ImageCraft Assembly Language Guide, Document # 001-44475 Rev. *B
39
M8C Instruction Set
4.2
Add without Carry
ADD
Computes the sum of the two operands. The first operand’s value is replaced by the computed sum.
If the sum is greater than 255, the Carry Flag is set in the Flag register. If the sum is zero, the Zero
Flag is set in the Flag register. The
ADD SP, expr
instruction does not affect the flags in any way.
Instructions
Operation
Opcode
Cycles Bytes
Mnemonic
Argument
ADD
A, expr
0x01
4
2
ADD
A, [expr]
0x02
6
2
ADD
A, [X+expr]
0x03
7
2
ADD
[expr], A
0x04
7
2
ADD
[X+expr], A
0x05
8
2
ADD
[expr], expr
0x06
9
3
ADD
[X+expr], expr
0x07
10
3
ADD
SP, expr
0x38
5
2
Conditional
Flags:
CF
ZF
Set if the sum > 255; cleared otherwise.
ADD SP, expr
does not affect the Carry Flag.
Set if the result is zero; cleared otherwise.
ADD SP, expr
does not affect the Zero Flag.
Example 1:
mov
A, 10
;initialize A to 10 (decimal)
add
A, 240
;result is A=250 (decimal)
add
A, 6
;result is A=0, CF=1, ZF=1
Example 2:
mov
A, 10
;initialize A to 10 (decimal)
add
A, 240
;result is A=250 (decimal)
add
A, 7
;result is A=1, CF=1, ZF=0
add
A, 5
;result is A=6, CF=0, ZF=0
Example 3:
mov
A, 10
;initialize A to 10 (decimal)
swap A, SP
;put 10 in SP
add
SP, 240
;result is SP=250 (decimal)
add
SP, 6
;SP=0, CF=unchanged, ZF=unchanged
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
+
SP
SP k
+
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 ...