tags:

views:

54

answers:

3

physical address=16*selector+offset but i don't know why multiplying 16 by selector?

+2  A: 

64? Sure? Read e.g. wikipedia. Multiplying by 64 is like shifting left by 6 bits (wikipedia says it should be 4, i.e. *16), i.e. is like saying the selector represents the most significant 16 bits of a 22 bits address (wikipedia reports 20). This is real mode as decribed in wikipedia too (better than I can do).

ShinTakezou
+4  A: 

In order to be "programmer-compatible" with the Z80, yet still be able to use more than 64 kiB of memory, early Intel processors introduced memory segmentation. The 16-bit segment would be shifted left 4 bits (meaning multiplication by 16, and not 64 as your question claims) before being added to the 16-bit offset, resulting in a 20-bit address.

For programmers accustomed to the Z80, all that was required was to use the segments provided by the OS, and they would be able to use the given 64 kilobyte offset as they pleased. New programmers could do more sophisticated manipulation of the segments, allowing them to access 1 MiB of address space (the IBM PC cut it down to 640 kiB, but for their own reason).

Ignacio Vazquez-Abrams
your right 64 was a mistype
sia
Somehow I don't think they cared about being Z80 compatible, as the Z80 was their direct competition. The instructions weren't even 8080 compatible, although translation was relatively easy.
Mark Ransom
@Mark: Of course they cared. If they were moderately Z80-compatible then it'd another bullet point that they could add. One that could pull Z80 developers their way.
Ignacio Vazquez-Abrams
@Ignacio: The Z80 was a batch of odd extensions on the 8080, and I don't remember most of those extensions going into the 8086 and 8088. There was nothing that caught on that was particularly upwards compatible from the Z80.
David Thornley
@David: The memory addressing scheme. x86 programmers these days don't have to worry about descriptor tables in protected mode thanks to the operating system. Replace "x86" with "Z80", "descriptor tables" with "memory segments", and "protected mode" with "the 8086", and history repeats itself.
Ignacio Vazquez-Abrams
@Ignacio: The Z80 addressed memory much like the 8080. The difference was a pair of index registers, IX and IY, which were clumsy and slow attempts to allow indexing. I found them mostly useless, and that seemed to be the general consensus from what I read. The Z80 didn't have memory segments. In short, from a good deal of Z80 experience some decades ago, I have no idea what you're talking about.
David Thornley
@David: Exactly. The Z80 didn't have memory segments. And the 8086 could be treated as though it didn't have memory segments either, as long as you were willing to compromise.
Ignacio Vazquez-Abrams
@Ignacio: And the 8080 didn't have memory segments, either. I'm completely failing to see where the Z80 comes in here. The 8086 and 8088 were assembly-compatible with the 8080. The very first BASIC for the IBM PC was actually a touch slower than the equivalent on a fast 8085, since it was simply reassembled.
David Thornley
+1  A: 

i don't know why multiplying 64 by selector?

A 16-bit pointer can easily address 64 KB.

The CPU designers wanted to be able to address 1 MB.

So instead of using a single 16-bit pointer, they specified that a pointer would be implemented by two registers, i.e. segment-plus-offset, where 'segment' is a 16-bit register whose value is multiplied by 16 in order to address the 1 MB.

The value (16) comes from dividing the desired address range (1 MB) by the natural addressibility of the 16-bit register size (64 KB) ... i.e. 16 come from 1 MB / 64 KB.

ChrisW