Use a predef macro that takes labels instead of juggling constants.

Besides making predefs convenient, naming a predef no longer requires
adding or renaming a predef constant. This also lets predefs be rearranged at will.
This commit is contained in:
yenatch 2014-06-16 11:20:01 -07:00
parent 0b7dfeb9b2
commit 8639fcd29b
15 changed files with 325 additions and 555 deletions

View File

@ -643,8 +643,7 @@ asm_38436: ; 38436 (e:4436)
xor a xor a
ld [$d10a], a ld [$d10a], a
call Function3839a call Function3839a
ld a, $b predef Functionc6e0
call Predef
jp Function38387 jp Function38387

View File

@ -1336,8 +1336,7 @@ AIScoring_Encore: ; 38c3b
push hl push hl
ld a, [wEnemyMoveStruct + MOVE_TYPE] ld a, [wEnemyMoveStruct + MOVE_TYPE]
ld hl, EnemyMonType1 ld hl, EnemyMonType1
ld a, $41 predef Function347d3
call Predef
pop hl pop hl
ld a, [$d265] ld a, [$d265]

View File

@ -954,22 +954,18 @@ BattleAnimCmd_DC: ; cc5dc (33:45dc)
ld a, [TempBattleMonSpecies] ; $d205 ld a, [TempBattleMonSpecies] ; $d205
ld [CurPartySpecies], a ; $d108 ld [CurPartySpecies], a ; $d108
ld hl, BattleMonDVs ; $c632 ld hl, BattleMonDVs ; $c632
ld a, PREDEF_GET_UNOWN_LETTER predef GetUnownLetter
call Predef
ld de, $8000 ld de, $8000
ld a, $3c predef Function51077
call Predef
jr .done jr .done
.player .player
ld a, [TempEnemyMonSpecies] ; $d204 ld a, [TempEnemyMonSpecies] ; $d204
ld [CurPartySpecies], a ; $d108 ld [CurPartySpecies], a ; $d108
ld hl, EnemyMonDVs ; $d20c ld hl, EnemyMonDVs ; $d20c
ld a, PREDEF_GET_UNOWN_LETTER predef GetUnownLetter
call Predef
ld de, $8000 ld de, $8000
ld a, $3d predef Function5116c
call Predef
.done .done
pop af pop af
@ -1194,20 +1190,16 @@ BattleAnimCmd_E6: ; cc776 (33:4776)
jr z, .player jr z, .player
ld hl, BattleMonDVs ; $c632 ld hl, BattleMonDVs ; $c632
ld a, PREDEF_GET_UNOWN_LETTER predef GetUnownLetter
call Predef
ld de, $9000 ld de, $9000
ld a, $3c predef Function51077
call Predef
jr .done jr .done
.player .player
ld hl, EnemyMonDVs ; $d20c ld hl, EnemyMonDVs ; $d20c
ld a, PREDEF_GET_UNOWN_LETTER predef GetUnownLetter
call Predef
ld de, $9310 ld de, $9310
ld a, $3d predef Function5116c
call Predef
.done .done
pop af pop af

View File

@ -1311,8 +1311,7 @@ Function3c874: ; 3c874
xor a xor a
ld [$cfca], a ld [$cfca], a
ld [FXAnimIDHi], a ld [FXAnimIDHi], a
ld a, $37 predef PlayBattleAnim
call Predef
call SwitchTurnCore call SwitchTurnCore
.asm_3c8d3 .asm_3c8d3
@ -2078,8 +2077,7 @@ Function3cd3c: ; 3cd3c
.asm_3cd4a .asm_3cd4a
push bc push bc
ld [$d10a], a ld [$d10a], a
ld a, $b predef Functionc6e0
call Predef
pop bc pop bc
ret ret
; 3cd55 ; 3cd55
@ -2461,8 +2459,7 @@ Function3cfa4: ; 3cfa4
ld a, [BattleType] ld a, [BattleType]
cp BATTLETYPE_CANLOSE cp BATTLETYPE_CANLOSE
jr nz, .asm_3cfe8 jr nz, .asm_3cfe8
ld a, $2 predef Functionc658
call Predef
.asm_3cfe8 .asm_3cfe8
ld a, [$c2cc] ld a, [$c2cc]
@ -2791,8 +2788,7 @@ Function3d1aa: ; 3d1aa
ld c, a ld c, a
ld hl, $c664 ld hl, $c664
ld b, $0 ld b, $0
ld a, $3 predef FlagPredef
call Predef
ld hl, EnemySubStatus3 ld hl, EnemySubStatus3
res 2, [hl] res 2, [hl]
xor a xor a
@ -3379,12 +3375,10 @@ Function3d581: ; 3d581
ld hl, $c664 ld hl, $c664
ld b, $1 ld b, $1
push bc push bc
ld a, $3 predef FlagPredef
call Predef
pop bc pop bc
ld hl, $c6fc ld hl, $c6fc
ld a, $3 predef_jump FlagPredef
jp Predef
; 3d599 ; 3d599
Function3d599: ; 3d599 Function3d599: ; 3d599
@ -3599,8 +3593,7 @@ Function3d6ca: ; 3d6ca
and a and a
jr nz, .asm_3d708 jr nz, .asm_3d708
ld hl, EnemyMonDVs ld hl, EnemyMonDVs
ld a, PREDEF_GET_UNOWN_LETTER predef GetUnownLetter
call Predef
ld a, [UnownLetter] ld a, [UnownLetter]
ld [$def4], a ld [$def4], a
@ -3710,8 +3703,7 @@ Function3d7c7: ; 3d7c7
call GetBaseData call GetBaseData
ld a, $1 ld a, $1
ld [MonType], a ld [MonType], a
ld a, $1f predef Function5084a
call Predef
call Function3f47c call Function3f47c
xor a xor a
ld [$cfca], a ld [$cfca], a
@ -3735,8 +3727,7 @@ Function3d7c7: ; 3d7c7
hlcoord 12, 0 hlcoord 12, 0
ld d, $0 ld d, $0
ld e, $0 ld e, $0
ld a, $47 predef Functiond008e
call Predef
jr .asm_3d82c jr .asm_3d82c
.asm_3d821 .asm_3d821
@ -4192,8 +4183,7 @@ Function3db32: ; 3db32
Function3db5f: ; 3db5f Function3db5f: ; 3db5f
ld hl, BattleMonDVs ld hl, BattleMonDVs
ld a, PREDEF_GET_UNOWN_LETTER predef GetUnownLetter
call Predef
hlcoord 1, 5 hlcoord 1, 5
ld b, 7 ld b, 7
ld c, 8 ld c, 8
@ -4376,8 +4366,7 @@ Function3dc5b: ; 3dc5b
ld c, a ld c, a
ld hl, $c664 ld hl, $c664
ld b, $0 ld b, $0
ld a, $3 predef FlagPredef
call Predef
call Function3d43b call Function3d43b
ld hl, BattleText_0x80a75 ld hl, BattleText_0x80a75
jr .asm_3dcdf jr .asm_3dcdf
@ -4523,8 +4512,7 @@ Function3dd2f: ; 3dd2f
.asm_3dda4 .asm_3dda4
ld [$d10a], a ld [$d10a], a
ld a, $b predef Functionc6e0
call Predef
Function3ddac: Function3ddac:
call RefreshBattleHuds call RefreshBattleHuds
callab GetOpponentItem callab GetOpponentItem
@ -4548,8 +4536,7 @@ Function3ddc8: ; 3ddc8
xor a xor a
ld [$cfca], a ld [$cfca], a
ld [FXAnimIDHi], a ld [FXAnimIDHi], a
ld a, $37 predef PlayBattleAnim
call Predef
call SwitchTurnCore call SwitchTurnCore
pop bc pop bc
pop de pop de
@ -4815,8 +4802,7 @@ DrawPlayerHUD: ; 3df58
ld b, OTPARTYMON ld b, OTPARTYMON
xor a xor a
ld [MonType], a ld [MonType], a
ld a, PREDEF_DRAW_PLAYER_HP predef DrawPlayerHP
call Predef
; Exp bar ; Exp bar
push de push de
@ -4912,8 +4898,7 @@ PrintPlayerHUD: ; 3dfbf
push af push af
push hl push hl
ld de, BattleMonStatus ld de, BattleMonStatus
ld a, $21 predef Function50d2e
call Predef
pop hl pop hl
pop bc pop bc
ret nz ret nz
@ -4986,8 +4971,7 @@ Function3e043: ; 3e043
push af push af
push hl push hl
ld de, EnemyMonStatus ld de, EnemyMonStatus
ld a, $21 predef Function50d2e
call Predef
pop hl pop hl
pop bc pop bc
jr nz, .asm_3e0be jr nz, .asm_3e0be
@ -5593,8 +5577,7 @@ Function3e4bc: ; 3e4bc
.asm_3e513 .asm_3e513
ld a, SCREEN_WIDTH ld a, SCREEN_WIDTH
ld [Buffer1], a ld [Buffer1], a
ld a, PREDEF_LIST_MOVES predef ListMoves
call Predef
ld b, 5 ld b, 5
ld a, [$d235] ld a, [$d235]
@ -5921,8 +5904,7 @@ MoveInfoBox: ; 3e6c8
ld a, [wPlayerMoveStruct + MOVE_ANIM] ld a, [wPlayerMoveStruct + MOVE_ANIM]
ld b, a ld b, a
hlcoord 2, 10 hlcoord 2, 10
ld a, PREDEF_PRINT_MOVE_TYPE predef PrintMoveType
call Predef
.done .done
ret ret
@ -6387,8 +6369,7 @@ LoadEnemyMon: ; 3e8eb
; Get letter based on DVs ; Get letter based on DVs
ld hl, EnemyMonDVs ld hl, EnemyMonDVs
ld a, PREDEF_GET_UNOWN_LETTER predef GetUnownLetter
call Predef
; Can't use any letters that haven't been unlocked ; Can't use any letters that haven't been unlocked
; If combined with forced shiny battletype, causes an infinite loop ; If combined with forced shiny battletype, causes an infinite loop
call CheckUnownLetter call CheckUnownLetter
@ -6469,8 +6450,7 @@ LoadEnemyMon: ; 3e8eb
ld de, EnemyMonMaxHP ld de, EnemyMonMaxHP
ld b, $00 ld b, $00
ld hl, $d201 ; ? ld hl, $d201 ; ?
ld a, PREDEF_FILLSTATS predef Functione167
call Predef
; If we're in a trainer battle, ; If we're in a trainer battle,
; get the rest of the parameters from the party struct ; get the rest of the parameters from the party struct
@ -6588,8 +6568,7 @@ LoadEnemyMon: ; 3e8eb
; Make sure the predef knows this isn't a partymon ; Make sure the predef knows this isn't a partymon
ld [MagikarpLength], a ld [MagikarpLength], a
; Fill moves based on level ; Fill moves based on level
ld a, PREDEF_FILLMOVES predef FillMoves
call Predef
.PP .PP
; Trainer battle? ; Trainer battle?
@ -6600,8 +6579,7 @@ LoadEnemyMon: ; 3e8eb
; Fill wild PP ; Fill wild PP
ld hl, EnemyMonMoves ld hl, EnemyMonMoves
ld de, EnemyMonPP ld de, EnemyMonPP
ld a, PREDEF_FILLPP predef FillPP
call Predef
jr .Finish jr .Finish
.TrainerPP .TrainerPP
@ -6654,8 +6632,7 @@ LoadEnemyMon: ; 3e8eb
ld c, a ld c, a
ld b, 1 ; set ld b, 1 ; set
ld hl, PokedexSeen ld hl, PokedexSeen
ld a, PREDEF_FLAG predef FlagPredef
call Predef
ld hl, EnemyMonStats ld hl, EnemyMonStats
ld de, EnemyStats ld de, EnemyStats
@ -7294,8 +7271,7 @@ Function3ee17: ; 3ee17
ld a, d ld a, d
ld [FXAnimIDHi], a ld [FXAnimIDHi], a
call WaitBGMap call WaitBGMap
ld a, $37 predef_jump PlayBattleAnim
jp Predef
; 3ee27 ; 3ee27
Function3ee27: ; 3ee27 Function3ee27: ; 3ee27
@ -7340,8 +7316,7 @@ Function3ee3b: ; 3ee3b
ld c, a ld c, a
ld b, $2 ld b, $2
ld d, $0 ld d, $0
ld a, $3 predef FlagPredef
call Predef
ld a, c ld a, c
and a and a
pop bc pop bc
@ -7514,8 +7489,7 @@ Function3ee3b: ; 3ee3b
.asm_3ef74 .asm_3ef74
xor a xor a
ld [MonType], a ld [MonType], a
ld a, $1f predef Function5084a
call Predef
callab Function50e1b callab Function50e1b
pop bc pop bc
ld hl, PartyMon1Level - PartyMon1 ld hl, PartyMon1Level - PartyMon1
@ -7551,8 +7525,7 @@ Function3ee3b: ; 3ee3b
add hl, bc add hl, bc
push bc push bc
ld b, $1 ld b, $1
ld a, $c predef Functione167
call Predef
pop bc pop bc
pop de pop de
ld hl, $0025 ld hl, $0025
@ -7628,16 +7601,14 @@ Function3ee3b: ; 3ee3b
.asm_3f057 .asm_3f057
xor a xor a
ld [MonType], a ld [MonType], a
ld a, $1f predef Function5084a
call Predef
hlcoord 9, 0 hlcoord 9, 0
ld b, $a ld b, $a
ld c, $9 ld c, $9
call TextBox call TextBox
hlcoord 11, 1 hlcoord 11, 1
ld bc, $0004 ld bc, $0004
ld a, $28 predef Function50b7b
call Predef
ld c, $1e ld c, $1e
call DelayFrames call DelayFrames
call Functiona80 call Functiona80
@ -7657,8 +7628,7 @@ Function3ee3b: ; 3ee3b
ld a, b ld a, b
ld [CurPartyLevel], a ld [CurPartyLevel], a
push bc push bc
ld a, $1a predef LearnLevelMoves
call Predef
pop bc pop bc
ld a, b ld a, b
cp c cp c
@ -7669,8 +7639,7 @@ Function3ee3b: ; 3ee3b
ld a, [CurPartyMon] ld a, [CurPartyMon]
ld c, a ld c, a
ld b, $1 ld b, $1
ld a, $3 predef FlagPredef
call Predef
pop af pop af
ld [CurPartyLevel], a ld [CurPartyLevel], a
@ -7787,8 +7756,7 @@ Function3f136: ; 3f136
ld [DefaultFlypoint], a ld [DefaultFlypoint], a
xor a xor a
ld [MonType], a ld [MonType], a
ld a, $1f predef Function5084a
call Predef
ld a, [TempMonLevel] ld a, [TempMonLevel]
ld b, a ld b, a
ld e, a ld e, a
@ -8312,11 +8280,9 @@ Function3f447: ; 3f447
ld a, [BattleMonSpecies] ld a, [BattleMonSpecies]
ld [CurPartySpecies], a ld [CurPartySpecies], a
ld hl, BattleMonDVs ld hl, BattleMonDVs
ld a, PREDEF_GET_UNOWN_LETTER predef GetUnownLetter
call Predef
ld de, $9310 ld de, $9310
ld a, $3d predef Function5116c
call Predef
pop af pop af
ld [CurPartySpecies], a ld [CurPartySpecies], a
ret ret
@ -8351,11 +8317,9 @@ Function3f486: ; 3f486
ld [CurPartySpecies], a ld [CurPartySpecies], a
call GetBaseData call GetBaseData
ld hl, EnemyMonDVs ld hl, EnemyMonDVs
ld a, PREDEF_GET_UNOWN_LETTER predef GetUnownLetter
call Predef
ld de, VTiles2 ld de, VTiles2
ld a, $3e predef Function5108b
call Predef
pop af pop af
ld [CurPartySpecies], a ld [CurPartySpecies], a
ret ret
@ -8502,8 +8466,7 @@ Function3f594: ; 3f594
ld [$c6e6], a ld [$c6e6], a
hlcoord 12, 0 hlcoord 12, 0
lb bc, 7, 7 lb bc, 7, 7
ld a, PREDEF_FILL_BOX predef FillBox
call Predef
ld a, $ff ld a, $ff
ld [CurOTMon], a ld [CurOTMon], a
ld a, TRAINER_BATTLE ld a, TRAINER_BATTLE
@ -8549,8 +8512,7 @@ Function3f607: ; 3f607
ld bc, NUM_MOVES ld bc, NUM_MOVES
call CopyBytes call CopyBytes
ld hl, EnemyMonDVs ld hl, EnemyMonDVs
ld a, PREDEF_GET_UNOWN_LETTER predef GetUnownLetter
call Predef
ld a, [CurPartySpecies] ld a, [CurPartySpecies]
cp UNOWN cp UNOWN
jr nz, .asm_3f648 jr nz, .asm_3f648
@ -8562,15 +8524,13 @@ Function3f607: ; 3f607
.asm_3f648 .asm_3f648
ld de, VTiles2 ld de, VTiles2
ld a, $3e predef Function5108b
call Predef
xor a xor a
ld [TrainerClass], a ld [TrainerClass], a
ld [$ffad], a ld [$ffad], a
hlcoord 12, 0 hlcoord 12, 0
lb bc, 7, 7 lb bc, 7, 7
ld a, PREDEF_FILL_BOX predef FillBox
call Predef
ret ret
; 3f662 ; 3f662
@ -8650,8 +8610,7 @@ Function3f6a5: ; 3f6a5
call Function3f71d call Function3f71d
xor a xor a
ld [$d1e9], a ld [$d1e9], a
ld a, $1c predef Function421e6
call Predef
callba Function2ed44 callba Function2ed44
ret ret
; 3f6d0 ; 3f6d0
@ -9325,8 +9284,7 @@ Function3fb6c: ; 3fb6c
ld [$ffad], a ld [$ffad], a
hlcoord 2, 6 hlcoord 2, 6
ld bc, $0606 ld bc, $0606
ld a, $13 predef FillBox
call Predef
xor a xor a
ld [hWY], a ld [hWY], a
ld [rWY], a ld [rWY], a
@ -9397,8 +9355,7 @@ GetBattleBackpic: ; 3fbff
.Decompress .Decompress
ld de, $9310 ld de, $9310
ld c, $31 ld c, $31
ld a, PREDEF_DECOMPRESS predef DecompressPredef
call Predef
ret ret
; 3fc30 ; 3fc30
@ -9421,8 +9378,7 @@ Function3fc30: ; 3fc30
ld [$ffad], a ld [$ffad], a
hlcoord 2, 6 hlcoord 2, 6
ld bc, $0606 ld bc, $0606
ld a, $13 predef FillBox
call Predef
ret ret
; 3fc5b ; 3fc5b
@ -9503,8 +9459,7 @@ BattleStartMessage: ; 3fc8b
hlcoord 12, 0 hlcoord 12, 0
ld d, $0 ld d, $0
ld e, $1 ld e, $1
ld a, $47 predef Functiond008e
call Predef
jr .asm_3fceb jr .asm_3fceb
.asm_3fce0 .asm_3fce0

View File

@ -3227,8 +3227,7 @@ BattleCommand11: ; 351c0
ld [$d1ef], a ld [$d1ef], a
ld h, b ld h, b
ld l, c ld l, c
ld a, $b predef Functionc6e0
call Predef
call RefreshBattleHuds call RefreshBattleHuds
call SwitchTurn call SwitchTurn
@ -4607,8 +4606,7 @@ BattleCommand42: ; 35926
ld a, $1 ld a, $1
ld [$d10a], a ld [$d10a], a
hlcoord 10, 9 hlcoord 10, 9
ld a, $b predef Functionc6e0
call Predef
ld hl, EnemyMonHP ld hl, EnemyMonHP
ld a, [hli] ld a, [hli]
ld [$d1ed], a ld [$d1ed], a
@ -4623,8 +4621,7 @@ BattleCommand42: ; 35926
ld [$d10a], a ld [$d10a], a
call ResetDamage call ResetDamage
hlcoord 2, 2 hlcoord 2, 2
ld a, $b predef Functionc6e0
call Predef
callba Function178000 callba Function178000
ld hl, SharedPainText ld hl, SharedPainText
@ -4767,8 +4764,7 @@ BattleCommand44: ; 359e6
ld a, [hl] ld a, [hl]
ld [$d265], a ld [$d265], a
ld a, $29 predef GetTypeName
call Predef
ld hl, TransformedTypeText ld hl, TransformedTypeText
jp StdBattleTextBox jp StdBattleTextBox
@ -5341,8 +5337,7 @@ Function35d1c: ; 35d1c
hlcoord 2, 2 hlcoord 2, 2
xor a xor a
ld [$d10a], a ld [$d10a], a
ld a, $b predef Functionc6e0
call Predef
.asm_35d7b .asm_35d7b
jp RefreshBattleHuds jp RefreshBattleHuds
; 35d7e ; 35d7e
@ -5401,8 +5396,7 @@ Function35d7e: ; 35d7e
hlcoord 10, 9 hlcoord 10, 9
ld a, $1 ld a, $1
ld [$d10a], a ld [$d10a], a
ld a, $b predef Functionc6e0
call Predef
.asm_35ddd .asm_35ddd
jp RefreshBattleHuds jp RefreshBattleHuds
; 35de0 ; 35de0
@ -5850,8 +5844,7 @@ Function36011: ; 36011
xor a xor a
.asm_3607e .asm_3607e
ld [$d10a], a ld [$d10a], a
ld a, $b predef Functionc6e0
call Predef
call RefreshBattleHuds call RefreshBattleHuds
jp UpdateBattleMonInParty jp UpdateBattleMonInParty
; 3608c ; 3608c
@ -8001,8 +7994,7 @@ BattleCommand27: ; 36cb2
xor a xor a
.asm_36d0c .asm_36d0c
ld [$d10a], a ld [$d10a], a
ld a, $b predef Functionc6e0
call Predef
call RefreshBattleHuds call RefreshBattleHuds
ld hl, RecoilText ld hl, RecoilText
jp StdBattleTextBox jp StdBattleTextBox

View File

@ -21,35 +21,6 @@ MONS_PER_BOX EQU 20
NUM_BOXES EQU 14 NUM_BOXES EQU 14
; predefs
PREDEF_LEARN_MOVE EQU $00
PREDEF_FLAG EQU $03
PREDEF_FILLPP EQU $05
PREDEF_ADDPARTYMON EQU $06
PREDEF_FILLSTATS EQU $0C
PREDEF_PRINT_MOVE_DESCRIPTION EQU $11
PREDEF_UPDATE_PLAYER_HUD EQU $12
PREDEF_FILL_BOX EQU $13
PREDEF_UPDATE_ENEMY_HUD EQU $15
PREDEF_START_BATTLE EQU $16
PREDEF_FILL_IN_EXP_BAR EQU $17
PREDEF_FILLMOVES EQU $1B
PREDEF_LIST_MOVES EQU $20
PREDEF_GET_GENDER EQU $24
PREDEF_STATS_SCREEN EQU $25
PREDEF_DRAW_PLAYER_HP EQU $26
PREDEF_DRAW_ENEMY_HP EQU $27
PREDEF_GET_TYPE_NAME EQU $29
PREDEF_PRINT_MOVE_TYPE EQU $2A
PREDEF_PRINT_TYPE EQU $2B
PREDEF_GET_UNOWN_LETTER EQU $2D
PREDEF_LOAD_SGB_LAYOUT EQU $31
PREDEF_CHECK_CONTEST_MON EQU $33
PREDEF_BATTLE_TRANSITION EQU $34
PREDEF_PARTYMON_ITEM_NAME EQU $3B
PREDEF_DECOMPRESS EQU $40
; flag manipulation ; flag manipulation
RESET_FLAG EQU 0 RESET_FLAG EQU 0
SET_FLAG EQU 1 SET_FLAG EQU 1

View File

@ -1531,8 +1531,7 @@ Script_startbattle: ; 0x97436
; script command 0x5f ; script command 0x5f
call Function2879 call Function2879
ld a, PREDEF_START_BATTLE predef StartBattle
call Predef
ld a, [$d0ee] ld a, [$d0ee]
and $3f and $3f
ld [ScriptVar], a ld [ScriptVar], a

View File

@ -1007,8 +1007,7 @@ Functiond066e: ; d066e
push bc push bc
push hl push hl
ld de, VTiles2 ld de, VTiles2
ld a, $3e predef Function5108b
call Predef
pop hl pop hl
pop bc pop bc
ld d, $0 ld d, $0

View File

@ -753,15 +753,14 @@ GetSGBLayout:: ; 3340
ld a, [hCGB] ld a, [hCGB]
and a and a
jr nz, .dosgb jr nz, .sgb
ld a, [hSGB] ld a, [hSGB]
and a and a
ret z ret z
.dosgb .sgb
ld a, $31 ; LoadSGBLayout predef_jump Function864c ; LoadSGBLayout
jp Predef
; 334e ; 334e
@ -1700,14 +1699,12 @@ Function378b:: ; 378b
jr c, .asm_37ad jr c, .asm_37ad
push hl push hl
ld de, VTiles2 ld de, VTiles2
ld a, $3c predef Function51077
call Predef
pop hl pop hl
xor a xor a
ld [$ffad], a ld [$ffad], a
ld bc, $0707 ld bc, $0707
ld a, $13 predef FillBox
call Predef
xor a xor a
ld [$c2c6], a ld [$c2c6], a
ret ret

View File

@ -167,8 +167,7 @@ Init:: ; 17d
call DelayFrame call DelayFrame
ld a, $30 predef Function9853
call Predef
call SoundRestart call SoundRestart
xor a xor a

View File

@ -31,8 +31,7 @@ CheckSeenMon:: ; 339b
PokedexFlagAction:: ; 33a1 PokedexFlagAction:: ; 33a1
ld d, 0 ld d, 0
ld a, PREDEF_FLAG predef FlagPredef
call Predef
ld a, c ld a, c
and a and a
ret ret

View File

@ -8,8 +8,7 @@ GetItemDescription: ; 0x1c8955
pop hl pop hl
ld a, [$d265] ld a, [$d265]
ld [$cf60], a ld [$cf60], a
ld a, $11 predef PrintMoveDesc
call Predef
ret ret
.nomovedesc .nomovedesc

View File

@ -399,8 +399,7 @@ ParkBall: ; e8a2
ld [hBattleTurn], a ld [hBattleTurn], a
ld [Buffer2], a ld [Buffer2], a
ld [$cfca], a ld [$cfca], a
ld a, $37 predef PlayBattleAnim
call Predef
ld a, [$c64e] ld a, [$c64e]
and a and a
@ -525,8 +524,7 @@ ParkBall: ; e8a2
ld a, [EnemyMonSpecies] ld a, [EnemyMonSpecies]
ld [$d265], a ld [$d265], a
ld a, $43 predef Functionfb877
call Predef
.asm_eab7 .asm_eab7
ld a, [BattleType] ld a, [BattleType]
@ -546,8 +544,7 @@ ParkBall: ; e8a2
ld [MonType], a ld [MonType], a
call ClearSprites call ClearSprites
ld a, $6 predef Functiond88c
call Predef
callba Function4db49 callba Function4db49
@ -604,8 +601,7 @@ ParkBall: ; e8a2
.asm_eb3c .asm_eb3c
call ClearSprites call ClearSprites
ld a, $9 predef Functionde6e
call Predef
callba Function4db83 callba Function4db83
@ -1265,8 +1261,7 @@ Functionee8c: ; ee8c
ld a, PartyMon1HPExp - 1 - PartyMon1 ld a, PartyMon1HPExp - 1 - PartyMon1
call GetPartyParamLocation call GetPartyParamLocation
ld b, $1 ld b, $1
ld a, $c predef_jump Functione167
jp Predef
; ee9f ; ee9f
Functionee9f: ; ee9f Functionee9f: ; ee9f
@ -1405,8 +1400,7 @@ RareCandy: ; ef14
xor a xor a
ld [MonType], a ld [MonType], a
ld a, $1f predef Function5084a
call Predef
hlcoord 9, 0 hlcoord 9, 0
ld b, 10 ld b, 10
@ -1415,8 +1409,7 @@ RareCandy: ; ef14
hlcoord 11, 1 hlcoord 11, 1
ld bc, $0004 ld bc, $0004
ld a, $28 predef Function50b7b
call Predef
call Functiona80 call Functiona80
@ -1424,8 +1417,7 @@ RareCandy: ; ef14
ld [MonType], a ld [MonType], a
ld a, [CurPartySpecies] ld a, [CurPartySpecies]
ld [$d265], a ld [$d265], a
ld a, $1a predef LearnLevelMoves
call Predef
xor a xor a
ld [$d1e9], a ld [$d1e9], a
@ -1654,8 +1646,7 @@ Functionf0d6: ; f0d6
ld d, 0 ld d, 0
ld hl, $c6fc ld hl, $c6fc
ld b, CHECK_FLAG ld b, CHECK_FLAG
ld a, PREDEF_FLAG predef FlagPredef
call Predef
ld a, c ld a, c
and a and a
jr z, .asm_f104 jr z, .asm_f104
@ -1664,8 +1655,7 @@ Functionf0d6: ; f0d6
ld c, a ld c, a
ld hl, $c664 ld hl, $c664
ld b, SET_FLAG ld b, SET_FLAG
ld a, PREDEF_FLAG predef FlagPredef
call Predef
.asm_f104 .asm_f104
xor a xor a
@ -1834,8 +1824,7 @@ Functionf1db: ; f1db (3:71db)
call AddNTimes call AddNTimes
ld a, $2 ld a, $2
ld [$d10a], a ld [$d10a], a
ld a, $b predef_jump Functionc6e0
jp Predef
; known jump sources: ee11 (3:6e11), ee3f (3:6e3f), ef16 (3:6f16), efaf (3:6faf), efce (3:6fce), f0ab (3:70ab), f0ca (3:70ca), f12a (3:712a), f1ab (3:71ab), f5c7 (3:75c7) ; known jump sources: ee11 (3:6e11), ee3f (3:6e3f), ef16 (3:6f16), efaf (3:6faf), efce (3:6fce), f0ab (3:70ab), f0ca (3:70ca), f12a (3:712a), f1ab (3:71ab), f5c7 (3:75c7)
Functionf1f9: ; f1f9 (3:71f9) Functionf1f9: ; f1f9 (3:71f9)
@ -2971,8 +2960,7 @@ Functionf7a0: ; f7a0
ld [$c689], a ld [$c689], a
ld [hBattleTurn], a ld [hBattleTurn], a
ld [$cfca], a ld [$cfca], a
ld a, $37 predef PlayBattleAnim
call Predef
ld hl, BlockedTheBallText ld hl, BlockedTheBallText
call PrintText call PrintText
ld hl, DontBeAThiefText ld hl, DontBeAThiefText
@ -3119,8 +3107,7 @@ Functionf84c: ; f84c
call GetPartyParamLocation call GetPartyParamLocation
push hl push hl
ld de, Buffer1 ld de, Buffer1
ld a, PREDEF_FILLPP predef FillPP
call Predef
pop hl pop hl
ld bc, PartyMon1PP - PartyMon1Moves ld bc, PartyMon1PP - PartyMon1Moves
add hl, bc add hl, bc

View File

@ -196,3 +196,25 @@ x = x + \1 * $40000
endr endr
ENDM ENDM
add_predef: MACRO
\1Predef::
dw \1
db BANK(\1)
ENDM
predef_id: MACRO
; Some functions load the predef id
; without immediately calling Predef.
ld a, (\1Predef - PredefPointers) / 3
ENDM
predef: MACRO
predef_id \1
call Predef
ENDM
predef_jump: MACRO
predef_id \1
jp Predef
ENDM

573
main.asm

File diff suppressed because it is too large Load Diff