1571-1.TXT rev 1a 96-11-01 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * THIS DOCUMENT IS COPYRIGHT (C) 1988, 1996 BY HERNE DATA SYSTEMS LTD. THE MATERIAL CONTAINED HEREIN MAY BE FREELY USED FOR PERSONAL INFORMATION ONLY. IF YOU REPRODUCE IT, THIS COPYRIGHT NOTICE MUST NOT BE REMOVED. THIS MATERIAL MAY NOT BE EXPLOITED FOR COMMERCIAL PURPOSES. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Herne Data Systems Ltd., PO Box 250, Tiverton, ON N0G 2T0 CANADA. Voice/fax 519-366-2732, e-mail herne@herne.com internet: http://www.herne.com * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * An Introduction to the 1571 and 1581 Disk Drives Commodore disk drives are amongst the most complex currently available for home computers. Each has its own microprocessor, interface circuitry and extensive ROM based operating system. This approach developed from the early Commodore PET (Personal Electronic Transactor) series computers which contained no internal interface or support for disk drives. To maintain compatibility with these earlier units, most Commodore disk drives have been built this way ever since. The 1571 disk drive, produced primarily for the C-128 and C-128 D Personal Computers, is perhaps the most complex yet: It has a sophisticated and versatile operating system which allows it to read both Commodore GCR format disks and industry standard IBM system 34 (MFM) type disks, each in either single or double sided formats. The 1571 is also one of the fastest disk drives produced by Commodore, even though it uses the C-64 style serial port rather than the IEEE 488 parallel bus used by most other Commodore fast drives. Despite its wealth of features, little has been written about the 1571, especially about the more advanced features such as burst mode and accessing MFM disks. Most programming guides deal mainly with a specific model of computer and only devote a minimal amount of space to peripherals such as disk drives, even though the peripherals may be at least as sophisticated as the computer itself. With the increasing complexity and versatility of Commodore disk drives, These drives certainly deserve equal space. 1.1 About This Series This series is intended to be a guide for programming and using the 1571 drive at all levels from novice to advanced programmer. Much of the material is also applicable to other Commodore disk drives, such as the 1541 and the new 1581. The material is especially relevant for the built in disk drive of the 128-D computer and the 1570 (a European single sided version of the 1571). The series on is organized into a number of different major parts. Although each part is more or less self contained, reference may be made to other parts for clarity or further information. The emphasis of this series is on teaching the fundamentals of how the various players in the programming game (i.e. the computer, disks, disk drives, disk files, etc.) interact with each other. In this capacity, it should be considered to be a basic reference tool or foundation upon which you can explore your own ideas and applications. Most of the examples included in this series refer specifically to BASIC 7.0, the native language of the C-128. However, since the 1571 can be used with other Commodore computers, examples are also provided in BASIC 2.0 and 3.5 as well as in assembly language. The examples presented in the text are, for the most part, greatly simplified to demonstrate a specific point. You are, of course, free to embelish them with all the bells and whistles that you see fit. Some readers may get a feeling of deja vu from certain parts of the text. This is quite understandable because parts of the text have been extracted and adapted from some of the numerous articles that I have written about programming the 1571 in Commodore Magazine, TPUG Magazine, The Transactor, Commodore Computing International and Twin Cities 128. I would like to thank the editors of these fine publications for encouraging my writing and programming efforts. Good luck, and remember, computing should be fun!! 1.2 The 1571: An Overview The Commodore 1571 disk drive is a highly versatile mass storage device which can be used with the C-128, C-128-D, C-64, 64-C, SX- 64, C-16, Plus/4 and VIC-20 computers. It is a double sided drive which can store up to 340 kilobytes of data per disk. The 1571 is read and write compatible with other Commodore drives using DOS format "A" such as the 1541 and 2031. However, since these drives are only single sided, they will not be able to access the second side of a 1571 disk. In special circumstances, such as C-128 CP/M mode, the 1571 also allows you to use other disk formats with capacities of up to 400 kilobytes per disk. In fact, the 1571 can read most disk types, including MS-DOS, with a bit of simple programming. 1.2.1 Specifications Tables 1-1 to 1-3 summarize the hardware and technical specifications of the 1571 disk drive. Table 1-1: 1571 Hardware Specifications ...................................................... Height 76 mm ( 3 inches) Width 216 mm ( 8.5 inches) Length 346 mm (13.5 inches) Weight 3.5 kg (7.7 lb) Microprocessor 6502A Interface 65C22A ROM 23256 (32 k bytes) RAM 4016 (8 k bytes) MFM controller WD1770 Chip speed 1 MHz (1541 mode) 2 MHz (1571 mode) Communication: Slow Serial Bus 350 bytes/second (read and write) Fast Serial Bus 4000 bytes/second (read) 400 bytes/second (write - limited by verify after write) Device number 8 to 11 (hardware selected) 8 to 30 (software selected, temporary) ............................................................. Table 1.2: GCR Mode Specifications ............................................................. Total capacity per side 252,019 bytes (unformatted) 174,848 bytes (formatted) Bytes per sector 256 Sectors per track track # sectors ----------------------- 1 - 17 21 18 - 24 19 25 - 30 18 31 - 35 17 Tracks per side 35 (1 to 35 on side 0, 36 to 70 side 1) Sectors per side 683 total 664 available to user 19 reserved for system use Directory entries 144 per disk Max SEQ, PRG or USR 168,656 (single sided) file size (bytes) 337,312 (double sided) Max REL file size 167,132 bytes Records per REL file 65535 Record size 2 to 254 bytes Recording format 2A (1540, 1541, 1551, 2031 read/write compatible) ......................................................... Table 1-3: MFM Mode Specifications ......................................................... Total unformatted capacity 250,000 bytes per side Maximum Formatted capacity Sector size Bytes per side ----------------------------- 128 133,120 256 184,320 512 204,800 1024 204,800 Maximum Sectors per track Sector size Sectors ----------------------- 128 26 256 18 512 10 1024 5 Tracks per side 40 maximum Note that MFM disk formats are not supported directly by Commodore DOS (i.e. LOAD, SAVE, etc) but are supported by C-128 CP/M mode ............................................................. When used with the C-128 or 128-D computer, the fast serial bus of the 1571 drive permits data transfer at speeds of over ten times faster than the 1541 type slow serial bus. The slow serial bus is also supported by the 1571 to allow it to be used with other Commodore computers. (The fast serial bus depends on special hardware in both the disk drive and the computer and will not work with older Commodore computers. Slow bus compatibility was originally included in the 1571 to make it wotk properly with the C-128 in C-64 emulation mode. To achieve true C-64 hardware compatibility, the C-128's fast serial port hardware is locked out during C-64 mode operation.) All DOS commands sent to the 1571 and status messages returned to the computer are transmitted in slow bus mode. 1.2.2 Operation The 1571 disk drive uses standard 5-1/4 inch double sided, double density disks. Virtually any brand will work satisfactorily, although name brands are generally of better quality than discount generic brands and will give longer life, especially in frequent use applications. A double sided disk drive has two read/write heads, one on the top and one on the bottom. This allows the drive to access both sides of the disk without having to physically turn it over. Some users of single sided disk drives, such as the 1541, have developed a habit of flipping the disk over (similar to a record or tape) to use the second side. This should not be done with the 1571 when it is used with a C-128. The 1571 will format and use both sides of the disk automatically without having to do this. If you attempt to create a "flippie", you will destroy any existing data on both sides of the disk. Even in 1541 single sided mode, using flippie disks may not be a good idea, especially for irreplaceable data, because it greatly shortens the life of the disk. Similar to an audio record, a disk turns in one direction only when reading/writing data on a given side. Because the disk is encased in a protective jacket, it is constantly rubbing on the jacket lining, but always in the same direction. When you flip the disk over, it will rotate in the opposite direction. Similar to the "knap" in fabrics and carpets, this will stress the recording media in the opposite direction. A constantly changing rotation direction caused by flipping the disk will cause greater wear and tear on the disk, thus shortening its useful life. The actual shortening of the life will vary greatly depending on how often the disk is flipped, the quality of the disk, the cleanliness of the head, as well as many other less tangible factors. To many people, the advantage of doubling the amount of data stored on each single sided disk outweighs the potential drawbacks. In other words, if you are willing to take the risk, the choice is yours. But remember, you don't get something for nothing. In order to use flippie disks, you will need a disk notcher. This is a small device, similar to a paper punch, which will cut out an extra write protect notch on the right side of the disk. Without this notch, you cannot format or write data to the back side of a flippie. 1.3 Care and Feeding of your 1571 The 1571 is a fairly rugged device. However, that does not mean that it enjoys being dropped, drowned, kicked, etc. Like other electronic equipment, a little common sense is required, especially when moving from one location to another. The following general hints apply to all disk drives. (a) Keep the disk drive well ventilated. Allowing a few inches of space around the vents is generally adequate for dissipating heat from normal use. Prolonged use in hot environments may require artificial cooling, such as fans when adequate ventilation space is not available. (b) The drive is intended to be used in "normal" office or household environments. It probably will not last too long next to a heating duct or in your backyard in the Yukon in December. Similarly, it probably would not appreciate being left on the deck of Noah's ark or in a Sahara sandstorm. (c) The read/write heads should be cleaned about once per year in normal use. More frequent cleanings may be desirable with heavier usage, but may cause additional head wear if done too frequently. Virtually any wet (generally isopropyl alcohol or fluoro carbon based) commercial head cleaner will be acceptable. These head cleaners work by inserting a special cleaning pad (containing the cleaner) resembling a floppy disk into the drive and causing the mechanism to spin for a few moments. Follow the indivdual cleaner manufacturers' instructions and recommendations for best results. (d) The head tracking rails should be lubricated as required with a molybdenum based instrument lubricant. Do not use oil for this purpose because it will contaminate your heads and disks. Lubrication should be done by a qualified service shop. (e) Never touch the exposed magnetic surfaces of the disk. Avoid spilling liquids and crumbs/dust on them. Keep the disk in its protective jacket when not in use. This minimizes the possibility of the above events and limits their effects if they do occur. (f) Do not fold, spindle or mutilate the disks. Although I have revocered data from disks which were folded in two, I have also lost data on disks which were only slightly bent. (g) Keep the disk and disk drive away from magnetic fields. This includes magnetic fields created by electric motors, TV's and monitors, computer power supplies, speakers, headphones, etc. It may also be wise to keep them away from electric trolley buses, subway trains and airport x-ray machines. (h) Always turn on the disk drive power before inserting a disk and remove the disk before turning off the power. Never remove the disk while the green "drive in use" light is on (unless the drive is locked up or a similar emergency has occured).