-
Notifications
You must be signed in to change notification settings - Fork 0
/
output-exam1.txt
193 lines (174 loc) · 1.66 KB
/
output-exam1.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
192
193
#source "exam1.txt"
' Calling the main function.
call main
halt
#line 1
f:
' Parameters:
' * BooleanType a (offset 8)
' * BooleanType b (offset 6)
' * BooleanType c (offset 4)
' Local variables:
enter 0
#line 2
pushi bp
pushi 8
addi
loadi
pushi bp
pushi 6
addi
loadi
and
pushi bp
pushi 4
addi
loadi
not
or
ret 2, 0, 6
#line 5
main:
' Parameters:
' Local variables:
' * BooleanType b1 (offset -2)
' * BooleanType b2 (offset -4)
' * BooleanType b3 (offset -6)
' * IntType a (offset -8)
enter 8
#line 9
' Write
pushi 1
pushi 0
pushi 0
call f
outi
#line 10
' Write
pushi 1
pushi 0
pushi 1
call f
outi
#line 11
' Write
pushi 0
pushi 1
pushi 1
call f
outi
#line 12
' Write
pushi 0
pushi 0
pushi 0
call f
outi
#line 14
' Write
pushb 10
outb
#line 16
pushi bp
pushi -2
addi
pushi 1
storei
#line 17
pushi bp
pushi -4
addi
pushi 3
pushi 1
gti
storei
#line 18
pushi bp
pushi -6
addi
pushf 4.5
pushf 4.2
lef
storei
#line 19
' Write
pushi bp
pushi -2
addi
loadi
outi
#line 20
' Write
pushi bp
pushi -4
addi
loadi
outi
#line 21
' Write
pushi bp
pushi -6
addi
loadi
outi
#line 23
' Write
pushb 10
outb
#line 25
' If:
pushi bp
pushi -2
addi
loadi
jz label2
' Then:
' Write
pushb 89
outb
jmp label1
' Else:
label2:
' Write
pushb 78
outb
label1:
#line 28
' Write
pushb 10
outb
#line 30
pushi bp
pushi -8
addi
pushi 0
storei
#line 31
' WhileLoop
label3:
pushi bp
pushi -8
addi
loadi
pushi 10
lti
jz label4
' Write
pushi bp
pushi -8
addi
loadi
outi
pushi bp
pushi -8
addi
pushi bp
pushi -8
addi
loadi
pushi 1
addi
storei
jmp label3
label4:
ret 0, 8, 0