Newsgroups: comp.sys.sinclair
Path: ulke.hiMolde.no!trane.uninett.no!nntp.uio.no!ifi.uio.no!news.sics.se!eua.ericsson.se!erinews.ericsson.se!cnn.exu.ericsson.se!convex!cs.utexas.edu!news.sprintlink.net!EU.net!uknet!comlab.ox.ac.uk!imc
From: imc@comlab.ox.ac.uk (Ian Collier)
Subject: Re: Tape Header Information
Message-ID: <6252.imc@comlab.ox.ac.uk>
X-Local-Date: Wednesday, 15th March 1995 at 5:16pm GMT
Originator: imc@msc2.comlab
Organization: Oxford University Computing Laboratory
References: <3k1jva$37k@lion.inmos.co.uk> <3k3ndt$1es31@unixfe.rl.ac.uk>
Date: Wed, 15 Mar 1995 17:16:21 GMT
Lines: 52

In article <3k3ndt$1es31@unixfe.rl.ac.uk>, Mark Smith <mark@sa.rl.ac.uk> wrote:
>The tape header info is 17 bytes long

>Each tape file consista of a header section, then a data section.
>The first byte in the header is a flag (either 255 or 0, I can't remember,
...
>Then follows 17 bytes of information.
>I can't remember the order or the bytes, but
...
>                              I can't remember any more, but the last
>byte in the header is a checksum byte calculated by exoring all the bytes
>together.

Isn't the net wonderful in that even people who don't know the answer can
post a response...

A tape header contains 17 bytes of information [in addition to this
information, an initial zero byte is saved as the flag, and a final
checksum byte is added, which is the XOR of all the preceding bytes
including the flag.  You don't normally notice these, however, as they
are dealt with by the ROM routine]:

     offset   description
     0        type (0=program; 1=num array, 2=string array, 3=code)
     1-10     name (10 ASCII characters, space-filled)
     11-12    length of data (LSB first)
     13-14    start address of CODE
  or 13-14    program LINE number
  or 14       name/type byte of the array
     15-16    length of program excluding variables.

*However*, the original question was about the 9-byte header that precedes
items saved on the Interface 1 with SAVE *"b".  These bytes are saved
without flags or checksums, and are as follows.

     offset   description
     0        type
     1-2      length of data
     3-4      start address of data
     5-6      length of program excluding variables   (ignored for CODE)
  or 5        name/type byte of the array
     7-8      program LINE number        (ignored for non-program files)

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 .
