Skip to content

Commit af00406

Browse files
committed
Update array access to new scheme
Now it uses an ARRAY_PTR subroutine so it's useful for pointers to arrays (i.e. arrays ByRef in parameters).
1 parent a5f1e43 commit af00406

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

arch/zx48k/backend/__parray.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616

1717

1818
def _paddr(offset):
19-
''' Generic array address parameter loading.
20-
Emmits output code for setting IX at the right location.
19+
""" Generic element array-address stack-ptr loading.
20+
Emits output code for setting IX at the right location.
2121
bytes = Number of bytes to load:
2222
1 => 8 bit value
2323
2 => 16 bit value / string
2424
4 => 32 bit value / f16 value
2525
5 => 40 bit value
26-
'''
26+
"""
2727
output = []
2828

2929
indirect = offset[0] == '*'
@@ -40,12 +40,9 @@ def _paddr(offset):
4040
output.append('add hl, de')
4141

4242
if indirect:
43-
output.append('ld c, (hl)')
44-
output.append('inc hl')
45-
output.append('ld h, (hl)')
46-
output.append('ld l, c')
47-
48-
output.append('call __ARRAY')
43+
output.append('call __ARRAY_PTR')
44+
else:
45+
output.append('call __ARRAY')
4946
REQUIRES.add('array.asm')
5047
return output
5148

0 commit comments

Comments
 (0)