beautypg.com

Rpbasic-52 programming guide, Appendix d - data storage, String storage – Remote Processing BASIC 52 User Manual

Page 161: Variable storage, Floating-point format

background image

RPBASIC-52 PROGRAMMING GUIDE

D-1

APPENDIX D - Data storage

STRING STORAGE

BASIC-52 stores string variables between MTO P and top of variable space, call VARTO P. String $(0) would be
stored from VARTOP to [VARTOP + (bytes_per_string + 1)]. String $(1) is stored from [VARTOP +
(bytes_per_string + 2)] to [VARTOP +2 * (bytes_per_string + 1)], and so on.

All strings are term inated with a c arriage return (0D H, 13 decim al).

VARIABLE STORAGE

Scaler variables are numbers not in a dimension. Dimensioned or arrayed variables (commonly referred to as
"arrays") are those whose identifier includes a single-dimensioned expression.

Scaler variables:

PAR T, A1 , B

Dimensioned va riables:

T E M P ( 5) , P R E S S (A )

Scalars are stored starting at VARTO P-1, with storage growing down at eight bytes per variable.

FLOATING-POINT FORMAT

RPB ASIC-5 2 stores all floating-point nu mbers in a no rmalized pa cked binary-co ded decim al (BCD ) format. All
numbers are normalized, so the most significant digit in a floating-point number is never zero unless its actual
value is zero.

To demonstrate the floating-point format, see how RPBASIC-52 stores 12345678.

L O C A T I O N

V A L U E

D E S C R I PT I O N

X

88H

exponent: 81H = 10

1

, 80H = 10

0

, 7FH = 10

-1

, etc.

Zero is represented by a zero exponent

X-1

00H

sign bit: 00H = positive, 01H = negative
Other bits are temporary values used only during calculations

X-2

78H

least significant tw o digits

X-3

56H

next least significan t two digits

X-4

34H

next most sig nificant two digits

X-5

12H

most significan t two digits

So we have .12345678 X 10

8

which is 12345678.

The PO KEF c omm and stores num bers in RA M in this sam e format. PE EKF e xpects to read a number in th is
format.