beautypg.com

Remote Processing RPC-210 User Manual

Page 15

background image

SAVING CODE AND DATA

BASIC

SECTION 3

Page 3-2

WARNING:

Be careful using the BSAVE command. RPBASIC
resides at addre sses 0

.

7000H, segment 0. If you

overwrite any portion of this area, RPBASIC-52
may ope rate er ratically. You can sa fely wr ite data
a n d a s se m b ly la n gu a ge c od e fr o m 70 0 0H t o F F F F H ,
in segment 0.

L i nk i ng P ro g ra m s
EXEC UTE loads and runs the program in the program
specified by SAVE. The range for E XEC UTE 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 a s 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

p r o gr a m e xe c ut io n , pr e ss < C t r l- C > .

You may notice there is a slight pause between the
printed he llo' s and pro gram segmen t number . T his is
t he ti m e i t t ak e s t o c le a r m em o r y a n d l oa d th e pr o g ra m .
Loading and clear ing take appr oximately 0.2 5 seconds in
a very small program and several seconds in a very large
p r o gr a m .

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
p r o gr a m .

Demo pr ograms EX EC1. BAS through EXE C7. BAS,
when saved to EPRO M, 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 gr ound(J7-15 is
ground ). P ush the re set button. The pr ogram , if an y, in
EPRO M 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, r emove the ground from
J7-17. You can still load/modify/r un the program by
first executing LOAD. See below.

LOADING A PROGRAM

Ther e are tim es when y ou may w ish to tempor arily
m o d if y or o th e r wi se te s t o u t a c ha n ge to a pr o g ra m .
Since the program is loaded into RAM in autorun,
modifications can be made without affecting the program
i n E P R O M . U s e t he L O A D or L O A D n comm and to
transfer the EPROM program to RAM.

If you find out tha t modification s are not de sirable or did
not work, you can restore the original program to RAM
using the LOAD com mand.

HIDING A PROGRAM

You can hide program s using the HIDE comm and.
Simply typing in this command in the immediate mode
or as part of comm and line hides code. You will not be
able to list it.

WARNING:

HIDE IS VIRTUALLY IRREVERSIBLE.

O N C E E X EC U T E D , Y O U C A N N O T

‘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
L I ST c o m ma n d, i t wi ll no t l is t t he r e st of th e pr o g ra m .

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
developm ent.