56 lines
518 B
C
56 lines
518 B
C
|
#include "mc8051fun.h"
|
||
|
|
||
|
/*
|
||
|
* val0,val1 = r0,r1
|
||
|
* r2 = result
|
||
|
* r7 = len of val0,val1
|
||
|
*/
|
||
|
void long_mul__() __naked
|
||
|
{
|
||
|
|
||
|
__asm
|
||
|
.globl long_mul
|
||
|
|
||
|
long_mul:
|
||
|
push AR0
|
||
|
push AR7
|
||
|
mov r0,AR2
|
||
|
lcall long_fill_zero
|
||
|
pop AR7
|
||
|
pop AR0
|
||
|
|
||
|
mov r6,#8
|
||
|
mov a,@r1
|
||
|
000$:
|
||
|
rrc a
|
||
|
jnc 001$
|
||
|
|
||
|
push ACC
|
||
|
push AR0
|
||
|
push AR1
|
||
|
push AR7
|
||
|
mov r1,AR0
|
||
|
mov r0,AR2
|
||
|
lcall long_add
|
||
|
pop AR7
|
||
|
pop AR1
|
||
|
pop AR0
|
||
|
pop ACC
|
||
|
|
||
|
001$:
|
||
|
push ACC
|
||
|
push AR7
|
||
|
push AR0
|
||
|
clr c
|
||
|
lcall long_rlc
|
||
|
pop AR0
|
||
|
pop AR7
|
||
|
pop ACC
|
||
|
|
||
|
djnz r6,000$
|
||
|
ret
|
||
|
__endasm;
|
||
|
}
|
||
|
|
||
|
|