4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by gacha23
0

What kind of numbers?
The easiest thing might be to convert the number to a string, then use interrupt 21H/9H to show it.

0

You should convert it to its ascii representation first... But how do you do it? I'll show you how to convert one digit to ascii, then YOU must "find out" how to convert more than a single digit by yourself, ok? Otherwise you wouldnt really learn anything...

one(1) in binary is 0001, 2 is 0010, three is 0011, and so on... Ones ascii representation is 0011 0001, 2 is 0011 0010, three is 0011 0011, and so on... Can you get it already? All you gotta do is to turn on the two bits in the H.O nibble... Now an example in assembly language:

mov ah, 0EH;
	mov al, 5h;
	or al, 30h;
	int 10h;

I havent tried this one, but I believe it should work. We use int 10h to print the ascii character in al to the screen.. That ascii character is 35h(0011 0101), or "5".

I have not tested it. With two or more digits is a bit more complicated, but lets consider that 12 / 10 = 1,2... And now you have all you need to convert up to 99.. Now think by yourself

Edited by Dante Wingates: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.