Chuck Guzis wrote:
  Okay, folks--anyone got a shorter sans-jump one?  One
that perhaps
 doesn't require an extra register?  How about one that uses a DAA to
 do something sneaky? 
Although it's the other way round, this is one of my top five favorite
gems of all time:
; 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
Using the above as a basis for ascii-to-hex is left as an exercise for
Chuc^H^H^H^Hthe reader.
--
Jim Leonard (trixter at 
oldskool.org)            
http://www.oldskool.org/
Help our electronic games project:           
http://www.mobygames.com/
Or check out some trippy MindCandy at     
http://www.mindcandydvd.com/
A child borne of the home computer wars: 
http://trixter.wordpress.com/