From 010e0ff9c98dc8b724d316b2cfffe0115de61586 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 10 Nov 2020 22:07:19 -0500 Subject: [PATCH] botdemo: add soem more --- appleiibot/Makefile | 9 ++- appleiibot/fastar2.s | 60 ++++++++++----- bot_demo/FLYER.BAS | Bin 0 -> 223 bytes bot_demo/Makefile | 1 + bot_demo/NYAN.BAS | Bin 0 -> 214 bytes bot_demo/QR.BAS | Bin 0 -> 265 bytes bot_demo/TODO | 6 ++ bot_demo/botdemo.s | 167 ++++++++++++++++++++++++++++++++++++++++ bot_demo/load.s | 177 ++++++++++++++++++++++++++++++++++++++++++- 9 files changed, 395 insertions(+), 25 deletions(-) create mode 100644 bot_demo/FLYER.BAS create mode 100644 bot_demo/NYAN.BAS create mode 100644 bot_demo/QR.BAS create mode 100644 bot_demo/TODO create mode 100644 bot_demo/botdemo.s diff --git a/appleiibot/Makefile b/appleiibot/Makefile index 0652d340..5529bf85 100644 --- a/appleiibot/Makefile +++ b/appleiibot/Makefile @@ -11,7 +11,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS \ RASTER4.BAS RASTER5.BAS PUMPKIN.BAS PUMPKIN_SMALL.BAS LADY.BAS \ A2.BAS FOURAM.BAS FLOPPY.BAS QR.BAS A2_4EVER.BAS RLE.BAS RLE2.BAS \ RLEASM.BAS HORIZON.BAS FLYER.BAS STAR.BAS HYPER.BAS FASTAR.BAS \ - FASTAR2.BAS FASTAR2 + FASTAR2.BAS FASTAR2 BIN.BAS cp empty.dsk appleiibot.dsk $(DOS33) -y appleiibot.dsk BSAVE -a 0x0300 LOAD $(DOS33) -y appleiibot.dsk BSAVE -a 0x0C00 FASTAR2 @@ -49,6 +49,7 @@ appleiibot.dsk: E2.BAS FLAME.BAS FLAME2.BAS \ $(DOS33) -y appleiibot.dsk SAVE A HYPER.BAS $(DOS33) -y appleiibot.dsk SAVE A FASTAR.BAS $(DOS33) -y appleiibot.dsk SAVE A FASTAR2.BAS + $(DOS33) -y appleiibot.dsk SAVE A BIN.BAS ### @@ -126,6 +127,12 @@ NYAN.BAS: nyan.bas E2.BAS: entropy_small.bas $(TOKENIZE) < entropy_small.bas > E2.BAS +#### + +BIN.BAS: bin.bas + $(TOKENIZE) < bin.bas > BIN.BAS + + #### diff --git a/appleiibot/fastar2.s b/appleiibot/fastar2.s index 137703a5..673f29fb 100644 --- a/appleiibot/fastar2.s +++ b/appleiibot/fastar2.s @@ -30,33 +30,15 @@ HCOLOR = $F6F0 ; color in X (must be 0..7) sta XH ldx #0 + + jmp check_bounds populate_loop: ; Z = XXYY YYYY ; C=Z*.125 ; A=A+(A-64)*C ; B=B+(B-64)*C - ; check to see if out of bounds - lda XH - bmi redo_point - lda YH - bpl all_good - -redo_point: - ; store a break in the lines - lda #0 - sta $1000,X - sta $1100,X - sta Z ; needed? - inx - - jsr rand16 - sta XH - jsr rand16 - sta YH - -all_good: ; X is in NUM1 for this @@ -112,7 +94,19 @@ do_mult: lda RESULT+2 ; hight sta NUM1+1 - ; add to AA + ; add to X; subtract if minus + lda MINUS + beq not_minus + + sec + lda #00 + sbc NUM1 + sta NUM1 + lda #00 + sbc NUM1+1 + sta NUM1+1 + +not_minus: clc lda XL adc NUM1 @@ -128,6 +122,30 @@ do_mult: adc #$8 sta Z + + ; check to see if out of bounds +check_bounds: + lda XH + bmi redo_point + lda YH + bpl all_good + +redo_point: + ; store a break in the lines + lda #0 + sta $1000,X + sta $1100,X + sta Z ; needed? + inx + + jsr rand16 + sta XH + jsr rand16 + sta YH + +all_good: + + ; write out lda XH diff --git a/bot_demo/FLYER.BAS b/bot_demo/FLYER.BAS new file mode 100644 index 0000000000000000000000000000000000000000..320898886c23a2a762e862877b67893e0a536db3 GIT binary patch literal 223 zcmW-ZF>1p=5Jd+=oK5cwm|&1#B4%gh^=eKaq(-onbQ9mfg|RW%M+hNJI+q3~Y~&)F zJ|tI(?CQh+@4sJ|s1Y35Ffz%I1|3Y*9lSlxW=~m`!CZ}DEqjtK7FO!0bAqM12Oqmo zT_1#ogW%nLR)G)S`gG~}#otZWIpQ;m*JyeP1fjfQ8X28X|}w1dfCk@mK> za?rtF=Caf8HMa8Vzx3I`k9vRu-^!qE|Cf|0YDZGWGEiouib)kTr+rd=yF8Vb1pxd5 D8-zzf literal 0 HcmV?d00001 diff --git a/bot_demo/Makefile b/bot_demo/Makefile index 3bf7d317..3a029ee1 100644 --- a/bot_demo/Makefile +++ b/bot_demo/Makefile @@ -8,6 +8,7 @@ all: bot_demo.dsk bot_demo.dsk: HELLO BOTDEMO cp empty.dsk bot_demo.dsk $(DOS33) -y bot_demo.dsk BSAVE -a 0x6000 BOTDEMO + $(DOS33) -y bot_demo.dsk BSAVE -a 0x6000 BOTDEMO MYSTERY $(DOS33) -y bot_demo.dsk SAVE A HELLO diff --git a/bot_demo/NYAN.BAS b/bot_demo/NYAN.BAS new file mode 100644 index 0000000000000000000000000000000000000000..f3d19c8cf03707f016e97054fef79c25256a69c7 GIT binary patch literal 214 zcmXAiyA8rX5JXo!me1A;ZW5B_a{12>Zi8b46x&goks3kndF+c?- z;gLWw)liUe_V%{gKuX;}(HBS|1BPE5Obm^Y7Yq&>np#>#U3jEnWMFD?B2x3Dv5{4y zCs5qfDp2)8)M+EDou&pl8iA^(j7~;ro-(vFI$>mL3e*v(YPB} + +; Zero Page + .include "zp.inc" + .include "hardware.inc" + +DONE = 0 +DO_LOAD = 1 +DO_LIST = 2 +DO_RUN = 3 + + +bot_demo: + ;=================== + ; init some stuff + + ; we have from $6000 to $9600 (DOS 3.3) + ; which is $3600 = 12 + 1.5 = 13.5k + + ; we don't need to set HIMEM as we don't use many vars + ; and variable memory starts right after the program it seems + + + ;=================== + ; PT3 Setup + + lda #0 + sta DONE_PLAYING + lda #1 + sta LOOP + + jsr mockingboard_detect + bcc mockingboard_not_found +setup_interrupt: + jsr mockingboard_init + jsr mockingboard_setup_interrupt + jsr reset_ay_both + jsr clear_ay_both + jsr pt3_init_song + +start_interrupts: + tsx + stx original_stack + + cli + +mockingboard_not_found: + + ;=================== + ; init screen + jsr TEXT + jsr HOME + bit KEYRESET + + ; GR part +; bit PAGE1 +; bit LORES ; 4 +; bit SET_GR ; 4 + +; bit FULLGR ; 4 + + ;=================== + ; init vars + +; lda #0 +; sta DRAW_PAGE +; lda #4 +; sta DISP_PAGE + + ;============================= + ; Load desire 1st + +; lda #desire_rle +; sta GBASH +; lda #$c +; jsr load_rle_gr + +; jsr gr_copy_to_current ; copy to page1 + +; jsr page_flip + +; jsr wait_until_keypress + + +; jsr do_list + +; jsr do_list + + +done: + lda trigger + beq not_trigger + + lda #0 + sta trigger + + lda command + cmp #DONE + beq done + + cmp #DO_LIST + bne not_do_list + jmp do_list + +not_do_list: + cmp #DO_LOAD + bne not_do_load + jsr do_load + jmp not_trigger + +not_do_load: + cmp #DO_RUN + bne not_trigger + + jmp do_run + +not_trigger: + + jmp done + + +todo_list: + .byte DO_LOAD,1 + .byte DO_LIST,4 + .byte DO_RUN,10 ; flyer + .byte DO_LOAD,1 + .byte DO_LIST,4 + .byte DO_RUN,20 ; nyan + .byte DO_LOAD,1 + .byte DO_LIST,5 + .byte DO_RUN,15 ; qr + .byte DONE,$FF + +command: .byte $00 +which: .byte $00 +timeout: .byte $01 +trigger: .byte $00 +original_stack: .byte $00 + +; .include "gr_unrle.s" +; .include "gr_unrle_large.s" +; .include "gr_offsets.s" +; .include "gr_copy.s" +; .include "gr_copy_large.s" +; .include "gr_pageflip.s" + +.include "pt3_lib_core.s" +.include "pt3_lib_init.s" +.include "pt3_lib_mockingboard_setup.s" +.include "interrupt_handler.s" +; if you're self patching, detect has to be after interrupt_handler.s +.include "pt3_lib_mockingboard_detect.s" + +.include "load.s" + +.include "nozp.inc" + + + +PT3_LOC = song +.align $100 +song: +.incbin "../pt3_player/music/DF.PT3" diff --git a/bot_demo/load.s b/bot_demo/load.s index ce392525..73e3f941 100644 --- a/bot_demo/load.s +++ b/bot_demo/load.s @@ -1,9 +1,12 @@ - +TXTTAB = $67 +PRGEND = $AF +VARTAB = $69 CURLIN = $75 ERRFLG = $D8 TXTPTR = $B8 CHRGET = $00B1 +SCRTCH = $D64B RESTART = $D43C INLIN2 = $D52E PARSE_INPUT_LINE = $d559 @@ -14,6 +17,10 @@ load_file: ;================= ; run list command do_list: + bit SET_TEXT + bit PAGE0 + jsr HOME + lda #list_string @@ -22,14 +29,34 @@ do_list: jmp run_command + ; want to list from 0 to ffff + +;LINNUM = $50 +; lda #$00 +; sta LINNUM +; sta LINNUM+1 +; +; jsr $D61A ; FINDLIN, gets line in LOWTR +; +; lda #$ff +; sta LINNUM +; sta LINNUM+1 +; +; jsr $d6da ; LIST_0 +; jsr $d6cc ; LIST_0 +; +; rts + ;================= ; run run command ; a do-run-run, a do-run-run do_run: + jsr HOME + lda #run_string sta cti_smc+1 + lda #>run_string + sta cti_smc+2 jsr copy_to_input jmp run_command @@ -90,3 +117,147 @@ run_command: jsr PARSE_INPUT_LINE jmp TRACE_ + + ;============================ + ;============================ + ; do_load + ;============================ + ;============================ + +do_load: + + jsr SCRTCH ; runs "NEW" + ; messes with stack :( + + lda which_file + asl + asl + tax + + lda file_list,X + sta get_size_smc1+1 + lda file_list+1,X + sta get_size_smc1+2 + + clc + lda file_list,X + adc #1 + sta get_size_smc2+1 + lda file_list+1,X + adc #0 + sta get_size_smc2+2 + + clc + lda file_list,X + adc #2 + sta do_load_smc1+1 + lda file_list+1,X + adc #0 + sta do_load_smc1+2 + + lda #<($801) + sta do_load_smc2+1 + lda #>($801) + sta do_load_smc2+2 + +get_size_smc1: + lda $dede + sta file_size + +get_size_smc2: + lda $dede + sta file_size+1 + + ; always is 0? + lda #0 + sta $800 + + +do_load_loop: + +do_load_smc1: + lda $dede +do_load_smc2: + sta $0800 + + inc do_load_smc1+1 + bne no_load1_oflo + inc do_load_smc1+2 +no_load1_oflo: + + inc do_load_smc2+1 + bne no_load2_oflo + inc do_load_smc2+2 +no_load2_oflo: + + lda do_load_smc1+1 + cmp file_list+2,X + bne do_load_loop + + lda do_load_smc1+2 + cmp file_list+3,X + bne do_load_loop + + ; done with file list, increment + + inc which_file + + ; update all the values + ; this is actually from the DOS3.3 code, roughly starting at $A413 + + ; add length to SOP / ASSOP + ; TXTTAB $67 -- start of program + ; need to add the size and store it in PRGEND $AF and VARTAB $69 + + clc + lda file_size + ldy file_size+1 + adc TXTTAB + tax + tya + adc TXTTAB+1 ; A:X is now end of basic prog + + ; skip the error check + sta PRGEND+1 + sta VARTAB+1 + stx PRGEND + stx VARTAB + + rts + + +file_size: .word $dede + +which_file: .byte $0 + +file_list: + .word flyer,flyer_end + .word nyan,nyan_end + .word qr,qr_end + +title_list: + .word flyer_title + .word nyan_title + .word qr_title + +flyer_title: + .byte 8,10,"HI-RES SHAPETABLE FLYER",0 +nyan_title: + .byte 8,10,"HI-RES ANIMATED NYAN CAT",0 +qr_title: + .byte 0,10,"MYSTERY BAR CODE WILL NEVER LET YOU DOWN",0 + + +flyer: +.incbin "FLYER.BAS" +flyer_end: + +nyan: +.incbin "NYAN.BAS" +nyan_end: + +qr: +.incbin "QR.BAS" +qr_end: + +