On Sat, 09 Feb 2008 09:44:21 -0000, Anant Narayanan <[EMAIL PROTECTED]> wrote:

Hi,

I'm trying to make a Hello World program in assembly without depending
on libc. Here's what I have so far:

DATA    string+0(SB)/7, $"Hello\n\z"
GLOBL   string+0(SB), $7

TEXT    _main+0(SB), 1, $0

// first arg; $1 = stdout
MOVL    $1, (SP)
// second arg, address of string
MOVL    $string+0(SB), 4(SP)
// third arg, $7 = length of string
MOVL    $7, 8(SP)
// fourth argument, -1LL (vlong offset)
MOVL    $-1, 12(SP)
MOVL    $-1, 16(SP)

// use pwrite syscall
MOVL    $51, AX
INT     $64
RET


No two cents from me. Just posted this to say that AT&T syntax is "sickly." I suppose Anant Narayanan is assembling these using 8a, and given the "symptoms" (the syntax, that is) 8a must be using AT&T syntax. I am wondering if there is an Intel syntax assembler for Plan 9 (something akin to Netwide Assembler or yet better Flat Assembler).

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Reply via email to