Rpbasic-52 programming guide – Remote Processing BASIC 52 User Manual
Page 8
RPBASIC-52 PROGRAMMING GUIDE
1-5
RPBASIC-52 Memory Map
subroutines is limited to the amount of internal stack
space. Usually this is about 35 subroutines, but can
go down if F OR-N EXT loops are active. T his is
s u ff i ci e nt t o h a n dl e al l m ul t i- t as k in g (O N L I N E , O N
COUN T, ON KEY PAD, etc.) and several levels of
subroutines.
Most complex programs tend to have a maximum of
7 nested subrou tine levels. Usua lly the maxim um is
4.
Passing Variables Between Programs
All variables in R PBA SIC-52 are g lobal. This
means any routine can modify any variable at any
time. When a new program is loaded using
EXECU TE, variables are erased.
Values can be passed between programs using any
variations of PEEK and P OKE statem ents.
Addresses
Addresses are specified as either decimal or
hexadecim al numbe rs. Hexadec imal addres ses with
a leading alpha character nee d a preceding zero
otherwise they will be interpreted as variable name s.
100
POKEB,1,1000H,15
110
A = PEEKB(1,1000H)
Memory addresses range from 0 to 0FFFFH and
segments from 0 to 7. A segment represents a 64K
block of memory. Programs and RPBASIC -52
variables reside in se gment 0. V ariables are
generally stored in s egmen t 1 and higher.
Basic program area can be 32K or 64K, depending
upon t he am ount o f RA M ins talled .
Arrays
Arrays are single dimension and start with element
0. They are dim ensioned using the DIM statement.
Each varia ble may h ave up to 255 e lements (0 to
254). Undimensioned arrays default to 11 elem ents,
variable (0) through variable (10). Naming
conventions used for scaler variables apply to arrays.
Strings
M e m o r y i s al l oc a te d to s tr i ng s us i ng t he S T R IN G
command. There is no power up default. Up to 255
strings, identified as $(0) throug h $(254) are
available.
To use strings, you must first determine the
maximum length of any one string and then the
maxim um num ber of strings. Using the formula
(bytes/string + 1) * number of strings + 1
returns the number of bytes to allocate.
The AS C, CH R, and ST R com mands a re used to
evaluate and manipulate strings. Text assigned to a
string is enclosed in double quotation marks:
100 STRING 1000,40
110 $(0)=">03"