Bradley Kjell, Central Connecticut State University

Slightly Improved Edition, August 2007

This is a course in assembly language programming of the MIPS processor. It emphasizes the topics needed for study of computer architecture: bits, bit patterns, operations on bit patterns, and how bit patterns represent instructions and data. This course is equivalent to a semester-long junior college or university course (except, perhaps, for the emphasis on bit patterns).

The emphasis of the course is on understanding how computers work. This will provide a basis for further study of computer architecture and computer software. The MIPS processor, the subject of this course, has a well designed architecture and is particularly fruitful to study. However, the goal of the course is not to turn you into a MIPS programmer, but to give you an understanding of all computer systems.

The only equipment you need for this course is a PC. The only software you need is the SPIM simulator of the MIPS32 processor and a text editor. The simulator is available by free download (see appendix A). Example programs are presented using an MS Windows operating system. However, you can use any platform that runs SPIM. (There are many).

Assembly Language is normally taken the semester after a course in a high level programming language (such as Java or C). This course assumes that you have this background although no specific programming language is required.

Read the pages of this course actively. Think about and answer the question at the bottom of each page. (This style of tutorial is called programmed learning. It is very effective for technical material). Most questions call for just a little thought. Some call for pencil and paper. Keep a pencil and a scrap of paper next to your keyboard. Each chapter is about 15 pages long. Spend several minutes per page. You can read each chapter in about 30 minutes. However, for maximum benefit, you should run some of the example programs, write some programs of your own, and then think about your results. This may take several hours.

Works best with IE 6.0 or higher, at 1024 x 768 resolution or better

Part 1: Prelude to Assembly Language

Assembly language: what it is, why it is studied, and where it is used.

Part 2: Data Representation

Data: characters and integers. The binary addition algorithm.

Part 3: Running SPIM; Bitwise Logic

Running SPIM. MIPS programming. Bitwise logic operations.

Part 4: Integer Arithmetic and Memory Access

Integer arithmetic. Moving data to and from memory.

Part 5: Branches, Decisions, and Loops

Program flow: branch, jump, and set instructions; loops, and decisions.

Part 6: Extended Assembly Language

The assembler extends bare machine language. Registers have mnemonic names. Pseudoinstructions extend the bare hardware.

Part 7: The Stack and Subroutine Linkage

Programs are divided into sections called subroutines. At run time, the stack is used to save and to restore a subroutine's values.

Part 8: Floating Point Data

Bit patterns are used to represent floating point numbers. More machine instructions are used to do floating point arithmetic.

Part 9: Data Structures in Assembly Language

Appendices

Index


Older version of the tutorial in zip format. file  2.4 MB


Click here Main Tutorial Menu