FPU advise needed - SOLVED -

This forum is for outdated or irrelevant Modding Information that may or may not be 3 months old.

Moderator: thunderchero

User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1964
Joined: Sun Apr 27, 2008 2:00 am

FPU advise needed - SOLVED -

Post by Spocks-cuddly-tribble »

Hi friends,


whilst fixing a hidden/biased minor race feature, I also implemented normal minor pop growth.


(...)


Now to the problem:

I'm not familiar with the FPU handling and how it affects stacks (esp?)
(google didn't help to a non-programmer, as least not within a realistic timeframe)

(...)

With some useful hints on the issue, I could finish this project next weekend (no code space issue, still over 100 bytes free).
Last edited by Spocks-cuddly-tribble on Mon Nov 29, 2010 8:34 am, edited 1 time in total.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
Flocke
BORG Trouble Maker
BORG Trouble Maker
Posts: 3259
Joined: Sun Apr 27, 2008 2:00 am
Location: Hamburg, Germany

Re: FPU advise needed (for normal minor race advancement)

Post by Flocke »

Spocks-cuddly-tribble wrote:I'm not familiar with the FPU handling and how it affects stacks (esp?)
(google didn't help to a non-programmer, as least not within a realistic timeframe)
Hi SCT,
I'm not familar with FPU arithmetic either, but doing a quick search I found a nice description: http://runtime-basic.net/Assembler:Schn ... U-Register (german)

first the fpu only operates on special fpu registers which are organized as a stack and not the esp
second all operators ending with a p seam to pop the first register st0 in fpu stack

so fmul st(1), st means st1 = st1 * st0
and fmulp st(1), st means st0 = st1 * st0 cause st1 becomes st0 after the pop

lateron fstp qword ptr [esp] stores the result st0 but also pops the stack again so st0 gets lost

fistp dword ptr [esp+1A8h] stores whatever is in st0 fpu register after the two preceding function calls as integer

hope this already helps :)
only referring to what you've posted

edit: oh, forgot FMUL dword ptr [esp+160h] multiplying st0 by a float and FILD dWORD [systInfo+40h] pushing the fpu stack and loading a signed integer in st0

Return to “Modding Information Archive”