Re: newbie: I/O with nasm



how can I do simple I/O with nasm? For example: I want to read a string
from the commandline. Please keep it simple;-).

Okay, keeping it simple, the easiest way in my opinion is to get
something like the C library to do the work for you. How you do it
depends on your compiler, but with GCC, you can do something like this:

[section .data]

prompt: db 'Name: ',0
result: db 'Hello, %s!',0

[section .bss]

name: resb 1024

[section .text]

global _main
extern _printf, _gets
_main:
push prompt
call _printf
add esp,4

push name
call _gets
add esp,4

push name
push result
call _printf
add esp,8

mov eax,0
ret

Then you tell NASM to give you a suitable object file and have gcc link
with it:

C:\>nasmw -f win32 myprog.asm -o myprog.obj
C:\>gcc myprog.obj -o myprog.exe

.