Skip to content
Browse files

adding project 4

  • Loading branch information...
1 parent 9869187 commit 2f99c0159e104939dee91564fc0043388f2c40f5 @cmoylan committed May 20, 2012
Showing with 94 additions and 0 deletions.
  1. +11 −0 project04/fill/Fill.asm
  2. +11 −0 project04/fill/Fill.tst
  3. +9 −0 project04/mult/Mult.asm
  4. +7 −0 project04/mult/Mult.cmp
  5. +56 −0 project04/mult/Mult.tst
View
11 project04/fill/Fill.asm
@@ -0,0 +1,11 @@
+// This file is part of the materials accompanying the book
+// "The Elements of Computing Systems" by Nisan and Schocken,
+// MIT Press. Book site: www.idc.ac.il/tecs
+// File name: projects/04/Fill.asm
+
+// 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.
+
+// Put your code here.
View
11 project04/fill/Fill.tst
@@ -0,0 +1,11 @@
+// This file is part of the materials accompanying the book
+// "The Elements of Computing Systems" by Nisan and Schocken,
+// MIT Press. Book site: www.idc.ac.il/tecs
+// File name: projects/04/fill/Fill.tst
+
+load Fill.hack;
+echo "First, make sure that 'No Animation' is selected. Then, select the Keyboard, click on any key and check the screen.";
+
+repeat {
+ ticktock;
+}
View
9 project04/mult/Mult.asm
@@ -0,0 +1,9 @@
+// This file is part of the materials accompanying the book
+// "The Elements of Computing Systems" by Nisan and Schocken,
+// MIT Press. Book site: www.idc.ac.il/tecs
+// File name: projects/04/Mult.asm
+
+// Multiplies R0 and R1 and stores the result in R2.
+// (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[3], respectively.)
+
+// Put your code here.
View
7 project04/mult/Mult.cmp
@@ -0,0 +1,7 @@
+| RAM[2] |
+| 0 |
+| 0 |
+| 0 |
+| 3 |
+| 8 |
+| 42 |
View
56 project04/mult/Mult.tst
@@ -0,0 +1,56 @@
+// This file is part of the materials accompanying the book
+// "The Elements of Computing Systems" by Nisan and Schocken,
+// MIT Press. Book site: www.idc.ac.il/tecs
+// File name: projects/04/mult/Mult.tst
+
+load Mult.hack,
+output-file Mult.out,
+compare-to Mult.cmp,
+output-list RAM[2]%D2.6.2;
+
+set RAM[0] 0,
+set RAM[1] 0;
+repeat 20 {
+ ticktock;
+}
+output;
+
+set PC 0,
+set RAM[0] 1,
+set RAM[1] 0;
+repeat 50 {
+ ticktock;
+}
+output;
+
+set PC 0,
+set RAM[0] 0,
+set RAM[1] 2;
+repeat 80 {
+ ticktock;
+}
+output;
+
+set PC 0,
+set RAM[0] 3,
+set RAM[1] 1;
+repeat 120 {
+ ticktock;
+}
+output;
+
+set PC 0,
+set RAM[0] 2,
+set RAM[1] 4;
+repeat 150 {
+ ticktock;
+}
+output;
+
+set PC 0,
+set RAM[0] 6,
+set RAM[1] 7;
+repeat 210 {
+ ticktock;
+}
+output;

0 comments on commit 2f99c01

Please sign in to comment.
Something went wrong with that request. Please try again.