0% found this document useful (0 votes)
111 views9 pages

Laboratory Manual Course Title: Assembly Language Programming Course Code: CSE 236

The document is a course outline and lab manual for an Assembly Language Programming course with the following key details: - The course code is CSE 236, it is offered in the fall 2020 trimester, and covers basic assembly language syntax, instructions, I/O devices, stacks, procedures, arrays, and interrupts. - The lab topics include introduction to 8086 microprocessor and EMU8086, flow control instructions, loops, procedures, stacks, arrays, strings, and interrupts. - The course objectives are to learn 8086 assembly language, how compilers translate code to assembly, and understand basic concepts needed to solve complex problems in assembly language.

Uploaded by

akib95
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)
111 views9 pages

Laboratory Manual Course Title: Assembly Language Programming Course Code: CSE 236

The document is a course outline and lab manual for an Assembly Language Programming course with the following key details: - The course code is CSE 236, it is offered in the fall 2020 trimester, and covers basic assembly language syntax, instructions, I/O devices, stacks, procedures, arrays, and interrupts. - The lab topics include introduction to 8086 microprocessor and EMU8086, flow control instructions, loops, procedures, stacks, arrays, strings, and interrupts. - The course objectives are to learn 8086 assembly language, how compilers translate code to assembly, and understand basic concepts needed to solve complex problems in assembly language.

Uploaded by

akib95
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/ 9

UNITED INTERNATIONAL UNIVERSITY

Laboratory Manual

Course Title: Assembly Language Programming

Course Code: CSE 236


UNITED INTERNATIONAL UNIVERSITY
Department of Computer Science and Engineering (CSE)
CSE 236: Assembly Language Programming
Course Outline & Lab Manual

1 Course Title Assembly Language Programming

2 Course Code CSE 236


3 Trimester and Year Fall 2020
4 Credit Hours 1.0
5 Class Hours Sunday: 9:00 – 11:30 AM (Section B)
Wednesday: 9:00 – 11:30 AM (Section A)
6 Class Rooms Online
7 Instructor’s Name Ali Haisam Muhammad Rafid

8 Email haisam@cse.uiu.ac.bd

9 Counselling Hours Day Time


9:00 AM – 10:30 AM, 2:00 PM – 5:00
Saturday PM
Sunday 11:30 AM – 12:30 PM
9:00 AM – 10:30 AM, 2:00 PM – 5:00
Tuesday PM
11:30 AM – 1:30 PM, 2:00 PM – 5:00
Wednesday PM

10 Text Book Assembly language Programming and Programming Organization of the IBM
- PC Ytha Yu and Charles Marut
11 Course Objectives
(COs)
COs Description

CO1 Get familiar with 8086/88 assembly language (low level


language) and EMU8086

CO2 Learn basic procedures of how a compiler translates C/C++


code to assembly language and perform simpler optimizations

CO3 Understand basic assembly language syntax and instructions

CO4 Understanding basic concepts of I/O devices, Stacks,


Procedures, Arrays, Addressing modes, Strings and Interrupts
for solving complex problems
12 COs with
Assessment
COs Assessment Methods (%)
Methods
- Attendance 10

- Assignments 35

- Class Performance 15

CO1, CO2, Mid Exam 15


CO3

CO3, CO4 Final Exam 25

13 Mapping of COs and


Program outcomes
COs Program Outcomes (POs)

PO PO PO PO PO PO PO PO PO PO PO PO
1 2 3 4 5 6 7 8 9 10 11 12

CO1 x

CO2 x x

CO3 x x

CO4 x x x

Lab Outline:

Class Topics/Assignments COs Lab Outcomes/Activities


Introduction:
CO1,
Lab1 8086 microprocessor,EMU8086, registers, Learn about 8086 and EMU8086
CO2
pointers and Flags
Flow control, conditional and unconditional CO1, Learn basic and conditional
Lab2
jumps CO3 instructions
Learn and apply logic to
Lab3 Loop, shift and rotate CO3
implement loops
Learn more about conditions
Lab4 Flow control and nested loop CO3
and implement nested loop
CO3,
Lab5 Flow control and nested loop, procedures Learn about procedures
CO4
MIDTERM EXAM
Learn about stacks and
Lab6 Procedures, Stack CO4
procedures
Lab7 Multiplication and division, INDEC, OUTDEC CO3, Learn multiplication and
CO4 division instructions
Lab8 Array operations CO1, Learn about 1-D and 2-D arrays
CO4
Learn about String operations
Lab9 String operations CO4
Learn about interrupt and
Lab10 Interrupt & recursion CO4 recursion using assembly
language
LAB FINAL EXAM

Lab Manual

CSE 236 Lab - 1

Topic Name: Introduction: 8086 microprocessor, memory, CPU, I/O, 8086 instructions and
coding in EMU8086, registers, pointers and Flags

1 Get familiar with 8086 & EMU8086


2 Example problem: Input and output in assembly language

3 Practice problem
● Take input 2 binary number and do the ADD, SUB, AND, OR, XOR operations.

CSE 236 Lab - 2

Topic Name: Flow control instructions, conditional and unconditional jumps

1 If-Else related example problems


● Check if a number is even or odd
● Check if a letter is uppercase or lowercase

2 Practice problem :
● Convert an uppercase letter to lowercase and vice versa
● Find the largest among three numbers (in AX, BX and CX).
● Assume that AX=5, BX=7, CX=4. Now find the value of the expression, 2AX - 3CX + 4(BX - AX)
and show it in AX.
CSE 236 Lab - 3

Topic Name: Loop, shift and rotate

1 Write a program to print 80 stars using LOOP instruction


2 Write a program that will count the number of characters until a newline line is read using
WHILE loop
3 Shift and rotate instructions examples

4 Practice problems
● Read until a blank character is read
● Write a program to count the number of vowels read until a ‘q’ or ‘Q’ is pressed

CSE 236 Lab - 4

Topic Name: Flow control and nested loop

1 Finding the Greatest Common Divisor of two numbers


1.1 Definition
Greatest Common Divisor (GCD) of two (or more integers) is the largest positive integer that divides
each of the given integers. For example, GCD of 10; 25 and, 30 is 5. Because 5 is the largest positive
integer, which can divide all 10, 25 and 30.
1.2 Euclidean Algorithm
void main(){
int x = 10, y = 20;
int gcd = 1;
while( x != y){
if (x > y) x = x-y;
else y = y - x;
}
gcd = x;
}
2 Calculate the nth term of Fibonacci Sequence
2.1 Definition
Fibonacci Sequence can be defined as 1, 1, 2, 3, 5, 8, 13, …... Here each term FN = FN-1 + FN-2 , i.e., every
term of Fibonacci sequence is equal to the summation of previous two terms. First two terms are
defined as F1 = 1 and F2 = 1.
So, F3 = F2 + F1 =) F3 = 1 + 1 =) F3 = 2
2.2 Algorithm
C code for determining the 5th term of Fibonacci sequence is given below
int n = 5, i = 1;
int fib_f = 1, fib_s = 1, fib_t = 1;
for (i = 3; i<=n; i++){
fib_t = fib_f + fib_s;
fib_f = fib_s;
fib_s = fib_t;
}
printf("%d", fib_t);

3 Practice Problem
• Find the Least Common Multiple (LCM) of three given numbers. LCM for 10, 20, 30 is 60
• Find whether a given number is prime or not. A prime number can only be divided by 1 and
number itself. 17 is a prime number, 24 is not.
• Find the average of n numbers. The average for 10, 20, 30 is 20

CSE 236 Lab - 5

Topic Name: Flow control and nested loop, procedures

1 Printing Prime Numbers from 2 to 100


1.1 Definition
Prime numbers have only two divisors- 1 and the number itself. 2 is prime because it is divisible by 1
and 2 only. 17 is prime number because it is divisible by 1 and 17 only. 18 is not a prime number
because it is divisible by 1, 2, 3, 6, 9 and 18.
1.2 Algorithm
The following program prints prime numbers from 2 to 100
void main(){
int i = 1;
for (i=2; i<100; i++){
for (j=2; j<i/2; j++){
if(i%j == 0) break;
}
if (j >= i/j) printf("%d ", i);
}
}
2 Printing a Pattern
2.1 Problem Statement
Take input n from user. And print the following pattern using nested loop structure.
For n = 4 print -
****
***
**
*
For n = 1, print -
*
For n = 2, print -
**
*
3 Practice Problem
• Print the nth term of Catalan series for given n
• Calculate the value of nP r = n!/(n-r)! from given n and r
• Calculate the value of nCr = n!/((n-r)!r!) from given n and r
• Print the following pattern for n = 5
*
**
***
****
*****
• Print the following pattern for n = 3
*
* *
* *
* *
*
• Print the following pattern for n = 5
1
12
123
1234
12345

CSE 236 Lab - 6

Topic Name: Procedures, Stack

1 Procedure for multiplication without using MUL instruction (using left shift and right shift)
2 Using stack to print the input characters in reverse order

3 Practice Problem
● Write a program to take five lowercase characters and display them in reverse order after
converting to uppercase and vice versa
● Write a program to take five lowercase characters and display them in same order after
converting to uppercase
● Implement the above two problems in a single program calling separate procedures
● Write a program to determine if a number in AX is even or odd, positive or negative, prime or not
prime using three different procedures

CSE 236 Lab - 7

Topic Name: Multiplication and division, INDEC, OUTDEC


1 INDEC: Decimal input program
2 OUTDEC: Decimal output program

3 Practice Problem
● Write a program to determine if a number is prime or not.
● Write a program to determine the factorial of a number.
● Write an assembly program that checks whether an year is a leap year or not.
● Input a decimal number then show it in its binary form.

CSE 236 Lab - 8

Topic Name: Array operations

1 Array addressing: 1-D and 2-D.


2 A code to sum in AX the elements of the 10-element array W defined by_ W DW 10, 20, 30, 40,
50, 60, 70, 80, 90, 100.
3 Swapping between 3rd and 20th element in a byte array.

4 Practice Problem
● Write a procedure REVERSE that will reverse an array of N words. This means that the Nth word
becomes the first, the (N-l)th word becomes the second, and so on, and the first word becomes the
Nth word. The procedure ls entered with SI pointing to the array, and BX has the number of words
N.
● Write a procedure REVERSE that will print the odd indexed elements of an array in reverse order.

CSE 236 Lab - 9

Topic Name: String operations

1 Copy one string into another in the same and the reverse order

2 Reading and storing a character string


3 Array addressing modes

4 Practice Problem
● An assembly program that takes a sentence as input and finds out the number of words in that
sentence. The full stop('.') denotes the end of input. There may be more than one space between
two adjacent words. Space is the only whitespace character that is used in our program. The
output must be a 2-digit number.
Input-1:
--------
Hello World.
Output-1:
---------
02

Input-2:
--------
Dhaka is the capital city of Bangladesh.
Output-3:
---------
07
.
● A program to counting the number of vowels and consonants in a string.
● Write a procedure SUM will take 2 array of same size as parameter. Sum each index value of both array
and store the value in another array at the same index. E.g. A[0]+B[0]=C[0]. Use both the addressing
modes-
a. Register indirect mode.
b. Based and Indexed addressing mode.

CSE 236 Lab - 10

Topic Name: String, Interrupt and Recursion

1 Suppose STR1 and STR2 are strings of length 10. We put O in AX if the strings are identical, put 1 in
AX if STR1 comes first alphabetically, or put 2 in AX if STR2 comes first alphabetically (assume DS
and ES are initialized).
2 Lecture on interrupt and recursion and review.

You might also like