From: Tyler L. <ty...@ty...> - 2008-10-19 23:00:12
|
Hello, I've spent the last couple hours trying to debug this, and haven't found much. I"m writing a proc that would take what is in eax, and run through that and print byte-by-byte the message supplied in eax, here's the code--assistance would be awesome if possible. 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 Thanks, Tyler Littlefield email: ty...@ty... web: tysdomain-com Visit for quality software and web design. skype: st8amnd2005 |