PIC17C75X
DECF
Decrement f
[ label ] DECF f,d
0 ≤ f ≤ 255
DECFSZ
Syntax:
Decrement f, skip if 0
Syntax:
Operands:
[ label ] DECFSZ f,d
Operands:
0 ≤ f ≤ 255
d
[0,1]
d
[0,1]
Operation:
(f) – 1 → (dest)
Operation:
(f) – 1 → (dest);
skip if result = 0
Status Affected:
Encoding:
OV, C, DC, Z
Status Affected:
Encoding:
None
0000
011d
ffff
ffff
0001
011d
ffff
ffff
Decrement register 'f'. If 'd' is 0 the
result is stored in WREG. If 'd' is 1 the
result is stored back in register 'f'.
Description:
The contents of register 'f' are decre-
mented. If 'd' is 0 the result is placed in
WREG. If 'd' is 1 the result is placed
back in register 'f'.
Description:
Words:
Cycles:
1
1
If the result is 0, the next instruction,
which is already fetched, is discarded,
and an NOP is executed instead mak-
ing it a two-cycle instruction.
Q Cycle Activity:
Q1
Q2
Q3
Q4
Decode
Read
register 'f'
Process
Data
Write to
Words:
Cycles:
1
destination
1(2)
DECF
CNT,
1
Example:
Q Cycle Activity:
Q1
Before Instruction
Q2
Q3
Q4
CNT
Z
=
=
0x01
0
Decode
Read
register 'f'
Process
Data
Write to
destination
After Instruction
If skip:
Q1
CNT
=
0x00
1
Q2
Q3
Q4
Z
=
No
No
No
No
operation
operation
operation
operation
HERE
DECFSZ
GOTO
CNT, 1
LOOP
Example:
CONTINUE
Before Instruction
PC
=
Address (HERE)
After Instruction
CNT
If CNT
PC
If CNT
PC
=
=
=
≠
=
CNT - 1
0;
Address (CONTINUE)
0;
Address (HERE+1)
1997 Microchip Technology Inc.
DS30264A-page 197