[an error occurred while processing this directive]
|
char2bcd: ;число в А
mov b,#100
div ab
orl a,#'0'
mov r2,a ;r2=ASCII сотни
mov a,b
mov b,#10
div ab
orl a,#'0' ;a=ASCII десятки
orl b,#'0' ;b=ASCII единицы
ret
char2hex: ;число в А
mov r2,a
swap a
anl a,#0fh
add a,#hextab-$+2
movc a,@a+pc
xch a,r2 ;r2=hex MSB
anl a,#0fh
add a,#hextab-$+2 a=hex LSB
ret
hextab db '0123456789ABCDEF'
E-mail: info@telesys.ru