Use labels instead of constants for HRAM

Use explicit ldh instruction to access HRAM locations, don't rely on optimizing ld
This commit is contained in:
Rangi
2018-08-25 14:28:22 -04:00
parent 376c64468b
commit eb1e3636bb
243 changed files with 4706 additions and 4661 deletions

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