From 8a222dd57a9f73c228aa07bd491e5abbc98f2644 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 15 Dec 2020 10:19:46 -0500 Subject: [PATCH] duke: escape now quits to title --- duke/Makefile | 2 +- duke/TODO | 11 +++++++++++ duke/duke.s | 8 +++++--- duke/keyboard.s | 12 +++++++++++- duke/quit_yn.s | 46 ++++++++++++++++++++++++++++++++++++++++++++++ duke/zp.inc | 1 + 6 files changed, 75 insertions(+), 5 deletions(-) create mode 100644 duke/quit_yn.s diff --git a/duke/Makefile b/duke/Makefile index 056e9819..dd9431e3 100644 --- a/duke/Makefile +++ b/duke/Makefile @@ -42,7 +42,7 @@ DUKE: duke.o ld65 -o DUKE duke.o -C ../linker_scripts/apple2_2000.inc duke.o: duke.s zp.inc hardware.inc duke.s \ - print_help.s gr_fast_clear.s \ + print_help.s gr_fast_clear.s quit_yn.s \ graphics/duke_graphics.inc \ maps/level1_map.lzsa \ status_bar.s draw_duke.s move_duke.s gr_putsprite_crop.s \ diff --git a/duke/TODO b/duke/TODO index 2e2061ee..c807e9d3 100644 --- a/duke/TODO +++ b/duke/TODO @@ -1,3 +1,14 @@ +door +~~~~ +door animation +sad noise wehn not have key +key in inventory +key pickup noise +NO BONUS message +back to title screen +are you sure message on quit + + sound: ~~~~~~ click on jump diff --git a/duke/duke.s b/duke/duke.s index a615b378..45044633 100644 --- a/duke/duke.s +++ b/duke/duke.s @@ -5,7 +5,7 @@ ; Zero Page .include "zp.inc" .include "hardware.inc" - + .include "common_defines.inc" TILES = $9000 BIG_TILEMAP = $9400 @@ -155,7 +155,7 @@ no_frame_oflo: ;=========================== lda LEVEL_OVER - bpl do_duke_loop + beq do_duke_loop jmp done_with_duke @@ -174,7 +174,8 @@ do_duke_loop: done_with_duke: bit KEYRESET ; clear keypress - jmp done_with_duke + rts ; exit back + ;========================== ; includes @@ -195,6 +196,7 @@ done_with_duke: .include "keyboard.s" .include "joystick.s" .include "print_help.s" + .include "quit_yn.s" .include "draw_duke.s" .include "move_duke.s" diff --git a/duke/keyboard.s b/duke/keyboard.s index a46ea8ee..90c07065 100644 --- a/duke/keyboard.s +++ b/duke/keyboard.s @@ -205,7 +205,7 @@ space_pressed: check_return: cmp #13 - bne done_keypress + bne check_escape return_pressed: @@ -245,6 +245,16 @@ laser_assign: done_return: jmp no_keypress +check_escape: + cmp #27 + bne done_keypress + + jsr print_quit + + jmp done_keypress + + + done_keypress: no_keypress: bit KEYRESET diff --git a/duke/quit_yn.s b/duke/quit_yn.s new file mode 100644 index 00000000..e345e8b1 --- /dev/null +++ b/duke/quit_yn.s @@ -0,0 +1,46 @@ +; Quit? Are you sure? + +print_quit: + bit KEYRESET ; clear keyboard + bit SET_TEXT + + jsr normal_text + + lda #' '|$80 + sta clear_all_color+1 + jsr clear_all + + lda #quit_text + sta OUTH + jsr move_and_print_list + + jsr page_flip + +query_quit: + lda KEYPRESS + bpl query_quit + bit KEYRESET + + cmp #'Y'|$80 + beq really_quit + cmp #'y'|$80 + beq really_quit + + bit SET_GR + rts + +really_quit: + lda #GAME_OVER + sta LEVEL_OVER + + lda #LOAD_TITLE + sta WHICH_LOAD + + rts + +quit_text: +.byte 8,10,"ARE YOU SURE YOU WANT TO",0 +.byte 14,11,"QUIT? (Y/N)",0 +.byte 255 diff --git a/duke/zp.inc b/duke/zp.inc index 5335be76..ee1d30b6 100644 --- a/duke/zp.inc +++ b/duke/zp.inc @@ -127,6 +127,7 @@ SOUND_STATUS = $DE GRID_PAGE = $DF ANIMATE_FRAME = $E0 LEVEL_OVER = $E1 + GAME_OVER = $FF LOCATIONS_L = $E2 LOCATIONS_H = $E3