Instruction set
COMF | Complement f |
Form |
[label] COMF f, d
( label is omitable, shows SPACE code ) |
Operands |
f : Register file addesss ( 00(00h) to 127(7Fh) )
d : Destination select ( 0 or 1 ) |
Operation |
It executes the complementary operation of the contents of the f register.(Not 2's Complement)
d = 0 : store result in W
d = 1 : store result in f
(EX)  |  |
Flag |
When the result is 0, it sets 1 to the Z flag.
When the result is not 0, it sets 0 to the Z flag. |
Instruction
cycles | 1 cycle |
DECF | Decrement f |
Form |
[label] DECF f, d
( label is omitable, shows SPACE code ) |
Operands |
f : Register file addesss ( 00(00h) to 127(7Fh) )
d : Destination select ( 0 or 1 ) |
Operation |
It subtracts 1 from the contents of the f register.
d = 0 : store result in W
d = 1 : store result in f
(EX)  |  |
Flag |
When the result is 0, it sets 1 to the Z flag.
When the result is not 0, it sets 0 to the Z flag. |
Instruction
cycles | 1 cycle |
DECFSZ | Decrement f, Skip if 0 |
Form |
[label] DECFSZ f, d
( label is omitable, shows SPACE code ) |
Operands |
f : Register file addesss ( 00(00h) to 127(7Fh) )
d : Destination select ( 0 or 1 ) |
Operation |
It subtracts 1 from the contents of the f register.
d = 0 : store result in W
d = 1 : store result in f
In case of the result of the subtraction is 0, it changes the following instruction into the NOP and executes it. (It executes the instruction of the present address +2.) |  |
Flag | No change |
Instruction
cycles |
1 cycle
When skipping, it is 2 cycles. |
GOTO | Go to address |
Form |
[label] GOTO k
( label is omitable, shows SPACE code ) |
Operands | k : literal field ( 000(000h) to 2047(7FFh) ) |
Operation |
It jumps unconditionally to the address which the literal field shows.
It sets the literal value to 11 bits of lower part of program counter (PC) and it sets the bit 3 and 4 of the PCLATH register to 2 bits of higher part. |  |
Flag | No change |
Instruction
cycles | 2 cycles |
Next instructions
 |