CreateBootSectorTarget(dosmbr ${CMAKE_CURRENT_SOURCE_DIR}/dosmbr.S ${CMAKE_CURRENT_BINARY_DIR}/dosmbr.bin 7c00)
CreateBootSectorTarget(ext2 ${CMAKE_CURRENT_SOURCE_DIR}/ext2.S ${CMAKE_CURRENT_BINARY_DIR}/ext2.bin 0)
- CreateBootSectorTarget(fat ${CMAKE_CURRENT_SOURCE_DIR}/fatx.S ${CMAKE_CURRENT_BINARY_DIR}/fat.bin 7c00)
+
+ CreateBootSectorTarget(fat ${CMAKE_CURRENT_SOURCE_DIR}/fat.S ${CMAKE_CURRENT_BINARY_DIR}/fat.bin 7c00)
CreateBootSectorTarget(fat32 ${CMAKE_CURRENT_SOURCE_DIR}/fat32.S ${CMAKE_CURRENT_BINARY_DIR}/fat32.bin 7c00)
+
+ ## New versions using FATX.S (experimental)
+ # add_definitions(-DFAT12)
+ # CreateBootSectorTarget(fat_new ${CMAKE_CURRENT_SOURCE_DIR}/fatx.S ${CMAKE_CURRENT_BINARY_DIR}/fat_new.bin 7c00)
+ # remove_definitions(-DFAT12)
+ # add_definitions(-DFAT16)
+ # CreateBootSectorTarget(fat16_new ${CMAKE_CURRENT_SOURCE_DIR}/fatx.S ${CMAKE_CURRENT_BINARY_DIR}/fat16_new.bin 7c00)
+ # remove_definitions(-DFAT16)
+ # add_definitions(-DFAT32)
+ # CreateBootSectorTarget(fat32_new ${CMAKE_CURRENT_SOURCE_DIR}/fatx.S ${CMAKE_CURRENT_BINARY_DIR}/fat32_new.bin 7c00)
+ # remove_definitions(-DFAT32)
+
CreateBootSectorTarget(isoboot ${CMAKE_CURRENT_SOURCE_DIR}/isoboot.S ${CMAKE_CURRENT_BINARY_DIR}/isoboot.bin 7000)
CreateBootSectorTarget(isobtrt ${CMAKE_CURRENT_SOURCE_DIR}/isobtrt.S ${CMAKE_CURRENT_BINARY_DIR}/isobtrt.bin 7000)
******************************************************************************/
/* We have 3 bytes at the entry point to jump over the data area */
start:
- jmp short main
+ jmp short main // FIXME: When compiling FAT32, assembler will complain
+ // that the label is too far... Need investigation!
nop
/* Here starts the BIOS Parameter Block (BPB) data.
add eax, dword ptr BP_REL(HiddenSectors)
/* Load sector count into ecx */
-#if FAT32
- mov ecx, BP_REL(SectorsPerFatBig)
+#ifdef FAT32
+ mov ecx, dword ptr BP_REL(SectorsPerFatBig)
#else
movzx ecx, word ptr BP_REL(SectorsPerFat)
#endif
dec dx
jnz .CheckDirEntry
-#if FAT32
+#ifdef FAT32
/* Check to see if this was the last cluster in the chain */
cmp eax, HEX(0ffffff8)
jnb BootFailure
.FoundFreeLoader:
/* Load the cluster number of freeldr into eax */
-#if FAT32
+#ifdef FAT32
#error unsupported
#else
movzx eax, word ptr es:[bx + HEX(1A)]
call ReadCluster
/* Check if this is the last cluster in the chain */
-#if FAT32
+#if defined(FAT32)
cmp eax, HEX(0ffffff8)
-#elif FAT12
+#elif defined(FAT12)
cmp ax, HEX(0ff8)
#else
cmp ax, HEX(0fff8)
/* Save ES */
push es
-#if FAT32
-#error FAT23 not implemented
-#elif FAT12
+#if defined(FAT32)
+#error FAT32 not implemented
+#elif defined(FAT12)
#error FAT12 not implemented
#else
/* DX:AX = AX * 2 (since FAT16 entries are 2 bytes) */