This small, and common, gem converts a hexadecimal number into a ASCII value that is possible to put in a string.
Since Norbert Juffa brougt the gem to my attention, therefor he will be credited here. He also provided the nice comments.;
; input:
; al = single hex digit
;
; output:
; al = single ASCII digit
;
; destroys:
; flags
;
cmp al,10 ; if x < 10, set CF = 1
sbb al,69h ; 0-9: 96h .. 9Fh, A-F: A1h..A6h
das ; 0-9: subtr. 66h -> 30h-39h,
; A-F: subtr. 60h -> 41h..46h