0% found this document useful (0 votes)
9 views35 pages

EEE 432 - Lab Manual

Microprocessor Lab Manual

Uploaded by

rezwansarkar
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)
9 views35 pages

EEE 432 - Lab Manual

Microprocessor Lab Manual

Uploaded by

rezwansarkar
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/ 35

Experiment no: 01

Name of the experiment: Familiarization with Microprocessor 8086 kit and Emulator 8086
software.

Objectives: The main objective of this experiment is-


1. To be familiar with Microprocessor kit

2. To be familiar with Emulator 8086 software.

Equipments:
1. Microprocessor 8086 kit.
2. Emulator-8086 software

Theory: 8086 Microprocessor is an enhanced version of 8085 Microprocessor that was


designed by Intel in 1976. It is a 16-bit Microprocessor having 20 address lines and16 data lines
that provides up to 1MB storage.

The term “16-bit” means that its arithmetic logic unit, internal registers and most of its
instructions are designed to work with 16-bit binary words. 2) The 8086 has a 16-bit data bus, so
it can read data from or write data to memory and ports either 16 bits or 8 bits at a time.

An assembly language is a type of low-level programming language that is intended to


communicate directly with a computer's hardware. An assembly language statement is a line of
text that translates into a single machine instruction. Assembly Language is expressed in a more
human readable form than the binary instructions and names are allowed for memory locations,
registers, operations etc.

A microcontroller puts the CPU and all peripherals onto the same chip, a microprocessor houses
a more powerful CPU on a single chip that connects to external peripherals.
Emulator 8086 Software

8086 Microprocessor Emulator, also known as EMU8086, is an emulator of the program 8086
microprocessor. It is developed with a built-in 8086 assembler.

The CS(code segment register) is used to address the code segment of the memory i.e a location
in the memory where the code is stored. The IP(Instruction pointer) contains the offset within the
code segment of the memory.

In computer engineering and low-level programming (such as assembly language), an


offset usually denotes the number of address locations added to a base address in order to get to a
specific absolute address.

Stack Segment − It contains data and return addresses of procedures or subroutines.

The Stack Pointer (SP) register is used to indicate the location of the last item put onto the stack.

Base Pointer (BP) − The 16-bit BP register mainly helps in referencing the parameter variables
passed to a subroutine.
SI is called source index and DI is destination index. As the name follows, SI is always pointed
to the source array and DI is always pointed to the destination. This is usually used to move a
block of data, such as records (or structures) and arrays. These register is commonly coupled
with DS and ES.

ES:DI (ES is Extra Segment, DI is Destination Index) is typically used to point to the destination
for a string copy, as mentioned above.

Data segment register (DS): points to the data segment of the memory where the data is stored.
Extra Segment Register (ES): also refers to a segment in the memory which is another data
segment in the memory. Stack Segment Register (SS): is used for addressing stack segment of
the memory.

Program:
MOV AX, 2233H
ADD AX, 1122H

Output:

Program:
MOV AX, 2233H
SUB AX, 1122H

Output:

Conclusion:
Experiment no: 02
Name of the experiment: Experimental study of arithmetic assembly language
instruction using Emulator.
Objectives:
Equipments:
1. Emulator-8086 software
Overview: In this experiment we worked with arithmetic commands ADD, SUB,
MUL, DIV, ADC and SBB. ADD is used for addition of two numbers and SUB is used
to subtract a number from another number. MUL and DIV are used to multiply
and divide two numbers respectfully.
ADC is called addition with carry. If there is a carry when two numbers are added,
then carry is added to the number. For SBB, subtraction is done with considering
carry.
Machine code, also known as machine language, is the elemental language of
computers. It is read by the computer's central processing unit (CPU), is
composed of digital binary numbers and looks like a very long sequence of zeros
and ones.

Program 1:
MOV AX, 2233H
ADD AX, 1122H
SUB AX, 1122H
In this program MOV is a basic command which is used to assign a number to a
variable register.AX is a variable register which contains the space of 16 bits. ADD
and SUB are commands which add and subtract the AX contents respectfully and
stores it to AX register. ‘H’ denotes the hexadecimal value. For each line of the
program written above there is a particular machine code. It is shown below.
Assembly language Machine code Calculation
MOV AX, 2233H B8 33 22 AX=2233H
ADD AX, 1122H 05 22 11 AX=3355H
SUB AX, 1122H 2D 22 11 AX=2233H

Output:

Program 2:
MOV AL, 55H
ADD AL, 11H
SUB AL, 11H

In this program MOV is a basic command which is used to assign a number to a


variable register.AL is a variable register which contains the space of 8 bits. ADD
and SUB are commands which add and subtract the AL contents respectfully and
stores it to AL register. ‘H’ denotes the hexadecimal value. For each line of the
program written above there is a particular machine code. It is shown below.
Assembly language Machine code Calculation
MOV AL, 55H B0 55 AL=0055H
ADD AL, 11H 04 11 AL=0066H
SUB AL, 11H 2C 11 AL=0055H

Output:
Program 3:
MOV CX,0BA98H
MOV DX,0FEDCH
MOV AX,4567H
MOV BX,0123H
ADD CX,AX
ADC DX,BX

In this program MOV is a basic command which is used to assign a number to a


variable register. AX, BX, CX and DX are variable registers which contain the space
of 16 bits. ADD is a command which adds CX and AX contents and then the carry
is added when DX and BX are added. ‘H’ denotes the hexadecimal value. For each
line of the program written above there is a particular machine code. It is shown
below.
Assembly language Machine code Calculation
MOV CX,0BA98H B9 98 BA CX=0BA98H
MOV DX, 0FEDCH BA DC FE DX=0FEDCH
MOV AX,4567H B8 67 45 AX=4567H
MOV BX, 0123H BB 23 01 BX=0123H
ADD CX,AX 03 C8 CX=FFFFH
ADC DX, BX 13 D3 DX=FFFFH

Output: Registers are below

Program 4:
MOV BX,5678H
MOV AX,1234H
MOV DX,6789H
MOV BX,2345H
SUB BX,DX
SUBB AX,CX

In this program MOV is a basic command which is used to assign a number to a


variable register.AX,BX,CX and DX are variable registers which contain the space
of 16 bits. SUB is a command which subtracts BX from DX content and then the
carry is subtracted when AX and CX are subtracted. ‘H’ denotes the hexadecimal
value.For each line of the program written above there is a particular machine
code. It is shown below.
Assembly language Machine code Calculation
MOV BX, 5678H BB 78 56 BX=5678H
MOV AX, 1234H B8 34 12 AX=1234H
MOV DX,6789H BA 89 67 DX=6789H
MOV CX, 2345H B9 45 23 CX=2345H
SUB BX,DX 2B DA BX=EEEFH
SBB CX, DX 1B C1 AX=EEEEH

Output: Registers are below

Program 5:
MOV AL, 00F0H
MOV BL, 0011H
MUL BL

In this program MOV is a basic command which is used to assign a number to a


variable register.AL and BL are variable registers which contain the space of 8 bits.
MUL is a command which multiplies AL and BL contents and stores it to BL
register. ‘H’ denotes the hexadecimal value. For each line of the program written
above there is a particular machine code. It is shown below.
Assembly language Machine code Calculation
MOV AL, 00F0H B0 F0 AL=00F0H
MOV BL, 0011H B3 11 BL=0011H
MUL BL F6 E3 BL=0011H

Output:

Program 6:
MOV AX, 00F0H
MOV BL, 0010H
DIV BL

In this program MOV is a basic command which is used to assign a number to a


variable register.AX and BL are variable registers which contain the spaces of 16 &
8 bits respectfully. DIV is a command which divides AX and BL contents and stores
it to AL register. ‘H’ denotes the hexadecimal value. For each line of the program
written above there is a particular machine code. It is shown below.
Assembly language Machine code Calculation
MOV AX, 00F0H B8 F0 00 AX=00F0H
MOV BL, 0010H B3 10 BL=0010H
DIV BL F6 F3 BL=0010H

Output:
Program 7:
MOV AL,85H
MOV BL,35H
MOV AH,00H
IMUL BL
In this program MOV is a basic command which is used to assign a number to a
variable register. AH, AL and BL are variable registers which contain the space of
08 bits.IMUL is a command which multiplies signed BL contents. ‘H’ denotes the
hexadecimal value. For each line of the program written above there is a
particular machine code. It is shown below.
Assembly language Machine code Calculation
MOV AL,85H B0 85 AL=85H
MOV BL,35H B3 35 BL=35H
MOV AH,00H B4 00 AH=00H
IMUL BL F6 EB BL=0035H

Output: Registers are below.

Program 8:
MOV AL,85H
MOV BL,35H
MOV AH,00H
IDIV BL
In this program MOV is a basic command which is used to assign a number to a
variable register. AH, AL and BL are variable registers which contain the space of
08 bits.IDIV is a command which divides signed BL contents. ‘H’ denotes the
hexadecimal value. For each line of the program written above there is a
particular machine code. It is shown below.
Assembly language Machine code Calculation
MOV AL,85H B0 85 AL=85H
MOV BL,35H B3 35 BL=35H
MOV AH,00H B4 00 AH=00H
DIV BL F6 FB BL=0035H

Output: Registers are below.

Discussion:
Experiment no: 03

Name of the experiment: Study of Logical instruction and command in Assembly


Language.

Objectives: The main objective of this experiment is-


1.To perform various arithmetic and logical shift and rotate assembly language instruction &
verify the result in the computer by using the software ‘Emulator-8086’.

Equipments:
1. Emulator-8086 software

Theory: In this experiment we have performed with various commands such as AND,
OR,XOR,SHL,SAL,SAR,SHR,RCL,ROL,ROR,RCR and ADD.A short note on these commands
is below.

ADD :It is used for the addition of numbers OR:It is used to set bit at particular position

SAR: It is used to shift arithmetic right RCL: It is used to rotate left through carry

AND :It is used to clear certain bits SHL : It is used to Shift logical left

SHR: It is used to shift logical right ROR : It is used to Rotate right

SAL : It is used to shift arithmetic left ROL: It is used to rotate left

RCR: It is used to rotate right through carry XOR: It is used to invert certain bits

Programes perfomed in Lab:


Program 01:

MOV CL, 10111100B


AND CL, 10111100B

Assembly language Machine code Calculation


MOV CL, 10111100B B1BC
AND CL, 10111100B 80E1BC CX=00BC

Output in Emulator:
Program 02:

MOV CL, 10111100B


OR CL, 01100000B

Assembly language Machine code Calculation


MOV CL, 10111100B B1BC
OR CL, 01100000B 80 C9 60 CX=005FCH

Output in Emulator:

Program 03:

MOV CL, 10111100B


XOR CL, 00100000B

Assembly language Machine code Calculation


MOV CL, 10111100B B1BC
XOR CL, 00100000B 80 F1 20 CX=9CH
Output in Emulator:

Program 04:

MOV BX, 1234H


SHL BX, 4

Assembly language Machine code Calculation


MOV BX, 1234H BB 34 12
SHL BX, 1 D1 E3 BX=2468FH
SHL BX, 2 D1 E3 D1 E3 BX=48D0H
SHL BX, 3 D1 E3 D1 E3 D1 E3 BX=91A0H
SHL BX, 4 D1 E3 D1 E3 D1 E3 D1 E3 BX=2340H

Output in Emulator:
Program: 05:

MOV BX, 1234H


SHR BX, 4

Assembly language Machine code Calculation


MOV BX, 1234H BB 34 12
SHR BX,1 D1 EB BX=0123H
SHR BX,2 D1 EB D1 EB BX=0246H
SHR BX,3 D1 EB D1 EB D1 EB BX=048DH
SHR BX,4 D1 EB D1 EB D1 EB D1 EB BX=091AH

Output in Emulator:

Program:6
MOV AX,1234H

SHL AX,4

MOV BX,1234H

SHL BX,1

ADD AX,BX

Assembly language Machine code Calculation


MOV AX,1234H B83412H
SHL AX,4 D1E0 D1E0 D1E0 D1E0
MOV BX,1234H B83412H AX=47A8H
SHL BX,1 D1E3
ADD AX,BX
03C3

Output in Emulator:

Program-07: Multiply AX by 17 using Shift & ADD operation, where AX=1234H.

MOV AX,1234H

SHL AX,4

MOV BX,1234H

ADD AX,BX

Discussion:
Experiment no: 04

Name of the experiment: Experimental study of logical shift and rotate assembly language
instructions by using Emulator-8086’.
Objectives:
Equipments:
1. Emulator-8086 software
Overview: In this experiment we have performed with various commands such as AND,
OR,XOR,SHL,SAL,SAR,SHR,RCL,ROL,ROR,RCR and ADD.A short note on these commands is
below.

ADD Addition of numbers SAR Shift arithmetic right

AND Clear certain bits SHR Shift logical right

OR Set bit at particular position RCL Rotate left through carry

SAL Shift arithmetic left RCR Rotate right through carry

SHL Shift logical left ROL Rotate left

ROR Rotate right XOR Invert certain bits


1. Program and output for shift logically right by 1,2,3,4 units are below.
MOV BX, 1234H
SHR BX, 1
In this program MOV is a basic command which is used to assign a number to a variable
register.BX is a variable register which contains the space of 16 bits. SHR is a command which
shifts bits logically right by 1 unit and stores it to BX register. ‘H’ denotes the hexadecimal value.
For each line of the program written above there is a particular machine code. It is shown
below.

Assembly language Machine code Calculation


MOV BX, 1234H BB 34 12 BX=1234H
SHR BX,1 D1 EB BX=091AH
Output: Registers are below
Shift logically right by 2 units is below.
Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
SHR BX,2 D1 EB D1 EB BX=048DH
Output: Registers are below

Shift logically right by 3 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
SHR BX,3 D1 EB D1 EB D1 EB BX=0246H
Output: Registers are below

Shift logically right by 4 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
SHR BX,4 D1 EB D1 EB D1 EB D1 EB BX=0123H
Output: Registers are below

Problem 2(ii): Program and output for shift arithmetically left by 1,2,3,4 units are below.
MOV BX, 1234H
SAL BX, 1
In the above program MOV is a basic command which is used to assign a number to a variable
register.BX is a variable register which contains the space of 16 bits. SAL is a command which
shifts bits arithmetically left by 1 unit and stores it to BX register. ‘H’ denotes the hexadecimal
value. For each line of the program written above there is a particular machine code. It is shown
below.

Assembly language Machine code Calculation


MOV BX, 1234H BB 34 12 BX=1234H
SAL BX,1 D1 E3 BX=2468H
Output: Registers are below

Shift arithmetically left by 2 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
SAL BX,2 D1 E3 D1 E3 BX=48D0H
Output: Registers are below

Shift arithmetically left by 3 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
SAL BX,3 D1 E3 D1 E3 D1 E3 BX=91A0H
Output: Registers are below

Shift arithmetically left by 4 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
SAL BX,4 D1 E3 D1 E3 D1 E3 D1 E3 BX=2340H
Output: Registers are below

 Program and output for shift arithmetically right by 1,2,3,4 units are below.
MOV BX, 1234H
SAR BX, 1
In this program MOV is a basic command which is used to assign a number to a variable
register.BX is a variable register which contains the space of 16 bits. SAR is a command which
shifts bits arithmetically right by 1 unit and stores it to BX register. ‘H’ denotes the hexadecimal
value. For each line of the program written above there is a particular machine code. It is shown
below.
Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
SAR BX,1 D1 FB BX=091AH
Output: Registers are below

Shift arithmetically right by 2 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
SAR BX,2 D1 FB D1 FB BX=048DH
Output: Registers are below

Shift arithmetically right by 3 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
SAR BX,3 D1 FB D1 FB D1 FB BX=0246H
Output: Registers are below

Shift arithmetically right by 4 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
SAR BX,4 D1 FB D1 FB D1 FB D1 FB BX=0123H

Output: Registers are below

Problem 2(iii): Program and output for rotate left by 1,2,3,4 units are below.
MOV BX, 1234H
ROL BX, 1
In the above program MOV is a basic command which is used to assign a number to a variable
register.BX is a variable register which contains the space of 16 bits. ROL is a command which
rotates bits left by 1 unit and stores it to BX register. ‘H’ denotes the hexadecimal value. For
each line of the program written above there is a particular machine code. It is shown below.
Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
ROL BX,1 D1 C3 BX=2468H
Output: Registers are below

Rotate left by 2 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
ROL BX,2 D1 C3 D1 C3 BX=48D0H
Output: Registers are below

Rotate left by 3 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
ROL BX,3 D1 C3 D1 C3 D1 C3 BX=91A0H
Output: Registers are below

Rotate left by 4 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
ROL BX,4 D1 C3 D1 C3 D1 C3 D1 C3 BX=2341H
Output: Registers are below

 Program and output for rotate right by 1,2,3,4 units are below.
MOV BX, 1234H
ROR BX, 1
In this program MOV is a basic command which is used to assign a number to a variable
register.BX is a variable register which contains the space of 16 bits. ROR is a command which
rotates bits right by 1 unit and stores it to BX register. ‘H’ denotes the hexadecimal value. For
each line of the program written above there is a particular machine code. It is shown below.
Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
ROR BX,1 D1 CB BX=091AH
Output: Registers are below

Rotate right by 2 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
ROR BX,2 D1 CB D1 CB BX=048DH
Output: Registers are below

Rotate right by 3 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
ROR BX,3 D1 CB D1 CB D1 CB BX=8246H
Output: Registers are below

Rotate right by 4 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
ROR BX,4 D1 CB D1 CB D1 CB D1 CB BX=4123H

Output: Registers are below

Problem 2(iv): Program and output for rotate left through carry by 1,2,3,4 units are below.
MOV BX, 1234H
RCL BX, 1
In the above program MOV is a basic command which is used to assign a number to a variable
register.BX is a variable register which contains the space of 16 bits. RCL is a command which
rotates bits left through carry by 1 unit and stores it to BX register. ‘H’ denotes the hexadecimal
value. For each line of the program written above there is a particular machine code. It is shown
below.

Assembly language Machine code Calculation


MOV BX, 1234H BB 34 12 BX=1234H
RCL BX,1 D1 D3 BX=2468H
Output: Registers are below

Rotate left through carry by 2 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
RCL BX,2 D1 D3 D1 D3 BX=48D0H
Output: Registers are below

Rotate left through carry by 3 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
RCL BX,3 D1 D3 D1 D3 D1 D3 BX=91A0H
Output: Registers are below

Rotate left through carry by 4 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
RCL BX,4 D1 D3 D1 D3 D1 D3 D1 D3 BX=2340H
Output: Registers are below

 Program and output for rotate right through carry by 1,2,3,4 units are below.
MOV BX, 1234H
RCR BX, 1
In this program MOV is a basic command which is used to assign a number to a variable
register.BX is a variable register which contains the space of 16 bits. RCR is a command which
rotates bits right through carry by 1 unit and stores it to BX register. ‘H’ denotes the
hexadecimal value. For each line of the program written above there is a particular machine
code. It is shown below.

Assembly language Machine code Calculation


MOV BX, 1234H BB 34 12 BX=1234H
RCR BX,1 D1 DB BX=091AH
Output: Registers are below

Rotate right through carry by 2 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
RCR BX,2 D1 DB D1 DB BX=048DH
Output: Registers are below

Rotate right through carry by 3 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
RCR BX,3 D1 DB D1 DB D1 DB BX=0246H
Output: Registers are below

Rotate right through carry by 4 units is below.


Assembly language Machine code Calculation
MOV BX, 1234H BB 34 12 BX=1234H
RCR BX,4 D1 DB D1 DB D1 DB D1 DB BX=8123H
Output: Registers are below
Program 3:
MOV AX,1234H
SHL AX,4
MOV BX,1234H
SHL BX,1
ADD AX,BX
In this program MOV is a basic command which is used to assign a number to a variable
register. AX and BX are variable registers which contain the space of 16 bits. SHL is a command
which shifts logically left. ‘H’ denotes the hexadecimal value. For each line of the program
written above there is a particular machine code. It is shown below.

Assembly language Machine code Calculation


MOV AX,1234H B8 34 12 AX=1234H
SHL AX,4 D1 E0 D1 E0 D1 E0 D1 E0 AX=2340H
MOV BX,1234H BB 34 12 BX=1234H
SHL BX,1 D1 E3 BX=2468H
ADD AX,BX 03 C3 AX=47A8H

Output: Registers are below.

Discussion: In this experiment we have learnt how to use assembly language instruction. We
have performed with various commands such as
AND,OR,XOR,SHL,SAL,SAR,SHR,RCL,ROL,ROR,RCR and ADD of hexadecimal numbers using the
MDA-8086 microprocessor kit and also we have checked the result by using the software
‘Emulator-8086’.The results we have got from the kit and the software were same. Thus the
experiment was successful.
Experiment No: 05
Name of the experiment: Experimental study of assembly language program to perform (5*AL-
6*BH+ BH/8) and to convert temperature from 0F to 0C.
Objectives:

Theory: Arithmatic instructions such as: ADD, AD, SUB, SBB, MUL, IMUL, DIV, IDIV can be
used to to represent a simple expression. we have already been introduced about these
instructions in the previous experiments. PUSH & POP instructions are important instructions
that store and retrieve data from the LIFO(Last In First Out) stack memory. PUSH is used to
save the parameter .On the other hand, POP is used to retrieve them from the stack.
ADD instruction adds together its two operands, storing the result in its first operand.
ADC (Add with Carry) instruction adds the values, together with the carry flag. ADC is used to
synthesize multiword arithmetic.
SUB instruction subtracts the value
SUBB instruction subtracts the specified byte variable and the carry flag from the accumulator.
MUL (unsigned multiply) instruction multiplies an 8-, 16-, or 32-bit operand by either AL, AX,
or EAX. The Carry flag indicates whether or not the upper half of the product contains
significant digits.
IMUL executes a signed multiply of a byte, word, or long by the contents of the AL, AX, or
EAX register and stores the product in the AX.
DIV executes unsigned division. div divides a 16-, 32-, or 64-bit register value (dividend) by a
register or memory byte, word, or long (divisor). The quotient is stored in the AL, AX register
respectively. The remainder is stored in AH, Dx.
IDIV executes signed division. idiv divides a 16-, 32-, or 64-bit register value (dividend) by a
register or memory byte, word, or long (divisor). The size of the divisor (8-, 16- or 32-bit
operand) determines the particular register used as the dividend, quotient, and remainder.

Work 1: Performing the operation 5*AL - 6*BH + (BH/8) and storing the value to CX.
Instruction Machine Code Result
MOV AL,10 B0 0A
MOV BL,5 B3 05
MUL BL F6 E3
MOV CX,AX 8B C8
MOV BL,6 B3 06
MOV BH,8 B7 08
MOV AL,BH 8A C7
MUL BL F6 E3
SUB CX,AX 2B C8
PUSH CX 51
MOV CL,3 B1 03
SHR BH,CL D2 EF
MOV BL,BH 8A DF
MOV BH,00 B7 00
POP CX 59
ADD CX,BX 03 CB

Work 2: Converting farenhite scale to degree Celsius scale.


Instruction Machine Code Result

MOV AL,40 B0 28
MOV BL,32 B3 20
SUB AL,BL 2A C3
MOV CL,5 B1 05
IMUL CL F6 E9
MOV DL,9 B2 09
IDIV DL F6 FA
Discussion:
Experiment Name: Study of INC, DEC, CMP, Loop & JUMP
instruction.

Theory:
INC instruction adds one to the destination operand. The destination operand can
be a register or a memory location.

DEC − Used to decrement the provided byte/word by 1

CMP instruction compares two operands. It is generally used in conditional


execution.

JMP transfers control to another point in the program.

There are following types of conditional jump instructions:

i) JC : Stands for 'Jump if Carry'

It checks whether the carry flag is set or not. If yes, then jump takes place, that is:
If CF = 1, then jump.

ii) JNC : Stands for 'Jump if Not Carry'

It checks whether the carry flag is reset or not. If yes, then jump takes place, that
is: If CF = 0, then jump.

iii) JE / JZ : Stands for 'Jump if Equal' or 'Jump if Zero'

It checks whether the zero flag is set or not. If yes, then jump takes place, that is: If
ZF = 1, then jump.

iv) JNE / JNZ : Stands for 'Jump if Not Equal' or 'Jump if Not Zero'

It checks whether the zero flag is reset or not. If yes, then jump takes place, that is:
If ZF = 0, then jump.
Program : 1+3+5+7+…………………………………+15
Solution:
MOV CX,07
MOV AX,01
MOV DX,01
SUM:
INC AX
INC AX
ADD DX,AX
DEC CX
CMP CX,0
JZ SKIP
CMP CX,0
JNZ SUM
SKIP:

Output:
Experiment No. : 07
Experiment Name: Conversion of Upper case to Lower case and vice versa in assembly
language.
Objective:

Theory: An interrupt is a condition that causes the microprocessor to temporarily work


on a different task and then return to its previous task. Interrupt is an event or signal that
request to attention of CPU.
Whenever an interrupt occurs the processor completes the execution of the current
instruction. After the execution of ISR, control returns back to the main routine where it
was interrupted.
MOV AH,01- For keyboard input in AH with the interrupt.
MOV AH,02- call for printing a character on the screen and moving in ah and then "int
21h" causes your function (2) to be executed and whatever is in data register is to be
printed.
MOV DL, 0Ah- is for line feed i.e moves to next output line
MOV DL, 0Dh- is for carriage return. Carriage return means to return to the beginning
of the current line.

Required Apparatus:
1. Emulator-8086

Program : Conversion of small letter to block letter & vice versa.

MOV AH,1
INT 21H
MOV BL,AL
MOV CL,32
XOR BL,CL
MOV AH,2
MOV DL,0AH
INT 21H
MOV DL,0DH
INT 21H
MOV DL,BL
INT 21H

Output:

Discussion:
Experiment no: 08
Name of the experiment: Experimental study of assembly language program to perform the
operation of character string output.
Objectives: The main objective of this experiment is to learn the assembly language instruction
to perform the operation of character string output by using the software ‘Emulator-8086’.
Equipment:
Emulator-8086 software
Overview:
In this experiment we have to use various commands such as MOV, INT, LEA, SUB etc. MOV is a
basic command which is used to assign a number to a variable register. ‘H’ denotes the
hexadecimal value. SUB is used for subtraction purpose.
INT is called ‘Interrupt vector’. It is the address of the BIOS and DOS routine. BIOS is called
‘Basic Input-Output System’. The BIOS routines are responsible for system testing and loading
the operating system. It handles the input-output operations. DOS is called ‘Disk Operating
System’.
LEA stands for “Load effective address”. It puts a copy of the source offset address into the
destination. Input and output of characters and strings may be done by the DOS routine INT
21h. INT 21h, function 9, causes the string whose offset address is in DX to be displayed. The
string must be end with a “$” character.
.Model small tells the assembler that you intend to use the small memory model - one code
segment, one data segment and one stack segment - and the values of the segment registers
are never changed. It has the following effects: You are allowed to write the instruction retn
(return from a near subroutine) as ret.
. STACK 100h : is a segment directive which defines 100h words as program STACK. The linker
sets the values of SS and SP. ... END identifier : the end of program directive. The identifier is
the place where the program to start to run.
A data definition statement sets aside storage in memory for a variable, with an optional name.
Data definition statements create variables based on intrinsic data types such as BYTE, WORD,
DWORD SBYTE, SWORD etc.
MOV AX,@DATA is the first line of code that gets run. I believe @DATA is a variable that holds
the value of the location in memory where the data segment lives. It moves the memory
location of @DATA into the AX register (16 bit register).
DS is called data segment register. It points to the segment of the data used by the running
program. You can point this to anywhere you want as long as it contains the desired data. ES is
called extra segment register.
LEA − Used to load the address of operand into the provided register.
 Write a assembly language program to convert the first lower case letter of your name to
the upper case letter using character string output.
Program:
.MODEL SMALL
.STACK 100H
.DATA
MSG1 DB 'Enter the first lower case letter of your name= $'
MSG2 DB 'The first upper case letter of your name is= $'
.CODE
MOV AX,@DATA
MOV DS,AX
LEA DX,MSG1
MOV AH,9
INT 21H
MOV AH,1
INT 21H
MOV BL,AL
MOV AH,2
MOV DL,0AH
INT 21H
MOV DL,0DH
INT 21H
LEA DX,MSG2
MOV AH,9
INT 21H
MOV AH,2
MOV CL,20H
SUB BL,CL
MOV DL,BL
INT 21H
Output:
 Write a assembly language program to show the first letters of your full name in a column
using character string output.
Program:
.MODEL SMALL
.STACK 100H
.DATA
MSG DB 'Enter the first letters of your full name= $'
.CODE
MOV AX,@DATA
MOV DS,AX
LEA DX,MSG
MOV AH,9
INT 21H
MOV AH,1
INT 21H
MOV BL,AL
MOV AH,1
INT 21H
MOV BH,AL
MOV AH,1
INT 21H
MOV CL,AL
MOV AH,2
MOV DL,0AH
INT 21H
MOV DL,0DH
INT 21H
MOV AH,2
MOV DL,BL
INT 21H
MOV AH,2
MOV DL,0AH
INT 21H
MOV DL,0DH
INT 21H
MOV AH,2
MOV DL,BH
INT 21H
MOV AH,2
MOV DL,0AH
INT 21H
MOV DL,0DH
INT 21H
MOV AH,2
MOV DL,CL
INT 21H
Output:

Discussion:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy