Is there such a thing as overflow when doing CMPS/CMPSX? Because you are just comparing, and not producing a 'difference', I think there's nothing that could be called overflow. Is that right? $8000_0000 compared to $0000_0001 is 'less than', so C=1. I'm a little punch drunk from all this signed stuff.

CMPS is just SUBS without the result being saved, so yes there is an overflow and it will be used to generate the correct sign. TESTB D,#31 XORC relies on D[31] being the msb of the result, which it won't be with CMPS/CMPSX but that matters not one jot.

We could call it "correct sign", but maybe just "sign" would suffice. On the other hand, "correct sign" doesn't get mentally dismissed as easily.

Plain "sign" would be interpreted as the sign bit of the result, I think. I like the name "correct sign" and what it is, the XOR combination of sign bit and overflow.

XOR is a beautiful logical operation because it's reversible and there's no carry. After writing xoroshiro+ code for the Z80, I'm really tuned into XOR and I found it easier to represent two variables as a and a XOR b instead of simply a and b.

Finally, Chip, could you please add TESTB D,#31 XORC somewhere in the docs, so that people know how to test for overflow? Thanks.

## Comments

840Vote UpVote DownCMPS is just SUBS without the result being saved, so yes there is an overflow and it will be used to generate the correct sign. TESTB D,#31 XORC relies on D[31] being the msb of the result, which it won't be with CMPS/CMPSX but that matters not one jot.

Plain "sign" would be interpreted as the sign bit of the result, I think. I like the name "correct sign" and what it is, the XOR combination of sign bit and overflow.

XOR is a beautiful logical operation because it's reversible and there's no carry. After writing xoroshiro+ code for the Z80, I'm really tuned into XOR and I found it easier to represent two variables as

aanda XOR binstead of simplyaandb.Finally, Chip, could you please add

TESTB D,#31 XORCsomewhere in the docs, so that people know how to test for overflow? Thanks.8,0300Vote UpVote Downhttps://docs.google.com/spreadsheets/d/12LZ9KPEy5FEz8aVAG1DBVur36MB2eTVNT4QZ7wgpc-c/edit?usp=sharing