I will provide you disassembly from a computer game that runs in MS-DOS. The game was written in C with a Watcom compiler. Some library function calls are already identified. Explain the functions I give to you and suggest names and C-language function signatures for them, including which parameters map to which registers or stack values. Also suggest names for global values if you have enough context to do so.
FUN_000a0ad9
PUSH EBP
MOV EBP,ESP
PUSH ESI
PUSH EDI
MOV EDI,EAX
MOV ESI,EDX
PUSH ECX
PUSH dword ptr [EBP + Stack[0x4]]
PUSH EBX
CALL FUN_000a0f39
PUSH 0x17
CALL FUN_000a34b8
CALL FUN_000a3477
TEST AL,AL
JZ LAB_000a0b27
PUSH ESI
PUSH dword ptr [PTR_s_source_0018d687] = "source"
PUSH 0x0
CALL FUN_000a88cd
TEST EAX,EAX
JNZ LAB_000a0b27
PUSH EDI
PUSH ESI
MOV EAX,ESI
CALL strlen
INC EAX
PUSH EAX
PUSH 0x4
PUSH 0x8017
PUSH 0x0
CALL FUN_000a89e8
LAB_000a0b27
MOV EDX,ESI
MOV EAX,EDI
CALL strcpy__0
MOV ESI,EAX
CALL FUN_000a351e
MOV EAX,ESI
LEA ESP=>local_c,[EBP + -0x8]
POP EDI
POP ESI
POP EBP
RET 0x4
Description:
This function combines the functionality of FUN_000a0f39, FUN_000a34b8, and FUN_000a3477. It calls these functions in the following sequence:
FUN_000a0f39
FUN_000a34b8
FUN_000a3477
If FUN_000a3477 returns true (AL=1), it continues:
calls FUN_000a88cd with parameters ("source", ESI, 0)
If the previous call succeeds:
Allocates memory with FUN_000a89e8
Calls strcpy__0 to copy the string from ESI to EDI
int Check_And_Set_Param(int param_5, int param_6, int param_7);
FUN_000a34b8
Description:
This function performs several operations and calls, such as FUN_000a8db9 and FUN_000a3350. It increments the value of DAT_00188acc and updates some global variables.
Description:
This function checks if the conditions (DAT_00188acb != 0 && DAT_00188acc == 1) are met, and if so, returns true if DAT_00188a43 & 0x4 is non-zero and DAT_00188aad is non-zero.
Description:
This function checks if the conditions (DAT_00188acb != 0 && DAT_00188acc == 1) are met, and if so, returns true if DAT_00188a42 & 0x2 is zero.
Description:
This function first checks if the conditions (DAT_00188acb != 0 && DAT_00188acc == 1) are met, then performs several operations, and calls FUN_000a338e and FUN_000a8db9.
Description:
This function takes three parameters, stores them in local variables, and then performs several function calls depending on the values of those parameters.
int Parameters_Check(void *param1, uint32_t param2, uint32_t param3);
FUN_000a89e8
Description:
This function takes several parameters and then uses them to initialize local variables, manipulates some global values, and calls other functions.