Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
68000 assembly language programming: a structured approach
Bennett J., Prentice-Hall, Inc., Upper Saddle River, NJ, 1986. Type: Book (9789780138113810)
Date Reviewed: Dec 1 1989
Comparative Review

The Motorola MC68000 processor continues to find extensive use in industrial and business applications despite its age, at least in microprocessor terms (it was introduced in 1979). It has become a de facto industry standard 16(32)-bit CPU, as witnessed by the number of books currently available on how to program it.

A previous comparative review of MC68000 texts (<CR> 8810-0740) may have left readers with the impression that Harman and Lawson remains the “standard against which other [texts] in this area will be judged.” Indeed, only Gorsline was seen as measuring up to Harman and Lawson. Since that time, several MC68000 books have been published, one of which, the Ford and Topp text, surpasses the “standard” set by Harman and Lawson. In order to place Ford and Topp’s book in perspective, I will comment on the strengths and weaknesses of some MC68000 assembly language programming books published to date (in chronological order).

Leventhal, Hawkins, Kane, and Cramer

Lance Leventhal has not so much written many books on microprocessors as written the same book many times (Kane, Hawkins, and Leventhal [1] is the 68000 version). Like its illustrious predecessors (see Osborne [2]), Kane et al. has a number of excellent features, such as the use of boldface type for the key parts of the text and Roman type to expand on this material (this enables the more experienced reader to skip over topics as desired). The authors illustrate the 68000 instruction set by presenting numerous sample programs. These programs are well set out, thoroughly commented, and described using extensive flow charting and many diagrams. Interfacing to 6800-style peripherals is covered (6821 PIA in chapter 13 and 6850 ACIA in chapter 14). Software development is given extended coverage; separate chapters discuss problem definition, program design, documentation, debugging, testing, maintenance, and redesign. Chapter 22 describes each individual 68000 instruction in some detail. Three appendices, which serve as excellent quick reference guides, are included. The first edition of Kane et al. appeared in 1981, and the second edition--Leventhal et al.--in 1986. This second edition incorporates minor revisions, primarily in chapters 3 (“Machine Architecture”) and 12 (“Advanced 68020 Addressing and Instructions”). Either edition provides excellent coverage of 68000 assembly language programming, and indeed rivalled Harman and Lawson as the first choice 68000 text for a number of years.

King and Knight

The strength of King and Knight’s book, originally published in 1983, is its gradual development of a feel for the 68000 instruction set by employing short example routines (albeit not as comprehensively as Leventhal et al.). Comparing data, stacks and subroutines, arithmetic, logical operations, and exception handling are treated in chapters 4 through 7. A detailed case study of a monitor program for running and debugging assembler programs follows in chapter 8. The second edition of this book appeared in 1987 and was a significant improvement over the first. One chapter covering other processors in the MC68000 family and four appendices have been added. The appendices cover extra 68010 instructions, extra 68020 instructions, examples for common micros, and sample answers to the exercises. Keywords are highlighted in boldface. The only interfacing example in either edition uses a 6850 ACIA to write a character string out onto a serial link, which also illustrates how the MOVEP instruction is useful in interfacing between the 16-bit CPU and an 8-bit peripheral device.

Harman and Lawson

Four 68000 books were published during 1985: Harman and Lawson, Jaulent, Kelly-Bootle and Fowler, and Williams. Harman and Lawson write in the classic university textbook style, and thus make the reader suffer general microcomputer organization and number system representation yet again. Not until chapter 4 do we get down to a serious look at the MC68000 (registers and addressing modes). Basic 68000 instructions are introduced in chapter 5 in the context of Motorola’s assembler and MACsbug monitor. Subsequent chapters are devoted to data transfer, program control, and subroutines (chapter 6); arithmetic operations (chapter 7); logical and bit operations (chapter 8); programming techniques (chapter 9); system operation (chapter 10); exception processing (chapter 11); and interfacing and I/O programming (chapter 12). Chapter 9 includes a discussion of position-independent code and implementation of data structures (arrays and linked lists). Chapter 12 discusses the RESET and MOVEP instructions in relation to interfacing to 6800-style peripheral controllers (the 6850 ACIA, 6821 PIA, and 6840 PTM). Exercises are presented at the end of each chapter section, and answers to selected questions appear at the end of the book. The treatment throughout the body of the text is good; the best feature of this book, however, may be the appendices. Extensive use has been made of Motorola publications [3,4]. In a sense, students purchasing this text receive two books in one. Harman and Lawson present far fewer programming examples than Leventhal et al.

Jaulent

The first four chapters of Jaulent’s book are devoted to hardware considerations. Chapter 5 discusses addressing modes of the 68000, 68008, and 68010 processors, making extensive use of diagrams and screen dumps of register contents (although the particular assembler used is never introduced). The 68000 instruction set is covered in chapter 6, which includes numerous programming examples (such as a palindrome check, counting the number of 1s in a longword, and a table search for a particular binary word). Chapter 7 presents two more substantial programming exercises--an examination of 68000 exceptions (including interrupts generated by a 6821 PIA) and a dynamic memory test routine. Five appendices are included, one of which covers the PAL devices referred to in the earlier hardware chapters. The book is rather short and suffers from the lack of an index, figure captions, and chapter summaries.

Kelly-Bootle and Fowler

Kelly-Bootle and Fowler include a discussion of memory management, virtual memory, and RAMdisk as background to the separate chapters on the MC68010 and MC68020. Good diagrams, particularly of registers and memory, characterize the book and help illustrate programming principles, particularly where advanced topics are concerned. “Practical application” boxes are a good feature in which recently introduced topics are applied to a real-world problem (although not as extensively as in Leventhal et al.)

Williams

Williams, like Kane et al., begins with basic concepts before introducing the MC68000. Instruction formats are well set out, including the contents of registers both before and after instruction execution. The discussion of the 68000 instruction set is preceded by an introduction to program development mechanics (text editor, assembly, linking, loading, and debugging). Here the book makes its commitment to an outmoded operating system, CP/M-68K, in order to illustrate commonly encountered C language constructs (UNIX is only mentioned in passing). I/O is covered differently than in most other 68000 texts, beginning with a general discussion of terminal, file, character, and special I/O. This discussion is followed by the interfacing of 68000 assembly routines to high-level programs in a CP/M-68K context. High-level data structures (records, arrays, linked lists, stacks, queues, and trees), sorting, searching, hashing, and recursion are covered in a separate chapter. These concepts are admirably illustrated by a 68000 telephone directory system. The following chapter treats exception processing and interrupts. Williams presents a case study of a complete 68000 operating system in chapter 8 after first introducing operating system fundamentals.

Bennett

Six 68000 texts were published during 1986--Bennett, Bramer, Dr. Dobb’s, Gill et al., Krantz and Stanley, and Triebel and Singh. Bennett’s book has been the subject of an earlier review (<CR> 8806-0376), which asserted that it demonstrates a poor understanding of the tradeoffs between assembly and high-level languages. Like Williams, and Krantz and Stanley, Bennett discusses 68000 programming from a high-level language (HLL) perspective. Unfortunately, the HLL chosen is not C, nor even Pascal, but rather a “Pascal-like” language called Pasweb, which is an amalgam of Pascal and WEB (a macro expander based on Knuth’s work on T2EX). Pasweb serves as a program description language with which algorithms are described prior to their encoding in 68000 assembler. High-level control structures, including GOTO, IF . . . THEN . . . ELSE, CASE, REPEAT . . . UNTIL, FOR, and WHILE loops, are covered. The book also covers context switching, parameter passing, and complex data structures (bit maps, multidimensional arrays, records, and dynamic data structures such as stacks, queues, and linked lists). Bennett also mentions high-level languages and assembler routine linkage. Programming examples (and assembler notation, etc.) are oriented around the Motorola MEX68KECB single-board microcomputer. Likewise, the author discusses I/O in the context of TUTOR routines (TUTOR is the monitor-in-ROM included in the MEX68KECB). I/O devices covered are the MC6850 ACIA and MC68230 PI/T. Disappointingly, very few programming examples (of any sort) are presented.

Bramer

A good feature of Bramer’s text is the use of chapter reviews. He devotes a separate chapter to the fundamentals of software engineering; it covers documentation, analysis, stepwise refinement of program design, modular programming, and testing. He develops 68000 programming slowly and thoroughly from the early chapters on. He makes moderate use of sample programs. The book culminates in advanced topics such as records, arrays, and case statements in chapter 15. The coverage of I/O programming is restricted to the 6821 PIA (push-button switches and LEDs) and the 6850 ACIA (using both polling and interrupts). Chapter 21 covers the writing of position-independent code, while chapter 22 is devoted to macros and conditional assembly. The final chapter summarizes the various 68000 family members. Five appendices are included. They cover the representation of data within the computer, a 68000 summary, difficulties in implementing the sample programs presented in the text due to the target microcomputer, an assembly language subroutine library listing, and answers to all exercises. The latter feature is not often included in such texts and is most welcome. A reference list is also provided.

Editors of Dr. Dobb’s Journal

The 19 chapters of the Dr. Dobb’s book are essentially reprinted from Dr. Dobb’s Journal of Programming Tools and are divided into three sections--an introduction to the 68000 family, 68000 development tools, and useful 68000 routines and techniques. The introductory section is rather brief, yet it includes several small programming examples as well as a discussion of the 68020 CPU and its 68851 and 68881 coprocessors. The development section includes a tiny BASIC interpreter, two FORTH interpreters (a favorite of Dr. Dobb’s), and a two-pass 68000 cross-assembler written in Modula-2 (complete listings are provided for each). The first FORTH program includes a good discussion of the four threading options available when writing a threaded interpreter. The useful routines section begins with a chapter on good programming convention, which includes modular design, position-independent code, reentrant code, recursion, jump tables, parameter passing, and linkage of assembler routines to HLL programs. This chapter is followed by a discussion of the MEX68KECB TUTOR firmware, multitasking kernels, a random number generator, a memory test (which can overlap itself during program execution), an integer square root routine, a Mandelbrot routine for the Apple Macintosh, and a binary search program. (Specialized assembler books on the Macintosh and other specific microcomputers are beyond the scope of the present review.) While this book contains a lot of useful and practical information, it is not particularly suitable as a primary 68000 text; it is better suited as a companion or adjunct to such books as Ford and Topp, Leventhal et al., and Harman and Lawson.

Gill, Corwin, and Logar

Gill et al. use a limited number of programming examples, including echoing characters to a screen, transmitting arguments to subroutines, nested subroutine, recursion (the example is everyone’s favorite, the Towers of Hanoi), interrupt-driven prompt (which includes a brief mention of coroutines), and ASCII-to-binary conversion. They use the Motorola MEX68KECB single-board computer to illustrate traps, interrupts, and programming of the onboard MC68230 PI/T to provide a time request facility. The last chapter is devoted to advanced assembly techniques, namely macros, local variables, repeat directive, and conditional assembly.

Krantz and Stanley

The first 11 chapters of Krantz and Stanley’s book introduce the 68000 architecture, addressing modes, and instructions (chapter 10 covers parameter passing). The authors then switch to tutorial mode, using YASE (Yet Another Screen Editor) as a vehicle to illustrate advanced 68000 programming concepts. Unfortunately, YASE was targeted for a Pro-68 IBM PC plug-in card running either OS9/68K or CP/M-68K--a rather esoteric application. UNIX is only mentioned in passing, in relation to termcap. Topics covered include data structures, user interfaces, bit-mapped graphics, and serial I/O (using an MC68681 DUART). A separate chapter introduces the 68010 and 68020 processors, which goes somewhat against the flow of the book up to this point. The appeal of this book is its orientation to a practical, real-world application (albeit a rather obscure one), although the authors have essentially placed all their eggs in one basket by using just one large case study. Nevertheless, the systems programming orientation is welcome, particularly the attention to real-world considerations in chapter 16, “The Hard Stuff that the Compiler Usually Takes Care Of,” and chapter 20, “The Last Step” (program debugging).

Triebel and Singh

Triebel and Singh’s book is an outgrowth of an earlier work by the same authors, which covered both the MC68000 and the i8086 [5]. The use of “before” and “after” software model diagrams of the 68000 to illustrate addressing modes and instruction execution is a good feature and aids in the grasping of fundamental concepts. Very few substantial programming examples are included, however. In chapter 5 the Motorola MEX68KECB is introduced. TUTOR Monitor commands are covered in some detail, as are the writing and debugging of programs on this single-board microcomputer. The interfacing coverage has more of a hardware orientation than in most 68000 assembly language texts (indeed, an entire chapter is devoted to the MEX68KECB hardware). The I/O devices covered are the 6821 PIA, 6850 ACIA, and 68230 PI/T (the latter two devices are used on the MEX68KECB). The authors make extensive use of Motorola data sheets, especially in the appendix on the MC68230.

Ford and Topp

Three more 68000 texts were published in 1988--Ford and Topp, Gorsline, and Skinner. Ford and Topp’s book is excellent. It is thorough and comprehensive from beginning to end. The attention to detail is superb, down to the handy reference information included on the inside front and back covers and the use of the odometer example to illustrate two’s complement numbers. The first three chapters discuss general concepts such as data representation and machine organization. Programming concepts are introduced gradually in chapter 4; numerous examples help explain these concepts. The 68000 programs are often preceded by an algorithm description and a Pascal solution to the problem at hand. Sample programs are presented in standard Motorola M68KMASM format. Chapter 5 covers the implementation of HLL programming structures (IF . . . THEN . . . ELSE, WHILE . . . DO, and FOR . . . DO). Chapter 6 deals with arrays and stacks and includes the Pascal record structure. These concepts are illustrated by selection sort, arrays of records, and selection sort routines. Chapter 7 covers subroutines, including parameter passing (with and without functions), bubble sort, and register dump routines. Chapter 8 covers arithmetic, including floating point addition and multiplication routines. String handling and data conversion (including encryption) are described in the following chapter. Chapter 10 deals with run-time support for HLL constructs such as case (jump tables), sets, matrices, stack frames, and recursion (using the ubiquitous Towers of Hanoi). Reentrant code and position-independent code are also discussed. Chapter 11 treats HLL data structures (stacks, queues, linked lists, binary trees, and hashing).

Ford and Tropp present I/O programming in the context of the MEX68KECB single-board computer. Routines illustrate the MC6850 ACIA (polled terminal I/O, echoing characters, and transparent mode), MC68230 in timer mode (downloading, screen blanking, and process switching), and MC68230 in parallel mode (Centronics printer driver). Chapter 13 deals with exception processing, including system initialization and traps. A single-stepping program illustrates the principles introduced earlier. Peripheral device interrupts are treated in chapter 14; routines illustrate a buffered interrupt-driven serial I/O, printer driver, elapsed time measurement, and process switching. A total of seven appendices cover condition codes computation, instruction format summary, and instruction execution times (all in standard Motorola format) as well as the MC68020 CPU (excellent coverage, with numerous programming examples), C language utility programs, and an ASCII code chart. These appendices are at least as comprehensive as those in either Harman and Lawson or Leventhal et al. Answers to selected exercises are also provided (each chapter concludes with both exercises and programming exercises). An instructor’s guide is available, as are a UNIX MC68020 cross-assembler (4.2 BSD or System V), VersaModule monitor, and all the programs included in the text proper ($75). A Consulair 68000 development system for the Apple Macintosh is also available ($40). In summary, Ford and Topp is an excellent 68000 programming text and the best available on the implementation of HLL constructs in 68000 assembly code.

Gorsline

Gorsline places assembly language programming in context by starting with a discussion of reusable modules and object-oriented systems (data encapsulation and hiding). A large proportion of the introductory material, especially diagrams, is taken from Gorsline’s earlier work [6] and from several other Prentice-Hall books. Indeed, the diagrams are a strong feature of this book and add significantly to the reader’s grasp of the material presented in the text. Gorsline covers both the MC68000 and the MC68020 processors (the MC680XY family). He develops programming topics in a gradual, controlled manner. Chapter 2 includes a good explanation of why having two stack pointers is advantageous. Chapters on program flow control, data manipulation, and macros follow. Five short programming examples (taken from Triebel and Singh) appear in the data manipulation chapter, together with flowcharts for each.

Chapter 6 covers I/O, with particular reference to the MC68681 DUART. Only one programming example is included, character I/O (based on a Motorola application note). The author discusses DMA in relation to the MC68450 DMAC, but leaves a fuller treatment until chapter 7. No programming example is presented in either chapter, however. Data transmission, printers, disks (both floppy and optical), and magnetic tape are also mentioned. Once again, the accompanying diagrams are excellent. Chapter 7 includes a few I/O programming examples, one of these being the use of a 68681 in a dual-task application. A general discussion of exceptions follows. Synchronization between DMA channels and a main program is discussed in terms of processes, concurrency, critical sections, and semaphores (using the TAS and CAS(2) instructions). The MC68120 Intelligent Peripheral Controller is also introduced.

Chapter 8 is devoted to assemblers and actually includes designs for a two-pass assembler and macro preprocessor (the former is taken from Gorsline’s earlier book [6]). Relocation, linking, and loading are covered in chapter 9, which also includes a good introductory treatment of operating systems. This treatment serves as a platform for introducing the MC68451 MMU and MC68010 virtual processor. A separate chapter covers the MC68881 floating-point coprocessor. A detailed listing of MC680XY family instructions appears in an appendix (68008, 68000, 68010, 68012, 68020, and 68881). In summary, Gorsline’s book is a little light on programming examples, but the diagrams are excellent. The book is also suitable as either an MC68000 or an MC68020 assembly language programming text.

Skinner

Skinner includes exercises at the end of each chapter and provides answers to all exercises. Programming is introduced by way of data movement, integer arithmetic, and conditional instructions. He introduces the concept of device-independent I/O early; routines for the Atari ST, Commodore Amiga, and Apple Macintosh computers are included in Appendix B. The programming of specific peripheral controllers is only briefly covered, and the discussion is limited to the MC6850 ACIA. Short example routines explain addressing modes. Separate chapters are devoted to stack manipulation and subroutines. This background information is then used to describe the implementation of linked lists. Skinner also covers shift and rotate instructions and multiprecision and decimal arithmetic. Separate chapters discuss the 68010, 68020, and 68030 family members. Overall, the book suffers first from a lack of substantial programming examples, and second from the lack of comprehensive appendices. Despite its more recent publication date (reflected by a separate chapter on the 68030), this book offers no real advantage over earlier texts.

Wakerly

Digital computer hardware is the starting point for Wakerly’s book. As in many recent texts, assembly language programming is placed in an HLL context. Chapters 2 and 3 introduce Pascal and data structures, respectively. The following two chapters provide conventional coverage of number systems and arithmetic and of basic computer organization. Naturally enough, 68000 family members are used to illustrate memory addressing capability, registers, instruction formats, and addressing modes in the latter chapter. A Pascal simulation of 68000 instruction set execution is also provided. Assembly language programming is introduced in chapter 5 and substantially explored in the following chapter. Chapter 7 deals with addressing modes, position-independent code, and memory management. Chapter 8 treats 68000 instructions and chapter 9 covers subroutines; the latter has a strong Pascal bias. The chapter on I/O is rather brief and restricted to keyboard and display drivers. It discusses no specific peripheral controller chips and, curiously, includes an i8086 I/O routine. Chapter 11 covers interrupts and DMA. Processes and concurrency are discussed in chapter 12, which includes good coverage of both timing-dependent processes (deadlocks, critical sections, locking, and semaphores) and shared data and instructions. These topics are illustrated by a 68000 routine that uses queues to buffer input and output.

A general discussion of program development is included in chapter 13. Chapter 14 discusses advanced 68000 family members but gives few programming examples, and 68000 family systems are covered in chapter 15. This chapter discusses cache, floating point and MMU coprocessors, and the MC6850 ACIA and MC68230 PI/T peripheral chips (it is a pity these latter two devices were not incorporated into chapter 10). I wonder why Wakerly included the remaining chapters, on the MC6809, PDP/LSI-11, i80x86, and hypothetical H11--it’s as if he found it difficult to disengage from the mode adopted in his earlier work [7]. I would have preferred to see this space used to expand the treatment of 68000 I/O along the lines indicated earlier. He includes two appendices--one on the ASCII character set and one on serial communication (again, the latter should have been incorporated into the section on I/O programming). The listing of keywords in the left-hand margin is welcome. Another good feature is the use of “Mac Notes” throughout the text to point out how the 68000 examples need to be modified in order to run on the Macintosh (under either MDS or MPW). The comments on the references at the end of each chapter are also helpful.

Conclusion

And (in my eyes) the winner is Ford and Topp. Leventhal et al. and Harman and Lawson are the runners up.

Reviewer:  John Fulcher Review #: CR113537
1) Kane, G.; Hawkins, D.; and Leventhal, L.68000 assembly language programming. Osborne/McGraw-Hill, Berkeley, CA, 1981.
2) Osborne, A.Introduction to microcomputers, vol. 1 (2nd ed.). Osborne/McGraw-Hill, Berkeley, CA, 1980.
3) Motorola, Inc.16-bit microprocessor user’s manual (3rd ed.). Prentice-Hall, Englewood Cliffs, NJ, 1982.
4) Motorola, Inc.MC68000 16/32-bit microprocessor programmer’s reference manual (4th ed.). Prentice-Hall, Englewood Cliffs, NJ, 1984.
5) Triebel, W. A. and Singh, A.16-bit microprocessors: architecture, software and interface techniques. Prentice-Hall, Englewood Cliffs, NJ, 1985.
6) Gorsline, G. W.16-bit modern microcomputers: the Intel I8086 family. Prentice-Hall, Englewood Cliffs, NJ, 1985. See <CR> Rev. 8507-0571.
7) Wakerly, J. F.Microcomputer architecture and programming. Wiley, New York, 1981.
Comparative Review
This review compares the following items:
  • 68000 assembly language programming: a structured approach:
  • MC68000 assembly language programming:
  • Dr. Dobb’s toolbook of 68000 programming:
  • The MC68000: assembly language and systems programming:
  • Assembly language programming for the 68000:
  • Assembly and assemblers: the Motorola MC68000 family:
  • The Motorola MC68000 microprocessor family: assembly language, interface, design, and system design:
  • The 68000 hardware and software:
  • 68000, 68010, 68020 primer:
  • Programming the M68000 (2nd ed.):
  • 68000 assembly language: techniques for building programs:
  • 68000 assembly language programming (2nd ed.):
  • Assembly language programming for the 68000 family:
  • Microcomputer architecture and programming: the 68000 family:
  • Programming the 68000:
  • The 68000 microprocessor: architecture, software, and interfacing techniques:
  • Bookmark and Share
      Featured Reviewer  
     
    Mc68000 Assembly Language (D.3.2 ... )
     
     
    Motorola 68000 (C.5.3 ... )
     
     
    Macro And Assembly Languages (D.3.2 ... )
     
     
    Mc68000 Assembly Language (D.3.2 ... )
     
     
    Motorola 68000 (C.5.3 ... )
     
     
    Procedures, Functions, And Subroutines (D.3.3 ... )
     
      more  
    Would you recommend this review?
    yes
    no
    Other reviews under "Mc68000 Assembly Language": Date
    The 68000 and 68020
    Triebel W., Singh A., Prentice-Hall, Inc., Upper Saddle River, NJ, 1991. Type: Book (9780138121327)
    Sep 1 1992
    The MC68000 microprocessor family
    Liu Y., Prentice-Hall, Inc., Upper Saddle River, NJ, 1991. Type: Book (9780135663998)
    May 1 1992
    Programming and designing with the 68000 family
    Mimar T., Prentice-Hall, Inc., Upper Saddle River, NJ, 1991. Type: Book (9780137314980)
    Apr 1 1992
    more...

    E-Mail This Printer-Friendly
    Send Your Comments
    Contact Us
    Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
    Terms of Use
    | Privacy Policy