beautypg.com

3 alu operations using t, 4 alu operations using o, 5 alu bit operations usi – Maxim Integrated MAXQ7667 User Manual

Page 36: Maxq7667 user’s guide

background image

3-9

___________________________________________________________________________________________________________

MAXQ7667 User’s Guide

3.5.3 ALU Operations Using the Active Accumulator and a Source

The following arithmetic and logical operations can use any register or immediate value as a source. The active accumulator Acc is

always used as the second operand and the implicit destination. Also, Acc may not be used as the source for any of these operations.

add A[4]

; Acc = Acc + A[4]

addc #32h

; Acc = Acc + 0032h + Carry

sub A[15]

; Acc = Acc – A[15]

subb A[1]

; Acc = Acc – A[1] - Carry

cmp #00h

; If (Acc == 0000h), set Equals flag

and A[0]

; Acc = Acc AND A[0]

or #55h

; Acc = Acc OR #0055h

xor A[1]

; Acc = Acc XOR A[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

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 autoincrement, autodecrement, or modulo operations defined by the accumulator pointer

control (APC) register.