Skip to main content

I/O Ports

Spectranext exposes several fixed Z80 I/O ports (addresses ending in $3B). Use the usual instructions — for example ld bc, $nn3B with out (c), a and in a, (c) — with the port numbers below.

I/O ports

$003B — Page A

Write only. Chooses which 4K page is visible in memory region A. Prefer the ROM paging helpers (for example SETPAGEA) instead of raw OUT, so paging stays consistent with the rest of the system. Details: memory.

$013B — Page B

Write only. Same role as $003B, but for region B (for example SETPAGEB).

$053B — Page 0 (Spectranext only)

Write only. Chooses which 4 KiB Spectranext page is visible in section 0, at $0000$0FFF. The page number is written in A:

ld a, page_number
ld bc, $053B
out (c), a

This is a Spectranext-only extension; original Spectranet hardware has no programmable section-0 mapping. It is intended for tightly controlled environments that need to temporarily replace the Spectrum ROM view, such as the eSXDOS/DOT compatibility kernel. It is not a substitute for the normal PAGEIN/PAGEOUT and page-A/page-B APIs: mapping a page at $0000 also replaces the Spectrum ROM, interrupt vectors, and ROM entry points visible to the Z80.

The assembler symbol is PAGE0REG.

$063B — Page 3 (Spectranext only)

Write only. Chooses which 4 KiB Spectranext page is visible in section 3, at $3000$3FFF. Write the page number in A using the same pattern:

ld a, page_number
ld bc, $063B
out (c), a

This is also a Spectranext-only extension. It permits a second independent 4 KiB mapping in addition to pages A and B, and is used by the eSXDOS/DOT environment to expose the second half of a command image or a shared workspace. Be careful not to use it while code, data, or the stack still depends on the mapping it replaces. The assembler symbol is PAGE3REG.

$023B — Trap / CPLD

Read and write. Spectranet-style programmable trap address and related behaviour; reads can report hardware identity (what the CPLD reports).

$033B — Cartridge control

Read and write. Controls paging the Spectranet ROM/RAM, traps, and the register bit pattern used when detecting Spectranext.

$043B — Console I/O

Write only. Each byte you send is printed on the host console. Typical pattern: bc = $043B, then out (c), a per character. More detail: libterm and logging.

See also