Does JMP always set the Z flag?
jazzed
Posts: 11,803
I see code like this sometimes:
jmp #label wz
Does it always set the Z flag? The latest datasheet/manual do not document this as far as I can tell.
Guess I get to write some test code. :grumble: :P ... these new emoticons are awful.
jmp #label wz
Does it always set the Z flag? The latest datasheet/manual do not document this as far as I can tell.
Guess I get to write some test code. :grumble: :P ... these new emoticons are awful.
Comments
I haven't verified it, but I believe that's how it works.
Dave
(JMP = JMPRET ... NR) I guess that means Z will be set with WZ.
I'd say that's an acceptable answer.
-Phil
The cflag, zflag and result variables I show in my code snippet above are only temporary variables. These values aren't actually stored in the cog's struct unless the appropriate bits are set in the ZCRI field of the instruction. The last few lines of the ExecutePasmInstruction routine in SpinSim are:
-Phil
The TEST or CMP instructions wouldn't work if the C or Z flags depended on whether the result was written or not. These are just NR versions of AND and SUB.
But Dave if the dest starts at 0 why would it ever become anything else unless it was written?
Even with NR, the result is always computed -- just not written. The Z flag is set according to that computed result, IOW what the destination would have been had the result actually been written.
-Phil