Re: Hex to ascii




----- Original Message -----
From: "Robert Redelmeier" <redelm@xxxxxxxxxxxxxxx>
Newsgroups: comp.lang.asm.x86
Sent: Wednesday, September 13, 2006 1:46 PM
Subject: Re: Hex to ascii



"Robert Redelmeier" <redelm@xxxxxxxxxxxxxxx> wrote in message
news:KtXNg.715$vJ2.191@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Displacer <spamtrap@xxxxxxxxxx> wrote in part:
Hi, I need to convert a hex byte into its 2 byte ascii
number. What I'm doing is building a file name based on a
single byte. The file name is mapxx where xx is a 2 digit
ascii number, such as map12. Anyway my question is if my
routine is called with a value of 0Ch, how do I convert
that into the needed 31h 32h, which is plugged into the
file name to make map12?

Very common question. Assuming hex < 99 in AL:

AAM
AAM ax, 3030h

two ASCII digits are in AX. The AAM instruction
(ASCII Adjust after Multiply) does the work for you.


Nice! I'm thinking that would produce a nice nybble split for byte hex
routines if you use 'AAM imm8' with 10H for imm8... correct?
http://www.x86.org/secrets/opcodes/aam.htm

You must've missed Randall Hyde's 8/31 post "Faster HexToBuffer Routines"
since you didn't suggest using 'AAM imm8' in my or Chuck's brute force hex
routines.


Rod Pemberton

.



Relevant Pages

  • Re: connected to access point but no internet found
    ... WEP has a problem converting from ASCII to Hexadecimal. ... algorithms for converting from ASCII to Hex. ... If you use the Hex key, ...
    (alt.internet.wireless)
  • RE: Character set conversoin headaches
    ... I made a mistake in my initial analysis in that an ascii file ... ASCII mode converted the two character sequence to a one character ... Text files in Unix System Services are supposed to have hex '15' as ... You talk about converting to ASCII, ...
    (bit.listserv.ibm-main)
  • Re: Sandisk WiFi+256 card using WPA-PSK
    ... > need to use a profile to connect using the Sandisk utility. ... > network key (in ascii) it complains that it's not a valid hex key. ...
    (microsoft.public.pocketpc)
  • =?iso-8859-1?Q?Re:_Character_set_conversoin_headaches?=
    ... Text files in Unix System Services are supposed to have hex '15' as ... If you want to translate an ASCII file with CRLF ...
    (bit.listserv.ibm-main)
  • Re: change from unicode to ASCII
    ... corner from which you can choose Unicode (hex), ASCII, or ASCII ... >> Microsoft MVP ...
    (microsoft.public.word.docmanagement)