4.4 Non-EAX/AX/AL expressions
------------------------------
Such expressions are used when the result must be saved to any register
other than EAX, AX or AL. When calculating this type of expression, only
the contents of the destination register changes, and all other registers
are preserved. If the destination register is a byte register and
calculation makes use of values are large as a word, when one writes to the
trailing byte the contents of the leading byte of the destination register
may also be destroyed.
This places some limits on operations and operands permitted in
EAX/AX/AL expressions. In byte-type expressions one cannot:
call a macro function
call a register function
call a stack function
Non-EAX/AX/AL expressions used to be allowed use of only the following
operations: addition, subtraction, XOR, OR, and AND. Now there are far
fewer such restrictions for 16 and 32-bit registers, but a few restrictions
still remain. For instance if the expression contains a shift to the value
of a variable and the destination is register CX or ECX this expression is
compiled as follows:
CX = var * SI * 3 * var >> 3; //generates an error message
Note: for 8-bit non-AL expressions you can multiply only by 0, 1, 2, 4,
8, 16, 32, 64, or 128. All these restrictions are related to the preference
for not destroying other registers when using non-EAX/AX/AL expressions.