beautypg.com

6 processor status flag operations, 1 sign flag, 2 zero flag – Maxim Integrated MAX31782 User Manual

Page 174: 9 .6 processor status flag operations -9, 19 .6 .1 sign flag -9 19 .6 .2 zero flag -9, 6processorstatusflagoperations

background image

MaximIntegrated 19-9

MAX31782 User’s Guide

Revision 0; 8/11

19.5.5ALUBitOperationsUsingOnlytheActiveAccumulator

The following operations operate on single bits of the current active accumulator in conjunction with the Carry flag . Any
of these operations may use an Acc bit from 0 to 15 .

move

C, Acc.0

; copy bit 0 of accumulator to Carry

move

Acc.5, C

; copy Carry to bit 5 of accumulator

and

Acc.3

; Acc.3 = Acc.3 AND Carry

or

Acc.0

; Acc.0 = Acc.0 OR Carry

xor

Acc.1

; Acc.1 = Acc.1 OR Carry

None of the above bit operations cause the auto-increment, auto-decrement, or modulo operations defined by the
accumulator pointer control (APC) register .

19.5.6Example:AddingTwo4-ByteNumbersUsingAuto-Increment

move

A[0], #5678h ; First number – 12345678h

move

A[1], #1234h

move

A[2], #0AAAAh ; Second number – 0AAAAAAAh

move

A[3], #0AAAh

move

APC, #81h

; Active Acc = A[0], increment low bit = mod 2

add

A[2]

; A[0] = 5678h + AAAAh = 0122h + Carry

addc

A[3]

; A[1] = 1234h + AAAh + 1 = 1CDFh

; 12345678h + 0AAAAAAAh = 1CDF0122h

9.6ProcessorStatusFlagOperations

The Processor Status Flag (PSF) register contains five flags that are used to indicate and store the results of arithmetic
and logical operations, four of which can also be used for conditional program branching .

19.6.1SignFlag

The Sign flag (PSF .6) reflects the current state of the most significant bit of the active accumulator . If signed arithmetic
is being used, this flag indicates whether the value in the accumulator is positive or negative .
Since the Sign flag is a dynamic reflection of the high bit of the active accumulator, any instruction that changes the
value in the active accumulator can potentially change the value of the Sign flag . Also, any instruction that changes
which accumulator is the active one (including AP auto-increment/decrement) can also change the Sign flag .
The following operation uses the Sign flag:
• JUMP S, src (Jump if Sign flag is set)

19.6.2ZeroFlag

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 .
Since the Zero flag is a dynamic reflection of (Acc = 0), any instruction that changes the value in the active accumulator
can potentially change the value of the Zero flag . Also, any instruction that changes which accumulator is the active one
(including AP auto-increment/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)