Do you have some machine code programs stored on tape that require POKEing RAMTOP before LOADing the program from cassette? Or are you writing your Basic programs around a favorite machine code POKEing routine? If so, knowing how to program the LOAD command can be a real convenience.
Using the LOAD command in a program allows you to read and execute a series of programs on tape without the hassle of starting and stopping the cassette deck. The first program can change RAMTOP in preparation for a machine code POKEing program. The next program(s) can POKE in your USR routine(s) above RAMTOP. The last program can be a basic program that uses the USR routines.
To illustrate how this works in practice, the LSCROLL program written by Douglas D. Sharp will be used (SYNC 2:2).
Listing 1 is a program to change RAMTOP. Type in this program. To store this program on tape, you need to be able to distinguish between the LOAD and SAVE modes by looking at the TV display. If you are unfamiliar with the LOAD pattern, type RUN and ENTER to observe the LOAD pattern. Hit the BREAK key to exit the LOAD mode. When you know what the LOAD pattern looks like, you are ready to store this program on tape. Use the following procedure:
1) Press CLEAR and ENTER, RUN 500 and ENTER, and start your cassette deck in record mode.
2) Observe the SAVE pattern on the TV display.
3) Stop the cassette deck when the LOAD pattern appears.
4) Hit the BREAK key to exit the LOAD mode.
Listing 1. RAMTOP Change.
10 POKE 16388,68
20 POKE 16389,127
30 LOAD "LSCROLL"
40 STOP
50 SAVE "TEST LSCROLL"
60 GOTO 10
Listing 2 is the program for LSCROLL. Some readers will already have it on tape. For those who do not, carefully type in the program and RUN it. If, within a few seconds, the number 22093 appears on your screen, you have correctly entered the program.
Listing 2. LSCROLL.
4 LET C=0
5 REM ALL OS IN THIS LISTING
6 REM ARE ZEROS.
10 LET D$="3AEE7FFE16DA517F3E0032EE7F3AEF7FD600CA617FFE15D2617FC3667F3E1632EF7FF53AEF7F47F13AEE7F80FE16DA857F26002E163AEE7F4F0600ED427D32EF7FED5B0C400EFFF53AEE7F6FF1260006001AFE76CA9F7F13C3957F0CA7E5ED42E1CAAC7F13C3957F0600F53AEF7F4FF1C5D5E1237EFE76C2B77FE5A7ED522B7D4DD600E1C2D07FE5D1C3E57F3DC2D87F13C3E17F06000B13D5E123EDB03E001213C10B79D600C2B47FC90000"
20 FOR X=2 TO 344 STEP 2
30 LET P=(CODE D$(X-1)-28)*16
40 LET P=P+CODE D$(X)-28
50 POKE 32579+INT (X/2),P
60 LET C=C+P
70 NEXT X
80 PRINT C
Modify the LSCROLL program by typing in the additional statements in Listing 3. SAVE the program on tape directly after the first program. Use the same procedure as before—except substitute the command RUN 100 for RUN 50.
Listing 3. Additional Statements.
80 LOAD "TEST LSCROLL"
90 STOP
100 SAVE "LSCROLL"
110 GOTO 4
Did you notice the screen go blank before the LOAD pattern appeared? The program was executing during this time.
Type NEW and ENTER to erase the LSCROLL listing.
Now type in the program in Listing 4. Save this program after the second program. Use the command
SAVE “TEST LSCROLL” and ENTER
This program is being SAVEd in the standard fashion under the name “TEST LSCROLL”.
Listing 4. Test LSCROLL.
10 PRINT AT 0,13;"TEST";AT 5,13;"HELLO";AT 20,13;"GOODBYE"
20 POKE 32750,2
30 POKE 32751,20
40 PAUSE 20
50 RAND USR 32580
60 GOTO 40
Now it is time for the acid test. Rewind your cassette deck into position to LOAD the first program. You should be able to LOAD and execute all three programs in a single loading. Let’s go:
1) Type LOAD “TEST LSCROLL” and ENTER.
2) Start the cassette deck.
3) Observe your TV display.
You should be able to distinguish the following phrases:
a) LOAD pattern.
b) Read pattern for the first program.
c) LOAD pattern.
d) Read pattern for the second program.
e) Execution of the second program (blank screen).
f) LOAD pattern.
g) Read pattern for the last program.
Continuing with the sequence,
4) Screen returns
5) Stop cassette deck
6) Type RUN and ENTER
Super! A single LOADing has changed RAMTOP, POKEd in a USR routine, and read in your Basic program. Only the program of interest is stored in memory. It is almost as good as buying a ROM that has your favorite USR routines on it.
A couple of questions for the reader to enjoy:
1) How could you modify the last program so that it runs itself after loading?
2) What do you think would happen if the BREAK key is pressed during the LOAD cycle during the phases that are asterisked?
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.