>On 2002-02-12 21:08:50, Anonymous wrote:
>>>It's a weird system, for sure.
>>>You know that, for example, between 0xA000
>>>and 0xB000 there is 64k (65536d), right?
>>
>>Yes, 64k is the segment size in real mode.
>
>Yes! Each segment is 64k _LONG_... _BUT_, they
>exist every 16 bytes! In other words, every 16
>bytes a new segment begins.
Okay now I understand why I write to the 0xA000
segment. A part of it overlaps with the 0xA001
segment and with every other segment up to 0xAFFF,
then I would have to use different offsets.
>
>>But 0xB000 - 0xA000 = 0x1000
>
>Right, which means 0x1000 segments!!! Not 0x1000
>bytes!
>
>>which is not 65536,
>>but 4096, and if I append another 0 it comes out
>>expected, right?
>
>Well, yeah... add another zero in hex, and you're
>actually multiplying by 16 (ie, each segment spans
>16 bytes, as I said).
Okay, then the segment number * 16 is the effective
address I am using?
>
>>>In other words, using the segment 0xA000, and a
>>>16 bit offset, you can access all memory up to
>>>(but not including) 0xB000.
>>
>>Yes, that is how the stupid (okay "old") real mode
>>addressing works ...
>
>Uhm... pmode is segmented as well. Only difference
>is, you decide on the frequency, and size of a
>segment.
Yes, of course! I meant flat mode here, I don't want
to use segments in my OS.
>
>>>Now, of course, that means 64k is divided up into
>>>0x1000 segments, so, for each individual
>>>segment, we have 65536d/0x1000 = 16d bytes.
>>>
>>A segment is divided into smaller pieces? This is
>>something I didn't know.
>
>No, that's not what I mean... that was a really
>bad (and now that I read it, not entirely accurate)
>way to reinforce the fact that real mode segments
>have a frequency of 16 bytes.
>
>>Okay, I can access the same memory with differnt
>>segment-offset combinations, now I know why the
>>the segment index is not in the form 0x0-0xF
>>(which would make sense for real mode, 16*64KB
>> would 1 MB, hmm, perhaps we would lose some memory
>> to the BIOS-ROM & devices ...).
>
>!?
I meant for 1 MB of memory divided in 64 kb segments,
they could have used 16 segments which would be enough,
then we would have to calcuate the effective address as
segnum * 65536 + offset. I think this would have been
even easier for programs when memory is contained in more
than one segment. But Intel didn't do it this way ...
>
>>What you explained here was for real-mode, right?
>
>Well, yeah, but if you can't understand real
>mode segmentation, you can't convert real mode
>segment/offset combo's into pmode (let alone
>write a pmode kernel!)
>
>Jeff