From 3571f998b28fbc8d9250ba04c983935f10a16c15 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Sat, 20 Jan 2018 15:02:59 +0100 Subject: removed dat files --- projects/12/Sys.jack | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'projects/12/Sys.jack') 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", * 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; } } -- cgit v1.2.3