Ever since I started with 8086 Assembly Language programming, I have been hammering my mind about these Segments and Segment registers. The problem I am facing is that I can't have a visual image of what segments are in my mind and therefore the concepts are not clear to me.
- Can anyone help me understand the concept relating it to a real world scenario? Also I have the following questions:
Question 1:
As far as I have understood, In 16-bit real mode with 20 address line enabled, we could divide the physical memory into 16 segments with 64KiB each. The first segment starts at 0x00000
. What will be the starting address of next segment. Will it be by adding 0x10000
(65536 = 64KiB)?
Question 2:
This question is a bit odd to ask here but still SO is my only option. Suppose if I am given with an Offset address of 0x6000
, How can I find the segment to which it belongs in order to address it.
Thanks
segment_reg << 4 + offset_reg
. As long as that gets you the address you want, it works. If you need to address location0x6000
, then the segment register you use could be0
and the offset register could be0x6000
since that's a 16-bit value. Or, the segment register could be0x600
and your offset can be0
. That works, too. – Franklin