flat assembler
Message board for the users of flat assembler.

Index > DOS > Memeory Segmentation

Author
Thread Post new topic Reply to topic
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 )?
Post 30 Sep 2007, 01:11
View user's profile Send private message Yahoo Messenger Reply with quote
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
Post 30 Sep 2007, 05:57
View user's profile Send private message Yahoo Messenger Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1389
Location: Piraeus, Greece
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

_________________
Hobby BASIC Interpreter
Post 30 Sep 2007, 08:35
View user's profile Send private message Visit poster's website Reply with quote
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/
Post 30 Sep 2007, 09:36
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.