How to create SNA file from z88dk-generated binary file?

ZX80, ZX 81, ZX Spectrum, TS2068 and other clones
Post Reply
Stefan123
Member
Posts: 85
Joined: Fri Oct 21, 2016 7:57 am

How to create SNA file from z88dk-generated binary file?

Post by Stefan123 »

I would like to test Mike Dailly's new Spectrum Next emulator CSpect at:
https://dailly.blogspot.se/2017/07/new- ... lator.html

However, it only supports SNA files. How do I create an SNA file from the binary file generated by z88dk?

I have tried the makesna tool at https://sourceforge.net/projects/zxspectrumutils/ in the following way:

Code: Select all

makesna my_prog.sna 32768 my_prog_CODE.bin 32768
Where 32768 is my CRT_ORG_CODE value. However, the generated SNA file is 131103 bytes (although my binary file is only 4009 bytes) so I think this tool creates a Spectrum 128K snapshot. It is my impression that CSpect only supports Spectrum 48K snapshots.

I also tried to create a snapshot file by loading my test program in the ZEsarUX emulator and save a snapshot but ZEsarUX doesn't support snaphsots in TBBlue mode.
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

I just added an issue to get appmake to build sna files:
https://github.com/z88dk/z88dk/issues/287

This site suggests that you may be able to extract a 48k snapshot from a 128k one by extracting the first 49179 bytes:
https://faqwiki.zxnet.co.uk/wiki/SNA_format

Maybe try this:

Code: Select all

makesna my_prog.tmp 32768 my_prog_CODE.bin 32768
appmake +extract -b my_prog.tmp -o my_prog.sna -l 49179
and see if the .sna works.

Other than that there are other sna converters around but they are very old because sna hasn't been in common use since the early days of spectrum emulation.

snapconv from http://www.worldofspectrum.org/utilities.html may be able to do what you want too but the included binary no longer works on 64-bit windows even with compatibility mode switched on.
Stefan123
Member
Posts: 85
Joined: Fri Oct 21, 2016 7:57 am

Post by Stefan123 »

Adding SNA support to appmake sounds good :-)

I tried your suggestion to truncate my SNA file with appmake but the SNA file still doesn't work in CSpect.

I'm not sure I trust the makesna tool. When I look at the SNA file it creates in a HEX editor, the code is placed in the display memory (0x4000) not at 0x8000 as I would have expected.
Stefan123
Member
Posts: 85
Joined: Fri Oct 21, 2016 7:57 am

Post by Stefan123 »

I erroneously thought an SNA file included the lower 16 KB ROM as well but now I realize that, naturally, it only includes the 48 KB RAM, hence why my code at 0x8000 was placed at 0x4000 in the SNA file.

However, CSpect still doesn't like my SNA files...
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

I think we have working sna generation in now.

Add:

-create-app -Cz"--sna"

to the compile line and a snapshot should be generated instead of a tap.
Stefan123
Member
Posts: 85
Joined: Fri Oct 21, 2016 7:57 am

Post by Stefan123 »

Alvin, I tried your added support for creating sna files today but I get the following error when using the z88dk build from 2017-07-22:

zcc +zx -vn -O3 -startup=31 -clib=new -m -L../zxnext_sprite/lib/sccz80 -lzxnext_sprite -I../zxnext_sprite/include src/zxnext_layer2_demo.c src/zxnext_layer2.c -o bin/sccz80/zxnext_layer2 -create-app -Cz"--sna"
sccz80:"src/zxnext_layer2.c" L:95 Warning:#55:Implicit definition of function 'intrinsic_ldi_num_256' it will return an int. Prototype it explicitly if this is not what you want.
zx: Error: File D:\Spectrum\z88dk\lib\config\..\..\bin/appmake/zx_48.sna not found
Building application code failed

Should there be a file called z88dk/bin/appmake/zx_48.sna in the z88dk installation?
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

Ack, I put the file in z88dk/bin which is not tracked by git.

I've updated git now and have moved the file into src/appmake/data instead.

You have some backward slashes in there so I think you're windows? If you don't want to wait you can grab my set of windows binaries here:
https://drive.google.com/file/d/0B6XhJJ ... sp=sharing

Copy into z88dk/bin.

You'll also need this file in the same place:
https://github.com/z88dk/z88dk/tree/mas ... pmake/data
Stefan123
Member
Posts: 85
Joined: Fri Oct 21, 2016 7:57 am

Post by Stefan123 »

Thanks Alvin, that did the trick and the generated SNA file works fine in CSpect :-)
Post Reply