Hello,
I'm rather new to nasm, and wrote this program to print out a message byte-by-byte It's not printing, but it seems to run through the loop with gdb. Thoughts/comments would be great.
code:
section .data
buff db "Hello world!",0 ;the message we're going to print
section .text
global _start:
_start:
mov eax,buff ;moves the buffer address to eax for the call.
call write ;will write what ever is stored at eax byte by byet.
call exit ;exits
write:
mov esi,eax ;get what's stored in eax (hopefully an address) and store it in esi.
jmp .wloop
.wloop: ;the loop.
call pc
mov cl,[esi] ;moves the dereferenced esi to cl.
movzx ecx, byte [esi]
cmp cl,0 ;is the byte a null character?
je .wend
mov eax,4
mov ebx,1
mov edx,1
int 80h ;print the character.
inc esi ;move the pointer to the next char in the buffer.
jmp .wloop ;restart the loop
.wend:
ret
exit:
mov eax,1
mov ebx,1
int 80h
ret
pc:
mov eax,4
mov ebx,1
mov ecx,'d'
mov edx,1
int 80h
ret