# Vault 7: Projects

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

### Protego

# PIC24FJ64GA004 - Programmers Reference Manual

- 1
- 2
…
- 404
- 405
- 406
- 407
- 408
…
- 501
- 502

16-bit MCU and DSC Programmer’s Reference Manual
DS70157F-page 406 © 2005-2011 Microchip Technology Inc.
SUB
Subtract Literal from Wn
Implemented in: PIC24F PIC24H PIC24E dsPIC30F dsPIC33F dsPIC33E
X X X X X X
Syntax: {label:} SUB{.B} #lit10, Wn
Operands: lit10 ∈ [0 ... 255] for byte operation
lit10 ∈ [0 ... 1023] for word operation
Wn ∈ [W0 ... W15]
Operation: (Wn) – lit10 → Wn
Status Affected: DC, N, OV, Z, C
Encoding: 1011 0001 0Bkk kkkk kkkk dddd
Description: Subtract the 10-bit unsigned literal operand from the contents of the
working register Wn, and store the result back in the working register
Wn. Register direct addressing must be used for Wn.
The ‘B’ bit selects byte or word operation.
The ‘k’ bits specify the literal operand.
The ‘d’ bits select the address of the working register.
Note 1: The extension .B in the instruction denotes a byte operation
rather than a word operation. You may use a .W extension to
denote a word operation, but it is not required.
2: For byte operations, the literal must be specified as an
unsigned value [0:255]. See Section 4.6 “Using 10-bit Lit-
eral Operands” for information on using 10-bit literal
operands in Byte mode.
Words: 1
Cycles: 1
Example 1:
SUB.B #0x23, W0 ; Sub. 0x23 from W0 (Byte mode)
; Store result to W0
Before
Instruction
After
Instruction
W0 7804 W0 78E1
SR 0000 SR 0008 (N = 1)
Example 2:
SUB #0x108, W4 ; Sub. 0x108 from W4 (Word mode)
; Store result to W4
Before
Instruction
After
Instruction
W4 6234 W4 612C
SR 0000 SR 0001 (C = 1)

- 1
- 2
…
- 404
- 405
- 406
- 407
- 408
…
- 501
- 502