Difference between revisions of "CWTool image format"

From DiscFerret
Jump to: navigation, search
(Created page with "Category:Disc image files *Format originator:* CWTool by Karsten Scheibler (http://www.unusedino.de/cw/) == Common features == Track numbers are stored as 'absolute' tracks...")
 
Line 1: Line 1:
 
[[Category:Disc image files]]
 
[[Category:Disc image files]]
  
*Format originator:* CWTool by Karsten Scheibler (http://www.unusedino.de/cw/)
+
'''Format originator:''' CWTool by Karsten Scheibler (http://www.unusedino.de/cw/)
  
 
== Common features ==
 
== Common features ==

Revision as of 13:26, 14 June 2011


Format originator: CWTool by Karsten Scheibler (http://www.unusedino.de/cw/)

Common features

Track numbers are stored as 'absolute' tracks. If a drive has only one magnetic head, the track number will match the physical track number used to read the given track.

When a drive has more than one head (e.g. a 3.5-inch double-sided 80-track drive), the following conversions are used:

  • Converting from physical track/head numbers to absolute track number: AbsTrack = (PhysTrack * NumHeads) + PhysHead
  • Converting from absolute track number to physical track/head numbers: PhysTrack = AbsTrack / NumHeads, PhysHead = AbsTrack % NumHeads (forward-slash denotes integer division, percent denotes an integer modulo operation)

This means that our typical 3.5-inch floppy disc with two physical heads and 80 physical tracks will -- to CWTool -- be seen as having 160 absolute tracks. Thus, in order to decode back to a cyl/head address, we need to know how many heads the original drive had, and how many were used to image the disc. Failing that, we can make an educated guess based on the maximum absolute track number seen in the image (e.g. a greater than 85 absolute tracks is likely to indicate that the image was created from a double-sided disc).

Binary file formats

All CWTool binary image formats begin with a 32-byte "magic string" which identifies the file format version. Possible magic strings include:

  • "cwtool raw data" -- binary format 1
  • "cwtool raw data 2" -- binary format 2
  • "cwtool raw data 3" -- binary format 3

Binary formats store tracks as a sequence of data blocks with a header prepended. This header consists of:

  • TRACK_MAGIC -- one byte, 0xCA
  • Physical track number -- one byte
  • Clock -- one byte
  • Flags -- one byte
  • Payload size -- 32-bit unsigned integer, little endian (most significant byte first)

Text-based file formats

This format is unique in that it stores the track data as decimal or hex numbers. The magic string detected by CWTool is "# cwtool raw text 3\n", where '\n' is an ASCII newline.

 # cwtool raw text 3
track_data track clock flags {