Newsgroups: comp.sys.sinclair
Path: ulke.hiMolde.no!trane.uninett.no!nac.no!ifi.uio.no!sics.se!eua.ericsson.se!cnn.exu.ericsson.se!convex!cs.utexas.edu!howland.reston.ans.net!news.sprintlink.net!EU.net!uknet!comlab.ox.ac.uk!imc
From: imc@comlab.ox.ac.uk (Ian Collier)
Subject: Re: The .Z80 file format for ZX Spectrum snapshots
Message-ID: <5947.imc@uk.ac.ox.prg>
X-Local-Date: Wednesday, 18th January 1995 at 5:24pm GMT
Originator: imc@msc5.comlab
Organization: Oxford University Computing Laboratory
References: <3f0v97$k0m@rug4.cs.rug.nl>
Date: Wed, 18 Jan 1995 17:24:13 GMT
Lines: 61

In article <3f0v97$k0m@rug4.cs.rug.nl>, gerton@rcondw.rug.nl () wrote:
>There are a large number of Spectrum emulators around at the moment, for many platforms.  Some of these
>emulators use their own snapshot format, but [why don't you all use my
>.Z80 format?]

>Arguments contra .SNA:

>The .SNA format stores the program counter and AF register pair on the stack; the emulator should, after
>  loading, do POP AF/RETN first (or only RETN?)  This causes problems when 1. the SP points to the ROM,
>  and 2. when the SP points into an area not intended to be used as a stack.

This is a consequence of the fact that the snapshot format was originally
used for a physical device.  On there you have no choice but to store the
return address on the stack because the Z80 puts it there when you press
the NMI button (this is several magnitudes worse on the Sam, on which
pressing the NMI button generates a huge number of requests).  I have
not in general found this to be a problem.

>                                                    2 is not academic at all: many, many modern games
>  use PUSH to clear memory, or to transfer a block quickly (quicker than LDIR, that is).

Frode has demonstrated that using PUSH to perform an LDIR is not quicker.
Using PUSH to clear memory would be, but I have never seen it used.

>It is always 48K long, even for 16K programs or well-compressable programs.

But it can be zipped.

>Arguments pro .Z80:

>The compression and decompression algorithm used is very simple.

>Arguments contra .Z80:

The compression and decompression algorithm used is very simple.  I think I
would prefer the compression to be left to compression tools which can do a
good job (if you really need the disk space, why not let the emulator call
the decompressor to decompress it?...).

The format of .Z80 does not seem to have been well publicised.  It has
never appeared in the Spectrum FAQ (whereas the .SNA format has), and I
have never seen a document describing it.  I noticed the reference
at the bottom of the quoted article and am at this moment attempting
to retrieve it.  At 75 bytes per second!!

Now, given that .Z80 exists and is the only common format that supports 128K
(as far as I know), it would be silly to invent another.  But I think that
.SNA should also be supported by 48K emulators as it seems to be the most
commonly used format at the moment.

Now I'm off to read that document as it just arrived...

Ian Collier - Departmental Lecturer (and perpetual postgrad student) -
imc@comlab.ox.ac.uk - Oxford University Computing Laboratory, Wolfson
Building, Parks Road, Oxford OX1 3QD - WWW Home Page (including Spectrum
section): http://www.comlab.ox.ac.uk/oucl/users/ian.collier/index.html

New to this group?  Answers to frequently-asked questions can be had from
http://www.nvg.unit.no/spectrum/ .
>New< - Visit the Sam Coup FAQ at:
http://whirligig.ecs.soton.ac.uk/~tsp93/Coupe/FAQ.txt .
