The Timer Interrupt Table as a table stored somewhere in the memory. The address of the table is stored in the pointer timertab, which is a 2-byte variable declared in the BAOS headers. The table may not have more than MAX_TIMERS entries. MAX_TIMERS is also declared inside the BAOS headers.
The table has the following layout:
Byte | 0 | 1 | 2 - 3 |
---|---|---|---|
Description | Interrupt Counter | Initial Counter Value | Call vector |
Interrupt Counter | Everytime a timer-interrupt happens, this integer is decreased by 1. If the result is 0 (zero) the timer is trigered |
Initial Counter Value | After a timer got triggered, BAOS will look at the value of the Initial Counter Value. If it is not 0 (zero), BAOS will put this value into the Interrupt Counter and the timer will repeat itself, if it is 0 (zero), the timer will be triggered and afterward deleted. |
Call vector |
This is a pointer to a function somewhere in the memory (flash or RAM).
When the timer get's triggered, it will call the function that resides at
[Call vector] .NOTE: You should not use a flash page other than the operating system page (page 0). Since BAOS is a multitasking OS, it can happen (and will happen!) that another process changes the flash page currently mapped to $4000 - $7FFF. This means that there will be a call to some place in the flash, which may result in a system crash. On Calculaters with multiple RAM pages (everything except the TI-83+ BE) the same can happen when you use a RAM location between $8000 and $BFFF, but since BAOS does not yet support you can forget about this last one. |