diff --git a/.gitignore b/projects/.gitignore similarity index 100% rename from .gitignore rename to projects/.gitignore diff --git a/tools/OS/Memory.vm b/tools/OS/Memory.vm index 28fe8a5..51a3660 100644 --- a/tools/OS/Memory.vm +++ b/tools/OS/Memory.vm @@ -37,9 +37,9 @@ push temp 0 pop that 0 push constant 0 return -function Memory.alloc 1 +function Memory.alloc 2 push argument 0 -push constant 1 +push constant 0 lt if-goto IF_TRUE0 goto IF_FALSE0 @@ -48,9 +48,21 @@ push constant 5 call Sys.error 1 pop temp 0 label IF_FALSE0 +push argument 0 +push constant 0 +eq +if-goto IF_TRUE1 +goto IF_FALSE1 +label IF_TRUE1 +push constant 1 +pop argument 0 +label IF_FALSE1 push constant 2048 pop local 0 label WHILE_EXP0 +push local 0 +push constant 16383 +lt push constant 0 push local 0 add @@ -58,6 +70,7 @@ pop pointer 1 push that 0 push argument 0 lt +and not if-goto WHILE_END0 push constant 1 @@ -65,7 +78,91 @@ push local 0 add pop pointer 1 push that 0 +pop local 1 +push constant 0 +push local 0 +add +pop pointer 1 +push that 0 +push constant 0 +eq +push local 1 +push constant 16382 +gt +or +push constant 0 +push local 1 +add +pop pointer 1 +push that 0 +push constant 0 +eq +or +if-goto IF_TRUE2 +goto IF_FALSE2 +label IF_TRUE2 +push local 1 pop local 0 +goto IF_END2 +label IF_FALSE2 +push constant 0 +push local 0 +add +push constant 1 +push local 0 +add +pop pointer 1 +push that 0 +push local 0 +sub +push constant 0 +push local 1 +add +pop pointer 1 +push that 0 +add +pop temp 0 +pop pointer 1 +push temp 0 +pop that 0 +push constant 1 +push local 1 +add +pop pointer 1 +push that 0 +push local 1 +push constant 2 +add +eq +if-goto IF_TRUE3 +goto IF_FALSE3 +label IF_TRUE3 +push constant 1 +push local 0 +add +push local 0 +push constant 2 +add +pop temp 0 +pop pointer 1 +push temp 0 +pop that 0 +goto IF_END3 +label IF_FALSE3 +push constant 1 +push local 0 +add +push constant 1 +push local 1 +add +pop pointer 1 +push that 0 +pop temp 0 +pop pointer 1 +push temp 0 +pop that 0 +label IF_END3 +label IF_END2 goto WHILE_EXP0 label WHILE_END0 push local 0 @@ -73,13 +170,13 @@ push argument 0 add push constant 16379 gt -if-goto IF_TRUE1 -goto IF_FALSE1 -label IF_TRUE1 +if-goto IF_TRUE4 +goto IF_FALSE4 +label IF_TRUE4 push constant 6 call Sys.error 1 pop temp 0 -label IF_FALSE1 +label IF_FALSE4 push constant 0 push local 0 add @@ -89,9 +186,9 @@ push argument 0 push constant 2 add gt -if-goto IF_TRUE2 -goto IF_FALSE2 -label IF_TRUE2 +if-goto IF_TRUE5 +goto IF_FALSE5 +label IF_TRUE5 push argument 0 push constant 2 add @@ -119,9 +216,9 @@ push local 0 push constant 2 add eq -if-goto IF_TRUE3 -goto IF_FALSE3 -label IF_TRUE3 +if-goto IF_TRUE6 +goto IF_FALSE6 +label IF_TRUE6 push argument 0 push constant 3 add @@ -136,8 +233,8 @@ pop temp 0 pop pointer 1 push temp 0 pop that 0 -goto IF_END3 -label IF_FALSE3 +goto IF_END6 +label IF_FALSE6 push argument 0 push constant 3 add @@ -152,7 +249,7 @@ pop temp 0 pop pointer 1 push temp 0 pop that 0 -label IF_END3 +label IF_END6 push constant 1 push local 0 add @@ -165,7 +262,7 @@ pop temp 0 pop pointer 1 push temp 0 pop that 0 -label IF_FALSE2 +label IF_FALSE5 push constant 0 push local 0 add diff --git a/tools/OS/Sys.vm b/tools/OS/Sys.vm index df9209c..ae9261e 100644 --- a/tools/OS/Sys.vm +++ b/tools/OS/Sys.vm @@ -65,15 +65,14 @@ 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 +call Output.printChar 1 +pop temp 0 push constant 82 -call String.appendChar 2 +call Output.printChar 1 +pop temp 0 push constant 82 -call String.appendChar 2 -call Output.printString 1 +call Output.printChar 1 pop temp 0 push argument 0 call Output.printInt 1 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..3bc11c8 --- /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..daeb6e8 --- /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..2152f03 --- /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..ff70ba5 --- /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..e6e0a43 --- /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..f733a14 --- /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..b2876e6 --- /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..e5d931f --- /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..bae5be7 --- /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..6861eaf --- /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..1a16426 --- /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..7c60190 --- /dev/null +++ b/tools/bin/scripts/defaultVM.txt @@ -0,0 +1,3 @@ +repeat { + vmstep; +} \ No newline at end of file