pTAL Conversion Guide

Pointers
pTAL Conversion Guide527302-002
10-20
Implicit Conversions
Numeric Conversions With CBADDR, CWADDR, and
PROCADDR Addresses
pTAL does not allow conversions between numbers and CBADDR, CWADDR, and
PROCADDR addresses.
Numeric Conversions With EXTADDRs Addresses
You can move an EXTADDR into an INT(32), or an INT(32) into an EXTADDR.
Implicit Conversions
pTAL generates implicit conversions for the following operations:
Block moves and comparisons
The native compiler automatically converts an address type if required for the
source or destination pointer in a block move or block comparison instruction:
INT .src;
INT(32) .dest
dest ':=' src FOR string_length ELEMENTS;
IF src <> dest for string_length ELEMENTS THEN
report_error(x);
@sg1 := -1; ! Move 16-bit INT treated as word address
! to SGWADDR
@sg1 := i ; ! Move 16-bit INT treated as word address
! to SGWADDR
@sg2 := i ; ! Move 16-bit INT treated as word address
! to SGWADDR
sg2 := i ; ! Move 16-bit INT treated as byte address
! to SGWADDR
@str2 := i ; ! Move 16-bit INT treated as byte address
! to SGWADDR
i := @sg1; ! i holds 16-bit word address
i := @sg2; ! i holds 16-bit word address
i := sg2; ! i holds 16-bit byte address
i := @str2; ! i holds 16-bit byte address
Example 10-6. Numeric Conversions With EXTADDR Addresses (pTAL)
INT .EXT i;
INT(32) j;
@i := j; ! Move INT(32) into EXTADDR
j := @i; ! Move EXTADDR into INT(32)
Example 10-5. Numeric Conversions With System Global Addresses
(pTAL) (page2of2)