mirror of
https://github.com/catseye/SixtyPical.git
synced 2025-02-01 23:33:28 +00:00
NOt 100% sure it's correct, but it seems close.
This commit is contained in:
parent
13e6654088
commit
a082aee001
@ -410,6 +410,14 @@ class Compiler(object):
|
||||
self.emitter.emit(STA(self.addressing_mode_for_index(dest.index)(dest_label)))
|
||||
self.emitter.emit(LDA(Absolute(Offset(src_label, 1))))
|
||||
self.emitter.emit(STA(self.addressing_mode_for_index(dest.index)(Offset(dest_label, 256))))
|
||||
elif isinstance(src.type, VectorType) and isinstance(dest.ref.type, TableType) and isinstance(dest.ref.type.of_type, VectorType):
|
||||
# FIXME this is the exact same as above - can this be simplified?
|
||||
src_label = self.labels[src.name]
|
||||
dest_label = self.labels[dest.ref.name]
|
||||
self.emitter.emit(LDA(Absolute(src_label)))
|
||||
self.emitter.emit(STA(self.addressing_mode_for_index(dest.index)(dest_label)))
|
||||
self.emitter.emit(LDA(Absolute(Offset(src_label, 1))))
|
||||
self.emitter.emit(STA(self.addressing_mode_for_index(dest.index)(Offset(dest_label, 256))))
|
||||
else:
|
||||
raise NotImplementedError
|
||||
elif isinstance(src, ConstantRef) and isinstance(dest, IndexedRef):
|
||||
@ -429,6 +437,14 @@ class Compiler(object):
|
||||
self.emitter.emit(STA(Absolute(dest_label)))
|
||||
self.emitter.emit(LDA(self.addressing_mode_for_index(src.index)(Offset(src_label, 256))))
|
||||
self.emitter.emit(STA(Absolute(Offset(dest_label, 1))))
|
||||
elif isinstance(dest.type, VectorType) and isinstance(src.ref.type, TableType) and isinstance(src.ref.type.of_type, VectorType):
|
||||
# FIXME this is the exact same as above - can this be simplified?
|
||||
src_label = self.labels[src.ref.name]
|
||||
dest_label = self.labels[dest.name]
|
||||
self.emitter.emit(LDA(self.addressing_mode_for_index(src.index)(src_label)))
|
||||
self.emitter.emit(STA(Absolute(dest_label)))
|
||||
self.emitter.emit(LDA(self.addressing_mode_for_index(src.index)(Offset(src_label, 256))))
|
||||
self.emitter.emit(STA(Absolute(Offset(dest_label, 1))))
|
||||
else:
|
||||
raise NotImplementedError
|
||||
|
||||
|
@ -1926,7 +1926,7 @@ Copying to and from a vector table.
|
||||
| ld x, 0
|
||||
| copy bar, one
|
||||
| copy one, many + x
|
||||
| //copy many + x, one
|
||||
| //call one
|
||||
| copy many + x, one
|
||||
| call one
|
||||
| }
|
||||
= ok
|
||||
|
@ -606,6 +606,53 @@ goto.
|
||||
= $0813 LDX #$C8
|
||||
= $0815 RTS
|
||||
|
||||
### Vector tables
|
||||
|
||||
Copying to and from a vector table.
|
||||
|
||||
| vector
|
||||
| outputs x
|
||||
| trashes a, z, n
|
||||
| one
|
||||
| vector
|
||||
| outputs x
|
||||
| trashes a, z, n
|
||||
| table[256] many
|
||||
|
|
||||
| routine bar outputs x trashes a, z, n {
|
||||
| ld x, 200
|
||||
| }
|
||||
|
|
||||
| routine main
|
||||
| inputs one, many
|
||||
| outputs one, many
|
||||
| trashes a, x, n, z
|
||||
| {
|
||||
| ld x, 0
|
||||
| copy bar, one
|
||||
| copy one, many + x
|
||||
| copy many + x, one
|
||||
| call one
|
||||
| }
|
||||
= $080D LDX #$00
|
||||
= $080F LDA #$35
|
||||
= $0811 STA $083B
|
||||
= $0814 LDA #$08
|
||||
= $0816 STA $083C
|
||||
= $0819 LDA $083B
|
||||
= $081C STA $083D,X
|
||||
= $081F LDA $083C
|
||||
= $0822 STA $093D,X
|
||||
= $0825 LDA $083D,X
|
||||
= $0828 STA $083B
|
||||
= $082B LDA $093D,X
|
||||
= $082E STA $083C
|
||||
= $0831 JSR $0838
|
||||
= $0834 RTS
|
||||
= $0835 LDX #$C8
|
||||
= $0837 RTS
|
||||
= $0838 JMP ($083B)
|
||||
|
||||
### word operations
|
||||
|
||||
Adding a constant word to a word memory location.
|
||||
|
Loading…
x
Reference in New Issue
Block a user