Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

16-bit MCU and DSC Programmer’s Reference Manual
DS70157F-page 410 © 2005-2011 Microchip Technology Inc.
SUB
Subtract Accumulators
Implemented in: PIC24F PIC24H PIC24E dsPIC30F dsPIC33F dsPIC33E
X X X
Syntax: {label:} SUB Acc
Operands: Acc [A,B]
Operation: If (Acc = A):
ACCA – ACCB ACCA
Else:
ACCB – ACCA ACCB
Status Affected: OA, OB, OAB, SA, SB, SAB
Encoding: 1100 1011 A011 0000 0000 0000
Description: Subtract the contents of the unspecified accumulator from the contents
of Acc, and store the result back into Acc. This instruction performs a
40-bit subtraction.
The ‘A’ bit specifies the destination accumulator.
Words: 1
Cycles: 1
Example 1:
SUB A ; Subtract ACCB from ACCA
; Store the result to ACCA
; CORCON = 0x0000 (no saturation)
Before
Instruction
After
Instruction
ACCA 76 120F 098A ACCA 52 1EFC 4D73
ACCB 23 F312 BC17 ACCB 23 F312 BC17
CORCON 0000 CORCON 0000
SR 0000 SR 1100 (OA, OB = 1)
Example 2:
SUB B ; Subtract ACCA from ACCB
; Store the result to ACCB
; CORCON = 0x0040 (SATB = 1)
Before
Instruction
After
Instruction
ACCA FF 9022 2EE1 ACCA FF 9022 2EE1
ACCB 00 2456 8F4C ACCB 00 7FFF FFFF
CORCON 0040 CORCON 0040
SR 0000 SR 1400 (SB, SAB = 1)

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh