News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Changing 20bit adress to 32bit

Started by harsha, June 01, 2005, 11:33:45 AM

Previous topic - Next topic

harsha

Consider the following segment address 0xB0000 as this is a 20 bit address this  is stored in segment register(16bit) as 0xB000
and let the offset address be 0x8000 which will be in the offset register
and now  segment:offset address is
0xB000:0x8000
then when converting what will be the 20bit address??

MichaelW

The "absolute" address that corresponds to the segment:offset address B000h:8000h is B8000h. To do the conversion you shift the segment address left by 4 bits and add it to the offset address.
eschew obfuscation

harsha

The absolute address you gave is only 20bit But in programs like C we need to provide 32bit address for the compiler.How to convert it to 32 bit address?

MichaelW

The conversion I specified is for real mode. For normal real mode where you have 16-bit segment addresses and 16-bit offset addresses, you get 20-bit absolute addresses. You normally encounter 32-bit addresses only for protected mode. Under Windows you ignore the values in the segment registers and use 32-bit offset addresses.
eschew obfuscation