mirror of
https://github.com/catseye/SixtyPical.git
synced 2024-11-25 23:49:17 +00:00
copy []+y, a
to indirectly read byte into the a
register.
This commit is contained in:
parent
2e4d01edd3
commit
f9dc730f88
@ -11,6 +11,7 @@ History of SixtyPical
|
||||
* Can `copy` a literal word to a word table.
|
||||
* Subtract word (constant or memory location) from word memory location.
|
||||
* `trash` instruction explicitly indicates a value is no longer considered meaningful.
|
||||
* `copy []+y, a` can indirectly read a byte value into the `a` register.
|
||||
* Fixed bug which was preventing `if` branches to diverge in what they initialized,
|
||||
if it was already initialized when going into the `if`.
|
||||
* Fixed a bug which was making it crash when trying to analyze `repeat forever` loops.
|
||||
|
@ -235,7 +235,9 @@ routine player_logic
|
||||
add ptr, new_pos
|
||||
ld y, 0
|
||||
|
||||
// copy [ptr] + y, a
|
||||
// check collision.
|
||||
copy [ptr] + y, a
|
||||
|
||||
// cmp a, 32
|
||||
// if z {
|
||||
// copy new_pos, pos
|
||||
|
@ -385,7 +385,10 @@ class Compiler(object):
|
||||
else:
|
||||
raise NotImplementedError((src, dest))
|
||||
elif isinstance(src, IndirectRef) and isinstance(dest, LocationRef):
|
||||
if dest.type == TYPE_BYTE and isinstance(src.ref.type, PointerType):
|
||||
if dest == REG_A and isinstance(src.ref.type, PointerType):
|
||||
src_label = self.labels[src.ref.name]
|
||||
self.emitter.emit(LDA(IndirectY(src_label)))
|
||||
elif dest.type == TYPE_BYTE and isinstance(src.ref.type, PointerType):
|
||||
src_label = self.labels[src.ref.name]
|
||||
dest_label = self.labels[dest.name]
|
||||
self.emitter.emit(LDA(IndirectY(src_label)))
|
||||
|
@ -1005,7 +1005,7 @@ Write stored value through a pointer.
|
||||
= $081A STA ($FE),Y
|
||||
= $081C RTS
|
||||
|
||||
Read through a pointer.
|
||||
Read through a pointer, into a byte storage location, or the `a` register.
|
||||
|
||||
| buffer[2048] buf
|
||||
| pointer ptr @ 254
|
||||
@ -1019,15 +1019,17 @@ Read through a pointer.
|
||||
| ld y, 0
|
||||
| copy ^buf, ptr
|
||||
| copy [ptr] + y, foo
|
||||
| copy [ptr] + y, a
|
||||
| }
|
||||
= $080D LDY #$00
|
||||
= $080F LDA #$1D
|
||||
= $080F LDA #$1F
|
||||
= $0811 STA $FE
|
||||
= $0813 LDA #$08
|
||||
= $0815 STA $FF
|
||||
= $0817 LDA ($FE),Y
|
||||
= $0819 STA $101D
|
||||
= $081C RTS
|
||||
= $0819 STA $101F
|
||||
= $081C LDA ($FE),Y
|
||||
= $081E RTS
|
||||
|
||||
Add a word memory location, and a literal word, to a pointer, and then read through it.
|
||||
Note that this is *not* range-checked. (Yet.)
|
||||
|
Loading…
Reference in New Issue
Block a user