summaryrefslogtreecommitdiff
path: root/projects/12/Sys.jack
diff options
context:
space:
mode:
authorYuchen Pei <me@ypei.me>2018-01-20 15:02:59 +0100
committerYuchen Pei <me@ypei.me>2018-01-20 15:02:59 +0100
commit3571f998b28fbc8d9250ba04c983935f10a16c15 (patch)
treeae96d428136613c0928f0606ccacf21d093cb8ec /projects/12/Sys.jack
parent3d08a3b370316d14ab6d08209566464853005474 (diff)
removed dat files
Diffstat (limited to 'projects/12/Sys.jack')
-rw-r--r--projects/12/Sys.jack19
1 files changed, 12 insertions, 7 deletions
diff --git a/projects/12/Sys.jack b/projects/12/Sys.jack
index d6b99f6..53c078c 100644
--- a/projects/12/Sys.jack
+++ b/projects/12/Sys.jack
@@ -10,14 +10,14 @@ class Sys {
/** Performs all the initializations required by the OS. */
function void init() {
- do Array.init();
do Keyboard.init();
do Math.init();
do Memory.init();
do Output.init();
do Screen.init();
- do String.init();
do Main.main();
+ do Sys.halt();
+ return;
}
/** Halts the program execution. */
@@ -29,18 +29,23 @@ class Sys {
/** Waits approximately duration milliseconds and returns. */
function void wait(int duration) {
- Output.printString("waiting")
+ var int i, j;
let i = 0;
- while (i < 50000){
+ while (i < duration){
let i = i + 1;
+ let j = 0;
+ while (j < 318){
+ let j = j + 1;
+ }
}
- Output.printString("done")
+ return;
}
/** Displays the given error code in the form "ERR<errorCode>",
* and halts the program's execution. */
function void error(int errorCode) {
- Output.printString("ERR");
- Output.printInt(errorCode);
+ do Output.printString("ERR");
+ do Output.printInt(errorCode);
+ return;
}
}