I'm reading a book on how to write assembly for x86 Linux.
I want to assemble the following assembly source code (exit.s) on my x86_x64 Linux OS:
.section .data
.section .text
.globl _start
_start:
mov1 $1, %eax
mov1 $0, %ebx
int $0x80
By calling this command: as exit.s -o exit.o
However, the assembler exits with the following error:
exit.s: Assembler messages:
exit.s: Warning: end of file not at end of a line; newline inserted
exit.s:6: Error: no such instruction: `mov1 $1,%eax'
exit.s:7: Error: no such instruction: `mov1 $0,%ebx'
From what I can gather, the instruction set for x86_x64 Linux is different from x86, hence the error. By replacing mov1 with mov, the assembler succeeds in compiling. However, seeing as the rest of the book is written for x86, I would like to be able to assemble x86 assembly for my OS.
I read somewhere that it's possible to do so by specifying the option --32, like so: as --32 exit.s -o exit.o, but by doing that, I receive the same error as before.
How do I assemble x86 source code on an x86_x64 architecture?