CPMBIOS.S Patch For DEC Rainbow Disk I/O CPMBIOS.S Patch For DEC Rainbow Disk I/O CPMBIOS.S Patch For DEC Rainbow Disk I/O Robert Heller Robert Heller Robert Heller Fri May 16, 1986 Fri May 16, 1986 Fri May 16, 1986 (c) Copyright 1986 by Robert Heller (c) Copyright 1986 by Robert Heller (c) Copyright 1986 by Robert Heller Chapter 1: Introduction I wrote this patch to provide a means to move files between my Stride 440 and various other CP/M-68K machines in the area. In an adjacent office to where I work at the University of Massachuttes, there is a DEC Rainbow connected to one of the University's VAXes via a serial line. It is posible to reliably and quickly transfer files between the Rainbow and the VAX using Kermit at 9600 BAUD. On one of our VAXes we have a pair of 8" floppy drives. We have a program that will read and write single-sided, single-density 8" CP/M format floppies. The other CP/M-68K systems in the area have 8" drives and can read and write this format. Since the DEC Rainbow uses 96TPI drives and run CP/M-80/86, it seemed like it should be easy to move files between my Stride and the Rainbow. After doing some "nibble" analysis of a disk formatted and written to by the Rainbow, I discovered that the Rainbow uses sector skewing. It was then merely a matter of modifing Stride's CPMBIOS.S file to provide a sector translate table, when using Rainbow disks. Chapter 2: The Patches I wanted to make the fix transparent and unobtrusive. I also didn't want to have multiple version of CPM.SYS eating up disk space. Since the RX50 drives on the Rainbow are single-sided and the Rainbow uses a 10-sector format, I set the patch to conditionally (at startup time) include the sector translate table, based on the low-level configuration of the drive. That way I could setup one or the other floppy drive as a Rainbow format drive with UTIL (or MU.UTIL) by simply setting up the drive as a 10 sectored single sided drive with a skew for format of 2. 2.1 The Executable Part Of The Patch This patch goes in the _init routine at the q22 _init q22 _init q22 label. *** * RPH: do DEC Rainbow hack * * first check for floppy disk (only mess with floppies!) * q22: cmp.b #4,devnum * left floppy? beq RPH1 * br if so cmp.b #5,devnum * right floppy? bne RPH99 * br if not * * now check sectors/track and # tracks * RPH1: cmp.w #40,spt(a5) * 40 sectors/track? bne RPH99 * br if not cmp.w #80,dsktrk+intdef * 80 tracks? bne RPH99 * br if not * * now get disk conf info to check skew factor * movem.l d0/a0,-(A7) * save registers (just in case) lea rphfcnf,a0 * get floppy conf. argblock move.w dskchan(A6),rphfcnf+14 * stash logical channel # in * req. packet. moveq #readch,D0 * read chan conf trap #biosl * hit it * * check skew factor * cmp.b #2,rphfcon+4 * skew = 2? bne RPH88 * br if not * skew == 2, blast in translate table for DEC Rainbow CP/M-86/80 disks lea DECxlat,a0 * compute address move.l a0,xlt(A4) * setup xlt table * done. clean up, etc. RPH88: movem.l (A7)+,d0/a0 * restore registers * * The following code determines the size of the disk allocation * vector, in bytes. This is based on the number of blocks on the disk. * One bit per block in the allocation vector is allocated. * * The '16+1' factor added below is to make sure that if the last word * of the allocation vector is only partially used, it is actually * allocated. * RPH99: 2.2 The Non-Executable Part Of The Patch The non-executable part of the patch consists of the translate table and the configuration request packet and buffer. This goes into the .data segment: .data .data rphfcnf: .dc.w 128 ; config chan .dc.w 0 ; error word .dc.l 32 ; size in bytes .dc.l rphfcon ; conf block .dc.w 0 ; logical block number .dc.w 0 ; control word (filled in later) .even DECxlat: .dc.b 0, 1, 2, 3 * first phy sector .dc.b 8, 9,10,11 * third phy sector .dc.b 16,17,18,19 * fifth phy sector .dc.b 24,25,26,27 * seventh phy sector .dc.b 32,33,34,35 * ninth phy sector .dc.b 4, 5, 6, 7 * second phy sector .dc.b 12,13,14,15 * fourth phy sector .dc.b 20,21,22,23 * sixth phy sector .dc.b 28,29,30,31 * eigth phy sector .dc.b 36,37,38,39 * tenth phy sector And this goes into the .bss segment: .bss .bss * space for disk conf. info rphfcon: .ds.b 32