NASM - The Netwide Assembler
NASM Forum => Using NASM => Topic started by: Nathan Handler on February 16, 2008, 04:01:06 AM
-
I have a program that is meant to display the top 5 items in the stack. However, it only displays the top item. I'm new to nasm and running it on ubuntu. Any help would be appreciated.
http://pastebin.com/m1f2aa8a2 (http://pastebin.com/m1f2aa8a2)
-
Since the int 80h returns the number of bytes written in eax, you need to reload eax with 4 (__NT_write) *inside* your loop.
Best,
Frank
-
__NR_write...
That is...
Best,
Frank
-
Ok, moving the "mov eax,4" inside the loop made the code (http://pastebin.com/mf10e97c) work. I'm just wondering, why does it need to be inside the loop? Originally, I set eax to 4 right above the loop. Inside the loop, the value of eax was left untouched. Shouldn't it remain set to 4 throughout the entire loop?