How to Calculate a Memory Address

Techwalla may earn compensation through affiliate links in this story. Learn more about our affiliate and product review process here.
Image Credit: Siri Stafford/Digital Vision/Getty Images

A computer memory address is a hexadecimal or binary address that a computer uses when storing data. Whenever a piece of information is stored, the computer has to calculate where to store the data in memory based off of a segment and offset address from the hard drive. Calculating the memory address from these segment and offset addresses can be tricky and requires advanced computing and mathematical knowledge, but is crucial for a programmer to know how to do so.

Advertisement

Step 1

Take your 16-bit segment and offset addresses and break them into pairs. For example, if the two addresses you are dealing with are "0000:0100," you can translate them into 20-bit segment and offset addresses by breaking them in half at the colon so they become "0000" for the 20-bit segment address and "0100" for the 20-bit offset address.

Advertisement

Video of the Day

Step 2

Add the two 20-bit addresses together in binary form to get the hexadecimal address of the memory. For the "0000" and "0100" addresses, the addition result would be "00100" in hexadecimal. This address is the physical hexadecimal address of the memory.

Step 3

Convert the hexadecimal 20-bit physical address into binary format by breaking each of the hexadecimal digits into its own binary form. In the "00100" example, you break them down into "0000," "0000," "0001," "0000," and "0000" to get the string "0000 0000 0001 0000 0000" as the final binary memory address.

Advertisement

Video of the Day

Advertisement

Advertisement

references