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

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