Skip to content

Commit 9596222

Browse files
committed
Add rSYS alias for rKEY0
1 parent f2d8ebb commit 9596222

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

HISTORY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,5 @@
8484
- Deprecate memory region and cartridge header constants
8585
- Changed formatting and reorganized sections
8686
- Moved revision history to separate HISTORY.md file
87+
- **Rev 4.11.0** - 2025-05-19 *(Rangi42)*
88+
- Added `rMODE` alias for `rKEY0`

hardware.inc

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ endc
2222
; Define the include guard and the current hardware.inc version
2323
; (do this after the RGBDS version check since the `def` syntax depends on it)
2424
def HARDWARE_INC equ 1
25-
def HARDWARE_INC_VERSION equs "4.10.0"
25+
def HARDWARE_INC_VERSION equs "4.11.0"
2626

2727
; Usage: rev_Check_hardware_inc <min_ver>
2828
; Examples:
@@ -430,8 +430,8 @@ def LCDCB_PRION equ 0 ; (CGB only) whether OBJ priority bits are enabled [r/w]
430430
def LCDCF_WINOFF equ 0 << LCDCB_WINON
431431
def LCDCF_WINON equ 1 << LCDCB_WINON
432432
def LCDCF_BLKS equ 1 << LCDCB_BLKS
433-
def LCDCF_BLK21 equ 0 << LCDCB_BLKS
434-
def LCDCF_BLK01 equ 1 << LCDCB_BLKS
433+
def LCDCF_BLK21 equ 0 << LCDCB_BLKS
434+
def LCDCF_BLK01 equ 1 << LCDCB_BLKS
435435
def LCDCF_BG9800 equ 0 << LCDCB_BG9C00
436436
def LCDCF_BG9C00 equ 1 << LCDCB_BG9C00
437437
def LCDCF_OBJ8 equ 0 << LCDCB_OBJ16
@@ -512,20 +512,20 @@ def rWX equ $FF4B
512512

513513
def WX_OFS equ 7 ; subtract this to get the actual Window Y coordinate
514514

515-
; -- KEY0 ($FF4C) -------------------------------------------------------------
515+
; -- SYS / KEY0 ($FF4C) -------------------------------------------------------------
516516
; (CGB boot ROM only) CPU mode select
517-
def rKEY0 equ $FF4C
517+
def rSYS equ $FF4C
518518

519-
; KEY0 is known as the "CPU mode register" in Fig. 11 of this patent:
519+
; This is known as the "CPU mode register" in Fig. 11 of this patent:
520520
; https://patents.google.com/patent/US6322447B1/en?oq=US6322447bi
521521
; "OBJ priority mode designating register" in the same patent
522522
; Credit to @mattcurrie for this finding!
523523

524-
def KEY0F_MODE equ %0000_11_00 ; current system mode [r/w]
525-
def KEY0F_CGB equ %0000_00_00 ; CGB mode
526-
def KEY0F_DMG equ %0000_01_00 ; DMG compatibility mode
527-
def KEY0F_PGB1 equ %0000_10_00 ; LCD is driven externally, CPU is stopped
528-
def KEY0F_PGB2 equ %0000_11_00 ; LCD is driven externally, CPU is running
524+
def SYSF_MODE equ %0000_11_00 ; current system mode [r/w]
525+
def SYSF_CGB equ %0000_00_00 ; CGB mode
526+
def SYSF_DMG equ %0000_01_00 ; DMG compatibility mode
527+
def SYSF_PGB1 equ %0000_10_00 ; LCD is driven externally, CPU is stopped
528+
def SYSF_PGB2 equ %0000_11_00 ; LCD is driven externally, CPU is running
529529

530530
; -- SPD / KEY1 ($FF4D) -------------------------------------------------------
531531
; (CGB only) Double-speed mode control
@@ -867,6 +867,13 @@ def rNR50 equ rAUDVOL
867867
def rNR51 equ rAUDTERM
868868
def rNR52 equ rAUDENA
869869

870+
def rKEY0 equ rSYS
871+
def KEY0F_MODE equ SYSF_MODE
872+
def KEY0F_CGB equ SYSF_CGB
873+
def KEY0F_DMG equ SYSF_DMG
874+
def KEY0F_PGB1 equ SYSF_PGB1
875+
def KEY0F_PGB2 equ SYSF_PGB2
876+
870877
def rKEY1 equ rSPD
871878
def KEY1F_DBLSPEED equ SPDF_DBLSPEED
872879
def KEY1F_PREPARE equ SPDF_PREPARE

0 commit comments

Comments
 (0)