Commodore 64 memory map

Address Hex
Address Dec
Description
$0000-$00FF, 0-256
Zero page
$0000
0
Processor port data direction register. Bits: Default: $2F, %00101111.
$0001
1
Processor port. Bits: Default: $37, %00110111.
$0002
2
Unused.
$0003-$0004
3-4
Unused.
Default: $B1AA, execution address of routine converting floating point to integer.
$0005-$0006
5-6
Unused.
Default: $B391, execution address of routine converting integer to floating point.
$0007
7
Byte being search for during various operations.
Current digit of number being input.
Low byte of first integer operand during AND and OR.
Low byte of integer-format FAC during INT().
$0008
8
Byte being search for during various operations.
Current byte of BASIC line during tokenization.
High byte of first integer operand during AND and OR.
$0009
9
Current column number during SPC() and TAB().
$000A
10
LOAD/VERIFY switch. Values:
$000B
11
Current token during tokenization.
Length of BASIC line during insertion of line.
AND/OR switch; $00 = AND; $FF = OR.
Number of dimensions during array operations.
$000C
12
Switch for array operations. Values:
$000D
13
Current expression type. Values:
$000E
14
Current numerical expression type. Bits:
$000F
15
Quotation mode switch during tokenization; Bit #6: 0 = Normal mode; 1 = Quotation mode.
Quotation mode switch during LIST; $01 = Normal mode; $FE = Quotation mode.
Garbage collection indicator during memory allocation for string variable; $00-$7F = There was no garbage collection yet; $80 = Garbage collection already took place.
$0010
16
Switch during fetch of variable name. Values:
$0011
17
GET/INPUT/READ switch. Values:
$0012
18
Sign during SIN() and TAN(). Values:
$0013
19
Current I/O device number.
Default: $00, keyboard for input and screen for output.
$0014-$0015
20-21
Line number during GOSUB, GOTO and RUN.
Second line number during LIST.
Memory address during PEEK, POKE, SYS and WAIT.
$0016
22
Pointer to next expression in string stack. Values: $19; $1C; $1F; $22.
Default: $19.
$0017-$0018
23-24
Pointer to previous expression in string stack.
$0019-$0021
25-33
String stack, temporary area for processing string expressions (9 bytes, 3 entries).
$0022-$0025
34-37
Temporary area for various operations (4 bytes).
$0026-$0029
38-41
Auxiliary arithmetical register for division and multiplication (4 bytes).
$002A
42
Unused.
$002B-$002C
43-44
Pointer to beginning of BASIC area.
Default: $0801, 2049.
$002D-$002E
45-46
Pointer to beginning of variable area. (End of program plus 1.)
$002F-$0030
47-48
Pointer to beginning of array variable area.
$0031-$0032
49-50
Pointer to end of array variable area.
$0033-$0034
51-52
Pointer to beginning of string variable area. (Grows downwards from end of BASIC area.)
$0035-$0036
53-54
Pointer to memory allocated for current string variable.
$0037-$0038
55-56
Pointer to end of BASIC area.
Default: $A000, 40960.
$0039-$003A
57-58
Current BASIC line number. Values:
$003B-$003C
59-60
Current BASIC line number for CONT.
$003D-$003E
61-62
Pointer to next BASIC instruction for CONT. Values:
$003F-$0040
63-64
BASIC line number of current DATA item for READ.
$0041-$0042
65-66
Pointer to next DATA item for READ.
$0043-$0044
67-68
Pointer to input result during GET, INPUT and READ.
$0045-$0046
69-70
Name and type of current variable. Bits:
$0047-$0048
71-72
Pointer to value of current variable or FN function.
$0049-$004A
73-74
Pointer to value of current variable during LET.
Value of second and third parameter during WAIT.
Logical number and device number during OPEN.
$0049, 73: Logical number of CLOSE.
Device number of LOAD, SAVE and VERIFY.
$004B-$004C
75-76
Temporary area for saving original pointer to current BASIC instruction during GET, INPUT and READ.
$004D
77
Comparison operator indicator. Bits:
$004E-$004F
78-79
Pointer to current FN function.
$0050-$0051
80-81
Pointer to current string variable during memory allocation.
$0052
82
Unused.
$0053
83
Step size of garbage collection. Values: $03; $07.
$0054-$0056
84-86
JMP ABS machine instruction, jump to current BASIC function.
$0055-$0056, 85-86: Execution address of current BASIC function.
$0057-$005B
87-91
Arithmetic register #3 (5 bytes).
$005C-$0060
92-96
Arithmetic register #4 (5 bytes).
$0061-$0065
97-101
FAC, arithmetic register #1 (5 bytes).
$0066
102
Sign of FAC. Bits:
$0067
103
Number of degrees during polynomial evaluation.
$0068
104
Temporary area for various operations.
$0069-$006D
105-109
ARG, arithmetic register #2 (5 bytes).
$006E
110
Sign of ARG. Bits:
$006F-$0070
111-112
Pointer to first string expression during string comparison.
$0071-$0072
113-114
Auxiliary pointer during array operations.
Temporary area for saving original pointer to current BASIC instruction during VAL().
Pointer to current item of polynomial table during polynomial evaluation.
$0073-$008A
115-138
CHRGET. Machine code routine to read next byte from BASIC program or direct command (24 bytes).
$0079, 121: CHRGOT. Read current byte from BASIC program or direct command.
$007A-$007B, 122-123: Pointer to current byte in BASIC program or direct command.
$008B-$008F
139-143
Previous result of RND().
$0090
144
Value of ST variable, device status for serial bus and datasette input/output. Serial bus bits: Datasette bits:
$0091
145
Stop key indicator. Values:
$0092
146
Unknown. (Timing constant during datasette input.)
$0093
147
LOAD/VERIFY switch. Values:
$0094
148
Serial bus output cache status. Bits:
$0095
149
Serial bus output cache, previous byte to be sent to serial bus.
$0096
150
Unknown. (End of tape indicator during datasette input/output.)
$0097
151
Temporary area for saving original value of Y register during input from RS232.
Temporary area for saving original value of X register during input from datasette.
$0098
152
Number of files currently open. Values: $00-$0A, 0-10.
$0099
153
Current input device number.
Default: $00, keyboard.
$009A
154
Current output device number.
Default: $03, screen.
$009B
155
Unknown. (Parity bit during datasette input/output.)
$009C
156
Unknown. (Byte ready indicator during datasette input/output.)
$009D
157
System error display switch. Bits:
$009E
158
Byte to be put into output buffer during RS232 and datasette output.
Block header type during datasette input/output.
Length of file name during datasette input/output.
Error counter during LOAD from datasette. Values: $00-$3E, 0-62.
$009F
159
Auxiliary counter for writing file name into datasette buffer.
Auxiliary counter for comparing requested file name with file name read from datasette during datasette input.
Error correction counter during LOAD from datasette. Values: $00-$3E, 0-62.
$00A0-$00A2
160-162
Value of TI variable, time of day, increased by 1 every 1/60 second (on PAL machines). Values: $000000-$4F19FF, 0-518399 (on PAL machines).
$00A3
163
EOI switch during serial bus output. Bits: Bit counter during datasette output.
$00A4
164
Byte buffer during serial bus input.
Parity during datasette input/output.
$00A5
165
Bit counter during serial bus input/output.
Counter for sync mark during datasette output.
$00A6
166
Offset of current byte in datasette buffer.
$00A7
167
Bit buffer during RS232 input.
$00A8
168
Bit counter during RS232 input.
$00A9
169
Stop bit switch during RS232 input. Values:
$00AA
170
Byte buffer during RS232 input.
$00AB
171
Parity during RS232 input.
Computed block checksum during datasette input.
$00AC-$00AD
172-173
Start address for SAVE to serial bus.
Pointer to current byte during SAVE to serial bus or datasette.
Pointer to line in screen memory to be scrolled during scrolling the screen.
$00AE-$00AF
174-175
Load address read from input file and pointer to current byte during LOAD/VERIFY from serial bus.
End address after LOAD/VERIFY from serial bus or datasette.
End address for SAVE to serial bus or datasette.
Pointer to line in Color RAM to be scrolled during scrolling the screen.
$00B0-$00B1
176-177
Unknown.
$00B2-$00B3
178-179
Pointer to datasette buffer.
Default: $033C, 828.
$00B4
180
Bit counter and stop bit switch during RS232 output. Bits: Bit counter during datasette input/output.
$00B5
181
Bit buffer (in bit #2) during RS232 output.
$00B6
182
Byte buffer during RS232 output.
$00B7
183
Length of file name or disk command; first parameter of LOAD, SAVE and VERIFY or fourth parameter of OPEN. Values:
$00B8
184
Logical number of current file.
$00B9
185
Secondary address of current file.
$00BA
186
Device number of current file.
$00BB-$00BC
187-188
Pointer to current file name or disk command; first parameter of LOAD, SAVE and VERIFY or fourth parameter of OPEN.
$00BD
189
Parity during RS232 output.
Byte buffer during datasette input/output.
$00BE
190
Block counter during datasette input/output.
$00BF
191
Unknown.
$00C0
192
Datasette motor switch. Values:
$00C1-$00C2
193-194
Start address during SAVE to serial bus, LOAD and VERIFY from datasette and SAVE to datasette.
Pointer to current byte during memory test.
$00C3-$00C4
195-196
Start address for a secondary address of 0 for LOAD and VERIFY from serial bus or datasette.
Pointer to ROM table of default vectors during initialization of I/O vectors.
$00C5
197
Matrix code of key previously pressed. Values:
$00C6
198
Length of keyboard buffer. Values:
$00C7
199
Reverse mode switch. Values:
$00C8
200
Length of line minus 1 during screen input. Values: $27, 39; $4F, 79.
$00C9
201
Cursor row during screen input. Values: $00-$18, 0-24.
$00CA
202
Cursor column during screen input. Values: $00-$27, 0-39.
$00CB
203
Matrix code of key currently being pressed. Values:
$00CC
204
Cursor visibility switch. Values:
$00CD
205
Delay counter for changing cursor phase. Values:
$00CE
206
Screen code of character under cursor.
$00CF
207
Cursor phase switch. Values:
$00D0
208
End of line switch during screen input. Values:
$00D1-$00D2
209-210
Pointer to current line in screen memory.
$00D3
211
Current cursor column. Values: $00-$27, 0-39.
$00D4
212
Quotation mode switch. Values:
$00D5
213
Length of current screen line minus 1. Values: $27, 39; $4F, 79.
$00D6
214
Current cursor row. Values: $00-$18, 0-24.
$00D7
215
PETSCII code of character during screen input/output.
Bit buffer during datasette input.
Block checksum during datasette output.
$00D8
216
Number of insertions. Values:
$00D9-$00F1
217-241
High byte of pointers to each line in screen memory (25 bytes). Values:
$00F2
242
Temporary area during scrolling the screen.
$00F3-$00F4
243-244
Pointer to current line in Color RAM.
$00F5-$00F6
245-246
Pointer to current conversion table during conversion from keyboard matrix codes to PETSCII codes.
$00F7-$00F8
247-248
Pointer to RS232 input buffer. Values:
$00F9-$00FA
249-250
Pointer to RS232 output buffer. Values:
$00FB-$00FE
251-254
Unused (4 bytes).
$00FF-$010A
255-266
Buffer for conversion from floating point to string (12 bytes.)
$0100-$01FF, 256-511
Processor stack
$00FF-$010A
255-266
Buffer for conversion from floating point to string (12 bytes.)
$0100-$013D
256-317
Pointers to bytes read with error during datasette input (62 bytes, 31 entries).
$0100-$01FF
256-511
Processor stack. Also used for storing data related to FOR and GOSUB.
$0200-$02FF, 512-767
$0200-$0258
512-600
Input buffer, storage area for data read from screen (89 bytes).
$0259-$0262
601-610
Logical numbers assigned to files (10 bytes, 10 entries).
$0263-$026C
611-620
Device numbers assigned to files (10 bytes, 10 entries).
$026D-$0276
621-630
Secondary addresses assigned to files (10 bytes, 10 entries).
$0277-$0280
631-640
Keyboard buffer (10 bytes, 10 entries).
$0281-$0282
641-642
Pointer to beginning of BASIC area after memory test.
Default: $0800, 2048.
$0283-$0284
643-644
Pointer to end of BASIC area after memory test.
Default: $A000, 40960.
$0285
645
Unused. (Serial bus timeout.)
$0286
646
Current color, cursor color. Values: $00-$0F, 0-15.
$0287
647
Color of character under cursor. Values: $00-$0F, 0-15.
$0288
648
High byte of pointer to screen memory for screen input/output.
Default: $04, $0400, 1024.
$0289
649
Maximum length of keyboard buffer. Values:
$028A
650
Keyboard repeat switch. Bits:
$028B
651
Delay counter during repeat sequence, for delaying between successive repeats. Values:
$028C
652
Repeat sequence delay counter, for delaying before first repetition. Values:
$028D
653
Shift key indicator. Bits:
$028E
654
Previous value of shift key indicator. Bits:
$028F-$0290
655-656
Execution address of routine that, based on the status of shift keys, sets the pointer at memory address $00F5-$00F6 to the appropriate conversion table for converting keyboard matrix codes to PETSCII codes.
Default: $EB48.
$0291
657
Commodore-Shift switch. Bits:
$0292
658
Scroll direction switch during scrolling the screen. Values:
$0293
659
RS232 control register. Bits:
$0294
660
RS232 command register. Bits:
$0295-$0296
661-662
Default value of RS232 output timer, based on baud rate. (Must be filled with actual value before RS232 input/output if baud rate is "user specified" in RS232 control register, memory address $0293.)
$0297
663
Value of ST variable, device status for RS232 input/output. Bits:
$0298
664
RS232 byte size, number of data bits per data byte, default value for bit counters.
$0299-$029A
665-666
Default value of RS232 input timer, based on baud rate. (Calculated automatically from default value of RS232 output timer, at memory address $0295-$0296.)
$029B
667
Offset of byte received in RS232 input buffer.
$029C
668
Offset of current byte in RS232 input buffer.
$029D
669
Offset of byte to send in RS232 output buffer.
$029E
670
Offset of current byte in RS232 output buffer.
$029F-$02A0
671-672
Temporary area for saving pointer to original interrupt service routine during datasette input output. Values:
$02A1
673
Temporary area for saving original value of CIA#2 interrupt control register, at memory address $DD0D, during RS232 input/output.
$02A2
674
Temporary area for saving original value of CIA#1 timer #1 control register, at memory address $DC0E, during datasette input/output.
$02A3-$02A4
675-676
Unknown.
$02A5
677
Number of line currently being scrolled during scrolling the screen.
$02A6
678
PAL/NTSC switch, for selecting RS232 baud rate from the proper table. Values:
$02A7-$02FF
679-767
Unused (89 bytes).
$0300-$03FF, 768-1023
$0300-$0301
768-769
Execution address of warm reset, displaying optional BASIC error message and entering BASIC idle loop.
Default: $E38B.
$0302-$0303
770-771
Execution address of BASIC idle loop.
Default: $A483.
$0304-$0305
772-773
Execution address of BASIC line tokenizater routine.
Default: $A57C.
$0306-$0307
774-775
Execution address of BASIC token decoder routine.
Default: $A71A.
$0308-$0309
776-777
Execution address of BASIC instruction executor routine.
Default: $A7E4.
$030A-$030B
778-779
Execution address of routine reading next item of BASIC expression.
Default: $AE86.
$030C
780
Default value of register A for SYS.
Value of register A after SYS.
$030D
781
Default value of register X for SYS.
Value of register X after SYS.
$030E
782
Default value of register Y for SYS.
Value of register Y after SYS.
$030F
783
Default value of status register for SYS.
Value of status register after SYS.
$0310-$0312
784-786
JMP ABS machine instruction, jump to USR() function.
$0311-$0312, 785-786: Execution address of USR() function.
$0313
787
Unused.
$0314-$0315
788-789
Execution address of interrupt service routine.
Default: $EA31.
$0316-$0317
790-791
Execution address of BRK service routine.
Default: $FE66.
$0318-$0319
792-793
Execution address of non-maskable interrupt service routine.
Default: $FE47.
$031A-$031B
794-795
Execution address of OPEN, routine opening files.
Default: $F34A.
$031C-$031D
796-797
Execution address of CLOSE, routine closing files.
Default: $F291.
$031E-$031F
798-799
Execution address of CHKIN, routine defining file as default input.
Default: $F20E.
$0320-$0321
800-801
Execution address of CHKOUT, routine defining file as default output.
Default: $F250.
$0322-$0323
802-803
Execution address of CLRCHN, routine initializating input/output.
Default: $F333.
$0324-$0325
804-805
Execution address of CHRIN, data input routine, except for keyboard and RS232 input.
Default: $F157.
$0326-$0327
806-807
Execution address of CHROUT, general purpose data output routine.
Default: $F1CA.
$0328-$0329
808-809
Execution address of STOP, routine checking the status of Stop key indicator, at memory address $0091.
Default: $F6ED.
$032A-$032B
810-811
Execution address of GETIN, general purpose data input routine.
Default: $F13E.
$032C-$032D
812-813
Execution address of CLALL, routine initializing input/output and clearing all file assignment tables.
Default: $F32F.
$032E-$032F
814-815
Unused.
Default: $FE66.
$0330-$0331
816-817
Execution address of LOAD, routine loading files.
Default: $F4A5.
$0332-$0333
818-819
Execution address of SAVE, routine saving files.
Default: $F5ED.
$0334-$033B
820-827
Unused (8 bytes).
$033C-$03FB
828-1019
Datasette buffer (192 bytes).
$03FC-$03FF
1020-1023
Unused (4 bytes).
$0400-$07FF, 1024-2047
Default screen memory
$0400-$07E7
1024-2023
Default area of screen memory (1000 bytes).
$07E8-$07F7
2024-2039
Unused (16 bytes).
$07F8-$07FF
2040-2047
Default area for sprite pointers (8 bytes).
$0800-$9FFF, 2048-40959
BASIC area
$0800
2048
Unused. (Must contain a value of 0 so that the BASIC program can be RUN.)
$0801-$9FFF
2049-40959
Default BASIC area (38911 bytes).
$8000-$9FFF
32768-40959
Optional cartridge ROM (8192 bytes).
$8000-$8001, 32768-32769: Execution address of cold reset.
$8002-$8003, 32770-32771: Execution address of non-maskable interrupt service routine.
$8004-$8008, 32772-32776: Cartridge signature. If contains the uppercase PETSCII string "CBM80" ($C3,$C2,$CD,$38,$30) then the routine vectors are accepted by the KERNAL.
$A000-$BFFF, 40960-49151
BASIC ROM
$A000-$BFFF
40960-49151
BASIC ROM or RAM area (8192 bytes); depends on the value of bits #0-#2 of the processor port at memory address $0001:
$C000-$CFFF, 49152-53247
Upper RAM area
$C000-$CFFF
49152-53247
Upper RAM area (4096 bytes).
$D000-$DFFF, 53248-57343
I/O Area
$D000-$DFFF
53248-57343
I/O Area (memory mapped chip registers), Character ROM or RAM area (4096 bytes); depends on the value of bits #0-#2 of the processor port at memory address $0001:
$D000-$DFFF, 53248-57343
Character ROM
$D000-$DFFF
53248-57343
Character ROM, shape of characters (4096 bytes).
$D000-$D7FF
53248-55295
Shape of characters in uppercase/graphics character set (2048 bytes, 256 entries).
$D800-$DFFF
55295-57343
Shape of characters in lowercase/uppercase character set (2048 bytes, 256 entries).
$D000-$D3FF, 53248-54271
VIC-II; video display
$D000
53248
Sprite #0 X-coordinate (only bits #0-#7).
$D001
53249
Sprite #0 Y-coordinate.
$D002
53250
Sprite #1 X-coordinate (only bits #0-#7).
$D003
53251
Sprite #1 Y-coordinate.
$D004
53252
Sprite #2 X-coordinate (only bits #0-#7).
$D005
53253
Sprite #2 Y-coordinate.
$D006
53254
Sprite #3 X-coordinate (only bits #0-#7).
$D007
53255
Sprite #3 Y-coordinate.
$D008
53256
Sprite #4 X-coordinate (only bits #0-#7).
$D009
53257
Sprite #4 Y-coordinate.
$D00A
53258
Sprite #5 X-coordinate (only bits #0-#7).
$D00B
53259
Sprite #5 Y-coordinate.
$D00C
53260
Sprite #6 X-coordinate (only bits #0-#7).
$D00D
53261
Sprite #6 Y-coordinate.
$D00E
53262
Sprite #7 X-coordinate (only bits #0-#7).
$D00F
53263
Sprite #7 Y-coordinate.
$D010
53264
Sprite #0-#7 X-coordinates (bit #8). Bits:
$D011
53265
Screen control register #1. Bits: Default: $1B, %00011011.
$D012
53266
Read: Current raster line (bits #0-#7).
Write: Raster line to generate interrupt at (bits #0-#7).
$D013
53267
Light pen X-coordinate (bits #1-#8).
Read-only.
$D014
53268
Light pen Y-coordinate.
Read-only.
$D015
53269
Sprite enable register. Bits:
$D016
53270
Screen control register #2. Bits: Default: $C8, %11001000.
$D017
53271
Sprite double height register. Bits:
$D018
53272
Memory setup register. Bits:
$D019
53273
Interrupt status register. Read bits: Write bits:
$D01A
53274
Interrupt control register. Bits:
$D01B
53275
Sprite priority register. Bits:
$D01C
53276
Sprite multicolor mode register. Bits:
$D01D
53277
Sprite double width register. Bits:
$D01E
53278
Sprite-sprite collision register. Read bits: Write: Enable further detection of sprite-sprite collisions.
$D01F
53279
Sprite-background collision register. Read bits: Write: Enable further detection of sprite-background collisions.
$D020
53280
Border color (only bits #0-#3).
$D021
53281
Background color (only bits #0-#3).
$D022
53282
Extra background color #1 (only bits #0-#3).
$D023
53283
Extra background color #2 (only bits #0-#3).
$D024
53284
Extra background color #3 (only bits #0-#3).
$D025
53285
Sprite extra color #1 (only bits #0-#3).
$D026
53286
Sprite extra color #2 (only bits #0-#3).
$D027
53287
Sprite #0 color (only bits #0-#3).
$D028
53288
Sprite #1 color (only bits #0-#3).
$D029
53289
Sprite #2 color (only bits #0-#3).
$D02A
53290
Sprite #3 color (only bits #0-#3).
$D02B
53291
Sprite #4 color (only bits #0-#3).
$D02C
53292
Sprite #5 color (only bits #0-#3).
$D02D
53293
Sprite #6 color (only bits #0-#3).
$D02E
53294
Sprite #7 color (only bits #0-#3).
$D02F-$D03F
53295-53311
Unusable (17 bytes).
$D040-$D3FF
53312-54271
VIC-II register images (repeated every $40, 64 bytes).
$D400-$D7FF, 54272-55295
SID; audio
$D400-$D401
54272-54273
Voice #1 frequency.
Write-only.
$D402-$D403
54274-54275
Voice #1 pulse width.
Write-only.
$D404
54276
Voice #1 control register. Bits: Write-only.
$D405
54277
Voice #1 Attack and Decay length. Bits: Write-only.
$D406
54278
Voice #1 Sustain volume and Release length. Bits: Write-only.
$D407-$D408
54279-54280
Voice #2 frequency.
Write-only.
$D409-$D40A
54281-54282
Voice #2 pulse width.
Write-only.
$D40B
54283
Voice #2 control register.
Write-only.
$D40C
54284
Voice #2 Attack and Decay length.
Write-only.
$D40D
54285
Voice #2 Sustain volume and Release length.
Write-only.
$D40E-$D40F
54286-54287
Voice #3 frequency.
Write-only.
$D410-$D411
54288-54289
Voice #3 pulse width.
Write-only.
$D412
54290
Voice #3 control register.
Write-only.
$D413
54291
Voice #3 Attack and Decay length.
Write-only.
$D414
54292
Voice #3 Sustain volume and Release length.
Write-only.
$D415
54293
Filter cut off frequency (bits #0-#2).
Write-only.
$D416
54294
Filter cut off frequency (bits #3-#10).
Write-only.
$D417
54295
Filter control. Bits: Write-only.
$D418
54296
Volume and filter modes. Bits: Write-only.
$D419
54297
X value of paddle selected at memory address $DD00. (Updates at every 512 system cycles.)
Read-only.
$D41A
54298
Y value of paddle selected at memory address $DD00. (Updates at every 512 system cycles.)
Read-only.
$D41B
54299
Voice #3 waveform output.
Read-only.
$D41C
54300
Voice #3 ADSR output.
Read-only.
$D41D-$D41F
54301-54303
Unusable (3 bytes).
$D420-$D7FF
54304-55295
SID register images (repeated every $20, 32 bytes).
$D800-$DBFF, 55296-56319
Color RAM
$D800-$DBE7
55296-56295
Color RAM (1000 bytes, only bits #0-#3).
$DBE8-$DBFF
56296-56319
Unused (24 bytes, only bits #0-#3).
$DC00-$DCFF, 56320-56575
CIA#1; inputs (keyboard, joystick, mouse), datasette, IRQ control
$DC00
56320
Port A, keyboard matrix columns and joystick #2. Read bits: Write bits:
$DC01
56321
Port B, keyboard matrix rows and joystick #1. Bits:
$DC02
56322
Port A data direction register.
$DC03
56323
Port B data direction register.
$DC04-$DC05
56324-56325
Timer A. Read: Current timer value.
Write: Set timer start value.
$DC06-$DC07
56326-56327
Timer B. Read: Current timer value.
Write: Set timer start value.
$DC08
56328
Time of Day, tenth seconds (in BCD). Values: $00-$09. Read: Current TOD value.
Write: Set TOD or alarm time.
$DC09
56329
Time of Day, seconds (in BCD). Values: $00-$59. Read: Current TOD value.
Write: Set TOD or alarm time.
$DC0A
56330
Time of Day, minutes (in BCD). Values: $00-$59. Read: Current TOD value.
Write: Set TOD or alarm time.
$DC0B
56331
Time of Day, hours (in BCD). Read bits: Write: Set TOD or alarm time.
$DC0C
56332
Serial shift register. (Bits are read and written upon every positive edge of the CNT pin.)
$DC0D
56333
Interrupt control and status register. Read bits: Write bits:
$DC0E
56334
Timer A control register. Bits:
$DC0F
56335
Timer B control register. Bits:
$DC10-$DCFF
56336-56575
CIA#1 register images (repeated every $10, 16 bytes).
$DD00-$DDFF, 56576-56831
CIA#2; serial bus, RS232, NMI control
$DD00
56576
Port A, serial bus access. Bits:
$DD01
56577
Port B, RS232 access. Read bits: Write bits:
$DD02
56578
Port A data direction register.
$DD03
56579
Port B data direction register.
$DD04-$DD05
56580-56581
Timer A. Read: Current timer value.
Write: Set timer start value.
$DD06-$DD07
56582-56583
Timer B. Read: Current timer value.
Write: Set timer start value.
$DD08
56584
Time of Day, tenth seconds (in BCD). Values: $00-$09. Read: Current TOD value.
Write: Set TOD or alarm time.
$DD09
56585
Time of Day, seconds (in BCD). Values: $00-$59. Read: Current TOD value.
Write: Set TOD or alarm time.
$DD0A
56586
Time of Day, minutes (in BCD). Values: $00-$59. Read: Current TOD value.
Write: Set TOD or alarm time.
$DD0B
56587
Time of Day, hours (in BCD). Read bits: Write: Set TOD or alarm time.
$DD0C
56588
Serial shift register. (Bits are read and written upon every positive edge of the CNT pin.)
$DD0D
56589
Interrupt control and status register. Read bits: Write bits:
$DD0E
56590
Timer A control register. Bits:
$DD0F
56591
Timer B control register. Bits:
$DD10-$DDFF
56592-56831
CIA#2 register images (repeated every $10, 16 bytes).
$DE00-$DEFF, 56832-57087
I/O Area #1
$DE00-$DEFF
56832-57087
I/O Area #1, memory mapped registers or machine code routines of optional external devices (256 bytes). Layout and contents depend on the actual device.
$DF00-$DFFF, 57088-57343
I/O Area #2
$DF00-$DFFF
57088-57343
I/O Area #2, memory mapped registers or machine code routines of optional external devices (256 bytes). Layout and contents depend on the actual device.
$E000-$FFFF, 57344-65535
KERNAL ROM
$E000-$FFFF
57344-65535
KERNAL ROM or RAM area (8192 bytes); depends on the value of bits #0-#2 of the processor port at memory address $0001:
$FF81-$FFF3, 65409-65523
Kernal functions
$FF81
65409
SCINIT
Initialize VIC; restore default input/output to keyboard/screen; clear screen; set PAL/NTSC switch and interrupt timer.
Input: –
Output: –
Used registers: A, X, Y.
Real address: $FF5B.
$FF84
65412
IOINIT
Initialize CIA's, SID volume; setup memory configuration; set and start interrupt timer.
Input: –
Output: –
Used registers: A, X.
Real address: $FDA3.
$FF87
65415
RAMTAS
Clear memory addresses $0002-$0101 and $0200-$03FF; run memory test and set start and end address of BASIC work area accordingly; set screen memory to $0400 and datasette buffer to $033C.
Input: –
Output: –
Used registers: A, X, Y.
Real address: $FD50.
$FF8A
65418
RESTOR
Fill vector table at memory addresses $0314-$0333 with default values.
Input: –
Output: –
Used registers: –
Real address: $FD15.
$FF8D
65421
VECTOR
Copy vector table at memory addresses $0314-$0333 from or into user table.
Input: Carry: 0 = Copy user table into vector table, 1 = Copy vector table into user table; X/Y = Pointer to user table.
Output: –
Used registers: A, Y.
Real address: $FD1A.
$FF90
65424
SETMSG
Set system error display switch at memory address $009D.
Input: A = Switch value.
Output: –
Used registers: –
Real address: $FE18.
$FF93
65427
LSTNSA
Send LISTEN secondary address to serial bus. (Must call LISTEN beforehands.)
Input: A = Secondary address.
Output: –
Used registers: A.
Real address: $EDB9.
$FF96
65430
TALKSA
Send TALK secondary address to serial bus. (Must call TALK beforehands.)
Input: A = Secondary address.
Output: –
Used registers: A.
Real address: $EDC7.
$FF99
65433
MEMBOT
Save or restore start address of BASIC work area.
Input: Carry: 0 = Restore from input, 1 = Save to output; X/Y = Address (if Carry = 0).
Output: X/Y = Address (if Carry = 1).
Used registers: X, Y.
Real address: $FE25.
$FF9C
65436
MEMTOP
Save or restore end address of BASIC work area.
Input: Carry: 0 = Restore from input, 1 = Save to output; X/Y = Address (if Carry = 0).
Output: X/Y = Address (if Carry = 1).
Used registers: X, Y.
Real address: $FE34.
$FF9F
65439
SCNKEY
Query keyboard; put current matrix code into memory address $00CB, current status of shift keys into memory address $028D and PETSCII code into keyboard buffer.
Input: –
Output: –
Used registers: A, X, Y.
Real address: $EA87.
$FFA2
65442
SETTMO
Unknown. (Set serial bus timeout.)
Input: A = Timeout value.
Output: –
Used registers: –
Real address: $FE21.
$FFA5
65445
IECIN
Read byte from serial bus. (Must call TALK and TALKSA beforehands.)
Input: –
Output: A = Byte read.
Used registers: A.
Real address: $EE13.
$FFA8
65448
IECOUT
Write byte to serial bus. (Must call LISTEN and LSTNSA beforehands.)
Input: A = Byte to write.
Output: –
Used registers: –
Real address: $EDDD.
$FFAB
65451
UNTALK
Send UNTALK command to serial bus.
Input: –
Output: –
Used registers: A.
Real address: $EDEF.
$FFAE
65454
UNLSTN
Send UNLISTEN command to serial bus.
Input: –
Output: –
Used registers: A.
Real address: $EDFE.
$FFB1
65457
LISTEN
Send LISTEN command to serial bus.
Input: A = Device number.
Output: –
Used registers: A.
Real address: $ED0C.
$FFB4
65460
TALK
Send TALK command to serial bus.
Input: A = Device number.
Output: –
Used registers: A.
Real address: $ED09.
$FFB7
65463
READST
Fetch status of current input/output device, value of ST variable. (For RS232, status is cleared.)
Input: –
Output: A = Device status.
Used registers: A.
Real address: $FE07.
$FFBA
65466
SETLFS
Set file parameters.
Input: A = Logical number; X = Device number; Y = Secondary address.
Output: –
Used registers: –
Real address: $FE00.
$FFBD
65469
SETNAM
Set file name parameters.
Input: A = File name length; X/Y = Pointer to file name.
Output: –
Used registers: –
Real address: $FDF9.
$FFC0
65472
OPEN
Open file. (Must call SETLFS and SETNAM beforehands.)
Input: –
Output: –
Used registers: A, X, Y.
Real address: ($031A), $F34A.
$FFC3
65475
CLOSE
Close file.
Input: A = Logical number.
Output: –
Used registers: A, X, Y.
Real address: ($031C), $F291.
$FFC6
65478
CHKIN
Define file as default input. (Must call OPEN beforehands.)
Input: X = Logical number.
Output: –
Used registers: A, X.
Real address: ($031E), $F20E.
$FFC9
65481
CHKOUT
Define file as default output. (Must call OPEN beforehands.)
Input: X = Logical number.
Output: –
Used registers: A, X.
Real address: ($0320), $F250.
$FFCC
65484
CLRCHN
Close default input/output files (for serial bus, send UNTALK and/or UNLISTEN); restore default input/output to keyboard/screen.
Input: –
Output: –
Used registers: A, X.
Real address: ($0322), $F333.
$FFCF
65487
CHRIN
Read byte from default input (for keyboard, read a line from the screen). (If not keyboard, must call OPEN and CHKIN beforehands.)
Input: –
Output: A = Byte read.
Used registers: A, Y.
Real address: ($0324), $F157.
$FFD2
65490
CHROUT
Write byte to default output. (If not screen, must call OPEN and CHKOUT beforehands.)
Input: A = Byte to write.
Output: –
Used registers: –
Real address: ($0326), $F1CA.
$FFD5
65493
LOAD
Load or verify file. (Must call SETLFS and SETNAM beforehands.)
Input: A: 0 = Load, 1-255 = Verify; X/Y = Load address (if secondary address = 0).
Output: Carry: 0 = No errors, 1 = Error; A = KERNAL error code (if Carry = 1); X/Y = Address of last byte loaded/verified (if Carry = 0).
Used registers: A, X, Y.
Real address: $F49E.
$FFD8
65496
SAVE
Save file. (Must call SETLFS and SETNAM beforehands.)
Input: A = Address of zero page register holding start address of memory area to save; X/Y = End address of memory area plus 1.
Output: Carry: 0 = No errors, 1 = Error; A = KERNAL error code (if Carry = 1).
Used registers: A, X, Y.
Real address: $F5DD.
$FFDB
65499
SETTIM
Set Time of Day, at memory address $00A0-$00A2.
Input: A/X/Y = New TOD value.
Output: –
Used registers: –
Real address: $F6E4.
$FFDE
65502
RDTIM
Read Time of Day, at memory address $00A0-$00A2.
Input: –
Output: A/X/Y = Current TOD value.
Used registers: A, X, Y.
Real address: $F6DD.
$FFE1
65505
STOP
Query Stop key indicator, at memory address $0091; if pressed, call CLRCHN and clear keyboard buffer.
Input: –
Output: Zero: 0 = Not pressed, 1 = Pressed; Carry: 1 = Pressed.
Used registers: A, X.
Real address: ($0328), $F6ED.
$FFE4
65508
GETIN
Read byte from default input. (If not keyboard, must call OPEN and CHKIN beforehands.)
Input: –
Output: A = Byte read.
Used registers: A, X, Y.
Real address: ($032A), $F13E.
$FFE7
65511
CLALL
Clear file table; call CLRCHN.
Input: –
Output: –
Used registers: A, X.
Real address: ($032C), $F32F.
$FFEA
65514
UDTIM
Update Time of Day, at memory address $00A0-$00A2, and Stop key indicator, at memory address $0091.
Input: –
Output: –
Used registers: A, X.
Real address: $F69B.
$FFED
65517
SCREEN
Fetch number of screen rows and columns.
Input: –
Output: X = Number of columns (40); Y = Number of rows (25).
Used registers: X, Y.
Real address: $E505.
$FFF0
65520
PLOT
Save or restore cursor position.
Input: Carry: 0 = Restore from input, 1 = Save to output; X = Cursor column (if Carry = 0); Y = Cursor row (if Carry = 0).
Output: X = Cursor column (if Carry = 1); Y = Cursor row (if Carry = 1).
Used registers: X, Y.
Real address: $E50A.
$FFF3
65523
IOBASE
Fetch CIA #1 base address.
Input: –
Output: X/Y = CIA #1 base address ($DC00).
Used registers: X, Y.
Real address: $E500.
$FFFA-$FFFF, 65530-65535
Hardware vectors
$FFFA-$FFFB
65530-65531
Execution address of non-maskable interrupt service routine.
Default: $FE43.
$FFFC-$FFFD
65532-65533
Execution address of cold reset.
Default: $FCE2.
$FFFE-$FFFF
65534-65535
Execution address of interrupt service routine.
Default: $FF48.