3) |
Any of the input/output or BASIC internal routines accessed through
the vector table located on page 3 (see ADDRESSING MODES, ZERO PAGE)
can be replaced, or amended by user code. Each 2-byte vector
consists of a low byte and a high byte address which is used by the
operating system.
The KERNAL VECTOR routine is the most reliable way to change any
of the vectors, but a single vector can be changed by POKES. A new
vector will point to a user prepared routine which is meant to
replace or augment the standard system routine. When the appropriate
BASIC command is executed, the user routine will be executed. If
after executing the user routine, it is necessary to execute the
normal system routine, the user program must JMP (JuMP) to the
address formerly contained in the vector. If not, the routine must
end with a RTS to transfer control back to BASIC. |
4) |
The HARDWARE INTERRUPT (IRQ) VECTOR can be changed. Every 1/60th of
a second, the operating system transfers control to the routine
specified by this vector. The KERNAL normally uses this for timing,
keyboard scanning, etc. If this technique is used, you should always
transfer control to the normal IRQ handling routine, unless the
replacement routine is prepared to handle the CIA chip. (REMEMBER to
end the routine with an RTI (ReTurn from Interrupt) if the CIA is
handled by the routine).
This method is useful for tasks which must happen concurrently
with a BASIC program, but has the drawback of being more difficult. |