USING THE 1581 DRIVE WITH CP/M Gene Pizzetta September 13, 1987 I've been waiting almost two months for the new CP/M BIOS to arrive from West Chester, while my 1581 drive gathered dust on the shelf. I'm sure the new system will be great when it finally gets here, but in the meantime I decided to do something to get the new drive working on my machine. Using the format program included in this library you can get your 1581 in service under CP/M in about three minutes. With about another half-hour of work you can get a full 800K on your 3-1/2 inch disks. It should be emphasized that the format program creates a disk that you computer will think is an Epson QX-10 double-sided 5-1/4 inch floppy. This disk format is not likely to be compatible with the revised BIOS you will eventually get from Commodore, so you'll probably have to move everything to disks with the new format later. In addition, you will not be able to boot CP/M from the 1581, so it should not be drive A. In the meantime, though, you'll have a fast, high-capacity drive that will hold all of WordStar Release 4 with plenty of space to spare. FORMAT81 Version 1.1 This is an interim program to format a disk in the Commodore 1581 disk drive for use under CP/M 3.0 on the C-128. Disks formatted with this program are NOT likely to be compatible with the official BIOS upgrade, when it is finally delivered by Commodore Business Machines. USAGE: FORMAT81 {d:} This command will format the disk in the given drive. If a drive specification is not supplied in the command tail, then the currently logged disk is assumed. Only drives A, B, C, and D will be accepted; all others result in an 'invalid drive' message. Permissible drives may be further restricted in the drive list. When you first put a disk into the 1581, you will be unable to make that drive the default (current) drive. If you try it, CP/M will make several attempts to log it in and then report a disk error. Returning you to where you were. Because of that you will have to use the command line drive designator to format your first disk (for example, "FORMAT81 B:". After the disk is formatted, you can log in the drive and check your disk space with SHOW.COM, NEW-D.COM, XDIR, or some other favorite utility. This format program will no doubt cause problems if you try to run it on a disk in a 1571 drive. Frankly, I haven't tried it (I haven't had the guts!), so I won't make any predictions. I think it would be best if you avoided the possibility by making a small change in the source code at the label DrvLst. The comments explain the procedure. If you don't want to bother with reassembly, you can make the patch directly to the .COM file using EDFILE or SID. The drive list can be found at 103h-106h. These four bytes are flags for drives A through D, respectively. If the byte for a drive is non- zero then FORMAT81 will abort with an "invalid drive" message if by chance it is the drive you inadvertantly selected. As distributed, the program will format a disk in any drive, but you should patch FFh (or any non-zero byte) into the flag bytes that do not correspond to a 1581 drive. For example, if your 1581 is drive C, then patch FFh, FFh, 00h, FFh into the drive list. The 00h at byte 105 corresponds to drive C. After you've made the patch, FORMAT81 won't let you format a disk in any drive but C. This program was developed with SLRMAC, a truly fantastic 8080 assembler that has extended Intel Z80 mnemonics built-in (and it's only $49.95). You can reassemble FORMAT81.MAC with MAC and HEXCOM, but first you will have to change the name to FORMAT81.ASM and then make sure Z80.LIB is on your default disk. Version 1.0 (9/10/87) -- successfully formatted disks in 1581 drive under CP/M using Epson QX-10 format options. Version 1.1 (9/12/87) -- added command line drive selection, drive list, error checking, and drive reset. MODIFYING THE BIOS After you have formatted a disk with FORMAT81, you will notice that you have only around 390K of disk space. That's because Epson QX-10 disks had only 40 tracks and your 1581 has 80. You can't read and write to the full 800K of your 1581 unless you modify your BIOS. But that's easy to do. Here's how: Making this patch will eliminate the possibility of reading and writing QX-10 double-sided disks (single-sided disks are unaffected), but I doubt many people do that with any regularity. Anyway, you will still have your original BIOS if you need it in a pinch. (At this point everybody seems to feel obliged to issue a warning about not using your original disks. I won't insult you. Anybody that needs such a warning wouldn't be making patches, they'd be playing Face Maker on the 64 side.) To make this patch you need the source code for your BIOS. Commodore sends it out to those who return the card in the "System Guide". If you're using a December 6 system that you got from another source, then the source code is available from Quantum-Link, most FOG boards (you may have to request it from the Sysop), and it may even be on CompuServe someplace. Find the file CXDISK.ASM and call up your favorite editor (like VDE) to make two tiny changes. Near the end of this rather long source file you will find the source for the disk parameter blocks. The one you need is the SECOND one marked 'Epson QX10'. The first QX-10 block is for single-sided disks. The source block will look like this: db 80h+S512*2+(10*2-8)+1 ; 256 byte sect, 16 sec/trk ; db S256*2 ; track 0 is 256 bytes/sector db MFM+S512+Type0+C0+S1 ; DSDD dw 0 ; start on track 2 sect 1 (2 alc) dpb 512,20,40,2048,128,2 ; sect# 1 to 10 db 10 ; (top and bottom numbered the same) db 'Epson QX10' ; 2 You only need to make two changes, both of them in the 5th line, that begins "dpb". Change the "40" to "80". Change the "2" to "0". That tells CP/M that the disk has 80 tracks and it should start at track 0 (the Epson had two reserved tracks for booting the system, so it started on track 2). You might also want to change the ASCII string in the last line to ' 1581 ', so that there are exactly 10 letters and spaces between the single quotes. The modified block should look like this: db 80h+S512*2+(10*2-8)+1 ; 256 byte sect, 16 sec/trk ; db S256*2 ; track 0 is 256 bytes/sector db MFM+S512+Type0+C0+S1 ; DSDD dw 0 ; start on track 2 sect 1 (2 alc) dpb 512,20,80,2048,128,0 ; sect# 1 to 10 db 10 ; (top and bottom numbered the same) db ' 1581 ' ; 2 Using the small doc file that comes with the source code as your guide, you will have to regenerate the CPM+.SYS file using the modified CXDISK.ASM file in place of the original. Once you get the regeneration process going, go out to dinner. It takes quite a while to do its work. When you come back, reboot the system with your new CPM+.SYS file in drive A (along with a copy of CCP.COM, of course). Then run SHOW.COM on your 1581. "RW, Space 796k" That's 800K, minus 4K for the disk directory. Enjoy! Let me know if you experience any problems, find any bugs, or have any suggestions. Gene Pizzetta 481 Revere Street Revere, MA 02151 Voice (617) 284-0891 CompuServe 72060,505 Quantum-Link GeneP