2-18
MSM66573 Family User's Manual
Chapter 2 CPU Architecture
The upper 8 bits of the PSW (PSWH) contain:
a flag (DD) that is referenced when executing instructions and
flags (CY, ZF, HC, S, OV) that are set to "1" or reset to "0" depending upon instruction
execution results.
Therefore, if the following instructions are performed on PSW or PSWH, flag operation may
change from its original function.
(i) Instructions that load the contents of PSW or PSWH into ACC
(contents of ZF become undefined)
(ii) Bit operation instructions on ZF
(ZF changes depending on its value immediately before execution of the bit operation
instruction.)
(iii) Increment, decrement, arithmetic, logic and compare instructions on PSW or PSWH
(The contents of PSW or PSWH immediately after instruction execution are undefined.)
If an interrupt occurs, PSW is automatically saved during interrupt processing and
automatically restored by execution of a RTI instruction.
PSW is assigned to the SFR area. At reset (due to a
RES input, BRK instruction execution,
watchdog timer overflow, or opcode trap), the contents of PSW become 0000H.
Each bit in the PSW is described below.
Bit 15: Carry flag (CY)
The carry flag is set to "1" if:
carry from bit 7 occurs in a byte operation,
borrow to bit 7 occurs in a byte operation,
carry from bit 15 occurs in a word operation, or
borrow to bit 15 occurs in a word operation
as the result of executing an arithmetic or comparison instruction. Otherwise it is reset to
"0". The carry flag can be set or reset directly by instructions and can be used to transmit
or receive data for bits specified by registers. In addition, the carry flag can be tested by
conditional branch instructions.
Bit 14: Zero flag (ZF)
The zero flag is set to "1" when:
the result of an arithmetic instruction is zero,
an instruction to load the ACC is executed and the load contents are zero, or
a bit operation instruction is executed and the target bit is zero.
Otherwise, it is reset to "0". The zero flag can be tested by conditional branch instructions.