Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Wire Protocols

I/O Devices describes each device’s bus-facing register behavior — what a 6502 program sees. This appendix documents the byte-level protocols four of those devices speak over an attached Transport to talk to something outside the emulator process. It’s reference material for writing a peripheral implementation (real hardware, a script, another emulator) or a replacement for one of the bundled SDL2 peripheral binaries — not needed for ordinary use of the emulator or debugger.

Two families of protocol, serving different needs:

  • Peer-communication protocols — the VIA and PTM protocols exchange GPIO/timer signal state bidirectionally with one or more connected peripherals, mirroring how a real VIA or PTM talks to the hardware wired to its pins. A newly connected peripheral receives a full state dump; every peripheral thereafter sees every state change, whether it originated on the device (a program writing a register) or from another connected peripheral.
  • External rendering protocols — the Character Display, LED Matrix, and LCD Display protocols stream composited frame data to the bundled emma65-display, emma65-led-matrix, and emma65-lcd-display SDL2 peripheral binaries (see Running the Display Peripheral, Running the LED Matrix Peripheral, and Running the LCD Display Peripheral). These only matter when running the plain emma65 CLI standalone — the debugger renders all three devices in-process and never speaks any of these protocols.
ProtocolDevice (config type)DirectionEncodingTransport requirement
VIA Peer ProtocolVIA (via/6522)bidirectionalASCII or Binary, selected by protocol=multipoint (tcp:/unix:)
PTM Peer ProtocolPTM (ptm/6840)bidirectionalASCII or Binary, selected by protocol=multipoint (tcp:/unix:)
Character Display External ProtocolCharacter Display (display)outbound frames + inbound keystrokesBinary onlyatomic send (pipe: only)
LED Matrix External ProtocolLED Matrix (display/matrix)outbound onlyBinary onlyatomic send (pipe: only)
LCD Display External ProtocolLCD Display (display/lcd)outbound onlyBinary onlyatomic send (pipe: only)

The three rendering protocols additionally require an atomic transport send — either the whole outbound message is delivered or none of it is — because all three are framed with no length prefixes or delimiters; a partial write would desync the stream with no way to resynchronize. In practice this rules out every transport but pipe:, and each device rejects any other transport spec at configuration time. The peer-communication protocols have no such requirement, since every message is short and self-delimiting.