/* Updates a FAT12 cluster entry in the FAT file table with the specified next chain index. If the cluster is the last in the file chain, the magic value  */
static void UpdateFAT12ClusterEntry(uint8_t *const FATTable, const uint16_t Index, const uint16_t ChainEntry)
/* Updates a FAT12 cluster entry in the FAT file table with the specified next chain index. If the cluster is the last in the file chain, the magic value  */
static void UpdateFAT12ClusterEntry(uint8_t *const FATTable, const uint16_t Index, const uint16_t ChainEntry)
{
	uint8_t FATOffset   = (Index + (Index >> 1));
	bool    UpperNibble = ((Index & 1) != 0);
	if (UpperNibble)
	{
		FATTable[FATOffset]     = (FATTable[FATOffset] & 0x0F) | ((ChainEntry & 0x0F) << 4);
		FATTable[FATOffset + 1] = (ChainEntry >> 4);
	}
	else
	{
		FATTable[FATOffset]     = ChainEntry;
		FATTable[FATOffset + 1] = (FATTable[FATOffset + 1] & 0xF0) | (ChainEntry >> 8);
	}
}