装配偏移量计算规则 [英] Assembly offset calculation rule

查看:176
本文介绍了装配偏移量计算规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以...偏移量计算的规则在我的课程书中指出:

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 

是哪个?为什么?

(我认为第一个应该也是有效的,因为bx可以包含一个像(1..F)这样的任意值,但是我倾向于相信我错了,并且必须有一个BX或BP)

(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个基址寄存器(bpbx)和1个索引寄存器(sidi).您不能同时拥有bp + bxsi + di.请参阅表2-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

但是,您的课程书是正确的,任何部分都是可选的,但至少需要一个,因此您不需要基数,索引或偏移量.这些都是有效的:[const][bx][si][bx + si][bp + di + const].完整列表在我上面链接的手册中.

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.

这篇关于装配偏移量计算规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆