; ; ; Commodore VIC-20 ROM Memory Map V1.0 1 Sep 1994 ; ; Data types in headers (for reassembler): ; ; DATA Misc data ; TEXT String terminated with 00 ; WORD Vectors in LO/HI byte pairs ; CHIP I/O Area ; EMPTY ROM containing FF's or AA's ; ; ; BASIC v2.0 interpreter ROM ($B000 - $DFFF) ; This is almost identical to the C64 one. ; c000 c004 c00c c052 c080 c09e c129 c140 c14d c19e c328 c364 ;c364 ;c369 Basic Restart Vectors 'cbmbasic' DATA stmdsp BASIC Command Vectors fundsp BASIC Function Vectors optab BASIC Operator Vectors reslst BASIC Command Keyword Table msclst BASIC Misc. Keyword Table oplist BASIC Operator Keyword Table funlst BASIC Function Keyword Table errtab Error Message Table errptr Error Message Pointers okk Misc. Messages '<cr>ok<cr>' 'error' WORD c389 c38a c3b8 c3fb c408 c435 c437 c469 c474 c480 c49c c4a2 c533 c560 c579 c613 c642 c65e c68e c69c Unused byte DATA fndfor Find FOR/GOSUB Entry on Stack bltu Open Space in Memory getstk Check Stack Depth reason Check Memory Overlap omerr Output ?OUT OF MEMORY Error error Error Routine errfin Break Entry ready Restart BASIC main Input & Identify BASIC Line main1 Get Line Number & Tokenise Text inslin Insert BASIC Text linkprg Rechain Lines inlin Input Line Into Buffer crunch Tokenise Input Buffer fndlin Search for Line Number scrtch Perform [new] clear Perform [clr] stxpt Reset TXTPTR list Perform [list] WORD WORD WORD DATA DATA DATA DATA DATA WORD DATA TEXT DATA c717 c742 c7ae c7c4 c7e1 c7ed c81d c82c c857 c871 c883 c8a0 c8d2 c8f8 c906 c928 c93b c94b c96b c9a5 c9c4 c9d6 c9d9 c9e3 ca2c ca80 ca86 ca9a caa0 cab8 cad7 cae8 cb1e cb3b cb4d cb7b cba5 cbbf cbea cbf9 cc06 cc35 ccfc ;ccfc ;cd0c qplop Handle LIST Character for Perform [for] newstt BASIC Warm Start ckeol Check End of Program gone Prepare to execute statement gone3 Perform BASIC Keyword restor Perform [restore] stop Perform [stop], [end], break cont Perform [cont] run Perform [run] gosub Perform [gosub] goto Perform [goto] return Perform [return] data Perform [data] datan Search for Next Statement / Line if Perform [if] rem Perform [rem] ongoto Perform [on] linget Fetch linnum From BASIC let Perform [let] putint Assign Integer ptflpt Assign Floating Point putstr Assign String puttim Assign TI$ getspt Add Digit to FAC#1 printn Perform [print#] cmd Perform [cmd] strdon Print String From Memory print Perform [print] varop Output Variable crdo Output CR/LF comprt Handle comma, TAB(, SPC( strout Output String outspc Output Format Character doagin Handle Bad Data get Perform [get] inputn Perform [input#] input Perform [input] bufful Read Input Buffer qinlin Do Input Prompt read Perform [read] rdget General Purpose Read Routine exint Input Error Messages '?extra ignored<cr>' '?redo from start<cr>' cd1e cd61 cd8a cd9e ce83 cea8 cead cef1 next Perform [next] donext Check Valid Loop frmnum Confirm Result frmevl Evaluate Expression in Text eval Evaluate Single Term pival Constant - pi DATA qdot Continue Expression parchk Expression in Brackets DATA cef7 cef7 cefa cefd cf08 cf0d cf14 cf28 cf48 cfa7 cfb1 cfd1 cfe6 d016 d01b d02e d07e d08b d0e7 d11d d128 d194 d1a5 d1aa d1b2 d1bf d1d1 d218 d245 d248 d261 d30e d34c d37d d391 d39e d3a6 d3e1 d3f4 d465 d487 d4d5 d4f4 d526 d5bd d606 d63d d67a d6a3 d6db d6ec d700 d72c d737 chkcls Confirm Character -test ')'-test '('-test commasynerr Output ?SYNTAX Error domin Set up NOT Function rsvvar Identify Reserved Variable isvar Search for Variable tisasc Convert TI to ASCII String isfun Identify Function Type strfun Evaluate String Function numfun Evaluate Numeric Function orop Perform [or], [and] dorel Perform <, =, > numrel Numeric Comparison strrel String Comparison dim Perform [dim] ptrget Identify Variable ordvar Locate Ordinary Variable notfns Create New Variable notevl Create Variable aryget Allocate Array Pointer Space n32768 Constant 32768 in Flpt DATA facinx FAC#1 to Integer in (AC/YR) intidx Evaluate Text for Integer ayint FAC#1 to Positive Integer isary Get Array Parameters fndary Find Array bserr '?bad subscript error' '?illegal quantity error' notfdd Create Array inlpn2 Locate Element in Array umult Number of Bytes in Subscript fre Perform [fre] givayf Convert Integer in (AC/YR) to Flpt pos Perform [pos] errdir Confirm Program Mode getfnm Check Syntax of FN fndoer Perform [fn] strd Perform [str$] strlit Set Up String putnw1 Save String Descriptor getspa Allocate Space for String garbag Garbage Collection dvars Search for Next String grbpas Collect a String cat Concatenate Two Strings movins Store String in High RAM frestr Perform String Housekeeping frefac Clean Descriptor Stack chrd Perform [chr$] leftd Perform [left$] rightd Perform [right$] midd Perform [mid$] d761 d77c d782 d78b d79b d7ad d7b5 d7eb d7f7 d80d d824 d82d d849 d850 d862 d867 d947 d97e d983 d9bc d9ea da28 da59 da8c dab7 dad4 dae2 daf9 dafe db07 db0f dba2 dbc7 dbfc dc0c dc1b dc2b dc39 dc58 dc5b dc9b dccc dcf3 ddb3 ddc2 dddd de68 df11 df71 df7b dfb4 dfbf dfed pream Pull sTring Parameters len Perform [len] len1 Exit String Mode asc Perform [asc] gtbytc Evaluate Text to 1 Byte in XR val Perform [val] strval Convert ASCII String to Flpt getnum Get parameters for POKE/WAIT getadr Convert FAC#1 to Integer in LINNUM peek Perform [peek] poke Perform [poke] wait Perform [wait] faddh Add 0.5 to FAC#1 fsub Perform Subtraction fadd5 Normalise Addition fadd Perform Addition negfac 2's Complement FAC#1 overr Output ?OVERFLOW Error mulshf Multiply by Zero Byte fone Table of Flpt Constants DATA log Perform [log] fmult Perform Multiply mulply Multiply by a Byte conupk Load FAC#2 From Memory muldiv Test Both Accumulators mldvex Overflow / Underflow mul10 Multiply FAC#1 by 10 tenc Constant 10 in Flpt DATA div10 Divide FAC#1 by 10 fdiv Divide FAC#2 by Flpt at (AC/YR) fdivt Divide FAC#2 by FAC#1 movfm Load FAC#1 From Memory mov2f Store FAC#1 in Memory movfa Copy FAC#2 into FAC#1 movaf Copy FAC#1 into FAC#2 round Round FAC#1 sign Check Sign of FAC#1 sgn Perform [sgn] abs Perform [abs] fcomp Compare FAC#1 With Memory qint Convert FAC#1 to Integer int Perform [int] fin Convert ASCII String to a Number in FAC#1 n0999 String Conversion Constants DATA inprt Output 'IN' and Line Number fout Convert FAC#1 to ASCII String foutim Convert TI to String fhalf Table of Constants DATA sqr Perform [sqr] fpwrt Perform power ($) negop Negate FAC#1 logeb2 Table of Constants DATA exp Perform [exp] ; ; ; VIC-20 Kernel ROM ;e000 e040 e08a e094 e0f6 e109 e10f e115 e11b e121 e127 e153 e162 e1bb e1c4 e1d1 e1fd e203 e20b e216 e261 e268 e2b1 e2dd (exp continues) EXP continued From BASIC ROM polyx Series Evaluation rmulc Constants for RND DATA rnd Perform [rnd] bioerr Handle I/O Error in BASIC bchout Output Character bchin Input Character bckout Set Up For Output bckin Set Up For Input bgetin Get One Character sys Perform [sys] savet Perform [save] verfyt Perform [verify / load] opent Perform [open] closet Perform [close] slpara Get Parameters For LOAD/SAVE combyt Get Next One Byte Parameter deflt Check Default Parameters cmmerr Check For Comma ocpara Get Parameters For OPEN/CLOSE cos Perform [cos] sin Perform [sin] tan Perform [tan] pi2 Table of Trig Constants DATA ;e2dd 1.570796327 pi/2 ;e2e2 6.28318531 pi*2 ;e2e7 0.25 ;e2ec ;e2ed ;e2f2 ;e2f7 ;e2fc ;e301 ;e306 #05 (counter) -14.3813907 42.0077971 -76.7041703 81.6052237 -41.3417021 6.28318531 e30b e33b atn Perform [atn] atncon Table of ATN Constants ;e33b ;e3ec ;e341 ;e346 ;e34b ;e350 ;e355 ;e35a ;e35f ;e364 #0b (counter) -0.000684793912 0.00485094216 -0.161117018 0.034209638 -0.0542791328 0.0724571965 -0.0898023954 0.110932413 -0.142839808 DATA ;e369 0.19999912 ;e36e -0.333333316 ;e373 1.00 e378 e387 e39f ;e39f e3a4 e404 e429 ;e429 ;e436 init BASIC Cold Start initat CHRGET For Zero-page rndsed RND Seed For zero-page 0.811635157 initcz Initialize BASIC RAM initms Output Power-Up Message words Power-Up Message DATA ' bytes free<cr>' '<clr>**** cbm basic v2 ****<cr>' e44f e45b e467 bvtrs Table of BASIC Vectors (for 0300) WORD initv Initialize Vectors bassft BASIC Warm Restart [RUNSTOP-RESTORE] e475 e47c e4a0 e4a9 e4b2 e4bc e4c1 e4cf e4da ? - e500 e505 e50a e518 e55f e581 e587 e5b5 e5bb e5cf e5e5 e64f e6b8 e6c5 e6ea e719 e72d e742 e756 e800 e8c3 e8d8 e8e8 e8fa e912 e921 iobase Return I/O Base Address screen Return Screen Organization plot Read / Set Cursor X/Y Position cint1 Initialize I/O Clear Screen Home Cursor Set Screen Pointers Set I/O Defaults (Unused Entry) Set I/O Defaults lp2 Get Character From Keyboard Buffer Input From Keyboard Input From Screen or Keyboard Quotes Test Set Up Screen Print Advance Cursor Retreat Cursor Back on to Previous Line Output to Screen -unshifted characters-shifted charactersGo to Next Line Output <CR> Check Line Decrement Check Line Increment Set Colour Code Colour Code Table DATA DATA Unused Bytes For Future Patches EMPTY Serial Output 1 Serial Output 0 Get Serial Data And Clock In Get Secondary Address patch for Serial LOAD/VERIFY Relocated Load patch for Serial LOAD/VERIFY Tape Write patch for CLOSE Unused EMPTY e929 ? DATA e975 e9ee ea56 ea6e ea7e ea8d eaa1 eab2 eabf eb1e eb71 ec46 ec5e ec9f ece0 ed21 ed69 eda3 Scroll Screen Open A Space On The Screen Move A Screen Line Syncronise Colour Transfer Set Start of Line Clear Screen Line Print To Screen Syncronise Colour Pointer Main IRQ Entry Point scnkey Scan Keyboard Process Key Image Pointers to Keyboard decoding tables WORD Keyboard Decoding Table - Unshifted DATA Keyboard Decoding Table - Shifted DATA Keyboard Decoding Table - Commodore DATA Graphics/Text Control Keyboard Decoding Table DATA Keyboard Decoding Table - Control DATA ede4 edf4 edfd ee14 ee17 ee49 eeb4 eeb4 eeb7 Video Chip Set Up Table Shift-Run Equivalent DATA Low Byte Screen Line Addresses talk Send TALK Command on Serial Bus listn Send LISTEN Command on Serial Bus Send Data On Serial Bus Flag Errors Status #80 - device not present Status #03 - write timeout eec0 eec5 eece eed3 eee4 eef6 ef04 ef19 ef84 ef8d ef96 efa3 efee f016 f019 f021 f027 f036 f05b f068 f0bc f0ed second Send LISTEN Secondary Address Clear ATN tksa Send TALK Secondary Address Wait For Clock ciout Send Serial Deferred untlk Send UNTALK on Serial Bus unlsn Send UNLISTEN on Serial Bus acptr Receive From Serial Bus Serial Clock On Serial Clock Off Delay 1 ms RS-232 Send Send New RS-232 Byte 'No DSR' Error 'No CTS' Error Disable Timer Compute Bit Count RS-232 Receive Set Up To Receive Process RS-232 Byte Submit to RS-232 Send to RS-232 Buffer DATA DATA f116 f14f f160 - Input From RS-232 Get From RS-232 Serial Bus Idle f174 Table of Kernal I/O Messages ;f174 '<cr> i/o error #' ; ... ;f1df 'ok<cr>' f1e2 f1e6 f1f5 f20e f250 f27a f2c7 f309 f34a f3cf f3df f3ef f3f3 f40a f495 f4c7 f542 f549 f55c f5ca f647 f659 f66a f675 f685 f692 f6f1 f728 f734 f760 f767 f770 Print Message if Direct Print Message getin Get a byte chrin Input a byte Get From Tape / Serial / RS-232 chrout Output One Character chkin Set Input Device chkout Set Output Devic close Close File Find File Set File values clall Abort All Files clrchn Restore Default I/O open Open File Send Secondary Address Open RS-232 load Load RAM From Device LOAD -loadLoad File From Serial Bus Load File From Tape Print "SEARCHING" Print Filename Print "LOADING / VERIFYING" save Save RAM To Device SAVE -saveSave to Serial Bus Save to Tape Print "SAVING" udtim Increment Real-Time Clock rdtim Read Real-Time Clock settim Set Real-Time Clock STOP Check STOP Key ;f77e f77e f781 f784 f787 f78a f78d f790 f793 f796 Output I/O Error Messages 'too many files' 'file open' 'file not open' 'file not found' 'device not present' 'not input file' 'not output file' 'missing filename' 'illegal device number' f7af - Find Any Tape Header DATA f7e7 f84d f854 f867 f88a f894 f8ab f8b7 f8c0 f8e3 f8f4 f94b f95d f98e faad - fbd2 fbdb fbea fc06 fc95 fccf fcf6 fd08 fd11 fd1b fd22 fd3f fd4d fd52 fd57 fd6d fd8d fdf1 fdf9 fe39 fe49 fe50 fe57 fe66 fe6f fe73 fe82 fea9 fed2 ;fed2 Reset Tape Pointer New Character Setup Send Tone to Tape Write Data to Tape Write Tape Leader Restore Normal IRQ Set IRQ Vector Kill Tape Motor Check Read / Write Pointer Bump Read / Write Pointer Power-Up RESET Entry Check For A-ROM ROM Mask 'a0CBM' DATA restor Restore Kernal Vectors (at 0314) vector Change Vectors For User Kernal Reset Vectors WORD ramtas Initialise System Constants IRQ Vectors For Tape I/O WORD ioinit Initialise I/O Enable Timer setnam Set Filename setlfs Set Logical File Parameters readss Get I/O Status Word setmsg Control OS Messages settmo Set IEEE Timeout memtop Set / Read Top of Memory membot Set / Read Bottom of Memory NMI Transfer Entry Warm Start Basic [BRK] User Vector (default BRK) ff56 ff5b ff72 Write Tape Header Get Buffer Address Set Buffer Stat / End Pointers Find Specific Tape Header Bump Tape Pointer Print "PRESS PLAY ON TAPE" Check Tape Status Print "PRESS RECORD..." Initiate Tape Read Initiate Tape Write Common Tape Code Check Tape Stop Set Read Timing Read Tape Bits Store Tape Characters Exit Interrupt RS-232 Timing Table IRQ Transfer Entry ; ;ff8a Vic-20 Kernel Jump Table DATA ; ff8a ff8d ff90 ff93 ff96 ff99 ff9c ff9f ffa2 ffa5 ffa8 ffab ffae ffb1 ffb4 ffb7 ffba ffbd ffc0 ffc3 ffc6 ffc9 ffcc ffcf ffd2 ffd5 ffd8 ffdb ffde ffe1 ffe4 ffe7 ffea ffed fff0 fff3 jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp jmp $fd52 restor $fd57 vector $fe66 setmsg $eec0 secnd $eece tksa $fe73 memtop $fe82 membot $eb1e scnkey $fe6f settmo $ef19 acptr $eee4 ciout $eef6 untalk $ef04 unlsn $ee17 listn $ee14 talk $fe57 readss $fe50 setlfs $fe49 setnam ($031a) (iopen) ($031c) (iclose) ($031e) (ichkin) ($0320) (ichkout) ($0322) (iclrch) ($0324) (ichrin) ($0326) (ichrout) $f542 load $f675 save $f767 settim $f760 rdtim ($0328) (istop) ($032a) (igetin) ($032c) (iclall) $f734 udtim $e505 screen $e50a plot $e500 iobase ;fff6 Unused Vectors fff6 [ffff] fff8 [ffff] ;fffa fffa fffc fffe Transfer Vectors [fea9] NMI [fd22] RESET [ff72] IRQ Restore Vectors Change Vectors For User Control OS Messages Send SA After Listen Send SA After Talk Set/Read System RAM Top Set/Read System RAM Bottom Scan Keyboard Set Timeout In IEEE Handshake Serial Byte In Handshake Serial Byte Out Command Serial Bus UNTALK Command Serial Bus UNLISTEN Command Serial Bus LISTEN Command Serial Bus TALK Read I/O Status Word Set Logical File Parameters Set Filename Open Vector [F40A] Close Vector [F34A] Set Input [F2C7] Set Output [F309] Restore I/O Vector [F353] Input Vector, chrin [F20E] Output Vector, chrout [F27A] Load RAM From Device Save RAM To Device Set Real-Time Clock Read Real-Time Clock Test-Stop Vector [F770] Get From Keyboad [F1F5] Close All Channels And Files [F3EF] Increment Real-Time Clock Return Screen Organization Read / Set Cursor X/Y Position Return I/O Base Address