Jump to content
Posted Sat Oct 16, 2010 12:48 AM
Posted Sat Oct 16, 2010 1:31 PM
Yes, that's right. The number in square brackets is the offset to the starting address, so an offset of 0 gives you the starting address (a). The assembly equivalent is
It's been a while since I've done this so I figured I'd better double check because my memory is crap.
If I go
Then MyArray is a and MyArray is b, correct?
; MyArray LDX 0 LDA MyArray,X ; MyArray LDX 1 LDA MyArray,XMichael
Posted Sat Oct 16, 2010 1:50 PM
If you dim an array to ROM, it will be a read-only array. But if you dim an array to RAM, it will be a read/write (variable) array.
I don't know for sure, but I thought arrays were read-only with bB:
rem dim a Superchip array for writing and reading dim w_MyArray=$F000 dim r_MyArray=$F080 w_MyArray=rand w_MyArray=r_MyArray+1
rem modify the index instead of dimming twice dim MyArray=$F000 rem use index 0 to 127 for writing rem use index 128 to 255 for reading MyArray=rand MyArray=MyArray+1In the second example, note that 140=12+128, so it does the same thing as the first example (add 1 to the element with index 12). However, the second example/method is harder for the reader to understand, and it will work only for Superchip expansion RAM (since the Superchip has 128 bytes of RAM, so there are a total of 256 write and read addresses).
0 members, 0 guests, 0 anonymous users