    
- 帖子
- 3852
- 积分
- 13044
- 威望
- 16780
- 金钱
- 36761
- 在线时间
- 1139 小时
         
|
大家好,今天我们来学习下数据传送mov指令的延伸。。因为今天比较忙,也没有准备,就讲解下movzx指令吧 因为这为我们以后课程的寻址打下基础。。
前面我已经对mov指令进行讲解了。今天我们来进行mov指令的延伸。
movzx。movzx一般用于将较小值拷贝到较大值中。 这个指令是非常有用的,大家以后学程序设计的话,例如我们需要处理windows中的消息。例如WM_COMMADN消息。这个消息结构的wParam的高16位是通知码,而低16位则是命令id。有时候需要判断命令id的话,则需要将这个wparam的低16位扩展成32位的,并且其余位用0填充。这就用到了movzx。
movzx是将源操作数的内容拷贝到目的操作数,并将该值0扩展至16位或者32位。但是它只适用于无符号整数。 他大致下面的三种格式。
movzx 32位通用寄存器, 8位通用寄存器/内存单元
movzx 32位通用寄存器, 16位通用寄存器/内存单元
movzx 16位通用寄存器, 8位通用寄存器/内存单元
举个例子。例如
1. 此时eax=00304000h
此时执行 movzx eax, ax后 eax = 00004000h 。
2. 此时eax = 00003040h
此时执行 movzx eax, ah eax = 00000030h。
总结:
movzx其实就是将我们的源操作数取出来,然后置于目的操作数,目的操作数其余位用0填充。
好接下来留几个作业吧。
1.例如此时eax = 00506040h
执行movzx eax, ax 后 eax= ???
2.例如此时eax = 00300000h
执行 movzx, eax, al 后 eax=??
3.例如此时ebx = 00400050h , eax = 00403000h
执行movzx ebx, ax 后 ebx= ??
4.假设此时[00400000]内存单元的数据是58 62 30 44,
执行 movzx eax, byte ptr [00400000]后 eax = ??
|
|