当前文档版本为 v0.2.0,您可以访问当前页面的 开发中 版本以获取最近可能的更新。

addc


addc A, R

指令格式

addc A, R

影响标志

C AC Z OV

伪指令

1
2
3
4
5
6
7
8
9
bit T, H
bit[4] L4
bit[3] H3
{AC, L4} = A[3:0] + R[3:0] + C
{T, H3} = A[6:4] + R[6:4] + AC
{C, H} = A[7] + R[7] + T
OV = C ^ T
A = {H, H3, L4}
Z = A ? 0 : 1

指令描述

累加器A和寄存器R带进位加法,结果存储到累加器A;

范例

1
2
3
4
5
6
//0xA8 + 0x69
//C = 0, AC = 0, Z = 0, OV = 0
mov     A, #0x69    //A = 0x69
mov     0x90, A     //[0x90] = 0x69
mov     A, #0xA8    //A = 0xA8
addc    A, 0x90     //A = 0x11, C = 1, AC = 1, Z = 0, OV = 0

addc R, A

指令格式

addc R, A

影响标志

C AC Z OV

伪指令

1
2
3
4
5
6
7
8
9
bit T, H
bit[4] L4
bit[3] H3
{AC, L4} = A[3:0] + R[3:0] + C
{T, H3} = A[6:4] + R[6:4] + AC
{C, H} = A[7] + R[7] + T
OV = C ^ T
R = {H, H3, L4}
Z = R ? 0 : 1

指令描述

寄存器R和累加器A带进位加法,结果存储到寄存器R;

范例

1
2
3
4
5
//0x80 + 0x80
//C = 0, AC = 0, Z = 0, OV = 0
mov     A, #80      //A = 0x80
mov     0x91, A     //[0x91] = 0x80
addc    0x91, A     //[0x91] = 0x00, C = 1, AC = 0, Z = 1, OV = 1