本文介绍了汇编语言:cbw的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不确定cbw
命令的实际作用.我有一段代码:
I am unsure of what the cbw
command actually does. I have a snippet of code:
mov ax,0FF0h
cbw
idiv ah
cbw之后ax的值如何变化?
How does the value of ax change after cbw?
推荐答案
cbw
指令将一个字节扩展为一个单词.在这种情况下,它将使用AL
的符号位(恰好是1)并将其复制到AH
的每一位.
The cbw
instruction sign-extends a byte into a word. In this case, it'll take the sign bit of AL
(which happens to be 1) and copy it into every bit of AH
.
这意味着AX
的二进制补码值将相同,但是二进制表示形式将不同.
This means that the two's-complement value of AX
will be the same, but the binary representation will be different.
cbw
指令后的AX
值将为FFF0h
(16位-16值,就像AL
最初是8位-16一样)
The value of AX
after the cbw
instruction will be FFF0h
(a 16-bit -16 value, just like AL
was originally an 8-bit -16)
这篇关于汇编语言:cbw的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!