DiskToImg v0.29 and ImgToDisk v0.24 - Copy disk images to/from floppy disks =========================================================================== J.G.Harston - 1999-2015 mdfs.net/Apps/DiskTools -- jgh@mdfs.net 70 Camm Street, Walkley, Sheffield S6 3TR DiskToImg is a program that creates a disk image from a floppy disk, and ImgToDisk performs the complementary action of copying a disk image to a floppy disk, optionally formatting it first. Both programs will run on RISC OS or BBC/Master. The programs can be run as a *command or CHAINed. Summary ------- CHAIN "DiskToImg () (-size ) -invert -mix -zero -v -help" or *DiskToImg () (-size ) -invert -mix -zero -v -help CHAIN "ImgToDisk () (-size ) -invert -format -v -help" or *ImgToDisk () (-size ) -invert -format -v -help Specifying disk format ---------------------- Disk formats can be specified with a geometry parameter as follows: G::::::: or with any combination of: D:Q:H:T:N:N:Z ImgToDisk also recognises the following geometry parameters when formatting: O:I parameter default 1 1, 2 or 4 for single, double or high density 1 1 for sequential tracks, 0 for interleaved tracks 1 number of sides, 1 or 2 80 number of tracks, eg 35, 40, 70, 80, 84, etc. 1 sector size, 0=128, 1=256, 2=512, 3=1024, etc. 256 sector size in bytes, must be a power of 2 10 number of sectors per track, eg 10, 16, etc. 0 hex number of the first sector on a track, eg 00, 01, etc offset of sectors numbers between tracks 1 interleave between sectors on a track For example: G:1:1:2:80:1:10:00 is 2xDFS, AcornCPM, TorchCPN, HADFS G:2:0:2:80:2:18:01 is DOS 1440K D2:Q1:H2:T80:N256:N16:Z0 is ADFS L 640K T35:S0:N16:Z01 is MZ80K, with default D1:Q1:H1 Disk formats that can also specified with the -size parameter as follows: tracks bytes/ seq/ sides sectors sector density int examples ----------------------------------------------------------------------------- -size 70K 1 35 16 128 FM seq 1xMZ-80K -size 100K 1 40 10 256 FM seq 40T DFS -size 140K 2 35 16 128 FM seq 2xMZ-80K -size 160K 1 40 16 256 MFM seq ADFS S -size 200K 1 80 10 256 FM seq 80T DFS -size 280K 2 35 16 256 MFM seq MZ-80A/B -size 320K 1 80 16 256 MFM seq ADFS M -size 360K 2 40 9 512 MFM int DOS 360K -size 400K 2 80 10 256 FM seq 2xDFS, AcornCPM, TorchCPN, HADFS -size 640K 2 80 16 256 MFM seq ADFS L, Filestore -size 720K 2 80 9 512 MFM int DOS 720K -size 800K 2 80 5 1024 MFM int MDFS, AcornDOS, ADFS D, ADFS E -size 1440K 2 80 9 512 MFM int DOS 1440K -size 1600K 2 80 5 1024 MFM int ADFS F Note that disk formats readable are dependent on the floppy disk hardware of the machine the program is running on. The -size option can be modified with a geometry option. The usual use of this is to use a different track interleave or a different base sector number. For example: -size 400K Q0 will image a double-sided DFS disk, but store it as an interleaved image instead of the default sequential image. Command options --------------- -help This options causes a summary list of all command options and parameters to be displayed. -verbose An updating display of the current track being transfered is displayed, along with what format the disk appears to be. -format The destination disk is formatted before copying. Otherwise, the destination disk must already be suitably formatted for the image to be copied to it. The -format option currently does not work for 200K, 320K and 400K, and only works on RISC OS. -mix Slogger DDCPM disks use a different density on different tracks. The -mix option should be used to give DiskToImg a hint. -zero Track 0 starts at sector 0, not at the sector number specified with the Z geometry parameter. This is for disks such as Flex disks where tracks normally start with sector 1, but track zero starts with sector 0. -invert Inverts all disk data. -auto Attempt to automatically sense the disk format. This is the default option if no geometry is specified. DiskToImg attempts to automatically sense the disk format track by track so disks formatted to a different density on each track can be imaged. When DiskToImg has worked out what the disk format is it displays what disk format it appears to be. The -auto option always tries to image two sides of 80 tracks unless the T or H options are used. DiskToImg currently cannot image disks where each sector on a track is a different size, or where sectors are missing on a track. ImgToDisk can be given the -auto option, which selects a disk format based on the size of the image file. The format selected is that which is listed by using the -help option. All command options can be abbreviated to a single character, other than -help which must be given in full. Definitions ----------- A sequential disk image is one where the data is stored sequentially, up one side of the disk, then up the other side: side 0/track 0, side 0/track 1, side 0/track 2, side 0/track 3... ...side 0/track 79, side 1/track 0, side 1/track 1... An interleaved disk image is one where the data from each side of the physical disk is interleaved in the disk image: side 0/track 0, side 1/track 0, side 0/track 1, side 1/track 1... ...side 0/track 78, side 1/track 78, side 0/track 79, side 1/track 79. DiskToImg and ImgToDisk default to using the natural track ordering that matches the filesystem on the disk or in the image. 8-bit BBC filing systems are all sequential and images will default to sequential track ordering. This can be overridden using the Q geometry parameter. Mixed-density disks ------------------- If the imaged disk is formatted to a different density on different tracks, as with Slogger DDCPM disks, the image of lower density tracks are padded to the size of the highest density tracks. If the higher density tracks are exactly twice the size of the lower density tracks, then each low density sector is padding with &FF bytes after it to the length of the high density sectors, otherwise the end of the whole track is padded with &FF bytes. For example, with a disk with some tracks formatted to 10x256 FM and some tracks formatted to 16x256 MFM, the image will contain: 0123456789xxxxxx 0123456789xxxxxx 0123456789xxxxxx 0123456789ABCDEF 0123456789ABCDEF 0123456789ABCDEF With a disk with some tracks formatted to 10x256 FM and some tracks formatted to 10x512 MFM (as with Slogger DDCPM disks), the image will contain: 0x1x2x3x4x5x6x7x8x9x 0x1x2x3x4x5x6x7x8x9x 0x1x2x3x4x5x6x7x8x9x 00112233445566778899 00112233445566778899 00112233445566778899 This also means that the offset from the start of the image to a particular sector is a constant multiple regardless of the density of the imaged sector. Version History --------------- DiskToImg: v0.12 26-Mar-1999 Quick initial version. v0.20 03-Aug-2010 Completely rewitten, better interface, more supported formats. v0.21 10-Dec-2011 Added DOS 1440K and ADFS 1600K, bugfixed 200K. v0.22 07-Feb-2012 Added -autosense option to DiskToImg. v0.23 14-Feb-2012 Put BBC disk access code back in. v0.24 15-Feb-2012 Generalised geometry interface, -auto is default option. v0.25 26-Feb-2012 Slogger Disks pads sectors instead of tracks. v0.26 04-Mar-2012 Bugfix, would display "autosense" even if size specified, -invert option added. v0.27 26-May-2012 If full track can't be read, attempts to read individual sectors. Added interleaved ADFS. v0.27a 18-May-2014 Bugfix, accesses side 2 on BBC/Master correctly, forces all disk access to floppy drive, -help displays version. v0.28 17-Aug-2014 Normal exit uses exit(0), -help option must be in full. v0.29 16-Feb-2015 -size parameter can be modified by geometry parameters, added -zero switch. ImgToDisk: v0.10 29-Dec-2008 Initial version, only does 200K/400K/640K disks. v0.21 10-Dec-2011 Uses command line, has -format option larger list of recognised disks. v0.22 07-Feb-2012 Uses number of tracks to find second side. v0.23 25-Nov-2012 Removed Windows code as cannot access Windows disk hardware as user-land program. Added -debug option. Full disk geometry can be specified, can write disks on BBC/Master. Added interleaved ADFS. v0.23a 26-May-2014 Bugfix, accesses side 2 on BBC/Master correctly, forces all disk access to floppy drive, -help displays version. v0.24 17-Aug-2014 Accepts same geometry parameters as DiskToImg, added -invert option.