The task involves CIA chips, keyboard scanning, joysticks, timers, real-time clock, serial bus, disk/printer handshaking, RS-232, or user port I/O.
| Chip | Decimal | Hex | Common role |
|---|---|---|---|
| CIA #1 | 56320 | $DC00 |
Keyboard matrix, joystick ports, timers, TOD, IRQ |
| CIA #2 | 56576 | $DD00 |
Serial bus, RS-232/user port, VIC bank select, NMI |
Each CIA exposes 16 registers mirrored across its 256-byte block.
| Offset | Purpose |
|---|---|
| 0 | Port A data |
| 1 | Port B data |
| 2 | Port A data direction |
| 3 | Port B data direction |
| 4-5 | Timer A latch/counter low/high |
| 6-7 | Timer B latch/counter low/high |
| 8-11 | Time-of-day clock |
| 12 | Serial data register |
| 13 | Interrupt control/status |
| 14 | Control register A |
| 15 | Control register B |
Joystick values are active low.
$DC00 / 56320.$DC01 / 56321.Typical bits:
| Bit | Mask | Direction/button |
|---|---|---|
| 0 | 1 | Up |
| 1 | 2 | Down |
| 2 | 4 | Left |
| 3 | 8 | Right |
| 4 | 16 | Fire |
Pressed means bit is 0.
BASIC example:
10 J=PEEK(56320)
20 IF (J AND 16)=0 THEN PRINT "FIRE"
SETLFS, SETNAM, OPEN, CHRIN, CHROUT, CLOSE) unless bit-banging is the task.Powered by TurnKey Linux.