From: Lukas Krickl Date: Sun, 14 Sep 2025 10:34:57 +0000 (+0200) Subject: debug: Added stub for debug menu X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=07f5325a1b9dcf167db2868d10fe8c7e263f16ea;p=gbrg%2F.git debug: Added stub for debug menu --- diff --git a/src/action_menu.s b/src/action_menu.s index ea34afd..e4d7966 100644 --- a/src/action_menu.s +++ b/src/action_menu.s @@ -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 index 0000000..408e8b6 --- /dev/null +++ b/src/debug.s @@ -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 diff --git a/src/main.s b/src/main.s index 6585a40..0587cf8 100644 --- a/src/main.s +++ b/src/main.s @@ -84,6 +84,7 @@ main: #include "shoot.s" #include "action_menu.s" #include "select_menu.s" +#include "debug.s" ; fill bank .fill 0xFF, 0x4000 - $ diff --git a/src/update.s b/src/update.s index 7b4e66e..8971f4f 100644 --- a/src/update.s +++ b/src/update.s @@ -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