Authors
Publication
Publication Details
Volume: 4 Issue: 1
Date
Pages
Non-Maskable Interrupts
You’ll need an “NMI Switch”, RAM in the DOCK bank and the ability to copy the T/S 2068 HOME ROM to the RAM.
Basically, the NMI works as follows. When the NMI line at the rear connector is brought momentarily to ground, the computer stops what its doing and starts executing code at 0066h. So that the computer doesn’t lose its place, the address where it left off goes on the machine stack. Also, the status of the maskable interrupt is saved, and then the maskable interrupt is disabled.
The NMI cannot be disabled, so we can use it to interrupt most programs.
When we’re done servicing our NMI, we want to send the computer back to what it was doing. All that’s necessary is to restore whatever registers we’ve changed, and then use a RETN instruction. We don’t use an ordinary RET in this case because it does not restore the status of the maskable interrupt as RETN does.
This all looks very nice, but there’s a problem: address 0066h is in the ROM and the ROM code there has a bug. What it should have does is as follows. If memory locations 5CB0/1h (23728/9 decimal) contain a non-zero address, that address would be jumped to. If, instead both locations contain zeros, the interrupt the interrupt routine would simply return via RETN. Unfortunately, the ROM has it coded the other way around.The jump will only occur if these locations contain zeroes. As such, the ROM code reduces the powerful NMI function to a reset switch can disable the software.
The good news is that we need to change only one byte to fix the program. Two ways to do this come readily to mind. We can build a circuit that disables the computer memory when the “bugfull” byte is being addressed, and then insert the proper byte on the data bus. Alternately, we can build a circuit that replaces the ROM and its code.
Remember that interrupt driven print-screen program we played around with above? We discovered that it worked fine with BASIC, but many commercial programs disable the maskable interrupt, rendering it useless. An NMI version can’t be disabled.