Classic Computer Magazine Archive ANTIC VOL. 3, NO. 5 / SEPTEMBER 1984

Assembly language

COPY MATE

A fast, easy disk-sector copier

by MIKE PALMER

SYNOPSIS
This self-booting disk-copy program copies an entire disk in two passes with 48K (or more) RAM, but works in as little as 16K.  The main program listing is written in assembly language, and requires OSS's MAC/65 or Atari Assembler Editor cartridge.  With Atari XL machines, the Translator disk is required to run the machine-language program generated from the assembled listing.  Antic disk subscribers: follow directions in article.

COPYMATE is a utility program that copies disks.  It boots (loads itself) in three seconds and is ready for immediate use.  The program is initialized with a set of pre-defined options that are displayed on the screen.  You can change these default settings with the BASIC customizer program in Listing 2.
   To create the working version of COPYMATE, type Listing 1 into the Assembler Editor or MAC/65 and assemble it to disk with the command ASM,, #D:COPYMATE.OBJ. Next, enter DOS and use menu option L to load COPYMATE.OBJ. (Before entering DOS, XL owners should boot Translator while pressing [OPTION] to disable BASIC.) As the file loads, hold down [OPTION] to run the routine that creates the boot file.  Insert a newly-formatted blank disk into Drive 1 and press [RETURN].  In a few seconds, a working version of COPYMATE will be created and then booted automatically
   To load an existing version of COPYMATE, turn off your computer and remove all cartridges. (XL owners should boot Translator while holding down [OPTION] to disable BASIC.) Now put the COPYMATE disk in Drive 1 and turn on the computer (XL owners press [SELECT]).
   Before starting a copy, you can change any of the displayed options with a single keystroke.  Press [S] or [D] to switch the source or destination drive number between 1 and 2, [F] to choose a formatting option, and [W] to turn Write Verification on and off.
   COPYMATE displays a "map" of the source (original) disk on the screen.  Each of the 720 dots initially displayed represent one sector (128 bytes) of the disk.  If a sector contains data, the dot is replaced by a larger dot; if the sector can't be read, a question mark replaces the dot.  When the sector is empty, the original dot remains.  A line at the bottom of the screen indicates (in hexadecimal) the number of the sector being read or written.
   COPYMATE does not copy blank sectors.  You can copy your source disk in one pass if it is less than half full.  To produce an exact copy, however, the destination disk must be formatted first.  Results are unpredictable when this is not done.
   When COPYMATE encounters a diskread error, it will retry the sector involved for up to 15 seconds before proceeding to the next one.  If you know a sector is bad, move COPYMATE to the next sector by pressing [BREAK].  When reading a series of bad sectors, wait at least 15 seconds between presses of [BREAK] or you may miss a sector.
   If you're not using the Translator disk, you can press [RESET] at any time to abort a copy and return to the initial menu of options.  Press [SELECT] during a read operation to skip the rest of the disk and start writing what's been read to the destination disk.  If you're copying a DOS disk, do not press [SELECT] until the disk VTOC and directory (sectors $168 to $170) have been read.  Otherwise, you won't be able to access the files on the disk.
   You can use the [OPTION] key to make multiple copies of a disk with a single disk drive.  You can also do this with a two-drive setup, but only if the source disk is less than half full (one-pass copy).  Since you'll be switching half-copied disks, and there are no special prompts, you must keep track of each step of the operation.
   First, set up for a one-drive copy.  Insert the source disk and press [START).  When "INSERT DESTINATION DISK" appears, insert the first destination disk and press [START].  When "INSERT SOURCE DISK" or "COPY COMPLETE" appears, press [OPTION] to indicate that the data that's been read is to be written again.  Then insert the second destination disk, and press [START].  Repeat the last two steps for each additional copy, and then repeat the entire process until all copies have been completed.

CUSTOMIZING COPYMATE
Listing 2 is a BASIC program (CUSTOMIZER) that sets COPYMATE parameters to your specifications.  Type in Listing 2, check it with TYPO, and SAVE a copy as a backup.  RUN the program and put the COPYMATE boot disk in Drive 1. (Use your backup copy of COPYMATE, in case there's a typing error in the CUSTOMIZER program.) Press [RETURN] and answer each question.  The range of responses for each parameter is shown in square brackets; the current setting appears under the cursor.  To accept the current setting for any parameter, press [RETURN].  After the final question, the new options will be written to the boot disk.  Remember to remove the BASIC cartridge before you boot COPYMATE.
   When using CUSTOMIZER, you must specify the make of the drive to be used.  With one exception, Atari-compatible drives write zeros to a disk during the formatting operation.  The exception is the Percom drive, which writes a pattern of $1A (hex) to the disk.  For COPYMATE to determine whether a sector is empty or not, it must know if the disk was formatted on a Percom drive.  If this option isn't set correctly, COPYMATE will work, but it won't skip blank sectors,.

Mike Palmer is a software systems analyst (he designs operating systems) for a flight simulator firm in Quebec, Canada.  He has owned his Atari 800 for 18 months, and programs primarily in assembly language.  Mike is trying to start an Atari Users' Group in his area.

Listing 1: COPYMATE.BAS Download

Listing 2: COPYMATE.M65 Download / View