Posted June 1, 201015 yr Hi,I am new to assembly and want to know how to print integers in assembly on stdout. As printing string is straight forward. But i am not able to find how to put integers on stdout.I am using as and ld in linux to compile my program and run. I am not using HLA or MASM etc.Thanks.
June 1, 201015 yr He's not, stdout is the universal terminology for standard output.As for dreambig2212; you'll have to print each digit individually by converting them to a printable ascii character. For example, the hexadecimal value of the printable ascii character '1' is 31h. If your dl register contains a digit you'd like to print, adding 30h to it will make it a printable ascii character.add dl, 30hTo print larger numbers you'll have to write a routine to seperate the integer into printable digits.
June 2, 201015 yr Author He's not, stdout is the universal terminology for standard output.As for dreambig2212; you'll have to print each digit individually by converting them to a printable ascii character. For example, the hexadecimal value of the printable ascii character '1' is 31h. If your dl register contains a digit you'd like to print, adding 30h to it will make it a printable ascii character.add dl, 30hTo print larger numbers you'll have to write a routine to seperate the integer into printable digits.Thanks Gushe. You are correct I am asking for the same. I will do as you suggested.
Create an account or sign in to comment