70
ImageCraft Assembly Language Guide, Document # 001-44475 Rev. *B
M8C Instruction Set
4.33
Subtract without Borrow
SUB
Computes the difference of the two operands. The first operand’s value is replaced by the computed
difference. If the difference is less than zero, the Carry Flag is set in the Flag register. If the differ-
ence is zero, the Zero Flag is set in the Flag register; otherwise, the Zero Flag is cleared.
Instructions
Operation
Opcode
Cycles Bytes
Mnemonic
Argument
SUB
A, expr
0x11
4
2
SUB
A, [expr]
0x12
6
2
SUB
A, [X+expr]
0x13
7
2
SUB
[expr], A
0x14
7
2
SUB
[X+expr], A
0x15
8
2
SUB
[expr], expr
0x16
9
3
SUB
[X+expr], expr
0x17
10
3
Conditional
Flags:
CF
ZF
Set if treating the numbers as unsigned, the difference < 0; cleared other-
wise.
Set if the result is zero; cleared otherwise.
Example 1:
mov
A, 0
;set accumulator to zero
or
F, 0x04
;set carry flag
sub
A, 12
;accumulator value is now 0xF4
Example 2:
mov
[0x39], 2
;initialize ram[0x39]=0x02
mov
[0x40], FFh
;initialize ram[0x40]=0xff
inc
[0x40]
;ram[0x40]=0x00, CF=1
sub
[0x39], 0
;ram[0x39]=0x02
A
A K
–
A
A ram k
–
A
A ram X k
+
–
ram k
ram k
A
–
ram X k
+
ram X k
+
A
–
ram k
1
ram k
1
k
2
–
ram X k
1
+
ram X k
1
+
k
2
–
Summary of Contents for PSoC DESIGNER ImageCraft M8C
Page 6: ...6 ImageCraft Assembly Language Guide Document 001 44475 Rev B Contents Feedback ...
Page 10: ...10 ImageCraft Assembly Language Guide Document 001 44475 Rev B Introduction Feedback ...
Page 24: ...24 ImageCraft Assembly Language Guide Document 001 44475 Rev B M8C Microprocessor Feedback ...
Page 95: ...ImageCraft Assembly Language Guide Document 001 44475 Rev B 95 Assembler Directives Feedback ...
Page 96: ...96 ImageCraft Assembly Language Guide Document 001 44475 Rev B Assembler Directives Feedback ...
Page 104: ...104 ImageCraft Assembly Language Guide Document 001 44475 Rev B Feedback ...
Page 108: ...108 ImageCraft Assembly Language Guide Document 001 44475 Rev B Index Feedback ...