aboutsummaryrefslogtreecommitdiff
path: root/projects/12/KeyboardTest
diff options
context:
space:
mode:
Diffstat (limited to 'projects/12/KeyboardTest')
-rw-r--r--projects/12/KeyboardTest/Keyboard.jack97
-rw-r--r--projects/12/KeyboardTest/Keyboard.vm115
-rw-r--r--projects/12/KeyboardTest/KeyboardTestOutput.gifbin12048 -> 0 bytes
-rw-r--r--projects/12/KeyboardTest/Main.jack93
-rw-r--r--projects/12/KeyboardTest/Main.vm949
5 files changed, 0 insertions, 1254 deletions
diff --git a/projects/12/KeyboardTest/Keyboard.jack b/projects/12/KeyboardTest/Keyboard.jack
deleted file mode 100644
index a35704a..0000000
--- a/projects/12/KeyboardTest/Keyboard.jack
+++ /dev/null
@@ -1,97 +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/Keyboard.jack
-
-/**
- * A library for handling user input from the keyboard.
- */
-class Keyboard {
-
- /** Initializes the keyboard. */
- function void init() {
- return;
- }
-
- /**
- * Returns the character of the currently pressed key on the keyboard;
- * if no key is currently pressed, returns 0.
- *
- * Recognizes all ASCII characters, as well as the following keys:
- * new line = 128 = String.newline()
- * backspace = 129 = String.backspace()
- * left arrow = 130
- * up arrow = 131
- * right arrow = 132
- * down arrow = 133
- * home = 134
- * End = 135
- * page up = 136
- * page down = 137
- * insert = 138
- * delete = 139
- * ESC = 140
- * F1 - F12 = 141 - 152
- */
- function char keyPressed() {
- return Memory.peek(24576);
- }
-
- /**
- * Waits until a key is pressed on the keyboard and released,
- * then echoes the key to the screen, and returns the character
- * of the pressed key.
- */
- function char readChar() {
- var int key, key1;
- let key = 0;
- while (key = 0) {
- let key = Memory.peek(24576);
- }
- let key1 = key;
- while (key1 = key) {
- let key1 = Memory.peek(24576);
- }
- if ((key > 31) & (key < 127) | (key = 128) | (key = 129)) {
- do Output.printChar(key);
- }
- return key;
- }
-
- /**
- * Displays the message on the screen, reads from the keyboard the entered
- * text until a newline character is detected, echoes the text to the screen,
- * and returns its value. Also handles user backspaces.
- */
- function String readLine(String message) {
- var int c;
- var String s;
- let s = String.new(140);
- do Output.printString(message);
- let c = Keyboard.readChar();
- while (~(c = 128)) {
- if (c = 129) {
- if (s.length() > 0) {
- do s.eraseLastChar();
- }
- } else {
- do s.appendChar(c);
- }
- let c = Keyboard.readChar();
- }
- return s;
- }
-
- /**
- * Displays the message on the screen, reads from the keyboard the entered
- * text until a newline character is detected, echoes the text to the screen,
- * and returns its integer value (until the first non-digit character in the
- * entered text is detected). Also handles user backspaces.
- */
- function int readInt(String message) {
- var String s;
- do Output.printString(message);
- let s = Keyboard.readLine("");
- return s.intValue();
- }
-}
diff --git a/projects/12/KeyboardTest/Keyboard.vm b/projects/12/KeyboardTest/Keyboard.vm
deleted file mode 100644
index 5dc3426..0000000
--- a/projects/12/KeyboardTest/Keyboard.vm
+++ /dev/null
@@ -1,115 +0,0 @@
-function Keyboard.init 0
-push constant 0
-return
-function Keyboard.keyPressed 0
-push constant 24576
-call Memory.peek 1
-return
-function Keyboard.readChar 2
-push constant 0
-pop local 0
-label WHILE_EXP0
-push local 0
-push constant 0
-eq
-not
-if-goto WHILE_END0
-push constant 24576
-call Memory.peek 1
-pop local 0
-goto WHILE_EXP0
-label WHILE_END0
-push local 0
-pop local 1
-label WHILE_EXP1
-push local 1
-push local 0
-eq
-not
-if-goto WHILE_END1
-push constant 24576
-call Memory.peek 1
-pop local 1
-goto WHILE_EXP1
-label WHILE_END1
-push local 0
-push constant 31
-gt
-push local 0
-push constant 127
-lt
-and
-push local 0
-push constant 128
-eq
-or
-push local 0
-push constant 129
-eq
-or
-if-goto IF_TRUE0
-goto IF_FALSE0
-label IF_TRUE0
-push local 0
-call Output.printChar 1
-pop temp 0
-label IF_FALSE0
-push local 0
-return
-function Keyboard.readLine 2
-push constant 140
-call String.new 1
-pop local 1
-push argument 0
-call Output.printString 1
-pop temp 0
-call Keyboard.readChar 0
-pop local 0
-label WHILE_EXP0
-push local 0
-push constant 128
-eq
-not
-not
-if-goto WHILE_END0
-push local 0
-push constant 129
-eq
-if-goto IF_TRUE0
-goto IF_FALSE0
-label IF_TRUE0
-push local 1
-call String.length 1
-push constant 0
-gt
-if-goto IF_TRUE1
-goto IF_FALSE1
-label IF_TRUE1
-push local 1
-call String.eraseLastChar 1
-pop temp 0
-label IF_FALSE1
-goto IF_END0
-label IF_FALSE0
-push local 1
-push local 0
-call String.appendChar 2
-pop temp 0
-label IF_END0
-call Keyboard.readChar 0
-pop local 0
-goto WHILE_EXP0
-label WHILE_END0
-push local 1
-return
-function Keyboard.readInt 1
-push argument 0
-call Output.printString 1
-pop temp 0
-push constant 0
-call String.new 1
-call Keyboard.readLine 1
-pop local 0
-push local 0
-call String.intValue 1
-return
diff --git a/projects/12/KeyboardTest/KeyboardTestOutput.gif b/projects/12/KeyboardTest/KeyboardTestOutput.gif
deleted file mode 100644
index 944983a..0000000
--- a/projects/12/KeyboardTest/KeyboardTestOutput.gif
+++ /dev/null
Binary files differ
diff --git a/projects/12/KeyboardTest/Main.jack b/projects/12/KeyboardTest/Main.jack
deleted file mode 100644
index e89182c..0000000
--- a/projects/12/KeyboardTest/Main.jack
+++ /dev/null
@@ -1,93 +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/KeyboardTest/Main.jack
-
-/** Test program for the OS Keyboard class. */
-class Main {
-
- /** Gets input from the user and verifies its contents. */
- function void main() {
- var char c, key;
- var String s;
- var int i;
- var boolean ok;
-
- let ok = false;
- do Output.printString("keyPressed test:");
- do Output.println();
- while (~ok) {
- do Output.printString("Please press the 'Page Down' key");
- while (key = 0) {
- let key = Keyboard.keyPressed();
- }
- let c = key;
- while (~(key = 0)) {
- let key = Keyboard.keyPressed();
- }
-
- do Output.println();
-
- if (c = 137) {
- do Output.printString("ok");
- do Output.println();
- let ok = true;
- }
- }
-
- let ok = false;
- do Output.printString("readChar test:");
- do Output.println();
- do Output.printString("(Verify that the pressed character is echoed to the screen)");
- do Output.println();
- while (~ok) {
- do Output.printString("Please press the number '3': ");
- let c = Keyboard.readChar();
-
- do Output.println();
-
- if (c = 51) {
- do Output.printString("ok");
- do Output.println();
- let ok = true;
- }
- }
-
- let ok = false;
- do Output.printString("readLine test:");
- do Output.println();
- do Output.printString("(Verify echo and usage of 'backspace')");
- do Output.println();
- while (~ok) {
- let s = Keyboard.readLine("Please type 'JACK' and press enter: ");
-
- if (s.length() = 4) {
- if ((s.charAt(0) = 74) & (s.charAt(1) = 65) & (s.charAt(2) = 67) & (s.charAt(3) = 75)) {
- do Output.printString("ok");
- do Output.println();
- let ok = true;
- }
- }
- }
-
- let ok = false;
- do Output.printString("readInt test:");
- do Output.println();
- do Output.printString("(Verify echo and usage of 'backspace')");
- do Output.println();
- while (~ok) {
- let i = Keyboard.readInt("Please type '-32123' and press enter: ");
-
- if (i = (-32123)) {
- do Output.printString("ok");
- do Output.println();
- let ok = true;
- }
- }
-
- do Output.println();
- do Output.printString("Test completed successfully");
-
- return;
- }
-}
diff --git a/projects/12/KeyboardTest/Main.vm b/projects/12/KeyboardTest/Main.vm
deleted file mode 100644
index aec89d6..0000000
--- a/projects/12/KeyboardTest/Main.vm
+++ /dev/null
@@ -1,949 +0,0 @@
-function Main.main 5
-push constant 0
-pop local 4
-push constant 16
-call String.new 1
-push constant 107
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 121
-call String.appendChar 2
-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 101
-call String.appendChar 2
-push constant 100
-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
-label WHILE_EXP0
-push local 4
-not
-not
-if-goto WHILE_END0
-push constant 32
-call String.new 1
-push constant 80
-call String.appendChar 2
-push constant 108
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 115
-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 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 116
-call String.appendChar 2
-push constant 104
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 39
-call String.appendChar 2
-push constant 80
-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 68
-call String.appendChar 2
-push constant 111
-call String.appendChar 2
-push constant 119
-call String.appendChar 2
-push constant 110
-call String.appendChar 2
-push constant 39
-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
-call Output.printString 1
-pop temp 0
-label WHILE_EXP1
-push local 1
-push constant 0
-eq
-not
-if-goto WHILE_END1
-call Keyboard.keyPressed 0
-pop local 1
-goto WHILE_EXP1
-label WHILE_END1
-push local 1
-pop local 0
-label WHILE_EXP2
-push local 1
-push constant 0
-eq
-not
-not
-if-goto WHILE_END2
-call Keyboard.keyPressed 0
-pop local 1
-goto WHILE_EXP2
-label WHILE_END2
-call Output.println 0
-pop temp 0
-push local 0
-push constant 137
-eq
-if-goto IF_TRUE0
-goto IF_FALSE0
-label IF_TRUE0
-push constant 2
-call String.new 1
-push constant 111
-call String.appendChar 2
-push constant 107
-call String.appendChar 2
-call Output.printString 1
-pop temp 0
-call Output.println 0
-pop temp 0
-push constant 0
-not
-pop local 4
-label IF_FALSE0
-goto WHILE_EXP0
-label WHILE_END0
-push constant 0
-pop local 4
-push constant 14
-call String.new 1
-push constant 114
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 100
-call String.appendChar 2
-push constant 67
-call String.appendChar 2
-push constant 104
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 114
-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 59
-call String.new 1
-push constant 40
-call String.appendChar 2
-push constant 86
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 105
-call String.appendChar 2
-push constant 102
-call String.appendChar 2
-push constant 121
-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 116
-call String.appendChar 2
-push constant 104
-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 101
-call String.appendChar 2
-push constant 115
-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 32
-call String.appendChar 2
-push constant 99
-call String.appendChar 2
-push constant 104
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 99
-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 105
-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 99
-call String.appendChar 2
-push constant 104
-call String.appendChar 2
-push constant 111
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 100
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 116
-call String.appendChar 2
-push constant 111
-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 101
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 99
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 110
-call String.appendChar 2
-push constant 41
-call String.appendChar 2
-call Output.printString 1
-pop temp 0
-call Output.println 0
-pop temp 0
-label WHILE_EXP3
-push local 4
-not
-not
-if-goto WHILE_END3
-push constant 29
-call String.new 1
-push constant 80
-call String.appendChar 2
-push constant 108
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 115
-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 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 116
-call String.appendChar 2
-push constant 104
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 110
-call String.appendChar 2
-push constant 117
-call String.appendChar 2
-push constant 109
-call String.appendChar 2
-push constant 98
-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 39
-call String.appendChar 2
-push constant 51
-call String.appendChar 2
-push constant 39
-call String.appendChar 2
-push constant 58
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-call Output.printString 1
-pop temp 0
-call Keyboard.readChar 0
-pop local 0
-call Output.println 0
-pop temp 0
-push local 0
-push constant 51
-eq
-if-goto IF_TRUE1
-goto IF_FALSE1
-label IF_TRUE1
-push constant 2
-call String.new 1
-push constant 111
-call String.appendChar 2
-push constant 107
-call String.appendChar 2
-call Output.printString 1
-pop temp 0
-call Output.println 0
-pop temp 0
-push constant 0
-not
-pop local 4
-label IF_FALSE1
-goto WHILE_EXP3
-label WHILE_END3
-push constant 0
-pop local 4
-push constant 14
-call String.new 1
-push constant 114
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 100
-call String.appendChar 2
-push constant 76
-call String.appendChar 2
-push constant 105
-call String.appendChar 2
-push constant 110
-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 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 38
-call String.new 1
-push constant 40
-call String.appendChar 2
-push constant 86
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 105
-call String.appendChar 2
-push constant 102
-call String.appendChar 2
-push constant 121
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 99
-call String.appendChar 2
-push constant 104
-call String.appendChar 2
-push constant 111
-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 100
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 117
-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 111
-call String.appendChar 2
-push constant 102
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 39
-call String.appendChar 2
-push constant 98
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 99
-call String.appendChar 2
-push constant 107
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 112
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 99
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 39
-call String.appendChar 2
-push constant 41
-call String.appendChar 2
-call Output.printString 1
-pop temp 0
-call Output.println 0
-pop temp 0
-label WHILE_EXP4
-push local 4
-not
-not
-if-goto WHILE_END4
-push constant 36
-call String.new 1
-push constant 80
-call String.appendChar 2
-push constant 108
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 115
-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 121
-call String.appendChar 2
-push constant 112
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 39
-call String.appendChar 2
-push constant 74
-call String.appendChar 2
-push constant 65
-call String.appendChar 2
-push constant 67
-call String.appendChar 2
-push constant 75
-call String.appendChar 2
-push constant 39
-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 100
-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 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 101
-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 114
-call String.appendChar 2
-push constant 58
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-call Keyboard.readLine 1
-pop local 2
-push local 2
-call String.length 1
-push constant 4
-eq
-if-goto IF_TRUE2
-goto IF_FALSE2
-label IF_TRUE2
-push local 2
-push constant 0
-call String.charAt 2
-push constant 74
-eq
-push local 2
-push constant 1
-call String.charAt 2
-push constant 65
-eq
-and
-push local 2
-push constant 2
-call String.charAt 2
-push constant 67
-eq
-and
-push local 2
-push constant 3
-call String.charAt 2
-push constant 75
-eq
-and
-if-goto IF_TRUE3
-goto IF_FALSE3
-label IF_TRUE3
-push constant 2
-call String.new 1
-push constant 111
-call String.appendChar 2
-push constant 107
-call String.appendChar 2
-call Output.printString 1
-pop temp 0
-call Output.println 0
-pop temp 0
-push constant 0
-not
-pop local 4
-label IF_FALSE3
-label IF_FALSE2
-goto WHILE_EXP4
-label WHILE_END4
-push constant 0
-pop local 4
-push constant 13
-call String.new 1
-push constant 114
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 100
-call String.appendChar 2
-push constant 73
-call String.appendChar 2
-push constant 110
-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 38
-call String.new 1
-push constant 40
-call String.appendChar 2
-push constant 86
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 114
-call String.appendChar 2
-push constant 105
-call String.appendChar 2
-push constant 102
-call String.appendChar 2
-push constant 121
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 99
-call String.appendChar 2
-push constant 104
-call String.appendChar 2
-push constant 111
-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 100
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 117
-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 111
-call String.appendChar 2
-push constant 102
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 39
-call String.appendChar 2
-push constant 98
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 99
-call String.appendChar 2
-push constant 107
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 112
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 99
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 39
-call String.appendChar 2
-push constant 41
-call String.appendChar 2
-call Output.printString 1
-pop temp 0
-call Output.println 0
-pop temp 0
-label WHILE_EXP5
-push local 4
-not
-not
-if-goto WHILE_END5
-push constant 38
-call String.new 1
-push constant 80
-call String.appendChar 2
-push constant 108
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 97
-call String.appendChar 2
-push constant 115
-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 121
-call String.appendChar 2
-push constant 112
-call String.appendChar 2
-push constant 101
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-push constant 39
-call String.appendChar 2
-push constant 45
-call String.appendChar 2
-push constant 51
-call String.appendChar 2
-push constant 50
-call String.appendChar 2
-push constant 49
-call String.appendChar 2
-push constant 50
-call String.appendChar 2
-push constant 51
-call String.appendChar 2
-push constant 39
-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 100
-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 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 101
-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 114
-call String.appendChar 2
-push constant 58
-call String.appendChar 2
-push constant 32
-call String.appendChar 2
-call Keyboard.readInt 1
-pop local 3
-push local 3
-push constant 32123
-neg
-eq
-if-goto IF_TRUE4
-goto IF_FALSE4
-label IF_TRUE4
-push constant 2
-call String.new 1
-push constant 111
-call String.appendChar 2
-push constant 107
-call String.appendChar 2
-call Output.printString 1
-pop temp 0
-call Output.println 0
-pop temp 0
-push constant 0
-not
-pop local 4
-label IF_FALSE4
-goto WHILE_EXP5
-label WHILE_END5
-call Output.println 0
-pop temp 0
-push constant 27
-call String.new 1
-push constant 84
-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 32
-call String.appendChar 2
-push constant 99
-call String.appendChar 2
-push constant 111
-call String.appendChar 2
-push constant 109
-call String.appendChar 2
-push constant 112
-call String.appendChar 2
-push constant 108
-call String.appendChar 2
-push constant 101
-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 32
-call String.appendChar 2
-push constant 115
-call String.appendChar 2
-push constant 117
-call String.appendChar 2
-push constant 99
-call String.appendChar 2
-push constant 99
-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 102
-call String.appendChar 2
-push constant 117
-call String.appendChar 2
-push constant 108
-call String.appendChar 2
-push constant 108
-call String.appendChar 2
-push constant 121
-call String.appendChar 2
-call Output.printString 1
-pop temp 0
-push constant 0
-return