pTAL Conversion Guide

Pointers
pTAL Conversion Guide527302-002
10-21
Implicit Conversions
In the preceding code, the address type of SRC is WADDR, but the address type
of DEST is EXTADDR. The native compiler automatically converts the address
type of SRC to EXTADDR.
Call-by-reference actual parameters
The native compiler automatically converts the address type of an actual
parameter to the address type of a formal parameter:
PROC p (i);
EXTADDR .i;
BEGIN
...
END;
PROC p2;
BEGIN
INT .i;
CALL p(@i); ! Convert address type of i
! from WADDR to EXTADDR
END;
Table 10-5. Valid Address Conversions (see also Table 10-6 on page 10-22)
From
To
BADDR WADDR CBADDR CWADDR
SGBADDR
SGBXADDR
BADDR Identity Note 1
WADDR Note 2 Identity
CBADDR Identity
CWADDR Identity
SGBADDR
SGBXADDR
Identity
SGWADDR
SGWXADDR
Note 2
EXTADDR
PROCADDR
INT Note 3 Note 4 Note 5
INT32
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. INT constant only, which pTAL treats as a G-relative byte address.
4. INT constant only, which pTAL treats as a G-relative word address.
5. Input INT, which pTAL treats as a SG-relative byte address.