git @ Cat's Eye Technologies SixtyPical / ad8e064
Use right endianness when `copy`ing literal word into storage. Chris Pressey 3 years ago
5 changed file(s) with 14 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
66 * Add word (constant or memory location) to word memory location.
77 * Add word to pointer (unchecked for now).
88 * Implementation: `--debug` shows some extra info during analysis.
9 * Fixed bug where `copy`ing literal word into word storage used wrong endianness.
910
1011 0.8
1112 ---
8282
8383 routine main
8484 inputs cinv
85 outputs cinv, save_cinv
85 outputs cinv, save_cinv, pos
8686 trashes a, n, z
8787 {
88 copy word 0, pos
8889 with interrupts off {
8990 copy cinv, save_cinv
9091 copy our_cinv, cinv
22 SRC=$1
33 OUT=/tmp/a-out.prg
44 bin/sixtypical --analyze --compile --basic-prelude $SRC > $OUT || exit 1
5 x64 $OUT
5 if [ -e vicerc ]; then
6 x64 -config vicerc $OUT
7 else
8 x64 $OUT
9 fi
610 rm -f $OUT
357357 elif src.type == TYPE_WORD and dest.type == TYPE_WORD:
358358 if isinstance(src, ConstantRef):
359359 dest_label = self.labels[dest.name]
360 self.emitter.emit(LDA(Immediate(Byte(src.low_byte()))))
361 self.emitter.emit(STA(Absolute(dest_label)))
360362 self.emitter.emit(LDA(Immediate(Byte(src.high_byte()))))
361 self.emitter.emit(STA(Absolute(dest_label)))
362 self.emitter.emit(LDA(Immediate(Byte(src.low_byte()))))
363363 self.emitter.emit(STA(Absolute(Offset(dest_label, 1))))
364364 else:
365365 src_label = self.labels[src.name]
274274 | outputs bar
275275 | trashes a, n, z
276276 | {
277 | copy 65535, bar
278 | }
279 = 00c0a9ff8d0bc0a9ff8d0cc060
277 | copy 2000, bar
278 | }
279 = 00c0a9d08d0bc0a9078d0cc060
280280
281281 Copy vector to vector.
282282
457457 | add ptr, word 1
458458 | copy [ptr] + y, foo
459459 | }
460 = 00c0a9028d38c0a96b8d39c0a000a93485fea9c085ffa5fe6d38c085fea5ff6d39c085ffa5fe690185fea5ff690085ffb1fe8d36c060
460 = 00c0a96b8d38c0a9028d39c0a000a93485fea9c085ffa5fe6d38c085fea5ff6d39c085ffa5fe690185fea5ff690085ffb1fe8d36c060