From a6a95e048d3d711ba7629ffcb99c517a580a207c Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Fri, 12 Jul 2019 13:40:29 -0400 Subject: [PATCH] ootw: c3: "implement" checkpoint3 also fix a bug in text printing introduced a while back, might be why intro broken --- ootw/Makefile | 15 ++- ootw/hello.bas | 5 +- ootw/loader.s | 18 +++ ootw/ootw_c3.s | 93 ++++++++++++++ ootw/ootw_c3_vent.s | 143 +++++++++++++++++++++ ootw/ootw_graphics/l3vent/Makefile | 18 +++ ootw/ootw_graphics/l3vent/ootw_c3_vent.inc | 5 + ootw/ootw_graphics/l3vent/vent.png | Bin 0 -> 257 bytes ootw/text_print.s | 2 +- 9 files changed, 295 insertions(+), 4 deletions(-) create mode 100644 ootw/ootw_c3.s create mode 100644 ootw/ootw_c3_vent.s create mode 100644 ootw/ootw_graphics/l3vent/Makefile create mode 100644 ootw/ootw_graphics/l3vent/ootw_c3_vent.inc create mode 100644 ootw/ootw_graphics/l3vent/vent.png diff --git a/ootw/Makefile b/ootw/Makefile index c62a797e..bda85784 100644 --- a/ootw/Makefile +++ b/ootw/Makefile @@ -7,12 +7,13 @@ PNG2LZ4 = ../gr-utils/png2lz4 all: ootw.dsk -ootw.dsk: HELLO LOADER INTRO OOTW OOTW_C2 #COMPRESS-TEST +ootw.dsk: HELLO LOADER INTRO OOTW OOTW_C2 OOTW_C3 $(DOS33) -y ootw.dsk SAVE A HELLO $(DOS33) -y ootw.dsk BSAVE -a 0x1400 LOADER $(DOS33) -y ootw.dsk BSAVE -a 0x1700 INTRO $(DOS33) -y ootw.dsk BSAVE -a 0x1700 OOTW $(DOS33) -y ootw.dsk BSAVE -a 0x1700 OOTW_C2 + $(DOS33) -y ootw.dsk BSAVE -a 0x1700 OOTW_C3 # $(DOS33) -y ootw.dsk BSAVE -a 0x2000 COMPRESS-TEST @@ -61,6 +62,18 @@ ootw_c2.o: ootw_c2.s \ ootw_graphics/l2intro/ootw_l2intro.inc ca65 -o ootw_c2.o ootw_c2.s -l ootw_c2.lst +#### + +OOTW_C3: ootw_c3.o + ld65 -o OOTW_C3 ootw_c3.o -C ../linker_scripts/apple2_1700.inc + +ootw_c3.o: ootw_c3.s \ + gr_copy.s gr_copy_offset.s gr_fast_clear.s gr_pageflip.s gr_unrle.s \ + gr_putsprite.s gr_putsprite_flipped.s gr_putsprite_crop.s \ + keyboard.s gr_run_sequence.s physicist.s \ + ootw_graphics/sprites/sprites_physicist.inc \ + ootw_graphics/l3vent/ootw_c3_vent.inc + ca65 -o ootw_c3.o ootw_c3.s -l ootw_c3.lst #### diff --git a/ootw/hello.bas b/ootw/hello.bas index 8cb01784..2b09bfd6 100644 --- a/ootw/hello.bas +++ b/ootw/hello.bas @@ -17,9 +17,10 @@ 110 PRINT "0). START WITH INTRO MOVIE" 120 PRINT "1). START AT CHECKPOINT 1 (IH8S)" 130 PRINT "2). START AT CHECKPOINT 2 (RAGE)" + 135 PRINT "3). START AT CHECKPOINT 3 (VENT)" 140 INPUT A - 150 IF A < 0 OR A > 2 THEN 5 - 155 IF A=1 OR A=2 THEN GOSUB 300 + 150 IF A < 0 OR A > 3 THEN 5 + 155 IF A=1 OR A=2 OR A=3 THEN GOSUB 300 160 POKE 5,A 200 PRINT CHR$ (4)"BRUN LOADER" 300 HOME diff --git a/ootw/loader.s b/ootw/loader.s index 7e4a3e0a..0d188e84 100644 --- a/ootw/loader.s +++ b/ootw/loader.s @@ -51,6 +51,8 @@ which_load_loop: beq load_ootw_cp1 cmp #2 beq load_ootw_cp2 + cmp #3 + beq load_ootw_cp3 ; fall through @@ -79,9 +81,19 @@ load_ootw_cp2: sta namlo lda #>ootw_c2_filename sta namhi + jmp load_done + +load_ootw_cp3: + + ; open and read a file + lda #ootw_c3_filename + sta namhi ; fall through + load_done: jsr opendir ; open and read entire file into memory @@ -111,6 +123,12 @@ ootw_c2_filename: ;.byte "OOTW_C2 " .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 .byte $A0,$A0,$A0,$A0,$A0,$A0 +ootw_c3_filename: ;.byte "OOTW_C3 " + .byte 'O'|$80,'O'|$80,'T'|$80,'W'|$80,'_'|$80,'C'|$80,'3'|$80,$A0 + .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 + .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 + .byte $A0,$A0,$A0,$A0,$A0,$A0 + ;unhook DOS and build nibble table diff --git a/ootw/ootw_c3.s b/ootw/ootw_c3.s new file mode 100644 index 00000000..9356e2ed --- /dev/null +++ b/ootw/ootw_c3.s @@ -0,0 +1,93 @@ +; Ootw for Apple II Lores -- Checkpoint3 -- The Ventilation System + +; by Vince "Deater" Weaver + +.include "zp.inc" +.include "hardware.inc" + + + +ootw_c3: + + ; Initialize some variables + + lda #0 + sta GAME_OVER + sta PHYSICIST_STATE + + lda #22 + sta PHYSICIST_Y + lda #20 + sta PHYSICIST_X + + lda #1 + sta DIRECTION + + ;======================= + ; Run the intro + ;======================= + + ;======================= + ; Enter the game + ;======================= + + jsr ootw_vent + + +;=========================== +; quit_level +;=========================== + +quit_level: + jsr TEXT + jsr HOME + lda KEYRESET ; clear strobe + bit PAGE0 + + lda #0 + sta DRAW_PAGE + + lda #end_message + sta OUTH + + jsr move_and_print + jsr move_and_print + +wait_loop: + lda KEYPRESS + bpl wait_loop + + lda KEYRESET ; clear strobe + + jmp ootw_c3 + + +end_message: +.byte 8,10,"PRESS RETURN TO CONTINUE",0 +.byte 11,20,"ACCESS CODE: VENT",0 + +.include "ootw_c3_vent.s" +;.include "physicist.s" +.include "text_print.s" +.include "gr_pageflip.s" +.include "gr_unrle.s" +.include "gr_fast_clear.s" +.include "gr_copy.s" +.include "gr_copy_offset.s" +.include "gr_putsprite.s" +.include "gr_putsprite_flipped.s" +.include "gr_putsprite_crop.s" +.include "gr_offsets.s" +.include "gr_offsets_hl.s" +.include "gr_run_sequence.s" +.include "gr_overlay.s" +.include "random16.s" +.include "keyboard.s" + +; room backgrounds +.include "ootw_graphics/l3vent/ootw_c3_vent.inc" +; sprites +;.include "ootw_graphics/sprites/sprites_physicist.inc" + diff --git a/ootw/ootw_c3_vent.s b/ootw/ootw_c3_vent.s new file mode 100644 index 00000000..e14ce1ea --- /dev/null +++ b/ootw/ootw_c3_vent.s @@ -0,0 +1,143 @@ +; Ootw Checkpoint3 -- Rolling around the vents + +ootw_vent: + + ;============================== + ; init + + lda #0 + + ; load background + lda #>(vent_rle) + sta GBASH + lda #<(vent_rle) + sta GBASL + lda #$c ; load to page $c00 + jsr load_rle_gr ; tail call + + ;=========================== + ; Enable graphics + + bit LORES + bit SET_GR + bit FULLGR + + ;=========================== + ; Setup pages (is this necessary?) + + lda #0 + sta DRAW_PAGE + lda #1 + sta DISP_PAGE + + ;================================= + ; copy to screen + + jsr gr_copy_to_current + jsr page_flip + + ;================================= + ; setup vars + + lda #0 + sta GAIT + sta GAME_OVER + + ;============================ + ; Vent Loop + ;============================ +vent_loop: + + ;================================ + ; copy background to current page + + jsr gr_copy_to_current + + ;================================== + ; draw background action + + ;=============================== + ; check keyboard + + jsr handle_keypress + + ;=============================== + ; move physicist + +; jsr move_physicist + + ;=============== + ; check room limits + +; jsr check_screen_limit + + + ;=============== + ; draw physicist + +; jsr draw_physicist + + + ;=============== + ; page flip + + jsr page_flip + + ;================ + ; inc frame count + + inc FRAMEL + bne vent_frame_no_oflo + inc FRAMEH +vent_frame_no_oflo: + + ;========================== + ; check if done this level + ;========================== + + lda GAME_OVER + beq still_in_vent + + cmp #$ff ; if $ff, we died + beq done_vent + + ;=============================== + ; check if exited room to right +; cmp #1 +; beq jail_exit_left + + ;================= + ; exit to right + +;jail_right_yes_exit: + +; lda #0 +; sta PHYSICIST_X +;jer_smc: +; lda #$0 ; smc+1 = exit location +; sta WHICH_CAVE +; jmp done_jail + + ;===================== + ; exit to left + +;jail_exit_left: + +; lda #37 +; sta PHYSICIST_X +;jel_smc: +; lda #0 ; smc+1 +; sta WHICH_CAVE +; jmp done_jail + + ; loop forever +still_in_vent: + lda #0 + sta GAME_OVER + + jmp vent_loop + +done_vent: + rts + + diff --git a/ootw/ootw_graphics/l3vent/Makefile b/ootw/ootw_graphics/l3vent/Makefile new file mode 100644 index 00000000..e331e46a --- /dev/null +++ b/ootw/ootw_graphics/l3vent/Makefile @@ -0,0 +1,18 @@ +include ../../../Makefile.inc + +PNG2RLE = ../../../gr-utils/png2rle +PNG2LZ4 = ../../../gr-utils/png2lz4 + +all: ootw_c3_vent.inc + +##### + +ootw_c3_vent.inc: $(PNG2RLE) \ + vent.png + $(PNG2RLE) asm vent.png vent_rle > ootw_c3_vent.inc + +##### + +clean: + rm -f *~ *.o *.lst *.lzz *.inc + diff --git a/ootw/ootw_graphics/l3vent/ootw_c3_vent.inc b/ootw/ootw_graphics/l3vent/ootw_c3_vent.inc new file mode 100644 index 00000000..f0370796 --- /dev/null +++ b/ootw/ootw_graphics/l3vent/ootw_c3_vent.inc @@ -0,0 +1,5 @@ +vent_rle: .byte $28 ; ysize=48 + .byte $A0,$11,$00, $20,$20, $22, $00,$00, $22, $20, $A0,$24,$00 + .byte $90, $4B, $A0,$23,$00, $A3,$20, $29, $2B, $20,$20 + .byte $A0,$FF,$00, $A0,$FF,$00, $A0,$FF,$00, $A0,$5B,$00 + .byte $A1 diff --git a/ootw/ootw_graphics/l3vent/vent.png b/ootw/ootw_graphics/l3vent/vent.png new file mode 100644 index 0000000000000000000000000000000000000000..0e45d1760127bc48e29e7c2073e1dc10e58fa7bd GIT binary patch literal 257 zcmeAS@N?(olHy`uVBq!ia0vp^0YGfP!VDx!PCqyT;sp4FxB}_NatR53d;h!qWmudr zXU-gv^M5ZK{-039{6EWP?%cWm7hDkeYIEUkZ_)n?|Ns9_WS?0J)WewM?e4vL>4nJ2(JfW#^h&xhk=6ZC7!;n?2p-b1jQ9U{Q0{YC?r|p8d2h$pPQSSSHj?2 zl$uzQnxasiS(2gP?&%v4-pD5oRAl7o;uvCaIyvD0i&uh+fQDwHh|ppojxyopJ&DV> tH*$3v1#&V;xE<7xU|pOb($l2K%fKDZa?