constants for rSTAT register

This commit is contained in:
xCrystal 2023-08-27 16:27:11 +02:00
parent 4dec74b770
commit 4ee4655e72
5 changed files with 17 additions and 6 deletions

View File

@ -131,6 +131,17 @@ DEF rLCDC_WINDOW_TILEMAP EQU 6 ; 0=9800-9BFF, 1=9C00-9FFF
DEF rLCDC_ENABLE EQU 7 ; 0=Off, 1=On
DEF LCDC_DEFAULT EQU (1 << rLCDC_ENABLE) | (1 << rLCDC_WINDOW_TILEMAP) | (1 << rLCDC_WINDOW_ENABLE) | (1 << rLCDC_SPRITES_ENABLE) | (1 << rLCDC_BG_PRIORITY)
DEF rSTAT EQU $ff41 ; LCDC Status (R/W)
DEF rSTAT_STATUS_FLAGS EQU %00000011 ; LCD controller status (Read Only)
DEF rSTAT_HBLANK_MASK EQU %00000000 ; In H-Blank (Read Only)
DEF rSTAT_VBLANK_MASK EQU %00000001 ; In V-Blank (Read Only)
DEF rSTAT_OAM_MASK EQU %00000010 ; OAM is used by system (Read Only)
DEF rSTAT_LCD_MASK EQU %00000011 ; Both OAM and VRAM used by system (Read Only)
DEF rSTAT_BUSY EQU 1 ; When set, VRAM access is unsafe (Read Only)
DEF rSTAT_LYC EQU 2 ; LYC=LY (0=Different, 1=Equal) (Read Only)
DEF rSTAT_INT_HBLANK EQU 3 ; Mode 00: H-Blank (Selectable)
DEF rSTAT_INT_VBLANK EQU 4 ; Mode 01: V-Blank (Selectable)
DEF rSTAT_INT_OAM EQU 5 ; Mode 02: OAM (Selectable)
DEF rSTAT_INT_LYC EQU 6 ; LYC=LY Coincidence (Selectable)
DEF rSCY EQU $ff42 ; Scroll Y (R/W)
DEF rSCX EQU $ff43 ; Scroll X (R/W)
DEF rLY EQU $ff44 ; LCDC Y-Coordinate (R)

View File

@ -194,7 +194,7 @@ HDMATransfer_NoDI:
; while not [rSTAT] & 3: pass
.loop2
ldh a, [rSTAT]
and $3
and rSTAT_STATUS_FLAGS
jr z, .loop2
; load the 5th byte of HDMA
ld a, b
@ -253,12 +253,12 @@ _continue_HDMATransfer:
; while [rSTAT] & 3: pass
.rstat_loop_1
ldh a, [rSTAT]
and $3
and rSTAT_STATUS_FLAGS
jr nz, .rstat_loop_1
; while not [rSTAT] & 3: pass
.rstat_loop_2
ldh a, [rSTAT]
and $3
and rSTAT_STATUS_FLAGS
jr z, .rstat_loop_2
; load the 5th byte of HDMA
ld a, e

View File

@ -47,7 +47,7 @@ SaveMenu_CopyTilemapAtOnce:
ld l, 0
ld a, SCREEN_HEIGHT
ldh [hTilesPerCycle], a
ld b, 1 << 1 ; not in v/hblank
ld b, 1 << rSTAT_BUSY ; not in v/hblank
ld c, LOW(rSTAT)
.loop

View File

@ -51,7 +51,7 @@ PhoneRing_CopyTilemapAtOnce:
ld l, 0
ld a, SCREEN_HEIGHT
ldh [hTilesPerCycle], a
ld b, 1 << 1 ; not in v/hblank
ld b, 1 << rSTAT_BUSY ; not in v/hblank
ld c, LOW(rSTAT)
.loop

View File

@ -108,7 +108,7 @@ Init::
ldh [hSCY], a
ldh [rJOYP], a
ld a, $8 ; HBlank int enable
ld a, 1 << rSTAT_INT_HBLANK
ldh [rSTAT], a
ld a, $90