Hi, I found another patch on my disk which probably has not
been applied to the stable kernel yet - please have a look
and comment :-)

- handle unusual floppy types
- change some initdisk messages
- re-enable DF_NOACCESS flag (correctly, I hope?)
- change InitializeAllBPBs to avoid "FAT16 FAT32 ambiguity"

Eric


Index: kernel/initdisk.c
===================================================================
--- kernel/initdisk.c	(Revision 1389)
+++ kernel/initdisk.c	(Arbeitskopie)
@@ -318,7 +318,7 @@
   type = regs.b.b.l - 1;
   if (regs.flags & 1)
     type = 0;                   /* return 320-360 for XTs */
-  else if (type > 6)
+  else if (type >= 6)
     type = 8;                   /* any odd ball drives get 8&7=0: the 320-360 table */
   else if (type == 5)
     type = 4;                   /* 5 and 4 are both 2.88 MB */
@@ -592,7 +592,7 @@
 
   if (nUnits >= NDEV)
   {
-    printf("more Partitions detected then possible, max = %d\n", NDEV);
+    printf("more Partitions detected than possible, max = %d\n", NDEV);
     return;                     /* we are done */
   }
 
@@ -734,7 +734,7 @@
       lba_bios_parameters.sectors > 0xffff ||
       lba_bios_parameters.totalSectHigh != 0)
   {
-    printf("Drive is too large to handle, using only 1st 8 GB\n"
+    printf("LBA drive properties implausible, using only 1st 8 GB\n"
            " drive %02x heads %lu sectors %lu , total=0x%lx-%08lx\n",
            drive,
            (ULONG) lba_bios_parameters.heads,
@@ -1286,7 +1286,7 @@
   pddt->ddt_driveno = driveno;
   pddt->ddt_type = init_getdriveparm(driveno, &pddt->ddt_defbpb);
   pddt->ddt_ncyl = (pddt->ddt_type & 7) ? 80 : 40;
-  pddt->ddt_descflags = init_readdasd(driveno) | flags;
+  pddt->ddt_descflags = init_readdasd(driveno) | flags | DF_DISKCHANGE | DF_NOACCESS;
 
   pddt->ddt_offset = 0;
   pddt->ddt_serialno = 0x12345678l;
Index: kernel/dsk.c
===================================================================
--- kernel/dsk.c	(Revision 1389)
+++ kernel/dsk.c	(Arbeitskopie)
@@ -374,8 +374,8 @@
   unsigned secs_per_cyl;
   WORD ret;
 
-  /* pddt->ddt_descflags |= DF_NOACCESS; 
-   * disabled for now - problems with FORMAT ?? */
+  pddt->ddt_descflags |= DF_NOACCESS;
+  /* was disabled - problems with FORMAT ?? */
 
   /* set drive to not accessible and changed */
   if (diskchange(pddt) != M_NOT_CHANGED)
Index: kernel/main.c
===================================================================
--- kernel/main.c	(Revision 1389)
+++ kernel/main.c	(Arbeitskopie)
@@ -126,14 +126,10 @@
 }
 
 /*
-    InitializeAllBPBs()
-    
-    or MakeNortonDiskEditorHappy()
-
-    it has been determined, that FDOS's BPB tables are initialized,
-    only when used (like DIR H:).
-    at least one known utility (norton DE) seems to access them directly.
-    ok, so we access for all drives, that the stuff gets build
+    InitializeAllBPBs() or MakeNortonDiskEditorHappy() - FreeDOS
+    does DPB setup on demand (eg DIR H:, via media_check, bpb_to_dpb)
+    so we touch all drives to make sure DPB are filled in. For some reason,
+    this was described as "init BPB to make Norton Disk Edit happy"...?
 */
 void InitializeAllBPBs(VOID)
 {
@@ -145,6 +141,14 @@
     if ((fileno = open(filename, O_RDONLY)) >= 0)
       close(fileno);
   }
+  /* chdir("A:\\") would need intr.asm/init-mod.h ext. but nicer than open() */
+#ifdef WITHFAT32  /* mark drive as not FAT32 to allow int25/26 access */
+  /* floppy is DF_NOACCESS until 1st media_check or int 21.440d.0847  */
+  LoL->DPBp->dpb_fatsize = 1;           /* not 0, that would be FAT32 */
+  LoL->DPBp->dpb_next->dpb_fatsize = 1; /* not 0, that would be FAT32 */
+  /* bpb_to_dpb(ddt_defbpb...) would be perfect but is not accessible */
+  /* media_check(get_dpb(0)); / int 21.32 etc would access phys drive */
+#endif
 }
 
 STATIC void PSPInit(void)
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Freedos-kernel mailing list
Freedos-kernel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to