home/menu.asm; forgot to track some files

This commit is contained in:
pikalaxalt
2016-06-17 09:49:16 -04:00
parent a2c4251575
commit eebeee7f7a
8 changed files with 32048 additions and 375 deletions

130
contents.asm Normal file
View File

@@ -0,0 +1,130 @@
; Doubles as bank constants.
; main.o
ROOFS EQU $7
TILESETS_1 EQU $6
TILESETS_2 EQU $7
TILESETS_3 EQU $8
TILESETS_4 EQU $C
TILESETS_5 EQU $2D
TILESETS_6 EQU $37
TILESETS_7 EQU $77
TILESETS_8 EQU $78
; data/egg_moves.o
EGG_MOVES EQU $8
; data/evos_attacks.o
EVOS_ATTACKS EQU $10
; data/pokedex/entries.o
POKEDEX_ENTRIES_1 EQU $60
POKEDEX_ENTRIES_2 EQU $6E
POKEDEX_ENTRIES_3 EQU $73
POKEDEX_ENTRIES_4 EQU $74
; engine/events.o
; engine/scripting.o
; engine/events_2.o
EVENTS EQU $25
; engine/credits.o
CREDITS EQU $42
; gfx/pics.o
PIC_POINTERS EQU $48
UNOWN_PIC_POINTERS EQU $49
TRAINER_PIC_POINTERS EQU $4A
PICS_FIX EQU $36
PICS_1 EQU $48
PICS_2 EQU $49
PICS_3 EQU $4A
PICS_4 EQU $4B
PICS_5 EQU $4C
PICS_6 EQU $4D
PICS_7 EQU $4E
PICS_8 EQU $4F
PICS_9 EQU $50
PICS_10 EQU $51
PICS_11 EQU $52
PICS_12 EQU $53
PICS_13 EQU $54
PICS_14 EQU $55
PICS_15 EQU $56
PICS_16 EQU $57
PICS_17 EQU $58
PICS_18 EQU $59
PICS_19 EQU $5A
; maps.o
MAP_HEADERS EQU $25
MAPS_1 EQU $2A
MAPS_2 EQU $2B
MAPS_3 EQU $2C
MAP_SCRIPTS_1 EQU $15
MAP_SCRIPTS_2 EQU $16
MAP_SCRIPTS_3 EQU $17
MAP_SCRIPTS_4 EQU $18
MAP_SCRIPTS_5 EQU $1A
MAP_SCRIPTS_6 EQU $1B
MAP_SCRIPTS_7 EQU $1C
MAP_SCRIPTS_8 EQU $1D
MAP_SCRIPTS_9 EQU $1E
MAP_SCRIPTS_10 EQU $1F
MAP_SCRIPTS_11 EQU $26
MAP_SCRIPTS_12 EQU $27
MAP_SCRIPTS_13 EQU $60
MAP_SCRIPTS_14 EQU $61
MAP_SCRIPTS_15 EQU $62
MAP_SCRIPTS_16 EQU $63
MAP_SCRIPTS_17 EQU $64
MAP_SCRIPTS_18 EQU $65
MAP_SCRIPTS_19 EQU $66
MAP_SCRIPTS_20 EQU $67
MAP_SCRIPTS_21 EQU $68
MAP_SCRIPTS_22 EQU $69
MAP_SCRIPTS_23 EQU $6A
MAP_SCRIPTS_24 EQU $6B
MAP_SCRIPTS_25 EQU $6C
; audio.o
AUDIO EQU $3A
SONGS_1 EQU $3A
SONGS_2 EQU $3B
SONGS_3 EQU $3C
SONGS_4 EQU $3D
SONGS_5 EQU $5E
EXTRA_SONGS_1 EQU $7
EXTRA_SONGS_2 EQU $33
SOUND_EFFECTS EQU $3C
CRYSTAL_SOUND_EFFECTS EQU $5E
CRIES EQU $3C
; misc.o
MISC_CRYSTAL EQU $5E

View File

@@ -27,9 +27,8 @@ INCLUDE "home/video.asm"
INCLUDE "home/map_objects.asm"
INCLUDE "home/sine.asm"
INCLUDE "home/movement.asm"
SetMenuAttributes:: ; 1a4e
dr $1a4e, $1eb3
INCLUDE "home/tilemap.asm"
INCLUDE "home/menu.asm"
PrinterReceive::
dr $1eb3, $1ebf
@@ -50,7 +49,10 @@ FarCall_hl::
dr $2e27, $2e49
Predef::
dr $2e49, $30e1
dr $2e49, $2ef1
Function2ef1::
dr $2ef1, $30e1
OpenSRAM::
dr $30e1, $30f1
@@ -115,7 +117,10 @@ Function3564::
dr $3564, $35b9
GetWeekday::
dr $35b9, $39f9
dr $35b9, $3654
Function3654::
dr $3654, $39f9
PlayCry::
dr $39f9, $3ade

View File

@@ -1,78 +1,61 @@
; Functions used in displaying and handling menus.
LoadMenuDataHeader::
LoadMenuDataHeader:: ; 1bac (0:1bac)
call CopyMenuDataHeader
call PushWindow
ret
CopyMenuDataHeader::
CopyMenuDataHeader:: ; 1bb3 (0:1bb3)
ld de, wMenuDataHeader
ld bc, wMenuDataHeaderEnd - wMenuDataHeader
call CopyBytes
ld a, [hROMBank]
ld [wMenuDataBank], a
ret
; 0x1d4b
StoreTo_wMenuCursorBuffer:: ; 1d4b
StoreTo_wMenuCursorBuffer
ld [wMenuCursorBuffer], a
ret
; 1d4f
MenuTextBox:: ; 1d4f
MenuTextBox:: ; 1bc1 (0:1bc1)
push hl
call LoadMenuTextBox
pop hl
jp PrintText
; 1d57
ret_1d57:: ; 1d57
; unreferenced
; XXX
ret_1bc9
ret
; 1d58
LoadMenuTextBox:: ; 1d58
LoadMenuTextBox:: ; 1bca (0:1bca)
ld hl, .MenuDataHeader
call LoadMenuDataHeader
ret
; 1d5f
.MenuDataHeader ; 1d5f
.MenuDataHeader:
db $40 ; tile backup
db 12, 0 ; start coords
db 17, 19 ; end coords
dw VTiles0
dw $8000
db 0 ; default option
; 1d67
MenuTextBoxBackup:: ; 1d67
MenuTextBoxBackup::
call MenuTextBox
call CloseWindow
ret
; 1d6e
LoadStandardMenuDataHeader:: ; 1d6e
LoadStandardMenuDataHeader::
ld hl, .MenuDataHeader
call LoadMenuDataHeader
ret
; 1d75
.MenuDataHeader ; 1d75
.MenuDataHeader: ; 1d75
db $40 ; tile backup
db 0, 0 ; start coords
db 17, 19 ; end coords
dw 0
db 1 ; default option
; 1d7d
Call_ExitMenu:: ; 1d7d
Call_ExitMenu::
call ExitMenu
ret
; 1d81
VerticalMenu::
VerticalMenu:: ; 1bf3 (0:1bf3)
xor a
ld [hBGMapMode], a
call MenuBox
@@ -82,28 +65,25 @@ VerticalMenu::
call CopyMenuData2
ld a, [wMenuData2Flags]
bit 7, a
jr z, .cancel
jr z, .asm_1c19
call InitVerticalMenuCursor
call StaticMenuJoypad
call MenuClickSound
bit 1, a
jr z, .okay
.cancel
jr z, .asm_1c1b
.asm_1c19
scf
ret
.okay
.asm_1c1b
and a
ret
; 0x1dab
GetMenu2:: ; 1dab
GetMenu2::
call LoadMenuDataHeader
call VerticalMenu
call CloseWindow
ld a, [wMenuCursorY]
ret
; 1db8
CopyNameFromMenu::
push hl
@@ -116,94 +96,74 @@ CopyNameFromMenu::
inc hl
inc hl
pop af
call GetNthString
call Function3654
ld d, h
ld e, l
call CopyName1
call Function317b
pop bc
pop hl
ret
; 0x1dcf
YesNoBox:: ; 1dcf
YesNoBox::
lb bc, SCREEN_WIDTH - 6, 7
PlaceYesNoBox:: ; 1dd2
PlaceYesNoBox::
jr _YesNoBox
PlaceGenericTwoOptionBox:: ; 1dd4
PlaceGenericTwoOptionBox::
call LoadMenuDataHeader
jr InterpretTwoOptionMenu
_YesNoBox:: ; 1dd9
; Return nc (yes) or c (no).
_YesNoBox::
push bc
ld hl, YesNoMenuDataHeader
call CopyMenuDataHeader
pop bc
; This seems to be an overflow prevention, but
; it was coded wrong.
ld a, b
cp SCREEN_WIDTH - 6
jr nz, .okay ; should this be "jr nc"?
ld a, SCREEN_WIDTH - 6
ld b, a
.okay
ld a, b
ld [wMenuBorderLeftCoord], a
add 5
add $5
ld [wMenuBorderRightCoord], a
ld a, c
ld [wMenuBorderTopCoord], a
add 4
add $4
ld [wMenuBorderBottomCoord], a
call PushWindow
InterpretTwoOptionMenu:: ; 1dfe
InterpretTwoOptionMenu::
call VerticalMenu
push af
ld c, $f
call DelayFrames
call CloseWindow
pop af
jr c, .no
jr c, .asm_1c80
ld a, [wMenuCursorY]
cp 2 ; no
jr z, .no
cp $2
jr z, .asm_1c80
and a
ret
.no
ld a, 2
.asm_1c80
ld a, $2
ld [wMenuCursorY], a
scf
ret
; 1e1d
YesNoMenuDataHeader:: ; 1e1d
YesNoMenuDataHeader:: ; 1c87 (0:1c87)
db $40 ; tile backup
db 5, 10 ; start coords
db 9, 15 ; end coords
dw .MenuData2
db 1 ; default option
; 1e25
.MenuData2 ; 1e25
.MenuData2: ; 1e25
db $c0 ; flags
db 2
db "YES@"
db "NO@"
; 1e2e
OffsetMenuDataHeader:: ; 1e2e
call _OffsetMenuDataHeader
OffsetMenuDataHeader::
call OffsetMenuDataHeader_
call PushWindow
ret
; 1e35
_OffsetMenuDataHeader:: ; 1e35
OffsetMenuDataHeader_:: ; 1c9f (0:1c9f)
push de
call CopyMenuDataHeader
pop de
@@ -226,39 +186,37 @@ _OffsetMenuDataHeader:: ; 1e35
add l
ld [wMenuBorderBottomCoord], a
ret
; 1e5d
DoNthMenu:: ; 1e5d
call MenuFunc_1e7f
DoNthMenu::
call DrawVariableLengthMenuBox
call MenuWriteText
call Function1eff
call Function1f23
call InitMenuCursorAndButtonPermissions
call GetStaticMenuJoypad
call GetMenuJoypad
call MenuClickSound
ret
; 1e70
SetUpMenu:: ; 1e70
call MenuFunc_1e7f ; ???
SetUpMenu::
call DrawVariableLengthMenuBox
call MenuWriteText
call Function1eff ; set up selection pointer
ld hl, w2DMenuFlags1
call InitMenuCursorAndButtonPermissions
ld hl, wcedc
set 7, [hl]
ret
MenuFunc_1e7f::
DrawVariableLengthMenuBox:: ; 1ce9 (0:1ce9)
call CopyMenuData2
call GetMenuIndexSet
call Function1ea6
call AutomaticGetMenuBottomCoord
call MenuBox
ret
MenuWriteText::
MenuWriteText:: ; 1cf6 (0:1cf6)
xor a
ld [hBGMapMode], a
call GetMenuIndexSet ; sort out the text
call Function1eda ; actually write it
call Function2e31
call GetMenuIndexSet
call RunMenuItemPrintingFunction
call Function2ef1
ld a, [hOAMUpdate]
push af
ld a, $1
@@ -267,9 +225,8 @@ MenuWriteText::
pop af
ld [hOAMUpdate], a
ret
; 0x1ea6
Function1ea6:: ; 1ea6
AutomaticGetMenuBottomCoord:: ; 1d10 (0:1d10)
ld a, [wMenuBorderLeftCoord]
ld c, a
ld a, [wMenuBorderRightCoord]
@@ -283,165 +240,146 @@ Function1ea6:: ; 1ea6
add b
ld [wMenuBorderBottomCoord], a
ret
; 1ebd
GetMenuIndexSet:: ; 1ebd
GetMenuIndexSet:: ; 1d27 (0:1d27)
ld hl, wMenuData2IndicesPointer
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [wWhichIndexSet]
and a
jr z, .skip
jr z, .asm_1d3d
ld b, a
ld c, -1
.loop
ld c, $ff
.asm_1d36
ld a, [hli]
cp c
jr nz, .loop
jr nz, .asm_1d36
dec b
jr nz, .loop
.skip
jr nz, .asm_1d36
.asm_1d3d
ld d, h
ld e, l
ld a, [hl]
ld [wMenuData2Items], a
ret
; 1eda
Function1eda:: ; 1eda
RunMenuItemPrintingFunction:: ; 1d44 (0:1d44)
call MenuBoxCoord2Tile
ld bc, 2 * SCREEN_WIDTH + 2
add hl, bc
.loop
.asm_1d4b
inc de
ld a, [de]
cp -1
cp $ff
ret z
ld [MenuSelection], a
ld [wMenuSelection], a
push de
push hl
ld d, h
ld e, l
ld hl, wMenuData2DisplayFunctionPointer
call .__wMenuData2DisplayFunction__
call ._hl_
pop hl
ld de, 2 * SCREEN_WIDTH
ld de, $28
add hl, de
pop de
jr .loop
; 1efb
jr .asm_1d4b
.__wMenuData2DisplayFunction__ ; 1efb
._hl_ ; 1d65 (0:1d65)
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 1eff
Function1eff:: ; 1eff
InitMenuCursorAndButtonPermissions:: ; 1d69 (0:1d69)
call InitVerticalMenuCursor
ld hl, wMenuJoypadFilter
ld a, [wMenuData2Flags]
bit 3, a
jr z, .disallow_select
set START_F, [hl]
.disallow_select
jr z, .asm_1d78
set 3, [hl]
.asm_1d78
ld a, [wMenuData2Flags]
bit 2, a
jr z, .disallow_left_right
set D_LEFT_F, [hl]
set D_RIGHT_F, [hl]
.disallow_left_right
jr z, .asm_1d83
set 5, [hl]
set 4, [hl]
.asm_1d83
ret
; 1f1a
Function1f1a:: ; 1f1a
GetScrollingMenuJoypad::
call ScrollingMenuJoypad
ld hl, wMenuJoypadFilter
and [hl]
jr Function1f2a
; 1f23
jr ContinueGettingMenuJoypad
Function1f23:: ; 1f23
GetStaticMenuJoypad:: ; 1d8d (0:1d8d)
xor a
ld [wMenuJoypad], a
call StaticMenuJoypad
; 1f2a
Function1f2a:: ; 1f2a
bit A_BUTTON_F, a
jr nz, .a_button
bit B_BUTTON_F, a
jr nz, .b_start
bit START_F, a
jr nz, .b_start
bit D_RIGHT_F, a
jr nz, .d_right
bit D_LEFT_F, a
jr nz, .d_left
ContinueGettingMenuJoypad::
bit 0, a
jr nz, .asm_1dbc
bit 1, a
jr nz, .asm_1dd7
bit 3, a
jr nz, .asm_1dd7
bit 4, a
jr nz, .asm_1dae
bit 5, a
jr nz, .asm_1db5
xor a
ld [wMenuJoypad], a
jr .done
.d_right
ld a, D_RIGHT
jr .asm_1dc1
.asm_1dae
ld a, $10
ld [wMenuJoypad], a
jr .done
.d_left
ld a, D_LEFT
jr .asm_1dc1
.asm_1db5
ld a, $20
ld [wMenuJoypad], a
jr .done
.a_button
ld a, A_BUTTON
jr .asm_1dc1
.asm_1dbc
ld a, $1
ld [wMenuJoypad], a
.done
.asm_1dc1
call GetMenuIndexSet
ld a, [wMenuCursorY]
ld l, a
ld h, $0
add hl, de
ld a, [hl]
ld [MenuSelection], a
ld [wMenuSelection], a
ld a, [wMenuCursorY]
ld [wMenuCursorBuffer], a
and a
ret
.b_start
ld a, B_BUTTON
.asm_1dd7
ld a, $2
ld [wMenuJoypad], a
ld a, -1
ld [MenuSelection], a
ld a, $ff
ld [wMenuSelection], a
scf
ret
; 1f79
PlaceMenuStrings:: ; 1f79
PlaceMenuStrings::
push de
ld hl, wMenuData2PointerTableAddr
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [MenuSelection]
call GetNthString
ld a, [wMenuSelection]
call Function3654
ld d, h
ld e, l
pop hl
call PlaceString
ret
; 1f8d
PlaceNthMenuStrings:: ; 1f8d
PlaceNthMenuStrings::
push de
ld a, [MenuSelection]
ld a, [wMenuSelection]
call GetMenuDataPointerTableEntry
inc hl
inc hl
@@ -451,10 +389,8 @@ PlaceNthMenuStrings:: ; 1f8d
pop hl
call PlaceString
ret
; 1f9e
Function1f9e:: ; 1f9e
; unreferenced
Function1e08::
call GetMenuDataPointerTableEntry
inc hl
inc hl
@@ -462,18 +398,16 @@ Function1f9e:: ; 1f9e
ld d, [hl]
ld e, a
ret
; 1fa7
MenuJumptable:: ; 1fa7
ld a, [MenuSelection]
MenuJumptable::
ld a, [wMenuSelection]
call GetMenuDataPointerTableEntry
ld a, [hli]
ld h, [hl]
ld l, a
jp [hl]
; 1fb1
GetMenuDataPointerTableEntry:: ; 1fb1
GetMenuDataPointerTableEntry:: ; 1e1b (0:1e1b)
ld e, a
ld d, $0
ld hl, wMenuData2PointerTableAddr
@@ -485,107 +419,88 @@ GetMenuDataPointerTableEntry:: ; 1fb1
add hl, de
add hl, de
ret
; 1fbf
ClearWindowData:: ; 1fbf
ld hl, wWindowStackPointer
ClearWindowData::
ld hl, wWindowData
call .bytefill
ld hl, wMenuDataHeader
call .bytefill
ld hl, wMenuData2Flags
ld hl, wMenuData2
call .bytefill
ld hl, w2DMenuCursorInitY
ld hl, wMenuData3
call .bytefill
ld a, [rSVBK]
push af
ld a, $7
ld [rSVBK], a
xor a
ld hl, wWindowStackBottom
call OpenSRAM
xor a
ld hl, sWindowStackTop
ld [hld], a
ld [hld], a
ld a, l
ld [wWindowStackPointer], a
ld a, h
ld [wWindowStackPointer + 1], a
pop af
ld [rSVBK], a
call CloseSRAM
ret
; 1ff0
.bytefill: ; 1ff0
ld bc, $0010
.bytefill
ld bc, $10
xor a
call ByteFill
ret
; 1ff8
MenuClickSound:: ; 1ff8
MenuClickSound:: ; 1e5f (0:1e5f)
push af
and A_BUTTON | B_BUTTON
jr z, .nosound
ld hl, wMenuFlags
bit 3, [hl]
jr nz, .nosound
and $3
jr z, .asm_1e6e
ld hl, wMenuDataHeader
bit 3, a
jr nz, .asm_1e6e
call PlayClickSFX
.nosound
.asm_1e6e
pop af
ret
; 2009
PlayClickSFX:: ; 2009
PlayClickSFX:: ; 1e70 (0:1e70)
push de
ld de, SFX_READ_TEXT_2
call PlaySFX
pop de
ret
; 0x2012
MenuTextBoxWaitButton:: ; 2012
MenuTextBoxWaitButton::
call MenuTextBox
call WaitButton
call ExitMenu
ret
; 201c
Place2DMenuItemName:: ; 201c
ld [hBuffer], a
Place2DMenuItemName::
ld [wBuffer], a
ld a, [hROMBank]
push af
ld a, [hBuffer]
ld a, [wBuffer]
rst Bankswitch
call PlaceString
pop af
rst Bankswitch
ret
; 202a
_2DMenu:: ; 202a
_2DMenu::
call CopyMenuData2
ld a, [hROMBank]
ld [wMenuData2_2DMenuItemStringsBank], a
callba _2DMenu_
ld [wMenuDataBank], a
push af
ld a, BANK(_2DMenu_)
rst Bankswitch
call _2DMenu_
pop bc
ld a, b
rst Bankswitch
ld a, [wMenuCursorBuffer]
ret
; 2039
InterpretBattleMenu:: ; 2039
ld a, [hROMBank]
ld [wMenuData2_2DMenuItemStringsBank], a
callba _InterpretBattleMenu
ld a, [wMenuCursorBuffer]
ResetBGWindow::
xor a
ld [hBGMapMode], a
ld a, $90
ld [rWY], a
ld [hWY], a
ret
; 2048
InterpretMobileMenu:: ; 2048
ld a, [hROMBank]
ld [wMenuData2_2DMenuItemStringsBank], a
callba _InterpretMobileMenu
ld a, [wMenuCursorBuffer]
ret
; 2057

View File

@@ -1,19 +1,81 @@
PushWindow:: ; 1c00
callab _PushWindow
SetMenuAttributes:: ; 1a4e
push hl
push bc
ld hl, w2DMenuCursorInitY
ld b, $8
.asm_1a55
ld a, [de]
inc de
ld [hli], a
dec b
jr nz, .asm_1a55
ld a, $1
ld [hli], a
ld [hli], a
xor a
ld [hli], a
ld [hli], a
ld [hli], a
pop bc
pop hl
ret
; 1c07
ExitMenu:: ; 0x1c07
StaticMenuJoypad:: ; 1a66 (0:1a66)
callab StaticMenuJoypad_
call GetMenuJoypad
ret
ScrollingMenuJoypad:: ; 1a70 (0:1a70)
callab ScrollingMenuJoypad_
call GetMenuJoypad
ret
GetMenuJoypad:: ; 1a7a (0:1a7a)
push bc
push af
callab _ExitMenu
ld a, [hJoyLast]
and D_PAD
ld b, a
ld a, [hJoyPressed]
and BUTTONS
or b
ld b, a
pop af
ld a, b
pop bc
ret
PlaceHollowCursor::
ld hl, wCursorCurrentTile
ld a, [hli]
ld h, [hl]
ld l, a
ld [hl], "▷"
ret
HideCursor::
ld hl, wCursorCurrentTile
ld a, [hli]
ld h, [hl]
ld l, a
ld [hl], " "
ret
PushWindow:: ; 1a9d (0:1a9d)
callab PushWindow_
ret
ExitMenu:: ; 1aa4 (0:1aa4)
push af
callab ExitMenu_
pop af
ret
InitVerticalMenuCursor:: ; 0x1c10
callab _InitVerticalMenuCursor
InitVerticalMenuCursor:: ; 1aad (0:1aad)
callab InitVerticalMenuCursor_
ret
CloseWindow:: ; 0x1c17
CloseWindow:: ; 1ab4 (0:1ab4)
push af
call ExitMenu
call ApplyTilemap
@@ -21,65 +83,53 @@ CloseWindow:: ; 0x1c17
pop af
ret
RestoreTileBackup:: ; 0x1c23
RestoreTileBackup::
call MenuBoxCoord2Tile
call .copy
call MenuBoxCoord2Attr
call .copy
ret
; 0x1c30
.copy: ; 0x1c30
call GetMenuBoxDims
inc b
inc c
.row
.asm_1ac8
push bc
push hl
.col
.asm_1aca
ld a, [de]
ld [hli], a
dec de
dec c
jr nz, .col ; 0x1c3b $fa
jr nz, .asm_1aca
pop hl
ld bc, SCREEN_WIDTH
ld bc, $14
add hl, bc
pop bc
dec b
jr nz, .row ; 0x1c44 $ef
jr nz, .asm_1ac8
ret
PopWindow:: ; 0x1c47
ld b, $10
ld de, wMenuFlags
.loop
PopWindow::
ld b, wMenuDataHeaderEnd - wMenuDataHeader
ld de, wMenuDataHeader
.asm_1adf
ld a, [hld]
ld [de], a
inc de
dec b
jr nz, .loop ; 0x1c50 $fa
jr nz, .asm_1adf
ret
GetMenuBoxDims:: ; 0x1c53
ld a, [wMenuBorderTopCoord] ; top
GetMenuBoxDims:: ; 1ae6 (0:1ae6)
ld a, [wMenuBorderTopCoord]
ld b, a
ld a, [wMenuBorderBottomCoord] ; bottom
ld a, [wMenuBorderBottomCoord]
sub b
ld b, a
ld a, [wMenuBorderLeftCoord] ; left
ld a, [wMenuBorderLeftCoord]
ld c, a
ld a, [wMenuBorderRightCoord] ; right
ld a, [wMenuBorderRightCoord]
sub c
ld c, a
ret
; 0x1c66
CopyMenuData2:: ; 1c66
CopyMenuData2:: ; 1af9 (0:1af9)
push hl
push de
push bc
@@ -88,17 +138,16 @@ CopyMenuData2:: ; 1c66
ld a, [hli]
ld h, [hl]
ld l, a
ld de, wMenuData2Flags
ld bc, wMenuData2End - wMenuData2Flags
ld de, wMenuData2
ld bc, wMenuData2End - wMenuData2
call CopyBytes
pop af
pop bc
pop de
pop hl
ret
; 1c7e
GetWindowStackTop:: ; 1c7e
GetWindowStackTop::
ld hl, wWindowStackPointer
ld a, [hli]
ld h, [hl]
@@ -108,21 +157,20 @@ GetWindowStackTop:: ; 1c7e
ld h, [hl]
ld l, a
ret
; 1c89
PlaceVerticalMenuItems:: ; 1c89
PlaceVerticalMenuItems:: ; 1b1c (0:1b1c)
call CopyMenuData2
ld hl, wMenuData2Pointer
ld e, [hl]
inc hl
ld d, [hl]
call GetMenuTextStartCoord
call Coord2Tile ; hl now contains the TileMap address where we will start printing text.
call Coord2Tile
inc de
ld a, [de] ; Number of items
ld a, [de]
inc de
ld b, a
.loop
.asm_1b2f
push bc
call PlaceString
inc de
@@ -130,12 +178,10 @@ PlaceVerticalMenuItems:: ; 1c89
add hl, bc
pop bc
dec b
jr nz, .loop
jr nz, .asm_1b2f
ld a, [wMenuData2Flags]
bit 4, a
ret z
call MenuBoxCoord2Tile
ld a, [de]
ld c, a
@@ -143,41 +189,34 @@ PlaceVerticalMenuItems:: ; 1c89
ld b, $0
add hl, bc
jp PlaceString
; 1cbb
MenuBox:: ; 1cbb
MenuBox:: ; 1b4e (0:1b4e)
call MenuBoxCoord2Tile
call GetMenuBoxDims
dec b
dec c
jp TextBox
; 1cc6
GetMenuTextStartCoord:: ; 1cc6
GetMenuTextStartCoord:: ; 1b59 (0:1b59)
ld a, [wMenuBorderTopCoord]
ld b, a
inc b
ld a, [wMenuBorderLeftCoord]
ld c, a
inc c
; bit 6: if not set, leave extra room on top
ld a, [wMenuData2Flags]
bit 6, a
jr nz, .bit_6_set
jr nz, .asm_1b6b
inc b
.bit_6_set
; bit 7: if set, leave extra room on the left
.asm_1b6b
ld a, [wMenuData2Flags]
bit 7, a
jr z, .bit_7_clear
jr z, .asm_1b73
inc c
.bit_7_clear
.asm_1b73
ret
; 1ce1
ClearMenuBoxInterior:: ; 1ce1
ClearMenuBoxInterior::
call MenuBoxCoord2Tile
ld bc, SCREEN_WIDTH + 1
add hl, bc
@@ -186,28 +225,21 @@ ClearMenuBoxInterior:: ; 1ce1
dec c
call ClearBox
ret
; 1cf1
ClearWholeMenuBox:: ; 1cf1
ClearWholeMenuBox::
call MenuBoxCoord2Tile
call GetMenuBoxDims
inc c
inc b
call ClearBox
ret
; 1cfd
MenuBoxCoord2Tile:: ; 1cfd
MenuBoxCoord2Tile:: ; 1b90 (0:1b90)
ld a, [wMenuBorderLeftCoord]
ld c, a
ld a, [wMenuBorderTopCoord]
ld b, a
; 1d05
Coord2Tile:: ; 1d05
; Return the address of TileMap(c, b) in hl.
Coord2Tile:: ; 1b98 (0:1b98)
xor a
ld h, a
ld l, b
@@ -223,35 +255,6 @@ Coord2Tile:: ; 1d05
xor a
ld b, a
add hl, bc
bccoord 0, 0
ld bc, wTileMap
add hl, bc
ret
; 1d19
MenuBoxCoord2Attr:: ; 1d19
ld a, [wMenuBorderLeftCoord]
ld c, a
ld a, [wMenuBorderTopCoord]
ld b, a
Coord2Attr:: ; 1d21
; Return the address of AttrMap(c, b) in hl.
xor a
ld h, a
ld l, b
ld a, c
ld b, h
ld c, l
add hl, hl
add hl, hl
add hl, bc
add hl, hl
add hl, hl
ld c, a
xor a
ld b, a
add hl, bc
bccoord 0, 0, AttrMap
add hl, bc
ret
; 1d35

View File

@@ -496,12 +496,6 @@ loadbytec2cf: macro
db \1 ; byte
endm
enum farwritetext_command
farwritetext: macro
db farwritetext_command
dba \1
endm
enum writetext_command
writetext: macro
db writetext_command

View File

@@ -70,7 +70,19 @@ SECTION "bank8", DATA, BANK[$8]
SECTION "bank9", DATA, BANK[$9]
StringBufferPointers::
dr $24000, $28000
dr $24000, $2400e
_2DMenu_::
dr $2400e, $24136
StaticMenuJoypad_::
dr $24136, $24139
ScrollingMenuJoypad_::
dr $24139, $242a0
PushWindow_::
dr $242a0, $24307
ExitMenu_::
dr $24307, $24395
InitVerticalMenuCursor_::
dr $24395, $28000
SECTION "banka", DATA, BANK[$a]
dr $28000, $2c000

31605
sram.asm Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -2131,12 +2131,13 @@ wcea4:: ds 1 ; cea4
wcea5:: ds 1 ; cea5
wcea6:: ds 1 ; cea6
wcea7:: ds 1 ; cea7
wcea8:: ds 1 ; cea8
wcea9:: ds 1 ; cea9
wceaa:: ds 1 ; ceaa
wceab:: ds 1 ; ceab
wWindowData::
wWindowStackPointer:: dw ; cea8
wMenuJoypad:: ds 1 ; ceaa
wMenuSelection:: ds 1 ; ceab
wceac:: ds 1 ; ceac
wcead:: ds 1 ; cead
wWhichIndexSet:: ds 1 ; cead
wceae:: ds 1 ; ceae
wceaf:: ds 1 ; ceaf
wceb0:: ds 1 ; ceb0
@@ -2147,14 +2148,16 @@ wceb4:: ds 1 ; ceb4
wceb5:: ds 1 ; ceb5
wceb6:: ds 1 ; ceb6
wceb7:: ds 1 ; ceb7
wWindowDataEnd::
wMenuDataHeader::
wceb8:: ds 1 ; ceb8
wceb9:: ds 1 ; ceb9
wceba:: ds 1 ; ceba
wcebb:: ds 1 ; cebb
wcebc:: ds 1 ; cebc
wcebd:: ds 1 ; cebd
wcebe:: ds 1 ; cebe
wcebf:: ds 1 ; cebf
wMenuBorderTopCoord:: ds 1 ; ceb9
wMenuBorderLeftCoord:: ds 1 ; ceba
wMenuBorderBottomCoord:: ds 1 ; cebb
wMenuBorderRightCoord:: ds 1 ; cebc
wMenuData2Pointer:: dw ; cebd
wMenuCursorBuffer:: ds 1 ; cebf
wcec0:: ds 1 ; cec0
wcec1:: ds 1 ; cec1
wcec2:: ds 1 ; cec2
@@ -2163,13 +2166,15 @@ wcec4:: ds 1 ; cec4
wcec5:: ds 1 ; cec5
wcec6:: ds 1 ; cec6
wcec7:: ds 1 ; cec7
wcec8:: ds 1 ; cec8
wcec9:: ds 1 ; cec9
wceca:: ds 1 ; ceca
wcecb:: ds 1 ; cecb
wcecc:: ds 1 ; cecc
wcecd:: ds 1 ; cecd
wcece:: ds 1 ; cece
wMenuDataHeaderEnd::
wMenuData2::
wMenuData2Flags:: ds 1 ; cec8
wMenuData2Items:: ds 1 ; cec9
wMenuData2IndicesPointer:: ds 1 ; ceca
wMenuDataBank:: ds 1 ; cecb
wMenuData2DisplayFunctionPointer:: dw ; cecc
wMenuData2PointerTableAddr:: ds 1 ; cece
wcecf:: ds 1 ; cecf
wced0:: ds 1 ; ced0
wced1:: ds 1 ; ced1
@@ -2179,22 +2184,26 @@ wced4:: ds 1 ; ced4
wced5:: ds 1 ; ced5
wced6:: ds 1 ; ced6
wced7:: ds 1 ; ced7
wced8:: ds 1 ; ced8
wMenuData2End::
wMenuData3::
w2DMenuCursorInitY:: ds 1 ; ced8
wced9:: ds 1 ; ced9
wceda:: ds 1 ; ceda
wcedb:: ds 1 ; cedb
wcedc:: ds 1 ; cedc
wcedd:: ds 1 ; cedd
wcede:: ds 1 ; cede
wcedf:: ds 1 ; cedf
wcee0:: ds 1 ; cee0
wMenuJoypadFilter:: ds 1 ; cedf
wMenuCursorY:: ds 1 ; cee0
wcee1:: ds 1 ; cee1
wcee2:: ds 1 ; cee2
wcee3:: ds 1 ; cee3
wCursorCurrentTile:: ds 1 ; cee3
wcee4:: ds 1 ; cee4
wcee5:: ds 1 ; cee5
wcee6:: ds 1 ; cee6
wcee7:: ds 1 ; cee7
wMenuData3End::
wOverworldDelay:: ds 1 ; cee8
wTextDelayFrames:: ds 1 ; cee9