[PDF] 803 bus route timetable
[PDF] 803 bus times austin
[PDF] 804 bus schedule
[PDF] 804 bus timetable 2018
[PDF] 804 bus timetable dandenong
[PDF] 804 bus timetable merrylands
[PDF] 804 bus timetable metropark
[PDF] 804 bus timetable miller
[PDF] 804 bus timetable pdf
[PDF] 80486 and pentium
[PDF] 805 area code camarillo california
[PDF] 805 area code city map
[PDF] 805 area code current time zone
[PDF] 805 area code location california
[PDF] 805 area code location ohio
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
Library of Congress Cataloging in Publication Data
Brey, Barry B.
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 Hallis 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., LondonPearson 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.
10987654321
ISBN-13: 978-0-13-502645-8
ISBN-10: 0-13-502645-8
This text is dedicated to my progenies, Brenda (the programmer) and Gary (theveterinarian technician), and to my constant four-legged companions: Romy,Sassy, Sir Elton, Eye Envy, and Baby Hooter.
iii
This page intentionally left blank
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 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.vi
PREFACE
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
PREFACEvii
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 bbrey@ee.net 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/breyviii
PREFACE
CHAPTER1INTRODUCTION TO THE MICROPROCESSOR AND COMPUTER 1
CHAPTER
2THE MICROPROCESSOR AND ITS ARCHITECTURE 51
CHAPTER
3ADDRESSING MODES 77
CHAPTER
4DATA MOVEMENT INSTRUCTIONS 111
CHAPTER
5ARITHMETIC AND LOGIC INSTRUCTIONS 156
CHAPTER
6PROGRAM CONTROL INSTRUCTIONS 192
CHAPTER
7USING ASSEMBLY LANGUAGE WITH C/C++ 223
CHAPTER
8PROGRAMMING THE MICROPROCESSOR 250
CHAPTER
98086/8088 HARDWARE SPECIFICATIONS 302
CHAPTER
10MEMORY INTERFACE 328
CHAPTER
11BASIC I/O INTERFACE 377
CHAPTER
12INTERRUPTS 451
CHAPTER
13DIRECT MEMORY ACCESS AND DMA-CONTROLLED I/O 490
CHAPTER
14THE ARITHMETIC COPROCESSOR, MMX, AND SIMD TECHNOLOGIES 531
CHAPTER
15BUS INTERFACE 592
CHAPTER
16THE 80185, 80188, AND 80286 MICROPROCESSORS 627
BRIEF CONTENTS
ix
CHAPTER17THE 80386 AND 80486 MICROPROCESSORS 677
CHAPTER
18THE PENTIUM AND PENTIUM PRO MICROPROCESSORS 729
CHAPTER
19THE PENTIUM II, PENTIUM III, PENTIUM 4, AND CORE2 MICROPROCESSORS 759
xBRIEF CONTENTS CHAPTER1INTRODUCTION 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
CHAPTER2THE 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
CHAPTER3ADDRESSING 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 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
CHAPTER4DATA 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
CHAPTER5ARITHMETIC 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
CHAPTER6PROGRAM 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
xiiCONTENTS
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
CHAPTER7USING 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
CHAPTER8PROGRAMMING 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
CHAPTER98086/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
CONTENTSxiii
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
CHAPTER10MEMORY 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
quotesdbs_dbs14.pdfusesText_20