mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-06-08 15:29:41 +00:00
gr-sim: dots: more minimal
This commit is contained in:
parent
59e302544b
commit
7e7ba324e2
|
@ -38,41 +38,28 @@ static short rotcos=0;
|
||||||
|
|
||||||
static void drawdots(void) {
|
static void drawdots(void) {
|
||||||
int temp32;
|
int temp32;
|
||||||
|
int transx,transz;
|
||||||
int yy;
|
int yy;
|
||||||
|
unsigned short our_x,our_y;
|
||||||
// cx=dotnum; // mov cx,cs:_dotnum
|
|
||||||
// si=0; // mov si,OFFSET dot
|
|
||||||
|
|
||||||
for(si=0;si<512;si+=SKIP) {
|
for(si=0;si<512;si+=SKIP) {
|
||||||
// push(cx); // push cx
|
|
||||||
ax=dot[si].x; // mov ax,ds:[si+0] ;X
|
|
||||||
imul_16(rotsin); // imul ds:_rotsin
|
|
||||||
ax=ax; // mov ax,ax
|
|
||||||
cx=dx; // mov cx,dx
|
|
||||||
ax=dot[si].z; // mov ax,ds:[si+4] ;Z
|
|
||||||
imul_16(rotcos); // imul ds:_rotcos
|
|
||||||
ax=ax-bx; // sub ax,bx
|
|
||||||
dx=dx-cx; // sub dx,cx
|
|
||||||
bp=dx; // mov bp,dx
|
|
||||||
bp=bp+9000; // add bp,9000
|
|
||||||
|
|
||||||
ax=dot[si].x; // mov ax,ds:[si+0] ;X
|
transx=dot[si].x*rotsin;
|
||||||
imul_16(rotcos); // imul ds:_rotcos
|
transz=dot[si].z*rotcos;
|
||||||
bx=ax; // mov bx,ax
|
temp32=transz-transx;
|
||||||
cx=dx; // mov cx,dx
|
bp=(temp32>>16)+9000;
|
||||||
ax=dot[si].z; // mov ax,ds:[si+4] ;Z
|
|
||||||
imul_16(rotsin); // imul ds:_rotsin
|
|
||||||
|
|
||||||
temp32=ax+bx; // add ax,bx
|
transx=dot[si].x*rotcos;
|
||||||
ax=ax+bx; //
|
transz=dot[si].z*rotsin;
|
||||||
dx=dx+cx; // adc dx,cx
|
temp32=transx+transz;
|
||||||
if (temp32&(1<<16)) dx=dx+1;
|
temp32>>=8;
|
||||||
|
|
||||||
ax=(ax>>8)|(dx<<8); // shrd ax,dx,8
|
ax=temp32&0xffff;
|
||||||
dx=sar(dx,8); // sar dx,8
|
dx=(temp32>>16)&0xffff;
|
||||||
|
|
||||||
bx=ax; // mov bx,ax
|
bx=ax; // mov 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
|
||||||
|
|
||||||
dx=sar(dx,3); // sar dx,3
|
dx=sar(dx,3); // sar dx,3
|
||||||
|
@ -83,14 +70,12 @@ static void drawdots(void) {
|
||||||
|
|
||||||
temp32=(dx<<16)|(ax&0xfffff);
|
temp32=(dx<<16)|(ax&0xfffff);
|
||||||
idiv_16(bp); // idiv bp
|
idiv_16(bp); // idiv bp
|
||||||
ax=ax+160; // add ax,160
|
our_x=ax+160; // add ax,160
|
||||||
push(ax); // push ax
|
|
||||||
|
|
||||||
/* if off end of screen, no need for shadow */
|
/* if off end of screen, no need for shadow */
|
||||||
|
|
||||||
if (ax>319) goto label2; // cmp ax,319
|
if (our_x>319) continue;
|
||||||
|
|
||||||
// ja @@2
|
|
||||||
/**********/
|
/**********/
|
||||||
/* shadow */
|
/* shadow */
|
||||||
/**********/
|
/**********/
|
||||||
|
@ -101,17 +86,13 @@ static void drawdots(void) {
|
||||||
ax=ax+100; // add ax,100
|
ax=ax+100; // add ax,100
|
||||||
|
|
||||||
/* if shadow off screen, don't draw */
|
/* if shadow off screen, don't draw */
|
||||||
if (ax>199) goto label2; // cmp ax,199
|
if (ax>199) continue; // cmp ax,199
|
||||||
// ja @@2
|
// ja @@2
|
||||||
bx=ax; // mov bx,ax
|
bx=ax; // mov bx,ax
|
||||||
|
|
||||||
// not needed, it's a C array
|
// not needed, it's a C array
|
||||||
//bx=bx<<1; // shl bx,1
|
|
||||||
bx=rows[bx]; // mov bx,ds:_rows[bx]
|
bx=rows[bx]; // mov bx,ds:_rows[bx]
|
||||||
ax=pop(); // pop ax
|
bx=bx+our_x; // add bx,ax
|
||||||
bx=bx+ax; // add bx,ax
|
|
||||||
push(ax); // push ax
|
|
||||||
|
|
||||||
|
|
||||||
/* draw shadow */
|
/* draw shadow */
|
||||||
|
|
||||||
|
@ -121,70 +102,57 @@ static void drawdots(void) {
|
||||||
color_equals(0);
|
color_equals(0);
|
||||||
plot( (bx%320)/8,yy);
|
plot( (bx%320)/8,yy);
|
||||||
|
|
||||||
/********/
|
/********/
|
||||||
/* ball */
|
/* ball */
|
||||||
/********/
|
/********/
|
||||||
|
|
||||||
dot[si].yadd+=gravity;
|
dot[si].yadd+=gravity;
|
||||||
ax=dot[si].y+dot[si].yadd;
|
ax=dot[si].y+dot[si].yadd;
|
||||||
|
|
||||||
temp32=ax;
|
temp32=ax;
|
||||||
if (temp32&0x8000) temp32|=0xffff0000;
|
if (temp32&0x8000) temp32|=0xffff0000;
|
||||||
if (temp32<gravitybottom) goto label4; //cmp ax,ds:_gravitybottom
|
if (temp32>=gravitybottom) {
|
||||||
// jl @@4
|
push(ax); // push ax
|
||||||
|
ax=-dot[si].yadd;
|
||||||
|
imul_16(gravityd); // imul cs:_gravityd
|
||||||
|
ax=sar(ax,4); // sar ax,4
|
||||||
|
dot[si].yadd=ax; // mov ds:[si+14],ax
|
||||||
|
ax=pop(); // pop ax
|
||||||
|
ax+=dot[si].yadd; // add ax,ds:[si+14]
|
||||||
|
}
|
||||||
|
|
||||||
push(ax); // push ax
|
dot[si].y=ax; // mov ds:[si+2],ax
|
||||||
ax=-dot[si].yadd;
|
if (ax&0x8000) { // cwd
|
||||||
imul_16(gravityd); // imul cs:_gravityd
|
dx=0xffff;
|
||||||
ax=sar(ax,4); // sar ax,4
|
}
|
||||||
dot[si].yadd=ax; // mov ds:[si+14],ax
|
else {
|
||||||
ax=pop(); // pop ax
|
dx=0;
|
||||||
ax+=dot[si].yadd; // add ax,ds:[si+14]
|
}
|
||||||
|
dx=(dx<<6)|(ax>>10); // shld dx,ax,6
|
||||||
|
ax=ax<<6; // shl ax,6
|
||||||
|
idiv_16(bp); // idiv bp
|
||||||
|
our_y=ax+100; // add ax,100
|
||||||
|
if (our_y>199) continue; // cmp ax,199
|
||||||
|
|
||||||
label4:
|
bp=bp>>6; // shr bp,6
|
||||||
dot[si].y=ax; // mov ds:[si+2],ax
|
bp=bp&(~3L); // and bp,not 3
|
||||||
if (ax&0x8000) { // cwd
|
|
||||||
dx=0xffff;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
dx=0;
|
|
||||||
}
|
|
||||||
dx=(dx<<6)|(ax>>10); // shld dx,ax,6
|
|
||||||
ax=ax<<6; // shl ax,6
|
|
||||||
idiv_16(bp); // idiv bp
|
|
||||||
ax=ax+100; // add ax,100
|
|
||||||
if (ax>199) goto label3; // cmp ax,199
|
|
||||||
// ja @@3
|
|
||||||
bx=ax; // mov bx,ax
|
|
||||||
|
|
||||||
// not needed, C array
|
temp32=bp;
|
||||||
//bx=bx<<1; // shl bx,1
|
if (temp32&0x8000) temp32|=0xffff0000;
|
||||||
bx=rows[bx]; // mov bx,ds:_rows[bx]
|
if (temp32<bpmin) {
|
||||||
|
bpmin=bp;
|
||||||
|
}
|
||||||
|
|
||||||
ax=pop(); // pop ax
|
temp32=bp;
|
||||||
push(ax);
|
if (temp32&0x8000) temp32|=0xffff0000;
|
||||||
bx=bx+ax; // add bx,ax
|
if (temp32>bpmax) {
|
||||||
bp=bp>>6; // shr bp,6
|
bpmax=bp;
|
||||||
bp=bp&(~3L); // and bp,not 3
|
}
|
||||||
|
|
||||||
temp32=bp;
|
/* plot ball */
|
||||||
if (temp32&0x8000) temp32|=0xffff0000;
|
yy=(our_y*48)/200;
|
||||||
if (temp32>=bpmin) goto label_t1; // cmp bp,cs:_bpmin
|
color_equals(6);
|
||||||
// jge @@t1
|
plot(our_x/8,yy);
|
||||||
bpmin=bp; // mov cs:_bpmin,bp
|
|
||||||
label_t1:
|
|
||||||
temp32=bp;
|
|
||||||
if (temp32&0x8000) temp32|=0xffff0000;
|
|
||||||
if (temp32<=bpmax) goto label_t2; // cmp bp,cs:_bpmax
|
|
||||||
// jle @@t2
|
|
||||||
bpmax=bp; // mov cs:_bpmax,bp
|
|
||||||
label_t2:
|
|
||||||
yy=((bx/320)*48)/200;
|
|
||||||
color_equals(6);
|
|
||||||
plot( (bx%320)/8,yy);
|
|
||||||
label2:
|
|
||||||
label3:
|
|
||||||
bx=pop(); // pop bx
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user