Sets the interrupt mode.
Mode 0
Not used by TI calculators, but means that an external device plugged into a z80 device generates the interrupt.
Mode 1
Interrupts are generated by the internal circuitry of the processor (aka the OS). The frequency of these interrupts is 200 per second on a ZX Spectrum, but it depends on the state of the batteries in the case of TI calculators (probably varies between 100 and 150). Every time an interrupt is encountered, the OS performs an RST $28.
Mode 2
Allows user to determine when an interrupt happens, and what the interrupt does. For more information on interrupts, see this page.
Syntax
IM 0 ;will compile, but will result in a crash on your calculator
IM 1
IM 2
Effects
All flags are preserved.
Uses
The most important use of IM is to allow for the programmer to create their own interrupts that can do whatever they want them to, when they want the interrupts to occur. For more information on how interrupts work, see this page.
T-States
8 t-states for each mode