如何通过给定地址范围来计算内存大小? [英] How to calculate size of memory by given a range of address?

查看:2221
本文介绍了如何通过给定地址范围来计算内存大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个练习,我无法解决它,
我有3个记忆范围:

 第一@最后@ 

范围1:FD00 0000到FDFF FFFF
<范围2:D000 0000至DFFF FFFF


<范围3:FA00 0000至FBFF FFFF


是:给每个范围的内存大小(兆字节)?

我知道的是我应该计算范围的大小=最后一个地址 - 第一个地址
,所以第一个范围的结果是:00FF FFFF。
这是正确的吗?那我该怎么办?我在互联网上搜索过,我没有找到一个例子



请帮助

解决方案

在范例1中的例子中,你是对的。这是以十六进制表示的内存大小,以字节表示。



您可以通过首先将00FF FFFF转换为十进制数,然后将该数将字节转换为兆字节。



要从字节转换为兆字节,请使用关系

  1 MB = 1兆字节= 1024 * 1 KB = 1,048,576字节。 

大量的在线十六进制到十进制转换器。内置于Windows的计算器也可以进行转换。



对于其他范围,您再次想要进行减法以确定范围的大小,然后应用例如

  FBFF FFFF 
-
FA00 0000
----- ----
01FF FFFF

通过这些步骤更好地掌握发生的事情,以下关系将允许您更快地回答这些问题:

  0010 0000 = 1,048,576 

$ b>

I have an exercice that I couldn't resolve it, I have 3 memory range :

      First @      Last @ 

range1: FD00 0000 to FDFF FFFF

range2 : D000 0000 to DFFF FFFF

range3 : FA00 0000 to FBFF FFFF

the question is :give the size of the memory for each range (Mega byte)?

what I know is that I should calculate size of the range = last address - first address so the result for the first range is : 00FF FFFF . Is this right? then what should I do? I have searched on the internet I didn't found an example

Please help

解决方案

In your example for Range 1, you are correct. That is the size of the memory, stated in hexidecimal, in bytes.

You may gain the most insight by first converting 00FF FFFF to a decimal number, then converting that number of bytes into megabytes.

To convert from bytes to megabytes use the relationship

1 MB = 1 Megabyte = 1024 * 1 KB = 1,048,576 bytes.

There are tons of online Hex to Decimal converters. The calculator built in to Windows can also do the conversion.

For the other ranges, you again want to do subtraction to determine the size of the range, and then apply the steps above, e.g.

 FBFF FFFF
-
 FA00 0000
 ---------
 01FF FFFF

Having gone through those steps to better grasp what is happening, the following relationship will allow you to answer such questions faster:

0010 0000 = 1,048,576

So 1MB is the same as 0010 0000 (sometimes called 0x100000).

这篇关于如何通过给定地址范围来计算内存大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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