Skip to content
Projet 816wiki
Contents

The register map (v0.1)

The contract between the 65816 software and the three programmable devices: what each register does. Version 0.1, still a proposal to be validated.

The common conventions

  • Each block exposes 32 8-bit registers, from $00 to $1F, repeated eight times in its 256-byte page.
  • 16- or 24-bit values store the low byte at the lowest address (suffixes _L, _M, _H). A write takes effect only when the _H byte is written; a read of _L freezes the others.
  • Register $1F (ID) gives the block’s identifier and the version of its map: 9K = 1, video = 2, Pico = 3; an expansion card is invited to return F.
  • Each block has an interrupt mask (IRQ_EN) and a status register (IRQ_STAT) that the interrupt handler reads to find the source.

The 9K, system controller ($00:9C00)

RegistersRole
SYS_CLK, SYS_STATUSPHI2 speed (values to be defined after measurement), status of the PSRAMs, the codec and start-up
IRQ_EN, IRQ_STAT, TMR_*interrupts and timer
FM_*, PSG_*access to the FM (YM2151) and PSG (AY-3-8910) sound cores, to be revised if another timbre is chosen
PCM_*, MIX_*sample channel and mixer (FM, PSG, PCM volumes)
DMA_*recording by DMA: address in PSRAM, length, format
I2C_CTRL, I2C_DATAcontrol of the audio codec, over its I²C at 1.8 V
MEM_PTR_*, MEM_DATAmemory port: read or write a PSRAM byte at a 24-bit address, with automatic advance

The video, Tang Nano 20K ($00:9D00)

RegistersRole
VADDR0_*, VINC0, VDATA0port 0: video address, step, data
VADDR1_*, VINC1, VDATA1port 1, identical
VCTRL, VMODEdisplay on, reset; mode number (list to be defined)
IRQ_EN, IRQ_STAT, IRQ_LINE_*interrupts: vertical blank, chosen line, sprite collision (if kept)
SCAN_*, BORDERline currently being displayed; border colour

The resolution, the modes, the layers and the sprites are not yet defined: they will come with a video memory map.

The Pico, input/output ($00:9E00)

RegistersRole
CMD, STATUS, ERROR, ARG0 to ARG7mailbox: arguments, command code, status and error
DATA, DATA_CNT_*data port of the current command, and number of bytes waiting
IRQ_EN, IRQ_STATend of command, keyboard, mouse, serial console, network
KBD_*, MOUSE_*, JOY0, JOY1keyboard, mouse and two gamepads, read directly
UART_DATA, UART_STATUSserial console

First commands: version, files (open, read, write, close, seek, list, delete), clock (read, set) and network status. The response time of the Pico, which works in software, is still to be measured; if it is not enough, the 9K will be able to stretch the clock during its accesses.

Loading at start-up (proposal)

During start-up, the processor is held off the bus. The Pico then takes its place on part of the bus and writes, through the 9K’s memory port, the vectors and then the boot code into the PSRAM. A start-up completion register is still to be added. The mechanism requires no extra pins; the pace of the accesses on the Pico’s side is still to be checked.

What remains to be validated

  1. The sound cores, and therefore the FM and PSG registers.
  2. The formulas for the PHI2 speed, the PCM frequency and the timer prescaler.
  3. Loading at start-up by the Pico and its completion register.
  4. The video modes, the resolution and the video memory map.
  5. The keyboard and gamepad formats, and the wiring of the DE-9 sockets.
  6. The Pico’s response time on the bus.

The complete map, register by register, is in the repository: docs/registers.md, checked by tools/check_registers.py.

Sources in the repository : docs/registers.md, docs/SPEC.md.