flat assembler
Message board for the users of flat assembler.
Index
> Windows > Windows Console Programming? |
Author |
|
rhyno_dagreat 26 Jan 2009, 02:52
Hey... I was wondering how would I write a console "Hello World!" app in FASM?
|
|||
26 Jan 2009, 02:52 |
|
asmcoder 26 Jan 2009, 03:20
[content deleted]
Last edited by asmcoder on 14 Aug 2009, 14:53; edited 1 time in total |
|||
26 Jan 2009, 03:20 |
|
rhyno_dagreat 27 Jan 2009, 04:12
Thanks, but I mean is there a way to call PrintF in FASM?
Also, rather than using "invoke" is it possible to use "call" for OS functions? Thanks! |
|||
27 Jan 2009, 04:12 |
|
revolution 27 Jan 2009, 04:32
rhyno_dagreat wrote: Thanks, but I mean is there a way to call PrintF in FASM? rhyno_dagreat wrote: Also, rather than using "invoke" is it possible to use "call" for OS functions?! |
|||
27 Jan 2009, 04:32 |
|
asmcoder 27 Jan 2009, 05:02
[content deleted]
Last edited by asmcoder on 14 Aug 2009, 14:53; edited 1 time in total |
|||
27 Jan 2009, 05:02 |
|
Picnic 27 Jan 2009, 16:45
rhyno_dagreat wrote:
Hi rhyno_dagreat, If you don't like invoke -the way it sounds- you can use fix to replace it with something else. Code: format pe console include 'win32ax.inc' ; + CRTDLL.DLL api fix invoke print fix cinvoke printf, .data text db 'Hello World!',0 .code main: print text api ExitProcess, 0 .end main |
|||
27 Jan 2009, 16:45 |
|
rhyno_dagreat 27 Jan 2009, 21:01
Thank you all for the help!
When I'm pushing params on the stack, do I push them in the order they go in, or reverse order? Also I was hoping to be able to use the C-library. Truth be told, I'm very new to Windows programming in ASM, so I don't know where to begin with it or what is needed to write a program - especially when it comes to console programming (which is something I would like to know how to do first). But I do know that I like using classic-style ASM routines which means call instead of invoke and such. Thanks! |
|||
27 Jan 2009, 21:01 |
|
bitRAKE 28 Jan 2009, 02:58
I have an example using MSVCRT.DLL, but it's 64-bit:
http://board.flatassembler.net/topic.php?p=86947#86947 ...32-bit would be pushing the arguments in reverse order, and correcting the stack, iirc. |
|||
28 Jan 2009, 02:58 |
|
Azu 17 Feb 2009, 11:38
revolution wrote: With one exception all Win32 API function are stdcall compliant I thought stdcall was the same as invoke except it doesn't put the [] automatically.. :s |
|||
17 Feb 2009, 11:38 |
|
revolution 17 Feb 2009, 11:46
Unlike other Windows functions, wsprintf uses the C calling convention (_cdecl), rather than the Pascal calling convention. As a result, it is the responsibility of the calling process to pop arguments off the stack, and arguments are pushed on the stack from right to left. In C-language modules, the C compiler performs this task.
|
|||
17 Feb 2009, 11:46 |
|
Azu 17 Feb 2009, 11:58
Interesting, thanks!
I think the C calling convention would make more bloated code then. |
|||
17 Feb 2009, 11:58 |
|
bitRAKE 17 Feb 2009, 17:08
Not necessarily, the parameter stack space broadens the interface between caller and callee beyond the single return value. A more cohesive design can reuse this space in very productive ways - stack correction being used rarely.
|
|||
17 Feb 2009, 17:08 |
|
revolution 17 Feb 2009, 18:45
bitRAKE wrote: Not necessarily, the parameter stack space broadens the interface between caller and callee beyond the single return value. A more cohesive design can reuse this space in very productive ways - stack correction being used rarely. And Azu is correct, many a C program is bloated these days. But that has nothing to do with the calling standard |
|||
17 Feb 2009, 18:45 |
|
Yardman 18 Feb 2009, 00:08
[ Post removed by author. ]
Last edited by Yardman on 04 Apr 2012, 03:27; edited 1 time in total |
|||
18 Feb 2009, 00:08 |
|
Azu 18 Feb 2009, 00:53
bitRAKE wrote: Not necessarily, the parameter stack space broadens the interface between caller and callee beyond the single return value. A more cohesive design can reuse this space in very productive ways - stack correction being used rarely. |
|||
18 Feb 2009, 00:53 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.