pTAL Conversion Guide

pTAL Built-In Routines
pTAL Conversion Guide527302-002
18-51
$UDIVREM32
$UDIVREM32
$UDIVREM32 provides the functionality of the TNS LDIV instruction. $UDIVREM32
performs unsigned division and produces a quotient and a remainder.
dividend input
INT(32):value
divisor input
sINT:value
quotient output
INT(32):variable
remainder output
sINT:variable
Note. The EpTAL compiler does not support this procedure.
pTAL privileged procedure No
Can be executed only by privileged procedures No
Sets condition code No
Sets $CARRY No
Sets $OVERFLOW Yes, if and only if the divisor is 0
Figure 18-22. TAL Code Equivalent to $UDIVREM32 Routine
STACK 0, dividend, divisor;
CODE(EXCH; STRP 2);
CODE(LDIV; EXCH);
CODE(STRP 3; EXCH);
CODE(LDIV; EXCH);
STORE remainder, quotient;
$UDIVREM32 (
,
,
) ;
VST654.vsd
,
dividend
divisor
quotient
remainder