Thanks everybody (especially Jim and Charles), I got this to work. Here's the final program:

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

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

MOVL    $1, 4(SP)
MOVL    $string<>+0(SB), 8(SP)
MOVL    $7, 12(SP)
MOVL    $-1, 16(SP)
MOVL    $-1, 20(SP)

MOVL    $51, AX
INT     $64

MOVL    $string<>+0(SB), 4(SP)
MOVL    $8, AX
INT     $64

Jim pointed out that using RET was incorrect as the instruction wouldn't know where to get back to. Calling exits() instead, works.

Plan 9 gets more and more exciting for me, everyday :)
Thanks again!

Cheers,
Anant

Reply via email to