Learn about the technologies behind the Internet with The TCP/IP Guide!|
NOTE: Using robot software to mass-download the site degrades the server and is prohibited. See here for more.
Find The PC Guide helpful? Please consider a donation to The PC Guide Tip Jar. Visa/MC/Paypal accepted.
|View over 750 of my fine art photos any time for free at DesktopScenes.com!|
Segment and Offset Memory Addressing
In order to understand some of the other logical concepts regarding memory, it's useful to understand how the PC refers to memory addresses. For convenience, it is easier to refer to a memory address using a standard or linear address. So for example we say that the IDE hard disk BIOS usually starts at memory location C8000h. This is in fact true. However, it is not how PC processors refer to memory locations.
In x86 CPUs, memory addresses are composed of two parts: the segment address and the offset. These two are added together to produce the "real" address of the memory location, by shifting the segment address one hex digit to the left (which is the same as multiplying it by 16, since memory addresses are expressed in hexadecimal notation) and then adding the segment offset to it. (Yes, this is strange and not intuitive unless you are a PC programmer, and maybe not even then.) The address itself is often referred to using the notation segment:offset.
Because of the peculiarity of this scheme, there are in fact many combinations of segments and offsets that can result in the same linear address. Let's take C8000h again. The standard way to refer to this address is C000:8000; to get to the linear address you take C000, shift it one digit to the left to get C0000, and then add 8000 to get C8000. However, C800:0000 results in the same linear address.
This is a confusing way to refer to memory locations which is why I don't use it except where necessary to demonstrate something. The particulars of addressing are normally only of importance to programmers. Interestingly, the segment:offset addressing scheme is a primary reason for the existence of the high memory area.
Next: Memory Layout Overview