From: sparky4 Date: Fri, 11 Aug 2017 19:13:16 +0000 (-0500) Subject: dots for a simple port but damn it! X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=fdc075517b50afa6cdf1c83d523d112fb79e8abc;p=plz.git dots for a simple port but damn it! --- diff --git a/dots/a b/dots/a new file mode 100755 index 0000000..d01757e Binary files /dev/null and b/dots/a differ diff --git a/dots/asm.asm b/dots/asm.asm new file mode 100755 index 0000000..16b8e52 --- /dev/null +++ b/dots/asm.asm @@ -0,0 +1,251 @@ +include clink.inc +code SEGMENT para public 'CODE' +ASSUME cs:code + +.386 + +MAXDOTS equ 1024 + +BOTTOM equ 8000 + +public _gravitybottom +_gravitybottom dw BOTTOM + +public _bpmin,_bpmax +_bpmin dw 30000 +_bpmax dw -30000 + +public _gravity +_gravity dw 0 + +public _dotnum +_dotnum dw 0 + +public _gravityd +_gravityd dw 16 + +dw -1280 +dw -960 +dw -640 +dw -320 +public _rows +_rows dw 200 dup(0) + +public _dot +_dot LABEL WORD +dot dw MAXDOTS dup(0,0,0,0,0,0,0,0) ;x,y,z,oldposshadow,oldpos,-,-,- + +public _rotsin,_rotcos +_rotsin dw 0 +_rotcos dw 0 + +public _bgpic +_bgpic dw 0,0 + +public _depthtable1,_depthtable2,_depthtable3,_depthtable4 +_depthtable1 dd 128 dup(0) +_depthtable2 dd 128 dup(0) +_depthtable3 dd 128 dup(0) +_depthtable4 dd 128 dup(0) + +public _drawdots +_drawdots PROC FAR + CBEG + mov ax,0a000h + mov es,ax + mov ax,cs + mov ds,ax + mov fs,cs:_bgpic[2] + mov cx,cs:_dotnum + mov si,OFFSET dot +@@loo: +@@1: push cx + + mov ax,ds:[si+0] ;X + imul ds:_rotsin + mov ax,ax + mov cx,dx + mov ax,ds:[si+4] ;Z + imul ds:_rotcos + sub ax,bx + sub dx,cx + mov bp,dx + add bp,9000 + + mov ax,ds:[si+0] ;X + imul ds:_rotcos + mov bx,ax + mov cx,dx + mov ax,ds:[si+4] ;Z + imul ds:_rotsin + add ax,bx + adc dx,cx + shrd ax,dx,8 + sar dx,8 + + mov bx,ax + mov cx,dx + shrd ax,dx,3 + sar dx,3 + add ax,bx + adc dx,cx + + idiv bp + add ax,160 + push ax + cmp ax,319 + ja @@2 + + ;shadow + + xor ax,ax + mov dx,8 + idiv bp + add ax,100 + cmp ax,199 + ja @@2 + mov bx,ax + shl bx,1 + mov bx,ds:_rows[bx] + pop ax + add bx,ax + push ax + + mov di,ds:[si+6] + mov ax,fs:[di] + mov es:[di],ax + mov ax,87+87*256 + mov word ptr es:[bx],ax + mov ds:[si+6],bx + + ;ball + + mov ax,ds:_gravity + add ds:[si+14],ax + mov ax,ds:[si+2] ;Y + add ax,ds:[si+14] + cmp ax,ds:_gravitybottom + jl @@4 + push ax + mov ax,ds:[si+14] + neg ax + imul cs:_gravityd + sar ax,4 + mov ds:[si+14],ax + pop ax + add ax,ds:[si+14] +@@4: mov ds:[si+2],ax + cwd + shld dx,ax,6 + shl ax,6 + idiv bp + add ax,100 + cmp ax,199 + ja @@3 + mov bx,ax + shl bx,1 + mov bx,ds:_rows[bx] + pop ax + add bx,ax + + mov di,ds:[si+8] + mov eax,fs:[di] + mov es:[di],eax + add di,320 + mov eax,fs:[di] + mov es:[di],eax + add di,320 + mov eax,fs:[di] + mov es:[di],eax +; add di,320 +; mov eax,fs:[di] +; mov es:[di],eax + shr bp,6 + and bp,not 3 + + cmp bp,cs:_bpmin + jge @@t1 + mov cs:_bpmin,bp +@@t1: cmp bp,cs:_bpmax + jle @@t2 + mov cs:_bpmax,bp +@@t2: + mov ax,word ptr ds:_depthtable1[bp] + mov word ptr es:[bx+1],ax + mov eax,ds:_depthtable2[bp] + mov dword ptr es:[bx+320],eax + mov ax,word ptr ds:_depthtable3[bp] + mov word ptr es:[bx+641],ax + mov ds:[si+8],bx + +@@z: pop cx + add si,16 + loop @@1oo +@@0: CEND + +@@2: mov di,ds:[si+8] + mov eax,fs:[di] + mov es:[di],eax + add di,320 + mov eax,fs:[di] + mov es:[di],eax + add di,320 + mov eax,fs:[di] + mov es:[di],eax + mov di,ds:[si+6] + mov ds:[si+6],ax + mov ax,fs:[di] + mov es:[di],ax + pop bx + pop cx + add si,16 + loop @@1 + jmp @@0 +@@3: mov di,ds:[si+8] + mov eax,fs:[di] + mov es:[di],eax + add di,320 + mov eax,fs:[di] + mov es:[di],eax + add di,320 + mov eax,fs:[di] + mov es:[di],eax + pop bx + pop cx + add si,16 + loop @@1 + jmp @@0 +_drawdots ENDP + +PUBLIC _setpalette +_setpalette PROC FAR + push bp + mov bp,sp + push si + push di + push ds + mov si,[bp+6] + mov ds,[bp+8] + mov dx,3c8h + mov al,0 + out dx,al + inc dx + mov cx,768 + rep outsb + pop ds + pop di + pop si + pop bp + ret +_setpalette ENDP + +_face LABEL WORD +public _face +include face.inc +dw 30000,30000,30000 + +PUBLIC _sin1024 +include sin1024.inc + +code ENDS +END diff --git a/dots/asm.c b/dots/asm.c new file mode 100755 index 0000000..e69de29 diff --git a/dots/asm.h b/dots/asm.h new file mode 100755 index 0000000..e69de29 diff --git a/dots/clink.inc b/dots/clink.inc new file mode 100755 index 0000000..3d5effb --- /dev/null +++ b/dots/clink.inc @@ -0,0 +1,41 @@ +FIXWORD MACRO ;go to word boundary + if ($-start) mod 1 + db 0 + endif + ENDM + +CDS MACRO + mov ax,cs + mov ds,ax + ENDM + +CBEG MACRO ;C/Assembler procedure begin + push bp + mov bp,sp + push si + push di + push ds + ENDM + +CEND MACRO ;C/Assembler procedure end + pop ds + pop di + pop si + pop bp + ret + ENDM + +CBEG0 MACRO ;C/Assembler procedure begin, minimal + push bp + mov bp,sp + ENDM + +CEND0 MACRO ;C/Assembler procedure end, minimal + pop bp + ret + ENDM + +movpar MACRO reg,par ;loads parameter [par(0..)] to register [reg] + mov reg,[bp+par*2+6] + ENDM + diff --git a/dots/cut b/dots/cut new file mode 100755 index 0000000..0dd2c9c --- /dev/null +++ b/dots/cut @@ -0,0 +1,86 @@ + #if 0 + switch(mode=c) + { + case 0: + for(a=0;a +#include +#include +#include +#include +#include +#include "../dis/dis.h" + +extern int face[]; + +extern int bpmin,bpmax; + +extern char *bgpic; +extern int rotsin,rotcos; +extern int rows[]; +extern long depthtable1[]; +extern long depthtable2[]; +extern long depthtable3[]; +extern long depthtable4[]; + +extern int dotnum; + +extern void drawdots(void); + +char far *vram=(char far *)0xa0000000L; + +char pal[768]; +char pal2[768]; + +extern sin1024[]; + +int isin(int deg) +{ + return(sin1024[deg&1023]); +} + +int icos(int deg) +{ + return(sin1024[(deg+256)&1023]); +} + +extern struct +{ + int x; + int y; + int z; + int old1; + int old2; + int old3; + int old4; + int yadd; +} dot[]; + +extern int gravity; +extern int gravitybottom; +extern int gravityd; + +void setborder(unsigned char color) +{ + _asm + { + mov dx,3dah + in al,dx + mov dx,3c0h + mov al,11h+32 + out dx,al + mov al,color + out dx,al + } +} + +int cols[]={ +0,0,0, +4,25,30, +8,40,45, +16,55,60}; +int dottaul[1024]; + +int main(int argc,char *argv[]) +{ + int timer=30000; + int dropper,repeat; + int frame=0; + int rota=-1*64; + int fb=0; + int rot=0,rots=0; + int a,b,c,d,i,j,mode; + int grav,gravd; + int f=0; + dis_partstart(); + dotnum=512; + for(a=0;a15) c=15; + c=15-c; + depthtable1[a]=0x202+0x04040404*c; + depthtable2[a]=0x02030302+0x04040404*c; + depthtable3[a]=0x202+0x04040404*c; + //depthtable4[a]=0x02020302+0x04040404*c; + } + bgpic=halloc(64000L,1L); + memcpy(bgpic,vram,64000); + a=0; + for(b=64;b>=0;b--) + { + for(c=0;c<768;c++) + { + a=pal[c]-b; + if(a<0) a=0; + pal2[c]=a; + } + dis_waitb(); + dis_waitb(); + outp(0x3c8,0); + for(c=0;c<768;c++) outp(0x3c9,pal2[c]); + } + + while(!dis_exit() && frame<2450) + { + //setborder(0); + repeat=dis_waitb(); + if(frame>2300) setpalette(pal2); + //setborder(1); + if(dis_indemo()) + { + a=dis_musplus(); + if(a>-4 && a<0) break; + } + while(repeat--) + { + frame++; + if(frame==500) f=0; + i=dottaul[j]; + j++; j%=dotnum; + if(frame<500) + { + dot[i].x=isin(f*11)*40; + dot[i].y=icos(f*13)*10-dropper; + dot[i].z=isin(f*17)*40; + dot[i].yadd=0; + } + else if(frame<900) + { + dot[i].x=icos(f*15)*55; + dot[i].y=dropper; + dot[i].z=isin(f*15)*55; + dot[i].yadd=-260; + } + else if(frame<1700) + { + a=sin1024[frame&1023]/8; + dot[i].x=icos(f*66)*a; + dot[i].y=8000; + dot[i].z=isin(f*66)*a; + dot[i].yadd=-300; + } + else if(frame<2360) + { + /* + a=rand()/128+32; + dot[i].y=8000-a*80; + b=rand()&1023; + a+=rand()&31; + dot[i].x=sin1024[b]*a/3+(a-50)*7; + dot[i].z=sin1024[(b+256)&1023]*a/3+(a-40)*7; + dot[i].yadd=300; + if(frame>1640 && !(frame&31) && grav>-2) grav--; + */ + dot[i].x=rand()-16384; + dot[i].y=8000-rand()/2; + dot[i].z=rand()-16384; + dot[i].yadd=0; + if(frame>1900 && !(frame&31) && grav>0) grav--; + } + else if(frame<2400) + { + a=frame-2360; + for(b=0;b<768;b+=3) + { + c=pal[b+0]+a*3; + if(c>63) c=63; + pal2[b+0]=c; + c=pal[b+1]+a*3; + if(c>63) c=63; + pal2[b+1]=c; + c=pal[b+2]+a*4; + if(c>63) c=63; + pal2[b+2]=c; + } + } + else if(frame<2440) + { + a=frame-2400; + for(b=0;b<768;b+=3) + { + c=63-a*2; + if(c<0) c=0; + pal2[b+0]=c; + pal2[b+1]=c; + pal2[b+2]=c; + } + } + if(dropper>4000) dropper-=100; + rotcos=icos(rot)*64; rotsin=isin(rot)*64; + rots+=2; + if(frame>1900) + { + rot+=rota/64; + rota--; + } + else rot=isin(rots); + f++; + gravity=grav; + gravityd=gravd; + } + drawdots(); + } + if(!dis_indemo()) + { + _asm mov ax,3h + _asm int 10h + } + return(0); +} diff --git a/dots/dots.lnk b/dots/dots.lnk new file mode 100755 index 0000000..69615a8 --- /dev/null +++ b/dots/dots.lnk @@ -0,0 +1,6 @@ +debug dwarf all +option stack=32768 +system dos +file dots.obj +name dots.exe +option map=dots.meh diff --git a/dots/dots.meh b/dots/dots.meh new file mode 100755 index 0000000..c5864b4 --- /dev/null +++ b/dots/dots.meh @@ -0,0 +1,255 @@ +Open Watcom Linker Version 2.0 beta Nov 19 2016 01:49:19 (64-bit) +Copyright (c) 2002-2016 The Open Watcom Contributors. All Rights Reserved. +Portions Copyright (c) 1985-2002 Sybase, Inc. All Rights Reserved. +Created on: 17/08/11 14:12:27 +Executable Image: dots.exe +creating a DOS executable +Error! E2028: _sin1024 is an undefined reference +Error! E2028: dis_partstart_ is an undefined reference +Error! E2028: _dotnum is an undefined reference +Error! E2028: _dot is an undefined reference +Error! E2028: _gravitybottom is an undefined reference +Error! E2028: _rows is an undefined reference +Error! E2028: _depthtable1 is an undefined reference +Error! E2028: _depthtable2 is an undefined reference +Error! E2028: _depthtable3 is an undefined reference +Error! E2028: _bgpic is an undefined reference +Error! E2028: dis_waitb_ is an undefined reference +Error! E2028: dis_exit_ is an undefined reference +Error! E2028: setpalette_ is an undefined reference +Error! E2028: dis_indemo_ is an undefined reference +Error! E2028: dis_musplus_ is an undefined reference +Error! E2028: _rotcos is an undefined reference +Error! E2028: _rotsin is an undefined reference +Error! E2028: _gravity is an undefined reference +Error! E2028: _gravityd is an undefined reference +Error! E2028: drawdots_ is an undefined reference + + + +------------+ + | Groups | + +------------+ + +Group Address Size +===== ======= ==== + +DGROUP 01b9:0000 00008ee0 + + + + +--------------+ + | Segments | + +--------------+ + +Segment Class Group Address Size +======= ===== ===== ======= ==== + +dots_TEXT CODE AUTO 0000:0000 0000092e +_TEXT CODE AUTO 0000:0930 00001255 +FAR_DATA FAR_DATA AUTO 01b8:0005 00000000 +_NULL BEGDATA DGROUP 01b9:0000 00000020 +_AFTERNULL BEGDATA DGROUP 01bb:0000 00000002 +CONST DATA DGROUP 01bb:0002 00000000 +CONST2 DATA DGROUP 01bb:0002 00000000 +_DATA DATA DGROUP 01bc:0000 0000006e +XIB DATA DGROUP 01c2:000e 00000000 +XI DATA DGROUP 01c2:000e 00000012 +XIE DATA DGROUP 01c4:0000 00000000 +YIB DATA DGROUP 01c4:0000 00000000 +YI DATA DGROUP 01c4:0000 00000006 +YIE DATA DGROUP 01c4:0006 00000000 +STRINGS DATA DGROUP 01c4:0006 00000000 +DATA DATA DGROUP 01c4:0006 00000000 +_BSS BSS DGROUP 01c4:0006 00000e1c +STACK STACK DGROUP 02a7:0000 00008000 + + + +----------------+ + | Memory Map | + +----------------+ + +* = unreferenced symbol ++ = symbol only referenced locally + +Address Symbol +======= ====== + +Module: dots.obj(/dos/z/plz/dots/dots.c) +0000:0000+ isin_ +0000:0026+ icos_ +0000:004e+ setborder_ +0000:0082 main_ +01b9:0030+ _vram +01b9:0034+ _cols +01b9:00b6+ _dottaul +01b9:08b6+ _pal2 +01b9:0bb6+ _pal +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(stk086.asm) +0000:0935 __STK +0000:0955* __STKOVERFLOW_ +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(rand.c) +0000:0972 rand_ +0000:09b4* srand_ +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(i4m.asm) +0000:09d8 __I4M +0000:09d8 __U4M +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(haloc.c) +0000:0a05 halloc_ +0000:0aae* hfree_ +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(cstart) +01b9:0000* __nullarea +01b9:0052* __ovlflag +01b9:0053* __intno +01b9:0054* __ovlvec +0000:0ab6 _cstart_ +0000:0b89* _Not_Enough_Memory_ +0000:0cbb __exit_ +0000:0cd8 __do_exit_with_msg__ +0000:0d31 __GETDS +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(cmodel.asm) +0000:0d3c _big_code_ +0000:0d3c* CodeModelMismatch +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(argcv.c) +01b9:0eb6 __argv +01b9:0eba ___argv +01b9:0ebe __argc +01b9:0ec0 ___argc +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(xmsg.c) +0000:0d3c* __exit_with_msg_ +0000:0d41 __fatal_runtime_error_ +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(crwdata) +01b9:0058 __curbrk +01b9:0060 __STACKLOW +01b9:0062 __STACKTOP +01b9:0064 __cbyte +01b9:0066 __child +01b9:0068 __no87 +01b9:0075 ___FPE_handler +01b9:005a __psp +01b9:0069 __get_ovl_stack +01b9:006d __restore_ovl_stack +01b9:0071 __close_ovl_file +01b9:0079 __LpCmdLine +01b9:007d __LpPgmName +01b9:005c __osmajor +01b9:005d __osminor +01b9:005e __osmode +01b9:005f __HShift +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(pia.asm) +0000:0d63 __PIA +0000:0d5c* __PIS +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(cmain086.c) +0000:0d7a __CMain +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(initrtns.c) +0000:0ddb __InitRtns +0000:0ddb* __FInitRtns +0000:0e36 __FiniRtns +0000:0e36* __FFiniRtns +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(uselfn.c) +01b9:0082 ___uselfn +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(dosseg) +0000:0e9a __DOSseg__ +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(initargv.c) +0000:1098 __Init_Argv_ +0000:10fa __Fini_Argv_ +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(enterdb.c) +0000:1124 __EnterWVIDEO_ +01b9:0084+ ___WD_Present +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(___argc.c) +01b9:0ec6 ____Argv +01b9:0eca ____Argc +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(amblksiz.c) +01b9:0086 __amblksiz +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(exit.c) +0000:1148+ __null_int23_exit_ +0000:1149 exit_ +0000:1161* _exit_ +01b9:0088+ ___int23_exit +01b9:008c+ ___FPE_handler_exit +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(sgdef086) +01b9:009e __Start_XI +01b9:00b0 __End_XI +01b9:00b0 __Start_YI +01b9:00b6 __End_YI +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(nmalloc.c) +0000:117c _nmalloc_ +01b9:0090 ___nheapbeg +01b9:0092 ___MiniHeapRover +01b9:0094 ___LargestSizeB4MiniHeapRover +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(fmalloc.c) +0000:1253* _fmalloc_ +0000:1253 malloc_ +01b9:0096+ ___fheap +01b9:0098 ___fheapRover +01b9:009a ___LargestSizeB4Rover +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(histsplt.c) +01b9:0ecc ___historical_splitparms +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(ffree.c) +0000:1365* _ffree_ +0000:1365 free_ +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(mem.c) +0000:13b0 __MemAllocator +0000:147a __MemFree +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(nmemneed.c) +0000:15e6 __nmemneed_ +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(grownear.c) +0000:166e __LastFree_ +0000:16e8 __ExpandDGROUP_ +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(growseg.c) +0000:17f9 __GrowSeg_ +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(allocseg.c) +0000:18e9 __AllocSeg_ +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(fmemneed.c) +0000:1980 __fmemneed_ +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(heapgrow.c) +0000:1983* _heapgrow_ +0000:1983* _fheapgrow_ +0000:1984 _nheapgrow_ +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(nfree.c) +0000:19fb _nfree_ +01b9:0ece+ ___MiniHeapFreeRover +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(heapen.c) +0000:1af6* _heapenable_ +01b9:009c ___heap_enabled +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(sbrk.c) +0000:1b07 __brk_ +0000:1b6e* sbrk_ +Module: /dos/fdos/watcom2/lib286/dos/clibl.lib(errno.c) +0000:1b7e* __get_errno_ptr_ +01b9:0ed0 _errno + + + +---------------------------+ + | Unresolved References | + +---------------------------+ + +Undefined Symbol Referenced by +================ ============= + +_sin1024 dots.obj(/dos/z/plz/dots/dots.c) +dis_partstart_ dots.obj(/dos/z/plz/dots/dots.c) +_dotnum dots.obj(/dos/z/plz/dots/dots.c) +_dot dots.obj(/dos/z/plz/dots/dots.c) +_gravitybottom dots.obj(/dos/z/plz/dots/dots.c) +_rows dots.obj(/dos/z/plz/dots/dots.c) +_depthtable1 dots.obj(/dos/z/plz/dots/dots.c) +_depthtable2 dots.obj(/dos/z/plz/dots/dots.c) +_depthtable3 dots.obj(/dos/z/plz/dots/dots.c) +_bgpic dots.obj(/dos/z/plz/dots/dots.c) +dis_waitb_ dots.obj(/dos/z/plz/dots/dots.c) +dis_exit_ dots.obj(/dos/z/plz/dots/dots.c) +setpalette_ dots.obj(/dos/z/plz/dots/dots.c) +dis_indemo_ dots.obj(/dos/z/plz/dots/dots.c) +dis_musplus_ dots.obj(/dos/z/plz/dots/dots.c) +_rotcos dots.obj(/dos/z/plz/dots/dots.c) +_rotsin dots.obj(/dos/z/plz/dots/dots.c) +_gravity dots.obj(/dos/z/plz/dots/dots.c) +_gravityd dots.obj(/dos/z/plz/dots/dots.c) +drawdots_ dots.obj(/dos/z/plz/dots/dots.c) + + + +--------------------+ + | Libraries Used | + +--------------------+ + +/dos/fdos/watcom2/lib286/dos/clibl.lib diff --git a/dots/dots.obj b/dots/dots.obj new file mode 100755 index 0000000..7735faf Binary files /dev/null and b/dots/dots.obj differ diff --git a/dots/dp_prefs b/dots/dp_prefs new file mode 100755 index 0000000..f76dcd5 Binary files /dev/null and b/dots/dp_prefs differ diff --git a/dots/face.c b/dots/face.c new file mode 100755 index 0000000..7012189 --- /dev/null +++ b/dots/face.c @@ -0,0 +1,26 @@ +#include + +char buf[1024]; + +main() +{ + FILE *f1; + int a,b,c=0; + float x,y,z; + f1=fopen("face.asc","rt"); + while(!feof(f1)) + { + fgets(buf,1024,f1); + fgets(buf,1024,f1); + if(!memcmp(buf,"Vertex ",7)) + { + if(c) + { + sscanf(buf,"Vertex %i: X: %f Y: %f Z: %f",&a,&x,&y,&z); + printf("dw %i,%i,%i\n",(int)(x*1000),-(int)(z*1000),(int)(y*1000)); + } + else c=1; + } + } + fclose(f1); +} diff --git a/dots/face.exe b/dots/face.exe new file mode 100755 index 0000000..419e449 Binary files /dev/null and b/dots/face.exe differ diff --git a/dots/face.inc b/dots/face.inc new file mode 100755 index 0000000..301b1c0 --- /dev/null +++ b/dots/face.inc @@ -0,0 +1 @@ +dw 2248,-2306,0 diff --git a/dots/main.c b/dots/main.c new file mode 100755 index 0000000..8bc0af6 --- /dev/null +++ b/dots/main.c @@ -0,0 +1,291 @@ +#include +#include +#include +#include +#include +#include +#include "..\dis\dis.h" + +extern int face[]; + +extern int bpmin,bpmax; + +extern char *bgpic; +extern int rotsin,rotcos; +extern int rows[]; +extern long depthtable1[]; +extern long depthtable2[]; +extern long depthtable3[]; +extern long depthtable4[]; + +extern int dotnum; + +extern void drawdots(void); + +char far *vram=(char far *)0xa0000000L; + +char pal[768]; +char pal2[768]; + +extern sin1024[]; + +int isin(int deg) +{ + return(sin1024[deg&1023]); +} + +int icos(int deg) +{ + return(sin1024[(deg+256)&1023]); +} + +extern struct +{ + int x; + int y; + int z; + int old1; + int old2; + int old3; + int old4; + int yadd; +} dot[]; + +extern int gravity; +extern int gravitybottom; +extern int gravityd; + +void setborder(int color) +{ + _asm + { + mov dx,3dah + in al,dx + mov dx,3c0h + mov al,11h+32 + out dx,al + mov al,color + out dx,al + } +} + +int cols[]={ +0,0,0, +4,25,30, +8,40,45, +16,55,60}; +int dottaul[1024]; + +main(int argc,char *argv[]) +{ + int timer=30000; + int dropper,repeat; + int frame=0; + int rota=-1*64; + int fb=0; + int rot=0,rots=0; + int a,b,c,d,i,j,mode; + int grav,gravd; + int f=0; + dis_partstart(); + dotnum=512; + for(a=0;a15) c=15; + c=15-c; + depthtable1[a]=0x202+0x04040404*c; + depthtable2[a]=0x02030302+0x04040404*c; + depthtable3[a]=0x202+0x04040404*c; + //depthtable4[a]=0x02020302+0x04040404*c; + } + bgpic=halloc(64000L,1L); + memcpy(bgpic,vram,64000); + a=0; + for(b=64;b>=0;b--) + { + for(c=0;c<768;c++) + { + a=pal[c]-b; + if(a<0) a=0; + pal2[c]=a; + } + dis_waitb(); + dis_waitb(); + outp(0x3c8,0); + for(c=0;c<768;c++) outp(0x3c9,pal2[c]); + } + + while(!dis_exit() && frame<2450) + { + //setborder(0); + repeat=dis_waitb(); + if(frame>2300) setpalette(pal2); + //setborder(1); + if(dis_indemo()) + { + a=dis_musplus(); + if(a>-4 && a<0) break; + } + while(repeat--) + { + frame++; + if(frame==500) f=0; + i=dottaul[j]; + j++; j%=dotnum; + if(frame<500) + { + dot[i].x=isin(f*11)*40; + dot[i].y=icos(f*13)*10-dropper; + dot[i].z=isin(f*17)*40; + dot[i].yadd=0; + } + else if(frame<900) + { + dot[i].x=icos(f*15)*55; + dot[i].y=dropper; + dot[i].z=isin(f*15)*55; + dot[i].yadd=-260; + } + else if(frame<1700) + { + a=sin1024[frame&1023]/8; + dot[i].x=icos(f*66)*a; + dot[i].y=8000; + dot[i].z=isin(f*66)*a; + dot[i].yadd=-300; + } + else if(frame<2360) + { + /* + a=rand()/128+32; + dot[i].y=8000-a*80; + b=rand()&1023; + a+=rand()&31; + dot[i].x=sin1024[b]*a/3+(a-50)*7; + dot[i].z=sin1024[(b+256)&1023]*a/3+(a-40)*7; + dot[i].yadd=300; + if(frame>1640 && !(frame&31) && grav>-2) grav--; + */ + dot[i].x=rand()-16384; + dot[i].y=8000-rand()/2; + dot[i].z=rand()-16384; + dot[i].yadd=0; + if(frame>1900 && !(frame&31) && grav>0) grav--; + } + else if(frame<2400) + { + a=frame-2360; + for(b=0;b<768;b+=3) + { + c=pal[b+0]+a*3; + if(c>63) c=63; + pal2[b+0]=c; + c=pal[b+1]+a*3; + if(c>63) c=63; + pal2[b+1]=c; + c=pal[b+2]+a*4; + if(c>63) c=63; + pal2[b+2]=c; + } + } + else if(frame<2440) + { + a=frame-2400; + for(b=0;b<768;b+=3) + { + c=63-a*2; + if(c<0) c=0; + pal2[b+0]=c; + pal2[b+1]=c; + pal2[b+2]=c; + } + } + if(dropper>4000) dropper-=100; + rotcos=icos(rot)*64; rotsin=isin(rot)*64; + rots+=2; + if(frame>1900) + { + rot+=rota/64; + rota--; + } + else rot=isin(rots); + f++; + gravity=grav; + gravityd=gravd; + } + drawdots(); + } + if(!dis_indemo()) + { + _asm mov ax,3h + _asm int 10h + } + return(0); +} diff --git a/dots/makefile b/dots/makefile new file mode 100755 index 0000000..53048b3 --- /dev/null +++ b/dots/makefile @@ -0,0 +1,48 @@ +MEMORYMODE=l +# symbolic debug for wsample/wprof/wd +D_FLAGS=-d1+ + +# stacksize +STKSIZ=32768 +#STKSIZ=24576#40960 + +# +# compile flags +# +S_FLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k$(STKSIZ) +Z_FLAGS=-zk0 -zc#### -zp4 -ei# -zm +O_FLAGS=-opnr -oe=24 -oil+ -outback -ohm +T_FLAGS=-bt=dos -wx -m$(MEMORYMODE) -0 -fpi87 $(D_FLAGS) -fo=.obj## -e=65536 + +DBUGFLAGS=-fm=$^&.meh -fd=$^& $(D_FLAGS) +CPPFLAGS=-DTARGET_MSDOS=16 -DMSDOS=1 -DSTACKSIZE=$(STKSIZ) + +AFLAGS=$(T_FLAGS) +CFLAGS=$(T_FLAGS) -wo -i"$(DOSLIBDIR)" $(O_FLAGS) $(S_FLAGS) $(Z_FLAGS) +LFLAGS=-l=dos $(S_FLAGS) $(DBUGFLAGS) +#asm_f = /ML /m2 /s /JJUMPS +#c_f = /AL /c /W3 + +#.asm.obj : +# tasm $(asm_f) $< +# +#.c.obj : +# cl /qc $(c_f) $< + +.c.obj: + *wcl $(CFLAGS) $(extra_$^&_obj_opts) $(CPPFLAGS) -c $[@ +.asm.obj: + *wcl $(AFLAGS) $(extra_$^&_obj_opts) -c $[@ +.obj.exe : + *wcl $(LFLAGS) $(extra_$^&_exe_opts)$< -fe=$@ + +# link /E $(objs),dots.exe,nul; +# copy dots.exe ..\main\data\minvball.exe + +DOTSOBJS=dots.obj ../dis/disc.obj# asm.obj + +all : dots.exe + +dots.exe : $(DOTSOBJS) + +#asm.asm : face.inc diff --git a/dots/makefile.old b/dots/makefile.old new file mode 100755 index 0000000..945ebad --- /dev/null +++ b/dots/makefile.old @@ -0,0 +1,24 @@ +all : dots.exe face.exe + +face.exe : face.c + cl /qc /AL face.c + face > face.inc + +objs=main.obj asm.obj ..\dis\disc.obj + +asm_f = /ML /m2 /s /JJUMPS +c_f = /AL /c /W3 + +.asm.obj : + tasm $(asm_f) $< + +.c.obj : + cl /qc $(c_f) $< + +dots.exe : $(objs) + link /E $(objs),dots.exe,nul; + copy dots.exe ..\main\data\minvball.exe + +asm.asm : face.inc + + diff --git a/dots/sin1024.inc b/dots/sin1024.inc new file mode 100755 index 0000000..6614fbe --- /dev/null +++ b/dots/sin1024.inc @@ -0,0 +1,33 @@ +_sin1024 LABEL WORD +dw 0,1,3,4,6,7,9,10,12,14,15,17,18,20,21,23,25,26,28,29,31,32,34,36,37,39,40,42,43,45,46,48 +dw 49,51,53,54,56,57,59,60,62,63,65,66,68,69,71,72,74,75,77,78,80,81,83,84,86,87,89,90,92,93,95,96 +dw 97,99,100,102,103,105,106,108,109,110,112,113,115,116,117,119,120,122,123,124,126,127,128,130,131,132,134,135,136,138,139,140 +dw 142,143,144,146,147,148,149,151,152,153,155,156,157,158,159,161,162,163,164,166,167,168,169,170,171,173,174,175,176,177,178,179 +dw 181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,211 +dw 212,213,214,215,216,217,217,218,219,220,221,221,222,223,224,225,225,226,227,227,228,229,230,230,231,232,232,233,234,234,235,235 +dw 236,237,237,238,238,239,239,240,241,241,242,242,243,243,244,244,244,245,245,246,246,247,247,247,248,248,249,249,249,250,250,250 +dw 251,251,251,251,252,252,252,252,253,253,253,253,254,254,254,254,254,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255 +dw 256,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,254,254,254,254,254,253,253,253,253,252,252,252,252,251,251,251 +dw 251,250,250,250,249,249,249,248,248,247,247,247,246,246,245,245,244,244,244,243,243,242,242,241,241,240,239,239,238,238,237,237 +dw 236,235,235,234,234,233,232,232,231,230,230,229,228,227,227,226,225,225,224,223,222,221,221,220,219,218,217,217,216,215,214,213 +dw 212,211,211,210,209,208,207,206,205,204,203,202,201,200,199,198,197,196,195,194,193,192,191,190,189,188,187,186,185,184,183,182 +dw 181,179,178,177,176,175,174,173,171,170,169,168,167,166,164,163,162,161,159,158,157,156,155,153,152,151,149,148,147,146,144,143 +dw 142,140,139,138,136,135,134,132,131,130,128,127,126,124,123,122,120,119,117,116,115,113,112,110,109,108,106,105,103,102,100,99 +dw 97,96,95,93,92,90,89,87,86,84,83,81,80,78,77,75,74,72,71,69,68,66,65,63,62,60,59,57,56,54,53,51 +dw 49,48,46,45,43,42,40,39,37,36,34,32,31,29,28,26,25,23,21,20,18,17,15,14,12,10,9,7,6,4,3,1 +dw 0,-1,-3,-4,-6,-7,-9,-10,-12,-14,-15,-17,-18,-20,-21,-23,-25,-26,-28,-29,-31,-32,-34,-36,-37,-39,-40,-42,-43,-45,-46,-48 +dw -49,-51,-53,-54,-56,-57,-59,-60,-62,-63,-65,-66,-68,-69,-71,-72,-74,-75,-77,-78,-80,-81,-83,-84,-86,-87,-89,-90,-92,-93,-95,-96 +dw -97,-99,-100,-102,-103,-105,-106,-108,-109,-110,-112,-113,-115,-116,-117,-119,-120,-122,-123,-124,-126,-127,-128,-130,-131,-132,-134,-135,-136,-138,-139,-140 +dw -142,-143,-144,-146,-147,-148,-149,-151,-152,-153,-155,-156,-157,-158,-159,-161,-162,-163,-164,-166,-167,-168,-169,-170,-171,-173,-174,-175,-176,-177,-178,-179 +dw -181,-182,-183,-184,-185,-186,-187,-188,-189,-190,-191,-192,-193,-194,-195,-196,-197,-198,-199,-200,-201,-202,-203,-204,-205,-206,-207,-208,-209,-210,-211,-211 +dw -212,-213,-214,-215,-216,-217,-217,-218,-219,-220,-221,-221,-222,-223,-224,-225,-225,-226,-227,-227,-228,-229,-230,-230,-231,-232,-232,-233,-234,-234,-235,-235 +dw -236,-237,-237,-238,-238,-239,-239,-240,-241,-241,-242,-242,-243,-243,-244,-244,-244,-245,-245,-246,-246,-247,-247,-247,-248,-248,-249,-249,-249,-250,-250,-250 +dw -251,-251,-251,-251,-252,-252,-252,-252,-253,-253,-253,-253,-254,-254,-254,-254,-254,-254,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255 +dw -256,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-255,-254,-254,-254,-254,-254,-254,-253,-253,-253,-253,-252,-252,-252,-252,-251,-251,-251 +dw -251,-250,-250,-250,-249,-249,-249,-248,-248,-247,-247,-247,-246,-246,-245,-245,-244,-244,-244,-243,-243,-242,-242,-241,-241,-240,-239,-239,-238,-238,-237,-237 +dw -236,-235,-235,-234,-234,-233,-232,-232,-231,-230,-230,-229,-228,-227,-227,-226,-225,-225,-224,-223,-222,-221,-221,-220,-219,-218,-217,-217,-216,-215,-214,-213 +dw -212,-211,-211,-210,-209,-208,-207,-206,-205,-204,-203,-202,-201,-200,-199,-198,-197,-196,-195,-194,-193,-192,-191,-190,-189,-188,-187,-186,-185,-184,-183,-182 +dw -181,-179,-178,-177,-176,-175,-174,-173,-171,-170,-169,-168,-167,-166,-164,-163,-162,-161,-159,-158,-157,-156,-155,-153,-152,-151,-149,-148,-147,-146,-144,-143 +dw -142,-140,-139,-138,-136,-135,-134,-132,-131,-130,-128,-127,-126,-124,-123,-122,-120,-119,-117,-116,-115,-113,-112,-110,-109,-108,-106,-105,-103,-102,-100,-99 +dw -97,-96,-95,-93,-92,-90,-89,-87,-86,-84,-83,-81,-80,-78,-77,-75,-74,-72,-71,-69,-68,-66,-65,-63,-62,-60,-59,-57,-56,-54,-53,-51 +dw -49,-48,-46,-45,-43,-42,-40,-39,-37,-36,-34,-32,-31,-29,-28,-26,-25,-23,-21,-20,-18,-17,-15,-14,-12,-10,-9,-7,-6,-4,-3,-1 diff --git a/plzpart/makefile b/plzpart/makefile new file mode 100755 index 0000000..e70bb5b --- /dev/null +++ b/plzpart/makefile @@ -0,0 +1,133 @@ +# +# Higanbana Project makefile +# +# +# Possible optimizations for 8088 class processors +# +# -oa Relax alias checking +# -ob Try to generate straight line code +# -oe - expand user functions inline (-oe=20 is default, adds lots of code) +# -oh Enable repeated optimizations +# -oi generate certain lib funcs inline +# -oi+ Set max inline depth (C++ only, use -oi for C) +# -ok Flowing of register save into function flow graph +# -ol loop optimizations +# -ol+ loop optimizations plus unrolling +# -or Reorder for pipelined (486+ procs); not sure if good to use +# -os Favor space over time +# -ot Favor time over space +# -ei Allocate an "int" for all enum types +# -zp2 Allow compiler to add padding to structs +# -zpw Use with above; make sure you are warning free! +# -0 8088/8086 class code generation +# -s disable stack overflow checking + +# -zk0u translate kanji to unicode... wwww +# -zk0 kanji support~ +# -zkl current codepage + +#%.C +#192x144 +#wwww will add these +!ifdef __LINUX__ +REMOVECOMMAND=rm -f +COPYCOMMAND=cp -f +DIRSEP=/ +OBJ=o +!else +REMOVECOMMAND=del +COPYCOMMAND=copy /y +DIRSEP=\ +OBJ=obj +!endif +#!ifndef INCLUDE +#IN=..$(DIRSEP)..$(DIRSEP)fdos$(DIRSEP)watcom2$(DIRSEP)h +#IFLAGS=-i=$(IN) +#!endif + +TARGET_OS = dos + +#EXMMTESTDIR=16$(DIRSEP)exmmtest$(DIRSEP) +SRC=src$(DIRSEP) +SRCLIB=$(SRC)lib$(DIRSEP) + +AFLAGS=-mh -0 -d1 -e=65536 +PLZFLAGS=-fh=plzpart.hed +SFLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k32768 +DFLAGS=-DTARGET_MSDOS=16 -DMSDOS=1 $(SFLAGS) +ZFLAGS=-zk0 -zq -zc -zp8# -zm +CFLAGS=$(AFLAGS) $(IFLAGS)-lr -l=dos -wo##wwww +OFLAGS=-obmiler -out -oh -ei -zp8 -fpi87 -onac -ol+ -ok####x +FLAGS=$(CFLAGS) $(OFLAGS) $(DFLAGS) $(ZFLAGS) + + +EXEC = plzpart.exe +OBJS = copper.$(OBJ) tweak.$(OBJ) plz.$(OBJ) asmyt.$(OBJ) + +all: $(EXEC) + +# +#game and bakapi executables +# +plzpart.exe: plzpart.$(OBJ) $(OBJS) + wcl $(FLAGS) $(PLZFLAGS) plzpart.$(OBJ) $(OBJS) -fm=plzpart.map + + +# +#executable's objects +# +plzpart.$(OBJ): plzpart.h plzpart.c + wcl $(FLAGS) -c plzpart.c + +# +#non executable objects libraries +# +plz.$(OBJ): plz.h plz.c + wcl $(FLAGS) -c plz.c +tweak.$(OBJ): tweak.h tweak.c + wcl $(FLAGS) -c tweak.c +asmyt.$(OBJ): asmyt.h asmyt.c + wcl $(FLAGS) -c asmyt.c +copper.$(OBJ): copper.h copper.c + wcl $(FLAGS) -c copper.c + + +# +#other~ +# +clean: .symbolic + @$(REMOVECOMMAND) $(EXEC) +# @$(REMOVECOMMAND) *.$(OBJ) + @$(REMOVECOMMAND) *.o + +# +# PLZPART_OBJS = plz.o copper.o asmyt.o tweak.o vect.o vga.o opengl.o \ +# plza.o plzfill.o sinit.o spline.o main.o +# +# PLZPART_PATH = plzpart +# +# PLZPART_PATH_OBJS = $(addprefix $(PLZPART_PATH)/,$(PLZPART_OBJS)) +# +# PLZPART_BIN = plzpart +# +# OBJS += $(PLZPART_PATH_OBJS) +# +# default-plzpart: +# $(MAKE) -C .. plzpart-all +# +# plzpart-all: $(PLZPART_PATH)/$(PLZPART_BIN) +# +# $(PLZPART_PATH)/$(PLZPART_BIN): $(PLZPART_PATH_OBJS) +# $(LD) -o $@ $(LDFLAGS) $(PLZPART_PATH_OBJS) $(LIBS) +# +# plz.c: tweak.h ptau.pre +asmyt.c +copper.c +main.c +plza.c +plz.c +plzfill.c +sinit.c +spline.c +tweak.c +vect.c