Contents of the UNCRASH.DOC file
Back From The Zone
(PC Magazine Vol 5 No 5 March 11, 1986 User-to-User)
(Compiled and edited by Dean R. Wood)
If you've ever found yourself hopelessly locked inside an
infinite loop, you've probably experienced the frustration of having
to reset your computer to get out of it. This can be especially
distressing when you're using a volatile RAMdisk and the most recent
version of the program that caused that infinite loop evaporates with
it. You might think that hitting Ctrl-Break will get you out of such
a situation, but this works only if a DOS function is called during
the loop. UNCRASH.COM cures this problem.
The IBM PC executes an interrupt about 18 times a second to update
the time kept current by DOS. The BIOS routine that performs this
service also performs another interrupt, called the Timer Tick at 1CH,
that allows other applications, such as a print spooler, to gain
control at regular intervals. UNCRASH takes advantage of this DOS
feature; it loads its own address into the location called by the
Timer Tick interrupt and gets control 18 times a second. When the
Ctrl-Break keys are pressed, the BIOS keyboard interrupt servicer sets
the highest bit of byte 71H in data segment 40H.
When UNCRASH finds this bit set, it resets the high bit at 71H
to zero, sends an end-of-interrupt signal to the interrupt controller
at port 20H, and causes the application to terminate by calling DOS
function 4CH. UNCRASH saves and passes control to the address that
was previously located at interrupt 1CH, so it shouldn't preempt any
other programs that use this service. Although UNCRASH works well
with most software, it will not work in IBM BASIC and will cause the
machine to hang if it is used while in BASIC.
To test how well the program breaks out of an assembler routine,
before you load UNCRASH, create a tiny endless assembler loop called
ENDLESS.COM by getting into DOS and putting DEBUG on your disk and
typing the following:
Be sure to hit the Enter key at the end of every line. Run it by
typing ENDLESS and try to break out of it by hitting Ctrl-Break.
After satisfying yourself that it can't be done, switch your system
off and on again, and run UNCRASH.COM. Then run ENDLESS, and you'll
see that you can indeed Ctrl-Break to safety. However, don't leave
UNCRASH in memory and later load BASIC, or you'll crash.