■ List of multiplication/division library [16-bit multiplication/division] ・16-bit multiplication (For both signed/no signed):__imulu8sw ・Signed 16-bit division:__idivu8sw ・Signed 16-bit module:__imodu8sw ・No signed 16-bit division:__uidivu8sw ・No signed 16-bit module:__uimodu8sw
[32-bit multiplication/division] ・32-bit multiplication (For both signed/no signed):__lmulu8sw ・Signed 32-bit division:__ldivu8sw ・Signed 32-bit module:__lmodu8sw ・No signed 32-bit division:__uldivu8sw ・No signed 32-bit module:__ulmodu8sw
■ Calling method of multiplication/division library [Calling procedure of 16-bit multiplication/division] (1) Set the argument to register ER0,ER2 (2) Call the library with the bl command (3) Get the content of calculation result (ER0)
<Example> Signed 16-bit division Numbers (1) to (3) correspond to the above step. _si_num, _si_den, _int_res are user defined variable name labels.
l er0, _si_num <== (1) Setting the dividend
l er2, _si_den <== (1) Setting the divisor
bl __idivu8sw <== (2)
st er0, _int_res <== (3)
[Calling procedure of 32-bit multiplication/division] (1) Store the argument in stack (2) Call the library with the bl command (3) Change the stack pointer to the stack a calculation result is stored. (Add 4 to the stack pointer) (4) Get the content of calculation result (stack)
<Example> Signed 32-bit division Numbers (1) to (4) correspond to the above step. _sl_num, _sl_den, and _long_res are user defined variable name labels.
l er0, _sl_num <== (1) Setting the dividend l er2, _sl_num+02h <== (1) push xr0 <== (1)
l er0, _sl_den <== (1) Setting the divider l er2, _sl_den+02h <== (1) push xr0 <== (1)
bl __ldivu8sw <== (2)
add sp, #4 <== (3)
pop xr0 <== (4) st er0, _long_res <== (4) st er2, _long_res+02h<== (4)
*When using the multiplication/division library, select [Project] -> [Options] -> [Target] in IDEU8, and check [Automatically search C emulation library] in the [Target Option] dialog. *For calling a program written in C language with the assembly language, refer to "1.6 Combining with Assembly Language" in "CCU8 Programming Guide".