summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2022-08-16 11:53:39 +0800
committerFrederick Yin <fkfd@fkfd.me>2022-08-16 11:53:39 +0800
commit9c0cb1d1c32724fc95ac9548e4f8d873d3adaccc (patch)
tree1c12cfcb04dd4e298ddf6c4a5b8d10ea3c4ad47c
nand2tetris software suite
-rw-r--r--tools/Assembler.bat27
-rwxr-xr-xtools/Assembler.sh32
-rw-r--r--tools/CPUEmulator.bat29
-rwxr-xr-xtools/CPUEmulator.sh33
-rw-r--r--tools/HardwareSimulator.bat30
-rwxr-xr-xtools/HardwareSimulator.sh34
-rw-r--r--tools/JackCompiler.bat26
-rwxr-xr-xtools/JackCompiler.sh35
-rw-r--r--tools/OS/Array.vm23
-rw-r--r--tools/OS/Keyboard.vm102
-rw-r--r--tools/OS/Math.vm408
-rw-r--r--tools/OS/Memory.vm376
-rw-r--r--tools/OS/Output.vm1852
-rw-r--r--tools/OS/Screen.vm806
-rw-r--r--tools/OS/String.vm393
-rw-r--r--tools/OS/Sys.vm83
-rw-r--r--tools/TextComparer.bat29
-rwxr-xr-xtools/TextComparer.sh36
-rw-r--r--tools/VMEmulator.bat29
-rwxr-xr-xtools/VMEmulator.sh33
-rw-r--r--tools/bin/classes/CPUEmulatorMain.classbin0 -> 1084 bytes
-rw-r--r--tools/bin/classes/HackAssemblerMain.classbin0 -> 1098 bytes
-rw-r--r--tools/bin/classes/HardwareSimulatorMain.classbin0 -> 1182 bytes
-rw-r--r--tools/bin/classes/TextComparer.classbin0 -> 1739 bytes
-rw-r--r--tools/bin/classes/VMEmulatorMain.classbin0 -> 1073 bytes
-rw-r--r--tools/bin/help/asmAbout.html96
-rw-r--r--tools/bin/help/asmUsage.html115
-rw-r--r--tools/bin/help/compiler.txt9
-rw-r--r--tools/bin/help/cpuAbout.html96
-rw-r--r--tools/bin/help/cpuUsage.html115
-rw-r--r--tools/bin/help/hwAbout.html96
-rw-r--r--tools/bin/help/hwUsage.html115
-rw-r--r--tools/bin/help/vmAbout.html110
-rw-r--r--tools/bin/help/vmUsage.html115
-rw-r--r--tools/bin/images/arrow2.gifbin0 -> 1073 bytes
-rw-r--r--tools/bin/images/calculator2.gifbin0 -> 302 bytes
-rw-r--r--tools/bin/images/cancel.gifbin0 -> 1133 bytes
-rw-r--r--tools/bin/images/chip.gifbin0 -> 1078 bytes
-rw-r--r--tools/bin/images/clock2.gifbin0 -> 1138 bytes
-rw-r--r--tools/bin/images/equal.gifbin0 -> 1042 bytes
-rw-r--r--tools/bin/images/find.gifbin0 -> 1014 bytes
-rw-r--r--tools/bin/images/hex.gifbin0 -> 1422 bytes
-rw-r--r--tools/bin/images/keyboard.gifbin0 -> 1017 bytes
-rw-r--r--tools/bin/images/ok.gifbin0 -> 988 bytes
-rw-r--r--tools/bin/images/ok2.gifbin0 -> 920 bytes
-rw-r--r--tools/bin/images/open.gifbin0 -> 930 bytes
-rw-r--r--tools/bin/images/open2.gifbin0 -> 969 bytes
-rw-r--r--tools/bin/images/opendoc.gifbin0 -> 1094 bytes
-rw-r--r--tools/bin/images/redflag.gifbin0 -> 1100 bytes
-rw-r--r--tools/bin/images/save.gifbin0 -> 1257 bytes
-rw-r--r--tools/bin/images/scroll.gifbin0 -> 949 bytes
-rw-r--r--tools/bin/images/smallcancel.gifbin0 -> 946 bytes
-rw-r--r--tools/bin/images/smallequal.gifbin0 -> 898 bytes
-rw-r--r--tools/bin/images/smallminus.gifbin0 -> 863 bytes
-rw-r--r--tools/bin/images/smallnew.gifbin0 -> 1000 bytes
-rw-r--r--tools/bin/images/smallok.gifbin0 -> 925 bytes
-rw-r--r--tools/bin/images/smallplus.gifbin0 -> 873 bytes
-rw-r--r--tools/bin/images/vcrfastforward.gifbin0 -> 1122 bytes
-rw-r--r--tools/bin/images/vcrforward.gifbin0 -> 1021 bytes
-rw-r--r--tools/bin/images/vcrrewind.gifbin0 -> 1122 bytes
-rw-r--r--tools/bin/images/vcrstop.gifbin0 -> 972 bytes
-rw-r--r--tools/bin/lib/AssemblerGUI.jarbin0 -> 4470 bytes
-rw-r--r--tools/bin/lib/Compilers.jarbin0 -> 27094 bytes
-rw-r--r--tools/bin/lib/Hack.jarbin0 -> 59364 bytes
-rw-r--r--tools/bin/lib/HackGUI.jarbin0 -> 96666 bytes
-rw-r--r--tools/bin/lib/Simulators.jarbin0 -> 81810 bytes
-rw-r--r--tools/bin/lib/SimulatorsGUI.jarbin0 -> 68492 bytes
-rw-r--r--tools/bin/lib/TranslatorsGUI.jarbin0 -> 13643 bytes
-rw-r--r--tools/bin/scripts/defaultCPU.txt3
-rw-r--r--tools/bin/scripts/defaultHW.txt4
-rw-r--r--tools/bin/scripts/defaultVM.txt3
-rw-r--r--tools/builtInChips/ALU.classbin0 -> 1754 bytes
-rw-r--r--tools/builtInChips/ALU.hdl55
-rw-r--r--tools/builtInChips/ARegister.classbin0 -> 337 bytes
-rw-r--r--tools/builtInChips/ARegister.hdl24
-rw-r--r--tools/builtInChips/Add16.classbin0 -> 343 bytes
-rw-r--r--tools/builtInChips/Add16.hdl18
-rw-r--r--tools/builtInChips/And.classbin0 -> 341 bytes
-rw-r--r--tools/builtInChips/And.hdl16
-rw-r--r--tools/builtInChips/And16.hdl17
-rw-r--r--tools/builtInChips/Bit.classbin0 -> 416 bytes
-rw-r--r--tools/builtInChips/Bit.hdl19
-rw-r--r--tools/builtInChips/DFF.classbin0 -> 401 bytes
-rw-r--r--tools/builtInChips/DFF.hdl18
-rw-r--r--tools/builtInChips/DMux.classbin0 -> 365 bytes
-rw-r--r--tools/builtInChips/DMux.hdl20
-rw-r--r--tools/builtInChips/DMux4Way.classbin0 -> 408 bytes
-rw-r--r--tools/builtInChips/DMux4Way.hdl22
-rw-r--r--tools/builtInChips/DMux8Way.classbin0 -> 488 bytes
-rw-r--r--tools/builtInChips/DMux8Way.hdl22
-rw-r--r--tools/builtInChips/DRegister.classbin0 -> 339 bytes
-rw-r--r--tools/builtInChips/DRegister.hdl24
-rw-r--r--tools/builtInChips/FullAdder.classbin0 -> 380 bytes
-rw-r--r--tools/builtInChips/FullAdder.hdl19
-rw-r--r--tools/builtInChips/HalfAdder.classbin0 -> 360 bytes
-rw-r--r--tools/builtInChips/HalfAdder.hdl18
-rw-r--r--tools/builtInChips/Inc16.classbin0 -> 333 bytes
-rw-r--r--tools/builtInChips/Inc16.hdl18
-rw-r--r--tools/builtInChips/Keyboard.classbin0 -> 1709 bytes
-rw-r--r--tools/builtInChips/Keyboard.hdl23
-rw-r--r--tools/builtInChips/Mux.classbin0 -> 356 bytes
-rw-r--r--tools/builtInChips/Mux.hdl16
-rw-r--r--tools/builtInChips/Mux16.hdl16
-rw-r--r--tools/builtInChips/Mux4Way16.classbin0 -> 435 bytes
-rw-r--r--tools/builtInChips/Mux4Way16.hdl21
-rw-r--r--tools/builtInChips/Mux8Way16.classbin0 -> 527 bytes
-rw-r--r--tools/builtInChips/Mux8Way16.hdl24
-rw-r--r--tools/builtInChips/Nand.classbin0 -> 344 bytes
-rw-r--r--tools/builtInChips/Nand.hdl16
-rw-r--r--tools/builtInChips/Not.classbin0 -> 331 bytes
-rw-r--r--tools/builtInChips/Not.hdl16
-rw-r--r--tools/builtInChips/Not16.classbin0 -> 327 bytes
-rw-r--r--tools/builtInChips/Not16.hdl16
-rw-r--r--tools/builtInChips/Or.classbin0 -> 340 bytes
-rw-r--r--tools/builtInChips/Or.hdl16
-rw-r--r--tools/builtInChips/Or16.hdl16
-rw-r--r--tools/builtInChips/Or8Way.classbin0 -> 340 bytes
-rw-r--r--tools/builtInChips/Or8Way.hdl16
-rw-r--r--tools/builtInChips/PC.classbin0 -> 1899 bytes
-rw-r--r--tools/builtInChips/PC.hdl22
-rw-r--r--tools/builtInChips/RAM.classbin0 -> 1928 bytes
-rw-r--r--tools/builtInChips/RAM16K.classbin0 -> 390 bytes
-rw-r--r--tools/builtInChips/RAM16K.hdl24
-rw-r--r--tools/builtInChips/RAM4K.classbin0 -> 309 bytes
-rw-r--r--tools/builtInChips/RAM4K.hdl24
-rw-r--r--tools/builtInChips/RAM512.classbin0 -> 311 bytes
-rw-r--r--tools/builtInChips/RAM512.hdl24
-rw-r--r--tools/builtInChips/RAM64.classbin0 -> 308 bytes
-rw-r--r--tools/builtInChips/RAM64.hdl24
-rw-r--r--tools/builtInChips/RAM8.classbin0 -> 306 bytes
-rw-r--r--tools/builtInChips/RAM8.hdl24
-rw-r--r--tools/builtInChips/ROM32K.classbin0 -> 3469 bytes
-rw-r--r--tools/builtInChips/ROM32K.hdl30
-rw-r--r--tools/builtInChips/Register.classbin0 -> 423 bytes
-rw-r--r--tools/builtInChips/Register.hdl19
-rw-r--r--tools/builtInChips/RegisterWithGUI.classbin0 -> 1769 bytes
-rw-r--r--tools/builtInChips/Screen.classbin0 -> 1322 bytes
-rw-r--r--tools/builtInChips/Screen.hdl35
-rw-r--r--tools/builtInChips/Xor.classbin0 -> 341 bytes
-rw-r--r--tools/builtInChips/Xor.hdl16
-rw-r--r--tools/builtInVMCode/Array.classbin0 -> 436 bytes
-rw-r--r--tools/builtInVMCode/JackOSClass.classbin0 -> 1782 bytes
-rw-r--r--tools/builtInVMCode/Keyboard.classbin0 -> 1362 bytes
-rw-r--r--tools/builtInVMCode/Math.classbin0 -> 650 bytes
-rw-r--r--tools/builtInVMCode/Memory.classbin0 -> 788 bytes
-rw-r--r--tools/builtInVMCode/Output.classbin0 -> 4264 bytes
-rw-r--r--tools/builtInVMCode/Screen.classbin0 -> 1921 bytes
-rw-r--r--tools/builtInVMCode/String.classbin0 -> 1630 bytes
-rw-r--r--tools/builtInVMCode/Sys.classbin0 -> 1885 bytes
149 files changed, 6041 insertions, 0 deletions
diff --git a/tools/Assembler.bat b/tools/Assembler.bat
new file mode 100644
index 0000000..93260ec
--- /dev/null
+++ b/tools/Assembler.bat
@@ -0,0 +1,27 @@
+@echo off
+
+rem $Id: Assembler.bat,v 1.2 2014/05/10 00:52:43 marka Exp $
+rem mark.armbrust@pobox.com
+
+setlocal
+if not "%2"=="" goto :USAGE
+if "%~1"=="/?" (
+:USAGE
+ echo Usage:
+ echo Assembler Starts the assembler in interactive mode.
+ echo Assembler FILE[.asm] Assembles FILE.asm to FILE.hack.
+ exit -b
+)
+if not "%~1"=="" (
+ set "_arg1=%~f1"
+)
+pushd "%~dp0"
+if "%~1"=="" (
+ start javaw -classpath "%CLASSPATH%;bin/classes;bin/lib/Hack.jar;bin/lib/HackGUI.jar;bin/lib/Compilers.jar;bin/lib/AssemblerGUI.jar;bin/lib/TranslatorsGUI.jar" ^
+ HackAssemblerMain
+) else (
+ echo Assembling "%_arg1%"
+ java -classpath "%CLASSPATH%;bin/classes;bin/lib/Hack.jar;bin/lib/HackGUI.jar;bin/lib/Compilers.jar;bin/lib/AssemblerGUI.jar;bin/lib/TranslatorsGUI.jar" ^
+ HackAssemblerMain "%_arg1%"
+)
+popd
diff --git a/tools/Assembler.sh b/tools/Assembler.sh
new file mode 100755
index 0000000..70db569
--- /dev/null
+++ b/tools/Assembler.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env sh
+
+# $Id: Assembler.sh,v 1.1 2014/06/17 21:14:01 marka Exp $
+# mark.armbrust@pobox.com
+
+# User's CDPATH can interfere with cd in this script
+unset CDPATH
+# Get the true name of this script
+script="`test -L "$0" && readlink -n "$0" || echo "$0"`"
+dir="$PWD"
+cd "`dirname "$script"`"
+if [ \( $# -gt 1 \) -o \( "$1" = "-h" \) -o \( "$1" = "--help" \) ]
+then
+ echo "Usage:"
+ echo " `basename "$0"` Starts the assembler in interactive mode."
+ echo " `basename "$0"` FILE[.asm] Assembles FILE.asm to FILE.hack."
+elif [ $# -eq 0 ]
+then
+ # Run assembler in interactive mode
+ java -classpath "${CLASSPATH}:bin/classes:bin/lib/Hack.jar:bin/lib/HackGUI.jar:bin/lib/Compilers.jar:bin/lib/AssemblerGUI.jar:bin/lib/TranslatorsGUI.jar" HackAssemblerMain &
+else
+ # Convert arg1 to an absolute path and run assembler with arg1.
+ if [ `echo "$1" | sed -e "s/\(.\).*/\1/"` = / ]
+ then
+ arg1="$1"
+ else
+ arg1="${dir}/$1"
+ fi
+ echo Assembling "$arg1"
+ java -classpath "${CLASSPATH}:bin/classes:bin/lib/Hack.jar:bin/lib/HackGUI.jar:bin/lib/Compilers.jar:bin/lib/AssemblerGUI.jar:bin/lib/TranslatorsGUI.jar" HackAssemblerMain "$arg1"
+fi
+
diff --git a/tools/CPUEmulator.bat b/tools/CPUEmulator.bat
new file mode 100644
index 0000000..f92cf40
--- /dev/null
+++ b/tools/CPUEmulator.bat
@@ -0,0 +1,29 @@
+@echo off
+
+rem $Id: CPUEmulator.bat,v 1.3 2014/05/10 00:52:43 marka Exp $
+rem mark.armbrust@pobox.com
+
+setlocal
+if not "%2"=="" goto :USAGE
+if "%~1"=="/?" (
+:USAGE
+ echo Usage:
+ echo CPUEmulator Starts the CPU Emulator in interactive mode.
+ echo CPUEmulator FILE.tst Starts the CPU Emulator and runs the FILE.tst
+ echo test script. The success/failure message
+ echo is printed to the command console.
+ exit -b
+)
+if not "%~1"=="" (
+ set "_arg1=%~f1"
+)
+pushd "%~dp0"
+if "%~1"=="" (
+ start javaw -classpath "%CLASSPATH%;bin/classes;bin/lib/Hack.jar;bin/lib/HackGUI.jar;bin/lib/Simulators.jar;bin/lib/SimulatorsGUI.jar;bin/lib/Compilers.jar" ^
+ CPUEmulatorMain
+) else (
+rem echo Running "%_arg1%"
+ java -classpath "%CLASSPATH%;bin/classes;bin/lib/Hack.jar;bin/lib/HackGUI.jar;bin/lib/Simulators.jar;bin/lib/SimulatorsGUI.jar;bin/lib/Compilers.jar" ^
+ CPUEmulatorMain "%_arg1%"
+)
+popd
diff --git a/tools/CPUEmulator.sh b/tools/CPUEmulator.sh
new file mode 100755
index 0000000..033d9d7
--- /dev/null
+++ b/tools/CPUEmulator.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env sh
+
+# $Id: CPUEmulator.sh,v 1.1 2014/06/17 21:14:01 marka Exp $
+# mark.armbrust@pobox.com
+
+# User's CDPATH can interfere with cd in this script
+unset CDPATH
+# Get the true name of this script
+script="`test -L "$0" && readlink -n "$0" || echo "$0"`"
+dir="$PWD"
+cd "`dirname "$script"`"
+if [ \( $# -gt 1 \) -o \( "$1" = "-h" \) -o \( "$1" = "--help" \) ]
+then
+ echo "Usage:"
+ echo " `basename "$0"` Starts the CPU Emulator in interactive mode."
+ echo " `basename "$0"` FILE.tst Starts the CPU Emulator and runs the File.tst"
+ echo " test script. The success/failure message"
+ echo " is printed to the command console."
+elif [ $# -eq 0 ]
+then
+ # Run CPU emulator in interactive mode
+ java -classpath "${CLASSPATH}:bin/classes:bin/lib/Hack.jar:bin/lib/HackGUI.jar:bin/lib/Simulators.jar:bin/lib/SimulatorsGUI.jar:bin/lib/Compilers.jar" CPUEmulatorMain &
+else
+ # Convert arg1 to an absolute path and run CPU emulator with arg1
+ if [ `echo "$1" | sed -e "s/\(.\).*/\1/"` = / ]
+ then
+ arg1="$1"
+ else
+ arg1="${dir}/$1"
+ fi
+# echo Running "$arg1"
+ java -classpath "${CLASSPATH}:bin/classes:bin/lib/Hack.jar:bin/lib/HackGUI.jar:bin/lib/Simulators.jar:bin/lib/SimulatorsGUI.jar:bin/lib/Compilers.jar" CPUEmulatorMain "$arg1"
+fi
diff --git a/tools/HardwareSimulator.bat b/tools/HardwareSimulator.bat
new file mode 100644
index 0000000..76baa31
--- /dev/null
+++ b/tools/HardwareSimulator.bat
@@ -0,0 +1,30 @@
+@echo off
+
+rem $Id: HardwareSimulator.bat,v 1.3 2014/05/10 00:52:43 marka Exp $
+rem mark.armbrust@pobox.com
+
+setlocal
+if not "%2"=="" goto :USAGE
+if "%~1"=="/?" (
+:USAGE
+ echo Usage:
+ echo HardwareSimulator Starts the Hardware Simulator in
+ echo interactive mode.
+ echo HardwareSimulator FILE.tst Starts the Hardware Simulator and runs the
+ echo FILE.tst test script. The success/failure
+ echo message is printed to the command console.
+ exit -b
+)
+if not "%~1"=="" (
+ set "_arg1=%~f1"
+)
+pushd "%~dp0"
+if "%~1"=="" (
+ start javaw -classpath "%CLASSPATH%;.;bin/classes;bin/lib/Hack.jar;bin/lib/HackGUI.jar;bin/lib/Simulators.jar;bin/lib/SimulatorsGUI.jar;bin/lib/Compilers.jar" ^
+ HardwareSimulatorMain
+) else (
+rem echo Running "%_arg1%"
+ java -classpath "%CLASSPATH%;.;bin/classes;bin/lib/Hack.jar;bin/lib/HackGUI.jar;bin/lib/Simulators.jar;bin/lib/SimulatorsGUI.jar;bin/lib/Compilers.jar" ^
+ HardwareSimulatorMain "%_arg1%"
+)
+popd
diff --git a/tools/HardwareSimulator.sh b/tools/HardwareSimulator.sh
new file mode 100755
index 0000000..47e7482
--- /dev/null
+++ b/tools/HardwareSimulator.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env sh
+
+# $Id: HardwareSimulator.sh,v 1.1 2014/06/17 21:14:01 marka Exp $
+# mark.armbrust@pobox.com
+
+# User's CDPATH can interfere with cd in this script
+unset CDPATH
+# Get the true name of this script
+script="`test -L "$0" && readlink -n "$0" || echo "$0"`"
+dir="$PWD"
+cd "`dirname "$script"`"
+if [ \( $# -gt 1 \) -o \( "$1" = "-h" \) -o \( "$1" = "--help" \) ]
+then
+ echo "Usage:"
+ echo " `basename "$0"` Starts the Hardware Simulator in"
+ echo " interactive mode."
+ echo " `basename "$0"` FILE.tst Starts the Hardware Simulator and runs the"
+ echo " FILE.tst test script. The success/failure"
+ echo " message is printed to the command console."
+elif [ $# -eq 0 ]
+then
+ # Run hardware simulator in interactive mode
+ java -classpath "${CLASSPATH}:bin/classes:BuiltIn:bin/lib/Hack.jar:bin/lib/HackGUI.jar:bin/lib/Simulators.jar:bin/lib/SimulatorsGUI.jar:bin/lib/Compilers.jar" HardwareSimulatorMain &
+else
+ # Convert arg1 to an absolute path and run hardware simulator with arg1
+ if [ `echo "$1" | sed -e "s/\(.\).*/\1/"` = / ]
+ then
+ arg1="$1"
+ else
+ arg1="${dir}/$1"
+ fi
+# echo Running "$arg1"
+ java -classpath "${CLASSPATH}:bin/classes:BuiltIn:bin/lib/Hack.jar:bin/lib/HackGUI.jar:bin/lib/Simulators.jar:bin/lib/SimulatorsGUI.jar:bin/lib/Compilers.jar" HardwareSimulatorMain "$arg1"
+fi
diff --git a/tools/JackCompiler.bat b/tools/JackCompiler.bat
new file mode 100644
index 0000000..9399b94
--- /dev/null
+++ b/tools/JackCompiler.bat
@@ -0,0 +1,26 @@
+@echo off
+
+rem $Id: JackCompiler.bat,v 1.2 2014/05/10 00:52:43 marka Exp $
+rem mark.armbrust@pobox.com
+
+setlocal
+if not "%2"=="" goto :USAGE
+if "%~1"=="/?" (
+:USAGE
+ echo Usage:
+ echo JackCompiler Compiles all .jack files in the current
+ echo working directory.
+ echo JackCompiler DIRECTORY Compiles all .jack files in DIRECTORY.
+ echo JackCompiler FILE.jack Compiles FILE.jack to FILE.vm.
+ exit -b
+)
+if not "%~1"=="" (
+ set "_arg1=%~f1"
+) else (
+ set "_arg1=%CD%"
+)
+pushd "%~dp0"
+echo Compiling "%_arg1%"
+java -classpath "%CLASSPATH%;bin/classes;bin/lib/Hack.jar;bin/lib/Compilers.jar" ^
+ Hack.Compiler.JackCompiler "%_arg1%"
+popd
diff --git a/tools/JackCompiler.sh b/tools/JackCompiler.sh
new file mode 100755
index 0000000..699dfb8
--- /dev/null
+++ b/tools/JackCompiler.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env sh
+
+# $Id: JackCompiler.sh,v 1.1 2014/06/17 21:14:01 marka Exp $
+# mark.armbrust@pobox.com
+
+# User's CDPATH can interfere with cd in this script
+unset CDPATH
+# Get the true name of this script
+script="`test -L "$0" && readlink -n "$0" || echo "$0"`"
+dir="$PWD"
+cd "`dirname "$script"`"
+if [ \( $# -gt 1 \) -o \( "$1" = "-h" \) -o \( "$1" = "--help" \) ]
+then
+ echo "Usage:"
+ echo " `basename "$0"` Compiles all .jack files in the current"
+ echo " working directory."
+ echo " `basename "$0"` DIRECTORY Compiles all .jack files in DIRECTORY."
+ echo " `basename "$0"` FILE.jack Compiles FILE.jack to FILE.vm."
+else
+ if [ $# -eq 0 ]
+ then
+ # Use current directory as arg1
+ arg1="$dir"
+ else
+ # Convert arg1 to an absolute path
+ if [ `echo "$1" | sed -e "s/\(.\).*/\1/"` = / ]
+ then
+ arg1="$1"
+ else
+ arg1="$dir/$1"
+ fi
+ fi
+ echo Compiling "$arg1"
+ java -classpath "${CLASSPATH}:bin/classes:bin/lib/Hack.jar:bin/lib/Compilers.jar" Hack.Compiler.JackCompiler "$arg1"
+fi
diff --git a/tools/OS/Array.vm b/tools/OS/Array.vm
new file mode 100644
index 0000000..aa4c9e8
--- /dev/null
+++ b/tools/OS/Array.vm
@@ -0,0 +1,23 @@
+function Array.new 0
+push argument 0
+push constant 0
+gt
+not
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 2
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+push argument 0
+call Memory.alloc 1
+return
+function Array.dispose 0
+push argument 0
+pop pointer 0
+push pointer 0
+call Memory.deAlloc 1
+pop temp 0
+push constant 0
+return
diff --git a/tools/OS/Keyboard.vm b/tools/OS/Keyboard.vm
new file mode 100644
index 0000000..a806c4e
--- /dev/null
+++ b/tools/OS/Keyboard.vm
@@ -0,0 +1,102 @@
+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
+call Output.printChar 1
+pop temp 0
+label WHILE_EXP0
+push local 1
+push constant 0
+eq
+push local 0
+push constant 0
+gt
+or
+not
+if-goto WHILE_END0
+call Keyboard.keyPressed 0
+pop local 0
+push local 0
+push constant 0
+gt
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push local 0
+pop local 1
+label IF_FALSE0
+goto WHILE_EXP0
+label WHILE_END0
+call String.backSpace 0
+call Output.printChar 1
+pop temp 0
+push local 1
+call Output.printChar 1
+pop temp 0
+push local 1
+return
+function Keyboard.readLine 5
+push constant 80
+call String.new 1
+pop local 3
+push argument 0
+call Output.printString 1
+pop temp 0
+call String.newLine 0
+pop local 1
+call String.backSpace 0
+pop local 2
+label WHILE_EXP0
+push local 4
+not
+not
+if-goto WHILE_END0
+call Keyboard.readChar 0
+pop local 0
+push local 0
+push local 1
+eq
+pop local 4
+push local 4
+not
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push local 0
+push local 2
+eq
+if-goto IF_TRUE1
+goto IF_FALSE1
+label IF_TRUE1
+push local 3
+call String.eraseLastChar 1
+pop temp 0
+goto IF_END1
+label IF_FALSE1
+push local 3
+push local 0
+call String.appendChar 2
+pop local 3
+label IF_END1
+label IF_FALSE0
+goto WHILE_EXP0
+label WHILE_END0
+push local 3
+return
+function Keyboard.readInt 2
+push argument 0
+call Keyboard.readLine 1
+pop local 0
+push local 0
+call String.intValue 1
+pop local 1
+push local 0
+call String.dispose 1
+pop temp 0
+push local 1
+return
diff --git a/tools/OS/Math.vm b/tools/OS/Math.vm
new file mode 100644
index 0000000..b660688
--- /dev/null
+++ b/tools/OS/Math.vm
@@ -0,0 +1,408 @@
+function Math.init 1
+push constant 16
+call Array.new 1
+pop static 1
+push constant 16
+call Array.new 1
+pop static 0
+push constant 0
+push static 0
+add
+push constant 1
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+label WHILE_EXP0
+push local 0
+push constant 15
+lt
+not
+if-goto WHILE_END0
+push local 0
+push constant 1
+add
+pop local 0
+push local 0
+push static 0
+add
+push local 0
+push constant 1
+sub
+push static 0
+add
+pop pointer 1
+push that 0
+push local 0
+push constant 1
+sub
+push static 0
+add
+pop pointer 1
+push that 0
+add
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+goto WHILE_EXP0
+label WHILE_END0
+push constant 0
+return
+function Math.abs 0
+push argument 0
+push constant 0
+lt
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push argument 0
+neg
+pop argument 0
+label IF_FALSE0
+push argument 0
+return
+function Math.multiply 5
+push argument 0
+push constant 0
+lt
+push argument 1
+push constant 0
+gt
+and
+push argument 0
+push constant 0
+gt
+push argument 1
+push constant 0
+lt
+and
+or
+pop local 4
+push argument 0
+call Math.abs 1
+pop argument 0
+push argument 1
+call Math.abs 1
+pop argument 1
+push argument 0
+push argument 1
+lt
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push argument 0
+pop local 1
+push argument 1
+pop argument 0
+push local 1
+pop argument 1
+label IF_FALSE0
+label WHILE_EXP0
+push local 2
+push constant 1
+sub
+push argument 1
+push constant 1
+sub
+lt
+not
+if-goto WHILE_END0
+push local 3
+push static 0
+add
+pop pointer 1
+push that 0
+push argument 1
+and
+push constant 0
+eq
+not
+if-goto IF_TRUE1
+goto IF_FALSE1
+label IF_TRUE1
+push local 0
+push argument 0
+add
+pop local 0
+push local 2
+push local 3
+push static 0
+add
+pop pointer 1
+push that 0
+add
+pop local 2
+label IF_FALSE1
+push argument 0
+push argument 0
+add
+pop argument 0
+push local 3
+push constant 1
+add
+pop local 3
+goto WHILE_EXP0
+label WHILE_END0
+push local 4
+if-goto IF_TRUE2
+goto IF_FALSE2
+label IF_TRUE2
+push local 0
+neg
+pop local 0
+label IF_FALSE2
+push local 0
+return
+function Math.divide 4
+push argument 1
+push constant 0
+eq
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 3
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+push argument 0
+push constant 0
+lt
+push argument 1
+push constant 0
+gt
+and
+push argument 0
+push constant 0
+gt
+push argument 1
+push constant 0
+lt
+and
+or
+pop local 2
+push constant 0
+push static 1
+add
+push argument 1
+call Math.abs 1
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push argument 0
+call Math.abs 1
+pop argument 0
+label WHILE_EXP0
+push local 0
+push constant 15
+lt
+push local 3
+not
+and
+not
+if-goto WHILE_END0
+push constant 32767
+push local 0
+push static 1
+add
+pop pointer 1
+push that 0
+push constant 1
+sub
+sub
+push local 0
+push static 1
+add
+pop pointer 1
+push that 0
+push constant 1
+sub
+lt
+pop local 3
+push local 3
+not
+if-goto IF_TRUE1
+goto IF_FALSE1
+label IF_TRUE1
+push local 0
+push constant 1
+add
+push static 1
+add
+push local 0
+push static 1
+add
+pop pointer 1
+push that 0
+push local 0
+push static 1
+add
+pop pointer 1
+push that 0
+add
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push local 0
+push constant 1
+add
+push static 1
+add
+pop pointer 1
+push that 0
+push constant 1
+sub
+push argument 0
+push constant 1
+sub
+gt
+pop local 3
+push local 3
+not
+if-goto IF_TRUE2
+goto IF_FALSE2
+label IF_TRUE2
+push local 0
+push constant 1
+add
+pop local 0
+label IF_FALSE2
+label IF_FALSE1
+goto WHILE_EXP0
+label WHILE_END0
+label WHILE_EXP1
+push local 0
+push constant 1
+neg
+gt
+not
+if-goto WHILE_END1
+push local 0
+push static 1
+add
+pop pointer 1
+push that 0
+push constant 1
+sub
+push argument 0
+push constant 1
+sub
+gt
+not
+if-goto IF_TRUE3
+goto IF_FALSE3
+label IF_TRUE3
+push local 1
+push local 0
+push static 0
+add
+pop pointer 1
+push that 0
+add
+pop local 1
+push argument 0
+push local 0
+push static 1
+add
+pop pointer 1
+push that 0
+sub
+pop argument 0
+label IF_FALSE3
+push local 0
+push constant 1
+sub
+pop local 0
+goto WHILE_EXP1
+label WHILE_END1
+push local 2
+if-goto IF_TRUE4
+goto IF_FALSE4
+label IF_TRUE4
+push local 1
+neg
+pop local 1
+label IF_FALSE4
+push local 1
+return
+function Math.sqrt 4
+push argument 0
+push constant 0
+lt
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 4
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+push constant 7
+pop local 0
+label WHILE_EXP0
+push local 0
+push constant 1
+neg
+gt
+not
+if-goto WHILE_END0
+push local 3
+push local 0
+push static 0
+add
+pop pointer 1
+push that 0
+add
+pop local 1
+push local 1
+push local 1
+call Math.multiply 2
+pop local 2
+push local 2
+push argument 0
+gt
+not
+push local 2
+push constant 0
+lt
+not
+and
+if-goto IF_TRUE1
+goto IF_FALSE1
+label IF_TRUE1
+push local 1
+pop local 3
+label IF_FALSE1
+push local 0
+push constant 1
+sub
+pop local 0
+goto WHILE_EXP0
+label WHILE_END0
+push local 3
+return
+function Math.max 0
+push argument 0
+push argument 1
+gt
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push argument 0
+pop argument 1
+label IF_FALSE0
+push argument 1
+return
+function Math.min 0
+push argument 0
+push argument 1
+lt
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push argument 0
+pop argument 1
+label IF_FALSE0
+push argument 1
+return
diff --git a/tools/OS/Memory.vm b/tools/OS/Memory.vm
new file mode 100644
index 0000000..8c74b87
--- /dev/null
+++ b/tools/OS/Memory.vm
@@ -0,0 +1,376 @@
+function Memory.init 0
+push constant 0
+pop static 0
+push constant 2048
+push static 0
+add
+push constant 14334
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 2049
+push static 0
+add
+push constant 2050
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 0
+return
+function Memory.peek 0
+push argument 0
+push static 0
+add
+pop pointer 1
+push that 0
+return
+function Memory.poke 0
+push argument 0
+push static 0
+add
+push argument 1
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 0
+return
+function Memory.alloc 2
+push argument 0
+push constant 0
+lt
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 5
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+push argument 0
+push constant 0
+eq
+if-goto IF_TRUE1
+goto IF_FALSE1
+label IF_TRUE1
+push constant 1
+pop argument 0
+label IF_FALSE1
+push constant 2048
+pop local 0
+label WHILE_EXP0
+push local 0
+push constant 16383
+lt
+push constant 0
+push local 0
+add
+pop pointer 1
+push that 0
+push argument 0
+lt
+and
+not
+if-goto WHILE_END0
+push constant 1
+push local 0
+add
+pop pointer 1
+push that 0
+pop local 1
+push constant 0
+push local 0
+add
+pop pointer 1
+push that 0
+push constant 0
+eq
+push local 1
+push constant 16382
+gt
+or
+push constant 0
+push local 1
+add
+pop pointer 1
+push that 0
+push constant 0
+eq
+or
+if-goto IF_TRUE2
+goto IF_FALSE2
+label IF_TRUE2
+push local 1
+pop local 0
+goto IF_END2
+label IF_FALSE2
+push constant 0
+push local 0
+add
+push constant 1
+push local 0
+add
+pop pointer 1
+push that 0
+push local 0
+sub
+push constant 0
+push local 1
+add
+pop pointer 1
+push that 0
+add
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 1
+push local 1
+add
+pop pointer 1
+push that 0
+push local 1
+push constant 2
+add
+eq
+if-goto IF_TRUE3
+goto IF_FALSE3
+label IF_TRUE3
+push constant 1
+push local 0
+add
+push local 0
+push constant 2
+add
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+goto IF_END3
+label IF_FALSE3
+push constant 1
+push local 0
+add
+push constant 1
+push local 1
+add
+pop pointer 1
+push that 0
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+label IF_END3
+label IF_END2
+goto WHILE_EXP0
+label WHILE_END0
+push local 0
+push argument 0
+add
+push constant 16379
+gt
+if-goto IF_TRUE4
+goto IF_FALSE4
+label IF_TRUE4
+push constant 6
+call Sys.error 1
+pop temp 0
+label IF_FALSE4
+push constant 0
+push local 0
+add
+pop pointer 1
+push that 0
+push argument 0
+push constant 2
+add
+gt
+if-goto IF_TRUE5
+goto IF_FALSE5
+label IF_TRUE5
+push argument 0
+push constant 2
+add
+push local 0
+add
+push constant 0
+push local 0
+add
+pop pointer 1
+push that 0
+push argument 0
+sub
+push constant 2
+sub
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 1
+push local 0
+add
+pop pointer 1
+push that 0
+push local 0
+push constant 2
+add
+eq
+if-goto IF_TRUE6
+goto IF_FALSE6
+label IF_TRUE6
+push argument 0
+push constant 3
+add
+push local 0
+add
+push local 0
+push argument 0
+add
+push constant 4
+add
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+goto IF_END6
+label IF_FALSE6
+push argument 0
+push constant 3
+add
+push local 0
+add
+push constant 1
+push local 0
+add
+pop pointer 1
+push that 0
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+label IF_END6
+push constant 1
+push local 0
+add
+push local 0
+push argument 0
+add
+push constant 2
+add
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+label IF_FALSE5
+push constant 0
+push local 0
+add
+push constant 0
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push local 0
+push constant 2
+add
+return
+function Memory.deAlloc 2
+push argument 0
+push constant 2
+sub
+pop local 0
+push constant 1
+push local 0
+add
+pop pointer 1
+push that 0
+pop local 1
+push constant 0
+push local 1
+add
+pop pointer 1
+push that 0
+push constant 0
+eq
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 0
+push local 0
+add
+push constant 1
+push local 0
+add
+pop pointer 1
+push that 0
+push local 0
+sub
+push constant 2
+sub
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+goto IF_END0
+label IF_FALSE0
+push constant 0
+push local 0
+add
+push constant 1
+push local 0
+add
+pop pointer 1
+push that 0
+push local 0
+sub
+push constant 0
+push local 1
+add
+pop pointer 1
+push that 0
+add
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 1
+push local 1
+add
+pop pointer 1
+push that 0
+push local 1
+push constant 2
+add
+eq
+if-goto IF_TRUE1
+goto IF_FALSE1
+label IF_TRUE1
+push constant 1
+push local 0
+add
+push local 0
+push constant 2
+add
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+goto IF_END1
+label IF_FALSE1
+push constant 1
+push local 0
+add
+push constant 1
+push local 1
+add
+pop pointer 1
+push that 0
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+label IF_END1
+label IF_END0
+push constant 0
+return
diff --git a/tools/OS/Output.vm b/tools/OS/Output.vm
new file mode 100644
index 0000000..b8addd7
--- /dev/null
+++ b/tools/OS/Output.vm
@@ -0,0 +1,1852 @@
+function Output.init 0
+push constant 16384
+pop static 4
+push constant 0
+not
+pop static 2
+push constant 32
+pop static 1
+push constant 0
+pop static 0
+push constant 6
+call String.new 1
+pop static 3
+call Output.initMap 0
+pop temp 0
+call Output.createShiftedMap 0
+pop temp 0
+push constant 0
+return
+function Output.initMap 0
+push constant 127
+call Array.new 1
+pop static 5
+push constant 0
+push constant 63
+push constant 63
+push constant 63
+push constant 63
+push constant 63
+push constant 63
+push constant 63
+push constant 63
+push constant 63
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 32
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 33
+push constant 12
+push constant 30
+push constant 30
+push constant 30
+push constant 12
+push constant 12
+push constant 0
+push constant 12
+push constant 12
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 34
+push constant 54
+push constant 54
+push constant 20
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 35
+push constant 0
+push constant 18
+push constant 18
+push constant 63
+push constant 18
+push constant 18
+push constant 63
+push constant 18
+push constant 18
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 36
+push constant 12
+push constant 30
+push constant 51
+push constant 3
+push constant 30
+push constant 48
+push constant 51
+push constant 30
+push constant 12
+push constant 12
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 37
+push constant 0
+push constant 0
+push constant 35
+push constant 51
+push constant 24
+push constant 12
+push constant 6
+push constant 51
+push constant 49
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 38
+push constant 12
+push constant 30
+push constant 30
+push constant 12
+push constant 54
+push constant 27
+push constant 27
+push constant 27
+push constant 54
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 39
+push constant 12
+push constant 12
+push constant 6
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 40
+push constant 24
+push constant 12
+push constant 6
+push constant 6
+push constant 6
+push constant 6
+push constant 6
+push constant 12
+push constant 24
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 41
+push constant 6
+push constant 12
+push constant 24
+push constant 24
+push constant 24
+push constant 24
+push constant 24
+push constant 12
+push constant 6
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 42
+push constant 0
+push constant 0
+push constant 0
+push constant 51
+push constant 30
+push constant 63
+push constant 30
+push constant 51
+push constant 0
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 43
+push constant 0
+push constant 0
+push constant 0
+push constant 12
+push constant 12
+push constant 63
+push constant 12
+push constant 12
+push constant 0
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 44
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 12
+push constant 12
+push constant 6
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 45
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 63
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 46
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 12
+push constant 12
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 47
+push constant 0
+push constant 0
+push constant 32
+push constant 48
+push constant 24
+push constant 12
+push constant 6
+push constant 3
+push constant 1
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 48
+push constant 12
+push constant 30
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 30
+push constant 12
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 49
+push constant 12
+push constant 14
+push constant 15
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 63
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 50
+push constant 30
+push constant 51
+push constant 48
+push constant 24
+push constant 12
+push constant 6
+push constant 3
+push constant 51
+push constant 63
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 51
+push constant 30
+push constant 51
+push constant 48
+push constant 48
+push constant 28
+push constant 48
+push constant 48
+push constant 51
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 52
+push constant 16
+push constant 24
+push constant 28
+push constant 26
+push constant 25
+push constant 63
+push constant 24
+push constant 24
+push constant 60
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 53
+push constant 63
+push constant 3
+push constant 3
+push constant 31
+push constant 48
+push constant 48
+push constant 48
+push constant 51
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 54
+push constant 28
+push constant 6
+push constant 3
+push constant 3
+push constant 31
+push constant 51
+push constant 51
+push constant 51
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 55
+push constant 63
+push constant 49
+push constant 48
+push constant 48
+push constant 24
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 56
+push constant 30
+push constant 51
+push constant 51
+push constant 51
+push constant 30
+push constant 51
+push constant 51
+push constant 51
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 57
+push constant 30
+push constant 51
+push constant 51
+push constant 51
+push constant 62
+push constant 48
+push constant 48
+push constant 24
+push constant 14
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 58
+push constant 0
+push constant 0
+push constant 12
+push constant 12
+push constant 0
+push constant 0
+push constant 12
+push constant 12
+push constant 0
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 59
+push constant 0
+push constant 0
+push constant 12
+push constant 12
+push constant 0
+push constant 0
+push constant 12
+push constant 12
+push constant 6
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 60
+push constant 0
+push constant 0
+push constant 24
+push constant 12
+push constant 6
+push constant 3
+push constant 6
+push constant 12
+push constant 24
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 61
+push constant 0
+push constant 0
+push constant 0
+push constant 63
+push constant 0
+push constant 0
+push constant 63
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 62
+push constant 0
+push constant 0
+push constant 3
+push constant 6
+push constant 12
+push constant 24
+push constant 12
+push constant 6
+push constant 3
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 64
+push constant 30
+push constant 51
+push constant 51
+push constant 59
+push constant 59
+push constant 59
+push constant 27
+push constant 3
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 63
+push constant 30
+push constant 51
+push constant 51
+push constant 24
+push constant 12
+push constant 12
+push constant 0
+push constant 12
+push constant 12
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 65
+push constant 12
+push constant 30
+push constant 51
+push constant 51
+push constant 63
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 66
+push constant 31
+push constant 51
+push constant 51
+push constant 51
+push constant 31
+push constant 51
+push constant 51
+push constant 51
+push constant 31
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 67
+push constant 28
+push constant 54
+push constant 35
+push constant 3
+push constant 3
+push constant 3
+push constant 35
+push constant 54
+push constant 28
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 68
+push constant 15
+push constant 27
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 27
+push constant 15
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 69
+push constant 63
+push constant 51
+push constant 35
+push constant 11
+push constant 15
+push constant 11
+push constant 35
+push constant 51
+push constant 63
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 70
+push constant 63
+push constant 51
+push constant 35
+push constant 11
+push constant 15
+push constant 11
+push constant 3
+push constant 3
+push constant 3
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 71
+push constant 28
+push constant 54
+push constant 35
+push constant 3
+push constant 59
+push constant 51
+push constant 51
+push constant 54
+push constant 44
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 72
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 63
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 73
+push constant 30
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 74
+push constant 60
+push constant 24
+push constant 24
+push constant 24
+push constant 24
+push constant 24
+push constant 27
+push constant 27
+push constant 14
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 75
+push constant 51
+push constant 51
+push constant 51
+push constant 27
+push constant 15
+push constant 27
+push constant 51
+push constant 51
+push constant 51
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 76
+push constant 3
+push constant 3
+push constant 3
+push constant 3
+push constant 3
+push constant 3
+push constant 35
+push constant 51
+push constant 63
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 77
+push constant 33
+push constant 51
+push constant 63
+push constant 63
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 78
+push constant 51
+push constant 51
+push constant 55
+push constant 55
+push constant 63
+push constant 59
+push constant 59
+push constant 51
+push constant 51
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 79
+push constant 30
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 80
+push constant 31
+push constant 51
+push constant 51
+push constant 51
+push constant 31
+push constant 3
+push constant 3
+push constant 3
+push constant 3
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 81
+push constant 30
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 63
+push constant 59
+push constant 30
+push constant 48
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 82
+push constant 31
+push constant 51
+push constant 51
+push constant 51
+push constant 31
+push constant 27
+push constant 51
+push constant 51
+push constant 51
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 83
+push constant 30
+push constant 51
+push constant 51
+push constant 6
+push constant 28
+push constant 48
+push constant 51
+push constant 51
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 84
+push constant 63
+push constant 63
+push constant 45
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 85
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 86
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 30
+push constant 30
+push constant 12
+push constant 12
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 87
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 63
+push constant 63
+push constant 63
+push constant 18
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 88
+push constant 51
+push constant 51
+push constant 30
+push constant 30
+push constant 12
+push constant 30
+push constant 30
+push constant 51
+push constant 51
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 89
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 30
+push constant 12
+push constant 12
+push constant 12
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 90
+push constant 63
+push constant 51
+push constant 49
+push constant 24
+push constant 12
+push constant 6
+push constant 35
+push constant 51
+push constant 63
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 91
+push constant 30
+push constant 6
+push constant 6
+push constant 6
+push constant 6
+push constant 6
+push constant 6
+push constant 6
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 92
+push constant 0
+push constant 0
+push constant 1
+push constant 3
+push constant 6
+push constant 12
+push constant 24
+push constant 48
+push constant 32
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 93
+push constant 30
+push constant 24
+push constant 24
+push constant 24
+push constant 24
+push constant 24
+push constant 24
+push constant 24
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 94
+push constant 8
+push constant 28
+push constant 54
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 95
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 63
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 96
+push constant 6
+push constant 12
+push constant 24
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 97
+push constant 0
+push constant 0
+push constant 0
+push constant 14
+push constant 24
+push constant 30
+push constant 27
+push constant 27
+push constant 54
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 98
+push constant 3
+push constant 3
+push constant 3
+push constant 15
+push constant 27
+push constant 51
+push constant 51
+push constant 51
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 99
+push constant 0
+push constant 0
+push constant 0
+push constant 30
+push constant 51
+push constant 3
+push constant 3
+push constant 51
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 100
+push constant 48
+push constant 48
+push constant 48
+push constant 60
+push constant 54
+push constant 51
+push constant 51
+push constant 51
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 101
+push constant 0
+push constant 0
+push constant 0
+push constant 30
+push constant 51
+push constant 63
+push constant 3
+push constant 51
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 102
+push constant 28
+push constant 54
+push constant 38
+push constant 6
+push constant 15
+push constant 6
+push constant 6
+push constant 6
+push constant 15
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 103
+push constant 0
+push constant 0
+push constant 30
+push constant 51
+push constant 51
+push constant 51
+push constant 62
+push constant 48
+push constant 51
+push constant 30
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 104
+push constant 3
+push constant 3
+push constant 3
+push constant 27
+push constant 55
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 105
+push constant 12
+push constant 12
+push constant 0
+push constant 14
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 106
+push constant 48
+push constant 48
+push constant 0
+push constant 56
+push constant 48
+push constant 48
+push constant 48
+push constant 48
+push constant 51
+push constant 30
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 107
+push constant 3
+push constant 3
+push constant 3
+push constant 51
+push constant 27
+push constant 15
+push constant 15
+push constant 27
+push constant 51
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 108
+push constant 14
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 109
+push constant 0
+push constant 0
+push constant 0
+push constant 29
+push constant 63
+push constant 43
+push constant 43
+push constant 43
+push constant 43
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 110
+push constant 0
+push constant 0
+push constant 0
+push constant 29
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 111
+push constant 0
+push constant 0
+push constant 0
+push constant 30
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 112
+push constant 0
+push constant 0
+push constant 0
+push constant 30
+push constant 51
+push constant 51
+push constant 51
+push constant 31
+push constant 3
+push constant 3
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 113
+push constant 0
+push constant 0
+push constant 0
+push constant 30
+push constant 51
+push constant 51
+push constant 51
+push constant 62
+push constant 48
+push constant 48
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 114
+push constant 0
+push constant 0
+push constant 0
+push constant 29
+push constant 55
+push constant 51
+push constant 3
+push constant 3
+push constant 7
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 115
+push constant 0
+push constant 0
+push constant 0
+push constant 30
+push constant 51
+push constant 6
+push constant 24
+push constant 51
+push constant 30
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 116
+push constant 4
+push constant 6
+push constant 6
+push constant 15
+push constant 6
+push constant 6
+push constant 6
+push constant 54
+push constant 28
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 117
+push constant 0
+push constant 0
+push constant 0
+push constant 27
+push constant 27
+push constant 27
+push constant 27
+push constant 27
+push constant 54
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 118
+push constant 0
+push constant 0
+push constant 0
+push constant 51
+push constant 51
+push constant 51
+push constant 51
+push constant 30
+push constant 12
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 119
+push constant 0
+push constant 0
+push constant 0
+push constant 51
+push constant 51
+push constant 51
+push constant 63
+push constant 63
+push constant 18
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 120
+push constant 0
+push constant 0
+push constant 0
+push constant 51
+push constant 30
+push constant 12
+push constant 12
+push constant 30
+push constant 51
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 121
+push constant 0
+push constant 0
+push constant 0
+push constant 51
+push constant 51
+push constant 51
+push constant 62
+push constant 48
+push constant 24
+push constant 15
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 122
+push constant 0
+push constant 0
+push constant 0
+push constant 63
+push constant 27
+push constant 12
+push constant 6
+push constant 51
+push constant 63
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 123
+push constant 56
+push constant 12
+push constant 12
+push constant 12
+push constant 7
+push constant 12
+push constant 12
+push constant 12
+push constant 56
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 124
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 12
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 125
+push constant 7
+push constant 12
+push constant 12
+push constant 12
+push constant 56
+push constant 12
+push constant 12
+push constant 12
+push constant 7
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 126
+push constant 38
+push constant 45
+push constant 25
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+push constant 0
+call Output.create 12
+pop temp 0
+push constant 0
+return
+function Output.create 1
+push constant 11
+call Array.new 1
+pop local 0
+push argument 0
+push static 5
+add
+push local 0
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 0
+push local 0
+add
+push argument 1
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 1
+push local 0
+add
+push argument 2
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 2
+push local 0
+add
+push argument 3
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 3
+push local 0
+add
+push argument 4
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 4
+push local 0
+add
+push argument 5
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 5
+push local 0
+add
+push argument 6
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 6
+push local 0
+add
+push argument 7
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 7
+push local 0
+add
+push argument 8
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 8
+push local 0
+add
+push argument 9
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 9
+push local 0
+add
+push argument 10
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 10
+push local 0
+add
+push argument 11
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 0
+return
+function Output.createShiftedMap 4
+push constant 127
+call Array.new 1
+pop static 6
+push constant 0
+pop local 2
+label WHILE_EXP0
+push local 2
+push constant 127
+lt
+not
+if-goto WHILE_END0
+push local 2
+push static 5
+add
+pop pointer 1
+push that 0
+pop local 0
+push constant 11
+call Array.new 1
+pop local 1
+push local 2
+push static 6
+add
+push local 1
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 0
+pop local 3
+label WHILE_EXP1
+push local 3
+push constant 11
+lt
+not
+if-goto WHILE_END1
+push local 3
+push local 1
+add
+push local 3
+push local 0
+add
+pop pointer 1
+push that 0
+push constant 256
+call Math.multiply 2
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push local 3
+push constant 1
+add
+pop local 3
+goto WHILE_EXP1
+label WHILE_END1
+push local 2
+push constant 0
+eq
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 32
+pop local 2
+goto IF_END0
+label IF_FALSE0
+push local 2
+push constant 1
+add
+pop local 2
+label IF_END0
+goto WHILE_EXP0
+label WHILE_END0
+push constant 0
+return
+function Output.getMap 1
+push argument 0
+push constant 32
+lt
+push argument 0
+push constant 126
+gt
+or
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 0
+pop argument 0
+label IF_FALSE0
+push static 2
+if-goto IF_TRUE1
+goto IF_FALSE1
+label IF_TRUE1
+push argument 0
+push static 5
+add
+pop pointer 1
+push that 0
+pop local 0
+goto IF_END1
+label IF_FALSE1
+push argument 0
+push static 6
+add
+pop pointer 1
+push that 0
+pop local 0
+label IF_END1
+push local 0
+return
+function Output.drawChar 4
+push argument 0
+call Output.getMap 1
+pop local 2
+push static 1
+pop local 0
+label WHILE_EXP0
+push local 1
+push constant 11
+lt
+not
+if-goto WHILE_END0
+push static 2
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push local 0
+push static 4
+add
+pop pointer 1
+push that 0
+push constant 256
+neg
+and
+pop local 3
+goto IF_END0
+label IF_FALSE0
+push local 0
+push static 4
+add
+pop pointer 1
+push that 0
+push constant 255
+and
+pop local 3
+label IF_END0
+push local 0
+push static 4
+add
+push local 1
+push local 2
+add
+pop pointer 1
+push that 0
+push local 3
+or
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push local 0
+push constant 32
+add
+pop local 0
+push local 1
+push constant 1
+add
+pop local 1
+goto WHILE_EXP0
+label WHILE_END0
+push constant 0
+return
+function Output.moveCursor 0
+push argument 0
+push constant 0
+lt
+push argument 0
+push constant 22
+gt
+or
+push argument 1
+push constant 0
+lt
+or
+push argument 1
+push constant 63
+gt
+or
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 20
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+push argument 1
+push constant 2
+call Math.divide 2
+pop static 0
+push constant 32
+push argument 0
+push constant 352
+call Math.multiply 2
+add
+push static 0
+add
+pop static 1
+push argument 1
+push static 0
+push constant 2
+call Math.multiply 2
+eq
+pop static 2
+push constant 32
+call Output.drawChar 1
+pop temp 0
+push constant 0
+return
+function Output.printChar 0
+push argument 0
+call String.newLine 0
+eq
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+call Output.println 0
+pop temp 0
+goto IF_END0
+label IF_FALSE0
+push argument 0
+call String.backSpace 0
+eq
+if-goto IF_TRUE1
+goto IF_FALSE1
+label IF_TRUE1
+call Output.backSpace 0
+pop temp 0
+goto IF_END1
+label IF_FALSE1
+push argument 0
+call Output.drawChar 1
+pop temp 0
+push static 2
+not
+if-goto IF_TRUE2
+goto IF_FALSE2
+label IF_TRUE2
+push static 0
+push constant 1
+add
+pop static 0
+push static 1
+push constant 1
+add
+pop static 1
+label IF_FALSE2
+push static 0
+push constant 32
+eq
+if-goto IF_TRUE3
+goto IF_FALSE3
+label IF_TRUE3
+call Output.println 0
+pop temp 0
+goto IF_END3
+label IF_FALSE3
+push static 2
+not
+pop static 2
+label IF_END3
+label IF_END1
+label IF_END0
+push constant 0
+return
+function Output.printString 2
+push argument 0
+call String.length 1
+pop local 1
+label WHILE_EXP0
+push local 0
+push local 1
+lt
+not
+if-goto WHILE_END0
+push argument 0
+push local 0
+call String.charAt 2
+call Output.printChar 1
+pop temp 0
+push local 0
+push constant 1
+add
+pop local 0
+goto WHILE_EXP0
+label WHILE_END0
+push constant 0
+return
+function Output.printInt 0
+push static 3
+push argument 0
+call String.setInt 2
+pop temp 0
+push static 3
+call Output.printString 1
+pop temp 0
+push constant 0
+return
+function Output.println 0
+push static 1
+push constant 352
+add
+push static 0
+sub
+pop static 1
+push constant 0
+pop static 0
+push constant 0
+not
+pop static 2
+push static 1
+push constant 8128
+eq
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 32
+pop static 1
+label IF_FALSE0
+push constant 0
+return
+function Output.backSpace 0
+push static 2
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push static 0
+push constant 0
+gt
+if-goto IF_TRUE1
+goto IF_FALSE1
+label IF_TRUE1
+push static 0
+push constant 1
+sub
+pop static 0
+push static 1
+push constant 1
+sub
+pop static 1
+goto IF_END1
+label IF_FALSE1
+push constant 31
+pop static 0
+push static 1
+push constant 32
+eq
+if-goto IF_TRUE2
+goto IF_FALSE2
+label IF_TRUE2
+push constant 8128
+pop static 1
+label IF_FALSE2
+push static 1
+push constant 321
+sub
+pop static 1
+label IF_END1
+push constant 0
+pop static 2
+goto IF_END0
+label IF_FALSE0
+push constant 0
+not
+pop static 2
+label IF_END0
+push constant 32
+call Output.drawChar 1
+pop temp 0
+push constant 0
+return
diff --git a/tools/OS/Screen.vm b/tools/OS/Screen.vm
new file mode 100644
index 0000000..fccafb5
--- /dev/null
+++ b/tools/OS/Screen.vm
@@ -0,0 +1,806 @@
+function Screen.init 1
+push constant 16384
+pop static 1
+push constant 0
+not
+pop static 2
+push constant 17
+call Array.new 1
+pop static 0
+push constant 0
+push static 0
+add
+push constant 1
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+label WHILE_EXP0
+push local 0
+push constant 16
+lt
+not
+if-goto WHILE_END0
+push local 0
+push constant 1
+add
+pop local 0
+push local 0
+push static 0
+add
+push local 0
+push constant 1
+sub
+push static 0
+add
+pop pointer 1
+push that 0
+push local 0
+push constant 1
+sub
+push static 0
+add
+pop pointer 1
+push that 0
+add
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+goto WHILE_EXP0
+label WHILE_END0
+push constant 0
+return
+function Screen.clearScreen 1
+label WHILE_EXP0
+push local 0
+push constant 8192
+lt
+not
+if-goto WHILE_END0
+push local 0
+push static 1
+add
+push constant 0
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push local 0
+push constant 1
+add
+pop local 0
+goto WHILE_EXP0
+label WHILE_END0
+push constant 0
+return
+function Screen.updateLocation 0
+push static 2
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push argument 0
+push static 1
+add
+push argument 0
+push static 1
+add
+pop pointer 1
+push that 0
+push argument 1
+or
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+goto IF_END0
+label IF_FALSE0
+push argument 0
+push static 1
+add
+push argument 0
+push static 1
+add
+pop pointer 1
+push that 0
+push argument 1
+not
+and
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+label IF_END0
+push constant 0
+return
+function Screen.setColor 0
+push argument 0
+pop static 2
+push constant 0
+return
+function Screen.drawPixel 3
+push argument 0
+push constant 0
+lt
+push argument 0
+push constant 511
+gt
+or
+push argument 1
+push constant 0
+lt
+or
+push argument 1
+push constant 255
+gt
+or
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 7
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+push argument 0
+push constant 16
+call Math.divide 2
+pop local 0
+push argument 0
+push local 0
+push constant 16
+call Math.multiply 2
+sub
+pop local 1
+push argument 1
+push constant 32
+call Math.multiply 2
+push local 0
+add
+pop local 2
+push local 2
+push local 1
+push static 0
+add
+pop pointer 1
+push that 0
+call Screen.updateLocation 2
+pop temp 0
+push constant 0
+return
+function Screen.drawConditional 0
+push argument 2
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push argument 1
+push argument 0
+call Screen.drawPixel 2
+pop temp 0
+goto IF_END0
+label IF_FALSE0
+push argument 0
+push argument 1
+call Screen.drawPixel 2
+pop temp 0
+label IF_END0
+push constant 0
+return
+function Screen.drawLine 11
+push argument 0
+push constant 0
+lt
+push argument 2
+push constant 511
+gt
+or
+push argument 1
+push constant 0
+lt
+or
+push argument 3
+push constant 255
+gt
+or
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 8
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+push argument 2
+push argument 0
+sub
+call Math.abs 1
+pop local 3
+push argument 3
+push argument 1
+sub
+call Math.abs 1
+pop local 2
+push local 3
+push local 2
+lt
+pop local 6
+push local 6
+push argument 3
+push argument 1
+lt
+and
+push local 6
+not
+push argument 2
+push argument 0
+lt
+and
+or
+if-goto IF_TRUE1
+goto IF_FALSE1
+label IF_TRUE1
+push argument 0
+pop local 4
+push argument 2
+pop argument 0
+push local 4
+pop argument 2
+push argument 1
+pop local 4
+push argument 3
+pop argument 1
+push local 4
+pop argument 3
+label IF_FALSE1
+push local 6
+if-goto IF_TRUE2
+goto IF_FALSE2
+label IF_TRUE2
+push local 3
+pop local 4
+push local 2
+pop local 3
+push local 4
+pop local 2
+push argument 1
+pop local 1
+push argument 0
+pop local 0
+push argument 3
+pop local 8
+push argument 0
+push argument 2
+gt
+pop local 7
+goto IF_END2
+label IF_FALSE2
+push argument 0
+pop local 1
+push argument 1
+pop local 0
+push argument 2
+pop local 8
+push argument 1
+push argument 3
+gt
+pop local 7
+label IF_END2
+push constant 2
+push local 2
+call Math.multiply 2
+push local 3
+sub
+pop local 5
+push constant 2
+push local 2
+call Math.multiply 2
+pop local 9
+push constant 2
+push local 2
+push local 3
+sub
+call Math.multiply 2
+pop local 10
+push local 1
+push local 0
+push local 6
+call Screen.drawConditional 3
+pop temp 0
+label WHILE_EXP0
+push local 1
+push local 8
+lt
+not
+if-goto WHILE_END0
+push local 5
+push constant 0
+lt
+if-goto IF_TRUE3
+goto IF_FALSE3
+label IF_TRUE3
+push local 5
+push local 9
+add
+pop local 5
+goto IF_END3
+label IF_FALSE3
+push local 5
+push local 10
+add
+pop local 5
+push local 7
+if-goto IF_TRUE4
+goto IF_FALSE4
+label IF_TRUE4
+push local 0
+push constant 1
+sub
+pop local 0
+goto IF_END4
+label IF_FALSE4
+push local 0
+push constant 1
+add
+pop local 0
+label IF_END4
+label IF_END3
+push local 1
+push constant 1
+add
+pop local 1
+push local 1
+push local 0
+push local 6
+call Screen.drawConditional 3
+pop temp 0
+goto WHILE_EXP0
+label WHILE_END0
+push constant 0
+return
+function Screen.drawRectangle 9
+push argument 0
+push argument 2
+gt
+push argument 1
+push argument 3
+gt
+or
+push argument 0
+push constant 0
+lt
+or
+push argument 2
+push constant 511
+gt
+or
+push argument 1
+push constant 0
+lt
+or
+push argument 3
+push constant 255
+gt
+or
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 9
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+push argument 0
+push constant 16
+call Math.divide 2
+pop local 3
+push argument 0
+push local 3
+push constant 16
+call Math.multiply 2
+sub
+pop local 7
+push argument 2
+push constant 16
+call Math.divide 2
+pop local 4
+push argument 2
+push local 4
+push constant 16
+call Math.multiply 2
+sub
+pop local 8
+push local 7
+push static 0
+add
+pop pointer 1
+push that 0
+push constant 1
+sub
+not
+pop local 6
+push local 8
+push constant 1
+add
+push static 0
+add
+pop pointer 1
+push that 0
+push constant 1
+sub
+pop local 5
+push argument 1
+push constant 32
+call Math.multiply 2
+push local 3
+add
+pop local 0
+push local 4
+push local 3
+sub
+pop local 2
+label WHILE_EXP0
+push argument 1
+push argument 3
+gt
+not
+not
+if-goto WHILE_END0
+push local 0
+push local 2
+add
+pop local 1
+push local 2
+push constant 0
+eq
+if-goto IF_TRUE1
+goto IF_FALSE1
+label IF_TRUE1
+push local 0
+push local 5
+push local 6
+and
+call Screen.updateLocation 2
+pop temp 0
+goto IF_END1
+label IF_FALSE1
+push local 0
+push local 6
+call Screen.updateLocation 2
+pop temp 0
+push local 0
+push constant 1
+add
+pop local 0
+label WHILE_EXP1
+push local 0
+push local 1
+lt
+not
+if-goto WHILE_END1
+push local 0
+push constant 1
+neg
+call Screen.updateLocation 2
+pop temp 0
+push local 0
+push constant 1
+add
+pop local 0
+goto WHILE_EXP1
+label WHILE_END1
+push local 1
+push local 5
+call Screen.updateLocation 2
+pop temp 0
+label IF_END1
+push argument 1
+push constant 1
+add
+pop argument 1
+push local 1
+push constant 32
+add
+push local 2
+sub
+pop local 0
+goto WHILE_EXP0
+label WHILE_END0
+push constant 0
+return
+function Screen.drawHorizontal 11
+push argument 1
+push argument 2
+call Math.min 2
+pop local 7
+push argument 1
+push argument 2
+call Math.max 2
+pop local 8
+push argument 0
+push constant 1
+neg
+gt
+push argument 0
+push constant 256
+lt
+and
+push local 7
+push constant 512
+lt
+and
+push local 8
+push constant 1
+neg
+gt
+and
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push local 7
+push constant 0
+call Math.max 2
+pop local 7
+push local 8
+push constant 511
+call Math.min 2
+pop local 8
+push local 7
+push constant 16
+call Math.divide 2
+pop local 1
+push local 7
+push local 1
+push constant 16
+call Math.multiply 2
+sub
+pop local 9
+push local 8
+push constant 16
+call Math.divide 2
+pop local 2
+push local 8
+push local 2
+push constant 16
+call Math.multiply 2
+sub
+pop local 10
+push local 9
+push static 0
+add
+pop pointer 1
+push that 0
+push constant 1
+sub
+not
+pop local 5
+push local 10
+push constant 1
+add
+push static 0
+add
+pop pointer 1
+push that 0
+push constant 1
+sub
+pop local 4
+push argument 0
+push constant 32
+call Math.multiply 2
+push local 1
+add
+pop local 0
+push local 2
+push local 1
+sub
+pop local 6
+push local 0
+push local 6
+add
+pop local 3
+push local 6
+push constant 0
+eq
+if-goto IF_TRUE1
+goto IF_FALSE1
+label IF_TRUE1
+push local 0
+push local 4
+push local 5
+and
+call Screen.updateLocation 2
+pop temp 0
+goto IF_END1
+label IF_FALSE1
+push local 0
+push local 5
+call Screen.updateLocation 2
+pop temp 0
+push local 0
+push constant 1
+add
+pop local 0
+label WHILE_EXP0
+push local 0
+push local 3
+lt
+not
+if-goto WHILE_END0
+push local 0
+push constant 1
+neg
+call Screen.updateLocation 2
+pop temp 0
+push local 0
+push constant 1
+add
+pop local 0
+goto WHILE_EXP0
+label WHILE_END0
+push local 3
+push local 4
+call Screen.updateLocation 2
+pop temp 0
+label IF_END1
+label IF_FALSE0
+push constant 0
+return
+function Screen.drawSymetric 0
+push argument 1
+push argument 3
+sub
+push argument 0
+push argument 2
+add
+push argument 0
+push argument 2
+sub
+call Screen.drawHorizontal 3
+pop temp 0
+push argument 1
+push argument 3
+add
+push argument 0
+push argument 2
+add
+push argument 0
+push argument 2
+sub
+call Screen.drawHorizontal 3
+pop temp 0
+push argument 1
+push argument 2
+sub
+push argument 0
+push argument 3
+sub
+push argument 0
+push argument 3
+add
+call Screen.drawHorizontal 3
+pop temp 0
+push argument 1
+push argument 2
+add
+push argument 0
+push argument 3
+sub
+push argument 0
+push argument 3
+add
+call Screen.drawHorizontal 3
+pop temp 0
+push constant 0
+return
+function Screen.drawCircle 3
+push argument 0
+push constant 0
+lt
+push argument 0
+push constant 511
+gt
+or
+push argument 1
+push constant 0
+lt
+or
+push argument 1
+push constant 255
+gt
+or
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 12
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+push argument 0
+push argument 2
+sub
+push constant 0
+lt
+push argument 0
+push argument 2
+add
+push constant 511
+gt
+or
+push argument 1
+push argument 2
+sub
+push constant 0
+lt
+or
+push argument 1
+push argument 2
+add
+push constant 255
+gt
+or
+if-goto IF_TRUE1
+goto IF_FALSE1
+label IF_TRUE1
+push constant 13
+call Sys.error 1
+pop temp 0
+label IF_FALSE1
+push argument 2
+pop local 1
+push constant 1
+push argument 2
+sub
+pop local 2
+push argument 0
+push argument 1
+push local 0
+push local 1
+call Screen.drawSymetric 4
+pop temp 0
+label WHILE_EXP0
+push local 1
+push local 0
+gt
+not
+if-goto WHILE_END0
+push local 2
+push constant 0
+lt
+if-goto IF_TRUE2
+goto IF_FALSE2
+label IF_TRUE2
+push local 2
+push constant 2
+push local 0
+call Math.multiply 2
+add
+push constant 3
+add
+pop local 2
+goto IF_END2
+label IF_FALSE2
+push local 2
+push constant 2
+push local 0
+push local 1
+sub
+call Math.multiply 2
+add
+push constant 5
+add
+pop local 2
+push local 1
+push constant 1
+sub
+pop local 1
+label IF_END2
+push local 0
+push constant 1
+add
+pop local 0
+push argument 0
+push argument 1
+push local 0
+push local 1
+call Screen.drawSymetric 4
+pop temp 0
+goto WHILE_EXP0
+label WHILE_END0
+push constant 0
+return
diff --git a/tools/OS/String.vm b/tools/OS/String.vm
new file mode 100644
index 0000000..9b7577e
--- /dev/null
+++ b/tools/OS/String.vm
@@ -0,0 +1,393 @@
+function String.new 0
+push constant 3
+call Memory.alloc 1
+pop pointer 0
+push argument 0
+push constant 0
+lt
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 14
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+push argument 0
+push constant 0
+gt
+if-goto IF_TRUE1
+goto IF_FALSE1
+label IF_TRUE1
+push argument 0
+call Array.new 1
+pop this 1
+label IF_FALSE1
+push argument 0
+pop this 0
+push constant 0
+pop this 2
+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 1
+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 2
+return
+function String.charAt 0
+push argument 0
+pop pointer 0
+push argument 1
+push constant 0
+lt
+push argument 1
+push this 2
+gt
+or
+push argument 1
+push this 2
+eq
+or
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 15
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+push argument 1
+push this 1
+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 this 2
+gt
+or
+push argument 1
+push this 2
+eq
+or
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 16
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+push argument 1
+push this 1
+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 2
+push this 0
+eq
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 17
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+push this 2
+push this 1
+add
+push argument 1
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push this 2
+push constant 1
+add
+pop this 2
+push pointer 0
+return
+function String.eraseLastChar 0
+push argument 0
+pop pointer 0
+push this 2
+push constant 0
+eq
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 18
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+push this 2
+push constant 1
+sub
+pop this 2
+push constant 0
+return
+function String.intValue 5
+push argument 0
+pop pointer 0
+push this 2
+push constant 0
+eq
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 0
+return
+label IF_FALSE0
+push constant 0
+not
+pop local 3
+push constant 0
+push this 1
+add
+pop pointer 1
+push that 0
+push constant 45
+eq
+if-goto IF_TRUE1
+goto IF_FALSE1
+label IF_TRUE1
+push constant 0
+not
+pop local 4
+push constant 1
+pop local 0
+label IF_FALSE1
+label WHILE_EXP0
+push local 0
+push this 2
+lt
+push local 3
+and
+not
+if-goto WHILE_END0
+push local 0
+push this 1
+add
+pop pointer 1
+push that 0
+push constant 48
+sub
+pop local 2
+push local 2
+push constant 0
+lt
+push local 2
+push constant 9
+gt
+or
+not
+pop local 3
+push local 3
+if-goto IF_TRUE2
+goto IF_FALSE2
+label IF_TRUE2
+push local 1
+push constant 10
+call Math.multiply 2
+push local 2
+add
+pop local 1
+push local 0
+push constant 1
+add
+pop local 0
+label IF_FALSE2
+goto WHILE_EXP0
+label WHILE_END0
+push local 4
+if-goto IF_TRUE3
+goto IF_FALSE3
+label IF_TRUE3
+push local 1
+neg
+pop local 1
+label IF_FALSE3
+push local 1
+return
+function String.setInt 4
+push argument 0
+pop pointer 0
+push this 0
+push constant 0
+eq
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 19
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+push constant 6
+call Array.new 1
+pop local 2
+push argument 1
+push constant 0
+lt
+if-goto IF_TRUE1
+goto IF_FALSE1
+label IF_TRUE1
+push constant 0
+not
+pop local 3
+push argument 1
+neg
+pop argument 1
+label IF_FALSE1
+push argument 1
+pop local 1
+label WHILE_EXP0
+push local 1
+push constant 0
+gt
+not
+if-goto WHILE_END0
+push argument 1
+push constant 10
+call Math.divide 2
+pop local 1
+push local 0
+push local 2
+add
+push constant 48
+push argument 1
+push local 1
+push constant 10
+call Math.multiply 2
+sub
+add
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push local 0
+push constant 1
+add
+pop local 0
+push local 1
+pop argument 1
+goto WHILE_EXP0
+label WHILE_END0
+push local 3
+if-goto IF_TRUE2
+goto IF_FALSE2
+label IF_TRUE2
+push local 0
+push local 2
+add
+push constant 45
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push local 0
+push constant 1
+add
+pop local 0
+label IF_FALSE2
+push this 0
+push local 0
+lt
+if-goto IF_TRUE3
+goto IF_FALSE3
+label IF_TRUE3
+push constant 19
+call Sys.error 1
+pop temp 0
+label IF_FALSE3
+push local 0
+push constant 0
+eq
+if-goto IF_TRUE4
+goto IF_FALSE4
+label IF_TRUE4
+push constant 0
+push this 1
+add
+push constant 48
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push constant 1
+pop this 2
+goto IF_END4
+label IF_FALSE4
+push constant 0
+pop this 2
+label WHILE_EXP1
+push this 2
+push local 0
+lt
+not
+if-goto WHILE_END1
+push this 2
+push this 1
+add
+push local 0
+push this 2
+push constant 1
+add
+sub
+push local 2
+add
+pop pointer 1
+push that 0
+pop temp 0
+pop pointer 1
+push temp 0
+pop that 0
+push this 2
+push constant 1
+add
+pop this 2
+goto WHILE_EXP1
+label WHILE_END1
+label IF_END4
+push local 2
+call Array.dispose 1
+pop temp 0
+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/tools/OS/Sys.vm b/tools/OS/Sys.vm
new file mode 100644
index 0000000..c186dad
--- /dev/null
+++ b/tools/OS/Sys.vm
@@ -0,0 +1,83 @@
+function Sys.init 0
+call Memory.init 0
+pop temp 0
+call Math.init 0
+pop temp 0
+call Screen.init 0
+pop temp 0
+call Output.init 0
+pop temp 0
+call Keyboard.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 1
+push argument 0
+push constant 0
+lt
+if-goto IF_TRUE0
+goto IF_FALSE0
+label IF_TRUE0
+push constant 1
+call Sys.error 1
+pop temp 0
+label IF_FALSE0
+label WHILE_EXP0
+push argument 0
+push constant 0
+gt
+not
+if-goto WHILE_END0
+push constant 50
+pop local 0
+label WHILE_EXP1
+push local 0
+push constant 0
+gt
+not
+if-goto WHILE_END1
+push local 0
+push constant 1
+sub
+pop local 0
+goto WHILE_EXP1
+label WHILE_END1
+push argument 0
+push constant 1
+sub
+pop argument 0
+goto WHILE_EXP0
+label WHILE_END0
+push constant 0
+return
+function Sys.error 0
+push constant 69
+call Output.printChar 1
+pop temp 0
+push constant 82
+call Output.printChar 1
+pop temp 0
+push constant 82
+call Output.printChar 1
+pop temp 0
+push argument 0
+call Output.printInt 1
+pop temp 0
+call Sys.halt 0
+pop temp 0
+push constant 0
+return
diff --git a/tools/TextComparer.bat b/tools/TextComparer.bat
new file mode 100644
index 0000000..a036d00
--- /dev/null
+++ b/tools/TextComparer.bat
@@ -0,0 +1,29 @@
+@echo off
+
+rem $Id: TextComparer.bat,v 1.2 2014/05/10 00:52:43 marka Exp $
+rem mark.armbrust@pobox.com
+
+setlocal
+if not "%3"=="" goto :USAGE
+if "%1"=="/?" goto :USAGE
+if not "%~1"=="" (
+ set "_arg1=%~f1"
+)
+if not "%~2"=="" (
+ set "_arg2=%~f2"
+)
+pushd "%~dp0"
+if NOT "%~1"=="" (
+ if NOT "%~2"=="" (
+ java -classpath "%CLASSPATH%;bin/classes" TextComparer ^
+ "%_arg1%" "%_arg2%"
+ popd
+ exit /B
+ )
+)
+:USAGE
+echo Usage:
+echo TextComparer FILE1 FILE2 Compares FILE1 and FILE2. The success
+echo message or the first miscompared line
+echo is printed to the command console.
+popd
diff --git a/tools/TextComparer.sh b/tools/TextComparer.sh
new file mode 100755
index 0000000..c8b08af
--- /dev/null
+++ b/tools/TextComparer.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env sh
+
+# $Id: TextComparer.sh,v 1.1 2014/06/17 21:14:01 marka Exp $
+# mark.armbrust@pobox.com
+
+# User's CDPATH can interfere with cd in this script
+unset CDPATH
+# Get the true name of this script
+script="`test -L "$0" && readlink -n "$0" || echo "$0"`"
+dir="$PWD"
+cd "`dirname "$script"`"
+if [ \( $# -ne 2 \) -o \( "$1" = "-h" \) -o \( "$1" = "--help" \) ]
+then
+ # print usage
+ echo "Usage:"
+ echo " `basename "$0"` FILE1 FILE2 Compares FILE1 and FILE2. The success"
+ echo " message or the first miscompared line"
+ echo " is printed to the command console."
+else
+ # Convert arg1 to an absolute path
+ if [ `echo "$1" | sed -e "s/\(.\).*/\1/"` = / ]
+ then
+ arg1="$1"
+ else
+ arg1="$dir/$1"
+ fi
+ # Convert arg2 to an absolute path
+ if [ `echo "$2" | sed -e "s/\(.\).*/\1/"` = / ]
+ then
+ arg2="$2"
+ else
+ arg2="$dir/$2"
+ fi
+# echo Comparing "$arg1" "$arg2"
+ java -classpath "${CLASSPATH}:bin/classes" TextComparer "$arg1" "$arg2"
+fi
diff --git a/tools/VMEmulator.bat b/tools/VMEmulator.bat
new file mode 100644
index 0000000..1b15b72
--- /dev/null
+++ b/tools/VMEmulator.bat
@@ -0,0 +1,29 @@
+@echo off
+
+rem $Id: VMEmulator.bat,v 1.3 2014/05/10 00:51:55 marka Exp $
+rem mark.armbrust@pobox.com
+
+setlocal
+if not "%2"=="" goto :USAGE
+if "%~1"=="/?" (
+:USAGE
+ echo Usage:
+ echo VMEmulator Starts the VM Emulator in interactive mode.
+ echo VMEmulator FILE.tst Starts the VM Emulator and runs the FILE.tst test
+ echo script. The success/failure message is
+ echo printed to the command console.
+ exit -b
+)
+if not "%~1"=="" (
+ set "_arg1=%~f1"
+)
+pushd "%~dp0"
+if "%~1"=="" (
+ start javaw -classpath "%CLASSPATH%;.;bin/classes;bin/lib/Hack.jar;bin/lib/HackGUI.jar;bin/lib/Simulators.jar;bin/lib/SimulatorsGUI.jar;bin/lib/Compilers.jar" ^
+ VMEmulatorMain
+) else (
+rem echo Running "%_arg1%"
+ java -classpath "%CLASSPATH%;.;bin/classes;bin/lib/Hack.jar;bin/lib/HackGUI.jar;bin/lib/Simulators.jar;bin/lib/SimulatorsGUI.jar;bin/lib/Compilers.jar" ^
+ VMEmulatorMain "%_arg1%"
+)
+popd
diff --git a/tools/VMEmulator.sh b/tools/VMEmulator.sh
new file mode 100755
index 0000000..48f4f0f
--- /dev/null
+++ b/tools/VMEmulator.sh
@@ -0,0 +1,33 @@
+#!/usr/bin/env sh
+
+# $Id: VMEmulator.sh,v 1.1 2014/06/17 21:14:01 marka Exp $
+# mark.armbrust@pobox.com
+
+# User's CDPATH can interfere with cd in this script
+unset CDPATH
+# Get the true name of this script
+script="`test -L "$0" && readlink -n "$0" || echo "$0"`"
+dir="$PWD"
+cd "`dirname "$script"`"
+if [ \( $# -gt 1 \) -o \( "$1" = "-h" \) -o \( "$1" = "--help" \) ]
+then
+ echo "Usage:"
+ echo " `basename "$0"` Starts the VM Emulator in interactive mode."
+ echo " `basename "$0"` FILE.tst Starts the VM Emulator and runs the FILE.tst test"
+ echo " script. The success/failure message is"
+ echo " printed to the command console."
+elif [ $# -eq 0 ]
+then
+ # Run VM emulator in interactive mode
+ java -classpath "${CLASSPATH}:bin/classes:bin/lib/Hack.jar:bin/lib/HackGUI.jar:bin/lib/Simulators.jar:bin/lib/SimulatorsGUI.jar:bin/lib/Compilers.jar" VMEmulatorMain &
+else
+ # Convert arg1 to an absolute path and run VM emulator with arg1
+ if [ `echo "$1" | sed -e "s/\(.\).*/\1/"` = / ]
+ then
+ arg1="$1"
+ else
+ arg1="${dir}/$1"
+ fi
+# echo Running "$arg1"
+ java -classpath "${CLASSPATH}:bin/classes:bin/lib/Hack.jar:bin/lib/HackGUI.jar:bin/lib/Simulators.jar:bin/lib/SimulatorsGUI.jar:bin/lib/Compilers.jar" VMEmulatorMain "$arg1"
+fi
diff --git a/tools/bin/classes/CPUEmulatorMain.class b/tools/bin/classes/CPUEmulatorMain.class
new file mode 100644
index 0000000..2c5b68f
--- /dev/null
+++ b/tools/bin/classes/CPUEmulatorMain.class
Binary files differ
diff --git a/tools/bin/classes/HackAssemblerMain.class b/tools/bin/classes/HackAssemblerMain.class
new file mode 100644
index 0000000..b912391
--- /dev/null
+++ b/tools/bin/classes/HackAssemblerMain.class
Binary files differ
diff --git a/tools/bin/classes/HardwareSimulatorMain.class b/tools/bin/classes/HardwareSimulatorMain.class
new file mode 100644
index 0000000..5786077
--- /dev/null
+++ b/tools/bin/classes/HardwareSimulatorMain.class
Binary files differ
diff --git a/tools/bin/classes/TextComparer.class b/tools/bin/classes/TextComparer.class
new file mode 100644
index 0000000..f2e076e
--- /dev/null
+++ b/tools/bin/classes/TextComparer.class
Binary files differ
diff --git a/tools/bin/classes/VMEmulatorMain.class b/tools/bin/classes/VMEmulatorMain.class
new file mode 100644
index 0000000..aa6b7ff
--- /dev/null
+++ b/tools/bin/classes/VMEmulatorMain.class
Binary files differ
diff --git a/tools/bin/help/asmAbout.html b/tools/bin/help/asmAbout.html
new file mode 100644
index 0000000..919e539
--- /dev/null
+++ b/tools/bin/help/asmAbout.html
@@ -0,0 +1,96 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 10">
+<meta name=Originator content="Microsoft Word 10">
+<link rel=File-List href="asmAbout_files/filelist.xml">
+<title>About Assembler</title>
+<!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:GrammarState>Clean</w:GrammarState>
+ <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
+ {margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:13.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+<!--[if gte mso 10]>
+<style>
+ /* Style Definitions */
+ table.MsoNormalTable
+ {mso-style-name:"Table Normal";
+ mso-tstyle-rowband-size:0;
+ mso-tstyle-colband-size:0;
+ mso-style-noshow:yes;
+ mso-style-parent:"";
+ mso-padding-alt:0in 5.4pt 0in 5.4pt;
+ mso-para-margin:0in;
+ mso-para-margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:10.0pt;
+ font-family:"Times New Roman";}
+</style>
+<![endif]-->
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p class=MsoBodyText align=center style='text-align:center'><b><span
+style='font-size:12.0pt'>Assembler, Version 2.5</span></b></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>&nbsp;</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'>This program is
+part of www.nand2tetris.org<o:p></o:p></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span class=GramE>and</span>
+the book &quot;The Elements of Computing Systems&quot;<o:p></o:p></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span class=GramE>by</span>
+Nisan and Schocken, MIT Press.</p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>&nbsp;</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>Software Architects: Yaron Ukrainitz and Yannai A. Gonczarowski</span></p>
+
+<p class=MsoNormal>&nbsp;</p>
+
+</div>
+
+</body>
+
+</html>
diff --git a/tools/bin/help/asmUsage.html b/tools/bin/help/asmUsage.html
new file mode 100644
index 0000000..1e18db2
--- /dev/null
+++ b/tools/bin/help/asmUsage.html
@@ -0,0 +1,115 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 11">
+<meta name=Originator content="Microsoft Word 11">
+<link rel=File-List href="asmUsage_files/filelist.xml">
+<title>Usage instruction and tips can be found in:</title>
+<!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:GrammarState>Clean</w:GrammarState>
+ <w:ValidateAgainstSchemas/>
+ <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
+ <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
+ <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
+ <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+ </w:WordDocument>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
+ </w:LatentStyles>
+</xml><![endif]-->
+<style>
+<!--
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0cm;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
+ {margin:0cm;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:13.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:612.0pt 792.0pt;
+ margin:72.0pt 90.0pt 72.0pt 90.0pt;
+ mso-header-margin:36.0pt;
+ mso-footer-margin:36.0pt;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+<!--[if gte mso 10]>
+<style>
+ /* Style Definitions */
+ table.MsoNormalTable
+ {mso-style-name:"Table Normal";
+ mso-tstyle-rowband-size:0;
+ mso-tstyle-colband-size:0;
+ mso-style-noshow:yes;
+ mso-style-parent:"";
+ mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
+ mso-para-margin:0cm;
+ mso-para-margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:10.0pt;
+ font-family:"Times New Roman";
+ mso-ansi-language:#0400;
+ mso-fareast-language:#0400;
+ mso-bidi-language:#0400;}
+</style>
+<![endif]-->
+</head>
+
+<body lang=EN-US style='tab-interval:36.0pt'>
+
+<div class=Section1>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>Usage instruction and tips can be found in:</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>&nbsp;</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><b><span
+style='font-size:12.0pt'>The Assembler Tutorial</span></b></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><b><span
+style='font-size:12.0pt'>&nbsp;</span></b></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>Available in www.nand2tetris.org</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>&nbsp;</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>And in relevant book chapters from </span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><b><span
+style='font-size:12.0pt'>The Elements of Computing Systems,<o:p></o:p></span></b></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>by Noam Nisan and Shimon Schocken</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>MIT Press</span></p>
+
+<p class=MsoNormal>&nbsp;</p>
+
+</div>
+
+</body>
+
+</html>
diff --git a/tools/bin/help/compiler.txt b/tools/bin/help/compiler.txt
new file mode 100644
index 0000000..07bbba9
--- /dev/null
+++ b/tools/bin/help/compiler.txt
@@ -0,0 +1,9 @@
+Jack Compiler, Version 2.5
+
+This program is part of www.nand2tetris.org
+and the book "The Elements of Computing Systems"
+by Nisan and Schocken, MIT Press.
+
+Software Architects: Yaron Ukrainitz and Yannai A. Gonczarowski
+
+Usage instruction and tips can be found in the relevant book chapters.
diff --git a/tools/bin/help/cpuAbout.html b/tools/bin/help/cpuAbout.html
new file mode 100644
index 0000000..f806d5e
--- /dev/null
+++ b/tools/bin/help/cpuAbout.html
@@ -0,0 +1,96 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 10">
+<meta name=Originator content="Microsoft Word 10">
+<link rel=File-List href="cpuAbout_files/filelist.xml">
+<title>About CPU Emulator</title>
+<!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:GrammarState>Clean</w:GrammarState>
+ <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
+ {margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:13.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+<!--[if gte mso 10]>
+<style>
+ /* Style Definitions */
+ table.MsoNormalTable
+ {mso-style-name:"Table Normal";
+ mso-tstyle-rowband-size:0;
+ mso-tstyle-colband-size:0;
+ mso-style-noshow:yes;
+ mso-style-parent:"";
+ mso-padding-alt:0in 5.4pt 0in 5.4pt;
+ mso-para-margin:0in;
+ mso-para-margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:10.0pt;
+ font-family:"Times New Roman";}
+</style>
+<![endif]-->
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p class=MsoBodyText align=center style='text-align:center'><b><span
+style='font-size:12.0pt'>CPU Emulator, Version 2.5</span></b></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>&nbsp;</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'>This program is
+part of www.nand2tetris.org<o:p></o:p></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span class=GramE>and</span>
+the book &quot;The Elements of Computing Systems&quot;<o:p></o:p></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span class=GramE>by</span>
+Nisan and Schocken, MIT Press.</p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>&nbsp;</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>Software Architects: Yaron Ukrainitz and Yannai A. Gonczarowski</span></p>
+
+<p class=MsoNormal>&nbsp;</p>
+
+</div>
+
+</body>
+
+</html>
diff --git a/tools/bin/help/cpuUsage.html b/tools/bin/help/cpuUsage.html
new file mode 100644
index 0000000..7e69482
--- /dev/null
+++ b/tools/bin/help/cpuUsage.html
@@ -0,0 +1,115 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 11">
+<meta name=Originator content="Microsoft Word 11">
+<link rel=File-List href="cpuUsage_files/filelist.xml">
+<title>Usage instruction and tips can be found in:</title>
+<!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:GrammarState>Clean</w:GrammarState>
+ <w:ValidateAgainstSchemas/>
+ <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
+ <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
+ <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
+ <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+ </w:WordDocument>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
+ </w:LatentStyles>
+</xml><![endif]-->
+<style>
+<!--
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0cm;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
+ {margin:0cm;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:13.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:612.0pt 792.0pt;
+ margin:72.0pt 90.0pt 72.0pt 90.0pt;
+ mso-header-margin:36.0pt;
+ mso-footer-margin:36.0pt;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+<!--[if gte mso 10]>
+<style>
+ /* Style Definitions */
+ table.MsoNormalTable
+ {mso-style-name:"Table Normal";
+ mso-tstyle-rowband-size:0;
+ mso-tstyle-colband-size:0;
+ mso-style-noshow:yes;
+ mso-style-parent:"";
+ mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
+ mso-para-margin:0cm;
+ mso-para-margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:10.0pt;
+ font-family:"Times New Roman";
+ mso-ansi-language:#0400;
+ mso-fareast-language:#0400;
+ mso-bidi-language:#0400;}
+</style>
+<![endif]-->
+</head>
+
+<body lang=EN-US style='tab-interval:36.0pt'>
+
+<div class=Section1>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>Usage instruction and tips can be found in:</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>&nbsp;</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><b><span
+style='font-size:12.0pt'>The CPU Emulator Tutorial</span></b></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><b><span
+style='font-size:12.0pt'>&nbsp;</span></b></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>Available in www.nand2tetris.org</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>&nbsp;</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>And in relevant book chapters from </span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><b><span
+style='font-size:12.0pt'>The Elements of Computing Systems,<o:p></o:p></span></b></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>by Noam Nisan and Shimon Schocken</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>MIT Press</span></p>
+
+<p class=MsoNormal>&nbsp;</p>
+
+</div>
+
+</body>
+
+</html>
diff --git a/tools/bin/help/hwAbout.html b/tools/bin/help/hwAbout.html
new file mode 100644
index 0000000..67ad89b
--- /dev/null
+++ b/tools/bin/help/hwAbout.html
@@ -0,0 +1,96 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 10">
+<meta name=Originator content="Microsoft Word 10">
+<link rel=File-List href="hwAbout_files/filelist.xml">
+<title>About Hardware Simulator</title>
+<!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:GrammarState>Clean</w:GrammarState>
+ <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
+ {margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:13.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+<!--[if gte mso 10]>
+<style>
+ /* Style Definitions */
+ table.MsoNormalTable
+ {mso-style-name:"Table Normal";
+ mso-tstyle-rowband-size:0;
+ mso-tstyle-colband-size:0;
+ mso-style-noshow:yes;
+ mso-style-parent:"";
+ mso-padding-alt:0in 5.4pt 0in 5.4pt;
+ mso-para-margin:0in;
+ mso-para-margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:10.0pt;
+ font-family:"Times New Roman";}
+</style>
+<![endif]-->
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p class=MsoBodyText align=center style='text-align:center'><b><span
+style='font-size:12.0pt'>Hardware Simulator, Version 2.5</span></b></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>&nbsp;</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'>This program is
+part of www.nand2tetris.org<o:p></o:p></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span class=GramE>and</span>
+the book &quot;The Elements of Computing Systems&quot;<o:p></o:p></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span class=GramE>by</span>
+Nisan and Schocken, MIT Press.</p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>&nbsp;</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>Software Architects: Yaron Ukrainitz and Yannai A. Gonczarowski</span></p>
+
+<p class=MsoNormal>&nbsp;</p>
+
+</div>
+
+</body>
+
+</html>
diff --git a/tools/bin/help/hwUsage.html b/tools/bin/help/hwUsage.html
new file mode 100644
index 0000000..4663f53
--- /dev/null
+++ b/tools/bin/help/hwUsage.html
@@ -0,0 +1,115 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 11">
+<meta name=Originator content="Microsoft Word 11">
+<link rel=File-List href="hwUsage_files/filelist.xml">
+<title>Usage instruction and tips can be found in:</title>
+<!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:GrammarState>Clean</w:GrammarState>
+ <w:ValidateAgainstSchemas/>
+ <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
+ <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
+ <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
+ <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+ </w:WordDocument>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
+ </w:LatentStyles>
+</xml><![endif]-->
+<style>
+<!--
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0cm;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
+ {margin:0cm;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:13.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:612.0pt 792.0pt;
+ margin:72.0pt 90.0pt 72.0pt 90.0pt;
+ mso-header-margin:36.0pt;
+ mso-footer-margin:36.0pt;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+<!--[if gte mso 10]>
+<style>
+ /* Style Definitions */
+ table.MsoNormalTable
+ {mso-style-name:"Table Normal";
+ mso-tstyle-rowband-size:0;
+ mso-tstyle-colband-size:0;
+ mso-style-noshow:yes;
+ mso-style-parent:"";
+ mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
+ mso-para-margin:0cm;
+ mso-para-margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:10.0pt;
+ font-family:"Times New Roman";
+ mso-ansi-language:#0400;
+ mso-fareast-language:#0400;
+ mso-bidi-language:#0400;}
+</style>
+<![endif]-->
+</head>
+
+<body lang=EN-US style='tab-interval:36.0pt'>
+
+<div class=Section1>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>Usage instruction and tips can be found in:</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>&nbsp;</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><b><span
+style='font-size:12.0pt'>The Hardware Simulator Tutorial</span></b></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><b><span
+style='font-size:12.0pt'>&nbsp;</span></b></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>Available in www.nand2tetris.org</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>&nbsp;</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>And in relevant book chapters from </span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><b><span
+style='font-size:12.0pt'>The Elements of Computing Systems,<o:p></o:p></span></b></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>by Noam Nisan and Shimon Schocken</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>MIT Press</span></p>
+
+<p class=MsoNormal>&nbsp;</p>
+
+</div>
+
+</body>
+
+</html>
diff --git a/tools/bin/help/vmAbout.html b/tools/bin/help/vmAbout.html
new file mode 100644
index 0000000..c5b296a
--- /dev/null
+++ b/tools/bin/help/vmAbout.html
@@ -0,0 +1,110 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 11">
+<meta name=Originator content="Microsoft Word 11">
+<link rel=File-List href="vmAbout_files/filelist.xml">
+<title>About Virtual Machine Emulator</title>
+<!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:GrammarState>Clean</w:GrammarState>
+ <w:ValidateAgainstSchemas/>
+ <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
+ <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
+ <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
+ <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+ </w:WordDocument>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
+ </w:LatentStyles>
+</xml><![endif]-->
+<style>
+<!--
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0cm;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
+ {margin:0cm;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:13.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+span.GramE
+ {mso-style-name:"";
+ mso-gram-e:yes;}
+@page Section1
+ {size:612.0pt 792.0pt;
+ margin:72.0pt 90.0pt 72.0pt 90.0pt;
+ mso-header-margin:36.0pt;
+ mso-footer-margin:36.0pt;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+<!--[if gte mso 10]>
+<style>
+ /* Style Definitions */
+ table.MsoNormalTable
+ {mso-style-name:"Table Normal";
+ mso-tstyle-rowband-size:0;
+ mso-tstyle-colband-size:0;
+ mso-style-noshow:yes;
+ mso-style-parent:"";
+ mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
+ mso-para-margin:0cm;
+ mso-para-margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:10.0pt;
+ font-family:"Times New Roman";
+ mso-ansi-language:#0400;
+ mso-fareast-language:#0400;
+ mso-bidi-language:#0400;}
+</style>
+<![endif]-->
+</head>
+
+<body lang=EN-US style='tab-interval:36.0pt'>
+
+<div class=Section1>
+
+<p class=MsoBodyText align=center style='text-align:center'><b><span
+style='font-size:12.0pt'>Virtual Machine Emulator, Version 2.5</span></b></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>&nbsp;</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'>This program is
+part of www.nand2tetris.org<o:p></o:p></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span class=GramE>and</span>
+the book &quot;The Elements of Computing Systems&quot;<o:p></o:p></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span class=GramE>by</span>
+Nisan and Schocken, MIT Press.</p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>&nbsp;</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>Software Architects: Yaron Ukrainitz and Yannai A.
+Gonczarowski</span></p>
+
+<p class=MsoNormal>&nbsp;</p>
+
+</div>
+
+</body>
+
+</html>
diff --git a/tools/bin/help/vmUsage.html b/tools/bin/help/vmUsage.html
new file mode 100644
index 0000000..611662b
--- /dev/null
+++ b/tools/bin/help/vmUsage.html
@@ -0,0 +1,115 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 11">
+<meta name=Originator content="Microsoft Word 11">
+<link rel=File-List href="vmUsage_files/filelist.xml">
+<title>Usage instruction and tips can be found in:</title>
+<!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:GrammarState>Clean</w:GrammarState>
+ <w:ValidateAgainstSchemas/>
+ <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
+ <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
+ <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
+ <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
+ </w:WordDocument>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:LatentStyles DefLockedState="false" LatentStyleCount="156">
+ </w:LatentStyles>
+</xml><![endif]-->
+<style>
+<!--
+ /* Style Definitions */
+ p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0cm;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
+ {margin:0cm;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:13.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:612.0pt 792.0pt;
+ margin:72.0pt 90.0pt 72.0pt 90.0pt;
+ mso-header-margin:36.0pt;
+ mso-footer-margin:36.0pt;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+<!--[if gte mso 10]>
+<style>
+ /* Style Definitions */
+ table.MsoNormalTable
+ {mso-style-name:"Table Normal";
+ mso-tstyle-rowband-size:0;
+ mso-tstyle-colband-size:0;
+ mso-style-noshow:yes;
+ mso-style-parent:"";
+ mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
+ mso-para-margin:0cm;
+ mso-para-margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:10.0pt;
+ font-family:"Times New Roman";
+ mso-ansi-language:#0400;
+ mso-fareast-language:#0400;
+ mso-bidi-language:#0400;}
+</style>
+<![endif]-->
+</head>
+
+<body lang=EN-US style='tab-interval:36.0pt'>
+
+<div class=Section1>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>Usage instruction and tips can be found in:</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>&nbsp;</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><b><span
+style='font-size:12.0pt'>The VM Emulator Tutorial</span></b></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><b><span
+style='font-size:12.0pt'>&nbsp;</span></b></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>Available in www.nand2tetris.org</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>&nbsp;</span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>And in relevant book chapters from </span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><b><span
+style='font-size:12.0pt'>The Elements of Computing Systems,<o:p></o:p></span></b></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>by Noam Nisan and Shimon Schocken<b><o:p></o:p></b></span></p>
+
+<p class=MsoBodyText align=center style='text-align:center'><span
+style='font-size:12.0pt'>MIT Press</span></p>
+
+<p class=MsoNormal>&nbsp;</p>
+
+</div>
+
+</body>
+
+</html>
diff --git a/tools/bin/images/arrow2.gif b/tools/bin/images/arrow2.gif
new file mode 100644
index 0000000..c744eab
--- /dev/null
+++ b/tools/bin/images/arrow2.gif
Binary files differ
diff --git a/tools/bin/images/calculator2.gif b/tools/bin/images/calculator2.gif
new file mode 100644
index 0000000..834cb05
--- /dev/null
+++ b/tools/bin/images/calculator2.gif
Binary files differ
diff --git a/tools/bin/images/cancel.gif b/tools/bin/images/cancel.gif
new file mode 100644
index 0000000..a8509fa
--- /dev/null
+++ b/tools/bin/images/cancel.gif
Binary files differ
diff --git a/tools/bin/images/chip.gif b/tools/bin/images/chip.gif
new file mode 100644
index 0000000..fbfbb02
--- /dev/null
+++ b/tools/bin/images/chip.gif
Binary files differ
diff --git a/tools/bin/images/clock2.gif b/tools/bin/images/clock2.gif
new file mode 100644
index 0000000..addcf78
--- /dev/null
+++ b/tools/bin/images/clock2.gif
Binary files differ
diff --git a/tools/bin/images/equal.gif b/tools/bin/images/equal.gif
new file mode 100644
index 0000000..3402556
--- /dev/null
+++ b/tools/bin/images/equal.gif
Binary files differ
diff --git a/tools/bin/images/find.gif b/tools/bin/images/find.gif
new file mode 100644
index 0000000..e3f4c9d
--- /dev/null
+++ b/tools/bin/images/find.gif
Binary files differ
diff --git a/tools/bin/images/hex.gif b/tools/bin/images/hex.gif
new file mode 100644
index 0000000..68a851b
--- /dev/null
+++ b/tools/bin/images/hex.gif
Binary files differ
diff --git a/tools/bin/images/keyboard.gif b/tools/bin/images/keyboard.gif
new file mode 100644
index 0000000..823aaf8
--- /dev/null
+++ b/tools/bin/images/keyboard.gif
Binary files differ
diff --git a/tools/bin/images/ok.gif b/tools/bin/images/ok.gif
new file mode 100644
index 0000000..fe6ed8d
--- /dev/null
+++ b/tools/bin/images/ok.gif
Binary files differ
diff --git a/tools/bin/images/ok2.gif b/tools/bin/images/ok2.gif
new file mode 100644
index 0000000..083909b
--- /dev/null
+++ b/tools/bin/images/ok2.gif
Binary files differ
diff --git a/tools/bin/images/open.gif b/tools/bin/images/open.gif
new file mode 100644
index 0000000..f69a024
--- /dev/null
+++ b/tools/bin/images/open.gif
Binary files differ
diff --git a/tools/bin/images/open2.gif b/tools/bin/images/open2.gif
new file mode 100644
index 0000000..2b94682
--- /dev/null
+++ b/tools/bin/images/open2.gif
Binary files differ
diff --git a/tools/bin/images/opendoc.gif b/tools/bin/images/opendoc.gif
new file mode 100644
index 0000000..e84f0d6
--- /dev/null
+++ b/tools/bin/images/opendoc.gif
Binary files differ
diff --git a/tools/bin/images/redflag.gif b/tools/bin/images/redflag.gif
new file mode 100644
index 0000000..1b1a6b1
--- /dev/null
+++ b/tools/bin/images/redflag.gif
Binary files differ
diff --git a/tools/bin/images/save.gif b/tools/bin/images/save.gif
new file mode 100644
index 0000000..7b5d5b9
--- /dev/null
+++ b/tools/bin/images/save.gif
Binary files differ
diff --git a/tools/bin/images/scroll.gif b/tools/bin/images/scroll.gif
new file mode 100644
index 0000000..e00a9a1
--- /dev/null
+++ b/tools/bin/images/scroll.gif
Binary files differ
diff --git a/tools/bin/images/smallcancel.gif b/tools/bin/images/smallcancel.gif
new file mode 100644
index 0000000..1f8cddc
--- /dev/null
+++ b/tools/bin/images/smallcancel.gif
Binary files differ
diff --git a/tools/bin/images/smallequal.gif b/tools/bin/images/smallequal.gif
new file mode 100644
index 0000000..a1db606
--- /dev/null
+++ b/tools/bin/images/smallequal.gif
Binary files differ
diff --git a/tools/bin/images/smallminus.gif b/tools/bin/images/smallminus.gif
new file mode 100644
index 0000000..06492f5
--- /dev/null
+++ b/tools/bin/images/smallminus.gif
Binary files differ
diff --git a/tools/bin/images/smallnew.gif b/tools/bin/images/smallnew.gif
new file mode 100644
index 0000000..c3137e5
--- /dev/null
+++ b/tools/bin/images/smallnew.gif
Binary files differ
diff --git a/tools/bin/images/smallok.gif b/tools/bin/images/smallok.gif
new file mode 100644
index 0000000..9bef2b2
--- /dev/null
+++ b/tools/bin/images/smallok.gif
Binary files differ
diff --git a/tools/bin/images/smallplus.gif b/tools/bin/images/smallplus.gif
new file mode 100644
index 0000000..9030b0b
--- /dev/null
+++ b/tools/bin/images/smallplus.gif
Binary files differ
diff --git a/tools/bin/images/vcrfastforward.gif b/tools/bin/images/vcrfastforward.gif
new file mode 100644
index 0000000..11c7235
--- /dev/null
+++ b/tools/bin/images/vcrfastforward.gif
Binary files differ
diff --git a/tools/bin/images/vcrforward.gif b/tools/bin/images/vcrforward.gif
new file mode 100644
index 0000000..b58d649
--- /dev/null
+++ b/tools/bin/images/vcrforward.gif
Binary files differ
diff --git a/tools/bin/images/vcrrewind.gif b/tools/bin/images/vcrrewind.gif
new file mode 100644
index 0000000..e55b4d6
--- /dev/null
+++ b/tools/bin/images/vcrrewind.gif
Binary files differ
diff --git a/tools/bin/images/vcrstop.gif b/tools/bin/images/vcrstop.gif
new file mode 100644
index 0000000..abe2082
--- /dev/null
+++ b/tools/bin/images/vcrstop.gif
Binary files differ
diff --git a/tools/bin/lib/AssemblerGUI.jar b/tools/bin/lib/AssemblerGUI.jar
new file mode 100644
index 0000000..c40d455
--- /dev/null
+++ b/tools/bin/lib/AssemblerGUI.jar
Binary files differ
diff --git a/tools/bin/lib/Compilers.jar b/tools/bin/lib/Compilers.jar
new file mode 100644
index 0000000..9a78b05
--- /dev/null
+++ b/tools/bin/lib/Compilers.jar
Binary files differ
diff --git a/tools/bin/lib/Hack.jar b/tools/bin/lib/Hack.jar
new file mode 100644
index 0000000..9d57398
--- /dev/null
+++ b/tools/bin/lib/Hack.jar
Binary files differ
diff --git a/tools/bin/lib/HackGUI.jar b/tools/bin/lib/HackGUI.jar
new file mode 100644
index 0000000..22d4ff3
--- /dev/null
+++ b/tools/bin/lib/HackGUI.jar
Binary files differ
diff --git a/tools/bin/lib/Simulators.jar b/tools/bin/lib/Simulators.jar
new file mode 100644
index 0000000..72b5db7
--- /dev/null
+++ b/tools/bin/lib/Simulators.jar
Binary files differ
diff --git a/tools/bin/lib/SimulatorsGUI.jar b/tools/bin/lib/SimulatorsGUI.jar
new file mode 100644
index 0000000..4d36e64
--- /dev/null
+++ b/tools/bin/lib/SimulatorsGUI.jar
Binary files differ
diff --git a/tools/bin/lib/TranslatorsGUI.jar b/tools/bin/lib/TranslatorsGUI.jar
new file mode 100644
index 0000000..f29f926
--- /dev/null
+++ b/tools/bin/lib/TranslatorsGUI.jar
Binary files differ
diff --git a/tools/bin/scripts/defaultCPU.txt b/tools/bin/scripts/defaultCPU.txt
new file mode 100644
index 0000000..43b2720
--- /dev/null
+++ b/tools/bin/scripts/defaultCPU.txt
@@ -0,0 +1,3 @@
+repeat {
+ ticktock;
+} \ No newline at end of file
diff --git a/tools/bin/scripts/defaultHW.txt b/tools/bin/scripts/defaultHW.txt
new file mode 100644
index 0000000..bdb2261
--- /dev/null
+++ b/tools/bin/scripts/defaultHW.txt
@@ -0,0 +1,4 @@
+repeat {
+ tick,
+ tock;
+} \ No newline at end of file
diff --git a/tools/bin/scripts/defaultVM.txt b/tools/bin/scripts/defaultVM.txt
new file mode 100644
index 0000000..dbc64c4
--- /dev/null
+++ b/tools/bin/scripts/defaultVM.txt
@@ -0,0 +1,3 @@
+repeat {
+ vmstep;
+} \ No newline at end of file
diff --git a/tools/builtInChips/ALU.class b/tools/builtInChips/ALU.class
new file mode 100644
index 0000000..03f95dc
--- /dev/null
+++ b/tools/builtInChips/ALU.class
Binary files differ
diff --git a/tools/builtInChips/ALU.hdl b/tools/builtInChips/ALU.hdl
new file mode 100644
index 0000000..e5fd1f0
--- /dev/null
+++ b/tools/builtInChips/ALU.hdl
@@ -0,0 +1,55 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/ALU.hdl
+
+/**
+ * The ALU. Computes one of the following functions:
+ * x+y, x-y, y–x, 0, 1, -1, x, y, -x, -y, !x, !y,
+ * x+1, y+1, x-1, y-1, x&y, x|y on two 16-bit inputs.
+ * Which function to compute is determined by 6 input bits
+ * denoted zx, nx, zy, ny, f, no.
+ * The computed function's value is called "out".
+ * In addition to computing out, the ALU computes two
+ * 1-bit outputs called zr and ng:
+ * if out == 0, zr = 1; otherwise zr = 0;
+ * If out < 0, ng = 1; otherwise ng = 0.
+ * The 6-bit combinations (zx,nx,zy,ny,f,no) and
+ * their effect are documented in the book.
+ */
+
+// Implementation: the ALU manipulates the x and y
+// inputs and then operates on the resulting values,
+// as follows:
+// if (zx == 1) sets x = 0 // 16-bit constant
+// if (nx == 1) sets x = ~x // bitwise "not"
+// if (zy == 1) sets y = 0 // 16-bit constant
+// if (ny == 1) sets y = ~y // bitwise "not"
+// if (f == 1) sets out = x + y // integer 2's-complement addition
+// if (f == 0) sets out = x & y // bitwise And
+// if (no == 1) sets out = ~out // bitwise Not
+// if (out == 0) sets zr = 1
+// if (out < 0) sets ng = 1
+
+
+CHIP ALU {
+
+ IN // 16-bit inputs:
+ x[16], y[16],
+ // Control bits:
+ zx, // Zero the x input
+ nx, // Negate the x input
+ zy, // Zero the y input
+ ny, // Negate the y input
+ f, // Function code: 1 for add, 0 for and
+ no; // Negate the out output
+
+ OUT // 16-bit output
+ out[16],
+
+ // ALU output flags
+ zr, // 1 if out=0, 0 otherwise
+ ng; // 1 if out<0, 0 otherwise
+
+ BUILTIN ALU;
+}
diff --git a/tools/builtInChips/ARegister.class b/tools/builtInChips/ARegister.class
new file mode 100644
index 0000000..ab9aadc
--- /dev/null
+++ b/tools/builtInChips/ARegister.class
Binary files differ
diff --git a/tools/builtInChips/ARegister.hdl b/tools/builtInChips/ARegister.hdl
new file mode 100644
index 0000000..23aee73
--- /dev/null
+++ b/tools/builtInChips/ARegister.hdl
@@ -0,0 +1,24 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/ARegister.hdl
+
+/**
+ * A 16-Bit register called "A Register".
+ * If load[t-1]=1 then out[t] = in[t-1]
+ * else out does not change (out[t] = out[t-1])
+ *
+ * This built-in chip implementation has the side effect of
+ * providing a GUI representation of a 16-bit register
+ * called "A register" (typically used to store an address).
+ */
+
+CHIP ARegister {
+
+ IN in[16], load;
+ OUT out[16];
+
+ BUILTIN ARegister;
+ CLOCKED in, load;
+}
+
diff --git a/tools/builtInChips/Add16.class b/tools/builtInChips/Add16.class
new file mode 100644
index 0000000..c3754ce
--- /dev/null
+++ b/tools/builtInChips/Add16.class
Binary files differ
diff --git a/tools/builtInChips/Add16.hdl b/tools/builtInChips/Add16.hdl
new file mode 100644
index 0000000..a494af4
--- /dev/null
+++ b/tools/builtInChips/Add16.hdl
@@ -0,0 +1,18 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Add16.hdl
+
+/*
+ * Adds two 16-bit values.
+ * The most significant carry bit is ignored.
+ */
+
+CHIP Add16 {
+
+ IN a[16], b[16];
+ OUT out[16];
+
+ BUILTIN Add16;
+}
+
diff --git a/tools/builtInChips/And.class b/tools/builtInChips/And.class
new file mode 100644
index 0000000..2c7492b
--- /dev/null
+++ b/tools/builtInChips/And.class
Binary files differ
diff --git a/tools/builtInChips/And.hdl b/tools/builtInChips/And.hdl
new file mode 100644
index 0000000..d2c48b5
--- /dev/null
+++ b/tools/builtInChips/And.hdl
@@ -0,0 +1,16 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/And.hdl
+
+/**
+ * And gate: out = 1 if {a == 1 and b == 1}, 0 otherwise
+ */
+
+CHIP And {
+
+ IN a, b;
+ OUT out;
+
+ BUILTIN And;
+}
diff --git a/tools/builtInChips/And16.hdl b/tools/builtInChips/And16.hdl
new file mode 100644
index 0000000..4c71874
--- /dev/null
+++ b/tools/builtInChips/And16.hdl
@@ -0,0 +1,17 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/And16.hdl
+
+/**
+ * 16-bit-wise And gate: for i = 0..15: out[i] = a[i] and b[i]
+ */
+
+CHIP And16 {
+
+ IN a[16], b[16];
+ OUT out[16];
+
+ BUILTIN And;
+}
+
diff --git a/tools/builtInChips/Bit.class b/tools/builtInChips/Bit.class
new file mode 100644
index 0000000..1e5a3c4
--- /dev/null
+++ b/tools/builtInChips/Bit.class
Binary files differ
diff --git a/tools/builtInChips/Bit.hdl b/tools/builtInChips/Bit.hdl
new file mode 100644
index 0000000..a0a76bb
--- /dev/null
+++ b/tools/builtInChips/Bit.hdl
@@ -0,0 +1,19 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Bit.hdl
+
+/**
+ * 1-bit register.
+ * If load[t] == 1 then out[t+1] = in[t]
+ * else out[t+1] = out[t] (no change)
+ */
+
+CHIP Bit {
+
+ IN in, load;
+ OUT out;
+
+ BUILTIN Bit;
+ CLOCKED in, load;
+}
diff --git a/tools/builtInChips/DFF.class b/tools/builtInChips/DFF.class
new file mode 100644
index 0000000..49efcf1
--- /dev/null
+++ b/tools/builtInChips/DFF.class
Binary files differ
diff --git a/tools/builtInChips/DFF.hdl b/tools/builtInChips/DFF.hdl
new file mode 100644
index 0000000..c66b796
--- /dev/null
+++ b/tools/builtInChips/DFF.hdl
@@ -0,0 +1,18 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/DFF.hdl
+
+/**
+ * Data Flip-flop: out(t) = in(t-1)
+ * where t is the current time unit, or clock cycle.
+ */
+
+CHIP DFF {
+
+ IN in;
+ OUT out;
+
+ BUILTIN DFF;
+ CLOCKED in;
+}
diff --git a/tools/builtInChips/DMux.class b/tools/builtInChips/DMux.class
new file mode 100644
index 0000000..8cf4e0b
--- /dev/null
+++ b/tools/builtInChips/DMux.class
Binary files differ
diff --git a/tools/builtInChips/DMux.hdl b/tools/builtInChips/DMux.hdl
new file mode 100644
index 0000000..80153d7
--- /dev/null
+++ b/tools/builtInChips/DMux.hdl
@@ -0,0 +1,20 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/DMux.hdl
+
+/**
+ * Dmultiplexor.
+ * {a,b} = {in,0} if sel == 0
+ * {0,in} if sel == 1
+ */
+
+
+CHIP DMux {
+
+ IN in, sel;
+ OUT a, b;
+
+ BUILTIN DMux;
+}
+
diff --git a/tools/builtInChips/DMux4Way.class b/tools/builtInChips/DMux4Way.class
new file mode 100644
index 0000000..ab72a17
--- /dev/null
+++ b/tools/builtInChips/DMux4Way.class
Binary files differ
diff --git a/tools/builtInChips/DMux4Way.hdl b/tools/builtInChips/DMux4Way.hdl
new file mode 100644
index 0000000..110bb4e
--- /dev/null
+++ b/tools/builtInChips/DMux4Way.hdl
@@ -0,0 +1,22 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/DMux4Way.hdl
+
+/**
+ * 4-way demultiplexor.
+ * {a,b,c,d} = {in,0,0,0} if sel == 00
+ * {0,in,0,0} if sel == 01
+ * {0,0,in,0} if sel == 10
+ * {0,0,0,in} if sel == 11
+ */
+
+
+CHIP DMux4Way {
+
+ IN in, sel[2];
+ OUT a, b, c, d;
+
+ BUILTIN DMux4Way;
+}
+
diff --git a/tools/builtInChips/DMux8Way.class b/tools/builtInChips/DMux8Way.class
new file mode 100644
index 0000000..80e7437
--- /dev/null
+++ b/tools/builtInChips/DMux8Way.class
Binary files differ
diff --git a/tools/builtInChips/DMux8Way.hdl b/tools/builtInChips/DMux8Way.hdl
new file mode 100644
index 0000000..c5536b8
--- /dev/null
+++ b/tools/builtInChips/DMux8Way.hdl
@@ -0,0 +1,22 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/DMux8Way.hdl
+
+/**
+ * 8-way demultiplexor.
+ * {a,b,c,d,e,f,g,h} = {in,0,0,0,0,0,0,0} if sel == 000
+ * {0,in,0,0,0,0,0,0} if sel == 001
+ * etc.
+ * {0,0,0,0,0,0,0,in} if sel == 111
+ */
+
+
+CHIP DMux8Way {
+
+ IN in, sel[3];
+ OUT a, b, c, d, e, f, g, h;
+
+ BUILTIN DMux8Way;
+}
+
diff --git a/tools/builtInChips/DRegister.class b/tools/builtInChips/DRegister.class
new file mode 100644
index 0000000..74a713d
--- /dev/null
+++ b/tools/builtInChips/DRegister.class
Binary files differ
diff --git a/tools/builtInChips/DRegister.hdl b/tools/builtInChips/DRegister.hdl
new file mode 100644
index 0000000..6c9a254
--- /dev/null
+++ b/tools/builtInChips/DRegister.hdl
@@ -0,0 +1,24 @@
+// This file is part of the materials accompanying the book
+// "The Elements of Computing Systems" by Nisan and Schocken,
+// MIT Press. Book site: www.idc.ac.il/tecs
+// File name: tools/builtIn/DRegister.hdl
+
+/**
+ * A 16-Bit register called "D Register".
+ * If load[t-1]=1 then out[t] = in[t-1]
+ * else out does not change (out[t] = out[t-1])
+ *
+ * This built-in chip implementation has the side effect of
+ * providing a GUI representation of a 16-bit register
+ * called "D register" (typically used to store data).
+ */
+
+CHIP DRegister {
+
+ IN in[16], load;
+ OUT out[16];
+
+ BUILTIN DRegister;
+ CLOCKED in, load;
+}
+
diff --git a/tools/builtInChips/FullAdder.class b/tools/builtInChips/FullAdder.class
new file mode 100644
index 0000000..2ed9ead
--- /dev/null
+++ b/tools/builtInChips/FullAdder.class
Binary files differ
diff --git a/tools/builtInChips/FullAdder.hdl b/tools/builtInChips/FullAdder.hdl
new file mode 100644
index 0000000..a4caa56
--- /dev/null
+++ b/tools/builtInChips/FullAdder.hdl
@@ -0,0 +1,19 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/FullAdder.hdl
+
+/**
+ * Full adder. Computes sum, the least significant bit of
+ * a + b + c, and carry, the most significant bit of a + b + c.
+ */
+
+CHIP FullAdder {
+
+ IN a, b, c;
+ OUT sum, // LSB of a + b + c
+ carry; // MSB of a + b + c
+
+ BUILTIN FullAdder;
+}
+
diff --git a/tools/builtInChips/HalfAdder.class b/tools/builtInChips/HalfAdder.class
new file mode 100644
index 0000000..e7741ed
--- /dev/null
+++ b/tools/builtInChips/HalfAdder.class
Binary files differ
diff --git a/tools/builtInChips/HalfAdder.hdl b/tools/builtInChips/HalfAdder.hdl
new file mode 100644
index 0000000..1591b96
--- /dev/null
+++ b/tools/builtInChips/HalfAdder.hdl
@@ -0,0 +1,18 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/HalfAdder.hdl
+
+/**
+ * Half adder. Computes sum, the least significnat bit of a + b,
+ * and carry, the most significnat bit of a + b.
+ */
+
+CHIP HalfAdder {
+
+ IN a, b;
+ OUT sum, // LSB of a + b
+ carry; // MSB of a + b
+
+ BUILTIN HalfAdder;
+}
diff --git a/tools/builtInChips/Inc16.class b/tools/builtInChips/Inc16.class
new file mode 100644
index 0000000..b5b2aeb
--- /dev/null
+++ b/tools/builtInChips/Inc16.class
Binary files differ
diff --git a/tools/builtInChips/Inc16.hdl b/tools/builtInChips/Inc16.hdl
new file mode 100644
index 0000000..9d2d49b
--- /dev/null
+++ b/tools/builtInChips/Inc16.hdl
@@ -0,0 +1,18 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Inc16.hdl
+
+/**
+ * 16-bit incrementer. out = in + 1 (16-bit addition).
+ * Overflow is neither detected nor handled.
+ */
+
+CHIP Inc16 {
+
+ IN in[16];
+ OUT out[16];
+
+ BUILTIN Inc16;
+}
+
diff --git a/tools/builtInChips/Keyboard.class b/tools/builtInChips/Keyboard.class
new file mode 100644
index 0000000..090b7cc
--- /dev/null
+++ b/tools/builtInChips/Keyboard.class
Binary files differ
diff --git a/tools/builtInChips/Keyboard.hdl b/tools/builtInChips/Keyboard.hdl
new file mode 100644
index 0000000..26ca5ed
--- /dev/null
+++ b/tools/builtInChips/Keyboard.hdl
@@ -0,0 +1,23 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Keyboard.hdl
+
+/**
+ * The keyboard (memory map).
+ * Outputs the code of the currently pressed key.
+ *
+ * The built-in chip implementation has two side effects supplied
+ * by the simulator. First, the keyboard memory map is continuously
+ * being refreshed from the physical keyboard unit. Second, it
+ * displays a keyboard icon and data entry GUI.
+ */
+
+CHIP Keyboard {
+
+ OUT out[16]; // The ASCII code of the pressed key,
+ // or 0 if no key is currently pressed,
+ // or one the special codes listed in Figure 5.5.
+
+ BUILTIN Keyboard;
+}
diff --git a/tools/builtInChips/Mux.class b/tools/builtInChips/Mux.class
new file mode 100644
index 0000000..75c6645
--- /dev/null
+++ b/tools/builtInChips/Mux.class
Binary files differ
diff --git a/tools/builtInChips/Mux.hdl b/tools/builtInChips/Mux.hdl
new file mode 100644
index 0000000..a0eefbc
--- /dev/null
+++ b/tools/builtInChips/Mux.hdl
@@ -0,0 +1,16 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Mux.hdl
+
+/**
+ * Multiplexor. If sel == 1 then out = b else out = a.
+ */
+
+CHIP Mux {
+
+ IN a, b, sel;
+ OUT out;
+
+ BUILTIN Mux;
+}
diff --git a/tools/builtInChips/Mux16.hdl b/tools/builtInChips/Mux16.hdl
new file mode 100644
index 0000000..676d1f4
--- /dev/null
+++ b/tools/builtInChips/Mux16.hdl
@@ -0,0 +1,16 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Mux16.hdl
+
+/**
+ * 16 bit multiplexor. If sel == 1 then out = b else out = a.
+ */
+
+CHIP Mux16 {
+
+ IN a[16], b[16], sel;
+ OUT out[16];
+
+ BUILTIN Mux;
+}
diff --git a/tools/builtInChips/Mux4Way16.class b/tools/builtInChips/Mux4Way16.class
new file mode 100644
index 0000000..b2e2ed7
--- /dev/null
+++ b/tools/builtInChips/Mux4Way16.class
Binary files differ
diff --git a/tools/builtInChips/Mux4Way16.hdl b/tools/builtInChips/Mux4Way16.hdl
new file mode 100644
index 0000000..9929e82
--- /dev/null
+++ b/tools/builtInChips/Mux4Way16.hdl
@@ -0,0 +1,21 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Mux4Way16.hdl
+
+/**
+ * 4-way 16-bit multiplexor.
+ * out = a if sel == 00
+ * b if sel == 01
+ * c if sel == 10
+ * d if sel == 11
+ */
+
+
+CHIP Mux4Way16 {
+
+ IN a[16], b[16], c[16], d[16], sel[2];
+ OUT out[16];
+
+ BUILTIN Mux4Way16;
+}
diff --git a/tools/builtInChips/Mux8Way16.class b/tools/builtInChips/Mux8Way16.class
new file mode 100644
index 0000000..d8040ef
--- /dev/null
+++ b/tools/builtInChips/Mux8Way16.class
Binary files differ
diff --git a/tools/builtInChips/Mux8Way16.hdl b/tools/builtInChips/Mux8Way16.hdl
new file mode 100644
index 0000000..dc16861
--- /dev/null
+++ b/tools/builtInChips/Mux8Way16.hdl
@@ -0,0 +1,24 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Mux8Way16.hdl
+
+/**
+ * 8-way 16-bit multiplexor.
+ * out = a if sel == 000
+ * b if sel == 001
+ * etc.
+ * h if sel == 111
+ */
+
+
+CHIP Mux8Way16 {
+
+ IN a[16], b[16], c[16], d[16],
+ e[16], f[16], g[16], h[16],
+ sel[3];
+
+ OUT out[16];
+
+ BUILTIN Mux8Way16;
+} \ No newline at end of file
diff --git a/tools/builtInChips/Nand.class b/tools/builtInChips/Nand.class
new file mode 100644
index 0000000..4b429ba
--- /dev/null
+++ b/tools/builtInChips/Nand.class
Binary files differ
diff --git a/tools/builtInChips/Nand.hdl b/tools/builtInChips/Nand.hdl
new file mode 100644
index 0000000..ae0204e
--- /dev/null
+++ b/tools/builtInChips/Nand.hdl
@@ -0,0 +1,16 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Nand.hdl
+
+/**
+ * Nand gate: out = a Nand b.
+ */
+
+CHIP Nand {
+
+ IN a, b;
+ OUT out;
+
+ BUILTIN Nand;
+}
diff --git a/tools/builtInChips/Not.class b/tools/builtInChips/Not.class
new file mode 100644
index 0000000..4726b67
--- /dev/null
+++ b/tools/builtInChips/Not.class
Binary files differ
diff --git a/tools/builtInChips/Not.hdl b/tools/builtInChips/Not.hdl
new file mode 100644
index 0000000..5b9d897
--- /dev/null
+++ b/tools/builtInChips/Not.hdl
@@ -0,0 +1,16 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Not.hdl
+
+/**
+ * Not gate: out = not in
+ */
+
+CHIP Not {
+
+ IN in;
+ OUT out;
+
+ BUILTIN Not;
+} \ No newline at end of file
diff --git a/tools/builtInChips/Not16.class b/tools/builtInChips/Not16.class
new file mode 100644
index 0000000..ff3e68f
--- /dev/null
+++ b/tools/builtInChips/Not16.class
Binary files differ
diff --git a/tools/builtInChips/Not16.hdl b/tools/builtInChips/Not16.hdl
new file mode 100644
index 0000000..c50dab9
--- /dev/null
+++ b/tools/builtInChips/Not16.hdl
@@ -0,0 +1,16 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Not16.hdl
+
+/**
+ * 16-bit Not gate: for i = 0..15: out[i] = not in[i]
+ */
+
+CHIP Not16 {
+
+ IN in[16];
+ OUT out[16];
+
+ BUILTIN Not16;
+} \ No newline at end of file
diff --git a/tools/builtInChips/Or.class b/tools/builtInChips/Or.class
new file mode 100644
index 0000000..a5b64f9
--- /dev/null
+++ b/tools/builtInChips/Or.class
Binary files differ
diff --git a/tools/builtInChips/Or.hdl b/tools/builtInChips/Or.hdl
new file mode 100644
index 0000000..4a3f14b
--- /dev/null
+++ b/tools/builtInChips/Or.hdl
@@ -0,0 +1,16 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Or.hdl
+
+/**
+ * Or gate: out = 1 if {a == 1 or b == 1}, 0 otherwise
+ */
+
+CHIP Or {
+
+ IN a, b;
+ OUT out;
+
+ BUILTIN Or;
+}
diff --git a/tools/builtInChips/Or16.hdl b/tools/builtInChips/Or16.hdl
new file mode 100644
index 0000000..6c124e8
--- /dev/null
+++ b/tools/builtInChips/Or16.hdl
@@ -0,0 +1,16 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Or16.hdl
+
+/**
+ * 16-bit bitwise Or gate: for i = 0..15 out[i] = a[i] or b[i].
+ */
+
+CHIP Or16 {
+
+ IN a[16], b[16];
+ OUT out[16];
+
+ BUILTIN Or;
+}
diff --git a/tools/builtInChips/Or8Way.class b/tools/builtInChips/Or8Way.class
new file mode 100644
index 0000000..104804b
--- /dev/null
+++ b/tools/builtInChips/Or8Way.class
Binary files differ
diff --git a/tools/builtInChips/Or8Way.hdl b/tools/builtInChips/Or8Way.hdl
new file mode 100644
index 0000000..dccd61d
--- /dev/null
+++ b/tools/builtInChips/Or8Way.hdl
@@ -0,0 +1,16 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Or8Way.hdl
+
+/**
+ * 8-way Or gate: out = in[0] or in[1] or ... or in[7].
+ */
+
+CHIP Or8Way {
+
+ IN in[8];
+ OUT out;
+
+ BUILTIN Or8Way;
+}
diff --git a/tools/builtInChips/PC.class b/tools/builtInChips/PC.class
new file mode 100644
index 0000000..1e6ada1
--- /dev/null
+++ b/tools/builtInChips/PC.class
Binary files differ
diff --git a/tools/builtInChips/PC.hdl b/tools/builtInChips/PC.hdl
new file mode 100644
index 0000000..f102d99
--- /dev/null
+++ b/tools/builtInChips/PC.hdl
@@ -0,0 +1,22 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/PC.hdl
+
+/**
+ * 16-bit counter with load and reset controls.
+ *
+ * If reset(t-1) then out(t) = 0
+ * else if load(t-1) then out(t) = in(t-1)
+ * else if inc(t-1) then out(t) = out(t-1) + 1 (integer addition)
+ * else out(t) = out(t-1)
+ */
+
+CHIP PC {
+
+ IN in[16], load, inc, reset;
+ OUT out[16];
+
+ BUILTIN PC;
+ CLOCKED in, load, inc, reset;
+}
diff --git a/tools/builtInChips/RAM.class b/tools/builtInChips/RAM.class
new file mode 100644
index 0000000..e17050f
--- /dev/null
+++ b/tools/builtInChips/RAM.class
Binary files differ
diff --git a/tools/builtInChips/RAM16K.class b/tools/builtInChips/RAM16K.class
new file mode 100644
index 0000000..2f1e3fe
--- /dev/null
+++ b/tools/builtInChips/RAM16K.class
Binary files differ
diff --git a/tools/builtInChips/RAM16K.hdl b/tools/builtInChips/RAM16K.hdl
new file mode 100644
index 0000000..7031bf9
--- /dev/null
+++ b/tools/builtInChips/RAM16K.hdl
@@ -0,0 +1,24 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/RAM16K.hdl
+
+/**
+ * Memory of 16K registers, each 16-bit wide.
+ * The chip facilitates read and write operations, as follows:
+ * Read: out(t) = RAM16K[address(t)](t)
+ * Write: If load(t-1) then RAM16K[address(t-1)](t) = in(t-1)
+ * In words: the chip always outputs the value stored at the memory
+ * location specified by address. If load=1, the in value is loaded
+ * into the memory location specified by address. This value becomes
+ * available through the out output starting from the next time step.
+ */
+
+CHIP RAM16K {
+
+ IN in[16], load, address[14];
+ OUT out[16];
+
+ BUILTIN RAM16K;
+ CLOCKED in, load;
+}
diff --git a/tools/builtInChips/RAM4K.class b/tools/builtInChips/RAM4K.class
new file mode 100644
index 0000000..164ebf8
--- /dev/null
+++ b/tools/builtInChips/RAM4K.class
Binary files differ
diff --git a/tools/builtInChips/RAM4K.hdl b/tools/builtInChips/RAM4K.hdl
new file mode 100644
index 0000000..8f1b211
--- /dev/null
+++ b/tools/builtInChips/RAM4K.hdl
@@ -0,0 +1,24 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/RAM4K.hdl
+
+/**
+ * Memory of 4K registers, each 16-bit wide.
+ * The chip facilitates read and write operations, as follows:
+ * Read: out(t) = RAM4K[address(t)](t)
+ * Write: If load(t-1) then RAM4K[address(t-1)](t) = in(t-1)
+ * In words: the chip always outputs the value stored at the memory
+ * location specified by address. If load == 1, the in value is loaded
+ * into the memory location specified by address. This value becomes
+ * available through the out output starting from the next time step.
+ */
+
+CHIP RAM4K {
+
+ IN in[16], load, address[12];
+ OUT out[16];
+
+ BUILTIN RAM4K;
+ CLOCKED in, load;
+}
diff --git a/tools/builtInChips/RAM512.class b/tools/builtInChips/RAM512.class
new file mode 100644
index 0000000..69bff7a
--- /dev/null
+++ b/tools/builtInChips/RAM512.class
Binary files differ
diff --git a/tools/builtInChips/RAM512.hdl b/tools/builtInChips/RAM512.hdl
new file mode 100644
index 0000000..2a2f433
--- /dev/null
+++ b/tools/builtInChips/RAM512.hdl
@@ -0,0 +1,24 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/RAM512.hdl
+
+/**
+ * Memory of 512 registers, each 16-bit wide.
+ * The chip facilitates read and write operations, as follows:
+ * Read: out(t) = RAM512[address(t)](t)
+ * Write: If load(t-1) then RAM512[address(t-1)](t) = in(t-1)
+ * In words: the chip always outputs the value stored at the memory
+ * location specified by address. If load == 1, the in value is loaded
+ * into the memory location specified by address. This value becomes
+ * available through the out output starting from the next time step.
+ */
+
+CHIP RAM512 {
+
+ IN in[16], load, address[9];
+ OUT out[16];
+
+ BUILTIN RAM512;
+ CLOCKED in, load;
+}
diff --git a/tools/builtInChips/RAM64.class b/tools/builtInChips/RAM64.class
new file mode 100644
index 0000000..a1fe78a
--- /dev/null
+++ b/tools/builtInChips/RAM64.class
Binary files differ
diff --git a/tools/builtInChips/RAM64.hdl b/tools/builtInChips/RAM64.hdl
new file mode 100644
index 0000000..6f32f47
--- /dev/null
+++ b/tools/builtInChips/RAM64.hdl
@@ -0,0 +1,24 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/RAM64.hdl
+
+/**
+ * Memory of 64 registers, each 16-bit wide.
+ * The chip facilitates read and write operations, as follows:
+ * Read: out(t) = RAM64[address(t)](t)
+ * Write: If load(t-1) then RAM64[address(t-1)](t) = in(t-1)
+ * In words: the chip always outputs the value stored at the memory
+ * location specified by address. If load == 1, the in value is loaded
+ * into the memory location specified by address. This value becomes
+ * available through the out output starting from the next time step.
+ */
+
+CHIP RAM64 {
+
+ IN in[16], load, address[6];
+ OUT out[16];
+
+ BUILTIN RAM64;
+ CLOCKED in, load;
+}
diff --git a/tools/builtInChips/RAM8.class b/tools/builtInChips/RAM8.class
new file mode 100644
index 0000000..88f106e
--- /dev/null
+++ b/tools/builtInChips/RAM8.class
Binary files differ
diff --git a/tools/builtInChips/RAM8.hdl b/tools/builtInChips/RAM8.hdl
new file mode 100644
index 0000000..c08d62c
--- /dev/null
+++ b/tools/builtInChips/RAM8.hdl
@@ -0,0 +1,24 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/RAM8.hdl
+
+/**
+ * Memory of 8 registers, each 16-bit wide.
+ * The chip facilitates read and write operations, as follows:
+ * Read: out(t) = RAM8[address(t)](t)
+ * Write: If load(t-1) then RAM8[address(t-1)](t) = in(t-1)
+ * In words: the chip always outputs the value stored at the memory
+ * location specified by address. If load == 1, the in value is loaded
+ * into the memory location specified by address. This value becomes
+ * available through the out output starting from the next time step.
+ */
+
+CHIP RAM8 {
+
+ IN in[16], load, address[3];
+ OUT out[16];
+
+ BUILTIN RAM8;
+ CLOCKED in, load;
+}
diff --git a/tools/builtInChips/ROM32K.class b/tools/builtInChips/ROM32K.class
new file mode 100644
index 0000000..c4320d8
--- /dev/null
+++ b/tools/builtInChips/ROM32K.class
Binary files differ
diff --git a/tools/builtInChips/ROM32K.hdl b/tools/builtInChips/ROM32K.hdl
new file mode 100644
index 0000000..929f824
--- /dev/null
+++ b/tools/builtInChips/ROM32K.hdl
@@ -0,0 +1,30 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/ROM32K.hdl
+
+/**
+ * Read-Only memory (ROM) of 16K registers, each 16-bit wide.
+ * The chip is designed to facilitate data read, as follows:
+ * out(t) = ROM32K[address(t)](t)
+ * In words: the chip always outputs the value stored at the
+ * memory location specified by address.
+ *
+ * The built-in chip implementation has a GUI side-effect,
+ * showing an array-like component that displays the ROM's
+ * contents. The ROM32K chip is supposed to be pre-loaded with
+ * a machine language program. To that end, the built-in chip
+ * implementation also knows how to handle the "ROM32K load Xxx"
+ * script command, where Xxx is the name of a text file containing
+ * a program written in the Hack machine language. When the
+ * simulator encounters such a command in a test script, the code
+ * found in the file is loaded into the simulated ROM32K unit.
+ */
+
+CHIP ROM32K {
+
+ IN address[15];
+ OUT out[16];
+
+ BUILTIN ROM32K;
+}
diff --git a/tools/builtInChips/Register.class b/tools/builtInChips/Register.class
new file mode 100644
index 0000000..3958fcd
--- /dev/null
+++ b/tools/builtInChips/Register.class
Binary files differ
diff --git a/tools/builtInChips/Register.hdl b/tools/builtInChips/Register.hdl
new file mode 100644
index 0000000..3b81e46
--- /dev/null
+++ b/tools/builtInChips/Register.hdl
@@ -0,0 +1,19 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Register.hdl
+
+/**
+ * 16-Bit register.
+ * If load[t-1]=1 then out[t] = in[t-1]
+ * else out does not change (out[t] = out[t-1])
+ */
+
+CHIP Register {
+
+ IN in[16], load;
+ OUT out[16];
+
+ BUILTIN Register;
+ CLOCKED in, load;
+}
diff --git a/tools/builtInChips/RegisterWithGUI.class b/tools/builtInChips/RegisterWithGUI.class
new file mode 100644
index 0000000..c80208c
--- /dev/null
+++ b/tools/builtInChips/RegisterWithGUI.class
Binary files differ
diff --git a/tools/builtInChips/Screen.class b/tools/builtInChips/Screen.class
new file mode 100644
index 0000000..100ed03
--- /dev/null
+++ b/tools/builtInChips/Screen.class
Binary files differ
diff --git a/tools/builtInChips/Screen.hdl b/tools/builtInChips/Screen.hdl
new file mode 100644
index 0000000..5e7837b
--- /dev/null
+++ b/tools/builtInChips/Screen.hdl
@@ -0,0 +1,35 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Screen.hdl
+
+/**
+ * The Screen (memory map).
+ * Functions exactly like a 16-bit 8K RAM:
+ * 1. out(t)=Screen[address(t)](t)
+ * 2. If load(t-1) then Screen[address(t-1)](t)=in(t-1)
+ *
+ * The built-in chip implementation has the side effect of continuously
+ * refreshing a visual 256 by 512 black-and-white screen, simulated
+ * by the simulator. Each row in the visual screen is represented
+ * by 32 consecutive 16-bit words, starting at the top left corner
+ * of the visual screen. Thus the pixel at row r from the top and
+ * column c from the left (0<=r<=255, 0<=c<=511) reflects the c%16
+ * bit (counting from LSB to MSB) of the word found in
+ * Screen[r*32+c/16].
+ */
+
+CHIP Screen {
+
+ IN in[16], // what to write
+ load, // write-enable bit
+ address[13]; // where to read/write
+ OUT out[16]; // Screen value at the given address
+
+ BUILTIN Screen;
+ CLOCKED in, load;
+}
+
+
+
+ \ No newline at end of file
diff --git a/tools/builtInChips/Xor.class b/tools/builtInChips/Xor.class
new file mode 100644
index 0000000..d99ad18
--- /dev/null
+++ b/tools/builtInChips/Xor.class
Binary files differ
diff --git a/tools/builtInChips/Xor.hdl b/tools/builtInChips/Xor.hdl
new file mode 100644
index 0000000..8452d73
--- /dev/null
+++ b/tools/builtInChips/Xor.hdl
@@ -0,0 +1,16 @@
+// This file is part of www.nand2tetris.org
+// and the book "The Elements of Computing Systems"
+// by Nisan and Schocken, MIT Press.
+// File name: tools/builtIn/Xor.hdl
+
+/**
+ * Exclusive-or gate: out = !(a == b).
+ */
+
+CHIP Xor {
+
+ IN a, b;
+ OUT out;
+
+ BUILTIN Xor;
+}
diff --git a/tools/builtInVMCode/Array.class b/tools/builtInVMCode/Array.class
new file mode 100644
index 0000000..c76b652
--- /dev/null
+++ b/tools/builtInVMCode/Array.class
Binary files differ
diff --git a/tools/builtInVMCode/JackOSClass.class b/tools/builtInVMCode/JackOSClass.class
new file mode 100644
index 0000000..25df72a
--- /dev/null
+++ b/tools/builtInVMCode/JackOSClass.class
Binary files differ
diff --git a/tools/builtInVMCode/Keyboard.class b/tools/builtInVMCode/Keyboard.class
new file mode 100644
index 0000000..7366f75
--- /dev/null
+++ b/tools/builtInVMCode/Keyboard.class
Binary files differ
diff --git a/tools/builtInVMCode/Math.class b/tools/builtInVMCode/Math.class
new file mode 100644
index 0000000..71aef91
--- /dev/null
+++ b/tools/builtInVMCode/Math.class
Binary files differ
diff --git a/tools/builtInVMCode/Memory.class b/tools/builtInVMCode/Memory.class
new file mode 100644
index 0000000..e9bb7ad
--- /dev/null
+++ b/tools/builtInVMCode/Memory.class
Binary files differ
diff --git a/tools/builtInVMCode/Output.class b/tools/builtInVMCode/Output.class
new file mode 100644
index 0000000..65b25b7
--- /dev/null
+++ b/tools/builtInVMCode/Output.class
Binary files differ
diff --git a/tools/builtInVMCode/Screen.class b/tools/builtInVMCode/Screen.class
new file mode 100644
index 0000000..8644e09
--- /dev/null
+++ b/tools/builtInVMCode/Screen.class
Binary files differ
diff --git a/tools/builtInVMCode/String.class b/tools/builtInVMCode/String.class
new file mode 100644
index 0000000..98c7f58
--- /dev/null
+++ b/tools/builtInVMCode/String.class
Binary files differ
diff --git a/tools/builtInVMCode/Sys.class b/tools/builtInVMCode/Sys.class
new file mode 100644
index 0000000..0c15f1b
--- /dev/null
+++ b/tools/builtInVMCode/Sys.class
Binary files differ