
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, address 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, number of bytes to write
Function: Writes raw binary data to flash EPROM from RAM.
Mode: Command, run
Use: BSAVE 1, ROMTO , 1,RAMPTR , 512
Cards: RPC-320, RPC-330
DESCRIPTION
BSAVE writes a block of binary information to E PRO M from RAM . Use the PO KE com mands to w rite data
to RAM.
WARNING: BSAVE should be used sparingly. The flash EPROM has a limited number of write cycles
(1000) to each sector.
A length of 0 writes 65,536 bytes.
Limited pa rame ter checking is perfo rmed. Basic assum es RA M exists at the segm ent and address 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
RAM or E PRO M is used, 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 and its address is limited to 32767 decimal, or 7FFFH.
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 autom atical ly detects the type of 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 bytes to be saved, 512 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
different write addresses were specified. Th is brings us to the second rea son se ctor siz e is considered.
RPBASIC forces the requested EPROM address down to an even sector 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
Komentarze do niniejszej Instrukcji