flat assembler
Message board for the users of flat assembler.
Index
> Windows > 32 bit code to 64 bit code Goto page 1, 2 Next |
Author |
|
HaHaAnonymous 17 Oct 2013, 18:15
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 19:44; edited 1 time in total |
|||
17 Oct 2013, 18:15 |
|
AsmGuru62 17 Oct 2013, 18:39
This may help:
http://msdn.microsoft.com/en-us/library/ms235286.aspx |
|||
17 Oct 2013, 18:39 |
|
HaHaAnonymous 17 Oct 2013, 18:48
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 19:44; edited 1 time in total |
|||
17 Oct 2013, 18:48 |
|
patchariadog 17 Oct 2013, 22:02
thanks guys
I looked at the link AsmGuru62 gave http://msdn.microsoft.com/en-us/library/ms235286.aspx so I then looked at tutorials for SSE and I found this http://neilkemp.us/src/sse_tutorial/sse_tutorial.html#C so then I tried a simple test to see if I could divide numbers using SSE Code: mov [buffer1],20 mov [buffer2],2 mov rax,[buffer1] mov rbx,[buffer2] MOVUPS XMM0, [RAX] MOVUPS XMM1, [RBX] DIVPS XMM0, XMM1 MOVUPS dqword[buffer1], XMM0 but the code crashes my exe. I determined that the crash happens on the MOVUPS XMM0, [RAX] line so is their something I need to enable to use SSE? can someone please show me some code, because I still dont get how to convert my code to 64 bit |
|||
17 Oct 2013, 22:02 |
|
HaHaAnonymous 17 Oct 2013, 23:20
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 19:43; edited 1 time in total |
|||
17 Oct 2013, 23:20 |
|
patchariadog 18 Oct 2013, 14:19
ok so I changed the code like you said HaHaAnonymous and it does not crash anymore.
the result should be 10 (20/2) It now will give me a result in the textbox but it is always the same number like 4251078 I know this is just a formatting problem so how can I format the result. this is what I have tried Code: mov [buffer1],20 mov [buffer2],2 mov rax,buffer1 mov rbx,buffer2 MOVUPS XMM0, [RAX] MOVUPS XMM1, [RBX] DIVPS XMM0, XMM1 MOVUPS dqword[buffer1], XMM0 cinvoke wsprintfA,addr buffer5,"%u",buffer1 invoke SetDlgItemTextA,[hwnd],unitofmeasurementtextbox,addr buffer5 this gave me the 4251078 and Code: mov [buffer1],20 mov [buffer2],2 mov rax,buffer1 mov rbx,buffer2 MOVUPS XMM0, [RAX] MOVUPS XMM1, [RBX] DIVPS XMM0, XMM1 MOVUPS dqword[buffer1], XMM0 cinvoke sprintf, addr buffer2, "%.16lf", dword [buffer1], dword [buffer1 + 4] invoke SetDlgItemTextA,[hwnd],resultlengthxtextbox,addr buffer2 gave me still 0.00000000 if possible I would rather use the scanf because I can set the precision of the result thanks |
|||
18 Oct 2013, 14:19 |
|
HaHaAnonymous 18 Oct 2013, 15:52
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 19:43; edited 1 time in total |
|||
18 Oct 2013, 15:52 |
|
patchariadog 18 Oct 2013, 16:04
I was just using the 20 and 2 for example.
this is what I want to do. their is 3 textboxes one has always a whole number like 512 or 680 one has always a whole number like 512 or 680 one has a user defined measurement that could be a whole number or a decimal like 2 or 2.23 my 32 bit application read both of the whole number values in to buffers then called sscanf on them with the %f format. then it divided them using the fpu and put the result in a buffer. then it took the answer and multiplied it by the third textbox that contains a whole number or decimal and wrote the new answer to the answer textbox an example would be like this 200/87*2.32 = answer in answer textbox that is what I want to do with sse and 64 bit so how can I do that I also tried this but now it crashes again mov rax,20.0 mov rbx,2.0 MOVupsXMM0, [RAX] and mov rax,20.0 mov rbx,2.0 MOVss XMM0, [RAX] and mov rax,20.0 mov rbx,2.0 MOVsd XMM0, [RAX] all make it crash |
|||
18 Oct 2013, 16:04 |
|
HaHaAnonymous 18 Oct 2013, 16:18
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 19:43; edited 1 time in total |
|||
18 Oct 2013, 16:18 |
|
patchariadog 18 Oct 2013, 16:36
thanks for that. I am pretty sure it is now dividing and storing the correct value in xmm0 but the problem is how do I format xmm0 so that the user can see the real result, because it still shows a fake number like 4540154 or 0.000000
|
|||
18 Oct 2013, 16:36 |
|
HaHaAnonymous 18 Oct 2013, 19:07
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 19:43; edited 1 time in total |
|||
18 Oct 2013, 19:07 |
|
patchariadog 19 Oct 2013, 00:24
does anyone know of a way how to use sprintf in 64 bit or how to format the number in just assembly
this is the line I use in 32 bit Code: cinvoke sprintf, addr buffer2, "%.16lf", dword [buffer1], dword [buffer1 + 4] buffer1 has the number and buffer2 is empty and it gets the formatted number |
|||
19 Oct 2013, 00:24 |
|
HaHaAnonymous 19 Oct 2013, 01:19
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 19:42; edited 1 time in total |
|||
19 Oct 2013, 01:19 |
|
patchariadog 19 Oct 2013, 16:21
first off thanks for all the help
okay this is the code I am running now Code: mov dword[buffer1],20.0 mov dword[buffer2],2.0 mov rax,buffer1 mov rbx,buffer2 MOVUPS XMM0, [RAX] MOVUPS XMM1, [RBX] DIVsd XMM0, XMM1 MOVUPS dqword[buffer2], XMM0 lea rdi,[buffer2] ; format = "%lf" mov rsi,"%lf" mov rdx,rdi invoke MessageBoxA,[hwnd],abouttext,title,MB_OK call qword [sprintf] invoke SetDlgItemTextA,[hwnd],resultlengthxtextbox,addr buffer2 for some reason if I remove the message box(which is what I want) it crashes when it calls sprintf If I leave the message box in it gives me a number but in the Unicode format like -yy? although it is giving different symbols for different calcs so it is probably working just not displaying them in a readable way. how can I get it to show me 20.0/2.0 = 10.0 instead of -yy? |
|||
19 Oct 2013, 16:21 |
|
HaHaAnonymous 19 Oct 2013, 17:09
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 19:42; edited 1 time in total |
|||
19 Oct 2013, 17:09 |
|
patchariadog 19 Oct 2013, 17:34
I typed in the exact code you gave me and it gives me an empty textbox. I even pasted the code in a new template project and it is still a empty textbox
I think the problem is do I have to move the xmm0 into a buffer after the divss? this is the line right after the divss code I was using before Code: MOVUPS dqword[buffer2], XMM0 also dont the buffers have to be dq instead of dd because they are in a 64 bit program? also you change the mov rdx,rdi line with xor rdx,rdx when I change this 1 line in the above code I posted that gives me -yy? if I use mov rdx,rdi it crashes if I use xor rdx,rdx it does not crash but the textbox is empty if I use mov rdx,rdi with messagebox it gives me -yy? thanks |
|||
19 Oct 2013, 17:34 |
|
HaHaAnonymous 19 Oct 2013, 21:45
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 19:41; edited 3 times in total |
|||
19 Oct 2013, 21:45 |
|
patchariadog 20 Oct 2013, 00:03
I also got this
Code: invoke GetDlgItemTextA, [hwnd], resultlengthypixelstextbox, bufferbufferf1, 100 cinvoke sscanf, bufferbufferf1, "%f", bufferf1 ;read in MeasuredlengthYinpixelstextbox invoke GetDlgItemTextA, [hwnd], measuredlengthypixelstextbox, bufferbufferf2, 100 cinvoke sscanf, bufferbufferf2, "%f", bufferf2 ;resultlengthYpixels / MeasuredlengthYpixels finit fild qword [bufferf1] fild qword [bufferf2] fdivp fstp qword [bufferf3] cinvoke sprintf, addr bufferf1, "%.16lf", qword [bufferf3], qword [bufferf3+8] invoke SetDlgItemTextA,[hwnd],resultlengthytextbox,addr bufferf1 it give me anywhere from 0.9513214 to 1.0184798 no matter what numbers I give it the data are all dq |
|||
20 Oct 2013, 00:03 |
|
HaHaAnonymous 20 Oct 2013, 14:44
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 19:41; edited 1 time in total |
|||
20 Oct 2013, 14:44 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.