This is slightly OT (and sorry for the crosspost) but...

I'm trying to learn/write assembly on my Mac. I've written assembly for i386 machines (and other embedded type procs) but I'm having an odd problem. Seems that no matter what I do, the a.out that results from my assemble "as hello.asm" is not executable. I take this a a bad sign, but for completeness I chmod +x it and try to execute it, only to have my shell lock me out (can't kill the 'job' but I can background it). A process list shows no a.out running but rather a line like this:

root 11280 0.0 0.0 0 0 ?? Z 31Dec69 0:00.00 (crashdump)

Not sure what this means, but my assumption is that the assembly is not making a proper executable binary (perhaps just building an object file?). The code I'm assembling is actually an example I found on the net, but I've not been able to find much other information. Here's the short snippet:

------------------------------------------------------
.data
.cstring
.align 2
LC0:
.ascii "hello world\012\000"
.text
.align 2
.globl _start
_start:
li r3,1 ; arg1 = stdout = 1
lis r4,hi16(LC0) ; arg2 = address of string. loaded in two steps
ori r4,r4,lo16(LC0) ; high halfword and then low
li r5,12 ; arg3 = numBytes = 12
li r0,4 ; 4 is write syscall
sc ; call write
nop ; need the no-op because sc skips one instr.
li r0,1 ; 1 is exit syscall
li r3,0 ; exit status 0
sc ; call exit
------------------------------------------------------



Anyone have any ideas? TIA.


weston

_______________________________________________
Siglinux mailing list
[EMAIL PROTECTED]
http://machito.utacm.org/mailman/listinfo/siglinux

Reply via email to