86:Interrupts

From WikiTI
Revision as of 20:38, 20 September 2021 by Zeroko (Talk | contribs)

Jump to: navigation, search


Individual interrupt sources can be enabled, disabled, or acknowledged using Port 3. When an interrupt occurs, the CPU automatically masks interrupts, so there is no need to start with DI. Interrupts must be acknowledged before executing EI, or the interrupt will retrigger immediately after the instruction following the EI is executed. RET & RETI have the same effects on the TI-86, so RET can be used to save one byte.

There is no way to cause a non-maskable interrupt, so the OS does not have an NMI handler.

Interrupt Mode 0

When an interrupt occurs, the CPU treats the current bus content as an opcode & executes it. If the interrupt source was the LCD Controller, this will be the last byte transferred by DMA. For any other interrupt source, it will be the last byte accessed by the instruction that was executing when the interrupt condition arose, either as part of the instruction itself or as a memory operand. If the resulting opcode requires additional opcode or operand bytes, they will all have the same value fetched from the address in PC without changing the value of PC. Under normal circumstances, IM 0 is likely to result in a crash.

Interrupt Mode 1

When an interrupt occurs, the CPU pushes the return address & then jumps to address 0038h. If the ROM is disabled at the time (see bit 6 of Port 4), the calculator will likely crash.

Interrupt Mode 2

When an interrupt occurs, the CPU treats the current bus content as the lower 8 bits of an address, with the upper 8 bits being the value of the I register. Regardless of interrupt source, the bus content will be the last byte accessed (either as part of the opcode or as a memory operand) by the instruction that was executing when the interrupt condition arose, because if LCD DMA occurs, it takes place after the CPU reads the previous bus content. The CPU then pushes the return address & jumps to the address stored at the address saved earlier. If the first or both of the bytes of this new address are read from an unused bank, their value will be the lower 8 bits of the return address. If just the second byte is read from an unused bank, its value will be the same as the first.