EasyManua.ls Logo

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

Texas Instruments TI-89
334 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
82
Section 2: Compiler
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
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 Operation
__du16u16 Divide 16-bit unsigned by 16-bit unsigned
__ds32s32 Divide 32-bit signed by 32-bit signed
__du32u32 Divide 32-bit unsigned by 32-bit unsigned
__ds16u16 Divide 16-bit signed by 16-bit unsigned
__ms16u16 Mod 16-bit signed with 16-bit unsigned
__mu16u16 Mod 16-bit unsigned with 16-bit unsigned
__ms32s32 Mod 32-bit signed with 32-bit signed
__mu32u32 Mod 32-bit unsigned with 32-bit unsigned
Table 2.5: Integer Arithmetic Functions
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:
extern int i, j; move.l _i,d1
void f( void ) move.l _j,d0
{ jsr __ds32s32
i = i / j; move.l d1,_i
} rts

Table of Contents

Other manuals for Texas Instruments TI-89

Related product manuals