pTAL Conversion Guide

Pointers
pTAL Conversion Guide527302-002
10-22
Converting Between Address Types
Converting Between Address Types
Topics:
Address Conversions Using pTAL Built-In Routines on page 10-22
Low-Level Address Conversions Using Arithmetic Operations on page 10-23
Address Conversions Using pTAL Built-In Routines
pTAL and TAL (starting with the D40 release of TAL) provide the following routines that
convert an address from one address type to another.
$BADDR_TO_EXTADDR(x)
$BADDR_TO_WADDR(x)
$SGBADDR_TO_SGWADDR(x)
$SGBADDR_TO_EXTADDR(x)
$SGWADDR_TO_SGBADDR(x)
$SGWADDR_TO_EXTADDR(x)
Table 10-6. Valid Address Conversions (see also Table 10-5 on page 10-21)
From
To
SGWADDR
SGWXADDR EXTADDR PROCADDR INT INT32
BADDR Note 2
WADDR Note 2
CBADDR Note 2
CWADDR Note 2
SGBADDR
SGBXADDR
Note 1 Note 2 Note 3
SGWADDR/
SGWXADDR
Identity Note 2 Note 4
EXTADDR Identity
PROCADDR Identity
INT Identity Note 5
INT32 Note 5 Identity
1. Requires explicit conversion using either a type-transfer routine ($SGBADDR_TO_SGWADDR or
$BADDR_TO_WADDR) or an unsigned right shift operator. The result of such a conversion is undefined if the
least significant bit of the BADDR address is 1.
2. Implicit conversion for passing a parameter by address. In all other cases, you must perform an explicit
conversion using a type-transfer routine or unsigned left-shift operator.
3. Output INT is SG-relative byte address.
4. Output INT is SG-relative word address.
5. Requires explicit conversion.