; From Regulus Berdin; untested
; Input - ASCII number in W
; Output - binary in W
sublw '9'
movlw 'A' - .10
skpnc
movlw '0'
subwf ASCII,w
Tracy Smith says:
If you KNOW that the ASCII is '0'-'9','A'-'F' then a simpler solution for the midrange pics is:addlw -'A' skpc addlw 'A' - 10 + '0' addlw 10If the ASCII value is in ram, then this solution will work for the 12 bit core too:
movlw -'A' btfsc ASCII,6 movlw -'0' addwf ASCII,f ;(or w)