r/AskProgramming•
BoJacob

[Assembly] Does the STATUS register only update depending on the previous instruction?

Resolved

I'm confused because I know that specific operations only effect certain bits in the STATUS register, but does that mean that the other unaffected bits are left alone? Or are they cleared?

Example:

*MOVLW h'01'

*MOVWF h'20'

*RRF h'20', F

*MOVF h'20', W

MOVLW and MOVWF don't change anything in STATUS

RRF will make h'20' 0000 0000, and set the Carry flag.

MOVF does effect Zero flag, so I know that will now be set

But my question is, will the Carry flag still be set from the previous instruction? I was under the impression that the STATUS register was like a memory of the last instruction, so if it had bits set, and then another operation was performed, it would overwrite. Like, MOVF obviously didn't carry anything, so would Carry be cleared or left alone?

Thanks in advance.

*edit: Sorry for the formatting. Tried to clean it up a little.

Posted May 29, 2016, 7:45 PM UTC

24
Loading comments…