-
Notifications
You must be signed in to change notification settings - Fork 1
/
assembly_file.txt
193 lines (150 loc) · 2.46 KB
/
assembly_file.txt
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
START main
multiply0:
MOV $0 , multiply_RET1
MOV $1 , n1
MOV $2 , n2
CLRQ
MUL n1 , n2 , MUL_RES2
MOV MUL_RES2 , multiply
BIND multiply
JMP multiply_RET1
multiply3:
MOV $0 , multiply_RET4
MOV $1 , n1
MOV $2 , n2
CLRQ
MUL n1 , n2 , MUL_RES5
MOV MUL_RES5 , multiply
BIND multiply
JMP multiply_RET4
multiply6:
MOV $0 , multiply_RET7
MOV $1 , n1
MOV $2 , n2
MOV $3 , n3
CLRQ
MUL n1 , n2 , MUL_RES8
MUL MUL_RES8 , n3 , MUL_RES9
MOV MUL_RES9 , multiply
BIND multiply
JMP multiply_RET7
main:
MOV 10 , n5
MOV 11.500000 , n6
MOV 10 , n1
MOV 20.500000 , n2
ADD n1 , n2 , ADD_RES10
MOV ADD_RES10 , n2
SUB n1 , n2 , SUB_RES11
MOV SUB_RES11 , n2
MUL n1 , n2 , MUL_RES12
MOV MUL_RES12 , n2
DIV n1 , n2 , DIV_RES13
MOV DIV_RES13 , n2
ADD n1 , 1 , ADD_RES14
MOV ADD_RES14 , n1
SUB n1 , 1 , SUB_RES15
MOV SUB_RES15 , n1
MUL n2 , -1 , UNI_RES16
MOV UNI_RES16 , n2
IF17:
CMPG n1 , n2 , RES18
JIFN RES18 , END_IF19
MOV 10 , n8
MOV n1 , n3
JMP END_IF20:
END_IF19:
IF21:
CMPGE n1 , n2 , RES22
JIFN RES22 , END_IF23
MOV 11 , n8
MOV n1 , n3
JMP END_IF24:
END_IF23:
IF25:
CMPE n1 , n2 , RES26
JIFN RES26 , END_IF27
MOV n1 , n3
JMP END_IF28:
END_IF27:
IF29:
CMPNE n1 , n2 , RES30
JIFN RES30 , END_IF31
MOV n1 , n3
JMP END_IF32:
END_IF31:
IF33:
CMPL n1 , n2 , RES34
JIFN RES34 , END_IF35
MOV n1 , n3
JMP END_IF36:
END_IF35:
IF37:
CMPLE n1 , n2 , RES38
JIFN RES38 , END_IF39
MOV n1 , n3
JMP END_IF40:
END_IF39:
MOV n1 , n3
END_IF40:
END_IF36:
END_IF32:
END_IF28:
END_IF24:
END_IF20:
WHILE41:
CMPG n2 , n1 , RES42
JIFN RES42 , END_WHILE43
MOV 12 , n8
MOV n1 , n3
MOV 0 , n1
FOR44:
CMPL n1 , 10 , RES45
JIFN RES45 , END_FOR46
ADD n1 , 1 , ADD_RES47
MOV ADD_RES47 , n1
MOV n1 , n3
JMP FOR44
END_FOR46:
JMP WHILE41
END_WHILE43:
DO_WHILE48:
MOV 123 , n8
MOV n1 , n3
CMPG n1 , n2 , RES49
JIF RES49 , DO_WHILE48
END__DO_WHILE50:
MOV 0 , n1
FOR51:
CMPL n1 , 10 , RES52
JIFN RES52 , END_FOR53
ADD n1 , 1 , ADD_RES54
MOV ADD_RES54 , n1
MOV 20 , n8
MOV n1 , n3
JMP FOR51
END_FOR53:
MOV 10 , global_variable
BIND multiply55
BIND n1 , $1
BIND n3 , $2
JMP multiply0
multiply55:
MOV $1 , RET_VAL56
MOV RET_VAL56 , n4
BIND multiply57
BIND n2 , $1
BIND n3 , $2
JMP multiply3
multiply57:
MOV $1 , RET_VAL58
MOV RET_VAL58 , n2
BIND multiply59
BIND n2 , $1
BIND n1 , $2
BIND n3 , $3
JMP multiply6
multiply59:
MOV $1 , RET_VAL60
MOV RET_VAL60 , n2
HALT