SlideShare a Scribd company logo
Department of Electrical and Electronic Engineering
Bangladesh University of Engineering and Technology

Group No.: 05

Course No.: EEE 316
Course Name: Microprocessor

Experiment No.: 02,

and Interfacing Sessional.

03, 04

Experiment Name:

Logical Instructions, Jump Commands, LOOPs
and Arrays in Assembly Language

Date of Performance: 21/01/2014
Date of Submission: 25/01/2014

Name: Musbiha
Level: 3 Term: 2
Section:

Binte Wali

A1

Student No.: 0906022
Objective:
To be familiar with the operations of Arrays in assembly language
programming.

Home Task:
To write complete assembly language for the operation of
finding out how many numbers divisible by 5 lie in between
two given input numbers DATA1 and DATA2.
Also finding out those numbers.

Code:
CODE SEGMENT
ASSUME CS:CODE, DS:CODE
;
ORG 100H
;
MAIN: MOV AX, CS
MOV DS, AX
;
MOV BX, 0
MOV CX, 0
MOV DX, 0
MOV CL, DATA2
SUB CL, DATA1
ADD CL, 1
beginn:
;LOOP STARTS
MOV AL, CL
ADD AL, DATA1
SUB AL, 1
CBW
;AH will have the remainder
MOV BL, 5
DIV BL
CMP AH, 0
JZ AN_
JMP END_
AN_:
ADD DL, 1

;When Remainder is zero
MOV AL, CL
ADD AL, DATA1
SUB AL, 1
MOV BL,DL
MOV [ARR+BX-1], AL
END_:
loop beginn
;
MOV ANS, DL
MOV AH, 4CH
INT 21H
;
ORG 1500H
DATA1 DB 22
ORG 1510H
DATA2 DB 39
ORG 1540H
ANS DB ?
ORG 1600H
ARR DB 80 DUP(0)
;
CODE ENDS
END
END MAIN

;how many numbers
;solution array

Debug Results:
In each debugging,
DATA1’s value is at 1410:1500.
DATA2’s value is at 1410:1510.
Answer ANS’s value is at 1410:1540.
Answer ARRAY is at 1410:1600.
For DATA1= 2 and DATA2= 4, Answer=0 (at 1410:1540) and the
Answer array contains no contents (at 1410:1600)

For DATA1= 14 and DATA2= 16, Answer=01 (at 1410:1540) and
the Answer array contains one content which is 15
(at 1410:1600)
For DATA1= 22 and DATA2= 39, Answer=03 (at 1410:1540) and
the Answer array contains three contents which are 35, 30, 25
(at 1410:1600)

For DATA1= 15 and DATA2= 50, Answer=08 (at 1410:1540) and
the Answer array contains eight contents which are 50, 45, 40,
35, 30, 25, 20, 15 (at 1410:1600)
Lab Task:
Taking an input array and reversing the case of each
array-element; if any of them is digit, expressing that
as 10’s complement

Code:
CODE SEGMENT
ASSUME CS:CODE, DS:CODE
;
ORG 100H
;
MAIN: MOV AX, CS
MOV DS, AX
;
ORG 100H
ARR_ DB '1','A' ,'a','2','3','4','7','5','G','h','4','k';
ORG 1500H;
ANS DB 12 DUP(0);
MOV CX ,12;
MOV DL, 106;
LOOP1:
MOV BX,CX;
MOV AL,[ARR_+BX-1];
CMP AL,'9';
JG SKIP;
SUB DL,AL;
MOV AL, DL;
MOV DL,106;
MOV [ANS+BX-1],AL;
JMP EXIT_;
SKIP:
CMP AL,'Z';
JG SKIP1;
ADD AL,32;
MOV [ANS+BX-1],AL;
JMP EXIT_;
SKIP1:
SUB AL,32;
MOV [ANS+BX-1],AL;

;input array
EXIT_:
LOOP LOOP1;
MOV AH, 4CH
INT 21H
CODE ENDS
END MAIN

Result:
In debugging window,
Input array is at 1413:0200.
Output array is at 1413:1500.
Input array was: 1Aa23475Gh4k
Output array is: 9aA87635gH6K

More Related Content

What's hot (20)

PPT
Chapter 6 intermediate code generation
Vipul Naik
 
PPTX
Intermediate code generation1
Shashwat Shriparv
 
PPTX
Optimization of dfa
Kiran Acharya
 
PPT
Lecture 03 lexical analysis
Iffat Anjum
 
PPT
Chapter Eight(2)
bolovv
 
PPTX
Back patching
santhiya thavanthi
 
PPTX
Lecture 12 intermediate code generation
Iffat Anjum
 
PPTX
Resumen material MIT
Rawel Luciano
 
PPTX
Syntax-Directed Translation into Three Address Code
sanchi29
 
DOCX
Cs6660 compiler design may june 2016 Answer Key
appasami
 
PPTX
Basic Block
Shiv1234567
 
DOC
Compiler Design QA
Dr. C.V. Suresh Babu
 
PDF
Intermediate code generation
Akshaya Arunan
 
PPT
02. chapter 3 lexical analysis
raosir123
 
PDF
Lecture6 syntax analysis_2
Mahesh Kumar Chelimilla
 
PPT
Chapter Three(1)
bolovv
 
PPTX
Language for specifying lexical Analyzer
Archana Gopinath
 
PPT
Lecture 13 intermediate code generation 2.pptx
Iffat Anjum
 
Chapter 6 intermediate code generation
Vipul Naik
 
Intermediate code generation1
Shashwat Shriparv
 
Optimization of dfa
Kiran Acharya
 
Lecture 03 lexical analysis
Iffat Anjum
 
Chapter Eight(2)
bolovv
 
Back patching
santhiya thavanthi
 
Lecture 12 intermediate code generation
Iffat Anjum
 
Resumen material MIT
Rawel Luciano
 
Syntax-Directed Translation into Three Address Code
sanchi29
 
Cs6660 compiler design may june 2016 Answer Key
appasami
 
Basic Block
Shiv1234567
 
Compiler Design QA
Dr. C.V. Suresh Babu
 
Intermediate code generation
Akshaya Arunan
 
02. chapter 3 lexical analysis
raosir123
 
Lecture6 syntax analysis_2
Mahesh Kumar Chelimilla
 
Chapter Three(1)
bolovv
 
Language for specifying lexical Analyzer
Archana Gopinath
 
Lecture 13 intermediate code generation 2.pptx
Iffat Anjum
 

Similar to Eee316: Logical Instructions, Jump Commands, LOOPs and Arrays in Assembly Language (20)

PDF
8085 Assembly language programs.pdf
RahulMishra122561
 
PDF
chapter 7 Logic, shift and rotate instructions
warda aziz
 
PPTX
L12_ COA_COmputer architecurte and organization
sambhuduttan
 
PPTX
5.pptx
Chanyalew21
 
PDF
Bcsl 022 solved-assignment_2012-13
Indira Gnadhi National Open University (IGNOU)
 
PDF
Chapter 6 Flow control Instructions
warda aziz
 
PPTX
[ASM]Lab5
Nora Youssef
 
PDF
15CSL48 MP&MC manual
RLJIT
 
DOCX
ARM lab programs
revanasidha janbgi
 
PDF
microprocessor_labbmet.pdf
Yadav Raj
 
PDF
Microprocessor lab
D V YA Shrestha
 
PPTX
3.ASSEMBLERS.pptx
GaganaP13
 
PDF
Introduction to ibm pc assembly language
warda aziz
 
PPT
chapt5 and 06assemblylanguagecodesandmachinelanguage.ppt
mubashrabashir540
 
PDF
8086 labmanual
Murali Krishna
 
PDF
8086 microprocessor lab manual
University of Technology - Iraq
 
PDF
8085labmanual.pdf
SZahidNabiDar
 
PPTX
Assembly language programs
HarshitParkar6677
 
PPTX
[ASM]Lab8
Nora Youssef
 
8085 Assembly language programs.pdf
RahulMishra122561
 
chapter 7 Logic, shift and rotate instructions
warda aziz
 
L12_ COA_COmputer architecurte and organization
sambhuduttan
 
5.pptx
Chanyalew21
 
Bcsl 022 solved-assignment_2012-13
Indira Gnadhi National Open University (IGNOU)
 
Chapter 6 Flow control Instructions
warda aziz
 
[ASM]Lab5
Nora Youssef
 
15CSL48 MP&MC manual
RLJIT
 
ARM lab programs
revanasidha janbgi
 
microprocessor_labbmet.pdf
Yadav Raj
 
Microprocessor lab
D V YA Shrestha
 
3.ASSEMBLERS.pptx
GaganaP13
 
Introduction to ibm pc assembly language
warda aziz
 
chapt5 and 06assemblylanguagecodesandmachinelanguage.ppt
mubashrabashir540
 
8086 labmanual
Murali Krishna
 
8086 microprocessor lab manual
University of Technology - Iraq
 
8085labmanual.pdf
SZahidNabiDar
 
Assembly language programs
HarshitParkar6677
 
[ASM]Lab8
Nora Youssef
 
Ad

More from Musbiha Binte Wali (7)

PDF
Underwater Object Detection and Tracking Using Electromagnetic Waves
Musbiha Binte Wali
 
PDF
Design horn-antenna using hfss
Musbiha Binte Wali
 
PDF
Amanda mc kittrick_ros_-_Irene_Iddesleigh
Musbiha Binte Wali
 
PDF
ASAP-13 scheme (phase I) submitted by 0906022
Musbiha Binte Wali
 
PDF
eee316 exp01
Musbiha Binte Wali
 
PPTX
0906022 - Miracles of Kaaba and the Golden Ratio
Musbiha Binte Wali
 
Underwater Object Detection and Tracking Using Electromagnetic Waves
Musbiha Binte Wali
 
Design horn-antenna using hfss
Musbiha Binte Wali
 
Amanda mc kittrick_ros_-_Irene_Iddesleigh
Musbiha Binte Wali
 
ASAP-13 scheme (phase I) submitted by 0906022
Musbiha Binte Wali
 
eee316 exp01
Musbiha Binte Wali
 
0906022 - Miracles of Kaaba and the Golden Ratio
Musbiha Binte Wali
 
Ad

Recently uploaded (20)

PDF
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
PPSX
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PPTX
ROLE OF ANTIOXIDANT IN EYE HEALTH MANAGEMENT.pptx
Subham Panja
 
PPTX
How to Configure Storno Accounting in Odoo 18 Accounting
Celine George
 
PPTX
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
PDF
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
PPSX
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PPTX
Views on Education of Indian Thinkers J.Krishnamurthy..pptx
ShrutiMahanta1
 
PPTX
How to Configure Lost Reasons in Odoo 18 CRM
Celine George
 
PDF
Federal dollars withheld by district, charter, grant recipient
Mebane Rash
 
PDF
community health nursing question paper 2.pdf
Prince kumar
 
PPTX
Gall bladder, Small intestine and Large intestine.pptx
rekhapositivity
 
PDF
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
PPTX
PPT on the Development of Education in the Victorian England
Beena E S
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PPTX
How to Define Translation to Custom Module And Add a new language in Odoo 18
Celine George
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
HEALTH ASSESSMENT (Community Health Nursing) - GNM 1st Year
Priyanshu Anand
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
ROLE OF ANTIOXIDANT IN EYE HEALTH MANAGEMENT.pptx
Subham Panja
 
How to Configure Storno Accounting in Odoo 18 Accounting
Celine George
 
SCHOOL-BASED SEXUAL HARASSMENT PREVENTION AND RESPONSE WORKSHOP
komlalokoe
 
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
Health Planning in india - Unit 03 - CHN 2 - GNM 3RD YEAR.ppsx
Priyanshu Anand
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
Views on Education of Indian Thinkers J.Krishnamurthy..pptx
ShrutiMahanta1
 
How to Configure Lost Reasons in Odoo 18 CRM
Celine George
 
Federal dollars withheld by district, charter, grant recipient
Mebane Rash
 
community health nursing question paper 2.pdf
Prince kumar
 
Gall bladder, Small intestine and Large intestine.pptx
rekhapositivity
 
1, 2, 3… E MAIS UM CICLO CHEGA AO FIM!.pdf
Colégio Santa Teresinha
 
PPT on the Development of Education in the Victorian England
Beena E S
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
How to Define Translation to Custom Module And Add a new language in Odoo 18
Celine George
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 

Eee316: Logical Instructions, Jump Commands, LOOPs and Arrays in Assembly Language

  • 1. Department of Electrical and Electronic Engineering Bangladesh University of Engineering and Technology Group No.: 05 Course No.: EEE 316 Course Name: Microprocessor Experiment No.: 02, and Interfacing Sessional. 03, 04 Experiment Name: Logical Instructions, Jump Commands, LOOPs and Arrays in Assembly Language Date of Performance: 21/01/2014 Date of Submission: 25/01/2014 Name: Musbiha Level: 3 Term: 2 Section: Binte Wali A1 Student No.: 0906022
  • 2. Objective: To be familiar with the operations of Arrays in assembly language programming. Home Task: To write complete assembly language for the operation of finding out how many numbers divisible by 5 lie in between two given input numbers DATA1 and DATA2. Also finding out those numbers. Code: CODE SEGMENT ASSUME CS:CODE, DS:CODE ; ORG 100H ; MAIN: MOV AX, CS MOV DS, AX ; MOV BX, 0 MOV CX, 0 MOV DX, 0 MOV CL, DATA2 SUB CL, DATA1 ADD CL, 1 beginn: ;LOOP STARTS MOV AL, CL ADD AL, DATA1 SUB AL, 1 CBW ;AH will have the remainder MOV BL, 5 DIV BL CMP AH, 0 JZ AN_ JMP END_ AN_: ADD DL, 1 ;When Remainder is zero
  • 3. MOV AL, CL ADD AL, DATA1 SUB AL, 1 MOV BL,DL MOV [ARR+BX-1], AL END_: loop beginn ; MOV ANS, DL MOV AH, 4CH INT 21H ; ORG 1500H DATA1 DB 22 ORG 1510H DATA2 DB 39 ORG 1540H ANS DB ? ORG 1600H ARR DB 80 DUP(0) ; CODE ENDS END END MAIN ;how many numbers ;solution array Debug Results: In each debugging, DATA1’s value is at 1410:1500. DATA2’s value is at 1410:1510. Answer ANS’s value is at 1410:1540. Answer ARRAY is at 1410:1600.
  • 4. For DATA1= 2 and DATA2= 4, Answer=0 (at 1410:1540) and the Answer array contains no contents (at 1410:1600) For DATA1= 14 and DATA2= 16, Answer=01 (at 1410:1540) and the Answer array contains one content which is 15 (at 1410:1600)
  • 5. For DATA1= 22 and DATA2= 39, Answer=03 (at 1410:1540) and the Answer array contains three contents which are 35, 30, 25 (at 1410:1600) For DATA1= 15 and DATA2= 50, Answer=08 (at 1410:1540) and the Answer array contains eight contents which are 50, 45, 40, 35, 30, 25, 20, 15 (at 1410:1600)
  • 6. Lab Task: Taking an input array and reversing the case of each array-element; if any of them is digit, expressing that as 10’s complement Code: CODE SEGMENT ASSUME CS:CODE, DS:CODE ; ORG 100H ; MAIN: MOV AX, CS MOV DS, AX ; ORG 100H ARR_ DB '1','A' ,'a','2','3','4','7','5','G','h','4','k'; ORG 1500H; ANS DB 12 DUP(0); MOV CX ,12; MOV DL, 106; LOOP1: MOV BX,CX; MOV AL,[ARR_+BX-1]; CMP AL,'9'; JG SKIP; SUB DL,AL; MOV AL, DL; MOV DL,106; MOV [ANS+BX-1],AL; JMP EXIT_; SKIP: CMP AL,'Z'; JG SKIP1; ADD AL,32; MOV [ANS+BX-1],AL; JMP EXIT_; SKIP1: SUB AL,32; MOV [ANS+BX-1],AL; ;input array
  • 7. EXIT_: LOOP LOOP1; MOV AH, 4CH INT 21H CODE ENDS END MAIN Result: In debugging window, Input array is at 1413:0200. Output array is at 1413:1500. Input array was: 1Aa23475Gh4k Output array is: 9aA87635gH6K