Arrays
Kurt Finnie
Posts: 21
I've been working at understanding arrays and have run into several problems.
The first is that I don't know how to display my spin code, so I'm going to write it all out.
VAR
long MainStack[noparse][[/noparse]9]
byte idx
OBJ
tv="tv_text"
PUB Main
tv.start
wordfill(@sail,0,1000)
repeat idx from 0 to 255 step 10
sail[noparse][[/noparse]idx] := idx
repeat idx from 1 to 255
tv.dec(word[noparse][[/noparse]@sail][noparse][[/noparse]idx]
tv.str(string(", "))
DAT
sail word 0,0,0, (... to 1000)
When I execute the above, my display shows all of the array elements as expected.
When I change 255 to 256 (or any larger number), my display scrolls continuously.
Ultimately, I'd like to have a 10,000 element word array and be able to display any segment of it on screen.
Why is the display scrolling?
There's got to be a better way of defining the array, rather than typing 1000 0's separated by commas.
The array has to be in the DAT section, not in the VAR section.
Kurt
The first is that I don't know how to display my spin code, so I'm going to write it all out.
VAR
long MainStack[noparse][[/noparse]9]
byte idx
OBJ
tv="tv_text"
PUB Main
tv.start
wordfill(@sail,0,1000)
repeat idx from 0 to 255 step 10
sail[noparse][[/noparse]idx] := idx
repeat idx from 1 to 255
tv.dec(word[noparse][[/noparse]@sail][noparse][[/noparse]idx]
tv.str(string(", "))
DAT
sail word 0,0,0, (... to 1000)
When I execute the above, my display shows all of the array elements as expected.
When I change 255 to 256 (or any larger number), my display scrolls continuously.
Ultimately, I'd like to have a 10,000 element word array and be able to display any segment of it on screen.
Why is the display scrolling?
There's got to be a better way of defining the array, rather than typing 1000 0's separated by commas.
The array has to be in the DAT section, not in the VAR section.
Kurt
Comments
as far as the DAT question...I'm sure there is a better way to do that but I don't know it.
Rick