Ãëàâíàÿ » Êàòàëîã    
ðåôåðàòû Ðàçäåëû ðåôåðàòû
ðåôåðàòû
ðåôåðàòûÃëàâíàÿ

ðåôåðàòûÁèîëîãèÿ

ðåôåðàòûÁóõãàëòåðñêèé ó÷åò è àóäèò

ðåôåðàòûÂîåííàÿ êàôåäðà

ðåôåðàòûÃåîãðàôèÿ

ðåôåðàòûÃåîëîãèÿ

ðåôåðàòûÃðàôîëîãèÿ

ðåôåðàòûÄåíüãè è êðåäèò

ðåôåðàòûÅñòåñòâîçíàíèå

ðåôåðàòûÇîîëîãèÿ

ðåôåðàòûÈíâåñòèöèè

ðåôåðàòûÈíîñòðàííûå ÿçûêè

ðåôåðàòûÈñêóññòâî

ðåôåðàòûÈñòîðèÿ

ðåôåðàòûÊàðòîãðàôèÿ

ðåôåðàòûÊîìïüþòåðíûå ñåòè

ðåôåðàòûÊîìïüþòåðû ÝÂÌ

ðåôåðàòûÊîñìåòîëîãèÿ

ðåôåðàòûÊóëüòóðîëîãèÿ

ðåôåðàòûËèòåðàòóðà

ðåôåðàòûÌàðêåòèíã

ðåôåðàòûÌàòåìàòèêà

ðåôåðàòûÌàøèíîñòðîåíèå

ðåôåðàòûÌåäèöèíà

ðåôåðàòûÌåíåäæìåíò

ðåôåðàòûÌóçûêà

ðåôåðàòûÍàóêà è òåõíèêà

ðåôåðàòûÏåäàãîãèêà

ðåôåðàòûÏðàâî

ðåôåðàòûÏðîìûøëåííîñòü ïðîèçâîäñòâî

ðåôåðàòûÐàäèîýëåêòðîíèêà

ðåôåðàòûÐåêëàìà

ðåôåðàòûÐåôåðàòû ïî ãåîëîãèè

ðåôåðàòûÌåäèöèíñêèå íàóêàì

ðåôåðàòûÓïðàâëåíèå

ðåôåðàòûÔèçèêà

ðåôåðàòûÔèëîñîôèÿ

ðåôåðàòûÔèíàíñû

ðåôåðàòûÔîòîãðàôèÿ

ðåôåðàòûÕèìèÿ

ðåôåðàòûÝêîíîìèêà

ðåôåðàòû
ðåôåðàòû Èíôîðìàöèÿ ðåôåðàòû
ðåôåðàòû
ðåôåðàòû

Ñèñòåìû àäðåñàöèè â Ìèíè è Ìèê îÝÂÌ


ÌÎÑÊÎÂÑÊÈÉ
ÎÐÄÅÍÀ
ÒÐÓÄÎÂÎÃÎ
ÊÐÀÑÍÎÃÎ ÇÍÀÌÅÍÈ
ÝÊÎÍÎÌÈÊÎ-ÑÒÀÒÈÑÒÈ×ÅÑÊÈÉ
ÈÍÑÒÈÒÓÒ
ÊÀÔÅÄÐÀ
ÂÛ×ÈÑËÈÒÅËÜÍÛÕ
ÌÀØÈÍ
ÊÓÐÑÎÂÀß
ÐÀÁÎÒÀ
íà
òåìó:
Ñðàâíèòåëüíûé
àíàëèç
ðàçëè÷íûõ
ñèñòåì
àäðåñàöèè,
èñïîëüçóåìûõ
â ìèíè è
ìèêðîÝÂÌ.
            Äàòà
ãîòîâíîñòè
ðàáîòû:
            Ñòóäåíò:  Êîçëîâ
À.Â.
            Ðóêîâîäèòåëü
ðàáîòû: 
×åðíÿê Í.Ã.
            Çàùèùåíà  “____” “_________”  1994 ã.
Ìîñêâà
1994 ã.
ÌÎÑÊÎÂÑÊÈÉ
ÎÐÄÅÍÀ
ÒÐÓÄÎÂÎÃÎ
ÊÐÀÑÍÎÃÎ ÇÍÀÌÅÍÈ
ÝÊÎÍÎÌÈÊÎ-ÑÒÀÒÈÑÒÈ×ÅÑÊÈÉ
ÈÍÑÒÈÒÓÒ
ÊÀÔÅÄÐÀ
ÂÛ×ÈÑËÈÒÅËÜÍÛÕ
ÌÀØÈÍ
ÇÀÄÀÍÈÅ
ÍÀ ÊÓÐÑÎÂÓÞ
ÐÀÁÎÒÓ
ãðóïïà  ÄÏ-101  êóðñ  1
Ñòóäåíò:          Êîçëîâ À.Â.
           
Òåìà:                Ñðàâíèòåëüíûé
àíàëèç
ðàçëè÷íûõ
ñèñòåì
àäðåñàöèè,
èñïîëüçóåìûõ
â                   ìèíè
è ìèêðîÝÂÌ.
             
Îñíîâíûå
ðàçäåëû
êóðñîâîé
ðàáîòû:
1. Ââåäåíèå.
Îòëè÷èÿ
ìèíè- è
ìèêðîÝÂÌ.
2. Ñèñòåìû
àäðåñàöèè,
èñïîëüçóåìûå
â ìèíè-ÝÂÌ.(
Íà ïðèìåðå
ÑÌ ÝÂÌ ).
3. Ñèñòåìû
àäðåñàöèè,
èñïîëüçóåìûå
â ÏÝÂÌ.( Íà
ïðèìåðå
êîíêðåòíîé
ÏÝÂÌ ).
4. Çàêëþ÷åíèå.
Ñðàâíèòåëüíûé
àíàëèç ñèñòåì
àäðåñàöèè
èñïîëüçóåìûõ
â ìèíè- è 
ïåðñîíàëüíûõ
ÝÂÌ.
Ðåêîìåíäóåìàÿ
ëèòåðàòóðà:
       
1. Ìàëûå
ÝÂÌ âûñîêîé
ïðîèçâîäèòåëüíîñòè.
Àðõèòåêòóðà
è
ïðîãðàììèðîâàíèå.                    
Ìîñêâà
"Ðàäèî è
ñâÿçü" 1990.
2. Ä.Áðàìì,
Ï.Áðàìì.
Ïðîöåññîð 80386 è
åãî
ïðîãðàììèðîâàíèå.
"Ìèð" 1990.
3. Øàãóðèí,
Â.Á. Áðîäèí, Ã.Ï.
Ìîçãîâîé.
Îïèñàíèå è
ñèñòåìà
êîìàíä. ÌÏ
"Ìàëèï" 1992.
Äàòà
âûäà÷è
çàäàíèÿ “____” “_________” 1994
ã.
Ñðîê
ïðåäñòàâëåíèÿ
ðàáîòû íà
êàôåäðó "  " "        " 1994 ã.
Ðóêîâîäèòåëü
êóðñîâîé
ðàáîòû : 
×åðíÿê Í.Ã.
1.
ÎÒËÈ×Èß
ÌÈÍÈ- È
ÌÈÊÐÎÝÂÌ.
 
            Â êîíöå 60-õ
ãîäîâ
íà÷àëñÿ
ñåðèéíûé
âûïóñê ñðàâíèòåëüíî
íåáîëüøèõ è
äåøåâûõ
ìèíè-ÝÂÌ. Èõ
ïðåäíàçíà÷àëè
äëÿ
ïðåäïðèÿòèé
è îðãàíèçàöèé,
ãäå
óñòàíîâêà
âûñîêîïðîèçâîäèòåëüíûõ
ÝÂÌ áûëà
ýêîíîìè÷åñêè
íåâûãîäíîé.
 èõ çàäà÷ó
ïåðâîíà÷àëüíî
âõîäèëà
àâòîìàòèçàöèÿ
ïðîôåññèîíàëüíîé
ðàáîòû â
ðàçëè÷íûõ
îðãàíèçàöèÿõ,
ðàáîòà íà
ïðåäïðèÿòèÿõ
â êà÷åñòâå
ïðîáëåìíîîðèåíòèðîâàííûõ
ÝÂÌ. Â 1977-78 ãîäó
áûë íà÷àò
âûïóñê
ñåìåéñòâà
ìàëûõ ÝÂÌ (ÑÌ
ÝÂÌ). Èõ
÷àñòî
íàçûâàëè
óïðàâëÿþùèìè
âû÷èñëèòåëüíûìè
êîìïëåêñàìè,
òàê êàê îíè
÷àùå âñåãî
èñïîëüçîâàëèñü
â ñèñòåìàõ
óïðàâëåíèÿ
ðàçëè÷íîãî
ðîäà. Îäíàêî,
ÑÌ 3-åé
î÷åðåäè,
ðàçðàáîòàííûå
â ïîñëåäíèå
ãîäû
îòíîñÿòñÿ
óæå ê ÝÂÌ
÷åòâåðòîãî
ïîêîëåíèÿ è
èìåþò áîëüøóþ
ïðîèçâîäèòåëüíîñòü,
ïîýòîìó êðóã
èõ
ïðèìåíåíèÿ
ðåçêî
ðàñøèðèëñÿ,
è èõ àêòèâíî
èñïîëüçóþò
â êà÷åñòâå
àâòîìàòèçèðîâàííûõ
ðàáî÷èõ
ìåñò, îáúåäèíÿþò
â
âû÷èñëèòåëüíûå
ñèñòåìû, è ïîðó÷àþò
èì ðàñ÷åò
ýêîíîìè÷åñêèõ
è ñòàòèñòè÷åñêèõ
çàäà÷. Ñ
ïîÿâëåíèåì
áîëüøèõ
èíòåãðàëüíûõ
ñõåì
ñâÿçàíî
ðàçâèòèå äðóãîãî
êëàññà
ìàøèí -
ìèêðîÝÂÌ, è,
êàê äîñòèæåíèå
ýòîãî
íàïðàâëåíèÿ -
ïîÿâëåíèå
ìîùíûõ
ïðîôåññèîíàëüíûõ
ÏÝÂÌ, êîòîðûå
èñïîëüçóþòñÿ
íà ðàáî÷èõ
ìåñòàõ äëÿ
àâòîìàòèçàöèè
òðóäà,
íåñëîæíûõ
ðàñ÷åòîâ è  ðàçëè÷íîãî
ðîäà 
ïðîåêòèðîâàíèÿ.
Îñíîâíûì
îòëè÷èåì
ìèíè- îò
ìèêðîÝÂÌ
íåñîìíåííî
ÿâëÿåòñÿ
îðèåíòàöèÿ.
Ìàøèíû ÑÌ ÝÂÌ
âûïóñêàëèñü
êàê
ïðîáëåìíî
îðèåíòèðîâàííûå
ÝÂÌ è ïîääåðæèâàëèñü
áîëüøèì
êîëè÷åñòâîì
ðàçëè÷íûõ
ìîäóëåé
îïðåäåëÿþùèõ
èõ ñïåöèàëèçàöèþ,
â òî âðåìÿ
êàê ÏÝÂÌ - ýòî
óíèâåðñàëüíûå
ÝÂÌ,
ðàññ÷èòàííûå
ïîìèìî
ïðèìåíåíèÿ â
ïðîôåññèîíàëüíîé
äåÿòåëüíîñòè
åùå è íà
ïðèìåíåíèå
â êà÷åñòâå
îáó÷àþùèõ è
áûòîâûõ ÝÂÌ.
Ïî
ôóíêöèîíàëüíûì
âîçìîæíîñòÿì
ìèíè- è
ìèêðîÝÂÌ
èìåþùèå
ïðèìåðíî îäèí
è òîò æå
óðîâåíü íå
îòëè÷àþòñÿ
äðóã îò äðóãà,
êàê ýòî
äîëæíî áûòü
äëÿ ìàøèí
ðàçíîãî
êëàññà, ò.å.
ó÷èòûâàÿ
÷òî
ìèíè-ÝÂÌ
ñ÷èòàåòñÿ
áîëåå
ìîùíîé ÷åì
ìèêðîÝÂÌ, à â
÷àñòíîñòè
ÏÝÂÌ. Äëÿ
ñðàâíåíèÿ
âîçüìåì
ñóïåðìèíè-ÝÂÌ
ÑÌ 1700 è
ñîâðåìåííóþ
ïåðñîíàëüíóþ
ÝÂÌ íà áàçå
32-ðàçðÿäíîãî
ïðîöåññîðà.
ÑÌ 1700                       AMD 80386 DX 40Mhz
Ïðîèçâîäèòåëü-
íîñòü,
ìëí.îï./ñ                  3                                              9.6
Ðàçðÿäíîñòü                             32                                            32
Åìêîñòü
ÎÇÓ
Ìáàéò                          5-15                                        1-128
Âñå
äàííûå ïî
ïðîöåññîðó AMD386
âçÿòû èç
äîêóìåíòàöèè
íà Ali 386 MINI ISA System Board. Êàê
âèäíî ñ
ðàçâèòèåì
ýëåìåíòíîé
áàçû ÏÝÂÌ,
çàäóìàííûå
êàê ìåíåå
ìîùíûå, ÷åì
ìèíè-ÝÂÌ
ïåðñîíàëüíûå
êîìïüþòåðû
îáîãíàëè èõ
ïî
ïðîèçâîäèòåëüíîñòè.
2.
ÑÈÑÒÅÌÛ
ÀÄÐÅÑÀÖÈÈ
ÈÑÏÎËÜÇÓÅÌÛÅ
 ÌÈÍÈ-ÝÂÌ
            Â ýòîé
ãëàâå áóäóò
ðàññìîòðåíû
ñïîñîáû àäðåñàöèè
äàííûõ,
èñïîëüçóåìûå
â ìèíè-ÝÂÌ
íà ïðèìåðå
ÑÌ1700. Ýòî
ïåðâûé
ïðåäñòàâèòåëü
32-ðàçðÿäíûõ
ÝÂÌ
ñåìåéñòâà
ÑÌ.
Âû÷èñëèòåëüíûé
êîìïëåêñ ÑÌ1700
ïðåäñòàâëÿåò
ñîáîé óíèâåðñàëüíóþ
ÝÂÌ. Îäíà èç
îñíîâíûõ
öåëåé åãî
ñîçäàíèÿ -
ýòî
ðàñøèðåíèå
âèðòóàëüíîãî
àäðåñíîãî
ïðîñòðàíñòâà
ïî
ñðàâíåíèþ ñ 16-ðàçðÿäíîé
ÑÌ4. Õîòÿ
íåêîòîðûå
èíñòðóêöèè âû÷èñëèòåëüíîãî
êîìïëåêñà
ÑÌ1700 èìåþò ñõîäñòâî
ñ
èíñòðóêöèÿìè
ÑÌ4, ÑÌ1700
ïðåäñòàâëÿåò
ñîáîé
ïîëíîñòüþ
íîâóþ
àðõèòåêòóðó.
Àïïàðàòíûå
ñðåäñòâà ÑÌ1700
îðèåíòèðîâàíû
íà ðåàëèçàöèþ
ÿçûêîâ
âûñîêîãî
óðîâíÿ è ñèñòåìíûõ
ïðîãðàìì,
êîòîðûå
èñïîëüçóþòñÿ
îïåðàöèîííîé
ñèñòåìîé è
êîìïèëÿòîðîì.
Ñèñòåìà
êîìàíä ÑÌ1700 â
íàñòîÿùåå
âðåìÿ âêëþ÷àåò
304 èíñòðóêöèè
è áîëåå 20
ðåæèìîâ
àäðåñàöèè
îïåðàíäîâ.
Âñå ýòî äàåò
âîçìîæíîñòü
ïðîãðàììèñòó
ñîñòàâëÿòü
ýôôåêòèâíûå
ïî îáúåìó è
âðåìåíè
âûïîëíåíèÿ
ïðîãðàììû.
Êàêèå æå
ñïîñîáû
àäðåñàöèè
ïðåäóñìîòðåíû
â ÑÌ1700? Ìû
ðàññìîòðèì
íåñêîëüêî
ñïîñîáîâ àäðåñàöèè,
êîòîðûå â
îáùåì ìîæíî
ïîäåëèòü íà ðåãèñòðîâûå,
êîñâåííûå,
èíäåêñíûå è
ñïåöèàëüíûå.
2.1 
ÐÅÃÈÑÒÐÎÂÛÉ
ÐÅÆÈÌ
ÀÄÐÅÑÀÖÈÈ
            Â ýòîì
ðåæèìå
îïåðàíäîì
ÿâëÿåòñÿ
ñîäåðæèìîå
ðåãèñòðà.Ðàññìîòðèì
èíñòðóêöèþ MOVL
R2,R3. Äëÿ ÑÌ ÝÂÌ
õàðàêòåðíî,
÷òî
ïðèåìíèêîì
âñåãäà
ÿâëÿåòñÿ
âòîðîé
îïåðàíä äëÿ
äâóõ- è òðåòèé
äëÿ
òðåõ-îïåðàíäíûõ
èíñòðóêöèé.
Ïîýòîìó
èíñòðóêöèÿ MOVL
R2,R3 ïåðåñûëàåò
ñîäåðæèìîå
ðåãèñòðà R2 â
ðåãèñòð R3, à íå
íàîáîðîò,
êàê áûëî áû ñ
àíàëîãè÷íîé
èíñòðóêöèåé
MOV AX,BX èç íàáîðà
êîìàíä
ïðîöåññîðîâ
cåìåéñòâà 8086
ôèðìû Intel. Ïðèâåäåì
ïðèìåð
èñïîëüçîâàíèÿ
ýòîãî ñïîñîáà
àäðåñàöèè
íà ïðèìåðå
èíñòðóêöèè MOVL
R2,R3. Åå
ìàøèííàÿ
çàïèñü
áóäåò
âûãëÿäåòü,
êàê D0 52 53, ãäå D0 -
êîä
èíñòðóêöèè,
à 52 è 53 - ïðÿìàÿ
àäðåñàöèÿ,
2îé ðåãèñòð è
ïðÿìàÿ
àäðåñàöèÿ,
3èé ðåãèñòð
ñîîòâåòñòâåííî.
   
Ïóñòü
ñîäåðæèìîå
ðåãèñòðîâ äî
îïåðàöèè áûëî:
R2 = 00000010
R3 = 00001000
Òîãäà
ïîñëå îíè
áóäóò
âûãëÿäåòü
òàê:
R2 = 00000010
R3 = 00000010
Êàê âèäíî
èç ïðèìåðà,
ñîäåðæèìîå
ðåãèñòðà R2
áûëî
ñêîïèðîâàíî
â R3.
2.2 
ÊÎÑÂÅÍÍÎ-ÐÅÃÈÑÒÐÎÂÛÉ
ÐÅÆÈÌ
            Â ýòîì
ðåæèìå
ñîäåðæèìîå
ðåãèñòðà
ÿâëÿåòñÿ
àäðåñîì
îïåðàíäà.
Ìíåìîíèêà
íà
àññåìáëåðå (Rn),
ãäå (Rn) ÿâëÿåòñÿ
ðåãèñòðîì
ñîäåðæàùèì
ëèáî àäðåñ
îïåðàíäà
èñòî÷íèêà {MOVL
(R2),R3} ëèáî àäðåñ
îïåðàíäà
ïðèåìíèêà {MOVL
R2,(R3)}.  êà÷åñòâå
ïðèìåðà îïÿòü
ïðèâåäåì
èíñòðóêöèþ
ïåðåñûëêè
äâîéíîãî
ñëîâà MOVL R2,(R3). Êîä
îïåðàöèè
îñòàíåòñÿ
òîò æå, à îïåðàíäû
áóäóò
ïðåäñòàâëåíû
êàê 52 63, ãäå 63 - ýòî
óæå
êîñâåííàÿ
àäðåñàöèÿ ñ
èñïîëüçîâàíèåì
3ãî ðåãèñòðà.
Ïðè òîì æå
ñîäåðæèìîì
ðåãèñòðîâ,
÷òî è â
ïðåäûäóùåì
ïðèìåðå,
áóäåì èìåòü:
   
Äî îïåðàöèè
MOVL R2,(R3):
                                                                        R2
= 00000010
                                                                        R3
= 00001000
                                                          (00001000) = 00000200           (R3)
Ïîñëå...
                                                                        R2
= 00000010
                                                                        R3
= 00001000
                                                          (00001000) = 00000010
   
Ïîñëå
îïåðàöèè
ïåðåñûëêè
çíà÷åíèå
ÿ÷åéêè
ïàìÿòè,
àäðåñ
êîòîðîé
ñîäåðæàëñÿ â R3
(00001000) èçìåíèëñÿ
ñ 000000200 íà 00000010.
2.3  ÐÅÆÈÌ Ñ
ÀÂÒÎÓÂÅËÈ×ÅÍÈÅÌ
            Ñïåöèàëüíî
äëÿ
îáðàáîòêè
ìàññèâîâ
äàííûõ â CM1700
ïðåäóñìîòðåíà
àäðåñàöèÿ ñ
àâòîóâóëè÷åíèåì.
 ýòîì
ðåæèìå
ñîäåðæèìîå
âûáðàííîãî
ðåãèñòðà
ÿâëÿåòñÿ
àäðåñîì
îïåðàíäà, êàê
è ïðè
êîñâåííî-ðåãèñòðîâîé
àäðåñàöèè,
îäíàêî ïîñëå
âûïîëíåíèÿ
îïåðàöèè
ñîäåðæèìîå
ðåãèñòðà
óâåëè÷èâàåòñÿ
íà N, â
çàâèñèìîñòè
îò òèïà
îïåðàíäà:
N = 1,  åñëè
îïåðàíäîì
ÿâëÿåòñÿ
áàéò,
N = 2,  åñëè
îïåðàíäîì
ÿâëÿåòñÿ
ñëîâî,
N = 4,  åñëè
îïåðàíäîì
ÿâëÿåòñÿ
äâîéíîå ñëîâî,
N = 8,  åñëè
îïåðàíäîì
ÿâëÿåòñÿ
ó÷åòâåðåííîå
ñëîâî èëè
ñëîâî ñ                               ïëàâàþùåé
çàïÿòîé,
N =16,
åñëè
îïåðàíäîì
ÿâëÿåòñÿ
öåëîå ñëîâî
äëèíîé 128
ðàçðÿäîâ èëè                      äâîéíîå
ñëîâî ñ ïëàâàþùåé
çàïÿòîé.
   
            Ðàññìîòðèì
ýòîò ðåæèì
àäðåñàöèè
èñïîëüçóÿ
êîìàíäó MOVL (R0),(R2)+. Â
ïàìÿòè
èíñòðóêöèÿ
áóäåò
ïðåäñòàâëåíà
êàê D0 60 82, ãäå 60 -
êàê óæå
ãîâîðèëîñü
êîñâåííàÿ àäðåñàöèÿ
ñ ðåãèñòðîì R0,
à 82 -
êîñâåííàÿ
àäðåñàöèÿ ñ
èñïîëüçîâàíèåì
ðåãèñòðà R2 è
àâòîóâåëè÷åíèå.
Âîñüìåðêà â
ïîñëåäíåì
ñëó÷àå êàê
ðàç è
îçíà÷àåò
äàííûé
ðåæèì
àäðåñàöèè.
Äî îïåðàöèè
MOVL (R0),(R2)+
                                                                        R0
= 00001000
                                                                        R2
= 00001050
                                                          (00001000) = 000000AC          (R3)
                                                          (00001050) = 00000000           (R2)
Ïîñëå...
                                                                        R0
= 00001000
                                                                        R2
= 00001054           <——
Óâåëè÷èëîñü
íà 4
                                                          (00001000) = 000000AC
                                                          (00001050) = 000000AC
   
Êàê
âèäíî
ïðîèçîøëà
ïåðåñûëêà
÷èñëà èç ÿ÷åéêè
00001000 â 00001050 è
çíà÷åíèå
ðåãèñòðà R2
óâåëè÷èëîñü
íà 4. (
Èíñòðóêöèÿ MOVL
ïåðåñûëàåò
äâîéíûå ñëîâà.
Îá ýòîì
ãîâîðèò
ñóôôèêñ 'L' - Long -
äëèííîå èëè
äâîéíîå
ñëîâî.
Ïîýòîìó R2
óâåëè÷èëñÿ
íà 4. Âîîáùå
ïðåäóñìîòðåíû
îïåðàöèè
ðàáîòàþùèå
ñ áàéòàìè,
ñëîâàìè,
äâîéíûìè
ñëîâàìè è
èíîãäà ñ
ó÷åòâåðåííûìè
ñëîâàìè è èìåþùèå
ñóôôèêñû B,W,L è Q
ñîîòâåòñòâåííî.)
2.4  ÐÅÆÈÌ Ñ
ÀÂÒÎÓÌÅÍÜØÅÍÈÅÌ
            Ýòîò
ðåæèì
èäåíòè÷åí
ðåæèìó ñ
àâòîóâåëè÷åíèåì,
îäíàêî çäåñü
ïîñëå
âûïîëíåíèÿ
îïåðàöèè
ñëåäóåò íå
óâåëè÷åíèå,
à
óìåíüøåíèå
îïåðàíäà ïî
òåì æå
ïðàâèëàì. Äëÿ
ïðèìåðà
ðàññìîòðèì
êîìàíäó CLRB -(R5),
êîòîðàÿ â
ïàìÿòè
áóäåò
âûãëÿäåòü
êàê 94 75. Çäåñü 94 -
êîä îïåðàöèè,
à 75 - çíà÷èò:
èñïîëüçîâàòü
ðåãèñòð R5 ( ?5 ) è
ïðîèçâåñòè
óìåíüøåíèå
ïîñëå
èñïîëíåíèÿ ( 7?
).
Äî îïåðàöèè
CLRB -(R5)
                                                                        R5
= 00001000
                                                        (00000FFF) = 0000001A
                                                        (000001000) = 0000001A           (R5)
Ïîñëå...
                                                                        R5
= 00000FFF           <—— 
óìåíüøèëîñü
íà 1
                                                         (00000FFF) = 0000001A           (R5)
                                                         (000001000) = 00000000          <——  0
    
Èçìåíåíèÿ
õîðîøî
âèäíû.
ß÷åéêà 00001000, íà
êîòîðóþ
ïåðâîíà÷àëüíî
óêàçûâàë
ðåãèñòð R5 î÷èñòèëàñü
( CLRB - CLeaR Byte -
î÷èñòèòü
áàéò
),çíà÷åíèå ðåãèñòðà
R5
óìåíüøèëîñü
íà 1 è òåïåðü
óêàçûâàåò
íà ÿ÷åéêó
ïàìÿòè
ðàñïîëîæåííóþ
ïåðåä ÿ÷åéêîé
00001000, ò.å. 00000FFF.
2.5 
ÊÎÑÂÅÍÍÛÉ
ÐÅÆÈÌ Ñ
ÀÂÒÎÓÂÅËÈ×ÅÍÈÅÌ
            Â ýòîì
ðåæèìå
ñîäåðæèìîå
âûáðàííîãî
ðåãèñòðà
ÿâëÿåòñÿ
àäðåñîì
àäðåñà
îïåðàíäà, à ïîñëå
âûïîëíåíèÿ
îïåðàöèè
ïðîèçâîäèòñÿ
óâåëè÷åíèå
ñîäåðæèìîãî
ýòîãî ðåãèñòðà
íà 4,
íåçàâèñèìî
îò ðàçìåðà
îïåðàíäà. Ýòî
îïðåäåëÿåòñÿ
òåì, ÷òî
ðåãèñòð
ñîäåðæèò
àäðåñ àäðåñà (
ò.å. àäðåñ
ÿ÷åéêè,
ñîäåðæèìîå
êîòîðîé â
ñâîþ î÷åðåäü
èñïîëüçóåòñÿ
êàê àäðåñ äëÿ
ïîëó÷åíèÿ
äåéñòâèòåëüíîãî
îïåðàíäà ), à
àäðåñ âñåãäà
ïðåäñòàâëÿåòñÿ
êàê äâîéíîå
ñëîâî.
            Äëÿ
ïðèìåðà
âîçüìåì
îïåðàöèþ
î÷èñòêè áàéòà,
ìíåìîíèêà
êîòîðîé íà
àññåìáëåðå
áóäåò
âûãëÿäåòü
êàê CLRB @(R5)+.
Ñèìâîë '@' (
çþõà )
îçíà÷àåò
èñïîëüçîâàíèå
íå ïðîñòî
ðåæèìà ñ
àâòîóâåëè÷åíèåì,
à èìåííî
êîñâåííîãî.
Ïðåäñòàâëåíèå
ýòîé
îïåðàöèè â
ïàìÿòè áóäåò
94 95, ãäå 94 - êîä
îïåðàöèè, 95 -
îçíà÷àåò
èñïîëüçîâàíèå
ðåãèñòðà R5 è
êîñâåííîé
àäðåñàöèè ñ
àâòîóâåëè÷åíèåì
(öèôðà 9).
Äî îïåðàöèè
CLRB @(R5)+
                                                                        R5
= 00001000 
                                                          (00001000) = 000000AC          (R5)
                                                         (000000AC) = 0A                      (00001000)
Ïîñëå...
                                                                        R5
= 00001004           <—— 
óâåëè÷èëîñü
íà 4
                                                          (00001000) = 000000AC
                                                         (000000AC) = 00                       <——  0
Â
ðåçóëüòàòå
âûïîëíåíèÿ
ýòîé
êîìàíäû ñîäåðæèìîå
ÿ÷åéêè 000000AC,
àäðåñ
êîòîðîé
cîäåðæàëñÿ â
ÿ÷åéêå 00001000, íà
êîòîðóþ
óêàçûâàë
ðåãèñòð R5 îáíóëèëîñü,
à çíà÷åíèå
ðåãèñòðà R5
óâåëè÷èëîñü
íà 4.
   
2.6  ÐÅÆÈÌ
ÑÌÅÙÅÍÈß
            Â ýòîì
ðåæèìå
ñîäåðæèìîå
âûáðàííîãî
ðåãèñòðà
ñêëàäûâàåòñÿ
ñ
ñîäåðæèìûì
áàéòà, ñëîâà
èëè
äâîéíîãî
ñëîâà,
ñëåäóþùåãî
íåïîñðåäñòâåííî
çà
ñïåöèôèêàòîðîì
îïåðàíäà.
Ïîëó÷åííàÿ
ñóììà
ÿâëÿåòñÿ
àäðåñîì îïåðàíäà.
Ìíåìîíèêè
íà
àññåìáëåðå
äëÿ 3åõ ñëó÷àåâ
èìåþò âèä: B^X(Rn), W^X(Rn),
L^X(Rn), ãäå X
ñìåùåíèå,
îòíîñèòåëüíî
(Rn).
Âîçìîæíîñòü
çàäàâàòü
ðàçìåðíîñòü
ñìåùåíèÿ
ïðåäóñìîòðåíà
äëÿ ýêîíîìèè
ïàìÿòè.
            Ðàññìîòðèì
ýòîò ñïîñîá
àäðåñàöèè
íà ïðèìåðå
êîìàíäû CLRB B^2(R4),
êîòîðàÿ
î÷èñòèò 3èé
áàéò áàéòîâîãî
ìàññèâà,
àäðåñ
êîòîðîãî
ñîäåðæèòñÿ â
ðåãèñòðå R5. Åå
ìàøèííîå
ïðåäñòàâëåíèå
âûãëÿäèò êàê
94 A4 02, ãäå 94 - êîä
îïåðàöèè, A4 -
ðåãèñòð R4 è
ñìåùåíèå
ïðåäñòàâëåíî
áàéòîì ( äëÿ ñëîâà
è äâîéíîãî
ñëîâà áûëî
áû C4 è E4
ñîîòâåòñòâåííî,
à òðåòüå ïîëå
ïðåäñòàâëÿëî
áû ñìåùåíèå
êàê ñëîâî
èëè äâîéíîå
ñëîâî ),  à
02 ñîáñòâåííî
ñìåùåíèå,
ïðåäñòàâëåííîå
â âèäå áàéòà.
Äî îïåðàöèè
CLRB B^2(R4)
                                                                        R4
= 00001000
                                                          (00001000) = 00                       (R4)
                                                          (00001001) = 01
                                                          (00001002) = 02                       (R4)+2
Ïîñëå...
                                                                        R4
= 00001000
                                                          (00001000) = 00                       (R4)
                                                          (00001001) = 01
                                                          (00001002) = 00                       <—— 0
Â
ðåçóëüòàòå
âûïîëíåíèÿ
êîìàíäû
äåéñòâèòåëüíî
ïðîèçîøëî
î÷èùåíèå
ÿ÷åéêè 00001002, çàäàííîé
íà÷àëüíûì
àäðåñîì 00001000 è
ñìåùåíèåì 2. Ýòîò
ðåæèì
àäðåñàöèè
ïîçâîëÿåò
ëåãêî îáðàùàòüñÿ
ê îòäåëüíûì
ýëåìåíòàì
ìàññèâîâ,
÷òî î÷åíü
óäîáíî.
2.7 
ÊÎÑÂÅÍÍÛÉ
ÐÅÆÈÌ
ÑÌÅÙÅÍÈß
            Â ýòîì
ðåæèìå
ñîäåðæèìîå
âûáðàííîãî
ðåãèñòðà
ñêëàäûâàåòñÿ
ñî
ñìåùåíèåì (
áàéò, ñëîâî èëè
äâîéíîå
ñëîâî
ñëåäóþùåå
íåïîñðåäñòâåííî
çà
ñïåöèôèêàòîðîì 
îïåðàíäà ) è ïîëó÷åííàÿ
ñóììà
ðàññìàòðèâàåòñÿ
êàê àäðåñ
äâîéíîãî
ñëîâà,
êîòîðîå
ÿâëÿåòñÿ àäðåñîì
îïåðàíäà.
Ìíåìîíè÷åñêîå
ïðåäñòàâëåíèå
íà
àññåìáëåðå
@B^X(Rn), @W^X(Rn) è @L^X(Rn) äëÿ
ñìåùåíèÿ X â áàéò,
ñëîâî èëè
äâîéíîå
ñëîâî
ñîîòâåòñòâåííî.
Rn - ýòî
ðåãèñòð,èñïîëüçóåìûé
â äàííîì
ñïîñîáå
àäðåñàöèè.
            Â
êà÷åñòâå
ïðèìåðà
âîçüìåì
èíñòðóêöèþ MOVW
@B^8(R5),(R2), êîòîðàÿ äîëæíà
çàíåñòè â
ïàìÿòü ïî
àäðåñó (R2)
÷èñëî, íà
êîòîðîå
óêàçûâàåò
äâîéíîå
ñëîâî, ïî àäðåñó
ïîëó÷àåìîìó
ïðè ñëîæåíèè
ñîäåðæèìîãî
ðåãèñòðà R2 ñî
ñìåùåíèåì 8.
Íà
ìàøèííîì ÿçûêå
ýòà
èíñòðóêöèÿ
áóäåò èìåòü
âèä B0 B5 08 62, ãäå Â0 -
êîä
èíñòðóêöèè, B5
- ðåãèñòð R5 è
áàéòîâîå 
ñìåùåíèå, 08 -
ñìåùåíèå è 62 -
êîñâåííàÿ àäðåñàöèÿ
ñ
èñïîëüçîâàíèåì
ðåãèñòðà R2.
Äî îïåðàöèè
MOVW @B^8(R5),(R2)
                                                                        R5
= 00001000
                                                                        R2
= 00000400
                                                          (00001000) = 00000100           (R5)
                                                          (00001004) = 00000200
                                                          (00001008) = 00000300           (R5)+8
                                                          (00000300) = AAAA                @(R5)+8
                                                          (00000400) = 0000                   (R2)
   
Ïîñëå...
                                                                        R5
= 00001000
                                                                        R2
= 00000400
                                                          (00001000) = 00000100           (R5)
                                                          (00001004) = 00000200
                                                          (00001008) = 00000300           (R5)+8
                                                          (00000300) = AAAA
                                                          (00000400) = AAAA
Êàê
âèäíî èç
ïðèìåðà â
ÿ÷åéêó 00000400
áûëî çàíåñåíî
ñîäåðæèìîå
ÿ÷åéêè 00000300.
Àäðåñ 0000300 áûë
âû÷èñëåí
êàê
ñîäåðæèìîå R5 (
00001000 ) ïëþñ 8 ò.å. 00001008.
Ýòà ÿ÷åéêà,
êàê âèäíî,
äåéñòâèòåëüíî
ñîäåðæèò
àäðåñ 00000300.
2.8  ÐÅÆÈÌ
ÊÎÐÎÒÊÎÃÎ
ËÈÒÅÐÀËÀ
            Òàê êàê
ìíîãèå
ëèòåðàëû
(÷èñëà),
èñïîëüçóåìûå
â
ïðîãðàììàõ,
èìåþò
íåáîëüøîé
ðàçìåð, òî â
ÑÌ1700
ïðåäóñìîòðåí
ñïåöèàëüíûé
ðåæèì àäðåñàöèè,
íàçûâàåìûé
ðåæèìîì
êîðîòêîãî
ëèòåðàëà. Â
ýòîì ðåæèìå
êîíñòàíòà
ñîäåðæèòñÿ
íåïîñðåäñòâåííî
â ñàìîì
ñïåöèôèêàòîðå
îïåðàíäà.
Ëþáîé
ñïåöèôèêàòîð
îïåðàíäà, äâà
ñòàðøèõ
ðàçðÿäà
êîòîðîãî
ðàâíû íóëþ
ñîäåðæèò
ëèòåðàëüíóþ
êîíñòàíòó â
ìëàäøèõ
øåñòè
ðàçðÿäàõ.
                  00 ??????
<—— áàéò
ñïåöèôèêàòîð
îïåðàíäà
                      ëèòåðàë
Ñ
ïîìîùüþ
ëèòåðàëà â
èíñòðóêöèè
ìîãóò áûòü
ïðåäñòàâëåíû
öåëûå ÷èñëà
â äèàïàçîíå
îò 0 äî 63.
Ìíåìîíèêà
íà
àññåìáëåðå S^#n,
ãäå n - ëèòåðàë.
Ðàññìîòðèì
èíñòðóêöèþ MOVL
S^#18,R3 êîòîðàÿ â
ïàìÿòè
áóäåò 
ïðåäñòàâëåíà
â âèäå D0 18 53. Çäåñü
D0 - êîä
èíñòðóêöèè, 18
- ëèòåðàë, 53 -
ðåãèñòð R3 ïðè
ïðÿìîé
àäðåñàöèè.
Äî îïåðàöèè
MOVL S^#18,R3
                                                                        R3
= 00001234
Ïîñëå...
                                                                        R3
= 00000018
Èç ïðèìåðà
âèäíî, ÷òî
ëèòåðàë áûë
çàíåñåí â
ðåãèñòð R3
2.9  ÈÍÄÅÊÑÍÛÉ
ÐÅÆÈÌ
   
            Îäíèì èç
íàèáîëåå
ìîùíûõ
ñðåäñòâ
àäðåñàöèè â
ÑÌ1700 ÿâëÿåòñÿ
èñïîëüçîâàíèå
ðåãèñòðîâ
îáùåãî
íàçíà÷åíèÿ
äëÿ
îïðåäåëåíèÿ
èíäåêñà
ýëåìåíòà â
ìàññèâà
äàííûõ. Âîò
ôîðìàò
ñïåöèôèêàòîðà
êîìàíäû:
15                                         11                              7                                   3                                        0                              
                        ÊÁÐÀ                          ÍÁÐ
                            ÊÈР                ÍÈÐ
ãäå  
ÊÁÐÀ     -
êîä
áàçîâîãî
ðåæèìà
àäðåñàöèè,
       
ÍÁР   -
íîìåð
áàçîâîãî
ðåãèñòðà,
       
ÊÈР        - êîä
èíäåêñíîãî
ðåæèìà (0100),
       
ÍÈР         - íîìåð
èíäåêñíîãî
ðåãèñòðà.
   
Êàê
âèäíî
ðàçðÿäû 15 - 8
ñîäåðæàò
âòîðîé ñïåöèôèêàòîð
îïåðàíäà,
êîòîðûé
íàçûâàåòñÿ
áàçîâûì. Îí
ìîæåò
îïðåäåëÿòü
ëþáîé ðåæèì
àäðåñàöèè,
êðîìå
ðåãèñòðîâîãî,
êîðîòêîãî ëèòåðàëà
è
èíäåêñíîãî.
Åñëè
áàçîâûé
ñïåöèôèêàòîð
òðåáóåò
ðàñøèðåíèÿ,
òî ýòî
ðàñøèðåíèå
ñëåäóåò
íåïîñðåäñòâåííî
çà ñïåöèôèêàòîðîì.
Ñïåöèôèêàòîð
îáû÷íî
îïðåäåëÿåò
àäðåñ
íà÷àëà
ìàññèâà, à â
èíäåêñíîì
ðåãèñòðå Rx
ñîäåðæèòñÿ
íîìåð
ýëåìåíòà
ìàññèâà. Ïðè
îïðåäåëåíèè
ýôôåêòèâíîãî
àäðåñà îïåðàíäà
ñíà÷àëà
âû÷èñëÿåòñÿ
áàçîâûé àäðåñ
ìàññèâà èëè
òàáëèöû.
Çàòåì
ñîäåðæèìîå
èíäåêñíîãî
ðåãèñòðà
óìíîæàåòñÿ
íà 1, 2, 4 èëè 8, â
çàâèñèìîñòè
îò ðàçìåðà
îïåðàíäà è
ïðèáàâëÿåòñÿ
ê áàçîâîìó
àäðåñó.
Èñïîëüçóÿ
ýòîò ðåæèì
àäðåñàöèè
ñîâìåñòíî ñ
óæå îïèñàííûìè
ìîæíî
ïîëó÷èòü
ñëåäóþùèå ðåæèìû
àäðåñàöèè :
   
1. Êîñâåííî-ðåãèñòðîâûé
èíäåêñíûé, (Rn)[Rx].
2. Ñ
àâòîóâåëè÷åíèåì
èíäåêñíûé, (Rn)+[Rx].
3. Êîñâåííûé
ñ
àâòîóâåëè÷êíèåì
èíäåêñíûé,
@(Rn)+[Rx].
4. Ñ
àâòîóìåíüøåíèåì
èíäåêñíûé, -(Rn)[Rx].
5. Ñìåùåíèÿ
èíäåêñíûé,
N^X(Rn)[Rx], ãäå N ìîæåò
ïðèíèìàòü
çíà÷åíèÿ B, W, L.
6. Êîñâåííûé
ñìåùåíèÿ
èíäåêñíûé,
@N^X(Rn)[Rx]
           
Ïðè
ðàáîòå ñî
ñòðóêòóðàìè
äàííûõ
èíäåêñíûé
ðåæèì
ãîðàçäî
óäîáíåå, ÷åì
ïðîñòî ðåæèì
ñìåùåíèÿ.
Âî-ïåðâûõ,
çäåñü
èìååòñÿ ìîùíûé
ðåæèì
çàäàíèÿ
íà÷àëüíîãî
àäðåñà ìàññèâà
ñ ïîìîùüþ
îäíîãî èç
îñíîâíûõ
ðåæèìîâ
àäðåñàöèè,
÷òî
ïîçâîëÿåò
ëåãêî ìîäèôèöèðîâàòü
ýòîò àäðåñ.
Âî âòîðûõ,
ïðîãðàììèñò
â èíäåêñíîì
ðåãèñòðå [Rx]
óêàçûâàåò
òîëüêî íîìåð
ýëåìåíòà, à
íåîáõîäèìîå
ñìåùåíèå
âû÷èñëÿåòñÿ
àâòîìàòè÷åñêè
èç êîíòåêñòà
îïåðàíäà.
Òàê,
èíñòðóêöèÿ CLRB
B^2(R4), ðåàëèçóþùàÿ
ðåæèì ñìåùåíèÿ
( ïóíêò 2.6 )
ìîæåò
âûãëÿäåòü
êàê CLRB (R0)[R4] è åñëè
â R0 íàõîäèòñÿ
àäðåñ
ìàññèâà, à â R4
ñìåùåíèå, òî
îíà
àíàëîãè÷íî
ïåðâîé
èíñòðóêöèè
î÷èñòèò 3èé
ýëåìåíò
ìàññèâà.
Äî îïåðàöèè
CLRB (R0)[R4]
                         
                                                                        R0  = 00001000
                                                                        R4  = 00000002
                                                           (00001000) = 00                      (R0)
                                                           (00001001) = 01
                                                           (00001002) = 02                      (R0)+[R4]*1
Ïîñëå...
                                                                        R0  = 00001000
                                                                        R4  = 00000002
                                                           (00001000) = 00                      (R0)
                                                           (00001001) = 01
                                                           (00001002) = 00                      <—— 0
   
Ïðèìåð
äîêàçûâàåò
àáñîëþòíóþ
èäåíòè÷íîñòü
ýòèõ
èíñòðóêöèé.
2.10  ÐÅÆÈÌÛ
ÀÄÐÅÑÀÖÈÈ Ñ
ÈÑÏÎËÜÇÎÂÀÍÈÅÌ
Ñ×ÅÒ×ÈÊÀ
ÈÍÑÒÐÓÊÖÈÉ.
           
            Îäíèì èç
íåóäîáñòâ
îïèñàííûõ
âûøå ñïîñîáîâ
àäðåñàöèè
ÿâëÿåòñÿ òî,
÷òî  âî
âñåõ íèõ
òðåáóåòñÿ
ïðåäâàðèòåëüíàÿ
çàãðóçêà
îäíîãî èç
ðåãèñòðîâ
îáùåãî
íàçíà÷åíèÿ.
Òîëüêî ïîñëå
òîãî, êàê
ðåãèñòð
çàãðóæåí,
ñîäåðæèìîå
åãî ìîæåò
áûòü
èñïîëüçîâàíî
â êà÷åñòâå
óêàçàòåëÿ
íà÷àëà
ìàññèâà,
àäðåñà
ýëåìåíòà è
ò.ä. Ïðè
îäíîêðàòíîì
îáðàùåíèè ê
ïðîèçâîëüíîé
ÿ÷åéêå
òàêîé ñïîñîá
ÿâëÿåòñÿ
íåóäîáíûì è
íåýôôåêòèâíûì,
òàê êàê òðåáóåò
ïî ñóòè
âûïîëíåíèÿ
äâóõ
îïåðàöèé âìåñòî
îäíîé -
ïðåäâàðèòåëüíîé
çàãðóçêè
àäðåñà â
ðåãèñòð è
ñîáñòâåííî
îáðàùåíèå ê
ïàìÿòè
÷åðåç ýòîò 
ðåãèñòð ñ
ïîìîùüþ îäíîãî
èç ðåæèìîâ
àäðåñàöèè.
Îäíàêî ýòó îïåðàöèþ
ìîæíî
ðåàëèçîâàòü
ãîðàçäî
ïðîùå, åñëè
èñïîëüçîâàòü
ñ÷åò÷èê
èíñòðóêöèé.
Ðåãèñòð R15
ÿâëÿåòñÿ
ñ÷åò÷èêîì
èíñòðóêöèé, è
îäíîâðåìåííî
ðåãèñòðîì
îáùåãî
íàçíà÷åíèÿ,
òî åñòü
äîñòóïåí
ïðîãðàììèñòó
äëÿ èñïîëüçîâàíèÿ
â êà÷åñòâå
áàçîâîãî
ðåãèñòðà è
ò.ä. Ýòî î÷åíü
óïðîùàåò
æèçíü ïðîãðàììèñòó,
îäíàêî
òðåáóåò
ïîâûøåííîé
âíèìàòåëüíîñòè,òàê
êàê
èñïîëüçîâàíèå
ýòîãî
ðåãèñòðà
íàïðèìåð ïðè
àäðåñàöèè ñ
àâòîóìåíüøåíèåì
ïðèâåäåò ê
íåïðåäñêàçóåìîìó
ðåçóëüòàòó.
Ôàêòè÷åñêè
ñî ñ÷åò÷èêîì
èíñòðóêöèé
èñïîëüçóþòñÿ
òîëüêî ÷åòûðå
ðåæèìà
àäðåñàöèè: ñ
àâòîóâåëè÷åíèåì,
êîñâåííûé ñ
àâòîóâåëè÷åíèåì,
ñìåùåíèÿ è
êîñâåííûé
ñìåùåíèÿ.
Ýòî äàåò ñ
òî÷êè
çðåíèÿ
ïðîãðàììèñòà
( íî íå
àïïàðàòíî ) ÷åòûðå
äîïîëíèòåëüíûõ
ðåæèìà
àäðåñàöèè: íåïîñðåäñòâåííûé,
àáñîëþòíûé,
îòíîñèòåëüíûé
è
êîñâåííî-îòíîñèòåëüíûé.
            Ðàññìîòðèì
àëãîðèòì
âûïîëíåíèÿ
ðåæèìà ñ
àâòîóâåëè÷åíèåì
ïðè
èñïîëüçîâàíèè
ñ÷åò÷èêà
èíñòðóêöèé
â êà÷åñòâå
ðåãèñòðà
îáùåãî íàçíà÷åíèÿ.
Ïî
îïðåäåëåíèþ
ðåæèìà ñ
àâòîóâåëè÷åíèåì
îïåðàöèÿ
ïðîèçâîäèòñÿ
íàä îïåðàíäîì,
íà êîòîðûé
óêàçûâàåò
âûáðàííûé ðåãèñòð.
Åñëè ìû
èñïîëüçóåì
ñ÷åò÷èê
èíñòðóêöèé,
òî îí â ýòîò
ìîìåíò
áóäåò
óêàçûâàòü
íà ÿ÷åéêó
íåïîñðåäñòâåííî
ñëåäóþùóþ çà
ñïåöèôèêàòîðîì
îïåðàíäà.
Òàêèì îáðàçîì
îïåðàíä 
îêàçûâàåòñÿ
íåïîñðåäñòâåííî
â ïîòîêå
èíñòðóêöèé.
Ïîñëå âûáîðêè
îïåðàíäà
ñîäåðæèìîå
ñ÷åò÷èêà
óâåëè÷èòñÿ
íà ðàçìåð
îïåðàíäà,
îïðåäåëÿåìûé
êîäîì
îïåðàöèè. Äëèíà
êîíñòàíòû
äîëæíà
ñîîòâåòñòâîâàòü
òèïó
èíñòðóêöèè,
äàæå åñëè åå
ôàêòè÷åñêèé
ðàçìåð
ìåíüøå,
òîëüêî òîãäà
ïîñëå àâòîóâåëè÷åíèÿ
ñîäåðæèìîãî
ñ÷åò÷èêà
èíñòðóêöèé
îí áóäåò
ñîäåðæàòü
ïðàâèëüíûé
àäðåñ
ñëåäóþùåé
êîìàíäû. Äëÿ
ïðèìåðà
ðàññìîòðèì
èíñòðóêöèþ MOVB
#10,(R2)
   
Äî îïåðàöèè
MOVB #10,(R2)
                                                            00000305  : 
90  ÊÎÏ
                                                            00000306  : 
8F  <———
ïðåäñòàâëåíèå
'(R15)+'
                                                            00000307  : 
10  <———
êîíñòàíòà
                                                            00000308  : 
62  <———
ïðåäñòàâëåíèå
'(R2)'
                         
                                                                        R2  = 00001000
                                                                      R15 
= 00000305
                                                           (00001000) = FF                      (R2)
Ïîñëå...
                                                                        R2  = 00001000
                                                                      R15 
= 00000309
                                                           (00001000) = 10                      (R2)
Ïðè
êîìïèëÿöèè
èíñòðóêöèÿ MOVB
#10,(R2) áûëà
çàìåíåíà íà
MOVB (R15)+(R2), à
êîíñòàíòà
áûëà
ïîìåùåíà â
ïîòîê
èíñòðóêöèé,
è áûëà
óñïåøíî
àäðåñîâàíà
è
ñêîïèðîâàíà
ïî àäðåñó (00001000).
            Åñëè
èñïîëüçîâàòü
êîñâåííûé
ðåæèì ñ àâòîóâåëè÷åíèåì,
òî ïî
îïðåäåëåíèþ
ðåæèìà ñîäåðæèìîå
ñ÷åò÷èêà
èíñòðóêöèé
ÿâëÿåòñÿ íå
àäðåñîì
îïåðàíäà, à
àäðåñîì
àäðåñà
îïåðàíäà, à
ïîñëå âûïîëíåíèÿ
èíñòðóêöèè
çíà÷åíèå
ñ÷åò÷èêà
óâåëè÷èòñÿ
íà 4, òàê êàê
ìû ïåðåäàåì
32-ðàçðÿäíûå
àäðåñà.
Òàêèì
îáðàçîì ìû
èìååì
âîçìîæíîñòü
çàäàòü ïðÿìî
â êîäå
èíñòðóêöèè
àáñîëþòíûé
àäðåñ
îïåðàíäà.
Åñëè â
ïðåäûäóùåì
ïðèìåðå
èñïîëüçîâàòü
ýòîò ïðèìåð,
òî ïî àäðåñó
(00001000) áóäåò
çàíåñåíî íå
÷èñëî 10, à
çíà÷åíèå
ÿ÷åéêè 10. Íà
àññåìáëåðå
òàêàÿ
èíñòðóêöèÿ
áóäåò èìåòü
ìíåìîíèêó MOVB
@#10,(R2):
Äî îïåðàöèè
MOVB @#10,(R2)
                                                            00000305  : 
90  ÊÎÏ
                                                            00000306  : 
9F  <———
ïðåäñòàâëåíèå
'@(R15)+'
                                                            00000307  : 
10  
                                                            00000308  : 
00  
                                                            00000309  : 
00  
                                                            0000030A  : 
00 
                                                            0000030B  : 
62  <———
ïðåäñòàâëåíèå
'(R2)'
                         
                                                                        R2  = 00001000
                                                                      R15 
= 00000305
                                                           (00000010) = 00     
                                                           (00001000) = FF      (R2)
Ïîñëå...
                                                                        R2  = 00001000
                                                                      R15 
= 00000309
                                                           (00000010) = 00
                                                           (00001000) = 00                      <——— 0
              
            Åñòü
îïðåäåëåííûé
êëàññ
ïðîãðàìì,
êîòîðûå
íàçûâàþòñÿ
ïîçèöèîííî-íåçàâèñèìûìè.
Îíè ìîãóò
áûòü
çàãðóæåíû è
çàïóùåíû â
ëþáîé
îáëàñòè
ïàìÿòè áåç ïåðåòðàíñëÿöèè,
ïåðåëèíêîâêè
èëè ìîäèôèêàöèè
àäðåñîâ
îïåðàíäîâ.
Ïðè
ïåðåìåùåíèè
â ïàìÿòè
ïðîãðàììû,
èñïîëüçóþùåé
êîñâåííî-ðåãèñòðîâûé
ðåæèì
àäðåñàöèè
àäðåñ àäðåñóåìîé
ÿ÷åéêè íå
èçìåíÿåòñÿ.
Åñëè äàííûå
â ïàìÿòè
ïåðåìåùàþòñÿ
âìåñòå ñ
ïðîãðàììîé,
êàê ýòî ÷àùå
âñåãî
áûâàåò, òî
àäðåñîâàòüñÿ
áóäóò
ñîâñåì íå òå
äàííûå,
êîòîðûå äîëæíû
áû. ×òî
äåëàòü â
òàêèõ
ñëó÷àÿõ ? Ðàññìîòðèì
êàê
èñïîëüçîâàòü
ñ÷åò÷èê
èíñòðóêöèé
â ðåæèìå ñî
ñìåùåíèåì.
Ñîäåðæèìîå
ðåãèñòðà
ñ÷åò÷èêà
èíñòðóêöèé 
ñêëàäûâàåòñÿ
ñî
ñìåùåíèåì,
êîòîðîå
ðàñïîëîæåíî
íåïîñðåäñòâåííî
â ïîòîêå èíñòðóêöèé.
Ïîëó÷åííàÿ
ñóììà
ÿâëÿåòñÿ àäðåñîì
îïåðàíäà.
Î÷åâèäíî,
÷òî â ýòîì
ñëó÷àå
äàííûå
áóäóò
àäðåñîâàòüñÿ
ïðàâèëüíî, òàê
êàê åñëè
ïîäîáðàòü
ñìåùåíèå
ðàâíîå ðàçíèöå
ìåæäó
àäðåñîì
îïåðàíäà è
àäðåñîì òåêóùåé
êîìàíäû, òî
ýòà
ðàçíîñòü
âñåãäà áóäåò
ïîñòîÿííîé.
Ýòîò ðåæèì
àäðåñàöèè íàçûâàåòñÿ
îòíîñèòåëüíûì
è íà
àññåìáëåðå
çàïèñûâàåòñÿ
ïðîñòî êàê Addr,
ãäå Addr - àäðåñ îïåðàíäà.
Ðàññìîòðèì
âûïîëíåíèå
èíñòðóêöèè MOVB
10,(R2)
Äî îïåðàöèè
MOVB 10,(R2)
                                                            00000305  : 
90  ÊÎÏ
                                                            00000306  : 
CF  <———
ïðåäñòàâëåíèå
'@(R15)'
                                                            00000307  : 
07 
îòðèöàòåëüíîå
ñìåùåíèå (309-10),
                                                            00000308  : 
FD 
ïðåäñòàâëåííîå
â äîï. êîäå 
                                                            00000309  : 
62  <———
ïðåäñòàâëåíèå
'(R2)'
                         
                                                                        R2  = 00001000
                                                                      R15 
= 00000305
                                                           (00000010) = 00     
                                                           (00001000) = FF      (R2)
Ïîñëå...
                                                                        R2  = 00001000
                                                                      R15 
= 0000030A          <——— + 5
                                                           (00000010) = 00
                                                           (00001000) = 00                      <———     0
              
            Îòìåòèì,
÷òî
ñìåùåíèå â
äàííîì
ïðèìåðå îòðèöàòåëüíîå
è
ïðåäñòàâëåíî
â   äîïîëíèòåëüíîì
êîäå. Äëèíà
ñìåùåíèÿ è
ñîîòâåòñòâóþùèé
êîíêðåòíûé
êîä ðåæèìà
âû÷èñëÿåòñÿ
àâòîìàòè÷åñêè
íà ýòàïå
êîìïèëèðîâàíèÿ.
Åñëè
èñïîëüçîâàòü
ñ÷åò÷èê
èíñòðóêöèé
â êîñâåííîì
ðåæèìå ñî
ñìåùåíèåì, òî
ïîëó÷èì åùå
îäèí ñïîñîá
àäðåñàöèè,
êîòîðûé
íàçûâàåòñÿ
êîñâåííî-îòíîñèòåëüíûì.
Çäåñü ñóììà
ñîäåðæèìîãî
ñ÷åò÷èêà
èíñòðóêöèé
ñêëàäûâàåòñÿ
ñî
ñìåùåíèåì è
ðàññìàòðèâàåòñÿ
êàê àäðåñ
àäðåñà
îïåðàíäà. Äëÿ
ïðîãðàììèñòà
ýòîò ðåæèì
ÿâëÿåòñÿ
ïðîñòî
ðåæèìîì
êîñâåííîé
àäðåñàöèè ñ
èñïîëüçîâàíèåì
ïðîèçâîëüíîé
ÿ÷åéêè äëÿ
õðàíåíèÿ
àäðåñà. Êàê è
â ïðåäûäóùåì
ïðèìåðå
ñìåùåíèå
äîëæíî áûòü
ðàâíî
ðàçíèöå
ìåæäó
àäðåñîì
äàííîé
ÿ÷åéêè è
òåêóùèì
ïîëîæåíèåì
èíñòðóêöèè.
Íà àññåìáëåðå
ýòîò ðåæèì
îáîçíà÷àåòñÿ
@Addr, ãäå Addr - àäðåñ
ÿ÷åéêè, â
êîòîðîé
íàõîäèòñÿ
àäðåñ îïåðàíäà.
Ðàññìîòðèì    
èíñòðóêöèþ
MOVB @10,(R2):
Äî îïåðàöèè
MOVB @10,(R2)
                                                            00000305  : 
90  ÊÎÏ
                                                            00000306  : 
CC  <———
ïðåäñòàâëåíèå
'@W^FD7(R15)'
                                                            00000307  : 
07 
îòðèöàòåëüíîå
ñìåùåíèå (309-10), 
                                                            00000308  : 
FD 
ïðåäñòàâëåííîå
â äîï. êîäå 
                                                            00000309  : 
62  <———
ïðåäñòàâëåíèå
'(R2)'
                                                                        R2  = 00001000
                                                                      R15 
= 00000305
                                                           (00000000) = EE                      (00000010)
                                                           (00000010) = 00     
                                                           (00001000) = FF                      (R2)
Ïîñëå...
                                                                        R2  = 00001000
                                                                      R15 
= 0000030A          <——  + 5
                                                          (00000000) = EE
                                                          (00000010) = 00
                                                          (00001000) = EE                       <——  EE
2.11 
ÀÄÐÅÑÀÖÈß
ÏÅÐÅÕÎÄÎÂ.
           
Ïîñëåäíèé
ñïîñîá
àäðåñàöèè,
êîòîðûé áóäåò
ðàññìîòðåí -
ýòî
àäðåñàöèÿ  ïåðåõîäîâ.
Âîò ôîðìàò
èíñòðóêöèè
óñëîâíîãî
ïåðåõîäà:
7                                                                                                                                                            0
ÊÎÄ
ÎÏÅÐÀÖÈÈ
ÑÌÅÙÅÍÈÅ
Àäðåñàöèÿ
â ýòèõ
èíñòðóêöèÿõ
îòëè÷àåòñÿ
îò âñåõ
ðàññìàòðèâàåìûõ
òåì, ÷òî
çäåñü íåò
ñïåöèôèêàòîðà
îïåðàíäà.
Êàæäàÿ èíñòðóêöèÿ
óñëîâíîãî
ïåðåõîäà
ñîñòîèò èç
êîäà
îïåðàöèè è
ñëåäóþùåãî
çà íèì
áàéòíîãî
ñìåùåíèÿ ñî
çíàêîì. Ïðè
ôîðìèðîâàíèè
àäðåñà
ïåðåõîäà
ñìåùåíèå
ñêëàäûâàåòñÿ
ñ ñîäåðæèìûì
ñ÷åò÷èêà
èíñòðóêöèé
ïîäîáíî
òîìó, êàê ýòî
äåëàëîñü ïðè
îòíîñèòåëüíîé
àäðåñàöèè.
Ïî÷åìó âñåãî
128 áàéò ? Ýòî
îáóñëîâëåíî
òåì, ÷òî
áîëüøèíñòâî
ïåðåõîäîâ
àäðåñîâàíû ê
ÿ÷åéêàì, íàõîäÿùèìñÿ
íà
íåáîëüøîì
ðàññòîÿíèè
îò ñàìîé
èíñòðóêöèè
ïåðåõîäà.
Ëèøü â
íåêîòîðûõ
ñëó÷àÿõ
òðåáóåòñÿ
èñïîëüçîâàíèå
áîëåå
ýôôåêòèâíûõ
ðåæèìîâ
àäðåñàöèè.
3.   ÑÈÑÒÅÌÛ
ÀÄÐÅÑÀÖÈÈ
ÈÑÏÎËÜÇÓÅÌÛÅ
 ÏÝÂÌ
            Ñèñòåìû
àäðåñàöèè
èñïîëüçóåìûå
â ïåðñîíàëüíûõ
ÝÂÌ áóäóò
ðàññìîòðåíû
íà ïðèìåðå
32-ðàçðÿäíîãî
ïðîöåññîðà 80386
ôèðìû Intel. Âñå
÷òî êàñàåòñÿ
ýòîãî ïðîöåññîðà,
ñèñòåìû åãî
êîìàíä è
ñïîñîáîâ àäðåñàöèè
ìîæíî òàê æå
îòíåñòè ê
386-ûì ïðîöåññîðàì
ôèðì Cyrix è AMD (Advanced Micro Devices),
êîòîðûå
ïîëíîñòüþ ñîâìåñòèìû
ñ I80386. ÌÏ 80386
ïðåäñòàâëÿåò
ñîáîé âûñîêîïðîèçâîäèòåëüíûé
32-ðàçðÿäíûé
ìèêðîïðîöåññîð,
âûïîëíÿþùèé
3-4 ÌÎÏÑ (MIPS). Îí
îòëè÷àåòñÿ ïîëíîé
32-ðàçðÿäíîé
àðõèòåêòóðîé
ñ ôèçè÷åñêèì
àäðåñíûì
îñòðàíñòâîì
4 Ãáàéò è
âñòðîåííûìè
ñðåäñòâàìè
ñòðàíè÷íîé
âèðòóàëüíîé
ïàìÿòè, ÌÏ 80386
ìîæåò
àäðåñîâàòü 64
Òáàéò
âèðòóàëüíîé
ïàìÿòè.
Ñèñòåìà
êîìàíä ÌÏ 80386
ñîäåðæèò 9
êàòåãîðèé
êîìàíä:
ïåðåñûëêè
äàííûõ, àðèôìåòè÷åñêèõ,
ñäâèãà,
îáðàáîòêè
ñòðîê,
îáðàáîòêè
áèòîâ,
ïåðåäà÷è
óïðàâëåíèÿ, ïîääåðæêè
ÿçûêîâ
âûñîêîãî
óðîâíÿ,
ïîääåðæêè
îïåðàöèîííîé
ñèñòåìû è
óïðàâëåíèÿ
ïðîöåññîðîì.
Äëèíà
êîìàíäû â
ñðåäíåì
ñîñòàâëÿåò 2-3
áàéòà.
Îïåðàíäû
ìîãóò èìåòü
äëèíó 8,16 èëè 32
ðàçðÿäà.
            ÌÏ 80386
ðåàëèçóåò
ñåãìåíòíóþ
îðãàíèçàöèþ
ïàìÿòè, ïðè
êîòîðîé
ôèçè÷åñêèé
àäðåñ ÿ÷åéêè
âû÷èñëÿåòñÿ
ïóòåì
ñëîæåíèÿ
áàçîâîãî àäðåñà
ñåãìåíòà è
îòíîñèòåëüíîãî
àäðåñà
ÿ÷åéêè
âíóòðè
ñåãìåíòà.
Áàçîâûé
àäðåñ îïðåäåëÿåòñÿ
ñîäåðæèìûì
16-ðàçðÿäíîãî
ñåãìåíòíîãî 
ðåãèñòðà è
çàâèñèò îò
ðåæèìà ðàáîòû
ìèêðîïðîöåññîðà.
Åñëè
ìèêðîïðîöåññîð
ðàáîòàåò â
ðåæèìå
îáðàáîòêè
16-ðàçðÿäíûõ
äàííûõ (
ðåæèì
ðåàëüíûõ
àäðåñîâ èëè
ðåæèì
âèðòóàëüíîãî
ïðîöåññîðà 8086),
òî 20-ðàçðÿäíûé
áàçîâûé
àäðåñ
ôîðìèðóåòñÿ
ïóòåì ñäâèãà
ñîäåðæèìîãî
ñåãìåíòíîãî
ðåãèñòðà íà ÷åòûðå
ðàçðÿäà
âëåâî. Ò.å.
åñëè â
ñåãìåíòíîì
ðåãèñòðå
ñîäåðæèòñÿ
÷èñëî 45F7, òî
áàçîâûé àäðåñ
áóäåò 45F70. Åñëè
ìèêðîïðîöåññîð
ðàáîòàåò â
ðåæèìå
îáðàáîòêè
32-ðàçðÿäíûõ
äàííûõ ( çàùèùåííûé
ðåæèì ), òî
32-ðàçðÿäíûé
áàçîâûé
àäðåñ ñîäåðæèòñÿ
â
äåñêðèïòîðå,
âûáîð
êîòîðîãî èç
òàáëèöû
äåñêðèïòîðîâ
îñóùåñòâëÿåòñÿ
ñ ïîìîùüþ
ñåëåêòîðà -
ñîäåðæèìîãî
ñîîòâåòñòâóþùåãî
ñåãìåíòíîãî
ðåãèñòðà. Â
çàâèñèìîñòè
îò òèïà
îáðàùåíèÿ ê
ïàìÿòè
ïðîèçâîäèòñÿ
âûáîð
ñåãìåíòíîãî
ðåãèñòðà è
ñïîñîáà
îïðåäåëåíèÿ
îòíîñèòåëüíîãî
àäðåñà. Äëÿ   
íåêîòîðûõ
ñïîñîáîâ
îáðàùåíèÿ ê
ïàìÿòè
âîçìîæíû
âàðèàíòû
âûáîðà
ñåãìåíòíûõ
ðåãèñòðîâ.
Ýòè
âàðèàíòû
ìîãóò áûòü âûáðàíû
ñ ïîìîùüþ
ïðåôèêñà
çàìåíû
ñåãìåíòà SEG.
Íà
ìíåìîíèêå
àññåìáëåðà
ýòî âûãëÿäèò
ïðîñòî êàê DS:[?],
ES:[?], CS:[?], FS:[?] è ò.ä. Â
êà÷åñòâå îòíîñèòåëüíîãî
àäðåñà
èñïîëüçóåòñÿ
ñîäåðæèìîå
ðåãèñòðîâ  EIP(IP), ESP(SP), ESI(SI), EDI(DI)
èëè ýôôåêòèâíûé
àäðåñ EA,
êîòîðûé
ôîðìèðóåòñÿ
â ñîîòâåòñòâèè
ñ çàäàííûì
ñïîñîáîì
àäðåñàöèè (êîñâåííûé,
èíäåêñíûé è
ò.ä.).
    1.
Âûáîðêà
êîìàíä.
      
Ñåãìåíòíûé
ðåãèñòð                       CS                   (
Code Segment )
      
Îòíîñèòåëüíûé
àäðåñ          EIP(IP)            ( Instruction
Pointer )
    2.
Îáðàùåíèå ê
ñòåêó.
      
Ñåãìåíòíûé
ðåãèñòð                       SS                    ( Stack Segment )
      
Îòíîñèòåëüíûé
àäðåñ          ESP(SP)          ( Stack Pointer )
    3.
Àäðåñàöèÿ
îïåðàíäà.
      
Ñåãìåíòíûé
ðåãèñòð                       DS
èëè (CS,SS,ES,FS,GS)
      
Îòíîñèòåëüíûé
àäðåñ          EA
    4.
Àäðåñàöèÿ
ýëåìåíòà
ñòðîêè-èñòî÷íèêà.
      
Ñåãìåíòíûé
ðåãèñòð                       DS
èëè (CS,SS,ES,FS,GS)
      
Îòíîñèòåëüíûé
àäðåñ          ESI(SI)
    5.
Àäðåñàöèÿ
ýëåìåíòà
ñòðîêè-ïðèåìíèêà.
      
Ñåãìåíòíûé
ðåãèñòð                       ES
      
Îòíîñèòåëüíûé
àäðåñ          EDI(DI)
    6.
Àäðåñàöèÿ
îïåðàíäà ñ
èñïîëüçîâàíèåì
â êà÷åñòâå
áàçîâîãî
ðåãèñòðà EBP(BP)                                                          èëè ESP(SP).
      
Ñåãìåíòíûé
ðåãèñòð                       SS
èëè (CS,DS,ES,FS,GS)
      
Îòíîñèòåëüíûé
àäðåñ          EA
Ýôôåêòèâíûé
àäðåñ
îïåðàíäà EA
ÿâëÿåòñÿ 16- èëè
32-ðàçðÿäíûì è
ôîðìèðóåòñÿ
â
çàâèñèìîñòè
îò çíà÷åíèÿ
îïðåäåëåííûõ
ïîëåé â
ïðåäñòàâëåíèè
êîìàíäû. Â
îáùåì
ñëó÷àå EA
îáðàçóåòñÿ
ïóòåì
ñëîæåíèÿ
òðåõ
êîìïîíåíò:
·
ñîäåðæèìîãî
áàçîâîãî
ðåãèñòðà EBP(BP)
èëè EBX(BX);
·
ñîäåðæèìîãî
èíäåêñíîãî
ðåãèñòðà ESI(SI)
èëè EDI(DI);
·
8-, 16- èëè
32-ðàçðÿäíîãî
ñìåùåíèÿ,
çàäàííîãî
íåïîñðåäñòâåííî
â êîìàíäå.
Â
ðàçíûõ
ñëó÷àÿõ äëÿ
ôîðìèðîâàíèÿ
EA èñïîëüçóþòñÿ
ëèáî âñå
ëèáî ÷àñòü
ýòèõ
ñëàãàåìûõ.
Òåïåðü
ðàññìîòðèì
êîíêðåòíûå
ñïîñîáû
àäðåñàöèè.
3.1 
ÍÅÏÎÑÐÅÄÑÒÂÅÍÍÀß
ÀÄÐÅÑÀÖÈß.
            Â
êà÷åñòâå
îïåðàíäà
èñïîëüçóåòñÿ
îäèí, äâà èëè
÷åòûðå
ïîñëåäíèõ  áàéòà
êîìàíäû.
Òàêîé
ñïîñîá
àäðåñàöèè
ðåàëèçóåòñÿ
ïðè
âûïîëíåíèè
ðÿäà êîìàíä
ïåðåñûëêè (MOV, PUSH),
àðèôìåòè÷åñêèõ
îïåðàöèÿõ (ADD, ADC, SUB,
SBB, CMP, IMUL), è ëîãè÷åñêèõ
(AND, OR, XOR, TEST).
Ðàññìîòðèì
ïðîñòîé
ïðèìåð -
óìíîæåíèå ñîäåðæèìîãî
ðåãèñòðà íà
êîíñòàíòó:
Ðåãèñòðû äî
âûïîëíåíèÿ
IMUL  AX,5
                                                            AX
= 10
Ïîñëå...
                                                            AX
= 50
3.2 
ÐÅÃÈÑÒÐÎÂÀß
ÀÄÐÅÑÀÖÈß.
            Ïðè ýòîì
ñïîñîáå
àäðåñàöèè
îïåðàíäîì
áåðåòñÿ
ñîäåðæèìîå
ðåãèñòðà.
Íàïðèìåð äëÿ 
îïåðàöèè
çàíåñåíèÿ
íà ñòåê
ðåàëèçàöèÿ
ðåãèñòðîâîãî
ñïîñîáà
àäðåñàöèè áóäåò
âûãëÿäåòü
êàê PUSH DS.
Ðåãèñòðû äî
âûïîëíåíèÿ PUSH DS
                                                            DS
= 5678h
                                                            SP
= FFFEh
                                                 SS:FFFE = 0000h
Ïîñëå...
                                                            DS
= 5678
                                                            SP
= FFFDh
                                                 SS:FFFD = 5678
                                                 SS:FFFE = 0000
Êàê âèäíî
èç ïðèìåðà
çíà÷åíèå
ðåãèñòðà DS áûëî
çàíåñåíî íà
ñòåê.
3.3 
ÊÎÑÂÅÍÍÎ-ÐÅÃÈÑÒÐÎÂÀß
ÀÄÐÅÑÀÖÈß.
            Ïðè
òàêîé
àäðåñàöèè
îòíîñèòåëüíûé
àäðåñ
ñîäåðæèòñÿ â
èíäåêñíîì (SI, DI,
ESI, EDI) èëè
áàçîâîì ( BX, BP, EBX, EBP)
ðåãèñòðàõ
èëè â
ðåãèñòðàõ
îáùåãî íàçíà÷åíèÿ
EAX, ECX, EDX. Àäðåñ
îïåðàíäà
âû÷èñëÿåòñÿ
êàê
ñåãìåíò:ñìåùåíèå.
Ñìåùåíèå
ïðåäñòàâëåíî
ýôôåêòèâíûì
àäðåñîì.
            Äëÿ
ïðèìåðà
ðàññìîòðèì
êîìàíäó MOV  EBX,[EDI], êîòîðàÿ
ïåðåñûëàåò
ñîäåðæèìîå
ÿ÷åéêè DS:[EDI] â ðåãèñòð
EBX. (  êà÷åñòâå
ðàçìåðà
îïåðàíäà
áåðåòñÿ
äâîéíîå
ñëîâî - 4
áàéòà.
Ðåãèñòðû äî
âûïîëíåíèÿ MOV
EBX,[EDI]
                                                            EBX
= 5678h
                                                            EDI
= 0100h
                                                   DS:0100h = 1221h   (edi)
Ïîñëå...
                                                            EBX
= 1221h               <——— 1221h
                                                            EDI
= 0100h
                                                   DS:0100h = 1221h
Ïðèìåð â
êîììåíòàðèÿõ
íå
íóæäàåòñÿ.
×èñëî, àäðåñ
êîòîðîãî DS:EDI
áûëî
óñïåøíî
çàíåñåíî â
ðåãèñòð EBX.
Ðåãèñòð DS
èñïîëüçîâàëñÿ
ïî óìîë÷àíèþ.
3.4  ÏÐßÌÀß
ÀÄÐÅÑÀÖÈß.
            Ïðè ýòîì
ñïîñîáå
àäðåñàöèè
ñìåùåíèå â
ñåãìåíòå äî
îïåðàíäà
çàäàíî â
âèäå ñëîâà
èëè
äâîéíîãî
ñëîâà â êîäå
êîìàíäû.  Äëÿ 
ïðèìåðà âîçüìåì
îïåðàöèþ MOV EAX,[1994h],
ïåðåñûëàþùóþ
äâîéíîå ñëîâî
ïî àäðåñó DS:1994 â
ðåãèñòð EAX.
Ðåãèñòðû äî
âûïîëíåíèÿ MOV
EAX,[1994h]
                                                            EAX
= 0000h
                                                    DS:1994h = 5000h
Ïîñëå...
                                                            EAX
= 5000h              <—— 5000h
                                                    DS:1994h = 5000h   
Èç
ïðèìåðà
âèäíî, ÷òî
÷èñëî, ïðÿìî
àäðåñîâàííîå
êàê ds:[1994h] áûëî
ñêîïèðîâàíî
â çàäàííûé ðåãèñòð.
3.5 
ÁÀÇÎÂÀß
ÀÄÐÅÑÀÖÈß.
            Îòíîñèòåëüíûé
àäðåñ
îïåðàíäà
ôîðìèðóåòñÿ
ïðè ñëîæåíèè
ñîäåðæèìîãî
áàçîâîãî ðåãèñòðà
ñ
íåïîñðåäñòâåííûì
ñìåùåíèåì.
Ñìåùåíèå
ìîæåò áûòü
ïðåäñòàâëåíî
ñëîâîì èëè
äâîéíûì
ñëîâîì.
Ðàññìîòðèì
èíñòðóêöèþ ADD
AX,[BP+10h], êîòîðàÿ ê
ñîäåðæèìîìó
ðåãèñòðà AX
ïðèáàâëÿåò
÷èñëî, àäðåñ
êîòîðîãî DS:[BP+10h]...
Ðåãèñòðû äî
âûïîëíåíèÿ ADD
AX,[BP+10h]
                                                            AX  = 0067h
                                                            BP  = 0100h
                                                  DS:0100h = 0000h                 (bp)
                                                  DS:0101h = 0001h
                                                            ·  · 
·  ·  ·  ·
                                                  DS:0109h = 0009h
                                                  DS:0110h = 0010h    (bp+10h)
Ïîñëå...
                                                            AX  = 0077h   <——  (67h+10h = 77h)
                                                            BP  = 0100h
                                                  DS:0100h = 0000h
                                                  DS:0101h = 0001h
                                                            ·  · 
·  ·  ·  ·
                                                  DS:0109h = 0009h
                                                  DS:0110h = 0010h
Êàê
âèäíî èç
ïðèìåðà, ê
ñîäåðæèìîìó
BP áûëî äîáàâëåíî
10h è
ïîëó÷èëîñü
ñìåùåíèå 110h,
ïî êîòîðîìó
è áûëî âçÿòî
÷èñëî,
ïðèáàâëåííîå
ê AX.
3.6 
ÈÍÄÅÊÑÍÀß
ÀÄÐÅÑÀÖÈß.
            Ïðèìåðíî
òîæå ñàìîå,
÷òî è
áàçîâàÿ
àäðåñàöèÿ,
îäíàêî çäåñü
è
èñïîëüçóþòñÿ
èíäåêñíûå
ðåãèñòðû ( SI,DI ) è
ñìåùåíèå
çàäàííîå
áàéòîì èëè
ñëîâîì. Ïðè
ôîðìèðîâàíèè
32-ðàçðÿäíûõ àäðåñîâ,
â êà÷åñòâå
áàçîâîãî
èëè èíäåêñíîãî
ìîæåò
èñïîëüçîâàòüñÿ
ëþáîé èç
ðåãèñòðîâ EAX, ECX, EDX,
EBX, EBP, ESI, EDI.. Äëÿ
ïðèìåðà
âîçüìåì
èíñòðóêöèþ MOV
WORD PTR ES:[DI+2],AX, êîòîðàÿ
ïî àäðåñó ES:[DI+2]
çàøëåò
ñëîâî èç AX.
Ðåãèñòðû äî
âûïîëíåíèÿ MOV WORD
PTR ES:[DI+2],AX
                                                            AX  = 0099h
                                                            DI  = 000Dh
                                                 ES:000Dh = 0000h                 (di)
                                                 ES:000Fh = 0000h                  (di+2)
Ïîñëå...
                                                            AX  = 0099h
                                                            DI  = 000Dh
                                                 ES:000Dh = 0000h
                                                 ES:000Fh = 0099h                  <—— 99h
Àäðåñ
ÿ÷åéêè ES:000Fh áûë
ïîñ÷èòàí
êàê ñîäåðæèìîå
DI ïëþñ 2 = F. ×èñëî 99h
èç ðåãèñòðà AX
óñïåøíî
ñêîïèðîâàíî
â ýòó ÿ÷åéêó
ïàìÿòè.
3.7  ÁÀÇÎÂÎ-ÈÍÄÅÊÑÍÀß
ÀÄÐÅÑÀÖÈß.
            Ïðè
èñïîëüçîâàíèè
ýòîãî
ñïîñîáà
îòíîñèòåëüíûé
àäðåñ
îáðàçóåòñÿ
ïóòåì
ñëîæåíèÿ
ñîäåðæèìûõ
áàçîâîãî ( BX,BP ) è
èíäåêñíîãî (
SI,DI ) ðåãèñòðîâ.
Íàïðèìåð äëÿ
îïåðàöèè MOV AX,[BP+SI]
ìû ïîëó÷èì:
Ðåãèñòðû äî
âûïîëíåíèÿ MOV
AX,[BP+SI]
                                                            AX  = 00AAh
                                                            BP  = 0100h
                                                            SI  = 0050h
                                                  DS:0100h = 0001h                 (bp)
                                             DS:0150h = 0002h                      (bp+si)
Ïîñëå...
                                                            AX  = 0002h 
              <—— 02h
                                                            BP  = 0100h
                                                            SI  = 0050h
                                                 DS:0100h = 0001h
                                                 DS:0150h = 0002h
Àäðåñ
ÿ÷åéêè DS:0150h
ïîëó÷åí
ïóòåì
ñëîæåíèÿ çíà÷åíèé
ðåãèñòðîâ BP è SI,
ïîñëå ÷åãî
÷èñëî èç ýòîé
ÿ÷åéêè
ïàìÿòè áûë
çàãðóæåí â
ðåãèñòð AX.
3.8 
ÁÀÇÎÂÎ-ÈÍÄÅÊÑÍÀß
ÀÄÐÅÑÀÖÈß ÑÎ
ÑÌÅÙÅÍÈÅÌ.
            Ýòî
âàðèàíò
áàçîâî
èíäåêñíîé
àäðåñàöèè,
ïðè êîòîðîì ê
îòíîñèòåëüíîìó
àäðåñó ïðèáàâëÿåòñÿ
8- èëè
16-ðàçðÿäíîå
ñìåùåíèå.
Äîïîëíèòåëüíûå
ñïîñîáû
àäðåñàöèè
ðåàëèçóþòñÿ
ïðè
èñïîëüçîâàíèè
32-ðàçðÿäíûõ
àäðåñîâ, êîãäà
çàäàíî
ñïåöèàëüíîå
ïîëå (SIB) â êîäå
êîìàíäû.
Òîãäà
âîçìîæíû
êîíñòðóêöèè
òèïà [EAX+EBX], [EAX+EAX], [ECX+EDX], Â
êà÷åñòâå
èíäåêñíîãî
ðåãèñòðà
ìîæíî èñïîëüçîâàòü
ëþáîé
ðåãèñòð
êðîìå ESP.
Ñîäåðæèìîå
ýòîãî
ðåãèñòðà
óìíîæàåòñÿ
íà ìàñøòàáíûé
êîýôôèöèåíò
F ò.å.
ñäâèãàåòñÿ
âëåâî íà
÷èñëî
ðàçðÿäîâ 0,1,3
èëè 4.
Çíà÷åíèå F
çàâèñèò îò
ðàçìåðà
äàííûõ. Äëÿ
ïðèìåðà
ðàññìîòðèì
èíñòðóêöèþ MOV
EAX,[EAX+EAX].
Ðåãèñòðû äî
âûïîëíåíèÿ  MOV EAX,[EAX+EAX]
                                                            EAX  = 0010h
                                                            DS:0010h
= 000Ah                  (eax)
                                                            DS:0020h
= 000Bh                  (eax+eax)
Ïîñëå...
                                                            EAX  = 000Bh 
                       <—— 0Bh
                                                     DS:0010h = 000Ah
                                                     DS:0020h = 000Bh
Áàçîâûé
àäðåñ
áåðåòñÿ èç EAX,
ñêëàäûâàåòñÿ
ñî ñìåùåíèåì
èç EAX è
äâîéíîå
ñëîâî ïî
àäðåñó DS:0020h çàíîñèòñÿ
â EAX.
3.9 
ÈÍÄÅÊÑÍÀß
ÀÄÐÅÑÀÖÈß Ñ
ÌÀÑØÒÀÁÈÐÎÂÀÍÈÅÌ
                    
            Ïðè
èñïîëüçîâàíèè
ýòîãî
ñïîñîáà
àäðåñàöèè
îòíîñèòåëüíûé
àäðåñ
ôîðìèðóåòñÿ
ïðè ñëîæåíèè
ìàñøòàáèðîâàííîãî
èíäåêñà ( ñîäåðæèìîãî
èíäåêñíîãî
ðåãèñòðà ) è
32-ðàçðÿäíîãî
ñìåùåíèÿ.
Ïîÿñíèì
èäåþ
ìàñøòàáèðîâàíèÿ
èíäåêñà:
ñîäåðæèìîå
èíäåêñíîãî
ðåãèñòðà
óìíîæàåòñÿ
íà
ìàñøòàáíûé
êîýôôèöèåíò,
÷òîáû
ïðàâèëüíî
àäðåñîâàòü
äàííûå
ðàçìåðîì
áîëåå îäíîãî
áàéòà. Äëÿ
ïðèìåðà
ðàññìîòðèì
ôðàãìåíò
ïðîãðàììû,
îñóùåñòâëÿþùåé
ðàáîòó ñ
öåïî÷êîé äâîéíûõ-ñëîâ.
                                    Start:    jmp      Begin
                                   
                                    Var      dd        5
dup (0)
                                   
                                    Begin:
                                                mov      edi,2                            
                       ; 1
                                                mov      [Var+edi*4],12345678h                     ;
2
                                   
Ïåðåìåííàÿ
Var
ïðåäñòàâëÿåò
ñîáîé
ìàññèâ èç 5
32-ðàçðÿäíûõ
ñëîâ. Â
ñòðîêå 1 ìû
çàíîñèì â èíäåêñíûé
ðåãèñòð 2,
èìåÿ ââèäó
îáðàáîòêó âòîðîãî
ýëåìåíòà
ìàññèâà, à
äàëåå â ñòðîêå
2 ìû çàíîñèì
âî âòîðîé 
ýëåìåíò ÷èñëî
1234567h. Íà ïàñêàëå
ýòî
âûãëÿäåëî-áû
êàê Y[2]:=$1234567   
Åñëè áû ìû
íå ïðîèçâåëè ìàñøòàáèðîâàíèå,
òî ÷èñëî 1234567h
áûëî-áû çàíåñåíî
ïî àäðåñó [Y+2], à
ïðè
ìàñøòàáèðîâàíèè
ðåàëüíûé
àäðåñ áûë
âû÷èñëåí
êàê [Y+2*4] ò.å. [Y+8] è
÷èñëî ïîïàëî
"ïî àäðåñó".
Èñïîëüçîâàíèå
ìàñøòàáèðîâàíèÿ
èìååò
îãðîìíóþ
ðîëü ïðè ðàáîòå
ñ
ìàññèâàìè
ñëîâ è
äâîéíûõ
ñëîâ, èçáàâëÿÿ
ïðîãðàììèñòà
îò
íåîáõîäèìîñòè
äîïîëíèòåëüíîãî
èíäåêñèðîâàíèÿ
ïåðåìåííûõ
è ðàáîòû ñ
óäâîåííûìè
è
ó÷åòâåðåííûìè
èíäåêñàìè
ýëåìåíòîâ.
Âñå ýòî çà
íåãî âûïîëíÿåò
ïðîöåññîð,
ñîêðàùàÿ è
ðàçìåð êîäà è
ñêîðîñòü åãî
âûïîëíåíèÿ.
3.10 
ÁÀÇÎÂÎ-ÈÍÄÅÊÑÍÀß
ÀÄÐÅÑÀÖÈß Ñ
ÌÀÑØÒÀÁÈÐÎÂÀÍÈÅÌ
 
            Îòíîñèòåëüíûé
àäðåñ
ôîðìèðóåòñÿ
ñëîæåíèåì
ìàñøòàáèðîâàííîãî
èíäåêñà è
áàçû, â
êà÷åñòâå
êîòîðîé
èñïîëüçóåòñÿ
ñîäåðæèìîå
îäíîãî èç
ðåãèñòðîâ
EAX,EBX,ECX,EDX,ESI èëè EDI.
Ïðèâåäåì ïðèìåð
òàêîé
àäðåñàöèè
äàííûõ:
Èíñòðóêöèÿ MOV
[EAX+EDI*4],666h ïîìåñòèò
÷èñëî 666h ïî
àäðåñó EAX ïëþñ
ó÷åòâåðåííîå
ñîäåðæèìîå EDI.
   
Ðåãèñòðû äî
âûïîëíåíèÿ  MOV [EAX+EDI*4],666h
                                                            EAX  = 0100h
                                                            EDI  = 0002h
                                                   DS:0100h = 000Ah               (eax)  
                                                   DS:0104h = 000Bh  
                                                   DS:0108h = 000Ch               (eax+edi*4)
Ïîñëå...
                                                            EAX  = 0100h
                                                            EDI  = 0002h
                                                   DS:0100h = 000Ah               (eax)  
                                                   DS:0104h = 000Bh  
                                                   DS:0108h = 0666h                            <——
666h
       
Ìàñøòàáèðîâàíèå
ïîçâîëèëî
àäðåñîâàòü èìåííî
2-å 32-ðàçðÿäíîå
ñëîâî, à íå
çàïèñàòü ÷èñëî
666h ïî àäðåñó EAX+2
ò.å. 102h, êîòîðûé
ïîïàäàåò ïî ñåðåäèíå
äâóõ
ýëåìåíòîâ
ìàññèâà.       
3.11 
ÁÀÇÎÂÎ-ÈÍÄÅÊÑÍÀß
ÀÄÐÅÑÀÖÈß ÑÎ
ÑÌÅÙÅÍÈÅÌ È
ÌÀÑØÒÀÁÈÐÎÂÀÍÈÅÌ
 
            Ýòîò
ñïîñîá
àäðåñàöèè
ðàññìîòðåí
â ïóíêòå 3.6 ïðè
èñïîëüçîâàíèè 
32-ðàçðÿäíîé
àäðåñàöèè.
Ïîýòîìó
ïðèâåäåì
ëèøü ïðèìåð
èíñòðóêöèè è
îïèøåì åå
äåéñòâèÿ.
Èíñòðóêöèÿ INC
[EAX+EDI*4+12345678h] óâåëè÷èò
íà åäèíèöó
÷èñëî, àäðåñ
êîòîðîãî âû÷èñëÿåòñÿ,
êàê áàçîâûé
ïëþñ
32-ðàçðÿäíîå
ñìåùåíèå 12345678h
è ïëþñ
ìàñøòàáèðîâàííûé
ïî îñíîâàíèþ
4 èíäåêñ,
ñîäåðæàùèéñÿ
â ðåãèñòðå EDI.
3.12 
ÎÒÍÎÑÈÒÅËÜÍÀß
ÀÄÐÅÑÀÖÈß
           
            Îòíîñèòåëüíàÿ
àäðåñàöèÿ
èñïîëüçóåòñÿ
â ìèêðîïðîöåññîðå
80386 ïðè
âûïîëíåíèè
ðÿäà êîìàíä
óïðàâëåíèÿ (
óñëîâíûå è
áåçóñëîâíûå
ïåðåõîäû,
âûçîâû
ïîäïðîãðàìì,
óïðàâëåíèå
öèêëàìè è ò.ä.
), ÷òîáû
àäðåñîâàòü
ÿ÷åéêó
ïàìÿòè,
ñîäåðæàùóþ
ñëåäóþùóþ
êîìàíäó. Ïðè
ýòîì
ñïîñîáå
àäðåñ
ôîðìèðóåòñÿ
êàê ñóììà
ñîäåðæèìîãî
ðåãèñòðà EIP(IP) ( instruction
pointer - óêàçàòåëü
èíñòðóêöèè ),
ñîîòâåòñòâóþùåãî
òåêóùåé
êîìàíäå, è 8-, 16-
èëè
32-ðàçðÿäíîãî   
ñìåùåíèÿ,
îïðåäåëÿþùåãî
ïîëîæåíèå
ñëåäóþùåé
êîìàíäû,
îòíîñèòåëüíî
òåêóùåé.
Íàïðèìåð
ðàññìîòðèì
îïåðàöèþ
áåçóñëîâíîãî
ïåðåõîäà â
ïðèâåäåííîì
ôðàãìåíòå:
                                                                        .
                                                                        .          
                                                                        mov      ax,5
                                                                        jmp      @1
                                                            sub       ax,ax
                                                @1:      mov      bx,ax
                                                                        .
                                                                        .                      
Áåçóñëîâíûé
ïåðåõîä
áóäåò
ïðåäñòàâëåí
êàê JMP 02, ò.å. íà 2
áàéòà
âïåðåä, ïîñëå
èíñòðóêöèè. SUB
AX,AX çàíèìàåò â
ïàìÿòè
ñëîâî,
çíà÷èò
ïåðåõîä
áóäåò
ïåðåäàí íà
êîìàíäó MOV BX,AX
ò.å. ïî àäðåñó
CS:IP+2. (Ýòî
íåìíîãî
óïðîùåííûé
ïðèìåð
âíóòðèñåãìåíòíîãî
ïåðåõîäà. Íà
ñàìîì äåëå
ïðè ïåðåõîäàõ
ìåíåå ÷åì íà
128 áàéò
èñïîëüçóåòñÿ
êîðîòêèé
ïåðåõîä EB??90, ãäå ??
- ýòî ðàçìåð
êîäà êîòîðûé
íàäî
ïðîïóñòèòü + 1
áàéò.
Äîïîëíèòåëüíûé
áàéò
ïðèáàâëÿåòñÿ
çà ñ÷åò êîäà
90h ñëåäóþùåãî
çà
ñìåùåíèåì.
Ýòîò êîä 
ïðåäñòàâëÿåò
ñîáîé êîä
èíñòðóêöèè NOP
( no operation ),
ïðèñóòñòâèå
åãî
àáñîëþòíî
áåñïîëåçíî,
íî ñëîæèëîñü
èñòîðè÷åñêè,
è áîëüøå íå
èñïðàâëÿëîñü.
Áàéò ?? - ýòî
áàéò ñî
çíàêîì, òàê
÷òî ïåðåõîä
âîçìîæåí
êàê âïåðåä, òàê
è   
íàçàä. À âîò
ïðè
ïåðåõîäàõ
áîëåå ÷åì íà
127 áàéò
èñïîëüçóåòñÿ
êîìàíäà  E9???? ,
îïèñàííàÿ
âûøå ).
4.
ÇÀÊËÞ×ÅÍÈÅ.
ÑÐÀÂÍÈÒÅËÜÍÛÉ
ÀÍÀËÈÇ ÑÈÑÒÅÌ
ÀÄÐÅÑÀÖÈÈ    
ÈÑÏÎËÜÇÓÅÌÛÕ
 CM1700 È Â ÏÝÂÌ ÍÀ
ÁÀÇÅ
ÏÐÎÖÅÑÑÎÐÀ 80386.
   
            Â äâóõ
ïðåäûäóùèõ
ðàçäåëàõ ìû
ïðèâåëè ïðèìåðû
è îïèñàëè
îñíîâíûå ñïîñîáû
àäðåñàöèè,
èñïîëüçóåìûå
â ìàøèíàõ
äâóõ ðàçíûõ
ñåìåéñòâ -
ìèíè- è
ìèêðîÝÂÌ.
Êîíå÷íî ýòî
íå âñå, ÷òî
ìîæíî
ñêàçàòü î ñèñòåìàõ
àäðåñàöèè
äëÿ
êîìïüþòåðîâ
ýòèõ
ñåìåéñòâ,
òåì íå ìåíåå
îñíîâíûå
ñïîñîáû
çàäàíèÿ
àäðåñîâ è
àäðåñàöèè
îïåðàíäîâ áûëè
ðàññìîòðåíû
è ìîæíî
ïîïûòàòüñÿ
ïðîàíàëèçèðîâàòü,
ñðàâíèòü è
ïðèâåñòè
ïðèìåðû èñïîëüçîâàíèÿ
òåõ
ñïîñîáîâ
àäðåñàöèè, êîòîðûå
áûëè
îïèñàíû.
            Äëÿ
íà÷àëà,
ðàññìîòðèì
ñàìûå
ïðîñòûå ñïîñîáû
àäðåñàöèè,
òàêèå êàê
ðåãèñòðîâàÿ,
ïðÿìàÿ,
íåïîñðåäñòâåííàÿ
è êîðîòêîãî
ëèòåðàëà. Ïðî
ðåãèñòðîâóþ
àäðåñàöèþ
òðóäíî
íàïèñàòü
áîëüøå, ÷åì
óæå áûëî
íàïèñàíî.
Åñòåñòâåííî,
÷òî ýòîò
ñïîñîá
àäðåñàöèè
ïîääåðæèâàåòñÿ
è íà ÑÌ1700 è 80386
ïðîöåññîðîì,
êàê âïðî÷åì
âîîáùå
âñåìè
ïðîöåññîðàìè
ñåìåéñòâà
80õ86 è ìíîãèìè
äðóãèìè
ïðîöåññîðàìè,
êîòîðûå èìåþò
ðåãèñòðîâóþ
ïàìÿòü.
Íåñìîòðÿ íà
ïðîñòîòó
ýòîãî
ñïîñîáà
àäðåñàöèè,
îí äîñòàòî÷íî
÷àñòî
èñïîëüçóåòñÿ
äëÿ
ìàíèïóëÿöèè
ðåãèñòðàìè,
èõ î÷èñòêè,
ìîäèôèêàöèè
èõ
ñîäåðæèìîãî.
Ðåãèñòðîâàÿ
ïàìÿòü
îòëè÷àåòñÿ
î÷åíü
áîëüøîé
ñêîðîñòüþ, è
ïîýòîìó áîëüøèíñòâî
âû÷èñëåíèé,
îñîáåííî
íåñëîæíûõ
ïðîãðàììèñòû
ïûòàþòñÿ
äåëàòü â
ýòèõ
ðåãèñòðàõ. Â
íèõ ïîìåùàþò
íà÷àëüíûå
çíà÷åíèÿ,
ïðîèçâîäÿò
âû÷èñëåíèÿ,
ìîäèôèêàöèþ
è êàê-òî
èñïîëüçóþò
ïîëó÷åííûå
ðåçóëüòàòû.
Äëÿ âñåõ
ýòèõ äåéñòâèé
åñòåñòâåííûì
ÿâëÿåòñÿ
ïðèìåíåíèå
èìåííî
ðåãèñòðîâîãî
ñïîñîáà
àäðåñàöèè. Áîëüøèì
ïîäñïîðüåì
ðåãèñòðîâîìó
ñïîñîáó àäðåñàöèè
ÿâëÿåòñÿ
ðåæèì
íåïîñðåäñòâåííîé
àäðåñàöèè.
Êîíå÷íî â
îñíîâíîì îí
èñïîëüçóåòñÿ
äëÿ çàãðóçêè
â ðåãèñòðû
íà÷àëüíûõ
çíà÷åíèé,
çàðàíåå
èçâåñòíûõ
àäðåñîâ,
ñðàâíåíèÿ ñ
êîíñòàíòîé
è òàê äàëåå. Íî
åñëè
êîïíóòü
÷óòü ãëóáæå,
òî ýòîò
ñïîñîá
àäðåñàöèè
äàåò åùå
ìíîæåñòâî
óäîáñòâ. Íàïðèìåð
äëÿ ïåðåõîäà
ïî çàðàíåå
èçâåñòíîìó
àäðåñó
ïðåäñòàâëåííîìó
â âèäå ñåãìåíòà
ñî
ñìåùåíèåì
ìîæíî
èñïîëüçîâàòü
òàêîé êîä:
                                               
push     0f000h
push     0ffffh
ret
                                                                            
Êîìàíäà
RET áåðåò èç
ñòåêà
çíà÷åíèÿ
ñåãìåíòà è
ñìåùåíèÿ, à
ïîòîì äåëàåò
ìåæñåãìåíòíûé
ïåðåõîä.
Ïðåäñòàâèì
ñåáå,
âûïîëíåíèå
ïîäîáíîãî
êîäà áåç
âîçìîæíîñòè
ïîìåùàòü íà
âåðøèíó
ñòåêà
íåïîñðåäñòâåííîå
çíà÷åíèå:
mov      ax,0f000h
push     ax
mov      ax,0ffffh
push     ax
ret
Êàê
âèäèì,
âûãëÿäèò
ýòî íå
ñëèøêîì
êîìïàêòíî, â
ñðàâíåíèè ñ
ïðåäûäóùèì
ïðèìåðîì, è ìîæåòå
áûòü
óâåðåíû, ÷òî
âûïîëíÿåòñÿ
ýòî íà
íåñêîëüêî
òàêòîâ
äîëüøå. Ýòî
ñàìûé ïðîñòîé
ïðèìåð
ïðèìåíåíèÿ
íåïîñðåäñòâåííîé
àäðåñàöèè,
íà ñàìîì
äåëå åå
ïðèìåíåíèå ãîðàçäî
øèðå,
îñîáåííî
åñëè
èíòåíñèâíî èñïîëüçóþòñÿ
ðàáîòà ñ
îïåðàöèîííîé
ñèñòåìîé,
ãäå âñå
çíà÷åíèÿ,
àäðåñà è
ïàðàìåòðû
ñòàíäàðòèçèðîâàíû
è â îñíîâíîì
çàðàíåå
èçâåñòíû. Íà
ÑÌ 1700 ðåæèì
íåïîñðåäñòâåííîé
àäðåñàöèè
ðåàëèçóåòñÿ
ïðîãðàììíî,
ñ èñïîëüçîâàíèåì
ñ÷åò÷èêà èíñòðóêöèé,
à â ìàøèíàõ
íà áàçå i386 îí
ðåàëèçóåòñÿ
àïïàðàòíî.
Òðóäíî
ñêàçàòü ÷òî
ëó÷øå,
îäíàêî â ÑÌ 1700
ïðåäóñìîòðåí
åùå è ðåæèì êîðîòêîãî
ëèòåðàëà,
ïðåèìóùåñòâà
êîòîðîãî
ïåðåä
îáû÷íîé
íåïîñðåäñòâåííîé
àäðåñàöèåé
äàííûõ
ìåíüøèõ ÷åì
64 áåñïîðíû. Â 80386
ïðîöåññîðå
íè÷åãî
ïîäîáíîãî
íå
ïðåäóñìîòðåíî,
õîòÿ ìîæåò
áûòü ýòî
ëó÷øå - íå
óâåëè÷èâàåò
ñèñòåìó
êîìàíä è
ñëåäîâàòåëüíî
óïðîùàåò
ñòðóêòóðó
ïðîöåññîðà.
            Ïðÿìàÿ
àäðåñàöèÿ
ýòî òîæå
äîñòàòî÷íî
ïðîñòîé, íî
î÷åíü ÷àñòî
èñïîëüçóåìûé
èíñòðóìåíò.
×àùå âñåãî
èñïîëüçóåòñÿ
äëÿ
îáðàùåíèÿ ê
îäèíî÷íûì
ïåðåìåííûì,
îáëàñòÿì
äàííûõ
îïåðàöèîííûõ
ñèñòåì è ò.ä.
Ðåàëèçîâàí
è â i386
ïðîöåññîðå è
íà ÑÌ 1700, îïÿòü
æå ÷åðåç
ñ÷åò÷èê
èíñòðóêöèé.
           
            Áîëåå
ñëîæíûìè,
îäíàêî è
áîëåå
ïðîäóêòèâíûìè
ÿâëÿþòñÿ
êîñâåííûå
ñïîñîáû
àäðåñàöèè.
Êîñâåííî
ðåãèñòðîâûé,
êîñâåííûé
ñî ñìåùåíèåì,
èíäåêñíûå
ðåæèìû
àäðåñàöèè ðåàëèçîâàíû
â ïîëíîé ìåðå
è íà ÑÌ 1700 è â
ÏÝÂÌ. Îíè
äàþò
íàèáîëüøèé
ýôôåêò ïðè
îáðàáîòêå ìàññèâîâ,
òàáëèö,
ðàçëè÷íîãî
ðîäà ñïèñêîâ.
Äëÿ
ñðàâíåíèÿ
ïðèâåäåì
òàáëèöó
àíàëîãè÷íûõ
ïî ñìûñëó
èíñòðóêöèé
ÑÌ 1700 è
ïðîöåññîðà 80386.
   
            1.
Êîñâåííî
ðåãèñòðîâûé.
               ÑÌ 1700        MOVB            R1,(R2)
               i386   
          MOV               [EBX],EAX
   
            2.
Ñìåùåíèÿ.
               ÑÌ 1700        MOVB            W^32769(R4),R1
               i386   
          MOV               EAX,[EDX+32769]
   
            3.
Êîñâåííûé
ñìåùåíèÿ.
               ÑÌ 1700        MOVW           @B^8(R5),(R2)
               i386   
          MOV               ESI,[EDI+8]
                                    MOV               AX, word ptr [ESI]
                                    MOV               word ptr [EDX],AX
                                   
            4.
Êîñâåííî
ðåãèñòðîâûé
èíäåêñíûé.
               ÑÌ 1700        MOVB            (R1)[R2],R3
               i386   
          MOV               CX,[BP+DI]
           
            5.
Ñìåùåíèÿ
èíäåêñíûé.
           
               ÑÌ 1700        MOVB            B^5(R1)[R2],R3
               i386   
          MOV               EAX,[EBX+ECX+5]
Â
òàáëèöå
ïðèâåäåíû
ëèøü
íåêîòîðûå
ðåæèìû
àäðåñàöèè, è
ñåé÷àñ ìû
ïîÿñíèì
ïî÷åìó. Åñëè
îáðàòèòü
âíèìàíèå íà
ïóíêò 3, òî
âèäíî, ÷òî
êîìàíäà,
àíàëîãè÷íàÿ
êîñâåííîìó
ðåæèìó
ñìåùåíèÿ
çàìåíåíà íà
3 èíñòðóêöèè
èç íàáîðà
êîìàíä
ïðîöåññîðà 80386.
Äåéñòâèòåëüíî
386-îé ïðîöåññîð
íå ïîíèìàåò
êîíñòðóêöèé
òèïà "àäðåñ
àäðåñà",
ïîýòîìó
ïîäîáíûå
ìàíèïóëÿöèè
ïðèõîäèòñÿ
äåëàòü ñ
ïîìîùüþ äîïîëíèòåëüíîãî
ðåãèñòðà.
Áîëåå òîãî
ñèñòåìà
àäðåñàöèè
ïðîöåññîðà 80386
íå äîïóñêàåò
èñïîëüçîâàíèÿ
êîìàíä ñ
îáðàùåíèåì
ïàìÿòü-ïàìÿòü.
Ýòî îïÿòü
çàñòàâëÿåò
èñïîëüçîâàòü
äîïîëíèòåëüíûå
ðåãèñòðû. Îäíàêî
â ñèñòåìå
êîìàíä i386
ïðåäóñìîòðåíû
êîìàíäû
îáðàáîòêè
ñòðîê. Ýòè
êîìàíäû âî
ìíîãèõ
ñëó÷àÿõ
ïîçâîëÿþò
îáîéòèñü
áåç ïîäîáíûõ
ïðîáëåì. Âîò
ýòè êîìàíäû:
   
MOVS{B,W,D}          -
ïåðåñëàòü
ñòðîêó
STOS{B,W,D}            -
çàíåñòè â
ïàìÿòü èç {AL,AX,EAX}
LODS{B,W,D}           -
çàíåñòè èç
ïàìÿòè â {AL,AX,EAX}
CMPS{B,W,D}           -
ñðàâíèòü
ñòðîêè
SCAS{B,W,D}           -
ñêàíèðîâàòü
ñòðîêó
                       
Âñå
ýòè êîìàíäû
ìîæíî
èñïîëüçîâàòü
ñ ïðåôèêñîì
ïîâòîðåíèÿ REP.
Ó ýòîãî
ïðåôèêñà
åñòü è óñëîâíûå
ìîäèôèêàöèè
REPE, REPZ, REPNE REPNZ è äðóãèå,
ïðåêðàùàþùèå
ïîâòîðåíèå
ïî êàêîìó-òî
ïðèçíàêó äî
èñ÷åðïàíèÿ
ñ÷åò÷èêà. Ñ
ïîìîùüþ
ïåðâûõ òðåõ
êîìàíä è
ðåàëèçóåòñÿ
îñíîâíàÿ
ðàáîòà ñ
ïàìÿòüþ. Ýòè
èíñòðóêöèè
ìîæíî îõàðàêòåðèçîâàòü,
êàê
èñïîëüçóþùèå
àâòîóâåëè÷åíèå
èëè
àâòîóìåíüøåíèå,
òàê êàê îíè ïîñëå
âûïîëíåíèÿ
ìîäèôèöèðóþò
òåêóùåå ñìåùåíèå,
êîòîðîå
õðàíèòñÿ â
ðåãèñòðàõ
ESI(SI),EDI(DI). Â òîæå
âðåìÿ MOVS
ðåàëèçóåò
àäðåñàöèþ
"ïàìÿòü-ïàìÿòü".
Ñ ïåðâîãî
âçãëÿäà ýòîãî
íåäîñòàòî÷íî
äëÿ òîãî,
÷òîáû
ýôôåêòèâíî
èñïîëüçîâàòü
íàïðèìåð
ïîäîáèå
êîñâåííîãî
ñ
àâòîóâåëè÷åíèåì
èíäåêñíîãî
ðåæèìà.
Îäíàêî ýòè
ñëîæíûå
èíñòðóêöèè
ëåãêî
çàìåíÿþòñÿ
íàáîðîì
èíñòðóêöèé
ïðîöåññîðà 80386.
Íàïðèìåð
ïåðåïèøåì
êîìàíäó MOVL @(R1)+[R3],(R2)+
äëÿ ìàøèí íà
áàçå i80386.
                                   
                                                            CLD   
                                                            MOV   ESI,[EAX+EBX]
                                                            MOVSD
Åñëè
ïîëîæèòü,
÷òî EDI = R2, òî
ðåçóëüòàò
áóäåò òåì æå.
Äàëåå ESI è EDI
áóäóò
óâåëè÷åíû
íà 4 è äëÿ äàëüíåéøåé
ïåðåñûëêè
ìîæíî áûëî
áû íàïèñàòü
   
                                                            MOV   CX,1000
                                                            REP     MOVSB
                                   
×òî
ïðèâåëî áû ê
ïåðåñûëêå 4000
áàéò èç DS:[ESI] â ES:[EDI].
Êîíå÷íî
íóæíà
íåêîòîðàÿ
ïðåäâàðèòåëüíàÿ
ïîäãîòîâêà,
ê ïðèìåðó
çàäàíèå
íà÷àëüíûõ àäðåñîâ,
óñòàíîâêà
ñ÷åò÷èêà â ECX,
çàäàíèå íàïðàâëåíèÿ
(CLD/STD - ïðèáàâëÿòü
èëè
îòíèìàòü â ESI è(èëè)
EDI), îäíàêî
ïðèìåðíî
òàêèå æå
ïðèãîòîâëåíèÿ
íåîáõîäèìû
è â ïåðâîì
ñëó÷àå.
   
Òàêèì
îáðàçîì,
ðàññìàòðèâàÿ
è ñðàâíèâàÿ
âîçìîæíûå
ñïîñîáû
àäðåñàöèè
íà ÑÌ ÝÂÌ è
ïåðñîíàëüíûõ
ÝÂÌ íà áàçå
ïðîöåññîðà i386
ìîæíî
ñôîðìèðîâàòü
âïîëíå
îïðåäåëåííîå
ïðåäñòàâëåíèå
î
âîçìîæíîñòÿõ
ýòèõ ìàøèí.
Íåñîìíåííî
ÑÌ 1700 ÿâëÿåòñÿ
áîëåå
ìîùíîé
ìàøèíîé, ðàññ÷èòàííîé
íà ðåøåíèå
äîñòàòî÷íî
ñëîæíûõ
ýêîíîìè÷åñêèõ
è äðóãèõ
çàäà÷. Èìåÿ
áîëåå
ñîâåðøåííûé
íàáîð
âîçìîæíûõ
ñïîñîáîâ
àäðåñàöèè
ïîçâîëÿåò
êà÷åñòâåííåå
è êîìïàêòíåå
çàïèñûâàòü
çàäà÷è
îðèåíòèðîâàííûå
íà ðàáîòó ñ
áîëüøèì
êîëè÷åñòâîì
ðàçëè÷íîé
íôîðìàöèè,
ïî
ñðàâíåíèþ ñ
âîçìîæíîé
ðåàëèçàöèåé
ïîäîáíûõ
çàäà÷ íà ÏÝÂÌ.Ïðÿìàÿ
èëè
êîñâåííàÿ
àäðåñàöèÿ
"ïàìÿòü-ïàìÿòü"
íåñîìíåííî
èìååò
îãðîìíûå
ïðåèìóùåñòâà,
è ðåçêî
ñíèæàåò
ðàçìåð êîäà è
êîëè÷åñòâî
äîïîëíèòåëüíûõ
ðåñóðñîâ (
ðåãèñòðû,
ëèøíèå
òàêòû è ò.ä.),
èñïîëüçóåìûõ
ïðè ïîäîáíûõ
ïåðåñûëêàõ.
Îäíàêî,
íåñìîòðÿ íà ýòî,
ïåðåïðîãðàììèðîâàíèå
ïîäîáíûõ
çàäà÷ äëÿ
ïðîöåññîðà 80386
âïîëíå
ðåàëüíî è
äàæå èìååò
ñìûñë.
Áëàãîäàðÿ
ðàçâèòèþ
ýëåìåíòíîé áàçû,
íîâûì
àðõèòåêòóðíûì
ðåøåíèÿì,
ïîâûøåíèþ
ïðîèçâîäèòåëüíîñòè
âíóòðåííèõ
è âíåøíèõ
çàïîìèíàþùèõ
óñòðîéñòâ
îáùàÿ ïðîèçâîäèòåëüíîñòü
ñîâðåìåííûõ
ÏÝÂÌ äîñòèãàåò,
è ÷àñòî
îáõîäèò
ïðîèçâîäèòåëüíîñòü
òàêèõ
êëàññè÷åñêèõ
âû÷èñëèòåëüíûõ
ñèñòåì, êàê
ÂÑ íà îñíîâå
ÑÌ è ÅÑ ÝÂÌ.
Ïîýòîìó,
íåñìîòðÿ íà
íåêîòîðóþ íåïðèñïîñîáëåííîñü
ìàøèí ýòîãî
êëàññà äëÿ
ðåøåíèÿ
ñëîæíûõ
çàäà÷,
ïîñëåäíåå
âðåìÿ î÷åíü
áîëüøîé
ïðîöåíò
ïîäîáíûõ
âû÷èñëåíèé  
ïðèõîäèòñÿ
íà ÏÝÂÌ. È
êîíå÷íî íå
ïîñëåäíþþ
ðîëü çäåñü
èãðàåò èõ
îòíîñèòåëüíî
íåáîëüøàÿ
ñòîèìîñòü,
ãëîáàëüíîå
ðàñïðîñòðàíåíèå
è îãðîìíîå
êîëè÷åñòâî
ïðèêëàäíûõ
ïðîãðàìì, à
ñëåäîâàòåëüíî
è ïðîãðàììèñòîâ,
ñïîñîáíûõ
ïèñàòü
ãðàìîòíîå
ÏÎ äëÿ
ðåøåíèÿ
ýêîíîìè÷åñêèõ
çàäà÷.
   
Êîçëîâ
À.Â.
ÑÏÈÑÎÊ
ÈÑÏÎËÜÇÎÂÀÍÍÎÉ
ËÈÒÅÐÀÒÓÐÛ.
1. Ìàëûå
ÝÂÌ âûñîêîé
ïðîèçâîäèòåëüíîñòè.
Àðõèòåêòóðà
è ïðîãðàììèðîâàíèå.
Ìîñêâà
"Ðàäèî è
ñâÿçü" 1990.
2. Ä.Áðàìì,
Ï.Áðàìì.
Ïðîöåññîð 80386 è
åãî
ïðîãðàììèðîâàíèå.
"Ìèð" 1990.
3. Øàãóðèí,
Â.Á. Áðîäèí, Ã.Ï.
Ìîçãîâîé.
Îïèñàíèå è
ñèñòåìà
êîìàíä. ÌÏ
"Ìàëèï" 1992.
4. Âû÷èñëèòåëüíûå
ìàøèíû,
ñèñòåìû è
ñåòè. Ìîñêâà
"Ôèíàíñû è
ñòàòèñòèêà"
1991.
5. ALI 386DX MINI
ISA Syståm Board user's manual. Printed in the Taiwan. Edition - August
1993.
ÎÃËÀÂËÅÍÈÅ
   
    1.
Ââåäåíèå.
       
Ñðàâíåíèå
ìèíè- è
ìèêðîÝÂÌ.
    2.
Ñèñòåìû
àäðåñàöèè
èñïîëüçóåìûå
â ìèíè-ÝÂÌ.
       1.
Ðåãèñòðîâûé
ðåæèì
àäðåñàöèè.
       2.
Êîñâåííî
ðåãèñòðîâûé
ðåæèì àäðåñàöèè.
       3.
Ðåæèì ñ
àâòîóâåëè÷åíèåì.
       4.
Ðåæèì ñ
àâòîóìåíüøåíèåì.
       5.
Êîñâåííûé ñ
àâòîóâåëè÷åíèåì.
       6.
Ðåæèì
ñìåùåíèÿ.
       7.
Êîñâåííûé
ñìåùåíèÿ.
       8.
Ðåæèì
êîðîòêîãî
ëèòåðàëà.
       9.
Èíäåêñíûé
ðåæèì.
      10.
Ðåæèìû
àäðåñàöèè ñ
èñïîëüçîâàíèåì
ñ÷åò÷èêà
èíñòðóêöèé.
      11.
Àäðåñàöèÿ
ïåðåõîäîâ.
      
    3.
Ñèñòåìû
àäðåñàöèè
èñïîëüçóåìûå
â ÏÝÂÌ.
       1.
Íåïîñðåäñòâåííàÿ
àäðåñàöèÿ.
       2.
Ðåãèñòðîâàÿ
àäðåñàöèÿ.
       3.
Êîñâåííî-ðåãèñòðîâàÿ
àäðåñàöèÿ.
       4.
Ïðÿìàÿ
àäðåñàöèÿ.
       5.
Áàçîâàÿ
àäðåñàöèÿ.
       6.
Èíäåêñíàÿ
àäðåñàöèÿ.
       7.
Áàçîâî-èíäåêñíàÿ
àäðåñàöèÿ.
       8.
Áàçîâî-èíäåêñíàÿ
àäðåñàöèÿ ñî
ñìåùåíèåì.
       9.
Èíäåêñíàÿ
àäðåñàöèÿ ñ
ìàñøòàáèðîâàíèåì.
      10.
Áàçîâî-èíäåêñíàÿ
àäðåñàöèÿ ñî
ñìåùåíèåì.
      11.
Áàçîâî-èíäåêñíàÿ
àäðåñàöèÿ ñî
ñìåùåíèåì è
ñ
ìàñøòàáèðîâàíèåì.
      12.
Îòíîñèòåëüíàÿ
àäðåñàöèÿ.
    4.
Çàêëþ÷åíèå.
Ñðàâíèòåëüíûé
àíàëèç
ñèñòåì
àäðåñàöèè
èñïîëüçóåìûõ
â                     CM1700 è â
ÏÝÂÌ íà áàçå
ïðîöåññîðà 80386.
   
    5.
Ëèòåðàòóðà.
ðåôåðàòû Ðåêîìåíäóåì ðåôåðàòûðåôåðàòû

     
Ðåôåðàòû @2011