DEC, DECSZ, DJNZ

 

DEC        fr        Decrement fr


Words:        1        Cycles:        1                Affects:        Z

 

Operation:        Fr is decremented. Z will be set to 1 if the result was 0, otherwise Z will be cleared to 0.

 

Coding:        DECF                fr,1

 

 

DECSZ        fr        Decrement fr and skip if zero


Words:        1        Cycles:        1 or 2 (skip)        Affects:        none

 

Operation:        Fr is decremented. The next instruction word will be skipped if the result was 0.

 

Coding:        DECFSZ        fr,1

 

Note:        Only one word is skipped by this instruction. To avoid strange results, make sure that any instruction following DECSZ is a single-word instruction.

 

 

DJNZ        fr,addr9        Decrement fr and jump if not zero


Words:        2        Cycles:        2 or 3 (jump)        Affects:        none

 

Operation:        Fr is decremented. If the result is not 0, a jump to addr9 is executed.

 

Coding:        DECFSZ        fr,1

       GOTO        addr9