Converting a .z80 snapshot for compiling?

The place for codemasters or beginners to talk about programming any language for the Spectrum.
Post Reply
Jodo
Drutt
Posts: 25
Joined: Wed Apr 11, 2018 10:52 am
Location: West Yorkshire, UK

Converting a .z80 snapshot for compiling?

Post 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!
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2640
Joined: Mon Nov 13, 2017 3:16 pm

Re: Converting a .z80 snapshot for compiling?

Post 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).
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Jodo
Drutt
Posts: 25
Joined: Wed Apr 11, 2018 10:52 am
Location: West Yorkshire, UK

Re: Converting a .z80 snapshot for compiling?

Post 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.
User avatar
Joefish
Rick Dangerous
Posts: 2042
Joined: Tue Nov 14, 2017 10:26 am

Re: Converting a .z80 snapshot for compiling?

Post 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.
Jodo
Drutt
Posts: 25
Joined: Wed Apr 11, 2018 10:52 am
Location: West Yorkshire, UK

Re: Converting a .z80 snapshot for compiling?

Post 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!
User avatar
Einar Saukas
Bugaboo
Posts: 3070
Joined: Wed Nov 15, 2017 2:48 pm

Re: Converting a .z80 snapshot for compiling?

Post 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.
Jodo
Drutt
Posts: 25
Joined: Wed Apr 11, 2018 10:52 am
Location: West Yorkshire, UK

Re: Converting a .z80 snapshot for compiling?

Post 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.
serbalgi
Drutt
Posts: 27
Joined: Sat Jan 06, 2018 11:13 am

Re: Converting a .z80 snapshot for compiling?

Post 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
User avatar
Einar Saukas
Bugaboo
Posts: 3070
Joined: Wed Nov 15, 2017 2:48 pm

Re: Converting a .z80 snapshot for compiling?

Post 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.
Jodo
Drutt
Posts: 25
Joined: Wed Apr 11, 2018 10:52 am
Location: West Yorkshire, UK

Re: Converting a .z80 snapshot for compiling?

Post 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!? :?
Post Reply