|
Exception Vector Processing
ABOUT
The 68000 processor used by the TI-89 keeps a #1024 byte vector table beginning at
$000000. This table contains pointers to routines used by the cpu, operating system, and
the user. The vectors are refered to with an index from #0 through #255. This document
describes some of these vectors as they relate to the AMS.
VECTOR ASSIGNMENTS ON THE TI-89
Line 1010 ($A) Emulator
Triggered when an op code beginning with 1010 is encountered; the operating system uses
this to throw errors. The general format is $Axxx where xxx is the error code. The error
codes are the same as printed in the calculators manual. Some error codes are not
documented.
Line 1111 ($F) Emulator
Triggered when an op code beginning with 1111 is encountered.
AMS < 2.04 Print Line 1111 Emulator and Freeze.
AMS =>2.04 Call routine in jump table format is $F800 + JumpTableIndex.
Example: ClrScr is $19E in the jump table. $F800 + $19E = $F99E. So dc.w $F99E (or .word
0xF99E 'as' style) would call ClrScr. When using this method, the call takes 2 bytes
compared to 6 bytes and is much slower than the traditional methods.
Auto Interrupts 1-7
The interrupt level can be set with OSSetSR or Trap #1. Setting an interrupt mask above
$500 will disable the calculator's ability to save state information if there is a power
outage.
There are 8 levels of interrupts available on the TI-89:
|
Interrupt Mask |
Short Description |
Disabled Interrupts |
$700 |
Disable All Interrupts |
Auto
Interrupts 1, 2,
3, 4,
5, 6
|
$600 |
Disable ON key & Below |
Auto
Interrupts 1, 2,
3, 4,
5, 6 |
$500 |
Disable Timers & Below |
Auto
Interrupts 1, 2,
3, 4,
5 |
$400 |
Disable Link & Below |
Auto
Interrupts 1, 2,
3, 4 |
$300 |
Disable Slow Clock & Below |
Auto
Interrupts 1, 2,
3 |
$200 |
Disable Keyboard & Below |
Auto
Interrupts 1, 2 |
$100 |
Disable Key Scan |
Auto
Interrupts 1 |
$000 |
Enable All Interrupts |
<NONE> |
|
Interrupt Number
|
Description With Respect to the AMS
|
Auto Interrupt 1 |
Status Line: By default, it triggers about 395 times per
second. Draws the status line. |
Auto Interrupt 2 |
Keypress: Triggered when a key is pressed. A single
keypress can generate multiple interrupts! |
Auto Interrupt 3 |
Slow Clock: Not used by the AMS. Triggers exactly one time per second on HW2 calcs. On HW1 calcs, it triggers ~0.616322 times per second. |
Auto Interrupt 4 |
Link:Triggered by the linking hardware for varoius
reasons. |
Auto Interrupt 5 |
Timers: Controls the 6 timers used by
the TIOS (1-6 inclusive). This interrupt is triggered at 20 times per second if the
programmable rate generator has not been altered. TIGCC hooks this interrupt to provide
vector timers. |
Auto Interrupt 6 |
ON KEY: Triggers when the ON KEY is pressed. A single
keypress can generate multiple interrupts! It also seems to be triggered when battery
power is low. That explains why doorsos breaks out of programs sometimes when STO is
pressed. |
Auto Interrupt 7 |
Protected Memory Violation: Triggers when a write is
attempted at any address below $120 or any address from $E00000 - $FFFFFF. This is to
prevent damage to the Exception Vector Table from a stack overflow for example. The user
stack begins at $4BFF and grows backwards to $400, so most of the user vectors will be
damaged before this interrupt triggers. To avoid this interrupt, you can add $40000 to the
address that you want to write to. A second method is to clear bit #2 at $600001 to
disable the interrupt; setting the bit enables the interrupt once again.
Notes: The following instructions may be of interest in this interrupt...
...
MOVE USP,A0 ;the address to
the user stack is in a0
CMPA.L #$400,A0 ;compare with
$400
BHI... ;if higher, then 'Protected Memory Error' is
thrown...
;else 'Memory Error' is Thrown
Auto Interrupt 7 cannot be disabled via the SR because it is not maskable.
Instead, use port .........where did alh's page go =P
|
---to do--- clean this up... get rid of ugly table....
Trap Exception Table
|
Trap
|
Description
|
Input
|
Output
|
Notes
|
Trap #0
($0) |
Execute various supervisor mode functions. |
D0 = function code |
|
Known Functions: |
0 |
sets the power state, switches flash to low power mode |
1 |
Idle |
2 |
Clear Break |
3 |
Check Break |
4 |
Reset |
5 |
|
6 |
Error Lockup |
|
Trap #1
($1) |
Interrupt Mask |
D0.w = new interrupt mask |
D0.l = old SR |
OSSetSR uses this trap. |
Trap #2
($2) |
Reset |
none |
The calculator is reset. On ams 2.xx, the archive will be
intact. |
Used by Trap #8, so redirect this trap to avoid a reset if you
use it. |
Trap #3
($3) |
OSenqueue |
parameters on stack C style:
(short data, void* Queue) |
D0.w = 1 on success 0 on failure
Assume that D1-D2/A0-A1 are destroyed |
This will not work if you want to use OSenqueue
becuase OSenqueue expects to be run in user mode. It peforms rts instead
of rte at the end of the routine. |
Trap #4
($4) |
Turns the calculator off |
|
Calculator is off... waits for the ON key to be pressed or a
link interrupt to turn back on. |
|
Trap #5
($5 |
Prints Trap 5 with black bar and hangs |
|
|
|
Trap #6
($6) |
Prints Trap 6 with black bar and hangs |
|
|
|
Trap #7
($7) |
Prints Trap 7 with black bar and hangs |
|
|
|
Trap #8
($8) |
Runs a block in supervisor mode. |
LE_WORD Size;BYTE Code[]; |
The code is called (passed a5 with the end address), trap #2
is then called (put on the stack as the return address) |
|
Trap #9
($9) |
Returns pointers to various system functions and tables |
D0.w = function id |
A0.l = pointer |
Input Table |
D0.w |
Pointer |
0 |
OSContrastUp |
1 |
WinOpen |
2 |
OSLinkReset |
3 |
TIMERV *OSTimerVectors; |
4 |
BYTE *OSContrast;
(end of LCD_MEM) |
5 |
WinStr |
6 |
KEY_QUEUE *KeyBuffer; |
7 |
OSqclear |
8 |
CHARTYPE* CharTbl; |
9 |
OSContrastUp |
10 |
OSContrastDn |
11 |
OSClearBreak |
12 |
KEYCODE* KeyCodes; |
13 |
OSCheckBreak |
14 |
LCD_MEM |
15 |
OSdequeue |
16 |
RAMTest |
17 |
WinMoveTo |
|
Trap #10
($A) |
Self Test |
|
|
|
Trap #11
($B) |
Handles all of the FLASH operations for the operating system.
This trap needs to execute from the ram if writing is to be peformed. |
D3 = function number
D4 = size
A2 = addr1
A3 = addr2 |
|
D3 |
Function |
0 |
write |
1 |
erase |
2 |
addcert |
3 |
getcert |
4 |
cgetvernum |
If (flen) function is copied and executed in RAM. |
Trap #12
($C) |
Enter Supervisor Mode |
none |
d0.w contains previous SR upon return. |
RTE won't work to restore user mode because this trap pop's
the sr off of the stack and then peforms rts which pops the return address off of the
stack |
Trap #13
($D) |
Prints Trap 13 with black bar and hangs |
|
|
|
Trap #14
($E) |
Prints Trap 14 with black bar and hangs |
|
|
|
Trap #15
($F) |
Prints ER_throw with black bar and hangs. |
|
|
|
Copyright © 2000 - by Greg D. All Rights Reserved.
|
|
|
|