ref-xx/basinc

SAVE "" DATA a() gets corrupted data if number array's dimension is bigger than 1

Closed this issue · 3 comments

Loading a number array gets corrupted data if array has more than one dimension:

If I create
DIM a(3): SAVE "arr" DATA a()
and then
DIM a(3):LOAD "arr" DATA a()
it works OK. But if the array's dimension is bigger than 1, it fails. Try
Dim a(2,2):save "arr2" data a()
then type
Dim a(2,2):load "arr2" data a()
loads some data, but the array a() created gets corrupted and has only one dimension, and random length

If SAVE and LOAD into a .TAP, it works, so I think the problem is at saving, when writing header info on the file.

I need more info on this.
I couldn't replicate the issue. Please provide step by step instructions.

What I have tried:

  1. First used this code to create and save an array. Streamed data to TAPE IMAGE BUILDER using capture mode "Streaming>Save Commands" and saving to actual file as "a.bsd"
10 DIM a(3,3)
20 LET a(1,1)=4
30 LET a(2,2)=5: LET a(3,3)=7
35 FOR x=1 TO 3: FOR y=1 TO 3: PRINT a(y,x);: NEXT y: PRINT : NEXT x
40 SAVE "a" DATA a()

Now I have a number array block saved.

Now reset the spectrum (new file) and typed this snippet, loaded back the data successfully using streaming and loading directly from file

10 DIM a(3,3)
15 LOAD "" DATA a()
35 FOR x=1 TO 3: FOR y=1 TO 3: PRINT a(y,x);: NEXT y: PRINT : NEXT x

No problems encountered.

ok tested the recommendation and it seems like it fixed the issue. I checked a couple of scenarios and it looks ok. If there will be problems on loading from native drive, please report. (Fix added to V1.795 will be released soon)