1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2025-02-17 22:30:27 +00:00

Copy word to word table.

This commit is contained in:
Chris Pressey 2017-12-11 11:43:53 +00:00
parent 81aeb6c3f7
commit b86e7491d5
3 changed files with 22 additions and 13 deletions

View File

@ -9,5 +9,5 @@ routine main
ld x, 0 ld x, 0
copy 777, one copy 777, one
copy one, many + x copy one, many + x
copy many + x, one //copy many + x, one
} }

View File

@ -363,10 +363,17 @@ class Compiler(object):
if src.type == TYPE_WORD and dest.ref.type == TYPE_WORD_TABLE: if src.type == TYPE_WORD and dest.ref.type == TYPE_WORD_TABLE:
src_label = self.labels[src.name] src_label = self.labels[src.name]
dest_label = self.labels[dest.ref.name] dest_label = self.labels[dest.ref.name]
raise NotImplementedError("""\ addressing_mode = None
What we will need to do here, is to have TWO 'labels' per name, one for the high byte table, if dest.index == REG_X:
and one for the low byte table. Then select AbsoluteX() or AbsoluteY() addressing on those addressing_mode = AbsoluteX
tables. And use that in the STA() part.""") elif dest.index == REG_Y:
addressing_mode = AbsoluteY
else:
raise NotImplementedError(dest)
self.emitter.emit(LDA(Absolute(src_label)))
self.emitter.emit(STA(AbsoluteX(dest_label)))
self.emitter.emit(LDA(Absolute(Offset(src_label, 1))))
self.emitter.emit(STA(AbsoluteX(Offset(dest_label, 256))))
else: else:
raise NotImplementedError raise NotImplementedError

View File

@ -453,7 +453,7 @@ Copy routine to vector, inside an `interrupts off` block.
= $081A INX = $081A INX
= $081B RTS = $081B RTS
Copy word to word table and back. Copy word to word table.
| word one | word one
| word table many | word table many
@ -466,15 +466,17 @@ Copy word to word table and back.
| ld x, 0 | ld x, 0
| copy 777, one | copy 777, one
| copy one, many + x | copy one, many + x
| copy many + x, one
| } | }
= $080D LDX #$00 = $080D LDX #$00
= $08.. LDA #$D0 = $080F LDA #$09
= $080F STA $0818 = $0811 STA $0826
= $0812 LDA #$07 = $0814 LDA #$03
= $0814 STA $0819 = $0816 STA $0827
= ... = $0819 LDA $0826
= $08.. RTS = $081C STA $0828,X
= $081F LDA $0827
= $0822 STA $0928,X
= $0825 RTS
Indirect call. Indirect call.