Question

in 8086 microprocessor a 20 bit address is divided in 16bit+4bit address in which 4 bit binary is the segment address.when we convert a 4bit binary into hexadecimal it gets to 1bit hexadecimal.my question is when we encounter the problem of calculating the physical address from the logical, a 4bit hexadecimal segment address is given.why is it so? Also in the calculation of physical address we append 0 in lsb to find the base address of the segment and then we add the offset into it. what is the logic behind appending 0?

Was it helpful?

Solution

One segment is equal to one paragraph. One paragraph is equal to 16 decimal bytes or 10 hexadecimal bytes. So a segment value of 89AB with zero offset is equal to 89AB x 10 or 89AB0 (note: all addresses are in hexadecimal for this context).

For segment-offset to 20-bit absolute address conversion example, this is best represented like this:

89AB:F012  ->  89AB   ->  89AB0   (paragraph to byte ->  89AB x 10 = 89AB0)
                F012  ->  0F012   (offset is already in byte unit)
                          ----- +
                          98AC2   (the absolute address)

For absolute address to segment-offset conversion:

98AC2  ->  9 8AC2  ->  9     ->  9000  ->  9000:8AC2
           (split)     8AC2      8AC2

or...

98AC2  ->  98AC 2  ->  98AC  ->  98AC  ->  98AC:0002
           (split)        2      0002

or can be split at middle...

98AC2  ->  98 AC2  ->  98    ->  9800  ->  9800:0AC2
           (split)      AC2      0AC2

All above three segment-offset address including 89AB:F012 (the original address value) points to the same absolute address (same physical location).

OTHER TIPS

The value in any register considered to be a Segment register is multiplied by 16 (or shifted one hexadecimal byte to the left; add an extra 0 to the end of the hex number) and then the value in an Offset register is added to it. So, the Absolute address for any combination of Segment and Offset pairs is found by using the formula: Absolute
Memory
Location

= (Segment value * 16) + Offset value

After working through some examples, this will become much clearer to understand: The Absolute or Linear address for the Segment:Offset pair, F000:FFFD can be computed quite easily in your mind by simply inserting a zero at the end of the Segment value ( which is the same as multiplying by 16 ) and then adding the Offset value: F0000 + FFFD ------ FFFFD or 1,048,573(decimal)

Here's another example: 923F:E2FF ->

        923F0
       + E2FF
       ------
        A06EF   or   657,135(decimal)

Now let's compute the Absolute Memory location for the largest value that can be expressed using a Segment:Offset reference: FFFF0 + FFFF
------- 10FFEF or 1,114,095 (decimal) In reality, it wasn't until quite some time after the 8086, that such a large value actually corresponded to a real Memory location. Once it became common for PCs to have over 1MiB of memory, programmers developed ways to use it to their advantage and this last byte became part of what's now called the HMA (High Memory Area). But until that time, if a program tried to use a Segment:Offset pair that exceeded a 20-bit Absolute address (1MiB), the CPU would truncate the highest bit (an 8086/8088 CPU has only 20 address lines), effectively mapping any value over FFFFFh (1,048,575) to an address within the first Segment. Thus, 10FFEFh was mapped to FFEFh.

One of the downsides in using Segment:Offset pairs (and likely what confuses most of you) is the fact that a large number of these pairs refer to the same exact memory locations. For example, every Segment:Offset pair below, refers to exactly the same location in memory:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top