0

I started learning assembly today and I copied and pasted a program that displays hello world. I tried to modify it to use C function system("PAUSE") and I made this:

[section .data]

hello: db 'Hello, world!',10,0
pause: db 'PAUSE',10,0

[section .text]

global _main
extern _printf
extern _system

_main:

push hello
call _printf
add esp,4

push pause
call _system
add esp,8

mov eax,0
ret

It does display "Press any key to continue" but when I press any key it freezes. What did I do wrong?

1
Contributor
1
Reply
2
Views
5 Years
Discussion Span
Last Post by sergent
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.