3

I'm starting to learn Assembly (ASM x86). I'm using the emulator emu8086. I've written the following instruction:

mov eax,3

When I'm trying to emulate the instruction, emu8086 writes: wrong parameters MOV eax,3. probably it's an undefined var: eax

In addition, when I replaced eax with ax, ah or al - It worked just fine.

Why is it like that? What should I do in order to fix this problem? Thanks.

Michael Petch
  • 46,082
  • 8
  • 107
  • 198
Programmer
  • 750
  • 2
  • 9
  • 17

2 Answers2

7

emu8086 emulates the original 8086. It's a 16 bit processor, so there are no 32 bit registers (eax, ebx, etc.)

For a bit more information on the register layout, check out the Wikipedia page on the Intel 8086.

chbaker0
  • 1,758
  • 2
  • 13
  • 27
  • 1
    Thanks. Do you know any other emulator which is suitable to usage of 32 bit registers too? – Programmer Jan 23 '14 at 18:52
  • @Programmer try the NASM assembler – meda Jan 23 '14 at 18:56
  • I don't know of any that are as interactive as emu8086. However, you can use an emulator like [bochs](http://bochs.sourceforge.net/) and use an assembler like [NASM](http://www.nasm.us/) to get 32 bit (and 64 bit) emulation. – chbaker0 Jan 23 '14 at 18:57
  • 1
    @Programmer Note: things get a lot more complicated when you are attempting to emulate 32 bits. You have to actually go through the process of switching the (emulated) CPU into 32 bit mode, which is a whole topic in itself. If you want 32 bit assembly, you may be best off just writing native assembly programs for whatever OS you are on. – chbaker0 Jan 23 '14 at 19:00
0
db 66h
mov ax, 3
db 0, 0

Should emulate mov eax, 3 (in 16-bit code) in an assembler that doesn't support it. Easier to use an assembler that does...

DirtyBit
  • 16,613
  • 4
  • 34
  • 55
Frank Kotler
  • 3,079
  • 2
  • 14
  • 9