Classic Computer Magazine Archive COMPUTE! ISSUE 78 / NOVEMBER 1986 / PAGE 8

Applesoft B Commands

I am familiar with the Applesoft BASIC commands LOAD, SAVE, and RUN. These commands sometimes show up in your magazine with the letter B in front. What do these commands do?

Bruce Meulendyke

BSAVE, BLOAD, and BRUN are used to save, load, and run binary files. A binary file often consists of a machine language program, but it can also contain other data such as a screen image. Here's the syntax for BSAVE:

BSAVE filename, Aaddress, Llength,
Sslot, Ddrive, Vvolume

BSAVE saves the contents of a designated memory area to a disk file. Every BSAVE command must include at least three parameters: a filename, the letter A followed by the starting address of the memory area you wish to save (add a $ after the A if you supply the address value in hexadecimal), and the letter L followed by the length of the area to save (you can also add a $ after the L to supply the length value in hexadecimal). The last three parameters (S followed by a slot number, D followed by a drive number, and V followed by a volume number) are optional. (The volume number parameter is valid for DOS 3.3 only.) Here's the syntax for BLOAD:

BLOAD filename, Aaddress, Sslot,
Ddrive, Vvolume

BLOAD loads a binary file from disk into the computer's memory. Only the filename parameter is mandatory. The other parameters take the same format as for BSAVE (indicate hexadecimal numbers with a $). If you supply a load address, BLOAD loads the binary file into the designated memory area. If the address is omitted, the computer loads the file into the same area it was saved from. Note that you needn't specify the file's length: The computer simply loads until it reaches the end of the file. Here's the syntax for BRUN:

BRUN filename, Aaddress, Sslot,
Ddrive, Vvolume

BRUN assumes that the binary file contains a machine language program. It performs a BLOAD of the designated file, then starts the program by performing a JMP to the beginning of the file. Just as with BLOAD, the address, slot, drive, and (for DOS 3.3) volume parameters are optional. BRUN offers a very convenient way to load and run a machine language program, since you don't need to know where the program goes in memory. Some other computers (the Commodore 64, for instance) require that you start an ML program with a SYS to the correct address after you've loaded it.