Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (11 votes)
45 views

The 8085 Microprocessor Architecture Programming and Interfacing 1e Kumar all chapter instant download

Microprocessor

Uploaded by

djenoezethu93
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (11 votes)
45 views

The 8085 Microprocessor Architecture Programming and Interfacing 1e Kumar all chapter instant download

Microprocessor

Uploaded by

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

Download the full version of the ebook at

https://ebookultra.com

The 8085 Microprocessor Architecture


Programming and Interfacing 1e Kumar

https://ebookultra.com/download/the-8085-
microprocessor-architecture-programming-and-
interfacing-1e-kumar/

Explore and download more ebook at https://ebookultra.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

The 8085 Microprocessor Architecture Programming and


Interfacing 1st Edition K Udaya Kumar

https://ebookultra.com/download/the-8085-microprocessor-architecture-
programming-and-interfacing-1st-edition-k-udaya-kumar/

ebookultra.com

Analog Interfacing to Embedded Microprocessor Systems 2nd


ed Edition Stuart Ball

https://ebookultra.com/download/analog-interfacing-to-embedded-
microprocessor-systems-2nd-ed-edition-stuart-ball/

ebookultra.com

The Intel Microprocessors 8086 8088 80186 80188 80286


80386 80486 Pentium and Pentium Processor Architecture
Programming and Interfacing Prentice Hall International
Editions Barry B. Brey
https://ebookultra.com/download/the-intel-
microprocessors-8086-8088-80186-80188-80286-80386-80486-pentium-and-
pentium-processor-architecture-programming-and-interfacing-prentice-
hall-international-editions-barry-b-brey/
ebookultra.com

Microprocessor Architecture From Simple Pipelines to Chip


Multiprocessors 1st Edition Jean-Loup Baer

https://ebookultra.com/download/microprocessor-architecture-from-
simple-pipelines-to-chip-multiprocessors-1st-edition-jean-loup-baer/

ebookultra.com
Embedded Linux Hardware Software and Interfacing R
Hardware Software and Interfacing Hollabaugh

https://ebookultra.com/download/embedded-linux-hardware-software-and-
interfacing-r-hardware-software-and-interfacing-hollabaugh/

ebookultra.com

The Lab Manual to Accompany The 8088 and 8086


Microprocessors Programming Interfacing Software Hardware
and Applications 4th Edition Walter A. Triebel
https://ebookultra.com/download/the-lab-manual-to-accompany-
the-8088-and-8086-microprocessors-programming-interfacing-software-
hardware-and-applications-4th-edition-walter-a-triebel/
ebookultra.com

Microprocessor 3 Philippe Darche

https://ebookultra.com/download/microprocessor-3-philippe-darche/

ebookultra.com

Digital signal processors architecture programming and


applications 2nd Edition B. Venkataramani

https://ebookultra.com/download/digital-signal-processors-
architecture-programming-and-applications-2nd-edition-b-venkataramani/

ebookultra.com

Bluetooth Application Programming with the Java APIs The


Morgan Kaufmann Series in Networking 1st Edition C Bala
Kumar
https://ebookultra.com/download/bluetooth-application-programming-
with-the-java-apis-the-morgan-kaufmann-series-in-networking-1st-
edition-c-bala-kumar/
ebookultra.com
The 8085 Microprocessor Architecture Programming and
Interfacing 1e Kumar Digital Instant Download
Author(s): Kumar, K. Udaya; Umashankar, B. S
ISBN(s): 9788257452247, 8257452246
Edition: Online-Ausg
File Details: PDF, 7.68 MB
Year: 2008
Language: english
udayakumar_fm.qxp 4/21/2008 2:31 PM Page i

THE 8085
MICROPROCESSOR
Architecture, Programming
and Interfacing

K. UDAYA KUMAR,
Principal,
B.N.M. Institute of Technology,
Bangalore, India.

B. S. UMASHANKAR,
Professor,
Department of Computer Science,
B.N.M. Institute of Technology,
Bangalore, India.
udayakumar_fm.qxp 4/16/2008 4:21 PM Page ii

Copyright © 2008 Dorling Kindersley (India) Pvt. Ltd.


Licensees of Pearson Education in South Asia

No part of this eBook may be used or reproduced in any manner whatsoever without the publisher’s prior
written consent.

This eBook may or may not include all assets that were part of the print version. The publisher reserves the
right to remove any material present in this eBook at any time.

ISBN 9788177584554
eISBN 9788131799772

Head Office: A-8(A), Sector 62, Knowledge Boulevard, 7th Floor, NOIDA 201 309, India
Registered Office: 11 Local Shopping Centre, Panchsheel Park, New Delhi 110 017, India
udayakumar_fm.qxp 4/16/2008 4:21 PM Page iii

Dedicated to
the Goddess of Learning
udayakumar_fm.qxp 4/16/2008 4:21 PM Page iv

This page is intentionally left blank.


udayakumar_fm.qxp 4/16/2008 4:21 PM Page v

Contents

Preface xi 5. First Assembly Language Program 38


5.1 Problem Statement 38
Part I 5.2 About the Microprocessor Kit 41
5.3 Using the Microprocessor Kit in
FUNDAMENTALS OF A Serial Mode 51
MICROPROCESSOR 1 Questions 51

1. Evolution of Microprocessors 3 6. Data Transfer Group of


1.1 Early Integrated Circuits 3 Instructions 52
1.2 4-Bit Microprocessors 4 6.1 Classification of 8085 Instructions 53
1.3 8-Bit Microprocessors 4 6.2 Instruction Type MVI r, d8 54
1.4 16-Bit Microprocessors 4 6.3 Instruction Type MOV r1, r2 54
1.5 32-Bit Microprocessors 5 6.4 Instruction Type MOV r, M 55
1.6 Recent Microprocessors 5 6.5 Instruction Type MOV M, r 56
1.7 Microcontrollers and Digital Signal 6.6 Instruction Type LXI rp, d16 56
Processors 5 6.7 Instruction Type MVI m, d8 57
6.8 Instruction Type LDA a16 57
2. Fundamentals of a Computer 7 6.9 Instruction Type STA a16 58
2.1 Calculator 7 6.10 Instruction Type XCHG 58
2.2 Computer 8 6.11 Addressing Modes of 8085 59
2.3 Microcomputer 12 6.12 Instruction Type LDAX rp 62
2.4 Computer Languages 13 6.13 Instruction Type STAX rp 62
Questions 16 6.14 Instruction Type LHLD a16 63
6.15 Instruction Type SHLD a16 63
3. Number Representation 17 Questions 63
3.1 Unsigned Binary Integers 17
3.2 Signed Binary Integers 18
7. Arithmetic Group of Instructions 65
3.3 Representation of Fractions 23 7.1 Instructions to Perform Addition 66
3.4 Signed Floating Point 7.2 Instructions to Perform Subtraction 70
Numbers 25 7.3 Instruction Type INX rp 73
Questions 25 7.4 Instruction Type DCX rp 74
7.5 Instruction Type DAD rp 74
4. Fundamentals of Microprocessor 27 7.6 Decimal Addition in 8085 75
4.1 History of Microprocessors 27 Questions 76
4.2 Description of 8085 Pins 29
4.3 Programmer’s View of 8085: Need for
8. Logical Group of Instructions 77
Registers 34 8.1 Instructions to Perform ‘AND’
4.4 Accumulator or Register A 35 Operation 78
4.5 Registers B, C, D, E, H, And L 36 8.2 Instructions to Perform ‘OR’
Questions 36 Operation 79
udayakumar_fm.qxp 4/16/2008 4:21 PM Page vi

vi
8.3 Instructions to Perform 12. Addressing of I/O Ports 125
‘EXCLUSIVE OR’ Operation 80
8.4 Instruction to Complement 12.1 Need for I/O Ports 125
Accumulator 82 12.2 IN and OUT Instructions 127
8.5 Instructions to Complement/Set ‘Cy’ 12.3 Memory-Mapped I/O 128
Flag 82 12.4 I/O-Mapped I/O 129
Contents

8.6 Instructions to Perform Compare 12.5 Comparison of Memory-Mapped


Operation 83 I/O and I/O-Mapped I/O 129
8.7 Instructions to Rotate Questions 132
Accumulator 85
Questions 88
13. Architecture of 8085 133
13.1 Details of 8085 Architecture 134
9. NOP and Stack Group of 13.2 Instruction Cycle 140
Instructions 90 13.3 Comparison of Different Machine
Cycles 152
9.1 Stack and The Stack Pointer 90 13.4 Memory Speed Requirement 153
9.2 Instruction Type POP rp 92 13.5 Wait State Generation 160
9.3 Instruction Type PUSH rp 93 Questions 161
9.4 Instruction Type LXI SP, d16 94
9.5 Instruction Type SPHL 95
9.6 Instruction Type XTHL 95 Part II
9.7 Instruction Type INX SP 95
9.8 Instruction Type DCX SP 96 ASSEMBLY LANGUAGE
9.9 Instruction Type DAD SP 96 PROGRAMS 163
9.10 Instruction Type NOP 96
Questions 98 14. Simple Assembly Language
Programs 165
10. Branch Group of Instructions 99
14.1 Exchange 10 Bytes 165
10.1 More Details about Program 14.2 Add two Multi-Byte Numbers 169
Execution 100 14.3 Add two Multi-Byte BCD
10.2 Unconditional Jump Instructions 102 Numbers 171
10.3 Conditional Jump Instructions 104 14.4 Block Movement without
10.4 Unconditional Call and Return Overlap 174
Instructions 107 14.5 Block Movement with Overlap 175
10.5 Conditional Call Instructions 109 14.6 Add N Numbers of Size 8 Bits 178
10.6 Conditional Return Instructions 111 14.7 Check the Fourth Bit of a Byte 181
10.7 RSTN – Restart Instructions 113 14.8 Subtract two Multi-Byte
Questions 115 Numbers 182
14.9 Multiply two numbers of Size
11. Chip Select Logic 117 8 Bits 184
11.1 Concept of Chip Selection 117 14.10 Divide a 16-Bit Number
11.2 RAM Chip–Pin Details And by an 8-Bit Number 187
Address Range 118 Questions 189
11.3 Multiple Memory Address
Range 119 15. Use of PC in Writing and
11.4 Working of 74138 Decoder IC 120
11.5 Use of 74138 to Generate Chip Executing 8085 Programs 190
Select Logic 121 15.1 Steps Needed to Run an Assembly
11.6 Use of 74138 in ALS-SDA-85M Language Program 191
Kit 122 15.2 Creation of .ASM File using a
Questions 123 Text Editor 195
udayakumar_fm.qxp 4/16/2008 4:21 PM Page vii

vii
15.3 Generation of .OBJ File using a 17.5 Bubble Sort in Ascending/Descending
Cross-Assembler 195 Order as per Choice 259
15.4 Generation of .HEX File using a 17.6 Selection Sort in Ascending/Descending
Linker 197 Order as per Choice 263
15.5 Downloading the Machine Code to 17.7 Add Contents of N Word
the Kit 199 Locations 266

Contents
15.6 Running the Downloaded Program 17.8 Multiply Two 8-Bit Numbers (Shift
on the Kit 201 and Add Method) 268
15.7 Running the Program using the PC 17.9 Multiply two 2-Digit BCD
as a Terminal 201 Numbers 270
Questions 204 17.10 Multiply two 16-Bit Binary
Numbers 272
Questions 276
16. Additional Assembly Language
Programs 205
16.1 Search for a Number using Linear Part III
Search 206
16.2 Find the Smallest Number 208 PROGRAMMABLE AND NON-
16.3 Compute the HCF of Two 8-Bit PROGRAMMABLE I/O PORTS 275
Numbers 210
16.4 Check for ‘2 out of 5’ Code 212 18. Interrupts In 8085 277
16.5 Convert ASCII to Binary 214 18.1 Data Transfer Schemes 278
16.6 Convert Binary to ASCII 216 18.2 General Discussion about 8085
16.7 Convert BCD to Binary 218 Interrupts 283
16.8 Convert Binary to BCD 221 18.3 EI and DI Instructions 285
16.9 Check for Palindrome 228 18.4 INTR and INTA* Pins 288
16.10 Compute the LCM of Two 8-Bit 18.5 RST5.5 and RST6.5 Pins 291
Numbers 230 18.6 RST7.5 Pin 292
16.11 Sort Numbers using Bubble 18.7 Trap Interrupt Pin 293
Sort 233 18.8 Execution of ‘DAD rp’
16.12 Sort Numbers using Selection Instruction 296
Sort 235 18.9 SIM and RIM Instructions 297
16.13 Simulate Decimal up Counter 237 18.10 HLT Instruction 302
16.14 Simulate Decimal down 18.11 Programs using Interrupts 302
Counter 240 Questions 310
16.15 Display Alternately 00 and FF in
the Data Field 241 19. 8212 Non-Programmable 8-Bit
16.16 Simulate a Real-Time Clock 243 I/O Port 311
Questions 246 19.1 Working of 8212 311
19.2 Applications of 8212 315
17. More Complex Assembly Questions 322
Language Programs 247
20. 8255 Programmable Peripheral
17.1 Subtract Multi-Byte BCD
Numbers 248
Interface Chip 323
17.2 Convert 16-Bit Binary to BCD 250 20.1 Description of 8255 PPI 323
17.3 Do an operation on Two Numbers 20.2 Operational Modes of 8255 327
Based on the Value of X 252 20.3 Control Port of 8255 328
17.4 Do an Operation on Two BCD 20.4 Mode 1–Strobed I/O 331
Numbers Based on the Value 20.5 Mode 2–Bi-Directional I/O 340
of X 255 Questions 342
udayakumar_fm.qxp 4/16/2008 4:21 PM Page viii

viii

21. Programs using Interface 24.3 Description of 8257 DMA


Modules 344 Controller Chip 444
24.4 Programming the 8257 446
21.1 Description of Logic Controller 24.5 Description of the Pins Of
Interface 344 8257 452
21.2 Successive Approximation 24.6 Working of the 8257 DMA
Contents

ADC Interface 353 Controller 456


21.3 Dual Slope ADC Interface 356 24.7 State Diagram of 8085 457
21.4 Digital to Analog Converter Questions 460
Interface 359
21.5 Stepper Motor Interface 363
Questions 366
25. Intel 8253—Programmable
Interval Timer 461
25.1 Need for Programmable Interval
Part IV Timer 461
SUPPORT CHIPS 367 25.2 Description of 8253 Timer 462
25.3 Programming the 8253 463
22. Interfacing of I/O Devices 369 25.4 Mode 0–Interrupt On Terminal
Count 467
22.1 Interfacing 7-Segment Display 370 25.5 Mode 1–Re-Triggerable Mono-
22.2 Display Interface using Serial Stable Multi 468
Transfer 374 25.6 Mode 2–Rate Generator 469
22.3 Interfacing a Simple Keyboard 377 25.7 Mode 3–Square Wave Generator 471
22.4 Interfacing a Matrix Keyboard 380 25.8 Mode 4–Software-Triggered
22.5 Description of Matrix Keyboard Strobe 472
Interface 381 28.9 Mode 5–Hardware-Triggered
22.6 Intel 8279 Keyboard And Display Strobe 473
Controller 384 28.10 Use of 8253 in ALS-SDA-85
22.7 Programs using 8279 402 Kit 475
Questions 414 Questions 475
23. Intel 8259A—Programmable 26. Intel 8251A—Universal
Interrupt Controller 416 Synchronous Asynchronous
23.1 Need for an Interrupt Controller 417 Receiver Transmitter
23.2 Overview of the Working
of 8259 419
(USART) 477
23.3 Pins of 8259 421 26.1 Need for USART 477
23.4 Registers used in 8259 422 26.2 Asynchronous Transmission 478
23.5 Programming the 8259 with 26.3 Asynchronous Reception 481
no Slaves 424 26.4 Synchronous Transmission 483
23.6 Programming the 8259 with 26.5 Synchronous Reception 484
Slaves 436 26.6 Pin Description of 8251 USART 484
23.7 Use of 8259 in an 8086-Based 26.7 Programming the 8251 488
System 439 26.8 Use of SOD Pin of 8085 for
23.8 Architecture of 8259 439 Serial Transfer 492
Questions 440 Questions 493

24. Intel 8257—Programmable 27. Zilog Z-80 Microprocessor 495


DMA Controller 442 27.1 Comparison of Intel 8080 with
24.1 Concept of Direct Memory Intel 8085 496
Access (DMA) 442 27.2 Programmer’s View of Z-80 497
24.2 Need for DMA Data Transfer 443 27.3 Special Features of Z-80 498
udayakumar_fm.qxp 4/16/2008 4:21 PM Page ix

ix
27.4 Addressing Modes of Z-80 499 29.4 Data Memory Structure 551
27.5 Special Instruction Types 506 29.5 Programmer’s View of 8051 556
27.6 Pins of Z-80 517 29.6 Addressing Modes of 8051 557
27.7 Interrupt Structure in Z-80 519 29.7 Instruction Set of 8051 560
27.8 Programming Examples 524 29.8 Programming Examples 568
27.9 Instruction Set Summary 527 Questions 573

Contents
Questions 528
30. Advanced Topics
28. Motorola M6800
in 8051 574
Microprocessor 529
30.1 Interrupt Structure of 8051 575
28.1 Pin Description of 6800 530 30.2 Timers of 8051 579
28.2 Programmer’s View of 6800 531 30.3 Serial Interface 584
28.3 Addressing Modes of 6800 533 30.4 Structure and Operation of
28.4 Instruction Set of 6800 536 Ports 591
28.5 Interrupts of 6800 540 30.5 Power Saving Modes of 8051 595
28.6 Programming Examples 542 30.6 Programming of EPROM in
Questions 545 8751BH 597
Questions 600
29. 8051 Microcontroller 546
29.1 Main Features of Intel 8051 547 Bibliography 601
29.2 Functional Blocks of Intel 8051 548
29.3 Program Memory Structure 550 Index 603
udayakumar_fm.qxp 4/16/2008 4:21 PM Page x

This page is intentionally left blank.


udayakumar_fm.qxp 4/16/2008 4:21 PM Page xi

Preface

Microprocessors, microcontrollers, and digital signal processor chips are used in business machines,
automotive electronics, home appliances, electronic toys, and a variety of industrial applications. In
this book, we confine ourselves to the study of 8-bit microprocessors Intel 8085, Zilog Z-80 and
Motorola 6800, as well as the popular 8-bit microcontroller—the Intel 8051.
This book has been written after teaching the subject of microprocessors for more than two
decades, keeping in mind the difficulties faced by students in grasping the subject. We have pre-
sented the material in a lucid language, using short, simple sentences to facilitate easy reading and
understanding. Each concept has been articulated with a number of examples with emphasis on clar-
ity, in a logical sequence. To this end, the book is divided into four parts. The first part consists of
Chapters 1 to 13, and deals with the fundamentals of a microprocessor. Chapters 14 to17 make up
the second part, and focuses on assembly language programs. The programmable and non-program-
mable ports are examined in part three from Chapters 18 to 21, while the concluding portion of the
book, consisting of Chapters 22 to 30 deals with support chips.
Chapter 1 introduces the developments in electronics starting with the transistor and the early inte-
grated circuits and provides an insight into the evolution of microprocessors, microcontrollers and
digital signal processors.
Chapter 2 familiarizes students with the various parts of a computer, their main functions and the
evolution of computer languages.
Chapter 3 explains clearly the unsigned and the various signed number representations for integers
and provides an overview of signed floating-point numbers.
Chapter 4 touches upon the history of the microprocessor and deals with the fundamentals of the
8085 microprocessor, which is the main focus of this book. The various registers and the program-
mer’s view of 8085 are also introduced here.
Chapter 5 describes a typical 8085-microprocessor kit and its usage by indicating the steps needed
to write and execute a simple assembly language program.
Chapter 6 gives the classification of 8085 instructions and elaborates on the data transfer group of
instructions with meaningful examples. The various addressing modes of 8085 are also explained.
Chapter 7 deals with the arithmetic group of instructions and explains the various flags used in the
8085 microprocessor.
Chapters 8 to 10 focus on the logical, stack, and branch group of instructions respectively, explain-
ing them with suitable examples.
Chapter 11 dwells on the concept of chip selection and the use of 74138 to generate chip select
logic.
Chapter 12 discusses the need for I/O ports, their addressing and compares I/O mapped I/O with
memory mapped I/O.
Chapter 13 furnishes a detailed architecture of 8085, and explains the various machine cycles
needed for executing a variety of instructions.
Chapter 14 explains simple assembly language programs that are executed on a microprocessor kit
and also illustrates some of the commonly used monitor routines.
udayakumar_fm.qxp 4/16/2008 4:21 PM Page xii

xii
Chapter 15 brings out the use of a personal computer in writing an assembly language program,
translating it to machine language using an assembler, and then downloading it to the microprocessor
kit for execution.
Chapter 16 deals with complex assembly language programs. For these programs students have to
use the PC to enter the program, do the translation using the assembler, download the machine code
Preface

to the microprocessor kit, and run the program using the commands issued by the PC in serial mode.
Chapter 17 is about more complex assembly language problems. For each of these problems, the
flowchart and the program are provided along with trace for test data. This simplifies the understand-
ing of the given solution.
Chapter 18 expounds on data transfer schemes and discusses in detail about the use of interrupts in
the 8085 microprocessor. The interrupt related instructions are explained here, and we look at a num-
ber of assembly language programs that make use of interrupts.
Chapter 19 presents a detailed explanation of the working and application of the Intel 8212—a non-
programmable I/O port.
Chapter 20 is about the popular Intel 8255—a programmable peripheral interface chip. The
description, operational modes and the control words are delineated.
Chapter 21 describes some of the commonly used interface modules like logic controller, analog-
to-digital converter, digital-to-analog converter and stepper motor. A number of interesting programs
using these interface modules are illustrated.
Chapter 22 first deals with interfacing 7-segment display and matrix keyboard using latches and
tri-state gates. Then the Intel 8279—the programmable keyboard and display controller chip is
described at length. A number of useful routines using the 8279 chip are also explained.
Chapter 23 is about the Intel 8259—the programmable interrupt controller. It gives an overview of
the working of 8259, and explains the function of its pins and the programming of 8259 with and with-
out slave 8259s.
Chapter 24 covers the programmable DMA Controller—the Intel 8257. In this chapter the concept
of Direct Memory Access (DMA), the DMA controller chip and its programming are examined in
depth.
Chapter 25 describes the Intel 8253—a programmable interval timer. It explains the need for a pro-
grammable timer and succinctly spells out the various modes of operation of 8253.
Chapter 26 examines the Intel 8251—the Universal Synchronous Asynchronous Receiver Trans-
mitter (USART). It explains the asynchronous and synchronous modes of transmission and reception,
and describes the programming of the 8251.
Chapter 27 reviews the Zilog Z-80 microprocessor. With an in-depth knowledge of the 8085
microprocessor acquired from the first 26 chapters, students would be in a position to understand the
programmer’s view, new addressing modes, and the new instruction types available in Z-80. The
chapter ends with a few programming examples that provide a critical comparison of the Z-80 and
the Intel 8085.
Chapter 28 talks about the M6800 microprocessor from Motorola, which has a very simple archi-
tecture compared to 8085 or the Z-80. It describes the pins, the programmer’s view, addressing modes,
and the instruction set of M6800 and ends with a few programming examples that demonstrate its
power in spite of its simplicity.
Chapter 29 is devoted to the popular Intel 8051 microcontroller. It discusses the basics of the 8051
providing details about its functional blocks, the programmer’s view, addressing modes, and the
instruction set. A number of assembly language programming examples are provided to make students
comfortable with the instruction set of 8051.
Chapter 30, the concluding chapter, reviews the advanced topics in 8051. It deals with the interrupt
structure, timers, serial interface, structure and operation of ports, and power saving modes of 8051.
udayakumar_fm.qxp 4/16/2008 4:21 PM Page xiii

xiii
The chapter ends with the programming of EPROM in 8751, which is the EPROM version of the 8051
microcontroller.
Comments and feedback on the various topics discussed in this book are welcome.

ACKNOWLEDGEMENTS

Preface
The authors are grateful for the timely help, encouragement and support extended by Narayan Rao R.
Maanay, Secretary, B.N.M. Institute of Technology, as well as Prof. T.J. Rama Murthy, Director, and
Dr. K. Ranga, Dean of the institution. They are thankful to the reviewers for their constructive sug-
gestions, which helped in enhancing the contents of this book. Finally, the authors are indebted to their
family members for their encouragement and forbearance.
K. Udaya Kumar
B. S. Umashankar
udayakumar_fm.qxp 4/16/2008 4:21 PM Page xiv

This page is intentionally left blank.


Udayakumar_ch_01.qxp 4/17/2008 7:33 PM Page 1

Fundamentals of
a Microprocessor

Chapter Heads

1 Evolution of Microprocessors
2 Fundamentals of a Computer
3 Number Representation
4 Fundamentals of Microprocessor
5 First Assembly Language Program
6 Data Transfer Group of Instructions
7 Arithmetic Group of Instructions
8 Logical Group of Instructions
9 NOP and Stack Group of Instructions
10 Branch Group of Instructions
11 Chip Select Logic
12 Addressing of I/O Ports
13 Architecture of 8085
Udayakumar_ch_01.qxp 4/2/2008 2:41 PM Page 2

INTRODUCTION
This part comprises of chaps. 1 to 14. Chapters 1 and 2 are intro-
ductory chapters which discuss the evolution of microprocessors
and the fundamentals of a computer, respectively. The following
chapters deal with the framework and internal architecture of a
microprocessor.
Udayakumar_ch_01.qxp 4/17/2008 7:33 PM Page 3

1
Evolution of
Microprocessors


Early integrated circuits

4-bit microprocessors

8-bit microprocessors

16-bit microprocessors

32-bit microprocessors

Recent microprocessors

Microcontrollers and digital signal processors

This chapter gives a crisp outline of the various stages in the evolution of today’s microprocessors.
Explicit information is given right from the integrated circuits through the 4-, 8-, 16- and 32-bit micro-
processors to the present-day microprocessors and microcontrollers.

 1.1 EARLY INTEGRATED CIRCUITS

The 1939–45 world war posed stringent envorinmental and operation requirements like standardiza-
tion, miniaturization, reliability, maintainability and the like on electronic communication equipment
components. Key improvements took place in the design and manufacture of electronic components.
After the war, the semiconductor transistor came into widespread use.
The concept of integrated circuit (IC), also known as ‘chip’, which integrates a circuit of several
electronic components into a solid block was envisaged in 1952. In 1959, the invention of planar
process with aluminium metallization by Robert Noyce and Jean Hoerni at Fairchild Semiconductor
enabled large-scale production of ICs.
The progress of integration of circuitry was very rapid. The small-scale integration (SSI) chip having
digital logic gates circuitry was introduced in 1964. Gordon Earle Moore at Fairchild Semiconductor
predicted that the number of transistors on a silicon chip would increase from 50 in 1965 to 65,000 in
1975. It was recognized as his first articulation of Moore’s law suggesting that the number of transistors
on a chip will double every year. Moore’s prediction indeed was true and medium-scale integration (MSI)
chip with a complete register circuit appeared in 1968. The large-scale integration (LSI) memory chip
(256-bit RAM) was produced by Fairchild in 1970. In 1971, the LSI chips with 1024-bit dynamic random
access memory (RAM) and Universal Asynchronous Receiver Transmitter (UART) were developed.
Udayakumar_ch_01.qxp 4/2/2008 2:41 PM Page 4

4
 1.2 4-BIT MICROPROCESSORS

The advent of microprocessors was accidental. Intel Corporation founded by Moore and Noyce in 1968
was initially focused on creating semiconductor memory (DRAMs and EPROMs) for digital comput-
The 8085 Microprocessor

ers. In 1969, a Japanese calculator manufacturer – Busicom approached Intel with a design for a small
calculator, which required 12 custom chips. Ted Hoff, an Intel engineer felt that a general-purpose logic
device could replace the separate multiple components. This idea led to the development of the first
microprocessor. Microprocessors made a modest beginning as the drivers for calculators.
Federico Faggin and Stanley Mazor realized Ted Hoff’s ideas into hardware at Intel. The result was
the Intel 4000 family comprising the 4001 (2K ROM), the 4002 (320-bit RAM), the 4003 (10-bit I/O
shift-register) and the 4004, a 4-bit central processing unit (CPU). Intel introduced the 4004
microprocessor to the worldwide market on November 15, 1971. It was a 4-bit PMOS chip with 2,300
transistors. It was not truly a general-purpose microprocessor as it was basically designed for a calcu-
lator. About the same time, Texas Instruments also developed the 4-bit microprocessor TMS 1000.
Texas Instruments is recognized as the inventor and owner of the microprocessor patent.

 1.3 8-BIT MICROPROCESSORS

Federico Faggin and his team at Intel designed a chip for controlling a CRT display produced by
Computer Terminals Corporation, later called Datapoint. This chip did not meet Datapoint’s functional
requirement of speed and they decided not to use it. Intel introduced this chip as world’s first 8-bit
general-purpose microprocessor 8008 in 1972. The Intel 8008 was used in the famous Mark-8
computer kit. On realizing the potential of this product, Intel introduced the improved 8008, the 8080
microprocessor in 1974. The Intel 8080 really created the microprocessor market. The other notable
8-bit microprocessors include Motorola 6800, designed for use in automotive and industrial applications,
and Rockwell PPS-8, Signetics 2650 having innovative and powerful instruction set architecture.
With improvements in integration technology, Intel was able to integrate the additional chips
required by the 8080, that is, the 8224 clock generator and the 8228 system controller along with the
8080 microprocessor within a single chip – the Intel 8085. The other improved 8-bit microprocessors
include Motorola MC6809 designed for high performance, Zilog Z-80 and RCA COSMAC designed
for aerospace applications.
In 1975, Moore recalled that his prediction of exponential growth in the complexity of integrated
circuits was true. He also forecast a change for the next decade indicating that the pace of complex-
ity increase would slow to a doubling every two years during the maturation of design capabilities.
With increase in processing power the microprocessors dominated as the CPU of digital comput-
ers. Earlier to the arrival of microprocessors, CPU was realized from individual SSI chips. The
digital computer that uses a single chip microprocessor as its CPU is referred to as a microcomputer.

 1.4 16-BIT MICROPROCESSORS

Intel introduced the 16-bit microprocessor 8086 (16-bit bus) in 1978 and 8088 (8-bit bus) in 1979. It
had 29,000 transistors. IBM selected the Intel 8088 for their personal computer (IBM-PC) introduced
in 1981. Intel released the 16-bit microprocessor 80286 (having 1,34,000 transistors) which was used
Udayakumar_ch_01.qxp 4/2/2008 2:41 PM Page 5

5
as CPU for the advanced technology personal computers (PC-AT) in 1982. It was called Intel 286 and
was the first Intel processor that could run all the software written for its predecessor Intel 8088. This
backward software compatibility was important for its commercial success. It is important to note that
this software compatibility remains a hallmark of Intel’s family of microprocessors.

Evolution of
1.5 32-BIT MICROPROCESSORS

Microprocessors


In 1985, Intel announced the 80386 a 32-bit microprocessor with 2,75,000 transistors. It supported
multitasking. Introduced in 1989, Intel 486 microprocessor was the first to offer a built-in math co-
processor. It had 1.2 million transistors.
In 1993, Intel Pentium microprocessor with 3.1 million transistors was introduced. It allowed
computers to process real-world data like speech, sound, handwriting and photographic images. The
7.5-million transistor Intel Pentium II microprocessor, introduced in 1997, was designed specifically
to process audio, video and graphics data efficiently. Intel Celeron processors range designed for the
value PC market segment were released from 1999.
Intel Pentium III processors with 9.5 million transistors designed for advanced imaging, 3D,
streaming audio, video and speech recognition applications and Intel Pentium III Xeon processors for
workstation and server market segments were introduced in 1999. Intel Pentium IV processors with
more than 42 million transistors introduced from 2000 are used in the present PCs. Users can create
professional quality movies, deliver TV-like video via the internet, communicate with real-time video
and voice, render 3D graphics in real time, quickly encode music for MP3 players and simultaneously
run several multimedia applications while connected to the Internet.
Intel Xeon processors introduced from 2001 are targeted for high-performance and mid-range,
dual-processor workstations, dual and multiprocessor server configurations coming in the range.

 1.6 RECENT MICROPROCESSORS

The Itanium processor is the first in a family of 64-bit products from Intel introduced in 2001. It is
well suited for the most demanding enterprise and high-performance computing applications like
e-Commerce security transactions, large databases, mechanical computer-aided engineering and
sophisticated scientific and engineering computing.
Introduced from 2003, the Intel Pentium M processor, the Intel 855 chipset family and the Intel
PRO/Wireless 2100 network connection are the three components of Intel Centrino mobile techno-
logy. Intel Centrino mobile technology is designed specifically for portable computing, with built-in
wireless local area network (LAN) capability and breakthrough mobile performance. It enables
extended battery life and thinner, lighter, mobile computers.

 1.7 MICROCONTROLLERS AND DIGITAL SIGNAL PROCESSORS

A microcontroller is a highly integrated chip that contains all the components comprising a controller.
Typically, this includes a CPU, RAM, some form of read only memory (ROM), input/output (I/O)
Udayakumar_ch_01.qxp 4/2/2008 2:41 PM Page 6

6
ports, timers and so on. Unlike a general-purpose computer, which also includes all of these compo-
nents, a microcontroller is designed for a very specific task – to control a particular system. As a result,
the number of parts can be reduced, which cuts down the cost. Microcontrollers are sometimes called
embedded microcontrollers, which just means that they are part of an embedded system – that is, one
part of a larger system. One of the popular 8-bit microcontrollers is Intel 8051.
The 8085 Microprocessor

Digital Signal Processor (DSP) is a special-purpose CPU used for digital signal processing appli-
cations. Once a signal is converted into digital data, its components can be isolated, analysed and
rearranged more easily than in analogue form using various algorithms, such as Fast Fourier Trans-
form. It provides ultrafast instruction sequences, such as shift and add, and multiply and add, which
are commonly used in math-intensive signal processing. DSP is used in many fields, including bio-
medicine, sonar, radar, seismology, audio, cell phones, sound cards, fax machines, modems, hard
disks, digital TV, speech and music processing, imaging and communications. It is also used to create
the concert hall and surround sound effects in stereo and home theatre equipments. One of the popu-
lar DSP chips is TMS320C54X from Texas instruments.
Microprocessors, microcontrollers and DSP chips are used in business machines, automotive
electronics, home appliances, electronic toys, variety of industrial applications and the like. Today,
there is no field in which microprocessors, microcontrollers or DSP chips have not made an impact.
Semiconductor Industries Association (SIA) has projected annual sales in the year 2006 for micro-
processors, microcontrollers and DSPs as $36.4 billion, $12.3 billion and $9 billion, respectively.
Udayakumar_ch_02.qxp 4/18/2008 11:53 AM Page 7

2
Fundamentals
of a Computer


Calculator
Computer


● Input devices

● Output devices

● Memory and its classification

● Arithmetic Logic Unit (ALU)

● Control unit and CPU

● Input and output ports


Microcomputer
● Microprocessor

● Microcontroller

Computer languages


●Machine language program


● Assembly language program

● High-level language program


Questions

This chapter outlines in brief the various components of a computer and their major functions. In the
first half of the chapter we deal with the advantages of a computer over a calculator. The chapter ends
with a small note on microcomputers and a detailed discussion of the various computer languages
along with their merits and demerits.

 2.1 CALCULATOR

A calculator is a hand-held equipment using which arithmetic calculations are performed very easily.
Block diagram of a calculator is shown in Fig. 2.1.
It will have keypad as an input device. Values needed in a calculation are provided to the calculator
using this keypad. There will be an arithmetic unit, which is responsible for performing the needed
Udayakumar_ch_02.qxp 3/15/2008 4:59 PM Page 8

LCD Display
The 8085 Microprocessor

Arithmetic Unit

Fig. 2.1
Block diagram of a
Keypad calculator

calculations. It is a semiconductor chip, which performs the calculations at electronic speeds.


Typically it can perform an addition operation in a microsecond.
In an arithmetic operation, say addition, the two inputs are entered using the keypad. The first value
that is input goes to the accumulator. The accumulator in turn, provides one input to the arithmetic
unit. Next the user inputs the operation to be performed by the arithmetic unit (e.g. ‘+’). Finally, the
user inputs the second value to the arithmetic unit using the keypad. Then the arithmetic unit performs
the add operation, under the control of the control unit, and displays the result on the LCD panel in
about a microsecond after the completion of the operation.
It takes the user about 3 seconds to get this result on the calculator assuming 1 second is needed
for inputting each of the values to be added, and 1 second is needed for inputing the operation to be
performed. However, the arithmetic unit utilized only about a microsecond for performing the calcu-
lation. Thus a calculator becomes slow in the hands as one cannot input values to the calculator at elec-
tronic speeds! This problem is overcome in a computer.

 2.2 COMPUTER

A computer is generally a desktop equipment, using which arithmetic calculations are performed at a
tremendous speed. Nowadays laptop computers as well as hand-held computers have emerged. The
blocks that make up a computer are shown in Fig. 2.2.

2.2.1 INPUT DEVICES

The input devices are used for supplying program and data to the memory. In other words, the com-
puter system reads the program and the data from the input devices. Most common input devices are
the keyboard and mouse.

2.2.2 OUTPUT DEVICES

Output devices are used for displaying or recording the results computed by the computer. Most
common output devices are the CRT display, printer, and plotter.
Udayakumar_ch_02.qxp 3/15/2008 4:59 PM Page 9

Output Devices

Fundamentals
Output Ports

of a Computer
Control Unit

Arithmetic Logic Unit Main Memory


(ALU)

Input Ports
Secondary Storage
Fig. 2.2
Blocks of a Von
Neumann computer
Input Devices

2.2.3 MEMORY AND ITS CLASSIFICATION

Compared to a calculator, the memory unit is an extra block. In the memory the entire set of opera-
tions that are to be performed is written using the keyboard as a sequence of instructions. This
sequence of instructions is called program. Also, the data on which the program is to operate is entered
using the keyboard, and can be stored in memory. Memory can also be used for storing intermediate
and final results. This design of a stored program computer where program, data, and result reside in
memory is due to Von Neumann.
Memory can be classified into main memory and secondary memory. Secondary memory is also fre-
quently termed as auxiliary memory. Main memory has the drawback of high-cost and low-capacity
storage. But its advantage is the high speed of data transfer. The control unit can directly communicate
with the main memory but not with the secondary memory. Main memory can be broadly classified
into random access memory (RAM) and read only memory (ROM).

Random access memory (RAM): RAM consists of a number of memory locations where in each
location typically 8 bits are stored. (A bit is a binary digit. Thus it can have only one of the two
values 0 or 1.) It is possible to read from a RAM location, as well as write to a RAM location. The
disadvantage of RAM is that it is volatile. What it means is that, the moment power supply to the
RAM is switched off, the information in the RAM will be lost.

Sequential Access: There are two types of accessing information. They are sequential access and ran-
dom access. In sequential access it is necessary to access information strictly in an order. If there are
100 memory locations, it has to be accessed in the order of 1, 2, 3, ... 100. Thus, it takes least time to
access information from location 0 and maximum time to access information from location 100. An
example device that employs sequential access is the magnetic tape.
Udayakumar_ch_02.qxp 3/15/2008 4:59 PM Page 10

10
Random Access: In random access technique, it is possible to access a memory location in any order.
For example, one can read from the 100 locations in the order of 45, 34, 67, 28, 57, and so on.
Second, it takes the same time to read from a memory location irrespective of its position. In a RAM,
the method of access is random, and its name in fact is derived based on the method of access.
Read only memory (ROM): ROM also consists of a number of memory locations where in each loca-
The 8085 Microprocessor

tion typically 8 bits are stored. A ROM also uses random access technique just like a RAM. The advan-
tage of ROM is that it is nonvolatile. What it means is that, even if the power supply to the ROM is
switched off, the information in the ROM will not be lost. However, it is only possible to read from a
ROM location. Thus, in a computer ROM is used for storing information that should not be lost when
power is switched off. But first of all how to store information in a ROM? To answer this question, semi-
conductor manufacturers provide several versions of ROM whose characteristics are briefly discussed in
the following.
Mask-programmed ROM: It derives this name because the information is written to this type of
ROM at the time of manufacture using a suitable mask. Once the manufacturer writes this type of
ROM, it is not possible to change this information even by the manufacturer. The information entered
is permanent. It is cheap compared to the other types of ROMs, when cost per unit quantity is consid-
ered. But the user has to place an order for a large number at a time. Thus, ROMs are used in equip-
ments that are produced in large quantities. To give an analogy, mask-programmed ROMs are similar
to books that are printed in large volumes.
PROM: It stands for ‘programmable read only memory’. The user writes information to this type of
ROM using PROM programmer equipment. Once the user writes this type of ROM, it is not possible
to change this information anymore. The information entered is permanent. Although it is costlier
compared to a mask ROM, it is cheap compared to the other types of ROMs discussed successively
in this chapter. The advantage is that the user is free to buy even a single piece of PROM from a local
shop. Thus, PROMs are used in equipment that are produced in small quantities. To extend the anal-
ogy PROMs are similar to blank notebooks that are written by a user making use of an ink pen.
EPROM: It stands for ‘erasable programmable read only memory’. Information is written to this type
of ROM by the user using a EPROM programmer equipment. After the user writes this type of ROM,
it is possible to change this information a number of times. Thus, although the information entered is
not lost when power is switched off, it is possible to erase it and then write new information. Erasing
of the EPROM is done by exposure of strong ultraviolet (UV) light from a very close distance on the
quartz window of the EPROM chip. Then the contents of the entire EPROM are lost. For this purpose
UV light eraser equipment are available. Although it is costlier compared to a mask ROM or a PROM,
it is very popular. The user is free to buy even a single piece of EPROM from a local shop. Thus,
EPROMs are used during the development phase of the equipment. They are also frequently used in

Type of ROM Info. entered Possible to Cost per chip Min. order Method of erasing Application
by change info? quantity info. area

Mask- Manufacturer No Cheapest Large Not possible Large-scale


programmed production
ROM
PROM User No Costlier One Not possible Medium-scale
production
EPROM User Yes Even more One Using strong R&D
costly UV source
EEPROM User Yes Costliest One Using electrical R&D
signals
Udayakumar_ch_02.qxp 3/15/2008 4:59 PM Page 11

11
equipments that are produced in small quantities. To extend the analogy writing to an EPROM is sim-
ilar to writing on sand using a stick. If a strong breeze comes everything is erased!
EEPROM or EAPROM: It stands for ‘electrically erasable (or alterable) programmable read only
memory’. Information is written to this type of ROM by the user using a EPROM programmer equip-
ment. After the user writes this type of ROM, it is possible to change this information a number of

Fundamentals
times. Thus although the information entered is not lost when power is switched off, it is possible to
erase it and then write new information. However, erasing of the EEPROM is done by electrical sig-

of a Computer
nals. Then the contents of the EEPROM can be selectively erased. It is costlier compared to the other
types of ROMs, and is gaining in popularity. The user is free to buy even a single piece of EEPROM
from a local shop. Thus EEPROMs are used during the development phase of the equipment. They
are also frequently used in equipments that are produced in small quantities. To extend the analogy
EEPROMs are similar to blank notebooks that are written by a user making use of a soft pencil. The
information can be selectively rubbed out and new information can be written.
If an EPROM or an EEPROM can be used for reading as well as writing information, and is also
nonvolatile, what is the use of RAM? The problem with any type of ROM is that although reading
from the ROM is fast, the writing (if permitted) is very slow, and the erasing (if permitted) is
extremely slow. Also the writing of the EPROM is not possible when the program is in execution. To
give an example, some typical EPROM chips allow reading from a memory location in less than a
microsecond, write to a memory location in about 50 ms, and is erased in about 30 minutes.

Secondary memory: Sometimes there is a need to have more amount of information than is possible
to store in a main memory. In such cases it is stored in the secondary memory. This type of memory
is characterized by virtues of large capacity for storage and low cost per bit of storage. But its disad-
vantage is its very low speed for access. The control unit does not directly access secondary storage.
Typical examples for secondary memory are the hard disk, floppy disk, and magnetic tape.

2.2.4 ARITHMETIC LOGIC UNIT (ALU)

In a computer, there is an ALU, which is capable of performing logical operations (like AND, OR, Ex-
OR, Invert) in addition to the arithmetic operations. The control unit supplies the data required by the
ALU from memory, or from input devices, and directs the ALU to perform a specific operation based on
the instruction fetched from the memory. ALU is the ‘calculator’ portion of the computer.

2.2.5 CONTROL UNIT AND CPU

The control unit fetches one instruction at a time from the main memory, and then executes it. In this
execution, it makes use of the ALU, if the instruction execution involves an arithmetic or logical oper-
ation (like AND, OR, Ex-OR). This fetching and execution is done at electronic speeds, say in less
than a microsecond. Then the control unit fetches and executes the next instruction from the memory,
and so on, till the program is completed and the result is output using the output device. In many com-
puters, the control unit and the ALU are integrated into a single block, and this single block is termed
as the central processing unit (CPU).
The point to be noted here is that the control unit is fetching the instructions from the main memory
at electronic speeds, rather than from a human being through a keypad at terribly low speeds. In a cal-
culator we may indicate an operation to be performed by the arithmetic unit in 1 second. In a computer,
the control unit fetches and executes more than 1 million instructions at the same time. This is what
makes the computer much faster than a calculator. Is a calculator obsolete in view of the above virtues
Udayakumar_ch_02.qxp 3/15/2008 4:59 PM Page 12

12
of the computer? It is not. The reason is simple. If it is required to find the roots of a given quadratic
equation one needs only about 1 minute when using a calculator. But using a computer it may take as
much as a few hours to develop an error-free program for this problem. It depends on the ability of
the programmer. Once the program is developed it takes only a few microseconds to execute the pro-
gram to obtain the roots of the quadratic equation. Thus a calculator is the choice if the calculation is
The 8085 Microprocessor

required to be done only once. A computer is the choice if the calculations are required to be done a
number of times with different sets of data.

2.2.6 INPUT AND OUTPUT PORTS

CPU and the main memory are very fast compared to electromechanical input or output devices like
printers, etc. In such a case it is essential that the data lines of the computer is not kept engaged for a
long time during communication with input/output (I/O) devices. Otherwise the overall speed of the
computer system comes down drastically. So I/O devices are connected to a computer through I/O
ports.
For example, to communicate with a printer, the CPU loads the output port connected to the printer
at electronic speeds. This is slowly printed by the printer. When the printer has finished printing, the
output port requests the CPU for further data. This way, the CPU is allowed to work at its full speed
with no degradation in the overall speed of the computer system.

 2.3 MICROCOMPUTER

A microcomputer is a small sized, inexpensive, and limited capability computer. It has the same blocks
that are present in a computer. Present-day microcomputers are very small in size. They are of the size
of a notebook. In the days to come they are bound to become still smaller. They are very cheap so that
many individuals can possess them as their personal computers. Because of mass production they are
becoming still cheaper. Many early microcomputers were not very powerful. For example, they did not
have even a simple multiply instruction in their instruction set. Also, they could work only on unsigned
integer data. But present-day microcomputers have not only multiply and divide instructions on
unsigned and signed numbers, but are also capable of performing floating point arithmetic operations.
In fact they are more powerful than the mini computers and main computers of yesteryear.

2.3.1 MICROPROCESSOR

Microprocessor is the CPU part of a microcomputer, and is available as a single integrated circuit.
Thus a microprocessor will have the control unit and the ALU of a microcomputer. An example
is Intel 8085 microprocessor. In addition to the microprocessor, a microcomputer will have the
following:

– ROM/PROM/EPROM/EEPROM for storing program;


– RAM for storing data, intermediate results, and final results;
– I/O devices for communication with the outside world;
– I/O ports for communication with the I/O devices.
Udayakumar_ch_02.qxp 3/15/2008 4:59 PM Page 13

13
Microprocessors are extensively used in the present-day world. Before the advent of the micro-
processor, logic design was done by hardware using gates, flip flops, etc. A mini computer was too
expensive to think of. With the advent of the microprocessor, logic design using hardware is mostly
replaced by design using a microprocessor. This provides ‘flexible’ instrumentation where just by
changing the software it is possible to change the characteristics of the system. Also, new generations

Fundamentals
of applications have surfaced, which were not thought of earlier because of the prohibitive cost of a
mini computer or the complexity of logic design using hardware. A few of the applications using

of a Computer
microprocessors are listed below.

– Business applications such as desk-top publishing;


– Industrial applications such as power plant control;
– Measuring instruments such as multi meter;
– Household equipments such as washing machine;
– Medical equipments such as blood pressure monitor;
– Defence equipments such as light combat aircraft;
– Computers such as personal computer.

2.3.2 MICROCONTROLLER

It is possible to integrate on a single chip all of the blocks that are needed in a microcomputer, except
the I/O devices. Such a chip is termed a microcontroller. An example is Intel 8751. A few of the blocks
on the 8751 are:

– 4K ⫻8 bits of EPROM;
– 128 ⫻8 bits of RAM;
– 4 numbers of 8 bit I/O ports.

It also has timers and facility for serial communication. Microcontrollers are used in a variety of
instruments like washing machines, printer sharer, computer keyboards, etc. They are basically used
in equipment where the size and cost are required to be very small compared to a microcomputer, and
where lots of complex calculations are not needed.

 2.4 COMPUTER LANGUAGES

In this section we describe the evolution of computer languages starting from the machine language
to the high-level languages. Their merits and demerits are discussed at length.

2.4.1 MACHINE LANGUAGE PROGRAM

A program can be written using only 0s and 1s. The data can also be specified using only 0s and 1s.
Such a program is called machine language program. Machine language was the first in the
evolution of computer programming languages. Computer directly understands a program written in
the machine language. In fact, even to this day, basically computers understand only the 0s and 1s.
Udayakumar_ch_02.qxp 3/15/2008 4:59 PM Page 14

14
Disadvantages of machine language program: Writing a program in machine language has the
following drawbacks.
 It is very tiresome to work with and highly error prone. While writing the program, a 1 and 0 can get
interchanged due to typographical error. But then it is very difficult to locate it for correction.
 By a glance through the program, it is very difficult to visualize the function of the program. In
The 8085 Microprocessor

fact, it is very difficult to make out whether a particular bit sequence is an instruction in the pro-
gram, or a data value, or the output result. This is because data, result, and an instruction are rep-
resented using 0s and 1s in machine language.
 The same program does not work on another computer by a different manufacturer. This is
because machine language is different for different computers. For example, on one computer the
bit sequence 10100110 may mean ‘add two numbers’, and may mean ‘subtract two numbers’ on
another computer. In other words, a program written in machine language is said to be ‘not
portable’.
 To write a program in machine language one must be highly conversant with the organization and
architecture of the computer system being used.

Advantages of machine language program: The only advantages of writing in machine language are:

 Machine language program is executed faster than a program written in a high-level language
(high-level language is discussed a little later).
 A translator like compiler is not needed and so results in a cheaper computer system.

To conclude, machine language is rarely used nowadays, except where very high-speed execution is
required. It is also used in cheap microcomputer systems.

2.4.2 ASSEMBLY LANGUAGE PROGRAM

The next development in the evolution of computer languages was the assembly language. Assembly
language uses mnemonics in place of a sequence of 0s and 1s. For example, to add register A and B
in a particular computer, assembly language uses the mnemonic ‘ADD B’ in place of 10000000. Also,
assembly language uses symbolic names to denote addresses and data. A number of such examples are
dealt with in the successive chapters. Thus writing a program in assembly language has advantages
over writing the same in a machine language.

Disadvantages of assembly language program: However, the disadvantages of writing in assem-


bly language are:

 The same program does not work on another computer by a different manufacturer. This is because
assembly language is different for different computers. For example, on one computer the mnemonic
‘ADD E’ may mean ‘add contents of A register and E register’, and may have no meaning at all on
another computer. In other words, a program written in assembly language is also not portable.
 To write a program in assembly language one must be highly conversant with the organization and
architecture of the computer system being used.
 An assembler, which is a translator program, is needed for translating the assembly language pro-
gram into machine code. But each assembly language instruction is translated into only one
Udayakumar_ch_02.qxp 3/15/2008 4:59 PM Page 15

15
instruction in the machine language. As such the assembler program is not a very huge one, and
so is quite cheap.

Advantages of assembly language program: The advantages of writing in assembly language are:

Fundamentals
 It is less tiresome to work with and much less error prone. While writing the program, if a typo-
graphical error occurred due to oversight, it is much easier to locate it for correction. In most

of a Computer
cases, the assembler program detects it.
 By a glance through the program it is much easier to visualize the function of the program.
 As far as speed of execution is concerned machine language and assembly language have equal
speed of execution. Thus assembly language program is also executed faster than a program writ-
ten in a high-level language (high-level language is discussed next).

To conclude, assembly language is rarely used nowadays except where very high-speed execution is
required. However, it is widely used in microcomputer systems. Both machine language and assem-
bly language are termed as low-level languages.

2.4.3 HIGH-LEVEL LANGUAGE PROGRAM

The next development in the evolution of computer languages is the high-level language. Some exam-
ples for high-level languages are as follows:

BASIC (for ‘Beginners All Purpose Symbolic Instruction Code’);


FORTRAN (for ‘Formula Translation’);
COBOL (for ‘COmmon Business Oriented Language’);
Pascal (named after the French scientist Blaise Pascal).

High-level languages use English-like language, but with less words and fewer ambiguities. For
example, in English the word ‘can’ can have different meanings based on the context. It is possible to
use it as a noun or a verb in a sentence. But high-level languages use only a few words, with each word
having a unique meaning.

Disadvantages of high-level languages: However, the disadvantages of writing in high-level


languages are:

 A compiler, which is a translator program, is needed for translating the high-level language pro-
gram into machine code. But each high-level language instruction is translated into more than one
instruction in the machine language. As such the compiler program is a huge one and so is quite
expensive.
 The code generated by the compiler might not be as compact as written straightaway in low-level
language. Thus a program written in high-level language usually takes longer to execute.

Advantages of high-level languages: But writing a program in a high-level language has the
following advantages over writing the same in a low-level language.
Udayakumar_ch_02.qxp 4/18/2008 11:53 AM Page 16

16
 It is very easy to learn a high-level language and is a pleasure to work with. While writing the
program, if a typographical error occurred due to oversight, it is much easier to locate it for
correction. Most of the times the compiler detects it.
 By a glance through the program it is easy to visualize the function of the program.
 The programmer is not required to be familiar with the organization or the architecture of the com-
The 8085 Microprocessor

puter system being used. Thus even school children can work with high-level languages.
 The same program works on any other computer, provided the other computer has a compiler for
the language in which the program is written. In other words the programs written in high-level
languages are portable.
 Productivity is enormously increased.

To conclude, high-level languages are almost always used nowadays except where very high-speed
execution is required.

QUESTIONS

1. What is the difference between a calculator and a computer? What makes a computer faster
than a calculator?
2. Briefly explain the blocks that constitute a stored program computer.
3. Name a few input and output devices and their role in a computer.
4. Explain the terms ‘random access’ and ‘sequential access’. Identify the type of access in
the following:
a. RAM,
b. EPROM,
c. ROM,
d. Magnetic tape.
5. Distinguish between main memory and secondary memory. Identify the memory type for
the following:
a. Magnetic disk,
b. RAM,
c. Magnetic tape,
d. EEPROM.
6. Describe the features of various types of ROMs.
7. Describe the role of ALU and control unit in a computer.
8. What is the need for input ports and output ports?
9. Differentiate microprocessor, microcontroller, and microcomputer.
10. Give an overview of the evolution of computer languages, highlighting the merits and
demerits of each type of language.
Udayakumar_ch_03.qxp 4/18/2008 12:39 PM Page 17

3
Number
Representation

 Unsigned binary integers


Signed binary integers


● Sign Magnitude notation

● 1’s complement notation

● 2’s complement notation

 Representation of fractions
● 2’s complement fractions
 Signed floating point numbers
 Questions

A computer is quite often used for performing computations on numbers. The types of numbers on
which the computer is required to perform calculations are: unsigned integers; signed integers; and
signed floating point numbers.
In a digital computer everything, whether it is some data, result, or an instruction, has to be rep-
resented using only 0s and 1s. This is because the digital computer basically uses transistors that are
made to work in the ‘Off’ state or the ‘On’ state. The ‘Off’ state is generally represented as the 0 state
and the ‘On’ state is represented as 1 state. In computers 0s and 1s are called ‘bits’. A bit stands for
‘BInary digiT’.

 3.1 UNSIGNED BINARY INTEGERS

Unsigned binary integers are numbers without any ‘⫹’ or ‘⫺’ sign. Examples are: number of books
in a library, runs scored by a batsman in a cricket match, etc. Obviously they are unsigned integers
like 34,567 and 87. These numbers have to be represented in a computer using only binary notation
or bits. Numbers are represented in a computer using a fixed size, like 4, 8, 16, 32 bits, etc. If num-
bers are represented in a computer using 8 bits, it is said that the computer uses 8-bit word size. Gen-
erally, word sizes are a power of 2. In the early days of computing, word sizes were generally 4 bits.
These days, it is generally 32 bits or 64 bits. A tabular column of decimal numbers and their equiva-
lent in unsigned binary is shown in the following, assuming a word size of 4 bits.
Udayakumar_ch_03.qxp 3/15/2008 5:00 PM Page 18

18

Number Unsigned binary notation

5 0101
13 1101
0 0000 Minimum number, which is 0
15 1111 Maximum number, which is (24  1)

In this table, just as 13 in decimal notation is 1  101  3  100, 1101 in binary is 1  23 


The 8085 Microprocessor

1  22  0  21  1  20. From this, it is obvious that if the word size is n bits, the range of (2n1)
numbers that can be represented is from 0 to (2n1). A table of word size and the range of unsigned
integers that can be represented is shown here.

Word size Range for unsigned numbers

4 0 to 15
8 0 to 255
16 0 to 65535
32 0 to 4,294,967,295

In other words, when the word size is only 4 bits, it is not possible to represent a number like 223.
The minimum word size has to be 8 bits to represent the number 223.

 3.2 SIGNED BINARY INTEGERS

Signed integers are numbers with a ‘’ or ‘’ sign. An example is the list of temperatures (correct to
nearest digit) in various cities of the world. Obviously they are signed integers like 34, 15, 23,
and 17. These numbers along with their sign have to be represented in a computer using only binary
notation or bits.
There are various ways of representing signed numbers in a computer. The simplest way of repre-
senting a signed number is the sign magnitude (SM) method.

3.2.1 SIGN MAGNITUDE NOTATION

In this method of representing signed numbers, the most significant bit (MSB) indicates the sign of
the number. The number is treated as positive, if the MSB is 0. It is negative if the MSB is 1. The other
bits indicate the magnitude of the number.
A tabular column of signed decimal numbers and their equivalent in SM notation follows assuming
a word size of 4 bits.

Number SM notation

5 0 101
5 1 101
3 0 011
3 1 011
7 0 111 Most positive number, which is (23  1)
0 0 000 Notation for 0
0 1 000 Notation for 0
7 1 111 Most negative number, which is (23  1)
Udayakumar_ch_03.qxp 3/15/2008 5:00 PM Page 19

19
From this table, it is obvious that if the word size is n bits, the range of numbers that can be repre-
sented is from (2n1  1) to (2n1  1). A table of word size and the range of SM numbers that
can be represented is shown in the following.

Word size Range for SM numbers

4 7 to 7

Number
8 127 to 127
16 32767 to 32767
32 2147483647 to 2147483647

Representation
In other words, when the word size is only 4 bits, it is not possible to represent a number like 123.
The minimum word size has to be 8 bits to represent the number 123.
Notice that the bit sequence 1101 corresponds to the unsigned number 13, as well as the number 5
in SM notation. Its value depends only on the way the user or the programmer interprets the bit sequence.
A number is represented inside a computer with the purpose of performing some calculation using
that number. The most basic arithmetic operation in a computer is the addition operation. The follow-
ing examples show the result of adding two signed numbers that are represented inside the computer
in SM notation.

Example 1: Add the numbers (5) and (3) using a computer. The numbers are assumed to be
represented using 4-bit SM notation.
1111 ← Carries generated during addition
0101 ← (+5)
1011 ← (−3)
——––
0000 ← Sum
The computer instead of giving the correct answer of 2  0010, has given the wrong answer of
0  0000! To give the correct answer the computer will have to manipulate the result of addition
quite a lot.

Example 2: Add the numbers (4) and (2) using a computer. The numbers are assumed to be rep-
resented using 4-bit SM notation.
0000 ← Carries generated during addition
1100 ← (−4)
0010 ← (+2)
———
1110 ← Sum
The computer instead of giving the correct answer of 2  1010, has given the wrong answer of 6
 1110! To give the correct answer the computer will have to manipulate the result of addition quite a lot.

Thus to conclude: SM notation is very simple to understand because it is very similar to the conven-
tional way of representing signed numbers. But its disadvantages are:

 There are two notations for 0 (0000 and 1000), which is very inconvenient when the computer
wants to test for a 0 result.
 It is not convenient for the computer to perform arithmetic.

Hence, SM notation is generally not used to represent signed numbers inside a computer.
Udayakumar_ch_03.qxp 3/15/2008 5:00 PM Page 20

20
3.2.2 1’S COMPLEMENT NOTATION

This is another method of representing signed integers in a computer. In this method also, the MSB
indicates the sign of the number. The number is treated as positive, if the MSB is 0. It is negative if
the MSB is 1. However, the other bits directly indicate the magnitude of the number only when the
number is positive. If the number is negative, the other bits signify the 1’s complement of the magni-
The 8085 Microprocessor

tude of the number.


A tabular column of signed decimal numbers and their equivalent in 1’s complement notation is
shown below, assuming a word size of 4 bits.
Number 1’s complement notation

5 0 101
5 1 010
3 0 011
3 1 100
7 0 111 Most positive number, which is (231)
0 0 000 Notation for 0
0 1 111 Notation for 0
7 1 000 Most negative number, which is (23  1)

From the given table, it is obvious that if the word size is n bits, the range of numbers that can be
represented is from (2n1  1) to (2n1  1). A table of word size and the range of 1’s complement
numbers that can be represented is shown.
Word size Range for 1’s complement numbers

4 7 to 7
8 127 to 127
16 32767 to 32767
32 2147483647 to 2147483647

In other words, when the word size is only 4 bits, it is not possible to represent a number like 123.
The minimum word size has to be 8 bits to represent the number 123.
Notice that the bit sequence 1101 corresponds to the following values in different notations.
—1101 is 13 in unsigned notation,
—1101 is 5 in SM notation,
—1101 is 2 in 1’s complement notation.
Its value depends only on the way the user or the programmer interprets the bit sequence. Exam-
ples for addition of two signed numbers represented using 1’s complement notation are shown below.
Example 1: Add the numbers (5) and (3) using a computer. The numbers are assumed to be rep-
resented using 4-bit 1’s complement notation.
1100 ← Carries generated during addition
0101 ← (+5)
1100 ← (−3)
———
0001 ← Sum
The computer instead of giving the correct answer of 2  0010, has given the wrong answer of
1  0001! However, to get the correct answer the computer will have to simply add to the result the
final carry that is generated, as shown in the following.
Udayakumar_ch_03.qxp 3/15/2008 5:00 PM Page 21

21
0001
 1
———
0010  2

Example 2: Add the numbers (4) and (2) using a computer. The numbers are assumed to be rep-
resented using 4-bit 1’s complement notation.

Number
0010 ← Carries generated during addition

Representation
1011 ← (−4)
0010 ← (+2)
———
1101 ← Sum

After the addition of the final carry, the result remains as 1101. This is 2, which is the correct
answer. If it is not clear, as to how 1101 is 2, the following explanation should make it clear. In
1 101 the MSB is a 1. It means the number is negative. Then, the remaining bits do not provide the
magnitude directly. To solve this problem, just consider 1’s complement of 1 101. 1’s complement of
1 101 is 0 010, which is 2. Thus, 1 101, which is 1’s complement of 0 010 is 2.

Thus to conclude: 1’s complement notation is not very simple to understand because it is very much
different from the conventional way of representing signed numbers. The other disadvantage is that
there are two notations for 0 (0000 and 1111), which is very inconvenient when the computer wants
to test for a 0 result.
But, it is quite convenient for the computer to perform arithmetic. To get the correct answer after
addition, the result of addition and final carry has to be added up.
Hence, 1’s complement notation is also generally not used to represent signed numbers inside a
computer.

3.2.3 2’S COMPLEMENT NOTATION

This is yet another method of representing signed integers in a computer. In this method also, the MSB
indicates the sign of the number. The number is treated as positive, if the MSB is 0. It is negative if
the MSB is 1. However, the other bits directly indicate the magnitude of the number only when the
number is positive. If the number is negative, the other bits signify the 2’s complement of the magni-
tude of the number.
Thus a positive number has the same representation in SM, 1’s complement, and 2’s complement
notations. Only negative numbers are represented differently in these notations.

Number 2’s complement notation

5 0 101
5 1 011
3 0 011
3 1 101
7 0 111 Most positive number, which is (23  1)
0 0 000 Notation for 0
7 1 001
8 1 000 Most negative number, which is 23
Udayakumar_ch_03.qxp 3/15/2008 5:00 PM Page 22

22
A tabular column of signed decimal numbers and their equivalent in 2’s complement notation is
shown below, assuming a word size of 4 bits.
Notice that there is a single notation for 0, immaterial of whether it is 0 or 0. One may feel that
0 000 is 0 only, as the MSB in this case is a 0. But then, the notation for 0 should be the 2’s com-
plement of 0 000, which is 1111  1  0 000 ignoring the carry.
If it is not clear, as to how 1000 is 8, the following explanation should make it clear. In 1 000 the
The 8085 Microprocessor

MSB is a 1. It means the number is negative. Then, the remaining bits do not provide the magnitude
directly. To solve this problem, just consider 2’s complement of 1 000. 2’s complement of 1 000 is
0 111  1  7  1  8. Thus, 1 000 is 8.
An alternative way of arriving at the same conclusion is as follows. Shown in the following discus-
sion is the 2’s complement notations for 5, 6, 7 and 5, 6, 7. Then a question mark is placed
to indicate the value of 1 000. Using the rules of mathematical induction, 1 000 can be interpreted as
either 8 or 8. However, 8 is not correct, as the MSB is 1. Thus, 1 000 has the value 8 in 2’s
complement notation.

0 101  5
0 110  6
0 111  7
1 000  ?
冎 1 011  5
2’s complement 1 010  6
1 001  7
1 000  ?

Thus, in 2’s complement notation an extra negative number can be represented compared with SM
or 1’s complement notation. This is because, in 2’s complement notation, there is only a single nota-
tion for zero, whereas in SM and 1’s complement notations there are two notations for 0.
From this, it is obvious that if the word size is n bits, the range of numbers that can be represented
is from 2n1 to (2n1  1). A table of word size and the range of 2’s complement numbers that
can be represented is shown next.

Word size Range for 2’s complement numbers

4 8 to 7
8 128 to 127
16 32768 to 32767
32 2147483648 to 2147483647  2  10 9 (approx.)

In other words, when the word size is only 4 bits, it is not possible to represent a number like 123.
The minimum word size has to be 8 bits to represent the number 123.
Notice that the bit sequence 1101 corresponds to the following values in different notations.

—1101 is 13 in unsigned numbers


—1101 is 5 in SM notation
—1101 is 2 in 1’s complement notation
—1101 is 3 in 2’s complement notation

Its value depends only on the way the user or the programmer interprets the bit sequence.
Examples for addition of two signed numbers represented using 2’s complement notation are
shown next.
Udayakumar_ch_03.qxp 3/15/2008 5:00 PM Page 23

23
Example 1: Add the numbers (5) and (3) using a computer. The numbers are assumed to be rep-
resented using 4-bit 2’s complement notation.
1101 ← Carries generated during addition
0101 ← (+5)
1101 ← (−3)
————

Number
0010 ← Sum
Notice that the computer straightaway gives the correct answer of 2  0010.

Representation
Example 2: Add the numbers (4) and (2) using a computer. The numbers are assumed to be rep-
resented using 4-bit 2’s complement notation.
0000 ← Carries generated during addition
1100 ← (−4)
0010 ← (+2)
————
1110 ← Sum
This is 2, which is the correct answer. If it is not clear, as to how 1110 is 2, the following expla-
nation should make it clear. In 1 110 the MSB is a 1. It means the number is negative. Then, the
remaining bits do not provide the magnitude directly. To solve this problem, just consider 2’s comple-
ment of 1 110. 2’s complement of 1 110 is 0 001  1  0 010, which is 2. Thus, 1 110, which is 2’s
complement of 0 010 is 2.

Thus to conclude: 2’s complement notation is not very simple to understand because it is very much
different from the conventional way of representing signed numbers.
But, its advantage is that there is a single notation for zero, which is very convenient when the com-
puter wants to test for a 0 result. Also, it is very convenient for the computer to perform arithmetic.
The addition operation straightaway gives the correct result.
Hence, 2’s complement notation is generally used to represent signed numbers inside a computer.

 3.3 REPRESENTATION OF FRACTIONS

It may be necessary quite often to represent fractions. For example, it may be needed to represent
inside a computer a value like 0.875 or 0.875. This topic is discussed next.
Let us say we have the 4-bit number 1001. Then, what is its value? It has the value 9, 1, 6, or
7 depending on whether it is unsigned, SM number, 1’s complement number, or 2’s complement
number, respectively. Thus the value a given sequence of bits will have depends purely on the inter-
pretation of the user.
So far, only integers were discussed. Thus, a number like 1000 was assumed to have the binary
point at the extreme right of the bit sequence. To represent signed fractions, it is necessary to assume
the binary point just after the MSB in the bit sequence.
The MS bit specifies the sign of a number. But then, how to specify the binary point inside a
computer? This problem is easily solved if all numbers are required to have the binary point at the
same position in the bit sequence. For example, if all numbers are required to have the binary point
Udayakumar_ch_03.qxp 3/15/2008 5:00 PM Page 24

24
just after the MS bit, it is just assumed that it exists there! Such numbers where the binary point is
assumed to be at a fixed position in the bit sequence are called fixed-point numbers.
Just as there are unsigned, SM, 1’s complement, and 2’s complement integers, there are also
unsigned, SM, 1’s complement, and 2’s complement fractions. Unsigned fractions will have the
assumed binary point at the extreme left. SM, 1’s complement, and 2’s complement fractions will have
this imaginary binary point just to the right of the MS bit.
The 8085 Microprocessor

If the imaginary point is at the extreme right, then the number is an integer. If the imaginary binary
point is at the extreme left for an unsigned number, the number is an unsigned fraction. If the binary
point is to the immediate right of the MS bit, the number is a signed fraction. If the binary point is in
the middle of a bit sequence, the number has an integer and a fractional part.
Only 2’s complement fractions, which are the most common, are discussed next.

3.3.1 2’S COMPLEMENT FRACTIONS

For simplicity, the word size is assumed to be 4 bits. It will be generalized to n bits later. The word
0 001 is interpreted as 0.001 if it is a 2’s complement fraction. Just as 0.345 decimal has the value
3  101  4  102  5  103, the bit sequence 0.001 will have the value 0  21  0  22 
1  23  0.125, and is treated as 0.125 as the MS bit is 0.
As another example, what is the value of 1 001, if the interpretation is that it is a 2’s complement
fraction? It is 1.001 assuming the binary point after the MS bit. As the MS bit is 1, it is a negative
number. Then the remaining bits do not specify the magnitude directly. The 2’s complement of 1 000
is 0110  1  0 111. This is a positive fraction with the value 1  21  1  22  1  23  0.5
 0.25  0.125  0.875 decimal. Thus, 0.875 is the value of 1 001.
A tabular column of signed decimal fractions and their equivalent in 2’s complement notation is
shown below, assuming a word size of 4 bits.

Fraction 2’s complement notation

0.5 0 100
0.5 1 100
0.25 0 001 Smallest magnitude non-zero value is 23
0.25 1 111 Smallest magnitude non-zero value is 23
+0.875 0 111 Largest positive magnitude value is (123)
0.875 1 001
1.0 1 000 Largest negative magnitude value is 1.0
0 0 000

From the above, it is obvious that if the word size is n bits, the smallest magnitude non-zero
fraction that can be represented is 2(n1). A table of word size and the smallest magnitude fraction
that can be represented is shown in the following.

Word size Smallest magnitude 2’s complement fraction

4  0.125
8  0.0078125
16  0.0000305
32  0.5  109

In other words, when the word size is only 4 bits, it is not possible to represent a number like
0.0123 quite accurately. The minimum word size has to be 8 bits to represent the number 0.0123
somewhat accurately. The accuracy is very much improved if the word size is further increased.
Udayakumar_ch_03.qxp 4/18/2008 12:39 PM Page 25

25
 3.4 SIGNED FLOATING POINT NUMBERS

In our daily life, we work many times with real numbers, which will have an integer part and a frac-
tional part. An example is 23.456. But this notation is not convenient for representing very large mag-
nitude numbers, like ⫺123456789.4567. This same number can be more conveniently represented in

Number
scientific notation as ⫺1.2345678 ⫻ 10⫹08. But this actually stands for ⫺123456780. So there is an
error of 9.4567, which forms a very small percentage error.

Representation
However, the advantage of this scientific notation is that a very much larger number than
⫺1.2345678 ⫻ 10⫹08 can be represented using same number of digits. For example, ⫹9.9999999 ⫻
10⫹99 is the largest magnitude positive number using same number of digits.
Similarly, the way we represent real numbers in our daily life is not convenient for representing
very small numbers, like ⫹0.00000045678912. This same number can be more conveniently repre-
sented in scientific notation as ⫹4.56789 ⫻ 10⫺07. But this actually stands for ⫹0.000000456789. So
there is an error of 0.00000000000012, which forms a very small percentage error.
However, the advantage of this scientific notation is that a very much smaller magnitude number
than ⫹4.56789 ⫻ 10⫺07 can be represented using same number of digits. For example, ⫺1.00000 ⫻
10⫺99 is the smallest magnitude negative number using the same number of digits.
Using fixed-point notation, when the word size is as large as 32 bits, the largest magnitude signed
integer that can be represented is approximately ⫾2 ⫻ 10⫹09 only. And the smallest non-zero magni-
tude signed fraction that can be represented is approximately ⫾0.5 ⫻ 10⫺09 only when the word size
is 32 bits.
So to represent very large, or very small signed numbers, with a word size of say, 32 bits, a com-
puter uses floating point notation. This may result in small errors, but the error will be negligible, if
large number of digits is reserved for the fractional part. But the important thing is that much larger
range of numbers can be represented than is possible with fixed-point notation.
A floating-point number like ⫹1.23 ⫻ 104 can be written in several equivalent ways as ⫹12.3 ⫻
10 or ⫹0.123 ⫻ 105.
3

Similarly, there are several ways of representing floating point numbers in a computer also. As an
example, in the 32-bit floating point notation used in Intel 8087 numeric co-processor, the largest
magnitude number is approximately ⫾ 5.12 ⫻ 10⫹38 and the smallest magnitude number is approxi-
mately ⫾ 8 ⫻ 10⫺39. The interested reader can refer to the book ‘Advanced Microprocessors and IBM-
PC Assembly Language Programming’ by Udaya kumar and Umashankar (Tata McGraw Hill Publi-
cation) for more details.

QUESTIONS

1. Give examples for unsigned integers, signed integers, and floating point numbers.
2. Explain how unsigned numbers are represented in a digital computer. If such numbers are
represented using 16 bits, what will be the range?
3. Explain how signed numbers are represented in a digital computer using SM notation. If such
numbers are represented using 32 bits, what will be the range?
4. Explain how signed numbers are represented in a digital computer using 1’s complement
notation. If such numbers are represented using 8 bits, what will be the range?
5. Explain how signed numbers are represented in a digital computer using 2’s complement
notation. If such numbers are represented using 64 bits, what will be the range?
Udayakumar_ch_03.qxp 3/15/2008 5:00 PM Page 26

26
6. Fill up the following table with the values of the bit sequences in unsigned integer, SM inte-
ger, etc.

Unsigned SM 1’s comp. 2’s comp. 2’s comp. fraction

0110 1100 ? ? ? ? ?
1110 0110 ? ? ? ? ?
The 8085 Microprocessor

1011 0011 ? ? ? ? ?

7. What are the advantages of 2’s complement notation over SM and 1’s complement notations
in representing signed numbers?
8. How can fractions be represented in a computer using fixed-point notation? Explain the 2’s
complement method of representing fixed-point fractions.
Udayakumar_ch_04.qxp 4/18/2008 12:39 PM Page 27

4
Fundamentals of
Microprocessor

 History of microprocessors
 Description of 8085 pins
● VCC, and VSS pins

● AD7-0 pins

● A15-8 pins

● ALE pin

● IO/M* pin

 Programmer’s view of 8085: Need for registers


● Meaning of programmer’s view

 Accumulator or register A
 Registers B, C, D, E, H, and L
 Questions

 4.1 HISTORY OF MICROPROCESSORS

The history of microprocessors dates back to only the year 1971! By this time, the integrated circuits
technology was so much developed that it was possible to integrate on a single chip the logic of con-
trol unit and ALU. Intel Corporation in the USA announced the first microprocessor in 1971. It was
the Intel 4004. It was a 4-bit processor intended for making programmable calculators.
A 4-bit microprocessor receives 4 bits of information from outside the microprocessor, performs the
necessary processing on it, and then sends out of the microprocessor a 4-bit result. It will have an ALU that
can perform operations on 4-bit numbers. It is said that a 4-bit microprocessor has a word size of 4 bits.
With only 4 bits as the word size, the 4004 could only represent signed numbers in the range
⫺8 to ⫹7, which is indeed very small. Hence, it was not really of practical use for arithmetic
calculations. However, it found applications in controlling devices. For example, it could be used to
switch on or switch off a motor. This was achieved by sending out logic 1 or logic 0 from the
microprocessor, and making use of a suitable driver circuitry.
Similarly, it could be used for checking if the temperature of a water bath is above or below a
certain desired temperature. This was done by the reading of the logic 1 or 0 value that was developed
Udayakumar_ch_04.qxp 3/15/2008 5:01 PM Page 28

28
by a temperature sensor after proper signal conditioning. The microprocessor can receive this infor-
mation on a single pin to check the temperature.
Next in the evolution was the Intel 8008, the first 8-bit microprocessor. This was in the year 1972. This
was soon followed by Intel 8080, also an 8-bit microprocessor. Intel 8080 was the first commercially
popular 8 bit microprocessor. With 8 bits as the word size, it could represent signed numbers in the
range of ⫺128 to ⫹127. This is also not a good enough range for performing arithmetic calculations.
The 8085 Microprocessor

Thus, the 8080 also was used only for control applications.
By this time, some other manufacturers of integrated circuits who were till then manufacturing only
components like logic gates, flip flops, shift registers, etc. got fascinated by this new product, and they
also released to the market their designs of microprocessor. Notable among them was the 6800 from
Motorola and Z-80 from Zilog.
The 6800 design was based on the popular PDP-11 minicomputer of those days. This chip became
quite popular for control applications. Z-80 was basically an improvement over the 8080, with a large
number of new and powerful instructions. This chip also became very popular in the field of control
applications.
In the meanwhile, Intel came out with their improvement over the 8080. This was the Intel 8085.
This was only a hardware improvement over 8080. As far as instruction set was concerned, there was
basically no improvement. However, the 8085 also became very popular. The 6800, Z-80, and 8085
are all only 8-bit microprocessors, and they rule the 8-bit microprocessor world in control
applications.
Around the year 1974, Intel released Intel 8048 family, their first microcontroller family. This was
later followed by the Intel 8051 series of microcontrollers. Still later Intel released 8096 family of
microcontrollers. In the present-day world, a large number of microcontrollers are being used in a
variety of consumer products.
Around 1978, Intel released 8086, the first 16-bit microprocessor. With 16-bit word size, it was
possible to represent signed numbers in the range of ⫺32,768 to ⫹32,767, which is quite a decent
range for performing arithmetic calculations. As such, this processor became very popular not only for
control applications, but also for number crunching operations. Not to be outdone, Motorola came out
with 68000, their 16-bit processor. Zilog released Z-8000, again a 16-bit processor. These are the most
popular 16-bit processors.
Then IBM Corporation released the first personal computer (IBM-PC) using 8088 as the CPU
developed by Intel. The Intel 8088 has the same instruction set as the 8086. However, it can only
receive 8 bits at a time from outside, and send out 8 bits at a time. Internally it is capable of perform-
ing 16-bit arithmetic. This chip was designed to make use of the processing power of a 16-bit ALU,
while being capable of communicating with the common 8 bit peripheral devices of those days. The
IBM-PC became extremely popular, and has now pervaded all walks of our lives. IBM released IBM-
PC/XT a little later, using the same Intel 8088. This computer had a hard disk drive in addition to the
floppy drives of the earlier PC.
From then on, the development of newer and more powerful processors has been very swift. Intel
released 80186, which was mainly used in embedded applications. Then Intel released 80286, which
was used in IBM-PC/AT. The processor could be used in multi-user, multi-tasking environment. How-
ever, the 80186 and 80286 were still 16-bit processors. In the meanwhile Motorola released 68010,
also a 16-bit processor. Around this time Zilog lost the race to capture a major share in the market,
with Intel and Motorola emerging as the forerunners to the top spot.
In the early 80s, Intel released the 32-bit processor, the Intel 80386. With 32-bit word size, it was pos-
sible to represent signed numbers in the range ⫾2 ⫻109, which is quite a large range for performing
arithmetic calculations. If floating point notation is used, it can represent much larger numbers. As such,
this processor became very popular as the CPU in computers for number crunching operations. Not to
Udayakumar_ch_04.qxp 3/15/2008 5:01 PM Page 29

29
be outdone, Motorola came out with 68020, their 32-bit processor. Intel released 80486, which was basi-
cally a 80386 processor and 80387 numeric co-processor on a single chip. Motorola released 68030. In
the early 90s Intel deviated from their naming tradition and released 80586 by the name Pentium proces-
sor. It is extremely fast in performing arithmetic calculations and executing instructions. The Pentium 4
released in 2000 has 42 Million transistors worked with a clock frequency of 1.5 GHz and is rated for

Fundamentals of
1500 MIPS (Million instructions per second)
To conclude, the present-day computers based on microprocessors are already faster than the mini

Microprocessor
computers and sometimes the main frame computers of yesteryear, and they are available at a small
fraction of the cost of such main frame computers. We can hope to see the release of still more
powerful and at the same time cheaper microprocessors and microcontrollers in the future.
In this book, Intel 8085 processor will be discussed at great length. Armed with that knowledge,
Zilog Z-80, Motorola 6800 processors, and Intel 8051 microcontroller will be discussed quite exhaus-
tively in a few chapters.

 4.2 DESCRIPTION OF 8085 PINS

Intel 8085 is fabricated as a 40-pin DIP IC. DIP stands for ‘dual inline package’. It means the pack-
age will have pins on only two sides, 20 on each side in this case.
Intel manufactures 8085 in several versions, like 8085A, 8085AH, 8085AH-2, and 8085AH-1. The
8085A is fabricated using NMOS technology. It is a variant of MOS (metal oxide semiconductor)
technology. It uses n channel silicon-gate process. The AH series are more expensive processors,
which use high-density MOS (HMOS) for fabrication. They typically consume 20% less power com-
pared to the A series. The recommended internal clock frequency for the various types of 8085 is as
follows.

Type Recommended clock frequency

8085A and 8085AH 3 MHz


8085AH-2 5 MHz
8085AH-1 6 MHz

Basically they are same, the only difference being in the speed of operation, or the technology used
for fabrication. In this discussion, they are simply referred to as 8085. The pin diagram of 8085 is as
shown in fig. 4.1.
In fig. 4.1, the pin number and its associated function is indicated for each of the 40 pins. For exam-
ple, the diagram indicates that pin number 20 is the Vss pin, which should be connected to ground, and
40 is the Vcc pin, which should be connected to ⫹5 V dc supply. A user definitely needs this informa-
tion, when he is required to wire up a microprocessor in his circuit. However, for the purpose of under-
standing the working of the processor, only the function of the various pins need to be known. There
is no need to know which pin number performs what function. For example, to understand the work-
ing of 8085 microprocessor, the user should be aware that it needs a power supply of ⫹5 V dc and
ground. It is not necessary to know the pin numbers to which ⫹5 V dc and ground are to be connected.
A simplified diagram that does not indicate the pin numbers, but only indicates the function of the
various pins, can be called a functional pin diagram. Fig. 4.2 partly provides the functional pin
diagram of 8085. It shows only 22 pins. The remaining portion is explained later in the text.
Udayakumar_ch_04.qxp 3/15/2008 5:01 PM Page 30

30

X1 1 40 Vcc
X2 2 39 Hold
Reset out 3 38 HLDA
SOD 4 37 Clk out
The 8085 Microprocessor

SID 5 36 Reset in
Trap 6 35 Ready
RST 7.5 7 34 IO/M*
RST 6.5 8 33 S1
RST 5.5 9 32 RD*
INTR 10 31 WR*
8085
INTA* 11 30 ALE
AD0 12 29 S0
AD1 13 28 A15
AD2 14 27 A14
AD3 15 26 A13
AD4 16 25 A12
AD5 17 24 A11
AD6 18 23 A10
AD7 19 22 A9
Vss 20 21 A8 Fig. 4.1
Pin diagram of 8085

Vcc AD7-0
Gnd
A15-8

8085 ALE
RD*
Fig. 4.2
WR*
IO/M*
Functional pin diagram
of 8085 (incomplete)

4.2.1 VCC AND VSS PINS

Any IC needs a power supply for its working. Similarly, 8085 needs a power supply of ⫹5 V dc for
its working. Pin 40 of 8085 is the Vcc pin. It should be connected to ⫹5 V dc power supply. Pin 20 of
8085 is the Vss pin. It should be connected to power supply ground.

4.2.2 AD7-0 PINS

Intel 8085 communicates with the outside world with 8 bits at a time. When the 8085 desires
to receive 8-bit information, it receives it on the eight pins AD7, AD6, ... ,AD0. These eight pins are
Exploring the Variety of Random
Documents with Different Content
the awful cloud: ‘Let there be light again! Tell my people, the
poor and oppressed, to go out from the old world, from
oppression and blood, and build my altar in the new!’
“As I live, my friends, I believe that to be His voice! Yes,
were my soul trembling on the verge of eternity, were this
hand freezing in death, were this voice choking in the last
struggle, I would still with the last impulse of that soul, with
the last wave of that hand, with the last gasp of that voice,
implore you to remember this truth—God has given America
to be free! Yes, as I sank into the gloomy shadows of the
grave, with my last faint whisper I would beg you to sign that
parchment for the sake of the millions whose very breath is
now hushed in intense expectation as they look up to you for
the awful words, ‘You are free!’”
The unknown speaker fell exhausted in his seat; but the
work was done.
A wild murmur runs through the hall. “Sign!” There is no
doubt now. Look how they rush forward! Stout-hearted John
Hancock has scarcely time to sign his bold name before the
pen is grasped by another—another and another. Look how
the names blaze on the parchment! Adams and Lee, Jefferson
and Carroll, Franklin and Sherman.
And now the parchment is signed.
Now, old man in the steeple, now bare your arm and let the
bell speak! Hark to the music of that bell! Is there not a
poetry in that sound, a poetry more sublime than that of
Shakespeare and Milton? Is there not a music in that sound
that reminds you of those sublime tones which broke from
angel lips when the news of the child Jesus burst on the hill-
tops of Bethlehem? For the tones of that bell now come
pealing, pealing, pealing, “Independence now and
Independence forever.”
CHILD LOST.
It used to be a custom to have a man go through
the town ringing a bell and “crying” any thing was
lost. You should imitate the crier, at the same time
swinging your hand as if ringing a bell. This selection
requires a great variety in the manner, pitch of the
voice and gestures of the reader.
“Nine,” by the Cathedral clock!
Chill the air with rising damps;
Drearily from block to block
In the gloom the bellman tramps—
“Child lost! Child lost!
Blue eyes, curly hair,
Pink dress—child lost!”

Something in the doleful strain


Makes the dullest listener start;
And a sympathetic pain
Shoot to every feeling heart.
Anxious fathers homeward haste,
Musing with paternal pride
Of their daughters, happy-faced,
Silken-haired and sparkling-eyed.
Many a tender mother sees
Younglings playing round her chair,
Thinking, “If ’twere one of these,
How could I the anguish bear?”

“Ten,” the old Cathedral sounds;


Dark and gloomy are the streets;
Still the bellman goes his rounds,
Still his doleful cry repeats—
“Oh, yes! oh, yes!
Child lost! Blue eyes,
Curly hair, pink dress—
Child lost! Child lost!”

“Can’t my little one be found?


Are there any tidings, friend?”
Cries the mother, “Is she drowned?
Is she stolen? God forfend!
Search the commons, search the parks,
Search the doorway and the halls,
Search the alleys, foul and dark,
Search the empty market stalls.
Here is gold and silver—see!
Take it all and welcome, man;
Only bring my child to me,
Let me have my child again.”

Hark! the old Cathedral bell


Peals “eleven,” and it sounds
To the mother like a knell;
Still the bellman goes his rounds.
“Child lost! Child lost!
Blue eyes, curly hair,
Pink dress—child lost!”

Half aroused from dreams of peace,


Many hear the lonesome call,
Then into their beds of ease
Into deeper slumber fall;
But the anxious mother cries,
“Oh, my darling’s curly hair!
Oh, her sweetly-smiling eyes!
Have you sought her everywhere?
Long and agonizing dread
Chills my heart and drives me wild—
What if Minnie should be dead?
God, in mercy, find my child!”

“Twelve” by the Cathedral clock;


Dimly shine the midnight lamps;
Drearily from block to block,
In the rain the bellman tramps.
“Child lost! Child lost!
Blue eyes, curly hair,
Pink dress—child lost!”

THE CAPTAIN AND THE FIREMAN.


Spin us a yarn of the sea, old man,
About some captain bold,
Who steered his ship and made her slip
When the sea and the thunder rolled;
Some tale that will stir the blood, you know,
Like the pirate tales of old.

“It was the old ‘tramp’ Malabar,


With coal for Singapore;
‘The captain stood upon the bridge’
And loud the wind did roar,
And far upon the starboard bow
We saw the stormy shore.

“The night came down as black as pitch;


More loud the wind did blow;
The waves made wreck around the deck
And washed us to and fro;
But half the crew, though wild it blew,
Were sleeping down below.

“‘The captain stood upon the bridge,’


And I was at the wheel;
The waves were piling all around,
Which made the old ‘tank’ reel,
When—smash! there came an awful crash
That shook the ribs of steel.

“‘We’ve struck a wreck!’ ‘Stand by the pumps!’


Her plates were gaping wide;
And out her blood streamed in the flood,
The wreck had bruised her side;
Her coal poured out—her inky blood—
And stained the foaming tide.

“‘The captain stood upon the bridge,’


The firemen down below;
He saw and knew what he could do,
While they but heard the blow.
The bravest man is he that stands
Against an unseen foe.

“‘All hands on deck!’ was now the cry,


‘For we are sinking fast;
Our boats were stove by that last wave—
This night will be our last;
There’s not a plank on board the tank,
She’s steel, from keel to mast.’

“‘The captain stood upon the bridge;’


All hands were now on deck;
The waves went down, the sun came up,
We saw the drifting wreck,
And there, upon the starboard bow,
The land—a distant speck.

“‘Who’ll go below and fire her up?”


The captain loud did roar.
‘We’re dumping coal with every roll,
But, see! the storm is o’er;
And I will stand upon the bridge,
And guide her to the shore.’

“‘I’ll go for one,’ said old ‘Tramp Jim,’


‘And shovel in the coal.
I’ll go,’ said Jim, all black and grim,
‘Though death be down that hole;
I’ve heard a man who dies for men
Is sure to save his soul.

“‘So turn the steam into that mill,


And let it spin around,
And I will feed the old thing coal
Till you be hard aground;
I’ll go alone, there’s none to moan,
If old ‘Tramp Jim’ be drowned!’

“He went below and fired her up,


The steam began to roar;
‘The captain stood upon the bridge’
And steered her for the shore;
The ship was sinking by the bow,
Her race was nearly o’er.

“The water rose around poor Jim,


Down in the fire-room there.
‘I’ll shovel in the coal,’ he gasped,
‘’Till the water wets me hair—
The Lord must take me as I am,
I have no time for prayer.’

“‘The captain stood upon the bridge.’


(Oh, hang that phrase, I say!
‘The firemen bravely stood below,’
Suits more this time of day,)
Old Jim kept shovelling in the coal,
Though it was time to pray.

“And every soul was saved, my lads,


Why do I speak it low?
The Lord took Jim, all black and grim,
And made him white as snow.
Some say, ‘the captain on the bridge,’
But I say, ‘Jim below!’”

W. B. Collison.

THE FACE ON THE FLOOR.


This is one of many recitations in this volume that
have proved their popularity by actual test. “The
Face on the Floor,” when well recited, holds the
hearers spell-bound.
’Twas a balmy summer evening, and a goodly crowd was
there
That well nigh filled Joe’s barroom on the corner of the
square,
And as songs and witty stories came through the open door;
A vagabond crept slowly in and posed upon the floor.
“Where did it come from?” some one said;
“The wind has blown it in.”
“What does it want?” another cried, “Some whiskey, beer or
gin?”
“Here, Toby, seek him, if your stomach’s equal to the work,
I wouldn’t touch him with a fork, he’s as filthy as a Turk.”

This badinage the poor wretch took with stoical good grace,
In fact, he smiled as if he thought he’d struck the proper
place;
“Come, boys, I know there’s kindly hearts among so good a
crowd;
To be in such good company would make a deacon proud.

“Give me a drink! That’s what I want, I’m out of funds, you


know,
When I had cash to treat the gang, this hand was never
slow;
What? You laugh as if you thought this pocket never held a
sou;
I once was fixed as well, my boys, as any one of you.

“There, thanks, that braced me nicely, God bless you, one


and all,
Next time I pass this good saloon I’ll make another call;
Give you a song? No, I can’t do that, my singing days are
past,
My voice is cracked, my throat’s worn out and my lungs are
going fast.

“Say, give me another whiskey and I’ll tell you what I’ll do—
I’ll tell you a funny story, and a fact, I promise, too;
That I was ever a decent man, not one of you would think,
But I was, some four or five years back, say, give us another
drink.
“Fill her up, Joe, I want to put some life into my frame—
Such little drinks to a bum like me are miserably tame;
Five fingers—there, that’s the scheme—and corking whiskey,
too,
Well, boys, here’s luck, and landlord, my best regards to you.

“You’ve treated me pretty kindly and I’d like to tell you how
I came to be the dirty sot you see before you now;
As I told you, once I was a man, with muscle, frame and
health,
And, but for a blunder, ought to have made considerable
wealth.

“I was a painter—not one that daubed on bricks and wood.


But an artist, and, for my age, was rated pretty good;
I worked hard at my canvas, and was bidding fair to rise;
For gradually I saw the star of fame before my eyes.

“I made a picture, perhaps you’ve seen, ’tis called the Chase


of Fame;
It brought me fifteen hundred pounds, and added to my
name;
And then, I met a woman—now comes the funny part—
With eyes that petrified my brain, and sunk into my heart.

“Why don’t you laugh? ’Tis funny that the vagabond you see
Could ever love a woman and expect her love for me;
But ’twas so, and for a month or two her smile was freely
given;
And when her loving lips touched mine, it carried me to
heaven.

“Boys, did you ever see a girl for whom your soul you’d give,
With a form like the Milo Venus, too beautiful to live,
With eyes that would beat the Kohinoor and a wealth of
chestnut hair?
If so, ’twas she, for there never was another half so fair.

“I was working on a portrait one afternoon in May,


Of a fair-haired boy, a friend of mine who lived across the
way,
And Madeline admired it, and much to my surprise,
Said that she’d like to know the man that had such dreamy
eyes.

“It didn’t take long to know him, and before the month had
flown;
My friend had stole my darling, and I was left alone;
And ere a year of misery had passed above my head,
The jewel I had treasured so had tarnished and was dead.

“That’s why I took to drink, boys. Why, I never saw you


smile,
I thought you’d be amused and laughing all the while;
Why, what’s the matter, friend? There’s a teardrop in your
eye,
Come, laugh like me, ’tis only babes and women that should
cry.

“Say, boys, if you’ll give me another whiskey, I’ll be glad,


And I’ll draw right here, the picture of the face that drove
me mad;
Give me that piece of chalk with which you mark the base-
ball score—
And you shall see the lovely Madeline upon the bar-room
floor.”

Another drink, and with chalk in hand, the vagabond began


To sketch a face that well might buy the soul of any man,
Then, as he placed another lock upon the shapely head,
With a fearful shriek he leaped and fell across the picture—
dead.
H. Antoine D’Arcy.

THE ENGINEER’S STORY.


Han’som, stranger? Yes, she’s purty an’ ez peart ez she can
be.
Clever? Wy! she ain’t no chicken, but she’s good enough fur
me.
What’s her name? ’Tis kind o’ common, yit I ain’t ashamed
to tell,
She’s ole “Fiddler” Filkin’s daughter, an’ her dad he calls her
“Nell.”

I wuz drivin’ on the “Central” jist about a year ago


On the run from Winnemucca up to Reno in Washoe.
There’s no end o’ skeery places. ’Taint a road fur one who
dreams,
With its curves an’ awful tres’les over rocks an’ mountain
streams.

’Twuz an afternoon in August, we hed got behind an hour


An’ wuz tearin’ up the mountain like a summer thunder-
shower,
Round the bends an’ by the hedges ’bout ez fast ez we could
go,
With the mountain-peaks above us an’ the river down below.

Ez we come nigh to a tres’le ’cros’t a holler, deep an’ wild,


Suddenly I saw a baby, ’twuz the stationkeeper’s child,
Toddlin’ right along the timbers with a bold and fearless
tread
Right afore the locomotive, not a hundred rods ahead.
I jist jumped an’ grabbed the throttle an’ I fa’rly held my
breath,
Fur I felt I couldn’t stop her till the child wuz crushed to
death,
When a woman sprang afore me like a sudden streak o’
light,
Caught the boy and twixt the timbers in a second sank from
sight.

I jist whis’l’d all the brakes on. An’ we worked with might an’
main
Till the fire flew from the drivers, but we couldn’t stop the
train,
An’ it rumbled on above her. How she screamed ez we rolled
by
An’ the river roared below us—I shall hear her till I die!

Then we stop’t; the sun was shinin’; I ran back along the
ridge
An’ I found her—dead? No! livin’! She wuz hangin’ to the
bridge
Wher she drop’t down thro’ the cross-ties with one arm
about a sill
An’ the other round the baby, who wuz yellin’ fur to kill!

So we saved ’em. She wuz gritty. She’s ez peart ez she kin


be—
Now we’re married; she’s no chicken, but she’s good enough
fur me,
An’ ef eny ask who owns her, wy! I ain’t ashamed to tell—
She’s my wife. Ther’ ain’t none better than ole Filkin’s
daughter “Nell.”

Eugene J. Hall.
JIM.
He was jes’ a plain, ever’-day, all-round kind of a jour.,
Consumpted lookin’—but la!
The jokeyest, wittyest, story-tellin’, song-singin’, laughin’est,
jolliest
Feller you ever saw!
Worked at jes’ coarse work, but you kin bet he was fine
enough in his talk,
And his feelin’s, too!
Lordy! ef he was on’y back on his bench again to-day, a
carryin’ on
Like he ust to do!

Any shop-mate’ll tell you they never was on top o’dirt


A better feller’n Jim!
You want a favor, and couldn’t git it anywheres else—
You could git it o’ him!
Most free-heartedest man thataway in the world, I guess!
Give ever’ nickel he’s worth—
And, ef you’d a-wanted it, and named it to him, and it was
his,
He’d a-give you the earth!

Allus a-reachin’ out, Jim was and a-helpin’ some


Poor feller onto his feet—
He’d a-never a-keered how hungry he was his se’f.
So’s the feller got somepin to eat!
Didn’t make no difference at all to him how he was dressed,
He used to say to me:
“You tog out a tramp purty comfortable in winter-time,
And he’ll git along!” says he.

Jim didn’t have, nor never could git ahead, so overly much
O’ this world’s goods at a time—
’Fore now I’ve saw him, more’n onc’t lend a dollar and ha’f
to
Turn ’round and borry a dime!
Mebby laugh and joke about hisse’f fer awhile—then jerk his
coat,
And kind o’ square his chin,
Tie his apern, and squat hisse’f on his old shoe bench
And go peggin’ agin.

Patientest feller, too, I reckon, at every jes’ naturally


Coughed hisse’f to death!
Long enough after his voice was lost he’d laugh and say,
He could git ever’thing but his breath—
“You fellers,” he’d sort o’ twinkle his eyes and say,
“Is pilin’ onto me
A mighty big debt for that air little weak-chested ghost o’
mine to pack
Through all eternity!”

Now there was a man ’at jes’ ’peared like to me,


’At ortn’t a-never died!
“But death hain’t a-showin’ no favors,” the old boss said,
“On’y to Jim,” and cried:
And Wigger, ’at put up the best sewed work in the shop,
Er the whole blamed neighborhood,
He says, “When God made Jim, I bet you He didn’t do
anything else that day,
But jes’ set around and feel good.”

James Whitcomb Riley.

QUEEN VASHTI’S LAMENT.


Is this all the love that he bore me, my husband, to publish
my face
To the nobles of Media and Persia, whose hearts are
besotted and base?
Did he think me a slave, me, Vashti, the Beautiful, me,
Queen of queens,
To summon me thus for a show to the midst of his bacchanal
scenes?

I stand like an image of brass, I, Vashti, in sight of such


men!
No, sooner, a thousand times sooner, the mouth of the
lioness’ den,
When she’s fiercest with hunger and love for the hungry
young lions that tear
Her teats with sharp, innocent teeth, I would enter, far
rather than here!

Did he love me, or is he, too, though the King, but a brute
like the rest!
I have seen him in wine, and I fancied ’twas then that he
loved me the best;
Though I think I would rather have one sweet, passionate
word from the heart
Than a year of caresses that may with the wine that creates
them depart.

But ever before, in his wine, toward me he showed honor


and grace;
He was King, I was Queen, and those nobles, he made them
remember their place.
But now all is changed; I am vile, they are honored, they
push me aside,
A butt for Memucan and Shethar and Meres, gone mad in
their pride!
Shall I faint, shall I pine, shall I sicken and die for the loss of
his love?
Not I; I am queen of myself, though the stars fall from
heaven above.
The stars! ha! the torment is there, for my light is put out by
a star,
That has dazzled the eyes of the King and his court and his
captains of war.

He was lonely, they say, and he looked, as he sat like a


ghost at his wine,
On the couch by his side, where, of yore his Beautiful used
to recline.
But the King is a slave to his pride, to his oath and the laws
of the Medes,
And he cannot call Vashti again though his poor heart is
wounded and bleeds.

So they sought through the land for a wife, while the King
thought of me all the while—
I can see him, this moment, with eyes that are lost for the
loss of a smile,
Gazing dreamily on while each maiden is temptingly passed
in review,
While the love in his heart is awake with the thought of a
face that he knew!

Then she came when his heart was grown weary with loving
the dream of the past!
She is fair—I could curse her for that, if I thought that this
passion would last!
But e’en if it last, all the love is for me, and, through good
and through ill,
The King shall remember his Vashti, shall think of his
Beautiful still.
Oh! the day is a weary burden, the night is a restless strife,

I am sick to the very heart of my soul, with this life—this
death in life!
Oh! that the glorious, changeless sun would draw me up in
his might,
And quench my dreariness in the flood of his everlasting
light!

What is it? Oft as I lie awake and my pillow is wet with tears,
There comes—it came to me just now—a flash, then
disappears;
A flash of thought that makes this life a re-enacted scene,
That makes me dream what was, will be, and what is now,
has been.

And I, when age on age has rolled, shall sit on the royal
throne,
And the King shall love his Vashti, his Beautiful, his own,
And for the joy of what has been and what again will be,
I’ll try to bear this awful weight of lonely misery!

The star! Queen Esther! blazing light that burns into my


soul!
The star! the star! Oh! flickering light of life beyond control!
O King! remember Vashti, thy Beautiful, thy own,
Who loved thee and shall love thee still, when Esther’s light
has flown!

John Reade.

THE SKELETON’S STORY.


It will require all the dramatic power of which you
are capable to recite this selection and do it full
justice. Be wide-awake, quick in tone and gesture,
shouting at one time, whispering at another,
speaking with your whole body. The emotions of fear
and horror are especially prominent.
It is two miles ahead to the foot-hills—two miles of parched
turf and rocky space. To the right—the left—behind, is the
rolling prairie. This broad valley strikes the Sierra Nevadas
and stops as if a wall had been built across it.
Ride closer! What is this on the grass? A skull here—a rib
there—bones scattered about as the wild beasts left them
after the horrible feast. The clean-picked skull grins and
stares—every bone and scattered lock of hair has its story of
a tragedy. And what besides these relics? More bones—not
scattered, but lying in heaps—a vertebra with ribs attached—
a fleshless skull bleaching under the summer sun. Wolves!
Yes. Count the heaps of bones and you will find nearly a
score. Open boats are picked up at sea with neither life nor
sign to betray their secret. Skeletons are found upon the
prairie, but they tell a plain story to those who halt beside
them. Let us listen:
Away off to the right you can see treetops. Away off to the
left you can see the same sight. The skeleton is in line
between the two points. He left one grove to ride to the
other. To ride! Certainly; a mile away is the skeleton of a
horse or mule. The beast fell and was left there.
It is months since that ride, and the trail has been
obliterated. Were it otherwise, and you took it up from the
spot where the skeleton horse now lies, you would find the
last three or four miles made at a tremendous pace.
“Step! step! step!”
What is it? Darkness has gathered over mountain and
prairie as the hunter jogs along over the broken ground.
Overhead the countless stars look down upon him—around
him is the pall of night. There was a patter of footsteps on
the dry grass. He halts and peers around him, but the
darkness is too deep for him to discover any cause for alarm.
“Patter! patter! patter!”
There it is again! It is not fifty yards from where he last
halted. The steps are too light for those of an Indian.
“Wolves!” whispers the hunter, as a howl suddenly breaks
upon his ear.
Wolves! The gaunt, grizzly wolves of the foot-hills—thin and
poor and hungry and savage—the legs tireless—the mouth
full of teeth which can crack the shoulder-bone of a buffalo.
He can see their dark forms flitting from point to point—the
patter of their feet upon the parched grass proves that he is
surrounded.
Now the race begins. A line of wolves spread out to the
right and left, and gallops after—tongues out—eyes flashing—
great flakes of foam flying back to blotch stone and grass and
leave a trail to be followed by the cowardly coyotes.
Men ride thus only when life is the stake. A horse puts forth
such speed only when terror follows close behind and causes
every nerve to tighten like a wire drawn until the scratch of a
finger makes it chord with a wail of despair. The line is there
—aye! it is gaining! Inch by inch it creeps up, and the red eye
takes on a more savage gleam as the hunter cries out to his
horse and opens fire from his revolvers. A wolf falls on the
right—a second on the left. Does the wind cease blowing
because it meets a forest! The fall of one man in a mad mob
increases the determination of the rest.
With a cry so full of the despair that wells up from the
heart of the strong man when he gives up his struggle for life
that the hunter almost believes a companion rides beside
him, the horse staggers—recovers—plunges forward—falls to
the earth. It was a glorious struggle; but he has lost.
There is a confused heap of snarling, fighting, maddened
beasts, and the line rushes forward again. Saddle, bridle, and
blanket are in shreds—the horse a skeleton. And now the
chase is after the hunter. He has half a mile the start, and as
he runs the veins stand out, the muscles tighten, and he
wonders at his own speed. Behind him are the gaunt bodies
and the tireless legs. Closer, closer, and now he is going to
face fate like a brave man should. He has halted. In an
instant a circle is formed about him—a circle of red eyes,
foaming mouths, and yellow fangs which are to meet in his
flesh.
There is an interval—a breathing spell. He looks up at the
stars—out upon the night. It is his last hour, but there is no
quaking—no crying out to the night to send him aid. As the
wolves rest, a flash blinds their eyes—a second—a third—and
a fourth, and they give before the man they had looked upon
as their certain prey. But it is only for a moment. He sees
them gathering for the rush, and firing his remaining bullets
among them he seizes his long rifle by the barrel and braces
to meet the shock. Even a savage would have admired the
heroic fight he made for life. He sounds the war-cry and
whirls his weapon around him, and wolf after wolf falls
disabled. He feels a strange exultation over the desperate
combat, and as the pack give way before his mighty blows a
gleam of hope springs up in his heart.
It is only for a moment; then the circle narrows. Each
disabled beast is replaced by three which hunger for blood.
There is a rush—a swirl—and the cry of despair is drowned in
the chorus of snarls as the pack fight over the feast.
The gray of morning—the sunlight of noonday—the stars of
evening will look down upon grinning skull and whitening
bones, and the wolf will return to crunch them again. Men will
not bury them. They will look down upon them as we look,
and ride away with a feeling that ’tis but another dark secret
of the wonderful prairie.

THE LADY AND THE EARL.


The figures in the text of this piece indicate the
gestures to be made, as shown in Typical Gestures,
at the beginning of Part II. of this volume.
I saw her in the festive halls, in scenes of pride and16 glee,
’Mongst many beautiful and fair, but none so fair as she;
Hers was the most attractive2 form that mingled in the
scene,
And all who saw her said she moved a goddess and a queen.

The diamond blazed in her dark hair and bound her polished
brow,
And precious gems were clasped around her swan-like neck
of snow;
And Indian looms had lent their stores to form her
sumptuous dress,
And art with nature joined to grace her passing loveliness.

I looked upon her and I said, who6 is so blessed as she?


A creature she all light and life, all beauty and all glee;
Sure,5 sweet content blooms on her cheek and on her brow
a pearl,
And she was1 young and innocent, the Lady of the Earl.

But as I looked more carefully, I saw that radiant smile


Was but assumed in mockery, the unthinking to beguile.
Thus have I seen a summer rose in all its beauty bloom,
When it has24 shed its sweetness o’er a cold and lonely
tomb.

She struck the harp, and when they praised her skill she
turned aside,
A rebel tear of conscious woe20 and memory to hide;
But when she raised her head she looked so13 lovely, so
serene,
To gaze in her proud eyes you’d think a tear had seldom
been.

The humblest maid in rural life can5 boast a happier fate


Than she, the beautiful and good, in all her rank and state;
For she was sacrificed,20 alas! to cold and selfish pride
When her young lips had breathed the vow to be a soldier’s
bride.

Of late I viewed her move along,2 the idol of the crowd;


A few short months elapsed, and then,12 I kissed her in her
shroud!
And o’er her splendid monument I saw the hatchment wave,
But there was one proud heart5 which did more honor to her
grave.

A warrior dropped his plumed head upon her place of rest,


And with his feverish lips the name of Ephilinda pressed;
Then breathed a prayer, and checked the groan of parting
pain,
And as he left the tomb he said,11 “Yet we shall meet again.”
MY VESPER SONG.
Filled with weariness and pain,
Scarcely strong enough to pray,
In this twilight hour I sit,
Sit and sing my doubts away.
O’er my broken purposes,
Ere the coming shadows roll,
Let me build a bridge of song:
“Jesus, lover of my soul.”

“Let me to Thy bosom fly!”


How the words my thoughts repeat:
To Thy bosom, Lord, I come,
Though unfit to kiss Thy feet.
Once I gathered sheaves for Thee,
Dreaming I could hold them fast:
Now I can but faintly sing,
“Oh! receive my soul at last.”

I am weary of my fears,
Like a child when night comes on:
In the shadow, Lord, I sing,
“Leave, oh, leave me not alone.”
Through the tears I still must shed,
Through the evil yet to be,
Though I falter while I sing,
“Still support and comfort me.”

“All my trust on Thee is stayed;”


Does the rhythm of the song
Softly falling on my heart,
Make its pulses firm and strong?
Or is this Thy perfect peace,
Now descending while I sing,
That my soul may sleep to-night
“’Neath the shadow of Thy wing?

“Thou of life the fountain art;”


If I slumber on Thy breast,
If I sing myself to sleep,
Sleep and death alike are rest.
Not impatiently I sing,
Though I lift my hands and cry
“Jesus, lover of my soul,
Let me to Thy bosom fly.”

THE VOLUNTEER ORGANIST.


With distinct enunciation give the dialect in this
piece, and assume the character of a countryman
who is telling this story. Guard against being vulgar
or too commonplace.
The gret big church wuz crowded full uv broadcloth an’ of
silk,
An’ satins rich as cream thet grows on our ol’ brindle’s milk;
Shined boots, biled shirts, stiff dickeys, an’ stove-pipe hats
were there,
An’ dudes ’ith trouserloons so tight they couldn’t kneel down
in prayer.

The elder in his poolpit high said, as he slowly riz:


“Our organist is kep’ to hum, laid up ’ith roomatiz,
An’ as we hev no substitoot, as brother Moore ain’t here,
Will some ’un in the congregation be so kind ’s to
volunteer?”

An’ then a red-nosed, blear-eyed tramp, of low-toned, rowdy


style,
Give an interductory hiccup, an’ then swaggered up the aisle.
Then thro’ that holy atmosphere there crep’ a sense er sin,
An’ thro’ thet air of sanctity the odor uv ol’ gin.

Then Deacon Purington he yelled, his teeth all set on edge:


“This man perfanes the house er God! W’y, this is sacrilege!”
The tramp didn’ hear a word he said, but slouched ’ith
stumblin’ feet,
An’ stalked an’ swaggered up the steps, an’ gained the organ
seat.

He then went pawin’ thro’ the keys, an’ soon there rose a
strain
Thet seemed to jest bulge out the heart, an’ ’lectrify the
brain;
An’ then he slapped down on the thing ’ith hands an’ head
an’ knees,
He slam-dashed his hull body down kerflop upon the keys.

The organ roared, the music flood went sweepin’ high an’
dry,
It swelled into the rafters, an’ bulged out into the sky;
The ol’ church shook and staggered, an’ seemed to reel an’
sway,
An’ the elder shouted “Glory!” an’ I yelled out “Hooray!”

An’ then he tried a tender strain thet melted in our ears,


Thet brought up blessed memories and drenched ’em down
’ith tears;
An’ we dreamed uv ol’ time kitchens, ’ith Tabby on the mat,
Tu home an’ luv an’ baby days, an’ mother, an’ all that!

An’ then he struck a streak uv hope—a song from souls


forgiven—
Thet burst from prison bars uv sin, an’ stormed the gates uv
heaven;
The morning stars together sung—no soul wuz left alone—
We felt the universe wuz safe, an’ God was on His throne!

An’ then a wail of deep despair an’ darkness come again,


An’ long, black crape hung on the doors uv all the homes uv
men;
No luv, no light, no joy, no hope, no songs of glad delight,
An’ then—the tramp, he swaggered down an’ reeled out into
the night!

But we knew he’d tol’ his story, tho’ he never spoke a word,
An’ it was the saddest story thet our ears had ever heard;
He hed tol’ his own life history, an’ no eye was dry thet day,
W’en the elder rose an’ simply said: “My brethren, let us
pray.”

S. W. Foss.

COMIN’ THRO’ THE RYE.


If a body meet a body
Comin’ thro’ the rye,
If a body kiss a body,
Need a body cry?
Ev’ry lassie has her laddie,
Nane they say ha’e I,
Yet all the lads they smile at me
When comin’ thro’ the rye.

If a body meet a body,


Comin’ frae the town;
If a body meet a body,
Need a body frown?
Ev’ry lassie has her laddie,
Nane they say ha’e I,
Yet all the lads they smile at me
When comin’ thro’ the rye.

Amang the train there is a swain,


I dearly love mysel’,
But what’s his name, or where’s his hame
I dinna choose to tell.
Ev’ry lassie has her laddie,
Nane they say ha’e I,
Yet all the lads they smile at me
When comin’ thro’ the rye.

Robert Burns.

JOAN OF ARC.
Twas in the days of chivalry, when steel-clad warriors swore
To bear their ladies’ favors amidst the battle’s roar,
To right the wrongs of injured maids, the lance in rest to lay,
And nobly fall in honor’s cause or triumph in the fray.
But not to-day a lance is couched, no waving plume is there,
No war-horse sniffs the trumpet’s breath, no banner woos
the air;
No crowding chiefs the tilt-yard throng to quench the thirst
of fame,
Though chiefs are met, intent to leave their names eternal
shame!

A still and solemn silence reigned, deep darkness veiled the


skies,
And Nature, shuddering, shook to see the impious sacrifice!
Full in the centre of the lists a dreadful pile is reared,
Awaiting one whose noble soul death’s terrors never feared,
Gaul’s young Minerva, who had led her countrymen to fame,
And foremost in the battle rent that conquered country’s
chain;
Who, when the sun of fame had set that on its armies
shone,
Its broken ranks in order set, inspired and led them on;
The low-born maid that, clad in steel, restored a fallen king,
Who taught the vanquished o’er their foes triumphal songs
to sing;
Whose banner in the battle’s front the badge of conquest
streamed,
And built again a tottering throne, a forfeit crown redeemed!

But when her glorious deeds were done, Fate sent a darker
day,
The blaze of brightness faded in murkiest clouds away;
And France stood looking idly on, nor dared to strike a blow,
Her guardian angel’s life to save, but gave it to the foe!
Ungrateful France her saviour’s fate beheld with careless
smile,
While Superstition, hiding hate and vengeance, fired the pile!

What holy horror of her crime is looked by yonder priest,


Like that grim bird that hovers nigh, and scents the funeral
feast!
Is this the maiden’s triumph, won in battle’s dreadful scenes,
Whose banner so triumphant flew before thy walls, Orleans!

Hark to the trumpet’s solemn sound! Low roll the muffled


drums
As slowly through the silent throng the sad procession
comes;
Wrapp’d in the garments of the grave, the corselet laid
aside,
Still with Bellona’s step she treads, through all her woes
descried.

As beautiful her features now as when inspired she spoke


Those oracles that slumbering France to life and action
woke:
The majesty yet haunts her looks, that late so dreadful
beamed
In war, when o’er her burnished arms the long rich tresses
streamed,
She gazes on the ghastly pile, tho’ pale as marble stone;
’Twas not with fear, for from her lips escaped no sigh nor
groan;
But she, her country’s saviour, thus to render up her breath

That was a pang far worse than all the bitterness of death!

’Twas done; the blazing pile is fired, the flames have


wrapped her round;
The owlet shrieked, and circling flew with dull, foreboding
sound;
Fate shuddered at the ghastly sight, and smiled a ghostly
smile;
And fame and honor spread their wings above the funeral
pile.
But, phœnix-like, her spirit rose from out the burning flame,
More beautiful and bright by far than in her days of fame.
Peace to her spirit! Let us give her memory to renown,
Nor on her faults or failings dwell, but draw the curtain
down.

Clare S. McKinley.

THE VULTURE OF THE ALPS.


This selection is narrative, yet it is narrative
intensely dramatic. Imagine the feelings of a parent
who sees the “youngest of his babes” torn away
from his embrace by a vulture and carried away in
mid-air. Let your tones, attitudes and gestures all be
strong. Picture the flight of a mountain eagle with
uplifted arm, and depict with an expression of agony
the grief of the parent.
I’ve been among the mighty Alps, and wandered through
their vales,
And heard the honest mountaineers relate their dismal tales,
As round the cottage blazing hearth, when their daily work
was o’er,
They spake of those who disappeared, and ne’er were heard
of more.

And there I from a shepherd heard a narrative of fear,


A tale to rend a mortal heart, which mothers might not hear:
The tears were standing in his eyes, his voice was
tremulous.
But, wiping all those tears away he told his story thus:—

“It is among these barren cliffs the ravenous vulture dwells,

You might also like