Hi Tom,

here is one of two diffs for patches that I have not
commited to SVN because I was waiting for review...

Topic: Handle floppy type 6 and use DF_DISKCHANGE and
DF_NOACCESS as well as InitializeAllBPBs in a way which
should help disk tools to avoid confusion about FAT1x
versus FAT32.

Question: Are there any side effects?

Thanks for commenting :-)

Eric



$ svn diff freedos/
Index: freedos/kernel/initdisk.c
===================================================================
--- freedos/kernel/initdisk.c   (Revision 1365)
+++ freedos/kernel/initdisk.c   (Working Copy)
@@ -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 */
@@ -577,7 +577,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 */
   }

@@ -719,7 +719,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,
@@ -1269,7 +1269,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: freedos/kernel/dsk.c
===================================================================
--- freedos/kernel/dsk.c        (Revision 1365)
+++ freedos/kernel/dsk.c        (Working Copy)
@@ -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: freedos/kernel/main.c
===================================================================
--- freedos/kernel/main.c       (Revision 1365)
+++ freedos/kernel/main.c       (Working Copy)
@@ -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)



------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to