1
0
mirror of https://github.com/catseye/SixtyPical.git synced 2024-11-25 23:49:17 +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
copy 777, one
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:
src_label = self.labels[src.name]
dest_label = self.labels[dest.ref.name]
raise NotImplementedError("""\
What we will need to do here, is to have TWO 'labels' per name, one for the high byte table,
and one for the low byte table. Then select AbsoluteX() or AbsoluteY() addressing on those
tables. And use that in the STA() part.""")
addressing_mode = None
if dest.index == REG_X:
addressing_mode = AbsoluteX
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:
raise NotImplementedError

View File

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