Data Movement Instructions A Course in Microprocessor Electrical Engineering Department University of Indonesia
Load-Effective Address <ul><li>There are several LEA instructions in   p </li></ul><ul><ul><li>Table  4.9  lists the LEA ...
Load-Effective Address  (cont’d) <ul><li>LDS, LES, LFS, LGS, LSS </li></ul><ul><ul><li>The LDS, LES, LFS, LGS, LSS instruc...
String Data Transfers <ul><li>There are 5 string data transfer instructions: LODS, STOS, MOVS, INS, and OUTS </li></ul><ul...
String Data Transfers  (cont’d) <ul><li>DI and SI </li></ul><ul><ul><li>The DI offset address accesses data in the extra s...
String Data Transfers  (cont’d) <ul><ul><li>Fig. 4.16  shows the effect of executing the LODSW instruction if the D flag=0...
String Data Transfers  (cont’d) <ul><ul><li>In example  4.5  STOSW instruction is used to clear the video text display </l...
String Data Transfers  (cont’d) <ul><li>INS </li></ul><ul><ul><li>The INS (input string) instruction transfers data from a...
 
 
 
 
 
 
 
 
 
 
Upcoming SlideShare
Loading in …5
×

Chapter4.3 4-mikroprocessor

463 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
463
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Chapter4.3 4-mikroprocessor

  1. 1. Data Movement Instructions A Course in Microprocessor Electrical Engineering Department University of Indonesia
  2. 2. Load-Effective Address <ul><li>There are several LEA instructions in  p </li></ul><ul><ul><li>Table 4.9 lists the LEA instructions </li></ul></ul><ul><li>LEA </li></ul><ul><ul><li>The LEA instruction loads a 16- or 32- bit register with the offset address of the data specified by the operand </li></ul></ul><ul><ul><li>E.g., LEA AX,NUMB </li></ul></ul><ul><ul><li>Compare: LEA BX,[DI] & MOV BX,[DI] </li></ul></ul><ul><ul><li>Understand Example 4.3 </li></ul></ul>
  3. 3. Load-Effective Address (cont’d) <ul><li>LDS, LES, LFS, LGS, LSS </li></ul><ul><ul><li>The LDS, LES, LFS, LGS, LSS instructions load any 16- or 32-bit register with an offset address and load the DS, ES, FS, GS, or SS segment register with a segment address </li></ul></ul><ul><ul><li>Fig. 4.15 illustrates an example LDS BX,[DI] instruction </li></ul></ul><ul><ul><ul><li>this instruction transfers the 32-bit number, address-ed by DI in the data segment, into the BX and DS registers </li></ul></ul></ul><ul><ul><ul><li>Study Example 4.4 </li></ul></ul></ul>
  4. 4. String Data Transfers <ul><li>There are 5 string data transfer instructions: LODS, STOS, MOVS, INS, and OUTS </li></ul><ul><li>The Direction Flag </li></ul><ul><ul><li>The direction flag (D) -located in the flag register- selects the auto-increment (D=O) or the auto-decrement (D=1) operation for the DI and SI registers during string operations </li></ul></ul><ul><ul><li>The CLD instruction clears the D flag (D=0), and the STD instruction sets it (D=1) </li></ul></ul>
  5. 5. String Data Transfers (cont’d) <ul><li>DI and SI </li></ul><ul><ul><li>The DI offset address accesses data in the extra segment for all string instructions that use it </li></ul></ul><ul><ul><li>The SI offset address accesses data, by default, in the data segment </li></ul></ul><ul><li>LODS </li></ul><ul><ul><li>The LODS instruction loads AL, AX, or EAX with data stored at the data segment offset address indexed by the SI register (Table 4.10 ) </li></ul></ul>
  6. 6. String Data Transfers (cont’d) <ul><ul><li>Fig. 4.16 shows the effect of executing the LODSW instruction if the D flag=0, SI=1000H, and DS=1000H </li></ul></ul><ul><li>STOS </li></ul><ul><ul><li>The STOS instruction stores AL, AX, or EAX at the extra segment memory location addressed by the DI register </li></ul></ul><ul><ul><li>Table 4.11 lists all forms of STOS instructions </li></ul></ul><ul><ul><li>The STOSB (stores a byte), STOSW (stores a word) and STOSD (stores a doubleword) </li></ul></ul>
  7. 7. String Data Transfers (cont’d) <ul><ul><li>In example 4.5 STOSW instruction is used to clear the video text display </li></ul></ul><ul><li>MOVS </li></ul><ul><ul><li>MOVS instruction transfers data (either byte, word or doubleword) from one memory loca-tion to another (Table 4.13 ) </li></ul></ul><ul><ul><li>MOVS transfers data from the data segment location addressed by SI to the extra segment location addressed by DI </li></ul></ul><ul><ul><li>Example 4.6 lists a short program that uses MOVS </li></ul></ul>
  8. 8. String Data Transfers (cont’d) <ul><li>INS </li></ul><ul><ul><li>The INS (input string) instruction transfers data from an I/O device into extra segment memory location addressed by the DI register </li></ul></ul><ul><ul><li>The I/O address is contained in the DX register </li></ul></ul><ul><ul><li>See Table 4.14 and Study example 4.7 </li></ul></ul><ul><li>OUTS </li></ul><ul><ul><li>The OUTS (output string) transfers data from the data segment location addressed by SI to an I/O device (addressed by DX) -- Table 4.15 & Example 4.8 </li></ul></ul>

×