Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SAVE inside SUB freezes the program (*solved*)
#1
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:

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()
Reply
#2
Sorry for the delay. But I was a bit busy these last month.
Which version are you using?
Anyway latest version *crashed* the compiler, so will have a deeper look into it... :?
Reply
#3
Ok. It was a bug with the SAVE routine, and I think I've fixed it.
Please, can you download version ZX Basic 1.4.0-s1918 and test it.

Note: I'm also checking for the LOAD routine, as it might contain the same bug.
Update: LOAD does not suffer from this bug. Smile
Reply
#4
Thank you for debugging it.
I've tested the sample program and it doesn't freeze anymore Smile
Im sorry but I don't have now the time to make more thorough tests. The labels program was finished without the save feature. Also, I don't have anymore an emulator with save capabilities (was using ZXSpin on Wine, but can't use Wine anymore)

Greetings
Reply
#5
juanjo Wrote:Thank you for debugging it.
I've tested the sample program and it doesn't freeze anymore Smile
Im sorry but I don't have now the time to make more thorough tests. The labels program was finished without the save feature. Also, I don't have anymore an emulator with save capabilities (was using ZXSpin on Wine, but can't use Wine anymore)

Greetings
Thanks!

My favourite was EmuZWin (now abandoned). By far the best. A pitty Sad
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)