Resource centre for ZX Spectrum games
      using Manic Miner and Jet Set Willy game engines

 

Archive of the

Manic Miner & Jet Set Willy Yahoo! Group

messages

 

 

 

Message: 4416

Author: andrewbroad

Date: 24/08/2004

Subject: Re: TAP files and checksums

 

Alexandra wrote:

>
> Thank you both for the tutorials. I'm starting to get my head
> round them though it's still very much 747 to some extent.

747?


> I have started by trying to insert some of Geoff's routines to my
> own file, but 2 old problems have resurfaced - 1) editing in a hex
> file causes the game to crash (is this to do with checksums or
> something?)

Yes, if you edit a TAP file in a hex-editor or a text-editor, you
will invalidate the checksum(s).

That's why I wrote SPECSAISIE FixChecksums, which loads a TAP file
ignoring the checksums, and resaves it with correct checksums.


> 2) I need to know how to convert the addresses in the hex editor
> into spectrum memory addresses. I think it begins at the first
> block of 20's after the sea of 0's at the beginning, but I'm not
> sure.

A TAP file consists of one or more Spectrum files, stored one after
another in the obvious way (the TAP format respects simple file-
concatenation).

In short, each Spectrum file in a TAP file consists of 24 bytes,
followed by the data themselves, followed by a checksum-byte.

In detail, a Spectrum file consists of a header followed by a data-
block:

Structure of header:
- Offsets 0-1 : how many bytes will follow (always 19)
- Offset 2 : flag-byte (always 0)
- Offset 3 : file-type (0=BASIC, 1=NUMBER ARRAY,
2=CHARACTER ARRAY, 3=CODE)
- Offsets 4-13 : filename
- Offsets 14-15 : length of data-block
- Offsets 16-17 : parameter 1 } file-type
- Offsets 18-19 : parameter 2 } specific
- Offset 20 : header checksum-byte

Structure of data-block:
- Offsets 0-1 : how many bytes will follow
- Offset 2 : flag-byte (non-zero)
- Offsets 3-n : the data
- Offset (n+1) : data checksum-byte

[ http://www.srcf.ucam.org/~pak21/cssfaq/reference/formats.htm ]

--
Dr. Andrew Broad
http://www.geocities.com/andrewbroad/
http://www.geocities.com/andrewbroad/spectrum/

 

 

arrowleft
arrowright