User guide
8.3. LOADING AND STORING VALUES 147
to S in the description of OCODE s tat em ents should be regarded as a specification of
S for the subsequent statement.
Static variables, tables and string constants are allocated space in the program
area and ar e referenced using labels such as L36 and L92. All glob al , loc al and static
variables are of the same size and, on mos t modern implementations, they hold 32 bit
values. More recently 64 bit versions of BCPL are becoming more common.
OCODE is normally encoded as a sequence of integers, but for human consumption
a more readable form is available. The command procode translates the numeric
OCODE into this mnemonic form. An OCODE statement consists of a function or
directive code possibly followed by operands that are either optionally signed integers,
quoted characters or labels of the form Ln wher e n is a label number. The following
are examples of mnemonic OCODE statements:
LSTR 5 ’H’ ’e’ ’l’ ’l’ ’o’
LP 3
GETBYTE
SL L36
There are OCODE statements for loading and storing values, for applying expres-
sion op e r ator s, for the implementation of functions and routine, and to control the
flow of execution. There are also directives for the allocation of storage and to all ow
information to be passed to the codegenerator.
8.3 Loading and Storing values
A variables may be local, global or stati c, and may be accessed in three ways depending
on its context, and so there are 9 stat em ents for accessing variables as shown in the
following table.
Statement
Meaning
LP n P!S := P!n; S := S+1
LG n
P!S := G!n; S := S+1
LL Ln
P!S := Ln; S := S+1
LLP n
P!S := @P!n; S := S+1
LLG n
P!S := @G!n; S := S+1
LLL Ln
P!S := @Ln; S := S+1
SP n
S := S-1; P!n := P!S
SG n
S := S-1; G!n := P!S
SL Ln
S := S-1; Ln := P!S
The following tables shows the six statements for loading constants.