You are on page 1of 2

INSTRUCTION PIC 16 PIC 18 ARM

MOVE MOVWF f MOVWF f, A MOV R0, R1


MOVLW k MOVLW k //no A MOV R0, #k
MOVF f, d MOVF f, d, A
MOVFF fs, fd //no A
MVN R0,R1

ADD ADDWF f, d ADDWF f, d, A ADD R0, R1, R2


ADDLW k ADDLW k //no A ADC R0, R1, R2
ADDWFC f, d, A

SUBTRACT SUBWF f, d SUBWF f, d, A SUB R0, R1, R2


SUBLW k SUBLW k //no A SBC R0, R1, R2
SUBWFC f, d, A RSB R0, R1, R2
RSC R0, R1, R2
Note: In PIC,
SUBLW = W  k-W ; SUBWF = d(?)  f-W
Note: In ARM, there is inverted carry,
SUB = R0 R1 – R2, ; RSB = R0  R2-R1

MULTIPLY XXXXXXXXXXXXX MULWF f, A MUL R0, R1, R2


MULLW k //no A MLA R0, R1, R2, R3
UMULL R0, R1, R2, R3
SMULL R0, R1, R2, R3
UMLAL R0, R1, R2, R3
SMLAL R0, R1, R2, R3
IN PIC, {PRODH, PRODL}  MULTIPLICATION RESULT

IN ARM, MUL = R0  R1 * R2 (FOR BOTH SIGNED AND UNSIGNED NUMBERS)


MLA = R0  (R1 * R2) + R3
UMULL = {R1, R0}  R2 * R3 (FOR UNSIGNED NUMBERS)
SMULL = {R1, R0}  R2 * R3 (FOR SIGNED NUMBERS)
UMLAL = {R1, R0}  (R2 * R3) + {R1, R0} (FOR UNSIGNED NUMBERS)
SMLAL = {R1, R0}  (R2 * R3) + {R1, R0} (FOR SIGNED NUMBERS)

AND/OR/EXOR ANDWF f, d ANDWF f, d, A AND R0, R1, R2


ANDLW k ANDLW k
OR = IOR OR = IOR OR = ORR
EXOR = XOR EXOR = XOR EXOR = EOR
IN ARM,
BIC R0, R1, R2 R0  R1. (R2)’ DO NOT AFFECT FLAGS (ADD ‘S’, IF NEEDED)
CMP R0, R1 PERFORMS R0-R1; AFFECT FLAGS ONLY
CMN R0, R1 PERFORMS R0+R1; AFFECT FLAGS ONLY
TST R0, R1 PERFORMS R0 AND R1; AFFECT FLAGS ONLY
TEQ R0, R1 PERFORMS R0 XOR R1; AFFECT FLAGS ONLY

INCREMENT INCF f, d INCF f, d, A XXXXXXXXXXXXXXXXXXXXXXXXXXXX


DECREMENT DECF f, d DECF f, d, A XXXXXXXXXXXXXXXXXXXXXXXXXXXX
1’s COMPLEMENT COMF f, d COMF f, d, A XXXXXXXXXXXXXXXXXXXXXXXXXXXX
2’s COMPLEMENT XXXXXXXXXXXXX NEGF f, d, A XXXXXXXXXXXXXXXXXXXXXXXXXXXX
DAW XXXXXXXXXXXXX DAW XXXXXXXXXXXXXXXXXXXXXXXXXXXX
CLEAR CLRW XXXXXXXXXXXXXXXXXXXXXXXXXXXX
CLRF f CLRF f, A
SWAP SWAPF f, d SWAPF f, d, A XXXXXXXXXXXXXXXXXXXXXXXXXXXX
CONDITIONAL BRANCH
BRANCH IF CARRY XXXXXXXXXXXXX BC n BCS n
BNC n BCC n
BRANCH IF ZERO XXXXXXXXXXXXX BZ n BEQ n
BNZ n BNE n
BRANCH IF XXXXXXXXXXXXX BOV n BVS n
OVERFLOW BNOV n BVC n
BRANCH IF NEGATIVE XXXXXXXXXXXXX BN n BMI n
BNN n BPL n
BRANCH IF HIGHER C.(~Z) BHI n
BRANCH IF HIGHER OR BHS n
SAME
BRANCH IF LOWER BLO n
BRANCH IF LOWER OR (~C).Z BLS n
SAME
BRANCH IF GREATER (~Z) AND [---------------] BGT n
BRANCH IF GREATER (NV) OR [(~N).(~V)] BGE n
OR EQUAL
BRANCH IF LESS [N(~V)] OR [(~N)V] BLT n
BRANCH IF LESS OR BLE n
EQUAL
UNCONDITIONAL BRANCH
BRANCH ALWAYS GOTO n BRA n Bn
GOTO n BAL n
BRANCH NEVER NOP NOP BNV n
NOP
CALL AND RETURN
CALL CALL k CALL k BL n
RCALL k
RETURN RETURN (subroutine) RETURN (subroutine) B return
RETLW k (subroutine) RETLW k (subroutine)
RETFIE (ISR) RETFIE (ISR)
BIT INSTRUCTIONS
ROTATE LEFT RLF f, d RLCF f, d, A LSL #N
THROUGH CARRY LSR #N
ROTATE RIGHT RRF f, d RRCF f, d, A ASR #N
THROUGH CARRY ROR #N (ROTATE WITH CARRY)
ROTATE LEFT XXXXXXXXXXXXX RLNCF f, d, A REST WITHOUT CARRY
WITHOUT CARRY
ROTATE RIGHT XXXXXXXXXXXXX RRNCF f, d, A
WITHOUT CARRY
BIT SET BSF F, B BSF F, B, A XXXXXXXXXXXXXXXXXXXXXXXXXX
BIT CLEAR BCF F, B BCF F, B, A XXXXXXXXXXXXXXXXXXXXXXXXXX
BIT TEST SKIP IF CLEAR BTFSC F, B BTFSC F, B, A XXXXXXXXXXXXXXXXXXXXXXXXXX
BIT TEST SKIP IF SET BTFSS F, B BTFSS F, B, A XXXXXXXXXXXXXXXXXXXXXXXXXX
BIT TOGGLE XXXXXXXXXXXX BTG F, B, A XXXXXXXXXXXXXXXXXXXXXXXXXX

INCREMENT F, SKIP IF INCFSZ F,D INCFSZ F,D XXXXXXXXXXXXXXXXXXXXXXXXXX


F=0 INCFSNZ F,D (F ≠ 0)
DECREMENT F, SKIP IF DECFSZ F,D DECFSZ F,D XXXXXXXXXXXXXXXXXXXXXXXXXX
F=0 DECFSNZ F,D (F ≠ 0)

SKIP IF F=W XXXXXXXXXXX CPFSEQ F, A XXXXXXXXXXXXXXXXXXXXXXXXXX


SKIP IF F>W XXXXXXXXXXX CPFSGT F, A XXXXXXXXXXXXXXXXXXXXXXXXXX
SKIP IF F<W XXXXXXXXXXX CPFSLT F, A XXXXXXXXXXXXXXXXXXXXXXXXXX
SKIP IF F=0 XXXXXXXXXXX TSTFSZ F, A XXXXXXXXXXXXXXXXXXXXXXXXXX