# Vault 7: Projects

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

### Protego

# PIC24FJ64GA004 - Programmers Reference Manual

- 1
- 2
…
- 191
- 192
- 193
- 194
- 195
…
- 501
- 502

© 2005-2011 Microchip Technology Inc. DS70157F-page 193
Section 5. Instruction Descriptions
Instruction
Descriptions
5
CP
Compare Wb with lit8, Set Status Flags
Implemented in: PIC24F PIC24H PIC24E dsPIC30F dsPIC33F dsPIC33E
X X
Syntax: {label:} CP{.B} Wb, #lit8
Operands: Wb ∈ [W0 ... W15]
lit8 ∈ [ 0 ... 255]
Operation: (Wb) – lit8
Status Affected: DC, N, OV, Z, C
Encoding: 1110 0001 0www wBkk k11k kkkk
Description: Compute (Wb) – lit8, and update the STATUS register. This instruction is
equivalent to the SUB instruction, but the result of the subtraction is not
stored. Register direct addressing must be used for Wb.
The ‘w’ bits select the address of the Wb base register.
The ‘B’ bit selects byte or word operation (‘0’ for word, ‘1’ for byte).
The ‘k’ bits provide the literal operand, a five-bit integer number.
Note: 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.
Words: 1
Cycles: 1
Example 1:
CP.B W4, #0x12 ; Compare W4 with 0x12 (Byte mode)
Before
Instruction
After
Instruction
W4 7711 W4 7711
SR 0000 SR 0009 (N, C = 1)
Example 2:
CP W4, #0x12 ; Compare W4 with 0x12 (Word mode)
Before
Instruction
After
Instruction
W4 7713 W4 7713
SR 0000 SR 0001 (C = 1)

- 1
- 2
…
- 191
- 192
- 193
- 194
- 195
…
- 501
- 502