Hello Pablo,
Assuming "packed BCD" format, with both decimal digits contained within the same byte, here is a possible C function -
byte BCDconvert (byte BCDval)
{
return (((BCDval & 0x30) >> 4) * 10 + (BCDval & 0x0F));
}
Here is the same process written in assembler -
BCDconvert:
lda BCDval
and #$30
nsa
ldx #10
mul
psha
lda BCDval
and #$0F
add 1,sp
ais #1 ; Adjust stack pointer
rts
; On exit, ACC contains the binary value
Regards,
Mac