|
-
Apr 30th, 2002, 10:09 AM
#1
Thread Starter
Lively Member
Hex to ASCII
Ok, I am having troubles working out an algorithm to do this in x86 assembly. So lets say I have the hex DC 0B FD F4 at memory offset :1027, it is little-endian stored of course(so the serial is really f4 fd 0b dc). It is the serial number of the disk. I need to convert the hex to ASCII vaules so that I can print them.
For the digits if I add 30H to them then the become there respective ASCII charachter. But I am kinda lost from there.
I am using this code to get the first sector of the floppy disk:
Code:
MOV AH,02
MOV AL,01
MOV CH,00
MOV CL,01
MOV DX,0000
LEA BX,[1000]
INT 13
INT 20
this is a dump of what is retrieved:
Code:
0B79:1000 EB 3C 90 4D 53 44 4F 53-35 2E 30 00 02 01 01 00 .<.MSDOS5.0.....
0B79:1010 02 E0 00 40 0B F0 09 00-12 00 02 00 00 00 00 00 ...@............
0B79:1020 00 00 00 00 00 00 29 DC-0B FD F4 4E 4F 20 4E 41 ......)....NO NA
0B79:1030 4D 45 20 20 20 20 46 41-54 31 32 20 20 20 33 C9 ME FAT12 3.
0B79:1040 8E D1 BC F0 7B 8E D9 B8-00 20 8E C0 FC BD 00 7C ....{.... .....|
0B79:1050 38 4E 24 7D 24 8B C1 99-E8 3C 01 72 1C 83 EB 3A 8N$}$....<.r...:
0B79:1060 66 A1 1C 7C 26 66 3B 07-26 8A 57 FC 75 06 80 CA f..|&f;.&.W.u...
0B79:1070 02 88 56 02 80 C3 10 73-EB 33 C9 8A 46 10 98 F7 ..V....s.3..F...
down at 0b79:1027 for a lenght of 4bytes is the serial number.
Would someone please help me with a code example or something..
Thanks
Josh -- Name
Zevlag13 -- AIM
www.WotsIt.org for all your file format spec questions!
-
May 3rd, 2002, 07:00 PM
#2
Junior Member
-
May 5th, 2002, 10:55 AM
#3
PowerPoster
just as you add 0x30 to digits to make them ASCII, for letters you add 'a' for lower case and 'A' for upper case, so algorithmically,
grab nibble
if nibble < 10 then add 0x30 else add 0x41
-
May 5th, 2002, 05:33 PM
#4
Frenzied Member
Originally not posted from Earl of Gonds
I am the -400th viewer of this cheesecake
How is this significant?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|