The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: harsha on June 01, 2005, 11:33:45 AM

Title: Changing 20bit adress to 32bit
Post by: harsha on June 01, 2005, 11:33:45 AM
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??
Title: Re: Changing 20bit adress to 32bit
Post by: MichaelW on June 01, 2005, 11:45:53 AM
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.
Title: @MichelW
Post by: harsha on June 03, 2005, 03:36:35 PM
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?
Title: Re: Changing 20bit adress to 32bit
Post by: MichaelW on June 03, 2005, 06:05:12 PM
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.