git @ Cat's Eye Technologies SixtyPical / f9dc730
`copy []+y, a` to indirectly read byte into the `a` register. Chris Pressey 3 years ago
4 changed file(s) with 14 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
1010 * Can `copy` a literal word to a word table.
1111 * Subtract word (constant or memory location) from word memory location.
1212 * `trash` instruction explicitly indicates a value is no longer considered meaningful.
13 * `copy []+y, a` can indirectly read a byte value into the `a` register.
1314 * Fixed bug which was preventing `if` branches to diverge in what they initialized,
1415 if it was already initialized when going into the `if`.
1516 * Fixed a bug which was making it crash when trying to analyze `repeat forever` loops.
234234 add ptr, new_pos
235235 ld y, 0
236236
237 // copy [ptr] + y, a
237 // check collision.
238 copy [ptr] + y, a
239
238240 // cmp a, 32
239241 // if z {
240242 // copy new_pos, pos
384384 else:
385385 raise NotImplementedError((src, dest))
386386 elif isinstance(src, IndirectRef) and isinstance(dest, LocationRef):
387 if dest.type == TYPE_BYTE and isinstance(src.ref.type, PointerType):
387 if dest == REG_A and isinstance(src.ref.type, PointerType):
388 src_label = self.labels[src.ref.name]
389 self.emitter.emit(LDA(IndirectY(src_label)))
390 elif dest.type == TYPE_BYTE and isinstance(src.ref.type, PointerType):
388391 src_label = self.labels[src.ref.name]
389392 dest_label = self.labels[dest.name]
390393 self.emitter.emit(LDA(IndirectY(src_label)))
10041004 = $081A STA ($FE),Y
10051005 = $081C RTS
10061006
1007 Read through a pointer.
1007 Read through a pointer, into a byte storage location, or the `a` register.
10081008
10091009 | buffer[2048] buf
10101010 | pointer ptr @ 254
10181018 | ld y, 0
10191019 | copy ^buf, ptr
10201020 | copy [ptr] + y, foo
1021 | copy [ptr] + y, a
10211022 | }
10221023 = $080D LDY #$00
1023 = $080F LDA #$1D
1024 = $080F LDA #$1F
10241025 = $0811 STA $FE
10251026 = $0813 LDA #$08
10261027 = $0815 STA $FF
10271028 = $0817 LDA ($FE),Y
1028 = $0819 STA $101D
1029 = $081C RTS
1029 = $0819 STA $101F
1030 = $081C LDA ($FE),Y
1031 = $081E RTS
10301032
10311033 Add a word memory location, and a literal word, to a pointer, and then read through it.
10321034 Note that this is *not* range-checked. (Yet.)