about summary refs log tree commit diff
path: root/lang/mips/chapter-2/exercise-1/q.s
blob: 47069cdf2c720c4ecabbb6a3dc109b8820dd8f4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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