flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
vid
unfortunatelly, no.
only with some very dirty tricks, and i am not sure about it. |
|||
![]() |
|
revolution
Macros cannot be forward referenced, not ever, never, no chance, not possible. Except if you rewrite fasm.
|
|||
![]() |
|
vid
but you can store data in variables and forward reference variables... that's what i meant with "very dirty tricks"
|
|||
![]() |
|
Tomasz Grysztar
This "dirty trick" is closely related to this problem: http://board.flatassembler.net/topic.php?t=5934
|
|||
![]() |
|
Plue
revolution wrote: Macros cannot be forward referenced, not ever, never, no chance, not possible. Except if you rewrite fasm. It looks like what I want to do is actually possible by forward-referencing a variable from a macro and then generating the instructions from that macro. But I managed to do it some other way by buffering up all the code in between, writing the simple list of instructions without going through the buffer, and then writing the buffer. (I am writing a compiler.) _________________ Roses are red Violets are blue Some poems rhyme And some don't. |
|||
![]() |
|
revolution
Plue wrote: As I said, I don't need full macro functionality, only a simple list of instructions. Plue wrote: I am writing a compiler. |
|||
![]() |
|
Plue
revolution wrote:
Macro SymbolName { Simple list of instructions < Here!!! ![]() .. } Quote:
_________________ Roses are red Violets are blue Some poems rhyme And some don't. |
|||
![]() |
|
Goplat
revolution wrote: Macros cannot be forward referenced, not ever, never, no chance, not possible. ![]() Code: match =1,second { mymacro } match =second,second { macro mymacro \{ db "blah" \} second equ 1 include 'fwdmac.asm' } |
|||
![]() |
|
vid
Goplat:
![]() |
|||
![]() |
|
revolution
Goplat wrote: Sounds like a challenge Okay, I change my statement a little. How about this: Macros cannot be forward referenced in a useful way, not ever, never, no chance, not possible. Hehe, now the challenge is to make it useful ... ![]() |
|||
![]() |
|
Mr_Silent
2 revolution: What is your meaning of "useful"?
Code: .maincode fix _main macro _main { macro tag_main { } ;------------------------------------------------------------------------------ .postdef fix } _post macro _post { macro tag_post { } ;------------------------------------------------------------------------------ .end fix } _end macro _end { tag_post tag_main } ;////////////////////////////////////////////////////////////////////////////// .maincode zb sb1,'a','b','z','x' zd sd1,'a','b','z','x' .postdef macro zd p1,[p2] \{ \common label p1 \forward dd p2 \common dd 0 \} macro zb p1,[p2] \{ \common label p1 \forward db p2 \common db 0 \} .end |
|||
![]() |
|
revolution
Mr_Silent: I think your code does not address the problem of defining the macros after you instantiate it. You code defines a few macros but does not use any of them until the final ".end" statement.
Goplat posted a nice example of reassembling the same file again that simulates defining macros after they are used, but I think it is not useful in any real program. It was all in good fun and my challenge was not anything serious. I would be delighted to see a real-world working example of Goplat's idea given above. |
|||
![]() |
|
Mr_Silent
revolution wrote: I think your code does not address the problem of defining the macros after you instantiate it. Of course, it doesn't ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
|||
![]() |
|
revolution
Mr_Silent wrote: Or did you want the community to find some critical bu... err... feature which will allow normal fwd-ref ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.