CIS Logo SVC Logo

   Computing & Information Systems


Schoology Facebook        Search CIS Site      Tutorials

Mac1 Notes

The following outline is intended to assist CS 330 students in learning machine language programming in Mac1 using Br. David's Mic1 simulator.
  1. Begin by considering the parts of the machine that are visible to the Mac1 programmer. These parts are the ALU, main memory, AC, PC, and SP. The other registers are only accessible at the microprogramming level. The ALU appears to the Mac1 programmer as if it is capable of adding and subtracting (though actually the subtraction is carried out in microcode).
  2. Note one significant limitation of the simulated machine: it cannot do input/output. Tannenbaum's original machine had memory-mapped I/O. That is, it could do input and output by reading and writing certain memory locations that behaved like I/O registers.
  3. Look at the drawing of the simulated machine . Some items seen here, such as the IR register, are not directly available to the Mac1 programmer. Note that the Mac1 program is loaded starting at location 0 in main memory and that the stack grows backward from location 68. Locations 40 and following are commonly used to hold data temporarily.
  4. Examine mic1doc.txt as this file has a lot of useful information. Skip over the details of Mic1 microprogramming for now and concentrate on the Mac1 machine language level. In particular, read through the Mac1 instruction set shown in a table toward the end of this file or look at the Mac1 Instruction Set on the web. The machine has instructions for arithmetic, load/store the accumulator, jumps, stack operations, call/return function-handling instructions, etc.
  5. In the above file, mic1doc.txt, read the section on how to code and run a Mac1 program. Run the simulator, open the mic015.txt file, and run it one Mac1 instruction at a time. (Just click on the button for 1 Mac1 instruction.) Compare the assembler version of the Mac1 code with the numbers shown in red as the simulator runs. Verify that the simulator is correctly carrying out the code. Note the large 80-line microprogram in the mic015.txt file. Use this with every Mac1 program that you write. The actual Mac1 code is at the end of this file: 6 lines of 16 bits each. The assembler version of this at the very bottom is just for us to read; the simulator ignores this as comment lines.
  6. Next look at mic003.txt and run it on the simulator. Note how it implements a loop to compute n * m using a series of additions. Use one of the handouts showing the data and stack areas of main memory to trace the execution of this program.
  7. Read Functions, Parameters, and Stack Frames in Mac-1 Machine Language
  8. Read through mic004.txt and the Word document Notes on mic004.txt. Then run this program on the simulator. Watch how it handles the function call and return. Trace the execution by comparing it to the drawing of the run-time stack.

Instructor: Br. David Carlson

Maintained by: Br. David Carlson
Last updated: April 03, 2014