The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: ninjarider on September 02, 2005, 05:58:33 PM

Title: segmented registers es: bx
Post by: ninjarider on September 02, 2005, 05:58:33 PM
es = fah
bx = 0fh

es: bx = ?????
im not sure if im correct but, wouldn't it be 0fafh
Title: Re: segmented registers es: bx
Post by: PBrennick on September 02, 2005, 06:18:25 PM
ninjarider

es:bx is a pointer to a memory address in segment 00fah at offset ofh, and not a pointer to segment 0fa00h at offset 0fh which it looks like you are trying to say, it is 0fa:0fh

hth,
Paul
Title: Re: segmented registers es: bx
Post by: MichaelW on September 02, 2005, 07:05:13 PM
ninjarider,

For real mode the corresponding physical address would be 0FAFh, but it would be somewhat unusual for a real-mode DOS program to use an address in this range because it would fall somewhere in the memory occupied by the OS. For protected mode the segment registers contain selectors rather than segment addresses, and selector values cannot be used directly in physical address calculations.

Title: Re: segmented registers es: bx
Post by: PBrennick on September 02, 2005, 08:06:37 PM
Michael,
I do not think you are correct.  That breaks down to 0f and af which is not what is contained in the registers.  It should be 0faofh.

Paul
Title: Re: segmented registers es: bx
Post by: P1 on September 02, 2005, 08:47:35 PM
segment is understand as fa = fa00, so es:bx translate to fa0f in this case.

This is from the 8088, 16 pages of 65536 bytes of addressable memory.

I must be getting old.   :(

Regards,  P1  :8)
Title: Re: segmented registers es: bx
Post by: PBrennick on September 02, 2005, 09:57:10 PM
P1,
Thank you for confirming that.  I was petty sure that was correct.

I guess we are all getting old.  :bdg

Paul
Title: Re: segmented registers es: bx
Post by: tenkey on September 02, 2005, 10:19:21 PM
You're getting old. Michael is correct. Start of segment 00FA is physical address 00FA0 (20-bits!)

So 00FA:000F = 00FAF.
Title: Re: segmented registers es: bx
Post by: PBrennick on September 03, 2005, 07:36:05 AM
Since there is more than one Michael here and they are making dissimilar claims, saying Michael is right is pretty funny.  :lol

Paul
Title: Re: segmented registers es: bx
Post by: Gustav on September 03, 2005, 02:37:34 PM

> P1,
> Thank you for confirming that.  I was petty sure that was correct.

You both were wrong. Possibly you should consider to make some real-mode code again, just for fun :).
I'm pretty sure you will learn a lot.


Title: Re: segmented registers es: bx
Post by: tenkey on September 04, 2005, 12:20:07 AM
Quote from: PBrennick on September 03, 2005, 07:36:05 AMSince there is more than one Michael here and they are making dissimilar claims, saying Michael is right is pretty funny.  :lol
What's odd about the remark is that I see only one Michael, MichaelW, being addressed as Michael in this thread. Did the other one opt out? Or is the other Michael, P1?

This thread should be in the 16-bit DOS forum.
Title: Re: segmented registers es: bx
Post by: ninjarider on September 06, 2005, 01:50:40 PM
thnx. i was reading the intel architecture and it didn't have anything about how to calculate the actual physical address.
Title: Re: segmented registers es: bx
Post by: P1 on September 06, 2005, 01:53:48 PM
I was wrong.

I confused the A000:0000 style of the 20 bit address.  So I shifted wrong in my head.

My apologies to those who were correct.

From:http://www.cpu-world.com/Arch/8088.html
Physical memory address pointed by segment:offset pair is calculated as:
address = (<segment> * 16) + <offset>

Regards,  P1  :8)