This the multi-page printable view of this section.Click here to print.

Return to the regular view of this page.

Kernal Calls

Official OS calls

Table of Contents

The entries below are the official1 Kernal entry points for the Commodore 64.

1 - Except for CLRLN & CLSR which are from the ROM disassembly but are useful.

Files

CLALL Close all open files
CLOSE Close a logical file
LOAD Load memory from a device
OPEN Open a logical file
SAVE Save memory to a device
SETLFS Setup a logical file
SETNAM Set file name

Channels

CHKIN Open channel for input
CHKOUT Open channel for output
CHRIN Get a character from the input channel
CHROUT Output a character
CLRCHN Clear I/O channels
READST Read status word

IEEE Serial Bus

ACPTR Get data from the serial bus
CIOUT Transmit a byte over the serial bus
LISTEN Command a device on serial bus to LISTEN
SECOND Send secondary address for LISTEN
SETTMO Set IEEE bus card timeout
TALK Command a device on serial bus to TALK
TKSA Send secondary address to a device commanded to TALK
UNLSN Send an UNLISTEN command
UNTLK Send an UNTALK command

Keyboard

GETIN Get a character
SCNKEY Scan the keyboard
STOP Check if key/stop key is pressed

Memory

IOBASE Define I/O memory page
MEMBOT Set bottom of memory
MEMTOP Set top of memory
RAMTAS Perform RAM test

Screen

CLRLN Clear the line X
CLSR Clear the screen
PLOT Set cursor location
SCREEN Return screen format
SETMSG Control system message output

System

CINT Initialise screen editor
IOINIT Initialise I/O Devices
RESTOR Restore default system & interrup vectors
VECTOR Manage RAM Vectors

Time

RDTIM Read system clock
SETTIM Set system clock
UDTIM Update system clock

1 - ACPTR

Get data from the serial bus
Function AddressDescription
ACPTR FFA5Get data from the serial bus

This routine gets a byte of data off the serial bus using full handshaking. The data is returned in the accumulator.

To prepare for this routine the TALK routine must be called first to command the device on the serial bus to send data through the bus. If the input device needs a secondary command, it must be sent by using the TKSA routine before calling this routine.

Errors are returned in the status word. The READST routine is used to read the status word.

Example:
JSRACPTRGet a byte from the bus
STAdata

2 - CHKIN

Open channel for input
Function AddressVectorDescription
CHKIN FFC6031EOpen channel for input

Any logical file number that has been created by the OPEN routine can be defined as an input channel. Of course, the device you intend opening a channel to must be an input device. Otherwise, an error will occur, and the routine will be aborted.

If you are getting data from anywhere other than the keyboard, this routine must be called before using either the CHRIN or the GETIN routines for data input. If you want to use the input from the keyboard, and no other input channels are opened, then the calls to this routine, and to the OPEN routine are not needed.

Example:
LDX#2Define logical file 2 as an input channel
JSRCHKIN

3 - CHKOUT

Open channel for output
Function AddressVectorDescription
CHKOUT FFC90320Open channel for output

Any logical file number that has been created by the OPEN routine can be defined as an output channel. Of course, the device you intend opening a channel to must be an output device. Otherwise, an error will occur, and the routine will be aborted.

This routine must be called before any data is sent to any output device unless you want to use the screen as your output device. If screen output is desired, and there are no other output channels already defined, then calls to this routine, and to the OPEN routine are not needed.

Example:
LDX#3Define logical file 3 as an output channel
JSRCHKOUT

4 - CHRIN

Get a character from the input channel
Function AddressDescription
CHRIN FFCFGet a character from the input channel

This routine gets a byte of data from a channel already set up as the input channel by the CHKIN routine. If CHKIN has NOT been used to define another input channel, then all your data is expected from the keyboard.

The data byte is returned in the accumulator. The Y index register is unchanged and is usually used in a loop to store received characters.

The channel remains open after the call.

Reading from the Keyboard

Input from the keyboard is handled in a special way. First, the cursor is turned on, and blinks until a carriage return is typed on the keyboard. All characters on the line can be retrieved one at a time by calling this routine once for each character. When the carriage return is retrieved, the entire line has been processed. The next time this routine is called, the whole process begins again, i.e., by flashing the cursor.

Example:

.readLine   LDY #0              ; Prepare Y register to store data
.readLoop   JSR CHRIN           ; Get next character
            STA BUF,Y           ; Store in BUF (0x200 89 byte basic input buffer)
            INY
            CMP #0x0D           ; Carriage Return
            BNE readLoop        ; Loop back for next character
            RTS
Example:
readLineLDY#0Prepare Y register to store data
readLoopJSRCHRINGet next character
STABUF,YStore in BUF (0x200 89 byte basic input buffer)
INY
CMP#0x0DCheck for Carriage Return
BNEreadLoopLoop back to the next character
RTS

This example does no bounds checking so if more than 89 characters are read it will overwrite the Kernal workspace in page 2.

Reading from other devices

Here you need to call OPEN and CHKIN first before calling CHRIN.

5 - CHROUT

Output a character
Function AddressVectorDescription
CHROUT FFD20326Output a character

This routine outputs a character to an already opened channel. Use the OPEN and CHKOUT routines to set up the output channel before calling this routine. If this call is omitted, data is sent to the default output device (number 3, the screen).

The data byte to be output is loaded into the accumulator, and this routine is called. The data is then sent to the specified output device. The channel is left open after the call.

Care must be taken when using this routine to send data to a specific serial device since data will be sent to all open output channels on the bus.

Unless this is desired, all open output channels on the serial bus other than the intended destination channel must be closed by a call to the CLRCHN routine.

Example:
LDX#4Logical file 4
JSRCHKOUTOpen channel 4 for output
LDA#'A'
JSRCHROUTSend character
JMPCLRCHNClear all I/O channels so future output goes to screen

6 - CINT

Initialise screen editor
Function AddressDescription
CINT FF81Initialise screen editor

This routine sets up the VIC-II chip, clear the screen, set the cursor pointer and the screen editor.

Normally, this routine is called as part of the initialization process of a Commodore 64 program cartridge.

7 - CIOUT

Transmit a byte over the serial bus
Function AddressDescription
CIOUT FFA8Transmit a byte over the serial bus

This routine is used to send information to devices on the serial bus. A call to this routine will put a data byte onto the serial bus using full serial handshaking.

Before this routine is called, the LISTEN routine must be used to command a device on the serial bus to get ready to receive data. If a device needs a secondary address, it must also be sent by using the SECOND routine.

The accumulator is loaded with a byte to handshake as data on the serial bus. A device must be listening or the status word will return a timeout.

This routine always buffers one character. (The routine holds the previous character to be sent back.) So when a call to the UNLSN routine is made to end the data transmission, the buffered character is sent with an End Or Identify (EOI) set. Then the UNLSN command is sent to the device.

Example:
LDA#'X'Send 'X' to the serial bus
JSRCIOUT

8 - CLALL

Close all open files
Function AddressVectorDescription
CLALL FFE7032CClose all open files

This routine closes all open files. When this routine is called, the pointers into the open file table are reset, closing all files.

Also, the CLRCHN routine is automatically called to reset the I/O channels.

9 - CLOSE

Close a logical file
Function AddressVectorDescription
CLOSE FFC3031CClose a logical file

This routine is used to close a logical file after all I/O operations have been completed on that file. This routine is called after the accumulator is loaded with the logical file number to be closed - the same number used when the file was opened using the OPEN routine.

Example:
LDA#15Close logical file 15
JSRCLOSE

10 - CLRCHN

Clear I/O channels
Function AddressVectorDescription
CLRCHN FFCC0322Clear I/O channels

This routine is called to clear all open channels and restore the I/O channels to their original default values.

It is usually called after opening other I/O channels like a tape or disk drive and using them for input/output operations. The default input device is 0 (keyboard). The default output device is 3 (screen).

This routine is automatically called when the CLALL routine is executed.

11 - CLRLN

Clear the line X
Function AddressDescription
CLRLN E9FFClear the line X

This routine clears the line pointed to by X.

This is not an official documented Kernal entry point but is listed in the C64 ROM disassembly.

12 - CLSR

Clear the screen
Function AddressDescription
CLSR E544Clear the screen

This routine sets up the screen line link table (0x00D9…0x00F2). It then clears the screen line by line using the CLRLN routine. Once that's completed, it then homes the cursor to the top left.

This is not an official documented Kernal entry point but is listed in the C64 ROM disassembly.

13 - GETIN

Get a character
Function AddressVectorDescription
GETIN FFE4032AGet a character

If the input channel is the keyboard, this subroutine removes one character from the keyboard queue and returns it as an ASCII value in the accumulator. If the queue is empty, the value returned in the accumulator will be zero.

Characters are put into the queue automatically by an interrupt driven keyboard scan routine which calls the SCNKEY routine. The keyboard buffer can hold up to ten characters. After the buffer is filled, additional characters are ignored until at least one character has been removed from the queue.

If the channel is RS-232, then only the A register is used and a single character is returned. See READST to check validity.

If the channel is serial, cassette, or screen, call BASIN routine.

See also

CHKIN, OPEN, READST

14 - IOBASE

Define I/O memory page
Function AddressDescription
IOBASE FFF3Define I/O memory page

This routine sets the X and Y registers to the address of the memory section where the memory mapped 110 devices are located. This address can then be used with an offset to access the memory mapped I/O devices in the Commodore 64. The offset is the number of locations from the beginning of the page on which the I/O register you want is located. The X register contains the low order address byte, while the Y register contains the high order address byte.

This routine exists to provide compatibility between the Commodore 64, VIC-20, and potential future models of the Commodore 64. If the I/O locations for a machine language program are set by a call to this routine, they should still remain compatible with future versions of the Commodore 64, the KERNAL and BASIC.

Example:
JSRIOBASESet the Data Direction Register (DDR) of user port
STXFREKZPStore base address
STYFREKZP+1
LDA#0New value of User Port DDR
LDY#2Offset to DDR of User Port
STA(FREKZP),YSet the register
RTS

Note: FREKZP (0x00FB) in this example is a 4 byte block of zeropage memory unused by Basic or Kernal and is available for user code.

For the C64 the value returned is 0xDC00 - address of CLA #1

For the C128 the value returned is 0xD000 - address of the VIC chip

15 - IOINIT

Initialise I/O Devices
Function AddressDescription
IOINIT FF84Initialise I/O Devices

This routine initializes all input/output devices and routines.

It is normally called as part of the initialization procedure of a Commodore 64 program cartridge.

16 - LISTEN

Command a device on serial bus to LISTEN
Function AddressDescription
LISTEN FFB1Command a device on serial bus to LISTEN

This routine will command a device on the serial bus to receive data. The accumulator must first be loaded with a device number between 0 and 31. When called, this routine then ORs bit by bit to convert this device number to a talk address. The specified device will then go into listen mode, and be ready to accept information.

Example:
LDA#8Command device #8 to listen
JSRLISTEN

17 - LOAD

Load memory from a device
Function AddressVectorDescription
LOAD FFD50330Load memory from a device

This routine LOADs data bytes from any input device directly into the memory. It can also be used for a verify operation, comparing data from a device with the data already in memory, while leaving the data stored in RAM unchanged.

To use, you first need to call SETLFS to set the device to save to. Then SETNAM must be called to set the filename.

The accumulator must be set to 0 for a load or 1 for a verify operation.

If the input device is opened with a secondary address of 0, the header information from the device is ignored. In this case the X & Y registers must contain the starting address for the load.

With a secondary address of 1 the data is loaded into memory starting at the location specified by the header.

This routine returns the highest address of the data loaded on exit.

You cannot load from devices 0 (keyboard), 2 (RS-232) or 3 (Screen).
Example:
fileNameEQUS"TESTCARD"Filename to load
fileNameEnd
loadFileLDA#8Logical File Number
LDX#8Device 8 = Disk
LDY#1Secondary address 1 = Use address stored in the file
LDA#fileNameEnd-fileNamelength of fileName
LDX#<fileNameAddress if fileName
LDY#>fileName
LDA#00=Load operation
JSRLOAD
STXendAddressOptional, save address after the loaded data
STYendAddress+1
RTS
endAddressEQUW0Address after our loaded data

18 - MEMBOT

Set bottom of memory
Function AddressDescription
MEMBOT FF9CSet bottom of memory

This routine reads or writes the bottom of memory.

When the Carry flag is set then the bottom memory address is read into the X, Y index registers.

When the Carry flag is clear then the bottom memory address is set to the address in the X, Y index registers.

The value is stored in the MEMSTR variable at 0x281.

Default values

Machine Value
C64 0x0800
V20 unexpanded 0x1000
V20 with 3K expansion 0x0400
V20 with 8K or more 0x1200
Example:
Move bottom of memory up 1 page
SECRead memory bottom
JSRMEMBOT
INY
CLCWrite memory bottom
JSRMEMBOT

19 - MEMTOP

Set top of memory
Function AddressDescription
MEMTOP FF99Set top of memory

This routine reads or writes the top of memory.

When the Carry flag is set then the top memory address is read into the X, Y index registers.

When the Carry flag is clear then the top memory address is set to the address in the X, Y index registers.

The value is stored in the MEMSIZ variable at 0x283.

20 - OPEN

Open a logical file
Function AddressVectorDescription
OPEN FFC0031AOpen a logical file

This routine is used to OPEN a logical file. Once the logical file is set up, it can be used for input/output operations.

Most of the I/O routines call on this routine to create the logical files to operate on. No arguments need to be set up to use this routine, but both the SETLFS and SETNAM routines must be called before using this routine.

Example:
openFileEquivalent of Basic: OPEN 15,8,15,"I/O"
LDA#filenameEnd-filenameLength of filename
LDX#<filenameAddress of filename
LDY#>filename
JSRSETNAMSet filename
LDA#15Logical file number
LDX#8Device number, 8 = disk
LDY#15Secondary address
JSRSETLFSSetup logical file
JMPOPENOpen the logical file
filenameEQUS"I/O"Filename
filenameEnd

21 - PLOT

Set cursor location
Function AddressDescription
PLOT FFF0Set cursor location

This routine either reads or sets the text cursor's location.

Reading cursor location

A call to this routine with the accumulator carry flag set loads the current position of the cursor on the screen (in X,Y coordinates) into the Y and X registers. Y is the column number of the cursor location (0-39), and X is the row number of the location of the cursor (0-24).

Example:
getCurPosGet current cursor position
SECSet Carry to read the text position
JSRPLOT
STXFREKZPStore the Row (0..24)
STYFREKZP+1Store the Column (0..39)
RTS

Note: FREKZP (0x00FB) in this example is a 4 byte block of zeropage memory unused by Basic or Kernal and is available for user code.

Setting cursor location

A call with the carry bit clear moves the cursor to X,Y as determined by the Y and X registers.

Example:

Example:
setCurPosSet the cursor position to Row 10 Column 5
CLCClear Carry to set the text position
LDX#10We want Row 10
LDY#5Column 5
JMPPLOT

22 - RAMTAS

Perform RAM test
Function AddressDescription
RAMTAS FF87Perform RAM test

This routine is used to test RAM and set the top and bottom of memory pointers accordingly.

It clears locations &00 to &0101 and &0200 to &03FF. It then allocates the cassette buffer, and sets the screen base to $0400.

Normally, this routine is called as part of the initialization process of a Commodore 64 program cartridge.

23 - RDTIM

Read system clock
Function AddressDescription
RDTIM FFDERead system clock

This routine is used to read the system clock. The clock's resolution is a 60th of a second. Three bytes are returned by the routine. The accumulator contains the most significant byte, the X index register contains the next most significant byte, and the Y index register contains the least significant byte.

Example:
readClockRead the system clock and store in zero page
JSRRDTIM
STYFREKZPLeast significant byte
STXFREKZP+1
STAFREKZP+2Most significant byte
RTS

Note: FREKZP (0x00FB) in this example is a 4 byte block of zeropage memory unused by Basic or Kernal and is available for user code.

24 - READST

Read status word
Function AddressDescription
READST FFB7Read status word

This routine returns the current status of the I/O devices in the accumulator. The routine is usually called after new communication to an I/O device. The routine gives you information about device status, or errors that have occurred during the I/O operation.

The bits returned in the accumulator contain the following information:

Bit Cassette Read Serial Bus R/W Tape Verify/Load
0 write timeout
1 read timeout
2 short block short block
3 long block long block
4 unrecoverable read error any mismatch
5 checksum error checksum error
6 end of file EOI line
7 end of tape device not present end of tape
Example:
JSRREADSTCheck for end of file during read
AND#&40Check bit 6
BNEeofDetectedBranch on EOF

25 - RESTOR

Restore default system & interrup vectors
Function AddressDescription
RESTOR FF8ARestore default system & interrup vectors

This routine restores the default values of all system vectors used in KERNAL and BASIC routines and interrupts.

See the Memory Map for the default vector contents.

The VECTOR routine is used to read and alter individual system vectors.

26 - SAVE

Save memory to a device
Function AddressVectorDescription
SAVE FFD80332Save memory to a device

This routine saves a section of memory to a device.

To use, you first need to call SETLFS to set the device to save to. Then SETNAM must be called to set the filename.

Finally you store the start address in 2 bytes of zero page memory, set X & Y to point to the address immediately after the data to save, and A to the offset within zeropage where the start address was stored.

Any errors are reported via the READST routine.

You cannot save to devices 0 (keyboard), 2 (RS-232) or 3 (Screen).
Example:
saveFileLDA#1Select device 1 = Cassette
LDA#0Set no file name, valid for cassette only
LDA#<startAddressStart address low byte
STAFREEKZPStore in Zero Page.
LDA#>startAddressStart address high byte
STAFREEKZP+1
LDX#<endAddressEnd address low byte
LDY#>endAddressEnd address high byte
LDA#<FREEKZPZero page offset to FREEKZP
JMPSAVESave the file

Note: FREKZP (0x00FB) in this example is a 4 byte block of zeropage memory unused by Basic or Kernal and is available for user code.

27 - SCNKEY

Scan the keyboard
Function AddressDescription
SCNKEY FF9FScan the keyboard

This routine scans the Commodore 64 keyboard and checks for pressed keys. It is the same routine called by the interrupt handler. If a key is down, its ASCII value is placed in the keyboard queue. This routine is called only if the normal IRQ interrupt is bypassed.

Example:
getKeyJSRSCNKEYScan keyboard
JSRGETINGet character
CMP#0Have we got a character?
BEQgetKeyNo then loop back
JMPCHROUTPrint it to the screen

28 - SCREEN

Return screen format
Function AddressDescription
SCREEN FFEDReturn screen format

This routine returns the format of the screen, e.g., 40 columns in X and 25 lines in Y. The routine can be used to determine what machine a program is running on. This function has been implemented on the Commodore 64 to help upward compatibility of your programs.

Example:
JSRSCREEN
STXMAXCOL
STYMAXROW

29 - SECOND

Send secondary address for LISTEN
Function AddressDescription
SECOND FF93Send secondary address for LISTEN

This routine transmits a secondary address on the serial bus for a LISTEN device. The routine sends this number as a secondary address command over the serial bus. This routine can only be called after a call to the LISTEN routine. It will not work after a TALK.

Example:
LDA#8Command device #8 to listen with command #15
LDA#15
JSRSECOND

30 - SETLFS

Setup a logical file
Function AddressDescription
SETLFS FFBASetup a logical file

This routine sets the logical file number, device address, and secondary address (command number) for other KERNAL routines.

The logical file number is used by the system as a key to the file table created by the OPEN file routine. Device addresses can range from 0 to 31. The following codes are used by the Commodore 64 to stand for the CBM devices listed below:

Address Device
0 Keyboard
1 Cassette / Datassette
2 RS232
3 Screen
4 Printer
8 Disk drive
9 Disk drive

Device numbers 4 or greater automatically refer to devices on the serial bus.

A command to the device is sent as a secondary address on the serial bus after the device number is sent during the serial attention handshaking sequence. If no secondary address is to be sent, the Y index register should be set to 255.

Example:
LDA#15Logical file number
LDX#8Device number, 8 = disk
LDY#15Secondary address
JSRSETLFSSetup logical file

31 - SETMSG

Control system message output
Function AddressDescription
SETMSG FF90Control system message output

This routine controls the printing of error and control messages by the KERNAL. Either print error messages or print control messages can be selected by setting the accumulator when the routine is called. FILE NOT FOUND is an example of an error message. PRESS PLAY ON CASSETTE is an example of a control message.

Bits 6 and 7 of this value determine where the message will come from.

If bit 7 is 1, one of the error messages from the KERNAL is printed.

If bit 6 is set, control messages are printed.

If this is set to 0 then all kernal messages are disabled.

32 - SETNAM

Set file name
Function AddressDescription
SETNAM FFBDSet file name

This routine is used to set up the file name for the OPEN, SAVE, or LOAD routines.

The accumulator must be loaded with the length of the file name. The X and Y registers must be loaded with the address of the file name, in standard 6502 low-byte/high-byte format.

The address can be any valid memory address in the system where a string of characters for the file name is stored.

If no file name is desired, the accumulator must be set to 0, representing a zero file length. The X and Y registers can be set to any memory address in that case.

Example:
LDA#filenameEnd-filenameLength of filename
LDX#<filenameAddress of filename
LDY#>filename
JSRSETNAMSet filename
filenameEQUS"I/O"Filename
filenameEnd

33 - SETTIM

Set system clock
Function AddressDescription
SETTIM FFDBSet system clock

A system clock is maintained by an interrupt routine that updates the clock every 1/60th of a second (one "jiffy"). The clock is three bytes long, which gives it the capability to count up to 5,184,000 jiffies (24 hours). At that point the clock resets to zero.

Before calling this routine to set the clock, the accumulator must contain the most significant byte, the X index register the next most significant byte, and the Y index register the least significant byte of the initial time setting (in jiffies).

Example:
setClockSet clock to 10 minutes = 600 seconds = 3600 jiffies
LDA#0Most significant byte
LDX#>3600
LDY#<3600Least significant byte
JMPSETTIM

34 - SETTMO

Set IEEE bus card timeout
Function AddressDescription
SETTMO FFA2Set IEEE bus card timeout

This routine sets the timeout flag for the IEEE bus. When the timeout flag is set, the Commodore 64 will wait for a device on the IEEE port for 64 milliseconds. If the device does not respond to the Commodore 64's Data Address Valid (DAV) signal within that time the Commodore 64 will recognize an error condition and leave the handshake sequence. When this routine is called when the accumulator contains a 0 in bit 7, timeouts are enabled. A 1 in bit 7 will disable the timeouts.

Example:
LDA#0Disable IEEE Timeout
JSRSETTMO

35 - STOP

Check if key/stop key is pressed
Function AddressVectorDescription
STOP FFE10328Check if key/stop key is pressed

This routine checks for either the RUN/STOP key or certain other keys are pressed.

Check for RUN/STOP key pressed

If the key was pressed during a UDTIM call, this call returns the z flag set. In addition, the channels will be reset to default values.

Example:
Check for STOP key pressed
JSRUDTIMUpdate timer which also scans for STOP
JSRSTOP
BNEstopNotDown
JMPstopDownJump to code to handle STOP
stopNotDownContinue further processing

In the above example if the STOP key is pressed we jump to the method stopDown. This method could reset your application, cancelling some lengthy operation.

Check for other keys

If the stop key is not pressed then the z flag will be clear and the accumulator will be set to one of the following keys located on the same keyboard column as the stop key:

C64 key Accumulator Vic-20 key Accumulator
1 0xFE Cursor Down 0x7F
Left arrow 0xFD / 0xBF
CTRL 0xFB , 0xDF
2 0xF7 N 0xEF
Space 0xEF V 0xF7
Commodore 0xDF X 0xFB
Q 0xBF Left Shift 0xFD

If no key is down in the STOP column, the routine returns 0xFF on both machines.

36 - TALK

Command a device on serial bus to TALK
Function AddressDescription
TALK FFB4Command a device on serial bus to TALK

To use this routine the accumulator must first be loaded with a device number between 0 and 31.

When called, this routine then ORs bit by bit to convert this device number to a talk address. Then this data is transmitted as a command on the serial bus.

If a secondary address is required then the TKSA routine must be called immediately after this one.

Example:
LDA#4Command device #4 to talk
JSRTALK

37 - TKSA

Send secondary address to a device commanded to TALK
Function AddressDescription
TKSA FF96Send secondary address to a device commanded to TALK

This routine transmits a secondary address on the serial bus for a TALK device. This routine must be called with a number between 0 and 31 in the accumulator. The routine sends this number as a secondary address command over the serial bus. This routine can only be called after a call to the TALK routine. It will not work after a LISTEN.

Example:
LDA#4Command device #4 to talk with command #7
JSRTALK
LDA#7
JSRTKSA

38 - UDTIM

Update system clock
Function AddressDescription
UDTIM FFEAUpdate system clock

This routine updates the system clock. Normally this routine is called by the normal KERNAL interrupt routine every 1/60th of a second. If the user program processes its own interrupts this routine must be called to update the time. In addition, the <STOP> key routine must be called, if the <STOP> key is to remain functional.

39 - UNLSN

Send an UNLISTEN command
Function AddressDescription
UNLISTEN FFAESend an UNLISTEN command

This routine commands all devices on the serial bus to stop receiving data. Calling this routine results in an UNLISTEN command being transmitted on the serial bus. Only devices previously commanded to listen are affected. This routine is normally used after the Commodore 64 has finished sending data to external devices. Sending the UNLISTEN commands the listening devices to get off the serial bus, so it can be used for other purposes.

Example:
JSRUNLSN

40 - UNTLK

Send an UNTALK command
Function AddressDescription
UNTLK FFABSend an UNTALK command

This routine commands all devices on the serial bus to stop sending data. Calling this routine results in an UNTALK command being transmitted on the serial bus. Only devices previously commanded to talk are affected.

Example:
JSRUNTLK

41 - VECTOR

Manage RAM Vectors
Function AddressDescription
VECTOR FF8DManage RAM Vectors

This routine manages all system vector jump addresses stored in RAM.

Calling this routine with the the accumulator carry bit set stores the current contents of the RAM vectors in a list pointed to by the X and Y registers.

When this routine is called with the carry clear, the user list pointed to by the X and Y registers is transferred to the system RAM vectors.

The RAM vectors are listed in the memory map.

This routine requires caution in its use. The best way to use it is to first read the entire vector contents into the user area, alter the desired vectors, and then copy the contents back to the system vectors.