Chapter Five
APPLE II & IIe
BASICODE is an encoding standard created to allow the interchanging of programs written in BASIC, between different brands of computers. The program listing is recorded on tape in ASCII using a special standard called BASICODE. This program makes it possible to read and write standard BASICODE through the cassette recorder interface.
No changes are required to the Apple nor to the tape-recorder connections. You can start right away! The program functions with or without DOS and is independent of the size of the memory. However, at least 16K RAM and Applesoft either in ROM or in the language card are required.
The BASICODE-2 system
To transfer programs from one computer to another, without too many problems, the software must meet some special requirements. Briefly, it amounts to the fact that a number of BASIC statements may not be used, and some others only with certain limitations. Instead you will have a number of subroutines replacing these statements.
Each computer has its own routines. A program consists now of two parts: firstly, a machine-dependent part, different for each computer, and secondly, the main program, which is identical for all computers. The main program always starts at line 1000, and uses the subroutines located below line 1000. The Apple standard subroutines have been included in this program. What these subroutines do, and how to use them, is described in
Chapter Four.
Only the main program needs to be transferred, since the subroutines are contained in the BASICODE-2 translation program which you already have. Prior to loading a BASICODE-2 program you must have loaded the subroutines.
How to use this program
By typing
& and then RETURN you will get the main menu displayed on the screen. Prior to reading in a BASICODE-2 program you can enter the subroutines by typing
1. You can check the subroutines by typing
LIST. In this manner you can also load the subroutines if you want to write a program using BASICODE-2 standards.
Option 2 loads a program from tape, and option 3 saves a program on tape. A detailed description of the load and save options now follows.
The loading option
After typing
2 you will see 'START THE RECORDER AND TOUCH ANY KEY' on the screen. Start the tape with the BASICODE program and as soon as you hear the header tone, touch any key (the header is the tone at the start). With the proper tape level the screen shows 'HEADER FOUND'. The computer loads from the tape, indicated by the flashing characters at the extreme top right of the screen. After detection of the trailer tone, and if all is well, you will see the program listing start to scroll on the screen.
The newly loaded program is being added to what is already stored in the memory. If errors occur during loading, the loading process will not stop at the trailer. Press control C; the screen will now display 'LOADING ENDED' followed by a selection menu. Typing
1 results in a listing of the program read. This listing can be stopped by touching any key.
Pressing the SPACE key will restart the listing, any other key halts it. If there are not too many errors, the program may still be entered by typing
2. Later on you can correct it yourself. When there are too many errors, it is better to type
3. return to BASIC and try another load with a different volume setting of the cassette recorder.
If the program is too large for your Apple, the load stops with 'MEMORY FULL' and 'LOADING ENDED'. You can then start to follow the interrupted load sequence just described.
The write option
By typing
3 in the main menu you will be shown the next menu page. Again there are three possibilities: option 1 checks the maximum line length of 60 characters. This includes a space after the line number and a space before the keywords 'TO', 'STEP', 'THEN', 'AND', 'OR', 'GOTO' and 'GOSUB'. These spaces are automatically added by the save option.
The program is also checked for control characters. The numbers of the lines containing errors are displayed on the screen; the lines can be corrected before saving on tape. Option 2 saves the program on tape starting at line 1000, the BASICODE-2 subroutines are not included. Option 3 saves the entire program, which in fact contradicts the BASICODE-2 protocol! However it is a useful contradiction.
Before writing, a table is generated followed by the message 'START THE RECORDER AND TOUCH ANY KEY'.
After touching the key, the recording is started; when you hear the beep the save process is complete. If the memory size of your Apple is too small to store the program and the table, the program will be erased to make space.
In this case, you will see 'BASIC PROGRAM OVERWRITTEN'. If the table size is such that it cannot fit in your memory, you will see 'OUT OF MEMORY ERROR'. The program has been erased, but you can divide it in sections which, after save and load, may be merged. The memory size of most Apples is sufficient, so it will not be very often that you need to do this.