mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-06-08 15:29:41 +00:00
dots: more work on 6502
This commit is contained in:
parent
fd60bd5953
commit
9903d4ffc5
|
@ -18,12 +18,10 @@ static short gravitybottom;
|
||||||
static short gravity=0;
|
static short gravity=0;
|
||||||
static short gravityd=16;
|
static short gravityd=16;
|
||||||
|
|
||||||
static struct {
|
static short dot_x[MAXDOTS];
|
||||||
short x; // 0
|
static short dot_y[MAXDOTS];
|
||||||
short y; // 2
|
static short dot_z[MAXDOTS];
|
||||||
short z; // 4
|
static short dot_yadd[MAXDOTS];
|
||||||
short yadd; // 14
|
|
||||||
} dot[MAXDOTS];
|
|
||||||
|
|
||||||
static short rotsin=0;
|
static short rotsin=0;
|
||||||
static short rotcos=0;
|
static short rotcos=0;
|
||||||
|
@ -38,21 +36,21 @@ static void drawdots(void) {
|
||||||
|
|
||||||
for(d=0;d<MAXDOTS;d++) {
|
for(d=0;d<MAXDOTS;d++) {
|
||||||
|
|
||||||
transx=dot[d].x*rotsin;
|
transx=dot_x[d]*rotsin;
|
||||||
transz=dot[d].z*rotcos;
|
transz=dot_z[d]*rotcos;
|
||||||
temp32=transz-transx;
|
temp32=transz-transx;
|
||||||
sc=(temp32>>16)+9000;
|
sc=(temp32>>16)+9000;
|
||||||
if (sc==0) sc=1;
|
if (sc==0) sc=1;
|
||||||
|
|
||||||
transx=dot[d].x*rotcos;
|
transx=dot_x[d]*rotcos;
|
||||||
transz=dot[d].z*rotsin;
|
transz=dot_z[d]*rotsin;
|
||||||
temp32=transx+transz;
|
temp32=transx+transz;
|
||||||
temp32>>=8;
|
temp32>>=8;
|
||||||
|
#if 1
|
||||||
ax=temp32&0xffff;
|
ax=temp32&0xffff;
|
||||||
dx=(temp32>>16)&0xffff;
|
dx=(temp32>>16)&0xffff;
|
||||||
|
|
||||||
bx=ax; // mov bx,ax
|
bx=ax;
|
||||||
cx=dx; // mov cx,dx
|
cx=dx; // mov cx,dx
|
||||||
|
|
||||||
ax=(ax>>3)|(dx<<13); // shrd ax,dx,3
|
ax=(ax>>3)|(dx<<13); // shrd ax,dx,3
|
||||||
|
@ -60,16 +58,24 @@ static void drawdots(void) {
|
||||||
signed_ax=dx;
|
signed_ax=dx;
|
||||||
dx=signed_ax>>3;
|
dx=signed_ax>>3;
|
||||||
|
|
||||||
|
temp32=temp32>>3;
|
||||||
|
ax=temp32&0xffff;
|
||||||
|
dx=(temp32>>16)&0xffff;
|
||||||
|
|
||||||
temp32=ax+bx; // add ax,bx
|
temp32=ax+bx; // add ax,bx
|
||||||
ax=ax+bx;
|
ax=ax+bx;
|
||||||
dx=dx+cx; // adc dx,cx
|
dx=dx+cx; // adc dx,cx
|
||||||
if (temp32&(1<<16)) dx=dx+1;
|
if (temp32&(1<<16)) dx=dx+1;
|
||||||
|
|
||||||
temp32=(dx<<16)|(ax&0xffff);
|
temp32=(dx<<16)|(ax&0xffff);
|
||||||
|
#else
|
||||||
|
temp32=temp32+(temp32>>3);
|
||||||
|
#endif
|
||||||
ball_x=(temp32/sc)/8;
|
ball_x=(temp32/sc)/8;
|
||||||
|
|
||||||
ball_x+=20;
|
ball_x+=20;
|
||||||
|
|
||||||
|
|
||||||
/* if off end of screen, no need for shadow */
|
/* if off end of screen, no need for shadow */
|
||||||
|
|
||||||
if (ball_x>39) continue;
|
if (ball_x>39) continue;
|
||||||
|
@ -94,24 +100,24 @@ static void drawdots(void) {
|
||||||
/* ball */
|
/* ball */
|
||||||
/********/
|
/********/
|
||||||
|
|
||||||
dot[d].yadd+=gravity;
|
dot_yadd[d]+=gravity;
|
||||||
newy=dot[d].y+dot[d].yadd;
|
newy=dot_y[d]+dot_yadd[d];
|
||||||
|
|
||||||
temp32=newy;
|
temp32=newy;
|
||||||
if (temp32&0x8000) temp32|=0xffff0000;
|
if (temp32&0x8000) temp32|=0xffff0000;
|
||||||
if (temp32>=gravitybottom) {
|
if (temp32>=gravitybottom) {
|
||||||
ax=-dot[d].yadd;
|
//ax=-dot_yadd[d];
|
||||||
temp32=(-dot[d].yadd)*gravityd;
|
temp32=(-dot_yadd[d])*gravityd;
|
||||||
ax=temp32&0xffff;
|
ax=temp32&0xffff;
|
||||||
|
|
||||||
signed_ax=ax;
|
signed_ax=ax;
|
||||||
ax=signed_ax>>4;
|
ax=signed_ax>>4;
|
||||||
|
|
||||||
dot[d].yadd=ax;
|
dot_yadd[d]=ax;
|
||||||
newy+=dot[d].yadd;
|
newy+=dot_yadd[d];
|
||||||
}
|
}
|
||||||
|
|
||||||
dot[d].y=newy;
|
dot_y[d]=newy;
|
||||||
|
|
||||||
/* sign extend */
|
/* sign extend */
|
||||||
temp32=newy;
|
temp32=newy;
|
||||||
|
@ -181,18 +187,18 @@ int main(int argc,char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for(a=0;a<MAXDOTS;a++) {
|
for(a=0;a<MAXDOTS;a++) {
|
||||||
dot[a].x=0;
|
dot_x[a]=0;
|
||||||
dot[a].y=2560-dropper;
|
dot_y[a]=2560-dropper;
|
||||||
dot[a].z=0;
|
dot_z[a]=0;
|
||||||
dot[a].yadd=0;
|
dot_yadd[a]=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(a=0;a<(MAXDOTS-12);a++) { // scramble
|
for(a=0;a<(MAXDOTS-12);a++) { // scramble
|
||||||
b=rand()%MAXDOTS;
|
b=rand()%MAXDOTS;
|
||||||
c=rand()%MAXDOTS;
|
c=rand()%MAXDOTS;
|
||||||
d=dot[b].x; dot[b].x=dot[c].x; dot[c].x=d;
|
d=dot_x[b]; dot_x[b]=dot_x[c]; dot_x[c]=d;
|
||||||
d=dot[b].y; dot[b].y=dot[c].y; dot[c].y=d;
|
d=dot_y[b]; dot_y[b]=dot_y[c]; dot_y[c]=d;
|
||||||
d=dot[b].z; dot[b].z=dot[c].z; dot[c].z=d;
|
d=dot_z[b]; dot_z[b]=dot_z[c]; dot_z[c]=d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -224,10 +230,10 @@ int main(int argc,char **argv) {
|
||||||
// dot[i].x=isin(f*11)*40;
|
// dot[i].x=isin(f*11)*40;
|
||||||
// dot[i].y=icos(f*13)*10-dropper;
|
// dot[i].y=icos(f*13)*10-dropper;
|
||||||
// dot[i].z=isin(f*17)*40;
|
// dot[i].z=isin(f*17)*40;
|
||||||
dot[i].x=isin(f*8)*32;
|
dot_x[i]=isin(f*8)*32;
|
||||||
dot[i].y=icos(f*16)*8-dropper;
|
dot_y[i]=icos(f*16)*8-dropper;
|
||||||
dot[i].z=isin(f*16)*32;
|
dot_z[i]=isin(f*16)*32;
|
||||||
dot[i].yadd=0;
|
dot_yadd[i]=0;
|
||||||
}
|
}
|
||||||
/* bouncing ring */
|
/* bouncing ring */
|
||||||
else if(frame<643) {
|
else if(frame<643) {
|
||||||
|
@ -235,10 +241,10 @@ int main(int argc,char **argv) {
|
||||||
// dot[i].y=dropper;
|
// dot[i].y=dropper;
|
||||||
// dot[i].z=isin(f*15)*55;
|
// dot[i].z=isin(f*15)*55;
|
||||||
// dot[i].yadd=-260;
|
// dot[i].yadd=-260;
|
||||||
dot[i].x=icos(f*16)*48;
|
dot_x[i]=icos(f*16)*48;
|
||||||
dot[i].y=dropper;
|
dot_y[i]=dropper;
|
||||||
dot[i].z=isin(f*16)*48;
|
dot_z[i]=isin(f*16)*48;
|
||||||
dot[i].yadd=-260;
|
dot_yadd[i]=-260;
|
||||||
}
|
}
|
||||||
/* fountain */
|
/* fountain */
|
||||||
else if(frame<1214) {
|
else if(frame<1214) {
|
||||||
|
@ -248,17 +254,17 @@ int main(int argc,char **argv) {
|
||||||
// dot[i].z=isin(f*66)*a;
|
// dot[i].z=isin(f*66)*a;
|
||||||
// dot[i].yadd=-300;
|
// dot[i].yadd=-300;
|
||||||
a=sin1024[frame&1023]/8;
|
a=sin1024[frame&1023]/8;
|
||||||
dot[i].x=icos(f*64)*a;
|
dot_x[i]=icos(f*64)*a;
|
||||||
dot[i].y=8000;
|
dot_y[i]=8000;
|
||||||
dot[i].z=isin(f*64)*a;
|
dot_z[i]=isin(f*64)*a;
|
||||||
dot[i].yadd=-300;
|
dot_yadd[i]=-300;
|
||||||
}
|
}
|
||||||
/* swirling */
|
/* swirling */
|
||||||
else if(frame<1686) {
|
else if(frame<1686) {
|
||||||
dot[i].x=rand()-16384;
|
dot_x[i]=rand()-16384;
|
||||||
dot[i].y=8000-rand()/2;
|
dot_y[i]=8000-rand()/2;
|
||||||
dot[i].z=rand()-16384;
|
dot_z[i]=rand()-16384;
|
||||||
dot[i].yadd=0;
|
dot_yadd[i]=0;
|
||||||
if(frame>1357 && !(frame&31) && grav>0) grav--;
|
if(frame>1357 && !(frame&31) && grav>0) grav--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user