summaryrefslogtreecommitdiff
path: root/projects/07/MemoryAccess
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2022-08-22 17:04:49 +0800
committerFrederick Yin <fkfd@fkfd.me>2022-08-22 17:04:49 +0800
commit21c58570d3897f1f480b6cf6c572c350e7a0dd95 (patch)
treeeed5ff515d322439ab843e009b00faed0e30e9c8 /projects/07/MemoryAccess
parent10c9f64f592198d78aad11ebc676629d92ca6576 (diff)
Output assembly files in project 07
Diffstat (limited to 'projects/07/MemoryAccess')
-rw-r--r--projects/07/MemoryAccess/BasicTest/BasicTest.asm237
-rw-r--r--projects/07/MemoryAccess/PointerTest/PointerTest.asm125
-rw-r--r--projects/07/MemoryAccess/StaticTest/StaticTest.asm70
3 files changed, 432 insertions, 0 deletions
diff --git a/projects/07/MemoryAccess/BasicTest/BasicTest.asm b/projects/07/MemoryAccess/BasicTest/BasicTest.asm
new file mode 100644
index 0000000..3f567b8
--- /dev/null
+++ b/projects/07/MemoryAccess/BasicTest/BasicTest.asm
@@ -0,0 +1,237 @@
+@10
+D=A
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@0
+D=A
+@LCL
+M=M+D
+@SP
+M=M-1
+A=M
+D=M
+@LCL
+A=M
+M=D
+@0
+D=A
+@LCL
+M=M-D
+@21
+D=A
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@22
+D=A
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@2
+D=A
+@ARG
+M=M+D
+@SP
+M=M-1
+A=M
+D=M
+@ARG
+A=M
+M=D
+@2
+D=A
+@ARG
+M=M-D
+@1
+D=A
+@ARG
+M=M+D
+@SP
+M=M-1
+A=M
+D=M
+@ARG
+A=M
+M=D
+@1
+D=A
+@ARG
+M=M-D
+@36
+D=A
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@6
+D=A
+@THIS
+M=M+D
+@SP
+M=M-1
+A=M
+D=M
+@THIS
+A=M
+M=D
+@6
+D=A
+@THIS
+M=M-D
+@42
+D=A
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@45
+D=A
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@5
+D=A
+@THAT
+M=M+D
+@SP
+M=M-1
+A=M
+D=M
+@THAT
+A=M
+M=D
+@5
+D=A
+@THAT
+M=M-D
+@2
+D=A
+@THAT
+M=M+D
+@SP
+M=M-1
+A=M
+D=M
+@THAT
+A=M
+M=D
+@2
+D=A
+@THAT
+M=M-D
+@510
+D=A
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+M=M-1
+A=M
+D=M
+@11
+M=D
+@LCL
+D=M
+@0
+A=D+A
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@THAT
+D=M
+@5
+A=D+A
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+M=M-1
+A=M
+D=M
+@SP
+A=M-1
+M=D+M
+@ARG
+D=M
+@1
+A=D+A
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+M=M-1
+A=M
+D=M
+@SP
+A=M-1
+M=M-D
+@THIS
+D=M
+@6
+A=D+A
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@THIS
+D=M
+@6
+A=D+A
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+M=M-1
+A=M
+D=M
+@SP
+A=M-1
+M=D+M
+@SP
+M=M-1
+A=M
+D=M
+@SP
+A=M-1
+M=M-D
+@11
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+M=M-1
+A=M
+D=M
+@SP
+A=M-1
+M=D+M
diff --git a/projects/07/MemoryAccess/PointerTest/PointerTest.asm b/projects/07/MemoryAccess/PointerTest/PointerTest.asm
new file mode 100644
index 0000000..9511e12
--- /dev/null
+++ b/projects/07/MemoryAccess/PointerTest/PointerTest.asm
@@ -0,0 +1,125 @@
+@3030
+D=A
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+M=M-1
+A=M
+D=M
+@THIS
+M=D
+@3040
+D=A
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+M=M-1
+A=M
+D=M
+@THAT
+M=D
+@32
+D=A
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@2
+D=A
+@THIS
+M=M+D
+@SP
+M=M-1
+A=M
+D=M
+@THIS
+A=M
+M=D
+@2
+D=A
+@THIS
+M=M-D
+@46
+D=A
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@6
+D=A
+@THAT
+M=M+D
+@SP
+M=M-1
+A=M
+D=M
+@THAT
+A=M
+M=D
+@6
+D=A
+@THAT
+M=M-D
+@THIS
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@THAT
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+M=M-1
+A=M
+D=M
+@SP
+A=M-1
+M=D+M
+@THIS
+D=M
+@2
+A=D+A
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+M=M-1
+A=M
+D=M
+@SP
+A=M-1
+M=M-D
+@THAT
+D=M
+@6
+A=D+A
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+M=M-1
+A=M
+D=M
+@SP
+A=M-1
+M=D+M
diff --git a/projects/07/MemoryAccess/StaticTest/StaticTest.asm b/projects/07/MemoryAccess/StaticTest/StaticTest.asm
new file mode 100644
index 0000000..48aaacd
--- /dev/null
+++ b/projects/07/MemoryAccess/StaticTest/StaticTest.asm
@@ -0,0 +1,70 @@
+@111
+D=A
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@333
+D=A
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@888
+D=A
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+M=M-1
+A=M
+D=M
+@StaticTest.8
+M=D
+@SP
+M=M-1
+A=M
+D=M
+@StaticTest.3
+M=D
+@SP
+M=M-1
+A=M
+D=M
+@StaticTest.1
+M=D
+@StaticTest.3
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@StaticTest.1
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+AM=M-1
+D=M
+A=A-1
+M=M-D
+@StaticTest.8
+D=M
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@SP
+AM=M-1
+D=M
+A=A-1
+M=D+M