[A83] Re: tst + tstio instructions
[Prev][Next][Index][Thread]
[A83] Re: tst + tstio instructions
> From: "Ronald Teune" <rtwolf@gmx.net>
>
> > The m and p flags are minus and positive, which merely reflect the sign
of
> > the result. Note that this is distinctly different from the carry, as
> > adding 2 to -3 still results in the m flag being set even though the
carry
> > is not. And p is true when m isn't true.
> Well, I don't understand carry too, actually.
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
Follow-Ups:
References: