Macintosh assembly language

The purpose of this talk is to present a progress report on the conversion of the teaching of assembly language at Ohio State from the IBM System/370 mainframe to the Apple Macintosh microcomputer. An earlier report on this subject appears in the proceedings of the 1987 Computer Science Conference. Pilot sections on Macintosh assembly language were first taught in Winter and Spring Quarters, 1987; all sections of the assembly language course at Ohio State were converted to the Macintosh as of Summer Quarter, 1987. The total number of students enrolled in this course is approximately 300 per year. The machine actually used for the assembly language course is the Macintosh Plus. To write an assembly language program, the student checks out a System disk containing a RamDisk program and the necessary programs from MDS, the Macintosh 68000 Development System, and from BCS, the Boston College Shell. The student develops his program in memory, saves it on his User disk, then assembles, links, and executes it; iterating the process until he is satisfied with the result. Ohio State is now in the process of converting from System disks to TOPS, a system in which the MDS and BCS programs are contained on a file server; TOPS is expected to be operational sometime this year. Ultimately, the student will also be able to dispense with the User disk and save his program on the file server. The laboratory assignments in the Macintosh assembly language course are designed to bring out the essential features of assembly language in a coordinated fashion. This is done as follows: Laboratory Report 1: Input, compute, and output the sum, difference, and product of two sixteen-bit signed integers using the BCS input and output macros for decimal integers. Laboratory Report 2: Input, compute, and output the sum, difference, product, quotient and remainder of two sixteen-bit signed integers with checks for overflow. Laboratory Report 3: This is similar to Laboratory Report 2 except that unsigned sixteen-bit arithmetic is used and output is implemented by looping through a two-dimensional array. Laboratory Report 4: This is similar to Laboratory Report 2 except that input requires conversion of decimal ASCII strings to sixteen-bit signed binary integers, and output requires conversion from sixteen-bit signed binary integers to decimal ASCII strings. Laboratory Report 5: This is similar to Laboratory Report 4 except that input, computation, and output are all achieved by means of subroutine calls; and hexadecimal as well as decimal output of the results is required. Laboratory Report 6: In his final laboratory report, the student draws rectangles, lines, and patterns on the Macintosh screen using the QuickDraw routines in the Macintosh toolbox. A textbook on Macintosh assembly language is in the process of development for use with this course. A preliminary draft of this book currently covers the following subjects: Chapter One contains a discussion of binary arithmetic and the basic architecture of the MC68000 CPU chip used in the Macintosh. Chapter Two contains a discussion of how to edit, assemble, link, and execute a program to be run on the Macintosh under MDS and BCS. Chapter Three contains a detailed discussion of signed binary integer arithmetic and the basic Move, Add, Sub (Subtract), Muls (Multiply Signed), and Divs (Divide Signed) operations. This chapter also contains a detailed discussion of the N (Negative), Z (Zero), and V (Overflow) flags and their use in signed conditional branching operations. Chapter Four contains a brief discussion of how MDS actually translates assembly language code to machine language, together with a few simple examples of the translation process. Chapter Five contains a description of the most important of the twelve addressing modes available on the MC68000 and how they are used in MDS. Chapter Six contains a discussion of unsigned binary integer arithmetic and the basic Move, Add, Sub (Subtract), Mulu (Multiply Unsigned), and Divu (Divide Unsigned) operations. This chapter also contains a detailed discussion of the Z (Zero) and C (Carry-Borrow) flags and their use in unsigned conditional branching operations. Chapter Seven introduces looping and address modification. Chapter Eight contains a discussion of what the actual machine language implementation of assembly language code looks like. Chapter Nine follows a series of complete examples from their assembly language forms through the detailed assembly and linking process to their final machine language forms. Additional chapters, when written, will contain discussions of macros, file handling, and subroutine linkage as prescribed in the definition of CS3 in Curriculum 78. An important feature of the chapter on subroutine linkage is that the linkage procedures used will be exactly the same as those used in linking to stack-based routines in the Macintosh toolbox, thus greatly simplifying the teaching of the use of the toolbox routines. Additional results of this conversion effort will be reported at the 1989 Computer Science Conference.