Exercises 2.8 Exercises
1.
Say you want to allocate an area in memory for storing any number in the range \(0\)—\(4,000,000,000\text{.}\) This memory area will start at location \(\hex{2fffeb96}\text{.}\) Give the addresses of each byte of memory that will be required.
Convert \(4,000,000,000\) to hexadecimal to determine how many bytes are required to store the largest number.
Four bytes are sufficient to store an unsigned integer up to \(4,294,967,295\) so we would need to allocate the memory bytes at \(\hex{2fffeb96}\text{,}\) \(\hex{2fffeb97}\text{,}\) \(\hex{2fffeb98}\text{,}\) and \(\hex{2fffeb99}\text{.}\)
2.
You need to allocate an area in memory for storing an array of 30 bytes. The first byte will have the value \(0\) stored in it, the second \(1\text{,}\) the third \(2\text{,}\) etc. This memory area will start at location \(\hex{00100e}\text{.}\) Show what this area of memory looks like.
\(\hex{00100e}\text{:}\) | \(\hex{00}\) |
\(\hex{00100f}\text{:}\) | \(\hex{01}\) |
\(\hex{001010}\text{:}\) | \(\hex{02}\) |
\(\hex{001011}\text{:}\) | \(\hex{03}\) |
\(\cdots\) | \(\cdots\) |
\(\hex{00102a}\text{:}\) | \(\hex{1c}\) |
\(\hex{00102b}\text{:}\) | \(\hex{1d}\) |
3.
We have shown how to write only the first sixteen addresses in hexadecimal in Figure 2.7.1. How would you write the address of the seventeenth byte (byte number sixteen) in hexadecimal?