pTAL Reference Manual (G06.24+, H06.09+, J06.03+)

Example 265 $INT Routine
PROC p;
BEGIN
INT .SG a;
SGXBADDR b;
INT i;
INT .EXT e;
i := $INT(a); ! OK: a is INT
i := $INT(@a); ! OK: @a is SGWADDR
i := $INT(b); ! OK: b is SGXBADDR
i := $INT(i); ! OK: i is INT
i := $INT(@b); ! ERROR: @b is WADDR
i := $INT(@i); ! ERROR: @i is WADDR
i := $INT(@e); ! OK: @e is EXTADDR
END;
$INT_OV
NOTE: $INT_OV is supported in the D40 and later product versions.
$INT_OV converts its argument to an INT value and sets $OVERFLOW in some cases.
NopTAL privileged procedure
NoCan be executed only by privileged procedures
NoSets condition code
NoSets $CARRY
YesSets $OVERFLOW
expression
is an expression whose value is an INT, INT(32), UNSIGNED(1-31), FIXED, REAL, REAL(64),
SGBADDR, SGWADDR, SGXBADDR, SGXWADDR, or EXTADDR value.
If the data type of its argument is an INT(32) value greater than 32767 or less than -32768,
$INT_OV traps if overflow traps are enabled (see Chapter 13 (page 234)); otherwise, $INT_OV
ignores the problem.
Example 266 Difference Between $INT and $INT_OV
INT i;
INT(32) j := 32767;
INT(32) k := 32768;
i := $INT(j); ! INT never sets overflow
IF $OVERFLOW THEN ... ! $OVERFLOW is false
i := $INT(k); ! INT never sets overflow
IF $OVERFLOW THEN ... ! $OVERFLOW is false
i := $INT_OV(j);
IF $OVERFLOW THEN ... ! $OVERFLOW is false
i := $INT_OV(k);
IF $OVERFLOW THEN ... ! $OVERFLOW is true
$INTERROGATEHIO
NOTE: The EpTAL compiler does not support this procedure.
318 Built-In Routines