mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-02-08 12:30:47 +00:00
dots: update minimal to match 6502
This commit is contained in:
parent
e2c14813ed
commit
a2feef02da
@ -28,9 +28,8 @@ static short rotcos=0;
|
|||||||
|
|
||||||
static void drawdots(void) {
|
static void drawdots(void) {
|
||||||
int temp32;
|
int temp32;
|
||||||
// int transx,transz;
|
|
||||||
unsigned short ball_x,ball_y,shadow_y;
|
unsigned short ball_x,ball_y,shadow_y;
|
||||||
unsigned short d,sc,newy;
|
unsigned short d,distance,newy;
|
||||||
unsigned short ax;
|
unsigned short ax;
|
||||||
short signed_ax;
|
short signed_ax;
|
||||||
|
|
||||||
@ -43,9 +42,10 @@ static void drawdots(void) {
|
|||||||
/* by= (ez/dz)*dy + ey */
|
/* by= (ez/dz)*dy + ey */
|
||||||
|
|
||||||
temp32=((dot_z[d]*rotcos)-(dot_x[d]*rotsin));
|
temp32=((dot_z[d]*rotcos)-(dot_x[d]*rotsin));
|
||||||
sc=(temp32>>16)+9000;
|
distance=(temp32>>16)+9000;
|
||||||
if (sc==0) sc=1;
|
if (distance==0) distance=1;
|
||||||
// printf("%d\n",sc-9000);
|
|
||||||
|
// printf("%d\n",distance-9000);
|
||||||
|
|
||||||
|
|
||||||
temp32=((dot_x[d]*rotcos)+(dot_z[d]*rotsin));
|
temp32=((dot_x[d]*rotcos)+(dot_z[d]*rotsin));
|
||||||
@ -53,9 +53,9 @@ static void drawdots(void) {
|
|||||||
|
|
||||||
temp32=temp32+(temp32>>3);
|
temp32=temp32+(temp32>>3);
|
||||||
|
|
||||||
ball_x=(temp32/sc)/8;
|
ball_x=(temp32/distance)/8;
|
||||||
|
|
||||||
// printf("%x/%x/8=%x\n",temp32,sc,ball_x);
|
// printf("%x/%x/8=%x\n",temp32,distance,ball_x);
|
||||||
|
|
||||||
/* center */
|
/* center */
|
||||||
ball_x+=20;
|
ball_x+=20;
|
||||||
@ -67,7 +67,7 @@ static void drawdots(void) {
|
|||||||
/* shadow */
|
/* shadow */
|
||||||
/**********/
|
/**********/
|
||||||
|
|
||||||
shadow_y=0x80000/sc/4;
|
shadow_y=0x80000/distance/4;
|
||||||
|
|
||||||
/* center it */
|
/* center it */
|
||||||
shadow_y+=24;
|
shadow_y+=24;
|
||||||
@ -110,7 +110,7 @@ static void drawdots(void) {
|
|||||||
|
|
||||||
temp32<<=6;
|
temp32<<=6;
|
||||||
|
|
||||||
newy=temp32/sc/4;
|
newy=temp32/distance/4;
|
||||||
|
|
||||||
/* center */
|
/* center */
|
||||||
ball_y=newy+24;
|
ball_y=newy+24;
|
||||||
|
@ -35,58 +35,36 @@ 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 ball_x,ball_y,shadow_y;
|
unsigned short ball_x,ball_y,shadow_y;
|
||||||
unsigned short d,sc,newy;
|
unsigned short d,distance,newy;
|
||||||
unsigned short ax,bx,cx,dx;
|
unsigned short ax;
|
||||||
short signed_ax;
|
short signed_ax;
|
||||||
|
|
||||||
for(d=0;d<512;d+=SKIP) {
|
for(d=0;d<512;d+=SKIP) {
|
||||||
|
|
||||||
transx=dot[d].x*rotsin;
|
temp32=(dot[d].z*rotcos)-(dot[d].x*rotsin);
|
||||||
transz=dot[d].z*rotcos;
|
distance=(temp32>>16)+9000;
|
||||||
temp32=transz-transx;
|
if (distance==0) distance=1;
|
||||||
sc=(temp32>>16)+9000;
|
|
||||||
if (sc==0) sc=1;
|
|
||||||
|
|
||||||
transx=dot[d].x*rotcos;
|
temp32=((dot[d].x*rotcos)+(dot[d].z*rotsin));
|
||||||
transz=dot[d].z*rotsin;
|
|
||||||
temp32=transx+transz;
|
|
||||||
temp32>>=8;
|
temp32>>=8;
|
||||||
|
|
||||||
ax=temp32&0xffff;
|
temp32=temp32+(temp32>>3);
|
||||||
dx=(temp32>>16)&0xffff;
|
|
||||||
|
|
||||||
bx=ax; // mov bx,ax
|
ball_x=(temp32/distance);
|
||||||
cx=dx; // mov cx,dx
|
|
||||||
|
|
||||||
ax=(ax>>3)|(dx<<13); // shrd ax,dx,3
|
|
||||||
|
|
||||||
// dx=sar(dx,3); // sar dx,3
|
|
||||||
signed_ax=dx;
|
|
||||||
dx=signed_ax>>3;
|
|
||||||
|
|
||||||
temp32=ax+bx; // add ax,bx
|
|
||||||
ax=ax+bx;
|
|
||||||
dx=dx+cx; // adc dx,cx
|
|
||||||
if (temp32&(1<<16)) dx=dx+1;
|
|
||||||
|
|
||||||
temp32=(dx<<16)|(ax&0xffff);
|
|
||||||
if (sc) ball_x=(temp32/sc)&0xffff;
|
|
||||||
else ball_x=0;
|
|
||||||
|
|
||||||
|
/* center */
|
||||||
ball_x+=160;
|
ball_x+=160;
|
||||||
|
|
||||||
/* if off end of screen, no need for shadow */
|
/* if off end of screen, no need for shadow */
|
||||||
|
|
||||||
if (ball_x>319) continue;
|
if (ball_x>319) continue;
|
||||||
|
|
||||||
/**********/
|
/**********/
|
||||||
/* shadow */
|
/* shadow */
|
||||||
/**********/
|
/**********/
|
||||||
|
|
||||||
shadow_y=0x80000/sc;
|
shadow_y=0x80000/distance;
|
||||||
|
|
||||||
/* center it */
|
/* center it */
|
||||||
shadow_y+=100;
|
shadow_y+=100;
|
||||||
@ -109,11 +87,9 @@ static void drawdots(void) {
|
|||||||
temp32=newy;
|
temp32=newy;
|
||||||
if (temp32&0x8000) temp32|=0xffff0000;
|
if (temp32&0x8000) temp32|=0xffff0000;
|
||||||
if (temp32>=gravitybottom) {
|
if (temp32>=gravitybottom) {
|
||||||
ax=-dot[d].yadd;
|
|
||||||
temp32=(-dot[d].yadd)*gravityd;
|
temp32=(-dot[d].yadd)*gravityd;
|
||||||
ax=temp32&0xffff;
|
ax=temp32&0xffff;
|
||||||
|
|
||||||
// ax=sar(ax,4);
|
|
||||||
signed_ax=ax;
|
signed_ax=ax;
|
||||||
ax=signed_ax>>4;
|
ax=signed_ax>>4;
|
||||||
|
|
||||||
@ -130,12 +106,8 @@ static void drawdots(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
temp32<<=6;
|
temp32<<=6;
|
||||||
// dx=(dx<<6)|(newy>>10); // shld dx,ax,6
|
|
||||||
// newy=newy<<6; // shl ax,6
|
|
||||||
// ax=newy;
|
|
||||||
// idiv_16(sc); // idiv sc
|
|
||||||
|
|
||||||
if (sc) newy=temp32/sc;
|
newy=temp32/distance;
|
||||||
|
|
||||||
/* center */
|
/* center */
|
||||||
ball_y=newy+100; // add ax,100
|
ball_y=newy+100; // add ax,100
|
||||||
|
Loading…
x
Reference in New Issue
Block a user