Page 1 of 1

Mysterious lost program coding!

Posted: Tue May 15, 2018 5:45 pm
by llewelyn
If anyone can please help I would be very grateful. I created a better TANK picture from UDG's using BASin for Beginners. I ran it and it worked just fine, the animated tracks could use some work but it wasnt bad for a mornings work.

Saved it as a .SNA to reload into Fuse my preferred choice for coding and editing Basic. Heres where it gets weird. Fuse displayed the tank as a static image (no track movement) which must mean it received the listing that told it what to do, right?

Trouble is, there is no listing nor will it allow me to insert more code. Its like it locked me out of my own work. Tried putting it back into BASin, same thing. How is it even possible to display an image without its listing to follow?
Heres the file in question:-

http://s000.tinyupload.com/index.php?fi ... 9470768592

Re: Mysterious lost program coding!

Posted: Tue May 15, 2018 6:20 pm
by MonkZy
I loaded the snapshot into ZEsarUX and get the same result as Fuse, the tank is displayed but the spectrum is locked up. In ZEsarUX you can use the debugger to display the BASIC, the program only contains PRINT lines displaying the UDG's inside an endless loop. There are no lines of BASIC POKEing the UDG data. Did you POKE the UDG data by hand? It seems the snapshot is broken somehow. The tank looks great though. The UDG data can be recovered from the screen data, if u need it.

Re: Mysterious lost program coding!

Posted: Tue May 15, 2018 7:16 pm
by llewelyn
All the program consisted of was the set of UDG's called by a PRINT CHR$ (152) etc. followed by a second set of 4 UDG's for the alternative tracks. There was a PAUSE between the two sets of UDG's and a GOTO at the end so that the effect was to make the tracks animated.

I suppose I can do it all again, its a pain but its not that hard to do using BASins very handy UDG editing tool, best I've found. Besides I may be able to improve on it.

Thanks MonkZy for figuring it out, it baffled me completely, how can a program display an image without any listing? The other thing that bothered me a bit was the reported file size of 48k! Surely that cant be right? Not for just 12 UDG's - no way!

Thats not the first time that BASin and Fuse between them seem to have screwed up my files. I saved the early version using Fuse which reported that the saved file may be corrupted, it uses non-standard something or other or words to that effect. Before that BASin saved as a snapshot which ran fine in itself but appeared mangled in Fuse with a 'Nonsense in Basic' report.

Re: Mysterious lost program coding!

Posted: Tue May 15, 2018 7:27 pm
by Seven.FFF
It's not that there's no listing. It's that the machine is crashed, and is stuck in an endless loop. Not your BASIC program, but the part of the machine that reads and executes BASIC, and responds to keypresses, is no longer doing that.

Normally you get chucked back to a reset and (c) 1982 when that happens, but in this case, as Ast said on your other thread, not here. And being a snapshot, you have a nicely preserved snapshot of an ongoing crash, which you can load up and carry on crashing at any point!

Re: Mysterious lost program coding!

Posted: Tue May 15, 2018 7:31 pm
by R-Tape
Looks like it's solved, but in case it's any use here is the snapshot broken out of the lock.

I don't know if I got lucky but I set the program counter to 56 (the BASIC interrupt entry point) and it snapped out of it! (you can do this in some emulator debuggers and ZX-Blockeditor)

Re: Mysterious lost program coding!

Posted: Tue May 15, 2018 7:50 pm
by Ast A. Moore
R-Tape wrote: Tue May 15, 2018 7:31 pm I don't know if I got lucky but I set the program counter to 56 (the BASIC interrupt entry point) and it snapped out of it! (you can do this in some emulator debuggers and ZX-Blockeditor)
Hmm. Looks like it was an emulator-specific fluke. Interrupts are not disabled and keep occurring at regular intervals, but the address on the stack keeps growing . . . I don’t know, I never fully trusted the practice of exchanging snapshots (.sna files in particular) between different emulators. That’s a recipe for disaster.

Re: Mysterious lost program coding!

Posted: Tue May 15, 2018 8:15 pm
by llewelyn
Thank you all very much! Ast_A_Moore your reprimand is duly noted - I should know better. R-Tape thats the second time you've been most helpful, thank you too. It makes all the difference to have some helpful chaps who can act as mentors to this old man!

Well I've learnt a useful and valuable lesson today. Swapping files between programs is fraught with dangers that could be minimised by starting out with the listings kept and where applicable any attachments kept safely separate.

I should have suspected something was up when BASin kept on suggesting I save the file as 128k Spectrum mode. I've never used a 128k machine or an emulated version though funnily enough I was about to ask for some advice with that.

My question is, as I understand it the 128k pulls the trick off by using bank switching. So, can I save more than one UDG set in separate banks to be called upon as required and (2) is there a manual available that explains how to do the bank switching from Basic?

Re: Mysterious lost program coding!

Posted: Tue May 15, 2018 8:19 pm
by hikoki
what about using some other file format like .bin to swap files between Basin and Fuse?

Re: Mysterious lost program coding!

Posted: Tue May 15, 2018 9:03 pm
by Ast A. Moore
llewelyn wrote: Tue May 15, 2018 8:15 pm My question is, as I understand it the 128k pulls the trick off by using bank switching. So, can I save more than one UDG set in separate banks to be called upon as required and (2) is there a manual available that explains how to do the bank switching from Basic?
How many UDGs do you plan to use? I sincerely doubt you’re going to need more RAM than is available to you on a 48K Speccy. I you run out of the 21 characters in a set, simple define a few more sets and switch between them. Alternatively, redefine the characters of a font. You’ll have 768 bytes per font (96 characters) and the ability to switch between them just as easily. It’s much simpler and safer than messing about with bank switching. Besides, when running in 128 BASIC, you’ll only have 19 UDGs, as two of them are reserved for the new BASIC keywords: PLAY and SPECTRUM.