ALU and Accumulator Operations
Simple Math & Shift
Accumulator - Basic Math Instructions
MOV Ax, loc16
ADD Ax, loc16
SUB Ax, loc16
AND Ax, loc16
OR Ax, loc16
XOR Ax, loc16
AND Ax,loc16,#16b
NOT Ax
NEG Ax
MOV loc16,Ax
Ax = AH or AL Operations
xxx Ax, #16b ;word
xxxB Ax, #8b ;byte
xxxL ACC, #32b ;long
xxx = instruction: MOV, ADD, SUB, ...
Ax = AH, or AL
Assembler will automatically convert to 1
word instruction.
Two word instructions with shift option
One word instruction, no shift
ADD ACC, #01234h<<4
ADDB AL, #34h
ACC Operations
MOV ACC,loc16<<shift
ADD
SUB
}
from memory (left shift
optional)
MOV ACC,#16b<<shift
ADD
SUB
}
16-bit constant (left shift
optional)
MOV loc16,ACC <<shift ;AL
MOVH loc16,ACC <<shift ;AH
Format
Ex
Variation
Shift the Accumulator
Shift full ACC
LSL ACC <<shift
SFR ACC >>shift
LSL ACC <<T
SFR ACC >>T
ACC
31 ……… 0
SFR
ACC
31 ……… 0
LSL
0C
C
SXM
Shift AL or AH
LSL AX <<T
LSR AX <<T
ASR AX >>T
LSL AX <<shift
LSR AX <<shift
ASR AX >>shift
Ax
15 ……… 0
ASR
Ax
15 ……… 0
LSL
0C
C
SXM
Ax
15 ……… 0
LSRC
0
(1-16)
(0-15)
C28x - Appendix C - Assembly Programming C - 7