dreambig2212 Posted June 1, 2010 Posted June 1, 2010 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.
cyb3rl0rd1867 Posted June 1, 2010 Posted June 1, 2010 I don't program on Linux but I think you're confusing C and assembly.
Gushe Posted June 1, 2010 Posted June 1, 2010 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.
dreambig2212 Posted June 2, 2010 Author Posted June 2, 2010 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now