MMIO registers: Difference between revisions
From SNESdev Wiki
Jump to navigationJump to search
Rainwarrior (talk | contribs) (just stubbing out a very quick list) |
(Adds interrupt-related CPU registers.) |
||
Line 25: | Line 25: | ||
* $4218-421F STD CNTRL1-4 | * $4218-421F STD CNTRL1-4 | ||
* $4300-437F [[DMA registers]] | * $4300-437F [[DMA registers]] | ||
==Interrupts== | |||
{{Anchor|NMITIMEN}} | |||
===NMITIMEN - Interrupts and Joypad reading ($4200 write)=== | |||
---- | |||
7 bit 0 | |||
---- ---- | |||
N.VH ...J | |||
| || | | |||
| || +- Joypad auto-read enable | |||
| ++------ H/V timer IRQ: | |||
| 00 = Disable timer | |||
| 01 = IRQ when H counter == HTIME | |||
| 10 = IRQ when V counter == VTIME and H counter == 0 | |||
| 11 = IRQ when H counter == HTIME and V counter == VTIME | |||
+--------- Vblank NMI enable | |||
TODO: Details on the exact conditions for an NMI or IRQ. | |||
===Screen timer values=== | |||
---- | |||
{{Anchor|HTIME}} | |||
====HTIMEL, HTIMEH - H timer target ($4207, $4208 write)==== | |||
7 bit 0 7 bit 0 | |||
---- ---- ---- ---- | |||
.... ...X XXXX XXXX | |||
| |||| |||| | |||
+---++++-++++- H counter target for timer IRQ | |||
Note that setting a value larger than the maximum H counter value of 339 will prevent the timer's H condition from being met. | |||
{{Anchor|VTIME}} | |||
====VTIMEL, VTIMEH - V timer target ($4209, $420A write)==== | |||
7 bit 0 7 bit 0 | |||
---- ---- ---- ---- | |||
.... ...V VVVV VVVV | |||
| |||| |||| | |||
+---++++-++++- V counter target for timer IRQ | |||
Note that setting a value larger than the maximum V counter value will prevent the timer's V condition from being met. The maximum depends on the region (261 for NTSC, 311 for PAL) and interlacing (1 additional scanline every other frame). | |||
===Status=== | |||
---- | |||
{{Anchor|RDNMI}} | |||
====RDNMI - Vblank flag and CPU version ($4210 read)==== | |||
7 bit 0 | |||
---- ---- | |||
Nxxx VVVV | |||
|||| |||| | |||
|||| ++++- CPU version | |||
|+++------ Open bus | |||
+--------- Vblank flag | |||
On read: RDNMI D7 = 0 | |||
The vblank flag is set at the start of vblank and cleared at the end of vblank or on read. | |||
{{Anchor|TIMEUP}} | |||
====TIMEUP - Timer flag ($4211 read)==== | |||
7 bit 0 | |||
---- ---- | |||
Txxx xxxx | |||
|||| |||| | |||
|+++-++++- Open bus | |||
+--------- Timer flag | |||
On read: TIMEUP D7 = 0 | |||
The timer flag is set when the timer condition specified in NMITIMEN becomes true and is cleared on read. | |||
{{Anchor|HVBJOY}} | |||
====HVBJOY - Screen and Joypad status ($4212 read)==== | |||
7 bit 0 | |||
---- ---- | |||
VHxx xxxJ | |||
|||| |||| | |||
|||| |||+- Joypad auto-read in-progress flag | |||
||++-+++-- Open bus | |||
|+-------- Hblank flag | |||
+--------- Vblank flag |
Revision as of 16:11, 22 May 2022
TODO
- $2100-213F PPU registers
- $2140-2413 APUIO
- $2180 WMDATA
- $2181-2183 WMADD
- $4016 Legacy Gamepad 1
- $4017 Legacy Gamepad 2
- $4200 NMITIMEN
- $4201 WRIO
- $4202-4203 WRMPY
- $4204-4206 WRDIV
- $4207-4208 HTIME
- $4209-420A VTIME
- $420B MDMAEN
- $420C HDMAEN
- $420D MEMSEL
- $420E-420F ?
- $4210 RDNMI
- $4211 TIMEUP
- $4212 HVBJOY
- $4213 RDIO
- $4214-4215 RDDIV
- $4216-4217 RDMPY
- $4218-421F STD CNTRL1-4
- $4300-437F DMA registers
Interrupts
NMITIMEN - Interrupts and Joypad reading ($4200 write)
7 bit 0 ---- ---- N.VH ...J | || | | || +- Joypad auto-read enable | ++------ H/V timer IRQ: | 00 = Disable timer | 01 = IRQ when H counter == HTIME | 10 = IRQ when V counter == VTIME and H counter == 0 | 11 = IRQ when H counter == HTIME and V counter == VTIME +--------- Vblank NMI enable
TODO: Details on the exact conditions for an NMI or IRQ.
Screen timer values
HTIMEL, HTIMEH - H timer target ($4207, $4208 write)
7 bit 0 7 bit 0 ---- ---- ---- ---- .... ...X XXXX XXXX | |||| |||| +---++++-++++- H counter target for timer IRQ
Note that setting a value larger than the maximum H counter value of 339 will prevent the timer's H condition from being met.
VTIMEL, VTIMEH - V timer target ($4209, $420A write)
7 bit 0 7 bit 0 ---- ---- ---- ---- .... ...V VVVV VVVV | |||| |||| +---++++-++++- V counter target for timer IRQ
Note that setting a value larger than the maximum V counter value will prevent the timer's V condition from being met. The maximum depends on the region (261 for NTSC, 311 for PAL) and interlacing (1 additional scanline every other frame).
Status
RDNMI - Vblank flag and CPU version ($4210 read)
7 bit 0 ---- ---- Nxxx VVVV |||| |||| |||| ++++- CPU version |+++------ Open bus +--------- Vblank flag On read: RDNMI D7 = 0
The vblank flag is set at the start of vblank and cleared at the end of vblank or on read.
TIMEUP - Timer flag ($4211 read)
7 bit 0 ---- ---- Txxx xxxx |||| |||| |+++-++++- Open bus +--------- Timer flag On read: TIMEUP D7 = 0
The timer flag is set when the timer condition specified in NMITIMEN becomes true and is cleared on read.
HVBJOY - Screen and Joypad status ($4212 read)
7 bit 0 ---- ---- VHxx xxxJ |||| |||| |||| |||+- Joypad auto-read in-progress flag ||++-+++-- Open bus |+-------- Hblank flag +--------- Vblank flag