73
CHAPTER 3 CPU ARCHITECTURE
(2) Parity/overflow flag (P/V)
The P/V flag performs the following two kinds of operation associated with execution of an operation instruction.
The status of the P/V flag can be tested with a conditional branch instruction.
Parity flag operation
Set (1) when the number of bits set (1) as the result of execution of a logical operation instruction, shift/rotate
instruction, or a CHKL or CHKLA instruction is even, and reset (0) if odd. When a 16-bit shift instruction is
executed, however, only the low-order 8 bits of the operation result are valid for the parity flag.
Overflow flag operation
Set (1) only when the numeric range expressed as a two’s complement is exceeded as the result of execution
of a arithmetic operation instruction, and reset (0) otherwise. More specifically, the value of this flag is the
exclusive OR of the carry into the MSB and the carry out of the MSB. For example, the two’s complement range
in an 8-bit arithmetic operation is 80H (–128) to 7FH (+127), and the flag is set (1) if the operation result is outside
this range, and reset (0) if within this range.
Example
The operation of the overflow flag when an 8-bit addition instruction is executed is shown below.
When the addition of 78H (+120) and 69H (+105) is performed, the operation result is E1H (+225), and the
two’s complement limit is exceeded, with the result that the P/V flag is set (1). Expressed as a two’s
complement, E1H is -31.
78H (+120)
69H (+105)
=
= +)
0111
0110
1110
1000
1001
0001
+)
0
CY
=
–31
P/V = 1
When the following two negative numbers are added together, the operation result is within the two’s
complement range, and therefore the P/V flag is reset (0).
FBH (–5)
F0H (–16)
=
= +)
1111
1111
1110
1011
0000
1011
+)
1
CY
=
–21
P/V = 0
(3) Interrupt request enable flag (IE)
This flag controls CPU interrupt request acknowledgment operations.
When “0”, interrupts are disabled, and only non-maskable interrupts and unmasked macro service can be
acknowledged. All other interrupts are disabled.
When “1”, the interrupt enabled state is set, and enabling of interrupt request acknowledgment is controlled by the
interrupt mask flags corresponding to the individual interrupt requests and the priority of the individual interrupts.
The IE flag is set (1) by execution of an EI instruction, and reset (0) by execution of a DI instruction or acknowledgment
of an interrupt.