Workshop In Computer Construction - From Nand to Tetris
Project 4 - Machine Language
Deadline March 14th, 2003 at Ross closing time
Description In this project you should write two small assembly programs. The files has a .asm suffix. Those programs are:
  • Mult.asm - The program's inputs are R0 and R1. The program computes the product R0*R1 and stores the result in R2. The algorithm can be iterative addition.
    Recall that the Hack platform maps R0, R1, and R2 on RAM addresses 0x0000, 0x0001, and 0x0002, respectively. The contract (in this program) is such that R0>=0, R1>=0, and R0 * R1<32768 . Your program need not test these conditions, but rather assume that they hold.
    To test the Mult.hack on the CPU Emulator, you may use the test scripts Mult.tst and Mult.cmp. As usual, all these files should be in the same directory on your computer.
  • Fill.asm - The program runs an infinite loop that "listens" to the keyboard input. When a key is pressed (any key), the program blackens the screen, i.e. writes "black" in every pixel. When no key is pressed, the screen should be cleared.
    To test fill.hack on the CPU Emulator, you may use the Fill.tst script. This script loads Fill.hack into the simulator and tells the user how to test the program interactively.
Submission Submit a tar file contains all your *.asm, and a README file in the root.
Resources