Support `save X, Y, Z {}` as a shortcut syntax for nested `save`s.
Chris Pressey
4 years ago
3 | 3 |
0.17
|
4 | 4 |
----
|
5 | 5 |
|
|
6 |
* `save X, Y, Z { }` now allowed as a shortcut for nested `save`s.
|
6 | 7 |
* Split TODO off into own file.
|
7 | 8 |
* `sixtypical` no longer writes the compiled binary to standard
|
8 | |
output. The `--output` command-line argument should be given.
|
|
9 |
output. The `--output` command-line argument should be given
|
|
10 |
to get a compiled binary; otherwise only analysis is run.
|
|
11 |
* Internal cleanups, including a hierarchy of `Outputters`.
|
9 | 12 |
* All tests pass when `sixtypical` is run under Python 3.5.2.
|
10 | 13 |
|
11 | 14 |
0.16
|
14 | 14 |
Is that consistent with `st`? Well, probably it is, but we have to explain it.
|
15 | 15 |
It might make more sense, then, for it to be "part of the operation" instead of "part of
|
16 | 16 |
the reference"; something like `st.hi x, word`; `st.lo y, word`. Dunno.
|
17 | |
|
18 | |
### Save multiple values in single block
|
19 | |
|
20 | |
As a shortcut for the idiom
|
21 | |
|
22 | |
save a { save var {
|
23 | |
...
|
24 | |
} }
|
25 | |
|
26 | |
allow
|
27 | |
|
28 | |
save a, var {
|
29 | |
...
|
30 | |
}
|
31 | 17 |
|
32 | 18 |
### Save values to other-than-the-stack
|
33 | 19 |
|
617 | 617 |
self.emitter.emit(CLI())
|
618 | 618 |
|
619 | 619 |
def compile_save(self, instr):
|
620 | |
location = instr.locations[0]
|
621 | |
if location == REG_A:
|
622 | |
self.emitter.emit(PHA())
|
623 | |
self.compile_block(instr.block)
|
624 | |
self.emitter.emit(PLA())
|
625 | |
elif location == REG_X:
|
626 | |
self.emitter.emit(TXA())
|
627 | |
self.emitter.emit(PHA())
|
628 | |
self.compile_block(instr.block)
|
629 | |
self.emitter.emit(PLA())
|
630 | |
self.emitter.emit(TAX())
|
631 | |
elif location == REG_Y:
|
632 | |
self.emitter.emit(TYA())
|
633 | |
self.emitter.emit(PHA())
|
634 | |
self.compile_block(instr.block)
|
635 | |
self.emitter.emit(PLA())
|
636 | |
self.emitter.emit(TAY())
|
637 | |
else:
|
638 | |
src_label = self.get_label(location.name)
|
639 | |
self.emitter.emit(LDA(Absolute(src_label)))
|
640 | |
self.emitter.emit(PHA())
|
641 | |
self.compile_block(instr.block)
|
642 | |
self.emitter.emit(PLA())
|
643 | |
self.emitter.emit(STA(Absolute(src_label)))
|
|
620 |
for location in instr.locations:
|
|
621 |
if location == REG_A:
|
|
622 |
self.emitter.emit(PHA())
|
|
623 |
elif location == REG_X:
|
|
624 |
self.emitter.emit(TXA())
|
|
625 |
self.emitter.emit(PHA())
|
|
626 |
elif location == REG_Y:
|
|
627 |
self.emitter.emit(TYA())
|
|
628 |
self.emitter.emit(PHA())
|
|
629 |
else:
|
|
630 |
src_label = self.get_label(location.name)
|
|
631 |
self.emitter.emit(LDA(Absolute(src_label)))
|
|
632 |
self.emitter.emit(PHA())
|
|
633 |
|
|
634 |
self.compile_block(instr.block)
|
|
635 |
|
|
636 |
for location in reversed(instr.locations):
|
|
637 |
if location == REG_A:
|
|
638 |
self.emitter.emit(PLA())
|
|
639 |
elif location == REG_X:
|
|
640 |
self.emitter.emit(PLA())
|
|
641 |
self.emitter.emit(TAX())
|
|
642 |
elif location == REG_Y:
|
|
643 |
self.emitter.emit(PLA())
|
|
644 |
self.emitter.emit(TAY())
|
|
645 |
else:
|
|
646 |
src_label = self.get_label(location.name)
|
|
647 |
self.emitter.emit(PLA())
|
|
648 |
self.emitter.emit(STA(Absolute(src_label)))
|