mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Merge pull request #198 from yenatch/split-predefs-specials-stds
decouple home/ from engine/
This commit is contained in:
commit
0d6efda9bb
@ -9542,212 +9542,13 @@ BattleCommand53: ; 37563
|
||||
; 37588
|
||||
|
||||
|
||||
BattleCommand54: ; 37588
|
||||
; curse
|
||||
INCLUDE "battle/effects/curse.asm"
|
||||
|
||||
ld de, BattleMonType1
|
||||
ld bc, PlayerStatLevels
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .go
|
||||
ld de, EnemyMonType1
|
||||
ld bc, EnemyStatLevels
|
||||
INCLUDE "battle/effects/protect.asm"
|
||||
|
||||
.go
|
||||
INCLUDE "battle/effects/endure.asm"
|
||||
|
||||
; Curse is different for Ghost-types.
|
||||
|
||||
ld a, [de]
|
||||
cp GHOST
|
||||
jr z, .ghost
|
||||
inc de
|
||||
ld a, [de]
|
||||
cp GHOST
|
||||
jr z, .ghost
|
||||
|
||||
|
||||
; If no stats can be increased, don't.
|
||||
|
||||
; Attack
|
||||
ld a, [bc]
|
||||
cp 13 ; max
|
||||
jr c, .raise
|
||||
|
||||
; Defense
|
||||
inc bc
|
||||
ld a, [bc]
|
||||
cp 13 ; max
|
||||
jr nc, .cantraise
|
||||
|
||||
.raise
|
||||
|
||||
; Raise Attack and Defense, and lower Speed.
|
||||
|
||||
ld a, $1
|
||||
ld [$c689], a
|
||||
call Function0x37e01
|
||||
ld a, $2
|
||||
call Function0x36532
|
||||
call SwitchTurn
|
||||
call BattleCommand8d
|
||||
call ResetMiss
|
||||
call SwitchTurn
|
||||
call BattleCommand70
|
||||
call BattleCommand8c
|
||||
call ResetMiss
|
||||
call BattleCommand71
|
||||
jp BattleCommand8c
|
||||
|
||||
|
||||
.ghost
|
||||
|
||||
; Cut HP in half and put a curse on the opponent.
|
||||
|
||||
call CheckHiddenOpponent
|
||||
jr nz, .failed
|
||||
|
||||
call CheckSubstituteOpp
|
||||
jr nz, .failed
|
||||
|
||||
ld a, BATTLE_VARS_SUBSTATUS1_OPP
|
||||
call GetBattleVarPair
|
||||
bit 1, [hl]
|
||||
jr nz, .failed
|
||||
|
||||
set 1, [hl]
|
||||
call Function0x37e01
|
||||
ld hl, GetHalfMaxHP
|
||||
call CallBankF
|
||||
ld hl, Function3cc3f
|
||||
call CallBankF
|
||||
call UpdateUserInParty
|
||||
ld hl, PutACurseText
|
||||
jp StdBattleTextBox
|
||||
|
||||
.failed
|
||||
call Function0x37e77
|
||||
jp PrintButItFailed
|
||||
|
||||
|
||||
.cantraise
|
||||
|
||||
; Can't raise either stat.
|
||||
|
||||
ld b, $8 ; ABILITY
|
||||
call GetStatName
|
||||
call Function0x37e77
|
||||
ld hl, WontRiseAnymoreText
|
||||
jp StdBattleTextBox
|
||||
; 37618
|
||||
|
||||
|
||||
BattleCommand55: ; 37618
|
||||
; protect
|
||||
|
||||
call Function0x3762c
|
||||
ret c
|
||||
ld a, BATTLE_VARS_SUBSTATUS1
|
||||
call GetBattleVarPair
|
||||
set 2, [hl]
|
||||
call Function0x37e01
|
||||
ld hl, ProtectedItselfText
|
||||
jp StdBattleTextBox
|
||||
; 3762c
|
||||
|
||||
|
||||
Function0x3762c: ; 3762c
|
||||
ld de, $c679
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .asm_37637
|
||||
ld de, $c681
|
||||
|
||||
.asm_37637
|
||||
call Function0x36abf
|
||||
jr nz, .asm_37665
|
||||
|
||||
ld a, $3
|
||||
call CleanGetBattleVarPair
|
||||
bit 4, a
|
||||
jr nz, .asm_37665
|
||||
|
||||
ld b, $ff
|
||||
ld a, [de]
|
||||
ld c, a
|
||||
.asm_37649
|
||||
ld a, c
|
||||
and a
|
||||
jr z, .asm_37656
|
||||
|
||||
dec c
|
||||
srl b
|
||||
ld a, b
|
||||
and a
|
||||
jr nz, .asm_37649
|
||||
|
||||
jr .asm_37665
|
||||
|
||||
.asm_37656
|
||||
call BattleRandom
|
||||
and a
|
||||
jr z, .asm_37656
|
||||
|
||||
dec a
|
||||
cp b
|
||||
jr nc, .asm_37665
|
||||
|
||||
ld a, [de]
|
||||
inc a
|
||||
ld [de], a
|
||||
and a
|
||||
ret
|
||||
|
||||
.asm_37665
|
||||
xor a
|
||||
ld [de], a
|
||||
call Function0x37e77
|
||||
call PrintButItFailed
|
||||
scf
|
||||
ret
|
||||
; 3766f
|
||||
|
||||
|
||||
BattleCommand5a: ; 3766f
|
||||
; endure
|
||||
|
||||
call Function0x3762c
|
||||
ret c
|
||||
|
||||
ld a, BATTLE_VARS_SUBSTATUS1
|
||||
call GetBattleVarPair
|
||||
set SUBSTATUS_ENDURE, [hl]
|
||||
call Function0x37e01
|
||||
ld hl, BracedItselfText
|
||||
jp StdBattleTextBox
|
||||
; 37683
|
||||
|
||||
|
||||
BattleCommand56: ; 37683
|
||||
; spikes
|
||||
|
||||
ld hl, EnemyScreens
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .asm_3768e
|
||||
ld hl, PlayerScreens
|
||||
|
||||
.asm_3768e
|
||||
bit 0, [hl]
|
||||
jr nz, .failed
|
||||
|
||||
set 0, [hl]
|
||||
call Function0x37e01
|
||||
ld hl, SpikesText
|
||||
jp StdBattleTextBox
|
||||
|
||||
.failed
|
||||
jp Function0x37354
|
||||
; 376a0
|
||||
INCLUDE "battle/effects/spikes.asm"
|
||||
|
||||
|
||||
BattleCommand57: ; 376a0
|
||||
|
98
battle/effects/curse.asm
Normal file
98
battle/effects/curse.asm
Normal file
@ -0,0 +1,98 @@
|
||||
BattleCommand54: ; 37588
|
||||
; curse
|
||||
|
||||
ld de, BattleMonType1
|
||||
ld bc, PlayerStatLevels
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .go
|
||||
ld de, EnemyMonType1
|
||||
ld bc, EnemyStatLevels
|
||||
|
||||
.go
|
||||
|
||||
; Curse is different for Ghost-types.
|
||||
|
||||
ld a, [de]
|
||||
cp GHOST
|
||||
jr z, .ghost
|
||||
inc de
|
||||
ld a, [de]
|
||||
cp GHOST
|
||||
jr z, .ghost
|
||||
|
||||
|
||||
; If no stats can be increased, don't.
|
||||
|
||||
; Attack
|
||||
ld a, [bc]
|
||||
cp 13 ; max
|
||||
jr c, .raise
|
||||
|
||||
; Defense
|
||||
inc bc
|
||||
ld a, [bc]
|
||||
cp 13 ; max
|
||||
jr nc, .cantraise
|
||||
|
||||
.raise
|
||||
|
||||
; Raise Attack and Defense, and lower Speed.
|
||||
|
||||
ld a, $1
|
||||
ld [$c689], a
|
||||
call Function0x37e01
|
||||
ld a, $2
|
||||
call Function0x36532
|
||||
call SwitchTurn
|
||||
call BattleCommand8d
|
||||
call ResetMiss
|
||||
call SwitchTurn
|
||||
call BattleCommand70
|
||||
call BattleCommand8c
|
||||
call ResetMiss
|
||||
call BattleCommand71
|
||||
jp BattleCommand8c
|
||||
|
||||
|
||||
.ghost
|
||||
|
||||
; Cut HP in half and put a curse on the opponent.
|
||||
|
||||
call CheckHiddenOpponent
|
||||
jr nz, .failed
|
||||
|
||||
call CheckSubstituteOpp
|
||||
jr nz, .failed
|
||||
|
||||
ld a, BATTLE_VARS_SUBSTATUS1_OPP
|
||||
call GetBattleVarPair
|
||||
bit 1, [hl]
|
||||
jr nz, .failed
|
||||
|
||||
set 1, [hl]
|
||||
call Function0x37e01
|
||||
ld hl, GetHalfMaxHP
|
||||
call CallBankF
|
||||
ld hl, Function3cc3f
|
||||
call CallBankF
|
||||
call UpdateUserInParty
|
||||
ld hl, PutACurseText
|
||||
jp StdBattleTextBox
|
||||
|
||||
.failed
|
||||
call Function0x37e77
|
||||
jp PrintButItFailed
|
||||
|
||||
|
||||
.cantraise
|
||||
|
||||
; Can't raise either stat.
|
||||
|
||||
ld b, $8 ; ABILITY
|
||||
call GetStatName
|
||||
call Function0x37e77
|
||||
ld hl, WontRiseAnymoreText
|
||||
jp StdBattleTextBox
|
||||
; 37618
|
||||
|
18
battle/effects/endure.asm
Normal file
18
battle/effects/endure.asm
Normal file
@ -0,0 +1,18 @@
|
||||
BattleCommand5a: ; 3766f
|
||||
; endure
|
||||
|
||||
; Endure shares code with Protect. See protect.asm.
|
||||
|
||||
call ProtectChance
|
||||
ret c
|
||||
|
||||
ld a, BATTLE_VARS_SUBSTATUS1
|
||||
call GetBattleVarPair
|
||||
set SUBSTATUS_ENDURE, [hl]
|
||||
|
||||
call Function0x37e01
|
||||
|
||||
ld hl, BracedItselfText
|
||||
jp StdBattleTextBox
|
||||
; 37683
|
||||
|
81
battle/effects/protect.asm
Normal file
81
battle/effects/protect.asm
Normal file
@ -0,0 +1,81 @@
|
||||
BattleCommand55: ; 37618
|
||||
; protect
|
||||
call ProtectChance
|
||||
ret c
|
||||
|
||||
ld a, BATTLE_VARS_SUBSTATUS1
|
||||
call GetBattleVarPair
|
||||
set SUBSTATUS_PROTECT, [hl]
|
||||
|
||||
call Function0x37e01
|
||||
|
||||
ld hl, ProtectedItselfText
|
||||
jp StdBattleTextBox
|
||||
; 3762c
|
||||
|
||||
|
||||
ProtectChance: ; 3762c
|
||||
|
||||
ld de, PlayerProtectCount
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .asm_37637
|
||||
ld de, EnemyProtectCount
|
||||
.asm_37637
|
||||
|
||||
call Function0x36abf
|
||||
jr nz, .failed
|
||||
|
||||
; Can't have a substitute.
|
||||
|
||||
ld a, BATTLE_VARS_SUBSTATUS4
|
||||
call CleanGetBattleVarPair
|
||||
bit SUBSTATUS_SUBSTITUTE, a
|
||||
jr nz, .failed
|
||||
|
||||
; Halve the chance of a successful Protect for each consecutive use.
|
||||
|
||||
ld b, $ff
|
||||
ld a, [de]
|
||||
ld c, a
|
||||
.loop
|
||||
ld a, c
|
||||
and a
|
||||
jr z, .done
|
||||
dec c
|
||||
|
||||
srl b
|
||||
ld a, b
|
||||
and a
|
||||
jr nz, .loop
|
||||
jr .failed
|
||||
.done
|
||||
|
||||
.rand
|
||||
call BattleRandom
|
||||
and a
|
||||
jr z, .rand
|
||||
|
||||
dec a
|
||||
cp b
|
||||
jr nc, .failed
|
||||
|
||||
; Another consecutive Protect use.
|
||||
|
||||
ld a, [de]
|
||||
inc a
|
||||
ld [de], a
|
||||
|
||||
and a
|
||||
ret
|
||||
|
||||
|
||||
.failed
|
||||
xor a
|
||||
ld [de], a
|
||||
call Function0x37e77
|
||||
call PrintButItFailed
|
||||
scf
|
||||
ret
|
||||
; 3766f
|
||||
|
28
battle/effects/spikes.asm
Normal file
28
battle/effects/spikes.asm
Normal file
@ -0,0 +1,28 @@
|
||||
BattleCommand56: ; 37683
|
||||
; spikes
|
||||
|
||||
ld hl, EnemyScreens
|
||||
ld a, [hBattleTurn]
|
||||
and a
|
||||
jr z, .asm_3768e
|
||||
ld hl, PlayerScreens
|
||||
.asm_3768e
|
||||
|
||||
; Fails if spikes are already down!
|
||||
|
||||
bit SCREENS_SPIKES, [hl]
|
||||
jr nz, .failed
|
||||
|
||||
; Nothing else stops it from working.
|
||||
|
||||
set SCREENS_SPIKES, [hl]
|
||||
|
||||
call Function0x37e01
|
||||
|
||||
ld hl, SpikesText
|
||||
jp StdBattleTextBox
|
||||
|
||||
.failed
|
||||
jp Function0x37354
|
||||
; 376a0
|
||||
|
@ -170,8 +170,8 @@ BUTTONS EQU %00010000
|
||||
D_PAD EQU %00100000
|
||||
|
||||
NO_INPUT EQU %00000000
|
||||
BUTTON_A EQU %00000001
|
||||
BUTTON_B EQU %00000010
|
||||
A_BUTTON EQU %00000001
|
||||
B_BUTTON EQU %00000010
|
||||
SELECT EQU %00000100
|
||||
START EQU %00001000
|
||||
D_RIGHT EQU %00010000
|
||||
|
165
engine/fruit_trees.asm
Normal file
165
engine/fruit_trees.asm
Normal file
@ -0,0 +1,165 @@
|
||||
FruitTreeScript: ; 44000
|
||||
3callasm BANK(GetCurTreeFruit), GetCurTreeFruit
|
||||
loadfont
|
||||
copybytetovar CurFruit
|
||||
itemtotext $0, $0
|
||||
2writetext FruitBearingTreeText
|
||||
keeptextopen
|
||||
3callasm BANK(TryResetFruitTrees), TryResetFruitTrees
|
||||
3callasm BANK(CheckFruitTree), CheckFruitTree
|
||||
iffalse .fruit
|
||||
2writetext NothingHereText
|
||||
closetext
|
||||
2jump .end
|
||||
|
||||
.fruit
|
||||
2writetext HeyItsFruitText
|
||||
copybytetovar CurFruit
|
||||
giveitem $ff, 1
|
||||
iffalse .packisfull
|
||||
keeptextopen
|
||||
2writetext ObtainedFruitText
|
||||
3callasm BANK(PickedFruitTree), PickedFruitTree
|
||||
specialsound
|
||||
itemnotify
|
||||
2jump .end
|
||||
|
||||
.packisfull
|
||||
keeptextopen
|
||||
2writetext FruitPackIsFullText
|
||||
closetext
|
||||
|
||||
.end
|
||||
loadmovesprites
|
||||
end
|
||||
; 44041
|
||||
|
||||
GetCurTreeFruit: ; 44041
|
||||
ld a, [CurFruitTree]
|
||||
dec a
|
||||
call GetFruitTreeItem
|
||||
ld [CurFruit], a
|
||||
ret
|
||||
; 4404c
|
||||
|
||||
TryResetFruitTrees: ; 4404c
|
||||
ld hl, $dc1e
|
||||
bit 4, [hl]
|
||||
ret nz
|
||||
jp ResetFruitTrees
|
||||
; 44055
|
||||
|
||||
CheckFruitTree: ; 44055
|
||||
ld b, 2
|
||||
call GetFruitTreeFlag
|
||||
ld a, c
|
||||
ld [ScriptVar], a
|
||||
ret
|
||||
; 4405f
|
||||
|
||||
PickedFruitTree: ; 4405f
|
||||
ld a, $41
|
||||
ld hl, $609b
|
||||
rst FarCall ; empty function
|
||||
|
||||
ld b, 1
|
||||
jp GetFruitTreeFlag
|
||||
; 4406a
|
||||
|
||||
ResetFruitTrees: ; 4406a
|
||||
xor a
|
||||
ld hl, FruitTreeFlags
|
||||
ld [hli], a
|
||||
ld [hli], a
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ld hl, $dc1e
|
||||
set 4, [hl]
|
||||
ret
|
||||
; 44078
|
||||
|
||||
GetFruitTreeFlag: ; 44078
|
||||
push hl
|
||||
push de
|
||||
ld a, [CurFruitTree]
|
||||
dec a
|
||||
ld e, a
|
||||
ld d, 0
|
||||
ld hl, FruitTreeFlags
|
||||
call FlagAction
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
; 4408a
|
||||
|
||||
GetFruitTreeItem: ; 4408a
|
||||
push hl
|
||||
push de
|
||||
ld e, a
|
||||
ld d, 0
|
||||
ld hl, FruitTreeItems
|
||||
add hl, de
|
||||
ld a, [hl]
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
; 44097
|
||||
|
||||
FruitTreeItems: ; 44097
|
||||
db BERRY
|
||||
db BERRY
|
||||
db BERRY
|
||||
db BERRY
|
||||
db PSNCUREBERRY
|
||||
db PSNCUREBERRY
|
||||
db BITTER_BERRY
|
||||
db BITTER_BERRY
|
||||
db PRZCUREBERRY
|
||||
db PRZCUREBERRY
|
||||
db MYSTERYBERRY
|
||||
db MYSTERYBERRY
|
||||
db ICE_BERRY
|
||||
db ICE_BERRY
|
||||
db MINT_BERRY
|
||||
db BURNT_BERRY
|
||||
db RED_APRICORN
|
||||
db BLU_APRICORN
|
||||
db BLK_APRICORN
|
||||
db WHT_APRICORN
|
||||
db PNK_APRICORN
|
||||
db GRN_APRICORN
|
||||
db YLW_APRICORN
|
||||
db BERRY
|
||||
db PSNCUREBERRY
|
||||
db BITTER_BERRY
|
||||
db PRZCUREBERRY
|
||||
db ICE_BERRY
|
||||
db MINT_BERRY
|
||||
db BURNT_BERRY
|
||||
; 440b5
|
||||
|
||||
FruitBearingTreeText: ; 440b5
|
||||
text_jump _FruitBearingTreeText, BANK(_FruitBearingTreeText)
|
||||
db "@"
|
||||
; 440ba
|
||||
|
||||
HeyItsFruitText: ; 440ba
|
||||
text_jump _HeyItsFruitText, BANK(_HeyItsFruitText)
|
||||
db "@"
|
||||
; 440bf
|
||||
|
||||
ObtainedFruitText: ; 440bf
|
||||
text_jump _ObtainedFruitText, BANK(_ObtainedFruitText)
|
||||
db "@"
|
||||
; 440c4
|
||||
|
||||
FruitPackIsFullText: ; 440c4
|
||||
text_jump _FruitPackIsFullText, BANK(_FruitPackIsFullText)
|
||||
db "@"
|
||||
; 440c9
|
||||
|
||||
NothingHereText: ; 440c9
|
||||
text_jump _NothingHereText, BANK(_NothingHereText)
|
||||
db "@"
|
||||
; 440ce
|
||||
|
@ -539,7 +539,7 @@ Script_verbosegiveitem2: ; 0x96f8e
|
||||
ld a, [de]
|
||||
ld [$d10c], a
|
||||
ld hl, $d892
|
||||
call Function2f66
|
||||
call ReceiveItem
|
||||
ld a, $1
|
||||
jr c, .asm_96fb0 ; 0x96fad $1
|
||||
xor a
|
||||
@ -2320,7 +2320,7 @@ Script_giveitem: ; 0x977ca
|
||||
call GetScriptByte
|
||||
ld [$d10c], a
|
||||
ld hl, $d892
|
||||
call Function2f66
|
||||
call ReceiveItem
|
||||
jr nc, .asm_977eb ; 0x977e3 $6
|
||||
ld a, $1
|
||||
ld [$c2dd], a
|
||||
@ -2346,7 +2346,7 @@ Script_takeitem: ; 0x977f0
|
||||
ld a, $ff
|
||||
ld [$d107], a
|
||||
ld hl, $d892
|
||||
call Function2f53
|
||||
call TossItem
|
||||
ret nc
|
||||
ld a, $1
|
||||
ld [$c2dd], a
|
||||
@ -2363,7 +2363,7 @@ Script_checkitem: ; 0x97812
|
||||
call GetScriptByte
|
||||
ld [$d106], a
|
||||
ld hl, $d892
|
||||
call PickUpItem
|
||||
call CheckItem
|
||||
ret nc
|
||||
ld a, $1
|
||||
ld [$c2dd], a
|
||||
|
2619
engine/std_scripts.asm
Normal file
2619
engine/std_scripts.asm
Normal file
File diff suppressed because it is too large
Load Diff
236
event/name_rater.asm
Normal file
236
event/name_rater.asm
Normal file
@ -0,0 +1,236 @@
|
||||
NameRater: ; fb6ed
|
||||
ld hl, UnknownText_0xfb80f
|
||||
call PrintText
|
||||
call Function1dcf
|
||||
jp c, .asm_fb77e
|
||||
ld hl, UnknownText_0xfb814
|
||||
call PrintText
|
||||
callba Function50000
|
||||
jr c, .asm_fb77e
|
||||
ld a, [CurPartySpecies]
|
||||
cp EGG
|
||||
jr z, .asm_fb783
|
||||
call GetCurNick
|
||||
call Functionfb78a
|
||||
jr c, .asm_fb779
|
||||
ld hl, UnknownText_0xfb819
|
||||
call PrintText
|
||||
call Function1dcf
|
||||
jr c, .asm_fb77e
|
||||
ld hl, UnknownText_0xfb81e
|
||||
call PrintText
|
||||
xor a
|
||||
ld [MonType], a
|
||||
ld a, [CurPartySpecies]
|
||||
ld [$d265], a
|
||||
ld [CurSpecies], a
|
||||
call GetBaseData
|
||||
ld b, 0
|
||||
ld de, StringBuffer2
|
||||
callba Function116b7
|
||||
call Functionfb7be
|
||||
ld hl, UnknownText_0xfb837
|
||||
jr c, .asm_fb76c
|
||||
call Functionfb7d3
|
||||
ld hl, UnknownText_0xfb837
|
||||
jr c, .asm_fb76c
|
||||
ld hl, PartyMon1Nickname
|
||||
ld bc, $000b
|
||||
ld a, [CurPartyMon]
|
||||
call AddNTimes
|
||||
ld e, l
|
||||
ld d, h
|
||||
ld hl, StringBuffer2
|
||||
ld bc, $000b
|
||||
call CopyBytes
|
||||
ld hl, UnknownText_0xfb823
|
||||
|
||||
.asm_fb76c
|
||||
push hl
|
||||
call GetCurNick
|
||||
ld hl, UnknownText_0xfb83c
|
||||
call PrintText
|
||||
pop hl
|
||||
jr .asm_fb786
|
||||
|
||||
.asm_fb779
|
||||
ld hl, UnknownText_0xfb82d
|
||||
jr .asm_fb786
|
||||
|
||||
.asm_fb77e
|
||||
ld hl, UnknownText_0xfb828
|
||||
jr .asm_fb786
|
||||
|
||||
.asm_fb783
|
||||
ld hl, UnknownText_0xfb832
|
||||
|
||||
.asm_fb786
|
||||
call PrintText
|
||||
ret
|
||||
; fb78a
|
||||
|
||||
Functionfb78a: ; fb78a
|
||||
ld hl, PartyMon1OT
|
||||
ld bc, $000b
|
||||
ld a, [CurPartyMon]
|
||||
call AddNTimes
|
||||
ld de, PlayerName
|
||||
ld c, $b
|
||||
call .asm_fb7b1
|
||||
jr c, .asm_fb7bc
|
||||
ld hl, PartyMon1ID
|
||||
ld bc, PartyMon2 - PartyMon1
|
||||
ld a, [CurPartyMon]
|
||||
call AddNTimes
|
||||
ld de, PlayerID
|
||||
ld c, $2
|
||||
.asm_fb7b1
|
||||
ld a, [de]
|
||||
cp [hl]
|
||||
jr nz, .asm_fb7bc
|
||||
inc hl
|
||||
inc de
|
||||
dec c
|
||||
jr nz, .asm_fb7b1
|
||||
and a
|
||||
ret
|
||||
|
||||
.asm_fb7bc
|
||||
scf
|
||||
ret
|
||||
; fb7be
|
||||
|
||||
Functionfb7be: ; fb7be
|
||||
ld hl, StringBuffer2
|
||||
ld c, 10
|
||||
.asm_fb7c3
|
||||
ld a, [hli]
|
||||
cp "@"
|
||||
jr z, .asm_fb7cf
|
||||
cp " "
|
||||
jr nz, .asm_fb7d1
|
||||
dec c
|
||||
jr nz, .asm_fb7c3
|
||||
|
||||
.asm_fb7cf
|
||||
scf
|
||||
ret
|
||||
|
||||
.asm_fb7d1
|
||||
and a
|
||||
ret
|
||||
; fb7d3
|
||||
|
||||
Functionfb7d3: ; fb7d3
|
||||
ld hl, PartyMon1Nickname
|
||||
ld bc, $000b
|
||||
ld a, [CurPartyMon]
|
||||
call AddNTimes
|
||||
push hl
|
||||
call Functionfb802
|
||||
ld b, c
|
||||
ld hl, StringBuffer2
|
||||
call Functionfb802
|
||||
pop hl
|
||||
ld a, c
|
||||
cp b
|
||||
jr nz, .asm_fb7fe
|
||||
ld de, StringBuffer2
|
||||
.asm_fb7f2
|
||||
ld a, [de]
|
||||
cp "@"
|
||||
jr z, .asm_fb800
|
||||
cp [hl]
|
||||
jr nz, .asm_fb7fe
|
||||
inc hl
|
||||
inc de
|
||||
jr .asm_fb7f2
|
||||
|
||||
.asm_fb7fe
|
||||
and a
|
||||
ret
|
||||
|
||||
.asm_fb800
|
||||
scf
|
||||
ret
|
||||
; fb802
|
||||
|
||||
Functionfb802: ; fb802
|
||||
ld c, 0
|
||||
.asm_fb804
|
||||
ld a, [hli]
|
||||
cp "@"
|
||||
ret z
|
||||
inc c
|
||||
ld a, c
|
||||
cp 10
|
||||
jr nz, .asm_fb804
|
||||
ret
|
||||
; fb80f
|
||||
|
||||
UnknownText_0xfb80f: ; 0xfb80f
|
||||
; Hello, hello! I'm the NAME RATER.
|
||||
; I rate the names of #MON.
|
||||
; Would you like me to rate names?
|
||||
text_jump UnknownText_0x1c0043, BANK(UnknownText_0x1c0043)
|
||||
db "@"
|
||||
; 0xfb814
|
||||
|
||||
UnknownText_0xfb814: ; 0xfb814
|
||||
; Which #MON's nickname should I rate for you?
|
||||
text_jump UnknownText_0x1c00a0, BANK(UnknownText_0x1c00a0)
|
||||
db "@"
|
||||
; 0xfb819
|
||||
|
||||
UnknownText_0xfb819: ; 0xfb819
|
||||
; Hm… @ … That's a fairly decent name.
|
||||
; But, how about a slightly better nickname?
|
||||
; Want me to give it a better name?
|
||||
text_jump UnknownText_0x1c00cd, BANK(UnknownText_0x1c00cd)
|
||||
db "@"
|
||||
; 0xfb81e
|
||||
|
||||
UnknownText_0xfb81e: ; 0xfb81e
|
||||
; All right. What name should we give it, then?
|
||||
text_jump UnknownText_0x1c0142, BANK(UnknownText_0x1c0142)
|
||||
db "@"
|
||||
; 0xfb823
|
||||
|
||||
UnknownText_0xfb823: ; 0xfb823
|
||||
; That's a better name than before! Well done!
|
||||
text_jump UnknownText_0x1c0171, BANK(UnknownText_0x1c0171)
|
||||
db "@"
|
||||
; 0xfb828
|
||||
|
||||
UnknownText_0xfb828: ; 0xfb828
|
||||
; OK, then. Come again sometime.
|
||||
text_jump UnknownText_0x1c019e, BANK(UnknownText_0x1c019e)
|
||||
db "@"
|
||||
; 0xfb82d
|
||||
|
||||
UnknownText_0xfb82d: ; 0xfb82d
|
||||
; Hm… @ ? What a great name! It's perfect.
|
||||
; Treat @ with loving care.
|
||||
text_jump UnknownText_0x1c01be, BANK(UnknownText_0x1c01be)
|
||||
db "@"
|
||||
; 0xfb832
|
||||
|
||||
UnknownText_0xfb832: ; 0xfb832
|
||||
; Whoa… That's just an EGG.
|
||||
text_jump UnknownText_0x1c0208, BANK(UnknownText_0x1c0208)
|
||||
db "@"
|
||||
; 0xfb837
|
||||
|
||||
UnknownText_0xfb837: ; 0xfb837
|
||||
; It might look the same as before,
|
||||
; but this new name is much better! Well done!
|
||||
text_jump UnknownText_0x1c0222, BANK(UnknownText_0x1c0222)
|
||||
db "@"
|
||||
; 0xfb83c
|
||||
|
||||
UnknownText_0xfb83c: ; 0xfb83c
|
||||
; All right. This #MON is now named @ .
|
||||
text_jump UnknownText_0x1c0272, BANK(UnknownText_0x1c0272)
|
||||
db "@"
|
||||
; 0xfb841
|
||||
|
134
home/copy2.asm
Normal file
134
home/copy2.asm
Normal file
@ -0,0 +1,134 @@
|
||||
CopyBytes: ; 0x3026
|
||||
; copy bc bytes from hl to de
|
||||
inc b ; we bail the moment b hits 0, so include the last run
|
||||
inc c ; same thing; include last byte
|
||||
jr .HandleLoop
|
||||
.CopyByte
|
||||
ld a, [hli]
|
||||
ld [de], a
|
||||
inc de
|
||||
.HandleLoop
|
||||
dec c
|
||||
jr nz, .CopyByte
|
||||
dec b
|
||||
jr nz, .CopyByte
|
||||
ret
|
||||
|
||||
SwapBytes: ; 0x3034
|
||||
; swap bc bytes between hl and de
|
||||
.Loop
|
||||
; stash [hl] away on the stack
|
||||
ld a, [hl]
|
||||
push af
|
||||
|
||||
; copy a byte from [de] to [hl]
|
||||
ld a, [de]
|
||||
ld [hli], a
|
||||
|
||||
; retrieve the previous value of [hl]; put it in [de]
|
||||
pop af
|
||||
ld [de], a
|
||||
inc de
|
||||
|
||||
; handle loop stuff
|
||||
dec bc
|
||||
ld a, b
|
||||
or c
|
||||
jr nz, .Loop
|
||||
ret
|
||||
|
||||
ByteFill: ; 0x3041
|
||||
; fill bc bytes with the value of a, starting at hl
|
||||
inc b ; we bail the moment b hits 0, so include the last run
|
||||
inc c ; same thing; include last byte
|
||||
jr .HandleLoop
|
||||
.PutByte
|
||||
ld [hli], a
|
||||
.HandleLoop
|
||||
dec c
|
||||
jr nz, .PutByte
|
||||
dec b
|
||||
jr nz, .PutByte
|
||||
ret
|
||||
|
||||
GetFarByte: ; 0x304d
|
||||
; retrieve a single byte from a:hl, and return it in a.
|
||||
; bankswitch to new bank
|
||||
ld [hBuffer], a
|
||||
ld a, [hROMBank]
|
||||
push af
|
||||
ld a, [hBuffer]
|
||||
rst Bankswitch
|
||||
|
||||
; get byte from new bank
|
||||
ld a, [hl]
|
||||
ld [hBuffer], a
|
||||
|
||||
; bankswitch to previous bank
|
||||
pop af
|
||||
rst Bankswitch
|
||||
|
||||
; return retrieved value in a
|
||||
ld a, [hBuffer]
|
||||
ret
|
||||
|
||||
GetFarHalfword: ; 0x305d
|
||||
; retrieve a halfword from a:hl, and return it in hl.
|
||||
; bankswitch to new bank
|
||||
ld [hBuffer], a
|
||||
ld a, [hROMBank]
|
||||
push af
|
||||
ld a, [hBuffer]
|
||||
rst Bankswitch
|
||||
|
||||
; get halfword from new bank, put it in hl
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
|
||||
; bankswitch to previous bank and return
|
||||
pop af
|
||||
rst Bankswitch
|
||||
ret
|
||||
; 0x306b
|
||||
|
||||
FarCopyWRAM: ; 306b
|
||||
ld [hBuffer], a
|
||||
ld a, [rSVBK]
|
||||
push af
|
||||
ld a, [hBuffer]
|
||||
ld [rSVBK], a
|
||||
call CopyBytes
|
||||
pop af
|
||||
ld [rSVBK], a
|
||||
ret
|
||||
; 307b
|
||||
|
||||
GetFarWRAMByte: ; 307b
|
||||
ld [hBuffer], a
|
||||
ld a, [rSVBK]
|
||||
push af
|
||||
ld a, [hBuffer]
|
||||
ld [rSVBK], a
|
||||
ld a, [hl]
|
||||
ld [hBuffer], a
|
||||
pop af
|
||||
ld [rSVBK], a
|
||||
ld a, [hBuffer]
|
||||
ret
|
||||
; 308d
|
||||
|
||||
GetFarWRAMWord: ; 308d
|
||||
ld [hBuffer], a
|
||||
ld a, [rSVBK]
|
||||
push af
|
||||
ld a, [hBuffer]
|
||||
ld [rSVBK], a
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
pop af
|
||||
ld [rSVBK], a
|
||||
ret
|
||||
; 309d
|
||||
|
31
home/double_speed.asm
Normal file
31
home/double_speed.asm
Normal file
@ -0,0 +1,31 @@
|
||||
; The CGB hardware introduces Double Speed Mode.
|
||||
; While active, the clock speed is doubled.
|
||||
|
||||
; The hardware can switch between normal speed
|
||||
; and double speed at any time, but LCD output
|
||||
; collapses during the switch.
|
||||
|
||||
DoubleSpeed: ; 2fef
|
||||
ld hl, rKEY1
|
||||
bit 7, [hl]
|
||||
jr z, SwitchSpeed
|
||||
ret
|
||||
; 2ff7
|
||||
|
||||
NormalSpeed: ; 2ff7
|
||||
ld hl, rKEY1
|
||||
bit 7, [hl]
|
||||
ret z
|
||||
; 2ffd
|
||||
|
||||
SwitchSpeed: ; 2ffd
|
||||
set 0, [hl]
|
||||
xor a
|
||||
ld [rIF], a
|
||||
ld [rIE], a
|
||||
ld a, $30
|
||||
ld [rJOYP], a
|
||||
stop ; rgbasm adds a nop after this instruction by default
|
||||
ret
|
||||
; 300b
|
||||
|
113
home/flag.asm
Normal file
113
home/flag.asm
Normal file
@ -0,0 +1,113 @@
|
||||
Function2e50: ; 2e50
|
||||
xor a
|
||||
ld hl, EventFlags
|
||||
ld [hli], a
|
||||
ret
|
||||
; 2e56
|
||||
|
||||
Function2e56: ; 2e56
|
||||
xor a
|
||||
ld hl, BikeFlags
|
||||
ld [hli], a
|
||||
ld [hl], a
|
||||
ret
|
||||
; 2e5d
|
||||
|
||||
Function2e5d: ; 2e5d
|
||||
ld a, [$d19a]
|
||||
cp $2
|
||||
jr z, .asm_2e69
|
||||
cp $1
|
||||
jr z, .asm_2e69
|
||||
ret
|
||||
|
||||
.asm_2e69
|
||||
ld hl, StatusFlags
|
||||
res 2, [hl]
|
||||
ret
|
||||
; 2e6f
|
||||
|
||||
|
||||
EventFlagAction: ; 0x2e6f
|
||||
ld hl, EventFlags
|
||||
call FlagAction
|
||||
ret
|
||||
|
||||
FlagAction: ; 0x2e76
|
||||
; Perform action b on bit de in flag array hl.
|
||||
|
||||
; inputs:
|
||||
; b: function
|
||||
; 0 clear bit
|
||||
; 1 set bit
|
||||
; 2 check bit
|
||||
; de: bit number
|
||||
; hl: index within bit table
|
||||
|
||||
; get index within the byte
|
||||
ld a, e
|
||||
and 7
|
||||
|
||||
; shift de right by three bits (get the index within memory)
|
||||
srl d
|
||||
rr e
|
||||
srl d
|
||||
rr e
|
||||
srl d
|
||||
rr e
|
||||
add hl, de
|
||||
|
||||
; implement a decoder
|
||||
ld c, 1
|
||||
rrca
|
||||
jr nc, .one
|
||||
rlc c
|
||||
.one
|
||||
rrca
|
||||
jr nc, .two
|
||||
rlc c
|
||||
rlc c
|
||||
.two
|
||||
rrca
|
||||
jr nc, .three
|
||||
swap c
|
||||
.three
|
||||
|
||||
; check b's value: 0, 1, 2
|
||||
ld a, b
|
||||
cp 1
|
||||
jr c, .clearbit ; 0
|
||||
jr z, .setbit ; 1
|
||||
|
||||
; check bit
|
||||
ld a, [hl]
|
||||
and c
|
||||
ld c, a
|
||||
ret
|
||||
|
||||
.setbit
|
||||
; set bit
|
||||
ld a, [hl]
|
||||
or c
|
||||
ld [hl], a
|
||||
ret
|
||||
|
||||
.clearbit
|
||||
; clear bit
|
||||
ld a, c
|
||||
cpl
|
||||
and [hl]
|
||||
ld [hl], a
|
||||
ret
|
||||
; 0x2ead
|
||||
|
||||
|
||||
Function2ead: ; 2ead
|
||||
ld de, ENGINE_POKEDEX
|
||||
ld b, CHECK_FLAG
|
||||
callba EngineFlagAction
|
||||
ld a, c
|
||||
and a
|
||||
ret
|
||||
; 2ebb
|
||||
|
38
home/handshake.asm
Normal file
38
home/handshake.asm
Normal file
@ -0,0 +1,38 @@
|
||||
AskSerial: ; 2063
|
||||
; send out a handshake while serial int is off
|
||||
ld a, [$c2d4]
|
||||
bit 0, a
|
||||
ret z
|
||||
|
||||
ld a, [$c2d5]
|
||||
and a
|
||||
ret nz
|
||||
|
||||
; once every 6 frames
|
||||
ld hl, $ca8a
|
||||
inc [hl]
|
||||
ld a, [hl]
|
||||
cp 6
|
||||
ret c
|
||||
|
||||
xor a
|
||||
ld [hl], a
|
||||
|
||||
ld a, $c
|
||||
ld [$c2d5], a
|
||||
|
||||
; handshake
|
||||
ld a, $88
|
||||
ld [rSB], a
|
||||
|
||||
; switch to internal clock
|
||||
ld a, %00000001
|
||||
ld [rSC], a
|
||||
|
||||
; start transfer
|
||||
ld a, %10000001
|
||||
ld [rSC], a
|
||||
|
||||
ret
|
||||
; 208a
|
||||
|
@ -156,7 +156,7 @@ Init: ; 17d
|
||||
ld a, [hCGB]
|
||||
and a
|
||||
jr z, .asm_22b
|
||||
call Function2ff7
|
||||
call NormalSpeed
|
||||
.asm_22b
|
||||
|
||||
xor a
|
76
home/item.asm
Normal file
76
home/item.asm
Normal file
@ -0,0 +1,76 @@
|
||||
DoItemEffect: ; 2f3f
|
||||
callba _DoItemEffect
|
||||
ret
|
||||
; 2f46
|
||||
|
||||
CheckTossableItem: ; 2f46
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
callba _CheckTossableItem
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
; 2f53
|
||||
|
||||
TossItem: ; 2f53
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
ld a, [hROMBank]
|
||||
push af
|
||||
ld a, BANK(_TossItem)
|
||||
rst Bankswitch
|
||||
|
||||
call _TossItem
|
||||
|
||||
pop bc
|
||||
ld a, b
|
||||
rst Bankswitch
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
; 2f66
|
||||
|
||||
ReceiveItem: ; 2f66
|
||||
push bc
|
||||
ld a, [hROMBank]
|
||||
push af
|
||||
ld a, BANK(_ReceiveItem)
|
||||
rst Bankswitch
|
||||
push hl
|
||||
push de
|
||||
|
||||
call _ReceiveItem
|
||||
|
||||
pop de
|
||||
pop hl
|
||||
pop bc
|
||||
ld a, b
|
||||
rst Bankswitch
|
||||
pop bc
|
||||
ret
|
||||
; 2f79
|
||||
|
||||
CheckItem: ; 2f79
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
ld a, [hROMBank]
|
||||
push af
|
||||
ld a, BANK(_CheckItem)
|
||||
rst Bankswitch
|
||||
|
||||
call _CheckItem
|
||||
|
||||
pop bc
|
||||
ld a, b
|
||||
rst Bankswitch
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
; 2f8c
|
||||
|
@ -101,8 +101,8 @@ Joypad: ; 935
|
||||
; Now that we have the input, we can do stuff with it.
|
||||
|
||||
; For example, soft reset:
|
||||
and BUTTON_A | BUTTON_B | SELECT | START
|
||||
cp BUTTON_A | BUTTON_B | SELECT | START
|
||||
and A_BUTTON | B_BUTTON | SELECT | START
|
||||
cp A_BUTTON | B_BUTTON | SELECT | START
|
||||
jp z, Reset
|
||||
|
||||
ret
|
||||
@ -283,11 +283,11 @@ Functiona1b: ; a1b
|
||||
pop bc
|
||||
|
||||
ld a, [hJoyDown]
|
||||
cp D_UP | SELECT | BUTTON_B
|
||||
cp D_UP | SELECT | B_BUTTON
|
||||
jr z, .asm_a34
|
||||
|
||||
ld a, [$ffa9]
|
||||
and START | BUTTON_A
|
||||
and START | A_BUTTON
|
||||
jr nz, .asm_a34
|
||||
|
||||
dec c
|
||||
@ -306,7 +306,7 @@ Functiona36: ; a36
|
||||
call DelayFrame
|
||||
call GetJoypadPublic
|
||||
ld a, [hJoyPressed]
|
||||
and BUTTON_A | BUTTON_B
|
||||
and A_BUTTON | B_BUTTON
|
||||
ret nz
|
||||
call RTC
|
||||
jr Functiona36
|
||||
@ -382,7 +382,7 @@ Functiona80: ; a80
|
||||
Functionaa5: ; aa5
|
||||
call Functiona57
|
||||
ld a, [$ffa9]
|
||||
and BUTTON_A | BUTTON_B
|
||||
and A_BUTTON | B_BUTTON
|
||||
jr z, Functionaa5
|
||||
ret
|
||||
; aaf
|
2369
home/map.asm
Normal file
2369
home/map.asm
Normal file
File diff suppressed because it is too large
Load Diff
76
home/math.asm
Normal file
76
home/math.asm
Normal file
@ -0,0 +1,76 @@
|
||||
SimpleMultiply: ; 3105
|
||||
; Return a * c.
|
||||
and a
|
||||
ret z
|
||||
|
||||
push bc
|
||||
ld b, a
|
||||
xor a
|
||||
.loop
|
||||
add c
|
||||
dec b
|
||||
jr nz, .loop
|
||||
pop bc
|
||||
ret
|
||||
; 3110
|
||||
|
||||
|
||||
SimpleDivide: ; 3110
|
||||
; Divide a by c. Return quotient b and remainder a.
|
||||
ld b, 0
|
||||
.loop
|
||||
inc b
|
||||
sub c
|
||||
jr nc, .loop
|
||||
dec b
|
||||
add c
|
||||
ret
|
||||
; 3119
|
||||
|
||||
|
||||
Multiply: ; 3119
|
||||
; Multiply hMultiplicand (3 bytes) by hMultiplier. Result in hProduct.
|
||||
; All values are big endian.
|
||||
push hl
|
||||
push bc
|
||||
|
||||
callab _Multiply
|
||||
|
||||
pop bc
|
||||
pop hl
|
||||
ret
|
||||
; 3124
|
||||
|
||||
|
||||
Divide: ; 3124
|
||||
; Divide hDividend length b (max 4 bytes) by hDivisor. Result in hQuotient.
|
||||
; All values are big endian.
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
ld a, [hROMBank]
|
||||
push af
|
||||
ld a, BANK(_Divide)
|
||||
rst Bankswitch
|
||||
|
||||
call _Divide
|
||||
|
||||
pop af
|
||||
rst Bankswitch
|
||||
pop bc
|
||||
pop de
|
||||
pop hl
|
||||
ret
|
||||
; 3136
|
||||
|
||||
|
||||
SubtractSigned: ; 3136
|
||||
; Return a - b, sign in carry.
|
||||
sub b
|
||||
ret nc
|
||||
cpl
|
||||
add 1
|
||||
scf
|
||||
ret
|
||||
; 313d
|
||||
|
54
home/predef.asm
Normal file
54
home/predef.asm
Normal file
@ -0,0 +1,54 @@
|
||||
Predef: ; 2d83
|
||||
; Call predefined function a.
|
||||
; Preserves bc, de, hl and f.
|
||||
|
||||
ld [PredefID], a
|
||||
ld a, [hROMBank]
|
||||
push af
|
||||
|
||||
ld a, BANK(GetPredefPointer)
|
||||
rst Bankswitch
|
||||
call GetPredefPointer ; stores hl in PredefTemp
|
||||
|
||||
; Switch to the new function's bank
|
||||
rst Bankswitch
|
||||
|
||||
; Instead of directly calling stuff,
|
||||
; push it to the stack in reverse.
|
||||
|
||||
ld hl, .Return
|
||||
push hl
|
||||
|
||||
; Call the Predef function
|
||||
ld a, [PredefAddress]
|
||||
ld h, a
|
||||
ld a, [PredefAddress + 1]
|
||||
ld l, a
|
||||
push hl
|
||||
|
||||
; Get hl back
|
||||
ld a, [PredefTemp]
|
||||
ld h, a
|
||||
ld a, [PredefTemp + 1]
|
||||
ld l, a
|
||||
ret
|
||||
|
||||
.Return
|
||||
; Clean up after the Predef call
|
||||
|
||||
ld a, h
|
||||
ld [PredefTemp], a
|
||||
ld a, l
|
||||
ld [PredefTemp+1], a
|
||||
|
||||
pop hl
|
||||
ld a, h
|
||||
rst Bankswitch
|
||||
|
||||
ld a, [PredefTemp]
|
||||
ld h, a
|
||||
ld a, [PredefTemp + 1]
|
||||
ld l, a
|
||||
ret
|
||||
; 2dba
|
||||
|
76
home/random.asm
Normal file
76
home/random.asm
Normal file
@ -0,0 +1,76 @@
|
||||
Random: ; 2f8c
|
||||
; A simple hardware-based random number generator (RNG).
|
||||
|
||||
; Two random numbers are generated by adding and subtracting
|
||||
; the divider to the respective values every time it's called.
|
||||
|
||||
; The divider is a register that increments at a rate of 16384Hz.
|
||||
; For comparison, the Game Boy operates at a clock speed of 4.2MHz.
|
||||
|
||||
; Additionally, an equivalent function is executed in VBlank.
|
||||
|
||||
; This leaves a with the value in hRandomSub.
|
||||
|
||||
push bc
|
||||
|
||||
ld a, [rDIV]
|
||||
ld b, a
|
||||
ld a, [hRandomAdd]
|
||||
adc b
|
||||
ld [hRandomAdd], a
|
||||
|
||||
ld a, [rDIV]
|
||||
ld b, a
|
||||
ld a, [hRandomSub]
|
||||
sbc b
|
||||
ld [hRandomSub], a
|
||||
|
||||
pop bc
|
||||
ret
|
||||
; 2f9f
|
||||
|
||||
BattleRandom: ; 2f9f
|
||||
; _BattleRandom lives in another bank.
|
||||
|
||||
; It handles all RNG calls in the battle engine, allowing
|
||||
; link battles to remain in sync using a shared PRNG.
|
||||
|
||||
ld a, [hROMBank]
|
||||
push af
|
||||
ld a, BANK(_BattleRandom)
|
||||
rst Bankswitch
|
||||
|
||||
call _BattleRandom
|
||||
|
||||
ld [$cfb6], a
|
||||
pop af
|
||||
rst Bankswitch
|
||||
ld a, [$cfb6]
|
||||
ret
|
||||
; 2fb1
|
||||
|
||||
|
||||
Function2fb1: ; 2fb1
|
||||
push bc
|
||||
ld c, a
|
||||
xor a
|
||||
sub c
|
||||
.asm_2fb5
|
||||
sub c
|
||||
jr nc, .asm_2fb5
|
||||
add c
|
||||
ld b, a
|
||||
push bc
|
||||
.asm_2fbb
|
||||
call Random
|
||||
ld a, [hRandomAdd]
|
||||
ld c, a
|
||||
add b
|
||||
jr c, .asm_2fbb
|
||||
ld a, c
|
||||
pop bc
|
||||
call SimpleDivide
|
||||
pop bc
|
||||
ret
|
||||
; 2fcb
|
||||
|
34
home/sram.asm
Normal file
34
home/sram.asm
Normal file
@ -0,0 +1,34 @@
|
||||
GetSRAMBank: ; 2fcb
|
||||
; load sram bank a
|
||||
; if invalid bank, sram is disabled
|
||||
cp NUM_SRAM_BANKS
|
||||
jr c, OpenSRAM
|
||||
jr CloseSRAM
|
||||
; 2fd1
|
||||
|
||||
OpenSRAM: ; 2fd1
|
||||
; switch to sram bank a
|
||||
push af
|
||||
; latch clock data
|
||||
ld a, 1
|
||||
ld [MBC3LatchClock], a
|
||||
; enable sram/clock write
|
||||
ld a, SRAM_ENABLE
|
||||
ld [MBC3SRamEnable], a
|
||||
; select sram bank
|
||||
pop af
|
||||
ld [MBC3SRamBank], a
|
||||
ret
|
||||
; 2fe1
|
||||
|
||||
CloseSRAM: ; 2fe1
|
||||
push af
|
||||
ld a, SRAM_DISABLE
|
||||
; reset clock latch for next time
|
||||
ld [MBC3LatchClock], a
|
||||
; disable sram/clock write
|
||||
ld [MBC3SRamEnable], a
|
||||
pop af
|
||||
ret
|
||||
; 2fec
|
||||
|
39
home/string.asm
Normal file
39
home/string.asm
Normal file
@ -0,0 +1,39 @@
|
||||
InitString: ; 2ef6
|
||||
; Init a string of length c.
|
||||
push hl
|
||||
jr _InitString
|
||||
; 2ef9
|
||||
|
||||
InitName: ; 2ef9
|
||||
; Intended for names, so this function is limited to ten characters.
|
||||
push hl
|
||||
ld c, 10
|
||||
; 2efc
|
||||
|
||||
_InitString: ; 2efc
|
||||
; if the string pointed to by hl is empty (defined as "zero or more spaces
|
||||
; followed by a null"), then initialize it to the string pointed to by de.
|
||||
push bc
|
||||
.loop
|
||||
ld a, [hli]
|
||||
cp "@"
|
||||
jr z, .blank
|
||||
cp " "
|
||||
jr nz, .notblank
|
||||
dec c
|
||||
jr nz, .loop
|
||||
.blank
|
||||
pop bc
|
||||
ld l, e
|
||||
ld h, d
|
||||
pop de
|
||||
ld b, 0
|
||||
inc c
|
||||
call CopyBytes
|
||||
ret
|
||||
.notblank
|
||||
pop bc
|
||||
pop hl
|
||||
ret
|
||||
; 2f17
|
||||
|
@ -1054,7 +1054,7 @@ Text_0A: ; 14ed
|
||||
push bc
|
||||
call GetJoypadPublic
|
||||
ld a, [hJoyDown]
|
||||
and BUTTON_A | BUTTON_B
|
||||
and A_BUTTON | B_BUTTON
|
||||
jr nz, .asm_14fd
|
||||
ld c, 30
|
||||
call DelayFrames
|
||||
@ -1136,7 +1136,7 @@ Text_0C: ; 1543
|
||||
ld [hli], a
|
||||
call GetJoypadPublic
|
||||
ld a, [hJoyDown]
|
||||
and BUTTON_A | BUTTON_B
|
||||
and A_BUTTON | B_BUTTON
|
||||
jr nz, .asm_155a
|
||||
ld c, 10
|
||||
call DelayFrames
|
922
predef/cgb.asm
Normal file
922
predef/cgb.asm
Normal file
@ -0,0 +1,922 @@
|
||||
; Replaces the functionality of sgb.asm to work with CGB hardware.
|
||||
|
||||
CheckCGB: ; 8d55
|
||||
ld a, [hCGB]
|
||||
and a
|
||||
ret
|
||||
; 8d59
|
||||
|
||||
Function8d59: ; 8d59
|
||||
ld a, b
|
||||
cp $ff
|
||||
jr nz, .asm_8d61
|
||||
ld a, [SGBPredef]
|
||||
|
||||
.asm_8d61
|
||||
cp $fc
|
||||
jp z, Function96f3
|
||||
call Function9673
|
||||
ld l, a
|
||||
ld h, 0
|
||||
add hl, hl
|
||||
ld de, Table8d7a
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
ld de, Function8d79
|
||||
push de
|
||||
jp [hl]
|
||||
; 8d79
|
||||
|
||||
Function8d79: ; 8d79
|
||||
ret
|
||||
; 8d7a
|
||||
|
||||
Table8d7a: ; 8d7a
|
||||
dw Function8db8
|
||||
dw Function8ddb
|
||||
dw Function8eb9
|
||||
dw Function8edb
|
||||
dw Function8f70
|
||||
dw Function906e
|
||||
dw Function90f8
|
||||
dw Function9122
|
||||
dw Function91ad
|
||||
dw Function91c8
|
||||
dw Function91d1
|
||||
dw Function91e4
|
||||
dw Function9228
|
||||
dw Function9251
|
||||
dw Function9373
|
||||
dw Function93a6
|
||||
dw Function93ba
|
||||
dw Function9195
|
||||
dw Function9499
|
||||
dw Function94d0
|
||||
dw Function93d3
|
||||
dw Function9289
|
||||
dw Function903e
|
||||
dw Function8fca
|
||||
dw Function925e
|
||||
dw Function94fa
|
||||
dw Function9529
|
||||
dw Function9555
|
||||
dw Function9578
|
||||
dw Function9591
|
||||
dw Function9542
|
||||
; 8db8
|
||||
|
||||
Function8db8: ; 8db8
|
||||
ld hl, $5c67
|
||||
ld de, $d000
|
||||
ld c, $4
|
||||
call $5615
|
||||
ld hl, $5c67
|
||||
ld de, $d020
|
||||
ld c, $4
|
||||
call $5615
|
||||
ld hl, $5c67
|
||||
ld de, MartPointer
|
||||
ld c, $2
|
||||
call $5615
|
||||
jr Function8e23
|
||||
|
||||
Function8ddb: ; 8ddb
|
||||
ld de, $d000
|
||||
call Function9729
|
||||
push hl
|
||||
call Function9643
|
||||
call Function973a
|
||||
push hl
|
||||
call Function9643
|
||||
ld a, [EnemyHPPal]
|
||||
ld l, a
|
||||
ld h, $0
|
||||
add hl, hl
|
||||
add hl, hl
|
||||
ld bc, $68be
|
||||
add hl, bc
|
||||
call Function9643
|
||||
ld a, [PlayerHPPal]
|
||||
ld l, a
|
||||
ld h, $0
|
||||
add hl, hl
|
||||
add hl, hl
|
||||
ld bc, $68be
|
||||
add hl, bc
|
||||
call Function9643
|
||||
ld hl, $68ca
|
||||
call Function9643
|
||||
ld de, MartPointer
|
||||
pop hl
|
||||
call Function9643
|
||||
pop hl
|
||||
call Function9643
|
||||
ld a, $1
|
||||
ld [SGBPredef], a
|
||||
call Function96a4
|
||||
|
||||
Function8e23: ; 8e23
|
||||
call Function8e85
|
||||
ld hl, AttrMap
|
||||
ld bc, $0168
|
||||
ld a, $2
|
||||
call ByteFill
|
||||
ld hl, $ce29
|
||||
ld bc, $080a
|
||||
ld a, $0
|
||||
call Function9663
|
||||
ld hl, $cde3
|
||||
ld bc, $070a
|
||||
ld a, $1
|
||||
call Function9663
|
||||
ld hl, AttrMap
|
||||
ld bc, $040a
|
||||
ld a, $2
|
||||
call Function9663
|
||||
ld hl, $ce6f
|
||||
ld bc, $050a
|
||||
ld a, $3
|
||||
call Function9663
|
||||
ld hl, $cebf
|
||||
ld bc, $0109
|
||||
ld a, $4
|
||||
call Function9663
|
||||
ld hl, $cec9
|
||||
ld bc, $0078
|
||||
ld a, $7
|
||||
call ByteFill
|
||||
ld hl, $579c
|
||||
ld de, $d050
|
||||
ld bc, $0030
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
call Function96b3
|
||||
ret
|
||||
; 8e85
|
||||
|
||||
|
||||
Function8e85: ; 8e85
|
||||
ld a, $40
|
||||
ld hl, $4dc0
|
||||
rst FarCall
|
||||
ld hl, $7311
|
||||
jr nc, .asm_8e93
|
||||
ld hl, $7309
|
||||
|
||||
.asm_8e93
|
||||
ld de, $d038
|
||||
ld bc, $0008
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
ret
|
||||
; 8e9f
|
||||
|
||||
Function8e9f: ; 8e9f
|
||||
callba Function100dc0
|
||||
ld hl, $7311
|
||||
jr nc, .asm_8ead
|
||||
ld hl, $7309
|
||||
|
||||
.asm_8ead
|
||||
ld de, $d000
|
||||
ld bc, $0008
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
ret
|
||||
; 8eb9
|
||||
|
||||
Function8eb9: ; 8eb9
|
||||
ld a, [PlayerGender]
|
||||
bit 0, a
|
||||
jr z, .asm_8ec5
|
||||
ld hl, $7759
|
||||
jr .asm_8ec8
|
||||
|
||||
.asm_8ec5
|
||||
ld hl, $7729
|
||||
|
||||
.asm_8ec8
|
||||
ld de, $d000
|
||||
ld bc, $0030
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
call Function96a4
|
||||
ld a, $1
|
||||
ld [hCGBPalUpdate], a
|
||||
ret
|
||||
; 8edb
|
||||
|
||||
Function8edb: ; 8edb
|
||||
ld de, $d000
|
||||
ld a, [$cda1]
|
||||
ld l, a
|
||||
ld h, $0
|
||||
add hl, hl
|
||||
add hl, hl
|
||||
ld bc, $68be
|
||||
add hl, bc
|
||||
call Function9643
|
||||
ld a, [CurPartySpecies]
|
||||
ld bc, TempMonDVs
|
||||
call Function974b
|
||||
call Function9643
|
||||
ld hl, $68ca
|
||||
call Function9643
|
||||
ld hl, $4f52
|
||||
ld de, $d018
|
||||
ld bc, $0018
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
call Function9699
|
||||
ld hl, AttrMap
|
||||
ld bc, $0814
|
||||
ld a, $1
|
||||
call Function9663
|
||||
ld hl, $cf23
|
||||
ld bc, $000a
|
||||
ld a, $2
|
||||
call ByteFill
|
||||
ld hl, $ce4a
|
||||
ld bc, $0202
|
||||
ld a, $3
|
||||
call Function9663
|
||||
ld hl, $ce4c
|
||||
ld bc, $0202
|
||||
ld a, $4
|
||||
call Function9663
|
||||
ld hl, $ce4e
|
||||
ld bc, $0202
|
||||
ld a, $5
|
||||
call Function9663
|
||||
call Function96b3
|
||||
call Function96a4
|
||||
ld a, $1
|
||||
ld [hCGBPalUpdate], a
|
||||
ret
|
||||
; 8f52
|
||||
|
||||
INCBIN "baserom.gbc", $8f52, $8f70 - $8f52
|
||||
|
||||
Function8f70: ; 8f70
|
||||
ld de, Unkn1Pals
|
||||
ld a, $1d
|
||||
call Function9625
|
||||
call Function9630
|
||||
ld a, [CurPartySpecies]
|
||||
cp $ff
|
||||
jr nz, .asm_8f8a
|
||||
ld hl, $4fba
|
||||
call Function9630
|
||||
jr .asm_8f90
|
||||
|
||||
.asm_8f8a
|
||||
call Function9775
|
||||
call Function9643
|
||||
|
||||
.asm_8f90
|
||||
call Function9699
|
||||
ld hl, $cdee
|
||||
ld bc, $0707
|
||||
ld a, $1
|
||||
call Function9663
|
||||
call Function971a
|
||||
ld hl, $4fc2
|
||||
ld de, $d078
|
||||
ld bc, $0008
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
call Function96b3
|
||||
call Function96a4
|
||||
ld a, $1
|
||||
ld [hCGBPalUpdate], a
|
||||
ret
|
||||
; 8fba
|
||||
|
||||
INCBIN "baserom.gbc", $8fba, $8fca - $8fba
|
||||
|
||||
Function8fca: ; 8fca
|
||||
ld de, Unkn1Pals
|
||||
ld a, $1d
|
||||
call Function9625
|
||||
call Function9630
|
||||
ld a, [CurPartySpecies]
|
||||
cp $ff
|
||||
jr nz, .asm_8fe4
|
||||
ld hl, $5036
|
||||
call Function9630
|
||||
jr .asm_8fed
|
||||
|
||||
.asm_8fe4
|
||||
ld bc, TempMonDVs
|
||||
call Function974b
|
||||
call Function9643
|
||||
|
||||
.asm_8fed
|
||||
call Function9699
|
||||
ld hl, $ce2a
|
||||
ld bc, $0707
|
||||
ld a, $1
|
||||
call Function9663
|
||||
call Function971a
|
||||
call Function96b3
|
||||
call Function96a4
|
||||
ld a, $1
|
||||
ld [hCGBPalUpdate], a
|
||||
ret
|
||||
; 9009
|
||||
|
||||
INCBIN "baserom.gbc", $9009, $903e - $9009
|
||||
|
||||
Function903e: ; 903e
|
||||
ld de, Unkn1Pals
|
||||
ld a, $1d
|
||||
call Function9625
|
||||
call Function9630
|
||||
ld a, [CurPartySpecies]
|
||||
call Function9775
|
||||
call Function9643
|
||||
call Function9699
|
||||
ld hl, $ce44
|
||||
ld bc, $0707
|
||||
ld a, $1
|
||||
call Function9663
|
||||
call Function971a
|
||||
call Function96b3
|
||||
call Function96a4
|
||||
ld a, $1
|
||||
ld [hCGBPalUpdate], a
|
||||
ret
|
||||
; 906e
|
||||
|
||||
Function906e: ; 906e
|
||||
ld hl, $77a9
|
||||
ld de, Unkn1Pals
|
||||
ld bc, $0080
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
call Function9699
|
||||
ld hl, $ce01
|
||||
ld bc, $0a03
|
||||
ld a, $2
|
||||
call Function9663
|
||||
ld hl, $ce12
|
||||
ld bc, $0a03
|
||||
ld a, $2
|
||||
call Function9663
|
||||
ld hl, $ce29
|
||||
ld bc, $0603
|
||||
ld a, $3
|
||||
call Function9663
|
||||
ld hl, $ce3a
|
||||
ld bc, $0603
|
||||
ld a, $3
|
||||
call Function9663
|
||||
ld hl, $ce51
|
||||
ld bc, $0203
|
||||
ld a, $4
|
||||
call Function9663
|
||||
ld hl, $ce62
|
||||
ld bc, $0203
|
||||
ld a, $4
|
||||
call Function9663
|
||||
ld hl, $ce05
|
||||
ld bc, $020c
|
||||
ld a, $1
|
||||
call Function9663
|
||||
ld hl, $ce04
|
||||
ld bc, $0a01
|
||||
ld a, $1
|
||||
call Function9663
|
||||
ld hl, $ce11
|
||||
ld bc, $0a01
|
||||
ld a, $1
|
||||
call Function9663
|
||||
ld hl, $cec9
|
||||
ld bc, $0078
|
||||
ld a, $7
|
||||
call ByteFill
|
||||
call Function96b3
|
||||
call Function96a4
|
||||
ld a, $1
|
||||
ld [hCGBPalUpdate], a
|
||||
ret
|
||||
; 90f8
|
||||
|
||||
Function90f8: ; 90f8
|
||||
ld hl, $5ca7
|
||||
call Function9610
|
||||
call Function9699
|
||||
ld de, Unkn2Pals
|
||||
ld a, $3c
|
||||
call Function9625
|
||||
call Function9630
|
||||
ld hl, $ce51
|
||||
ld bc, $0c14
|
||||
ld a, $1
|
||||
call Function9663
|
||||
call Function96b3
|
||||
call Function96a4
|
||||
ld a, $1
|
||||
ld [hCGBPalUpdate], a
|
||||
ret
|
||||
; 9122
|
||||
|
||||
Function9122: ; 9122
|
||||
ld b, $0
|
||||
ld hl, $512d
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
jp [hl]
|
||||
; 912d
|
||||
|
||||
INCBIN "baserom.gbc", $912d, $9195 - $912d
|
||||
|
||||
Function9195: ; 9195
|
||||
ld hl, $7789
|
||||
ld de, Unkn1Pals
|
||||
ld bc, $0028
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
call Function96a4
|
||||
call Function9699
|
||||
call Function96b3
|
||||
ret
|
||||
; 91ad
|
||||
|
||||
Function91ad: ; 91ad
|
||||
ld hl, $7641
|
||||
ld de, Unkn1Pals
|
||||
ld bc, $0080
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
ld hl, $5cb7
|
||||
call Function9610
|
||||
call Function9699
|
||||
call Function96b3
|
||||
ret
|
||||
; 91c8
|
||||
|
||||
Function91c8: ; 91c8
|
||||
call Functionb1de
|
||||
ld a, $9
|
||||
ld [SGBPredef], a
|
||||
ret
|
||||
; 91d1
|
||||
|
||||
Function91d1: ; 91d1
|
||||
ld hl, $5c57
|
||||
call Function9610
|
||||
call Function8e9f
|
||||
call Function8e85
|
||||
call Function971a
|
||||
call Function96b3
|
||||
ret
|
||||
; 91e4
|
||||
|
||||
Function91e4: ; 91e4
|
||||
ld de, Unkn1Pals
|
||||
ld a, c
|
||||
and a
|
||||
jr z, .asm_91f5
|
||||
ld a, $1a
|
||||
call Function9625
|
||||
call Function9630
|
||||
jr .asm_921a
|
||||
|
||||
.asm_91f5
|
||||
ld hl, PartyMon1DVs
|
||||
ld bc, $0030
|
||||
ld a, [CurPartyMon]
|
||||
call AddNTimes
|
||||
ld c, l
|
||||
ld b, h
|
||||
ld a, [PlayerHPPal]
|
||||
call Function974b
|
||||
call Function9643
|
||||
ld hl, $579c
|
||||
ld de, $d050
|
||||
ld bc, $0030
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
|
||||
.asm_921a
|
||||
call Function9699
|
||||
call Function96b3
|
||||
call Function96a4
|
||||
ld a, $1
|
||||
ld [hCGBPalUpdate], a
|
||||
ret
|
||||
; 9228
|
||||
|
||||
Function9228: ; 9228
|
||||
ld hl, $76f1
|
||||
ld de, Unkn1Pals
|
||||
ld bc, $0028
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
ld hl, $7719
|
||||
ld de, Unkn2Pals
|
||||
ld bc, $0010
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
ld a, $8
|
||||
ld [SGBPredef], a
|
||||
call Function96a4
|
||||
ld a, $1
|
||||
ld [hCGBPalUpdate], a
|
||||
ret
|
||||
; 9251
|
||||
|
||||
Function9251: ; 9251
|
||||
ld hl, $5cb7
|
||||
call Function9610
|
||||
call Function9699
|
||||
call Function96b3
|
||||
ret
|
||||
; 925e
|
||||
|
||||
Function925e: ; 925e
|
||||
ld hl, $5bc7
|
||||
call Function9610
|
||||
ld de, Unkn2Pals
|
||||
ld a, $4c
|
||||
call Function9625
|
||||
call Function9630
|
||||
ld a, [rSVBK]
|
||||
push af
|
||||
ld a, $5
|
||||
ld [rSVBK], a
|
||||
ld hl, Unkn2Pals
|
||||
ld a, $1f
|
||||
ld [hli], a
|
||||
ld a, $0
|
||||
ld [hl], a
|
||||
pop af
|
||||
ld [rSVBK], a
|
||||
call Function9699
|
||||
call Function96b3
|
||||
ret
|
||||
; 9289
|
||||
|
||||
Function9289: ; 9289
|
||||
ld de, Unkn1Pals
|
||||
xor a
|
||||
call Function976b
|
||||
call Function9643
|
||||
ld a, $1
|
||||
call Function976b
|
||||
call Function9643
|
||||
ld a, $3
|
||||
call Function976b
|
||||
call Function9643
|
||||
ld a, $2
|
||||
call Function976b
|
||||
call Function9643
|
||||
ld a, $4
|
||||
call Function976b
|
||||
call Function9643
|
||||
ld a, $7
|
||||
call Function976b
|
||||
call Function9643
|
||||
ld a, $6
|
||||
call Function976b
|
||||
call Function9643
|
||||
ld a, $5
|
||||
call Function976b
|
||||
call Function9643
|
||||
ld a, $24
|
||||
call Function9625
|
||||
call Function9630
|
||||
ld hl, AttrMap
|
||||
ld bc, $0168
|
||||
ld a, [PlayerGender]
|
||||
and a
|
||||
ld a, $1
|
||||
jr z, .asm_92e3
|
||||
ld a, $0
|
||||
|
||||
.asm_92e3
|
||||
call ByteFill
|
||||
ld hl, $cdfb
|
||||
ld bc, $0705
|
||||
ld a, [PlayerGender]
|
||||
and a
|
||||
ld a, $0
|
||||
jr z, .asm_92f6
|
||||
ld a, $1
|
||||
|
||||
.asm_92f6
|
||||
call Function9663
|
||||
ld hl, $cdff
|
||||
ld [hl], $1
|
||||
ld hl, $ceb7
|
||||
ld bc, $0204
|
||||
ld a, $1
|
||||
call Function9663
|
||||
ld hl, $cebb
|
||||
ld bc, $0204
|
||||
ld a, $2
|
||||
call Function9663
|
||||
ld hl, $cebf
|
||||
ld bc, $0204
|
||||
ld a, $3
|
||||
call Function9663
|
||||
ld hl, $cec3
|
||||
ld bc, $0204
|
||||
ld a, $4
|
||||
call Function9663
|
||||
ld hl, $cef3
|
||||
ld bc, $0204
|
||||
ld a, $5
|
||||
call Function9663
|
||||
ld hl, $cef7
|
||||
ld bc, $0204
|
||||
ld a, $6
|
||||
call Function9663
|
||||
ld hl, $cefb
|
||||
ld bc, $0204
|
||||
ld a, $7
|
||||
call Function9663
|
||||
ld a, [PlayerGender]
|
||||
and a
|
||||
push af
|
||||
jr z, .asm_935d
|
||||
ld hl, $ceff
|
||||
ld bc, $0204
|
||||
ld a, $1
|
||||
call Function9663
|
||||
|
||||
.asm_935d
|
||||
pop af
|
||||
ld c, $0
|
||||
jr nz, .asm_9363
|
||||
inc c
|
||||
|
||||
.asm_9363
|
||||
ld a, c
|
||||
ld hl, $cdff
|
||||
ld [hl], a
|
||||
call Function96b3
|
||||
call Function96a4
|
||||
ld a, $1
|
||||
ld [hCGBPalUpdate], a
|
||||
ret
|
||||
; 9373
|
||||
|
||||
Function9373: ; 9373
|
||||
ld de, Unkn1Pals
|
||||
ld a, $10
|
||||
call Function9625
|
||||
call Function9630
|
||||
ld a, [PlayerHPPal]
|
||||
ld l, a
|
||||
ld h, $0
|
||||
add hl, hl
|
||||
add hl, hl
|
||||
ld bc, $68be
|
||||
add hl, bc
|
||||
call Function9643
|
||||
call Function9699
|
||||
ld hl, $cdf8
|
||||
ld bc, $0209
|
||||
ld a, $1
|
||||
call Function9663
|
||||
call Function96b3
|
||||
call Function96a4
|
||||
ld a, $1
|
||||
ld [hCGBPalUpdate], a
|
||||
ret
|
||||
; 93a6
|
||||
|
||||
Function93a6: ; 93a6
|
||||
ld hl, $5c47
|
||||
call Function9610
|
||||
call Function9699
|
||||
call Function96b3
|
||||
call Function96a4
|
||||
ld a, $1
|
||||
ld [hCGBPalUpdate], a
|
||||
ret
|
||||
; 93ba
|
||||
|
||||
Function93ba: ; 93ba
|
||||
ld de, Unkn1Pals
|
||||
ld a, $1d
|
||||
call Function9625
|
||||
call Function9630
|
||||
call Function9699
|
||||
call Function96b3
|
||||
call Function96a4
|
||||
ld a, $1
|
||||
ld [hCGBPalUpdate], a
|
||||
ret
|
||||
; 93d3
|
||||
|
||||
Function93d3: ; 93d3
|
||||
ld a, [BattleType]
|
||||
cp $3
|
||||
jr z, .asm_93e6
|
||||
ld a, [PlayerGender]
|
||||
bit 0, a
|
||||
jr z, .asm_93e6
|
||||
ld hl, $5469
|
||||
jr .asm_93e9
|
||||
|
||||
.asm_93e6
|
||||
ld hl, $5439
|
||||
|
||||
.asm_93e9
|
||||
ld de, Unkn1Pals
|
||||
ld bc, $0040
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
call Function9699
|
||||
ld hl, AttrMap
|
||||
ld bc, $010a
|
||||
ld a, $1
|
||||
call Function9663
|
||||
ld hl, $cde3
|
||||
ld bc, $010a
|
||||
ld a, $2
|
||||
call Function9663
|
||||
ld hl, $ce08
|
||||
ld bc, $0901
|
||||
ld a, $3
|
||||
call Function9663
|
||||
ld hl, $ce65
|
||||
ld bc, $0305
|
||||
ld a, $4
|
||||
call Function9663
|
||||
ld hl, $ce15
|
||||
ld bc, $0305
|
||||
ld a, $5
|
||||
call Function9663
|
||||
call Function96b3
|
||||
call Function96a4
|
||||
ld a, $1
|
||||
ld [hCGBPalUpdate], a
|
||||
ret
|
||||
; 9439
|
||||
|
||||
INCBIN "baserom.gbc", $9439, $9499 - $9439
|
||||
|
||||
Function9499: ; 9499
|
||||
call Function91c8
|
||||
ld de, $0014
|
||||
ld hl, AttrMap
|
||||
ld a, [$cf82]
|
||||
.asm_94a5
|
||||
and a
|
||||
jr z, .asm_94ac
|
||||
dec a
|
||||
add hl, de
|
||||
jr .asm_94a5
|
||||
|
||||
.asm_94ac
|
||||
ld a, [$cf83]
|
||||
ld e, a
|
||||
ld d, $0
|
||||
add hl, de
|
||||
ld a, [$cf82]
|
||||
ld b, a
|
||||
ld a, [$cf84]
|
||||
inc a
|
||||
sub b
|
||||
ld b, a
|
||||
ld a, [$cf83]
|
||||
ld c, a
|
||||
ld a, [$cf85]
|
||||
sub c
|
||||
inc a
|
||||
ld c, a
|
||||
ld a, $0
|
||||
call Function9663
|
||||
call Function96b3
|
||||
ret
|
||||
; 94d0
|
||||
|
||||
Function94d0: ; 94d0
|
||||
ld hl, $5ba7
|
||||
call Function9610
|
||||
call Function9699
|
||||
ld hl, $ce29
|
||||
ld bc, $0a14
|
||||
ld a, $2
|
||||
call Function9663
|
||||
ld hl, $ce51
|
||||
ld bc, $0614
|
||||
ld a, $1
|
||||
call Function9663
|
||||
call Function96b3
|
||||
call Function96a4
|
||||
ld a, $1
|
||||
ld [hCGBPalUpdate], a
|
||||
ret
|
||||
; 94fa
|
||||
|
||||
Function94fa: ; 94fa
|
||||
ld de, Unkn1Pals
|
||||
ld a, $4e
|
||||
call Function9625
|
||||
call Function9630
|
||||
ld hl, $5521
|
||||
ld de, Unkn2Pals
|
||||
call Function9630
|
||||
ld hl, $5521
|
||||
ld de, $d048
|
||||
call Function9630
|
||||
call Function9699
|
||||
call Function96b3
|
||||
call Function96a4
|
||||
ret
|
||||
; 9521
|
||||
|
||||
INCBIN "baserom.gbc", $9521, $9529 - $9521
|
||||
|
||||
Function9529: ; 9529
|
||||
ld de, Unkn1Pals
|
||||
ld a, [CurPartySpecies]
|
||||
ld bc, TempMonDVs
|
||||
call Function974b
|
||||
call Function9643
|
||||
call Function9699
|
||||
call Function96b3
|
||||
call Function96a4
|
||||
ret
|
||||
; 9542
|
||||
|
||||
Function9542: ; 9542
|
||||
ld de, Unkn1Pals
|
||||
ld a, [CurPartySpecies]
|
||||
call Function9775
|
||||
call Function9643
|
||||
call Function9699
|
||||
call Function96b3
|
||||
ret
|
||||
; 9555
|
||||
|
||||
Function9555: ; 9555
|
||||
ld hl, $5cc7
|
||||
call Function9610
|
||||
ld hl, $7681
|
||||
ld de, Unkn2Pals
|
||||
ld bc, $0008
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
ld de, $d078
|
||||
ld a, $1c
|
||||
call Function9625
|
||||
call Function9630
|
||||
call Function9699
|
||||
ret
|
||||
; 9578
|
||||
|
||||
Function9578: ; 9578
|
||||
ld de, Unkn1Pals
|
||||
ld a, [CurPartySpecies]
|
||||
ld bc, TempMonDVs
|
||||
call Function9764
|
||||
call Function9643
|
||||
call Function9699
|
||||
call Function96b3
|
||||
call Function96a4
|
||||
ret
|
||||
; 9591
|
||||
|
||||
Function9591: ; 9591
|
||||
ld hl, $55e0
|
||||
ld de, Unkn1Pals
|
||||
ld bc, $0010
|
||||
ld a, $5
|
||||
call FarCopyWRAM
|
||||
call Function96a4
|
||||
call Function9699
|
||||
ld hl, $ce68
|
||||
ld bc, $080e
|
||||
ld a, $1
|
||||
call Function9663
|
||||
ld hl, $ce3e
|
||||
ld bc, $0112
|
||||
ld a, $1
|
||||
call Function9663
|
||||
ld hl, $cf1a
|
||||
ld bc, $0112
|
||||
ld a, $1
|
||||
call Function9663
|
||||
ld hl, AttrMap
|
||||
ld bc, $1102
|
||||
ld a, $1
|
||||
call Function9663
|
||||
ld hl, $ce4f
|
||||
ld bc, $0c01
|
||||
ld a, $1
|
||||
call Function9663
|
||||
call Function96b3
|
||||
ret
|
||||
; 95e0
|
||||
|
591
predef/sgb.asm
Normal file
591
predef/sgb.asm
Normal file
@ -0,0 +1,591 @@
|
||||
Function864c: ; 864c
|
||||
; LoadSGBLayout
|
||||
call CheckCGB
|
||||
jp nz, Function8d59
|
||||
|
||||
ld a, b
|
||||
cp $ff
|
||||
jr nz, .asm_865a
|
||||
ld a, [SGBPredef]
|
||||
|
||||
.asm_865a
|
||||
cp $fc
|
||||
jp z, Function8ade
|
||||
ld l, a
|
||||
ld h, 0
|
||||
add hl, hl
|
||||
ld de, Table866f
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
ld de, Function8a60
|
||||
push de
|
||||
jp [hl]
|
||||
; 866f
|
||||
|
||||
Table866f: ; 866f
|
||||
dw Function86ad
|
||||
dw Function86b4
|
||||
dw Function875c
|
||||
dw Function8763
|
||||
dw Function87b2
|
||||
dw Function8852
|
||||
dw Function8859
|
||||
dw Function8867
|
||||
dw Function8860
|
||||
dw Function88b1
|
||||
dw Function87ab
|
||||
dw Function88cd
|
||||
dw Function8884
|
||||
dw Function891a
|
||||
dw Function873c
|
||||
dw Function8897
|
||||
dw Function882a
|
||||
dw Function889e
|
||||
dw Function8928
|
||||
dw Function8890
|
||||
dw Function884b
|
||||
dw Function891a
|
||||
dw Function8823
|
||||
dw Function87e9
|
||||
dw Function8921
|
||||
dw Function89a6
|
||||
dw Function89ad
|
||||
dw Function89d9
|
||||
dw Function89e0
|
||||
dw Function8860
|
||||
dw Function8969
|
||||
; 86ad
|
||||
|
||||
Function86ad: ; 86ad
|
||||
ld hl, $5c66
|
||||
ld de, $5aa6
|
||||
ret
|
||||
; 86b4
|
||||
|
||||
Function86b4: ; 86b4
|
||||
ld hl, $5aa6
|
||||
call Function9809
|
||||
ld hl, $5ce6
|
||||
ld de, $cda9
|
||||
ld bc, $0010
|
||||
call CopyBytes
|
||||
ld a, [PlayerHPPal]
|
||||
ld l, a
|
||||
ld h, $0
|
||||
add hl, hl
|
||||
add hl, hl
|
||||
ld de, $68be
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld [$cdac], a
|
||||
ld a, [hli]
|
||||
ld [$cdad], a
|
||||
ld a, [hli]
|
||||
ld [$cdae], a
|
||||
ld a, [hl]
|
||||
ld [$cdaf], a
|
||||
ld a, [EnemyHPPal]
|
||||
ld l, a
|
||||
ld h, $0
|
||||
add hl, hl
|
||||
add hl, hl
|
||||
ld de, $68be
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld [$cdb2], a
|
||||
ld a, [hli]
|
||||
ld [$cdb3], a
|
||||
ld a, [hli]
|
||||
ld [$cdb4], a
|
||||
ld a, [hl]
|
||||
ld [$cdb5], a
|
||||
ld hl, $5cf6
|
||||
ld de, $cdb9
|
||||
ld bc, $0010
|
||||
call CopyBytes
|
||||
call Function9729
|
||||
ld a, [hli]
|
||||
ld [$cdbc], a
|
||||
ld a, [hli]
|
||||
ld [$cdbd], a
|
||||
ld a, [hli]
|
||||
ld [$cdbe], a
|
||||
ld a, [hl]
|
||||
ld [$cdbf], a
|
||||
call Function973a
|
||||
ld a, [hli]
|
||||
ld [$cdc2], a
|
||||
ld a, [hli]
|
||||
ld [$cdc3], a
|
||||
ld a, [hli]
|
||||
ld [$cdc4], a
|
||||
ld a, [hl]
|
||||
ld [$cdc5], a
|
||||
ld hl, $cda9
|
||||
ld de, $cdb9
|
||||
ld a, $1
|
||||
ld [SGBPredef], a
|
||||
ret
|
||||
; 873c
|
||||
|
||||
Function873c: ; 873c
|
||||
ld hl, $5bd6
|
||||
ld de, $cda9
|
||||
ld bc, $0010
|
||||
call CopyBytes
|
||||
ld hl, $cdaa
|
||||
ld [hl], $10
|
||||
inc hl
|
||||
inc hl
|
||||
ld a, [PlayerHPPal]
|
||||
add $2f
|
||||
ld [hl], a
|
||||
ld hl, $cda9
|
||||
ld de, $5ad6
|
||||
ret
|
||||
; 875c
|
||||
|
||||
Function875c: ; 875c
|
||||
ld hl, $5c76
|
||||
ld de, $5a86
|
||||
ret
|
||||
; 8763
|
||||
|
||||
Function8763: ; 8763
|
||||
ld hl, $5ce6
|
||||
ld de, $cda9
|
||||
ld bc, $0010
|
||||
call CopyBytes
|
||||
ld a, [$cda1]
|
||||
ld l, a
|
||||
ld h, $0
|
||||
add hl, hl
|
||||
add hl, hl
|
||||
ld de, $68be
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld [$cdac], a
|
||||
ld a, [hli]
|
||||
ld [$cdad], a
|
||||
ld a, [hli]
|
||||
ld [$cdae], a
|
||||
ld a, [hl]
|
||||
ld [$cdaf], a
|
||||
ld a, [CurPartySpecies]
|
||||
ld bc, TempMonDVs
|
||||
call Function974b
|
||||
ld a, [hli]
|
||||
ld [$cdb2], a
|
||||
ld a, [hli]
|
||||
ld [$cdb3], a
|
||||
ld a, [hli]
|
||||
ld [$cdb4], a
|
||||
ld a, [hl]
|
||||
ld [$cdb5], a
|
||||
ld hl, $cda9
|
||||
ld de, $5ac6
|
||||
ret
|
||||
; 87ab
|
||||
|
||||
Function87ab: ; 87ab
|
||||
ld hl, $5c56
|
||||
ld de, $cdaa
|
||||
ret
|
||||
; 87b2
|
||||
|
||||
Function87b2: ; 87b2
|
||||
ld hl, $5ce6
|
||||
ld de, $cda9
|
||||
ld bc, $0010
|
||||
call CopyBytes
|
||||
ld hl, $cdac
|
||||
ld [hl], $9f
|
||||
inc hl
|
||||
ld [hl], $2a
|
||||
inc hl
|
||||
ld [hl], $5a
|
||||
inc hl
|
||||
ld [hl], $19
|
||||
ld a, [CurPartySpecies]
|
||||
call Function9775
|
||||
ld a, [hli]
|
||||
ld [$cdb2], a
|
||||
ld a, [hli]
|
||||
ld [$cdb3], a
|
||||
ld a, [hli]
|
||||
ld [$cdb4], a
|
||||
ld a, [hl]
|
||||
ld [$cdb5], a
|
||||
ld hl, $cda9
|
||||
ld de, $5ae6
|
||||
ret
|
||||
; 87e9
|
||||
|
||||
Function87e9: ; 87e9
|
||||
ld hl, $5ce6
|
||||
ld de, $cda9
|
||||
ld bc, $0010
|
||||
call CopyBytes
|
||||
ld hl, $cdac
|
||||
ld [hl], $9f
|
||||
inc hl
|
||||
ld [hl], $2a
|
||||
inc hl
|
||||
ld [hl], $5a
|
||||
inc hl
|
||||
ld [hl], $19
|
||||
ld a, [CurPartySpecies]
|
||||
ld bc, TempMonDVs
|
||||
call Function974b
|
||||
ld a, [hli]
|
||||
ld [$cdb2], a
|
||||
ld a, [hli]
|
||||
ld [$cdb3], a
|
||||
ld a, [hli]
|
||||
ld [$cdb4], a
|
||||
ld a, [hl]
|
||||
ld [$cdb5], a
|
||||
ld hl, $cda9
|
||||
ld de, $5ae6
|
||||
ret
|
||||
; 8823
|
||||
|
||||
Function8823: ; 8823
|
||||
call Function87b2
|
||||
ld de, $5af6
|
||||
ret
|
||||
; 882a
|
||||
|
||||
Function882a: ; 882a
|
||||
ld hl, $5ce6
|
||||
ld de, $cda9
|
||||
ld bc, $0010
|
||||
call CopyBytes
|
||||
ld hl, $cdac
|
||||
ld [hl], $9f
|
||||
inc hl
|
||||
ld [hl], $2a
|
||||
inc hl
|
||||
ld [hl], $5a
|
||||
inc hl
|
||||
ld [hl], $19
|
||||
ld hl, $cda9
|
||||
ld de, $5a86
|
||||
ret
|
||||
; 884b
|
||||
|
||||
Function884b: ; 884b
|
||||
ld hl, $5c36
|
||||
ld de, $5a86
|
||||
ret
|
||||
; 8852
|
||||
|
||||
Function8852: ; 8852
|
||||
ld hl, $5c96
|
||||
ld de, $5b06
|
||||
ret
|
||||
; 8859
|
||||
|
||||
Function8859: ; 8859
|
||||
ld hl, $5ca6
|
||||
ld de, $5b76
|
||||
ret
|
||||
; 8860
|
||||
|
||||
Function8860: ; 8860
|
||||
ld hl, $5cb6
|
||||
ld de, $5a86
|
||||
ret
|
||||
; 8867
|
||||
|
||||
Function8867: ; 8867
|
||||
ld b, $0
|
||||
ld hl, $4878
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
add hl, bc
|
||||
ld e, [hl]
|
||||
inc hl
|
||||
ld d, [hl]
|
||||
inc hl
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
ret
|
||||
; 8878
|
||||
|
||||
INCBIN "baserom.gbc", $8878, $8884 - $8878
|
||||
|
||||
Function8884: ; 8884
|
||||
ld hl, $5b96
|
||||
ld de, $5b56
|
||||
ld a, $8
|
||||
ld [SGBPredef], a
|
||||
ret
|
||||
; 8890
|
||||
|
||||
Function8890: ; 8890
|
||||
ld hl, $5ba6
|
||||
ld de, $5b86
|
||||
ret
|
||||
; 8897
|
||||
|
||||
Function8897: ; 8897
|
||||
ld hl, $5c46
|
||||
ld de, $5a86
|
||||
ret
|
||||
; 889e
|
||||
|
||||
Function889e: ; 889e
|
||||
ld hl, $5a86
|
||||
ld de, PlayerLightScreenCount
|
||||
ld bc, $0010
|
||||
call CopyBytes
|
||||
ld hl, $5bb6
|
||||
ld de, $5a86
|
||||
ret
|
||||
; 88b1
|
||||
|
||||
Function88b1: ; 88b1
|
||||
ld hl, $5bd6
|
||||
ld de, $cda9
|
||||
ld bc, $0010
|
||||
call CopyBytes
|
||||
call Function8a0c
|
||||
ld hl, $cdaa
|
||||
ld [hld], a
|
||||
ld de, $5a86
|
||||
ld a, $9
|
||||
ld [SGBPredef], a
|
||||
ret
|
||||
; 88cd
|
||||
|
||||
Function88cd: ; 88cd
|
||||
push bc
|
||||
ld hl, $5ce6
|
||||
ld de, $cda9
|
||||
ld bc, $0010
|
||||
call CopyBytes
|
||||
pop bc
|
||||
ld a, c
|
||||
and a
|
||||
jr z, .asm_88ef
|
||||
ld hl, $cdac
|
||||
ld [hl], $e7
|
||||
inc hl
|
||||
ld [hl], $1c
|
||||
inc hl
|
||||
ld [hl], $62
|
||||
inc hl
|
||||
ld [hl], $c
|
||||
jr .asm_8913
|
||||
|
||||
.asm_88ef
|
||||
ld hl, PartyMon1DVs
|
||||
ld bc, $0030
|
||||
ld a, [CurPartyMon]
|
||||
call AddNTimes
|
||||
ld c, l
|
||||
ld b, h
|
||||
ld a, [PlayerHPPal]
|
||||
call Function974b
|
||||
ld a, [hli]
|
||||
ld [$cdac], a
|
||||
ld a, [hli]
|
||||
ld [$cdad], a
|
||||
ld a, [hli]
|
||||
ld [$cdae], a
|
||||
ld a, [hl]
|
||||
ld [$cdaf], a
|
||||
|
||||
.asm_8913
|
||||
ld hl, $cda9
|
||||
ld de, $5a86
|
||||
ret
|
||||
; 891a
|
||||
|
||||
Function891a: ; 891a
|
||||
ld hl, $5cb6
|
||||
ld de, $5a86
|
||||
ret
|
||||
; 8921
|
||||
|
||||
Function8921: ; 8921
|
||||
ld hl, $5bc6
|
||||
ld de, $5a86
|
||||
ret
|
||||
; 8928
|
||||
|
||||
Function8928: ; 8928
|
||||
ld hl, $5bd6
|
||||
ld de, $cda9
|
||||
ld bc, $0010
|
||||
call CopyBytes
|
||||
ld hl, $5a86
|
||||
ld de, $cdb9
|
||||
ld bc, $0010
|
||||
call CopyBytes
|
||||
call Function8a0c
|
||||
ld hl, $cdaa
|
||||
ld [hl], a
|
||||
ld hl, $cdac
|
||||
ld [hl], $2e
|
||||
ld hl, $cdbc
|
||||
ld a, $5
|
||||
ld [hli], a
|
||||
ld a, [$cf83]
|
||||
ld [hli], a
|
||||
ld a, [$cf82]
|
||||
ld [hli], a
|
||||
ld a, [$cf85]
|
||||
ld [hli], a
|
||||
ld a, [$cf84]
|
||||
ld [hl], a
|
||||
ld hl, $cda9
|
||||
ld de, $cdb9
|
||||
ret
|
||||
; 8969
|
||||
|
||||
Function8969: ; 8969
|
||||
ld hl, $5ce6
|
||||
ld de, $cda9
|
||||
ld bc, $0010
|
||||
call CopyBytes
|
||||
ld a, [CurPartySpecies]
|
||||
ld l, a
|
||||
ld h, $0
|
||||
add hl, hl
|
||||
add hl, hl
|
||||
add hl, hl
|
||||
ld de, $68ce
|
||||
add hl, de
|
||||
ld a, [$cf65]
|
||||
and $3
|
||||
sla a
|
||||
sla a
|
||||
ld c, a
|
||||
ld b, $0
|
||||
add hl, bc
|
||||
ld a, [hli]
|
||||
ld [$cdac], a
|
||||
ld a, [hli]
|
||||
ld [$cdad], a
|
||||
ld a, [hli]
|
||||
ld [$cdae], a
|
||||
ld a, [hl]
|
||||
ld [$cdaf], a
|
||||
ld hl, $cda9
|
||||
ld de, $5a86
|
||||
ret
|
||||
; 89a6
|
||||
|
||||
Function89a6: ; 89a6
|
||||
ld hl, $5cd6
|
||||
ld de, $5a86
|
||||
ret
|
||||
; 89ad
|
||||
|
||||
Function89ad: ; 89ad
|
||||
ld hl, $5ce6
|
||||
ld de, $cda9
|
||||
ld bc, $0010
|
||||
call CopyBytes
|
||||
ld a, [CurPartySpecies]
|
||||
ld bc, TempMonDVs
|
||||
call Function974b
|
||||
ld a, [hli]
|
||||
ld [$cdac], a
|
||||
ld a, [hli]
|
||||
ld [$cdad], a
|
||||
ld a, [hli]
|
||||
ld [$cdae], a
|
||||
ld a, [hl]
|
||||
ld [$cdaf], a
|
||||
ld hl, $cda9
|
||||
ld de, $5a86
|
||||
ret
|
||||
; 89d9
|
||||
|
||||
Function89d9: ; 89d9
|
||||
ld hl, $5cc6
|
||||
ld de, $5a86
|
||||
ret
|
||||
; 89e0
|
||||
|
||||
Function89e0: ; 89e0
|
||||
ld hl, $5ce6
|
||||
ld de, $cda9
|
||||
ld bc, $0010
|
||||
call CopyBytes
|
||||
ld a, [CurPartySpecies]
|
||||
ld bc, TempMonDVs
|
||||
call Function9764
|
||||
ld a, [hli]
|
||||
ld [$cdac], a
|
||||
ld a, [hli]
|
||||
ld [$cdad], a
|
||||
ld a, [hli]
|
||||
ld [$cdae], a
|
||||
ld a, [hl]
|
||||
ld [$cdaf], a
|
||||
ld hl, $cda9
|
||||
ld de, $5a86
|
||||
ret
|
||||
; 8a0c
|
||||
|
||||
Function8a0c: ; 8a0c
|
||||
ld a, [TimeOfDayPal]
|
||||
cp $2
|
||||
jr c, .asm_8a16
|
||||
ld a, $19
|
||||
ret
|
||||
|
||||
.asm_8a16
|
||||
ld a, [$d19a]
|
||||
cp $2
|
||||
jr z, .asm_8a39
|
||||
cp $4
|
||||
jr z, .asm_8a3c
|
||||
cp $7
|
||||
jr z, .asm_8a3c
|
||||
cp $5
|
||||
jr z, .asm_8a3f
|
||||
cp $6
|
||||
jr z, .asm_8a42
|
||||
ld a, [MapGroup]
|
||||
ld e, a
|
||||
ld d, $0
|
||||
ld hl, $4a45
|
||||
add hl, de
|
||||
ld a, [hl]
|
||||
ret
|
||||
|
||||
.asm_8a39
|
||||
ld a, $0
|
||||
ret
|
||||
|
||||
.asm_8a3c
|
||||
ld a, $18
|
||||
ret
|
||||
|
||||
.asm_8a3f
|
||||
ld a, $6
|
||||
ret
|
||||
|
||||
.asm_8a42
|
||||
ld a, $3
|
||||
ret
|
||||
; 8a45
|
||||
|
||||
INCBIN "baserom.gbc", $8a45, $8a60 - $8a45
|
||||
|
||||
Function8a60: ; 8a60
|
||||
push de
|
||||
call Function9809
|
||||
pop hl
|
||||
jp Function9809
|
||||
; 8a68
|
||||
|
@ -45,7 +45,7 @@ GiveOddEgg: ; 1fb4b6
|
||||
ld a, $ff
|
||||
ld [$d107], a
|
||||
ld hl, NumItems
|
||||
call Function2f53
|
||||
call TossItem
|
||||
ld a, EGG
|
||||
ld [$cd2a], a
|
||||
ld a, $29
|
||||
|
162
text/types.asm
Normal file
162
text/types.asm
Normal file
@ -0,0 +1,162 @@
|
||||
PrintMonTypes: ; 5090d
|
||||
; Print both types of CurSpecies on the stats screen at hl.
|
||||
|
||||
push hl
|
||||
call GetBaseData
|
||||
pop hl
|
||||
|
||||
push hl
|
||||
ld a, [BaseType1]
|
||||
call .PrintType
|
||||
|
||||
ld a, [BaseType1]
|
||||
ld b, a
|
||||
ld a, [BaseType2]
|
||||
cp b
|
||||
pop hl
|
||||
jr z, .HideSecondType
|
||||
|
||||
; Next row
|
||||
ld bc, 20
|
||||
add hl, bc
|
||||
|
||||
.PrintType
|
||||
ld b, a
|
||||
jr PrintType
|
||||
|
||||
.HideSecondType
|
||||
; This doesn't actually do anything.
|
||||
ld a, " "
|
||||
ld bc, 20 - 3
|
||||
add hl, bc
|
||||
ld [hl], a
|
||||
inc bc
|
||||
add hl, bc
|
||||
ld bc, 5
|
||||
jp ByteFill
|
||||
; 5093a
|
||||
|
||||
PrintMoveType: ; 5093a
|
||||
; Print the type of move b at hl.
|
||||
|
||||
push hl
|
||||
ld a, b
|
||||
dec a
|
||||
ld bc, Move2 - Move1
|
||||
ld hl, Moves
|
||||
call AddNTimes
|
||||
ld de, StringBuffer1
|
||||
ld a, BANK(Moves)
|
||||
call FarCopyBytes
|
||||
ld a, [StringBuffer1 + PlayerMoveType - PlayerMoveStruct]
|
||||
pop hl
|
||||
|
||||
ld b, a
|
||||
; 50953
|
||||
|
||||
PrintType: ; 50953
|
||||
; Print type b at hl.
|
||||
ld a, b
|
||||
|
||||
push hl
|
||||
add a
|
||||
ld hl, TypeNames
|
||||
ld e, a
|
||||
ld d, 0
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld e, a
|
||||
ld d, [hl]
|
||||
pop hl
|
||||
|
||||
jp PlaceString
|
||||
; 50964
|
||||
|
||||
|
||||
GetTypeName: ; 50964
|
||||
; Copy the name of type $d265 to StringBuffer1.
|
||||
ld a, [$d265]
|
||||
ld hl, TypeNames
|
||||
ld e, a
|
||||
ld d, 0
|
||||
add hl, de
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
ld de, StringBuffer1
|
||||
ld bc, $000d
|
||||
jp CopyBytes
|
||||
; 5097b
|
||||
|
||||
|
||||
TypeNames: ; 5097b
|
||||
dw Normal
|
||||
dw Fighting
|
||||
dw Flying
|
||||
dw Poison
|
||||
dw Ground
|
||||
dw Rock
|
||||
dw Bird
|
||||
dw Bug
|
||||
dw Ghost
|
||||
dw Steel
|
||||
dw Normal
|
||||
dw Normal
|
||||
dw Normal
|
||||
dw Normal
|
||||
dw Normal
|
||||
dw Normal
|
||||
dw Normal
|
||||
dw Normal
|
||||
dw Normal
|
||||
dw UnknownType
|
||||
dw Fire
|
||||
dw Water
|
||||
dw Grass
|
||||
dw Electric
|
||||
dw Psychic
|
||||
dw Ice
|
||||
dw Dragon
|
||||
dw Dark
|
||||
|
||||
Normal:
|
||||
db "NORMAL@"
|
||||
Fighting:
|
||||
db "FIGHTING@"
|
||||
Flying:
|
||||
db "FLYING@"
|
||||
Poison:
|
||||
db "POISON@"
|
||||
UnknownType:
|
||||
db "???@"
|
||||
Fire:
|
||||
db "FIRE@"
|
||||
Water:
|
||||
db "WATER@"
|
||||
Grass:
|
||||
db "GRASS@"
|
||||
Electric:
|
||||
db "ELECTRIC@"
|
||||
Psychic:
|
||||
db "PSYCHIC@"
|
||||
Ice:
|
||||
db "ICE@"
|
||||
Ground:
|
||||
db "GROUND@"
|
||||
Rock:
|
||||
db "ROCK@"
|
||||
Bird:
|
||||
db "BIRD@"
|
||||
Bug:
|
||||
db "BUG@"
|
||||
Ghost:
|
||||
db "GHOST@"
|
||||
Steel:
|
||||
db "STEEL@"
|
||||
Dragon:
|
||||
db "DRAGON@"
|
||||
Dark:
|
||||
db "DARK@"
|
||||
; 50a28
|
||||
|
15
wram.asm
15
wram.asm
@ -477,7 +477,10 @@ BattleMonType1: ; c64a
|
||||
BattleMonType2: ; c64b
|
||||
ds 1
|
||||
|
||||
ds 23
|
||||
ds 10
|
||||
|
||||
OTName: ; c656
|
||||
ds 13
|
||||
|
||||
CurOTMon: ; c663
|
||||
ds 1
|
||||
@ -585,6 +588,7 @@ PlayerPerishCount: ; c677
|
||||
ds 1
|
||||
PlayerFuryCutterCount: ; c678
|
||||
ds 1
|
||||
PlayerProtectCount: ; c679
|
||||
ds 1
|
||||
|
||||
EnemyRolloutCount: ; c67a
|
||||
@ -600,6 +604,7 @@ EnemyPerishCount: ; c67f
|
||||
ds 1
|
||||
EnemyFuryCutterCount: ; c680
|
||||
ds 1
|
||||
EnemyProtectCount: ; c681
|
||||
ds 1
|
||||
|
||||
PlayerDamageTaken: ; c682
|
||||
@ -2023,12 +2028,12 @@ PartyMon6Nickname: ; de78
|
||||
PartyMonNicknamesEnd
|
||||
|
||||
SECTION "Pokedex",WRAMX[$de99],BANK[1]
|
||||
PokedexSeen: ; de99
|
||||
ds 32
|
||||
EndPokedexSeen:
|
||||
PokedexCaught: ; deb9
|
||||
PokedexCaught: ; de99
|
||||
ds 32
|
||||
EndPokedexCaught:
|
||||
PokedexSeen: ; deb9
|
||||
ds 32
|
||||
EndPokedexSeen:
|
||||
UnownDex: ; ded9
|
||||
ds 26
|
||||
UnlockedUnowns: ; def3
|
||||
|
Loading…
Reference in New Issue
Block a user