C64 TO C128 CROSS REFERENCE Compiled by Kevin Hopkins, Monticello, IL Note that this document is 93 columns wide. To print it out to your printer, you should place it into either 'Elite' (12 CPI) or 'Condensed' (15-17 CPI) mode. Some printers are not capable of this--so a few of the lines may wrap-around to the next available line. *******************************KERNAL ROM CROSS REFERENCE********************************** C64 C64 C128 C128 ADDR ROUTINE COMMENTS LABEL LABEL ADDR NOTE ******************************************************************************************* e4b7 Patch room for later kernal versions ------ ------ ---- e4d3 Patch to ef90 test if RS-232 start bit rec. ------ ------ e6d8 e4da Clear color RAM to color in background reg. ------ ------ c4b7 e4e0 Pause after finding a file on cassette ------ ------ e907 e4ec Baud rate table for PAL standard monitors ------ ------ e864 e500 Return base address of system I/O block IOBASE IOBASE f781 e505 Return screen size - rows in .y cols. in .x SCREEN SCRORG cc58 * c00f e50a Read/Set location of the cursor PLOT PLOT cc6a via c018 e518 Initialize screen and keyboard ------ CINT c07b *** c000 e544 Initialize screen line link tbl. & clear scr. ------ CLEAR c142 e566 Home the cursor ------ HOME c150 e56c Set pointer to current screen line ------ SETLINE c15c e5a0 Set default I/O devices & VIC default values ------ ------ e157 e5b4 Get character from keyboard buffer LP2 KEYIN c234 via c006 e5ca Wait for carriage return from keyboard ------ KEYLIN c258 e632 Input character from screen or keyboard ------ GETSCRN c29b * c009 e684 Test for quote marks ------ QUOTECK c2ff e691 Add a character to the screen ------ SETCHAR c320 e6a8 Return from outputting a character to screen ------ PRNTEXIT c30c e6b6 Update the cursor position ------ UDCRSR c33e e701 Move cursor back over 40 col. line boundary ------ RETREAT cc00 e716 Output to the screen (Main screen editor) ------ PRINT c72d via c00c e87c Move cursor to next line ------ NEXTLIN c363 e891 Output a carriage return ------ RTRN c76f e8a1 Move cursor to previous screen line ------ ------ c86d e8b3 Move cursor to next screen line ------ ------ c85d e8cb Check for a color change ------ COLORSET c7da e8da PETSCII color code equivalent table ------ COLORTBL ce4c e8ea Scroll screen ------ SCROLL cea6 e965 Insert a blank line on the screen ------ OPENLIN c37c e9c8 Move screen line ------ MOVLINE c40d (c41b) e9e0 Set temporary color pointer for scrolling ------ ------ c411 e9f0 Set starting addr pointer of current scr line ------ SETADDR c15e e9ff Clear screen line ------ CLRLINE c4a5 ea13 Set cursor blink timing & color mem. addr. ------ DISPLY cc34 * c003 ea1c Store to screen ------ ------ cc3e ea24 Synchronize color RAM pt. to Screen line pt. ------ ------ c17c ea31 IRQ interrupt entry ------ IRQ fa65 ea81 Interrupt exit (C64 see also febc) ------ CRTI ff33 ea87 Read the keyboard SCNKEY SCNKEY c55d * c012 eae0 Decode keystroke put ASCII value in keybuff. ------ REPEAT c651 * c015 eb48 Set up proper keyboard decode table ------ ------ c60a eb64 Load & evaluate decoder table of shift patrn ------ ------ c62f eb79 Keyboard decode table vectors ------ KEYPTRS c06f eb81 Standard keyboard matrix decode table ------ ------ fa80 ebc2 Shifted keyboard matrix decode table ------ ------ fad9 ec03 Commodore logo keyboard matrix decode table ------ ------ fb32 ec44 Set lowercase/uppercase or uppercase/graphics ------ ------ c880 ec5e Set flag to enable-disable switching chr set ------ ------ c8a6 ec78 Control keyboard matrix decode table ------ ------ fb8b ecb9 Video chip register default table ------ ------ e2c7 ece7 Text for keybrd buffer when SHIFT/RUN pressed ------ ------ cee7 ecf0 Low byte table of screen line addresses ------ SADDRTBL c033 ed09 Send TALK to a device on the serial buss TALK TALK e33b ed0c Send LISTEN to a device on the serial buss LISTEN LISTEN e33e ed11 Send command code to device on serial buss ------ ------ e343 ed40 Send a byte on the serial buss ------ ------ e38c edad Set status word ------ ------ e425 edb9 Send 2nd addr to dev on ser buss after LISTEN SECOND SECOND e4d2 edbe Set serial ATN line low (inverted to active) ------ ------ e4d7 edc7 Send 2nd addr to dev on ser buss after TALK TKSA TKSA e4e0 eddd Send a byte to I/O device over serial buss CIOUT CIOUT e503 edef Send UNTALK to a device on serial buss UNTLK UNTLK e515 edfe Send UNLISTEN to a device on serial buss UNLSN UNLSN e526 ee13 Receive data byte from device on serial buss ACPTR ACPTR e43e ee85 Set serial clock line low (inverted to active)------ ------ e545 ee8e Set serial clock line high (inverted inactive)------ ------ e54e ee97 Set serial buss data output line low (invt hi)------ ------ e557 eea0 Set serial buss data output line high (inv lo)------ ------ e560 eea9 Get serial buss data & clock pulse input bits ------ ------ e569 eeb3 Perform an approximate one-millisecond delay ------ ------ e597 (e385) eebb Transmit RS-232 bit (NMI interrupt driven) ------ ------ e5ff eed7 Prepare parity bit & set stop bits counter ------ ------ e61b ef00 Prepare to send stop bit ------ ------ e644 ef06 Prepare to send next byte ------ ------ e64a ef2e Handle RS-232 errors while transmitting ------ ------ e672 ef4a Set word length for current RS-232 character ------ ------ e68e ef59 Receive next RS-232 bit (NMI) ------ ------ e69d ef6e Test for stop bit ------ ------ e6b2 ef7e Setup to receive a new byte from RS-232 ------ ------ e6c2 ef90 Test if start bit received from RS-232 ------ ------ e6d4 ef97 Put a byte of receive data into RS-232 inbuff ------ ------ e6df efb3 Check parity of received byte ------ ------ e6fb efc7 Handle errors while receiving from RS-232 dev ------ ------ e70f efdb Check for framing/break error ------ ------ e723 efe1 CHKOUT for the RS-232 device ------ ------ e729 f014 Store character in transmit buffer ------ ------ e75c f02e Prepare Timer A/Timer 1 interrupt for RS-232 ------ ------ e776 f04d CHKIN for the RS-232 device ------ ------ e795 f086 Get character from RS-232 receive buffer ------ ------ e7ce f0a4 Stop CIA#2 RS-232 NMIs for serial/cassette rt ------ ------ e7ec f0bd Kernal control messages ------ ------ f6b0 f12b Print kernal error messages if in direct mode ------ ------ f71e f13e Get one byte from the input device GETIN GETIN eeeb f14e GETIN from the RS-232 device ------ ------ eefd f157 Input a character from the current device CHRIN BASIN ef06 f179 CHRIN from Tape ------ ------ ef28 f199 Return byte from tape buffer ------ ------ ef48 f1ad Get character from serial input channel ------ ------ ef5c f1b8 CHRIN from RS-232 device ------ ------ ef67 f1ca Output a byte CHROUT BSOUT ef79 f1dc CHROUT to tape ------ ------ ef8b f208 CHROUT to RS-232 device ------ ------ efb7 f20e Designate a logical file as current input chn CHKIN CHKIN f106 f237 Open serial input channel ------ ------ f127 f250 Designate a logical file as current output ch CHKOUT CKOUT f14c f279 Open serial output channel ------ ------ f16d f291 Determine device for CLOSE CLOSE CLOSE f188 f2ab Close a logical I/O file for RS-232 device ------ ------ f1a2 f2c8 Close a logical I/O file for tape ------ ------ f1a9 f2ee Close a logical I/O file for serial device ------ ------ f1cf f2f1 Common exit for close logical file ------ ------ f1e4 f30f Find the file in the logical file table ------ ------ f202 f31f Set current logical file, device, 2ndary addr ------ ------ f212 f32f Close all logical I/O files CLALL CLALL f222 f333 Restore current I & O devices to default devs CLRCHN CLRCH f226 f34a Open a logical I/O file OPEN OPEN efbd f49e Load RAM from a device LOAD LOAD f265 f5af Print SEARCHING message if in direct mode ------ ------ f50f f5c1 Print filename ------ ------ f521 f5d2 Print LOADING or VERIFYING ------ ------ f533 f5dd Save RAM to a device SAVE SAVE f53e f68f Print SAVING & filename if in direct mode ------ ------ f5bc f69b Update software clock & check for STOP key UDTIM UDTIM f5f8 f6dd Read time from software clock into .A,.X,.Y RDTIM RDTIM f65e f6e4 Set the software clock from .A,.X,.Y SETTIM SETTIM f665 f6ed Test STOP key STOP STOP f66e f6fb Set kernal I/O error message ------ ------ f67c f72c Get next tape file header from cassette ------ ------ e8d0 f76a Write tape file header block ------ ------ e919 f7d0 Put pointer to tape buffer in .X & .Y reg. ------ ------ e980 f7d7 Set I/O area start & end pnts to tape buffer ------ ------ e987 f7ea Search tape for filename ------ ------ e99a f80d Increment count of number of chrs in tape buf ------ ------ e9be f817 Test cass. butt's & handle mess for tape read ------ ------ e9c8 f82e Check cassette switch ------ ------ e9df f838 Test cass. but's & handle mess for tape write ------ ------ e9e9 f841 Read tape header into buffer ------ ------ e9f2 f84a Load next two blocks of data from cassette ------ ------ e9fb f864 Write tape buffer to tape ------ ------ ea15 f875 Common code for read/writing tape data block ------ ------ ea26 f8d0 Test STOP key during cassette I/O operations ------ ------ ea8f f8e2 Adjust CIA#1 Timer A for Tape Bit Timing ------ ------ eaa1 f92c Read tape Data (IRQ) ------ ------ eaeb fa60 Receive & store next character from cassette ------ ------ ec1f fb8e Move tape SAVE/LOAD addr. into pointer ($ac) ------ ------ ed51 fb97 Reset counters for read/writing a new byte ------ ------ ed5a fba6 Toggle the tape data output line ------ ------ ed69 fbc8 Write data to cassette - part 2 (IRQ) ------ ------ ed8b fc6a Write data to cassette - part 1 (IRQ) ------ ------ ee2e fc93 Restores the default IRQ routine ------ ------ ee57 fcb8 Terminate cassette I/O ------ ------ ee95 fcbd Set the IRQ vector for tape operations ------ ------ ee9b fcca Turn off the tape motor ------ ------ eeb0 fcd1 Check the tape read/write pointer ------ ------ eeb7 fcdb Advance the tape read/write pointer ------ ------ eec1 fce2 Power-on reset routine ------ RESET e000 fd02 Check for autostart cartridge ------ ------ e1f0 and e242 fd10 Text for autostart cartridge check ------ ------ e2c4 fd15 Restore RAM vectors for default I/O routines RESTOR RESTOR e056 fd1a Set RAM vector table from table pnt in .X,.Y VECTOR VECTOR e05b fd30 Table of RAM vectors to default I/O routines ------ ------ e073 fd50 Perform RAM test & set pntrs to RAM top/bot RAMTAS RAMTAS e093 fd9b Table of tape IRQ vectors ------ ------ eea8 fda3 Initialize CIA I/O devices IOINIT IOINIT e109 fdf9 Set filename parameters SETNAM SETNAN f731 fe00 Set logical file num, device num & 2nd addr SETLFS SETLFS f738 fe07 Read the I/O Status Word READST READST f744 fe18 Set the kernal message control flag SETMSG SETMSG f75c fe21 Set time-out flag for IEEE bus SETTMO SETTMO f75f fe25 Read/Set top of RAM pointer MEMTOP MEMTOP f763 fe34 Read/Set bottom of RAM pointer MEMBOT MEMBOT f772 fe43 NMI interrupt entry point ------ NMI fa40 * ff05 fe66 BRK routine ------ MONBRK b009 fe66 Warm start routine ------ ------ fa53 fe72 NMI RS-232 handler ------ ------ e805 fec2 RS-232 baud rate tables for US TV (NTSC) ------ ------ e850 fed6 RS-232 receive the next bit (NMI) ------ ------ e878 ff07 RS-232 byte reception initiator ------ ------ e8a9 ff48 Main IRQ/BRK interrupt entry point ------ JIRQ ff17 ff5b initialize VICII & set PAL/NTSC flag CINT CINT c07b via c000 ff6e initialize CIA#1 timer A generated IRQs ------ ------ e1b8 using rasters ff80 Kernal version identifier byte ------ ------ ff80 ******************************************************************************************* Jump table for operating system: ff81 to ff5b jmp to CINT ------ JCINT ff81 to c000 to c07b ff84 to fda3 jmp to IOINIT ------ JIOINIT ff84 to e109 ff87 to fd50 jmp to RAMTAS ------ JRAMTAS ff87 to e093 ff8a to fd15 jmp to RESTOR ------ JRESTOR ff8a to e056 ff8d to fd1a jmp to VECTOR ------ JVECTOR ff8d to e05b ff90 to fe18 jmp to SETMSG ------ JSETMSG ff90 to f75c ff93 to edb9 jmp to SECOND ------ JSECOND ff93 to e4d2 ff96 to edc7 jmp to TKSA ------ JTKSA ff96 to e4e0 ff99 to fe25 jmp to MEMTOP ------ JMEMTOP ff99 to f763 ff9c to fe34 jmp to MEMBOT ------ JMEMBOT ff9c to f772 ff9f to ea87 jmp to SCNKEY ------ JKEY ff9f to c012 to c55d ffa2 to fe21 jmp to SETTMO ------ JSETTMO ffa2 to f75f ffa5 to ee13 jmp to ACPTR ------ JACPTR ffa5 to e43e ffa8 to eddd jmp to CIOUT ------ JCIOUT ffa8 to e503 ffab to edef jmp to UNTLK ------ JUNTLK ffab to e515 ffae to edfe jmp to UNLSN ------ JUNLSN ffae to e526 ffb1 to ed0c jmp to LISTEN ------ JLISTN ffb1 to e33e ffb4 to ed09 jmp to TALK ------ JTALK ffb4 to e33b ffb7 to fe07 jmp to READST ------ JREADST ffb7 to f744 ffba to fe00 jmp to SETLFS ------ JSETLFS ffba to f738 ffbd to fdf9 jmp to SETNAM ------ JSETNAM ffbd to f731 ffc0 to f34a jmp thru (IOPEN) at (031a) to OPEN ------ JOPEN ffc0 to efbd ffc3 to f291 jmp thru (ICLOSE) at (031c) to CLOSE ------ JCLOSE ffc3 to f188 ffc6 to f20e jmp thru (ICHKIN) at (031e) to CHKIN ------ JCHKIN ffc6 to f106 ffc9 to f250 jmp thru (ICKOUT) at (0320) to CHKOUT ------ JCKOUT ffc9 to f14c ffcc to f333 jmp thru (ICLRCH) at (0322) to CLRCHN ------ JCLRCH ffcc to f226 ffcf to f157 jmp thru (IBASIN) at (0324) to CHRIN ------ JBASIN ffcf to ef06 ffd2 to f1ca jmp thru (IBSOUT) at (0326) to CHROUT ------ JBSOUT ffd2 to ef79 ffd5 to f49e jmp to LOAD ------ JLOAD ffd5 to f265 ffd8 to f5dd jmp to SAVE ------ JSAVE ffd8 to f53e ffdb to f6e4 jmp to SETTIM ------ JSETTIM ffdb to f665 ffde to f6dd jmp to RDTIM ------ JRDTIM ffde to f65e ffe1 to f6ed jmp thru (ISTOP) at (0328) to STOP ------ JSTOP ffe1 to f66e ffe4 to f13e jmp thru (IGETIN) at (032a) to GETIN ------ JGETIN ffe4 to eeeb ffe7 to f32f jmp thru (ICLALL) at (032c) to CLALL ------ JCLALL ffe7 to f222 ffea to f69b jmp to UDTIM ------ JUDTIM ffea to f5f8 ffed to e505 jmp to SCREEN ------ JSCRORG ffed to c00f to cc5b fff0 to e50a jmp to PLOT ------ JPLOT fff0 to c018 to cc6a fff3 to e500 jmp to IOBASE ------ JIOBASE fff3 to f781 ******************************************************************************************* Hardware vectors: fffa to fe43 Non-maskable interrupt vector ------ NMI fffa to ff05 fffc to fce2 System reset hardware vector ------ RESET fffc to ff3d fffe to ff48 Maskable interrupt request & BRK ------ IRQ/BRK fffe to ff17 ******************************************************************************************* Bibliography: Mapping the Commodore 64; by Sheldon Leemon (Compute! Books) Mapping the Commodore 128; by Ottis R. Cowper (Compute! Books) Compute!'s VIC-20 and Commodore 64 TOOL KIT: BASIC; by Dan Heeb (Compute! Books) Compute!'s VIC-20 and Commodore 64 TOOL KIT: KERNAL; by Dan Heeb (Compute! Books) The Anatomy of Commodore 64; by Angerhausen, Becker, Englisch and Gerits (Abacus) Commodore 128 BASIC 7.0 Internals; by Jarvis and Springer (Abacus) Commodore 128 Internals; by Gerits, Schrieb and Thrun (Abacus)