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

Lab Report 3

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)
19 views

Lab Report 3

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/ 6

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: 03

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

__________________
Instructor Signature
Lab No. 03

Arithmetic Instructions

Objectives:

• Understand the working Arithmetic instruction


• Understand the use the Arithmetic Instruction by Implementing them.

Tools/Software Required:
EMU 8086 Tool

:Introduction

ADD instruction adds values exiting in two registers, register and memory, immediate and
.memory, immediate and register
SUB instruction subtracts the contents of operand2 from operand1 and leaves the difference
.in operand1, with operand2 unchanged
Lab Tasks:

Lab Tasks:

Lab Task 01:


Write an assembly program that loads AX, BX, CX and DX registers with 1254, B812, 9067, ADC3
and adds AX, BX, CX and DX. Save the sum in DI register.

Code:
.model small
.stack 100h

.code
main proc
mov ax,1254h
mov bx,0b812h
mov cx,9067h
mov dx,0adc3h

add ax,bx
add cx,dx
add ax,cx
mov di,ax

main endp
end main
Output:

Lab Task 02:


Write an assembly language program that find the square of a number existing in AH. Result must be
stored in DX register
Code:
.model small
.stack 100h

.code
main proc
mov bl,7h
mov bh,7h

mov al,bl
mov ah,bh
mul ah

mov bh,ah
mov al,.5
mul al

main endp
endp main

Output:

Lab Task 03:


Write an assembly language program that divides the number in BL by the number in CL and then
multiplies the result by 2. The final answer must be a 16-bit number stored in the DX register.
Code:
.model small
.stack 100h
.code
main proc
mov bl,10
mov ax,bx ;dividend stored in ax register of 16 bit
mov cl,5 ;store 5 in cl
div cl
mov cx,2 ;store 2 in cx
MUL cx
mov dx,ax ;move ax into dx

main endp
endp main

Output:
Results & Observations:
In this lab we learn about the working of arithmetic instruction and also understand the use of
arithmetic instruction by implementing them.in this lab we learn about ADD, ADC, SUB, SBB,
INC, DEC, NEG, MUL, DIV instruction. We also learn about divisor which we store in small bit
register and dividend store in higher bit for example divisor store in 8 bit and dividend store in
16 bit and same as multiplier and multiplicand.

You might also like