SETFIELD Set record field value Extension
SETFIELD field_name destination_r/m, source_reg
Generates code that sets a value in a record field. Sets the field in
the destination register or memory address with the contents of a
source register. Source register must be a register of the same size
as destination_r/m or smaller; if smaller, it must be the least
significant part of another register that is the same size as the
destination.
To perform its function, SETFIELD generates a series of XOR, XCHG,
ROL, ROR, OR, and MOVZX instructions. The contents of source_reg
are changed.
If you're using SETFIELD when your source and target registers are
the same, the instruction does not OR the source value to itself.
Instead, SETFIELD ensures that the fields of the target register not
being set will be zero.
SETFIELD does not attempt to clear the target field before ORing the
new value. If this is necessary, you must explicitly clear the field
(using MASKFLAG).
Example: RECORD FiDate year:7, month:4, day:5
sub dx,dx ; Clear all fields
setfield year dx,bx ; (bx changed)
setfield month dx,cx ; (cx changed)
setfield day dx,al