PDA

View Full Version : How 6502 Overflow Works



wraggster
January 15th, 2013, 22:48
http://hackadaycom.files.wordpress.com/2013/01/6502overflow.png?w=580&h=434 (http://hackaday.com/2013/01/15/how-6502-overflow-works/6502overflow/)
The 6502 was a ubiquitous microprocessor back in the 80s, powering devices such as the Apple II and the Nintendo Entertainment System. [Ken] took an in depth look at a small part of the processor: the overflow circuit (http://www.arcfn.com/2013/01/a-small-part-of-6502-chip-explained.html).
In order to do signed calculations, a microprocessor’s arithmetic logic unit (ALU) needs to be able to calculate when an overflow occurs. This happens when two numbers are added that cannot fit in a single byte. The result of a calculation will be incorrect, so the processor must inform the program that an overflow has occurred. This is done by setting an overflow flag.
[Ken] uses this example to first explain how the overflow circuit works in logic. He then looks at the gates and a transistor implementation of the logic. Finally, he walks us through the circuit on the actual 6502 die, showing how the circuit is constructed in silicon.
This is a great example to learn a bit more about how ALUs work and how integrated circuits get built.
http://hackaday.com/2013/01/15/how-6502-overflow-works/