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

@@ -13,17 +13,17 @@ Random::
push bc
ld a, [rDIV]
ldh a, [rDIV]
ld b, a
ld a, [hRandomAdd]
ldh a, [hRandomAdd]
adc b
ld [hRandomAdd], a
ldh [hRandomAdd], a
ld a, [rDIV]
ldh a, [rDIV]
ld b, a
ld a, [hRandomSub]
ldh a, [hRandomSub]
sbc b
ld [hRandomSub], a
ldh [hRandomSub], a
pop bc
ret
@@ -34,7 +34,7 @@ BattleRandom::
; It handles all RNG calls in the battle engine, allowing
; link battles to remain in sync using a shared PRNG.
ld a, [hROMBank]
ldh a, [hROMBank]
push af
ld a, BANK(_BattleRandom)
rst Bankswitch
@@ -67,7 +67,7 @@ RandomRange::
push bc
.loop
call Random
ld a, [hRandomAdd]
ldh a, [hRandomAdd]
ld c, a
add b
jr c, .loop