0% found this document useful (0 votes)
9 views

Lab Report 2

Uploaded by

Captain Jk
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Lab Report 2

Uploaded by

Captain Jk
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Department of Computer Science

Pak-Austria Fachhochschule: Institute of Applied Sciences


and Technology, Haripur, Pakistan

COMP- 261L Computer Arithmetic and Assembly


Language Lab

Lab Report: 02

Class: COMP-261L
Name: Jamal Ahmed Khan
Registration No.: B20F0358CS022
Semester: 3rd
Submitted to: Sir Rafiullah

__________________
Instructor Signature
Lab No. 02

Data Transfer Instructions

Objectives:
 Understand the working and use of MOV instruction.
 Understand the working and use of XCHG instruction.

Tools/Software Required:
EMU 8086 Tool

:Introduction

Pronounced as ‘move’, MOV transfers a constant, contents of memory or register to a


.register or memory. MOV operates on two operands, called source and destination

Pronounced as ‘exchange’, XCHG swaps the contents of its operands. Operand can both be
.registers or a register and a memory location

Lab Tasks:

Lab Task 01: Write a set of instructions in 8086-88 assembly language that swaps the contents of
CX and DX registers without using XCHG instruction.

Code:

.Model small
.stack 100h
.data
msg db "AB",0dh,0ah,'&'
.code //Code Start
main proc
mov cx,111 //move value into CX register
mov dx,222 //move value into DX register
mov ax,cx //move cx into ax temp
mov cx,dx //mov dx into cx
mov dx,ax //move ax into dx

main endp
end main

Output:
Task 2
Write a set of instructions in 8086-88 assembly language that swaps the contents of SS and DS
registers.

Code:
.model small
.stack 100h
.data
msg db "AB",0dh,0ah,'&'
.code
main proc
mov bx,111
mov ds,bx
mov bx,222
mov ss,bx

mov cx,ds
mov ds,bx
mov bx,ss
main endp

end main
Output:

Task 3:

Code:
.model small
.stack 100h

.data

.code

main proc

mov ax,9FFFH

mov bl,al ;move al into bl

mov al,ah ;move ah into al

mov ah,bl ;move bl into ah

main endp

endp main

Output:

Task 4
Write a set of instructions in 8086-88 assembly language that swaps the contents of upper and
lower bytes in BX register without using XCHG instruction.
Code:
.model small
.stack 100h

.code
main proc
mov ax,9fffh
mov bl,al
mov al,ah
mov ah,bl

main endp
end main
Output:

Results & Observations:


In this lab we learn about software emu8086 and try to learn about syntax of Assembly
language. We also learn about 16 and 8 bit register. we further practice about mov and xchange
command in emu8086 we try different tasks and learn the logic of it and saw its results how to
give value in different registers and how to XCHG value between registers by using xchange
command and also by temporary variables. And get satisfactory results.

You might also like