[RESOLVED] Converting hex to string and vice versa

How do I convert a string to hex format? I'm thinking that I should use the ascii but I don't know how to read each character from a string entered. I'm so stuck.
[177 byte] By [taboonch] at [2007-11-20 10:58:51]
# 1 Re: [RESOLVED] Converting hex to string and vice versa
Hi Taboonch,

Read my reply at:
http://www.dev-archive.com/forum/showthread.php?t=410867

This is about hex-string conversion. Start from there and see if you have specific questions.

Good luck.

Iaki Viggers
iviggers at 2007-11-10 3:55:11 >
# 2 Re: [RESOLVED] Converting hex to string and vice versa
Thanks for the reply, iviggers. But, what if the user enters more than one character? Example:

Enter number: A19F

How do I convert this to hex so I can add it to another number?
taboonch at 2007-11-10 3:56:11 >
# 3 Re: [RESOLVED] Converting hex to string and vice versa
Hi Taboonch,

The code provided above was intended to give a starting point. I can help if you have specific questions (like why that opcode was used there). But
this looks more like a homework, so I'll keep it generic:
- Code loops (until input=0Dh) OR use service 3Fh of INT 21h to accept multi-byte input.
- For bytes other than the first one, make sure program doesn't override conversion of previous bytes; i.e. manage buffers properly.
- Reverse operations if the other conversion is needed.

Don't misunderstand my point; this is not the moral of "Learn by yourself". IF yours is a student context, then you (students) should question teachers about the worth of any class in particular. Otherwise they just make you hate assembly language.
iviggers at 2007-11-10 3:57:10 >
# 4 Re: [RESOLVED] Converting hex to string and vice versa
Hey. Thanks for the help! I solved my problem already.
taboonch at 2007-11-10 3:58:17 >