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

rev


rev R

指令格式

rev R

影响标志

伪代码描述

1
2
R = (R >> 4) & 0x0f
  | (R << 4) & 0xf0;

指令描述

寄存器R内容的高4位和低4位交换,结果存储到寄存器R中。

指令执行前:
       7    6    5    4    3    2    1    0
    +----+----+----+----+----+----+----+----+
R = | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 |
    +----+----+----+----+----+----+----+----+
指令执行后:
       7    6    5    4    3    2    1    0
    +----+----+----+----+----+----+----+----+
R = | b3 | b2 | b1 | b0 | b7 | b6 | b5 | b4 |
    +----+----+----+----+----+----+----+----+

范例

1
2
3
mov A, #0x34    //A = 0x34
mov R, A        //R = 0x34
rev R           //R = 0x43

rev A, R

指令格式

rev A, R

影响标志

伪代码描述

1
2
A = (R >> 4) & 0x0f
  | (R << 4) & 0xf0;

指令描述

寄存器R内容的高4位和低4位交换,结果存储到累加器A中。

指令执行前:
       7    6    5    4    3    2    1    0
    +----+----+----+----+----+----+----+----+
R = | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 |
    +----+----+----+----+----+----+----+----+
指令执行后:
       7    6    5    4    3    2    1    0
    +----+----+----+----+----+----+----+----+
A = | b3 | b2 | b1 | b0 | b7 | b6 | b5 | b4 |
    +----+----+----+----+----+----+----+----+

范例

1
2
3
mov A, #0xC5    //A = 0xC5
mov R, A        //R = 0xC5
rev A, R        //A = 0x5C