1. Trang chủ
  2. » Giáo Dục - Đào Tạo

The intel microprocessors architecture, programming, and interfacing – part 1

395 11 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 395
Dung lượng 3,85 MB

Nội dung

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 Intel 80xxx series microprocessors Pentium (Microprocessor) 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 permission 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 Singapore Pte Ltd Pearson Education Canada, Inc Pearson Education—Japan Pearson Education Australia Pty Limited Pearson Education North Asia Ltd., Hong Kong Pearson Educación de Mexico, S.A de C.V Pearson Education Malaysia Pte Ltd 10 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 (the veterinarian technician), and to my constant four-legged companions: Romy, Sassy, Sir Elton, Eye Envy, and Baby Hooter iii This page intentionally left blank PREFACE This practical reference text is written for students who require a thorough knowledge of programming 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 microprocessor 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 programming 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, keyboard/display controllers, arithmetic coprocessors, and video display systems Also discussed are v vi PREFACE 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 microprocessors Instructions for each family member, which include the 80386, 80486, Pentium, Pentium Pro, Pentium II, Pentium III, and Pentium processors, are compared and contrasted with those for the 8086/8088 microprocessors This entire series of microprocessors is very similar, 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 floatingpoint 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 programming 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 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: 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 Program using MFC controls, handlers, and functions to use the keyboard, video display system, and disk memory in assembly language and C++ Develop software that uses macro sequences, procedures, conditional assembly, and flow control assembler directives that are linked to a Visual C++ program Develop software for code conversions using lookup tables and algorithms Program the numeric coprocessor to solve complex equations Develop software for the MMX and SIMD extensions Explain the differences between the family members and highlight the features of each member Describe and use real and protected mode operation of the microprocessor 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 PREFACE vii CONTENT OVERVIEW Chapter introduces the Intel family of microprocessors with an emphasis on the microprocessorbased 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 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 through 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 introduces the use of Visual C/C++ Express with the inline assembler and separate 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 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 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 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 family of arithmetic coprocessors, as well as MMX and SIMD instructions Today few applications function efficiently without the power of the arithmetic coprocessor Remember that all Intel microprocessors 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 microprocessors 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 original 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 viii PREFACE the assembler program and the Windows Visual C++ interface A complete listing of all 8086–Pentium and Core2 instructions, including many example instructions and machine coding 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 evennumbered 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/brey BRIEF CONTENTS CHAPTER INTRODUCTION TO THE MICROPROCESSOR AND COMPUTER CHAPTER THE MICROPROCESSOR AND ITS ARCHITECTURE 51 CHAPTER ADDRESSING MODES 77 CHAPTER DATA MOVEMENT INSTRUCTIONS 111 CHAPTER ARITHMETIC AND LOGIC INSTRUCTIONS 156 CHAPTER PROGRAM CONTROL INSTRUCTIONS 192 CHAPTER USING ASSEMBLY LANGUAGE WITH C/C++ 223 CHAPTER PROGRAMMING THE MICROPROCESSOR 250 CHAPTER 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 ix 362 D8–D15 D0–D7 A1–A16 U2 10 25 24 21 23 26 27 22 20 M27512 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 O0 O1 O2 O3 O4 O5 O6 O7 U3 11 12 13 15 16 17 18 19 10 25 24 21 23 26 27 22 20 OE CE M27512 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 O0 O1 O2 O3 O4 O5 O6 O7 U4 11 12 13 15 16 17 18 19 10 25 24 21 23 26 27 22 20 OE CE M27512 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 O0 O1 O2 O3 O4 O5 O6 O7 U5 11 12 13 15 16 17 18 19 10 25 24 21 23 26 27 22 20 OE CE M27512 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15 O0 O1 O2 O3 O4 O5 O6 O7 11 12 13 15 16 17 18 19 OE CE #MRDC #MWTC A0 A23 A22 A21 A20 A19 A18 A17 A16 #BHE 10 11 12 13 16 VCC 28 I I I I I I I I I I I I/O I/O I/O I/O I/O I/O I/O I/O I/O I/O 17 18 19 20 21 23 24 25 26 27 I/CLK VCC U1 GAL22LV10C/LCC LWR HWR RB0 RB1 RB2 RB3 U6 10 25 24 21 23 26 22 27 20 28 FIGURE 10–32 HM62256 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 OE WE CE VCC D0 D1 D2 D3 D4 D5 D6 D7 U7 11 12 13 15 16 17 18 19 10 25 24 21 23 26 22 27 20 28 HM62256 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 OE WE CE VCC D0 D1 D2 D3 D4 D5 D6 D7 U8 11 12 13 15 16 17 18 19 10 25 24 21 23 26 22 27 20 28 HM62256 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 OE WE CE VCC An 80386SX memory system containing 256K of EPROM and 128K of SRAM D0 D1 D2 D3 D4 D5 D6 D7 U9 11 12 13 15 16 17 18 19 10 25 24 21 23 26 22 27 20 28 HM62256 A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 OE WE CE VCC D0 D1 D2 D3 D4 D5 D6 D7 11 12 13 15 16 17 18 19 363 MEMORY INTERFACE four 27512 (64K × 8) EPROMs and 128K bytes of SRAM memory found in four 62256 (32K × 8) SRAMs Notice in Figure 10–32 that the PLD also generates the memory bank write signals LWR and HWR As can be gleaned from this circuit, the number of components required to interface memory has been reduced to just one, in most cases (the PLD) The program listing for the PLD is located in Example 10–8 The PLD decodes the 16-bit-wide memory addresses at locations 000000H–01FFFFH for the SRAM and locations FC0000H–FFFFFFH for the EPROM EXAMPLE 10–8 VHDL code for the decoder of Figure 10–32 library ieee; use ieee.std_logic_1164.all; entity DECODER_10_32 is port ( A23, A22, A21, A20, A19, A18, A17, A16, A0, BHE, MWTC: in STD_LOGIC; LWR, HWR, RB0, RB1, RB2, RB3: out STD_LOGIC ); end; architecture V1 of DECODER_10_32 is begin LWR HWR RB0 RB1 RB2 RB3 end V1; 10–5

Ngày đăng: 26/10/2022, 22:34