On Mon, 21 Jun 1999, Luke (boo) Farrar wrote:

> Can some clever chap (or chapess) tell me what is wrong with this: It
> is supposed to print the letter A to the screen..... But it doesn't.

Run it through strace and you'll see that the write is returning -EFAULT.

> export        _main
> _main:
>       mov     eax,#4

__NR_write

>       mov     ebx,#1

STDOUT_FILENO (or whatever)

>       mov     ecx,#13

Where does this number come from?  The second argument of write(2) is
supposed to be a pointer.

>       mov     edx,#1

Write one byte.

>       int     $80
>
>       mov     eax,#1
>       int     $80
> .data
> .bss

I assume that you're trying to run this under i386/Linux, in which case
you mean "write the character A to standard output".

.data
ac:     db "A"

.text
export  _main
_main:
        mov     eax, #4
        mov     ebx, #1
        mov     ecx, ac
        mov     edx, #1
        int     $80

        mov     eax, #1
        int     $80
.bss


Which assembler as you using, BTW?

Matthew.

Reply via email to