git @ Cat's Eye Technologies SixtyPical / c8c69a2
Fix problem with test case, and with serializing as zero page. Chris Pressey 4 years ago
4 changed file(s) with 30 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
0 buffer[2048] buf
1 pointer ptr @ 254
2
3 routine main
4 inputs buf
5 outputs buf, y
6 trashes a, z, n, ptr
7 {
8 ld y, 0
9 copy buf, ptr
10 // copy 123, [ptr] + y
11 }
300300 elif isinstance(src.type, BufferType) and isinstance(dest.type, PointerType):
301301 # TODO: this maybe should not be the 'copy' opcode at all that means this
302302 src_label = self.labels[src.name]
303 dest_label = self.labels[dest.name]
303 dest_label = self.labels[dest.name]
304304 self.emitter.emit(LDA(Immediate(HighAddressByte(src_label))))
305305 self.emitter.emit(STA(ZeroPage(dest_label)))
306306 self.emitter.emit(LDA(Immediate(LowAddressByte(src_label))))
307 #self.emitter.emit(STA(ZeroPage(Offset(dest_label, 1))))
308 self.emitter.emit(STA(ZeroPage(dest_label)))
307 self.emitter.emit(STA(ZeroPage(Offset(dest_label, 1))))
309308 elif isinstance(src.type, VectorType) and isinstance(dest.type, VectorType):
310309 src_label = self.labels[src.name]
311310 dest_label = self.labels[dest.name]
8181 def serialize(self, addr=None):
8282 return self.label.serialize(offset=self.offset)
8383
84 def serialize_as_zero_page(self, offset=0):
85 return self.label.serialize_as_zero_page(offset=self.offset)
86
8487 def __repr__(self):
8588 return "%s(%r, %r)" % (self.__class__.__name__, self.label, self.offset)
8689
343343
344344 Buffers and pointers.
345345
346 > | buffer[2048] buf
347 > | pointer ptr : 254
348 > |
349 > | routine main
350 > | inputs buf
351 > | outputs buf, y
352 > | trashes a, z, n, ptr
353 > | {
354 > | ld y, 0
355 > | copy buf, ptr
356 > | // copy 123, [ptr] + y
357 > | }
358 > = 00c0a000a90b850dc0a9c0850ec060
346 | buffer[2048] buf
347 | pointer ptr @ 254
348 |
349 | routine main
350 | inputs buf
351 | outputs buf, y
352 | trashes a, z, n, ptr
353 | {
354 | ld y, 0
355 | copy buf, ptr
356 | // copy 123, [ptr] + y
357 | }
358 = 00c0a000a90b85fea9c085ff60