Anpassungen Path-Struktur
27
original/tools/Assembler.bat
Normal file
@@ -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
|
||||
32
original/tools/Assembler.sh
Normal file
@@ -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
|
||||
|
||||
29
original/tools/CPUEmulator.bat
Normal file
@@ -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
|
||||
33
original/tools/CPUEmulator.sh
Normal file
@@ -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
|
||||
30
original/tools/HardwareSimulator.bat
Normal file
@@ -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
|
||||
34
original/tools/HardwareSimulator.sh
Normal file
@@ -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
|
||||
26
original/tools/JackCompiler.bat
Normal file
@@ -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
|
||||
35
original/tools/JackCompiler.sh
Normal file
@@ -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
|
||||
23
original/tools/OS/Array.vm
Normal file
@@ -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
|
||||
102
original/tools/OS/Keyboard.vm
Normal file
@@ -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
|
||||
408
original/tools/OS/Math.vm
Normal file
@@ -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
|
||||
376
original/tools/OS/Memory.vm
Normal file
@@ -0,0 +1,376 @@
|
||||
function Memory.init 0
|
||||
push constant 0
|
||||
pop static 0
|
||||
push constant 2048
|
||||
push static 0
|
||||
add
|
||||
push constant 14334
|
||||
pop temp 0
|
||||
pop pointer 1
|
||||
push temp 0
|
||||
pop that 0
|
||||
push constant 2049
|
||||
push static 0
|
||||
add
|
||||
push constant 2050
|
||||
pop temp 0
|
||||
pop pointer 1
|
||||
push temp 0
|
||||
pop that 0
|
||||
push constant 0
|
||||
return
|
||||
function Memory.peek 0
|
||||
push argument 0
|
||||
push static 0
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
return
|
||||
function Memory.poke 0
|
||||
push argument 0
|
||||
push static 0
|
||||
add
|
||||
push argument 1
|
||||
pop temp 0
|
||||
pop pointer 1
|
||||
push temp 0
|
||||
pop that 0
|
||||
push constant 0
|
||||
return
|
||||
function Memory.alloc 2
|
||||
push argument 0
|
||||
push constant 0
|
||||
lt
|
||||
if-goto IF_TRUE0
|
||||
goto IF_FALSE0
|
||||
label IF_TRUE0
|
||||
push constant 5
|
||||
call Sys.error 1
|
||||
pop temp 0
|
||||
label IF_FALSE0
|
||||
push argument 0
|
||||
push constant 0
|
||||
eq
|
||||
if-goto IF_TRUE1
|
||||
goto IF_FALSE1
|
||||
label IF_TRUE1
|
||||
push constant 1
|
||||
pop argument 0
|
||||
label IF_FALSE1
|
||||
push constant 2048
|
||||
pop local 0
|
||||
label WHILE_EXP0
|
||||
push local 0
|
||||
push constant 16383
|
||||
lt
|
||||
push constant 0
|
||||
push local 0
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
push argument 0
|
||||
lt
|
||||
and
|
||||
not
|
||||
if-goto WHILE_END0
|
||||
push constant 1
|
||||
push local 0
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
pop local 1
|
||||
push constant 0
|
||||
push local 0
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
push constant 0
|
||||
eq
|
||||
push local 1
|
||||
push constant 16382
|
||||
gt
|
||||
or
|
||||
push constant 0
|
||||
push local 1
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
push constant 0
|
||||
eq
|
||||
or
|
||||
if-goto IF_TRUE2
|
||||
goto IF_FALSE2
|
||||
label IF_TRUE2
|
||||
push local 1
|
||||
pop local 0
|
||||
goto IF_END2
|
||||
label IF_FALSE2
|
||||
push constant 0
|
||||
push local 0
|
||||
add
|
||||
push constant 1
|
||||
push local 0
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
push local 0
|
||||
sub
|
||||
push constant 0
|
||||
push local 1
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
add
|
||||
pop temp 0
|
||||
pop pointer 1
|
||||
push temp 0
|
||||
pop that 0
|
||||
push constant 1
|
||||
push local 1
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
push local 1
|
||||
push constant 2
|
||||
add
|
||||
eq
|
||||
if-goto IF_TRUE3
|
||||
goto IF_FALSE3
|
||||
label IF_TRUE3
|
||||
push constant 1
|
||||
push local 0
|
||||
add
|
||||
push local 0
|
||||
push constant 2
|
||||
add
|
||||
pop temp 0
|
||||
pop pointer 1
|
||||
push temp 0
|
||||
pop that 0
|
||||
goto IF_END3
|
||||
label IF_FALSE3
|
||||
push constant 1
|
||||
push local 0
|
||||
add
|
||||
push constant 1
|
||||
push local 1
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
pop temp 0
|
||||
pop pointer 1
|
||||
push temp 0
|
||||
pop that 0
|
||||
label IF_END3
|
||||
label IF_END2
|
||||
goto WHILE_EXP0
|
||||
label WHILE_END0
|
||||
push local 0
|
||||
push argument 0
|
||||
add
|
||||
push constant 16379
|
||||
gt
|
||||
if-goto IF_TRUE4
|
||||
goto IF_FALSE4
|
||||
label IF_TRUE4
|
||||
push constant 6
|
||||
call Sys.error 1
|
||||
pop temp 0
|
||||
label IF_FALSE4
|
||||
push constant 0
|
||||
push local 0
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
push argument 0
|
||||
push constant 2
|
||||
add
|
||||
gt
|
||||
if-goto IF_TRUE5
|
||||
goto IF_FALSE5
|
||||
label IF_TRUE5
|
||||
push argument 0
|
||||
push constant 2
|
||||
add
|
||||
push local 0
|
||||
add
|
||||
push constant 0
|
||||
push local 0
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
push argument 0
|
||||
sub
|
||||
push constant 2
|
||||
sub
|
||||
pop temp 0
|
||||
pop pointer 1
|
||||
push temp 0
|
||||
pop that 0
|
||||
push constant 1
|
||||
push local 0
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
push local 0
|
||||
push constant 2
|
||||
add
|
||||
eq
|
||||
if-goto IF_TRUE6
|
||||
goto IF_FALSE6
|
||||
label IF_TRUE6
|
||||
push argument 0
|
||||
push constant 3
|
||||
add
|
||||
push local 0
|
||||
add
|
||||
push local 0
|
||||
push argument 0
|
||||
add
|
||||
push constant 4
|
||||
add
|
||||
pop temp 0
|
||||
pop pointer 1
|
||||
push temp 0
|
||||
pop that 0
|
||||
goto IF_END6
|
||||
label IF_FALSE6
|
||||
push argument 0
|
||||
push constant 3
|
||||
add
|
||||
push local 0
|
||||
add
|
||||
push constant 1
|
||||
push local 0
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
pop temp 0
|
||||
pop pointer 1
|
||||
push temp 0
|
||||
pop that 0
|
||||
label IF_END6
|
||||
push constant 1
|
||||
push local 0
|
||||
add
|
||||
push local 0
|
||||
push argument 0
|
||||
add
|
||||
push constant 2
|
||||
add
|
||||
pop temp 0
|
||||
pop pointer 1
|
||||
push temp 0
|
||||
pop that 0
|
||||
label IF_FALSE5
|
||||
push constant 0
|
||||
push local 0
|
||||
add
|
||||
push constant 0
|
||||
pop temp 0
|
||||
pop pointer 1
|
||||
push temp 0
|
||||
pop that 0
|
||||
push local 0
|
||||
push constant 2
|
||||
add
|
||||
return
|
||||
function Memory.deAlloc 2
|
||||
push argument 0
|
||||
push constant 2
|
||||
sub
|
||||
pop local 0
|
||||
push constant 1
|
||||
push local 0
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
pop local 1
|
||||
push constant 0
|
||||
push local 1
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
push constant 0
|
||||
eq
|
||||
if-goto IF_TRUE0
|
||||
goto IF_FALSE0
|
||||
label IF_TRUE0
|
||||
push constant 0
|
||||
push local 0
|
||||
add
|
||||
push constant 1
|
||||
push local 0
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
push local 0
|
||||
sub
|
||||
push constant 2
|
||||
sub
|
||||
pop temp 0
|
||||
pop pointer 1
|
||||
push temp 0
|
||||
pop that 0
|
||||
goto IF_END0
|
||||
label IF_FALSE0
|
||||
push constant 0
|
||||
push local 0
|
||||
add
|
||||
push constant 1
|
||||
push local 0
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
push local 0
|
||||
sub
|
||||
push constant 0
|
||||
push local 1
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
add
|
||||
pop temp 0
|
||||
pop pointer 1
|
||||
push temp 0
|
||||
pop that 0
|
||||
push constant 1
|
||||
push local 1
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
push local 1
|
||||
push constant 2
|
||||
add
|
||||
eq
|
||||
if-goto IF_TRUE1
|
||||
goto IF_FALSE1
|
||||
label IF_TRUE1
|
||||
push constant 1
|
||||
push local 0
|
||||
add
|
||||
push local 0
|
||||
push constant 2
|
||||
add
|
||||
pop temp 0
|
||||
pop pointer 1
|
||||
push temp 0
|
||||
pop that 0
|
||||
goto IF_END1
|
||||
label IF_FALSE1
|
||||
push constant 1
|
||||
push local 0
|
||||
add
|
||||
push constant 1
|
||||
push local 1
|
||||
add
|
||||
pop pointer 1
|
||||
push that 0
|
||||
pop temp 0
|
||||
pop pointer 1
|
||||
push temp 0
|
||||
pop that 0
|
||||
label IF_END1
|
||||
label IF_END0
|
||||
push constant 0
|
||||
return
|
||||
1852
original/tools/OS/Output.vm
Normal file
806
original/tools/OS/Screen.vm
Normal file
@@ -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
|
||||
393
original/tools/OS/String.vm
Normal file
@@ -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
|
||||
83
original/tools/OS/Sys.vm
Normal file
@@ -0,0 +1,83 @@
|
||||
function Sys.init 0
|
||||
call Memory.init 0
|
||||
pop temp 0
|
||||
call Math.init 0
|
||||
pop temp 0
|
||||
call Screen.init 0
|
||||
pop temp 0
|
||||
call Output.init 0
|
||||
pop temp 0
|
||||
call Keyboard.init 0
|
||||
pop temp 0
|
||||
call Main.main 0
|
||||
pop temp 0
|
||||
call Sys.halt 0
|
||||
pop temp 0
|
||||
push constant 0
|
||||
return
|
||||
function Sys.halt 0
|
||||
label WHILE_EXP0
|
||||
push constant 0
|
||||
not
|
||||
not
|
||||
if-goto WHILE_END0
|
||||
goto WHILE_EXP0
|
||||
label WHILE_END0
|
||||
push constant 0
|
||||
return
|
||||
function Sys.wait 1
|
||||
push argument 0
|
||||
push constant 0
|
||||
lt
|
||||
if-goto IF_TRUE0
|
||||
goto IF_FALSE0
|
||||
label IF_TRUE0
|
||||
push constant 1
|
||||
call Sys.error 1
|
||||
pop temp 0
|
||||
label IF_FALSE0
|
||||
label WHILE_EXP0
|
||||
push argument 0
|
||||
push constant 0
|
||||
gt
|
||||
not
|
||||
if-goto WHILE_END0
|
||||
push constant 50
|
||||
pop local 0
|
||||
label WHILE_EXP1
|
||||
push local 0
|
||||
push constant 0
|
||||
gt
|
||||
not
|
||||
if-goto WHILE_END1
|
||||
push local 0
|
||||
push constant 1
|
||||
sub
|
||||
pop local 0
|
||||
goto WHILE_EXP1
|
||||
label WHILE_END1
|
||||
push argument 0
|
||||
push constant 1
|
||||
sub
|
||||
pop argument 0
|
||||
goto WHILE_EXP0
|
||||
label WHILE_END0
|
||||
push constant 0
|
||||
return
|
||||
function Sys.error 0
|
||||
push constant 69
|
||||
call Output.printChar 1
|
||||
pop temp 0
|
||||
push constant 82
|
||||
call Output.printChar 1
|
||||
pop temp 0
|
||||
push constant 82
|
||||
call Output.printChar 1
|
||||
pop temp 0
|
||||
push argument 0
|
||||
call Output.printInt 1
|
||||
pop temp 0
|
||||
call Sys.halt 0
|
||||
pop temp 0
|
||||
push constant 0
|
||||
return
|
||||
29
original/tools/TextComparer.bat
Normal file
@@ -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
|
||||
36
original/tools/TextComparer.sh
Normal file
@@ -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
|
||||
29
original/tools/VMEmulator.bat
Normal file
@@ -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
|
||||
33
original/tools/VMEmulator.sh
Normal file
@@ -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
|
||||
1
original/tools/bin/Assembler.dat
Normal file
@@ -0,0 +1 @@
|
||||
/Users/shimonschocken/Downloads/Add.asm
|
||||
1
original/tools/bin/CPU Emulator.dat
Normal file
@@ -0,0 +1 @@
|
||||
/Users/shimonschocken/Downloads
|
||||
1
original/tools/bin/Hardware Simulator.dat
Normal file
@@ -0,0 +1 @@
|
||||
/home/netalondon/Downloads/nand2tetris_new/projects/5
|
||||
1
original/tools/bin/Virtual Machine Emulator.dat
Normal file
@@ -0,0 +1 @@
|
||||
/home/netalondon/Downloads/nand2tetris_new/projects/8/ProgramFlow/BasicLoop
|
||||
BIN
original/tools/bin/classes/CPUEmulatorMain.class
Normal file
BIN
original/tools/bin/classes/HackAssemblerMain.class
Normal file
BIN
original/tools/bin/classes/HardwareSimulatorMain.class
Normal file
BIN
original/tools/bin/classes/TextComparer.class
Normal file
BIN
original/tools/bin/classes/VMEmulatorMain.class
Normal file
96
original/tools/bin/help/asmAbout.html
Normal file
@@ -0,0 +1,96 @@
|
||||
<html xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:w="urn:schemas-microsoft-com:office:word"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
|
||||
<head>
|
||||
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
|
||||
<meta name=ProgId content=Word.Document>
|
||||
<meta name=Generator content="Microsoft Word 10">
|
||||
<meta name=Originator content="Microsoft Word 10">
|
||||
<link rel=File-List href="asmAbout_files/filelist.xml">
|
||||
<title>About Assembler</title>
|
||||
<!--[if gte mso 9]><xml>
|
||||
<w:WordDocument>
|
||||
<w:GrammarState>Clean</w:GrammarState>
|
||||
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
|
||||
</w:WordDocument>
|
||||
</xml><![endif]-->
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
|
||||
{margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:13.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style>
|
||||
<!--[if gte mso 10]>
|
||||
<style>
|
||||
/* Style Definitions */
|
||||
table.MsoNormalTable
|
||||
{mso-style-name:"Table Normal";
|
||||
mso-tstyle-rowband-size:0;
|
||||
mso-tstyle-colband-size:0;
|
||||
mso-style-noshow:yes;
|
||||
mso-style-parent:"";
|
||||
mso-padding-alt:0in 5.4pt 0in 5.4pt;
|
||||
mso-para-margin:0in;
|
||||
mso-para-margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:10.0pt;
|
||||
font-family:"Times New Roman";}
|
||||
</style>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body lang=EN-US style='tab-interval:.5in'>
|
||||
|
||||
<div class=Section1>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><b><span
|
||||
style='font-size:12.0pt'>Assembler, Version 2.5</span></b></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'> </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'>This program is
|
||||
part of www.nand2tetris.org<o:p></o:p></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span class=GramE>and</span>
|
||||
the book "The Elements of Computing Systems"<o:p></o:p></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span class=GramE>by</span>
|
||||
Nisan and Schocken, MIT Press.</p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'> </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>Software Architects: Yaron Ukrainitz and Yannai A. Gonczarowski</span></p>
|
||||
|
||||
<p class=MsoNormal> </p>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
115
original/tools/bin/help/asmUsage.html
Normal file
@@ -0,0 +1,115 @@
|
||||
<html xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:w="urn:schemas-microsoft-com:office:word"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
|
||||
<head>
|
||||
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
|
||||
<meta name=ProgId content=Word.Document>
|
||||
<meta name=Generator content="Microsoft Word 11">
|
||||
<meta name=Originator content="Microsoft Word 11">
|
||||
<link rel=File-List href="asmUsage_files/filelist.xml">
|
||||
<title>Usage instruction and tips can be found in:</title>
|
||||
<!--[if gte mso 9]><xml>
|
||||
<w:WordDocument>
|
||||
<w:GrammarState>Clean</w:GrammarState>
|
||||
<w:ValidateAgainstSchemas/>
|
||||
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
|
||||
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
|
||||
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
|
||||
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
|
||||
</w:WordDocument>
|
||||
</xml><![endif]--><!--[if gte mso 9]><xml>
|
||||
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
|
||||
</w:LatentStyles>
|
||||
</xml><![endif]-->
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
|
||||
{margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:13.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:612.0pt 792.0pt;
|
||||
margin:72.0pt 90.0pt 72.0pt 90.0pt;
|
||||
mso-header-margin:36.0pt;
|
||||
mso-footer-margin:36.0pt;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style>
|
||||
<!--[if gte mso 10]>
|
||||
<style>
|
||||
/* Style Definitions */
|
||||
table.MsoNormalTable
|
||||
{mso-style-name:"Table Normal";
|
||||
mso-tstyle-rowband-size:0;
|
||||
mso-tstyle-colband-size:0;
|
||||
mso-style-noshow:yes;
|
||||
mso-style-parent:"";
|
||||
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
|
||||
mso-para-margin:0cm;
|
||||
mso-para-margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:10.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-ansi-language:#0400;
|
||||
mso-fareast-language:#0400;
|
||||
mso-bidi-language:#0400;}
|
||||
</style>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body lang=EN-US style='tab-interval:36.0pt'>
|
||||
|
||||
<div class=Section1>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>Usage instruction and tips can be found in:</span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'> </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><b><span
|
||||
style='font-size:12.0pt'>The Assembler Tutorial</span></b></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><b><span
|
||||
style='font-size:12.0pt'> </span></b></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>Available in www.nand2tetris.org</span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'> </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>And in relevant book chapters from </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><b><span
|
||||
style='font-size:12.0pt'>The Elements of Computing Systems,<o:p></o:p></span></b></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>by Noam Nisan and Shimon Schocken</span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>MIT Press</span></p>
|
||||
|
||||
<p class=MsoNormal> </p>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
9
original/tools/bin/help/compiler.txt
Normal file
@@ -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.
|
||||
96
original/tools/bin/help/cpuAbout.html
Normal file
@@ -0,0 +1,96 @@
|
||||
<html xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:w="urn:schemas-microsoft-com:office:word"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
|
||||
<head>
|
||||
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
|
||||
<meta name=ProgId content=Word.Document>
|
||||
<meta name=Generator content="Microsoft Word 10">
|
||||
<meta name=Originator content="Microsoft Word 10">
|
||||
<link rel=File-List href="cpuAbout_files/filelist.xml">
|
||||
<title>About CPU Emulator</title>
|
||||
<!--[if gte mso 9]><xml>
|
||||
<w:WordDocument>
|
||||
<w:GrammarState>Clean</w:GrammarState>
|
||||
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
|
||||
</w:WordDocument>
|
||||
</xml><![endif]-->
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
|
||||
{margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:13.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style>
|
||||
<!--[if gte mso 10]>
|
||||
<style>
|
||||
/* Style Definitions */
|
||||
table.MsoNormalTable
|
||||
{mso-style-name:"Table Normal";
|
||||
mso-tstyle-rowband-size:0;
|
||||
mso-tstyle-colband-size:0;
|
||||
mso-style-noshow:yes;
|
||||
mso-style-parent:"";
|
||||
mso-padding-alt:0in 5.4pt 0in 5.4pt;
|
||||
mso-para-margin:0in;
|
||||
mso-para-margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:10.0pt;
|
||||
font-family:"Times New Roman";}
|
||||
</style>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body lang=EN-US style='tab-interval:.5in'>
|
||||
|
||||
<div class=Section1>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><b><span
|
||||
style='font-size:12.0pt'>CPU Emulator, Version 2.5</span></b></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'> </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'>This program is
|
||||
part of www.nand2tetris.org<o:p></o:p></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span class=GramE>and</span>
|
||||
the book "The Elements of Computing Systems"<o:p></o:p></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span class=GramE>by</span>
|
||||
Nisan and Schocken, MIT Press.</p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'> </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>Software Architects: Yaron Ukrainitz and Yannai A. Gonczarowski</span></p>
|
||||
|
||||
<p class=MsoNormal> </p>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
115
original/tools/bin/help/cpuUsage.html
Normal file
@@ -0,0 +1,115 @@
|
||||
<html xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:w="urn:schemas-microsoft-com:office:word"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
|
||||
<head>
|
||||
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
|
||||
<meta name=ProgId content=Word.Document>
|
||||
<meta name=Generator content="Microsoft Word 11">
|
||||
<meta name=Originator content="Microsoft Word 11">
|
||||
<link rel=File-List href="cpuUsage_files/filelist.xml">
|
||||
<title>Usage instruction and tips can be found in:</title>
|
||||
<!--[if gte mso 9]><xml>
|
||||
<w:WordDocument>
|
||||
<w:GrammarState>Clean</w:GrammarState>
|
||||
<w:ValidateAgainstSchemas/>
|
||||
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
|
||||
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
|
||||
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
|
||||
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
|
||||
</w:WordDocument>
|
||||
</xml><![endif]--><!--[if gte mso 9]><xml>
|
||||
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
|
||||
</w:LatentStyles>
|
||||
</xml><![endif]-->
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
|
||||
{margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:13.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:612.0pt 792.0pt;
|
||||
margin:72.0pt 90.0pt 72.0pt 90.0pt;
|
||||
mso-header-margin:36.0pt;
|
||||
mso-footer-margin:36.0pt;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style>
|
||||
<!--[if gte mso 10]>
|
||||
<style>
|
||||
/* Style Definitions */
|
||||
table.MsoNormalTable
|
||||
{mso-style-name:"Table Normal";
|
||||
mso-tstyle-rowband-size:0;
|
||||
mso-tstyle-colband-size:0;
|
||||
mso-style-noshow:yes;
|
||||
mso-style-parent:"";
|
||||
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
|
||||
mso-para-margin:0cm;
|
||||
mso-para-margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:10.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-ansi-language:#0400;
|
||||
mso-fareast-language:#0400;
|
||||
mso-bidi-language:#0400;}
|
||||
</style>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body lang=EN-US style='tab-interval:36.0pt'>
|
||||
|
||||
<div class=Section1>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>Usage instruction and tips can be found in:</span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'> </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><b><span
|
||||
style='font-size:12.0pt'>The CPU Emulator Tutorial</span></b></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><b><span
|
||||
style='font-size:12.0pt'> </span></b></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>Available in www.nand2tetris.org</span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'> </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>And in relevant book chapters from </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><b><span
|
||||
style='font-size:12.0pt'>The Elements of Computing Systems,<o:p></o:p></span></b></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>by Noam Nisan and Shimon Schocken</span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>MIT Press</span></p>
|
||||
|
||||
<p class=MsoNormal> </p>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
96
original/tools/bin/help/hwAbout.html
Normal file
@@ -0,0 +1,96 @@
|
||||
<html xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:w="urn:schemas-microsoft-com:office:word"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
|
||||
<head>
|
||||
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
|
||||
<meta name=ProgId content=Word.Document>
|
||||
<meta name=Generator content="Microsoft Word 10">
|
||||
<meta name=Originator content="Microsoft Word 10">
|
||||
<link rel=File-List href="hwAbout_files/filelist.xml">
|
||||
<title>About Hardware Simulator</title>
|
||||
<!--[if gte mso 9]><xml>
|
||||
<w:WordDocument>
|
||||
<w:GrammarState>Clean</w:GrammarState>
|
||||
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
|
||||
</w:WordDocument>
|
||||
</xml><![endif]-->
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
|
||||
{margin:0in;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:13.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:8.5in 11.0in;
|
||||
margin:1.0in 1.25in 1.0in 1.25in;
|
||||
mso-header-margin:.5in;
|
||||
mso-footer-margin:.5in;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style>
|
||||
<!--[if gte mso 10]>
|
||||
<style>
|
||||
/* Style Definitions */
|
||||
table.MsoNormalTable
|
||||
{mso-style-name:"Table Normal";
|
||||
mso-tstyle-rowband-size:0;
|
||||
mso-tstyle-colband-size:0;
|
||||
mso-style-noshow:yes;
|
||||
mso-style-parent:"";
|
||||
mso-padding-alt:0in 5.4pt 0in 5.4pt;
|
||||
mso-para-margin:0in;
|
||||
mso-para-margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:10.0pt;
|
||||
font-family:"Times New Roman";}
|
||||
</style>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body lang=EN-US style='tab-interval:.5in'>
|
||||
|
||||
<div class=Section1>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><b><span
|
||||
style='font-size:12.0pt'>Hardware Simulator, Version 2.5</span></b></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'> </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'>This program is
|
||||
part of www.nand2tetris.org<o:p></o:p></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span class=GramE>and</span>
|
||||
the book "The Elements of Computing Systems"<o:p></o:p></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span class=GramE>by</span>
|
||||
Nisan and Schocken, MIT Press.</p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'> </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>Software Architects: Yaron Ukrainitz and Yannai A. Gonczarowski</span></p>
|
||||
|
||||
<p class=MsoNormal> </p>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
115
original/tools/bin/help/hwUsage.html
Normal file
@@ -0,0 +1,115 @@
|
||||
<html xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:w="urn:schemas-microsoft-com:office:word"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
|
||||
<head>
|
||||
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
|
||||
<meta name=ProgId content=Word.Document>
|
||||
<meta name=Generator content="Microsoft Word 11">
|
||||
<meta name=Originator content="Microsoft Word 11">
|
||||
<link rel=File-List href="hwUsage_files/filelist.xml">
|
||||
<title>Usage instruction and tips can be found in:</title>
|
||||
<!--[if gte mso 9]><xml>
|
||||
<w:WordDocument>
|
||||
<w:GrammarState>Clean</w:GrammarState>
|
||||
<w:ValidateAgainstSchemas/>
|
||||
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
|
||||
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
|
||||
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
|
||||
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
|
||||
</w:WordDocument>
|
||||
</xml><![endif]--><!--[if gte mso 9]><xml>
|
||||
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
|
||||
</w:LatentStyles>
|
||||
</xml><![endif]-->
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
|
||||
{margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:13.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:612.0pt 792.0pt;
|
||||
margin:72.0pt 90.0pt 72.0pt 90.0pt;
|
||||
mso-header-margin:36.0pt;
|
||||
mso-footer-margin:36.0pt;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style>
|
||||
<!--[if gte mso 10]>
|
||||
<style>
|
||||
/* Style Definitions */
|
||||
table.MsoNormalTable
|
||||
{mso-style-name:"Table Normal";
|
||||
mso-tstyle-rowband-size:0;
|
||||
mso-tstyle-colband-size:0;
|
||||
mso-style-noshow:yes;
|
||||
mso-style-parent:"";
|
||||
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
|
||||
mso-para-margin:0cm;
|
||||
mso-para-margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:10.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-ansi-language:#0400;
|
||||
mso-fareast-language:#0400;
|
||||
mso-bidi-language:#0400;}
|
||||
</style>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body lang=EN-US style='tab-interval:36.0pt'>
|
||||
|
||||
<div class=Section1>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>Usage instruction and tips can be found in:</span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'> </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><b><span
|
||||
style='font-size:12.0pt'>The Hardware Simulator Tutorial</span></b></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><b><span
|
||||
style='font-size:12.0pt'> </span></b></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>Available in www.nand2tetris.org</span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'> </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>And in relevant book chapters from </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><b><span
|
||||
style='font-size:12.0pt'>The Elements of Computing Systems,<o:p></o:p></span></b></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>by Noam Nisan and Shimon Schocken</span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>MIT Press</span></p>
|
||||
|
||||
<p class=MsoNormal> </p>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
110
original/tools/bin/help/vmAbout.html
Normal file
@@ -0,0 +1,110 @@
|
||||
<html xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:w="urn:schemas-microsoft-com:office:word"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
|
||||
<head>
|
||||
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
|
||||
<meta name=ProgId content=Word.Document>
|
||||
<meta name=Generator content="Microsoft Word 11">
|
||||
<meta name=Originator content="Microsoft Word 11">
|
||||
<link rel=File-List href="vmAbout_files/filelist.xml">
|
||||
<title>About Virtual Machine Emulator</title>
|
||||
<!--[if gte mso 9]><xml>
|
||||
<w:WordDocument>
|
||||
<w:GrammarState>Clean</w:GrammarState>
|
||||
<w:ValidateAgainstSchemas/>
|
||||
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
|
||||
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
|
||||
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
|
||||
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
|
||||
</w:WordDocument>
|
||||
</xml><![endif]--><!--[if gte mso 9]><xml>
|
||||
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
|
||||
</w:LatentStyles>
|
||||
</xml><![endif]-->
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
|
||||
{margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:13.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
span.GramE
|
||||
{mso-style-name:"";
|
||||
mso-gram-e:yes;}
|
||||
@page Section1
|
||||
{size:612.0pt 792.0pt;
|
||||
margin:72.0pt 90.0pt 72.0pt 90.0pt;
|
||||
mso-header-margin:36.0pt;
|
||||
mso-footer-margin:36.0pt;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style>
|
||||
<!--[if gte mso 10]>
|
||||
<style>
|
||||
/* Style Definitions */
|
||||
table.MsoNormalTable
|
||||
{mso-style-name:"Table Normal";
|
||||
mso-tstyle-rowband-size:0;
|
||||
mso-tstyle-colband-size:0;
|
||||
mso-style-noshow:yes;
|
||||
mso-style-parent:"";
|
||||
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
|
||||
mso-para-margin:0cm;
|
||||
mso-para-margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:10.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-ansi-language:#0400;
|
||||
mso-fareast-language:#0400;
|
||||
mso-bidi-language:#0400;}
|
||||
</style>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body lang=EN-US style='tab-interval:36.0pt'>
|
||||
|
||||
<div class=Section1>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><b><span
|
||||
style='font-size:12.0pt'>Virtual Machine Emulator, Version 2.5</span></b></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'> </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'>This program is
|
||||
part of www.nand2tetris.org<o:p></o:p></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span class=GramE>and</span>
|
||||
the book "The Elements of Computing Systems"<o:p></o:p></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span class=GramE>by</span>
|
||||
Nisan and Schocken, MIT Press.</p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'> </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>Software Architects: Yaron Ukrainitz and Yannai A.
|
||||
Gonczarowski</span></p>
|
||||
|
||||
<p class=MsoNormal> </p>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
115
original/tools/bin/help/vmUsage.html
Normal file
@@ -0,0 +1,115 @@
|
||||
<html xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:w="urn:schemas-microsoft-com:office:word"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
|
||||
<head>
|
||||
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
|
||||
<meta name=ProgId content=Word.Document>
|
||||
<meta name=Generator content="Microsoft Word 11">
|
||||
<meta name=Originator content="Microsoft Word 11">
|
||||
<link rel=File-List href="vmUsage_files/filelist.xml">
|
||||
<title>Usage instruction and tips can be found in:</title>
|
||||
<!--[if gte mso 9]><xml>
|
||||
<w:WordDocument>
|
||||
<w:GrammarState>Clean</w:GrammarState>
|
||||
<w:ValidateAgainstSchemas/>
|
||||
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
|
||||
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
|
||||
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
|
||||
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
|
||||
</w:WordDocument>
|
||||
</xml><![endif]--><!--[if gte mso 9]><xml>
|
||||
<w:LatentStyles DefLockedState="false" LatentStyleCount="156">
|
||||
</w:LatentStyles>
|
||||
</xml><![endif]-->
|
||||
<style>
|
||||
<!--
|
||||
/* Style Definitions */
|
||||
p.MsoNormal, li.MsoNormal, div.MsoNormal
|
||||
{mso-style-parent:"";
|
||||
margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:12.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
p.MsoBodyText, li.MsoBodyText, div.MsoBodyText
|
||||
{margin:0cm;
|
||||
margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:13.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-fareast-font-family:"Times New Roman";}
|
||||
@page Section1
|
||||
{size:612.0pt 792.0pt;
|
||||
margin:72.0pt 90.0pt 72.0pt 90.0pt;
|
||||
mso-header-margin:36.0pt;
|
||||
mso-footer-margin:36.0pt;
|
||||
mso-paper-source:0;}
|
||||
div.Section1
|
||||
{page:Section1;}
|
||||
-->
|
||||
</style>
|
||||
<!--[if gte mso 10]>
|
||||
<style>
|
||||
/* Style Definitions */
|
||||
table.MsoNormalTable
|
||||
{mso-style-name:"Table Normal";
|
||||
mso-tstyle-rowband-size:0;
|
||||
mso-tstyle-colband-size:0;
|
||||
mso-style-noshow:yes;
|
||||
mso-style-parent:"";
|
||||
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
|
||||
mso-para-margin:0cm;
|
||||
mso-para-margin-bottom:.0001pt;
|
||||
mso-pagination:widow-orphan;
|
||||
font-size:10.0pt;
|
||||
font-family:"Times New Roman";
|
||||
mso-ansi-language:#0400;
|
||||
mso-fareast-language:#0400;
|
||||
mso-bidi-language:#0400;}
|
||||
</style>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body lang=EN-US style='tab-interval:36.0pt'>
|
||||
|
||||
<div class=Section1>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>Usage instruction and tips can be found in:</span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'> </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><b><span
|
||||
style='font-size:12.0pt'>The VM Emulator Tutorial</span></b></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><b><span
|
||||
style='font-size:12.0pt'> </span></b></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>Available in www.nand2tetris.org</span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'> </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>And in relevant book chapters from </span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><b><span
|
||||
style='font-size:12.0pt'>The Elements of Computing Systems,<o:p></o:p></span></b></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>by Noam Nisan and Shimon Schocken<b><o:p></o:p></b></span></p>
|
||||
|
||||
<p class=MsoBodyText align=center style='text-align:center'><span
|
||||
style='font-size:12.0pt'>MIT Press</span></p>
|
||||
|
||||
<p class=MsoNormal> </p>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
BIN
original/tools/bin/images/arrow2.gif
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
original/tools/bin/images/calculator2.gif
Normal file
|
After Width: | Height: | Size: 302 B |
BIN
original/tools/bin/images/cancel.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
original/tools/bin/images/chip.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
original/tools/bin/images/clock2.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
original/tools/bin/images/equal.gif
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
original/tools/bin/images/find.gif
Normal file
|
After Width: | Height: | Size: 1014 B |
BIN
original/tools/bin/images/hex.gif
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
original/tools/bin/images/keyboard.gif
Normal file
|
After Width: | Height: | Size: 1017 B |
BIN
original/tools/bin/images/ok.gif
Normal file
|
After Width: | Height: | Size: 988 B |
BIN
original/tools/bin/images/ok2.gif
Normal file
|
After Width: | Height: | Size: 920 B |
BIN
original/tools/bin/images/open.gif
Normal file
|
After Width: | Height: | Size: 930 B |
BIN
original/tools/bin/images/open2.gif
Normal file
|
After Width: | Height: | Size: 969 B |
BIN
original/tools/bin/images/opendoc.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
original/tools/bin/images/redflag.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
original/tools/bin/images/save.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
original/tools/bin/images/scroll.gif
Normal file
|
After Width: | Height: | Size: 949 B |
BIN
original/tools/bin/images/smallcancel.gif
Normal file
|
After Width: | Height: | Size: 946 B |
BIN
original/tools/bin/images/smallequal.gif
Normal file
|
After Width: | Height: | Size: 898 B |
BIN
original/tools/bin/images/smallminus.gif
Normal file
|
After Width: | Height: | Size: 863 B |
BIN
original/tools/bin/images/smallnew.gif
Normal file
|
After Width: | Height: | Size: 1000 B |
BIN
original/tools/bin/images/smallok.gif
Normal file
|
After Width: | Height: | Size: 925 B |
BIN
original/tools/bin/images/smallplus.gif
Normal file
|
After Width: | Height: | Size: 873 B |
BIN
original/tools/bin/images/vcrfastforward.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
original/tools/bin/images/vcrforward.gif
Normal file
|
After Width: | Height: | Size: 1021 B |
BIN
original/tools/bin/images/vcrrewind.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
original/tools/bin/images/vcrstop.gif
Normal file
|
After Width: | Height: | Size: 972 B |
BIN
original/tools/bin/lib/AssemblerGUI.jar
Normal file
BIN
original/tools/bin/lib/Compilers.jar
Normal file
BIN
original/tools/bin/lib/Hack.jar
Normal file
BIN
original/tools/bin/lib/HackGUI.jar
Normal file
BIN
original/tools/bin/lib/Simulators.jar
Normal file
BIN
original/tools/bin/lib/SimulatorsGUI.jar
Normal file
BIN
original/tools/bin/lib/TranslatorsGUI.jar
Normal file
3
original/tools/bin/scripts/defaultCPU.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
repeat {
|
||||
ticktock;
|
||||
}
|
||||
4
original/tools/bin/scripts/defaultHW.txt
Normal file
@@ -0,0 +1,4 @@
|
||||
repeat {
|
||||
tick,
|
||||
tock;
|
||||
}
|
||||
3
original/tools/bin/scripts/defaultVM.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
repeat {
|
||||
vmstep;
|
||||
}
|
||||
BIN
original/tools/builtInChips/ALU.class
Normal file
49
original/tools/builtInChips/ALU.hdl
Normal file
@@ -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: tools/builtInChips/ALU.hdl
|
||||
/**
|
||||
* ALU (Arithmetic Logic Unit):
|
||||
* Computes out = one of the following functions:
|
||||
* 0, 1, -1,
|
||||
* x, y, !x, !y, -x, -y,
|
||||
* x + 1, y + 1, x - 1, y - 1,
|
||||
* x + y, x - y, y - x,
|
||||
* x & y, x | y
|
||||
* on the 16-bit inputs x, y,
|
||||
* according to the input bits zx, nx, zy, ny, f, no.
|
||||
* In addition, computes the output bits:
|
||||
* zr = (out == 0, 1, 0)
|
||||
* ng = (out < 0, 1, 0)
|
||||
*/
|
||||
// Implementation: Manipulates the x and y inputs
|
||||
// and 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
|
||||
|
||||
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;
|
||||
}
|
||||
BIN
original/tools/builtInChips/ARegister.class
Normal file
22
original/tools/builtInChips/ARegister.hdl
Normal file
@@ -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/builtInChips/ARegister.hdl
|
||||
/**
|
||||
* A 16-bit register named ARegister with the same functionality
|
||||
* of the Register chip:
|
||||
* If load is asserted, the register's value is set to in;
|
||||
* Otherwise, the register maintains its current value.
|
||||
* out(t+1) = (load(t), in(t), out(t))
|
||||
*
|
||||
* This built-in implementation has a visualization side effect.
|
||||
*/
|
||||
CHIP ARegister {
|
||||
|
||||
IN in[16], load;
|
||||
OUT out[16];
|
||||
|
||||
BUILTIN ARegister;
|
||||
CLOCKED in, load;
|
||||
}
|
||||
|
||||
BIN
original/tools/builtInChips/Add16.class
Normal file
16
original/tools/builtInChips/Add16.hdl
Normal file
@@ -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/builtInChips/Add16.hdl
|
||||
/**
|
||||
* 16-bit adder: Adds two 16-bit two's complement values.
|
||||
* The most significant carry bit is ignored.
|
||||
*/
|
||||
CHIP Add16 {
|
||||
|
||||
IN a[16], b[16];
|
||||
OUT out[16];
|
||||
|
||||
BUILTIN Add16;
|
||||
}
|
||||
|
||||
BIN
original/tools/builtInChips/And.class
Normal file
15
original/tools/builtInChips/And.hdl
Normal file
@@ -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: tools/builtInChips/And.hdl
|
||||
/**
|
||||
* And gate:
|
||||
* out = (((a == 1) && (b == 1))), 1, 0)
|
||||
*/
|
||||
CHIP And {
|
||||
|
||||
IN a, b;
|
||||
OUT out;
|
||||
|
||||
BUILTIN And;
|
||||
}
|
||||
16
original/tools/builtInChips/And16.hdl
Normal file
@@ -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/builtInChips/And16.hdl
|
||||
/**
|
||||
* 16-bit bitwise And gate:
|
||||
* out[i] = And(a[i],b[i]) for i = 0..15
|
||||
*/
|
||||
CHIP And16 {
|
||||
|
||||
IN a[16], b[16];
|
||||
OUT out[16];
|
||||
|
||||
BUILTIN And;
|
||||
}
|
||||
|
||||
BIN
original/tools/builtInChips/Bit.class
Normal file
18
original/tools/builtInChips/Bit.hdl
Normal file
@@ -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/builtInChips/Bit.hdl
|
||||
/**
|
||||
* 1-bit register:
|
||||
* If load is asserted, the register's value is set to in;
|
||||
* Otherwise, the register maintains its current value.
|
||||
* out(t+1) = (load(t), in(t), out(t))
|
||||
*/
|
||||
CHIP Bit {
|
||||
|
||||
IN in, load;
|
||||
OUT out;
|
||||
|
||||
BUILTIN Bit;
|
||||
CLOCKED in, load;
|
||||
}
|
||||
BIN
original/tools/builtInChips/DFF.class
Normal file
16
original/tools/builtInChips/DFF.hdl
Normal file
@@ -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/builtInChips/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;
|
||||
}
|
||||
BIN
original/tools/builtInChips/DMux.class
Normal file
16
original/tools/builtInChips/DMux.hdl
Normal file
@@ -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/builtInChips/DMux.hdl
|
||||
/**
|
||||
* Demultiplexor:
|
||||
* [a, b] = ((sel == 0), [in, 0], [0, in])
|
||||
*/
|
||||
CHIP DMux {
|
||||
|
||||
IN in, sel;
|
||||
OUT a, b;
|
||||
|
||||
BUILTIN DMux;
|
||||
}
|
||||
|
||||
BIN
original/tools/builtInChips/DMux4Way.class
Normal file
19
original/tools/builtInChips/DMux4Way.hdl
Normal file
@@ -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/builtInChips/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;
|
||||
}
|
||||
|
||||
BIN
original/tools/builtInChips/DMux8Way.class
Normal file
19
original/tools/builtInChips/DMux8Way.hdl
Normal file
@@ -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/builtInChips/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
|
||||
* ...
|
||||
* [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;
|
||||
}
|
||||
|
||||
BIN
original/tools/builtInChips/DRegister.class
Normal file
22
original/tools/builtInChips/DRegister.hdl
Normal file
@@ -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/builtInChips/DRegister.hdl
|
||||
/**
|
||||
* A 16-bit register named DRegister with the same functionality
|
||||
* of the Register chip:
|
||||
* If load is asserted, the register's value is set to in;
|
||||
* Otherwise, the register maintains its current value.
|
||||
* out(t+1) = (load(t), in(t), out(t))
|
||||
*
|
||||
* This built-in implementation has a visualization side effect.
|
||||
*/
|
||||
CHIP DRegister {
|
||||
|
||||
IN in[16], load;
|
||||
OUT out[16];
|
||||
|
||||
BUILTIN DRegister;
|
||||
CLOCKED in, load;
|
||||
}
|
||||
|
||||
BIN
original/tools/builtInChips/FullAdder.class
Normal file
16
original/tools/builtInChips/FullAdder.hdl
Normal file
@@ -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/builtInChips/FullAdder.hdl
|
||||
/**
|
||||
* Computes the sum of three bits.
|
||||
*/
|
||||
CHIP FullAdder {
|
||||
|
||||
IN a, b, c;
|
||||
OUT sum, // LSB of a + b + c
|
||||
carry; // MSB of a + b + c
|
||||
|
||||
BUILTIN FullAdder;
|
||||
}
|
||||
|
||||
BIN
original/tools/builtInChips/HalfAdder.class
Normal file
15
original/tools/builtInChips/HalfAdder.hdl
Normal file
@@ -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: tools/builtInChips/HalfAdder.hdl
|
||||
/**
|
||||
* Computes the sum of two bits.
|
||||
*/
|
||||
CHIP HalfAdder {
|
||||
|
||||
IN a, b;
|
||||
OUT sum, // LSB of a + b
|
||||
carry; // MSB of a + b
|
||||
|
||||
BUILTIN HalfAdder;
|
||||
}
|
||||