Testing status flags
4x5n
Posts: 745
I've got a bunch of SX micro-controllers and am looking into writing code for a simple first project. There are no sensors that require advance mathematics. I'm going through the instruction set looking for instructions for testing flag states in the status register. In particular I'm interested in the DC flag. However I don't see any test instructions for flags or individual bits in a register. Is there such a command or am I going to have to mask off the bit with an "and" and then act on the zero flag?
Masking off the bit and acting on it wouldn't be the worst thing in the world but I'd rather not if there's an instruction that will do so directly.
Masking off the bit and acting on it wouldn't be the worst thing in the world but I'd rather not if there's an instruction that will do so directly.
Comments
Obviously some very special status bits have dedicated instructions, e.g., SNC, SC, JC, JNC, SZ, SNZ, JZ, JNZ. But you could still use the same bit tests, e.g.
JNB Z, :somelabel
But it's not as efficient.
At least the instruction set just isn't that big
Here is a really useful cheat sheet.
Trying to keep things straight is more then a slight challenge. On the positive side I'm having a lot of fun. Yes I know I should at least stick with one processor but I got a bunch of SX processors at a price that I couldn't resist. Now all I have to do is come up with ways to use them. :-)