#include #include #include #include int horizony=70; int bailstart=0; // must be divisible by 2 int bail=192; int bailhalve=64; int group=500; int zwave[1024]; FILE *f1; void P(char *str,...) { char out[256]; va_list argp; va_start(argp,str); vsprintf(out,str,argp); fprintf(f1,"%s\n",out); va_end(argp); } long wflip(unsigned long l) { long m,lo,hi; lo=l&0xffff; hi=l>>16; m=(lo<<16)+hi; return(m); } main() { int i,j,jm,y,a; int sina=1; long l,firstraydir; f1=fopen("theloop.inc","wt"); for(i=0;iscreen "); P(";ds ->codesegment"); P(";es ->screenbuffer"); P(";fs ->wavetablex"); P(";gs ->wavetabley"); P(""); P("ALIGN 16 ;following should stay in cache"); P("theloop_waveseg dw 0"); P("theloop_xsina1 dw 0"); P("theloop_ysina1 dw 0"); P("theloop_xsina2 dw 0"); P("theloop_ysina2 dw 0"); P("theloop_heigth dw 0"); firstraydir=-(200-horizony)*2560L; P(""); P(";entry: es=videbuf"); P("; bp=pointer to bottom of current column in videbuf"); P("; fs=waveXsegment"); P("; gs=waveYsegment"); P("; si=waveXpos"); P("; di=waveYpos"); P("; cx=waveXadd"); P("; dx=waveYadd"); P("; ax=camera heigth adder"); P("theloop PROC FAR"); P("mov cs:theloop_xsina1,cx"); P("mov cs:theloop_ysina1,dx"); P("add cx,cx"); P("mov cs:theloop_xsina2,cx"); P("add dx,dx"); P("mov cs:theloop_ysina2,dx"); P("mov cs:theloop_heigth,ax"); P("mov ax,cs"); P("mov ds,ax"); P("xor eax,eax"); P("mov ecx,0%08lXh",wflip(firstraydir)); for(i=bailstart;ibail) jm=bail; for(j=i;j=bail) { P("_@seek%i:",bail); P("_@seekr%i:",bail); P("ret"); } else P("jmp _@seek%i",jm); } P("theloop ENDP"); printf(" \r",i); fclose(f1); }