I/O port map: Difference between revisions

From WSdev Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(28 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The WonderSwan SoC has three general blocks of I/O port accesses:
{| class="wikitable"
! From !! To !! Holder !! Width !! Speed
|-
| $00 || $B7 || WonderSwan SoC || 16-bit || 1 cycle
|-
| $B8 || $BF || Internal EEPROM control || 16-bit || 1 cycle
|-
| $C0 || $FF || Cartridge bus || 8-bit || 1<sup>(color)</sup>/2 cycles (configurable)
|}
With the exception of internal EEPROM on the ASWAN, all unaligned 16-bit accesses can be converted to two 8-bit accesses with a 1-cycle penalty.
== I/O port map ==
* Superscripts are used to mark ports specific to a given mode or platform:
* Superscripts are used to mark ports specific to a given mode or platform:
** Color mode: <sup>(color)</sup>.
** Color mode: <sup>(color)</sup>. Such ports are only accessible when color mode is enabled through port <code>$60</code>.
** WS/WSC/SC console: <sup>(WS)</sup>, <sup>(WSC)</sup>, <sup>(SC)</sup>.
** WS/WSC/SC console: <sup>(WS)</sup>, <sup>(WSC)</sup>, <sup>(SC)</sup>.
* If two Bits rows are provided, the second one refers to the "Color" mode.
* If two Bits rows are provided, the second one refers to the "Color" mode.
Line 13: Line 29:
! Notes
! Notes
|-
|-
! rowspan="45" | [[Display]]  
! rowspan="47" | [[Display]]  
! $00
! $00
| [[Display#Display Control|Display Control]]
| [[Display/IO Ports#Display Control|Display Control]]
| style="text-align: right" | <tt style="white-space: nowrap">..ow Ws21</tt>
| style="text-align: right" | <tt style="white-space: nowrap">..wo Ws21</tt>
| RW8
| RW8
|  
|  
|-
|-
! $01
! $01
| [[Display#Display Background|Display Background]]
| [[Display/IO Ports#Display Background|Display Background]]
| style="text-align: right" | <tt style="white-space: nowrap">.... .sss</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.... .sss</tt>
<tt style="white-space: nowrap">pppp iiii</tt>
<tt style="white-space: nowrap">pppp iiii</tt>
Line 29: Line 45:
|-
|-
! $02
! $02
| [[Display#Current Line|Display Current Line]]
| [[Display/IO Ports#Current Line|Display Current Line]]
| style="text-align: right" | <tt style="white-space: nowrap">llll llll</tt>
| style="text-align: right" | <tt style="white-space: nowrap">llll llll</tt>
| R8
| R8
Line 35: Line 51:
|-
|-
! $03
! $03
| [[Display#Interrupt Line|Display Interrupt Line]]
| [[Display/IO Ports#Interrupt Line|Display Interrupt Line]]
| style="text-align: right" | <tt style="white-space: nowrap">llll llll</tt>
| style="text-align: right" | <tt style="white-space: nowrap">llll llll</tt>
| RW8
| RW8
Line 41: Line 57:
|-
|-
! $04
! $04
| [[Display#Sprite Table Address|Sprite Table Address]]
| [[Display/IO Ports#Sprite Table Address|Sprite Table Address]]
| style="text-align: right" | <tt style="white-space: nowrap">...a aaaa</tt>
| style="text-align: right" | <tt style="white-space: nowrap">...a aaaa</tt>
<tt style="white-space: nowrap">..aa aaaa</tt>
<tt style="white-space: nowrap">..aa aaaa</tt>
Line 48: Line 64:
|-
|-
! $05
! $05
| [[Display#Sprite Table First|Sprite Table First]]
| [[Display/IO Ports#Sprite Table First|Sprite Table First]]
| style="text-align: right" | <tt style="white-space: nowrap">.iii iiii</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.iii iiii</tt>
| RW8
| RW8
Line 54: Line 70:
|-
|-
! $06
! $06
| [[Display#Sprite Table Count|Sprite Table Count]]
| [[Display/IO Ports#Sprite Table Count|Sprite Table Count]]
| style="text-align: right" | <tt style="white-space: nowrap">cccc cccc</tt>
| style="text-align: right" | <tt style="white-space: nowrap">cccc cccc</tt>
| RW8
| RW8
Line 60: Line 76:
|-
|-
! $07
! $07
| [[Display#Screen Address|Screen Address]]
| [[Display/IO Ports#Screen Address|Screen Address]]
| style="text-align: right" | <tt style="white-space: nowrap">.222 .111</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.222 .111</tt>
<tt style="white-space: nowrap">2222 1111</tt>
<tt style="white-space: nowrap">2222 1111</tt>
Line 68: Line 84:
|-
|-
! $08
! $08
| [[Display#Screen 2 Window|Screen 2 Window Left]]
| [[Display/IO Ports#Screen 2 Window|Screen 2 Window Left]]
| style="text-align: right" | <tt style="white-space: nowrap">xxxx xxxx</tt>
| style="text-align: right" | <tt style="white-space: nowrap">xxxx xxxx</tt>
| RW8
| RW8
Line 74: Line 90:
|-
|-
! $09
! $09
| [[Display#Screen 2 Window|Screen 2 Window Top]]
| [[Display/IO Ports#Screen 2 Window|Screen 2 Window Top]]
| style="text-align: right" | <tt style="white-space: nowrap">yyyy yyyy</tt>
| style="text-align: right" | <tt style="white-space: nowrap">yyyy yyyy</tt>
| RW8
| RW8
Line 80: Line 96:
|-
|-
! $0A
! $0A
| [[Display#Screen 2 Window|Screen 2 Window Right]]
| [[Display/IO Ports#Screen 2 Window|Screen 2 Window Right]]
| style="text-align: right" | <tt style="white-space: nowrap">xxxx xxxx</tt>
| style="text-align: right" | <tt style="white-space: nowrap">xxxx xxxx</tt>
| RW8
| RW8
Line 86: Line 102:
|-
|-
! $0B
! $0B
| [[Display#Screen 2 Window|Screen 2 Window Bottom]]
| [[Display/IO Ports#Screen 2 Window|Screen 2 Window Bottom]]
| style="text-align: right" | <tt style="white-space: nowrap">yyyy yyyy</tt>
| style="text-align: right" | <tt style="white-space: nowrap">yyyy yyyy</tt>
| RW8
| RW8
| Coordinate (y)
| Coordinate (y)
|-
|-
! $0B
! $0C
| [[Display#Sprite Window|Sprite Window Left]]
| [[Display/IO Ports#Sprite Window|Sprite Window Left]]
| style="text-align: right" | <tt style="white-space: nowrap">xxxx xxxx</tt>
| style="text-align: right" | <tt style="white-space: nowrap">xxxx xxxx</tt>
| RW8
| RW8
| Coordinate (x)
| Coordinate (x)
|-
|-
! $0C
! $0D
| [[Display#Sprite Window|Sprite Window Top]]
| [[Display/IO Ports#Sprite Window|Sprite Window Top]]
| style="text-align: right" | <tt style="white-space: nowrap">yyyy yyyy</tt>
| style="text-align: right" | <tt style="white-space: nowrap">yyyy yyyy</tt>
| RW8
| RW8
Line 104: Line 120:
|-
|-
! $0E
! $0E
| [[Display#Sprite Window|Sprite Window Right]]
| [[Display/IO Ports#Sprite Window|Sprite Window Right]]
| style="text-align: right" | <tt style="white-space: nowrap">xxxx xxxx</tt>
| style="text-align: right" | <tt style="white-space: nowrap">xxxx xxxx</tt>
| RW8
| RW8
Line 110: Line 126:
|-
|-
! $0F
! $0F
| [[Display#Sprite Window|Sprite Window Bottom]]
| [[Display/IO Ports#Sprite Window|Sprite Window Bottom]]
| style="text-align: right" | <tt style="white-space: nowrap">yyyy yyyy</tt>
| style="text-align: right" | <tt style="white-space: nowrap">yyyy yyyy</tt>
| RW8
| RW8
Line 116: Line 132:
|-
|-
! $10
! $10
| [[Display#Screen Scroll|Screen 1 Scroll X]]
| [[Display/IO Ports#Screen Scroll|Screen 1 Scroll X]]
| style="text-align: right" | <tt style="white-space: nowrap">xxxx xxxx</tt>
| style="text-align: right" | <tt style="white-space: nowrap">xxxx xxxx</tt>
| RW8
| RW8
Line 122: Line 138:
|-
|-
! $11
! $11
| [[Display#Screen Scroll|Screen 1 Scroll Y]]
| [[Display/IO Ports#Screen Scroll|Screen 1 Scroll Y]]
| style="text-align: right" | <tt style="white-space: nowrap">yyyy yyyy</tt>
| style="text-align: right" | <tt style="white-space: nowrap">yyyy yyyy</tt>
| RW8
| RW8
Line 128: Line 144:
|-
|-
! $12
! $12
| [[Display#Screen Scroll|Screen 2 Scroll X]]
| [[Display/IO Ports#Screen Scroll|Screen 2 Scroll X]]
| style="text-align: right" | <tt style="white-space: nowrap">xxxx xxxx</tt>
| style="text-align: right" | <tt style="white-space: nowrap">xxxx xxxx</tt>
| RW8
| RW8
Line 134: Line 150:
|-
|-
! $13
! $13
| [[Display#Screen Scroll|Screen 2 Scroll Y]]
| [[Display/IO Ports#Screen Scroll|Screen 2 Scroll Y]]
| style="text-align: right" | <tt style="white-space: nowrap">yyyy yyyy</tt>
| style="text-align: right" | <tt style="white-space: nowrap">yyyy yyyy</tt>
| RW8
| RW8
Line 140: Line 156:
|-
|-
! $14
! $14
| [[Display#LCD Control|LCD Control]]
| [[Display/IO Ports#LCD Control|LCD Control]]
| style="text-align: right" | <tt style="white-space: nowrap">.... ..Ce</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.... ..Ce</tt>
| RW8
| RW8
Line 146: Line 162:
|-
|-
! $15
! $15
| [[Display#LCD Icon Control|LCD Icon Control]]
| [[Display/IO Ports#LCD Icon Control|LCD Icon Control]]
| style="text-align: right" | <tt style="white-space: nowrap">..32 1hvs</tt>
| style="text-align: right" | <tt style="white-space: nowrap">..32 1hvs</tt>
| RW8
| RW8
| Auxillary 3 (3), Auxillary 2 (2), Auxillary 1 (1),
| Etc. 3 (3), Etc. 2 (2), Etc. 1 (1),
Horizontal (h), Vertical (v), Sleep (s)
Horizontal (h), Vertical (v), Sleep (s)
|-
|-
! $16
! $16
| [[Display#LCD Final Line|LCD Final Line]]
| [[Display/IO Ports#LCD Final Line|LCD Final Line]]
| style="text-align: right" | <tt style="white-space: nowrap">llll llll</tt>
| style="text-align: right" | <tt style="white-space: nowrap">llll llll</tt>
| RW8
| RW8
Line 159: Line 175:
|-
|-
! $17
! $17
| [[Display#LCD Back Porch Line|LCD Back Porch Line]]<sup>(WSC)</sup>
| [[Display/IO Ports#LCD Back Porch Line|LCD Back Porch Line]]<sup>(WSC)</sup>
| style="text-align: right" | <tt style="white-space: nowrap">llll llll</tt>
| style="text-align: right" | <tt style="white-space: nowrap">llll llll</tt>
| RW8
| RW8
| Line (l)
| Line (l)
|-
! $18
| [[Display/IO Ports#LCD Line Counter|LCD Line Counter]]
| style="text-align: right" | <tt style="white-space: nowrap">llll llll</tt>
| W8
| Line (l)
|-
! $1A
| [[Display/IO Ports#LCD Status|LCD Latched Icon Status]]
| style="text-align: right" | <tt style="white-space: nowrap">..cv vvhs</tt>
| R8
| Cartridge icon (c), Volume icons (v),
Headphone icon (h), Latch override (l)
|-
|-
! $1A
! $1A
| [[Display#LCD Status|LCD Status]]
| [[Display/IO Ports#LCD Status|LCD Latched Icon Control]]
| style="text-align: right" | <tt style="white-space: nowrap">...v vv.s</tt>
| style="text-align: right" | <tt style="white-space: nowrap">..cv vvhs</tt>
| RW8
| W8
| Volume segment status (v), Sleep (s)
| Cartridge (c), Sound (s), Latch override (l)
|-
|-
! $1C
! $1C
| [[Display#LCD Mono Shade LUT|LCD Mono Shade LUT 0/1]]
| [[Display/IO Ports#LCD Mono Shade LUT|LCD Mono Shade LUT 0/1]]
| style="text-align: right" | <tt style="white-space: nowrap">1111 0000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">1111 0000</tt>
| RW8
| RW8
Line 177: Line 206:
|-
|-
! $1D
! $1D
| [[Display#LCD Mono Shade LUT|LCD Mono Shade LUT 2/3]]
| [[Display/IO Ports#LCD Mono Shade LUT|LCD Mono Shade LUT 2/3]]
| style="text-align: right" | <tt style="white-space: nowrap">3333 2222</tt>
| style="text-align: right" | <tt style="white-space: nowrap">3333 2222</tt>
| RW8
| RW8
Line 183: Line 212:
|-
|-
! $1E
! $1E
| [[Display#LCD Mono Shade LUT|LCD Mono Shade LUT 4/5]]
| [[Display/IO Ports#LCD Mono Shade LUT|LCD Mono Shade LUT 4/5]]
| style="text-align: right" | <tt style="white-space: nowrap">5555 4444</tt>
| style="text-align: right" | <tt style="white-space: nowrap">5555 4444</tt>
| RW8
| RW8
Line 189: Line 218:
|-
|-
! $1F
! $1F
| [[Display#LCD Mono Shade LUT|LCD Mono Shade LUT 6/7]]
| [[Display/IO Ports#LCD Mono Shade LUT|LCD Mono Shade LUT 6/7]]
| style="text-align: right" | <tt style="white-space: nowrap">7777 6666</tt>
| style="text-align: right" | <tt style="white-space: nowrap">7777 6666</tt>
| RW8
| RW8
Line 195: Line 224:
|-
|-
! $20
! $20
| [[Display#LCD Mono Palette|LCD Mono Palette 0]]
| [[Display/IO Ports#LCD Mono Palette|LCD Mono Palette 0]]
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| RW16
| RW16
Line 201: Line 230:
|-
|-
! $22
! $22
| [[Display#LCD Mono Palette|LCD Mono Palette 1]]
| [[Display/IO Ports#LCD Mono Palette|LCD Mono Palette 1]]
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| RW16
| RW16
Line 207: Line 236:
|-
|-
! $24
! $24
| [[Display#LCD Mono Palette|LCD Mono Palette 2]]
| [[Display/IO Ports#LCD Mono Palette|LCD Mono Palette 2]]
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| RW16
| RW16
Line 213: Line 242:
|-
|-
! $26
! $26
| [[Display#LCD Mono Palette|LCD Mono Palette 3]]
| [[Display/IO Ports#LCD Mono Palette|LCD Mono Palette 3]]
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| RW16
| RW16
Line 219: Line 248:
|-
|-
! $28
! $28
| [[Display#LCD Mono Palette|LCD Mono Palette 4]]
| [[Display/IO Ports#LCD Mono Palette|LCD Mono Palette 4]]
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| RW16
| RW16
Line 225: Line 254:
|-
|-
! $2A
! $2A
| [[Display#LCD Mono Palette|LCD Mono Palette 5]]
| [[Display/IO Ports#LCD Mono Palette|LCD Mono Palette 5]]
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| RW16
| RW16
Line 231: Line 260:
|-
|-
! $2C
! $2C
| [[Display#LCD Mono Palette|LCD Mono Palette 6]]
| [[Display/IO Ports#LCD Mono Palette|LCD Mono Palette 6]]
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| RW16
| RW16
Line 237: Line 266:
|-
|-
! $2E
! $2E
| [[Display#LCD Mono Palette|LCD Mono Palette 7]]
| [[Display/IO Ports#LCD Mono Palette|LCD Mono Palette 7]]
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| RW16
| RW16
Line 243: Line 272:
|-
|-
! $30
! $30
| [[Display#LCD Mono Palette|LCD Mono Palette 8]]
| [[Display/IO Ports#LCD Mono Palette|LCD Mono Palette 8]]
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| RW16
| RW16
Line 249: Line 278:
|-
|-
! $32
! $32
| [[Display#LCD Mono Palette|LCD Mono Palette 9]]
| [[Display/IO Ports#LCD Mono Palette|LCD Mono Palette 9]]
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| RW16
| RW16
Line 255: Line 284:
|-
|-
! $34
! $34
| [[Display#LCD Mono Palette|LCD Mono Palette 10]]
| [[Display/IO Ports#LCD Mono Palette|LCD Mono Palette 10]]
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| RW16
| RW16
Line 261: Line 290:
|-
|-
! $36
! $36
| [[Display#LCD Mono Palette|LCD Mono Palette 11]]
| [[Display/IO Ports#LCD Mono Palette|LCD Mono Palette 11]]
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| RW16
| RW16
Line 267: Line 296:
|-
|-
! $38
! $38
| [[Display#LCD Mono Palette|LCD Mono Palette 12]]
| [[Display/IO Ports#LCD Mono Palette|LCD Mono Palette 12]]
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| RW16
| RW16
Line 273: Line 302:
|-
|-
! $3A
! $3A
| [[Display#LCD Mono Palette|LCD Mono Palette 13]]
| [[Display/IO Ports#LCD Mono Palette|LCD Mono Palette 13]]
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| RW16
| RW16
Line 279: Line 308:
|-
|-
! $3C
! $3C
| [[Display#LCD Mono Palette|LCD Mono Palette 14]]
| [[Display/IO Ports#LCD Mono Palette|LCD Mono Palette 14]]
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| RW16
| RW16
Line 285: Line 314:
|-
|-
! $3E
! $3E
| [[Display#LCD Mono Palette|LCD Mono Palette 15]]
| [[Display/IO Ports#LCD Mono Palette|LCD Mono Palette 15]]
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.333 .222 .111 .000</tt>
| RW16
| RW16
Line 293: Line 322:
! $40
! $40
| [[DMA#General DMA|GDMA Source Address Low]]
| [[DMA#General DMA|GDMA Source Address Low]]
| style="text-align: right" | <tt style="white-space: nowrap">llll llll llll llll</tt>
| style="text-align: right" | <tt style="white-space: nowrap">llll llll llll lll.</tt>
| RW16
| RW16
| Linear address, low 16 bits (l)
| Linear address, low 16 bits (l)
Line 305: Line 334:
! $44
! $44
| [[DMA#General DMA|GDMA Destination Address]]
| [[DMA#General DMA|GDMA Destination Address]]
| style="text-align: right" | <tt style="white-space: nowrap">aaaa aaaa aaaa aaaa</tt>
| style="text-align: right" | <tt style="white-space: nowrap">aaaa aaaa aaaa aaa.</tt>
| RW16
| RW16
| IRAM address (a)
| IRAM address (a)
Line 311: Line 340:
! $46
! $46
| [[DMA#General DMA|GDMA Length]]
| [[DMA#General DMA|GDMA Length]]
| style="text-align: right" | <tt style="white-space: nowrap">bbbb bbbb bbbb bbbb</tt>
| style="text-align: right" | <tt style="white-space: nowrap">bbbb bbbb bbbb bbb.</tt>
| RW16
| RW16
| Bytes (b)
| Bytes (b)
Line 347: Line 376:
! $52
! $52
| [[DMA#Sound DMA|SDMA Control]]
| [[DMA#Sound DMA|SDMA Control]]
| style="text-align: right" | <tt style="white-space: nowrap">ed.t r?ff</tt>
| style="text-align: right" | <tt style="white-space: nowrap">ed.t rhff</tt>
| RW8
| RW8
| Enable (e), Decrement (d), Target (t),
| Enable (e), Decrement (d), Target (t),
Repeat (r), Frequency (f)
Repeat (r), Hold (h), Frequency (f)
|-
|-
! rowspan="2" | System<sup>(color)</sup>
! rowspan="2" | [[SoC]]<sup>(color)</sup>
! $60
! $60
| System Control 2
| [[SoC#System Control 2|System Control 2]]
| style="text-align: right" | <tt style="white-space: nowrap">c4C. ?.??</tt>
| style="text-align: right" | <tt style="white-space: nowrap">c4C. i?sl</tt>
| RW8
| RW8
| Color (c), 4BPP (4), Chunky (C)
| Color (c), 4BPP (4), Chunky (C),<br/>
Cart I/O wait state (i), SRAM wait state (s),<br/>
Cart clock speed (l).
|-
|-
! $62
! $62
| System Control 3
| [[SoC#System Control 3|System Control 3]]
| style="text-align: right" | <tt style="white-space: nowrap">S... ...p</tt>
| style="text-align: right" | <tt style="white-space: nowrap">S... ...p</tt>
| RW8
| RW8
| SwanCrystal (S), Power off (p)
| SwanCrystal (S), Power off (p)
|-
|-
! rowspan="5" | [[Hyper Voice]]<sup>(color)</sup>
! rowspan="4" | [[Hyper Voice]]<sup>(color)</sup>
! $64
! $64
| Hyper Voice Left Output
| [[Hyper Voice#Hyper Voice Output|Hyper Voice Left Output]]
| style="text-align: right" | <tt style="white-space: nowrap">ssss ssss ssss ssss</tt>
| style="text-align: right" | <tt style="white-space: nowrap">ssss ssss ssss ssss</tt>
| W16
| W16
Line 373: Line 404:
|-
|-
! $66
! $66
| Hyper Voice Right Output
| [[Hyper Voice#Hyper Voice Output|Hyper Voice Right Output]]
| style="text-align: right" | <tt style="white-space: nowrap">ssss ssss ssss ssss</tt>
| style="text-align: right" | <tt style="white-space: nowrap">ssss ssss ssss ssss</tt>
| W16
| W16
| Raw sample (s)
| Raw sample (s)
|-
! $68
| Hyper Voice Left Input
| style="text-align: right" | <tt style="white-space: nowrap">ssss ssss</tt>
| 8
| Sample (s)
|-
|-
! $69
! $69
| Hyper Voice Right Input
| [[Hyper Voice#Hyper Voice Input|Hyper Voice Right Input]]
| style="text-align: right" | <tt style="white-space: nowrap">ssss ssss</tt>
| style="text-align: right" | <tt style="white-space: nowrap">ssss ssss</tt>
| 8
| W8
| Sample (s)
| Sample (s)
|-
|-
! $6A
! $6A
| Hyper Voice Control
| [[Hyper Voice#Hyper Voice Control|Hyper Voice Control]]
| style="text-align: right" | <tt style="white-space: nowrap">.mmc .... errr ffss</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.mmc ???? errr ffss</tt>
| RW16
| RW16
| Mask (m), Channel (c), Enable (e),
| Mask (m), Channel reset (c), Enable (e),
Rate (r), Format (f), Shift (s)
Rate (r), Format (f), Shift (s)
|-
|-
Line 446: Line 471:
|
|
|-
|-
! rowspan="21" | [[Sound]]
! rowspan="22" | [[Sound]]
! $80
! $80
| [[Sound#Sound Channel Frequency|Sound Channel 1 Frequency]]
| [[Sound#Sound Channel Frequency|Sound Channel 1 Frequency]]
Line 551: Line 576:
| Left Half (l), Full (L)
| Left Half (l), Full (L)
Right Half (r), Full (R)
Right Half (r), Full (R)
|-
! $95
| [[Sound#Sound Test|Sound Test]]
| style="text-align: right" | <tt style="white-space: nowrap">425? ???h</tt>
| RW8
|
|-
|-
! $96
! $96
| Sound Channel Output Right
| [[Sound#Sound Channel Output Right|Sound Channel Output Right]]
| style="text-align: right" | <tt style="white-space: nowrap">.... ..ss ssss ssss</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.... ..ss ssss ssss</tt>
| R16
| R16
Line 559: Line 590:
|-
|-
! $98
! $98
| Sound Channel Output Left
| [[Sound#Sound Channel Output Left|Sound Channel Output Left]]
| style="text-align: right" | <tt style="white-space: nowrap">.... ..ss ssss ssss</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.... ..ss ssss ssss</tt>
| R16
| R16
Line 565: Line 596:
|-
|-
! $9A
! $9A
| Sound Channel Output Sum
| [[Sound#Sound Channel Output Sum|Sound Channel Output Sum]]
| style="text-align: right" | <tt style="white-space: nowrap">.... .sss ssss ssss</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.... .sss ssss ssss</tt>
| R16
| R16
Line 571: Line 602:
|-
|-
! $9E
! $9E
| Sound Speaker Master Volume<sup>(color)</sup>
| [[Sound#Sound Speaker Main Volume|Sound Speaker Main Volume]]<sup>(color)</sup>
| style="text-align: right" | <tt style="white-space: nowrap">.... ..vv</tt>
| style="text-align: right" | <tt style="white-space: nowrap">.... ..vv</tt>
| R8
| RW8
| ?
| Main volume (v)
|-
|-
! System
! [[SoC]]
! $A0
! $A0
| System Control
| [[SoC#System Control|System Control]]
| style="text-align: right" | <tt style="white-space: nowrap">t??? swcl</tt>
| style="text-align: right" | <tt style="white-space: nowrap">C??? swcl</tt>
| RW8
| RW8
| Test OK (t), ROM speed (s), ROM width (w),
| Cartridge OK (C), ROM wait state (s), ROM width (w),
Color system (c), Boot ROM lockout (l)
Color system (c), Boot ROM lockout (l)
|-
|-
Line 616: Line 647:
| Ticks (t)
| Ticks (t)
|-
|-
! [[Interrupts]]
! ?
! $B0
! $AC
| [[Interrupts#Interrupt Vector|Interrupt Vector]]
| ?
| style="text-align: right" | <tt style="white-space: nowrap">.... ...p</tt>
| W8?
| Power off (p)
|-
! rowspan="2" | [[Interrupts]]
! rowspan="2" | $B0
| [[Interrupts#Interrupt Vector Offset|Interrupt Vector Offset]]
| style="text-align: right" | <tt style="white-space: nowrap">VVVV V...</tt>
| style="text-align: right" | <tt style="white-space: nowrap">VVVV V...</tt>
| RW8
| W8
| Vector offset (v)
| Vector offset (V)
|-
| [[Interrupts#Interrupt Vector Request|Interrupt Vector Request]]
| style="text-align: right" | <tt style="white-space: nowrap">vvvv vvvv</tt>
| R8
| Requested vector offset (v)
|-
|-
! rowspan="2" | [[UART]]
! rowspan="2" | [[UART]]
Line 639: Line 682:
! $B2
! $B2
| [[Interrupts#Interrupt Enable|Interrupt Enable]]
| [[Interrupts#Interrupt Enable|Interrupt Enable]]
| iiii iiii
| style="text-align: right" | <tt style="white-space: nowrap">iiii iiii</tt>
| RW8
| RW8
| Interrupt index (i)
| Interrupt index (i)
Line 660: Line 703:
! $B4
! $B4
| [[Interrupts#Interrupt Status|Interrupt Status]]
| [[Interrupts#Interrupt Status|Interrupt Status]]
| iiii iiii
| style="text-align: right" | <tt style="white-space: nowrap">iiii iiii</tt>
| R8
| R8
| Interrupt index (i)
| Interrupt index (i)
Line 674: Line 717:
! $B6
! $B6
| [[Interrupts#Interrupt Acknowledge|Interrupt Acknowledge]]
| [[Interrupts#Interrupt Acknowledge|Interrupt Acknowledge]]
| iiii iiii
| style="text-align: right" | <tt style="white-space: nowrap">iiii iiii</tt>
| R8?
| W8
| Interrupt index (i)
| Interrupt index (i)
|-
|-
Line 709: Line 752:
|-
|-
! [[Mapper|Cartridge]]
! [[Mapper|Cartridge]]
! $C0<br />
! $C0<br />...<br />
$FF
$FF
| Cartridge I/O
| Cartridge I/O
|
|
|
| RW8
| Forwarded by the SoC
| Forwarded by the SoC
|}
|}
== I/O port routing ==
The [[NEC V30MZ]] supports 16-bit I/O port addresses. The WonderSwan SoC routes them using the following algorithm:
* If an address is between <code>$00B8</code> and <code>$00BF</code> inclusive, it is routed to the internal EEPROM control block.
* If an address is between <code>$00C0</code> and <code>$00FF</code> inclusive, it is routed to the cartride bus.
* If an address's bits <code>0</code> through <code>8</code> inclusive are between <code>$000</code> and <code>$0B7</code> inclusive, they are routed to the SoC block.
* If none of these conditions are reached, open bus is read.
On the monochrome models, as well as color models in mono emulation, open bus is always <code>0x90</code>.

Latest revision as of 20:13, 23 February 2025

The WonderSwan SoC has three general blocks of I/O port accesses:

From To Holder Width Speed
$00 $B7 WonderSwan SoC 16-bit 1 cycle
$B8 $BF Internal EEPROM control 16-bit 1 cycle
$C0 $FF Cartridge bus 8-bit 1(color)/2 cycles (configurable)

With the exception of internal EEPROM on the ASWAN, all unaligned 16-bit accesses can be converted to two 8-bit accesses with a 1-cycle penalty.

I/O port map

  • Superscripts are used to mark ports specific to a given mode or platform:
    • Color mode: (color). Such ports are only accessible when color mode is enabled through port $60.
    • WS/WSC/SC console: (WS), (WSC), (SC).
  • If two Bits rows are provided, the second one refers to the "Color" mode.
  • The Type can be: R - readable, W - writable, L - writable before boot ROM lockout, 8/16 - width (byte/word).
Category Port Description Bits Type Notes
Display $00 Display Control ..wo Ws21 RW8
$01 Display Background .... .sss

pppp iiii

RW8 Shade (s)

Palette (p), Index (i)

$02 Display Current Line llll llll R8 Line (l)
$03 Display Interrupt Line llll llll RW8 Line (l)
$04 Sprite Table Address ...a aaaa

..aa aaaa

RW8 Address >> 9 (a)
$05 Sprite Table First .iii iiii RW8 Index (i)
$06 Sprite Table Count cccc cccc RW8 Count (c)
$07 Screen Address .222 .111

2222 1111

RW8 Screen 1 address >> 11 (1)

Screen 2 address >> 11 (2)

$08 Screen 2 Window Left xxxx xxxx RW8 Coordinate (x)
$09 Screen 2 Window Top yyyy yyyy RW8 Coordinate (y)
$0A Screen 2 Window Right xxxx xxxx RW8 Coordinate (x)
$0B Screen 2 Window Bottom yyyy yyyy RW8 Coordinate (y)
$0C Sprite Window Left xxxx xxxx RW8 Coordinate (x)
$0D Sprite Window Top yyyy yyyy RW8 Coordinate (y)
$0E Sprite Window Right xxxx xxxx RW8 Coordinate (x)
$0F Sprite Window Bottom yyyy yyyy RW8 Coordinate (y)
$10 Screen 1 Scroll X xxxx xxxx RW8 Coordinate (x)
$11 Screen 1 Scroll Y yyyy yyyy RW8 Coordinate (y)
$12 Screen 2 Scroll X xxxx xxxx RW8 Coordinate (x)
$13 Screen 2 Scroll Y yyyy yyyy RW8 Coordinate (y)
$14 LCD Control .... ..Ce RW8 Contrast (C)(WSC), Enable (e)
$15 LCD Icon Control ..32 1hvs RW8 Etc. 3 (3), Etc. 2 (2), Etc. 1 (1),

Horizontal (h), Vertical (v), Sleep (s)

$16 LCD Final Line llll llll RW8 Line (l)
$17 LCD Back Porch Line(WSC) llll llll RW8 Line (l)
$18 LCD Line Counter llll llll W8 Line (l)
$1A LCD Latched Icon Status ..cv vvhs R8 Cartridge icon (c), Volume icons (v),

Headphone icon (h), Latch override (l)

$1A LCD Latched Icon Control ..cv vvhs W8 Cartridge (c), Sound (s), Latch override (l)
$1C LCD Mono Shade LUT 0/1 1111 0000 RW8 Shade index
$1D LCD Mono Shade LUT 2/3 3333 2222 RW8 Shade index
$1E LCD Mono Shade LUT 4/5 5555 4444 RW8 Shade index
$1F LCD Mono Shade LUT 6/7 7777 6666 RW8 Shade index
$20 LCD Mono Palette 0 .333 .222 .111 .000 RW16 Shade LUT index
$22 LCD Mono Palette 1 .333 .222 .111 .000 RW16 Shade LUT index
$24 LCD Mono Palette 2 .333 .222 .111 .000 RW16 Shade LUT index
$26 LCD Mono Palette 3 .333 .222 .111 .000 RW16 Shade LUT index
$28 LCD Mono Palette 4 .333 .222 .111 .000 RW16 Shade LUT index
$2A LCD Mono Palette 5 .333 .222 .111 .000 RW16 Shade LUT index
$2C LCD Mono Palette 6 .333 .222 .111 .000 RW16 Shade LUT index
$2E LCD Mono Palette 7 .333 .222 .111 .000 RW16 Shade LUT index
$30 LCD Mono Palette 8 .333 .222 .111 .000 RW16 Shade LUT index
$32 LCD Mono Palette 9 .333 .222 .111 .000 RW16 Shade LUT index
$34 LCD Mono Palette 10 .333 .222 .111 .000 RW16 Shade LUT index
$36 LCD Mono Palette 11 .333 .222 .111 .000 RW16 Shade LUT index
$38 LCD Mono Palette 12 .333 .222 .111 .000 RW16 Shade LUT index
$3A LCD Mono Palette 13 .333 .222 .111 .000 RW16 Shade LUT index
$3C LCD Mono Palette 14 .333 .222 .111 .000 RW16 Shade LUT index
$3E LCD Mono Palette 15 .333 .222 .111 .000 RW16 Shade LUT index
DMA(color) $40 GDMA Source Address Low llll llll llll lll. RW16 Linear address, low 16 bits (l)
$42 GDMA Source Address High .... hhhh RW8 Linear address, high 4 bits (h)
$44 GDMA Destination Address aaaa aaaa aaaa aaa. RW16 IRAM address (a)
$46 GDMA Length bbbb bbbb bbbb bbb. RW16 Bytes (b)
$48 GDMA Control ed.. .... RW8 Enable (e), Decrement (d)
$4A SDMA Source Address Low llll llll llll llll RW16 Linear address, low 16 bits (l)
$4C SDMA Source Address High .... hhhh RW8 Linear address, high 4 bits (h)
$4E SDMA Length Low llll llll llll llll RW16 Length, low 16 bits (l)
$50 SDMA Length High .... hhhh RW8 Length, high 4 bits (h)
$52 SDMA Control ed.t rhff RW8 Enable (e), Decrement (d), Target (t),

Repeat (r), Hold (h), Frequency (f)

SoC(color) $60 System Control 2 c4C. i?sl RW8 Color (c), 4BPP (4), Chunky (C),

Cart I/O wait state (i), SRAM wait state (s),
Cart clock speed (l).

$62 System Control 3 S... ...p RW8 SwanCrystal (S), Power off (p)
Hyper Voice(color) $64 Hyper Voice Left Output ssss ssss ssss ssss W16 Raw sample (s)
$66 Hyper Voice Right Output ssss ssss ssss ssss W16 Raw sample (s)
$69 Hyper Voice Right Input ssss ssss W8 Sample (s)
$6A Hyper Voice Control .mmc ???? errr ffss RW16 Mask (m), Channel reset (c), Enable (e),

Rate (r), Format (f), Shift (s)

Display(SC) $70 LCD Timing Configuration 1? ???? ???? RL8
$71 LCD Timing Configuration 2? ???? ???? RL8
$72 LCD Timing Configuration 3? ???? ???? RL8
$73 LCD Timing Configuration 4? ???? ???? RL8
$74 LCD Timing Configuration 5? ???? ???? RL8
$75 LCD Timing Configuration 6? ???? ???? RL8
$76 LCD Timing Configuration 7? ???? ???? RL8
$77 LCD Timing Configuration 8? ???? ???? RL8
Sound $80 Sound Channel 1 Frequency .... .ddd dddd dddd RW16 Divider (d)
$82 Sound Channel 2 Frequency .... .ddd dddd dddd RW16 Divider (d)
$84 Sound Channel 3 Frequency .... .ddd dddd dddd RW16 Divider (d)
$86 Sound Channel 4 Frequency .... .ddd dddd dddd RW16 Divider (d)
$88 Sound Channel 1 Volume llll rrrr RW8 Left (l), Right (r)
$89 Sound Channel 2 Volume llll rrrr RW8 Left (l), Right (r)
Sound Channel 2 Voice Sample ssss ssss RW8 Sample (s)
$8A Sound Channel 3 Volume llll rrrr RW8 Left (l), Right (r)
$8B Sound Channel 4 Volume llll rrrr RW8 Left (l), Right (r)
$8C Sound Channel 3 Sweep Amount vvvv vvvv RW8 Value (v)
$8D Sound Channel 3 Sweep Ticks ...t tttt RW8 Ticks (t)
$8E Sound Channel 4 Noise Control ...e rttt RW8 Enable (e), Reset (r), Tap (t)
$8F Sound Wavetable Address wwww wwww RW8 Address >> 6 (w)
$90 Sound Channel Control nsv. 4321 RW8 Channel enable (1234)

Noise (n), Sweep (s), Voice (v)

$91 Sound Output Control H... hrrs RW8 Headphones connected (H)

Headphone output (h) Speaker output (s), range (r)

$92 Sound Channel 4 LFSR Register .rrr rrrr rrrr rrrr R16 PRNG state (r)
$94 Sound Channel 2 Voice Volume .... lLrR RW8 Left Half (l), Full (L)

Right Half (r), Full (R)

$95 Sound Test 425? ???h RW8
$96 Sound Channel Output Right .... ..ss ssss ssss R16 Sample (s)
$98 Sound Channel Output Left .... ..ss ssss ssss R16 Sample (s)
$9A Sound Channel Output Sum .... .sss ssss ssss R16 Sample (s)
$9E Sound Speaker Main Volume(color) .... ..vv RW8 Main volume (v)
SoC $A0 System Control C??? swcl RW8 Cartridge OK (C), ROM wait state (s), ROM width (w),

Color system (c), Boot ROM lockout (l)

Timers $A2 Timer Control .... VvHh RW8 Horizontal enable (h), auto reload (H)

Vertical enable (v), auto reload (V)

$A4 Horizontal Blank Timer Reload tttt tttt tttt tttt RW16 Ticks (t)
$A6 Vertical Blank Timer Reload tttt tttt tttt tttt RW16 Ticks (t)
$A8 Horizontal Blank Timer Counter tttt tttt tttt tttt R16 Ticks (t)
$AA Vertical Blank Timer Counter tttt tttt tttt tttt R16 Ticks (t)
? $AC ? .... ...p W8? Power off (p)
Interrupts $B0 Interrupt Vector Offset VVVV V... W8 Vector offset (V)
Interrupt Vector Request vvvv vvvv R8 Requested vector offset (v)
UART $B1 Serial Receive Data dddd dddd R8 Receive buffer data (d)
$B1 Serial Transmit Data dddd dddd W8 Transmit buffer data (d)
Interrupts $B2 Interrupt Enable iiii iiii RW8 Interrupt index (i)
UART $B3 Serial Status eb.. .tor R8 Enable (e), Baud rate (b),

Transfer ready (t), Overrun (o), Receive ready (r)

$B3 Serial Control ebO. .... W8 Enable (e), Baud rate (b), Reset Overrun (O)
Interrupts $B4 Interrupt Status iiii iiii R8 Interrupt index (i)
Keypad $B5 Keypad Scan .iii oooo RW8 Input row (i), Output column (o)
Interrupts $B6 Interrupt Acknowledge iiii iiii W8 Interrupt index (i)
$B7 Interrupt NMI Control ...b .... RW8 Low battery (b)
Internal EEPROM $BA Internal EEPROM Data dddd dddd dddd dddd RW16 Data (d)
$BC Internal EEPROM Command RW16
$BE Internal EEPROM Status .... .... p... ..RD R16 Protected (p), Ready (R), Done (D)
Internal EEPROM Control .... .... pewr .... W16 Protect (p), Erase (e), Write (w), Read (r)
Cartridge $C0
...

$FF

Cartridge I/O RW8 Forwarded by the SoC

I/O port routing

The NEC V30MZ supports 16-bit I/O port addresses. The WonderSwan SoC routes them using the following algorithm:

  • If an address is between $00B8 and $00BF inclusive, it is routed to the internal EEPROM control block.
  • If an address is between $00C0 and $00FF inclusive, it is routed to the cartride bus.
  • If an address's bits 0 through 8 inclusive are between $000 and $0B7 inclusive, they are routed to the SoC block.
  • If none of these conditions are reached, open bus is read.

On the monochrome models, as well as color models in mono emulation, open bus is always 0x90.