You need to put the string address into ECX. Here is an example:
PHP Code:
; nasm -f elf32 -o display.o display.asm
; ld -o display display.o
global _start
segment .data
announce db 'Your character: '
ann_len equ $ - announce
newline db 10
segment .bss
buff resb 1
segment .text
_start:
mov eax, 4 ; __NR_WRITE
mov ebx, 1 ; STDOUT
mov ecx, announce ; address of string
mov edx, ann_len ; length of string
int 80h
mov al, 30h
mov [buff], al ; store '30h' in buffer
mov eax, 4 ; __NR_WRITE
mov ebx, 1 ; STDOUT
mov ecx, buff ; address of string
mov edx, 1 ; length of string
int 80h
mov eax, 4 ; __NR_WRITE
mov ebx, 1 ; STDOUT
mov ecx, newline ; address of string
mov edx, 1 ; length of string
int 80h
mov eax, 1 ; __NR_EXIT
int 80h
Hope that helps!
Bookmarks