diff options
Diffstat (limited to 'mips/chapter-2/exercise-1/q.s')
-rw-r--r-- | mips/chapter-2/exercise-1/q.s | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mips/chapter-2/exercise-1/q.s b/mips/chapter-2/exercise-1/q.s new file mode 100644 index 0000000..47069cd --- /dev/null +++ b/mips/chapter-2/exercise-1/q.s @@ -0,0 +1,20 @@ +# s3 = s1 - s2 / s3 + .text +main: + li $s1, 69 # s1 = 69 + li $s2, 20 # s2 = 20 + li $s3, 4 # s3 = 4 + + div $s3, $s2, $s3 # s3 = s2 / s3 + sub $s3, $s1, $s3 # s3 = s1 - s3 + + li $v0, 1 # print integer + move $a0, $s3 # at s3 + syscall + + li $v0, 11 # print character + li $a0, 10 # newline + syscall + + li $v0, 10 # terminate program run + syscall |