Below is decompiled assembly code from an MS-DOS program written in C and compiled with…
Rate quality
Private research annotation
Sign in to add a private research label or note.
- User
Below is decompiled assembly code from an MS-DOS program written in C and compiled with the Watcom compiler. Please explain what the functions seem to do and suggest names for the functions.
FUN_00160e45 PUSHAD MOV ECX,0x20 MOV EAX,0x52 CALL FUN_00160ee7 POPAD RET
FUN_00160ee7 PUSH EDX MOV EDX,EAX MOV EAX,[DAT_00160d00] CALL FUN_00160a54 POP EDX RET
FUN_00160a54 PUSH EBX PUSH ECX PUSH ESI LEA ESI,[EAX*0x4 + 0xfffffffc] MOV ECX,0x23 LAB_00160a63 PUSH EAX PUSH EDX MOV DX,0x3da LAB_00160a69 IN AL,DX TEST AL,0x8 JNZ LAB_00160a69 LAB_00160a6e IN AL,DX TEST AL,0x8 JZ LAB_00160a6e POP EDX POP EAX PUSH EAX CALL FUN_00160a3c TEST AL,0x20 POP EAX JNZ LAB_00160a8c LOOP LAB_00160a63 POP ESI POP ECX POP EBX MOV EAX,0x1 STC RET LAB_00160a8c MOV EAX,EDX MOV EDX,dword ptr [ESI + 0x160004]=>DAT_00160000 OUT DX,AL POP ESI POP ECX POP EBX XOR EAX,EAX CLC RET
FUN_00160a3c PUSH EDX PUSH ESI LEA ESI,[EAX*0x4 + 0xfffffffc] MOV EDX,dword ptr [ESI + 0x160004]=>DAT_00160000 ADD EDX,0x5 IN AL,DX POP ESI POP EDX RET
- Assistant
-
FUN_00160e45: This function sets the value of ECX to 0x20, sets the value of EAX to 0x52, and then callsFUN_00160ee7. After the function call, it performs a POPAD (Pop All General Purpose Registers) instruction to restore the state of the registers before the function call and then returns to the caller. A potential name for this function could beexecute_FUN_00160ee7. -
FUN_00160ee7: This function first saves the value of EDX before callingFUN_00160a54. Then, it restores the value of EDX, and returns to the caller. A potential name for this function could bepreserve_EDX_call_FUN_00160a54. -
FUN_00160a54: This function appears to be checking some hardware status while looping 0x23 times. It callsFUN_00160a3cduring the loop, testing if the 0x20 bit is set in the returned AL register. If it is set, it jumps toLAB_00160a8cwhich writes to some hardware port and returns zero with the CF (Carry Flag) cleared. If the loop continues without the bit being set, the function returns 1 with the STC (Set Carry Flag) instruction. A potential name for this function could be .
-