| SetIntVec | Function (Macro)

intr.h

void SetIntVec (long IntVec, INT_HANDLER Handler);

Sets an interrupt vector.

SetIntVec sets the interrupt vector located at the absolute address IntVec to the interrupt handler pointed to by Handler. Handler should be either a value returned from GetIntVec, or the address of a user-defined interrupt handler defined using DEFINE_INT_HANDLER. Note that Handler may not be the address of an ordinary C function.
Typical values of IntVec are given in the following table as enumerated in the IntVecs enum:

Address | Associated Constant | Triggered On
0x04 | INT_VEC_RESET | Reset (contains pointer to OS entry point)
0x08 | INT_VEC_BUS_ERROR | Bus error
0x0C | INT_VEC_ADDRESS_ERROR | Address error (accessing a short or long at an odd address)
0x10 | INT_VEC_ILLEGAL_INSTRUCTION | Illegal instruction
0x14 | INT_VEC_ZERO_DIVIDE | Division by zero
0x18 | INT_VEC_CHK_INS | CHK instruction
0x1C | INT_VEC_TRAPV_INS | TRAPV instruction
0x20 | INT_VEC_PRIVILEGE_VIOLATION | Privilege violation
0x24 | INT_VEC_TRACE | Code Tracing
0x28 | INT_VEC_LINE_1010 | Special instructions generated by ER_throw (0xA???)
0x2C | INT_VEC_LINE_1111 | F-Line instructions (0xF???)
0x3C | INT_VEC_UNINITIALIZED_INT | Uninitialized interrupt vector
0x60 | INT_VEC_SPURIOUS_INT | Spurious interrupt
0x64 | AUTO_INT_1 | Main timer hardware interrupt running at approximately 350 Hz
0x68 | AUTO_INT_2 INT_VEC_KEY_PRESS | Key press (triggered periodically while key(s) other than 'ON' are held down; the rate depends both on battery strength and on which keys are being held down, and is usually in the ballpark of about 600 Hz)
0x6C | AUTO_INT_3 | On most calculators, triggers once per second if enabled using a certain instruction
0x70 | AUTO_INT_4 INT_VEC_LINK | Link port activity
0x74 | AUTO_INT_5 | System timer running at approximately 18 Hz (see PRG_setRate, PRG_setStart)
0x78 | AUTO_INT_6 INT_VEC_ON_KEY_PRESS | 'ON' key press
0x7C | AUTO_INT_7 INT_VEC_STACK_OVERFLOW | Stack overflow (actually results in Protected Memory Violation)

All traps may be triggered manually using the TRAP assembler instruction.

Address | Associated Constant | Default Behavior
0x80 | TRAP_0 | (unknown)
0x84 | TRAP_1 INT_VEC_INT_MASK | Change interrupt mask (bits 8-10 of %sr) to %d0.w, output old mask in %d0.l
0x88 | TRAP_2 INT_VEC_MANUAL_RESET | Reset calculator
0x8C | TRAP_3 | (unknown)
0x90 | TRAP_4 INT_VEC_OFF | Turn the calculator off and wait for 'ON' key press
0x94 | TRAP_5 | (unknown)
0x98 | TRAP_6 | (unknown)
0x9C | TRAP_7 | (unknown)
0xA0 | TRAP_8 | (unknown)
0xA4 | TRAP_9 | Access to various system routines
0xA8 | TRAP_10 INT_VEC_SELF_TEST | Enter self test
0xAC | TRAP_11 INT_VEC_ARCHIVE | Print "Trap 11" and freeze
0xB0 | TRAP_12 | Put the processor in supervisor mode; return the previous value of the status register in `%d0:w`
0xB4 | TRAP_13 | Print "Trap 13" and freeze
0xB8 | TRAP_14 | Print "Trap 14" and freeze
0xBC | TRAP_15 INT_VEC_ER_THROW | Print "ER_throw" and freeze

See DEFINE_INT_HANDLER for an example of usage.

See also: GetIntVec, IntVecs, DEFINE_INT_HANDLER