From a000308104aab27c2dde9a306f1bc654b2db4806 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 29 Nov 2017 12:30:41 +0100 Subject: first commit --- projects/00/file.txt | 6 + projects/01/And.cmp | 5 + projects/01/And.hdl | 20 + projects/01/And.out | 5 + projects/01/And.tst | 29 + projects/01/And16.cmp | 7 + projects/01/And16.hdl | 17 + projects/01/And16.tst | 39 + projects/01/DMux.cmp | 5 + projects/01/DMux.hdl | 21 + projects/01/DMux.out | 5 + projects/01/DMux.tst | 27 + projects/01/DMux4Way.cmp | 9 + projects/01/DMux4Way.hdl | 20 + projects/01/DMux4Way.tst | 43 + projects/01/DMux8Way.cmp | 17 + projects/01/DMux8Way.hdl | 20 + projects/01/DMux8Way.tst | 75 + projects/01/Mux.cmp | 9 + projects/01/Mux.hdl | 22 + projects/01/Mux.out | 9 + projects/01/Mux.tst | 49 + projects/01/Mux16.cmp | 9 + projects/01/Mux16.hdl | 18 + projects/01/Mux16.tst | 49 + projects/01/Mux4Way16.cmp | 9 + projects/01/Mux4Way16.hdl | 20 + projects/01/Mux4Way16.tst | 49 + projects/01/Mux8Way16.cmp | 17 + projects/01/Mux8Way16.hdl | 22 + projects/01/Mux8Way16.tst | 89 + projects/01/Not.cmp | 3 + projects/01/Not.hdl | 18 + projects/01/Not.out | 3 + projects/01/Not.tst | 17 + projects/01/Not16.cmp | 6 + projects/01/Not16.hdl | 17 + projects/01/Not16.tst | 29 + projects/01/Or.cmp | 5 + projects/01/Or.hdl | 21 + projects/01/Or.out | 5 + projects/01/Or.tst | 29 + projects/01/Or16.cmp | 7 + projects/01/Or16.hdl | 17 + projects/01/Or16.tst | 39 + projects/01/Or8Way.cmp | 6 + projects/01/Or8Way.hdl | 17 + projects/01/Or8Way.tst | 29 + projects/01/Xor.cmp | 5 + projects/01/Xor.hdl | 22 + projects/01/Xor.out | 5 + projects/01/Xor.tst | 29 + projects/02/ALU-nostat.cmp | 37 + projects/02/ALU-nostat.tst | 353 + projects/02/ALU.cmp | 37 + projects/02/ALU.hdl | 46 + projects/02/ALU.tst | 377 + projects/02/Add16.cmp | 7 + projects/02/Add16.hdl | 17 + projects/02/Add16.tst | 39 + projects/02/FullAdder.cmp | 9 + projects/02/FullAdder.hdl | 17 + projects/02/FullAdder.tst | 47 + projects/02/HalfAdder.cmp | 5 + projects/02/HalfAdder.hdl | 17 + projects/02/HalfAdder.tst | 29 + projects/02/Inc16.cmp | 5 + projects/02/Inc16.hdl | 17 + projects/02/Inc16.tst | 25 + projects/03/a/Bit.cmp | 215 + projects/03/a/Bit.hdl | 18 + projects/03/a/Bit.tst | 865 + projects/03/a/PC.cmp | 31 + projects/03/a/PC.hdl | 20 + projects/03/a/PC.tst | 125 + projects/03/a/RAM64.cmp | 320 + projects/03/a/RAM64.hdl | 19 + projects/03/a/RAM64.tst | 1026 + projects/03/a/RAM8.cmp | 173 + projects/03/a/RAM8.hdl | 19 + projects/03/a/RAM8.tst | 560 + projects/03/a/Register.cmp | 149 + projects/03/a/Register.hdl | 18 + projects/03/a/Register.tst | 569 + projects/03/b/RAM16K.cmp | 320 + projects/03/b/RAM16K.hdl | 19 + projects/03/b/RAM16K.tst | 1026 + projects/03/b/RAM4K.cmp | 320 + projects/03/b/RAM4K.hdl | 19 + projects/03/b/RAM4K.tst | 1026 + projects/03/b/RAM512.cmp | 320 + projects/03/b/RAM512.hdl | 19 + projects/03/b/RAM512.tst | 1027 + projects/04/fill/Fill.asm | 14 + projects/04/fill/Fill.tst | 11 + projects/04/fill/FillAutomatic.cmp | 4 + projects/04/fill/FillAutomatic.tst | 37 + projects/04/mult/Mult.cmp | 7 + projects/04/mult/Mult.tst | 74 + projects/04/mult/mult.asm | 9 + projects/05/Add.hack | 6 + projects/05/CPU-external.cmp | 93 + projects/05/CPU-external.tst | 150 + projects/05/CPU.cmp | 93 + projects/05/CPU.hdl | 43 + projects/05/CPU.tst | 150 + projects/05/Computer.hdl | 23 + projects/05/ComputerAdd-external.cmp | 15 + projects/05/ComputerAdd-external.tst | 32 + projects/05/ComputerAdd.cmp | 15 + projects/05/ComputerAdd.tst | 32 + projects/05/ComputerMax-external.cmp | 28 + projects/05/ComputerMax-external.tst | 38 + projects/05/ComputerMax.cmp | 28 + projects/05/ComputerMax.tst | 39 + projects/05/ComputerRect-external.cmp | 65 + projects/05/ComputerRect-external.tst | 26 + projects/05/ComputerRect.cmp | 65 + projects/05/ComputerRect.tst | 26 + projects/05/Max.hack | 16 + projects/05/Memory.cmp | 54 + projects/05/Memory.hdl | 31 + projects/05/Memory.tst | 163 + projects/05/Rect.hack | 25 + projects/06/add/Add.asm | 13 + projects/06/max/Max.asm | 26 + projects/06/max/MaxL.asm | 23 + projects/06/pong/Pong.asm | 28375 +++++++++++++++++++ projects/06/pong/PongL.asm | 27490 ++++++++++++++++++ projects/06/rect/Rect.asm | 35 + projects/06/rect/RectL.asm | 32 + projects/07/MemoryAccess/BasicTest/BasicTest.cmp | 2 + projects/07/MemoryAccess/BasicTest/BasicTest.tst | 25 + projects/07/MemoryAccess/BasicTest/BasicTest.vm | 31 + .../07/MemoryAccess/BasicTest/BasicTestVME.tst | 25 + .../07/MemoryAccess/PointerTest/PointerTest.cmp | 2 + .../07/MemoryAccess/PointerTest/PointerTest.tst | 20 + .../07/MemoryAccess/PointerTest/PointerTest.vm | 22 + .../07/MemoryAccess/PointerTest/PointerTestVME.tst | 20 + projects/07/MemoryAccess/StaticTest/StaticTest.cmp | 2 + projects/07/MemoryAccess/StaticTest/StaticTest.tst | 17 + projects/07/MemoryAccess/StaticTest/StaticTest.vm | 17 + .../07/MemoryAccess/StaticTest/StaticTestVME.tst | 17 + .../07/StackArithmetic/SimpleAdd/SimpleAdd.cmp | 2 + .../07/StackArithmetic/SimpleAdd/SimpleAdd.tst | 17 + projects/07/StackArithmetic/SimpleAdd/SimpleAdd.vm | 9 + .../07/StackArithmetic/SimpleAdd/SimpleAddVME.tst | 17 + .../07/StackArithmetic/StackTest/StackTest.cmp | 4 + .../07/StackArithmetic/StackTest/StackTest.tst | 22 + projects/07/StackArithmetic/StackTest/StackTest.vm | 45 + .../07/StackArithmetic/StackTest/StackTestVME.tst | 22 + .../FibonacciElement/FibonacciElement.cmp | 2 + .../FibonacciElement/FibonacciElement.tst | 18 + .../FibonacciElement/FibonacciElementVME.tst | 17 + projects/08/FunctionCalls/FibonacciElement/Main.vm | 30 + projects/08/FunctionCalls/FibonacciElement/Sys.vm | 15 + .../08/FunctionCalls/NestedCall/NestedCall.cmp | 2 + .../08/FunctionCalls/NestedCall/NestedCall.html | 196 + .../08/FunctionCalls/NestedCall/NestedCall.tst | 65 + .../FunctionCalls/NestedCall/NestedCallStack.html | 306 + .../08/FunctionCalls/NestedCall/NestedCallVME.tst | 70 + projects/08/FunctionCalls/NestedCall/Sys.vm | 63 + .../SimpleFunction/SimpleFunction.cmp | 2 + .../SimpleFunction/SimpleFunction.tst | 29 + .../FunctionCalls/SimpleFunction/SimpleFunction.vm | 16 + .../SimpleFunction/SimpleFunctionVME.tst | 29 + projects/08/FunctionCalls/StaticsTest/Class1.vm | 20 + projects/08/FunctionCalls/StaticsTest/Class2.vm | 20 + .../08/FunctionCalls/StaticsTest/StaticsTest.cmp | 2 + .../08/FunctionCalls/StaticsTest/StaticsTest.tst | 17 + .../FunctionCalls/StaticsTest/StaticsTestVME.tst | 17 + projects/08/FunctionCalls/StaticsTest/Sys.vm | 20 + projects/08/ProgramFlow/BasicLoop/BasicLoop.cmp | 2 + projects/08/ProgramFlow/BasicLoop/BasicLoop.tst | 20 + projects/08/ProgramFlow/BasicLoop/BasicLoop.vm | 22 + projects/08/ProgramFlow/BasicLoop/BasicLoopVME.tst | 20 + .../FibonacciSeries/FibonacciSeries.cmp | 2 + .../FibonacciSeries/FibonacciSeries.tst | 22 + .../ProgramFlow/FibonacciSeries/FibonacciSeries.vm | 49 + .../FibonacciSeries/FibonacciSeriesVME.tst | 22 + projects/09/Average/Main.jack | 27 + projects/09/BitmapEditor/BitmapEditor.html | 200 + projects/09/BitmapEditor/BitmapEditor.iml | 10 + projects/09/Fraction/Fraction.jack | 65 + projects/09/Fraction/Main.jack | 16 + projects/09/HelloWorld/Main.jack | 14 + projects/09/Jack OS API.pdf | Bin 0 -> 108857 bytes projects/09/List/List.jack | 46 + projects/09/List/Main.jack | 17 + projects/09/Square/Main.jack | 15 + projects/09/Square/Square.jack | 108 + projects/09/Square/SquareGame.jack | 79 + projects/10/ArrayTest/Main.jack | 38 + projects/10/ArrayTest/Main.xml | 286 + projects/10/ArrayTest/MainT.xml | 142 + projects/10/ExpressionLessSquare/Main.jack | 36 + projects/10/ExpressionLessSquare/Main.xml | 205 + projects/10/ExpressionLessSquare/MainT.xml | 109 + projects/10/ExpressionLessSquare/Square.jack | 99 + projects/10/ExpressionLessSquare/Square.xml | 967 + projects/10/ExpressionLessSquare/SquareGame.jack | 60 + projects/10/ExpressionLessSquare/SquareGame.xml | 544 + projects/10/ExpressionLessSquare/SquareGameT.xml | 268 + projects/10/ExpressionLessSquare/SquareT.xml | 449 + projects/10/Square/Main.jack | 36 + projects/10/Square/Main.xml | 244 + projects/10/Square/MainT.xml | 126 + projects/10/Square/Square.jack | 110 + projects/10/Square/Square.xml | 1211 + projects/10/Square/SquareGame.jack | 81 + projects/10/Square/SquareGame.xml | 643 + projects/10/Square/SquareGameT.xml | 315 + projects/10/Square/SquareT.xml | 561 + projects/11/Average/Main.jack | 29 + projects/11/ComplexArrays/Main.jack | 70 + projects/11/ConvertToBin/Main.jack | 82 + projects/11/Pong/Ball.jack | 203 + projects/11/Pong/Bat.jack | 103 + projects/11/Pong/Main.jack | 20 + projects/11/Pong/PongGame.jack | 137 + projects/11/Seven/Main.jack | 17 + projects/11/Square/Main.jack | 17 + projects/11/Square/Square.jack | 110 + projects/11/Square/SquareGame.jack | 81 + projects/12/Array.jack | 23 + projects/12/ArrayTest/ArrayTest.cmp | 2 + projects/12/ArrayTest/ArrayTest.tst | 15 + projects/12/ArrayTest/Main.jack | 40 + projects/12/Keyboard.jack | 62 + projects/12/KeyboardTest/KeyboardTestOutput.gif | Bin 0 -> 12048 bytes projects/12/KeyboardTest/Main.jack | 93 + projects/12/Math.jack | 47 + projects/12/MathTest/Main.jack | 35 + projects/12/MathTest/MathTest.cmp | 2 + projects/12/MathTest/MathTest.tst | 15 + projects/12/Memory.jack | 34 + projects/12/MemoryTest/Main.jack | 42 + projects/12/MemoryTest/MemoryTest.cmp | 2 + projects/12/MemoryTest/MemoryTest.tst | 15 + projects/12/Output.jack | 203 + projects/12/OutputTest/Main.jack | 42 + projects/12/OutputTest/OutputTestOutput.gif | Bin 0 -> 6184 bytes projects/12/Screen.jack | 43 + projects/12/ScreenTest/Main.jack | 36 + projects/12/ScreenTest/ScreenTestOutput.gif | Bin 0 -> 4563 bytes projects/12/String.jack | 64 + projects/12/StringTest/Main.jack | 83 + projects/12/StringTest/StringTestOutput.gif | Bin 0 -> 8126 bytes projects/12/Sys.jack | 27 + projects/12/SysTest/Main.jack | 31 + projects/13/more fun to go.txt | 9 + projects/demo/Xor.cmp | 5 + projects/demo/Xor.hdl | 25 + projects/demo/Xor.out | 0 projects/demo/Xor.tst | 29 + tools/.DS_Store | Bin 0 -> 8196 bytes tools/Assembler.bat | 27 + tools/Assembler.sh | 32 + tools/CPUEmulator.bat | 29 + tools/CPUEmulator.sh | 33 + tools/HardwareSimulator.bat | 30 + tools/HardwareSimulator.sh | 34 + tools/JackCompiler.bat | 26 + tools/JackCompiler.sh | 35 + tools/OS/Array.vm | 23 + tools/OS/Keyboard.vm | 102 + tools/OS/Math.vm | 408 + tools/OS/Memory.vm | 279 + tools/OS/Output.vm | 1852 ++ tools/OS/Screen.vm | 806 + tools/OS/String.vm | 393 + tools/OS/Sys.vm | 84 + tools/TextComparer.bat | 29 + tools/TextComparer.sh | 36 + tools/VMEmulator.bat | 29 + tools/VMEmulator.sh | 33 + tools/bin/classes/CPUEmulatorMain.class | Bin 0 -> 1084 bytes tools/bin/classes/HackAssemblerMain.class | Bin 0 -> 1098 bytes tools/bin/classes/HardwareSimulatorMain.class | Bin 0 -> 1182 bytes tools/bin/classes/TextComparer.class | Bin 0 -> 1739 bytes tools/bin/classes/VMEmulatorMain.class | Bin 0 -> 1073 bytes tools/bin/help/asmAbout.html | 96 + tools/bin/help/asmUsage.html | 115 + tools/bin/help/compiler.txt | 9 + tools/bin/help/cpuAbout.html | 96 + tools/bin/help/cpuUsage.html | 115 + tools/bin/help/hwAbout.html | 96 + tools/bin/help/hwUsage.html | 115 + tools/bin/help/vmAbout.html | 110 + tools/bin/help/vmUsage.html | 115 + tools/bin/images/arrow2.gif | Bin 0 -> 1073 bytes tools/bin/images/calculator2.gif | Bin 0 -> 302 bytes tools/bin/images/cancel.gif | Bin 0 -> 1133 bytes tools/bin/images/chip.gif | Bin 0 -> 1078 bytes tools/bin/images/clock2.gif | Bin 0 -> 1138 bytes tools/bin/images/equal.gif | Bin 0 -> 1042 bytes tools/bin/images/find.gif | Bin 0 -> 1014 bytes tools/bin/images/hex.gif | Bin 0 -> 1422 bytes tools/bin/images/keyboard.gif | Bin 0 -> 1017 bytes tools/bin/images/ok.gif | Bin 0 -> 988 bytes tools/bin/images/ok2.gif | Bin 0 -> 920 bytes tools/bin/images/open.gif | Bin 0 -> 930 bytes tools/bin/images/open2.gif | Bin 0 -> 969 bytes tools/bin/images/opendoc.gif | Bin 0 -> 1094 bytes tools/bin/images/redflag.gif | Bin 0 -> 1100 bytes tools/bin/images/save.gif | Bin 0 -> 1257 bytes tools/bin/images/scroll.gif | Bin 0 -> 949 bytes tools/bin/images/smallcancel.gif | Bin 0 -> 946 bytes tools/bin/images/smallequal.gif | Bin 0 -> 898 bytes tools/bin/images/smallminus.gif | Bin 0 -> 863 bytes tools/bin/images/smallnew.gif | Bin 0 -> 1000 bytes tools/bin/images/smallok.gif | Bin 0 -> 925 bytes tools/bin/images/smallplus.gif | Bin 0 -> 873 bytes tools/bin/images/vcrfastforward.gif | Bin 0 -> 1122 bytes tools/bin/images/vcrforward.gif | Bin 0 -> 1021 bytes tools/bin/images/vcrrewind.gif | Bin 0 -> 1122 bytes tools/bin/images/vcrstop.gif | Bin 0 -> 972 bytes tools/bin/lib/AssemblerGUI.jar | Bin 0 -> 4470 bytes tools/bin/lib/Compilers.jar | Bin 0 -> 27094 bytes tools/bin/lib/Hack.jar | Bin 0 -> 59364 bytes tools/bin/lib/HackGUI.jar | Bin 0 -> 96666 bytes tools/bin/lib/Simulators.jar | Bin 0 -> 81810 bytes tools/bin/lib/SimulatorsGUI.jar | Bin 0 -> 68492 bytes tools/bin/lib/TranslatorsGUI.jar | Bin 0 -> 13643 bytes tools/bin/scripts/defaultCPU.txt | 3 + tools/bin/scripts/defaultHW.txt | 4 + tools/bin/scripts/defaultVM.txt | 3 + tools/builtInChips/ALU.class | Bin 0 -> 1754 bytes tools/builtInChips/ALU.hdl | 55 + tools/builtInChips/ARegister.class | Bin 0 -> 337 bytes tools/builtInChips/ARegister.hdl | 24 + tools/builtInChips/Add16.class | Bin 0 -> 343 bytes tools/builtInChips/Add16.hdl | 18 + tools/builtInChips/And.class | Bin 0 -> 341 bytes tools/builtInChips/And.hdl | 16 + tools/builtInChips/And16.hdl | 17 + tools/builtInChips/Bit.class | Bin 0 -> 416 bytes tools/builtInChips/Bit.hdl | 19 + tools/builtInChips/DFF.class | Bin 0 -> 401 bytes tools/builtInChips/DFF.hdl | 18 + tools/builtInChips/DMux.class | Bin 0 -> 365 bytes tools/builtInChips/DMux.hdl | 20 + tools/builtInChips/DMux4Way.class | Bin 0 -> 408 bytes tools/builtInChips/DMux4Way.hdl | 22 + tools/builtInChips/DMux8Way.class | Bin 0 -> 488 bytes tools/builtInChips/DMux8Way.hdl | 22 + tools/builtInChips/DRegister.class | Bin 0 -> 339 bytes tools/builtInChips/DRegister.hdl | 24 + tools/builtInChips/FullAdder.class | Bin 0 -> 380 bytes tools/builtInChips/FullAdder.hdl | 19 + tools/builtInChips/HalfAdder.class | Bin 0 -> 360 bytes tools/builtInChips/HalfAdder.hdl | 18 + tools/builtInChips/Inc16.class | Bin 0 -> 333 bytes tools/builtInChips/Inc16.hdl | 18 + tools/builtInChips/Keyboard.class | Bin 0 -> 1709 bytes tools/builtInChips/Keyboard.hdl | 23 + tools/builtInChips/Mux.class | Bin 0 -> 356 bytes tools/builtInChips/Mux.hdl | 16 + tools/builtInChips/Mux16.hdl | 16 + tools/builtInChips/Mux4Way16.class | Bin 0 -> 435 bytes tools/builtInChips/Mux4Way16.hdl | 21 + tools/builtInChips/Mux8Way16.class | Bin 0 -> 527 bytes tools/builtInChips/Mux8Way16.hdl | 24 + tools/builtInChips/Nand.class | Bin 0 -> 344 bytes tools/builtInChips/Nand.hdl | 16 + tools/builtInChips/Not.class | Bin 0 -> 331 bytes tools/builtInChips/Not.hdl | 16 + tools/builtInChips/Not16.class | Bin 0 -> 327 bytes tools/builtInChips/Not16.hdl | 16 + tools/builtInChips/Or.class | Bin 0 -> 340 bytes tools/builtInChips/Or.hdl | 16 + tools/builtInChips/Or16.hdl | 16 + tools/builtInChips/Or8Way.class | Bin 0 -> 340 bytes tools/builtInChips/Or8Way.hdl | 16 + tools/builtInChips/PC.class | Bin 0 -> 1899 bytes tools/builtInChips/PC.hdl | 22 + tools/builtInChips/RAM.class | Bin 0 -> 1928 bytes tools/builtInChips/RAM16K.class | Bin 0 -> 390 bytes tools/builtInChips/RAM16K.hdl | 24 + tools/builtInChips/RAM4K.class | Bin 0 -> 309 bytes tools/builtInChips/RAM4K.hdl | 24 + tools/builtInChips/RAM512.class | Bin 0 -> 311 bytes tools/builtInChips/RAM512.hdl | 24 + tools/builtInChips/RAM64.class | Bin 0 -> 308 bytes tools/builtInChips/RAM64.hdl | 24 + tools/builtInChips/RAM8.class | Bin 0 -> 306 bytes tools/builtInChips/RAM8.hdl | 24 + tools/builtInChips/ROM32K.class | Bin 0 -> 3469 bytes tools/builtInChips/ROM32K.hdl | 30 + tools/builtInChips/Register.class | Bin 0 -> 423 bytes tools/builtInChips/Register.hdl | 19 + tools/builtInChips/RegisterWithGUI.class | Bin 0 -> 1769 bytes tools/builtInChips/Screen.class | Bin 0 -> 1322 bytes tools/builtInChips/Screen.hdl | 35 + tools/builtInChips/Xor.class | Bin 0 -> 341 bytes tools/builtInChips/Xor.hdl | 16 + tools/builtInVMCode/Array.class | Bin 0 -> 436 bytes tools/builtInVMCode/JackOSClass.class | Bin 0 -> 1782 bytes tools/builtInVMCode/Keyboard.class | Bin 0 -> 1362 bytes tools/builtInVMCode/Math.class | Bin 0 -> 650 bytes tools/builtInVMCode/Memory.class | Bin 0 -> 788 bytes tools/builtInVMCode/Output.class | Bin 0 -> 4264 bytes tools/builtInVMCode/Screen.class | Bin 0 -> 1921 bytes tools/builtInVMCode/String.class | Bin 0 -> 1630 bytes tools/builtInVMCode/Sys.class | Bin 0 -> 1885 bytes 405 files changed, 84201 insertions(+) create mode 100644 projects/00/file.txt create mode 100644 projects/01/And.cmp create mode 100644 projects/01/And.hdl create mode 100644 projects/01/And.out create mode 100644 projects/01/And.tst create mode 100644 projects/01/And16.cmp create mode 100644 projects/01/And16.hdl create mode 100644 projects/01/And16.tst create mode 100644 projects/01/DMux.cmp create mode 100644 projects/01/DMux.hdl create mode 100644 projects/01/DMux.out create mode 100644 projects/01/DMux.tst create mode 100644 projects/01/DMux4Way.cmp create mode 100644 projects/01/DMux4Way.hdl create mode 100644 projects/01/DMux4Way.tst create mode 100644 projects/01/DMux8Way.cmp create mode 100644 projects/01/DMux8Way.hdl create mode 100644 projects/01/DMux8Way.tst create mode 100644 projects/01/Mux.cmp create mode 100644 projects/01/Mux.hdl create mode 100644 projects/01/Mux.out create mode 100644 projects/01/Mux.tst create mode 100644 projects/01/Mux16.cmp create mode 100644 projects/01/Mux16.hdl create mode 100644 projects/01/Mux16.tst create mode 100644 projects/01/Mux4Way16.cmp create mode 100644 projects/01/Mux4Way16.hdl create mode 100644 projects/01/Mux4Way16.tst create mode 100644 projects/01/Mux8Way16.cmp create mode 100644 projects/01/Mux8Way16.hdl create mode 100644 projects/01/Mux8Way16.tst create mode 100644 projects/01/Not.cmp create mode 100644 projects/01/Not.hdl create mode 100644 projects/01/Not.out create mode 100644 projects/01/Not.tst create mode 100644 projects/01/Not16.cmp create mode 100644 projects/01/Not16.hdl create mode 100644 projects/01/Not16.tst create mode 100644 projects/01/Or.cmp create mode 100644 projects/01/Or.hdl create mode 100644 projects/01/Or.out create mode 100644 projects/01/Or.tst create mode 100644 projects/01/Or16.cmp create mode 100644 projects/01/Or16.hdl create mode 100644 projects/01/Or16.tst create mode 100644 projects/01/Or8Way.cmp create mode 100644 projects/01/Or8Way.hdl create mode 100644 projects/01/Or8Way.tst create mode 100644 projects/01/Xor.cmp create mode 100644 projects/01/Xor.hdl create mode 100644 projects/01/Xor.out create mode 100644 projects/01/Xor.tst create mode 100644 projects/02/ALU-nostat.cmp create mode 100644 projects/02/ALU-nostat.tst create mode 100644 projects/02/ALU.cmp create mode 100644 projects/02/ALU.hdl create mode 100644 projects/02/ALU.tst create mode 100644 projects/02/Add16.cmp create mode 100644 projects/02/Add16.hdl create mode 100644 projects/02/Add16.tst create mode 100644 projects/02/FullAdder.cmp create mode 100644 projects/02/FullAdder.hdl create mode 100644 projects/02/FullAdder.tst create mode 100644 projects/02/HalfAdder.cmp create mode 100644 projects/02/HalfAdder.hdl create mode 100644 projects/02/HalfAdder.tst create mode 100644 projects/02/Inc16.cmp create mode 100644 projects/02/Inc16.hdl create mode 100644 projects/02/Inc16.tst create mode 100644 projects/03/a/Bit.cmp create mode 100644 projects/03/a/Bit.hdl create mode 100644 projects/03/a/Bit.tst create mode 100644 projects/03/a/PC.cmp create mode 100644 projects/03/a/PC.hdl create mode 100644 projects/03/a/PC.tst create mode 100644 projects/03/a/RAM64.cmp create mode 100644 projects/03/a/RAM64.hdl create mode 100644 projects/03/a/RAM64.tst create mode 100644 projects/03/a/RAM8.cmp create mode 100644 projects/03/a/RAM8.hdl create mode 100644 projects/03/a/RAM8.tst create mode 100644 projects/03/a/Register.cmp create mode 100644 projects/03/a/Register.hdl create mode 100644 projects/03/a/Register.tst create mode 100644 projects/03/b/RAM16K.cmp create mode 100644 projects/03/b/RAM16K.hdl create mode 100644 projects/03/b/RAM16K.tst create mode 100644 projects/03/b/RAM4K.cmp create mode 100644 projects/03/b/RAM4K.hdl create mode 100644 projects/03/b/RAM4K.tst create mode 100644 projects/03/b/RAM512.cmp create mode 100644 projects/03/b/RAM512.hdl create mode 100644 projects/03/b/RAM512.tst create mode 100644 projects/04/fill/Fill.asm create mode 100644 projects/04/fill/Fill.tst create mode 100644 projects/04/fill/FillAutomatic.cmp create mode 100644 projects/04/fill/FillAutomatic.tst create mode 100644 projects/04/mult/Mult.cmp create mode 100644 projects/04/mult/Mult.tst create mode 100644 projects/04/mult/mult.asm create mode 100644 projects/05/Add.hack create mode 100644 projects/05/CPU-external.cmp create mode 100644 projects/05/CPU-external.tst create mode 100644 projects/05/CPU.cmp create mode 100644 projects/05/CPU.hdl create mode 100644 projects/05/CPU.tst create mode 100644 projects/05/Computer.hdl create mode 100644 projects/05/ComputerAdd-external.cmp create mode 100644 projects/05/ComputerAdd-external.tst create mode 100644 projects/05/ComputerAdd.cmp create mode 100644 projects/05/ComputerAdd.tst create mode 100644 projects/05/ComputerMax-external.cmp create mode 100644 projects/05/ComputerMax-external.tst create mode 100644 projects/05/ComputerMax.cmp create mode 100644 projects/05/ComputerMax.tst create mode 100644 projects/05/ComputerRect-external.cmp create mode 100644 projects/05/ComputerRect-external.tst create mode 100644 projects/05/ComputerRect.cmp create mode 100644 projects/05/ComputerRect.tst create mode 100644 projects/05/Max.hack create mode 100644 projects/05/Memory.cmp create mode 100644 projects/05/Memory.hdl create mode 100644 projects/05/Memory.tst create mode 100644 projects/05/Rect.hack create mode 100644 projects/06/add/Add.asm create mode 100644 projects/06/max/Max.asm create mode 100644 projects/06/max/MaxL.asm create mode 100644 projects/06/pong/Pong.asm create mode 100644 projects/06/pong/PongL.asm create mode 100644 projects/06/rect/Rect.asm create mode 100644 projects/06/rect/RectL.asm create mode 100644 projects/07/MemoryAccess/BasicTest/BasicTest.cmp create mode 100644 projects/07/MemoryAccess/BasicTest/BasicTest.tst create mode 100644 projects/07/MemoryAccess/BasicTest/BasicTest.vm create mode 100644 projects/07/MemoryAccess/BasicTest/BasicTestVME.tst create mode 100644 projects/07/MemoryAccess/PointerTest/PointerTest.cmp create mode 100644 projects/07/MemoryAccess/PointerTest/PointerTest.tst create mode 100644 projects/07/MemoryAccess/PointerTest/PointerTest.vm create mode 100644 projects/07/MemoryAccess/PointerTest/PointerTestVME.tst create mode 100644 projects/07/MemoryAccess/StaticTest/StaticTest.cmp create mode 100644 projects/07/MemoryAccess/StaticTest/StaticTest.tst create mode 100644 projects/07/MemoryAccess/StaticTest/StaticTest.vm create mode 100644 projects/07/MemoryAccess/StaticTest/StaticTestVME.tst create mode 100644 projects/07/StackArithmetic/SimpleAdd/SimpleAdd.cmp create mode 100644 projects/07/StackArithmetic/SimpleAdd/SimpleAdd.tst create mode 100644 projects/07/StackArithmetic/SimpleAdd/SimpleAdd.vm create mode 100644 projects/07/StackArithmetic/SimpleAdd/SimpleAddVME.tst create mode 100644 projects/07/StackArithmetic/StackTest/StackTest.cmp create mode 100644 projects/07/StackArithmetic/StackTest/StackTest.tst create mode 100644 projects/07/StackArithmetic/StackTest/StackTest.vm create mode 100644 projects/07/StackArithmetic/StackTest/StackTestVME.tst create mode 100644 projects/08/FunctionCalls/FibonacciElement/FibonacciElement.cmp create mode 100644 projects/08/FunctionCalls/FibonacciElement/FibonacciElement.tst create mode 100644 projects/08/FunctionCalls/FibonacciElement/FibonacciElementVME.tst create mode 100644 projects/08/FunctionCalls/FibonacciElement/Main.vm create mode 100644 projects/08/FunctionCalls/FibonacciElement/Sys.vm create mode 100644 projects/08/FunctionCalls/NestedCall/NestedCall.cmp create mode 100644 projects/08/FunctionCalls/NestedCall/NestedCall.html create mode 100644 projects/08/FunctionCalls/NestedCall/NestedCall.tst create mode 100644 projects/08/FunctionCalls/NestedCall/NestedCallStack.html create mode 100644 projects/08/FunctionCalls/NestedCall/NestedCallVME.tst create mode 100644 projects/08/FunctionCalls/NestedCall/Sys.vm create mode 100644 projects/08/FunctionCalls/SimpleFunction/SimpleFunction.cmp create mode 100644 projects/08/FunctionCalls/SimpleFunction/SimpleFunction.tst create mode 100644 projects/08/FunctionCalls/SimpleFunction/SimpleFunction.vm create mode 100644 projects/08/FunctionCalls/SimpleFunction/SimpleFunctionVME.tst create mode 100644 projects/08/FunctionCalls/StaticsTest/Class1.vm create mode 100644 projects/08/FunctionCalls/StaticsTest/Class2.vm create mode 100644 projects/08/FunctionCalls/StaticsTest/StaticsTest.cmp create mode 100644 projects/08/FunctionCalls/StaticsTest/StaticsTest.tst create mode 100644 projects/08/FunctionCalls/StaticsTest/StaticsTestVME.tst create mode 100644 projects/08/FunctionCalls/StaticsTest/Sys.vm create mode 100644 projects/08/ProgramFlow/BasicLoop/BasicLoop.cmp create mode 100644 projects/08/ProgramFlow/BasicLoop/BasicLoop.tst create mode 100644 projects/08/ProgramFlow/BasicLoop/BasicLoop.vm create mode 100644 projects/08/ProgramFlow/BasicLoop/BasicLoopVME.tst create mode 100644 projects/08/ProgramFlow/FibonacciSeries/FibonacciSeries.cmp create mode 100644 projects/08/ProgramFlow/FibonacciSeries/FibonacciSeries.tst create mode 100644 projects/08/ProgramFlow/FibonacciSeries/FibonacciSeries.vm create mode 100644 projects/08/ProgramFlow/FibonacciSeries/FibonacciSeriesVME.tst create mode 100644 projects/09/Average/Main.jack create mode 100644 projects/09/BitmapEditor/BitmapEditor.html create mode 100644 projects/09/BitmapEditor/BitmapEditor.iml create mode 100644 projects/09/Fraction/Fraction.jack create mode 100644 projects/09/Fraction/Main.jack create mode 100644 projects/09/HelloWorld/Main.jack create mode 100644 projects/09/Jack OS API.pdf create mode 100644 projects/09/List/List.jack create mode 100644 projects/09/List/Main.jack create mode 100644 projects/09/Square/Main.jack create mode 100644 projects/09/Square/Square.jack create mode 100644 projects/09/Square/SquareGame.jack create mode 100644 projects/10/ArrayTest/Main.jack create mode 100644 projects/10/ArrayTest/Main.xml create mode 100644 projects/10/ArrayTest/MainT.xml create mode 100644 projects/10/ExpressionLessSquare/Main.jack create mode 100644 projects/10/ExpressionLessSquare/Main.xml create mode 100644 projects/10/ExpressionLessSquare/MainT.xml create mode 100644 projects/10/ExpressionLessSquare/Square.jack create mode 100644 projects/10/ExpressionLessSquare/Square.xml create mode 100644 projects/10/ExpressionLessSquare/SquareGame.jack create mode 100644 projects/10/ExpressionLessSquare/SquareGame.xml create mode 100644 projects/10/ExpressionLessSquare/SquareGameT.xml create mode 100644 projects/10/ExpressionLessSquare/SquareT.xml create mode 100644 projects/10/Square/Main.jack create mode 100644 projects/10/Square/Main.xml create mode 100644 projects/10/Square/MainT.xml create mode 100644 projects/10/Square/Square.jack create mode 100644 projects/10/Square/Square.xml create mode 100644 projects/10/Square/SquareGame.jack create mode 100644 projects/10/Square/SquareGame.xml create mode 100644 projects/10/Square/SquareGameT.xml create mode 100644 projects/10/Square/SquareT.xml create mode 100644 projects/11/Average/Main.jack create mode 100644 projects/11/ComplexArrays/Main.jack create mode 100644 projects/11/ConvertToBin/Main.jack create mode 100644 projects/11/Pong/Ball.jack create mode 100644 projects/11/Pong/Bat.jack create mode 100644 projects/11/Pong/Main.jack create mode 100644 projects/11/Pong/PongGame.jack create mode 100644 projects/11/Seven/Main.jack create mode 100644 projects/11/Square/Main.jack create mode 100644 projects/11/Square/Square.jack create mode 100644 projects/11/Square/SquareGame.jack create mode 100644 projects/12/Array.jack create mode 100644 projects/12/ArrayTest/ArrayTest.cmp create mode 100644 projects/12/ArrayTest/ArrayTest.tst create mode 100644 projects/12/ArrayTest/Main.jack create mode 100644 projects/12/Keyboard.jack create mode 100644 projects/12/KeyboardTest/KeyboardTestOutput.gif create mode 100644 projects/12/KeyboardTest/Main.jack create mode 100644 projects/12/Math.jack create mode 100644 projects/12/MathTest/Main.jack create mode 100644 projects/12/MathTest/MathTest.cmp create mode 100644 projects/12/MathTest/MathTest.tst create mode 100644 projects/12/Memory.jack create mode 100644 projects/12/MemoryTest/Main.jack create mode 100644 projects/12/MemoryTest/MemoryTest.cmp create mode 100644 projects/12/MemoryTest/MemoryTest.tst create mode 100644 projects/12/Output.jack create mode 100644 projects/12/OutputTest/Main.jack create mode 100644 projects/12/OutputTest/OutputTestOutput.gif create mode 100644 projects/12/Screen.jack create mode 100644 projects/12/ScreenTest/Main.jack create mode 100644 projects/12/ScreenTest/ScreenTestOutput.gif create mode 100644 projects/12/String.jack create mode 100644 projects/12/StringTest/Main.jack create mode 100644 projects/12/StringTest/StringTestOutput.gif create mode 100644 projects/12/Sys.jack create mode 100644 projects/12/SysTest/Main.jack create mode 100644 projects/13/more fun to go.txt create mode 100644 projects/demo/Xor.cmp create mode 100644 projects/demo/Xor.hdl create mode 100644 projects/demo/Xor.out create mode 100644 projects/demo/Xor.tst create mode 100644 tools/.DS_Store create mode 100644 tools/Assembler.bat create mode 100644 tools/Assembler.sh create mode 100644 tools/CPUEmulator.bat create mode 100644 tools/CPUEmulator.sh create mode 100644 tools/HardwareSimulator.bat create mode 100755 tools/HardwareSimulator.sh create mode 100644 tools/JackCompiler.bat create mode 100644 tools/JackCompiler.sh create mode 100644 tools/OS/Array.vm create mode 100644 tools/OS/Keyboard.vm create mode 100644 tools/OS/Math.vm create mode 100644 tools/OS/Memory.vm create mode 100644 tools/OS/Output.vm create mode 100644 tools/OS/Screen.vm create mode 100644 tools/OS/String.vm create mode 100644 tools/OS/Sys.vm create mode 100644 tools/TextComparer.bat create mode 100644 tools/TextComparer.sh create mode 100644 tools/VMEmulator.bat create mode 100644 tools/VMEmulator.sh create mode 100644 tools/bin/classes/CPUEmulatorMain.class create mode 100644 tools/bin/classes/HackAssemblerMain.class create mode 100644 tools/bin/classes/HardwareSimulatorMain.class create mode 100644 tools/bin/classes/TextComparer.class create mode 100644 tools/bin/classes/VMEmulatorMain.class create mode 100644 tools/bin/help/asmAbout.html create mode 100644 tools/bin/help/asmUsage.html create mode 100644 tools/bin/help/compiler.txt create mode 100644 tools/bin/help/cpuAbout.html create mode 100644 tools/bin/help/cpuUsage.html create mode 100644 tools/bin/help/hwAbout.html create mode 100644 tools/bin/help/hwUsage.html create mode 100644 tools/bin/help/vmAbout.html create mode 100644 tools/bin/help/vmUsage.html create mode 100644 tools/bin/images/arrow2.gif create mode 100644 tools/bin/images/calculator2.gif create mode 100644 tools/bin/images/cancel.gif create mode 100644 tools/bin/images/chip.gif create mode 100644 tools/bin/images/clock2.gif create mode 100644 tools/bin/images/equal.gif create mode 100644 tools/bin/images/find.gif create mode 100644 tools/bin/images/hex.gif create mode 100644 tools/bin/images/keyboard.gif create mode 100644 tools/bin/images/ok.gif create mode 100644 tools/bin/images/ok2.gif create mode 100644 tools/bin/images/open.gif create mode 100644 tools/bin/images/open2.gif create mode 100644 tools/bin/images/opendoc.gif create mode 100644 tools/bin/images/redflag.gif create mode 100644 tools/bin/images/save.gif create mode 100644 tools/bin/images/scroll.gif create mode 100644 tools/bin/images/smallcancel.gif create mode 100644 tools/bin/images/smallequal.gif create mode 100644 tools/bin/images/smallminus.gif create mode 100644 tools/bin/images/smallnew.gif create mode 100644 tools/bin/images/smallok.gif create mode 100644 tools/bin/images/smallplus.gif create mode 100644 tools/bin/images/vcrfastforward.gif create mode 100644 tools/bin/images/vcrforward.gif create mode 100644 tools/bin/images/vcrrewind.gif create mode 100644 tools/bin/images/vcrstop.gif create mode 100644 tools/bin/lib/AssemblerGUI.jar create mode 100644 tools/bin/lib/Compilers.jar create mode 100644 tools/bin/lib/Hack.jar create mode 100644 tools/bin/lib/HackGUI.jar create mode 100644 tools/bin/lib/Simulators.jar create mode 100644 tools/bin/lib/SimulatorsGUI.jar create mode 100644 tools/bin/lib/TranslatorsGUI.jar create mode 100644 tools/bin/scripts/defaultCPU.txt create mode 100644 tools/bin/scripts/defaultHW.txt create mode 100644 tools/bin/scripts/defaultVM.txt create mode 100644 tools/builtInChips/ALU.class create mode 100644 tools/builtInChips/ALU.hdl create mode 100644 tools/builtInChips/ARegister.class create mode 100644 tools/builtInChips/ARegister.hdl create mode 100644 tools/builtInChips/Add16.class create mode 100644 tools/builtInChips/Add16.hdl create mode 100644 tools/builtInChips/And.class create mode 100644 tools/builtInChips/And.hdl create mode 100644 tools/builtInChips/And16.hdl create mode 100644 tools/builtInChips/Bit.class create mode 100644 tools/builtInChips/Bit.hdl create mode 100644 tools/builtInChips/DFF.class create mode 100644 tools/builtInChips/DFF.hdl create mode 100644 tools/builtInChips/DMux.class create mode 100644 tools/builtInChips/DMux.hdl create mode 100644 tools/builtInChips/DMux4Way.class create mode 100644 tools/builtInChips/DMux4Way.hdl create mode 100644 tools/builtInChips/DMux8Way.class create mode 100644 tools/builtInChips/DMux8Way.hdl create mode 100644 tools/builtInChips/DRegister.class create mode 100644 tools/builtInChips/DRegister.hdl create mode 100644 tools/builtInChips/FullAdder.class create mode 100644 tools/builtInChips/FullAdder.hdl create mode 100644 tools/builtInChips/HalfAdder.class create mode 100644 tools/builtInChips/HalfAdder.hdl create mode 100644 tools/builtInChips/Inc16.class create mode 100644 tools/builtInChips/Inc16.hdl create mode 100644 tools/builtInChips/Keyboard.class create mode 100644 tools/builtInChips/Keyboard.hdl create mode 100644 tools/builtInChips/Mux.class create mode 100644 tools/builtInChips/Mux.hdl create mode 100644 tools/builtInChips/Mux16.hdl create mode 100644 tools/builtInChips/Mux4Way16.class create mode 100644 tools/builtInChips/Mux4Way16.hdl create mode 100644 tools/builtInChips/Mux8Way16.class create mode 100644 tools/builtInChips/Mux8Way16.hdl create mode 100644 tools/builtInChips/Nand.class create mode 100644 tools/builtInChips/Nand.hdl create mode 100644 tools/builtInChips/Not.class create mode 100644 tools/builtInChips/Not.hdl create mode 100644 tools/builtInChips/Not16.class create mode 100644 tools/builtInChips/Not16.hdl create mode 100644 tools/builtInChips/Or.class create mode 100644 tools/builtInChips/Or.hdl create mode 100644 tools/builtInChips/Or16.hdl create mode 100644 tools/builtInChips/Or8Way.class create mode 100644 tools/builtInChips/Or8Way.hdl create mode 100644 tools/builtInChips/PC.class create mode 100644 tools/builtInChips/PC.hdl create mode 100644 tools/builtInChips/RAM.class create mode 100644 tools/builtInChips/RAM16K.class create mode 100644 tools/builtInChips/RAM16K.hdl create mode 100644 tools/builtInChips/RAM4K.class create mode 100644 tools/builtInChips/RAM4K.hdl create mode 100644 tools/builtInChips/RAM512.class create mode 100644 tools/builtInChips/RAM512.hdl create mode 100644 tools/builtInChips/RAM64.class create mode 100644 tools/builtInChips/RAM64.hdl create mode 100644 tools/builtInChips/RAM8.class create mode 100644 tools/builtInChips/RAM8.hdl create mode 100644 tools/builtInChips/ROM32K.class create mode 100644 tools/builtInChips/ROM32K.hdl create mode 100644 tools/builtInChips/Register.class create mode 100644 tools/builtInChips/Register.hdl create mode 100644 tools/builtInChips/RegisterWithGUI.class create mode 100644 tools/builtInChips/Screen.class create mode 100644 tools/builtInChips/Screen.hdl create mode 100644 tools/builtInChips/Xor.class create mode 100644 tools/builtInChips/Xor.hdl create mode 100644 tools/builtInVMCode/Array.class create mode 100644 tools/builtInVMCode/JackOSClass.class create mode 100644 tools/builtInVMCode/Keyboard.class create mode 100644 tools/builtInVMCode/Math.class create mode 100644 tools/builtInVMCode/Memory.class create mode 100644 tools/builtInVMCode/Output.class create mode 100644 tools/builtInVMCode/Screen.class create mode 100644 tools/builtInVMCode/String.class create mode 100644 tools/builtInVMCode/Sys.class diff --git a/projects/00/file.txt b/projects/00/file.txt new file mode 100644 index 0000000..ff654e3 --- /dev/null +++ b/projects/00/file.txt @@ -0,0 +1,6 @@ +The only purpose of this file is to practice submitting files +in the Nand to Tetris course websites in Coursera. + +There is no need to modify the contents of this file. +All you have to do is submit it as is, following the +Project 0 guidelines in the website. \ No newline at end of file diff --git a/projects/01/And.cmp b/projects/01/And.cmp new file mode 100644 index 0000000..75e709a --- /dev/null +++ b/projects/01/And.cmp @@ -0,0 +1,5 @@ +| a | b | out | +| 0 | 0 | 0 | +| 0 | 1 | 0 | +| 1 | 0 | 0 | +| 1 | 1 | 1 | diff --git a/projects/01/And.hdl b/projects/01/And.hdl new file mode 100644 index 0000000..754e54e --- /dev/null +++ b/projects/01/And.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: projects/01/And.hdl + +/** + * And gate: + * out = 1 if (a == 1 and b == 1) + * 0 otherwise + */ + +CHIP And { + IN a, b; + OUT out; + + PARTS: + // Put your code here: + Nand (a=a, b=b, out=nandab); + Not (in=nandab, out=out); +} diff --git a/projects/01/And.out b/projects/01/And.out new file mode 100644 index 0000000..8199ca5 --- /dev/null +++ b/projects/01/And.out @@ -0,0 +1,5 @@ +| a | b | out | +| 0 | 0 | 0 | +| 0 | 1 | 0 | +| 1 | 0 | 0 | +| 1 | 1 | 1 | diff --git a/projects/01/And.tst b/projects/01/And.tst new file mode 100644 index 0000000..7ace19d --- /dev/null +++ b/projects/01/And.tst @@ -0,0 +1,29 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/01/And.tst + +load And.hdl, +output-file And.out, +compare-to And.cmp, +output-list a%B3.1.3 b%B3.1.3 out%B3.1.3; + +set a 0, +set b 0, +eval, +output; + +set a 0, +set b 1, +eval, +output; + +set a 1, +set b 0, +eval, +output; + +set a 1, +set b 1, +eval, +output; diff --git a/projects/01/And16.cmp b/projects/01/And16.cmp new file mode 100644 index 0000000..32c8648 --- /dev/null +++ b/projects/01/And16.cmp @@ -0,0 +1,7 @@ +| a | b | out | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | +| 0000000000000000 | 1111111111111111 | 0000000000000000 | +| 1111111111111111 | 1111111111111111 | 1111111111111111 | +| 1010101010101010 | 0101010101010101 | 0000000000000000 | +| 0011110011000011 | 0000111111110000 | 0000110011000000 | +| 0001001000110100 | 1001100001110110 | 0001000000110100 | diff --git a/projects/01/And16.hdl b/projects/01/And16.hdl new file mode 100644 index 0000000..27fe04a --- /dev/null +++ b/projects/01/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: projects/01/And16.hdl + +/** + * 16-bit bitwise And: + * for i = 0..15: out[i] = (a[i] and b[i]) + */ + +CHIP And16 { + IN a[16], b[16]; + OUT out[16]; + + PARTS: + // Put your code here: +} \ No newline at end of file diff --git a/projects/01/And16.tst b/projects/01/And16.tst new file mode 100644 index 0000000..c8921e7 --- /dev/null +++ b/projects/01/And16.tst @@ -0,0 +1,39 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/01/And16.tst + +load And16.hdl, +output-file And16.out, +compare-to And16.cmp, +output-list a%B1.16.1 b%B1.16.1 out%B1.16.1; + +set a %B0000000000000000, +set b %B0000000000000000, +eval, +output; + +set a %B0000000000000000, +set b %B1111111111111111, +eval, +output; + +set a %B1111111111111111, +set b %B1111111111111111, +eval, +output; + +set a %B1010101010101010, +set b %B0101010101010101, +eval, +output; + +set a %B0011110011000011, +set b %B0000111111110000, +eval, +output; + +set a %B0001001000110100, +set b %B1001100001110110, +eval, +output; \ No newline at end of file diff --git a/projects/01/DMux.cmp b/projects/01/DMux.cmp new file mode 100644 index 0000000..6982094 --- /dev/null +++ b/projects/01/DMux.cmp @@ -0,0 +1,5 @@ +| in | sel | a | b | +| 0 | 0 | 0 | 0 | +| 0 | 1 | 0 | 0 | +| 1 | 0 | 1 | 0 | +| 1 | 1 | 0 | 1 | diff --git a/projects/01/DMux.hdl b/projects/01/DMux.hdl new file mode 100644 index 0000000..b528313 --- /dev/null +++ b/projects/01/DMux.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: projects/01/DMux.hdl + +/** + * Demultiplexor: + * {a, b} = {in, 0} if sel == 0 + * {0, in} if sel == 1 + */ + +CHIP DMux { + IN in, sel; + OUT a, b; + + PARTS: + // Put your code here: + Not (in=sel, out=notsel); + And (a=in, b=notsel, out=a); + And (a=in, b=sel, out=b); +} diff --git a/projects/01/DMux.out b/projects/01/DMux.out new file mode 100644 index 0000000..9a92ec0 --- /dev/null +++ b/projects/01/DMux.out @@ -0,0 +1,5 @@ +| in | sel | a | b | +| 0 | 0 | 0 | 0 | +| 0 | 1 | 0 | 0 | +| 1 | 0 | 1 | 0 | +| 1 | 1 | 0 | 1 | diff --git a/projects/01/DMux.tst b/projects/01/DMux.tst new file mode 100644 index 0000000..4adbc43 --- /dev/null +++ b/projects/01/DMux.tst @@ -0,0 +1,27 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/01/DMux.tst + +load DMux.hdl, +output-file DMux.out, +compare-to DMux.cmp, +output-list in%B3.1.3 sel%B3.1.3 a%B3.1.3 b%B3.1.3; + +set in 0, +set sel 0, +eval, +output; + +set sel 1, +eval, +output; + +set in 1, +set sel 0, +eval, +output; + +set sel 1, +eval, +output; diff --git a/projects/01/DMux4Way.cmp b/projects/01/DMux4Way.cmp new file mode 100644 index 0000000..eac35c4 --- /dev/null +++ b/projects/01/DMux4Way.cmp @@ -0,0 +1,9 @@ +| in | sel | a | b | c | d | +| 0 | 00 | 0 | 0 | 0 | 0 | +| 0 | 01 | 0 | 0 | 0 | 0 | +| 0 | 10 | 0 | 0 | 0 | 0 | +| 0 | 11 | 0 | 0 | 0 | 0 | +| 1 | 00 | 1 | 0 | 0 | 0 | +| 1 | 01 | 0 | 1 | 0 | 0 | +| 1 | 10 | 0 | 0 | 1 | 0 | +| 1 | 11 | 0 | 0 | 0 | 1 | diff --git a/projects/01/DMux4Way.hdl b/projects/01/DMux4Way.hdl new file mode 100644 index 0000000..24270c0 --- /dev/null +++ b/projects/01/DMux4Way.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: projects/01/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; + + PARTS: + // Put your code here: +} \ No newline at end of file diff --git a/projects/01/DMux4Way.tst b/projects/01/DMux4Way.tst new file mode 100644 index 0000000..6fbbb56 --- /dev/null +++ b/projects/01/DMux4Way.tst @@ -0,0 +1,43 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/01/DMux4Way.tst + +load DMux4Way.hdl, +output-file DMux4Way.out, +compare-to DMux4Way.cmp, +output-list in%B2.1.2 sel%B2.2.2 a%B2.1.2 b%B2.1.2 c%B2.1.2 d%B2.1.2; + +set in 0, +set sel %B00, +eval, +output; + +set sel %B01, +eval, +output; + +set sel %B10, +eval, +output; + +set sel %B11, +eval, +output; + +set in 1, +set sel %B00, +eval, +output; + +set sel %B01, +eval, +output; + +set sel %B10, +eval, +output; + +set sel %B11, +eval, +output; diff --git a/projects/01/DMux8Way.cmp b/projects/01/DMux8Way.cmp new file mode 100644 index 0000000..375d44a --- /dev/null +++ b/projects/01/DMux8Way.cmp @@ -0,0 +1,17 @@ +| in | sel | a | b | c | d | e | f | g | h | +| 0 | 000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 0 | 001 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 0 | 010 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 0 | 011 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 0 | 100 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 0 | 101 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 0 | 110 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 0 | 111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 1 | 000 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 1 | 001 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | +| 1 | 010 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | +| 1 | 011 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | +| 1 | 100 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | +| 1 | 101 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | +| 1 | 110 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | +| 1 | 111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | diff --git a/projects/01/DMux8Way.hdl b/projects/01/DMux8Way.hdl new file mode 100644 index 0000000..75714a5 --- /dev/null +++ b/projects/01/DMux8Way.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: projects/01/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; + + PARTS: + // Put your code here: +} \ No newline at end of file diff --git a/projects/01/DMux8Way.tst b/projects/01/DMux8Way.tst new file mode 100644 index 0000000..56d827e --- /dev/null +++ b/projects/01/DMux8Way.tst @@ -0,0 +1,75 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/01/DMux8Way.tst + +load DMux8Way.hdl, +output-file DMux8Way.out, +compare-to DMux8Way.cmp, +output-list in%B2.1.2 sel%B2.3.2 a%B2.1.2 b%B2.1.2 c%B2.1.2 d%B2.1.2 e%B2.1.2 f%B2.1.2 g%B2.1.2 h%B2.1.2; + +set in 0, +set sel %B000, +eval, +output; + +set sel %B001, +eval, +output; + +set sel %B010, +eval, +output; + +set sel %B011, +eval, +output; + +set sel %B100, +eval, +output; + +set sel %B101, +eval, +output; + +set sel %B110, +eval, +output; + +set sel %B111, +eval, +output; + +set in 1, +set sel %B000, +eval, +output; + +set sel %B001, +eval, +output; + +set sel %B010, +eval, +output; + +set sel %B011, +eval, +output; + +set sel %B100, +eval, +output; + +set sel %B101, +eval, +output; + +set sel %B110, +eval, +output; + +set sel %B111, +eval, +output; diff --git a/projects/01/Mux.cmp b/projects/01/Mux.cmp new file mode 100644 index 0000000..7a5cc5b --- /dev/null +++ b/projects/01/Mux.cmp @@ -0,0 +1,9 @@ +| a | b | sel | out | +| 0 | 0 | 0 | 0 | +| 0 | 0 | 1 | 0 | +| 0 | 1 | 0 | 0 | +| 0 | 1 | 1 | 1 | +| 1 | 0 | 0 | 1 | +| 1 | 0 | 1 | 0 | +| 1 | 1 | 0 | 1 | +| 1 | 1 | 1 | 1 | diff --git a/projects/01/Mux.hdl b/projects/01/Mux.hdl new file mode 100644 index 0000000..aac2e36 --- /dev/null +++ b/projects/01/Mux.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: projects/01/Mux.hdl + +/** + * Multiplexor: + * out = a if sel == 0 + * b otherwise + */ + +CHIP Mux { + IN a, b, sel; + OUT out; + + PARTS: + // Put your code here: + Not (in=sel, out=notsel); + And (a=a, b=notsel, out=aandnotsel); + And (a=sel, b=b, out=selandb); + Or (a=aandnotsel, b=selandb, out=out); +} diff --git a/projects/01/Mux.out b/projects/01/Mux.out new file mode 100644 index 0000000..e4b51c6 --- /dev/null +++ b/projects/01/Mux.out @@ -0,0 +1,9 @@ +| a | b | sel | out | +| 0 | 0 | 0 | 0 | +| 0 | 0 | 1 | 0 | +| 0 | 1 | 0 | 0 | +| 0 | 1 | 1 | 1 | +| 1 | 0 | 0 | 1 | +| 1 | 0 | 1 | 0 | +| 1 | 1 | 0 | 1 | +| 1 | 1 | 1 | 1 | diff --git a/projects/01/Mux.tst b/projects/01/Mux.tst new file mode 100644 index 0000000..9b7afd9 --- /dev/null +++ b/projects/01/Mux.tst @@ -0,0 +1,49 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/01/Mux.tst + +load Mux.hdl, +output-file Mux.out, +compare-to Mux.cmp, +output-list a%B3.1.3 b%B3.1.3 sel%B3.1.3 out%B3.1.3; + +set a 0, +set b 0, +set sel 0, +eval, +output; + +set sel 1, +eval, +output; + +set a 0, +set b 1, +set sel 0, +eval, +output; + +set sel 1, +eval, +output; + +set a 1, +set b 0, +set sel 0, +eval, +output; + +set sel 1, +eval, +output; + +set a 1, +set b 1, +set sel 0, +eval, +output; + +set sel 1, +eval, +output; diff --git a/projects/01/Mux16.cmp b/projects/01/Mux16.cmp new file mode 100644 index 0000000..661ee67 --- /dev/null +++ b/projects/01/Mux16.cmp @@ -0,0 +1,9 @@ +| a | b | sel | out | +| 0000000000000000 | 0000000000000000 | 0 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 1 | 0000000000000000 | +| 0000000000000000 | 0001001000110100 | 0 | 0000000000000000 | +| 0000000000000000 | 0001001000110100 | 1 | 0001001000110100 | +| 1001100001110110 | 0000000000000000 | 0 | 1001100001110110 | +| 1001100001110110 | 0000000000000000 | 1 | 0000000000000000 | +| 1010101010101010 | 0101010101010101 | 0 | 1010101010101010 | +| 1010101010101010 | 0101010101010101 | 1 | 0101010101010101 | diff --git a/projects/01/Mux16.hdl b/projects/01/Mux16.hdl new file mode 100644 index 0000000..97dd784 --- /dev/null +++ b/projects/01/Mux16.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: projects/01/Mux16.hdl + +/** + * 16-bit multiplexor: + * for i = 0..15 out[i] = a[i] if sel == 0 + * b[i] if sel == 1 + */ + +CHIP Mux16 { + IN a[16], b[16], sel; + OUT out[16]; + + PARTS: + // Put your code here: +} diff --git a/projects/01/Mux16.tst b/projects/01/Mux16.tst new file mode 100644 index 0000000..cf34155 --- /dev/null +++ b/projects/01/Mux16.tst @@ -0,0 +1,49 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/01/Mux16.tst + +load Mux16.hdl, +output-file Mux16.out, +compare-to Mux16.cmp, +output-list a%B1.16.1 b%B1.16.1 sel%D2.1.2 out%B1.16.1; + +set a 0, +set b 0, +set sel 0, +eval, +output; + +set sel 1, +eval, +output; + +set a %B0000000000000000, +set b %B0001001000110100, +set sel 0, +eval, +output; + +set sel 1, +eval, +output; + +set a %B1001100001110110, +set b %B0000000000000000, +set sel 0, +eval, +output; + +set sel 1, +eval, +output; + +set a %B1010101010101010, +set b %B0101010101010101, +set sel 0, +eval, +output; + +set sel 1, +eval, +output; \ No newline at end of file diff --git a/projects/01/Mux4Way16.cmp b/projects/01/Mux4Way16.cmp new file mode 100644 index 0000000..8704e79 --- /dev/null +++ b/projects/01/Mux4Way16.cmp @@ -0,0 +1,9 @@ +| a | b | c | d | sel | out | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 00 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 01 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 10 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 11 | 0000000000000000 | +| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 00 | 0001001000110100 | +| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 01 | 1001100001110110 | +| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 10 | 1010101010101010 | +| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 11 | 0101010101010101 | diff --git a/projects/01/Mux4Way16.hdl b/projects/01/Mux4Way16.hdl new file mode 100644 index 0000000..75baced --- /dev/null +++ b/projects/01/Mux4Way16.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: projects/01/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]; + + PARTS: + // Put your code here: +} \ No newline at end of file diff --git a/projects/01/Mux4Way16.tst b/projects/01/Mux4Way16.tst new file mode 100644 index 0000000..3f4efa3 --- /dev/null +++ b/projects/01/Mux4Way16.tst @@ -0,0 +1,49 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/01/Mux4Way16.tst + +load Mux4Way16.hdl, +output-file Mux4Way16.out, +compare-to Mux4Way16.cmp, +output-list a%B1.16.1 b%B1.16.1 c%B1.16.1 d%B1.16.1 sel%B2.2.2 out%B1.16.1; + +set a 0, +set b 0, +set c 0, +set d 0, +set sel 0, +eval, +output; + +set sel 1, +eval, +output; + +set sel 2, +eval, +output; + +set sel 3, +eval, +output; + +set a %B0001001000110100, +set b %B1001100001110110, +set c %B1010101010101010, +set d %B0101010101010101, +set sel 0, +eval, +output; + +set sel 1, +eval, +output; + +set sel 2, +eval, +output; + +set sel 3, +eval, +output; diff --git a/projects/01/Mux8Way16.cmp b/projects/01/Mux8Way16.cmp new file mode 100644 index 0000000..1484e0a --- /dev/null +++ b/projects/01/Mux8Way16.cmp @@ -0,0 +1,17 @@ +| a | b | c | d | e | f | g | h | sel | out | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 000 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 001 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 010 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 011 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 100 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 101 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 110 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 111 | 0000000000000000 | +| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 000 | 0001001000110100 | +| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 001 | 0010001101000101 | +| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 010 | 0011010001010110 | +| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 011 | 0100010101100111 | +| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 100 | 0101011001111000 | +| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 101 | 0110011110001001 | +| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 110 | 0111100010011010 | +| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 111 | 1000100110101011 | diff --git a/projects/01/Mux8Way16.hdl b/projects/01/Mux8Way16.hdl new file mode 100644 index 0000000..88c791e --- /dev/null +++ b/projects/01/Mux8Way16.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: projects/01/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]; + + PARTS: + // Put your code here: +} \ No newline at end of file diff --git a/projects/01/Mux8Way16.tst b/projects/01/Mux8Way16.tst new file mode 100644 index 0000000..59bb41c --- /dev/null +++ b/projects/01/Mux8Way16.tst @@ -0,0 +1,89 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/01/Mux8Way16.tst + +load Mux8Way16.hdl, +output-file Mux8Way16.out, +compare-to Mux8Way16.cmp, +output-list a%B1.16.1 b%B1.16.1 c%B1.16.1 d%B1.16.1 e%B1.16.1 f%B1.16.1 g%B1.16.1 h%B1.16.1 sel%B2.3.2 out%B1.16.1; + +set a 0, +set b 0, +set c 0, +set d 0, +set e 0, +set f 0, +set g 0, +set h 0, +set sel 0, +eval, +output; + +set sel 1, +eval, +output; + +set sel 2, +eval, +output; + +set sel 3, +eval, +output; + +set sel 4, +eval, +output; + +set sel 5, +eval, +output; + +set sel 6, +eval, +output; + +set sel 7, +eval, +output; + +set a %B0001001000110100, +set b %B0010001101000101, +set c %B0011010001010110, +set d %B0100010101100111, +set e %B0101011001111000, +set f %B0110011110001001, +set g %B0111100010011010, +set h %B1000100110101011, +set sel 0, +eval, +output; + +set sel 1, +eval, +output; + +set sel 2, +eval, +output; + +set sel 3, +eval, +output; + +set sel 4, +eval, +output; + +set sel 5, +eval, +output; + +set sel 6, +eval, +output; + +set sel 7, +eval, +output; diff --git a/projects/01/Not.cmp b/projects/01/Not.cmp new file mode 100644 index 0000000..e8c1191 --- /dev/null +++ b/projects/01/Not.cmp @@ -0,0 +1,3 @@ +| in | out | +| 0 | 1 | +| 1 | 0 | diff --git a/projects/01/Not.hdl b/projects/01/Not.hdl new file mode 100644 index 0000000..e8aac51 --- /dev/null +++ b/projects/01/Not.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: projects/01/Not.hdl + +/** + * Not gate: + * out = not in + */ + +CHIP Not { + IN in; + OUT out; + + PARTS: + // Put your code here: + Nand (a=in, b=in, out=out); +} diff --git a/projects/01/Not.out b/projects/01/Not.out new file mode 100644 index 0000000..7b64092 --- /dev/null +++ b/projects/01/Not.out @@ -0,0 +1,3 @@ +| in | out | +| 0 | 1 | +| 1 | 0 | diff --git a/projects/01/Not.tst b/projects/01/Not.tst new file mode 100644 index 0000000..1e3bbe7 --- /dev/null +++ b/projects/01/Not.tst @@ -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: projects/01/Not.tst + +load Not.hdl, +output-file Not.out, +compare-to Not.cmp, +output-list in%B3.1.3 out%B3.1.3; + +set in 0, +eval, +output; + +set in 1, +eval, +output; diff --git a/projects/01/Not16.cmp b/projects/01/Not16.cmp new file mode 100644 index 0000000..68a5512 --- /dev/null +++ b/projects/01/Not16.cmp @@ -0,0 +1,6 @@ +| in | out | +| 0000000000000000 | 1111111111111111 | +| 1111111111111111 | 0000000000000000 | +| 1010101010101010 | 0101010101010101 | +| 0011110011000011 | 1100001100111100 | +| 0001001000110100 | 1110110111001011 | diff --git a/projects/01/Not16.hdl b/projects/01/Not16.hdl new file mode 100644 index 0000000..3d25bbe --- /dev/null +++ b/projects/01/Not16.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: projects/01/Not16.hdl + +/** + * 16-bit Not: + * for i=0..15: out[i] = not in[i] + */ + +CHIP Not16 { + IN in[16]; + OUT out[16]; + + PARTS: + // Put your code here: +} \ No newline at end of file diff --git a/projects/01/Not16.tst b/projects/01/Not16.tst new file mode 100644 index 0000000..e7e2c3b --- /dev/null +++ b/projects/01/Not16.tst @@ -0,0 +1,29 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/01/Not16.tst + +load Not16.hdl, +output-file Not16.out, +compare-to Not16.cmp, +output-list in%B1.16.1 out%B1.16.1; + +set in %B0000000000000000, +eval, +output; + +set in %B1111111111111111, +eval, +output; + +set in %B1010101010101010, +eval, +output; + +set in %B0011110011000011, +eval, +output; + +set in %B0001001000110100, +eval, +output; \ No newline at end of file diff --git a/projects/01/Or.cmp b/projects/01/Or.cmp new file mode 100644 index 0000000..dab924c --- /dev/null +++ b/projects/01/Or.cmp @@ -0,0 +1,5 @@ +| a | b | out | +| 0 | 0 | 0 | +| 0 | 1 | 1 | +| 1 | 0 | 1 | +| 1 | 1 | 1 | diff --git a/projects/01/Or.hdl b/projects/01/Or.hdl new file mode 100644 index 0000000..f539fbf --- /dev/null +++ b/projects/01/Or.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: projects/01/Or.hdl + + /** + * Or gate: + * out = 1 if (a == 1 or b == 1) + * 0 otherwise + */ + +CHIP Or { + IN a, b; + OUT out; + + PARTS: + // Put your code here: + Not (in=a, out=nota); + Not (in=b, out=notb); + Nand (a=nota, b=notb, out=out); +} diff --git a/projects/01/Or.out b/projects/01/Or.out new file mode 100644 index 0000000..8010688 --- /dev/null +++ b/projects/01/Or.out @@ -0,0 +1,5 @@ +| a | b | out | +| 0 | 0 | 0 | +| 0 | 1 | 1 | +| 1 | 0 | 1 | +| 1 | 1 | 1 | diff --git a/projects/01/Or.tst b/projects/01/Or.tst new file mode 100644 index 0000000..948b6b3 --- /dev/null +++ b/projects/01/Or.tst @@ -0,0 +1,29 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/01/Or.tst + +load Or.hdl, +output-file Or.out, +compare-to Or.cmp, +output-list a%B3.1.3 b%B3.1.3 out%B3.1.3; + +set a 0, +set b 0, +eval, +output; + +set a 0, +set b 1, +eval, +output; + +set a 1, +set b 0, +eval, +output; + +set a 1, +set b 1, +eval, +output; diff --git a/projects/01/Or16.cmp b/projects/01/Or16.cmp new file mode 100644 index 0000000..e2c3a30 --- /dev/null +++ b/projects/01/Or16.cmp @@ -0,0 +1,7 @@ +| a | b | out | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | +| 0000000000000000 | 1111111111111111 | 1111111111111111 | +| 1111111111111111 | 1111111111111111 | 1111111111111111 | +| 1010101010101010 | 0101010101010101 | 1111111111111111 | +| 0011110011000011 | 0000111111110000 | 0011111111110011 | +| 0001001000110100 | 1001100001110110 | 1001101001110110 | diff --git a/projects/01/Or16.hdl b/projects/01/Or16.hdl new file mode 100644 index 0000000..0238f05 --- /dev/null +++ b/projects/01/Or16.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: projects/01/Or16.hdl + +/** + * 16-bit bitwise Or: + * for i = 0..15 out[i] = (a[i] or b[i]) + */ + +CHIP Or16 { + IN a[16], b[16]; + OUT out[16]; + + PARTS: + // Put your code here: +} \ No newline at end of file diff --git a/projects/01/Or16.tst b/projects/01/Or16.tst new file mode 100644 index 0000000..ea7b944 --- /dev/null +++ b/projects/01/Or16.tst @@ -0,0 +1,39 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/01/Or16.tst + +load Or16.hdl, +output-file Or16.out, +compare-to Or16.cmp, +output-list a%B1.16.1 b%B1.16.1 out%B1.16.1; + +set a %B0000000000000000, +set b %B0000000000000000, +eval, +output; + +set a %B0000000000000000, +set b %B1111111111111111, +eval, +output; + +set a %B1111111111111111, +set b %B1111111111111111, +eval, +output; + +set a %B1010101010101010, +set b %B0101010101010101, +eval, +output; + +set a %B0011110011000011, +set b %B0000111111110000, +eval, +output; + +set a %B0001001000110100, +set b %B1001100001110110, +eval, +output; \ No newline at end of file diff --git a/projects/01/Or8Way.cmp b/projects/01/Or8Way.cmp new file mode 100644 index 0000000..3f9fd54 --- /dev/null +++ b/projects/01/Or8Way.cmp @@ -0,0 +1,6 @@ +| in | out | +| 00000000 | 0 | +| 11111111 | 1 | +| 00010000 | 1 | +| 00000001 | 1 | +| 00100110 | 1 | diff --git a/projects/01/Or8Way.hdl b/projects/01/Or8Way.hdl new file mode 100644 index 0000000..24c78c4 --- /dev/null +++ b/projects/01/Or8Way.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: projects/01/Or8Way.hdl + +/** + * 8-way Or: + * out = (in[0] or in[1] or ... or in[7]) + */ + +CHIP Or8Way { + IN in[8]; + OUT out; + + PARTS: + // Put your code here: +} \ No newline at end of file diff --git a/projects/01/Or8Way.tst b/projects/01/Or8Way.tst new file mode 100644 index 0000000..e6fbba7 --- /dev/null +++ b/projects/01/Or8Way.tst @@ -0,0 +1,29 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/01/Or8Way.tst + +load Or8Way.hdl, +output-file Or8Way.out, +compare-to Or8Way.cmp, +output-list in%B2.8.2 out%B2.1.2; + +set in %B00000000, +eval, +output; + +set in %B11111111, +eval, +output; + +set in %B00010000, +eval, +output; + +set in %B00000001, +eval, +output; + +set in %B00100110, +eval, +output; \ No newline at end of file diff --git a/projects/01/Xor.cmp b/projects/01/Xor.cmp new file mode 100644 index 0000000..a1e07b2 --- /dev/null +++ b/projects/01/Xor.cmp @@ -0,0 +1,5 @@ +| a | b | out | +| 0 | 0 | 0 | +| 0 | 1 | 1 | +| 1 | 0 | 1 | +| 1 | 1 | 0 | diff --git a/projects/01/Xor.hdl b/projects/01/Xor.hdl new file mode 100644 index 0000000..5ec4579 --- /dev/null +++ b/projects/01/Xor.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: projects/01/Xor.hdl + +/** + * Exclusive-or gate: + * out = not (a == b) + */ + +CHIP Xor { + IN a, b; + OUT out; + + PARTS: + // Put your code here: + Not (in=a, out=nota); + Not (in=b, out=notb); + And (a=a, b=notb, out=aandnotb); + And (a=nota, b=b, out=notaandb); + Or (a=aandnotb, b=notaandb, out=out); +} diff --git a/projects/01/Xor.out b/projects/01/Xor.out new file mode 100644 index 0000000..73a8d0c --- /dev/null +++ b/projects/01/Xor.out @@ -0,0 +1,5 @@ +| a | b | out | +| 0 | 0 | 0 | +| 0 | 1 | 1 | +| 1 | 0 | 1 | +| 1 | 1 | 0 | diff --git a/projects/01/Xor.tst b/projects/01/Xor.tst new file mode 100644 index 0000000..658cbe5 --- /dev/null +++ b/projects/01/Xor.tst @@ -0,0 +1,29 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/01/Xor.tst + +load Xor.hdl, +output-file Xor.out, +compare-to Xor.cmp, +output-list a%B3.1.3 b%B3.1.3 out%B3.1.3; + +set a 0, +set b 0, +eval, +output; + +set a 0, +set b 1, +eval, +output; + +set a 1, +set b 0, +eval, +output; + +set a 1, +set b 1, +eval, +output; diff --git a/projects/02/ALU-nostat.cmp b/projects/02/ALU-nostat.cmp new file mode 100644 index 0000000..976ab78 --- /dev/null +++ b/projects/02/ALU-nostat.cmp @@ -0,0 +1,37 @@ +| x | y |zx |nx |zy |ny | f |no | out | +| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | +| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | +| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | +| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 | +| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 | +| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 | +| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 | +| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 | +| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | +| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | +| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 | +| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 | +| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 | +| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 | +| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | +| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 | +| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 | +| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 | +| 0101101110100000 | 0001111011010010 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | +| 0101101110100000 | 0001111011010010 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | +| 0101101110100000 | 0001111011010010 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | +| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 0 | 0 | 0101101110100000 | +| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 0 | 0 | 0001111011010010 | +| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 0 | 1 | 1010010001011111 | +| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 0 | 1 | 1110000100101101 | +| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 1 | 1 | 1010010001100000 | +| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 1 | 1 | 1110000100101110 | +| 0101101110100000 | 0001111011010010 | 0 | 1 | 1 | 1 | 1 | 1 | 0101101110100001 | +| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 1 | 1 | 1 | 0001111011010011 | +| 0101101110100000 | 0001111011010010 | 0 | 0 | 1 | 1 | 1 | 0 | 0101101110011111 | +| 0101101110100000 | 0001111011010010 | 1 | 1 | 0 | 0 | 1 | 0 | 0001111011010001 | +| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 0 | 1 | 0 | 0111101001110010 | +| 0101101110100000 | 0001111011010010 | 0 | 1 | 0 | 0 | 1 | 1 | 0011110011001110 | +| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 1 | 1 | 1 | 1100001100110010 | +| 0101101110100000 | 0001111011010010 | 0 | 0 | 0 | 0 | 0 | 0 | 0001101010000000 | +| 0101101110100000 | 0001111011010010 | 0 | 1 | 0 | 1 | 0 | 1 | 0101111111110010 | diff --git a/projects/02/ALU-nostat.tst b/projects/02/ALU-nostat.tst new file mode 100644 index 0000000..fa3e448 --- /dev/null +++ b/projects/02/ALU-nostat.tst @@ -0,0 +1,353 @@ +// 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: projects/02/ALU-nostat.tst + +// ALU-nostat.tst provides a partial test of the ALU chip. +// It IS NOT a replacement for ALU.tst. + +// ALU-nostat.tst tests only the computation part of the ALU. +// The 'zr' and 'ng' status outputs are ignored. + +// This test lets you concentrate on getting the ALU computation right without the +// additional task of handling the status outputs. + +// Once your ALU passes ALU-nostat.tst you need to test it with ALU.tst. +// This way, any comparison failures during ALU.tst will be caused by errors in +// the handling of the 'zr' and 'ng' status outputs. + +load ALU.hdl, +output-file ALU-nostat.out, +compare-to ALU-nostat.cmp, +output-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1 + ny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1; + +set x %B0000000000000000, +set y %B1111111111111111, + +set zx 1, +set nx 0, +set zy 1, +set ny 0, +set f 1, +set no 0, +eval, +output; + +set zx 1, +set nx 1, +set zy 1, +set ny 1, +set f 1, +set no 1, +eval, +output; + +set zx 1, +set nx 1, +set zy 1, +set ny 0, +set f 1, +set no 0, +eval, +output; + +set zx 0, +set nx 0, +set zy 1, +set ny 1, +set f 0, +set no 0, +eval, +output; + +set zx 1, +set nx 1, +set zy 0, +set ny 0, +set f 0, +set no 0, +eval, +output; + +set zx 0, +set nx 0, +set zy 1, +set ny 1, +set f 0, +set no 1, +eval, +output; + +set zx 1, +set nx 1, +set zy 0, +set ny 0, +set f 0, +set no 1, +eval, +output; + +set zx 0, +set nx 0, +set zy 1, +set ny 1, +set f 1, +set no 1, +eval, +output; + +set zx 1, +set nx 1, +set zy 0, +set ny 0, +set f 1, +set no 1, +eval, +output; + +set zx 0, +set nx 1, +set zy 1, +set ny 1, +set f 1, +set no 1, +eval, +output; + +set zx 1, +set nx 1, +set zy 0, +set ny 1, +set f 1, +set no 1, +eval, +output; + +set zx 0, +set nx 0, +set zy 1, +set ny 1, +set f 1, +set no 0, +eval, +output; + +set zx 1, +set nx 1, +set zy 0, +set ny 0, +set f 1, +set no 0, +eval, +output; + +set zx 0, +set nx 0, +set zy 0, +set ny 0, +set f 1, +set no 0, +eval, +output; + +set zx 0, +set nx 1, +set zy 0, +set ny 0, +set f 1, +set no 1, +eval, +output; + +set zx 0, +set nx 0, +set zy 0, +set ny 1, +set f 1, +set no 1, +eval, +output; + +set zx 0, +set nx 0, +set zy 0, +set ny 0, +set f 0, +set no 0, +eval, +output; + +set zx 0, +set nx 1, +set zy 0, +set ny 1, +set f 0, +set no 1, +eval, +output; + +set x %B101101110100000, +set y %B001111011010010, + +set zx 1, +set nx 0, +set zy 1, +set ny 0, +set f 1, +set no 0, +eval, +output; + +set zx 1, +set nx 1, +set zy 1, +set ny 1, +set f 1, +set no 1, +eval, +output; + +set zx 1, +set nx 1, +set zy 1, +set ny 0, +set f 1, +set no 0, +eval, +output; + +set zx 0, +set nx 0, +set zy 1, +set ny 1, +set f 0, +set no 0, +eval, +output; + +set zx 1, +set nx 1, +set zy 0, +set ny 0, +set f 0, +set no 0, +eval, +output; + +set zx 0, +set nx 0, +set zy 1, +set ny 1, +set f 0, +set no 1, +eval, +output; + +set zx 1, +set nx 1, +set zy 0, +set ny 0, +set f 0, +set no 1, +eval, +output; + +set zx 0, +set nx 0, +set zy 1, +set ny 1, +set f 1, +set no 1, +eval, +output; + +set zx 1, +set nx 1, +set zy 0, +set ny 0, +set f 1, +set no 1, +eval, +output; + +set zx 0, +set nx 1, +set zy 1, +set ny 1, +set f 1, +set no 1, +eval, +output; + +set zx 1, +set nx 1, +set zy 0, +set ny 1, +set f 1, +set no 1, +eval, +output; + +set zx 0, +set nx 0, +set zy 1, +set ny 1, +set f 1, +set no 0, +eval, +output; + +set zx 1, +set nx 1, +set zy 0, +set ny 0, +set f 1, +set no 0, +eval, +output; + +set zx 0, +set nx 0, +set zy 0, +set ny 0, +set f 1, +set no 0, +eval, +output; + +set zx 0, +set nx 1, +set zy 0, +set ny 0, +set f 1, +set no 1, +eval, +output; + +set zx 0, +set nx 0, +set zy 0, +set ny 1, +set f 1, +set no 1, +eval, +output; + +set zx 0, +set nx 0, +set zy 0, +set ny 0, +set f 0, +set no 0, +eval, +output; + +set zx 0, +set nx 1, +set zy 0, +set ny 1, +set f 0, +set no 1, +eval, +output; diff --git a/projects/02/ALU.cmp b/projects/02/ALU.cmp new file mode 100644 index 0000000..2ec3a55 --- /dev/null +++ b/projects/02/ALU.cmp @@ -0,0 +1,37 @@ +| x | y |zx |nx |zy |ny | f |no | out |zr |ng | +| 0000000000000000 | 1111111111111111 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 | +| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 | +| 0000000000000000 | 1111111111111111 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 | +| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000000000 | 1 | 0 | +| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 0 | 1111111111111111 | 0 | 1 | +| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 | +| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 0 | 1 | 0000000000000000 | 1 | 0 | +| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 | +| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 | +| 0000000000000000 | 1111111111111111 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 | +| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000000 | 1 | 0 | +| 0000000000000000 | 1111111111111111 | 0 | 0 | 1 | 1 | 1 | 0 | 1111111111111111 | 0 | 1 | +| 0000000000000000 | 1111111111111111 | 1 | 1 | 0 | 0 | 1 | 0 | 1111111111111110 | 0 | 1 | +| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 | +| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000000001 | 0 | 0 | +| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111111111 | 0 | 1 | +| 0000000000000000 | 1111111111111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000000 | 1 | 0 | +| 0000000000000000 | 1111111111111111 | 0 | 1 | 0 | 1 | 0 | 1 | 1111111111111111 | 0 | 1 | +| 0000000000010001 | 0000000000000011 | 1 | 0 | 1 | 0 | 1 | 0 | 0000000000000000 | 1 | 0 | +| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 1 | 1 | 1 | 0000000000000001 | 0 | 0 | +| 0000000000010001 | 0000000000000011 | 1 | 1 | 1 | 0 | 1 | 0 | 1111111111111111 | 0 | 1 | +| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 0 | 0000000000010001 | 0 | 0 | +| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 0 | 0000000000000011 | 0 | 0 | +| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 0 | 1 | 1111111111101110 | 0 | 1 | +| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 0 | 1 | 1111111111111100 | 0 | 1 | +| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 1 | 1111111111101111 | 0 | 1 | +| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 1 | 1111111111111101 | 0 | 1 | +| 0000000000010001 | 0000000000000011 | 0 | 1 | 1 | 1 | 1 | 1 | 0000000000010010 | 0 | 0 | +| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 1 | 1 | 1 | 0000000000000100 | 0 | 0 | +| 0000000000010001 | 0000000000000011 | 0 | 0 | 1 | 1 | 1 | 0 | 0000000000010000 | 0 | 0 | +| 0000000000010001 | 0000000000000011 | 1 | 1 | 0 | 0 | 1 | 0 | 0000000000000010 | 0 | 0 | +| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 1 | 0 | 0000000000010100 | 0 | 0 | +| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 0 | 1 | 1 | 0000000000001110 | 0 | 0 | +| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 1 | 1 | 1 | 1111111111110010 | 0 | 1 | +| 0000000000010001 | 0000000000000011 | 0 | 0 | 0 | 0 | 0 | 0 | 0000000000000001 | 0 | 0 | +| 0000000000010001 | 0000000000000011 | 0 | 1 | 0 | 1 | 0 | 1 | 0000000000010011 | 0 | 0 | diff --git a/projects/02/ALU.hdl b/projects/02/ALU.hdl new file mode 100644 index 0000000..9a753e3 --- /dev/null +++ b/projects/02/ALU.hdl @@ -0,0 +1,46 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/02/ALU.hdl + +/** + * The ALU (Arithmetic Logic Unit). + * 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, + * according to 6 input bits denoted zx,nx,zy,ny,f,no. + * In addition, the ALU computes two 1-bit outputs: + * if the ALU output == 0, zr is set to 1; otherwise zr is set to 0; + * if the ALU output < 0, ng is set to 1; otherwise ng is set to 0. + */ + +// Implementation: the ALU logic manipulates the x and y inputs +// and operates on the resulting values, as follows: +// if (zx == 1) set x = 0 // 16-bit constant +// if (nx == 1) set x = !x // bitwise not +// if (zy == 1) set y = 0 // 16-bit constant +// if (ny == 1) set y = !y // bitwise not +// if (f == 1) set out = x + y // integer 2's complement addition +// if (f == 0) set out = x & y // bitwise and +// if (no == 1) set out = !out // bitwise not +// if (out == 0) set zr = 1 +// if (out < 0) set ng = 1 + +CHIP ALU { + IN + x[16], y[16], // 16-bit inputs + zx, // zero the x input? + nx, // negate the x input? + zy, // zero the y input? + ny, // negate the y input? + f, // compute out = x + y (if 1) or x & y (if 0) + no; // negate the out output? + + OUT + out[16], // 16-bit output + zr, // 1 if (out == 0), 0 otherwise + ng; // 1 if (out < 0), 0 otherwise + + PARTS: + // Put you code here: +} \ No newline at end of file diff --git a/projects/02/ALU.tst b/projects/02/ALU.tst new file mode 100644 index 0000000..9e665b0 --- /dev/null +++ b/projects/02/ALU.tst @@ -0,0 +1,377 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/02/ALU.tst + +load ALU.hdl, +output-file ALU.out, +compare-to ALU.cmp, +output-list x%B1.16.1 y%B1.16.1 zx%B1.1.1 nx%B1.1.1 zy%B1.1.1 + ny%B1.1.1 f%B1.1.1 no%B1.1.1 out%B1.16.1 zr%B1.1.1 + ng%B1.1.1; + +set x %B0000000000000000, // x = 0 +set y %B1111111111111111; // y = -1 + +// Compute 0 +set zx 1, +set nx 0, +set zy 1, +set ny 0, +set f 1, +set no 0, +eval, +output; + +// Compute 1 +set zx 1, +set nx 1, +set zy 1, +set ny 1, +set f 1, +set no 1, +eval, +output; + +// Compute -1 +set zx 1, +set nx 1, +set zy 1, +set ny 0, +set f 1, +set no 0, +eval, +output; + +// Compute x +set zx 0, +set nx 0, +set zy 1, +set ny 1, +set f 0, +set no 0, +eval, +output; + +// Compute y +set zx 1, +set nx 1, +set zy 0, +set ny 0, +set f 0, +set no 0, +eval, +output; + +// Compute !x +set zx 0, +set nx 0, +set zy 1, +set ny 1, +set f 0, +set no 1, +eval, +output; + +// Compute !y +set zx 1, +set nx 1, +set zy 0, +set ny 0, +set f 0, +set no 1, +eval, +output; + +// Compute -x +set zx 0, +set nx 0, +set zy 1, +set ny 1, +set f 1, +set no 1, +eval, +output; + +// Compute -y +set zx 1, +set nx 1, +set zy 0, +set ny 0, +set f 1, +set no 1, +eval, +output; + +// Compute x + 1 +set zx 0, +set nx 1, +set zy 1, +set ny 1, +set f 1, +set no 1, +eval, +output; + +// Compute y + 1 +set zx 1, +set nx 1, +set zy 0, +set ny 1, +set f 1, +set no 1, +eval, +output; + +// Compute x - 1 +set zx 0, +set nx 0, +set zy 1, +set ny 1, +set f 1, +set no 0, +eval, +output; + +// Compute y - 1 +set zx 1, +set nx 1, +set zy 0, +set ny 0, +set f 1, +set no 0, +eval, +output; + +// Compute x + y +set zx 0, +set nx 0, +set zy 0, +set ny 0, +set f 1, +set no 0, +eval, +output; + +// Compute x - y +set zx 0, +set nx 1, +set zy 0, +set ny 0, +set f 1, +set no 1, +eval, +output; + +// Compute y - x +set zx 0, +set nx 0, +set zy 0, +set ny 1, +set f 1, +set no 1, +eval, +output; + +// Compute x & y +set zx 0, +set nx 0, +set zy 0, +set ny 0, +set f 0, +set no 0, +eval, +output; + +// Compute x | y +set zx 0, +set nx 1, +set zy 0, +set ny 1, +set f 0, +set no 1, +eval, +output; + +set x %B000000000010001, // x = 17 +set y %B000000000000011; // y = 3 + +// Compute 0 +set zx 1, +set nx 0, +set zy 1, +set ny 0, +set f 1, +set no 0, +eval, +output; + +// Compute 1 +set zx 1, +set nx 1, +set zy 1, +set ny 1, +set f 1, +set no 1, +eval, +output; + +// Compute -1 +set zx 1, +set nx 1, +set zy 1, +set ny 0, +set f 1, +set no 0, +eval, +output; + +// Compute x +set zx 0, +set nx 0, +set zy 1, +set ny 1, +set f 0, +set no 0, +eval, +output; + +// Compute y +set zx 1, +set nx 1, +set zy 0, +set ny 0, +set f 0, +set no 0, +eval, +output; + +// Compute !x +set zx 0, +set nx 0, +set zy 1, +set ny 1, +set f 0, +set no 1, +eval, +output; + +// Compute !y +set zx 1, +set nx 1, +set zy 0, +set ny 0, +set f 0, +set no 1, +eval, +output; + +// Compute -x +set zx 0, +set nx 0, +set zy 1, +set ny 1, +set f 1, +set no 1, +eval, +output; + +// Compute -y +set zx 1, +set nx 1, +set zy 0, +set ny 0, +set f 1, +set no 1, +eval, +output; + +// Compute x + 1 +set zx 0, +set nx 1, +set zy 1, +set ny 1, +set f 1, +set no 1, +eval, +output; + +// Compute y + 1 +set zx 1, +set nx 1, +set zy 0, +set ny 1, +set f 1, +set no 1, +eval, +output; + +// Compute x - 1 +set zx 0, +set nx 0, +set zy 1, +set ny 1, +set f 1, +set no 0, +eval, +output; + +// Compute y - 1 +set zx 1, +set nx 1, +set zy 0, +set ny 0, +set f 1, +set no 0, +eval, +output; + +// Compute x + y +set zx 0, +set nx 0, +set zy 0, +set ny 0, +set f 1, +set no 0, +eval, +output; + +// Compute x - y +set zx 0, +set nx 1, +set zy 0, +set ny 0, +set f 1, +set no 1, +eval, +output; + +// Compute y - x +set zx 0, +set nx 0, +set zy 0, +set ny 1, +set f 1, +set no 1, +eval, +output; + +// Compute x & y +set zx 0, +set nx 0, +set zy 0, +set ny 0, +set f 0, +set no 0, +eval, +output; + +// Compute x | y +set zx 0, +set nx 1, +set zy 0, +set ny 1, +set f 0, +set no 1, +eval, +output; diff --git a/projects/02/Add16.cmp b/projects/02/Add16.cmp new file mode 100644 index 0000000..76d069c --- /dev/null +++ b/projects/02/Add16.cmp @@ -0,0 +1,7 @@ +| a | b | out | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | +| 0000000000000000 | 1111111111111111 | 1111111111111111 | +| 1111111111111111 | 1111111111111111 | 1111111111111110 | +| 1010101010101010 | 0101010101010101 | 1111111111111111 | +| 0011110011000011 | 0000111111110000 | 0100110010110011 | +| 0001001000110100 | 1001100001110110 | 1010101010101010 | diff --git a/projects/02/Add16.hdl b/projects/02/Add16.hdl new file mode 100644 index 0000000..aa7604d --- /dev/null +++ b/projects/02/Add16.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: projects/02/Adder16.hdl + +/** + * Adds two 16-bit values. + * The most significant carry bit is ignored. + */ + +CHIP Add16 { + IN a[16], b[16]; + OUT out[16]; + + PARTS: + // Put you code here: +} \ No newline at end of file diff --git a/projects/02/Add16.tst b/projects/02/Add16.tst new file mode 100644 index 0000000..85e1be1 --- /dev/null +++ b/projects/02/Add16.tst @@ -0,0 +1,39 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/02/Add16.tst + +load Add16.hdl, +output-file Add16.out, +compare-to Add16.cmp, +output-list a%B1.16.1 b%B1.16.1 out%B1.16.1; + +set a %B0000000000000000, +set b %B0000000000000000, +eval, +output; + +set a %B0000000000000000, +set b %B1111111111111111, +eval, +output; + +set a %B1111111111111111, +set b %B1111111111111111, +eval, +output; + +set a %B1010101010101010, +set b %B0101010101010101, +eval, +output; + +set a %B0011110011000011, +set b %B0000111111110000, +eval, +output; + +set a %B0001001000110100, +set b %B1001100001110110, +eval, +output; diff --git a/projects/02/FullAdder.cmp b/projects/02/FullAdder.cmp new file mode 100644 index 0000000..84551aa --- /dev/null +++ b/projects/02/FullAdder.cmp @@ -0,0 +1,9 @@ +| a | b | c | sum | carry | +| 0 | 0 | 0 | 0 | 0 | +| 0 | 0 | 1 | 1 | 0 | +| 0 | 1 | 0 | 1 | 0 | +| 0 | 1 | 1 | 0 | 1 | +| 1 | 0 | 0 | 1 | 0 | +| 1 | 0 | 1 | 0 | 1 | +| 1 | 1 | 0 | 0 | 1 | +| 1 | 1 | 1 | 1 | 1 | diff --git a/projects/02/FullAdder.hdl b/projects/02/FullAdder.hdl new file mode 100644 index 0000000..67559c3 --- /dev/null +++ b/projects/02/FullAdder.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: projects/02/FullAdder.hdl + +/** + * Computes the sum of three bits. + */ + +CHIP FullAdder { + IN a, b, c; // 1-bit inputs + OUT sum, // Right bit of a + b + c + carry; // Left bit of a + b + c + + PARTS: + // Put you code here: +} \ No newline at end of file diff --git a/projects/02/FullAdder.tst b/projects/02/FullAdder.tst new file mode 100644 index 0000000..5125cee --- /dev/null +++ b/projects/02/FullAdder.tst @@ -0,0 +1,47 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/02/FullAdder.tst + +load FullAdder.hdl, +output-file FullAdder.out, +compare-to FullAdder.cmp, +output-list a%B3.1.3 b%B3.1.3 c%B3.1.3 sum%B3.1.3 carry%B3.1.3; + +set a 0, +set b 0, +set c 0, +eval, +output; + +set c 1, +eval, +output; + +set b 1, +set c 0, +eval, +output; + +set c 1, +eval, +output; + +set a 1, +set b 0, +set c 0, +eval, +output; + +set c 1, +eval, +output; + +set b 1, +set c 0, +eval, +output; + +set c 1, +eval, +output; diff --git a/projects/02/HalfAdder.cmp b/projects/02/HalfAdder.cmp new file mode 100644 index 0000000..911c770 --- /dev/null +++ b/projects/02/HalfAdder.cmp @@ -0,0 +1,5 @@ +| a | b | sum | carry | +| 0 | 0 | 0 | 0 | +| 0 | 1 | 1 | 0 | +| 1 | 0 | 1 | 0 | +| 1 | 1 | 0 | 1 | diff --git a/projects/02/HalfAdder.hdl b/projects/02/HalfAdder.hdl new file mode 100644 index 0000000..98b281f --- /dev/null +++ b/projects/02/HalfAdder.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: projects/02/HalfAdder.hdl + +/** + * Computes the sum of two bits. + */ + +CHIP HalfAdder { + IN a, b; // 1-bit inputs + OUT sum, // Right bit of a + b + carry; // Left bit of a + b + + PARTS: + // Put you code here: +} diff --git a/projects/02/HalfAdder.tst b/projects/02/HalfAdder.tst new file mode 100644 index 0000000..069b8ea --- /dev/null +++ b/projects/02/HalfAdder.tst @@ -0,0 +1,29 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/02/HalfAdder.tst + +load HalfAdder.hdl, +output-file HalfAdder.out, +compare-to HalfAdder.cmp, +output-list a%B3.1.3 b%B3.1.3 sum%B3.1.3 carry%B3.1.3; + +set a 0, +set b 0, +eval, +output; + +set a 0, +set b 1, +eval, +output; + +set a 1, +set b 0, +eval, +output; + +set a 1, +set b 1, +eval, +output; diff --git a/projects/02/Inc16.cmp b/projects/02/Inc16.cmp new file mode 100644 index 0000000..451f563 --- /dev/null +++ b/projects/02/Inc16.cmp @@ -0,0 +1,5 @@ +| in | out | +| 0000000000000000 | 0000000000000001 | +| 1111111111111111 | 0000000000000000 | +| 0000000000000101 | 0000000000000110 | +| 1111111111111011 | 1111111111111100 | diff --git a/projects/02/Inc16.hdl b/projects/02/Inc16.hdl new file mode 100644 index 0000000..fb6c0dd --- /dev/null +++ b/projects/02/Inc16.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: projects/02/Inc16.hdl + +/** + * 16-bit incrementer: + * out = in + 1 (arithmetic addition) + */ + +CHIP Inc16 { + IN in[16]; + OUT out[16]; + + PARTS: + // Put you code here: +} \ No newline at end of file diff --git a/projects/02/Inc16.tst b/projects/02/Inc16.tst new file mode 100644 index 0000000..8537d86 --- /dev/null +++ b/projects/02/Inc16.tst @@ -0,0 +1,25 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/02/Inc16.tst + +load Inc16.hdl, +output-file Inc16.out, +compare-to Inc16.cmp, +output-list in%B1.16.1 out%B1.16.1; + +set in %B0000000000000000, // in = 0 +eval, +output; + +set in %B1111111111111111, // in = -1 +eval, +output; + +set in %B0000000000000101, // in = 5 +eval, +output; + +set in %B1111111111111011, // in = -5 +eval, +output; diff --git a/projects/03/a/Bit.cmp b/projects/03/a/Bit.cmp new file mode 100644 index 0000000..e900ec7 --- /dev/null +++ b/projects/03/a/Bit.cmp @@ -0,0 +1,215 @@ +| time | in |load | out | +| 0+ | 0 | 0 | 0 | +| 1 | 0 | 0 | 0 | +| 1+ | 0 | 1 | 0 | +| 2 | 0 | 1 | 0 | +| 2+ | 1 | 0 | 0 | +| 3 | 1 | 0 | 0 | +| 3+ | 1 | 1 | 0 | +| 4 | 1 | 1 | 1 | +| 4+ | 0 | 0 | 1 | +| 5 | 0 | 0 | 1 | +| 5+ | 1 | 0 | 1 | +| 6 | 1 | 0 | 1 | +| 6+ | 0 | 1 | 1 | +| 7 | 0 | 1 | 0 | +| 7+ | 1 | 1 | 0 | +| 8 | 1 | 1 | 1 | +| 8+ | 0 | 0 | 1 | +| 9 | 0 | 0 | 1 | +| 9+ | 0 | 0 | 1 | +| 10 | 0 | 0 | 1 | +| 10+ | 0 | 0 | 1 | +| 11 | 0 | 0 | 1 | +| 11+ | 0 | 0 | 1 | +| 12 | 0 | 0 | 1 | +| 12+ | 0 | 0 | 1 | +| 13 | 0 | 0 | 1 | +| 13+ | 0 | 0 | 1 | +| 14 | 0 | 0 | 1 | +| 14+ | 0 | 0 | 1 | +| 15 | 0 | 0 | 1 | +| 15+ | 0 | 0 | 1 | +| 16 | 0 | 0 | 1 | +| 16+ | 0 | 0 | 1 | +| 17 | 0 | 0 | 1 | +| 17+ | 0 | 0 | 1 | +| 18 | 0 | 0 | 1 | +| 18+ | 0 | 0 | 1 | +| 19 | 0 | 0 | 1 | +| 19+ | 0 | 0 | 1 | +| 20 | 0 | 0 | 1 | +| 20+ | 0 | 0 | 1 | +| 21 | 0 | 0 | 1 | +| 21+ | 0 | 0 | 1 | +| 22 | 0 | 0 | 1 | +| 22+ | 0 | 0 | 1 | +| 23 | 0 | 0 | 1 | +| 23+ | 0 | 0 | 1 | +| 24 | 0 | 0 | 1 | +| 24+ | 0 | 0 | 1 | +| 25 | 0 | 0 | 1 | +| 25+ | 0 | 0 | 1 | +| 26 | 0 | 0 | 1 | +| 26+ | 0 | 0 | 1 | +| 27 | 0 | 0 | 1 | +| 27+ | 0 | 0 | 1 | +| 28 | 0 | 0 | 1 | +| 28+ | 0 | 0 | 1 | +| 29 | 0 | 0 | 1 | +| 29+ | 0 | 0 | 1 | +| 30 | 0 | 0 | 1 | +| 30+ | 0 | 0 | 1 | +| 31 | 0 | 0 | 1 | +| 31+ | 0 | 0 | 1 | +| 32 | 0 | 0 | 1 | +| 32+ | 0 | 0 | 1 | +| 33 | 0 | 0 | 1 | +| 33+ | 0 | 0 | 1 | +| 34 | 0 | 0 | 1 | +| 34+ | 0 | 0 | 1 | +| 35 | 0 | 0 | 1 | +| 35+ | 0 | 0 | 1 | +| 36 | 0 | 0 | 1 | +| 36+ | 0 | 0 | 1 | +| 37 | 0 | 0 | 1 | +| 37+ | 0 | 0 | 1 | +| 38 | 0 | 0 | 1 | +| 38+ | 0 | 0 | 1 | +| 39 | 0 | 0 | 1 | +| 39+ | 0 | 0 | 1 | +| 40 | 0 | 0 | 1 | +| 40+ | 0 | 0 | 1 | +| 41 | 0 | 0 | 1 | +| 41+ | 0 | 0 | 1 | +| 42 | 0 | 0 | 1 | +| 42+ | 0 | 0 | 1 | +| 43 | 0 | 0 | 1 | +| 43+ | 0 | 0 | 1 | +| 44 | 0 | 0 | 1 | +| 44+ | 0 | 0 | 1 | +| 45 | 0 | 0 | 1 | +| 45+ | 0 | 0 | 1 | +| 46 | 0 | 0 | 1 | +| 46+ | 0 | 0 | 1 | +| 47 | 0 | 0 | 1 | +| 47+ | 0 | 0 | 1 | +| 48 | 0 | 0 | 1 | +| 48+ | 0 | 0 | 1 | +| 49 | 0 | 0 | 1 | +| 49+ | 0 | 0 | 1 | +| 50 | 0 | 0 | 1 | +| 50+ | 0 | 0 | 1 | +| 51 | 0 | 0 | 1 | +| 51+ | 0 | 0 | 1 | +| 52 | 0 | 0 | 1 | +| 52+ | 0 | 0 | 1 | +| 53 | 0 | 0 | 1 | +| 53+ | 0 | 0 | 1 | +| 54 | 0 | 0 | 1 | +| 54+ | 0 | 0 | 1 | +| 55 | 0 | 0 | 1 | +| 55+ | 0 | 0 | 1 | +| 56 | 0 | 0 | 1 | +| 56+ | 0 | 0 | 1 | +| 57 | 0 | 0 | 1 | +| 57+ | 0 | 1 | 1 | +| 58 | 0 | 1 | 0 | +| 58+ | 1 | 0 | 0 | +| 59 | 1 | 0 | 0 | +| 59+ | 1 | 0 | 0 | +| 60 | 1 | 0 | 0 | +| 60+ | 1 | 0 | 0 | +| 61 | 1 | 0 | 0 | +| 61+ | 1 | 0 | 0 | +| 62 | 1 | 0 | 0 | +| 62+ | 1 | 0 | 0 | +| 63 | 1 | 0 | 0 | +| 63+ | 1 | 0 | 0 | +| 64 | 1 | 0 | 0 | +| 64+ | 1 | 0 | 0 | +| 65 | 1 | 0 | 0 | +| 65+ | 1 | 0 | 0 | +| 66 | 1 | 0 | 0 | +| 66+ | 1 | 0 | 0 | +| 67 | 1 | 0 | 0 | +| 67+ | 1 | 0 | 0 | +| 68 | 1 | 0 | 0 | +| 68+ | 1 | 0 | 0 | +| 69 | 1 | 0 | 0 | +| 69+ | 1 | 0 | 0 | +| 70 | 1 | 0 | 0 | +| 70+ | 1 | 0 | 0 | +| 71 | 1 | 0 | 0 | +| 71+ | 1 | 0 | 0 | +| 72 | 1 | 0 | 0 | +| 72+ | 1 | 0 | 0 | +| 73 | 1 | 0 | 0 | +| 73+ | 1 | 0 | 0 | +| 74 | 1 | 0 | 0 | +| 74+ | 1 | 0 | 0 | +| 75 | 1 | 0 | 0 | +| 75+ | 1 | 0 | 0 | +| 76 | 1 | 0 | 0 | +| 76+ | 1 | 0 | 0 | +| 77 | 1 | 0 | 0 | +| 77+ | 1 | 0 | 0 | +| 78 | 1 | 0 | 0 | +| 78+ | 1 | 0 | 0 | +| 79 | 1 | 0 | 0 | +| 79+ | 1 | 0 | 0 | +| 80 | 1 | 0 | 0 | +| 80+ | 1 | 0 | 0 | +| 81 | 1 | 0 | 0 | +| 81+ | 1 | 0 | 0 | +| 82 | 1 | 0 | 0 | +| 82+ | 1 | 0 | 0 | +| 83 | 1 | 0 | 0 | +| 83+ | 1 | 0 | 0 | +| 84 | 1 | 0 | 0 | +| 84+ | 1 | 0 | 0 | +| 85 | 1 | 0 | 0 | +| 85+ | 1 | 0 | 0 | +| 86 | 1 | 0 | 0 | +| 86+ | 1 | 0 | 0 | +| 87 | 1 | 0 | 0 | +| 87+ | 1 | 0 | 0 | +| 88 | 1 | 0 | 0 | +| 88+ | 1 | 0 | 0 | +| 89 | 1 | 0 | 0 | +| 89+ | 1 | 0 | 0 | +| 90 | 1 | 0 | 0 | +| 90+ | 1 | 0 | 0 | +| 91 | 1 | 0 | 0 | +| 91+ | 1 | 0 | 0 | +| 92 | 1 | 0 | 0 | +| 92+ | 1 | 0 | 0 | +| 93 | 1 | 0 | 0 | +| 93+ | 1 | 0 | 0 | +| 94 | 1 | 0 | 0 | +| 94+ | 1 | 0 | 0 | +| 95 | 1 | 0 | 0 | +| 95+ | 1 | 0 | 0 | +| 96 | 1 | 0 | 0 | +| 96+ | 1 | 0 | 0 | +| 97 | 1 | 0 | 0 | +| 97+ | 1 | 0 | 0 | +| 98 | 1 | 0 | 0 | +| 98+ | 1 | 0 | 0 | +| 99 | 1 | 0 | 0 | +| 99+ | 1 | 0 | 0 | +| 100 | 1 | 0 | 0 | +| 100+ | 1 | 0 | 0 | +| 101 | 1 | 0 | 0 | +| 101+ | 1 | 0 | 0 | +| 102 | 1 | 0 | 0 | +| 102+ | 1 | 0 | 0 | +| 103 | 1 | 0 | 0 | +| 103+ | 1 | 0 | 0 | +| 104 | 1 | 0 | 0 | +| 104+ | 1 | 0 | 0 | +| 105 | 1 | 0 | 0 | +| 105+ | 1 | 0 | 0 | +| 106 | 1 | 0 | 0 | +| 106+ | 1 | 0 | 0 | +| 107 | 1 | 0 | 0 | diff --git a/projects/03/a/Bit.hdl b/projects/03/a/Bit.hdl new file mode 100644 index 0000000..3064198 --- /dev/null +++ b/projects/03/a/Bit.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: projects/03/a/Bit.hdl + +/** + * 1-bit register: + * If load[t] == 1 then out[t+1] = in[t] + * else out does not change (out[t+1] = out[t]) + */ + +CHIP Bit { + IN in, load; + OUT out; + + PARTS: + // Put your code here: +} diff --git a/projects/03/a/Bit.tst b/projects/03/a/Bit.tst new file mode 100644 index 0000000..c6bf523 --- /dev/null +++ b/projects/03/a/Bit.tst @@ -0,0 +1,865 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/03/a/Bit.tst + +load Bit.hdl, +output-file Bit.out, +compare-to Bit.cmp, +output-list time%S1.4.1 in%B2.1.2 load%B2.1.2 out%B2.1.2; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 1, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 1, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 1, +tick, +output; + +tock, +output; + +set in 1, +set load 1, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 1, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; + +set in 1, +set load 0, +tick, +output; + +tock, +output; diff --git a/projects/03/a/PC.cmp b/projects/03/a/PC.cmp new file mode 100644 index 0000000..6a050d9 --- /dev/null +++ b/projects/03/a/PC.cmp @@ -0,0 +1,31 @@ +| time | in |reset|load | inc | out | +| 0+ | 0 | 0 | 0 | 0 | 0 | +| 1 | 0 | 0 | 0 | 0 | 0 | +| 1+ | 0 | 0 | 0 | 1 | 0 | +| 2 | 0 | 0 | 0 | 1 | 1 | +| 2+ | -32123 | 0 | 0 | 1 | 1 | +| 3 | -32123 | 0 | 0 | 1 | 2 | +| 3+ | -32123 | 0 | 1 | 1 | 2 | +| 4 | -32123 | 0 | 1 | 1 | -32123 | +| 4+ | -32123 | 0 | 0 | 1 | -32123 | +| 5 | -32123 | 0 | 0 | 1 | -32122 | +| 5+ | -32123 | 0 | 0 | 1 | -32122 | +| 6 | -32123 | 0 | 0 | 1 | -32121 | +| 6+ | 12345 | 0 | 1 | 0 | -32121 | +| 7 | 12345 | 0 | 1 | 0 | 12345 | +| 7+ | 12345 | 1 | 1 | 0 | 12345 | +| 8 | 12345 | 1 | 1 | 0 | 0 | +| 8+ | 12345 | 0 | 1 | 1 | 0 | +| 9 | 12345 | 0 | 1 | 1 | 12345 | +| 9+ | 12345 | 1 | 1 | 1 | 12345 | +| 10 | 12345 | 1 | 1 | 1 | 0 | +| 10+ | 12345 | 0 | 0 | 1 | 0 | +| 11 | 12345 | 0 | 0 | 1 | 1 | +| 11+ | 12345 | 1 | 0 | 1 | 1 | +| 12 | 12345 | 1 | 0 | 1 | 0 | +| 12+ | 0 | 0 | 1 | 1 | 0 | +| 13 | 0 | 0 | 1 | 1 | 0 | +| 13+ | 0 | 0 | 0 | 1 | 0 | +| 14 | 0 | 0 | 0 | 1 | 1 | +| 14+ | 22222 | 1 | 0 | 0 | 1 | +| 15 | 22222 | 1 | 0 | 0 | 0 | diff --git a/projects/03/a/PC.hdl b/projects/03/a/PC.hdl new file mode 100644 index 0000000..a326e43 --- /dev/null +++ b/projects/03/a/PC.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: projects/03/a/PC.hdl + +/** + * A 16-bit counter with load and reset control bits. + * if (reset[t] == 1) out[t+1] = 0 + * else if (load[t] == 1) out[t+1] = in[t] + * else if (inc[t] == 1) out[t+1] = out[t] + 1 (integer addition) + * else out[t+1] = out[t] + */ + +CHIP PC { + IN in[16],load,inc,reset; + OUT out[16]; + + PARTS: + // Put your code here: +} diff --git a/projects/03/a/PC.tst b/projects/03/a/PC.tst new file mode 100644 index 0000000..7f4f3cd --- /dev/null +++ b/projects/03/a/PC.tst @@ -0,0 +1,125 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/03/a/PC.tst + +load PC.hdl, +output-file PC.out, +compare-to PC.cmp, +output-list time%S1.4.1 in%D1.6.1 reset%B2.1.2 load%B2.1.2 inc%B2.1.2 out%D1.6.1; + +set in 0, +set reset 0, +set load 0, +set inc 0, +tick, +output; + +tock, +output; + +set inc 1, +tick, +output; + +tock, +output; + +set in -32123, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set load 0, +tick, +output; + +tock, +output; + +tick, +output; + +tock, +output; + +set in 12345, +set load 1, +set inc 0, +tick, +output; + +tock, +output; + +set reset 1, +tick, +output; + +tock, +output; + +set reset 0, +set inc 1, +tick, +output; + +tock, +output; + +set reset 1, +tick, +output; + +tock, +output; + +set reset 0, +set load 0, +tick, +output; + +tock, +output; + +set reset 1, +tick, +output; + +tock, +output; + +set in 0, +set reset 0, +set load 1, +tick, +output; + +tock, +output; + +set load 0, +set inc 1, +tick, +output; + +tock, +output; + +set in 22222, +set reset 1, +set inc 0, +tick, +output; + +tock, +output; diff --git a/projects/03/a/RAM64.cmp b/projects/03/a/RAM64.cmp new file mode 100644 index 0000000..fdb7745 --- /dev/null +++ b/projects/03/a/RAM64.cmp @@ -0,0 +1,320 @@ +| time | in |load |address| out | +| 0+ | 0 | 0 | 0 | 0 | +| 1 | 0 | 0 | 0 | 0 | +| 1+ | 0 | 1 | 0 | 0 | +| 2 | 0 | 1 | 0 | 0 | +| 2+ | 1313 | 0 | 0 | 0 | +| 3 | 1313 | 0 | 0 | 0 | +| 3+ | 1313 | 1 | 13 | 0 | +| 4 | 1313 | 1 | 13 | 1313 | +| 4+ | 1313 | 0 | 0 | 0 | +| 5 | 1313 | 0 | 0 | 0 | +| 5+ | 4747 | 0 | 47 | 0 | +| 6 | 4747 | 0 | 47 | 0 | +| 6+ | 4747 | 1 | 47 | 0 | +| 7 | 4747 | 1 | 47 | 4747 | +| 7+ | 4747 | 0 | 47 | 4747 | +| 8 | 4747 | 0 | 47 | 4747 | +| 8 | 4747 | 0 | 13 | 1313 | +| 8+ | 6363 | 0 | 13 | 1313 | +| 9 | 6363 | 0 | 13 | 1313 | +| 9+ | 6363 | 1 | 63 | 0 | +| 10 | 6363 | 1 | 63 | 6363 | +| 10+ | 6363 | 0 | 63 | 6363 | +| 11 | 6363 | 0 | 63 | 6363 | +| 11 | 6363 | 0 | 47 | 4747 | +| 11 | 6363 | 0 | 63 | 6363 | +| 11+ | 6363 | 0 | 40 | 0 | +| 12 | 6363 | 0 | 40 | 0 | +| 12 | 6363 | 0 | 41 | 0 | +| 12 | 6363 | 0 | 42 | 0 | +| 12 | 6363 | 0 | 43 | 0 | +| 12 | 6363 | 0 | 44 | 0 | +| 12 | 6363 | 0 | 45 | 0 | +| 12 | 6363 | 0 | 46 | 0 | +| 12 | 6363 | 0 | 47 | 4747 | +| 12+ | 21845 | 1 | 40 | 0 | +| 13 | 21845 | 1 | 40 | 21845 | +| 13+ | 21845 | 1 | 41 | 0 | +| 14 | 21845 | 1 | 41 | 21845 | +| 14+ | 21845 | 1 | 42 | 0 | +| 15 | 21845 | 1 | 42 | 21845 | +| 15+ | 21845 | 1 | 43 | 0 | +| 16 | 21845 | 1 | 43 | 21845 | +| 16+ | 21845 | 1 | 44 | 0 | +| 17 | 21845 | 1 | 44 | 21845 | +| 17+ | 21845 | 1 | 45 | 0 | +| 18 | 21845 | 1 | 45 | 21845 | +| 18+ | 21845 | 1 | 46 | 0 | +| 19 | 21845 | 1 | 46 | 21845 | +| 19+ | 21845 | 1 | 47 | 4747 | +| 20 | 21845 | 1 | 47 | 21845 | +| 20+ | 21845 | 0 | 40 | 21845 | +| 21 | 21845 | 0 | 40 | 21845 | +| 21 | 21845 | 0 | 41 | 21845 | +| 21 | 21845 | 0 | 42 | 21845 | +| 21 | 21845 | 0 | 43 | 21845 | +| 21 | 21845 | 0 | 44 | 21845 | +| 21 | 21845 | 0 | 45 | 21845 | +| 21 | 21845 | 0 | 46 | 21845 | +| 21 | 21845 | 0 | 47 | 21845 | +| 21+ | -21846 | 1 | 40 | 21845 | +| 22 | -21846 | 1 | 40 | -21846 | +| 22+ | -21846 | 0 | 40 | -21846 | +| 23 | -21846 | 0 | 40 | -21846 | +| 23 | -21846 | 0 | 41 | 21845 | +| 23 | -21846 | 0 | 42 | 21845 | +| 23 | -21846 | 0 | 43 | 21845 | +| 23 | -21846 | 0 | 44 | 21845 | +| 23 | -21846 | 0 | 45 | 21845 | +| 23 | -21846 | 0 | 46 | 21845 | +| 23 | -21846 | 0 | 47 | 21845 | +| 23+ | 21845 | 1 | 40 | -21846 | +| 24 | 21845 | 1 | 40 | 21845 | +| 24+ | -21846 | 1 | 41 | 21845 | +| 25 | -21846 | 1 | 41 | -21846 | +| 25+ | -21846 | 0 | 40 | 21845 | +| 26 | -21846 | 0 | 40 | 21845 | +| 26 | -21846 | 0 | 41 | -21846 | +| 26 | -21846 | 0 | 42 | 21845 | +| 26 | -21846 | 0 | 43 | 21845 | +| 26 | -21846 | 0 | 44 | 21845 | +| 26 | -21846 | 0 | 45 | 21845 | +| 26 | -21846 | 0 | 46 | 21845 | +| 26 | -21846 | 0 | 47 | 21845 | +| 26+ | 21845 | 1 | 41 | -21846 | +| 27 | 21845 | 1 | 41 | 21845 | +| 27+ | -21846 | 1 | 42 | 21845 | +| 28 | -21846 | 1 | 42 | -21846 | +| 28+ | -21846 | 0 | 40 | 21845 | +| 29 | -21846 | 0 | 40 | 21845 | +| 29 | -21846 | 0 | 41 | 21845 | +| 29 | -21846 | 0 | 42 | -21846 | +| 29 | -21846 | 0 | 43 | 21845 | +| 29 | -21846 | 0 | 44 | 21845 | +| 29 | -21846 | 0 | 45 | 21845 | +| 29 | -21846 | 0 | 46 | 21845 | +| 29 | -21846 | 0 | 47 | 21845 | +| 29+ | 21845 | 1 | 42 | -21846 | +| 30 | 21845 | 1 | 42 | 21845 | +| 30+ | -21846 | 1 | 43 | 21845 | +| 31 | -21846 | 1 | 43 | -21846 | +| 31+ | -21846 | 0 | 40 | 21845 | +| 32 | -21846 | 0 | 40 | 21845 | +| 32 | -21846 | 0 | 41 | 21845 | +| 32 | -21846 | 0 | 42 | 21845 | +| 32 | -21846 | 0 | 43 | -21846 | +| 32 | -21846 | 0 | 44 | 21845 | +| 32 | -21846 | 0 | 45 | 21845 | +| 32 | -21846 | 0 | 46 | 21845 | +| 32 | -21846 | 0 | 47 | 21845 | +| 32+ | 21845 | 1 | 43 | -21846 | +| 33 | 21845 | 1 | 43 | 21845 | +| 33+ | -21846 | 1 | 44 | 21845 | +| 34 | -21846 | 1 | 44 | -21846 | +| 34+ | -21846 | 0 | 40 | 21845 | +| 35 | -21846 | 0 | 40 | 21845 | +| 35 | -21846 | 0 | 41 | 21845 | +| 35 | -21846 | 0 | 42 | 21845 | +| 35 | -21846 | 0 | 43 | 21845 | +| 35 | -21846 | 0 | 44 | -21846 | +| 35 | -21846 | 0 | 45 | 21845 | +| 35 | -21846 | 0 | 46 | 21845 | +| 35 | -21846 | 0 | 47 | 21845 | +| 35+ | 21845 | 1 | 44 | -21846 | +| 36 | 21845 | 1 | 44 | 21845 | +| 36+ | -21846 | 1 | 45 | 21845 | +| 37 | -21846 | 1 | 45 | -21846 | +| 37+ | -21846 | 0 | 40 | 21845 | +| 38 | -21846 | 0 | 40 | 21845 | +| 38 | -21846 | 0 | 41 | 21845 | +| 38 | -21846 | 0 | 42 | 21845 | +| 38 | -21846 | 0 | 43 | 21845 | +| 38 | -21846 | 0 | 44 | 21845 | +| 38 | -21846 | 0 | 45 | -21846 | +| 38 | -21846 | 0 | 46 | 21845 | +| 38 | -21846 | 0 | 47 | 21845 | +| 38+ | 21845 | 1 | 45 | -21846 | +| 39 | 21845 | 1 | 45 | 21845 | +| 39+ | -21846 | 1 | 46 | 21845 | +| 40 | -21846 | 1 | 46 | -21846 | +| 40+ | -21846 | 0 | 40 | 21845 | +| 41 | -21846 | 0 | 40 | 21845 | +| 41 | -21846 | 0 | 41 | 21845 | +| 41 | -21846 | 0 | 42 | 21845 | +| 41 | -21846 | 0 | 43 | 21845 | +| 41 | -21846 | 0 | 44 | 21845 | +| 41 | -21846 | 0 | 45 | 21845 | +| 41 | -21846 | 0 | 46 | -21846 | +| 41 | -21846 | 0 | 47 | 21845 | +| 41+ | 21845 | 1 | 46 | -21846 | +| 42 | 21845 | 1 | 46 | 21845 | +| 42+ | -21846 | 1 | 47 | 21845 | +| 43 | -21846 | 1 | 47 | -21846 | +| 43+ | -21846 | 0 | 40 | 21845 | +| 44 | -21846 | 0 | 40 | 21845 | +| 44 | -21846 | 0 | 41 | 21845 | +| 44 | -21846 | 0 | 42 | 21845 | +| 44 | -21846 | 0 | 43 | 21845 | +| 44 | -21846 | 0 | 44 | 21845 | +| 44 | -21846 | 0 | 45 | 21845 | +| 44 | -21846 | 0 | 46 | 21845 | +| 44 | -21846 | 0 | 47 | -21846 | +| 44+ | 21845 | 1 | 47 | -21846 | +| 45 | 21845 | 1 | 47 | 21845 | +| 45+ | 21845 | 0 | 40 | 21845 | +| 46 | 21845 | 0 | 40 | 21845 | +| 46 | 21845 | 0 | 41 | 21845 | +| 46 | 21845 | 0 | 42 | 21845 | +| 46 | 21845 | 0 | 43 | 21845 | +| 46 | 21845 | 0 | 44 | 21845 | +| 46 | 21845 | 0 | 45 | 21845 | +| 46 | 21845 | 0 | 46 | 21845 | +| 46 | 21845 | 0 | 47 | 21845 | +| 46+ | 21845 | 0 | 5 | 0 | +| 47 | 21845 | 0 | 5 | 0 | +| 47 | 21845 | 0 | 13 | 1313 | +| 47 | 21845 | 0 | 21 | 0 | +| 47 | 21845 | 0 | 29 | 0 | +| 47 | 21845 | 0 | 37 | 0 | +| 47 | 21845 | 0 | 45 | 21845 | +| 47 | 21845 | 0 | 53 | 0 | +| 47 | 21845 | 0 | 61 | 0 | +| 47+ | 21845 | 1 | 5 | 0 | +| 48 | 21845 | 1 | 5 | 21845 | +| 48+ | 21845 | 1 | 13 | 1313 | +| 49 | 21845 | 1 | 13 | 21845 | +| 49+ | 21845 | 1 | 21 | 0 | +| 50 | 21845 | 1 | 21 | 21845 | +| 50+ | 21845 | 1 | 29 | 0 | +| 51 | 21845 | 1 | 29 | 21845 | +| 51+ | 21845 | 1 | 37 | 0 | +| 52 | 21845 | 1 | 37 | 21845 | +| 52+ | 21845 | 1 | 45 | 21845 | +| 53 | 21845 | 1 | 45 | 21845 | +| 53+ | 21845 | 1 | 53 | 0 | +| 54 | 21845 | 1 | 53 | 21845 | +| 54+ | 21845 | 1 | 61 | 0 | +| 55 | 21845 | 1 | 61 | 21845 | +| 55+ | 21845 | 0 | 5 | 21845 | +| 56 | 21845 | 0 | 5 | 21845 | +| 56 | 21845 | 0 | 13 | 21845 | +| 56 | 21845 | 0 | 21 | 21845 | +| 56 | 21845 | 0 | 29 | 21845 | +| 56 | 21845 | 0 | 37 | 21845 | +| 56 | 21845 | 0 | 45 | 21845 | +| 56 | 21845 | 0 | 53 | 21845 | +| 56 | 21845 | 0 | 61 | 21845 | +| 56+ | -21846 | 1 | 5 | 21845 | +| 57 | -21846 | 1 | 5 | -21846 | +| 57+ | -21846 | 0 | 5 | -21846 | +| 58 | -21846 | 0 | 5 | -21846 | +| 58 | -21846 | 0 | 13 | 21845 | +| 58 | -21846 | 0 | 21 | 21845 | +| 58 | -21846 | 0 | 29 | 21845 | +| 58 | -21846 | 0 | 37 | 21845 | +| 58 | -21846 | 0 | 45 | 21845 | +| 58 | -21846 | 0 | 53 | 21845 | +| 58 | -21846 | 0 | 61 | 21845 | +| 58+ | 21845 | 1 | 5 | -21846 | +| 59 | 21845 | 1 | 5 | 21845 | +| 59+ | -21846 | 1 | 13 | 21845 | +| 60 | -21846 | 1 | 13 | -21846 | +| 60+ | -21846 | 0 | 5 | 21845 | +| 61 | -21846 | 0 | 5 | 21845 | +| 61 | -21846 | 0 | 13 | -21846 | +| 61 | -21846 | 0 | 21 | 21845 | +| 61 | -21846 | 0 | 29 | 21845 | +| 61 | -21846 | 0 | 37 | 21845 | +| 61 | -21846 | 0 | 45 | 21845 | +| 61 | -21846 | 0 | 53 | 21845 | +| 61 | -21846 | 0 | 61 | 21845 | +| 61+ | 21845 | 1 | 13 | -21846 | +| 62 | 21845 | 1 | 13 | 21845 | +| 62+ | -21846 | 1 | 21 | 21845 | +| 63 | -21846 | 1 | 21 | -21846 | +| 63+ | -21846 | 0 | 5 | 21845 | +| 64 | -21846 | 0 | 5 | 21845 | +| 64 | -21846 | 0 | 13 | 21845 | +| 64 | -21846 | 0 | 21 | -21846 | +| 64 | -21846 | 0 | 29 | 21845 | +| 64 | -21846 | 0 | 37 | 21845 | +| 64 | -21846 | 0 | 45 | 21845 | +| 64 | -21846 | 0 | 53 | 21845 | +| 64 | -21846 | 0 | 61 | 21845 | +| 64+ | 21845 | 1 | 21 | -21846 | +| 65 | 21845 | 1 | 21 | 21845 | +| 65+ | -21846 | 1 | 29 | 21845 | +| 66 | -21846 | 1 | 29 | -21846 | +| 66+ | -21846 | 0 | 5 | 21845 | +| 67 | -21846 | 0 | 5 | 21845 | +| 67 | -21846 | 0 | 13 | 21845 | +| 67 | -21846 | 0 | 21 | 21845 | +| 67 | -21846 | 0 | 29 | -21846 | +| 67 | -21846 | 0 | 37 | 21845 | +| 67 | -21846 | 0 | 45 | 21845 | +| 67 | -21846 | 0 | 53 | 21845 | +| 67 | -21846 | 0 | 61 | 21845 | +| 67+ | 21845 | 1 | 29 | -21846 | +| 68 | 21845 | 1 | 29 | 21845 | +| 68+ | -21846 | 1 | 37 | 21845 | +| 69 | -21846 | 1 | 37 | -21846 | +| 69+ | -21846 | 0 | 5 | 21845 | +| 70 | -21846 | 0 | 5 | 21845 | +| 70 | -21846 | 0 | 13 | 21845 | +| 70 | -21846 | 0 | 21 | 21845 | +| 70 | -21846 | 0 | 29 | 21845 | +| 70 | -21846 | 0 | 37 | -21846 | +| 70 | -21846 | 0 | 45 | 21845 | +| 70 | -21846 | 0 | 53 | 21845 | +| 70 | -21846 | 0 | 61 | 21845 | +| 70+ | 21845 | 1 | 37 | -21846 | +| 71 | 21845 | 1 | 37 | 21845 | +| 71+ | -21846 | 1 | 45 | 21845 | +| 72 | -21846 | 1 | 45 | -21846 | +| 72+ | -21846 | 0 | 5 | 21845 | +| 73 | -21846 | 0 | 5 | 21845 | +| 73 | -21846 | 0 | 13 | 21845 | +| 73 | -21846 | 0 | 21 | 21845 | +| 73 | -21846 | 0 | 29 | 21845 | +| 73 | -21846 | 0 | 37 | 21845 | +| 73 | -21846 | 0 | 45 | -21846 | +| 73 | -21846 | 0 | 53 | 21845 | +| 73 | -21846 | 0 | 61 | 21845 | +| 73+ | 21845 | 1 | 45 | -21846 | +| 74 | 21845 | 1 | 45 | 21845 | +| 74+ | -21846 | 1 | 53 | 21845 | +| 75 | -21846 | 1 | 53 | -21846 | +| 75+ | -21846 | 0 | 5 | 21845 | +| 76 | -21846 | 0 | 5 | 21845 | +| 76 | -21846 | 0 | 13 | 21845 | +| 76 | -21846 | 0 | 21 | 21845 | +| 76 | -21846 | 0 | 29 | 21845 | +| 76 | -21846 | 0 | 37 | 21845 | +| 76 | -21846 | 0 | 45 | 21845 | +| 76 | -21846 | 0 | 53 | -21846 | +| 76 | -21846 | 0 | 61 | 21845 | +| 76+ | 21845 | 1 | 53 | -21846 | +| 77 | 21845 | 1 | 53 | 21845 | +| 77+ | -21846 | 1 | 61 | 21845 | +| 78 | -21846 | 1 | 61 | -21846 | +| 78+ | -21846 | 0 | 5 | 21845 | +| 79 | -21846 | 0 | 5 | 21845 | +| 79 | -21846 | 0 | 13 | 21845 | +| 79 | -21846 | 0 | 21 | 21845 | +| 79 | -21846 | 0 | 29 | 21845 | +| 79 | -21846 | 0 | 37 | 21845 | +| 79 | -21846 | 0 | 45 | 21845 | +| 79 | -21846 | 0 | 53 | 21845 | +| 79 | -21846 | 0 | 61 | -21846 | +| 79+ | 21845 | 1 | 61 | -21846 | +| 80 | 21845 | 1 | 61 | 21845 | +| 80+ | 21845 | 0 | 5 | 21845 | +| 81 | 21845 | 0 | 5 | 21845 | +| 81 | 21845 | 0 | 13 | 21845 | +| 81 | 21845 | 0 | 21 | 21845 | +| 81 | 21845 | 0 | 29 | 21845 | +| 81 | 21845 | 0 | 37 | 21845 | +| 81 | 21845 | 0 | 45 | 21845 | +| 81 | 21845 | 0 | 53 | 21845 | +| 81 | 21845 | 0 | 61 | 21845 | diff --git a/projects/03/a/RAM64.hdl b/projects/03/a/RAM64.hdl new file mode 100644 index 0000000..66efcbd --- /dev/null +++ b/projects/03/a/RAM64.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: projects/03/a/RAM64.hdl + +/** + * Memory of 64 registers, each 16 bit-wide. Out holds the value + * stored at the memory location specified by address. If load==1, then + * the in value is loaded into the memory location specified by address + * (the loaded value will be emitted to out from the next time step onward). + */ + +CHIP RAM64 { + IN in[16], load, address[6]; + OUT out[16]; + + PARTS: + // Put your code here: +} \ No newline at end of file diff --git a/projects/03/a/RAM64.tst b/projects/03/a/RAM64.tst new file mode 100644 index 0000000..e1a1409 --- /dev/null +++ b/projects/03/a/RAM64.tst @@ -0,0 +1,1026 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/03/a/RAM64.tst + +load RAM64.hdl, +output-file RAM64.out, +compare-to RAM64.cmp, +output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.3.2 out%D1.6.1; + +set in 0, +set load 0, +set address 0, +tick, +output; +tock, +output; + +set load 1, +tick, +output; +tock, +output; + +set in 1313, +set load 0, +tick, +output; +tock, +output; + +set load 1, +set address 13, +tick, +output; +tock, +output; + +set load 0, +set address 0, +tick, +output; +tock, +output; + +set in 4747, +set address 47, +tick, +output; +tock, +output; + +set load 1, +tick, +output; +tock, +output; + +set load 0, +tick, +output; +tock, +output; + +set address 13, +eval, +output; + +set in 6363, +tick, +output; +tock, +output; + +set load 1, +set address 63, +tick, +output; +tock, +output; + +set load 0, +tick, +output; +tock, +output; + +set address 47, +eval, +output; + +set address 63, +eval, +output; + + +set load 0, +set address %B101000, +tick, +output; +tock, +output; +set address %B101001, +eval, +output; +set address %B101010, +eval, +output; +set address %B101011, +eval, +output; +set address %B101100, +eval, +output; +set address %B101101, +eval, +output; +set address %B101110, +eval, +output; +set address %B101111, +eval, +output; + +set load 1, +set in %B0101010101010101, +set address %B101000, +tick, +output; +tock, +output; +set address %B101001, +tick, +output, +tock, +output; +set address %B101010, +tick, +output, +tock, +output; +set address %B101011, +tick, +output, +tock, +output; +set address %B101100, +tick, +output, +tock, +output; +set address %B101101, +tick, +output, +tock, +output; +set address %B101110, +tick, +output, +tock, +output; +set address %B101111, +tick, +output, +tock, +output; + +set load 0, +set address %B101000, +tick, +output; +tock, +output; +set address %B101001, +eval, +output; +set address %B101010, +eval, +output; +set address %B101011, +eval, +output; +set address %B101100, +eval, +output; +set address %B101101, +eval, +output; +set address %B101110, +eval, +output; +set address %B101111, +eval, +output; + +set load 1, +set address %B101000, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B101000, +tick, +output; +tock, +output; +set address %B101001, +eval, +output; +set address %B101010, +eval, +output; +set address %B101011, +eval, +output; +set address %B101100, +eval, +output; +set address %B101101, +eval, +output; +set address %B101110, +eval, +output; +set address %B101111, +eval, +output; + +set load 1, +set address %B101000, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101001, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B101000, +tick, +output; +tock, +output; +set address %B101001, +eval, +output; +set address %B101010, +eval, +output; +set address %B101011, +eval, +output; +set address %B101100, +eval, +output; +set address %B101101, +eval, +output; +set address %B101110, +eval, +output; +set address %B101111, +eval, +output; + +set load 1, +set address %B101001, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101010, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B101000, +tick, +output; +tock, +output; +set address %B101001, +eval, +output; +set address %B101010, +eval, +output; +set address %B101011, +eval, +output; +set address %B101100, +eval, +output; +set address %B101101, +eval, +output; +set address %B101110, +eval, +output; +set address %B101111, +eval, +output; + +set load 1, +set address %B101010, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101011, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B101000, +tick, +output; +tock, +output; +set address %B101001, +eval, +output; +set address %B101010, +eval, +output; +set address %B101011, +eval, +output; +set address %B101100, +eval, +output; +set address %B101101, +eval, +output; +set address %B101110, +eval, +output; +set address %B101111, +eval, +output; + +set load 1, +set address %B101011, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101100, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B101000, +tick, +output; +tock, +output; +set address %B101001, +eval, +output; +set address %B101010, +eval, +output; +set address %B101011, +eval, +output; +set address %B101100, +eval, +output; +set address %B101101, +eval, +output; +set address %B101110, +eval, +output; +set address %B101111, +eval, +output; + +set load 1, +set address %B101100, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B101000, +tick, +output; +tock, +output; +set address %B101001, +eval, +output; +set address %B101010, +eval, +output; +set address %B101011, +eval, +output; +set address %B101100, +eval, +output; +set address %B101101, +eval, +output; +set address %B101110, +eval, +output; +set address %B101111, +eval, +output; + +set load 1, +set address %B101101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101110, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B101000, +tick, +output; +tock, +output; +set address %B101001, +eval, +output; +set address %B101010, +eval, +output; +set address %B101011, +eval, +output; +set address %B101100, +eval, +output; +set address %B101101, +eval, +output; +set address %B101110, +eval, +output; +set address %B101111, +eval, +output; + +set load 1, +set address %B101110, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101111, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B101000, +tick, +output; +tock, +output; +set address %B101001, +eval, +output; +set address %B101010, +eval, +output; +set address %B101011, +eval, +output; +set address %B101100, +eval, +output; +set address %B101101, +eval, +output; +set address %B101110, +eval, +output; +set address %B101111, +eval, +output; + +set load 1, +set address %B101111, +set in %B0101010101010101, +tick, +output, +tock, +output; + +set load 0, +set address %B101000, +tick, +output; +tock, +output; +set address %B101001, +eval, +output; +set address %B101010, +eval, +output; +set address %B101011, +eval, +output; +set address %B101100, +eval, +output; +set address %B101101, +eval, +output; +set address %B101110, +eval, +output; +set address %B101111, +eval, +output; + + +set load 0, +set address %B000101, +tick, +output; +tock, +output; +set address %B001101, +eval, +output; +set address %B010101, +eval, +output; +set address %B011101, +eval, +output; +set address %B100101, +eval, +output; +set address %B101101, +eval, +output; +set address %B110101, +eval, +output; +set address %B111101, +eval, +output; + +set load 1, +set in %B0101010101010101, +set address %B000101, +tick, +output; +tock, +output; +set address %B001101, +tick, +output, +tock, +output; +set address %B010101, +tick, +output, +tock, +output; +set address %B011101, +tick, +output, +tock, +output; +set address %B100101, +tick, +output, +tock, +output; +set address %B101101, +tick, +output, +tock, +output; +set address %B110101, +tick, +output, +tock, +output; +set address %B111101, +tick, +output, +tock, +output; + +set load 0, +set address %B000101, +tick, +output; +tock, +output; +set address %B001101, +eval, +output; +set address %B010101, +eval, +output; +set address %B011101, +eval, +output; +set address %B100101, +eval, +output; +set address %B101101, +eval, +output; +set address %B110101, +eval, +output; +set address %B111101, +eval, +output; + +set load 1, +set address %B000101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101, +tick, +output; +tock, +output; +set address %B001101, +eval, +output; +set address %B010101, +eval, +output; +set address %B011101, +eval, +output; +set address %B100101, +eval, +output; +set address %B101101, +eval, +output; +set address %B110101, +eval, +output; +set address %B111101, +eval, +output; + +set load 1, +set address %B000101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B001101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101, +tick, +output; +tock, +output; +set address %B001101, +eval, +output; +set address %B010101, +eval, +output; +set address %B011101, +eval, +output; +set address %B100101, +eval, +output; +set address %B101101, +eval, +output; +set address %B110101, +eval, +output; +set address %B111101, +eval, +output; + +set load 1, +set address %B001101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101, +tick, +output; +tock, +output; +set address %B001101, +eval, +output; +set address %B010101, +eval, +output; +set address %B011101, +eval, +output; +set address %B100101, +eval, +output; +set address %B101101, +eval, +output; +set address %B110101, +eval, +output; +set address %B111101, +eval, +output; + +set load 1, +set address %B010101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B011101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101, +tick, +output; +tock, +output; +set address %B001101, +eval, +output; +set address %B010101, +eval, +output; +set address %B011101, +eval, +output; +set address %B100101, +eval, +output; +set address %B101101, +eval, +output; +set address %B110101, +eval, +output; +set address %B111101, +eval, +output; + +set load 1, +set address %B011101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B100101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101, +tick, +output; +tock, +output; +set address %B001101, +eval, +output; +set address %B010101, +eval, +output; +set address %B011101, +eval, +output; +set address %B100101, +eval, +output; +set address %B101101, +eval, +output; +set address %B110101, +eval, +output; +set address %B111101, +eval, +output; + +set load 1, +set address %B100101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101, +tick, +output; +tock, +output; +set address %B001101, +eval, +output; +set address %B010101, +eval, +output; +set address %B011101, +eval, +output; +set address %B100101, +eval, +output; +set address %B101101, +eval, +output; +set address %B110101, +eval, +output; +set address %B111101, +eval, +output; + +set load 1, +set address %B101101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B110101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101, +tick, +output; +tock, +output; +set address %B001101, +eval, +output; +set address %B010101, +eval, +output; +set address %B011101, +eval, +output; +set address %B100101, +eval, +output; +set address %B101101, +eval, +output; +set address %B110101, +eval, +output; +set address %B111101, +eval, +output; + +set load 1, +set address %B110101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B111101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101, +tick, +output; +tock, +output; +set address %B001101, +eval, +output; +set address %B010101, +eval, +output; +set address %B011101, +eval, +output; +set address %B100101, +eval, +output; +set address %B101101, +eval, +output; +set address %B110101, +eval, +output; +set address %B111101, +eval, +output; + +set load 1, +set address %B111101, +set in %B0101010101010101, +tick, +output, +tock, +output; + +set load 0, +set address %B000101, +tick, +output; +tock, +output; +set address %B001101, +eval, +output; +set address %B010101, +eval, +output; +set address %B011101, +eval, +output; +set address %B100101, +eval, +output; +set address %B101101, +eval, +output; +set address %B110101, +eval, +output; +set address %B111101, +eval, +output; diff --git a/projects/03/a/RAM8.cmp b/projects/03/a/RAM8.cmp new file mode 100644 index 0000000..536c6ef --- /dev/null +++ b/projects/03/a/RAM8.cmp @@ -0,0 +1,173 @@ +| time | in |load |address| out | +| 0+ | 0 | 0 | 0 | 0 | +| 1 | 0 | 0 | 0 | 0 | +| 1+ | 0 | 1 | 0 | 0 | +| 2 | 0 | 1 | 0 | 0 | +| 2+ | 11111 | 0 | 0 | 0 | +| 3 | 11111 | 0 | 0 | 0 | +| 3+ | 11111 | 1 | 1 | 0 | +| 4 | 11111 | 1 | 1 | 11111 | +| 4+ | 11111 | 0 | 0 | 0 | +| 5 | 11111 | 0 | 0 | 0 | +| 5+ | 3333 | 0 | 3 | 0 | +| 6 | 3333 | 0 | 3 | 0 | +| 6+ | 3333 | 1 | 3 | 0 | +| 7 | 3333 | 1 | 3 | 3333 | +| 7+ | 3333 | 0 | 3 | 3333 | +| 8 | 3333 | 0 | 3 | 3333 | +| 8 | 3333 | 0 | 1 | 11111 | +| 8+ | 7777 | 0 | 1 | 11111 | +| 9 | 7777 | 0 | 1 | 11111 | +| 9+ | 7777 | 1 | 7 | 0 | +| 10 | 7777 | 1 | 7 | 7777 | +| 10+ | 7777 | 0 | 7 | 7777 | +| 11 | 7777 | 0 | 7 | 7777 | +| 11 | 7777 | 0 | 3 | 3333 | +| 11 | 7777 | 0 | 7 | 7777 | +| 11+ | 7777 | 0 | 0 | 0 | +| 12 | 7777 | 0 | 0 | 0 | +| 12 | 7777 | 0 | 1 | 11111 | +| 12 | 7777 | 0 | 2 | 0 | +| 12 | 7777 | 0 | 3 | 3333 | +| 12 | 7777 | 0 | 4 | 0 | +| 12 | 7777 | 0 | 5 | 0 | +| 12 | 7777 | 0 | 6 | 0 | +| 12 | 7777 | 0 | 7 | 7777 | +| 12+ | 21845 | 1 | 0 | 0 | +| 13 | 21845 | 1 | 0 | 21845 | +| 13+ | 21845 | 1 | 1 | 11111 | +| 14 | 21845 | 1 | 1 | 21845 | +| 14+ | 21845 | 1 | 2 | 0 | +| 15 | 21845 | 1 | 2 | 21845 | +| 15+ | 21845 | 1 | 3 | 3333 | +| 16 | 21845 | 1 | 3 | 21845 | +| 16+ | 21845 | 1 | 4 | 0 | +| 17 | 21845 | 1 | 4 | 21845 | +| 17+ | 21845 | 1 | 5 | 0 | +| 18 | 21845 | 1 | 5 | 21845 | +| 18+ | 21845 | 1 | 6 | 0 | +| 19 | 21845 | 1 | 6 | 21845 | +| 19+ | 21845 | 1 | 7 | 7777 | +| 20 | 21845 | 1 | 7 | 21845 | +| 20+ | 21845 | 0 | 0 | 21845 | +| 21 | 21845 | 0 | 0 | 21845 | +| 21 | 21845 | 0 | 1 | 21845 | +| 21 | 21845 | 0 | 2 | 21845 | +| 21 | 21845 | 0 | 3 | 21845 | +| 21 | 21845 | 0 | 4 | 21845 | +| 21 | 21845 | 0 | 5 | 21845 | +| 21 | 21845 | 0 | 6 | 21845 | +| 21 | 21845 | 0 | 7 | 21845 | +| 21+ | -21846 | 1 | 0 | 21845 | +| 22 | -21846 | 1 | 0 | -21846 | +| 22+ | -21846 | 0 | 0 | -21846 | +| 23 | -21846 | 0 | 0 | -21846 | +| 23 | -21846 | 0 | 1 | 21845 | +| 23 | -21846 | 0 | 2 | 21845 | +| 23 | -21846 | 0 | 3 | 21845 | +| 23 | -21846 | 0 | 4 | 21845 | +| 23 | -21846 | 0 | 5 | 21845 | +| 23 | -21846 | 0 | 6 | 21845 | +| 23 | -21846 | 0 | 7 | 21845 | +| 23+ | 21845 | 1 | 0 | -21846 | +| 24 | 21845 | 1 | 0 | 21845 | +| 24+ | -21846 | 1 | 1 | 21845 | +| 25 | -21846 | 1 | 1 | -21846 | +| 25+ | -21846 | 0 | 0 | 21845 | +| 26 | -21846 | 0 | 0 | 21845 | +| 26 | -21846 | 0 | 1 | -21846 | +| 26 | -21846 | 0 | 2 | 21845 | +| 26 | -21846 | 0 | 3 | 21845 | +| 26 | -21846 | 0 | 4 | 21845 | +| 26 | -21846 | 0 | 5 | 21845 | +| 26 | -21846 | 0 | 6 | 21845 | +| 26 | -21846 | 0 | 7 | 21845 | +| 26+ | 21845 | 1 | 1 | -21846 | +| 27 | 21845 | 1 | 1 | 21845 | +| 27+ | -21846 | 1 | 2 | 21845 | +| 28 | -21846 | 1 | 2 | -21846 | +| 28+ | -21846 | 0 | 0 | 21845 | +| 29 | -21846 | 0 | 0 | 21845 | +| 29 | -21846 | 0 | 1 | 21845 | +| 29 | -21846 | 0 | 2 | -21846 | +| 29 | -21846 | 0 | 3 | 21845 | +| 29 | -21846 | 0 | 4 | 21845 | +| 29 | -21846 | 0 | 5 | 21845 | +| 29 | -21846 | 0 | 6 | 21845 | +| 29 | -21846 | 0 | 7 | 21845 | +| 29+ | 21845 | 1 | 2 | -21846 | +| 30 | 21845 | 1 | 2 | 21845 | +| 30+ | -21846 | 1 | 3 | 21845 | +| 31 | -21846 | 1 | 3 | -21846 | +| 31+ | -21846 | 0 | 0 | 21845 | +| 32 | -21846 | 0 | 0 | 21845 | +| 32 | -21846 | 0 | 1 | 21845 | +| 32 | -21846 | 0 | 2 | 21845 | +| 32 | -21846 | 0 | 3 | -21846 | +| 32 | -21846 | 0 | 4 | 21845 | +| 32 | -21846 | 0 | 5 | 21845 | +| 32 | -21846 | 0 | 6 | 21845 | +| 32 | -21846 | 0 | 7 | 21845 | +| 32+ | 21845 | 1 | 3 | -21846 | +| 33 | 21845 | 1 | 3 | 21845 | +| 33+ | -21846 | 1 | 4 | 21845 | +| 34 | -21846 | 1 | 4 | -21846 | +| 34+ | -21846 | 0 | 0 | 21845 | +| 35 | -21846 | 0 | 0 | 21845 | +| 35 | -21846 | 0 | 1 | 21845 | +| 35 | -21846 | 0 | 2 | 21845 | +| 35 | -21846 | 0 | 3 | 21845 | +| 35 | -21846 | 0 | 4 | -21846 | +| 35 | -21846 | 0 | 5 | 21845 | +| 35 | -21846 | 0 | 6 | 21845 | +| 35 | -21846 | 0 | 7 | 21845 | +| 35+ | 21845 | 1 | 4 | -21846 | +| 36 | 21845 | 1 | 4 | 21845 | +| 36+ | -21846 | 1 | 5 | 21845 | +| 37 | -21846 | 1 | 5 | -21846 | +| 37+ | -21846 | 0 | 0 | 21845 | +| 38 | -21846 | 0 | 0 | 21845 | +| 38 | -21846 | 0 | 1 | 21845 | +| 38 | -21846 | 0 | 2 | 21845 | +| 38 | -21846 | 0 | 3 | 21845 | +| 38 | -21846 | 0 | 4 | 21845 | +| 38 | -21846 | 0 | 5 | -21846 | +| 38 | -21846 | 0 | 6 | 21845 | +| 38 | -21846 | 0 | 7 | 21845 | +| 38+ | 21845 | 1 | 5 | -21846 | +| 39 | 21845 | 1 | 5 | 21845 | +| 39+ | -21846 | 1 | 6 | 21845 | +| 40 | -21846 | 1 | 6 | -21846 | +| 40+ | -21846 | 0 | 0 | 21845 | +| 41 | -21846 | 0 | 0 | 21845 | +| 41 | -21846 | 0 | 1 | 21845 | +| 41 | -21846 | 0 | 2 | 21845 | +| 41 | -21846 | 0 | 3 | 21845 | +| 41 | -21846 | 0 | 4 | 21845 | +| 41 | -21846 | 0 | 5 | 21845 | +| 41 | -21846 | 0 | 6 | -21846 | +| 41 | -21846 | 0 | 7 | 21845 | +| 41+ | 21845 | 1 | 6 | -21846 | +| 42 | 21845 | 1 | 6 | 21845 | +| 42+ | -21846 | 1 | 7 | 21845 | +| 43 | -21846 | 1 | 7 | -21846 | +| 43+ | -21846 | 0 | 0 | 21845 | +| 44 | -21846 | 0 | 0 | 21845 | +| 44 | -21846 | 0 | 1 | 21845 | +| 44 | -21846 | 0 | 2 | 21845 | +| 44 | -21846 | 0 | 3 | 21845 | +| 44 | -21846 | 0 | 4 | 21845 | +| 44 | -21846 | 0 | 5 | 21845 | +| 44 | -21846 | 0 | 6 | 21845 | +| 44 | -21846 | 0 | 7 | -21846 | +| 44+ | 21845 | 1 | 7 | -21846 | +| 45 | 21845 | 1 | 7 | 21845 | +| 45+ | 21845 | 0 | 0 | 21845 | +| 46 | 21845 | 0 | 0 | 21845 | +| 46 | 21845 | 0 | 1 | 21845 | +| 46 | 21845 | 0 | 2 | 21845 | +| 46 | 21845 | 0 | 3 | 21845 | +| 46 | 21845 | 0 | 4 | 21845 | +| 46 | 21845 | 0 | 5 | 21845 | +| 46 | 21845 | 0 | 6 | 21845 | +| 46 | 21845 | 0 | 7 | 21845 | diff --git a/projects/03/a/RAM8.hdl b/projects/03/a/RAM8.hdl new file mode 100644 index 0000000..4c0e070 --- /dev/null +++ b/projects/03/a/RAM8.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: projects/03/a/RAM8.hdl + +/** + * Memory of 8 registers, each 16 bit-wide. Out holds the value + * stored at the memory location specified by address. If load==1, then + * the in value is loaded into the memory location specified by address + * (the loaded value will be emitted to out from the next time step onward). + */ + +CHIP RAM8 { + IN in[16], load, address[3]; + OUT out[16]; + + PARTS: + // Put your code here: +} \ No newline at end of file diff --git a/projects/03/a/RAM8.tst b/projects/03/a/RAM8.tst new file mode 100644 index 0000000..9b6069c --- /dev/null +++ b/projects/03/a/RAM8.tst @@ -0,0 +1,560 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/03/a/RAM8.tst + +load RAM8.hdl, +output-file RAM8.out, +compare-to RAM8.cmp, +output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D3.1.3 out%D1.6.1; + +set in 0, +set load 0, +set address 0, +tick, +output; +tock, +output; + +set load 1, +tick, +output; +tock, +output; + +set in 11111, +set load 0, +tick, +output; +tock, +output; + +set load 1, +set address 1, +tick, +output; +tock, +output; + +set load 0, +set address 0, +tick, +output; +tock, +output; + +set in 3333, +set address 3, +tick, +output; +tock, +output; + +set load 1, +tick, +output; +tock, +output; + +set load 0, +tick, +output; +tock, +output; + +set address 1, +eval, +output; + +set in 7777, +tick, +output; +tock, +output; + +set load 1, +set address 7, +tick, +output; +tock, +output; + +set load 0, +tick, +output; +tock, +output; + +set address 3, +eval, +output; + +set address 7, +eval, +output; + +set load 0, +set address 0, +tick, +output; +tock, +output; +set address 1, +eval, +output; +set address 2, +eval, +output; +set address 3, +eval, +output; +set address 4, +eval, +output; +set address 5, +eval, +output; +set address 6, +eval, +output; +set address 7, +eval, +output; + +set load 1, +set in %B0101010101010101, +set address 0, +tick, +output; +tock, +output; +set address 1, +tick, +output, +tock, +output; +set address 2, +tick, +output, +tock, +output; +set address 3, +tick, +output, +tock, +output; +set address 4, +tick, +output, +tock, +output; +set address 5, +tick, +output, +tock, +output; +set address 6, +tick, +output, +tock, +output; +set address 7, +tick, +output, +tock, +output; + +set load 0, +set address 0, +tick, +output; +tock, +output; +set address 1, +eval, +output; +set address 2, +eval, +output; +set address 3, +eval, +output; +set address 4, +eval, +output; +set address 5, +eval, +output; +set address 6, +eval, +output; +set address 7, +eval, +output; + +set load 1, +set address 0, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address 0, +tick, +output; +tock, +output; +set address 1, +eval, +output; +set address 2, +eval, +output; +set address 3, +eval, +output; +set address 4, +eval, +output; +set address 5, +eval, +output; +set address 6, +eval, +output; +set address 7, +eval, +output; + +set load 1, +set address 0, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address 1, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address 0, +tick, +output; +tock, +output; +set address 1, +eval, +output; +set address 2, +eval, +output; +set address 3, +eval, +output; +set address 4, +eval, +output; +set address 5, +eval, +output; +set address 6, +eval, +output; +set address 7, +eval, +output; + +set load 1, +set address 1, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address 2, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address 0, +tick, +output; +tock, +output; +set address 1, +eval, +output; +set address 2, +eval, +output; +set address 3, +eval, +output; +set address 4, +eval, +output; +set address 5, +eval, +output; +set address 6, +eval, +output; +set address 7, +eval, +output; + +set load 1, +set address 2, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address 3, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address 0, +tick, +output; +tock, +output; +set address 1, +eval, +output; +set address 2, +eval, +output; +set address 3, +eval, +output; +set address 4, +eval, +output; +set address 5, +eval, +output; +set address 6, +eval, +output; +set address 7, +eval, +output; + +set load 1, +set address 3, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address 4, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address 0, +tick, +output; +tock, +output; +set address 1, +eval, +output; +set address 2, +eval, +output; +set address 3, +eval, +output; +set address 4, +eval, +output; +set address 5, +eval, +output; +set address 6, +eval, +output; +set address 7, +eval, +output; + +set load 1, +set address 4, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address 5, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address 0, +tick, +output; +tock, +output; +set address 1, +eval, +output; +set address 2, +eval, +output; +set address 3, +eval, +output; +set address 4, +eval, +output; +set address 5, +eval, +output; +set address 6, +eval, +output; +set address 7, +eval, +output; + +set load 1, +set address 5, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address 6, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address 0, +tick, +output; +tock, +output; +set address 1, +eval, +output; +set address 2, +eval, +output; +set address 3, +eval, +output; +set address 4, +eval, +output; +set address 5, +eval, +output; +set address 6, +eval, +output; +set address 7, +eval, +output; + +set load 1, +set address 6, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address 7, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address 0, +tick, +output; +tock, +output; +set address 1, +eval, +output; +set address 2, +eval, +output; +set address 3, +eval, +output; +set address 4, +eval, +output; +set address 5, +eval, +output; +set address 6, +eval, +output; +set address 7, +eval, +output; + +set load 1, +set address 7, +set in %B0101010101010101, +tick, +output, +tock, +output; + +set load 0, +set address 0, +tick, +output; +tock, +output; +set address 1, +eval, +output; +set address 2, +eval, +output; +set address 3, +eval, +output; +set address 4, +eval, +output; +set address 5, +eval, +output; +set address 6, +eval, +output; +set address 7, +eval, +output; + diff --git a/projects/03/a/Register.cmp b/projects/03/a/Register.cmp new file mode 100644 index 0000000..a899f27 --- /dev/null +++ b/projects/03/a/Register.cmp @@ -0,0 +1,149 @@ +| time | in |load | out | +| 0+ | 0 | 0 | 0 | +| 1 | 0 | 0 | 0 | +| 1+ | 0 | 1 | 0 | +| 2 | 0 | 1 | 0 | +| 2+ | -32123 | 0 | 0 | +| 3 | -32123 | 0 | 0 | +| 3+ | 11111 | 0 | 0 | +| 4 | 11111 | 0 | 0 | +| 4+ | -32123 | 1 | 0 | +| 5 | -32123 | 1 | -32123 | +| 5+ | -32123 | 1 | -32123 | +| 6 | -32123 | 1 | -32123 | +| 6+ | -32123 | 0 | -32123 | +| 7 | -32123 | 0 | -32123 | +| 7+ | 12345 | 1 | -32123 | +| 8 | 12345 | 1 | 12345 | +| 8+ | 0 | 0 | 12345 | +| 9 | 0 | 0 | 12345 | +| 9+ | 0 | 1 | 12345 | +| 10 | 0 | 1 | 0 | +| 10+ | 1 | 0 | 0 | +| 11 | 1 | 0 | 0 | +| 11+ | 1 | 1 | 0 | +| 12 | 1 | 1 | 1 | +| 12+ | 2 | 0 | 1 | +| 13 | 2 | 0 | 1 | +| 13+ | 2 | 1 | 1 | +| 14 | 2 | 1 | 2 | +| 14+ | 4 | 0 | 2 | +| 15 | 4 | 0 | 2 | +| 15+ | 4 | 1 | 2 | +| 16 | 4 | 1 | 4 | +| 16+ | 8 | 0 | 4 | +| 17 | 8 | 0 | 4 | +| 17+ | 8 | 1 | 4 | +| 18 | 8 | 1 | 8 | +| 18+ | 16 | 0 | 8 | +| 19 | 16 | 0 | 8 | +| 19+ | 16 | 1 | 8 | +| 20 | 16 | 1 | 16 | +| 20+ | 32 | 0 | 16 | +| 21 | 32 | 0 | 16 | +| 21+ | 32 | 1 | 16 | +| 22 | 32 | 1 | 32 | +| 22+ | 64 | 0 | 32 | +| 23 | 64 | 0 | 32 | +| 23+ | 64 | 1 | 32 | +| 24 | 64 | 1 | 64 | +| 24+ | 128 | 0 | 64 | +| 25 | 128 | 0 | 64 | +| 25+ | 128 | 1 | 64 | +| 26 | 128 | 1 | 128 | +| 26+ | 256 | 0 | 128 | +| 27 | 256 | 0 | 128 | +| 27+ | 256 | 1 | 128 | +| 28 | 256 | 1 | 256 | +| 28+ | 512 | 0 | 256 | +| 29 | 512 | 0 | 256 | +| 29+ | 512 | 1 | 256 | +| 30 | 512 | 1 | 512 | +| 30+ | 1024 | 0 | 512 | +| 31 | 1024 | 0 | 512 | +| 31+ | 1024 | 1 | 512 | +| 32 | 1024 | 1 | 1024 | +| 32+ | 2048 | 0 | 1024 | +| 33 | 2048 | 0 | 1024 | +| 33+ | 2048 | 1 | 1024 | +| 34 | 2048 | 1 | 2048 | +| 34+ | 4096 | 0 | 2048 | +| 35 | 4096 | 0 | 2048 | +| 35+ | 4096 | 1 | 2048 | +| 36 | 4096 | 1 | 4096 | +| 36+ | 8192 | 0 | 4096 | +| 37 | 8192 | 0 | 4096 | +| 37+ | 8192 | 1 | 4096 | +| 38 | 8192 | 1 | 8192 | +| 38+ | 16384 | 0 | 8192 | +| 39 | 16384 | 0 | 8192 | +| 39+ | 16384 | 1 | 8192 | +| 40 | 16384 | 1 | 16384 | +| 40+ | -32768 | 0 | 16384 | +| 41 | -32768 | 0 | 16384 | +| 41+ | -32768 | 1 | 16384 | +| 42 | -32768 | 1 | -32768 | +| 42+ | -2 | 0 | -32768 | +| 43 | -2 | 0 | -32768 | +| 43+ | -2 | 1 | -32768 | +| 44 | -2 | 1 | -2 | +| 44+ | -3 | 0 | -2 | +| 45 | -3 | 0 | -2 | +| 45+ | -3 | 1 | -2 | +| 46 | -3 | 1 | -3 | +| 46+ | -5 | 0 | -3 | +| 47 | -5 | 0 | -3 | +| 47+ | -5 | 1 | -3 | +| 48 | -5 | 1 | -5 | +| 48+ | -9 | 0 | -5 | +| 49 | -9 | 0 | -5 | +| 49+ | -9 | 1 | -5 | +| 50 | -9 | 1 | -9 | +| 50+ | -17 | 0 | -9 | +| 51 | -17 | 0 | -9 | +| 51+ | -17 | 1 | -9 | +| 52 | -17 | 1 | -17 | +| 52+ | -33 | 0 | -17 | +| 53 | -33 | 0 | -17 | +| 53+ | -33 | 1 | -17 | +| 54 | -33 | 1 | -33 | +| 54+ | -65 | 0 | -33 | +| 55 | -65 | 0 | -33 | +| 55+ | -65 | 1 | -33 | +| 56 | -65 | 1 | -65 | +| 56+ | -129 | 0 | -65 | +| 57 | -129 | 0 | -65 | +| 57+ | -129 | 1 | -65 | +| 58 | -129 | 1 | -129 | +| 58+ | -257 | 0 | -129 | +| 59 | -257 | 0 | -129 | +| 59+ | -257 | 1 | -129 | +| 60 | -257 | 1 | -257 | +| 60+ | -513 | 0 | -257 | +| 61 | -513 | 0 | -257 | +| 61+ | -513 | 1 | -257 | +| 62 | -513 | 1 | -513 | +| 62+ | -1025 | 0 | -513 | +| 63 | -1025 | 0 | -513 | +| 63+ | -1025 | 1 | -513 | +| 64 | -1025 | 1 | -1025 | +| 64+ | -2049 | 0 | -1025 | +| 65 | -2049 | 0 | -1025 | +| 65+ | -2049 | 1 | -1025 | +| 66 | -2049 | 1 | -2049 | +| 66+ | -4097 | 0 | -2049 | +| 67 | -4097 | 0 | -2049 | +| 67+ | -4097 | 1 | -2049 | +| 68 | -4097 | 1 | -4097 | +| 68+ | -8193 | 0 | -4097 | +| 69 | -8193 | 0 | -4097 | +| 69+ | -8193 | 1 | -4097 | +| 70 | -8193 | 1 | -8193 | +| 70+ | -16385 | 0 | -8193 | +| 71 | -16385 | 0 | -8193 | +| 71+ | -16385 | 1 | -8193 | +| 72 | -16385 | 1 | -16385 | +| 72+ | 32767 | 0 | -16385 | +| 73 | 32767 | 0 | -16385 | +| 73+ | 32767 | 1 | -16385 | +| 74 | 32767 | 1 | 32767 | diff --git a/projects/03/a/Register.hdl b/projects/03/a/Register.hdl new file mode 100644 index 0000000..926b99f --- /dev/null +++ b/projects/03/a/Register.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: projects/03/a/Register.hdl + +/** + * 16-bit register: + * If load[t] == 1 then out[t+1] = in[t] + * else out does not change + */ + +CHIP Register { + IN in[16], load; + OUT out[16]; + + PARTS: + // Put your code here: +} diff --git a/projects/03/a/Register.tst b/projects/03/a/Register.tst new file mode 100644 index 0000000..aeec166 --- /dev/null +++ b/projects/03/a/Register.tst @@ -0,0 +1,569 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/03/a/Register.tst + +load Register.hdl, +output-file Register.out, +compare-to Register.cmp, +output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 out%D1.6.1; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 1, +tick, +output; + +tock, +output; + +set in -32123, +set load 0, +tick, +output; + +tock, +output; + +set in 11111, +set load 0, +tick, +output; + +tock, +output; + +set in -32123, +set load 1, +tick, +output; + +tock, +output; + +set in -32123, +set load 1, +tick, +output; + +tock, +output; + +set in -32123, +set load 0, +tick, +output; + +tock, +output; + +set in 12345, +set load 1, +tick, +output; + +tock, +output; + +set in 0, +set load 0, +tick, +output; + +tock, +output; + +set in 0, +set load 1, +tick, +output; + +tock, +output; + +set in %B0000000000000001, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B0000000000000010, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B0000000000000100, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B0000000000001000, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B0000000000010000, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B0000000000100000, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B0000000001000000, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B0000000010000000, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B0000000100000000, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B0000001000000000, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B0000010000000000, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B0000100000000000, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B0001000000000000, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B0010000000000000, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B0100000000000000, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B1000000000000000, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B1111111111111110, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B1111111111111101, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B1111111111111011, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B1111111111110111, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B1111111111101111, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B1111111111011111, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B1111111110111111, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B1111111101111111, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B1111111011111111, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B1111110111111111, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B1111101111111111, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B1111011111111111, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B1110111111111111, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B1101111111111111, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B1011111111111111, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; + +set in %B0111111111111111, +set load 0, +tick, +output; + +tock, +output; + +set load 1, +tick, +output; + +tock, +output; diff --git a/projects/03/b/RAM16K.cmp b/projects/03/b/RAM16K.cmp new file mode 100644 index 0000000..a1ad9db --- /dev/null +++ b/projects/03/b/RAM16K.cmp @@ -0,0 +1,320 @@ +| time | in |load | address | out | +| 0+ | 0 | 0 | 0 | 0 | +| 1 | 0 | 0 | 0 | 0 | +| 1+ | 0 | 1 | 0 | 0 | +| 2 | 0 | 1 | 0 | 0 | +| 2+ | 4321 | 0 | 0 | 0 | +| 3 | 4321 | 0 | 0 | 0 | +| 3+ | 4321 | 1 | 4321 | 0 | +| 4 | 4321 | 1 | 4321 | 4321 | +| 4+ | 4321 | 0 | 0 | 0 | +| 5 | 4321 | 0 | 0 | 0 | +| 5+ | 12345 | 0 | 12345 | 0 | +| 6 | 12345 | 0 | 12345 | 0 | +| 6+ | 12345 | 1 | 12345 | 0 | +| 7 | 12345 | 1 | 12345 | 12345 | +| 7+ | 12345 | 0 | 12345 | 12345 | +| 8 | 12345 | 0 | 12345 | 12345 | +| 8 | 12345 | 0 | 4321 | 4321 | +| 8+ | 16383 | 0 | 4321 | 4321 | +| 9 | 16383 | 0 | 4321 | 4321 | +| 9+ | 16383 | 1 | 16383 | 0 | +| 10 | 16383 | 1 | 16383 | 16383 | +| 10+ | 16383 | 0 | 16383 | 16383 | +| 11 | 16383 | 0 | 16383 | 16383 | +| 11 | 16383 | 0 | 12345 | 12345 | +| 11 | 16383 | 0 | 16383 | 16383 | +| 11+ | 16383 | 0 | 10920 | 0 | +| 12 | 16383 | 0 | 10920 | 0 | +| 12 | 16383 | 0 | 10921 | 0 | +| 12 | 16383 | 0 | 10922 | 0 | +| 12 | 16383 | 0 | 10923 | 0 | +| 12 | 16383 | 0 | 10924 | 0 | +| 12 | 16383 | 0 | 10925 | 0 | +| 12 | 16383 | 0 | 10926 | 0 | +| 12 | 16383 | 0 | 10927 | 0 | +| 12+ | 21845 | 1 | 10920 | 0 | +| 13 | 21845 | 1 | 10920 | 21845 | +| 13+ | 21845 | 1 | 10921 | 0 | +| 14 | 21845 | 1 | 10921 | 21845 | +| 14+ | 21845 | 1 | 10922 | 0 | +| 15 | 21845 | 1 | 10922 | 21845 | +| 15+ | 21845 | 1 | 10923 | 0 | +| 16 | 21845 | 1 | 10923 | 21845 | +| 16+ | 21845 | 1 | 10924 | 0 | +| 17 | 21845 | 1 | 10924 | 21845 | +| 17+ | 21845 | 1 | 10925 | 0 | +| 18 | 21845 | 1 | 10925 | 21845 | +| 18+ | 21845 | 1 | 10926 | 0 | +| 19 | 21845 | 1 | 10926 | 21845 | +| 19+ | 21845 | 1 | 10927 | 0 | +| 20 | 21845 | 1 | 10927 | 21845 | +| 20+ | 21845 | 0 | 10920 | 21845 | +| 21 | 21845 | 0 | 10920 | 21845 | +| 21 | 21845 | 0 | 10921 | 21845 | +| 21 | 21845 | 0 | 10922 | 21845 | +| 21 | 21845 | 0 | 10923 | 21845 | +| 21 | 21845 | 0 | 10924 | 21845 | +| 21 | 21845 | 0 | 10925 | 21845 | +| 21 | 21845 | 0 | 10926 | 21845 | +| 21 | 21845 | 0 | 10927 | 21845 | +| 21+ | -21846 | 1 | 10920 | 21845 | +| 22 | -21846 | 1 | 10920 | -21846 | +| 22+ | -21846 | 0 | 10920 | -21846 | +| 23 | -21846 | 0 | 10920 | -21846 | +| 23 | -21846 | 0 | 10921 | 21845 | +| 23 | -21846 | 0 | 10922 | 21845 | +| 23 | -21846 | 0 | 10923 | 21845 | +| 23 | -21846 | 0 | 10924 | 21845 | +| 23 | -21846 | 0 | 10925 | 21845 | +| 23 | -21846 | 0 | 10926 | 21845 | +| 23 | -21846 | 0 | 10927 | 21845 | +| 23+ | 21845 | 1 | 10920 | -21846 | +| 24 | 21845 | 1 | 10920 | 21845 | +| 24+ | -21846 | 1 | 10921 | 21845 | +| 25 | -21846 | 1 | 10921 | -21846 | +| 25+ | -21846 | 0 | 10920 | 21845 | +| 26 | -21846 | 0 | 10920 | 21845 | +| 26 | -21846 | 0 | 10921 | -21846 | +| 26 | -21846 | 0 | 10922 | 21845 | +| 26 | -21846 | 0 | 10923 | 21845 | +| 26 | -21846 | 0 | 10924 | 21845 | +| 26 | -21846 | 0 | 10925 | 21845 | +| 26 | -21846 | 0 | 10926 | 21845 | +| 26 | -21846 | 0 | 10927 | 21845 | +| 26+ | 21845 | 1 | 10921 | -21846 | +| 27 | 21845 | 1 | 10921 | 21845 | +| 27+ | -21846 | 1 | 10922 | 21845 | +| 28 | -21846 | 1 | 10922 | -21846 | +| 28+ | -21846 | 0 | 10920 | 21845 | +| 29 | -21846 | 0 | 10920 | 21845 | +| 29 | -21846 | 0 | 10921 | 21845 | +| 29 | -21846 | 0 | 10922 | -21846 | +| 29 | -21846 | 0 | 10923 | 21845 | +| 29 | -21846 | 0 | 10924 | 21845 | +| 29 | -21846 | 0 | 10925 | 21845 | +| 29 | -21846 | 0 | 10926 | 21845 | +| 29 | -21846 | 0 | 10927 | 21845 | +| 29+ | 21845 | 1 | 10922 | -21846 | +| 30 | 21845 | 1 | 10922 | 21845 | +| 30+ | -21846 | 1 | 10923 | 21845 | +| 31 | -21846 | 1 | 10923 | -21846 | +| 31+ | -21846 | 0 | 10920 | 21845 | +| 32 | -21846 | 0 | 10920 | 21845 | +| 32 | -21846 | 0 | 10921 | 21845 | +| 32 | -21846 | 0 | 10922 | 21845 | +| 32 | -21846 | 0 | 10923 | -21846 | +| 32 | -21846 | 0 | 10924 | 21845 | +| 32 | -21846 | 0 | 10925 | 21845 | +| 32 | -21846 | 0 | 10926 | 21845 | +| 32 | -21846 | 0 | 10927 | 21845 | +| 32+ | 21845 | 1 | 10923 | -21846 | +| 33 | 21845 | 1 | 10923 | 21845 | +| 33+ | -21846 | 1 | 10924 | 21845 | +| 34 | -21846 | 1 | 10924 | -21846 | +| 34+ | -21846 | 0 | 10920 | 21845 | +| 35 | -21846 | 0 | 10920 | 21845 | +| 35 | -21846 | 0 | 10921 | 21845 | +| 35 | -21846 | 0 | 10922 | 21845 | +| 35 | -21846 | 0 | 10923 | 21845 | +| 35 | -21846 | 0 | 10924 | -21846 | +| 35 | -21846 | 0 | 10925 | 21845 | +| 35 | -21846 | 0 | 10926 | 21845 | +| 35 | -21846 | 0 | 10927 | 21845 | +| 35+ | 21845 | 1 | 10924 | -21846 | +| 36 | 21845 | 1 | 10924 | 21845 | +| 36+ | -21846 | 1 | 10925 | 21845 | +| 37 | -21846 | 1 | 10925 | -21846 | +| 37+ | -21846 | 0 | 10920 | 21845 | +| 38 | -21846 | 0 | 10920 | 21845 | +| 38 | -21846 | 0 | 10921 | 21845 | +| 38 | -21846 | 0 | 10922 | 21845 | +| 38 | -21846 | 0 | 10923 | 21845 | +| 38 | -21846 | 0 | 10924 | 21845 | +| 38 | -21846 | 0 | 10925 | -21846 | +| 38 | -21846 | 0 | 10926 | 21845 | +| 38 | -21846 | 0 | 10927 | 21845 | +| 38+ | 21845 | 1 | 10925 | -21846 | +| 39 | 21845 | 1 | 10925 | 21845 | +| 39+ | -21846 | 1 | 10926 | 21845 | +| 40 | -21846 | 1 | 10926 | -21846 | +| 40+ | -21846 | 0 | 10920 | 21845 | +| 41 | -21846 | 0 | 10920 | 21845 | +| 41 | -21846 | 0 | 10921 | 21845 | +| 41 | -21846 | 0 | 10922 | 21845 | +| 41 | -21846 | 0 | 10923 | 21845 | +| 41 | -21846 | 0 | 10924 | 21845 | +| 41 | -21846 | 0 | 10925 | 21845 | +| 41 | -21846 | 0 | 10926 | -21846 | +| 41 | -21846 | 0 | 10927 | 21845 | +| 41+ | 21845 | 1 | 10926 | -21846 | +| 42 | 21845 | 1 | 10926 | 21845 | +| 42+ | -21846 | 1 | 10927 | 21845 | +| 43 | -21846 | 1 | 10927 | -21846 | +| 43+ | -21846 | 0 | 10920 | 21845 | +| 44 | -21846 | 0 | 10920 | 21845 | +| 44 | -21846 | 0 | 10921 | 21845 | +| 44 | -21846 | 0 | 10922 | 21845 | +| 44 | -21846 | 0 | 10923 | 21845 | +| 44 | -21846 | 0 | 10924 | 21845 | +| 44 | -21846 | 0 | 10925 | 21845 | +| 44 | -21846 | 0 | 10926 | 21845 | +| 44 | -21846 | 0 | 10927 | -21846 | +| 44+ | 21845 | 1 | 10927 | -21846 | +| 45 | 21845 | 1 | 10927 | 21845 | +| 45+ | 21845 | 0 | 10920 | 21845 | +| 46 | 21845 | 0 | 10920 | 21845 | +| 46 | 21845 | 0 | 10921 | 21845 | +| 46 | 21845 | 0 | 10922 | 21845 | +| 46 | 21845 | 0 | 10923 | 21845 | +| 46 | 21845 | 0 | 10924 | 21845 | +| 46 | 21845 | 0 | 10925 | 21845 | +| 46 | 21845 | 0 | 10926 | 21845 | +| 46 | 21845 | 0 | 10927 | 21845 | +| 46+ | 21845 | 0 | 1365 | 0 | +| 47 | 21845 | 0 | 1365 | 0 | +| 47 | 21845 | 0 | 3413 | 0 | +| 47 | 21845 | 0 | 5461 | 0 | +| 47 | 21845 | 0 | 7509 | 0 | +| 47 | 21845 | 0 | 9557 | 0 | +| 47 | 21845 | 0 | 11605 | 0 | +| 47 | 21845 | 0 | 13653 | 0 | +| 47 | 21845 | 0 | 15701 | 0 | +| 47+ | 21845 | 1 | 1365 | 0 | +| 48 | 21845 | 1 | 1365 | 21845 | +| 48+ | 21845 | 1 | 3413 | 0 | +| 49 | 21845 | 1 | 3413 | 21845 | +| 49+ | 21845 | 1 | 5461 | 0 | +| 50 | 21845 | 1 | 5461 | 21845 | +| 50+ | 21845 | 1 | 7509 | 0 | +| 51 | 21845 | 1 | 7509 | 21845 | +| 51+ | 21845 | 1 | 9557 | 0 | +| 52 | 21845 | 1 | 9557 | 21845 | +| 52+ | 21845 | 1 | 11605 | 0 | +| 53 | 21845 | 1 | 11605 | 21845 | +| 53+ | 21845 | 1 | 13653 | 0 | +| 54 | 21845 | 1 | 13653 | 21845 | +| 54+ | 21845 | 1 | 15701 | 0 | +| 55 | 21845 | 1 | 15701 | 21845 | +| 55+ | 21845 | 0 | 1365 | 21845 | +| 56 | 21845 | 0 | 1365 | 21845 | +| 56 | 21845 | 0 | 3413 | 21845 | +| 56 | 21845 | 0 | 5461 | 21845 | +| 56 | 21845 | 0 | 7509 | 21845 | +| 56 | 21845 | 0 | 9557 | 21845 | +| 56 | 21845 | 0 | 11605 | 21845 | +| 56 | 21845 | 0 | 13653 | 21845 | +| 56 | 21845 | 0 | 15701 | 21845 | +| 56+ | -21846 | 1 | 1365 | 21845 | +| 57 | -21846 | 1 | 1365 | -21846 | +| 57+ | -21846 | 0 | 1365 | -21846 | +| 58 | -21846 | 0 | 1365 | -21846 | +| 58 | -21846 | 0 | 3413 | 21845 | +| 58 | -21846 | 0 | 5461 | 21845 | +| 58 | -21846 | 0 | 7509 | 21845 | +| 58 | -21846 | 0 | 9557 | 21845 | +| 58 | -21846 | 0 | 11605 | 21845 | +| 58 | -21846 | 0 | 13653 | 21845 | +| 58 | -21846 | 0 | 15701 | 21845 | +| 58+ | 21845 | 1 | 1365 | -21846 | +| 59 | 21845 | 1 | 1365 | 21845 | +| 59+ | -21846 | 1 | 3413 | 21845 | +| 60 | -21846 | 1 | 3413 | -21846 | +| 60+ | -21846 | 0 | 1365 | 21845 | +| 61 | -21846 | 0 | 1365 | 21845 | +| 61 | -21846 | 0 | 3413 | -21846 | +| 61 | -21846 | 0 | 5461 | 21845 | +| 61 | -21846 | 0 | 7509 | 21845 | +| 61 | -21846 | 0 | 9557 | 21845 | +| 61 | -21846 | 0 | 11605 | 21845 | +| 61 | -21846 | 0 | 13653 | 21845 | +| 61 | -21846 | 0 | 15701 | 21845 | +| 61+ | 21845 | 1 | 3413 | -21846 | +| 62 | 21845 | 1 | 3413 | 21845 | +| 62+ | -21846 | 1 | 5461 | 21845 | +| 63 | -21846 | 1 | 5461 | -21846 | +| 63+ | -21846 | 0 | 1365 | 21845 | +| 64 | -21846 | 0 | 1365 | 21845 | +| 64 | -21846 | 0 | 3413 | 21845 | +| 64 | -21846 | 0 | 5461 | -21846 | +| 64 | -21846 | 0 | 7509 | 21845 | +| 64 | -21846 | 0 | 9557 | 21845 | +| 64 | -21846 | 0 | 11605 | 21845 | +| 64 | -21846 | 0 | 13653 | 21845 | +| 64 | -21846 | 0 | 15701 | 21845 | +| 64+ | 21845 | 1 | 5461 | -21846 | +| 65 | 21845 | 1 | 5461 | 21845 | +| 65+ | -21846 | 1 | 7509 | 21845 | +| 66 | -21846 | 1 | 7509 | -21846 | +| 66+ | -21846 | 0 | 1365 | 21845 | +| 67 | -21846 | 0 | 1365 | 21845 | +| 67 | -21846 | 0 | 3413 | 21845 | +| 67 | -21846 | 0 | 5461 | 21845 | +| 67 | -21846 | 0 | 7509 | -21846 | +| 67 | -21846 | 0 | 9557 | 21845 | +| 67 | -21846 | 0 | 11605 | 21845 | +| 67 | -21846 | 0 | 13653 | 21845 | +| 67 | -21846 | 0 | 15701 | 21845 | +| 67+ | 21845 | 1 | 7509 | -21846 | +| 68 | 21845 | 1 | 7509 | 21845 | +| 68+ | -21846 | 1 | 9557 | 21845 | +| 69 | -21846 | 1 | 9557 | -21846 | +| 69+ | -21846 | 0 | 1365 | 21845 | +| 70 | -21846 | 0 | 1365 | 21845 | +| 70 | -21846 | 0 | 3413 | 21845 | +| 70 | -21846 | 0 | 5461 | 21845 | +| 70 | -21846 | 0 | 7509 | 21845 | +| 70 | -21846 | 0 | 9557 | -21846 | +| 70 | -21846 | 0 | 11605 | 21845 | +| 70 | -21846 | 0 | 13653 | 21845 | +| 70 | -21846 | 0 | 15701 | 21845 | +| 70+ | 21845 | 1 | 9557 | -21846 | +| 71 | 21845 | 1 | 9557 | 21845 | +| 71+ | -21846 | 1 | 11605 | 21845 | +| 72 | -21846 | 1 | 11605 | -21846 | +| 72+ | -21846 | 0 | 1365 | 21845 | +| 73 | -21846 | 0 | 1365 | 21845 | +| 73 | -21846 | 0 | 3413 | 21845 | +| 73 | -21846 | 0 | 5461 | 21845 | +| 73 | -21846 | 0 | 7509 | 21845 | +| 73 | -21846 | 0 | 9557 | 21845 | +| 73 | -21846 | 0 | 11605 | -21846 | +| 73 | -21846 | 0 | 13653 | 21845 | +| 73 | -21846 | 0 | 15701 | 21845 | +| 73+ | 21845 | 1 | 11605 | -21846 | +| 74 | 21845 | 1 | 11605 | 21845 | +| 74+ | -21846 | 1 | 13653 | 21845 | +| 75 | -21846 | 1 | 13653 | -21846 | +| 75+ | -21846 | 0 | 1365 | 21845 | +| 76 | -21846 | 0 | 1365 | 21845 | +| 76 | -21846 | 0 | 3413 | 21845 | +| 76 | -21846 | 0 | 5461 | 21845 | +| 76 | -21846 | 0 | 7509 | 21845 | +| 76 | -21846 | 0 | 9557 | 21845 | +| 76 | -21846 | 0 | 11605 | 21845 | +| 76 | -21846 | 0 | 13653 | -21846 | +| 76 | -21846 | 0 | 15701 | 21845 | +| 76+ | 21845 | 1 | 13653 | -21846 | +| 77 | 21845 | 1 | 13653 | 21845 | +| 77+ | -21846 | 1 | 15701 | 21845 | +| 78 | -21846 | 1 | 15701 | -21846 | +| 78+ | -21846 | 0 | 1365 | 21845 | +| 79 | -21846 | 0 | 1365 | 21845 | +| 79 | -21846 | 0 | 3413 | 21845 | +| 79 | -21846 | 0 | 5461 | 21845 | +| 79 | -21846 | 0 | 7509 | 21845 | +| 79 | -21846 | 0 | 9557 | 21845 | +| 79 | -21846 | 0 | 11605 | 21845 | +| 79 | -21846 | 0 | 13653 | 21845 | +| 79 | -21846 | 0 | 15701 | -21846 | +| 79+ | 21845 | 1 | 15701 | -21846 | +| 80 | 21845 | 1 | 15701 | 21845 | +| 80+ | 21845 | 0 | 1365 | 21845 | +| 81 | 21845 | 0 | 1365 | 21845 | +| 81 | 21845 | 0 | 3413 | 21845 | +| 81 | 21845 | 0 | 5461 | 21845 | +| 81 | 21845 | 0 | 7509 | 21845 | +| 81 | 21845 | 0 | 9557 | 21845 | +| 81 | 21845 | 0 | 11605 | 21845 | +| 81 | 21845 | 0 | 13653 | 21845 | +| 81 | 21845 | 0 | 15701 | 21845 | diff --git a/projects/03/b/RAM16K.hdl b/projects/03/b/RAM16K.hdl new file mode 100644 index 0000000..119a19e --- /dev/null +++ b/projects/03/b/RAM16K.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: projects/03/b/RAM16K.hdl + +/** + * Memory of 16K registers, each 16 bit-wide. Out holds the value + * stored at the memory location specified by address. If load==1, then + * the in value is loaded into the memory location specified by address + * (the loaded value will be emitted to out from the next time step onward). + */ + +CHIP RAM16K { + IN in[16], load, address[14]; + OUT out[16]; + + PARTS: + // Put your code here: +} \ No newline at end of file diff --git a/projects/03/b/RAM16K.tst b/projects/03/b/RAM16K.tst new file mode 100644 index 0000000..e556ad4 --- /dev/null +++ b/projects/03/b/RAM16K.tst @@ -0,0 +1,1026 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/03/b/RAM16K.tst + +load RAM16K.hdl, +output-file RAM16K.out, +compare-to RAM16K.cmp, +output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.5.2 out%D1.6.1; + +set in 0, +set load 0, +set address 0, +tick, +output; +tock, +output; + +set load 1, +tick, +output; +tock, +output; + +set in 4321, +set load 0, +tick, +output; +tock, +output; + +set load 1, +set address 4321, +tick, +output; +tock, +output; + +set load 0, +set address 0, +tick, +output; +tock, +output; + +set in 12345, +set address 12345, +tick, +output; +tock, +output; + +set load 1, +tick, +output; +tock, +output; + +set load 0, +tick, +output; +tock, +output; + +set address 4321, +eval, +output; + +set in 16383, +tick, +output; +tock, +output; + +set load 1, +set address 16383, +tick, +output; +tock, +output; + +set load 0, +tick, +output; +tock, +output; + +set address 12345, +eval, +output; + +set address 16383, +eval, +output; + + +set load 0, +set address %B10101010101000, +tick, +output; +tock, +output; +set address %B10101010101001, +eval, +output; +set address %B10101010101010, +eval, +output; +set address %B10101010101011, +eval, +output; +set address %B10101010101100, +eval, +output; +set address %B10101010101101, +eval, +output; +set address %B10101010101110, +eval, +output; +set address %B10101010101111, +eval, +output; + +set load 1, +set in %B0101010101010101, +set address %B10101010101000, +tick, +output; +tock, +output; +set address %B10101010101001, +tick, +output, +tock, +output; +set address %B10101010101010, +tick, +output, +tock, +output; +set address %B10101010101011, +tick, +output, +tock, +output; +set address %B10101010101100, +tick, +output, +tock, +output; +set address %B10101010101101, +tick, +output, +tock, +output; +set address %B10101010101110, +tick, +output, +tock, +output; +set address %B10101010101111, +tick, +output, +tock, +output; + +set load 0, +set address %B10101010101000, +tick, +output; +tock, +output; +set address %B10101010101001, +eval, +output; +set address %B10101010101010, +eval, +output; +set address %B10101010101011, +eval, +output; +set address %B10101010101100, +eval, +output; +set address %B10101010101101, +eval, +output; +set address %B10101010101110, +eval, +output; +set address %B10101010101111, +eval, +output; + +set load 1, +set address %B10101010101000, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B10101010101000, +tick, +output; +tock, +output; +set address %B10101010101001, +eval, +output; +set address %B10101010101010, +eval, +output; +set address %B10101010101011, +eval, +output; +set address %B10101010101100, +eval, +output; +set address %B10101010101101, +eval, +output; +set address %B10101010101110, +eval, +output; +set address %B10101010101111, +eval, +output; + +set load 1, +set address %B10101010101000, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B10101010101001, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B10101010101000, +tick, +output; +tock, +output; +set address %B10101010101001, +eval, +output; +set address %B10101010101010, +eval, +output; +set address %B10101010101011, +eval, +output; +set address %B10101010101100, +eval, +output; +set address %B10101010101101, +eval, +output; +set address %B10101010101110, +eval, +output; +set address %B10101010101111, +eval, +output; + +set load 1, +set address %B10101010101001, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B10101010101010, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B10101010101000, +tick, +output; +tock, +output; +set address %B10101010101001, +eval, +output; +set address %B10101010101010, +eval, +output; +set address %B10101010101011, +eval, +output; +set address %B10101010101100, +eval, +output; +set address %B10101010101101, +eval, +output; +set address %B10101010101110, +eval, +output; +set address %B10101010101111, +eval, +output; + +set load 1, +set address %B10101010101010, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B10101010101011, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B10101010101000, +tick, +output; +tock, +output; +set address %B10101010101001, +eval, +output; +set address %B10101010101010, +eval, +output; +set address %B10101010101011, +eval, +output; +set address %B10101010101100, +eval, +output; +set address %B10101010101101, +eval, +output; +set address %B10101010101110, +eval, +output; +set address %B10101010101111, +eval, +output; + +set load 1, +set address %B10101010101011, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B10101010101100, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B10101010101000, +tick, +output; +tock, +output; +set address %B10101010101001, +eval, +output; +set address %B10101010101010, +eval, +output; +set address %B10101010101011, +eval, +output; +set address %B10101010101100, +eval, +output; +set address %B10101010101101, +eval, +output; +set address %B10101010101110, +eval, +output; +set address %B10101010101111, +eval, +output; + +set load 1, +set address %B10101010101100, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B10101010101101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B10101010101000, +tick, +output; +tock, +output; +set address %B10101010101001, +eval, +output; +set address %B10101010101010, +eval, +output; +set address %B10101010101011, +eval, +output; +set address %B10101010101100, +eval, +output; +set address %B10101010101101, +eval, +output; +set address %B10101010101110, +eval, +output; +set address %B10101010101111, +eval, +output; + +set load 1, +set address %B10101010101101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B10101010101110, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B10101010101000, +tick, +output; +tock, +output; +set address %B10101010101001, +eval, +output; +set address %B10101010101010, +eval, +output; +set address %B10101010101011, +eval, +output; +set address %B10101010101100, +eval, +output; +set address %B10101010101101, +eval, +output; +set address %B10101010101110, +eval, +output; +set address %B10101010101111, +eval, +output; + +set load 1, +set address %B10101010101110, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B10101010101111, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B10101010101000, +tick, +output; +tock, +output; +set address %B10101010101001, +eval, +output; +set address %B10101010101010, +eval, +output; +set address %B10101010101011, +eval, +output; +set address %B10101010101100, +eval, +output; +set address %B10101010101101, +eval, +output; +set address %B10101010101110, +eval, +output; +set address %B10101010101111, +eval, +output; + +set load 1, +set address %B10101010101111, +set in %B0101010101010101, +tick, +output, +tock, +output; + +set load 0, +set address %B10101010101000, +tick, +output; +tock, +output; +set address %B10101010101001, +eval, +output; +set address %B10101010101010, +eval, +output; +set address %B10101010101011, +eval, +output; +set address %B10101010101100, +eval, +output; +set address %B10101010101101, +eval, +output; +set address %B10101010101110, +eval, +output; +set address %B10101010101111, +eval, +output; + + +set load 0, +set address %B00010101010101, +tick, +output; +tock, +output; +set address %B00110101010101, +eval, +output; +set address %B01010101010101, +eval, +output; +set address %B01110101010101, +eval, +output; +set address %B10010101010101, +eval, +output; +set address %B10110101010101, +eval, +output; +set address %B11010101010101, +eval, +output; +set address %B11110101010101, +eval, +output; + +set load 1, +set in %B0101010101010101, +set address %B00010101010101, +tick, +output; +tock, +output; +set address %B00110101010101, +tick, +output, +tock, +output; +set address %B01010101010101, +tick, +output, +tock, +output; +set address %B01110101010101, +tick, +output, +tock, +output; +set address %B10010101010101, +tick, +output, +tock, +output; +set address %B10110101010101, +tick, +output, +tock, +output; +set address %B11010101010101, +tick, +output, +tock, +output; +set address %B11110101010101, +tick, +output, +tock, +output; + +set load 0, +set address %B00010101010101, +tick, +output; +tock, +output; +set address %B00110101010101, +eval, +output; +set address %B01010101010101, +eval, +output; +set address %B01110101010101, +eval, +output; +set address %B10010101010101, +eval, +output; +set address %B10110101010101, +eval, +output; +set address %B11010101010101, +eval, +output; +set address %B11110101010101, +eval, +output; + +set load 1, +set address %B00010101010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B00010101010101, +tick, +output; +tock, +output; +set address %B00110101010101, +eval, +output; +set address %B01010101010101, +eval, +output; +set address %B01110101010101, +eval, +output; +set address %B10010101010101, +eval, +output; +set address %B10110101010101, +eval, +output; +set address %B11010101010101, +eval, +output; +set address %B11110101010101, +eval, +output; + +set load 1, +set address %B00010101010101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B00110101010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B00010101010101, +tick, +output; +tock, +output; +set address %B00110101010101, +eval, +output; +set address %B01010101010101, +eval, +output; +set address %B01110101010101, +eval, +output; +set address %B10010101010101, +eval, +output; +set address %B10110101010101, +eval, +output; +set address %B11010101010101, +eval, +output; +set address %B11110101010101, +eval, +output; + +set load 1, +set address %B00110101010101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B01010101010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B00010101010101, +tick, +output; +tock, +output; +set address %B00110101010101, +eval, +output; +set address %B01010101010101, +eval, +output; +set address %B01110101010101, +eval, +output; +set address %B10010101010101, +eval, +output; +set address %B10110101010101, +eval, +output; +set address %B11010101010101, +eval, +output; +set address %B11110101010101, +eval, +output; + +set load 1, +set address %B01010101010101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B01110101010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B00010101010101, +tick, +output; +tock, +output; +set address %B00110101010101, +eval, +output; +set address %B01010101010101, +eval, +output; +set address %B01110101010101, +eval, +output; +set address %B10010101010101, +eval, +output; +set address %B10110101010101, +eval, +output; +set address %B11010101010101, +eval, +output; +set address %B11110101010101, +eval, +output; + +set load 1, +set address %B01110101010101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B10010101010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B00010101010101, +tick, +output; +tock, +output; +set address %B00110101010101, +eval, +output; +set address %B01010101010101, +eval, +output; +set address %B01110101010101, +eval, +output; +set address %B10010101010101, +eval, +output; +set address %B10110101010101, +eval, +output; +set address %B11010101010101, +eval, +output; +set address %B11110101010101, +eval, +output; + +set load 1, +set address %B10010101010101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B10110101010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B00010101010101, +tick, +output; +tock, +output; +set address %B00110101010101, +eval, +output; +set address %B01010101010101, +eval, +output; +set address %B01110101010101, +eval, +output; +set address %B10010101010101, +eval, +output; +set address %B10110101010101, +eval, +output; +set address %B11010101010101, +eval, +output; +set address %B11110101010101, +eval, +output; + +set load 1, +set address %B10110101010101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B11010101010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B00010101010101, +tick, +output; +tock, +output; +set address %B00110101010101, +eval, +output; +set address %B01010101010101, +eval, +output; +set address %B01110101010101, +eval, +output; +set address %B10010101010101, +eval, +output; +set address %B10110101010101, +eval, +output; +set address %B11010101010101, +eval, +output; +set address %B11110101010101, +eval, +output; + +set load 1, +set address %B11010101010101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B11110101010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B00010101010101, +tick, +output; +tock, +output; +set address %B00110101010101, +eval, +output; +set address %B01010101010101, +eval, +output; +set address %B01110101010101, +eval, +output; +set address %B10010101010101, +eval, +output; +set address %B10110101010101, +eval, +output; +set address %B11010101010101, +eval, +output; +set address %B11110101010101, +eval, +output; + +set load 1, +set address %B11110101010101, +set in %B0101010101010101, +tick, +output, +tock, +output; + +set load 0, +set address %B00010101010101, +tick, +output; +tock, +output; +set address %B00110101010101, +eval, +output; +set address %B01010101010101, +eval, +output; +set address %B01110101010101, +eval, +output; +set address %B10010101010101, +eval, +output; +set address %B10110101010101, +eval, +output; +set address %B11010101010101, +eval, +output; +set address %B11110101010101, +eval, +output; diff --git a/projects/03/b/RAM4K.cmp b/projects/03/b/RAM4K.cmp new file mode 100644 index 0000000..a614796 --- /dev/null +++ b/projects/03/b/RAM4K.cmp @@ -0,0 +1,320 @@ +| time | in |load |address | out | +| 0+ | 0 | 0 | 0 | 0 | +| 1 | 0 | 0 | 0 | 0 | +| 1+ | 0 | 1 | 0 | 0 | +| 2 | 0 | 1 | 0 | 0 | +| 2+ | 1111 | 0 | 0 | 0 | +| 3 | 1111 | 0 | 0 | 0 | +| 3+ | 1111 | 1 | 1111 | 0 | +| 4 | 1111 | 1 | 1111 | 1111 | +| 4+ | 1111 | 0 | 0 | 0 | +| 5 | 1111 | 0 | 0 | 0 | +| 5+ | 3513 | 0 | 3513 | 0 | +| 6 | 3513 | 0 | 3513 | 0 | +| 6+ | 3513 | 1 | 3513 | 0 | +| 7 | 3513 | 1 | 3513 | 3513 | +| 7+ | 3513 | 0 | 3513 | 3513 | +| 8 | 3513 | 0 | 3513 | 3513 | +| 8 | 3513 | 0 | 1111 | 1111 | +| 8+ | 4095 | 0 | 1111 | 1111 | +| 9 | 4095 | 0 | 1111 | 1111 | +| 9+ | 4095 | 1 | 4095 | 0 | +| 10 | 4095 | 1 | 4095 | 4095 | +| 10+ | 4095 | 0 | 4095 | 4095 | +| 11 | 4095 | 0 | 4095 | 4095 | +| 11 | 4095 | 0 | 3513 | 3513 | +| 11 | 4095 | 0 | 4095 | 4095 | +| 11+ | 4095 | 0 | 2728 | 0 | +| 12 | 4095 | 0 | 2728 | 0 | +| 12 | 4095 | 0 | 2729 | 0 | +| 12 | 4095 | 0 | 2730 | 0 | +| 12 | 4095 | 0 | 2731 | 0 | +| 12 | 4095 | 0 | 2732 | 0 | +| 12 | 4095 | 0 | 2733 | 0 | +| 12 | 4095 | 0 | 2734 | 0 | +| 12 | 4095 | 0 | 2735 | 0 | +| 12+ | 21845 | 1 | 2728 | 0 | +| 13 | 21845 | 1 | 2728 | 21845 | +| 13+ | 21845 | 1 | 2729 | 0 | +| 14 | 21845 | 1 | 2729 | 21845 | +| 14+ | 21845 | 1 | 2730 | 0 | +| 15 | 21845 | 1 | 2730 | 21845 | +| 15+ | 21845 | 1 | 2731 | 0 | +| 16 | 21845 | 1 | 2731 | 21845 | +| 16+ | 21845 | 1 | 2732 | 0 | +| 17 | 21845 | 1 | 2732 | 21845 | +| 17+ | 21845 | 1 | 2733 | 0 | +| 18 | 21845 | 1 | 2733 | 21845 | +| 18+ | 21845 | 1 | 2734 | 0 | +| 19 | 21845 | 1 | 2734 | 21845 | +| 19+ | 21845 | 1 | 2735 | 0 | +| 20 | 21845 | 1 | 2735 | 21845 | +| 20+ | 21845 | 0 | 2728 | 21845 | +| 21 | 21845 | 0 | 2728 | 21845 | +| 21 | 21845 | 0 | 2729 | 21845 | +| 21 | 21845 | 0 | 2730 | 21845 | +| 21 | 21845 | 0 | 2731 | 21845 | +| 21 | 21845 | 0 | 2732 | 21845 | +| 21 | 21845 | 0 | 2733 | 21845 | +| 21 | 21845 | 0 | 2734 | 21845 | +| 21 | 21845 | 0 | 2735 | 21845 | +| 21+ | -21846 | 1 | 2728 | 21845 | +| 22 | -21846 | 1 | 2728 | -21846 | +| 22+ | -21846 | 0 | 2728 | -21846 | +| 23 | -21846 | 0 | 2728 | -21846 | +| 23 | -21846 | 0 | 2729 | 21845 | +| 23 | -21846 | 0 | 2730 | 21845 | +| 23 | -21846 | 0 | 2731 | 21845 | +| 23 | -21846 | 0 | 2732 | 21845 | +| 23 | -21846 | 0 | 2733 | 21845 | +| 23 | -21846 | 0 | 2734 | 21845 | +| 23 | -21846 | 0 | 2735 | 21845 | +| 23+ | 21845 | 1 | 2728 | -21846 | +| 24 | 21845 | 1 | 2728 | 21845 | +| 24+ | -21846 | 1 | 2729 | 21845 | +| 25 | -21846 | 1 | 2729 | -21846 | +| 25+ | -21846 | 0 | 2728 | 21845 | +| 26 | -21846 | 0 | 2728 | 21845 | +| 26 | -21846 | 0 | 2729 | -21846 | +| 26 | -21846 | 0 | 2730 | 21845 | +| 26 | -21846 | 0 | 2731 | 21845 | +| 26 | -21846 | 0 | 2732 | 21845 | +| 26 | -21846 | 0 | 2733 | 21845 | +| 26 | -21846 | 0 | 2734 | 21845 | +| 26 | -21846 | 0 | 2735 | 21845 | +| 26+ | 21845 | 1 | 2729 | -21846 | +| 27 | 21845 | 1 | 2729 | 21845 | +| 27+ | -21846 | 1 | 2730 | 21845 | +| 28 | -21846 | 1 | 2730 | -21846 | +| 28+ | -21846 | 0 | 2728 | 21845 | +| 29 | -21846 | 0 | 2728 | 21845 | +| 29 | -21846 | 0 | 2729 | 21845 | +| 29 | -21846 | 0 | 2730 | -21846 | +| 29 | -21846 | 0 | 2731 | 21845 | +| 29 | -21846 | 0 | 2732 | 21845 | +| 29 | -21846 | 0 | 2733 | 21845 | +| 29 | -21846 | 0 | 2734 | 21845 | +| 29 | -21846 | 0 | 2735 | 21845 | +| 29+ | 21845 | 1 | 2730 | -21846 | +| 30 | 21845 | 1 | 2730 | 21845 | +| 30+ | -21846 | 1 | 2731 | 21845 | +| 31 | -21846 | 1 | 2731 | -21846 | +| 31+ | -21846 | 0 | 2728 | 21845 | +| 32 | -21846 | 0 | 2728 | 21845 | +| 32 | -21846 | 0 | 2729 | 21845 | +| 32 | -21846 | 0 | 2730 | 21845 | +| 32 | -21846 | 0 | 2731 | -21846 | +| 32 | -21846 | 0 | 2732 | 21845 | +| 32 | -21846 | 0 | 2733 | 21845 | +| 32 | -21846 | 0 | 2734 | 21845 | +| 32 | -21846 | 0 | 2735 | 21845 | +| 32+ | 21845 | 1 | 2731 | -21846 | +| 33 | 21845 | 1 | 2731 | 21845 | +| 33+ | -21846 | 1 | 2732 | 21845 | +| 34 | -21846 | 1 | 2732 | -21846 | +| 34+ | -21846 | 0 | 2728 | 21845 | +| 35 | -21846 | 0 | 2728 | 21845 | +| 35 | -21846 | 0 | 2729 | 21845 | +| 35 | -21846 | 0 | 2730 | 21845 | +| 35 | -21846 | 0 | 2731 | 21845 | +| 35 | -21846 | 0 | 2732 | -21846 | +| 35 | -21846 | 0 | 2733 | 21845 | +| 35 | -21846 | 0 | 2734 | 21845 | +| 35 | -21846 | 0 | 2735 | 21845 | +| 35+ | 21845 | 1 | 2732 | -21846 | +| 36 | 21845 | 1 | 2732 | 21845 | +| 36+ | -21846 | 1 | 2733 | 21845 | +| 37 | -21846 | 1 | 2733 | -21846 | +| 37+ | -21846 | 0 | 2728 | 21845 | +| 38 | -21846 | 0 | 2728 | 21845 | +| 38 | -21846 | 0 | 2729 | 21845 | +| 38 | -21846 | 0 | 2730 | 21845 | +| 38 | -21846 | 0 | 2731 | 21845 | +| 38 | -21846 | 0 | 2732 | 21845 | +| 38 | -21846 | 0 | 2733 | -21846 | +| 38 | -21846 | 0 | 2734 | 21845 | +| 38 | -21846 | 0 | 2735 | 21845 | +| 38+ | 21845 | 1 | 2733 | -21846 | +| 39 | 21845 | 1 | 2733 | 21845 | +| 39+ | -21846 | 1 | 2734 | 21845 | +| 40 | -21846 | 1 | 2734 | -21846 | +| 40+ | -21846 | 0 | 2728 | 21845 | +| 41 | -21846 | 0 | 2728 | 21845 | +| 41 | -21846 | 0 | 2729 | 21845 | +| 41 | -21846 | 0 | 2730 | 21845 | +| 41 | -21846 | 0 | 2731 | 21845 | +| 41 | -21846 | 0 | 2732 | 21845 | +| 41 | -21846 | 0 | 2733 | 21845 | +| 41 | -21846 | 0 | 2734 | -21846 | +| 41 | -21846 | 0 | 2735 | 21845 | +| 41+ | 21845 | 1 | 2734 | -21846 | +| 42 | 21845 | 1 | 2734 | 21845 | +| 42+ | -21846 | 1 | 2735 | 21845 | +| 43 | -21846 | 1 | 2735 | -21846 | +| 43+ | -21846 | 0 | 2728 | 21845 | +| 44 | -21846 | 0 | 2728 | 21845 | +| 44 | -21846 | 0 | 2729 | 21845 | +| 44 | -21846 | 0 | 2730 | 21845 | +| 44 | -21846 | 0 | 2731 | 21845 | +| 44 | -21846 | 0 | 2732 | 21845 | +| 44 | -21846 | 0 | 2733 | 21845 | +| 44 | -21846 | 0 | 2734 | 21845 | +| 44 | -21846 | 0 | 2735 | -21846 | +| 44+ | 21845 | 1 | 2735 | -21846 | +| 45 | 21845 | 1 | 2735 | 21845 | +| 45+ | 21845 | 0 | 2728 | 21845 | +| 46 | 21845 | 0 | 2728 | 21845 | +| 46 | 21845 | 0 | 2729 | 21845 | +| 46 | 21845 | 0 | 2730 | 21845 | +| 46 | 21845 | 0 | 2731 | 21845 | +| 46 | 21845 | 0 | 2732 | 21845 | +| 46 | 21845 | 0 | 2733 | 21845 | +| 46 | 21845 | 0 | 2734 | 21845 | +| 46 | 21845 | 0 | 2735 | 21845 | +| 46+ | 21845 | 0 | 341 | 0 | +| 47 | 21845 | 0 | 341 | 0 | +| 47 | 21845 | 0 | 853 | 0 | +| 47 | 21845 | 0 | 1365 | 0 | +| 47 | 21845 | 0 | 1877 | 0 | +| 47 | 21845 | 0 | 2389 | 0 | +| 47 | 21845 | 0 | 2901 | 0 | +| 47 | 21845 | 0 | 3413 | 0 | +| 47 | 21845 | 0 | 3925 | 0 | +| 47+ | 21845 | 1 | 341 | 0 | +| 48 | 21845 | 1 | 341 | 21845 | +| 48+ | 21845 | 1 | 853 | 0 | +| 49 | 21845 | 1 | 853 | 21845 | +| 49+ | 21845 | 1 | 1365 | 0 | +| 50 | 21845 | 1 | 1365 | 21845 | +| 50+ | 21845 | 1 | 1877 | 0 | +| 51 | 21845 | 1 | 1877 | 21845 | +| 51+ | 21845 | 1 | 2389 | 0 | +| 52 | 21845 | 1 | 2389 | 21845 | +| 52+ | 21845 | 1 | 2901 | 0 | +| 53 | 21845 | 1 | 2901 | 21845 | +| 53+ | 21845 | 1 | 3413 | 0 | +| 54 | 21845 | 1 | 3413 | 21845 | +| 54+ | 21845 | 1 | 3925 | 0 | +| 55 | 21845 | 1 | 3925 | 21845 | +| 55+ | 21845 | 0 | 341 | 21845 | +| 56 | 21845 | 0 | 341 | 21845 | +| 56 | 21845 | 0 | 853 | 21845 | +| 56 | 21845 | 0 | 1365 | 21845 | +| 56 | 21845 | 0 | 1877 | 21845 | +| 56 | 21845 | 0 | 2389 | 21845 | +| 56 | 21845 | 0 | 2901 | 21845 | +| 56 | 21845 | 0 | 3413 | 21845 | +| 56 | 21845 | 0 | 3925 | 21845 | +| 56+ | -21846 | 1 | 341 | 21845 | +| 57 | -21846 | 1 | 341 | -21846 | +| 57+ | -21846 | 0 | 341 | -21846 | +| 58 | -21846 | 0 | 341 | -21846 | +| 58 | -21846 | 0 | 853 | 21845 | +| 58 | -21846 | 0 | 1365 | 21845 | +| 58 | -21846 | 0 | 1877 | 21845 | +| 58 | -21846 | 0 | 2389 | 21845 | +| 58 | -21846 | 0 | 2901 | 21845 | +| 58 | -21846 | 0 | 3413 | 21845 | +| 58 | -21846 | 0 | 3925 | 21845 | +| 58+ | 21845 | 1 | 341 | -21846 | +| 59 | 21845 | 1 | 341 | 21845 | +| 59+ | -21846 | 1 | 853 | 21845 | +| 60 | -21846 | 1 | 853 | -21846 | +| 60+ | -21846 | 0 | 341 | 21845 | +| 61 | -21846 | 0 | 341 | 21845 | +| 61 | -21846 | 0 | 853 | -21846 | +| 61 | -21846 | 0 | 1365 | 21845 | +| 61 | -21846 | 0 | 1877 | 21845 | +| 61 | -21846 | 0 | 2389 | 21845 | +| 61 | -21846 | 0 | 2901 | 21845 | +| 61 | -21846 | 0 | 3413 | 21845 | +| 61 | -21846 | 0 | 3925 | 21845 | +| 61+ | 21845 | 1 | 853 | -21846 | +| 62 | 21845 | 1 | 853 | 21845 | +| 62+ | -21846 | 1 | 1365 | 21845 | +| 63 | -21846 | 1 | 1365 | -21846 | +| 63+ | -21846 | 0 | 341 | 21845 | +| 64 | -21846 | 0 | 341 | 21845 | +| 64 | -21846 | 0 | 853 | 21845 | +| 64 | -21846 | 0 | 1365 | -21846 | +| 64 | -21846 | 0 | 1877 | 21845 | +| 64 | -21846 | 0 | 2389 | 21845 | +| 64 | -21846 | 0 | 2901 | 21845 | +| 64 | -21846 | 0 | 3413 | 21845 | +| 64 | -21846 | 0 | 3925 | 21845 | +| 64+ | 21845 | 1 | 1365 | -21846 | +| 65 | 21845 | 1 | 1365 | 21845 | +| 65+ | -21846 | 1 | 1877 | 21845 | +| 66 | -21846 | 1 | 1877 | -21846 | +| 66+ | -21846 | 0 | 341 | 21845 | +| 67 | -21846 | 0 | 341 | 21845 | +| 67 | -21846 | 0 | 853 | 21845 | +| 67 | -21846 | 0 | 1365 | 21845 | +| 67 | -21846 | 0 | 1877 | -21846 | +| 67 | -21846 | 0 | 2389 | 21845 | +| 67 | -21846 | 0 | 2901 | 21845 | +| 67 | -21846 | 0 | 3413 | 21845 | +| 67 | -21846 | 0 | 3925 | 21845 | +| 67+ | 21845 | 1 | 1877 | -21846 | +| 68 | 21845 | 1 | 1877 | 21845 | +| 68+ | -21846 | 1 | 2389 | 21845 | +| 69 | -21846 | 1 | 2389 | -21846 | +| 69+ | -21846 | 0 | 341 | 21845 | +| 70 | -21846 | 0 | 341 | 21845 | +| 70 | -21846 | 0 | 853 | 21845 | +| 70 | -21846 | 0 | 1365 | 21845 | +| 70 | -21846 | 0 | 1877 | 21845 | +| 70 | -21846 | 0 | 2389 | -21846 | +| 70 | -21846 | 0 | 2901 | 21845 | +| 70 | -21846 | 0 | 3413 | 21845 | +| 70 | -21846 | 0 | 3925 | 21845 | +| 70+ | 21845 | 1 | 2389 | -21846 | +| 71 | 21845 | 1 | 2389 | 21845 | +| 71+ | -21846 | 1 | 2901 | 21845 | +| 72 | -21846 | 1 | 2901 | -21846 | +| 72+ | -21846 | 0 | 341 | 21845 | +| 73 | -21846 | 0 | 341 | 21845 | +| 73 | -21846 | 0 | 853 | 21845 | +| 73 | -21846 | 0 | 1365 | 21845 | +| 73 | -21846 | 0 | 1877 | 21845 | +| 73 | -21846 | 0 | 2389 | 21845 | +| 73 | -21846 | 0 | 2901 | -21846 | +| 73 | -21846 | 0 | 3413 | 21845 | +| 73 | -21846 | 0 | 3925 | 21845 | +| 73+ | 21845 | 1 | 2901 | -21846 | +| 74 | 21845 | 1 | 2901 | 21845 | +| 74+ | -21846 | 1 | 3413 | 21845 | +| 75 | -21846 | 1 | 3413 | -21846 | +| 75+ | -21846 | 0 | 341 | 21845 | +| 76 | -21846 | 0 | 341 | 21845 | +| 76 | -21846 | 0 | 853 | 21845 | +| 76 | -21846 | 0 | 1365 | 21845 | +| 76 | -21846 | 0 | 1877 | 21845 | +| 76 | -21846 | 0 | 2389 | 21845 | +| 76 | -21846 | 0 | 2901 | 21845 | +| 76 | -21846 | 0 | 3413 | -21846 | +| 76 | -21846 | 0 | 3925 | 21845 | +| 76+ | 21845 | 1 | 3413 | -21846 | +| 77 | 21845 | 1 | 3413 | 21845 | +| 77+ | -21846 | 1 | 3925 | 21845 | +| 78 | -21846 | 1 | 3925 | -21846 | +| 78+ | -21846 | 0 | 341 | 21845 | +| 79 | -21846 | 0 | 341 | 21845 | +| 79 | -21846 | 0 | 853 | 21845 | +| 79 | -21846 | 0 | 1365 | 21845 | +| 79 | -21846 | 0 | 1877 | 21845 | +| 79 | -21846 | 0 | 2389 | 21845 | +| 79 | -21846 | 0 | 2901 | 21845 | +| 79 | -21846 | 0 | 3413 | 21845 | +| 79 | -21846 | 0 | 3925 | -21846 | +| 79+ | 21845 | 1 | 3925 | -21846 | +| 80 | 21845 | 1 | 3925 | 21845 | +| 80+ | 21845 | 0 | 341 | 21845 | +| 81 | 21845 | 0 | 341 | 21845 | +| 81 | 21845 | 0 | 853 | 21845 | +| 81 | 21845 | 0 | 1365 | 21845 | +| 81 | 21845 | 0 | 1877 | 21845 | +| 81 | 21845 | 0 | 2389 | 21845 | +| 81 | 21845 | 0 | 2901 | 21845 | +| 81 | 21845 | 0 | 3413 | 21845 | +| 81 | 21845 | 0 | 3925 | 21845 | diff --git a/projects/03/b/RAM4K.hdl b/projects/03/b/RAM4K.hdl new file mode 100644 index 0000000..1cee633 --- /dev/null +++ b/projects/03/b/RAM4K.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: projects/03/b/RAM4K.hdl + +/** + * Memory of 4K registers, each 16 bit-wide. Out holds the value + * stored at the memory location specified by address. If load==1, then + * the in value is loaded into the memory location specified by address + * (the loaded value will be emitted to out from the next time step onward). + */ + +CHIP RAM4K { + IN in[16], load, address[12]; + OUT out[16]; + + PARTS: + // Put your code here: +} \ No newline at end of file diff --git a/projects/03/b/RAM4K.tst b/projects/03/b/RAM4K.tst new file mode 100644 index 0000000..7a5aa12 --- /dev/null +++ b/projects/03/b/RAM4K.tst @@ -0,0 +1,1026 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/03/b/RAM4K.tst + +load RAM4K.hdl, +output-file RAM4K.out, +compare-to RAM4K.cmp, +output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.4.2 out%D1.6.1; + +set in 0, +set load 0, +set address 0, +tick, +output; +tock, +output; + +set load 1, +tick, +output; +tock, +output; + +set in 1111, +set load 0, +tick, +output; +tock, +output; + +set load 1, +set address 1111, +tick, +output; +tock, +output; + +set load 0, +set address 0, +tick, +output; +tock, +output; + +set in 3513, +set address 3513, +tick, +output; +tock, +output; + +set load 1, +tick, +output; +tock, +output; + +set load 0, +tick, +output; +tock, +output; + +set address 1111, +eval, +output; + +set in 4095, +tick, +output; +tock, +output; + +set load 1, +set address 4095, +tick, +output; +tock, +output; + +set load 0, +tick, +output; +tock, +output; + +set address 3513, +eval, +output; + +set address 4095, +eval, +output; + + +set load 0, +set address %B101010101000, +tick, +output; +tock, +output; +set address %B101010101001, +eval, +output; +set address %B101010101010, +eval, +output; +set address %B101010101011, +eval, +output; +set address %B101010101100, +eval, +output; +set address %B101010101101, +eval, +output; +set address %B101010101110, +eval, +output; +set address %B101010101111, +eval, +output; + +set load 1, +set in %B0101010101010101, +set address %B101010101000, +tick, +output; +tock, +output; +set address %B101010101001, +tick, +output, +tock, +output; +set address %B101010101010, +tick, +output, +tock, +output; +set address %B101010101011, +tick, +output, +tock, +output; +set address %B101010101100, +tick, +output, +tock, +output; +set address %B101010101101, +tick, +output, +tock, +output; +set address %B101010101110, +tick, +output, +tock, +output; +set address %B101010101111, +tick, +output, +tock, +output; + +set load 0, +set address %B101010101000, +tick, +output; +tock, +output; +set address %B101010101001, +eval, +output; +set address %B101010101010, +eval, +output; +set address %B101010101011, +eval, +output; +set address %B101010101100, +eval, +output; +set address %B101010101101, +eval, +output; +set address %B101010101110, +eval, +output; +set address %B101010101111, +eval, +output; + +set load 1, +set address %B101010101000, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B101010101000, +tick, +output; +tock, +output; +set address %B101010101001, +eval, +output; +set address %B101010101010, +eval, +output; +set address %B101010101011, +eval, +output; +set address %B101010101100, +eval, +output; +set address %B101010101101, +eval, +output; +set address %B101010101110, +eval, +output; +set address %B101010101111, +eval, +output; + +set load 1, +set address %B101010101000, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101010101001, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B101010101000, +tick, +output; +tock, +output; +set address %B101010101001, +eval, +output; +set address %B101010101010, +eval, +output; +set address %B101010101011, +eval, +output; +set address %B101010101100, +eval, +output; +set address %B101010101101, +eval, +output; +set address %B101010101110, +eval, +output; +set address %B101010101111, +eval, +output; + +set load 1, +set address %B101010101001, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101010101010, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B101010101000, +tick, +output; +tock, +output; +set address %B101010101001, +eval, +output; +set address %B101010101010, +eval, +output; +set address %B101010101011, +eval, +output; +set address %B101010101100, +eval, +output; +set address %B101010101101, +eval, +output; +set address %B101010101110, +eval, +output; +set address %B101010101111, +eval, +output; + +set load 1, +set address %B101010101010, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101010101011, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B101010101000, +tick, +output; +tock, +output; +set address %B101010101001, +eval, +output; +set address %B101010101010, +eval, +output; +set address %B101010101011, +eval, +output; +set address %B101010101100, +eval, +output; +set address %B101010101101, +eval, +output; +set address %B101010101110, +eval, +output; +set address %B101010101111, +eval, +output; + +set load 1, +set address %B101010101011, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101010101100, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B101010101000, +tick, +output; +tock, +output; +set address %B101010101001, +eval, +output; +set address %B101010101010, +eval, +output; +set address %B101010101011, +eval, +output; +set address %B101010101100, +eval, +output; +set address %B101010101101, +eval, +output; +set address %B101010101110, +eval, +output; +set address %B101010101111, +eval, +output; + +set load 1, +set address %B101010101100, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101010101101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B101010101000, +tick, +output; +tock, +output; +set address %B101010101001, +eval, +output; +set address %B101010101010, +eval, +output; +set address %B101010101011, +eval, +output; +set address %B101010101100, +eval, +output; +set address %B101010101101, +eval, +output; +set address %B101010101110, +eval, +output; +set address %B101010101111, +eval, +output; + +set load 1, +set address %B101010101101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101010101110, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B101010101000, +tick, +output; +tock, +output; +set address %B101010101001, +eval, +output; +set address %B101010101010, +eval, +output; +set address %B101010101011, +eval, +output; +set address %B101010101100, +eval, +output; +set address %B101010101101, +eval, +output; +set address %B101010101110, +eval, +output; +set address %B101010101111, +eval, +output; + +set load 1, +set address %B101010101110, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101010101111, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B101010101000, +tick, +output; +tock, +output; +set address %B101010101001, +eval, +output; +set address %B101010101010, +eval, +output; +set address %B101010101011, +eval, +output; +set address %B101010101100, +eval, +output; +set address %B101010101101, +eval, +output; +set address %B101010101110, +eval, +output; +set address %B101010101111, +eval, +output; + +set load 1, +set address %B101010101111, +set in %B0101010101010101, +tick, +output, +tock, +output; + +set load 0, +set address %B101010101000, +tick, +output; +tock, +output; +set address %B101010101001, +eval, +output; +set address %B101010101010, +eval, +output; +set address %B101010101011, +eval, +output; +set address %B101010101100, +eval, +output; +set address %B101010101101, +eval, +output; +set address %B101010101110, +eval, +output; +set address %B101010101111, +eval, +output; + + +set load 0, +set address %B000101010101, +tick, +output; +tock, +output; +set address %B001101010101, +eval, +output; +set address %B010101010101, +eval, +output; +set address %B011101010101, +eval, +output; +set address %B100101010101, +eval, +output; +set address %B101101010101, +eval, +output; +set address %B110101010101, +eval, +output; +set address %B111101010101, +eval, +output; + +set load 1, +set in %B0101010101010101, +set address %B000101010101, +tick, +output; +tock, +output; +set address %B001101010101, +tick, +output, +tock, +output; +set address %B010101010101, +tick, +output, +tock, +output; +set address %B011101010101, +tick, +output, +tock, +output; +set address %B100101010101, +tick, +output, +tock, +output; +set address %B101101010101, +tick, +output, +tock, +output; +set address %B110101010101, +tick, +output, +tock, +output; +set address %B111101010101, +tick, +output, +tock, +output; + +set load 0, +set address %B000101010101, +tick, +output; +tock, +output; +set address %B001101010101, +eval, +output; +set address %B010101010101, +eval, +output; +set address %B011101010101, +eval, +output; +set address %B100101010101, +eval, +output; +set address %B101101010101, +eval, +output; +set address %B110101010101, +eval, +output; +set address %B111101010101, +eval, +output; + +set load 1, +set address %B000101010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101010101, +tick, +output; +tock, +output; +set address %B001101010101, +eval, +output; +set address %B010101010101, +eval, +output; +set address %B011101010101, +eval, +output; +set address %B100101010101, +eval, +output; +set address %B101101010101, +eval, +output; +set address %B110101010101, +eval, +output; +set address %B111101010101, +eval, +output; + +set load 1, +set address %B000101010101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B001101010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101010101, +tick, +output; +tock, +output; +set address %B001101010101, +eval, +output; +set address %B010101010101, +eval, +output; +set address %B011101010101, +eval, +output; +set address %B100101010101, +eval, +output; +set address %B101101010101, +eval, +output; +set address %B110101010101, +eval, +output; +set address %B111101010101, +eval, +output; + +set load 1, +set address %B001101010101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B010101010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101010101, +tick, +output; +tock, +output; +set address %B001101010101, +eval, +output; +set address %B010101010101, +eval, +output; +set address %B011101010101, +eval, +output; +set address %B100101010101, +eval, +output; +set address %B101101010101, +eval, +output; +set address %B110101010101, +eval, +output; +set address %B111101010101, +eval, +output; + +set load 1, +set address %B010101010101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B011101010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101010101, +tick, +output; +tock, +output; +set address %B001101010101, +eval, +output; +set address %B010101010101, +eval, +output; +set address %B011101010101, +eval, +output; +set address %B100101010101, +eval, +output; +set address %B101101010101, +eval, +output; +set address %B110101010101, +eval, +output; +set address %B111101010101, +eval, +output; + +set load 1, +set address %B011101010101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B100101010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101010101, +tick, +output; +tock, +output; +set address %B001101010101, +eval, +output; +set address %B010101010101, +eval, +output; +set address %B011101010101, +eval, +output; +set address %B100101010101, +eval, +output; +set address %B101101010101, +eval, +output; +set address %B110101010101, +eval, +output; +set address %B111101010101, +eval, +output; + +set load 1, +set address %B100101010101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101101010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101010101, +tick, +output; +tock, +output; +set address %B001101010101, +eval, +output; +set address %B010101010101, +eval, +output; +set address %B011101010101, +eval, +output; +set address %B100101010101, +eval, +output; +set address %B101101010101, +eval, +output; +set address %B110101010101, +eval, +output; +set address %B111101010101, +eval, +output; + +set load 1, +set address %B101101010101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B110101010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101010101, +tick, +output; +tock, +output; +set address %B001101010101, +eval, +output; +set address %B010101010101, +eval, +output; +set address %B011101010101, +eval, +output; +set address %B100101010101, +eval, +output; +set address %B101101010101, +eval, +output; +set address %B110101010101, +eval, +output; +set address %B111101010101, +eval, +output; + +set load 1, +set address %B110101010101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B111101010101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101010101, +tick, +output; +tock, +output; +set address %B001101010101, +eval, +output; +set address %B010101010101, +eval, +output; +set address %B011101010101, +eval, +output; +set address %B100101010101, +eval, +output; +set address %B101101010101, +eval, +output; +set address %B110101010101, +eval, +output; +set address %B111101010101, +eval, +output; + +set load 1, +set address %B111101010101, +set in %B0101010101010101, +tick, +output, +tock, +output; + +set load 0, +set address %B000101010101, +tick, +output; +tock, +output; +set address %B001101010101, +eval, +output; +set address %B010101010101, +eval, +output; +set address %B011101010101, +eval, +output; +set address %B100101010101, +eval, +output; +set address %B101101010101, +eval, +output; +set address %B110101010101, +eval, +output; +set address %B111101010101, +eval, +output; diff --git a/projects/03/b/RAM512.cmp b/projects/03/b/RAM512.cmp new file mode 100644 index 0000000..6f756ca --- /dev/null +++ b/projects/03/b/RAM512.cmp @@ -0,0 +1,320 @@ +| time | in |load |address| out | +| 0+ | 0 | 0 | 0 | 0 | +| 1 | 0 | 0 | 0 | 0 | +| 1+ | 0 | 1 | 0 | 0 | +| 2 | 0 | 1 | 0 | 0 | +| 2+ | 13099 | 0 | 0 | 0 | +| 3 | 13099 | 0 | 0 | 0 | +| 3+ | 13099 | 1 | 130 | 0 | +| 4 | 13099 | 1 | 130 | 13099 | +| 4+ | 13099 | 0 | 0 | 0 | +| 5 | 13099 | 0 | 0 | 0 | +| 5+ | 4729 | 0 | 472 | 0 | +| 6 | 4729 | 0 | 472 | 0 | +| 6+ | 4729 | 1 | 472 | 0 | +| 7 | 4729 | 1 | 472 | 4729 | +| 7+ | 4729 | 0 | 472 | 4729 | +| 8 | 4729 | 0 | 472 | 4729 | +| 8 | 4729 | 0 | 130 | 13099 | +| 8+ | 5119 | 0 | 130 | 13099 | +| 9 | 5119 | 0 | 130 | 13099 | +| 9+ | 5119 | 1 | 511 | 0 | +| 10 | 5119 | 1 | 511 | 5119 | +| 10+ | 5119 | 0 | 511 | 5119 | +| 11 | 5119 | 0 | 511 | 5119 | +| 11 | 5119 | 0 | 472 | 4729 | +| 11 | 5119 | 0 | 511 | 5119 | +| 11+ | 5119 | 0 | 168 | 0 | +| 12 | 5119 | 0 | 168 | 0 | +| 12 | 5119 | 0 | 169 | 0 | +| 12 | 5119 | 0 | 170 | 0 | +| 12 | 5119 | 0 | 171 | 0 | +| 12 | 5119 | 0 | 172 | 0 | +| 12 | 5119 | 0 | 173 | 0 | +| 12 | 5119 | 0 | 174 | 0 | +| 12 | 5119 | 0 | 175 | 0 | +| 12+ | 21845 | 1 | 168 | 0 | +| 13 | 21845 | 1 | 168 | 21845 | +| 13+ | 21845 | 1 | 169 | 0 | +| 14 | 21845 | 1 | 169 | 21845 | +| 14+ | 21845 | 1 | 170 | 0 | +| 15 | 21845 | 1 | 170 | 21845 | +| 15+ | 21845 | 1 | 171 | 0 | +| 16 | 21845 | 1 | 171 | 21845 | +| 16+ | 21845 | 1 | 172 | 0 | +| 17 | 21845 | 1 | 172 | 21845 | +| 17+ | 21845 | 1 | 173 | 0 | +| 18 | 21845 | 1 | 173 | 21845 | +| 18+ | 21845 | 1 | 174 | 0 | +| 19 | 21845 | 1 | 174 | 21845 | +| 19+ | 21845 | 1 | 175 | 0 | +| 20 | 21845 | 1 | 175 | 21845 | +| 20+ | 21845 | 0 | 168 | 21845 | +| 21 | 21845 | 0 | 168 | 21845 | +| 21 | 21845 | 0 | 169 | 21845 | +| 21 | 21845 | 0 | 170 | 21845 | +| 21 | 21845 | 0 | 171 | 21845 | +| 21 | 21845 | 0 | 172 | 21845 | +| 21 | 21845 | 0 | 173 | 21845 | +| 21 | 21845 | 0 | 174 | 21845 | +| 21 | 21845 | 0 | 175 | 21845 | +| 21+ | -21846 | 1 | 168 | 21845 | +| 22 | -21846 | 1 | 168 | -21846 | +| 22+ | -21846 | 0 | 168 | -21846 | +| 23 | -21846 | 0 | 168 | -21846 | +| 23 | -21846 | 0 | 169 | 21845 | +| 23 | -21846 | 0 | 170 | 21845 | +| 23 | -21846 | 0 | 171 | 21845 | +| 23 | -21846 | 0 | 172 | 21845 | +| 23 | -21846 | 0 | 173 | 21845 | +| 23 | -21846 | 0 | 174 | 21845 | +| 23 | -21846 | 0 | 175 | 21845 | +| 23+ | 21845 | 1 | 168 | -21846 | +| 24 | 21845 | 1 | 168 | 21845 | +| 24+ | -21846 | 1 | 169 | 21845 | +| 25 | -21846 | 1 | 169 | -21846 | +| 25+ | -21846 | 0 | 168 | 21845 | +| 26 | -21846 | 0 | 168 | 21845 | +| 26 | -21846 | 0 | 169 | -21846 | +| 26 | -21846 | 0 | 170 | 21845 | +| 26 | -21846 | 0 | 171 | 21845 | +| 26 | -21846 | 0 | 172 | 21845 | +| 26 | -21846 | 0 | 173 | 21845 | +| 26 | -21846 | 0 | 174 | 21845 | +| 26 | -21846 | 0 | 175 | 21845 | +| 26+ | 21845 | 1 | 169 | -21846 | +| 27 | 21845 | 1 | 169 | 21845 | +| 27+ | -21846 | 1 | 170 | 21845 | +| 28 | -21846 | 1 | 170 | -21846 | +| 28+ | -21846 | 0 | 168 | 21845 | +| 29 | -21846 | 0 | 168 | 21845 | +| 29 | -21846 | 0 | 169 | 21845 | +| 29 | -21846 | 0 | 170 | -21846 | +| 29 | -21846 | 0 | 171 | 21845 | +| 29 | -21846 | 0 | 172 | 21845 | +| 29 | -21846 | 0 | 173 | 21845 | +| 29 | -21846 | 0 | 174 | 21845 | +| 29 | -21846 | 0 | 175 | 21845 | +| 29+ | 21845 | 1 | 170 | -21846 | +| 30 | 21845 | 1 | 170 | 21845 | +| 30+ | -21846 | 1 | 171 | 21845 | +| 31 | -21846 | 1 | 171 | -21846 | +| 31+ | -21846 | 0 | 168 | 21845 | +| 32 | -21846 | 0 | 168 | 21845 | +| 32 | -21846 | 0 | 169 | 21845 | +| 32 | -21846 | 0 | 170 | 21845 | +| 32 | -21846 | 0 | 171 | -21846 | +| 32 | -21846 | 0 | 172 | 21845 | +| 32 | -21846 | 0 | 173 | 21845 | +| 32 | -21846 | 0 | 174 | 21845 | +| 32 | -21846 | 0 | 175 | 21845 | +| 32+ | 21845 | 1 | 171 | -21846 | +| 33 | 21845 | 1 | 171 | 21845 | +| 33+ | -21846 | 1 | 172 | 21845 | +| 34 | -21846 | 1 | 172 | -21846 | +| 34+ | -21846 | 0 | 168 | 21845 | +| 35 | -21846 | 0 | 168 | 21845 | +| 35 | -21846 | 0 | 169 | 21845 | +| 35 | -21846 | 0 | 170 | 21845 | +| 35 | -21846 | 0 | 171 | 21845 | +| 35 | -21846 | 0 | 172 | -21846 | +| 35 | -21846 | 0 | 173 | 21845 | +| 35 | -21846 | 0 | 174 | 21845 | +| 35 | -21846 | 0 | 175 | 21845 | +| 35+ | 21845 | 1 | 172 | -21846 | +| 36 | 21845 | 1 | 172 | 21845 | +| 36+ | -21846 | 1 | 173 | 21845 | +| 37 | -21846 | 1 | 173 | -21846 | +| 37+ | -21846 | 0 | 168 | 21845 | +| 38 | -21846 | 0 | 168 | 21845 | +| 38 | -21846 | 0 | 169 | 21845 | +| 38 | -21846 | 0 | 170 | 21845 | +| 38 | -21846 | 0 | 171 | 21845 | +| 38 | -21846 | 0 | 172 | 21845 | +| 38 | -21846 | 0 | 173 | -21846 | +| 38 | -21846 | 0 | 174 | 21845 | +| 38 | -21846 | 0 | 175 | 21845 | +| 38+ | 21845 | 1 | 173 | -21846 | +| 39 | 21845 | 1 | 173 | 21845 | +| 39+ | -21846 | 1 | 174 | 21845 | +| 40 | -21846 | 1 | 174 | -21846 | +| 40+ | -21846 | 0 | 168 | 21845 | +| 41 | -21846 | 0 | 168 | 21845 | +| 41 | -21846 | 0 | 169 | 21845 | +| 41 | -21846 | 0 | 170 | 21845 | +| 41 | -21846 | 0 | 171 | 21845 | +| 41 | -21846 | 0 | 172 | 21845 | +| 41 | -21846 | 0 | 173 | 21845 | +| 41 | -21846 | 0 | 174 | -21846 | +| 41 | -21846 | 0 | 175 | 21845 | +| 41+ | 21845 | 1 | 174 | -21846 | +| 42 | 21845 | 1 | 174 | 21845 | +| 42+ | -21846 | 1 | 175 | 21845 | +| 43 | -21846 | 1 | 175 | -21846 | +| 43+ | -21846 | 0 | 168 | 21845 | +| 44 | -21846 | 0 | 168 | 21845 | +| 44 | -21846 | 0 | 169 | 21845 | +| 44 | -21846 | 0 | 170 | 21845 | +| 44 | -21846 | 0 | 171 | 21845 | +| 44 | -21846 | 0 | 172 | 21845 | +| 44 | -21846 | 0 | 173 | 21845 | +| 44 | -21846 | 0 | 174 | 21845 | +| 44 | -21846 | 0 | 175 | -21846 | +| 44+ | 21845 | 1 | 175 | -21846 | +| 45 | 21845 | 1 | 175 | 21845 | +| 45+ | 21845 | 0 | 168 | 21845 | +| 46 | 21845 | 0 | 168 | 21845 | +| 46 | 21845 | 0 | 169 | 21845 | +| 46 | 21845 | 0 | 170 | 21845 | +| 46 | 21845 | 0 | 171 | 21845 | +| 46 | 21845 | 0 | 172 | 21845 | +| 46 | 21845 | 0 | 173 | 21845 | +| 46 | 21845 | 0 | 174 | 21845 | +| 46 | 21845 | 0 | 175 | 21845 | +| 46+ | 21845 | 0 | 42 | 0 | +| 47 | 21845 | 0 | 42 | 0 | +| 47 | 21845 | 0 | 106 | 0 | +| 47 | 21845 | 0 | 170 | 21845 | +| 47 | 21845 | 0 | 234 | 0 | +| 47 | 21845 | 0 | 298 | 0 | +| 47 | 21845 | 0 | 362 | 0 | +| 47 | 21845 | 0 | 426 | 0 | +| 47 | 21845 | 0 | 490 | 0 | +| 47+ | 21845 | 1 | 42 | 0 | +| 48 | 21845 | 1 | 42 | 21845 | +| 48+ | 21845 | 1 | 106 | 0 | +| 49 | 21845 | 1 | 106 | 21845 | +| 49+ | 21845 | 1 | 170 | 21845 | +| 50 | 21845 | 1 | 170 | 21845 | +| 50+ | 21845 | 1 | 234 | 0 | +| 51 | 21845 | 1 | 234 | 21845 | +| 51+ | 21845 | 1 | 298 | 0 | +| 52 | 21845 | 1 | 298 | 21845 | +| 52+ | 21845 | 1 | 362 | 0 | +| 53 | 21845 | 1 | 362 | 21845 | +| 53+ | 21845 | 1 | 426 | 0 | +| 54 | 21845 | 1 | 426 | 21845 | +| 54+ | 21845 | 1 | 490 | 0 | +| 55 | 21845 | 1 | 490 | 21845 | +| 55+ | 21845 | 0 | 42 | 21845 | +| 56 | 21845 | 0 | 42 | 21845 | +| 56 | 21845 | 0 | 106 | 21845 | +| 56 | 21845 | 0 | 170 | 21845 | +| 56 | 21845 | 0 | 234 | 21845 | +| 56 | 21845 | 0 | 298 | 21845 | +| 56 | 21845 | 0 | 362 | 21845 | +| 56 | 21845 | 0 | 426 | 21845 | +| 56 | 21845 | 0 | 490 | 21845 | +| 56+ | -21846 | 1 | 42 | 21845 | +| 57 | -21846 | 1 | 42 | -21846 | +| 57+ | -21846 | 0 | 42 | -21846 | +| 58 | -21846 | 0 | 42 | -21846 | +| 58 | -21846 | 0 | 106 | 21845 | +| 58 | -21846 | 0 | 170 | 21845 | +| 58 | -21846 | 0 | 234 | 21845 | +| 58 | -21846 | 0 | 298 | 21845 | +| 58 | -21846 | 0 | 362 | 21845 | +| 58 | -21846 | 0 | 426 | 21845 | +| 58 | -21846 | 0 | 490 | 21845 | +| 58+ | 21845 | 1 | 42 | -21846 | +| 59 | 21845 | 1 | 42 | 21845 | +| 59+ | -21846 | 1 | 106 | 21845 | +| 60 | -21846 | 1 | 106 | -21846 | +| 60+ | -21846 | 0 | 42 | 21845 | +| 61 | -21846 | 0 | 42 | 21845 | +| 61 | -21846 | 0 | 106 | -21846 | +| 61 | -21846 | 0 | 170 | 21845 | +| 61 | -21846 | 0 | 234 | 21845 | +| 61 | -21846 | 0 | 298 | 21845 | +| 61 | -21846 | 0 | 362 | 21845 | +| 61 | -21846 | 0 | 426 | 21845 | +| 61 | -21846 | 0 | 490 | 21845 | +| 61+ | 21845 | 1 | 106 | -21846 | +| 62 | 21845 | 1 | 106 | 21845 | +| 62+ | -21846 | 1 | 170 | 21845 | +| 63 | -21846 | 1 | 170 | -21846 | +| 63+ | -21846 | 0 | 42 | 21845 | +| 64 | -21846 | 0 | 42 | 21845 | +| 64 | -21846 | 0 | 106 | 21845 | +| 64 | -21846 | 0 | 170 | -21846 | +| 64 | -21846 | 0 | 234 | 21845 | +| 64 | -21846 | 0 | 298 | 21845 | +| 64 | -21846 | 0 | 362 | 21845 | +| 64 | -21846 | 0 | 426 | 21845 | +| 64 | -21846 | 0 | 490 | 21845 | +| 64+ | 21845 | 1 | 170 | -21846 | +| 65 | 21845 | 1 | 170 | 21845 | +| 65+ | -21846 | 1 | 234 | 21845 | +| 66 | -21846 | 1 | 234 | -21846 | +| 66+ | -21846 | 0 | 42 | 21845 | +| 67 | -21846 | 0 | 42 | 21845 | +| 67 | -21846 | 0 | 106 | 21845 | +| 67 | -21846 | 0 | 170 | 21845 | +| 67 | -21846 | 0 | 234 | -21846 | +| 67 | -21846 | 0 | 298 | 21845 | +| 67 | -21846 | 0 | 362 | 21845 | +| 67 | -21846 | 0 | 426 | 21845 | +| 67 | -21846 | 0 | 490 | 21845 | +| 67+ | 21845 | 1 | 234 | -21846 | +| 68 | 21845 | 1 | 234 | 21845 | +| 68+ | -21846 | 1 | 298 | 21845 | +| 69 | -21846 | 1 | 298 | -21846 | +| 69+ | -21846 | 0 | 42 | 21845 | +| 70 | -21846 | 0 | 42 | 21845 | +| 70 | -21846 | 0 | 106 | 21845 | +| 70 | -21846 | 0 | 170 | 21845 | +| 70 | -21846 | 0 | 234 | 21845 | +| 70 | -21846 | 0 | 298 | -21846 | +| 70 | -21846 | 0 | 362 | 21845 | +| 70 | -21846 | 0 | 426 | 21845 | +| 70 | -21846 | 0 | 490 | 21845 | +| 70+ | 21845 | 1 | 298 | -21846 | +| 71 | 21845 | 1 | 298 | 21845 | +| 71+ | -21846 | 1 | 362 | 21845 | +| 72 | -21846 | 1 | 362 | -21846 | +| 72+ | -21846 | 0 | 42 | 21845 | +| 73 | -21846 | 0 | 42 | 21845 | +| 73 | -21846 | 0 | 106 | 21845 | +| 73 | -21846 | 0 | 170 | 21845 | +| 73 | -21846 | 0 | 234 | 21845 | +| 73 | -21846 | 0 | 298 | 21845 | +| 73 | -21846 | 0 | 362 | -21846 | +| 73 | -21846 | 0 | 426 | 21845 | +| 73 | -21846 | 0 | 490 | 21845 | +| 73+ | 21845 | 1 | 362 | -21846 | +| 74 | 21845 | 1 | 362 | 21845 | +| 74+ | -21846 | 1 | 426 | 21845 | +| 75 | -21846 | 1 | 426 | -21846 | +| 75+ | -21846 | 0 | 42 | 21845 | +| 76 | -21846 | 0 | 42 | 21845 | +| 76 | -21846 | 0 | 106 | 21845 | +| 76 | -21846 | 0 | 170 | 21845 | +| 76 | -21846 | 0 | 234 | 21845 | +| 76 | -21846 | 0 | 298 | 21845 | +| 76 | -21846 | 0 | 362 | 21845 | +| 76 | -21846 | 0 | 426 | -21846 | +| 76 | -21846 | 0 | 490 | 21845 | +| 76+ | 21845 | 1 | 426 | -21846 | +| 77 | 21845 | 1 | 426 | 21845 | +| 77+ | -21846 | 1 | 490 | 21845 | +| 78 | -21846 | 1 | 490 | -21846 | +| 78+ | -21846 | 0 | 42 | 21845 | +| 79 | -21846 | 0 | 42 | 21845 | +| 79 | -21846 | 0 | 106 | 21845 | +| 79 | -21846 | 0 | 170 | 21845 | +| 79 | -21846 | 0 | 234 | 21845 | +| 79 | -21846 | 0 | 298 | 21845 | +| 79 | -21846 | 0 | 362 | 21845 | +| 79 | -21846 | 0 | 426 | 21845 | +| 79 | -21846 | 0 | 490 | -21846 | +| 79+ | 21845 | 1 | 490 | -21846 | +| 80 | 21845 | 1 | 490 | 21845 | +| 80+ | 21845 | 0 | 42 | 21845 | +| 81 | 21845 | 0 | 42 | 21845 | +| 81 | 21845 | 0 | 106 | 21845 | +| 81 | 21845 | 0 | 170 | 21845 | +| 81 | 21845 | 0 | 234 | 21845 | +| 81 | 21845 | 0 | 298 | 21845 | +| 81 | 21845 | 0 | 362 | 21845 | +| 81 | 21845 | 0 | 426 | 21845 | +| 81 | 21845 | 0 | 490 | 21845 | diff --git a/projects/03/b/RAM512.hdl b/projects/03/b/RAM512.hdl new file mode 100644 index 0000000..6c40f28 --- /dev/null +++ b/projects/03/b/RAM512.hdl @@ -0,0 +1,19 @@ +// 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: projects/03/b/RAM512.hdl + +/** + * Memory of 512 registers, each 16 bit-wide. Out holds the value + * stored at the memory location specified by address. If load==1, then + * the in value is loaded into the memory location specified by address + * (the loaded value will be emitted to out from the next time step onward). + */ + +CHIP RAM512 { + IN in[16], load, address[9]; + OUT out[16]; + + PARTS: + // Put your code here: +} \ No newline at end of file diff --git a/projects/03/b/RAM512.tst b/projects/03/b/RAM512.tst new file mode 100644 index 0000000..4ec6fc2 --- /dev/null +++ b/projects/03/b/RAM512.tst @@ -0,0 +1,1027 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/03/b/RAM512.tst + +load RAM512.hdl, +output-file RAM512.out, +compare-to RAM512.cmp, +output-list time%S1.4.1 in%D1.6.1 load%B2.1.2 address%D2.3.2 out%D1.6.1; + +set in 0, +set load 0, +set address 0, +tick, +output; +tock, +output; + +set load 1, +tick, +output; +tock, +output; + +set in 13099, +set load 0, +tick, +output; +tock, +output; + +set load 1, +set address 130, +tick, +output; +tock, +output; + +set load 0, +set address 0, +tick, +output; +tock, +output; + +set in 4729, +set address 472, +tick, +output; +tock, +output; + +set load 1, +tick, +output; +tock, +output; + +set load 0, +tick, +output; +tock, +output; + +set address 130, +eval, +output; + +set in 5119, +tick, +output; +tock, +output; + +set load 1, +set address 511, +tick, +output; +tock, +output; + +set load 0, +tick, +output; +tock, +output; + +set address 472, +eval, +output; + +set address 511, +eval, +output; + + +set load 0, +set address %B010101000, +tick, +output; +tock, +output; +set address %B010101001, +eval, +output; +set address %B010101010, +eval, +output; +set address %B010101011, +eval, +output; +set address %B010101100, +eval, +output; +set address %B010101101, +eval, +output; +set address %B010101110, +eval, +output; +set address %B010101111, +eval, +output; + +set load 1, +set in %B0101010101010101, +set address %B010101000, +tick, +output; +tock, +output; +set address %B010101001, +tick, +output, +tock, +output; +set address %B010101010, +tick, +output, +tock, +output; +set address %B010101011, +tick, +output, +tock, +output; +set address %B010101100, +tick, +output, +tock, +output; +set address %B010101101, +tick, +output, +tock, +output; +set address %B010101110, +tick, +output, +tock, +output; +set address %B010101111, +tick, +output, +tock, +output; + +set load 0, +set address %B010101000, +tick, +output; +tock, +output; +set address %B010101001, +eval, +output; +set address %B010101010, +eval, +output; +set address %B010101011, +eval, +output; +set address %B010101100, +eval, +output; +set address %B010101101, +eval, +output; +set address %B010101110, +eval, +output; +set address %B010101111, +eval, +output; + +set load 1, +set address %B010101000, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B010101000, +tick, +output; +tock, +output; +set address %B010101001, +eval, +output; +set address %B010101010, +eval, +output; +set address %B010101011, +eval, +output; +set address %B010101100, +eval, +output; +set address %B010101101, +eval, +output; +set address %B010101110, +eval, +output; +set address %B010101111, +eval, +output; + +set load 1, +set address %B010101000, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B010101001, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B010101000, +tick, +output; +tock, +output; +set address %B010101001, +eval, +output; +set address %B010101010, +eval, +output; +set address %B010101011, +eval, +output; +set address %B010101100, +eval, +output; +set address %B010101101, +eval, +output; +set address %B010101110, +eval, +output; +set address %B010101111, +eval, +output; + +set load 1, +set address %B010101001, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B010101010, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B010101000, +tick, +output; +tock, +output; +set address %B010101001, +eval, +output; +set address %B010101010, +eval, +output; +set address %B010101011, +eval, +output; +set address %B010101100, +eval, +output; +set address %B010101101, +eval, +output; +set address %B010101110, +eval, +output; +set address %B010101111, +eval, +output; + +set load 1, +set address %B010101010, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B010101011, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B010101000, +tick, +output; +tock, +output; +set address %B010101001, +eval, +output; +set address %B010101010, +eval, +output; +set address %B010101011, +eval, +output; +set address %B010101100, +eval, +output; +set address %B010101101, +eval, +output; +set address %B010101110, +eval, +output; +set address %B010101111, +eval, +output; + +set load 1, +set address %B010101011, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B010101100, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B010101000, +tick, +output; +tock, +output; +set address %B010101001, +eval, +output; +set address %B010101010, +eval, +output; +set address %B010101011, +eval, +output; +set address %B010101100, +eval, +output; +set address %B010101101, +eval, +output; +set address %B010101110, +eval, +output; +set address %B010101111, +eval, +output; + +set load 1, +set address %B010101100, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B010101101, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B010101000, +tick, +output; +tock, +output; +set address %B010101001, +eval, +output; +set address %B010101010, +eval, +output; +set address %B010101011, +eval, +output; +set address %B010101100, +eval, +output; +set address %B010101101, +eval, +output; +set address %B010101110, +eval, +output; +set address %B010101111, +eval, +output; + +set load 1, +set address %B010101101, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B010101110, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B010101000, +tick, +output; +tock, +output; +set address %B010101001, +eval, +output; +set address %B010101010, +eval, +output; +set address %B010101011, +eval, +output; +set address %B010101100, +eval, +output; +set address %B010101101, +eval, +output; +set address %B010101110, +eval, +output; +set address %B010101111, +eval, +output; + +set load 1, +set address %B010101110, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B010101111, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B010101000, +tick, +output; +tock, +output; +set address %B010101001, +eval, +output; +set address %B010101010, +eval, +output; +set address %B010101011, +eval, +output; +set address %B010101100, +eval, +output; +set address %B010101101, +eval, +output; +set address %B010101110, +eval, +output; +set address %B010101111, +eval, +output; + +set load 1, +set address %B010101111, +set in %B0101010101010101, +tick, +output, +tock, +output; + +set load 0, +set address %B010101000, +tick, +output; +tock, +output; +set address %B010101001, +eval, +output; +set address %B010101010, +eval, +output; +set address %B010101011, +eval, +output; +set address %B010101100, +eval, +output; +set address %B010101101, +eval, +output; +set address %B010101110, +eval, +output; +set address %B010101111, +eval, +output; + + +set load 0, +set address %B000101010, +tick, +output; +tock, +output; +set address %B001101010, +eval, +output; +set address %B010101010, +eval, +output; +set address %B011101010, +eval, +output; +set address %B100101010, +eval, +output; +set address %B101101010, +eval, +output; +set address %B110101010, +eval, +output; +set address %B111101010, +eval, +output; + +set load 1, +set in %B0101010101010101, +set address %B000101010, +tick, +output; +tock, +output; +set address %B001101010, +tick, +output, +tock, +output; +set address %B010101010, +tick, +output, +tock, +output; +set address %B011101010, +tick, +output, +tock, +output; +set address %B100101010, +tick, +output, +tock, +output; +set address %B101101010, +tick, +output, +tock, +output; +set address %B110101010, +tick, +output, +tock, +output; +set address %B111101010, +tick, +output, +tock, +output; + +set load 0, +set address %B000101010, +tick, +output; +tock, +output; +set address %B001101010, +eval, +output; +set address %B010101010, +eval, +output; +set address %B011101010, +eval, +output; +set address %B100101010, +eval, +output; +set address %B101101010, +eval, +output; +set address %B110101010, +eval, +output; +set address %B111101010, +eval, +output; + +set load 1, +set address %B000101010, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101010, +tick, +output; +tock, +output; +set address %B001101010, +eval, +output; +set address %B010101010, +eval, +output; +set address %B011101010, +eval, +output; +set address %B100101010, +eval, +output; +set address %B101101010, +eval, +output; +set address %B110101010, +eval, +output; +set address %B111101010, +eval, +output; + +set load 1, +set address %B000101010, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B001101010, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101010, +tick, +output; +tock, +output; +set address %B001101010, +eval, +output; +set address %B010101010, +eval, +output; +set address %B011101010, +eval, +output; +set address %B100101010, +eval, +output; +set address %B101101010, +eval, +output; +set address %B110101010, +eval, +output; +set address %B111101010, +eval, +output; + +set load 1, +set address %B001101010, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B010101010, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101010, +tick, +output; +tock, +output; +set address %B001101010, +eval, +output; +set address %B010101010, +eval, +output; +set address %B011101010, +eval, +output; +set address %B100101010, +eval, +output; +set address %B101101010, +eval, +output; +set address %B110101010, +eval, +output; +set address %B111101010, +eval, +output; + +set load 1, +set address %B010101010, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B011101010, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101010, +tick, +output; +tock, +output; +set address %B001101010, +eval, +output; +set address %B010101010, +eval, +output; +set address %B011101010, +eval, +output; +set address %B100101010, +eval, +output; +set address %B101101010, +eval, +output; +set address %B110101010, +eval, +output; +set address %B111101010, +eval, +output; + +set load 1, +set address %B011101010, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B100101010, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101010, +tick, +output; +tock, +output; +set address %B001101010, +eval, +output; +set address %B010101010, +eval, +output; +set address %B011101010, +eval, +output; +set address %B100101010, +eval, +output; +set address %B101101010, +eval, +output; +set address %B110101010, +eval, +output; +set address %B111101010, +eval, +output; + +set load 1, +set address %B100101010, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B101101010, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101010, +tick, +output; +tock, +output; +set address %B001101010, +eval, +output; +set address %B010101010, +eval, +output; +set address %B011101010, +eval, +output; +set address %B100101010, +eval, +output; +set address %B101101010, +eval, +output; +set address %B110101010, +eval, +output; +set address %B111101010, +eval, +output; + +set load 1, +set address %B101101010, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B110101010, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101010, +tick, +output; +tock, +output; +set address %B001101010, +eval, +output; +set address %B010101010, +eval, +output; +set address %B011101010, +eval, +output; +set address %B100101010, +eval, +output; +set address %B101101010, +eval, +output; +set address %B110101010, +eval, +output; +set address %B111101010, +eval, +output; + +set load 1, +set address %B110101010, +set in %B0101010101010101, +tick, +output, +tock, +output; +set address %B111101010, +set in %B1010101010101010, +tick, +output; +tock, +output; + +set load 0, +set address %B000101010, +tick, +output; +tock, +output; +set address %B001101010, +eval, +output; +set address %B010101010, +eval, +output; +set address %B011101010, +eval, +output; +set address %B100101010, +eval, +output; +set address %B101101010, +eval, +output; +set address %B110101010, +eval, +output; +set address %B111101010, +eval, +output; + +set load 1, +set address %B111101010, +set in %B0101010101010101, +tick, +output, +tock, +output; + +set load 0, +set address %B000101010, +tick, +output; +tock, +output; +set address %B001101010, +eval, +output; +set address %B010101010, +eval, +output; +set address %B011101010, +eval, +output; +set address %B100101010, +eval, +output; +set address %B101101010, +eval, +output; +set address %B110101010, +eval, +output; +set address %B111101010, +eval, +output; + diff --git a/projects/04/fill/Fill.asm b/projects/04/fill/Fill.asm new file mode 100644 index 0000000..8f24a95 --- /dev/null +++ b/projects/04/fill/Fill.asm @@ -0,0 +1,14 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/04/Fill.asm + +// Runs an infinite loop that listens to the keyboard input. +// When a key is pressed (any key), the program blackens the screen, +// i.e. writes "black" in every pixel; +// the screen should remain fully black as long as the key is pressed. +// When no key is pressed, the program clears the screen, i.e. writes +// "white" in every pixel; +// the screen should remain fully clear as long as no key is pressed. + +// Put your code here. \ No newline at end of file diff --git a/projects/04/fill/Fill.tst b/projects/04/fill/Fill.tst new file mode 100644 index 0000000..149bfee --- /dev/null +++ b/projects/04/fill/Fill.tst @@ -0,0 +1,11 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/04/fill/Fill.tst + +load Fill.hack; +echo "Make sure that 'No Animation' is selected. Then, select the keyboard, press any key for some time, and inspect the screen."; + +repeat { + ticktock; +} diff --git a/projects/04/fill/FillAutomatic.cmp b/projects/04/fill/FillAutomatic.cmp new file mode 100644 index 0000000..a71db27 --- /dev/null +++ b/projects/04/fill/FillAutomatic.cmp @@ -0,0 +1,4 @@ +|RAM[16384]|RAM[17648]|RAM[18349]|RAM[19444]|RAM[20771]|RAM[21031]|RAM[22596]|RAM[23754]|RAM[24575]| +| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | -1 | +| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | diff --git a/projects/04/fill/FillAutomatic.tst b/projects/04/fill/FillAutomatic.tst new file mode 100644 index 0000000..90bfef9 --- /dev/null +++ b/projects/04/fill/FillAutomatic.tst @@ -0,0 +1,37 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/04/fill/FillAutomatic + +// This script can be used to test the Fill program automatically, +// rather than interactively. Specifically, the script sets the keyboard +// memory map (RAM[24576]) to 0, 1, and then again to 0. This simulates the +// acts of leaving the keyboard untouched, pressing some key, and then releasing +// the key. After each on of these simulated events, the script outputs the values +// of some selected registers from the screen memory map (RAM[16384]-RAM[24576]). +// This is done in order to test that these registers are set to 000...0 or 111....1, +// as mandated by how the Fill program should react to the keyboard events. + +load Fill.hack, +output-file FillAutomatic.out, +compare-to FillAutomatic.cmp, +output-list RAM[16384]%D2.6.2 RAM[17648]%D2.6.2 RAM[18349]%D2.6.2 RAM[19444]%D2.6.2 RAM[20771]%D2.6.2 RAM[21031]%D2.6.2 RAM[22596]%D2.6.2 RAM[23754]%D2.6.2 RAM[24575]%D2.6.2; + +set RAM[24576] 0, // the keyboard is untouched +repeat 1000000 { + ticktock; +} +output; // test that the screen is white + +set RAM[24576] 1, // a keyboard key is pressed +repeat 1000000 { + ticktock; +} +output; // test that the screen is black + +set RAM[24576] 0, // they keyboard in untouched +repeat 1000000 { + ticktock; +} +output; // test that the screen is white + diff --git a/projects/04/mult/Mult.cmp b/projects/04/mult/Mult.cmp new file mode 100644 index 0000000..296b5fb --- /dev/null +++ b/projects/04/mult/Mult.cmp @@ -0,0 +1,7 @@ +| RAM[0] | RAM[1] | RAM[2] | +| 0 | 0 | 0 | +| 1 | 0 | 0 | +| 0 | 2 | 0 | +| 3 | 1 | 3 | +| 2 | 4 | 8 | +| 6 | 7 | 42 | \ No newline at end of file diff --git a/projects/04/mult/Mult.tst b/projects/04/mult/Mult.tst new file mode 100644 index 0000000..f877664 --- /dev/null +++ b/projects/04/mult/Mult.tst @@ -0,0 +1,74 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/04/mult/Mult.tst + +load Mult.hack, +output-file Mult.out, +compare-to Mult.cmp, +output-list RAM[0]%D2.6.2 RAM[1]%D2.6.2 RAM[2]%D2.6.2; + +set RAM[0] 0, // Set test arguments +set RAM[1] 0, +set RAM[2] -1; // Test that program initialized product to 0 +repeat 20 { + ticktock; +} +set RAM[0] 0, // Restore arguments in case program used them as loop counter +set RAM[1] 0, +output; + +set PC 0, +set RAM[0] 1, // Set test arguments +set RAM[1] 0, +set RAM[2] -1; // Ensure that program initialized product to 0 +repeat 50 { + ticktock; +} +set RAM[0] 1, // Restore arguments in case program used them as loop counter +set RAM[1] 0, +output; + +set PC 0, +set RAM[0] 0, // Set test arguments +set RAM[1] 2, +set RAM[2] -1; // Ensure that program initialized product to 0 +repeat 80 { + ticktock; +} +set RAM[0] 0, // Restore arguments in case program used them as loop counter +set RAM[1] 2, +output; + +set PC 0, +set RAM[0] 3, // Set test arguments +set RAM[1] 1, +set RAM[2] -1; // Ensure that program initialized product to 0 +repeat 120 { + ticktock; +} +set RAM[0] 3, // Restore arguments in case program used them as loop counter +set RAM[1] 1, +output; + +set PC 0, +set RAM[0] 2, // Set test arguments +set RAM[1] 4, +set RAM[2] -1; // Ensure that program initialized product to 0 +repeat 150 { + ticktock; +} +set RAM[0] 2, // Restore arguments in case program used them as loop counter +set RAM[1] 4, +output; + +set PC 0, +set RAM[0] 6, // Set test arguments +set RAM[1] 7, +set RAM[2] -1; // Ensure that program initialized product to 0 +repeat 210 { + ticktock; +} +set RAM[0] 6, // Restore arguments in case program used them as loop counter +set RAM[1] 7, +output; diff --git a/projects/04/mult/mult.asm b/projects/04/mult/mult.asm new file mode 100644 index 0000000..b44440a --- /dev/null +++ b/projects/04/mult/mult.asm @@ -0,0 +1,9 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/04/Mult.asm + +// Multiplies R0 and R1 and stores the result in R2. +// (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.) + +// Put your code here. \ No newline at end of file diff --git a/projects/05/Add.hack b/projects/05/Add.hack new file mode 100644 index 0000000..fe5969d --- /dev/null +++ b/projects/05/Add.hack @@ -0,0 +1,6 @@ +0000000000000010 +1110110000010000 +0000000000000011 +1110000010010000 +0000000000000000 +1110001100001000 diff --git a/projects/05/CPU-external.cmp b/projects/05/CPU-external.cmp new file mode 100644 index 0000000..58f43bd --- /dev/null +++ b/projects/05/CPU-external.cmp @@ -0,0 +1,93 @@ +|time| inM | instruction |reset| outM |writeM |addre| pc | +|0+ | 0|0011000000111001| 0 |*******| 0 | 0| 0| +|1 | 0|0011000000111001| 0 |*******| 0 |12345| 1| +|1+ | 0|1110110000010000| 0 |*******| 0 |12345| 1| +|2 | 0|1110110000010000| 0 |*******| 0 |12345| 2| +|2+ | 0|0101101110100000| 0 |*******| 0 |12345| 2| +|3 | 0|0101101110100000| 0 |*******| 0 |23456| 3| +|3+ | 0|1110000111010000| 0 |*******| 0 |23456| 3| +|4 | 0|1110000111010000| 0 |*******| 0 |23456| 4| +|4+ | 0|0000001111101000| 0 |*******| 0 |23456| 4| +|5 | 0|0000001111101000| 0 |*******| 0 | 1000| 5| +|5+ | 0|1110001100001000| 0 | 11111| 1 | 1000| 5| +|6 | 0|1110001100001000| 0 | 11111| 1 | 1000| 6| +|6+ | 0|0000001111101001| 0 |*******| 0 | 1000| 6| +|7 | 0|0000001111101001| 0 |*******| 0 | 1001| 7| +|7+ | 0|1110001110011000| 0 | 11110| 1 | 1001| 7| +|8 | 0|1110001110011000| 0 | 11109| 1 | 1001| 8| +|8+ | 0|0000001111101000| 0 |*******| 0 | 1001| 8| +|9 | 0|0000001111101000| 0 |*******| 0 | 1000| 9| +|9+ | 11111|1111010011010000| 0 |*******| 0 | 1000| 9| +|10 | 11111|1111010011010000| 0 |*******| 0 | 1000| 10| +|10+ | 11111|0000000000001110| 0 |*******| 0 | 1000| 10| +|11 | 11111|0000000000001110| 0 |*******| 0 | 14| 11| +|11+ | 11111|1110001100000100| 0 |*******| 0 | 14| 11| +|12 | 11111|1110001100000100| 0 |*******| 0 | 14| 14| +|12+ | 11111|0000001111100111| 0 |*******| 0 | 14| 14| +|13 | 11111|0000001111100111| 0 |*******| 0 | 999| 15| +|13+ | 11111|1110110111100000| 0 |*******| 0 | 999| 15| +|14 | 11111|1110110111100000| 0 |*******| 0 | 1000| 16| +|14+ | 11111|1110001100001000| 0 | -1| 1 | 1000| 16| +|15 | 11111|1110001100001000| 0 | -1| 1 | 1000| 17| +|15+ | 11111|0000000000010101| 0 |*******| 0 | 1000| 17| +|16 | 11111|0000000000010101| 0 |*******| 0 | 21| 18| +|16+ | 11111|1110011111000010| 0 |*******| 0 | 21| 18| +|17 | 11111|1110011111000010| 0 |*******| 0 | 21| 21| +|17+ | 11111|0000000000000010| 0 |*******| 0 | 21| 21| +|18 | 11111|0000000000000010| 0 |*******| 0 | 2| 22| +|18+ | 11111|1110000010010000| 0 |*******| 0 | 2| 22| +|19 | 11111|1110000010010000| 0 |*******| 0 | 2| 23| +|19+ | 11111|0000001111101000| 0 |*******| 0 | 2| 23| +|20 | 11111|0000001111101000| 0 |*******| 0 | 1000| 24| +|20+ | 11111|1110111010010000| 0 |*******| 0 | 1000| 24| +|21 | 11111|1110111010010000| 0 |*******| 0 | 1000| 25| +|21+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 25| +|22 | 11111|1110001100000001| 0 |*******| 0 | 1000| 26| +|22+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 26| +|23 | 11111|1110001100000010| 0 |*******| 0 | 1000| 27| +|23+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 27| +|24 | 11111|1110001100000011| 0 |*******| 0 | 1000| 28| +|24+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 28| +|25 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| +|25+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| +|26 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| +|26+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| +|27 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| +|27+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| +|28 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| +|28+ | 11111|1110101010010000| 0 |*******| 0 | 1000| 1000| +|29 | 11111|1110101010010000| 0 |*******| 0 | 1000| 1001| +|29+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 1001| +|30 | 11111|1110001100000001| 0 |*******| 0 | 1000| 1002| +|30+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 1002| +|31 | 11111|1110001100000010| 0 |*******| 0 | 1000| 1000| +|31+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| +|32 | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| +|32+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| +|33 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1001| +|33+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1001| +|34 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1002| +|34+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1002| +|35 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| +|35+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| +|36 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| +|36+ | 11111|1110111111010000| 0 |*******| 0 | 1000| 1000| +|37 | 11111|1110111111010000| 0 |*******| 0 | 1000| 1001| +|37+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 1001| +|38 | 11111|1110001100000001| 0 |*******| 0 | 1000| 1000| +|38+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 1000| +|39 | 11111|1110001100000010| 0 |*******| 0 | 1000| 1001| +|39+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 1001| +|40 | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| +|40+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| +|41 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1001| +|41+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1001| +|42 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| +|42+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| +|43 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1001| +|43+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1001| +|44 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| +|44+ | 11111|1110001100000111| 1 |*******| 0 | 1000| 1000| +|45 | 11111|1110001100000111| 1 |*******| 0 | 1000| 0| +|45+ | 11111|0111111111111111| 0 |*******| 0 | 1000| 0| +|46 | 11111|0111111111111111| 0 |*******| 0 |32767| 1| diff --git a/projects/05/CPU-external.tst b/projects/05/CPU-external.tst new file mode 100644 index 0000000..5aa0295 --- /dev/null +++ b/projects/05/CPU-external.tst @@ -0,0 +1,150 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/05/CPU-external.tst + +load CPU.hdl, +output-file CPU-external.out, +compare-to CPU-external.cmp, +output-list time%S0.4.0 inM%D0.6.0 instruction%B0.16.0 reset%B2.1.2 outM%D1.6.0 writeM%B3.1.3 addressM%D0.5.0 pc%D0.5.0; + + +set instruction %B0011000000111001, // @12345 +tick, output, tock, output; + +set instruction %B1110110000010000, // D=A +tick, output, tock, output; + +set instruction %B0101101110100000, // @23456 +tick, output, tock, output; + +set instruction %B1110000111010000, // D=A-D +tick, output, tock, output; + +set instruction %B0000001111101000, // @1000 +tick, output, tock, output; + +set instruction %B1110001100001000, // M=D +tick, output, tock, output; + +set instruction %B0000001111101001, // @1001 +tick, output, tock, output; + +set instruction %B1110001110011000, // MD=D-1 +tick, output, tock, output; + +set instruction %B0000001111101000, // @1000 +tick, output, tock, output; + +set instruction %B1111010011010000, // D=D-M +set inM 11111, +tick, output, tock, output; + +set instruction %B0000000000001110, // @14 +tick, output, tock, output; + +set instruction %B1110001100000100, // D;jlt +tick, output, tock, output; + +set instruction %B0000001111100111, // @999 +tick, output, tock, output; + +set instruction %B1110110111100000, // A=A+1 +tick, output, tock, output; + +set instruction %B1110001100001000, // M=D +tick, output, tock, output; + +set instruction %B0000000000010101, // @21 +tick, output, tock, output; + +set instruction %B1110011111000010, // D+1;jeq +tick, output, tock, output; + +set instruction %B0000000000000010, // @2 +tick, output, tock, output; + +set instruction %B1110000010010000, // D=D+A +tick, output, tock, output; + +set instruction %B0000001111101000, // @1000 +tick, output, tock, output; + +set instruction %B1110111010010000, // D=-1 +tick, output, tock, output; + +set instruction %B1110001100000001, // D;JGT +tick, output, tock, output; + +set instruction %B1110001100000010, // D;JEQ +tick, output, tock, output; + +set instruction %B1110001100000011, // D;JGE +tick, output, tock, output; + +set instruction %B1110001100000100, // D;JLT +tick, output, tock, output; + +set instruction %B1110001100000101, // D;JNE +tick, output, tock, output; + +set instruction %B1110001100000110, // D;JLE +tick, output, tock, output; + +set instruction %B1110001100000111, // D;JMP +tick, output, tock, output; + +set instruction %B1110101010010000, // D=0 +tick, output, tock, output; + +set instruction %B1110001100000001, // D;JGT +tick, output, tock, output; + +set instruction %B1110001100000010, // D;JEQ +tick, output, tock, output; + +set instruction %B1110001100000011, // D;JGE +tick, output, tock, output; + +set instruction %B1110001100000100, // D;JLT +tick, output, tock, output; + +set instruction %B1110001100000101, // D;JNE +tick, output, tock, output; + +set instruction %B1110001100000110, // D;JLE +tick, output, tock, output; + +set instruction %B1110001100000111, // D;JMP +tick, output, tock, output; + +set instruction %B1110111111010000, // D=1 +tick, output, tock, output; + +set instruction %B1110001100000001, // D;JGT +tick, output, tock, output; + +set instruction %B1110001100000010, // D;JEQ +tick, output, tock, output; + +set instruction %B1110001100000011, // D;JGE +tick, output, tock, output; + +set instruction %B1110001100000100, // D;JLT +tick, output, tock, output; + +set instruction %B1110001100000101, // D;JNE +tick, output, tock, output; + +set instruction %B1110001100000110, // D;JLE +tick, output, tock, output; + +set instruction %B1110001100000111, // D;JMP +tick, output, tock, output; + +set reset 1; +tick, output, tock, output; + +set instruction %B0111111111111111, // @32767 +set reset 0; +tick, output, tock, output; diff --git a/projects/05/CPU.cmp b/projects/05/CPU.cmp new file mode 100644 index 0000000..345674c --- /dev/null +++ b/projects/05/CPU.cmp @@ -0,0 +1,93 @@ +|time| inM | instruction |reset| outM |writeM |addre| pc |DRegiste| +|0+ | 0|0011000000111001| 0 |*******| 0 | 0| 0| 0 | +|1 | 0|0011000000111001| 0 |*******| 0 |12345| 1| 0 | +|1+ | 0|1110110000010000| 0 |*******| 0 |12345| 1| 12345 | +|2 | 0|1110110000010000| 0 |*******| 0 |12345| 2| 12345 | +|2+ | 0|0101101110100000| 0 |*******| 0 |12345| 2| 12345 | +|3 | 0|0101101110100000| 0 |*******| 0 |23456| 3| 12345 | +|3+ | 0|1110000111010000| 0 |*******| 0 |23456| 3| 11111 | +|4 | 0|1110000111010000| 0 |*******| 0 |23456| 4| 11111 | +|4+ | 0|0000001111101000| 0 |*******| 0 |23456| 4| 11111 | +|5 | 0|0000001111101000| 0 |*******| 0 | 1000| 5| 11111 | +|5+ | 0|1110001100001000| 0 | 11111| 1 | 1000| 5| 11111 | +|6 | 0|1110001100001000| 0 | 11111| 1 | 1000| 6| 11111 | +|6+ | 0|0000001111101001| 0 |*******| 0 | 1000| 6| 11111 | +|7 | 0|0000001111101001| 0 |*******| 0 | 1001| 7| 11111 | +|7+ | 0|1110001110011000| 0 | 11110| 1 | 1001| 7| 11110 | +|8 | 0|1110001110011000| 0 | 11109| 1 | 1001| 8| 11110 | +|8+ | 0|0000001111101000| 0 |*******| 0 | 1001| 8| 11110 | +|9 | 0|0000001111101000| 0 |*******| 0 | 1000| 9| 11110 | +|9+ | 11111|1111010011010000| 0 |*******| 0 | 1000| 9| -1 | +|10 | 11111|1111010011010000| 0 |*******| 0 | 1000| 10| -1 | +|10+ | 11111|0000000000001110| 0 |*******| 0 | 1000| 10| -1 | +|11 | 11111|0000000000001110| 0 |*******| 0 | 14| 11| -1 | +|11+ | 11111|1110001100000100| 0 |*******| 0 | 14| 11| -1 | +|12 | 11111|1110001100000100| 0 |*******| 0 | 14| 14| -1 | +|12+ | 11111|0000001111100111| 0 |*******| 0 | 14| 14| -1 | +|13 | 11111|0000001111100111| 0 |*******| 0 | 999| 15| -1 | +|13+ | 11111|1110110111100000| 0 |*******| 0 | 999| 15| -1 | +|14 | 11111|1110110111100000| 0 |*******| 0 | 1000| 16| -1 | +|14+ | 11111|1110001100001000| 0 | -1| 1 | 1000| 16| -1 | +|15 | 11111|1110001100001000| 0 | -1| 1 | 1000| 17| -1 | +|15+ | 11111|0000000000010101| 0 |*******| 0 | 1000| 17| -1 | +|16 | 11111|0000000000010101| 0 |*******| 0 | 21| 18| -1 | +|16+ | 11111|1110011111000010| 0 |*******| 0 | 21| 18| -1 | +|17 | 11111|1110011111000010| 0 |*******| 0 | 21| 21| -1 | +|17+ | 11111|0000000000000010| 0 |*******| 0 | 21| 21| -1 | +|18 | 11111|0000000000000010| 0 |*******| 0 | 2| 22| -1 | +|18+ | 11111|1110000010010000| 0 |*******| 0 | 2| 22| 1 | +|19 | 11111|1110000010010000| 0 |*******| 0 | 2| 23| 1 | +|19+ | 11111|0000001111101000| 0 |*******| 0 | 2| 23| 1 | +|20 | 11111|0000001111101000| 0 |*******| 0 | 1000| 24| 1 | +|20+ | 11111|1110111010010000| 0 |*******| 0 | 1000| 24| -1 | +|21 | 11111|1110111010010000| 0 |*******| 0 | 1000| 25| -1 | +|21+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 25| -1 | +|22 | 11111|1110001100000001| 0 |*******| 0 | 1000| 26| -1 | +|22+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 26| -1 | +|23 | 11111|1110001100000010| 0 |*******| 0 | 1000| 27| -1 | +|23+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 27| -1 | +|24 | 11111|1110001100000011| 0 |*******| 0 | 1000| 28| -1 | +|24+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 28| -1 | +|25 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| -1 | +|25+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| -1 | +|26 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| -1 | +|26+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| -1 | +|27 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| -1 | +|27+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| -1 | +|28 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| -1 | +|28+ | 11111|1110101010010000| 0 |*******| 0 | 1000| 1000| 0 | +|29 | 11111|1110101010010000| 0 |*******| 0 | 1000| 1001| 0 | +|29+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 1001| 0 | +|30 | 11111|1110001100000001| 0 |*******| 0 | 1000| 1002| 0 | +|30+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 1002| 0 | +|31 | 11111|1110001100000010| 0 |*******| 0 | 1000| 1000| 0 | +|31+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| 0 | +|32 | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| 0 | +|32+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| 0 | +|33 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1001| 0 | +|33+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1001| 0 | +|34 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1002| 0 | +|34+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1002| 0 | +|35 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| 0 | +|35+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| 0 | +|36 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| 0 | +|36+ | 11111|1110111111010000| 0 |*******| 0 | 1000| 1000| 1 | +|37 | 11111|1110111111010000| 0 |*******| 0 | 1000| 1001| 1 | +|37+ | 11111|1110001100000001| 0 |*******| 0 | 1000| 1001| 1 | +|38 | 11111|1110001100000001| 0 |*******| 0 | 1000| 1000| 1 | +|38+ | 11111|1110001100000010| 0 |*******| 0 | 1000| 1000| 1 | +|39 | 11111|1110001100000010| 0 |*******| 0 | 1000| 1001| 1 | +|39+ | 11111|1110001100000011| 0 |*******| 0 | 1000| 1001| 1 | +|40 | 11111|1110001100000011| 0 |*******| 0 | 1000| 1000| 1 | +|40+ | 11111|1110001100000100| 0 |*******| 0 | 1000| 1000| 1 | +|41 | 11111|1110001100000100| 0 |*******| 0 | 1000| 1001| 1 | +|41+ | 11111|1110001100000101| 0 |*******| 0 | 1000| 1001| 1 | +|42 | 11111|1110001100000101| 0 |*******| 0 | 1000| 1000| 1 | +|42+ | 11111|1110001100000110| 0 |*******| 0 | 1000| 1000| 1 | +|43 | 11111|1110001100000110| 0 |*******| 0 | 1000| 1001| 1 | +|43+ | 11111|1110001100000111| 0 |*******| 0 | 1000| 1001| 1 | +|44 | 11111|1110001100000111| 0 |*******| 0 | 1000| 1000| 1 | +|44+ | 11111|1110001100000111| 1 |*******| 0 | 1000| 1000| 1 | +|45 | 11111|1110001100000111| 1 |*******| 0 | 1000| 0| 1 | +|45+ | 11111|0111111111111111| 0 |*******| 0 | 1000| 0| 1 | +|46 | 11111|0111111111111111| 0 |*******| 0 |32767| 1| 1 | diff --git a/projects/05/CPU.hdl b/projects/05/CPU.hdl new file mode 100644 index 0000000..7b73ca0 --- /dev/null +++ b/projects/05/CPU.hdl @@ -0,0 +1,43 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/05/CPU.hdl + +/** + * The Hack CPU (Central Processing unit), consisting of an ALU, + * two registers named A and D, and a program counter named PC. + * The CPU is designed to fetch and execute instructions written in + * the Hack machine language. In particular, functions as follows: + * Executes the inputted instruction according to the Hack machine + * language specification. The D and A in the language specification + * refer to CPU-resident registers, while M refers to the external + * memory location addressed by A, i.e. to Memory[A]. The inM input + * holds the value of this location. If the current instruction needs + * to write a value to M, the value is placed in outM, the address + * of the target location is placed in the addressM output, and the + * writeM control bit is asserted. (When writeM==0, any value may + * appear in outM). The outM and writeM outputs are combinational: + * they are affected instantaneously by the execution of the current + * instruction. The addressM and pc outputs are clocked: although they + * are affected by the execution of the current instruction, they commit + * to their new values only in the next time step. If reset==1 then the + * CPU jumps to address 0 (i.e. pc is set to 0 in next time step) rather + * than to the address resulting from executing the current instruction. + */ + +CHIP CPU { + + IN inM[16], // M value input (M = contents of RAM[A]) + instruction[16], // Instruction for execution + reset; // Signals whether to re-start the current + // program (reset==1) or continue executing + // the current program (reset==0). + + OUT outM[16], // M value output + writeM, // Write to M? + addressM[15], // Address in data memory (of M) + pc[15]; // address of next instruction + + PARTS: + // Put your code here: +} \ No newline at end of file diff --git a/projects/05/CPU.tst b/projects/05/CPU.tst new file mode 100644 index 0000000..98eee1c --- /dev/null +++ b/projects/05/CPU.tst @@ -0,0 +1,150 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/05/CPU.tst + +load CPU.hdl, +output-file CPU.out, +compare-to CPU.cmp, +output-list time%S0.4.0 inM%D0.6.0 instruction%B0.16.0 reset%B2.1.2 outM%D1.6.0 writeM%B3.1.3 addressM%D0.5.0 pc%D0.5.0 DRegister[]%D1.6.1; + + +set instruction %B0011000000111001, // @12345 +tick, output, tock, output; + +set instruction %B1110110000010000, // D=A +tick, output, tock, output; + +set instruction %B0101101110100000, // @23456 +tick, output, tock, output; + +set instruction %B1110000111010000, // D=A-D +tick, output, tock, output; + +set instruction %B0000001111101000, // @1000 +tick, output, tock, output; + +set instruction %B1110001100001000, // M=D +tick, output, tock, output; + +set instruction %B0000001111101001, // @1001 +tick, output, tock, output; + +set instruction %B1110001110011000, // MD=D-1 +tick, output, tock, output; + +set instruction %B0000001111101000, // @1000 +tick, output, tock, output; + +set instruction %B1111010011010000, // D=D-M +set inM 11111, +tick, output, tock, output; + +set instruction %B0000000000001110, // @14 +tick, output, tock, output; + +set instruction %B1110001100000100, // D;jlt +tick, output, tock, output; + +set instruction %B0000001111100111, // @999 +tick, output, tock, output; + +set instruction %B1110110111100000, // A=A+1 +tick, output, tock, output; + +set instruction %B1110001100001000, // M=D +tick, output, tock, output; + +set instruction %B0000000000010101, // @21 +tick, output, tock, output; + +set instruction %B1110011111000010, // D+1;jeq +tick, output, tock, output; + +set instruction %B0000000000000010, // @2 +tick, output, tock, output; + +set instruction %B1110000010010000, // D=D+A +tick, output, tock, output; + +set instruction %B0000001111101000, // @1000 +tick, output, tock, output; + +set instruction %B1110111010010000, // D=-1 +tick, output, tock, output; + +set instruction %B1110001100000001, // D;JGT +tick, output, tock, output; + +set instruction %B1110001100000010, // D;JEQ +tick, output, tock, output; + +set instruction %B1110001100000011, // D;JGE +tick, output, tock, output; + +set instruction %B1110001100000100, // D;JLT +tick, output, tock, output; + +set instruction %B1110001100000101, // D;JNE +tick, output, tock, output; + +set instruction %B1110001100000110, // D;JLE +tick, output, tock, output; + +set instruction %B1110001100000111, // D;JMP +tick, output, tock, output; + +set instruction %B1110101010010000, // D=0 +tick, output, tock, output; + +set instruction %B1110001100000001, // D;JGT +tick, output, tock, output; + +set instruction %B1110001100000010, // D;JEQ +tick, output, tock, output; + +set instruction %B1110001100000011, // D;JGE +tick, output, tock, output; + +set instruction %B1110001100000100, // D;JLT +tick, output, tock, output; + +set instruction %B1110001100000101, // D;JNE +tick, output, tock, output; + +set instruction %B1110001100000110, // D;JLE +tick, output, tock, output; + +set instruction %B1110001100000111, // D;JMP +tick, output, tock, output; + +set instruction %B1110111111010000, // D=1 +tick, output, tock, output; + +set instruction %B1110001100000001, // D;JGT +tick, output, tock, output; + +set instruction %B1110001100000010, // D;JEQ +tick, output, tock, output; + +set instruction %B1110001100000011, // D;JGE +tick, output, tock, output; + +set instruction %B1110001100000100, // D;JLT +tick, output, tock, output; + +set instruction %B1110001100000101, // D;JNE +tick, output, tock, output; + +set instruction %B1110001100000110, // D;JLE +tick, output, tock, output; + +set instruction %B1110001100000111, // D;JMP +tick, output, tock, output; + +set reset 1; +tick, output, tock, output; + +set instruction %B0111111111111111, // @32767 +set reset 0; +tick, output, tock, output; diff --git a/projects/05/Computer.hdl b/projects/05/Computer.hdl new file mode 100644 index 0000000..22f9b48 --- /dev/null +++ b/projects/05/Computer.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: projects/05/Computer.hdl + +/** + * The HACK computer, including CPU, ROM and RAM. + * When reset is 0, the program stored in the computer's ROM executes. + * When reset is 1, the execution of the program restarts. + * Thus, to start a program's execution, reset must be pushed "up" (1) + * and "down" (0). From this point onward the user is at the mercy of + * the software. In particular, depending on the program's code, the + * screen may show some output and the user may be able to interact + * with the computer via the keyboard. + */ + +CHIP Computer { + + IN reset; + + PARTS: + // Put your code here: +} diff --git a/projects/05/ComputerAdd-external.cmp b/projects/05/ComputerAdd-external.cmp new file mode 100644 index 0000000..a3a8eaf --- /dev/null +++ b/projects/05/ComputerAdd-external.cmp @@ -0,0 +1,15 @@ +| time |reset|RAM16K[0]|RAM16K[1]|RAM16K[2]| +| 0 | 0 | 0 | 0 | 0 | +| 1 | 0 | 0 | 0 | 0 | +| 2 | 0 | 0 | 0 | 0 | +| 3 | 0 | 0 | 0 | 0 | +| 4 | 0 | 0 | 0 | 0 | +| 5 | 0 | 0 | 0 | 0 | +| 6 | 0 | 5 | 0 | 0 | +| 7 | 1 | 0 | 0 | 0 | +| 8 | 0 | 0 | 0 | 0 | +| 9 | 0 | 0 | 0 | 0 | +| 10 | 0 | 0 | 0 | 0 | +| 11 | 0 | 0 | 0 | 0 | +| 12 | 0 | 0 | 0 | 0 | +| 13 | 0 | 5 | 0 | 0 | diff --git a/projects/05/ComputerAdd-external.tst b/projects/05/ComputerAdd-external.tst new file mode 100644 index 0000000..09cc1a7 --- /dev/null +++ b/projects/05/ComputerAdd-external.tst @@ -0,0 +1,32 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/05/ComputerAdd-external.tst + +load Computer.hdl, +output-file ComputerAdd-external.out, +compare-to ComputerAdd-external.cmp, +output-list time%S1.4.1 reset%B2.1.2 RAM16K[0]%D1.7.1 RAM16K[1]%D1.7.1 RAM16K[2]%D1.7.1; + +// Load a program written in the Hack machine language. +// The program adds the two constants 2 and 3 and writes the result in RAM[0]. +ROM32K load Add.hack, +output; + +// First run (at the beginning PC=0) +repeat 6 { + tick, tock, output; +} + +// Reset the PC +set reset 1, +set RAM16K[0] 0, +tick, tock, output; + + +// Second run, to check that the PC was reset correctly. +set reset 0, + +repeat 6 { + tick, tock, output; +} diff --git a/projects/05/ComputerAdd.cmp b/projects/05/ComputerAdd.cmp new file mode 100644 index 0000000..f295464 --- /dev/null +++ b/projects/05/ComputerAdd.cmp @@ -0,0 +1,15 @@ +| time |reset|ARegister|DRegister|PC[]|RAM16K[0]|RAM16K[1]|RAM16K[2]| +| 0 | 0 | 0 | 0 | 0| 0 | 0 | 0 | +| 1 | 0 | 2 | 0 | 1| 0 | 0 | 0 | +| 2 | 0 | 2 | 2 | 2| 0 | 0 | 0 | +| 3 | 0 | 3 | 2 | 3| 0 | 0 | 0 | +| 4 | 0 | 3 | 5 | 4| 0 | 0 | 0 | +| 5 | 0 | 0 | 5 | 5| 0 | 0 | 0 | +| 6 | 0 | 0 | 5 | 6| 5 | 0 | 0 | +| 7 | 1 | 0 | 5 | 0| 0 | 0 | 0 | +| 8 | 0 | 2 | 5 | 1| 0 | 0 | 0 | +| 9 | 0 | 2 | 2 | 2| 0 | 0 | 0 | +| 10 | 0 | 3 | 2 | 3| 0 | 0 | 0 | +| 11 | 0 | 3 | 5 | 4| 0 | 0 | 0 | +| 12 | 0 | 0 | 5 | 5| 0 | 0 | 0 | +| 13 | 0 | 0 | 5 | 6| 5 | 0 | 0 | diff --git a/projects/05/ComputerAdd.tst b/projects/05/ComputerAdd.tst new file mode 100644 index 0000000..27f4411 --- /dev/null +++ b/projects/05/ComputerAdd.tst @@ -0,0 +1,32 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/05/ComputerAdd.tst + +load Computer.hdl, +output-file ComputerAdd.out, +compare-to ComputerAdd.cmp, +output-list time%S1.4.1 reset%B2.1.2 ARegister[0]%D1.7.1 DRegister[0]%D1.7.1 PC[]%D0.4.0 RAM16K[0]%D1.7.1 RAM16K[1]%D1.7.1 RAM16K[2]%D1.7.1; + +// Load a program written in the Hack machine language. +// The program adds the two constants 2 and 3 and writes the result in RAM[0]. +ROM32K load Add.hack, +output; + +// First run (at the beginning PC=0) +repeat 6 { + tick, tock, output; +} + +// Reset the PC +set reset 1, +set RAM16K[0] 0, +tick, tock, output; + + +// Second run, to check that the PC was reset correctly. +set reset 0, + +repeat 6 { + tick, tock, output; +} diff --git a/projects/05/ComputerMax-external.cmp b/projects/05/ComputerMax-external.cmp new file mode 100644 index 0000000..f864733 --- /dev/null +++ b/projects/05/ComputerMax-external.cmp @@ -0,0 +1,28 @@ +| time |reset|RAM16K[0]|RAM16K[1]|RAM16K[2]| +| 0 | 0 | 3 | 5 | 0 | +| 1 | 0 | 3 | 5 | 0 | +| 2 | 0 | 3 | 5 | 0 | +| 3 | 0 | 3 | 5 | 0 | +| 4 | 0 | 3 | 5 | 0 | +| 5 | 0 | 3 | 5 | 0 | +| 6 | 0 | 3 | 5 | 0 | +| 7 | 0 | 3 | 5 | 0 | +| 8 | 0 | 3 | 5 | 0 | +| 9 | 0 | 3 | 5 | 0 | +| 10 | 0 | 3 | 5 | 0 | +| 11 | 0 | 3 | 5 | 0 | +| 12 | 0 | 3 | 5 | 5 | +| 13 | 0 | 3 | 5 | 5 | +| 14 | 0 | 3 | 5 | 5 | +| 15 | 1 | 3 | 5 | 5 | +| 15 | 0 | 23456 | 12345 | 5 | +| 16 | 0 | 23456 | 12345 | 5 | +| 17 | 0 | 23456 | 12345 | 5 | +| 18 | 0 | 23456 | 12345 | 5 | +| 19 | 0 | 23456 | 12345 | 5 | +| 20 | 0 | 23456 | 12345 | 5 | +| 21 | 0 | 23456 | 12345 | 5 | +| 22 | 0 | 23456 | 12345 | 5 | +| 23 | 0 | 23456 | 12345 | 5 | +| 24 | 0 | 23456 | 12345 | 5 | +| 25 | 0 | 23456 | 12345 | 23456 | diff --git a/projects/05/ComputerMax-external.tst b/projects/05/ComputerMax-external.tst new file mode 100644 index 0000000..52b6bef --- /dev/null +++ b/projects/05/ComputerMax-external.tst @@ -0,0 +1,38 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/05/ComputerMax-external.tst + +load Computer.hdl, +output-file ComputerMax-external.out, +compare-to ComputerMax-external.cmp, +output-list time%S1.4.1 reset%B2.1.2 RAM16K[0]%D1.7.1 RAM16K[1]%D1.7.1 RAM16K[2]%D1.7.1; + +// Load a program written in the Hack machine language. +// The program computes the maximum of RAM[0] and RAM[1] +// and writes the result in RAM[2]. +ROM32K load Max.hack, + +// first run: compute max(3,5) +set RAM16K[0] 3, +set RAM16K[1] 5, +output; + +repeat 14 { + tick, tock, output; +} + +// reset the PC +set reset 1, +tick, tock, output; + +// second run: compute max(23456,12345) +set reset 0, +set RAM16K[0] 23456, +set RAM16K[1] 12345, +output; + +// The run on these inputs needs less cycles (different branching) +repeat 10 { + tick, tock, output; +} diff --git a/projects/05/ComputerMax.cmp b/projects/05/ComputerMax.cmp new file mode 100644 index 0000000..42276cd --- /dev/null +++ b/projects/05/ComputerMax.cmp @@ -0,0 +1,28 @@ +| time |reset|ARegister|DRegister|PC[]|RAM16K[0]|RAM16K[1]|RAM16K[2]| +| 0 | 0 | 0 | 0 | 0| 3 | 5 | 0 | +| 1 | 0 | 0 | 0 | 1| 3 | 5 | 0 | +| 2 | 0 | 0 | 3 | 2| 3 | 5 | 0 | +| 3 | 0 | 1 | 3 | 3| 3 | 5 | 0 | +| 4 | 0 | 1 | -2 | 4| 3 | 5 | 0 | +| 5 | 0 | 10 | -2 | 5| 3 | 5 | 0 | +| 6 | 0 | 10 | -2 | 6| 3 | 5 | 0 | +| 7 | 0 | 1 | -2 | 7| 3 | 5 | 0 | +| 8 | 0 | 1 | 5 | 8| 3 | 5 | 0 | +| 9 | 0 | 12 | 5 | 9| 3 | 5 | 0 | +| 10 | 0 | 12 | 5 | 12| 3 | 5 | 0 | +| 11 | 0 | 2 | 5 | 13| 3 | 5 | 0 | +| 12 | 0 | 2 | 5 | 14| 3 | 5 | 5 | +| 13 | 0 | 14 | 5 | 15| 3 | 5 | 5 | +| 14 | 0 | 14 | 5 | 14| 3 | 5 | 5 | +| 15 | 1 | 14 | 5 | 0| 3 | 5 | 5 | +| 15 | 0 | 14 | 5 | 0| 23456 | 12345 | 5 | +| 16 | 0 | 0 | 5 | 1| 23456 | 12345 | 5 | +| 17 | 0 | 0 | 23456 | 2| 23456 | 12345 | 5 | +| 18 | 0 | 1 | 23456 | 3| 23456 | 12345 | 5 | +| 19 | 0 | 1 | 11111 | 4| 23456 | 12345 | 5 | +| 20 | 0 | 10 | 11111 | 5| 23456 | 12345 | 5 | +| 21 | 0 | 10 | 11111 | 10| 23456 | 12345 | 5 | +| 22 | 0 | 0 | 11111 | 11| 23456 | 12345 | 5 | +| 23 | 0 | 0 | 23456 | 12| 23456 | 12345 | 5 | +| 24 | 0 | 2 | 23456 | 13| 23456 | 12345 | 5 | +| 25 | 0 | 2 | 23456 | 14| 23456 | 12345 | 23456 | diff --git a/projects/05/ComputerMax.tst b/projects/05/ComputerMax.tst new file mode 100644 index 0000000..e090754 --- /dev/null +++ b/projects/05/ComputerMax.tst @@ -0,0 +1,39 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/05/ComputerMax.tst + +load Computer.hdl, +output-file ComputerMax.out, +compare-to ComputerMax.cmp, +output-list time%S1.4.1 reset%B2.1.2 ARegister[]%D1.7.1 DRegister[]%D1.7.1 PC[]%D0.4.0 RAM16K[0]%D1.7.1 RAM16K[1]%D1.7.1 RAM16K[2]%D1.7.1; + +// Load a program written in the Hack machine language. +// The program computes the maximum of RAM[0] and RAM[1] +// and writes the result in RAM[2]. + +ROM32K load Max.hack, + +// first run: compute max(3,5) +set RAM16K[0] 3, +set RAM16K[1] 5, +output; + +repeat 14 { + tick, tock, output; +} + +// reset the PC +set reset 1, +tick, tock, output; + +// second run: compute max(23456,12345) +set reset 0, +set RAM16K[0] 23456, +set RAM16K[1] 12345, +output; + +// The run on these inputs needs less cycles (different branching) +repeat 10 { + tick, tock, output; +} diff --git a/projects/05/ComputerRect-external.cmp b/projects/05/ComputerRect-external.cmp new file mode 100644 index 0000000..f276922 --- /dev/null +++ b/projects/05/ComputerRect-external.cmp @@ -0,0 +1,65 @@ +| time | +| 0 | +| 1 | +| 2 | +| 3 | +| 4 | +| 5 | +| 6 | +| 7 | +| 8 | +| 9 | +| 10 | +| 11 | +| 12 | +| 13 | +| 14 | +| 15 | +| 16 | +| 17 | +| 18 | +| 19 | +| 20 | +| 21 | +| 22 | +| 23 | +| 24 | +| 25 | +| 26 | +| 27 | +| 28 | +| 29 | +| 30 | +| 31 | +| 32 | +| 33 | +| 34 | +| 35 | +| 36 | +| 37 | +| 38 | +| 39 | +| 40 | +| 41 | +| 42 | +| 43 | +| 44 | +| 45 | +| 46 | +| 47 | +| 48 | +| 49 | +| 50 | +| 51 | +| 52 | +| 53 | +| 54 | +| 55 | +| 56 | +| 57 | +| 58 | +| 59 | +| 60 | +| 61 | +| 62 | +| 63 | diff --git a/projects/05/ComputerRect-external.tst b/projects/05/ComputerRect-external.tst new file mode 100644 index 0000000..f9102f7 --- /dev/null +++ b/projects/05/ComputerRect-external.tst @@ -0,0 +1,26 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/05/ComputerRect-external.tst + +load Computer.hdl, +output-file ComputerRect-external.out, +compare-to ComputerRect-external.cmp, +output-list time%S1.4.1; + +// Load a program written in the Hack machine language. +// The program draws a rectangle of width 16 pixels and +// length RAM[0] at the top left of the screen. +ROM32K load Rect.hack, + +echo "Before you run this script, select the 'Screen' option from the 'View' menu"; + +echo "A small rectangle should be drawn at the top left of the screen (the 'Screen' option of the 'View' menu should be selected.)"; + +// draw a rectangle 16 pixels wide and 4 pixels long +set RAM16K[0] 4, +output; + +repeat 63 { + tick, tock, output; +} diff --git a/projects/05/ComputerRect.cmp b/projects/05/ComputerRect.cmp new file mode 100644 index 0000000..a6b5cc9 --- /dev/null +++ b/projects/05/ComputerRect.cmp @@ -0,0 +1,65 @@ +| time |ARegister|DRegister|PC[]|RAM16K[0]|RAM16K[1]|RAM16K[2]| +| 0 | 0 | 0 | 0| 4 | 0 | 0 | +| 1 | 0 | 0 | 1| 4 | 0 | 0 | +| 2 | 0 | 4 | 2| 4 | 0 | 0 | +| 3 | 23 | 4 | 3| 4 | 0 | 0 | +| 4 | 23 | 4 | 4| 4 | 0 | 0 | +| 5 | 16 | 4 | 5| 4 | 0 | 0 | +| 6 | 16 | 4 | 6| 4 | 0 | 0 | +| 7 | 16384 | 4 | 7| 4 | 0 | 0 | +| 8 | 16384 | 16384 | 8| 4 | 0 | 0 | +| 9 | 17 | 16384 | 9| 4 | 0 | 0 | +| 10 | 17 | 16384 | 10| 4 | 0 | 0 | +| 11 | 17 | 16384 | 11| 4 | 0 | 0 | +| 12 | 16384 | 16384 | 12| 4 | 0 | 0 | +| 13 | 16384 | 16384 | 13| 4 | 0 | 0 | +| 14 | 17 | 16384 | 14| 4 | 0 | 0 | +| 15 | 17 | 16384 | 15| 4 | 0 | 0 | +| 16 | 32 | 16384 | 16| 4 | 0 | 0 | +| 17 | 32 | 16416 | 17| 4 | 0 | 0 | +| 18 | 17 | 16416 | 18| 4 | 0 | 0 | +| 19 | 17 | 16416 | 19| 4 | 0 | 0 | +| 20 | 16 | 16416 | 20| 4 | 0 | 0 | +| 21 | 16 | 3 | 21| 4 | 0 | 0 | +| 22 | 10 | 3 | 22| 4 | 0 | 0 | +| 23 | 10 | 3 | 10| 4 | 0 | 0 | +| 24 | 17 | 3 | 11| 4 | 0 | 0 | +| 25 | 16416 | 3 | 12| 4 | 0 | 0 | +| 26 | 16416 | 3 | 13| 4 | 0 | 0 | +| 27 | 17 | 3 | 14| 4 | 0 | 0 | +| 28 | 17 | 16416 | 15| 4 | 0 | 0 | +| 29 | 32 | 16416 | 16| 4 | 0 | 0 | +| 30 | 32 | 16448 | 17| 4 | 0 | 0 | +| 31 | 17 | 16448 | 18| 4 | 0 | 0 | +| 32 | 17 | 16448 | 19| 4 | 0 | 0 | +| 33 | 16 | 16448 | 20| 4 | 0 | 0 | +| 34 | 16 | 2 | 21| 4 | 0 | 0 | +| 35 | 10 | 2 | 22| 4 | 0 | 0 | +| 36 | 10 | 2 | 10| 4 | 0 | 0 | +| 37 | 17 | 2 | 11| 4 | 0 | 0 | +| 38 | 16448 | 2 | 12| 4 | 0 | 0 | +| 39 | 16448 | 2 | 13| 4 | 0 | 0 | +| 40 | 17 | 2 | 14| 4 | 0 | 0 | +| 41 | 17 | 16448 | 15| 4 | 0 | 0 | +| 42 | 32 | 16448 | 16| 4 | 0 | 0 | +| 43 | 32 | 16480 | 17| 4 | 0 | 0 | +| 44 | 17 | 16480 | 18| 4 | 0 | 0 | +| 45 | 17 | 16480 | 19| 4 | 0 | 0 | +| 46 | 16 | 16480 | 20| 4 | 0 | 0 | +| 47 | 16 | 1 | 21| 4 | 0 | 0 | +| 48 | 10 | 1 | 22| 4 | 0 | 0 | +| 49 | 10 | 1 | 10| 4 | 0 | 0 | +| 50 | 17 | 1 | 11| 4 | 0 | 0 | +| 51 | 16480 | 1 | 12| 4 | 0 | 0 | +| 52 | 16480 | 1 | 13| 4 | 0 | 0 | +| 53 | 17 | 1 | 14| 4 | 0 | 0 | +| 54 | 17 | 16480 | 15| 4 | 0 | 0 | +| 55 | 32 | 16480 | 16| 4 | 0 | 0 | +| 56 | 32 | 16512 | 17| 4 | 0 | 0 | +| 57 | 17 | 16512 | 18| 4 | 0 | 0 | +| 58 | 17 | 16512 | 19| 4 | 0 | 0 | +| 59 | 16 | 16512 | 20| 4 | 0 | 0 | +| 60 | 16 | 0 | 21| 4 | 0 | 0 | +| 61 | 10 | 0 | 22| 4 | 0 | 0 | +| 62 | 10 | 0 | 23| 4 | 0 | 0 | +| 63 | 23 | 0 | 24| 4 | 0 | 0 | diff --git a/projects/05/ComputerRect.tst b/projects/05/ComputerRect.tst new file mode 100644 index 0000000..b1e2126 --- /dev/null +++ b/projects/05/ComputerRect.tst @@ -0,0 +1,26 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/05/ComputerRect.tst + +load Computer.hdl, +output-file ComputerRect.out, +compare-to ComputerRect.cmp, +output-list time%S1.4.1 ARegister[]%D1.7.1 DRegister[]%D1.7.1 PC[]%D0.4.0 RAM16K[0]%D1.7.1 RAM16K[1]%D1.7.1 RAM16K[2]%D1.7.1; + +// Load a program written in the Hack machine language. +// The program draws a rectangle of width 16 pixels and +// length RAM[0] at the top left of the screen. +ROM32K load Rect.hack, + +echo "Before you run this script, select the 'Screen' option from the 'View' menu"; + +echo "A small rectangle should be drawn at the top left of the screen (the 'Screen' option of the 'View' menu should be selected.)"; + +// Draws a rectangle 16 pixels wide and 4 pixels long +set RAM16K[0] 4, +output; + +repeat 63 { + tick, tock, output; +} diff --git a/projects/05/Max.hack b/projects/05/Max.hack new file mode 100644 index 0000000..2e04a8d --- /dev/null +++ b/projects/05/Max.hack @@ -0,0 +1,16 @@ +0000000000000000 +1111110000010000 +0000000000000001 +1111010011010000 +0000000000001010 +1110001100000001 +0000000000000001 +1111110000010000 +0000000000001100 +1110101010000111 +0000000000000000 +1111110000010000 +0000000000000010 +1110001100001000 +0000000000001110 +1110101010000111 diff --git a/projects/05/Memory.cmp b/projects/05/Memory.cmp new file mode 100644 index 0000000..613d171 --- /dev/null +++ b/projects/05/Memory.cmp @@ -0,0 +1,54 @@ +| in |load | address | out | +| -1 | 1 | 000000000000000 | 0 | +| -1 | 1 | 000000000000000 | -1 | +| 9999 | 0 | 000000000000000 | -1 | +| 9999 | 0 | 000000000000000 | -1 | +| 9999 | 0 | 010000000000000 | 0 | +| 9999 | 0 | 100000000000000 | 0 | +| 2222 | 1 | 010000000000000 | 0 | +| 2222 | 1 | 010000000000000 | 2222 | +| 9999 | 0 | 010000000000000 | 2222 | +| 9999 | 0 | 010000000000000 | 2222 | +| 9999 | 0 | 000000000000000 | -1 | +| 9999 | 0 | 100000000000000 | 0 | +| 9999 | 0 | 000000000000001 | 0 | +| 9999 | 0 | 000000000000010 | 0 | +| 9999 | 0 | 000000000000100 | 0 | +| 9999 | 0 | 000000000001000 | 0 | +| 9999 | 0 | 000000000010000 | 0 | +| 9999 | 0 | 000000000100000 | 0 | +| 9999 | 0 | 000000001000000 | 0 | +| 9999 | 0 | 000000010000000 | 0 | +| 9999 | 0 | 000000100000000 | 0 | +| 9999 | 0 | 000001000000000 | 0 | +| 9999 | 0 | 000010000000000 | 0 | +| 9999 | 0 | 000100000000000 | 0 | +| 9999 | 0 | 001000000000000 | 0 | +| 9999 | 0 | 010000000000000 | 2222 | +| 1234 | 1 | 001001000110100 | 0 | +| 1234 | 1 | 001001000110100 | 1234 | +| 1234 | 0 | 010001000110100 | 0 | +| 1234 | 0 | 110001000110100 | 0 | +| 2345 | 1 | 010001101000101 | 0 | +| 2345 | 1 | 010001101000101 | 2345 | +| 2345 | 0 | 000001101000101 | 0 | +| 2345 | 0 | 100001101000101 | 0 | +| 2345 | 0 | 110000000000000 | 75 | +| -1 | 1 | 100111111001111 | -1 | +| -1 | 1 | 101000001001111 | -1 | +| -1 | 1 | 000111111001111 | 0 | +| -1 | 1 | 010111111001111 | 0 | +| -1 | 0 | 100111111001110 | 0 | +| -1 | 0 | 100111111001101 | 0 | +| -1 | 0 | 100111111001011 | 0 | +| -1 | 0 | 100111111000111 | 0 | +| -1 | 0 | 100111111011111 | 0 | +| -1 | 0 | 100111111101111 | 0 | +| -1 | 0 | 100111110001111 | 0 | +| -1 | 0 | 100111101001111 | 0 | +| -1 | 0 | 100111011001111 | 0 | +| -1 | 0 | 100110111001111 | 0 | +| -1 | 0 | 100101111001111 | 0 | +| -1 | 0 | 100011111001111 | 0 | +| -1 | 0 | 101111111001111 | 0 | +| -1 | 0 | 110000000000000 | 89 | diff --git a/projects/05/Memory.hdl b/projects/05/Memory.hdl new file mode 100644 index 0000000..62a4fd2 --- /dev/null +++ b/projects/05/Memory.hdl @@ -0,0 +1,31 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/05/Memory.hdl + +/** + * The complete address space of the Hack computer's memory, + * including RAM and memory-mapped I/O. + * The chip facilitates read and write operations, as follows: + * Read: out(t) = Memory[address(t)](t) + * Write: if load(t-1) then Memory[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 from the next time step onward. + * Address space rules: + * Only the upper 16K+8K+1 words of the Memory chip are used. + * Access to address>0x6000 is invalid. Access to any address in + * the range 0x4000-0x5FFF results in accessing the screen memory + * map. Access to address 0x6000 results in accessing the keyboard + * memory map. The behavior in these addresses is described in the + * Screen and Keyboard chip specifications given in the book. + */ + +CHIP Memory { + IN in[16], load, address[15]; + OUT out[16]; + + PARTS: + // Put your code here: +} \ No newline at end of file diff --git a/projects/05/Memory.tst b/projects/05/Memory.tst new file mode 100644 index 0000000..f712a48 --- /dev/null +++ b/projects/05/Memory.tst @@ -0,0 +1,163 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/05/Memory.tst + +load Memory.hdl, +output-file Memory.out, +compare-to Memory.cmp, +output-list in%D1.6.1 load%B2.1.2 address%B1.15.1 out%D1.6.1; + +echo "Before you run this script, select the 'Screen' option from the 'View' menu"; + +set in -1, // Set RAM[0] = -1 +set load 1, +set address 0, +tick, +output; +tock, +output; + +set in 9999, // RAM[0] holds value +set load 0, +tick, +output; +tock, +output; + +set address %X2000, // Did not also write to upper RAM or Screen +eval, +output; +set address %X4000, +eval, +output; + +set in 2222, // Set RAM[2000] = 2222 +set load 1, +set address %X2000, +tick, +output; +tock, +output; + +set in 9999, // RAM[2000] holds value +set load 0, +tick, +output; +tock, +output; + +set address 0, // Did not also write to lower RAM or Screen +eval, +output; +set address %X4000, +eval, +output; + +set load 0, // Low order address bits connected +set address %X0001, eval, output; +set address %X0002, eval, output; +set address %X0004, eval, output; +set address %X0008, eval, output; +set address %X0010, eval, output; +set address %X0020, eval, output; +set address %X0040, eval, output; +set address %X0080, eval, output; +set address %X0100, eval, output; +set address %X0200, eval, output; +set address %X0400, eval, output; +set address %X0800, eval, output; +set address %X1000, eval, output; +set address %X2000, eval, output; + +set address %X1234, // RAM[1234] = 1234 +set in 1234, +set load 1, +tick, +output; +tock, +output; + +set load 0, +set address %X2234, // Did not also write to upper RAM or Screen +eval, output; +set address %X6234, +eval, output; + +set address %X2345, // RAM[2345] = 2345 +set in 2345, +set load 1, +tick, +output; +tock, +output; + +set load 0, +set address %X0345, // Did not also write to lower RAM or Screen +eval, output; +set address %X4345, +eval, output; + +// Keyboard test + +set address 24576, +echo "Click the Keyboard icon and hold down the 'K' key (uppercase) until you see the next message (it should appear shortly after that) ...", +// It's important to keep holding the key down since if the system is busy, +// the memory will zero itself before being outputted. + +while out <> 75 { + eval, +} + +clear-echo, +output; + +// Screen test + +set load 1, +set in -1, +set address %X4FCF, +tick, +tock, +output, + +set address %X504F, +tick, +tock, +output; + +set address %X0FCF, // Did not also write to lower or upper RAM +eval, +output; +set address %X2FCF, +eval, +output; + +set load 0, // Low order address bits connected +set address %X4FCE, eval, output; +set address %X4FCD, eval, output; +set address %X4FCB, eval, output; +set address %X4FC7, eval, output; +set address %X4FDF, eval, output; +set address %X4FEF, eval, output; +set address %X4F8F, eval, output; +set address %X4F4F, eval, output; +set address %X4ECF, eval, output; +set address %X4DCF, eval, output; +set address %X4BCF, eval, output; +set address %X47CF, eval, output; +set address %X5FCF, eval, output; + + +set load 0, +set address 24576, +echo "Make sure you see ONLY two horizontal lines in the middle of the screen. Hold down 'Y' (uppercase) until you see the next message ...", +// It's important to keep holding the key down since if the system is busy, +// the memory will zero itself before being outputted. + +while out <> 89 { + eval, +} + +clear-echo, +output; diff --git a/projects/05/Rect.hack b/projects/05/Rect.hack new file mode 100644 index 0000000..ee017ab --- /dev/null +++ b/projects/05/Rect.hack @@ -0,0 +1,25 @@ +0000000000000000 +1111110000010000 +0000000000010111 +1110001100000110 +0000000000010000 +1110001100001000 +0100000000000000 +1110110000010000 +0000000000010001 +1110001100001000 +0000000000010001 +1111110000100000 +1110111010001000 +0000000000010001 +1111110000010000 +0000000000100000 +1110000010010000 +0000000000010001 +1110001100001000 +0000000000010000 +1111110010011000 +0000000000001010 +1110001100000001 +0000000000010111 +1110101010000111 diff --git a/projects/06/add/Add.asm b/projects/06/add/Add.asm new file mode 100644 index 0000000..3d4ec46 --- /dev/null +++ b/projects/06/add/Add.asm @@ -0,0 +1,13 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/06/add/Add.asm + +// Computes R0 = 2 + 3 (R0 refers to RAM[0]) + +@2 +D=A +@3 +D=D+A +@0 +M=D diff --git a/projects/06/max/Max.asm b/projects/06/max/Max.asm new file mode 100644 index 0000000..b62c138 --- /dev/null +++ b/projects/06/max/Max.asm @@ -0,0 +1,26 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/06/max/Max.asm + +// Computes R2 = max(R0, R1) (R0,R1,R2 refer to RAM[0],RAM[1],RAM[2]) + + @R0 + D=M // D = first number + @R1 + D=D-M // D = first number - second number + @OUTPUT_FIRST + D;JGT // if D>0 (first is greater) goto output_first + @R1 + D=M // D = second number + @OUTPUT_D + 0;JMP // goto output_d +(OUTPUT_FIRST) + @R0 + D=M // D = first number +(OUTPUT_D) + @R2 + M=D // M[2] = D (greatest number) +(INFINITE_LOOP) + @INFINITE_LOOP + 0;JMP // infinite loop diff --git a/projects/06/max/MaxL.asm b/projects/06/max/MaxL.asm new file mode 100644 index 0000000..fc3ccbf --- /dev/null +++ b/projects/06/max/MaxL.asm @@ -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: projects/06/max/MaxL.asm + +// Symbol-less version of the Max.asm program. + +@0 +D=M +@1 +D=D-M +@10 +D;JGT +@1 +D=M +@12 +0;JMP +@0 +D=M +@2 +M=D +@14 +0;JMP diff --git a/projects/06/pong/Pong.asm b/projects/06/pong/Pong.asm new file mode 100644 index 0000000..79691f0 --- /dev/null +++ b/projects/06/pong/Pong.asm @@ -0,0 +1,28375 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/06/pong/Pong.asm + +// The Pong game program was originally written in the high-level Jack language. +// The Jack code was then translated by the Jack compiler into VM code. +// The VM code was then translated by the VM translator into the Hack +// assembly code shown here. + +@256 +D=A +@SP +M=D +@133 +0;JMP +@R15 +M=D +@SP +AM=M-1 +D=M +A=A-1 +D=M-D +M=0 +@END_EQ +D;JNE +@SP +A=M-1 +M=-1 +(END_EQ) +@R15 +A=M +0;JMP +@R15 +M=D +@SP +AM=M-1 +D=M +A=A-1 +D=M-D +M=0 +@END_GT +D;JLE +@SP +A=M-1 +M=-1 +(END_GT) +@R15 +A=M +0;JMP +@R15 +M=D +@SP +AM=M-1 +D=M +A=A-1 +D=M-D +M=0 +@END_LT +D;JGE +@SP +A=M-1 +M=-1 +(END_LT) +@R15 +A=M +0;JMP +@5 +D=A +@LCL +A=M-D +D=M +@R13 +M=D +@SP +AM=M-1 +D=M +@ARG +A=M +M=D +D=A +@SP +M=D+1 +@LCL +D=M +@R14 +AM=D-1 +D=M +@THAT +M=D +@R14 +AM=M-1 +D=M +@THIS +M=D +@R14 +AM=M-1 +D=M +@ARG +M=D +@R14 +AM=M-1 +D=M +@LCL +M=D +@R13 +A=M +0;JMP +@SP +A=M +M=D +@LCL +D=M +@SP +AM=M+1 +M=D +@ARG +D=M +@SP +AM=M+1 +M=D +@THIS +D=M +@SP +AM=M+1 +M=D +@THAT +D=M +@SP +AM=M+1 +M=D +@4 +D=A +@R13 +D=D+M +@SP +D=M-D +@ARG +M=D +@SP +MD=M+1 +@LCL +M=D +@R14 +A=M +0;JMP +@0 +D=A +@R13 +M=D +@sys.init +D=A +@R14 +M=D +@RET_ADDRESS_CALL0 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL0) +(ball.new) +@15 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@memory.alloc +D=A +@R14 +M=D +@RET_ADDRESS_CALL1 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL1) +@SP +AM=M-1 +D=M +@THIS +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +A=M +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@10 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@THIS +D=M +@11 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@ARG +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@12 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@ARG +D=M +@5 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@THIS +D=M +@13 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@SP +M=M+1 +A=M-1 +M=0 +@THIS +D=M +@14 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@ball.show +D=A +@R14 +M=D +@RET_ADDRESS_CALL2 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL2) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(ball.dispose) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@memory.dealloc +D=A +@R14 +M=D +@RET_ADDRESS_CALL3 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL3) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(ball.show) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +A=M-1 +M=!M +@1 +D=A +@R13 +M=D +@screen.setcolor +D=A +@R14 +M=D +@RET_ADDRESS_CALL4 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL4) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@ball.draw +D=A +@R14 +M=D +@RET_ADDRESS_CALL5 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL5) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(ball.hide) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@SP +M=M+1 +A=M-1 +M=0 +@1 +D=A +@R13 +M=D +@screen.setcolor +D=A +@R14 +M=D +@RET_ADDRESS_CALL6 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL6) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@ball.draw +D=A +@R14 +M=D +@RET_ADDRESS_CALL7 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL7) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(ball.draw) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@5 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@5 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@4 +D=A +@R13 +M=D +@screen.drawrectangle +D=A +@R14 +M=D +@RET_ADDRESS_CALL8 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL8) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(ball.getleft) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(ball.getright) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@5 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@54 +0;JMP +(ball.setdestination) +@3 +D=A +(LOOP_ball.setdestination) +D=D-1 +@SP +AM=M+1 +A=A-1 +M=0 +@LOOP_ball.setdestination +D;JGT +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@math.abs +D=A +@R14 +M=D +@RET_ADDRESS_CALL9 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL9) +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@THIS +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@math.abs +D=A +@R14 +M=D +@RET_ADDRESS_CALL10 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL10) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT0 +D=A +@38 +0;JMP +(RET_ADDRESS_LT0) +@THIS +D=M +@7 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@THIS +D=M +@7 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ball.setdestination$if_true0 +D;JNE +@ball.setdestination$if_false0 +0;JMP +(ball.setdestination$if_true0) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT1 +D=A +@38 +0;JMP +(RET_ADDRESS_LT1) +@THIS +D=M +@8 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT2 +D=A +@38 +0;JMP +(RET_ADDRESS_LT2) +@THIS +D=M +@9 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@ball.setdestination$if_end0 +0;JMP +(ball.setdestination$if_false0) +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT3 +D=A +@38 +0;JMP +(RET_ADDRESS_LT3) +@THIS +D=M +@8 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT4 +D=A +@38 +0;JMP +(RET_ADDRESS_LT4) +@THIS +D=M +@9 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +(ball.setdestination$if_end0) +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL11 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL11) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL12 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL12) +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL13 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL13) +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(ball.move) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@ball.hide +D=A +@R14 +M=D +@RET_ADDRESS_CALL14 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL14) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT5 +D=A +@38 +0;JMP +(RET_ADDRESS_LT5) +@SP +AM=M-1 +D=M +@ball.move$if_true0 +D;JNE +@ball.move$if_false0 +0;JMP +(ball.move$if_true0) +@THIS +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@5 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@ball.move$if_end0 +0;JMP +(ball.move$if_false0) +@THIS +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@6 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@THIS +D=M +@9 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ball.move$if_true1 +D;JNE +@ball.move$if_false1 +0;JMP +(ball.move$if_true1) +@THIS +D=M +@7 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ball.move$if_true2 +D;JNE +@ball.move$if_false2 +0;JMP +(ball.move$if_true2) +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THIS +A=M +M=D +@ball.move$if_end2 +0;JMP +(ball.move$if_false2) +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THIS +A=M+1 +M=D +(ball.move$if_end2) +@ball.move$if_end1 +0;JMP +(ball.move$if_false1) +@THIS +D=M +@7 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ball.move$if_true3 +D;JNE +@ball.move$if_false3 +0;JMP +(ball.move$if_true3) +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@THIS +A=M +M=D +@ball.move$if_end3 +0;JMP +(ball.move$if_false3) +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +M=D +(ball.move$if_end3) +(ball.move$if_end1) +(ball.move$if_end0) +@THIS +D=M +@8 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ball.move$if_true4 +D;JNE +@ball.move$if_false4 +0;JMP +(ball.move$if_true4) +@THIS +D=M +@7 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ball.move$if_true5 +D;JNE +@ball.move$if_false5 +0;JMP +(ball.move$if_true5) +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THIS +A=M+1 +M=D +@ball.move$if_end5 +0;JMP +(ball.move$if_false5) +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THIS +A=M +M=D +(ball.move$if_end5) +@ball.move$if_end4 +0;JMP +(ball.move$if_false4) +@THIS +D=M +@7 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ball.move$if_true6 +D;JNE +@ball.move$if_false6 +0;JMP +(ball.move$if_true6) +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +M=D +@ball.move$if_end6 +0;JMP +(ball.move$if_false6) +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@THIS +A=M +M=D +(ball.move$if_end6) +(ball.move$if_end4) +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@10 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT0 +D=A +@22 +0;JMP +(RET_ADDRESS_GT0) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@ball.move$if_true7 +D;JNE +@ball.move$if_false7 +0;JMP +(ball.move$if_true7) +@SP +M=M+1 +A=M-1 +M=1 +@THIS +D=M +@14 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@THIS +D=M +@10 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +A=M +M=D +(ball.move$if_false7) +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@11 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT6 +D=A +@38 +0;JMP +(RET_ADDRESS_LT6) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@ball.move$if_true8 +D;JNE +@ball.move$if_false8 +0;JMP +(ball.move$if_true8) +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@14 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@THIS +D=M +@11 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +A=M +M=D +(ball.move$if_false8) +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@12 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT1 +D=A +@22 +0;JMP +(RET_ADDRESS_GT1) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@ball.move$if_true9 +D;JNE +@ball.move$if_false9 +0;JMP +(ball.move$if_true9) +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@14 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@THIS +D=M +@12 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +M=D +(ball.move$if_false9) +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@13 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT7 +D=A +@38 +0;JMP +(RET_ADDRESS_LT7) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@ball.move$if_true10 +D;JNE +@ball.move$if_false10 +0;JMP +(ball.move$if_true10) +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@14 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@THIS +D=M +@13 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +M=D +(ball.move$if_false10) +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@ball.show +D=A +@R14 +M=D +@RET_ADDRESS_CALL15 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL15) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +D=M +@14 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(ball.bounce) +@5 +D=A +(LOOP_ball.bounce) +D=D-1 +@SP +AM=M+1 +A=A-1 +M=0 +@LOOP_ball.bounce +D;JGT +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@10 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.divide +D=A +@R14 +M=D +@RET_ADDRESS_CALL16 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL16) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +@THIS +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@10 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.divide +D=A +@R14 +M=D +@RET_ADDRESS_CALL17 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL17) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_EQ0 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ0) +@SP +AM=M-1 +D=M +@ball.bounce$if_true0 +D;JNE +@ball.bounce$if_false0 +0;JMP +(ball.bounce$if_true0) +@10 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@ball.bounce$if_end0 +0;JMP +(ball.bounce$if_false0) +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT8 +D=A +@38 +0;JMP +(RET_ADDRESS_LT8) +@SP +A=M-1 +M=!M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@RET_ADDRESS_EQ1 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ1) +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT9 +D=A +@38 +0;JMP +(RET_ADDRESS_LT9) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +A=M-1 +D=!M +M=D+1 +@RET_ADDRESS_EQ2 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ2) +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@SP +AM=M-1 +D=M +@ball.bounce$if_true1 +D;JNE +@ball.bounce$if_false1 +0;JMP +(ball.bounce$if_true1) +@20 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@ball.bounce$if_end1 +0;JMP +(ball.bounce$if_false1) +@5 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +(ball.bounce$if_end1) +(ball.bounce$if_end0) +@THIS +D=M +@14 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@RET_ADDRESS_EQ3 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ3) +@SP +AM=M-1 +D=M +@ball.bounce$if_true2 +D;JNE +@ball.bounce$if_false2 +0;JMP +(ball.bounce$if_true2) +@506 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@50 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +D=!M +M=D+1 +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL18 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL18) +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.divide +D=A +@R14 +M=D +@RET_ADDRESS_CALL19 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL19) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL20 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL20) +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@ball.bounce$if_end2 +0;JMP +(ball.bounce$if_false2) +@THIS +D=M +@14 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_EQ4 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ4) +@SP +AM=M-1 +D=M +@ball.bounce$if_true3 +D;JNE +@ball.bounce$if_false3 +0;JMP +(ball.bounce$if_true3) +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@50 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL21 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL21) +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.divide +D=A +@R14 +M=D +@RET_ADDRESS_CALL22 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL22) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL23 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL23) +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@ball.bounce$if_end3 +0;JMP +(ball.bounce$if_false3) +@THIS +D=M +@14 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_EQ5 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ5) +@SP +AM=M-1 +D=M +@ball.bounce$if_true4 +D;JNE +@ball.bounce$if_false4 +0;JMP +(ball.bounce$if_true4) +@250 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@25 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +D=!M +M=D+1 +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL24 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL24) +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.divide +D=A +@R14 +M=D +@RET_ADDRESS_CALL25 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL25) +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL26 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL26) +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@ball.bounce$if_end4 +0;JMP +(ball.bounce$if_false4) +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@25 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL27 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL27) +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.divide +D=A +@R14 +M=D +@RET_ADDRESS_CALL28 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL28) +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL29 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL29) +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +(ball.bounce$if_end4) +(ball.bounce$if_end3) +(ball.bounce$if_end2) +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@R13 +M=D +@ball.setdestination +D=A +@R14 +M=D +@RET_ADDRESS_CALL30 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL30) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(bat.new) +@5 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@memory.alloc +D=A +@R14 +M=D +@RET_ADDRESS_CALL31 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL31) +@SP +AM=M-1 +D=M +@THIS +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +A=M +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +M=D +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@bat.show +D=A +@R14 +M=D +@RET_ADDRESS_CALL32 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL32) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(bat.dispose) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@memory.dealloc +D=A +@R14 +M=D +@RET_ADDRESS_CALL33 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL33) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(bat.show) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +A=M-1 +M=!M +@1 +D=A +@R13 +M=D +@screen.setcolor +D=A +@R14 +M=D +@RET_ADDRESS_CALL34 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL34) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@bat.draw +D=A +@R14 +M=D +@RET_ADDRESS_CALL35 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL35) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(bat.hide) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@SP +M=M+1 +A=M-1 +M=0 +@1 +D=A +@R13 +M=D +@screen.setcolor +D=A +@R14 +M=D +@RET_ADDRESS_CALL36 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL36) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@bat.draw +D=A +@R14 +M=D +@RET_ADDRESS_CALL37 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL37) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(bat.draw) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@4 +D=A +@R13 +M=D +@screen.drawrectangle +D=A +@R14 +M=D +@RET_ADDRESS_CALL38 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL38) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(bat.setdirection) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(bat.getleft) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(bat.getright) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@54 +0;JMP +(bat.setwidth) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@bat.hide +D=A +@R14 +M=D +@RET_ADDRESS_CALL39 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL39) +@SP +AM=M-1 +D=M +@R5 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@bat.show +D=A +@R14 +M=D +@RET_ADDRESS_CALL40 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL40) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(bat.move) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@RET_ADDRESS_EQ6 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ6) +@SP +AM=M-1 +D=M +@bat.move$if_true0 +D;JNE +@bat.move$if_false0 +0;JMP +(bat.move$if_true0) +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@THIS +A=M +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT10 +D=A +@38 +0;JMP +(RET_ADDRESS_LT10) +@SP +AM=M-1 +D=M +@bat.move$if_true1 +D;JNE +@bat.move$if_false1 +0;JMP +(bat.move$if_true1) +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@THIS +A=M +M=D +(bat.move$if_false1) +@SP +M=M+1 +A=M-1 +M=0 +@1 +D=A +@R13 +M=D +@screen.setcolor +D=A +@R14 +M=D +@RET_ADDRESS_CALL41 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL41) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@4 +D=A +@R13 +M=D +@screen.drawrectangle +D=A +@R14 +M=D +@RET_ADDRESS_CALL42 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL42) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +A=M-1 +M=!M +@1 +D=A +@R13 +M=D +@screen.setcolor +D=A +@R14 +M=D +@RET_ADDRESS_CALL43 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL43) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@4 +D=A +@R13 +M=D +@screen.drawrectangle +D=A +@R14 +M=D +@RET_ADDRESS_CALL44 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL44) +@SP +AM=M-1 +D=M +@R5 +M=D +@bat.move$if_end0 +0;JMP +(bat.move$if_false0) +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THIS +A=M +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@511 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT2 +D=A +@22 +0;JMP +(RET_ADDRESS_GT2) +@SP +AM=M-1 +D=M +@bat.move$if_true2 +D;JNE +@bat.move$if_false2 +0;JMP +(bat.move$if_true2) +@511 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@THIS +A=M +M=D +(bat.move$if_false2) +@SP +M=M+1 +A=M-1 +M=0 +@1 +D=A +@R13 +M=D +@screen.setcolor +D=A +@R14 +M=D +@RET_ADDRESS_CALL45 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL45) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@4 +D=A +@R13 +M=D +@screen.drawrectangle +D=A +@R14 +M=D +@RET_ADDRESS_CALL46 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL46) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +A=M-1 +M=!M +@1 +D=A +@R13 +M=D +@screen.setcolor +D=A +@R14 +M=D +@RET_ADDRESS_CALL47 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL47) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@4 +D=A +@R13 +M=D +@screen.drawrectangle +D=A +@R14 +M=D +@RET_ADDRESS_CALL48 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL48) +@SP +AM=M-1 +D=M +@R5 +M=D +(bat.move$if_end0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(main.main) +@SP +AM=M+1 +A=A-1 +M=0 +@0 +D=A +@R13 +M=D +@ponggame.newinstance +D=A +@R14 +M=D +@RET_ADDRESS_CALL49 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL49) +@SP +AM=M-1 +D=M +@R5 +M=D +@0 +D=A +@R13 +M=D +@ponggame.getinstance +D=A +@R14 +M=D +@RET_ADDRESS_CALL50 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL50) +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@ponggame.run +D=A +@R14 +M=D +@RET_ADDRESS_CALL51 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL51) +@SP +AM=M-1 +D=M +@R5 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@ponggame.dispose +D=A +@R14 +M=D +@RET_ADDRESS_CALL52 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL52) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(ponggame.new) +@7 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@memory.alloc +D=A +@R14 +M=D +@RET_ADDRESS_CALL53 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL53) +@SP +AM=M-1 +D=M +@THIS +M=D +@0 +D=A +@R13 +M=D +@screen.clearscreen +D=A +@R14 +M=D +@RET_ADDRESS_CALL54 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL54) +@SP +AM=M-1 +D=M +@R5 +M=D +@50 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@230 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@229 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@6 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@7 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@R13 +M=D +@bat.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL55 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL55) +@SP +AM=M-1 +D=M +@THIS +A=M +M=D +@253 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@222 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@511 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@229 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@R13 +M=D +@ball.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL56 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL56) +@SP +AM=M-1 +D=M +@THIS +A=M+1 +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@400 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@3 +D=A +@R13 +M=D +@ball.setdestination +D=A +@R14 +M=D +@RET_ADDRESS_CALL57 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL57) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@238 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@511 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@240 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@R13 +M=D +@screen.drawrectangle +D=A +@R14 +M=D +@RET_ADDRESS_CALL58 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL58) +@SP +AM=M-1 +D=M +@R5 +M=D +@22 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@2 +D=A +@R13 +M=D +@output.movecursor +D=A +@R14 +M=D +@RET_ADDRESS_CALL59 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL59) +@SP +AM=M-1 +D=M +@R5 +M=D +@8 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@string.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL60 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL60) +@83 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL61 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL61) +@99 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL62 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL62) +@111 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL63 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL63) +@114 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL64 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL64) +@101 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL65 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL65) +@58 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL66 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL66) +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL67 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL67) +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL68 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL68) +@1 +D=A +@R13 +M=D +@output.printstring +D=A +@R14 +M=D +@RET_ADDRESS_CALL69 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL69) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(ponggame.dispose) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@bat.dispose +D=A +@R14 +M=D +@RET_ADDRESS_CALL70 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL70) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@ball.dispose +D=A +@R14 +M=D +@RET_ADDRESS_CALL71 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL71) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@memory.dealloc +D=A +@R14 +M=D +@RET_ADDRESS_CALL72 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL72) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(ponggame.newinstance) +@0 +D=A +@R13 +M=D +@ponggame.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL73 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL73) +@SP +AM=M-1 +D=M +@ponggame.0 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(ponggame.getinstance) +@ponggame.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(ponggame.run) +@SP +AM=M+1 +A=A-1 +M=0 +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +(ponggame.run$while_exp0) +@THIS +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +M=!M +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@ponggame.run$while_end0 +D;JNE +(ponggame.run$while_exp1) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_EQ7 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ7) +@THIS +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@ponggame.run$while_end1 +D;JNE +@0 +D=A +@R13 +M=D +@keyboard.keypressed +D=A +@R14 +M=D +@RET_ADDRESS_CALL74 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL74) +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@bat.move +D=A +@R14 +M=D +@RET_ADDRESS_CALL75 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL75) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@ponggame.moveball +D=A +@R14 +M=D +@RET_ADDRESS_CALL76 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL76) +@SP +AM=M-1 +D=M +@R5 +M=D +@ponggame.run$while_exp1 +0;JMP +(ponggame.run$while_end1) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@130 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_EQ8 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ8) +@SP +AM=M-1 +D=M +@ponggame.run$if_true0 +D;JNE +@ponggame.run$if_false0 +0;JMP +(ponggame.run$if_true0) +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@2 +D=A +@R13 +M=D +@bat.setdirection +D=A +@R14 +M=D +@RET_ADDRESS_CALL77 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL77) +@SP +AM=M-1 +D=M +@R5 +M=D +@ponggame.run$if_end0 +0;JMP +(ponggame.run$if_false0) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@132 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_EQ9 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ9) +@SP +AM=M-1 +D=M +@ponggame.run$if_true1 +D;JNE +@ponggame.run$if_false1 +0;JMP +(ponggame.run$if_true1) +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@bat.setdirection +D=A +@R14 +M=D +@RET_ADDRESS_CALL78 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL78) +@SP +AM=M-1 +D=M +@R5 +M=D +@ponggame.run$if_end1 +0;JMP +(ponggame.run$if_false1) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@140 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_EQ10 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ10) +@SP +AM=M-1 +D=M +@ponggame.run$if_true2 +D;JNE +@ponggame.run$if_false2 +0;JMP +(ponggame.run$if_true2) +@SP +M=M+1 +A=M-1 +M=0 +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +M=D +(ponggame.run$if_false2) +(ponggame.run$if_end1) +(ponggame.run$if_end0) +(ponggame.run$while_exp2) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_EQ11 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ11) +@SP +A=M-1 +M=!M +@THIS +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@ponggame.run$while_end2 +D;JNE +@0 +D=A +@R13 +M=D +@keyboard.keypressed +D=A +@R14 +M=D +@RET_ADDRESS_CALL79 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL79) +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@bat.move +D=A +@R14 +M=D +@RET_ADDRESS_CALL80 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL80) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@ponggame.moveball +D=A +@R14 +M=D +@RET_ADDRESS_CALL81 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL81) +@SP +AM=M-1 +D=M +@R5 +M=D +@ponggame.run$while_exp2 +0;JMP +(ponggame.run$while_end2) +@ponggame.run$while_exp0 +0;JMP +(ponggame.run$while_end0) +@THIS +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ponggame.run$if_true3 +D;JNE +@ponggame.run$if_false3 +0;JMP +(ponggame.run$if_true3) +@10 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@output.movecursor +D=A +@R14 +M=D +@RET_ADDRESS_CALL82 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL82) +@SP +AM=M-1 +D=M +@R5 +M=D +@9 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@string.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL83 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL83) +@71 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL84 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL84) +@97 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL85 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL85) +@109 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL86 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL86) +@101 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL87 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL87) +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL88 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL88) +@79 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL89 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL89) +@118 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL90 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL90) +@101 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL91 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL91) +@114 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL92 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL92) +@1 +D=A +@R13 +M=D +@output.printstring +D=A +@R14 +M=D +@RET_ADDRESS_CALL93 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL93) +@SP +AM=M-1 +D=M +@R5 +M=D +(ponggame.run$if_false3) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(ponggame.moveball) +@5 +D=A +(LOOP_ponggame.moveball) +D=D-1 +@SP +AM=M+1 +A=A-1 +M=0 +@LOOP_ponggame.moveball +D;JGT +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@ball.move +D=A +@R14 +M=D +@RET_ADDRESS_CALL94 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL94) +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_GT3 +D=A +@22 +0;JMP +(RET_ADDRESS_GT3) +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@5 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_EQ12 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ12) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@SP +AM=M-1 +D=M +@ponggame.moveball$if_true0 +D;JNE +@ponggame.moveball$if_false0 +0;JMP +(ponggame.moveball$if_true0) +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@bat.getleft +D=A +@R14 +M=D +@RET_ADDRESS_CALL95 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL95) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@bat.getright +D=A +@R14 +M=D +@RET_ADDRESS_CALL96 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL96) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@ball.getleft +D=A +@R14 +M=D +@RET_ADDRESS_CALL97 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL97) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@ball.getright +D=A +@R14 +M=D +@RET_ADDRESS_CALL98 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL98) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_EQ13 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ13) +@SP +AM=M-1 +D=M +@ponggame.moveball$if_true1 +D;JNE +@ponggame.moveball$if_false1 +0;JMP +(ponggame.moveball$if_true1) +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT4 +D=A +@22 +0;JMP +(RET_ADDRESS_GT4) +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT11 +D=A +@38 +0;JMP +(RET_ADDRESS_LT11) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +M=D +@THIS +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@ponggame.moveball$if_true2 +D;JNE +@ponggame.moveball$if_false2 +0;JMP +(ponggame.moveball$if_true2) +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@10 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@RET_ADDRESS_LT12 +D=A +@38 +0;JMP +(RET_ADDRESS_LT12) +@SP +AM=M-1 +D=M +@ponggame.moveball$if_true3 +D;JNE +@ponggame.moveball$if_false3 +0;JMP +(ponggame.moveball$if_true3) +@SP +M=M+1 +A=M-1 +M=1 +@SP +A=M-1 +D=!M +M=D+1 +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@ponggame.moveball$if_end3 +0;JMP +(ponggame.moveball$if_false3) +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@10 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@RET_ADDRESS_GT5 +D=A +@22 +0;JMP +(RET_ADDRESS_GT5) +@SP +AM=M-1 +D=M +@ponggame.moveball$if_true4 +D;JNE +@ponggame.moveball$if_false4 +0;JMP +(ponggame.moveball$if_true4) +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +(ponggame.moveball$if_false4) +(ponggame.moveball$if_end3) +@THIS +D=M +@6 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +D=M +@6 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@bat.setwidth +D=A +@R14 +M=D +@RET_ADDRESS_CALL99 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL99) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@22 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@7 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@output.movecursor +D=A +@R14 +M=D +@RET_ADDRESS_CALL100 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL100) +@SP +AM=M-1 +D=M +@R5 +M=D +@THIS +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@output.printint +D=A +@R14 +M=D +@RET_ADDRESS_CALL101 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL101) +@SP +AM=M-1 +D=M +@R5 +M=D +(ponggame.moveball$if_false2) +(ponggame.moveball$if_false1) +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@ball.bounce +D=A +@R14 +M=D +@RET_ADDRESS_CALL102 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL102) +@SP +AM=M-1 +D=M +@R5 +M=D +(ponggame.moveball$if_false0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(array.new) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_GT6 +D=A +@22 +0;JMP +(RET_ADDRESS_GT6) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@array.new$if_true0 +D;JNE +@array.new$if_false0 +0;JMP +(array.new$if_true0) +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL103 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL103) +@SP +AM=M-1 +D=M +@R5 +M=D +(array.new$if_false0) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@memory.alloc +D=A +@R14 +M=D +@RET_ADDRESS_CALL104 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL104) +@54 +0;JMP +(array.dispose) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@memory.dealloc +D=A +@R14 +M=D +@RET_ADDRESS_CALL105 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL105) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(keyboard.init) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(keyboard.keypressed) +@24576 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@memory.peek +D=A +@R14 +M=D +@RET_ADDRESS_CALL106 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL106) +@54 +0;JMP +(keyboard.readchar) +@SP +A=M +M=0 +AD=A+1 +M=0 +@SP +M=D+1 +@SP +M=M+1 +A=M-1 +M=0 +@1 +D=A +@R13 +M=D +@output.printchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL107 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL107) +@SP +AM=M-1 +D=M +@R5 +M=D +(keyboard.readchar$while_exp0) +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_EQ14 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ14) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_GT7 +D=A +@22 +0;JMP +(RET_ADDRESS_GT7) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@keyboard.readchar$while_end0 +D;JNE +@0 +D=A +@R13 +M=D +@keyboard.keypressed +D=A +@R14 +M=D +@RET_ADDRESS_CALL108 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL108) +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_GT8 +D=A +@22 +0;JMP +(RET_ADDRESS_GT8) +@SP +AM=M-1 +D=M +@keyboard.readchar$if_true0 +D;JNE +@keyboard.readchar$if_false0 +0;JMP +(keyboard.readchar$if_true0) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +(keyboard.readchar$if_false0) +@keyboard.readchar$while_exp0 +0;JMP +(keyboard.readchar$while_end0) +@0 +D=A +@R13 +M=D +@string.backspace +D=A +@R14 +M=D +@RET_ADDRESS_CALL109 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL109) +@1 +D=A +@R13 +M=D +@output.printchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL110 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL110) +@SP +AM=M-1 +D=M +@R5 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@output.printchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL111 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL111) +@SP +AM=M-1 +D=M +@R5 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(keyboard.readline) +@5 +D=A +(LOOP_keyboard.readline) +D=D-1 +@SP +AM=M+1 +A=A-1 +M=0 +@LOOP_keyboard.readline +D;JGT +@80 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@string.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL112 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL112) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@output.printstring +D=A +@R14 +M=D +@RET_ADDRESS_CALL113 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL113) +@SP +AM=M-1 +D=M +@R5 +M=D +@0 +D=A +@R13 +M=D +@string.newline +D=A +@R14 +M=D +@RET_ADDRESS_CALL114 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL114) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@0 +D=A +@R13 +M=D +@string.backspace +D=A +@R14 +M=D +@RET_ADDRESS_CALL115 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL115) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +(keyboard.readline$while_exp0) +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +M=!M +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@keyboard.readline$while_end0 +D;JNE +@0 +D=A +@R13 +M=D +@keyboard.readchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL116 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL116) +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_EQ15 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ15) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@keyboard.readline$if_true0 +D;JNE +@keyboard.readline$if_false0 +0;JMP +(keyboard.readline$if_true0) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_EQ16 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ16) +@SP +AM=M-1 +D=M +@keyboard.readline$if_true1 +D;JNE +@keyboard.readline$if_false1 +0;JMP +(keyboard.readline$if_true1) +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@string.eraselastchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL117 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL117) +@SP +AM=M-1 +D=M +@R5 +M=D +@keyboard.readline$if_end1 +0;JMP +(keyboard.readline$if_false1) +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL118 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL118) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +(keyboard.readline$if_end1) +(keyboard.readline$if_false0) +@keyboard.readline$while_exp0 +0;JMP +(keyboard.readline$while_end0) +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(keyboard.readint) +@SP +A=M +M=0 +AD=A+1 +M=0 +@SP +M=D+1 +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@keyboard.readline +D=A +@R14 +M=D +@RET_ADDRESS_CALL119 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL119) +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@string.intvalue +D=A +@R14 +M=D +@RET_ADDRESS_CALL120 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL120) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@string.dispose +D=A +@R14 +M=D +@RET_ADDRESS_CALL121 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL121) +@SP +AM=M-1 +D=M +@R5 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(math.init) +@SP +AM=M+1 +A=A-1 +M=0 +@16 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@array.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL122 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL122) +@SP +AM=M-1 +D=M +@math.1 +M=D +@16 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@array.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL123 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL123) +@SP +AM=M-1 +D=M +@math.0 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@math.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +(math.init$while_exp0) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@15 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT13 +D=A +@38 +0;JMP +(RET_ADDRESS_LT13) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@math.init$while_end0 +D;JNE +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@math.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@math.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@math.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@math.init$while_exp0 +0;JMP +(math.init$while_end0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(math.abs) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT14 +D=A +@38 +0;JMP +(RET_ADDRESS_LT14) +@SP +AM=M-1 +D=M +@math.abs$if_true0 +D;JNE +@math.abs$if_false0 +0;JMP +(math.abs$if_true0) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +D=!M +M=D+1 +@SP +AM=M-1 +D=M +@ARG +A=M +M=D +(math.abs$if_false0) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(math.multiply) +@5 +D=A +(LOOP_math.multiply) +D=D-1 +@SP +AM=M+1 +A=A-1 +M=0 +@LOOP_math.multiply +D;JGT +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT15 +D=A +@38 +0;JMP +(RET_ADDRESS_LT15) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_GT9 +D=A +@22 +0;JMP +(RET_ADDRESS_GT9) +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_GT10 +D=A +@22 +0;JMP +(RET_ADDRESS_GT10) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT16 +D=A +@38 +0;JMP +(RET_ADDRESS_LT16) +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@math.abs +D=A +@R14 +M=D +@RET_ADDRESS_CALL124 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL124) +@SP +AM=M-1 +D=M +@ARG +A=M +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@math.abs +D=A +@R14 +M=D +@RET_ADDRESS_CALL125 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL125) +@SP +AM=M-1 +D=M +@ARG +A=M+1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT17 +D=A +@38 +0;JMP +(RET_ADDRESS_LT17) +@SP +AM=M-1 +D=M +@math.multiply$if_true0 +D;JNE +@math.multiply$if_false0 +0;JMP +(math.multiply$if_true0) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ARG +A=M +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ARG +A=M+1 +M=D +(math.multiply$if_false0) +(math.multiply$while_exp0) +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT18 +D=A +@38 +0;JMP +(RET_ADDRESS_LT18) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@math.multiply$while_end0 +D;JNE +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@math.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_GT11 +D=A +@22 +0;JMP +(RET_ADDRESS_GT11) +@SP +AM=M-1 +D=M +@math.multiply$if_true1 +D;JNE +@math.multiply$if_false1 +0;JMP +(math.multiply$if_true1) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@math.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +(math.multiply$if_false1) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@ARG +A=M +M=D +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +@math.multiply$while_exp0 +0;JMP +(math.multiply$while_end0) +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@math.multiply$if_true2 +D;JNE +@math.multiply$if_false2 +0;JMP +(math.multiply$if_true2) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +D=!M +M=D+1 +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +(math.multiply$if_false2) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(math.divide) +@4 +D=A +(LOOP_math.divide) +D=D-1 +@SP +AM=M+1 +A=A-1 +M=0 +@LOOP_math.divide +D;JGT +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_EQ17 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ17) +@SP +AM=M-1 +D=M +@math.divide$if_true0 +D;JNE +@math.divide$if_false0 +0;JMP +(math.divide$if_true0) +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL126 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL126) +@SP +AM=M-1 +D=M +@R5 +M=D +(math.divide$if_false0) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT19 +D=A +@38 +0;JMP +(RET_ADDRESS_LT19) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_GT12 +D=A +@22 +0;JMP +(RET_ADDRESS_GT12) +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_GT13 +D=A +@22 +0;JMP +(RET_ADDRESS_GT13) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT20 +D=A +@38 +0;JMP +(RET_ADDRESS_LT20) +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@math.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@math.abs +D=A +@R14 +M=D +@RET_ADDRESS_CALL127 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL127) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@math.abs +D=A +@R14 +M=D +@RET_ADDRESS_CALL128 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL128) +@SP +AM=M-1 +D=M +@ARG +A=M +M=D +(math.divide$while_exp0) +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +M=!M +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@math.divide$while_end0 +D;JNE +@32767 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@math.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@math.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT21 +D=A +@38 +0;JMP +(RET_ADDRESS_LT21) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@math.divide$if_true1 +D;JNE +@math.divide$if_false1 +0;JMP +(math.divide$if_true1) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@math.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@math.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@math.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@math.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT14 +D=A +@22 +0;JMP +(RET_ADDRESS_GT14) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@math.divide$if_true2 +D;JNE +@math.divide$if_false2 +0;JMP +(math.divide$if_true2) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +(math.divide$if_false2) +(math.divide$if_false1) +@math.divide$while_exp0 +0;JMP +(math.divide$while_end0) +(math.divide$while_exp1) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +A=M-1 +D=!M +M=D+1 +@RET_ADDRESS_GT15 +D=A +@22 +0;JMP +(RET_ADDRESS_GT15) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@math.divide$while_end1 +D;JNE +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@math.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT16 +D=A +@22 +0;JMP +(RET_ADDRESS_GT16) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@math.divide$if_true3 +D;JNE +@math.divide$if_false3 +0;JMP +(math.divide$if_true3) +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@math.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@math.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@ARG +A=M +M=D +(math.divide$if_false3) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@math.divide$while_exp1 +0;JMP +(math.divide$while_end1) +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@math.divide$if_true4 +D;JNE +@math.divide$if_false4 +0;JMP +(math.divide$if_true4) +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +D=!M +M=D+1 +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +(math.divide$if_false4) +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(math.sqrt) +@4 +D=A +(LOOP_math.sqrt) +D=D-1 +@SP +AM=M+1 +A=A-1 +M=0 +@LOOP_math.sqrt +D;JGT +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT22 +D=A +@38 +0;JMP +(RET_ADDRESS_LT22) +@SP +AM=M-1 +D=M +@math.sqrt$if_true0 +D;JNE +@math.sqrt$if_false0 +0;JMP +(math.sqrt$if_true0) +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL129 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL129) +@SP +AM=M-1 +D=M +@R5 +M=D +(math.sqrt$if_false0) +@7 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +(math.sqrt$while_exp0) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +A=M-1 +D=!M +M=D+1 +@RET_ADDRESS_GT17 +D=A +@22 +0;JMP +(RET_ADDRESS_GT17) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@math.sqrt$while_end0 +D;JNE +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@math.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL130 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL130) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT18 +D=A +@22 +0;JMP +(RET_ADDRESS_GT18) +@SP +A=M-1 +M=!M +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT23 +D=A +@38 +0;JMP +(RET_ADDRESS_LT23) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@SP +AM=M-1 +D=M +@math.sqrt$if_true1 +D;JNE +@math.sqrt$if_false1 +0;JMP +(math.sqrt$if_true1) +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +(math.sqrt$if_false1) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@math.sqrt$while_exp0 +0;JMP +(math.sqrt$while_end0) +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(math.max) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT19 +D=A +@22 +0;JMP +(RET_ADDRESS_GT19) +@SP +AM=M-1 +D=M +@math.max$if_true0 +D;JNE +@math.max$if_false0 +0;JMP +(math.max$if_true0) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ARG +A=M+1 +M=D +(math.max$if_false0) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(math.min) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT24 +D=A +@38 +0;JMP +(RET_ADDRESS_LT24) +@SP +AM=M-1 +D=M +@math.min$if_true0 +D;JNE +@math.min$if_false0 +0;JMP +(math.min$if_true0) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ARG +A=M+1 +M=D +(math.min$if_false0) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(memory.init) +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@memory.0 +M=D +@2048 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@memory.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@14334 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@2049 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@memory.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@2050 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(memory.peek) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@memory.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(memory.poke) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@memory.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(memory.alloc) +@SP +AM=M+1 +A=A-1 +M=0 +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@RET_ADDRESS_LT25 +D=A +@38 +0;JMP +(RET_ADDRESS_LT25) +@SP +AM=M-1 +D=M +@memory.alloc$if_true0 +D;JNE +@memory.alloc$if_false0 +0;JMP +(memory.alloc$if_true0) +@5 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL131 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL131) +@SP +AM=M-1 +D=M +@R5 +M=D +(memory.alloc$if_false0) +@2048 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +(memory.alloc$while_exp0) +@SP +M=M+1 +A=M-1 +M=0 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT26 +D=A +@38 +0;JMP +(RET_ADDRESS_LT26) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@memory.alloc$while_end0 +D;JNE +@SP +M=M+1 +A=M-1 +M=1 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@memory.alloc$while_exp0 +0;JMP +(memory.alloc$while_end0) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@16379 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT20 +D=A +@22 +0;JMP +(RET_ADDRESS_GT20) +@SP +AM=M-1 +D=M +@memory.alloc$if_true1 +D;JNE +@memory.alloc$if_false1 +0;JMP +(memory.alloc$if_true1) +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL132 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL132) +@SP +AM=M-1 +D=M +@R5 +M=D +(memory.alloc$if_false1) +@SP +M=M+1 +A=M-1 +M=0 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@RET_ADDRESS_GT21 +D=A +@22 +0;JMP +(RET_ADDRESS_GT21) +@SP +AM=M-1 +D=M +@memory.alloc$if_true2 +D;JNE +@memory.alloc$if_false2 +0;JMP +(memory.alloc$if_true2) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +M=M+1 +A=M-1 +M=0 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@SP +M=M+1 +A=M-1 +M=1 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@RET_ADDRESS_EQ18 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ18) +@SP +AM=M-1 +D=M +@memory.alloc$if_true3 +D;JNE +@memory.alloc$if_false3 +0;JMP +(memory.alloc$if_true3) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@memory.alloc$if_end3 +0;JMP +(memory.alloc$if_false3) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +M=M+1 +A=M-1 +M=1 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +(memory.alloc$if_end3) +@SP +M=M+1 +A=M-1 +M=1 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +(memory.alloc$if_false2) +@SP +M=M+1 +A=M-1 +M=0 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@54 +0;JMP +(memory.dealloc) +@SP +A=M +M=0 +AD=A+1 +M=0 +@SP +M=D+1 +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@SP +M=M+1 +A=M-1 +M=1 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_EQ19 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ19) +@SP +AM=M-1 +D=M +@memory.dealloc$if_true0 +D;JNE +@memory.dealloc$if_false0 +0;JMP +(memory.dealloc$if_true0) +@SP +M=M+1 +A=M-1 +M=0 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +M=M+1 +A=M-1 +M=1 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@memory.dealloc$if_end0 +0;JMP +(memory.dealloc$if_false0) +@SP +M=M+1 +A=M-1 +M=0 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +M=M+1 +A=M-1 +M=1 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +M=M+1 +A=M-1 +M=0 +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@SP +M=M+1 +A=M-1 +M=1 +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@RET_ADDRESS_EQ20 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ20) +@SP +AM=M-1 +D=M +@memory.dealloc$if_true1 +D;JNE +@memory.dealloc$if_false1 +0;JMP +(memory.dealloc$if_true1) +@SP +M=M+1 +A=M-1 +M=1 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@memory.dealloc$if_end1 +0;JMP +(memory.dealloc$if_false1) +@SP +M=M+1 +A=M-1 +M=1 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +M=M+1 +A=M-1 +M=1 +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +(memory.dealloc$if_end1) +(memory.dealloc$if_end0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(output.init) +@16384 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@output.4 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@output.2 +M=D +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@output.1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@output.0 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@string.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL133 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL133) +@SP +AM=M-1 +D=M +@output.3 +M=D +@0 +D=A +@R13 +M=D +@output.initmap +D=A +@R14 +M=D +@RET_ADDRESS_CALL134 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL134) +@SP +AM=M-1 +D=M +@R5 +M=D +@0 +D=A +@R13 +M=D +@output.createshiftedmap +D=A +@R14 +M=D +@RET_ADDRESS_CALL135 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL135) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(output.initmap) +@127 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@array.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL136 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL136) +@SP +AM=M-1 +D=M +@output.5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL137 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL137) +@SP +AM=M-1 +D=M +@R5 +M=D +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL138 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL138) +@SP +AM=M-1 +D=M +@R5 +M=D +@33 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL139 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL139) +@SP +AM=M-1 +D=M +@R5 +M=D +@34 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@20 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL140 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL140) +@SP +AM=M-1 +D=M +@R5 +M=D +@35 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@18 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@18 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@18 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@18 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@18 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@18 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL141 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL141) +@SP +AM=M-1 +D=M +@R5 +M=D +@36 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL142 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL142) +@SP +AM=M-1 +D=M +@R5 +M=D +@37 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@35 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@49 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL143 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL143) +@SP +AM=M-1 +D=M +@R5 +M=D +@38 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL144 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL144) +@SP +AM=M-1 +D=M +@R5 +M=D +@39 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL145 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL145) +@SP +AM=M-1 +D=M +@R5 +M=D +@40 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL146 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL146) +@SP +AM=M-1 +D=M +@R5 +M=D +@41 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL147 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL147) +@SP +AM=M-1 +D=M +@R5 +M=D +@42 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL148 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL148) +@SP +AM=M-1 +D=M +@R5 +M=D +@43 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL149 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL149) +@SP +AM=M-1 +D=M +@R5 +M=D +@44 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL150 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL150) +@SP +AM=M-1 +D=M +@R5 +M=D +@45 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL151 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL151) +@SP +AM=M-1 +D=M +@R5 +M=D +@46 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL152 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL152) +@SP +AM=M-1 +D=M +@R5 +M=D +@47 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL153 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL153) +@SP +AM=M-1 +D=M +@R5 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL154 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL154) +@SP +AM=M-1 +D=M +@R5 +M=D +@49 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@14 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@15 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL155 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL155) +@SP +AM=M-1 +D=M +@R5 +M=D +@50 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL156 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL156) +@SP +AM=M-1 +D=M +@R5 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@28 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL157 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL157) +@SP +AM=M-1 +D=M +@R5 +M=D +@52 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@16 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@28 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@26 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@25 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@60 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL158 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL158) +@SP +AM=M-1 +D=M +@R5 +M=D +@53 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@31 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL159 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL159) +@SP +AM=M-1 +D=M +@R5 +M=D +@54 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@28 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@31 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL160 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL160) +@SP +AM=M-1 +D=M +@R5 +M=D +@55 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@49 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL161 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL161) +@SP +AM=M-1 +D=M +@R5 +M=D +@56 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL162 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL162) +@SP +AM=M-1 +D=M +@R5 +M=D +@57 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@62 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@14 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL163 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL163) +@SP +AM=M-1 +D=M +@R5 +M=D +@58 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL164 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL164) +@SP +AM=M-1 +D=M +@R5 +M=D +@59 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL165 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL165) +@SP +AM=M-1 +D=M +@R5 +M=D +@60 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL166 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL166) +@SP +AM=M-1 +D=M +@R5 +M=D +@61 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL167 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL167) +@SP +AM=M-1 +D=M +@R5 +M=D +@62 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL168 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL168) +@SP +AM=M-1 +D=M +@R5 +M=D +@64 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@59 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@59 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@59 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL169 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL169) +@SP +AM=M-1 +D=M +@R5 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL170 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL170) +@SP +AM=M-1 +D=M +@R5 +M=D +@65 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL171 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL171) +@SP +AM=M-1 +D=M +@R5 +M=D +@66 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@31 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@31 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@31 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL172 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL172) +@SP +AM=M-1 +D=M +@R5 +M=D +@67 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@28 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@35 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@35 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@28 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL173 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL173) +@SP +AM=M-1 +D=M +@R5 +M=D +@68 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@15 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@15 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL174 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL174) +@SP +AM=M-1 +D=M +@R5 +M=D +@69 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@35 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@11 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@15 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@11 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@35 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL175 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL175) +@SP +AM=M-1 +D=M +@R5 +M=D +@70 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@35 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@11 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@15 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@11 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL176 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL176) +@SP +AM=M-1 +D=M +@R5 +M=D +@71 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@28 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@35 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@59 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@44 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL177 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL177) +@SP +AM=M-1 +D=M +@R5 +M=D +@72 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL178 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL178) +@SP +AM=M-1 +D=M +@R5 +M=D +@73 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL179 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL179) +@SP +AM=M-1 +D=M +@R5 +M=D +@74 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@60 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@14 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL180 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL180) +@SP +AM=M-1 +D=M +@R5 +M=D +@75 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@15 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL181 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL181) +@SP +AM=M-1 +D=M +@R5 +M=D +@76 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@35 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL182 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL182) +@SP +AM=M-1 +D=M +@R5 +M=D +@77 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@33 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL183 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL183) +@SP +AM=M-1 +D=M +@R5 +M=D +@78 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@55 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@55 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@59 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@59 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL184 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL184) +@SP +AM=M-1 +D=M +@R5 +M=D +@79 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL185 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL185) +@SP +AM=M-1 +D=M +@R5 +M=D +@80 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@31 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@31 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL186 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL186) +@SP +AM=M-1 +D=M +@R5 +M=D +@81 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@59 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL187 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL187) +@SP +AM=M-1 +D=M +@R5 +M=D +@82 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@31 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@31 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL188 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL188) +@SP +AM=M-1 +D=M +@R5 +M=D +@83 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@28 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL189 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL189) +@SP +AM=M-1 +D=M +@R5 +M=D +@84 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@45 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL190 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL190) +@SP +AM=M-1 +D=M +@R5 +M=D +@85 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL191 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL191) +@SP +AM=M-1 +D=M +@R5 +M=D +@86 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL192 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL192) +@SP +AM=M-1 +D=M +@R5 +M=D +@87 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@18 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL193 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL193) +@SP +AM=M-1 +D=M +@R5 +M=D +@88 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL194 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL194) +@SP +AM=M-1 +D=M +@R5 +M=D +@89 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL195 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL195) +@SP +AM=M-1 +D=M +@R5 +M=D +@90 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@49 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@35 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL196 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL196) +@SP +AM=M-1 +D=M +@R5 +M=D +@91 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL197 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL197) +@SP +AM=M-1 +D=M +@R5 +M=D +@92 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=1 +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL198 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL198) +@SP +AM=M-1 +D=M +@R5 +M=D +@93 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL199 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL199) +@SP +AM=M-1 +D=M +@R5 +M=D +@94 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@8 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@28 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL200 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL200) +@SP +AM=M-1 +D=M +@R5 +M=D +@95 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL201 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL201) +@SP +AM=M-1 +D=M +@R5 +M=D +@96 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL202 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL202) +@SP +AM=M-1 +D=M +@R5 +M=D +@97 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@14 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL203 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL203) +@SP +AM=M-1 +D=M +@R5 +M=D +@98 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@15 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL204 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL204) +@SP +AM=M-1 +D=M +@R5 +M=D +@99 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL205 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL205) +@SP +AM=M-1 +D=M +@R5 +M=D +@100 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@60 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL206 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL206) +@SP +AM=M-1 +D=M +@R5 +M=D +@101 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL207 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL207) +@SP +AM=M-1 +D=M +@R5 +M=D +@102 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@28 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@38 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@15 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@15 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL208 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL208) +@SP +AM=M-1 +D=M +@R5 +M=D +@103 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@62 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL209 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL209) +@SP +AM=M-1 +D=M +@R5 +M=D +@104 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@55 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL210 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL210) +@SP +AM=M-1 +D=M +@R5 +M=D +@105 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@14 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL211 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL211) +@SP +AM=M-1 +D=M +@R5 +M=D +@106 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@56 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL212 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL212) +@SP +AM=M-1 +D=M +@R5 +M=D +@107 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@15 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@15 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL213 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL213) +@SP +AM=M-1 +D=M +@R5 +M=D +@108 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@14 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL214 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL214) +@SP +AM=M-1 +D=M +@R5 +M=D +@109 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@29 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@43 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@43 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@43 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@43 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL215 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL215) +@SP +AM=M-1 +D=M +@R5 +M=D +@110 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@29 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL216 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL216) +@SP +AM=M-1 +D=M +@R5 +M=D +@111 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL217 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL217) +@SP +AM=M-1 +D=M +@R5 +M=D +@112 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@31 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL218 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL218) +@SP +AM=M-1 +D=M +@R5 +M=D +@113 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@62 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL219 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL219) +@SP +AM=M-1 +D=M +@R5 +M=D +@114 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@29 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@55 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@7 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL220 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL220) +@SP +AM=M-1 +D=M +@R5 +M=D +@115 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL221 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL221) +@SP +AM=M-1 +D=M +@R5 +M=D +@116 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@15 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@28 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL222 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL222) +@SP +AM=M-1 +D=M +@R5 +M=D +@117 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL223 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL223) +@SP +AM=M-1 +D=M +@R5 +M=D +@118 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL224 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL224) +@SP +AM=M-1 +D=M +@R5 +M=D +@119 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@18 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL225 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL225) +@SP +AM=M-1 +D=M +@R5 +M=D +@120 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@30 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL226 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL226) +@SP +AM=M-1 +D=M +@R5 +M=D +@121 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@62 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@24 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@15 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL227 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL227) +@SP +AM=M-1 +D=M +@R5 +M=D +@122 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@27 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@51 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL228 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL228) +@SP +AM=M-1 +D=M +@R5 +M=D +@123 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@56 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@7 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@56 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL229 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL229) +@SP +AM=M-1 +D=M +@R5 +M=D +@124 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL230 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL230) +@SP +AM=M-1 +D=M +@R5 +M=D +@125 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@7 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@56 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@7 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL231 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL231) +@SP +AM=M-1 +D=M +@R5 +M=D +@126 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@38 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@45 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@25 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@SP +M=M+1 +A=M-1 +M=0 +@12 +D=A +@R13 +M=D +@output.create +D=A +@R14 +M=D +@RET_ADDRESS_CALL232 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL232) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(output.create) +@SP +AM=M+1 +A=A-1 +M=0 +@11 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@array.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL233 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL233) +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@output.5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@SP +M=M+1 +A=M-1 +M=0 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@SP +M=M+1 +A=M-1 +M=1 +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@4 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +D=M +@5 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@5 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +D=M +@6 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +D=M +@7 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@7 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +D=M +@8 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@8 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +D=M +@9 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@9 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +D=M +@10 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@10 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +D=M +@11 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(output.createshiftedmap) +@4 +D=A +(LOOP_output.createshiftedmap) +D=D-1 +@SP +AM=M+1 +A=A-1 +M=0 +@LOOP_output.createshiftedmap +D;JGT +@127 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@array.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL234 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL234) +@SP +AM=M-1 +D=M +@output.6 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +(output.createshiftedmap$while_exp0) +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@127 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT27 +D=A +@38 +0;JMP +(RET_ADDRESS_LT27) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@output.createshiftedmap$while_end0 +D;JNE +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@output.5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@11 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@array.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL235 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL235) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@output.6 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +(output.createshiftedmap$while_exp1) +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@11 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT28 +D=A +@38 +0;JMP +(RET_ADDRESS_LT28) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@output.createshiftedmap$while_end1 +D;JNE +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@256 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL236 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL236) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +@output.createshiftedmap$while_exp1 +0;JMP +(output.createshiftedmap$while_end1) +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_EQ21 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ21) +@SP +AM=M-1 +D=M +@output.createshiftedmap$if_true0 +D;JNE +@output.createshiftedmap$if_false0 +0;JMP +(output.createshiftedmap$if_true0) +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +@output.createshiftedmap$if_end0 +0;JMP +(output.createshiftedmap$if_false0) +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +(output.createshiftedmap$if_end0) +@output.createshiftedmap$while_exp0 +0;JMP +(output.createshiftedmap$while_end0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(output.getmap) +@SP +AM=M+1 +A=A-1 +M=0 +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT29 +D=A +@38 +0;JMP +(RET_ADDRESS_LT29) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@126 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT22 +D=A +@22 +0;JMP +(RET_ADDRESS_GT22) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +AM=M-1 +D=M +@output.getmap$if_true0 +D;JNE +@output.getmap$if_false0 +0;JMP +(output.getmap$if_true0) +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@ARG +A=M +M=D +(output.getmap$if_false0) +@output.2 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@output.getmap$if_true1 +D;JNE +@output.getmap$if_false1 +0;JMP +(output.getmap$if_true1) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@output.5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@output.getmap$if_end1 +0;JMP +(output.getmap$if_false1) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@output.6 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +(output.getmap$if_end1) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(output.drawchar) +@4 +D=A +(LOOP_output.drawchar) +D=D-1 +@SP +AM=M+1 +A=A-1 +M=0 +@LOOP_output.drawchar +D;JGT +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@output.getmap +D=A +@R14 +M=D +@RET_ADDRESS_CALL237 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL237) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +@output.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +(output.drawchar$while_exp0) +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@11 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT30 +D=A +@38 +0;JMP +(RET_ADDRESS_LT30) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@output.drawchar$while_end0 +D;JNE +@output.2 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@output.drawchar$if_true0 +D;JNE +@output.drawchar$if_false0 +0;JMP +(output.drawchar$if_true0) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@output.4 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@256 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +D=!M +M=D+1 +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +@output.drawchar$if_end0 +0;JMP +(output.drawchar$if_false0) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@output.4 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@255 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +(output.drawchar$if_end0) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@output.4 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@output.drawchar$while_exp0 +0;JMP +(output.drawchar$while_end0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(output.movecursor) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT31 +D=A +@38 +0;JMP +(RET_ADDRESS_LT31) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@22 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT23 +D=A +@22 +0;JMP +(RET_ADDRESS_GT23) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT32 +D=A +@38 +0;JMP +(RET_ADDRESS_LT32) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@63 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT24 +D=A +@22 +0;JMP +(RET_ADDRESS_GT24) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +AM=M-1 +D=M +@output.movecursor$if_true0 +D;JNE +@output.movecursor$if_false0 +0;JMP +(output.movecursor$if_true0) +@20 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL238 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL238) +@SP +AM=M-1 +D=M +@R5 +M=D +(output.movecursor$if_false0) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.divide +D=A +@R14 +M=D +@RET_ADDRESS_CALL239 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL239) +@SP +AM=M-1 +D=M +@output.0 +M=D +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@352 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL240 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL240) +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@output.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@output.1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@output.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL241 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL241) +@RET_ADDRESS_EQ22 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ22) +@SP +AM=M-1 +D=M +@output.2 +M=D +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@output.drawchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL242 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL242) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(output.printchar) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@0 +D=A +@R13 +M=D +@string.newline +D=A +@R14 +M=D +@RET_ADDRESS_CALL243 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL243) +@RET_ADDRESS_EQ23 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ23) +@SP +AM=M-1 +D=M +@output.printchar$if_true0 +D;JNE +@output.printchar$if_false0 +0;JMP +(output.printchar$if_true0) +@0 +D=A +@R13 +M=D +@output.println +D=A +@R14 +M=D +@RET_ADDRESS_CALL244 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL244) +@SP +AM=M-1 +D=M +@R5 +M=D +@output.printchar$if_end0 +0;JMP +(output.printchar$if_false0) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@0 +D=A +@R13 +M=D +@string.backspace +D=A +@R14 +M=D +@RET_ADDRESS_CALL245 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL245) +@RET_ADDRESS_EQ24 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ24) +@SP +AM=M-1 +D=M +@output.printchar$if_true1 +D;JNE +@output.printchar$if_false1 +0;JMP +(output.printchar$if_true1) +@0 +D=A +@R13 +M=D +@output.backspace +D=A +@R14 +M=D +@RET_ADDRESS_CALL246 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL246) +@SP +AM=M-1 +D=M +@R5 +M=D +@output.printchar$if_end1 +0;JMP +(output.printchar$if_false1) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@output.drawchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL247 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL247) +@SP +AM=M-1 +D=M +@R5 +M=D +@output.2 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@output.printchar$if_true2 +D;JNE +@output.printchar$if_false2 +0;JMP +(output.printchar$if_true2) +@output.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@output.0 +M=D +@output.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@output.1 +M=D +(output.printchar$if_false2) +@output.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_EQ25 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ25) +@SP +AM=M-1 +D=M +@output.printchar$if_true3 +D;JNE +@output.printchar$if_false3 +0;JMP +(output.printchar$if_true3) +@0 +D=A +@R13 +M=D +@output.println +D=A +@R14 +M=D +@RET_ADDRESS_CALL248 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL248) +@SP +AM=M-1 +D=M +@R5 +M=D +@output.printchar$if_end3 +0;JMP +(output.printchar$if_false3) +@output.2 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@output.2 +M=D +(output.printchar$if_end3) +(output.printchar$if_end1) +(output.printchar$if_end0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(output.printstring) +@SP +A=M +M=0 +AD=A+1 +M=0 +@SP +M=D+1 +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@string.length +D=A +@R14 +M=D +@RET_ADDRESS_CALL249 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL249) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +(output.printstring$while_exp0) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT33 +D=A +@38 +0;JMP +(RET_ADDRESS_LT33) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@output.printstring$while_end0 +D;JNE +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.charat +D=A +@R14 +M=D +@RET_ADDRESS_CALL250 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL250) +@1 +D=A +@R13 +M=D +@output.printchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL251 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL251) +@SP +AM=M-1 +D=M +@R5 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@output.printstring$while_exp0 +0;JMP +(output.printstring$while_end0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(output.printint) +@output.3 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.setint +D=A +@R14 +M=D +@RET_ADDRESS_CALL252 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL252) +@SP +AM=M-1 +D=M +@R5 +M=D +@output.3 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@output.printstring +D=A +@R14 +M=D +@RET_ADDRESS_CALL253 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL253) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(output.println) +@output.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@352 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@output.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@output.1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@output.0 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@output.2 +M=D +@output.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@8128 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_EQ26 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ26) +@SP +AM=M-1 +D=M +@output.println$if_true0 +D;JNE +@output.println$if_false0 +0;JMP +(output.println$if_true0) +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@output.1 +M=D +(output.println$if_false0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(output.backspace) +@output.2 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@output.backspace$if_true0 +D;JNE +@output.backspace$if_false0 +0;JMP +(output.backspace$if_true0) +@output.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_GT25 +D=A +@22 +0;JMP +(RET_ADDRESS_GT25) +@SP +AM=M-1 +D=M +@output.backspace$if_true1 +D;JNE +@output.backspace$if_false1 +0;JMP +(output.backspace$if_true1) +@output.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@output.0 +M=D +@output.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@output.1 +M=D +@output.backspace$if_end1 +0;JMP +(output.backspace$if_false1) +@31 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@output.0 +M=D +@output.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_EQ27 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ27) +@SP +AM=M-1 +D=M +@output.backspace$if_true2 +D;JNE +@output.backspace$if_false2 +0;JMP +(output.backspace$if_true2) +@8128 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@output.1 +M=D +(output.backspace$if_false2) +@output.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@321 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@output.1 +M=D +(output.backspace$if_end1) +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@output.2 +M=D +@output.backspace$if_end0 +0;JMP +(output.backspace$if_false0) +@SP +M=M+1 +A=M-1 +M=0 +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@output.2 +M=D +(output.backspace$if_end0) +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@output.drawchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL254 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL254) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(screen.init) +@SP +AM=M+1 +A=A-1 +M=0 +@16384 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@screen.1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@screen.2 +M=D +@17 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@array.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL255 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL255) +@SP +AM=M-1 +D=M +@screen.0 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@screen.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +(screen.init$while_exp0) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@16 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT34 +D=A +@38 +0;JMP +(RET_ADDRESS_LT34) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@screen.init$while_end0 +D;JNE +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@screen.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@screen.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@screen.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@screen.init$while_exp0 +0;JMP +(screen.init$while_end0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(screen.clearscreen) +@SP +AM=M+1 +A=A-1 +M=0 +(screen.clearscreen$while_exp0) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@8192 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT35 +D=A +@38 +0;JMP +(RET_ADDRESS_LT35) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@screen.clearscreen$while_end0 +D;JNE +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@screen.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@screen.clearscreen$while_exp0 +0;JMP +(screen.clearscreen$while_end0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(screen.updatelocation) +@screen.2 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@screen.updatelocation$if_true0 +D;JNE +@screen.updatelocation$if_false0 +0;JMP +(screen.updatelocation$if_true0) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@screen.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@screen.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@screen.updatelocation$if_end0 +0;JMP +(screen.updatelocation$if_false0) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@screen.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@screen.1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +(screen.updatelocation$if_end0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(screen.setcolor) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@screen.2 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(screen.drawpixel) +@3 +D=A +(LOOP_screen.drawpixel) +D=D-1 +@SP +AM=M+1 +A=A-1 +M=0 +@LOOP_screen.drawpixel +D;JGT +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT36 +D=A +@38 +0;JMP +(RET_ADDRESS_LT36) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@511 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT26 +D=A +@22 +0;JMP +(RET_ADDRESS_GT26) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT37 +D=A +@38 +0;JMP +(RET_ADDRESS_LT37) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@255 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT27 +D=A +@22 +0;JMP +(RET_ADDRESS_GT27) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +AM=M-1 +D=M +@screen.drawpixel$if_true0 +D;JNE +@screen.drawpixel$if_false0 +0;JMP +(screen.drawpixel$if_true0) +@7 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL256 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL256) +@SP +AM=M-1 +D=M +@R5 +M=D +(screen.drawpixel$if_false0) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@16 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.divide +D=A +@R14 +M=D +@RET_ADDRESS_CALL257 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL257) +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@16 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL258 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL258) +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL259 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL259) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@screen.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@screen.updatelocation +D=A +@R14 +M=D +@RET_ADDRESS_CALL260 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL260) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(screen.drawconditional) +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@screen.drawconditional$if_true0 +D;JNE +@screen.drawconditional$if_false0 +0;JMP +(screen.drawconditional$if_true0) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@screen.drawpixel +D=A +@R14 +M=D +@RET_ADDRESS_CALL261 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL261) +@SP +AM=M-1 +D=M +@R5 +M=D +@screen.drawconditional$if_end0 +0;JMP +(screen.drawconditional$if_false0) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@screen.drawpixel +D=A +@R14 +M=D +@RET_ADDRESS_CALL262 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL262) +@SP +AM=M-1 +D=M +@R5 +M=D +(screen.drawconditional$if_end0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(screen.drawline) +@11 +D=A +(LOOP_screen.drawline) +D=D-1 +@SP +AM=M+1 +A=A-1 +M=0 +@LOOP_screen.drawline +D;JGT +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT38 +D=A +@38 +0;JMP +(RET_ADDRESS_LT38) +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@511 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT28 +D=A +@22 +0;JMP +(RET_ADDRESS_GT28) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT39 +D=A +@38 +0;JMP +(RET_ADDRESS_LT39) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@255 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT29 +D=A +@22 +0;JMP +(RET_ADDRESS_GT29) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +AM=M-1 +D=M +@screen.drawline$if_true0 +D;JNE +@screen.drawline$if_false0 +0;JMP +(screen.drawline$if_true0) +@8 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL263 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL263) +@SP +AM=M-1 +D=M +@R5 +M=D +(screen.drawline$if_false0) +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@1 +D=A +@R13 +M=D +@math.abs +D=A +@R14 +M=D +@RET_ADDRESS_CALL264 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL264) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@1 +D=A +@R13 +M=D +@math.abs +D=A +@R14 +M=D +@RET_ADDRESS_CALL265 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL265) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT40 +D=A +@38 +0;JMP +(RET_ADDRESS_LT40) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@LCL +D=M +@6 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT41 +D=A +@38 +0;JMP +(RET_ADDRESS_LT41) +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@LCL +D=M +@6 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +M=!M +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT42 +D=A +@38 +0;JMP +(RET_ADDRESS_LT42) +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +AM=M-1 +D=M +@screen.drawline$if_true1 +D;JNE +@screen.drawline$if_false1 +0;JMP +(screen.drawline$if_true1) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ARG +A=M +M=D +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ARG +A=M+1 +A=A+1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ARG +A=M+1 +M=D +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ARG +A=M+1 +A=A+1 +A=A+1 +M=D +(screen.drawline$if_false1) +@LCL +D=M +@6 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@screen.drawline$if_true2 +D;JNE +@screen.drawline$if_false2 +0;JMP +(screen.drawline$if_true2) +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@8 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT30 +D=A +@22 +0;JMP +(RET_ADDRESS_GT30) +@LCL +D=M +@7 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@screen.drawline$if_end2 +0;JMP +(screen.drawline$if_false2) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@8 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT31 +D=A +@22 +0;JMP +(RET_ADDRESS_GT31) +@LCL +D=M +@7 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +(screen.drawline$if_end2) +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL266 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL266) +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL267 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL267) +@LCL +D=M +@9 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL268 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL268) +@LCL +D=M +@10 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@6 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@R13 +M=D +@screen.drawconditional +D=A +@R14 +M=D +@RET_ADDRESS_CALL269 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL269) +@SP +AM=M-1 +D=M +@R5 +M=D +(screen.drawline$while_exp0) +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@8 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT43 +D=A +@38 +0;JMP +(RET_ADDRESS_LT43) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@screen.drawline$while_end0 +D;JNE +@LCL +D=M +@5 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT44 +D=A +@38 +0;JMP +(RET_ADDRESS_LT44) +@SP +AM=M-1 +D=M +@screen.drawline$if_true3 +D;JNE +@screen.drawline$if_false3 +0;JMP +(screen.drawline$if_true3) +@LCL +D=M +@5 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@9 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@screen.drawline$if_end3 +0;JMP +(screen.drawline$if_false3) +@LCL +D=M +@5 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@10 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@LCL +D=M +@7 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@screen.drawline$if_true4 +D;JNE +@screen.drawline$if_false4 +0;JMP +(screen.drawline$if_true4) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@screen.drawline$if_end4 +0;JMP +(screen.drawline$if_false4) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +(screen.drawline$if_end4) +(screen.drawline$if_end3) +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@6 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@3 +D=A +@R13 +M=D +@screen.drawconditional +D=A +@R14 +M=D +@RET_ADDRESS_CALL270 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL270) +@SP +AM=M-1 +D=M +@R5 +M=D +@screen.drawline$while_exp0 +0;JMP +(screen.drawline$while_end0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(screen.drawrectangle) +@9 +D=A +(LOOP_screen.drawrectangle) +D=D-1 +@SP +AM=M+1 +A=A-1 +M=0 +@LOOP_screen.drawrectangle +D;JGT +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT32 +D=A +@22 +0;JMP +(RET_ADDRESS_GT32) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT33 +D=A +@22 +0;JMP +(RET_ADDRESS_GT33) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT45 +D=A +@38 +0;JMP +(RET_ADDRESS_LT45) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@511 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT34 +D=A +@22 +0;JMP +(RET_ADDRESS_GT34) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT46 +D=A +@38 +0;JMP +(RET_ADDRESS_LT46) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@255 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT35 +D=A +@22 +0;JMP +(RET_ADDRESS_GT35) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +AM=M-1 +D=M +@screen.drawrectangle$if_true0 +D;JNE +@screen.drawrectangle$if_false0 +0;JMP +(screen.drawrectangle$if_true0) +@9 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL271 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL271) +@SP +AM=M-1 +D=M +@R5 +M=D +(screen.drawrectangle$if_false0) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@16 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.divide +D=A +@R14 +M=D +@RET_ADDRESS_CALL272 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL272) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@16 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL273 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL273) +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@LCL +D=M +@7 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@16 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.divide +D=A +@R14 +M=D +@RET_ADDRESS_CALL274 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL274) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@16 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL275 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL275) +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@LCL +D=M +@8 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@LCL +D=M +@7 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@screen.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@LCL +D=M +@8 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@screen.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL276 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL276) +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +(screen.drawrectangle$while_exp0) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT36 +D=A +@22 +0;JMP +(RET_ADDRESS_GT36) +@SP +A=M-1 +M=!M +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@screen.drawrectangle$while_end0 +D;JNE +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_EQ28 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ28) +@SP +AM=M-1 +D=M +@screen.drawrectangle$if_true1 +D;JNE +@screen.drawrectangle$if_false1 +0;JMP +(screen.drawrectangle$if_true1) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@5 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@6 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@2 +D=A +@R13 +M=D +@screen.updatelocation +D=A +@R14 +M=D +@RET_ADDRESS_CALL277 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL277) +@SP +AM=M-1 +D=M +@R5 +M=D +@screen.drawrectangle$if_end1 +0;JMP +(screen.drawrectangle$if_false1) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@6 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@screen.updatelocation +D=A +@R14 +M=D +@RET_ADDRESS_CALL278 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL278) +@SP +AM=M-1 +D=M +@R5 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +(screen.drawrectangle$while_exp1) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT47 +D=A +@38 +0;JMP +(RET_ADDRESS_LT47) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@screen.drawrectangle$while_end1 +D;JNE +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +A=M-1 +D=!M +M=D+1 +@2 +D=A +@R13 +M=D +@screen.updatelocation +D=A +@R14 +M=D +@RET_ADDRESS_CALL279 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL279) +@SP +AM=M-1 +D=M +@R5 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@screen.drawrectangle$while_exp1 +0;JMP +(screen.drawrectangle$while_end1) +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@5 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@screen.updatelocation +D=A +@R14 +M=D +@RET_ADDRESS_CALL280 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL280) +@SP +AM=M-1 +D=M +@R5 +M=D +(screen.drawrectangle$if_end1) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@ARG +A=M+1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@screen.drawrectangle$while_exp0 +0;JMP +(screen.drawrectangle$while_end0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(screen.drawhorizontal) +@11 +D=A +(LOOP_screen.drawhorizontal) +D=D-1 +@SP +AM=M+1 +A=A-1 +M=0 +@LOOP_screen.drawhorizontal +D;JGT +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.min +D=A +@R14 +M=D +@RET_ADDRESS_CALL281 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL281) +@LCL +D=M +@7 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.max +D=A +@R14 +M=D +@RET_ADDRESS_CALL282 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL282) +@LCL +D=M +@8 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +A=M-1 +D=!M +M=D+1 +@RET_ADDRESS_GT37 +D=A +@22 +0;JMP +(RET_ADDRESS_GT37) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@256 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT48 +D=A +@38 +0;JMP +(RET_ADDRESS_LT48) +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@LCL +D=M +@7 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@512 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT49 +D=A +@38 +0;JMP +(RET_ADDRESS_LT49) +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@LCL +D=M +@8 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +A=M-1 +D=!M +M=D+1 +@RET_ADDRESS_GT38 +D=A +@22 +0;JMP +(RET_ADDRESS_GT38) +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@SP +AM=M-1 +D=M +@screen.drawhorizontal$if_true0 +D;JNE +@screen.drawhorizontal$if_false0 +0;JMP +(screen.drawhorizontal$if_true0) +@LCL +D=M +@7 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@2 +D=A +@R13 +M=D +@math.max +D=A +@R14 +M=D +@RET_ADDRESS_CALL283 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL283) +@LCL +D=M +@7 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@LCL +D=M +@8 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@511 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.min +D=A +@R14 +M=D +@RET_ADDRESS_CALL284 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL284) +@LCL +D=M +@8 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@LCL +D=M +@7 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@16 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.divide +D=A +@R14 +M=D +@RET_ADDRESS_CALL285 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL285) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@LCL +D=M +@7 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@16 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL286 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL286) +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@LCL +D=M +@9 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@LCL +D=M +@8 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@16 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.divide +D=A +@R14 +M=D +@RET_ADDRESS_CALL287 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL287) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +@LCL +D=M +@8 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@16 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL288 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL288) +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@LCL +D=M +@10 +D=D+A +@R13 +M=D +@SP +AM=M-1 +D=M +@R13 +A=M +M=D +@LCL +D=M +@9 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@screen.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@LCL +D=M +@10 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@screen.0 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@32 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL289 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL289) +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@6 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +@LCL +D=M +@6 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_EQ29 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ29) +@SP +AM=M-1 +D=M +@screen.drawhorizontal$if_true1 +D;JNE +@screen.drawhorizontal$if_false1 +0;JMP +(screen.drawhorizontal$if_true1) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@5 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@2 +D=A +@R13 +M=D +@screen.updatelocation +D=A +@R14 +M=D +@RET_ADDRESS_CALL290 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL290) +@SP +AM=M-1 +D=M +@R5 +M=D +@screen.drawhorizontal$if_end1 +0;JMP +(screen.drawhorizontal$if_false1) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@5 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@screen.updatelocation +D=A +@R14 +M=D +@RET_ADDRESS_CALL291 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL291) +@SP +AM=M-1 +D=M +@R5 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +(screen.drawhorizontal$while_exp0) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT50 +D=A +@38 +0;JMP +(RET_ADDRESS_LT50) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@screen.drawhorizontal$while_end0 +D;JNE +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +A=M-1 +D=!M +M=D+1 +@2 +D=A +@R13 +M=D +@screen.updatelocation +D=A +@R14 +M=D +@RET_ADDRESS_CALL292 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL292) +@SP +AM=M-1 +D=M +@R5 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@screen.drawhorizontal$while_exp0 +0;JMP +(screen.drawhorizontal$while_end0) +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@screen.updatelocation +D=A +@R14 +M=D +@RET_ADDRESS_CALL293 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL293) +@SP +AM=M-1 +D=M +@R5 +M=D +(screen.drawhorizontal$if_end1) +(screen.drawhorizontal$if_false0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(screen.drawsymetric) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@3 +D=A +@R13 +M=D +@screen.drawhorizontal +D=A +@R14 +M=D +@RET_ADDRESS_CALL294 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL294) +@SP +AM=M-1 +D=M +@R5 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@3 +D=A +@R13 +M=D +@screen.drawhorizontal +D=A +@R14 +M=D +@RET_ADDRESS_CALL295 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL295) +@SP +AM=M-1 +D=M +@R5 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@3 +D=A +@R13 +M=D +@screen.drawhorizontal +D=A +@R14 +M=D +@RET_ADDRESS_CALL296 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL296) +@SP +AM=M-1 +D=M +@R5 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@3 +D=A +@R13 +M=D +@screen.drawhorizontal +D=A +@R14 +M=D +@RET_ADDRESS_CALL297 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL297) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(screen.drawcircle) +@3 +D=A +(LOOP_screen.drawcircle) +D=D-1 +@SP +AM=M+1 +A=A-1 +M=0 +@LOOP_screen.drawcircle +D;JGT +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT51 +D=A +@38 +0;JMP +(RET_ADDRESS_LT51) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@511 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT39 +D=A +@22 +0;JMP +(RET_ADDRESS_GT39) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT52 +D=A +@38 +0;JMP +(RET_ADDRESS_LT52) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@255 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT40 +D=A +@22 +0;JMP +(RET_ADDRESS_GT40) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +AM=M-1 +D=M +@screen.drawcircle$if_true0 +D;JNE +@screen.drawcircle$if_false0 +0;JMP +(screen.drawcircle$if_true0) +@12 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL298 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL298) +@SP +AM=M-1 +D=M +@R5 +M=D +(screen.drawcircle$if_false0) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT53 +D=A +@38 +0;JMP +(RET_ADDRESS_LT53) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@511 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT41 +D=A +@22 +0;JMP +(RET_ADDRESS_GT41) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT54 +D=A +@38 +0;JMP +(RET_ADDRESS_LT54) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@255 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT42 +D=A +@22 +0;JMP +(RET_ADDRESS_GT42) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +AM=M-1 +D=M +@screen.drawcircle$if_true1 +D;JNE +@screen.drawcircle$if_false1 +0;JMP +(screen.drawcircle$if_true1) +@13 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL299 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL299) +@SP +AM=M-1 +D=M +@R5 +M=D +(screen.drawcircle$if_false1) +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@R13 +M=D +@screen.drawsymetric +D=A +@R14 +M=D +@RET_ADDRESS_CALL300 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL300) +@SP +AM=M-1 +D=M +@R5 +M=D +(screen.drawcircle$while_exp0) +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT43 +D=A +@22 +0;JMP +(RET_ADDRESS_GT43) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@screen.drawcircle$while_end0 +D;JNE +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT55 +D=A +@38 +0;JMP +(RET_ADDRESS_LT55) +@SP +AM=M-1 +D=M +@screen.drawcircle$if_true2 +D;JNE +@screen.drawcircle$if_false2 +0;JMP +(screen.drawcircle$if_true2) +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL301 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL301) +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +@screen.drawcircle$if_end2 +0;JMP +(screen.drawcircle$if_false2) +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL302 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL302) +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@5 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +(screen.drawcircle$if_end2) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@4 +D=A +@R13 +M=D +@screen.drawsymetric +D=A +@R14 +M=D +@RET_ADDRESS_CALL303 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL303) +@SP +AM=M-1 +D=M +@R5 +M=D +@screen.drawcircle$while_exp0 +0;JMP +(screen.drawcircle$while_end0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(string.new) +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@memory.alloc +D=A +@R14 +M=D +@RET_ADDRESS_CALL304 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL304) +@SP +AM=M-1 +D=M +@THIS +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT56 +D=A +@38 +0;JMP +(RET_ADDRESS_LT56) +@SP +AM=M-1 +D=M +@string.new$if_true0 +D;JNE +@string.new$if_false0 +0;JMP +(string.new$if_true0) +@14 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL305 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL305) +@SP +AM=M-1 +D=M +@R5 +M=D +(string.new$if_false0) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_GT44 +D=A +@22 +0;JMP +(RET_ADDRESS_GT44) +@SP +AM=M-1 +D=M +@string.new$if_true1 +D;JNE +@string.new$if_false1 +0;JMP +(string.new$if_true1) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@array.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL306 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL306) +@SP +AM=M-1 +D=M +@THIS +A=M+1 +M=D +(string.new$if_false1) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +A=M +M=D +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(string.dispose) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_GT45 +D=A +@22 +0;JMP +(RET_ADDRESS_GT45) +@SP +AM=M-1 +D=M +@string.dispose$if_true0 +D;JNE +@string.dispose$if_false0 +0;JMP +(string.dispose$if_true0) +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@array.dispose +D=A +@R14 +M=D +@RET_ADDRESS_CALL307 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL307) +@SP +AM=M-1 +D=M +@R5 +M=D +(string.dispose$if_false0) +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@memory.dealloc +D=A +@R14 +M=D +@RET_ADDRESS_CALL308 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL308) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(string.length) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(string.charat) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT57 +D=A +@38 +0;JMP +(RET_ADDRESS_LT57) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT46 +D=A +@22 +0;JMP +(RET_ADDRESS_GT46) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_EQ30 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ30) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +AM=M-1 +D=M +@string.charat$if_true0 +D;JNE +@string.charat$if_false0 +0;JMP +(string.charat$if_true0) +@15 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL309 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL309) +@SP +AM=M-1 +D=M +@R5 +M=D +(string.charat$if_false0) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(string.setcharat) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT58 +D=A +@38 +0;JMP +(RET_ADDRESS_LT58) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT47 +D=A +@22 +0;JMP +(RET_ADDRESS_GT47) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_EQ31 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ31) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +AM=M-1 +D=M +@string.setcharat$if_true0 +D;JNE +@string.setcharat$if_false0 +0;JMP +(string.setcharat$if_true0) +@16 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL310 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL310) +@SP +AM=M-1 +D=M +@R5 +M=D +(string.setcharat$if_false0) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(string.appendchar) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_EQ32 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ32) +@SP +AM=M-1 +D=M +@string.appendchar$if_true0 +D;JNE +@string.appendchar$if_false0 +0;JMP +(string.appendchar$if_true0) +@17 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL311 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL311) +@SP +AM=M-1 +D=M +@R5 +M=D +(string.appendchar$if_false0) +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +M=D +@THIS +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(string.eraselastchar) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_EQ33 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ33) +@SP +AM=M-1 +D=M +@string.eraselastchar$if_true0 +D;JNE +@string.eraselastchar$if_false0 +0;JMP +(string.eraselastchar$if_true0) +@18 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL312 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL312) +@SP +AM=M-1 +D=M +@R5 +M=D +(string.eraselastchar$if_false0) +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(string.intvalue) +@5 +D=A +(LOOP_string.intvalue) +D=D-1 +@SP +AM=M+1 +A=A-1 +M=0 +@LOOP_string.intvalue +D;JGT +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_EQ34 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ34) +@SP +AM=M-1 +D=M +@string.intvalue$if_true0 +D;JNE +@string.intvalue$if_false0 +0;JMP +(string.intvalue$if_true0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(string.intvalue$if_false0) +@SP +M=M+1 +A=M-1 +M=0 +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@45 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_EQ35 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ35) +@SP +AM=M-1 +D=M +@string.intvalue$if_true1 +D;JNE +@string.intvalue$if_false1 +0;JMP +(string.intvalue$if_true1) +@SP +M=M+1 +A=M-1 +M=0 +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +(string.intvalue$if_false1) +(string.intvalue$while_exp0) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT59 +D=A +@38 +0;JMP +(RET_ADDRESS_LT59) +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D&M +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@string.intvalue$while_end0 +D;JNE +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT60 +D=A +@38 +0;JMP +(RET_ADDRESS_LT60) +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@9 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_GT48 +D=A +@22 +0;JMP +(RET_ADDRESS_GT48) +@SP +AM=M-1 +D=M +A=A-1 +M=D|M +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@string.intvalue$if_true2 +D;JNE +@string.intvalue$if_false2 +0;JMP +(string.intvalue$if_true2) +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@10 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL313 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL313) +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +(string.intvalue$if_false2) +@string.intvalue$while_exp0 +0;JMP +(string.intvalue$while_end0) +@LCL +D=M +@4 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@string.intvalue$if_true3 +D;JNE +@string.intvalue$if_false3 +0;JMP +(string.intvalue$if_true3) +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +D=!M +M=D+1 +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +(string.intvalue$if_false3) +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(string.setint) +@4 +D=A +(LOOP_string.setint) +D=D-1 +@SP +AM=M+1 +A=A-1 +M=0 +@LOOP_string.setint +D;JGT +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THIS +M=D +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_EQ36 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ36) +@SP +AM=M-1 +D=M +@string.setint$if_true0 +D;JNE +@string.setint$if_false0 +0;JMP +(string.setint$if_true0) +@19 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL314 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL314) +@SP +AM=M-1 +D=M +@R5 +M=D +(string.setint$if_false0) +@6 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@array.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL315 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL315) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT61 +D=A +@38 +0;JMP +(RET_ADDRESS_LT61) +@SP +AM=M-1 +D=M +@string.setint$if_true1 +D;JNE +@string.setint$if_false1 +0;JMP +(string.setint$if_true1) +@SP +M=M+1 +A=M-1 +M=0 +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@LCL +A=M+1 +A=A+1 +A=A+1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +A=M-1 +D=!M +M=D+1 +@SP +AM=M-1 +D=M +@ARG +A=M+1 +M=D +(string.setint$if_false1) +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +(string.setint$while_exp0) +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_GT49 +D=A +@22 +0;JMP +(RET_ADDRESS_GT49) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@string.setint$while_end0 +D;JNE +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@10 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.divide +D=A +@R14 +M=D +@RET_ADDRESS_CALL316 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL316) +@SP +AM=M-1 +D=M +@LCL +A=M+1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@ARG +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@10 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@math.multiply +D=A +@R14 +M=D +@RET_ADDRESS_CALL317 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL317) +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@LCL +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@ARG +A=M+1 +M=D +@string.setint$while_exp0 +0;JMP +(string.setint$while_end0) +@LCL +D=M +@3 +A=D+A +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@string.setint$if_true2 +D;JNE +@string.setint$if_false2 +0;JMP +(string.setint$if_true2) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@45 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +(string.setint$if_false2) +@THIS +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT62 +D=A +@38 +0;JMP +(RET_ADDRESS_LT62) +@SP +AM=M-1 +D=M +@string.setint$if_true3 +D;JNE +@string.setint$if_false3 +0;JMP +(string.setint$if_true3) +@19 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL318 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL318) +@SP +AM=M-1 +D=M +@R5 +M=D +(string.setint$if_false3) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_EQ37 +D=A +@6 +0;JMP +(RET_ADDRESS_EQ37) +@SP +AM=M-1 +D=M +@string.setint$if_true4 +D;JNE +@string.setint$if_false4 +0;JMP +(string.setint$if_true4) +@SP +M=M+1 +A=M-1 +M=0 +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@48 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +M=D +@string.setint$if_end4 +0;JMP +(string.setint$if_false4) +@SP +M=M+1 +A=M-1 +M=0 +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +M=D +(string.setint$while_exp1) +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@RET_ADDRESS_LT63 +D=A +@38 +0;JMP +(RET_ADDRESS_LT63) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@string.setint$while_end1 +D;JNE +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THAT +M=D +@THAT +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +AM=M-1 +D=M +@THAT +M=D +@R5 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@THAT +A=M +M=D +@THIS +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=D+M +@SP +AM=M-1 +D=M +@THIS +A=M+1 +A=A+1 +M=D +@string.setint$while_exp1 +0;JMP +(string.setint$while_end1) +(string.setint$if_end4) +@LCL +A=M+1 +A=A+1 +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@array.dispose +D=A +@R14 +M=D +@RET_ADDRESS_CALL319 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL319) +@SP +AM=M-1 +D=M +@R5 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(string.newline) +@128 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(string.backspace) +@129 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(string.doublequote) +@34 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +(sys.init) +@0 +D=A +@R13 +M=D +@memory.init +D=A +@R14 +M=D +@RET_ADDRESS_CALL320 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL320) +@SP +AM=M-1 +D=M +@R5 +M=D +@0 +D=A +@R13 +M=D +@math.init +D=A +@R14 +M=D +@RET_ADDRESS_CALL321 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL321) +@SP +AM=M-1 +D=M +@R5 +M=D +@0 +D=A +@R13 +M=D +@screen.init +D=A +@R14 +M=D +@RET_ADDRESS_CALL322 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL322) +@SP +AM=M-1 +D=M +@R5 +M=D +@0 +D=A +@R13 +M=D +@output.init +D=A +@R14 +M=D +@RET_ADDRESS_CALL323 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL323) +@SP +AM=M-1 +D=M +@R5 +M=D +@0 +D=A +@R13 +M=D +@keyboard.init +D=A +@R14 +M=D +@RET_ADDRESS_CALL324 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL324) +@SP +AM=M-1 +D=M +@R5 +M=D +@0 +D=A +@R13 +M=D +@main.main +D=A +@R14 +M=D +@RET_ADDRESS_CALL325 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL325) +@SP +AM=M-1 +D=M +@R5 +M=D +@0 +D=A +@R13 +M=D +@sys.halt +D=A +@R14 +M=D +@RET_ADDRESS_CALL326 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL326) +@SP +AM=M-1 +D=M +@R5 +M=D +(sys.halt) +(sys.halt$while_exp0) +@SP +M=M+1 +A=M-1 +M=0 +@SP +A=M-1 +M=!M +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@sys.halt$while_end0 +D;JNE +@sys.halt$while_exp0 +0;JMP +(sys.halt$while_end0) +(sys.wait) +@SP +AM=M+1 +A=A-1 +M=0 +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_LT64 +D=A +@38 +0;JMP +(RET_ADDRESS_LT64) +@SP +AM=M-1 +D=M +@sys.wait$if_true0 +D;JNE +@sys.wait$if_false0 +0;JMP +(sys.wait$if_true0) +@SP +M=M+1 +A=M-1 +M=1 +@1 +D=A +@R13 +M=D +@sys.error +D=A +@R14 +M=D +@RET_ADDRESS_CALL327 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL327) +@SP +AM=M-1 +D=M +@R5 +M=D +(sys.wait$if_false0) +(sys.wait$while_exp0) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_GT50 +D=A +@22 +0;JMP +(RET_ADDRESS_GT50) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@sys.wait$while_end0 +D;JNE +@50 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +(sys.wait$while_exp1) +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=0 +@RET_ADDRESS_GT51 +D=A +@22 +0;JMP +(RET_ADDRESS_GT51) +@SP +A=M-1 +M=!M +@SP +AM=M-1 +D=M +@sys.wait$while_end1 +D;JNE +@LCL +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@LCL +A=M +M=D +@sys.wait$while_exp1 +0;JMP +(sys.wait$while_end1) +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@SP +M=M+1 +A=M-1 +M=1 +@SP +AM=M-1 +D=M +A=A-1 +M=M-D +@SP +AM=M-1 +D=M +@ARG +A=M +M=D +@sys.wait$while_exp0 +0;JMP +(sys.wait$while_end0) +@SP +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +(sys.error) +@3 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@string.new +D=A +@R14 +M=D +@RET_ADDRESS_CALL328 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL328) +@69 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL329 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL329) +@82 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL330 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL330) +@82 +D=A +@SP +AM=M+1 +A=A-1 +M=D +@2 +D=A +@R13 +M=D +@string.appendchar +D=A +@R14 +M=D +@RET_ADDRESS_CALL331 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL331) +@1 +D=A +@R13 +M=D +@output.printstring +D=A +@R14 +M=D +@RET_ADDRESS_CALL332 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL332) +@SP +AM=M-1 +D=M +@R5 +M=D +@ARG +A=M +D=M +@SP +AM=M+1 +A=A-1 +M=D +@1 +D=A +@R13 +M=D +@output.printint +D=A +@R14 +M=D +@RET_ADDRESS_CALL333 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL333) +@SP +AM=M-1 +D=M +@R5 +M=D +@0 +D=A +@R13 +M=D +@sys.halt +D=A +@R14 +M=D +@RET_ADDRESS_CALL334 +D=A +@95 +0;JMP +(RET_ADDRESS_CALL334) +@SP +AM=M-1 +D=M +@R5 +M=D diff --git a/projects/06/pong/PongL.asm b/projects/06/pong/PongL.asm new file mode 100644 index 0000000..17c1044 --- /dev/null +++ b/projects/06/pong/PongL.asm @@ -0,0 +1,27490 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/06/pong/PongL.asm + +// Symbol-less version of the Pong.asm program. + +@256 +D=A +@0 +M=D +@133 +0;JMP +@15 +M=D +@0 +AM=M-1 +D=M +A=A-1 +D=M-D +M=0 +@19 +D;JNE +@0 +A=M-1 +M=-1 +@15 +A=M +0;JMP +@15 +M=D +@0 +AM=M-1 +D=M +A=A-1 +D=M-D +M=0 +@35 +D;JLE +@0 +A=M-1 +M=-1 +@15 +A=M +0;JMP +@15 +M=D +@0 +AM=M-1 +D=M +A=A-1 +D=M-D +M=0 +@51 +D;JGE +@0 +A=M-1 +M=-1 +@15 +A=M +0;JMP +@5 +D=A +@1 +A=M-D +D=M +@13 +M=D +@0 +AM=M-1 +D=M +@2 +A=M +M=D +D=A +@0 +M=D+1 +@1 +D=M +@14 +AM=D-1 +D=M +@4 +M=D +@14 +AM=M-1 +D=M +@3 +M=D +@14 +AM=M-1 +D=M +@2 +M=D +@14 +AM=M-1 +D=M +@1 +M=D +@13 +A=M +0;JMP +@0 +A=M +M=D +@1 +D=M +@0 +AM=M+1 +M=D +@2 +D=M +@0 +AM=M+1 +M=D +@3 +D=M +@0 +AM=M+1 +M=D +@4 +D=M +@0 +AM=M+1 +M=D +@4 +D=A +@13 +D=D+M +@0 +D=M-D +@2 +M=D +@0 +MD=M+1 +@1 +M=D +@14 +A=M +0;JMP +@0 +D=A +@13 +M=D +@27058 +D=A +@14 +M=D +@145 +D=A +@95 +0;JMP +@15 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@8643 +D=A +@14 +M=D +@163 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@3 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +A=M +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +A=M+1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@10 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@3 +D=M +@11 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@2 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@12 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@2 +D=M +@5 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@3 +D=M +@13 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=0 +@3 +D=M +@14 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@387 +D=A +@14 +M=D +@333 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@9357 +D=A +@14 +M=D +@376 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +A=M-1 +M=!M +@1 +D=A +@13 +M=D +@20889 +D=A +@14 +M=D +@418 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@514 +D=A +@14 +M=D +@441 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@1 +D=A +@13 +M=D +@20889 +D=A +@14 +M=D +@480 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@514 +D=A +@14 +M=D +@503 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@5 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@5 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@4 +D=A +@13 +M=D +@22354 +D=A +@14 +M=D +@588 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@5 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@54 +0;JMP +@3 +D=A +D=D-1 +@0 +AM=M+1 +A=A-1 +M=0 +@654 +D;JGT +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@6774 +D=A +@14 +M=D +@747 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@3 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@6774 +D=A +@14 +M=D +@774 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@798 +D=A +@38 +0;JMP +@3 +D=M +@7 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@3 +D=M +@7 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@826 +D;JNE +@930 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@886 +D=A +@38 +0;JMP +@3 +D=M +@8 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@916 +D=A +@38 +0;JMP +@3 +D=M +@9 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@991 +0;JMP +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@948 +D=A +@38 +0;JMP +@3 +D=M +@8 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@979 +D=A +@38 +0;JMP +@3 +D=M +@9 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@1016 +D=A +@95 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@1062 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@1109 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@452 +D=A +@14 +M=D +@1156 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@1178 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +@1185 +D;JNE +@1219 +0;JMP +@3 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@5 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@1401 +0;JMP +@3 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@6 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@3 +D=M +@9 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1267 +D;JNE +@1335 +0;JMP +@3 +D=M +@7 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1283 +D;JNE +@1309 +0;JMP +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@3 +A=M +M=D +@1333 +0;JMP +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@3 +A=M+1 +M=D +@1401 +0;JMP +@3 +D=M +@7 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1351 +D;JNE +@1377 +0;JMP +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@3 +A=M +M=D +@1401 +0;JMP +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@3 +A=M+1 +M=D +@3 +D=M +@8 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1417 +D;JNE +@1485 +0;JMP +@3 +D=M +@7 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1433 +D;JNE +@1459 +0;JMP +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@3 +A=M+1 +M=D +@1483 +0;JMP +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@3 +A=M +M=D +@1551 +0;JMP +@3 +D=M +@7 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1501 +D;JNE +@1527 +0;JMP +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@3 +A=M+1 +M=D +@1551 +0;JMP +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@3 +A=M +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@10 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1571 +D=A +@22 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@1581 +D;JNE +@1612 +0;JMP +@0 +M=M+1 +A=M-1 +M=1 +@3 +D=M +@14 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@3 +D=M +@10 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +A=M +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@11 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1632 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@1642 +D;JNE +@1675 +0;JMP +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@14 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@3 +D=M +@11 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +A=M +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@12 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1695 +D=A +@22 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@1705 +D;JNE +@1738 +0;JMP +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@14 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@3 +D=M +@12 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +A=M+1 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@13 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1758 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@1768 +D;JNE +@1801 +0;JMP +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@14 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@3 +D=M +@13 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +A=M+1 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@387 +D=A +@14 +M=D +@1819 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +D=M +@14 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@5 +D=A +D=D-1 +@0 +AM=M+1 +A=A-1 +M=0 +@1837 +D;JGT +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@10 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@7287 +D=A +@14 +M=D +@1882 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@3 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@10 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@7287 +D=A +@14 +M=D +@1916 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@1939 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@1946 +D;JNE +@1963 +0;JMP +@10 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@2086 +0;JMP +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@1979 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@1997 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@2018 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +A=M-1 +D=!M +M=D+1 +@2042 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@0 +AM=M-1 +D=M +@2054 +D;JNE +@2071 +0;JMP +@20 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@2086 +0;JMP +@5 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@3 +D=M +@14 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@2103 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@2110 +D;JNE +@2227 +0;JMP +@506 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@50 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +D=!M +M=D+1 +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@2153 +D=A +@95 +0;JMP +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@7287 +D=A +@14 +M=D +@2173 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@2214 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@2616 +0;JMP +@3 +D=M +@14 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2246 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@2253 +D;JNE +@2364 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@50 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@2290 +D=A +@95 +0;JMP +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@7287 +D=A +@14 +M=D +@2310 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@2351 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@2616 +0;JMP +@3 +D=M +@14 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2383 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@2390 +D;JNE +@2507 +0;JMP +@250 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@25 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +D=!M +M=D+1 +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@2432 +D=A +@95 +0;JMP +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@7287 +D=A +@14 +M=D +@2453 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@2494 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@2616 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@25 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@2543 +D=A +@95 +0;JMP +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@7287 +D=A +@14 +M=D +@2564 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@2605 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@13 +M=D +@652 +D=A +@14 +M=D +@2648 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@5 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@8643 +D=A +@14 +M=D +@2677 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@3 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +A=M +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +A=M+1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +M=D +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@2827 +D=A +@14 +M=D +@2773 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@9357 +D=A +@14 +M=D +@2816 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +A=M-1 +M=!M +@1 +D=A +@13 +M=D +@20889 +D=A +@14 +M=D +@2858 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@2954 +D=A +@14 +M=D +@2881 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@1 +D=A +@13 +M=D +@20889 +D=A +@14 +M=D +@2920 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@2954 +D=A +@14 +M=D +@2943 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@4 +D=A +@13 +M=D +@22354 +D=A +@14 +M=D +@3033 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@2892 +D=A +@14 +M=D +@3163 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@2827 +D=A +@14 +M=D +@3200 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@3240 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@3247 +D;JNE +@3525 +0;JMP +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@3 +A=M +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@3286 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +@3293 +D;JNE +@3303 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@3 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=0 +@1 +D=A +@13 +M=D +@20889 +D=A +@14 +M=D +@3319 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@4 +D=A +@13 +M=D +@22354 +D=A +@14 +M=D +@3424 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +A=M-1 +M=!M +@1 +D=A +@13 +M=D +@20889 +D=A +@14 +M=D +@3448 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@4 +D=A +@13 +M=D +@22354 +D=A +@14 +M=D +@3518 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3831 +0;JMP +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@3 +A=M +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@511 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3579 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +@3586 +D;JNE +@3611 +0;JMP +@511 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@3 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=0 +@1 +D=A +@13 +M=D +@20889 +D=A +@14 +M=D +@3627 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@4 +D=A +@13 +M=D +@22354 +D=A +@14 +M=D +@3706 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +A=M-1 +M=!M +@1 +D=A +@13 +M=D +@20889 +D=A +@14 +M=D +@3730 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@4 +D=A +@13 +M=D +@22354 +D=A +@14 +M=D +@3826 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@0 +AM=M+1 +A=A-1 +M=0 +@0 +D=A +@13 +M=D +@4508 +D=A +@14 +M=D +@3853 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +D=A +@13 +M=D +@4531 +D=A +@14 +M=D +@3870 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@4539 +D=A +@14 +M=D +@3895 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@4419 +D=A +@14 +M=D +@3919 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@7 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@8643 +D=A +@14 +M=D +@3948 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@3 +M=D +@0 +D=A +@13 +M=D +@20598 +D=A +@14 +M=D +@3965 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@50 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@230 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@229 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@6 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@7 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@13 +M=D +@2659 +D=A +@14 +M=D +@4026 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@3 +A=M +M=D +@253 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@222 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@511 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@229 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@13 +M=D +@145 +D=A +@14 +M=D +@4076 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@3 +A=M+1 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@400 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@3 +D=A +@13 +M=D +@652 +D=A +@14 +M=D +@4111 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@238 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@511 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@240 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@13 +M=D +@22354 +D=A +@14 +M=D +@4150 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@22 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@2 +D=A +@13 +M=D +@19350 +D=A +@14 +M=D +@4177 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@8 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@25105 +D=A +@14 +M=D +@4200 +D=A +@95 +0;JMP +@83 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@4218 +D=A +@95 +0;JMP +@99 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@4236 +D=A +@95 +0;JMP +@111 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@4254 +D=A +@95 +0;JMP +@114 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@4272 +D=A +@95 +0;JMP +@101 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@4290 +D=A +@95 +0;JMP +@58 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@4308 +D=A +@95 +0;JMP +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@4326 +D=A +@95 +0;JMP +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@4344 +D=A +@95 +0;JMP +@1 +D=A +@13 +M=D +@19850 +D=A +@14 +M=D +@4356 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@2786 +D=A +@14 +M=D +@4450 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@346 +D=A +@14 +M=D +@4474 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@9357 +D=A +@14 +M=D +@4497 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@0 +D=A +@13 +M=D +@3930 +D=A +@14 +M=D +@4520 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@16 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@16 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@0 +AM=M+1 +A=A-1 +M=0 +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +M=!M +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@4943 +D;JNE +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@4590 +D=A +@6 +0;JMP +@3 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@4682 +D;JNE +@0 +D=A +@13 +M=D +@5924 +D=A +@14 +M=D +@4627 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@3211 +D=A +@14 +M=D +@4652 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@5191 +D=A +@14 +M=D +@4675 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@4575 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@130 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@4699 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@4706 +D;JNE +@4736 +0;JMP +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@2 +D=A +@13 +M=D +@3044 +D=A +@14 +M=D +@4729 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@4831 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@132 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@4753 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@4760 +D;JNE +@4792 +0;JMP +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@3044 +D=A +@14 +M=D +@4785 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@4831 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@140 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@4809 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@4816 +D;JNE +@4831 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@4846 +D=A +@6 +0;JMP +@0 +A=M-1 +M=!M +@3 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@4941 +D;JNE +@0 +D=A +@13 +M=D +@5924 +D=A +@14 +M=D +@4886 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@3211 +D=A +@14 +M=D +@4911 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@5191 +D=A +@14 +M=D +@4934 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@4831 +0;JMP +@4555 +0;JMP +@3 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4959 +D;JNE +@5185 +0;JMP +@10 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@19350 +D=A +@14 +M=D +@4983 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@9 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@25105 +D=A +@14 +M=D +@5006 +D=A +@95 +0;JMP +@71 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@5024 +D=A +@95 +0;JMP +@97 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@5042 +D=A +@95 +0;JMP +@109 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@5060 +D=A +@95 +0;JMP +@101 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@5078 +D=A +@95 +0;JMP +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@5096 +D=A +@95 +0;JMP +@79 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@5114 +D=A +@95 +0;JMP +@118 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@5132 +D=A +@95 +0;JMP +@101 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@5150 +D=A +@95 +0;JMP +@114 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@5168 +D=A +@95 +0;JMP +@1 +D=A +@13 +M=D +@19850 +D=A +@14 +M=D +@5180 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@5 +D=A +D=D-1 +@0 +AM=M+1 +A=A-1 +M=0 +@5193 +D;JGT +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@1126 +D=A +@14 +M=D +@5231 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@5254 +D=A +@22 +0;JMP +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@5 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@5275 +D=A +@6 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@0 +AM=M-1 +D=M +@5290 +D;JNE +@5802 +0;JMP +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@3078 +D=A +@14 +M=D +@5337 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@3099 +D=A +@14 +M=D +@5362 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@599 +D=A +@14 +M=D +@5388 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@620 +D=A +@14 +M=D +@5415 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@5442 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@5449 +D;JNE +@5771 +0;JMP +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@5469 +D=A +@22 +0;JMP +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@5490 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +M=D +@3 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@5522 +D;JNE +@5771 +0;JMP +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@10 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@5553 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +@5560 +D;JNE +@5576 +0;JMP +@0 +M=M+1 +A=M-1 +M=1 +@0 +A=M-1 +D=!M +M=D+1 +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@5625 +0;JMP +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@10 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@5608 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +@5615 +D;JNE +@5625 +0;JMP +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@3 +D=M +@6 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=M +@6 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@3133 +D=A +@14 +M=D +@5684 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@22 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@7 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@19350 +D=A +@14 +M=D +@5740 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@19981 +D=A +@14 +M=D +@5766 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@1835 +D=A +@14 +M=D +@5797 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@5823 +D=A +@22 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@5833 +D;JNE +@5856 +0;JMP +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@5851 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@8643 +D=A +@14 +M=D +@5875 +D=A +@95 +0;JMP +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@9357 +D=A +@14 +M=D +@5907 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@24576 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@8558 +D=A +@14 +M=D +@5942 +D=A +@95 +0;JMP +@54 +0;JMP +@0 +A=M +M=0 +AD=A+1 +M=0 +@0 +M=D+1 +@0 +M=M+1 +A=M-1 +M=0 +@1 +D=A +@13 +M=D +@19610 +D=A +@14 +M=D +@5967 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@5987 +D=A +@6 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@6002 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@6070 +D;JNE +@0 +D=A +@13 +M=D +@5924 +D=A +@14 +M=D +@6027 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@6048 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +@6055 +D;JNE +@6068 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@5972 +0;JMP +@0 +D=A +@13 +M=D +@27042 +D=A +@14 +M=D +@6082 +D=A +@95 +0;JMP +@1 +D=A +@13 +M=D +@19610 +D=A +@14 +M=D +@6094 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@19610 +D=A +@14 +M=D +@6118 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@5 +D=A +D=D-1 +@0 +AM=M+1 +A=A-1 +M=0 +@6134 +D;JGT +@80 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@25105 +D=A +@14 +M=D +@6159 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@19850 +D=A +@14 +M=D +@6186 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +D=A +@13 +M=D +@27034 +D=A +@14 +M=D +@6203 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@0 +D=A +@13 +M=D +@27042 +D=A +@14 +M=D +@6221 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +M=!M +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@6404 +D;JNE +@0 +D=A +@13 +M=D +@5944 +D=A +@14 +M=D +@6260 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@6284 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@6312 +D;JNE +@6402 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@6331 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@6338 +D;JNE +@6366 +0;JMP +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@25801 +D=A +@14 +M=D +@6359 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@6402 +0;JMP +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@6394 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@6228 +0;JMP +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@0 +A=M +M=0 +AD=A+1 +M=0 +@0 +M=D+1 +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@6132 +D=A +@14 +M=D +@6441 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@25889 +D=A +@14 +M=D +@6466 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@25252 +D=A +@14 +M=D +@6491 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@0 +AM=M+1 +A=A-1 +M=0 +@16 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@5808 +D=A +@14 +M=D +@6527 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@17 +M=D +@16 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@5808 +D=A +@14 +M=D +@6550 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@18 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@18 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@15 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6613 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@6768 +D;JNE +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@18 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@18 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@18 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@6596 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@6789 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +@6796 +D;JNE +@6813 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +D=!M +M=D+1 +@0 +AM=M-1 +D=M +@2 +A=M +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@5 +D=A +D=D-1 +@0 +AM=M+1 +A=A-1 +M=0 +@6824 +D;JGT +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@6846 +D=A +@38 +0;JMP +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@6861 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@6881 +D=A +@22 +0;JMP +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@6896 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@6774 +D=A +@14 +M=D +@6934 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@2 +A=M +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@6774 +D=A +@14 +M=D +@6959 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@2 +A=M+1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@6983 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +@6990 +D;JNE +@7029 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@2 +A=M +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@2 +A=M+1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@7048 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@7245 +D;JNE +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@18 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@0 +M=M+1 +A=M-1 +M=0 +@7108 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +@7115 +D;JNE +@7192 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@18 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@2 +A=M +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@7029 +0;JMP +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@7261 +D;JNE +@7278 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +D=!M +M=D+1 +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@4 +D=A +D=D-1 +@0 +AM=M+1 +A=A-1 +M=0 +@7289 +D;JGT +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@7311 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@7318 +D;JNE +@7341 +0;JMP +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@7336 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@7356 +D=A +@38 +0;JMP +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@7371 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@7391 +D=A +@22 +0;JMP +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@7406 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@17 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@6774 +D=A +@14 +M=D +@7457 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@6774 +D=A +@14 +M=D +@7498 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@2 +A=M +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +M=!M +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@7841 +D;JNE +@32767 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@17 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@17 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@7599 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@7626 +D;JNE +@7839 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@17 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@17 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@17 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@17 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@7790 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@7817 +D;JNE +@7839 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@7504 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +A=M-1 +D=!M +M=D+1 +@7860 +D=A +@22 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@8039 +D;JNE +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@17 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@7909 +D=A +@22 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@7919 +D;JNE +@8015 +0;JMP +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@18 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@17 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@2 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@7841 +0;JMP +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@8054 +D;JNE +@8071 +0;JMP +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +D=!M +M=D+1 +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@4 +D=A +D=D-1 +@0 +AM=M+1 +A=A-1 +M=0 +@8082 +D;JGT +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@8104 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +@8111 +D;JNE +@8134 +0;JMP +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@8129 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@7 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +A=M-1 +D=!M +M=D+1 +@8165 +D=A +@22 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@8348 +D;JNE +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@18 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@8249 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@8275 +D=A +@22 +0;JMP +@0 +A=M-1 +M=!M +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@8294 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@0 +AM=M-1 +D=M +@8309 +D;JNE +@8324 +0;JMP +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@8146 +0;JMP +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@8377 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +@8384 +D;JNE +@8397 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@2 +A=M+1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@8424 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +@8431 +D;JNE +@8444 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@2 +A=M+1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@19 +M=D +@2048 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@19 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@14334 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@2049 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@19 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2050 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@19 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@19 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@0 +AM=M+1 +A=A-1 +M=0 +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@8662 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +@8669 +D;JNE +@8692 +0;JMP +@5 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@8687 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2048 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=0 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@8743 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@8787 +D;JNE +@0 +M=M+1 +A=M-1 +M=1 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@8704 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@16379 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@8816 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +@8823 +D;JNE +@8846 +0;JMP +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@8841 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@8896 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +@8903 +D;JNE +@9295 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +M=M+1 +A=M-1 +M=0 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=1 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@9056 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@9063 +D;JNE +@9147 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@9227 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +M=M+1 +A=M-1 +M=1 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=1 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=0 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@54 +0;JMP +@0 +A=M +M=0 +AD=A+1 +M=0 +@0 +M=D+1 +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=1 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@9458 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@9465 +D;JNE +@9556 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +M=M+1 +A=M-1 +M=1 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@9848 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +M=M+1 +A=M-1 +M=1 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +M=M+1 +A=M-1 +M=0 +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=1 +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@9717 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@9724 +D;JNE +@9782 +0;JMP +@0 +M=M+1 +A=M-1 +M=1 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@9848 +0;JMP +@0 +M=M+1 +A=M-1 +M=1 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +M=M+1 +A=M-1 +M=1 +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@16384 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@20 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@21 +M=D +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@22 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@23 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@25105 +D=A +@14 +M=D +@9915 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@24 +M=D +@0 +D=A +@13 +M=D +@9960 +D=A +@14 +M=D +@9932 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +D=A +@13 +M=D +@18456 +D=A +@14 +M=D +@9949 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@127 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@5808 +D=A +@14 +M=D +@9978 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@25 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@10061 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@10128 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@33 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@10211 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@34 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@20 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@10284 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@35 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@18 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@18 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@18 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@18 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@18 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@18 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@10367 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@36 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@10454 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@37 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@35 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@49 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@10535 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@38 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@10620 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@39 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@10693 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@40 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@10778 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@41 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@10863 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@42 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@10940 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@43 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@11017 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@44 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@11090 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@45 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@11159 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@46 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@11230 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@47 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@11309 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@11394 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@49 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@14 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@15 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@11479 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@50 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@11564 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@28 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@11649 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@52 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@16 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@28 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@26 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@25 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@60 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@11734 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@53 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@31 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@11819 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@54 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@28 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@31 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@11904 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@55 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@49 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@11989 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@56 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@12074 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@57 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@62 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@14 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@12159 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@58 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@12234 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@59 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@12311 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@60 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@12392 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@61 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@12463 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@62 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@12544 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@64 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@59 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@59 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@59 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@12629 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@12712 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@65 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@12797 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@66 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@31 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@31 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@31 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@12882 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@67 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@28 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@35 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@35 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@28 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@12967 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@68 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@15 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@15 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@13052 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@69 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@35 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@11 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@15 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@11 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@35 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@13137 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@70 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@35 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@11 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@15 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@11 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@13222 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@71 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@28 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@35 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@59 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@44 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@13307 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@72 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@13392 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@73 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@13477 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@74 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@60 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@14 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@13562 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@75 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@15 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@13647 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@76 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@35 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@13732 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@77 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@33 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@13817 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@78 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@55 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@55 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@59 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@59 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@13902 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@79 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@13987 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@80 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@31 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@31 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@14072 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@81 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@59 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@14159 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@82 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@31 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@31 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@14244 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@83 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@28 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@14329 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@84 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@45 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@14414 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@85 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@14499 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@86 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@14584 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@87 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@18 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@14669 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@88 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@14754 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@89 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@14839 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@90 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@49 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@35 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@14924 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@91 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@15009 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@92 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=1 +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@15088 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@93 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@15173 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@94 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@8 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@28 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@15246 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@95 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@15315 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@96 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@15388 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@97 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@14 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@15467 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@98 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@15 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@15552 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@99 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@15631 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@100 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@60 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@15716 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@101 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@15795 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@102 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@28 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@38 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@15 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@15 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@15880 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@103 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@62 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@15963 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@104 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@55 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@16048 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@105 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@14 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@16131 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@106 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@56 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@16216 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@107 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@15 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@15 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@16301 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@108 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@14 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@16386 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@109 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@29 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@43 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@43 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@43 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@43 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@16465 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@110 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@29 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@16544 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@111 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@16623 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@112 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@31 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@16704 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@113 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@62 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@16785 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@114 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@29 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@55 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@7 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@16864 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@115 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@16943 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@116 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@15 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@28 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@17028 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@117 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@17107 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@118 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@17186 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@119 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@18 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@17265 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@120 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@30 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@17344 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@121 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@62 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@15 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@17425 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@122 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@51 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@17504 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@123 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@56 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@7 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@56 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@17589 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@124 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@17674 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@125 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@7 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@56 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@7 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@17759 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@126 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@38 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@45 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@25 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@0 +M=M+1 +A=M-1 +M=0 +@12 +D=A +@13 +M=D +@17843 +D=A +@14 +M=D +@17832 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@0 +AM=M+1 +A=A-1 +M=0 +@11 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@5808 +D=A +@14 +M=D +@17865 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@25 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=0 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=1 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@4 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +D=M +@5 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@5 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +D=M +@6 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +D=M +@7 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@7 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +D=M +@8 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@8 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +D=M +@9 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@9 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +D=M +@10 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@10 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +D=M +@11 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@4 +D=A +D=D-1 +@0 +AM=M+1 +A=A-1 +M=0 +@18458 +D;JGT +@127 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@5808 +D=A +@14 +M=D +@18483 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@26 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@127 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@18517 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@18859 +D;JNE +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@25 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@11 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@5808 +D=A +@14 +M=D +@18580 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@26 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@11 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@18665 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@18795 +D;JNE +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@256 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@18745 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@18646 +0;JMP +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@18811 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@18818 +D;JNE +@18833 +0;JMP +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@18857 +0;JMP +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@18499 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@0 +AM=M+1 +A=A-1 +M=0 +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@18886 +D=A +@38 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@126 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@18903 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +AM=M-1 +D=M +@18915 +D;JNE +@18925 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@2 +A=M +M=D +@21 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@18938 +D;JNE +@18976 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@25 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@19012 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@26 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@4 +D=A +D=D-1 +@0 +AM=M+1 +A=A-1 +M=0 +@19023 +D;JGT +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@18865 +D=A +@14 +M=D +@19049 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@22 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@11 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@19085 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@19344 +D;JNE +@21 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@19106 +D;JNE +@19161 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@20 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@256 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +D=!M +M=D+1 +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@19210 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@20 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@255 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@20 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@19068 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@19365 +D=A +@38 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@22 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@19382 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@19402 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@63 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@19424 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +AM=M-1 +D=M +@19436 +D;JNE +@19459 +0;JMP +@20 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@19454 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@7287 +D=A +@14 +M=D +@19484 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@23 +M=D +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@352 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@19520 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@23 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@22 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@23 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@19572 +D=A +@95 +0;JMP +@19576 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@21 +M=D +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@19021 +D=A +@14 +M=D +@19599 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +D=A +@13 +M=D +@27034 +D=A +@14 +M=D +@19629 +D=A +@95 +0;JMP +@19633 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@19640 +D;JNE +@19659 +0;JMP +@0 +D=A +@13 +M=D +@20040 +D=A +@14 +M=D +@19652 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@19844 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +D=A +@13 +M=D +@27042 +D=A +@14 +M=D +@19678 +D=A +@95 +0;JMP +@19682 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@19689 +D;JNE +@19708 +0;JMP +@0 +D=A +@13 +M=D +@20134 +D=A +@14 +M=D +@19701 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@19844 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@19021 +D=A +@14 +M=D +@19727 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@21 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@19748 +D;JNE +@19788 +0;JMP +@23 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@23 +M=D +@22 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@22 +M=D +@23 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@19804 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@19811 +D;JNE +@19830 +0;JMP +@0 +D=A +@13 +M=D +@20040 +D=A +@14 +M=D +@19823 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@19844 +0;JMP +@21 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@21 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@0 +A=M +M=0 +AD=A+1 +M=0 +@0 +M=D+1 +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@25339 +D=A +@14 +M=D +@19876 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@19900 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@19975 +D;JNE +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25361 +D=A +@14 +M=D +@19934 +D=A +@95 +0;JMP +@1 +D=A +@13 +M=D +@19610 +D=A +@14 +M=D +@19946 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@19882 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@24 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@26291 +D=A +@14 +M=D +@20006 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@24 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@19850 +D=A +@14 +M=D +@20029 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@22 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@352 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@23 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@22 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@23 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@21 +M=D +@22 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@8128 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@20110 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@20117 +D;JNE +@20128 +0;JMP +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@22 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@21 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@20147 +D;JNE +@20288 +0;JMP +@23 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@20161 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +@20168 +D;JNE +@20210 +0;JMP +@23 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@23 +M=D +@22 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@22 +M=D +@20277 +0;JMP +@31 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@23 +M=D +@22 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@20237 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@20244 +D;JNE +@20255 +0;JMP +@8128 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@22 +M=D +@22 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@321 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@22 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@21 +M=D +@20300 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@21 +M=D +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@19021 +D=A +@14 +M=D +@20318 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@0 +AM=M+1 +A=A-1 +M=0 +@16384 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@27 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@28 +M=D +@17 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@5808 +D=A +@14 +M=D +@20374 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@29 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@29 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@16 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@20437 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@20592 +D;JNE +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@29 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@29 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@29 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@20420 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@0 +AM=M+1 +A=A-1 +M=0 +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@8192 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@20619 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@20695 +D;JNE +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@20602 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@28 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@20714 +D;JNE +@20798 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@20883 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@27 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@28 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@3 +D=A +D=D-1 +@0 +AM=M+1 +A=A-1 +M=0 +@20909 +D;JGT +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@20931 +D=A +@38 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@511 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@20948 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@20968 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@255 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@20990 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +AM=M-1 +D=M +@21002 +D;JNE +@21025 +0;JMP +@7 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@21020 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@16 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@7287 +D=A +@14 +M=D +@21050 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@16 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@21088 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@21124 +D=A +@95 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@29 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@20701 +D=A +@14 +M=D +@21193 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@21219 +D;JNE +@21252 +0;JMP +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@20907 +D=A +@14 +M=D +@21245 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@21283 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@20907 +D=A +@14 +M=D +@21278 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@11 +D=A +D=D-1 +@0 +AM=M+1 +A=A-1 +M=0 +@21291 +D;JGT +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@21313 +D=A +@38 +0;JMP +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@511 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@21331 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@21351 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@255 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@21375 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +AM=M-1 +D=M +@21387 +D;JNE +@21410 +0;JMP +@8 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@21405 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@1 +D=A +@13 +M=D +@6774 +D=A +@14 +M=D +@21442 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@1 +D=A +@13 +M=D +@6774 +D=A +@14 +M=D +@21483 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@21511 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@1 +D=M +@6 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@21551 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@1 +D=M +@6 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +M=!M +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@21587 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +AM=M-1 +D=M +@21604 +D;JNE +@21698 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@2 +A=M +M=D +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@2 +A=M+1 +A=A+1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@2 +A=M+1 +M=D +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@2 +A=M+1 +A=A+1 +A=A+1 +M=D +@1 +D=M +@6 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@21714 +D;JNE +@21844 +0;JMP +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@8 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@21830 +D=A +@22 +0;JMP +@1 +D=M +@7 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@21922 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@8 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@21910 +D=A +@22 +0;JMP +@1 +D=M +@7 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@21948 +D=A +@95 +0;JMP +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@21998 +D=A +@95 +0;JMP +@1 +D=M +@9 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@22050 +D=A +@95 +0;JMP +@1 +D=M +@10 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@6 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@13 +M=D +@21204 +D=A +@14 +M=D +@22097 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@8 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@22122 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@22348 +D;JNE +@1 +D=M +@5 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@22147 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +@22154 +D;JNE +@22189 +0;JMP +@1 +D=M +@5 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@9 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@22284 +0;JMP +@1 +D=M +@5 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@10 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@1 +D=M +@7 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@22238 +D;JNE +@22262 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@22284 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@6 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +D=A +@13 +M=D +@21204 +D=A +@14 +M=D +@22341 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@22102 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@9 +D=A +D=D-1 +@0 +AM=M+1 +A=A-1 +M=0 +@22356 +D;JGT +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@22382 +D=A +@22 +0;JMP +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@22402 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@22422 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@511 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@22445 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@22465 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@255 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@22489 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +AM=M-1 +D=M +@22501 +D;JNE +@22524 +0;JMP +@9 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@22519 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@16 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@7287 +D=A +@14 +M=D +@22549 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@16 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@22591 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@1 +D=M +@7 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@16 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@7287 +D=A +@14 +M=D +@22634 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@16 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@22678 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@1 +D=M +@8 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@1 +D=M +@7 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@29 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@1 +D=M +@8 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@29 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@22835 +D=A +@95 +0;JMP +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@22905 +D=A +@22 +0;JMP +@0 +A=M-1 +M=!M +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@23245 +D;JNE +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@22958 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@22965 +D;JNE +@23014 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@5 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@6 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@2 +D=A +@13 +M=D +@20701 +D=A +@14 +M=D +@23007 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@23184 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@6 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@20701 +D=A +@14 +M=D +@23042 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@23087 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@23151 +D;JNE +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +A=M-1 +D=!M +M=D+1 +@2 +D=A +@13 +M=D +@20701 +D=A +@14 +M=D +@23122 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@23069 +0;JMP +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@5 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@20701 +D=A +@14 +M=D +@23179 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@2 +A=M+1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@22885 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@11 +D=A +D=D-1 +@0 +AM=M+1 +A=A-1 +M=0 +@23253 +D;JGT +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@8406 +D=A +@14 +M=D +@23287 +D=A +@95 +0;JMP +@1 +D=M +@7 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@8359 +D=A +@14 +M=D +@23326 +D=A +@95 +0;JMP +@1 +D=M +@8 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +A=M-1 +D=!M +M=D+1 +@23357 +D=A +@22 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@256 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@23374 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@1 +D=M +@7 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@512 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@23398 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@1 +D=M +@8 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +A=M-1 +D=!M +M=D+1 +@23424 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@0 +AM=M-1 +D=M +@23436 +D;JNE +@24145 +0;JMP +@1 +D=M +@7 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@2 +D=A +@13 +M=D +@8359 +D=A +@14 +M=D +@23461 +D=A +@95 +0;JMP +@1 +D=M +@7 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@1 +D=M +@8 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@511 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@8406 +D=A +@14 +M=D +@23500 +D=A +@95 +0;JMP +@1 +D=M +@8 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@1 +D=M +@7 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@16 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@7287 +D=A +@14 +M=D +@23539 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@1 +D=M +@7 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@16 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@23579 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@1 +D=M +@9 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@1 +D=M +@8 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@16 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@7287 +D=A +@14 +M=D +@23623 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@1 +D=M +@8 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@16 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@23665 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@1 +D=M +@10 +D=D+A +@13 +M=D +@0 +AM=M-1 +D=M +@13 +A=M +M=D +@1 +D=M +@9 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@29 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@1 +D=M +@10 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@29 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@32 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@23820 +D=A +@95 +0;JMP +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@6 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@1 +D=M +@6 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@23915 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@23922 +D;JNE +@23971 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@5 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@2 +D=A +@13 +M=D +@20701 +D=A +@14 +M=D +@23964 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@24145 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@5 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@20701 +D=A +@14 +M=D +@23999 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@24046 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@24110 +D;JNE +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +A=M-1 +D=!M +M=D+1 +@2 +D=A +@13 +M=D +@20701 +D=A +@14 +M=D +@24081 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@24026 +0;JMP +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@20701 +D=A +@14 +M=D +@24140 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@3 +D=A +@13 +M=D +@23251 +D=A +@14 +M=D +@24224 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@3 +D=A +@13 +M=D +@23251 +D=A +@14 +M=D +@24302 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@3 +D=A +@13 +M=D +@23251 +D=A +@14 +M=D +@24381 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@3 +D=A +@13 +M=D +@23251 +D=A +@14 +M=D +@24460 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@3 +D=A +D=D-1 +@0 +AM=M+1 +A=A-1 +M=0 +@24473 +D;JGT +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@24495 +D=A +@38 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@511 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24512 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@24532 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@255 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24554 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +AM=M-1 +D=M +@24566 +D;JNE +@24589 +0;JMP +@12 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@24584 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +M=M+1 +A=M-1 +M=0 +@24617 +D=A +@38 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@511 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24647 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +M=M+1 +A=M-1 +M=0 +@24680 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@255 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@24715 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +AM=M-1 +D=M +@24727 +D;JNE +@24750 +0;JMP +@13 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@24745 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@13 +M=D +@24151 +D=A +@14 +M=D +@24828 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@24851 +D=A +@22 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@25099 +D;JNE +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@24875 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +@24882 +D;JNE +@24940 +0;JMP +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@24915 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@25030 +0;JMP +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@24985 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@5 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@4 +D=A +@13 +M=D +@24151 +D=A +@14 +M=D +@25092 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@24833 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@8643 +D=A +@14 +M=D +@25123 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@3 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@25143 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +@25150 +D;JNE +@25173 +0;JMP +@14 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@25168 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@25188 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +@25195 +D;JNE +@25220 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@5808 +D=A +@14 +M=D +@25214 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@3 +A=M+1 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@25279 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +@25286 +D;JNE +@25310 +0;JMP +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@5877 +D=A +@14 +M=D +@25305 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@9357 +D=A +@14 +M=D +@25328 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@25388 +D=A +@38 +0;JMP +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@25407 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@25431 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +AM=M-1 +D=M +@25443 +D;JNE +@25466 +0;JMP +@15 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@25461 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@25526 +D=A +@38 +0;JMP +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@25545 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@25569 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +AM=M-1 +D=M +@25581 +D;JNE +@25604 +0;JMP +@16 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@25599 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@25690 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@25697 +D;JNE +@25720 +0;JMP +@17 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@25715 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +M=D +@3 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@25829 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@25836 +D;JNE +@25859 +0;JMP +@18 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@25854 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@5 +D=A +D=D-1 +@0 +AM=M+1 +A=A-1 +M=0 +@25891 +D;JGT +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@25926 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@25933 +D;JNE +@25939 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@45 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@25992 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@25999 +D;JNE +@26025 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +A=A+1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@26044 +D=A +@38 +0;JMP +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D&M +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@26249 +D;JNE +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@26131 +D=A +@38 +0;JMP +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@9 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@26149 +D=A +@22 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=D|M +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@26181 +D;JNE +@26247 +0;JMP +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@10 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@26206 +D=A +@95 +0;JMP +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@26025 +0;JMP +@1 +D=M +@4 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@26265 +D;JNE +@26282 +0;JMP +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +D=!M +M=D+1 +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@4 +D=A +D=D-1 +@0 +AM=M+1 +A=A-1 +M=0 +@26293 +D;JGT +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@3 +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@26327 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@26334 +D;JNE +@26357 +0;JMP +@19 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@26352 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@6 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@5808 +D=A +@14 +M=D +@26375 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@26397 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +@26404 +D;JNE +@26436 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@1 +A=M+1 +A=A+1 +A=A+1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +A=M-1 +D=!M +M=D+1 +@0 +AM=M-1 +D=M +@2 +A=M+1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@26464 +D=A +@22 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@26630 +D;JNE +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@10 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@7287 +D=A +@14 +M=D +@26497 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@1 +A=M+1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@10 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@6822 +D=A +@14 +M=D +@26561 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@2 +A=M+1 +M=D +@26449 +0;JMP +@1 +D=M +@3 +A=D+A +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@26646 +D;JNE +@26716 +0;JMP +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@45 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@3 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@26734 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +@26741 +D;JNE +@26764 +0;JMP +@19 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@26759 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@26779 +D=A +@6 +0;JMP +@0 +AM=M-1 +D=M +@26786 +D;JNE +@26843 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@48 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +M=D +@27003 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@26873 +D=A +@38 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@27003 +D;JNE +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@4 +M=D +@4 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@5 +M=D +@0 +AM=M-1 +D=M +@4 +M=D +@5 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@4 +A=M +M=D +@3 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=D+M +@0 +AM=M-1 +D=M +@3 +A=M+1 +A=A+1 +M=D +@26854 +0;JMP +@1 +A=M+1 +A=A+1 +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@5877 +D=A +@14 +M=D +@27023 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@128 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@129 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@34 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@54 +0;JMP +@0 +D=A +@13 +M=D +@8453 +D=A +@14 +M=D +@27070 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +D=A +@13 +M=D +@6505 +D=A +@14 +M=D +@27087 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +D=A +@13 +M=D +@20329 +D=A +@14 +M=D +@27104 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +D=A +@13 +M=D +@9854 +D=A +@14 +M=D +@27121 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +D=A +@13 +M=D +@5918 +D=A +@14 +M=D +@27138 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +D=A +@13 +M=D +@3837 +D=A +@14 +M=D +@27155 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +D=A +@13 +M=D +@27177 +D=A +@14 +M=D +@27172 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@0 +A=M-1 +M=!M +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@27194 +D;JNE +@27177 +0;JMP +@0 +AM=M+1 +A=A-1 +M=0 +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@27213 +D=A +@38 +0;JMP +@0 +AM=M-1 +D=M +@27220 +D;JNE +@27241 +0;JMP +@0 +M=M+1 +A=M-1 +M=1 +@1 +D=A +@13 +M=D +@27353 +D=A +@14 +M=D +@27236 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@27256 +D=A +@22 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@27347 +D;JNE +@50 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=0 +@27291 +D=A +@22 +0;JMP +@0 +A=M-1 +M=!M +@0 +AM=M-1 +D=M +@27323 +D;JNE +@1 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@1 +A=M +M=D +@27276 +0;JMP +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@0 +M=M+1 +A=M-1 +M=1 +@0 +AM=M-1 +D=M +A=A-1 +M=M-D +@0 +AM=M-1 +D=M +@2 +A=M +M=D +@27241 +0;JMP +@0 +M=M+1 +A=M-1 +M=0 +@54 +0;JMP +@3 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@25105 +D=A +@14 +M=D +@27371 +D=A +@95 +0;JMP +@69 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@27389 +D=A +@95 +0;JMP +@82 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@27407 +D=A +@95 +0;JMP +@82 +D=A +@0 +AM=M+1 +A=A-1 +M=D +@2 +D=A +@13 +M=D +@25659 +D=A +@14 +M=D +@27425 +D=A +@95 +0;JMP +@1 +D=A +@13 +M=D +@19850 +D=A +@14 +M=D +@27437 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@2 +A=M +D=M +@0 +AM=M+1 +A=A-1 +M=D +@1 +D=A +@13 +M=D +@19981 +D=A +@14 +M=D +@27461 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D +@0 +D=A +@13 +M=D +@27177 +D=A +@14 +M=D +@27478 +D=A +@95 +0;JMP +@0 +AM=M-1 +D=M +@5 +M=D diff --git a/projects/06/rect/Rect.asm b/projects/06/rect/Rect.asm new file mode 100644 index 0000000..6cbbaeb --- /dev/null +++ b/projects/06/rect/Rect.asm @@ -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: projects/06/rect/Rect.asm + +// Draws a rectangle at the top-left corner of the screen. +// The rectangle is 16 pixels wide and R0 pixels high. + + @0 + D=M + @INFINITE_LOOP + D;JLE + @counter + M=D + @SCREEN + D=A + @address + M=D +(LOOP) + @address + A=M + M=-1 + @address + D=M + @32 + D=D+A + @address + M=D + @counter + MD=M-1 + @LOOP + D;JGT +(INFINITE_LOOP) + @INFINITE_LOOP + 0;JMP diff --git a/projects/06/rect/RectL.asm b/projects/06/rect/RectL.asm new file mode 100644 index 0000000..e97c09b --- /dev/null +++ b/projects/06/rect/RectL.asm @@ -0,0 +1,32 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/06/rect/RectL.asm + +// Symbol-less version of the Rect.asm program. + +@0 +D=M +@23 +D;JLE +@16 +M=D +@16384 +D=A +@17 +M=D +@17 +A=M +M=-1 +@17 +D=M +@32 +D=D+A +@17 +M=D +@16 +MD=M-1 +@10 +D;JGT +@23 +0;JMP diff --git a/projects/07/MemoryAccess/BasicTest/BasicTest.cmp b/projects/07/MemoryAccess/BasicTest/BasicTest.cmp new file mode 100644 index 0000000..538454b --- /dev/null +++ b/projects/07/MemoryAccess/BasicTest/BasicTest.cmp @@ -0,0 +1,2 @@ +|RAM[256]|RAM[300]|RAM[401]|RAM[402]|RAM[3006|RAM[3012|RAM[3015|RAM[11] | +| 472 | 10 | 21 | 22 | 36 | 42 | 45 | 510 | diff --git a/projects/07/MemoryAccess/BasicTest/BasicTest.tst b/projects/07/MemoryAccess/BasicTest/BasicTest.tst new file mode 100644 index 0000000..fa6d9a6 --- /dev/null +++ b/projects/07/MemoryAccess/BasicTest/BasicTest.tst @@ -0,0 +1,25 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/07/MemoryAccess/BasicTest/BasicTest.tst + +load BasicTest.asm, +output-file BasicTest.out, +compare-to BasicTest.cmp, +output-list RAM[256]%D1.6.1 RAM[300]%D1.6.1 RAM[401]%D1.6.1 + RAM[402]%D1.6.1 RAM[3006]%D1.6.1 RAM[3012]%D1.6.1 + RAM[3015]%D1.6.1 RAM[11]%D1.6.1; + +set RAM[0] 256, // stack pointer +set RAM[1] 300, // base address of the local segment +set RAM[2] 400, // base address of the argument segment +set RAM[3] 3000, // base address of the this segment +set RAM[4] 3010, // base address of the that segment + +repeat 600 { // enough cycles to complete the execution + ticktock; +} + +// Outputs the stack base and some values +// from the tested memory segments +output; diff --git a/projects/07/MemoryAccess/BasicTest/BasicTest.vm b/projects/07/MemoryAccess/BasicTest/BasicTest.vm new file mode 100644 index 0000000..b2f9343 --- /dev/null +++ b/projects/07/MemoryAccess/BasicTest/BasicTest.vm @@ -0,0 +1,31 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/07/MemoryAccess/BasicTest/BasicTest.vm + +// Executes pop and push commands using the virtual memory segments. +push constant 10 +pop local 0 +push constant 21 +push constant 22 +pop argument 2 +pop argument 1 +push constant 36 +pop this 6 +push constant 42 +push constant 45 +pop that 5 +pop that 2 +push constant 510 +pop temp 6 +push local 0 +push that 5 +add +push argument 1 +sub +push this 6 +push this 6 +add +sub +push temp 6 +add diff --git a/projects/07/MemoryAccess/BasicTest/BasicTestVME.tst b/projects/07/MemoryAccess/BasicTest/BasicTestVME.tst new file mode 100644 index 0000000..24e9090 --- /dev/null +++ b/projects/07/MemoryAccess/BasicTest/BasicTestVME.tst @@ -0,0 +1,25 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/07/MemoryAccess/BasicTest/BasicTestVME.tst + +load BasicTest.vm, +output-file BasicTest.out, +compare-to BasicTest.cmp, +output-list RAM[256]%D1.6.1 RAM[300]%D1.6.1 RAM[401]%D1.6.1 + RAM[402]%D1.6.1 RAM[3006]%D1.6.1 RAM[3012]%D1.6.1 + RAM[3015]%D1.6.1 RAM[11]%D1.6.1; + +set sp 256, // stack pointer +set local 300, // base address of the local segment +set argument 400, // base address of the argument segment +set this 3000, // base address of the this segment +set that 3010, // base address of the that segment + +repeat 25 { // BasicTest.vm has 25 instructions + vmstep; +} + +// Outputs the stack base and some values +// from the tested memory segments +output; diff --git a/projects/07/MemoryAccess/PointerTest/PointerTest.cmp b/projects/07/MemoryAccess/PointerTest/PointerTest.cmp new file mode 100644 index 0000000..b59fa97 --- /dev/null +++ b/projects/07/MemoryAccess/PointerTest/PointerTest.cmp @@ -0,0 +1,2 @@ +|RAM[256]| RAM[3] | RAM[4] |RAM[3032|RAM[3046| +| 6084 | 3030 | 3040 | 32 | 46 | diff --git a/projects/07/MemoryAccess/PointerTest/PointerTest.tst b/projects/07/MemoryAccess/PointerTest/PointerTest.tst new file mode 100644 index 0000000..cd5515d --- /dev/null +++ b/projects/07/MemoryAccess/PointerTest/PointerTest.tst @@ -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: projects/07/MemoryAccess/PointerTest/PointerTest.tst + +load PointerTest.asm, +output-file PointerTest.out, +compare-to PointerTest.cmp, +output-list RAM[256]%D1.6.1 RAM[3]%D1.6.1 + RAM[4]%D1.6.1 RAM[3032]%D1.6.1 RAM[3046]%D1.6.1; + +set RAM[0] 256, // initializes the stack pointer + +repeat 450 { // enough cycles to complete the execution + ticktock; +} + +// outputs the stack base, this, that, and +// some values from the the this and that segments +output; diff --git a/projects/07/MemoryAccess/PointerTest/PointerTest.vm b/projects/07/MemoryAccess/PointerTest/PointerTest.vm new file mode 100644 index 0000000..5b0a109 --- /dev/null +++ b/projects/07/MemoryAccess/PointerTest/PointerTest.vm @@ -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: projects/07/MemoryAccess/PointerTest/PointerTest.vm + +// Executes pop and push commands using the +// pointer, this, and that segments. +push constant 3030 +pop pointer 0 +push constant 3040 +pop pointer 1 +push constant 32 +pop this 2 +push constant 46 +pop that 6 +push pointer 0 +push pointer 1 +add +push this 2 +sub +push that 6 +add diff --git a/projects/07/MemoryAccess/PointerTest/PointerTestVME.tst b/projects/07/MemoryAccess/PointerTest/PointerTestVME.tst new file mode 100644 index 0000000..1b395c2 --- /dev/null +++ b/projects/07/MemoryAccess/PointerTest/PointerTestVME.tst @@ -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: projects/07/MemoryAccess/PointerTest/PointerTestVME.tst + +load PointerTest.vm, +output-file PointerTest.out, +compare-to PointerTest.cmp, +output-list RAM[256]%D1.6.1 RAM[3]%D1.6.1 RAM[4]%D1.6.1 + RAM[3032]%D1.6.1 RAM[3046]%D1.6.1; + +set RAM[0] 256, // initializes the stack pointer + +repeat 15 { // PointerTest.vm has 15 instructions + vmstep; +} + +// outputs the stack base, this, that, and +// some values from the the this and that segments +output; diff --git a/projects/07/MemoryAccess/StaticTest/StaticTest.cmp b/projects/07/MemoryAccess/StaticTest/StaticTest.cmp new file mode 100644 index 0000000..29f4bf0 --- /dev/null +++ b/projects/07/MemoryAccess/StaticTest/StaticTest.cmp @@ -0,0 +1,2 @@ +|RAM[256]| +| 1110 | diff --git a/projects/07/MemoryAccess/StaticTest/StaticTest.tst b/projects/07/MemoryAccess/StaticTest/StaticTest.tst new file mode 100644 index 0000000..1f23d66 --- /dev/null +++ b/projects/07/MemoryAccess/StaticTest/StaticTest.tst @@ -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: projects/07/MemoryAccess/StaticTest/StaticTest.tst + +load StaticTest.asm, +output-file StaticTest.out, +compare-to StaticTest.cmp, +output-list RAM[256]%D1.6.1; + +set RAM[0] 256, // initializes the stack pointer + +repeat 200 { // enough cycles to complete the execution + ticktock; +} + +output; // the stack base diff --git a/projects/07/MemoryAccess/StaticTest/StaticTest.vm b/projects/07/MemoryAccess/StaticTest/StaticTest.vm new file mode 100644 index 0000000..65b4f6f --- /dev/null +++ b/projects/07/MemoryAccess/StaticTest/StaticTest.vm @@ -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: projects/07/MemoryAccess/StaticTest/StaticTest.vm + +// Executes pop and push commands using the static segment. +push constant 111 +push constant 333 +push constant 888 +pop static 8 +pop static 3 +pop static 1 +push static 3 +push static 1 +sub +push static 8 +add diff --git a/projects/07/MemoryAccess/StaticTest/StaticTestVME.tst b/projects/07/MemoryAccess/StaticTest/StaticTestVME.tst new file mode 100644 index 0000000..52882a4 --- /dev/null +++ b/projects/07/MemoryAccess/StaticTest/StaticTestVME.tst @@ -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: projects/07/MemoryAccess/StaticTest/StaticTestVME.tst + +load StaticTest.vm, +output-file StaticTest.out, +compare-to StaticTest.cmp, +output-list RAM[256]%D1.6.1; + +set sp 256, // initializes the stack pointer + +repeat 11 { // StaticTest.vm has 11 instructions + vmstep; +} + +output; // the stack base diff --git a/projects/07/StackArithmetic/SimpleAdd/SimpleAdd.cmp b/projects/07/StackArithmetic/SimpleAdd/SimpleAdd.cmp new file mode 100644 index 0000000..7a3585b --- /dev/null +++ b/projects/07/StackArithmetic/SimpleAdd/SimpleAdd.cmp @@ -0,0 +1,2 @@ +| RAM[0] | RAM[256] | +| 257 | 15 | diff --git a/projects/07/StackArithmetic/SimpleAdd/SimpleAdd.tst b/projects/07/StackArithmetic/SimpleAdd/SimpleAdd.tst new file mode 100644 index 0000000..02dece3 --- /dev/null +++ b/projects/07/StackArithmetic/SimpleAdd/SimpleAdd.tst @@ -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: projects/07/StackArithmetic/SimpleAdd/SimpleAdd.tst + +load SimpleAdd.asm, +output-file SimpleAdd.out, +compare-to SimpleAdd.cmp, +output-list RAM[0]%D2.6.2 RAM[256]%D2.6.2; + +set RAM[0] 256, // initializes the stack pointer + +repeat 60 { // enough cycles to complete the execution + ticktock; +} + +output; // the stack pointer and the stack base diff --git a/projects/07/StackArithmetic/SimpleAdd/SimpleAdd.vm b/projects/07/StackArithmetic/SimpleAdd/SimpleAdd.vm new file mode 100644 index 0000000..cfd4ee9 --- /dev/null +++ b/projects/07/StackArithmetic/SimpleAdd/SimpleAdd.vm @@ -0,0 +1,9 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/07/StackArithmetic/SimpleAdd/SimpleAdd.vm + +// Pushes and adds two constants. +push constant 7 +push constant 8 +add diff --git a/projects/07/StackArithmetic/SimpleAdd/SimpleAddVME.tst b/projects/07/StackArithmetic/SimpleAdd/SimpleAddVME.tst new file mode 100644 index 0000000..5010f4f --- /dev/null +++ b/projects/07/StackArithmetic/SimpleAdd/SimpleAddVME.tst @@ -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: projects/07/StackArithmetic/SimpleAdd/SimpleAddVME.tst + +load SimpleAdd.vm, +output-file SimpleAdd.out, +compare-to SimpleAdd.cmp, +output-list RAM[0]%D2.6.2 RAM[256]%D2.6.2; + +set RAM[0] 256, // initializes the stack pointer + +repeat 3 { // SimpleAdd.vm has 3 instructions + vmstep; +} + +output; // the stack pointer and the stack base diff --git a/projects/07/StackArithmetic/StackTest/StackTest.cmp b/projects/07/StackArithmetic/StackTest/StackTest.cmp new file mode 100644 index 0000000..f90fa1b --- /dev/null +++ b/projects/07/StackArithmetic/StackTest/StackTest.cmp @@ -0,0 +1,4 @@ +| RAM[0] | RAM[256] | RAM[257] | RAM[258] | RAM[259] | RAM[260] | +| 266 | -1 | 0 | 0 | 0 | -1 | +| RAM[261] | RAM[262] | RAM[263] | RAM[264] | RAM[265] | +| 0 | -1 | 0 | 0 | -91 | diff --git a/projects/07/StackArithmetic/StackTest/StackTest.tst b/projects/07/StackArithmetic/StackTest/StackTest.tst new file mode 100644 index 0000000..f9c5396 --- /dev/null +++ b/projects/07/StackArithmetic/StackTest/StackTest.tst @@ -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: projects/07/StackArithmetic/StackTest/StackTest.tst + +load StackTest.asm, +output-file StackTest.out, +compare-to StackTest.cmp, +output-list RAM[0]%D2.6.2 + RAM[256]%D2.6.2 RAM[257]%D2.6.2 RAM[258]%D2.6.2 RAM[259]%D2.6.2 RAM[260]%D2.6.2; + +set RAM[0] 256, // initializes the stack pointer + +repeat 1000 { // enough cycles to complete the execution + ticktock; +} + +// outputs the stack pointer (RAM[0]) and +// the stack contents: RAM[256]-RAM[265] +output; +output-list RAM[261]%D2.6.2 RAM[262]%D2.6.2 RAM[263]%D2.6.2 RAM[264]%D2.6.2 RAM[265]%D2.6.2; +output; diff --git a/projects/07/StackArithmetic/StackTest/StackTest.vm b/projects/07/StackArithmetic/StackTest/StackTest.vm new file mode 100644 index 0000000..bfe78e0 --- /dev/null +++ b/projects/07/StackArithmetic/StackTest/StackTest.vm @@ -0,0 +1,45 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/07/StackArithmetic/StackTest/StackTest.vm + +// Executes a sequence of arithmetic and logical operations +// on the stack. +push constant 17 +push constant 17 +eq +push constant 17 +push constant 16 +eq +push constant 16 +push constant 17 +eq +push constant 892 +push constant 891 +lt +push constant 891 +push constant 892 +lt +push constant 891 +push constant 891 +lt +push constant 32767 +push constant 32766 +gt +push constant 32766 +push constant 32767 +gt +push constant 32766 +push constant 32766 +gt +push constant 57 +push constant 31 +push constant 53 +add +push constant 112 +sub +neg +and +push constant 82 +or +not diff --git a/projects/07/StackArithmetic/StackTest/StackTestVME.tst b/projects/07/StackArithmetic/StackTest/StackTestVME.tst new file mode 100644 index 0000000..b66bd05 --- /dev/null +++ b/projects/07/StackArithmetic/StackTest/StackTestVME.tst @@ -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: projects/07/StackArithmetic/StackTest/StackTestVME.tst + +load StackTest.vm, +output-file StackTest.out, +compare-to StackTest.cmp, +output-list RAM[0]%D2.6.2 + RAM[256]%D2.6.2 RAM[257]%D2.6.2 RAM[258]%D2.6.2 RAM[259]%D2.6.2 RAM[260]%D2.6.2; + +set RAM[0] 256, // initializes the stack pointer + +repeat 38 { // StackTest.vm consists of 38 instructions + vmstep; +} + +// outputs the stack pointer (RAM[0]) and +// the stack contents: RAM[256]-RAM[265] +output; +output-list RAM[261]%D2.6.2 RAM[262]%D2.6.2 RAM[263]%D2.6.2 RAM[264]%D2.6.2 RAM[265]%D2.6.2; +output; diff --git a/projects/08/FunctionCalls/FibonacciElement/FibonacciElement.cmp b/projects/08/FunctionCalls/FibonacciElement/FibonacciElement.cmp new file mode 100644 index 0000000..d667834 --- /dev/null +++ b/projects/08/FunctionCalls/FibonacciElement/FibonacciElement.cmp @@ -0,0 +1,2 @@ +| RAM[0] |RAM[261]| +| 262 | 3 | diff --git a/projects/08/FunctionCalls/FibonacciElement/FibonacciElement.tst b/projects/08/FunctionCalls/FibonacciElement/FibonacciElement.tst new file mode 100644 index 0000000..1f907b1 --- /dev/null +++ b/projects/08/FunctionCalls/FibonacciElement/FibonacciElement.tst @@ -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: projects/08/FunctionCalls/FibonacciElement/FibonacciElement.tst + +// FibonacciElement.asm results from translating both Main.vm and Sys.vm into +// a single assembly program, stored in the file FibonacciElement.asm. + +load FibonacciElement.asm, +output-file FibonacciElement.out, +compare-to FibonacciElement.cmp, +output-list RAM[0]%D1.6.1 RAM[261]%D1.6.1; + +repeat 6000 { + ticktock; +} + +output; diff --git a/projects/08/FunctionCalls/FibonacciElement/FibonacciElementVME.tst b/projects/08/FunctionCalls/FibonacciElement/FibonacciElementVME.tst new file mode 100644 index 0000000..87c0920 --- /dev/null +++ b/projects/08/FunctionCalls/FibonacciElement/FibonacciElementVME.tst @@ -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: projects/08/FunctionCalls/FibonacciElement/FibonacciElementVME.tst + +load, // Load all the VM files from the current directory +output-file FibonacciElement.out, +compare-to FibonacciElement.cmp, +output-list RAM[0]%D1.6.1 RAM[261]%D1.6.1; + +set sp 261, + +repeat 110 { + vmstep; +} + +output; diff --git a/projects/08/FunctionCalls/FibonacciElement/Main.vm b/projects/08/FunctionCalls/FibonacciElement/Main.vm new file mode 100644 index 0000000..55e5ad2 --- /dev/null +++ b/projects/08/FunctionCalls/FibonacciElement/Main.vm @@ -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: projects/08/FunctionCalls/FibonacciElement/Main.vm + +// Computes the n'th element of the Fibonacci series, recursively. +// n is given in argument[0]. Called by the Sys.init function +// (part of the Sys.vm file), which also pushes the argument[0] +// parameter before this code starts running. + +function Main.fibonacci 0 +push argument 0 +push constant 2 +lt // checks if n<2 +if-goto IF_TRUE +goto IF_FALSE +label IF_TRUE // if n<2, return n +push argument 0 +return +label IF_FALSE // if n>=2, returns fib(n-2)+fib(n-1) +push argument 0 +push constant 2 +sub +call Main.fibonacci 1 // computes fib(n-2) +push argument 0 +push constant 1 +sub +call Main.fibonacci 1 // computes fib(n-1) +add // returns fib(n-1) + fib(n-2) +return diff --git a/projects/08/FunctionCalls/FibonacciElement/Sys.vm b/projects/08/FunctionCalls/FibonacciElement/Sys.vm new file mode 100644 index 0000000..f3965c9 --- /dev/null +++ b/projects/08/FunctionCalls/FibonacciElement/Sys.vm @@ -0,0 +1,15 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/08/FunctionCalls/FibonacciElement/Sys.vm + +// Pushes a constant, say n, onto the stack, and calls the Main.fibonacii +// function, which computes the n'th element of the Fibonacci series. +// Note that by convention, the Sys.init function is called "automatically" +// by the bootstrap code. + +function Sys.init 0 +push constant 4 +call Main.fibonacci 1 // computes the 4'th fibonacci element +label WHILE +goto WHILE // loops infinitely diff --git a/projects/08/FunctionCalls/NestedCall/NestedCall.cmp b/projects/08/FunctionCalls/NestedCall/NestedCall.cmp new file mode 100644 index 0000000..9200202 --- /dev/null +++ b/projects/08/FunctionCalls/NestedCall/NestedCall.cmp @@ -0,0 +1,2 @@ +| RAM[0] | RAM[1] | RAM[2] | RAM[3] | RAM[4] | RAM[5] | RAM[6] | +| 261 | 261 | 256 | 4000 | 5000 | 135 | 246 | diff --git a/projects/08/FunctionCalls/NestedCall/NestedCall.html b/projects/08/FunctionCalls/NestedCall/NestedCall.html new file mode 100644 index 0000000..0821f9c --- /dev/null +++ b/projects/08/FunctionCalls/NestedCall/NestedCall.html @@ -0,0 +1,196 @@ + + + + + NestedCall.tst — Nand2Tetris Calling Convention Test + + + + +

Synopsis

+NestedCall.tst is an intermediate test (in terms of complexity) intended to be used between the SimpleFunction and +FibonacciElement tests. It may be useful when SimpleFunction passes but FibonacciElement fails or crashes. NestedCall also +tests several requirements of the Function Calling Protocol that are not verified by the other +supplied tests. NestedCall can be used with or without the VM bootstrap code. +

+NestedCallVME.tst runs the same test on the VM Emulator. +

+The NestedCall tests and supporting documentation were written by Mark Armbrust. + + +

Test Structure

+

Startup

+NestedCall is implemented entirely within the Sys.vm file. The first function in Sys.vm is +Sys.init(). This allows it to be used before the bootstrap code has been added to the VM Translator +since there will be no file processing order issues. +

+NestedCall loads Sys.asm, sets up the stack to simulate the bootstrap's call to Sys.init(), then +begins execution at the beginning of Sys.asm. If the bootstrap is not present, the program begins +running with Sys.init() since it is the first function in Sys.vm. +

+If Sys.asm includes the bootstrap, the bootstrap will (re)initialize the stack and call Sys.init(), +so the test should see the same environment either way it gets to Sys.init(). +

+The test setup also initializes the + +

Sys.init()

+ +THIS and THAT are set to known values so that context save and restore can be tested. +

+Sys.init() calls Sys.main() and stores the return value in temp 1. This tests call to and +return from a function with no arguments. + +

Sys.main()

+Sys.init() allocates 5 local variables. It sets local 1, local 2 and +local 3. local 0 and local 4 are intentionally not set. +

+THIS and THAT are changed so that context save and restore can be tested. +

+Sys.main() calls Sys.add12(123) and stores the return value in temp 0. This tests call to and +return from a function with arguments. +

+After Sys.add12() returns, Sys.main() sums local 0 through local 4 and returns the +result. This tests that the local segment was properly allocated on the stack and that the local +variables were not overwritten by the call to Sys.main(). It also tests that local 0 and +local 4 were properly initialized to 0. + +

Sys.add12()

+ +THIS and THAT are set to known values so that context save and restore can be tested. +

+Returns argument 0 plus 12. + + +

Test Coverage

+ +

+Functions with no arguments return to correct RIP (Return Instruction Point) with correct return value on stack.
+This can fail if the RIP is not correctly pushed on the stack by the calling code, or if the returning +code does not store the RIP in a temporary register before overwriting it with the return value. + +

+Functions with arguments return to correct RIP with correct return value on stack.
+This can fail if it is assumed that ARG points to the RIP. + +

+Functions with local variables allocate space on the stack for the local variables.
+This can fail if the function prologue is not written or if the SP is not updated after zeroing +the local variables. + +

+All local variables are initialized to 0.
+Common errors are to forget this completely, or for the zeroing loop to be off by one. + +

+THIS and THAT are correctly retained across function calls. Looking ahead, in Project 9 you will be asked to write a simple computer game in the high-level Jack language. You can run your game (following compilation) on the supplied VM Emulator. But, if you choose to translate the VM code that the compiler generates using your VM Translator, then code like +"push THIS, push THAT ... pop THIS, pop THAT" can cause some interesting failures! + + +

Debugging

+These comments assume that your VM translator has passed the SimpleFunction test. +

+If RAM[0] is incorrect, you have a stack skew. More data was pushed onto the stack by +call than was popped by return, or vice versa. See debugging with +breakpoints later in this section. +

+If one or more of RAM[1] through RAM[4] is incorrect, the LCL, +ARG, THIS and THAT pointers are not being correctly saved or restored. +Most likely problem is when they are being saved; the SimpleFunction test verified that +return restored them correctly. +

+If RAM[5] is incorrect there may be a problem with setting up the ARG pointer. +

+If RAM[4] is incorrect and RAM[5] is correct, there may be a problem with +allocation or initialization of local variables. + +

Debugging with breakpoints

+ +To find tough bugs you can use the "breakpoint" facility in the CPU Emulator (red flag button). +You can use breakpoints to have you program stop when it gets to a particular RAM address. For +example:
+ • load the NestedCall.tst file,
+ • set a PC breakpoint at the ROM address for (Sys.main),
+ • hit the run button.
+When the CPU Emulator stops at the breakpoint you can inspect the RAM to check the stack and pointers values. +(If the breakpoint isn't hit, you will need to to single-step debug through +your calling code to see why it didn't get there.) +

+Other useful places to set breakpoints are the entry points to the other functions and at the +first and final instructions generated for return commands. +

+NestedCallStack.html shows the expected stack values at various points +during the test. + +

Finding ROM address in your ASM code

+It is not easy to find the ROM locations where you want to set breakpoints, because there is no +one-to-one correspondence between the ASM file line numbers and the ROM addresses. This is made even more +difficult because the supplied CPU Emulator does not display the (LABELS) in its ROM panel. +

+There are two things that you can do to make this easier. +

+

Modify your assembler to generate a listing file.
+A listing file shows all the ASM source lines, including comments, as well as the ROM addresses and +the values of the labels and the instructions. For example, here is a snippet of a listing file generated by an assembler written by Mark Armbrust: +
+   20    16      @i      // i -= 1
+   21  FC88      M=M-1
+             
+   22  FC10      D=M     // if i > 0
+   23     6      @LOOP
+   24  E301      D;JGT   //      goto LOOP
+             
+   25        (STOP)
+   25    25      @STOP
+   26  EA87      0;JMP
+
+Data Symbols
+
+   16 D  i
+
+Code Symbols
+
+    6 C  LOOP
+   17 C  SKIP
+   25 C  STOP
+
+For the Nand2Tetris environment, it is most useful to list the ROM addresses and A-instruction +values in decimal. In the above snippet, the C-instruction values are +listed in hexadecimal. +

+The list file is generated during pass 2 of the Assembler, parallel to generating the .hack file. To +make it easier to handle blank and comment only lines, Mark has Parser.commandType() return +NO_COMMAND for source lines with no command. Mark also added Parser.sourceLine() that returns the +unmodified source line. +

+

Have your VM Translator write the VM source lines as comments in the ASM output.
+For example: +
+    // label LOOP
+(Sys.init$LOOP)
+    // goto LOOP
+@Sys.init$LOOP
+0;JMP
+    //
+    // // Sys.main()
+    // 
+    // // Sets locals 1, 2 and 3, leaving locals 0 and 4 unchanged to test
+    // // default local initialization to 0.  (RAM set to -1 by test setup.)
+    // // Calls Sys.add12(123) and stores return value (135) in temp 0.
+    // // Returns local 0 + local 1 + local 2 + local 3 + local 4 (456) to confirm
+    // // that locals were not mangled by function call.
+    // 
+    // function Sys.main 5
+(Sys.main)
+@5
+D=-A
+($3)
+@SP
+
+Note that comments in the VM source become double comments. Looking ahead, in Project 11 you will be asked to write a compiler for the Jack language. If your compiler will write the Jack source lines as comments in the +generated VM files, this convention will be quite useful. + + + \ No newline at end of file diff --git a/projects/08/FunctionCalls/NestedCall/NestedCall.tst b/projects/08/FunctionCalls/NestedCall/NestedCall.tst new file mode 100644 index 0000000..70e5523 --- /dev/null +++ b/projects/08/FunctionCalls/NestedCall/NestedCall.tst @@ -0,0 +1,65 @@ +// Test file for NestedCall test. + +load NestedCall.asm, +output-file NestedCall.out, +compare-to NestedCall.cmp, +output-list RAM[0]%D1.6.1 RAM[1]%D1.6.1 RAM[2]%D1.6.1 RAM[3]%D1.6.1 RAM[4]%D1.6.1 RAM[5]%D1.6.1 RAM[6]%D1.6.1; + +set RAM[0] 261, +set RAM[1] 261, +set RAM[2] 256, +set RAM[3] -3, +set RAM[4] -4, +set RAM[5] -1, // test results +set RAM[6] -1, +set RAM[256] 1234, // fake stack frame from call Sys.init +set RAM[257] -1, +set RAM[258] -2, +set RAM[259] -3, +set RAM[260] -4, + +set RAM[261] -1, // Initialize stack to check for local segment +set RAM[262] -1, // being cleared to zero. +set RAM[263] -1, +set RAM[264] -1, +set RAM[265] -1, +set RAM[266] -1, +set RAM[267] -1, +set RAM[268] -1, +set RAM[269] -1, +set RAM[270] -1, +set RAM[271] -1, +set RAM[272] -1, +set RAM[273] -1, +set RAM[274] -1, +set RAM[275] -1, +set RAM[276] -1, +set RAM[277] -1, +set RAM[278] -1, +set RAM[279] -1, +set RAM[280] -1, +set RAM[281] -1, +set RAM[282] -1, +set RAM[283] -1, +set RAM[284] -1, +set RAM[285] -1, +set RAM[286] -1, +set RAM[287] -1, +set RAM[288] -1, +set RAM[289] -1, +set RAM[290] -1, +set RAM[291] -1, +set RAM[292] -1, +set RAM[293] -1, +set RAM[294] -1, +set RAM[295] -1, +set RAM[296] -1, +set RAM[297] -1, +set RAM[298] -1, +set RAM[299] -1, + +repeat 4000 { + ticktock; +} + +output; diff --git a/projects/08/FunctionCalls/NestedCall/NestedCallStack.html b/projects/08/FunctionCalls/NestedCall/NestedCallStack.html new file mode 100644 index 0000000..70582b6 --- /dev/null +++ b/projects/08/FunctionCalls/NestedCall/NestedCallStack.html @@ -0,0 +1,306 @@ + + + + + NestedCall.tst — Stack Frames + + + + + + + +
+ + + + + + + + + + + +
Bootstrap init
Pointers
0256SP
1-1LCL
2-2ARG
3-3THIS
4-4THAT
Stack
256???←SP

+ This is how my boot­strap code initial­izes the pointers before calling Sys.init(). +

+ Setting the LCL, ARG, THIS and THAT point­ers to known illegal values helps identify + when a pointer is used before it is initial­ized. +

+ (If you are running the NestedCall test with­out boot­strap code, you will not see this state.)

+
+ + + + + + + + + + + + + + + + +
Entry to Sys.init()
Pointers
0261SP
1261LCL
2256ARG
3-3THIS
4-4THAT
Stack
256*Return IP←ARG
257-1Saved LCL
258-2Saved ARGSys.init
259-3Saved THIS frame
260-4Saved THAT
261???←LCL, SP

+ This is how NestedCall.tst initial­izes the pointers and stack. This is what RAM looks + like after my boot­strap calls Sys.init(). +

+ (If your VM trans­lation includes the boot­strap, the -1 through -4 values may be + different if your boot­strap initial­izes them.)

+
+ + + + + + + + + + + + + + + + + + + + +
Entry to Sys.main()
Pointers
0266SP
1266LCL
2261ARG
34000THIS
45000THAT
Stack
256*Return IP
257-1Saved LCL
258-2Saved ARGSys.init
259-3Saved THIS frame
260-4Saved THAT
261*Return IP←ARG
262261Saved LCL
263256Saved ARGSys.main
2644000Saved THIS frame
2655000Saved THAT
266???←LCL, SP
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
After Sys.main() prologue
Pointers
0271SP
1266LCL
2261ARG
34000THIS
45000THAT
Stack
256*Return IP
257-1Saved LCL
258-2Saved ARGSys.init
259-3Saved THIS frame
260-4Saved THAT
261*Return IP←ARG
262261Saved LCL
263256Saved ARGSys.main
2644000Saved THIS frame
2655000Saved THAT
2660local 0←LCL
2670local 1
2680local 2
2690local 3
2700local 4
271???←SP

+ The function prologue is the assembly language code generated for the + "function" VM command. +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Entry to Sys.add12(123)
Pointers
0277SP
1277LCL
2271ARG
34001THIS
45001THAT
Stack
256*Return IP
257-1Saved LCL
258-2Saved ARGSys.init
259-3Saved THIS frame
260-4Saved THAT
261*Return IP
262261Saved LCL
263256Saved ARGSys.main
2644000Saved THIS frame
2655000Saved THAT
2660local 0
267200local 1
26840local 2
2696local 3
2700local 4
271123argument 0←ARG
272*Return IP
273266Saved LCLSys.add12
274261Saved ARG frame
2754001Saved THIS
2765001Saved THAT
277???←LCL, SP
+
+ +

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Before Sys.add12() return
Pointers
0278SP
1277LCL
2271ARG
34002THIS
45002THAT
Stack
256*Return IP
257-1Saved LCL
258-2Saved ARGSys.init
259-3Saved THIS frame
260-4Saved THAT
261*Return IP
262261Saved LCL
263256Saved ARGSys.main
2644000Saved THIS frame
2655000Saved THAT
2660local 0
267200local 1
26840local 2
2696local 3
2700local 4
271123argument 0←ARG
272*Return IP
273266Saved LCLSys.add12
274261Saved ARG frame
2754001Saved THIS
2765001Saved THAT
277135Return value←LCL
278???←SP
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
After Sys.add12() return
Pointers
0272SP
1266LCL
2261ARG
34001THIS
45001THAT
Stack
256*Return IP
257-1Saved LCL
258-2Saved ARGSys.init
259-3Saved THIS frame
260-4Saved THAT
261*Return IP←ARG
262261Saved LCL
263256Saved ARGSys.main
2644000Saved THIS frame
2655000Saved THAT
2660local 0←LCL
267200local 1
26840local 2
2696local 3
2700local 4
271135Return value
272???←SP
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Before Sys.main() return
Pointers
0272SP
1266LCL
2261ARG
34001THIS
45001THAT
Stack
256*Return IP
257-1Saved LCL
258-2Saved ARGSys.init
259-3Saved THIS frame
260-4Saved THAT
261*Return IP←ARG
262261Saved LCL
263256Saved ARGSys.main
2644000Saved THIS frame
2655000Saved THAT
2660local 0←LCL
267200local 1
26840local 2
2696local 3
2700local 4
271246Return value
272???←SP
+
+ + + + + + + + + + + + + + + + +
After Sys.main() return
Pointers
0262SP
1261LCL
2256ARG
34000THIS
45000THAT
Stack
256*Return IP←ARG
257-1Saved LCL
258-2Saved ARGSys.init
259-3Saved THIS frame
260-4Saved THAT
261246Return value←LCL
262???←SP
+
+ + + + + + + + + + + + + + + +
In Sys.init() halt loop
Pointers
0261SP
1261LCL
2256ARG
34000THIS
45000THAT
Stack
256*Return IP←ARG
257-1Saved LCL
258-2Saved ARGSys.init
259-3Saved THIS frame
260-4Saved THAT
261???←LCL, SP
+
+ + + \ No newline at end of file diff --git a/projects/08/FunctionCalls/NestedCall/NestedCallVME.tst b/projects/08/FunctionCalls/NestedCall/NestedCallVME.tst new file mode 100644 index 0000000..2c689b8 --- /dev/null +++ b/projects/08/FunctionCalls/NestedCall/NestedCallVME.tst @@ -0,0 +1,70 @@ +// Test file for NestedCall test. + +load Sys.vm, +output-file NestedCall.out, +compare-to NestedCall.cmp, +output-list RAM[0]%D1.6.1 RAM[1]%D1.6.1 RAM[2]%D1.6.1 RAM[3]%D1.6.1 RAM[4]%D1.6.1 RAM[5]%D1.6.1 RAM[6]%D1.6.1; + +set RAM[0] 261, +set RAM[1] 261, +set RAM[2] 256, +set RAM[3] -3, +set RAM[4] -4, +set RAM[5] -1, // test results +set RAM[6] -1, +set RAM[256] 1234, // fake stack frame from call Sys.init +set RAM[257] -1, +set RAM[258] -2, +set RAM[259] -3, +set RAM[260] -4, + +set RAM[261] -1, // Initialize stack to check for local segment +set RAM[262] -1, // being cleared to zero. +set RAM[263] -1, +set RAM[264] -1, +set RAM[265] -1, +set RAM[266] -1, +set RAM[267] -1, +set RAM[268] -1, +set RAM[269] -1, +set RAM[270] -1, +set RAM[271] -1, +set RAM[272] -1, +set RAM[273] -1, +set RAM[274] -1, +set RAM[275] -1, +set RAM[276] -1, +set RAM[277] -1, +set RAM[278] -1, +set RAM[279] -1, +set RAM[280] -1, +set RAM[281] -1, +set RAM[282] -1, +set RAM[283] -1, +set RAM[284] -1, +set RAM[285] -1, +set RAM[286] -1, +set RAM[287] -1, +set RAM[288] -1, +set RAM[289] -1, +set RAM[290] -1, +set RAM[291] -1, +set RAM[292] -1, +set RAM[293] -1, +set RAM[294] -1, +set RAM[295] -1, +set RAM[296] -1, +set RAM[297] -1, +set RAM[298] -1, +set RAM[299] -1, + +set sp 261, +set local 261, +set argument 256, +set this 3000, +set that 4000; + +repeat 50 { + vmstep; +} +output; diff --git a/projects/08/FunctionCalls/NestedCall/Sys.vm b/projects/08/FunctionCalls/NestedCall/Sys.vm new file mode 100644 index 0000000..8b0b003 --- /dev/null +++ b/projects/08/FunctionCalls/NestedCall/Sys.vm @@ -0,0 +1,63 @@ +// Sys.vm for NestedCall test. + +// Sys.init() +// +// Calls Sys.main() and stores return value in temp 1. +// Does not return. (Enters infinite loop.) + +function Sys.init 0 +push constant 4000 // test THIS and THAT context save +pop pointer 0 +push constant 5000 +pop pointer 1 +call Sys.main 0 +pop temp 1 +label LOOP +goto LOOP + +// Sys.main() +// +// Sets locals 1, 2 and 3, leaving locals 0 and 4 unchanged to test +// default local initialization to 0. (RAM set to -1 by test setup.) +// Calls Sys.add12(123) and stores return value (135) in temp 0. +// Returns local 0 + local 1 + local 2 + local 3 + local 4 (456) to confirm +// that locals were not mangled by function call. + +function Sys.main 5 +push constant 4001 +pop pointer 0 +push constant 5001 +pop pointer 1 +push constant 200 +pop local 1 +push constant 40 +pop local 2 +push constant 6 +pop local 3 +push constant 123 +call Sys.add12 1 +pop temp 0 +push local 0 +push local 1 +push local 2 +push local 3 +push local 4 +add +add +add +add +return + +// Sys.add12(int n) +// +// Returns n+12. + +function Sys.add12 0 +push constant 4002 +pop pointer 0 +push constant 5002 +pop pointer 1 +push argument 0 +push constant 12 +add +return diff --git a/projects/08/FunctionCalls/SimpleFunction/SimpleFunction.cmp b/projects/08/FunctionCalls/SimpleFunction/SimpleFunction.cmp new file mode 100644 index 0000000..c3ea911 --- /dev/null +++ b/projects/08/FunctionCalls/SimpleFunction/SimpleFunction.cmp @@ -0,0 +1,2 @@ +| RAM[0] | RAM[1] | RAM[2] | RAM[3] | RAM[4] |RAM[310]| +| 311 | 305 | 300 | 3010 | 4010 | 1196 | diff --git a/projects/08/FunctionCalls/SimpleFunction/SimpleFunction.tst b/projects/08/FunctionCalls/SimpleFunction/SimpleFunction.tst new file mode 100644 index 0000000..c7b5905 --- /dev/null +++ b/projects/08/FunctionCalls/SimpleFunction/SimpleFunction.tst @@ -0,0 +1,29 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/08/FunctionCalls/SimpleFunction/SimpleFunction.tst + +load SimpleFunction.asm, +output-file SimpleFunction.out, +compare-to SimpleFunction.cmp, +output-list RAM[0]%D1.6.1 RAM[1]%D1.6.1 RAM[2]%D1.6.1 + RAM[3]%D1.6.1 RAM[4]%D1.6.1 RAM[310]%D1.6.1; + +set RAM[0] 317, +set RAM[1] 317, +set RAM[2] 310, +set RAM[3] 3000, +set RAM[4] 4000, +set RAM[310] 1234, +set RAM[311] 37, +set RAM[312] 1000, +set RAM[313] 305, +set RAM[314] 300, +set RAM[315] 3010, +set RAM[316] 4010, + +repeat 300 { + ticktock; +} + +output; diff --git a/projects/08/FunctionCalls/SimpleFunction/SimpleFunction.vm b/projects/08/FunctionCalls/SimpleFunction/SimpleFunction.vm new file mode 100644 index 0000000..d64a34f --- /dev/null +++ b/projects/08/FunctionCalls/SimpleFunction/SimpleFunction.vm @@ -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: projects/08/FunctionCalls/SimpleFunction/SimpleFunction.vm + +// Performs a simple calculation and returns the result. +function SimpleFunction.test 2 +push local 0 +push local 1 +add +not +push argument 0 +add +push argument 1 +sub +return diff --git a/projects/08/FunctionCalls/SimpleFunction/SimpleFunctionVME.tst b/projects/08/FunctionCalls/SimpleFunction/SimpleFunctionVME.tst new file mode 100644 index 0000000..c9267ee --- /dev/null +++ b/projects/08/FunctionCalls/SimpleFunction/SimpleFunctionVME.tst @@ -0,0 +1,29 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/08/FunctionCalls/SimpleFunction/SimpleFunctionVME.tst + +load SimpleFunction.vm, +output-file SimpleFunction.out, +compare-to SimpleFunction.cmp, +output-list RAM[0]%D1.6.1 RAM[1]%D1.6.1 RAM[2]%D1.6.1 + RAM[3]%D1.6.1 RAM[4]%D1.6.1 RAM[310]%D1.6.1; + +set sp 317, +set local 317, +set argument 310, +set this 3000, +set that 4000, +set argument[0] 1234, +set argument[1] 37, +set argument[2] 9, +set argument[3] 305, +set argument[4] 300, +set argument[5] 3010, +set argument[6] 4010, + +repeat 10 { + vmstep; +} + +output; diff --git a/projects/08/FunctionCalls/StaticsTest/Class1.vm b/projects/08/FunctionCalls/StaticsTest/Class1.vm new file mode 100644 index 0000000..c463537 --- /dev/null +++ b/projects/08/FunctionCalls/StaticsTest/Class1.vm @@ -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: projects/08/FunctionCalls/StaticsTest/Class1.vm + +// Stores two supplied arguments in static[0] and static[1]. +function Class1.set 0 +push argument 0 +pop static 0 +push argument 1 +pop static 1 +push constant 0 +return + +// Returns static[0] - static[1]. +function Class1.get 0 +push static 0 +push static 1 +sub +return diff --git a/projects/08/FunctionCalls/StaticsTest/Class2.vm b/projects/08/FunctionCalls/StaticsTest/Class2.vm new file mode 100644 index 0000000..94f2946 --- /dev/null +++ b/projects/08/FunctionCalls/StaticsTest/Class2.vm @@ -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: projects/08/FunctionCalls/StaticsTest/Class2.vm + +// Stores two supplied arguments in static[0] and static[1]. +function Class2.set 0 +push argument 0 +pop static 0 +push argument 1 +pop static 1 +push constant 0 +return + +// Returns static[0] - static[1]. +function Class2.get 0 +push static 0 +push static 1 +sub +return diff --git a/projects/08/FunctionCalls/StaticsTest/StaticsTest.cmp b/projects/08/FunctionCalls/StaticsTest/StaticsTest.cmp new file mode 100644 index 0000000..5589f1e --- /dev/null +++ b/projects/08/FunctionCalls/StaticsTest/StaticsTest.cmp @@ -0,0 +1,2 @@ +| RAM[0] |RAM[261]|RAM[262]| +| 263 | -2 | 8 | diff --git a/projects/08/FunctionCalls/StaticsTest/StaticsTest.tst b/projects/08/FunctionCalls/StaticsTest/StaticsTest.tst new file mode 100644 index 0000000..1b9194e --- /dev/null +++ b/projects/08/FunctionCalls/StaticsTest/StaticsTest.tst @@ -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: projects/08/FunctionCalls/StaticsTest/StaticsTest.tst + +load StaticsTest.asm, +output-file StaticsTest.out, +compare-to StaticsTest.cmp, +output-list RAM[0]%D1.6.1 RAM[261]%D1.6.1 RAM[262]%D1.6.1; + +set RAM[0] 256, + +repeat 2500 { + ticktock; +} + +output; diff --git a/projects/08/FunctionCalls/StaticsTest/StaticsTestVME.tst b/projects/08/FunctionCalls/StaticsTest/StaticsTestVME.tst new file mode 100644 index 0000000..130ba66 --- /dev/null +++ b/projects/08/FunctionCalls/StaticsTest/StaticsTestVME.tst @@ -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: projects/08/FunctionCalls/StaticsTest/StaticsTestVME.tst + +load, // loads all the VM files from the current directory. +output-file StaticsTest.out, +compare-to StaticsTest.cmp, +output-list RAM[0]%D1.6.1 RAM[261]%D1.6.1 RAM[262]%D1.6.1; + +set sp 261, + +repeat 36 { + vmstep; +} + +output; diff --git a/projects/08/FunctionCalls/StaticsTest/Sys.vm b/projects/08/FunctionCalls/StaticsTest/Sys.vm new file mode 100644 index 0000000..3708322 --- /dev/null +++ b/projects/08/FunctionCalls/StaticsTest/Sys.vm @@ -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: projects/08/FunctionCalls/StaticsTest/Sys.vm + +// Tests that different functions, stored in two different +// class files, manipulate the static segment correctly. +function Sys.init 0 +push constant 6 +push constant 8 +call Class1.set 2 +pop temp 0 // Dumps the return value +push constant 23 +push constant 15 +call Class2.set 2 +pop temp 0 // Dumps the return value +call Class1.get 0 +call Class2.get 0 +label WHILE +goto WHILE diff --git a/projects/08/ProgramFlow/BasicLoop/BasicLoop.cmp b/projects/08/ProgramFlow/BasicLoop/BasicLoop.cmp new file mode 100644 index 0000000..00d35d2 --- /dev/null +++ b/projects/08/ProgramFlow/BasicLoop/BasicLoop.cmp @@ -0,0 +1,2 @@ +| RAM[0] |RAM[256]| +| 257 | 6 | diff --git a/projects/08/ProgramFlow/BasicLoop/BasicLoop.tst b/projects/08/ProgramFlow/BasicLoop/BasicLoop.tst new file mode 100644 index 0000000..50ca118 --- /dev/null +++ b/projects/08/ProgramFlow/BasicLoop/BasicLoop.tst @@ -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: projects/08/ProgramFlow/BasicLoop/BasicLoop.tst + +load BasicLoop.asm, +output-file BasicLoop.out, +compare-to BasicLoop.cmp, +output-list RAM[0]%D1.6.1 RAM[256]%D1.6.1; + +set RAM[0] 256, +set RAM[1] 300, +set RAM[2] 400, +set RAM[400] 3, + +repeat 600 { + ticktock; +} + +output; diff --git a/projects/08/ProgramFlow/BasicLoop/BasicLoop.vm b/projects/08/ProgramFlow/BasicLoop/BasicLoop.vm new file mode 100644 index 0000000..2d63f13 --- /dev/null +++ b/projects/08/ProgramFlow/BasicLoop/BasicLoop.vm @@ -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: projects/08/ProgramFlow/BasicLoop/BasicLoop.vm + +// Computes the sum 1 + 2 + ... + argument[0] and pushes the +// result onto the stack. Argument[0] is initialized by the test +// script before this code starts running. +push constant 0 +pop local 0 // initializes sum = 0 +label LOOP_START +push argument 0 +push local 0 +add +pop local 0 // sum = sum + counter +push argument 0 +push constant 1 +sub +pop argument 0 // counter-- +push argument 0 +if-goto LOOP_START // If counter > 0, goto LOOP_START +push local 0 diff --git a/projects/08/ProgramFlow/BasicLoop/BasicLoopVME.tst b/projects/08/ProgramFlow/BasicLoop/BasicLoopVME.tst new file mode 100644 index 0000000..237fdff --- /dev/null +++ b/projects/08/ProgramFlow/BasicLoop/BasicLoopVME.tst @@ -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: projects/08/ProgramFlow/BasicLoop/BasicLoopVME.tst + +load BasicLoop.vm, +output-file BasicLoop.out, +compare-to BasicLoop.cmp, +output-list RAM[0]%D1.6.1 RAM[256]%D1.6.1; + +set sp 256, +set local 300, +set argument 400, +set argument[0] 3, + +repeat 33 { + vmstep; +} + +output; diff --git a/projects/08/ProgramFlow/FibonacciSeries/FibonacciSeries.cmp b/projects/08/ProgramFlow/FibonacciSeries/FibonacciSeries.cmp new file mode 100644 index 0000000..c262a4b --- /dev/null +++ b/projects/08/ProgramFlow/FibonacciSeries/FibonacciSeries.cmp @@ -0,0 +1,2 @@ +|RAM[3000]|RAM[3001]|RAM[3002]|RAM[3003]|RAM[3004]|RAM[3005]| +| 0 | 1 | 1 | 2 | 3 | 5 | diff --git a/projects/08/ProgramFlow/FibonacciSeries/FibonacciSeries.tst b/projects/08/ProgramFlow/FibonacciSeries/FibonacciSeries.tst new file mode 100644 index 0000000..07df2b9 --- /dev/null +++ b/projects/08/ProgramFlow/FibonacciSeries/FibonacciSeries.tst @@ -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: projects/08/ProgramFlow/FibonacciSeries/FibonacciSeries.tst + +load FibonacciSeries.asm, +output-file FibonacciSeries.out, +compare-to FibonacciSeries.cmp, +output-list RAM[3000]%D1.6.2 RAM[3001]%D1.6.2 RAM[3002]%D1.6.2 + RAM[3003]%D1.6.2 RAM[3004]%D1.6.2 RAM[3005]%D1.6.2; + +set RAM[0] 256, +set RAM[1] 300, +set RAM[2] 400, +set RAM[400] 6, +set RAM[401] 3000, + +repeat 1100 { + ticktock; +} + +output; diff --git a/projects/08/ProgramFlow/FibonacciSeries/FibonacciSeries.vm b/projects/08/ProgramFlow/FibonacciSeries/FibonacciSeries.vm new file mode 100644 index 0000000..6a643b6 --- /dev/null +++ b/projects/08/ProgramFlow/FibonacciSeries/FibonacciSeries.vm @@ -0,0 +1,49 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/08/ProgramFlow/FibonacciSeries/FibonacciSeries.vm + +// Puts the first argument[0] elements of the Fibonacci series +// in the memory, starting in the address given in argument[1]. +// Argument[0] and argument[1] are initialized by the test script +// before this code starts running. + +push argument 1 +pop pointer 1 // that = argument[1] + +push constant 0 +pop that 0 // first element in the series = 0 +push constant 1 +pop that 1 // second element in the series = 1 + +push argument 0 +push constant 2 +sub +pop argument 0 // num_of_elements -= 2 (first 2 elements are set) + +label MAIN_LOOP_START + +push argument 0 +if-goto COMPUTE_ELEMENT // if num_of_elements > 0, goto COMPUTE_ELEMENT +goto END_PROGRAM // otherwise, goto END_PROGRAM + +label COMPUTE_ELEMENT + +push that 0 +push that 1 +add +pop that 2 // that[2] = that[0] + that[1] + +push pointer 1 +push constant 1 +add +pop pointer 1 // that += 1 + +push argument 0 +push constant 1 +sub +pop argument 0 // num_of_elements-- + +goto MAIN_LOOP_START + +label END_PROGRAM diff --git a/projects/08/ProgramFlow/FibonacciSeries/FibonacciSeriesVME.tst b/projects/08/ProgramFlow/FibonacciSeries/FibonacciSeriesVME.tst new file mode 100644 index 0000000..243f31b --- /dev/null +++ b/projects/08/ProgramFlow/FibonacciSeries/FibonacciSeriesVME.tst @@ -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: projects/08/ProgramFlow/FibonacciSeries/FibonacciSeriesVME.tst + +load FibonacciSeries.vm, +output-file FibonacciSeries.out, +compare-to FibonacciSeries.cmp, +output-list RAM[3000]%D1.6.2 RAM[3001]%D1.6.2 RAM[3002]%D1.6.2 + RAM[3003]%D1.6.2 RAM[3004]%D1.6.2 RAM[3005]%D1.6.2; + +set sp 256, +set local 300, +set argument 400, +set argument[0] 6, +set argument[1] 3000, + +repeat 73 { + vmstep; +} + +output; diff --git a/projects/09/Average/Main.jack b/projects/09/Average/Main.jack new file mode 100644 index 0000000..a359602 --- /dev/null +++ b/projects/09/Average/Main.jack @@ -0,0 +1,27 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/09/Average/Main.jack + +// Inputs some numbers and computes their average +class Main { + function void main() { + var Array a; + var int length; + var int i, sum; + + let length = Keyboard.readInt("How many numbers? "); + let a = Array.new(length); // constructs the array + + let i = 0; + while (i < length) { + let a[i] = Keyboard.readInt("Enter a number: "); + let sum = sum + a[i]; + let i = i + 1; + } + + do Output.printString("The average is "); + do Output.printInt(sum / length); + return; + } +} diff --git a/projects/09/BitmapEditor/BitmapEditor.html b/projects/09/BitmapEditor/BitmapEditor.html new file mode 100644 index 0000000..fdb9e0b --- /dev/null +++ b/projects/09/BitmapEditor/BitmapEditor.html @@ -0,0 +1,200 @@ + + + + Sokoban Bitmap Editor + + + +

IDC Herzliya / Efi Arazi School of Computer Science / Digital Systems Construction, Spring 2011 / Project 09 / Golan Parashi

+

Sokoban Bitmap Editor

+

This javascript applicaiton is used to generate highly optimized jack code for drawing a 16x16 bitmap to the screen.

+

Using the mouse, click the desired cell to mark/unmark it. You may use 90 degrees rotation and vertical mirroring by
+ clicking the appropriate buttons.

+

When you are finished drawing, you may select function type and enter function's name.

+

+ + + + + + + + + + + + + + +
BitmapGenerated Jack Code
+
+ + + + + + + +
Function Type:
+ +
Function Name:
+
+
+ + + + +
+ + + + \ No newline at end of file diff --git a/projects/09/BitmapEditor/BitmapEditor.iml b/projects/09/BitmapEditor/BitmapEditor.iml new file mode 100644 index 0000000..ef582b1 --- /dev/null +++ b/projects/09/BitmapEditor/BitmapEditor.iml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/projects/09/Fraction/Fraction.jack b/projects/09/Fraction/Fraction.jack new file mode 100644 index 0000000..c86f0a5 --- /dev/null +++ b/projects/09/Fraction/Fraction.jack @@ -0,0 +1,65 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/09/Fraction/Fraction.jack + +/** Represents the Fraction type and related operations. */ +class Fraction { + field int numerator, denominator; // field = property = member variable. + + /** Constructs a (reduced) fraction from the given numerator and denominator. */ + constructor Fraction new(int x, int y) { + let numerator = x; + let denominator = y; + do reduce(); // reduces the fraction + return this; // a constructor is expected to return a reference to the new object + } + + // Reduces this fraction. + method void reduce() { + var int g; + let g = Fraction.gcd(numerator, denominator); + if (g > 1) { + let numerator = numerator / g; + let denominator = denominator / g; + } + return; + } + + /** Accessors. */ + method int getNumerator() { return numerator; } + method int getDenominator() { return denominator; } + + /** Returns the sum of this fraction and the other one. */ + method Fraction plus(Fraction other) { + var int sum; + let sum = (numerator * other.getDenominator()) + (other.getNumerator() * denominator); + return Fraction.new(sum, denominator * other.getDenominator()); + } + + // More fraction-related methods (minus, times, div, etc.) can be added here. + + /** Disposes this fraction. */ + method void dispose() { + do Memory.deAlloc(this); // uses an OS routine to recycle the memory held by the object + return; + } + + /** Prints this fraction in the format x/y. */ + method void print() { + do Output.printInt(numerator); + do Output.printString("/"); + do Output.printInt(denominator); + return; + } + + // Computes the greatest common divisor of the given integers. + function int gcd(int a, int b) { + var int r; + while (~(b = 0)) { // applies Euclid's algorithm + let r = a - (b * (a / b)); // r = remainder of the integer division a/b + let a = b; let b = r; + } + return a; + } +} diff --git a/projects/09/Fraction/Main.jack b/projects/09/Fraction/Main.jack new file mode 100644 index 0000000..43ddece --- /dev/null +++ b/projects/09/Fraction/Main.jack @@ -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: projects/09/Fraction/Main.jack + +// Computes the sum of 2/3 and 1/5. +class Main { + function void main() { + var Fraction a, b, c; + let a = Fraction.new(2,3); + let b = Fraction.new(1,5); + let c = a.plus(b); // Computes c = a + b + do c.print(); // Prints "13/15" + return; + } +} diff --git a/projects/09/HelloWorld/Main.jack b/projects/09/HelloWorld/Main.jack new file mode 100644 index 0000000..446b21b --- /dev/null +++ b/projects/09/HelloWorld/Main.jack @@ -0,0 +1,14 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/09/HelloWorld/Main.jack + +/** Hello World program. */ +class Main { + function void main() { + /* Prints some text using the standard library. */ + do Output.printString("Hello world!"); + do Output.println(); // New line + return; + } +} diff --git a/projects/09/Jack OS API.pdf b/projects/09/Jack OS API.pdf new file mode 100644 index 0000000..e653e86 Binary files /dev/null and b/projects/09/Jack OS API.pdf differ diff --git a/projects/09/List/List.jack b/projects/09/List/List.jack new file mode 100644 index 0000000..c62fe28 --- /dev/null +++ b/projects/09/List/List.jack @@ -0,0 +1,46 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/09/List/List.jack + +/** Represents a linked list of integers. */ +class List { + field int data; // a list consists of a data field, + field List next; // followed by a list + + /* Creates a List. */ + constructor List new(int car, List cdr) { + let data = car; // the identifiers car and cdr are used in + let next = cdr; // memory of the Lisp programming language + return this; + } + + /** Accessors. */ + method int getData() { return data; } + method int getNext() { return next; } + + /** Prints this list. */ + method void print() { + var List current; // initializes current to the first item + let current = this; // of this list + while (~(current = null)) { + do Output.printInt(current.getData()); + do Output.printChar(32); // prints a space + let current = current.getNext(); + } + return; + } + + /** Disposes this List by recursively disposing its tail. */ + method void dispose() { + if (~(next = null)) { + do next.dispose(); + } + // Uses an OS routine to recycle this object. + do Memory.deAlloc(this); + return; + } + + // More list processing methods can come here. + +} diff --git a/projects/09/List/Main.jack b/projects/09/List/Main.jack new file mode 100644 index 0000000..824eb6f --- /dev/null +++ b/projects/09/List/Main.jack @@ -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: projects/09/List/Main.jack + +/** Demonstrates the use of the List abstraction. */ +class Main { + function void main() { + // Creates and uses the list (2,3,5). + var List v; + let v = List.new(5,null); + let v = List.new(2,List.new(3,v)); + do v.print(); // prints 2 3 5 + do v.dispose(); // disposes the list + return; + } +} diff --git a/projects/09/Square/Main.jack b/projects/09/Square/Main.jack new file mode 100644 index 0000000..8311cc2 --- /dev/null +++ b/projects/09/Square/Main.jack @@ -0,0 +1,15 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/09/Square/Main.jack + +/** Initializes a new Square Dance game and starts running it. */ +class Main { + function void main() { + var SquareGame game; + let game = SquareGame.new(); + do game.run(); + do game.dispose(); + return; + } +} diff --git a/projects/09/Square/Square.jack b/projects/09/Square/Square.jack new file mode 100644 index 0000000..38066e5 --- /dev/null +++ b/projects/09/Square/Square.jack @@ -0,0 +1,108 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/09/Square/Square.jack + +/** Implements a graphical square. */ +class Square { + + field int x, y; // screen location of the square's top-left corner + field int size; // length of this square, in pixels + + /** Constructs a new square with a given location and size. */ + constructor Square new(int Ax, int Ay, int Asize) { + let x = Ax; + let y = Ay; + let size = Asize; + do draw(); + return this; + } + + /** Disposes this square. */ + method void dispose() { + do Memory.deAlloc(this); + return; + } + + /** Draws the square on the screen. */ + method void draw() { + do Screen.setColor(true); + do Screen.drawRectangle(x, y, x + size, y + size); + return; + } + + /** Erases the square from the screen. */ + method void erase() { + do Screen.setColor(false); + do Screen.drawRectangle(x, y, x + size, y + size); + return; + } + + /** Increments the square size by 2 pixels. */ + method void incSize() { + if (((y + size) < 254) & ((x + size) < 510)) { + do erase(); + let size = size + 2; + do draw(); + } + return; + } + + /** Decrements the square size by 2 pixels. */ + method void decSize() { + if (size > 2) { + do erase(); + let size = size - 2; + do draw(); + } + return; + } + + /** Moves the square up by 2 pixels. */ + method void moveUp() { + if (y > 1) { + do Screen.setColor(false); + do Screen.drawRectangle(x, (y + size) - 1, x + size, y + size); + let y = y - 2; + do Screen.setColor(true); + do Screen.drawRectangle(x, y, x + size, y + 1); + } + return; + } + + /** Moves the square down by 2 pixels. */ + method void moveDown() { + if ((y + size) < 254) { + do Screen.setColor(false); + do Screen.drawRectangle(x, y, x + size, y + 1); + let y = y + 2; + do Screen.setColor(true); + do Screen.drawRectangle(x, (y + size) - 1, x + size, y + size); + } + return; + } + + /** Moves the square left by 2 pixels. */ + method void moveLeft() { + if (x > 1) { + do Screen.setColor(false); + do Screen.drawRectangle((x + size) - 1, y, x + size, y + size); + let x = x - 2; + do Screen.setColor(true); + do Screen.drawRectangle(x, y, x + 1, y + size); + } + return; + } + + /** Moves the square right by 2 pixels. */ + method void moveRight() { + if ((x + size) < 510) { + do Screen.setColor(false); + do Screen.drawRectangle(x, y, x + 1, y + size); + let x = x + 2; + do Screen.setColor(true); + do Screen.drawRectangle((x + size) - 1, y, x + size, y + size); + } + return; + } +} diff --git a/projects/09/Square/SquareGame.jack b/projects/09/Square/SquareGame.jack new file mode 100644 index 0000000..02393e2 --- /dev/null +++ b/projects/09/Square/SquareGame.jack @@ -0,0 +1,79 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/09/Square/SquareGame.jack + +/** + * Implements the Square Dance game. + * This simple game allows the user to move a black square around + * the screen, and change the square's size during the movement. + * When the game starts, a square of 30 by 30 pixels is shown at the + * top-left corner of the screen. The user controls the square as follows. + * The 4 arrow keys are used to move the square up, down, left, and right. + * The 'z' and 'x' keys are used, respectively, to decrement and increment + * the square's size. The 'q' key is used to quit the game. + */ + +class SquareGame { + field Square square; // the square of this game + field int direction; // the square's current direction: + // 0=none, 1=up, 2=down, 3=left, 4=right + + /** Constructs a new Square Game. */ + constructor SquareGame new() { + // Creates a 30 by 30 pixels square and positions it at the top-left + // of the screen. + let square = Square.new(0, 0, 30); + let direction = 0; // initial state is no movement + return this; + } + + /** Disposes this game. */ + method void dispose() { + do square.dispose(); + do Memory.deAlloc(this); + return; + } + + /** Moves the square in the current direction. */ + method void moveSquare() { + if (direction = 1) { do square.moveUp(); } + if (direction = 2) { do square.moveDown(); } + if (direction = 3) { do square.moveLeft(); } + if (direction = 4) { do square.moveRight(); } + do Sys.wait(5); // delays the next movement + return; + } + + /** Runs the game: handles the user's inputs and moves the square accordingly */ + method void run() { + var char key; // the key currently pressed by the user + var boolean exit; + let exit = false; + + while (~exit) { + // waits for a key to be pressed + while (key = 0) { + let key = Keyboard.keyPressed(); + do moveSquare(); + } + if (key = 81) { let exit = true; } // q key + if (key = 90) { do square.decSize(); } // z key + if (key = 88) { do square.incSize(); } // x key + if (key = 131) { let direction = 1; } // up arrow + if (key = 133) { let direction = 2; } // down arrow + if (key = 130) { let direction = 3; } // left arrow + if (key = 132) { let direction = 4; } // right arrow + + // waits for the key to be released + while (~(key = 0)) { + let key = Keyboard.keyPressed(); + do moveSquare(); + } + } // while + return; + } +} + + + diff --git a/projects/10/ArrayTest/Main.jack b/projects/10/ArrayTest/Main.jack new file mode 100644 index 0000000..aa237b1 --- /dev/null +++ b/projects/10/ArrayTest/Main.jack @@ -0,0 +1,38 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/10/ArrayTest/Main.jack + +// (identical to projects/09/Average/Main.jack) + +/** Computes the average of a sequence of integers. */ +class Main { + function void main() { + var Array a; + var int length; + var int i, sum; + + let length = Keyboard.readInt("HOW MANY NUMBERS? "); + let a = Array.new(length); + let i = 0; + + while (i < length) { + let a[i] = Keyboard.readInt("ENTER THE NEXT NUMBER: "); + let i = i + 1; + } + + let i = 0; + let sum = 0; + + while (i < length) { + let sum = sum + a[i]; + let i = i + 1; + } + + do Output.printString("THE AVERAGE IS: "); + do Output.printInt(sum / length); + do Output.println(); + + return; + } +} diff --git a/projects/10/ArrayTest/Main.xml b/projects/10/ArrayTest/Main.xml new file mode 100644 index 0000000..0ea96df --- /dev/null +++ b/projects/10/ArrayTest/Main.xml @@ -0,0 +1,286 @@ + + class + Main + { + + function + void + main + ( + + + ) + + { + + var + Array + a + ; + + + var + int + length + ; + + + var + int + i + , + sum + ; + + + + let + length + = + + + Keyboard + . + readInt + ( + + + + HOW MANY NUMBERS? + + + + ) + + + ; + + + let + a + = + + + Array + . + new + ( + + + + length + + + + ) + + + ; + + + let + i + = + + + 0 + + + ; + + + while + ( + + + i + + < + + length + + + ) + { + + + let + a + [ + + + i + + + ] + = + + + Keyboard + . + readInt + ( + + + + ENTER THE NEXT NUMBER: + + + + ) + + + ; + + + let + i + = + + + i + + + + + 1 + + + ; + + + } + + + let + i + = + + + 0 + + + ; + + + let + sum + = + + + 0 + + + ; + + + while + ( + + + i + + < + + length + + + ) + { + + + let + sum + = + + + sum + + + + + a + [ + + + i + + + ] + + + ; + + + let + i + = + + + i + + + + + 1 + + + ; + + + } + + + do + Output + . + printString + ( + + + + THE AVERAGE IS: + + + + ) + ; + + + do + Output + . + printInt + ( + + + + sum + + / + + length + + + + ) + ; + + + do + Output + . + println + ( + + + ) + ; + + + return + ; + + + } + + + } + diff --git a/projects/10/ArrayTest/MainT.xml b/projects/10/ArrayTest/MainT.xml new file mode 100644 index 0000000..68721ec --- /dev/null +++ b/projects/10/ArrayTest/MainT.xml @@ -0,0 +1,142 @@ + + class + Main + { + function + void + main + ( + ) + { + var + Array + a + ; + var + int + length + ; + var + int + i + , + sum + ; + let + length + = + Keyboard + . + readInt + ( + HOW MANY NUMBERS? + ) + ; + let + a + = + Array + . + new + ( + length + ) + ; + let + i + = + 0 + ; + while + ( + i + < + length + ) + { + let + a + [ + i + ] + = + Keyboard + . + readInt + ( + ENTER THE NEXT NUMBER: + ) + ; + let + i + = + i + + + 1 + ; + } + let + i + = + 0 + ; + let + sum + = + 0 + ; + while + ( + i + < + length + ) + { + let + sum + = + sum + + + a + [ + i + ] + ; + let + i + = + i + + + 1 + ; + } + do + Output + . + printString + ( + THE AVERAGE IS: + ) + ; + do + Output + . + printInt + ( + sum + / + length + ) + ; + do + Output + . + println + ( + ) + ; + return + ; + } + } + diff --git a/projects/10/ExpressionLessSquare/Main.jack b/projects/10/ExpressionLessSquare/Main.jack new file mode 100644 index 0000000..d2c5561 --- /dev/null +++ b/projects/10/ExpressionLessSquare/Main.jack @@ -0,0 +1,36 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/10/ExpressionLessSquare/Main.jack + +/** Expressionless version of projects/10/Square/Main.jack. */ + +class Main { + static boolean test; // Added for testing -- there is no static keyword + // in the Square files. + + function void main() { + var SquareGame game; + let game = game; + do game.run(); + do game.dispose(); + return; + } + + function void test() { // Added to test Jack syntax that is not use in + var int i, j; // the Square files. + var String s; + var Array a; + if (i) { + let s = i; + let s = j; + let a[i] = j; + } + else { // There is no else keyword in the Square files. + let i = i; + let j = j; + let i = i | j; + } + return; + } +} diff --git a/projects/10/ExpressionLessSquare/Main.xml b/projects/10/ExpressionLessSquare/Main.xml new file mode 100644 index 0000000..6beb694 --- /dev/null +++ b/projects/10/ExpressionLessSquare/Main.xml @@ -0,0 +1,205 @@ + + class + Main + { + + static + boolean + test + ; + + + function + void + main + ( + + + ) + + { + + var + SquareGame + game + ; + + + + let + game + = + + + game + + + ; + + + do + game + . + run + ( + + + ) + ; + + + do + game + . + dispose + ( + + + ) + ; + + + return + ; + + + } + + + + function + void + test + ( + + + ) + + { + + var + int + i + , + j + ; + + + var + String + s + ; + + + var + Array + a + ; + + + + if + ( + + + i + + + ) + { + + + let + s + = + + + i + + + ; + + + let + s + = + + + j + + + ; + + + let + a + [ + + + i + + + ] + = + + + j + + + ; + + + } + else + { + + + let + i + = + + + i + + + ; + + + let + j + = + + + j + + + ; + + + let + i + = + + + i + + | + + j + + + ; + + + } + + + return + ; + + + } + + + } + diff --git a/projects/10/ExpressionLessSquare/MainT.xml b/projects/10/ExpressionLessSquare/MainT.xml new file mode 100644 index 0000000..f074ba4 --- /dev/null +++ b/projects/10/ExpressionLessSquare/MainT.xml @@ -0,0 +1,109 @@ + + class + Main + { + static + boolean + test + ; + function + void + main + ( + ) + { + var + SquareGame + game + ; + let + game + = + game + ; + do + game + . + run + ( + ) + ; + do + game + . + dispose + ( + ) + ; + return + ; + } + function + void + test + ( + ) + { + var + int + i + , + j + ; + var + String + s + ; + var + Array + a + ; + if + ( + i + ) + { + let + s + = + i + ; + let + s + = + j + ; + let + a + [ + i + ] + = + j + ; + } + else + { + let + i + = + i + ; + let + j + = + j + ; + let + i + = + i + | + j + ; + } + return + ; + } + } + diff --git a/projects/10/ExpressionLessSquare/Square.jack b/projects/10/ExpressionLessSquare/Square.jack new file mode 100644 index 0000000..33a54ad --- /dev/null +++ b/projects/10/ExpressionLessSquare/Square.jack @@ -0,0 +1,99 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +/// File name: projects/10/ExpressionLessSquare/Square.jack + +/** Expressionless version of projects/10/Square/Square.jack. */ + +class Square { + + field int x, y; + field int size; + + constructor Square new(int Ax, int Ay, int Asize) { + let x = Ax; + let y = Ay; + let size = Asize; + do draw(); + return x; + } + + method void dispose() { + do Memory.deAlloc(this); + return; + } + + method void draw() { + do Screen.setColor(x); + do Screen.drawRectangle(x, y, x, y); + return; + } + + method void erase() { + do Screen.setColor(x); + do Screen.drawRectangle(x, y, x, y); + return; + } + + method void incSize() { + if (x) { + do erase(); + let size = size; + do draw(); + } + return; + } + + method void decSize() { + if (size) { + do erase(); + let size = size; + do draw(); + } + return; + } + + method void moveUp() { + if (y) { + do Screen.setColor(x); + do Screen.drawRectangle(x, y, x, y); + let y = y; + do Screen.setColor(x); + do Screen.drawRectangle(x, y, x, y); + } + return; + } + + method void moveDown() { + if (y) { + do Screen.setColor(x); + do Screen.drawRectangle(x, y, x, y); + let y = y; + do Screen.setColor(x); + do Screen.drawRectangle(x, y, x, y); + } + return; + } + + method void moveLeft() { + if (x) { + do Screen.setColor(x); + do Screen.drawRectangle(x, y, x, y); + let x = x; + do Screen.setColor(x); + do Screen.drawRectangle(x, y, x, y); + } + return; + } + + method void moveRight() { + if (x) { + do Screen.setColor(x); + do Screen.drawRectangle(x, y, x, y); + let x = x; + do Screen.setColor(x); + do Screen.drawRectangle(x, y, x, y); + } + return; + } +} diff --git a/projects/10/ExpressionLessSquare/Square.xml b/projects/10/ExpressionLessSquare/Square.xml new file mode 100644 index 0000000..ed0e6ec --- /dev/null +++ b/projects/10/ExpressionLessSquare/Square.xml @@ -0,0 +1,967 @@ + + class + Square + { + + field + int + x + , + y + ; + + + field + int + size + ; + + + constructor + Square + new + ( + + int + Ax + , + int + Ay + , + int + Asize + + ) + + { + + + let + x + = + + + Ax + + + ; + + + let + y + = + + + Ay + + + ; + + + let + size + = + + + Asize + + + ; + + + do + draw + ( + + + ) + ; + + + return + + + x + + + ; + + + } + + + + method + void + dispose + ( + + + ) + + { + + + do + Memory + . + deAlloc + ( + + + + this + + + + ) + ; + + + return + ; + + + } + + + + method + void + draw + ( + + + ) + + { + + + do + Screen + . + setColor + ( + + + + x + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + y + + + , + + + x + + + , + + + y + + + + ) + ; + + + return + ; + + + } + + + + method + void + erase + ( + + + ) + + { + + + do + Screen + . + setColor + ( + + + + x + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + y + + + , + + + x + + + , + + + y + + + + ) + ; + + + return + ; + + + } + + + + method + void + incSize + ( + + + ) + + { + + + if + ( + + + x + + + ) + { + + + do + erase + ( + + + ) + ; + + + let + size + = + + + size + + + ; + + + do + draw + ( + + + ) + ; + + + } + + + return + ; + + + } + + + + method + void + decSize + ( + + + ) + + { + + + if + ( + + + size + + + ) + { + + + do + erase + ( + + + ) + ; + + + let + size + = + + + size + + + ; + + + do + draw + ( + + + ) + ; + + + } + + + return + ; + + + } + + + + method + void + moveUp + ( + + + ) + + { + + + if + ( + + + y + + + ) + { + + + do + Screen + . + setColor + ( + + + + x + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + y + + + , + + + x + + + , + + + y + + + + ) + ; + + + let + y + = + + + y + + + ; + + + do + Screen + . + setColor + ( + + + + x + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + y + + + , + + + x + + + , + + + y + + + + ) + ; + + + } + + + return + ; + + + } + + + + method + void + moveDown + ( + + + ) + + { + + + if + ( + + + y + + + ) + { + + + do + Screen + . + setColor + ( + + + + x + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + y + + + , + + + x + + + , + + + y + + + + ) + ; + + + let + y + = + + + y + + + ; + + + do + Screen + . + setColor + ( + + + + x + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + y + + + , + + + x + + + , + + + y + + + + ) + ; + + + } + + + return + ; + + + } + + + + method + void + moveLeft + ( + + + ) + + { + + + if + ( + + + x + + + ) + { + + + do + Screen + . + setColor + ( + + + + x + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + y + + + , + + + x + + + , + + + y + + + + ) + ; + + + let + x + = + + + x + + + ; + + + do + Screen + . + setColor + ( + + + + x + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + y + + + , + + + x + + + , + + + y + + + + ) + ; + + + } + + + return + ; + + + } + + + + method + void + moveRight + ( + + + ) + + { + + + if + ( + + + x + + + ) + { + + + do + Screen + . + setColor + ( + + + + x + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + y + + + , + + + x + + + , + + + y + + + + ) + ; + + + let + x + = + + + x + + + ; + + + do + Screen + . + setColor + ( + + + + x + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + y + + + , + + + x + + + , + + + y + + + + ) + ; + + + } + + + return + ; + + + } + + + } + diff --git a/projects/10/ExpressionLessSquare/SquareGame.jack b/projects/10/ExpressionLessSquare/SquareGame.jack new file mode 100644 index 0000000..2866f0d --- /dev/null +++ b/projects/10/ExpressionLessSquare/SquareGame.jack @@ -0,0 +1,60 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/10/ExpressionLessSquare/SquareGame.jack + +/** Expressionless version of projects/10/Square/SquareGame.jack. */ + +class SquareGame { + field Square square; + field int direction; + + constructor SquareGame new() { + let square = square; + let direction = direction; + return square; + } + + method void dispose() { + do square.dispose(); + do Memory.deAlloc(square); + return; + } + + method void moveSquare() { + if (direction) { do square.moveUp(); } + if (direction) { do square.moveDown(); } + if (direction) { do square.moveLeft(); } + if (direction) { do square.moveRight(); } + do Sys.wait(direction); + return; + } + + method void run() { + var char key; + var boolean exit; + + let exit = key; + while (exit) { + while (key) { + let key = key; + do moveSquare(); + } + + if (key) { let exit = exit; } + if (key) { do square.decSize(); } + if (key) { do square.incSize(); } + if (key) { let direction = exit; } + if (key) { let direction = key; } + if (key) { let direction = square; } + if (key) { let direction = direction; } + + while (key) { + let key = key; + do moveSquare(); + } + } + return; + } +} + diff --git a/projects/10/ExpressionLessSquare/SquareGame.xml b/projects/10/ExpressionLessSquare/SquareGame.xml new file mode 100644 index 0000000..288c6cd --- /dev/null +++ b/projects/10/ExpressionLessSquare/SquareGame.xml @@ -0,0 +1,544 @@ + + class + SquareGame + { + + field + Square + square + ; + + + field + int + direction + ; + + + constructor + SquareGame + new + ( + + + ) + + { + + + let + square + = + + + square + + + ; + + + let + direction + = + + + direction + + + ; + + + return + + + square + + + ; + + + } + + + + method + void + dispose + ( + + + ) + + { + + + do + square + . + dispose + ( + + + ) + ; + + + do + Memory + . + deAlloc + ( + + + + square + + + + ) + ; + + + return + ; + + + } + + + + method + void + moveSquare + ( + + + ) + + { + + + if + ( + + + direction + + + ) + { + + + do + square + . + moveUp + ( + + + ) + ; + + + } + + + if + ( + + + direction + + + ) + { + + + do + square + . + moveDown + ( + + + ) + ; + + + } + + + if + ( + + + direction + + + ) + { + + + do + square + . + moveLeft + ( + + + ) + ; + + + } + + + if + ( + + + direction + + + ) + { + + + do + square + . + moveRight + ( + + + ) + ; + + + } + + + do + Sys + . + wait + ( + + + + direction + + + + ) + ; + + + return + ; + + + } + + + + method + void + run + ( + + + ) + + { + + var + char + key + ; + + + var + boolean + exit + ; + + + + let + exit + = + + + key + + + ; + + + while + ( + + + exit + + + ) + { + + + while + ( + + + key + + + ) + { + + + let + key + = + + + key + + + ; + + + do + moveSquare + ( + + + ) + ; + + + } + + + if + ( + + + key + + + ) + { + + + let + exit + = + + + exit + + + ; + + + } + + + if + ( + + + key + + + ) + { + + + do + square + . + decSize + ( + + + ) + ; + + + } + + + if + ( + + + key + + + ) + { + + + do + square + . + incSize + ( + + + ) + ; + + + } + + + if + ( + + + key + + + ) + { + + + let + direction + = + + + exit + + + ; + + + } + + + if + ( + + + key + + + ) + { + + + let + direction + = + + + key + + + ; + + + } + + + if + ( + + + key + + + ) + { + + + let + direction + = + + + square + + + ; + + + } + + + if + ( + + + key + + + ) + { + + + let + direction + = + + + direction + + + ; + + + } + + + while + ( + + + key + + + ) + { + + + let + key + = + + + key + + + ; + + + do + moveSquare + ( + + + ) + ; + + + } + + + } + + + return + ; + + + } + + + } + diff --git a/projects/10/ExpressionLessSquare/SquareGameT.xml b/projects/10/ExpressionLessSquare/SquareGameT.xml new file mode 100644 index 0000000..278a8a9 --- /dev/null +++ b/projects/10/ExpressionLessSquare/SquareGameT.xml @@ -0,0 +1,268 @@ + + class + SquareGame + { + field + Square + square + ; + field + int + direction + ; + constructor + SquareGame + new + ( + ) + { + let + square + = + square + ; + let + direction + = + direction + ; + return + square + ; + } + method + void + dispose + ( + ) + { + do + square + . + dispose + ( + ) + ; + do + Memory + . + deAlloc + ( + square + ) + ; + return + ; + } + method + void + moveSquare + ( + ) + { + if + ( + direction + ) + { + do + square + . + moveUp + ( + ) + ; + } + if + ( + direction + ) + { + do + square + . + moveDown + ( + ) + ; + } + if + ( + direction + ) + { + do + square + . + moveLeft + ( + ) + ; + } + if + ( + direction + ) + { + do + square + . + moveRight + ( + ) + ; + } + do + Sys + . + wait + ( + direction + ) + ; + return + ; + } + method + void + run + ( + ) + { + var + char + key + ; + var + boolean + exit + ; + let + exit + = + key + ; + while + ( + exit + ) + { + while + ( + key + ) + { + let + key + = + key + ; + do + moveSquare + ( + ) + ; + } + if + ( + key + ) + { + let + exit + = + exit + ; + } + if + ( + key + ) + { + do + square + . + decSize + ( + ) + ; + } + if + ( + key + ) + { + do + square + . + incSize + ( + ) + ; + } + if + ( + key + ) + { + let + direction + = + exit + ; + } + if + ( + key + ) + { + let + direction + = + key + ; + } + if + ( + key + ) + { + let + direction + = + square + ; + } + if + ( + key + ) + { + let + direction + = + direction + ; + } + while + ( + key + ) + { + let + key + = + key + ; + do + moveSquare + ( + ) + ; + } + } + return + ; + } + } + diff --git a/projects/10/ExpressionLessSquare/SquareT.xml b/projects/10/ExpressionLessSquare/SquareT.xml new file mode 100644 index 0000000..cd03a1e --- /dev/null +++ b/projects/10/ExpressionLessSquare/SquareT.xml @@ -0,0 +1,449 @@ + + class + Square + { + field + int + x + , + y + ; + field + int + size + ; + constructor + Square + new + ( + int + Ax + , + int + Ay + , + int + Asize + ) + { + let + x + = + Ax + ; + let + y + = + Ay + ; + let + size + = + Asize + ; + do + draw + ( + ) + ; + return + x + ; + } + method + void + dispose + ( + ) + { + do + Memory + . + deAlloc + ( + this + ) + ; + return + ; + } + method + void + draw + ( + ) + { + do + Screen + . + setColor + ( + x + ) + ; + do + Screen + . + drawRectangle + ( + x + , + y + , + x + , + y + ) + ; + return + ; + } + method + void + erase + ( + ) + { + do + Screen + . + setColor + ( + x + ) + ; + do + Screen + . + drawRectangle + ( + x + , + y + , + x + , + y + ) + ; + return + ; + } + method + void + incSize + ( + ) + { + if + ( + x + ) + { + do + erase + ( + ) + ; + let + size + = + size + ; + do + draw + ( + ) + ; + } + return + ; + } + method + void + decSize + ( + ) + { + if + ( + size + ) + { + do + erase + ( + ) + ; + let + size + = + size + ; + do + draw + ( + ) + ; + } + return + ; + } + method + void + moveUp + ( + ) + { + if + ( + y + ) + { + do + Screen + . + setColor + ( + x + ) + ; + do + Screen + . + drawRectangle + ( + x + , + y + , + x + , + y + ) + ; + let + y + = + y + ; + do + Screen + . + setColor + ( + x + ) + ; + do + Screen + . + drawRectangle + ( + x + , + y + , + x + , + y + ) + ; + } + return + ; + } + method + void + moveDown + ( + ) + { + if + ( + y + ) + { + do + Screen + . + setColor + ( + x + ) + ; + do + Screen + . + drawRectangle + ( + x + , + y + , + x + , + y + ) + ; + let + y + = + y + ; + do + Screen + . + setColor + ( + x + ) + ; + do + Screen + . + drawRectangle + ( + x + , + y + , + x + , + y + ) + ; + } + return + ; + } + method + void + moveLeft + ( + ) + { + if + ( + x + ) + { + do + Screen + . + setColor + ( + x + ) + ; + do + Screen + . + drawRectangle + ( + x + , + y + , + x + , + y + ) + ; + let + x + = + x + ; + do + Screen + . + setColor + ( + x + ) + ; + do + Screen + . + drawRectangle + ( + x + , + y + , + x + , + y + ) + ; + } + return + ; + } + method + void + moveRight + ( + ) + { + if + ( + x + ) + { + do + Screen + . + setColor + ( + x + ) + ; + do + Screen + . + drawRectangle + ( + x + , + y + , + x + , + y + ) + ; + let + x + = + x + ; + do + Screen + . + setColor + ( + x + ) + ; + do + Screen + . + drawRectangle + ( + x + , + y + , + x + , + y + ) + ; + } + return + ; + } + } + diff --git a/projects/10/Square/Main.jack b/projects/10/Square/Main.jack new file mode 100644 index 0000000..0b9e4cb --- /dev/null +++ b/projects/10/Square/Main.jack @@ -0,0 +1,36 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/10/Square/Main.jack + +// (derived from projects/09/Square/Main.jack, with testing additions) + +/** Initializes a new Square Dance game and starts running it. */ +class Main { + static boolean test; // Added for testing -- there is no static keyword + // in the Square files. + function void main() { + var SquareGame game; + let game = SquareGame.new(); + do game.run(); + do game.dispose(); + return; + } + + function void test() { // Added to test Jack syntax that is not use in + var int i, j; // the Square files. + var String s; + var Array a; + if (false) { + let s = "string constant"; + let s = null; + let a[1] = a[2]; + } + else { // There is no else keyword in the Square files. + let i = i * (-j); + let j = j / (-2); // note: unary negate constant 2 + let i = i | j; + } + return; + } +} diff --git a/projects/10/Square/Main.xml b/projects/10/Square/Main.xml new file mode 100644 index 0000000..f6863c6 --- /dev/null +++ b/projects/10/Square/Main.xml @@ -0,0 +1,244 @@ + + class + Main + { + + static + boolean + test + ; + + + function + void + main + ( + + + ) + + { + + var + SquareGame + game + ; + + + + let + game + = + + + SquareGame + . + new + ( + + + ) + + + ; + + + do + game + . + run + ( + + + ) + ; + + + do + game + . + dispose + ( + + + ) + ; + + + return + ; + + + } + + + + function + void + test + ( + + + ) + + { + + var + int + i + , + j + ; + + + var + String + s + ; + + + var + Array + a + ; + + + + if + ( + + + false + + + ) + { + + + let + s + = + + + string constant + + + ; + + + let + s + = + + + null + + + ; + + + let + a + [ + + + 1 + + + ] + = + + + a + [ + + + 2 + + + ] + + + ; + + + } + else + { + + + let + i + = + + + i + + * + + ( + + + - + + j + + + + ) + + + ; + + + let + j + = + + + j + + / + + ( + + + - + + 2 + + + + ) + + + ; + + + let + i + = + + + i + + | + + j + + + ; + + + } + + + return + ; + + + } + + + } + diff --git a/projects/10/Square/MainT.xml b/projects/10/Square/MainT.xml new file mode 100644 index 0000000..950c050 --- /dev/null +++ b/projects/10/Square/MainT.xml @@ -0,0 +1,126 @@ + + class + Main + { + static + boolean + test + ; + function + void + main + ( + ) + { + var + SquareGame + game + ; + let + game + = + SquareGame + . + new + ( + ) + ; + do + game + . + run + ( + ) + ; + do + game + . + dispose + ( + ) + ; + return + ; + } + function + void + test + ( + ) + { + var + int + i + , + j + ; + var + String + s + ; + var + Array + a + ; + if + ( + false + ) + { + let + s + = + string constant + ; + let + s + = + null + ; + let + a + [ + 1 + ] + = + a + [ + 2 + ] + ; + } + else + { + let + i + = + i + * + ( + - + j + ) + ; + let + j + = + j + / + ( + - + 2 + ) + ; + let + i + = + i + | + j + ; + } + return + ; + } + } + diff --git a/projects/10/Square/Square.jack b/projects/10/Square/Square.jack new file mode 100644 index 0000000..3faf24f --- /dev/null +++ b/projects/10/Square/Square.jack @@ -0,0 +1,110 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/10/Square/Square.jack + +// (same as projects/09/Square/Square.jack) + +/** Implements a graphical square. */ +class Square { + + field int x, y; // screen location of the square's top-left corner + field int size; // length of this square, in pixels + + /** Constructs a new square with a given location and size. */ + constructor Square new(int Ax, int Ay, int Asize) { + let x = Ax; + let y = Ay; + let size = Asize; + do draw(); + return this; + } + + /** Disposes this square. */ + method void dispose() { + do Memory.deAlloc(this); + return; + } + + /** Draws the square on the screen. */ + method void draw() { + do Screen.setColor(true); + do Screen.drawRectangle(x, y, x + size, y + size); + return; + } + + /** Erases the square from the screen. */ + method void erase() { + do Screen.setColor(false); + do Screen.drawRectangle(x, y, x + size, y + size); + return; + } + + /** Increments the square size by 2 pixels. */ + method void incSize() { + if (((y + size) < 254) & ((x + size) < 510)) { + do erase(); + let size = size + 2; + do draw(); + } + return; + } + + /** Decrements the square size by 2 pixels. */ + method void decSize() { + if (size > 2) { + do erase(); + let size = size - 2; + do draw(); + } + return; + } + + /** Moves the square up by 2 pixels. */ + method void moveUp() { + if (y > 1) { + do Screen.setColor(false); + do Screen.drawRectangle(x, (y + size) - 1, x + size, y + size); + let y = y - 2; + do Screen.setColor(true); + do Screen.drawRectangle(x, y, x + size, y + 1); + } + return; + } + + /** Moves the square down by 2 pixels. */ + method void moveDown() { + if ((y + size) < 254) { + do Screen.setColor(false); + do Screen.drawRectangle(x, y, x + size, y + 1); + let y = y + 2; + do Screen.setColor(true); + do Screen.drawRectangle(x, (y + size) - 1, x + size, y + size); + } + return; + } + + /** Moves the square left by 2 pixels. */ + method void moveLeft() { + if (x > 1) { + do Screen.setColor(false); + do Screen.drawRectangle((x + size) - 1, y, x + size, y + size); + let x = x - 2; + do Screen.setColor(true); + do Screen.drawRectangle(x, y, x + 1, y + size); + } + return; + } + + /** Moves the square right by 2 pixels. */ + method void moveRight() { + if ((x + size) < 510) { + do Screen.setColor(false); + do Screen.drawRectangle(x, y, x + 1, y + size); + let x = x + 2; + do Screen.setColor(true); + do Screen.drawRectangle((x + size) - 1, y, x + size, y + size); + } + return; + } +} diff --git a/projects/10/Square/Square.xml b/projects/10/Square/Square.xml new file mode 100644 index 0000000..ff5f235 --- /dev/null +++ b/projects/10/Square/Square.xml @@ -0,0 +1,1211 @@ + + class + Square + { + + field + int + x + , + y + ; + + + field + int + size + ; + + + constructor + Square + new + ( + + int + Ax + , + int + Ay + , + int + Asize + + ) + + { + + + let + x + = + + + Ax + + + ; + + + let + y + = + + + Ay + + + ; + + + let + size + = + + + Asize + + + ; + + + do + draw + ( + + + ) + ; + + + return + + + this + + + ; + + + } + + + + method + void + dispose + ( + + + ) + + { + + + do + Memory + . + deAlloc + ( + + + + this + + + + ) + ; + + + return + ; + + + } + + + + method + void + draw + ( + + + ) + + { + + + do + Screen + . + setColor + ( + + + + true + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + y + + + , + + + x + + + + + size + + + , + + + y + + + + + size + + + + ) + ; + + + return + ; + + + } + + + + method + void + erase + ( + + + ) + + { + + + do + Screen + . + setColor + ( + + + + false + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + y + + + , + + + x + + + + + size + + + , + + + y + + + + + size + + + + ) + ; + + + return + ; + + + } + + + + method + void + incSize + ( + + + ) + + { + + + if + ( + + + ( + + + ( + + + y + + + + + size + + + ) + + < + + 254 + + + ) + + & + + ( + + + ( + + + x + + + + + size + + + ) + + < + + 510 + + + ) + + + ) + { + + + do + erase + ( + + + ) + ; + + + let + size + = + + + size + + + + + 2 + + + ; + + + do + draw + ( + + + ) + ; + + + } + + + return + ; + + + } + + + + method + void + decSize + ( + + + ) + + { + + + if + ( + + + size + + > + + 2 + + + ) + { + + + do + erase + ( + + + ) + ; + + + let + size + = + + + size + + - + + 2 + + + ; + + + do + draw + ( + + + ) + ; + + + } + + + return + ; + + + } + + + + method + void + moveUp + ( + + + ) + + { + + + if + ( + + + y + + > + + 1 + + + ) + { + + + do + Screen + . + setColor + ( + + + + false + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + ( + + + y + + + + + size + + + ) + + - + + 1 + + + , + + + x + + + + + size + + + , + + + y + + + + + size + + + + ) + ; + + + let + y + = + + + y + + - + + 2 + + + ; + + + do + Screen + . + setColor + ( + + + + true + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + y + + + , + + + x + + + + + size + + + , + + + y + + + + + 1 + + + + ) + ; + + + } + + + return + ; + + + } + + + + method + void + moveDown + ( + + + ) + + { + + + if + ( + + + ( + + + y + + + + + size + + + ) + + < + + 254 + + + ) + { + + + do + Screen + . + setColor + ( + + + + false + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + y + + + , + + + x + + + + + size + + + , + + + y + + + + + 1 + + + + ) + ; + + + let + y + = + + + y + + + + + 2 + + + ; + + + do + Screen + . + setColor + ( + + + + true + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + ( + + + y + + + + + size + + + ) + + - + + 1 + + + , + + + x + + + + + size + + + , + + + y + + + + + size + + + + ) + ; + + + } + + + return + ; + + + } + + + + method + void + moveLeft + ( + + + ) + + { + + + if + ( + + + x + + > + + 1 + + + ) + { + + + do + Screen + . + setColor + ( + + + + false + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + ( + + + x + + + + + size + + + ) + + - + + 1 + + + , + + + y + + + , + + + x + + + + + size + + + , + + + y + + + + + size + + + + ) + ; + + + let + x + = + + + x + + - + + 2 + + + ; + + + do + Screen + . + setColor + ( + + + + true + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + y + + + , + + + x + + + + + 1 + + + , + + + y + + + + + size + + + + ) + ; + + + } + + + return + ; + + + } + + + + method + void + moveRight + ( + + + ) + + { + + + if + ( + + + ( + + + x + + + + + size + + + ) + + < + + 510 + + + ) + { + + + do + Screen + . + setColor + ( + + + + false + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + x + + + , + + + y + + + , + + + x + + + + + 1 + + + , + + + y + + + + + size + + + + ) + ; + + + let + x + = + + + x + + + + + 2 + + + ; + + + do + Screen + . + setColor + ( + + + + true + + + + ) + ; + + + do + Screen + . + drawRectangle + ( + + + + ( + + + x + + + + + size + + + ) + + - + + 1 + + + , + + + y + + + , + + + x + + + + + size + + + , + + + y + + + + + size + + + + ) + ; + + + } + + + return + ; + + + } + + + } + diff --git a/projects/10/Square/SquareGame.jack b/projects/10/Square/SquareGame.jack new file mode 100644 index 0000000..4f71b16 --- /dev/null +++ b/projects/10/Square/SquareGame.jack @@ -0,0 +1,81 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/10/Square/SquareGame.jack + +// (same as projects/09/Square/SquareGame.jack) + +/** + * Implements the Square Dance game. + * This simple game allows the user to move a black square around + * the screen, and change the square's size during the movement. + * When the game starts, a square of 30 by 30 pixels is shown at the + * top-left corner of the screen. The user controls the square as follows. + * The 4 arrow keys are used to move the square up, down, left, and right. + * The 'z' and 'x' keys are used, respectively, to decrement and increment + * the square's size. The 'q' key is used to quit the game. + */ + +class SquareGame { + field Square square; // the square of this game + field int direction; // the square's current direction: + // 0=none, 1=up, 2=down, 3=left, 4=right + + /** Constructs a new Square Game. */ + constructor SquareGame new() { + // Creates a 30 by 30 pixels square and positions it at the top-left + // of the screen. + let square = Square.new(0, 0, 30); + let direction = 0; // initial state is no movement + return this; + } + + /** Disposes this game. */ + method void dispose() { + do square.dispose(); + do Memory.deAlloc(this); + return; + } + + /** Moves the square in the current direction. */ + method void moveSquare() { + if (direction = 1) { do square.moveUp(); } + if (direction = 2) { do square.moveDown(); } + if (direction = 3) { do square.moveLeft(); } + if (direction = 4) { do square.moveRight(); } + do Sys.wait(5); // delays the next movement + return; + } + + /** Runs the game: handles the user's inputs and moves the square accordingly */ + method void run() { + var char key; // the key currently pressed by the user + var boolean exit; + let exit = false; + + while (~exit) { + // waits for a key to be pressed + while (key = 0) { + let key = Keyboard.keyPressed(); + do moveSquare(); + } + if (key = 81) { let exit = true; } // q key + if (key = 90) { do square.decSize(); } // z key + if (key = 88) { do square.incSize(); } // x key + if (key = 131) { let direction = 1; } // up arrow + if (key = 133) { let direction = 2; } // down arrow + if (key = 130) { let direction = 3; } // left arrow + if (key = 132) { let direction = 4; } // right arrow + + // waits for the key to be released + while (~(key = 0)) { + let key = Keyboard.keyPressed(); + do moveSquare(); + } + } // while + return; + } +} + + + diff --git a/projects/10/Square/SquareGame.xml b/projects/10/Square/SquareGame.xml new file mode 100644 index 0000000..ed3ab6e --- /dev/null +++ b/projects/10/Square/SquareGame.xml @@ -0,0 +1,643 @@ + + class + SquareGame + { + + field + Square + square + ; + + + field + int + direction + ; + + + constructor + SquareGame + new + ( + + + ) + + { + + + let + square + = + + + Square + . + new + ( + + + + 0 + + + , + + + 0 + + + , + + + 30 + + + + ) + + + ; + + + let + direction + = + + + 0 + + + ; + + + return + + + this + + + ; + + + } + + + + method + void + dispose + ( + + + ) + + { + + + do + square + . + dispose + ( + + + ) + ; + + + do + Memory + . + deAlloc + ( + + + + this + + + + ) + ; + + + return + ; + + + } + + + + method + void + moveSquare + ( + + + ) + + { + + + if + ( + + + direction + + = + + 1 + + + ) + { + + + do + square + . + moveUp + ( + + + ) + ; + + + } + + + if + ( + + + direction + + = + + 2 + + + ) + { + + + do + square + . + moveDown + ( + + + ) + ; + + + } + + + if + ( + + + direction + + = + + 3 + + + ) + { + + + do + square + . + moveLeft + ( + + + ) + ; + + + } + + + if + ( + + + direction + + = + + 4 + + + ) + { + + + do + square + . + moveRight + ( + + + ) + ; + + + } + + + do + Sys + . + wait + ( + + + + 5 + + + + ) + ; + + + return + ; + + + } + + + + method + void + run + ( + + + ) + + { + + var + char + key + ; + + + var + boolean + exit + ; + + + + let + exit + = + + + false + + + ; + + + while + ( + + + ~ + + exit + + + + ) + { + + + while + ( + + + key + + = + + 0 + + + ) + { + + + let + key + = + + + Keyboard + . + keyPressed + ( + + + ) + + + ; + + + do + moveSquare + ( + + + ) + ; + + + } + + + if + ( + + + key + + = + + 81 + + + ) + { + + + let + exit + = + + + true + + + ; + + + } + + + if + ( + + + key + + = + + 90 + + + ) + { + + + do + square + . + decSize + ( + + + ) + ; + + + } + + + if + ( + + + key + + = + + 88 + + + ) + { + + + do + square + . + incSize + ( + + + ) + ; + + + } + + + if + ( + + + key + + = + + 131 + + + ) + { + + + let + direction + = + + + 1 + + + ; + + + } + + + if + ( + + + key + + = + + 133 + + + ) + { + + + let + direction + = + + + 2 + + + ; + + + } + + + if + ( + + + key + + = + + 130 + + + ) + { + + + let + direction + = + + + 3 + + + ; + + + } + + + if + ( + + + key + + = + + 132 + + + ) + { + + + let + direction + = + + + 4 + + + ; + + + } + + + while + ( + + + ~ + + ( + + + key + + = + + 0 + + + ) + + + + ) + { + + + let + key + = + + + Keyboard + . + keyPressed + ( + + + ) + + + ; + + + do + moveSquare + ( + + + ) + ; + + + } + + + } + + + return + ; + + + } + + + } + diff --git a/projects/10/Square/SquareGameT.xml b/projects/10/Square/SquareGameT.xml new file mode 100644 index 0000000..3136af2 --- /dev/null +++ b/projects/10/Square/SquareGameT.xml @@ -0,0 +1,315 @@ + + class + SquareGame + { + field + Square + square + ; + field + int + direction + ; + constructor + SquareGame + new + ( + ) + { + let + square + = + Square + . + new + ( + 0 + , + 0 + , + 30 + ) + ; + let + direction + = + 0 + ; + return + this + ; + } + method + void + dispose + ( + ) + { + do + square + . + dispose + ( + ) + ; + do + Memory + . + deAlloc + ( + this + ) + ; + return + ; + } + method + void + moveSquare + ( + ) + { + if + ( + direction + = + 1 + ) + { + do + square + . + moveUp + ( + ) + ; + } + if + ( + direction + = + 2 + ) + { + do + square + . + moveDown + ( + ) + ; + } + if + ( + direction + = + 3 + ) + { + do + square + . + moveLeft + ( + ) + ; + } + if + ( + direction + = + 4 + ) + { + do + square + . + moveRight + ( + ) + ; + } + do + Sys + . + wait + ( + 5 + ) + ; + return + ; + } + method + void + run + ( + ) + { + var + char + key + ; + var + boolean + exit + ; + let + exit + = + false + ; + while + ( + ~ + exit + ) + { + while + ( + key + = + 0 + ) + { + let + key + = + Keyboard + . + keyPressed + ( + ) + ; + do + moveSquare + ( + ) + ; + } + if + ( + key + = + 81 + ) + { + let + exit + = + true + ; + } + if + ( + key + = + 90 + ) + { + do + square + . + decSize + ( + ) + ; + } + if + ( + key + = + 88 + ) + { + do + square + . + incSize + ( + ) + ; + } + if + ( + key + = + 131 + ) + { + let + direction + = + 1 + ; + } + if + ( + key + = + 133 + ) + { + let + direction + = + 2 + ; + } + if + ( + key + = + 130 + ) + { + let + direction + = + 3 + ; + } + if + ( + key + = + 132 + ) + { + let + direction + = + 4 + ; + } + while + ( + ~ + ( + key + = + 0 + ) + ) + { + let + key + = + Keyboard + . + keyPressed + ( + ) + ; + do + moveSquare + ( + ) + ; + } + } + return + ; + } + } + diff --git a/projects/10/Square/SquareT.xml b/projects/10/Square/SquareT.xml new file mode 100644 index 0000000..69a8ca0 --- /dev/null +++ b/projects/10/Square/SquareT.xml @@ -0,0 +1,561 @@ + + class + Square + { + field + int + x + , + y + ; + field + int + size + ; + constructor + Square + new + ( + int + Ax + , + int + Ay + , + int + Asize + ) + { + let + x + = + Ax + ; + let + y + = + Ay + ; + let + size + = + Asize + ; + do + draw + ( + ) + ; + return + this + ; + } + method + void + dispose + ( + ) + { + do + Memory + . + deAlloc + ( + this + ) + ; + return + ; + } + method + void + draw + ( + ) + { + do + Screen + . + setColor + ( + true + ) + ; + do + Screen + . + drawRectangle + ( + x + , + y + , + x + + + size + , + y + + + size + ) + ; + return + ; + } + method + void + erase + ( + ) + { + do + Screen + . + setColor + ( + false + ) + ; + do + Screen + . + drawRectangle + ( + x + , + y + , + x + + + size + , + y + + + size + ) + ; + return + ; + } + method + void + incSize + ( + ) + { + if + ( + ( + ( + y + + + size + ) + < + 254 + ) + & + ( + ( + x + + + size + ) + < + 510 + ) + ) + { + do + erase + ( + ) + ; + let + size + = + size + + + 2 + ; + do + draw + ( + ) + ; + } + return + ; + } + method + void + decSize + ( + ) + { + if + ( + size + > + 2 + ) + { + do + erase + ( + ) + ; + let + size + = + size + - + 2 + ; + do + draw + ( + ) + ; + } + return + ; + } + method + void + moveUp + ( + ) + { + if + ( + y + > + 1 + ) + { + do + Screen + . + setColor + ( + false + ) + ; + do + Screen + . + drawRectangle + ( + x + , + ( + y + + + size + ) + - + 1 + , + x + + + size + , + y + + + size + ) + ; + let + y + = + y + - + 2 + ; + do + Screen + . + setColor + ( + true + ) + ; + do + Screen + . + drawRectangle + ( + x + , + y + , + x + + + size + , + y + + + 1 + ) + ; + } + return + ; + } + method + void + moveDown + ( + ) + { + if + ( + ( + y + + + size + ) + < + 254 + ) + { + do + Screen + . + setColor + ( + false + ) + ; + do + Screen + . + drawRectangle + ( + x + , + y + , + x + + + size + , + y + + + 1 + ) + ; + let + y + = + y + + + 2 + ; + do + Screen + . + setColor + ( + true + ) + ; + do + Screen + . + drawRectangle + ( + x + , + ( + y + + + size + ) + - + 1 + , + x + + + size + , + y + + + size + ) + ; + } + return + ; + } + method + void + moveLeft + ( + ) + { + if + ( + x + > + 1 + ) + { + do + Screen + . + setColor + ( + false + ) + ; + do + Screen + . + drawRectangle + ( + ( + x + + + size + ) + - + 1 + , + y + , + x + + + size + , + y + + + size + ) + ; + let + x + = + x + - + 2 + ; + do + Screen + . + setColor + ( + true + ) + ; + do + Screen + . + drawRectangle + ( + x + , + y + , + x + + + 1 + , + y + + + size + ) + ; + } + return + ; + } + method + void + moveRight + ( + ) + { + if + ( + ( + x + + + size + ) + < + 510 + ) + { + do + Screen + . + setColor + ( + false + ) + ; + do + Screen + . + drawRectangle + ( + x + , + y + , + x + + + 1 + , + y + + + size + ) + ; + let + x + = + x + + + 2 + ; + do + Screen + . + setColor + ( + true + ) + ; + do + Screen + . + drawRectangle + ( + ( + x + + + size + ) + - + 1 + , + y + , + x + + + size + , + y + + + size + ) + ; + } + return + ; + } + } + diff --git a/projects/11/Average/Main.jack b/projects/11/Average/Main.jack new file mode 100644 index 0000000..d560bf1 --- /dev/null +++ b/projects/11/Average/Main.jack @@ -0,0 +1,29 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/11/Average/Main.jack + +// (Same as projects/09/Average/Main.jack) + +// Inputs some numbers and computes their average +class Main { + function void main() { + var Array a; + var int length; + var int i, sum; + + let length = Keyboard.readInt("How many numbers? "); + let a = Array.new(length); // constructs the array + + let i = 0; + while (i < length) { + let a[i] = Keyboard.readInt("Enter a number: "); + let sum = sum + a[i]; + let i = i + 1; + } + + do Output.printString("The average is "); + do Output.printInt(sum / length); + return; + } +} diff --git a/projects/11/ComplexArrays/Main.jack b/projects/11/ComplexArrays/Main.jack new file mode 100644 index 0000000..fe51c20 --- /dev/null +++ b/projects/11/ComplexArrays/Main.jack @@ -0,0 +1,70 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/11/ComplexArrays/Main.jack + +/** + * Performs several complex array processing tests. + * For each test, the expected result is printed, along with the + * actual result. In each test, the two results should be equal. + */ +class Main { + + function void main() { + var Array a, b, c; + + let a = Array.new(10); + let b = Array.new(5); + let c = Array.new(1); + + let a[3] = 2; + let a[4] = 8; + let a[5] = 4; + let b[a[3]] = a[3] + 3; // b[2] = 5 + let a[b[a[3]]] = a[a[5]] * b[((7 - a[3]) - Main.double(2)) + 1]; // a[5] = 8 * 5 = 40 + let c[0] = null; + let c = c[0]; + + do Output.printString("Test 1: expected result: 5; actual result: "); + do Output.printInt(b[2]); + do Output.println(); + do Output.printString("Test 2: expected result: 40; actual result: "); + do Output.printInt(a[5]); + do Output.println(); + do Output.printString("Test 3: expected result: 0; actual result: "); + do Output.printInt(c); + do Output.println(); + + let c = null; + + if (c = null) { + do Main.fill(a, 10); + let c = a[3]; + let c[1] = 33; + let c = a[7]; + let c[1] = 77; + let b = a[3]; + let b[1] = b[1] + c[1]; // b[1] = 33 + 77 = 110; + } + + do Output.printString("Test 4: expected result: 77; actual result: "); + do Output.printInt(c[1]); + do Output.println(); + do Output.printString("Test 5: expected result: 110; actual result: "); + do Output.printInt(b[1]); + do Output.println(); + return; + } + + function int double(int a) { + return a * 2; + } + + function void fill(Array a, int size) { + while (size > 0) { + let size = size - 1; + let a[size] = Array.new(3); + } + return; + } +} diff --git a/projects/11/ConvertToBin/Main.jack b/projects/11/ConvertToBin/Main.jack new file mode 100644 index 0000000..e627486 --- /dev/null +++ b/projects/11/ConvertToBin/Main.jack @@ -0,0 +1,82 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/11/ConvertToBin/Main.jack + +/** + * Unpacks a 16-bit number into its binary representation: + * Takes the 16-bit number stored in RAM[8000] and stores its individual + * bits in RAM[8001..8016] (each location will contain 0 or 1). + * Before the conversion, RAM[8001]..RAM[8016] are initialized to -1. + * + * The program should be tested as follows: + * 1) Load the program into the supplied VM emulator + * 2) Put some value in RAM[8000] + * 3) Switch to "no animation" + * 4) Run the program (give it enough time to run) + * 5) Stop the program + * 6) Check that RAM[8001]..RAM[8016] contains the correct binary result, and + * that none of these memory locations contains -1. + */ +class Main { + + /** + * Initializes RAM[8001]..RAM[8016] to -1, + * and converts the value in RAM[8000] to binary. + */ + function void main() { + var int value; + do Main.fillMemory(8001, 16, -1); // sets RAM[8001]..RAM[8016] to -1 + let value = Memory.peek(8000); // reads a value from RAM[8000] + do Main.convert(value); // performs the conversion + return; + } + + /** Converts the given decimal value to binary, and puts + * the resulting bits in RAM[8001]..RAM[8016]. */ + function void convert(int value) { + var int mask, position; + var boolean loop; + + let loop = true; + while (loop) { + let position = position + 1; + let mask = Main.nextMask(mask); + + if (~(position > 16)) { + + if (~((value & mask) = 0)) { + do Memory.poke(8000 + position, 1); + } + else { + do Memory.poke(8000 + position, 0); + } + } + else { + let loop = false; + } + } + return; + } + + /** Returns the next mask (the mask that should follow the given mask). */ + function int nextMask(int mask) { + if (mask = 0) { + return 1; + } + else { + return mask * 2; + } + } + + /** Fills 'length' consecutive memory locations with 'value', + * starting at 'startAddress'. */ + function void fillMemory(int startAddress, int length, int value) { + while (length > 0) { + do Memory.poke(startAddress, value); + let length = length - 1; + let startAddress = startAddress + 1; + } + return; + } +} diff --git a/projects/11/Pong/Ball.jack b/projects/11/Pong/Ball.jack new file mode 100644 index 0000000..02e47f9 --- /dev/null +++ b/projects/11/Pong/Ball.jack @@ -0,0 +1,203 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/11/Pong/Ball.jack + +/** + * A graphical ball. Characterized by a screen location and distance of + * last destination. Has methods for drawing, erasing and moving on the screen. + * The ball is displayed as a filled, 6-by-6 pixles rectangle. + */ +class Ball { + + field int x, y; // the ball's screen location (in pixels) + field int lengthx, lengthy; // distance of last destination (in pixels) + + field int d, straightD, diagonalD; // used for straight line movement computation + field boolean invert, positivex, positivey; // (same) + + field int leftWall, rightWall, topWall, bottomWall; // wall locations + + field int wall; // last wall that the ball was bounced off of + + /** Constructs a new ball with the given initial location and wall locations. */ + constructor Ball new(int Ax, int Ay, + int AleftWall, int ArightWall, int AtopWall, int AbottomWall) { + let x = Ax; + let y = Ay; + let leftWall = AleftWall; + let rightWall = ArightWall - 6; // -6 for ball size + let topWall = AtopWall; + let bottomWall = AbottomWall - 6; // -6 for ball size + let wall = 0; + do show(); + return this; + } + + /** Deallocates the Ball's memory. */ + method void dispose() { + do Memory.deAlloc(this); + return; + } + + /** Shows the ball. */ + method void show() { + do Screen.setColor(true); + do draw(); + return; + } + + /** Hides the ball. */ + method void hide() { + do Screen.setColor(false); + do draw(); + return; + } + + /** Draws the ball. */ + method void draw() { + do Screen.drawRectangle(x, y, x + 5, y + 5); + return; + } + + /** Returns the ball's left edge. */ + method int getLeft() { + return x; + } + + /** Returns the ball's right edge. */ + method int getRight() { + return x + 5; + } + + /** Computes and sets the ball's destination. */ + method void setDestination(int destx, int desty) { + var int dx, dy, temp; + let lengthx = destx - x; + let lengthy = desty - y; + let dx = Math.abs(lengthx); + let dy = Math.abs(lengthy); + let invert = (dx < dy); + + if (invert) { + let temp = dx; // swap dx, dy + let dx = dy; + let dy = temp; + let positivex = (y < desty); + let positivey = (x < destx); + } + else { + let positivex = (x < destx); + let positivey = (y < desty); + } + + let d = (2 * dy) - dx; + let straightD = 2 * dy; + let diagonalD = 2 * (dy - dx); + + return; + } + + /** + * Moves the ball one unit towards its destination. + * If the ball has reached a wall, returns 0. + * Else, returns a value according to the wall: + * 1 (left wall), 2 (right wall), 3 (top wall), 4 (bottom wall). + */ + method int move() { + + do hide(); + + if (d < 0) { let d = d + straightD; } + else { + let d = d + diagonalD; + + if (positivey) { + if (invert) { let x = x + 4; } + else { let y = y + 4; } + } + else { + if (invert) { let x = x - 4; } + else { let y = y - 4; } + } + } + + if (positivex) { + if (invert) { let y = y + 4; } + else { let x = x + 4; } + } + else { + if (invert) { let y = y - 4; } + else { let x = x - 4; } + } + + if (~(x > leftWall)) { + let wall = 1; + let x = leftWall; + } + if (~(x < rightWall)) { + let wall = 2; + let x = rightWall; + } + if (~(y > topWall)) { + let wall = 3; + let y = topWall; + } + if (~(y < bottomWall)) { + let wall = 4; + let y = bottomWall; + } + + do show(); + + return wall; + } + + /** + * Bounces off the current wall: sets the new destination + * of the ball according to the ball's angle and the given + * bouncing direction (-1/0/1=left/center/right or up/center/down). + */ + method void bounce(int bouncingDirection) { + var int newx, newy, divLengthx, divLengthy, factor; + + // dividing by 10 first since results are too big + let divLengthx = lengthx / 10; + let divLengthy = lengthy / 10; + if (bouncingDirection = 0) { let factor = 10; } + else { + if (((~(lengthx < 0)) & (bouncingDirection = 1)) | ((lengthx < 0) & (bouncingDirection = (-1)))) { + let factor = 20; // bounce direction is in ball direction + } + else { let factor = 5; } // bounce direction is against ball direction + } + + if (wall = 1) { + let newx = 506; + let newy = (divLengthy * (-50)) / divLengthx; + let newy = y + (newy * factor); + } + else { + if (wall = 2) { + let newx = 0; + let newy = (divLengthy * 50) / divLengthx; + let newy = y + (newy * factor); + } + else { + if (wall = 3) { + let newy = 250; + let newx = (divLengthx * (-25)) / divLengthy; + let newx = x + (newx * factor); + } + else { // assumes wall = 4 + let newy = 0; + let newx = (divLengthx * 25) / divLengthy; + let newx = x + (newx * factor); + } + } + } + + do setDestination(newx, newy); + return; + } +} diff --git a/projects/11/Pong/Bat.jack b/projects/11/Pong/Bat.jack new file mode 100644 index 0000000..340760f --- /dev/null +++ b/projects/11/Pong/Bat.jack @@ -0,0 +1,103 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/11/Pong/Bat.jack + +/** + * A graphical Pong bat. + * Displayed as a filled horizontal rectangle that has + * a screen location, a width and a height. + * Has methods for drawing, erasing, moving left and right, + * and changing its width (to make the hitting action more challenging). + * This class should have been called "paddle", following the + * standard Pong terminology. But, unaware of this terminology, + * we called it "bat", and then decided to stick to it. + */ +class Bat { + + field int x, y; // the bat's screen location + field int width, height; // the bat's width and height + field int direction; // direction of the bat's movement (1 = left, 2 = right) + + /** Constructs a new bat with the given location and width. */ + constructor Bat new(int Ax, int Ay, int Awidth, int Aheight) { + let x = Ax; + let y = Ay; + let width = Awidth; + let height = Aheight; + let direction = 2; + do show(); + return this; + } + + /** Deallocates the object's memory. */ + method void dispose() { + do Memory.deAlloc(this); + return; + } + + /** Shows the bat. */ + method void show() { + do Screen.setColor(true); + do draw(); + return; + } + + /** Hides the bat. */ + method void hide() { + do Screen.setColor(false); + do draw(); + return; + } + + /** Draws the bat. */ + method void draw() { + do Screen.drawRectangle(x, y, x + width, y + height); + return; + } + + /** Sets the bat's direction (0=stop, 1=left, 2=right). */ + method void setDirection(int Adirection) { + let direction = Adirection; + return; + } + + /** Returns the bat's left edge. */ + method int getLeft() { + return x; + } + + /** Returns the bat's right edge. */ + method int getRight() { + return x + width; + } + + /** Sets the bat's width. */ + method void setWidth(int Awidth) { + do hide(); + let width = Awidth; + do show(); + return; + } + + /** Moves the bat one step in the bat's direction. */ + method void move() { + if (direction = 1) { + let x = x - 4; + if (x < 0) { let x = 0; } + do Screen.setColor(false); + do Screen.drawRectangle((x + width) + 1, y, (x + width) + 4, y + height); + do Screen.setColor(true); + do Screen.drawRectangle(x, y, x + 3, y + height); + } + else { + let x = x + 4; + if ((x + width) > 511) { let x = 511 - width; } + do Screen.setColor(false); + do Screen.drawRectangle(x - 4, y, x - 1, y + height); + do Screen.setColor(true); + do Screen.drawRectangle((x + width) - 3, y, x + width, y + height); + } + return; + } +} diff --git a/projects/11/Pong/Main.jack b/projects/11/Pong/Main.jack new file mode 100644 index 0000000..45e2dd2 --- /dev/null +++ b/projects/11/Pong/Main.jack @@ -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: projects/11/Pong/Main.jack + +/** + * The main class of the Pong game. + */ +class Main { + + /** Initializes a Pong game and starts running it. */ + function void main() { + var PongGame game; + do PongGame.newInstance(); + let game = PongGame.getInstance(); + do game.run(); + do game.dispose(); + return; + } +} diff --git a/projects/11/Pong/PongGame.jack b/projects/11/Pong/PongGame.jack new file mode 100644 index 0000000..7e1ae4c --- /dev/null +++ b/projects/11/Pong/PongGame.jack @@ -0,0 +1,137 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/11/Pong/PongGame.jack + +/** + * Represents a Pong game. + */ +class PongGame { + + static PongGame instance; // the singelton, a Pong game instance + field Bat bat; // the bat + field Ball ball; // the ball + field int wall; // the current wall that the ball is bouncing off of. + field boolean exit; // true when the game is over + field int score; // the current score. + field int lastWall; // the last wall that the ball bounced off of. + + // The current width of the bat + field int batWidth; + + /** Constructs a new Pong game. */ + constructor PongGame new() { + do Screen.clearScreen(); + let batWidth = 50; // initial bat size + let bat = Bat.new(230, 229, batWidth, 7); + let ball = Ball.new(253, 222, 0, 511, 0, 229); + do ball.setDestination(400,0); + do Screen.drawRectangle(0, 238, 511, 240); + do Output.moveCursor(22,0); + do Output.printString("Score: 0"); + + let exit = false; + let score = 0; + let wall = 0; + let lastWall = 0; + + return this; + } + + /** Deallocates the object's memory. */ + method void dispose() { + do bat.dispose(); + do ball.dispose(); + do Memory.deAlloc(this); + return; + } + + /** Creates an instance of Pong game, and stores it. */ + function void newInstance() { + let instance = PongGame.new(); + return; + } + + /** Returns the single instance of this Pong game. */ + function PongGame getInstance() { + return instance; + } + + /** Starts the game, and andles inputs from the user that control + * the bat's movement direction. */ + method void run() { + var char key; + + while (~exit) { + // waits for a key to be pressed. + while ((key = 0) & (~exit)) { + let key = Keyboard.keyPressed(); + do bat.move(); + do moveBall(); + do Sys.wait(50); + } + + if (key = 130) { do bat.setDirection(1); } + else { + if (key = 132) { do bat.setDirection(2); } + else { + if (key = 140) { let exit = true; } + } + } + + // Waits for the key to be released. + while ((~(key = 0)) & (~exit)) { + let key = Keyboard.keyPressed(); + do bat.move(); + do moveBall(); + do Sys.wait(50); + } + } + + if (exit) { + do Output.moveCursor(10,27); + do Output.printString("Game Over"); + } + + return; + } + + /** + * Handles ball movement, including bouncing. + * If the ball bounces off a wall, finds its new direction. + * If the ball bounces off the bat, increases the score by one + * and shrinks the bat's size, to make the game more challenging. + */ + method void moveBall() { + var int bouncingDirection, batLeft, batRight, ballLeft, ballRight; + + let wall = ball.move(); + + if ((wall > 0) & (~(wall = lastWall))) { + let lastWall = wall; + let bouncingDirection = 0; + let batLeft = bat.getLeft(); + let batRight = bat.getRight(); + let ballLeft = ball.getLeft(); + let ballRight = ball.getRight(); + + if (wall = 4) { + let exit = (batLeft > ballRight) | (batRight < ballLeft); + if (~exit) { + if (ballRight < (batLeft + 10)) { let bouncingDirection = -1; } + else { + if (ballLeft > (batRight - 10)) { let bouncingDirection = 1; } + } + + let batWidth = batWidth - 2; + do bat.setWidth(batWidth); + let score = score + 1; + do Output.moveCursor(22,7); + do Output.printInt(score); + } + } + do ball.bounce(bouncingDirection); + } + return; + } +} \ No newline at end of file diff --git a/projects/11/Seven/Main.jack b/projects/11/Seven/Main.jack new file mode 100644 index 0000000..067402e --- /dev/null +++ b/projects/11/Seven/Main.jack @@ -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: projects/11/Seven/Main.jack + +/** + * Computes the value of 1 + (2 * 3) and prints the result + * at the top-left of the screen. + */ +class Main { + + function void main() { + do Output.printInt(1 + (2 * 3)); + return; + } + +} diff --git a/projects/11/Square/Main.jack b/projects/11/Square/Main.jack new file mode 100644 index 0000000..0753893 --- /dev/null +++ b/projects/11/Square/Main.jack @@ -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: projects/11/Square/Main.jack + +// (same as projects/09/Square/Main.jack) + +/** Initializes a new Square Dance game and starts running it. */ +class Main { + function void main() { + var SquareGame game; + let game = SquareGame.new(); + do game.run(); + do game.dispose(); + return; + } +} diff --git a/projects/11/Square/Square.jack b/projects/11/Square/Square.jack new file mode 100644 index 0000000..5a92838 --- /dev/null +++ b/projects/11/Square/Square.jack @@ -0,0 +1,110 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/11/Square/Square.jack + +// (same as projects/09/Square/Square.jack) + +/** Implements a graphical square. */ +class Square { + + field int x, y; // screen location of the square's top-left corner + field int size; // length of this square, in pixels + + /** Constructs a new square with a given location and size. */ + constructor Square new(int Ax, int Ay, int Asize) { + let x = Ax; + let y = Ay; + let size = Asize; + do draw(); + return this; + } + + /** Disposes this square. */ + method void dispose() { + do Memory.deAlloc(this); + return; + } + + /** Draws the square on the screen. */ + method void draw() { + do Screen.setColor(true); + do Screen.drawRectangle(x, y, x + size, y + size); + return; + } + + /** Erases the square from the screen. */ + method void erase() { + do Screen.setColor(false); + do Screen.drawRectangle(x, y, x + size, y + size); + return; + } + + /** Increments the square size by 2 pixels. */ + method void incSize() { + if (((y + size) < 254) & ((x + size) < 510)) { + do erase(); + let size = size + 2; + do draw(); + } + return; + } + + /** Decrements the square size by 2 pixels. */ + method void decSize() { + if (size > 2) { + do erase(); + let size = size - 2; + do draw(); + } + return; + } + + /** Moves the square up by 2 pixels. */ + method void moveUp() { + if (y > 1) { + do Screen.setColor(false); + do Screen.drawRectangle(x, (y + size) - 1, x + size, y + size); + let y = y - 2; + do Screen.setColor(true); + do Screen.drawRectangle(x, y, x + size, y + 1); + } + return; + } + + /** Moves the square down by 2 pixels. */ + method void moveDown() { + if ((y + size) < 254) { + do Screen.setColor(false); + do Screen.drawRectangle(x, y, x + size, y + 1); + let y = y + 2; + do Screen.setColor(true); + do Screen.drawRectangle(x, (y + size) - 1, x + size, y + size); + } + return; + } + + /** Moves the square left by 2 pixels. */ + method void moveLeft() { + if (x > 1) { + do Screen.setColor(false); + do Screen.drawRectangle((x + size) - 1, y, x + size, y + size); + let x = x - 2; + do Screen.setColor(true); + do Screen.drawRectangle(x, y, x + 1, y + size); + } + return; + } + + /** Moves the square right by 2 pixels. */ + method void moveRight() { + if ((x + size) < 510) { + do Screen.setColor(false); + do Screen.drawRectangle(x, y, x + 1, y + size); + let x = x + 2; + do Screen.setColor(true); + do Screen.drawRectangle((x + size) - 1, y, x + size, y + size); + } + return; + } +} diff --git a/projects/11/Square/SquareGame.jack b/projects/11/Square/SquareGame.jack new file mode 100644 index 0000000..4fe7e39 --- /dev/null +++ b/projects/11/Square/SquareGame.jack @@ -0,0 +1,81 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/11/Square/SquareGame.jack + +// (same as projects/09/Square/SquareGame.jack) + +/** + * Implements the Square Dance game. + * This simple game allows the user to move a black square around + * the screen, and change the square's size during the movement. + * When the game starts, a square of 30 by 30 pixels is shown at the + * top-left corner of the screen. The user controls the square as follows. + * The 4 arrow keys are used to move the square up, down, left, and right. + * The 'z' and 'x' keys are used, respectively, to decrement and increment + * the square's size. The 'q' key is used to quit the game. + */ + +class SquareGame { + field Square square; // the square of this game + field int direction; // the square's current direction: + // 0=none, 1=up, 2=down, 3=left, 4=right + + /** Constructs a new Square Game. */ + constructor SquareGame new() { + // Creates a 30 by 30 pixels square and positions it at the top-left + // of the screen. + let square = Square.new(0, 0, 30); + let direction = 0; // initial state is no movement + return this; + } + + /** Disposes this game. */ + method void dispose() { + do square.dispose(); + do Memory.deAlloc(this); + return; + } + + /** Moves the square in the current direction. */ + method void moveSquare() { + if (direction = 1) { do square.moveUp(); } + if (direction = 2) { do square.moveDown(); } + if (direction = 3) { do square.moveLeft(); } + if (direction = 4) { do square.moveRight(); } + do Sys.wait(5); // delays the next movement + return; + } + + /** Runs the game: handles the user's inputs and moves the square accordingly */ + method void run() { + var char key; // the key currently pressed by the user + var boolean exit; + let exit = false; + + while (~exit) { + // waits for a key to be pressed + while (key = 0) { + let key = Keyboard.keyPressed(); + do moveSquare(); + } + if (key = 81) { let exit = true; } // q key + if (key = 90) { do square.decSize(); } // z key + if (key = 88) { do square.incSize(); } // x key + if (key = 131) { let direction = 1; } // up arrow + if (key = 133) { let direction = 2; } // down arrow + if (key = 130) { let direction = 3; } // left arrow + if (key = 132) { let direction = 4; } // right arrow + + // waits for the key to be released + while (~(key = 0)) { + let key = Keyboard.keyPressed(); + do moveSquare(); + } + } // while + return; + } +} + + + diff --git a/projects/12/Array.jack b/projects/12/Array.jack new file mode 100644 index 0000000..ee31129 --- /dev/null +++ b/projects/12/Array.jack @@ -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: projects/12/Array.jack + +/** + * Represents an array. + * In the Jack language, arrays are instances of the Array class. + * Once declared, the array entries can be accessed using the usual + * syntax arr[i]. Each array entry can hold a primitive data type as + * well as any object type. Different array entries can have different + * data types. + */ +class Array { + + /** Constructs a new Array of the given size. */ + function Array new(int size) { + } + + /** Disposes this array. */ + method void dispose() { + } +} diff --git a/projects/12/ArrayTest/ArrayTest.cmp b/projects/12/ArrayTest/ArrayTest.cmp new file mode 100644 index 0000000..d1a9798 --- /dev/null +++ b/projects/12/ArrayTest/ArrayTest.cmp @@ -0,0 +1,2 @@ +|RAM[8000]|RAM[8001]|RAM[8002]|RAM[8003]| +| 222 | 122 | 100 | 10 | diff --git a/projects/12/ArrayTest/ArrayTest.tst b/projects/12/ArrayTest/ArrayTest.tst new file mode 100644 index 0000000..89934b9 --- /dev/null +++ b/projects/12/ArrayTest/ArrayTest.tst @@ -0,0 +1,15 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/ArrayTest/ArrayTest.tst + +load, +output-file ArrayTest.out, +compare-to ArrayTest.cmp, +output-list RAM[8000]%D2.6.1 RAM[8001]%D2.6.1 RAM[8002]%D2.6.1 RAM[8003]%D2.6.1; + +repeat 1000000 { + vmstep; +} + +output; diff --git a/projects/12/ArrayTest/Main.jack b/projects/12/ArrayTest/Main.jack new file mode 100644 index 0000000..439770a --- /dev/null +++ b/projects/12/ArrayTest/Main.jack @@ -0,0 +1,40 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/ArrayTest/Main.jack + +/** Test program for the OS Array class. */ +class Main { + + /** Performs several Array manipulations. */ + function void main() { + var Array r; // stores test results + var Array a, b, c; + + let r = 8000; + + let a = Array.new(3); + let a[2] = 222; + let r[0] = a[2]; // RAM[8000] = 222 + + let b = Array.new(3); + let b[1] = a[2] - 100; + let r[1] = b[1]; // RAM[8001] = 122 + + let c = Array.new(500); + let c[499] = a[2] - b[1]; + let r[2] = c[499]; // RAM[8002] = 100 + + do a.dispose(); + do b.dispose(); + + let b = Array.new(3); + let b[0] = c[499] - 90; + let r[3] = b[0]; // RAM[8003] = 10 + + do c.dispose(); + do b.dispose(); + + return; + } +} diff --git a/projects/12/Keyboard.jack b/projects/12/Keyboard.jack new file mode 100644 index 0000000..03e1031 --- /dev/null +++ b/projects/12/Keyboard.jack @@ -0,0 +1,62 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/Keyboard.jack + +/** + * A library for handling user input from the keyboard. + */ +class Keyboard { + + /** Initializes the keyboard. */ + function void init() { + } + + /** + * Returns the character of the currently pressed key on the keyboard; + * if no key is currently pressed, returns 0. + * + * Recognizes all ASCII characters, as well as the following keys: + * new line = 128 = String.newline() + * backspace = 129 = String.backspace() + * left arrow = 130 + * up arrow = 131 + * right arrow = 132 + * down arrow = 133 + * home = 134 + * End = 135 + * page up = 136 + * page down = 137 + * insert = 138 + * delete = 139 + * ESC = 140 + * F1 - F12 = 141 - 152 + */ + function char keyPressed() { + } + + /** + * Waits until a key is pressed on the keyboard and released, + * then echoes the key to the screen, and returns the character + * of the pressed key. + */ + function char readChar() { + } + + /** + * Displays the message on the screen, reads from the keyboard the entered + * text until a newline character is detected, echoes the text to the screen, + * and returns its value. Also handles user backspaces. + */ + function String readLine(String message) { + } + + /** + * Displays the message on the screen, reads from the keyboard the entered + * text until a newline character is detected, echoes the text to the screen, + * and returns its integer value (until the first non-digit character in the + * entered text is detected). Also handles user backspaces. + */ + function int readInt(String message) { + } +} diff --git a/projects/12/KeyboardTest/KeyboardTestOutput.gif b/projects/12/KeyboardTest/KeyboardTestOutput.gif new file mode 100644 index 0000000..944983a Binary files /dev/null and b/projects/12/KeyboardTest/KeyboardTestOutput.gif differ diff --git a/projects/12/KeyboardTest/Main.jack b/projects/12/KeyboardTest/Main.jack new file mode 100644 index 0000000..e89182c --- /dev/null +++ b/projects/12/KeyboardTest/Main.jack @@ -0,0 +1,93 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/KeyboardTest/Main.jack + +/** Test program for the OS Keyboard class. */ +class Main { + + /** Gets input from the user and verifies its contents. */ + function void main() { + var char c, key; + var String s; + var int i; + var boolean ok; + + let ok = false; + do Output.printString("keyPressed test:"); + do Output.println(); + while (~ok) { + do Output.printString("Please press the 'Page Down' key"); + while (key = 0) { + let key = Keyboard.keyPressed(); + } + let c = key; + while (~(key = 0)) { + let key = Keyboard.keyPressed(); + } + + do Output.println(); + + if (c = 137) { + do Output.printString("ok"); + do Output.println(); + let ok = true; + } + } + + let ok = false; + do Output.printString("readChar test:"); + do Output.println(); + do Output.printString("(Verify that the pressed character is echoed to the screen)"); + do Output.println(); + while (~ok) { + do Output.printString("Please press the number '3': "); + let c = Keyboard.readChar(); + + do Output.println(); + + if (c = 51) { + do Output.printString("ok"); + do Output.println(); + let ok = true; + } + } + + let ok = false; + do Output.printString("readLine test:"); + do Output.println(); + do Output.printString("(Verify echo and usage of 'backspace')"); + do Output.println(); + while (~ok) { + let s = Keyboard.readLine("Please type 'JACK' and press enter: "); + + if (s.length() = 4) { + if ((s.charAt(0) = 74) & (s.charAt(1) = 65) & (s.charAt(2) = 67) & (s.charAt(3) = 75)) { + do Output.printString("ok"); + do Output.println(); + let ok = true; + } + } + } + + let ok = false; + do Output.printString("readInt test:"); + do Output.println(); + do Output.printString("(Verify echo and usage of 'backspace')"); + do Output.println(); + while (~ok) { + let i = Keyboard.readInt("Please type '-32123' and press enter: "); + + if (i = (-32123)) { + do Output.printString("ok"); + do Output.println(); + let ok = true; + } + } + + do Output.println(); + do Output.printString("Test completed successfully"); + + return; + } +} diff --git a/projects/12/Math.jack b/projects/12/Math.jack new file mode 100644 index 0000000..a57f023 --- /dev/null +++ b/projects/12/Math.jack @@ -0,0 +1,47 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/Math.jack + +/** + * A library of commonly used mathematical functions. + * Note: Jack compilers implement multiplication and division using OS method calls. + */ +class Math { + + /** Initializes the library. */ + function void init() { + } + + /** Returns the absolute value of x. */ + function int abs(int x) { + } + + /** Returns the product of x and y. + * When a Jack compiler detects the multiplication operator '*' in the + * program's code, it handles it by invoking this method. In other words, + * the Jack expressions x*y and multiply(x,y) return the same value. + */ + function int multiply(int x, int y) { + } + + /** Returns the integer part of x/y. + * When a Jack compiler detects the multiplication operator '/' in the + * program's code, it handles it by invoking this method. In other words, + * the Jack expressions x/y and divide(x,y) return the same value. + */ + function int divide(int x, int y) { + } + + /** Returns the integer part of the square root of x. */ + function int sqrt(int x) { + } + + /** Returns the greater number. */ + function int max(int a, int b) { + } + + /** Returns the smaller number. */ + function int min(int a, int b) { + } +} diff --git a/projects/12/MathTest/Main.jack b/projects/12/MathTest/Main.jack new file mode 100644 index 0000000..de5cec2 --- /dev/null +++ b/projects/12/MathTest/Main.jack @@ -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: projects/12/MathTest/Main.jack + +/** Test program for the OS Math class. */ +class Main { + + /** Performs various mathematical operations, using calls to the Math class methods. */ + function void main() { + var Array r; // stores the test results; + + let r = 8000; + + let r[0] = 2 * 3; // 6 + let r[1] = r[0] * (-30); // 6 * (-30) = -180 + let r[2] = r[1] * 100; // (-180) * 100 = -18000 + let r[3] = 1 * r[2]; // 1 * (-18000) = -18000 + let r[4] = r[3] * 0; // 0 + + let r[5] = 9 / 3; // 3 + let r[6] = (-18000) / 6; // -3000 + let r[7] = 32766 / (-32767); // 0 + + let r[8] = Math.sqrt(9); // 3 + let r[9] = Math.sqrt(32767); // 181 + + let r[10] = Math.min(345, 123); // 123 + let r[11] = Math.max(123, -345); // 123 + let r[12] = Math.abs(27); // 27 + let r[13] = Math.abs(-32767); // 32767 + + return; + } +} diff --git a/projects/12/MathTest/MathTest.cmp b/projects/12/MathTest/MathTest.cmp new file mode 100644 index 0000000..703c1be --- /dev/null +++ b/projects/12/MathTest/MathTest.cmp @@ -0,0 +1,2 @@ +|RAM[8000]|RAM[8001]|RAM[8002]|RAM[8003]|RAM[8004]|RAM[8005]|RAM[8006]|RAM[8007]|RAM[8008]|RAM[8009]|RAM[8010]|RAM[8011]|RAM[8012]|RAM[8013]| +| 6 | -180 | -18000 | -18000 | 0 | 3 | -3000 | 0 | 3 | 181 | 123 | 123 | 27 | 32767 | diff --git a/projects/12/MathTest/MathTest.tst b/projects/12/MathTest/MathTest.tst new file mode 100644 index 0000000..127dbb4 --- /dev/null +++ b/projects/12/MathTest/MathTest.tst @@ -0,0 +1,15 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/MathTest/MathTest.tst + +load, +output-file MathTest.out, +compare-to MathTest.cmp, +output-list RAM[8000]%D2.6.1 RAM[8001]%D2.6.1 RAM[8002]%D2.6.1 RAM[8003]%D2.6.1 RAM[8004]%D2.6.1 RAM[8005]%D2.6.1 RAM[8006]%D2.6.1 RAM[8007]%D2.6.1 RAM[8008]%D2.6.1 RAM[8009]%D2.6.1 RAM[8010]%D2.6.1 RAM[8011]%D2.6.1 RAM[8012]%D2.6.1 RAM[8013]%D2.6.1; + +repeat 1000000 { + vmstep; +} + +output; diff --git a/projects/12/Memory.jack b/projects/12/Memory.jack new file mode 100644 index 0000000..941eec1 --- /dev/null +++ b/projects/12/Memory.jack @@ -0,0 +1,34 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/Memory.jack + +/** + * This library provides two services: direct access to the computer's main + * memory (RAM), and allocation and recycling of memory blocks. The Hack RAM + * consists of 32,768 words, each holding a 16-bit binary number. + */ +class Memory { + + /** Initializes the class. */ + function void init() { + } + + /** Returns the RAM value at the given address. */ + function int peek(int address) { + } + + /** Sets the RAM value at the given address to the given value. */ + function void poke(int address, int value) { + } + + /** Finds an available RAM block of the given size and returns + * a reference to its base address. */ + function int alloc(int size) { + } + + /** De-allocates the given object (cast as an array) by making + * it available for future allocations. */ + function void deAlloc(Array o) { + } +} diff --git a/projects/12/MemoryTest/Main.jack b/projects/12/MemoryTest/Main.jack new file mode 100644 index 0000000..77a53a9 --- /dev/null +++ b/projects/12/MemoryTest/Main.jack @@ -0,0 +1,42 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/MemoryTest/Main.jack + +/** Test program for the OS Memory class. */ +class Main { + + /** Performs various memory manipulations. */ + function void main() { + var int temp; + var Array a, b, c; + + do Memory.poke(8000, 333); // RAM[8000] = 333 + let temp = Memory.peek(8000); + do Memory.poke(8001, temp + 1); // RAM[8001] = 334 + + let a = Array.new(3); // uses Memory.alloc + let a[2] = 222; + do Memory.poke(8002, a[2]); // RAM[8002] = 222 + + let b = Array.new(3); + let b[1] = a[2] - 100; + do Memory.poke(8003, b[1]); // RAM[8003] = 122 + + let c = Array.new(500); + let c[499] = a[2] - b[1]; + do Memory.poke(8004, c[499]); // RAM[8004] = 100 + + do a.dispose(); // uses Memory.deAlloc + do b.dispose(); + + let b = Array.new(3); + let b[0] = c[499] - 90; + do Memory.poke(8005, b[0]); // RAM[8005] = 10 + + do c.dispose(); + do b.dispose(); + + return; + } +} diff --git a/projects/12/MemoryTest/MemoryTest.cmp b/projects/12/MemoryTest/MemoryTest.cmp new file mode 100644 index 0000000..057958b --- /dev/null +++ b/projects/12/MemoryTest/MemoryTest.cmp @@ -0,0 +1,2 @@ +|RAM[8000]|RAM[8001]|RAM[8002]|RAM[8003]|RAM[8004]|RAM[8005]| +| 333 | 334 | 222 | 122 | 100 | 10 | diff --git a/projects/12/MemoryTest/MemoryTest.tst b/projects/12/MemoryTest/MemoryTest.tst new file mode 100644 index 0000000..1da34fd --- /dev/null +++ b/projects/12/MemoryTest/MemoryTest.tst @@ -0,0 +1,15 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/MemoryTest/MemoryTest.tst + +load, +output-file MemoryTest.out, +compare-to MemoryTest.cmp, +output-list RAM[8000]%D2.6.1 RAM[8001]%D2.6.1 RAM[8002]%D2.6.1 RAM[8003]%D2.6.1 RAM[8004]%D2.6.1 RAM[8005]%D2.6.1; + +repeat 1000000 { + vmstep; +} + +output; diff --git a/projects/12/Output.jack b/projects/12/Output.jack new file mode 100644 index 0000000..18e3382 --- /dev/null +++ b/projects/12/Output.jack @@ -0,0 +1,203 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/Output.jack + +/** + * A library of functions for writing text on the screen. + * The Hack physical screen consists of 512 rows of 256 pixels each. + * The library uses a fixed font, in which each character is displayed + * within a frame which is 11 pixels high (including 1 pixel for inter-line + * spacing) and 8 pixels wide (including 2 pixels for inter-character spacing). + * The resulting grid accommodates 23 rows (indexed 0..22, top to bottom) + * of 64 characters each (indexed 0..63, left to right). The top left + * character position on the screen is indexed (0,0). A cursor, implemented + * as a small filled square, indicates where the next character will be displayed. + */ +class Output { + + // Character map for displaying characters + static Array charMaps; + + /** Initializes the screen, and locates the cursor at the screen's top-left. */ + function void init() { + } + + // Initializes the character map array + function void initMap() { + var int i; + + let charMaps = Array.new(127); + + // Black square, used for displaying non-printable characters. + do Output.create(0,63,63,63,63,63,63,63,63,63,0,0); + + // Assigns the bitmap for each character in the charachter set. + // The first parameter is the character index, the next 11 numbers + // are the values of each row in the frame that represents this character. + do Output.create(32,0,0,0,0,0,0,0,0,0,0,0); // + do Output.create(33,12,30,30,30,12,12,0,12,12,0,0); // ! + do Output.create(34,54,54,20,0,0,0,0,0,0,0,0); // " + do Output.create(35,0,18,18,63,18,18,63,18,18,0,0); // # + do Output.create(36,12,30,51,3,30,48,51,30,12,12,0); // $ + do Output.create(37,0,0,35,51,24,12,6,51,49,0,0); // % + do Output.create(38,12,30,30,12,54,27,27,27,54,0,0); // & + do Output.create(39,12,12,6,0,0,0,0,0,0,0,0); // ' + do Output.create(40,24,12,6,6,6,6,6,12,24,0,0); // ( + do Output.create(41,6,12,24,24,24,24,24,12,6,0,0); // ) + do Output.create(42,0,0,0,51,30,63,30,51,0,0,0); // * + do Output.create(43,0,0,0,12,12,63,12,12,0,0,0); // + + do Output.create(44,0,0,0,0,0,0,0,12,12,6,0); // , + do Output.create(45,0,0,0,0,0,63,0,0,0,0,0); // - + do Output.create(46,0,0,0,0,0,0,0,12,12,0,0); // . + do Output.create(47,0,0,32,48,24,12,6,3,1,0,0); // / + + do Output.create(48,12,30,51,51,51,51,51,30,12,0,0); // 0 + do Output.create(49,12,14,15,12,12,12,12,12,63,0,0); // 1 + do Output.create(50,30,51,48,24,12,6,3,51,63,0,0); // 2 + do Output.create(51,30,51,48,48,28,48,48,51,30,0,0); // 3 + do Output.create(52,16,24,28,26,25,63,24,24,60,0,0); // 4 + do Output.create(53,63,3,3,31,48,48,48,51,30,0,0); // 5 + do Output.create(54,28,6,3,3,31,51,51,51,30,0,0); // 6 + do Output.create(55,63,49,48,48,24,12,12,12,12,0,0); // 7 + do Output.create(56,30,51,51,51,30,51,51,51,30,0,0); // 8 + do Output.create(57,30,51,51,51,62,48,48,24,14,0,0); // 9 + + do Output.create(58,0,0,12,12,0,0,12,12,0,0,0); // : + do Output.create(59,0,0,12,12,0,0,12,12,6,0,0); // ; + do Output.create(60,0,0,24,12,6,3,6,12,24,0,0); // < + do Output.create(61,0,0,0,63,0,0,63,0,0,0,0); // = + do Output.create(62,0,0,3,6,12,24,12,6,3,0,0); // > + do Output.create(64,30,51,51,59,59,59,27,3,30,0,0); // @ + do Output.create(63,30,51,51,24,12,12,0,12,12,0,0); // ? + + do Output.create(65,0,0,0,0,0,0,0,0,0,0,0); // A ** TO BE FILLED ** + do Output.create(66,31,51,51,51,31,51,51,51,31,0,0); // B + do Output.create(67,28,54,35,3,3,3,35,54,28,0,0); // C + do Output.create(68,15,27,51,51,51,51,51,27,15,0,0); // D + do Output.create(69,63,51,35,11,15,11,35,51,63,0,0); // E + do Output.create(70,63,51,35,11,15,11,3,3,3,0,0); // F + do Output.create(71,28,54,35,3,59,51,51,54,44,0,0); // G + do Output.create(72,51,51,51,51,63,51,51,51,51,0,0); // H + do Output.create(73,30,12,12,12,12,12,12,12,30,0,0); // I + do Output.create(74,60,24,24,24,24,24,27,27,14,0,0); // J + do Output.create(75,51,51,51,27,15,27,51,51,51,0,0); // K + do Output.create(76,3,3,3,3,3,3,35,51,63,0,0); // L + do Output.create(77,33,51,63,63,51,51,51,51,51,0,0); // M + do Output.create(78,51,51,55,55,63,59,59,51,51,0,0); // N + do Output.create(79,30,51,51,51,51,51,51,51,30,0,0); // O + do Output.create(80,31,51,51,51,31,3,3,3,3,0,0); // P + do Output.create(81,30,51,51,51,51,51,63,59,30,48,0);// Q + do Output.create(82,31,51,51,51,31,27,51,51,51,0,0); // R + do Output.create(83,30,51,51,6,28,48,51,51,30,0,0); // S + do Output.create(84,63,63,45,12,12,12,12,12,30,0,0); // T + do Output.create(85,51,51,51,51,51,51,51,51,30,0,0); // U + do Output.create(86,51,51,51,51,51,30,30,12,12,0,0); // V + do Output.create(87,51,51,51,51,51,63,63,63,18,0,0); // W + do Output.create(88,51,51,30,30,12,30,30,51,51,0,0); // X + do Output.create(89,51,51,51,51,30,12,12,12,30,0,0); // Y + do Output.create(90,63,51,49,24,12,6,35,51,63,0,0); // Z + + do Output.create(91,30,6,6,6,6,6,6,6,30,0,0); // [ + do Output.create(92,0,0,1,3,6,12,24,48,32,0,0); // \ + do Output.create(93,30,24,24,24,24,24,24,24,30,0,0); // ] + do Output.create(94,8,28,54,0,0,0,0,0,0,0,0); // ^ + do Output.create(95,0,0,0,0,0,0,0,0,0,63,0); // _ + do Output.create(96,6,12,24,0,0,0,0,0,0,0,0); // ` + + do Output.create(97,0,0,0,14,24,30,27,27,54,0,0); // a + do Output.create(98,3,3,3,15,27,51,51,51,30,0,0); // b + do Output.create(99,0,0,0,30,51,3,3,51,30,0,0); // c + do Output.create(100,48,48,48,60,54,51,51,51,30,0,0); // d + do Output.create(101,0,0,0,30,51,63,3,51,30,0,0); // e + do Output.create(102,28,54,38,6,15,6,6,6,15,0,0); // f + do Output.create(103,0,0,30,51,51,51,62,48,51,30,0); // g + do Output.create(104,3,3,3,27,55,51,51,51,51,0,0); // h + do Output.create(105,12,12,0,14,12,12,12,12,30,0,0); // i + do Output.create(106,48,48,0,56,48,48,48,48,51,30,0); // j + do Output.create(107,3,3,3,51,27,15,15,27,51,0,0); // k + do Output.create(108,14,12,12,12,12,12,12,12,30,0,0); // l + do Output.create(109,0,0,0,29,63,43,43,43,43,0,0); // m + do Output.create(110,0,0,0,29,51,51,51,51,51,0,0); // n + do Output.create(111,0,0,0,30,51,51,51,51,30,0,0); // o + do Output.create(112,0,0,0,30,51,51,51,31,3,3,0); // p + do Output.create(113,0,0,0,30,51,51,51,62,48,48,0); // q + do Output.create(114,0,0,0,29,55,51,3,3,7,0,0); // r + do Output.create(115,0,0,0,30,51,6,24,51,30,0,0); // s + do Output.create(116,4,6,6,15,6,6,6,54,28,0,0); // t + do Output.create(117,0,0,0,27,27,27,27,27,54,0,0); // u + do Output.create(118,0,0,0,51,51,51,51,30,12,0,0); // v + do Output.create(119,0,0,0,51,51,51,63,63,18,0,0); // w + do Output.create(120,0,0,0,51,30,12,12,30,51,0,0); // x + do Output.create(121,0,0,0,51,51,51,62,48,24,15,0); // y + do Output.create(122,0,0,0,63,27,12,6,51,63,0,0); // z + + do Output.create(123,56,12,12,12,7,12,12,12,56,0,0); // { + do Output.create(124,12,12,12,12,12,12,12,12,12,0,0); // | + do Output.create(125,7,12,12,12,56,12,12,12,7,0,0); // } + do Output.create(126,38,45,25,0,0,0,0,0,0,0,0); // ~ + + return; + } + + // Creates the character map array of the given character index, using the given values. + function void create(int index, int a, int b, int c, int d, int e, + int f, int g, int h, int i, int j, int k) { + var Array map; + + let map = Array.new(11); + let charMaps[index] = map; + + let map[0] = a; + let map[1] = b; + let map[2] = c; + let map[3] = d; + let map[4] = e; + let map[5] = f; + let map[6] = g; + let map[7] = h; + let map[8] = i; + let map[9] = j; + let map[10] = k; + + return; + } + + // Returns the character map (array of size 11) of the given character. + // If the given character is invalid or non-printable, returns the + // character map of a black square. + function Array getMap(char c) { + if ((c < 32) | (c > 126)) { + let c = 0; + } + return charMaps[c]; + } + + /** Moves the cursor to the j-th column of the i-th row, + * and erases the character displayed there. */ + function void moveCursor(int i, int j) { + } + + /** Displays the given character at the cursor location, + * and advances the cursor one column forward. */ + function void printChar(char c) { + } + + /** displays the given string starting at the cursor location, + * and advances the cursor appropriately. */ + function void printString(String s) { + } + + /** Displays the given integer starting at the cursor location, + * and advances the cursor appropriately. */ + function void printInt(int i) { + } + + /** Advances the cursor to the beginning of the next line. */ + function void println() { + } + + /** Moves the cursor one column back. */ + function void backSpace() { + } +} diff --git a/projects/12/OutputTest/Main.jack b/projects/12/OutputTest/Main.jack new file mode 100644 index 0000000..f243068 --- /dev/null +++ b/projects/12/OutputTest/Main.jack @@ -0,0 +1,42 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/OutputTest/Main.jack + +/** Test program for the OS Output class. */ +class Main { + + /** Outputs the entire character set to the screen using all the + * methods of the Output class. */ + function void main() { + var String s; + + let s = String.new(1); + do s.appendChar(String.doubleQuote()); + + do Output.moveCursor(0, 63); + do Output.printChar(66); + do Output.moveCursor(22, 0); + do Output.printChar(67); + do Output.moveCursor(22, 63); + do Output.printChar(68); + do Output.printChar(65); + + do Output.moveCursor(2, 0); + do Output.printString("0123456789"); + do Output.println(); + + do Output.printString("ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz"); + do Output.println(); + + do Output.printString("!#$%&'()*+,-./:;<=>?@[\]^_`{|}~"); + do Output.printString(s); + do Output.println(); + + do Output.printInt(-12345); + do Output.backSpace(); + do Output.printInt(6789); + + return; + } +} diff --git a/projects/12/OutputTest/OutputTestOutput.gif b/projects/12/OutputTest/OutputTestOutput.gif new file mode 100644 index 0000000..b8ec2c0 Binary files /dev/null and b/projects/12/OutputTest/OutputTestOutput.gif differ diff --git a/projects/12/Screen.jack b/projects/12/Screen.jack new file mode 100644 index 0000000..7356d35 --- /dev/null +++ b/projects/12/Screen.jack @@ -0,0 +1,43 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/Screen.jack + +/** + * A library of functions for displaying graphics on the screen. + * The Hack physical screen consists of 512 rows (indexed 0..511, top to bottom) + * of 256 pixels each (indexed 0..255, left to right). The top left pixel on + * the screen is indexed (0,0). + */ +class Screen { + + /** Initializes the Screen. */ + function void init() { + } + + /** Erases the entire screen. */ + function void clearScreen() { + } + + /** Sets the current color, to be used for all subsequent drawXXX commands. + * Black is represented by true, white by false. */ + function void setColor(boolean b) { + } + + /** Draws the (x,y) pixel, using the current color. */ + function void drawPixel(int x, int y) { + } + + /** Draws a line from pixel (x1,y1) to pixel (x2,y2), using the current color. */ + function void drawLine(int x1, int y1, int x2, int y2) { + } + + /** Draws a filled rectangle whose top left corner is (x1, y1) + * and bottom right corner is (x2,y2), using the current color. */ + function void drawRectangle(int x1, int y1, int x2, int y2) { + } + + /** Draws a filled circle of radius r<=181 around (x,y), using the current color. */ + function void drawCircle(int x, int y, int r) { + } +} diff --git a/projects/12/ScreenTest/Main.jack b/projects/12/ScreenTest/Main.jack new file mode 100644 index 0000000..00f36bd --- /dev/null +++ b/projects/12/ScreenTest/Main.jack @@ -0,0 +1,36 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/ScreenTest/Main.jack + +/** Test program for the OS Screen class. */ +class Main { + + /** Draws a sample pictue on the screen using lines and circles. */ + function void main() { + + do Screen.drawLine(0,220,511,220); // base line + do Screen.drawRectangle(280,90,410,220); // house + + do Screen.setColor(false); + do Screen.drawRectangle(350,120,390,219); // door + do Screen.drawRectangle(292,120,332,150); // window + + do Screen.setColor(true); + do Screen.drawCircle(360,170,3); // door handle + do Screen.drawLine(280,90,345,35); // roof + do Screen.drawLine(345,35,410,90); // roof + + do Screen.drawCircle(140,60,30); // sun + do Screen.drawLine(140,26, 140, 6); + do Screen.drawLine(163,35,178,20); + do Screen.drawLine(174,60,194,60); + do Screen.drawLine(163,85,178,100); + do Screen.drawLine(140,94,140,114); + do Screen.drawLine(117,85,102,100); + do Screen.drawLine(106,60,86,60); + do Screen.drawLine(117,35,102,20); + + return; + } +} diff --git a/projects/12/ScreenTest/ScreenTestOutput.gif b/projects/12/ScreenTest/ScreenTestOutput.gif new file mode 100644 index 0000000..f1742cc Binary files /dev/null and b/projects/12/ScreenTest/ScreenTestOutput.gif differ diff --git a/projects/12/String.jack b/projects/12/String.jack new file mode 100644 index 0000000..228d71c --- /dev/null +++ b/projects/12/String.jack @@ -0,0 +1,64 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/String.jack + +/** + * Represents character strings. In addition for constructing and disposing + * strings, the class features methods for getting and setting individual + * characters of the string, for erasing the string's last character, + * for appending a character to the string's end, and more typical + * string-oriented operations. + */ +class String { + + /** constructs a new empty string with a maximum length of maxLength + * and initial length of 0. */ + constructor String new(int maxLength) { + } + + /** Disposes this string. */ + method void dispose() { + } + + /** Returns the current length of this string. */ + method int length() { + } + + /** Returns the character at the j-th location of this string. */ + method char charAt(int j) { + } + + /** Sets the character at the j-th location of this string to c. */ + method void setCharAt(int j, char c) { + } + + /** Appends c to this string's end and returns this string. */ + method String appendChar(char c) { + } + + /** Erases the last character from this string. */ + method void eraseLastChar() { + } + + /** Returns the integer value of this string, + * until a non-digit character is detected. */ + method int intValue() { + } + + /** Sets this string to hold a representation of the given value. */ + method void setInt(int val) { + } + + /** Returns the new line character. */ + function char newLine() { + } + + /** Returns the backspace character. */ + function char backSpace() { + } + + /** Returns the double quote (") character. */ + function char doubleQuote() { + } +} diff --git a/projects/12/StringTest/Main.jack b/projects/12/StringTest/Main.jack new file mode 100644 index 0000000..2848548 --- /dev/null +++ b/projects/12/StringTest/Main.jack @@ -0,0 +1,83 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/StringTest/Main.jack + +/** Test program for the OS String class. */ +class Main { + + /** Performs various string manipulations and displays their results. */ + function void main() { + var String s; + var String i; + + let s = String.new(0); // a zero-capacity string should be supported + do s.dispose(); + + let s = String.new(6); // capacity 6, make sure that length 5 is displayed + let s = s.appendChar(97); + let s = s.appendChar(98); + let s = s.appendChar(99); + let s = s.appendChar(100); + let s = s.appendChar(101); + do Output.printString("new,appendChar: "); + do Output.printString(s); // new, appendChar: abcde + do Output.println(); + + let i = String.new(6); + do i.setInt(12345); + do Output.printString("setInt: "); + do Output.printString(i); // setInt: 12345 + do Output.println(); + + do i.setInt(-32767); + do Output.printString("setInt: "); + do Output.printString(i); // setInt: -32767 + do Output.println(); + + do Output.printString("length: "); + do Output.printInt(s.length()); // length: 5 + do Output.println(); + + do Output.printString("charAt[2]: "); + do Output.printInt(s.charAt(2)); // charAt[2]: 99 + do Output.println(); + + do s.setCharAt(2, 45); + do Output.printString("setCharAt(2,'-'): "); + do Output.printString(s); // setCharAt(2,'-'): ab-de + do Output.println(); + + do s.eraseLastChar(); + do Output.printString("eraseLastChar: "); + do Output.printString(s); // eraseLastChar: ab-d + do Output.println(); + + let s = "456"; + do Output.printString("intValue: "); + do Output.printInt(s.intValue()); // intValue: 456 + do Output.println(); + + let s = "-32123"; + do Output.printString("intValue: "); + do Output.printInt(s.intValue()); // intValue: -32123 + do Output.println(); + + do Output.printString("backSpace: "); + do Output.printInt(String.backSpace()); // backSpace: 129 + do Output.println(); + + do Output.printString("doubleQuote: "); + do Output.printInt(String.doubleQuote());// doubleQuote: 34 + do Output.println(); + + do Output.printString("newLine: "); + do Output.printInt(String.newLine()); // newLine: 128 + do Output.println(); + + do i.dispose(); + do s.dispose(); + + return; + } +} diff --git a/projects/12/StringTest/StringTestOutput.gif b/projects/12/StringTest/StringTestOutput.gif new file mode 100644 index 0000000..5c2932c Binary files /dev/null and b/projects/12/StringTest/StringTestOutput.gif differ diff --git a/projects/12/Sys.jack b/projects/12/Sys.jack new file mode 100644 index 0000000..bee6f67 --- /dev/null +++ b/projects/12/Sys.jack @@ -0,0 +1,27 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/Sys.jack + +/** + * A library that supports various program execution services. + */ +class Sys { + + /** Performs all the initializations required by the OS. */ + function void init() { + } + + /** Halts the program execution. */ + function void halt() { + } + + /** Waits approximately duration milliseconds and returns. */ + function void wait(int duration) { + } + + /** Displays the given error code in the form "ERR", + * and halts the program's execution. */ + function void error(int errorCode) { + } +} diff --git a/projects/12/SysTest/Main.jack b/projects/12/SysTest/Main.jack new file mode 100644 index 0000000..a153b25 --- /dev/null +++ b/projects/12/SysTest/Main.jack @@ -0,0 +1,31 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/12/SysTest/Main.jack + +/** Test program for the OS Sys class. */ +class Main { + + /** Tests the wait method of the Sys class. */ + function void main() { + var char key; + + do Output.printString("Wait test:"); + do Output.println(); + do Output.printString("Press any key. After 2 seconds, another message will be printed:"); + + while (key = 0) { + let key = Keyboard.keyPressed(); + } + while (~(key = 0)) { + let key = Keyboard.keyPressed(); + } + + do Sys.wait(2000); + + do Output.println(); + do Output.printString("Time is up. Make sure that 2 seconds elapsed."); + + return; + } +} diff --git a/projects/13/more fun to go.txt b/projects/13/more fun to go.txt new file mode 100644 index 0000000..a7f066e --- /dev/null +++ b/projects/13/more fun to go.txt @@ -0,0 +1,9 @@ +See Chapter 13. It's your call! + +And, if you develop something cool, please let us know about it. + +We hope that you enjoyed the course! + +-- Noam and Shimon + +www.nand2tetris.org \ No newline at end of file diff --git a/projects/demo/Xor.cmp b/projects/demo/Xor.cmp new file mode 100644 index 0000000..a1e07b2 --- /dev/null +++ b/projects/demo/Xor.cmp @@ -0,0 +1,5 @@ +| a | b | out | +| 0 | 0 | 0 | +| 0 | 1 | 1 | +| 1 | 0 | 1 | +| 1 | 1 | 0 | diff --git a/projects/demo/Xor.hdl b/projects/demo/Xor.hdl new file mode 100644 index 0000000..db49351 --- /dev/null +++ b/projects/demo/Xor.hdl @@ -0,0 +1,25 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/demo/Xor.hdl + +/** + * Exclusive-or gate: true if either a is true and b is false, or + * a is false and b is true; false otherwise. + * QUESTION: how can the simulator execute this program properly without + * HDL implementations of the underlying Not, And, and Or chip-parts? + * Answer: since the demo folder contains no Not.hdl, And.hdl and Or.hdl + * files, the simulator reverts to using their built-in implementations. + */ + +CHIP Xor { + IN a, b; + OUT out; + + PARTS: + Not (in=a, out=nota); + Not (in=b, out=notb); + And (a=a, b=notb, out=x); + And (a=nota, b=b, out=y); + Or (a=x, b=y, out=out); +} \ No newline at end of file diff --git a/projects/demo/Xor.out b/projects/demo/Xor.out new file mode 100644 index 0000000..e69de29 diff --git a/projects/demo/Xor.tst b/projects/demo/Xor.tst new file mode 100644 index 0000000..658cbe5 --- /dev/null +++ b/projects/demo/Xor.tst @@ -0,0 +1,29 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/01/Xor.tst + +load Xor.hdl, +output-file Xor.out, +compare-to Xor.cmp, +output-list a%B3.1.3 b%B3.1.3 out%B3.1.3; + +set a 0, +set b 0, +eval, +output; + +set a 0, +set b 1, +eval, +output; + +set a 1, +set b 0, +eval, +output; + +set a 1, +set b 1, +eval, +output; diff --git a/tools/.DS_Store b/tools/.DS_Store new file mode 100644 index 0000000..80fb89e Binary files /dev/null and b/tools/.DS_Store differ 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 100644 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 100644 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 100644 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..5d42aad --- /dev/null +++ b/tools/OS/Memory.vm @@ -0,0 +1,279 @@ +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 1 +push argument 0 +push constant 1 +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 constant 2048 +pop local 0 +label WHILE_EXP0 +push constant 0 +push local 0 +add +pop pointer 1 +push that 0 +push argument 0 +lt +not +if-goto WHILE_END0 +push constant 1 +push local 0 +add +pop pointer 1 +push that 0 +pop local 0 +goto WHILE_EXP0 +label WHILE_END0 +push local 0 +push argument 0 +add +push constant 16379 +gt +if-goto IF_TRUE1 +goto IF_FALSE1 +label IF_TRUE1 +push constant 6 +call Sys.error 1 +pop temp 0 +label IF_FALSE1 +push constant 0 +push local 0 +add +pop pointer 1 +push that 0 +push argument 0 +push constant 2 +add +gt +if-goto IF_TRUE2 +goto IF_FALSE2 +label IF_TRUE2 +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_TRUE3 +goto IF_FALSE3 +label IF_TRUE3 +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_END3 +label IF_FALSE3 +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_END3 +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_FALSE2 +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..3ed7c0c --- /dev/null +++ b/tools/OS/Sys.vm @@ -0,0 +1,84 @@ +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 3 +call String.new 1 +push constant 69 +call String.appendChar 2 +push constant 82 +call String.appendChar 2 +push constant 82 +call String.appendChar 2 +call Output.printString 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 100644 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 100644 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 Binary files /dev/null and b/tools/bin/classes/CPUEmulatorMain.class differ diff --git a/tools/bin/classes/HackAssemblerMain.class b/tools/bin/classes/HackAssemblerMain.class new file mode 100644 index 0000000..b912391 Binary files /dev/null and b/tools/bin/classes/HackAssemblerMain.class differ diff --git a/tools/bin/classes/HardwareSimulatorMain.class b/tools/bin/classes/HardwareSimulatorMain.class new file mode 100644 index 0000000..5786077 Binary files /dev/null and b/tools/bin/classes/HardwareSimulatorMain.class differ diff --git a/tools/bin/classes/TextComparer.class b/tools/bin/classes/TextComparer.class new file mode 100644 index 0000000..f2e076e Binary files /dev/null and b/tools/bin/classes/TextComparer.class differ diff --git a/tools/bin/classes/VMEmulatorMain.class b/tools/bin/classes/VMEmulatorMain.class new file mode 100644 index 0000000..aa6b7ff Binary files /dev/null and b/tools/bin/classes/VMEmulatorMain.class 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 @@ + + + + + + + + +About Assembler + + + + + + + +

+ +

Assembler, 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

+ +

 

+ +
+ + + + 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 @@ + + + + + + + + +Usage instruction and tips can be found in: + + + + + + + +
+ +

Usage instruction and tips can be found in:

+ +

 

+ +

The Assembler Tutorial

+ +

 

+ +

Available in www.nand2tetris.org

+ +

 

+ +

And in relevant book chapters from

+ +

The Elements of Computing Systems,

+ +

by Noam Nisan and Shimon Schocken

+ +

MIT Press

+ +

 

+ +
+ + + + 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 @@ + + + + + + + + +About CPU Emulator + + + + + + + +
+ +

CPU Emulator, 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

+ +

 

+ +
+ + + + 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 @@ + + + + + + + + +Usage instruction and tips can be found in: + + + + + + + +
+ +

Usage instruction and tips can be found in:

+ +

 

+ +

The CPU Emulator Tutorial

+ +

 

+ +

Available in www.nand2tetris.org

+ +

 

+ +

And in relevant book chapters from

+ +

The Elements of Computing Systems,

+ +

by Noam Nisan and Shimon Schocken

+ +

MIT Press

+ +

 

+ +
+ + + + 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 @@ + + + + + + + + +About Hardware Simulator + + + + + + + +
+ +

Hardware Simulator, 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

+ +

 

+ +
+ + + + 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 @@ + + + + + + + + +Usage instruction and tips can be found in: + + + + + + + +
+ +

Usage instruction and tips can be found in:

+ +

 

+ +

The Hardware Simulator Tutorial

+ +

 

+ +

Available in www.nand2tetris.org

+ +

 

+ +

And in relevant book chapters from

+ +

The Elements of Computing Systems,

+ +

by Noam Nisan and Shimon Schocken

+ +

MIT Press

+ +

 

+ +
+ + + + 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 @@ + + + + + + + + +About Virtual Machine Emulator + + + + + + + +
+ +

Virtual Machine Emulator, 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

+ +

 

+ +
+ + + + 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 @@ + + + + + + + + +Usage instruction and tips can be found in: + + + + + + + +
+ +

Usage instruction and tips can be found in:

+ +

 

+ +

The VM Emulator Tutorial

+ +

 

+ +

Available in www.nand2tetris.org

+ +

 

+ +

And in relevant book chapters from

+ +

The Elements of Computing Systems,

+ +

by Noam Nisan and Shimon Schocken

+ +

MIT Press

+ +

 

+ +
+ + + + diff --git a/tools/bin/images/arrow2.gif b/tools/bin/images/arrow2.gif new file mode 100644 index 0000000..c744eab Binary files /dev/null and b/tools/bin/images/arrow2.gif differ diff --git a/tools/bin/images/calculator2.gif b/tools/bin/images/calculator2.gif new file mode 100644 index 0000000..834cb05 Binary files /dev/null and b/tools/bin/images/calculator2.gif differ diff --git a/tools/bin/images/cancel.gif b/tools/bin/images/cancel.gif new file mode 100644 index 0000000..a8509fa Binary files /dev/null and b/tools/bin/images/cancel.gif differ diff --git a/tools/bin/images/chip.gif b/tools/bin/images/chip.gif new file mode 100644 index 0000000..fbfbb02 Binary files /dev/null and b/tools/bin/images/chip.gif differ diff --git a/tools/bin/images/clock2.gif b/tools/bin/images/clock2.gif new file mode 100644 index 0000000..addcf78 Binary files /dev/null and b/tools/bin/images/clock2.gif differ diff --git a/tools/bin/images/equal.gif b/tools/bin/images/equal.gif new file mode 100644 index 0000000..3402556 Binary files /dev/null and b/tools/bin/images/equal.gif differ diff --git a/tools/bin/images/find.gif b/tools/bin/images/find.gif new file mode 100644 index 0000000..e3f4c9d Binary files /dev/null and b/tools/bin/images/find.gif differ diff --git a/tools/bin/images/hex.gif b/tools/bin/images/hex.gif new file mode 100644 index 0000000..68a851b Binary files /dev/null and b/tools/bin/images/hex.gif differ diff --git a/tools/bin/images/keyboard.gif b/tools/bin/images/keyboard.gif new file mode 100644 index 0000000..823aaf8 Binary files /dev/null and b/tools/bin/images/keyboard.gif differ diff --git a/tools/bin/images/ok.gif b/tools/bin/images/ok.gif new file mode 100644 index 0000000..fe6ed8d Binary files /dev/null and b/tools/bin/images/ok.gif differ diff --git a/tools/bin/images/ok2.gif b/tools/bin/images/ok2.gif new file mode 100644 index 0000000..083909b Binary files /dev/null and b/tools/bin/images/ok2.gif differ diff --git a/tools/bin/images/open.gif b/tools/bin/images/open.gif new file mode 100644 index 0000000..f69a024 Binary files /dev/null and b/tools/bin/images/open.gif differ diff --git a/tools/bin/images/open2.gif b/tools/bin/images/open2.gif new file mode 100644 index 0000000..2b94682 Binary files /dev/null and b/tools/bin/images/open2.gif differ diff --git a/tools/bin/images/opendoc.gif b/tools/bin/images/opendoc.gif new file mode 100644 index 0000000..e84f0d6 Binary files /dev/null and b/tools/bin/images/opendoc.gif differ diff --git a/tools/bin/images/redflag.gif b/tools/bin/images/redflag.gif new file mode 100644 index 0000000..1b1a6b1 Binary files /dev/null and b/tools/bin/images/redflag.gif differ diff --git a/tools/bin/images/save.gif b/tools/bin/images/save.gif new file mode 100644 index 0000000..7b5d5b9 Binary files /dev/null and b/tools/bin/images/save.gif differ diff --git a/tools/bin/images/scroll.gif b/tools/bin/images/scroll.gif new file mode 100644 index 0000000..e00a9a1 Binary files /dev/null and b/tools/bin/images/scroll.gif differ diff --git a/tools/bin/images/smallcancel.gif b/tools/bin/images/smallcancel.gif new file mode 100644 index 0000000..1f8cddc Binary files /dev/null and b/tools/bin/images/smallcancel.gif differ diff --git a/tools/bin/images/smallequal.gif b/tools/bin/images/smallequal.gif new file mode 100644 index 0000000..a1db606 Binary files /dev/null and b/tools/bin/images/smallequal.gif differ diff --git a/tools/bin/images/smallminus.gif b/tools/bin/images/smallminus.gif new file mode 100644 index 0000000..06492f5 Binary files /dev/null and b/tools/bin/images/smallminus.gif differ diff --git a/tools/bin/images/smallnew.gif b/tools/bin/images/smallnew.gif new file mode 100644 index 0000000..c3137e5 Binary files /dev/null and b/tools/bin/images/smallnew.gif differ diff --git a/tools/bin/images/smallok.gif b/tools/bin/images/smallok.gif new file mode 100644 index 0000000..9bef2b2 Binary files /dev/null and b/tools/bin/images/smallok.gif differ diff --git a/tools/bin/images/smallplus.gif b/tools/bin/images/smallplus.gif new file mode 100644 index 0000000..9030b0b Binary files /dev/null and b/tools/bin/images/smallplus.gif differ diff --git a/tools/bin/images/vcrfastforward.gif b/tools/bin/images/vcrfastforward.gif new file mode 100644 index 0000000..11c7235 Binary files /dev/null and b/tools/bin/images/vcrfastforward.gif differ diff --git a/tools/bin/images/vcrforward.gif b/tools/bin/images/vcrforward.gif new file mode 100644 index 0000000..b58d649 Binary files /dev/null and b/tools/bin/images/vcrforward.gif differ diff --git a/tools/bin/images/vcrrewind.gif b/tools/bin/images/vcrrewind.gif new file mode 100644 index 0000000..e55b4d6 Binary files /dev/null and b/tools/bin/images/vcrrewind.gif differ diff --git a/tools/bin/images/vcrstop.gif b/tools/bin/images/vcrstop.gif new file mode 100644 index 0000000..abe2082 Binary files /dev/null and b/tools/bin/images/vcrstop.gif differ diff --git a/tools/bin/lib/AssemblerGUI.jar b/tools/bin/lib/AssemblerGUI.jar new file mode 100644 index 0000000..c40d455 Binary files /dev/null and b/tools/bin/lib/AssemblerGUI.jar differ diff --git a/tools/bin/lib/Compilers.jar b/tools/bin/lib/Compilers.jar new file mode 100644 index 0000000..9a78b05 Binary files /dev/null and b/tools/bin/lib/Compilers.jar differ diff --git a/tools/bin/lib/Hack.jar b/tools/bin/lib/Hack.jar new file mode 100644 index 0000000..9d57398 Binary files /dev/null and b/tools/bin/lib/Hack.jar differ diff --git a/tools/bin/lib/HackGUI.jar b/tools/bin/lib/HackGUI.jar new file mode 100644 index 0000000..22d4ff3 Binary files /dev/null and b/tools/bin/lib/HackGUI.jar differ diff --git a/tools/bin/lib/Simulators.jar b/tools/bin/lib/Simulators.jar new file mode 100644 index 0000000..72b5db7 Binary files /dev/null and b/tools/bin/lib/Simulators.jar differ diff --git a/tools/bin/lib/SimulatorsGUI.jar b/tools/bin/lib/SimulatorsGUI.jar new file mode 100644 index 0000000..4d36e64 Binary files /dev/null and b/tools/bin/lib/SimulatorsGUI.jar differ diff --git a/tools/bin/lib/TranslatorsGUI.jar b/tools/bin/lib/TranslatorsGUI.jar new file mode 100644 index 0000000..f29f926 Binary files /dev/null and b/tools/bin/lib/TranslatorsGUI.jar 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 Binary files /dev/null and b/tools/builtInChips/ALU.class 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 Binary files /dev/null and b/tools/builtInChips/ARegister.class 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 Binary files /dev/null and b/tools/builtInChips/Add16.class 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 Binary files /dev/null and b/tools/builtInChips/And.class 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 Binary files /dev/null and b/tools/builtInChips/Bit.class 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 Binary files /dev/null and b/tools/builtInChips/DFF.class 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 Binary files /dev/null and b/tools/builtInChips/DMux.class 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 Binary files /dev/null and b/tools/builtInChips/DMux4Way.class 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 Binary files /dev/null and b/tools/builtInChips/DMux8Way.class 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 Binary files /dev/null and b/tools/builtInChips/DRegister.class 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 Binary files /dev/null and b/tools/builtInChips/FullAdder.class 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 Binary files /dev/null and b/tools/builtInChips/HalfAdder.class 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 Binary files /dev/null and b/tools/builtInChips/Inc16.class 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 Binary files /dev/null and b/tools/builtInChips/Keyboard.class 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 Binary files /dev/null and b/tools/builtInChips/Mux.class 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 Binary files /dev/null and b/tools/builtInChips/Mux4Way16.class 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 Binary files /dev/null and b/tools/builtInChips/Mux8Way16.class 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 Binary files /dev/null and b/tools/builtInChips/Nand.class 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 Binary files /dev/null and b/tools/builtInChips/Not.class 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 Binary files /dev/null and b/tools/builtInChips/Not16.class 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 Binary files /dev/null and b/tools/builtInChips/Or.class 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 Binary files /dev/null and b/tools/builtInChips/Or8Way.class 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 Binary files /dev/null and b/tools/builtInChips/PC.class 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 Binary files /dev/null and b/tools/builtInChips/RAM.class differ diff --git a/tools/builtInChips/RAM16K.class b/tools/builtInChips/RAM16K.class new file mode 100644 index 0000000..2f1e3fe Binary files /dev/null and b/tools/builtInChips/RAM16K.class 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 Binary files /dev/null and b/tools/builtInChips/RAM4K.class 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 Binary files /dev/null and b/tools/builtInChips/RAM512.class 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 Binary files /dev/null and b/tools/builtInChips/RAM64.class 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 Binary files /dev/null and b/tools/builtInChips/RAM8.class 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 Binary files /dev/null and b/tools/builtInChips/ROM32K.class 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 Binary files /dev/null and b/tools/builtInChips/Register.class 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 Binary files /dev/null and b/tools/builtInChips/RegisterWithGUI.class differ diff --git a/tools/builtInChips/Screen.class b/tools/builtInChips/Screen.class new file mode 100644 index 0000000..100ed03 Binary files /dev/null and b/tools/builtInChips/Screen.class 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 Binary files /dev/null and b/tools/builtInChips/Xor.class 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 Binary files /dev/null and b/tools/builtInVMCode/Array.class differ diff --git a/tools/builtInVMCode/JackOSClass.class b/tools/builtInVMCode/JackOSClass.class new file mode 100644 index 0000000..25df72a Binary files /dev/null and b/tools/builtInVMCode/JackOSClass.class differ diff --git a/tools/builtInVMCode/Keyboard.class b/tools/builtInVMCode/Keyboard.class new file mode 100644 index 0000000..7366f75 Binary files /dev/null and b/tools/builtInVMCode/Keyboard.class differ diff --git a/tools/builtInVMCode/Math.class b/tools/builtInVMCode/Math.class new file mode 100644 index 0000000..71aef91 Binary files /dev/null and b/tools/builtInVMCode/Math.class differ diff --git a/tools/builtInVMCode/Memory.class b/tools/builtInVMCode/Memory.class new file mode 100644 index 0000000..e9bb7ad Binary files /dev/null and b/tools/builtInVMCode/Memory.class differ diff --git a/tools/builtInVMCode/Output.class b/tools/builtInVMCode/Output.class new file mode 100644 index 0000000..65b25b7 Binary files /dev/null and b/tools/builtInVMCode/Output.class differ diff --git a/tools/builtInVMCode/Screen.class b/tools/builtInVMCode/Screen.class new file mode 100644 index 0000000..8644e09 Binary files /dev/null and b/tools/builtInVMCode/Screen.class differ diff --git a/tools/builtInVMCode/String.class b/tools/builtInVMCode/String.class new file mode 100644 index 0000000..98c7f58 Binary files /dev/null and b/tools/builtInVMCode/String.class differ diff --git a/tools/builtInVMCode/Sys.class b/tools/builtInVMCode/Sys.class new file mode 100644 index 0000000..0c15f1b Binary files /dev/null and b/tools/builtInVMCode/Sys.class differ -- cgit v1.2.3