Source: Compute's Mapping the Commodore 64; The Anatomy of the Commodore 64
| Range | Size | Description |
|---|---|---|
| $0000–$00FF | 256 B | Zero Page (fastest addressing) |
| $0100–$01FF | 256 B | CPU Stack |
| $0200–$03FF | 512 B | OS/BASIC work area (vectors, tables) |
| $0400–$07FF | 1 KB | Default screen text matrix (40×25) |
| $0800–$9FFF | 38 KB | BASIC program area (default) |
| $A000–$BFFF | 8 KB | BASIC ROM (or cartridge/RAM under) |
| $C000–$CFFF | 4 KB | Upper RAM (ML friendly) |
| $D000–$DFFF | 4 KB | I/O space (VIC-II/SID/CIA/Color RAM) |
| $E000–$FFFF | 8 KB | Kernal ROM (or RAM under) |
Labels follow COMPUTE!‘s Mapping the Commodore 64. BASIC uses $02–$8F; the Kernal uses $90–$FF. Free for ML that keeps BASIC and the Kernal running: $02 and $FB–$FE. If BASIC is not used, $03–$8F may be reused (restore CHRGET at $73–$8A before returning to BASIC).
| Address | Dec | Label | Description |
|---|---|---|---|
| $00 | 0 | D6510 | 6510 data direction register (default $2F) |
| $01 | 1 | R6510 | 6510 I/O port: bits 0-2 LORAM/HIRAM/CHAREN banking, 3-5 cassette (default $37) |
| $02 | 2 | - | Unused; free for user programs |
| $03–$04 | 3–4 | ADRAY1 | Vector: float -> signed integer ($B1AA) |
| $05–$06 | 5–6 | ADRAY2 | Vector: integer -> float ($B391) |
| $07 | 7 | CHARAC | BASIC: search character for scanning |
| $08 | 8 | ENDCHR | BASIC: scan-for-quote / end-of-statement flag |
| $09 | 9 | TRMPOS | Cursor column before last TAB/SPC |
| $0A | 10 | VERCK | BASIC: 0 = LOAD, 1 = VERIFY |
| $0B | 11 | COUNT | Input buffer index / array dimension count |
| $0C | 12 | DIMFLG | Flag: default array DIM |
| $0D | 13 | VALTYP | Data type: $FF = string, $00 = numeric |
| $0E | 14 | INTFLG | Numeric type: $80 = integer, $00 = float |
| $0F | 15 | GARBFL | DATA scan / LIST quote / garbage-collection flag |
| $10 | 16 | SUBFLG | Subscript reference / FN call flag |
| $11 | 17 | INPFLG | 0 = INPUT, $40 = GET, $98 = READ |
| $12 | 18 | TANSGN | TAN/SIN sign; comparison result |
| $13 | 19 | CHANNL | Current I/O channel (CMD logical file); 0 = default |
| $14–$15 | 20–21 | LINNUM | Integer value / target line number (GOTO, PEEK, POKE, SYS address) |
| $16 | 22 | TEMPPT | Index to next free temporary string descriptor |
| $17–$18 | 23–24 | LASTPT | Pointer to last temporary string |
| $19–$21 | 25–33 | TEMPST | Temporary string descriptor stack (3 x 3 bytes) |
| $22–$25 | 34–37 | INDEX | Miscellaneous temporary pointers |
| $26–$2A | 38–42 | RESHO | Floating-point multiply/divide product area |
| $2B–$2C | 43–44 | TXTTAB | Start of BASIC program text (default $0801) |
| $2D–$2E | 45–46 | VARTAB | Start of BASIC variables (= end of program + 1) |
| $2F–$30 | 47–48 | ARYTAB | Start of BASIC arrays |
| $31–$32 | 49–50 | STREND | End of arrays + 1 (bottom of free RAM) |
| $33–$34 | 51–52 | FRETOP | Bottom of string storage (strings grow down) |
| $35–$36 | 53–54 | FRESPC | Utility string pointer |
| $37–$38 | 55–56 | MEMSIZ | Top of BASIC memory + 1 (default $A000) |
| $39–$3A | 57–58 | CURLIN | Current BASIC line number ($FFxx = direct mode) |
| $3B–$3C | 59–60 | OLDLIN | Line number for CONT |
| $3D–$3E | 61–62 | OLDTXT | Statement pointer for CONT |
| $3F–$40 | 63–64 | DATLIN | Line number of current DATA statement |
| $41–$42 | 65–66 | DATPTR | Pointer to current DATA item |
| $43–$44 | 67–68 | INPPTR | Pointer to INPUT/GET/READ source |
| $45–$46 | 69–70 | VARNAM | Current variable name |
| $47–$48 | 71–72 | VARPNT | Pointer to current variable's value |
| $49–$4A | 73–74 | FORPNT | Pointer to FOR/NEXT index variable |
| $4B–$4C | 75–76 | OPPTR | Math operator table displacement / temp TXTPTR save |
| $4D | 77 | OPMASK | Comparison operator mask |
| $4E–$4F | 78–79 | DEFPNT | Pointer to current FN descriptor |
| $50–$52 | 80–82 | DSCPNT | Temporary string descriptor |
| $53 | 83 | FOUR6 | Garbage-collection string step size |
| $54–$56 | 84–86 | JMPER | JMP opcode + address for function dispatch |
| $57–$60 | 87–96 | - | BASIC floating-point work area (TEMPF1/TEMPF2) |
| $61–$66 | 97–102 | FAC1 | Floating-point accumulator #1: $61 exponent, $62-$65 mantissa, $66 sign |
| $67 | 103 | SGNFLG | Series evaluation term count / sign |
| $68 | 104 | BITS | FAC1 overflow digit |
| $69–$6E | 105–110 | ARG | Floating-point accumulator #2: $69 exponent, $6A-$6D mantissa, $6E sign |
| $6F | 111 | ARISGN | Sign comparison of FAC1 vs FAC2 |
| $70 | 112 | FACOV | FAC1 low-order rounding byte |
| $71–$72 | 113–114 | FBUFPT | Pointer to number-to-string buffer / series pointer |
| $73–$8A | 115–138 | CHRGET | Self-modifying get-next-BASIC-character routine (copied from ROM at reset) |
| $79 | 121 | CHRGOT | Entry inside CHRGET: re-read current character |
| $7A–$7B | 122–123 | TXTPTR | BASIC text pointer (operand of the LDA inside CHRGET) |
| $8B–$8F | 139–143 | RNDX | RND seed (5-byte float) |
| $90 | 144 | STATUS | Kernal I/O status word ST (read with READST $FFB7) |
| $91 | 145 | STKEY | STOP-key row flag ($7F = STOP pressed) |
| $92 | 146 | SVXT | Tape timing constant |
| $93 | 147 | VERCK | Kernal: 0 = LOAD, 1 = VERIFY |
| $94 | 148 | C3PO | Serial: deferred-character flag |
| $95 | 149 | BSOUR | Serial: buffered output character |
| $96 | 150 | SYNO | Tape: block sync number |
| $97 | 151 | XSAV | Temp X/Y save for BASIN/BSOUT |
| $98 | 152 | LDTND | Number of open files (index into $0259 tables) |
| $99 | 153 | DFLTN | Current input device (0 = keyboard) |
| $9A | 154 | DFLTO | Current output device (3 = screen) |
| $9B | 155 | PRTY | Tape: character parity |
| $9C | 156 | DPSW | Tape: byte-received flag |
| $9D | 157 | MSGFLG | Kernal message control (SETMSG): $80 = direct-mode msgs, $40 = errors, 0 = none |
| $9E | 158 | PTR1 | Tape pass-1 error log / temp |
| $9F | 159 | PTR2 | Tape pass-2 error log / temp |
| $A0–$A2 | 160–162 | TIME | Jiffy clock, 24-bit big-endian (TI); updated by UDTIM each IRQ |
| $A3–$A4 | 163–164 | - | Serial/tape temp (bit counter, EOI flag) |
| $A5 | 165 | CNTDN | Tape sync countdown |
| $A6 | 166 | BUFPNT | Tape buffer index |
| $A7–$AB | 167–171 | INBIT..RIPRTY | RS-232 / tape receive work bytes |
| $AC–$AD | 172–173 | SAL | Pointer: current LOAD/SAVE/screen-scroll address |
| $AE–$AF | 174–175 | EAL | Pointer: LOAD end address + 1 / SAVE end address |
| $B0–$B1 | 176–177 | CMP0 | Tape timing |
| $B2–$B3 | 178–179 | TAPE1 | Pointer to tape buffer (default $033C) |
| $B4–$B6 | 180–182 | BITTS..RODATA | RS-232 transmit work bytes |
| $B7 | 183 | FNLEN | Current filename length (SETNAM) |
| $B8 | 184 | LA | Current logical file number (SETLFS) |
| $B9 | 185 | SA | Current secondary address (SETLFS) |
| $BA | 186 | FA | Current device number (SETLFS; last-used drive, 8 = first disk) |
| $BB–$BC | 187–188 | FNADR | Pointer to current filename (SETNAM) |
| $BD | 189 | ROPRTY | RS-232 output parity / tape byte being built |
| $BE | 190 | FSBLK | Tape: blocks remaining to read/write |
| $BF | 191 | MYCH | Tape: byte being assembled |
| $C0 | 192 | CAS1 | Tape motor interlock |
| $C1–$C2 | 193–194 | STAL | LOAD/SAVE start address |
| $C3–$C4 | 195–196 | MEMUSS | LOAD destination for secondary address 0 (relocating load) |
| $C5 | 197 | LSTX | Matrix code of last key pressed ($40 = none) |
| $C6 | 198 | NDX | Number of characters in keyboard buffer ($0277) |
| $C7 | 199 | RVS | Reverse-video flag (non-zero = on) |
| $C8 | 200 | INDX | End of logical line for INPUT |
| $C9–$CA | 201–202 | LXSP | Cursor row ($C9) / column ($CA) at start of input |
| $CB | 203 | SFDX | Matrix code of current key ($40 = none) |
| $CC | 204 | BLNSW | Cursor blink enable: 0 = flash cursor |
| $CD | 205 | BLNCT | Countdown to next cursor toggle |
| $CE | 206 | GDBLN | Screen code under cursor |
| $CF | 207 | BLNON | Cursor phase: 0 = original char shown |
| $D0 | 208 | CRSW | Input from screen (non-zero) or keyboard (0) |
| $D1–$D2 | 209–210 | PNT | Pointer to start of current screen line |
| $D3 | 211 | PNTR | Cursor column on logical line (0-79) |
| $D4 | 212 | QTSW | Quote mode flag (non-zero = on) |
| $D5 | 213 | LNMX | Current logical line length (39 or 79) |
| $D6 | 214 | TBLX | Cursor physical row (0-24) |
| $D7 | 215 | - | Temp: last character output (ASCII) / checksum |
| $D8 | 216 | INSRT | Pending inserts count |
| $D9–$F2 | 217–242 | LDTB1 | Screen line link table / line-start high bytes (25 entries) |
| $F3–$F4 | 243–244 | USER | Pointer to color RAM for current line |
| $F5–$F6 | 245–246 | KEYTAB | Pointer to current keyboard decode table |
| $F7–$F8 | 247–248 | RIBUF | Pointer to RS-232 input buffer |
| $F9–$FA | 249–250 | ROBUF | Pointer to RS-232 output buffer |
| $FB–$FE | 251–254 | FREKZP | Free zero page for user programs (4 bytes) |
| $FF | 255 | BASZPT | BASIC float-to-string temp |
The 6510 stack grows downward from $01FF. SP register holds low byte of current top. Do not use this region for data storage in time-critical IRQs — pushes/pulls compete with JSR/RTS.
| Address | Label | Description |
|---|---|---|
| $0200–$0258 | BUF | BASIC/Kernal input buffer (89 bytes) |
| $0259–$0262 | LAT | Logical file number table (10 entries) |
| $0263–$026C | FAT | Device number table (10 entries) |
| $026D–$0276 | SAT | Secondary address table (10 entries) |
| $0277–$0280 | KEYD | Keyboard buffer (10 bytes) |
| $0281–$0282 | MEMSTR | Start of memory pointer ($0800 default) |
| $0283–$0284 | MEMSIZ | Top of memory ($A000 default) |
| $0285 | TIMOUT | Serial IEEE timeout flag |
| $0286 | COLOR | Current foreground color code |
| $0287 | GDCOL | Color under cursor |
| $0288 | HIBASE | Screen RAM page ($04 = $0400) |
| $0289 | XMAX | Keyboard buffer max size (10 default) |
| $028A | RPTFLG | Key repeat flag ($40=repeat all) |
| $028B | KOUNT | Repeat delay counter |
| $028C | DELAY | Repeat speed counter |
| $028D | SHFLAG | Keyboard shift flags |
| $028E | LSTSHF | Previous shift state |
| $028F–$0290 | KEYLOG | Pointer: keyboard decode logic |
| $0291 | MODE | Shift+Commodore mode (0=switch, 128=lock) |
| $0292 | AUTODN | Screen scroll enable (0=on) |
| $0293–$0294 | M51CTR | RS-232 control register (fake 6551) |
| $0295–$0296 | M51CDR | RS-232 command register |
| $0297–$0298 | M51AJB | RS-232 baud rate (non-standard) |
| $0299–$029A | RIDBE | RS-232 buffer pointers |
| $029B–$02FF | Other RS-232/cassette work areas |
| Address | Default Points To | Description |
|---|---|---|
| $0300–$0301 | $E38B | IERROR — BASIC error message vector |
| $0302–$0303 | $A483 | IMAIN — BASIC main loop vector |
| $0304–$0305 | $A57C | ICRNCH — Tokenize input line vector |
| $0306–$0307 | $A71A | IQPLOP — List a token vector |
| $0308–$0309 | $A7E4 | IGONE — Execute a statement vector |
| $030A–$030B | $AE86 | IEVAL — Evaluate expression vector |
| $030C | $0 | SAREG — .A saved on IRQ |
| $030D | $00 | SXREG — .X saved on IRQ |
| $030E | $00 | SYREG — .Y saved on IRQ |
| $030F | $00 | SPREG — SP saved on IRQ |
| $0310–$0311 | $FE43/$8B | USRPOK — USR() vector (JMP + addr) |
| $0312–$0313 | $EA31 | IRQ vector (vectored from $FFFE) |
| $0314–$0315 | $EA31 | Hardware IRQ vector (CINV) |
| $0316–$0317 | $FE66 | BRK handler vector (CBINV) |
| $0318–$0319 | $FE47 | NMI vector (NMINV) |
| $031A–$031B | $F34A | IOPEN — OPEN routine vector |
| $031C–$031D | $F291 | ICLOSE — CLOSE routine vector |
| $031E–$031F | $F20E | ICHKIN — CHKIN routine vector |
| $0320–$0321 | $F250 | ICKOUT — CKOUT routine vector |
| $0322–$0323 | $F333 | ICLRCH — CLRCH routine vector |
| $0324–$0325 | $F157 | IBASIN — BASIN/CHRIN routine vector |
| $0326–$0327 | $F1CA | IBSOUT — BSOUT/CHROUT routine vector |
| $0328–$0329 | $F6ED | ISTOP — STOP key check vector |
| $032A–$032B | $F13E | IGETIN — GETIN routine vector |
| $032C–$032D | $F32F | ICLALL — CLALL routine vector |
| $032E–$032F | $FE66 | IUSRTO — User-defined load vector |
| $0330–$0331 | $F549 | ILOAD — LOAD routine vector |
| $0332–$0333 | $F685 | ISAVE — SAVE routine vector |
| Region | Address | Notes |
|---|---|---|
| Screen Matrix | $0400–$07E7 | 1000 bytes: 40 cols × 25 rows (default) |
| Unused | $07E8–$07FF | 24 bytes free |
| Color RAM | $D800–$DBE7 | 1000 bytes, nibble per cell (low 4 bits) |
| Color unused | $DBE8–$DBFF | 24 bytes |
Screen address formula: addr = $0400 + (row × 40) + col
POKE 43,1 : POKE 44,8 resets BASIC start pointer4 KB of RAM, never overlaid by ROM. Ideal location for:
| Range | Chip | Function |
|---|---|---|
| $D000–$D3FF | VIC-II | Video Interface Controller |
| $D400–$D7FF | SID | Sound Interface Device |
| $D800–$DBFF | Color | Color RAM (nibbles) |
| $DC00–$DCFF | CIA #1 | Keyboard, joysticks, IRQ timer |
| $DD00–$DDFF | CIA #2 | Serial bus, VIC bank, NMI timer |
| $DE00–$DEFF | I/O #1 | Cartridge expansion port I/O area 1 |
| $DF00–$DFFF | I/O #2 | Cartridge expansion port I/O area 2 |
When HIRAM=0 or banking overrides I/O region, character ROM or RAM appears instead.
| Bit | Name | 0 = … | 1 = … |
|---|---|---|---|
| 0 | LORAM | BASIC ROM disabled | BASIC ROM at $A000 enabled |
| 1 | HIRAM | Kernal ROM disabled | Kernal ROM at $E000 enabled |
| 2 | CHAREN | Char ROM at $D000 | I/O at $D000 enabled |
| 3 | CASS WR | Cassette write low | Cassette write high |
| 4 | CASS SW | (read only) | Cassette sense line |
| 5 | CASS MT | Cassette motor on | Cassette motor off |
Common values:
$37 (binary 00110111) — default: BASIC+Kernal+I/O visible$36 — Kernal+I/O visible, BASIC RAM underneath$35 — I/O visible, RAM at $A000 and $E000$34 — all RAM (no ROM, no I/O)$33 — BASIC + Kernal ROM, character ROM at $D000 instead of I/OBASIC ROM is visible only when LORAM and HIRAM are both 1; with both 0, $D000 is RAM regardless of CHAREN.
| Address | Label | Function |
|---|---|---|
| $E003 | — | Kernal version/signature bytes |
| $EA31 | IRQRTL | Standard IRQ handler entry |
| $E544 | PLOT | Read/set cursor position |
| $E566 | IOBASE | Return CIA base address in .XY |
| $FF81 | SCINIT | Initialize VIC/screen editor |
| $FF84 | IOINIT | Initialize CIA chips |
| $FF87 | RAMTAS | RAM test and zero page init |
| $FF8A | RESTOR | Restore default vectors |
| $FF8D | VECTOR | Read/set system vectors |
| $FF90 | SETMSG | Set Kernal message flag |
| $FF93 | SECOND | Send secondary address after LISTEN |
| $FF96 | TKSA | Send secondary address after TALK |
| $FF99 | MEMTOP | Read/set top of memory |
| $FF9C | MEMBOT | Read/set bottom of memory |
| $FF9F | SCNKEY | Scan keyboard |
| $FFA2 | SETTMO | Set serial bus timeout |
| $FFA5 | ACPTR | Receive byte from serial bus |
| $FFA8 | CIOUT | Send byte to serial bus |
| $FFAB | UNTLK | Command device to UNTALK |
| $FFAE | UNLSN | Command device to UNLISTEN |
| $FFB1 | LISTEN | Command device to LISTEN |
| $FFB4 | TALK | Command device to TALK |
| $FFB7 | READST | Read I/O status word |
| $FFBA | SETLFS | Set logical/device/secondary address |
| $FFBD | SETNAM | Set filename address and length |
| $FFC0 | OPEN | Open logical file |
| $FFC3 | CLOSE | Close logical file |
| $FFC6 | CHKIN | Set input channel |
| $FFC9 | CKOUT | Set output channel |
| $FFCC | CLRCH | Restore default I/O channels |
| $FFCF | CHRIN | Input character from current channel |
| $FFD2 | CHROUT | Output character to current channel |
| $FFD5 | LOAD | Load file from device |
| $FFD8 | SAVE | Save file to device |
| $FFDB | SETTIM | Set jiffy clock |
| $FFDE | RDTIM | Read jiffy clock |
| $FFE1 | STOP | Check STOP key |
| $FFE4 | GETIN | Get character from keyboard buffer |
| $FFE7 | CLALL | Close all channels and files |
| $FFEA | UDTIM | Increment jiffy clock |
| $FFED | SCREEN | Return screen dimensions |
| $FFF0 | PLOT | Read/set cursor X/Y position |
| $FFF3 | IOBASE | Return I/O base address |
| $FFFA | — | NMI vector (points into Kernal) |
| $FFFC | — | RESET vector ($FCE2) |
| $FFFE | — | IRQ/BRK vector ($FF48) |
| Bits 0–1 | VIC Bank | Address Range |
|---|---|---|
| 11 | 0 | $0000–$3FFF |
| 10 | 1 | $4000–$7FFF |
| 01 | 2 | $8000–$BFFF |
| 00 | 3 | $C000–$FFFF |
Default: Bank 0 ($0000–$3FFF) — screen at $0400, charset at $1000 (ROM image).
Character ROM is mirrored into VIC banks 0 and 2 at offsets $1000 and $1800.
Each sprite = 64 bytes (63 data + 1 padding). Pointer bytes stored at screen RAM + $03F8 (8 bytes).
| Pointer Value | Sprite Data Address (Bank 0) |
|---|---|
| $0D | $0340 |
| $0E | $0380 |
| $0F | $03C0 |
| $80 | $2000 |
| $81 | $2040 |
| … | … |
sprite_addr = bank_base + (pointer_value × 64)
Powered by TurnKey Linux.