Search code examples
memoryassemblyhardwarememory-addressprocessor

What is the 8-hex-digit address of the "last" byte for a PC with 32 MBytes of RAM


I'm reading a book about assembly; Jones and Bartlett Publishers Introduction to 80x86 Assembly

The author give exercises but no answers to it. Obviously before going further, I want to make sure that I fully understand the chapter concepts.

donc,

What is the 8-hex-digit address of the "last" byte for a PC with 32 MBytes of RAM

This is my solution:

1) convert to bits 32 MBytes = 268435456 bits

2) I subtract 8 bits to remove the last byte 268435448

3) conversion to hexadecimal FFFFFF8

So I got FFFFFF8

Does this look a good answer?


Solution

  • No. For assembly programming it's very helpful to be able to do simple power-of-2 calculations in your head. 1K is 2^10. So 1M is 2^20. So 32M is 2^25 (because 2^5 = 32). So the address of the last byte is 2^25-1 (because the first byte is at 0). This is 25 bits that are all 1's (because 2^n-1 is always n 1's). In hex, this is six F's (4 bits per F) plus an additional 1, so prepending a zero to get 8 hex digits, you have 01FFFFFF.