Hi again,

news about boot sector properties:

- our FAT32 boot sectors always trust DL, so the code in SYS
  which says "if A:/B: set 0, else set 0xff" should be changed
  to "if A:/B: set 0, else set 0x80" to make the boot sector
  look nicer to disk tools, right? And makebootfat and my tool
  sys-freedos-linux should mention that options like -E number
  or --drive=number have no effect on FAT32, correct?

- I wrote a patch to make the FAT32 LBA boot sector use the
  DS:SI partition table entry pointer for the partition offset,
  please help by proof-reading it... See below.

- our boot sectors do not need any geometry in LBA mode but
  they never use LBA for A: because it "might be a buggy
  cdrom boot floppy emulation". I suggest to allow LBA even
  for A: for the FAT16 boot sector, would that be okay?

- our FAT12, FAT16 and FAT32 CHS boot sectors work on 8086,
  and FAT32 LBA needs 386. SYS uses LBA for FAT32 if it can
  do so on the PC on which you run SYS for the target drive.
  I suggest to add a command line option to force CHS or LBA.
  Please suggest a syntax.

- I suggest to change the way in which SYS writes the
  FAT12 / FAT16 drive number: instead of using 0 A:/B:
  and 255 (auto) else, use 0 A:/B: and 128 (hdd) else,
  and change the boot sectors to trust DL from whoever
  calls the boot sector (MBR, BIOS, boot menu) unless
  some SYS command line makes SYS modify code in the
  sector to ignore DL, possibly for buggy BIOS compat.
  SYS could default to "ignore if A:/B:, else trust",
  then you need 2 options (force ignore, force trust).
  Comments and syntax suggestions please...

- the FAT12 / FAT16 boot sectors are too stuffed to
  check int13.8 for real geometry, but we could say
  that LBA is often supported - then we get to my
  suggestion "allow LBA even for A: if FAT16"... :-).
  When you use LBA, wrong CHS geometry is irrelevant.



The above would fix the following:

- mtools / mkdosfs can fail to set the partition
  offset (number of "hidden sectors") but a MBR
  usually passes the right partition table entry
  pointer - my patch makes FAT32 LBA boot easier

- CHS geometries can easily mismatch between when
  you format a drive and when you use a drive to
  boot from it - the "use LBA boot sector" option
  for FAT32 for SYS and the "use LBA even for A:
  if FAT16" options would make it easier to use
  LBA to boot which has no CHS risks. See above.

- it was not intuitive that FAT12 / FAT16 used
  "drive 255 means automatic" while FAT32 always
  used automatic, so I suggest to always use the
  automatic choice unless a SYS option forces use
  of a given drive number, even in FAT12 / FAT16
  (maybe not for FAT12 A:, see above)

Eric


Patch for boot32lb.asm for "use DS:SI partition table entry":

--- boot32lb.asm        (revision 1365)
+++ boot32lb.asm        (working copy)
@@ -107,27 +107,39 @@
 ; ENTRY
 ;-----------------------------------------------------------------------

-real_start:    cld
-               cli
+real_start:    cld             ; input: DS:SI pointer to partition table
+               cli             ; entry in RAM, DL BIOS boot drive number
                sub     ax, ax
+               mov     bx, ds          ; preserve DS of DS:SI in BX
                mov     ds, ax
                mov     bp, 0x7c00

                mov     ax, 0x1FE0
                mov     es, ax
-               mov     si, bp
                mov     di, bp
+               ; mov   si, bp
+               xchg    si, bp          ; preserve SI in BP but break BP
                mov     cx, 0x0100
                rep     movsw           ; move boot code to the
0x1FE0:0x0000
                jmp     word 0x1FE0:cont

-loadseg_off    dw      0, LOADSEG
+%define loadseg_off    (loadseg_seg-2)
+               ; dw 0          ; the extra "mov bx,ds" gets us here
+loadseg_seg    dw LOADSEG      ; sys.c hardcodes offset of this!

 ; -------------

-cont:          mov     ds, ax
+cont:          mov     ds, bx                  ; restore DS of DS:SI
+               mov     si, bp                  ; restore SI of DS:SI
+               mov     bp, 0x7c00              ; fix BP, we need it
+               test    byte [si], 0x7f         ; is ds:[si] 0 or 0x80?
                mov     ss, ax          ; stack and BP-relative moves up, too
                 lea     sp, [bp-0x20]
+               jnz     no_partdata             ; was ds:[si] 0 or 0x80?
+               push    dword [si+8]            ; partition offset
+               pop     dword [nHidden]         ; relative to SS:BP :-)
+no_partdata:   mov     ds, ax                  ; drop caller DS:SI now
+               mov     word [loadsegoff_60],cx ; set to 0
                sti
                mov     [drive], dl     ; BIOS passes drive number in DL



-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to