## nitin1 15

i am using masm to write assebmly language codes. can you please tell that how can i change binary numbers to its ascii ? like 10 is given what will be its ascii value ? i know that 30h is ascii value of 0 ans so on. please help.

## deceptikon 1,790

10 in binary or 10 in decimal? In binary 10 is 2, which gives you the ASCII value for the control character STX. Really all you need to do is get the integer value and then treat it like a character. To be strictly correct with 7-bit ASCII, make sure that any significant bits beyond the 7th are cleared.

You can simply download an ASCII table - I got mine from lookuptables.com I believe. google it and you'll see a lot to choose from. Get one that includes their hex value.

I keep it as a gif on the desktop - very handy. 30h is not a binary value, of course.

## nitin1 15

but my question is that like i have i/p a binary number say, 1010 (10 in decimal), then what will be its ascii which ahould be in o/p ? i am using MASM , which have many registers and i have to output value in one of them. in registers , we need to o/p the value in hex. right ?

P.S i am telling something(resgiters) and asking(remaining) something also.

## deceptikon 1,790

but my question is that like i have i/p a binary number say, 1010 (10 in decimal), then what will be its ascii which ahould be in o/p ?

I'm assuming the input is four characters here, the string "1010", so you'd need to convert that to an actual decimal value. Then that value can be stored in a register and used to output the ASCII character corresponding to the decimal value 10 (a line feed).

I get the impression that you're confused about numeric representations. 1010b, 10, 12q, Ah, they're all the same thing. The only difference is how they're represented on output for a human reader. The computer only sees 1010.

## nitin1 15

sir, then what is will print as the ascii value of 1010 ? it is 10 decimal. so what should be the output ? in by book, it is given that ascii of 45 is 3435. as 0--> 30h and 4-->34 & 5--> 35 . i think.

## deceptikon 1,790

Look at the link I gave you in my first reply.

## nitin1 15

yes, i have read it. but how will i change it. i know the answer , i dont know how to change it. thanks