01-13-2015, 05:59 AM
I'm making a program to print customized labels with the ZX Printer. I was going to make load/save of label data.
The problem is when using SAVE in any of its variants inside a SUB. It freezes after saving is done, and the saved data is different from when the SAVE is done in the 'main block'.
The LOAD command does work inside a SUB.
I don't know if it has some relation to the previous bug report about SAVE:
<!-- l --><a class="postlink-local" href="http://www.boriel.com/forum/bug-reports/save-bug-solved-t858.html">bug-reports/save-bug-solved-t858.html</a><!-- l -->
Here is a little program that reproduces the error:
The problem is when using SAVE in any of its variants inside a SUB. It freezes after saving is done, and the saved data is different from when the SAVE is done in the 'main block'.
The LOAD command does work inside a SUB.
I don't know if it has some relation to the previous bug report about SAVE:
<!-- l --><a class="postlink-local" href="http://www.boriel.com/forum/bug-reports/save-bug-solved-t858.html">bug-reports/save-bug-solved-t858.html</a><!-- l -->
Here is a little program that reproduces the error:
Code:
dim variableToSave as uinteger
variableToSave = 1234
sub saveSomething()
' This freezes the program AFTER saving is done
save "test1" DATA variableToSave
' This freezes the program AFTER saving is done and shows a funny "demo"
'save "test1" screen$
end sub
sub waitForAKey()
while inkey$=""
end while
while inkey$<>""
end while
end sub
print "Press any key to start save..."
waitForAKey()
saveSomething()
'This works (in the main block)
'save "test1" DATA variableToSave
print "Save done. Press any key to continue..."
waitForAKey()
' Do some random stuff (the Spectrum freezes before reaching here):
dim i as uinteger
i = 2 + 2
print "i = "; i
print "Press any key to exit..."
waitForAKey()