beautypg.com

6 processor status flag operations, 1 sign flag, 3 .6 processor status flag operations -10 – Maxim Integrated MAXQ622 User Manual

Page 46: 3 .6 .1 sign flag -10

background image

MAXQ612/MAXQ622 User’s Guide

3-10

Maxim Integrated

sra

; Shift accumulator right arithmetically once

sra2

; Shift accumulator right arithmetically twice

sra4

; Shift accumulator right arithmetically 4 times

xchn

; Swap low and high nibbles of each Acc byte

xch

; Swap low byte and high byte of Acc

3.5.5 ALU Bit Operations Using Only the Active Accumulator

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

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 autoincrement, autodecrement, or modulo operations defined by the accu-
mulator pointer control (APC) register .

3.5.6 Example: Adding Two 4-Byte Numbers Using Autoincrement

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

3.6 Processor Status Flag Operations

The processor status flag (PSF) register contains four flags that are used to indicate and store the results of arithmetic
and logical operations as well as control program branching .

3.6.1 Sign Flag

The sign flag (PSF .6) reflects the current state of the high bit of the active accumulator, Acc .15 . If signed arithmetic is
being used, this flag indicates whether the value in the accumulator is positive or negative .
Because 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 autoincrement/decrement) can also change the sign flag .
The following operation uses the sign flag:
• JUMP S, src

(jump if sign flag is set)

This manual is related to the following products: