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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CONVERSION FROM BINARY TO HEXADECIMAL

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
I'm writing an assembly code and try to work it in sim68k. I couldn't figure out how to convert from binary numbers to hexadecimal. anyone could help me?
 
each 4 bits (a nyble) makes up a digit of hexadecimal.
each byte (2 nybles) has 2 digits.

How I did it for speed was to have a string with value of '0123456789ABCDEF'

say al holds value I want to convert:

mov ebx,OFFSET HEXstring
or eax,0Fh
add ebx,eax
mov al,[ebx]

al will hold ascii charactor!

to do high digit aswel:

push ax
{do low charactor}
pop ax
shr al,4
{do low charactor but returns high char}

this should help you but i didnt have the time to go deep on this right now, if it doesnt help reply to this.

"People who have nothing to say, say it too loud and have little knowledge. It's the quiet ones you need to worry about!"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top