flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2, 3 Next |
Author |
|
Madis731 03 Jun 2005, 18:47
Hi Privalov
What do you think about Nickolay's idea of putting assembly file's name to the taskbar? And BTW what does the 'dup' acronym mean? www.acronymfinder.com gave me "Data User Part" but that is only somewhat logical ![]() |
|||
![]() |
|
Nikolay Petrov 03 Jun 2005, 18:58
Wow people you are a very fast
![]() Midas731 - sorry, may be my sense of humor is a strangely. ![]() Privalov I agree. I use a primary fasm compiler for my prog and I have more problem with: proc bla, var1:byte,var2:float,var3:dword,... than "dup" |
|||
![]() |
|
Nikolay Petrov 03 Jun 2005, 19:20
Madis731 I "want" when I have a too many fasm windows opened, I to know what is the asm script. "tab" window is a good but this is information not put in the taskbar.
For me it doesn't matter if in taskbar write: flat assembler 1....[bla.asm] or bla.asm - flat assembler 1... Last edited by Nikolay Petrov on 03 Jun 2005, 19:29; edited 2 times in total |
|||
![]() |
|
shaolin007 03 Jun 2005, 19:26
Madis731 wrote: Hi Privalov dup=duplicate |
|||
![]() |
|
Tomasz Grysztar 03 Jun 2005, 20:49
Quote:
You might try such "proc" macro variant: Code: macro proc name,[arg] { common if used name name: virtual at ebp+8 if ~ arg eq forward label arg dd ? common end if ..ret = $ - (ebp+8) end virtual local ..data,..size if defined ..size virtual at ebp - ..size else if ..ret push ebp mov ebp,esp end if end if ..data: macro enter size,level \{ if size eq & level eq rb (4 - ($-..data) and 11b) and 11b if defined ..size ..size = $ - ..data end virtual else ..size = $ - ..data end if if ..ret | defined ..size push ebp mov ebp,esp if ..size sub esp,..size end if end if else enter size,level end if \} macro return \{ if ..ret | defined ..size leave end if if ..ret retn ..ret else retn end if \} } macro endp { purge return purge enter end if } It allows syntax like: Code: proc foo, arg1:byte, arg2:dword mov al,[arg1] mov ebx,[arg2] return endp But its weak point compared to standard fasm's "proc" macro is that the arguments are defined as global labels. BTW, I have also once tried to reorganize fasm's macros to use "ret" keyword instead of "return" in procedures, just like it should be with procedures (also for kind of compatibility with TASM), but there was too strong opposition, because (probably because of NASM style) people expect RET keyword to generate the near return opcode - while it is RETN and RETF that are the actual mnemonics for near and far return, and RET should be able to generate any of the two depending on the context. I still think using this original meaning of RET would be better. |
|||
![]() |
|
crc 03 Jun 2005, 23:05
Quote: Version 1.61.9 brings a small suprise: I have implemented the DUP operator - one more thing to make conversion from TASM/MASM easier (and also in some cases DUP is much more handy than NASM-style TIMES): Hmm, I use a macro named dup in my code. Will my macro still be useable without renaming it? (I'll try to test tomorrow, just to see). |
|||
![]() |
|
Tomasz Grysztar 03 Jun 2005, 23:12
Of course, there shouldn't be any problems. Macros and symbolic constants can override any keyword.
|
|||
![]() |
|
crc 04 Jun 2005, 00:57
Quote: Of course, there shouldn't be any problems. Macros and symbolic constants can override any keyword. Excellent! I just tested it, and sure enough it worked. Thanks for clarifying this for me. |
|||
![]() |
|
Tomasz Grysztar 07 Jun 2005, 14:20
The 1.61.10 release comes with one important fix and one new feature. The fix applies to ELF64 object output - I have misinterpreted the ELF64 specification according to the RELA relocations type and this caused previous versions to generate wrong code - now everything should be OK with ELF64 objects.
The new feature is the experimental "match" - the long awaited conditional preprocessing directive. However, as I wanted to base it on the macro handler in the similar way to "rept", I have designed it to allow even more interesting things. The simplest description is: "match" checks whether the given chain of symbols matches the given pattern. Pattern comes first, the comma and potentially matching symbols next: Code: match +,+ { ; this will be preprocessed } match +,- { ; there's no match, this won't be preprocessed } The special characters and quoted strings in pattern have to be matched exactly, like in the sample above, however if you put any name symbol in pattern, it will match any chain of symbols. If you need some symbol to be matched exactly as is, precede it with = character. Code: match alpha, 1+1 { } ; match match =alpha, 1+1 { } ; mismatch match =alpha, alpha { } ; match So the = is interpreted specialy in pattern and symbol following is treated as pattern element to be compared exactly, so it also allows to check for the comma in the pattern by preceding comma with =, and to check for = character with the == sequence. And what makes "match" something more than just simple conditional preprocessing is that the names which match any chain of symbols are then replaced inside the "match" block with those chains of symbols - just like macro parameters. For example: Code: match alpha+beta*gamma,1+2*3 { db alpha,beta,gamma } ; becomes db 1,2,3 Any name must match at least one symbol, it cannot match empty value: Code: match any, { } ; mismatch But each consecutive name is matched with as few symbols as possible: Code: match any other, 1+2*3 { db any ; db 1 db other ; db +2*3 } It should be obvious that this directive significantly extends the abilities of processing any macro parameters, se also the sample below. I haven't managed to design any good solution for something like "else match", however "fix" directive can help again (at least until something better is invented): Code: macro freeform [arg] { common DONE fix NO match src->dst, arg \{ mov dst,src \DONE fix YES \} match =NO dst<-src, DONE arg \{ mov dst,src \DONE fix YES \} match =NO, DONE \{ unrecognized syntax \} } freeform eax -> ebx ; mov ebx,eax freeform al <- [esi+1] ; mov al,[esi+1] Note that DONE constant is escaped inside "match" - this is required, because "match" (just like "rept") is processed similarly to macro, and therefore is actually processed twice - first it gets defined (and during the definition prioritized constants get replaced with their values) and only after the definition is completed preprocessor actually checks for the match and applies the macro when the match occurs. So if we wrote "DONE fix YES" inside the "match" block after the "DONE fix 0" definition, it would become "0 fix YES" before actuall processing of the macro (when the FIX directive would be interpreted) - thus the escaping was needed. This is a small flaw in my design, but I really think this is the best way how could I implement it. |
|||
![]() |
|
pelaillo 07 Jun 2005, 17:47
Quote:
How does the "any[blank]other" works here? Which are the symbols that work? |
|||
![]() |
|
Tomasz Grysztar 07 Jun 2005, 17:51
Both "any" and "other" match any chain of symbols, but both will take as few symbols as possible - and so "any" matches only one symbol leaving rest for the "other", and "other" has to take all the rest of symbols since there is nothing more in pattern.
|
|||
![]() |
|
Tomasz Grysztar 07 Jun 2005, 19:24
I've decided to disable replacing prioritized constant during the definition of in-place macro like "rept" or "match" - this will make it behave more like one would expect (at the cost of making impossible to "fix" any control operators for those structures).
|
|||
![]() |
|
revolution 08 Jun 2005, 08:45
Can it be made similar to IF so that the ~ will mean not matched?
Code: macro if_def name { match =defined,name \{ } macro if_ndef name { match ~ =defined,name \{ } |
|||
![]() |
|
vid 08 Jun 2005, 08:46
wow, preprocessor is becoming really messy... but at least we have lot of power with it.
I just like to know - is it possible to match "," character, since "<",">"s doesn't play any special role now...? |
|||
![]() |
|
revolution 08 Jun 2005, 08:52
Quote:
|
|||
![]() |
|
Tommy 08 Jun 2005, 10:00
This allows:
Code: macro .if [val] { common local __endif match a == b,val \{ cmp a,b jne __endif \} macro .endif \{ __endif: \} } Code: .if eax = 834 ; code goes here .endif ![]() |
|||
![]() |
|
Tomasz Grysztar 08 Jun 2005, 12:28
revolution: no, the matches would loose its macro-like sense (where the parameters obtained from "match" would be applied?) - it is designed to be something different that just something like "if".
|
|||
![]() |
|
Tomasz Grysztar 08 Jun 2005, 14:45
I've also got an idea that standard symbolic constants (defined with EQU) would be replaced in the matched symbols (the symbols after comma), so you could just use "DONE equ NO" etc. in the sample above (and reduce the need for FIX directive at all), and also "match =name,name" to check for not defined symbolic constant.
This would reduce need for the FIX directive only to the preprocessor symbol redefinition, since the other current applications could be substituted by use of "match" solely to replace the symbolic constants: Code: match replaced, arg { some_macro replaced } And then I could even try to redefine FIX directive (but break backward compatibility!!!) to get rid of the "double fixing" problems it causes. |
|||
![]() |
|
decard 08 Jun 2005, 20:07
I don't get everything about new "match" directive. Why this code doesn't work?
Code: macro .if [val] { common local __endif match a ==== b,val \{ cmp a,b jne __endif \} match a !== b,val \{ cmp a,b je __endif \} macro .endif \{ __endif: \} } mov eax,1 .if eax == 1 nop .endif It is attmpt to make more complex .if macro, that allows == and != operators for comparing... but when I compile this, the second match directive also inserts the code. |
|||
![]() |
|
Goto page Previous 1, 2, 3 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.