[[Category:CP1610]]
| Instruction Name | Return Status Word |
| Mnemonic | RSWD |
| CP1610 Clock Cycles | 6 |
| Interruptible | Yes |
| Opcode Range | $0038-$003F |
The Return Status Word (RSWD) instruction sets or clears the [[Sign Flag]], [[Zero Flag]], [[Overflow Flag]], and [[Carry Flag]] according to the value in the specified register. The opcode format is as follows.
0000:0000:0011:1rrr
where:
rrr indicates the target register
such that:
rrr == 000 indicates register R0
rrr == 001 indicates register R1
rrr == 010 indicates register R2
rrr == 011 indicates register R3
rrr == 100 indicates register R4
rrr == 101 indicates register R5
rrr == 110 indicates register R6
rrr == 111 indicates register R7
After the RSWD instruction is executed, the S, Z, O, and C flags will be set or clear based on the bits in the specified register according to the format below.
0000:0000:szoc:0000
where:
s if one(1), the [[Sign Flag]] is set; otherwise, cleared
z if one(1), the [[Zero Flag]] is set; otherwise, cleared
o if one(1), the [[Overflow Flag]] is set; otherwise, cleared
c if one(1), the [[Carry Flag]] is set; otherwise, cleared