Search code examples
assemblyx86mov

Illegal use of mov/xchg operators


I'm taking an assembler course at school and they asked this question:

What are illegal use of the next operations:

1.    mov   bh,al
2.    mov   dh,cx 
3.    mov   bh,bh 
4.    mov   cl, 4F2h 
5.    mov   cx, 002dh 
6.    xchg  var1, var2

What are the situations where the operations with mov and xchg are not legal?


Solution

  • Certain combinations of operands are legal, and certain combinations aren't. Most notably, both operands must be of the same size, and at least one operand must be a register. I think those facts combined should suffice to let you determine which of the above are legal and which are not.