Labeled every function in ROM0 that's referenced in the source

This commit is contained in:
pikalaxalt
2016-05-10 12:31:49 -04:00
parent e95d42e0af
commit ae36ef2c7f
86 changed files with 554 additions and 512 deletions

View File

@@ -576,16 +576,16 @@ Function17aa22: ; 17aa22 (5e:6a22)
push de
ld a, $3
call Function17aae0
rept 3
add a
endr
add a
add a
add $0
push af
ld a, $4
call Function17aae0
rept 3
add a
endr
add a
add a
add $8
ld c, a
pop af

View File

@@ -550,9 +550,9 @@ _Get1bpp:: ; 1042b2
ld a, b
ld l, c
ld h, $0
rept 3
add hl, hl ; multiply by 8
endr
add hl, hl ; multiply by 8
add hl, hl ; multiply by 8
ld c, l
ld b, h
ld h, d

View File

@@ -53,9 +53,9 @@ MobileCheckOwnMonAnywhere: ; 4a843
jr z, .asm_4a8d1
ld hl, .BoxAddrs
ld b, 0
rept 3
add hl, bc
endr
add hl, bc
add hl, bc
ld a, [hli]
call GetSRAMBank
ld a, [hli]

View File

@@ -45,7 +45,9 @@ Function8917a: ; 8917a (22:517a)
ret
Function89185: ; 89185 (22:5185)
; Compares c bytes starting at de and hl and incrementing together until a match is found.
; strcmp(hl, de, c)
; Compares c bytes starting at de and hl and incrementing together until a mismatch is found.
; Preserves hl and de.
push de
push hl
.loop
@@ -62,7 +64,9 @@ Function89185: ; 89185 (22:5185)
ret
Function89193: ; 89193
; copy(hl, de, 4)
; Copies c bytes from hl to de.
; Preserves hl and de.
push de
push hl
.loop
@@ -355,10 +359,10 @@ Function89305: ; 89305 (22:5305)
Function8931b: ; 8931b
push hl
ld hl, $a03b
ld hl, $a03b ; 4:a03b
ld a, [MenuSelection]
dec a
ld bc, $0025
ld bc, 37
call AddNTimes
ld b, h
ld c, l
@@ -371,7 +375,9 @@ Function8932d: ; 8932d
add hl, bc
Function89331: ; 89331
; Scans up to 5 characters starting at hl, looking for a nonspace character up to the next terminator. Sets carry if it does not find a nonspace character. Returns the location of the following character in hl.
; Scans up to 5 characters starting at hl, looking for a nonspace character up to the next terminator.
; Sets carry if it does not find a nonspace character.
; Returns the location of the following character in hl.
push bc
ld c, 5
.loop
@@ -1649,44 +1655,44 @@ String_89a53: ; 89a53
; 89a57
Function89a57: ; 89a57
call Function354b
bit 6, c
jr nz, .asm_89a78
bit 7, c
jr nz, .asm_89a81
bit 0, c
jr nz, .asm_89a70
bit 1, c
jr nz, .asm_89a70
bit 3, c
jr nz, .asm_89a74
call JoyTextDelay_ForcehJoyDown ; joypad
bit D_UP_F, c
jr nz, .d_up
bit D_DOWN_F, c
jr nz, .d_down
bit A_BUTTON_F, c
jr nz, .a_b_button
bit B_BUTTON_F, c
jr nz, .a_b_button
bit START_F, c
jr nz, .start_button
scf
ret
.asm_89a70
.a_b_button
ld a, $1
and a
ret
.asm_89a74
.start_button
ld a, $2
and a
ret
.asm_89a78
call Function89a9b
call nc, Function89a8a
.d_up
call .MoveCursorUp
call nc, .PlayPocketSwitchSFX
ld a, $0
ret
.asm_89a81
call Function89a93
call nc, Function89a8a
.d_down
call .MoveCursorDown
call nc, .PlayPocketSwitchSFX
ld a, $0
ret
; 89a8a
Function89a8a: ; 89a8a
.PlayPocketSwitchSFX: ; 89a8a
push af
ld de, SFX_SWITCH_POCKETS
call PlaySFX
@@ -1694,42 +1700,42 @@ Function89a8a: ; 89a8a
ret
; 89a93
Function89a93: ; 89a93
ld d, $28
ld e, $1
call Function89aa3
.MoveCursorDown: ; 89a93
ld d, 40
ld e, 1
call .ApplyCursorMovement
ret
; 89a9b
Function89a9b: ; 89a9b
ld d, $1
ld e, $ff
call Function89aa3
.MoveCursorUp: ; 89a9b
ld d, 1
ld e, -1
call .ApplyCursorMovement
ret
; 89aa3
Function89aa3: ; 89aa3
.ApplyCursorMovement: ; 89aa3
ld a, [MenuSelection]
ld c, a
push bc
.asm_89aa8
.loop
ld a, [MenuSelection]
cp d
jr z, .asm_89ac0
jr z, .equal_to_d
add e
jr nz, .asm_89ab2
jr nz, .not_zero
inc a
.asm_89ab2
.not_zero
ld [MenuSelection], a
call Function89ac7
jr nc, .asm_89aa8
call Function89ae6
call .Function89ac7 ; BCD conversion of data in SRAM?
jr nc, .loop
call .Function89ae6 ; split [MenuSelection] into [wd030] + [wd031] where [wd030] <= 5
pop bc
and a
ret
.asm_89ac0
.equal_to_d
pop bc
ld a, c
ld [MenuSelection], a
@@ -1737,48 +1743,48 @@ Function89aa3: ; 89aa3
ret
; 89ac7
Function89ac7: ; 89ac7
.Function89ac7: ; 89ac7
call OpenSRAMBank4
call Function8931b
call Function89ad4
call .Function89ad4
call CloseSRAM
ret
; 89ad4
Function89ad4: ; 89ad4
.Function89ad4: ; 89ad4
push de
call Function8932d
jr c, .asm_89ae3
ld hl, $0011
call Function8932d ; find a non-space character within 5 bytes of bc
jr c, .no_nonspace_character
ld hl, 17
add hl, bc
call Function89b45
jr c, .asm_89ae4
jr c, .finish_decode
.asm_89ae3
.no_nonspace_character
and a
.asm_89ae4
.finish_decode
pop de
ret
; 89ae6
Function89ae6: ; 89ae6
.Function89ae6: ; 89ae6
ld hl, wd031
xor a
ld [hl], a
ld a, [MenuSelection]
.asm_89aee
cp $6
jr c, .asm_89afc
sub $5
.loop2
cp 6
jr c, .load_and_ret
sub 5
ld c, a
ld a, [hl]
add $5
add 5
ld [hl], a
ld a, c
jr .asm_89aee
jr .loop2
.asm_89afc
.load_and_ret
ld [wd030], a
ret
; 89b00
@@ -1823,48 +1829,50 @@ Function89b3b: ; 89b3b (22:5b3b)
ret
Function89b45: ; 89b45
; some sort of decoder?
; BCD?
push hl
push bc
ld c, $10
ld e, $0
.asm_89b4b
.loop
ld a, [hli]
ld b, a
and $f
cp $a
jr c, .asm_89b5a
cp 10
jr c, .low_nybble_less_than_10
ld a, c
cp $b
jr nc, .asm_89b74
jr .asm_89b71
jr nc, .clear_carry
jr .set_carry
.asm_89b5a
.low_nybble_less_than_10
dec c
swap b
inc e
ld a, b
and $f
cp $a
jr c, .asm_89b6c
cp 10
jr c, .high_nybble_less_than_10
ld a, c
cp $b
jr nc, .asm_89b74
jr .asm_89b71
jr nc, .clear_carry
jr .set_carry
.asm_89b6c
.high_nybble_less_than_10
inc e
dec c
jr nz, .asm_89b4b
jr nz, .loop
dec e
.asm_89b71
.set_carry
scf
jr .asm_89b75
jr .finish
.asm_89b74
.clear_carry
and a
.asm_89b75
.finish
pop bc
pop hl
ret
@@ -2027,56 +2035,59 @@ Function89c44: ; 89c44 (22:5c44)
ret
Function89c67: ; 89c67 (22:5c67)
call Function354b
; menu scrolling?
call JoyTextDelay_ForcehJoyDown ; joypad
ld b, $0
bit 0, c
jr z, .asm_89c74
bit A_BUTTON_F, c
jr z, .not_a_button
ld b, $1
and a
ret
.asm_89c74
bit 1, c
jr z, .asm_89c7a
.not_a_button
bit B_BUTTON_F, c
jr z, .not_b_button
scf
ret
.asm_89c7a
.not_b_button
xor a
bit 6, c
jr z, .asm_89c81
bit D_UP_F, c
jr z, .not_d_up
ld a, $1
.asm_89c81
bit 7, c
jr z, .asm_89c87
.not_d_up
bit D_DOWN_F, c
jr z, .not_d_down
ld a, $2
.asm_89c87
bit 5, c
jr z, .asm_89c8d
.not_d_down
bit D_LEFT_F, c
jr z, .not_d_left
ld a, $3
.asm_89c8d
bit 4, c
jr z, .asm_89c93
.not_d_left
bit D_RIGHT_F, c
jr z, .not_d_right
ld a, $4
.asm_89c93
.not_d_right
and a
ret z
ret z ; no dpad pressed
dec a
ld c, a
ld d, $0
ld hl, Unknown_89cbf
ld hl, .ScrollData0
ld a, [wd02f]
and a
jr z, .asm_89ca5
ld hl, Unknown_89ccf
.asm_89ca5
jr z, .got_data
ld hl, .ScrollData1
.got_data
ld a, [wd011]
and a
jr z, .asm_89cb1
jr z, .got_row
ld e, $4
.asm_89cad
.add_n_times
add hl, de
dec a
jr nz, .asm_89cad
.asm_89cb1
jr nz, .add_n_times
.got_row
ld e, c
add hl, de
ld a, [hl]
@@ -2089,13 +2100,13 @@ Function89c67: ; 89c67 (22:5c67)
ret
; 89cbf (22:5cbf)
Unknown_89cbf: ; 89cbf
.ScrollData0: ; 89cbf
db 0, 2, 0, 0
db 1, 3, 0, 0
db 2, 4, 0, 0
db 3, 0, 0, 0
Unknown_89ccf: ; 89ccf
.ScrollData1: ; 89ccf
db 0, 0, 0, 0
db 0, 3, 0, 0
db 2, 4, 0, 0
@@ -2305,7 +2316,7 @@ Jumptable_89e18: ; 89e18 (22:5e18)
Function89e1e: ; 89e1e (22:5e1e)
call OpenSRAMBank4
ld bc, $a037
ld bc, $a037 ; 4:a037
call Function8b36c
call CloseSRAM
xor a
@@ -2648,9 +2659,9 @@ Function8a055: ; 8a055 (22:6055)
ld a, $5
call Function8a5a3
pop hl
rept 3
inc hl
endr
inc hl
inc hl
ld a, $6
call Function8a5a3
call CGBOnly_LoadEDTile
@@ -4061,7 +4072,7 @@ Function8aab6: ; 8aab6 (22:6ab6)
; 8aaf0 (22:6af0)
String_8aaf0: ; 8aaf0
db "あたらしい めいし", $4a, "できまし", $22, "@"
db "あたらしい めいし<PKMN>できまし<LNBRK>@"
; 8ab00
Function8ab00: ; 8ab00
@@ -4096,6 +4107,7 @@ Function8ab11: ; 8ab11 (22:6b11)
ret
Function8ab3b: ; 8ab3b (22:6b3b)
.pressed_start
call Function891fe
call ClearBGPalettes
call Function893cc
@@ -4114,23 +4126,24 @@ Function8ab3b: ; 8ab3b (22:6b3b)
call Function89a0c
call CloseSRAM
call Function891ab
call Function8ab77
jr c, Function8ab3b
call .JoypadLoop
jr c, .pressed_start
ret
Function8ab77: ; 8ab77 (22:6b77)
call Function354b
bit 0, c
jr nz, .asm_8ab8e
bit 1, c
jr nz, .asm_8ab8e
bit 3, c
jr z, Function8ab77
.JoypadLoop: ; 8ab77 (22:6b77)
call JoyTextDelay_ForcehJoyDown
bit A_BUTTON_F, c
jr nz, .a_b_button
bit B_BUTTON_F, c
jr nz, .a_b_button
bit START_F, c
jr z, .JoypadLoop
call PlayClickSFX
call Function89d0d
scf
ret
.asm_8ab8e
.a_b_button
call PlayClickSFX
and a
ret

View File

@@ -54,16 +54,18 @@ Function8b363: ; 8b363
; 8b36c
Function8b36c: ; 8b36c (22:736c)
; [bc + (0:4)] = -1
push bc
ld h, b
ld l, c
ld bc, $4
ld bc, 4
ld a, -1
call ByteFill
pop bc
ret
Function8b379: ; 8b379 (22:7379)
; d = [bc + e]
push bc
ld a, c
add e
@@ -77,6 +79,7 @@ Function8b379: ; 8b379 (22:7379)
ret
Function8b385: ; 8b385 (22:7385)
; [bc + e] = d
push bc
ld a, c
add e
@@ -90,36 +93,39 @@ Function8b385: ; 8b385 (22:7385)
ret
Function8b391: ; 8b391 (22:7391)
; find first e in range(4) such that [bc + e] == -1
; if none exist, return carry
push bc
ld e, $0
ld d, $4
.asm_8b396
ld e, 0
ld d, 4
.loop
ld a, [bc]
inc bc
cp $ff
jr z, .asm_8b3a2
cp -1
jr z, .done
inc e
dec d
jr nz, .asm_8b396
jr nz, .loop
dec e
scf
.asm_8b3a2
.done
pop bc
ret
Function8b3a4: ; 8b3a4 (22:73a4)
; strcmp(hl, bc, 4)
push de
push bc
ld d, b
ld e, c
ld c, $4
ld c, 4
call Function89185
pop bc
pop de
ret
Function8b3b0: ; 8b3b0 (22:73b0)
ld bc, $a037
ld bc, $a037 ; 4:a037
ld a, [$a60b]
and a
jr z, .asm_8b3c2
@@ -153,82 +159,88 @@ Function8b3cd: ; 8b3cd (22:73cd)
Function8b3dd: ; 8b3dd (22:73dd)
push de
push bc
call Function354b
call JoyTextDelay_ForcehJoyDown ; joypad
ld a, c
pop bc
pop de
bit 0, a
jr nz, .asm_8b3f7
bit 1, a
jr nz, .asm_8b40e
bit 6, a
jr nz, .asm_8b429
bit 7, a
jr nz, .asm_8b443
bit A_BUTTON_F, a
jr nz, .a_button
bit B_BUTTON_F, a
jr nz, .b_button
bit D_UP_F, a
jr nz, .d_up
bit D_DOWN_F, a
jr nz, .d_down
and a
ret
.asm_8b3f7
.a_button
ld a, e
cp $3
jr z, .asm_8b407
jr z, .e_is_zero
inc e
ld d, $0
ld d, 0
call Function8b385
xor a
ld [wd010], a
ret
.asm_8b407
.e_is_zero
call PlayClickSFX
ld d, $0
scf
ret
.asm_8b40e
.b_button
ld a, e
and a
jr nz, .asm_8b41e
jr nz, .e_is_not_zero
call PlayClickSFX
ld d, $ff
ld d, -1
call Function8b385
ld d, $1
ld d, 1
scf
ret
.asm_8b41e
ld d, $ff
.e_is_not_zero
ld d, -1
call Function8b385
dec e
xor a
ld [wd010], a
ret
.asm_8b429
.d_up
call Function8b379
ld a, d
cp $a
jr c, .asm_8b433
jr c, .less_than_10_up_1
ld d, $9
.asm_8b433
.less_than_10_up_1
inc d
ld a, d
cp $a
jr c, .asm_8b43b
jr c, .less_than_10_up_2
ld d, $0
.asm_8b43b
.less_than_10_up_2
call Function8b385
xor a
ld [wd010], a
ret
.asm_8b443
.d_down
call Function8b379
ld a, d
cp $a
jr c, .asm_8b44d
jr c, .less_than_10_down
ld d, $0
.asm_8b44d
.less_than_10_down
ld a, d
dec d
and a
jr nz, .asm_8b454
jr nz, .nonzero_down
ld d, $9
.asm_8b454
.nonzero_down
call Function8b385
xor a
ld [wd010], a
@@ -403,6 +415,7 @@ Function8b539: ; 8b539 (22:7539)
ret
Function8b555: ; 8b555 (22:7555)
.loop
ld hl, UnknownText_0x8b5ce
call PrintText
ld bc, wd017
@@ -416,27 +429,29 @@ Function8b555: ; 8b555 (22:7555)
jr nz, .asm_8b57c
ld hl, UnknownText_0x8b5e2
call PrintText
jr Function8b555
jr .loop
.asm_8b57c
ld hl, UnknownText_0x8b5d3
call PrintText
ld bc, wd013
call Function8b45c
jr c, Function8b555
jr c, .loop
ld bc, wd017
ld hl, wd013
call Function8b3a4
jr z, .asm_8b5a6
jr z, .strings_equal
call Function89448
ld bc, wd013
call Function8b493
ld hl, UnknownText_0x8b5d8
call PrintText
jr .asm_8b57c
.asm_8b5a6
.strings_equal
call OpenSRAMBank4
ld hl, wd013
ld de, $a037
ld de, $a037 ; 4:a037
ld bc, $4
call CopyBytes
call CloseSRAM
@@ -504,7 +519,7 @@ Function8b5e7: ; 8b5e7 (22:75e7)
ld bc, wd013
call Function8b493
call OpenSRAMBank4
ld hl, $a037
ld hl, $a037 ; 4:a037
call Function8b3a4
call CloseSRAM
jr z, .asm_8b635

View File

@@ -1167,9 +1167,9 @@ Function1006fd: ; 1006fd
ld hl, $a800
call GetSRAMBank
xor a
rept 3
ld [hli], a
endr
ld [hli], a
ld [hli], a
call CloseSRAM
ret
; 10070d
@@ -7211,9 +7211,9 @@ Function1030cd: ; 1030cd
ld a, [wcf44]
ld l, a
ld h, 0
rept 3
add hl, hl
endr
add hl, hl
add hl, hl
ld bc, Unknown_103112
add hl, bc
ld b, $30

View File

@@ -181,9 +181,9 @@ MobileFn_105fe3: mobile ; 105fe3
inc [hl]
jr nz, .asm_106001
ld a, $ff
rept 3
ld [hli], a
endr
ld [hli], a
ld [hli], a
ld [hl], a
.asm_106001
@@ -211,9 +211,9 @@ MobileFn_106008: mobile ; 106008
inc [hl]
jr nz, .asm_106027
ld a, $ff
rept 3
ld [hli], a
endr
ld [hli], a
ld [hli], a
ld [hl], a
.asm_106027
@@ -606,9 +606,9 @@ _MobilePrintNum:: ; 1061ef
ld de, ._9
.three_to_nine_digits
rept 3
inc de
endr
inc de
inc de
dec a
dec a
@@ -689,9 +689,9 @@ endr
sbc b
ld [hPrintNum6], a
ld a, [de]
rept 3
inc de
endr
inc de
inc de
ld b, a
ld a, [hPrintNum1]
sbc b

View File

@@ -634,9 +634,9 @@ Function1144d1: ; 1144d1
dec de
dec de
push de
rept 3
inc de
endr
inc de
inc de
inc hl
ld a, [de]
ld [hli], a
@@ -4460,9 +4460,9 @@ Function1158c2: ; 1158c2
ld bc, $0003
.asm_115914
rept 3
dec bc
endr
dec bc
dec bc
ld a, c
ld [$dc19], a
ld a, b
@@ -5139,9 +5139,9 @@ endr
ld e, [hl]
inc hl
ld d, [hl]
rept 3
inc de
endr
inc de
inc de
ld [hl], d
dec hl
ld [hl], e

View File

@@ -3767,9 +3767,9 @@ Function119b6b: ; 119b6b
ld [hld], a
dec hl
pop de
rept 3
inc hl
endr
inc hl
inc hl
ld a, h
cp $e0
jr c, .asm_119b93

View File

@@ -495,9 +495,9 @@ Function171aec: ; 171aec (5c:5aec)
.asm_171b34
pop hl
ld bc, $14
rept 3
add hl, bc
endr
add hl, bc
add hl, bc
pop af
dec a
jr nz, .asm_171b1b

View File

@@ -4393,9 +4393,9 @@ Function17f3f0: ; 17f3f0
pop hl
add hl, de
add hl, de
rept 3
inc hl
endr
inc hl
inc hl
ld e, l
ld d, h
ld l, c

View File

@@ -836,9 +836,9 @@ Function4a680: ; 4a680 (12:6680)
ld [hli], a
ld [hli], a
xor a
rept 3
ld [hli], a
endr
ld [hli], a
ld [hli], a
ret
Function4a6ab: ; 4a6ab (12:66ab)

View File

@@ -164,7 +164,7 @@ Function1dc381: ; 1dc381
call TextBox
hlcoord 8, 2
ld a, [TempMonLevel]
call Function383d
call PrintLevel_Force3Digits
hlcoord 12, 2
ld [hl], "◀" ; Filled left triangle
inc hl

View File

@@ -10,9 +10,9 @@ UnusedTitleScreen: ; 10c000
ld [hBGMapMode], a
ld hl, wJumptableIndex
rept 3
ld [hli], a
endr
ld [hli], a
ld [hli], a
ld [hl], a
ld hl, UnusedTitleBG_GFX