Internal Integer Arithmetic Functions; Table 2.5: Integer Arithmetic Functions - Texas Instruments TI-89 Software Manual

Sierra c assembler
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

82
2.12.1.

Internal Integer Arithmetic Functions

The 68000 compiler, com68, generates function calls to perform integer
arithmetic when in-line code would require an unacceptable amount of space. It
also generates function calls to perform some division and modulus operations.
The size and type of the operands determine whether a function call is
generated. For example, the division of two signed 16-bit operands will be
handled by in-line code, but the division of two signed 32-bit operands will be
handled by a function call. Table 2.5, Integer Arithmetic Functions, lists the
functions that are called by the 68000 compiler to perform the specified integer
arithmetic operations.
Function Name
_ _ du16u16
_ _ ds32s32
_ _ du32u32
_ _ ds16u16
_ _ ms16u16
_ _ mu16u16
_ _ ms32s32
_ _ mu32u32
Arguments are passed to the functions listed in Table 2.5 in registers d0 and d1;
they are not passed on the stack. Results are always 32 bits and are returned in
register d1 (basically, d1 = d1 / d0 or d1 = d1 % d0). The functions that operate
on 16-bit operands use only registers d0 and d1. The functions that operate on
32-bit operands also use registers d2, a0, and a1.
The following example, which shows both a 68000 C file and the generated
assembly code, illustrates the generation of an internally generated function call:
TI-89 / TI-92 Plus Sierra C Assembler Reference Manual
Operation
Divide 16-bit unsigned by 16-bit unsigned
Divide 32-bit signed by 32-bit signed
Divide 32-bit unsigned by 32-bit unsigned
Divide 16-bit signed by 16-bit unsigned
Mod 16-bit signed with 16-bit unsigned
Mod 16-bit unsigned with 16-bit unsigned
Mod 32-bit signed with 32-bit signed
Mod 32-bit unsigned with 32-bit unsigned

Table 2.5: Integer Arithmetic Functions

extern int i, j;
void f( void )
{
i = i / j;
}
move.l
_i,d1
move.l
_j,d0
jsr
__ds32s32
move.l
d1,_i
rts
Not for Distribution
Section 2: Compiler
Beta Version February 2, 2001

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92 plusTi-89 plusTi-92 plus

Table of Contents