Merge pull request #555 from Rangi42/ldh

Use real labels for HRAM instead of constants, and the ldh instruction
This commit is contained in:
Rangi 2018-08-25 22:23:45 -04:00 committed by GitHub
commit 3eacab563d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
243 changed files with 4768 additions and 4727 deletions

View File

@ -61,7 +61,7 @@ $(crystal11_obj): RGBASMFLAGS = -D _CRYSTAL -D _CRYSTAL11
# It doesn't look like $(shell) can be deferred so there might not be a better way.
define DEP
$1: $2 $$(shell tools/scan_includes $2)
$$(RGBASM) $$(RGBASMFLAGS) -o $$@ $$<
$$(RGBASM) $$(RGBASMFLAGS) -L -o $$@ $$<
endef
# Build tools when building the rom.

View File

@ -202,10 +202,10 @@ _UpdateSound::
call FadeMusic
; write volume to hardware register
ld a, [wVolume]
ld [rNR50], a
ldh [rNR50], a
; write SO on/off to hardware register
ld a, [wSoundOutput]
ld [rNR51], a
ldh [rNR51], a
ret
UpdateChannels:
@ -244,7 +244,7 @@ UpdateChannels:
jr z, .asm_e8159
;
ld a, [wSoundInput]
ld [rNR10], a
ldh [rNR10], a
.asm_e8159
bit NOTE_REST, [hl] ; rest
jr nz, .ch1rest
@ -258,35 +258,35 @@ UpdateChannels:
.frequency_override
ld a, [wCurTrackFrequency]
ld [rNR13], a
ldh [rNR13], a
ld a, [wCurTrackFrequency + 1]
ld [rNR14], a
ldh [rNR14], a
.check_duty_override
bit NOTE_DUTY_OVERRIDE, [hl]
ret z
ld a, [wCurTrackDuty]
ld d, a
ld a, [rNR11]
ldh a, [rNR11]
and $3f ; sound length
or d
ld [rNR11], a
ldh [rNR11], a
ret
.asm_e8184
ld a, [wCurTrackDuty]
ld d, a
ld a, [rNR11]
ldh a, [rNR11]
and $3f ; sound length
or d
ld [rNR11], a
ldh [rNR11], a
ld a, [wCurTrackFrequency]
ld [rNR13], a
ldh [rNR13], a
ret
.ch1rest
ld a, [rNR52]
ldh a, [rNR52]
and %10001110 ; ch1 off
ld [rNR52], a
ldh [rNR52], a
ld hl, rNR10
call ClearChannel
ret
@ -295,14 +295,14 @@ UpdateChannels:
ld hl, wCurTrackDuty
ld a, $3f ; sound length
or [hl]
ld [rNR11], a
ldh [rNR11], a
ld a, [wCurTrackIntensity]
ld [rNR12], a
ldh [rNR12], a
ld a, [wCurTrackFrequency]
ld [rNR13], a
ldh [rNR13], a
ld a, [wCurTrackFrequency + 1]
or $80
ld [rNR14], a
ldh [rNR14], a
ret
.Channel2:
@ -319,34 +319,34 @@ UpdateChannels:
ret z
ld a, [wCurTrackDuty]
ld d, a
ld a, [rNR21]
ldh a, [rNR21]
and $3f ; sound length
or d
ld [rNR21], a
ldh [rNR21], a
ret
.asm_e81db ; unused
ld a, [wCurTrackFrequency]
ld [rNR23], a
ldh [rNR23], a
ld a, [wCurTrackFrequency + 1]
ld [rNR24], a
ldh [rNR24], a
ret
.asm_e81e6
ld a, [wCurTrackDuty]
ld d, a
ld a, [rNR21]
ldh a, [rNR21]
and $3f ; sound length
or d
ld [rNR21], a
ldh [rNR21], a
ld a, [wCurTrackFrequency]
ld [rNR23], a
ldh [rNR23], a
ret
.ch2rest
ld a, [rNR52]
ldh a, [rNR52]
and %10001101 ; ch2 off
ld [rNR52], a
ldh [rNR52], a
ld hl, rNR20
call ClearChannel
ret
@ -355,14 +355,14 @@ UpdateChannels:
ld hl, wCurTrackDuty
ld a, $3f ; sound length
or [hl]
ld [rNR21], a
ldh [rNR21], a
ld a, [wCurTrackIntensity]
ld [rNR22], a
ldh [rNR22], a
ld a, [wCurTrackFrequency]
ld [rNR23], a
ldh [rNR23], a
ld a, [wCurTrackFrequency + 1]
or $80 ; initial (restart)
ld [rNR24], a
ldh [rNR24], a
ret
.Channel3:
@ -379,37 +379,37 @@ UpdateChannels:
.asm_e822f ; unused
ld a, [wCurTrackFrequency]
ld [rNR33], a
ldh [rNR33], a
ld a, [wCurTrackFrequency + 1]
ld [rNR34], a
ldh [rNR34], a
ret
.asm_e823a
ld a, [wCurTrackFrequency]
ld [rNR33], a
ldh [rNR33], a
ret
.ch3rest
ld a, [rNR52]
ldh a, [rNR52]
and %10001011 ; ch3 off
ld [rNR52], a
ldh [rNR52], a
ld hl, rNR30
call ClearChannel
ret
.asm_e824d
ld a, $3f ; sound length
ld [rNR31], a
ldh [rNR31], a
xor a
ld [rNR30], a
ldh [rNR30], a
call .asm_e8268
ld a, $80
ld [rNR30], a
ldh [rNR30], a
ld a, [wCurTrackFrequency]
ld [rNR33], a
ldh [rNR33], a
ld a, [wCurTrackFrequency + 1]
or $80
ld [rNR34], a
ldh [rNR34], a
ret
.asm_e8268
@ -428,42 +428,42 @@ endr
add hl, de
; load wavepattern into rWave_0-rWave_f
ld a, [hli]
ld [rWave_0], a
ldh [rWave_0], a
ld a, [hli]
ld [rWave_1], a
ldh [rWave_1], a
ld a, [hli]
ld [rWave_2], a
ldh [rWave_2], a
ld a, [hli]
ld [rWave_3], a
ldh [rWave_3], a
ld a, [hli]
ld [rWave_4], a
ldh [rWave_4], a
ld a, [hli]
ld [rWave_5], a
ldh [rWave_5], a
ld a, [hli]
ld [rWave_6], a
ldh [rWave_6], a
ld a, [hli]
ld [rWave_7], a
ldh [rWave_7], a
ld a, [hli]
ld [rWave_8], a
ldh [rWave_8], a
ld a, [hli]
ld [rWave_9], a
ldh [rWave_9], a
ld a, [hli]
ld [rWave_a], a
ldh [rWave_a], a
ld a, [hli]
ld [rWave_b], a
ldh [rWave_b], a
ld a, [hli]
ld [rWave_c], a
ldh [rWave_c], a
ld a, [hli]
ld [rWave_d], a
ldh [rWave_d], a
ld a, [hli]
ld [rWave_e], a
ldh [rWave_e], a
ld a, [hli]
ld [rWave_f], a
ldh [rWave_f], a
pop hl
ld a, [wCurTrackIntensity]
and $f0
sla a
ld [rNR32], a
ldh [rNR32], a
ret
.Channel4:
@ -478,26 +478,26 @@ endr
.asm_e82c1 ; unused
ld a, [wCurTrackFrequency]
ld [rNR43], a
ldh [rNR43], a
ret
.ch4rest
ld a, [rNR52]
ldh a, [rNR52]
and %10000111 ; ch4 off
ld [rNR52], a
ldh [rNR52], a
ld hl, rNR40
call ClearChannel
ret
.asm_e82d4
ld a, $3f ; sound length
ld [rNR41], a
ldh [rNR41], a
ld a, [wCurTrackIntensity]
ld [rNR42], a
ldh [rNR42], a
ld a, [wCurTrackFrequency]
ld [rNR43], a
ldh [rNR43], a
ld a, $80
ld [rNR44], a
ldh [rNR44], a
ret
_CheckSFX:
@ -551,15 +551,15 @@ PlayDanger:
.applychannel
xor a
ld [rNR10], a
ldh [rNR10], a
ld a, [hli]
ld [rNR11], a
ldh [rNR11], a
ld a, [hli]
ld [rNR12], a
ldh [rNR12], a
ld a, [hli]
ld [rNR13], a
ldh [rNR13], a
ld a, [hli]
ld [rNR14], a
ldh [rNR14], a
.increment
ld a, d
@ -1221,7 +1221,7 @@ ParseMusic:
jr nz, .ok
; ????
xor a
ld [rNR10], a ; sweep = 0
ldh [rNR10], a ; sweep = 0
.ok
; stop playing
; turn channel off
@ -2476,56 +2476,56 @@ _PlaySFX::
jr z, .ch6
res SOUND_CHANNEL_ON, [hl] ; turn it off
xor a
ld [rNR11], a ; length/wavepattern = 0
ldh [rNR11], a ; length/wavepattern = 0
ld a, $8
ld [rNR12], a ; envelope = 0
ldh [rNR12], a ; envelope = 0
xor a
ld [rNR13], a ; frequency lo = 0
ldh [rNR13], a ; frequency lo = 0
ld a, $80
ld [rNR14], a ; restart sound (freq hi = 0)
ldh [rNR14], a ; restart sound (freq hi = 0)
xor a
ld [wSoundInput], a ; global sound off
ld [rNR10], a ; sweep = 0
ldh [rNR10], a ; sweep = 0
.ch6
ld hl, wChannel6Flags1
bit SOUND_CHANNEL_ON, [hl]
jr z, .ch7
res SOUND_CHANNEL_ON, [hl] ; turn it off
xor a
ld [rNR21], a ; length/wavepattern = 0
ldh [rNR21], a ; length/wavepattern = 0
ld a, $8
ld [rNR22], a ; envelope = 0
ldh [rNR22], a ; envelope = 0
xor a
ld [rNR23], a ; frequency lo = 0
ldh [rNR23], a ; frequency lo = 0
ld a, $80
ld [rNR24], a ; restart sound (freq hi = 0)
ldh [rNR24], a ; restart sound (freq hi = 0)
.ch7
ld hl, wChannel7Flags1
bit SOUND_CHANNEL_ON, [hl]
jr z, .ch8
res SOUND_CHANNEL_ON, [hl] ; turn it off
xor a
ld [rNR30], a ; sound mode #3 off
ld [rNR31], a ; length/wavepattern = 0
ldh [rNR30], a ; sound mode #3 off
ldh [rNR31], a ; length/wavepattern = 0
ld a, $8
ld [rNR32], a ; envelope = 0
ldh [rNR32], a ; envelope = 0
xor a
ld [rNR33], a ; frequency lo = 0
ldh [rNR33], a ; frequency lo = 0
ld a, $80
ld [rNR34], a ; restart sound (freq hi = 0)
ldh [rNR34], a ; restart sound (freq hi = 0)
.ch8
ld hl, wChannel8Flags1
bit SOUND_CHANNEL_ON, [hl]
jr z, .chscleared
res SOUND_CHANNEL_ON, [hl] ; turn it off
xor a
ld [rNR41], a ; length/wavepattern = 0
ldh [rNR41], a ; length/wavepattern = 0
ld a, $8
ld [rNR42], a ; envelope = 0
ldh [rNR42], a ; envelope = 0
xor a
ld [rNR43], a ; frequency lo = 0
ldh [rNR43], a ; frequency lo = 0
ld a, $80
ld [rNR44], a ; restart sound (freq hi = 0)
ldh [rNR44], a ; restart sound (freq hi = 0)
xor a
ld [wNoiseSampleAddress], a
ld [wNoiseSampleAddress + 1], a

View File

@ -2,8 +2,6 @@ INCLUDE "charmap.asm"
INCLUDE "macros.asm"
INCLUDE "hram.asm"
INCLUDE "constants/hardware_constants.asm"
INCLUDE "constants/deco_constants.asm"
INCLUDE "constants/wram_constants.asm"

View File

@ -485,7 +485,7 @@ In [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm).
```asm
BattleCheckTypeMatchup:
ld hl, wEnemyMonType1
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, CheckTypeMatchup
ld hl, wBattleMonType1
@ -962,7 +962,7 @@ Then edit [engine/battle/start_battle.asm](/engine/battle/start_battle.asm):
```diff
FindFirstAliveMonAndStartBattle:
xor a
ld [hMapAnims], a
ldh [hMapAnims], a
call DelayFrame
- ld b, 6
- ld hl, wPartyMon1HP
@ -1520,7 +1520,7 @@ ScriptCall:
ld a, 1
.bank_loop
push af
ld [rSVBK], a
ldh [rSVBK], a
xor a
ld hl, WRAM1_Begin
ld bc, WRAM1_End - WRAM1_Begin

View File

@ -520,7 +520,7 @@ AIUpdateHUD:
call UpdateEnemyMonInParty
farcall UpdateEnemyHUD
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld hl, wEnemyItemState
dec [hl]
scf
@ -671,7 +671,7 @@ AI_Switch:
ld hl, wEnemySubStatus4
res SUBSTATUS_RAGE, [hl]
xor a
ld [hBattleTurn], a
ldh [hBattleTurn], a
callfar PursuitSwitch
push af
@ -755,17 +755,17 @@ EnemyUsedDireHit:
jp PrintText_UsedItemOn_AND_AIUpdateHUD
Function3851e: ; This appears to be unused
ld [hDivisor], a
ldh [hDivisor], a
ld hl, wEnemyMonMaxHP
ld a, [hli]
ld [hDividend], a
ldh [hDividend], a
ld a, [hl]
ld [hDividend + 1], a
ldh [hDividend + 1], a
ld b, 2
call Divide
ld a, [hQuotient + 2]
ldh a, [hQuotient + 2]
ld c, a
ld a, [hQuotient + 1]
ldh a, [hQuotient + 1]
ld b, a
ld hl, wEnemyMonHP + 1
ld a, [hld]

View File

@ -165,7 +165,7 @@ AI_Types:
push bc
push de
ld a, 1
ld [hBattleTurn], a
ldh [hBattleTurn], a
callfar BattleCheckTypeMatchup
pop de
pop bc
@ -410,7 +410,7 @@ AI_Smart_Sleep:
AI_Smart_LeechHit:
push hl
ld a, 1
ld [hBattleTurn], a
ldh [hBattleTurn], a
callfar BattleCheckTypeMatchup
pop hl
@ -486,7 +486,7 @@ AI_Smart_LockOn:
jr nc, .asm_3884f
ld a, $1
ld [hBattleTurn], a
ldh [hBattleTurn], a
push hl
push bc
@ -1289,7 +1289,7 @@ AI_Smart_Mimic:
call AIGetEnemyMove
ld a, $1
ld [hBattleTurn], a
ldh [hBattleTurn], a
callfar BattleCheckTypeMatchup
ld a, [wTypeMatchup]
@ -1631,7 +1631,7 @@ AI_Smart_PriorityHit:
; Greatly encourage this move if it will KO the player.
ld a, $1
ld [hBattleTurn], a
ldh [hBattleTurn], a
push hl
callfar EnemyAttackDamage
callfar BattleCommand_DamageCalc
@ -1675,7 +1675,7 @@ AI_Smart_Conversion2:
ld [wPlayerMoveStruct + MOVE_TYPE], a
xor a
ld [hBattleTurn], a
ldh [hBattleTurn], a
callfar BattleCheckTypeMatchup
@ -2285,7 +2285,7 @@ AI_Smart_RapidSpin:
AI_Smart_HiddenPower:
push hl
ld a, 1
ld [hBattleTurn], a
ldh [hBattleTurn], a
; Calculate Hidden Power's type and base power based on enemy's DVs.
callfar HiddenPowerDamage
@ -3013,7 +3013,7 @@ INCLUDE "data/battle/ai/reckless_moves.asm"
AIDamageCalc:
ld a, 1
ld [hBattleTurn], a
ldh [hBattleTurn], a
ld a, [wEnemyMoveStruct + MOVE_EFFECT]
ld de, 1
ld hl, ConstantDamageEffects
@ -3119,7 +3119,7 @@ AI_Status:
push bc
push de
ld a, 1
ld [hBattleTurn], a
ldh [hBattleTurn], a
callfar BattleCheckTypeMatchup
pop de
pop bc

View File

@ -277,7 +277,7 @@ HPBarAnim_UpdateHPRemaining:
ret
HPBarAnim_PaletteUpdate:
ld a, [hCGB]
ldh a, [hCGB]
and a
ret z
ld hl, wCurHPAnimPal
@ -288,7 +288,7 @@ HPBarAnim_PaletteUpdate:
ret
HPBarAnim_BGMapUpdate:
ld a, [hCGB]
ldh a, [hCGB]
and a
jr nz, .cgb
call DelayFrame
@ -316,15 +316,15 @@ HPBarAnim_BGMapUpdate:
cp $5
jr z, .skip_delay
ld a, $2
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld a, c
ld [hBGMapThird], a
ldh [hBGMapThird], a
call DelayFrame
.skip_delay
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld a, c
ld [hBGMapThird], a
ldh [hBGMapThird], a
call DelayFrame
pop af
cp $2
@ -336,14 +336,14 @@ HPBarAnim_BGMapUpdate:
.two_frames
inc c
ld a, $2
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld a, c
ld [hBGMapThird], a
ldh [hBGMapThird], a
call DelayFrame
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld a, c
ld [hBGMapThird], a
ldh [hBGMapThird], a
call DelayFrame
ret
@ -356,7 +356,7 @@ HPBarAnim_BGMapUpdate:
.finish
call DelayFrame
ld a, c
ld [hBGMapThird], a
ldh [hBGMapThird], a
call DelayFrame
ret

View File

@ -10,11 +10,11 @@ BATTLETRANSITION_SQUARE EQUS "\"8\"" ; $fe
DoBattleTransition:
call .InitGFX
ld a, [rBGP]
ldh a, [rBGP]
ld [wBGP], a
ld a, [rOBP0]
ldh a, [rOBP0]
ld [wOBP0], a
ld a, [rOBP1]
ldh a, [rOBP1]
ld [wOBP1], a
call DelayFrame
ld hl, hVBlank
@ -31,10 +31,10 @@ DoBattleTransition:
jr .loop
.done
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ld [rSVBK], a
ldh [rSVBK], a
ld hl, wBGPals1
ld bc, 8 palettes
@ -42,22 +42,22 @@ DoBattleTransition:
call ByteFill
pop af
ld [rSVBK], a
ldh [rSVBK], a
ld a, %11111111
ld [wBGP], a
call DmgToCgbBGPals
call DelayFrame
xor a
ld [hLCDCPointer], a
ld [hLYOverrideStart], a
ld [hLYOverrideEnd], a
ld [hSCY], a
ldh [hLCDCPointer], a
ldh [hLYOverrideStart], a
ldh [hLYOverrideEnd], a
ldh [hSCY], a
ld a, 1 ; unnecessary bankswitch?
ld [rSVBK], a
ldh [rSVBK], a
pop af
ld [hVBlank], a
ldh [hVBlank], a
call DelayFrame
ret
@ -77,10 +77,10 @@ DoBattleTransition:
.resume
ld a, SCREEN_HEIGHT_PX
ld [hWY], a
ldh [hWY], a
call DelayFrame
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld hl, wJumptableIndex
xor a
ld [hli], a
@ -104,10 +104,10 @@ LoadTrainerBattlePokeballTiles:
ld c, 2
call Request2bpp
ld a, [rVBK]
ldh a, [rVBK]
push af
ld a, $1
ld [rVBK], a
ldh [rVBK], a
ld de, TrainerBattlePokeballTiles
ld hl, vTiles3 tile BATTLETRANSITION_SQUARE
@ -116,14 +116,14 @@ LoadTrainerBattlePokeballTiles:
call Request2bpp
pop af
ld [rVBK], a
ldh [rVBK], a
ret
ConvertTrainerBattlePokeballTilesTo2bpp:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
ld [rSVBK], a
ldh [rSVBK], a
push hl
ld hl, wDecompressScratch
ld bc, $28 tiles
@ -142,7 +142,7 @@ ConvertTrainerBattlePokeballTilesTo2bpp:
ld c, $28
call Request2bpp
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
TrainerBattlePokeballTiles:
@ -258,7 +258,7 @@ StartTrainerBattle_SetUpBGMap:
call StartTrainerBattle_NextScene
xor a
ld [wcf64], a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ret
StartTrainerBattle_Flash:
@ -311,16 +311,16 @@ StartTrainerBattle_Flash:
StartTrainerBattle_SetUpForWavyOutro:
farcall Function5602
ld a, BANK(wLYOverrides)
ld [rSVBK], a
ldh [rSVBK], a
call StartTrainerBattle_NextScene
ld a, rSCX - $ff00
ld [hLCDCPointer], a
ld a, LOW(rSCX)
ldh [hLCDCPointer], a
xor a
ld [hLYOverrideStart], a
ldh [hLYOverrideStart], a
ld a, $90
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
xor a
ld [wcf64], a
ld [wcf65], a
@ -369,7 +369,7 @@ StartTrainerBattle_SineWave:
StartTrainerBattle_SetUpForSpinOutro:
farcall Function5602
ld a, BANK(wLYOverrides)
ld [rSVBK], a
ldh [rSVBK], a
call StartTrainerBattle_NextScene
xor a
ld [wcf64], a
@ -377,7 +377,7 @@ StartTrainerBattle_SetUpForSpinOutro:
StartTrainerBattle_SpinToBlack:
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld a, [wcf64]
ld e, a
ld d, 0
@ -391,7 +391,7 @@ endr
ld [wcf65], a
call .load
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
call DelayFrame
call DelayFrame
ld hl, wcf64
@ -400,12 +400,12 @@ endr
.end
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
call DelayFrame
call DelayFrame
call DelayFrame
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld a, BATTLETRANSITION_FINISH
ld [wJumptableIndex], a
ret
@ -511,12 +511,12 @@ ENDM
StartTrainerBattle_SetUpForRandomScatterOutro:
farcall Function5602
ld a, BANK(wLYOverrides)
ld [rSVBK], a
ldh [rSVBK], a
call StartTrainerBattle_NextScene
ld a, $10
ld [wcf64], a
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
ret
StartTrainerBattle_SpeckleToBlack:
@ -536,12 +536,12 @@ StartTrainerBattle_SpeckleToBlack:
.done
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
call DelayFrame
call DelayFrame
call DelayFrame
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld a, BATTLETRANSITION_FINISH
ld [wJumptableIndex], a
ret
@ -583,7 +583,7 @@ StartTrainerBattle_LoadPokeBallGraphics:
jp z, .nextscene ; don't need to be here if wild
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
hlcoord 0, 0, wAttrMap
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
inc b
@ -640,11 +640,11 @@ StartTrainerBattle_LoadPokeBallGraphics:
dec b
jr nz, .loop2
ld a, [hCGB]
ldh a, [hCGB]
and a
jr nz, .cgb
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
call DelayFrame
call DelayFrame
jr .nextscene
@ -657,10 +657,10 @@ StartTrainerBattle_LoadPokeBallGraphics:
jr nz, .daytime
ld hl, .nightpals
.daytime
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ld [rSVBK], a
ldh [rSVBK], a
call .copypals
push hl
ld de, wBGPals1 palette PAL_BG_TEXT
@ -671,9 +671,9 @@ StartTrainerBattle_LoadPokeBallGraphics:
ld bc, 1 palettes
call CopyBytes
pop af
ld [rSVBK], a
ldh [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
call DelayFrame
call BattleStart_CopyTilemapAtOnce
@ -731,10 +731,10 @@ PokeBallTransition:
db %00000011, %11000000
WipeLYOverrides:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wLYOverrides)
ld [rSVBK], a
ldh [rSVBK], a
ld hl, wLYOverrides
call .wipe
@ -742,7 +742,7 @@ WipeLYOverrides:
call .wipe
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
.wipe
@ -777,7 +777,7 @@ StartTrainerBattle_ZoomToBlack:
inc de
ld h, a
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call .Copy
call WaitBGMap
jr .loop
@ -823,8 +823,8 @@ ENDM
Unreferenced_Function8c7c9:
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
call WaitBGMap
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ret

View File

@ -2,7 +2,7 @@ ConsumeHeldItem:
push hl
push de
push bc
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
ld hl, wOTPartyMon1Item
ld de, wEnemyMonItem
@ -38,7 +38,7 @@ ConsumeHeldItem:
pop af
pop hl
call GetPartyLocation
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr nz, .ourturn
ld a, [wBattleMode]

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ HiddenPowerDamage:
; Override Hidden Power's type and power based on the user's DVs.
ld hl, wBattleMonDVs
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .got_dvs
ld hl, wEnemyMonDVs

View File

@ -83,13 +83,13 @@ DetermineLinkBattleResult:
jr z, .next
dec hl
xor a
ld [hDividend + 0], a
ldh [hDividend + 0], a
ld a, [hli]
ld [hDividend + 1], a
ldh [hDividend + 1], a
ld a, [hli]
ld [hDividend + 2], a
ldh [hDividend + 2], a
xor a
ld [hDividend + 3], a
ldh [hDividend + 3], a
ld a, [hli]
ld b, a
ld a, [hld]
@ -97,13 +97,13 @@ DetermineLinkBattleResult:
rr a
srl b
rr a
ld [hDivisor], a
ldh [hDivisor], a
ld b, $4
call Divide
ld a, [hQuotient + 2]
ldh a, [hQuotient + 2]
add e
ld e, a
ld a, [hQuotient + 1]
ldh a, [hQuotient + 1]
adc d
ld d, a
dec hl

View File

@ -1,7 +1,7 @@
_DisappearUser:
xor a
ld [hBGMapMode], a
ld a, [hBattleTurn]
ldh [hBGMapMode], a
ldh a, [hBattleTurn]
and a
jr z, .player
call GetEnemyFrontpicCoords
@ -21,8 +21,8 @@ _AppearUserLowerSub:
AppearUser:
xor a
ld [hBGMapMode], a
ld a, [hBattleTurn]
ldh [hBGMapMode], a
ldh a, [hBattleTurn]
and a
jr z, .player
call GetEnemyFrontpicCoords
@ -32,11 +32,11 @@ AppearUser:
call GetPlayerBackpicCoords
ld a, $31
.okay
ld [hGraphicStartTile], a
ldh [hGraphicStartTile], a
predef PlaceGraphic
FinishAppearDisappearUser:
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
ret
GetEnemyFrontpicCoords:
@ -101,32 +101,32 @@ DoWeatherModifiers:
.ApplyModifier:
xor a
ld [hMultiplicand + 0], a
ldh [hMultiplicand + 0], a
ld hl, wCurDamage
ld a, [hli]
ld [hMultiplicand + 1], a
ldh [hMultiplicand + 1], a
ld a, [hl]
ld [hMultiplicand + 2], a
ldh [hMultiplicand + 2], a
inc de
ld a, [de]
ld [hMultiplier], a
ldh [hMultiplier], a
call Multiply
ld a, 10
ld [hDivisor], a
ldh [hDivisor], a
ld b, 4
call Divide
ld a, [hQuotient + 0]
ldh a, [hQuotient + 0]
and a
ld bc, -1
jr nz, .Update
ld a, [hQuotient + 1]
ldh a, [hQuotient + 1]
ld b, a
ld a, [hQuotient + 2]
ldh a, [hQuotient + 2]
ld c, a
or b
jr nz, .Update
@ -153,7 +153,7 @@ DoBadgeTypeBoosts:
and a
ret nz
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
ret nz

View File

@ -1,7 +1,7 @@
BattleCommand_BatonPass:
; batonpass
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jp nz, .Enemy

View File

@ -2,7 +2,7 @@ BattleCommand_BeatUp:
; beatup
call ResetDamage
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jp nz, .enemy_beats_up
@ -210,7 +210,7 @@ GetBeatupMonLocation:
push bc
ld c, a
ld b, 0
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
ld hl, wPartyMon1Species
jr z, .got_species

View File

@ -7,7 +7,7 @@ BattleCommand_StoreEnergy:
ret z
ld hl, wPlayerRolloutCount
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .check_still_storing_energy
ld hl, wEnemyRolloutCount
@ -28,7 +28,7 @@ BattleCommand_StoreEnergy:
ld [hl], a
ld hl, wPlayerDamageTaken + 1
ld de, wPlayerCharging ; player
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .player
ld hl, wEnemyDamageTaken + 1
@ -74,7 +74,7 @@ BattleCommand_UnleashEnergy:
ld de, wPlayerDamageTaken
ld bc, wPlayerRolloutCount
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .got_damage
ld de, wEnemyDamageTaken

View File

@ -3,7 +3,7 @@ BattleCommand_Conversion:
ld hl, wBattleMonMoves
ld de, wBattleMonType1
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .got_moves
ld hl, wEnemyMonMoves

View File

@ -5,7 +5,7 @@ BattleCommand_Conversion2:
and a
jr nz, .failed
ld hl, wBattleMonType1
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .got_type
ld hl, wEnemyMonType1

View File

@ -3,7 +3,7 @@ BattleCommand_Curse:
ld de, wBattleMonType1
ld bc, wPlayerStatLevels
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .go
ld de, wEnemyMonType1

View File

@ -7,7 +7,7 @@ BattleCommand_Disable:
ld de, wEnemyDisableCount
ld hl, wEnemyMonMoves
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .got_moves
ld de, wPlayerDisableCount
@ -33,7 +33,7 @@ BattleCommand_Disable:
cp b
jr nz, .loop
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
ld hl, wEnemyMonPP
jr z, .got_pp
@ -55,7 +55,7 @@ BattleCommand_Disable:
ld [de], a
call AnimateCurrentMove
ld hl, wDisabledMove
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr nz, .got_disabled_move_pointer
inc hl

View File

@ -3,7 +3,7 @@ BattleCommand_Encore:
ld hl, wEnemyMonMoves
ld de, wEnemyEncoreCount
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .ok
ld hl, wBattleMonMoves
@ -47,7 +47,7 @@ BattleCommand_Encore:
ld [de], a
call CheckOpponentWentFirst
jr nz, .finish_move
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .force_last_enemy_move

View File

@ -4,7 +4,7 @@ BattleCommand_FalseSwipe:
; Makes sure wCurDamage < MonHP
ld hl, wEnemyMonHP
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .got_hp
ld hl, wBattleMonHP

View File

@ -3,25 +3,25 @@ BattleCommand_FrustrationPower:
push bc
ld hl, wBattleMonHappiness
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .got_happiness
ld hl, wEnemyMonHappiness
.got_happiness
ld a, $ff
sub [hl]
ld [hMultiplicand + 2], a
ldh [hMultiplicand + 2], a
xor a
ld [hMultiplicand + 0], a
ld [hMultiplicand + 1], a
ldh [hMultiplicand + 0], a
ldh [hMultiplicand + 1], a
ld a, 10
ld [hMultiplier], a
ldh [hMultiplier], a
call Multiply
ld a, 25
ld [hDivisor], a
ldh [hDivisor], a
ld b, 4
call Divide
ld a, [hQuotient + 2]
ldh a, [hQuotient + 2]
ld d, a
pop bc
ret

View File

@ -2,7 +2,7 @@ BattleCommand_FuryCutter:
; furycutter
ld hl, wPlayerFuryCutterCount
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .go
ld hl, wEnemyFuryCutterCount
@ -42,7 +42,7 @@ ResetFuryCutterCount:
push hl
ld hl, wPlayerFuryCutterCount
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .reset
ld hl, wEnemyFuryCutterCount

View File

@ -3,7 +3,7 @@ BattleCommand_CheckFutureSight:
ld hl, wPlayerFutureSightCount
ld de, wPlayerFutureSightDamage
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .ok
ld hl, wEnemyFutureSightCount
@ -41,7 +41,7 @@ BattleCommand_FutureSight:
ld [hl], b
.AlreadyChargingFutureSight:
ld hl, wPlayerFutureSightCount
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .GotFutureSightCount
ld hl, wEnemyFutureSightCount
@ -57,7 +57,7 @@ BattleCommand_FutureSight:
call StdBattleTextBox
call BattleCommand_RaiseSub
ld de, wPlayerFutureSightDamage
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .StoreDamage
ld de, wEnemyFutureSightDamage

View File

@ -5,7 +5,7 @@ BattleCommand_HealBell:
call GetBattleVarAddr
res SUBSTATUS_NIGHTMARE, [hl]
ld de, wPartyMon1Status
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .got_status
ld de, wOTPartyMon1Status
@ -28,7 +28,7 @@ BattleCommand_HealBell:
ld hl, BellChimedText
call StdBattleTextBox
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jp z, CalcPlayerStats
jp CalcEnemyStats

View File

@ -7,7 +7,7 @@ BattleCommand_LeechSeed:
jr nz, .evaded
ld de, wEnemyMonType1
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .ok
ld de, wBattleMonType1

View File

@ -7,7 +7,7 @@ BattleCommand_Mimic:
and a
jr nz, .fail
ld hl, wBattleMonMoves
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .player_turn
ld hl, wEnemyMonMoves

View File

@ -5,7 +5,7 @@ BattleCommand_PayDay:
ld hl, wStringBuffer1
ld [hli], a
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
ld a, [wBattleMonLevel]
jr z, .ok

View File

@ -54,7 +54,7 @@ BattleCommand_Present:
call AnimateCurrentMove
call BattleCommand_SwitchTurn
ld hl, AICheckPlayerMaxHP
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .got_hp_fn_pointer
ld hl, AICheckEnemyMaxHP

View File

@ -14,7 +14,7 @@ BattleCommand_Protect:
ProtectChance:
ld de, wPlayerProtectCount
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .asm_37637
ld de, wEnemyProtectCount

View File

@ -3,7 +3,7 @@ BattleCommand_PsychUp:
ld hl, wEnemyStatLevels
ld de, wPlayerStatLevels
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .pointers_correct
; It's the enemy's turn, so swap the pointers.
@ -35,7 +35,7 @@ BattleCommand_PsychUp:
inc de
dec b
jr nz, .loop2
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr nz, .calc_enemy_stats
call CalcPlayerStats

View File

@ -3,7 +3,7 @@ BattleCommand_Pursuit:
; Double damage if the opponent is switching.
ld hl, wEnemyIsSwitching
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .ok
ld hl, wPlayerIsSwitching

View File

@ -12,7 +12,7 @@ BattleCommand_ClearHazards:
ld hl, wPlayerScreens
ld de, wPlayerWrapCount
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .got_screens_wrap
ld hl, wEnemyScreens

View File

@ -2,24 +2,24 @@ BattleCommand_HappinessPower:
; happinesspower
push bc
ld hl, wBattleMonHappiness
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .ok
ld hl, wEnemyMonHappiness
.ok
xor a
ld [hMultiplicand + 0], a
ld [hMultiplicand + 1], a
ldh [hMultiplicand + 0], a
ldh [hMultiplicand + 1], a
ld a, [hl]
ld [hMultiplicand + 2], a
ldh [hMultiplicand + 2], a
ld a, 10
ld [hMultiplier], a
ldh [hMultiplier], a
call Multiply
ld a, 25
ld [hDivisor], a
ldh [hDivisor], a
ld b, 4
call Divide
ld a, [hQuotient + 2]
ldh a, [hQuotient + 2]
ld d, a
pop bc
ret

View File

@ -4,7 +4,7 @@ BattleCommand_CheckCurl:
; checkcurl
ld de, wPlayerRolloutCount
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .ok
ld de, wEnemyRolloutCount
@ -31,7 +31,7 @@ BattleCommand_RolloutPower:
ret nz
ld hl, wPlayerRolloutCount
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .got_rollout_count
ld hl, wEnemyRolloutCount

View File

@ -3,7 +3,7 @@ BattleCommand_Safeguard:
ld hl, wPlayerScreens
ld de, wPlayerSafeguardCount
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .ok
ld hl, wEnemyScreens

View File

@ -27,7 +27,7 @@ BattleCommand_Sketch:
ld e, l
; Get the battle move structs.
ld hl, wBattleMonMoves
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .get_last_move
ld hl, wEnemyMonMoves
@ -74,7 +74,7 @@ BattleCommand_Sketch:
ld [hl], a
pop bc
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .user_trainer
ld a, [wBattleMode]

View File

@ -5,7 +5,7 @@ BattleCommand_SleepTalk:
ld a, [wAttackMissed]
and a
jr nz, .fail
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
ld hl, wBattleMonMoves + 1
ld a, [wDisabledMove]
@ -77,7 +77,7 @@ BattleCommand_SleepTalk:
ret
.check_has_usable_move
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
ld a, [wDisabledMove]
jr z, .got_move_2

View File

@ -2,7 +2,7 @@ BattleCommand_Spikes:
; spikes
ld hl, wEnemyScreens
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .asm_3768e
ld hl, wPlayerScreens

View File

@ -6,7 +6,7 @@ BattleCommand_Spite:
jp nz, .failed
ld bc, PARTYMON_STRUCT_LENGTH ; ????
ld hl, wEnemyMonMoves
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .got_moves
ld hl, wBattleMonMoves
@ -63,7 +63,7 @@ BattleCommand_Spite:
call GetBattleVar
bit SUBSTATUS_TRANSFORMED, a
jr nz, .transformed
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr nz, .not_wildmon
ld a, [wBattleMode]

View File

@ -4,7 +4,7 @@ BattleCommand_Substitute:
call BattleCommand_MoveDelay
ld hl, wBattleMonMaxHP
ld de, wPlayerSubstituteHP
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .got_hp
ld hl, wEnemyMonMaxHP
@ -46,7 +46,7 @@ BattleCommand_Substitute:
ld hl, wPlayerWrapCount
ld de, wPlayerTrappingMove
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .player
ld hl, wEnemyWrapCount

View File

@ -16,7 +16,7 @@ BattleCommand_Teleport:
bit SUBSTATUS_CANT_RUN, a
jr nz, .failed
; Only need to check these next things if it's your turn
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr nz, .enemy_turn
; Can't teleport from a trainer battle

View File

@ -1,7 +1,7 @@
BattleCommand_Thief:
; thief
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr nz, .enemy

View File

@ -30,7 +30,7 @@ BattleCommand_Transform:
call ResetActorDisable
ld hl, wBattleMonSpecies
ld de, wEnemyMonSpecies
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr nz, .got_mon_species
ld hl, wEnemyMonSpecies
@ -46,7 +46,7 @@ BattleCommand_Transform:
inc de
ld bc, NUM_MOVES
call CopyBytes
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .mimic_enemy_backup
ld a, [de]
@ -112,7 +112,7 @@ BattleCommand_Transform:
call BattleSideCopy
call _CheckBattleScene
jr c, .mimic_anims
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
ld a, [wPlayerMinimized]
jr z, .got_byte

View File

@ -315,9 +315,9 @@ ComputeTrainerReward:
ld hl, wBattleReward
xor a
ld [hli], a
ld a, [hProduct + 2]
ldh a, [hProduct + 2]
ld [hli], a
ld a, [hProduct + 3]
ldh a, [hProduct + 3]
ld [hl], a
ret

View File

@ -1,22 +1,22 @@
BattleIntroSlidingPics:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wLYOverrides)
ld [rSVBK], a
ldh [rSVBK], a
call .subfunction1
ld a, rSCX - $ff00
ld [hLCDCPointer], a
ld a, LOW(rSCX)
ldh [hLCDCPointer], a
call .subfunction2
xor a
ld [hLCDCPointer], a
ldh [hLCDCPointer], a
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
.subfunction1
call .subfunction4
ld a, $90
ld [hSCX], a
ldh [hSCX], a
ld a, %11100100
call DmgToCgbBGPals
lb de, %11100100, %11100100
@ -31,11 +31,11 @@ BattleIntroSlidingPics:
.loop1
push af
.loop2
ld a, [rLY]
ldh a, [rLY]
cp $60
jr c, .loop2
ld a, d
ld [hSCX], a
ldh [hSCX], a
call .subfunction5
inc e
inc e

View File

@ -14,7 +14,7 @@ ShowLinkBattleParticipants:
FindFirstAliveMonAndStartBattle:
xor a
ld [hMapAnims], a
ldh [hMapAnims], a
call DelayFrame
ld b, PARTY_LENGTH
ld hl, wPartyMon1HP
@ -36,14 +36,14 @@ FindFirstAliveMonAndStartBattle:
predef DoBattleTransition
farcall _LoadBattleFontsHPBar
ld a, 1
ld [hBGMapMode], a
ldh [hBGMapMode], a
call ClearSprites
call ClearTileMap
xor a
ld [hBGMapMode], a
ld [hWY], a
ld [rWY], a
ld [hMapAnims], a
ldh [hBGMapMode], a
ldh [hWY], a
ldh [rWY], a
ldh [hMapAnims], a
ret
PlayBattleMusic:

View File

@ -1,6 +1,6 @@
BattleStart_TrainerHuds:
ld a, $e4
ld [rOBP0], a
ldh [rOBP0], a
call LoadBallIconGFX
call ShowPlayerMonsRemaining
ld a, [wBattleMode]
@ -10,7 +10,7 @@ BattleStart_TrainerHuds:
EnemySwitch_TrainerHud:
ld a, $e4
ld [rOBP0], a
ldh [rOBP0], a
call LoadBallIconGFX
jp ShowOTTrainerMonsRemaining
@ -253,5 +253,5 @@ _ShowLinkBattleParticipants:
call GetSGBLayout
call SetPalettes
ld a, $e4
ld [rOBP0], a
ldh [rOBP0], a
ret

View File

@ -8,7 +8,7 @@ UsedMoveText:
; this is a stream of text and asm from 105db9 to 105ef6
text_jump _ActorNameText
start_asm
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr nz, .start

View File

@ -1,16 +1,16 @@
; Battle animation command interpreter.
PlayBattleAnim:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wActiveAnimObjects)
ld [rSVBK], a
ldh [rSVBK], a
call _PlayBattleAnim
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
_PlayBattleAnim:
@ -25,7 +25,7 @@ _PlayBattleAnim:
call BattleAnimDelayFrame
ld c, 1
ld a, [rKEY1]
ldh a, [rKEY1]
bit 7, a
jr nz, .asm_cc0ff
ld c, 3
@ -39,10 +39,10 @@ _PlayBattleAnim:
call BattleAnimRunScript
pop af
ld [hVBlank], a
ldh [hVBlank], a
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
call BattleAnimDelayFrame
call BattleAnimDelayFrame
@ -65,8 +65,8 @@ BattleAnimRunScript:
call BattleAnimRequestPals
xor a
ld [hSCX], a
ld [hSCY], a
ldh [hSCX], a
ldh [hSCY], a
call BattleAnimDelayFrame
call BattleAnimRestoreHuds
@ -139,7 +139,7 @@ BattleAnimClearHud:
call WaitTop
call ClearActorHud
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
call BattleAnimDelayFrame
call BattleAnimDelayFrame
call BattleAnimDelayFrame
@ -150,20 +150,20 @@ BattleAnimRestoreHuds:
call BattleAnimDelayFrame
call WaitTop
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wCurBattleMon) ; alternatively: BANK(wTempMon), BANK(wPartyMon1), several others
ld [rSVBK], a
ldh [rSVBK], a
ld hl, UpdateBattleHuds
ld a, BANK(UpdatePlayerHUD)
rst FarCall ; Why not "call UpdateBattleHuds"?
pop af
ld [rSVBK], a
ldh [rSVBK], a
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
call BattleAnimDelayFrame
call BattleAnimDelayFrame
call BattleAnimDelayFrame
@ -171,17 +171,17 @@ BattleAnimRestoreHuds:
ret
BattleAnimRequestPals:
ld a, [hCGB]
ldh a, [hCGB]
and a
ret z
ld a, [rBGP]
ldh a, [rBGP]
ld b, a
ld a, [wBGP]
cp b
call nz, BattleAnim_SetBGPals
ld a, [rOBP0]
ldh a, [rOBP0]
ld b, a
ld a, [wOBP0]
cp b
@ -200,7 +200,7 @@ BattleAnimDelayFrame:
ret
ClearActorHud:
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .player
@ -217,18 +217,18 @@ ClearActorHud:
Unreferenced_Functioncc220:
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld a, LOW(vBGMap0 tile $28)
ld [hBGMapAddress], a
ldh [hBGMapAddress], a
ld a, HIGH(vBGMap0 tile $28)
ld [hBGMapAddress + 1], a
ldh [hBGMapAddress + 1], a
call WaitBGMap2
ld a, $60
ld [hWY], a
ldh [hWY], a
xor a ; LOW(vBGMap0)
ld [hBGMapAddress], a
ldh [hBGMapAddress], a
ld a, HIGH(vBGMap0)
ld [hBGMapAddress + 1], a
ldh [hBGMapAddress + 1], a
call BattleAnimDelayFrame
ret
@ -633,7 +633,7 @@ BattleAnimCmd_OBP1:
ret
BattleAnimCmd_ResetObp0:
ld a, [hSGB]
ldh a, [hSGB]
and a
ld a, $e0
jr z, .not_sgb
@ -885,14 +885,14 @@ BattleAnimCmd_E7:
ret
BattleAnimCmd_Transform:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wCurPartySpecies)
ld [rSVBK], a
ldh [rSVBK], a
ld a, [wCurPartySpecies] ; CurPartySpecies
push af
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .player
@ -916,12 +916,12 @@ BattleAnimCmd_Transform:
pop af
ld [wCurPartySpecies], a ; CurPartySpecies
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
BattleAnimCmd_UpdateActorPic:
ld de, vTiles0 tile $00
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .player
@ -939,10 +939,10 @@ BattleAnimCmd_UpdateActorPic:
ret
BattleAnimCmd_RaiseSub:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, 1 ; unnecessary bankswitch?
ld [rSVBK], a
ldh [rSVBK], a
xor a ; sScratch
call GetSRAMBank
@ -958,7 +958,7 @@ GetSubstitutePic: ; used only for BANK(GetSubstitutePic)
or b
jr nz, .loop
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .player
@ -1003,7 +1003,7 @@ GetSubstitutePic: ; used only for BANK(GetSubstitutePic)
.done
call CloseSRAM
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
.CopyTile:
@ -1013,17 +1013,17 @@ GetSubstitutePic: ; used only for BANK(GetSubstitutePic)
ret
BattleAnimCmd_MinimizeOpp:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, 1 ; unnecessary bankswitch?
ld [rSVBK], a
ldh [rSVBK], a
xor a ; sScratch
call GetSRAMBank
call GetMinimizePic
call Request2bpp
call CloseSRAM
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
GetMinimizePic:
@ -1037,7 +1037,7 @@ GetMinimizePic:
or b
jr nz, .loop
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .player
@ -1067,10 +1067,10 @@ MinimizePic:
INCBIN "gfx/battle/minimize.2bpp"
BattleAnimCmd_Minimize:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, 1 ; unnecessary bankswitch?
ld [rSVBK], a
ldh [rSVBK], a
xor a ; sScratch
call GetSRAMBank
call GetMinimizePic
@ -1078,18 +1078,18 @@ BattleAnimCmd_Minimize:
call Request2bpp
call CloseSRAM
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
BattleAnimCmd_DropSub:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wCurPartySpecies)
ld [rSVBK], a
ldh [rSVBK], a
ld a, [wCurPartySpecies] ; CurPartySpecies
push af
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .player
@ -1103,21 +1103,21 @@ BattleAnimCmd_DropSub:
pop af
ld [wCurPartySpecies], a ; CurPartySpecies
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
BattleAnimCmd_BeatUp:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wCurPartySpecies)
ld [rSVBK], a
ldh [rSVBK], a
ld a, [wCurPartySpecies] ; CurPartySpecies
push af
ld a, [wBattleAnimParam]
ld [wCurPartySpecies], a ; CurPartySpecies
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .player
@ -1139,17 +1139,17 @@ BattleAnimCmd_BeatUp:
ld b, SCGB_BATTLE_COLORS
call GetSGBLayout
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
BattleAnimCmd_OAMOn:
xor a
ld [hOAMUpdate], a
ldh [hOAMUpdate], a
ret
BattleAnimCmd_OAMOff:
ld a, $1
ld [hOAMUpdate], a
ldh [hOAMUpdate], a
ret
BattleAnimCmd_ClearSprites:
@ -1194,7 +1194,7 @@ BattleAnimCmd_Sound:
db $f0, $0f, $f0, $0f
.GetCryTrack:
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr nz, .enemy
@ -1216,12 +1216,12 @@ rept 4
add hl, de
endr
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wEnemyMon) ; wBattleMon is in WRAM0, but EnemyMon is in WRAMX
ld [rSVBK], a
ldh [rSVBK], a
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr nz, .enemy
@ -1278,7 +1278,7 @@ endr
.done
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
.CryData:
@ -1314,10 +1314,10 @@ PlayHitSound:
ret
BattleAnimAssignPals:
ld a, [hCGB]
ldh a, [hCGB]
and a
jr nz, .cgb
ld a, [hSGB]
ldh a, [hSGB]
and a
ld a, %11100000
jr z, .sgb
@ -1374,59 +1374,59 @@ BattleAnim_RevertPals:
lb de, %11100100, %11100100
call DmgToCgbObjPals
xor a
ld [hSCX], a
ld [hSCY], a
ldh [hSCX], a
ldh [hSCY], a
call BattleAnimDelayFrame
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
ret
BattleAnim_SetBGPals:
ld [rBGP], a
ld a, [hCGB]
ldh [rBGP], a
ldh a, [hCGB]
and a
ret z
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ld [rSVBK], a
ldh [rSVBK], a
ld hl, wBGPals2
ld de, wBGPals1
ld a, [rBGP]
ldh a, [rBGP]
ld b, a
ld c, 7
call CopyPals
ld hl, wOBPals2
ld de, wOBPals1
ld a, [rBGP]
ldh a, [rBGP]
ld b, a
ld c, 2
call CopyPals
pop af
ld [rSVBK], a
ldh [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
BattleAnim_SetOBPals:
ld [rOBP0], a
ld a, [hCGB]
ldh [rOBP0], a
ldh a, [hCGB]
and a
ret z
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wOBPals1)
ld [rSVBK], a
ldh [rSVBK], a
ld hl, wOBPals2 palette PAL_BATTLE_OB_GRAY
ld de, wOBPals1 palette PAL_BATTLE_OB_GRAY
ld a, [rOBP0]
ldh a, [rOBP0]
ld b, a
ld c, 2
call CopyPals
pop af
ld [rSVBK], a
ldh [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
BattleAnim_UpdateOAM_All:

View File

@ -363,14 +363,14 @@ BattleBGEffect_HideMon:
call ClearBox
pop bc
xor a
ld [hBGMapThird], a
ldh [hBGMapThird], a
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
ret
.four
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call EndBattleBGEffect
ret
@ -460,13 +460,13 @@ BattleBGEffect_FeetFollow:
.okay2
call ClearBox
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
pop bc
ret
.five
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call EndBattleBGEffect
ret
@ -527,13 +527,13 @@ BattleBGEffect_HeadFollow:
.okay2
call ClearBox
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
pop bc
ret
.five
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call EndBattleBGEffect
ret
@ -615,9 +615,9 @@ BattleBGEffect_27:
jr nz, .row2
.okay2
xor a
ld [hBGMapThird], a
ldh [hBGMapThird], a
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
call BattleBGEffects_IncrementJumptable
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
@ -626,7 +626,7 @@ BattleBGEffect_27:
.four
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
@ -736,7 +736,7 @@ BattleBGEffect_RunPicResizeScript:
.skip
call BattleBGEffects_IncrementJumptable
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
ret
.clear
@ -745,7 +745,7 @@ BattleBGEffect_RunPicResizeScript:
.restart
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld hl, BG_EFFECT_STRUCT_JT_INDEX
add hl, bc
ld [hl], $0
@ -753,7 +753,7 @@ BattleBGEffect_RunPicResizeScript:
.end
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call EndBattleBGEffect
ret
@ -915,7 +915,7 @@ BattleBGEffect_Surf:
call InitSurfWaves
.one
ld a, [hLCDCPointer]
ldh a, [hLCDCPointer]
and a
ret z
push bc
@ -945,7 +945,7 @@ BattleBGEffect_Surf:
ld hl, wSurfWaveBGEffect
ld bc, $0
.loop2
ld a, [hLYOverrideStart]
ldh a, [hLYOverrideStart]
cp e
jr nc, .load_zero
push hl
@ -978,12 +978,12 @@ BattleBGEffect_Whirlpool:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCY - $ff00
ld [hLCDCPointer], a
ld a, LOW(rSCY)
ldh [hLCDCPointer], a
xor a
ld [hLYOverrideStart], a
ldh [hLYOverrideStart], a
ld a, $5e
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
lb de, 2, 2
call Functionc8f2e
ret
@ -998,7 +998,7 @@ BattleBGEffect_Whirlpool:
BattleBGEffect_30:
call BattleBGEffects_ClearLYOverrides
ld a, rSCY - $ff00
ld a, LOW(rSCY)
call BattleBGEffect_SetLCDStatCustoms1
call EndBattleBGEffect
ret
@ -1051,12 +1051,12 @@ BattleBGEffect_Psychic:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCX - $ff00
ld [hLCDCPointer], a
ld a, LOW(rSCX)
ldh [hLCDCPointer], a
xor a
ld [hLYOverrideStart], a
ldh [hLYOverrideStart], a
ld a, $5f
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
lb de, 6, 5
call Functionc8f2e
ld hl, BG_EFFECT_STRUCT_03
@ -1088,7 +1088,7 @@ BattleBGEffect_Teleport:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCX - $ff00
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
lb de, 6, 5
call Functionc8f2e
@ -1112,7 +1112,7 @@ BattleBGEffect_NightShade:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCY - $ff00
ld a, LOW(rSCY)
call BattleBGEffect_SetLCDStatCustoms1
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
@ -1142,11 +1142,11 @@ BattleBGEffect_DoubleTeam:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCX - $ff00
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
inc a
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $0
@ -1201,9 +1201,9 @@ BattleBGEffect_DoubleTeam:
inc a
ld d, a
ld h, HIGH(wLYOverridesBackup)
ld a, [hLYOverrideStart]
ldh a, [hLYOverrideStart]
ld l, a
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
sub l
srl a
push af
@ -1233,7 +1233,7 @@ BattleBGEffect_AcidArmor:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCY - $ff00
ld a, LOW(rSCY)
call BattleBGEffect_SetLCDStatCustoms1
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
@ -1241,7 +1241,7 @@ BattleBGEffect_AcidArmor:
ld d, 2
call Functionc8f2e
ld h, HIGH(wLYOverridesBackup)
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
ld l, a
ld [hl], $0
dec l
@ -1249,7 +1249,7 @@ BattleBGEffect_AcidArmor:
ret
.one
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
ld l, a
ld h, HIGH(wLYOverridesBackup)
ld e, l
@ -1259,11 +1259,11 @@ BattleBGEffect_AcidArmor:
ld a, [de]
dec de
ld [hld], a
ld a, [hLYOverrideStart]
ldh a, [hLYOverrideStart]
cp l
jr nz, .loop
ld [hl], $90
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
ld l, a
ld a, [hl]
cp $1
@ -1295,11 +1295,11 @@ BattleBGEffect_Withdraw:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCY - $ff00
ld a, LOW(rSCY)
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
inc a
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $1
@ -1344,11 +1344,11 @@ BattleBGEffect_Dig:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCY - $ff00
ld a, LOW(rSCY)
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
inc a
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $2
@ -1370,9 +1370,9 @@ BattleBGEffect_Dig:
ld [hl], $10
call BattleBGEffects_IncrementJumptable
.two
ld a, [hLYOverrideStart]
ldh a, [hLYOverrideStart]
ld l, a
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
sub l
dec a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
@ -1410,11 +1410,11 @@ BattleBGEffect_Tackle:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCX - $ff00
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
inc a
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@ -1444,11 +1444,11 @@ BattleBGEffect_25:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCX - $ff00
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms2
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
inc a
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@ -1521,16 +1521,16 @@ Functionc88a5:
jp BGEffect_FillLYOverridesBackup
.rollout
ld a, [hLYOverrideStart]
ldh a, [hLYOverrideStart]
ld d, a
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
sub d
ld d, a
ld h, HIGH(wLYOverridesBackup)
ld a, [hSCY]
ldh a, [hSCY]
or a
jr nz, .skip1
ld a, [hLYOverrideStart]
ldh a, [hLYOverrideStart]
or a
jr z, .skip2
dec a
@ -1539,14 +1539,14 @@ Functionc88a5:
jr .skip2
.skip1
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
dec a
ld l, a
ld [hl], $0
.skip2
ld a, [hSCY]
ldh a, [hSCY]
ld l, a
ld a, [hLYOverrideStart]
ldh a, [hLYOverrideStart]
sub l
jr nc, .skip3
xor a
@ -1575,11 +1575,11 @@ BattleBGEffect_2d:
BGEffect2d_2f_zero:
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCX - $ff00
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
inc a
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@ -1618,11 +1618,11 @@ BattleBGEffect_26:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCX - $ff00
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
inc a
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@ -1656,11 +1656,11 @@ BattleBGEffect_2c:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCX - $ff00
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
inc a
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
xor a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
@ -1710,7 +1710,7 @@ BattleBGEffect_28:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCX - $ff00
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
ret
@ -1752,11 +1752,11 @@ BattleBGEffect_BounceDown:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCY - $ff00
ld a, LOW(rSCY)
call BattleBGEffect_SetLCDStatCustoms2
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
inc a
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $1
@ -1808,14 +1808,14 @@ BattleBGEffect_2a:
call BattleBGEffects_SetLYOverrides
ld a, $47
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
inc a
ld [hLYOverrideEnd], a
ld a, [hLYOverrideStart]
ldh [hLYOverrideEnd], a
ldh a, [hLYOverrideStart]
ld l, a
ld h, HIGH(wLYOverridesBackup)
.loop
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
cp l
jr z, .done
xor a
@ -1840,9 +1840,9 @@ BattleBGEffect_2a:
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
ld a, [hLYOverrideStart]
ldh a, [hLYOverrideStart]
inc a
ld [hLYOverrideStart], a
ldh [hLYOverrideStart], a
call BattleBGEffects_IncrementJumptable
ret
@ -1850,7 +1850,7 @@ BattleBGEffect_2a:
call .GetLYOverride
jr nc, .finish
call .SetLYOverridesBackup
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
dec a
ld l, a
ld [hl], e
@ -1862,9 +1862,9 @@ BattleBGEffect_2a:
.SetLYOverridesBackup:
ld e, a
ld a, [hLYOverrideStart]
ldh a, [hLYOverrideStart]
ld l, a
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
sub l
srl a
ld h, HIGH(wLYOverridesBackup)
@ -1909,7 +1909,7 @@ BattleBGEffect_2b:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCX - $ff00
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
@ -1937,7 +1937,7 @@ BattleBGEffect_2b:
ret
BattleBGEffect_1c:
ld a, [hCGB]
ldh a, [hCGB]
and a
jr nz, .cgb
call BattleBGEffects_AnonJumptable
@ -1950,12 +1950,12 @@ BattleBGEffect_1c:
call BattleBGEffects_IncrementJumptable
ld a, $e4
call BattleBGEffects_SetLYOverrides
ld a, rBGP - $ff00
ld [hLCDCPointer], a
ld a, LOW(rBGP)
ldh [hLCDCPointer], a
xor a
ld [hLYOverrideStart], a
ldh [hLYOverrideStart], a
ld a, $60
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
ret
.one
@ -2175,11 +2175,11 @@ BattleBGEffect_VibrateMon:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCX - $ff00
ld a, LOW(rSCX)
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
inc a
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld [hl], $1
@ -2220,12 +2220,12 @@ BattleBGEffect_WobbleMon:
.zero
call BattleBGEffects_IncrementJumptable
call BattleBGEffects_ClearLYOverrides
ld a, rSCX - $ff00
ld [hLCDCPointer], a
ld a, LOW(rSCX)
ldh [hLCDCPointer], a
xor a
ld [hLYOverrideStart], a
ldh [hLYOverrideStart], a
ld a, $37
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld [hl], $0
@ -2262,7 +2262,7 @@ BattleBGEffect_2e:
push af
call DelayFrame
pop af
ld [hSCY], a
ldh [hSCY], a
xor $ff
inc a
ld [wAnimObject01YOffset], a
@ -2273,7 +2273,7 @@ BattleBGEffect_1f:
jr nc, .skip
xor a
.skip
ld [hSCX], a
ldh [hSCX], a
ret
BattleBGEffect_20:
@ -2281,7 +2281,7 @@ BattleBGEffect_20:
jr nc, .skip
xor a
.skip
ld [hSCY], a
ldh [hSCY], a
ret
Functionc8d0b:
@ -2330,7 +2330,7 @@ BattleBGEffect_35:
jr nc, .finish
ld d, $6
call BattleBGEffects_Sine
ld [hSCX], a
ldh [hSCX], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
@ -2340,7 +2340,7 @@ BattleBGEffect_35:
.finish
xor a
ld [hSCX], a
ldh [hSCX], a
ret
BattleBGEffect_GetNthDMGPal:
@ -2367,7 +2367,7 @@ BattleBGEffect_GetNthDMGPal:
ret
BGEffect_RapidCyclePals:
ld a, [hCGB]
ldh a, [hCGB]
and a
jr nz, .cgb
push de
@ -2387,9 +2387,9 @@ BGEffect_RapidCyclePals:
call BattleBGEffects_SetLYOverrides
ld a, $47
call BattleBGEffect_SetLCDStatCustoms1
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
inc a
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
ld hl, BG_EFFECT_STRUCT_03
add hl, bc
ld a, [hl]
@ -2427,7 +2427,7 @@ BGEffect_RapidCyclePals:
.two_dmg
call BattleBGEffects_ResetVideoHRAM
ld a, %11100100
ld [rBGP], a
ldh [rBGP], a
call EndBattleBGEffect
ret
@ -2525,10 +2525,10 @@ BGEffect_RapidCyclePals:
BGEffects_LoadBGPal0_OBPal1:
ld h, a
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ld [rSVBK], a
ldh [rSVBK], a
ld a, h
push bc
push af
@ -2545,17 +2545,17 @@ BGEffects_LoadBGPal0_OBPal1:
call CopyPals
pop bc
pop af
ld [rSVBK], a
ldh [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
BGEffects_LoadBGPal1_OBPal0:
ld h, a
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ld [rSVBK], a
ldh [rSVBK], a
ld a, h
push bc
push af
@ -2572,9 +2572,9 @@ BGEffects_LoadBGPal1_OBPal0:
call CopyPals
pop bc
pop af
ld [rSVBK], a
ldh [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
BattleBGEffect_GetFirstDMGPal:
@ -2621,7 +2621,7 @@ BattleBGEffects_SetLYOverrides:
ret
BattleBGEffect_SetLCDStatCustoms1:
ld [hLCDCPointer], a
ldh [hLCDCPointer], a
call BGEffect_CheckBattleTurn
jr nz, .player_turn
lb de, $00, $36
@ -2631,13 +2631,13 @@ BattleBGEffect_SetLCDStatCustoms1:
lb de, $2f, $5e
.okay
ld a, d
ld [hLYOverrideStart], a
ldh [hLYOverrideStart], a
ld a, e
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
ret
BattleBGEffect_SetLCDStatCustoms2:
ld [hLCDCPointer], a
ldh [hLCDCPointer], a
call BGEffect_CheckBattleTurn
jr nz, .player_turn
lb de, $00, $36
@ -2647,30 +2647,30 @@ BattleBGEffect_SetLCDStatCustoms2:
lb de, $2d, $5e
.okay
ld a, d
ld [hLYOverrideStart], a
ldh [hLYOverrideStart], a
ld a, e
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
ret
BattleAnim_ResetLCDStatCustom:
xor a
ld [hLYOverrideStart], a
ld [hLYOverrideEnd], a
ldh [hLYOverrideStart], a
ldh [hLYOverrideEnd], a
call BattleBGEffects_ClearLYOverrides
xor a
ld [hLCDCPointer], a
ldh [hLCDCPointer], a
call EndBattleBGEffect
ret
BattleBGEffects_ResetVideoHRAM:
xor a
ld [hLCDCPointer], a
ldh [hLCDCPointer], a
ld a, %11100100
ld [rBGP], a
ldh [rBGP], a
ld [wBGP], a
ld [wOBP1], a
ld [hLYOverrideStart], a
ld [hLYOverrideEnd], a
ldh [hLYOverrideStart], a
ldh [hLYOverrideEnd], a
call BattleBGEffects_ClearLYOverrides
ret
@ -2686,10 +2686,10 @@ Functionc8f2e:
ld [wBattleAnimTemp3], a
ld bc, wLYOverridesBackup
.loop
ld a, [hLYOverrideStart]
ldh a, [hLYOverrideStart]
cp c
jr nc, .next
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
cp c
jr c, .next
ld a, [wBattleAnimTemp2]
@ -2763,14 +2763,14 @@ Functionc8f9a:
call BattleBGEffects_Sine
ld e, a
pop hl
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
cp c
jr c, .skip1
ld a, e
ld [bc], a
inc bc
.skip1
ld a, [hLYOverrideStart]
ldh a, [hLYOverrideStart]
cp l
jr nc, .skip2
ld [hl], e
@ -2788,7 +2788,7 @@ Functionc8f9a:
ret
.GetLYOverrideBackupAddrOffset:
ld a, [hLYOverrideStart]
ldh a, [hLYOverrideStart]
ld e, a
ld a, [wBattleAnimTemp0]
add e
@ -2798,13 +2798,13 @@ Functionc8f9a:
BattleBGEffect_WavyScreenFX:
push bc
ld a, [hLYOverrideStart]
ldh a, [hLYOverrideStart]
ld l, a
inc a
ld e, a
ld h, HIGH(wLYOverridesBackup)
ld d, h
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
sub l
and a
jr z, .done
@ -2826,9 +2826,9 @@ BattleBGEffect_WavyScreenFX:
BGEffect_FillLYOverridesBackup:
push af
ld h, HIGH(wLYOverridesBackup)
ld a, [hLYOverrideStart]
ldh a, [hLYOverrideStart]
ld l, a
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
sub l
ld d, a
pop af
@ -2842,14 +2842,14 @@ BGEffect_DisplaceLYOverridesBackup:
; e = a; d = [hLYOverrideEnd] - [hLYOverrideStart] - a
push af
ld e, a
ld a, [hLYOverrideStart]
ldh a, [hLYOverrideStart]
ld l, a
ld a, [hLYOverrideEnd]
ldh a, [hLYOverrideEnd]
sub l
sub e
ld d, a
ld h, HIGH(wLYOverridesBackup)
ld a, [hLYOverrideStart]
ldh a, [hLYOverrideStart]
ld l, a
ld a, $90
.loop
@ -2867,7 +2867,7 @@ BGEffect_DisplaceLYOverridesBackup:
BGEffect_CheckBattleTurn:
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and $1
xor [hl]
ret
@ -2875,7 +2875,7 @@ BGEffect_CheckBattleTurn:
BGEffect_CheckFlyDigStatus:
ld hl, BG_EFFECT_STRUCT_BATTLE_TURN
add hl, bc
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and $1
xor [hl]
jr nz, .player
@ -2889,7 +2889,7 @@ BGEffect_CheckFlyDigStatus:
ret
BattleBGEffects_CheckSGB:
ld a, [hSGB]
ldh a, [hSGB]
and a
ret

View File

@ -217,7 +217,7 @@ InitBattleAnimBuffer:
ld [wBattleAnimTempXOffset], a
ld a, [hli]
ld [wBattleAnimTempYOffset], a
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
ret z
ld hl, BATTLEANIMSTRUCT_01

View File

@ -425,14 +425,14 @@ BattleAnimFunction_PokeBallBlocked:
GetBallAnimPal:
ld hl, BallColors
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wCurItem)
ld [rSVBK], a
ldh [rSVBK], a
ld a, [wCurItem]
ld e, a
pop af
ld [rSVBK], a
ldh [rSVBK], a
.IsInArray:
ld a, [hli]
cp -1
@ -1137,12 +1137,12 @@ BattleAnimFunction_0D:
dw .four
.zero
call BattleAnim_IncAnonJumptableIndex
ld a, rSCY - $ff00
ld [hLCDCPointer], a
ld a, LOW(rSCY)
ldh [hLCDCPointer], a
ld a, $58
ld [hLYOverrideStart], a
ldh [hLYOverrideStart], a
ld a, $5e
ld [hLYOverrideEnd], a
ldh [hLYOverrideEnd], a
ret
.one
@ -1156,7 +1156,7 @@ BattleAnimFunction_0D:
jr nc, .asm_cd69b
call BattleAnim_IncAnonJumptableIndex
xor a
ld [hLYOverrideStart], a
ldh [hLYOverrideStart], a
ret
.asm_cd69b
@ -1175,7 +1175,7 @@ BattleAnimFunction_0D:
add [hl]
sub $10
ret c
ld [hLYOverrideStart], a
ldh [hLYOverrideStart], a
ld hl, BATTLEANIMSTRUCT_XOFFSET
add hl, bc
ld a, [hl]
@ -1196,9 +1196,9 @@ BattleAnimFunction_0D:
cp $70
jr c, asm_cd6da
xor a
ld [hLCDCPointer], a
ld [hLYOverrideStart], a
ld [hLYOverrideEnd], a
ldh [hLCDCPointer], a
ldh [hLYOverrideStart], a
ldh [hLYOverrideEnd], a
.four
call DeinitBattleAnimation
ret
@ -1209,7 +1209,7 @@ asm_cd6da:
ld [hl], a
sub $10
ret c
ld [hLYOverrideStart], a
ldh [hLYOverrideStart], a
ret
BattleAnimFunction_0E:
@ -1619,7 +1619,7 @@ Functioncd913:
ld hl, BATTLEANIMSTRUCT_10
add hl, bc
ld e, [hl]
ld hl, hTransferVirtualOAM ; $ff80
ld hl, -$80
add hl, de
ld e, l
ld d, h
@ -2116,7 +2116,7 @@ asm_cdbfa:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld e, [hl]
ld hl, hTransferVirtualOAM ; $ff80
ld hl, -$80
add hl, de
ld e, l
ld d, h
@ -2252,7 +2252,7 @@ BattleAnimFunction_21:
dw Functioncdced
Functioncdcca:
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr z, .asm_cdcd9
ld hl, BATTLEANIMSTRUCT_0B
@ -3227,7 +3227,7 @@ BattleAnimFunction_32:
Functionce260:
call BattleAnim_IncAnonJumptableIndex
ld a, [hBattleTurn]
ldh a, [hBattleTurn]
and a
jr nz, .asm_ce26c
ld a, $f0
@ -3280,7 +3280,7 @@ Functionce29f:
srl a
ld e, a
ld d, $0
ld a, [hSGB]
ldh a, [hSGB]
and a
jr nz, .asm_ce2b6
ld hl, Unknown_ce2c4
@ -3356,7 +3356,7 @@ Functionce306:
ld hl, BATTLEANIMSTRUCT_0F
add hl, bc
ld e, [hl]
ld hl, hTransferVirtualOAM ; $ff80
ld hl, -$80
add hl, de
ld e, l
ld d, h

View File

@ -4,12 +4,12 @@ GetPokeBallWobble:
push de
ld a, [rSVBK]
ldh a, [rSVBK]
ld d, a
push de
ld a, BANK(wBuffer2)
ld [rSVBK], a
ldh [rSVBK], a
ld a, [wBuffer2]
inc a
@ -54,7 +54,7 @@ GetPokeBallWobble:
pop de
ld e, a
ld a, d
ld [rSVBK], a
ldh [rSVBK], a
ld a, e
pop de
ret

View File

@ -10,10 +10,10 @@ Function1700ba:
ret
Function1700c4:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
ldh [rSVBK], a
call Function17042c
@ -47,7 +47,7 @@ Function1700c4:
call CopyBytes
call CloseSRAM
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
Function170114:
@ -556,10 +556,10 @@ INCLUDE "data/battle_tower/unknown_levels.asm"
CopyBTTrainer_FromBT_OT_TowBT_OTTemp:
; copy the BattleTower-Trainer data that lies at 'wBT_OTTrainer' to 'wBT_OTTemp'
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wBT_OTTrainer)
ld [rSVBK], a
ldh [rSVBK], a
ld hl, wBT_OTTrainer
ld de, wBT_OTTemp
@ -567,7 +567,7 @@ CopyBTTrainer_FromBT_OT_TowBT_OTTemp:
call CopyBytes
pop af
ld [rSVBK], a
ldh [rSVBK], a
ld a, BANK(sBattleTowerChallengeState)
call GetSRAMBank
@ -982,7 +982,7 @@ BattleTower_RandomlyChooseReward: ; BattleTowerAction $1e
; Generate a random stat boosting item.
.loop
call Random
ld a, [hRandomAdd]
ldh a, [hRandomAdd]
and $7
cp 6
jr c, .okay
@ -1153,28 +1153,28 @@ Function17081d: ; BattleTowerAction $17
SaveBattleTowerLevelGroup: ; BattleTowerAction $07
ld a, BANK(sBTChoiceOfLevelGroup)
call GetSRAMBank
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
ldh [rSVBK], a
ld a, [wBTChoiceOfLvlGroup]
ld [sBTChoiceOfLevelGroup], a
pop af
ld [rSVBK], a
ldh [rSVBK], a
call CloseSRAM
ret
LoadBattleTowerLevelGroup: ; BattleTowerAction $08 ; Load level group choice
ld a, BANK(sBTChoiceOfLevelGroup)
call GetSRAMBank
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
ldh [rSVBK], a
ld a, [sBTChoiceOfLevelGroup]
ld [wBTChoiceOfLvlGroup], a
pop af
ld [rSVBK], a
ldh [rSVBK], a
call CloseSRAM
ret
@ -1336,14 +1336,14 @@ String_MysteryJP:
db "なぞナゾ@@" ; MYSTERY
Function1709aa: ; BattleTowerAction $0f
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(w3_d090)
ld [rSVBK], a
ldh [rSVBK], a
ld a, [w3_d090]
ld [wScriptVar], a
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
Function1709bb: ; BattleTowerAction $10
@ -1557,17 +1557,17 @@ BattleTowerAction_UbersCheck: ; BattleTowerAction $19
LoadOpponentTrainerAndPokemonWithOTSprite:
farcall Function_LoadOpponentTrainerAndPokemons
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, $3
ld [rSVBK], a
ldh [rSVBK], a
ld hl, wBT_OTTrainerClass
ld a, [hl]
dec a
ld c, a
ld b, $0
pop af
ld [rSVBK], a
ldh [rSVBK], a
ld hl, BTTrainerClassSprites
add hl, bc
ld a, [hl]
@ -1593,9 +1593,9 @@ LoadOpponentTrainerAndPokemonWithOTSprite:
ld hl, wUsedSprites
add hl, de
ld [hli], a
ld [hUsedSpriteIndex], a
ldh [hUsedSpriteIndex], a
ld a, [hl]
ld [hUsedSpriteTile], a
ldh [hUsedSpriteTile], a
farcall GetUsedSprite
ret

View File

@ -1,8 +1,8 @@
Function_LoadOpponentTrainerAndPokemons:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wBT_OTTrainer)
ld [rSVBK], a
ldh [rSVBK], a
; Fill wBT_OTTrainer with zeros
xor a
@ -19,11 +19,11 @@ Function_LoadOpponentTrainerAndPokemons:
; Set wBT_OTTrainer as start address to write the following data to
ld de, wBT_OTTrainer
ld a, [hRandomAdd]
ldh a, [hRandomAdd]
ld b, a
.resample ; loop to find a random trainer
call Random
ld a, [hRandomAdd]
ldh a, [hRandomAdd]
add b
ld b, a ; b contains the nr of the trainer
if DEF(_CRYSTAL11)
@ -87,7 +87,7 @@ endc
jr nz, .copy_bt_trainer_data_loop
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
@ -107,11 +107,11 @@ Function_LoadRandomBattleTowerMon:
ld bc, BattleTowerMons2 - BattleTowerMons1 ; size of one level group
call AddNTimes
ld a, [hRandomAdd]
ldh a, [hRandomAdd]
ld b, a
.resample
call Random
ld a, [hRandomAdd]
ldh a, [hRandomAdd]
add b
ld b, a
maskbits BATTLETOWER_NUM_UNIQUE_MON

View File

@ -3,10 +3,10 @@ BattleTowerText::
; 1: Intro text
; 2: Player lost
; 3: Player won
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wBT_OTTrainerClass)
ld [rSVBK], a
ldh [rSVBK], a
if DEF(_CRYSTAL11)
ld hl, wBT_OTTrainerClass
else
@ -28,7 +28,7 @@ endc
and a
jr nz, .female
; generate a random number between 0 and 24
ld a, [hRandomAdd]
ldh a, [hRandomAdd]
and $1f
cp 25
jr c, .okay0
@ -40,7 +40,7 @@ endc
.female
; generate a random number between 0 and 14
ld a, [hRandomAdd]
ldh a, [hRandomAdd]
and $f
cp 15
jr c, .okay1
@ -80,7 +80,7 @@ endc
ld h, a
bccoord 1, 14
pop af
ld [rSVBK], a
ldh [rSVBK], a
call PlaceHLTextAtBC
ret

View File

@ -188,7 +188,7 @@ PrintBlueCardBalance:
.DrawBox:
push de
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld hl, BlueCardBalanceMenuHeader
call CopyMenuHeader
call MenuBox
@ -232,7 +232,7 @@ Buena_PrizeMenu:
ld [wMenuCursorBuffer], a
xor a
ld [wWhichIndexSet], a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call InitScrollingMenu
call UpdateSprites
call ScrollingMenu

View File

@ -43,16 +43,16 @@ AskRememberPassword:
ret
Buena_ExitMenu:
ld a, [hOAMUpdate]
ldh a, [hOAMUpdate]
push af
call ExitMenu
call UpdateSprites
xor a
ld [hOAMUpdate], a
ldh [hOAMUpdate], a
call DelayFrame
ld a, $1
ld [hOAMUpdate], a
ldh [hOAMUpdate], a
call ApplyTilemap
pop af
ld [hOAMUpdate], a
ldh [hOAMUpdate], a
ret

View File

@ -150,9 +150,9 @@ BugContest_JudgeContestants:
ld [hli], a
ld a, [wContestMon]
ld [hli], a
ld a, [hProduct]
ldh a, [hProduct]
ld [hli], a
ld a, [hProduct + 1]
ldh a, [hProduct + 1]
ld [hl], a
call DetermineContestWinners
ret
@ -287,8 +287,8 @@ ContestScore:
; Determine the player's score in the Bug Catching Contest.
xor a
ld [hProduct], a
ld [hMultiplicand], a
ldh [hProduct], a
ldh [hMultiplicand], a
ld a, [wContestMonSpecies] ; Species
and a

View File

@ -31,8 +31,8 @@ CatchTutorial::
call .LoadDudeData
xor a
ld [hJoyDown], a
ld [hJoyPressed], a
ldh [hJoyDown], a
ldh [hJoyPressed], a
ld a, [wOptions]
push af
and $f8

View File

@ -656,11 +656,11 @@ DayCare_InitBreeding:
ld d, a
callfar CalcExpAtLevel
ld hl, wEggMonExp
ld a, [hMultiplicand]
ldh a, [hMultiplicand]
ld [hli], a
ld a, [hMultiplicand + 1]
ldh a, [hMultiplicand + 1]
ld [hli], a
ld a, [hMultiplicand + 2]
ldh a, [hMultiplicand + 2]
ld [hl], a
xor a
ld b, wEggMonDVs - wEggMonStatExp

View File

@ -62,7 +62,7 @@ ShakeHeadbuttTree:
call OverworldTextModeSwitch
call WaitBGMap
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
farcall ClearSpriteAnims
ld hl, wVirtualOAMSprite36
ld bc, wVirtualOAMEnd - wVirtualOAMSprite36
@ -80,7 +80,7 @@ INCBIN "gfx/overworld/headbutt_tree.2bpp"
HideHeadbuttTree:
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld a, [wPlayerDirection]
and %00001100
srl a
@ -101,7 +101,7 @@ HideHeadbuttTree:
ld [hld], a
call WaitBGMap
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ret
TreeRelativeLocationTable:
@ -205,7 +205,7 @@ Cut_SpawnAnimateLeaves:
Cut_StartWaiting:
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
; Cut_WaitAnimSFX
ld hl, wJumptableIndex
inc [hl]

View File

@ -1,8 +1,8 @@
LoadFishingGFX:
ld a, [rVBK]
ldh a, [rVBK]
push af
ld a, $1
ld [rVBK], a
ldh [rVBK], a
ld de, FishingGFX
ld a, [wPlayerGender]
@ -21,7 +21,7 @@ LoadFishingGFX:
call .LoadGFX
pop af
ld [rVBK], a
ldh [rVBK], a
ret
.LoadGFX:

View File

@ -44,7 +44,7 @@ RedCredits::
farcall FadeOutPalettes
xor a
ld [wVramState], a
ld [hMapAnims], a
ldh [hMapAnims], a
farcall InitDisplayForRedCredits
ld c, 8
call DelayFrames
@ -66,7 +66,7 @@ HallOfFame_FadeOutMusic:
farcall FadeOutPalettes
xor a
ld [wVramState], a
ld [hMapAnims], a
ldh [hMapAnims], a
farcall InitDisplayForHallOfFame
ld c, 100
jp DelayFrames
@ -243,17 +243,17 @@ AnimateHOFMonEntrance:
ld de, vTiles2 tile $31
predef GetMonBackpic
ld a, $31
ld [hGraphicStartTile], a
ldh [hGraphicStartTile], a
hlcoord 6, 6
lb bc, 6, 6
predef PlaceGraphic
ld a, $d0
ld [hSCY], a
ldh [hSCY], a
ld a, $90
ld [hSCX], a
ldh [hSCX], a
call WaitBGMap
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
call SetPalettes
@ -268,29 +268,29 @@ AnimateHOFMonEntrance:
call _PrepMonFrontpic
call WaitBGMap
xor a
ld [hBGMapMode], a
ld [hSCY], a
ldh [hBGMapMode], a
ldh [hSCY], a
call HOF_SlideFrontpic
ret
HOF_SlideBackpic:
.backpicloop
ld a, [hSCX]
ldh a, [hSCX]
cp $70
ret z
add $4
ld [hSCX], a
ldh [hSCX], a
call DelayFrame
jr .backpicloop
HOF_SlideFrontpic:
.frontpicloop
ld a, [hSCX]
ldh a, [hSCX]
and a
ret z
dec a
dec a
ld [hSCX], a
ldh [hSCX], a
call DelayFrame
jr .frontpicloop
@ -432,7 +432,7 @@ LoadHOFTeam:
DisplayHOFMon:
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld a, [hli]
ld [wTempMonSpecies], a
ld a, [hli]
@ -528,17 +528,17 @@ HOF_AnimatePlayerPic:
call ByteFill
farcall GetPlayerBackpic
ld a, $31
ld [hGraphicStartTile], a
ldh [hGraphicStartTile], a
hlcoord 6, 6
lb bc, 6, 6
predef PlaceGraphic
ld a, $d0
ld [hSCY], a
ldh [hSCY], a
ld a, $90
ld [hSCX], a
ldh [hSCX], a
call WaitBGMap
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld [wCurPartySpecies], a
ld b, SCGB_PLAYER_OR_MON_FRONTPIC_PALS
call GetSGBLayout
@ -552,19 +552,19 @@ HOF_AnimatePlayerPic:
call ByteFill
farcall HOF_LoadTrainerFrontpic
xor a
ld [hGraphicStartTile], a
ldh [hGraphicStartTile], a
hlcoord 12, 5
lb bc, 7, 7
predef PlaceGraphic
ld a, $c0
ld [hSCX], a
ldh [hSCX], a
call WaitBGMap
xor a
ld [hBGMapMode], a
ld [hSCY], a
ldh [hBGMapMode], a
ldh [hSCY], a
call HOF_SlideFrontpic
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
hlcoord 0, 2
lb bc, 8, 9
call TextBox

View File

@ -18,7 +18,7 @@ HealMachineAnim:
; 2: Up (Hall of Fame)
ld a, [wScriptVar]
ld [wBuffer1], a
ld a, [rOBP1]
ldh a, [rOBP1]
ld [wBuffer2], a
call .DoJumptableFunctions
ld a, [wBuffer2]
@ -158,7 +158,7 @@ INCBIN "gfx/overworld/heal_machine.2bpp"
call IsCGB
jr nz, .cgb
ld a, %11100000
ld [rOBP1], a
ldh [rOBP1], a
ret
.cgb
@ -168,7 +168,7 @@ INCBIN "gfx/overworld/heal_machine.2bpp"
ld a, BANK(wOBPals2)
call FarCopyWRAM
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
.palettes
@ -189,16 +189,16 @@ INCLUDE "gfx/overworld/heal_machine.pal"
.FlashPalettes:
call IsCGB
jr nz, .go
ld a, [rOBP1]
ldh a, [rOBP1]
xor %00101000
ld [rOBP1], a
ldh [rOBP1], a
ret
.go
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wOBPals2)
ld [rSVBK], a
ldh [rSVBK], a
ld hl, wOBPals2 palette PAL_OW_TREE
ld a, [hli]
@ -230,9 +230,9 @@ INCLUDE "gfx/overworld/heal_machine.pal"
ld [hl], a
pop af
ld [rSVBK], a
ldh [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
.PlaceHealingMachineTile:

View File

@ -59,7 +59,7 @@ Kurt_SelectApricorn:
ld a, [wMenuSelection]
ld [wMenuCursorBuffer], a
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call InitScrollingMenu
call UpdateSprites
call ScrollingMenu
@ -124,7 +124,7 @@ Kurt_SelectQuantity:
call LoadMenuHeader
.loop
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call MenuBox
call UpdateSprites
call .PlaceApricornName

View File

@ -198,30 +198,30 @@ CalcMagikarpLength:
; c = (bc - de) / [hl]
call .BCMinusDE
ld a, b
ld [hDividend + 0], a
ldh [hDividend + 0], a
ld a, c
ld [hDividend + 1], a
ldh [hDividend + 1], a
ld a, [hl]
ld [hDivisor], a
ldh [hDivisor], a
ld b, 2
call Divide
ld a, [hQuotient + 2]
ldh a, [hQuotient + 2]
ld c, a
; de = c + 100 × (2 + i)
xor a
ld [hMultiplicand + 0], a
ld [hMultiplicand + 1], a
ldh [hMultiplicand + 0], a
ldh [hMultiplicand + 1], a
ld a, 100
ld [hMultiplicand + 2], a
ldh [hMultiplicand + 2], a
ld a, [wTempByteValue]
ld [hMultiplier], a
ldh [hMultiplier], a
call Multiply
ld b, 0
ld a, [hProduct + 3]
ldh a, [hProduct + 3]
add c
ld e, a
ld a, [hProduct + 2]
ldh a, [hProduct + 2]
adc b
ld d, a
jr .done

View File

@ -14,10 +14,10 @@ MagnetTrain:
.continue
ld h, a
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wMagnetTrain)
ld [rSVBK], a
ldh [rSVBK], a
ld a, h
ld [wMagnetTrainDirection], a
@ -30,9 +30,9 @@ MagnetTrain:
ld a, d
ld [wMagnetTrainPlayerSpriteInitX], a
ld a, [hSCX]
ldh a, [hSCX]
push af
ld a, [hSCY]
ldh a, [hSCY]
push af
call MagntTrain_LoadGFX_PlayMusic
ld hl, hVBlank
@ -58,13 +58,13 @@ MagnetTrain:
.done
pop af
ld [hVBlank], a
ldh [hVBlank], a
call ClearBGPalettes
xor a
ld [hLCDCPointer], a
ld [hLYOverrideStart], a
ld [hLYOverrideEnd], a
ld [hSCX], a
ldh [hLCDCPointer], a
ldh [hLYOverrideStart], a
ldh [hLYOverrideEnd], a
ldh [hSCX], a
ld [wRequested2bppSource], a
ld [wRequested2bppSource + 1], a
ld [wRequested2bppDest], a
@ -73,13 +73,13 @@ MagnetTrain:
call ClearTileMap
pop af
ld [hSCY], a
ldh [hSCY], a
pop af
ld [hSCX], a
ldh [hSCX], a
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
MagnetTrain_UpdateLYOverrides:
@ -87,7 +87,7 @@ MagnetTrain_UpdateLYOverrides:
ld c, $2f
ld a, [wMagnetTrainOffset]
add a
ld [hSCX], a
ldh [hSCX], a
call .loadloop
ld c, $30
ld a, [wMagnetTrainPosition]
@ -119,19 +119,19 @@ MagntTrain_LoadGFX_PlayMusic:
call SetMagnetTrainPals
call DrawMagnetTrain
ld a, $90
ld [hWY], a
ldh [hWY], a
call EnableLCD
xor a
ld [hBGMapMode], a
ld [hSCX], a
ld [hSCY], a
ld a, [rSVBK]
ldh [hBGMapMode], a
ldh [hSCX], a
ldh [hSCY], a
ldh a, [rSVBK]
push af
ld a, BANK(wPlayerGender)
ld [rSVBK], a
ldh [rSVBK], a
farcall GetPlayerIcon
pop af
ld [rSVBK], a
ldh [rSVBK], a
ld hl, vTiles0
ld c, 4
call Request2bpp
@ -242,13 +242,13 @@ MagnetTrain_InitLYOverrides:
ld bc, wLYOverridesBackupEnd - wLYOverridesBackup
ld a, [wMagnetTrainInitPosition]
call ByteFill
ld a, rSCX - $ff00
ld [hLCDCPointer], a
ld a, LOW(rSCX)
ldh [hLCDCPointer], a
ret
SetMagnetTrainPals:
ld a, $1
ld [rVBK], a
ldh [rVBK], a
; bushes
hlbgcoord 0, 0
@ -275,7 +275,7 @@ SetMagnetTrainPals:
call ByteFill
ld a, $0
ld [rVBK], a
ldh [rVBK], a
ret
MagnetTrain_Jumptable:
@ -309,10 +309,10 @@ MagnetTrain_Jumptable:
ld a, [wMagnetTrainPlayerSpriteInitX]
ld e, a
ld b, SPRITE_ANIM_INDEX_MAGNET_TRAIN_RED
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wPlayerGender)
ld [rSVBK], a
ldh [rSVBK], a
ld a, [wPlayerGender]
bit PLAYERGENDER_FEMALE_F, a
jr z, .got_gender
@ -320,7 +320,7 @@ MagnetTrain_Jumptable:
.got_gender
pop af
ld [rSVBK], a
ldh [rSVBK], a
ld a, b
call _InitSpriteAnimStruct
ld hl, SPRITEANIMSTRUCT_TILE_ID
@ -408,10 +408,10 @@ MagnetTrain_Jumptable_FirstRunThrough:
call MagnetTrain_UpdateLYOverrides
call PushLYOverrides
call DelayFrame
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wEnvironment)
ld [rSVBK], a
ldh [rSVBK], a
ld a, [wTimeOfDayPal]
push af
ld a, [wEnvironment]
@ -424,18 +424,18 @@ MagnetTrain_Jumptable_FirstRunThrough:
ld b, SCGB_MAPPALS
call GetSGBLayout
call UpdateTimePals
ld a, [rBGP]
ldh a, [rBGP]
ld [wBGP], a
ld a, [rOBP0]
ldh a, [rOBP0]
ld [wOBP0], a
ld a, [rOBP1]
ldh a, [rOBP1]
ld [wOBP1], a
pop af
ld [wEnvironment], a
pop af
ld [wTimeOfDayPal], a
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
MagnetTrainTilemap1:

View File

@ -2,7 +2,7 @@ MAP_NAME_SIGN_START EQU $60
ReturnFromMapSetupScript::
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
farcall .inefficient_farcall ; this is a waste of 6 ROM bytes and 6 stack bytes
ret
@ -51,10 +51,10 @@ ReturnFromMapSetupScript::
ld a, [wCurrentLandmark]
ld [wPreviousLandmark], a
ld a, $90
ld [rWY], a
ld [hWY], a
ldh [rWY], a
ldh [hWY], a
xor a
ld [hLCDCPointer], a
ldh [hLCDCPointer], a
ret
.CheckMovingWithinLandmark:
@ -112,16 +112,16 @@ PlaceMapNameSign::
.skip2
ld a, $80
ld a, $70
ld [rWY], a
ld [hWY], a
ldh [rWY], a
ldh [hWY], a
ret
.disappear
ld a, $90
ld [rWY], a
ld [hWY], a
ldh [rWY], a
ldh [hWY], a
xor a
ld [hLCDCPointer], a
ldh [hLCDCPointer], a
ret
LoadMapNameSignGFX:

View File

@ -1,8 +1,8 @@
BankOfMom:
ld a, [hInMenu]
ldh a, [hInMenu]
push af
ld a, $1
ld [hInMenu], a
ldh [hInMenu], a
xor a
ld [wJumptableIndex], a
.loop
@ -14,7 +14,7 @@ BankOfMom:
.done
pop af
ld [hInMenu], a
ldh [hInMenu], a
ret
.RunJumptable:
@ -295,7 +295,7 @@ DSTChecks:
; check the time; avoid changing DST if doing so would change the current day
ld a, [wDST]
bit 7, a
ld a, [hHours]
ldh a, [hHours]
jr z, .NotDST
and a ; within one hour of 00:00?
jr z, .LostBooklet
@ -429,7 +429,7 @@ Mom_SetUpDepositMenu:
Mom_ContinueMenuSetup:
push de
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
hlcoord 0, 0
lb bc, 6, 18
call TextBox
@ -475,7 +475,7 @@ Mom_WithdrawDepositMenuJoypad:
jr nz, .pressedA
call .dpadaction
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
hlcoord 12, 6
ld bc, 7
ld a, " "
@ -484,7 +484,7 @@ Mom_WithdrawDepositMenuJoypad:
ld de, wStringBuffer2
lb bc, PRINTNUM_MONEY | PRINTNUM_LEADINGZEROS | 3, 6
call PrintNum
ld a, [hVBlankCounter]
ldh a, [hVBlankCounter]
and $10
jr nz, .skip
hlcoord 13, 6

View File

@ -61,11 +61,11 @@ CheckBalance_MomItem2:
jr nc, .nope
call GetItemFromMom
ld a, [hli]
ld [hMoneyTemp], a
ldh [hMoneyTemp], a
ld a, [hli]
ld [hMoneyTemp + 1], a
ldh [hMoneyTemp + 1], a
ld a, [hli]
ld [hMoneyTemp + 2], a
ldh [hMoneyTemp + 2], a
ld de, wMomsMoney
ld bc, hMoneyTemp
farcall CompareMoney
@ -118,11 +118,11 @@ MomBuysItem_DeductFunds:
ld de, 3 ; cost
add hl, de
ld a, [hli]
ld [hMoneyTemp], a
ldh [hMoneyTemp], a
ld a, [hli]
ld [hMoneyTemp + 1], a
ldh [hMoneyTemp + 1], a
ld a, [hli]
ld [hMoneyTemp + 2], a
ldh [hMoneyTemp + 2], a
ld de, wMomsMoney
ld bc, hMoneyTemp
farcall TakeMoney

View File

@ -23,13 +23,13 @@ _GiveOddEgg:
.not_done
; Break when [hRandom] <= de.
ld a, [hRandom + 1]
ldh a, [hRandom + 1]
cp d
jr c, .done
jr z, .ok
jr .next
.ok
ld a, [hRandom + 0]
ldh a, [hRandom + 0]
cp e
jr c, .done
jr z, .done

View File

@ -226,7 +226,7 @@ CutDownTreeOrGrass:
ld a, [wBuffer5] ; ReplacementTile
ld [hl], a
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call OverworldTextModeSwitch
call UpdateSprites
call DelayFrame
@ -575,7 +575,7 @@ FlyFunction:
.outdoors
xor a
ld [hMapAnims], a
ldh [hMapAnims], a
call LoadStandardMenuHeader
call ClearSprites
farcall _FlyMap
@ -1199,7 +1199,7 @@ DisappearWhirlpool:
ld a, [wBuffer5]
ld [hl], a
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call OverworldTextModeSwitch
ld a, [wBuffer6]
ld e, a
@ -1360,12 +1360,12 @@ GetFacingObject:
farcall CheckFacingObject
jr nc, .fail
ld a, [hObjectStructIndexBuffer]
ldh a, [hObjectStructIndexBuffer]
call GetObjectStruct
ld hl, OBJECT_MAP_OBJECT_INDEX
add hl, bc
ld a, [hl]
ld [hLastTalked], a
ldh [hLastTalked], a
call GetMapObject
ld hl, MAPOBJECT_MOVEMENT
add hl, bc
@ -1623,7 +1623,7 @@ MovementData_0xd093:
PutTheRodAway:
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld a, $1
ld [wPlayerAction], a
call UpdateSprites

View File

@ -1,12 +1,12 @@
LoadPoisonBGPals:
call .LoadPals
ld a, [hCGB]
ldh a, [hCGB]
and a
ret nz
ret ; ????
.LoadPals:
ld a, [hCGB]
ldh a, [hCGB]
and a
jr nz, .cgb
ld a, [wTimeOfDayPal]
@ -24,10 +24,10 @@ LoadPoisonBGPals:
ret
.cgb
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals2)
ld [rSVBK], a
ldh [rSVBK], a
ld hl, wBGPals2
ld c, 4 palettes
.loop
@ -38,9 +38,9 @@ LoadPoisonBGPals:
dec c
jr nz, .loop
pop af
ld [rSVBK], a
ldh [rSVBK], a
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ld c, 4
call DelayFrames
farcall _UpdateTimePals

View File

@ -10,7 +10,7 @@ PokemonCenterPC:
call LoadMenuHeader
.loop
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call .ChooseWhichPCListToUse
ld [wWhichIndexSet], a
call DoNthMenu
@ -360,7 +360,7 @@ PlayerWithdrawItemMenu:
ld hl, .WithdrewText
call MenuTextBox
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call ExitMenu
ret

View File

@ -7,7 +7,7 @@ Pokepic::
ld b, SCGB_POKEPIC
call GetSGBLayout
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
call GetBaseData
@ -21,7 +21,7 @@ Pokepic::
ld c, a
call Coord2Tile
ld a, $80
ld [hGraphicStartTile], a
ldh [hGraphicStartTile], a
lb bc, 7, 7
predef PlaceGraphic
call WaitBGMap
@ -34,7 +34,7 @@ ClosePokepic::
call WaitBGMap
call GetMemSGBLayout
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call OverworldTextModeSwitch
call ApplyTilemap
call UpdateSprites

View File

@ -22,10 +22,10 @@ GivePokerusAndConvertBerries:
bit STATUSFLAGS2_REACHED_GOLDENROD_F, [hl]
ret z
call Random
ld a, [hRandomAdd]
ldh a, [hRandomAdd]
and a
ret nz
ld a, [hRandomSub]
ldh a, [hRandomSub]
cp $3
ret nc ; 3/65536 chance (00 00, 00 01 or 00 02)
ld a, [wPartyCount]

View File

@ -12,7 +12,7 @@ PhotoStudio:
call DisableSpriteUpdates
farcall PrintPartymon
call ReturnToMapWithSpeechTextbox
ld a, [hPrinter]
ldh a, [hPrinter]
and a
jr nz, .cancel
ld hl, .Text_Presto

View File

@ -6,10 +6,10 @@ _UnownPrinter:
and a
ret z
ld a, [hInMenu]
ldh a, [hInMenu]
push af
ld a, $1
ld [hInMenu], a
ldh [hInMenu], a
ld a, [wOptions]
push af
set NO_TEXT_SCROLL, a
@ -69,11 +69,11 @@ _UnownPrinter:
.joy_loop
call JoyTextDelay
ld a, [hJoyPressed]
ldh a, [hJoyPressed]
and B_BUTTON
jr nz, .pressed_b
ld a, [hJoyPressed]
ldh a, [hJoyPressed]
and A_BUTTON
jr nz, .pressed_a
@ -94,15 +94,15 @@ _UnownPrinter:
pop af
ld [wOptions], a
pop af
ld [hInMenu], a
ldh [hInMenu], a
call ReturnToMapFromSubmenu
ret
.LeftRight:
ld a, [hJoyLast]
ldh a, [hJoyLast]
and D_RIGHT
jr nz, .press_right
ld a, [hJoyLast]
ldh a, [hJoyLast]
and D_LEFT
jr nz, .press_left
ret
@ -145,7 +145,7 @@ _UnownPrinter:
call .Load2bppToSRAM
hlcoord 1, 6
xor a
ld [hGraphicStartTile], a
ldh [hGraphicStartTile], a
lb bc, 7, 7
predef PlaceGraphic
ld de, vTiles2 tile $31
@ -153,23 +153,23 @@ _UnownPrinter:
ret
.Load2bppToSRAM:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
ld [rSVBK], a
ldh [rSVBK], a
ld a, BANK(sScratch)
call GetSRAMBank
ld de, wDecompressScratch
ld hl, sScratch
ld a, [hROMBank]
ldh a, [hROMBank]
ld b, a
ld c, $31
call Get2bpp
call CloseSRAM
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
.vacant
@ -188,7 +188,7 @@ _UnownPrinter:
ld hl, vTiles2 tile $31
ld de, sScratch
ld c, $31
ld a, [hROMBank]
ldh a, [hROMBank]
ld b, a
call Get2bpp
call CloseSRAM
@ -224,7 +224,7 @@ PlaceUnownPrinterFrontpic:
call ByteFill
hlcoord 7, 11
ld a, $31
ld [hGraphicStartTile], a
ldh [hGraphicStartTile], a
lb bc, 7, 7
predef PlaceGraphic
ret

View File

@ -37,7 +37,7 @@ RotateUnownFrontpic:
pop hl
ld de, sScratch
ld c, 7 * 7
ld a, [hROMBank]
ldh a, [hROMBank]
ld b, a
call Get2bpp
call CloseSRAM

View File

@ -380,11 +380,11 @@ PlayCurMonCry:
jp PlayMonCry
GameboyCheck:
ld a, [hCGB]
ldh a, [hCGB]
and a
jr nz, .cgb
ld a, [hSGB]
ldh a, [hSGB]
and a
jr nz, .sgb

View File

@ -242,34 +242,34 @@ GetTreeScore:
add hl, bc
ld a, h
ld [hDividend], a
ldh [hDividend], a
ld a, l
ld [hDividend + 1], a
ldh [hDividend + 1], a
ld a, 5
ld [hDivisor], a
ldh [hDivisor], a
ld b, 2
call Divide
ld a, [hQuotient + 1]
ld [hDividend], a
ld a, [hQuotient + 2]
ld [hDividend + 1], a
ldh a, [hQuotient + 1]
ldh [hDividend], a
ldh a, [hQuotient + 2]
ldh [hDividend + 1], a
ld a, 10
ld [hDivisor], a
ldh [hDivisor], a
ld b, 2
call Divide
ld a, [hQuotient + 3]
ldh a, [hRemainder]
ret
.OTIDScore:
ld a, [wPlayerID]
ld [hDividend], a
ldh [hDividend], a
ld a, [wPlayerID + 1]
ld [hDividend + 1], a
ldh [hDividend + 1], a
ld a, 10
ld [hDivisor], a
ldh [hDivisor], a
ld b, 2
call Divide
ld a, [hQuotient + 3]
ldh a, [hRemainder]
ret

View File

@ -115,7 +115,7 @@ DisplayUnownWords:
.load
call LoadMenuHeader
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call MenuBox
call UpdateSprites
call ApplyTilemap

View File

@ -147,10 +147,10 @@ _CardFlip:
ld de, SFX_TRANSACTION
call PlaySFX
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call CardFlip_PrintCoinBalance
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
call WaitSFX
call .Increment
ret
@ -162,7 +162,7 @@ _CardFlip:
.ChooseACard:
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
hlcoord 0, 0
lb bc, 12, 9
call CardFlip_FillGreenBox
@ -172,13 +172,13 @@ _CardFlip:
call AddNTimes
ld [hl], CARDFLIP_LIGHT_ON
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld c, 20
call DelayFrames
hlcoord 2, 0
call PlaceCardFaceDown
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld c, 20
call DelayFrames
hlcoord 2, 6
@ -190,7 +190,7 @@ _CardFlip:
ld [wCardFlipWhichCard], a
.loop
call JoyTextDelay
ld a, [hJoyLast]
ldh a, [hJoyLast]
and A_BUTTON
jr nz, .next
ld de, SFX_KINESIS
@ -242,7 +242,7 @@ _CardFlip:
call CardFlip_UpdateCoinBalanceDisplay
.betloop
call JoyTextDelay
ld a, [hJoyLast]
ldh a, [hJoyLast]
and A_BUTTON
jr nz, .betdone
call ChooseCard_HandleJoypad
@ -261,7 +261,7 @@ _CardFlip:
.CheckTheCard:
xor a
ld [hVBlankCounter], a
ldh [hVBlankCounter], a
call CardFlip_UpdateCursorOAM
call WaitSFX
ld de, SFX_CHOOSE_A_CARD
@ -311,7 +311,7 @@ _CardFlip:
jr c, .KeepTheCurrentDeck
call CardFlip_InitTilemap
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
call CardFlip_ShuffleDeck
ld hl, .CardsShuffledText
call PrintText
@ -396,7 +396,7 @@ GetCoordsOfChosenCard:
PlaceCardFaceDown:
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld de, .FaceDownCardTilemap
lb bc, 6, 5
call CardFlip_CopyToBox
@ -412,7 +412,7 @@ PlaceCardFaceDown:
CardFlip_DisplayCardFaceUp:
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
push hl
push hl
; Flip the card face up.
@ -458,7 +458,7 @@ CardFlip_DisplayCardFaceUp:
pop hl
; Pointless CGB check
ld a, [hCGB]
ldh a, [hCGB]
and a
ret z
@ -519,7 +519,7 @@ CardFlip_PrintCoinBalance:
CardFlip_InitTilemap:
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, $29
@ -607,7 +607,7 @@ CardFlip_ShiftDigitsLeftTwoPixels:
CardFlip_BlankDiscardedCardSlot:
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld a, [wCardFlipFaceUpCard]
ld e, a
ld d, 0
@ -1327,10 +1327,10 @@ ChooseCard_HandleJoypad:
CardFlip_UpdateCursorOAM:
call ClearSprites
ld a, [hCGB]
ldh a, [hCGB]
and a
jr nz, .skip
ld a, [hVBlankCounter]
ldh a, [hVBlankCounter]
and $4
ret nz
@ -1560,7 +1560,7 @@ ENDM
dsprite 1, 0, 1, 0, $00, 0 | X_FLIP | Y_FLIP | PRIORITY
CardFlip_InitAttrPals:
ld a, [hCGB]
ldh a, [hCGB]
and a
ret z
@ -1594,16 +1594,16 @@ CardFlip_InitAttrPals:
ld a, $1
call CardFlip_FillBox
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ld [rSVBK], a
ldh [rSVBK], a
ld hl, .palettes
ld de, wBGPals1
ld bc, 9 palettes
call CopyBytes
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
.palettes

View File

@ -28,14 +28,14 @@ _DummyGame:
xor a
call ByteFill
xor a
ld [hSCY], a
ld [hSCX], a
ld [rWY], a
ldh [hSCY], a
ldh [hSCX], a
ldh [rWY], a
ld [wJumptableIndex], a
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld a, LCDC_DEFAULT
ld [rLCDC], a
ldh [rLCDC], a
ld a, $e4
call DmgToCgbBGPals
ld a, $e0
@ -200,7 +200,7 @@ endr
ret
.RevealAll:
ld a, [hJoypadPressed]
ldh a, [hJoypadPressed]
and A_BUTTON
ret z
xor a
@ -500,7 +500,7 @@ DummyGame_InterpretJoypad_AnimateCursor:
cp $7
jr nc, .quit
call JoyTextDelay
ld hl, hJoypadPressed ; $ffa3
ld hl, hJoypadPressed
ld a, [hl]
and A_BUTTON
jr nz, .pressed_a

View File

@ -167,7 +167,7 @@ Slots_GetPals:
ld a, %11100100
call DmgToCgbBGPals
lb de, %11100100, %11100100
ld a, [hCGB]
ldh a, [hCGB]
and a
jr nz, .cgb
lb de, %11000000, %11100100
@ -214,7 +214,7 @@ SlotsLoop:
ld a, [wTextDelayFrames]
and $7
ret nz
ld a, [rBGP]
ldh a, [rBGP]
xor %00001100
call DmgToCgbBGPals
ret
@ -343,7 +343,7 @@ SlotsAction_WaitStart:
.proceed
call SlotsAction_Next
xor a
ld [hJoypadSum], a
ldh [hJoypadSum], a
ret
SlotsAction_WaitReel1:
@ -365,7 +365,7 @@ SlotsAction_WaitStopReel1:
call Slots_LoadReelState
call SlotsAction_Next
xor a
ld [hJoypadSum], a
ldh [hJoypadSum], a
SlotsAction_WaitReel2:
ld hl, hJoypadSum
ld a, [hl]
@ -385,7 +385,7 @@ SlotsAction_WaitStopReel2:
call Slots_LoadReelState
call SlotsAction_Next
xor a
ld [hJoypadSum], a
ldh [hJoypadSum], a
SlotsAction_WaitReel3:
ld hl, hJoypadSum
ld a, [hl]
@ -405,7 +405,7 @@ SlotsAction_WaitStopReel3:
call Slots_LoadReelState
call SlotsAction_Next
xor a
ld [hJoypadSum], a
ldh [hJoypadSum], a
ret
SlotsAction_FlashIfWin:
@ -429,7 +429,7 @@ SlotsAction_FlashScreen:
srl a
ret z
ld a, [rOBP0]
ldh a, [rOBP0]
xor $ff
ld e, a
ld d, a
@ -2042,7 +2042,7 @@ Slots_AnimateGolem:
xor $ff
inc a
ld [hl], a
ld [hSCY], a
ldh [hSCY], a
ret
.restart
@ -2050,7 +2050,7 @@ Slots_AnimateGolem:
add hl, bc
xor a
ld [hl], a
ld [hSCY], a
ldh [hSCY], a
ret
Slots_AnimateChansey:

View File

@ -4,15 +4,15 @@ PUZZLE_VOID EQU $ef
puzcoord EQUS "* 6 +"
_UnownPuzzle:
ld a, [hInMenu]
ldh a, [hInMenu]
push af
ld a, $1
ld [hInMenu], a
ldh [hInMenu], a
call ClearBGPalettes
call ClearTileMap
call ClearSprites
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call DisableLCD
ld hl, wc608 ; includes wPuzzlePieces
ld bc, wc7e8 - wc608
@ -38,15 +38,15 @@ _UnownPuzzle:
call UnownPuzzle_UpdateTilemap
call PlaceStartCancelBox
xor a
ld [hSCY], a
ld [hSCX], a
ld [rWY], a
ldh [hSCY], a
ldh [hSCX], a
ldh [rWY], a
ld [wJumptableIndex], a
ld [wHoldingUnownPuzzlePiece], a
ld [wUnownPuzzleCursorPosition], a
ld [wUnownPuzzleHeldPiece], a
ld a, %10010011
ld [rLCDC], a
ldh [rLCDC], a
call WaitBGMap
ld b, SCGB_UNOWN_PUZZLE
call GetSGBLayout
@ -66,7 +66,7 @@ _UnownPuzzle:
ld a, [wHoldingUnownPuzzlePiece]
and a
jr nz, .holding_piece
ld a, [hVBlankCounter]
ldh a, [hVBlankCounter]
and $10
jr z, .clear
.holding_piece
@ -81,12 +81,12 @@ _UnownPuzzle:
.quit
pop af
ld [hInMenu], a
ldh [hInMenu], a
call ClearBGPalettes
call ClearTileMap
call ClearSprites
ld a, LCDC_DEFAULT
ld [rLCDC], a
ldh [rLCDC], a
ret
InitUnownPuzzlePiecePositions:
@ -185,10 +185,10 @@ UnownPuzzleJumptable:
dw .Function
.Function:
ld a, [hJoyPressed]
ldh a, [hJoyPressed]
and START
jp nz, UnownPuzzle_Quit
ld a, [hJoyPressed]
ldh a, [hJoyPressed]
and A_BUTTON
jp nz, UnownPuzzle_A
ld hl, hJoyLast

View File

@ -1,7 +1,7 @@
; Replaces the functionality of sgb.asm to work with CGB hardware.
CheckCGB:
ld a, [hCGB]
ldh a, [hCGB]
and a
ret
@ -190,7 +190,7 @@ _CGB_PokegearPals:
call FarCopyWRAM
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
_CGB_StatsScreenHPPals:
@ -244,7 +244,7 @@ _CGB_StatsScreenHPPals:
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
StatsScreenPagePals:
@ -283,7 +283,7 @@ _CGB_Pokedex:
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
.PokedexQuestionMarkPalette:
@ -318,7 +318,7 @@ _CGB_BillsPC:
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
.Function9009:
@ -340,7 +340,7 @@ _CGB_BillsPC:
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
.BillsPCOrangePalette:
@ -363,7 +363,7 @@ _CGB_PokedexUnownMode:
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
_CGB_SlotMachine:
@ -416,7 +416,7 @@ _CGB_SlotMachine:
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
_CGB06:
@ -434,7 +434,7 @@ _CGB06:
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
_CGB_GSIntro:
@ -574,7 +574,7 @@ _CGB_Evolution:
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
_CGB_GSTitleScreen:
@ -592,7 +592,7 @@ _CGB_GSTitleScreen:
ld [wSGBPredef], a
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
_CGB0d:
@ -609,17 +609,17 @@ _CGB_UnownPuzzle:
ld a, PREDEFPAL_UNOWN_PUZZLE
call GetPredefPal
call LoadHLPaletteIntoDE
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wOBPals1)
ld [rSVBK], a
ldh [rSVBK], a
ld hl, wOBPals1
ld a, LOW(palred 31 + palgreen 0 + palblue 0)
ld [hli], a
ld a, HIGH(palred 31 + palgreen 0 + palblue 0)
ld [hl], a
pop af
ld [rSVBK], a
ldh [rSVBK], a
call WipeAttrMap
call ApplyAttrMap
ret
@ -726,7 +726,7 @@ _CGB_TrainerCard:
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
_CGB_MoveList:
@ -750,7 +750,7 @@ _CGB_MoveList:
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
_CGB_BetaPikachuMinigame:
@ -760,7 +760,7 @@ _CGB_BetaPikachuMinigame:
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
_CGB_PokedexSearchOption:
@ -772,7 +772,7 @@ _CGB_PokedexSearchOption:
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
_CGB_PackPals:
@ -820,7 +820,7 @@ _CGB_PackPals:
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
.ChrisPackPals:
@ -878,7 +878,7 @@ _CGB13:
call ApplyAttrMap
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
_CGB_GamefreakLogo:

View File

@ -151,7 +151,7 @@ Unreferenced_Function8b07:
call ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
.BGPal:
@ -169,7 +169,7 @@ Unreferenced_Function8b07:
Unreferenced_Function8b3f:
call CheckCGB
ret nz
ld a, [hSGB]
ldh a, [hSGB]
and a
ret z
ld hl, BlkPacket_9a86
@ -178,7 +178,7 @@ Unreferenced_Function8b3f:
Unreferenced_Function8b4d:
call CheckCGB
jr nz, .cgb
ld a, [hSGB]
ldh a, [hSGB]
and a
ret z
ld hl, PalPacket_BetaIntroVenusaur
@ -193,7 +193,7 @@ Unreferenced_Function8b4d:
Unreferenced_Function8b67:
call CheckCGB
jr nz, .cgb
ld a, [hSGB]
ldh a, [hSGB]
and a
ret z
ld hl, PalPacket_Pack
@ -208,7 +208,7 @@ Unreferenced_Function8b67:
Unreferenced_Function8b81:
call CheckCGB
jr nz, .cgb
ld a, [hSGB]
ldh a, [hSGB]
and a
ret z
ld a, c
@ -274,7 +274,7 @@ got_palette_pointer_8bd7
ret
Unreferenced_Function8bec:
ld a, [hCGB]
ldh a, [hCGB]
and a
jr nz, .cgb
ld hl, wPlayerLightScreenCount
@ -353,7 +353,7 @@ ApplyHPBarPals:
ld a, BANK(wBGPals2)
call FarCopyWRAM
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
.PartyMenu:
@ -383,10 +383,10 @@ LoadStatsScreenPals:
dec c
add hl, bc
add hl, bc
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ld [rSVBK], a
ldh [rSVBK], a
ld a, [hli]
ld [wBGPals1 palette 0], a
ld [wBGPals1 palette 2], a
@ -394,7 +394,7 @@ LoadStatsScreenPals:
ld [wBGPals1 palette 0 + 1], a
ld [wBGPals1 palette 2 + 1], a
pop af
ld [rSVBK], a
ldh [rSVBK], a
call ApplyPals
ld a, $1
ret
@ -492,10 +492,10 @@ GetPredefPal:
ret
LoadHLPaletteIntoDE:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wOBPals1)
ld [rSVBK], a
ldh [rSVBK], a
ld c, 1 palettes
.loop
ld a, [hli]
@ -504,14 +504,14 @@ LoadHLPaletteIntoDE:
dec c
jr nz, .loop
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
LoadPalette_White_Col1_Col2_Black:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ld [rSVBK], a
ldh [rSVBK], a
ld a, LOW(PALRGB_WHITE)
ld [de], a
@ -535,7 +535,7 @@ LoadPalette_White_Col1_Col2_Black:
inc de
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
FillBoxCGB:
@ -560,10 +560,10 @@ ResetBGPals:
push de
push hl
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ld [rSVBK], a
ldh [rSVBK], a
ld hl, wBGPals1
ld c, 1 palettes
@ -582,7 +582,7 @@ ResetBGPals:
jr nz, .loop
pop af
ld [rSVBK], a
ldh [rSVBK], a
pop hl
pop de
@ -606,19 +606,19 @@ ApplyPals:
ret
ApplyAttrMap:
ld a, [rLCDC]
ldh a, [rLCDC]
bit rLCDC_ENABLE, a
jr z, .UpdateVBank1
ld a, [hBGMapMode]
ldh a, [hBGMapMode]
push af
ld a, $2
ld [hBGMapMode], a
ldh [hBGMapMode], a
call DelayFrame
call DelayFrame
call DelayFrame
call DelayFrame
pop af
ld [hBGMapMode], a
ldh [hBGMapMode], a
ret
.UpdateVBank1:
@ -626,7 +626,7 @@ ApplyAttrMap:
debgcoord 0, 0
ld b, SCREEN_HEIGHT
ld a, $1
ld [rVBK], a
ldh [rVBK], a
.row
ld c, SCREEN_WIDTH
.col
@ -644,7 +644,7 @@ ApplyAttrMap:
dec b
jr nz, .row
ld a, $0
ld [rVBK], a
ldh [rVBK], a
ret
; CGB layout for SCGB_PARTY_MENU_HP_PALS
@ -742,11 +742,11 @@ Unreferenced_Function9779:
ret z
ld hl, BattleObjectPals
ld a, $90
ld [rOBPI], a
ldh [rOBPI], a
ld c, 6 palettes
.loop
ld a, [hli]
ld [rOBPD], a
ldh [rOBPD], a
dec c
jr nz, .loop
ld hl, BattleObjectPals
@ -763,7 +763,7 @@ Unreferenced_Function97cc:
call CheckCGB
ret z
ld a, $90
ld [rOBPI], a
ldh [rOBPI], a
ld a, PREDEFPAL_TRADE_TUBE
call GetPredefPal
call .PushPalette
@ -776,7 +776,7 @@ Unreferenced_Function97cc:
ld c, 1 palettes
.loop
ld a, [hli]
ld [rOBPD], a
ldh [rOBPD], a
dec c
jr nz, .loop
ret
@ -822,9 +822,9 @@ _PushSGBPals:
.loop
push bc
xor a
ld [rJOYP], a
ldh [rJOYP], a
ld a, $30
ld [rJOYP], a
ldh [rJOYP], a
ld b, $10
.loop2
ld e, $8
@ -836,18 +836,18 @@ _PushSGBPals:
jr nz, .okay
ld a, $20
.okay
ld [rJOYP], a
ldh [rJOYP], a
ld a, $30
ld [rJOYP], a
ldh [rJOYP], a
rr d
dec e
jr nz, .loop3
dec b
jr nz, .loop2
ld a, $20
ld [rJOYP], a
ldh [rJOYP], a
ld a, $30
ld [rJOYP], a
ldh [rJOYP], a
call SGBDelayCycles
pop bc
dec b
@ -864,12 +864,12 @@ InitSGBBorder:
set 7, a
ld [wcfbe], a
xor a
ld [rJOYP], a
ld [hSGB], a
ldh [rJOYP], a
ldh [hSGB], a
call PushSGBBorderPalsAndWait
jr nc, .skip
ld a, $1
ld [hSGB], a
ldh [hSGB], a
call _InitSGBBorderPals
call SGBBorder_PushBGPals
call SGBDelayCycles
@ -891,43 +891,43 @@ InitCGBPals::
ret z
; CGB only
ld a, BANK(vTiles3)
ld [rVBK], a
ldh [rVBK], a
ld hl, vTiles3
ld bc, $200 tiles
xor a
call ByteFill
ld a, BANK(vTiles0)
ld [rVBK], a
ldh [rVBK], a
ld a, 1 << rBGPI_AUTO_INCREMENT
ld [rBGPI], a
ldh [rBGPI], a
ld c, 4 * 8
.bgpals_loop
ld a, LOW(PALRGB_WHITE)
ld [rBGPD], a
ldh [rBGPD], a
ld a, HIGH(PALRGB_WHITE)
ld [rBGPD], a
ldh [rBGPD], a
dec c
jr nz, .bgpals_loop
ld a, 1 << rOBPI_AUTO_INCREMENT
ld [rOBPI], a
ldh [rOBPI], a
ld c, 4 * 8
.obpals_loop
ld a, LOW(PALRGB_WHITE)
ld [rOBPD], a
ldh [rOBPD], a
ld a, HIGH(PALRGB_WHITE)
ld [rOBPD], a
ldh [rOBPD], a
dec c
jr nz, .obpals_loop
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ld [rSVBK], a
ldh [rSVBK], a
ld hl, wBGPals1
call .LoadWhitePals
ld hl, wBGPals2
call .LoadWhitePals
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
.LoadWhitePals:
@ -972,7 +972,7 @@ _InitSGBBorderPals:
Unreferenced_Function9911:
di
xor a
ld [rJOYP], a
ldh [rJOYP], a
ld hl, MaskEnFreezePacket
call _PushSGBPals
call PushSGBBorder
@ -1007,35 +1007,35 @@ PushSGBBorderPalsAndWait:
ld hl, MltReq2Packet
call _PushSGBPals
call SGBDelayCycles
ld a, [rJOYP]
ldh a, [rJOYP]
and $3
cp $3
jr nz, .carry
ld a, $20
ld [rJOYP], a
ld a, [rJOYP]
ld a, [rJOYP]
ldh [rJOYP], a
ldh a, [rJOYP]
ldh a, [rJOYP]
call SGBDelayCycles
call SGBDelayCycles
ld a, $30
ld [rJOYP], a
ldh [rJOYP], a
call SGBDelayCycles
call SGBDelayCycles
ld a, $10
ld [rJOYP], a
ldh [rJOYP], a
rept 6
ld a, [rJOYP]
ldh a, [rJOYP]
endr
call SGBDelayCycles
call SGBDelayCycles
ld a, $30
ld [rJOYP], a
ld a, [rJOYP]
ld a, [rJOYP]
ld a, [rJOYP]
ldh [rJOYP], a
ldh a, [rJOYP]
ldh a, [rJOYP]
ldh a, [rJOYP]
call SGBDelayCycles
call SGBDelayCycles
ld a, [rJOYP]
ldh a, [rJOYP]
and $3
cp $3
jr nz, .carry
@ -1056,24 +1056,24 @@ endr
SGBBorder_PushBGPals:
call DisableLCD
ld a, %11100100
ld [rBGP], a
ldh [rBGP], a
ld hl, PredefPals
ld de, vTiles1
ld bc, $100 tiles
call CopyData
call DrawDefaultTiles
ld a, LCDC_DEFAULT
ld [rLCDC], a
ldh [rLCDC], a
ld hl, PalTrnPacket
call _PushSGBPals
xor a
ld [rBGP], a
ldh [rBGP], a
ret
SGBBorder_MorePalPushing:
call DisableLCD
ld a, $e4
ld [rBGP], a
ldh [rBGP], a
ld de, vTiles1
ld bc, 20 tiles
call CopyData
@ -1097,17 +1097,17 @@ SGBBorder_MorePalPushing:
call CopyData
call DrawDefaultTiles
ld a, LCDC_DEFAULT
ld [rLCDC], a
ldh [rLCDC], a
ld hl, PctTrnPacket
call _PushSGBPals
xor a
ld [rBGP], a
ldh [rBGP], a
ret
SGBBorder_YetMorePalPushing:
call DisableLCD
ld a, %11100100
ld [rBGP], a
ldh [rBGP], a
ld de, vTiles1
ld b, $80
.loop
@ -1121,11 +1121,11 @@ SGBBorder_YetMorePalPushing:
jr nz, .loop
call DrawDefaultTiles
ld a, LCDC_DEFAULT
ld [rLCDC], a
ldh [rLCDC], a
ld hl, ChrTrnPacket
call _PushSGBPals
xor a
ld [rBGP], a
ldh [rBGP], a
ret
CopyData:
@ -1237,10 +1237,10 @@ LoadMapPals:
ld e, l
ld d, h
; Switch to palettes WRAM bank
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wBGPals1)
ld [rSVBK], a
ldh [rSVBK], a
ld hl, wBGPals1
ld b, 8
.outer_loop
@ -1269,7 +1269,7 @@ LoadMapPals:
dec b
jr nz, .outer_loop
pop af
ld [rSVBK], a
ldh [rSVBK], a
.got_pals
ld a, [wTimeOfDayPal]

View File

@ -158,7 +158,7 @@ MG_Mobile_Layout01:
farcall ApplyAttrMap
farcall ApplyPals
ld a, $1
ld [hCGBPalUpdate], a
ldh [hCGBPalUpdate], a
ret
.Palette_49478:

View File

@ -10,11 +10,11 @@ HDMATransferAttrMapAndTileMapToWRAMBank3::
ld hl, wScratchTileMap
call PadTilemapForHDMATransfer
ld a, $0
ld [rVBK], a
ldh [rVBK], a
ld hl, wScratchTileMap
call HDMATransferToWRAMBank3
ld a, $1
ld [rVBK], a
ldh [rVBK], a
ld hl, wScratchAttrMap
call HDMATransferToWRAMBank3
ret
@ -28,7 +28,7 @@ HDMATransferTileMapToWRAMBank3::
ld hl, wScratchTileMap
call PadTilemapForHDMATransfer
ld a, $0
ld [rVBK], a
ldh [rVBK], a
ld hl, wScratchTileMap
call HDMATransferToWRAMBank3
ret
@ -42,7 +42,7 @@ HDMATransferAttrMapToWRAMBank3:
ld hl, wScratchAttrMap
call PadAttrMapForHDMATransfer
ld a, $1
ld [rVBK], a
ldh [rVBK], a
ld hl, wScratchAttrMap
call HDMATransferToWRAMBank3
ret
@ -61,18 +61,18 @@ ReloadMapPart::
call DelayFrame
di
ld a, [rVBK]
ldh a, [rVBK]
push af
ld a, $1
ld [rVBK], a
ldh [rVBK], a
ld hl, wScratchAttrMap
call HDMATransfer_Wait127Scanlines_toBGMap
ld a, $0
ld [rVBK], a
ldh [rVBK], a
ld hl, wScratchTileMap
call HDMATransfer_Wait127Scanlines_toBGMap
pop af
ld [rVBK], a
ldh [rVBK], a
ei
ret
@ -92,18 +92,18 @@ Mobile_ReloadMapPart:
call DelayFrame
di
ld a, [rVBK]
ldh a, [rVBK]
push af
ld a, $1
ld [rVBK], a
ldh [rVBK], a
ld hl, wScratchAttrMap
call HDMATransfer_NoDI
ld a, $0
ld [rVBK], a
ldh [rVBK], a
ld hl, wScratchTileMap
call HDMATransfer_NoDI
pop af
ld [rVBK], a
ldh [rVBK], a
ei
ret
@ -114,20 +114,20 @@ Mobile_ReloadMapPart:
.unreferenced_1040da
ld a, $1
ld [rVBK], a
ldh [rVBK], a
ld a, BANK(w3_d800)
ld [rSVBK], a
ldh [rSVBK], a
ld de, w3_d800
ld a, [hBGMapAddress + 1]
ld [rHDMA1], a
ld a, [hBGMapAddress]
ld [rHDMA2], a
ldh a, [hBGMapAddress + 1]
ldh [rHDMA1], a
ldh a, [hBGMapAddress]
ldh [rHDMA2], a
ld a, d
ld [rHDMA3], a
ldh [rHDMA3], a
ld a, e
ld [rHDMA4], a
ldh [rHDMA4], a
ld a, $23
ld [hDMATransfer], a
ldh [hDMATransfer], a
call WaitDMATransfer
ret
@ -137,9 +137,9 @@ Mobile_ReloadMapPart:
.unreferenced_104101
ld a, $1
ld [rVBK], a
ldh [rVBK], a
ld a, BANK(w3_d800)
ld [rSVBK], a
ldh [rSVBK], a
ld hl, w3_d800
call HDMATransferToWRAMBank3
ret
@ -162,18 +162,18 @@ OpenAndCloseMenu_HDMATransferTileMapAndAttrMap::
call DelayFrame
di
ld a, [rVBK]
ldh a, [rVBK]
push af
ld a, $1
ld [rVBK], a
ldh [rVBK], a
ld hl, wScratchAttrMap
call HDMATransfer_Wait123Scanlines_toBGMap
ld a, $0
ld [rVBK], a
ldh [rVBK], a
ld hl, wScratchTileMap
call HDMATransfer_Wait123Scanlines_toBGMap
pop af
ld [rVBK], a
ldh [rVBK], a
ei
ret
@ -194,40 +194,40 @@ Mobile_OpenAndCloseMenu_HDMATransferTileMapAndAttrMap:
call PadMapForHDMATransfer
ld a, $1
ld [rVBK], a
ldh [rVBK], a
ld hl, wScratchAttrMap
call HDMATransfer_Wait127Scanlines_toBGMap
ld a, $0
ld [rVBK], a
ldh [rVBK], a
ld hl, wScratchTileMap
call HDMATransfer_Wait127Scanlines_toBGMap
ret
CallInSafeGFXMode:
ld a, [hBGMapMode]
ldh a, [hBGMapMode]
push af
ld a, [hMapAnims]
ldh a, [hMapAnims]
push af
xor a
ld [hBGMapMode], a
ld [hMapAnims], a
ld a, [rSVBK]
ldh [hBGMapMode], a
ldh [hMapAnims], a
ldh a, [rSVBK]
push af
ld a, BANK(wScratchTileMap)
ld [rSVBK], a
ld a, [rVBK]
ldh [rSVBK], a
ldh a, [rVBK]
push af
call ._hl_
pop af
ld [rVBK], a
ldh [rVBK], a
pop af
ld [rSVBK], a
ldh [rSVBK], a
pop af
ld [hMapAnims], a
ldh [hMapAnims], a
pop af
ld [hBGMapMode], a
ldh [hBGMapMode], a
ret
._hl_
@ -236,12 +236,12 @@ CallInSafeGFXMode:
HDMATransferToWRAMBank3:
call _LoadHDMAParameters
ld a, $23
ld [hDMATransfer], a
ldh [hDMATransfer], a
WaitDMATransfer:
.loop
call DelayFrame
ld a, [hDMATransfer]
ldh a, [hDMATransfer]
and a
jr nz, .loop
ret
@ -250,9 +250,9 @@ HDMATransfer_Wait127Scanlines_toBGMap:
; HDMA transfer from hl to [hBGMapAddress]
; hBGMapAddress -> de
; 2 * SCREEN_HEIGHT -> c
ld a, [hBGMapAddress + 1]
ldh a, [hBGMapAddress + 1]
ld d, a
ld a, [hBGMapAddress]
ldh a, [hBGMapAddress]
ld e, a
ld c, 2 * SCREEN_HEIGHT
jr HDMATransfer_Wait127Scanlines
@ -262,9 +262,9 @@ HDMATransfer_Wait123Scanlines_toBGMap:
; hBGMapAddress -> de
; 2 * SCREEN_HEIGHT -> c
; $7b --> b
ld a, [hBGMapAddress + 1]
ldh a, [hBGMapAddress + 1]
ld d, a
ld a, [hBGMapAddress]
ldh a, [hBGMapAddress]
ld e, a
ld c, 2 * SCREEN_HEIGHT
jr HDMATransfer_Wait123Scanlines
@ -273,25 +273,25 @@ HDMATransfer_NoDI:
; HDMA transfer from hl to [hBGMapAddress]
; [hBGMapAddress] --> de
; 2 * SCREEN_HEIGHT --> c
ld a, [hBGMapAddress + 1]
ldh a, [hBGMapAddress + 1]
ld d, a
ld a, [hBGMapAddress]
ldh a, [hBGMapAddress]
ld e, a
ld c, 2 * SCREEN_HEIGHT
; [rHDMA1, rHDMA2] = hl & $fff0
ld a, h
ld [rHDMA1], a
ldh [rHDMA1], a
ld a, l
and $f0
ld [rHDMA2], a
ldh [rHDMA2], a
; [rHDMA3, rHDMA4] = de & $1ff0
ld a, d
and $1f
ld [rHDMA3], a
ldh [rHDMA3], a
ld a, e
and $f0
ld [rHDMA4], a
ldh [rHDMA4], a
; b = c | %10000000
ld a, c
dec c
@ -303,19 +303,19 @@ HDMATransfer_NoDI:
ld d, a
; while [rLY] >= d: pass
.loop1
ld a, [rLY]
ldh a, [rLY]
cp d
jr nc, .loop1
; while not [rSTAT] & 3: pass
.loop2
ld a, [rSTAT]
ldh a, [rSTAT]
and $3
jr z, .loop2
; load the 5th byte of HDMA
ld a, b
ld [rHDMA5], a
ldh [rHDMA5], a
; wait until rLY advances (c + 1) times
ld a, [rLY]
ldh a, [rLY]
inc c
ld hl, rLY
.loop3
@ -338,17 +338,17 @@ _continue_HDMATransfer:
; a lot of waiting around for hardware registers
; [rHDMA1, rHDMA2] = hl & $fff0
ld a, h
ld [rHDMA1], a
ldh [rHDMA1], a
ld a, l
and $f0 ; high nybble
ld [rHDMA2], a
ldh [rHDMA2], a
; [rHDMA3, rHDMA4] = de & $1ff0
ld a, d
and $1f ; lower 5 bits
ld [rHDMA3], a
ldh [rHDMA3], a
ld a, e
and $f0 ; high nybble
ld [rHDMA4], a
ldh [rHDMA4], a
; e = c | %10000000
ld a, c
dec c
@ -360,26 +360,26 @@ _continue_HDMATransfer:
ld d, a
; while [rLY] >= d: pass
.ly_loop
ld a, [rLY]
ldh a, [rLY]
cp d
jr nc, .ly_loop
di
; while [rSTAT] & 3: pass
.rstat_loop_1
ld a, [rSTAT]
ldh a, [rSTAT]
and $3
jr nz, .rstat_loop_1
; while not [rSTAT] & 3: pass
.rstat_loop_2
ld a, [rSTAT]
ldh a, [rSTAT]
and $3
jr z, .rstat_loop_2
; load the 5th byte of HDMA
ld a, e
ld [rHDMA5], a
ldh [rHDMA5], a
; wait until rLY advances (c + 1) times
ld a, [rLY]
ldh a, [rLY]
inc c
ld hl, rLY
.final_ly_loop
@ -396,14 +396,14 @@ _continue_HDMATransfer:
_LoadHDMAParameters:
ld a, h
ld [rHDMA1], a
ldh [rHDMA1], a
ld a, l
ld [rHDMA2], a
ld a, [hBGMapAddress + 1]
ldh [rHDMA2], a
ldh a, [hBGMapAddress + 1]
and $1f
ld [rHDMA3], a
ld a, [hBGMapAddress]
ld [rHDMA4], a
ldh [rHDMA3], a
ldh a, [hBGMapAddress]
ldh [rHDMA4], a
ret
PadTilemapForHDMATransfer:
@ -416,10 +416,10 @@ PadAttrMapForHDMATransfer:
PadMapForHDMATransfer:
; pad a 20x18 map to 32x18 for HDMA transfer
; back up the padding value in c to hMapObjectIndexBuffer
ld a, [hMapObjectIndexBuffer]
ldh a, [hMapObjectIndexBuffer]
push af
ld a, c
ld [hMapObjectIndexBuffer], a
ldh [hMapObjectIndexBuffer], a
; for each row on the screen
ld c, SCREEN_HEIGHT
@ -435,7 +435,7 @@ PadMapForHDMATransfer:
jr nz, .loop2
; load the original padding value of c into hl for 32 - 20 = 12 rows
ld a, [hMapObjectIndexBuffer]
ldh a, [hMapObjectIndexBuffer]
ld b, BG_MAP_WIDTH - SCREEN_WIDTH
.loop3
ld [hli], a
@ -447,16 +447,16 @@ PadMapForHDMATransfer:
; restore the original value of hMapObjectIndexBuffer
pop af
ld [hMapObjectIndexBuffer], a
ldh [hMapObjectIndexBuffer], a
ret
_Get2bpp::
; 2bpp when [rLCDC] & $80
; switch to WRAM bank 6
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wScratchTileMap)
ld [rSVBK], a
ldh [rSVBK], a
push bc
push hl
@ -491,7 +491,7 @@ _Get2bpp::
; restore the previous bank
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
_Get1bpp::
@ -521,10 +521,10 @@ _Get1bpp::
jr .loop
.bankswitch
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wScratchTileMap)
ld [rSVBK], a
ldh [rSVBK], a
push bc
push hl
@ -555,7 +555,7 @@ _Get1bpp::
call HDMATransfer_Wait127Scanlines
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
HDMATransfer_OnlyTopFourRows:
@ -570,13 +570,13 @@ HDMATransfer_OnlyTopFourRows:
decoord 0, 0, wAttrMap
call .Copy
ld a, $1
ld [rVBK], a
ldh [rVBK], a
ld c, $8
ld hl, wScratchTileMap + $80
debgcoord 0, 0, vBGMap1
call HDMATransfer_Wait127Scanlines
ld a, $0
ld [rVBK], a
ldh [rVBK], a
ld c, $8
ld hl, wScratchTileMap
debgcoord 0, 0, vBGMap1

View File

@ -22,7 +22,7 @@ _LoadStandardFont::
ld de, Font
ld hl, vTiles1
lb bc, BANK(Font), 128 ; "A" to "9"
ld a, [rLCDC]
ldh a, [rLCDC]
bit rLCDC_ENABLE, a
jp z, Copy1bpp

View File

@ -32,18 +32,18 @@ GetUnownLetter:
or b
; Divide by 10 to get 0-25
ld [hDividend + 3], a
ldh [hDividend + 3], a
xor a
ld [hDividend], a
ld [hDividend + 1], a
ld [hDividend + 2], a
ldh [hDividend], a
ldh [hDividend + 1], a
ldh [hDividend + 2], a
ld a, $ff / NUM_UNOWN + 1
ld [hDivisor], a
ldh [hDivisor], a
ld b, 4
call Divide
; Increment to get 1-26
ld a, [hQuotient + 2]
ldh a, [hQuotient + 2]
inc a
ld [wUnownLetter], a
ret
@ -53,11 +53,11 @@ GetMonFrontpic:
ld [wCurSpecies], a
call IsAPokemon
ret c
ld a, [rSVBK]
ldh a, [rSVBK]
push af
call _GetFrontpic
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
GetAnimatedFrontpic:
@ -65,14 +65,14 @@ GetAnimatedFrontpic:
ld [wCurSpecies], a
call IsAPokemon
ret c
ld a, [rSVBK]
ldh a, [rSVBK]
push af
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call _GetFrontpic
call GetAnimatedEnemyFrontpic
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
_GetFrontpic:
@ -84,7 +84,7 @@ _GetFrontpic:
push bc
call GetFrontpicPointer
ld a, BANK(wDecompressEnemyFrontpic)
ld [rSVBK], a
ldh [rSVBK], a
ld a, b
ld de, wDecompressEnemyFrontpic
call FarDecompress
@ -96,7 +96,7 @@ _GetFrontpic:
push hl
ld de, wDecompressScratch
ld c, 7 * 7
ld a, [hROMBank]
ldh a, [hROMBank]
ld b, a
call Get2bpp
pop hl
@ -131,11 +131,11 @@ GetFrontpicPointer:
GetAnimatedEnemyFrontpic:
ld a, BANK(vTiles3)
ld [rVBK], a
ldh [rVBK], a
push hl
ld de, wDecompressScratch
ld c, 7 * 7
ld a, [hROMBank]
ldh a, [hROMBank]
ld b, a
call Get2bpp
pop hl
@ -164,11 +164,11 @@ GetAnimatedEnemyFrontpic:
pop bc
pop hl
ld de, wDecompressScratch
ld a, [hROMBank]
ldh a, [hROMBank]
ld b, a
call Get2bpp
xor a
ld [rVBK], a
ldh [rVBK], a
ret
LoadFrontpicTiles:
@ -201,10 +201,10 @@ GetMonBackpic:
ld b, a
ld a, [wUnownLetter]
ld c, a
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
ld [rSVBK], a
ldh [rSVBK], a
push de
; These are assumed to be at the same address in their respective banks.
@ -236,11 +236,11 @@ GetMonBackpic:
call FixBackpicAlignment
pop hl
ld de, wDecompressScratch
ld a, [hROMBank]
ldh a, [hROMBank]
ld b, a
call Get2bpp
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
FixPicBank:
@ -314,16 +314,16 @@ GetTrainerPic:
ret nc
call WaitBGMap
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
ld hl, TrainerPicPointers
ld a, [wTrainerClass]
dec a
ld bc, 3
call AddNTimes
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
ld [rSVBK], a
ldh [rSVBK], a
push de
ld a, BANK(TrainerPicPointers)
call GetFarByte
@ -338,23 +338,23 @@ GetTrainerPic:
pop hl
ld de, wDecompressScratch
ld c, 7 * 7
ld a, [hROMBank]
ldh a, [hROMBank]
ld b, a
call Get2bpp
pop af
ld [rSVBK], a
ldh [rSVBK], a
call WaitBGMap
ld a, $1
ld [hBGMapMode], a
ldh [hBGMapMode], a
ret
DecompressGet2bpp:
; Decompress lz data from b:hl to scratch space at 6:d000, then copy it to address de.
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wDecompressScratch)
ld [rSVBK], a
ldh [rSVBK], a
push de
push bc
@ -364,12 +364,12 @@ DecompressGet2bpp:
pop bc
ld de, wDecompressScratch
pop hl
ld a, [hROMBank]
ldh a, [hROMBank]
ld b, a
call Get2bpp
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
FixBackpicAlignment:

View File

@ -1,5 +1,5 @@
WriteOAMDMACodeToHRAM::
ld c, hTransferVirtualOAM - $ff00
ld c, LOW(hTransferVirtualOAM)
ld b, .PushOAMEnd - .PushOAM
ld hl, .PushOAM
.loop
@ -12,7 +12,7 @@ WriteOAMDMACodeToHRAM::
.PushOAM:
ld a, HIGH(wVirtualOAM)
ld [rDMA], a
ldh [rDMA], a
ld a, NUM_SPRITE_OAM_STRUCTS
.pushoam_loop
dec a

View File

@ -51,7 +51,7 @@ LoadMenuMonIcon:
.GetPartyMonItemGFX:
push bc
ld a, [hObjectStructIndexBuffer]
ldh a, [hObjectStructIndexBuffer]
ld hl, wPartyMon1Item
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
@ -125,7 +125,7 @@ PartyMenu_InitAnimatedMonIcon:
.SpawnItemIcon:
push bc
ld a, [hObjectStructIndexBuffer]
ldh a, [hObjectStructIndexBuffer]
ld hl, wPartyMon1Item
ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes
@ -154,7 +154,7 @@ PartyMenu_InitAnimatedMonIcon:
InitPartyMenuIcon:
ld a, [wCurIconTile]
push af
ld a, [hObjectStructIndexBuffer]
ldh a, [hObjectStructIndexBuffer]
ld hl, wPartySpecies
ld e, a
ld d, 0
@ -163,7 +163,7 @@ InitPartyMenuIcon:
call ReadMonMenuIcon
ld [wCurIcon], a
call GetMemIconGFX
ld a, [hObjectStructIndexBuffer]
ldh a, [hObjectStructIndexBuffer]
; y coord
add a
add a
@ -184,7 +184,7 @@ InitPartyMenuIcon:
SetPartyMonIconAnimSpeed:
push bc
ld a, [hObjectStructIndexBuffer]
ldh a, [hObjectStructIndexBuffer]
ld b, a
call .getspeed
ld a, b

View File

@ -107,10 +107,10 @@ LoadMonAnimation:
ret
SetUpPokeAnim:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wPokeAnimStruct)
ld [rSVBK], a
ldh [rSVBK], a
ld a, [wPokeAnimSceneIndex]
ld c, a
ld b, 0
@ -125,7 +125,7 @@ SetUpPokeAnim:
ld a, [wPokeAnimSceneIndex]
ld c, a
pop af
ld [rSVBK], a
ldh [rSVBK], a
ld a, c
and $80
ret z
@ -256,16 +256,16 @@ PokeAnim_StereoCry:
ret
PokeAnim_DeinitFrames:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wPokeAnimCoord)
ld [rSVBK], a
ldh [rSVBK], a
call PokeAnim_PlaceGraphic
farcall HDMATransferTileMapToWRAMBank3
call PokeAnim_SetVBank0
farcall HDMATransferAttrMapToWRAMBank3
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
AnimateMon_CheckIfPokemon:
@ -282,10 +282,10 @@ AnimateMon_CheckIfPokemon:
ret
PokeAnim_InitPicAttributes:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wPokeAnimStruct)
ld [rSVBK], a
ldh [rSVBK], a
push bc
push de
@ -330,14 +330,14 @@ PokeAnim_InitPicAttributes:
ld [wPokeAnimFrontpicHeight], a
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
PokeAnim_InitAnim:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wPokeAnimIdleFlag)
ld [rSVBK], a
ldh [rSVBK], a
push bc
ld hl, wPokeAnimIdleFlag
ld bc, wPokeAnimStructEnd - wPokeAnimIdleFlag
@ -352,12 +352,12 @@ PokeAnim_InitAnim:
call GetMonFramesPointer
call GetMonBitmaskPointer
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
PokeAnim_DoAnimScript:
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
.loop
ld a, [wPokeAnimJumptableIndex]
and $7f
@ -823,16 +823,16 @@ PokeAnim_PlaceGraphic:
ret
PokeAnim_SetVBank1:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wPokeAnimCoord)
ld [rSVBK], a
ldh [rSVBK], a
xor a
ld [hBGMapMode], a
ldh [hBGMapMode], a
call .SetFlag
farcall HDMATransferAttrMapToWRAMBank3
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
.SetFlag:
@ -943,10 +943,10 @@ GetMonAnimPointer:
ret
PokeAnim_GetFrontpicDims:
ld a, [rSVBK]
ldh a, [rSVBK]
push af
ld a, BANK(wCurPartySpecies)
ld [rSVBK], a
ldh [rSVBK], a
ld a, [wCurPartySpecies]
ld [wCurSpecies], a
call GetBaseData
@ -954,7 +954,7 @@ PokeAnim_GetFrontpicDims:
and $f
ld c, a
pop af
ld [rSVBK], a
ldh [rSVBK], a
ret
GetMonFramesPointer:

View File

@ -8,7 +8,7 @@ PlaceGraphic:
and a
jr nz, .right
ld a, [hGraphicStartTile]
ldh a, [hGraphicStartTile]
.x1
push bc
push hl
@ -35,7 +35,7 @@ PlaceGraphic:
add hl, bc
pop bc
ld a, [hGraphicStartTile]
ldh a, [hGraphicStartTile]
.x2
push bc
push hl

Some files were not shown because too many files have changed in this diff Show More