
RPBASIC-52 PROGRAMMING GUIDE
2-84
POKEF
Syntax: POKEF segmen t,address,d ata
Where: segment = 0 to 7, specifies the 64K segment
address = 0 to 65535, location in segment to save to
data = +/- 1E-127 to +/- 0.99999999E+127, number to save to RAM
Function: Writes a floating point number to RAM.
Mode: Command, Run
Use: POKE F1,AD,DA
Cards: All
DESCRIPTION
Use POKEF to w rite floating point num bers into RAM. Program "constants" such as calibration tables are
saved to batte ry backed RAM .
WARNING: RPBASIC-52 does not check the address. It is possible to poke into the program, stack, or
variable areas. Results are unpredictable. Poke into mem ory above MT OP for safest
operation.
Each floating point number requires 6 bytes of R AM. W hen storing to RAM, separate addresses by at least 6
bytes. address is the starting address in RAM. Data is written to from address to address + 6. For exam ple, if
the first address was 0, the next is 6, third 12, and so on. An easy way to calculate an address is to use an
index number and multiply it by 6. By adding a constant, different sections of RAM may be used. See the
POKEB command for segment and address information.
RELATED
PEEKF
ERRORS
BAD SYNTAX If W, segmen t, address, or data is missing.
BAD DATA If segment is > 7, address or data > 65535 or negative
EXAMPLES
The following example takes data from an analog input, multiplies it by a con stant, and saves it to seg ment 1
of the 128K RAM.
1000 FOR N = 0 TO 7
1010 POKE F1,N*6+100,AIN(N)*1.2383
1020 NEXT
The equation "N*6" is an index multiplier.
The next example prints out the data from RAM.
500 FOR N = 0 TO 7
510 PRINT PEEKF(1,120+N*6)
520 NEXT
The expression "120+N *6" performs two functions. First, 120 is a fixed offset into RA M. This offset is
necessary when allocating sections of RAM for storage parameters (strings, byte data, and other floating point
numbers). "N*6" indexes the floating point number into RAM so it does not overwrite other valid numbers.
Komentáře k této Příručce