35 lines
453 B
C
35 lines
453 B
C
#include "mc8051fun.h"
|
|
#include "bcd.h"
|
|
|
|
#pragma disable_warning 59 // Disable "must return a value" warning
|
|
|
|
uint8_t bcd_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
|
|
da a
|
|
mov @r0,a
|
|
inc r0
|
|
inc r1
|
|
djnz r7,001$
|
|
mov dpl,#0x00
|
|
jnc $002
|
|
inc dpl
|
|
$002:
|
|
mov sp,_bp
|
|
__endasm;
|
|
}
|
|
|
|
|
|
|