Problem with SNA files in newer versions of z88dk

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

Problem with SNA files in newer versions of z88dk

Post by Stefan123 »

I just switched to the latest snapshot version of z88dk (20171205) but noticed that the created SNA files doesn't work in CSpect 1.0 anymore, they just crash. Not all SNA files crash though, the common denominator seems to be source files where I have set the stack location to something else than the default, i.e. I'm using "#pragma output REGISTER_SP = 0xBFFF" instead of "#pragma output REGISTER_SP = -1".

Previously, I have been using the z88dk snapshot version from 20170827 a lot and the SNA files it creates, regardless of if REGISTER_SP = 0xBFFF or REGISTER_SP = -1 is used, work fine in CSpect 1.0.

This is the command-line I use when compiling:
zcc +zx -vn -O3 -startup=30 -clib=new test.c -o test -create-app -Cz"--sna"

I looked around in the appmake source code and noticed that the option --sna-sp has been added. So I tried to use the option -Cz"--sna --sna-sp 49151" when compiling but the created SNA file still crashes.

What am I doing wrong?
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

The org address was pushed onto the stack in the wrong location in 48k snapshots.
It will be fixed in the Dec 7 build.
Stefan123
Member
Posts: 85
Joined: Fri Oct 21, 2016 7:57 am

Post by Stefan123 »

Thanks for the fix, now it works again :)
Stefan123
Member
Posts: 85
Joined: Fri Oct 21, 2016 7:57 am

Post by Stefan123 »

What is the recommended way of creating an SNA file: Using -Cz"--sna" or -subtype=sna?
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

subtype is the way it's going because it automatically adds the options for appmake but of course you can do it yourself like you're doing too.

subtype is being implemented in the target's config file.

For zxn.cfg in https://github.com/z88dk/z88dk/blob/mas ... xn.cfg#L26 :

Code: Select all

SUBTYPE   default -Cz+zxn
SUBTYPE   bin     -Cz"+zxn --bin"
SUBTYPE   zxn     -Cz+zxn
SUBTYPE   tap     -Cz+zxn
SUBTYPE   sna     -Cz"+zxn --sna"
SUBTYPE   dot     -Cz"+zxn --dot" -startupoffset=0x100 -D__ESXDOS_DOT_COMMAND -Ca-D__ESXDOS_DOT_COMMAND -Cl-D__ESXDOS_DOT_COMMAND
SUBTYPE   dotx    -Cz"+zxn --dot" -startupoffset=0x200 -D__ESXDOS_DOT_COMMAND -Ca-D__ESXDOS_DOT_COMMAND -Cl-D__ESXDOS_DOT_COMMAND
SUBTYPE dotn -Cz"+zxn --dot" -startupoffset=0x300 -D__ESXDOS_DOT_COMMAND -Ca-D__ESXDOS_DOT_COMMAND -Cl-D__ESXDOS_DOT_COMMAND
You may also want to add "-Cz--clean" to get the files that the sna generator uses deleted after use. I had that in there by default originally but there's no way to opt out of that if it's the default.

The "subtype=zxn" is not implemented yet and defaults to tap.
Post Reply