From ae23580743a339390d6a54b17f432c75377d3798 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 15 Sep 2021 08:23:22 -0400 Subject: [PATCH] wargames: more complete version --- demos/wargames/Makefile | 22 ++- demos/wargames/make_coords.c | 217 ++++++++++++++++++++++++++ demos/wargames/map.png | Bin 2140 -> 16695 bytes demos/wargames/wargames.s | 285 +++++++++++++++++++++++++---------- 4 files changed, 443 insertions(+), 81 deletions(-) create mode 100644 demos/wargames/make_coords.c diff --git a/demos/wargames/Makefile b/demos/wargames/Makefile index bc1b6ed4..a6c58034 100644 --- a/demos/wargames/Makefile +++ b/demos/wargames/Makefile @@ -12,15 +12,15 @@ all: wargames.dsk wargames.dsk: HELLO WARGAMES cp $(EMPTY_DISK) wargames.dsk $(DOS33) -y wargames.dsk SAVE A HELLO - $(DOS33) -y wargames.dsk BSAVE -a 0x1000 WARGAMES + $(DOS33) -y wargames.dsk BSAVE -a 0xc00 WARGAMES ### WARGAMES: wargames.o - ld65 -o WARGAMES wargames.o -C ../../linker_scripts/apple2_1000.inc + ld65 -o WARGAMES wargames.o -C ../../linker_scripts/apple2_c00.inc wargames.o: wargames.s ssi263.inc ssi263_detect.s ssi263_simple_speech.s \ - map.lzsa + map.lzsa coords.inc ca65 -o wargames.o wargames.s -l wargames.lst ### @@ -33,6 +33,19 @@ map.hgr: map.png ### +coords.inc: make_coords coords.txt + ./make_coords < coords.txt > coords.inc + +### + +make_coords: make_coords.o + $(CC) -o make_coords make_coords.o $(LFLAGS) -lm + +make_coords.o: make_coords.c + $(CC) $(CFLAGS) -c make_coords.c + +### + HELLO: hello.bas $(TOKENIZE) < hello.bas > HELLO @@ -40,6 +53,5 @@ HELLO: hello.bas #### clean: - rm -f *~ *.o *.lst HELLO WARGAMES - + rm -f *~ *.o *.lst HELLO WARGAMES make_coords diff --git a/demos/wargames/make_coords.c b/demos/wargames/make_coords.c new file mode 100644 index 00000000..70732b7e --- /dev/null +++ b/demos/wargames/make_coords.c @@ -0,0 +1,217 @@ +#include +#include + +static int debug=0; + +static void make_coord_line(int frame,int x,int y,int destx,int desty) { + + int status, xh,xl, yh,yl; + double theta,dx,dy; + int dxi,dyi,dxh,dxl,dyh,dyl; + int closestx,closesty,distance,closest; + + // status frame x/x y/y dx/dx dy/dy destx desty/radius + status=0; + xl=0; xh=x; + yl=0; yh=y; + + if ((destx-x)!=0) { + theta=atan2((desty-y),(destx-x)); + dx=cos(theta); + dy=sin(theta); + } + else { + if (debug) printf("; VERTICAL\n"); + theta=0; + dx=0; + dy=1; + } + + dxi=dx*256; + dyi=dy*256; + + dxh=(dxi>>8)&0xff; + dxl=dxi&0xff; + + dyh=(dyi>>8)&0xff; + dyl=dyi&0xff; + + if (debug) { + printf("; theta=%lf dx=%lf dy=%lf\n",theta,dx,dy); + printf("; dxh=%d dxl=%d\n",dxh,dxl); + printf("; dyh=%d dyl=%d\n",dyh,dyl); + } + + { int i,blahx,blahy; + blahx=xh*256; + blahy=yh*256; + closest=1000000; + closestx=0; + closesty=0; + + for (i=0;i<200;i++) { + distance=sqrt((blahx/256-destx)*(blahx/256-destx)+ + (blahy/256-desty)*(blahy/256-desty)); + if (distancedestx) direction=-1; + else direction=1; + + last=0,last2=0; + + if (debug) printf("; x=%d destx=%d y=%d height=%d\n", + x,destx,y,height); + if (debug) printf("; center_x=%d width=%d top=%d\n", + (x+destx)/2, + (x-destx), + y-height); + + for(i=x;i!=destx;i+=direction) { + current=func(i,x,destx,y,height); + if (debug) printf("; %d %lf -- %lf %lf\n",i,current, + current-last,last2-(current-last)); + diff=(current-last)-last2; + last2=current-last; + last=current; + } + + urgh=func(x+direction,x,destx,y,height)-func(x,x,destx,y,height); + zurgh=diff; + + u=urgh*256; z=zurgh*256; + + if (debug) printf("; $%02X $%02X, $%02X $%02X\n",(u>>8)&0xff,u&0xff, + (z>>8)&0xff,z&0xff); + +#if 0 + { int i,blahx,blahy; + blahx=xh*256; + blahy=yh*256; + closest=1000000; + closestx=0; + closesty=0; + + for (i=0;i<200;i++) { + distance=sqrt((blahx/256-destx)*(blahx/256-destx)+ + (blahy/256-desty)*(blahy/256-desty)); + if (distance>8)&0xff,u&0xff, + (z>>8)&0xff,z&0xff, + destx,255); + +} + + +int main(int argc, char **argv) { + + char string[BUFSIZ]; + char *ptr; + + int x,y; + int type, frame; + int destx, desty; + + while(1) { + ptr=fgets(string,BUFSIZ,stdin); + if (ptr==NULL) break; + + if (string[0]=='#') continue; + + sscanf(string,"%d %d %d %d %d %d", + &type,&frame,&x,&y,&destx,&desty); + + if (type==0) { + make_coord_line(frame,x,y,destx,desty); + } + else if (type==1) { + make_coord_parab(frame,x,y,destx,desty); + } + else { + fprintf(stderr,"Error, unknown type %d\n",type); + } + + } + + printf(".byte $FE\n"); + + return 0; +} + + +// 10,10 100,100 slope=90/90=1 +// +// +// +// +// +// + + diff --git a/demos/wargames/map.png b/demos/wargames/map.png index e4534f992c05bbfcee4058b3e143bfceea5f19e5..f5df5dd8c11a0bbdae3a2570a9d21431a13d976b 100644 GIT binary patch literal 16695 zcmeHtWmKD8({6ANS|qq@&;%>)?pmY-cXuo9?q0mOJH_3K6lrlUQYgjSQaJQ^eVy;m zx7IoT-mK)7y=ShOx%TXxeJ2yGrXq`l4nhY209f*JQW^jN9P#sYKO(~O5!?ln2LM=2 zeYN!5HDF#;&aO_DHue@&?mo^IR2JSgmH>eF>Or2qC!Iiw#ZzO9Aw0uC16kacYoPBB z56ZX?g|ag4%auoc3bW1&@#VHvILUmdQpX>jev7XBK7IX!F7nFrvn^{6!R(XktT3?G z=JBfU$0JaruTS*J`t?@$)@!fRQ({UV=I_ve$Ip8!r;#f^MErkuzX_1Lzj=Jk`17%J z!0UDld-UEn;PLV2gCNZQjmZ4Ui_(i9=6!v@dqMS>*Scwd0fj?6>gOPmedt|YX;13l*Qpci_l<9ZXiq_}sK}$I^x2BR?iZA;dbh~FjjP0p z&F;0HFFl_Rk}>WKdmT?!z`ftR_ZDq?hS1-zJdtdz+`YSc_hW~svN`{?*5W>;u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?9{aSIv@e6-V+Q?v2I=`gTPrvQgc;{*fpPkSnimeKA6Q@K7AvouiG zEDY_iqiKH{Fc^A=>tJTPU04K-Rs@X~YB{Lji(t@dWiXbi9AOLtn6HLWkAR;W!FWb+ z>l>v&wi9umf`MfO2GhF@4MhaatxUjDhvFm{(*P`YC@x~DM%S3MafBhbz<7OOl6+;| z1u(Pu2A(W%j5<#@T@N!Ezs@i;4Re?9y(P>|z932SRxos!n$qY_5&UI-`g^0> z1M|Qmissiles sta MISSILE_HIGH - ldy #0 +inner_missile_loop: + + ldy #MISSILE_STATUS lda (MISSILE_LOW),Y + cmp #$FE ; means all done + bne more_missiles + jmp really_done_missile + +more_missiles: ; see if totally done + lda (MISSILE_LOW),Y bpl keep_going jmp done_missile_loop keep_going: @@ -128,7 +153,7 @@ keep_going: ldy #MISSILE_START_FRAME lda (MISSILE_LOW),Y - cmp FRAME + cmp FRAMEH beq missile_activate jmp done_missile_loop ; not ready @@ -155,55 +180,16 @@ missile_draw: jsr HPLOT0 ; plot at (Y,X), (A) -missile_move: - - ; add X - clc - ldy #MISSILE_DX_L - lda (MISSILE_LOW),Y - ldy #MISSILE_X_FRAC - adc (MISSILE_LOW),Y - sta (MISSILE_LOW),Y - - ldy #MISSILE_DX_H - lda (MISSILE_LOW),Y - ldy #MISSILE_X - adc (MISSILE_LOW),Y - sta (MISSILE_LOW),Y - - ; add Y - clc - ldy #MISSILE_DY_L - lda (MISSILE_LOW),Y - ldy #MISSILE_Y_FRAC - adc (MISSILE_LOW),Y - sta (MISSILE_LOW),Y - - ldy #MISSILE_DY_H - lda (MISSILE_LOW),Y - ldy #MISSILE_Y - adc (MISSILE_LOW),Y - sta (MISSILE_LOW),Y - - - ; see if at end - ldy #MISSILE_Y - lda (MISSILE_LOW),Y ldy #MISSILE_DEST_Y - cmp (MISSILE_LOW),Y - bne not_match - - ldy #MISSILE_X lda (MISSILE_LOW),Y - ldy #MISSILE_DEST_X - cmp (MISSILE_LOW),Y - bne not_match + cmp #$FF + beq a_parab -is_match: - lda #STATUS_EXPLODING - ldy #MISSILE_STATUS - sta (MISSILE_LOW),Y -not_match: + jsr missile_move_line + jmp done_missile_loop + +a_parab: + jsr missile_move_parab jmp done_missile_loop missile_explode: @@ -219,7 +205,7 @@ missile_explode: sta VGI_CR - cmp #12 + cmp #EXPLOSION_RADIUS bcc not_done_explosion lda #STATUS_DONE @@ -241,23 +227,44 @@ not_done_explosion: done_missile_loop: + clc + lda MISSILE_LOW + adc #12 + sta MISSILE_LOW + lda #0 + adc MISSILE_HIGH + sta MISSILE_HIGH + jmp inner_missile_loop + +really_done_missile: lda #50 jsr WAIT - inc FRAME - beq done_missiles + clc + lda FRAMEL + adc #FRAME_ADD + sta FRAMEL + lda FRAMEH + adc #0 + sta FRAMEH - jmp missile_loop + cmp #$90 + bcs done_missiles + + jmp outer_missile_loop done_missiles: ;============================ ; print WINNER: NONE + jsr HOME + jsr move_and_print jsr wait_1s + jsr wait_1s ;========================================= @@ -271,6 +278,7 @@ done_missiles: jsr move_and_print + jsr wait_1s jsr wait_1s jsr normal_text @@ -538,6 +546,10 @@ header: .byte 0,3,"NATO / WARSAW PACT",0 .byte 27,3,"NONE",0 .byte 0,4,"FAR EAST STRATEGY",0 + +far_east: + .byte 11,21,"FAR EAST STRATEGY",0 + winner: .byte 14,21,"WINNER: NONE",0 @@ -553,20 +565,6 @@ ending: ; .byte "HOW ABOUT A NICE GAME OF CHESS",0 - - - -missiles: - .byte $00 ; status - .byte $10 ; start frame - .byte 10,$10 ; x-location - .byte 50,$10 ; y-location - .byte $01,$00 ; deltax - .byte $00,$00 ; deltay - .byte 100,50 ; destination - .byte $00 ; radius - .byte $00,$00,$00 ; padding - ;=================== ; next step ;=================== @@ -595,3 +593,138 @@ wait_1s_loop: bne wait_1s_loop rts + + ;============================ + ; missile move line + ;============================ + +missile_move_line: + + ; add X + clc + ldy #MISSILE_DX_L + lda (MISSILE_LOW),Y + ldy #MISSILE_X_FRAC + adc (MISSILE_LOW),Y + sta (MISSILE_LOW),Y + + ldy #MISSILE_DX_H + lda (MISSILE_LOW),Y + ldy #MISSILE_X + adc (MISSILE_LOW),Y + sta (MISSILE_LOW),Y + + ; add Y + clc + ldy #MISSILE_DY_L + lda (MISSILE_LOW),Y + ldy #MISSILE_Y_FRAC + adc (MISSILE_LOW),Y + sta (MISSILE_LOW),Y + + ldy #MISSILE_DY_H + lda (MISSILE_LOW),Y + ldy #MISSILE_Y + adc (MISSILE_LOW),Y + sta (MISSILE_LOW),Y + + + ; see if at end + ldy #MISSILE_Y + lda (MISSILE_LOW),Y + ldy #MISSILE_DEST_Y + cmp (MISSILE_LOW),Y + bne not_match + + ldy #MISSILE_X + lda (MISSILE_LOW),Y + ldy #MISSILE_DEST_X + cmp (MISSILE_LOW),Y + bne not_match + +is_match: + lda #STATUS_EXPLODING + ldy #MISSILE_STATUS + sta (MISSILE_LOW),Y + + lda #0 + ldy #MISSILE_RADIUS + sta (MISSILE_LOW),Y +not_match: + rts + + + + ;============================ + ; missile move parabola + ;============================ + +missile_move_parab: + + ; add X + clc + ldy #MISSILE_X_FRAC + lda (MISSILE_LOW),Y + ldy #MISSILE_X + adc (MISSILE_LOW),Y + sta (MISSILE_LOW),Y + + ; add Y + clc + ldy #MISSILE_P_DY_L + lda (MISSILE_LOW),Y + ldy #MISSILE_Y_FRAC + adc (MISSILE_LOW),Y + sta (MISSILE_LOW),Y + + ldy #MISSILE_P_DY_H + lda (MISSILE_LOW),Y + ldy #MISSILE_Y + adc (MISSILE_LOW),Y + sta (MISSILE_LOW),Y + + ; add dY + clc + ldy #MISSILE_P_DDY_L + lda (MISSILE_LOW),Y + ldy #MISSILE_P_DY_L + adc (MISSILE_LOW),Y + sta (MISSILE_LOW),Y + + ldy #MISSILE_P_DDY_H + lda (MISSILE_LOW),Y + ldy #MISSILE_P_DY_H + adc (MISSILE_LOW),Y + sta (MISSILE_LOW),Y + + + ; see if at end + ldy #MISSILE_X + lda (MISSILE_LOW),Y + ldy #MISSILE_DEST_X + cmp (MISSILE_LOW),Y + bne not_parab_match + +is_parab_match: + lda #STATUS_EXPLODING + ldy #MISSILE_STATUS + sta (MISSILE_LOW),Y + + lda #0 + ldy #MISSILE_RADIUS + sta (MISSILE_LOW),Y +not_parab_match: + rts + + + + ; status frame x/x y/y dx/dx dy/dy destx desty/radius +missiles: + +parabolas: +;.byte $00, 4, 164,$00, 75,$00, $FC,$8C, $00,$16, 80,255 + +.include "coords.inc" + +; status grame x/x y/y dy/dy ddy/ddy destx/desty +