What is parity for PASM commands...
Fastrobot
Posts: 51
in Propeller 1
Hi,
Simple question:
I'm looking at the p8x32A data-sheet, and noticing several commands set the carry bit to the so called "parity" of the result.
But the data sheet doesn't specify if that is even or odd parity.
So, if I have a command that tests a single bit: test ina,#4 wz,wc
The zero and carry bits are going to be set based on the value of bit number 2 of the input port.
example: if ina was equal to 7, executing the example command would cause the zero bit to be cleared.
But what would it do for the carry bit? set or cleared?
Thanks.
Simple question:
I'm looking at the p8x32A data-sheet, and noticing several commands set the carry bit to the so called "parity" of the result.
But the data sheet doesn't specify if that is even or odd parity.
So, if I have a command that tests a single bit: test ina,#4 wz,wc
The zero and carry bits are going to be set based on the value of bit number 2 of the input port.
example: if ina was equal to 7, executing the example command would cause the zero bit to be cleared.
But what would it do for the carry bit? set or cleared?
Thanks.
Comments
It turns out your example is problematic in that INA is a read-only register that appears in the destination address field. The TEST instruction is actually done between the "shadow RAM" location at the same address as INA, not the input register itself. What you want to do is: " TEST conFour,INA WZ,WC" where conFour is a constant with the value 4. In other words you'd have: "conFour LONG 4" somewhere after your code.
In that case, the TEST does a logical and of 7 with 4 with the result being 4. This is nonzero so Z is cleared to 0. The parity of the result is 1 (or odd) so C is set to 1.