Given the logical address, how to extract the page number?

I am studying Computer Systems. I have th following question and its answer:

Given the logical address 0xAEF9 (in hexadecimal) with a page size of 256 bytes, what is the page number?

Answer: 0xAE (I found this answer in the web, but I want to know how can I figure it out myself?

How can I figure out the page number for a given logical address?

Your logical address is made of 16 bits, that means you have a addressable space of $2^{16}$ bits. The page size is typically a power of 2, $2^n$, in this case $2^n = 256 \Rightarrow n = 8$.

The page number is calculated by substracting $n$ from the size of your logical address: $16 - 8 = 8$, so the first 8 bits of the address are your missing page number, that is 0xAE

Logical address includes both page number and the offset within the page.

Page size as mentioned is 256 = 28. It means that 8 bit address is necessary to address any word within the page. The least significant 8 bits are used for this purpose (as offset address)

The remaining bits (the most significant 8 bits) are used as page number.
So the fist 8 bits specify the page number. 0xAE in this case.

• duplicated answer maybe May 4 '13 at 23:45