display | more...


In Apple DOS 3.3 and ProDOS, the command for executing a binary file from a floppy disk.

syntax:   BRUN filename [,A$addr] [,L$length] [,Sslot] [,Ddrive]


filename = the file to be run, must be machine language executable;

addr = memory address at which to load and execute the code;

slot = physical expansion slot containing the floppy disk controller to use (rarely used option);

drive = which drive to use on the floppy disk controller (usually 1 or 2).


There is a functional difference between the DOS 3.3 and ProDOS versions of this command. In either version, BLOAD is used to load the code from disk. In the DOS 3.3 implementation, a JMP instruction is then used to transfer control to the beginning of the code. In ProDOS, a JSR instruction is used instead. This has the unfortunate result that if the code thus executed ends with the RTS instruction, it will terminate cleanly under ProDOS but will give unpredictable behavior under DOS 3.3. In the latter case, the Apple II knows no better than to execute the RTS, so it pops whatever happens to be on top of the stack, expecting the data located there to represent the address to which it should return control, and returns to the location indicated. For this reason, under DOS 3.3, the proper way to end an executable that can be BRUN is with JMP $3D0 - which returns control to the Applesoft command prompt ( ] ).

When this problem is encountered while using DOS 3.3, it can be circumvented by using BLOAD to load the desired code and then CALL to execute it; though in this case one must have a good idea of where to do so.


Typically the casual user would not need to know the BRUN command; it would be shielded from their awareness by autoloaders and batch files. However, anyone who had a stack of floppy disks full of cracked games (and I never met an Apple ][ owner who didn't have their share) invariably had at least a few games that had been separated from their original autoloader files and needed to be BRUN.

Apple Assembly Line, Vol 6 #4, Jan. 1986. Bob Sander-Cederlof, ed.
Apple ][ ProDos Reference, Apple Computer Co.
The comp.sys.apple2 Usenet newsgroup FAQ
This user's teenage Apple years

Brun (?), n. [See Broun a brook.]

Same as Brun, a brook.



© Webster 1913.

Log in or register to write something here or to contact authors.