flat assembler
Message board for the users of flat assembler.
Index
> Programming Language Design > On my new assembler Goto page Previous 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 Next |
Author |
|
Tomasz Grysztar 28 Jul 2017, 07:40
jacobly wrote: Another unintuitive thing I ran into was that jacobly wrote: Also, a few minor syntactical features from other compilers and assemblers that would be nice, but not strictly necessary and aren't really worth writing a macro for: jacobly wrote: \ followed by anything but whitespace and a comment acts like a newline (this is often used in z80 code for things like rrca \ rrca \ rrca \ rrca). There is no perfect solution to these problems, it is all about compromise. For example, fasmg still implements line concatenation and comments in a traditional way (compatible with fasm 1), even though this, for example, makes it impossible to use the ";" character in a custom syntax. I tried to find a balance in considering what might be more usually expected from fasm. |
|||
28 Jul 2017, 07:40 |
|
Tomasz Grysztar 28 Jul 2017, 08:20
Version hvj4j notices the "extra character on line" in the case you reported.
|
|||
28 Jul 2017, 08:20 |
|
jacobly 28 Jul 2017, 11:45
Hmm, I did not actually realize that those were used for other purposes by other assemblers (the only local label schemes I've ever seen are +_, @f, 0f), so that is indeed a good reason to not support them. I've also just come to the realization that by the time you are trying to support another assembler's syntax, you pretty much need a macro ? anyway, so there's no real reason to add things to fasmg that can already be supported in that way.
Is there any reason that a postpone ? block would be executed before all other values are resolved? Maybe I'm misunderstanding its purpose, but I'm trying to avoid a very slow loop that is the result of an unresolved variable evaluating to 0, but the loop really only needs to be executed once after the last pass. |
|||
28 Jul 2017, 11:45 |
|
Tomasz Grysztar 28 Jul 2017, 12:46
jacobly wrote: Is there any reason that a postpone ? block would be executed before all other values are resolved? Maybe I'm misunderstanding its purpose, but I'm trying to avoid a very slow loop that is the result of an unresolved variable evaluating to 0, but the loop really only needs to be executed once after the last pass. |
|||
28 Jul 2017, 12:46 |
|
ProMiNick 28 Jul 2017, 13:36
is for fasmg can be added version log?: what is done (like it done in fasm1).
|
|||
28 Jul 2017, 13:36 |
|
Tomasz Grysztar 28 Jul 2017, 14:30
ProMiNick wrote: is for fasmg can be added version log?: what is done (like it done in fasm1). |
|||
28 Jul 2017, 14:30 |
|
ProMiNick 28 Jul 2017, 14:44
And where it is? Link? (Or I `m stupid or my english is bad:I don`t found it) I feel 2nd...
|
|||
28 Jul 2017, 14:44 |
|
Tomasz Grysztar 28 Jul 2017, 15:19
I have linked it in a few places in this very thread.
|
|||
28 Jul 2017, 15:19 |
|
jacobly 28 Jul 2017, 17:08
Tomasz Grysztar wrote: The "postpone ?" needs not to define any constant or variables that may affect the other parts of source, because this is going to mess up the resolving and the additional passes are going to be needed. Code: a = b b = 1 shl 24 postpone ? repeat b - a end repeat end postpone Edit: In my more complex program, it actually gets run during passes 2 and 3, yet if I artificially add passes, everything works fine. Maybe I just have to actually use the variables that are defined solely for the postpone ? outside it for them to resolve first? Last edited by jacobly on 28 Jul 2017, 17:16; edited 1 time in total |
|||
28 Jul 2017, 17:08 |
|
Tomasz Grysztar 28 Jul 2017, 17:16
Ah, I see, you have found a kind of architectural bug there.
|
|||
28 Jul 2017, 17:16 |
|
Tomasz Grysztar 28 Jul 2017, 17:28
Please try it with the "hvjms" version.
|
|||
28 Jul 2017, 17:28 |
|
jacobly 28 Jul 2017, 17:44
Tomasz Grysztar wrote: Please try it with the "hvjms" version. |
|||
28 Jul 2017, 17:44 |
|
jacobly 30 Jul 2017, 05:37
Is it intentional for macro ? to get the lines of an included file but for macro ?! to skip them? I can sort of get around this with an interesting trick, but I still miss any unconditional macros at the top of the included file:
Code: macro ? temp& purge ? macro ?! line& display `line, 10 line end macro temp end macro include 'test.inc' purge ? I also just realized that trying to use macro ?! to parse syntax like .endif isn't going to work anyway since conditionally excluded lines aren't sent to macro ?!, so I will have to try something else. |
|||
30 Jul 2017, 05:37 |
|
Tomasz Grysztar 30 Jul 2017, 09:36
jacobly wrote: Is it intentional for macro ? to get the lines of an included file but for macro ?! to skip them? Also, since an unconditional interceptor catches all the lines that follow, no matter what they contain, it is useful when you need to completely alter the syntax in a section of source text and interpret all the lines "from scratch". It is not a good tool for selective preprocessing - to correctly assemble things like control directives and macro definitions you'd need to collect entire blocks of lines and then execute them appropriately. jacobly wrote: I can sort of get around this with an interesting trick, but I still miss any unconditional macros at the top of the included file (...) Code: macro ?! line& match =INCLUDE? path, line local text virtual db 'macro ?! l&',10 db ' display `l, 10',10 db ' l',10 db 'end macro',10 file path db 10,'purge ?' load text:$-$$ from $$ end virtual eval text else match =PURGE names, line purge names else match any, line display 'Ignored: ',`any,13,10 end match end macro include 'test.inc' jacobly wrote: I also just realized that trying to use macro ?! to parse syntax like .endif isn't going to work anyway since conditionally excluded lines aren't sent to macro ?!, so I will have to try something else. |
|||
30 Jul 2017, 09:36 |
|
jacobly 30 Jul 2017, 19:49
The eval trick doesn't actually work in my case because I'm using a local namespace so once you enter the include file, there's currently no way to even define an unconditional macro without preexisting context which eval would destroy. However, since I need neither label sizes nor dot-prefix style local labels, and since I will probably need to customize label defines anyway, I decided that it is easier to just redirect "label:" to "label := $" so that macros starting with a dot work anywhere inside the included file.
|
|||
30 Jul 2017, 19:49 |
|
Tomasz Grysztar 30 Jul 2017, 20:47
jacobly wrote: The eval trick doesn't actually work in my case because I'm using a local namespace so once you enter the include file, there's currently no way to even define an unconditional macro without preexisting context which eval would destroy. jacobly wrote: However, since I need neither label sizes nor dot-prefix style local labels, and since I will probably need to customize label defines anyway, I decided that it is easier to just redirect "label:" to "label := $" so that macros starting with a dot work anywhere inside the included file. |
|||
30 Jul 2017, 20:47 |
|
Tomasz Grysztar 04 Aug 2017, 18:14
Tomasz Grysztar wrote:
Additionally I experimented a bit with potential further levels of verbosity, like showing all the preprocessed lines in real time, but when testing it I noticed that it simply overwhelms with mostly useless information. A well-placed use of DISPLAY with the "-v2" option should be a better tool to debug macros rather than to blindly display every preprocessed line. |
|||
04 Aug 2017, 18:14 |
|
Tomasz Grysztar 11 Aug 2017, 16:20
The "-v2" switch turned out invaluable when I needed to figure out what in my MachO macros was causing few of my snippets to take excess passes. Thank you, jacobly, for this suggestion!
|
|||
11 Aug 2017, 16:20 |
|
Tomasz Grysztar 18 Sep 2017, 17:24
I have added another tiny bit of compatibility with fasm 1: fasmg now allows FORMAT BINARY AS 'EXT' directive so that it is possible to specify a file extension. Therefore the output path may now be omitted from the command line and when it is not present, fasmg generates the name of the output file automatically from the name of the source, just like fasm 1.
There are also some differences - the default extension is the lack of one. So the following command is not going to create any file: Code: fasmg nul -iDisplay(120) These additions open up a way for the option of generating multiple files from one source, which I've been planning for years. It would be limited to declaring the extensions of the produced files, analogously to the main file. |
|||
18 Sep 2017, 17:24 |
|
Goto page Previous 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.