beautypg.com

5 overflow flag, 7 controlling program flow, 1 obtaining the next exe – Maxim Integrated MAXQ Family User Manual

Page 36: 5 overflow flag -11, 7 controlling program flow -11, 1 obtaining the next execution address -11, Maxq family user’s guide

background image

3-11

• 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)

• AND Acc.

• OR Acc.

• XOR Acc.

• 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)

• MOVE Acc., C (Set selected active accumulator bit to Carry)

• AND Acc. (Carry = Carry AND selected active accumulator bit)

• OR Acc. (Carry = Carry OR selected active accumulator bit)

• XOR Acc. (Carry = Carry XOR selected active accumulator bit)

• JUMP C, src (Jump if Carry flag is set)

• JUMP NC, src (Jump if Carry flag is cleared)

3.6.5 Overflow Flag

The Overflow flag (PSF.2) is a static flag indicating that the carry or borrow bit (Carry status Flag) resulting from the last ADD/ADDC or

SUB/SUBB operation but did not match the carry or borrow of the high order bit of the active accumulator. The overflow flag is useful

when performing signed arithmetic operations.

The following instructions can alter the Overflow 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)

3.7 Controlling Program Flow

The MAXQ provides several options to control program flow and branching. Jumps may be unconditional, conditional, relative, or

absolute. Subroutine calls store the return address on the hardware stack for later return. Built-in counters and address registers are

provided to control looping operations.

3.7.1 Obtaining the Next Execution Address

The address of the next instruction to be executed can be read at any time by reading the Instruction Pointer (IP) register. This can be

particularly useful for initializing loops. Note that the value returned is actually the address of the current instruction plus 1, so this will

be the address of the next instruction executed as long as the current instruction does not cause a jump.

MAXQ Family User’s Guide

Maxim Integrated