The Apple 1 Basic

An Original Apple 1 Basic Cassette

Along with the Apple 1 Cassette Interface the buyer used to receive a cassette containing Apple 1 Basic. This Basic was later enhanced with a few new commands and was sold with the first Apple ][ computers as Apple Integer Basic
In order to run Apple 1 Basic you needed at least 8kB bytes of RAM, which required an additional investment of $120 back in '76. Thus if you wanted to run Apple 1 Basic on your computer you had to buy the computer for $666.66, 4kB extra RAM for $120.00 and the ACI for another $75,00. This all adds up to a grand total of $861.66, needles to say that this was quite a considerable amount of money at the time. (And I didn't even mention the money you'd have to spend on a keyboard, power supply, TV/monitor and casing material).
The second block of 4kB memory had to be mapped to memory bank $E. Basic is then loaded from tape using the command E000.EFFFR in the ACI monitor, after which it can be started by typing E000R in the Woz monitor.

With the basic came a "preliminary user manual" with a total of 16 pages, including the front page! A scanned version of the manual can be found on the downloads page, where you can also find the hex dump of the Apple 1 Basic.

Starting The Apple 1 Basic

I think it goes without saying that you should make sure that Apple 1 Basic is loaded into memory before it can be started. If it's not provided in ROM you'll have to load it into memory locations from $E000 to $EFFF. The Basic interpreter can be started by typing E000R in the Woz Monitor. After printing the contents of address E000 you'll see a > symbol followed by the flashing cursor, which is from now on our prompt to enter Basic commands.

Entering Apple 1 Basic E000 is the so called "Cold" entry point to the Basic interpreter, which means that the program is initialized before we can really get going. This also means that there will be no runnable program in memory when we enter the Basic this way.

If you had to go back to the Woz monitor for any particular reason and want to return to the Basic interpreter without losing anything you can use the "Warm" entry point by typing E2B3R in the Woz Monitor.

Starting Basic using its Cold entry point initializes the LOMEM and HIMEM pointers to $0800 and $1000 respectively (HIMEM is set to 4k + 1). This means that you'll have a total of 2kB of memory for your Basic program and its variables.
On a standard Apple 1 with 8k of RAM, you could lower LOMEM to $0300, giving you an extra 256 bytes of program memory. If you have more than 8k of RAM, which is the case with probably all modern day replicas and the Apple 1 emulation programs, then you can raise HIMEM to whatever memory size you've got. Needles to say of course that you can only use a contiguous block of memory between LOMEM and HIMEM.
Changing LOMEM and HIMEM is done with two similarly named commands. Please note that these two commands only accept decimal values and that they do NOT test whether your entries are valid. Also note that these commands will erase your existing Basic program from memory!

Saving And Restoring Basic Programs Using The ACI

Unfortunately there are no SAVE and LOAD commands available in Apple 1 Basic. However it is still possible to save your programs to tape and load them back in later. Doing so is not very straight forward, as you might expect from modern computers.

The original user manual only tells you how to save and restore a program using the standard 8kB configuration of the Apple 1, where LOMEM is set to $0800 and HIMEM is set to $1000. Other configurations will make it more complicated to save and restore your programs. Especially if you want to load a program into a different memory range than it was saved from.
For now I'll only explain the standard procedures. Later when I've disassembled the Apple 1 Basic program I may add extra information about how to use other memory ranges.

In order to save a Basic program you have to return back to the Woz Monitor. The easiest way to do that is to press the Reset key. Then you'll have to enter the ACI control program by typing C100R.
Now you must save two address ranges, one from $4A to $FF, and one from $0800 to $0FFF.

C100R

C100: A9*
004A.00FFW 0800.0FFFW
\
E2B3R

The first range saves important house keeping data, while the second range stores the entire program and variable space. In short, everything which is important for Basic is saved to tape. Thus if you read this tape back later you'll end up with exactly the same situation as when you saved it, including all the variables.
Please note that I deliberately wrote all addresses with 4 digits in order to avoid problems with the undocumented feature which exists in the ACI program.
The final command returns you back to Apple 1 Basic with your program still in tact.

Reading the tape back can be done without starting Apple 1 Basic first. You'll have to leave Basic anyway to enter the ACI program. Apple 1 Basic does not have to be initialized after loading the program from tape because all the important settings were saved to tape and are restored after loading is complete.
Thus if you're already in Basic press Reset to go back to the monitor and enter the following lines (and start the tape at the right time).

C100R

C100: A9*
004A.00FFR 0800.0FFFR
\
E2B3R

Doesn't differ much from the commands to save the program to tape, does it? Of course not. If you play the tape back you'll have to use the same address ranges as when you saved it. This is particularly true for reading back Apple 1 Basic programs.
Normally you may read a tape back to a different location, just as long as you read the same amount of bytes that were stored on tape. This will not work for Apple 1 Basic programs though, because all the data in the first block of memory are referring to the original block of memory only.

Don't forget to Warm start Apple 1 Basic after reading your program back. Accidentally using the Cold start method would immediately erase your freshly loaded program again.

Entering And Editing Basic Programs

To be continued....

Basic Variables, Strings & Arrays

To be continued....

Math

To be continued....

Program Control

GOTO
GOSUB
FOR NEXT
IF THEN

Error Codes

To be continued....

Overview Of All Instructions

To be continued....