aboutsummaryrefslogtreecommitdiff
path: root/projects/08/FunctionCalls
diff options
context:
space:
mode:
authorYuchen Pei <me@ypei.me>2018-01-05 16:50:11 +0100
committerYuchen Pei <me@ypei.me>2018-01-05 16:50:11 +0100
commit19cf47dd1c6e9d7c265ed52270eebd9095b49a8c (patch)
tree000ed18a3733b4f743d8e62a68129049521064a8 /projects/08/FunctionCalls
parent0b1849231f9fbd5b6ab44dfb8c831a3893996dfb (diff)
checkpoint: refactored project08 code
Diffstat (limited to 'projects/08/FunctionCalls')
-rw-r--r--projects/08/FunctionCalls/SimpleFunction/SimpleFunction1.asm137
1 files changed, 137 insertions, 0 deletions
diff --git a/projects/08/FunctionCalls/SimpleFunction/SimpleFunction1.asm b/projects/08/FunctionCalls/SimpleFunction/SimpleFunction1.asm
new file mode 100644
index 0000000..7fe71a5
--- /dev/null
+++ b/projects/08/FunctionCalls/SimpleFunction/SimpleFunction1.asm
@@ -0,0 +1,137 @@
+(SimpleFunction.test)
+@SP
+A=M
+M=0
+@SP
+M=M+1
+@SP
+A=M
+M=0
+@SP
+M=M+1
+@LCL
+D=M
+@0
+D=A+D
+A=D
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@LCL
+D=M
+@1
+D=A+D
+A=D
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+AM=M-1
+D=M
+@SP
+AM=M-1
+D=M+D
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+AM=M-1
+D=M
+@SP
+A=M
+M=!D
+@SP
+M=M+1
+@ARG
+D=M
+@0
+D=A+D
+A=D
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+AM=M-1
+D=M
+@SP
+AM=M-1
+D=M+D
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@ARG
+D=M
+@1
+D=A+D
+A=D
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+AM=M-1
+D=M
+@SP
+AM=M-1
+D=M-D
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@LCL
+D=M
+@R13
+M=D
+@SP
+AM=M-1
+D=M
+@ARG
+A=M
+M=D
+@ARG
+D=M+1
+@SP
+M=D
+@R13
+AM=M-1
+D=M
+@THAT
+M=D
+@R13
+AM=M-1
+D=M
+@THIS
+M=D
+@R13
+AM=M-1
+D=M
+@ARG
+M=D
+@R13
+AM=M-1
+D=M
+@LCL
+M=D
+@R13
+A=M-1
+A=M
+0;JMP
+(END)
+@END
+0;JMP \ No newline at end of file