当前页面为 开发中 版本,查看特定版本的文档,请在页面左下角的下拉菜单中进行选择。

and


and A, #K

指令格式

and A, #K

影响标志

Z

伪代码描述

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

指令描述

累加器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 : 0;

指令描述

累加器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 : 0;

指令描述

累加器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