diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-08-25 14:28:22 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-08-25 14:28:22 -0400 |
commit | eb1e3636bb71509546c274bf2a5910d8e71a9600 (patch) | |
tree | 24d7742604073b2afb86c1225258f8217d1653e7 /home/lcd.asm | |
parent | 376c64468bab8d162da43fc6e1b6f0942943cf43 (diff) |
Use labels instead of constants for HRAM
Use explicit ldh instruction to access HRAM locations, don't rely on optimizing ld
Diffstat (limited to 'home/lcd.asm')
-rw-r--r-- | home/lcd.asm | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/home/lcd.asm b/home/lcd.asm index 7ea53d453..7b78e5688 100644 --- a/home/lcd.asm +++ b/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 |