39 lines
446 B
C
39 lines
446 B
C
|
#include "bcd.h"
|
||
|
|
||
|
|
||
|
#pragma disable_warning 59 // Disable "must return a value" warning
|
||
|
|
||
|
void bcd_shr(__idata uint8_t *v, uint8_t len, uint8_t d) __reentrant
|
||
|
{
|
||
|
(void)v; (void)len, (void)d;
|
||
|
|
||
|
__asm
|
||
|
mov a,_bp
|
||
|
add a,#0xfd
|
||
|
mov sp,a
|
||
|
|
||
|
pop ar7 ; r7 = len
|
||
|
pop B ;
|
||
|
mov a,dpl
|
||
|
add a,r7
|
||
|
mov r0,a
|
||
|
001$:
|
||
|
dec r0
|
||
|
mov a,@r0
|
||
|
swap a
|
||
|
mov r6,a
|
||
|
anl a,#0x0f
|
||
|
orl a,b
|
||
|
mov @r0,a
|
||
|
mov a,r6
|
||
|
anl a,#0xf0
|
||
|
mov b,a
|
||
|
djnz r7,001$
|
||
|
|
||
|
mov sp,_bp
|
||
|
|
||
|
__endasm;
|
||
|
}
|
||
|
|
||
|
|