以十六进制字节计算大小 [英] Calculate size in Hex Bytes

查看:182
本文介绍了以十六进制字节计算大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

计算代码段的十六进制字节大小的正确方法是什么?我得到:

pre code> IP = 0848 CS = 1488 DS = 1808 SS = 1C80 ES = 1F88

我正在研究的练习题要求代码段的大小(以十六进制字节为单位),并给出以下选择: p>

  A。 3800 B. 1488 C. 0830 D. 0380 E.以上都不是

正确答案是A 。3800,但我不知道该如何计算。

解决方案

如何计算长度: p>


  • 注意CS。找到离它最近的段落寄存器,但更大。

  • 取两者之间的差值,并乘以0x10(读取:0上的粘性)。


在您的示例中,DS最接近。 1808 - 1488 == 380.和380 x 10 = 3800。

顺便说一下,这只适用于8086和其他类似骨头的CPU,并且在x86上处于实模式。在x86上的保护模式下(也就是说,除非你正在编写引导扇区或简单的DOS程序),段寄存器的值与段的大小无关,因此上面的内容只是简单的不适用。


what is the proper way to calculate the size in hex bytes of a code segment. I am given:

IP = 0848    CS = 1488    DS = 1808   SS = 1C80    ES = 1F88

The practice exercise I am working on asks what is the size (in hex bytes) of the code segment and gives these choices:

A. 3800    B. 1488    C. 0830    D. 0380    E. none of the above

The correct answer is A. 3800, but I haven't a clue as to how to calculate this.

解决方案

How to calculate the length:

  • Note CS. Find the segment register that's nearest to it, but greater.
  • Take the difference between the two, and multiply by 0x10 (read: tack on a 0).

In your example, DS is closest. 1808 - 1488 == 380. And 380 x 10 = 3800.

BTW, this only works on the 8086 and other, similarly boneheaded CPUs, and in real mode on x86. In protected mode on x86 (which is to say, unless you're writing a boot sector or a simple DOS program), the value of the segment register has very little to do with the size of the segment, and thus the stuff above simply doesn't apply.

这篇关于以十六进制字节计算大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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