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:
30
home/lcd.asm
30
home/lcd.asm
@@ -1,7 +1,7 @@
|
||||
; LCD handling
|
||||
|
||||
Unreferenced_Function547::
|
||||
ld a, [hLCDCPointer]
|
||||
ldh a, [hLCDCPointer]
|
||||
cp rSCX - $ff00
|
||||
ret nz
|
||||
ld c, a
|
||||
@@ -11,18 +11,18 @@ Unreferenced_Function547::
|
||||
|
||||
LCD::
|
||||
push af
|
||||
ld a, [hLCDCPointer]
|
||||
ldh a, [hLCDCPointer]
|
||||
and a
|
||||
jr z, .done
|
||||
|
||||
; At this point it's assumed we're in WRAM bank 5!
|
||||
push bc
|
||||
ld a, [rLY]
|
||||
ldh a, [rLY]
|
||||
ld c, a
|
||||
ld b, HIGH(wLYOverrides)
|
||||
ld a, [bc]
|
||||
ld b, a
|
||||
ld a, [hLCDCPointer]
|
||||
ldh a, [hLCDCPointer]
|
||||
ld c, a
|
||||
ld a, b
|
||||
ld [$ff00+c], a
|
||||
@@ -36,37 +36,37 @@ DisableLCD::
|
||||
; Turn the LCD off
|
||||
|
||||
; Don't need to do anything if the LCD is already off
|
||||
ld a, [rLCDC]
|
||||
ldh a, [rLCDC]
|
||||
bit rLCDC_ENABLE, a
|
||||
ret z
|
||||
|
||||
xor a
|
||||
ld [rIF], a
|
||||
ld a, [rIE]
|
||||
ldh [rIF], a
|
||||
ldh a, [rIE]
|
||||
ld b, a
|
||||
|
||||
; Disable VBlank
|
||||
res 0, a ; vblank
|
||||
ld [rIE], a
|
||||
ldh [rIE], a
|
||||
|
||||
.wait
|
||||
; Wait until VBlank would normally happen
|
||||
ld a, [rLY]
|
||||
ldh a, [rLY]
|
||||
cp LY_VBLANK + 1
|
||||
jr nz, .wait
|
||||
|
||||
ld a, [rLCDC]
|
||||
ldh a, [rLCDC]
|
||||
and $ff ^ (1 << rLCDC_ENABLE)
|
||||
ld [rLCDC], a
|
||||
ldh [rLCDC], a
|
||||
|
||||
xor a
|
||||
ld [rIF], a
|
||||
ldh [rIF], a
|
||||
ld a, b
|
||||
ld [rIE], a
|
||||
ldh [rIE], a
|
||||
ret
|
||||
|
||||
EnableLCD::
|
||||
ld a, [rLCDC]
|
||||
ldh a, [rLCDC]
|
||||
set rLCDC_ENABLE, a
|
||||
ld [rLCDC], a
|
||||
ldh [rLCDC], a
|
||||
ret
|
||||
|
Reference in New Issue
Block a user