Home » SAM Coupé » SamDisk v2.0

SamDisk v2.0


Introduction

SamDisk is a command-line utility for Windows 2000 and XP, used to transfer between physical SAM Coupé disks (both floppy and IDE) and disk images (DSK/MGT/IMG/HDF).

Version 2.0 adds many more features, including smarter copying, formatting, verifying, directory listing, disk scanning, and IDE support.

This utility requires a floppy drive connected to a standard motherboard connector. USB floppy drives cannot be supported as there is no way to access their embedded floppy controller chip.

Download

SamDisk v2.0 (21K) - Windows 2000/XP/2003
SamDisk v1.1 (17K) - old NT4 version (supports basic copying only)

Windows 95/98/Me users should use Edwin Blink's Disk Manager instead.

Floppy Usage

Copying

For a basic copy, simply specify the source and destination as arguments:

SamDisk.exe a: MyImage.dsk

This creates a disk image of the disk in drive A:, writing the contents to MyImage.dsk (in DSK format). This image can also be written back to the disk by reversing the arguments:

SamDisk.exe MyImage.dsk a:

As well as disk images and real floppy disks, you can also transfer to/from records on BDOS hard disks using the drive:record syntax, such as:

SamDisk.exe MyImage.mgt 2:34

This writes the contents of a MGT-format disk image to BDOS record 34 on IDE drive 2. For details on determining the correct drive number, see the IDE Usage section below.

When copying between images and real disks, SamDisk checks to make sure the target is suitable for the contents of the source. Because of this, when writing to real disks it may be necessary to re-format the target as part of the copy, which can be done by adding a /F parameter to the copy.

You may like to verify that data written to real disks can be read back successfully. You can do this as part of the copy processing by adding a /V parameter.

If you're working with standard SAMDOS/+D disk images, you can optimise the copy process by transferring only the used portions of the disk. This works best with near-empty disks, which will take only a fewseconds. To use minimal copying simply add a /M parameter.

The copy process is halted if errors are encountered when reading from a real floppy disks, which can be a problem for old disks that have deteriorated. Add a /E parameter tells SamDisk to report errors but continue copying. Write errors are still fatal, though re-formatting the target disk can often help fix them.

Verifying

Verifying a disk performs a sector-level read test of the entire disk:

SamDisk.exe /verify a:

This verifies the full 80 tracks on both sides of the disk. To verify only the used portions of a standard SAMDOS/+D disk add the /M parameter to perform a minimal verify of used disk areas.

By default, disk errors will halt the scanning, as you'll often want to discard a faulty disk. To ignore these errors and continue verifying the remainder of the disk add a /E parameter. The most common disk errors you're likely to see are data CRC errors and missing sectors.

You can also verify a chosen block of tracks as follows:

SamDisk.exe /verify /t:20 a:
SamDisk.exe /verify /t:70-79 /s:0 a:

The first example verifies the first 20 tracks on both sides of the disk. The second one verifies tracks 70 to 79 on side 0 of the disk only.

Formatting

To format an 80-track SAM/+D disk using the standard 10-sector format use:

SamDisk.exe /format a:

As with the verify command, you can choose to format a range of tracks using the /T: and /S: parameters. Please remember that both sides are formatted by default, so you must specify /S:0 or /S:1 to format only side 0 or 1!

A track skew of 1 sector is used by default, which matches that used by both MasterDOS and BDOS. You can use the /K:skew parameter to alter this value, but it's recommended that you keep the default value for optimal reading and writing speed.

Directory listing

When working with disks and images, it's often necessary to know the contents of each. SamDisk can list the SAM/+D directory contents of floppy disks, disk images and BDOS records, as follows:

SamDisk.exe /dir A:
SamDisk.exe /dir MyImage.dsk
SamDisk.exe /dir 2:7

Add the /A parameter to include hidden files in the listing.

Scanning

When dealing with unknown or suspected copy-protected disks, it can be useful to view the disk's logical track format. The scan command does just that, showing all sectors it finds, and anything unusual about each:

SamDisk.exe /scan a:

Here's what the first tracks of a normal SAM disk would look like:

0:0   1 2 3 4 5 6 7 8 9 10
0:1   10 1 2 3 4 5 6 7 8 9

The first track contains 10 sectors in the order 1 to 10. All ten sectors have the correct ID field values, and are 512 bytes each. The second track also contains ten sectors, but starting with sector ten (giving an efficient one-sector skew).

Here's a slightly more unusual disk format, as used by SAM Lemmings:

0:0   1 2
1:0   5[s=3] 3[s=3] 6[s=3] 4[s=3] 1 2[s=3]

The first track contains two normal 512-byte sectors. The second track contains five 1024 byte sectors (size=0 for 128 bytes, 1 for 256, 2 for 512 and 3 for 1024), and a single 512-byte sector.

As well as size, the track and head values found in the ID field will also be shown if they don't match their physical locations. At present, no attempt is made to read the data from the sectors to check for CRC errors.

As with verifying and formatting, you can choose to scan only a small range of tracks. This is perhaps most useful to check for data in tracks squeezed on the end of the disk:

SamDisk.exe /scan /t:80-82

Future versions of SamDisk will support these extended disks, as well as general copy-protection methods.

CP/M disks

SamDisk also supports the copying and formatting of CP/M disks, as used by Pro-Dos. These disks use a DOS-style 9-sector format, which means they're not SAMDOS compatible.

Copying to and from CP/M disks is detected automatically, so you can use the normal SamDisk copy syntax. The difference in disk format means image files are 720K in size rather than the normal 800K. When writing CP/M disks back to a floppy the target will need to be in 9-sector format (unless you use /F to format as part of the copy).

To correctly format a CP/M disk you must use the /CPM parameter with the format command, as follows:

SamDisk /format /cpm a:

Special thanks to Steve Parry-Thomas for his help with CP/M testing. Details of using Pro-Dos on the SAM can be found on his website.

IDE Usage

In addition to floppy disks, SamDisk can also read and write images of IDE devices. This allows the backup of the non-standard hard disks and compact flash cards, which isn't normally easy on Windows.

With your IDE drive connected, use the following command to list the available devices:

SamDisk.exe /dir

Only devices <= 8GB are shown, unless you add /A to view all disk devices. Here's a typical output from the command, with a 32MB CF card attached:

2: = 32MB, 63488 sectors, CHS=124,16,32, BDOS (40 records), bootable

The start of the line shows the drive number followed by a colon (2:). This will be used to refer to the device in any commands, much like a regular drive letter. The details also includes the device size in sectors, and a suitable geometry used to refer to the device (which may not exactly match what the card reports). In this case the device was identified as a BDOS disk, with space for 40 records.

With BDOS disks you can also list the records available, using the drive number from above:

SamDisk.exe /dir 2:

The result of this will be much like using the RECORD command in BDOS, giving the record numbers and names for any defined:

Record names: 1 : one
2 : two
5 : five
6 : six
7 : seven

By adding the required record number to the drive number, we can also refer to invididual records. This syntax is used both for copying and directory listings, such as:

SamDisk.exe 2:5 a:
SamDisk.exe 2:2 2:3
SamDisk.exe /dir 2:7

Copying using the device number alone allows the entire device to be read to an image, or written back from an image. These images are stored in RamSoft's HDF format, and to avoid confusion you must use a .hdf extension on the image filename:

SamDisk.exe 2: 32mb.hdf

For safety reasons, and to ensure BDOS works correctly, image files can only be written back to a device with the same geometry as they were read from. Be aware that different brands of compact flash cards of the same capacity may differ enough in sector sizes to make them incompatible with images from each other.

As with floppy disk images, the HDF-format hard disk images can be used with emulators, including SimCoupe.


Simon Owen
simon@simonowen.com