about summary refs log tree commit diff
path: root/lang/mips/chapter-2/exercise-1/e.s
diff options
context:
space:
mode:
Diffstat (limited to 'lang/mips/chapter-2/exercise-1/e.s')
-rw-r--r--lang/mips/chapter-2/exercise-1/e.s18
1 files changed, 18 insertions, 0 deletions
diff --git a/lang/mips/chapter-2/exercise-1/e.s b/lang/mips/chapter-2/exercise-1/e.s
new file mode 100644
index 0000000..d35702d
--- /dev/null
+++ b/lang/mips/chapter-2/exercise-1/e.s
@@ -0,0 +1,18 @@
+# read to and echo t0
+	.text
+main:
+	li	$v0,	5		# read integer to v0
+	syscall
+
+	move	$t0,	$v0		# t0 = v0
+
+	li	$v0,	1		# print integer
+	move	$a0,	$t0		# at t0
+	syscall
+
+	li	$v0,	11		# print character
+	li	$a0,	10		# newline
+	syscall
+
+	li	$v0,	10		# terminate program run
+	syscall