4

In the 8086 architecture, the memory space is 1 MiB in size and divided into logical segments of up to 64 KiB each.

i.e. it has 20 address lines thus the following method is used:

That the data segment register is shifted left 4 bits then added to the offset register

My question is: How we do the shift operation although all the registers are only 16 bits

6
  • 1
    Not really a programming question - this is just CPU architecture (circa mid 1980s) - the "shift" is handled by the CPU hardware - you don't need to worry about it.
    – Paul R
    Commented Nov 17, 2010 at 11:36
  • well, it's a programming question, but the premise is wrong.
    – Alex Brown
    Commented Nov 17, 2010 at 11:38
  • @Paul: you are right, but I study the CPU hardware and I didn't see any 20 bit register
    – Mina Fouad
    Commented Nov 17, 2010 at 11:43
  • you don't need a 20 bit register - the memory interface logic handles the generation of a 20 bit physical address
    – Paul R
    Commented Nov 17, 2010 at 11:45
  • 1
    can I conclude that it's a memory interface issue
    – Mina Fouad
    Commented Nov 17, 2010 at 11:50

1 Answer 1

6

Address translation is done internally by a special unit without using the registers available to user code to store intermediate results - it just fetches 16-bit values and does the translation inside - it is not reflected anywhere where the user code could observe it.

4
  • OK, but I need a reference to verify the answer
    – Mina Fouad
    Commented Nov 17, 2010 at 11:44
  • 2
    @Mina Fouad: No explicit references I'm aware of, but it can be deduced. Registers available to the code are not altered during the translation, so obviously they are not used as intermediate storage for shifts.
    – sharptooth
    Commented Nov 17, 2010 at 11:47
  • @Mina if you did find the reference, please post it for completeness Commented Nov 17, 2010 at 12:37
  • @belisarius: I didn't find but, when I asked the subject's DR the same question, she answered the same as sharptooth.
    – Mina Fouad
    Commented Nov 19, 2010 at 9:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.