Page 1 of 1

Converting a .z80 snapshot for compiling?

Posted: Wed Apr 11, 2018 11:08 am
by Jodo
I've started writing a game in Sinclair basic and wanted to compile it to see if the speed increase would make it worth finishing. I was planning on trying Boriel's ZX Basic compiler.

Unfortunately, I wrote it in the Marvin emulator and I've only got a .z80 snapshot to work with. I don't fancy manually copying it into a text file unless it's the only option!

Re: Converting a .z80 snapshot for compiling?

Posted: Wed Apr 11, 2018 11:26 am
by Ast A. Moore
Use Fuse and its emulated ZX Printer feature to LLIST your BASIC to a standard TXT file.

Fuse can open Z80 snapshots. Alternatively, you can save your BASIC listing to a TAP file from Marvin (if it supports this feature).

Re: Converting a .z80 snapshot for compiling?

Posted: Wed Apr 11, 2018 11:41 am
by Jodo
Brilliant, thank you. That sounds like just what I need, I'll give it a try. Marvin only saves to .z80 as far as I can see.

Re: Converting a .z80 snapshot for compiling?

Posted: Wed Apr 11, 2018 3:14 pm
by Joefish
BASIN lets you load a snapshot, then view the BASIC listing in its text editor. I don't know about saving as plain text but you should be able to COPY + PASTE it into Notepad or something.

Re: Converting a .z80 snapshot for compiling?

Posted: Wed Apr 11, 2018 6:43 pm
by Jodo
Thanks Joefish, that's another option and sounds easy.
I managed to get the plain text file from Fuse and fed it to ZX Basic Compiler. My issue now is I get errors on every line except REM lines, to the point where the compiler gives up after line 15 :lol:
I shall have to look at the documentation I think!

Re: Converting a .z80 snapshot for compiling?

Posted: Wed Apr 11, 2018 6:48 pm
by Einar Saukas
Joefish wrote: Wed Apr 11, 2018 3:14 pm BASIN lets you load a snapshot, then view the BASIC listing in its text editor. I don't know about saving as plain text but you should be able to COPY + PASTE it into Notepad or something.
In BASIN you can save program as BAS file, then open it in any text editor.

Re: Converting a .z80 snapshot for compiling?

Posted: Thu Apr 12, 2018 9:27 pm
by Jodo
Thanks Einar, I managed to save the .z80 as .bas in BASIN but the file isn't visible except from the BASIN Open dialog. It's icon has a padlock and I can't drag it to Notepad to open it. Thanks anyway.

I managed to get the text file from Fuse though and after deleting extra spaces I managed to get ZX Basic Compiler to read it. Unfortunately I get a lot of errors and the compiler gives up. I don't know where to begin with them and after looking for help on the compiler pages I think it's well above my ability to sort them out :oops:

Anyway, thanks for all the help you gave guys.

Re: Converting a .z80 snapshot for compiling?

Posted: Thu Apr 12, 2018 10:18 pm
by serbalgi
Jodo wrote: Thu Apr 12, 2018 9:27 pm I managed to get the text file from Fuse though and after deleting extra spaces I managed to get ZX Basic Compiler to read it. Unfortunately I get a lot of errors and the compiler gives up. I don't know where to begin with them and after looking for help on the compiler pages I think it's well above my ability to sort them out :oops:
LLIST doesn't seem the best way to me. Have you tried listbasic from fuse-utils?

Code: Select all

listbasic snapshot.z80 > source.txt

Re: Converting a .z80 snapshot for compiling?

Posted: Thu Apr 12, 2018 10:24 pm
by Einar Saukas
Boriel's ZX BASIC doesn't have exactly the same syntax as Sinclair BASIC. For instance, every IF requires a corresponding END IF.

You need to read Boriel's documentation, then make the necessary changes before compiling your code.

Re: Converting a .z80 snapshot for compiling?

Posted: Fri Apr 13, 2018 2:51 pm
by Jodo
Thanks serbalgi, I've just tried listbasic. It seems to format the text exactly the same way as using llist from Fuse so still have to delete the extra spaces. It's not a huge issue though with only 204 lines of code so far and if I choose to continue I think I'll do it in ZX-Editor from this point! :D (Doing it on a Kindle Fire using a virtual Spectrum keyboard was a little too masochistic I think :D )

I've been through what documentation I can find on Boriel's site and wiki, I'm using the latest version of the compiler and I read something yesterday on the forum about ":End If" no longer being required and also tried using the --sinclair tag. Those errors are still there but I got rid of a third of them by changing a variable name which was also an array name - it worked okay in the BASIC but not accepted in the compiler. The BASIC itself runs fine, just a bit too slow to be truly playable and I still have some more collision detection to add! :roll: Anyway, going to have another look at the other errors now, I think 3 were about strings - which I haven't used!? :?