assembly68hc12

In HC12 is it possible to compare 2 registers directly?


If I've loaded a value into register X and one into register Y, and I want to compare them... usually I have to do something like:

ldx value_1
ldy value_2
pshy
cpx 0,sp
ins

But that's 3 operations for the compare. Is there not a way to do this directly? I've tried cmp 0,y and cmp y, but those don't do what I want.

Is this just something I'll have to live with?

Thanks,

z.


Solution

  • For X and Y, I think yes, you have to load them first.

    If you can use A and B though, you might be able to use SBA. That would subtract the contents of B from A, setting your zero and other flags just like in a comparison.