Question

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?

Was it helpful?

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.

OTHER TIPS

There are two things you should think about:

For most computers (all PCs) adresses are given in bytes, not in bits.

Therefore you must calculate: 32 MByte = 33554432 Bytes, minus 1 byte = 01FFFFFF (hex) as "Gene" wrote in his answer.

In reality (if you are interested in) you must also think about the fact that there is a "gap" in the address area (from 000A0000 to 000FFFFF) of real PCs so either not all the RAM is useable or the last address of the RAM comes later. This area is used for the graphics card and the BIOS ROM.

I thinking is : 00007FFF because: 32MB = 32*1024 = 32768 byte last have address 32767 (7FFF)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top