I can calculate an address Segment:Offset as Segment * 0x10 + Offset. But how do I calculate the opposite?
E.g. how do I get from 0xF4170 to F400:0170 and from 0xACF04 to ABCD:1234?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You would be required to have either the base or the offset to start with, along with the linear address, as multiple
Segment:Offsetpairs can map to the same linear address.so if we have the segment
0xF400and the linear address0xF4170, we get the offset being0xF4170 - (0xF400 << 4)which is0x170.Doing this with only knowing the linear address doesn’t have a unique solution, so you have to choose a convention for splitting a 20-bit address into a 16-byte-aligned
segpart and a byte offset. One possible function is this:Segement = linear >> 4(top 16 bits)offset = linear & 0x0F(low 4 bits)You might choose a canonical form with 12:8 bits, leaving room for future expansion with wider linear addresses.