diff options
author | Astatin <[email protected]> | 2025-07-29 17:18:39 +0200 |
---|---|---|
committer | Astatin <[email protected]> | 2025-07-29 17:18:39 +0200 |
commit | 4db56b6d877ee88a672f5361bbe372783086353d (patch) | |
tree | 178243cc2b5838a361775d2afbf32a8b196e3870 | |
parent | be66214bde75566e946a02ec4b739570c5968d5c (diff) |
Add title screen
-rw-r--r-- | main.gbasm | 118 | ||||
-rw-r--r-- | modes/titlescreen.gbasm | 135 | ||||
-rw-r--r-- | music/title-screen-music.fur | bin | 0 -> 708 bytes | |||
-rw-r--r-- | scripts/generate-tiledata.py | 5 | ||||
-rw-r--r-- | sprites/gui/title-screen.png | bin | 0 -> 1833 bytes | |||
-rw-r--r-- | text.gbasm | 4 | ||||
-rw-r--r-- | text.gbtxt | 3 | ||||
-rw-r--r-- | tileset.gbasm | 180 | ||||
-rw-r--r-- | utils.gbasm | 117 |
9 files changed, 448 insertions, 114 deletions
@@ -2,117 +2,6 @@ .INCLUDE "init.gbasm" .INCLUDE "utils.gbasm" -.MACRODEF HBLANK_WAIT - LD A, $reg_lcd_controller - BIT 7, A - JR Z, =$HBlank_Wait.End - $HBlank_Wait.loop: - LD A, $reg_lcd_status - AND $03 - CP $00 - JR NZ, =$HBlank_Wait.loop - $HBlank_Wait.End: -.END - -.MACRODEF SET_WINDOW_LCDC_E - LD A, $mem_display_flag - BIT 3, A - LD E, $00 - JR Z, =$No_Window - LD E, $60 - $No_Window: -.END - -.MACRODEF ENABLE_TOP_BAR - XOR A - LD $reg_viewport_x, A - LD A, $57 - LD $reg_viewport_y, A - - LD A, $lcdc_guibg_tilemap - OR E - LD $reg_lcd_controller, A - - LD A, $palette_bold_font - LD $reg_bg_palette, A -.END - -.MACRODEF DISABLE_TOP_BAR - LD A, $mem_prepared_viewport_x - LD $reg_viewport_x, A - LD A, $mem_prepared_viewport_y - LD $reg_viewport_y, A - LD A, $mem_prepared_color_palette - LD $reg_bg_palette, A - - LD A, $lcdc_mapbg_tilemap - OR E - LD $reg_lcd_controller, A -.END - -.MACRODEF ENABLE_DIALOGUE - .HBLANK_WAIT - LD A, $98 - LD $reg_viewport_x, A - LD A, $b8 - LD $reg_viewport_y, A - - LD A, $lcdc_guibg_tilemap - OR E - LD $reg_lcd_controller, A -.END - -.MACRODEF DISABLE_DIALOGUE - PUSH BC - LD A, $mem_prepared_viewport_x - LD B, A - LD A, $mem_prepared_viewport_y - LD C, A - .HBLANK_WAIT - LD A, B - LD $reg_viewport_x, A - LD A, C - LD $reg_viewport_y, A - LD A, $mem_prepared_color_palette - LD $reg_bg_palette, A - LD A, $lcdc_mapbg_tilemap - OR E - LD $reg_lcd_controller, A - POP BC -.END - -.MACRODEF ENABLE_VBLANK_INTERRUPTS - LD A, $reg_interrupt_flags - RES 0, A - LD $reg_interrupt_flags, A - LD A, $reg_interrupt_enable - OR $01 - LD $reg_interrupt_enable, A -.END - -.MACRODEF RESET_INTERRUPTS - LD A, $00 - LD $reg_interrupt_flags, A -.END - -.MACRODEF ENABLE_LYC_INTERRUPT - LD A, low(=STAT_Entrypoint) - LD ($mem_stat_jump_destination), A - LD A, high(=STAT_Entrypoint) - LD ($mem_stat_jump_destination+1), A - .RESET_INTERRUPTS - LD A, $40 - LD $reg_lcd_status, A - LD A, $02 - LD $reg_interrupt_enable, A -.END - -.MACRODEF DISABLE_LYC_INTERRUPT - LD A, $reg_interrupt_enable - RES 1, A - LD $reg_interrupt_enable, A -.END - Entrypoint: CALL =Initialize_RNG @@ -134,11 +23,11 @@ Entrypoint: LD A, L LD ($mem_dungeon+2), A - CALL =Load_Tile - CALL =Load_Music - JP =New_Dungeon + ; JP =New_Dungeon + .LOAD_BANK_OF =Title_Screen + JP ptr(=Title_Screen) .INCLUDE "tiles.gbasm" .INCLUDE "rng.gbasm" @@ -167,6 +56,7 @@ Entrypoint: .INCLUDE "music/load.gbasm" .PADTO $4000 +.INCLUDE "modes/titlescreen.gbasm" .INCLUDE "tileset.gbasm" .INCLUDE "text.gbasm" .INCLUDE "dialogues/dialogues.gbasm" diff --git a/modes/titlescreen.gbasm b/modes/titlescreen.gbasm new file mode 100644 index 0000000..22640b2 --- /dev/null +++ b/modes/titlescreen.gbasm @@ -0,0 +1,135 @@ +Title_Screen: + .ASSERT bank(.) bank(=Title_Screen_Sprite_Data) + .ASSERT bank(.) bank(=Title_Screen_Sprite_Data.end) + + LD HL, $9010 + LD DE, ptr(=Title_Screen_Sprite_Data) + LD BC, $07f0 + CALL =memcpy + + LD HL, $8C00 + LD DE, =Title_Screen_Sprite_Data+$07f0 + LD BC, =Title_Screen_Sprite_Data.end-=Title_Screen_Sprite_Data-$07f0 + CALL =memcpy + + LD HL, $8800 + LD DE, ptr(=Font_Data) + LD BC, =Font_Data.end-=Font_Data + CALL =memcpy + + .draw_picture: + LD HL, $9842 + LD C, $01 + .draw_picture.loop16times: + LD B, $10 + .draw_picture.loop: + LD A, C + LD (HL+), A + DEC B + INC C + LD A, C + CP $80 + JR NZ, =.skip_font_skip + LD C, $C0 + .skip_font_skip: + LD A, B + CP $00 + JR NZ, =.draw_picture.loop + LD A, L + ADD $10 + LD L, A + LD A, H + ADC $00 + LD H, A + LD A, H + CP $99 + JR NZ, =.draw_picture.loop16times + LD A, L + CP $A2 + JR NZ, =.draw_picture.loop16times + + + LD A, $00 + LD $reg_viewport_x, A + LD $reg_viewport_y, A + LD A, $lcdc_mapbg_tilemap + LD $reg_lcd_controller, A + + LD A, $80 + .blink: + .blink.loop1: + CALL =Check_Frame_stuff + INC A + CP $20 + JR NZ =.blink.loop1 + CALL =.blink.draw_text + LD A, $00 + .blink.loop2: + CALL =Check_Frame_stuff + INC A + CP $20 + JR NZ =.blink.loop2 + CALL =.blink.undraw_text + LD A, $00 + JR =.blink + + .blink.draw_text: + PUSH BC + LD HL, $99C4 + LD BC, =Press_Txt + CALL =Print_str + INC HL + INC HL + LD BC, =Start_Txt + CALL =Print_str + POP BC + RET + + .blink.undraw_text: + PUSH BC + LD HL, $99C4 + LD BC, $000C + CALL =bzero + POP BC + RET + +Check_Frame_stuff: + CALL =RNG_Step + CALL =Pad_Button_Check + PUSH AF + LD A, $mem_button_action + BIT 3, A + JR NZ, =Title_Screen_Start_Pressed + + POP AF + CALL =Next_VBlank_Wait + RET + +Title_Screen_Start_Pressed: + LD A, $00 + .loop: + CALL =Next_VBlank_Wait + INC A + CP $05 + JR NZ =.loop + LD A, $reg_bg_palette + CP $00 + SLA A + SLA A + LD $reg_bg_palette, A + JR NZ, =Title_Screen_Start_Pressed + + LD A, $00 + .loop2: + CALL =Next_VBlank_Wait + INC A + CP $30 + JR NZ =.loop2 + + CALL =Next_VBlank_Wait + LD A, $00 + LD $reg_lcd_controller, A + + CALL =Load_Tile + + JP =New_Dungeon diff --git a/music/title-screen-music.fur b/music/title-screen-music.fur Binary files differnew file mode 100644 index 0000000..f20eff8 --- /dev/null +++ b/music/title-screen-music.fur diff --git a/scripts/generate-tiledata.py b/scripts/generate-tiledata.py index 105ac00..5ef0635 100644 --- a/scripts/generate-tiledata.py +++ b/scripts/generate-tiledata.py @@ -150,3 +150,8 @@ get_sprite_png_parse_output("./sprites/animations/ball.png", tallmode=True) get_sprite_png_parse_output("./sprites/animations/bubble1.png", tallmode=True) get_sprite_png_parse_output("./sprites/animations/bubble2.png", tallmode=True) print("\nAnimation_Sprites_Data.end:") + +sprite_idx = 0x01 +print("\nTitle_Screen_Sprite_Data:") +get_sprite_png_parse_output("./sprites/gui/title-screen.png", sprite_8x8=True) +print("\nTitle_Screen_Sprite_Data.end:") diff --git a/sprites/gui/title-screen.png b/sprites/gui/title-screen.png Binary files differnew file mode 100644 index 0000000..83ce3ad --- /dev/null +++ b/sprites/gui/title-screen.png @@ -9,3 +9,7 @@ Earcoptr_Attack_Menu_Txt: .DB 0x8e, 0x8a, 0x9b, 0x8c, 0x98, 0x99, 0x9d, 0x9b, 0xff Dungeon_Name_1_Txt: .DB 0x96, 0x98, 0x9b, 0x97, 0x92, 0x97, 0x90, 0x0, 0x8f, 0x98, 0x9b, 0x8e, 0x9c, 0x9d, 0xff +Press_Txt: +.DB 0x99, 0x9b, 0x8e, 0x9c, 0x9c, 0xff +Start_Txt: +.DB 0x9c, 0x9d, 0x8a, 0x9b, 0x9d, 0xff @@ -4,3 +4,6 @@ Freeze_Attack_Menu_Txt: Freeze Earcoptr_Attack_Menu_Txt: Earcoptr Dungeon_Name_1_Txt: Morning Forest + +Press_Txt: Press +Start_Txt: Start diff --git a/tileset.gbasm b/tileset.gbasm index 7cd0aa1..0d749b7 100644 --- a/tileset.gbasm +++ b/tileset.gbasm @@ -363,3 +363,183 @@ Animation_Sprites_Data: .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x69 Animation_Sprites_Data.end: + +Title_Screen_Sprite_Data: + .DB $ff, $ff, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80 ; 0x01 + .DB $ff, $ff, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x02 + .DB $ff, $ff, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $1e, $1e, $7e, $72 ; 0x03 + .DB $ff, $ff, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x04 + .DB $ff, $ff, $04, $07, $04, $07, $04, $07, $04, $07, $04, $07, $04, $07, $04, $07 ; 0x05 + .DB $ff, $ff, $bf, $40, $ff, $00, $ef, $10, $7e, $81, $5e, $a1, $3f, $c0, $3a, $c5 ; 0x06 + .DB $ff, $ff, $ff, $00, $ff, $00, $7e, $81, $3f, $c0, $fc, $03, $90, $6f, $e3, $1f ; 0x07 + .DB $ff, $ff, $ff, $00, $df, $20, $ff, $00, $8f, $70, $6f, $fe, $c1, $ff, $00, $ff ; 0x08 + .DB $ff, $ff, $ff, $00, $b7, $48, $fd, $02, $ff, $00, $ff, $00, $ff, $e0, $1f, $fc ; 0x09 + .DB $ff, $ff, $ff, $00, $ff, $00, $ff, $00, $b1, $4e, $ff, $00, $ff, $00, $df, $20 ; 0x0a + .DB $ff, $ff, $bf, $40, $7f, $80, $ff, $10, $ff, $10, $ff, $10, $ef, $30, $cf, $f0 ; 0x0b + .DB $ff, $ff, $5f, $a0, $fe, $01, $ff, $00, $ff, $00, $ff, $38, $ef, $7f, $c7, $f9 ; 0x0c + .DB $ff, $ff, $fe, $07, $ff, $03, $ef, $10, $ff, $00, $ff, $00, $fe, $01, $fe, $c1 ; 0x0d + .DB $ff, $ff, $1f, $e0, $c7, $b9, $fc, $c7, $fc, $5f, $c1, $7e, $cb, $74, $f0, $7f ; 0x0e + .DB $ff, $ff, $f3, $0e, $c7, $be, $df, $fc, $7e, $f1, $7c, $c3, $1f, $e0, $ac, $d3 ; 0x0f + .DB $ff, $ff, $ff, $01, $ff, $01, $d7, $29, $ff, $01, $ff, $01, $ff, $01, $ff, $01 ; 0x10 + .DB $80, $80, $81, $81, $81, $81, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80 ; 0x11 + .DB $1f, $1f, $ff, $e0, $80, $ff, $ff, $ff, $01, $01, $07, $07, $0d, $0d, $01, $01 ; 0x12 + .DB $ff, $df, $9e, $7f, $07, $ff, $3f, $ff, $e0, $e0, $80, $80, $00, $00, $00, $00 ; 0x13 + .DB $e0, $e0, $f8, $38, $f8, $f8, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x14 + .DB $02, $03, $02, $03, $01, $01, $01, $01, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x15 + .DB $3f, $c0, $0b, $f4, $28, $d7, $05, $fa, $80, $ff, $41, $7e, $20, $3f, $10, $1f ; 0x16 + .DB $d4, $2f, $ac, $57, $a4, $5f, $64, $9f, $b2, $4f, $02, $ff, $01, $ff, $03, $ff ; 0x17 + .DB $0b, $f4, $47, $b8, $1d, $e2, $5b, $a4, $33, $cc, $0c, $f3, $97, $e8, $e2, $fd ; 0x18 + .DB $ff, $07, $7f, $83, $ff, $01, $ff, $01, $f7, $09, $ff, $01, $df, $21, $7f, $83 ; 0x19 + .DB $ff, $83, $ff, $ff, $39, $3f, $0e, $0f, $04, $07, $03, $03, $01, $01, $c0, $c0 ; 0x1a + .DB $bf, $c0, $2b, $d4, $8b, $f4, $cb, $f4, $65, $fa, $30, $ff, $99, $fe, $8d, $fe ; 0x1b + .DB $dd, $a2, $87, $f8, $d1, $ee, $f0, $7f, $ff, $0f, $fc, $03, $1e, $e1, $03, $ff ; 0x1c + .DB $ff, $20, $ff, $20, $ff, $60, $ff, $40, $bf, $c0, $1f, $e0, $c3, $3c, $50, $af ; 0x1d + .DB $fc, $0f, $ff, $03, $ef, $11, $ff, $00, $ff, $00, $ff, $00, $7f, $80, $21, $de ; 0x1e + .DB $af, $d0, $27, $d8, $e6, $d9, $d0, $6f, $c6, $79, $c4, $7b, $d1, $ef, $83, $ff ; 0x1f + .DB $ff, $01, $ff, $01, $07, $f9, $4f, $bd, $3f, $f9, $f3, $ed, $c5, $fb, $63, $fd ; 0x20 + .DB $80, $80, $80, $80, $81, $81, $9f, $9e, $9f, $90, $9f, $96, $8b, $8a, $83, $82 ; 0x21 + .DB $00, $00, $1c, $1c, $ff, $e3, $ff, $18, $e7, $66, $83, $82, $87, $85, $8f, $89 ; 0x22 + .DB $00, $00, $00, $00, $00, $00, $80, $80, $80, $80, $80, $80, $00, $00, $00, $00 ; 0x23 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x24 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x25 + .DB $0c, $0c, $01, $01, $01, $01, $01, $01, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x26 + .DB $0e, $3e, $90, $90, $c0, $40, $e0, $20, $f0, $90, $f0, $90, $f0, $90, $f8, $a8 ; 0x27 + .DB $20, $3f, $1f, $1f, $00, $00, $40, $40, $e0, $a0, $e0, $a0, $e0, $a0, $e0, $a0 ; 0x28 + .DB $3e, $c3, $07, $ff, $ff, $ff, $03, $03, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x29 + .DB $7f, $ff, $0f, $ff, $a0, $fc, $e9, $f9, $1b, $1a, $03, $02, $03, $02, $03, $02 ; 0x2a + .DB $fe, $ff, $26, $3f, $7b, $7f, $00, $3f, $90, $bf, $b5, $bf, $8f, $8f, $a0, $a0 ; 0x2b + .DB $43, $bf, $04, $fc, $f8, $f8, $3e, $fe, $01, $ff, $30, $ff, $c9, $ff, $78, $78 ; 0x2c + .DB $87, $f8, $f1, $fe, $1e, $1f, $01, $01, $c0, $c0, $70, $f0, $00, $c0, $18, $18 ; 0x2d + .DB $59, $a7, $73, $8f, $06, $fe, $8c, $fc, $f4, $fc, $24, $3c, $22, $3e, $32, $3e ; 0x2e + .DB $ff, $ff, $c6, $c7, $03, $03, $01, $01, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x2f + .DB $b3, $fd, $99, $ff, $4d, $ff, $b7, $ff, $d1, $ff, $61, $7f, $1d, $1f, $0d, $0f ; 0x30 + .DB $83, $82, $83, $82, $83, $82, $83, $82, $83, $82, $83, $82, $83, $82, $87, $84 ; 0x31 + .DB $fe, $f2, $fd, $05, $f9, $39, $c1, $c1, $81, $81, $81, $81, $81, $81, $c0, $40 ; 0x32 + .DB $00, $00, $90, $90, $f9, $69, $fb, $6a, $fb, $6a, $ff, $06, $ff, $36, $dd, $d5 ; 0x33 + .DB $00, $00, $e0, $e0, $f6, $16, $ff, $ed, $ff, $cc, $f7, $95, $e7, $25, $c6, $c6 ; 0x34 + .DB $00, $00, $00, $00, $c0, $c0, $e0, $20, $f0, $90, $70, $50, $70, $50, $60, $60 ; 0x35 + .DB $00, $00, $00, $00, $0c, $0c, $1f, $13, $1c, $14, $1c, $14, $1f, $17, $1f, $14 ; 0x36 + .DB $f8, $a8, $fc, $ac, $fe, $b2, $fd, $05, $ff, $b6, $ff, $b6, $df, $52, $cf, $4e ; 0x37 + .DB $e0, $a0, $e4, $a4, $ee, $aa, $ef, $29, $f7, $55, $ff, $cc, $ff, $c2, $fd, $1d ; 0x38 + .DB $0e, $0e, $5f, $51, $ff, $a4, $ff, $0c, $ff, $43, $ff, $4f, $ff, $60, $df, $df ; 0x39 + .DB $7b, $7a, $ff, $c4, $ff, $96, $ff, $b6, $fd, $b5, $fd, $b5, $e9, $e9, $00, $00 ; 0x3a + .DB $f0, $d0, $f0, $30, $fb, $eb, $bf, $ad, $ff, $65, $df, $51, $ee, $2e, $c0, $c0 ; 0x3b + .DB $03, $03, $f7, $f4, $ff, $09, $ff, $38, $ff, $b3, $ef, $a9, $47, $44, $13, $03 ; 0x3c + .DB $9c, $94, $de, $52, $de, $52, $ff, $6d, $ff, $dc, $ff, $95, $ff, $71, $8e, $8e ; 0x3d + .DB $12, $1e, $92, $9e, $73, $7f, $31, $3f, $81, $bf, $38, $3f, $70, $3f, $74, $3f ; 0x3e + .DB $00, $00, $00, $00, $00, $00, $00, $00, $80, $80, $c0, $c0, $60, $e0, $30, $f0 ; 0x3f + .DB $05, $07, $07, $07, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03, $03 ; 0x40 + .DB $87, $87, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80 ; 0x41 + .DB $80, $80, $00, $00, $00, $00, $00, $00, $01, $01, $03, $02, $03, $02, $01, $01 ; 0x42 + .DB $1f, $17, $0c, $0c, $08, $08, $18, $18, $f8, $f0, $f8, $10, $f8, $f0, $18, $10 ; 0x43 + .DB $80, $80, $e0, $e0, $30, $30, $1c, $1c, $06, $06, $23, $23, $71, $71, $78, $58 ; 0x44 + .DB $00, $00, $00, $00, $01, $01, $03, $03, $06, $06, $0e, $0c, $8c, $88, $cc, $c8 ; 0x45 + .DB $0f, $09, $66, $66, $fc, $fc, $07, $07, $03, $03, $07, $07, $07, $05, $0f, $0f ; 0x46 + .DB $81, $81, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x47 + .DB $e0, $e0, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x48 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x49 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x4a + .DB $01, $01, $01, $01, $01, $01, $00, $00, $00, $00, $00, $00, $19, $19, $2b, $2b ; 0x4b + .DB $08, $f0, $25, $da, $82, $fd, $c9, $f6, $60, $7f, $3f, $3f, $c0, $c0, $20, $20 ; 0x4c + .DB $20, $00, $f9, $06, $9f, $60, $6f, $90, $1f, $e3, $fe, $ff, $01, $01, $00, $00 ; 0x4d + .DB $f6, $1f, $f8, $1f, $fd, $1f, $fe, $3f, $fb, $ff, $1e, $ff, $e7, $ff, $f8, $ff ; 0x4e + .DB $18, $f8, $0c, $fc, $86, $fe, $83, $ff, $60, $ff, $e0, $ff, $50, $ff, $e0, $ff ; 0x4f + .DB $03, $03, $07, $07, $05, $07, $85, $87, $cd, $cf, $6d, $ef, $3f, $ff, $0d, $ff ; 0x50 + .DB $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80 ; 0x51 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x52 + .DB $1c, $10, $1f, $10, $1f, $13, $1e, $1e, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x53 + .DB $fe, $ce, $ff, $83, $ff, $c1, $7f, $70, $1f, $18, $0f, $0f, $03, $03, $01, $01 ; 0x54 + .DB $7c, $70, $38, $30, $98, $90, $d8, $d8, $cc, $4c, $c3, $43, $00, $00, $00, $00 ; 0x55 + .DB $0f, $0b, $1e, $1a, $1e, $1a, $3e, $3e, $60, $60, $c0, $c0, $60, $60, $20, $20 ; 0x56 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x57 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x58 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $03, $03, $07, $07, $0f, $0c ; 0x59 + .DB $00, $00, $00, $00, $0c, $0c, $17, $17, $23, $23, $47, $46, $ff, $cf, $ff, $7e ; 0x5a + .DB $46, $46, $c4, $c4, $8c, $8c, $df, $98, $ff, $30, $ff, $e0, $ff, $00, $ff, $02 ; 0x5b + .DB $20, $20, $30, $30, $1b, $1b, $0e, $0e, $ff, $0c, $ff, $06, $ff, $03, $ff, $00 ; 0x5c + .DB $00, $00, $1c, $1c, $fc, $fc, $1f, $1f, $33, $33, $fc, $20, $ff, $e0, $ff, $40 ; 0x5d + .DB $3c, $3f, $0f, $0f, $e3, $e3, $b0, $b0, $10, $10, $18, $18, $f8, $08, $fc, $0c ; 0x5e + .DB $08, $ff, $c4, $ff, $f4, $ff, $37, $3f, $1d, $1f, $0e, $0f, $07, $07, $03, $03 ; 0x5f + .DB $09, $ff, $01, $ff, $01, $ff, $81, $ff, $81, $ff, $c1, $ff, $c1, $ff, $a1, $ff ; 0x60 + .DB $80, $80, $80, $80, $80, $80, $80, $80, $83, $83, $fe, $fe, $80, $80, $80, $80 ; 0x61 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $fe, $fe, $00, $00, $01, $01, $03, $03 ; 0x62 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $ff, $ff, $1f, $00 ; 0x63 + .DB $01, $01, $03, $03, $03, $02, $07, $04, $0f, $0c, $1e, $18, $fe, $f0, $fe, $00 ; 0x64 + .DB $00, $00, $00, $00, $00, $00, $01, $01, $01, $01, $00, $00, $00, $00, $06, $00 ; 0x65 + .DB $38, $38, $0c, $0c, $07, $07, $81, $81, $80, $00, $80, $80, $00, $00, $05, $04 ; 0x66 + .DB $00, $00, $00, $00, $00, $00, $80, $80, $80, $80, $c0, $c0, $c0, $c0, $cf, $4f ; 0x67 + .DB $00, $00, $00, $00, $00, $00, $01, $01, $03, $03, $07, $06, $3f, $38, $ff, $ff ; 0x68 + .DB $1f, $18, $3f, $20, $ff, $c0, $ff, $80, $ff, $00, $ff, $00, $ff, $03, $ff, $ff ; 0x69 + .DB $ff, $18, $ff, $06, $ff, $03, $ff, $01, $ff, $00, $ff, $f8, $ff, $fe, $ff, $ff ; 0x6a + .DB $ff, $0f, $ff, $1a, $ff, $00, $ff, $c0, $ff, $60, $ff, $3c, $ff, $07, $ff, $ff ; 0x6b + .DB $ff, $0f, $ff, $08, $ff, $18, $ff, $30, $ff, $60, $ff, $c0, $ff, $80, $ff, $07 ; 0x6c + .DB $ff, $80, $ff, $00, $ff, $00, $ff, $00, $ff, $00, $ff, $00, $ff, $18, $f7, $f7 ; 0x6d + .DB $fe, $06, $fe, $02, $ff, $03, $ff, $01, $ff, $00, $ff, $00, $ff, $00, $ff, $bb ; 0x6e + .DB $01, $01, $00, $00, $00, $00, $80, $80, $e0, $e0, $f0, $30, $ff, $0f, $f7, $f7 ; 0x6f + .DB $d9, $ff, $ed, $ff, $7b, $7f, $3d, $3f, $1f, $1f, $6f, $6f, $cf, $cf, $07, $07 ; 0x70 + .DB $80, $80, $80, $80, $80, $80, $84, $84, $9e, $9e, $90, $90, $80, $80, $80, $80 ; 0x71 + .DB $06, $06, $0c, $0c, $18, $18, $30, $30, $60, $60, $40, $40, $60, $40, $e0, $c0 ; 0x72 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x73 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $40, $40 ; 0x74 + .DB $0c, $00, $1e, $00, $1f, $0c, $1f, $07, $1f, $01, $3f, $00, $7f, $00, $ff, $00 ; 0x75 + .DB $07, $07, $1f, $01, $ff, $03, $fc, $1c, $f0, $f0, $80, $80, $80, $80, $80, $80 ; 0x76 + .DB $f8, $f8, $80, $80, $00, $00, $00, $00, $00, $00, $00, $00, $06, $06, $0b, $0b ; 0x77 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $04, $04, $80, $80 ; 0x78 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $20, $20, $00, $00, $00, $00 ; 0x79 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $40, $40, $00, $00 ; 0x7a + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $40, $40, $60, $60 ; 0x7b + .DB $0c, $0c, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x7c + .DB $03, $03, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $01, $01, $c3, $c3 ; 0x7d + .DB $47, $44, $57, $54, $47, $44, $3f, $38, $cf, $f0, $97, $eb, $af, $d0, $1f, $e0 ; 0x7e + .DB $f8, $08, $fa, $0a, $f8, $08, $ff, $07, $ff, $00, $ff, $f0, $ff, $00, $ff, $00 ; 0x7f + .DB $87, $87, $83, $83, $83, $83, $c3, $c3, $c3, $43, $e1, $61, $e1, $21, $f1, $31 ; 0x80 + .DB $80, $80, $80, $80, $80, $80, $98, $98, $97, $97, $bf, $bc, $bf, $ac, $b9, $a8 ; 0x81 + .DB $e0, $80, $e0, $80, $e0, $80, $e0, $80, $e0, $80, $e0, $c0, $f0, $40, $f0, $40 ; 0x82 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x83 + .DB $40, $40, $40, $40, $40, $40, $40, $40, $46, $40, $5e, $40, $7e, $42, $fe, $c2 ; 0x84 + .DB $ff, $61, $7e, $3e, $78, $18, $38, $18, $38, $38, $28, $28, $28, $28, $28, $28 ; 0x85 + .DB $80, $80, $00, $00, $00, $00, $00, $00, $00, $00, $04, $04, $06, $06, $03, $03 ; 0x86 + .DB $00, $00, $00, $00, $00, $00, $10, $10, $18, $18, $0c, $0c, $0c, $0c, $1d, $1d ; 0x87 + .DB $00, $00, $00, $00, $00, $00, $30, $30, $30, $30, $f0, $f0, $e0, $a0, $c0, $40 ; 0x88 + .DB $08, $08, $08, $08, $18, $18, $38, $38, $60, $60, $00, $00, $40, $40, $e0, $e0 ; 0x89 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $06, $06, $07, $07, $01, $01, $00, $00 ; 0x8a + .DB $e0, $e0, $00, $00, $00, $00, $06, $06, $0c, $0c, $1c, $1c, $b8, $a8, $f8, $c8 ; 0x8b + .DB $03, $03, $06, $06, $0c, $0c, $00, $00, $00, $00, $00, $00, $00, $00, $03, $03 ; 0x8c + .DB $c2, $c3, $42, $43, $02, $03, $02, $03, $02, $03, $03, $03, $fe, $ff, $83, $ff ; 0x8d + .DB $2f, $d0, $0f, $fc, $37, $fc, $36, $ff, $3b, $fe, $ae, $ff, $df, $ff, $8d, $ff ; 0x8e + .DB $ff, $00, $cf, $78, $cd, $7a, $ca, $7d, $4c, $fb, $c8, $ff, $d8, $ff, $d9, $ff ; 0x8f + .DB $b1, $51, $51, $b1, $a3, $63, $23, $e3, $27, $e7, $65, $e7, $fd, $ff, $89, $ff ; 0x90 + .DB $b9, $b8, $98, $98, $98, $98, $8c, $8c, $84, $84, $96, $96, $81, $81, $80, $80 ; 0x91 + .DB $f8, $40, $f8, $20, $78, $30, $7c, $10, $3e, $18, $37, $34, $e7, $e4, $87, $86 ; 0x92 + .DB $01, $00, $03, $01, $0f, $03, $7f, $0f, $7f, $7f, $ff, $38, $ff, $0c, $ff, $14 ; 0x93 + .DB $fe, $86, $fa, $9a, $e3, $62, $83, $82, $c3, $c2, $ff, $7e, $ff, $37, $ff, $29 ; 0x94 + .DB $28, $28, $28, $28, $28, $28, $1c, $1c, $94, $14, $d6, $16, $ce, $0a, $fe, $0e ; 0x95 + .DB $01, $01, $01, $01, $03, $03, $06, $06, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x96 + .DB $9f, $9f, $bf, $b4, $ff, $e0, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x97 + .DB $cc, $4c, $cf, $4f, $ef, $68, $00, $00, $00, $00, $08, $08, $19, $19, $39, $39 ; 0x98 + .DB $e8, $a8, $c0, $00, $c0, $00, $00, $00, $00, $00, $c1, $c1, $c1, $c1, $00, $00 ; 0x99 + .DB $00, $00, $c4, $c4, $ee, $ee, $ee, $aa, $fe, $9a, $fe, $32, $fc, $00, $80, $00 ; 0x9a + .DB $f8, $c8, $f8, $c8, $7f, $6f, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x9b + .DB $1e, $1f, $70, $7f, $c3, $ff, $7f, $7f, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x9c + .DB $00, $ff, $70, $ff, $df, $df, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x9d + .DB $87, $ff, $47, $ff, $fc, $fc, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x9e + .DB $ff, $ff, $fb, $fb, $26, $26, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00 ; 0x9f + .DB $01, $ff, $df, $ff, $09, $09, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01 ; 0xa0 + .DB $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $80, $ff, $ff ; 0xa1 + .DB $01, $01, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $ff, $ff ; 0xa2 + .DB $ff, $f3, $1f, $11, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $ff, $ff ; 0xa3 + .DB $ff, $ef, $f8, $88, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $ff, $ff ; 0xa4 + .DB $fc, $fc, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $ff, $ff ; 0xa5 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $ff, $ff ; 0xa6 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $ff, $ff ; 0xa7 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $ff, $ff ; 0xa8 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $ff, $ff ; 0xa9 + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $ff, $ff ; 0xaa + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $ff, $ff ; 0xab + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $ff, $ff ; 0xac + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $ff, $ff ; 0xad + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $ff, $ff ; 0xae + .DB $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $ff, $ff ; 0xaf + .DB $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $01, $ff, $ff ; 0xb0 + +Title_Screen_Sprite_Data.end: diff --git a/utils.gbasm b/utils.gbasm index 1393e82..5d6f9e7 100644 --- a/utils.gbasm +++ b/utils.gbasm @@ -34,6 +34,118 @@ tilemap_memcpy: ; src = DE, dest = HL, n = C JR NZ =.loop RET +.MACRODEF HBLANK_WAIT + LD A, $reg_lcd_controller + BIT 7, A + JR Z, =$HBlank_Wait.End + $HBlank_Wait.loop: + LD A, $reg_lcd_status + AND $03 + CP $00 + JR NZ, =$HBlank_Wait.loop + $HBlank_Wait.End: +.END + +.MACRODEF SET_WINDOW_LCDC_E + LD A, $mem_display_flag + BIT 3, A + LD E, $00 + JR Z, =$No_Window + LD E, $60 + $No_Window: +.END + +.MACRODEF ENABLE_TOP_BAR + XOR A + LD $reg_viewport_x, A + LD A, $57 + LD $reg_viewport_y, A + + LD A, $lcdc_guibg_tilemap + OR E + LD $reg_lcd_controller, A + + LD A, $palette_bold_font + LD $reg_bg_palette, A +.END + +.MACRODEF DISABLE_TOP_BAR + LD A, $mem_prepared_viewport_x + LD $reg_viewport_x, A + LD A, $mem_prepared_viewport_y + LD $reg_viewport_y, A + LD A, $mem_prepared_color_palette + LD $reg_bg_palette, A + + LD A, $lcdc_mapbg_tilemap + OR E + LD $reg_lcd_controller, A +.END + +.MACRODEF ENABLE_DIALOGUE + .HBLANK_WAIT + LD A, $98 + LD $reg_viewport_x, A + LD A, $b8 + LD $reg_viewport_y, A + + LD A, $lcdc_guibg_tilemap + OR E + LD $reg_lcd_controller, A +.END + +.MACRODEF DISABLE_DIALOGUE + PUSH BC + LD A, $mem_prepared_viewport_x + LD B, A + LD A, $mem_prepared_viewport_y + LD C, A + .HBLANK_WAIT + LD A, B + LD $reg_viewport_x, A + LD A, C + LD $reg_viewport_y, A + LD A, $mem_prepared_color_palette + LD $reg_bg_palette, A + LD A, $lcdc_mapbg_tilemap + OR E + LD $reg_lcd_controller, A + POP BC +.END + +.MACRODEF ENABLE_VBLANK_INTERRUPTS + LD A, $reg_interrupt_flags + RES 0, A + LD $reg_interrupt_flags, A + LD A, $reg_interrupt_enable + OR $01 + LD $reg_interrupt_enable, A +.END + +.MACRODEF RESET_INTERRUPTS + LD A, $00 + LD $reg_interrupt_flags, A +.END + +.MACRODEF ENABLE_LYC_INTERRUPT + LD A, low(=STAT_Entrypoint) + LD ($mem_stat_jump_destination), A + LD A, high(=STAT_Entrypoint) + LD ($mem_stat_jump_destination+1), A + .RESET_INTERRUPTS + LD A, $40 + LD $reg_lcd_status, A + LD A, $02 + LD $reg_interrupt_enable, A +.END + +.MACRODEF DISABLE_LYC_INTERRUPT + LD A, $reg_interrupt_enable + RES 1, A + LD $reg_interrupt_enable, A +.END + + bzero: ; dest = HL, n = BC LD A, $00 .loop: @@ -279,6 +391,10 @@ RRx: ; B is the number to rotate, A & 7 is how many bits to rotate it SUB $04 RET +Next_VBlank_Wait: + PUSH AF + .HBLANK_WAIT + POP AF VBlank_Wait: PUSH AF LD A, $reg_lcd_controller @@ -293,6 +409,7 @@ VBlank_Wait: POP AF RET + .MACRODEF CHANGE_BANK_TO_A LD $reg_rom_bank, A LD $saved_rom_bank, A |