Subject: Re: detect arithmetic overflow
To: Johnny Billquist <email@example.com>
From: Christos Zoulas <firstname.lastname@example.org>
Date: 08/06/2003 11:03:18
On Aug 6, 4:50pm, email@example.com (Johnny Billquist) wrote:
-- Subject: Re: detect arithmetic overflow
| The person in this case cannot examine the carry bit. Otherwise it's
| normally much easier to check the overflow bit. :-)
| I'm not sure I understand your sentence though. But something similar is
| one rule for setting the overflow bit in processors.
Yup, this is what the PDP-11 processor book states, assuming the N bit is
the carry into the sign bit and the C bit is the carry bit.
| To quote my PDP-11 processor handbook:
| When using double-operand instructions, such as ADD, SUB or CMP, in which
| both the source and destination have like signs, a change of sign in the
| result indicates an overflow condition.
| Another method used by the CPU is to test the N bit and C bit when dealing
| with shift and rotate instructions.
| . If only the N bit is set, an overflow exists.
| . If only the C bit is set, an overflow exists.
| . If both the N and C bits are set, there is no overflow condition.
| (The N bit says what sign we have)
| Johnny Billquist || "I'm on a bus
| || on a psychedelic trip
| email: firstname.lastname@example.org || Reading murder books
| pdp is alive! || tryin' to stay hip" - B. Idol
-- End of excerpt from Johnny Billquist