Integer overflow: Difference between revisions
Content added Content deleted
Puppydrum64 (talk | contribs) m (→Zilog Z80) |
Puppydrum64 (talk | contribs) m (→Zilog Z80) |
||
Line 2,670: | Line 2,670: | ||
=={{header|Z80 Assembly}}== |
=={{header|Z80 Assembly}}== |
||
===Zilog Z80=== |
===Zilog Z80=== |
||
The <code>P</code> flag represents overflow after an arithmetic operation, and bit parity after a bitwise or logical operation. Arithmetic operations will result in overflow if the |
The <code>P</code> flag represents overflow after an arithmetic operation, and bit parity after a bitwise or logical operation. Arithmetic operations will result in overflow if the 0x7F-0x80 boundary is crossed (or in the case of 16-bit math, the 0x7FFF-0x8000 boundary.) One quirk of the Z80 instruction set is that program counter relative jumps cannot be done based on overflow; only calls, returns, and jumps to fixed memory locations are allowed. In other words, the instructions <code>JR PE, label</code> and <code>JR PO, label</code> <i>do not exist.</i> |
||
There are no assembler mnemonics for overflow specifically, so we must borrow the ones for parity. |
There are no assembler mnemonics for overflow specifically, so we must borrow the ones for parity. |