Integer overflow: Difference between revisions

m
Line 2,671:
===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 7F-80 boundary is crossed. 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.
Your assembler may have overflow mnemonics but it's not a standard feature of the language.
* <code>PE</code> parity even, overflow occurred.
* <code>PO</code> parity odd, no overflow
 
<lang z80>ld a,&7F
1,489

edits