0% found this document useful (0 votes)
6 views25 pages

Lecture Notes - Unit 1

The document provides an overview of microprocessor architecture, focusing on the 8086 microprocessor. It discusses the evolution of microprocessors, categorizing them into mainframes, minicomputers, and microcomputers, as well as detailing the 8086's architecture, including its bus interface unit and execution unit. Additionally, it explains programming methods for microcomputers, including machine language, assembly language, and high-level languages.

Uploaded by

Lokesh Upputuri
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)
6 views25 pages

Lecture Notes - Unit 1

The document provides an overview of microprocessor architecture, focusing on the 8086 microprocessor. It discusses the evolution of microprocessors, categorizing them into mainframes, minicomputers, and microcomputers, as well as detailing the 8086's architecture, including its bus interface unit and execution unit. Additionally, it explains programming methods for microcomputers, including machine language, assembly language, and high-level languages.

Uploaded by

Lokesh Upputuri
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/ 25

10211CS109 – Microprocessor and Microcontroller

UNIT 1 MICROPROCESSOR ARCHITECTURE – 8086


(Prepared by Dr. G. Dhanabalan ASP / CSE)
(2023 – 24 WINTER SEMESTER)

Types of computers :
Mainframes
Computers come in a wide variety of sizes and capabilities. The largest and most
powerful are often called mainframes. Mainframe computers are designed to work at very
high speeds with large data words, typically 64 bits or greater and they have massive amounts
of memory. Computers of this type are used for military defense control, for business data
processing (in an insurance company, for example), and for creating computer graphics
displays for science fiction movies. Examples of this type of computer are the IBM 4381, the
Hone ywell DPS8, and the Cray Y-MP1832. The fastest and most powerful mainframes are
called supercomputers.

Minicomputers
Scaled-down versions of mainframe computers are often called minicomputers. The
main unit of a minicomputer usually fits in a single rack or box. A minicomputer runs more
slowly, works directly with smaller data words loften 32-bit words), and does not have as
much memory as a mainframe. Computers of this type are used for business data processing,
industrial control (for an oil refinery, for example), and scientific research. Examples of this
type of computer are th Digital Equipment Corporation VAX 6360 and the Data General
MV/8000l1.

Microcomputers
As the name implies, microcomputers are small computers. They range from small
controllers that work directly with 4-bit words and can address a few thousand bytes of
memory to larger units that work directly with 32-bit words and can address billions of bytes
of memory. Some of the more powerful microcomputers have all or most of the features of
earlier minicomputers. Therefore it has become very hard to draw a sharp line between these
two types. One distinguishing feature of a microcomputer is that the CPU is usually a single
integrated circuit called a microprocessor. Older books often used the terms microprocessor
and microcomputer interchangeably. But actually he microprocessor is the CPU to which you
add ROM, RAM and ports to make a microcomputer. Microcomputers are used in everything
from smart sewing machines to computer aided design systems. Examples of micro
computers are the Intel 805l single chip controller. lntei 8051 microcontroller is contained in
a single 40-pin chip.

Evolution of Microprocessor :
A common way of categorizing microprocessors is by the number of bits that their
ALU can work with at a time, In other words, a microprocessor with a 4-bit ALU will be
referred to as a 4’bit microprocessor, regardless 01’ the number of address lines or the
number of data bus lines that it has. The first commercially available microprocessor was the
Intel 4004, produced in 1971. It contained 2300 PMOS transistors. The 4004 was a 4- bit
device intended to be used with some other devices in making a calculator. In 1974 Intel
announced the 8080. which had a much larger instruction set than the 8008 and required Only
two additional devices to form a functional CPU. Also, the 8080 used NMOS transistors, so it
operated much faster than the 8008. The 8080 is referred to as a second-generation
microprocessor. Soon after Intel produced the 8080. Motorola came out with the MC6800,
another 8-bit general-purpose CPU. The 6800 had the advantage that it required only a + 5-V
supply rather than the – 5-V. + 5-V. and + 12- V supplies required by the 8080. For several
years the 8080 and the 6800 were the top-selling 8-bit microprocessors. Some of their
competitors were the MOS Technology 6502. Microprocessors have evolved in three
major directions during the last 15 years.
Dedicated or Embedded Controllers
One direction has been dedicated or em bedded controllers. These devices are used to
control "smart" machines, such as microwave ovens. clothes washers, sewing machines. auto
ignition systems, and metal lathes. Texas Instruments has produced millions of their TMS-
1000 family of 4-bit microprocessors for this type of application. In 1976 Intel introduced the
8048 which contains an 8-bit CPU, RAM. ROM and some I/O ports all in one 40-pin
package. Other manufacturers have followed with similar products. These devices are often
referred to as microcontrollers. Some currently available devices in this category—the Intel
8051 and the Motorola MC6801. A more recently Introduced single chip microcontroller, the
Intel 8096. contains a 16-bit CPU. ROM. RAM. a UART. ports, timers, and a 10-bit analog-
to-digital converter.
Bit-Slice Processors
A second direction of microprocessor evolution has been bit-slice processors. For
some applications, general purpose CPUs such as (he 8080 and 6800 are not fast enough or
do not have suitable instruction sets. For these applications, several manufacturers produce
devices which can be used to build a custom CPU. An example is the Advanced Micro
Devices 2900 family of devices. This family includes 4-bit ALUs. multiplexers. sequencers.
and other parts needed for custom-building a CPU. The term slice comes from the fact that
these parts can be connected In parallel to work with 8-bit words. 16-bit words, or 32-bit
words. In other words, a designer can add as many slices as needed for a particular particular
application. The designer not only custom-designs the hardware of the CPU, but also custom-
makes the instruction set for it using "microcode."
General-Purpose CPUs
The third major direction of microprocessor evolution has been toward general
purpose CPUs which give a microcomputer most or all of the computing power of earlier
minicomputers. After Motorola came out with the MC6800. Intel produced the 8085 an
upgrade of the 8080 that required only a + 5-V supply. Motorola then produced the MC6809
which has a few 16-bit instructions, but is still basically an 8-bit processor. In 1978 Intel
came out with the 8086 which is a full 16- bit processor. Some 16-bit microprocessors, such
as the National PACE and the Texas Instruments 9900 family of devices had been available
previously, but the market apparently wasn't ready. Soon after Intel came out with the 8086
Motorola came out with the 16-bit MC68000 and the 16-bit race was off and running. The
8086 and the 68000 work directly with 16-bit words instead of with 8-bit words, they can
address a million or more bytes of memory instead of the 64 Kbytes addressable by the 8-bit
processors, and they execute instructions much faster than the 8-bit processors. Also, these
16- bit processors have single instructions for functions such as multiply and divide, which
required a lengthy sequence of instructions on the 8-bit processors. The evolution along this
last path has continued on to 32-bit processors that work with gigabytes (10 bytes) or
terabytes (l02 bytes) of memory. Examples of these devices are the Intel 80386. the Motorola
MC68020 and the National 32032.
8086 Microprocessor architecture:
8086 CPU Is divided into two independent functional parts, the bus intetface unit or
BIU, and the execution unit or EU. Dividing the work between these two units speeds up
processing. The BIU sends out addresses, fetches instructions from memory, reads data from
ports and memory, and writes data to ports and memory. In other words, the BIU handles all
transfers of data and addresses on the buses for the execution unit. The execution unit of the
8086 tells the BIU where to fetch instructions or data from, decodes instructions, and
executes instructions. Let's take a look at some of the parts of the execution unit.
Execution Unit
EU contains control circuitry which directs internal operations. A decoder in the EU
translates instructions fetched from memory into a series of actions which the EU carries out.
The EU has a 16-bit arithmetic logic unit which can add, subtract, AND. OR, XOR,
increment, decrement, complement, or shift binary numbers.

8086 Internal Block diagram


Flag register
A flag is a flip-flop which indicates some condition produced by the execution of an
instruction or controls certain operations of the EU. A 16-bit flag register in the EU contains
nine active flags. Below figure shows the location of the nine flags in the flag register. Six of
the nine flags are used to indicate some condition produced by an Instruction. For example, a
flip-flop called the carry flag will be set to a I if the addition of two 16- bit binary numbers
produces a carry out of the most significant bit position. If no carry out of the MSB is
produced by the addition, then the carry flag will be a 0. The EU thus effectively-runs up a
"flag" to tell you that a carry was produced. The six conditional flags in this group are the
carry flag (CF). the parity flag IPF). the auxiliary carry flag (AF), the zero flag (ZF). the sign
flag (SF), and the overJlowflag (OFf. The names of these flags should give you hints as to
what conditions affect them. Certain 8086 instructions check these flags to determine which
of two alternative actions should be done in executing the instruction.

8086 Flag register format


The three remaining flags in the flag register are used to control certain operations of the
processor. These flags are different from the six conditional flags described above in the way
they are set or reset. The six conditional flags are set or reset by the EU on the basis of the
results of some arithmetic or logic operation. The control flag are deliberately set or reset
with specific instructions you put in your program. The three control flags are the trap flag
(TF) which is used for single stepping through a program: the tnterruptflag (IF), which is
used to allow or prohibit the interruption of a program; and the direction flag (DE) which is
used with string instructions.
General purpose register
EU has eight general purpose registers, labeled AH. AL. BFI. BL. CH , CL. DH. and
DL. These registers can be used individually for temporary storage of 8-bit data. The AL
register is also called the accumulator. It has some features that the other general-purpose
registers do not have. Certain pairs of these general .purpose registers can be
used together to store 16-bit data words. The acceptable register pairs are AH and AL. BH
and BL. CH and CL and DH and DL. The AH—AL pair is referred to as the AX register, the
BH—BL pair is referred to as the BX register, the CH—CL pair s relerred to as the CX
register, and the DlH—DL pair is referred to as the DX register.
Bus Interface Uint – BIU
While the EU is decoding an instruction or executing an Instruction which does not
require use of the buses. the BIU fetches up to six instruction bytes for the fouowlng
instructions. The BlU stores these prefetched bytes in a first-In—first-out register set called a
queue. When the EU is ready for its next Instruction, it simply reads the instruction byte(s)
for the instruction from the queue in the BIU. This is much faster than sending out an address
to the system memory and waiting for memory to send back the next instruction byte or
bytes. The process Is analogous to the way a bricklayer's assistant fetches bricks ahead of
time and keeps a queue of bricks lined up so that the bricklayer can just reach out and grab a
brick when necessary. Except in the cases of JMP and CALL instructions, where the queue
must be dumped and then reloaded starting from a new address, this prefetch-and-queue
scheme greatly speeds up processing. Fetching the next instruction while the current
instruction executes is called ptpelining.
Segment registers
The 8086 BIU sends out 20-bit addresses, so it can address any of 220 or 1.048.576
bytes in memory. However, at any given time the 8086 works with only four 65.536-byte
(64-Kbyte) segments within this 1,048,576 byte (1-Mbyte) range. Four segment registers in
the BIU are used to hold the upper 16 bits of the starting addresses of four memory segments
that the 8086 is working with at a particular time. The four segment registers are the code
segment ( CS) register. the stack segment (SS) register. the extra segment (ES) register. and
the data segment (DS) register. Below figure shows how these four segments might be
positioned in memory at a given time.

The four segments can be separated as shown, or, for small programs which do not need all
64 Kbytes in each segment. they can overlap. To repeat, then, a segment register is used to
hold the upper 16 bits of the starting address for each of the segments. The code segment
register. For example, holds the upper 16 bits of the starting address for the segment from
which the BLU Is currently fetching instruction code bytes. The BIU always inserts zeros for
the lowest 4 bits (nibble) of the 20-bit starting address for a segment. If the code segment
register contains 348AH. for example, then the code segment will start at address 348A0H. In
other words, a 64-Kbyte segment can be located anywhere within the 1-Mbyte address space,
but the segment will always start at an address with zeros in the lowest 4 bits. This constraint
was put on the location of segments so that it is only necessary to store and manipulate 16-bit
numbers when working with the starting address of a segment. The part of a segment starting
address stored in a segment register is often called the segment base.

8086 Programming method


To run a program, a microcomputer must have the program stored in binary form in
successive memory locations. There are three language levels that can be used to write a
program for a microcomputer.
1. Machine language
2. Assembly language
3. High level languages
Machine language
You can write programs as simply a sequence of the binary codes for the instructions
you want the microcomputer to execute. The three-instruction program in below figure is an
example. This binary form of the program is referred to as machine language because it is the
form required by the machine. However, it is difficult, if not impossible, for a programmer to
memorize the thousands of binary instruction codes for a CPU such as the 8086. Also. it is
very easy for an error to occur When working with long series of is and 0's. Using
hexadecimal representation for the binary codes might help some, but there are still thousands
of Instruction codes to cope with.

Execution of a three step computer program


Assembly language
To make programming easier, many programmers write programs in assembly
language. They then translate the assembly language program to machine language so that it
can be loaded into memory and run. Assembly language uses two-, three-, or four-letter
mnemonics to represent each instruction type. A mnemonic is Just a device to help you
remember something. The letters in an assembly language mnemonic are usually initials or a
shortened form of the English word(s) for the operation performed by the instruction. For
example, the mnemonic for subtract is SUB, the mnemonic for Exclusive OR is XOR. and
the mnemonic for the instruction to copy data from one location to another is MOV.
Assembly language statements are usually written in a standard form that has four fields. as
shown in Figure.

Assembly language program statement format


The first field in an assembly language statement is the labeljietd. A label isa symbol or
group of symbols used to represent an address which is not specifically known at the time the
statement is written. Labels are usually followed by a colon. Labels are not required in a
statement. theyarejust Inserted where they are needed. We will show later many uses of
labels. The opcode field of the instruction contains the mnemonic for the Instruction to be
performed. Instruction mnemonics are sometimes called operation codes, or opcodes. The
ADD mnemonic in the example Statement in Figure Indicates that we want the instruction to
do an addition.
The operand field of the statement contains the data. the memory address, the port
address, or the name of the register on which the instruction is to be performed. Operand is
Just another name for the data item(s) acted on by an instruction. In the example instruction
in Figure, there are two operands. AL and 07H, specified in the operand field, AL represents
the AL register, and 07H represents the number 07H. This assembly language statement thus
says, 'Add the number 07H to the contents of the AL register.' By Intel convention, the result
of the addition will be put in the register or the memory location specified before the comma
in the operand field. For the example statement in Figure then the result will be left in the AL
register. As another example, the assembly language statement ADD BH. AL, when
converted to machine language and run, will add the contents of the AL register to the
contents of the BH register. The results will be left in the BH register. The final field In an
assembly language statement such as that in Figure is the comment fleld, which starts with a
semicolon. Comments do not become part of the machine language program; but they are
very important. You write comments in a program to remind you of the function that an
instruction or group of instructions performs in the program.
High level languages
Another way of writing a program for a microcomputer is with a high-level language,
such as BASIC. Pascal, or C. These languages use program statements which are even more
English-like than those of assembly language. Each high .level statement may represent many
machine code instructions. An interpreter program or a compiler program is used to translate
higher level language statements to machine codes which can be loaded into memory and
executed. Programs can usually be written faster In high-level languages than in assembly
language because the high-level language works with bigger building blocks. However,
programs written in a high-level language and interpreted or compiled almost always execute
more slowly and require more memory than the same programs written in assembly language.
Programs that involve a lot of hardware control, such as robots and factory control systems,
or programs that must run as quickly as possible are usually best written in assembly
language. Complex data processing programs that manipulate massive amounts of data. such
as insurance company records, are usually best written in a high-level language. The decision
concerning which language to use has recently been made more difficult by the fact that
current assemblers allow the use of many high-level language features, and the fact that some
current high level languages provide assembly language features.

Program development tools


Editor
An editor is a program which allows you to create a file containing the assembly
language statements for your program. Examples of suitable editors are PC Write, Wordstar
and the editor that comes with some assemblers. The actual position of each field on a line is
not important, but you must put the fields of each statement in the correct order and you must
leave at least one blank between fields whenever possible. We like to line the fields up in
columns so that it is easier to read the program. As you type in your program the editor stores
the ASCII codes for the letters and numbers in successive RAM locations. If you make a
typing error, the editor will let you back up and correct it. If you leave out a program
statement, the editor will let you move everything down and insert the line. This is much
easier than working with pencil and paper, even If you type as slowly as I do. When you have
typed in all of your program, you then save the the on a floppy or hard disk. This file is called
a source file. The next step is to process the source file with an assembler. Incidentally, if you
are going to use the TASM or MASM assembler, you should give your source file name the
extension .ASM.
Assembler
An assembler program is used to translate the assembly language mnemonics for
instructions to the corresponding binary codes. When you run the assembler, it reads the
source file of your program from the disk where you saved it after editing. On the first pass
through the source program, the assembler determines the displacement of named data items,
the offset of labels. etc., and puts this information in a symbol table. On the second pass
through the source program, the assembler produces the binary code for each instruction and
inserts the offsets, etc.. that it calculated during the first pass. The assembler generates two
flies on the floppy or hard disk. The first file, called the object file. is given the extension
.OBJ. The object file contains the binary codes for the instructions and Information about the
addresses of the instructions. After further processing, the contents of this file will be loaded
into memory and run. The second file generated by the assembler is called the assembler list
file and is given the extension .LST. You usually send this file to a printer so that you will
have a printout of the entire program to work with when you are testing and troubleshooting
the program.
The assembler listing will also indicate any typing or syntax (assembly language
grammar) errors you made in your source program. To correct the errors indicated on the
listing, you use the editor to reedit your source program and save the corrected source
program on disk. You then reassemble the corrected source program. It may take several
times through the edit-assemble loop before you get all the syntax errors out of your source
program. A linker or locator will be used to assign the physical starting addresses for the
segments. MOV AX, DATA_HERE statement is assembled with some blanks after the basic
instruction code because the start of DS is not known at the time the program is assembled.
Linker
A Linker is a program used to join several object flies into one large object file. When
writing large programs, it is usually much more efficient to divide the large program into
smaller modules. Each module can be individually written, tested, and debugged. Then, when
all the modules work, their object modules can be linked together to form a large, functioning
program. Also, the object modules for useful programs - a square root program, for example -
can be kept in a linker file and linked into other programs as needed. The linker produces a
link file which contains the binary codes for all the combined modules. The linker also
produces a link map file which contains the address information about the linked files. The
linker, however, does not assign absolute addresses to the program: it assigns only relative
addresses starting from zero. This form of the program is said to be re locatable because it
can be put anywhere in memory to be run.
The linkers which come with the TASM or MASM assemblers produce link files with
the .EXE extension. If your program does not require any external hardware, you can use a
program called a debugger to load and run the .EXE file. The debugger program which loads
your program into memory automatically assigns physical starting addresses to the segments.
If you are going to run your program on a system such as an SDK-86 board, then you must
use a locator program to assign physical addresses to the segments in the .EXE. file.
Locator
A locator Is a program used to assign the specific addresses of where the segments of
object code are to be loaded into memory. A locator program called EXE2BIN comes with
the IBM PC Disk Operating System (DOS). EXE2BIN converts a .EXE file to a BIN file
which has physical addresses. You can then use the SDKCOM1 program to download the
BIN file in the SDK-86 board. The SDKCOM1 program can also be used to run the program
and debug it on the SDK-86 board.
Debugger
If your program requires no external hardware or requires only hardware accessible
directly from your microcomputer, then you can use a debugger to run and debug your
program. A debugger is a program which allows you to load your object code program into
system memory, execute the program, and troubleshoot or debug it. The debugger allows you
to look at the contents of registers and memory locations after your program runs. It allows
you to change the contents of registers and memory locations and rerun the program. Some
debuggers allow you to stop execution after each instruction so that you can check or alter
memory and register contents.
A debugger also allows you to set a breakpoint at any point in your program if you
insert a breakpoint, the debugger will run the program up to the instruction where you put the
breakpoint and then stop execution. You can then examine register and memory contents to
see whether the results are correct at that point. If the results are correct, you can move the
breakpoint to a later point in the program. If the results are not correct, you can check the
program up to that point to find out why they are not correct. The point here is that the
debugger commands help you to quickly find the source of a problem in your program. Once
you find the problem, you can then cycle back and correct the algorithm if necessary, use the
editor to correct your source program, reassemble the corrected source program. Relink and
run the program again.
A basic debugger comes with the DOS for most IBM PC-type computers, but more
powerful debuggers such as Borland's Turbo Debugger and Microsoft's Code view debugger
make debugging much easier because they allow you to directly see the contents of registers
and memory locations change as a program executes. Microprocessor prototyping boards
such as the SDK-86 contain a debugger program in ROM. On boards such as this, the
debugger is commonly called a monitor program because it lets you monitor program
activity. The SDK-86 monitor program, for example, lets you enter and run programs, single-
step through programs, examine register and memory contents, and insert breakpoints.
Emulator
Another way to run your program is with an emulator. An emulator is a mixture of
hardware and software. It is usually used to test and debug the hardware and software of an
external system, such as the prototype of a microprocessor based instrument. Part of the
hardware of an emulator is a multiwire cable which connects the host system to the system
being developed. A plug at the end of the cable is plugged into the prototype system in place
of its microprocessor. Through this connection the software of the emulator allows you to
download your object code program into RAM in the system being tested and run it.
Like a debugger, an emulator allows you to load and run programs, examine and
change the contents of registers, examine and change the contents of memory locations, and
insert breakpoints in the program. The emulator also takes a snapshot of the contents of
registers, activity on the address and data bus and the state of the flags as each instruction
executes. The emulator stores this trace data, as it is called, in a large RAM. You can do a
printout of the trace data to see the results that your program produced on a step-by-step
basis. Another powerful feature of an emulator is the ability to use either system memory or
the memory on the prototype for the program you are debugging.

Interrupts and interrupt service procedures


An 8086 interrupt can come from any one of three sources.
 One source is an external signal applied to the non-maskable interrupt (NMI) input pin or
to the Interrupt (INTR) input pin. An Interrupt caused by a signal applied to one of these
inputs is referred to as a hardware Interrupt.
 A second source of an interrupt is execution of the Interrupt Instruction. tNT. This is
referred to as a software interrupt.
 The third source of an interrupt is some error condition produced in the 8086 by the
execution of an instruction. An example of this is the divide-by-zero interrupt. If you
attempt to divide an operand by zero, the 8086 will automatically interrupt the currently
executing program.
At the end of each instruction cycle, the 8086 checks to see if any interrupts have
been requested. If an interrupt has been requested, the 8086 responds to the interrupt by
stepping through the following series of major actions.
1. It decrements the stack pointer by 2 and pushes the flag register on the stack.
2. It disables the 8086 INTR Interrupt input by clearing the interrupt flag (IF) In the flag
register.
3. It resets the trap flag (TF) in the flag register.
4. It decrements the stack pointer by 2 and pushes the current code segment register
contents on the stack.
5. It decrements the stack pointer again by 2 and pushes the current instruction pointer
contents on the stack.
6. It does an indirect far jump to the start of the procedure you wrote to respond to the
interrupt.

8086 interrupt response


Above Figure summarizes these steps in diagram form. As you can see, the 8086 pushes the
flag register on the stack, disables the INTR input and the single step function, and does
essentially an indirect far call to the interrupt service procedure. An IRET Instruction at the
end of the interrupt service procedure returns execution to the main program. Now let's see
how the 8086 actually gets to the interrupt procedure. When the 8086 does a far call to a
procedure, it puts a new value in the code segment register and a new value in the instruction
pointer. For an indirect far call, the 8086 gets the new values for CS and IP from four
memory addresses. Likewise, when the 8086 responds to an Interrupt, it goes to four memory
locations to get the CS and IP values for the Start of the interrupt-service procedure.
In an 8086 system, the first 1 Kbyte of memory from 00000H to 003FFH is set aside
as a table for storing the starting addresses of interrupt service procedures. Since 4 bytes are
required to store the CS and IP values for each Interrupt service procedure, the table can hold
the starting addresses for up to 256 Interrupt procedures. The starting address of an Interrupt
service procedure is often called the interrupt vector or the interrupt pointer, so the table is
referred to as the interrupt-vector table or the interrupt -pointer table.
Below Figure shows how the 256 Interrupt vectors are arranged in the table In
memory. Note that the instruction pointer value is put in as the low word of the vector and the
code segment register is put in as the high word of the vector. Each double word Interrupt
vector is identified by a number from 0 to 255. Intel calls this number the type of the
interrupt. The lowest five types are dedicated to specific Interrupts, such as the divide-by-
zero interrupt, the single step interrupt, and the non-maskable interrupt. Interrupt types 5 to
31 are reserved by Intel for use in more complex microprocessors, such as the 80288, 80386,
and 80486. The upper 224 Interrupt types, from 32 to 255 are available for you to use for
hardware or software interrupts. The vector for each interrupt type requires four memory
locations. Therefore, when the 8086 responds to a particular type interrupt, it automatically
multiplies the type by 4 to produce the desired address in the vector table. It then goes to that
address in the table to get the starting address of the interrupt service procedure.
8086 Interrupt pointer table

8086 signals, Basic configurations, System connections and Timing


8086 Pin diagram
Pin diagram of 8086 processor is shown in the below diagram. Find on V CC on pin 40 and
ground on pins 1 and 20. Find the clock input, labeled CLK. on pin 19. An 8086 requires a
clock signal from some external clock generator to synchronize internal operations in the
processor. Different versions of the 8086 have maximum clock frequencies ranging from 5
MHz to 10 MHz. Now look for the address/data bus lines. AD0—AD15. 8086 has a 20-bit
address bus and a 16-bit data bus and that the lower 16 address lines are multiplexed Out of
the data bus to minimize the number of pins needed. The 8086 sends out a signal called
Address Latch Enable, or ALE on pin 25 to strobe the external address latches. The upper 4
bits of the 20-bit address are sent out on the Lines labeled Al6/S3 through A19/S6. The
double mnemonic on these pins shows that address bits A16 through Al9 are sent out on these
lines during the first part of a machine cycle, and status information, which identifies the type
or operation being done in that cycle, is sent out on these lines during a later part of the cycle.
8086 pin diagram
Pin 32 of the 8086 in Figure is labeled RD. This signal will be asserted low when the 8086 is
reading data from memory or from a port. Pin 29 has the labels WR and LOCK next to it
because it has two functions. The function of this pin and the functions of the other pins
between 24 and 31 depend on the mode in which the 8086 is operating. The operating mode
of the 8086 is determined by the logic level applied to the MN/MX input, pin 33. If pin 33 is
asserted high, then the 8086 will function in minimum mode, and pins 24 through 31 will
have the functions shown in parentheses next to the pins in Figure.
In minimum mode, for example, pin 29 will function as WR. which will go low any
time the 8086 writes to a port or to a memory location. The RD, WR, and M/lO signals form
the heart of the control bus for a minimum-mode, 8086 system. If the MN/MX pin is
asserted low, then the 8086 is in maximum mode. In this mode, pins 24 through 31 will have
the functions described by the mnemonics next to the pins in figure. In this mode, the control
bus signals (SO, S1 and S2) are sent out in encoded form on pins 26, 27 and 28.
An external bus controller device decodes these signals to produce the control bus
signals required for a system which has two or more microprocessors sharing the same buses.
Another important pin on the 8086 is pin 21, the RESET input. If this input is asserted and
then released, the 8086 will, no matter what it was doing, fetch its next instruction from
physical address FFFFOH. At this address then, you put the first instruction you want the
microcomputer to execute after a reset or when the power is first turned on.
Finally, notice that the 8086 has two interrupt inputs. the nonmaskable interrupt
(NMI) input on pin 17 and the Interrupt (INTR) input on pin 18. A signal can be applied to
one of these inputs to cause the 8086 to stop executing its current program and go execute an
interrupt procedure which takes care of the condition that caused the interrupt. A return
instruction at the end of the interrupt-service procedure sends execution back to the
interrupted program.
8086 based microcomputer
Block diagram of a simple 8086 based microcomputer is shown in the below figure.
This diagram is a closer look at the generalized microcomputer. First, find the 8086 CPU, the
ROM and the RAM. Next, look for the ports, represented by the block labeled MCS-80
peripheral. There is a wide variety of port devices available. Some examples are parallel port
devices such as the 8255A, serial port devices, special port devices which interface with
CRTs, port devices which interface with keyboards and port devices which Interface with
floppy disks. Next, find the control bus, address bus, and data bus in the Figure. The basic
control bus consists of the signals labeled M/lO, RD, and WR at the top of the figure. If the
8086 is doing a read from memory or from a port, RD signal will be asserted. If the 8086 is
doing a write to memory or to a port, WR signal will be asserted.
During a read from memory or a write to memory, the M/lO signal will be high, and
during port operations the M/lO signal will be low. RD, WR and M/1O signals are used to
enable addressed devices. The address bus and the data bus are shown separately on the right
side of Figure. But where they leave the 8086, the two buses are shown as a single bus
labeled ADDR/DATA. The reason for this is that, in order to save pins, the lower 16 bits of
addresses are multiplexed on the data bus. Here's an overview of how this works. As a first
step in any operation where it accesses memory or a port, the 8086 sends out the lower 16
bits of the address on the data bus. External latches such as the 74LS373 octal devices shown
in Figure are used to 'grab’ this address and hold it during the rest of the operation. To strobe
these latches at the proper time, the 8086 outputs a signal called Address Latch Enable or
ALE. Once the address is stored on the outputs of the latches, the 8086 removes the address
from the address/data bus and uses the bus for reading or writing data.
Block diagram of a simple 8086 based microcomputer
Another section of Figure to look at briefly is the block labeled 8286 Transceiver.
This block represents bidirectional three-state buffers. For a very small system these buffers
are not needed, but as more devices are added to a system, they become necessary. Here's
why. Most of the devices – such as ROMs, RAMs and ports connected on microprocessor
buses have MOS inputs. So on a dc basis they don't require much current.
However, each input or output added to the System data bus acts like a capacitor of a
few picofarads connected to ground. In order to change the logic state on these signal lines
from low to high, all this added capacitance must be charged. To change the logic state to a
low, the capacitance must be discharged. If we connect more than a few devices on the data
bus lines. the 8086 outputs cannot supply enough current drive to charge and discharge , the
circuit capacitance fast enough. Therefore, we add external high-current drive buffers.
Buffers used on the data bus must be bidirectional because the 8086 sends data out on
the data bus and also reads data in on the data bus. The Data Transmit / Receive signal. DT/R
from the 8086 sets the direction in which data will pass through the buffers. When DT / R is
asserted high, the buffers will be set up to transmit data from the 8086 to ROM. RAM, or
ports. When DT/R is asserted low, the buffers will be set up to allow data to come into the
8086 from ROM, RAM or ports. The buffers used on the data bus must have three state
outputs so the outputs can be floated when the bus is being used for other operations.
The final section of Figure to look at is the 8284A clock generator in the upper left
corner. This device uses a crystal to produce the stable-frequency clock signal which steps
the 8086 through execution of its instructions in an orderly manner, The 8284A also
synchronizes the RESET signal and the READY signal with the clock so that these signals
are applied to the 8086 at the proper times. When the RESET input is asserted, the 8086 goes
to address FFFFOH to get its next instruction. The first Instruction of the system start-up
program is usually located at this address. So asserting this signal is a way to boot, or start,
the system.
8086 Bus Activities During a Read Machine Cycle
Below figure shows the signal activities on the 8086 microcomputer buses during simple read
and write operations.

Basic 8086 signal timings


 The first line to look at is the clock waveform CLK, at the top. This represents the
crystal controlled clock signal sent to the 8086 from an external clock generator
device such as the 8284 shown in the top left corner of Figure. One cycle of this clock
is called a state. For reference purposes, a state is measured from the (falling edge of
one clock pulse to the falling edge of the next clock pulse. The time interval labeled
T1 in the figure is an example of a state. Different versions of the 8086 have
maximum clock frequencies of between 5 MHz and 10 MHz, so the minimum time
for one State will be between 100 and 200ns depending on the part used and the
crystal used.
 A basic microprocessor operation such as reading a byte from memory or writing a
byte to a port is called a machine cycle. The times labeled TCY in the figure are
examples of machine cycles. A machine cycle consists of several states. The time a
microprocessor requires to fetch and execute an entire instruction is referred to as an
Instruction cycle. An instruction cycle consists of one or more machine cycles. To
summarize this, an instruction cycle is made un of machine cycles, and a machine
cycle is made up of states. The time (or a State Is determined by the frequency of the
clock signal. In this section we discuss the activities that occur on the 8086
microcomputer buses during a read machine cycle. The best way to analyze a timing
diagram such as the one in Figure is to think of time as a vertical line moving from
left to right across the diagram. With this technique you can easily see the sequence of
activities on the signal lines as you move your Imaginary time line across the
waveforms.
 During T1 of a read machine cycle, the 8086 first asserts the M/lO signal. It will assert
this signal high if it is going to do a read from memory during this cycle and it will
assert M/lO low if it is going to do a read from a port during this cycle. The timing
diagram in Figure shows two crossed waveforms for the M/IO signal because the
signal may be going low or going high for a read cycle. The point where the two
waveforms cross indicates the time at which the signal becomes valid for this machine
cycle. Likewise, in the rest of the timing diagram crossed lines are used to represent
the time when Information on a line or group of lines is changed.
 After asserting M/lO, the 8086 sends out a high on the Address Latch Enable signal
(ALE). This signal is connected to the enable input (STBI of the 74S373 octal latches,
as shown in Figure. So these latches will be enabled when ALE is high. The data
Inputs of these latches are connected to the 8086 AD0 – ADI5. AI6 – AI9. and Bus High
Enable (BHE) lines.
 After the 8086 asserts ALE high. it sends Out on these lines the address of the
memory location that it wants to read. Since the latches are enabled by ALE being
high, this address information passes through the latches to their outputs. The 8086
then makes the ALE output low, which disables the latches. The address held on the
latch Outputs travels along the address bus to memory and port devices. Note in the
timing diagram in Figure, how the activity on the ADDR / DATA lines is represented.
The first point at which the two waveforms cross represents the time at which the
8086 has put a valid address on these lines. These two waveforms do not indicate that
all 16 lines are going high or going low at this point.
 After ALE goes low, the address information is held on the latches, so the 8086 no
longer needs to send out the addresses, Therefore, as shown by a dashed line on the
ADDR / DATA line in Figure. the 8086 floats the AD0 – ADI5 lines so that they can
be used to input data from memory or from a port. At about the same time, the 8086
also removes the BHE and AI6 – AI9 information from the upper lines and sends out
some status information on those lines. The 8086 is now ready to read data from the
addressed memory location or port.
 Near the end of state T2 the 8086 asserts its RD signal low. If you trace the connection
of the RD signal in Figure, you should see that this signal is used to enable the
addressed memory device or port device. When enabled, the addressed device will put
a byte or word of data on the data bus. In other words, asserting RD signal low causes
the addressed device to put data on the data bus. This cause-and-effect relationship is
shown on the timing diagram in figure by an arrow going from the falling edge of RD
to the "bus reserved for data in" section of the ADDR/DATA waveforms. The bubble
on the tail of the arrow is always put on the signal transition or- level that causes some
action, and the point of the arrow always indicates the action caused. Arrows of this
sort are only used to show the effect a signal from one device will have on another
device. They are not usually used to indicate signal cause and effect within a device.
Now, referring to Figure again, find the section of the AD0 – ADI5 waveform marked
off as memory access time near the bottom of the diagram. This time represents the
time it takes by the memory to output valid data after it receives an address and an RD
signal.
 If the access time for a memory device is too long, the memory will not have valid
data on its outputs soon enough in the machine cycle for the 8086 to receive it
correctly The 8086 will then treat whatever garbage happens to be on the data bus as
valid data and go on with the next machine cycle. As long as Murphy's law is still in
force, the garbage read in will probably cause the entire program to crash.

Troubleshooting
The first point about troubleshooting a microcomputer is that a systematic approach is almost
always more effective than random poking, probing, and hoping. You don't, for example,
want to spend 2 hours troubleshooting a system and finally find that the only problem is that
the power supply is putting out only 3 V instead of 5 V. Use the following list of steps or a
list of your own each time you have to troubleshoot a microcomputer:
1. Identify the symptoms.
2. Make a careful visual and tactile inspection.
3. Check the power supply.
4. Do a "signal roll call,"
5. Systematically substitute socketed ICs and
6. Troubleshoot soldered-in ICs.
Identify the Symptoms
Make a list of the symptoms that you find or those that a customer describes to you.
Find out, for example, whether the symptom is present immediately when the power is turned
on or whether the system must operate for a while before the symptom shows up. If someone
else describes the symptoms to you, check them yourself or have that person demonstrate the
symptoms to you. This allows you to check if the problem is with the machine or with how
the person is attempting to use the machine.
Make a Careful Visual and Tactile Inspection
This step is good for preventive maintenance as well for finding a current problem.
Check for components that have been or are excessively hot. When touching components to
see if any are too hot, do it gently, because a bad IC can get hot enough to give a nasty burn if
you keep your finger on it too long. Check to see that all ICs are firmly seated in their sockets
and that the lCs have no bent pins. Vibration can cause lCs to work loose in their sockets. A
bent pin may make contact for a while, but after heating. cooling, and vibration, it may no
longer make contact, Also, inexpensive IC sockets may oxidize with age and no longer make
good contact. Check for broken wires and loose connectors.
A thin film of dust. etc.. may form on printed . circuit-board edge connectors and
prevent them from making dependable contact. The film can be removed by gently rubbing
the edge connector fingers with a cleaning pad available for this purpose. If the
microcomputer has ribbon cables, check to see if they have been moved around or stressed.
Ribbon cables have small Wires that are easily broken. II you suspect a broken conductor in a
ribbon cable, you can later make an ohmmeter check to verify your suspicions.
Check the Power Supply
From the manual for the microcomputer, determine the power supply voltages. Check
the supply voltage(s) directly on the appropriate pins of some ICs to make sure the voltage is
actually getting there. Check with a scope to make sure the power supplies do not have
excessive noise or ripple. One microcomputer that we were called on to troubleshoot had
very strange symptoms caused by 2-V peak-to-peak ripple on the 5-V supply.
Do a Signal Roll Call
The next step is to make a quick check of some key signals around the CPU of the
microcomputer. If the problem is a bad IC, this can help point you toward the one that is bad.
First, check it the clock signal is present and at the right frequency. If not, perhaps the clock
generator IC is bad. If the microcomputer has a clock but doesn't seem to be doing anything,
use an oscilloscope to check ii the CPU Is putting out control signals such as RD, WR and
ALE. Also, check the least significant data bus line to see if there is any activity on the buses.
If there is no activity on these lines, a common cause is that the CPU is stuck in a wait, hold,
halt, or reset condition by the failure of some TTL devices. To check this out, use the manual
to help you predict what logic level should be on each of the CPU input control signals for
normal operation.
The RDY input of the 8086, for example, should be high for normal operation. If an
external logic gate falls and holds RDY low, the 8086 will go on inserting WAIT states
forever, and the buses will be held constant, If the 8086 HOLD input is stuck high or the RST
input is held high. the 8086 address / data bus will be floating. Connecting a scope probe to
these lines will pull them to ground. So you will see them as constant lows, If there is activity
on the buses, use an oscilloscope to see if the CPU is putting out control signals such as RD
and WR. Also, check with your oscilloscope to see if select signals are being generated on the
outputs of the ROM, RAM and port decoders as the system attempts to run its monitor or
basic program. If no select signals are being produced, then the address decoder may be bad
or the CPU may not be sending out the correct addresses,
Assembler directives
The assembler directives described here are those for the intel 8086 macro assembler
(ASMS6), the Borland Turbo Assembler (TASM) and the IBM macro assembler (MASM). If
you are using some other assembler, consult the manual for it to find the corresponding
directives.
 ASSUME - The ASSUME directive is used to tell the assembler the name of the logical
segment It should use for a specified segment
 DB—Define Byte
The DB directive is used to declare a byte-type variable. or to Set aside one or more
storage locations of type byte in memory.
 END—End Program
The END directive is put after the last statement of a program to tell the assembler
that this is the end of the program module.
 ENDP—End Procedure
This directive is used along with the name of the procedure to indicate the end of a
procedure to the assembler.
 ENDS—End Segment
This directive is used with the name of a segment to indicate the end of that logical
segment.
 EQU—Equate
EQU is used to give a name to some value 'or symbol.
 EVEN—Align on Even Memory Address
As the assembler assembles a section of data declarations or instruction statements, it
uses a location counter to keep track of how many bytes it is from the start of a segment at
any time. The EVEN directive tells the assembler to increment the location counter to the
next even address if it is not already at an even address.
 EXTRN
The EXTRN directive is used to tell the assembler that the names or labels following
the directive are in some other assembly module.
 GLOBAL—Declare Symbols
as PUBLIC or EXTRN
The GLOBAL directive can be used in place of a PUBLIC directive or in place of an
EXTRN directive.
 GROUP—Group-Related segments
The GROUP directive is used to tell the assembler to group the logical segments
named after the directive into one logical group segment
 INCLUDE—Include Source Code from File
This directive is used to tell the assembler to insert a block of source code from the
named file into the current source module.
 LABEL
As the assembler assembles a section of data declarations or instruction statements, it
uses a location counter to keep track of how many bytes it Is from the start of a segment at
any time. The LABEL directive is used to give a name to the current value in the location
counter.
 ORG—Originate
As the assembler assembles a section of data declarations or instruction statements, it
uses a location counter to keep track of how many bytes It is from the start of a segment at
any time.
 PROC—Procedure
The PROC directive is used to identify the start of a Procedure.
 PTR—Pointer
The PTR operator is used to assign a specific type to a variable or to a label.
 SEGMENT
The SEGMENT directive is used to indicate the start of a logical segment.
 TYPE
The TYPE operator tells the assembler to determine the type of a specified variable.
 SHORT
The SHORT operator is used to tell the assembler that only a 1-byte displacement is
needed to code a Jump instruction.

You might also like