aboutsummaryrefslogtreecommitdiff
path: root/projects/07/StackArithmetic/SimpleAdd
diff options
context:
space:
mode:
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 |