FAQ  •  Register  •  Login

SAVE inside SUB freezes the program (*solved*)

<<

juanjo

Posts: 3

Joined: Tue Feb 03, 2009 2:54 am

Post Tue Jan 13, 2015 5:59 am

SAVE inside SUB freezes the program (*solved*)

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:
bug-reports/save-bug-solved-t858.html

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()
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Sat Jul 11, 2015 6:42 pm

Re: SAVE inside SUB freezes the program

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... :?
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Sun Jul 12, 2015 4:40 pm

Re: SAVE inside SUB freezes the program

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. :)
<<

juanjo

Posts: 3

Joined: Tue Feb 03, 2009 2:54 am

Post Mon Jul 13, 2015 1:41 pm

Re: SAVE inside SUB freezes the program

Thank you for debugging it.
I've tested the sample program and it doesn't freeze anymore :)
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
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Mon Jul 13, 2015 2:29 pm

Re: SAVE inside SUB freezes the program

juanjo wrote:Thank you for debugging it.
I've tested the sample program and it doesn't freeze anymore :)
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 :(

Return to Bug Reports

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO