0% found this document useful (0 votes)
60 views17 pages

MIC-Project 2023-24

The document discusses different data transfer instructions in 8086 microprocessor like MOV, PUSH, XCHG, XLAT, LEA, LDS. It provides the syntax, description and examples of each instruction. It also includes an introduction, conclusion and references used.

Uploaded by

kimt61703
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)
60 views17 pages

MIC-Project 2023-24

The document discusses different data transfer instructions in 8086 microprocessor like MOV, PUSH, XCHG, XLAT, LEA, LDS. It provides the syntax, description and examples of each instruction. It also includes an introduction, conclusion and references used.

Uploaded by

kimt61703
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/ 17

MICRO PROJECT

COMPUTER ENGINEERING

Submitted by

Name of Students Enrollment No


Bhakare.B.D 2011640096
Shinde.S.V 2211640131
Rahinj.H.A 2211640090
Rahinj.A.C 2211640124

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

DEPARTMENT OF COMPUTER ENGINEERING

SONIYA GANDHI POLYTECHNIC SHRIGONDA-413701.

(2023-2024)
SONIYA GANDHI POLYTECHNIC SHRIGONDA-413701

CERTIFICATE

This is to certify that the Micro-Project entitled.

“Data copy/Transfer Instruction”


Submitted by

Name of Students Enrollment Marks Out Marks Out Total Out


No Of 6 for Of Of
performanc 4 for 10
e in group performanc
activity e in oral
(D5Col.8) (D5Col.9)
Bhakare.B.D 2011640096

Shinde.S.V 2211640131

Rahinj.H.A 2211640090

Rahinj.A.C 2211640124

Is the bonafied work completed in the academic year 2023-2024


under my supervision and guidance in partial fulfilment for award of
diploma “Diploma in Computer Engineering” Maharashtra State
Board of Technical Education.

Prof.Gawade.P.T Prof. Nagne P.A. Prof. Nagwade A.B.

(Project guide) (H.O.D.) (Principal)


Index
Sr. No Name of title

1. Introduction

2. Types of Data transfer instructions


• MOV
• PUSH
• XCHG
• XLAT
• LEALDS
• Other instruction

3. Conclusion

4. Reference
Introduction :

➢ Data transfer instructions in the 8086 microprocessor are used to move data
between memory locations, registers, and input/output (I/O) devices.
➢ These instructions are essential for manipulating data within a program, as well
as for communicating with external devices.
➢ Data transfer instructions are a fundamental part of programming in the 8086
microprocessor, and are used extensively in applications ranging from simple
data manipulation to complex I/O device communication and string processing.
➢ Data transfer instructions are the instructions which transfers data in the
microprocessor. They are also called copy instructions.
➢ These are the instructions that transfer the data from source to destination. They
include:
• MOV, PUSH, POP, XCHG, XLAT transfer bytes, or words.
• IN, OUT transfer input and output ports.
• LEA, LDS, LES transfer addresses
• LAHF, SAHF, PUSHF, POPF transfer flag registers.
❖ MOV Instruction:
The MOV instruction copies a byte or a word from source to destination. Both operands
should be of same type either byte or a word. The instruction MOV mem, mem is illegal. It is
not possible to transfer data directly from one memory location to another. Therefore, both
source and destination operands cannot be memory address. The MOV instruction does not
affect any value in the flag register.

Example Assembly Code:

Consider an example to understand the behavior of MOV instruction. In the code given
below, a and b are the variables. DB is used for storing byte and DW is used for storing a
word (2 bytes).

ORG 100h
MOV AX, a ;Set AX to 'a' variable
MOV CX, 712h ;Set CX to 712h
MOV DS, CX ;Copies value of CX into DS
MOV SI, 25 ;Set SI to 0019 (decimal value of 25)
MOV [105], 6Ah ;Sets memory address 02712:0069 to 6Ah
MOV 25[BP][SI], AX ;PA=SS(Shifted left)+a+BP+SI
;Copy data from AX to physical address(PA)
MOV DL, [BX]+6 ;Load data from PA=DS(Shifted left)+BX+6 to DL
RET ;stops the program

a DW 5C2h
Output :
❖ 8086 PUSH Instruction
The PUSH instruction pushes the data in the stack. The format of PUSH
instruction is:

PUSH Source
It decrements the stack pointer by two and then stores the data from the source
operand at the position of the stack pointer. The source operand can be a
general-purpose register, segment register or a memory address but it should
be a word.

PUSH ASSEMBLY CODE

The PUSH instruction decrements the SP by 2. You can see in the output the
SP=FFFC which decrements by 2 becomes FFFA. The data of AX is pushed to
memory location DS: FFFA which is 16FFA in this example.

ORG 100h
MOV AX, 1C2Bh ;Set AX to 1C2B
PUSH AX ;Set SP=SP-2
;Push AX data to stack location DS:SP
MOV BX, 302Ah ;Set BX to 302A
PUSH BX ;SP=SP-2
;Push BX data to stack location DS:SP
RET ;stops the program

Output:
The XCHG inst
❖ Operand Exchange Instruction (XCHG):
ruction exchanges the contents of the source and destination. Both operands should be of
the same type either word (16 bits) or a byte (8 bits). It does not support segment
registers. The direct exchange of data between memory locations is illegal. Both operands
should be a general-purpose register. The syntax of instructions is:

XCHG Destination, Source


For example

•XCHG AX, BX exchanges words


•XCHG AL, BL exchanges bytes.
XCHG CL, 25[BX] exchanges bytes of CL with bytes stored in memory location DS:25+BX.

XCHG CS, AX is illegal.

EXAMPLE ASSEMBLY CODE

ORG 100h

MOV AX, a ;Set AX to 'a' variable

MOV CX, b ;Set CX to 'b' variable

XCHG AX, CX ;Exchange words of AX and CX

XCHG AH, CL ;Exchange bytes of AH and CL

RET ;stops the program

a DW 5C21h

b DW 3D05h
Output :
❖ XLAT Instruction:
The XLAT instruction takes no operands. It is used in lookup tables. The BX register contains
the offset address of the lookup table. The AL register has a byte number. The XLAT
instruction takes the byte number from AL and load the contents of address DS: BX+AL into
AL register. The syntax for this instruction is: XLAT
or
XLAT Table_Name
First, you’ll have to store the starting offset address of table into BX register which is done
by:

MOV BX, OFFSET Table_Name

Example Assembly Code:

Now, consider an example which takes a variable a in a range 1 to 15 and display it as a


hexadecimal digit. We have taken a=13.

ORG 100h
.MODEL SMALL
.DATA
TABLE DB '0123456789ABCDEF'
a DB 13
.code
MOV AL,a ;AL stores the byte number
MOV BX,OFFSET TABLE ;Sets BX to offset of starting address of the table
XLAT ;Sets AL to the hexa decimal value of var a
MOV DL,AL
MOV AH,02H ;Displays the charachter stored in DL
INT 21H
MOV AH,4CH
INT 21H
RET ;stops the program
Output:
❖ LEA Instruction:
The LEA stands for load Effective address. As the name implies, it takes the data from the
source and copies it to the destination operand. The destination is always a register whereas
the source can be an offset address of a variable or a memory location. Both MOV and LEA
instructions copy data from source to destination but the difference between them is LEA
copies only offset address or a memory address to destination register. The syntax of LEA
instruction is:

For example:

•LEA AX, [BX] Stores the offset address of BX into AX.


•LEA CX, var_1 Stores the address of var_1 into CX register
•LEA BX, [BP][SI] Loads effective address = BP+SI into BX register
Example Assembly Code

ORG 100h

.MODEL SMALL

.DATA

VAR DB 23h

.code

MOV AX,@DATA ;Sets AX equal to the starting address of data segment

MOV DS,AX ;Copy AX to DS

LEA DX,VAR ;Loads the address of VAR

RET ;stops the program


Output:
❖ LDS Instruction:
The LDS instruction stores four consecutive memory locations into a specified destination
register and a DS register. The format of LDS instruction is:

LDS Reg, Memory Address


The word from first two memory locations is loaded into a register and the word from the
next two memory locations gets stored to DS register.

Example Assembly Code

ORG 100h

.MODEL SMALL

.DATA

VAR DB 23h

.code

LDS AX,VAR

RET

Output
Conclusion :

In this article, we have discussed Data transfer instructions in detail. We started with
a basic introduction to opcode, and operand.
After that we discussed the format of the instruction with examples, then we
discussed the types of instructions then data transfer instruction with their syntax
and definition then some data transfer operations with their operand, description,
and examples.
Reference :

To complete this project we have took reference/suggestions from some resources,they are
as follows:

https://microcontrollerslab.com

https://www.geeksforgeeks.org
https://www.codingninjas.com

You might also like