I decompile old dos game (WATCOM compiler). I do not understand code after calling localtime. What calculations performing after calling localtime?
cseg01:00020F60 sub_20F60 proc near ; CODE XREF: sub_20D30+5p
cseg01:00020F60
cseg01:00020F60 var_14 = dword ptr -14h
cseg01:00020F60
cseg01:00020F60 push ebx
cseg01:00020F61 push ecx
cseg01:00020F62 push edx
cseg01:00020F63 push edi
cseg01:00020F64 sub esp, 4
cseg01:00020F67 xor eax, eax
cseg01:00020F69 call time_
cseg01:00020F6E mov [esp+14h+var_14], eax
cseg01:00020F71 mov eax, esp
cseg01:00020F73 call localtime_
cseg01:00020F78 mov ebx, [eax+4]
cseg01:00020F7B mov edx, eax
cseg01:00020F7D lea eax, ds:0[ebx*8]
cseg01:00020F84 sub eax, ebx
cseg01:00020F86 shl eax, 3
cseg01:00020F89 add eax, ebx
cseg01:00020F8B mov ebx, [edx]
cseg01:00020F8D mov ecx, [edx+8]
cseg01:00020F90 add ebx, eax
cseg01:00020F92 imul eax, ecx, 0DD7h
cseg01:00020F98 add eax, ebx
I tried to write pseudocode, there is my pseudocode:
after calling localtime
ebx = minutes
eax = ebx * 8;
eax = eax - ebx;
eax = eax >> 3;
eax = eax + ebx;
ebx = seconds;
ecx = hours;
ebx = ebx + eax;
eax = ecx * 3543;
eax = eax + ebx;
I do not understand this math stuff.