debug: Added stub for debug menu
authorLukas Krickl <lukas@krickl.dev>
Sun, 14 Sep 2025 10:34:57 +0000 (12:34 +0200)
committerLukas Krickl <lukas@krickl.dev>
Sun, 14 Sep 2025 10:34:57 +0000 (12:34 +0200)
src/action_menu.s
src/debug.s [new file with mode: 0644]
src/main.s
src/update.s

index ea34afddfa224c6c9a7bad9031bc23eabb68c13d..e4d796630bc7cb25c3e8f8664bdeef9b223ce54d 100644 (file)
@@ -50,6 +50,16 @@ update_action_menu:
                ret
 @notb:
        
+       ; on up enter debug mode
+       ld b, BTNUP
+       input_just
+       jr z, @notup REL
+               ; load debug menu
+               call debug_menu_init
+               ldnull bc
+               ret
+@notup:
+       
        ; update menu
        ld a, [action_menu_cursor]
        ld hl, action_menu_str_table
diff --git a/src/debug.s b/src/debug.s
new file mode 100644 (file)
index 0000000..408e8b6
--- /dev/null
@@ -0,0 +1,53 @@
+; this is a helper file for a debug menu
+
+str_dbg_new_game:
+.str "RELOAD"
+.db 0
+
+str_dbg_clear_actors:
+.str "CLEAR ACTORS"
+.db 0
+
+debug_menu_str_table:
+       dw str_dbg_new_game
+       dw str_dbg_clear_actors
+debug_menu_str_table_end:
+
+#define DEBUG_MENU_STR_TABLE_LEN (debug_menu_str_table_end - debug_menu_str_table)
+
+debug_menu_action_table:
+debug_menu_action_table_end:
+
+       ; updates the debug menu
+       ; inputs:
+       ;               de: state
+       ;       returns:
+       ;               bc: next state
+update_debug_menu:
+       ; exit debug menu on b press
+       ld b, BTNB
+       input_just
+       jr z, @notb REL
+               ld bc, st_update_game
+               ret
+@notb:
+
+       ldnull bc
+       ret
+
+debug_menu_init:
+       ld hl, game_mode
+       ld de, st_next
+       add hl, de
+       ; write st_update_debug_menu to std_Next
+       ld a, st_update_debug_menu LO
+       ld [hl+], a
+       ld a, st_update_debug_menu HI
+       ld [hl], a
+
+       ; draw initial status line
+       ld a, [action_menu_cursor]
+       ld b, DEBUG_MENU_STR_TABLE_LEN 
+       ld hl, debug_menu_str_table
+       call select_menu_draw_status
+       ret
index 6585a40c0d0c79db7651a9bf16c8f0a2ce7316df..0587cf8fa8810bd9b4400e50661457501b76548a 100644 (file)
@@ -84,6 +84,7 @@ main:
 #include "shoot.s"
 #include "action_menu.s"
 #include "select_menu.s"
+#include "debug.s"
 
 ; fill bank
 .fill 0xFF, 0x4000 - $
index 7b4e66e799c481ca73e57468a2a626454ba672ca..8971f4fc33de33bb7ae419355135a01db00fb296 100644 (file)
@@ -110,3 +110,6 @@ st_update_game_over:
 
 st_update_action_menu:
        st_def 0x00, update_action_menu, st_update_action_menu
+
+st_update_debug_menu:
+       st_def 0x00, update_debug_menu, st_update_debug_menu