Posted: Mon Apr 09, 2018 1:45 pm Post subject: [solved] Assembler Question - Check if float is an integer?
Hi all,
funny problem: I have found a nice point in the sourcecode of a game where the gold-value is being read. But sometimes the same source jumps into reading the mana, too.
newmem:
push eax
add eax,2c
mov [goldaddress],eax
pop eax
So what I need is a way to decide: is [eax+2c] actually pointing to gold or mana? I found out: gold is always a plain integer number, stored as float, wheres mana is always a "real" float number.
Any ideas?
best regards,
Marc
Last edited by MarcRené on Tue Apr 10, 2018 8:44 am; edited 1 time in total
code:
//...
// st(0) contains floating point value being tested
fld st(0)
frndint
fucomip st(1)
jz gold
// mana
// code for mana here
jmp exit
gold:
// code for gold here
exit:
//...
This probably isn't a good way of checking which address is being accessed, but I hope you learn something regardless. _________________
I don't know where I'm going, but I'll figure it out when I get there.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum