简体   繁体   English

将数据存储在内存中

[英]storage of data in memory

i want to know, how will the data be stored in memory ; 我想知道,如何将数据存储在内存中; or what will be the affect of the following code 或以下代码会产生什么影响

DATA1 DB 1,2,3 DATA1 DB 1,2,3

how does my data get stored.. if i am using a 80386 or above intel microprocessor.. i am a new with these stuff so kindly help! 我的数据如何存储..如果我使用的是80386或以上的英特尔微处理器..我是这些东西的新手,请帮忙!

Well, db defines a sequence of bytes so you'll get the three bytes 1, 2 and 3 in increasing memory locations, starting at data1 . 好吧, db定义了一个字节序列,因此您将从data1开始在递增的内存位置中获得三个字节1、2和3。

If data1 were at 0x00001234, the two statements db 1,2,3 and db 3,2,1 (that's one or the other, not one followed by the other) would give: 如果data1的值为0x00001234,则两个语句db 1,2,3db 3,2,1 (一个另一个,而不是紧随其后的另一个)将给出:

           DB 1,2,3          DB 3,2,1
           +------+          +------+
0x00001234 | 0x01 |          | 0x03 |
           +------+          +------+
0x00001235 | 0x02 |          | 0x02 |
           +------+          +------+
0x00001236 | 0x03 |          | 0x01 |
           +------+          +------+

For example, check out this debug session: 例如,签出以下debug会话:

c:\src> debug

-a 100
1388:0100 db 1,2,3,4
1388:0104 db 9,8,7,6
1388:0108

-d 100 10f
1388:0100  01 02 03 04 09 08 07 06-00 00 00 00 00 00 00 00   ................

-q

c:\src> _

You can see that the 1 , 2 , 3 and 4 (in that order) go into memory locations 0x0100 through 0x0103 and the 9 , 8 , 7 and 6 (again, in the specified order) go into memory locations 0x0104 through 0x0107 . 可以看到的是, 1234 (按该顺序)进入存储器位置0x0100通过0x01039876 (再次,按照指定的顺序)进入存储器位置0x0104通过0x0107

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM