!pr0
Killing the EXEC....................................Bob Bragner
                                               Istanbul, Turkey

Have you ever been at the beginning of the execution of a l-o-n-g EXEC file and realized you didn't really want to go through with it?  There's not really much you can do.  Control-C and RESET are ineffective even if you have an old Apple ][ without the Autostart ROM.  On a //e you can hit Control-Open Apple-RESET, but at the expense of anything you may have in the Apple's memory -- a rather drastic solution.

As it turns out, there is a very easy way to terminate an EXEC file in progress.  Apple DOS contains a single byte ($AAB3 when DOS is at its normal location) which is called "EXEC.STATUS".  If the value of this byte is not 0 DOS thinks an EXEC file is in charge.  If it is 0 then as far as DOS is concerned, no EXEC file is active.  So we have the following little routine:

















This routine can be reassembled to run anywhere.  the INIT portion simply directs the RESET vector to the KILL.EXEC part of the routine and must be called before the EXEC command is issued.  KILL.EXEC stores a 0 in the EXEC.STATUS flag and jumps to the DOS warm start at $3D0.  Now if you hit RESET during an EXEC file's operation, the file will terminate politely.

Here is a series of POKES and a CALL that could be placed at the beginning of any EXEC program:

!lm+5
POKE 1010,13 : POKE 1011,3 : CALL 64367
POKE 781,169 : POKE 782,0 : POKE 783,141 : POKE 784,179
POKE 785,170 : POKE 786,76 : POKE 787,208 : POKE 788,3
(the rest of your program goes here)
!lm-5

This works from machine language, Integer BASIC, Applesoft, AND the S-C RAMcard Macro Assembler.  The latter is a big help when you discover you're EXEC'ing the wrong 2000-line text file into the assembler, or you've forgotten to turn AUTO on!

[  Just a couple of comments:  this trick won't work with an old non-Autostart ROM Apple, since you can't redirect RESET; and be sure to type the CLOSE command after the RESET, to free up the file buffer that the EXEC file was using.   Bill  ]
