A
antd
Guest
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:
Code: (Assembly) [Select]
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:
Code: (Assembly) [Select]
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!
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:
Code: (Assembly) [Select]
Code:
; Set Countdown Timer to 0x258; dw_CDSeconds = Countdown Timer RAM addressmov cl, [edx+eax] ECX=0000040Amov [ebp+var_4], cl mov al, [ebp+var_4] EAX=0000000A ; 10!...imul eax, 3Ch EAX=00000258 ; 10 * 60 = 600mov ecx, [ebp+var_4] ECX=00000000 add ecx, eax ECX=00000258mov [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
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:
Code: (Assembly) [Select]
Code:
mov eax, 258hmov dw_CDSeconds, eax
I'm not a programmer. Please explain!
Last edited: