Message board for the users of flat assembler.
> Main > FASM Standard library: macroinstructions
Macroinstruction library is very important in FASM Std Lib. Well designed macros will make writing programs easier, that's obvious. Macro library that is included in FASMW package should be used as a base, we will only extend it in some aspects. I mean extended version of win32a.inc file, only with some "patents" from win32ax.inc.
How program using StdLib should look? I have some suggestion, of course it needs some changes:
; simple program that calculates GCD format PE console 4.0 include '%fasmlib%/fasmlib.inc' use_dll kernel32,crtdll .code ; read numbers cinvoke printf, _prompt cinvoke scanf, _read_pattern,a,b ; calculate GCD mov eax,[a] mov edx,[b] mov [pt.x],eax mov ebx,[pt.x] compare: cmp eax,edx jae substract xchg eax,edx substract: sub eax,edx jnz compare cinvoke printf, _result, [a],[b],edx invoke ExitProcess,0 .data _prompt db 'Enter two numbers: ', 0 _read_pattern db '%d%d', 0 _result db 'GCD (%d,%d)=%d', 0 a dd ? b dd ? pt POINT .idata
use_dll and .idata macros will automatically include files with needed equates and import functions (just with some better name).
Additionaly (not present in this example) iglobal/uglobal macros will be used for declaring variables in multi-file projects.
That's my suggestion, proably have to be modified. What's your opinion about it?
|15 Jun 2005, 13:35||
i would take another approach.
1. I suggest writing library from scrap, privalov's macrolibrary IMO isn't standardized in way we should want. We also may need to change some definitions. And we sholdn't leave developing of basic macrolibrary on privalov
2. macros starting with ".", we shouldn't definitively use these, they cause trouble at defining struc member ".data" for example etc. And I thought we agreed on "word_word" name form.
3. macro library shouldn't be one big file, i think it should be set of "macro packs" in independent files, and basically user should include them all himself. Of course later we can make include-all-files, but i think this should be left on user. In bigger project you only need to write such file once, and it's worth knowing what you really include and also decrease preprocessing time.
I post my idea at Main -> Fasm Standard Library concept by vid, take a look at it.
|16 Jun 2005, 08:35||
< Last Thread | Next Thread >
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.