Classic Computer Magazine Archive COMPUTE! ISSUE 26 / JULY 1982 / PAGE 144

VIC Super Expander Memory Map

Chuan Chee
St. Catharines, Canada

A map of the significant machine language routines in the VIC Super Expander. You can translate these hexadecimal numbers into decimal, then SYS to them and watch the effects.

General Input/Output Routines

A000-A001 Vector: RESET ($A044)
A022-A003 Vector: NMI ($A077)
A004-A008 ROM identification (‘a0CBM’)
A009-A010 Table: function key numbers
A011-A043 Table: initial function key definitions
A044-A076 RESET routine
A077-A08A NMI routine
A08B-A0BE Parse KEY (get parameters and check syntax)
A0BF-A131 Display all function key definitions
A110-A11C Print'° + chr$(34)' and an optional ‘+’
A11D-A131 Print ‘° + chr$(13)’ and an optional ‘+’
A132-A135 Table: ASCII string for output (‘key’ backwards)
A136-A13F Table: ASCII string for output (‘° + chr$(13)’ backwards)
A140-A149 Table: ASCII string for output (‘° + chr$(34)’ backwards)
A14A-A17A Delete current function key string (key number in .X)
A17B-A1B0 Insert string into function key definition area
A1B1-A1BE Locate function key definition (key number in .X, return index in .Y)
A1BF-A213 Table: new BASIC keywords in ASCII form
A214-A237 Table: vectors corresponding to new BASIC tokens ($CC to $DD)
A238-A2A1 Initialize kernal vectors, I/O, RAM
A2A2-A2C1 Table: kernal vectors (L,H)
A2C2-A2C7 Warm start routine
A2C8-A317 Output a character to device 3 (char in .A)
A318-A336 End music mode
A337-A365 Interpret keyboard matrix input
A366-A369 Table: keyboard matrix code for function keys
A36A-A371 Table: conversion pattern for function keys
A372-A394 IRQ routine
A395-A3A5 Input a char from any device (device number in $99)
A3A6-A3B3 Output a char to any device (char in .A, device num in $9A)
A3B4-A3F1 Input each char from keyboard buffer
A3B4- A3E7 Handle ‘RUN’ key
A3E8-A3F1 Handle ‘RETURN’ key
A3F2-A3FC Input from device 0
A3FD-A406 Print an error message in GRAPHIC 0 mode (error token in .A)
A407-A4B9 Lexically analyse BASIC source line (translate to tokens)
A4BA-A503 Print BASIC tokens in ASCII form
A504-A529 Start new BASIC statement
A515- A523 Handle new tokens ($CC to $D6)
A52A-A58A Get and evaluate an expression
A558- A58A Handle new function tokens ($D7 to $DD)
A58B-A596 Table: BASIC vectors for RAM
A597-A5A4 Change BASIC vectors during RESET

Music Routines

A5A5-A5D0 Save current sound table (address of table in .X,.Y)
A5D1-A601 IRQ music driver
A602-A625 Table: conversion for note index to frequency
A626-A6E5 Interpret music mode characters (char in .A)
A629-A643 Execute ‘O’ command, default 3
A644-A65D Execute ‘T’ command, default 0
A65E-A674 Execute ‘S’ command, default 4
A675-A686 Execute ‘V’ command, default 7
A687-A693 Execute ‘R’ command
A694-A69B Execute ‘P’ command
A69C-A6A7 Execute ‘Q’ command
A6A8- Play new note (note index in .Y)
A6AB-A6B3 Save new sound table when previous note finishes
A6B4-A6B9 Common return routine
A6BA-A6CD Play notes ‘A’ to ‘G’
A6CE-A6DA Execute ‘#’ command
A6DB-A6E5 Execute ‘$’ command
A6E6-A6EC Table: conversion for notes to note index
A6ED-A6EF Table: conversion for octave to base note index
A6F0-A6F9 Table: conversion for tempo to duration (jiffies)

Parsing New Command Routines

A6FA- Look for and evaluate first 1 -byte and two 2-byte parameters
A6FD- Look for and evaluate two 2-byte parameters
A700- Look for and evaluate one 2-byte parameter
A714-A71B Saveone 1-byte parameter (parameter in .A, index in .Y)
A71C- Look for and evaluate two 1-byte parameters
A71F-A72B Look for and evaluate one 1-byte parameter
A72C-A73F Parse GRAPHIC (get parameters and check syntax)
A740-A762 Parse CIRCLE
A763-A7A4 Parse DRAW
A7C8-A7CE Go to execute commands after parsing
A7EA-A809 Parse CHAR
A80A-A810 Parse PAINT
A811-A817 Parse RPOT
A818-A81B Parse RPEN
A81C-A81F Parse RSND
A820-A823 Parse RCOL
A824-A827 Parse RGR
A828-A842 Parse RDOT
A843-A846 Parse RJOY
A847-A84E Look for first 1 -byte parameter
A84F-A866 Indirect jump to execute new commands (pointer to parameter save area in .X,.Y, command index in .A)
A867-A878 Table: vector to execute new commands (H)
A879-A88A Table: vector to execute new commands (L)

Execute New Command Routines

A88B-AA22 Execute GRAPHIC
A8AB-A94E Handle GRAPHIC 1,2,3 if previous was 0.
A8D4-A942 Transfer BASIC program to above $2000 and execute CLR
A943-A94E Make screen at $1E00 and character set at $1000
A94F-A9AB Handle GRAPHIC 4
A967-A9AB Transfer BASIC program down to old location and execute CLR
A9AC- A9B7 Handle GRAPHIC 0 if previous was 1,2,3
A9B8-AA22 Set up proper GRAPHIC screen
AA23-AA28 Execute RGR
AA29-AA6A Execute COLOR
AA6B-AA84 Execute REGION
AA85-AA8B Execute RCOL
AA8C-AAE6 Execute RDOT
AAF2-AB12 Execute SCNCLR
AB13-AB22 Execute DRAW (c TO x,y...)
AB23-AB34 Execute DRAW (c,x,y TO x,y ...)
AB35-AB54 Execute SOUND
AB55-AB69 Execute RSND
AB6A-AB76 Execute RPOT
AB77-AB7D Execute RPEN
AB7E- Plot a single point from parameter save area
AB86-ABE4 Plot a single point from beginning scaled X,Y coordinates
ABE5- Set up pointers to character and colour memory
ABFA-AC0A Set up pointer to colour memory
AC0B- Draw a line with a new starting coordinate
AC11-AC92 Draw a line starting from previous coordinate (using a version of Bresenham's DDA algorithm)
AC93-AD12 Execute CIRCLE (using principal of digital differential analyser (DDA))
AD13- Convert starting angle to radians
AD19-AD22 Divide FAC# 1 by 16
AD23- Calculate new scaled X and Y coordinate on locus
AD39-AD6B Calculate unit offset * scaled radius
ADDF- Check for possible new lower bound pivot coordinate
ADE8-AE01 Save pivot coordinate
AE02-AE0B Check for possible new upper bound pivot coordinate
AE0C- Check if able to PAINT a coordinate
AE0F-AE1E Check if able to PAINT a coordinate (X, Y in .A, .Y)
AE1F-AE23 Move beginning scaled X,Y coordinate to .A, .Y
AE24-AE3B Check if coordinate has been already plotted on
AE3C-AE44 Move beginning scaled X coordinate to the right
AE45-AE51 Move beginning scaled X coordinate 2 to the left
AE52-AE56 Flag ‘FORMULA TOO COMPLEX’ error message
AE57-AED9 Execute CHAR
AEDA-AF13 Execute RJOY
AF14-AF33 Set up correct VIC chip screen registers
AF34- Save number of coordinates and colour register
AF39-AF3E Save colour register
AF3F-AF47 Copy beginning from ending scaled X,Y coordinate
AF48-AF75 Scale X and Ycoordinates
AF76-AFB0 Scale X or Y coordinate to the range 0 to 159 (.X = .A*coordinate*2/256) (number of columns or rows in .A)
AFB1-AFBA Table: vector to map Y coordinate to colour memory (L)
AFBB-AFCE Table: vector to map X coordinate to character memory (L)
AFCF-AFE2 Table: vector to map X coordinate to character memory (H)
AFE3-AFE5 Table: bit set for colour memory
AFE6-AFE6 (not used-contains $00)
AFE7-AFEE Table: bit mask for highres mode
AFEF-AFF6 Table: bit mask for multicolour mode
AFF7-AFFA Table: bytes to plot in multicolour mode
AFFB-AFFE Table: conversion factor for VIC chip screen registers
AFFF-AFFF (not used-contains $AA)


(H): high byte of a two-byte address
(L): low byte of a two-byte address
Vector: two-byte address used for indirection of execution
Pointer: two-byte address for data
Index: one-byte offset fora table

General RAM Area

0024 Number of coordinates
0024 Flag: colour register mode ($FF= multicolour, $00 = highres)
0024-0025 Pointer: New start of variables/start of BASIC memory
0026 Temp area for building VIC chip registers / for building character byte / for saving starl of BASIC (L)

Current Coordinates

0062 Ending scaled X coordinate (0 to 159)
0063 Beginning scaled X coordinate (0 to 159)
0064 Scaled X difference (absolule value)
0065 Ending scaled Y coordinate (0 to 159)
0066 Beginning scaled Y coordinate (0 to 159)
0067 Scaled Y difference (absolute value -1)

For Scaling Coornidates

0069 Multiplicand- 1
006A 16-bit product
006B-006C 10-bit multiplier


0069 Scaled X unit direction - 1
006A Scaled Y unit direction
006B-006C Number of scaled Y units left to plot before next scaled X unit (count up)
006D-006E Number of points left to plot (count up)


0069 Index: pivot coordinates save area


0069 Current row (0 to 19)
006A Current column (0 to 19)
006B Length of string
006C-006D Pointer: string location

General RAM Area

009B Index : begining of current function key definition
009B-009C Pointer: current char set address/byte in char set/position in screen memory/destination of byte of BASIC program to transfer
009D Index: end of function key definition area
009E Current function key number/length of current function key string
009F Length of current function key string (count down)
009E-009F Pointer: byte in colour memory
00AC-00AD Pointer: current byte (function key definition, tape, scrolling)
00C3 Flag: 0 = have transferred BASIC program to a new location
00C3-00C4 Pointer: kernal set up/current music table/parameter save area ($033C)
00FB-00FC Pointer: top of BASIC memory (usually same as $0284-$0285)

For Key

028F-0290 Vector: interpret keyboard input ($A337)
02A1 Number of bytes taken by Super Expander in high memory ($88)
02A2 Number of characters in function key definition
02A3 Index: current byte of function key string
02A4 Length of function key string (amount left to output)

For Music

02A5 Previous character in music mode
02A6 Music mode ($80 = on)
02A7 Screen echo ($50 = on, $00 = off)
02A8 Current voice (sound register - 1)
02A9 Current note index
02AA Current duration (jiffies)
02AB Current sound amplitude (volume * 2)
02AC Current octave (base note index)
02AD Voice 1 note index (+ $80)
02AE Voice 1 duration count down (jiffies)
02AF Voice 2 note index (+ $80)
02B0 Voice 2 duration count down (jiffies)
02B1 Voice 3 note index (+ $80)
02B2 Voice 3 duration count down (jiffies)
02B3 Voice 4 note index (+ $80)
02B4 Voice 4 duration count down (jiffies)
02B5-02BF (for expansion)

For Execution Of New Commands

02C0-02C2 Jump table: execute new commands (JMP $A84F)
02C3 Current VIC chip left margin register
02C4 Current VIC chip top margin register
02C5 Current VIC chip number of columns register
02C6 Current VIC chip number of rows register
02C7 Current row of cursor
02C8 Current GRAPHIC mode
02C9 (for expansion)
02CA Current colour register parameter (while plotting)
02CB Current screen colour
02CC Current border colour
02CD Current character colour
02CE Current auxiliary colour
02CF Index: parameter save area (while plotting)
02D0 Current character set address page
02D1 Usual character set address page ($80)
02D2-02D3 Pointer: old limit of BASIC memory
02D4 Old screen memory page
02D5 Last scaled X coordinate (0 to 159)
02D6 Last scaled Y coordinate (0 to 159)
02D7 Flag: $00 = DRAW c,x,y TO, $01 = DRAW c TO/current number of out of range coordinates ($00 = within range)
02D8 Old number of out of range coordinates ($00 = within range)
02D9 Index: parameter save area (while getting parameters)
02DA-02FF (for expansion)

Operating System Vectors

0300-0301 Vector: error message ($A3FD)
0302-0303 Vector: BASIC warm start ($C483)
0304-0305 Vector: lexically analyse BASIC source line ($A407)
0306-0307 Vector: print BASIC token in ASCII form ($A4BA)
0308-0309 Vector: start new BASIC statement ($A504)
030A-030B Vector: get and evaluate an expression ($A52A)
0314-0315 Vector: IRQ ($A372)
0316-0317 Vector: BRK instruction ($A2C2)
0318-0319 Vector: NMI ($FEAD)
031A-031B Vector: BASIC OPEN statement ($F40A)
031C-031D Vector: BASIC CLOSE statement ($F34A)
031E-031F Vector: set input ($F2C7)
0320-0321 Vector: set output ($F309)
0322-0323 Vector: restore I/O ($F3F3)
0324-0325 Vector: input a character ($A395)
0326-0327 Vector: output a character ($A3A6)
0328-0329 Vector: test STOP key ($F770)
032A-032B Vector: BASIC GET statement ($F1F5)
032C-032D Vector: abort I/O ($F3EF)
032E-032F Vector: user BRK instruction ($A2C2)
0330-0331 Vector: BASIC LOAD statement ($F549)
0332-0333 Vector: BASIC SAVE statement ($F685)
0334-033B (for expansion)

Save Area

033C-03F8 Save area: parameter passing/pivot coordinates (PAINT)

For Circle

033C Index: X or Y
0347-0348 Old scaled X coordinate on locus
0349-034A Old scaled Y coordinate on locus
034B-034C New scaled X coordinate on locus
034D-034E New scaled Y coordinate on locus
034F-0353 Floating point unit offset X coordinate
0355-0359 Floating point unit offset Y coordinate