Assembly offset calculation rule

前端 未结 1 644
遇见更好的自我
遇见更好的自我 2021-01-28 09:25

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)
<         


        
相关标签:
1条回答
  • 2021-01-28 09:52

    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.

    0 讨论(0)
提交回复
热议问题