flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > Preprocess and don't assemble- is it possible? |
Author |
|
vid 03 Feb 2005, 20:29
search the forum, there was an easy way to rewrite source this way (altough i will like it more as comandl ine paramter)
|
|||
03 Feb 2005, 20:29 |
|
THEWizardGenius 04 Feb 2005, 03:34
I think I found it, but all it had was a broken link:
http://board.win32asmcommunity.net/showthread.php?s=&threadid=10289 This isn't much help... I was hoping Privavlov would know what to do, and maybe put into the next FASM (yeah I know, 1.57 JUST came out... I guess it'll be a bit of a wait until the next one comes out...) maybe if enough people think this is a good idea, he will. I doubt he'll put it in as a commandline option though, because (as he always says) commandline options should not be able to determine the output of the file- it's all packed into one file. I really don't care where he puts it, I just want that feature... maybe a directive such as: preprocess_only or something... I think it would be a cool idea. If he won't put it in, it would be nice if he'd tell us how... like I say, I don't understand this much, so he would have to give some sort of guide "replace this line with this" sort of thing like that... |
|||
04 Feb 2005, 03:34 |
|
vid 05 Feb 2005, 10:21
not directive but command line switch due to FASM philosophy. What you have found wasn't what i meant, it was on this forum.
|
|||
05 Feb 2005, 10:21 |
|
Tomasz Grysztar 05 Feb 2005, 12:15
If you want to see the preprocessed source, you can insert the following lines after the "call preprocessor" and before the "call parser" instruction in the fasm.asm file:
Code: mov edx,_preprocessed call create mov edx,[memory_start] mov ecx,[source_start] sub ecx,edx call write call close jmp parse _preprocessed db 'preproce.dat',0 parse: (you can jump directly to "exit_program" instead of "parse" if you want it to do preprocessing only). Then every preprocessed source will be written into preproce.dat file, but it will be in the fasm's source format (already described in guide to fasm's internals), you'll probably need to convert it into human-readable form. |
|||
05 Feb 2005, 12:15 |
|
vid 06 Feb 2005, 00:25
privalov: (once more this question) WHY don't you make it as command line parameter ?!?
|
|||
06 Feb 2005, 00:25 |
|
Tomasz Grysztar 06 Feb 2005, 02:51
1) The format of preprocessed source is not guaranteed to be the same in all versions.
2) It contains some address fields, which would have to be relocated to be usable after writing to file, converting it to other form would help, but: 3) Some of the original information is lost when converting to preprocessing format, for example the first four characters of macro definition directive are replaced by some address field. All of the above make any implementation of this feature "dirty" and I'd like to avoid implementing "dirty" features in official releases. |
|||
06 Feb 2005, 02:51 |
|
THEWizardGenius 22 Feb 2005, 23:00
Well can't we have like something that doesn't spit out the weird FASM code-format but normal assembly? Perhaps in a normal executable... For example, given the code
macro mymac someth { mov ax,someth } mymac 3 mymac 4 mymac 5 It would spit out this: mov ax,3 mov ax,4 mov ax,5 |
|||
22 Feb 2005, 23:00 |
|
JohnFound 23 Feb 2005, 00:27
Fresh IDE have some similar functionality, related to the source level debuger. For now you can't get the whole listing at once, but when you debug the program step by step in the source, there is additional window that show the code generated by macroses.
Unfortunately, the debuger is not finished and have a big lack of features, i.e. it is not very usefull for now. In the future, there will be implemented more features and I though about some "list" function. Again unfortunately, the debuger have low priority in my task list, so... stay tuned. Regards. |
|||
23 Feb 2005, 00:27 |
|
iklin 23 Feb 2005, 20:07
2 THEWizardGenius:
Get the attach, replace files in the fasm source dir and compile. You'll get the fasm 1.58l with listing feature by Privalov not by me! 2 Privalov: If I place Code: mov edx,_processed call create mov edx,[source_start] mov ecx,[code_start] sub ecx,edx call write call close jmp assemble _processed db 'proce.dat',0 assemble: after "call parser" and before "call assembler"... hmm... will I get in 'proce.dat' parsed but not assembled fasm source which format isn't described in guide to fasm's internals? If I'm right after "call parse" all macros will be expanded and so on?
|
|||||||||||
23 Feb 2005, 20:07 |
|
THEWizardGenius 24 Feb 2005, 21:39
No, it assembles into special codes on the first pass, codes that only FASM understands, and on the SECOND pass it assembles to machine code. Unless of course the file is really big.
|
|||
24 Feb 2005, 21:39 |
|
iklin 25 Feb 2005, 15:37
I said "before "call assembler"..." What I'll get after parse calling parser and before calling assembler? After preprocessing there will be full source with includes in fasm internal format and there will be after parsing?
It seems like pure asm code without macros in fasm internal format. Maybe we can convert this code to human-readable form? |
|||
25 Feb 2005, 15:37 |
|
decard 25 Feb 2005, 19:11
proably it wouldn't be so difficult to modify fasm code, strip everything after preprocessor, and make it emit human-readable code...
|
|||
25 Feb 2005, 19:11 |
|
iklin 26 Feb 2005, 05:41
After preprocessor macros isn't expanded and we get just listing with expanded "include" statements. And this work already done by Privalov for version 1.56 (e.g.) and I'm applied this to version 1.58. But as I said after parser it seems that all macros, equs and another things are expanded but fasm internal format after parser stage(s) isn't described in unfinished fasm internals docs.
|
|||
26 Feb 2005, 05:41 |
|
THEWizardGenius 01 Mar 2005, 18:47
I just want macros and include and struc and other preprocessor directives expanded, giving us a file with little or no preprocessor directives in it at all. I don't want the undocumented internal format of cryptic binary codes, or anything like that; just a normal assembly file. If this isn't possible, I guess it doesn't matter, but all this other "gibberish" I don't understand.
|
|||
01 Mar 2005, 18:47 |
|
d0dka 11 Mar 2005, 20:36
i have question 'bout macroses and structs in fasm inner representation. as 3Bh symbol marks the lcode as preprocessed, so i put line to output, but the starnge symbols appear replacing macro or structure reserved word. i'll try to find some explanations in fasm guide, but find nothing.
i have such symbols for macro: 6D byte byte 42h 00h for structs: 73h byte byte 42h 00h at first i think that is value of [ macro_state ], but second byte confusing me. can anyone tell what meaning of this bytes? |
|||
11 Mar 2005, 20:36 |
|
Tomasz Grysztar 11 Mar 2005, 21:52
The earlier fasm versions were storing there the 32-bit pointer to the header of first macro line. However it is no more true with fasm 1.59 - with the latest versions this is stored inside the macro entry in preprocessor's symbols table and the "macro"/"struc" symbol in source is kept unchanged.
But there is one more case when the original source symbol is corrupted by preprocessor - when you use the "struc" macro, the preprocessor puts the colon character after the structure label, cutting out the first character of structure name (as it's no longer needed after recognizing the macro). |
|||
11 Mar 2005, 21:52 |
|
mrpink 22 Aug 2005, 09:58
I've written a postprocessor for the preprocessor of fasm 1.60.
It can easily be integrated into fasm or used as standalone commandline tool(9 kB). It simply recodes the preprocesed data to a "compilable" and readable file. The output is a little bit formatted for better readability. If you can live with fasm version 1.60 and want to try it, please send me an email and I will send you the code. |
|||
22 Aug 2005, 09:58 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.