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

and


and A, #K

指令格式

and A, #K

影响标志

Z

伪指令

1
2
A = A & K
Z = A ? 0 : 1

指令描述

累加器A和立即数K进行相与,结果存储到累加器A;

范例

1
2
3
4
//0xDB & 0x20
//C = 0, AC = 0, Z = 0, OV = 0
mov     A, #0x20    //A = 0x20
and     A, #0xDB    //A = 0x00, C = 0, AC = 0, Z = 1, OV = 0

and A, R

指令格式

and A, R

影响标志

Z

伪指令

1
2
A = A & R
Z = A ? 0 : 1

指令描述

累加器A和寄存器R进行相与,结果存储到累加器A;

范例

1
2
3
4
5
6
//0x79 & 0xC4
//C = 0, AC = 0, Z = 0, OV = 0
mov     A, #0xC4    //A = 0xC4
mov     0xA0, A     //[0xA0] = 0xC4
mov     A, #0x79    //A = 0x79
and     A, 0xA0     //A = 0x40, C = 0, AC = 0, Z = 0, OV = 1

and R, A

指令格式

and R, A

影响标志

Z

伪指令

1
2
R = A & R
Z = R ? 0 : 1

指令描述

累加器A和寄存器R进行相与,结果存储到寄存器R;

范例

1
2
3
4
5
6
//0x83 & 0x78
//C = 0, AC = 0, Z = 0, OV = 0
mov     A, #0x78    //A = 0x78
mov     0xA1, A     //[0xA1] = 0x78
mov     A, #0x83    //A = 0x83
and     0xA1, A     //[0xA1] = 0x00, C = 0, AC = 0, Z = 1, OV = 0