Rpbasic-52 programming guide, Save – Remote Processing BASIC 52 User Manual
Page 117

RPBASIC-52 PROGRAMMING GUIDE
2-98
SAVE
Syntax:
SAVE [segme nt]
Where: segment = 0 up to 7
Function:
S a ve p ro g ra m to fl as h E P R OM .
Mode:
Comm and
Use:
SAVE 1
Cards:
All
D E S C R IP T I ON
Use SAVE to store programs in flash EPROM. The current program in RAM is saved to the segment
specified. If no segment is specified, 0 is assumed. Up to 8 programs (totaling over 500K bytes) can be
saved, depending upon the flash EPROM type. Using EXECUTE , any of these 8 programs can be loaded and
r un d ur in g ru n -t im e . U s e L O A D to re t ri e ve a pr og ra m .
SAVE automatically determines the type of flash EPROM installed. When an attempt is made to save a
program to a segment larger than allowed by the EPROM type, an error message is returned.
The largest segment size depends upon the type of flash EPROM installed. The following table shows the
l ar ge st se g me n t f or a p a rt ic u la r E P R OM .
E P R O M
Size
Sector
Segment
type
Bytes
size
range
29C256
32K
64
0
29C040
512K
512
0-7
SAV E com pletely overw rites previous data in m emory, up to the program size plus enough b ytes to com plete
a sector. A sector is the number of bytes programmed in a flash at a time. For example, if a program was
only 100 bytes lo ng and a 29C 040 is installed, 412 by tes of "filler" are also progra mme d. If a program is
1000 bytes long , 24 bytes of filler are program med ( 2 sec tors = 512 bytes). Se ctor sizes are not a c oncern
except to users of BSAVE comm and.
Maximum program size also depends upon the amount of RAM installed. A 32K RAM can run a 29K
p ro g ra m . A 1 28 K or 51 2 K R A M c an e xe c ut e u p to a 60 K by te p ro g ra m .
To fin d out th e leng th of the progra m cu rrently in RA M, typ e PR INT LEN in the im med iate m ode.
Frequently, the length of a program in RAM is 10% to 30% less than that in a disk file. This is because the
code is tokeniz ed and com mands a re replaced w ith a single charac ter.
When program requirements are small and data is large, some data can be saved to the flash EPROM using
the B SAV E com man d.
RELATED
B S A V E , EX E C U T E , LO A D
E R R O R
BAD DATA
If segment is > 7 or larger than flash EPROM type.