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
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!
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
.
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:
DB 1,2,3 DB 3,2,1
+------+ +------+
0x00001234 | 0x01 | | 0x03 |
+------+ +------+
0x00001235 | 0x02 | | 0x02 |
+------+ +------+
0x00001236 | 0x03 | | 0x01 |
+------+ +------+
For example, check out this debug
session:
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
.
精彩评论