LY_BLANK and rLCDC constants

This commit is contained in:
xCrystal
2017-12-29 18:53:21 +01:00
parent 69762a2bfd
commit 3c6c80f1b2
21 changed files with 54 additions and 48 deletions

View File

@@ -3,7 +3,7 @@
Get2bpp_2:: ; dc9
ld a, [rLCDC]
bit 7, a
bit rLCDC_ENABLE, a
jp z, Copy2bpp
homecall _Get2bpp
@@ -13,7 +13,7 @@ Get2bpp_2:: ; dc9
Get1bpp_2:: ; ddc
ld a, [rLCDC]
bit 7, a
bit rLCDC_ENABLE, a
jp z, Copy1bpp
homecall _Get1bpp
@@ -361,7 +361,7 @@ Request1bpp:: ; f1e
Get2bpp:: ; f82
ld a, [rLCDC]
bit 7, a
bit rLCDC_ENABLE, a
jp nz, Request2bpp
Copy2bpp:: ; f89
@@ -392,7 +392,7 @@ Copy2bpp:: ; f89
Get1bpp:: ; f9d
ld a, [rLCDC]
bit 7, a
bit rLCDC_ENABLE, a
jp nz, Request1bpp
Copy1bpp:: ; fa4

View File

@@ -62,7 +62,7 @@ Init:: ; 17d
.wait
ld a, [rLY]
cp 145
cp LY_VBLANK + 1
jr nz, .wait
xor a
@@ -125,7 +125,7 @@ Init:: ; 17d
ld [hWX], a
ld [rWX], a
ld a, %11100011
ld a, rLCDC_DEFAULT ; %11100011
; LCD on
; Win tilemap 1
; Win on

View File

@@ -43,7 +43,7 @@ DisableLCD:: ; 568
; Don't need to do anything if the LCD is already off
ld a, [rLCDC]
bit 7, a ; lcd enable
bit rLCDC_ENABLE, a
ret z
xor a
@@ -58,11 +58,11 @@ DisableLCD:: ; 568
.wait
; Wait until VBlank would normally happen
ld a, [rLY]
cp 145
cp LY_VBLANK + 1
jr nz, .wait
ld a, [rLCDC]
and %01111111 ; lcd enable off
and $ff ^ 1 << rLCDC_ENABLE
ld [rLCDC], a
xor a
@@ -75,7 +75,7 @@ DisableLCD:: ; 568
EnableLCD:: ; 58a
ld a, [rLCDC]
set 7, a ; lcd enable
set rLCDC_ENABLE, a
ld [rLCDC], a
ret
; 591

View File

@@ -31,7 +31,7 @@ ClearTileMap:: ; fc8
; Update the BG Map.
ld a, [rLCDC]
bit 7, a
bit rLCDC_ENABLE, a
ret z
jp WaitBGMap
; fdb

View File

@@ -291,9 +291,9 @@ Serve1bppRequest:: ; 170a
; Back out if we're too far into VBlank
ld a, [rLY]
cp 144
cp LY_VBLANK
ret c
cp 146
cp LY_VBLANK + 2
ret nc
; Copy [Requested1bpp] 1bpp tiles from [Requested1bppSource] to [Requested1bppDest]
@@ -372,9 +372,9 @@ Serve2bppRequest:: ; 1769
; Back out if we're too far into VBlank
ld a, [rLY]
cp 144
cp LY_VBLANK
ret c
cp 146
cp LY_VBLANK + 2
ret nc
jr _Serve2bppRequest
@@ -454,9 +454,9 @@ AnimateTileset:: ; 17d3
; Back out if we're too far into VBlank
ld a, [rLY]
cp 144
cp LY_VBLANK
ret c
cp 151
cp LY_VBLANK + 7
ret nc
ld a, [hROMBank]