Assembly Language: cbw

拥有回忆 提交于 2019-12-10 17:21:03

问题


I am unsure of what the cbw command actually does. I have a snippet of code:

mov  ax,0FF0h
cbw
idiv ah

How does the value of ax change after cbw?


回答1:


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.

This means that the two's-complement value of AX will be the same, but the binary representation will be different.

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)



来源:https://stackoverflow.com/questions/7961711/assembly-language-cbw

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!