原创 钥匙模型法理解右环移指令

2009-3-4 18:59 2582 4 4 分类: MCU/ 嵌入式

74ls164移位程序


REVERS: CLR C  ;进位清零
        RRC A          ;A带进位右环移1位,ACC.0右移至C
        MOV 07H,C;ACC.0移至20H.7
        RRC A           ;
        MOV 06H,C;ACC.1移至20H.6
        RRC A
        MOV 05H,C
        RRC A
        MOV 04H,C
        RRC A
        MOV 03H,C
        RRC A
        MOV 02H,C
        RRC A
        MOV 01H,C
        RRC A
        MOV 00H,C
        MOV A,20H;将20H位存储器中逆排序好的传送给A
        RET


                                              C----------------------------- 20H ------------  ---A


                                          /           \                          /                             \


                                        7 654321 0                    07 06 05 04 03 02 01 00


                                       从高到低右移              


                            取一串钥匙,最大的钥匙当作c,当依次将小钥匙向c右向移动时,再通过进位c移动到20h单元重新排序,最后排好序还给A

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
EE直播间
更多
我要评论
0
4
关闭 站长推荐上一条 /3 下一条