1

I am learning for my exam and I can't understand why those two operations are wrong:

  1. mov al, 0110h

  2. push dh

and this is right:

  1. push si

What exactly I can push on stack?

fuz
  • 88,405
  • 25
  • 200
  • 352
Pond
  • 3
  • 2
  • 5
    1) `0110h` is bigger than 8 bits, it obviously doesn't fit into `al` which is a 8 bit register. 2) you can only push 16 bit registers – Jester Jan 31 '16 at 13:46
  • thank you. I have one question to the second answer : shouldn't it be bigger or equal to 16bit registers , because I think that push eax is possible, which is 32bit register – Pond Jan 31 '16 at 13:51
  • If `push eax` is possible depends on the instruction set/current processor mode. If it is 32-bit, then it would be ok. `push dh` seems to be invalid, see [PUSH](http://www.felixcloutier.com/x86/PUSH.html). Although `push imm8` is valid, `push r/m8` ("push dh") is not. So stack alignment seems to be of no concern. `push r/m16` ("push si") is valid, as you can see. – zx485 Jan 31 '16 at 14:12
  • 3
    You put `8086` in the title. That has no `eax`. – Jester Jan 31 '16 at 14:33
  • @zx485 You can also do a `push eax` in 16 bit mode—in this case, the assembler inserts a 66h prefix before the instruction to indicate that it's a 32 bit push. – fuz Jan 31 '16 at 15:16
  • @FUZxxl: You're right. Anyone who is interested in the specifics can visit [this post](http://stackoverflow.com/a/14660027/1305969) – zx485 Jan 31 '16 at 15:45

0 Answers0