git @ Cat's Eye Technologies SixtyPical / 16450e0
Compile goto's. Chris Pressey 6 years ago
3 changed file(s) with 37 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
0 routine chrout
1 inputs a
2 trashes a
3 @ 65490
4
5 routine bar trashes a, z, n {
6 ld a, 66
7 call chrout
8 }
9
10 routine main trashes a, z, n {
11 ld a, 65
12 call chrout
13 goto bar
14 }
199199 elif isinstance(location.type, VectorType):
200200 # XXX NOT QUITE RIGHT, IS IT?
201201 # We need to simulate an indirect JSR!
202 self.emitter.emit(JMP(Indirect(label)))
203 else:
204 raise NotImplementedError
205 elif opcode == 'goto':
206 location = instr.location
207 label = self.labels[instr.location.name]
208 if isinstance(location.type, RoutineType):
209 self.emitter.emit(JMP(Absolute(label)))
210 elif isinstance(location.type, VectorType):
202211 self.emitter.emit(JMP(Indirect(label)))
203212 else:
204213 raise NotImplementedError
273273 | copy bar, foo
274274 | call foo
275275 | }
276 = 00c0
276 = 00c0wewillfixthislater
277
278 goto.
279
280 | routine bar outputs x trashes z, n {
281 | ld x, 200
282 | }
283 |
284 | routine main outputs x trashes a, z, n {
285 | ld y, 200
286 | goto bar
287 | }
288 = 00c0a0c84c06c060a2c860