background image

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ              ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ          ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ

 

١٤

 

 

Instruction Set of 8086 Processor 

1- Data transfer Group 

1. MOV Instruction 

Flags affected

 

Operation

 

Format

 

meaning

  

Mnemonic

  

None

 

(S)       (D)

 

MOV D,S

 

move

 

MOV

 

 ﻭﻫﻭ ﺍﻴﻌﺎﺯ ﻴﻘﻭﻡ

ﺒﺎﺩﺨﺎل ﻋﺩﺩ ﻤﺒﺎﺸﺭ ﻤﻥ ﻗﺒل ﺍﻟﻤﺴﺘﺨﺩﻡ

 

 ﺍﻭ ﻨﻘل

)

ﻤﺤﺘﻭﻯ ﻤﺴﺠل

 

 ﺍﻭ

ﻤﺤﺘﻭﻯ ﺫﺍﻜﺭﺓ

 (

 ﺍﻟﻰ

ﻤﺤﺘﻭﻯ

 

ﻤﺴﺠل ﺍﺨﺭ

 

 ﺍﻭ

ﻤﻭﻗﻊ ﺫﺍﻜﺭﺓ ﺍﺨﺭ

  

 ﻤﻼﺤﻅﺔ

:

  

١

.

 ﻋﻨﺩ ﺍﻟﺘﻌﺎﻤل ﻤﻊ ﺍﻟﺫﺍﻜﺭﺓ ﺒﺸﻜل ﻤﺒﺎﺸﺭ

)

ﻋﻨﻭﺍﻥ ﻤﺒﺎﺸﺭ

(

 ﻴﺠﺏ ﺍﺘﺒﺎﻉ ﺍﻟﺨﻁﻭﺍﺕ ﺍﻟﺘﺎﻟﻴﺔ

:

  

 ﻓﻲ ﺠﺯﺀ ﻤﻘﻁﻊ ﺍﻟﺒﻴﺎﻨﺎﺕ

  

.DATA 
D1  DW   9A23H 
D2  DB   22H 

 ﺤﻴﺙ ﺘﻤﺜل ﻜل ﻤﻥ

D1

 

 ﻭ

D2

 

 ﻋﻨﻭﺍﻨﻴﻥ ﻤﺒﺎﺸﺭﺓ ﺍﻭ ﺍﺯﺍﺤﺎﺕ ﻤﺒﺎﺸﺭﺓ ﻀﻤﻥ ﻤﻘﻁﻊ ﺍﻟﺒﻴﺎﻨﺎﺕ ﻭﻜﺎﻻﺘﻲ

  

ﺘﻌﺭﻑ

 

D1

 

 ﺒﻴﺎﻨﺎﺕ ﺒﻁﻭل ﻜﻠﻤﺔ ﻭﺒﻘﻴﻤﺔ

9A23H

 

 ﻤﺨﺯﻭﻨﺔ ﻓﻲ ﺍﺯﺍﺤﺔ ﻤﻌﻁﺎﺓ ﻤﻥ ﻗﺒل ﺍﻟﻤﻌﺎﻟﺞ ﻀﻤﻥ ﻤﻘﻁﻊ ﺍﻟﺒﻴﺎﻨﺎﺕ ﻭﻤﻌﺭﻓﺔ

 ﻟﻠﻤﺴﺘﺨﺩﻡ ﺒﺎﻟﺭﻤﺯ

D1

.

  

 ﺒﻴﻨﻤﺎ

D2

 

 ﺒﻴﺎﻨﺎﺕ ﺒﻁﻭل ﺒﺎﻴﺕ ﻭﺒﻘﻴﻤﺔ

22H

 

 ﻤﺨﺯﻭﻨﺔ ﻓﻲ ﺍﺯﺍﺤﺔ ﻤﻌﻁﺎﺓ ﻤﻥ ﻗﺒل ﺍﻟﻤﻌﺎﻟﺞ ﻀﻤﻥ ﻤﻘﻁﻊ ﺍﻟﺒﻴﺎﻨﺎﺕ ﻭﻤﻌﺭﻓﺔ

 ﻟﻠﻤﺴﺘﺨﺩﻡ ﺒﺎﻟﺭﻤﺯ

D2

.

  

ﻭﻴﺘﻡ ﺍﺴﺘﺨﺩﺍﻤﻬﺎ ﺒﺎﻟﺒﺭﻨ

 ﺎﻤﺞ ﺒﺎﻟﺸﻜل ﺍﻟﺘﺎﻟﻲ

  

MOV  SI,D1 
MOV  CL,D2

 

 ﻭﺒﻌﺩ ﺍﻟﺘﻨﻔﻴﺫ ﻓﺎﻥ ﻗﻴﻡ ﺍﻟﻤﺴﺠﻼﺕ ﺴﺘﻜﻭﻥ

  

SI=9A23H 
CX=0022H 

 ﻭﻴﺠﺏ ﺍﻥ ﻨﺭﺍﻋﻲ ﺍﻥ ﻴﺜﺒﺕ ﺒﻌﺩ ﻜﺘﺎﺒﺔ ﺍﻟﺭﻗﻡ ﻓﻲ ﻤﻘﻁﻊ ﺍﻟﺒﻴﺎﻨﺎﺕ ﺤﺭﻑ

H

 

ﻭﺍﻟﺫﻱ ﻴﻤﺜل ﺭﻤﺯ ﺍﻟﻨﻅﺎﻡ ﺍﻟﺴﺎﺩﺱ ﻋﺸﺭﻱ

.

  

٢

 .

ﻋﻨﺩ ﺍﺩﺨﺎل ﺍﺭﻗﺎﻡ ﻤﺒﺎﺸﺭﺓ ﺍﻟﻰ ﻤﺴﺠل ﻴﺠﺏ ﺍﻥ ﻨﺭﺍﻋﻲ ﺍﻥ ﻜﺎﻥ ﺍﻟﺭﻗﻡ ﻴﺒﺩ

 ﺃ ﺒﺤﺭﻑ ﻤﻥ ﺍﻟﺤﺭﻭﻑ ﺍﻟﺘﻲ ﺘﻤﺜل ﺍﻻﺭﻗﺎﻡ ﻤﻥ

10

 

 ﺍﻟﻰ

15

 

 ﺍﻱ

)

A,B,C,D,E,F

 (

 ﻴﺠﺏ ﺍﻥ ﻴﻀﺎﻑ

0

 

ﻗﺒل ﺍﻟﺭﻗﻡ ﺤﺘﻰ ﻻﻴﻔﺴﺭ ﻤﻨﻘﺒل ﺍﻟﻤﻌﺎﻟﺞ ﻋﻠﻰ ﺍﻨﻪ ﺤﺭﻭﻑ ﻭﻟﻴﺱ ﺭﻗﻡ ﻓﻤﺜﻼ

  

 ﻋﻨﺩ ﺍﺩﺨﺎل ﺍﻟﺭﻗﻡ

AB23

 

 ﺍﻟﻰ ﺍﻟﻤﺴﺠل

CX

 

 ﻴﺠﺏ ﺍﻥ ﻴﻜﺘﺏ ﺍﻻﻴﻌﺎﺯ ﻜﺎﻟﺘﺎﻟﻲ

  

MOV  CX,0AB23 

  
  


background image

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ              ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ          ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ

 

٢٤

 

 

٣

 .

ﻋﻨﺩ ﺍﺩﺨﺎل ﺭﻗﻡ ﻤﺒﺎﺸﺭ ﺍﻟﻰ ﻋﻨﻭﺍﻥ ﺍ

 ﻭ ﺍﺯﺍﺤﺔ ﻤﻌﻨﻭﻨﺔ ﺒﺸﻜل ﻤﺒﺎﺸﺭ ﻓﻲ ﻤﻘﻁﻊ ﺍﻟﺒﻴﺎﻨﺎﺕ ﻓﻴﺘﻡ ﺘﻌﺭﻴﻑ ﺍﻟﻌﻨﻭﺍﻥ ﺍﻟﻤﺒﺎﺸﺭ

 ﺒﺎﻟﺸﻜل ﺍﻟﺘﺎﻟﻲ

  

.DATA 
D3   DB    ? 
D4   DW   ? 

 ﻭﻴﺘﻡ ﺍﺩﺨﺎل ﺍﻟﺒﻴﺎﻨﺎﺕ ﻀﻤﻥ ﻤﻘﻁﻊ

CODE

 

ﺒﺎﻟﺸﻜل ﺍﻟﺘﺎﻟﻲ

  

MOV    D3,0AFH 
MOV    D4,98CEH 

  

٤

 .

ﻻﻴﻤﻜﻥ ﻨﻘل ﺍﻟﺒﻴﺎﻨﺎﺕ ﺒﺸﻜل ﻤﺒﺎﺸﺭ ﻤﻥ ﻤﻭﻗﻊ ﺫﺍﻜﺭﺓ ﺍﻟﻰ ﻤﻭﻗﻊ ﺫﺍﻜ

 ﺭﺓ ﺍﺨﺭ ﻭﺍﻨﻤﺎ ﻴﺠﺏ ﺍﻥ ﻴﻜﻭﻥ ﺍﺤﺩ ﻤﺴﺠﻼﺕ ﺍﻟﻤﻌﺎﻟﺞ

ﻤﻨﻁﻘﺔ ﻭﺴﻁﻴﺔ ﻓﻤﺜﻼ

  

 ﻟﻨﻘل ﺍﻟﻤﻭﻗﻊ

D1

 

 ﺍﻟﻰ

D2

 

 ﻭﺍﻟﺘﻲ ﺘﺤﺘﻭﻱ ﻋﻠﻰ ﺍﻟﻘﻴﻡ ﺍﻟﺘﺎﻟﻴﺔ

67H

 

4B

 

 ﻓﻴﻜﺘﺏ ﺍﻟﺒﺭﻨﺎﻤﺞ ﺒﺎﻟﺸﻜل ﺍﻟﺘﺎﻟﻲ

  

.DATA 
D1 DB  67H 
D2 DB  4BH 
.CODE 
MOV  AL,D1 
MOV  D2,AL 
 

1-1THE  STACK  :  the  stack  is  implemented  in  the  memory  of  8086,  and  it  is  used  for 

temporary storage. 

Starting  address  of  stack  memory  (top  of  the  stack)  obtained  from  the  contents  of  the  stack 

pointer  (SP)  and  the  stack  segment  (SS)  (SS:SP).  Figure  1  shows  the  stack  region  for 

SS=0400H  and  SP=A000H.  Data  transferred  to  and  from  the  stack  are  word-wide,  not  byte-

wide.  Whenever  a  word  of  data  is  pushed  onto  the  top  of  the  stack,  the  high-order  8  bits  are 

placed  in  the  location  addressed  by  SP-1.  the  low-order  8  bits  are  placed  in  the  location 

addressed by SP-2.The SP is then decremented by 2.   

 Whenever data are popped from the stack, the low-order 8-bits are removed from the location  

addressed by SP. The high-order  8 bits are removed from the location addressed by SP+1. The 

SP is then incremented by 2. 

 ﺍﻟﻤﻜﺩﺱ

 :

 ﻴﺘﻡ ﺘﻁﺒﻴﻕ ﺍﻟﻤﻜﺩﺱ

 ﻓﻲ ﺫﺍﻜﺭﺓ ﺍﻟﻤﻌﺎﻟﺞ

٦٨٠٨

 

ﻭﺘﺴﺘﺨﺩﻡ ﻟﻠﺨﺯﻥ ﺍﻟﻭﻗﺘﻲ

.

 


background image

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ              ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ          ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ

 

٣٤

 

 

ﻴﺘﻡ ﺍﻟﺤﺼﻭل ﻋﻠﻰ ﻋﻨﻭﺍﻥ ﺍﻟﺒﺩﺍﻴﺔ ﻟﺫﺍﻜﺭﺓ ﺍﻟﻤﻜﺩﺱ

)

ﻗﻤﺔ ﺍﻟﻤﻜﺩﺱ

 (

 ﻭﺍﻟﺫﻱ ﻴﺘﻡ ﺍﻟﺤﺼﻭل ﻋﻠﻴﻪ ﻤﻥ ﺨﻼل ﻤﺤﺘﻭﻯ ﻤﺅﺸﺭ ﺍﻟﻤﻜﺩﺱ

SP 

 

  ﻭﻤﺴﺠل  ﻤﻘﻁﻊ  ﺍﻟﻤﻜﺩﺱ

SS

 )

SS:SP

  .(

  ﻭﺍﻟﺸﻜل  ﺭﻗﻡ

١

 

    ﻴﺒﻴﻥ  ﻤﻨﻁﻘﺔ  ﺍﻟﻤﻜﺩﺱ  ﺒﻘﻴﻤﺔ

SS=0400H

 

 ﻭ

    

SP=A000H

 

 ﻭﺍﻟﺒﻴﺎﻨﺎﺕ ﺍﻟﺘﻲ ﺍﻟﺘﻲ ﻴﺘﻡ ﺘﻨﺎﻗﻠﻬﺎ ﻤﻥ ﻭﺍﻟﻰ ﺍﻟﻤﻜﺩﺱ ﻫﻲ ﻤﻥ ﻨﻭﻋﻴﺔ ﺍﻟﻜﻠﻤﺔ

word

 

ﻭﻟﻴﺴﺕ ﻤﻥ ﻨﻭﻋﻴﺔ ﺍﻟﺒﺎﻴﺕ

 .

 ﻭﻋﻨﺩﻤﺎ ﻴﺘﻡ ﺩﻓﻊ

push

 

 ﻗﻴﻤﺔ ﻓﻲ ﻗﻤﺔ ﺍﻟﻤﻜﺩﺱ ﻓﺎﻥ

high  order  8bit

 

 ﺴﺘﻭﻀﻊ ﻓﻲ ﺍﻟﻤﻭﻗﻊ ﺍﻟﺫﻱ ﻋﻨﻭﺍﻨﻪ ﻫﻭ ﻗﻴﻤﺔ

SP

 

ﻤﻁﺭﻭﺡ ﻤﻨﻪ ﻭﺍﺤﺩ

 .

 ﻊـﻀﻭﻴ ﺎﻤﻨﻴﺒ

Low  order  8bit

 

ﻓﻲ ﺍﻟﻤﻭﻗ

 ﻊ ﺍﻟﺫﻱ ﻋﻨﻭﺍﻨﻪ ﻫﻭ ﻗﻴﻤﺔ

SP

 

 ﻤﻁﺭﻭﺡ ﻤﻨﻪ ﺍﺜﻨﻴﻥ

 .

 ﻭﻴﺘﻡ

 ﻁﺭﺡ ﺍﺜﻨﻴﻥ ﻤﻥ ﻗﻴﻤﺔ

SP

.

  

 ﻭﻋﻨﺩﻤﺎ ﻴﺘﻡ ﺍﺨﺭﺍﺝ ﺍﻟﺒﻴﺎﻨﺎﺕ ﻤﻥ ﺍﻟﻤﻜﺩﺱ ﻓﺎﻥ

low-order  8-bits

 

ﻴﺘﻡ ﺭﻓﻌﻬﺎ ﻤﻥ ﺍﻟﻤﻭﻗ

ـ

ﻊ ﺍﻟﻤﻌ

ـ

 ﻨﻭﻥ ﺒﻘﻴﻤﺔ

SP

 

ﺒﻴﻨ

ـ

 ﻤﺎ

high-order 8-bits

 

 ﻴﺘﻡ ﺭﻓﻌﻬﺎ ﻤﻥ ﺍﻟﻤﻭﻗﻊ ﺍﻟﻤﻌﻨﻭﻥ ﺒﻘﻴﻤﺔ

SP+1

 

 ﻭﻗﻴﻤﺔ

SP

 

ﻴﻀﺎﻑ ﻟﻪ ﺍﺜﻨﻴﻥ

.

  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Figure 1 The stack region

 

The  following  example  illustrates  pushing  the  content  of  the  AX  and  BX  registers  onto  the 

stack and then subsequently popping the data from the stack back to the registers. Assume that 

0400:FFFFH

 

.

 

.

 

 

0400:A000H

 

0400:A000H

 

.

 

.

 

.

 

Stack segment

 

End of stack

 

Top of stack

 

Bottom of stack

 


background image

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ              ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ          ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ

 

٤٤

 

 

the AX contains hex 026B, the BX contains 04E3, and the SP contains 36 ( the segment address 

in the SS does not concern us here) 

  ﻭﺍﻟﻤﺜﺎل  ﺍﻟﺘﺎﻟﻲ  ﻴﺒﻴﻥ  ﻟﻨﺎ  ﻜﻴﻔﻴﺔ  ﺍﺩﺨﺎل  ﻤﺤﺘﻭﻴﺎﺕ  ﺍﻟﻤﺴﺠﻠﻴﻥ

AX  and  BX

 

 ﻓﻲ  ﺍﻟﻤﻜﺩﺱ  ﻭﻤﻥ  ﺜﻡ  ﺒﺸﻜل  ﺘﻌﺎﻗﺒﻲ  ﺍﺨﺭﺍﺝ

 ﺍﻟﻤﻌﻠﻭﻤﺎﺕ ﻤﻥ ﺍﻟﻤﻜﺩﺱ ﻭﺍﺭﺠﺎﻋﻬﺎ ﺍﻟﻰ ﻤﻜﺎﻨﻬﺎ ﺍﻻﻭل ﻓﻲ ﺍﻟﻤﺴﺠﻠﻴﻥ

 .

 ﻭﺒﺎﻓﺘﺭﺍﺽ ﺍﻥ ﺍﻟﻤﺴﺠل

AX

 

 ﻴﺤﻭﻱ ﺍﻟﺭﻗﻡ

026B 

 

 ﺒﻨﻅﺎﻡ ﺍﻟﺴﺎﺩﺱ ﺍﻟﻌﺸﺭﻱ ﻭﺍﻟﻤﺴﺠل

BX

 

 ﻴﺤﻭﻱ ﺍﻟﻘﻴﻤﺔ

04E3 

 

 ﻭﻤﺴﺠل

SP

 ﻴ

 ﺤﻭﻱ ﺍﻟﻘﻴﻤﺔ

36

 

 ﻭﻻﻨﻬﺘﻡ ﺒﻘﻴﻤﺔ

SS

.

 

 

1. Initially, the stack is empty and looks like this  

 

 

 

 

 

2. PUSH AX: Decrements the SP by 2 (to 34) and stores the contents of the AX,026B, in the 

stack. Note that the operation reverses the sequence of the stored bytes, so that 026B becomes 

6B02: 

 

 

 

 

3. PUSH BX: Decrements the SP by 2 (to 32) and stores the contents of the BX,04E3, in the 

stack as E304: 

 

 

 

 

4. POP BX: Restores the word from where the SP points in the stack (E304) to the BX register 

and  increments  the  SP  by  2  (to  34).  The  BX  now  contains  04E3,  with  the  bytes  correctly 

restored. The stack now appears as: 

....

 

....

 

....

 

....

 

....

 

....

 

....

 

....

 

....

 

SS 

Segment address of stack 

 

SP=36 

Top of stack 

....

 

....

 

....

 

....

 

....

 

....

 

....

 

....

 

6B02

 

SS 

SP=34 

....

 

....

 

....

 

....

 

....

 

....

 

....

 

E304

 

6B02

 

SS 

SP=32 


background image

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ              ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ          ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ

 

٥٤

 

 

 

 

 

 

5. POP AX: Restores the word from where the SP points in the stack (6B02) to the AX register 

and  increments  the  SP  by  2  (to  36).  The  BX  now  contains  026B,  with  the  bytes  correctly 

restored. The stack now appears as: 

 

 

 

 

 

Note that POP instructions are coded in reverse sequence from PUSH instructions; the example 

pushed  the  AX  and  BX  registers,  but  popped  the  BX  and  AX,  in  that  order  .Also,  the  values 

pushed onto the stack are still there, although the SP no longer points to them. 

 ﻨﻼﺤﻅ ﺍﻥ ﺍﻴﻌﺎﺯﺍﺕ

POP 

 

 ﺘﻌﻤل ﺒﺸﻜل ﻤﻌﺎﻜﺱ ﻻﻴﻌﺎﺯﺍﺕ

PUSH

 

 ﻓﻘﺩ ﻗﻤﻨﺎ ﺒﺎﺩﺨﺎل

AX

 

 ﺜﻡ

BX 

 

 ﻭﻨﺨﺭﺝ

BX

 

 ﺜﻡ

AX

 

 ﻤﻊ

 ﺍﻻﻟﺘﺯﺍﻡ ﺒﺎﻟﺘﺭﺘﻴﺏ ﻭﻜﺫﻟﻙ ﺍﻟﻘﻴﻡ ﺍﻟﺘﻲ ﺍﺩﺨﻠﺕ ﺍﻟﻰ ﺍﻟﻤﻜﺩﺱ ﺒﻘﻴﺕ ﻫﻨﺎﻙ ﻤﻊ ﺍﻥ

SP

 

ﻟﻡ ﻴﻌﺩ ﻴﺅﺸﺭ ﻋﻠﻴﻬﺎ

.

  

1-2The MOV instruction : The function of MOV instruction is to transfer a byte or word of 

data from a source location to a destination location. The general form of MOV instruction is as 

shown below: 

 ﺍﻥ ﻭﻅﻴﻔﺔ ﺍﻴﻌﺎﺯ

MOV

 

 ﻫﻭ ﻟﻨﻘل ﺒﺎﻴﺕ ﺍﻭ ﻜﻠﻤﺔ

 ﻤﻥ ﺍﻟﺒﻴﺎﻨﺎﺕ ﻤﻥ ﻤﻭﻗﻊ ﺍﻟﻤﻨﻁﻠﻕ ﺍﻟﻰ ﻤﻭﻗﻊ ﺍﻟﻤﺴﺘﻘﺭ ﻭﺍﻟﺼﻴﻐﺔ ﺍﻟﻌﺎﻤﺔ ﻟﻼﻴﻌﺎﺯ

MOV

 

ﻫﻭ ﻜﺎﻻﺘﻲ

:

  

Flags affected

 

Operation

 

Format

 

meaning

 

Mnemonic

  

None

 

(S)       (D)

 

MOV D,S

 

move

 

MOV

 

 

From table 1-(a) , we see that data can be moved between general purpose registers, between a 

general  purpose  –  register  and  a  segment  register,  between  a  general  purpose-register  or 

....

 

....

 

....

 

....

 

....

 

....

 

....

 

E304

 

6B02

 

SS 

SP=34 

....

 

....

 

....

 

....

 

....

 

....

 

....

 

E304

 

6B02

 

SS 

SP=36 


background image

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ              ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ          ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ

 

٦٤

 

 

segment  register  and  memory,  or  between  a  memory  location  and  the  accumulator.  Note  that 

memory-to-memory transfers are not allowed.  

 ﻭﻤﻥ ﺨﻼل ﺍﻟﺠﺩﻭل

1-(a)

 

 ﻨﺭﻯ ﺍﻥ ﺍﻟﺒﻴﺎﻨﺎﺕ ﻴﻤﻜﻥ ﺍﻥ ﺘﻨﺘﻘل ﺒﻴﻥ ﻤﺴﺠﻼﺕ ﺍﻻﺴﺘﺨﺩﺍﻡ ﺍﻟﻌﺎﻡ ﺍﻭ ﺒﻴﻥ ﻤﺴﺠﻼﺕ ﺍﻻﺴﺘﺨﺩﺍﻡ ﺍﻟﻌﺎﻡ

 ﻭﻤﺴﺠﻼﺕ ﺍﻟﻤﻘﺎﻁﻊ ﺍﻭﺒﻴﻥ ﻤﺴﺠﻼﺕ ﺍﻻﺴﺘﺨﺩﺍﻡ ﺍﻟﻌﺎﻡ ﺍﻭ ﻤﺴﺠﻼﺕ ﺍﻟﻤﻘﺎﻁﻊ ﻤﻊ ﺍﻟﺫﺍﻜﺭﺓ ﺍﻭ ﺒﻴﻥ ﻤﻭﺍﻗﻊ ﺍﻟﺫﺍﻜﺭﺓ ﻭﺍﻟﻤﺭﻜﻡ

 .

ﻭﻻﺤﻅ ﺍﻨﻪ ﻻﻴﻭﺠﺩ ﺘﻨﺎﻗل ﻤﺒﺎﺸﺭ ﺒﻴﻥ ﻤﻭﺍﻗﻊ ﺍﻟﺫﺍﻜﺭﺓ

.

  

1-3PUSH / POP: The PUSH and POP instructions are important instructions that are store and 

retrieve data from the LIFO (Last In First Out) stack memory. The general forms of PUSH and 

POP instructions are as shown below: 

 ﺍﻥ ﺍﻴﻌﺎﺯﻱ

PUSH/POP

 

ﻫﻲ ﻤﻥ ﺍﻻﻴﻌﺎﺯﺍﺕ ﺍﻟﻤﻬﻤﺔ ﻭﺍﻟﺘﻲ ﺘﻘﻭﻡ ﺒﺨﺯﻥ ﻭﺍﺴﺘﻌﺎﺩﺓ ﺍﻟﻤﻌﻠﻭﻤﺎﺕ ﺫﺍﻜﺭﺓ ﺍﻟﻤﻜﺩﺱ

 )

 ﺍﺨﺭ ﻤﻥ ﻴﺩﺨل

ﺍﻭل ﻤﻥ ﻴﺨﺭﺝ

 (

ﻭﺍﻟﺼﻴﻐﺔ ﺍﻟﻌﺎﻤﺔ ﻟﻼﻴﻌﺎﺯﻱ

 

PUSH

 

 ﻭ

POP

 

ﻭﻜﻤﺎ ﻓﻲ ﺍﺩﻨﺎﻩ

:

  

  

  

Operand (S or D)

 

Flags 

  

Operation

 

Format

 

Meaning

 

Mnemonic

  

Register

 

Seg reg (CS illegal

 

Memory

 

Flag register

 

None

 

((SP))       (S)

  

(SP)       (SP)-2

 

PUSH  S

 

Push word onto 

stack

  

PUSH

 

None

 

(D)       ((SP))

  

(SP)       (SP)+2

 

POP D

 

POP word onto 

stack

 

POP

 

 

1-4 LEA, LDS, and LES(load – effective address) INSTRUCTIONS: 

These instructions load a segment and general purpose registers with an address directly from 

memory. The general forms of these instructions are as shown below: 

 

  ﻫﺫﻩ  ﺍﻻﻴﻌﺎﺯﺍﺕ  ﺘﺤﻤل  ﻤﺴﺠل  ﺍﻟﻤﻘﻁﻊ  ﻭﻤﺴﺠﻼﺕ  ﺍﻻﺴﺘﺨﺩﺍﻡ  ﺍﻟﻌﺎﻡ  ﺒﻌﻨﻭﺍﻥ  ﻤﺒﺎﺸﺭ  ﻤﻥ  ﺍﻟﺫﺍﻜﺭﺓ

  .

ﻭﺍﻟﺼﻴﻐﺔ  ﺍﻟﻌﺎﻤ

 ﺔ  ﻟﻬﺫﻩ

ﺍﻻﻴﻌﺎﺯﺍﺕ ﻤﺒﻴﻨﺔ ﻓﻲ ﺍﺩﻨﺎﻩ

:

 

Flags affected

 

Operation

 

Format

 

meaning

 

Mnemonic

  

None

 

EA       (reg16)    

 

LEA reg16,EA

 

Load effective address

  

LEA

 


background image

ﺤﺎﺴﺒﺎﺕ ﻤﺘﻘﺩﻤﺔ ﺍﻟﻤﺭﺤﻠﺔ ﺍﻟﺜﺎﻟﺜﺔ              ﻫﻨﺩﺴﺔ ﻜﻬﺭﻭ ﻤﻴﻜﺎﻨﻴﻙ          ﺍﻟﻤﺩﺭﺱ ﻤﺴﺎﻋﺩ ﺍﻨﻤﺎﺭ ﺨﻠﻴل ﺍﺒﺭﺍﻫﻴﻡ

 

٧٤

 

 

None

 

[PA]        (reg16)

  

 [PA+2]       (DS)

 

LDS reg16,EA

 

Load register and DS

 

LDS

 

None

 

[PA]        (reg16)

  

 [PA+2]       (ES)

 

LES reg16,EA

 

Load register and ES

 

LES

 

 

The LEA instruction is used to load a specified register with a 16 – bit effective address(EA). 

 ﺍﻥ ﺍﻴﻌﺎﺯ

LEA

 

 ﻫﻭ ﻴﺴﺘﺨﺩﻡ ﻟﺘﺤﻤﻴل ﻤﺴﺠل ﻤﻌﻴﻥ ﺒﻌﻨﻭﺍﻥ ﻓﻌﺎل ﺒﻁﻭل

16-bit

.

  

The  LDS  instruction  is  used  to  load  a  specified  register  with  the  contents  of  PA  and  PA+1 

memory locations, and load DS with the contents of PA+2 and PA+3 memory locations. 

 ﺍﻥ ﺍﻴﻌﺎﺯ

LDS

 ﻴ

 ﺴﺘﺨﺩﻡ ﻓﻲ ﻋﻤﻠﻴﺔ ﺘﺤﻤﻴل ﻤﺴﺠل

 ﻤﻌﻴﻥ

 ﺒﻤﺤﺘﻭﻯ ﻤﻭﺍﻗﻊ ﺍﻟﺫﺍﻜﺭﺓ

PA

 

 ﻭ

PA+1

 

 ﻭﺘﺤﻤﻴل

DS

 

 ﺒﻤﺤﺘﻭﻯ ﻤﻭﺍﻗﻊ

 ﺍﻟﺫﺍﻜﺭﺓ

PA+2

 

PA+3

 

The  LES  instruction  is  used  to  load  a  specified  register  with  the  contents  of  PA  and  PA+1 

memory locations, and load LES with the contents of PA+2 and PA+3 memory locations. 

 ﺍﻥ ﺍﻴﻌﺎﺯ

LES

 

 ﻴﺴﺘﺨﺩﻡ ﻓﻲ ﻋﻤﻠﻴﺔ ﺘﺤﻤﻴل ﻤﺴﺠل ﻤﻌﻴﻥ ﺒﻤﺤﺘﻭﻯ ﻤﻭﺍﻗﻊ ﺍﻟﺫﺍﻜﺭﺓ

PA

 

 ﻭ

PA+1

 

 ﻭﺘﺤﻤﻴل

ES

 

 ﺒﻤﺤﺘﻭﻯ ﻤﻭﺍﻗﻊ

 ﺍﻟﺫﺍﻜﺭﺓ

PA+2

 

PA+3

.

 

Example  1  :  Assuming  that  BX=20H  ,DI=1000H  ,  DS=1200H  and  the  following  memory 

contents: 

12204

 

12203

 

12202

 

12201

 

12200

 

Memory

  

22

 

FF

 

EE

 

AA

 

11

 

Content

 

 

What result is produced in the destination operand by execution the following instruction? 

a- LEA SI,[DI+BX+5]     b- LDS SI,[200] 

Solution : 

a- EA =1000+20+5=1025     then (SI)=1025 

b- PA=DS:EA=DS*10+EA=1200*10+200=12200 

(SI)=AA11H    and  (DS)=FFEEH 




رفعت المحاضرة من قبل: ضرغام العزاوي
المشاهدات: لقد قام 5 أعضاء و 160 زائراً بقراءة هذه المحاضرة








تسجيل دخول

أو
عبر الحساب الاعتيادي
الرجاء كتابة البريد الالكتروني بشكل صحيح
الرجاء كتابة كلمة المرور
لست عضواً في موقع محاضراتي؟
اضغط هنا للتسجيل