pTAL Reference Manual (H06.08+)

Data Representation
HP pTAL Reference Manual523746-006
3-7
Storing Addresses in Variables
Storing Addresses in Variables
You can store an address into a variable when either of the following is true:
The address is the same data type as the variable into which you are storing the
address.
The address is convertible to the data type of the variable into which you are
storing the address.
Converting Between Address Types and Numeric Data Types
You can move any 16-bit integer valuea constant or variableinto any system global
address type (SGBADDR, SGWADDR, SGXBADDR, or SGXWADDR). Conversely,
you can move the value of any system global data type into a 16-bit integer variable.
You can move an EXTADDR into an INT(32), or an INT(32) into an EXTADDR.
Exceptions: You cannot convert the following address types to numeric data types:
CBADDR
CWADDR
PROCADDR
Converting Between Address Types
You can convert an address from one address type to another using either:
Built-in address-conversion functions (see Table 15-4 on page 15-14)
Shift operations and low-level built-in routines
These conversions are supported for compatibility with TAL. HP recommends that
you use the equivalent pTAL routine when you write pTAL code.
Expression Operand Type Equivalent Routine Call
e '<<' 1 WADDR $WADDR_TO_BADDR(e )
e '<<' 1 SGWADDR $SGWADDR_TO_SGBADDR(e )
e '<<' 1 SGXWADDR $SGWADDR_TO_SGBADDR(e )
e '>>' 1 BADDR $BADDR_TO_WADDR(e )
e '>>' 1 SGBADDR $SGBADDR_TO_SGWADDR(e )
e '>>' 1 SGXBADDR $SGBADDR_TO_SGWADDR(e )
$UDBL(e ) BADDR $BADDR_TO_EXTADDR(e )
$DBLL(0,e ) BADDR $BADDR_TO_EXTADDR(e )
$UDBL(e ) '<<' 1 WADDR $WADDR_TO_EXTADDR(e )
$DBLL(0,e ) '<<' 1 WADDR $WADDR_TO_EXTADDR(e )