From d3a0cc3a8ba6dfeb64d3faeffdeb6845b60e5840 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Sat, 20 Jan 2018 15:41:49 +0100 Subject: rearranged the dir for github - removed tools and pdfs - rearranged the projects dirs - added md files - other minor changes --- projects/12/StringTest/Main.jack | 83 --- projects/12/StringTest/Main.vm | 469 -------------- projects/12/StringTest/String.jack | 176 ------ projects/12/StringTest/String.vm | 917 ---------------------------- projects/12/StringTest/StringTestOutput.gif | Bin 8126 -> 0 bytes 5 files changed, 1645 deletions(-) delete mode 100644 projects/12/StringTest/Main.jack delete mode 100644 projects/12/StringTest/Main.vm delete mode 100644 projects/12/StringTest/String.jack delete mode 100644 projects/12/StringTest/String.vm delete mode 100644 projects/12/StringTest/StringTestOutput.gif (limited to 'projects/12/StringTest') diff --git a/projects/12/StringTest/Main.jack b/projects/12/StringTest/Main.jack deleted file mode 100644 index 2848548..0000000 --- a/projects/12/StringTest/Main.jack +++ /dev/null @@ -1,83 +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/StringTest/Main.jack - -/** Test program for the OS String class. */ -class Main { - - /** Performs various string manipulations and displays their results. */ - function void main() { - var String s; - var String i; - - let s = String.new(0); // a zero-capacity string should be supported - do s.dispose(); - - let s = String.new(6); // capacity 6, make sure that length 5 is displayed - let s = s.appendChar(97); - let s = s.appendChar(98); - let s = s.appendChar(99); - let s = s.appendChar(100); - let s = s.appendChar(101); - do Output.printString("new,appendChar: "); - do Output.printString(s); // new, appendChar: abcde - do Output.println(); - - let i = String.new(6); - do i.setInt(12345); - do Output.printString("setInt: "); - do Output.printString(i); // setInt: 12345 - do Output.println(); - - do i.setInt(-32767); - do Output.printString("setInt: "); - do Output.printString(i); // setInt: -32767 - do Output.println(); - - do Output.printString("length: "); - do Output.printInt(s.length()); // length: 5 - do Output.println(); - - do Output.printString("charAt[2]: "); - do Output.printInt(s.charAt(2)); // charAt[2]: 99 - do Output.println(); - - do s.setCharAt(2, 45); - do Output.printString("setCharAt(2,'-'): "); - do Output.printString(s); // setCharAt(2,'-'): ab-de - do Output.println(); - - do s.eraseLastChar(); - do Output.printString("eraseLastChar: "); - do Output.printString(s); // eraseLastChar: ab-d - do Output.println(); - - let s = "456"; - do Output.printString("intValue: "); - do Output.printInt(s.intValue()); // intValue: 456 - do Output.println(); - - let s = "-32123"; - do Output.printString("intValue: "); - do Output.printInt(s.intValue()); // intValue: -32123 - do Output.println(); - - do Output.printString("backSpace: "); - do Output.printInt(String.backSpace()); // backSpace: 129 - do Output.println(); - - do Output.printString("doubleQuote: "); - do Output.printInt(String.doubleQuote());// doubleQuote: 34 - do Output.println(); - - do Output.printString("newLine: "); - do Output.printInt(String.newLine()); // newLine: 128 - do Output.println(); - - do i.dispose(); - do s.dispose(); - - return; - } -} diff --git a/projects/12/StringTest/Main.vm b/projects/12/StringTest/Main.vm deleted file mode 100644 index 2c9fb9f..0000000 --- a/projects/12/StringTest/Main.vm +++ /dev/null @@ -1,469 +0,0 @@ -function Main.main 2 -push constant 0 -call String.new 1 -pop local 0 -push local 0 -call String.dispose 1 -pop temp 0 -push constant 6 -call String.new 1 -pop local 0 -push local 0 -push constant 97 -call String.appendChar 2 -pop local 0 -push local 0 -push constant 98 -call String.appendChar 2 -pop local 0 -push local 0 -push constant 99 -call String.appendChar 2 -pop local 0 -push local 0 -push constant 100 -call String.appendChar 2 -pop local 0 -push local 0 -push constant 101 -call String.appendChar 2 -pop local 0 -push constant 16 -call String.new 1 -push constant 110 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 119 -call String.appendChar 2 -push constant 44 -call String.appendChar 2 -push constant 97 -call String.appendChar 2 -push constant 112 -call String.appendChar 2 -push constant 112 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 110 -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 58 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -call Output.printString 1 -pop temp 0 -push local 0 -call Output.printString 1 -pop temp 0 -call Output.println 0 -pop temp 0 -push constant 6 -call String.new 1 -pop local 1 -push local 1 -push constant 12345 -call String.setInt 2 -pop temp 0 -push constant 8 -call String.new 1 -push constant 115 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 116 -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 58 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -call Output.printString 1 -pop temp 0 -push local 1 -call Output.printString 1 -pop temp 0 -call Output.println 0 -pop temp 0 -push local 1 -push constant 32767 -neg -call String.setInt 2 -pop temp 0 -push constant 8 -call String.new 1 -push constant 115 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 116 -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 58 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -call Output.printString 1 -pop temp 0 -push local 1 -call Output.printString 1 -pop temp 0 -call Output.println 0 -pop temp 0 -push constant 8 -call String.new 1 -push constant 108 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 110 -call String.appendChar 2 -push constant 103 -call String.appendChar 2 -push constant 116 -call String.appendChar 2 -push constant 104 -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 -push local 0 -call String.length 1 -call Output.printInt 1 -pop temp 0 -call Output.println 0 -pop temp 0 -push constant 11 -call String.new 1 -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 65 -call String.appendChar 2 -push constant 116 -call String.appendChar 2 -push constant 91 -call String.appendChar 2 -push constant 50 -call String.appendChar 2 -push constant 93 -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 -push local 0 -push constant 2 -call String.charAt 2 -call Output.printInt 1 -pop temp 0 -call Output.println 0 -pop temp 0 -push local 0 -push constant 2 -push constant 45 -call String.setCharAt 3 -pop temp 0 -push constant 18 -call String.new 1 -push constant 115 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 116 -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 65 -call String.appendChar 2 -push constant 116 -call String.appendChar 2 -push constant 40 -call String.appendChar 2 -push constant 50 -call String.appendChar 2 -push constant 44 -call String.appendChar 2 -push constant 39 -call String.appendChar 2 -push constant 45 -call String.appendChar 2 -push constant 39 -call String.appendChar 2 -push constant 41 -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 -push local 0 -call Output.printString 1 -pop temp 0 -call Output.println 0 -pop temp 0 -push local 0 -call String.eraseLastChar 1 -pop temp 0 -push constant 15 -call String.new 1 -push constant 101 -call String.appendChar 2 -push constant 114 -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 76 -call String.appendChar 2 -push constant 97 -call String.appendChar 2 -push constant 115 -call String.appendChar 2 -push constant 116 -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 58 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -call Output.printString 1 -pop temp 0 -push local 0 -call Output.printString 1 -pop temp 0 -call Output.println 0 -pop temp 0 -push constant 3 -call String.new 1 -push constant 52 -call String.appendChar 2 -push constant 53 -call String.appendChar 2 -push constant 54 -call String.appendChar 2 -pop local 0 -push constant 10 -call String.new 1 -push constant 105 -call String.appendChar 2 -push constant 110 -call String.appendChar 2 -push constant 116 -call String.appendChar 2 -push constant 86 -call String.appendChar 2 -push constant 97 -call String.appendChar 2 -push constant 108 -call String.appendChar 2 -push constant 117 -call String.appendChar 2 -push constant 101 -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 -push local 0 -call String.intValue 1 -call Output.printInt 1 -pop temp 0 -call Output.println 0 -pop temp 0 -push constant 6 -call String.new 1 -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 -pop local 0 -push constant 10 -call String.new 1 -push constant 105 -call String.appendChar 2 -push constant 110 -call String.appendChar 2 -push constant 116 -call String.appendChar 2 -push constant 86 -call String.appendChar 2 -push constant 97 -call String.appendChar 2 -push constant 108 -call String.appendChar 2 -push constant 117 -call String.appendChar 2 -push constant 101 -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 -push local 0 -call String.intValue 1 -call Output.printInt 1 -pop temp 0 -call Output.println 0 -pop temp 0 -push constant 11 -call String.new 1 -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 83 -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 58 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -call Output.printString 1 -pop temp 0 -call String.backSpace 0 -call Output.printInt 1 -pop temp 0 -call Output.println 0 -pop temp 0 -push constant 13 -call String.new 1 -push constant 100 -call String.appendChar 2 -push constant 111 -call String.appendChar 2 -push constant 117 -call String.appendChar 2 -push constant 98 -call String.appendChar 2 -push constant 108 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 81 -call String.appendChar 2 -push constant 117 -call String.appendChar 2 -push constant 111 -call String.appendChar 2 -push constant 116 -call String.appendChar 2 -push constant 101 -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 String.doubleQuote 0 -call Output.printInt 1 -pop temp 0 -call Output.println 0 -pop temp 0 -push constant 9 -call String.new 1 -push constant 110 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 119 -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 58 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -call Output.printString 1 -pop temp 0 -call String.newLine 0 -call Output.printInt 1 -pop temp 0 -call Output.println 0 -pop temp 0 -push local 1 -call String.dispose 1 -pop temp 0 -push local 0 -call String.dispose 1 -pop temp 0 -push constant 0 -return diff --git a/projects/12/StringTest/String.jack b/projects/12/StringTest/String.jack deleted file mode 100644 index 3ef40b2..0000000 --- a/projects/12/StringTest/String.jack +++ /dev/null @@ -1,176 +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/String.jack - -/** - * Represents character strings. In addition for constructing and disposing - * strings, the class features methods for getting and setting individual - * characters of the string, for erasing the string's last character, - * for appending a character to the string's end, and more typical - * string-oriented operations. - */ -class String { - field int maxLen; - field int len; - field Array s; - - /** constructs a new empty string with a maximum length of maxLength - * and initial length of 0. */ - constructor String new(int maxLength) { - if (maxLength > 0) { - let s = Array.new(maxLength); - } - let maxLen = maxLength; - let len = 0; - return this; - } - - /** Disposes this string. */ - method void dispose() { - if (maxLen > 0) { - do s.dispose(); - } - do Memory.deAlloc(this); - return; - } - - /** Returns the current length of this string. */ - method int length() { - return len; - } - - /** Returns the character at the j-th location of this string. */ - method char charAt(int j) { - if ((j < 0) | (j + 1 > len)){ - do Output.printString("String.charAt: index out of range!"); - do Sys.error(5); - } - return s[j]; - } - - /** Sets the character at the j-th location of this string to c. */ - method void setCharAt(int j, char c) { - if ((j < 0) | (j + 1 > len)){ - do Output.printString("String.setCharAt: index out of range!"); - do Sys.error(5); - } - let s[j] = c; - return; - } - - /** Appends c to this string's end and returns this string. */ - method String appendChar(char c) { - if (len = maxLen) { - do Output.printString("String.appendChar: reached max length!"); - do Sys.error(5); - } - let s[len] = c; - let len = len + 1; - return this; - } - - /** Erases the last character from this string. */ - method void eraseLastChar() { - if (len = 0){ - do Output.printString("String.eraseLastChar: string is already empty!"); - do Sys.error(5); - } - let len = len - 1; - return; - } - - /** Returns the integer value of this string, - * until a non-digit character is detected. */ - method int intValue() { - var int n, i; - var char c; - var boolean neg, done; - let n = 0; - if (s[0] = 45) { - let i = 1; - let neg = true; - } else { - let i = 0; - let neg = false; - } - let c = s[i]; - if ((c < 48) | (c > 57)) { - do Sys.error(3); - do Output.printString("String.intValue: the input data is not number!"); - } - let done = false; - while ((~done) & (i < len)) { - let c = s[i]; - if ((c > 47) & (c < 58)) { - let n = n * 10 + (c - 48); - } else { - let done = true; - } - let i = i + 1; - } - if (neg) { - return -n; - } else { - return n; - } - - } - - /** Sets this string to hold a representation of the given value. */ - method void setInt(int val) { //change Output.printInt after this - var int x, i, y; - var boolean neg; - if (val < 0) { - let neg = true; - let len = 2; - } else { - let neg = false; - let len = 1; - } - let x = Math.abs(val); - if (x > 9999) { - let len = len + 4; - } else { if (x > 999) { - let len = len + 3; - } else { if (x > 99) { - let len = len + 2; - } else { if (x > 9) { - let len = len + 1; - }}}} - if (len > maxLen) { - do Output.printString("String.setInt: val is too big for the string!"); - do Sys.error(5); - } - if (x = 0) { - do setCharAt(0, 48); - return; - } - if (neg) { - do setCharAt(0, 45); - } - let i = len - 1; - while (x > 0) { - let y = x / 10; - do setCharAt(i, x - (y * 10) + 48); - let x = y; - let i = i - 1; - } - return; - } - - /** Returns the new line character. */ - function char newLine() { - return 128; - } - - /** Returns the backspace character. */ - function char backSpace() { - return 129; - } - - /** Returns the double quote (") character. */ - function char doubleQuote() { - return 34; - } -} diff --git a/projects/12/StringTest/String.vm b/projects/12/StringTest/String.vm deleted file mode 100644 index 36664c1..0000000 --- a/projects/12/StringTest/String.vm +++ /dev/null @@ -1,917 +0,0 @@ -function String.new 0 -push constant 3 -call Memory.alloc 1 -pop pointer 0 -push argument 0 -push constant 0 -gt -if-goto IF_TRUE0 -goto IF_FALSE0 -label IF_TRUE0 -push argument 0 -call Array.new 1 -pop this 2 -label IF_FALSE0 -push argument 0 -pop this 0 -push constant 0 -pop this 1 -push pointer 0 -return -function String.dispose 0 -push argument 0 -pop pointer 0 -push this 0 -push constant 0 -gt -if-goto IF_TRUE0 -goto IF_FALSE0 -label IF_TRUE0 -push this 2 -call Array.dispose 1 -pop temp 0 -label IF_FALSE0 -push pointer 0 -call Memory.deAlloc 1 -pop temp 0 -push constant 0 -return -function String.length 0 -push argument 0 -pop pointer 0 -push this 1 -return -function String.charAt 0 -push argument 0 -pop pointer 0 -push argument 1 -push constant 0 -lt -push argument 1 -push constant 1 -add -push this 1 -gt -or -if-goto IF_TRUE0 -goto IF_FALSE0 -label IF_TRUE0 -push constant 34 -call String.new 1 -push constant 83 -call String.appendChar 2 -push constant 116 -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 103 -call String.appendChar 2 -push constant 46 -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 65 -call String.appendChar 2 -push constant 116 -call String.appendChar 2 -push constant 58 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -push constant 105 -call String.appendChar 2 -push constant 110 -call String.appendChar 2 -push constant 100 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 120 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -push constant 111 -call String.appendChar 2 -push constant 117 -call String.appendChar 2 -push constant 116 -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 114 -call String.appendChar 2 -push constant 97 -call String.appendChar 2 -push constant 110 -call String.appendChar 2 -push constant 103 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 33 -call String.appendChar 2 -call Output.printString 1 -pop temp 0 -push constant 5 -call Sys.error 1 -pop temp 0 -label IF_FALSE0 -push argument 1 -push this 2 -add -pop pointer 1 -push that 0 -return -function String.setCharAt 0 -push argument 0 -pop pointer 0 -push argument 1 -push constant 0 -lt -push argument 1 -push constant 1 -add -push this 1 -gt -or -if-goto IF_TRUE0 -goto IF_FALSE0 -label IF_TRUE0 -push constant 37 -call String.new 1 -push constant 83 -call String.appendChar 2 -push constant 116 -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 103 -call String.appendChar 2 -push constant 46 -call String.appendChar 2 -push constant 115 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 116 -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 65 -call String.appendChar 2 -push constant 116 -call String.appendChar 2 -push constant 58 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -push constant 105 -call String.appendChar 2 -push constant 110 -call String.appendChar 2 -push constant 100 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 120 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -push constant 111 -call String.appendChar 2 -push constant 117 -call String.appendChar 2 -push constant 116 -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 114 -call String.appendChar 2 -push constant 97 -call String.appendChar 2 -push constant 110 -call String.appendChar 2 -push constant 103 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 33 -call String.appendChar 2 -call Output.printString 1 -pop temp 0 -push constant 5 -call Sys.error 1 -pop temp 0 -label IF_FALSE0 -push argument 1 -push this 2 -add -push argument 2 -pop temp 0 -pop pointer 1 -push temp 0 -pop that 0 -push constant 0 -return -function String.appendChar 0 -push argument 0 -pop pointer 0 -push this 1 -push this 0 -eq -if-goto IF_TRUE0 -goto IF_FALSE0 -label IF_TRUE0 -push constant 38 -call String.new 1 -push constant 83 -call String.appendChar 2 -push constant 116 -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 103 -call String.appendChar 2 -push constant 46 -call String.appendChar 2 -push constant 97 -call String.appendChar 2 -push constant 112 -call String.appendChar 2 -push constant 112 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 110 -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 58 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -push constant 114 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 97 -call String.appendChar 2 -push constant 99 -call String.appendChar 2 -push constant 104 -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 109 -call String.appendChar 2 -push constant 97 -call String.appendChar 2 -push constant 120 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -push constant 108 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 110 -call String.appendChar 2 -push constant 103 -call String.appendChar 2 -push constant 116 -call String.appendChar 2 -push constant 104 -call String.appendChar 2 -push constant 33 -call String.appendChar 2 -call Output.printString 1 -pop temp 0 -push constant 5 -call Sys.error 1 -pop temp 0 -label IF_FALSE0 -push this 1 -push this 2 -add -push argument 1 -pop temp 0 -pop pointer 1 -push temp 0 -pop that 0 -push this 1 -push constant 1 -add -pop this 1 -push pointer 0 -return -function String.eraseLastChar 0 -push argument 0 -pop pointer 0 -push this 1 -push constant 0 -eq -if-goto IF_TRUE0 -goto IF_FALSE0 -label IF_TRUE0 -push constant 46 -call String.new 1 -push constant 83 -call String.appendChar 2 -push constant 116 -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 103 -call String.appendChar 2 -push constant 46 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 114 -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 76 -call String.appendChar 2 -push constant 97 -call String.appendChar 2 -push constant 115 -call String.appendChar 2 -push constant 116 -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 58 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -push constant 115 -call String.appendChar 2 -push constant 116 -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 103 -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 97 -call String.appendChar 2 -push constant 108 -call String.appendChar 2 -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 121 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 109 -call String.appendChar 2 -push constant 112 -call String.appendChar 2 -push constant 116 -call String.appendChar 2 -push constant 121 -call String.appendChar 2 -push constant 33 -call String.appendChar 2 -call Output.printString 1 -pop temp 0 -push constant 5 -call Sys.error 1 -pop temp 0 -label IF_FALSE0 -push this 1 -push constant 1 -sub -pop this 1 -push constant 0 -return -function String.intValue 5 -push argument 0 -pop pointer 0 -push constant 0 -pop local 0 -push constant 0 -push this 2 -add -pop pointer 1 -push that 0 -push constant 45 -eq -if-goto IF_TRUE0 -goto IF_FALSE0 -label IF_TRUE0 -push constant 1 -pop local 1 -push constant 0 -not -pop local 3 -goto IF_END0 -label IF_FALSE0 -push constant 0 -pop local 1 -push constant 0 -pop local 3 -label IF_END0 -push local 1 -push this 2 -add -pop pointer 1 -push that 0 -pop local 2 -push local 2 -push constant 48 -lt -push local 2 -push constant 57 -gt -or -if-goto IF_TRUE1 -goto IF_FALSE1 -label IF_TRUE1 -push constant 3 -call Sys.error 1 -pop temp 0 -push constant 46 -call String.new 1 -push constant 83 -call String.appendChar 2 -push constant 116 -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 103 -call String.appendChar 2 -push constant 46 -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 86 -call String.appendChar 2 -push constant 97 -call String.appendChar 2 -push constant 108 -call String.appendChar 2 -push constant 117 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 58 -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 105 -call String.appendChar 2 -push constant 110 -call String.appendChar 2 -push constant 112 -call String.appendChar 2 -push constant 117 -call String.appendChar 2 -push constant 116 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -push constant 100 -call String.appendChar 2 -push constant 97 -call String.appendChar 2 -push constant 116 -call String.appendChar 2 -push constant 97 -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 110 -call String.appendChar 2 -push constant 111 -call String.appendChar 2 -push constant 116 -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 33 -call String.appendChar 2 -call Output.printString 1 -pop temp 0 -label IF_FALSE1 -push constant 0 -pop local 4 -label WHILE_EXP0 -push local 4 -not -push local 1 -push this 1 -lt -and -not -if-goto WHILE_END0 -push local 1 -push this 2 -add -pop pointer 1 -push that 0 -pop local 2 -push local 2 -push constant 47 -gt -push local 2 -push constant 58 -lt -and -if-goto IF_TRUE2 -goto IF_FALSE2 -label IF_TRUE2 -push local 0 -push constant 10 -call Math.multiply 2 -push local 2 -push constant 48 -sub -add -pop local 0 -goto IF_END2 -label IF_FALSE2 -push constant 0 -not -pop local 4 -label IF_END2 -push local 1 -push constant 1 -add -pop local 1 -goto WHILE_EXP0 -label WHILE_END0 -push local 3 -if-goto IF_TRUE3 -goto IF_FALSE3 -label IF_TRUE3 -push local 0 -neg -return -goto IF_END3 -label IF_FALSE3 -push local 0 -return -label IF_END3 -function String.setInt 4 -push argument 0 -pop pointer 0 -push argument 1 -push constant 0 -lt -if-goto IF_TRUE0 -goto IF_FALSE0 -label IF_TRUE0 -push constant 0 -not -pop local 3 -push constant 2 -pop this 1 -goto IF_END0 -label IF_FALSE0 -push constant 0 -pop local 3 -push constant 1 -pop this 1 -label IF_END0 -push argument 1 -call Math.abs 1 -pop local 0 -push local 0 -push constant 9999 -gt -if-goto IF_TRUE1 -goto IF_FALSE1 -label IF_TRUE1 -push this 1 -push constant 4 -add -pop this 1 -goto IF_END1 -label IF_FALSE1 -push local 0 -push constant 999 -gt -if-goto IF_TRUE2 -goto IF_FALSE2 -label IF_TRUE2 -push this 1 -push constant 3 -add -pop this 1 -goto IF_END2 -label IF_FALSE2 -push local 0 -push constant 99 -gt -if-goto IF_TRUE3 -goto IF_FALSE3 -label IF_TRUE3 -push this 1 -push constant 2 -add -pop this 1 -goto IF_END3 -label IF_FALSE3 -push local 0 -push constant 9 -gt -if-goto IF_TRUE4 -goto IF_FALSE4 -label IF_TRUE4 -push this 1 -push constant 1 -add -pop this 1 -label IF_FALSE4 -label IF_END3 -label IF_END2 -label IF_END1 -push this 1 -push this 0 -gt -if-goto IF_TRUE5 -goto IF_FALSE5 -label IF_TRUE5 -push constant 45 -call String.new 1 -push constant 83 -call String.appendChar 2 -push constant 116 -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 103 -call String.appendChar 2 -push constant 46 -call String.appendChar 2 -push constant 115 -call String.appendChar 2 -push constant 101 -call String.appendChar 2 -push constant 116 -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 58 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -push constant 118 -call String.appendChar 2 -push constant 97 -call String.appendChar 2 -push constant 108 -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 116 -call String.appendChar 2 -push constant 111 -call String.appendChar 2 -push constant 111 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -push constant 98 -call String.appendChar 2 -push constant 105 -call String.appendChar 2 -push constant 103 -call String.appendChar 2 -push constant 32 -call String.appendChar 2 -push constant 102 -call String.appendChar 2 -push constant 111 -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 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 116 -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 103 -call String.appendChar 2 -push constant 33 -call String.appendChar 2 -call Output.printString 1 -pop temp 0 -push constant 5 -call Sys.error 1 -pop temp 0 -label IF_FALSE5 -push local 0 -push constant 0 -eq -if-goto IF_TRUE6 -goto IF_FALSE6 -label IF_TRUE6 -push pointer 0 -push constant 0 -push constant 48 -call String.setCharAt 3 -pop temp 0 -push constant 0 -return -label IF_FALSE6 -push local 3 -if-goto IF_TRUE7 -goto IF_FALSE7 -label IF_TRUE7 -push pointer 0 -push constant 0 -push constant 45 -call String.setCharAt 3 -pop temp 0 -label IF_FALSE7 -push this 1 -push constant 1 -sub -pop local 1 -label WHILE_EXP0 -push local 0 -push constant 0 -gt -not -if-goto WHILE_END0 -push local 0 -push constant 10 -call Math.divide 2 -pop local 2 -push pointer 0 -push local 1 -push local 0 -push local 2 -push constant 10 -call Math.multiply 2 -sub -push constant 48 -add -call String.setCharAt 3 -pop temp 0 -push local 2 -pop local 0 -push local 1 -push constant 1 -sub -pop local 1 -goto WHILE_EXP0 -label WHILE_END0 -push constant 0 -return -function String.newLine 0 -push constant 128 -return -function String.backSpace 0 -push constant 129 -return -function String.doubleQuote 0 -push constant 34 -return diff --git a/projects/12/StringTest/StringTestOutput.gif b/projects/12/StringTest/StringTestOutput.gif deleted file mode 100644 index 5c2932c..0000000 Binary files a/projects/12/StringTest/StringTestOutput.gif and /dev/null differ -- cgit v1.2.3