Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Problem with understanding offset register

Status
Not open for further replies.

Lord Loh.

Full Member level 4
Joined
Jun 19, 2004
Messages
196
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,296
Location
Texas
Activity points
1,951
Segment:Offset

In 16 bit machines that have 20 bit address bus, the memory is supposed to have been divided into several segments having offsets of 0 through 65535.

This is supposed to hvae been done to store 20 bit address into two 16 bit registers.

A book that I have says :

Writing TSRs Through C by Yashwant Kanitkar said:
...However in 16-bit registers the maximum value that can be stored is 65,535. Then how do we access the locations beyond the 65,535th byte? By using two registers (segment and offset) in conjunction. For this the total memory (1MB) is divided into a number of units each comprising of 65,536 locations. Each such a unit is called a segment. Each segment always begins at a loation number that is exactly divisible by 16. The segment register contains the address of where the segment begins wheras the offset register contains the offset of the data/code from where the segment begins. For example the number contained in the segment register is 2 and that in the offset register is 5, the address of the data/code will be (16*2)+5=37

The example makes me feel that each segment is of 16 bytes!!! Could the example probably be wrong ?

As per calculations. 20 bit address bus give a maximum addressable locations of 1MB. 16-bit address gives 64Kb.

Therfore there ought to be 16 segments each consisting of 64 Kb.

16 seg * 64Kb = 1024kb

What do I understand this as ?
 

Segment:Offset

In 8086 family processors, the 20-bit physical address equals segment * 16 + offset. The segment is really just a starting point. Yes there are many combinations of segment and offset that point to the same physical address. In later Intel processors, protected mode segments operate very differently.
 

Segment:Offset

What is the reference taken to set the segment? Or is it arbitrary?

Do I understand that the segment 0 starts from 00000h and segment 1 from 10000h and segment 2 from 20000h?

Thank you.
 

Segment:Offset

Start of segment 0 = segment * 16 + offset = 0 * 16 + 0 = 00000h.
Start of segment 1 = segment * 16 + offset = 1 * 16 + 0 = 00010h.
Start of segment 2 = segment * 16 + offset = 2 * 16 + 0 = 00020h.
...
Start of segment 65535 = segment * 16 + offset = 65535 * 16 + 0 = FFFF0h.

End of segment 0 = segment * 16 + offset = 0 * 16 + 65535 = 0FFFFh.
End of segment 1 = segment * 16 + offset = 1 * 16 + 65535 = 1000Fh.
End of segment 2 = segment * 16 + offset = 2 * 16 + 65535 = 1001Fh.
...
End of segment 65535 = segment * 16 + offset = 65535 * 16 + 65535 = 0FFEFh (remember only 20 bits).


Also search Google for more info. For example:
https://thestarman.pcministry.com/asm/debug/Segments.html
 

Segment:Offset

This makes it appeat that there might be as much as 0FFF segments...Have I percived it correctly?

Can there be incomplete segments? So a total of FFFF segments ?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top