
SAVING CODE AND DATA BASIC SECTION 3
Page 3-2
WARNING:
Be careful using the BSAVE command. RPBASIC
resides at addresses 0.7000H, segment 0. If you
overwrite any portion of this area, RPBASIC-52
may operate er ratically. You can sa fely write data
and assembly language code from 7000H to FFFFH,
in segment 0.
Linking Programs
EXECUTE loads and runs the program in the program
specified by SAVE. The range for EXECUTE and
SAVE is 1 to 7 on the RPC-210 card.
Make the following modifications to the above program
to see how one program can call another.
Add the following lines:
10 PRINT "Program segment 1"
60 EXECUTE 2
Now type:
SAVE 2
Modify lines 10 and 60 as follows:
10 PRINT "Program segment 2"
60 EXECUTE 1
Now type:
SAVE or SAVE 1
(Typing SAVE is the same as typing SAVE 1).
To see the programs operate, type RUN. To stop
program execution, press < Ctrl-C> .
You may notice there is a slight pause between the
printed hello' s and program segment number . T his is
the time it takes to clear memory and load the program.
Loading and clearing take appr oximately 0.25 seconds in
a very small program and several seconds in a very large
program.
When linking programs, RPBASIC-52 var iables are not
preser ved. Data m ust be saved to R AM in segmen t 1
before executing a program and restored by the new
program.
Demo programs EXEC1. BAS through EXEC7.BAS,
when saved to EPROM, call one another randomly and
print out the number of times each program was called.
These program s are in the BASIC52 directory.
AUTORUNNING
To autor un a prog ram, br ing J7-17 to ground(J7-15 is
ground). P ush the reset button. The pr ogram , if any, in
EPROM segment 1 will run. If there are any error s, the
program will stop (assuming you have not trapped them
with ON ERROR) and display the error message.
Converse, to prevent autorun, remove the ground from
J7-17. You can still load/modify/run the program by
first executing LOAD. See below.
LOADING A PROGRAM
There are tim es when y ou may w ish to tempor arily
modify or otherwise test out a change to a program.
Since the program is loaded into RAM in autorun,
modifications can be made without affecting the program
in EPROM. Use the LOAD or LOAD n command to
transfer the EPROM program to RAM.
If you find out that modifications are not desirable or did
not work, you can restore the original program to RAM
using the LOAD command.
HIDING A PROGRAM
You can hide programs using the HIDE comm and.
Simply typing in this command in the immediate mode
or as part of command line hides code. You will not be
able to list it.
WARNING:
HIDE IS VIRTUALLY IRREVERSIBLE.
ONCE EXECUTED, YOU CAN NOT
‘UNDO’ A HIDE.
To further protect your pr ogram, put HIDE as one of the
first lines of your code. Once executed or found by the
LIST command, it will not list the rest of the program.
You can clear out a program using NEW and download
a new one. However, the flags used to indicate a hidden
program are still active and this new program cannot be
listed.
HIDE should be the very last change during program
development.
Commentaires sur ces manuels