git @ Cat's Eye Technologies SixtyPical / a082aee
NOt 100% sure it's correct, but it seems close. Chris Pressey 3 years ago
3 changed file(s) with 67 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
409409 self.emitter.emit(STA(self.addressing_mode_for_index(dest.index)(dest_label)))
410410 self.emitter.emit(LDA(Absolute(Offset(src_label, 1))))
411411 self.emitter.emit(STA(self.addressing_mode_for_index(dest.index)(Offset(dest_label, 256))))
412 elif isinstance(src.type, VectorType) and isinstance(dest.ref.type, TableType) and isinstance(dest.ref.type.of_type, VectorType):
413 # FIXME this is the exact same as above - can this be simplified?
414 src_label = self.labels[src.name]
415 dest_label = self.labels[dest.ref.name]
416 self.emitter.emit(LDA(Absolute(src_label)))
417 self.emitter.emit(STA(self.addressing_mode_for_index(dest.index)(dest_label)))
418 self.emitter.emit(LDA(Absolute(Offset(src_label, 1))))
419 self.emitter.emit(STA(self.addressing_mode_for_index(dest.index)(Offset(dest_label, 256))))
412420 else:
413421 raise NotImplementedError
414422 elif isinstance(src, ConstantRef) and isinstance(dest, IndexedRef):
422430 raise NotImplementedError
423431 elif isinstance(src, IndexedRef) and isinstance(dest, LocationRef):
424432 if TableType.is_a_table_type(src.ref.type, TYPE_WORD) and dest.type == TYPE_WORD:
433 src_label = self.labels[src.ref.name]
434 dest_label = self.labels[dest.name]
435 self.emitter.emit(LDA(self.addressing_mode_for_index(src.index)(src_label)))
436 self.emitter.emit(STA(Absolute(dest_label)))
437 self.emitter.emit(LDA(self.addressing_mode_for_index(src.index)(Offset(src_label, 256))))
438 self.emitter.emit(STA(Absolute(Offset(dest_label, 1))))
439 elif isinstance(dest.type, VectorType) and isinstance(src.ref.type, TableType) and isinstance(src.ref.type.of_type, VectorType):
440 # FIXME this is the exact same as above - can this be simplified?
425441 src_label = self.labels[src.ref.name]
426442 dest_label = self.labels[dest.name]
427443 self.emitter.emit(LDA(self.addressing_mode_for_index(src.index)(src_label)))
19251925 | ld x, 0
19261926 | copy bar, one
19271927 | copy one, many + x
1928 | //copy many + x, one
1929 | //call one
1930 | }
1931 = ok
1928 | copy many + x, one
1929 | call one
1930 | }
1931 = ok
605605 = $0813 LDX #$C8
606606 = $0815 RTS
607607
608 ### Vector tables
609
610 Copying to and from a vector table.
611
612 | vector
613 | outputs x
614 | trashes a, z, n
615 | one
616 | vector
617 | outputs x
618 | trashes a, z, n
619 | table[256] many
620 |
621 | routine bar outputs x trashes a, z, n {
622 | ld x, 200
623 | }
624 |
625 | routine main
626 | inputs one, many
627 | outputs one, many
628 | trashes a, x, n, z
629 | {
630 | ld x, 0
631 | copy bar, one
632 | copy one, many + x
633 | copy many + x, one
634 | call one
635 | }
636 = $080D LDX #$00
637 = $080F LDA #$35
638 = $0811 STA $083B
639 = $0814 LDA #$08
640 = $0816 STA $083C
641 = $0819 LDA $083B
642 = $081C STA $083D,X
643 = $081F LDA $083C
644 = $0822 STA $093D,X
645 = $0825 LDA $083D,X
646 = $0828 STA $083B
647 = $082B LDA $093D,X
648 = $082E STA $083C
649 = $0831 JSR $0838
650 = $0834 RTS
651 = $0835 LDX #$C8
652 = $0837 RTS
653 = $0838 JMP ($083B)
654
608655 ### word operations
609656
610657 Adding a constant word to a word memory location.