changeset 91:c10820aa211b

Added
author boisy
date Wed, 03 Jul 2002 03:41:59 +0000
parents 6aa54d3691e5
children 3f67d4e039f0
files 3rdparty/drivers/burke/bb1fhdisk.asm 3rdparty/drivers/burke/bb1hd.asm 3rdparty/drivers/burke/bb1hdisk.asm 3rdparty/drivers/burke/bb1th.asm 3rdparty/drivers/burke/bb1thdisk.asm 3rdparty/drivers/burke/bbfhdisk.asm 3rdparty/drivers/burke/bbhd.asm 3rdparty/drivers/burke/bbhdisk.asm 3rdparty/drivers/burke/bbxfhdisk.asm 3rdparty/drivers/burke/bbxhdisk.asm 3rdparty/drivers/burke/bbxthd.asm 3rdparty/drivers/burke/bkfhdisk.asm 3rdparty/drivers/burke/defsfile 3rdparty/drivers/burke/hdcmd.src 3rdparty/drivers/burke/hdmath.src 3rdparty/drivers/burke/hdutil3.src 3rdparty/drivers/burke/hdvars.src 3rdparty/drivers/burke/makefile 3rdparty/drivers/burke/wx2.equ 3rdparty/drivers/burke/xtos9.src
diffstat 20 files changed, 3415 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/bb1fhdisk.asm	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,61 @@
+*******************************************
+***                                     ***
+***     COPYRIGHT 1988 BURKE & BURKE    ***
+***     ALL RIGHTS RESERVED             ***
+***                                     ***
+*******************************************
+
+        nam     BB1FHDISK
+
+*
+*   CoCo XT Hard Disk Driver  07/26/87
+*   (with formatting capability)
+*
+*
+*   For Western Digital WD1002-WX2 (or WX1) Controller.
+*
+*   This is a general purpose driver.  It can handle
+*   1-2 hard drives, the parameters of which are described
+*   in the device descriptors.  The drives may be of
+*   different sizes.  This version is optimized
+*   for the CoCo 3 under level 1, version 2 OS9.
+*   It does not mess with the clock speed -- the native 
+*   speed is used. It also verifies disk writes, and uses 
+*   read caching.
+*
+*   THIS VERSION CAN FORMAT THE HARD DISK!
+*
+*   Chris Burke  Schaumburg, IL  07/26/87
+*
+
+ page
+*
+*  Conditional assembly control
+*
+
+Drives  equ     2           ;Number of drives supported
+
+irqflg  equ     0           ;non-zero to mask interrupts during HD access
+trsflg  equ     0           ;non-zero if optimized for 4x32 disk
+cchflg  equ     1           ;non-zero if read cache supported
+vrfflg  equ     1           ;non-zero if write verification supported
+tboflg  equ     0           ;non-zero if jump to 2 MHz for block moves
+fstflg  equ     1           ;non-zero if fast transfers supported
+sysram  equ     1           ;non-zero to use system RAM for verf buffer
+sizflg  equ     1           ;non-zero to allow drives of different sizes
+
+fmtflg  equ     1           ;non-zero if hard formatting supported
+errflg  equ     0           ;non-zero for good error messages
+icdflg  equ     0           ;non-zero to ignore C/D status bit
+timflg  equ     0           ;non-zero to support access timer
+
+XLEVEL  equ     1           ;Bogus level 2 flag
+
+testing equ     0           ;non-zero to call driver "XD", not "HD"
+
+*
+*   Include the main line
+*
+
+        use     xtos9.src
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/bb1hd.asm	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,54 @@
+*******************************************
+***                                     ***
+***     COPYRIGHT 1988 BURKE & BURKE    ***
+***     ALL RIGHTS RESERVED             ***
+***                                     ***
+*******************************************
+
+        nam     BB1HD
+
+*
+*   CoCo XT Hard Disk Driver  07/25/87
+*
+*   For Western Digital WD1002-WX2 (or WX1) Controller.
+*
+*   This version is optimized for 1 4x32 hard disk
+*   on the CoCo 2, under level 1, version 1 OS9.
+*   It does not mess with the clock speed -- it uses 
+*   the native speed.  It does not verify disk writes, 
+*   and does not use read caching.
+*
+*  Chris Burke  Schaumburg, IL  07/25/87
+*
+
+ page
+*
+*  Conditional assembly control
+*
+
+Drives  equ     1           ;Number of drives supported
+
+irqflg  equ     0           ;non-zero to mask interrupts during HD access
+trsflg  equ     1           ;non-zero if optimized for 4x32 disk
+cchflg  equ     0           ;non-zero if read cache supported
+vrfflg  equ     0           ;non-zero if write verification supported
+tboflg  equ     0           ;non-zero if jump to 2 MHz for block moves
+fstflg  equ     1           ;non-zero if fast transfers supported
+sysram  equ     1           ;non-zero to use system RAM for verf buffer
+sizflg  equ     0           ;non-zero to allow drives of different sizes
+
+fmtflg  equ     0           ;non-zero if hard formatting supported
+errflg  equ     0           ;non-zero for good error messages
+icdflg  equ     0           ;non-zero to ignore C/D status bit
+timflg  equ     0           ;non-zero to support access timer
+
+XLEVEL  equ     1           ;Bogus level 2 flag
+
+testing equ     0           ;non-zero to call driver "XD", not "HD"
+
+*
+*   Include the main line
+*
+
+        use     xtos9.src
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/bb1hdisk.asm	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,56 @@
+*******************************************
+***                                     ***
+***     COPYRIGHT 1987 BURKE & BURKE    ***
+***     ALL RIGHTS RESERVED             ***
+***                                     ***
+*******************************************
+
+        nam     BB1HDISK
+
+*
+*   CoCo XT Hard Disk Driver  07/25/87
+*
+*   For Western Digital WD1002-WX2 (or WX1) Controller.
+*
+*   This is a general purpose driver.  It can handle
+*   1-2 hard drives, the parameters of which are described
+*   in the device descriptors.  The drives may be of
+*   different sizes.  This version is optimized for the
+*   CoCo 2 under level 1, version 2 OS9.  It does not mess 
+*   with the clock speed -- the native speed is used.  It 
+*   also verifies disk writes, and uses read caching.
+*
+*  Chris Burke  Schaumburg, IL  07/25/87
+*
+
+ page
+*
+*  Conditional assembly control
+*
+
+Drives  equ     2           ;Number of drives supported
+
+irqflg  equ     0           ;non-zero to mask interrupts during HD access
+trsflg  equ     0           ;non-zero if optimized for 4x32 disk
+cchflg  equ     1           ;non-zero if read cache supported
+vrfflg  equ     1           ;non-zero if write verification supported
+tboflg  equ     0           ;non-zero if jump to 2 MHz for block moves
+fstflg  equ     1           ;non-zero if fast transfers supported
+sysram  equ     1           ;non-zero to use system RAM for verf buffer
+sizflg  equ     1           ;non-zero to allow drives of different sizes
+
+fmtflg  equ     0           ;non-zero if hard formatting supported
+errflg  equ     0           ;non-zero for good error messages
+icdflg  equ     0           ;non-zero to ignore C/D status bit
+timflg  equ     0           ;non-zero to support access timer
+
+XLEVEL  equ     1           ;Bogus level 2 flag
+
+testing equ     0           ;non-zero to call driver "XD", not "HD"
+
+*
+*   Include the main line
+*
+
+        use     xtos9.src
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/bb1th.asm	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,54 @@
+*******************************************
+***                                     ***
+***     COPYRIGHT 1988 BURKE & BURKE    ***
+***     ALL RIGHTS RESERVED             ***
+***                                     ***
+*******************************************
+
+        nam     BB1THD
+
+*
+*   CoCo XT Hard Disk Driver  07/25/87
+*
+*   For Western Digital WD1002-WX2 (or WX1) Controller.
+*
+*   This version is optimized for 1 4x32 hard disk
+*   on the CoCo 3, under level 1, version 1 OS9.  It 
+*   speeds up to 2 MHz during disk I/O, then slows down 
+*   again.  It does not verify disk writes, and does not 
+*   use read caching.
+*
+*  Chris Burke  Schaumburg, IL  07/25/87
+*
+
+ page
+*
+*  Conditional assembly control
+*
+
+Drives  equ     1           ;Number of drives supported
+
+irqflg  equ     0           ;non-zero to mask interrupts during HD access
+trsflg  equ     1           ;non-zero if optimized for 4x32 disk
+cchflg  equ     0           ;non-zero if read cache supported
+vrfflg  equ     0           ;non-zero if write verification supported
+tboflg  equ     1           ;non-zero if jump to 2 MHz for block moves
+fstflg  equ     1           ;non-zero if fast transfers supported
+sysram  equ     1           ;non-zero to use system RAM for verify buffer
+sizflg  equ     0           ;non-zero to allow drives of different sizes
+
+fmtflg  equ     0           ;non-zero if hard formatting supported
+errflg  equ     0           ;non-zero for good error messages
+icdflg  equ     0           ;non-zero to ignore C/D status bit
+timflg  equ     0           ;non-zero to support access timer
+
+XLEVEL  equ     1           ;Bogus level 2 flag
+
+testing equ     0           ;non-zero to call driver "XD", not "HD"
+
+*
+*   Include the main line
+*
+
+        use     xtos9.src
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/bb1thdisk.asm	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,56 @@
+*******************************************
+***                                     ***
+***     COPYRIGHT 1988 BURKE & BURKE    ***
+***     ALL RIGHTS RESERVED             ***
+***                                     ***
+*******************************************
+
+        nam     BB1THDISK
+
+*
+*   CoCo XT Hard Disk Driver  07/25/87
+*
+*   For Western Digital WD1002-WX2 (or WX1) Controller.
+*
+*   This is a general purpose driver.  It can handle
+*   1-2 hard drives, the parameters of which are described
+*   in the device descriptors.  The drives may be of
+*   different sizes.  This version is optimized for the CoCo 
+*   3, under level 1, version 2 OS9.  It speeds up to 2 MHz 
+*   during disk I/O, then slows down again.  It also verifies 
+*   disk writes, and uses read caching.
+*
+*  Chris Burke  Schaumburg, IL  07/25/87
+*
+
+ page
+*
+*  Conditional assembly control
+*
+
+Drives  equ     2           ;Number of drives supported
+
+irqflg  equ     0           ;non-zero to mask interrupts during HD access
+trsflg  equ     0           ;non-zero if optimized for 4x32 disk
+cchflg  equ     1           ;non-zero if read cache supported
+vrfflg  equ     1           ;non-zero if write verification supported
+tboflg  equ     1           ;non-zero if jump to 2 MHz for block moves
+fstflg  equ     1           ;non-zero if fast transfers supported
+sysram  equ     1           ;non-zero to use system RAM for verf buffer
+sizflg  equ     1           ;non-zero to allow drives of different sizes
+
+fmtflg  equ     0           ;non-zero if hard formatting supported
+errflg  equ     0           ;non-zero for good error messages
+icdflg  equ     0           ;non-zero to ignore C/D status bit
+timflg  equ     0           ;non-zero to support access timer
+
+XLEVEL  equ     1           ;Bogus level 2 flag
+
+testing equ     0           ;non-zero to call driver "XD", not "HD"
+
+*
+*   Include the main line
+*
+
+        use     xtos9.src
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/bbfhdisk.asm	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,60 @@
+*******************************************
+***                                     ***
+***     COPYRIGHT 1990 BURKE & BURKE    ***
+***     ALL RIGHTS RESERVED             ***
+***                                     ***
+*******************************************
+
+        nam     BBFHDISK
+
+*
+*   CoCo XT Hard Disk Driver  Version 2.0
+*
+*
+*   For Western Digital WD1002-WX2 (or WX1) Controller.
+*
+*   This is a general purpose driver.  It can handle
+*   1-4 hard drives, the parameters of which are described
+*   in the device descriptors.  The drives may be of different
+*   sizes.  This version is optimized for the CoCo 3 under level 
+*   2 OS9.  It does not mess with the clock speed -- the native 
+*   speed is used.  It also verifies disk writes, and uses 
+*   read caching.  This version ccan format the hard drive.
+*
+
+*
+*   Chris Burke  Schaumburg, IL  01/26/88
+*
+
+ page
+*
+*  Conditional assembly control
+*
+
+*Drives  equ     2           ;Number of drives supported
+Drives  equ     4           ;Number of drives supported (2 per controller)
+
+irqflg  equ     0           ;non-zero to mask interrupts during HD access
+trsflg  equ     0           ;non-zero if optimized for 4 heads, 32 SPT
+cchflg  equ     1           ;non-zero if read cache supported
+vrfflg  equ     1           ;non-zero if write verification supported
+tboflg  equ     0           ;non-zero if jump to 2 MHz for block moves
+fstflg  equ     1           ;non-zero if fast transfers supported
+sysram  equ     1           ;non-zero to use system RAM for verf buffer
+sizflg  equ     1           ;non-zero to allow drives of different sizes
+
+fmtflg  equ     1           ;non-zero if hard formatting supported
+errflg  equ     1           ;non-zero for good error messages
+icdflg  equ     0           ;non-zero to ignore C/D status bit
+timflg  equ     0           ;non-zero to support access timer
+
+XLEVEL  equ     2           ;Bogus level 2 flag
+
+testing equ     0           ;non-zero to call driver "XD", not "HD"
+
+*
+*   Include the main line
+*
+
+        use     xtos9.src
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/bbhd.asm	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,60 @@
+*******************************************
+***                                     ***
+***     COPYRIGHT 1988 BURKE & BURKE    ***
+***     ALL RIGHTS RESERVED             ***
+***                                     ***
+*******************************************
+
+        nam     BBHD
+
+*
+*   CoCo XT Hard Disk Driver  Version 2.0
+*   (with formatting capability)
+*
+*
+*   For Western Digital WD1002-WX2 (or WX1) Controller.
+*
+*   This version is optimized for ONE hard drive having 4
+*   heads and 32 sectors per track.  There is no formatting
+*   capability and no write verification.
+*
+*   The number of tracks is taken from the device descriptor,
+*   so this driver can be used with ST-506, ST-412, ST-225 or 
+*   ST-238 drives.  This version DOES include the read cache.
+*   It has the cruddy error messages.
+
+*
+*   Chris Burke  Schaumburg, IL  02/22/88
+*
+
+ page
+*
+*  Conditional assembly control
+*
+
+Drives  equ     1           ;Number of drives supported
+
+irqflg  equ     0           ;non-zero to mask interrupts during HD access
+trsflg  equ     1           ;non-zero if optimized for 4 heads, 32 SPT
+cchflg  equ     1           ;non-zero if read cache supported
+vrfflg  equ     0           ;non-zero if write verification supported
+tboflg  equ     0           ;non-zero if jump to 2 MHz for block moves
+fstflg  equ     1           ;non-zero if fast transfers supported
+sysram  equ     1           ;non-zero to use system RAM for verf buffer
+sizflg  equ     0           ;non-zero to allow drives of different sizes
+
+fmtflg  equ     0           ;non-zero if hard formatting supported
+errflg  equ     0           ;non-zero for good error messages
+icdflg  equ     0           ;non-zero to ignore C/D status bit
+timflg  equ     0           ;non-zero to support access timer
+
+XLEVEL  equ     2           ;Bogus level 2 flag
+
+testing equ     0           ;non-zero to call driver "XD", not "HD"
+
+*
+*   Include the main line
+*
+
+        use     xtos9.src
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/bbhdisk.asm	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,60 @@
+*******************************************
+***                                     ***
+***     COPYRIGHT 1990 BURKE & BURKE    ***
+***     ALL RIGHTS RESERVED             ***
+***                                     ***
+*******************************************
+
+        nam     BBHDISK
+
+*
+*   CoCo XT Hard Disk Driver  Version 2.0
+*
+*
+*   For Western Digital WD1002-WX2 (or WX1) Controller.
+*
+*   This is a general purpose driver.  It can handle
+*   1-4 hard drives, the parameters of which are described
+*   in the device descriptors.  The drives may be of different
+*   sizes.  This version is optimized for the CoCo 3 under level 
+*   2 OS9.  It does not mess with the clock speed -- the native 
+*   speed is used.  It also verifies disk writes, and uses 
+*   read caching.
+*
+
+*
+*   Chris Burke  Schaumburg, IL  01/26/88
+*
+
+ page
+*
+*  Conditional assembly control
+*
+
+*Drives  equ     2           ;Number of drives supported
+Drives  equ     4           ;Number of drives supported (2 per controller)
+
+irqflg  equ     0           ;non-zero to mask interrupts during HD access
+trsflg  equ     0           ;non-zero if optimized for 4 heads, 32 SPT
+cchflg  equ     1           ;non-zero if read cache supported
+vrfflg  equ     1           ;non-zero if write verification supported
+tboflg  equ     0           ;non-zero if jump to 2 MHz for block moves
+fstflg  equ     1           ;non-zero if fast transfers supported
+sysram  equ     1           ;non-zero to use system RAM for verf buffer
+sizflg  equ     1           ;non-zero to allow drives of different sizes
+
+fmtflg  equ     0           ;non-zero if hard formatting supported
+errflg  equ     1           ;non-zero for good error messages
+icdflg  equ     0           ;non-zero to ignore C/D status bit
+timflg  equ     0           ;non-zero to support access timer
+
+XLEVEL  equ     2           ;Bogus level 2 flag
+
+testing equ     0           ;non-zero to call driver "XD", not "HD"
+
+*
+*   Include the main line
+*
+
+        use     xtos9.src
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/bbxfhdisk.asm	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,61 @@
+*******************************************
+***                                     ***
+***     COPYRIGHT 1988 BURKE & BURKE    ***
+***     ALL RIGHTS RESERVED             ***
+***                                     ***
+*******************************************
+
+        nam     BBXFHDISK
+
+*
+*   CoCo XT Hard Disk Driver  07/26/87
+*   (with formatting capability)
+*
+*
+*   For Western Digital WD1002-WX2 (or WX1) Controller.
+*
+*   This is a general purpose driver.  It can handle
+*   1-2 hard drives, the parameters of which are described
+*   in the device descriptors.  The drives may be of different
+*   sizes.  This version is optimized for the CoCo 2 under
+*   level 1, version 1 OS9.  It does not mess with the clock 
+*   speed -- the native speed is used.  It also verifies disk 
+*   writes, and uses read caching.
+*
+*   THIS VERSION CAN FORMAT THE HARD DISK!  IT ALSO
+*   SUPPORTS WRITE PROTECTION.
+*
+*   Chris Burke  Schaumburg, IL  07/26/87
+*
+
+ page
+*
+*  Conditional assembly control
+*
+
+Drives  equ     2           ;Number of drives supported
+
+irqflg  equ     1           ;non-zero to mask interrupts during HD access
+trsflg  equ     0           ;non-zero if optimized for 4x40 disk
+cchflg  equ     1           ;non-zero if read cache supported
+vrfflg  equ     1           ;non-zero if write verification supported
+tboflg  equ     0           ;non-zero if jump to 2 MHz for block moves
+fstflg  equ     1           ;non-zero if fast transfers supported
+sysram  equ     1           ;non-zero to use system RAM for verf buffer
+sizflg  equ     1           ;non-zero to allow drives of different sizes
+
+fmtflg  equ     1           ;non-zero if hard formatting supported
+errflg  equ     0           ;non-zero for good error messages
+icdflg  equ     0           ;non-zero to ignore C/D status bit
+timflg  equ     0           ;non-zero to support access timer
+
+XLEVEL  equ     1           ;Bogus level 2 flag
+
+testing equ     0           ;non-zero to call driver "XD", not "HD"
+
+*
+*   Include the main line
+*
+
+        use     xtos9.src
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/bbxhdisk.asm	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,57 @@
+*******************************************
+***                                     ***
+***     COPYRIGHT 1988 BURKE & BURKE    ***
+***     ALL RIGHTS RESERVED             ***
+***                                     ***
+*******************************************
+
+        nam     BBXHDISK
+
+*
+*   CoCo XT Hard Disk Driver  07/25/87
+*
+*   For Western Digital WD1002-WX2 (or WX1) Controller.
+*
+*   This is a general purpose driver.  It can handle
+*   1-2 hard drives, the parameters of which are described
+*   in the device descriptors.  The drives may be of
+*   different sizes.  This version is optimized
+*   for the CoCo 2 under level 1, version 1 OS9.
+*   It does not mess with the clock speed -- the native 
+*   speed is used.  It also verifies disk writes, and uses 
+*   read caching.
+*
+*  Chris Burke  Schaumburg, IL  07/25/87
+*
+
+ page
+*
+*  Conditional assembly control
+*
+
+Drives  equ     2           ;Number of drives supported
+
+irqflg  equ     1           ;non-zero to mask interrupts during HD access
+trsflg  equ     0           ;non-zero if optimized for 4x32 disk
+cchflg  equ     1           ;non-zero if read cache supported
+vrfflg  equ     1           ;non-zero if write verification supported
+tboflg  equ     0           ;non-zero if jump to 2 MHz for block moves
+fstflg  equ     1           ;non-zero if fast transfers supported
+sysram  equ     1           ;non-zero to use system RAM for verf buffer
+sizflg  equ     1           ;non-zero to allow drives of different sizes
+
+fmtflg  equ     0           ;non-zero if hard formatting supported
+errflg  equ     0           ;non-zero for good error messages
+icdflg  equ     0           ;non-zero to ignore C/D status bit
+timflg  equ     0           ;non-zero to support access timer
+
+XLEVEL  equ     1           ;Bogus level 2 flag
+
+testing equ     0           ;non-zero to call driver "XD", not "HD"
+
+*
+*   Include the main line
+*
+
+        use     xtos9.src
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/bbxthd.asm	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,54 @@
+*******************************************
+***                                     ***
+***     COPYRIGHT 1987 BURKE & BURKE    ***
+***     ALL RIGHTS RESERVED             ***
+***                                     ***
+*******************************************
+
+        nam     BBXTHD
+
+*
+*   CoCo XT Hard Disk Driver  07/25/87
+*
+*   For Western Digital WD1002-WX2 (or WX1) Controller.
+*
+*   This version is optimized for 1 4x32 hard disk
+*   on the CoCo 3, under level 1 Version 1 OS9.  It 
+*   speeds up to 2 MHz during disk I/O, then slows down 
+*   again.  It does not verify disk writes, and does not 
+*   use read caching.
+*
+*  Chris Burke  Schaumburg, IL  07/25/87
+*
+
+ page
+*
+*  Conditional assembly control
+*
+
+Drives  equ     1           ;Number of drives supported
+
+irqflg  equ     1           ;non-zero to mask interrupts during HD access
+trsflg  equ     1           ;non-zero if optimized for 4x32 disk
+cchflg  equ     0           ;non-zero if read cache supported
+vrfflg  equ     0           ;non-zero if write verification supported
+tboflg  equ     1           ;non-zero if jump to 2 MHz for block moves
+fstflg  equ     1           ;non-zero if fast transfers supported
+sysram  equ     1           ;non-zero to use system RAM for verify buffer
+sizflg  equ     0           ;non-zero to allow drives of different sizes
+
+fmtflg  equ     0           ;non-zero if hard formatting supported
+errflg  equ     0           ;non-zero for good error messages
+icdflg  equ     0           ;non-zero to ignore C/D status bit
+timflg  equ     0           ;non-zero to support access timer
+
+XLEVEL  equ     1           ;Bogus level 2 flag
+
+testing equ     0           ;non-zero to call driver "XD", not "HD"
+
+*
+*   Include the main line
+*
+
+        use     xtos9.src
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/bkfhdisk.asm	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,64 @@
+*******************************************
+***                                     ***
+***     COPYRIGHT 1990 BURKE & BURKE    ***
+***     ALL RIGHTS RESERVED             ***
+***                                     ***
+*******************************************
+
+        nam     BKFHDISK
+
+*
+*   CoCo XT Hard Disk Driver  Version 2.0
+*   (with formatting capability)
+*
+*   Same as BBFHDISK, but a different name
+*
+*   For Western Digital WD1002-WX2 (or WX1) Controller.
+*
+*   This is a general purpose driver.  It can handle
+*   1-4 hard drives, the parameters of which are described
+*   in the device descriptors.  The drives may be of different
+*   sizes.  This version is optimized for the CoCo 3 under level 
+*   2 OS9.  It does not mess with the clock speed -- the native 
+*   speed is used.  It also verifies disk writes, and uses 
+*   read caching.
+*
+*   THIS VERSION CAN FORMAT THE HARD DISK!  IT ALSO
+*   SUPPORTS WRITE PROTECTION.  IT IS LEVEL-2 SPECIFIC.
+
+*
+*   Chris Burke  Schaumburg, IL  01/26/88
+*
+
+ page
+*
+*  Conditional assembly control
+*
+
+*Drives  equ     2           ;Number of drives supported
+Drives  equ     4           ;Number of drives supported (2 per controller)
+
+irqflg  equ     0           ;non-zero to mask interrupts during HD access
+trsflg  equ     0           ;non-zero if optimized for 4 heads, 32 SPT
+cchflg  equ     1           ;non-zero if read cache supported
+vrfflg  equ     1           ;non-zero if write verification supported
+tboflg  equ     0           ;non-zero if jump to 2 MHz for block moves
+fstflg  equ     1           ;non-zero if fast transfers supported
+sysram  equ     1           ;non-zero to use system RAM for verf buffer
+sizflg  equ     1           ;non-zero to allow drives of different sizes
+
+fmtflg  equ     1           ;non-zero if hard formatting supported
+errflg  equ     1           ;non-zero for good error messages
+icdflg  equ     0           ;non-zero to ignore C/D status bit
+timflg  equ     0           ;non-zero to support access timer
+
+XLEVEL  equ     2           ;Bogus level 2 flag
+
+testing equ     1           ;non-zero to call driver "BK", not "BB"
+
+*
+*   Include the main line
+*
+
+        use     xtos9.src
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/defsfile	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,3 @@
+Level	equ	2
+	use	os9defs
+	use	rbfdefs
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/hdcmd.src	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,849 @@
+*******************************************
+***                                     ***
+***     HDCMD.SRC                       ***
+***                                     ***
+***     COPYRIGHT BURKE & BURKE 1987    ***
+***     ALL RIGHTS RESERVED             ***
+***                                     ***
+***     COPYRIGHT BURKE & BURKE 1992    ***
+***     ALL RIGHTS RESERVED             ***
+***                                     ***
+*******************************************
+
+*
+*   This is the routine that executes controller commands, and
+*   its support routines.
+*
+*   Modification History
+*   --------------------
+*
+*   Date        Who     Description
+*   --------    ---     ------------------------------------
+*   12/20/87    CJB     Modified GetDat and PutDat to call
+*                        SNOOZE routine if not ready for data.
+*                        This causes the driver to sleep 
+*                        during disk seeks.
+*                       Modified s25flg stuff for generic
+*                        32x4x?? drives.
+*   02/07/88    CJB     Added CMEXIN to process special drive
+*                        parameters during formatting
+*
+*   04/17/88    cjb     Added WaitIdl, which waits for controller
+*                        ready to receive a command.
+*                       Added call to Snooze in WaitIdl.
+*   04/21/88    cjb     Added code to OR RetryEn into step rate
+*                        byte.  This allows retries to be disabled
+*                        by RetryEn = $80.
+*   05/18/88    cjb     Checked all paths for proper handling of
+*                        premature command termination
+*   06/12/88    cjb     Added WaitId2 to assure sleep for at least
+*                        one tick.
+*                       Fixed DrvCmd to check for WX$XIN opcode
+*                        if formatting enabled.
+*   07/01/88    cjb     Fixed bug in CMESTS -- changed "<" to ">"
+*   10/10/88    cjb     Modified to save error track if format enabled
+*   02/01/89    cjb     Fixed bug in error routine -- now dumps
+*                        cache on any uncorrectable error
+*                       Fixed bug in error routine to save
+*                        error track # correctly
+*   05/05/90    cjb     Added kludge for ST11R in WAIRDY
+*                       Added support for drives in multiple slots
+*   04/15/92    cjb     Fixed bug in location of DBLRDD - caused
+*                       driver to hang up on an error message.
+*                       Lenghtened a bit for speed, and to allow
+*                       easy 6309E overlays.
+*
+
+ page
+*
+*   Byte saver.
+*
+*   Call here to send command in Reg-A to drive in Reg-B,
+*   with 0's as the rest of the command.  
+*
+*   Note that this command sets the step rate to 3 ms!
+*
+DrvCmd  pshs    y,x,a           ;Save registers same as CmExec
+        sts     AbtStk,U        ;Save stack pointer for error recovery
+
+*   Enter here to send WX$STS -- stack etc. already set up
+
+DrvCm2  bsr     WAIRDY          ;Wait for ready for command -- preserves B
+        lda     ,S              ; recover reg-A
+
+    ifne    fmtflg
+        bsr     ChkCmd          ; translate cmd. if necessary
+    endc
+
+    ifne    (Drives-1)          ;If multiple drives,
+        andb    #$01            ; 2 drives per controller, different slots
+        aslb
+        aslb
+        aslb                    ;convert drive # to controller's format
+        aslb
+        aslb
+    else
+        clrb                    ;drive # is always 0
+    endc
+
+        bsr     PutCm2          ;Send command & drive #
+
+*  Send the rest of the command as 0's (including step rate . . . 3ms)
+*  Note that RetryEn is ignored here.
+
+        clra
+        clrb
+        bsr     PutCm2
+        bsr     PutCm2          ;Send 4 zeros for rest of command
+
+*  Pass control to dispatch routine, and wait for end when done
+
+        bra     CmDisp
+
+    page
+*
+*   Put Reg-D to controller as command bytes
+*
+*   Assumes AbtStk is valid.
+*
+    ifne    icdflg              ;If ignoring C/D status bit
+
+PutCm2  lbra    PutDt2
+
+    else
+
+PutCm2  bsr     PutCmd
+        tfr     B,A             ;Fall through to PutCm2
+
+    endc
+
+*
+*   Wait for controller to indicate it is ready to receive
+*   a command byte, then send it from Reg-A.
+*
+*   Assumes AbtStk,U has been set to the error recovery
+*   stack pointer.
+*   If the command aborts, the stack is cleaned and control
+*   passed to CmdDun.
+*
+    ifne    icdflg              ;If ignoring C/D status bit
+
+PutCmd  lbra    PutDat
+
+    else
+
+PutCmd  pshs    A
+
+PCM0    bsr     ChkAbt              ;Get status, check for abort
+        cmpa    #%00001101          ;Check for command request
+         bne    PCM0
+
+*  Ready.  Put the data
+
+        puls    A
+        sta     >HDDATA
+        rts
+
+    endc
+
+*
+*   Get status of hard disk controller, and abort command in
+*   progress if controller says so.
+*
+*   Assumes AbtStk,U has been set to the error recovery
+*   stack pointer.
+*   If the command aborts, the stack is cleaned and control
+*   passed to CmdDun.
+*
+ChkAbt  lda     >HDSTAT
+        cmpa    >HDSTAT             ;Data must be stable
+         bne    ChkAbt
+
+        anda    #%00001111
+        cmpa    #%00001111          ;Check for abort
+         bne    CKA9
+
+*  Well, the command is complete.  This normally means it
+*  aborted.  Pass control to CmdDun
+
+        lds     AbtStk,U            ;Clean stack
+        bra     CmdDun
+
+*  Not done yet.  Return current status to caller
+
+CKA9    rts
+
+    ifne    fmtflg          ;If formatting allowed,
+*
+*   Convert command op-code before transmission to controller
+*   if necessary.
+*
+*   The special initialization code WX$XIN is not a real controller
+*   op-code.
+*
+ChkCmd  cmpa    #WX$XIN         ;Check for bogus INITIALIZE PARAMETERS
+         bne    CCM9
+        lda     #WX$INI         ; convert to real INITIALIZE PARAMETERS
+CCM9    rts
+    endc
+
+*
+*   Wait for controller ready to receive a command, then
+*   get its attention.  Blows away Reg-A.  
+*
+*   Does not time out.
+*
+WAIRDY  bsr     WaitIdl         ;Wait for controller idle
+        clr     >HDATTN         ;Get attention of controller
+        rts
+
+*   Wait for controller ready to receive a command
+
+WaitIdl lda     >HDSTAT
+*        anda    #%00001111
+        anda    #%00001001      ;Special mask works for ST11R, too
+        cmpa    #%00000000      ; (all bits must be clear if ready)
+         beq    WaitId9
+
+*   Enter here to sleep for at least one tick.
+*   Waste time while waiting for HD.
+
+WaitId2 lbsr    Snooze          ;Give up slot, sleep.
+        bra     WaitIdl
+
+WaitId9 rts
+
+ page
+*
+*   Command execution module for CoCo XT.
+*
+*   Enter with:
+*
+*   Command op-code in Reg-A
+*   Buffer pointer in Reg-X (points to buffer for data part of cmd)
+*   Command image set up at IMAGE,U
+*   Reg-Y points to real or bogus path descriptor (for drive # and
+*   step rate).
+*   Slot 3 is assumed to be selected, with interrupts disabled.
+*
+*   Exits w/ carry clear if success, otherwise carry set and
+*   error code in Reg-B.
+*
+CMEXEC  pshs    y,x,a           ;Save caller's registers
+        sts     AbtStk,U        ;Save stack pointer for error recovery
+
+*   Wait for drive ready to accept a command
+
+        bsr     WaiRdy
+
+*   Point to the command block
+
+        leax    IMAGE,U
+
+*   Issue the command . . . op-code 1st
+*   PutCmd and PutCm2 will automatically abort the command
+*   if the controller indicates that this is necessary.
+
+        lda     0,S             ;Recover command op-code
+
+    ifne    fmtflg
+        bsr     ChkCmd          ;Translate command op-code if needed
+    endc
+
+CMX1    bsr     PutCmd
+
+        ldd     ,X++            ; (send head & sector)
+        bsr     PutCm2
+
+        ldd     ,X++            ; (send cylinder & block count)
+        bsr     PutCm2
+
+        lda     PD.STP,Y        ; (send step rate)
+        ora     RetryEn,U       ; (and send retry flag)
+        bsr     PutCmd
+
+*   Now dispatch the command based on it's op-code.  If a command
+*   isn't explicitly checked for in this loop, it is assumed that
+*   the command has no data arguments and is now executing.
+
+CmDisp  equ     *
+
+*   Command in progress.  Dispatch to service routine.
+*   Note that the service routine must check for premature
+*   command termination via CHKABT.
+
+        ldx     1,S             ;Recover possible data pointer
+        lda     0,S             ;Recover op-code
+
+        cmpa    #WX$RDD         ;READ SECTOR
+         beq    CMERDD
+
+        cmpa    #WX$WRT         ;WRITE SECTOR
+         beq    CMEWRT
+
+        cmpa    #WX$INI         ;SET DRIVE PARAMETERS
+         lbeq   CMEINI
+
+    ifne    fmtflg
+        cmpa    #WX$WBF         ;WRITE SECTOR BUFFER (for format)
+         lbeq   CMEWBF
+
+        cmpa    #WX$XIN         ;Bogus SET DRIVE PARAMETERS
+         lbeq   CMEXIN
+    endc
+
+        cmpa    #WX$STS         ;DETAILED STATUS REQUEST
+         lbeq   CMESTS
+
+*   Wait for end of command execution.  Then get completion status
+*   byte and decode any errors encountered.
+
+WaiEnd  bsr     ewait           ;Wait for command done
+
+*   Get completion status byte
+*   Stack pointer and ABTSTK,U match
+
+CmdDun  clrb                    ;Clear carry, assume no error
+
+        lda     >HDDATA
+        bita    #%00000010
+         beq    NoErr
+
+*   Error bit is set -- note this could still be a "null" error
+*   or a correctable error, so we have to get the status packet.
+
+        lda     0,S             ;Check op-code
+        cmpa    #WX$STS         ;Was it an error status request?
+         bne    GetErr
+
+*   Unknown error, or error while trying to determine error.
+
+NotRdy  comb
+        ldb     #E$Read         ;Report it as a "read" error
+
+*   Generic exit
+
+NoErr   equ     *
+CMEXIT  puls    a,x,y,pc
+
+*   Issue command to read error from controller.  This command
+*   will return the error code in Reg-B w/ carry set.
+
+GetErr  lda     #WX$STS         ;Recurse to get detailed status (implicit bfr)
+
+    ifne    Drives-1            ;If more than 1 drive,
+        ldb     PD.DRV,Y
+    endc
+
+        lds     AbtStk,U        ;Recover stack pointer
+        sta     0,S             ;Put command on stack
+        lbra    DrvCm2          ;Go try again.
+
+*   Wait for command to terminate
+
+ewait   lda     >HDSTAT
+        anda    #%00000111      ;NOTE:  IGNORE BUSY BIT
+        cmpa    #%00000111      ; (all bits set for command completion byte)
+         beq    ewx
+
+*  Not done.  Sleep for the rest of this tick, then try again.
+
+        lbsr    Snooze          ;Give up slot, sleep, get back slot
+        bra     ewait
+
+*   Exit
+
+ewx     rts
+
+ page
+*
+*   Handle tail end of sector read.
+*   Get the data to the caller's buffer.
+*
+CMERDD  lda     secnum,u
+        bita    #1
+         bne    CMRODD
+
+*  Read even logical sector on track -- 1st half of physical sector
+*  Save 2nd half if necessary.
+
+        bsr keep256
+
+    ifne    cchflg          ;If read cache supported,
+
+        tst BFRFLG,U
+         beq CMRE1
+
+*  Copy 2nd half of sector to verify buffer (possible cache)
+        leax    vrfbuf,U
+        bsr     keep256
+        bra     WaiEnd
+
+    endc
+
+*  Discard 2nd half of sector
+CMRE1   bsr     dump256
+        bra     WAIEND
+
+*  Read odd logical sector on track -- 2nd half of physical sector
+*  Throw away the 1st half
+CMRODD  bsr     dump256
+        bsr     keep256
+        bra     WAIEND
+
+ page
+*
+*   Handle tail end of sector write.
+*   Get the data from the caller's buffer.
+*
+CMEWRT  lda     secnum,u
+        bita    #1
+         bne    CMWODD
+
+*  Write even lsn on track -- uses 1st half, get 2nd half from verify bfr
+        bsr     writ256
+        bsr     copy256
+        bra     WAIEND
+
+*  Write odd lsn on track -- uses 2nd half, get 1st half from verify bfr
+CMWODD  bsr     copy256
+        bsr     writ256
+        bra     WAIEND
+
+    ifne    fmtflg          ;If hard formatting enabled,
+
+ page
+*
+*  Process command to fill sector buffer with (A).
+*
+*  This is only used at the beginning of a FORMAT command.
+*
+CMEWBF  ldd     #$E600      ; ($00 -> 256 iterations)
+        bsr     CMF0
+        bsr     CMF0        ; Reg-B is still 0 from previous iteration
+        lbra    WAIEND
+
+CMF0    bsr     PutDat      ;Fill 256 bytes of sector buffer with (A)
+        decb
+        bne     CMF0
+
+        rts
+
+    endc
+
+ page
+*
+*  Copy 256 bytes from sector buffer to (X)
+*
+
+    ifne    fstflg              ;If fast transfers,
+
+Keep256 bsr     GetDat          ;Full handshake on 1st byte
+        sta     ,X+
+    ifne    tboflg              ;If 2 MHz for transfers,
+        clr     >$FFD9
+    endc
+        bsr     GetDat          ;Get 2nd (quick move goes in pairs)
+        sta     ,X+
+        ldb     #$7F            ;pair count
+        pshs    B
+
+RDD1    lda     >HDDATA         ;Read the rest of the block w/o handshake
+        ldb     >HDDATA
+        std     ,X++
+        dec     ,S
+         bne    RDD1
+
+    ifne    tboflg              ;If 2 MHz for transfers,
+        clr     >$FFD8
+    endc
+
+        puls    A,PC            ;Flush counter
+
+    else                        ;If slow transfers,
+
+Keep256 clrb                    ;Copy 256 bytes
+    ifne    tboflg              ;If 2 MHz for transfers,
+        clr     >$FFD9
+    endc
+
+RDD1    bsr     GetDat          ;Full handshake on every byte
+        sta     ,X+
+        decb
+         bne    RDD1
+
+    ifne    tboflg              ;If 2 MHz for transfers,
+        clr     >$FFD8
+    endc
+
+        rts
+
+    endc
+
+*
+*  Copy 256 bytes from sector buffer to bit bucket
+*
+
+    ifne    fstflg              ;If fast transfers,
+
+Dump256 bsr     GetDat          ;Full handshake on 1st byte
+    ifne    tboflg              ;If 2 MHz for transfers,
+        clr     >$FFD9
+    endc
+        bsr     GetDat          ;Quick dump goes in pairs
+        ldb     #$7F
+
+RDD2    lda     >HDDATA         ;Read the rest of the block w/o handshake
+        lda     >HDDATA
+        decb
+         bne    RDD2
+
+    ifne    tboflg              ;If 2 MHz for transfers,
+        clr     >$FFD8
+    endc
+        rts
+
+    else                        ;If slow transfers,
+
+Dump256  clrb                   ;Copy 256 bytes
+    ifne    tboflg              ;If 2 MHz for transfers,
+        clr     >$FFD9
+    endc
+
+RDD2    bsr     GetDat          ;Full handshake on every byte
+        decb
+         bne    RDD2
+
+    ifne    tboflg              ;If 2 MHz for transfers,
+        clr     >$FFD8
+    endc
+        rts
+
+    endc
+
+*
+*   Wait for controller to indicate it is ready to transmit
+*   a data byte, then get it to Reg-A.
+*
+*   Assumes AbtStk,U has been set to the error recovery
+*   stack pointer.
+*   If the command aborts, the stack is cleaned and control
+*   passed to CmdDun.
+*
+GetDat  equ     *
+
+GDT0    lbsr    ChkAbt              ;Get status, check for abort
+    ifne    icdflg                  ;If ignoring C/D bit,
+        anda    #%00001011
+    endc
+        cmpa    #%00001011          ;Check for data request
+         beq    GDT1                ; (branch if request present)
+
+*   New -- sleep if controller not ready (D.DMAReq only)
+
+        lbsr    Snooze
+        bra     GDT0
+
+*  Ready.  Get the data
+
+GDT1    lda     >HDDATA
+        rts
+
+ page
+*
+*  Copy 256 bytes from (X) to sector buffer
+*
+
+    ifne    fstflg              ;If fast transfers,
+
+Writ256 ldd     ,X++
+        bsr     PutDt2          ;Full handshake on 1st byte pair
+    ifne    tboflg              ;If 2 MHz for transfers,
+        clr     >$FFD9
+    endc
+        ldb     #$7F
+        pshs    B
+
+WRT1    ldd     ,X++
+        sta     >HDDATA         ;Write the rest of the block w/o handshake
+        stb     >HDDATA
+        dec     ,S
+         bne    WRT1
+
+    ifne    tboflg              ;If 2 MHz for transfers,
+        clr     >$FFD8
+    endc
+        puls    A,PC            ;clean up counter
+
+    else                        ;If slow transfers,
+
+Writ256  clrb                    ;Copy 256 bytes
+    ifne    tboflg              ;If 2 MHz for transfers,
+        clr     >$FFD9
+    endc
+
+WRT1    lda     ,X+
+        bsr     PutDat          ;Full handshake on every byte
+        decb
+         bne    WRT1
+
+    ifne    tboflg              ;If 2 MHz for transfers,
+        clr     >$FFD8
+    endc
+        rts
+
+    endc
+
+*
+*  Copy 256 bytes from verify buffer to sector buffer
+*
+
+copy256 pshs    X
+
+        leax    vrfbuf,u        ;Get verify buffer pointer
+        bsr     writ256
+
+        puls    X,PC
+
+*
+*   Put Reg-D to controller as data bytes
+*
+*   Assumes AbtStk is valid.
+*
+PutDt2  bsr     PutDat
+        tfr     B,A             ;Fall through to PutCm2
+
+*
+*   Wait for controller to indicate it is ready to receive
+*   a data byte, then send it from Reg-A.
+*
+*   Assumes AbtStk,U has been set to the error recovery
+*   stack pointer.
+*   If the command aborts, the stack is cleaned and control
+*   passed to CmdDun.
+*
+PutDat  pshs    A
+
+PDT0    lbsr    ChkAbt              ;Get status, check for abort
+    ifne    icdflg                  ;If ignoring C/D bit,
+        anda    #%00001011
+    endc
+        cmpa    #%00001001          ;Check for data request
+         beq    PDT1                ; (branch if request present)
+
+*   New -- sleep if controller not ready (D.DMAReq only)
+
+        lbsr    Snooze
+        bra     PDT0
+
+*  Ready.  Put the data
+
+PDT1    puls    A
+        sta     >HDDATA
+        rts
+
+ page
+*
+*   Process detailed status request command.
+*   This routine performs the status request, then
+*   translates the controller's error code and returns
+*   it as the error status of the operation w/ C-bit set.
+*   "Null" and correctable errors do not cause C-bit set.
+*
+CMESTS  equ     *
+
+*  Recover error status from controller
+
+        bsr     GetDat      ;Read result of last disk command
+        pshs    a           ; (save)
+
+    ifne    FMTFLG
+        bsr     GetDat      ; (dump head #)
+        bsr     GetDat      ;Get shifted cyl # MS byte
+        tfr     A,B
+        bsr     GetDat      ;Get shifted cyl # LS byte
+        exg     A,B
+        std     ERRHCYL,U   ;Save cylinder # of error for FORMAT
+    else
+        bsr     DBLRDD      ;Dump last 3 response bytes
+        bsr     GetDat      ; (dump last response byte)
+    endc
+
+        lbsr    ewait       ; Wait for command complete
+        lda     >HDDATA     ;  and dump completion byte
+
+        puls    a           ; (recover error code)
+
+*  Look up error code in Reg-A -> Reg-B
+
+        anda    #$3F        ;Keep only error bits
+         beq    NULERR
+
+        cmpa    #WE$CER     ;Correctable error
+         bne    EL0
+
+*   Special processing for correctable errors.
+*   If formatting (RetryEn,U != 0), report these
+*   as READ ERRORS
+
+        tst     RetryEn,U       ;If retries disabled, error out.
+         beq    NULERR          ; (retries enabled -- ignore error)
+
+EL0     equ     *
+
+    ifne    cchflg          ;If read cache supported,
+        clr     BFRFLG,U        ;Dump cache on any error
+    endc
+    ifne    errflg      ;If good error messages enabled,
+
+        leax    ERRTBL,PCR     ;Point to lookup table
+
+*  Search error list.  Error code is in Reg-A
+
+EL1     tst     ,X
+         bmi    XXXERR
+        cmpa    ,X++
+         bne    EL1
+
+*  Found error code
+        comb                ;Set carry
+        ldb     -1,X            ;Fetch error code
+        bra     XCMXIT
+
+    endc
+
+*  Didn't find error code.  Note that errors that translate
+*  to E$Read are not in the table -- we just let them default
+*  to here.
+
+XXXERR  comb
+        ldb     #E$Read
+        bra     XCMXIT          ;Return status to caller
+
+NULERR  clrb                    ;Force carry clear
+XCMXIT  lbra    CMEXIT          ;Return status to caller
+
+*  Byte saver
+
+DBLRDD  lbsr    GetDat          ;Read 1 byte
+        lbra    GetDat
+
+ page
+    ifne    fmtflg      ;If formatting allowed,
+*
+*   Process special drive parameters command.
+*
+*   This command sends the legal track count rather
+*   than the park track count.
+*
+CMEXIN  ldd     PD.CYL,Y        ;get track count
+        bra     CMIN01
+    endc
+
+*
+*   Process command to send drive parameters to controller.
+*   Assumes Reg-Y points to real or bogus *PATH* descriptor.
+*
+*   This routine fetches the drive parameters from the descriptor,
+*   and sends them to the controller.
+*
+CMEINI  equ     *
+
+*   Send # of cylinders.  We send the park track, since it
+*   is the largest track # that will be used.
+
+    ifne    (Drives-1)      ;if 2 drives,
+     ifne   trsflg          ; if optimized for 32 SPT, 4 heads,
+        bsr     GtPkLSN         ;Get park LSN to B:X
+        pshs    X,B
+        ldd     ,S
+        addd    ,S
+        leas    3,S             ;Convert to track by dividing by 128
+     else
+        bsr     GtPkLSN         ;Get park LSN to B:X
+        lbsr    LSNDIV
+        tfr     X,D             ;Calculate track and get to D
+     endc
+    else                    ;if 1 drive,
+     ifne   trsflg          ; if optimized for 32 SPT, 4 heads,
+        ldd     PRKLSN,U
+        addd    PRKLSN,U        ;park track = park LSN/128
+     else
+        ldb     (PRKLSN+0),U
+        ldx     (PRKLSN+1),U    ;get park LSN
+        lbsr    LSNDIV
+        tfr     X,D             ;Calculate track and get to D
+     endc
+    endc
+
+*   Enter here w/ track count in Reg-D
+
+CMIN01  addd    #1              ; (advance track count by 1)
+        bsr     PutDt2          ;Send last legal track to controller
+
+*  Send # of heads
+
+        lda     PD.SID,Y
+        bsr     PutDat
+
+*  Send (bogus) reduced write current cylinder
+
+        ldd     PD.CYL,Y
+        lbsr    PutDt2
+
+*  Send write pre-comp cylinder (DD had wpc/4)
+
+    ifne    (Drives-1)         ;if 2 drives,
+        pshs    Y
+        ldb     PD.DRV,Y        ;Get drive #
+        lbsr    GOBPtr          ;Get option pointer for this drive
+        ldb     (PCCYL-OBSTART),Y
+        puls    Y
+    else
+        ldb     PCCYL,U         ;Get precomp cylinder / 4
+    endc
+        lda     #4
+        mul                     ;Convert to real cyl # in D
+        lbsr    PutDt2
+
+*   Send maximum error correction burst length (WD recommends 4)
+
+        lda     #4
+        lbsr    PutDat
+
+*   Wait for end of command, etc.
+
+        lbra    WaiEnd
+
+    ifne    (Drives-1)
+    page
+*
+*   Utility to get park lsn to B:X for systems with 2 drives.
+*
+GtPkLSN pshs    Y
+        ldb     PD.DRV,Y        ;Get drive #
+        lbsr    GOBPtr          ;Get option pointer for this drive
+        ldb     (PRKLSN+0-OBSTART),Y
+        ldx     (PRKLSN+1-OBSTART),Y
+        puls    Y,PC
+    endc
+
+    ifne    errflg      ;If good errors enabled,
+    page
+*
+*   Table of error code followed by OS9 error code
+*   This translation is somewhat arbitrary.
+*   Remember, E$Read errors are not in the table.
+*
+
+ERRTBL  fcb     WE$NSC,E$Seek,WE$WRF,E$Write,WE$NRD,E$NotRdy,WE$NT0,E$Seek
+        fcb     WE$DSS,E$Seek,WE$SIK,E$Seek,WE$BTK,E$Read,WE$CMD,E$Unit
+        fcb     WE$ISA,E$Sect
+        fcb     -1
+
+    endc
+
+*
+*   End of hdcmd.src
+*
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/hdmath.src	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,508 @@
+*   COPYRIGHT BURKE & BURKE 1990
+*   ALL RIGHTS RESERVED
+*
+*   COCO XT LSN / DRIVE -> TASK FILE CONVERSION
+*
+*   Version 2.0
+*
+*   Date        Who     Description
+*   --------    ---     --------------------------
+*   01-08-88    CJB     Coded from version 1.0
+*                       Added GOBPtr routine and support for 2
+*                        drives with different characteristics.
+*                       Changed ST-225 support to work with any
+*                        drive having 32 SPT and 4 heads (e.g.
+*                        ST-238 w/ RLL & W9 in).
+*   01/28/88    CJB     Changed LSN bounds check in XSETUP --
+*                        compare to park LSN!
+*   02/06/88    CJB     Fixed bug that caused loss of LSN MSbyte
+*                        when supporting 2 drives.
+*                       Eliminated need for DIVA and DIVY parameters
+*   05/18/88            Added CNV99 to check for seek errors
+*   12/12/88    cjb     Fixed bug in 1-drive XSETUP for park track
+*   05/18/90    cjb     Added support for drives in multiple slots
+*
+
+*
+*  Get ready to read or write a sector
+*
+SETUP   lbsr    SELDRV
+         bcs    SETXIT
+
+        bsr     XSETUP
+
+SETXIT  rts 
+
+    ifeq    trsflg              ;If not optimized for 4 heads, 32 SPT
+
+*
+*  General setup for read or write.
+*  Drive is already selected.
+*
+XSETUP  pshs    y,x,b
+
+    ifne    (Drives-1)
+        ldb     PD.DRV,Y
+        lbsr    GOBPTR          ;Point Y to park LSN area
+
+        ldb     ,S              ;Recover MSByte of LSN
+        cmpb    (PRKLSN-OBSTART+0),Y
+         lbhi   BADSEC
+         bcs    XSET2           ;Branch if OK
+
+        cmpx    (PRKLSN-OBSTART+1),Y
+         lbhi   BADSEC
+
+*  LSN is OK.  Still in B:X
+
+XSET2   ldy     3,S     ;Recover PD pointer
+
+    else
+        cmpb    PRKLSN+0,U
+         lbhi   BADSEC
+         bcs    XSET2
+
+        cmpx    PRKLSN+1,U
+         lbhi   BADSEC
+
+*  LSN is OK.  Still in B:X
+
+XSET2   equ     *
+
+    endc
+
+*
+*   Convert LSN to cylinder, sector, head #'s
+*   Save head.sector in TEMP
+*
+CNVLSN  equ     *
+
+        bsr LSNDIV          ;track -> X, Head -> A, sector ->B
+        std temp,u          ;save head & sector for later
+
+        clrb                ; (clear carry for ROR)
+        tfr x,d             ;Cylinder number
+        RORA
+        RORA                ;get cylinder MSB's to top of byte
+        RORA
+        std hicyl,u
+
+        ldb     temp+1,U    ;Process sector #
+        andb    #%00111111  ; (0-31 normal, 0-47 RLL)
+        stb     secnum,u    ;Save logical sector number
+        lsrb                ; / 2 to get physical sector #
+        orb     hicyl,U     ; OR in the physical sector number
+        stb     hicyl,U
+
+        lda     sdhreg,U    ;save drive #; OR in head
+        anda    #%00100000
+        ora     temp+0,U
+        sta     sdhreg,U
+
+        lda     #1          ;read only 1 sector
+        sta     seccnt,U
+
+        tst    drvsem,u    ;is drive ready?
+         beq   CNVOK
+
+*
+*   Drive is not ready.
+*
+CNV7    clr     drvsem,U
+
+    ifne    (Drives-1)      ;If multiple drives,
+*        ldy     actdrv,u
+*        lda     V.TRAK,y
+        ldy     3,s         ;Restore PD pointer
+*        cmpa    #$FF
+*         bne    CNVOK       ;Implicit seek if current track known
+        lbsr    Seek        ;Explicit seek
+    else
+        lda     DRVTBL+V.TRAK,U
+        cmpa    #$FF
+         bne    CNVOK       ;Implicit seek if current track known
+        lbsr    SEEKT0      ;Else seek to track 0
+    endc
+         bcs    CNV99       ; report error if any encountered
+
+*  Generic exit w/o error from conversion
+
+CNVOK   clrb
+
+CNV9    bcc     CNVXIT
+
+CNV99   stb     ,s          ;Set error code
+
+CNVXIT  puls    b,x,y,PC
+
+*  Return bad sector error
+
+BADSEC  puls    b
+        comb 
+        ldb     #E$Sect
+        puls    x,y,PC
+
+ page
+*
+*   Convert LSN in B:X to track # in X
+*   and head.sector (remainder) in D.  Enter with
+*   Reg-U -> static storage and Reg-Y -> path descriptor.
+*
+*   Routine assumes that MSB of LSN is 0, and that
+*   MSB of H*S is 0.
+*
+*   Start by dividing LSN by SPT*heads.  The quotient
+*   is the track number.  Then divide the remainder by
+*   SPT; the quotient is the head, and the remainder
+*   is the sector.
+*
+LSNDIV  pshs    Y,X,B               ;Save Y, stack LSN for division
+
+*   Calculate SPT * heads
+
+        lda     PD.SID,Y            ;Get sides
+        ldb     (PD.SCT+1),Y        ;Get reg-B = SPT
+        mul
+
+        pshs    D
+        clr     ,-S                 ;Now stack = heads*spt
+
+*   Calculate track # to X
+
+        bsr     div24               ;divide, X=quotient, D=remainder
+        leas    6,S                 ; discard temps
+
+        pshs    X                   ;Save track to return
+
+*   Now divide heads*SPT by SPT -- quickly
+
+        clr     ,-s
+        com     ,s
+
+LDV000  inc     ,s
+        subb    (PD.SCT+1),Y
+        sbca    #0
+         bhs    LDV000
+
+        addb    (PD.SCT+1),Y        ;Get sector # to B
+
+        puls    A,X,Y,PC            ;Get head to A, sector to B, track X
+
+*
+*   Divide 24 bit 'M' by 24 bit 'N'.  Return 16 bit quotient
+*   in Reg-X, 16 bit remainder in Reg-D.  Destroys M, N; leaves
+*   carcasses on stack.  Preserves U, Y.
+*
+*   Entry:
+*       M.l
+*       M.m
+*       M.h
+*       N.l
+*       N.m
+*       N.h
+*       P.l
+*   SP->P.h
+*
+
+div24   pshs    Y
+
+*   Push special division guys
+
+        ldd     #1
+        pshs    D
+        pshs    A                   ;24 bit "1" flag
+
+        clrb
+        pshs    D
+        pshs    A                   ;24 bits of 0's (result)
+
+*   Lotsa good stuff on stack.  Find biggest multiple of heads*spt
+*   smaller than or = LSN
+
+LDV001  ldd     (8+2+3+0),S
+        cmpd    (8+2+0+0),S
+         bne    LDV002              ;carry set w/ which is more
+
+        lda     (8+2+3+2),S
+        cmpa    (8+2+0+2),S
+
+*   Now CC set for LSN-HS
+LDV002  bcs     LDV005              ;branch if HS > LSN
+
+*   Get to multiply HS etc by 2
+
+        asl     (3+2),S             ;bit flag * 2
+        rol     (3+1),S
+        rol     (3+0),S
+
+        asl     (8+2+0+2),S         ;HS * 2
+        rol     (8+2+0+1),S
+        rol     (8+2+0+0),S
+
+        bra     LDV001
+
+*   Now HS is bigger than LSN.  Start dividing.
+
+LDV005  lsr     (8+2+0+0),S         ;HS / 2
+        ror     (8+2+0+1),S
+        ror     (8+2+0+2),S
+
+        lsr     (3+0),S             ;bit flag / 2
+        ror     (3+1),S
+        ror     (3+2),S
+         bcs    LDV008              ; (branch if ready for remainder)
+
+        ldd     (8+2+3+1),S         ;LSN - HS.scaled
+        subd    (8+2+0+1),S
+        std     (8+2+3+1),S
+        lda     (8+2+3+0),S
+        sbca    (8+2+0+0),S
+        sta     (8+2+3+0),S
+
+         bcc    LDV007
+
+*   No good.  Restore LSN
+
+        leay    (8+2+3),S
+        leax    (8+2+0),S
+        bsr     addxtoy             ;LSN + HS.scaled
+         bra    LDV005
+
+*   Good.  Add bit to result
+
+LDV007  leay    0,S                 ;Quotient + bit
+        leax    3,S
+        bsr     addxtoy
+         bra    LDV005
+
+*   Now we've checked for all multiples of HS.
+*   Quotient is at 0-2,S; remainder is where dividend was.
+*   Quotient and remainder are known to be < 65536
+
+LDV008  ldx     (0+1),S             ;get 16 bit quotient
+        leas    6,S                 ;Deallocate quotient & temps
+        ldd     (4+3+1),S           ;get 16 bit remainder
+
+        puls    Y,PC
+
+*
+*   Add 24 bits @X to 24 bits @Y
+*
+addxtoy ldd     1,Y
+        addd    1,X
+        std     1,Y
+        lda     0,Y
+        adca    0,X
+        sta     0,Y
+        rts
+
+    else
+
+*
+*   General setup for read or write.
+*   Drive is already selected.
+*
+*   Optimized for drives such as ST-225, with
+*   32 double-sectors / track.  This version
+*   works only with 4 heads.
+*
+*  Reg-Y points to path descriptor.
+*  Drive # already set up in SDHREG,U
+*
+XSETUP  pshs    y,x,b
+
+    ifne    (Drives-1)
+        ldy     actdrv,u    ;Verify legal LSN (fetch drive table pointer)
+
+        cmpb    DD.TOT,y
+         lbhi   BADSEC
+         bcs    XSET2      ;Branch if OK
+
+        cmpx    DD.TOT+1,y
+         lbcc   BADSEC
+
+*  LSN is OK.  Still in B:X
+
+XSET2   ldy     3,S     ;Recover PD pointer
+
+    else
+        cmpb    DRVTBL+DD.TOT,U
+         lbhi   BADSEC
+         bcs    XSET2
+
+        cmpx    DRVTBL+DD.TOT+1,U
+         lbcc   BADSEC
+
+*  LSN is OK.  Still in B:X
+
+XSET2   equ     *
+
+    endc
+
+*
+*   These drives have 4 heads, 32 sectors / track.
+*   The LSN is known to be in range.
+*
+
+        pshs    x,b     ;Calculate track = LSN / (32*4); format for controller
+        ldd     ,s
+        addd    ,s          ;double MS word of LSN; /128 is like *2 / 256.
+        tst     2,s         ; (there's never a carry from ADDD)
+         bpl    XSET3
+
+        incb                ;add in MSB of LS byte if needed -- never a carry
+
+*  NOTE -- carry must be clear here.
+
+XSET3   rora            ;Controller likes 2 MS bits of cylinder in MS bits of A
+        rora
+        rora
+        std     hicyl,U     ; (don't need to format Reg-B)
+
+        ldb     2,s         ;Calculate logical sector and physical sector
+        andb    #%00011111  ; (0-31 ALWAYS -- W9 in for RLL)
+        stb     secnum,u
+        lsrb                ; (physical sector is 1/2 logical -- 0-15)
+        orb     hicyl,u
+        stb     hicyl,u     ;format correctly
+
+        ldb     2,s         ;Calculate head number = LSN / 32
+        lda     #8
+        mul                 ; now head number is in Reg-A
+        anda    #%00000011
+        pshs    a
+        lda     sdhreg,u
+        anda    #%00100000  ; (save only the drive # from SELDRV)
+        ora     ,s+
+        sta     sdhreg,u    ; format for controller and save
+
+        lda     #1          ;Set up sector count
+        sta     seccnt,u
+
+        leas    3,s         ;Discard stack stuff
+
+*  Done with task file.
+        tst     drvsem,u    ;Is drive ready?
+         beq    CNVOK
+
+*  Drive not ready; perform seek
+CNV7    clr     drvsem,u
+
+    ifne    (Drives-1)      ;If multiple drives,
+*        ldy     actdrv,u
+*        lda     V.TRAK,y
+        ldy     3,s         ;Restore PD pointer
+*        cmpa    #$FF
+*         bne    CNVOK       ;Implicit seek if current track known
+        lbsr    Seek        ;Explicit seek
+    else
+        lda     DRVTBL+V.TRAK,U
+        cmpa    #$FF
+         bne    CNVOK       ;Implicit seek if current track known
+        lbsr    SEEKT0      ;Else seek to track 0
+    endc
+         bcs    CNV99
+
+*  Generic conversion exit with no error
+CNVOK   clrb 
+
+CNV9    bcc     CNVXIT
+
+CNV99   stb     ,s
+
+CNVXIT  puls    b,x,y,PC
+
+*  Return bad sector error
+BADSEC  puls    b
+        comb 
+        ldb     #E$Sect
+        puls    x,y,PC
+
+    endc
+
+*
+*   Perform drive selection calculations
+*
+SELDRV  equ     *
+
+    ifne    (Drives-1)          ;If multiple drives supported,
+
+        lda     PD.DRV,Y
+        cmpa    #Drives         ;Is drive # OK?
+         bcs    SD0
+
+*  Illegal drive error
+        comb
+        ldb     #E$Unit
+
+SD.XIT  rts
+
+*   Drive # in A is OK.  Set semaphore based on 
+*   current and prev. drive;
+
+SD0     clr     drvsem,U        ;Assume same drive.
+        cmpa    prvdrv,U        ;Same as previous?
+         beq    SD1             ; (if so, we're already set up)
+
+*  Set flag to indicate new drive, and wait for drive ready
+
+        sta     prvdrv,U
+        dec     drvsem,U
+        lbsr    WaiDrv          ;Wait -- preserve D,X,Y,U
+         bcs    SD.XIT          ; (abort if drive not ready)
+    ifne    cchflg          ;If cache supported,
+        clr     BfrFlg,U        ;Mark cache data invalid
+    endc
+
+*  Convert drive # to controller's format
+
+SD1     anda    #$01            ;2 drives / controller, but allow slots
+        asla
+        asla
+        asla
+        asla
+        asla
+        pshs    a
+        lda     sdhreg,U        ;get old value
+        anda    #%00001111      ; (save head #)
+        ora     ,s+
+        sta     sdhreg,U
+
+        pshs    x
+        ldx     PD.DTB,Y        ;get pointer to drive table
+        stx     ACTDRV,U
+        puls    x
+
+    else
+
+        lda     sdhreg,U        ;get old value
+        anda    #%00001111      ; save head #, force drive # to 0
+        sta     sdhreg,U
+
+    endc
+
+*  Carry clear unless error
+SDXIT   rts
+
+    ifne    (Drives-1)          ;For 2 drive systems,
+
+    page
+*
+*   Calculate pointer to drive PCCYL, DIVA, DIVY, and PRKTRK
+*   parameters, based on drive # in Reg-B.  Return ptr in Y.
+*
+*   Assumes U->static storage
+*
+GOBPtr  pshs    D
+        lda     #OBSIZE         ;(size of option packet for each drive)
+        mul
+        leay    OBSTART,U
+        leay    D,Y             ;Point to options for correct drive
+        puls    D,PC
+
+    endc
+
+*
+*   end of hdmath.src
+*
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/hdutil3.src	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,207 @@
+*   COPYRIGHT BURKE & BURKE 1987
+*   ALL RIGHTS RESERVED
+*
+*   COCO XT UTILITY ROUTINES
+*
+*   Date        Who     Description
+*   --------    ---     ---------------------------------
+*   08-14-87    CJB     Added modification history.
+*                       Added assembly switch for controller
+*                        in slot 1.
+*
+*   10-26-87    CJB     Added conditional assembly to leave
+*                       interrupts enabled if IRQFLG zero.
+*
+*   11-20-87    CJB     Fixed IRQ DISABLE bug (uses switch IRQFLG)
+*                       Added work-around for F$SLEEP bug (GRFDRV ONLY)
+*
+*   12-20-87    CJB     Added routine to sleep or delay while waiting
+*                       for disk seeks (SNOOZE)
+*
+*   01/28/88    CJB     Added improved slot switching and slot
+*                       independence.  Slot # in PD.DNS
+*
+*   02/08/88    CJB     Added SAVSLT for improved read cache performance
+*   05/18/88    cjb     Added CLR V.WAKE,U in SLOT4 routine
+*   07/14/91    cjb     Rev. 2.5 added support for fast recalibration
+*
+
+ page
+*
+*   Select HD controller slot SPARESEL in multi-Pak.
+*
+*   Enter w/ Reg-U -> static storage,
+*   Reg-Y -> path descriptor
+*
+*   The active ROM/CART slot is preserved.
+*
+*   This routine is normally called with interrupts enabled.
+*   It disables them if IRQFLG is 1, for use on L1, V1
+*   systems.
+*
+*   Note that this routine does *NOT* set the DMA semaphore.
+*   This is only done once, at the very beginning of each command.
+*
+SLOT3   equ     *
+
+    ifeq    IRQFLG              ;If level 2, or version 2 of level 1
+        pshs    CC              ;Save entry CC
+    endc
+
+        orcc    #$50        ;No interrupts during MPAK update
+
+        bsr     SavSlt          ;Save old slot #, get to A
+        anda    #%11110000
+        ora     PD.DNS,Y        ;Use device's slot #
+        sta     >MPAK
+
+    ifeq    IRQFLG              ;If level 2, or version 2 of level 1
+        puls    CC,PC           ; restore entry CC
+    else
+        rts                     ; exit with interrupts disabled
+    endc
+
+*   Utility to save old slot
+*   Preserves B:X
+
+SavSlt  lda     >MPAK
+        sta     OldSlt,U
+        rts
+
+*
+*   Restore original slot SPARESEL in multi-PAK.
+*
+*   Enter w/ Reg-U -> static storage
+*
+*   This routine preserves carry and B, since it is called
+*   before returning an error code.
+*
+*   The active ROM slot and CART interrupt is also preserved.
+*
+*   This routine is always called with interrupts disabled.
+*   (or with interrupts enabled and SLOT4 selected already)
+*   It always enables interrupts.
+*
+*   Note that this routine does *NOT* clear the DMA semaphore
+*   unless entered at Release.  This is only done once, at 
+*   the very end of each command.
+*
+Release orcc    #$50            ;Force no interrupts during updates
+
+        lda     #0              ;preserve carry
+*        sta     >D.DMAReq       ;clear "DMA in use" semaphore
+        sta     >DMASEM         ;Zero OS9 level-dependent semaphore
+
+SLOT4   orcc    #$50            ;Force no interrupts during update
+
+        lda     OLDSLT,U        ;Recover old slot
+        sta     >MPAK
+        lda     #0              ;Preserve carry
+        sta     V.WAKE,U        ;Free anyone waiting on us.
+
+        andcc   #$AF            ;Enable interrupts
+        rts
+
+*
+*   Wait for end of other processes disk I/O.  This is
+*   indicated by semaphore $6A = 0.  Grab semaphore
+*   as soon as it frees up.
+*
+*   Assumes slot 3 is selected at entry, and interrupts
+*   are enabled.
+*
+*   Always exits with slot 3 selected and interrupts disabled.
+*
+Semfor  pshs    U,X,Y,B,A,CC
+
+*  Wait for semaphore loop . . .
+Sem0    orcc    #$50            ;No interrupts!
+
+        tst     >DMASEM         ;Check OS9 level-dependent semaphore
+*        tst     >D.DMAReq       ;Check semaphore
+         bne    W6.SLP
+
+*  Semaphore is free.  Grab it.
+
+        dec     >DMASEM         ;Grab OS9 level-dependent semaphore
+*        dec     >D.DMAReq       ;Grab semaphore!
+        puls    CC,A,B,Y,X,U    ;restore interrupts, etc
+        bra     Slot3           ; and select hard disk controller
+
+*
+*   Routine to waste time during disk seeks, etc.
+*
+*   On systems that support D.DMAReq, we set the slot to 4 and
+*   give up the processor.  Otherwise, we return immediately.
+*
+Snooze  pshs    U,Y,X,D
+
+    ifeq    IRQFLG              ;If D.DMAReq,
+        bsr     TikNap          ; surrender slot and processor
+        bsr     Slot3           ; map controller in again
+    endc
+
+        puls    D,X,Y,U,PC
+
+*  Semaphore is busy.  Sleep a bit.
+W6.SLP  bsr     TikNap          ;Surrender the processor
+        bra     Sem0
+
+*
+*   Force slot 4, enable interrupts,
+*   Sleep for the rest of this tick.
+*
+TikNap  pshs    X               ;Save entry X
+        bsr     Slot4           ;Select slot 4, enable interrupts
+
+    ifne    (XLEVEL-1)      ;If Level 2,
+        ldx     <D.SYSPRC
+        cmpx    <DPROC
+         beq    TikXit          ;WORKAROUND -- IF LOADING GRFDRV, NO SLEEP!
+    endc
+
+        ldx     #1
+        OS9     F$Sleep         ;Give up the rest of this tick
+
+TikXit  puls    X,PC
+
+ page
+*
+*  Perform a SEEK command
+*
+SEEK    lda     #WX$SIK    ;Construct "SEEK" command
+        lbsr    CmExec
+        rts 
+
+*
+*  Seek to track 0
+*
+SEEKT0  tst     PD.STP,Y
+         bpl    ST0A
+
+*   Here for drives that don't need recalibration
+*   Just return immediately.
+
+        clrb
+        rts
+
+*   Here for drives that need it
+
+ST0A    lda     #WX$TK0      ;Create "RECALIBRATE" command
+        lbsr    CmExec
+         bcs ST0XIT
+
+    ifne    (Drives-1)
+        ldx     actdrv,u   ;Clear track number in active drive table
+        clr     V.TRAK,x
+        clr     V.TRAK+1,x
+    else
+        clr     DRVTBL+V.TRAK,U
+        clr     DRVTBL+V.TRAK+1,U
+    endc
+
+ST0XIT  rts
+
+*
+*   end of hdutil3.src
+*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/hdvars.src	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,120 @@
+*  COPYRIGHT 1987 BURKE & BURKE
+*  COPYRIGHT 1992 BURKE & BURKE
+*  ALL RIGHTS RESERVED
+*
+*  Variables for all CoCo XT hard disk drivers.
+*
+*  Chris Burke  Schaumburg, IL
+*
+*   Modification History
+*   --------------------
+*
+*   Date        Who     Description
+*   --------    ---     ---------------------------------------
+*   10/01/87    CJB     Added PCCYL variable.
+*                       Added unique drive parameters for each drive
+*   12/20/87    CJB     Added park track copied from DD for each drive
+*   12/23/87    CJB     Added level-dependent equates for use w/ 2 drives.
+*   01/28/88    CJB     Added area to preserve active slot 100%
+*   02/08/88    CJB     Eliminated DIVA, DIVY; changed read cache
+*   04/15/92    CJB     Added RETRYEN (should have been there already!?)
+*
+
+*
+*  Static Storage
+*
+    org     XDrvBeg             ;(level dependent)
+
+*   The controller handles up to 2 drives.
+*   The size of the drive table differs between 
+*   level 1 and level 2.
+
+DRVTBL  rmb     XDrvMen*Drives
+
+    ifne    (Drives-1)          ;If 2 drives,
+ACTDRV  rmb     2
+PRVDRV  rmb     1               ;Previous drive #
+    endc
+
+DRVSEM  rmb     1               ;New drive semaphore
+
+*  Register image for disk controller
+*
+*  SDHREG  00D0HHHH
+*  HICYL   MM0SSSSS
+*  LOWCYL  LLLLLLLL
+*  SECCNT  NNNNNNNN
+*
+*  D = drive #
+*  H = head #
+*  M = MSB's of cylinder #
+*  S = sector # on cylinder
+*  L = LSB's of cylinder #
+*  N = sector count or interleave
+
+IMAGE equ .
+
+SDHREG  RMB     1       ;Drive and head number
+HICYL   RMB     1       ;High cylinder # and sector number
+LOWCYL  RMB     1       ;Low cylinder number
+SECCNT  RMB     1       ;Sector count (interleave factor for format)
+OPTION  RMB     1       ;Options / step rate
+
+    ifne    cchflg      ;If read cache supported,
+
+*  Sector number for pre-read
+
+OLDLSN  rmb     3       ;Old LSN -- this + 1 in buffer if BFRFLG
+BFRFLG  rmb     1       ;$FF = pre-read sector is in verify buffer
+
+    endc
+
+*  Miscellaneous flags
+
+Temp    rmb     2    ;Scratch variable
+SECNUM  rmb     1    ;Used for sector splitting
+PSECNM  rmb     1    ;Previous sector number (used for pre-read feature)
+OLDSLT  rmb     1       ;Old MPAK slot # (to leave it as we found it)
+
+*   Variables for park track location and pre-comp.
+
+OBSTART equ     .   ;Base of option variables
+
+*   Drive #0 variables
+
+PCCYL   rmb     1   ;precomp cylinder / 4
+PRKLSN  rmb     3   ;Park LSN -- sector 0, head 0 of park track
+
+OBSIZE  equ     (.-OBSTART)
+
+     ifne    (Drives-1)
+
+*   Drive #1 variables
+
+PCCYL1  rmb     1   ;precomp cylinder / 4
+PRKLSN1 rmb     3
+
+     endc
+
+*   Value of stack pointer, in case we have to recover from an
+*   error.  This is used by CMEXEC and it's subroutines.
+
+AbtStk  rmb     2   ;Saved stack pointer
+RetryEn rmb     1   ;non-zero if hard disk hardware retries are enabled
+ErrHCyl rmb     2   ;store clyinder number of formatting error here
+
+*   Sector buffer for read caching, write verification,
+*   and pre-reading of adjacent "write" sectors.
+*
+*   Note that this buffer is shared between both drives, so
+*   the read cache is invalidated by switching drives.
+
+VRFBUF  rmb     256
+VB.END  equ     .
+
+*   Reserve some room for the stack
+
+        rmb     128         ;Stack
+
+endmem equ .
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/makefile	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,15 @@
+include ../../../Makefile.rules
+
+DEPENDS		= ./Makefile
+DRVRS		= bb1fhdisk.dr bb1hd.dr bb1hdisk.dr bb1th.dr bb1thdisk.dr \
+		bbhd.dr bbxfhdisk.dr bbxhdisk.dr \
+		bbxthd.dr bkfhdisk.dr bbfhdisk.dr bbhdisk.dr
+DESCS		=
+
+ALLOBJS		= $(DRVRS) $(DESCS)
+
+all:	$(ALLOBJS) $(DEPENDS)
+
+clean:
+	$(RM) $(ALLOBJS)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/wx2.equ	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,63 @@
+    opt -l
+*
+*   Hardware equates for Western Digital WX1 and WX2 controllers
+*
+*   Revised 4/21/88
+*
+
+*  Disk Controller Addresses
+HDDATA equ $FF50    ;read or write data here
+HDSTAT equ $FF51    ;read status here
+HDCONF equ $FF52    ;read parallel input lines here
+
+HDRSET equ $FF51    ;write here to reset controller
+HDATTN equ $FF52    ;write here to get controller's attention
+HDMASK equ $FF53    ;write here to control DMA and IRQ (both off)
+
+*  Command op-codes
+WX$TST  equ     0       ;Test drive ready
+WX$TK0  equ     1       ;Recalibrate to track 0
+WX$STS  equ     3       ;Status of last operation
+WX$FMT  equ     4       ;Format drive
+WX$VFY  equ     5       ;Verify sectors
+WX$FTK  equ     6       ;Format track
+WX$FBT  equ     7       ;Format bad track
+WX$RDD  equ     8       ;Read sector(s)
+WX$WRT  equ     $0A     ;Write sector(s)
+WX$SIK  equ     $0B     ;Seek
+WX$INI  equ     $0C     ;Initialize drive parameters
+WX$ECC  equ     $0D     ;Read ECC burst length
+WX$RBF  equ     $0E     ;Read sector buffer
+WX$WBF  equ     $0F     ;Write sector buffer
+
+WX$SBD  equ     $E0     ;Sector buffer diagnostic
+WX$DRD  equ     $E3     ;Drive diagnostic
+WX$CTD  equ     $E4     ;Controller diagnostic
+
+WX$RDL  equ     $E5     ;Read long
+WX$WRL  equ     $E6     ;Write long
+
+*   Bogus "special init" command
+
+WX$XIN  equ     $FF     ;Init w/ special parameters
+
+*   Error codes
+WE$AOK  equ     $00     ;No error
+WE$NSC  equ     $02     ;"Seek complete" not received
+WE$WRF  equ     $03     ;Write fault
+WE$NRD  equ     $04     ;Drive not ready
+WE$NT0  equ     $06     ;Track 0 not found
+WE$DSS  equ     $08     ;Drive still seeking
+WE$UER  equ     $11     ;Uncorrectable data error
+WE$DAM  equ     $12     ;Data address mark not found
+WE$SIK  equ     $15     ;Seek error
+WE$CER  equ     $18     ;Correctable data error occured
+WE$BTK  equ     $19     ;Track is flagged as bad
+WE$CMD  equ     $20     ;Invalid command
+WE$ISA  equ     $21     ;Illegal sector address
+WE$SBF  equ     $30     ;Sector buffer diagnostic failed
+WE$ROM  equ     $31     ;Controller ROM checksum error
+WE$ECC  equ     $32     ;ECC polynomial hardware failure
+
+    opt l
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/drivers/burke/xtos9.src	Wed Jul 03 03:41:59 2002 +0000
@@ -0,0 +1,953 @@
+*******************************************
+***                                     ***
+***     COPYRIGHT 1990 BURKE & BURKE    ***
+***     ALL RIGHTS RESERVED             ***
+***                                     ***
+***     COPYRIGHT 1992 BURKE & BURKE    ***
+***     ALL RIGHTS RESERVED             ***
+***                                     ***
+*******************************************
+
+*
+*  CoCo XT Hard Disk Driver  Version 2.0
+*
+*  For Western Digital WD1002-WX1 (or 27X) Controller.
+*
+*  The controller can only handle 512 bytes per sector,
+*  so these routines must synthesize 2 logical 256 byte
+*  sectors from each physical 512 byte sector.  This
+*  increases the time it takes to read or write a sector.
+*
+*  To counteract this, the 2nd half of each "even" sector
+*  is retained during a read.  If the next read accesses the
+*  "odd" half, the sector contents is read from the "verify"
+*  buffer instead of the hard disk.
+*
+*  This version can be optimized for a single ST-225 hard disk,
+*  via conditional assembly.  Several other parameters can also
+*  be controlled by conditional assembly.
+*
+*  Conditional assembly control:
+*
+*   Drives              ;Number of drives supported (1-2)
+*
+*   irqflg              ;non-zero to mask IRQ during disk access.
+*   fmtflg              ;non-zero if hard formatting supported
+*   fstflg              ;non-zero if fast transfers supported
+*   cchflg              ;non-zero if read cache supported
+*   vrfflg              ;non-zero if write verification supported
+*   tboflg              ;non-zero if jump to 2 MHz for block moves
+*   errflg              ;non-zero for good error messages
+*   icdflg              ;non-zero to ignore C/D status bit
+*   trsflg              ;non-zero if optimized for 32 SPT, 4 hd disks
+*   sysram              ;non-zero to use system RAM for verf buffer
+*   sizflg              ;non-zero if drives may be different sizes
+*
+*   XLEVEL              ;Special level 2 flag -- to use L1 assembler
+*
+*  Chris Burke  Schaumburg, IL  10/14/87
+*
+*   Modification History
+*   --------------------
+*
+*   Date        Who     Description
+*   --------    ---     -------------------------------------
+*   11/20/87    CJB     Fixed bug in PARK.
+*   12/23/87    CJB     Corrected table size and location
+*                       equates for L2 compatibility.  
+*                       Deleted support for Level 1, Version 
+*                       1.X OS9.
+*   12/27/87    CJB     Added code to grab parameters from
+*                       device descriptor if not obtained
+*                       by INIT.
+*   01/28/88    CJB     Added support for any slot.
+*   02/07/88    CJB     Changed FORMAT to reset drive parameters
+*                       Added speedy read cache algorithm.
+*                       Eliminated DIVA, DIVY, etc.
+*   02/23/88    CJB     Recoded for TRSFLG
+*   03/03/88    CJB     Changed module names to BBhdisk etc.
+*   04/17/88    cjb     Modified INIT to call WaitIdl before
+*                        shutting off controller interrupts & DMA
+*                       Fixed bugs in INIT which confused path
+*                        descriptor and device descriptor pointers
+*   04/21/88    cjb     Added code to disable I/O retries after
+*                        formatting hard drive.
+*   06/12/88    cjb     Changed to call WaitId2 instead of WaitIdl
+*   07/01/88    cjb     Changed revision from 2 to 3
+*   10/10/88    cjb     Modified for format error recovery
+*   05/18/90    cjb     Modified copyright
+*                       Added support for up to 4 drives
+*   07/07/91    cjb     Rev 2.5 (allow disabling of recalibration)
+*   04/15/92    cjb     Rev 2.6 (speed-ups, bug fix for DBLRDD)
+*
+
+ page
+*
+*  Equates
+*
+
+ ifp1
+        use     defsfile
+        use     wx2.equ
+ endc
+
+*  Index into device descriptor (using PD.XXX)
+
+DD.BASE equ M$DTYP-PD.OPT
+DD.HDSK equ $25              ;Start of extra hard disk stuff
+
+*  Multi-PAK Addresses
+MPAK equ $FF7F
+
+*
+*   Bogus equates for Level 2
+*
+
+D.DMARq2    equ     $008A       ;Bogus Level 2 D.DMAReq
+D.PROC2     equ     $0050       ;Bogus Level 2 D.PROC
+DRVMEM2     equ     $26         ;Level 2 drive table size
+DRVBEG2     equ     $0F         ;Level 2 start of drive tables
+
+*
+*   Bogus equates for Level 1
+*
+
+D.DMARq1    equ     $006A       ;Bogus Level 1 D.DMAReq
+D.PROC1     equ     $004B       ;Bogus Level 1 D.PROC
+DRVMEM1     equ     $18         ;Level 1 drive table size
+DRVBEG1     equ     $07         ;Level 1 start of drive tables
+
+    ifne    XLEVEL-1
+DMASEM  set     D.DMARq2        ;Level 2 DMA stuff (multi-pak)
+DPROC   set     D.PROC2         ;Level 2 process control stuff
+XDrvBeg set     DRVBEG2
+XDrvMen set     DRVMEM2
+
+    else
+DMASEM  set     D.DMARq1        ;Level 1 DMA stuff (multi-pak)
+DPROC   set     D.PROC1         ;Level 1 process control stuff
+XDrvBeg set     DRVBEG1
+XDrvMen set     DRVMEM1
+    endc
+
+ page
+*
+*   Module Header
+*
+verson  equ     2
+        mod     cchend,cchnam,drivr+objct,reent+verson,JmpTbl,endmem
+        fcb     DIR.+SHARE.+PEXEC.+PREAD.+PWRIT.+EXEC.+READ.+WRITE.
+
+*  Dynamic module name generation
+
+cchnam  equ     *
+
+    ifeq  testing
+        fcc     "BB"        ; (normal name)
+    else
+        fcc     "BK"        ; (special name)
+    endc
+
+    ifeq    (XLEVEL-1)      ;If level 1,
+        ifne    irqflg      ;If Level 1, Version 1 OS9
+            fcc /X/
+        else                ;If Level 1, Version 2 OS9
+            fcc /1/
+        endc
+    endc
+
+    ifne    fmtflg          ;If this driver can format hard disk,
+        fcc     /F/
+    endc
+
+    ifne    tboflg          ;If 2MHz transfers supported,
+        fcc     /T/
+    endc
+
+    ifne    trsflg          ;If "terse" version
+        fcs     /hd/        ;NOTE -- set MSB of last byte
+    else                    ;If "normal" version
+        fcs     /hdisk/     ;NOTE -- set MSB of last byte
+    endc
+
+        fcb     $06         ;revision - 2.6
+
+*   Copyright notice
+
+        fcc     /COPR. 1992 BURKE & BURKE/
+
+ page
+*
+*  Static Storage
+*
+
+    use     hdvars.src
+
+ page
+*
+*  Jump table
+*
+JmpTbl  lbra    INIT
+        lbra    READ
+        lbra    WRITE
+        lbra    GETSTA
+        lbra    SETSTA
+        lbra    TERM
+
+    ifne    sizflg              ;If drives may be different sizes,
+    page
+*
+*   Post-initialization for drives.
+*
+*   If we ever call a driver routine (other than INIT)
+*   with PARK LSN = 0, we know this drive has not been
+*   initialized.
+*
+*   Enter w/ Reg-Y = path descriptor pointer,
+*            Reg-U = static storage
+*
+*   Must save A and B:X as well as Y, U.
+*
+*   Returns carry set if error initializing drive
+*
+PostIni pshs    Y,X,D
+
+        ldb     PD.DRV,Y
+        lbsr    GOBPtr              ;Point Y to extra variables
+        clrb                        ;Force no carry (success)
+        ldb     (PRKLSN-OBSTART+0),Y
+        orb     (PRKLSN-OBSTART+1),Y
+         bne    PSTI0               ; (branch if OK)
+
+*   Perform drive info and controller intialization
+
+        ldy     4,S                 ;Get path pointer
+        ldy     PD.DEV,Y            ; get device table pointer
+        ldy     V$DESC,Y            ;  get device descriptor pointer
+        lbsr    CtlInit             ;Call routine to init. controller
+
+*   Done initiailizing this drive.
+
+PSTI0   puls  D,X,Y,PC
+
+    endc
+
+ page
+*
+*   Initialize driver routines
+*
+*   Reg-Y points to device descriptor
+*
+INIT    pshs    y
+
+*   This section calls routines that expect a *PATH* descriptor
+*   pointer in Reg-Y
+
+        leay    DD.BASE,Y   ;Make Y look like path descriptor to get slot
+
+        lbsr    Semfor      ;Wait, then select HD controller.
+        sta     >HDRSET     ;Reset controller
+        lbsr    WaitId2     ;Sleep -- wait for controller to reset
+*** Extra call to give WD1004 time to reset
+        lbsr    WaitId2     ;Sleep -- wait for controller to reset
+*** ENDK
+        ldy     ,S          ;Restore y -> device descriptor
+
+*   Set up controller for non-interrupt, non-DMA operation
+
+        clr     >HDMASK     ;Turn off controller interrupts and DMA
+
+*   Set # of drives we can handle
+
+        lda     #Drives
+        sta     V.NDRV,U
+
+*   Set up drive switching info
+
+    ifne    (Drives-1)
+        ldd     #$FFFF
+        std     prvdrv,u    ; (set PRVDRV unknown, DRVSEM for new drive)
+        std     actdrv,u    ;Pointer to active drive table
+    else
+        lda     #$FF
+        sta     DRVSEM,U
+    endc
+
+*   Enable hardware I/O retries.  These will be disabled by a FORMAT
+*   setstat, and will be re-enabled by an INIT call or a reboot.
+*   The main use of this is to disable retries during disk formatting.
+
+        clr     RetryEn,U   ;Enable hardware retries
+
+*   Program controller w/ drive parameters.  
+*   Y points to device descriptor.
+
+        bsr     CtlInit     ; (also clears BFRFLG,U and changes Y)
+         bcs    INIT9       ; (abort if error)
+
+*  Initialize the drive tables for all drives
+
+        ldd     #(-1)               ;Current track is unknown
+        stb     XDrvBeg+V.TRAK,U
+        std     XDrvBeg+DD.TOT,U    ;Set total sectors non-zero to allow LSN0
+    ifne    (Drives-1)
+        stb     XDrvBeg+XDrvMen*1+V.TRAK,U    ; (do all drives)
+        std     XDrvBeg+XDrvMen*1+DD.TOT,U
+      ifge  (Drives-3)
+        stb     XDrvBeg+XDrvMen*2+V.TRAK,U    ; (do all drives)
+        std     XDrvBeg+XDrvMen*2+DD.TOT,U
+      endc
+      ifge  (Drives-4)
+        stb     XDrvBeg+XDrvMen*3+V.TRAK,U    ; (do all drives)
+        std     XDrvBeg+XDrvMen*3+DD.TOT,U
+      endc
+    endc
+
+*   Reg-Y points to bogus path descriptor (courtesy of CtlInit).
+*   Wait for drive to be ready.  
+*
+*   Note that WaiDrv returns Reg-B=0 and carry clear to OK, 
+*   else reg-B = E$NotRdy and carry set.
+
+        bsr     WaiDrv          ;Note:  WaiDrv requires *PATH* descriptor
+
+*  Error hook
+INIT9   puls    Y               ;restore saved Y register (DD pointer)
+        bra     HDXIT
+
+*  Generic error-free exit
+OKXIT   clrb 
+
+*
+*  Generic exit.  Restore MULTI-PAK to
+*  slot #4 so floppy disk works, and release semaphore
+*
+*   Preserves CC and B
+*
+*   RELEASE also clears the V.WAKE flag.
+*
+HDXIT   lbsr    Release
+        rts 
+
+*
+*   Wait for drive ready
+*   Assumes reg-Y points to real or bogus path
+*   descriptor (for drive # and step rate)
+*
+WaiDrv  pshs    y,x,a,b
+
+        clr     ,-s                 ;Time out
+
+WaiDr2  lda     #WX$TST     ;Test drive ready
+
+    ifne    (Drives-1)              ;If more than 1 drive
+        ldb     PD.DRV,Y            ;get drive #
+    endc
+
+        lbsr    DrvCmd
+         bcc    WaiDr3              ; (branch if drive ready)
+
+        dec     ,s                  ;Decrement timeout
+         beq    WaiDr4              ; (branch if timeout)
+
+        lbsr    Snooze              ;Give drive some time
+        bra     WaiDr2              ; then retry.
+
+*   Timeout
+
+WaiDr4  comb
+        ldb     #E$NotRdy           ;Drive not ready
+        stb     1+1,S
+
+*   Carry clear if ready, else carry set
+
+WaiDr3  leas    1,S                 ;Discard counter
+        puls    a,b,x,y,pc
+
+*
+*   Get extra bytes from this drive's descriptor.
+*   Send them to the controller.  
+*
+*   Enter w/ 
+*   Reg-Y = Dev Desc pointer, and 
+*   Reg-U = static storage pointer.
+*
+*   Note that if there is a 2nd drive with different
+*   parameters, they must be obtained in a different
+*   manner.
+*
+*   Modifies Reg-Y to make it look like a bogus *PATH*
+*   descriptor
+*
+
+CtlInit equ     *
+
+    ifne    cchflg              ;If read cache,
+        clr     BFRFLG,U            ;Buffer contents invalid
+    endc
+
+        bsr     GetXtra             ;Call subroutine DDPTR in Y.
+
+*   Send drive parameters to controller.  Reg-Y points to device
+*   descriptor, but we adjust it to look like a path descriptor.
+
+        leay    DD.BASE,Y           ;Make Y look like path descriptor
+
+        lda     #WX$INI             ;Command to send drive parameters
+
+    ifne    (Drives-1)              ;If more than 1 drive
+        ldb     PD.DRV,Y            ;get drive #
+    endc
+
+        lbsr    DrvCmd              ;Set up drive parameters
+        rts
+
+    page
+*
+*   Copy precomp cylinder and park LSN from descriptor 
+*   (also gives max. tracks!)
+*
+
+GetXtra ldd     DD.HDSK+(PCCYL-OBSTART),Y       ;get prec, MSB of park LSN
+        ldx     DD.HDSK+(PRKLSN+1-OBSTART),Y    ;get rest of park LSN
+     ifne   (Drives-1)          ; If 2 drives,
+      ifne  sizflg              ;  of different sizes,
+        pshs    Y,X,D
+        ldb     DD.BASE+PD.DRV,Y    ;get drive #
+        lbsr    GOBPtr              ;get dest. pointer to Y
+        puls    D,X
+        std     (PCCYL-OBSTART),Y
+        stx     (PRKLSN+1-OBSTART),Y
+        puls    Y,PC                ;Recover DD ptr and exit
+      else                      ;  of same size,
+        std     PCCYL,U
+        stx     (PRKLSN+1),U        ;set up both tables at once
+        std     (PCCYL+OBSIZE),U
+        stx     (PRKLSN+1+OBSIZE),U
+        rts
+      endc
+     else                       ; If 1 drive,
+        std     PCCYL,U
+        stx     (PRKLSN+1),U
+        rts
+     endc
+
+    page
+*
+*   Terminate hard disk processing
+*
+TERM    lbsr    Semfor      ;Wait on semaphore, select controller
+        bra     OKXIT       ;Clear semaphore and successful exit
+
+*
+*  Dummy routine for GETSTA
+*
+GETSTA  comb                ;Set carry
+        ldb     #E$UnkSVC
+        rts 
+
+ page
+*
+*   Read a sector from disk
+*
+*   LSN in B:X.  If it is 1+OLDLSN,
+*   and the drive # is right, and the
+*   read cache is full, don't even bother
+*   doing address computations
+*
+*   There are always an even number of sectors
+*   per track, so if the new LSN is the old LSN
+*   with MSB set, we have a winner!  We always
+*   store the old LSN with MSB set.
+*
+
+READ    equ     *
+
+    ifne    cchflg      ;If read cache,
+
+        pshs    X,B         ;Save LSN
+        lbsr    SavSlt      ;Save old slot #, but don't change yet
+
+        tst     BFRFLG,U    ;Is buffer valid?
+         beq    READXX      ; (branch if no luck)
+     ifne   (Drives-1)
+        lda     PD.DRV,Y
+        cmpa    PRVDRV,U
+         bne    READXX      ; (branch if drive different)
+     endc
+        puls    B,X
+        cmpx    OLDLSN+1,U
+         bne    READXY
+        cmpb    OLDLSN+0,U
+         bne    READXY
+
+*   Use verify buffer for sector data -- no read necessary!
+*   The OLDLSN and PRVDRV variables are already set right.
+
+        pshs    u,y,x
+
+        ldb     #128
+        ldx     PD.BUF,Y        ;Get destination pointer
+        leay    vrfbuf,U        ;Get source pointer
+
+DR0     ldu     ,y++
+        stu     ,x++
+        decb
+         bne    DR0
+
+        puls    x,y,u
+        bra     OKXIT3          ;Successful exit
+
+*   Not a cache read.  Restore LSN
+
+READXX  puls    B,X
+
+*   Save LSN in case we can do a cache read next time.
+*   We always set the LSB of the saved LSN; the BFRFLG
+*   will be set only if the actual LSB is 0!
+
+READXY  clr     BFRFLG,U        ;Assume future cache read invalid
+        stb     OLDLSN+0,U      ;Save LSN for next time
+
+        pshs    B
+        tfr     X,D
+        bitb    #%00000001      ;If LSB is 0, cache read valid next time
+         bne    READXZ
+
+        com     BFRFLG,U        ; (cache read next time)
+
+READXZ  orb     #%00000001      ; (always set LSB in possible match)
+        std     OLDLSN+1,U
+        puls    B
+
+    endc
+
+*   Perform normal read -- LSN in B:X
+
+        lbsr    Semfor      ;Wait, select hard disk controller slot
+
+    ifne    sizflg      ;If drives can be different sizes,
+        lbsr    PostIni
+         bcs    HDXIT3
+    endc
+
+*   Check for LSN0
+
+        cmpx    #0          ;Check for LSN 0 -- SPECIAL
+         bne    NotLS0
+        tstb 
+         bne    NotLS0
+
+**   Wants to read LSN 0.
+**   See if LSN 0 has already been read once.
+**
+**   We must use PD.DTB,Y instead of ACTDRV,U because
+**   SELDRV has not been called yet.
+**
+**   Actually, we still read -- we just don't update
+**   the drive table
+*
+*        pshs    X,B         ;Save LSN
+*    ifne    (Drives-1)          ;If 2 drives,
+*        ldx     PD.DTB,Y    ;Point to drive table
+*    else
+*        leax    DRVTBL,U    ;Point to drive table
+*    endc
+*        ldd     DD.TOT,x    ;Get total sectors
+*        cmpd    #-1         ; -1 is a special value set by INIT routine
+*        puls    B,X         ;Restore LSN (always $000000)
+*         bne    NotLS0      ;If not -1, LSN 0 already read; no special stuff
+
+*   Special treatment for LSN0 -- refresh drive table when done
+
+        bsr     DoRead
+         bcs    HDXIT3
+
+        ldx     PD.BUF,y    ;Get buffer address
+        pshs    Y,X         ;Save old buffer and device descriptor ptrs
+
+*   Note that the SELDRV routine, called by DOREAD, sets up
+*   the drive table pointer in actdrv,U if there are 2 drives.
+
+    ifne    (Drives-1)          ;If 2 drives,
+        ldy     actdrv,u
+    else
+        leay    DRVTBL,U
+    endc
+
+        ldb     #DD.SIZ-1
+
+*  Update drive table from buffer
+
+RCPY1   lda     b,x
+        sta     b,y
+        decb 
+         bpl    RCPY1
+
+        puls    y,x
+        bra     OKXIT3
+
+*  Read (not LSN0)
+
+NotLS0  bsr     DoRead
+HDXIT3   lbcs   HDXIT
+
+OKXIT3  lbra    OKXIT
+
+ page
+*
+*  Utility to read a sector
+*
+DoRead  lbsr    SETUP
+         bcs    DORXIT
+
+*  Entry point for VERIFY
+VrfRdd  ldx     PD.BUF,Y    ;Get buffer address
+
+*  General read sector
+GetSec  lda     #WX$RDD        ;Create "READ SINGLE SECTOR" command
+        lbsr    CMEXEC
+DORXIT  rts 
+
+ page
+*
+*  Write a sector to disk.
+*
+*  This routine must pre-read the sector in order to
+*  pack 2 logical sectors into 1 physical sector.
+*  This invalidates any data that might have been pre-read
+*  into the verify buffer.
+*
+WRITE   lbsr    Semfor      ;Wait, then select HD controller
+
+    ifne    sizflg      ;If drives can be different sizes,
+        lbsr    PostIni
+         bcs    HDXIT3
+    endc
+
+*  Pre-read the "other" half of the sector to the verify buffer
+
+        pshs    X,B        ;Save LSN
+        lbsr    SETUP      ;Set up head, track, sector #'s
+        bsr     flphlf      ;flip LSB of SECNUM
+
+    ifne    cchflg      ;If read cache supported
+        clr     BFRFLG,u    ;2nd half of sector should not be saved
+    endc
+
+        leax    vrfbuf,U    ;Use verify buffer
+        bsr     GetSec      ; (re-use code)
+
+        puls    X,B
+         bcs    HDXIT3      ; branch to abort if pre-read fails
+
+        bsr     flphlf       ;fix up sector #
+
+*  Perform the write.  The "other" half of the physical sector
+*  has been pre-read into the verify buffer.
+
+        pshs    x,b       ;save LSN
+        bsr     DoWrit
+        puls    x,b
+         bcs    HDXIT3
+
+    ifne    vrfflg              ;If verify enabled,
+
+        tst     PD.VFY,Y   ;Verify writes?
+         bne    OKXIT3
+
+*  Verify the write
+        bsr     VERIFY
+         bcc    OKXIT3
+
+*  Verify failed; carry set
+        ldb     #E$Write
+        bra     HDXIT3
+
+    else
+
+        bra    OKXIT3
+
+    endc
+
+*
+*  Flip LSB of SECNUM.  This is used to pre-read the half of the sector
+*  that should not be changed by a write.
+*
+flphlf  lda     secnum,u
+        EORA    #1
+        sta     secnum,u
+        rts
+
+ page
+*
+*  Utility to write a sector
+*
+DoWRIT  lbsr    SETUP
+         bcs    DOWXIT
+
+        ldx     PD.BUF,Y        ;Get buffer pointer
+        lda     #WX$WRT         ;Create "WRITE SINGLE SECTOR" command
+        lbsr    CMEXEC
+
+DOWXIT  rts 
+
+    ifne    vrfflg          ;If verify supported,
+
+*
+*  Verify last sector written
+*
+*  Don't copy unused part of sector to verify buffer
+*
+VERIFY  pshs    x,b,a
+
+        ldx     PD.BUF,y    ;Save buffer pointer
+        pshs    x
+
+        leax    vrfbuf,U
+        stx     PD.BUF,y    ;Force dummy buffer pointer
+        ldx     4,s         ;Recover LSN
+
+        lbsr    setup
+         bcs    VF1
+
+    ifne    cchflg          ;If read cache supported,
+        clr     BFRFLG,u    ;Mark don't save 2nd half of sector
+    endc
+
+        lbsr    VrfRdd     ;Actual read done here
+
+VF1     puls    x
+        stx     PD.BUF,y    ;Restore buffer pointer
+         bcs    VRFXIT
+
+*  Look only at every 8th byte to speed up the verify
+        lda     #(256/8)    ;Iteration count
+        pshs    u,y,a
+
+        leay    vrfbuf,U    ;Point at sector buffer
+        tfr     x,u
+
+*  Compare the data read back to the data written
+VRF1    ldx     ,u
+        cmpx    ,y
+         bne    VRFERR
+
+        leau    8,u         ;next byte
+        leay    8,y
+        dec     ,s
+         bne    VRF1
+
+        bra     VRFOK
+
+*  Error exit
+VRFERR  orcc    #$01
+
+*  Deallocate temporaries
+VRFOK   puls    u,y,a
+
+*  Generic verify exit
+VRFXIT  puls    a,b,x,PC
+
+    endc
+
+ page
+*
+*   Set Status.
+*
+*   Reg-Y has path descriptor, and Reg-A has status code.
+*
+SETSTA  lbsr    Semfor      ;Wait, then select HD controller
+
+    ifne    sizflg      ;If drives can be different sizes,
+        lbsr    PostIni
+         lbcs   HDXIT
+    endc
+
+        lbsr    SELDRV
+
+        ldx     PD.RGS,y    ;Point at register stack
+        ldb     R$B,x       ;Recover service code
+
+        cmpb    #SS.Reset
+         bne    SS1
+
+        lbsr    SEEKT0
+        bra     SSXIT
+
+SS1     equ     *
+
+    ifne    fmtflg              ;If hard formatting supported,
+        cmpb    #SS.WTrk
+         bne    SS2
+
+        bsr     FmtTrk
+        bra     SSXIT
+    endc
+
+SS2     cmpb    #SS.SQD
+         bne    SS9
+
+        bsr     PwrDwn
+        bra     SSXIT
+
+*  Error - unrecognized SETSTA code
+
+SS9     comb 
+        ldb     #E$UnkSvc
+
+*  Generic exit.  Return error if carry set.
+
+SSXIT   lbcs    HDXIT
+        lbra    OKXIT
+
+ page
+*
+*  Power-down (park) disk
+*
+PwrDwn  equ     *
+
+*   Get park LSN to B:X
+
+    ifne    (Drives-1)      ;If 2 drives,
+        lbsr    GtPkLSN         ;Call routine to get park LSN to B:X
+    else
+        ldb     PRKLSN+0,U
+        ldx     PRKLSN+1,U
+    endc
+
+*   Seek to this LSN
+
+PwrDn2  lbsr    SETUP
+        lbsr    SEEK            ;Park head at last track
+        rts 
+
+    ifne    fmtflg          ;If hard format supported
+
+*
+*   Format a track.
+*
+*   Now we format one track at a time.
+*
+*   At entry Reg-X points to the register packet,
+*   and Reg-Y points to the path descriptor
+*
+FmtTrk  lda     #$80            ;Disable hardware retries
+        sta     RetryEn,U
+
+        ldd     R$U,x           ;Get track number -- must be zero.
+        cmpd    #0
+         bne    FMTXIT
+
+        ldd     R$Y,x           ;Check side/density -- MSB must be zero
+        cmpa    #0
+         beq    FMT1
+
+*  Ignore repeated calls, returning success
+FMTXIT  clrb 
+        rts 
+
+*  Perform the format if not write protected
+FMT1    pshs    u,y,x
+
+*  Proceed, disk not write protected
+FMT11   equ     *
+
+*   Set up reduced drive characteristics (only legal tracks)
+
+        lda     #WX$XIN     ;Bogus command to init. special parameters
+        lbsr    CmExec
+         bcs    FMTERR
+
+*  Initialize sector buffer
+
+        lda     #WX$WBF
+        lbsr    CmExec
+         bcs    FMTERR
+
+*   Begin formatting at track 0
+
+        ldd     #$C0FF          ;Set initial cylinder to (-1)
+        std     ERRHCYL,u
+
+*  Set up starting track for format
+
+FMT2    ldd     ERRHCYL,u       ;Use last good cylinder
+        anda    #%11000000
+        incb
+         bne    FMT3
+        adda    #%01000000
+FMT3    std     hicyl,U         ; (set track number, sector 0)
+
+*        clr     lowcyl,u        ;Clear LOWCYL
+*        clr     hicyl,u         ;Clear HICYL (and sector #)
+
+    ifne    (Drives-1)          ;If multiple drives,
+        lda     PD.DRV,Y        ;Set up drive #
+        ldb     #32
+        mul
+        stb     sdhreg,u        ;Select correct drive, clear head number
+    else
+        clr     sdhreg,u
+    endc
+
+        lda     PD.ILV,Y        ;Set interleave factor
+        lsra                    ; / 2 since physical sectors are 2X
+        sta     seccnt,u
+
+        lda     #WX$FMT         ;Command to FORMAT ENTIRE DRIVE
+*        lda     #WX$FTK         ;Command to FORMAT TRACK
+        lbsr    CmExec
+         bcs    FMT2            ;Try next track if error
+
+*   Return error code in B, C set or no error, C clear
+
+FMTERR  pshs    b,cc            ;Stack error status
+
+*   Set up correct drive characteristics (park track allowed)
+
+        lda     #WX$INI     ;Init. original parameters
+        lbsr    CmExec
+
+*   Get back error status
+
+        puls    cc,b
+
+*  End of format routine
+
+FMTEND  puls    x,y,u,PC
+
+    endc
+
+*
+*   End of main line of XTOS9.SRC.
+*   "USE" files follow.
+*
+
+ page
+*
+*   Include routines to issue command to controller
+*   and return completion status.
+*
+
+        use     hdcmd.src
+
+ page
+*
+*   Include routines to translate LSN & drive #
+*   to a controller task file.
+*
+
+        use     hdmath.src
+
+ page
+*
+*   Include utility routines.
+*
+
+        use     hdutil3.src
+
+ emod
+cchend equ *
+
+ end