mirror of
https://github.com/catseye/SixtyPical.git
synced 2025-04-27 17:44:49 +00:00
Fix problem with test case, and with serializing as zero page.
This commit is contained in:
parent
e41dd1aa01
commit
c8c69a2a7d
12
eg/buffer.60p
Normal file
12
eg/buffer.60p
Normal file
@ -0,0 +1,12 @@
|
||||
buffer[2048] buf
|
||||
pointer ptr @ 254
|
||||
|
||||
routine main
|
||||
inputs buf
|
||||
outputs buf, y
|
||||
trashes a, z, n, ptr
|
||||
{
|
||||
ld y, 0
|
||||
copy buf, ptr
|
||||
// copy 123, [ptr] + y
|
||||
}
|
@ -301,12 +301,11 @@ class Compiler(object):
|
||||
elif isinstance(src.type, BufferType) and isinstance(dest.type, PointerType):
|
||||
# TODO: this maybe should not be the 'copy' opcode at all that means this
|
||||
src_label = self.labels[src.name]
|
||||
dest_label = self.labels[dest.name]
|
||||
dest_label = self.labels[dest.name]
|
||||
self.emitter.emit(LDA(Immediate(HighAddressByte(src_label))))
|
||||
self.emitter.emit(STA(ZeroPage(dest_label)))
|
||||
self.emitter.emit(LDA(Immediate(LowAddressByte(src_label))))
|
||||
#self.emitter.emit(STA(ZeroPage(Offset(dest_label, 1))))
|
||||
self.emitter.emit(STA(ZeroPage(dest_label)))
|
||||
self.emitter.emit(STA(ZeroPage(Offset(dest_label, 1))))
|
||||
elif isinstance(src.type, VectorType) and isinstance(dest.type, VectorType):
|
||||
src_label = self.labels[src.name]
|
||||
dest_label = self.labels[dest.name]
|
||||
|
@ -82,6 +82,9 @@ class Offset(Emittable):
|
||||
def serialize(self, addr=None):
|
||||
return self.label.serialize(offset=self.offset)
|
||||
|
||||
def serialize_as_zero_page(self, offset=0):
|
||||
return self.label.serialize_as_zero_page(offset=self.offset)
|
||||
|
||||
def __repr__(self):
|
||||
return "%s(%r, %r)" % (self.__class__.__name__, self.label, self.offset)
|
||||
|
||||
|
@ -344,16 +344,16 @@ goto.
|
||||
|
||||
Buffers and pointers.
|
||||
|
||||
> | buffer[2048] buf
|
||||
> | pointer ptr : 254
|
||||
> |
|
||||
> | routine main
|
||||
> | inputs buf
|
||||
> | outputs buf, y
|
||||
> | trashes a, z, n, ptr
|
||||
> | {
|
||||
> | ld y, 0
|
||||
> | copy buf, ptr
|
||||
> | // copy 123, [ptr] + y
|
||||
> | }
|
||||
> = 00c0a000a90b850dc0a9c0850ec060
|
||||
| buffer[2048] buf
|
||||
| pointer ptr @ 254
|
||||
|
|
||||
| routine main
|
||||
| inputs buf
|
||||
| outputs buf, y
|
||||
| trashes a, z, n, ptr
|
||||
| {
|
||||
| ld y, 0
|
||||
| copy buf, ptr
|
||||
| // copy 123, [ptr] + y
|
||||
| }
|
||||
= 00c0a000a90b85fea9c085ff60
|
||||
|
Loading…
x
Reference in New Issue
Block a user