aboutsummaryrefslogtreecommitdiff
path: root/projects/12/SysTest
diff options
context:
space:
mode:
authorYuchen Pei <me@ypei.me>2018-01-20 15:41:49 +0100
committerYuchen Pei <me@ypei.me>2018-01-20 15:41:49 +0100
commitd3a0cc3a8ba6dfeb64d3faeffdeb6845b60e5840 (patch)
treed58df9ec2480e2a9ec6240f9c797f83d1a0b1056 /projects/12/SysTest
parent3571f998b28fbc8d9250ba04c983935f10a16c15 (diff)
rearranged the dir for github
- removed tools and pdfs - rearranged the projects dirs - added md files - other minor changes
Diffstat (limited to 'projects/12/SysTest')
-rw-r--r--projects/12/SysTest/Main.jack31
-rw-r--r--projects/12/SysTest/Main.vm281
-rw-r--r--projects/12/SysTest/Sys.jack51
-rw-r--r--projects/12/SysTest/Sys.vm74
4 files changed, 0 insertions, 437 deletions
diff --git a/projects/12/SysTest/Main.jack b/projects/12/SysTest/Main.jack
deleted file mode 100644
index a153b25..0000000
--- a/projects/12/SysTest/Main.jack
+++ /dev/null
@@ -1,31 +0,0 @@
-// This file is part of www.nand2tetris.org
-// and the book "The Elements of Computing Systems"
-// by Nisan and Schocken, MIT Press.
-// File name: projects/12/SysTest/Main.jack
-
-/** Test program for the OS Sys class. */
-class Main {
-
- /** Tests the wait method of the Sys class. */
- function void main() {
- var char key;
-
- do Output.printString("Wait test:");
- do Output.println();
- do Output.printString("Press any key. After 2 seconds, another message will be printed:");
-
- while (key = 0) {
- let key = Keyboard.keyPressed();
- }
- while (~(key = 0)) {
- let key = Keyboard.keyPressed();
- }
-
- do Sys.wait(2000);
-
- do Output.println();
- do Output.printString("Time is up. Make sure that 2 seconds elapsed.");
-
- return;
- }
-}
diff --git a/projects/12/SysTest/Main.vm b/projects/12/SysTest/Main.vm
deleted file mode 100644
index 4890e2f..0000000
--- a/projects/12/SysTest/Main.vm
+++ /dev/null
@@ -1,281 +0,0 @@
-function Main.main 1
-push constant 10
-call String.new 1
-push constant 87
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 105
-call String.appendChar 2
-push constant 116
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 116
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 116
-call String.appendChar 2
-push constant 58
-call String.appendChar 2
-call Output.printString 1
-pop temp 0
-call Output.println 0
-pop temp 0
-push constant 64
-call String.new 1
-push constant 80
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 110
-call String.appendChar 2
-push constant 121
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 107
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 121
-call String.appendChar 2
-push constant 46
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 65
-call String.appendChar 2
-push constant 102
-call String.appendChar 2
-push constant 116
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 50
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 99
-call String.appendChar 2
-push constant 111
-call String.appendChar 2
-push constant 110
-call String.appendChar 2
-push constant 100
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 44
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 110
-call String.appendChar 2
-push constant 111
-call String.appendChar 2
-push constant 116
-call String.appendChar 2
-push constant 104
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 109
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 103
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 119
-call String.appendChar 2
-push constant 105
-call String.appendChar 2
-push constant 108
-call String.appendChar 2
-push constant 108
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 98
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 112
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 105
-call String.appendChar 2
-push constant 110
-call String.appendChar 2
-push constant 116
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 100
-call String.appendChar 2
-push constant 58
-call String.appendChar 2
-call Output.printString 1
-pop temp 0
-label WHILE_EXP0
-push local 0
-push constant 0
-eq
-not
-if-goto WHILE_END0
-call Keyboard.keyPressed 0
-pop local 0
-goto WHILE_EXP0
-label WHILE_END0
-label WHILE_EXP1
-push local 0
-push constant 0
-eq
-not
-not
-if-goto WHILE_END1
-call Keyboard.keyPressed 0
-pop local 0
-goto WHILE_EXP1
-label WHILE_END1
-push constant 2000
-call Sys.wait 1
-pop temp 0
-call Output.println 0
-pop temp 0
-push constant 45
-call String.new 1
-push constant 84
-call String.appendChar 2
-push constant 105
-call String.appendChar 2
-push constant 109
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 105
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 117
-call String.appendChar 2
-push constant 112
-call String.appendChar 2
-push constant 46
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 77
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 107
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 117
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 116
-call String.appendChar 2
-push constant 104
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 116
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 50
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 99
-call String.appendChar 2
-push constant 111
-call String.appendChar 2
-push constant 110
-call String.appendChar 2
-push constant 100
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 108
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 112
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 100
-call String.appendChar 2
-push constant 46
-call String.appendChar 2
-call Output.printString 1
-pop temp 0
-push constant 0
-return
diff --git a/projects/12/SysTest/Sys.jack b/projects/12/SysTest/Sys.jack
deleted file mode 100644
index 53c078c..0000000
--- a/projects/12/SysTest/Sys.jack
+++ /dev/null
@@ -1,51 +0,0 @@
-// This file is part of www.nand2tetris.org
-// and the book "The Elements of Computing Systems"
-// by Nisan and Schocken, MIT Press.
-// File name: projects/12/Sys.jack
-
-/**
- * A library that supports various program execution services.
- */
-class Sys {
-
- /** Performs all the initializations required by the OS. */
- function void init() {
- do Keyboard.init();
- do Math.init();
- do Memory.init();
- do Output.init();
- do Screen.init();
- do Main.main();
- do Sys.halt();
- return;
- }
-
- /** Halts the program execution. */
- function void halt() {
- while (true){
- }
- return;
- }
-
- /** Waits approximately duration milliseconds and returns. */
- function void wait(int duration) {
- var int i, j;
- let i = 0;
- while (i < duration){
- let i = i + 1;
- let j = 0;
- while (j < 318){
- let j = j + 1;
- }
- }
- return;
- }
-
- /** Displays the given error code in the form "ERR<errorCode>",
- * and halts the program's execution. */
- function void error(int errorCode) {
- do Output.printString("ERR");
- do Output.printInt(errorCode);
- return;
- }
-}
diff --git a/projects/12/SysTest/Sys.vm b/projects/12/SysTest/Sys.vm
deleted file mode 100644
index fec2862..0000000
--- a/projects/12/SysTest/Sys.vm
+++ /dev/null
@@ -1,74 +0,0 @@
-function Sys.init 0
-call Keyboard.init 0
-pop temp 0
-call Math.init 0
-pop temp 0
-call Memory.init 0
-pop temp 0
-call Output.init 0
-pop temp 0
-call Screen.init 0
-pop temp 0
-call Main.main 0
-pop temp 0
-call Sys.halt 0
-pop temp 0
-push constant 0
-return
-function Sys.halt 0
-label WHILE_EXP0
-push constant 0
-not
-not
-if-goto WHILE_END0
-goto WHILE_EXP0
-label WHILE_END0
-push constant 0
-return
-function Sys.wait 2
-push constant 0
-pop local 0
-label WHILE_EXP0
-push local 0
-push argument 0
-lt
-not
-if-goto WHILE_END0
-push local 0
-push constant 1
-add
-pop local 0
-push constant 0
-pop local 1
-label WHILE_EXP1
-push local 1
-push constant 318
-lt
-not
-if-goto WHILE_END1
-push local 1
-push constant 1
-add
-pop local 1
-goto WHILE_EXP1
-label WHILE_END1
-goto WHILE_EXP0
-label WHILE_END0
-push constant 0
-return
-function Sys.error 0
-push constant 3
-call String.new 1
-push constant 69
-call String.appendChar 2
-push constant 82
-call String.appendChar 2
-push constant 82
-call String.appendChar 2
-call Output.printString 1
-pop temp 0
-push argument 0
-call Output.printInt 1
-pop temp 0
-push constant 0
-return