Professional Documents
Culture Documents
and Interfacing
8086, 8051, 8096, and advanced processors
N. Senthil Kumar
Professor
s
Department of Electrical and Electronics Engineering
s
Mepco Schlenk Engineering College
re
Sivakasi, Tamil Nadu
M. Saravanan yP
sit
Professor
Department of Electrical and Electronics Engineering
er
S. Jeevananthan
Professor
d
S.K. Shah
O
© Oxford University Press. All rights reserved.
3
Oxford University Press is a department of the University of Oxford.
It furthers the University’s objective of excellence in research, scholarship,
and education by publishing worldwide. Oxford is a registered trade mark of
Oxford University Press in the UK and in certain other countries.
Published in India by
Oxford University Press
YMCA Library Building, 1 Jai Singh Road, New Delhi 110001, India
s
by law, by licence, or under terms agreed with the appropriate reprographics
s
rights organization. Enquiries concerning reproduction outside the scope of the
re
above should be sent to the Rights Department, Oxford University Press, at the
address above.
yP
You must not circulate this work in any other form
and you must impose this same condition on any acquirer.
sit
ISBN-13: 978-0-19-807906-4
er
ISBN-10: 0-19-807906-0
iv
Brief Contents
Features of the Book iv
Preface vii
1. Microprocessors—Evolution and Introduction to 8085 1
2. Methods of Data Transfer and Serial Transfer Protocols 47
s s
5. 8086 Interrupts 175
re
6. Memory and I/O Interfacing 210
yP
7. Features and Interfacing of Programmable Devices for
sit
8086-based Systems 240
0XOWLSURFHVVRU&RQ¿JXUDWLRQ
er
s s
re
yP
sit
er
iv
Un
d
or
xf
O
Detailed Contents
Features of the Book iv
Preface vii
Brief Contents xi
1. Microprocessors—Evolution and Introduction to 8085 1
1.1 Introduction 1
1.2 Explanation of Basic Terms 2
1.3 Microprocessors and Microcontrollers 5
1.4 Microprocessor-based System 6
1.5 Origin of Microprocessors 7
1.5.1 First generation (1971–1973) 8
s
1.5.2 Second generation (1974–1978) 8
s
1.5.3 Third generation (1978–1980) 8
re
1.5.4 Fourth generation (1981–1995) 8
yP
1.5.5 Fifth generation (1995–till date)
1.5.6 Timeline of microprocessor evolution
9
9
sit
&ODVVL¿FDWLRQRI0LFURSURFHVVRUV
1.7 Types of Memory 11
er
Computers 14
1.10 Introduction to 8085 Processor 14
1.11 Architecture of 8085 16
d
s s
re
PART I: INTEL 8086—16-BIT MICROPROCESSORS
3.1 Introduction yP
3. Intel 8086 Microprocessor Architecture, Features, and Signals 63
63
sit
3.2 Architecture of 8086 63
er
s
4.7.1 CALL instruction 165
s
re
4.7.2 RET instruction 166
4.7.3 Macro 167
4.7.4 Illustrative example
5. 8086 Interrupts
yP 168
175
sit
5.1 Introduction 175
er
s
6.6.2 Assigning 8-bit address to 8-bit input device using
s
address decoder IC 74LS138 222
re
6.6.3 Assigning 16-bit address to 8-bit DIP switch using
yP
address decoder having only logic gates 224
6.7 Interfacing 8-bit Output Device with 8086 224
sit
6.8 Interfacing Printer with 8086 225
6.9 Interfacing 8-bit and 16-bit I/O Devices or Ports with 8086 229
er
s
7.12.3 Initialization of 8259 320
s
re
7.12.4 Operation of 8259 324
7.12.5 Interfacing of 8259 to 8086 325
7.13 8237 DMA Controller
yP
7.13.1 Features, pin details, and architecture of 8237
326
327
sit
7.13.2 DMA initialization and operation 333
7.13.3 Operation of 8237 with 8086 335
er
&RSURFHVVRUDQGFORVHO\FRXSOHGFRQ¿JXUDWLRQV
or
/RRVHO\FRXSOHGFRQ¿JXUDWLRQ
8.4 Bus Arbitration in Loosely-coupled Multiprocessor System 346
xf
s
378
s
9.4.1 Timing diagrams for general bus operation in minimum mode 378
re
9.4.2 Timing diagrams for general bus operation in maximum mode 382
yP
9.4.3 Interrupt acknowledgement (INTA) timing 383
9.4.4 Bus request and bus grant timing 384
sit
9.5 Design of Minimum Mode 8086-based System 385
er
s
12.4 8051 Timers 437
s
12.4.1 Timer SFRs 437
re
12.4.2 Timer operating modes 439
yP
12.4.3 Timer control and operation 442
12.4.4 Using timers as counters 443
sit
12.4.5 Programming examples 443
12.5 8051 Interrupts 445
er
s
14.3.4 Temporary register 521
s
5HJLVWHU¿OH
re
14.3.6 Program status word 523
14.3.7 Memory controller
14.3.8 Internal timing yP 523
523
sit
14.3.9 I/O section 524
14.4 Memory Structure 525
er
s
16.4.7 Global disable 561
s
re
16.4.8 Program status word 561
16.5 Serial Ports 562
16.5.1 Operating modes of serial port
yP
16.5.2 Serial port control/status registers
563
564
sit
16.5.3 Determining baud rate 564
16.5.4 Program for serial port data reception 565
er
s
18.4.1 Architecture of 80386 618
s
re
18.4.2 Register organization in 80386 620
18.4.3 Instruction set of 80386 623
yP
18.4.4 Addressing memory in protected mode
18.4.5 Physical memory organization in 80386
624
625
sit
18.4.6 Paging mechanism in 80386 626
18.5 80486 Microprocessor 629
er
s
19.4.6 Instruction set in SPARC microprocessor 714
s
re
19.4.7 Load and store instructions 715
19.4.8 Arithmetic and logical instructions 716
19.4.9 Branch instructions
19.4.10 Special instructions yP 717
718
sit
19.5 Software Embedded into System 721
19.5.1 Codesign 722
er
s s
re
yP
sit
er
iv
Un
d
or
xf
O
s
&RPPRQLQSXWDQGRXWSXWGHYLFHVIRUFRPSXWHUV
s
re
%XVVWUXFWXUHVXVHGLQFRPSXWHUVDQGWHFKQRORJ\LPSURYHPHQWV
PLFURSURFHVVRUDUFKLWHFWXUHDQGLQVWUXFWLRQVHW
yP
sit
1.1 INTRODUCTION
er
mobile phones, fax machines, and photocopiers and in advanced applications such
or
DV UDGDUV VDWHOOLWHV DQG ÀLJKWV$Q\ PLGGOHFODVV KRXVHKROG ZLOO KDYH DERXW D
xf
have led to rapid cost reduction and increased application of microprocessors and
their derivatives.
Typically, basic microprocessor chips have arithmetic and logic functional units
DORQJZLWKWKHDVVRFLDWHGFRQWUROORJLFWRSURFHVVWKHLQVWUXFWLRQH[HFXWLRQ$OPRVW
all microprocessors use the basic concept of stored-program execution. Programs
or instructions to be executed by the microprocessor are stored sequentially in
memory locations. The microprocessor, or the processor in general, fetches the
instructions one after another and executes them in its arithmetic and logic unit. So
all microprocessors have a built-in memory access and management part as well
as some amount of memory.
$PLFURSURFHVVRUFDQEHSURJUDPPHGWRSHUIRUPDQ\WDVNWKDWFDQEHZULWWHQ
and programmed by the user. Without a program, the microprocessor unit is a
SLHFH RI XVHOHVV HOHFWURQLF FLUFXLW 7KH SURJUDPPHU PXVW WDNH FDUH RI DOO WKH
UHVRXUFHV RI WKH PLFURSURFHVVRU DQG XVH WKHP HI¿FLHQWO\ IRU LPSOHPHQWLQJ WKH
UHTXLUHGIXQFWLRQDOLW\6RWRZRUNZLWKWKHPLFURSURFHVVRULWLVQHFHVVDU\IRUWKH
SURJUDPPHUWRNQRZDERXWLWVLQWHUQDOUHVRXUFHVDQGIHDWXUHV7KHSURJUDPPHU
s
will need a set of memory units and interfacing circuits for inputs and outputs.
s
re
7KHFLUFXLWVWRJHWKHUZLWKWKHPLFURSURFHVVRUPDNHWKHmicrocomputer system.
The physical components of the microcomputer system are called hardware. The
yP
SURJUDPWKDWPDNHVWKLVKDUGZDUHXVHIXOLVFDOOHGsoftware.
The semiconductor manufacturing technology for chips has developed from
sit
transistor–transistor logic (TTL) to complementary metal-oxide-semiconductor
er
integrated circuits; CMOS is favoured for portable computers and other battery-
powered devices because of its low power consumption.
d
or
The terms relevant to the use of microprocessors are explained in this section. These
O
s
means that the contents of the memory are erased when the power to the chip is
s
re
disrupted. The access of the individual memory location can be done randomly. In
PLFURSURFHVVRUVWKH5$0LVXVHGWRVWRUHGDWD
yP
DRAM Dynamic random access memory is a semiconductor memory in which
sit
the stored contents need to be refreshed repeatedly at about thousands of times per
second. Without refreshing, the stored data will be lost. These memory chips are
er
SRZHULVDYDLODEOH7KHUHLVQRQHHGIRUUHIUHVKLQJ,QWHUPVRIVSHHG65$0LV
faster.
d
ROM Read only memory devices are memory devices whose contents are
or
to perform arithmetic and logic operations on digital data. The typical operations
SHUIRUPHGE\ WKH$/8 DUHDGGLWLRQVXEWUDFWLRQORJLFDO$1' ORJLFDO25 DQG
FRPSDULVRQRIELQDU\GDWD*HQHUDOO\WKHIXQFWLRQVRIWKH$/8RIDPLFURSURFHVVRU
will decide the processor’s functionality.
Microcontroller $ PLFURFRQWUROOHU LV D FKLS WKDW LQFOXGHV PLFURSURFHVVRU
memory, and input/output signal ports. Microcontrollers can be called single-chip
microcomputers.
Microcomputer The system formed by interfacing the microprocessor
with the memory and I/O devices to execute the required programs is called
microcomputer.
Bus $EXVLV a group of wires/lines that carry similar information.
System bus The system bus is a group of wires/lines used for communication
between the microprocessor and peripherals.
s
Computer architecture 7KH GHVLJQ LQWHUQDO FRQ¿JXUDWLRQ DQG DFFHVVHV LQ D
s
re
digital computer are together called computer architecture.
yP
Von–Neumann architecture The architecture in which the same memory is
used for storing programs as well as data.
sit
Harvard architecture The architecture in which programs and data are stored
er
that supports limited machine language instructions. RISC processors are expected
or
EH H[HFXWHG %$6,& )RUWUDQ & 3DVFDO DQG -DYD DUH H[DPSOHV RI KLJKOHYHO
languages.
Assembly language $ SURJUDPPLQJ ODQJXDJH ZULWWHQ XVLQJ WKH PQHPRQLFV
or the instruction set of a particular microprocessor is called assembly language.
$VVHPEO\ ODQJXDJH SURJUDPPLQJ LV PLFURSURFHVVRUVSHFL¿F ,W LV QRW DV HDVLO\
understood as a high-level language program, but is easier than a machine language
program.
Machine language Machine language refers to binary code programs that are
VSHFL¿FWRWKHSURFHVVRUDQGFDQEHGLUHFWO\H[HFXWHGE\WKHSURFHVVRU0DFKLQH
language is the lowest level language and cannot be easily understood.
Assembler $FRPSXWHUDSSOLFDWLRQSURJUDPWKDWFRQYHUWVWKHDVVHPEO\ODQJXDJH
program into machine-level language program.
Compiler $FRPSXWHUSURJUDPWKDWFRQYHUWVWKHKLJKOHYHOODQJXDJHSURJUDP
into machine-level language program.
s s
is in the range of megahertz (MHz) or gigahertz (GHz).
re
MIPS Million instructions per second is a measure of the speed at which the
instructions are executed in a processor.
yP
sit
Tri-state logic It is the logic used by digital circuits. The three logic levels used
are high (1), low (0), and high impedance state (Z). The logic high state of a digital
er
FLUFXLWFDQVRXUFHFXUUHQWDQGWKHORJLFORZFDQVLQNFXUUHQWLQDFRPSXWHUV\VWHP
iv
EXWWKHKLJKLPSHGDQFHVWDWHQHLWKHUVRXUFHVQRUVLQNVFXUUHQWDQGVRWKHRWKHU
Un
resources and enables users to access the computer and its resources is called
or
operating system. It is required for any computer system to become operational and
xf
user friendly. Under the control of the operating system, the computer recognizes
and obeys commands typed by the user. In addition, the operating system provides
O
built-in routines that allow the user’s program to perform input/output operations
ZLWKRXWVSHFLI\LQJWKHH[DFWKDUGZDUHFRQ¿JXUDWLRQRIWKHFRPSXWHU,QORZOHYHO
microprocessor-based systems, the program that controls the hardware is called
monitor routine or monitor software.
s
<RX ZLOO EH DPD]HG WR NQRZ WKDW RXW RI SURFHVVRU FKLSV PDQXIDFWXUHG
s
re
DUHHPEHGGHGSURFHVVRUVRQO\RQHJRHVLQWRDJHQHUDOFRPSXWHU$SOHWKRUDRI
VHPLFRQGXFWRUFRPSDQLHVDUHLQWKHPLFURFRQWUROOHUPDUNHWDQGDQ\DSSOLFDWLRQ
yP
GHYHORSPHQW HQJLQHHU LV ÀRRGHG ZLWK D YDULHW\ RI PLFURFRQWUROOHUV WR FKRRVH
IURP7KLVERRNGLVFXVVHV,QWHO¶VELWVHULHVDQGELWVHULHVDVDOVR
sit
other advanced microcontrollers.
er
Data bus
Control bus
$GGUHVVEXV
)LJXUHVKRZVDW\SLFDOSHUVRQDOFRPSXWHUV\VWHP7KHLQWHUIDFLQJRIWKH
processor with the other parts of the microcomputer system needs a three-bus
architecture. The three buses are data bus, address bus, and control bus.
(DFKPHPRU\ORFDWLRQRU,2SRUWLVLGHQWL¿HGE\DVSHFL¿FDGGUHVVVLPLODU
to a postal address. In microprocessor systems, the addresses are all in binary,
and in general, represented in hexadecimal number format. The address is a
s s
$IWHUVHOHFWLQJWKHORFDWLRQWKHGDWDWUDQVIHUEHWZHHQWKHPHPRU\DQGSURFHVVRU
re
or between the I/O device and the processor is done through the data bus. The
yP
ZLGWKRIWKHGDWDEXVGHWHUPLQHVWKHGDWDVL]HWKDWFDQEHWUDQVIHUUHG$QELW
SURFHVVRUZLOOJHQHUDOO\KDYHDQELWGDWDEXVDQGDELWSURFHVVRUZLOOKDYH
sit
D ELW GDWD EXV 7KH PHPRU\ ORFDWLRQV LQ PLFURSURFHVVRUV DUH DFFHVVHG DV
ELWRURQHE\WHXQLWVRQO\6RWKHWUDQVIHURIDELWGDWDIURPPHPRU\QHHGVWZR
er
PHPRU\DGGUHVVHV$.%PHPRU\FKLSZLOOKDYHE\WHVRIPHPRU\ORFDWLRQV
iv
$ FRQWURO EXVLV QHHGHG IRU SURSHU GDWD WUDQVIHU EHWZHHQ WKH SURFHVVRU DQG
Un
the peripherals. The control bus basically consists of signals for selection of the
correct memory or I/O device from the address, indication of the direction of data
d
transfer, and synchronization of data transfer between slow devices. Many of the
or
control signals are given by the processor itself because the processor is the master
of the computer system. Some control signals such as selection of the correct
xf
memory chip can be generated externally by the logic circuits. The timing of the
O
control signal is very important; the entire timing of the operation is controlled by
WKHPLFURSURFHVVRULQV\QFKURQL]DWLRQZLWKWKHFORFNVLJQDOLQSXW
s s
$VWKHWHFKQRORJ\HYROYHGWKHQXPEHURIFLUFXLWVWKDWFRXOGEHIDEULFDWHGRQD
re
chip grew. Very large-scale integration (VLSI) led to chips that had speeds up to
yP
KXQGUHGVRIPLOOLRQVRIVZLWFKLQJVSHUVHFRQG7KHVHFRQGJHQHUDWLRQPDUNHGWKH
EHJLQQLQJRIYHU\HI¿FLHQWELWPLFURSURFHVVRUV6RPHRIWKHSRSXODUSURFHVVRUV
sit
ZHUH 0RWRUROD¶V DQG ,QWHO¶V DQG =LORJ¶V = 7KH VHFRQG
JHQHUDWLRQGHYLFHVPDUNHGDVKDUSFRQWUDVWZLWKWKHXVHRIQHZHUVHPLFRQGXFWRU
er
DQG KLJKHU GHQVLW\ WKDQ 3026 ,W UHVXOWHG LQ D ¿YHIROG LQFUHDVH LQ LQVWUXFWLRQ
execution speed and higher chip densities.
d
7KH WKLUG JHQHUDWLRQ LQWURGXFHG LQ ZDV GRPLQDWHG E\ ,QWHO¶V DQG
xf
=LORJ¶V=ZKLFKZHUHELWSURFHVVRUVZLWKPLQLFRPSXWHUOLNHSHUIRUPDQFH
O
7KHVHSURFHVVRUVKDGWKHWHFKQRORJ\RIELWDULWKPHWLFDQGSLSHOLQHGLQVWUXFWLRQ
SURFHVVLQJ7KHWKLUGJHQHUDWLRQFDPHZLWK,&WUDQVLVWRUFRXQWVRIDERXW
,Q0RWRUROD¶V0&IRUH[DPSOHDQRQFKLSFDFKHZDVLQFRUSRUDWHGIRUWKH
¿UVW WLPH DQG WKH GHSWK RI WKH SLSHOLQH ZDV LQFUHDVHG WR ¿YH RU PRUH VWDJHV ,W
was designed using high density metal-oxide-semiconductor (HMOS) technology.
+026SURYLGHVVRPHDGYDQWDJHVRYHU1026,WVVSHHG±SRZHUSURGXFWLVIRXU
WLPHVEHWWHUWKDQWKDWRI1026LWFDQDFFRPPRGDWHWZLFHWKHFLUFXLWGHQVLW\RI
1026
s
0+]
s
0+]
re
0+]
yP
0+]
0+]
sit
0+]
0+]
er
s
PHWKRG NQRZQ DV VXSHUVFDODU DUFKLWHFWXUH DQG FXUUHQWO\ RSHUDWHV ZLWK
s
re
IUHTXHQFLHV XS WR *+] VWDJH SLSHOLQH DQG WKUHHOHYHO FDFKH
yP
memory architectures.
[ ²,QWHO3HQWLXP,,SURFHVVRUZDVGHVLJQHGVSHFL¿FDOO\WRSURFHVVYLGHR
sit
00;DXGLRDQGJUDSKLFVGDWDHI¿FLHQWO\ZLWKVSHHGVRI0+]0+]
0+]DQG0+]
er
[LL ²,QWHO3HQWLXPSURFHVVRU
Un
$0'7RVKLEDDQG7H[DV,QVWUXPHQWVDOVRPDQXIDFWXUHSURFHVVRUFKLSV7KHVH
or
companies have their own chips and architectures in addition to the regular Intel-
based architectures.
xf
O
s
processors. Very long instruction word (VLIW) processors have instructions
s
composed of many machine operations. These instructions can be executed in
re
parallel. This parallel execution is called instruction-level parallelism. VLIW
yP
processors also have a large number of registers. Superscalar processors use
complex hardware to achieve parallelism. It is possible to have overlapping of
sit
instruction execution to increase the speed of execution.
er
Memory unit is an integral part of any microcomputer system. Its primary purpose is
Un
to hold program and data. The main objective of the memory unit design is to enable
LWWRRSHUDWHDWDVSHHGFORVHWRWKDWRIWKHSURFHVVRU$OWKRXJKWHFKQRORJ\LVDYDLODEOH
d
WRGHVLJQVXFKDKLJKVSHHGPHPRU\FRVWLVWKHPDMRUOLPLWLQJIDFWRU7RVWULNHD
or
balance between cost and operating speed, a memory system is usually designed
xf
using different materials such as solid state, magnetic, and optical materials.
$PLFURFRPSXWHUPHPRU\FDQEHORJLFDOO\GLYLGHGLQWRIRXUJURXSV
O
s s
re
yP
Primary memory
sit
er
6HPLFRQGXFWRU5$0 ROM
iv
Un
5$0GHYLFHVDOORZERWKUHDGLQJDQGZULWLQJWRWKHLUPHPRU\FHOOV,QVWDWLF
5$0GHYLFHVELWVDUHVWRUHGDVWKHVWDWXVRIRQRIIVZLWFKHV7KHUHDUHQRFKDUJHV
LQYROYHGDQGKHQFHQRFKDUJHVWROHDN+RZHYHUVWDWLF5$0GHYLFHVKDYHFRPSOH[
construction and hence larger size per unit storage. So they are more expensive.
6WDWLF5$0VDUHFRPSDUDWLYHO\IDVWHUDQGDUHXVHGLQFDFKHPHPRULHV
,QG\QDPLF5$0GHYLFHVWKHGDWDELWVDUHVWRUHGDVFKDUJHLQFDSDFLWRUV6LQFH
FDSDFLWRUFKDUJHKDVDWHQGHQF\WROHDNWKHVHGHYLFHVQHHGUHIUHVKLQJHYHQZKHQ
they are powered. However, they have simpler construction and smaller size per
unit storage. These devices are less expensive and comparatively slower.
$VWKHQDPHLPSOLHVD520SHUPLWVRQO\UHDGDFFHVV7KHUHDUHPDQ\NLQGV
RI520V
L 0DVNSURJUDPPDEOH520V03520VDUHFXVWRPPDGHIRUWKHFXVWRPHU
their contents are programmed by the manufacturer. Since they are mass
produced, they are inexpensive. The customer cannot erase or program it
afterwards.
s
UHTXLUHVEXONHUDVXUHRIDODUJHSRUWLRQRIWKHPHPRU\DUUD\
s
re
1.8 INPUT AND OUTPUT DEVICES
yP
,QSXWDQGRXW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7KH&38FRQWDLQVVHYHUDOUHJLVWHUVDQDULWKPHWLFDQGORJLFXQLW$/8
er
iv
Memory
Un
(ROM)
Read only memory
d
or
xf
5$0
O
Processor
Control unit
Input Output
unit unit
$/8
s
(iii) Special-purpose registers (iv) Instruction register and decoder
s
(v) Timing and control unit
re
1.11.1 Arithmetic and Logic Unit
yP
$/8 LV WKH FLUFXLWU\ WKDW SHUIRUPV WKH DFWXDO QXPHULFDO DQG ORJLFDO RSHUDWLRQV
sit
$GGLWLRQ $'' VXEWUDFWLRQ 68% LQFUHPHQW ,15 GHFUHPHQW '&5
DQG FRPSDULVRQ &03 DUH WKH DULWKPHWLF RSHUDWLRQV SRVVLEOH LQ WKH
er
iv
ELWLQWHUQDO
data bus
xf
O
}
)ODJÀLS Temp reg. Temp reg.
ÀRSV % &
Reg. select
s
from it. These general-purpose registers are user accessible through programs.
s
5HJLVWHUV%&'(+DQG/DUHWKHJHQHUDOSXUSRVHUHJLVWHUVLQWKH
re
DVVKRZQLQ)LJ7KH\FDQDOVREHFDOOHGVFUDWFKSDGUHJLVWHUV,QDOPRVWDOO
arithmetic and logical
operations, these registers yP
$FFXPXODWRU$ )ODJUHJLVWHU
sit
are used as the second % &
RSHUDQGVWKH¿UVWRSHUDQG
er
' (
being the accumulator
iv
$ 7KH JHQHUDOSXUSRVH + /
Un
3URJUDPFRXQWHU3&
KDQGOHGDVELWUHJLVWHUV
or
s s
' ' DQG ' RI WKH ÀDJ
re
register remain unassigned; S Z ; $& ; P ; CY
WKH\DUHPDUNHGZLWKDQ;WR
show that they are not used
D7 '
yP' ' D3 ' D1 D0
sit
and are don’t cares. Fig. 1.7 Flag register
$Q\ÀDJUHJLVWHUELWLVVDLGWREHµVHW¶ZKHQLWVYDOXHLVDQGµFOHDUHG¶ZKHQLWV
er
YDOXHLV7KHPRVWFRPPRQO\XVHGÀDJVDUH]HURFDUU\DQGVLJQ$&ÀDJFDQQRW
iv
be accessed externally.
Un
QXPEHUKDVDLQ¶VFRPSOHPHQWUHSUHVHQWDWLRQ7KLVÀDJLQGLFDWHVWKHVLJQRI
or
the number. (It may be recalled that signed magnitude numbers use 1 to indicate
xf
DQHJDWLYHQXPEHUDQGWRLQGLFDWHDSRVLWLYHQXPEHU7KLVÀDJFDQEHXVHGLQ
O
s
VWDFNSRLQWHU63ZKLFKKROGVWKHDGGUHVVRIWKHPHPRU\ORFDWLRQRIWKHWRSRI
s
re
WKH VWDFN7KH SURJUDPPHU FDQ UHVHUYH DQG DOORFDWH D VHULHV RI 5$0 ORFDWLRQV
WR EH XVHG DV D VWDFN DQG DFFRUGLQJO\ LQLWLDOL]H WKH VWDFN SRLQWHU7KH UDQJH RI
yP
VWDFN PHPRU\ ORFDWLRQV PXVW EH FKRVHQ FDUHIXOO\ VR WKDW LW GRHV QRW DIIHFW WKH
SURJUDPVSDFH,QDOOPLFURSURFHVVRUEDVHGV\VWHPVWKHVWDFNLVPDLQO\XVHGWR
sit
store the return address of the main program when a subroutine is called. While
er
WKHSURJUDPPHUXVHVWKHVWDFNIRUVWRUDJHDQGUHWULHYDORIGDWDWKHPLFURSURFHVVRU
XVHVWKHVWDFNGXULQJVXEURXWLQHFDOOV&DUHPXVWEHWDNHQE\WKHSURJUDPPHUWR
iv
HQVXUHWKDWWKHGDWDVWRUHGLQWKHVWDFNLVUHWULHYHGSURSHUO\VRWKDWWKHGDWDVWRUHG
Un
LQWKHVWDFNE\WKHSURFHVVRULVQRWDIIHFWHG
d
,WLVDQELWUHJLVWHUWKDWWHPSRUDULO\VWRUHVWKHLQVWUXFWLRQVGUDZQIURPPHPRU\
xf
locations, before their actual execution. The content of the register is decoded by
the decoder circuitry, where the nature of the operation to be performed is decided
O
(interpreted). In addition, there are two temporary registers W and Z, which are
controlled internally and not available for user access.
s
memory location.
s
7KHDGGUHVVEXVOLQHVDUHJHQHUDOO\LGHQWL¿HGDV$±$7KHDGGUHVVEXVKDV
re
HLJKWKLJKHURUGHUDGGUHVVOLQHV$±$ZKLFKDUHXQLGLUHFWLRQDO7KHORZHU
yP
RUGHUHLJKWOLQHV$±$DUHPXOWLSOH[HGWLPHVKDUHGZLWKWKHHLJKWGDWDELWV
(D0–D7) and hence, they are bidirectional. When the instruction is executed, these
sit
lines carry the address bits during the early part, and the eight data bits during the
later part. To separate the address from the data, a latch is used externally to save
er
The control bus carries control signals that are partly unidirectional and partly
ELGLUHFWLRQDO)RUDPLFURSURFHVVRUWRIXQFWLRQFRUUHFWO\WKHVHFRQWUROVLJQDOVDUH
d
vital. The control bus typically consists of a number of single lines that coordinate
or
DQGFRQWUROPLFURSURFHVVRURSHUDWLRQV)RUH[DPSOHDUHDGZULWHFRQWUROVLJQDO
xf
will indicate whether memory is being written into or read from. Thus, they are
O
individual lines that provide a pulse to indicate the operation of the microprocessor.
,QIDFWWKHPLFURSURFHVVRUJHQHUDWHVVSHFL¿FFRQWUROVLJQDOVIRUHYHU\RSHUDWLRQ
which in turn are used to identify the type of device the processor intends to
communicate with. The following points describe the control and status signals
RIWKHSURFHVVRU
L $/( RXWSXW$GGUHVV /DWFK (QDEOH LV D SXOVH WKDW LV SURYLGHG ZKHQ DQ
DGGUHVV DSSHDUV RQ WKH $'±$' OLQHV DIWHU ZKLFK LW EHFRPHV 7KLV
VLJQDOFDQEHXVHGWRHQDEOHDODWFKWRVDYHWKHDGGUHVVELWVIURPWKH$'
lines, thereby de-multiplexing the address bus and data bus.
(ii) RDDFWLYHORZRXWSXW7KH5HDGVLJQDOLQGLFDWHVWKDWGDWDDUHEHLQJUHDG
from the selected I/O or memory device and that they are available on the
data bus.
(iii) WRDFWLYHORZRXWSXW7KH:ULWHVLJQDOLQGLFDWHVWKDWWKHGDWDRQWKHGDWD
bus are to be written into a selected memory or I/O location.
(iv) IO/MRXWSXW,WLVDVLJQDOWKDWGLVWLQJXLVKHVEHWZHHQDPHPRU\RSHUDWLRQ
DQG DQ ,2 RSHUDWLRQ$Q DFWLYH ORZ RQ WKLV VLJQDO VKRZV LW LV D PHPRU\
s
how the movement of data within the computer is accomplished by a series of
s
EXVHV$GGUHVVLQIRUPDWLRQGDWDDQGFRQWUROVLJQDOVKDYHWREHFDUULHGDURXQG
re
inside the microprocessor as well as in the external system. Hence, the buses are
present both internally and externally.
yP
YL ,QWHUUXSWV7KHVHVLJQDOVDUHXVHGWRPDNHWKHPLFURSURFHVVRUUHVSRQGWRKLJK
sit
priority externally initiated signals. When an interrupt signal is detected by the
processor, it suspends the execution of the current program and executes the
er
SURJUDPFRUUHVSRQGLQJWRWKHLQWHUUXSWVLJQDOLQVWHDG)LYHLQWHUUXSWVLJQDOV
iv
,175567567567DQG7UDSDUHDYDLODEOHWRIDFLOLWDWHWKH
Un
SURFHVVRUWRUHFHLYHDQGDFNQRZOHGJHWKHLQWHUUXSWFDOORISHULSKHUDOV7KH
SURFHVVRUDFFHSWVWKUHHPRUHH[WHUQDOO\LQLWLDWHGVLJQDOV²5(6(7,1,
d
Hold, and Ready as inputs. The following points explain these signals in
or
EULHI
D ,175 LQSXW ,W LV D JHQHUDOSXUSRVH LQWHUUXSW UHTXHVW VLJQDO ,W LV DQ
xf
$ $GGUHVVEXV
$
Memory Input
Real
Output
MPU world
data
D7 Data bus
D0
Control bus
s
get control over the data and address buses for data transfer to and from
s
re
PHPRU\7KLVRSHUDWLRQLVFDOOHGGLUHFWPHPRU\DFFHVV'0$'0$
is useful when high-speed peripherals want to transfer data to and from
yP
memory. The processor does not intervene during this period.
L 5HDG\ LQSXW ,W LV D VLJQDO WKDW VHUYHV WR GHOD\ WKH PLFURSURFHVVRU
sit
read/write signals until a slow-responding peripheral is ready to send or
er
accept data. If this signal goes low, then the processor is allowed to wait
IRUDQLQWHJUDOQXPEHURIFORFNF\FOHVXQWLO5HDG\EHFRPHVKLJK7KH
iv
5HDG\VLJQDOPXVWEHV\QFKURQL]HGZLWKWKHSURFHVVRUFORFN
Un
; 1 VCC
d
; 39 HOLD
or
'0$
RESET OUT 3 +/'$
Serial V *1'
xf
Higher-order
75$3 5($'< ;; VCCVSS address bus
567 7 IO/M $
567 33 S1 $
567 9 RD SID Multiplexed
SOD lower-order
,175 10 31 WR address/data
75$3
,17$ 11 30 $/( 567 bus
$'
$' S0 567
$' 13 $ 567
,175
$'
$/(
$' $ ,17$ S1
$' $ 5($'< S0
HOLD IO/M
$' $ +/'$
$' 17 $ RESET RD
$' $ ,1 WR
$' 19 $
VSS $ RESET OUT CLK (OUT)
(a) (b)
s s
1.11.5.5 Power Supply and System Clock
re
7KH IROORZLQJ SLQV DUH DYDLODEOH LQ WKH FKLS WR SURYLGH SRZHU DQG FORFN
VLJQDOWRWKHSURFHVVRU
yP
(i) ; ; LQSXW$ PLFURSURFHVVRU QHHGV D VTXDUH ZDYH FORFN VLJQDO WR
sit
HQVXUHWKDWDOOLQWHUQDORSHUDWLRQVDUHV\QFKURQL]HG$FU\VWDORU5±&RU/±&
QHWZRUNLVFRQQHFWHGWRWKHVHWZRSLQV7KHFU\VWDOIUHTXHQF\LVLQWHUQDOO\
er
divided by two to give the operating system frequency. There are three
iv
the crystal size becomes smaller, and the crystal becomes lighter and cheaper.
7KHUHIRUHFORFNFLUFXLWVLQFOXGHDGLYLGHE\WZRFLUFXLWVRWKDWDGRXEOH
d
0+] FU\VWDO VKRXOG EH FRQQHFWHG WR WKH ; DQG ; SLQV7KH FU\VWDO LV
SUHIHUUHG DV D FORFN VRXUFH EHFDXVH RI LWV KLJK VWDELOLW\ ODUJH 4 TXDOLW\
xf
IDFWRUDQGDEVHQFHRIIUHTXHQF\GULIWLQJZLWKDJLQJ:LWKRXWDFORFNVLJQDO
O
s
ELW ELWGDWDRUWZRKH[GLJLWV
s
re
ELW ELWGDWDDGGUHVVRUIRXUKH[GLJLWV
( ) = Contents of
%DVHGRQWKHIXQFWLRQDOLW\WKHLQVWUXFWLRQVDUHFODVVL¿HGLQWRWKHIROORZLQJ¿YH
FDWHJRULHV
d
or
s s
LV VWRUHG LQ WKH DFFXPXODWRU 7KH ,QWHO LQVWUXFWLRQ VHW VXSSRUWV WZR W\SHV
re
RI DGGLWLRQ LQVWUXFWLRQV²ZLWK DQG ZLWKRXW DGGLWLRQ RI WKH FDUU\ ÀDJ FRQWHQW WR
yP
WKH OHDVW VLJQL¿FDQW ELW RI WKH QXPEHUV7KH LQVWUXFWLRQ VHW DOVR VXSSRUWV ELW
addition, i.e., the content of the HL register pair can be added to that of another
sit
register pair and the result stored in the HL register pair.
er
6XEWUDFWLRQ 68% 7KH LQVWUXFWLRQ VHW RI WKH VXSSRUWV WZR W\SHV RI
VXEWUDFWLRQ²ZLWK ERUURZ DQG ZLWKRXW ERUURZ /LNH DGGLWLRQ WKH VXEWUDFWLRQ
iv
operation also uses the accumulator as reference, i.e., it subtracts the content of a
Un
register or memory location from that of the accumulator and stores the result in
the accumulator.
d
or
and logical operations, the increment and decrement operations need not be based
O
s s
(i) One-byte instructions (ii) Two-byte instructions
re
(iii) Three-byte instructions
yP
$VVHPEO\ ODQJXDJH LQVWUXFWLRQV VKRXOG EH FRQYHUWHG LQWR PDFKLQH FRGH IRU
storage and execution by the processor. So the length of the machine language
sit
code instructions determines the length of the program. This in turn determines the
er
Instructions that require only one byte in machine language are called one-byte
instructions. These instructions just have the machine code or opcode alone to
represent the operation to be performed. The common examples are the instructions
d
or
that have their operands within the processor itself. Some examples of one-byte
LQVWUXFWLRQVDUHJLYHQLQ7DEOH(YHQWKRXJKWKHLQVWUXFWLRQ$''0DGGVWKH
xf
content of a memory location to that of the accumulator, its machine code requires
O
s s
re
Example:
MVI A, 32H (coded as 3E 32 in two contiguous bytes)
This is an example of immediate addressing.
yP
sit
7KHIROORZLQJWZRLQVWUXFWLRQVDUHDOVRH[DPSOHVRIWZRE\WHLQVWUXFWLRQV
L $',GDWD$ $GDWD
er
is not the data itself, but points directly to where it is located, this is called
Un
GLUHFWDGGUHVVLQJ)RUDGHWDLOHGDFFRXQWRIDGGUHVVLQJPRGHVVHH6HFWLRQ
1.13.3.
d
Instructions that require three bytes in machine code are called three-byte
xf
LQVWUXFWLRQV,QPDFKLQHODQJXDJHWKH¿UVWE\WHRIWKHWKUHHE\WHLQVWUXFWLRQV
LVWKHRSFRGHZKLFKVSHFL¿HVWKHRSHUDWLRQWREHSHUIRUPHG7KHQH[WWZRE\WHV
O
UHIHUWRWKHELWRSHUDQGZKLFKLVHLWKHUDELWQXPEHURUWKHDGGUHVVRID
memory location. Some common examples of three-byte instructions are listed in
7DEOH
Table 1.6 7KUHHE\WHLQVWUXFWLRQV
Opcode Operand Machine code/Opcode/Hex code Byte description
7KHLQVWUXFWLRQ/;,5SELWGDWDFDQEHH[SODLQHGDVIROORZV
5SLVRQHRIWKHSDLUVRIUHJLVWHUV%&'(RU+/ZKLFKDUHXVHGDVELW
UHJLVWHUV7KHWZRGDWDE\WHVDUHWREHVWRUHGDVDELWQXPEHULQ/DQG+LQ
VHTXHQFH /;, + + LV FRGHG DV + + + LQ WKUHH E\WHV 7KLV LV DQ
example of immediate addressing.)
,QH[HFXWLQJWKHLQVWUXFWLRQ/'$DGGUWKHDFFXPXODWRULVORDGHGZLWKWKHPHPRU\
FRQWHQWRIWKHDGGUHVVJLYHQLQWKHLQVWUXFWLRQ$GGULVDELWDGGUHVV/'$+
LVFRGHGDV$+++7KLVLVDQH[DPSOHRIGLUHFWDGGUHVVLQJ
s
,QWKHVHLQVWUXFWLRQVWKHVRXUFHFDQEHDUHJLVWHURUDQELWQXPEHU+WR))+
s
re
the destination is a register. The source and destination are operands. The various
formats for specifying operands are called addressing modes7KHKDVWKH
IROORZLQJ¿YHW\SHVRIDGGUHVVLQJ
(i) Immediate addressing yP
(ii) Memory direct addressing
sit
(iii) Register direct addressing (iv) Indirect addressing
er
DGGUHVVLQJLVJLYHQLQ)LJ addressing
O
Example:
MVI A, 9AH
(a) The operand is part of the instruction.
(b) The operand is stored in the register mentioned in the instruction.
Example:
ADI 05H
D $GG+WRWKHFRQWHQWVRIWKHDFFXPXODWRU
E +LVWKHRSHUDQG
Immediate addressing has no memory reference to fetch data. It executes faster,
but has limited data range.
1.13.3.2 Memory Direct Addressing
Memory direct addressing moves a byte or word between a memory location and
register. The memory location address is given in the instruction. The instruction
set does not support memory-to-memory transfer. Memory direct addressing is
LOOXVWUDWHGLQ)LJ
© Oxford University Press. All rights reserved.
Microprocessors—Evolution and Introduction to 8085 29
Instruction
2SFRGH0HPRU\DGGUHVV$ Memory
$
Operand
Example:
LDA 850FH
7KLVLQVWUXFWLRQLVXVHGWRORDGWKHFRQWHQWVRIWKHPHPRU\ORFDWLRQ)+LQWKH
s
accumulator.
s
re
Example:
STA 9001H
yP
This instruction is used to store the contents of the accumulator in the memory
address 9001H.
sit
In these instructions, the memory address of the operand is given in the instruction.
er
Direct addressing is also used for data transfer between the processor and
iv
LQSXWRXWSXWGHYLFHV)RUH[DPSOHWKH,1LQVWUXFWLRQLVXVHGWRUHFHLYHGDWDIURP
Un
the input port and store it in the accumulator; the OUT instruction is used to send
the data from the accumulator to the output port.
d
Example:
or
Register direct addressing transfers a copy of a byte or word from the source
register to the destination register. The operand is in the register named in the
instruction. It executes very fast, has very limited register space, and requires
good assembly programming. The operand is within in the processor itself; so the
H[HFXWLRQLVIDVWHU5HJLVWHUGLUHFWDGGUHVVLQJLVLOOXVWUDWHGLQ)LJ
Instruction
Opcode Register R Registers
R
Operand
Fig. 1
Fi 1.12
12 ))RUPDWRIUHJLVWHUGLUHFWDGGUHVVLQJ
I L GL GG L
s
access (or accesses) to retrieve the data which is to be loaded in the register.
s
re
Example:
MOV A, M
yP
Here, the data is in the memory location pointed to by the contents of the HL pair.
sit
The data is moved to the accumulator.
er
Instruction
iv
Memory
Registers
d
or
Memory address
to operand Operand
xf
R
O
In general, the assembly language mnemonics with their operands are written
¿UVW7KHDGGUHVVZKHUHWKHLQVWUXFWLRQVDUHVWRUHGLVJLYHQDGXPP\QDPHFDOOHG
label. The purpose of labels is to give the correct branch addresses in instructions.
s
Labels are separated from mnemonics with a colon.
s
re
The comments column is essential for any program as it helps the programmer
understand the logic of the program at any point in time. Without comments, it is
yP
GLI¿FXOWWRXQGHUVWDQGDQDVVHPEO\ODQJXDJHSURJUDP&RPPHQWVDUHVHSDUDWHG
sit
from the mnemonics with a semicolon.
7KH ¿UVW WZR FROXPQV FRUUHVSRQG WR WKH SK\VLFDO PHPRU\ DGGUHVV DQG WKH
er
DFWXDOPDFKLQHFRGH7KHVHWZRFROXPQVDUH¿OOHGLQDIWHUFRPSOHWLQJWKHDVVHPEO\
iv
language programming. These columns must contain only binary numbers, but for
HDV\XQGHUVWDQGLQJKH[DGHFLPDOQXPEHUVDUHXVHG)RUPDQXDODVVHPEOLQJWKHVH
Un
WZR FROXPQV DUH ¿OOHG LQ E\ WKH SURJUDPPHU $Q DVVHPEOHU FDQ JHQHUDWH WKHVH
columns automatically.
d
$QH[DPSOHRIWKHDVVHPEO\ODQJXDJHSURJUDPIRUPDWLVJLYHQLQ7DEOH
or
7KHLQVWUXFWLRQLQ7DEOHPRYHVWKHGDWD)+WRWKHDFFXPXODWRU
1.14.2 Data Transfer Instructions
Data transfer instructions are used to transfer data between two registers in the
microprocessor or between a peripheral device and the microprocessor. Some
instructions and their features are given in the following points. The complete list
ZLWKH[SODQDWLRQVLVJLYHQLQ7DEOH
L 09,LQVWUXFWLRQLVXVHGIRUVWRULQJELWGDWDLQDPLFURSURFHVVRUUHJLVWHU
LL /;,LQVWUXFWLRQLVXVHGIRUVWRULQJELWGDWDLQDUHJLVWHUSDLU
s
/'$ELW /RDGVWKHDFFXPXODWRU 0HPRU\ 7KUHHE\WHV /'$)+
s
re
with the data from the direct
memory location
indicated by the
ELWDGGUHVV yP
sit
/+/'ELW /RDGVWKH+DQG/ 0HPRU\ 7KUHHE\WHV /+/'$+
registers directly from direct
er
memory locations
indicated by the
Un
ELWDGGUHVV
67$ELW 6WRUHVWKHFRQWHQWVRI 0HPRU\ 7KUHHE\WHV 67$+
d
memory location
indicated by the
xf
ELWDGGUHVV
O
s
WKH+/UHJLVWHUSDLU
s
/'$;5S /RDGVDFFXPXODWRUZLWK ,QGLUHFW 2QHE\WH /'$;%
re
WKHFRQWHQWVRIWKH
yP
PHPRU\ORFDWLRQSRLQWHG
WRE\WKHUHJLVWHUSDLU
sit
67$;5S 6WRUHVWKHFRQWHQWVRIWKH ,QGLUHFW 2QHE\WH 67$;'
DFFXPXODWRULQWKH
er
PHPRU\ORFDWLRQSRLQWHG
WRE\WKHUHJLVWHUSDLU
iv
RIWKH+/UHJLVWHUSDLU
ZLWKWKDWRIWKH'DQG(
d
UHJLVWHUSDLU
or
WKHVWDFNSRLQWHU
O
LY /'$DQG67$XVHPHPRU\GLUHFWDGGUHVVLQJPRGHDQGDELWPHPRU\
DGGUHVVDVRSHUDQG
Y /'$; DQG 67$; XVH LQGLUHFW DGGUHVVLQJ PRGH IRU GDWD WUDQVIHU 7KH
RSHUDQG JLYHQ LQ WKH LQVWUXFWLRQ LV RQH RI WKH UHJLVWHU SDLUV %& RU '(
5HJLVWHU SDLU +/ LV QRW XVHG ZLWK /'$; GXH WR WKH DYDLODELOLW\ RI WKH
DOWHUQDWLYHLQVWUXFWLRQ029$0
YL /+/'DQG6+/'DUHWKHLQVWUXFWLRQVXVHGWRWUDQVIHUELWGDWDEHWZHHQ
WKH+/UHJLVWHUSDLUDQGWZRFRQVHFXWLYHPHPRU\ORFDWLRQV)RUH[DPSOH
H[HFXWLQJ6+/'+LQVWUXFWLRQZLOOVWRUHWKHFRQWHQWVRI/UHJLVWHULQ
+DQGWKHFRQWHQWVRI+UHJLVWHULQ+
YLL 386+ DQG 323 LQVWUXFWLRQV DUH XVHG IRU GDWD WUDQVIHU EHWZHHQ D UHJLVWHU
s
DQRXWSXWSRUW
s
re
[ ;&+* LQVWUXFWLRQ LV XVHG WR H[FKDQJH WKH FRQWHQWV RI WKH +/ DQG '(
UHJLVWHUSDLUV
WKHLUYDULDQWV7KHDULWKPHWLFLQVWUXFWLRQVDUHOLVWHGLQ7DEOH
iv
DFFXPXODWRU
O
s
register pair to that of the direct
s
re
H and L registers
,155 ,QFUHPHQWVWKHUHJLVWHU Register 2QHE\WH ,15%
,1;5S
by 1
,QFUHPHQWVWKHUHJLVWHU
yP
direct
Register 2QHE\WH ,1;%
sit
pair by 1 direct
er
pair by 1 direct
$''0 $GGVWKHFRQWHQWVRIWKH ,QGLUHFW 2QHE\WH $''0
d
7KHIROORZLQJSRLQWVOLVWVRPHNH\IHDWXUHVRIDULWKPHWLFRSHUDWLRQV
s
L )RUDULWKPHWLFRSHUDWLRQVRQHRIWKHGDWDPXVWEHVWRUHGLQWKHDFFXPXODWRU
s
re
and the other given or addressed in the instruction.
LL $GGZLWKFDUU\ LQVWUXFWLRQV DUH XVHG IRU PXOWLE\WH DQG KLJKHURUGHU E\WH
addition.
yP
(iii) Similarly, subtract-with-borrow instructions are used in multi-byte and
sit
higher-order byte subtraction.
er
(iv) Increment and decrement instructions can be operated not only on the
accumulator, but also on other registers including memory locations.
iv
Y 7KHFRQWHQWVRIDUHJLVWHUSDLUFDQEHLQFUHPHQWHGRUGHFUHPHQWHGXVLQJ,1;
Un
DQG'&;LQVWUXFWLRQV
YL '$$ LV WKH LQVWUXFWLRQ WKDW VXSSRUWV %&' DGGLWLRQ7KH DGGLWLRQ RI
d
%&'GDWDLVGRQHOLNHELQDU\DGGLWLRQXVLQJWKH$''LQVWUXFWLRQ'$$LV
or
used to convert the result of the binary addition of BCD numbers into a BCD
xf
s s
with the contents of the accumulator.
re
;5$0 7KHFRQWHQWVRIWKHPHPRU\ ,QGLUHFW 2QHE\WH ;5$0
yP
location pointed to by the HL
UHJLVWHUSDLULVORJLFDOO\(;25HG
sit
with the contents of the accumulator.
25$0 7KHFRQWHQWVRIWKHPHPRU\ ,QGLUHFW 2QHE\WH 25$0
er
RLC Rotates the bits of the accumulator Implicit One byte RLC
left by one position
d
RRC Rotates the bits of the accumulator Implicit One byte RRC
or
s
7KHLQVWUXFWLRQVHWRIWKHVXSSRUWVDFRPSDUHLQVWUXFWLRQIRUFRPSDULQJ
s
re
the magnitude of two binary numbers. The compare instructions are used to
FRPSDUH WKH DFFXPXODWRU FRQWHQW ZLWK WKH RSHUDQG VSHFL¿HG LQ WKH LQVWUXFWLRQ
yP
CPI instruction uses immediate addressing and CMP uses registers or indirectly
addressed memory location for comparing with the accumulator. The result of the
sit
FRPSDUHLQVWUXFWLRQLVLQGLFDWHGLQWKHÀDJUHJLVWHUDVIROORZV
er
subroutine instructions. The jump instructions merely transfer the execution from
O
one location in the program to another, whereas the subroutine instructions in the
main program transfer execution to a new location and also return to the main
SURJUDP 5HWXUQ LQVWUXFWLRQV DUH XVHG IRU WKLV SXUSRVH7KH EUDQFKLQJ FDQ WDNH
SODFH XQFRQGLWLRQDOO\ RU FRQGLWLRQDOO\ EDVHG RQ WKH ÀDJ FRQGLWLRQV VKRZQ LQ
Table 1.11. PCHL instruction is a special instruction used to branch to the address
stored in the HL register pair.
RST nLVWKHUHVWDUWLQVWUXFWLRQVXSSRUWHGE\WKH8SRQH[HFXWLRQRIWKH
RST n instruction, the program execution will be transferred to the address given
by n î)RUH[DPSOH567LQVWUXFWLRQZLOOWUDQVIHUWKHH[HFXWLRQWRWKHDGGUHVV
+ZKLFKLVWKHKH[DGHFLPDOHTXLYDOHQWRILQGHFLPDOIRUP
,QPDFKLQHFRGHRURSFRGHWKHELWRUKH[GLJLWDGGUHVVHVLQWKHEUDQFKLQJ
instructions are given such that the lower-order byte of the address follows the
KLJKHURUGHUE\WH)RUH[DPSOH-03+LVFRGHGDV&7KHRSFRGHIRU
-03&LVVWRUHG¿UVWIROORZHGE\DQGWKHQE\
s
&3ELW &DOORQSRVLWLYH 7KUHHE\WHV &3
s
&0ELW &DOORQPLQXV 7KUHHE\WHV &0
re
&=ELW &DOORQ]HUR 7KUHHE\WHV &=
&1=ELW
&3(ELW
&DOORQQR]HUR
&DOORQSDULW\HYHQ yP 7KUHHE\WHV
7KUHHE\WHV
&1=
&3(
sit
&32ELW &DOORQSDULW\RGG 7KUHHE\WHV &32
RET Return unconditionally One byte RET
er
s s
DI Disables interrupts Implicit One byte
re
EI Enables interrupts Implicit One byte
5,0 5HDGVLQWHUUXSWPDVN ,PSOLFLW 2QHE\WH
6,0 6HWVLQWHUUXSWPDVN
yP ,PSOLFLW 2QHE\WH
sit
1.15 SAMPLE PROGRAMS
er
The program given in Table 1.13 uses immediate addressing for the two data to be
Un
DGGHG7KHGDWDWREHDGGHGDUHVWRUHGLQPHPRU\ORFDWLRQV+DQG+
7KHVXPLVVWRUHGLQWKHPHPRU\ORFDWLRQ+7KLVSURJUDPDVVXPHVWKDWQR
d
:ULWHDQDVVHPEO\ODQJXDJHSURJUDPWRDGGWZRQXPEHUVRIELWVHDFK
This program also uses immediate addressing for loading the data in the processor
UHJLVWHUV7KHVXPLVVWRUHGLQWKHPHPRU\ORFDWLRQV+DQG+DVVKRZQ
LQ7DEOH
s
$ +/7 7HUPLQDWHSURJUDPH[HFXWLRQ
s
re
3. Write an assembly language program to add the two numbers stored in the
yP
PHPRU\ORFDWLRQV+DQG+DQGVWRUHWKHUHVXOWLQ+
sit
This program uses indirect addressing instructions to load the numbers to be
added in the processor registers. The carry, if generated, is ignored. The program
er
LVVKRZQLQ7DEOH
iv
Opcode
or
s s
operand fetch, and memory read/write or I/O read/write. The microprocessor’s
re
H[WHUQDOFRPPXQLFDWLRQIXQFWLRQFDQEHGLYLGHGLQWRWKUHHFDWHJRULHV
yP
(i) Memory read/write (ii) I/O read/write
LLL ,QWHUUXSWUHTXHVWDFNQRZOHGJH
sit
er
POINTS TO REMEMBER
iv
s
(iv) Testing for a given condition and altering the program sequence
s
x 7KHLQVWUXFWLRQVDUHFODVVL¿HGLQWRWKUHHJURXSVDFFRUGLQJWRZRUGVL]HRQHWZR
re
and three-byte instructions.
x
yP
$Q LQVWUXFWLRQ KDV WZR SDUWV²RSFRGH RSHUDWLRQ WR EH SHUIRUPHG DQG RSHUDQG
GDWD WR EH RSHUDWHG RQ 7KH RSHUDQG FDQ EH GDWD ELW RU ELW DGGUHVVHV
sit
registers, or implicit in the opcode. The method of specifying an operand (directly,
indirectly, etc.) is called addressing mode.
er
x The instructions are executed in steps of machine cycles and each machine cycle
iv
KEY TERMS
d
Accumulator ,WLVDQELWUHJLVWHULWLVDSDUWRIWKH$/8DQGLVWKHPRVWLPSRUWDQW
or
UHJLVWHU,WLVXVHGWRVWRUHELWGDWDDQGWRSHUIRUPDULWKPHWLFDQGORJLFDORSHUDWLRQV
xf
LGHQWL¿HGDVUHJLVWHU$
Address bus This bus carries the binary number (i.e., the address) used to access
a memory location. Binary data can then be written into or read from the addressed
PHPRU\ORFDWLRQ7KHDGGUHVVEXVFRQVLVWVRIZLUHVDQGFDQWKHUHIRUHKDQGOH
bits.
Addressing mode It is the method of specifying the data to be operated on by the
instruction.
Bus It is a group of conducting lines that carry data, address, and control signals
Clock speed This determines how many instructions per second the processor can
H[HFXWH,WLVVSHFL¿HGLQPHJDKHUW]0+]
Control bus This bus has various lines for coordinating and controlling
PLFURSURFHVVRURSHUDWLRQV)RUH[DPSOHRD and WR lines.
Data bus This bus carries data in binary form between the microprocessor and
H[WHUQDOXQLWVVXFKDVPHPRU\7\SLFDOVL]HLVHLJKWRUELWV
DMA controller ,WLVXVHGWRWDNHFRQWURORIWKHV\VWHPEXVE\SODFLQJDKLJKVLJQDO
on the Hold pin.
Flag ,WLVDÀLSÀRSXVHGWRVWRUHLQIRUPDWLRQDERXWWKHVWDWXVRIWKHSURFHVVRUDQG
the status of the instruction executed most recently.
s
sequence can be resumed.
s
Machine cycle It is the time required to access the memory or input/output devices.
re
Memory direct addressing It moves a byte or word between a memory location
and a register.
yP
Opcode ,WLVWKHSDUWRIWKHLQVWUXFWLRQWKDWVSHFL¿HVWKHRSHUDWLRQWREHSHUIRUPHG
sit
Operand It is the data on which the operation is performed.
287 This instruction is used to move data from the accumulator to an I/O port.
er
Ready It is an input signal to the processor. It is used by the memory or I/O devices
iv
to get extra time for data transfer or to introduce wait states in the bus cycles.
Register direct addressing It transfers a copy of a byte or word from a source
Un
Trap ,WLVDQRQPDVNDEOHLQWHUUXSWRIWKHDQGLVQRWGLVDEOHGE\SURFHVVRUUHVHW
xf
DQGSURJUDPVLQDSURFHVVRU,WLVWKHWLPHFRUUHVSRQGLQJWRRQHFORFNSHULRG
REVIEW QUESTIONS
1. What is the main function of a computer?
1DPHDQ\WKUHHLQSXWGHYLFHVRIDFRPSXWHU
1DPHDQ\WZRRXWSXWGHYLFHVRIDFRPSXWHU
1DPHDQ\WKUHHVWRUDJHGHYLFHVRIDFRPSXWHU
1DPHDQ\WKUHHSODFHVZKHUHFRPSXWHUVFDQEHXVHG
'UDZDEORFNGLDJUDPRIDFRPSXWHUDQGODEHOLWVFRPSRQHQWV
:KRGHYHORSHGWKHZRUOG¶V¿UVWPLFURSURFHVVRU"
:KDWLVWKHGDWDEXVZLGWKRIWKHPLFURSURFHVVRU"
:KHQGLG,QWHOLQWURGXFHWKH3HQWLXPPLFURSURFHVVRU"
:KDWLVWKHDPRXQWRIPHPRU\WKDWWKH3HQWLXPSURFHVVRUFDQDGGUHVV"
11. What are the basic units of a microprocessor?
:KDWLVWKHIXQFWLRQRIPLFURSURFHVVRULQDV\VWHP"
s
:K\LVWKHGDWDEXVELGLUHFWLRQDO"
s
+RZDUHWKHVLJQDOVRIWKHFODVVL¿HG"
re
+RZDUHFORFNVLJQDOVJHQHUDWHGLQWKH":KDWLVWKHIUHTXHQF\RIWKHLQWHUQDO
FORFN"
yP
+RZGRHVWKHSURFHVVRUGLIIHUHQWLDWHDPHPRU\DFFHVVUHDGZULWHVLJQDO
sit
from an I/O access (read/write) signal?
:K\LVFU\VWDODSUHIHUUHGFORFNVRXUFH"
er
:KLFKLQWHUUXSWKDVWKHKLJKHVWSULRULW\LQWKH":KDWLVWKHSULRULW\RIWKH
iv
other interrupts?
33. When and where is the Ready signal used?
Un
:KDWDUH+ROGDQG+/'$"+RZDUHWKH\XVHG"
'UDZDJHQHUDOEORFNGLDJUDPRIDPLFURSURFHVVRUEDVHGV\VWHP([SODLQEULHÀ\
d
WKHYDULRXVEORFNVRIWKHV\VWHP*LYHVRPHH[D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HZRXOGLWVWLOOEH
possible to write subroutines? How would the subroutine be called? How would
s s
one return to the main program?
re
yP
sit
er
iv
Un
d
or
xf
O