Microprocessor Systems
Microprocessor Systems
Table of Contents
1.0 COMPUTER PRINCIPLES ............................................................................................................................. - 4 -
1.1 MICROCOMPUTER ARCHITECHTURE ........................................................................................................ - 5 -
1.1.1 THE MICROPROCESSOR ...................................................................................................................... - 5 -
1.1.2 ARITHMETIC AND LOGIC UNIT ........................................................................................................... - 7 -
1.1.3 TIMING AND CONTROL ...................................................................................................................... - 8 -
1.1.4 THE BUS STRUCTURE .......................................................................................................................... - 8 -
2.0 MEMORIES ................................................................................................................................................ - 9 -
2.1 TERMINOLOGIES ................................................................................................................................. - 10 -
2.2 MAIN MEMORY ................................................................................................................................... - 12 -
2.2.1 ROM.................................................................................................................................................. - 12 -
2.2.2 Random access memories (RAM)..................................................................................................... - 16 -
2.2.3 MEMORY ORGANISATION ................................................................................................................ - 21 -
2.2.4 MEMORY MAPS ................................................................................................................................ - 22 -
2.2.6 MEMORY TIMING ............................................................................................................................. - 23 -
2.3 SECONDARY MEMORY ............................................................................................................................ - 24 -
2.3.1 BUBBLE MEMORY DEVICES (BMD) ................................................................................................... - 25 -
2.3.2 CHARGE COUPLED DEVICES (CCD) ................................................................................................... - 28 -
-1-
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
2.3.3 MAGNETIC SURFACE RECORDING .................................................................................................... - 29 -
2.3.4 CURRENT PULSE ENCODING ............................................................................................................. - 33 -
3.0 8085 MICROPROCESSOR ......................................................................................................................... - 35 -
3.1 8085 PIN DIAGRAM ............................................................................................................................. - 35 -
3.2 8085 MICROPROCESSOR FUNCTIONAL BLOCK DIAGRAM .................................................................. - 37 - 3.3
INSTRUCTION SETS AND ASSEMBLY LANGUAGE PROGRAMMING ..................................................... - 40 - 3.4
8085 INSTRUCTION SET ........................................................................................................................... - 42 -
SUMMARIZED 8080/8085 INSTRUCTION SET ............................................................................................... - 79 -
3.5 ADDRESSING MODES OR ADDRESSING METHODS ................................................................................. - 80 -
4.0 TOOLS USED IN ASSEMBLY LANGUAGE PROGRAMMING ....................................................................... - 84 -
5.0 INTERRUPTS ............................................................................................................................................. - 91 -
5.1 8085 interrupts .................................................................................................................................... - 93 -
6.0 INTERFACES ............................................................................................................................................. - 97 -
6.1 FORMATS FOR DATA TRANSFER.......................................................................................................... - 98 - 6.2
8156/8155 PIO .................................................................................................................................. - 103 - 8085-
8156 INTERFACE ......................................................................................................................... - 104 -
6.2.1 PORTS ......................................................................................................................................... - 104 -
PROGRAMMING THE PORTS ................................................................................................................... - 105 -
PROGRAMMING THE TIMER ................................................................................................................... - 109 -
7.0 I/O TECHNIQUES .................................................................................................................................... -
113 - 7.1 I/O-MAPPED I/O ................................................................................................................................ -
113 - 7.2 MEMORY-MAPPED I/O ...................................................................................................................... -
114 - 7.3 METHODS OF I/O DATA TRANSFER ................................................................................................... -
116 -
Direct Memory Access (DMA) ............................................................................................................. - 117 -
8.0 SUBROUTINES........................................................................................................................................ - 119 -
Introduction ............................................................................................................................................ - 119 -
8.1 Nested subroutines ........................................................................................................................... - 123 -
8.2 Parameter passing ............................................................................................................................. - 124 -
9.0 FAULT DIAGNOSIS ................................................................................................................................ - 126
- 9.1 TROUBLE SHOOTING TREE ................................................................................................................ - 126
- 9.2 TYPICAL FAULTS IN MICROCOMPUTER BASED SYSTEMS .................................................................. - 127
- 9.3 FAULT FIINDING TECHNIQUES ........................................................................................................... - 128
- REVISION QUESTIONS AND ANSWERS ........................................................................................................ -
134 - REVISION QUESTIONS (WITH ANSWERS)
.................................................................................................... - 153 -
-3-
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
symbols called ASCII (American Standard Code for Information Interchange). Most exchanges
between such items as keyboards, displays, printers etc are done in ASCII.
Address bus
Data bus
Control bus
Registers
ALU
Timing &
control
To external
BUS devices
The bus connects the microprocessor to its memory and to its I/O devices which are used to
communicate with the outside world.
Registers
A register is a temporary data storage location within the processor whose contents may be moved or
manipulated during each machine cycle. Because they are resident in the microprocessor, they can be
manipulated rapidly without selecting external chips. Although the details of the internal register
architecture vary from machine to machine, certain register types are very common.
1. PC (Program counter)
-4-
Once a program has been developed for a particular task, it is loaded into memory and is then executed.
To remember which program instruction is to be executed next; the processor uses a register called
the program counter (PC). The contents of the PC identify the address of the next instruction to be
fetched and executed. It is said to “point” to the next instruction. It contains the address of the next
instruction to be fetched. Its size determines the range of memory in which program instructions can
be located. For many common machines e.g. the 8080, 8085, Z80, 6502 or 6800 this is a 16-bit number
and gives a range of 65,536 possible locations.
2. Accumulator (A)
It is used extensively for data manipulations. Although exceptions occur, addition, subtractions and
similar instructions commonly use the accumulator for data to initiate the operation and as the
destination for the result.
5. Stack
In some microprocessors a special set of a registers is arranged in what is called a stack. These
registers are connected in such a way that when a word is stored in the first register, the data previously
contained in this register are transferred to the next register down the stack. The previous contents of
the second register are transferred to the third, the third to the fourth and so on. Storing data this way
is known as pushing the stack. When a read operation is performed, the word that is retrieved is the
last word pushed into the stack. This kind of stack is therefore called a last-in first out (LIFO) stack.
The read operation is called poping the stack.
-5-
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
A LIFO stack can also be implemented by using memory locations. Here a portion of RAM is reserved
for use as a stack. A CPU register is designed as a stack pointer (SP) and contains the address of the
free memory location (top of the stack). When the stack is to be pushed the data are stored in the
location pointed to by the SP and the pointer is stepped. Popping the stack involves the reverse
operation. The advantage of this type of stack is that many more storage locations become available.
The disadvantage is that stack operations may take longer because the data transfers occur external to
the CPU.
NB
The stack is a LIFO memory in the sense that items or data that goes in last will come out first. The
address of the top of the stack is contained in a register called stack pointer. Two instructions PUSH
and POP or are usually available with the stack.
PUSH operation is defined as writing to the top or bottom of the stack. Some microprocessors access
the stack from the top while others access via bottom. When the stack is accessed from the bottom the
stack pointer is incremented after a PUSH and decremented after a POP operation on the other hand
if the stack is accessed from the top the stack pointer is decremented after a push and incremented
after a pop
-6-
3. The instruction word is moved from memory to the instruction register (which is connected to
an instruction decoder).
4. Finally, the memory is told that the instruction has been received.
This shows that a number of critical timing conditions must be met if data transmission is to be properly
co-coordinated.
The timing and control block decodes instructions and directs the execute cycle. For example, the
instruction word 10001010 (8AH) is decoded by 8085 as “add register D with carry to the accumulator.
This instruction causes the timing and control block to command the ALU to add the contents of the
accumulator t the contents of register D and add to this sum a one if the carry flag is a one. The ALU
will then store the result in the accumulator erasing the old accumulator data. The various flags will
be changed based on the result of this operation. A gain the function of the timing and control is to
coordinate this activity. The timing and control block also provides a reset function to initialize the
CPU along with other components in the computer system.
• The control bus however is used to transmit of timing and control signals for co-ordinating data
transfers.
2.0 MEMORIES
• The function of the memory is to store information. It stores program, data, results or other kind
of information
• Main memory is supplemented by less costly auxiliary or backing memory for storage purposes.
• At present the following two kind of memories are commonly used in modern computers
-7-
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
(i) Semiconductor memory
- Faster
- Compact
- Lighter
- Consumes less power
- Static
- No rotating parts
-8-
2.1 TERMINOLOGIES
1. Bit
- Binary digit 0 or 1
2. Nibble
- A group of four bits
3. Byte
- A group of eight bits
4. Word
- A group of bits in a memory that contains information or data of some type. It
can be 8 bits, 16 bits, 32 bits etc
5. Cell
- Device or electrical circuit that can store a single bit
6. Register
- Is a device consisting of a number of flip-flops grouped together and capable of storing a binary
word
-9-
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
7. Capacity
- Is a way of specifying how many bits can be stored in a particular memory device e.g 4096, 20
bit word is written 4096 x 20 = 81920 bits
- Memory capacity is expressed as m x n
Where; m = No of words
n = No of bits per word (Word size)
NOTE
The no of words in a memory is always a multiple of 210 (1024) = 1K. Thus a memory that has a
storage capacity of 4K x 20 is actually; (4 x 1024) x 20 = 4096 x 20 = 81,920 bits
Example
Calculate the capacity of 2K x 8 memory chip
Solution
Words are 2K = 2 x 1024 = 2048 words
Word size = 8 bits per word
Total capacity = 8 x 2048 = 16,384 bits
8. Address
Is the number that uniquely identifies the location of a word in memory. Each word stored in a
memory must have unique address specified as binary numbers although octal, hexadecimal and
decimal are often used for convenience e.g.
Address Content
0000 Word 0
0001 Word 1
0010 Word 2
0011 Word 3
0100 Word 4
0101 Word 5
0110 Word 6
O111 Word 7
N.B
Random – means that any memory location can be accessed approximately the same time taken to access
any other location.
2.2.1 ROM
Read only memory is a type of semiconductor memory which is written into only once, at the
beginning, after which the information can only be read from it. They are used in applications requiring
that information is stored for a long time without change. They are used to store the data which are
not likely to change during the operation of the system. Each location contained in this memory can
be accessed to read out information but the contents cannot be changed. The information is initially
created and placed in the ROM in a process called “programming the ROM”. All ROMs are non-
volatile and store the information even if power fails.
Types of ROM
1. Masked ROM
2. Programmable ROM (PROM)
3. Erasable PROM (EPROM)
4. Electrically Erasable PROM ( EEPROM or E2PROM)
1) Masked ROM
- It‟s programming is performed by the manufacturer by using appropriate photographic masks.
- During the semiconductor fabrication process the desired data are programmed in the ROM
through “mask programming” method.
- The contents of the Rom can never be changed or modified thereafter e.g. monitor program.
- Figure below shows one way of building a ROM.
- 11 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
11 Word 3 001
Diode matrix ROM
Figure above shows one way of building a ROM by using a matrix of diodes. The input lines A0 and
A1 are the address inputs of the memory. Thus the ROM shown in this figure has a two-bit address
bus. Address is the number that uniquely identifies the location of a word in memory. Thus A0A1 can
be 00, 01, 10 or 11.
If A0 = 1 and A1 = 0, word 2 is selected. Then its NAND gate gives low output (because both the
inputs to this NAND gate of word 2 are high). This makes data lines D2 and D1 to pull low and D0
goes high which after inversion results in 110 at the output data bus meaning that the memory location
2 (word 2) contains decimal 6.
2) PROM
- Can be programmed by the user.
- Initially all memory cells are in the same state e.g. 0 or 1
- By following a specified procedure 0‟s can be written into the appropriate bit in the PROM by
passing a high current through some fusible links to vapourize them.
- Once the metal link has been vapourized the cell is designed to remain in the „0‟ state
indefinitely.
- PROM is used in applications requiring small programs and where speed is of an essential
requirement.
- 12 -
Bipolar ROM cells as PROM
3) Erasable PROM
Erasable programmable read only memories or
EPROMs can be programmed by the
user and can be erased and then reprogrammed
as and when desired. For programming
EPROM, a voltage of 10 to
25V is applied to the chip inputs for nearly 40
to 50 milliseconds for each address location. Each EPROM can be programmed typically within 20 to
30 minutes. EPROMs use MOSFETS with floating gate. After an EPROM has been programmed, its
contents can be erased by the following two methods;
i) Ultra violet erasable programmable read only memory:
Ultra violet light erasable programmable read only memories or UVEPROMs cans be erased by
exposing them to ultra violet light, as the name suggests. This ultra violet light is made to pass through
a quartz window on the chip package. The EPROM is exposed to high intensity ultra violet light rays
of short wavelength which produces photo current from the floating gate towards the silicon substrate.
This removes the charges stored in the gate, by cutting off the transistor and restoring logic 1 state to
the cell. The complete erasing of an EPROM takes nearly 20 to 30 minutes of exposure to UV rays
which, erases all the cells of the EPROM by restoring all the cells of the EPPOM to logic 1. Once it
is erased it can be reprogrammed by applying a high voltage programming pulse which injects high
energy electrons into the floating gate. These electrons on termination of the programming pulse don‟t
find any discharge path and are thus trapped in the region, keeping the MOSFET permanently ON
even after removal of power from the device. Thus the cell stores logic 0.
- 13 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
floating gate and erases that particular cell. EEPROM‟s have an additional advantage in that they can
be erased in negligible small time of 10 milliseconds as compared to 20 to 30 minutes in the case of
UVEPROMs.
- 14 -
2.2.2 Random access memories (RAM)
Random access memory, more appropriately called read-write memories (RWM), is a memory in
which access time is independent of address location of data, which means that the memory address
location is easily accessible. In RAM, each memory location can be addressed directly at random,
without first addressing other locations occurring earlier. Basically they are of two types, either of
bipolar cells or MOS cells.
1. Bipolar RAM cells
A bipolar RAM cell is shown in figure below with a dual emitter gating and with a triple emitter gating.
The dual emitter gating is used for linear selection arrangement and the triple emitter gating is used
for coincident selection arrangement. In both these versions, one emitter of the transistor T1 is
connected to the data line say „0‟sense and one emitter of transistor T2 is connected to the complement
of the data say „1‟ sense.
In the dual emitter version, the second emitter of transistors T1 and T2 are connected together to signal
S. The sense (or data line) and select line S, provide a low resistance to ground, thus grounding the
emitter and making the cell work like a simple flip-flop. Normally Vcc is held at 3.5V, select S at
nearly ground level i.e. 0, sense „0‟ line at about 0V and sense „1‟ line at about 1.5V. The conducting
transistor of the flip flop conducts through a select line. Read operation
For the read operation, select line „S‟ is held at a potential of 3V. The conducting transistor therefore
does not conduct through the select line but it conducts through the sense line „0‟ 0r sense line „1‟
depending upon whether logic „0‟ or logic „1‟ is stored in the memory cell. Write operation
For writing operation, the select line „S‟ is held at a potential of 3V. For writing logic „0‟ in the
memory, the sense line „0‟ is kept between ground and 0.7V and sense line „1‟ is kept at 3V, hence
transistor T1 conducts. For writing a „1‟ into the memory, sense line „0‟ voltage is kept at 3V and
sense line „1‟ at between ground and 0.7V, making transistor T2 to conduct hence storing logic „1‟
into the memory.
- 15 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Note
The working of the triple emitter gating circuit is similar. For the read operation, both „X‟ select and
„Y‟ select lines must be held high (at 3V). No current will flow through „X‟ select and „Y‟ select
lines because the emitters fed by these lines are reverse biased. The currents in „0‟ sense line and „1‟
sense lines are measured. The cell will be said to be in the zero state if „0‟ sense line shows current
and „1‟ sense line shows no current.
For writing (storing) data into the cell, both „X‟ select and „Y‟ select lines are held high. One sense
line is held high and the other low. This will enable one transistor to turn ON and the other transistor
to cut OFF.
2. MOS RAM cells
The contents of various RAM address locations are read from and written into as the computer
executes the program. For the fast operation of a computer, it is necessary to have fast read and write
cycle for the memories for which MOS RAMs are used. The only major disadvantage of MOS RAMs
is that they are volatile and as such all stored data or information in them is lost if power is switched
off or is interrupted. MOS RAM cells are of two types:
(i) Static RAM
(ii) Dynamic RAM
Static RAMS (SRAM)
The static RAM cells retain data indefinitely as long as power is applied to the cell. Figure below shows
a static RAM cell, which consists of six transistors.
Vdd
T1 T2
T5 T6
T3 T4
Operation.
Row
line
Vss
COLUMN COLUMN
(bit line) (bit line)
- 16 -
Transistors T5 and T6 act as access transistors to the cell and act as switches, so that data can be read
or written into the cell. Transistors pairs T1/T3 and and T2/T4 are NMOS inverters and are arranged
in cross-coupled form as shown in figure above.
Reading
Access to the cell is achieved by a high on the row line which allows the state of the cell to be read
out from the column lines. If T3 is off and T4 ON, then column will be high and column low and the
cell is said to be in the logic „1‟ state. Writing
To write a „0‟ in the cell, the row line is held high and column is forced low and column high. Thus
T4 turns OFF and T3 turns ON. When row is held low again, the access transistors T5 and T6 turn off
but due to the cross-coupled nature of the two, the data is retained in the cell. However, if power is
removed, the data will be lost and hence these devices are called volatile.
Dynamic RAM (DRAM)
Each SRAM cell either uses four transistors and two resistors or six transistors for CMOS logic. Hence
each cell consumes a relatively large area of silicon compared to other semiconductor memory options.
The DRAM uses fewer transistors per cell than the SRAM. Hence more bits can be achieved per mm2
but at the expense of more complex peripheral circuitry to refresh data. All DRAMs use MOS
technology and data is stored as charge on a capacitor. The highest density DRAM is obtained with
the one transistor cell. It consists of a single transistor and a storage capacitor Cs as shown below.
ROW
(word line)
T1
CS (Storage capacitor)
COLUMN
(bit line)
Reading
To read the cell, row is held high and hence T1 is turned ON. The voltage stored on Cs transferred to
the column line and sensed by a sense amplifier.
Writing
- 17 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
To write to the cell, row is held high again turning on T1. If a logic „1‟ is to be stored, then the column
line is held high and Cs charges µP to a logic „1‟. When row is held low, T1 is then turned off thus
holding the charge on Cs.
NOTE
The charge held on Cs can however leak away through T1 due to its small leakage current when the
transistor is OFF. Consequently the data must be periodically refreshed which thus requires extra
circuitry on the chip. In fact, the operation of reading the cell also results in data being lost. This is
because the storage capacitor is designed to be deliberately small for compactness. Consequently each
time the cell is read, it must be refreshed.
Note:
Because of their high capacity and low power consumption, dynamic RAMs are used in the main internal
memory of most personal computers.
Note:
Where only small amount of memory (typically less than 64K), is needed or where high speed is
required, dynamic RAMs can be used.
- 18 -
Bipolar RAMs MOS RAMs
1. Bipolar RAMs have a small access time, 1. MOS RAMs have a larger access time,
thus giving a higher operating speed i.e. Thus they are comparatively slow.
3. They have low power dissipation. 3. They have high power dissipation.
6. They have a smaller capacity and high 6. They have greater capacity and low power
power consumption. consumption.
1. BIT ORGANIZED
- Uses memory chips that are a „bit‟ organized i.e. can store only one bit in every memory location
e.g 256 x 1
A0
256 x 1 D0
A7
- To store 8- bit words we shall require 8 such chips connected as shown below.
- 19 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
A0 – A7
D0 – D7
256 x 8 memory
- Each chip would require 8 address lines and stores only one bit per location.
2) WORD ORGANIZED
- Uses memory chips that store a group of binary bits (word) in every memory location e.g
256 x 4
A0 D0
256 x 4 D2
D3
D4
A7
A0
D0
256 x 4 D1
D2
D3
D4
256 x 4 D5
D6
D7
A7
- 20 -
Question
A memory organization requires 1024 x 4-bit memory. Available memory chips are 256 x 4-bit.
Design the organization.
0000
ROM
CFFF
D000
RAM
E4FF
E5FF
I/O DEVICES
ECFF
CS CS
1K ROM 1K RAM
D0-D7
The LS 10 address bits A0 - A9 are used for addressing the 1024 memory location in either ROM or
RAM depending on CS. Three most significant address lines A12 - A15 are unconnected while A10 -
A11 are used for generating chip select signals. Two output lines are unused but they could be if we
had more chips.
- 21 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
ACCESS TIME
- 22 -
(a) Magnetic Disc
- Store information on one or more circular platters or disks which are continually spinning. -
These rotating disks are coated with a magnetic material and stacked with space between
them - Information is recorded on the surface of the rotating disks by magnetic head.
- Data is stored on the disc as a series of magnetic states.
- Data is resident on the disc in circular tracks usually 35-80 tracks on a disc.
- Each track is made µP of sectors 8-20 sectors ( sectors is a space of about 128 or 256 bytes )
(b) Magnetic bubble
- Consumes less power and are smaller compared to discs.
- Bubble device operates as a set of shift registers.
- Storage mechanism consists of cylindrically shaped magnetic domains (bubbles).
- Bubbles are formed on a thin magnetic film layer of a single crystal synthetic ferrite when a
magnetic field is applied to the films surface.
- A separate rotating field moves the bubble through the film in shift register fashion.
- Presence of a bubble is „1‟, no bubble is „0‟.
- 23 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
garnet substrate, such as gadolinium-gallium, or an amorphous metallic magnetic layer sputtered on
to a substrate such as glass.
The magnetic material exhibits uniaxial anisotropy with the easy axis perpendicular to the surface.
With no external magnetic field, the magnetic domains are arranged such that the sample is
magnetically neutral, half „pointing µP‟ and half „pointing down‟. As a small external magnetic field
is applied, the domains whose polarity is opposite to the field shrink. If the external field is increased
further, the domains shrink into bubbles. Any further increase in applied field will cause the bubbles
to reverse polarity and collapse. In practice the external field is maintained by a permanent magnet.
Typical bubble size is 6 µm, and a 16 Kbit bubble memory can be constructed on a film area of 25
square millimetres.
The bubbles are free to move throughout the film and can be viewed as tiny magnets afloat in a
magnetic field „sea‟ of opposite polarity, as shown in figure 7.13. They move through the film in
much the same way as holes move through a semiconductor. The bubbles must be constrained to move
in an orderly way and the most common method is to propagate the bubbles along permalloy [Link] or
chevron patterns (figure 7.14). The patterns are evaporated on to the surface of the film, usually
separated by an insulating film of silicon dioxide. To move the bubble a rotating magnetic field is
applied to the structure and the bubbles are forced to move along in response to magnetic poles
produced in the Permalloy. The substrate chip is placed at the centre of orthogonal coils which, when
supplied with a two-phase clock signal, serve to produce the rotating magnetic field.
Detection of the bubbles is achieved by utilizing the magneto-resistive effect which is present in the
Permalloy material. The bubble is first elongated into a strip by means of a chevron pattern. Passage
of the strip-bubble over an interconnected chevron is possible provided the interconnections do not
form a continuous strip. A current is passed through such a chevron and any change in resistance is
sensed as a small voltage change when the bubble passes over (figure7.15).
- 24 -
Bubbles are generated by passing a large amplitude current pulse through a conductor (figure 7.16) to
produce a localized magnetic field intense enough to reverse the garnet‟s magnetization and thus
directly create a bubble. The bubble, after generation, is propagated down the chevron track and on to
the propagating patterns. Typically 150 mA is required to generate a bubble.
The bubble memory is basically a shift register and the presence of a bubble at a sensing point signifies
a logical one. Trains of bubbles propagate serially along the Permalloy patterns in response to the
rotating field. In the absence of this applied field the bubbles remain stationary, held by the bias field
supplied by the permanent magnet. Start/stop operation is a very advantageous feature.
- 25 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Stopping the shifting process completely, or restarting it from a standstill, takes only 10-20 µs; thus
after each memory access the bubble chip can be stopped to conserve power. Similarly, during data
transfer, start/stop operation can give variable transfer rates and so simplify data buffering
requirements.
In order to reduce the access time of the serial bubble memory the memory chip is organized as a
series of minor loops, each with a transfer gate into a major line for reading and writing (figure
7.17). Bubbles circulate around the lines and when selected are transferred to and from the major
line. Typically for a 64 Kbit memory chip there might be 128 such minor loops, each containing a
maximum of 512 bubbles.
Bubble memories are slower than semiconductor memories but their non- volatility, low power
consumption and extremely small size make them competitive with rotating magnetic memories.
- 26 -
2.3.2 CHARGE COUPLED DEVICES (CCD)
Charge coupled devices though volatile, are to a certain extent competitive with bubble memories in
mass storage systems. Since their invention in 1970 they have evolved rapidly and commercial devices
with capacities in excess of 64 Kbits are readily available.
The basic element is a shift register structure, shown in figure 7.18, in which an input voltage V, to
the first electrode controls the injection of a charge of minority carriers into the p-type silicon near the
diffusion. This packet of charge in the vicinity of the first electrode, and subsequent packets, can be
moved from electrode to electrode along the structure by means of a three- phase clock Øl, Ø2, Ø3.
At the end of the shift register a floating drain receives the packets of charge which are then discharged
through a channel created by the pulse V. Before this happens the charge on the floating drain either
controls the gate of another device to provide an external signal or is used to inject charge to a
subsequent channel.
The CCD shift register has an extremely simple structure and owing to the low circuit component
requirement, can potentially achieve higher bit densities than semiconductor RAM. The two main
- 27 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
effects which limit the size of the device are transfer efficiency and storage time. Each time a packet
of charge is moved, a fraction of it is lost as a result of charge trapping in the silicon. However, losses
are only in the order of one part in 104, and registers with lengths of thousands of bits can be
constructed before refresh amplifiers are needed to restore the charge level. Storage time refers to the
maximum time for which the charge packet can remain in the structure before leakage currents reduce
it to too low a level. This time is temperature dependent, but within normal operating ranges, storage
times of 2-10 ms can be obtained. This determines the minimum clocking rate, the upper rate being
dependent on charge mobility.
As with bubble memories, the internal organization of a typical CCD memory is a parallel arrangement
of smaller registers giving a wider data path with a corresponding reduction in access time.
Probably the earliest commercial mass storage system using surface recording was the magnetic drum.
Drums are still produced but applications are limited to areas where reliability and ruggedness outweigh
poor utilization of space. Their place has been taken by the disc store. Discs can be classified as rigid or
flexible (the floppy disc). The rigid disc, with either a plated nickel-cobalt or magnetic iron oxide
surface, is capable of storing hundreds of megabytes on a 250 mm (10 inch) diameter surface. To record
at very high bit densities, and to obtain good signal strength from the sense heads when reading, it is
- 28 -
essential that the heads are positioned as close to the magnetic surfaces as possible but do not plough
into the surfaces. Early systems used rigidly mounted heads at a distance from the surface defined by
the mechanical tolerances. To accommodate unavoidable variations in surface thickness, typical
separation was 0.25 mm. Modern systems use the „flying head‟ principle in which the head is held a
constant distance from the surface by an air cushion, selfgenerated aerodynamically or supplied from
air jets built into the head structure. This method reduces head-to-surface separation by a factor of ten
compared with the rigid mounting. The separation loss is directly related to the distance separating the
head and surface and is a function of the wavelength of the recorded signal.
Disc storage systems are available in a wide range of sizes from single-disc memories to the multiple
stacks used in large computer systems, capable of holding in excess of a billion words. At the other
end of the scale floppy discs, or diskettes, are available for the smaller system and are used extensively
in low- cost microprocessor-based systems where the higher price of the more sophisticated, and more
reliable, rigid disc system would not be appropriate.
Basically, the floppy disc consists of a flexible magnetic disc, usually Mylar- based, coated with a
magnetic oxide. The disc is 200 mm (8 inches) in diameter, or 130 mm (5 ¼ inches) for the minifloppy,
and is permanently held in a plastic envelope for protection. This envelope has slot in it, allowing the
read/write heads to come into contact with the oxide layer when inserted into the drive unit (figure
7.20). By running in contact with the surface, bit density is increased but the head-tosurface wear is
correspondingly increased as well. The wear is minimized by maintaining contact only during data
transfers.
Microfloppy systems use a disc of 90 mm (3.5 inches) diameter, housed in a rigid plastic case which
incorporates a dust shutter. Three inch (75 mm) discs are also common.
With both the rigid and floppy discs, data is recorded on to and read from concentric tracks, each of
which is allocated a track address. The heads are permanently positioned over the correct track or are
moved there under servo control. Each track is divided into sectors and positional information is
provided from either pre-programmable control tracks, soft sectoring, or, in the case of some floppy
discs, from photo electrically sensed holes punched into the disc at appropriate intervals, hard
sectoring. Typically a floppy disc is spun at 360 revolutions per minute and 77 concentric recording
tracks are available for use, though double-density discs with 154 tracks per side and a capacity of 2.3
Mbytes are available.
- 29 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
At present, microfloppy discs offer a storage capacity of 0.5 to 1 Mbytes, though this is likely to increase
rapidly.
A particular design of rigid disc memory with enhanced reliability, developed initially by IBM and
known as the Winchester technology, has come into prominence. The main technological advance was
in the head design which has a very low mass and is lightly loaded. The head starts and stops in contact
with the specially lubricated magnetic surface. The entire mechanism, including the disc, is maintained
in a sealed, contamination-free environment. Early Winchester systems, still the most popular, used
130mm (5 ¼ inch) diameter discs with a head-to-surface separation of less than 0.5 µm (20 x l0-6
inch). More recently, 200mm (8 inch) and 350 mm (14 inch) discs have been introduced with bit
densities of 8.5 Kbits per track inch (330 bits per millimetre) and storage capacities from 5 to 16 Mbits.
Allowing the head to rest in contact with the surface obviates the need for a complex head loading
mechanism, reducing weight and enabling the head to fly closer to the surface. This in turn gives a
greater signal output, adding to the enhanced reliability of the system. Using thin film technology,
recent advances in head design have given bit packing densities of 10 Kbits per inch (400 bits per
millimetre).
In magnetic tape recording the magnetic oxide is deposited about 10µm thick on a polyester base, and
is allowed to ride directly in contact with the heads which are stacked together within the width of the
tape, normally 12mm (0.5 inch). The tape moves only when information is to be transferred, unlike
- 30 -
discs which often run at constant speed throughout, and tape wear is very small. This method of
operation poses considerable mechanical problems, however, since the operating speed is 3.8 metres
per second (150 inches per second) and in order to minimize tape wastage and time delays, the tape is
necessarily subjected to high accelerating and decelerating forces. The tape is driven by pinch wheels
and, as the mechanical parts have a high inertia, a reservoir of tape is maintained „to give the spools
sufficient time to get up speed without restricting the tape motion. The bidirectional spool motors are
controlled by servo systems acting on signals from upper and lower limit photocells to maintain the
reservoir levels (figure 7.21). An alternative approach is to use mechanical tensioning with the
reservoir of tape provided by a system of lightly sprung pulley wheels. Small personal computer
systems often adopt special coding arrangements which allow the use of commercial audio cassette
recorders operating at 48 millimetres per second (1.875 inches per second).
Because of the inertia limitations and the inherent disadvantage of single dimension addressing it is
usual to arrange that information is transferred in blocks to and from a random access memory as it is
required.
- 31 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
stored. Frequency modulation, as the name implies, uses two frequencies to indicate the two logic
levels zero and one. It is usual to have the upper frequency twice the lower.
A more recent scheme is that of delay modulation or modified frequency modulation (MFM). This
uses an adaptive code in which the current level is changed in the middle of a bit period when a one
is to be stored. For a zero to be stored the current is not changed unless followed by another zero, in
which case the current is changed at the end of the bit period.
The main problems associated with magnetic surface recording are those of pulse crowding and skew.
Pulse crowding occurs when the spatial separation between successive flux changes is insufficient and
interference occurs, imposing an upper limit to bit density. This is particularly apparent towards the
centre of a magnetic storage disc as the linear velocity decreases, but with aerodynamically supported
„flying‟ heads this effect is partially offset automatically by the head riding nearer the surface.
Skew is caused mainly by head-gap misalignment, though m magnetic tape systems additional skew
problems are introduced by the flexible nature of the medium, causing jitter at high speed. The time
synchronization between signals from tracks operating simultaneously creates difficulties which may
be overcome by making all tracks self-timing.
Phase, frequency, and delay modulation give rise to regular flux changes, and from these it is possible
to extract a timing signal, though the necessity for two flux reversals per bit period in phase and
frequency modulation is a limitation not present in delay modulation. Circuits for the generation of
these codes are illustrated in figure 7.22.
RZ encoding is seldom used because of the need to pre-erase the surface and because the frequency
of flux reversals is high (as can be seen in figure 7.23), leading to pulse crowding at relatively low bit
densities. NRZ encoding has a superior performance as far as pulse crowding is concerned but suffers
from two other disadvantages: self-timing is not possible, and the misreading of a single bit will cause
continued misreading until the bit value changes.
NRZ1 encoding overcomes the misreading difficulty, though pulse crowding occurs earlier. It should
be noted that, while a single track cannot be self-timing, an output is obtained for every „1‟ read and,
by including a character odd-parity track, every character encountered must contain at least a single
„1‟, which can then be used for timing. This is only possible, of course, if skew is negligible. With the
improvements that have taken place in flying head design skew can be virtually eliminated by the
much closer proximity of the head to the surface, and NRZ1 encoding, with its superior bandwidth
performance, retains its popularity.
- 32 -
3.0 8085 MICROPROCESSOR
INTRODUCTION
The very first microprocessor was introduced by Intel Corporation in 1971. Intel introduced the 4-bit
4004 and the 8-bit 8008 in that year. In 1974, Intel introduced the 8080 microprocessor, which handles
8-bit data words and has a 16-bit address line and a 16-bit stack pointer. The 8080 became one of the
most widely used general-purpose microprocessors in the industry. The Intel 8085 microprocessor is
an enhancement of the 8080 unit. It integrates the clock, system control, and interrupt prioritization
within the microprocessor IC, thereby reducing the number of ICs used in most systems. The 8085
also operates on single +5V power supply. The 8085 MPU uses all the same instructions as the 8080,
thereby making them program compatible.
- 33 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
- 34 -
The 8085 microprocessor is capable of transmitting 16-bit addresses, which means that 216 = 65,536
memory locations can be addressed directly. The data bus is of 8- bits which means that eight bits of
data can be transferred to and from the microprocessor.
The CPU sets the state of both the address and the control buses for the read or write operations.
However the state of the data bus may be established either by a memory location or by the CPU.
Thus both the CPU and the memory must be able to:
1. Drive a data bus line to a 1
2. Drive a data bus line to a 0
3. Allow a data bus line to be driven by other devices.
A device that can achieve these three states is said to be a three state device/driver called a buffer. The
control bus defines whether the device is to produce data (the first two states) or be passive (the high
impedance state) by some form of read/write select as shown in figure below.
select
- 35 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
The 8-bit internal data bus, which is bi-directional, carries the instructions and data between the different
registers. At the bottom right are the external address and data bus.
1. Program counter (PC)
• Is a 16 – bit register which holds the address of the next instruction to be executed.
• The PC goes through a step-by-step counting sequence and causes the processor to read
successive instructions previously stored in memory.
2. Instruction register (IR)
Holds the operation code (op-code) byte of the instruction currently under execution by the
processor.
3. Control and timing unit
Examines the instruction byte in the IR and implements it by sending out timing and control
signals to other parts of the processor and beyond.
4. Work registers
• Used to hold data items that are processed within instructions.
• There are seven work registers namely A (accumulator), B, C, D, E, H and L.
- 36 -
• The Accumulator is an 8-bit register used for operations such as arithmetic, logic, load, store and
I/O instructions. It is the principal work register.
• Registers B, C, D, E, H and L are also 8-bit and are called general purpose registers. They are
used as six 8-bit registers or as three 16-bit register pairs i.e. BC, DE and HL 5. ALU
• Used whenever arithmetic processing or logical operations are required.
• The results of such ALU operations are normally placed in the Accumulator.
6. Flag register or Status register.
• It contains 5 status bits (or flags) used to indicate different states of the ALU.
• The five flags found in 8085 processor are: (i) Sign flag (S)
• Is set to the condition of the most significant bit of the accumulator following the execution of
an arithmetic or logical instruction. These instruction use the MSB of data to represent the sign
of the number contained in the accumulator.
• A set sign flag (S = 1) represents a negative number whereas a reset sign flag (S = 0) means a
positive number (ii) Auxiliary carry flag (AC)
• Indicates an overflow or carry out of bit 3 of the accumulator in the same manner a carry flag
indicates an overflow from bit 7.
• AC = 1 means a carry from bit 3 occurred while AC = 0 means no carry from bit 3
• This flag is commonly used in BCD arithmetic
(iii) Parity flag (P)
• Tests for the number of 1 bits in the accumulator
• If the accumulator holds an even number of 1„s, it is said that even parity exists and the flag is
set to 1 (P = 1).
• However if the accumulator holds an odd number of 1 s ( called odd parity ) the parity flag is
reset to 0 (P = 0)
(iv) Carry flag (CY)
• Is set or reset by arithmetic operations.
• An overflow from an 8-bit addition will result in the carry flag bit being set to 1.
• In subtraction the carry flag acts as a „borrow‟ flag, indicating the minuend is less than the
subtrahend if the flag is set.
(v) Zero flag (Z)
• Used to indicate whether the results of the last operation is zero or not.
• The zero flag is set to 1 (Z=1) if the result is zero and reset (Z = 0) if the result is non-zero.
- 37 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
The flag/status register
B7 B6 B5 B4 B3 B2 B1 B0
S Z AC P CY
- 38 -
3.3 INSTRUCTION SETS AND ASSEMBLY LANGUAGE PROGRAMMING
Essentially, there are three levels of programming namely;
1. Machine language
2. Assembly (low level) language
3. High level language Machine language
• Is a list of or string of binary numbers (0’s and 1’s) which makes µP the instruction for the
process required. The microprocessor works in machine codes.
• This form of coding is tedious and error-prone for human operations. Therefore, machine code
programs are usually written in hexadecimal codes or by using symbolic notation known as
assembly language.
Assembly language
• Is a collection of mnemonics which represent the machine code instructions.
• Mnemonics are English-like commands which describe the action of each instruction in an
abbreviated form.
• These mnemonics are far more understandable to the human programmer e.g. MOV A, C means
move the data held in register C to register A.
• A computer programmer would normally write the whole of the proposed program in mnemonic
form and afterwards this would be coded into hexadecimal codes (machine codes) for use by the
computer as instructions.
• The process of converting the mnemonics into hexadecimal codes is called assembling the
program. Most microprocessors have an in built assembler.
High level language
• They are designed to be more readable by the person who is programming.
• They make use of statements as opposed to mnemonics (abbreviations). Examples are BASIC,
FORTRAN, PASCAL, COBOL etc.
• Before a high level language can be executed by the computer, it must be converted into a
suitable machine code. Two programs can be used to achieve this;
i) An interpreter ii) A
compiler Interpreter
This is a language translator that translates each high level instruction into the appropriate machine code
instruction as the program is running. It is common in BASIC.
Compiler
This translates the whole set of instructions into a machine code before the program runs.
- 39 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
INSTRUCTION SET
An instruction set is a collection of all the instructions available for a certain microprocessor.
Therefore when designing a program, the programmer is restricted to use the instructions provided for
that particular machine. Each microprocessor has its own unique set of instructions.
An instruction set provides information concerning each instruction which may be of use to the
programmer. This includes the following items;
1. Mnemonics: Abbreviations representing each instruction in the set.
2. Symbolic notation: A short hand method of representing the effect of executing an instruction.
3. Op-codes: The actual machine codes for each instruction.
4. Flags: Shows which flags are affected and how they change in response to the execution of each
instruction.
5. Number of bytes: Allows programmer to determine the length of the program.
6. T-states: Gives the number of clock cycles required to execute each instruction.
Instruction format
Each instruction consists of two parts, an operation code (op-code)/mnemonic and an operand and
adopts the following general format;
Mnemonic operand1, operand2
Mnemonic/op-code consists of 2-6 characters which describe the action of each instruction in
abbreviated form.
An operand identifies data or the location of data that will be processed by the instruction and is
separated from the mnemonic by one or more spaces.
In principle, all instructions require two operands; one to define the source of data prior to processing
and the second to define the destination of the processed data.
e.g. MOV A, B
- 40 -
Instruction fields
Name/label Op-code (mnemonic) Operand Comment field
field field field
e.g. e.g.
START: MOV A, B ; Move the contents of register B to
register A
1-6 2-6
characters Characters As required
NB
The semicolon before the comment helps to recognize that what comes next is a comment. If the
semicolon (;) appears in the label field, the whole line is treated as a comment.
• The stack, I/O, and machine control group includes instructions for maintaining the stack,
reading from input ports, writing to output ports, setting and reading interrupt masks, and setting
and clearing flags.
- 41 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
1 3.4.1 8085 DATA TRANSFER ___________________________________
INSTRUCTIONS ___________________________________
- 42 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
2
___________________________________
___________________________________
- 43 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
3
___________________________________
___________________________________
- 44 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 45 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
5
___________________________________
___________________________________
6 __________________________________
___________________________________
- 46 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
7 __________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 47 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 48 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
8 8 ___________________________________
10 ___________________________________
11 ___________________________________
12 ___________________________________
13 ___________________________________
14 ___________________________________
15 ___________________________________
16 ___________________________________
17
18 ___________________________________
- 49 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
19 ___________________________________
20 ___________________________________
21 ___________________________________
22 ___________________________________
23 ___________________________________
24 ___________________________________
25 ___________________________________
13
26
- 50 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
11 ___________________________________
15
12 ___________________________________
1
7
- 51 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 52 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
14 ___________________________________
___________________________________
___________________________________
15
___________________________________
21 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
23
- 53 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
1
3.4.2 8085 ARITHMETIC
INSTRUCTIONS
- 54 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
2
• This group of instructions ___________________________________
___________________________________
performs arithmetic operations ___________________________________
on data in registers and ___________________________________
memory. ___________________________________
3___________________________________
___________________________________
___________________________________
___________________________________ 3
___________________________________
- 55 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
4 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 56 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
5
e.g. ADD B
6 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 57 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
7 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
ADI F5H
8 (A ) + DATA
(A) + F5 = (A)
IF A = 23H = 0010 0011
THEN ADI F5H
= 23H + F5H
= 1 18H
A = 18H = 0001 1000
CY = 1
10
- 58 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
9 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
ADC B
e.g. (A) + (B) + (CY)
If
A = 25H, B = 3DH, CY = 1
= 25+3D+1
= 64H
10 ___________________________________
- 59 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 60 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
11 ___________________________________
___________________________________
12
___________________________________
11
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
12
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
13
- 61 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
15
14 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 62 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
16
15 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
SUI 57H
___________________________________
• (A) – DATA
___________________________________
• (A) – 57H = (A)
___________________________________
___________________________________
___________________________________
___________________________________
17
- 63 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
17 ___________________________________
___________________________________
18
21
18 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
19 ___________________________________
- 64 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
22
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 65 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
20
INR C
IF C = 65H
THEN
INR C
C = 66H
23
21
25
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 66 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
24 ___________________________________
e.g. INX B ___________________________________
Means: ___________________________________
(BC) + 1 LET ___________________________________
BC = FF05H i.e.
___________________________________
B =FF, C= 05
AFTER INX B ___________________________________
THEN BC = FF06H ___________________________________
i.e. B = FF, C = 06
28
26 ___________________________________
___________________________________
29
- 67 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
30
27 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 68 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
e.g.
1. DAD B
This means;
(HL) + (BC)
2. DAD D
Means;
(HL) + (DE)
31
28 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 69 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
3
2
___________________________________
___________________________________
- 70 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 71 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
1 3.4.3 8085 BRANCH INSTRUCTIONS
• A summary of the 8080/8085 microprocessor’s branch
instructions is shown in Fig. 8-32.
• These include jump, call, return, and restart instructions. Only
Intel’s mnemonics and op-codes are listed for each instruction
in Fig. 8-32.
• This group of instructions alters the normal sequential program
flow.
• The two types of branch instructions are unconditional and
conditional.
• Unconditional transfers simply perform the specified operation
on the program counter.
• Conditional transfers examine the status of one of the four MPU
flags to determine whether the specified branch is to be
executed.
• The conditions that may be specified are listed in the Intel
User’s Manual as follows:
___________________________________ ___________________________________
- 72 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
2 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 73 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
3 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
4 ___________________________________
___________________________________
___________________________________
___________________________________
- 74 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
5 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 75 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
6 ___________________________________
7 ___________________________________
- 76 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 77 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
8 ___________________________________
___________________________________
9 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 78 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
10 ___________________________________
___________________________________
11
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 79 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 80 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
1 3.4.4 8085 LOGICAL INSTRUCTIONS
• A summary of the 8080/8085 microprocessor’s logical
instructions is shown in Fig. 8-28. These includes AND, OR,
XOR, compare, rotate, and complement instructions.
• Only Intel’s mnemonics and op-codes are listed for each
instruction in Fig. 8-28. As in the previous section, the Logical
group of instructions will be detailed using Intel’s ___________________________________
corporationown format. ___________________________________
• This group of instructions performs logical (Boolean)
operations on data in registers and memory and on flags.
Refer to Fig. 8-18 for meanings of abbreviations used in the
following descriptions from the Intel User’s Manual.
- 81 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
2 ___________________________________
3 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 82 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
4 …………………………………………………
___________________________________
___________________________________
…………………………………………………
…………………………………………………
…………………………………………………
…………………………………………………
…………………………………………………
…………………………………………………
…………………………………………………
………………………………………………….
- 83 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
5 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 84 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
6 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
7 ___________________________________
___________________________________
___________________________________
___________________________________
- 85 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
8
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 86 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
10 ___________________________________
___________________________________
11
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 87 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 88 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
12
13 ___________________________________
___________________________________
___________________________________
- 89 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
14 ___________________________________
___________________________________
___________________________________
- 90 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
15 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 91 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
16 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 92 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
17 ___________________________________
___________________________________
18 __________________________________
_
___________________________________
___________________________________
___________________________________
- 93 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
19 __________________________________
_
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________ ___________________________________
- 94 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 95 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
1___________________________________
descriptions from the Intel User’s ___________________________________
Manual. ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 96 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 97 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
2 ___________________________________
3 ___________________________________
- 98 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 99 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
4 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 100 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
5
- 101 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
6 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
7 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 102 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 103 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
9 ___________________________________
10 ___________________________________
- 104 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 105 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
11 ___________________________________
___________________________________
12
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
13 ___________________________________
___________________________________
___________________________________
___________________________________
- 106 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
14 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
15 ___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 107 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
- 108 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
- 109 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
___________________________________
___________________________________
___________________________________
___________________________________
___________________________________
DAA MOV L, CNC
-- A Adr
DAD H MOV M, PUSH D
B SUI D8
LHLD Adr
MOV M,
C
MOV M,
D
MOV M,
E
MOV M,
H
MOV M,
L
HLT
MOV M,
A
MOV A,
B
MOV A,
C
MOV A,
D
MOV A,
E
MOV A,
H
MOV A,
L
MOV A,
M
MOV A,
A
ADD B
- 110 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
- 111 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Content Address
2000H 3E
2001H
data
2. LXI H, data
Memory
Content Address
21
2000H
Lower order
data byte
2001H
Higher order
data byte
2002H
Length: Instructions employing immediate addressing are either 2-bytes long (e.g. MVI A, data) or 3-
bytes long (e.g. LX H, data) i.e.
MVI A, data OR LXI H, data
- 112 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Note
In cases where an „X‟ appears in the middle of an instruction (mnemonic), it should be interpreted as
meaning „register pair‟.
Direct/Extended/Absolute addressing
Description: Instructions using this mode specify the address of an operand in the instruction itself i.e.
the address is part of the instruction.
Example:
1. LDA, 20BCH - Load the accumulator with the contents of memory location 20BCH.
(A) (20BC)
2. STA 20BDH - Store the contents of the accumulator in the memory location 20BDH
(20BD) (A)
3. LHLD 20ABH - Load H and L registers from the two consecutive memory locations
(L) (20AB) beginning at 20ABH.
(H) (20AC)
Length: Instructions using this mode are 3-bytes long, with the first byte as the op-code and the second
and third bytes giving the address (the low-order byte of the address is byte 2 and the highorder address
byte is byte 3) e.g. LDA, 2035H.
Memory
Content Address
BYTE3A
1 2000
BYTE35
2 2001
BYTE20
3 2002
- 113 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Description: Page zero is the first page of the memory of a computer. Thus page zero starts at 0000H
and ends at 00FFH. Hence the most significant byte of an address in page zero is 00H. To address any
location on page zero (using page zero addressing), it is only necessary to specify the least significant
byte of the address. Thus an instruction using page zero addressing is only 2-bytes long (the first byte
being the op-code and the second byte being the address within page zero).
Example:
STA 2CH - Store the contents of the accumulator in the memory location 002CH.
Length: Instructions using page zero are only 2-bytes long. Since this type of instruction is one byte
shorter than equivalent direct addressing instructions, it takes µP less memory space and is faster in
execution.
Register addressing/register direct addressing
Description: This mode of addressing specifies a register or register pair that contains data. It is
generally the same as direct addressing except that the location referred to in the instruction is a register
other than a memory location.
Example:
1. MOV B, C
2. ADD D
3. SBB E
Length: Instructions using this mode are 1-byte long.
Indirect addressing
Description: In this mode of addressing, the address of the data rather than the data itself is in the
memory location specified by the instruction. There are several ways of implementing indirect
addressing and the 8085 microprocessor uses register indirect addressing.
Register indirect addressing.
In this mode of addressing, the address referred to in the instruction is either contained in a 16-bit
register or in a register pair i.e. the instruction contains a register or register pair which stores the
address of data.
Example:
1. LDAX B - Load the accumulator with the contents of the memory location specified by
the contents of the register pair B and C.
- 114 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
2. STAX D - Store the contents of the accumulator in the memory location whose address
is specified by the contents of register pair D and E. Length: Instructions using this
mode are 1-byte long
- 115 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
1] THE ASSEMBLER
An assembly language program cannot be executed by a machine directly as it is not in binary form
[machine language]. Usually we refer to such a program as a source program. A program is needed
in order to translate an assembly language [source] program into the object code executable by the
machine. The program that does all this is called an assembler.
Several types of assemblers are available the most common are;
1] One-pass assemble
2] two-pass assemble
3] Macro assemble
4] Cross-assemble
5] Resident assemble
6] Meta assemble
One-pass assembler.
In one pass assembler the source code is processed only once. As the source code is processed, any
labels encountered are given an address and stored in a table. Therefore when the label is encountered
again the assembler may look backwards to find the address of the label. If the label has not been
defined yet the assembler issues an error message.
Since only one pass is used to translate the source code a one-pass assembler is very fast.
Two-Pass Assembler
The two-pass assembler is similar in operation to the one pass with one major difference i.e the first
pass made through the source code is specifically for the purpose of assigning an address to all labels.
When the labels have been stored in a table with the appropriate addresses a second pass is made to
actually translate the source code into machine code.
Macro-Assembler
A macro assembler is a type of two pass assembler that allows the programmer to write the source
code in a macro. Conditional assembly is also included in macro assemblers.
- 116 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Cross-Assembler
A cross assembler may be of any type already mentioned. The distinguishing feature of across
assembler is that it is not written in the same language used by the processor that will execute the
machine code generated by the assembler. Cross assemblers are usually written in high level languages
e.g. FORTRAN and then the assembler may be executed on another machine e.g.
Motorola 6800.
Resident-Assembler
Is almost the complete opposite of cross-assembler. It is written to run on the same machine that will
execute the source code.
Meta-Assembler
The most powerful assembler is the Meta assembler because it will support many micro-processors.
The programmer merely specifies at the start of the source code which microprocessor. The assembler
will translate the source code to the correct machine code.
NB
The output file from most assemblers is an object file is a code that may be confirmed to execute at
any address.
2] EDITOR
This is the program used to modify and create the files contain your own program and document A
good editor is display oriented i.e. a cursor that shows or marks your place in the file the editor has
commands to change ,delete or insert lines or character The two type of editors currently;
1] Line-Oriented editor
2] Character-Oriented editor
The main difference between the two is that line editor do not display any change in the file whereas
character editors will display the change. Character oriented editor are also called screen editor or
display editor.
- 117 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
3] DEBUGGER
This is a program that removes the bugs/errors out of your program. The debugger provides an
interactive method of executing and debugging the program one or a few instructions at a time.
Debugging Techniques
Debugging a microprocessor based system may be divided into two categories:
(i) Software debugging
(ii) Hardware debugging
Both debugging processes are usually carried out separately from each other because software
debugging can be carried out on an emulator without having the final system hardware.
In a single-board microcomputer, techniques commonly used in debugging are:
i) Single-stepping technique ii)
Breakpoint technique iii) Register
examine/simulator program
a) Single step
A single-stepper facility makes use of a single-step key on a keyboard and allows the user to execute
the program being debugged one instruction at a time. Generally, a single step facility is built with a
hardwired logic circuit. As the single-step key is pushed, it is possible to observe addresses and codes
as they are executed. During debugging, it is usually helpful to examine the state of the data bus, the
address bus, the control bus and the status flags. By the single step technique, one can be able to detect
program faults such as;
i. Incorrect addresses
ii. Incorrect jumps
iii. Incorrect data iv. Erroneous op-codes etc
The single step technique is useful for short programs. b)
Breakpoint
A breakpoint facility allows the user to execute a program in sections. The breakpoint can be set in a
program by using the RST instructions. When the execute key is pushed, the program is exeuted until
the breakpoint. The registers can then be examined for expected results. If that segment of the program
is found to be satisfactory, a second breakpoint can be set at another memory address to debug the
next segment of the program. With the breakpoint facility, you can isolate the segment of the program
with errors. Then that segment of the program can be debugged with single-step facility.
- 118 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
(ii) Software
Hardware breakpoint
The hardware breakpoint uses hardware to monitor the system address bus and detect when the system
reaches the desired breakpoint location. When the breakpoint is detected, the hardware uses the
processor control lines to either halt the processor for inspection or cause the processor to execute an
interrupt to a breakpoint routine. Hardware breakpoints can be used to debug both ROM and RAM
based programs.
Software breakpoints
Software breakpoints only operate on a system with the program in RAM because the breakpoint
instruction must be inserted into the program that is to be executed.
Note
Most debuggers combine single-stepper and breakpoint facilities to provide a complete package. The
user may insert a breakpoint at a desired point and let the program execute until that point. When the
program stops at the breakpoint, the user may use a single stepper to examine it one instruction at a
time.
c) Register examine/simulator
A simulator is a program that allows the execution of a program while observing the contents of the
registers of the target processor. When appropriate keys are pressed, the contents of the registers can
be displayed. The simulator operates by taking one instruction at a time and then simulating all actions
that the target processor would perform for that instruction.
Simulators are usually very large programs which will include all the software debugging tools (single-
stepper, breakpoint etc) necessary in a complete software development program.
5] LABLES
When a programmer is writing a program containing jump instruction, he does not always know the
absolute address in memory where the instruction is stored. Therefore it is usual for a programmer to
use „symbolic address name‟ or „labels‟ to indicate the intended addresses of the destination
- 119 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
instruction and it is only during the translation process that these are converted to absolute addresses
as shown below.
Normally the symbolic names used for labels are a mix of alpha – numeric names by the programmer
e.g. REPEAT, START, RESULT, BEGIN, LOOP, SUM, NUM etc
- 120 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
For example, if it is desired to have a subroutine at a particular location in memory such as 2000H, the
ORG statement would be placed immediately before the subroutine to direct the assembler to alter the
program counter.
ORG 2000H ; set program counter to 2000H.
SUB: MVI A, 05H ; subroutine puts 05H in A.
RET ; return to caller.
Note
Most assemblers will assume a starting address of 0000H if no ORG statement is given in the source
code.
b) Equate (EQU)
The EQU instruction is used to assign the data value or address in the operand field to the label in the
label field. The EQU instruction is important because it allows the programmer to write the source
code in symbolic form and be concerned with the numeric value needed. In some cases, the
programmer develops a program without knowing the actual address or data required by the hardware.
The program may be written and debugged in symbolic form and the actual data added at a later time.
Using the EQU instruction is also helpful when a data value is used several times in a program. If for
example a counter value was loaded at ten different locations in a program, a symbolic label (such as
„COUNT‟) could be used and the label „COUNT‟ defined at the end of the program. Example.
PORT A: EQU 00 ; assign a dummy value
PORT B: EQU 00 ; another dummy value
MVI A, FFH ; data to be sent to output
OUT PORT A ; send data to port A
OUT PORT B ; and port B too
NOTE: In the above example, the programmer does not know the hardware address of output ports A
and B, but may still write the program. When the port addresses are known, they may be used to
replace 00 in the EQU instruction.
- 121 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
NOTE
The commas are necessary for the assembler to differentiate between data values. When the code is
assembled, the machine code would appear as follows;
2000…….44
2001…….34
2002…….25
2003…….D3
d) Define storage (DS)
This instruction reserves or allocates memory locations for storage of temporary data
e.g. ORG 1800H
TEMP1: DS 2
This reserves 2 bytes of memory at locations starting from 1800H
7] MACRO
A macro is a sequence of instruction that the programmer gives a name. Whenever the programmer
wishes to duplicate the sequence of instruction, the macro name is inserted in the source code. The
macro routine is not the same as a subroutine „call‟ in assembly language. An assembly language call
is a function of the microprocessor. When a macro is used it is a function of the assembler and not the
micro-processor. Every time the macro name is encountered in the source file a block of instructions
(macro) is assembled.
5.0 INTERRUPTS
An interrupt is a signal (which may either be generated by the computer hardware or produced by an
instruction) that causes the computer to temporarily suspend or interrupt the normal sequence of
operations and transfer control to an „‟ interrupt routine‟‟ (see purpose of interrupt) There two
forms of interrupt namely:
1. Non – mask able interrupts
2. Mask able interrupts
- 122 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Maskable interrupt
Is one that can be “masked out‟‟ by means of an instruction in the program. Maskable interrupts
usually handle situations that are less catastrophic than those associated with non- maskable interrupts.
The 8085 has three maskable hardware interrupt lines on the chip – RST 7.5, RST 6.5 and RST 5.5. It
has 8 other maskable interrupts (which may be either software or hardware ) – RST 0 , RST 1, RST 2,
RST 3, RST 4, RST 5, RST 6 and RST 7.
NB
A maskable interrupt is received on the processors INTR pin. The processor does not recognize a
maskable interrupt unless the interrupt flag (IF) is set or enabled. In 8085it is the EI (enable interrupt)
instruction (op-code FBH) that enables the IF. However, if either the interrupt flag has not been set or
if the interrupt flag has been disabled by means of a DI (disable interrupt) or if the interrupt has been
masked out by means of an instruction in the program the interrupt is ignored.
- 123 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Main program
Save CPU status
Join interrµPt
InterrµPt here
routine
Re-enable interrµPts
- 124 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
RST 4 E7 0020H
RST 4.5 (TRAP) Hardware 0024H
RST 5 EF 0028H
RST 5.5 Hardware 002CH
RST 6 F7 0030H
RST 6.5 Hardware 0034H
RST 7 FF 0038H
RST 7.5 Hardware 003CH
8085 has a total of four hardware interrupts and eight software interrupts. Each of the software
interrupts RST 0,1,2,3,4,5,6 and 7 can be accessed either by means of a software instruction having
the op-code listed in table above, or can be accessed when a logic „1‟ signal is applied by an
interrupting device on the INTR ( interrupt request) pin of the CPU. When the signal is received by
the CPU it sends out a logic „0‟ on the INTA (interrupt acknowledge) control bus line to acknowledge
the interrupt request. In response to the logic „0‟ on the INTA line the interrupting device places the
op-code of required RST instruction on to the data bus. For example if the interrupting device wishes
to vector the CPU to the address corresponding to the RST 6 interrupt it places the hex value F7 on to
the data bus at this time This causes the CPU to transfer control or to vector control to address 0030H.
Purpose of Interrupts
The purpose of an interrupt is to allow peripheral devices to suspend the CPU operations in an orderly
manner and force the CPU to start peripheral service routine. Usually the service routine is involved
in the exchange of data or status and control of information between the CPU and peripheral. Once
the service routine is completed, the CPU return to operations from it was interrupted
N.B.
1. Servicing means identifying what kind of signals or operations are required 2.
The ability to interrupt can be disabled
- 125 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
c) Status saving: the mp saves the program counter (PC) contents for next instruction in the main
program
d) Peripheral identification: the mp must identify the requesting interrupting device
e) Servicing the peripheral: depending on the peripheral it is serviced by going to a service routine
f) Restoration: the mp reloads back registers to their original values
g) Resumes main program
Advantage of polling
1] Require less interfacing hardware
- 126 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Disadvantage
1] It requires extensive software
2] It is time consuming i.e. waste MPU time
3] If many devices must be polled it takes a lot of time to respond to an I/O device in need of
service.
Daisy Chain
• This is in effect a hardware poll.
• All I/O modules share a common interrupt request line.
• The interrupt acknowledge line is daisy chained through the modules.
• When the processor senses an interrupt it sends out an interrupt acknowledge signal. This
signal is propagated through a series of I/O modules unit it gets to a requesting module. The
requesting module responds by placing a word on the data bus. This word is referred to as
a vector the processor uses this vector as a pointer to the device.
• This technique is called a vectored interrupt.
Disadvantage
1] They are asynchronous in operation
2] They require more extensive hardware
Interrupt PRIORITIZATION
- With multiple lines the processor just picks the interrupt line with the highest priority.
- With soft ware polling the order in which modules are polled determines their priority.
- On a daisy chain the order of the device /modules determines their priority.
- 127 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
6.0 INTERFACES
Input /output data transfer movement always requires interrelated hardware and software facilities.
The hardware facility allows the microprocessor to be interfaced to the outside world. An interface is
a device dividing two zones operating under different conditions. Interfacing is therefore a matching
function. In a complete microprocessor system, the interface device connects the microprocessor
system to the peripheral world and organizes the data transferred to and from the peripheral devices
so that it may be assimilated by the computer system.
An interface is a special circuitry which fits into the gap between the processor and the peripheral.
The interface is connected to the processor‟s data bus, address bus and control bus and passes
information between the processor and the peripheral.
The interface unit has both an input and an output port. These ports are made µP of data storage
registers that hold the information being transferred to or from the peripheral device. Each port has
it‟s own address which is determined by the address decoding logic.
- 128 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
The parallel format is used when a high data transfer rate is desired.
A parallel peripheral device provides a path for transferring binary information in parallel.
Peripheral data bus
I/O bus
When the peripherals are relatively close to the processor say within a few meters of it, the
interconnecting cables between the computer and the peripheral are short and their cost is small
however when the peripheral are a great distance from the processor this cost may become very high
and an alternative approach may be used.
- 129 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Data
Data bus buffers
Port A data register I/O bus
The information stored in the control register specifies the ports mode of operation. The port data
register is used for transferring data to and from the data bus and I/O bus. The microprocessor
initializes each port by transferring appropriate bits into a control register so as to define the mode of
operation of the port. In most cases each port can be placed in an input or output mode. In addition,
the port can be made to function in a variety of operating modes. Three operating modes found in
most interface chips are:
- 130 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Handshaking mode
Handshaking refers to exchange of signals. Handshake lines are used to control the transfer between
two devices operating asynchronously with each other i.e. when they do not share a common clock.
The transfer with handshaking depends on whether the port is in an output or input mode.
In the output mode, the microprocessor writes a byte into the interface port data register. The interface
then enables output handshake line to inform the external device that a valid byte is available on the
I/O bus. When the external device accepts the byte from the I/O bus, it enables the input handshake
line. This sets a flag bit in the control register. The microprocessor reads the register containing the
flag bit to determine if the transfer was completed. If so, the microprocessor can write a new byte into
the data register of the interface chip.
In the input handshake mode, the external device places a byte on the I/O bus and enables the interface
input handshake line. The interface transfers the byte into its data register and also sets a flag bit in
the control register. The microprocessor reads the register containing the flag bit to determine if an
input transfer is requested. If the flag bit is set, the microprocessor reads the byte from the port data
register and clears the flag bit. The interface then informs the device attached to the I/O bus, through
the output handshake line that a new byte can now be accepted.
Interrupt mode
In the handshake mode, the microprocessor must periodically read the control register to check the
status of the flag bit. If there are a number of ports attached to the microprocessor it would be
necessary to poll them in succession to determine the ones that require a transfer. This is a time
consuming operation. It can be avoided by initializing the interface to operate in the interrupt mode.
Most commercial units provide a separate interrupt line for each port in the interface. Every time a
flag is set in the port, the interrupt request belonging to the port is automatically enabled to inform the
microprocessor that a transfer is to be initiated. The microprocessor responds to the interrupt signal
from the port that requested the action and transfers data to or from the interface port data register.
NB
Special integrated circuits are available to support any peripheral device which one my need to
incorporate into a system for parallel data transfer. These IC‟s are called programmable interface
chips. They are programmable in order to make them universally useful e.g. Intel 8155 PIO
(programmable input-output), Motorola MC 6522 PIA (peripheral interface adapter) e.t.c
- 131 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Synchronous mode
In the synchronous serial mode, the transmitter and receiver share a common clock. A synchronizing
agent between the receiver and transmitter called sync character is chosen. This is accomplished by
reserving a unique 8-bit pattern and assigning it as the sync character, when the transmitter starts
sending 8-bit characters, it sends a few sync characters first and then sends the actual message with
each clock pulse, the receiver checks the last eight bits received. If they do not match the bits of the
sync character, the receiver accepts one more bit, rejects the previous high order bit, and checks again
the last 8-bit received until a synch character is recognized. From here on, the receiver counts every
eight bits and accepts them as a single character. Moreover, when the transmitter does not have any
message characters to send, it sends a continuous string of sync characters in this case the two units
maintain synchronism while no meaningful message is being communicated.
Asynchronous mode
The character transmitter and receiver do not share a common clock. At least two additional bits are
sent with each character. These additional bits are called start and stop bits e.g. a teletype unit using
an 8-byte character code sends 11 bits for each characters transmitted. The first bit is the start bit.
This is followed by the 8-bits of the character and then two stop bits. The first bit is always „0‟ and
represents the start bit to indicate the beginning of a character. The receiver can detect the start bit
when the line goes from 1 to 0. After the 8-bits of he characters are received, the receiver checks for
two stop bits which are usually in the 1 state. After the two stop bits have been transmitted, the line
- 132 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
may go to 0, indicating a start bit for a new character. The line will stay in the 1-state if no character
follows immediately.
1 0 0 1 1 0 1 0
8-bit information
Start 2 stop bits
bit
It functions both as a transmitter and receiver and can be programmed to function in a variety of
modes. The interface is initialized for a particular serial transfer mode by means of a control byte
which is loaded into its control register. The transmitter register accepts a data byte from the
microprocessor through the data bus. This byte is transferred to a shift register for serial transmission.
The receiver portion receives serial information into another shift register for serial transmission.
When a complete data byte is accumulated, it is transferred to the receiver register. The microprocessor
can select the receiver register to read the byte through the data bus. The bits in the status register are
used to set input and output flags and to detect certain errors that may occur during the transmission.
- 133 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
• The address-data pins of the 8155/8156 PIO (AD0-AD7) are connected to the address-data bus of
the 8085 microprocessor.
Note
The only difference between 8155 and 8156 PIOs is that in 8155, the chip enable (CE) signal is low
while in 8156, the CE is high.
VCC PC2 PC 1 40
3
PC1 PC 2 39
4
TIMER 3 38 PC0
RESE 4 37
PB7
PC 5 36
PB6 5
6 35
PB5
IO/ 7 34
PB4
CE 8 33
PB3 9 32
PB2 31
10 8156
PB1 30
ALE 11 PIO
AD0 12 29 PB0
AD1 13 28
PA7
AD2 14 27
PA6
AD3 15 26
PA5
AD4 16 25
PA4
AD5 17 24
PA3 23
AD6 18
PA2 22
AD7 19
PA1 21
V 20
SS
PA0
- 134 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
8085-8156 INTERFACE
IO/ IO/
A13 CE
8085 AD AD 8156
microprocessor
AD1 AD1
AD0 AD0
ALE ALE
AD3-AD7 AD3-AD7
Address-data bus AD0-AD7 is the same as A8-A15. Thus AD0-AD2 will be A8-A10. These are used
for decoding the port addresses. A13 is used as a chip enable while A11, A12, A14 and A15 are unused
(don‟t care- assume zero).
Therefore port addresses are;
0 0 1 0 0 0 0 0 CSR 20H
0 0 1 0 0 0 0 1 PORT A 21H
0 0 1 0 0 0 1 0 PORT B 22H
0 0 1 0 0 0 1 1 PORT C 23H
0 0 1 0 0 1 0 0 TIMER LOWER PORT 24H
0 0 1 0 0 1 0 1 TIMER HIGHER PORT 25H
6.2.1 PORTS
8156 has three ports (Port A, Port B and Port C). To read data or write into these ports, IO/ must be
high. Each port has an internal register (PA, PB and PC) that latches data during an I/O operation. Port
A and Port B can latch 8-bit data each. Port C can however latch only 6-bit data. This is because Port
C is typically used for serial I/O or as a 6-bit parallel control port for handshaking to support data
transfer between the 8085 and an external device via Ports A and B.
Note
Handshaking means data transfer via exchange of control signals. Two bits (bits 2 and 3) of the CSR
are required t configure port C.
- 135 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
When using IN and OUT instructions, we have to include an immediate byte that specifies the port
address (port number) e.g. OUT 21H.
When IN or OUT instruction is executed, the 8085 duplicates the port number on the address bus and
on the address-data bus e.g. during OUT 21H, we have;
AD7 – AD0 = 0010 0001
A15 – A8 = 0010 0001
Besides ports A, B and C, 8156 contains a command and status register (CSR) and a timer. The CSR
determines whether the ports act as input or output ports (command word). It also contains information
about the status of the ports (status word). The timer is a 14-bit down counter used for counting input
pulses.
PORT C definition
Timer control
B7 Effect
B6
00 No effect on timer
01 Stop timer if running
10 Stop timer immediately terminal count is reached
11 Start timer immediately
- 136 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Port c definition
B3 B2 Effect
00 Defines port C as an input port
11 Defines port C as an output port
Defines;
PC0 as port A interrupt
01 PC1 as port A buffer full
PC2 as port A strobe
PC3-PC5 as output bits
Defines;
PC0 as port A interrupt
PC1 as port A buffer full
10 PC2 as port A strobe
PC3 as port B interrupt
PC4 as port B buffer full
PC5 as port B strobe
Note
To send a command word to the command and status register, we use OUT 20H e.g. suppose we want
port A to be in input port and port B to be an output port. Then B0 must be 0 and B1 must be 1 and the
rest can be zeros. To load the command register with this word, we use;
MVI A, 02H
OUT 20H
If we want port A to be input port and ports B and C to be output ports, we can initialize 8156 PIO
with the following instructions.
MVI A, 0EH
OUT 20H
Handshaking
Port C is complicated because it can act as an input, output or a handshaking port. When bits B3 and
B2 are 0 and 1 respectively, half of port C is used as a handshaking port and the other half as an output
port. When B3 and B2 is 1 and 0 respectively, port C provides handshaking for ports A and B. Three
handshaking bits are used for each port i.e. an interrupt, a buffer full and a strobe. This allows the use
of interrupt O/I with handshaking.
- 137 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Status word
The CSR can be read using an IN 20H instruction. This transfers the content of the status register to
the accumulator. Figure below shows the bits of status word.
INTR INTE BF INTR INTE BF INTR
X TIMERR B B A
B A A
Interrupt TIMER
Don‟t care
Example 1
Show the instructions needed to make port A an input port, B an input port and C a full handshaking
port. The A and B interrupts should be enabled and the timer bits reset to 00.
Solution
We need a command word of;
00111010 =3AH
This will reset the timer bits to 00(bits 7 and 6), enable the A and B interrupts (bits 5 and 4), provide
hand shaking for A and B (bits 2 and 3), make B an output port (bit1) and A an output port (bit0). To
send this command to the command register, we use;
MVI A, 3AH
OUT 20H
- 138 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Example 2
Show an interrupt driven input circuit that handshakes with port A.
Solution
(a)
8085 8156
Peripheral
data data device
AD0 - PA0 - PA7
AD7
INTR BF A
A
(b)
BF A
INTR A
In figure (a), the peripheral device sends data (PA0-PA7) to port A of the 8156 which then sends the
data (AD0-AD7) to the 8085. Port C provides the handshaking bits (INTR A, BF A and ) Figure
(b) is the timing diagram. First the peripheral device sends a low to the 8156. This loads the
peripheral data into port A via PA0-PA7 bus. The 8156 acknowledges receiving this data by sending
a high BF A back to the peripheral device.
A little later, the 8156 is ready to transfer data, so it sends a high INTR A to the RST 5.5 pin of the
8085. After the 8085 recognizes this interrupt, it branches to a service routine that includes the
instruction IN 22H. During the execution of this instruction, goes low, this transfers the data in
port A to the accumulator via the address-data bus. Then the remainder of the service routine is
completed.
Example 3
Show an interrupt driven output circuit that handshakes with port B. Solution
(a)
8085 8156
Peripheral
data data device
AD0 - PA0 - PA7
AD7
INTR BF B
B
(b)
- 139 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
INTR B
BF
B
Figure (a) is the circuit while figure (b) is the timing diagram. The action begins when the 8156 sends
a high INTR B to the 8085. After this has been recognized, the 8085 branches to a subroutine that
includes an OUT 22H instruction. During the execution of this instruction, goes low, this transfers
data from the accumulator to port B via the address-data bus. The INTR B then goes low, indicating
that the data has been received.
A little later, the 8186 sends a high BF B to the peripheral device. This transfers the data from port B
to the peripheral device via PB0-PB7 bus. To indicate that it has been received the data, the peripheral
device returns a low
T7 T6 T5 T4 T3 T2 T1 T0 PORT 24H
LOWER 8
BITS
T7 T6 T5 T4 T3 T2 T1 T0 PORT 25H
UPPER 6
BITS
TIMER
MODE
- 140 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Suppose we want to preset the terminal count to 00FFH, then these are the initializing instructions;
MVI A, FFH
OUT 24H
MVI A, 00H
OUT 25H
The first two instructions loads FFH to the lower 8 bits of the timer while the last two instructions
loads 00H to the upper 6 bits and the timer mode.
Timer mode
The output signal (pin 6) depends on the timer mode M2M1 as show in table below.
M2 M1 Effect
1 0 Single pulse
1 1 Continuous pulse
Figure below shows how the signals appear after each mode.
Start Terminal count Terminal count Terminal count Terminal count Terminal count
count
Mode 00
Mode 01
Mode 10
Mode 11
- 141 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Timer Command
Bits b7 and b6 of the command and status register (CSR) control the starting and stopping of the timer
as shown in table below.
B7 B6 Effect
0 0 No effect on timer
0 1 Stop timer immediately
1 0 Stop timer after terminal count is
reached
1 1 Start timer
For instance, suppose we want to start the timer, enable the port interrupts, make C and B output ports
and A an input port. Then we need a command word of; Command word = 1111 1110
The initializing instructions are;
MVI A, FEH
OUT 20H
Example
The system clock is connected to the TIMER IN input of the 8156. The clock has a frequency of
3MHz. show a program segment that produces a continuous square wave with a frequency of 1 kHz.
Include a start timer command, disable the port interrupts, make C and B output and A an input port.
Solution
We have to divide the clock frequency by 3000 which is equivalent to OBB8H. By setting the terminal
count equal to 0BBH, we will get one square wave for cycle out for each 3,000 clock pulses in.
Therefore, the lower 8 bits of the terminal count are; 1011 1000
This is the lower byte to be loaded into port 24H. The
upper 6 bits of the terminal count are;
00 1011
The timer mode bits for a continuous square wave are;
M2M1 = 01 Therefore,
port 25H must be loaded with;
0100 1011
The command word we need for port 20H is;
1100 1110
- 142 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
1 0 1 1 1 0 0 0 PORT 24H
PORT 25H
0 1 0 0 1 0 1 1
PORT 25H
MVI A, B8H
OUT 24H
MVI A, 4BH
OUT 25H
MVI A, CEH
OUT 20H
- 143 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Address bus
Data bus
M/IO MEMORY
MPU
I/O
R/W
Peripheral Peripheral
device 1 device N
- 144 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Address bus
Data bus
MPU
R/W
Peripheral Peripheral
device 1 device N
Since the interface circuit look exactly like memory locations to the processor any of the regular
instruction which operate upon the contents of memory location can be brought to bear upon the I/O
device.
- 145 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Disadvantages
• In order to perform operation on port data one must move the data into accumulator first.
- 146 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Programmed I/O
Using this technique the processor executes a program to perform all data transfer between the
computer system and the external devices via the I/O port the program tell the peripheral interface
exactly what to do and when to do it. The main characteristic is that the external device carries out
the function as dictated by the program inside the computer system i.e. the microprocessor completely
controls all the transfer.
Program control is the slowest although it requires the least amount of interface logic to implement
with this method the programmer has complete control over the entire process hence it is also easiest
method to test and debug.
Interrupt I/O
In programmed I/O when peripheral is not ready for data transfer then the processor must wait. In
system with several peripherals of this type, the time spent waiting is often not tolerable. There may
be other more important things which the processor should be doing rather than waiting for
peripherals. In such cases an alternative is to use interrupt I/O.
With interrupt I/O, the peripheral initiates the transfer of data. It does this by signaling to the processor
its readiness through a special input to the processor called an interrupt pin (INT). The external I/O
device is connected to this pin. When the device wants to communicate with microprocessor, it makes
the signal on the interrupt pin HIGH or LOW (depending on the microprocessor). In response the
microprocessor completes the current instruction and pushes the current contents of the PC into the
stack so that the processor will know where to return after completion of the I/O operation.
The processor then turns off the interrupt system so that it can execute instructions with no additional
interrupt occurring. Then it branches to the beginning of a special program written by user the called
an interrupt service routine.
The interrupt service routine is the program the external device wants the microprocessor to execute
in order to transfer data. The interrupt service routine transfers data or otherwise services the peripheral
- 147 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
in accordance with it‟s needs. Upon completion of the service routine, the processor POPs the address
which was saved/pushed into the stack onto the PC.
Most processors support several alternatives for the timing of a DMA data transfer. These are:
2] Cycle Stealing
The processor gives µP the bus for a memory cycle of DMA or at most a few such cycles. In this
technique the DMA controller transfers a byte of data between the peripheral and the memory by
„stealing‟ a clock cycle of the microprocessor. This is accomplished by not providing a clock signal
- 148 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
to the microprocessor. An INHIBIT signal is used for this purpose. This INHIBIT signal is normally
HIGH and is logically ANDed with the system clock to generate the microprocessors clock. The DMA
controller stops the microprocessor by lowering the INHIBIT signal to LOW. The DMA controller
then takes over the system buses for the time microprocessor is stopped.
- 149 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
8.0 SUBROUTINES
Introduction
When writing a program it is frequently necessary to repeat an operation which was performed in
another part of the program e.g. a time delay. The simplest solution to this problem would be to repeat
the entire routine on each occasion it is required. This is a rather wasteful approach, resulting in a
program which is larger than necessary and which contains several almost identical sections of codes.
A better approach would be to write each routine once only and call the function when required. This
may be achieved by writing the function as a subroutine.
Definition
A subroutine is a special program which performs some repetitive/ repeatedly needed tasks such as
searching, sorting etc and which may be called from any part of the main program.
If a commonly used function such as a time delay is coded as a subroutine, the time delay may be
accessed from any part of the program simply by calling the subroutine. This results in a shorter
program. Typically a subroutine can be written, assembled and tested separately.
Subroutine operation
Main program
Start of subroutine
Call
Subroutine body
subroutine
End of subroutine
Main
program
continues
• The execution of the program proceeds normally until the call subroutine instruction is
encountered.
• At this point, the address of the subroutine is placed into the program counter (PC) register,
causing a jump to the subroutine start address.
• At the same time, the microprocessor makes a note of the position reached in the main program
for later reference.
- 150 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
• The last instruction in the subroutine causes the microprocessor to return to the main program
at the point previously reached. This is called a RETurn Instruction (RET).
• The address of the instruction immediately following the subroutine is then placed back into
the program counter. This causes the main program to resume at the point previously reached.
NOTE
Since the subroutine may be called from anywhere in the program, the microprocessor must keep a
record of the subroutine return address. This is the address of the next instruction after the call
subroutine instruction. The microprocessor uses a special area of RAM called the stack to store this
information.
EXAMPLE
For the 8085 microprocessor demonstrate how a simple time delay subroutine may be called from the
main program. Use a trace table to study the detailed operation of the program.
; Main program
ORG 4000H
CALL DELAY
HLT
; Subroutine
ORG 5000H
DELAY: MVI A, 03H
DCR A
JNZ LOOP
RET
• The (incomplete) main program contains a subroutine call to the label DELAY, which is stored
at address 5000H.
• The subroutine loads a start value (03H) into the accumulator which is then repeatedly
decremented.
• The RET instruction then returns control to the main program at which point the HALT
instruction is encountered.
Trace table
- 151 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
first followed by the most significant byte. This is illustrated below with reference to the
example above.
Before subroutine.
PC 4000 Stack (Empty)
During subroutine
PC 5000 Stack (return address) 03 LSB
MSB
40
After subroutine
PC 4003 Stack (Empty)
Subroutine calls and return from subroutine are usually handled by two special instructions namely
CALL and RET respectively. When the CALL instruction is executed, the current contents of the PC
are saved in the stack and the PC is loaded with the address of the first instruction in the subroutine.
NOTE
• The current contents of the PC provide the address of the instruction that immediately follows
the CALL instruction. It is also called return address because this is the point where execution
of the calling program resumes after exiting the subroutine. Thus the CALL instruction is
equivalent to the following instruction sequence.
PUSH PC ; save return address in stack
JP ADDRESS ; branch to subroutine
• The RET instruction is usually the last instruction of the subroutine. When this instruction is
executed the return address previously saved in the stack is retrieved and is loaded into the PC.
Thus the control is transferred to the calling program. In concept, the RET instruction is
functionally equivalent to POP PC.
- 153 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Main program
Subroutine Subroutine
“SUB1” “SUB2”
Return from
Return from Subroutine “SUB2”
Main program Subroutine “SUB1”
continues
In the above example the main program executes normally until a subroutine call to “SUB1” is
encountered. The return address to the main program is then stored into the stack and the first
subroutine begins to run.
At some point, a subroutine call to “SUB2” occurs which causes the return address to the first
subroutine to be stored in the stack. The return address to the first subroutine is the most recently saved
and is therefore on the top of the stack.
When the second subroutine finishes, the return from subroutine instruction causes the top two bytes
on the stack to be placed into the program counter. This causes the first subroutine to resume at the
instruction following the second subroutine call.
On completion of the first subroutine, the remaining two bytes are removed from the stack and placed
on to the program counter. At this point the main program resumes immediately after the first
subroutine call.
Figure below shows the content of the stack at each point in the nested subroutine.
SUB2
SUB1 SUB1
SUB1
- 154 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
NB
1. A subroutine must be called from the main program using a call subroutine or jump to
subroutine instruction e.g. CALL 3000H (means jump to subroutine at memory location
3000H)
2. The last instruction executed by the subroutine must be a return from subroutine (RET).
3. In order to implement subroutine nesting we need to retrieve the return addresses exactly in
the reverse order in which they were saved since the stack is a LIFO data structure.
NB
Whichever of the above method is used, the program documentation must give adequate details of any
parameters used or returned by subroutine.
- 155 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Example
For the 8085 microprocessor, write a double loop time delay program which accepts its start value
using a parameter. The parameter should be passed using one of the microprocessors registers. On
completion, the subroutine should return to the main program leaving all the data registers in their
initial state.
Solution
Assume that the subroutine will accept the parameters in register C and that it will use register B
internally. The program is therefore;
ORG 4000H ; origin is 4000H
MVI C, 05H ; parameter = 5
CALL DELAY ; jump to subroutine
HALT
DELAY: PUSH BC ; store B & C in the stack
LOOP1: MVI B, FFH ; inner loop
LOOP2: DCR B ; outer loop
JNZ LOOP2
DCR C
JNZ LOOP1
POP BC ; restore B & C
RET
• The above example includes a short main program. In this program, a parameter (5) is loaded
into register C before the subroutine is called.
• The subroutine uses registers B and C internally and so the BC register pair is PUSHed into
the stack before the main time delay starts. The original register contents are restored when the
BC register pair is POPed from the stack just before the return instruction.
• The inner loop repeatedly decrements register B while the outer loop decrements register C
which is the parameter passed by the main program. Once B and C are zero, the main program
resumes.
- 156 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Start
Problem? NO
Leave it alone
YES
YES
YES
YES
YES
- 157 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
continue
9.2 TYPICAL FAULTS IN MICROCOMPUTER BASED SYSTEMS
i) Chip failure ii) Open
circuit interconnection iii) Short
Circuit interconnection iv)
Externally Included interface
v) Software Bugs.
1. Chip Failure
Common failures include;
a) Input(s) open circuit
b) Input(s) shorted to ground
c) Two or more inputs shorted together
d) Output stuck high
e) Incorrect or partial operation due to internal open or short circuit
f) Sequential logic faults (wrong count, wrong reset etc)
NOTE
Connectors are often a weak link in the chain particularly if of poor quality, subject to abuse or if
equipment is dismantled.
5. Software Bugs
Bugs are logic errors. These errors may go undetected for months or even year only to become apparent
when a particular set of inputs or operating conditions are established which hitherto have not been
used. In fact when writing very complex programs it may not be feasible to test for every possible
combination of operating conditions and feedback from the software user become essential.
Visual Inspection
It may reveal the source of a fault and is certainly worth carrying out before attempting further
investigations. Simple faults such as loose connectors, ICs loose in their sockets or cracked PCB‟s etc
can easily be identified or noticed by visual inspection. Sometimes the temperature of a component
helps to isolate a fault e.g. voltage regulator which runs too hot or cool may indicate a fault.
D.C Test
A multimeter is used to measure dc voltages or resistances. It is of limited use in microprocessor based
systems but may be satisfactory for checking power supplies to each device, short or open inference
circuit etc.
Oscilloscope
It is limited to those applications in which signals can be obtained e.g. Clock signals. Most of the
signals from the microprocessor are not and depend upon program being executed at that time. It‟s
applicable only when a microprocessor is made to generate repetitive signals e.g. by free running it or
running very short looping programs.
Examples of fault finding equipments in this technique are:
- 159 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
LOGIC PROBE
This is a hand-held instrument which is used and detects „high‟ and „low‟ logic levels in types of
circuits including TTL and CMOS logic probes should be capable of detecting indicating „bad‟ logic
levels, open circuits and inputs. The method of indicating the detected levels varies. Some probes e.g.
HP 545A use a near the logic tip to give the following indications:
OFF - Below logic „o‟ threshold
DIM - A bad logic level or open – circuit
BRIGHT - above logic 1 threshold
FLASHING - pulsating input
lamp
Other types of logic probes use three different types of colored LEDs typically RED, YELLOW &
GREEN which gives the following indications;
GREEN - below logic „0 ‟threshold
RED only - above logic „1‟ threshold
RED & YELLOW - pulsing 1 to 0
GREEN & YELLOW - pulsing 0 to 1
RED, GREEN & YELLOW - square waves.
- 160 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Logic pulser
It is used to stimulate digital circuits by injection of controlled pulses. A logic probe is often used to
determine the effect of stimulating a circuit as shown below:
CURRENT TRACER
It is used to locate the source of a low impedance path without the necessity of removing components
from the circuit. The tip is magnetically sensitive and is used to detect the magnetic field which
surrounds a conductor when carrying a current tracer must first be aligned with the printed circuit
track where tracing is to begin and its sensitivity control is adjusted so that the indicator lamp glows.
The current tracer tip is then moved along the tracks and along all branches including off the track
until the source of abnormal current flow is detected.
LOGIC COMPARATOR
Needed for checking faulty nodes in digital circuits, often associated with faulty ICs .It compares a
known good or reference with the one suspected of being faulty.
The reference IC is connected in parallel with the faulty IC input pins. Each output of the reference IC
is Ex-ORed with the corresponding output of the IC under test.
A difference between only two corresponding outputs generates a logical 1level on the Ex-OR gate
output and this is used to activate an error indicator LED.
The main advantage is that testing is carried out at normal operating speeds without need to remove
the suspected IC from the circuit.
LOGIC ANALYZER
One problem associated with checking the operation of a microprocessor based system is that data on
the bus and control lines changes rapidly as the program is executed. Since the bus signals are
repetitive, a signal event may occur within one or two micro processor cycle and go undetected.
A logic analyzer allows the logic states of a bus and control signals to be captured at specified times
and stored in a first –in first –out (FIFO) format/memory.
- 161 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
a) Trigger word
The point in a program where data capture starts or finishes must be selected by the user. This is
achieved by setting up a “trigger word” in the logic analyzer which is compared with the incoming
data. The trigger word may contain „don‟t cares‟(x) which enable data with unknown elements to be
specified. Once a match is found between the incoming the trigger word, data capture continues for a
predetermined number of clock pulses and is then terminated. This arrangement allows the user to
study events leading up to the trigger point as well as those immediately following it.
b) FIFO Memory
The data storage provided by logic analyzers organized as a first-in-first-out (FIFO) memory which
has typically 1024 to 2048 storage locations each 32 bits wide. Some logic analyzer allows this
memory to store be re-figured by the user to obtain a larger number of storage but of reduced width.
Each of the 32 bits of a word used to store the instantaneous logic state of a bus FIFO simultaneously
using either internally generated or externally derived clock signals.
As each data word is clocked into the FIFO, all previously captured data is shifted one place to make
room new data. The data word shifted out from the opposite end of the FIFO is lost. Therefore at any
instant, the FIFO contains a record of the logic states on the bus and control lines during the last 1024
or 2048 clock periods.
c) Clock signals
A logic analyzer may be told at which instants to capture data from the bus and control lines. Therefore
a clock signals is used data into the FIFO memory. A high speed asynchronous clock signal with user
selectable frequencies may be generated by the logic analyzer itself. This type of clock can operate at
much higher frequencies than are used in the system under test, thus enabling a logic analyzer to
perform high speed sampling of signals for solving hardware, logic and timing problems.
A low speed synchronous clock is obtained from the system under test using such signals such as RD,
WR, MREQ, IORQ etc as the source. This type of clock signal is useful for debugging software and
the user may select which edge of the clock is used to transfer data into the memory.
d) Display Format
The output from the FIFO memory may be formatted by a logic analyzer to provide one of the
following user selectable displays
- 162 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
i) State Display
A list or state display shows the contents of a logic analyzer memory as a sequence of binary, octal,
decimal or hexadecimal codes. Often display of ASCII equivalent is provided for easier
identification of certain words. ii) Timing Display
A timing display allows data captured from a limited number of channels to be displayed in correct
time as sequence as digital waveforms. Since the waveforms are constructed from the data stored in
memory, they do not represent the true shape of the original waveforms and are used for timing
comparisons only.
iii) Disassembly
Many logic analyzers allow captured data to be displayed as disassembled assembly language
mnemonics. For each different type of microprocessor supported, a logic analyzer requires addition
of a personality module or and through installation of associated software. The pod simply clips into
the microprocessor making all the necessary connections.
SIGNATURE ANALYZER
Signature analysis is a technique designed to simplify fault location on complex microprocessor based
systems. With the location on complexities of modern equipments, a manufacturer may often adapt a
modular form of construction in order to simplify testing and subsequent fault location. The major
advantage of this approach is that it requires a large number of connectors which add to the cost of
equipment and provide additional source of possible faults.
A circuit provided is marked up with appropriate waveforms and voltages obtained from the
equipment under test may b compared with those on the circuit diagram until discrepancy is found,
thus enabling the faulty component to be located.
Deriving Signatures
Signatures are digital information t any point in the circuit. They are taken at different points of the
act and are compared with the correct signature which is printed on the circuit diagram. Any
discrepancies should lea the technician to the sources of the trouble.
- 163 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
The bit sequences being measured are added into the feedback before being clocked into the shift
register. The effect of this is that some bits are inverted before being clocked into the shift register
depending on what has happened previously. The bit stream may be any length but only the residue
in the shift register at the end of the measurement is used. These 16 bits displayed in hexadecimal are
the signature of the measured data stream.
For the 1st eight periods (0-7), the circuit performs as an ordinary shift register but at period 7, the
1st „1‟ of the sequence has reached the ist tap of the shift register. The result of this is that the next
input bit which s a logical „0‟ is inverted before being clocked into the shift register. This process
continues until the end of the measurement when the 16- bit residue remaining is 1101100101010011
Taking Signature
In order to take signatures, a signature analyzer requires START and STOP signals. A Clock signals
is also required, and those signals are obtained from the circuit under test. At points defined in the
service manual. Typical points for obtaining these START and STOP signals are the high order
address lines while the clock may be obtained from the „RED‟ or „WRITE‟ lines or from chip selects.
1. What is the size of the memory address space for the microprocessors given in Table
12.1
Table 12.1
SOLUTION
The memory address space is given by
M = 2p
Where, P is the address bus width.
- 164 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
The memory address space for the µPs is given in Table 12.2
Table 12.2
Microprocessor Memory address space
8080A 64Kbytes
6800 64K bytes
8086 1M bytes
9900 64K bytes
Z8000 8M bytes
2. How many different instructions are possible in an 8-bit microprocessor? Compare this
number with the number of instructions of 8085.
SOLUTION
Words = 28 = 256
Therefore, the total number of instruction codes, assuming single byte op code = 256
SOLUTION
(b) Let the first 2K bytes be in EPROM and next 4K bytes be in the RAMs.
- 165 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
The relevant connections are shown in the Fig. 12.1. Other connections are indicated
below;
A0-A10 from µP to A0-A10 of 2716
Fig 12.1
Table 12.3
Memory chips Starting address Last address
EPROM 0000H 07FFH
RAM pair 1 0800H 0BFFH
RAM pair 2 0C00H 0FFFH
RAM pair 3 1000H 13FFH
RAM pair 4 1400H 17FFH
4. It is desired to clear the accumulator of 8085. Explain the possible instructions for this purpose.
SOLUTION
5. Write a set of instructions to check a register pair of 8085 µP for Zero content.
SOLUTION
Let us consider the B-C pair. The following set of instructions will set the Zero flag if the
content of B-C pair is Zero.
MOV A, C
ORA B ; OR C with B
JZ TEST ; Jump to TEST if Z=1
6. Write a program for 8085 to complement the bytes stored in locations 0F00H through 0FFFH
and store them in locations starting from 1F00H.
SOLUTION
Let D-E and H-L pair be pointers to source and destination memory locations respectively.
The program is given below:
SOLUTION
From instruction set, we obtain the number of bytes for each instruction. The total bytes required
are:
Bytes = 3+3+3+1+1+1+1+1+1+1+1+3+1 = 21
8. Calculate the time required to execute of Program of Q6. Assume T state time as 320 ns.
SOLUTION
From instruction set, we obtain the number of T states for each instruction.
- 167 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Where N is the number of times the instructions in the Do loop are executed. It is 100H=256
in this case. The JNZ condition is true for (N-1) times and during Nth time the control comes
out of LOOP, where the numbers of T states are 10 and 7 respectively
9. Write a program for 8085 to find the larger of the two numbers stored in the locations 0A02H and
0A01H and store it in memory location 0A02H.
SOLUTION
10. Write a program to clear memory location 01A0H in an 8085 microprocessor system.
SOLUTION
The following instructions will clear the memory location.
LXI H, 01A0H
- 168 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
MVI M, 00H
11. Write a program to find the smallest element in a block of 8–bit unsigned binary data, whose
number is stored in memory location A001H, and the data are stored in memory locations
beginning from A002H. Store the smallest number in memory locations FF00H. The µP used is
8085;
SOLUTION
LXI H, A001H ; Initialize pointer
MOV C, M ; Get the number of bytes in C
INX H ; Increase Pointer by 1
START: MOV A, M ; get a byte of data in A
REP: DCR C
JZ STOP ; stop at the end of data
INX H
CMP M ; Compare
JC REP ; If (A) < (M), try next number
JMP START
STOP: STA FF00H ; Store the smallest element
END
12. It is desired to mask (set to 0) the most significant four bits in the accumulator.
Suggest an instruction to accomplish this in an 8085µP system.
SOLUTION
ANI OFH
13. An 8085 program is given below. Find the task performed by this program.
SOLUTION
The operation performed by each instruction is given below:
START: LXI H, BUFR ; Initialize H-L pair with address BUFR
MOV C, OBH ; Initialize counter with decimal 11
LOOP: DCR C ; Decrease counter by one
JZ FINIS ; Go to FINIS if counter=0
IN DATA ; Input a byte from a DATA port
- -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
LXI B, 2475H
LXI D, 3794H
LDAX B
MOV L, A
LDAX D
STAX B
MOV A, L
STAX D
SOLUTION
N = 3+3+1+1+1+1+1+1=12 bytes
15. Assume that the accumulator contains 08H and register B contains 93H (both in BCD format).
Find the contents of the accumulator after ADD B instruction is executed. Is the result a valid
BCD number? If not, what should be done to obtain the result in BCD format? Explain clearly.
SOLUTION
The result is not a valid BCD number. ADD B instruction must be followed by DAA
instruction. The effect of this is given below:
1001 1011
0000 0110 ; Add 06H because the least significant bits do not represent a valid BCD digit
16. The contents of some memory locations of an 8085 µP based system are shown in the fig 12.2
What will be the content of H-L pair after the execution of the program given below:
LHLD 3000H
- 170 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
MOV E, M
INX H
MOV D, M
LDAX D
MOV L,A
INX D
LDAX D
Memory address memory contents MOV H, A
(Hex) (Hex)
02 3000
3001 30
3002 00
3003 30
Fig. 12.2
The first instruction will load L & H registers 02H and 30H respectively.
The second instruction will copy the contents of the memory location 3002H in register E, i.e.
register E will be loaded with 00.
The third and fourth instruction will load the D register with 30H (the contents of memory
location 3003H). Now the DE pair contains 3000H.
The instruction LDAX D will load the accumulator with 02H and the next instruction will
change the contents of the register L to 02H.
The last three instructions will make the contents of H register 30H, i.e. the contents of H
register will remain the same. Therefore, now the H-L pair contains 3002H.
PUSH B
PUSH D
PUSH H
PUSH PSW
What will be the last six instructions of the subroutine? Explain clearly.
SOLUTION
POP PSW
POP H
POP D
POP B
- 171 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
EI
RET
Here it is assumed that the interrupts are kept disabled during the execution of the subroutines.
18. Write an 8085program to convert a decimal digit in memory location 00F0H to an ASCII
character and store it in memory location 00F1H. If the memory location 00F0H does not contain
a decimal digit an ASCII question mark should be placed in the memory location 00F1H.
SOLUTION
The ASCII code for decimal 0 is 0110000 and for ? is 0111111. The program is given below;
LXL H, 00F1H
LDA 00F0H
CPI 0AH
JNC QUE
ADI 30B
MOV M, A
JMP STOP
QUE: MVI M, 3FH
STOP: END
19. Consider a keypad with eight keys marked 0 through 7. It is interfaced with an 8085µP based
controller. Each key is associated with a function that the controller carries out when the key is
pressed. Whenever any key is pressed, an encoder associated with the key pad gives an 8-bit
binary output corresponding with the key pressed, for example, when key number 4 is pressed, the
output of the encoder is 00000100. Assume the address of the port to which the key pad is
connected AH. Write the program segment to implement it.
SOLUTION
Assume a table containing bytes in contiguous memory location starting from address
TABLE. This table contain the eight branching addresses corresponding to eight
functions. The required program segment is given below.
- 172 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
SOLUTION
Let the EPROM under test to be plugged into a socket with 2K (2048 =0800H) locations
starting at address ‘EPROM’. Let the two LEDs be connected to port DISP at bit 0 and 1
locations respectively to indicate complete erasure or incomplete erasure. The program is
given below:
21. Write a subroutine to create a delay of 2 ms using 8085 µP with T = 320 ns.
SOLUTION
The time required to execute this routine = [10 + N x (6+4+4) + (N-1) x10+7] x 320 ns
N = 260
22. Prepare a flow chart and write an ALP for 8085 µP which inputs 500 bytes from I/O device
connected to port 0AH and stores them in memory location starting from 2A00H if the data is
positive and from 3A00H if the data is negative.
SOLUTION
The flow-chart is given in Fig 12.3 and the assembly language program is given below.
Start
Initialize
registers
Input byte
from port
NO
Is
Byte
Positive?
YES
Store byte
Store byte
Increment
Increment address
address
Decrement
counter
NO Is
counter
= 0?
YES
End
Fig 12.3
- 174 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
BEGIN: LXI H, 500 ; move 500 H-L pair, which will be used as a counter
LXI B, 2A00H
LXI D, 3A00H ; move 3A00H to D-E pair
LOOP: IN 0AH ; Input byte from port OAH
ORA A ; Check its sign
JP PLUS ; If possible go to plus
STAX D ; store the contents of A at address specified by DE pair
INX D ; increment D-E pair by one
JMP CHECK ; Jump to CHECK
PLUS: STAX B ; Store the contents of A at address specified by BC pair
INX B ; Increment B-C pair by one
CHECK: DCX H ; Decrement H-L pair by 1
MOV A, H ; move contents of H to A
ORA L ; OR the contents with contents of L
JNZ LOOP ; If not Zero, jump to LOOP
END ; END of mainline
23. Write a subroutine to shift left the contents of H-L pair by 1 bit as shown in figure below. Write
ALP using this subroutine to multiply an 8-bit number by 16. Assume 8085 µP.
CY H L 0
SOLUTION
- 175 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
24 Write an ALP for 8085 µP to find the series SUM (SUM = 1+ 2 + 3 +…+ 10 ).Using;
(a) INR instruction and no DCR instruction and (b) DCR instruction and no INR
instruction.
SOLUTION
25. Memory assemble the program of 24 (a) starting from memory location 2000H store in RAM
of 8085 µP kit and execute. Verify the validity of the program.
SOLUTION
Refer Appendix D.2 for the codes of various instructions. The program is hand assembled and
the codes are shown in table 12.4. The last code is for RST 1 which is used to transfer control
to the monitor. These codes are stored in the memory and the program is executed starting
- 176 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
from the memory location 2001H. The contents of memory location 2000H after execution of
the program = 37H = 5510
Table 12.4
2000 -
2001 06
2002 01
2003 0E
2004 00
2005 79
2006 80
2007 04
2008 4F
2009 78
200A FE
200B 0B
200C C2
200D 05
200E 20
200F 79
2010 32
2011 00
2012 20
2013 CF
26. Execute the program of 25 in single step mode and observe the contents of PC registers A,B,C
and the flags after the execution of each instruction. Verify the effect of each instruction on
PC, A,B,C, and the flags. Find the contents of memory location 2000H at the end of the
execution of the program.
- 177 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
SOLUTION
The program is executed in single-step mode starting at address 2001H. The contents of PC,
A, B, C, flag (F) are examined after every step and are given in Table 12.5 in hexadecimal
format.
Table 12.5
Flags
PC A B C F S Z AC P CY 2000 - - -
2003 00 01 00 undefined .
2005 00 01 00 undefined no change .
2006 00 01 00 undefined no change .
2007 01 01 00 00 0 0 0 0 0
2008 01 02 00 00 0 0 0 0 0
2009 01 02 01 00 0 0 0 0 0
200A 02 02 01 00 0 0 0 0 0
200C 02 02 01 A1 1 0 0 0 1
2005 02 02 01 A1 1 0 0 0 1
2006 01 02 01 A1 1 0 0 0 1
2007 03 02 01 04 0 0 0 1 0
2008 03 03 01 04 0 0 0 1 0
2009 03 03 03 04 0 0 0 1 0
200A 03 03 03 04 0 0 0 1 0
200C 03 03 03 A1 1 0 0 0 1
2005 03 03 03 A1 1 0 0 0 1
2006 03 03 03 A1 1 0 0 0 1
2007 06 03 03 04 0 0 0 1 0
2008 06 04 03 00 0 0 0 0 0
2009 06 04 06 00 0 0 0 0 0
200A 04 04 06 00 0 0 0 0 0
200C 04 04 06 A5 1 0 0 1 1
2005 04 04 06 A5 1 0 0 1 1
2006 06 04 06 A5 1 0 0 1 1
2007 0A 04 06 04 0 0 0 1 0
2008 0A 05 06 04 0 0 0 1 0
2009 0A 05 0A 04 0 0 0 1 0
200A 05 05 0A 04 0 0 0 1 0
200C 05 05 0A 05 1 0 0 1 1
2005 05 05 0A 05 1 0 0 1 1
2006 0A 05 0A A5 1 0 0 1 1
2007 0F 05 0A 04 0 0 0 1 0
2008 0F 06 0A 04 0 0 0 1 0
2009 0F 06 0F 04 0 0 0 1 0
200A 06 06 0F 04 0 0 0 1 0
200C 06 06 0F A1 1 0 0 0 1
- 178 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
2005 06 06 0F A1 1 0 0 0 1
2006 0F 06 0F A1 1 0 0 0 1
2007 15 06 0F 10 0 0 1 0 0
2008 15 07 0F 00 0 0 0 0 0
2009 15 07 15 00 0 0 0 0 0
200A 07 07 15 00 0 0 0 0 0
200C 07 07 15 A5 1 0 0 1 1
2005 07 07 15 A5 1 0 0 1 1
2006 15 07 15 A5 1 0 0 1 1
2007 1C 07 15 00 0 0 0 0 1
2008 1C 08 15 00 0 0 0 0 0
2009 1C 08 1C 00 0 0 0 0 0
200A 08 08 1C 00 0 0 0 0 0
200C 08 08 1C A1 1 0 0 0 1
2005 08 08 1C A1 1 0 0 0 1
2006 1C 08 1C A1 1 0 0 0 1
2007 24 08 1C 14 0 0 1 1 0
2008 24 09 1C 04 0 0 0 1 0
2009 24 09 24 04 0 0 0 1 0
200A 09 09 24 04 0 0 0 1 0
200C 09 09 24 A1 1 0 0 0 1
2005 09 09 24 A1 1 0 0 0 1
2006 24 09 24 A1 1 0 0 0 1
2007 2D 09 24 04 0 0 0 1 0
2008 2D 0A 24 04 0 0 0 1 0
2009 2D 0A 2D 04 0 0 0 1 0
200A 0A 0A 2D 04 0 0 0 1 0
200C 0A 0A 2D A5 1 0 0 1 1
2005 0A 0A 2D A5 1 0 0 1 1
2006 2D 0A 2D A5 1 0 0 1 1
2007 37 0A 2D 10 0 0 1 0 0
2008 37 0B 2D 00 0 0 0 0 0
2009 37 0B 37 00 0 0 0 0 0
200A 0B 0B 37 00 0 0 0 0 0
200C 0B 0B 37 54 0 1 1 1 0
200F 0B 0B 37 54 0 1 1 1 0
2010 37 0B 37 54 0 1 1 1 0
2013 37 0B 37 54 0 1 1 1 0
- 179 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
27. Write an assembly location in the accumulator. Assume that the result doesn‟t exceed 8-bit (in 2‟s
complement format).
SOLUTION
28. Hand assemble the subroutine of 27 starting from memory location 2000H.
Assume X=FOH and Y=08H
SOLUTION
- 180 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Table 12.6
29. Assemble the following program starting from memory location 203FH. Set SP = 20FFH
CALL MULT8
RST 1
Use an 8085 kit and store the MULT8 subroutine of Q28 and the above program and execute the
program. Examine the contents of register A and verify that this gives the product of X and Y.
- 181 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
SOLUTION
The subroutine and the program are loaded in RAM and program executed.
30. Given 2 positive 8 bit values X and Y, write an assembly language subroutine for 8085 µP, which
divides X by Y leaving the quotient in A and remainder in B. In case Y is Zero, FFH is left in A and
B registers.
SOLUTION
31. An 8085 µP based system has the program stored in memory as given in table 12.7. Write this program
in the assembly language.
- 182 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Table 12.7
0000 0E
0001 FF
0002 21
0003 41
0004 00
0005 46
0006 11
0007 51
0008 00
0009 23
000A 13
000B 1A
000C BE
000D CA
000E 16
000F 00
0010 05
0011 C2
0012 09
0013 00
0014 05
0015 00
0016 79
0017 32
0018 40
0019 00
001A 76
SOLUTION
The first code i.e. the contents of the memory location 0000H must be an op-code. Identified to be the
op-code for the instruction MVI C data (Refer to instruction set). Therefore, the next byte is the data
byte. In this way we go on identifying the codes and write the instructions. The complete program is
given below:
MVI C, 0FFH
LXI H, 0041H
MOV B, M
LXI D, 0051H
LOOP: INX H
INX D
- 183 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
LDAX D
CMP M
JZ OVER
DCR B
JNZ LOOP
MVI C, 00H
MOV A, C
STA 0040C
HLT
Supplementary questions
32. Find the address bus width for the µPs, which can address the following memory locations.
(a) 1 K bytes
(b) 64 K bytes
(c) 1 M bytes
(d) 8 Mbytes
(a) 8085
(b) 8086
(c) 6502
(d) 6800
(e) Z80
(f) 68000
(g) Z8000
34. It is desired to use 16 K bytes of EPROM and 48 K bytes of [Link] available EPROM‟s are
27256 (32 K x 8) and DRAM‟s are 2186A (8192 x 8). Find the number of chips required for RAM
and EPROMs.
- 184 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Ans. The term microprocessor came into existence in 1971 when the Intel Corporation of
America developed the first microprocessor (INTEL 4004), which is a 4-bit
microprocessor (µP).
Ans. It specifies the number of bits of data that is processed by the µP as a unit. For example,
an 8-bit µP performs various operation on 8-bit data. It also specifies the width of the
bus.
Ans. It is used to transfer the information (instruction or data) between the µP and the memory,
between the µP and the I/O devices.
- 185 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Ans. It unidirectional. The address information is always given by the µP to address a memory
or I/O device
Ans. It is bi-directional since the same bus is used for transfer of data between µP and the
memory or I/O device in both the same direction.
Ans. A bus used only for one specific purpose is known as a dedicated bus. For example
the address bus in some microprocessors is used to transmit only the address in some
microprocessors is only used to transmit only the address information where as in
some other microprocessors a bus is used to transmit address information as well as
for transfer of data the first one is a dedicated bus.
R12.14. Why multiplexing of buses i.e. using a bus for more than one function is preferred in µPs
Ans. The communication protocol between the µP and the I/O devices in which an I/O device
makes a request and then waits for the response from the µP is known as handshaking.
P12.16. How are the I/O devices interfaced with the µPs?
Ans. The I/O devices are interfaced with the µPs though the ports.
Ans. It stands for input and output devices. There are many situations in which a device is
used as input device for some functions and as output device for some other function.
Therefore these devices are usually represented by one term i.e. I/O.
Ans. It is always with reference to the µP for example if a keyboard is used for entering data
/instruction it is an input device.
- 186 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Ans. The set of instructions to perform the desired operation is known as a program.
P12.20 . What is the language in which instructions are given to any computer or µP based system?
Ans. The instructions are coded in binary form and this is the only language that a
computer or µP based system understands. It is known as the machine language.
Ans. This is another way of coding instruction in computers and µP based system.
In this names are assigned to instructions, registers, data and memory locations.
These names are usually the abbreviations of the name or descriptions of the
instruction (mnemonics), addresses, or data and are used to aid the designers memory.
Ans. It is a program which translate the assembly language program into an equivalent
machine language program.
P12.23. How does a µP differentiates between the instruction code and data/address?
Ans. It executes instructions step by step and depending upon the time at which a digital
information is received by a µP it will automatically interpret it as instruction code, data
or address.
Ans. For ease of programming, a program can be written in statements form called higher
level language, such as, FORTRAN, BASIC, PASCAL, etc.
Ans. Is it a program that translate programs from higher level language into machine
Language. It translates the whole program first before it is executed.
Ans. The electronic components and circuit which makes a computer or a µP based system
is known as hardware whereas the programs are called software.
- 187 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Ans. There are two basic operations (i) Fetch an instruction from memory and (ii) Execute
the instruction.
Ans. After the fetching of an instruction is completed, the µP performs the operation that is
specified by the instruction. This operation is known as the execute operation.
Ans. It performs arithmetic operations such as, addition , subtraction , etc, and logical
operation such as, AND, OR, EX-OR, etc. it is in fact the heart of the µP.
Ans. These are general purpose register in the µP used to store temporary address/data.
R12.33. How many general purpose registers are there in 8085 µP?
R12.34. Is there any special registration of H and L registers in 8085 µP? Explain
Ans. Registers H and L is used as a pair to store 16-bit address of a memory location. The
register H and L is meant for higher and lower bytes respectively.
Ans. It is binary µP counter which holds the address of either the first byte of the next
instruction to be fetched for execution or the address of the next byte of a multi-byte of
instruction which has not yet been completely fetched in either case it gets
automatically increment one by one as the instruction bytes gets fetched.
R12.36. What is the content of the program counter (PC) of an 8085 µP after its reset?
R12.37. How can a user have access to the general-purpose registers of the µP?
Ans. These are not accessible physically and can be accessed only through instruction.
Ans. Stack is a portion of RAM used for saving the contents of PC and general purpose
registers etc whenever required.
Ans. Since it is not possible to write into the ROM, therefore it cannot be used as stack
Ans. It is a special purpose register in the µP, which holds the address of the ‘Top’ of the
stack.
R12.41. What are the instructions meant to store in and retrieve from the stack in 8085 µP based
system?
Ans. PUSH instruction pushes the contents of the specified registers on to the stack and the
POP instruction retrieves the contents of the stack.
R12.42. Does the stack pointer get increment or decrement after PUSH instruction is executed in
8085 µP?
Ans. It gets decremented i.e. the stack grows in the downward direction.
Ans. Flags are single-bits of a register in µP used to store certain conditions which arise as
a result of execution of certain instructions.
Ans. If the result of arithmetic or a logical operation is zero, it is set (i.e. Z=1) otherwise it
is a reset (i.e. Z=0).
- 189 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Ans. Carry (CY,) Zero (Z,) Sign (S), Parity (P) and Auxiliary carry (AC).
Ans. Different I/O may be required to interrupt the µP. In such situation a priority is defined
for each of the interrupting devices i.e. which device will be attended to first in case
they both interrupt the µP at the same time.
Ans. These are known as TRAP, RST 7.5, RST 6.5, RST 5.5, and INTR. TRAP is the highest
priority interrupt and INTR is the lowest priority interrupt.
Ans. An interrupt, which can never masked, i.e. disable is known as non-maskable interrupt.
For example TRAP in 8085and NMI in 6800 are non-maskable interrupts.
Ans. It means direct memory access. For normal operation there is no direct transfer of data
between the I/O devices and memory. All data transfer takes place through the µP. This
is very time consuming process in case a large quantity of data transfer is required
between the I/O devices and the memory. The DMA operation helps in direct transfer
of data between the I/O devices and the memory.
R12.52. What type of memory will you prefer for program storage while developing a µP based
system and why?
Ans. An erasable programmable type of memory is best suited for this because is nonvolatile
and therefore, is not erased when power is off. At the same time it is possible to modify
the program by erasing and programming again.
R12.53. What type of memory will you prefer for program storage for a µP based system required in
very large numbers?
- 190 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Ans. Mask-programmed ROM will be the best suited for this because of its low cost for high
volume production.
R12.54. What type of memory will be best suited for program storage for a low µP based system?
Ans. PROM will be best suited for this because of its low cost for low volume and there is
no risk of loosing the program even by accident.
R12.55. Specify the type of memory, which you will prefer for permanent data and for temporary
data.
Ans. ROM for permanent data and RAM for temporary data.
Ans. Burning means programming of programmable ROMs. This term has become popular
because of burning of fusible links in PROMs for data storage.
R12.57. Is the meaning of programming same for computers and read only memories? Explain.
Ans. No. programming a computer means preparing a set of instructions to perform a task,
whereas programming a read only memory means entering information init.
Ans. It is the maximum possible memory size, which can be used with a µP.
Ans. It is the maximum possible number of I/O devices, which can be interfaced with a µP?
R12.60. Is it necessary for a µP to have separate address spaces for memory and I/O ? Explain
Ans. No in case separate address spaces are not available, the I/O device are connected as
the memory locations. This arrangement is known as memory mapped I/O.
Ans. When separate address is available for I/O devices, the I/O devices are connected using
this space. This arrangement is known as standard I/O or I/O mapped I/O.
Ans. It has 16-bit address bus for memory addressing and 8-bit address bus for I/O
addressing. The corresponding address spaces are 216 = 64 K byte and 28 = 256 for
memory and I/O devices respectively.
Ans. No. Since no separate address space is available for I/O. Therefore, only memory
mapped I/O is possible.
R12.64. 8085 µP has an 8-bit bus (AD0- AD7) known as address/data bus and another 8-bit bus
(A8 -A15) known as address bus. Explain the function of these buses.
Ans. The AD0 – AD7 bus is used for transfer of data (data bus) for lower order eight bits of
memory address, and for I/O address. The A bus is used on higher order eight bits of
memory address and duplicate the I/O address.
R12.65. In a 8085 µP based system, how do the I/O device and memory know for whom the address is
meant at any time.
Ans. In 8085 µP there is an output pin designated as IO/M. If it is HIGH, the address is meant
for the I/O and if it is LOW the address is meant for the memory.
R12.66. What happens if the memory locations are selected simultaneously for reading by a µP?
Ans. Data from two locations will cause bus contention. It is never allowed.
R12.67. What happens if the memory location and an I/O or two I/O devices are addressed simultaneously
by a µP?
Ans. This will also cause bus contention and is therefore never allowed.
R12.68. What can be the possible number of distinct op codes in a µP if eight bits are used for op code?
Ans. The maximum possible number of distinct op codes will be 28 = 256 for an 8-bit op code.
R12.69. What is the semiconductor technology used for the fabrication of 8085 µP?
R12.70. How many transistors are there in 8085 µP and what is the size of the chip?
Ans. 8085 µP consist of approximately 6,200 transistors (MOS) on a 164x222 mil chip
container in a 40-pin DIP
R12.71. What is the international clock frequency of 8085µP if a crystal of 6.25 MHz is used?
- 192 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
Ans. It is the time required for fetching one byte of instruction or for reading from or writing
into one memory location.
Ans. It is the time required for fetching and executing one instruction.
Ans. Usually the I/O device, which are usually electromechanical device, are slower in speed
than µP and so they require the µP to wait till they are ready for data transfer. For
these purpose the µP has to generate wait states.
R12.75. What are the various schemes used for data transfer between µP and I/O devices?
- 193 -
COMPILED BY: I. E LIABAYA COMMUNICATION & NAVIGATION (AVIONICS) DEPARTMENT.
3 DATA REGISTER
The data register contains the actual data being outputted or inputed from the processor a data register
serves a role similar to that of an accumulator in that it may be used in arithmetic/logic input /output
and load /store operation.
- 194 -