Assembly offset calculation rule

人盡茶涼 提交于 2019-12-02 19:59:14

问题


So... the rule of offset calculation states in my course book that:

offset = [bp] + [bx] + [di|si] + CONST  (any part is optional, but atleast one is required)

But reading on the internet i found the rule as :

offset = [bp|bx] + [di|si] + CONST 

Which one is it? And why?

(In my opinion the first should be also valid since bx could contain an arbitrary value like (1..F), but i tend to belive I am wrong and there must be a BX or BP)


回答1:


The "internet rule" is correct. You can have 1 base register (bp or bx) and 1 index register (si or di). You can't have bp + bx or si + di at the same time. See Table 2-1. 16-Bit Addressing Forms with the ModR/M Byte in the Intel Instruction Set Reference

Your course book is however correct that any part is optional but at least one is required, so you don't need a base or an index or an offset. These are all valid: [const], [bx], [si], [bx + si], [bp + di + const]. The full list is in the manual I linked above.



来源:https://stackoverflow.com/questions/28561487/assembly-offset-calculation-rule

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