# I/O map and memory Source: SX1 chapter 0 ("I/O マップ", printed pp. 12-28), read in the Internet Archive's OCR text (`reference/docs/shiken-ni-deru-x1.djvu.txt`); the OCR is rough, so every entry below is to be checked against the scan's page before it becomes a constant (the scan's SHA-1 is in `scripts/pinned_files.json`). Port numbers are 16-bit; `*` is an undecoded nibble. ## Memory space - 64 KB of RAM fills the whole memory space (SX1 ch. 0). - **IPL ROM switch** (SX1 p. 20): any `OUT` to 1D**h switches the IPL ROM in, any `OUT` to 1E**h switches it out; the data byte is ignored. With the ROM in, **reads** of 0000h-7FFFh come from the ROM and **writes** go to the RAM underneath ("shadow RAM"), so the code doing the switch must run from 8000h or above. The X1's IPL ROM is 4 KB, the turbo's 32 KB (MAME `-listroms`, OBSERVED), so the X1 repeats or leaves open the rest of the 32 KB window: U2. Reset turns the ROM in (the IPL runs from 0000h: SX1 p. 20). - The turbo adds memory banking through the 1FD0h register and the DMA (SX1 ch. 0, ch. 8); later rows. ## I/O space (X1 base unless marked) | Port | R/W | Device | Notes (SX1 page) | | --- | --- | --- | --- | | 0700h, 0701h | W, R/W | YM2151 address, data (CZ-8BS1 board; turbo Z built in) | p. 13; 0704h-0707h the board's CTC; on the turbo Z 0704h is a data latch, no CTC | | 0E80h-0E82h | R/W | kanji ROM (X1 with the kanji board; built into the turbo) | ch. 3 | | 0FE8h-0FEFh | R/W | 8-inch floppy (turbo/Z, unused by Sharp's software as of 1987) | p. 13 | | 0FF8h-0FFBh | R/W | MB8877A status/command, track, sector, data | p. 14 | | 0FFCh | W | drive select (bits 1-0), side (bit 4), motor (bit 7) | p. 14 | | 0FFDh-0FFFh | R | FM/MFM, 2HD (1.6 MB) and 2D/2DD (500 KB/1 MB) selects (turbo) | p. 14 | | 10**h, 11**h, 12**h | W | palette: three planes of 8 bits (B, R, G); a column of three bits gives a colour code; reset values AAh, CCh, F0h; **reading changes the palette** | p. 15 | | 13**h | W | text/graphics priority per colour code | p. 15 | | 14**h | R | CG ROM (character generator) | p. 15 | | 15**h, 16**h, 17**h | R/W | PCG BLUE, RED, GREEN | p. 15; turbo fast mode with the low nibble as the row (1FD0h bit 5) | | 1800h, 1801h | W | HD46505 register select (0-17), data | p. 76 (ch. 1) | | 1900h | R/W | sub-CPU (80C49) data port: the only one of its 8255-like interface the Z80 reaches | pp. 16-17 | | 1A00h-1A03h | R/W | 8255② ports A, B, C, control | pp. 17-19; port A printer data; port B status (bit 6: sub-CPU busy/ready handshake, SX1 ch. 4; bit 4 noted with the IPL switch); port C outputs (1A02h bit 6: 40/80 columns; bit 4: superimpose scroll) | | 1B**h | R/W | AY-3-8910 data | p. 20 | | 1C**h | W | AY-3-8910 register select | p. 20; joysticks through PSG ports R14/R15, active low | | 1D**h, 1E**h | W | IPL ROM in, out | p. 20 | | 1F8*h | R/W | Z80 DMA (turbo) | p. 21 (ch. 8) | | 1F90h-1F93h | R/W | Z80 SIO (turbo): channel A RS-232C, channel B mouse | p. 21 (ch. 6-7) | | 1F98h-1F9Bh | R/W | a second CTC (option) | p. 21 | | 1FA0h-1FA3h | R/W | CTC channels 0-3 | p. 21; UM880 §3.5.1 gives the same four ports | | 1FA8h-1FABh | R/W | the CTC on the FM board (as the board maps it) | p. 21 | | 1FB9h-1FBFh, 1FC0h-1FC5h | W | turbo Z text palette, priority, chroma key, scroll, multicolour palette | p. 22-25 | | 1FD0h | R/W | turbo mode register (graphics bank, PCG fast access, kanji, 400-line) | p. 26 and ch. 1-3 | | 1FE0h | W | black control (turbo) | p. 26 | | 1FF0h | R | start-up (DIP switch) port (turbo) | p. 26 | | 2000h-27FFh | R/W | text attributes: the OCR names blink, CG/PCG select, double height and double width in the upper bits; the colour (and reverse) fields in the lower bits are read from the scan before use (HYPOTHESIS until then) | p. 27 | | 3000h-37FFh | R/W | text VRAM (character codes; on the turbo also the kanji ROM's low address) | p. 27 | | 4000h-FFFFh | R/W | graphics VRAM: BLUE at 4000h-7FFFh (the address formula on p. 28); RED and GREEN follow at 8000h and C000h (U4: confirm from SX1 ch. 2) | p. 28 | Simultaneous-write mode for the three graphics planes is selected through 1A02h (SX1 p. 28), and the turbo's 400-line mode interleaves banks 0 and 1 by line (p. 28). ## Unknowns raised here - U2 The 4 KB IPL's image across the 32 KB ROM window. - U4 The RED and GREEN plane bases and the simultaneous-write rule. - U5 Open-bus reads: what an undecoded I/O port returns (MAME's first 2 ms of the `x1` run show 255 reads of port 4000h returning 00h, every 8.75 µs, before the IPL's first `OUT`: OBSERVED, cause not known; probably a delay loop reading VRAM).