{ File: SG4.UTIL3.TEXT
  Contains routines for floppy configuration.


  COPYRIGHT (c) 1983 SAGE Computer Technology
  All Rights Reserved

}


FUNCTION WhatFloppy(Parms:Conf_Floppy):INTEGER;
BEGIN
  WhatFloppy:=D_FCnonstan;
  WITH Parms DO
    IF MFMflag THEN
      BEGIN
	IF (Sides=2) AND (Cylinders=80) AND (SectorsPerTrack=8) AND
	   (NOT IBMflag) AND (NOT NCIflag) THEN WhatFloppy:=D_FCsg1280
	ELSE
	  IF (Sides=2) AND (Cylinders=40) AND (SectorsPerTrack=8)
	     AND (NOT IBMflag) AND (NOT NCIflag) THEN WhatFloppy:=D_FCsg640
	ELSE
	IF (Sides=2) AND (Cylinders=80) AND (SectorsPerTrack=10)
	   AND (NOT IBMflag) AND (NOT NCIflag) THEN WhatFloppy:=DFCsg1600
	ELSE
	IF (Sides=1) AND (Cylinders=40) AND (SectorsPerTrack=8)
	   AND (IBMflag) AND (NOT NCIflag) THEN WhatFloppy:=D_FCibm320
	ELSE
	IF (Sides=2) AND (Cylinders=40) AND (SectorsPerTrack=8)
	   AND (IBMflag) AND (NOT NCIflag) THEN WhatFloppy:=D_FCibm640
	ELSE
	IF (Sides=2) AND (Cylinders=80) AND (SectorsPerTrack=8)
	   AND (IBMflag) AND (NOT NCIflag) THEN WhatFloppy:=D_FCibm1280
	ELSE
	IF (Sides=1) AND (Cylinders=40) AND
	   (SectorsPerTrack=10) AND (IBMflag) AND
	   (NCIflag) THEN WhatFloppy:=D_FCnci400
	ELSE
	IF (Sides=2) AND (Cylinders=40) AND
	   (SectorsPerTrack=10) AND (IBMflag) AND
	   (NCIflag) THEN WhatFloppy:=D_FCnci800
	ELSE
	  IF (Sides=2) AND (Cylinders=80) AND
	     (SectorsPerTrack=10) AND (NOT IBMflag) AND
	     (NCIflag) THEN WhatFloppy:=D_FCnci1600
	ELSE
	IF (Sides=0) THEN WhatFloppy:=D_FCnodrv;
      END;
END;

PROCEDURE FloppyStandard(VAR Parms:Conf_Floppy);

FUNCTION Check40:BOOLEAN;
VAR
  dummy:BOOLEAN;
BEGIN
  WITH Parms DO
    BEGIN
      Check40:=TRUE;
      IF (Cylinders=80) OR DoubleStep THEN
	BEGIN
	  MNU_ClrScreen;
	  IF MNU_YesorNo('Use on an 80 track drive (read only)?') THEN
	    DoubleStep:=True
	  ELSE
	    BEGIN
	      WRITELN;
	      IF MNU_YesorNo('Use on a 40 track drive?') THEN
		DoubleStep:=FALSE
	      ELSE
		BEGIN
		  Check40:=FALSE;
		  WRITE('Sorry, no other options');
		  MNU_Reject:=TRUE;
		END;
	    END;
	END;
    END;
END;

FUNCTION Check80:BOOLEAN;
VAR
  dummy:BOOLEAN;
BEGIN
  Check80:=TRUE;
  WITH Parms DO
    BEGIN
      IF (Cylinders=40) OR (Cylinders=35) THEN
	BEGIN
	 IF DoubleStep THEN DoubleStep:=FALSE
	 ELSE
	  BEGIN
	    MNU_ClrScreen;
	    IF NOT MNU_YesorNo('Use on an 80 track drive?') THEN
	      BEGIN
		WRITE(CHR(7),
			'Cannot access 80 track diskettes from 40 track drive');
		Check80:=FALSE;
		MNU_Reject:=TRUE;
	      END
	  END;
	END;
    END;
END;

BEGIN { FloppyStandard }
  WITH Parms DO
    CASE MNU_ItemNumber OF
      D_FCsg1280:IF Check80 THEN
		   BEGIN { SAGE 80 track }
		     MFMflag:=TRUE;
		     Sides:=2;
		     Cylinders:=80;
		     SectorsPerTrack:=8;
		     IBMflag:=FALSE;
		     NCIflag:=FALSE;
		     BytesPerSector:=512;
		     Gap3:=42;
		     DataLeng:=255;
		     Gap3Format:=80;
		     PatternFormat:=229;
		     Skew:=0;
		   END;
      D_FCsg1600:IF Check80 THEN
		   BEGIN { SAGE 80 track }
		     MFMflag:=TRUE;
		     Sides:=2;
		     Cylinders:=80;
		     SectorsPerTrack:=10;
		     IBMflag:=FALSE;
		     NCIflag:=FALSE;
		     BytesPerSector:=512;
		     Gap3:=24;
		     DataLeng:=255;
		     Gap3Format:=32;
		     PatternFormat:=229;
		     Skew:=2;
		   END;
      D_FCSG640:IF Check40 THEN
		  BEGIN { SAGE 40 track }
		    MFMflag:=TRUE;
		    Sides:=2;
		    Cylinders:=40;
		    SectorsPerTrack:=8;
		    IBMflag:=FALSE;
		    NCIflag:=FALSE;
		    BytesPerSector:=512;
		    Gap3:=42;
		    DataLeng:=255;
		    Gap3Format:=80;
		    PatternFormat:=229;
		    Skew:=0;
		  END;
      D_FCibm320:IF Check40 THEN
		   BEGIN { IBM single side }
		     MFMflag:=TRUE;
		     Sides:=1;
		     Cylinders:=40;
		     SectorsPerTrack:=8;
		     IBMflag:=TRUE;
		     NCIflag:=FALSE;
		     BytesPerSector:=512;
		     Gap3:=42;
		     DataLeng:=255;
		     Gap3Format:=80;
		     PatternFormat:=229;
		     Skew:=0;
		   END;
      D_FCibm640:IF Check40 THEN
		   BEGIN { IBM double side }
		     MFMflag:=TRUE;
		     Sides:=2;
		     Cylinders:=40;
		     SectorsPerTrack:=8;
		     IBMflag:=TRUE;
		     NCIflag:=FALSE;
		     BytesPerSector:=512;
		     Gap3:=42;
		     DataLeng:=255;
		     Gap3Format:=80;
		     PatternFormat:=229;
		     Skew:=0;
		   END;
      D_FCIBM1280:IF Check80 THEN
		   BEGIN { IBM 80 track }
		     MFMflag:=TRUE;
		     Sides:=2;
		     Cylinders:=80;
		     SectorsPerTrack:=8;
		     IBMflag:=TRUE;
		     NCIflag:=FALSE;
		     BytesPerSector:=512;
		     Gap3:=42;
		     DataLeng:=255;
		     Gap3Format:=80;
		     PatternFormat:=229;
		     Skew:=0;
		   END;
      D_FCnci400:IF Check40 THEN
		   BEGIN { NCI single side }
		     MFMflag:=TRUE;
		     Sides:=1;
		     Cylinders:=40;
		     SectorsPerTrack:=10;
		     IBMflag:=TRUE;
		     NCIflag:=TRUE;
		     BytesPerSector:=512;
		     Gap3:=24;
		     DataLeng:=255;
		     Gap3Format:=32;
		     PatternFormat:=229;
		     Skew:=2;
		   END;
      D_FCnci800:IF Check40 THEN
		   BEGIN { NCI double side }
		     MFMflag:=TRUE;
		     Sides:=2;
		     Cylinders:=40;
		     SectorsPerTrack:=10;
		     IBMflag:=TRUE;
		     NCIflag:=TRUE;
		     BytesPerSector:=512;
		     Gap3:=24;
		     DataLeng:=255;
		     Gap3Format:=32;
		     PatternFormat:=229;
		     Skew:=2;
		   END;
      D_FCnci1600:IF Check80 THEN
		    BEGIN { NCI double side, 80 track }
		      MFMflag:=TRUE;
		      Sides:=2;
		      Cylinders:=80;
		      SectorsPerTrack:=10;
		      IBMflag:=FALSE;
		      NCIflag:=TRUE;
		      BytesPerSector:=512;
		      Gap3:=24;
		      DataLeng:=255;
		      Gap3Format:=32;
		      PatternFormat:=229;
		      Skew:=2;
		    END;
      D_FCuniv:BEGIN {Softech Universal Medium }
		 MNU_Error;
		 WRITE('Illegal selection');
		 MNU_Reject:=TRUE;
	       END;
       D_FCnodrv:BEGIN	{No drive}
		   Sides:=0;
		 END;
       D_FCnonstan:BEGIN
		     MNU_Error;
		     WRITE('Use Low Level Change Menu');
		     MNU_Reject:=TRUE;
		   END;
    END;
END;

                                                                                                                                                                                                                                                                                                                                                                                                                                                 