Subject: Re: function of the atr-file header Date: 23 Sep 1996 22:32:20 GMT From: feb6399@osfmail.isc.rit.edu (Frank Barrus) Organization: Rochester Institute of Technology, Rochester, NY Newsgroups: comp.sys.atari.8bit References: <324433D6.1E78@kawo2.rwth-aachen.de> In article <324433D6.1E78@kawo2.rwth-aachen.de>, Matthias Belitz wrote: >Hello ! > >Is anyone here, could tell me the function of the 16 byte file-header of >the ATR-files. > >Thanks Matt Well, here's the structure from it, taken out of ACE (the Atari Computer Emulator) struct sio2pc_image_hdr { byte code_lo, code_hi; /* ID code = 0x0296 */ byte size_b1, size_b2; /* low 16-bits of size */ byte secsize_lo, secsize_hi; /* sectors size: 128/256 */ byte size_b3, size_b4; /* high 16-bits of size (paragraphs) */ byte resv[6]; /* reserved */ byte numerr_hi, numerr_lo; /* number of sectors with errors */ }; struct errormap { byte sec_lo, sec_hi; /* sector with error */ byte cstat; /* communication status */ byte hstat; /* hardware status */ byte resv[4]; /* reserved */ }; Note that the size (which is stored in size_b1 through size_b4) is in paragraphs, or multiples of 16. Thus, take the total number of sectors, multiply by the sector size, and divide by 16, then store this result across those four bytes. (Actually, I might have added bytes 3 and 4 to it.... or someone else might have already. I can't remember now) Note that the errormap was an extension I added, but I'd like to see it get standardized, since they're useful for some disks. Basically, the errormap sits at the end of the data, and 'numerr' specifies the number of error records. Each one tells what sector should give an error when reading it, along with the codes that should be given for the error. The reserved part could be used to add other information for really strange errors. (but make sure you publish the extensions, if you add any!) I hope this helps some. - Frank -- Frank "Shaggy" Barrus: feb6399@osfmail.isc.rit.edu, shaggy@csh.rit.edu http://www.csh.rit.edu/~shaggy