beautypg.com

2 zero flag, 3 equals flag, 4 carry flag – Maxim Integrated MAXQ610 User Manual

Page 46: Maxq610 user’s guide

background image

3-11

MAXQ610 User’s Guide

3.6.2 Zero Flag

The zero flag (PSF .7) is a dynamic flag that reflects the current state of the active accumulator Acc . If all bits in the
active accumulator are zero, the zero flag equals 1 . Otherwise, it equals 0 .
Because the zero flag is a dynamic reflection of (Acc = 0), any instruction that changes the value in the active accu-
mulator can potentially change the value of the zero flag . Any instruction that changes which accumulator is the active
one (including AP autoincrement/decrement) can also change the zero flag .
The following operations use the zero flag:
• JUMP Z, src

(jump if zero flag is set)

• JUMP NZ, src

(jump if zero flag is cleared)

3.6.3 Equals Flag

The equals flag (PSF .0) is a static flag set by the CMP instruction . When the source given to the CMP instruction is
equal to the active accumulator, the equals flag is set to 1 . When the source is different from the active accumulator,
the equals flag is cleared to 0 .
The following instructions use the value of the equals flag . Note that the ‘src’ for the JUMP E/NE instructions must be
immediate .
• JUMP E, src

(jump if equals flag is set)

• JUMP NE, src

(jump if equals flag is cleared)

In addition to the CMP instruction, any instruction using PSF as the destination can alter the equals flag .

3.6.4 Carry Flag

The carry flag (PSF .1) is a static flag indicating that a carry or borrow bit resulted from the last ADD/ADDC or SUB/
SUBB operation . Unlike the other status flags, it can be set or cleared explicitly, and is also used as a generic bit
operand by many other instructions .
The following instructions can alter the carry flag:
• ADD src

(Add source to active accumulator)

• ADDC src

(Add source and carry to active accumulator)

• SUB src

(Subtract source from active accumulator)

• SUBB src

(Subtract source and carry from active accumulator)

• SLA, SLA2, SLA4

(Arithmetic shift left active accumulator)

• SRA, SRA2, SRA4

(Arithmetic shift right active accumulator)

• SR

(Shift active accumulator right)

• RLC/RRC

(Rotate active accumulator left/right through carry)

• MOVE C, Acc.

(Set Carry to selected active accumulator bit)

• MOVE C, #i

(Explicitly set, i = 1, or clear, i = 0, the carry flag)

• CPL C

(Complement carry)

• MOVE C, src.

(Copy bit addressable register bit to carry)

any instruction using PSF as the destination
The following instructions use the value of the carry flag:
• ADDC src

(Add source and carry to active accumulator)

• SUBB src

(Subtract source and carry from active accumulator)

• RLC/RRC

(Rotate active accumulator left/right through carry)

• CPL C

(Complement carry)