Still some stuff to identify but contains a sliver of the TCC lockup logic
Code:
void FUN_002d267c(void)
{
byte bVar1; // Temporary variable to hold byte-sized data
ushort uVar2; // Temporary variable to hold unsigned 16-bit data
byte bVar3; // Temporary variable to hold byte-sized data
ushort uVar4; // Variable to store the selected turbine speed threshold
// Read initial system flags
uVar2 = DAT_600023bc;
// Set default turbine speed threshold for overheat mode
uVar4 = Unlock_to_Partial_Lock_Minimum_Filtered_Turbine_Speed_While_in_Overheat;
// Outer condition to determine whether to proceed with the logic
if ((((((~uVar2 & 1) != 0) && // Check if the least significant bit (LSB) of uVar2 is cleared
(bVar1 = DAT_6000248c, // Load additional system flags into bVar1
uVar4 = Unlock_to_Partial_Lock_Minimum_Filtered_Turbine_Speed_for_Exhaust_Brake_Pending_in_2nd_Gear, // Update turbine speed threshold for exhaust brake
(~bVar1 & 2) != 0)) && // Check if bit 1 of bVar1 is cleared
(bVar1 = DAT_6000248d, (~bVar1 & 0x20) != 0)) && // Check if bit 5 of bVar1 is cleared
((uVar2 = DAT_600023c0, // Load another set of system flags
uVar4 = Unlock_to_Partial_Lock_Minimum_Filtered_Turbine_Speed_for_IDFSO, // Update turbine speed threshold for IDFSO
(~uVar2 & 0x400) != 0 && // Check if bit 10 of uVar2 is cleared
(bVar1 = DAT_600020d5, (~bVar1 & 0x80) != 0)))) && // Check if bit 7 of bVar1 is cleared
(uVar2 = DAT_600023c2, (~uVar2 & 2) != 0)) // Check if bit 1 of uVar2 is cleared
{
// Read the flag register related to torque management
bVar1 = Flag_Register_for_?(Related_to_TQ_Management);
if ((~bVar1 & 0x40) == 0) { // Check if bit 6 of bVar1 is NOT cleared
bVar1 = General_Purpose_Flag_Register_1;
if ((((((bVar1 & 4) != 0) || // Check if bit 2 of bVar1 is set(Change state of Gear/TCC request)
(bVar3 = Gear/TCC_State_Code,
uVar4 = Unlock_to_Partial_Lock_Turbine_Speed_Threshold_for_2nd_Gear_in_Driver_Select_Mode, // Set threshold for 2nd gear
(~bVar3 & 8) != 0)) && // Check if bit 3 of bVar3 is cleared
(((bVar1 & 4) != 0 ||
(bVar3 = Gear/TCC_State_Code,
uVar4 = Unlock_to_Partial_Lock_Turbine_Speed_Threshold_for_2P_Gear_in_Driver_Select_Mode, // Set threshold for 2P gear
(~bVar3 & 0x10) != 0)))) && // Check if bit 4 of bVar3 is cleared
(((bVar1 & 4) != 0 ||
(bVar3 = Gear/TCC_State_Code,
uVar4 = Unlock_to_Partial_Lock_Turbine_Speed_Threshold_for_3rd_Gear_in_Driver_Select_Mode, // Set threshold for 3rd gear
(~bVar3 & 0x20) != 0)))) && // Check if bit 5 of bVar3 is cleared
(((bVar1 & 4) != 0 ||
(bVar3 = Gear/TCC_State_Code,
uVar4 = Unlock_to_Partial_Lock_Turbine_Speed_Threshold_for_4th_Gear_in_Driver_Select_Mode, // Set threshold for 4th gear
(~bVar3 & 0x40) != 0)))) { // Check if bit 6 of bVar3 is cleared
if ((bVar1 & 4) != 0) { // Final check if bit 2 of bVar1 is set
return; // Exit early if condition is met
}
bVar1 = Gear/TCC_State_Code;
uVar4 = Unlock_to_Partial_Lock_Turbine_Speed_Threshold_for_4P_Gear_in_Driver_Select_Mode; // Set threshold for 4P gear
if ((~bVar1 & 0x80) != 0) { // Check if bit 7 of bVar1 is cleared
return; // Exit early if condition is met
}
}
}
else {
uVar2 = DAT_6000225a; // Load additional system flags
bVar1 = General_Purpose_Flag_Register_1;
if ((uVar2 & 4) == 0) { // Check if bit 2 of uVar2 is cleared
if (((((bVar1 & 4) != 0) ||
(bVar3 = Gear/TCC_State_Code,
uVar4 = Unlock_to_Partial_Lock_Minimum_Filtered_Turbine_Speed_for_2nd_Gear, // Set threshold for 2nd gear
(~bVar3 & 8) != 0)) && // Check if bit 3 of bVar3 is cleared
(((bVar1 & 4) != 0 ||
(bVar3 = Gear/TCC_State_Code,
uVar4 = Unlock_to_Partial_Lock_Minimum_Filtered_Turbine_Speed_for_2P_Gear, // Set threshold for 2P gear
(~bVar3 & 0x10) != 0)))) && // Check if bit 4 of bVar3 is cleared
((((bVar1 & 4) != 0 ||
(bVar3 = Gear/TCC_State_Code,
uVar4 = Unlock_to_Partial_Lock_Minimum_Filtered_Turbine_Speed_for_3rd_Gear, // Set threshold for 3rd gear
(~bVar3 & 0x20) != 0)) && // Check if bit 5 of bVar3 is cleared
(((bVar1 & 4) != 0 ||
(bVar3 = Gear/TCC_State_Code,
uVar4 = Unlock_to_Partial_Lock_Minimum_Filtered_Turbine_Speed_for_4th_Gear, // Set threshold for 4th gear
(~bVar3 & 0x40) != 0)))))) { // Check if bit 6 of bVar3 is cleared
if ((bVar1 & 4) != 0) { // Final check if bit 2 of bVar1 is set
return; // Exit early if condition is met
}
bVar1 = Gear/TCC_State_Code;
uVar4 = Unlock_to_Partial_Lock_Minimum_Filtered_Turbine_Speed_for_4P_Gear; // Set threshold for 4P gear
if ((~bVar1 & 0x80) != 0) { // Check if bit 7 of bVar1 is cleared
return; // Exit early if condition is met
}
}
}
else if (((((bVar1 & 4) != 0) ||
(bVar3 = Gear/TCC_State_Code,
uVar4 = Tow/Haul_Unlock_to_Partial_Lock_Minimum_Filtered_Turbine_Speed_for_2nd_Gear, // Set Tow/Haul threshold for 2nd gear
(~bVar3 & 8) != 0)) && // Check if bit 3 of bVar3 is cleared
(((bVar1 & 4) != 0 ||
(bVar3 = Gear/TCC_State_Code,
uVar4 = Tow/Haul_Unlock_to_Partial_Lock_Minimum_Filtered_Turbine_Speed_for_2P_Gear, // Set Tow/Haul threshold for 2P gear
(~bVar3 & 0x10) != 0)))) && // Check if bit 4 of bVar3 is cleared
((((bVar1 & 4) != 0 ||
(bVar3 = Gear/TCC_State_Code,
uVar4 = Tow/Haul_Unlock_to_Partial_Lock_Minimum_Filtered_Turbine_Speed_for_3rd_Gear, // Set Tow/Haul threshold for 3rd gear
(~bVar3 & 0x20) != 0)) && // Check if bit 5 of bVar3 is cleared
(((bVar1 & 4) != 0 ||
(bVar3 = Gear/TCC_State_Code,
uVar4 = Tow/Haul_Unlock_to_Partial_Lock_Minimum_Filtered_Turbine_Speed_for_4th_Gear, // Set Tow/Haul threshold for 4th gear
(~bVar3 & 0x40) != 0)))))) { // Check if bit 6 of bVar3 is cleared
if ((bVar1 & 4) != 0) { // Final check if bit 2 of bVar1 is set
return; // Exit early if condition is met
}
bVar1 = Gear/TCC_State_Code;
uVar4 = Tow/Haul_Unlock_to_Partial_Lock_Minimum_Filtered_Turbine_Speed_(Ntf)_for_4P_Gear; // Set Tow/Haul threshold for 4P gear
if ((~bVar1 & 0x80) != 0) { // Check if bit 7 of bVar3 is cleared
return; // Exit early if condition is met
}
}
}
}
// Final assignment of the determined turbine speed threshold
DAT_600023f6 = uVar4;
return;
}