Skip to content

Commit 2b1da95

Browse files
mattcurrieRangi42
andauthored
Add PSW related registers (#83)
* Add PSW related registers * Revert change to HISTORY.md Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com> * Revert change to hardware.inc Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com> * Adjust DMG mode commentry Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com> * Adjust DMG mode commentry Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com> * Restore `HARDWARE_INC_VERSION` --------- Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com>
1 parent 64f40e8 commit 2b1da95

File tree

2 files changed

+49
-2
lines changed

2 files changed

+49
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ Breaking changes increase the major version, backwards-compatible changes (typic
2424
* Carsten Sørensen (whose ideas Jeff based his file on)
2525
* Jeff Frohwein
2626
* AntonioND
27-
* BlitterObjectBob, tobiasvl, ISSOtm, Rangi42, avivace, Eievui, QuinnPainter, rondnelson99, daid, Hacktix, sukus21, alvaro-cuesta, basxto
27+
* BlitterObjectBob, tobiasvl, ISSOtm, Rangi42, avivace, Eievui, QuinnPainter, rondnelson99, daid, Hacktix, sukus21, alvaro-cuesta, basxto, mattcurrie
2828
* Probably lots of other people who have added to the file throughout the years

hardware.inc

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,54 @@ def rWBK equ $FF70
689689

690690
def WBK_BANK equ %00000_111 ; mapped WRAM bank (0-7) [r/w]
691691

692-
; -- $FF71-$FF75 are unused ---------------------------------------------------
692+
; -- PSW ($FF71) --------------------------------------------------------------
693+
; (CGB boot ROM's DMG mode only) Palette Selection Window and NMI control. [r/w]
694+
; Bits 1-6 are always 1.
695+
; In CGB mode, reads return $FF and writes are ignored.
696+
def rPSW equ $FF71
697+
698+
def B_PSW_WINDOW equ 7 ; whether the Palette Selection Window is enabled [r/w]
699+
def B_PSW_NMI equ 0 ; whether the NMI is enabled [r/w]
700+
def PSW_WINDOW equ 1 << B_PSW_WINDOW
701+
def PSW_WIN_OFF equ 0 << B_PSW_WINDOW
702+
def PSW_WIN_ON equ 1 << B_PSW_WINDOW
703+
def PSW_NMI equ 1 << B_PSW_NMI
704+
def PSW_NMI_DISABLE equ 0 << B_PSW_NMI
705+
def PSW_NMI_ENABLE equ 1 << B_PSW_NMI
706+
707+
; -- PSWX ($FF72) -------------------------------------------------------------
708+
; (CGB boot ROM only) X coordinate of the Palette Selection Window's top-left pixel, plus 7 (7-166) [r/w]
709+
; Readable and writable in both CGB and DMG mode.
710+
def rPSWX equ $FF72
711+
712+
; -- PSWY ($FF73) -------------------------------------------------------------
713+
; (CGB boot ROM only) Y coordinate of the Palette Selection Window's top-left pixel (0-143) [r/w]
714+
; Readable and writable in both CGB and DMG mode.
715+
def rPSWY equ $FF73
716+
717+
; -- PSM ($FF74) --------------------------------------------------------------
718+
; (CGB boot ROM only) Set the Palette Selection Window button mask (triggers NMI when pressed) [r/w]
719+
; Readable and writable in both CGB and DMG mode.
720+
def rPSM equ $FF74
721+
722+
def B_PSM_START equ 7
723+
def B_PSM_SELECT equ 6
724+
def B_PSM_B equ 5
725+
def B_PSM_A equ 4
726+
def B_PSM_DOWN equ 3
727+
def B_PSM_UP equ 2
728+
def B_PSM_LEFT equ 1
729+
def B_PSM_RIGHT equ 0
730+
def PSM_START equ 1 << B_PSM_START
731+
def PSM_SELECT equ 1 << B_PSM_SELECT
732+
def PSM_B equ 1 << B_PSM_B
733+
def PSM_A equ 1 << B_PSM_A
734+
def PSM_DOWN equ 1 << B_PSM_DOWN
735+
def PSM_UP equ 1 << B_PSM_UP
736+
def PSM_LEFT equ 1 << B_PSM_LEFT
737+
def PSM_RIGHT equ 1 << B_PSM_RIGHT
738+
739+
; -- $FF75 is unused ----------------------------------------------------------
693740

694741
; -- PCM12 ($FF76) ------------------------------------------------------------
695742
; Audio channels 1 and 2 output

0 commit comments

Comments
 (0)