All 2068 and Spectrum programs are saved/recorded on tape in one or more sections. These sections can be:
BASIC (program)
SCREEN$ (bytes)
or
MACHINE CODE (bytes)
Basic programs usually just have a basic section but machine code programs have 2 or 3 sections. These could include the basic section, maybe a screen$, and at least one code section.
HEADER
Every section on tape is preceeded by a header. This is the short part that loads when the border shows blue & red stripes. After a header has loaded, the title of the section will usually appear on screen. Besides the title, the header also loads in the length and starting address of the section.
FIGURE 1
10 REM this is a sample program to illustrate its structure.
20 LOAD "s" SCREEN$
30 LOAD "mc" CODE
40 CLS :PRINT "Stop Tape"
50 etc.,etc.......
60 (Basic Program)
70
80 STOP
90 SAVE "example" LINE 20: SAVE "s" SCREEN$: SAVE "mc"CODE
100 STOP
PROGRAM STRUCTURE
Figure 1 shows some of the basic section of a program. All of the program would be on tape as illustrated in Figure 2. This is a typical 3-section program with basic, screen and code. Note line 90 which is the save line. All programs do not always have a save line. In this one, the basic is saved by
SAVE "example" LINE 20
This means that when the saved program is loaded, it will automatically go to line 20. Therefore line 20 is called the auto-start line of the program. Line 20 instructs to LOAD “s” SCREEN$ so that the screen will load while the tape is still running. Then line 30 will LOAD “mc” which are the machine code bytes. This is the last section to be loaded so line 40 PRINTS a message to stop the tape player.
The rest of the program is then executed and somewhere in the basic there will be an instruction to access the machine code that was previously loaded.(This is done with the USR command). As the header of each section was loaded, the screen would have displayed Figure 3, however, a SCREEN$ would cover up part of it.
FIGURE 2
Program header Basic program Screen header Display screen Machine code header Bytes of code
FIGURE 3
Program: example bytes: s bytes: mc
PROBLEMS
Sometimes a header won’t display the title or the basic will not contain a SAVE line and you will not know where the auto-start line is.
To solve all these problems, we use a special utility program that allows us to load a header on top of it and it gives us all the required information. One such utility is called “Header”. To use it we first load it in and just follow the directions on the screen. The header of each section is loaded in with “Header” and we can read the needed info on the screen and/or let the printer put it on paper.
LET’S TRY IT
1. We will make a back-up of the program in Figure 1. The first step is to obtain the following information:
*Name of each section,
*Auto-start line of basic,
*Start address of each code section, and
*Length of each code section
If this cannot be readilly obtained by looking for the save line in the basic, then you must use a special utility such as “Header”.
2. Now load in only the basic section of the program in one of two ways. One way is to LOAD “” and BREAK when it has loaded the first section In some programs, you may not be able to BREAK. For these you must load them using: MERGE “”. This will cause a break automatically at the end of the first section. Try to stop the tape player right at the end of this section so that it is positioned at the start of the second section.
3. This basic can now be saved onto your back-up tape by:
SAVE "example" LINE 20
4. Now load the computer with the SCREEN$ section using one of the following:
LOAD "" SCREEN$
LOAD "" CODE
Do not erase this from your computer screen. It will end the load with message:[illegible] Immediately stop the tape at this point.
5. Now save the displayed screen onto the back-up tape using:
SAVE "s" SCREEN$
NOTE a SCREEN$ is always put at address 16384 and it is always 6912 bytes long. Therefore we could have saved it using:
SAVE "s" CODE 16384,6912
6. LOAD in the last section (machine code) from the original tape with:
LOAD "" CODE
7. Save this code and indicate the address it is to be put and the length of it.
SAVE "mc" CODE 40000,1200
In the sample the 40000 is the starting address of the code and 1200 is the number of bytes long it is. These must be included whenever saving code.
7. If the program has more sections just repeat the procedure for the extras,and if there are fewer, omit those. Now you may wish to verify everything using:
VERIFY ""
to check the basic and:
VERIFY "" CODE
to check the code. You can not verify the SCREEN$ so just skip over it when verifying.
PROGRAMMING TRICKS
The title of the basic program will always print on screen when its header is loaded, but the title of any following sections is sometimes not shown. This is done by making the ink and paper the same colour before that section is loaded. Obtain the hidden title by the use of “Header”.
When the basic section is loaded and you wish to BREAK the loading process at the end of the section, you may get a crash or it may keep on loading. This trick is done by a POKE in the auto-start line or by the ON ERR command. Overcome this problem by loading the basic with the MERGE command.
Sometimes there is a blank area of tape between sections. This would be needed for the basic to do something before the line that loads the next section. For example, the “Upload 2000” program does a short display routine between the basic and the machine code. Be sure to insert this same length of blank in your back-up. You can determine this length by timing it or with the tape counter.
NOTES
1. Make back-ups using the same names as the original unless you are sure the program won’t need names.
2. If you are in doubt whether the next section is a screen or machine code, load it with: LOAD “” CODE
3. Sometimes you will not need to use the Header utility. Many programs have all the necessary info in a save line in the basic section.
4. When saving a screen, it must be present on the TV screen or it will not save.
5. If the basic has a save line you can GOTO this line to save all sections but Note #4 applies. When saving more than one section by using the save line, be ready to press a key when prompted.
6. Note that throughout this article, I have used the term “back-up” as opposed to a “copy”. Even though we are dealing with making a copy or duplicate of an original program, the term “back-up” has a more legal ring to it!
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.