68000 MICROPROCESSOR Also by the Author from TAB BOOKS Inc
Total Page:16
File Type:pdf, Size:1020Kb
MASTERING THE 68000 MICROPROCESSOR Also by the Author from TAB BOOKS Inc. 1656 The Programming Guide to the Z80™ Chip MASTERING THE MICROPROCESSOR PHILLIP R. ROBINSON FIRST EDITION FIRST PRINTING Copyright © 1985 by TAB BOOKS Inc. Printed in the United States of America Reproduction or publication of the content in any manner, without express permission of the publisher, is prohibited. No liability is assumed with respect to the use of the information herein. Library of Congress Cataloging in Publication Data Robinson, Phillip R. Mastering the 68000 microprocessor. On t.p. the registered trademark symbol "TM" is superscript following "6800" in the title. Includes index. 1. Motorola 68000 (Microprocessor) I. Title. QA76.8.M6895R63 1985 001.64 85-4666 ISBN 0-8306-0886-9 ISBN 0-8306-1886-4 (pbk.) MC68000 is a trademark of Motorola Inc. Contents Preface ix Acknowledgments xi Introduction xv 1 Why Bother About Microprocessors? 1 Power and Popularity 1 Standardization Versus Specialization 3 Cost and Yield 3 Intel's Breakthrough 4 Microprocessor Evolution 5 Microprocessors and Microcomputers 6 Software Versus Hardware 7 Compatibility and Chip Families 7 2 Architecture 9 History and Design Philosophy 9 68000 History-Power Versus Compatibility 8, 16, or 32 Bits 11 Buses 13 Data Bus-Address Bus-Control Bus Registers 15 General Purpose-Special Purpose Arithmetic LogiC Unit 17 Decoder 17 Prefetch Queue 19 Addressing Modes 20 Data Types 20 Instructions 20 Operating Modes 20 Speed 21 Interrupts and Exceptions 22 3 Registers 23 Register Advantages 23 Register Types 24 68000 General-Purpose Registers 25 Data Registers-Address Registers 68000 Special-Purpose Registers 26 Stack Pointers-Status Register-Program Counter 4 Addressing 35 Operand Sizes 35 The Shape of Memory 36 Registers-Memory Addressing Modes 38 Register Specification-Effective Address-Syntax-Register Direct Modes-Memory Address Modes-Special Addressing Modes-Quick Immediate-Absolute Addressing-Relative Addressing-Implicit Reference Addressing Importance of Addressing Modes 46 5 Instruction Groups 47 You Don't Have to Learn Them All 48 Instruction Groups 49 Data Movement-Integer Arithmetic-Decimal-Logical-Shift and Rotate-Bit Manipulation Program Control Operations-System Control-Nothing Instructions Summary 76 6 Instruction Set n 7 Exceptions 157 Polling, Interrupts, and Exceptions 157 68000 Processing States 158 68000 Privilege Modes 158 User Mode-Supervisor Mode Reference Classification 160 Exception Processing 160 Types of Exceptions-Exception Priorities Summary 163 8 The 68000 Family 165 CPU Chips 167 68000-68008--68010-68020-68200 Peripheral Chips 183 68881 FPC-68851 PMMU-68451 MMU-68452 BAM-68120 IPC-68440 DDMA-68450 DMAC-68230 PlfT Data Communications Chips 192 68652 MPCC-68653 PGC-68661 EPCI-68681 DUART-68562 DUSCC-68564 SIO Mostek Peripheral Chips 194 68901 MFP-68564 S10-68345 FIFO-68590 LANCE Summary 194 9 Assembly Language 195 Computer Languages 195 Machine Language-Assembly Language-High-Level Languages-A Quick Comparison Language Selection 200 Using a 68000 Assembler 201 Op Code Mnemonics-Directives-Syntax-Format Macro Assemblers and Cross Assemblers 204 10 68000-Based Systems 207 Sinclair QL 208 IBM System 9000 209 Apple LISA and Apple Macintosh 209 Dimension 211 Convergent Technologies MiniFrame and MegaFrame 213 Synapse N+1 214 Index 215 ---------------------------------------------------------------------------------------------------------------------- Preface Most introductions to microprocessors center on vanced concepts such as frame pointers, supervisor 8-bit chips. Because I6-bit chips such as the 68000 mode, and memory management, but you don't have microprocessor are powerful, they are often con to use them. sidered too complicated for beginners. I want this The 68000 can be used for simple programs just book to fight that image and that custom. as an 8-bit chip can. But if you have a complicated The 68000 is far more powerful than the 8-bit data structure or routine to program, the 68000 will chips that were the basis of the first personal com make your life easier because it provides you with puters, but it is also, in many ways, easier to use. more tools for implementing such things. An 8-bit This pair of characteristics-power and ease of chip makes you do all the work with long sequences use-haven't washed away all of the reasons to learn of simple instructions: the 68000 lets you use just about 8-bit chips. The best chips of the 8-bit genera a few, more powerful instructions. Many functions tion are still used and programmed in personal com that took planning and programming on an 8-bit puters, controllers, and instrumentation. But for chip are reduced to a single, automatic operation those who want to keep up-to-date, or to catch up on the 68000. This process appears in many on technology, I6-bit chips are the natural choice. technologies and is particularly strong in microelec They are built into most new microprocessor-based tronics. While the chips become more powerful, us systems including virtually all new personal com ing them doesn't get more difficult (which is nice puters. because we aren't getting smarter). The elemental The 68000 is no more difficult to program than functions of the chips just keep advancing. Multiply any of the 8-bit chips. It just has more depth and ing I6-bit numbers or setting up a portion of the more capability than those chips. Sure, to get the stack for a subroutine was a major programming full use of the 68000 you must understand ad- task on a 4-bit microprocessor and required a ix carefully written subroutine on an 8-bit chip. Do shouldn't start with the 68000: it is one of the two ing the same jobs on a I6-bit chip such as the 68000 most popular 16-bit chips, and you can apply the only requires a single instruction. 68000 concepts you learn to 8-, 16-, or 32-chips. Keep in mind that you don't have to use all or In fact, the 68000 is more than a 16-bit even most of the 68000's power. By learning a few microprocessor. Many of its features handle 32-bits instructions and addressing modes, you can begin at a time. The 68000 family-which is also de to write fast, practical, and clean routines and scribed in this book-is a set of chips that includes programs. the 68008 (found in inexpensive home computers) If you're an old hand in the microprocessor and the 68020 (a full 32-bit chip that is found in business, you'll know that the 68000 is one of the super-minicomputers). Learn about the 68000 and most widely used 16-bit chips. If you're new to you will know most of the details of these chips, too. microprocessors, there is a no reason why you x Acknowledgments I would like to thank Cindy Martin, my wife, who sending me foundation materials for this book to ac helps me continue my real life while I'm caught up cepting my pleas for more time. in the pages of a book. I also thank the people at The people in the computer industry, from chip TAB BOOKS Inc. (especially Kimberly Tabor, Ray makers to computer crafters, who sent me informa mond Collins, Sandy Shatzer, and Leslie Wenger) tion and photographs of their products helped me who were patient and helpful all the way from greatly. These include the following individuals: Stan Victor of Mostek Corporation. David Anderson, James Lovegrove, Susan Dunn, and Lothar Stem of Motorola Inc. Erica Vogler of Apple Computer Corporation. Jill Palmquist of Corvus Systems. Barbara Henry of Micro Craft Corporation. Donna Caruso of Charles River Data Corporation. Mike Radisich and Dennis Steiner of Hewlett- Packard. Rick Bennett of Synapse Computer Corporation. Tracy Adams of Convergent Technologies. Leslie Baba of Callan Data Systems. Sinclair Research, Ltd. xi MASTERING THE 68000 MICROPROCESSOR Introduction This book has two purposes. First, it introduces you structions, this book covers each vital part of the to microprocessors using the 68000 chip as a guide. chip. There are some advanced details of the 68000 If you are unfamiliar with microcomputing that this book doesn't attempt to cover, including technology, the 68000 is an excellent choice as a first such things as the exact timing of instructions, the microprocessor. Despite its deserved reputation as interfacing of peripherals, and the algorithms for a very powerful 16-bit microprocessor, the 68000 assembly language subroutines. Those subjects are can be both understood and used by beginners. The better left to the original literature from the chip fundamental programming elements of the maker or a book dedicated to this subject. 68000-from instructions to addressing modes-are My intention is to present the software side of no more complicated to learn than those of far less the 68000 in a simple and painless way. If you want powerful 8-bit chips. But because those elements to learn about the hardware side of the 68000, you contain more punch and because the 68000 family still need to know what is in this book. After you includes chips with advanced instructions and have read it, then you'll be ready to study the memory addressing schemes, a 68000 program gets manufacturers' hardware details and specifications. more done than a comparable program for an 8-bit Chapter 1 explains the genesis and the impor chip. For that reason, if you are familiar with tance of microprocessors and the 68000. This is not microcomputing, you'll probably have heard of the a detailed history-plenty of those have been writ power and influence of the 68000 microprocessor. ten elsewhere. Instead, Chapter 1 is just a refresher The second purpose of this book is to present on the reasons why any of us bother with these tiny the fundamental information you need to under and complicated chips along with some suggestions stand and write 68000 assembly language pro on how to use this book.