100% found this document useful (3 votes)
2K views

Lab 1 - Introduction To 8086 Microprocessor Emulator

This document provides an introduction to microprocessors and microcontrollers. It discusses the key differences between microprocessors and microcontrollers. Specifically, it notes that microprocessors only contain a CPU while microcontrollers contain a CPU as well as RAM, ROM, and other peripherals integrated onto a single chip. The document also summarizes the EMU 8086 microprocessor emulator software, which can be used to test microprocessor code. It provides an overview of how to create and run projects using the emulator.

Uploaded by

Saif Ullah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
2K views

Lab 1 - Introduction To 8086 Microprocessor Emulator

This document provides an introduction to microprocessors and microcontrollers. It discusses the key differences between microprocessors and microcontrollers. Specifically, it notes that microprocessors only contain a CPU while microcontrollers contain a CPU as well as RAM, ROM, and other peripherals integrated onto a single chip. The document also summarizes the EMU 8086 microprocessor emulator software, which can be used to test microprocessor code. It provides an overview of how to create and run projects using the emulator.

Uploaded by

Saif Ullah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

EEE342 - Microprocessor Systems and Interfacing

Introduction to Microprocessor & Microcontroller


Lab. Experiment # 1

Objective:
Introduction to Microprocessors and Microcontrollers and working environment of EMU 8086
(Microprocessor Emulator).

Introduction:
A microprocessor is also known as computer processor which incorporates the functions of a
computer's central processing unit (CPU) on a single integrated circuit (IC) or at most a few
integrated circuits. The microprocessor is a multipurpose, clock driven, register based, digital-
integrated circuit which accepts binary data as input, processes it according to instructions stored
in its memory, and provides results as output. Microprocessors contain both combinational logic
and sequential digital logic. Microprocessors operate on numbers and symbols represented in
the binary numeral system.
Microprocessors touch almost every aspect of modern life. They can be found in vehicles,
consumer electronics, communications devices, appliances, toys and of course computers. With
the exception of full computers (i.e. desktop or full laptops) which use full microprocessors with
separate memory and peripherals (device used to put information into and get information out
of the computer).

Figure 2.1: Block Diagram of Microprocessor

8|Page Department of Electrical & Computer Engineering | CUI Wah


EEE342 - Microprocessor Systems and Interfacing

Difference between Microprocessor and Microcontroller:


The term microprocessor and microcontroller have always been confused with each other. Both
of them have been designed for real time application. They share many common features and at
the same time they have significant differences. Both the IC’s cannot be distinguished by looking
at them. They are available in different version starting from 6 pin to as high as 80 to 100 pins or
even higher depending on the features. Both microcontrollers and microprocessors are complex
sequential digital circuits meant to carry out job according to the program / instructions.
Microprocessor is an IC which has only the CPU inside them i.e. only the processing powers such
as Intel’s Pentium 1,2,3,4, core 2 duo, i3, i5 etc. These microprocessors don’t have RAM, ROM,
and other peripheral on the chip. A system designer has to add them externally to make them
functional. Application of microprocessor includes Desktop PC’s, Laptops, notepads etc. But this
is not the case with Microcontrollers. A Microcontroller is a programmable digital processor with
necessary peripherals. Microcontroller has a CPU, in addition with a fixed amount of RAM, ROM
and other peripherals all embedded on a single chip. At times it is also termed as a mini computer
or a computer on a single chip. Today different manufacturers produce microcontrollers with a
wide range of features available in different versions. Some manufacturers are ATMEL,
Microchip, TI, Freescale, Philips, Motorola etc. Microcontrollers are designed to perform specific
tasks.
Comparing microcontroller and microprocessor in terms of cost is not justified. Undoubtedly a
microcontroller is far cheaper than a microprocessor. However microcontroller cannot be used
in place of microprocessor and using a microprocessor is not advised in place of a microcontroller
as it makes the application quite costly. Microprocessor cannot be used stand alone. They need
other peripherals like RAM, ROM, buffer, I/O ports etc. and hence a system designed around a
microprocessor is quite costly.

Comparison between 8085, 8086 and 8088 Microprocessors:


8085 8086 8088
8085 is an 8 bit 8086 is a 16 bit 8088 is a 16 bit
microprocessor microprocessor microprocessor
It has 8 bit data bus It has 16 bit data bus It has 8 bit data bus
It has 8 bit ALU It has 16 bit ALU It has 16 bit ALU
8085 does not require 8086 requires memory 8088 does not require
memory banking as it has an banking to transfer 16 bit memory banking as it has an
8 bit data bus data at a time 8 bit data bus
8085 performs slower 8086 performs faster 8088 performs slower
memory operations as it can memory operations as it can memory operations as it can
transfer only 8 bits in one transfer 16 bits in one cycle transfer only 8 bits in one
cycle cycle
9|Page Department of Electrical & Computer Engineering | CUI Wah
EEE342 - Microprocessor Systems and Interfacing

8085 does not support 8086 supports pipeline 8088 supports pipeline
pipeline architecture architecture architecture
8085 has no pre-fetch queue 8086 has a 6 byte pre-fetch 8088 has a 4 byte pre-fetch
as it does not support queue for pipelining queue for pipelining
pipelining
8085 has an IO/ pin to 8086 has an M/ pin to 8088 has an IO/ pin to
differentiate between differentiate between differentiate between
memory and I/O operations memory and I/O operations memory and I/O operations
8085 has no pre-fetch queue 8086 BIU will fetch new bytes 8088 BIU will fetch a new
into the pipelining queue byte into the pipelining
when 2 bytes of the queue queue when 1 byte of the
are empty queue is empty
8085 has 5 flags 8086 has 9 flags 8088 has 9 flags

Table 2.2: Comparison of different Microprocessors

Programming Model of 8086:


The programming model for a microprocessor shows the various internal registers that are
accessible to the programmer. As a programmer of the 8086 we must be familiar with the various
registers in the execution unit (EU) and Bus Interface Unit (BIU). The Following Figure is a model
for the 8086. In general, each register has a special function.

Figure 2.2: Programming Model

10 | P a g e Department of Electrical & Computer Engineering | CUI Wah


EEE342 - Microprocessor Systems and Interfacing

The four data registers labeled AX, BX, CX and DX may be further subdivided for 8-bit operations
into a high-byte or low-byte register, depending where the byte is to be stored in the register.
Thus, for byte operations, the registers may be individually addressed. So, each of these is 16 bits
wide but can be accessed as a byte or a word.

 AX: known as an accumulator is used in arithmetic and logical operations


 BX: refers to the 16-bit base register
 CX: is used as a counter
The 8086 has a 16 bit flag register of which only 9 bits are used as flags and the rest 7 bits are not
used. These flags are set or reset after the operation in an ALU. Six of the flags are status
indicators, reflecting properties of the result of the last arithmetic or logical instructions. These
are CF, AF, PF, ZF, SF and OF. The 8086/88 has several instructions that can be used to transfer
program control to a new memory location based on the state of the flags. Three of the flags can
be set or reset directly by the programmer and are used to control the operation of the processor.
These are TF, IF, and DF.

EMU8086 - The Microprocessor Emulator:


 emu8086 is the emulator of 8086 (Intel and AMD compatible) microprocessor and
integrated assemblers.
 The emulator runs programs like the real microprocessor in step-by-step mode.
 It shows registers, memory, stack, variables and flags.
 All memory values can be investigated and edited by a double click.
 The instructions can be executed back and forward.
 emu8086 can create a tiny operating system and write its binary code to a bootable
floppy disk.
 The software package includes several external virtual devices: robot, stepper motor,
led display, and traffic lights intersection. Additional devices can be created.

11 | P a g e Department of Electrical & Computer Engineering | CUI Wah


EEE342 - Microprocessor Systems and Interfacing

Working with EMU 8086:


 Once you open the emu8086 emulator you should see the following screen.

Figure 2.3: Startup Window

 From here, you can create a new project with following options;

Figure 2.4: Formation of Project

12 | P a g e Department of Electrical & Computer Engineering | CUI Wah


EEE342 - Microprocessor Systems and Interfacing

This screen allows you select what kind of file you want create- either a bin file with .com
extension, an executive file with .exe extension, a pure binary file or a boot file. Once you select
the type the emu8086 opens the editor with a readymade template of the kind of file you wanted
to create.

 Consider that you selected .exe template then the editor opens with default template as
shown below

Figure 2.5: Template

Now, you can write the code in the “add your code here” section, change the code, data segment
part and define constant or variables.

 If you select cancel in the above default template selection then it opens just the blank
editor as shown below

13 | P a g e Department of Electrical & Computer Engineering | CUI Wah


EEE342 - Microprocessor Systems and Interfacing

Figure 2.6: New File

Example:
mov ax, 10
add ax, 21
inc ax
dec ax
sub ax, 12
add ax, 7
inc ax
dec ax
sub ax, 20

Once you have typed in your program you should save the program by going to File  Save or
File>save as or just by clicking the save button on the toolbar. Emu8086 will save it the newly
created file with .asm extension in it's default location (C:\emu8086\MySource) but you can
browse to a folder where you want to save the file.

14 | P a g e Department of Electrical & Computer Engineering | CUI Wah


EEE342 - Microprocessor Systems and Interfacing

Figure 2.7: Save Project

Once you have saved the file, you can emulate the program by clicking on the emulate button on
the toolbar to see the behavior of the program. That is what register has what content, the flag
resisters that gets effected by the program and so on. The screenshot below shows this process.

Figure 2.8: Emulation Window

15 | P a g e Department of Electrical & Computer Engineering | CUI Wah


EEE342 - Microprocessor Systems and Interfacing

From this emulator window we can just run the program or go through the program step by step
by clicking on the single step button.
For the example program above when we step through the program we can see the content of
the accumulator and how it gets modified and what new values are stored. Not only can we know
the content of the accumulator but also the other registers, the stack and the flag register.

16 | P a g e Department of Electrical & Computer Engineering | CUI Wah


EEE342 - Microprocessor Systems and Interfacing

Lab Tasks

Task 1:
Write the following code in emulator and examine the contents of registers by single stepping
MOV AL, 57
MOV DH, 69
MOV DL, 72
MOV BX, DX
MOV BH, AL
MOV BL, 9FH
MOV AH, 20
ADD AX, DX
ADD CX, BX
ADD AX, 1F35H

Task 2:
Write a program to subtract the content of register DX from the content of register AX, then add
the result to the content of CX. Set the registers to 4, 0A and 1F respectively.

17 | P a g e Department of Electrical & Computer Engineering | CUI Wah

You might also like