File tree Expand file tree Collapse file tree 2 files changed +118
-22
lines changed
Expand file tree Collapse file tree 2 files changed +118
-22
lines changed Original file line number Diff line number Diff line change @@ -37,9 +37,9 @@ push temp 0
3737pop that 0
3838push constant 0
3939return
40- function Memory.alloc 1
40+ function Memory.alloc 2
4141push argument 0
42- push constant 1
42+ push constant 0
4343lt
4444if-goto IF_TRUE0
4545goto IF_FALSE0
@@ -48,38 +48,135 @@ push constant 5
4848call Sys.error 1
4949pop temp 0
5050label IF_FALSE0
51+ push argument 0
52+ push constant 0
53+ eq
54+ if-goto IF_TRUE1
55+ goto IF_FALSE1
56+ label IF_TRUE1
57+ push constant 1
58+ pop argument 0
59+ label IF_FALSE1
5160push constant 2048
5261pop local 0
5362label WHILE_EXP0
63+ push local 0
64+ push constant 16383
65+ lt
5466push constant 0
5567push local 0
5668add
5769pop pointer 1
5870push that 0
5971push argument 0
6072lt
73+ and
6174not
6275if-goto WHILE_END0
6376push constant 1
6477push local 0
6578add
6679pop pointer 1
6780push that 0
81+ pop local 1
82+ push constant 0
83+ push local 0
84+ add
85+ pop pointer 1
86+ push that 0
87+ push constant 0
88+ eq
89+ push local 1
90+ push constant 16382
91+ gt
92+ or
93+ push constant 0
94+ push local 1
95+ add
96+ pop pointer 1
97+ push that 0
98+ push constant 0
99+ eq
100+ or
101+ if-goto IF_TRUE2
102+ goto IF_FALSE2
103+ label IF_TRUE2
104+ push local 1
68105pop local 0
106+ goto IF_END2
107+ label IF_FALSE2
108+ push constant 0
109+ push local 0
110+ add
111+ push constant 1
112+ push local 0
113+ add
114+ pop pointer 1
115+ push that 0
116+ push local 0
117+ sub
118+ push constant 0
119+ push local 1
120+ add
121+ pop pointer 1
122+ push that 0
123+ add
124+ pop temp 0
125+ pop pointer 1
126+ push temp 0
127+ pop that 0
128+ push constant 1
129+ push local 1
130+ add
131+ pop pointer 1
132+ push that 0
133+ push local 1
134+ push constant 2
135+ add
136+ eq
137+ if-goto IF_TRUE3
138+ goto IF_FALSE3
139+ label IF_TRUE3
140+ push constant 1
141+ push local 0
142+ add
143+ push local 0
144+ push constant 2
145+ add
146+ pop temp 0
147+ pop pointer 1
148+ push temp 0
149+ pop that 0
150+ goto IF_END3
151+ label IF_FALSE3
152+ push constant 1
153+ push local 0
154+ add
155+ push constant 1
156+ push local 1
157+ add
158+ pop pointer 1
159+ push that 0
160+ pop temp 0
161+ pop pointer 1
162+ push temp 0
163+ pop that 0
164+ label IF_END3
165+ label IF_END2
69166goto WHILE_EXP0
70167label WHILE_END0
71168push local 0
72169push argument 0
73170add
74171push constant 16379
75172gt
76- if-goto IF_TRUE1
77- goto IF_FALSE1
78- label IF_TRUE1
173+ if-goto IF_TRUE4
174+ goto IF_FALSE4
175+ label IF_TRUE4
79176push constant 6
80177call Sys.error 1
81178pop temp 0
82- label IF_FALSE1
179+ label IF_FALSE4
83180push constant 0
84181push local 0
85182add
@@ -89,9 +186,9 @@ push argument 0
89186push constant 2
90187add
91188gt
92- if-goto IF_TRUE2
93- goto IF_FALSE2
94- label IF_TRUE2
189+ if-goto IF_TRUE5
190+ goto IF_FALSE5
191+ label IF_TRUE5
95192push argument 0
96193push constant 2
97194add
@@ -119,9 +216,9 @@ push local 0
119216push constant 2
120217add
121218eq
122- if-goto IF_TRUE3
123- goto IF_FALSE3
124- label IF_TRUE3
219+ if-goto IF_TRUE6
220+ goto IF_FALSE6
221+ label IF_TRUE6
125222push argument 0
126223push constant 3
127224add
@@ -136,8 +233,8 @@ pop temp 0
136233pop pointer 1
137234push temp 0
138235pop that 0
139- goto IF_END3
140- label IF_FALSE3
236+ goto IF_END6
237+ label IF_FALSE6
141238push argument 0
142239push constant 3
143240add
@@ -152,7 +249,7 @@ pop temp 0
152249pop pointer 1
153250push temp 0
154251pop that 0
155- label IF_END3
252+ label IF_END6
156253push constant 1
157254push local 0
158255add
@@ -165,7 +262,7 @@ pop temp 0
165262pop pointer 1
166263push temp 0
167264pop that 0
168- label IF_FALSE2
265+ label IF_FALSE5
169266push constant 0
170267push local 0
171268add
Original file line number Diff line number Diff line change @@ -65,15 +65,14 @@ label WHILE_END0
6565push constant 0
6666return
6767function Sys.error 0
68- push constant 3
69- call String.new 1
7068push constant 69
71- call String.appendChar 2
69+ call Output.printChar 1
70+ pop temp 0
7271push constant 82
73- call String.appendChar 2
72+ call Output.printChar 1
73+ pop temp 0
7474push constant 82
75- call String.appendChar 2
76- call Output.printString 1
75+ call Output.printChar 1
7776pop temp 0
7877push argument 0
7978call Output.printInt 1
You can’t perform that action at this time.
0 commit comments