Skip to main content
16 events
when toggle format what by license comment
Feb 23, 2023 at 21:41 comment added Michael Karcher @Justme When I hand-recovered a boot sector using Nortons diskedit, I got bitten by the JMP check, too. It indeed has to be EB xx 90, as you say, not just EB xx yy. IIRC I tried with EB xx 00, and the partition didn't get recognized by MS-DOS.
Feb 23, 2023 at 15:56 history edited user3840170 CC BY-SA 4.0
added 6 characters in body
Feb 22, 2023 at 22:51 comment added ecm @Justme Would be interesting to learn the results for hard disks. I can't find this part (BIO disk init) in the free software MS-DOS v2 source release, but its DOS's getset.asm file does contain a part for reading the "FAT start" word (also called reserved sectors) from a BPB and using it in the DPB, so I assume that the hard disk init shipped with that DOS version may have honoured the on-disk BPB's reserved sectors.
Feb 22, 2023 at 22:45 comment added Justme @ecm Forgot to mention, I used a 1.44MB floppy image in a VM.
Feb 22, 2023 at 22:25 comment added ecm @Justme Did you check on diskettes or on hard disks? DOS Internals lists current DOS (then MS-DOS v5 or v6 ish) as always assuming 1 reserved sector on diskettes.
Feb 22, 2023 at 20:28 comment added Justme I think the answer is important, but from a different aspect. The original problem appears not to be directly related to the FAT partition having non-cylinder aligned start address, but the fact that the used MS-DOS 2.0 does not understand the FAT filesystem resedved sector count at offset 0x0E. In Microsoft documentation for FAT file systems, they explicitly warn about using value other than 1 here, and it seems MS-DOS 2.0 assumes it to be 1 without checking. Using a value of e.g. 2 is supported correctly under MS-DOS 6.22.
Feb 22, 2023 at 18:04 comment added Justme @ecm True, technically there can be just any arbitrary executable code if DOS compatibility is not needed. But for FAT driver compatibility, many storage formats such as SD cards have specified that the FAT boot sector must start with EBh, xx, 90h or E9h, xx, xx.
Feb 22, 2023 at 17:44 comment added ecm @Justme A jmp is not strictly needed to execute code, a near immediate call (opcode 0E8h) does equally well. And of course in an MBR the first instruction will usually not be a branch at all. Generally the BIOS will not check for instructions, yes. I did specifically state that "DOS" does this, or (as DOS Internals specifically notes) the BIO part of a DOS (which they call IO.SYS as in the usual MS-DOS), at a guess the disk init code. I copied two relevant sections from the book in pushbx.org/ecm/test/20230222.2/…
Feb 22, 2023 at 17:13 comment added Justme At least the JMP is not checked by BIOS or MBR. They just get loaded, and only BIOS checks for the 55AA signature at the end. MBR may not check it. It is up to DOS if it checks the JMP. But JMP is needed because the code is executed, so it needs to jump over header to actual code.
Feb 22, 2023 at 15:13 comment added Joshua @ecm: Oh; that appears to be something I needed. I didn't have full information on what DOS did when it didn't find the short jmp instruction.
Feb 22, 2023 at 15:09 comment added ecm @Joshua DOS Internals, which I have at home, does say DOS may check the jump. I cited it in hg.pushbx.org/ecm/ldosboot/file/a4823a5555d4/boot.asm#l506
Feb 22, 2023 at 15:03 comment added Joshua Oh fun. Is the documentation about DOS looking for a SHORT JMP instruction at the start of the boot sector just wrong?
Feb 22, 2023 at 14:41 comment added Joshua @Justme: Don't trust fdisk. When you load a disk image into your VM it's going to invent geometry. And we've already established that the MBR end is broken. So this leaves boot sector geometry, for which you found the correct value.
Feb 22, 2023 at 12:07 comment added Justme Thanks, my mistake. I still think there is no need to align the start of partition to 4KB boundary, as DOS still accesses 512 byte sectors for whatever purpose it wants, be it FAT or whatever. It might make more sense to align the partition so that it's the clusters that are 4KB aligned, but, will it really matter. It should be enough for DOS if the partition start is aligned to cylinder boundary, so CHS (0,1,1) or LBA 63. Assuming all parties agree on identical disk geometry, of course. Partition has end at 255 heads, FAT boot sector has 16 heads, and fdisk says 4 heads. All disagree.
Feb 22, 2023 at 11:44 comment added pndc @Justme Yes, and I wrote as much: "CHS (0,0,7) is LBA 6".
Feb 22, 2023 at 11:17 history answered pndc CC BY-SA 4.0