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 and explain the data that is used.

FUN_0012db50
CMP dword ptr [EAX0x4 + DAT_0012da54],0x0
JZ LAB_0012db80
PUSH ESI
MOV [DAT_0012da50],EAX
MOV ESI,dword ptr [EAX0x4 + DAT_0012da54]
MOV dword ptr [DAT_0012da74],ESI
MOVZX EAX,word ptr [ESI]
MOV [DAT_0012da40],EAX
MOVZX EAX,word ptr [ESI + 0x2]
MOV [DAT_0012da44],EAX
POP ESI
RET
LAB_0012db80
CALL FUN_00143700
CALL FUN_00142764
CALL FUN_00149ef8
MOV AH,0x9
MOV EDX,s_FONT:_Attempt_to_set_non-existin_0012da0d = “FONT: Attempt to set non-existing font.\n\r$”
INT 0x21
MOV AX,0x4c00
INT 0x21
XCHG EBX,EBX
PUSH ECX
PUSH EBP
PUSH ESI
PUSH EDI
SUB EBX,0x21
LAB_0012dbc5
SHL EBX,0x2
ADD EBX,dword ptr [DAT_0012da74]
MOVZX ESI,word ptr [EBX + 0x4]
ADD ESI,dword ptr [DAT_0012da74]
MOVZX EBX,word ptr [EBX + 0x6]
CALL FUN_0012dc44
LAB_0012dbc5
POP EDI
POP ESI
POP EBP
POP ECX
RET

FUN_0012dc44
PUSH EAX
PUSH EBX
PUSH ECX
PUSH EDX
CMP EAX,dword ptr [DAT_00142948]
JGE LAB_0012dd17
CMP EDX,dword ptr [DAT_0014294c]
JGE LAB_0012dd17
MOV EBP,dword ptr [DAT_0012da44]
CMP EDX,dword ptr [DAT_00142944]
JGE LAB_0012dc88
SUB EDX,dword ptr [DAT_00142944]
NEG EDX
SUB EBP,EDX
JLE LAB_0012dd17
ADD EDX,EDX
ADD ESI,EDX
MOV EDX,dword ptr [DAT_00142944]
LAB_0012dc88
MOV ECX,EDX
ADD ECX,EBP
SUB ECX,dword ptr [DAT_0014294c]
JLE LAB_0012dc9c
SUB EBP,ECX
JLE LAB_0012dd17
NOP
NOP
NOP
NOP
LAB_0012dc9c
MOV byte ptr [LAB_0012dd00+2],0x10
CMP EAX,dword ptr [DAT_00142940]
JGE LAB_0012dcc5
SUB EAX,dword ptr [DAT_00142940]
NEG EAX
SUB EBX,EAX
JLE LAB_0012dd17
ADD BL,0x10
MOV byte ptr [LAB_0012dd00+2],BL
MOV EAX,[DAT_00142940]
LAB_0012dcc5
MOV ECX,EAX
ADD ECX,EBX
SUB ECX,dword ptr [DAT_00142948] = 0140h
JLE LAB_0012dcd5
SUB EBX,ECX
JLE LAB_0012dd17
LAB_0012dcd5
MOV EDI,dword ptr [EDX*0x4 + DAT_00142950]
ADD EDI,dword ptr [PTR_DAT_00143550]
ADD EDI,EAX
MOV ECX,dword ptr [DAT_00142930]
SUB ECX,EBX
MOV dword ptr [LAB_0012dd0e+2],ECX
MOV CH,byte ptr [DAT_0012b508]
LAB_0012dcf8
MOV AX,word ptr [ESI]
MOV CL,BL
ADD ESI,0x2
SHL EAX,0x64 ; LAB_0012dd00+2 points to the 0x64 byte in this instruction
LAB_0012dd03
ADD EAX,EAX
JNC LAB_0012dd09
MOV byte ptr [EDI],CH
LAB_0012dd09
INC EDI
DEC CL
JNZ LAB_0012dd03
ADD EDI,0x3e8 ; LAB_0012dd0e+2 points to the 0x3e8 4-byte value in this instruction
DEC EBP
JNZ LAB_0012dcf8
LAB_0012dd17
POP EDX
POP ECX
POP EBX
POP EAX
RET

FUN_00142764
PUSHAD
CMP byte ptr [DAT_00142306],0x0
JZ LAB_0014278c
MOV byte ptr [DAT_00142306],0x0
MOV EAX,0x9
MOV EBX,dword ptr [DAT_00142300]
MOVZX ECX,word ptr [DAT_00142304]
CALL FUN_000a12a6
LAB_0014278c
POPAD
RET

FUN_00143700
PUSHAD
MOV EAX,[DAT_00142923]
CALL dword ptr [EAX + DAT_00143565]
MOV EAX,[DAT_00143558]
TEST EAX,EAX
JZ LAB_0014371a
CALL FUN_000a117e
LAB_0014371a
MOV EAX,[DAT_0014291f]
TEST EAX,EAX
JZ LAB_0014373d
CMP EAX,0x100
JC LAB_00143736
CALL FUN_0015fca7
CALL FUN_0015fc93
POPAD
RET
LAB_00143736
INT 0x10
CALL FUN_0015fc93
LAB_0014373d
POPAD
RET

FUN_00149ef8
PUSHAD
MOV EAX,[DAT_00147958]
TEST EAX,EAX
JZ LAB_00149f07
CALL FUN_000a117e
LAB_00149f07
POPAD
RET