Restructured functions in main.asm to resemble the home functions they clone

This commit is contained in:
PikalaxALT 2015-10-17 12:58:26 -04:00
parent 4fa6c6daa4
commit da7849d800
25 changed files with 689 additions and 811 deletions

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "extras"]
path = extras
url = git://github.com/kanzure/pokemon-reverse-engineering-tools.git
url = git://github.com/pret/pokemon-reverse-engineering-tools.git

View File

@ -26,3 +26,5 @@ INCLUDE "constants/misc_constants.asm"
INCLUDE "constants/std_constants.asm"
INCLUDE "constants/deco_constants.asm"
INCLUDE "constants/radio_constants.asm"
INCLUDE "constants/sprite_constants.asm"
INCLUDE "constants/tilemap_constants.asm"

View File

@ -474,188 +474,6 @@ MAP_NONE EQU 0
shift_const SOUTH
shift_const NORTH
; sprites
const_def
const SPRITE_NONE ; 00
const SPRITE_CHRIS ; 01
const SPRITE_CHRIS_BIKE ; 02
const SPRITE_GAMEBOY_KID ; 03
const SPRITE_SILVER ; 04
const SPRITE_OAK ; 05
const SPRITE_RED ; 06
const SPRITE_BLUE ; 07
const SPRITE_BILL ; 08
const SPRITE_ELDER ; 09
const SPRITE_JANINE ; 0a
const SPRITE_KURT ; 0b
const SPRITE_MOM ; 0c
const SPRITE_BLAINE ; 0d
const SPRITE_REDS_MOM ; 0e
const SPRITE_DAISY ; 0f
const SPRITE_ELM ; 10
const SPRITE_WILL ; 11
const SPRITE_FALKNER ; 12
const SPRITE_WHITNEY ; 13
const SPRITE_BUGSY ; 14
const SPRITE_MORTY ; 15
const SPRITE_CHUCK ; 16
const SPRITE_JASMINE ; 17
const SPRITE_PRYCE ; 18
const SPRITE_CLAIR ; 19
const SPRITE_BROCK ; 1a
const SPRITE_KAREN ; 1b
const SPRITE_BRUNO ; 1c
const SPRITE_MISTY ; 1d
const SPRITE_LANCE ; 1e
const SPRITE_SURGE ; 1f
const SPRITE_ERIKA ; 20
const SPRITE_KOGA ; 21
const SPRITE_SABRINA ; 22
const SPRITE_COOLTRAINER_M ; 23
const SPRITE_COOLTRAINER_F ; 24
const SPRITE_BUG_CATCHER ; 25
const SPRITE_TWIN ; 26
const SPRITE_YOUNGSTER ; 27
const SPRITE_LASS ; 28
const SPRITE_TEACHER ; 29
const SPRITE_BUENA ; 2a
const SPRITE_SUPER_NERD ; 2b
const SPRITE_ROCKER ; 2c
const SPRITE_POKEFAN_M ; 2d
const SPRITE_POKEFAN_F ; 2e
const SPRITE_GRAMPS ; 2f
const SPRITE_GRANNY ; 30
const SPRITE_SWIMMER_GUY ; 31
const SPRITE_SWIMMER_GIRL ; 32
const SPRITE_BIG_SNORLAX ; 33
const SPRITE_SURFING_PIKACHU ; 34
const SPRITE_ROCKET ; 35
const SPRITE_ROCKET_GIRL ; 36
const SPRITE_NURSE ; 37
const SPRITE_LINK_RECEPTIONIST ; 38
const SPRITE_CLERK ; 39
const SPRITE_FISHER ; 3a
const SPRITE_FISHING_GURU ; 3b
const SPRITE_SCIENTIST ; 3c
const SPRITE_KIMONO_GIRL ; 3d
const SPRITE_SAGE ; 3e
const SPRITE_UNUSED_GUY ; 3f
const SPRITE_GENTLEMAN ; 40
const SPRITE_BLACK_BELT ; 41
const SPRITE_RECEPTIONIST ; 42
const SPRITE_OFFICER ; 43
const SPRITE_CAL ; 44
const SPRITE_SLOWPOKE ; 45
const SPRITE_CAPTAIN ; 46
const SPRITE_BIG_LAPRAS ; 47
const SPRITE_GYM_GUY ; 48
const SPRITE_SAILOR ; 49
const SPRITE_BIKER ; 4a
const SPRITE_PHARMACIST ; 4b
const SPRITE_MONSTER ; 4c
const SPRITE_FAIRY ; 4d
const SPRITE_BIRD ; 4e
const SPRITE_DRAGON ; 4f
const SPRITE_BIG_ONIX ; 50
const SPRITE_N64 ; 51
const SPRITE_SUDOWOODO ; 52
const SPRITE_SURF ; 53
const SPRITE_POKE_BALL ; 54
const SPRITE_POKEDEX ; 55
const SPRITE_PAPER ; 56
const SPRITE_VIRTUAL_BOY ; 57
const SPRITE_OLD_LINK_RECEPTIONIST ; 58
const SPRITE_ROCK ; 59
const SPRITE_BOULDER ; 5a
const SPRITE_SNES ; 5b
const SPRITE_FAMICOM ; 5c
const SPRITE_FRUIT_TREE ; 5d
const SPRITE_GOLD_TROPHY ; 5e
const SPRITE_SILVER_TROPHY ; 5f
const SPRITE_KRIS ; 60
const SPRITE_KRIS_BIKE ; 61
const SPRITE_KURT_OUTSIDE ; 62
const SPRITE_SUICUNE ; 63
const SPRITE_ENTEI ; 64
const SPRITE_RAIKOU ; 65
const SPRITE_STANDING_YOUNGSTER ; 66
const_value SET $80
SPRITE_POKEMON EQU const_value
const SPRITE_UNOWN ; 80
const SPRITE_GEODUDE ; 81
const SPRITE_GROWLITHE ; 82
const SPRITE_WEEDLE ; 83
const SPRITE_SHELLDER ; 84
const SPRITE_ODDISH ; 85
const SPRITE_GENGAR ; 86
const SPRITE_ZUBAT ; 87
const SPRITE_MAGIKARP ; 88
const SPRITE_SQUIRTLE ; 89
const SPRITE_TOGEPI ; 8a
const SPRITE_BUTTERFREE ; 8b
const SPRITE_DIGLETT ; 8c
const SPRITE_POLIWAG ; 8d
const SPRITE_PIKACHU ; 8e
const SPRITE_CLEFAIRY ; 8f
const SPRITE_CHARMANDER ; 90
const SPRITE_JYNX ; 91
const SPRITE_STARMIE ; 92
const SPRITE_BULBASAUR ; 93
const SPRITE_JIGGLYPUFF ; 94
const SPRITE_GRIMER ; 95
const SPRITE_EKANS ; 96
const SPRITE_PARAS ; 97
const SPRITE_TENTACOOL ; 98
const SPRITE_TAUROS ; 99
const SPRITE_MACHOP ; 9a
const SPRITE_VOLTORB ; 9b
const SPRITE_LAPRAS ; 9c
const SPRITE_RHYDON ; 9d
const SPRITE_MOLTRES ; 9e
const SPRITE_SNORLAX ; 9f
const SPRITE_GYARADOS ; a0
const SPRITE_LUGIA ; a1
const SPRITE_HO_OH ; a2
const_value SET $e0
const SPRITE_DAYCARE_MON_1 ; e0
const SPRITE_DAYCARE_MON_2 ; e1
const_value SET $f0
SPRITE_VARS EQU const_value
const SPRITE_CONSOLE ; f0
const SPRITE_DOLL_1 ; f1
const SPRITE_DOLL_2 ; f2
const SPRITE_BIG_DOLL ; f3
const SPRITE_WEIRD_TREE ; f4
const SPRITE_OLIVINE_RIVAL ; f5
const SPRITE_AZALEA_ROCKET ; f6
const SPRITE_FUCHSIA_GYM_1 ; f7
const SPRITE_FUCHSIA_GYM_2 ; f8
const SPRITE_FUCHSIA_GYM_3 ; f9
const SPRITE_FUCHSIA_GYM_4 ; fa
const SPRITE_COPYCAT ; fb
const SPRITE_JANINE_IMPERSONATOR ; fc
; sprite types
const_value SET 1
const WALKING_SPRITE
const STANDING_SPRITE
const STILL_SPRITE
; sprite palettes
const_def
const PAL_OW_RED
const PAL_OW_BLUE
const PAL_OW_GREEN
const PAL_OW_BROWN
const PAL_OW_PINK
const PAL_OW_SILVER
const PAL_OW_TREE
const PAL_OW_ROCK
; permissions
const_value SET 1
const TOWN
@ -795,42 +613,6 @@ const_value = -1
const SPAWN_FAST_SHIP
NUM_SPAWNS EQU const_value
const_def
const SPRITEMOVEFN_00
const SPRITEMOVEFN_01
const SPRITEMOVEFN_02
const SPRITEMOVEFN_03
const SPRITEMOVEFN_04
const SPRITEMOVEFN_05
const SPRITEMOVEFN_06
const SPRITEMOVEFN_07
const SPRITEMOVEFN_08
const SPRITEMOVEFN_09
const SPRITEMOVEFN_0A
const SPRITEMOVEFN_0B
const SPRITEMOVEFN_0C
const SPRITEMOVEFN_0D
const SPRITEMOVEFN_0E
const SPRITEMOVEFN_0F
const SPRITEMOVEFN_10
const SPRITEMOVEFN_11
const SPRITEMOVEFN_12
const SPRITEMOVEFN_13
const SPRITEMOVEFN_14
const SPRITEMOVEFN_15
const SPRITEMOVEFN_16
const SPRITEMOVEFN_17
const SPRITEMOVEFN_18
const SPRITEMOVEFN_19
const SPRITEMOVEFN_1A
const SPRITEMOVEFN_1B
const SPRITEMOVEFN_1C
const SPRITEMOVEFN_1D
const SPRITEMOVEFN_1E
const SPRITEMOVEFN_1F
const SPRITEMOVEFN_20
const SPRITEMOVEFN_21
const_def
const PALETTE_AUTO
const PALETTE_DAY

View File

@ -0,0 +1,219 @@
; sprites
const_def
const SPRITE_NONE ; 00
const SPRITE_CHRIS ; 01
const SPRITE_CHRIS_BIKE ; 02
const SPRITE_GAMEBOY_KID ; 03
const SPRITE_SILVER ; 04
const SPRITE_OAK ; 05
const SPRITE_RED ; 06
const SPRITE_BLUE ; 07
const SPRITE_BILL ; 08
const SPRITE_ELDER ; 09
const SPRITE_JANINE ; 0a
const SPRITE_KURT ; 0b
const SPRITE_MOM ; 0c
const SPRITE_BLAINE ; 0d
const SPRITE_REDS_MOM ; 0e
const SPRITE_DAISY ; 0f
const SPRITE_ELM ; 10
const SPRITE_WILL ; 11
const SPRITE_FALKNER ; 12
const SPRITE_WHITNEY ; 13
const SPRITE_BUGSY ; 14
const SPRITE_MORTY ; 15
const SPRITE_CHUCK ; 16
const SPRITE_JASMINE ; 17
const SPRITE_PRYCE ; 18
const SPRITE_CLAIR ; 19
const SPRITE_BROCK ; 1a
const SPRITE_KAREN ; 1b
const SPRITE_BRUNO ; 1c
const SPRITE_MISTY ; 1d
const SPRITE_LANCE ; 1e
const SPRITE_SURGE ; 1f
const SPRITE_ERIKA ; 20
const SPRITE_KOGA ; 21
const SPRITE_SABRINA ; 22
const SPRITE_COOLTRAINER_M ; 23
const SPRITE_COOLTRAINER_F ; 24
const SPRITE_BUG_CATCHER ; 25
const SPRITE_TWIN ; 26
const SPRITE_YOUNGSTER ; 27
const SPRITE_LASS ; 28
const SPRITE_TEACHER ; 29
const SPRITE_BUENA ; 2a
const SPRITE_SUPER_NERD ; 2b
const SPRITE_ROCKER ; 2c
const SPRITE_POKEFAN_M ; 2d
const SPRITE_POKEFAN_F ; 2e
const SPRITE_GRAMPS ; 2f
const SPRITE_GRANNY ; 30
const SPRITE_SWIMMER_GUY ; 31
const SPRITE_SWIMMER_GIRL ; 32
const SPRITE_BIG_SNORLAX ; 33
const SPRITE_SURFING_PIKACHU ; 34
const SPRITE_ROCKET ; 35
const SPRITE_ROCKET_GIRL ; 36
const SPRITE_NURSE ; 37
const SPRITE_LINK_RECEPTIONIST ; 38
const SPRITE_CLERK ; 39
const SPRITE_FISHER ; 3a
const SPRITE_FISHING_GURU ; 3b
const SPRITE_SCIENTIST ; 3c
const SPRITE_KIMONO_GIRL ; 3d
const SPRITE_SAGE ; 3e
const SPRITE_UNUSED_GUY ; 3f
const SPRITE_GENTLEMAN ; 40
const SPRITE_BLACK_BELT ; 41
const SPRITE_RECEPTIONIST ; 42
const SPRITE_OFFICER ; 43
const SPRITE_CAL ; 44
const SPRITE_SLOWPOKE ; 45
const SPRITE_CAPTAIN ; 46
const SPRITE_BIG_LAPRAS ; 47
const SPRITE_GYM_GUY ; 48
const SPRITE_SAILOR ; 49
const SPRITE_BIKER ; 4a
const SPRITE_PHARMACIST ; 4b
const SPRITE_MONSTER ; 4c
const SPRITE_FAIRY ; 4d
const SPRITE_BIRD ; 4e
const SPRITE_DRAGON ; 4f
const SPRITE_BIG_ONIX ; 50
const SPRITE_N64 ; 51
const SPRITE_SUDOWOODO ; 52
const SPRITE_SURF ; 53
const SPRITE_POKE_BALL ; 54
const SPRITE_POKEDEX ; 55
const SPRITE_PAPER ; 56
const SPRITE_VIRTUAL_BOY ; 57
const SPRITE_OLD_LINK_RECEPTIONIST ; 58
const SPRITE_ROCK ; 59
const SPRITE_BOULDER ; 5a
const SPRITE_SNES ; 5b
const SPRITE_FAMICOM ; 5c
const SPRITE_FRUIT_TREE ; 5d
const SPRITE_GOLD_TROPHY ; 5e
const SPRITE_SILVER_TROPHY ; 5f
const SPRITE_KRIS ; 60
const SPRITE_KRIS_BIKE ; 61
const SPRITE_KURT_OUTSIDE ; 62
const SPRITE_SUICUNE ; 63
const SPRITE_ENTEI ; 64
const SPRITE_RAIKOU ; 65
const SPRITE_STANDING_YOUNGSTER ; 66
const_value SET $80
SPRITE_POKEMON EQU const_value
const SPRITE_UNOWN ; 80
const SPRITE_GEODUDE ; 81
const SPRITE_GROWLITHE ; 82
const SPRITE_WEEDLE ; 83
const SPRITE_SHELLDER ; 84
const SPRITE_ODDISH ; 85
const SPRITE_GENGAR ; 86
const SPRITE_ZUBAT ; 87
const SPRITE_MAGIKARP ; 88
const SPRITE_SQUIRTLE ; 89
const SPRITE_TOGEPI ; 8a
const SPRITE_BUTTERFREE ; 8b
const SPRITE_DIGLETT ; 8c
const SPRITE_POLIWAG ; 8d
const SPRITE_PIKACHU ; 8e
const SPRITE_CLEFAIRY ; 8f
const SPRITE_CHARMANDER ; 90
const SPRITE_JYNX ; 91
const SPRITE_STARMIE ; 92
const SPRITE_BULBASAUR ; 93
const SPRITE_JIGGLYPUFF ; 94
const SPRITE_GRIMER ; 95
const SPRITE_EKANS ; 96
const SPRITE_PARAS ; 97
const SPRITE_TENTACOOL ; 98
const SPRITE_TAUROS ; 99
const SPRITE_MACHOP ; 9a
const SPRITE_VOLTORB ; 9b
const SPRITE_LAPRAS ; 9c
const SPRITE_RHYDON ; 9d
const SPRITE_MOLTRES ; 9e
const SPRITE_SNORLAX ; 9f
const SPRITE_GYARADOS ; a0
const SPRITE_LUGIA ; a1
const SPRITE_HO_OH ; a2
const_value SET $e0
const SPRITE_DAYCARE_MON_1 ; e0
const SPRITE_DAYCARE_MON_2 ; e1
const_value SET $f0
SPRITE_VARS EQU const_value
const SPRITE_CONSOLE ; f0
const SPRITE_DOLL_1 ; f1
const SPRITE_DOLL_2 ; f2
const SPRITE_BIG_DOLL ; f3
const SPRITE_WEIRD_TREE ; f4
const SPRITE_OLIVINE_RIVAL ; f5
const SPRITE_AZALEA_ROCKET ; f6
const SPRITE_FUCHSIA_GYM_1 ; f7
const SPRITE_FUCHSIA_GYM_2 ; f8
const SPRITE_FUCHSIA_GYM_3 ; f9
const SPRITE_FUCHSIA_GYM_4 ; fa
const SPRITE_COPYCAT ; fb
const SPRITE_JANINE_IMPERSONATOR ; fc
; sprite types
const_value SET 1
const WALKING_SPRITE
const STANDING_SPRITE
const STILL_SPRITE
; sprite palettes
const_def
const PAL_OW_RED
const PAL_OW_BLUE
const PAL_OW_GREEN
const PAL_OW_BROWN
const PAL_OW_PINK
const PAL_OW_SILVER
const PAL_OW_TREE
const PAL_OW_ROCK
; sprite movements
const_def
const SPRITEMOVEFN_00
const SPRITEMOVEFN_01
const SPRITEMOVEFN_02
const SPRITEMOVEFN_03
const SPRITEMOVEFN_04
const SPRITEMOVEFN_05
const SPRITEMOVEFN_06
const SPRITEMOVEFN_07
const SPRITEMOVEFN_08
const SPRITEMOVEFN_09
const SPRITEMOVEFN_0A
const SPRITEMOVEFN_0B
const SPRITEMOVEFN_0C
const SPRITEMOVEFN_0D
const SPRITEMOVEFN_0E
const SPRITEMOVEFN_0F
const SPRITEMOVEFN_10
const SPRITEMOVEFN_11
const SPRITEMOVEFN_12
const SPRITEMOVEFN_13
const SPRITEMOVEFN_14
const SPRITEMOVEFN_15
const SPRITEMOVEFN_16
const SPRITEMOVEFN_17
const SPRITEMOVEFN_18
const SPRITEMOVEFN_19
const SPRITEMOVEFN_1A
const SPRITEMOVEFN_1B
const SPRITEMOVEFN_1C
const SPRITEMOVEFN_1D
const SPRITEMOVEFN_1E
const SPRITEMOVEFN_1F
const SPRITEMOVEFN_20
const SPRITEMOVEFN_21

View File

@ -0,0 +1,5 @@
LANDTILE EQU 0
WALLTILE EQU 1
WATRTILE EQU 15
TALK EQU 1 << 4

View File

@ -4,7 +4,7 @@ Pack: ; 10000
set 4, [hl]
call Function1068a
.loop
call Functiona57
call JoyTextDelay
ld a, [wcf63]
bit 7, a
jr nz, .done
@ -651,7 +651,7 @@ BattlePack: ; 10493
set 4, [hl]
call Function1068a
.asm_1049b
call Functiona57
call JoyTextDelay
ld a, [wcf63]
bit 7, a
jr nz, .asm_104ad

View File

@ -27,7 +27,7 @@ Pokedex: ; 40000
call DelayFrame
.main
call Functiona57
call JoyTextDelay
ld a, [wcf63]
bit 7, a
jr nz, .exit

View File

@ -141,7 +141,7 @@ SpecialBuenaPrize: ; 8afd4
call WriteBackup
ld hl, UnknownText_0x8b08b
call PrintText
call Functiona36
call JoyWaitAorB
call PlayClickSFX
ret
; 8b072

View File

@ -491,7 +491,7 @@ Function1656b: ; 1656b
Function16571: ; 16571
.loop
call Functiona57
call JoyTextDelay
ld hl, hJoyPressed
ld a, [hl]
and B_BUTTON

View File

@ -11,7 +11,7 @@ SEER_LEVEL_ONLY EQU 7
SpecialPokeSeer: ; 4f0bc
ld a, SEER_INTRO
call PrintSeerText
call Functiona36
call JoyWaitAorB
ld b, $6
callba SelectMonFromParty

View File

@ -151,7 +151,7 @@ endr
add hl, bc
call Function8aee9
call Function3200
call Functiona36
call JoyWaitAorB
call PlayClickSFX
call WriteBackup
ret

View File

@ -615,11 +615,11 @@ Function3246:: ; 3246
jr c, .wait
di
ld a, $1
ld a, 1 ; BANK(VTiles3)
ld [rVBK], a
hlcoord 0, 0, AttrMap
call Function327b
ld a, $0
ld a, 0 ; BANK(VTiles0)
ld [rVBK], a
hlcoord 0, 0
call Function327b
@ -639,7 +639,7 @@ Function3246:: ; 3246
Function327b:: ; 327b
ld [hSPBuffer], sp
ld sp, hl
ld a, [$ffd7]
ld a, [hBGMapAddress + 1]
ld h, a
ld l, 0
ld a, 18
@ -1188,7 +1188,7 @@ Function354b:: ; 354b
push af
ld a, $1
ld [hInMenu], a
call Functiona57
call JoyTextDelay
pop af
ld [hInMenu], a

View File

@ -211,6 +211,7 @@ endr
Request2bpp:: ; eba
; Load 2bpp at b:de to occupy c tiles of hl.
ld a, [hBGMapMode]
push af
xor a
@ -228,14 +229,14 @@ Request2bpp:: ; eba
ld [$ffd3], a
ld a, [InLinkBattle]
cp $4
jr nz, .asm_edc
jr nz, .okay
ld a, [$ffe9]
and a
jr nz, .asm_edc
jr nz, .okay
ld a, $6
ld [$ffd3], a
.asm_edc
.okay
ld a, e
ld [Requested2bppSource], a
ld a, d
@ -245,11 +246,11 @@ Request2bpp:: ; eba
ld a, h
ld [Requested2bppDest + 1], a
.asm_eec
.loop
ld a, c
ld hl, $ffd3
cp [hl]
jr nc, .asm_f08
jr nc, .iterate
ld [Requested2bpp], a
.wait
@ -268,19 +269,19 @@ Request2bpp:: ; eba
ld [hBGMapMode], a
ret
.asm_f08
.iterate
ld a, [$ffd3]
ld [Requested2bpp], a
.asm_f0d
.wait2
call DelayFrame
ld a, [Requested2bpp]
and a
jr nz, .asm_f0d
jr nz, .wait2
ld a, c
ld hl, $ffd3
sub [hl]
ld c, a
jr .asm_eec
jr .loop
; f1e
@ -302,14 +303,14 @@ Request1bpp:: ; f1e
ld [$ffd3], a
ld a, [InLinkBattle]
cp $4
jr nz, .asm_f40
jr nz, .NotMobile
ld a, [$ffe9]
and a
jr nz, .asm_f40
jr nz, .NotMobile
ld a, $6
ld [$ffd3], a
.asm_f40
.NotMobile
ld a, e
ld [Requested1bppSource], a
ld a, d
@ -318,11 +319,11 @@ Request1bpp:: ; f1e
ld [Requested1bppDest], a
ld a, h
ld [Requested1bppDest + 1], a
.asm_f50
.loop
ld a, c
ld hl, $ffd3
cp [hl]
jr nc, .asm_f6c
jr nc, .iterate
ld [Requested1bpp], a
.wait
@ -341,19 +342,21 @@ Request1bpp:: ; f1e
ld [hBGMapMode], a
ret
.asm_f6c
.iterate
ld a, [$ffd3]
ld [Requested1bpp], a
.asm_f71
.wait2
call DelayFrame
ld a, [Requested1bpp]
and a
jr nz, .asm_f71
jr nz, .wait2
ld a, c
ld hl, $ffd3
sub [hl]
ld c, a
jr .asm_f50
jr .loop
; f82

View File

@ -273,42 +273,44 @@ StopAutoInput:: ; a0a
; a1b
Functiona1b:: ; a1b
JoyTitleScreenInput:: ; a1b
.loop
call DelayFrame
push bc
call Functiona57
call JoyTextDelay
pop bc
ld a, [hJoyDown]
cp D_UP | SELECT | B_BUTTON
jr z, .asm_a34
jr z, .keycombo
ld a, [hJoyLast]
and START | A_BUTTON
jr nz, .asm_a34
jr nz, .keycombo
dec c
jr nz, Functiona1b
jr nz, .loop
and a
ret
.asm_a34
.keycombo
scf
ret
; a36
Functiona36:: ; a36
JoyWaitAorB:: ; a36
.loop
call DelayFrame
call GetJoypad
ld a, [hJoyPressed]
and A_BUTTON | B_BUTTON
ret nz
call RTC
jr Functiona36
jr .loop
; a46
CloseText:: ; a46
@ -317,13 +319,13 @@ CloseText:: ; a46
ld a, 1
ld [hOAMUpdate], a
call WaitBGMap
call Functiona36
call JoyWaitAorB
pop af
ld [hOAMUpdate], a
ret
; a57
Functiona57:: ; a57
JoyTextDelay:: ; a57
call GetJoypad
ld a, [hInMenu]
and a
@ -367,7 +369,7 @@ Functiona80:: ; a80
hlcoord 18, 17
call Functionb06
pop hl
call Functiona57
call JoyTextDelay
ld a, [hJoyLast]
and $3
jr z, .asm_a8d
@ -379,7 +381,7 @@ Functiona80:: ; a80
; aa5
Functionaa5:: ; aa5
call Functiona57
call JoyTextDelay
ld a, [hJoyLast]
and A_BUTTON | B_BUTTON
jr z, Functionaa5
@ -413,7 +415,7 @@ Functionac6:: ; ac6
callba Function1de28a
.asm_ad9
call Functionaf5
call Functiona57
call JoyTextDelay
ld a, [hJoyPressed]
and $3
jr nz, .asm_af1

View File

@ -2181,7 +2181,7 @@ Functionf3df: ; f3df (3:73df)
call Functionf1db
ld a, $f5
call Functionf24a
call Functiona36
call JoyWaitAorB
.asm_f413
ld a, b
inc a

843
main.asm

File diff suppressed because it is too large Load Diff

View File

@ -155,7 +155,7 @@ Function17a781: ; 17a781 (5e:6781)
push af
ld a, $1
ld [hInMenu], a
call Functiona57
call JoyTextDelay
pop af
ld [hInMenu], a
ret

View File

@ -194,7 +194,7 @@ Function8921f: ; 8921f (22:521f)
ret
Function89235: ; 89235 (22:5235)
call Functiona36
call JoyWaitAorB
call PlayClickSFX
ret
@ -3655,7 +3655,7 @@ Function8a78c: ; 8a78c (22:678c)
call InitName
call CloseSRAM
call DelayFrame
call Functiona57
call JoyTextDelay
call Function891de
call WhiteBGMap
call Function893cc
@ -3731,7 +3731,7 @@ Function8a818: ; 8a818 (22:6818)
ld de, .string_8a868
call PlaceString
call WaitBGMap
call Functiona36
call JoyWaitAorB
.asm_8a863
call CloseSRAM
scf
@ -3750,7 +3750,7 @@ Function8a818: ; 8a818 (22:6818)
hlcoord 1, 13
call PlaceString
call WaitBGMap
call Functiona36
call JoyWaitAorB
and a
ret
; 8a88b (22:688b)
@ -3805,7 +3805,7 @@ Function8a8c3: ; 8a8c3 (22:68c3)
ld de, String_8a926
call PlaceString
call WaitBGMap
call Functiona36
call JoyWaitAorB
.asm_8a90f
call Function89448
call Function891fe
@ -4057,7 +4057,7 @@ Function8aab6: ; 8aab6 (22:6ab6)
ld de, String_8aaf0
call PlaceString
call WaitBGMap
call Functiona36
call JoyWaitAorB
.asm_8aaeb
call CloseSRAM
scf

View File

@ -332,7 +332,7 @@ Function100232: ; 100232
pop de
call PlaceString
call Function100320
call Functiona36
call JoyWaitAorB
ret
; 10024d
@ -432,7 +432,7 @@ Function100301: ; 100301
callba Function10202c
callba Function115dd3
call Function100320
call Functiona36
call JoyWaitAorB
ret
; 100320
@ -4979,7 +4979,7 @@ Function102142: ; 102142
call MenuTextBox
ld de, SFX_LEVEL_UP
call PlaySFX
call Functiona36
call JoyWaitAorB
call ExitMenu
call Function10219f
ld hl, UnknownText_0x1021d6
@ -5022,7 +5022,7 @@ Function10219f: ; 10219f
call Function10218d
ld de, $c608 + 1
callba Function8ac4e
call Functiona36
call JoyWaitAorB
call PlayClickSFX
call Function1013aa
ret
@ -5056,7 +5056,7 @@ UnknownText_0x1021db: ; 1021d1
Function1021e0: ; 1021e0
call MenuTextBox
call Functiona36
call JoyWaitAorB
call ExitMenu
ret
; 1021ea
@ -7749,7 +7749,7 @@ Mobile_SelectThreeMons: ; 10366e
jr c, .asm_103696
callba Function8b1e1
jr nc, .asm_103690
call Functiona36
call JoyWaitAorB
jr .asm_103696
.asm_103690
@ -7772,7 +7772,7 @@ Mobile_SelectThreeMons: ; 10366e
call YesNoBox
jr c, .asm_1036b5
call Function1036f9
call Functiona36
call JoyWaitAorB
.asm_1036b5
call Function103700
@ -7794,7 +7794,7 @@ Mobile_SelectThreeMons: ; 10366e
.asm_1036d9
callba Function8b1e1
jr nc, .asm_1036e6
call Functiona36
call JoyWaitAorB
jr .asm_1036f4
.asm_1036e6
@ -7804,7 +7804,7 @@ Mobile_SelectThreeMons: ; 10366e
.asm_1036ec
call Function1036f9
call Functiona36
call JoyWaitAorB
jr .asm_1036b5
.asm_1036f4
@ -7859,7 +7859,7 @@ Function103700: ; 103700
.asm_10373c
ld hl, UnknownText_0x10377b
call PrintText
call Functiona36
call JoyWaitAorB
scf
ret
; 103747
@ -7981,10 +7981,10 @@ Function1037eb: ; 1037eb
jr nc, .asm_103807
ld hl, UnknownText_0x103819
call PrintText
call Functiona36
call JoyWaitAorB
ld hl, UnknownText_0x10381e
call PrintText
call Functiona36
call JoyWaitAorB
xor a
ld [ScriptVar], a
ret
@ -8042,7 +8042,7 @@ endr
ld [hl], a
ld hl, UnknownText_0x103876
call PrintText
call Functiona36
call JoyWaitAorB
callba Script_reloadmappart
callba Function4a94e
jr c, .asm_103870
@ -8074,7 +8074,7 @@ Function10387b: ; 10387b
ld [StringBuffer2], a
ld hl, UnknownText_0x103898
call PrintText
call Functiona36
call JoyWaitAorB
ret
; 103898

View File

@ -7716,7 +7716,7 @@ Function117699: ; 117699 (45:7699)
ret
Function1176ee: ; 1176ee (45:76ee)
call Functiona57
call JoyTextDelay
ld a, [wcd49]
bit 7, a
jr nz, .asm_117709
@ -8189,7 +8189,7 @@ Function117ab4: ; 0x117ab4
; 0x117acd
Function117acd: ; 0x117acd
call Functiona57
call JoyTextDelay
ld a, [wcf63]
bit 7, a
jr nz, .asm_117ae2 ; 0x117ad5 $b
@ -8493,7 +8493,7 @@ asm_11800b
ld a, $3
ld [rSVBK], a
.asm_118024
call Functiona57
call JoyTextDelay
call Function118473
ld a, [wcf66]
cp $1b
@ -8534,7 +8534,7 @@ Function11805f: ; 11805f
ld a, $3
ld [rSVBK], a
.asm_11807d
call Functiona57
call JoyTextDelay
call Function118473
ld a, [wcf66]
cp $1b
@ -8572,7 +8572,7 @@ Function1180b8: ; 1180b8
ld a, $3
ld [rSVBK], a
.asm_1180d1
call Functiona57
call JoyTextDelay
call Function118473
ld a, [wcf66]
cp $28
@ -8627,7 +8627,7 @@ Function118125: ; 118125
ld a, $3
ld [rSVBK], a
.asm_11813e
call Functiona57
call JoyTextDelay
call Function118473
ld a, [wcf66]
cp $f
@ -8712,7 +8712,7 @@ Function1181da: ; 1181da
ld a, $3
ld [rSVBK], a
.asm_1181f8
call Functiona57
call JoyTextDelay
call Function118473
ld a, [wcf66]
cp $28
@ -8750,7 +8750,7 @@ Function118233: ; 118233
ld a, $3
ld [rSVBK], a
.asm_11824c
call Functiona57
call JoyTextDelay
call Function118473
ld a, [wcf66]
cp $1e
@ -8787,7 +8787,7 @@ Function118284: ; 118284
ld a, $3
ld [rSVBK], a ; $ff00+$70
.asm_11829d
call Functiona57
call JoyTextDelay
call Function118473
ld a, [wcf66]
cp $20
@ -8824,7 +8824,7 @@ Function1182d5: ; 1182d5
ld a, $3
ld [rSVBK], a
.asm_1182ee
call Functiona57
call JoyTextDelay
call Function118473
ld a, [wcf66]
cp $1b
@ -8862,7 +8862,7 @@ Function118329: ; 118329
ld a, $3
ld [rSVBK], a
.asm_118342
call Functiona57
call JoyTextDelay
call Function118473
ld a, [wcf66]
cp $18
@ -8899,7 +8899,7 @@ Function11837a: ; 11837a
ld a, $3
ld [rSVBK], a
.asm_118393
call Functiona57
call JoyTextDelay
call Function118473
ld a, [wcf66]
cp $19
@ -14342,7 +14342,7 @@ Function11ac51: ; 11ac51
call Function11ad1b
call DelayFrame
.asm_11ac82
call Functiona57
call JoyTextDelay
ld a, [wcf63]
bit 7, a
jr nz, .asm_11aca8
@ -16935,7 +16935,7 @@ Function11c277: ; 11c277 (47:4277)
Function11c283: ; 11c283
.asm_11c283
call Functiona57
call JoyTextDelay
ld a, [hJoyPressed]
ld [hJoypadPressed], a
ld a, [wcf63]
@ -22187,7 +22187,7 @@ Function16d43b: ; 16d43b
call GetSGBLayout
call Function32f9
call WaitBGMap
call Functiona36
call JoyWaitAorB
call Function1d7d
ret
; 16d465
@ -22518,7 +22518,7 @@ Function16d7e7: ; 16d7e7
callba Function8cf62
.asm_16d7f4
call Functiona57
call JoyTextDelay
call Function16d713
and a
ret z
@ -23228,7 +23228,7 @@ Function1704f1: ; 1704f1
call ClearSprites
call ClearScreen
.asm_1704fa
call Functiona57
call JoyTextDelay
ld a, [wcf63]
bit 7, a
jr nz, .asm_17050f
@ -24539,7 +24539,7 @@ Function1719ed: ; 1719ed (5c:59ed)
ret
Function171a11: ; 171a11 (5c:5a11)
call Functiona57
call JoyTextDelay
ld a, [wcd49]
bit 7, a
jr nz, .asm_171a2c

View File

@ -714,7 +714,7 @@ Function17d405:
Function17d45a: ; 17d45a
.asm_17d45a
call Functiona57
call JoyTextDelay
ld a, [wcd77]
bit 7, a
jr nz, .asm_17d46f
@ -3144,7 +3144,7 @@ Function17e3f0: ; 17e3f0
call Function17e415
call Function17e41e
.asm_17e3f6
call Functiona57
call JoyTextDelay
ld hl, hJoyPressed
ld a, [hl]
and $1
@ -4678,7 +4678,7 @@ Function17f53d: ; 17f53d
Function17f555: ; 17f555
.asm_17f555
call Functiona57
call JoyTextDelay
call Function17f5ae
ld a, [wc303]
bit 7, a

View File

@ -546,7 +546,7 @@ UnusedTitleFG_OAM: ; 10ecb1
Function10ed51: ; 10ed51
call _TitleScreen
.loop
call Functiona57
call JoyTextDelay
ld a, [hJoyLast]
ld b, a
and 1

View File

@ -1,5 +1,5 @@
SECTION "Scratch", SRAM, BANK [0]
SRAM_Begin::
sScratch::
@ -49,6 +49,8 @@ sBackupGameDataEnd::
sBackupChecksum:: ds 2
s0_bf0f:: ds 1
sStackTop:: ds 2
ds $ee
SRAM_End::
SECTION "SRAM Bank 1", SRAM, BANK [1]

13
vram.asm Normal file
View File

@ -0,0 +1,13 @@
SECTION "VRAM0", VRAM, BANK [0]
VTiles0:: ds $800
VTiles1:: ds $800
VTiles2:: ds $800
VBGMap0:: ds $400
VBGMap1:: ds $400
SECTION "VRAM1", VRAM, BANK [1]
VTiles3:: ds $800
VTiles4:: ds $800
VTiles5:: ds $800
VBGMap2:: ds $400
VBGMap3:: ds $400

View File

@ -130,18 +130,7 @@ channel_struct: MACRO
ds 1 ; c132
ENDM
SECTION "CHR0", VRAM [$8000], BANK [0]
VTiles0::
SECTION "CHR1", VRAM [$8800], BANK [0]
VTiles1::
SECTION "CHR2", VRAM [$9000], BANK [0]
VTiles2::
SECTION "BG0", VRAM [$9800], BANK [0]
VBGMap0::
SECTION "BG1", VRAM [$9C00], BANK [0]
VBGMap1::
INCLUDE "vram.asm"
SECTION "Stack", WRAM0
wc000::
@ -1191,14 +1180,18 @@ CurSpecies:: ; cf60
ds 1
wcf61:: ds 2
wIntroSceneIndex::
wcf63:: ds 1
wNrOfBeatenBattleTowerTrainers::
wMomBankDigitCursorPosition::
wIntroSceneFrameCounter::
wcf64:: ds 1
IF !DEF(CRYSTAL11)
wPokedexStatus::
ENDC
wTitleScreenTimerLo::
wcf65:: ds 1
wTitleScreenTimerHi::
wcf66:: ds 1
Requested2bpp:: ; cf67