Interrupts & Traps ------------------ Note: Most infos here are taken from David Ellsworth's Fargo doc. ----------------------------------------------------------------------------- INTRODUCTION ----------------------------------------------------------------------------- The 68000 processor keeps a 256(d) byte exception vector table at the bottom of memory (address $000000). This table contains pointers to 64(d) vectors; each vector is an absolute pointer to a specific location in memory. Most of these vectors point to routines, although some have other functions. Each vector is referred to with an index between 0(d) to 63(d) inclusive. The vectors are assigned as follows: Address in table Assigned function ---------------- ----------------- 0000 to 0007 Reset vector (initial SSP and PC) (0-1) 0008 to 000B Bus error vector (2) 000C to 000F Address error vector (3) 0010 to 0013 Illegal instruction vector (4) 0014 to 0017 Zero divide vector (5) 0018 to 001B CHK instruction vector (6) 001C to 001F TRAPV instruction vector (7) 0020 to 0023 Privilege violation vector (8) 0024 to 0027 Trace vector (9) 0028 to 002C Line 1010 emulator vector (10) 002C to 002F Line 1011 emulator vector (11) 0030 to 003B Unassigned, reserved (12-14) 003C to 003F Uninitialised interrupt vector (15) 0040 to 005F Unassigned, reserved (16-23) 0060 to 0063 Spurious interrupt vector (24) 0064 to 007F Level 1-7 interrupt auto-vectors (25-31) 0080 to 00BF TRAP #0-15 instruction vectors (32-47) 00C0 to 00FF Unassigned, reserved (48-63) 0100 to 03FF User interrupt vectors (64-255) Some of these vectors are triggered when an error is encountered by the 68000 processor. Others can be triggered directly by a TRAP instruction. The interrupt auto-vectors, or auto-ints, are triggered when a specific hardware event occurs. ----------------------------------------------- VECTORS RECOVERED BY THE ANTI CRASH PROTECTION ----------------------------------------------- The following vectors cause a crash when they are triggered, that's why the Anti Crash protection recovers them: Address error Illegal instruction Zero divide CHK instruction TRAPV instruction Privilege violation Auto-Int 7 ----------------------------------------------------------------------------- VECTORS USED BY THE TI-92+/TI-89 ----------------------------------------------------------------------------- Line 1010 emulator ------------------ Opcode $Axxx: Trigger error {xxx}, with identical numbering to that used in the (TIOS) variable "errornum". Note that there are some error numbers that are undocumented in Appendix B of the TI-92 manual. If the Error List is empty, it displays 'Line 1010 emulator' Line 1111 emulator ------------------ Opcode $Fxxx Calls Rom function if xxx is > $800 and if it is a valid rom_call (On AMS 2.04 or with preos) Otherwise it displays 'Line 1111 emulator' Auto-Int 1 ---------- Triggered every 4th time [600017] is incremented. It runs at approximately 350 Hz (HW1). See LowLevel.txt Auto-Int 2 ---------- Triggered periodically while key(s) other than [ON] are held down. The rate depends both on battery strength and on which key(s) are being held down, and is usually in the ballpark of about 600 Hz. Squale92 reported that only the 7 first row of the keyboard matrix triggered the auto-int (on 92+). Auto-Int 3 ---------- Used by the clock on AMS 2.07 See LowLevel.txt Auto-Int 4 ---------- Link Service See LowLevel.txt Auto-Int 5 ---------- Triggered when [600017] is set to its initial value. After ROM initialization, it runs at approximately 18 Hz. See LowLevel.txt Auto-Int 6 ---------- Triggered when [ON] is pressed. Auto-Int 7 ---------- Protected memory violation. Triggered when memory below [$000120] is written while bit 2 of [$600001] is set. Ti's SDK says it is trigerred also if you access an adress from the range [$800000 , $FFFFFF] but I haven't tested it. Trap 0 ------ JSR ($40xxxx + D0.W) d0.w is AMS dependant, so I don't think you will be able to use it directly. tios::idle, tios::CheckBreak are implemented like it. Preos intercepts this trap quite often. Trap 1 ------ Change Interrupt Mask Input : D0.W = new interrupt mask (bits 10,9,8 of new SR) Output: D0.W = old SR Trap 2 ------ Reset Calculator Input : nothing Output: calculator is reset Trap 3 ------ Nothing. Unios installs a DEREF function so that you can do this for derefencing Handles: move.w #MyHandle,a0 trap #3 Preos hasn't this feature. Trap 4 ------ Turn Off, Turn On (see also Auto-Int 6) Best calling tios::off ! Input : nothing Output: calculator turns off, waits for [ON] Trap 5 ------ Print "Trap 5" and Freeze Trap 6 ------ ? Trap 7 ------ ? Trap 8 ------ ? Trap 9 ------ A0.L = $4004F8 + 4 * D0.W Input : D0.W = {00...11} Output: A0.L = $4004F8 + 4 * D0.W D0.L = 4 * D0.W; D0 pointer to -- ---------- 00 (ROM) OSContrastUp() 01 (ROM) WinOpen() 02 (ROM) OSLinkReset() 03 (RAM) 2 structures 04 (ROM) ?contrast 05 (ROM) WinStr() 06 (RAM) ?key_buffer 07 (ROM) flush word buffer, set size to 1 word (push *buffer) 08 (ROM) table for isupper(), etc. 09 (ROM) ?contrast_up() 0A (ROM) ?contrast_down() 0B (ROM) [60001A] = $FF, [05342] = $00 0C (ROM) getkey() table 0D (ROM) ? 0E (RAM) LCD memory 0F (ROM) Boolean ?read_word_buffer(WORD *a, BUFFER *b) 10 (ROM) RAM test 11 (ROM) WinMoveTo() TRAP 10 ------- Enter self test TRAP 11 ------- Hardware protection function. It moves memory from the RAM to the flash ROM, unprotecting the hardware. It adds certificates. It "protects" the execution of the programs. TRAP 12 ------- Go to Supervisor mode. TRAP 13 ------- Print "Trap 13" and Freeze TRAP 14 ------- Print "Trap 14" and Freeze TRAP 15 ------- Print "ER_throw" and Freeze