Re: Hex to ascii
- From: "Rod Pemberton" <spamtrap@xxxxxxxxxx>
- Date: Thu, 14 Sep 2006 04:03:51 -0400
----- 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
.
- Follow-Ups:
- Re: Hex to ascii
- From: Terje Mathisen
- Re: Hex to ascii
- From: Robert Redelmeier
- Re: Hex to ascii
- References:
- Hex to ascii
- From: Displacer
- Re: Hex to ascii
- From: Robert Redelmeier
- Hex to ascii
- Prev by Date: Re: 8088 LZSS+RLE decompression: Can this be improved?
- Next by Date: Re: Hex to ascii
- Previous by thread: Re: Hex to ascii
- Next by thread: Re: Hex to ascii
- Index(es):
Relevant Pages
|
|