• 沒有找到結果。

THE INTEL MICROPROCESSORS

N/A
N/A
Protected

Academic year: 2021

Share "THE INTEL MICROPROCESSORS"

Copied!
944
0
0

加載中.... (立即查看全文)

全文

(1)
(2)

THE INTEL MICROPROCESSORS

8086/8088, 80186/80188, 80286, 80386, 80486, Pentium, Pentium Pro Processor, Pentium II, Pentium III, Pentium 4, and Core2

with 64-Bit Extensions

Architecture, Programming, and Interfacing

Eighth Edition

BARRY B. BREY

Upper Saddle River, New Jersey Columbus, Ohio

(3)

The Intel microprocessors 8086/8088, 80186/80188, 80286, 80386, 80486, Pentium, Pentium Pro processor, Pentium II, Pentium III, Pentium 4, and Core2 with 64-bit extensions:

architecture, programming, and interfacing / Barry B. Brey—8th ed.

p. cm.

Includes index.

ISBN 0-13-502645-8

1. Intel 80xxx series microprocessors. 2. Pentium (Microprocessor) 3. Computer interfaces.

I. Title.

QA76.8.I292B75 2009 004.165—dc22

2008009338

Editor in Chief:Vernon Anthony Acquisitions Editor:Wyatt Morris Editorial Assistant:Christopher Reed

Production Coordination:GGS Book Services Project Manager:Jessica Sykes

Operations Specialist:Laura Weaver Design Coordinator:Mike Fruhbeis Cover Designer:Ilze Lemesis Cover image: iStockphoto

Director of Marketing:David Gesell Marketing Manager:Jimmy Stephens Marketing Assistant:Les Roberts

This book was set in Times by GGS Book Services. It was printed and bound by Hamilton Printing. The cover was printed by Phoenix Color Corp.

Copyright © 2009, 2006, 2003, 2000, 1997, 1994, 1991, 1987 by Pearson Education, Inc., Upper Saddle River, New Jersey 07458. Pearson Prentice Hall. All rights reserved.

Printed in the United States of America. This publication is protected by Copyright and per- mission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permission(s), write to:

Rights and Permissions Department.

Pearson Prentice Hall™is a trademark of Pearson Education, Inc.

Pearson®is a registered trademark of Pearson plc

Prentice Hall®is a registered trademark of Pearson Education, Inc.

Pearson Education Ltd., London Pearson Education Australia Pty. Limited Pearson Education Singapore Pte. Ltd. Pearson Education North Asia Ltd., Hong Kong Pearson Education Canada, Inc. Pearson Educación de Mexico, S.A. de C.V.

Pearson Education—Japan Pearson Education Malaysia Pte. Ltd.

10 9 8 7 6 5 4 3 2 1 ISBN–13: 978–0–13–502645–8 ISBN–10: 0–13–502645–8

(4)

veterinarian technician), and to my constant four-legged companions: Romy, Sassy, Sir Elton, Eye Envy, and Baby Hooter.

iii

(5)
(6)

This practical reference text is written for students who require a thorough knowledge of pro- gramming and interfacing of the Intel family of microprocessors. Today, anyone functioning or striving to function in a field of study that uses computers must understand assembly language programming, a version of C language, and interfacing. Intel microprocessors have gained wide, and at times exclusive, application in many areas of electronics, communications, and control systems, particularly in desktop computer systems. A major addition to this eighth edition explains how to interface C/C++ using Visual C++ Express, which is a free download from Microsoft, with assembly language for both the older DOS and the Windows environments.

Many applications include Visual C++ as a basis for learning assembly language using the inline assembler. Updated sections that detail new events in the fields of microprocessors and micro- processor interfacing have been added.

ORGANIZATION AND COVERAGE

To cultivate a comprehensive approach to learning, each chapter begins with a set of objectives that briefly define its content. Chapters contain many programming applications and examples that illustrate the main topics. Each chapter ends with a numerical summary, which doubles as a study guide, and reviews the information just presented. Questions and problems are provided for reinforcement and practice, including research paper suggestions.

This text contains many example programs using the Microsoft Macro Assembler program and the inline assembler in the Visual C++ environment, which provide a learning opportunity to program the Intel family of microprocessors. Operation of the programming environment includes the linker, library, macros, DOS function, BIOS functions, and Visual C/C++ program development. The inline assembler (C/C++) is illustrated for both the 16- and 32-bit program- ming environments of various versions of Visual C++. The text is written to use Visual C++

Express 2005 or 2008 as a development environment, but any version of Visual Studio can also be used with almost no change.

This text also provides a thorough description of family members, memory systems, and various I/O systems that include disk memory, ADC and DAC, 16550 UART, PIAs, timers, key- board/display controllers, arithmetic coprocessors, and video display systems. Also discussed are

PREFACE

v

(7)

the personal computer system buses (AGP, ISA, PCI, PCI Express, USB, serial ports, and parallel port). Through these systems, a practical approach to microprocessor interfacing can be learned.

APPROACH

Because the Intel family of microprocessors is quite diverse, this text initially concentrates on real mode programming, which is compatible with all versions of the Intel family of micro- processors. Instructions for each family member, which include the 80386, 80486, Pentium, Pentium Pro, Pentium II, Pentium III, and Pentium 4 processors, are compared and contrasted with those for the 8086/8088 microprocessors. This entire series of microprocessors is very sim- ilar, which allows more advanced versions and their instructions to be learned with the basic 8086/8088. Please note that the 8086/8088 are still used in embedded systems along with their updated counterparts, the 80186/80188 and 80386EX embedded microprocessor.

This text also explains the programming and operation of the numeric coprocessor, MMX extension, and the SIMD extension, which function in a system to provide access to floating- point calculations that are important in control systems, video graphics, and computer-aided design (CAD) applications. The numeric coprocessor allows a program to access complex arithmetic operations that are otherwise difficult to achieve with normal microprocessor pro- gramming. The MMX and SIMD instructions allow both integer and floating-point data to be manipulated in parallel at very high speed.

This text also describes the pin-outs and function of the 8086–80486 and all versions of the Pentium microprocessor. First, interfacing is explained using the 8086/8088 with some of the more common peripheral components. After explaining the basics, a more advanced emphasis is placed on the 80186/80188, 80386, 80486, and Pentium through Pentium 4 microprocessors.

Coverage of the 80286, because of its similarity to the 8086 and 80386, is minimized so the 80386, 80486, and Pentium versions can be covered in complete detail.

Through this approach, the operation of the microprocessor and programming with the advanced family members, along with interfacing all family members, provides a working and practical background of the Intel family of microprocessors. Upon completing a course using this text, you will be able to:

1. Develop software to control an application interface microprocessor. Generally, the software developed will also function on all versions of the microprocessor. This software also includes DOS-based and Windows-based applications. The main emphasis is on developing inline assembly and C++ mixed language programs in the Windows environment.

2. Program using MFC controls, handlers, and functions to use the keyboard, video display system, and disk memory in assembly language and C++.

3. Develop software that uses macro sequences, procedures, conditional assembly, and flow control assembler directives that are linked to a Visual C++ program.

4. Develop software for code conversions using lookup tables and algorithms.

5. Program the numeric coprocessor to solve complex equations.

6. Develop software for the MMX and SIMD extensions.

7. Explain the differences between the family members and highlight the features of each member.

8. Describe and use real and protected mode operation of the microprocessor.

9. Interface memory and I/O systems to the microprocessor.

10. Provide a detailed and comprehensive comparison of all family members and their software and hardware interfaces.

11. Explain the function of the real-time operating system in an embedded application.

12. Explain the operation of disk and video systems.

13. Interface small systems to the ISA, PCI, serial ports, parallel port, and USB bus in a personal computer system.

(8)

CONTENT OVERVIEW

Chapter 1 introduces the Intel family of microprocessors with an emphasis on the microprocessor- based computer system: its history, operation, and the methods used to store data in a microprocessor-based system. Number systems and conversions are also included. Chapter 2 explores the programming model of the microprocessor and system architecture. Both real and protected mode operations are explained.

Once an understanding of the basic machine is grasped, Chapters 3 through 6 explain how each instruction functions with the Intel family of microprocessors. As instructions are explained, simple applications are presented to illustrate the operation of the instructions and develop basic programming concepts.

Chapter 7 introduces the use of Visual C/C++ Express with the inline assembler and sepa- rate assembly language programming modules. It also explains how to configure Visual C++

Express for use with assembly language applications.

After the basis for programming is developed, Chapter 8 provides applications using the Visual C++ Express with the inline assembler program. These applications include programming using the keyboard and mouse through message handlers in the Windows environment. Disk files are explained using the File class, as well as keyboard and video operations on a personal computer system through Windows. This chapter provides the tools required to develop virtually any program on a personal computer system through the Windows environment.

Chapter 9 introduces the 8086/8088 family as a basis for learning basic memory and I/O interfacing, which follow in later chapters. This chapter shows the buffered system as well as the system timing.

Chapter 10 explains memory interface using both integrated decoders and programmable logic devices using VHDL. The 8-, 16-, 32-, and 64-bit memory systems are provided so the 8086–80486 and the Pentium through Pentium 4 microprocessors can be interfaced to memory.

Chapter 11 provides a detailed look at basic I/O interfacing, including PIAs, timers, the 16550 UART, and ADC/DAC. It also describes the interface of both DC and stepper motors.

Once these basic I/O components and their interface to the microprocessor are understood, Chapters 12 and 13 provide detail on advanced I/O techniques that include interrupts and direct memory access (DMA). Applications include a printer interface, real-time clock, disk memory, and video systems.

Chapter 14 details the operation and programming for the 8087–Pentium 4 family of arith- metic coprocessors, as well as MMX and SIMD instructions. Today few applications function efficiently without the power of the arithmetic coprocessor. Remember that all Intel micro- processors since the 80486 contain a coprocessor; since the Pentium, an MMX unit; and since the Pentium II, an SIMD unit.

Chapter 15 shows how to interface small systems to the personal computer through the use of the parallel port, serial ports, and the ISA, and PCI bus interfaces.

Chapters 16 and 17 cover the advanced 80186/80188–80486 microprocessors and explore their differences with the 8086/8088, as well as their enhancements and features. Cache memory, interleaved memory, and burst memory are described with the 80386 and 80486 microproces- sors. Chapter 16 also covers real-time operating systems (RTOS), and Chapter 17 also describes memory management and memory paging.

Chapter 18 details the Pentium and Pentium Pro microprocessors. These microprocessors are based upon the original 8086/8088.

Chapter 19 introduces the Pentium II, Pentium III, Pentium 4, and Core2 microprocessors.

It covers some of the new features, package styles, and the instructions that are added to the orig- inal instruction set.

Appendices are included to enhance the text. Appendix A provides an abbreviated listing of the DOS INT 21H function calls because the use of DOS has waned. It also details the use of

(9)

the assembler program and the Windows Visual C++ interface. A complete listing of all 8086–Pentium 4 and Core2 instructions, including many example instructions and machine cod- ing in hexadecimal as well as clock timing information, is found in Appendix B. Appendix C provides a compact list of all the instructions that change the flag bits. Answers for the even- numbered questions and problems are provided in Appendix D.

To access supplementary materials online, instructors need to request an instructor access code. Go to www.pearsonhighered.com/irc, where you can register for an instructor access code. Within 48 hours after registering, you will receive a confirming e-mail, including an instructor access code. Once you have received your code, go to the site and log on for full instructions on downloading the materials you wish to use.

Acknowledgments

I greatly appreciate the feedback from the following reviewers:

James K. Archibald, Brigham Young University William H. Murray III, Broome Community College.

STAY IN TOUCH

We can stay in touch through the Internet. My Internet site contains information about all of my textbooks and many important links that are specific to the personal computer, microprocessors, hardware, and software. Also available is a weekly lesson that details many of the aspects of the personal computer. Of particular interest is the “Technical Section,” which presents many notes on topics that are not covered in this text. Please feel free to contact me at [email protected] if you need any type of assistance. I usually answer all of my e-mail within 24 hours.

My website is http://members.ee.net/brey

(10)

CHAPTER

1

INTRODUCTION TO THE MICROPROCESSOR AND COMPUTER 1

CHAPTER

2

THE MICROPROCESSOR AND ITS ARCHITECTURE 51

CHAPTER

3

ADDRESSING MODES 77

CHAPTER

4

DATA MOVEMENT INSTRUCTIONS 111

CHAPTER

5

ARITHMETIC AND LOGIC INSTRUCTIONS 156

CHAPTER

6

PROGRAM CONTROL INSTRUCTIONS 192

CHAPTER

7

USING ASSEMBLY LANGUAGE WITH C/C++ 223

CHAPTER

8

PROGRAMMING THE MICROPROCESSOR 250

CHAPTER

9

8086/8088 HARDWARE SPECIFICATIONS 302

CHAPTER

10

MEMORY INTERFACE 328

CHAPTER

11

BASIC I/O INTERFACE 377

CHAPTER

12

INTERRUPTS 451

CHAPTER

13

DIRECT MEMORY ACCESS AND DMA-CONTROLLED I/O 490 CHAPTER

14

THE ARITHMETIC COPROCESSOR, MMX, AND SIMD TECHNOLOGIES 531

CHAPTER

15

BUS INTERFACE 592

CHAPTER

16

THE 80185, 80188, AND 80286 MICROPROCESSORS 627

BRIEF CONTENTS

ix

(11)

CHAPTER

17

THE 80386 AND 80486 MICROPROCESSORS 677 CHAPTER

18

THE PENTIUM AND PENTIUM PRO MICROPROCESSORS 729 CHAPTER

19

THE PENTIUM II, PENTIUM III, PENTIUM 4, AND CORE2 MICROPROCESSORS 759

(12)

CHAPTER

1

INTRODUCTION TO THE MICROPROCESSOR AND COMPUTER 1

Introduction/Chapter Objectives 1 1–1 A Historical Background 2

The Mechanical Age 2; The Electrical Age 2; Programming Advancements 4;

The Microprocessor Age 5; The Modern Microprocessor 7 1–2 The Microprocessor-Based Personal Computer System 17

The Memory and I/O System 17; The Microprocessor 25 1–3 Number Systems 29

Digits 29; Positional Notation 30; Conversion to Decimal 31; Conversion from Decimal 32;

Binary-Coded Hexadecimal 33 1–4 Computer Data Formats 35

ASCII and Unicode Data 35; BCD (Binary-Coded Decimal) Data 37; Byte-Sized Data 38;

Word-Sized Data 40; Doubleword-Sized Data 41; Real Numbers 43 1–5 Summary 45

1–6 Questions and Problems 46

CHAPTER

2

THE MICROPROCESSOR AND ITS ARCHITECTURE 51

Introduction/Chapter Objectives 51

2–1 Internal Microprocessor Architecture 51

The Programming Model 52; Multipurpose Registers 54 2–2 Real Mode Memory Addressing 58

Segments and Offsets 58; Default Segment and Offset Registers 60;

Segment and Offset Addressing Scheme Allows Relocation 60 2–3 Introduction to Protected Mode Memory Addressing 63

Selectors and Descriptors 63; Program-Invisible Registers 67 2–4 Memory Paging 68

Paging Registers 69; The Page Directory and Page Table 70 2–5 Flat Mode Memory 72

2–6 Summary 73

2–7 Questions and Problems 74

CHAPTER

3

ADDRESSING MODES 77

Introduction/Chapter Objectives 77 3–1 Data-Addressing Modes 78

Register Addressing 81; Immediate Addressing 83; Direct Data Addressing 86;

Register Indirect Addressing 88; Base-Plus-Index Addressing 91;

CONTENTS

xi

(13)

Register Relative Addressing 93; Base Relative-Plus-Index Addressing 96;

Scaled-Index Addressing 98; RIP Relative Addressing 99; Data Structures 99 3–2 Program Memory-Addressing Modes 100

Direct Program Memory Addressing 100; Relative Program Memory Addressing 101;

Indirect Program Memory Addressing 101 3–3 Stack Memory-Addressing Modes 102 3–4 Summary 105

3–5 Questions and Problems 107

CHAPTER

4

DATA MOVEMENT INSTRUCTIONS 111

Introduction/Chapter Objectives 111 4–1 MOV Revisited 112

Machine Language 112; The 64-Bit Mode for the Pentium 4 and Core2 120 4–2 PUSH/POP 122

PUSH 122; POP 124; Initializing the Stack 124 4–3 Load-Effective Address 127

LEA 127; LDS, LES, LFS, LGS, and LSS 128 4–4 String Data Transfers 130

The Direction Flag 130; DI and SI 130; LODS 130; STOS 131; MOVS 133;

INS 135; OUTS 136

4–5 Miscellaneous Data Transfer Instructions 137

XCHG 137; LANF and SAHF 137; XLAT 138; IN and OUT 138;

MOVSX and MOVZX 140; BSWAP 140; CMOV 141 4–6 Segment Override Prefix 142

4–7 Assembler Detail 142

Directives 143; Memory Organization 147; A Sample Program 150 4–8 Summary 151

4–9 Questions and Problems 154

CHAPTER

5

ARITHMETIC AND LOGIC INSTRUCTIONS 156

Introduction/Chapter Objectives 156

5–1 Addition, Subtraction, and Comparison 156 Addition 157; Subtraction 162; Comparison 165 5–2 Multiplication and Division 166

Multiplication 166; Division 169 5–3 BCD and ASCII Arithmetic 172

BCD Arithmetic 172; ASCII Arithmetic 173 5–4 Basic Logic Instructions 175

AND 175; OR 176; Test and Bit Test Instructions 180; NOT and NEG 181 5–5 Shift and Rotate 182

Shift 182; Rotate 184; Bit Scan Instructions 185 5–6 String Comparisons 186

SCAS 186; CMPS 187 5–7 Summary 187

5–8 Questions and Problems 189

CHAPTER

6

PROGRAM CONTROL INSTRUCTIONS 192

Introduction/Chapter Objectives 192 6–1 The Jump Group 192

Unconditional Jump (JMP) 193; Conditional Jumps and Conditional Sets 198; LOOP 201 6–2 Controlling the Flow of the Program 202

WHILE Loops 205; REPEAT-UNTIL Loops 206 6–3 Procedures 208

CALL 209; RET 211

(14)

6–4 Introduction to Interrupts 213

Interrupt Vectors 213; Interrupt Instructions 214; Interrupt Control 215;

Interrupts in the Personal Computer 216; 64-Bit Mode Interrupts 216 6–5 Machine Control and Miscellaneous Instructions 217

Controlling the Carry Flag Bit 217; WAIT 217; HLT 217; NOP 217;

LOCK Prefix 218; ESC 218; BOUND 218; ENTER and LEAVE 218 6–6 Summary 219

6–7 Questions and Problems 221

CHAPTER

7

USING ASSEMBLY LANGUAGE WITH C/C++ 223

Introduction/Chapter Objectives 223

7–1 Using Assembly Language with C++ for 16-Bit DOS Applications 224

Basic Rules and Simple Programs 224; What Cannot Be Used from MASM Inside an _asm Block 226; Using Character Strings 226; Using Data Structures 227;

An Example of a Mixed-Language Program 229

7–2 Using Assembly Language with Visual C/C++ for 32-Bit Applications 231 An Example that Uses Console I/O to Access the Keyboard and Display 231;

Directly Addressing I/O Ports 233; Developing a Visual C++ Application for Windows 234 7–3 Mixed Assembly and C++ Objects 242

Linking Assembly Language with Visual C++ 242; Adding New Assembly Language Instructions to C/C++ Programs 247

7–4 Summary 247

7–5 Questions and Problems 248

CHAPTER

8

PROGRAMMING THE MICROPROCESSOR 250

Introduction/Chapter Objectives 250 8–1 Modular Programming 251

The Assembler and Linker 251; PUBLIC and EXTRN 253; Libraries 254; Macros 257 8–2 Using the Keyboard and Video Display 259

Reading the Keyboard 259; Using the Video Display 265; Using a Timer in a Program 267;

The Mouse 269 8–3 Data Conversions 271

Converting from Binary to ASCII 272; Converting from ASCII to Binary 274;

Displaying and Reading Hexadecimal Data 274; Using Lookup Tables for Data Conversions 276; An Example Program Using a Lookup Table 278

8–4 Disk Files 280

Disk Organization 280; File Names 281; Sequential Access Files 282;

Random Access Files 291 8–5 Example Programs 294

Time/Date Display Program 294; Numeric Sort Program 295; Data Encryption 297 8–6 Summary 299

8–7 Questions and Problems 300

CHAPTER

9

8086/8088 HARDWARE SPECIFICATIONS 302

Introduction/Chapter Objectives 302 9–1 Pin-Outs and the Pin Functions 302

The Pin-Out 303; Power Supply Requirements 303; DC Characteristics 303;

Pin Connections 304 9–2 Clock Generator (8284A) 307

The 8284A Clock Generator 307; Operation of the 8284A 309 9–3 Bus Buffering and Latching 310

Demultiplexing the Buses 310; The Buffered System 312 9–4 Bus Timing 315

Basic Bus Operation 315; Timing in General 315; Read Timing 316; Write Timing 319

(15)

9–5 Ready and the Wait State 320

The READY Input 320; RDY and the 8284A 320 9–6 Minimum Mode versus Maximum Mode 323

Minimum Mode Operation 323; Maximum Mode Operation 323;

The 8288 Bus Controller 324; Pin Functions 325 9–7 Summary 325

9–8 Questions and Problems 326

CHAPTER

10

MEMORY INTERFACE 328

Introduction/Chapter Objectives 328 10–1 Memory Devices 328

Memory Pin Connections 329; ROM Memory 330; Static RAM (SRAM) Devices 332;

Dynamic RAM (DRAM) Memory 333 10–2 Address Decoding 340

Why Decode Memory? 340; Simple NAND Gate Decoder 341; The 3-to-8 Line Decoder (74LS138) 342; The Dual 2-to-4 Line Decoder (74LS139) 344; PLD Programmable Decoders 344

10–3 8088 and 80188 (8-Bit) Memory Interface 349

Basic 8088/80188 Memory Interface 349; Interfacing Flash Memory 351;

Error Correction 353

10–4 8086, 80186, 80286, and 80386SX (16-Bit) Memory Interface 356 16-Bit Bus Control 356

10–5 80386DX and 80486 (32-Bit) Memory Interface 363 Memory Banks 363; 32-Bit Memory Interface 364 10–6 Pentium through Core2 (64-Bit) Memory Interface 366

64-Bit Memory Interface 366 10–7 Dynamic RAM 370

DRAM Revisited 370; EDO Memory 371; SDRAM 371; DDR 373; DRAM Controllers 373 10–8 Summary 373

10–9 Questions and Problems 375

CHAPTER

11

BASIC I/O INTERFACE 377

Introduction/Chapter Objectives 377 11–1 Introduction to I/O Interface 377

The I/O Instructions 378; Isolated and Memory-Mapped I/O 379; Personal Computer I/O Map 380; Basic Input and Output Interfaces 380; Handshaking 382; Notes about Interfacing Circuitry 383

11–2 I/O Port Address Decoding 387

Decoding 8-Bit I/O Port Addresses 387; Decoding 16-Bit I/O Port Addresses 388;

8- and 16-Bit-Wide I/O Ports 389; 32-Bit-Wide I/O Ports 392 11–3 The Programmable Peripheral Interface 395

Basic Description of the 82C55 395; Programming the 82C55 397; Mode 0 Operation 398;

An LCD Display, Interfaced to the 82C55 403; Mode 1 Strobed Input 414; Signal

Definitions for Mode 1 Strobed Input 414; Mode 1 Strobed Output 416; Signal Definitions for Mode 1 Strobed Output 416; Mode 2 Bidirectional Operation 418; Signal Definitions for Bidirectional Mode 2 418; 82C55 Mode Summary 420; The Serial EEPROM Interface 421 11–4 8254 Programmable Interval Timer 423

8254 Functional Description 423; Pin Definitions 424; Programming the 8254 424;

DC Motor Speed and Direction Control 429 11–5 16550 Programmable Communications Interface 433

Asynchronous Serial Data 433; 16550 Functional Description 433; 16550 Pin Functions 434;

Programming the 16550 435

11–6 Analog-to-Digital (ADC) and Digital-to-Analog (DAC) Converters 440

The DAC0830 Digital-to-Analog Converter 440; The ADC080X Analog-to-Digital Converter 442; Using the ADC0804 and the DAC0830 445

(16)

11–7 Summary 446

11–8 Questions and Problems 448

CHAPTER

12

INTERRUPTS 451

Introduction/Chapter Objectives 451 12–1 Basic Interrupt Processing 451

The Purpose of Interrupts 451; Interrupts 452; Interrupt Instructions: BOUND, INTO, INT, INT 3, and IRET 455; The Operation of a Real Mode Interrupt 455; Operation of a Protected Mode Interrupt 456; Interrupt Flag Bits 457; Storing an Interrupt Vector in the Vector Table 458

12–2 Hardware Interrupts 459

INTR and 461; The 82C55 Keyboard Interrupt 462 12–3 Expanding the Interrupt Structure 465

Using the 74ALS244 to Expand Interrupts 465; Daisy-Chained Interrupt 466 12–4 8259A Programmable Interrupt Controller 468

General Description of the 8259A 468; Connecting a Single 8259A 469; Cascading Multiple 8259As 469; Programming the 8259A 469; 8259A Programming Example 475 12–5 Interrupt Examples 481

Real-Time Clock 482; Interrupt-Processed Keyboard 484 12–6 Summary 487

12–7 Questions and Problems 488

CHAPTER

13

DIRECT MEMORY ACCESS AND DMA-CONTROLLED I/O 490

Introduction/Chapter Objectives 490 13–1 Basic DMA Operation 490

Basic DMA Definitions 491 13–2 The 8237 DMA Controller 492

Pin Definitions 492; Internal Registers 494; Software Commands 497;

Programming the Address and Count Registers 498; The 8237 Connected to the 80X86 Microprocessor 498; Memory-to-Memory Transfer with the 8237 499; DMA-Processed Printer Interface 504

13–3 Shared-Bus Operation 506

Types of Buses Defined 507; The Bus Arbiter 509; Pin Definitions 509 13–4 Disk Memory Systems 513

Floppy Disk Memory 513; Pen Drives 517; Hard Disk Memory 518;

Optical Disk Memory 521 13–5 Video Displays 522

Video Signals 522; The TTL RGB Monitor 523; The Analog RGB Monitor 524 13–6 Summary 529

13–7 Questions and Problems 529

CHAPTER

14

THE ARITHMETIC COPROCESSOR, MMX, AND SIMD TECHNOLOGIES 531

Introduction/Chapter Objectives 531

14–1 Data Formats for the Arithmetic Coprocessor 532

Signed Integers 532; Binary-Coded Decimal (BCD) 533; Floating-Point 533 14–2 The 80X87 Architecture 536

Internal Structure of the 80X87 536 14–3 Instruction Set 541

Data Transfer Instructions 541; Arithmetic Instructions 543; Comparison Instructions 544;

Transcendental Operations 545; Constant Operations 546; Coprocessor Control Instructions 546; Coprocessor Instructions 548

14–4 Programming with the Arithmetic Coprocessor 565

Calculating the Area of a Circle 565; Finding the Resonant Frequency 566; Finding the Roots Using the Quadratic Equation 566; Using a Memory Array to Store Results 567;

Converting a Single-Precision Floating-Point Number to a String 568 INTA

(17)

14–5 Introduction to MMX Technology 570 Data Types 570; Instruction Set 571 14–6 Introduction to SSE Technology 581

Floating-Point Data 582; The Instruction Set 583; The Control/Status Register 584;

Programming Examples 584; Optimization 587 14–7 Summary 587

14–8 Questions and Problems 589

CHAPTER

15

BUS INTERFACE 592

Introduction/Chapter Objectives 592 15–1 The ISA Bus 592

CHAPTER

16

THE 80186, 80188, AND 80286 MICROPROCESSORS 627

Introduction/Chapter Objectives 627 16–1 80186/80188 Architecture 627

Versions of the 80186/80188 628; 80186 Basic Block Diagram 628; 80186/80188 Basic Features 629; Pin-Out 631; DC Operating Characteristics 634; 80186/80188 Timing 634 16–2 Programming the 80186/80188 Enhancements 637

Peripheral Control Block 637; Interrupts in the 80186/80188 638; Interrupt Controller 638;

Timers 643; DMA Controller 649; Chip Selection Unit 651 16–3 80C188EB Example Interface 655

16–4 Real-Time Operating Systems (RTOS) 662

What Is a Real-Time Operating System (RTOS)? 662; An Example System 663;

A Threaded System 666 16–5 Introduction to the 80286 670

Hardware Features 670; Additional Instructions 672; The Virtual Memory Machine 674 16–6 Summary 674

16–7 Questions and Problems 675

CHAPTER

17

THE 80386 AND 80486 MICROPROCESSORS 677

Introduction/Chapter Objectives 677

17–1 Introduction to the 80386 Microprocessor 678

The Memory System 681; The Input/Output System 687; Memory and I/O Control Signals 688; Timing 689; Wait States 691

17–2 Special 80386 Registers 692

Control Registers 692; Debug and Test Registers 693 17–3 80386 Memory Management 695

Descriptors and Selectors 695; Descriptor Tables 698; The Task State Segment (TSS) 700 17–4 Moving to Protected Mode 702

Evolution of the ISA Bus 593; The 8-Bit ISA Bus Output Interface 593; The 8-Bit ISA Bus Input Interface 598; The 16-Bit ISA Bus 601

15–2 The Peripheral Component Interconnect (PCI) Bus 602

The PCI Bus Pin-Out 603; The PCI Address/Data Connections 603;

Configuration Space 605; BIOS for PCI 607; PCI Interface 610; PCI Express Bus 610 15–3 The Parallel Printer Interface (LPT) 612

Port Details 612; Using the Parallel Port Without ECP Support 614 15–4 The Serial COM Ports 614

Communication Control 615 15–5 The Universal Serial Bus (USB) 617

The Connector 617; USB Data 617; USB Commands 618; The USB Bus Node 620;

Software for the USBN9604/3 621 15–6 Accelerated Graphics Port (AGP) 623 15–7 Summary 624

15–8 Questions and Problems 625

(18)

17–5 Virtual 8086 Mode 712

17–6 The Memory Paging Mechanism 713 The Page Directory 714 The Page Table 715 17–7 Introduction to the 80486 Microprocessor 718

Pin-Out of the 80486DX and 80486SX Microprocessors 718; Pin Definitions 718;

Basic 80486 Architecture 722; 80486 Memory System 723 17–8 Summary 726

17–9 Questions and Problems 727

CHAPTER

18

THE PENTIUM AND PENTIUM PRO MICROPROCESSORS 729

Introduction/Chapter Objectives 729

18–1 Introduction to the Pentium Microprocessor 730

The Memory System 734; Input/Output System 735; System Timing 735;

Branch Prediction Logic 738; Cache Structure 738; Superscalar Architecture 738 18–2 Special Pentium Registers 738

Control Registers 738; EFLAG Register 739; Built-In Self-Test (BIST) 740 18–3 Pentium Memory Management 740

Paging Unit 740; Memory-Management Mode 740 18–4 New Pentium Instructions 742

18–5 Introduction to the Pentium Pro Microprocessor 747

Internal Structure of the Pentium Pro 748; Pin Connections 750; The Memory System 754;

Input/Output System 755; System Timing 755 18–6 Special Pentium Pro Features 756

Control Register 4 756 18–7 Summary 757

18–8 Questions and Problems 758

CHAPTER

19

THE PENTIUM II, PENTIUM III, PENTIUM 4, AND CORE2 MICROPROCESSORS 759

Introduction/Chapter Objectives 759

19–1 Introduction to the Pentium II Microprocessor 760

The Memory System 765; Input/Output System 767; System Timing 768 19–2 Pentium II Software Changes 768

CPUID Instruction 768; SYSENTER and SYSEXIT Instructions 769;

FXSAVE and FXRSTOR Instructions 770 19–3 The Pentium III 770

Chip Sets 770; Bus 771; Pin-Out 771 19–4 The Pentium 4 and Core2 771

Memory Interface 772; Register Set 773; Hyper-Threading Technology 775;

Multiple Core Technology 776; CPUID 776; Model-Specific Registers 779;

Performance-Monitoring Registers 780; 64-Bit Extension Technology 780 19–5 Summary 782

19–6 Questions and Problems 783

APPENDIX A: THE ASSEMBLER, VISUAL C++, AND DOS 785

The Assembler 785

Assembler Memory Models 786 Selected DOS Function Calls 787 Using Visual C++ 790

Create a Dialog Application 791

APPENDIX B: INSTRUCTION SET SUMMARY 794

Instruction Set Summary 798 SIMD Instruction Set Summary 881

(19)

Data Movement Instructions 883 Arithmetic Instructions 885 Logic Instructions 891 Comparison Instructions 892 Data Conversion Instructions 894

APPENDIX C: FLAG-BIT CHANGES 895

APPENDIX D: ANSWERS TO SELECTED EVEN-NUMBERED QUESTIONS

AND PROBLEMS 897

INDEX 915

(20)

INTRODUCTION

This chapter provides an overview of the Intel family of microprocessors. Included is a discus- sion of the history of computers and the function of the microprocessor in the microprocessor- based computer system. Also introduced are terms and jargon used in the computer field, so that computerese is understood and applied when discussing microprocessors and computers.

The block diagram and a description of the function of each block detail the operation of a computer system. Blocks, in the block diagram, show how the memory and input/output (I/O) system of the personal computer interconnect. Detailed is the way data are stored in the mem- ory so each data type can be used as software is developed. Numeric data are stored as integers, floating-point, and binary-coded decimal (BCD); alphanumeric data are stored by using the ASCII (American Standard Code for Information Interchange) code and the Unicode.

CHAPTER OBJECTIVES

Upon completion of this chapter, you will be able to:

1. Converse by using appropriate computer terminology such as bit, byte, data, real memory system, protected mode memory system, Windows, DOS, I/O, and so forth.

2. Briefly detail the history of the computer and list applications performed by computer systems.

3. Provide an overview of the various 80X86 and Pentium family members.

4. Draw the block diagram of a computer system and explain the purpose of each block.

5. Describe the function of the microprocessor and detail its basic operation.

6. Define the contents of the memory system in the personal computer.

7. Convert between binary, decimal, and hexadecimal numbers.

8. Differentiate and represent numeric and alphabetic information as integers, floating-point, BCD, and ASCII data.

CHAPTER 1

Introduction to the Microprocessor and Computer

1

(21)

180X86 is an accepted acronym for 8086, 8088, 80186, 80188, 80286, 80386, and 80486 microprocessors and also include the Pentium series.

2Pentium, Pentium Pro, Pentium II, Pentium III, Pentium 4, and Core2 are registered trademarks of Intel Corporation.

1–1 A HISTORICAL BACKGROUND

This first section outlines the historical events leading to the development of the microprocessor and, specifically, the extremely powerful and current 80X86,1Pentium, Pentium Pro, Pentium III, Pentium 4,2and Core2 microprocessors. Although a study of history is not essential to understand the microprocessor, it furnishes interesting reading and provides a historical perspective of the fast-paced evolution of the computer.

The Mechanical Age

The idea of a computing system is not new—it has been around long before modem electrical and electronic devices were developed. The idea of calculating with a machine dates to 500 BC when the Babylonians, the ancestors of the present-day Iraqis, invented the abacus, the first mechanical calculator. The abacus, which uses strings of beads to perform calculations, was used by the ancient Babylonian priests to keep track of their vast storehouses of grain. The abacus, which was used extensively and is still in use today, was not improved until 1642, when mathematician Blaise Pascal invented a calculator that was constructed of gears and wheels. Each gear contained 10 teeth that, when moved one complete revolution, advanced a second gear one place. This is the same principle that is used in the automobile’s odometer mechanism and is the basis of all mechanical calculators. Incidentally, the PASCAL programming language is named in honor of Blaise Pascal for his pioneering work in mathematics and with the mechanical calculator.

The arrival of the first practical geared mechanical machines used to automatically com- pute information dates to the early 1800s. This is before humans invented the lightbulb or before much was known about electricity. In this dawn of the computer age, humans dreamed of mechanical machines that could compute numerical facts with a program—not merely calculat- ing facts, as with a calculator.

In 1937 it was discovered through plans and journals that one early pioneer of mechanical com- puting machinery was Charles Babbage, aided by Augusta Ada Byron, the Countess of Lovelace.

Babbage was commissioned in 1823 by the Royal Astronomical Society of Great Britain to produce a programmable calculating machine. This machine was to generate navigational tables for the Royal Navy. He accepted the challenge and began to create what he called his Analytical Engine. This engine was a steam-powered mechanical computer that stored a thousand 20-digit decimal num- bers and a variable program that could modify the function of the machine to perform various calcu- lating tasks. Input to his engine was through punched cards, much as computers in the 1950s and 1960s used punched cards. It is assumed that he obtained the idea of using punched cards from Joseph Jacquard, a Frenchman who used punched cards as input to a weaving machine he invented in 1801, which is today called Jacquard’s loom. Jacquard’s loom used punched cards to select intricate weav- ing patterns in the cloth that it produced. The punched cards programmed the loom.

After many years of work, Babbage’s dream began to fade when he realized that the machinists of his day were unable to create the mechanical parts needed to complete his work.

The Analytical Engine required more than 50,000 machined parts, which could not be made with enough precision to allow his engine to function reliably.

The Electrical Age

The 1800s saw the advent of the electric motor (conceived by Michael Faraday); with it came a multitude of motor-driven adding machines, all based on the mechanical calculator developed by Blaise Pascal. These electrically driven mechanical calculators were common pieces of office

(22)

equipment until well into the early 1970s, when the small handheld electronic calculator, first introduced by Bomar Corporation and called the Bomar Brain, appeared. Monroe was also a leading pioneer of electronic calculators, but its machines were desktop, four-function models the size of cash registers.

In 1889, Herman Hollerith developed the punched card for storing data. Like Babbage, he too apparently borrowed the idea of a punched card from Jacquard. He also developed a mechan- ical machine—driven by one of the new electric motors—that counted, sorted, and collated information stored on punched cards. The idea of calculating by machinery intrigued the United States government so much that Hollerith was commissioned to use his punched-card system to store and tabulate information for the 1890 census.

In 1896, Hollerith formed a company called the Tabulating Machine Company, which developed a line of machines that used punched cards for tabulation. After a number of mergers, the Tabulating Machine Company was formed into the International Business Machines Corporation, now referred to more commonly as IBM, Inc. The punched cards used in early computer systems are often called Hollerith cards, in honor of Herman Hollerith. The 12-bit code used on a punched card is called the Hollerith code.

Mechanical machines driven by electric motors continued to dominate the information processing world until the construction of the first electronic calculating machine in 1941.

A German inventor named Konrad Zuse, who worked as an engineer for the Henschel Aircraft Company in Berlin, invented the first modern electromechanical computer. His Z3 calculating computer, as pictured in Figure 1–1, was probably invented for use in aircraft and missile design during World War II for the German war effort. The Z3 was a relay logic machine that was clocked at 5.33 Hz (far slower than the latest multiple GHz microprocessors). Had Zuse been given adequate funding by the German government, he most likely would have developed a

FIGURE 1–1 The Z3 computer developed by Konrad Zuse uses a 5.33 hertz clocking frequency. (Photo courtesy of Horst Zuse, the son of Konrad.)

(23)

much more powerful computer system. Zuse is today finally receiving some belated honor for his pioneering work in the area of digital electronics, which began in the 1930s, and for his Z3 computer system. In 1936 Zuse constructed a mechanical version of his system and later in 1939 Zuse constructed his first electromechanical computer system, called the Z2.

It has recently been discovered (through the declassification of British military documents) that the first electronic computer was placed into operation in 1943 to break secret German mili- tary codes. This first electronic computing system, which used vacuum tubes, was invented by Alan Turing. Turing called his machine Colossus, probably because of its size. A problem with Colossus was that although its design allowed it to break secret German military codes generated by the mechanical Enigma machine, it could not solve other problems. Colossus was not programmable—it was a fixed-program computer system, which today is often called a special- purpose computer.

The first general-purpose, programmable electronic computer system was developed in 1946 at the University of Pennsylvania. This first modem computer was called the ENIAC (Electronic Numerical Integrator and Calculator). The ENIAC was a huge machine, con- taining over 17,000 vacuum tubes and over 500 miles of wires. This massive machine weighed over 30 tons, yet performed only about 100,000 operations per second. The ENIAC thrust the world into the age of electronic computers. The ENIAC was programmed by rewiring its circuits—a process that took many workers several days to accomplish. The workers changed the electrical connections on plug-boards that looked like early telephone switchboards.

Another problem with the ENIAC was the life of the vacuum tube components, which required frequent maintenance.

Breakthroughs that followed were the development of the transistor on December 23, 1947 at Bell Labs by John Bardeen, William Shockley, and Walter Brattain. This was followed by the 1958 invention of the integrated circuit by Jack Kilby of Texas Instruments. The integrated circuit led to the development of digital integrated circuits (RTL, or resistor-to-transistor logic) in the 1960s and the first microprocessor at Intel Corporation in 1971. At that time, Intel engi- neers Federico Faggin, Ted Hoff, and Stan Mazor developed the 4004 microprocessor (U.S.

Patent 3,821,715)—the device that started the microprocessor revolution that continues today at an ever-accelerating pace.

Programming Advancements

Now that programmable machines were developed, programs and programming languages began to appear. As mentioned earlier, the first programmable electronic computer system was programmed by rewiring its circuits. Because this proved too cumbersome for practical applica- tion, early in the evolution of computer systems, computer languages began to appear in order to control the computer. The first such language, machine language, was constructed of ones and zeros using binary codes that were stored in the computer memory system as groups of instruc- tions called a program. This was more efficient than rewiring a machine to program it, but it was still extremely time-consuming to develop a program because of the sheer number of program codes that were required. Mathematician John von Neumann was the first modern person to develop a system that accepted instructions and stored them in memory. Computers are often called von Neumann machines in honor of John von Neumann. (Recall that Babbage also had developed the concept long before von Neumann.)

Once computer systems such as the UNIVAC became available in the early 1950s, assembly language was used to simplify the chore of entering binary code into a computer as its instructions. The assembler allows the programmer to use mnemonic codes, such as ADD for addition, in place of a binary number such as 0100 0111. Although assembly language was an aid to programming, it wasn’t until 1957, when Grace Hopper developed the first high-level programming language called FLOWMATIC, that computers became easier to program. In the

(24)

same year, IBM developed FORTRAN (FORmula TRANslator) for its computer systems. The FORTRAN language allowed programmers to develop programs that used formulas to solve mathematical problems. Note that FORTRAN is still used by some scientists for computer programming. Another similar language, introduced about a year after FORTRAN, was ALGOL (ALGOrithmic Language).

The first truly successful and widespread programming language for business applications was COBOL (COmputer Business Oriented Language). Although COBOL usage has dimin- ished considerably in recent years, it is still a player in some large business and government systems. Another once-popular business language is RPG (Report Program Generator), which allows programming by specifying the form of the input, output, and calculations.

Since these early days of programming, additional languages have appeared. Some of the more common modern programming languages are BASIC, C#, C/C++, Java, PASCAL, and ADA. The BASIC and PASCAL languages were both designed as teaching languages, but have escaped the classroom. The BASIC language is used in many computer systems and may be one of the most common programming languages today. The BASIC language is probably the easiest of all to learn. Some estimates indicate that the BASIC language is used in the personal computer for 80% of the programs written by users. In the past decade, a new version of BASIC, Visual BASIC, has made programming in the Windows environment easier. The Visual BASIC lan- guage may eventually supplant C/C++ and PASCAL as a scientific language, but it is doubtful.

It is more apparent that the C# language is gaining headway and may actually replace C/C++ and most other languages including Java and may eventually replace BASIC. This of course is con- jecture and only the future will show which language eventually becomes dominant.

In the scientific community, primarily C/C++ and occasionally PASCAL and FORTRAN appear as control programs. One recent survey of embedded system developers showed that C was used by 60% and that 30% used assembly language. The remainder used BASIC and JAVA.

These languages, especially C/C++, allow the programmer almost complete control over the pro- gramming environment and computer system. In many cases, C/C++ is replacing some of the low-level machine control software or drivers normally reserved for assembly language. Even so, assembly language still plays an important role in programming. Many video games written for the personal computer are written almost exclusively in assembly language. Assembly language is also interspersed with C/C++ to perform machine control functions efficiently. Some of the newer parallel instructions found on the newest Pentium and Core2 microprocessors are only programmable in assembly language.

The ADA language is used heavily by the Department of Defense. The ADA language was named in honor of Augusta Ada Byron, Countess of Lovelace. The Countess worked with Charles Babbage in the early 1800s in the development of software for his Analytical Engine.

The Microprocessor Age

The world’s first microprocessor, the Intel 4004, was a 4-bit microprocessor–programmable con- troller on a chip. It addressed a mere 4096, 4-bit-wide memory locations. (A bit is a binary digit with a value of one or zero. A 4-bit-wide memory location is often called a nibble.) The 4004 instruction set contained only 45 instructions. It was fabricated with the then-current state-of- the-art P-channel MOSFET technology that only allowed it to execute instructions at the slow rate of 50 KIPs (kilo-instructions per second). This was slow when compared to the 100,000 instructions executed per second by the 30-ton ENIAC computer in 1946. The main difference was that the 4004 weighed much less than an ounce.

At first, applications abounded for this device. The 4-bit microprocessor debuted in early video game systems and small microprocessor-based control systems. One such early video game, a shuffleboard game, was produced by Bailey. The main problems with this early microprocessor were its speed, word width, and memory size. The evolution of the 4-bit microprocessor ended

(25)

Manufacturer Part Number

Fairchild F-8

Intel 8080

MOS Technology 6502

Motorola MC6800

National Semiconductor IMP-8 Rockwell International PPS-8

Zilog Z-8

TABLE 1–1 Early 8-bit microprocessors.

when Intel released the 4040, an updated version of the earlier 4004. The 4040 operated at a higher speed, although it lacked improvements in word width and memory size. Other companies, particularly Texas Instruments (TMS-1000), also produced 4-bit microprocessors. The 4-bit microprocessor still survives in low-end applications such as microwave ovens and small control systems and is still available from some microprocessor manufacturers. Most calculators are still based on 4-bit microprocessors that process 4-bit BCD (binary-coded decimal) codes.

Later in 1971, realizing that the microprocessor was a commercially viable product, Intel Corporation released the 8008—an extended 8-bit version of the 4004 microprocessor. The 8008 addressed an expanded memory size (16K bytes) and contained additional instructions (a total of 48) that provided an opportunity for its application in more advanced systems.

(A byte is generally an 8-bit-wide binary number and a K is 1024. Often, memory size is spec- ified in K bytes.)

As engineers developed more demanding uses for the 8008 microprocessor, they discov- ered that its somewhat small memory size, slow speed, and instruction set limited its usefulness.

Intel recognized these limitations and introduced the 8080 microprocessor in 1973—the first of the modem 8-bit microprocessors. About six months after Intel released the 8080 microproces- sor, Motorola Corporation introduced its MC6800 microprocessor. The floodgates opened and the 8080—and, to a lesser degree, the MC6800—ushered in the age of the microprocessor. Soon, other companies began to introduce their own versions of the 8-bit microprocessor. Table 1–1 lists several of these early microprocessors and their manufacturers. Of these early microprocessor producers, only Intel and Motorola (IBM also produces Motorola-style microprocessors) continue successfully to create newer and improved versions of the microprocessor. Motorola has sold its microprocessor division, and that company is now called Freescale Semiconductors, Inc. Zilog still manufactures microprocessors, but remains in the background, concentrating on microcon- trollers and embedded controllers instead of general-purpose microprocessors. Rockwell has all but abandoned microprocessor development in favor of modem circuitry. Motorola has declined from having nearly 50% share of the microprocessor market to a much smaller share. Intel today has nearly 100% of the desktop and notebook market.

What Was Special about the 8080? Not only could the 8080 address more memory and exe- cute additional instructions, but it executed them 10 times faster than the 8008. An addition that took 20 μs (50,000 instructions per second) on an 8008-based system required only 2.0 μs (500,000 instructions per second) on an 8080-based system. Also, the 8080 was compatible with TTL (transistor-transistor logic), whereas the 8008 was not directly compatible. This made inter- facing much easier and less expensive. The 8080 also addressed four times more memory (64K bytes) than the 8008 (l6K bytes). These improvements are responsible for ushering in the era of the 8080 and the continuing saga of the microprocessor. Incidentally, the first personal computer, the MITS Altair 8800, was released in 1974. (Note that the number 8800 was proba- bly chosen to avoid copyright violations with Intel.) The BASIC language interpreter, written for the Altair 8800 computer, was developed in 1975 by Bill Gates and Paul Allen, the founders of

(26)

Microsoft Corporation. The assembler program for the Altair 8800 was written by Digital Research Corporation, which once produced DR-DOS for the personal computer.

The 8085 Microprocessor. In 1977, Intel Corporation introduced an updated version of the 8080—the 8085. The 8085 was to be the last 8-bit, general-purpose microprocessor developed by Intel. Although only slightly more advanced than an 8080 microprocessor, the 8085 executed software at an even higher speed. An addition that took 2.0 μs (500,000 instructions per second on the 8080) required only 1.3 μs (769,230 instructions per second) on the 8085. The main advantages of the 8085 were its internal clock generator, internal system controller, and higher clock frequency. This higher level of component integration reduced the 8085’s cost and increased its usefulness. Intel has managed to sell well over 100 million copies of the 8085 microprocessor, its most successful 8-bit, general-purpose microprocessor. Because the 8085 is also manufactured (second-sourced) by many other companies, there are over 200 million of these microprocessors in existence. Applications that contain the 8085 will likely continue to be popular. Another company that sold 500 million 8-bit microprocessors is Zilog Corporation, which produced the Z-80 microprocessor. The Z-80 is machine language–compatible with the 8085, which means that there are over 700 million microprocessors that execute 8085/Z-80 compatible code!

The Modern Microprocessor

In 1978, Intel released the 8086 microprocessor; a year or so later, it released the 8088. Both devices are 16-bit microprocessors, which executed instructions in as little as 400 ns (2.5 MIPs, or 2.5 millions of instructions per second). This represented a major improvement over the exe- cution speed of the 8085. In addition, the 8086 and 8088 addressed 1M byte of memory, which was 16 times more memory than the 8085. (A 1M-byte memory contains 1024K byte-sized memory locations or 1,048,576 bytes.) This higher execution speed and larger memory size allowed the 8086 and 8088 to replace smaller minicomputers in many applications. One other feature found in the 8086/8088 was a small 4- or 6-byte instruction cache or queue that prefetched a few instructions before they were executed. The queue sped the operation of many sequences of instructions and proved to be the basis for the much larger instruction caches found in modem microprocessors.

The increased memory size and additional instructions in the 8086 and 8088 have led to many sophisticated applications for microprocessors. Improvements to the instruction set included multiply and divide instructions, which were missing on earlier microprocessors.

In addition, the number of instructions increased from 45 on the 4004, to 246 on the 8085, to well over 20,000 variations on the 8086 and 8088 microprocessors. Note that these microprocessors are called CISC (complex instruction set computers) because of the number and complexity of instructions. The additional instructions eased the task of developing efficient and sophisticated applications, even though the number of instructions are at first overwhelming and time- consuming to learn. The 16-bit microprocessor also provided more internal register storage space than the 8-bit microprocessor. The additional registers allowed software to be written more efficiently.

The 16-bit microprocessor evolved mainly because of the need for larger memory systems.

The popularity of the Intel family was ensured in 1981, when IBM Corporation decided to use the 8088 microprocessor in its personal computer. Applications such as spreadsheets, word processors, spelling checkers, and computer-based thesauruses were memory-intensive and required more than the 64K bytes of memory found in 8-bit microprocessors to execute effi- ciently. The 16-bit 8086 and 8088 provided 1M byte of memory for these applications. Soon, even the 1M-byte memory system proved limiting for large databases and other applications.

This led Intel to introduce the 80286 microprocessor, an updated 8086, in 1983.

(27)

3Windows is a registered trademark of Microsoft Corporation and is currently available as Windows 98, Windows 2000, Windows ME, and Windows XP.

The 80286 Microprocessor. The 80286 microprocessor (also a 16-bit architecture microprocessor) was almost identical to the 8086 and 8088, except it addressed a 16M-byte memory system instead of a 1M-byte system. The instruction set of the 80286 was almost identical to the 8086 and 8088, except for a few additional instructions that managed the extra 15M bytes of memory. The clock speed of the 80286 was increased, so it executed some instructions in as little as 250 ns (4.0 MIPs) with the original release 8.0 MHz version. Some changes also occurred to the internal execution of the instructions, which led to an eightfold increase in speed for many instructions when compared to 8086/8088 instructions.

The 32-Bit Microprocessor. Applications began to demand faster microprocessor speeds, more memory, and wider data paths. This led to the arrival of the 80386 in 1986 by Intel Corporation.

The 80386 represented a major overhaul of the 16-bit 8086–80286 architecture. The 80386 was Intel’s first practical 32-bit microprocessor that contained a 32-bit data bus and a 32-bit memory address. (Note that Intel produced an earlier, although unsuccessful, 32-bit microprocessor called the iapx-432.) Through these 32-bit buses, the 80386 addressed up to 4G bytes of memory. (1G of memory contains 1024M, or 1,073,741,824 locations.) A 4G-byte memory can store an astound- ing 1,000,000 typewritten, double-spaced pages of ASCII text data. The 80386 was available in a few modified versions such as the 80386SX, which addressed 16M bytes of memory through a 16-bit data and 24-bit address bus, and the 80386SL/80386SLC, which addressed 32M bytes of memory through a 16-bit data and 25-bit address bus. An 80386SLC version contained an internal cache memory that allowed it to process data at even higher rates. In 1995, Intel released the 80386EX microprocessor. The 80386EX microprocessor is called an embedded PC because it contains all the components of the AT class personal computer on a single integrated circuit. The 80386EX also contains 24 lines for input/output data, a 26-bit address bus, a 16-bit data bus, a DRAM refresh controller, and programmable chip selection logic.

Applications that require higher microprocessor speeds and large memory systems include software systems that use a GUI, or graphical user interface. Modem graphical displays often contain 256,000 or more picture elements (pixels, or pels). The least sophisticated VGA (variable graphics array) video display has a resolution of 640 pixels per scanning line with 480 scanning lines (this is the resolution used when the computer boots and display the boot screen). To display one screen of information, each picture element must be changed, which requires a high-speed microprocessor. Virtually all new software packages use this type of video interface. These GUI-based packages require high microprocessor speeds and accelerated video adapters for quick and efficient manipulation of video text and graphical data. The most striking system, which requires high-speed computing for its graphical display interface, is Microsoft Corporation’s Windows.3We often call a GUI a WYSIWYG (what you see is what you get) display.

The 32-bit microprocessor is needed because of the size of its data bus, which transfers real (single-precision floating-point) numbers that require 32-bit-wide memory. In order to effi- ciently process 32-bit real numbers, the microprocessor must efficiently pass them between itself and memory. If the numbers pass through an 8-bit data bus, it takes four read or write cycles;

when passed through a 32-bit data bus, however, only one read or write cycle is required. This significantly increases the speed of any program that manipulates real numbers. Most high-level languages, spreadsheets, and database management systems use real numbers for data storage.

Real numbers are also used in graphical design packages that use vectors to plot images on the video screen. These include such CAD (computer-aided drafting/design) systems as AUTOCAD, ORCAD, and so forth.

數據

table is 16 bits because the maximum table length is 64K bytes. When the protected mode oper- oper-ation is desired, the address of the global descriptor table and its limit are loaded into the GDTR.
TABLE  DB  3FH, 06H, 5BH, 4FH    ;lookup table DB  66H, 6DH, 7DH, 27H
table for the AND operation and (b) the logic symbol of an AND gate.
table for the OR operation and (b) the logic symbol of an OR gate.

參考文獻

相關文件

• The  ArrayList class is an example of a  collection class. • Starting with version 5.0, Java has added a  new kind of for loop called a for each

• helps teachers collect learning evidence to provide timely feedback & refine teaching strategies.. AaL • engages students in reflecting on & monitoring their progress

Robinson Crusoe is an Englishman from the 1) t_______ of York in the seventeenth century, the youngest son of a merchant of German origin. This trip is financially successful,

fostering independent application of reading strategies Strategy 7: Provide opportunities for students to track, reflect on, and share their learning progress (destination). •

Strategy 3: Offer descriptive feedback during the learning process (enabling strategy). Where the

First Taiwan Geometry Symposium, NCTS South () The Isoperimetric Problem in the Heisenberg group Hn November 20, 2010 13 / 44.. The Euclidean Isoperimetric Problem... The proof

ASL arithmetically shift a memory location left by one bit ASLA arithmetically shift the accumulator left by one bit ASLX arithmetically shift the index register left by one bit

• A put gives its holder the right to sell a number of the underlying asset for the strike price.. • An embedded option has to be traded along with the