Skip to content

Commit 31b48d5

Browse files
Extend the BOOTUP- and OAM sections
1 parent 14f50b1 commit 31b48d5

File tree

1 file changed

+46
-26
lines changed

1 file changed

+46
-26
lines changed

hardware.inc

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
;* Rev 2.7 - 19-Jan-19 : Added rPCMXX (ISSOtm)
2525
;* Rev 2.8 - 03-Feb-19 : Added audio registers flags (Álvaro Cuesta)
2626
;* Rev 2.9 - 28-Feb-20 : Added utility rP1 constants
27-
;* Rev 3.0 - 04-Jul-20 : Register ordering, byte-based sizes, general cleanup (Blitter Object)
27+
;* Rev 3.0 - 04-Jul-20 : Register ordering, byte-based sizes, OAM additions, general cleanup (Blitter Object)
2828

2929
; If all of these are already defined, don't do it again.
3030

@@ -60,27 +60,6 @@ rROMB1 EQU $3000 ; $3000->$3fff - If more than 256 ROM banks are present.
6060
rRAMB EQU $4000 ; $4000->$5fff - Bit 3 enables rumble (if present)
6161

6262

63-
; --
64-
; -- OAM flags
65-
; --
66-
67-
OAMF_PRI EQU %10000000 ; Priority
68-
OAMF_YFLIP EQU %01000000 ; Y flip
69-
OAMF_XFLIP EQU %00100000 ; X flip
70-
OAMF_PAL0 EQU %00000000 ; Palette number; 0,1 (DMG)
71-
OAMF_PAL1 EQU %00010000 ; Palette number; 0,1 (DMG)
72-
OAMF_BANK0 EQU %00000000 ; Bank number; 0,1 (GBC)
73-
OAMF_BANK1 EQU %00001000 ; Bank number; 0,1 (GBC)
74-
75-
OAMF_PALMASK EQU %00000111 ; Palette (GBC)
76-
77-
OAMB_PRI EQU 7 ; Priority
78-
OAMB_YFLIP EQU 6 ; Y flip
79-
OAMB_XFLIP EQU 5 ; X flip
80-
OAMB_PAL1 EQU 4 ; Palette number; 0,1 (DMG)
81-
OAMB_BANK1 EQU 3 ; Bank number; 0,1 (GBC)
82-
83-
8463
;***************************************************************************
8564
;*
8665
;* Custom registers
@@ -727,13 +706,18 @@ AUDHIGH_LENGTH_OFF EQU %00000000
727706

728707
;***************************************************************************
729708
;*
730-
;* CPU value on bootup (a=type)
709+
;* CPU values on bootup (a=type, b=qualifier)
731710
;*
732711
;***************************************************************************
733712

734-
BOOTUP_DMG EQU $01 ; Dot Matrix Game
735-
BOOTUP_CGB EQU $11 ; Color GameBoy
736-
BOOTUP_MGB EQU $FF ; Mini GameBoy (Pocket GameBoy)
713+
BOOTUP_A_DMG EQU $01 ; Dot Matrix Game
714+
BOOTUP_A_CGB EQU $11 ; Color GameBoy
715+
BOOTUP_A_MGB EQU $FF ; Mini GameBoy (Pocket GameBoy)
716+
717+
; if a=BOOTUP_A_CGB, bit 0 in b can be checked to determine if real CGB or
718+
; other system running in GBC mode
719+
BOOTUP_B_CGB EQU %00000000
720+
BOOTUP_B_OTHER EQU %00000001 ; GBA, GBA SP, Game Boy Player, or New GBA SP
737721

738722

739723
;***************************************************************************
@@ -852,6 +836,42 @@ SCRN_VY EQU 256 ; Virtual height of screen in pixels
852836
SCRN_VX_B EQU 32 ; Virtual width of screen in bytes
853837
SCRN_VY_B EQU 32 ; Virtual height of screen in bytes
854838

839+
840+
;***************************************************************************
841+
;*
842+
;* OAM related
843+
;*
844+
;***************************************************************************
845+
846+
; OAM attributes
847+
; each entry in OAM RAM is 4 bytes (sizeof_OAM_ATTRS)
848+
RSRESET
849+
OAMA_Y RB 1 ; y pos
850+
OAMA_X RB 1 ; x pos
851+
OAMA_TILEID RB 1 ; tile id
852+
OAMA_FLAGS RB 1 ; flags (see below)
853+
sizeof_OAM_ATTRS RB 0
854+
855+
OAM_COUNT EQU 40 ; number of OAM entries in OAM RAM
856+
857+
; flags
858+
OAMF_PRI EQU %10000000 ; Priority
859+
OAMF_YFLIP EQU %01000000 ; Y flip
860+
OAMF_XFLIP EQU %00100000 ; X flip
861+
OAMF_PAL0 EQU %00000000 ; Palette number; 0,1 (DMG)
862+
OAMF_PAL1 EQU %00010000 ; Palette number; 0,1 (DMG)
863+
OAMF_BANK0 EQU %00000000 ; Bank number; 0,1 (GBC)
864+
OAMF_BANK1 EQU %00001000 ; Bank number; 0,1 (GBC)
865+
866+
OAMF_PALMASK EQU %00000111 ; Palette (GBC)
867+
868+
OAMB_PRI EQU 7 ; Priority
869+
OAMB_YFLIP EQU 6 ; Y flip
870+
OAMB_XFLIP EQU 5 ; X flip
871+
OAMB_PAL1 EQU 4 ; Palette number; 0,1 (DMG)
872+
OAMB_BANK1 EQU 3 ; Bank number; 0,1 (GBC)
873+
874+
855875
;*
856876
;* Nintendo scrolling logo
857877
;* (Code won't work on a real GameBoy)

0 commit comments

Comments
 (0)