Update fx_media_format.c

Correction to boot record signature writing; attempted to bring in line with design intent of variable length boot record as used earlier in function.
This commit is contained in:
nflandin
2024-06-21 10:50:48 -07:00
committed by GitHub
parent 1b85eb2141
commit ee280d9d14
+16 -9
View File
@@ -443,17 +443,24 @@ UINT sectors_per_fat, f, s;
_fx_utility_memory_set(&byte_ptr[j + i], ' ', (11 - i)); _fx_utility_memory_set(&byte_ptr[j + i], ' ', (11 - i));
#endif /* FX_DISABLE_FORCE_MEMORY_OPERATION */ #endif /* FX_DISABLE_FORCE_MEMORY_OPERATION */
/* Set bootrecord signature. */
#ifdef FX_FORCE_512_BYTE_BOOT_SECTOR #ifdef FX_FORCE_512_BYTE_BOOT_SECTOR
/* Put the boot signature in the standard position. */
/* Set bootrecord signature. */ byte_ptr[FX_SIG_OFFSET] = FX_SIG_BYTE_1;
byte_ptr[510] = 0x55; byte_ptr[FX_SIG_OFFSET + 1] = FX_SIG_BYTE_2;
byte_ptr[511] = 0xAA;
#else #else
if (bytes_per_sector < 512)
/* Set bootrecord signature. */ {
byte_ptr[bytes_per_sector - 2] = 0x55; /* Put the boot signature at the end of the sector. */
byte_ptr[bytes_per_sector - 1] = 0xAA; byte_ptr[bytes_per_sector - 2] = FX_SIG_BYTE_1;
byte_ptr[bytes_per_sector - 1] = FX_SIG_BYTE_2;
}
else
{
/* Put the boot signature in the standard position. */
byte_ptr[FX_SIG_OFFSET] = FX_SIG_BYTE_1;
byte_ptr[FX_SIG_OFFSET + 1] = FX_SIG_BYTE_2;
}
#endif #endif
/* Select the boot record write command. */ /* Select the boot record write command. */