mc8051fun/long_add.c
2024-07-01 20:48:39 +02:00

34 lines
448 B
C

#include "mc8051fun.h"
#include "bcd.h"
#pragma disable_warning 59 // Disable "must return a value" warning
uint8_t long_add(__idata uint8_t *v1, __idata uint8_t *v2,uint8_t len) __reentrant
{
(void)v1; (void)v2; (void)len;
__asm
mov a,_bp
add a,#0xfd
mov sp,a
pop ar1
pop ar7
mov ar0,dpl
clr c
001$:
mov a,@r0
addc a,@r1
mov @r0,a
inc r0
inc r1
djnz r7,001$
mov dpl,#0x00
jnc $002
inc dpl
$002:
mov sp,_bp
__endasm;
}