flat assembler
Message board for the users of flat assembler.

 Index > DOS > Memeory Segmentation
Author
Master0fAsm

Joined: 01 Sep 2007
Posts: 11
Location: Darlington, South Carolina [USA]
Master0fAsm 30 Sep 2007, 01:11
Hello. I'm doing DOS programming with the x86. I wish to fully understand how memory is segmented. I already understand that it operates under a segment:offset structure, but, there are still some things I don't understand. I know that segments overlap each other, but, I don't know how they do this. And, I know how to find the linear address (far pointer) by using the segment or offset:

Quote:
E.G., I have the segment 0122h. To find the offset, I multiply 0122h by 16: 18ech is the offset of 0122h. If I just had the offset, I would've just divided it by 16.

To find the linear address (far pointer), I first add a zero to the segment: 0122h => 01220h. Then, I add it with the offset: 01220h + 18ech = 2b0ch.
This is where I get confused at. Now that I have the linear address 2b0ch, what can I do with it (or, what to do with it)?

How do I convert 2b0ch back to the segment? And offset?

How do Segments overlap each other?

How can I implement this information with FASM ( cs:[bx], using far pointers in 16-bit DOS )?
30 Sep 2007, 01:11
Master0fAsm

Joined: 01 Sep 2007
Posts: 11
Location: Darlington, South Carolina [USA]
Master0fAsm 30 Sep 2007, 05:57
Never mind, I found this site that explains the theory of segmentation very well:

http://homepage.smc.edu/morgan_david/cs40/segmentation.htm
30 Sep 2007, 05:57
Picnic

Joined: 05 May 2007
Posts: 1308
Picnic 30 Sep 2007, 08:35
Hi Master0fAsm, here is another good link for segment:offset addressing.

http://www.geocities.com/thestarman3/asm/debug/Segments.html
30 Sep 2007, 08:35
eek

Joined: 21 Oct 2006
Posts: 24
eek 30 Sep 2007, 09:36
This will let you actually LOOK at the memory as you mess about, helping with that baby steps period.

http://www.btinternet.com/~btketman/
30 Sep 2007, 09:36
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum