0% found this document useful (0 votes)
35 views4 pages

Lecture2 Logical and Physical Addressing 2

The document discusses logical and physical addressing in the 8086 microprocessor, detailing how memory is organized into segments and how logical addresses are formed using segment and offset values. It explains the calculation of physical addresses from logical addresses and provides examples to illustrate the concepts. The document emphasizes the importance of understanding these addressing modes for effective programming and memory management.

Uploaded by

harithbashar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views4 pages

Lecture2 Logical and Physical Addressing 2

The document discusses logical and physical addressing in the 8086 microprocessor, detailing how memory is organized into segments and how logical addresses are formed using segment and offset values. It explains the calculation of physical addresses from logical addresses and provides examples to illustrate the concepts. The document emphasizes the importance of understanding these addressing modes for effective programming and memory management.

Uploaded by

harithbashar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Lecture 2: Logical and Physical Addressing

Logical Addressing
 8086Mp has a 1 MByte memory locations; each size of each location is 8-bits. In order to
reach any location in this memory, we need to know the logical address of that location.
 8086Mp memory is logically divided into segments. The size of each segment is 64 Kbyte.
 A programmer can reach the 8086Mp memory only by using logical addressing. Logical
Address is written as follows: (Segment : Offset)
 The segment part of the address is fixed for all the memory locations that are in this segment
(which is 1000 H in the below example), while the offset value changes from 0000 H to FFFF
H for each segment.
 Offset is like a pointer that points to a specific location inside the segment.
 The segment value can only be stored in one of the segment registers while the offset is stored
in one of the offset registers associated with that segment (go back to the segment-offset
combinations table given in the previous lecture).

ٙ‫ركٌٕ انؼُٕاٌ انًُطم‬ٚ .‫ح‬ٛ‫رؼايم يؼ ٓا اال يٍ خالل انؼَُٕح انًُطم‬ٚٔ ‫صم انٗ ا٘ يٕلغ يٍ انزاكشج‬ٚ ٌ‫ًكٍ نهًثشيج ا‬ٚ‫ال‬
‫ داخم ْزا‬ٙ‫ؤشش انٗ يٕلغ يذذد ف‬ٚ ٘‫ًح انًؤشش انز‬ٛ‫ذًم ل‬ٚ َٙ‫ ) ٔانثا‬Segment(‫ذًم ػُٕاٌ انـ‬ٚ ‫ االٔل‬,ًٍٛ‫يٍ لغ‬
‫ًح‬ٛ‫ذرٕ٘ ل‬ٚ ٘‫كٌٕ طٕل انغجم انز‬ٚ ٌ‫رطهة ا‬ٚ ‫ يٍ انًٕالغ ٔرنك‬64 Kbyte ٗ‫ذرٕ٘ ػه‬ٚ Segment ‫ كم‬.Segment‫انـ‬
.ً‫ الدما‬ٙ‫أذ‬ٛ‫) كًا ع‬CS, DS, ES, SS( ‫ ادذ انغجالخ االستؼح‬ٙ‫ ف‬segment‫ًح انـ‬ٛ‫رى خضٌ ل‬ٚ .16-bit ٘ٔ‫غا‬ٚ segment‫انـ‬
‫ًح‬ٛ‫ فارا كاَد ل‬.ُّ‫خش يٕلغ ي‬ٜ )FFFF H( ٗ‫ ان‬segment‫) الٔل يٕلغ يٍ انـ‬0000 H( ٍ‫ ذرشأح ي‬ٙٓ‫ًح انًؤشش ف‬ٛ‫أيا ل‬
ٌ‫) ٔانؼُٕا‬6A00 H : 0000 H( ْٕ segment ‫ الٔل يٕلغ يٍ انـ‬ٙ‫ فإٌ انؼُٕاٌ انًُطم‬6A00 H ً‫ ذغأ٘ يثال‬segment‫انـ‬
.)6A00 H : FFFF H( ْٕ segment ‫ الخش يٕلغ يٍ انـ‬ٙ‫انًُطم‬
ٙ‫ (الٌ انذجى انكه‬64 Kbyte ٌٕ‫ك‬ٚ ‫ انٕادذ‬segment ‫ فًؼُاِ اٌ دجى انـ‬16-bit ٘ٔ‫غا‬ٚ ّ‫( طٕن‬offset) ‫تًا أٌ انًؤشش‬
.)64Kbyte ٘ٔ‫غا‬ٚ ْٕٔ 61 ‫ نألط‬2 ْٕ ‫تد‬61 ‫ًكٍ ػَُٕرّ تاعرخذاو‬ٚ ٘‫انز‬
‫ح‬ٛ‫ٍ انًُطم‬ٚٔ‫ش انؼُا‬ٛ‫ ٔلذ ذى ذأش‬,)‫ٕظخ يمطؼا ً يٍ انزاكشج (انًذذد تانهٌٕ االصسق انفاذخ‬ٚ ٙ‫ انشعى انران‬ٙ‫انًثال انًؼطٗ ف‬
‫ داخم يٕلغ انزاكشج‬ٙ‫كرة ف‬ٚ ‫غاس أيا يا‬ٛ‫ٍ أٔ ان‬ًٛٛ‫ انٗ جاَة انزاكشج ػهٗ ان‬ٙ‫ائ‬ٚ‫ض‬ٛ‫ أ انف‬ٙ‫رى كراتح انؼُٕاٌ عٕا ًء انًُطم‬ٚ .ّٛ‫ػه‬
.8-bits ّ‫كٌٕ طٕن‬ٚٔ ً ‫ظ ػُٕاَا‬ٛ‫) ٔن‬data‫ؼرثش يذرٕٖ انًٕلغ (أ٘ انـ‬ٛ‫ف‬
ٙ‫ االعفم ٔاخش يٕلغ يُٓا ْٕ انًٕجٕد ف‬ٙ‫ ػُذ سعى انزاكشج َمٕو تاػرثاس أل يٕلغ يُٓا ْٕ انًٕجٕد ف‬: 1‫مالحظة‬
‫ ػهًا ً اٌ تؼط انًصادس‬.‫ انًذاظشج انغاتمح‬ٙ‫ انًؼطٗ ف‬6 ‫ سلى‬ٙ‫ انكراب انًُٓج‬ٙ‫مح انًغرخذيح ف‬ٚ‫ يغ انطش‬ٙ‫ ٔرنك نهًش‬.ٗ‫االػه‬
.‫ذغرخذو ػكظ رنك‬

ّ‫ؼشف‬ٚ ‫فرشض اٌ انطانة‬ٚ ٘‫ ٔانز‬,‫ح‬ٛ‫ائ‬ٚ‫ض‬ٛ‫ح ٔانف‬ٛ‫ٍ انًُطم‬ٚٔ‫ كرات ح انؼُا‬ٙ‫رى اعرخذاو انُظاو انغادط ػشش ف‬ٚ :2 ‫مالحظة‬
.‫ذ‬ٛ‫تشكم ج‬

ٗ‫رى انرطشق ان‬ٚ ٌ‫جادِ تؼذ ا‬ٚ‫ح ا‬ٛ‫ف‬ٛ‫فٓى ك‬ٛ‫ش نهزاكشج تشكم ػالياخ اعرفٓاو الٌ انطانة ع‬ٛ‫ ذى كراتح انًٕلغ االخ‬:3 ‫مالحظة‬
.‫ح‬ٛ‫ائ‬ٚ‫ض‬ٛ‫انؼَُٕح انف‬
8-bits
?H:?H

...
1000 H : FFFF H
...

1000 H : F000 H
64 Kbyte Segment
Logical Addresses

1000 H : 0000 H

0000 H : 0000 H

Physical Addressing (PA): (Some references call it: effective address (EA))

In order to access any location in the 1 Mbyte memory, the Mp must generate a 20-bit
memory address, which is called a Physical Address (PA). Physical address is calculated from
the logical address as follows:

Physical Address (PA) = Segment * 16 + offset

where multiplying the segment by 16 is simply achieved by shifting it to the left and adding a
zero to the lower digit.

1 ْٕ ٙ‫ٍ تد (الٌ دجى انزاكشج انكه‬ٚ‫ركٌٕ يٍ سلى طٕنّ ػشش‬ٚ ٘‫ ٔانز‬ٙ‫م‬ٛ‫ ْٕ انؼُٕاٌ انذم‬ٙ‫ائ‬ٚ‫ض‬ٛ‫انؼُٕاٌ انف‬
‫ ٔرنك تاظافح صفش‬,ٙ‫ انًطهٕب انرؼايم يؼّ يٍ خالل انؼُٕاٌ انًُطم‬ٙ‫ائ‬ٚ‫ض‬ٛ‫مٕو انًؼانج تذغاب انؼُٕاٌ انف‬ٚٔ .)MByte
ٕ٘‫ذر‬ٚ ‫ فانًفشٔض اٌ َذصم ػهٗ سلى‬.offset ‫ًح انًؤشش‬ٛ‫) ثى انجًغ يغ ل‬61 ٙ‫ؼادل ظشب ف‬ٚ ٘‫ (ٔانز‬segment‫انٗ انـ‬
‫) الٔل‬00000 H( ٍٛ‫ ت‬ٙ‫ائ‬ٚ‫ض‬ٛ‫ًح انؼُٕاٌ انف‬ٛ‫) ٔذرشأح ل‬1 hexa digit ‫ (الٌ كم استؼح تد ذًثم‬5 hexa digits ٗ‫ػه‬
.‫) الخش ػُٕاٌ يُٓا‬FFFFF H) ٗ‫ ان‬,‫ػُٕاٌ يٍ انزاكشج‬

Example: Find the PA of the next instruction, if CS =1000 H, DS =A000 H, ES = A80 H, IP


=2000 H.

Solution:
The logical address of the next location is stored in (CS: IP), so that DS and ES will not be
required to calculate the PA of the next instruction.

‫ َالدظ‬.)CS: IP( ٙ‫ انؼُٕاٌ انًُطم‬ٙ‫زِ ف‬ٛ‫مٕو ترُف‬ٛ‫ انز٘ ع‬ٙ‫ؼاص انران‬ٚ‫ز ا٘ تشَايج تخضٌ ػُٕاٌ اال‬ٛ‫مٕو انًؼانج ػُذ ذُف‬ٚ
.‫ يؼطاج نغشض انرأكذ يٍ فٓى انطانة نهًٕظٕع‬ْٙٔ ‫ انذم‬ٙ‫ش داخهح ف‬ٛ‫ انغؤال غ‬ٙ‫ى انغجالخ االخشٖ انًٕجٕدج ف‬ٛ‫أٌ ل‬

PA= 1 0 0 0 0
2000 +
12000H
Example: If a segment register value is (2100H), what are the starting and ending physical
addresses of this segment?

Solution:
- For the starting address, the offset value is (0000 H), so PA is:
PA= 2 1 0 0 0
0000 +
21000H
- For the ending address, the offset value is (FFFF H), so PA is:
PA= 2 1 0 0 0
FFFF +
30FFFH
Example: If SS =A022 H, DI =F019 H, BP =2E60 H, IP =1111 H, find the PA of the stack.
Solution:
The stack is addressed using the logical address (SS: BP) or (SS: SP). The value of SP is not
given in the question, so that BP is used, so PA is:

‫ َؼهى‬,‫ انًذاظشج انغاتمح‬ٙ‫ ٔيٍ خالل انشجٕع انٗ انجذٔل انًؼطٗ ف‬SS‫ انـ‬ٙ‫ يخضٌٔ ف‬stack ‫ انخاص تانـ‬segment ‫انـ‬
.BP ‫ انغؤال فُغرخذو‬ٙ‫ش يؼطاج ف‬ٛ‫ غ‬SP ‫ًح‬ٛ‫ ٔتًا اٌ ل‬.‫ فمط‬BP ٔ SP ْٙ ّ‫تاٌ انًؤششاخ انًغرخذيح يؼ‬

PA= A 0 2 2 0
2E60 +
A3080H

Example: Find a logical address that can take you to the location (255AF H) of the memory.
Solution: There are many logical addresses that lead to the given PA:
‫ذ‬ٚ‫ُا ً أ٘ أٌ ُْانك انؼذ‬ٛ‫غأ٘ سلًا ً يؼ‬ٚ ‫ٍ داصم جًؼًٓا‬ًٛ‫جاد سل‬ٚ‫ يشاتٓح ال‬ْٙ ٙ‫ائ‬ٚ‫ض‬ٛ‫ يٍ انف‬ٙ‫جاد انؼُٕاٌ انًُطم‬ٚ‫ح ا‬ٛ‫ػًه‬
‫ ٔجًؼّ يغ‬segment‫ يٍ خالل ٔظغ صفش انٗ ػُٕاٌ انـ‬ٙ‫ انؼُٕاٌ انًُطم‬ٙ‫ٍ ف‬ًٛ‫جة انرأكذ يٍ صذح انشل‬ٚ ٍ‫ ٔنك‬,‫يٍ انذهٕل‬
.ٗ‫ انًؼط‬ٙ‫ائ‬ٚ‫ض‬ٛ‫طاتك انؼُٕاٌ انف‬ٚ ٌ‫جة ا‬ٚ ٘‫ انز‬ٙ‫ائ‬ٚ‫ض‬ٛ‫ ف ُذصم ػُذْا ػهٗ انؼُٕاٌ انف‬offset‫انـ‬

255A H: 000F H
or
2000 H: 55AF H
or
2500 H: 05AF H
(and many other combinations)

More examples can be found in [Ref. 1, table 2-1]

Best Regards
Dr. Zainab Alomari

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy