git @ Cat's Eye Technologies SixtyPical / 8a7e3aa
Flatten more. Chris Pressey 4 years ago
1 changed file(s) with 11 addition(s) and 17 deletion(s). Raw diff Collapse all Expand all
378378 dest = instr.dest
379379 src = instr.src
380380
381 if isinstance(src, (LocationRef, ConstantRef)) and isinstance(dest, IndirectRef):
382 if src.type == TYPE_BYTE and isinstance(dest.ref.type, PointerType):
383 if isinstance(src, ConstantRef):
384 ### copy 123, [ptr] + y
385 dest_label = self.get_label(dest.ref.name)
386 self.emitter.emit(LDA(Immediate(Byte(src.value))))
387 self.emitter.emit(STA(IndirectY(dest_label)))
388 elif isinstance(src, LocationRef):
389 ### copy b, [ptr] + y
390 src_label = self.get_label(src.name)
391 dest_label = self.get_label(dest.ref.name)
392 self.emitter.emit(LDA(Absolute(src_label)))
393 self.emitter.emit(STA(IndirectY(dest_label)))
394 else:
395 raise NotImplementedError((src, dest))
396 else:
397 raise NotImplementedError((src, dest))
381 if isinstance(src, ConstantRef) and isinstance(dest, IndirectRef) and src.type == TYPE_BYTE and isinstance(dest.ref.type, PointerType):
382 ### copy 123, [ptr] + y
383 dest_label = self.get_label(dest.ref.name)
384 self.emitter.emit(LDA(Immediate(Byte(src.value))))
385 self.emitter.emit(STA(IndirectY(dest_label)))
386 elif isinstance(src, LocationRef) and isinstance(dest, IndirectRef) and src.type == TYPE_BYTE and isinstance(dest.ref.type, PointerType):
387 ### copy b, [ptr] + y
388 src_label = self.get_label(src.name)
389 dest_label = self.get_label(dest.ref.name)
390 self.emitter.emit(LDA(Absolute(src_label)))
391 self.emitter.emit(STA(IndirectY(dest_label)))
398392 elif isinstance(src, IndirectRef) and isinstance(dest, LocationRef) and dest.type == TYPE_BYTE and isinstance(src.ref.type, PointerType):
399393 ### copy [ptr] + y, b
400394 src_label = self.get_label(src.ref.name)