flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > File access in macro |
Author |
|
LocoDelAssembly 23 Jan 2010, 06:54
The short answer is that it is impossible to write to a file other than the output file.
But do you really want this? What would be the problem if those constants are generated every time? |
|||
23 Jan 2010, 06:54 |
|
alorent 23 Jan 2010, 08:47
Hello LocoDelAssembly,
Thanks for the fast reply. Well, the constants file will be generated when the .asm file is modified (makefile rules) The idea is that at the moment, when I add a new element I have to go to the constant file (.inc) and add an entry to it. After that, I go to another file (.asm) and associate the constant with the function name. So, it's like making double work and with the chances of introducing human typying errors I know that it might sound a bit stupid the above and you might think of other simpler solutions, but it has to be like that Well, my question should have been more general and it would have been: "Can I call an external application from FASM preprocesor?" So, that external application could do all that work to append to file or whatever we want. Well, maybe it's a good feature to add to FASM the support to call an external application from its preprocesor Thanks!!! |
|||
23 Jan 2010, 08:47 |
|
revolution 23 Jan 2010, 09:06
You could use display to output information to the console. You still have to strip the first and last lines (the fasm greeting and the assembly statistics).
Code: macro AddToList name,value { display `name," = ",`value,13,10 } |
|||
23 Jan 2010, 09:06 |
|
LocoDelAssembly 23 Jan 2010, 18:18
Ah I understand now, you want to make an object/dll library and have the "inc" for other programs to use?
Well, this might work: Code: format binary as '.inc' LIST equ macro AddToList name, value { LIST equ LIST `name = `value, } ; You'll need to overload some directives to make virtual work properly like "section", "segment", "format", etc. virtual include 'real_source.asm' end virtual match list, LIST { irp val, list \{ match a==b, val \\{ db \\`a, " = ", \\`b, 10 \\} \} } [edit]Well, it won't work with calculated constants, the new REPT feature introduced in FASM 1.69 might help a bit, but yet it won't be complete enough (things like "$-someLabel" won't be resolved)[/edit] |
|||
23 Jan 2010, 18:18 |
|
alorent 23 Jan 2010, 21:51
Thanks revolution and LocoDelAssembly!!! I think that I need some time to digest your solutions
Thanks a lot!!! |
|||
23 Jan 2010, 21:51 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.