2015-10-24 07:34:19 -07:00
|
|
|
BackUpTiles:: ; 1c00
|
|
|
|
callab _BackUpTiles
|
|
|
|
ret
|
|
|
|
; 1c07
|
|
|
|
|
|
|
|
ExitMenu:: ; 0x1c07
|
|
|
|
push af
|
|
|
|
callab Function243e8
|
|
|
|
pop af
|
|
|
|
ret
|
|
|
|
|
|
|
|
Function1c10:: ; 0x1c10
|
|
|
|
callab Function2446d
|
|
|
|
ret
|
|
|
|
|
|
|
|
WriteBackup:: ; 0x1c17
|
|
|
|
push af
|
|
|
|
call ExitMenu
|
|
|
|
call Function321c
|
|
|
|
call UpdateSprites
|
|
|
|
pop af
|
|
|
|
ret
|
|
|
|
|
|
|
|
RestoreTileBackup:: ; 0x1c23
|
|
|
|
call GetMemTileCoord
|
|
|
|
call .copy
|
|
|
|
call GetMemAttrCoord
|
|
|
|
call .copy
|
|
|
|
ret
|
|
|
|
; 0x1c30
|
|
|
|
|
|
|
|
.copy: ; 0x1c30
|
|
|
|
call GetMenuBoxDims
|
2013-11-26 03:44:05 -08:00
|
|
|
inc b
|
|
|
|
inc c
|
2015-10-24 07:34:19 -07:00
|
|
|
|
|
|
|
.row
|
2013-11-26 03:44:05 -08:00
|
|
|
push bc
|
|
|
|
push hl
|
2015-10-24 07:34:19 -07:00
|
|
|
|
|
|
|
.col
|
2013-11-26 03:44:05 -08:00
|
|
|
ld a, [de]
|
|
|
|
ld [hli], a
|
|
|
|
dec de
|
|
|
|
dec c
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nz, .col ; 0x1c3b $fa
|
|
|
|
|
2013-11-26 03:44:05 -08:00
|
|
|
pop hl
|
2015-10-24 07:34:19 -07:00
|
|
|
ld bc, SCREEN_WIDTH
|
2013-11-26 03:44:05 -08:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nz, .row ; 0x1c44 $ef
|
|
|
|
|
2013-11-26 03:44:05 -08:00
|
|
|
ret
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function1c47:: ; 0x1c47
|
2013-11-26 03:44:05 -08:00
|
|
|
ld b, $10
|
2015-02-10 15:14:41 -08:00
|
|
|
ld de, wcf81
|
2015-10-24 07:34:19 -07:00
|
|
|
.loop
|
2013-11-26 03:44:05 -08:00
|
|
|
ld a, [hld]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec b
|
2015-10-24 07:34:19 -07:00
|
|
|
jr nz, .loop ; 0x1c50 $fa
|
2013-11-26 03:44:05 -08:00
|
|
|
ret
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
GetMenuBoxDims:: ; 0x1c53
|
|
|
|
ld a, [wMenuBorderTopCoord] ; top
|
2013-11-26 03:44:05 -08:00
|
|
|
ld b, a
|
2015-10-24 07:34:19 -07:00
|
|
|
ld a, [wMenuBorderBottomCoord] ; bottom
|
2013-11-26 03:44:05 -08:00
|
|
|
sub b
|
|
|
|
ld b, a
|
2015-10-24 07:34:19 -07:00
|
|
|
ld a, [wMenuBorderLeftCoord] ; left
|
2013-11-26 03:44:05 -08:00
|
|
|
ld c, a
|
2015-10-24 07:34:19 -07:00
|
|
|
ld a, [wMenuBorderRightCoord] ; right
|
2013-11-26 03:44:05 -08:00
|
|
|
sub c
|
|
|
|
ld c, a
|
|
|
|
ret
|
|
|
|
; 0x1c66
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function1c66:: ; 1c66
|
2013-11-26 03:44:05 -08:00
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
push af
|
2015-02-10 15:14:41 -08:00
|
|
|
ld hl, wcf86
|
2013-11-26 03:44:05 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
2015-11-04 11:02:11 -08:00
|
|
|
ld de, wMenuData2Flags
|
2013-11-26 03:44:05 -08:00
|
|
|
ld bc, $0010
|
|
|
|
call CopyBytes
|
|
|
|
pop af
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
; 1c7e
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function1c7e:: ; 1c7e
|
2015-02-10 15:14:41 -08:00
|
|
|
ld hl, wcf71
|
2013-11-26 03:44:05 -08:00
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
inc hl
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ret
|
|
|
|
; 1c89
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function1c89:: ; 1c89
|
2013-11-26 03:44:05 -08:00
|
|
|
call Function1c66
|
2015-02-10 15:14:41 -08:00
|
|
|
ld hl, wcf86
|
2013-11-26 03:44:05 -08:00
|
|
|
ld e, [hl]
|
|
|
|
inc hl
|
|
|
|
ld d, [hl]
|
|
|
|
call Function1cc6
|
|
|
|
call GetTileCoord
|
|
|
|
inc de
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld b, a
|
|
|
|
.asm_1c9c
|
|
|
|
push bc
|
|
|
|
call PlaceString
|
|
|
|
inc de
|
|
|
|
ld bc, $0028
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
|
|
|
jr nz, .asm_1c9c
|
2015-11-04 11:02:11 -08:00
|
|
|
ld a, [wMenuData2Flags]
|
2013-11-26 03:44:05 -08:00
|
|
|
bit 4, a
|
|
|
|
ret z
|
2015-10-16 10:35:43 -07:00
|
|
|
call GetMemTileCoord
|
2013-11-26 03:44:05 -08:00
|
|
|
ld a, [de]
|
|
|
|
ld c, a
|
|
|
|
inc de
|
|
|
|
ld b, $0
|
|
|
|
add hl, bc
|
|
|
|
jp PlaceString
|
|
|
|
; 1cbb
|
|
|
|
|
2015-11-04 11:02:11 -08:00
|
|
|
MenuBox:: ; 1cbb
|
2015-10-16 10:35:43 -07:00
|
|
|
call GetMemTileCoord
|
2015-10-24 07:34:19 -07:00
|
|
|
call GetMenuBoxDims
|
2013-11-26 03:44:05 -08:00
|
|
|
dec b
|
|
|
|
dec c
|
|
|
|
jp TextBox
|
|
|
|
; 1cc6
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function1cc6:: ; 1cc6
|
2015-10-24 07:34:19 -07:00
|
|
|
ld a, [wMenuBorderTopCoord]
|
2013-11-26 03:44:05 -08:00
|
|
|
ld b, a
|
|
|
|
inc b
|
2015-10-24 07:34:19 -07:00
|
|
|
ld a, [wMenuBorderLeftCoord]
|
2013-11-26 03:44:05 -08:00
|
|
|
ld c, a
|
|
|
|
inc c
|
2015-11-04 11:02:11 -08:00
|
|
|
ld a, [wMenuData2Flags]
|
2013-11-26 03:44:05 -08:00
|
|
|
bit 6, a
|
|
|
|
jr nz, .asm_1cd8
|
|
|
|
inc b
|
|
|
|
|
|
|
|
.asm_1cd8
|
2015-11-04 11:02:11 -08:00
|
|
|
ld a, [wMenuData2Flags]
|
2013-11-26 03:44:05 -08:00
|
|
|
bit 7, a
|
|
|
|
jr z, .asm_1ce0
|
|
|
|
inc c
|
|
|
|
|
|
|
|
.asm_1ce0
|
|
|
|
ret
|
|
|
|
; 1ce1
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function1ce1:: ; 1ce1
|
2015-10-16 10:35:43 -07:00
|
|
|
call GetMemTileCoord
|
2015-11-01 06:38:48 -08:00
|
|
|
lb bc, 0, 21
|
2013-11-26 03:44:05 -08:00
|
|
|
add hl, bc
|
2015-10-24 07:34:19 -07:00
|
|
|
call GetMenuBoxDims
|
2013-11-26 03:44:05 -08:00
|
|
|
dec b
|
|
|
|
dec c
|
|
|
|
call ClearBox
|
|
|
|
ret
|
|
|
|
; 1cf1
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
Function1cf1:: ; 1cf1
|
2015-10-16 10:35:43 -07:00
|
|
|
call GetMemTileCoord
|
2015-10-24 07:34:19 -07:00
|
|
|
call GetMenuBoxDims
|
2013-11-26 03:44:05 -08:00
|
|
|
inc c
|
|
|
|
inc b
|
|
|
|
call ClearBox
|
|
|
|
ret
|
|
|
|
; 1cfd
|
|
|
|
|
|
|
|
|
2015-10-16 10:35:43 -07:00
|
|
|
GetMemTileCoord:: ; 1cfd
|
2015-10-24 07:34:19 -07:00
|
|
|
ld a, [wMenuBorderLeftCoord]
|
2013-11-26 03:44:05 -08:00
|
|
|
ld c, a
|
2015-10-24 07:34:19 -07:00
|
|
|
ld a, [wMenuBorderTopCoord]
|
2013-11-26 03:44:05 -08:00
|
|
|
ld b, a
|
|
|
|
; 1d05
|
|
|
|
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetTileCoord:: ; 1d05
|
2013-11-26 03:44:05 -08:00
|
|
|
; Return the address of TileMap(c, b) in hl.
|
|
|
|
xor a
|
|
|
|
ld h, a
|
|
|
|
ld l, b
|
|
|
|
ld a, c
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-11-26 03:44:05 -08:00
|
|
|
add hl, hl
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-11-26 03:44:05 -08:00
|
|
|
add hl, bc
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-11-26 03:44:05 -08:00
|
|
|
add hl, hl
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-11-26 03:44:05 -08:00
|
|
|
ld c, a
|
|
|
|
xor a
|
|
|
|
ld b, a
|
|
|
|
add hl, bc
|
2015-07-22 12:57:02 -07:00
|
|
|
bccoord 0, 0
|
2013-11-26 03:44:05 -08:00
|
|
|
add hl, bc
|
|
|
|
ret
|
|
|
|
; 1d19
|
|
|
|
|
2015-10-24 07:34:19 -07:00
|
|
|
GetMemAttrCoord:: ; 1d19
|
|
|
|
ld a, [wMenuBorderLeftCoord]
|
2013-11-26 03:44:05 -08:00
|
|
|
ld c, a
|
2015-10-24 07:34:19 -07:00
|
|
|
ld a, [wMenuBorderTopCoord]
|
2013-11-26 03:44:05 -08:00
|
|
|
ld b, a
|
|
|
|
|
2014-02-01 17:26:39 -08:00
|
|
|
GetAttrCoord:: ; 1d21
|
2013-11-26 03:44:05 -08:00
|
|
|
; 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
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-11-26 03:44:05 -08:00
|
|
|
add hl, hl
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-11-26 03:44:05 -08:00
|
|
|
add hl, bc
|
2015-07-20 19:18:18 -07:00
|
|
|
rept 2
|
2013-11-26 03:44:05 -08:00
|
|
|
add hl, hl
|
2015-07-20 19:18:18 -07:00
|
|
|
endr
|
2013-11-26 03:44:05 -08:00
|
|
|
ld c, a
|
|
|
|
xor a
|
|
|
|
ld b, a
|
|
|
|
add hl, bc
|
2015-07-22 12:57:02 -07:00
|
|
|
bccoord 0, 0, AttrMap
|
2013-11-26 03:44:05 -08:00
|
|
|
add hl, bc
|
|
|
|
ret
|
|
|
|
; 1d35
|