Rpbasic-52 programming guide – Remote Processing BASIC 52 User Manual
Page 25
RPBASIC-52 PROGRAMMING GUIDE
2-6
BSAVE
Syntax:
BSAVE to ROM segmen t,ROM address,fro m RA M segm ent, RAM address, len gth
Where: ROM segment = 0 to 7, the 64K byte block to w rite to
ROM address = 0 to 65535, ad dress to write to
RAM segment = 0 to 7, a 64K byte block to read from
RAM a ddress = 0 to 65535, address to read from
length = 0 to 65535, nu mber of byte s to write
Function:
W r it es ra w bi na ry d at a t o f la sh E PR O M fr om R A M .
Mode:
Comm and, run
Use:
BSAVE 1, ROMTO , 1,RAMPTR , 512
Cards:
RPC-320, RPC-330
D E S C R IP T I ON
BSA VE w rites a block of binary in formation to E PRO M from RAM . Use the PO KE com mands to w rite data
t o R A M .
WARNING:
BSAVE should be used sparingly. The flash EPROM has a limited number of write cycles
(1000) to each se ctor.
A length of 0 writes 65,536 bytes.
Lim ited pa rame ter che cking is perfo rmed . Basic assum es RA M ex ists at th e segm ent an d addr ess spe cified.
Basic checks to make sure the ROM segment specified is within limits of the installed EPROM , but addresses
and lengths are not checked.
WARNING:
BSAVE can write over programs saved using the SAVE command.
A segment can be though of as the X0000H address of the RAM or EPROM. When a segment of 1 and an
address of 4300H are used, the address equivalent to 14300H is used to access the device. When a 128K
RA M or E PRO M is u sed, segment is 0 or 1. A 512K RAM or EPROM can have a segment of 0 to 7. A 32K
device only has segment 0 a n d i t s a d d re s s i s li m i te d to 3 2 76 7 d ec i m a l, o r 7 F F F H .
A flash EPROM is written to in sectors. A sector is 64, 128, or 512 bytes for the 32K, 128K, or 512K
EPR OM respec tively. R PBA SIC a utom atical ly dete cts the type o f EPR OM installe d whe n it writ es to it.
You must pay attention to the sector size for two reasons. First, a sector is the minimum number of bytes
written. If a program requires only 35 by tes to be saved, 51 2 bytes are w ritten when a 5 12K EP ROM is
installed. If the following is performed
1000 BSAVE 6,5,1,1000H,35
.
.
2000 BSAVE 6,42,1,1025H,35
several things happen. The data saved by line 1000 is overwritten by the data in line 2000, even though
differe nt writ e addr esses were specif ied. Th is bring s us to th e seco nd rea son se ctor siz e is con sidere d.
RPB ASIC fo rces the requeste d EPR OM a ddress dow n to an even se ctor address. In both ca ses above, data is
written to the EPROM starting at address 0, not at 5 or 42.
The solution to this situation is to write data out in even sector size blocks and to write them on sector
boundaries.
A program is not required to write in full sector sizes. When less than 1 sector is specified, RPBASIC writes
the next data in RAM until the full sector size is reached. When a large number of bytes are written, covering