mc8051fun/long_add.c
2024-07-03 07:37:44 +02:00

29 lines
423 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 r0,a
mov a,@r0 ; *v2
dec r0
mov r1,a
mov a,@r0 ; len
mov r7,a
mov r0,dpl
lcall long_invert
mov dpl,#0x00
jnc $002
inc dpl
$002:
__endasm;
}