diff --git a/duke/Makefile b/duke/Makefile index 819b02b0..efa9298f 100644 --- a/duke/Makefile +++ b/duke/Makefile @@ -26,6 +26,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 \ graphics/duke_graphics.inc \ maps/level1_map.lzsa \ status_bar.s draw_duke.s gr_putsprite_crop.s \ diff --git a/duke/draw_duke.s b/duke/draw_duke.s index 32b8e824..c06fd230 100644 --- a/duke/draw_duke.s +++ b/duke/draw_duke.s @@ -6,6 +6,8 @@ move_duke: jsr check_falling + jsr handle_jumping + lda DUKE_WALKING beq done_move_duke @@ -63,11 +65,30 @@ duke_collide: rts + + ;========================= + ; check_jumping + ;========================= +handle_jumping: + + lda DUKE_JUMPING + beq done_handle_jumping + + dec DUKE_Y + dec DUKE_Y + dec DUKE_JUMPING + +done_handle_jumping: + rts + ;========================= ; check_falling ;========================= check_falling: + lda DUKE_JUMPING + bne done_check_falling + ; check below feet ; block index below feet is (y+10)*16/4 + (x/2) + 1 @@ -100,7 +121,7 @@ check_falling: jsr copy_tilemap_subset done_check_below: - +done_check_falling: rts diff --git a/duke/duke.s b/duke/duke.s index cac6005b..ace84782 100644 --- a/duke/duke.s +++ b/duke/duke.s @@ -159,6 +159,7 @@ done_with_duke: .include "status_bar.s" .include "keyboard.s" .include "joystick.s" + .include "print_help.s" .include "draw_duke.s" .include "handle_laser.s" diff --git a/duke/keyboard.s b/duke/keyboard.s index b4862014..6094f503 100644 --- a/duke/keyboard.s +++ b/duke/keyboard.s @@ -78,13 +78,20 @@ keypress: check_sound: cmp #$14 ; control-T - bne check_joystick + bne check_help lda SOUND_STATUS eor #SOUND_DISABLED sta SOUND_STATUS jmp done_keypress +check_help: + cmp #'H' ; H (^H is same as left) + bne check_joystick + + jsr print_help + jmp done_keypress + ; can't be ^J as that's the same as down check_joystick: cmp #'J' ; J @@ -163,7 +170,7 @@ check_down: cmp #'S' beq down_pressed cmp #$0A - bne check_return + bne check_space down_pressed: lda CURSOR_Y ; if 48help_text + sta OUTH + jsr move_and_print_list + + jsr page_flip + +wait_for_keypress: + lda KEYPRESS + bpl wait_for_keypress + bit KEYRESET + + + bit SET_GR + rts + +help_text: +.byte 0, 5,"CONTROLS:",0 +.byte 3, 6, "A OR <- : MOVE LEFT",0 +.byte 3, 7, "D OR -> : MOVE RIGHT",0 +.byte 3, 8, "SPACEBAR : JUMP",0 +.byte 3,11, "RETURN : SHOOT LASER",0 +.byte 3,12, "ESC : QUITS",0 +.byte 255 diff --git a/duke/status_bar.s b/duke/status_bar.s index d4361ec4..612984bf 100644 --- a/duke/status_bar.s +++ b/duke/status_bar.s @@ -22,7 +22,7 @@ draw_status_bar: help_string: - .byte 3,20," PRESS ^H FOR HELP ",0 + .byte 3,20," PRESS 'H' FOR HELP ",0 score_string: ; 012456789012345678901234567890123456789 diff --git a/duke/text_print.s b/duke/text_print.s index 12f55170..0ff20932 100644 --- a/duke/text_print.s +++ b/duke/text_print.s @@ -90,7 +90,7 @@ done_print_string: rts -.if 0 + ;================================ ; move and print a list of lines ;================================ @@ -103,7 +103,7 @@ move_and_print_list: rts - +.if 0 ;================================ ; move and print a list of lines ;================================