Very insightful explaination.I noticed too the number is convert

來源: MGM 2006-08-02 17:56:57 [] [舊帖] [給我悄悄話] 本文已被閱讀: 次 (946 bytes)
But I don't know why until you explain it to me.
yesternday, i let i=90 (so 90 is stored in writebuffer), then I got its corresponding ascii char 'Z' printed on the console. But when i=5, the
output is not readable at all..

It now becomes clear that I should not never use a buffer declared in .bss section to hold the variable value I intend to output, because the standard output is a character device, and it will always convert the value store there into ascii. So, to use system call to output an integer is not trivial task; at least, most of the assembly programming book never touch it. Fortunately, there is a simple way to get around system call, write, that is what i putting in with my code generator: C function printf. I am putting in scanf for read() as well, so far they worked well.
Anyway, thanks for the insightful tips. Otherwise, it would perhaps take me several weeks to find out what went wrong.
請您先登陸,再發跟帖!

發現Adblock插件

如要繼續瀏覽
請支持本站 請務必在本站關閉/移除任何Adblock

關閉Adblock後 請點擊

請參考如何關閉Adblock/Adblock plus

安裝Adblock plus用戶請點擊瀏覽器圖標
選擇“Disable on www.wenxuecity.com”

安裝Adblock用戶請點擊圖標
選擇“don't run on pages on this domain”