35 lines
544 B
C
35 lines
544 B
C
#include "mc8051fun.h"
|
|
#include "bcd.h"
|
|
|
|
#pragma disable_warning 59 // Disable "must return a value" warning
|
|
|
|
|
|
void long_div(__idata uint8_t *v1, __idata uint8_t *v2,
|
|
__idata uint8_t *result, __idata uint8_t *rest, uint8_t len) __reentrant
|
|
{
|
|
|
|
(void)v1; (void)v2; (void)len;
|
|
(void)result; (void)rest;
|
|
|
|
__asm
|
|
mov a,_bp
|
|
add a,#0xfd
|
|
mov r0,a
|
|
mov a,@r0 ; *v2
|
|
dec r0
|
|
mov r1,a
|
|
mov a,@r0 ; *result
|
|
dec r0
|
|
mov r2,a
|
|
mov a,@r0 ; *rest
|
|
dec r0
|
|
mov r3,a
|
|
mov a,@r0 ; len
|
|
mov r7,a
|
|
mov r0,dpl ; *v1
|
|
lcall long_div
|
|
__endasm;
|
|
|
|
}
|
|
|