Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding a hex to a character help

Status
Not open for further replies.

hempster

Programmer
Sep 9, 2002
2
US
Hello,

I need to add a hex digit to a character, but am having trouble figuring it out.

For example, the user enters a character, say, "B"
Then I add 10h to it, which should be "R". I tried to do this, but it didnt turn out the way it was supposed to.

mov ah, 6
mov dl, char + 10h ;char is entered by the user
int 21h

I thought it was going to be that simple, but I was so wrong. By the way I'm new to this and have searched through the forums and in my book, but couldnt find anything. I'm sure it's simple, but I have no idea.

Thanks in advance
 
Ok nevermind I figured it out. In case anyone else cares to know, I was missing one line and the char + 10h was wrong. Here it is:

mov ah, 6
mov dl, char ;load char into dl
---> add dl, 12h ;add 12h to dl, output to screen
int 21h

I wish I figured it out earlier

-HEMPster
 
He he he... things are never simple in assembly, no?

Have fun learning!

"Information has a tendency to be free. Which means someone will always tell you something you don't want to know."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top