Vault 7: Projects
This publication series is about specific projects related to the Vault 7 main publication.
© 2005-2011 Microchip Technology Inc. DS70157F-page 69
Section 4. Instruction Set Details
Instruction Set
Details
4
4.6 USING 10-BIT LITERAL OPERANDS
Several instructions that support Byte and Word mode have 10-bit operands. For byte
instructions, a 10-bit literal is too large to use. So when 10-bit literals are used in Byte mode, the
range of the operand must be reduced to 8 bits or the assembler will generate an error.
Table 4-7
shows that the range of a 10-bit literal is 0:1023 in Word mode and 0:255 in Byte mode.
Instructions which employ 10-bit literals in Byte and Word mode are: ADD, ADDC, AND, IOR,
RETLW, SUB, SUBB, and XOR. Example 4-12 shows how positive and negative literals are used in
Byte mode for the ADD instruction.
Table 4-7: 10-bit Literal Coding
Example 4-12: Using 10-bit Literals for Byte Operands
Literal Value
Word Mode
kk kkkk kkkk
Byte Mode
kkkk kkkk
0 00 0000 0000 0000 0000
1 00 0000 0001 0000 0001
2 00 0000 0010 0000 0010
127 00 0111 1111 0111 1111
128 00 1000 0000 1000 0000
255 00 1111 1111 1111 1111
256 01 0000 0000 N/A
512 10 0000 0000 N/A
1023 11 1111 1111 N/A
ADD.B #0x80, W0 ; add 128 (or -128) to W0
ADD.B #0x380, W0 ; ERROR... Illegal syntax for byte mode
ADD.B #0xFF, W0 ; add 255 (or -1) to W0
ADD.B #0x3FF, W0 ; ERROR... Illegal syntax for byte mode
ADD.B #0xF, W0 ; add 15 to W0
ADD.B #0x7F, W0 ; add 127 to W0
ADD.B #0x100, W0 ; ERROR... Illegal syntax for byte mode
Note: Using a literal value greater than 127 in Byte mode is functionally identical to using
the equivalent negative two’s complement value, since the Most Significant bit of the
byte is set. When operating in Byte mode, the Assembler will accept either a positive
or negative literal value (i.e., #-10).
Protego_Release_01_05-Related-OEM-Documentation-PIC24FJ64GA004-Programmers_Reference_Manual.pdf