-
Notifications
You must be signed in to change notification settings - Fork 0
/
result.s
175 lines (110 loc) · 1.55 KB
/
result.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
.data
string0: .asciiz"a = "
string3: .asciiz"a+b = "
string4: .asciiz"a-b = "
string5: .asciiz"a*b = "
string6: .asciiz"a/b = "
string7: .asciiz"a>b = "
string8: .asciiz"a<b = "
string9: .asciiz"a>=b = "
string10: .asciiz"a<=b = "
string11: .asciiz"true&&true = "
.globl main
.text
main:
addiu $sp, $sp, -24
sw $ra, 0($sp)
li $t0, 10
sw $t0, 4($sp)
li $t0, 20
sw $t0, 8($sp)
li $t0, 0
li $t0, 0
li.s $f0, 10
s.s $f0, 20($sp)
la $a0, string0
li $v0, 4
syscall
lw $t0, 12($sp)
lw $t1, 16($sp)
addi $t0, $zero, 0
beq $t0, $t0, finalLabel2
beq $t1, $t0, finalLabel2
label1:
addi $t0, $zero, 1
finalLabel2:
la $a0, $t0
li $v0, 4
syscall
la $a0, string3
li $v0, 4
syscall
lw $t0, 4($sp)
move $a0, $t0
li $v0, 1
syscall
la $a0, string4
li $v0, 4
syscall
la $a0, string5
li $v0, 4
syscall
lw $t0, 4($sp)
lw $t1, 8($sp)
mult $t0, $t1
mflo $t0
move $a0, $t0
li $v0, 1
syscall
la $a0, string6
li $v0, 4
syscall
lw $t0, 4($sp)
lw $t1, 8($sp)
div $t0, $t1
mflo $t0
move $a0, $t0
li $v0, 1
syscall
la $a0, string7
li $v0, 4
syscall
lw $t0, 4($sp)
lw $t1, 8($sp)
sgt $t0, $t0, $t1
move $a0, $t0
li $v0, 1
syscall
la $a0, string8
li $v0, 4
syscall
lw $t0, 4($sp)
lw $t1, 8($sp)
slt $t0, $t0, $t1
move $a0, $t0
li $v0, 1
syscall
la $a0, string9
li $v0, 4
syscall
lw $t0, 4($sp)
lw $t1, 8($sp)
sge $t0, $t0, $t1
move $a0, $t0
li $v0, 1
syscall
la $a0, string10
li $v0, 4
syscall
lw $t0, 4($sp)
lw $t1, 8($sp)
sle $t0, $t0, $t1
move $a0, $t0
li $v0, 1
syscall
la $a0, string11
li $v0, 4
syscall
lw $ra, 0($sp)
addiu $sp, $sp, 24
jr $ra