how can i print numbers on the screen by using tasm

Recommended Answers

All 3 Replies

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

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.