6 processor status flag operations -35, 1 sign flag -35 – Maxim Integrated MAXQ7666 User Manual
Page 37

1.3.5.4 ALU Operations Using Only the Active Accumulator
The following arithmetic and logical operations operate only on the active accumulator.
cpl
; Acc = NOT Acc
neg
; Acc = (NOT Acc) + 1
rl
; Rotate accumulator left (not using Carry)
rlc
; Rotate accumulator left through Carry
rr
; Rotate accumulator right (not using Carry)
rrc
; Rotate accumulator right through Carry
sla
; Shift accumulator left arithmetically once
sla2
; Shift accumulator left arithmetically twice
sla4
; Shift accumulator left arithmetically four times
sr
; Shift accumulator right, set Carry to Acc.0,
; set Acc.15 to zero (MAXQ20)
sra
; Shift accumulator right arithmetically once
sra2
; Shift accumulator right arithmetically twice
sra4
; Shift accumulator right arithmetically four times
xchn
; Swap low and high nibbles of each Acc byte
xch (MAXQ20 only)
; Swap low byte and high byte of Acc
1.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 oper-
ations 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 point-
er control (APC) register.
1.3.5.6 Example: Adding Two 4-Byte Numbers Using Auto-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
1.3.6 Processor Status Flag Operations
The Processor Status Flag (PSF) register contains five flags that are used to indicate and store the results of arithmetic and logical oper-
ations, four of which can also be used for conditional program branching.
1.3.6.1 Sign Flag
The Sign flag (PSF.6) reflects the current state of the high bit of the active accumulator (Acc.15 for the MAXQ20). 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)
MAXQ7665/MAXQ7666 User’s Guide
1-35
Maxim Integrated