         IFUND :DCBNUMBER
NDISKDCBS      SET                     NDISKDCBS+PERSCI*WMFORMAT+PERSCI*IBMFORMAT+DAMFLOPPY
NEXTDISKDCB    SET                     *
:DRIVENUMBER   SET                     0
:DCBNUMBER     SET                     0
:DAMFLOPPY     SET                     DAMFLOPPY
:PERSCI        SET                     PERSCI
:HEADCHAIN     SET                     *
:NEXTCHAIN     SET                     0
         IF    PERSCI
:WMFORMAT      SET                     WMFORMAT
:IBMFORMAT     SET                     IBMFORMAT
         FIN   PERSCI
         ELSE
::       SET   *
         ORG   :DCB+DCB:NEXTDCB
         FDB   ::
         ORG   ::
         IF    :NEXTCHAIN
         ORG   :DCB+FDNEXTCHAIN
         FDB   ::
         ORG   ::
         FIN   :NEXTCHAIN
         FIN   :DCBNUMBER
         PAGE
         IF    :DAMFLOPPY
*        DAM Floppy

:BPS     SET   256                     bytes per sector
:SPT     SET   18                      sectors per track
:TPC     SET   1                       tracks per cylinder
:CYL     SET   40                      cylinders
:DATA    SET   0                       don't complement data
:FIRST   SET   0                       first sector
:CONTROLLER    SET                     CCB:DAMFLOPPY
         ELSEIF                        :PERSCI
         IF    :IBMFORMAT
*        IBM Disk

:BPS     SET   128                     bytes per sector
:SPT     SET   26                      sectors per track
:TPC     SET   1                       tracks per cylinder
:CYL     SET   77                      cylinders
:DATA    SET   1                       complement data
:FIRST   SET   1                       first sector
:CONTROLLER    SET                     CCB:PERSCI
         ELSEIF                        :WMFORMAT
*        Wavemate Disk

:BPS     SET   256                     bytes per sector
:SPT     SET   16                      sectors per track
:TPC     SET   1                       tracks per cylinder
:CYL     SET   77                      cylinders
:DATA    SET   0                       don't complement data
:FIRST   SET   0                       first sector
:CONTROLLER    SET                     CCB:PERSCI
         ELSE
         ?ERROR                        No format specified for PerSci Drives
         FIN   :IBMFORMAT
         ELSE
         ?ERROR                        No Drives defined
         FIN   :DAMFLOPPY

*        Device Control Block

:DCB     SET   *
         PCA   1
         RPT   FDSIZE                  clear dcb
         FCB   0
         PCA   0
         ORG   :DCB
         FCB   1
         FDB   0,0,0,FDDRIVER
         FDB   :BPS,:SPT,:TPC,:CYL
         ORG   :DCB+FDDSTATEJ
         JMP   DISKINTUNEXPECTED
         ORG   :DCB+FDDRIVE
         FCB   :DRIVENUMBER,$FF
         ORG   :DCB+FDCOMPLEMENT
         FCB   :DATA,:FIRST
         FDB   :HEADCHAIN,0
         FDB   :CONTROLLER
         ORG   :DCB+FDMAPALG
         FDB   1                      set mapalgorithm intially to 1
         ORG   :DCB+FDMAP
         PCA   1
         RPT   :SPT
         FCB   *-(:DCB+FDMAP)
         PCA   0
::       SET   *
         ORG   :DCB+DCB:NAME
         FDB   ::
         ORG   ::
         IF    :DCBNUMBER>9
         FCB   'D,'0+:DCBNUMBER/10,'0+:DCBNUMBER\10,':,0
         ELSE
         FCB   'D,'0+:DCBNUMBER,':,0
         FIN   :DCBNUMBER>9
         PAGE
:DCBNUMBER     SET                     :DCBNUMBER+1
:DRIVENUMBER   SET                     :DRIVENUMBER+1
         IF    &:NEXTCHAIN
:NEXTCHAIN     SET                     1
         FIN   &:NEXTCHAIN
         IF    :DRIVENUMBER&%10
         IF    :DAMFLOPPY
:DAMFLOPPY     SET                     :DAMFLOPPY-2
         IF    :DAMFLOPPY<1
:DRIVENUMBER   SET                     0
         FIN   :DAMFLOPPY<1
         IF    :NEXTCHAIN
:NEXTCHAIN     SET                     0
         FIN   :NEXTCHAIN
:HEADCHAIN     SET                     *
         ELSEIF                        :PERSCI
         IF    :IBMFORMAT
:IBMFORMAT     SET                     0
         IF    :WMFORMAT
:DRIVENUMBER   SET                     :DRIVENUMBER-2
         ELSE
:PERSCI  SET   :PERSCI-2
         IF    :PERSCI
:IBMFORMAT     SET                     IBMFORMAT
:WMFORMAT      SET                     WMFORMAT
         IF    :NEXTCHAIN
:NEXTCHAIN     SET                     0
         FIN   :NEXTCHAIN
:HEADCHAIN     SET                     *
         FIN   :PERSCI
         FIN   :WMFORMAT
         ELSEIF                        :WMFORMAT
:PERSCI  SET   :PERSCI-2
         IF    :PERSCI
:IBMFORMAT     SET                     IBMFORMAT
:WMFORMAT      SET                     WMFORMAT
         IF    :NEXTCHAIN
:NEXTCHAIN     SET                     0
         FIN   :NEXTCHAIN
:HEADCHAIN     SET                     *
         FIN   :PERSCI
         FIN   :IBMFORMAT
         FIN   :DAMFLOPPY
         FIN   :DRIVENUMBER&%10
         IF    :PERSCI+:DAMFLOPPY
         INCLUDE                       IOVFDDCBS.ASM
         FIN   :PERSCI+:DAMFLOPPY
