The next nine vectors, 768-785/$0300-$0311, are used in BASIC statement processing routines. The default values for these vectors are copied from a table at 16999-17016/ $4267-$4278 in BASIC ROM by the BASIC vector initializa- tion routine [$4251], part of the cold-start sequence. Thus, unlike the Kernal indirect vectors, the BASIC vectors are not affected by the RUN/STOP-RESTORE sequence. Any changes you make to the vectors will remain in effect until the next cold start of BASIC, as during a reset.
768-769 $ 0 3 0 0 - 9 0 3 0 1 IERROR Indirect vector for BASIC error handling routine
In BASIC ROM, the jump through this vector is taken at the beginning of the error handling routine (ERROR [$4D3C]). At the point the jump is taken, the X register will contain the cur- rent BASIC error number (0-41, or 128 to print READY) and the accumulator will hold the last character read from program text. The default target address of the vector is 19775/$4D3F, which simply reenters the error handling routine at the point immediately following the jump. You can redirect this vector to change the way BASIC handles errors.
In addition to modifying error handling, you can also use this vector to provide an alternate method of adding com- mands to BASIC.
770-771 $0302-$0303 IMAIN
Indirect vector in main BASIC loop
The jump through this indirect vector is taken in the main BASIC direct mode routine [$4DB7] at the point immediately after the READY prompt has been printed and the mode flag (127/$7F) has been set for immediate mode. The vector nor- mally holds 19910/$4DC6, the address of the instruction im- mediately following the indirect jump. You can redirect this vector to a routine of your own if you wish to change the be- havior of BASIC'S immediate mode.
772-773 $0304-$0305 ICRNCH
Indirect vector in BASIC tokenization routine
The jump through this indirect vector is taken at the begin- ning of the CRUNCH routine [$430A], which is responsible for converting lines of input text into tokenized program lines.
764-765 $02FC-$02FD $0304-$0305 772-773
that value in the MMU configuration register, loads the pro- cessor registers from locations 6-8, and executes an RTI in- struction, which causes the processor to retrieve status register and address values from the stack and resume processing at the specified address.
Indirect Vectors
The next 66 locations are indirect vectors for a variety of BASIC, Kernal, and screen editor routines. An indirect vector is a pair of locations that hold an address for an indirect jump instruction, such as JMP ($0300). The target address of the JMP will be determined by the value in the specified indirect vector. Having ROM routines jump through indirect vectors greatly increases the flexibility of the computer. Even though it isn't possible to change a routine in ROM, it's possible to add to or modify a routine that has an indirect vector by redirect- ing the vector to a RAM-based routine.
764-765 $02FC-$02FD ESC_FN_VEC
Indirect vector in extended function execution routine
The indirect jump through this vector is taken in the extended function handling subroutine when a two-byte extended func- tion token is found for which the second byte is greater than the largest standard extended function token (10/$0A). When the jump is taken, the accumulator will hold the out-of-range token value and the status register carry bit will be set. If carry is not clear upon return from the jump, a SYNTAX error mes- sage will be generated. The vector normally holds 19576/ $4C78, the address of the instruction following the call to this vector. This doesn't change the carry setting, so out-of-range extended function tokens normally result in an error message. If you add new functions to BASIC, you'll need to change this vector to point to the routine which executes your new func- tion. See Chapter 5 for an example.
766-767 $02FE-$02FF BNKVEC
Reserved indirect vector
These two locations are not used by system ROM routines. Commodore literature indicates that they are reserved for use as an indirect vector for function ROM routines.
90
BASIC Indirect Vectors
The next nine vectors, 768-785/$0300-$0311, are used in BASIC statement processing routines. The default values for these vectors are copied from a table at 16999-17016/ $4267-$4278 in BASIC ROM by the BASIC vector initializa- tion routine [$4251], part of the cold-start sequence. Thus, unlike the Kernal indirect vectors, the BASIC vectors are not affected by the RUN/STOP-RESTORE sequence. Any changes you make to the vectors will remain in effect until the next cold start of BASIC, as during a reset.
768-769 $ 0 3 0 0 - 9 0 3 0 1 IERROR Indirect vector for BASIC error handling routine
In BASIC ROM, the jump through this vector is taken at the beginning of the error handling routine (ERROR [$4D3C]). At the point the jump is taken, the X register will contain the cur- rent BASIC error number (0-41, or 128 to print READY) and the accumulator will hold the last character read from program text. The default target address of the vector is 19775/$4D3F, which simply reenters the error handling routine at the point immediately following the jump. You can redirect this vector to change the way BASIC handles errors.
In addition to modifying error handling, you can also use this vector to provide an alternate method of adding com- mands to BASIC.
770-771 $0302-$0303 IMAIN
Indirect vector in main BASIC loop
The jump through this indirect vector is taken in the main BASIC direct mode routine [$4DB7] at the point immediately after the READY prompt has been printed and the mode flag (127/$7F) has been set for immediate mode. The vector nor- mally holds 19910/$4DC6, the address of the instruction im- mediately following the indirect jump. You can redirect this vector to a routine of your own if you wish to change the be- havior of BASIC'S immediate mode.
772-773 $0304-$0305 ICRNCH
Indirect vector in BASIC tokenization routine
The jump through this indirect vector is taken at the begin- ning of the CRUNCH routine [$430A], which is responsible for converting lines of input text into tokenized program lines.
774-775
$0306-$0307
$0310-$0311
784-785The vector normally holds 17165/S430D, the address of the instruction immediately following the indirect jump. You can redirect this vector to a routine of your own if you wish to change the way program lines are tokenized.