Masked move MASKED MOV

Copies only the bits of Source that Mask picks into Dest.

How it works

While the rung is true, each bit of Dest that is on in Mask takes that bit from Source. Every other bit of Dest stays as it was. A false rung changes nothing.

How it's used

Use it to change some bits of a word and keep the others, such as two valve bits in an output word.

TagValue
Command13
Mask3
Valves241

Mask picks bits 0 and 1. Only those bits come from Command, so Valves is 241: its upper bits stay as they were.

Operands

OperandData typeRead or write
SourceDINT or a numberReads
MaskDINT or a numberReads
DestDINTReads and writes

Common mistakes

  • Expecting the bits outside Mask to clearOnly the bits that are on in Mask change. To clear the others, MOV 0 into Dest first.