Local 2D Array of strings crash (*solved*)
In the end I replaced it with a 2D array of UBYTEs instead which worked okay (and was probably less wasteful, tbh - I was only storing single characters anyway). If I figure out a decent way to reproduce the crash without it being embedded in a huge chunk of other stuff then I'll post it. It could well be something silly that I've done elsewhere in the program.
While I'm here, could someone clarify what is okay to declare within a SUB? I don't seem to have any problems declaring normal variables (e.g. DIM test AS UBYTE) within a SUB, but I seem to have crash issues if I try to declare and use an array (e.g. DIM test(2,2) AS UBYTE). Is it actually legal to try and do that?
This code, for example, crashes unless I move the UBYTE array outside of the SUB:
- Code:
test()
SUB test
DIM xpos as UBYTE
DIM ypos as UBYTE
DIM scrdata(22, 32) AS UBYTE
CLS
FOR ypos = 0 TO 21
FOR xpos = 0 TO 31
scrdata(ypos, xpos) = 65
NEXT xpos
NEXT ypos
PRINT "Done."
PAUSE 0
CLS
FOR ypos = 0 TO 21
FOR xpos = 0 TO 31
PRINT AT ypos, xpos; CHR(scrdata(ypos, xpos))
NEXT xpos
NEXT ypos
END SUB
Sorry if the answer here is obvious, I'm still getting used to how things work.

