Skip to content

Commit

Permalink
Consolidate BG Map & OAM attribute flags (#1078)
Browse files Browse the repository at this point in the history
  • Loading branch information
xCrystal committed Jan 7, 2024
1 parent e0c278a commit 0266f64
Show file tree
Hide file tree
Showing 14 changed files with 258 additions and 259 deletions.
25 changes: 12 additions & 13 deletions constants/hardware_constants.asm
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,19 @@ DEF SERIAL EQU 3
DEF JOYPAD EQU 4
DEF IE_DEFAULT EQU (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)

; OAM attribute flags
DEF OAM_TILE_BANK EQU 3
DEF OAM_OBP_NUM EQU 4 ; non CGB Mode Only
DEF OAM_X_FLIP EQU 5
DEF OAM_Y_FLIP EQU 6
DEF OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3)
; BG Map & OAM attribute flags
DEF TILE_BANK_F EQU 3
DEF OBP_NUM_F EQU 4 ; OAM attribute only, non CGB Mode Only
DEF X_FLIP_F EQU 5
DEF Y_FLIP_F EQU 6
DEF PRIORITY_F EQU 7 ; BG priority overrides OBJ priority. Otherwise, for OBJ: 0: OBJ above BG, 1: OBJ behind BG (colors 1-3)

; BG Map attribute flags
DEF PALETTE_MASK EQU %111
DEF VRAM_BANK_1 EQU 1 << OAM_TILE_BANK ; $08
DEF OBP_NUM EQU 1 << OAM_OBP_NUM ; $10
DEF X_FLIP EQU 1 << OAM_X_FLIP ; $20
DEF Y_FLIP EQU 1 << OAM_Y_FLIP ; $40
DEF PRIORITY EQU 1 << OAM_PRIORITY ; $80
DEF PALETTE_MASK EQU %111 ; For BG Map: which of BGP0–7 to use. For OAM: which of OBP0–7 to use (CGB mode only).
DEF VRAM_BANK_1 EQU 1 << TILE_BANK_F ; $08
DEF OBP1 EQU 1 << OBP_NUM_F ; $10
DEF X_FLIP EQU 1 << X_FLIP_F ; $20
DEF Y_FLIP EQU 1 << Y_FLIP_F ; $40
DEF PRIORITY EQU 1 << PRIORITY_F ; $80

; Hardware registers
DEF rJOYP EQU $ff00 ; Joypad (R/W)
Expand Down
Loading

0 comments on commit 0266f64

Please sign in to comment.