mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07: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
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user