assemblyx86-16memory-segmentation

Calculating Base Address of a Segment (Intel 8086)


I know that, Physical Address = Segment Address x 10h + offset

Suppose, physical address of a memory location is 33330 H and the offset is 1111 H. To find the segment address, (33330 - 1111)/10 = 3221.

Now, if do the calculation for the physical address, 3221 x 10h + 1111 = 33321 which is not 33330.

Why is that so? Is my process correct?


Solution

  • Always need possible physical address.
    Segment physical address must be paragraph aligned: n%10h=0.

    Here, 33330h-1111h=32219h linear address

    but you have to take 32210h (possible physical address) or Logical Address= 3221:0009

    So, (33330h - 1111h)/10h = 3221h segment register value (segment base right shifted by 4).