Re: [9fans] Hello Assembly
It's also that x86 segments memory into code, data, and stack, so you can have .code OR EAX, EAX // produces less binary than CMP EAX, 0; JE X JZ X JMP Y Y: .data str DB 'less\z' .code // ... .data .code .stack .code .data On Feb 11, 2008, at 2:41 PM, Jon Snader wrote: On Mon, Feb 11, 2008 at 11:43:08AM -0500, erik quanstrom wrote: I've always thought variables and such went at the bottom... or is that just m68k asm? you can put them anywhere. there's no typechecking in assembly and the linker doesn't care. When I started programming (so long ago that assembly and Fortran were basically the only games in town) we always put the data at the end--it just seemed fitting somehow. Later, the best practice became to put them at the beginning on the grounds that the data wouldn't move as changes where made to the program; in those days, all manner of strange things happened like programs that knew where the data portion of other programs lived. If nothing else, it made the (very crude) dumps easier to work with. jcs
Re: [9fans] Hello Assembly
On Mon, Feb 11, 2008 at 11:43:08AM -0500, erik quanstrom wrote: > > I've always thought variables and such went at the bottom... or > > is that just m68k asm? > > you can put them anywhere. there's no typechecking in assembly > and the linker doesn't care. > When I started programming (so long ago that assembly and Fortran were basically the only games in town) we always put the data at the end--it just seemed fitting somehow. Later, the best practice became to put them at the beginning on the grounds that the data wouldn't move as changes where made to the program; in those days, all manner of strange things happened like programs that knew where the data portion of other programs lived. If nothing else, it made the (very crude) dumps easier to work with. jcs
Re: [9fans] Hello Assembly
>>> I've always thought variables and such went at the bottom... or >>> is that just m68k asm? >>> >>> John >> >> you can put them anywhere. there's no typechecking in assembly >> and the linker doesn't care. >> >> - erik > > Ok, maybe that was just a style thing they taught us. > > John Most old school programmers put the variables at the bottom so the assembled binary could start executing from the top avoiding the need to jmp around the data. Even early C programs did this. Check out dmr's old C compilers. The globals were at the end of the file. Early PDP-11 binaries could be loaded with the a.out headers intact and run. The magic number was a branch relative eight words instruction and would jump the header.
Re: [9fans] Hello Assembly
>> I've always thought variables and such went at the bottom... or >> is that just m68k asm? >> >> John > > you can put them anywhere. there's no typechecking in assembly > and the linker doesn't care. > > - erik Ok, maybe that was just a style thing they taught us. John
Re: [9fans] Hello Assembly
> I've always thought variables and such went at the bottom... or > is that just m68k asm? > > John you can put them anywhere. there's no typechecking in assembly and the linker doesn't care. - erik
Re: [9fans] Hello Assembly
> On Feb 9, 2008 8:17 AM, Brantley Coile <[EMAIL PROTECTED]> wrote: >> I would like to hear what Rob or others have to say about the >> assembler syntax, but I actually like the syntax for the following >> reason. > > if you love assembly code, the assembler on Plan 9 is not great. > > If you love assembly code, you are in need of a CAT scan in my view. > > The v6 manual entry for as called assembly code "the ultimate dead > language". If only that had been true. > > gcc and friends have made the world safe for assembly, and there is more > assembly in use than ever. > > Writing assembly code should be as painful as possible. Plan 9 > succeeds in that regard. It's a good thing in my view. > > ron And if you can pass off the assembly writing task to an intern, all the better, right? :) I don't know... barring certain architecture gotchas, I enjoyed the assembly I did; it's sort of a relaxing break from C. John "Real Programmers Use FORTRAN" Floren
Re: [9fans] Hello Assembly
> 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 I've always thought variables and such went at the bottom... or is that just m68k asm? John
Re: [9fans] Hello Assembly
Windows 1, 2 &3 was done in assembler
Re: [9fans] Hello Assembly
> One more thing. Does anyone know if, in raw x86 assembly, RET implies > STI? Thanks. if it did, it would be impossible to call a function with interrupts off. - erik
Re: [9fans] Hello Assembly
One more thing. Does anyone know if, in raw x86 assembly, RET implies STI? Thanks.
Re: [9fans] Hello Assembly
Oh, and I can't wait to see those two have GUI support. When I finish making my OS C- and portability-friendly, I'm going to start with graphics. On Feb 10, 2008, at 9:36 PM, Adrian Tritschler wrote: Anant Narayanan <[EMAIL PROTECTED]> writes: I am working on rewriting an operating system that avoids this philosophy for the purpose of teaching assembly language. So far, I have 2% of the code (I started a rewrite), and I don't know if my code is 100% right. There's an OS (complete with a Window Manager, IDE, Web Browser, and even some games) written entirely in assembly: http:// www.menuetos.net/ Or, if you want something at the other end of the spectrum, there's an OS "with modular microkernels using the C# programming language." http://arstechnica.com/news.ars/post/20080208-developers-create- open-source-os-kernels-using-net-tools.html Everyone has 24 hours in a day, but some use it more than others ;) Indeed Anant Adrian
Re: [9fans] Hello Assembly
On Feb 10, 2008, at 9:36 PM, Adrian Tritschler wrote: OS "with modular microkernels using the C# programming language." Microsoft has too, and it outdates the other two. Unfortunately, it's only available in Microsoft and a select few universities. http://research.microsoft.com/os/singularity/
Re: [9fans] Hello Assembly
Anant Narayanan <[EMAIL PROTECTED]> writes: >> I am working on rewriting an operating system that avoids this >> philosophy for the purpose of teaching assembly language. So far, I >> have 2% of the code (I started a rewrite), and I don't know if my >> code is 100% right. > > There's an OS (complete with a Window Manager, IDE, Web Browser, and >even some games) written entirely in assembly: http://www.menuetos.net/ Or, if you want something at the other end of the spectrum, there's an OS "with modular microkernels using the C# programming language." http://arstechnica.com/news.ars/post/20080208-developers-create-open-source-os-kernels-using-net-tools.html > Everyone has 24 hours in a day, but some use it more than others ;) Indeed > Anant Adrian
Re: [9fans] Hello Assembly
In C, it could look like Write(char *filename, void *data, uvlong number_of_bytes); so I don't think it has an Open syscall, or probably you read everything into memory, modify the memory, then write it back. 64-bit systems can store quite a bit, but this philosophy will get old almost immediately: $ sed2c '1s/^/@/' # given sed2c is a program that converts sed commands to C char *buffer; buffer = malloc(FileLen("f")); Read("f", buffer, FileLen("f")); b[0] = '@'; Write("f", buffer, strlen(buffer)); Does that seem like a bit much? On Feb 10, 2008, at 1:01 PM, erik quanstrom wrote: There's an OS (complete with a Window Manager, IDE, Web Browser, and even some games) written entirely in assembly: http:// www.menuetos.net/ Everyone has 24 hours in a day, but some use it more than others ;) i can see from their documentation, that i have been using my time quite a bit more effectively: "Menuet has no roots within UNIX or the POSIX standards, nor is it based on any particular operating system. The design goal has been to remove the extra layers between different parts of an OS, which normally complicate programming and create bugs. here's their write system call: rbx - 1 Write rcx - Ignored rdx - Bytes to save rex - Pointer to data rfx - Filename pointer !? - erik
Re: [9fans] Hello Assembly
> There's an OS (complete with a Window Manager, IDE, Web Browser, and > even some games) written entirely in assembly: http://www.menuetos.net/ > > Everyone has 24 hours in a day, but some use it more than others ;) > i can see from their documentation, that i have been using my time quite a bit more effectively: "Menuet has no roots within UNIX or the POSIX standards, nor is it based on any particular operating system. The design goal has been to remove the extra layers between different parts of an OS, which normally complicate programming and create bugs. here's their write system call: rbx - 1 Write rcx - Ignored rdx - Bytes to save rex - Pointer to data rfx - Filename pointer !? - erik
Re: [9fans] Hello Assembly
I am working on rewriting an operating system that avoids this philosophy for the purpose of teaching assembly language. So far, I have 2% of the code (I started a rewrite), and I don't know if my code is 100% right. There's an OS (complete with a Window Manager, IDE, Web Browser, and even some games) written entirely in assembly: http://www.menuetos.net/ Everyone has 24 hours in a day, but some use it more than others ;) -- Anant
Re: [9fans] Hello Assembly
On Feb 10, 2008, at 3:56 AM, Martin Neubauer wrote: (Research) Unix was influential in that regard and showed that those parts are really small (and should be). Martin I am working on rewriting an operating system that avoids this philosophy for the purpose of teaching assembly language. So far, I have 2% of the code (I started a rewrite), and I don't know if my code is 100% right.
Re: [9fans] Hello Assembly
* Eris Discordia ([EMAIL PROTECTED]) wrote: > That is probably because assembly was never intended for moving from one > platform to another all the time, but for squeezing the most out of a > given platform whose nooks and crannies you ken well. Nah, that's only what the intel assembler is for. Originally, assembly language was devised for not having to type in machine opcodes directly. With the advent of high level programming laguages its main merit became the ability to write those bits of operating system code that just cannot be written in a high level language. (Research) Unix was influential in that regard and showed that those parts are really small (and should be). Martin
Re: [9fans] Hello Assembly
DATAstring<>+0(SB)/8, $"Hello\n\z\z" Why are there two \zs? Shouldn't one be enough? One should be enough, but 8c -S does two \z's (probably to pad it out to exactly 8 bytes). It works either way, since the length we pass as an argument to pwrite is still $7. Regards, Anant
Re: [9fans] Hello Assembly
On Sat, 09 Feb 2008 17:32:26 -, Charles Forsyth <[EMAIL PROTECTED]> wrote: the assembler is really just a front-end to the loader, and nothing to do with `at&t syntax'. For the first ten minutes after reading that, I was wondering what the comment meant. Then I remembered in Plan 9 speak the loader means the linker. So, I gather from what you have pointed out that 8a assembly is actually some sort of intermediate language like MSIL (or GNU's version of AT&T assembly for the GCC backend). and the <>) but generally i agree with brantley. some weeks i'm working with several processors, even several a day, and the `native' (in what sense? does the processor implement them?) assemblers typically differ in operand order, basic mnemonics (l/st vs mov), and other conventions, whereas the ?a family is uniformly data flow, and tends to use similar instructions for similar things. i find it much easier moving from platform to platform with it. That is probably because assembly was never intended for moving from one platform to another all the time, but for squeezing the most out of a given platform whose nooks and crannies you ken well. The notion of a "native" assembler sounds strange to me. Netwide (nasm) is known for being available on many software/hardware platforms with similar syntax (the Intel syntax) all over. Of course, the instruction sets are far from identical but the syntax is still (almost) the same. Register access, for instance, is done by simply naming the register in an instruction: mov eax, 00h Compared to the AT&T syntax (for GNU assembler): movl$0x0, %eax (three extra keystrokes to get the same op-code) -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Re: [9fans] Hello Assembly
If you love assembly code, you are in need of a CAT scan in my view. chances are the CAT scanner was programmed in assembler !
Re: [9fans] Hello Assembly
On Feb 9, 2008, at 4:15 PM, Anant Narayanan wrote: DATAstring<>+0(SB)/8, $"Hello\n\z\z" Why are there two \zs? Shouldn't one be enough?
Re: [9fans] Hello Assembly
Thanks everybody (especially Jim and Charles), I got this to work. Here's the final program: DATAstring<>+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
Re: [9fans] Hello Assembly
actually, there's probably enough space above your current location to (appear to) work, but a further error is hinted in the address given by the trap: 8.out 1183: suicide: invalid address 0x7 in sys call pc=0x104e since 7 is your length value, you've also got an off-by-4 error in your stack offsets. In which direction, 4(SP) or -4(SP)? Both don't work, it still suicides but at different 'invalid addresses' and pc values :( -- Anant
Re: [9fans] Hello Assembly
On 09-Feb-08, at 4:04 PM, erik quanstrom wrote: actually, i think there's something else wrong: for the equivalent c "pwrite(1, string, 7, 0)" i get this I don't get FP for `8c -S hello.c' (which just calls pwrite as you describe). This is what I get: TEXTmain+0(SB), 0, $32 MOVL$.string<>+0(SB), CX MOVL$1, AX MOVLAX, (SP) MOVLCX, 4(SP) MOVL$7, AX MOVLAX, 8(SP) MOVL$-1, 12(SP) MOVL$-1, 16(SP) CALL,pwrite+0(SB) RET , DATA.string<>+0(SB)/8, $"Hello\n\z\z" GLOBL .string<>+0(SB), $8 END , Replicating the exact program - with just three changes: moving the DATA/GLOBL statement to the top, changing main to _main and replacing CALL with MOVL $64, AX and INT $64 - still results in the suicide. Puzzling. -- Anant
Re: [9fans] Hello Assembly
>> 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 the assembler is really just a front-end to the loader, and nothing to do with `at&t syntax'. there are some odd aspects to thompson syntax as it is (data loading for instance, and the <>) but generally i agree with brantley. some weeks i'm working with several processors, even several a day, and the `native' (in what sense? does the processor implement them?) assemblers typically differ in operand order, basic mnemonics (l/st vs mov), and other conventions, whereas the ?a family is uniformly data flow, and tends to use similar instructions for similar things. i find it much easier moving from platform to platform with it.
Re: [9fans] Hello Assembly
> On Feb 9, 2008 8:17 AM, Brantley Coile <[EMAIL PROTECTED]> wrote: >> I would like to hear what Rob or others have to say about the >> assembler syntax, but I actually like the syntax for the following >> reason. > > if you love assembly code, the assembler on Plan 9 is not great. > > If you love assembly code, you are in need of a CAT scan in my view. > > The v6 manual entry for as called assembly code "the ultimate dead > language". If only that had been true. > > gcc and friends have made the world safe for assembly, and there is more > assembly in use than ever. > > Writing assembly code should be as painful as possible. Plan 9 > succeeds in that regard. It's a good thing in my view. > > ron I'm afraid Plan 9 fails in this reguard. Here's some Oberon code to make the pread call. (This is NOT Wirth's compiler, but Paul Reed's. He agrees with you about make assembly programming as hard as possible.) PROCEDURE syspread(poshi, poslo: LONGINT; VAR buf: ARRAY OF CHAR; fd: LONGINT): LONGINT; BEGIN (* 18: return value 14: poshi 10: poslo 0c: buflen 08; buf ptr 04: fd 00: RA *) SYSTEM.CODE( 0C9H, (* leave *) 06AH, 50, (* pushb $close *) 058H, (* pop eax *) 0CDH, 040H, (* int $40h *) 089H,084H,024H,018H,000H,000H,000H, (* movl eax, 18h(esp) *) 0C2H, 14H, 0(* ret $14h *) ) END syspread;
Re: [9fans] Hello Assembly
> if you love assembly code, the assembler on Plan 9 is not great. > > If you love assembly code, you are in need of a CAT scan in my view. > > The v6 manual entry for as called assembly code "the ultimate dead > language". If only that had been true. > > gcc and friends have made the world safe for assembly, and there is more > assembly in use than ever. > > Writing assembly code should be as painful as possible. Plan 9 > succeeds in that regard. It's a good thing in my view. > > ron i don't think that it follows from the fact that assembly language is inappropriately used in a lot of linux software that it should be as hard to use as possible on plan 9. there are some tasks that must be in assembly language. and it's a good tool for learning how the machine works. sometimes, like on really small controllers, it's the best tool for the job. just my 2ยข. - erik p.s. relax ron. i promise not to rewrite plan 9 in assembly language.
Re: [9fans] Hello Assembly
On Feb 9, 2008 8:17 AM, Brantley Coile <[EMAIL PROTECTED]> wrote: > I would like to hear what Rob or others have to say about the > assembler syntax, but I actually like the syntax for the following > reason. if you love assembly code, the assembler on Plan 9 is not great. If you love assembly code, you are in need of a CAT scan in my view. The v6 manual entry for as called assembly code "the ultimate dead language". If only that had been true. gcc and friends have made the world safe for assembly, and there is more assembly in use than ever. Writing assembly code should be as painful as possible. Plan 9 succeeds in that regard. It's a good thing in my view. ron
Re: [9fans] Hello Assembly
I would like to hear what Rob or others have to say about the assembler syntax, but I actually like the syntax for the following reason. You only have to remember one syntax and not ten different ones. I would think, given that the structure of the compiler/loader is very non-traditional, it would be difficult to provide all the pseudo operations that the various native assemblers would require. Best thing is not to write a lot of assembler code. :) > On Sat, 09 Feb 2008 09:44:21 -, 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" >> GLOBLstring+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/
Re: [9fans] Hello Assembly
On Sat, 09 Feb 2008 09:44:21 -, 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: DATAstring+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/
Re: [9fans] Hello Assembly
> acid: asm(_main) > _main 0x1020 SUBL$0x18,SP > _main+0x3 0x1023 MOVL$0x1,0x0(SP) > _main+0xa 0x102a MOVL$string(SB),0x4(FP) > _main+0x12 0x1032 MOVL$0x7,0x8(FP) > _main+0x1a 0x103a MOVL$0x0,0xc(FP) > _main+0x22 0x1042 MOVL$0x0,0x10(FP) > _main+0x2a 0x104a MOVL$0x33,AX > _main+0x2f 0x104f INTB$0x40 > _main+0x31 0x1051 ADDL$0x18,SP > _main+0x34 0x1054 RET > > why does the ... SP in the .s get changed to FP unless the offset is 0? - erik
Re: [9fans] Hello Assembly
> actually, there's probably enough space above your current location to > (appear to) work, but a further error > is hinted in the address given by the trap: > > 8.out 1183: suicide: invalid address 0x7 in sys call pc=0x104e > > since 7 is your length value, you've also got an off-by-4 error in your stack > offsets. actually, i think there's something else wrong: acid: asm(_main) _main 0x1020SUBL$0x18,SP _main+0x3 0x1023MOVL$0x1,0x0(SP) _main+0xa 0x102aMOVL$string(SB),0x4(FP) _main+0x12 0x1032 MOVL$0x7,0x8(FP) _main+0x1a 0x103a MOVL$0x0,0xc(FP) _main+0x22 0x1042 MOVL$0x0,0x10(FP) _main+0x2a 0x104a MOVL$0x33,AX _main+0x2f 0x104f INTB$0x40 _main+0x31 0x1051 ADDL$0x18,SP _main+0x34 0x1054 RET why does the for the equivalent c "pwrite(1, string, 7, 0)" i get this acid: asm(main) main 0x1020 SUBL$0x18,SP main+0x3 0x1023 MOVL$0x1,AX main+0x8 0x1028 MOVLAX,0x0(SP) main+0xb 0x102b MOVLstring(SB),AX main+0x11 0x1031MOVLAX,0x4(SP) main+0x15 0x1035MOVL$0x7,AX main+0x1a 0x103aMOVLAX,0x8(SP) main+0x1e 0x103eMOVL$0x0,0xc(SP) main+0x26 0x1046MOVL$0x0,0x10(SP) main+0x2e 0x104eCALLpwrite(SB) main+0x33 0x1053ADDL$0x18,SP main+0x36 0x1056RET - erik
Re: [9fans] Hello Assembly
> there might be more, but you haven't allocated a stack frame for the (system) > call actually, there's probably enough space above your current location to (appear to) work, but a further error is hinted in the address given by the trap: 8.out 1183: suicide: invalid address 0x7 in sys call pc=0x104e since 7 is your length value, you've also got an off-by-4 error in your stack offsets.
Re: [9fans] Hello Assembly
> I did think that was the case earlier, so I tried: > > TEXT _main+0(SB), 1, $32 > > (And also with values ranging from $4 to $32 in increments of $4 just > for the heck of it). But it doesn't seem to make any difference in the > suicide, apart from the changed value of pc. > > The error is most likely because of the line (that's the only 7 around > there): > MOVL $7, 8(SP) > > But it doesn't complain about: > MOVL $1, (SP) > > so I wonder... you seek: SUBL$value, SP - erik
Re: [9fans] Hello Assembly
Hi Charles, there might be more, but you haven't allocated a stack frame for the (system) call I did think that was the case earlier, so I tried: TEXT_main+0(SB), 1, $32 (And also with values ranging from $4 to $32 in increments of $4 just for the heck of it). But it doesn't seem to make any difference in the suicide, apart from the changed value of pc. The error is most likely because of the line (that's the only 7 around there): MOVL$7, 8(SP) But it doesn't complain about: MOVL$1, (SP) so I wonder... -- Anant
Re: [9fans] Hello Assembly
> It's probably something silly - I'll be extremely grateful if someone there might be more, but you haven't allocated a stack frame for the (system) call
[9fans] Hello Assembly
Hi, I'm trying to make a Hello World program in assembly without depending on libc. Here's what I have so far: DATAstring+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 The program assembles and links fine - but executing it gives me: 8.out 1183: suicide: invalid address 0x7 in sys call pc=0x104e It's probably something silly - I'll be extremely grateful if someone could point out what I'm doing wrong. Thanks! -- Anant