hello~ I'm about to learn x86 assembly language on mac os x... I'm using as instruction to compile assembly file in commend window. but I have several errors.. and I don't know how I can get through..
here is the errors and my assembly code.. which is quite simple.
**ung-mi-lims-macbook-pro:pa2 ungmi$ as swap.s
swap.s:16:Unknown pseudo-op: .type
swap.s:16:Rest of line ignored. 1st junk character valued 115 (s).
swap.s:19:suffix or operands invalid for `push'
swap.s:46:suffix or operands invalid for `pop'
ung-mi-lims-macbook-pro:pa2 ungmi$**
and the source is
.text
.align 4
.globl swap
.type swap,@function
swap:
pushl %ebp
movl %esp, %ebp
movl %ebp, %esp
popl %ebp
ret
and I searched some solution which is I have to put -arch i386 than
**ung-mi-lims-macbook-pro:pa2 ungmi$ as -arch i386 swap.s
swap.s:16:Unknown pseudo-op: .type
swap.s:16:Rest of line ignored. 1st junk character valued 115 (s).
ung-mi-lims-macbook-pro:pa2 ungmi$**
could you help me out.. just let me know what I need to compile assembly file.. I have xcode already.. and I'd rather to do this with commend window..and vi editor..
I will be waiting for your answer... plz help me.