Vic-20 Memory Map

Hex OffsetDecimal OffsetDescription
00000Jump for USR
0001-00021-2Vector for USR
0003-00043-4Float-Fixed vector
0005-00065-6Fixed-Float vector
00077Search character
00088Scan-quotes flag
00099TAB column save
000A100=LOAD, 1=VERIFY
000B11Input buffer pointer/# subscript
000C12Default DIM flag
000D13Type: FF=string, 00=numeric
000E14Type: 80=integer, 00=floating point
000F15DATA scan/LlST quote/memory flag
001016Subscript/FNx flag
0011170 = INPUT;$40 = GET;$98 = READ
001218ATN sign/Comparison eval flag
001319Current l/O prompt flag
0014-001520-21Integer value
001622Pointer: temporary string stack
0017-001823-24Last temp string vector
0019-002125-33Stack for temporary strings
0022-002534-37Utility pointer area
0026-002A38-42Product area for multiplication
002B-002C43-44Pointer: Start of Basic
002D-002E45-46Pointer: Start of Variables
002F-003047-48Pointer: Start of Arrays
0031-003249-50Pointer: End of Arrays
0033-003451-52Pointer: String storage (moving down)
0035-003653-54Utility string pointer
0037-003855-56Pointer: Limit of memory
0039-003A57-58Current Basic line number
003B-003C59-60Previous Basic line number
003D-003E61-62Pointer: Basic statement for CONT
003F-004063-64Current DATA line number
0041-004265-66Current DATA address
0043-004467-68Input vector
0045-004669-70Current variable name
0047-004871-72Current variable address
0049-004A73-74Variable pointer for FOR/NEXT
004B-004C75-76Y-save; op-save; Basic pointer save
004D77Comparison symbol accumulator
004E-005378-83Misc work area, pointers, etc
0054-005684-86Jump vector for functions
0057-006087-96Misc numeric work area
6197Accum#1: Exponent
0062-006598-101Accum#1: Mantissa
66102Accum#1: Sign
0067103Series evaluation constant pointer
0068104Accum#1 hi-order (overflow)
0069-006E105-110Accum#2: Exponent, etc.
006F111Sign comparison, Acc#1 vs #2
0070112Accum#1 lo-order (rounding)
0071-0072113-114Cassette buffer length/Series pointer
0073-008A115-138CHRGET subroutine (get BASIC char)
007A-007B122-123Basic pointer (within subroutine)
008B-008F139-143RND seed value
90144Status word ST
0091145Keyswitch PIA: STOP and RVS flags
0092146Timing constant for tape
0093147Load=0, Verify=1
0094148Serial output: deferred char flag
0095149Serial deferred character
0096150Tape EOT received
0097151Register save
98152How many open files
99153Input device (normally 0)
009A154Output (CMD) device, normally 3
009B155Tape character parity
009C156Byte-received flag
009D157Direct=$80/RUN=0 output control
009E158Tape Pass 1 error log/char buffer
009F159Tape Pass 2 error log corrected
00A0-00A2160-162Jiffy Clock (HML)
00A3163Serial bit count/EOI flag
00A4164Cycle count
00A5165Countdown, tape write/bit count
00A6166Pointer: tape buffer
00A7167Tape Write ldr count/Read pass/inbit
00A8168Tape Write new byte/Read error/inbit
00A9169Write start bit/Read bit err/stbit
00AA170Tape Scan;Cnt;Ld;End/byte assy
00AB171Write lead length/Rd checksum/parity
00AC-00AD172-173Pointer: tape buffer, scrolling
00AE-00AF174-175Tape end addresses/End of program
00B0-00B1176-177Tape timing constants
00B2-00B3178-179Pointer: start of tape buffer
00B4180Tape timer (1 Err:508 bit cnt
00B5181Tape EOT/RS-232 next bit to send
00B6182Read character error/outbyte buffer
00B7183# characters in file name
00B8184Current logical file
00B9185Current secondary address
00BA186Current device
00BB-00BC187-188Pointer: to file name
00BD189Write shift word/Read input char
00BE190# blocks remaining to Write/Read
00BF191Serial word buffer
00C0192Tape motor interlock
00C1-00C2193-194I/O start addresses
00C3-00C4195-196KERNAL setup pointer
00C5197Current key pressed
00C6198# chars in keyboard buffer
00C7199Screen reverse flag
00C8200Pointer: End-of-line for input
00C9-00CA201-202Input cursor log (row, column)
00CB203Which key: 64 if no key
00CC204cursor enable (0=flash cursor)
00CD205Cursor timing countdown
00CE206Character under cursor
00CF207Cursor in blink phase
00D0208Input from screen/from keyboard
00D1-00D2209-210Pointer to screen line
00D3211Position of cursor on above line
00D42120=direct cursor, else programmed
00D5213Current screen line length
00D6214Row where cursor lives
00D7215Last inkey/checksum/buffer
00D8216# of INSERTs outstanding
00D9-00F0217-240Screen line link table
00F1241Dummy screen link
00F2242Screen row marker
00F3-00F4243-244Screen color pointer
00F5-00F6245-246Keyboard pointer
00F7-00F8247-248RS-232 Rcv pointer
00F9-00FA249-250RS-232 Tx pointer
00FB-00FE251-254Operating system free zero page space
00FF255Basic storage
0100-010A256-266Floating to ASCII work area
0100-013E256-318Tape error log
0100-01FF256-511Processor stack area
0200-0258512-600Basic input buffer
0259-0262601-610Logical file table
0263-026C611-620Device # table
026D-0276621-630Secondary Address table
0277-0280631-640Keyboard buffer
0281-0282641-642Start of memory for op system
0283-0284643-644Top of memory for op system
0285645Serial bus timeout flag
286646Current color code
0287647Color under cursor
288648Screen memory page
289649Max size of keyboard buffer
028A650Key repeat (128=repeat all keys)
028B651Repeat speed counter
028C652Repeat delay counter
028D653Keyboard Shift/Control flag
028E654Last keyboard shift pattern
028F-0290655-656Pointer: decode logic
291657Shift mode switch (0 = enabled, 128 = locked)
0292658Autoscrolldownflag (0=on, <>0=off)
0293659RS-232 control register
0294660RS-232 command register
0295-0296661-662Nonstandard (Bit time/2-100)
0297663RS-232 status register
0298664Number of bits to send
0299-029A665-666Baud rate (full) bit time
029B667RS-232 receive pointer
029C668RS-232 input pointer
029D669RS-232 transmit pointer
029E670RS-232 output pointer
029F-02A0671-672Holds IRQ during tape operations
02A1-02FF673-767Program indirects
0300-0301768-769Error message link
0302-0303770-771Basic warm start link
0304-0305772-773Crunch Basic tokens link
0306-0307774-775Print tokens link
0308-0309776-777Start new Basic code link
030A-030B778-779Get arithmetic element link
030C780Storage for 6502 .A register
030D781Storage for 6502 .X register
030E782Storage for 6502 .Y register
030F783Storage for 6502 .P register
0314-0315788-789Hardware (IRQ) interrupt vector [EABF]
0316-0317790-791Break interrupt vector [FED2]
0318-0319792-793NMI interrupt vector [FEAD]
031A-031B794-795OPEN vector [F40A]
031C-031D796-797CLOSE vector [F34A]
031E-031F798-799Set-input vector [F2C7]
0320-0321800-801Set-output vector [F309]
0322-0323802-803Restore l/O vector [F3F3]
0324-0325804-805INPUT vector [F20E]
0326-0327806-807Output vector [F27A]
0328-0329808-809Test-STOP vector [F770]
032A-032B810-811GET vector [F1F5]
032C-032D812-813Abort l/O vector [F3EF]
032E-032F814-815User vector (default BRK) [FED2]
0330-0331816-817Link to load RAM [F549]
0332-0333818-819Link to save RAM [F685]
003C-03FB828-1019Cassette buffer
0400-0FFF1024-40953K expansion RAM area
1000-1DFF4096-7679User Basic area
1E00-1FFF7680-8191Screen memory
2000-3FFF8192-163838K expansion RAM/ROM block 1
4000-5FFF16384-245758K expansion RAM/ROM block 2
6000-7FFF24576-327678K expansion RAM/ROM block 3
NOTE:When additional memory is added to block 1 (and 2 and 3), the KERNAL relocates the following things for BASIC:
1000-11FF4096-4607Screen memory
1200-?4608-?User Basic area
9400-95FF37888-38399Color RAM
8000-8FFF32768-368634K Character generator ROM
8000-83FF32768-33791Upper case and graphics
8400-87FF33792-33815Reversed upper case and graphics
8800-8BFF33816-35839Upper and lower case
8C00-8FFF35840-36863Reversed upper and lower case
9000-93FF36864-37887I/O BLOCK 0
9000-900F36864-36879Address of VIC chip registers
900036864bits 0-6 horizontal centering
bit 7 sets interlace scan
900136865vertical centering
900236866bits 0-6 set # of columns
bit 7 is part of video matrix address
900336867bits 01/06/11 set # of rows
bit 0 sets 8x8 or 16x8 chars
900436868TV raster beam line
900536869bits 0-3 start of character memory
(default = 0)
Bits 4- 7 is rest of video address
(default = F)
BITS 3,2,1,0 CM starting address
900636870horizontal position of light pen
900736871vertical position of light pen
900836872Digitized value of paddle X
900936873Digitized value of paddle Y
900A36874Frequency for oscillator 1 (low)
900B36875Frequency for oscillator 2 (medium)
900C36876Frequency for oscillator 3 (high)
900D36877Frequency of noise source
900E36878bit 0-3 sets volume of all sound
bits4-7are auxiliary color information
900F36879Screen and border color register
bits4-7select background color
bits0-2select border color
bit3selects inverted or normal mode
9110-911F37136-371516522 VIA#1
911037136Port B output register (user port and RS-232 lines)
CPB0Received data(BB)Sin
DPB1Request to Send(CA)RTS
EPB2Data terminal ready(CD)DTR
FPB3Ring indicator(CE)RI
HPB4Received line signal(CF)DCD
KPB6Clear to send(CB)CTS
LPB7Data set ready(CC)DSR
BCB1Interrupt for Sin(BB)Sin
MCB2Transmitted data(BA)Sout
AGNDProtective ground(M)GND
NGNDSignal ground(AB)GND
911137137Port A output register
(PA1) Bit 1=Serial DATA IN
(PA2) Bit 2=Joy 0
(PA3) Bit 3=Joy 1
(PA4) Bit 4=Joy 2
(PA5) Bit 5 = Lightpen/Fire button
(PA6) Bit 6=Cassette switch sense
(PA7) Bit 7=Serial ATN out
911237138Data direction register B
911337139Data direction register A
911437140Timer 1 low byte
911537141Timer 1 high byte & counter
911637142Timer 1 low byte
911737143Timer 1 high byte
911837144Timer 2 low byte
911937145Timer 2 high byte
911A37146Shift register
911B37147Auxiliary control register
911C37148Peripheral control register
(CA1, CA2, CB1, CB2)
CA1 = restore key (Bit 0)
CA2 = cassette motor control (Bits 1-3)
CB1 = interrupt signal for received
RS-232 data (Bit 4)
CB2=transmitted RS-232 data (Bits 5-7)
911D37149Interrupt flag register
911E37150Interrupt enable register
911F37151Port A (Sense cassette switch)
9120-912F37152-371676522 VIA#2
912037152Port B output register (keyboard column scan)
(PB3) Bit 3 =cassette write line
(PB7) Bit 7 =Joy 3
912137153Port A output register (keyboard row scan)
912237154Data direction register B
912337155Data direction register A
912437156Timer 1, low byte latch
912537157Timer 1, high byte latch
912637158Timer 1, low byte counter
912737159Timer 1, high byte counter
timer 1 is used for the 60 time/second interrupt
912837160Timer 2, low byte latch
912937161Timer 2, high byte latch
912A37162Shift register
912B37163Auxiliary control register
912C37164Peripheral control register
CA1 Cassette read line (Bit 0)
CA2 Serial clock out (Bits 1-3)
CB1 Serial SRQ IN (Bit 4)
CB2 Serial data out (Bits 5-7)
912D37165Interrupt flag register
912E37166Interrupt enable register
912F37167Port A output register
9400-95FF37888-38399location of COLOR RAM with additional RAM at blk 1
9600-97FF38400-38911Normal location of COLOR RAM
9800-9BFF38912-39935I/O block 2
9C00-9FFF39936-40959I/O block 3
A000-BFFF40960-491528K decoded block for expansion ROM
C000-DFFF49152-573438K Basic ROM
E000-FFFF57344-655358K KERNAL ROM


This is a more in-depth guide to some of the memory locations you can use.

Hex OffsetDecimal OffsetDescription
0014-001520-21Where BASIC stores integer variables used in calculations. The fixed-float and float-fixed routines (vectors at 1-2 and 3-4) use the value in this area.
002B-002C43-44The start of the BASIC program in memory. Location 43 contains the low byte, and location 44 has the high byte. To compute the start of BASIC in decimal, use the formula: PEEK(43) 256 * PEEK(44)
002D-002E45-46The start of the numeric variables, which is usually immediately after the end of the BASIC program.
002F-003047-48The start of arrays in memory, usually immediately following the numeric variables.
0031-003249-50The end of the arrays in memory.
0033-003451-52Bottom of string storage, moving from the top of available memory down to the top of arrays.
0037-003855-56The top of free RAM. By lowering this value, some RAM can be "protected" against BASIC putting values here.
0043-004467-68Jump vector for INPUT statement.
0061-006697-102Floating point accumulator #1 for calculations.
0069-006E105-110Floating point accumulator #2.
0073-008A115-138The CHRGET subroutine resides here. This routine gets the next BASIC character from machine language.
0090144Status word ST.
0098152Number of open files.
0099153Device number for input, normally 0 (keyboard).
009A154Output (CMD) device, normally 3 (screen).
00A0-00A2160-1623 byte jiffy clock. The Tl and Tl$ variables are translations of these locations.
00B2-00B3178-179Points to the start of the tape buffer. Can be used as an indirect zero-page jump to a routine in the buffer.
00B7183Number of characters in filename.
00B9185Which secondary address is currently being used.
00BA186Current device number being accessed.
00BB-00BC187-188Points to location of filename in memory.
00C5197Current key being held down. There will be a 64 here if nothing is held down. If more than 1 key is down, the key with the highest number on the chart is what shows up here.
622;38none54^ (up arrow)
7DEL23cursor left/right39f155f5
15RETURN31cursor up/down47f363f7
00C6198Number of characters currently in keyboard buffer.
00C7199Flag for reverse on/off. A 1 here is on, 0 is offa
00CB203Same as 197
00D1-00D2209-210Address of start of line where cursor is.
00D3211Position of cursor on line.
00D5213Current screen line length--either 21, 43, 65, or 87
00D6214Screen row where cursor is. To change the cursor position, locations 209, 210, 211, and 214 must be changed.
00D8216Number of spaces left in INSERT mode. POKEing this to a zero will turn off insert mode.
00D9-00F0217-240Screen line link table. A 158 means that the line is finished at the end of that line, and a 30 means that the line continues on the next line.
00F3-00F4243-244Pointer to the current space in color memory.
00FB-00FE251-254Available locations in zero page.
0200-0258512-600BASIC input buffer (where the characters being INPUT will go)
0259-0262601-610Logic 1 file table for OPEN files.
0263-026C611-620Device # table for OPEN files.
026D-0276621-630Secondary address table
0277-0280631-640Keyboard buffer. If characters are POKEd in here and location 198 (# of characters in buffer) is changed, it will be as if the characters were typed from the keyboard.
0281-0282641-642Start of memory pointer.
0283-0284643-644Top of memory pointer.
0286646Current color code. This holds the color number that goes into color memory during PRINT operations.
0288648Screen memory page. If you want the operating system to know where screen memory is, this must be changed as well as the VIC chip.
0289649Maximum size of keyboard buffer. If this is set greater than 10, vital pointers will be destroyed.
028A650Keyboard repeat flag. If this is a 0, only cursor controls repeat; if 128, all keys repeat.
028B651This determines how long the VIC waits before repeating key.
028D653Keyboard SHIFT, CTRL, Commodore flag. The SHIFT sets the 1 bit, Commodore sets the 2 bit, and the CTRL sets the 4 bit.
0291657Setting this location to 128 will disable switching case, and a 0 here enables the ability to switch.
0300-0301768-769This is the jump vector for errors. By changing this vector, a routine can intercept any error condition.
033C-03FB828-1019Cassette buffer. This is where data files are held before they are INPUT. When not using files, this is available for POKEing or machine language programs.