Integer overflow: Difference between revisions

m
Line 2,593:
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>
 
<lang z80>ld a,&7F
ld a,&7F
add 1
jp pe,ErrorHandler ;pe = parity even, but in this case it represents overflow set</lang>
1,489

edits