flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
Tyler 07 Feb 2011, 03:53
That's GAS syntax. Fasm uses Intel syntax. But, even if you were to run that, it wouldn't do anything you could see because it has no output.
Intel: Code: Sum: push ebp mov ebp, esp mov ecx, ebp + 8 ; I think mov edx, ebp + 12 ; I think xor eax, eax test edx, edx je .L34 .L35: add eax, ecx add ecx, 4 dec edx jnz .L35 .L34: mov esp, ebp pop ebp ret |
|||
![]() |
|
edprog 07 Feb 2011, 04:25
Thank you Sir, But i do get errors, It also complains about the labels, do i need to put em some where?, I just need to make this compile correctly.
|
||||||||||
![]() |
|
revolution 07 Feb 2011, 04:26
edprog: What you have there is AT&T syntax and fasm can't assemble that.
And what you have is a function, not a program. You have to have a full program before you can run anything. fasm does not run code, it only assembles code for running later in your OS. BTW Tyler: Code: mov ecx, [ebp + 8] mov edx, [ebp + 12] |
|||
![]() |
|
edprog 07 Feb 2011, 04:35
Thank you revolution
Yes it is the code generated (per the book) from the function in C int Sum(int *Start, int Count) { int sum = 0; while(Count) { sum += *Start; Start++; Count--; } return sum; } I need to make it run somewhere, there is another program i will need to write with arrays but thats a topic for later,... so basically is there anyway I could see output when running this type of code?, like a manifest of how the data is allocated in memory or something.. some sort of output file? Thank you Gentlemen |
|||
![]() |
|
edprog 07 Feb 2011, 04:37
Or what can I use to run thes e programs, they give me two options
IA32 Code or Y86 Code.. I am jus tlost on where and how to run these programs.. Thank you |
|||
![]() |
|
edprog 07 Feb 2011, 04:44
After I ran the program with FASM, with your correction it compiles perfectly, is there anywhere i could see in more detail what the program is doing?, or how can I pass some parameters to this function to show me an output?, I know C, C++ but its the first time I am doing assembly.
Thank you |
|||
![]() |
|
revolution 07 Feb 2011, 04:55
Have a look at OllyDbg. You can follow the execution one instruction at a time. But you will need a small wrapper section to call the function with some values for it to make sense.
Code: include 'win32ax.inc' .data values: dd 34,78,12,3535,66 count =5 .code start: ccall Sum,values,count ;return value is in eax invoke ExitProcess,eax Sum: push ebp mov ebp,esp mov ecx,[ebp+8] mov edx,[ebp+12] xor eax,eax test edx,edx je .L34 .L35: add eax,[ecx] add ecx,4 dec edx jnz .L35 .L34: mov esp,ebp pop ebp ret .end start |
|||
![]() |
|
edprog 07 Feb 2011, 05:01
Thank you Revolution for helping me so mucch with this, I do get the following exception... I will also look at the link you provided.
|
||||||||||
![]() |
|
revolution 07 Feb 2011, 05:09
You forgot the 'x'. WIN32AX.INC. And you forgot the data defined for values. You can copy and paste the code from the forum into the fasm editor. I posted a complete source, you don't need to add anything else like 'format' to get it running.
Last edited by revolution on 07 Feb 2011, 05:10; edited 1 time in total |
|||
![]() |
|
edprog 07 Feb 2011, 05:10
Hello Revolution, I am sorry, I had other things there that were causing the compilation error. Now it works fine.. so I suppose it wont show the out-put right?
Thank you |
|||
![]() |
|
revolution 07 Feb 2011, 05:12
The exit code is the output sum. Not easy to use though.
But try OllyDbg anyway to help you understand what is happening. |
|||
![]() |
|
edprog 07 Feb 2011, 05:34
revolution wrote: The exit code is the output sum. Not easy to use though. Thank you revolutiuon, and how would i be able to see the exit code? |
|||
![]() |
|
revolution 07 Feb 2011, 05:37
edprog wrote: ... how would i be able to see the exit code? |
|||
![]() |
|
edprog 07 Feb 2011, 05:37
edprog wrote: Or what can I use to run thes e programs, they give me two options Which one should I download Download Download OllyDbg 1.10 (final version) Download Plugin Development Kit 1.10 (requires OllyDbg 1.10) Download free source of command line plugin (requires OllyDbg 1.08 or 1.10 and Borland's BCB 5.0) Older versions Download OllyDbg 1.08b (previous "official" release) Download Plugin Development Kit 1.08 Version 1.00 (mostly of historical value) |
|||
![]() |
|
revolution 07 Feb 2011, 05:40
Download OllyDbg 1.10 (final version), it is enough to start with.
|
|||
![]() |
|
edprog 07 Feb 2011, 05:44
Hello revolution,
I downloaded it, any tips on how to use it? Thank yoi |
|||
![]() |
|
JohnFound 07 Feb 2011, 05:46
You have to download OllyDbg 1.10 final.
OllyDbg is a debugger. It will load your program and will show you the instructions, registers and will execute the program instruction by instruction in order to show you how it works. |
|||
![]() |
|
edprog 07 Feb 2011, 05:56
Thank you Guys
So, this shall be my last question for the dat and I do appreciate your patience, by looking below, if I wanted to see at the result which line would it be it? Regards
|
||||||||||
![]() |
|
revolution 07 Feb 2011, 05:58
You didn't post enough of the picture. The exit code is at the bottom in the status bar. But you have to press F9 to run the program first.
|
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.