flat assembler
Message board for the users of flat assembler.
Index
> Windows > FPU help |
Author |
|
vid 28 May 2007, 11:03
FDBG contains code that can print floating values, ask Feryno
|
|||
28 May 2007, 11:03 |
|
kohlrak 28 May 2007, 11:07
FDBG?
|
|||
28 May 2007, 11:07 |
|
vid 28 May 2007, 12:24
|
|||
28 May 2007, 12:24 |
|
Feryno 28 May 2007, 12:55
yeah, but fdbg sources aren't much educative...
you can freely use fpu procedures - old versions of fdbg did calculations using FPU instructions, newer use CPU to avoid some FPU-based antidebug tricks the last version using FPU calculations is feryno.host.sk/ms/fdbg0010.zip read the file floating_proc.inc usage of debugger is nice and easy way to test what the instruction does ollydbg shows you everything in win32 and fdbg in win64 I suggest to read FASM help, chapter 2.1.13 FPU instructions for a start, FPU behaves as a stack with limit of 8 registers use fnitit before playing with FPU instructions (FPU may hold a mess from previous instructions...) you can push max 8 values into st0-st7 registers you can operate with 8 fpu registers (some instructions allow you to combine oparation with FPU register and value stored in memory) at the end you can pop values from register or access them without poping anyway |
|||
28 May 2007, 12:55 |
|
kohlrak 28 May 2007, 19:14
My computer says there's a problem with the zip, but i'll look at the other stuff. Thank you.
EDIT: Found what you're talking about. Actually, i was looking at that and going in order from top to bottom to figure out how to use the things. EDIT2: The following is a dump from visual studio, and how to translate that into fasm is anybody's guess, but i think that it would explain how to send things to printf. Code: 8: float a=4.56f; 00401028 mov dword ptr [ebp-4],4091EB85h 9: float b=1.23f; 0040102F mov dword ptr [ebp-8],3F9D70A4h 10: __asm int 3 ;placed here to intentionally crash ;the program so i could find this with ease 00401036 int 3 11: printf("%g", a, b); 00401037 fld dword ptr [ebp-8] 0040103A sub esp,8 0040103D fstp qword ptr [esp] 00401040 fld dword ptr [ebp-4] 00401043 sub esp,8 00401046 fstp qword ptr [esp] 00401049 push offset string "%e" (0042301c) 0040104E call printf (00401070) 00401053 add esp,14h |
|||
28 May 2007, 19:14 |
|
Plue 29 May 2007, 19:40
printf should work. But you must tell it the argument is a floating point value and not an integer.
|
|||
29 May 2007, 19:40 |
|
kohlrak 29 May 2007, 19:54
And if i figure out how to send it the variable, because the following dosn't work.
Code: cinvoke printf, <"%f", 0>, 4.3 Quote: 54376913213472293000000000000000000000000000000000000000000000000000000000000000 I'd be happy if you have any example code. EDIT: Found a nice little macro that helps called glpush, but that only works with constants, i still can't get it to work with variables. I'll keep trying to crack this... EDIT2: Got it working. I was using the GLfloat from tomasz's opengl.inc with the opengl example, and the GLfloat is 4 bytes, but you need to push 8 bytes. Lesson learned: Cstandard floats are 8 bytes, but the GL floats are 4 bytes. Do not use 8 bytes with gl calls and don't use 4 bytes with printf calls. You'll save yourself alot of agony that way. Aside from the differences in size, they apparently are treated the same way as each other in the FPU, so go ahead and use them. |
|||
29 May 2007, 19:54 |
|
Goplat 29 May 2007, 22:48
kohlrak wrote: Cstandard floats are 8 bytes, but the GL floats are 4 bytes. |
|||
29 May 2007, 22:48 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.