![TENX TECHNOLOGY TM57PE10 User Manual Download Page 38](http://html.mh-extra.com/html/tenx-technology/tm57pe10/tm57pe10_user-manual_1087886038.webp)
Advance Information
UM-TM57PE10_E
8-Bit Microcontroller
38
tenx technology inc.
Preliminary
Rev 1.4, 2012/01/19
COMF
Complement "f"
Syntax
COMF f [,d]
Operands
f : 00h ~ 7Fh, d : 0, 1
Operation
(destination) ← (f
_
)
Status Affected
Z
OP-Code
00 1001 dfff ffff
Description
The contents of register 'f' are complemented. If 'd' is 0, the result is stored
in W. If 'd' is 1, the result is stored back in register 'f'.
Cycle
1
Example
COMF REG1, 0
B : REG1 = 0x13
A : REG1 = 0x13, W = 0xEC
DECF
Decrement "f"
Syntax
DECF f [,d]
Operands
f : 00h ~ 7Fh, d : 0, 1
Operation
(destination) ← (f) - 1
Status Affected
Z
OP-Code
00 0011 dfff ffff
Description
Decrement register 'f'. If 'd' is 0, the result is stored in the W register. If 'd'
is 1, the result is stored back in register 'f'.
Cycle
1
Example
DECF CNT, 1
B : CNT = 0x01, Z = 0
A : CNT = 0x00, Z = 1
DECFSZ
Decrement "f", Skip if 0
Syntax
DECFSZ f [,d]
Operands
f : 00h ~ 7Fh, d : 0, 1
Operation
(destination) ← (f) - 1, skip next instruction if result is 0
Status Affected
-
OP-Code
00 1011 dfff ffff
Description
The contents of register 'f' are decremented. If 'd' is 0, the result is placed
in the W register. If 'd' is 1, the result is placed back in register 'f'. If the
result is 1, the next instruction is executed. If the result is 0, then a NOP is
executed instead, making it a 2 cycle instruction.
Cycle
1 or 2
Example
LABEL1 DECFSZ CNT, 1
GOTO LOOP
CONTINUE
B : PC = LABEL1
A : CNT = CNT – 1
if CNT = 0, PC = CONTINUE
if CNT
≠ 0, PC = 1
GOTO
Unconditional Branch
Syntax
GOTO k
Operands
k : 000h ~ FFFh
Operation
PC.11~0 ← k
Status Affected
-
OP-Code
11 kkkk kkkk kkkk
Description
GOTO is an unconditional branch. The 12-bit immediate value is loaded
into PC bits <11:0>. GOTO is a two-cycle instruction.
Cycle
2
Example
LABEL1 GOTO SUB1
B : PC = LABEL1
A : PC = SUB1