flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
Tomasz Grysztar 04 May 2006, 07:20
No matter whether it'd be a good idea or not, I'm not going to add any new directives earlier than I finish the current documentation projects.
|
|||
![]() |
|
revolution 04 May 2006, 16:21
No problem, it can wait, no rush, it is just a thought I had.
|
|||
![]() |
|
rugxulo 05 May 2006, 03:51
imatch might be a better choice as it's similar to NASM's imacro, istruc, etc.
|
|||
![]() |
|
Tomasz Grysztar 05 May 2006, 07:57
But we don't have imacro and istruc either.
|
|||
![]() |
|
revolution 05 May 2006, 16:17
rugxulo: matchi/imatch either way seems fine by me. But let's not go too deep into the discussion until the docu's are finished.
|
|||
![]() |
|
rugxulo 05 May 2006, 16:34
I just meant that since FASM shares some (minor) similarities with NASM, maybe it should stick to using the i- prefix to indicate case insensitivity. I don't need (or really want) this feature anyways.
![]() Tomasz Grysztar wrote: But we don't have imacro and istruc either. Obviously. ![]() |
|||
![]() |
|
Borsuc 05 May 2006, 17:42
Here's me with another suggestion: "matchnum" or something like that.
Yes, I know preprocessor doesn't do calculations, but these are not calculations. It's just a matter of checking a number if it's greater than something, or lower than something, or equal. It shouldn't be that far off the design, since "rept" already uses 'numbers'. examples: Code: matchnum symbolic_constant1 <= symbolic_constant2 { } matchnum a > b { } It may not be useful at a first look, and things can be achieved without it, but it is much harder and overkill to do. I'm still talking about preprocessing stage here, I know assembly stage can do this, but sometimes I need it at preprocessor. |
|||
![]() |
|
Tomasz Grysztar 05 May 2006, 18:23
Look here for some of the reasoning: http://board.flatassembler.net/topic.php?t=4655
|
|||
![]() |
|
LocoDelAssembly 10 Jul 2007, 04:07
I know that Tomasz can't add anything right now but still some debate is needed for imacro I think. Suppose the following code
Code: macro Abc{display "Hi!"} imacro abc{display "Bye!"} macro aBc{display "fasm"} Abc ; (1) aBc ; (2) What do you think that fasm should display at (1), "Hi!" or "Bye!"? What about (2)? "fasm" or "Bye!"? I vote for "Bye!" at (1) and "fasm" at (2) which in other words mean that imacro creates all the possible combinations of case-sensitive macros (macro abc, macro abC, macro aBc, ...). Of course fasm must perform this internally in another way because this way is a terrible waste of memory but the goal is to keep the behaviour as if was really happening. PS: I forgot the other alternative I had in my mind ![]() PS2: Supposing my first idea also a ipurge would be needed. |
|||
![]() |
|
revolution 10 Jul 2007, 11:28
Hi LocoDelAssembly,
Your idea might be useful but for now I just can't see where it could make sense. Do you have any example of a suitable use that you can share with us? Personally I can only see this being useful in MATCH. MACRO, STRUC, PURGE and others don't seem to have any need for insensitive case matching. |
|||
![]() |
|
dead_body 10 Jul 2007, 13:00
imatch is the best idea, IMHO.
LocoDelAssembly, where do you need imacro? For what tasks? |
|||
![]() |
|
LocoDelAssembly 10 Jul 2007, 14:17
To take control over CPU instructions and assembler directives. You know, to "overload" the NOP instruction you need to do this:
Code: irps instr, nop noP nOp nOP Nop NoP NOp NOP{ macro instr\{...\} } It would be a pain to define every CPU instruction this way, and even if you write some script that do this for you imagine how much memory would waste an instruction like PREFETCHNTA. And as an example take a look at the assembly listing generator at macroinstruction forum, due to the lack of imacro any instruction that not have all of its characters in lowercase goes unnoticed by the generator. About taking control over assembler directives I haven't published something about that yet (because I'm still need to finish it ![]() About istruc (which I confess it was never in my mind), perhaps deserves its insensitive version too but only because it can be used for other purposes than defining types, if the latter wasn't possible then istruc would be pointless because types should be case sensitive IMHO. |
|||
![]() |
|
revolution 10 Jul 2007, 16:31
But macro and struc are the same except that struc requires you to put a label name to declare it.
Also, why do you need complete control over an instruction? I use the mixed upper case to revert to the original instructions in two of my snippets posted to this board (compatibility macros and arm literals). Without the ability to revert to the normal instruction the macros would not be useful. I think the lower case macro name for instruction overloading is adequate. OF COURSE REAL PROGRAMMERS DON'T TYPE IN UPPERCACE, Or mIxEd CaSe, but in lower case! ![]() |
|||
![]() |
|
LocoDelAssembly 10 Jul 2007, 17:13
If you want to revert to original instruction follow this.
The real life variations are all capitalized, only first letter capitalized and all lowercase. However, what about "typo errors"? I want to have a way to change behaviour without needing to modify fasm itself and since fasm allows all the unconventional combinations too I want to be able to change them as well. I also want to propose another variant. What about having separated stacks for macro/purge and imacro/ipurge? This idea recovers more sense with struc/istruc actually. Example Code: struc Message{.string rb 256} istruc Message{.:} . . . WM_TEXT message ; WM_TEXT: . . . text Message ; text.string rb 256 That way you define a capitalized sensitive version to define a "class" and an insensitive version to define a block. The case sensitive definition takes priority over the insensitive ones so fasm first looks up in the sensitive definitions stack and if fails then retries using the insensitive stack. This idea however must be looked carefully because since it doesn't rely on defining all combinations of macro we are really introducing new behaviour to the preprocessor which could led to unpredictible results. |
|||
![]() |
|
vid 10 Jul 2007, 17:27
Loco: some interesting cases:
Code: macro xy {db 0} imacro xy {db 1} xy ;db 1 Xy ;db 1 in this case, we could overload original case-sensitive "xy" with case-insensitive "xy". So that would mean "imacro" would beheave just like if we had defined all case variations of name to be this macro. Code: imacro xy {db 0} macro xy {db 1} xy ;db 1 Xy ;db 0 in this case, we will overload lowcase "xy" form, but not others. |
|||
![]() |
|
LocoDelAssembly 10 Jul 2007, 18:17
I'm aware of this situation but, what's the matter? The user must be aware that with "imacro nop" and "ipurge nop" happens this:
Code: macro nOp{display "fasm"} ;imacro nOp{display "Hi!"} irps name, nop noP nOp nOP Nop NoP NOp NOP{ macro name\{display "Hi!"\} } macro Nop {display "Bye!"} ;ipurge noP irps name, nop noP nOp nOP Nop NoP NOp NOP{purge name} Nop ; Displays "Hi!" nOp; Displays "fasm" |
|||
![]() |
|
LocoDelAssembly 10 Jul 2007, 18:40
Oh I forgot an aspect that concerns to imatch too.
Code: imacro hernán{display "It's me It's also important to specify if this will work for ASCII 7 bit only or will be able to handle locales(?). [edit]Added missing closing quote on code[/edit Last edited by LocoDelAssembly on 10 Jul 2007, 19:03; edited 1 time in total |
|||
![]() |
|
vid 10 Jul 2007, 18:54
Loco: No chance to handle locales, forget about it right now.
another interesting case is this: Code: imacro xxx {...} purge xxx what with it? ![]() |
|||
![]() |
|
LocoDelAssembly 10 Jul 2007, 19:13
In first proposal the other 7 combinations are still available and on last proposal purge has no effect at all.
PS: And your first example with separated stacks the result is "db 0"/"db 1" and "db 1"/"db 0" respectively. |
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.