diff options
author | Astatin <[email protected]> | 2024-12-12 17:33:37 +0900 |
---|---|---|
committer | Astatin <[email protected]> | 2024-12-12 17:33:37 +0900 |
commit | bfc32de4fd80c7bb51283840abf21d48151b5feb (patch) | |
tree | d38f2ca7acf89961f538a1ea7d65d279e42f81d2 | |
parent | e93a99e8e8565db0111b40d3286ce3d78f263559 (diff) |
Fix copy dialogue buffer update outside of VBlank (+ add dbg for lcd status at the end of expected vblank thingy)
-rw-r--r-- | definitions.gbasm | 10 | ||||
-rw-r--r-- | dialogues.gbasm | 2 | ||||
-rw-r--r-- | dialogues.gbtxt | 1 | ||||
-rw-r--r-- | gui.gbasm | 14 | ||||
-rw-r--r-- | main.gbasm | 22 | ||||
-rw-r--r-- | utils.gbasm | 8 |
6 files changed, 38 insertions, 19 deletions
diff --git a/definitions.gbasm b/definitions.gbasm index 8da8615..4e60a84 100644 --- a/definitions.gbasm +++ b/definitions.gbasm @@ -61,6 +61,8 @@ .DEFINE mem_display_flag ($c013) ; bit 0: if dialogue box is displayed +; bit 1: dialogue box first line should be bold +; bit 2: if dialogue box text should be refreshed .DEFINE mem_current_mode ($c014) .DEFINE mem_requested_mode ($c015) @@ -140,10 +142,10 @@ .DEFINE dialogue_menu_choice3 $cac5 .DEFINE dialogue_menu_choice4 $cace -.DEFINE dialogue_menu_choice1_cursor ($caa0) -.DEFINE dialogue_menu_choice2_cursor ($caa9) -.DEFINE dialogue_menu_choice3_cursor ($cac4) -.DEFINE dialogue_menu_choice4_cursor ($cacd) +.DEFINE dialogue_menu_choice1_cursor ($9dc1) +.DEFINE dialogue_menu_choice2_cursor ($9dca) +.DEFINE dialogue_menu_choice3_cursor ($9e01) +.DEFINE dialogue_menu_choice4_cursor ($9e0a) .DEFINE mem_last_animation_low_pointer ($cadf) diff --git a/dialogues.gbasm b/dialogues.gbasm index 66e5c0b..7ec280e 100644 --- a/dialogues.gbasm +++ b/dialogues.gbasm @@ -2,6 +2,8 @@ Bunny_Prefix: .DB 0x8b, 0x9e, 0x97, 0x97, 0xa2, 0xaa, 0xff Text_1: .DB 0x91, 0x8e, 0x95, 0x95, 0x98, 0x0, 0xa5, 0xff +Debug_Text: +.DB 0x8d, 0x8b, 0x90, 0xff Menu_Choice_1: .DB 0x91, 0x98, 0x99, 0xff Menu_Choice_2: diff --git a/dialogues.gbtxt b/dialogues.gbtxt index 23676d8..7d42325 100644 --- a/dialogues.gbtxt +++ b/dialogues.gbtxt @@ -1,5 +1,6 @@ Bunny_Prefix: Bunny: Text_1: Hello ! +Debug_Text: DBG Menu_Choice_1: Hop Menu_Choice_2: Heal Menu_Choice_3: Freeze @@ -1,16 +1,18 @@ Copy_Dialogue_Buffer: LD A, $mem_display_flag - BIT 0, A + BIT 2, A RET Z + RES 2, A + LD $mem_display_flag, A LD HL, $9dc1 LD DE, $dialogue_first_line LD BC, $12 CALL =memcpy - LD HL, $9de1 - LD DE, $dialogue_second_line - LD BC, $12 - CALL =memcpy + ; LD HL, $9de1 + ; LD DE, $dialogue_second_line + ; LD BC, $12 + ; CALL =memcpy LD HL, $9e01 LD DE, $dialogue_third_line @@ -184,7 +186,7 @@ Check_Open_Menu_button: CALL =Init_Menu - LD A, $01 + LD A, $05 LD $mem_display_flag, A LD A, $enum_dungeon_menu_mode @@ -91,17 +91,28 @@ New_Dungeon: LD $mem_current_mode, A LD $mem_requested_mode, A + LD HL, $9c0f + LD BC, =Debug_Text + CALL =Print_str + + LD A, $68 + LD ($9c02), A + .ENABLE_WINDOW_NO_WAIT_HBLANK .ENABLE_VBLANK_INTERRUPTS EI - Wait_for_VRAM.loop: + Wait_for_Interrupt.loop: HALT EI - JP =Wait_for_VRAM.loop + JP =Wait_for_Interrupt.loop VBLANK_Entrypoint: .ENABLE_WINDOW_NO_WAIT_HBLANK + LD A, $tmp_var_5 + LD HL, $9c12 + CALL =Print_8bit + LD A, $palette_bold_font LD $reg_bg_palette, A @@ -109,9 +120,6 @@ VBLANK_Entrypoint: LD A, $mem_bunny_health CALL =Print_8bit - LD A, $68 - LD (HL), A - CALL $OAM_DMA_Transfer_routine CALL =Loading_Mode_VBlank @@ -122,9 +130,13 @@ VBLANK_Entrypoint: CALL =Display_Object Skip_VBlank_Dungeon_Update: + CALL =Copy_Dialogue_Buffer CALL =Display_dialogue_cursor + LD A, $reg_lcd_status + LD $tmp_var_5, A + ; LYC LD A, $09 LD $reg_lyc, A diff --git a/utils.gbasm b/utils.gbasm index b32d3ea..5063f83 100644 --- a/utils.gbasm +++ b/utils.gbasm @@ -235,10 +235,10 @@ VBlank_Wait: BIT 7, A JR Z, =VBlank_Wait.End VBlank_Wait.loop: - LD A, $reg_lcd_status - AND $03 - CP $01 - JR NZ, =VBlank_Wait.loop + LD A, $reg_lcd_status + AND $03 + CP $01 + JR NZ, =VBlank_Wait.loop VBlank_Wait.End: POP AF RET |