flat assembler
Message board for the users of flat assembler.
Index
> Windows > newbie needs help with windows 64 |
Author |
|
HaHaAnonymous 24 Mar 2013, 03:01
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 21:21; edited 1 time in total |
|||
24 Mar 2013, 03:01 |
|
bitRAKE 24 Mar 2013, 22:26
Regarding win64, a search for my posts will turn up some basic examples. Definitely get FDBG by ferno!
Shameless self promotion: Hilbert curve - plotter template http://board.flatassembler.net/topic.php?p=80896#80896 sub-classing control http://board.flatassembler.net/topic.php?p=94910#94910 use of nmake (two examples) http://board.flatassembler.net/topic.php?p=95073#95073 exception handling console app http://board.flatassembler.net/topic.php?p=109871#109871 |
|||
24 Mar 2013, 22:26 |
|
alessandro95 25 Mar 2013, 01:43
Thank you both, I'm looking at bitRAKE's links right now, truly interesting!
By the way, I'm pretty sure I have already seen your nick somewhere, project euler? |
|||
25 Mar 2013, 01:43 |
|
bitRAKE 25 Mar 2013, 02:58
Yeah, that's me.
Welcome! |
|||
25 Mar 2013, 02:58 |
|
alessandro95 28 Mar 2013, 01:22
And here I am with the noob question #2:
Right now I have Internet access only from my phone so I'll steal some bitRAKE's code from project euler: Code: ; for each integer from 1 to 1000 mov ecx, 3 mov esi, 3 mov edi, 5 xor ebx, ebx ; sum _0: mov eax, ecx xor edx, edx div esi test edx, edx je _yes mov eax, ecx xor edx, edx div edi test edx, edx jne _no _yes: add ebx, ecx _no: inc ecx cmp ecx, 1000 jne _0 OK, the code is very clear but how do you print or read the value of ebx once it.finished the calculations? |
|||
28 Mar 2013, 01:22 |
|
bitRAKE 28 Mar 2013, 01:27
I ran it in OllyDbg. Cliick at the end and push F2 or put an INT3 in the code, and push F9. Look at the register window.
Of course, you could write a console template to display results, but why? Get comfortable with the debugger - it's there to help and it speaks your language. http://www.ollydbg.de/ - is an excellent 32-bit debugger, works in Win64 on 32-bit code. |
|||
28 Mar 2013, 01:27 |
|
bitRAKE 28 Mar 2013, 15:41
Not sure where you are in the n00b-ness. Thought I'd post the minimal wrapper for you:
Code: format PE GUI 4.0 ; tell FASM what's up {put code HERE} int3 ; force debugger to stop retn ; lazy quit to Windows |
|||
28 Mar 2013, 15:41 |
|
bitRAKE 28 Mar 2013, 15:44
...and use this to debug with FDBG in 64-bit:
Code: format PE64 GUI 5.0 ; tell FASM what's up {put code HERE} int3 ; force debugger to stop retn ; lazy quit to Windows |
|||
28 Mar 2013, 15:44 |
|
alessandro95 29 Mar 2013, 07:39
thank you, this evening I'll finally have time to experiment a bit around, which means tomorrow I'll have a lot of other questions probably
|
|||
29 Mar 2013, 07:39 |
|
alessandro95 30 Mar 2013, 01:42
Ok, I played with the x87 FPU for a while, looks messy but was working, then I was trying another program and i encountered this (extremely stupid) problem:
Code: format PE GUI 4.0 number dd ? mov ecx,15 mov [number],ecx int3 retn the code compiles properly but doesn't do what it is supposed to, why? |
|||
30 Mar 2013, 01:42 |
|
alessandro95 31 Mar 2013, 03:16
Was my question that embarassing not to deserve an answer ?
|
|||
31 Mar 2013, 03:16 |
|
revolution 31 Mar 2013, 03:21
alessandro95: You never explained what your code is supposed to do.
But perhaps the problem is that you are executing from the address 'number' at program start? Anyhow, ollydbg would be an excellent way to see what is happening with the code. You can follow through one instruction at a time and watch it. |
|||
31 Mar 2013, 03:21 |
|
alessandro95 31 Mar 2013, 03:30
I just want to move the value of a register to somewhere in the memory (to pass it to the FPU later since it cannot be loaded directly from a register).
I looked at the program in olly but I cannot understand what's going on during the first 2 instruction (I'm posting from my mobile phone because I don't have internet access on my computer and I don't have my computer with me, otherwise I would post these 2 instruction), I'm just trying to reserve some space and move a value into it, nothing more than this |
|||
31 Mar 2013, 03:30 |
|
revolution 31 Mar 2013, 03:32
Perhaps the first two instruction are not what you expect. The CPU starts executing at 'number' (which contains four 0x00 bytes).
|
|||
31 Mar 2013, 03:32 |
|
alessandro95 31 Mar 2013, 03:35
They definetely aren't what I expect
and I now understood what you mean, I need to specify that the entry point is mov ecx,15 , right? |
|||
31 Mar 2013, 03:35 |
|
revolution 31 Mar 2013, 04:27
alessandro95 wrote: ... I need to specify that the entry point is mov ecx,15 , right? But maybe better if you move the variables to a different section from the code. That way when your code expands you will already have a good program layout to work from. |
|||
31 Mar 2013, 04:27 |
|
alessandro95 31 Mar 2013, 04:37
Ok, thank you!
|
|||
31 Mar 2013, 04:37 |
|
AsmGuru62 31 Mar 2013, 12:06
alessandro95:
You can find a 64-bit code example in FASM folder EXAMPLES\WIN64\PE64DEMO. Notice the 'entry' statement, where label is specified where to start the program. Also, notice that variables are in its own section, and code is in its own section too. |
|||
31 Mar 2013, 12:06 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.