NASM - The Netwide Assembler
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Search
Calendar
Login
Register
NASM - The Netwide Assembler
»
NASM Forum
»
Using NASM
»
Program Issue (loop)
« previous
next »
Print
Pages: [
1
]
Author
Topic: Program Issue (loop) (Read 16054 times)
Nathan Handler
Guest
Program Issue (loop)
«
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
Logged
nobody
Guest
Re: Program Issue (loop)
«
Reply #1 on:
February 16, 2008, 04:19:30 AM »
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
Logged
nobody
Guest
Re: Program Issue (loop)
«
Reply #2 on:
February 16, 2008, 04:21:06 AM »
__NR_write...
That is...
Best,
Frank
Logged
Nathan Handler
Guest
Re: Program Issue (loop)
«
Reply #3 on:
February 16, 2008, 01:21:21 PM »
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?
Logged
Print
Pages: [
1
]
« previous
next »
NASM - The Netwide Assembler
»
NASM Forum
»
Using NASM
»
Program Issue (loop)