Log in

View Full Version : ASm help!


NeO
February 10th, 2001, 05:40
I need little asm help!


:00448055 8945B0 mov dword ptr [ebp-50], eax /**In eax
123**/
:00448058 DB45B0 fild dword ptr [ebp-50] +++++
:0044805B DB2DC88A4400 fld tbyte ptr [00448AC8]++++++
:00448061 DEC9 fmulp st(1), st(0)+++++
:00448063 DB7DA4 fstp tbyte ptr [ebp-5C]++++++


I just want to know what those lines marked with ++++ do with eax!

Thanks for helping!


NeO

JimmyClif
February 10th, 2001, 09:15
Here I'll copy paste a few lines from AoA:

The FLD instruction:
The fld instruction loads a 32 bit, 64 bit, or 80 bit floating point value onto the stack. This instruction converts 32 and 64 bit operand to an 80 bit extended precision value before pushing the value onto the floating point stack.

The fld instruction first decrements the tos pointer (bits 11-13 of the status register) and then stores the 80 bit value in the physical register specified by the new tos pointer. If the source operand of the fld instruction is a floating point data register, ST(i), then the actual register the 80x87 uses for the load operation is the register number before decrementing the tos pointer. Therefore, fld st or fld st(0) duplicates the value on the top of the stack.

The FILD Instruction
The fild (integer load) instruction converts a 16, 32, or 64 bit two's complement integer to the 80 bit extended precision format and pushes the result onto the stack. This instruction always expects a single operand. This operand must be the address of a word, double word, or quad word integer variable. Although the instruction format for fild uses the familiar mod/rm fields, the operand must be a memory variable, even for 16 and 32 bit integers. You cannot specify one of the 80386's 16 or 32 bit general purpose registers. If you want to push an 80x86 general purpose register onto the FPU stack, you must first store it into a memory variable and then use fild to push that value of that memory variable.

The FMUL and FMULP Instructions
The fmul and fmulp instructions multiply two floating point values.
With no operands, fmul and fmulp both do the same thing - they pop st(0) and st(1), multiply these values, and push their product back onto the stack. The fmul instructions with two register operands compute destination := destination * source. One of the registers (source or destination) must be st(0).

The FSTP Instruction
The fst and fstp instructions copy the value on the top of the floating point register stack to another floating point register or to a 32, 64, or 80 bit memory variable. When copying data to a 32 or 64 bit memory variable, the 80 bit extended precision value on the top of stack is rounded to the smaller format as specified by the rounding control bits in the FPU control register.

The fstp instruction pops the value off the top of stack when moving it to the destination location. It does this by incrementing the top of stack pointer in the status register after accessing the data in st(0). If the destination operand is a floating point register, the FPU stores the value at the specified register number before popping the data off the top of the stack.

-------
Hope this helps...
JClif

hz
February 10th, 2001, 09:24
Hiya JC,
well thats that all cleared up then, think I
will stick with wf and dl [ebp-50] and see
if I can't figure it out from there, still its
worth bearing in mind :-)
regards

NeO
February 10th, 2001, 10:21
Thanks JimmyClif !


Here I'll copy paste a few lines from AoA!

what that were did you get it!!


NeO

NeO
February 10th, 2001, 10:40
Can you tell me what's the value do i get out!

Thanks!!

NeO

Bratsch
February 10th, 2001, 12:23
:00448055 8945B0 mov dword ptr [ebp-50], eax ; the eax, hex dword value is moved to ebp-50


:00448058 DB45B0 fild dword ptr [ebp-50] ;the value in ebp-50 is pushed to the top of the float stack and transformed from hex to float format in the process



:0044805B DB2DC88A4400 fld tbyte ptr [00448AC8];now the contents of a global variable, stored in 00448ac8, is pushed to the float stack and transformed to float format in the process




:00448061 DEC9 fmulp st(1), st(0) ;the two previous pushed values are multiplied with each other, the result is stored, in float format, in the top of the float stack, st(0).


:00448063 DB7DA4 fstp tbyte ptr [ebp-5C] ;the result is transferred (poped) from the float stack to ebp-5c.

In other words the contents of eax is multiplied, using float arithmetics, with the number stored at :00448AC8. The result is placed in ebp-5C.

Bratsch
February 10th, 2001, 12:27
the result in esp-5c will be, I think, in float format, so change the mode of the data window to ercognize its value

JimmyClif
February 10th, 2001, 13:33
AoA = Art of Assembly

get it here: http://webster.cs.ucr.edu/Page_asm/ArtofAssembly/ArtofAsm.html

---
hz : I tried to help tho... I don't understand this floating point stuff myself good enough to give better advice :'(

JimmyClif

NeO
February 10th, 2001, 14:00
Thanks to everyone !Very good answers!A lot of help!

For -Bratsch :esp-5c will be, I think, in float format, so change the mode of the data window to ercognize its value!!

How ???

NeO

JimmyClif
February 10th, 2001, 16:53
To hz (again)

Did you know that the more often I read your little answer the more I think it got funny?


"Sarcasmically",
JimmyClif

hz
February 10th, 2001, 17:18
Hiya JimmyClif,

honestly man, it was'nt meant to upset
anyone. Of course you tried to help, If I offended you then I apologise. Second time
this week I've unintentionally upset someone.

best regards
hz

JimmyClif
February 10th, 2001, 19:13
To hz:

No man,

No worries I know how you meant it! I didn't get upset.. actually I started laughing as you caught me right in the act

Bestest,
JimmyClif


PS: (besides the FSTP I was able to get the AoA text, and I thought it might help)

Bratsch
February 10th, 2001, 19:20
Quote:
NeO (02-10-2001 03:00):
Thanks to everyone !Very good answers!A lot of help!

For -Bratsch :esp-5c will be, I think, in float format, so change the mode of the data window to ercognize its value!!

How ???

NeO


In softIce, click repeatedly the upper margin of the data window where it says "byte" (usually) it will cycle to word dword short real, long real, 10 byte real. The format command has the same effect.Also type the softIce command: wf f (window, float stack float format) it will activate a window with the contents of the float stack, in float format.

NeO
February 11th, 2001, 09:57
Thanks man !!for helping!That really help and i crack it and wrote a keygen!


NeO