[A83] Re: tst + tstio instructions
[Prev][Next][Index][Thread]
[A83] Re: tst + tstio instructions
The statements about the P/M flag are mostly correct -- however not all
instructions affect the P/M flag. Refer to the Zilog docs to see which do
and which don't. Carry isn't always affected either. For example, INC r and
DEC r don't affect the carry, even though there was a carry during the
operation. Again, the Zilog docs list how all instructions affect the flags.
-----Original Message-----
From: assembly-83-bounce@lists.ticalc.org
[mailto:assembly-83-bounce@lists.ticalc.org]On Behalf Of Tijl Coosemans
Sent: Tuesday, July 03, 2001 2:15 PM
To: assembly-83@lists.ticalc.org
Subject: [A83] Re: tst + tstio instructions
The P/M flag has the same value as bit 7 of A. If it's set (negative result)
then the P/M flag is set, and you test that with M. If it isn't set
(positive result) then the P/M flag isn't set (how obvious :-) and you test
that with P.
The carry you can see as the 9th bit of A. When A overflows (larger than
$FF) then the carry is set. When the result is below 0 then the carry is set
either. Remember your first math classes. Then you had things like this (but
now in binary)
ca 7 6 5 4 3 2 1 0
0 1 1 1 1 1 1 1 1
+ 0 0 0 0 0 0 0 1
------------------
1 0 0 0 0 0 0 0 0
ca 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0
- 0 0 0 0 0 0 0 1
------------------
1 1 1 1 1 1 1 1 1
You see, the carry is set when a bit has been 'carried' over.
In rotations and shifts, the carry has the same value as the bit that was
shifted away, carried away.
Tijl Coosemans
References: