[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Pgubook-readers] Issue With 1st Example
From: |
Bryn M. Reeves |
Subject: |
Re: [Pgubook-readers] Issue With 1st Example |
Date: |
Wed, 10 Feb 2010 17:07:23 +0000 |
On Wed, 2010-02-10 at 09:19 -0700, address@hidden wrote:
> Hello,
>
> I'm having some issues with the first actual example assembly program
> in the text, namely that when I run it through the assembler, this is
> what I'm getting:
>
> address@hidden:~/asm> as exit.s -o exit.o
> exit.s: Assembler messages:
> exit.s:0: Warning: end of file in comment; newline inserted
> exit.s:25: Error: no such instruction: `mov1 $1,%eax'
> exit.s:29: Error: no such instruction: `mov1 $0,%ebx'
> address@hidden:~/asm>
>
> I'm not quite sure why this is happening, so I've attached my source
> file to this message, which I created and attempted to assemble using
> kwrite on my 32-bit openSUSE installation. Please let me know why
> this is happening, so I can continue learning assembly with confidence
> in my materials.
>
> ~Wesley
Hi Wesley,
Looks like a minor typo - those are "l"s (lowercase L) on the end of the
mov instruction not "1"s (numeral one) - it should read "movl". The
error you are getting is because "mov1" isn't recognised as a valid x86
assembler mnemonic.
The full name of the instruction is "move long".
Corrected version (assembles, links & runs here) attached:
$ as -o exit.o exit.s
$ ld -o exit exit.o
$ ./exit
$ echo $?
0
$ objdump -d ./a.out
./a.out: file format elf64-x86-64
Disassembly of section .text:
0000000000400078 <_start>:
400078: b8 01 00 00 00 mov $0x1,%eax
40007d: bb 00 00 00 00 mov $0x0,%ebx
400082: cd 80 int $0x80
Cheers,
Bryn.
exit.s
Description: Text document