6510: The C64's Custom Core
A 6502 with an I/O trick up its sleeve
The MOS 6510 added an integrated I/O port to the 6502, giving the Commodore 64 its signature memory banking and tape control.
Overview
The MOS 6510 is essentially a 6502 with an integrated 6-bit I/O port at addresses $00 and $01. This seemingly minor addition gave the Commodore 64 its flexible memory mapping, allowing programmers to swap ROM in and out of the address space and control the datasette.
Fast facts
- Clock speed: 0.985 MHz (PAL) / 1.023 MHz (NTSC).
- Compatibility: 100% instruction-compatible with 6502.
- I/O port: 6 bits at $00 (data direction) and $01 (data).
- Pin count: 40-pin DIP package.
The I/O port
The magic lives at two special addresses:
| Address | Function |
|---|---|
| $00 | Data Direction Register (DDR) - 1=output, 0=input |
| $01 | Port data - controls memory mapping and tape |
Port bit assignments
| Bit | Function |
|---|---|
| 0 | LORAM - BASIC ROM visibility |
| 1 | HIRAM - KERNAL ROM visibility |
| 2 | CHAREN - Character ROM / I/O visibility |
| 3 | Cassette write line |
| 4 | Cassette sense (input) |
| 5 | Cassette motor control |
Memory banking
By manipulating bits 0-2 of $01, programmers can:
- Hide BASIC ROM: gain 8KB at $A000-$BFFF for machine code.
- Hide KERNAL ROM: gain 8KB at $E000-$FFFF (requires custom IRQ handling).
- Access character ROM: read font data at $D000-$DFFF instead of I/O.
- Full 64KB RAM: set all three bits low for complete RAM access.
Common configurations
| $01 value | Configuration |
|---|---|
| $37 | Default: BASIC + KERNAL + I/O visible |
| $36 | BASIC hidden, KERNAL + I/O visible |
| $35 | BASIC + KERNAL hidden, I/O visible |
| $34 | All ROM hidden, I/O visible |
| $30 | All RAM visible (64KB) |
Why it matters
The 6510โs I/O port let the C64 punch above its weight. Games could claim the full 64KB while still using ROM routines when convenient. This flexibility, combined with the VIC-II and SID, made the C64 the dominant gaming platform of the 8-bit era.