Section
01 Part 02 – Memory Storage |
“If it draws blood, it's hardware.” ~Author Unknown |
Introduction
By
now, you should have a basic understanding of memory and different sizes, in this
part, we look at “where” this memory is located and
“how” it’s stored.
Accessing
Data Using the “Offset”
Computers
have a very specific way of accessing/storing memory, and it is done through
“addressing”:
Offset |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
A |
B |
C |
D |
E |
F |
00000000 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00000010 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00000020 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00000030 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
etc |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This table
above is an example of how memory is stored, the white “bytes” you see in the
table, is the “data” (i.e. your memory).
The purple digits at the top and left side are the “Offset”.
A computer
will use the offset as an “address”, to locate a byte in memory that it wants
to read, or even change. For example, in
the table below, you’ll notice that all bytes in memory are “00”, except for
one:
Offset |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
A |
B |
C |
D |
E |
F |
00000000 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00000010 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00000020 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
F2 |
00 |
00 |
00 |
00 |
00000030 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
etc |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You’ll
notice on column B row 00000020, the byte there is F2, if a computer wanted to
access that byte, it would go to offset 0000002B, it couldn’t be simpler.
I’ll
show you a few examples by highlighting the bytes when a computer accesses
them. Below is another example of
accessing a “byte”, but this time at offset 00000013:
Offset |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
A |
B |
C |
D |
E |
F |
00000000 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00000010 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00000020 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
F2 |
00 |
00 |
00 |
00 |
00000030 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
etc |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
As
you can see, the byte on column 3
row 00000010 is highlighted.
Now
we’ll write the “word” 20 4F at offset 0000000A:
Offset |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
A |
B |
C |
D |
E |
F |
00000000 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
20 |
4F |
00 |
00 |
00 |
00 |
00000010 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00000020 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
F2 |
00 |
00 |
00 |
00 |
00000030 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
etc |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
As
you can see, the word 20 4F has been split up, 20
has been put at 0000000A, and 4F has been put at 0000000B.
Now
let’s read the “long-word” from offset 00000034:
Offset |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
A |
B |
C |
D |
E |
F |
00000000 |
00 |
AC |
5E |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00000010 |
00 |
00 |
00 |
00 |
07 |
77 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00000020 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
47 |
00 |
00 |
00 |
00 |
00 |
00000030 |
00 |
00 |
11 |
20 |
F3 |
44 |
F5 |
39 |
C2 |
00 |
00 |
00 |
00 |
00 |
00 |
00 |
etc |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
As
you see above, the bytes F3,
44, F5 and 39, are highlighted, the
long-word is F3
44 F5 39. So not only has it read the byte at 00000034, it has also read the bytes
at 00000035, 00000036 and 00000037, and put them all together to
make a long-word.
We’ll
be coming back to memory more in depth later on, but hopefully this gives you
the basic idea.