In the first reactor, after defeating Guard Scorpion, the countdown timer is set to 10 minutes (600 seconds).
I debugged this area of code and it seems a little strange to me.
The timer is set to 600 seconds (0x258) in this way:
; Set Countdown Timer to 0x258
; dw_CDSeconds = Countdown Timer RAM address
mov cl, [edx+eax] ECX=0000040A
mov [ebp+var_4], cl
mov al, [ebp+var_4] EAX=0000000A ; 10!
...
imul eax, 3Ch EAX=00000258 ; 10 * 60 = 600
mov ecx, [ebp+var_4] ECX=00000000
add ecx, eax ECX=00000258
mov [ebp+var_4], ecx ECX=00000258
...
mov edx, [ebp+var_4] EDX=00000258
...
mov eax, [ebp+var_4] EAX=00000258
mov dw_CDSeconds, eax ; 600 seconds for the countdown timer
It does many things in between and I understand the need to push to the stack, etc.
However, why does it go to the trouble of using the expensive imul instruction?
And why calculate 0x258 instead of using it directly as an immediate?
Would it not be more efficient to do something like:
mov eax, 258h
mov dw_CDSeconds, eax
I'm thinking they didn't do this because the countdown routine will be used in places other than the first reactor, and thus use a different seconds value (not 10 minutes)? >.<
I'm not a programmer. Please explain!