-1

It doesn't necessarily have to be an array (it can be a register such as ax).

It's part of an exercise and it recommends to move only the first (right) 16 bit of eax to the array.

PeteSab
  • 15
  • 2
  • 2
    Since the low 16 bits are already in `ax`, you are done :) But if you want to `mov` it to anywhere else, just do so. – Jester May 23 '16 at 12:34
  • 2
    `ax` already contains the lower 16 bits of `eax`, since `ax` is just another "subview" of the `a` register. See my answer here as well: http://stackoverflow.com/posts/37275984/revisions – CherryDT May 23 '16 at 12:40
  • Possible duplicate of [x86 Calculating AX given AH and AL?](http://stackoverflow.com/questions/37243801/x86-calculating-ax-given-ah-and-al) (because CherryDT's answer has a nice ASCII-art register subset diagram). – Peter Cordes May 23 '16 at 13:33
  • See also the [x86 tag wiki](http://stackoverflow.com/tags/x86/info) – Peter Cordes May 23 '16 at 13:34

1 Answers1

4

The Intel registers can be referred to in a number of ways depending on how many bits you need:

  • RAX - 64 bits
  • EAX - The lower (rightmost) 32 bits of RAX
  • AX - The lower (rightmost) 16 bits of EAX
  • AH - The top 8 bits of AX
  • AL - The lower 8 bits of AX

To grab the lower 16 bits of EAX you could simply:

MOV BX, AX
David Hoelzer
  • 15,862
  • 4
  • 48
  • 67