about summary refs log tree commit diff
path: root/lang/mips/chapter-2/exercise-1/b.s
diff options
context:
space:
mode:
Diffstat (limited to 'lang/mips/chapter-2/exercise-1/b.s')
-rw-r--r--lang/mips/chapter-2/exercise-1/b.s19
1 files changed, 19 insertions, 0 deletions
diff --git a/lang/mips/chapter-2/exercise-1/b.s b/lang/mips/chapter-2/exercise-1/b.s
new file mode 100644
index 0000000..fa590b5
--- /dev/null
+++ b/lang/mips/chapter-2/exercise-1/b.s
@@ -0,0 +1,19 @@
+# s3 = t2 / (s1 - 54321)
+	.text
+main:
+	li	$t2,	69		# t2 = 69
+	li	$s1,	54324		# s1 = 54324
+
+	sub	$s1,	$s1,	54321	# s1 -= 54321
+	div	$t3,	$t2,	$s1	# t3 = t2 / s1
+
+	li	$v0,	1		# print integer
+	move	$a0,	$t3		# at a0
+	syscall
+
+	li	$v0,	11		# print character
+	li	$a0,	10		# newline
+	syscall
+
+	li	$v0,	10		# terminate program run
+	syscall