pTAL Conversion Guide

Pointers
pTAL Conversion Guide527302-002
10-18
Converting Between Addresses and Numbers
Converting Between Addresses and Numbers
pTAL supports only limited conversions between address types and numeric data
types.
Topics:
Numeric Conversions With BADDR and WADDR Addresses on page 10-18
Numeric Conversions With SGBADDR, SGWADDR, SGXBADDR, and
SGXWADDR Addresses on page 10-19
Numeric Conversions With CBADDR, CWADDR, and PROCADDR Addresses on
page 10-20
Numeric Conversions With EXTADDRs Addresses on page 10-20
Numeric Conversions With BADDR and WADDR Addresses
pTAL does not support these conversions:
From BADDR or WADDR to numeric data types
From numeric data types to BADDR or WADDR variables or pointers
You can, however, assign a 16-bit integer constant to a BADDR or WADDR address.
You might use this feature to initialize pointers to reference particular locations in the
upper 32K-words of the user data segment or to initialize a pointer to a value that your
program defines as NIL.
Example 10-3. Storing Addresses in Pointers and Variables (pTAL)
Invalid:
INT .i;
INT .EXT j;
WADDR w;
BADDR b;
EXTADDR e;
i := @b; ! ERROR: Cannot store WADDR into INT
Valid:
INT .i;
INT .EXT j;
WADDR w;
BADDR b;
EXTADDR e;
w := @i; ! Store WADDR into WADDR
e := @j; ! Store EXTADDR into EXTADDR
@i := w; ! Store WADDR into WADDR
@i := @b; ! Store WADDR into WADDR
e := ! Convert WADDR to EXTADDR and
$WADDR_TO_EXTADDR(@i); ! store into EXTADDR