I will provide you disassembly from a computer game that runs in MS-DOS. The game was…
- User
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.
Within FUN_000a0040 is a call to another function that calls memset. The documentation for int386 is: "int int386( int inter_no, const union REGS *in_regs, union REGS *out_regs );
The int386 function causes the computer's central processor (CPU) to be interrupted with an interrupt whose number is given by "inter_no". This function is present in the 386 C libraries and may be executed on 80386/486 systems. Before the interrupt, the CPU registers are loaded from the structure located by "in_regs". Following the interrupt, the structure located by "out_regs" is filled with the contents of the CPU registers. These structures may be located at the same location in memory.
You should consult the technical documentation for the computer that you are using to determine the expected register contents before and after the interrupt in question."
The documentation for int386x is: "int int386x( int inter_no, const union REGS *in_regs, union REGS *out_regs, struct SREGS *seg_regs );
The int386x function causes the computer's central processor (CPU) to be interrupted with an interrupt whose number is given by "inter_no". This function is present in the 386 C libraries and may be executed on 80386/486 systems. Before the interrupt, the CPU registers are loaded from the structure located by "in_regs" and the DS, ES, FS and GS segment registers are loaded from the structure located by "seg_regs". Following the interrupt, the structure located by "out_regs" is filled with the contents of the CPU registers. The "in_regs" and "out_regs" structures may be located at the same location in memory. The original values of the DS, ES, FS and GS registers are restored. The structure "seg_regs" is updated with the values of the segment registers following the interrupt.
You should consult the technical documentation for the computer that you are using to determine the expected register contents before and after the interrupt in question."
The documentation for segread is: "void segread( struct SREGS *seg_regs );
The segread function places the values of the segment registers into the structure located by "seg_regs"."
FUN_000994f0 and FUN_0009957d are called by functions in the program that are thought to be related to sound effects and MIDI. FUN_0009960a is called by the program's main function.
FUN_00099490 PUSH EBP MOV EBP,ESP PUSH EBX PUSH ECX PUSH EDX PUSH ESI PUSH EDI SUB ESP,0x2c MOV dword ptr [EBP + local_1c],EAX PUSH 0x4 PUSH 0x27 MOV ECX,s_int.c_00177348 = "int.c" MOV EBX,0xc XOR EDX,EDX LEA EAX=>local_28,[EBP + -0x24] CALL FUN_000a0040 MOV dword ptr [EBP + local_44],0x500 MOV EAX,dword ptr [EBP + local_1c] MOV dword ptr [EBP + local_30],EAX MOV AX,DS MOV EBX,dword ptr [EBP + local_1c] MOV EDX,EAX MOV EAX,EBX MOV word ptr [EBP + local_28],DX LEA ECX=>local_28,[EBP + -0x24] LEA EBX=>local_44,[EBP + -0x40] LEA EDX=>local_44,[EBP + -0x40] MOV EAX,0x31 CALL int386x LEA ESP=>local_18,[EBP + -0x14] POP EDI POP ESI POP EDX POP ECX POP EBX POP EBP RET
- Assistant
Here are the explanations of the given functions, along with suggested names and C-language function signatures:
-
FUN_00099490
Description: This function sets up an interrupt and calls the int386x function to perform a DOS Interrupt 31h (DPMI) call. The purpose of this function seems to set up a Real Mode Call Structure (RMCS) and make a DPMI (DOS Protected Mode Interface) call.
-