Top Banner
Data Movement Instructions A Course in Microprocessor Electrical Engineering Department University of Indonesia
18

Chapter4.3 4-mikroprocessor

Nov 29, 2014

Download

Documents

 
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chapter4.3 4-mikroprocessor

Data Movement Instructions

A Course in Microprocessor

Electrical Engineering Department

University of Indonesia

Page 2: Chapter4.3 4-mikroprocessor

Load-Effective Address

There are several LEA instructions in p– Table 4.9 lists the LEA instructions

LEA– The LEA instruction loads a 16- or 32- bit register

with the offset address of the data specified by the operand

– E.g., LEA AX,NUMB– Compare: LEA BX,[DI] & MOV BX,[DI]– Understand Example 4.3

Page 3: Chapter4.3 4-mikroprocessor

Load-Effective Address (cont’d)

LDS, LES, LFS, LGS, LSS– 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

– Fig. 4.15 illustrates an example LDS BX,[DI] instruction

• this instruction transfers the 32-bit number, address-ed by DI in the data segment, into the BX and DS registers

• Study Example 4.4

Page 4: Chapter4.3 4-mikroprocessor

String Data Transfers

There are 5 string data transfer instructions: LODS, STOS, MOVS, INS, and OUTS

The Direction Flag– 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

– The CLD instruction clears the D flag (D=0), and the STD instruction sets it (D=1)

Page 5: Chapter4.3 4-mikroprocessor

String Data Transfers (cont’d)

DI and SI– The DI offset address accesses data in the extra

segment for all string instructions that use it– The SI offset address accesses data, by default, in

the data segment

LODS– 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)

Page 6: Chapter4.3 4-mikroprocessor

String Data Transfers (cont’d)

– Fig.4.16 shows the effect of executing the LODSW instruction if the D flag=0, SI=1000H, and DS=1000H

STOS– The STOS instruction stores AL, AX, or EAX at the

extra segment memory location addressed by the DI register

– Table 4.11 lists all forms of STOS instructions– The STOSB (stores a byte), STOSW (stores a word)

and STOSD (stores a doubleword)

Page 7: Chapter4.3 4-mikroprocessor

String Data Transfers (cont’d)

– In example 4.5 STOSW instruction is used to clear the video text display

MOVS– MOVS instruction transfers data (either byte, word or

doubleword) from one memory loca-tion to another (Table 4.13)

– MOVS transfers data from the data segment location addressed by SI to the extra segment location addressed by DI

– Example 4.6 lists a short program that uses MOVS

Page 8: Chapter4.3 4-mikroprocessor

String Data Transfers (cont’d)

INS– The INS (input string) instruction transfers data from an

I/O device into extra segment memory location addressed by the DI register

– The I/O address is contained in the DX register– See Table 4.14 and Study example 4.7

OUTS– 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

Page 9: Chapter4.3 4-mikroprocessor
Page 10: Chapter4.3 4-mikroprocessor
Page 11: Chapter4.3 4-mikroprocessor
Page 12: Chapter4.3 4-mikroprocessor
Page 13: Chapter4.3 4-mikroprocessor
Page 14: Chapter4.3 4-mikroprocessor
Page 15: Chapter4.3 4-mikroprocessor
Page 16: Chapter4.3 4-mikroprocessor
Page 17: Chapter4.3 4-mikroprocessor
Page 18: Chapter4.3 4-mikroprocessor