aboutsummaryrefslogtreecommitdiff
path: root/projects/07/StackArithmetic/SimpleAdd
diff options
context:
space:
mode:
authorYuchen Pei <me@ypei.me>2018-01-02 15:49:12 +0100
committerYuchen Pei <me@ypei.me>2018-01-02 15:49:12 +0100
commit381e730b9b4f07eec97865ed94cff4c189c39ad1 (patch)
treeba1c77b83afb0c654e25f3c914f544fe5fe56e0c /projects/07/StackArithmetic/SimpleAdd
parente91518a763157acad4ed3542ac16a46223038c87 (diff)
finished first part of project 7
Diffstat (limited to 'projects/07/StackArithmetic/SimpleAdd')
-rw-r--r--projects/07/StackArithmetic/SimpleAdd/SimpleAdd.asm32
-rw-r--r--projects/07/StackArithmetic/SimpleAdd/SimpleAdd.out2
2 files changed, 34 insertions, 0 deletions
diff --git a/projects/07/StackArithmetic/SimpleAdd/SimpleAdd.asm b/projects/07/StackArithmetic/SimpleAdd/SimpleAdd.asm
new file mode 100644
index 0000000..faa8af7
--- /dev/null
+++ b/projects/07/StackArithmetic/SimpleAdd/SimpleAdd.asm
@@ -0,0 +1,32 @@
+@256
+D=A
+@SP
+M=D
+@7
+D=A
+@SP
+A=M
+M=D
+@SP
+M=M+1
+@8
+D=A
+@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
+(END)
+@END
+0;JMP \ No newline at end of file
diff --git a/projects/07/StackArithmetic/SimpleAdd/SimpleAdd.out b/projects/07/StackArithmetic/SimpleAdd/SimpleAdd.out
new file mode 100644
index 0000000..6b3b20e
--- /dev/null
+++ b/projects/07/StackArithmetic/SimpleAdd/SimpleAdd.out
@@ -0,0 +1,2 @@
+| RAM[0] | RAM[256] |
+| 257 | 15 |