User guide

148 CHAPTER 8. THE DESIGN OF OCODE
Statement Meaning
LF Ln P!S := entry point Ln; S := S+1
LN n
P!S := n; S := S+1
FNUM m e
P!S := <make float>(m, e); S := S+1
TRUE
P!S := TRUE; S := S+1
FALSE
P!S := FALSE; S := S+1
QUERY
P!S := ?; S := S+1
LSTR n C
1
. . . C
n
P!S := "C
1
. . . C
n
"; S := S+1
LF Ln loads the entry point of a non global function onto the stack. LN n l oads the
signed integer constant n onto the stack. FNUM m e loads a floating point approximation
of a number with signed integer mantissa m and signed integer decimal exponent e onto
the stack. The statements TRUE and FALSE are present to improve portability between
machines that use different representations for the integers. For instance, on machines
using ones complement or sign and m odulus arithmetic, TRUE is not equivalent to LN
-1. QUERY loads an undefi ned val ue onto the stack, and the LSTR statement allocates a
string in static memory and loads a pointer to it onto the stack.
Indirect as si gnme nts and assignments to elements of word and byte arrays normally
use the statements STIND and PUTBYTE whose meanings are given in table 5.3.
Statement
Meaning
STIND !(P!(S-1)) := P!(S-2); S := S-2
PUTBYTE
(P!(S-2))%(P!(S-1)) := P!(S-3); S := S-3
Assuming ptr is in global 200, the foll owing assignments:
!ptr := 12; ptr!3 := 99; ptr%3 := 65
translate into the following OCODE:
LN 12 LG 200 STIND
LN 99 LG 200 LN 3 PLUS STIND
LN 65 LG 200 LN 3 PUTBYTE
8.4 Field Selection Operators
Accessing and updating fields as requi r e d by the OF operator are implemented using
the OCODE operators SELLD and SELST.
SELLD takes two argments len and sh. It effect is e q ui valent to
P!(S-1) := !(P!(S-1)) >> sh & mask
where mask is a bi t pattern containing len ri ght justified ones. If em len is zero no
masking is done.
SELST takes three argments op, len and sh. If op is zer o, its effect is equival e nt to
SLCT len:sh:0 OF (P!(S-1)) := P!(S-2); S := S-2