radix dec
bin2bcd
clrf tens ; isochronous bin2bcd, 00..99 |B0
addlw -80 ; W = W - 80 |B0
rlf tens,F ; shift in 2^3*10 bit |B0
btfss tens,0 ; borrow? no, skip, else |B0
addlw 80 ; W = W + 80 |B0
addlw -40 ; W = W - 40 |B0
rlf tens,F ; shift in 2^2*10 bit |B0
btfss tens,0 ; borrow? no, skip, else |B0
addlw 40 ; W = W + 40 |B0
addlw -20 ; W = W - 20 |B0
rlf tens,F ; shift in 2^1*10 bit |B0
btfss tens,0 ; borrow? no, skip, else |B0
addlw 20 ; W = W + 20 |B0
addlw -10 ; W = W - 10, now W = "ones" |B0
rlf tens,F ; shift in 2^0*10 bit |B0
btfss tens,0 ; borrow? no, skip, else |B0
addlw 10 ; W = W + 10, now W = "ones" |B0
swapf tens,F ; |B0
iorwf tens,W ; W = packed bcd 00..99 |B0