|
I don’t mean to be disrespectful to you Dawei but the 8088 is a 16bit processor with a 20bit address bus but only has an 8bit data bus. The 8086 has the full 16 bit data bus, but at the time 16bit memory was expensive so intel created the 8088 for the IBM PC.
You are quite correct that to address into the full 20bit range you have to use segmented memory addressing.
If memory serves me correctly (please feel free to correct me if I am wrong), to use segmented addressing you have a segment and an offset address. Both are 16bit values. The segment specifies funnily enough specifies the segment in memory. Each segment is 16bytes long. So to get the real address where a segment address points to you multiply the segment address by 16.
The offset address lets you address into the segment specified. If you add the offset to the physical address gained from the segment you can address anywhere in memory. It is also true that you can address any byte in memory up to 2^16 (65536) bytes beyond the start of the segment.
So a simple calculation: - We specify the segment to be segment 20 with an offset of 15. What is the physical address of that? Well its (20 x 16) + 15 = 335. So the general formula is (segment x 16) + offset = physical address. Now there is a simple way to do this in assembly. All you do is shift the segment address to the left by 4 places (same as a multiply by 16) and then add the offset.
There is a special syntax for specifying a segmented address. The address is written with four hex digits separated with a colon. In my previous example the syntax would be 0014:000F (20 is 14 in hex and 15 is F). Thinking about it more it is obvious to see that there is sometimes more than one way to specify a physical address with this scheme. If an offset has a value less than 16 then it is considered normalised.
I don’t have much experience with segmented addressing from assembly but that is what I learned when I did it from C with some special functions. This is the scheme used on the 8088/86, I am not sure if it is the same for the 80286 when it is in protected mode.
|