Lab Manual For Assembly Language Course
Lab Manual For Assembly Language Course
07 To briefly understand the signed and unsigned multiplication and division instruction
process in assembly language
08 To study and understand the Assembly Language Instructions for Basic Logic
Operations
09 To understand how jump work in assembly Language Instructions and how to make if
else , switch and loop through jump instruction
10 To study and understand the functionality of all five loop instructions and their
implementation in different scenarios.
13 Introduction To Microcontroller
14 To Study 8051 Microcontroller Using The Keil Software and Create Hex File
Theory:
Most people today use decimal representation to count. In the decimal system
there are 10 digits: 0, 1, 3, 4, 5, 6, 7, 8, and 9. These digits can represent any value, for
example, 754. The value is formed by the sum of each digit, multiplied by the base (in
this it is 10 because there are 10 digits in decimal system) in power of digit position
(counting from zero):
2
7 * 10 5*101 4*10 0 700 50 4 754
Position of each digit is very important! For example if you place “7” at the end
value it will become another value.
2
5* 10 4*101 7 *10 0 500 40 7 547
Important note: any number power of zero is 1; even zero in power of zero is 1.
100 00 x 0 1
Computers are not as smart as humans are (or not yet), it’s easy to make an
electronic machine with two states on and off, or 1 and 0. Computers use binary system,
binary system uses 2 digits: 1, 1. and thus the base are 2. Each digit in a binary number is
called a BIT, 4 bits form a NIBBLE, 8 bits form a BYTE, two bytes form a WORD, and
two words form a DOUBLE WORD (rarely used).
High _ Bit nibble byte Low _ Bit
There is a convention to add “b” in the end of a binary number, this way we can
determine that 101b is a binary number with decimal value of 5. This binary number
10100101b equals to decimal value of 165:
10100101b
5
1* 27 0* 26 1* 2 0* 2 4 0* 23 1* 2 2 0* 21 1* 2 0
128 0 32 0 0 4 0 1
165(decimal _ value)
0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F
Hexadecimal Value
1234
(binary numbers)
There is a convention to add “h” in the end of a hexadecimal number, this way we
can determine that 5Fh is a hexadecimal number with value of 95. We also add “0”
(zero) in the beginning of hexadecimal numbers that begin with a letter (A…F), for
example 0E120h.
The hexadecimal number 1234h is equal to decimal value 4660:
1234h
3
1* 16 2*16 2 3*161 4*160 4660
Base Digit _ Position Decimal _ Value
(RAM)
(CPU)
Devices:
The System Bus connects the various components of a computer. The CPU is the
heart of the computer, most of computations occurs inside the CPU. RAM is a place to
where the programs are loaded in order to be executed.
Conclusion:
Experiment No. 02
Introduction to 8086 Architecture
Objective:
Introduction to architecture of Intel 8086 Microprocessor.
Theory:
The 8086 had eight (more or less general) 16-bit registers including the stack
pointer, but excluding the instruction pointer, flag register and segment registers. Four of
them, AX, BX, CX, and DX, could also be accessed as twice as many 8-bit registers (see
figures) while the other four, BP, SI, DI and SP, were 16-bit only.
Conclusion:
Experiment No. 03
Introduction to emu8086
Objective:
The brief understanding of all the features of emu8086 software.
Theory:
Type your code inside the text area, and click compile button. we will be asked for
a place where to save the compiled file. After successful compilation you can click
emulate button to load the compiled file in emulator.
*.asm – this file contains the original source code that was used to make an
executable file.
*.debug – this file has information that enables the emulator select lines of
original source code while running the machine code.
*.binf – this ASCII file contains information that is used by emulator to build file
at specified location, and set register values prior emulation.
Experiment No. 04
Arithmetic Operation
Objective:
To understand the assembly instructions for arithmetic operations.
Theory:
Arithmetic instruction: Microprocessor performs the arithmetic operations like
addition, subtraction multiplication and division.
Tool:
Emulator EMU8086
Intel Based computer
Procedure:
Follow the following procedure for arithmetic operations and observe the
new amendment as given in example.
Example 1:
Addition
MOV AX, 10
ADD AX, 20
MOV BX, AX
int 21h
Example 2:
Subtraction
MOV AX, 32
ADD AX, 10
MOV BX, AX
int 21h
Example 3:
Multiplication
MOV AX, 32
MOV BX, 10
MUL BX
int 21h
Example 4:
Division
Lab Tasks:
1. Compute the following equation using arithmetic functions in EMU8086.
Each time after
pressing the single step button, check and record down the contents of AX and
BX registers
in given table.
Objective:
Add, Multiplication, Push/Pop instruction
Theory:
Arithmetic instruction: Microprocessor performs the arithmetic operation like addition,
subtraction, multiplication and division.
PUSH:
It’s used to store data into stack using push operation stack pointer increased first and
then content of register or memory will store on that stack location which stored in SP.
PUSH Ax; SP increased by one and contain of R6 store into 08 location.
PUSH Ax; SP increased again by one and contain of R1 stored into 09 location.
POP:
To retrieve data from stack. In this retrieve data first and then stack pointer decreased by
one.
POP 20h; The content at 0Ah location will copy into 20h then stack pointer decrease by
1.
POP 21h; The content at 09h location will copy into 21h then stack pointer decrease by
1.
Example 1:
org 100h
mov ax, 5
add ax, 4
mov ax,bx
mul bx
push ax
pop ax
ret
Experiment No. 6
Objective:
To understand Addition, subtraction and compare instruction
Theory:
The Arithmetic logic unit (ALU) is used to perform arithmetic and logical instructions.
An ALU will, at minimum perform addition, subtraction, NOT, AND, OR and XOR and
usually single bit rotate and shift.
Addition:
Subtraction:
Comparison:
Experiment No. 7
Multiplication and division instruction
Objective:
To briefly understand the signed and unsigned multiplication and division instruction
process in assembly language.
Theory:
Mul: Unsigned multiply
When operand is a word: AX= (DX AX)/ operand and DX= remainder (modulus)
When operand is a word: AX= (DX AX)/ operand and DX= remainder (modulus)
Tools:
Intel Pc
Assembly 8086 software
Procedure
mov al,3
mov bl,2
mul bl
ret
MOV AX, 203 ; AX = 00CBh
MOV BL, 4
DIV BL ; AL = 50 (32h), AH = 3
RET
Experiment No.8
Objective:
To study and understand the Assembly Language Instructions for Basic Logic Operations
Theory:
The Intel 8086 Microprocessor instruction set contains instructions for performing basic logic
operations. The examples of these logic operations are AND, OR, XOR, TEST, NOT and
NEG instructions.
Tools:
Emulator emu8086
Intel Based Computer
Procedure:
Follow the following procedure for basic logic operations and observe the new ent
as given in example.
AND Instruction:
Logical AND between all bits of two operands. Result is stored in operand1.
1 AND 1 = 1
1 AND 0 = 0
0 AND 1 = 0
0 AND 0 = 0
Example:
1 OR 1 = 1
1 OR 0 = 1
0 OR 1 = 1
0 OR 0 = 0
Example:
RET
XOR Instruction:
Logical XOR (Exclusive OR) between all bits of two operands. Result is stored in first
operand.
1 XOR 1 = 0
1 XOR 0 = 1
0 XOR 1 = 1
0 XOR 0 = 0
Example:
RET
Experiment No. 9
Objective:
To understand how jump work in assembly Language Instructions and how to make if else , switch
and loop through jump instruction.
Theory:
A jump instruction performs an unconditional jump, like an instruction transfers the flow of
execution by changing the instruction pointer registers. There are a number of different opcodes
that perform a jump, an override instruction is used, the instruction may take 16-bit,32-bit or
segment: offset pointers.
Tools:
Emulator emu8086
Intel Based Computer
Procedure:
Follow the following procedure for basic amendment as given in example.
Experiment No. 10
Objective:
To study and understand the functionality of all five loop instructions and their implementation in
different scenarios.
Theory:
The Intel 8086 Microprocessor instruction set contains instructions for performing basic looping
operations. The examples of these logic operations are LOOP, LOOPE, LOOPNE etc. instructions.
Tools:
Emulator emu8086
Intel Based Computer
Procedure:
Follow the following procedure for basic looping operations and observe the new
amendment as given in example.
Loop Instruction.
Decrease CX, jump to label if CX not zero.
Algorithm:
CX = CX - 1
if CX <> 0 then
jump
else
no jump, continue
Example:
MOV AL,1
MOV DI,2000H
MOV CX,10
INC AL
INC DI
Loop HERE
RET
LOOPE Instruction.
Decrease CX, jump to label if CX not zero and Equal (ZF = 1).
Algorithm:
CX = CX - 1
jump
else
no jump, continue
Example:
include 'emu8086.inc'
ORG 100h
MOV AX, 0
MOV CX, 5
label1:
CMP AH, 0
LOOPE label1
RET
Experiment No. 14
Objective:
To Study 8051 Microcontroller Using The Keil Software and Create Hex File
Theory:
The Keil C51 C Compiler for the 8051 microcontroller is the most popular 8051 C compiler in the
world. It provides more features than any other 8051 C compiler available today.
The C51 C Compiler allows you to write 8051 microcontroller applications in C that, once compiled,
have the efficiency and speed of assembly language. Language extentions in the C51 Compiler give
you ful access to all resources of the 8051.
Procedure:
Experiment No. 15
Objective:
To Implement the IC Burning
IC Burning:
Programming or burning a microcontroller means to transfer the program from the compiler to the
memory of the microcontroller. A compiler is software which provides an environments to write ,
test and debug a program for the controller. The program for a controller is generally written in C
language.
In order to know how to program a microcontroller, we need a device called a burner/programmer.
A burner is a hardware device with dedicated software which reads the contents of hex file stored
on the PC or laptop and transferred it to the PC or USB cable and transfers the data to the memory
of the microcontroller to be programmed.
Tools:
SUPER PRO M SERIES SOFTWARE
IC BURNER
Procedure:
Experiment No. 16
Objective:
To Implement the Micro C Software For PIC Microcontroller
Theory:
Procedure:
APLLICATION:
Avionics
Medical equipment
Data communication equipment
White goods
Mobile phones, PHDS,MIDS
Industrial control
Consumer electronics
Automotive