flat assembler
Message board for the users of flat assembler.

Index > Main > Redefining the syntax (flat assembler 1.61)

Goto page Previous  1, 2, 3, 4, 5  Next

Do you like the proposed changes (read below)?
Yes
96%
 96%  [ 24 ]
No
4%
 4%  [ 1 ]
Total Votes : 25

Author
Thread Post new topic Reply to topic
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt 13 Jun 2005, 22:34
Hello everyone,
Will the old macro syntax be supported as well? maybe you can rename the macro folder oldmacros or something for compatibility. Two other requests, (1) could make an exit macro for the '.while' and '.repeat' macros, and (2) I posted this in the IDE forum but apparently nobody is looking so I'll post it here, Would it be to much trouble to add a 'block tab left' and a 'block tab right' to the edit menu, maybe in the options menu you can set the amount of spaces to tab over as well.
MadMatt
Post 13 Jun 2005, 22:34
View user's profile Send private message Reply with quote
halyavin



Joined: 21 Aug 2004
Posts: 42
halyavin 14 Jun 2005, 09:54
I need separate IncludeIGlobals and IncludeUGlobals macros.
Previously I use this:
Code:
IncludeIGlobals
endofcode: 
IncludeUGlobals
end_of_program:
    

What kglobals.inc I need now?
Post 14 Jun 2005, 09:54
View user's profile Send private message Visit poster's website Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 602
Location: Germany
MCD 14 Jun 2005, 10:40
Yep, I think you, Privalov, should first add an obselete flag to each topic, or even better, make an obsolete section on this board. And I think it's not your response to move/reedit them all, but rather tell each moderator to move obsolete topics from his section into an own, obsolete section. Anyway, it will be hard work whatever you do.
Just think of all the work needed for all those people working on bigger projects in fasm, like Fresh or MenuetOS. Not quiet to mention the updating problems I got...

Luckily this only applies to the preprocessor, especially macro bodies, which usually doesn't make the most part of a code.

_________________
MCD - the inevitable return of the Mad Computer Doggy

-||__/
.|+-~
.|| ||


Last edited by MCD on 14 Jun 2005, 14:54; edited 1 time in total
Post 14 Jun 2005, 10:40
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 14 Jun 2005, 14:11
halyalvin: I have updated the macros above.
Post 14 Jun 2005, 14:11
View user's profile Send private message Visit poster's website Reply with quote
MCD



Joined: 21 Aug 2004
Posts: 602
Location: Germany
MCD 14 Jun 2005, 14:53
WTH does "halyalvin:" mean?

upps, missed this strange nick Shocked Confused


Last edited by MCD on 15 Jun 2005, 08:23; edited 1 time in total
Post 14 Jun 2005, 14:53
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 14 Jun 2005, 18:12
Look at three posts above yours'
Post 14 Jun 2005, 18:12
View user's profile Send private message Yahoo Messenger Reply with quote
halyavin



Joined: 21 Aug 2004
Posts: 42
halyavin 16 Jun 2005, 05:46
Privalov
Now it works. Cool
Post 16 Jun 2005, 05:46
View user's profile Send private message Visit poster's website Reply with quote
halyavin



Joined: 21 Aug 2004
Posts: 42
halyavin 16 Jun 2005, 07:13
Misprint in documentation at page approximately 70.
Written:
Quote:
For example \{ is treated as single symbol, but during processing of the macroinstruction becomes the } symbol.

Right:
Quote:
For example \{ is treated as single symbol, but during processing of the macroinstruction becomes the { symbol.
Post 16 Jun 2005, 07:13
View user's profile Send private message Visit poster's website Reply with quote
halyavin



Joined: 21 Aug 2004
Posts: 42
halyavin 16 Jun 2005, 07:31
Code:
;win32wxp.inc
macro allow_nesting
{ macro pushd value
  \{ match ,value \\{
      pushx equ \\}
     match pushx =invoke proc,pushx value \\{
      invoke proc
      push eax
      pushx equ \\}
     match pushx,pushx \\{
      pushd <value>
      pushx equ \\}
     restore pushx \}
...
    

May be
Code:
 
match =pushx =invoke proc,pushx value 
    

and
Code:
match =pushx,pushx
    

strings should be written here?
Post 16 Jun 2005, 07:31
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 16 Jun 2005, 08:05
What do you mean? Confused
Post 16 Jun 2005, 08:05
View user's profile Send private message Visit poster's website Reply with quote
halyavin



Joined: 21 Aug 2004
Posts: 42
halyavin 17 Jun 2005, 12:04
I often see construction
Code:
match =something ...,something ...\{
...
something equ
\}
match =something ...,something ...\{
...
something equ
\}
...
purge something
    

But previous code in win32wxp.inc don't follow this scheme. Is this an error?
Post 17 Jun 2005, 12:04
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 17 Jun 2005, 12:29
Oh, I see what you mean (sorry - didn't read to carefully the last time). But this:
Code:
match pushx,pushx    

just checks whether "pushx" hasn't an empty value. Could be written also this way:
Code:
match any,pushx    

The first one of course also replaces the "pushx" inside the match block with the matched value, but when "pushx" is not empty, it doesn't have any value assigned at all, so this will replace "pushx" with "pushx" and everything works.
Of course for the same reason your modification would also work correctly.
Post 17 Jun 2005, 12:29
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 21 Jun 2005, 10:11
Privalov wrote:
macro ifndef name { match =name, name { }

does that mean equates aren't replaced on the left side of match?
Post 21 Jun 2005, 10:11
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 21 Jun 2005, 10:15
Indeed - please read carefully the new section 2.3.7 in the manual - I've written it with the purpose to clear out such things about the preprocessing.

The symbols in pattern are more like the definition of parameters for macro, so this should give some intuition about using them.
Post 21 Jun 2005, 10:15
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 21 Jun 2005, 11:17
Privalov wrote:
Some cryptic macro sample just for the fun of it: Wink
Code:
include 'win32ax.inc'

macro AddAPI param { match (name),param \{ macro name [params] \\{ \\common match (args),params \\\{ invoke name,args \\\} match =dd any,params \\\{ name dd any \\\} \\} \} }

.code

  start:

        AddAPI(MessageBox);
        AddAPI(ExitProcess);

        MessageBox(HWND_DESKTOP,"Hi! I'm the example program!","Win32 Assembly",MB_OK);

        ExitProcess(0);

.end start    

If you can make this to allow nesting, like ExitProcess(GetLastError()), then Randall Hyde MUST rewrite his assemblers review. Or he can even stop his HLA project, FASM wont be HLA's backend, but HLA will be FASM's macro-extension Very Happy Very Happy Very Happy
Post 21 Jun 2005, 11:17
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 23 Jun 2005, 15:27
Privalov:
FASM Manual wrote:
This label will be also attached at the beginning of every name starting with dot in the contents of macroinstruction.

and
FASM Manual wrote:
If somewhere inside the definition of structure the name consisting of a single dot it found, it is replaced by the name of the label for the given instance of structure and this label will not be defined automatically in such case, allowing to completely customize the definition.

Once you speak about appending names to labels, second time you speak about defining labels and thus namespace, which are different thing. I think (due to behior) second one should be "... instance of structure and this label won't be attached to names starting with dots anywhere in structure, allowing ...". Please justify this.
Post 23 Jun 2005, 15:27
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 23 Jun 2005, 15:31
No, this would mean that this:
Code:
struc foo
{ label .
  .x dd ? }
a foo    

is preprocessed to:
Code:
label a
.x dd ? ; wrong explanation     

while it actually is:
Code:
label a
a.x dd ?    

as opposed to:
Code:
struc foo { .x dd ? }
a foo    

which becomes:
Code:
a: a.x dd ?    
Post 23 Jun 2005, 15:31
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 23 Jun 2005, 16:50
You didn't mention anywhere that such label ("a") gets defined. I think you should add it to documentation
Post 23 Jun 2005, 16:50
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 15 Jun 2006, 20:18
decard: you should have looked at fasmlib macros:

Code:
macro idata arg
{
  __IData equ __IData,   ;add one ',' to __IData, initial "__IData" before ','s will be used to call macro
  macro __IDataBlock     ;begin macro (or overload old one) which holds data inside "idata" block
  arg
}

macro udata arg
{
  __UData equ __UData,
  macro __UDataBlock
  arg
}

;include all "idata"-defined blocks
macro IncludeIData
{
  macro __IData dummy,[n]  ;create macro which will be invoked, [n] makes sure macro's forward will
  \{                       ;be preprocessed for each ',' added to __IData
    \forward
       __IDataBlock        ;use the macro with data
       purge __IDataBlock  ;and remove it so previous macro becomes avilable
  \}
  match I, __IData \{ I \} ;and now unroll __IData macro (just "__IData" wouldn't do, replaced equate isn't
                           ;preprocessed anymore and so it wouldn't beheave as macro usage)
  purge __IData            ;__Idata macro is not needed anymore
}


;include all "udata"-defined blocks
macro IncludeUData         ;... same as IncludeIData but it is whole in virtual to count size and define labels
{                          ;and then required space is reserved
  macro __UData dummy,[n]
  \{
    \common
       \local ..begin, ..size
       ..begin = $
       virtual at $
    \forward
       __UDataBlock
       purge __UDataBlock
    \common
       ..size = $ - ..begin
       end virtual
       rb ..size
   \}
  match U, __UData
  \{
    U
  \}
  purge __UData
}    
Post 15 Jun 2006, 20:18
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body 17 Jul 2006, 08:42
Code:
;This file contains a test version of hllToFunc macro.
;Use(Initialize): 
;hllToFunc MessageBox,ExitProcess
;Test string:
;ExitProcess(<MessageBox(0,"Bear","Good Morning.",0)>)
macro hllToFunc [func]
{
        macro func      [sParam]
        \{
                \common
                define status 0
                match =0 (),status sParam                       ;call with no args
                \\{
                        call [func]
                        define status 1
                \\}
                match =0 (args),status sParam           ;we have string like (arguments).
                \\{
                        macro push_args [arg]                   ;we define push_args macro.
                        \\\{
                                \\\reverse                                      ;change common to reverse.
                                define status2 0
                                match =0 func(),status2 arg     ;no arguments?
                                \\\\{
                                        call [func]
                                        push eax
                                        define status2 1
                                \\\\}
                                match =0 func(args?),status2 arg        ;argument is a return function value?
                                \\\\{
                                        hllToFunc func                  ;slow? recursion.
                                        arg                                             ;function will be execute.
                                        purge func
                                        push eax                                ;push return arg from function.
                                        define status2 1
                                \\\\}
                                match =0,status2                        ;we have simple argument?
                                \\\\{
                                        pushd arg;only in test version!!! in real version it will be push_ex macro.
                                \\\\}
                        \\\}
                        push_args args
                        purge push_args                                 ;kill mecro.
                        call [func]
                        define status 1
                \\}
                match =0 =dd some?,status sParam        ;we inside macro import?
                \\{
                        func sParam                                             ;we do nothing.
                        define status 1
                \\}
                match =0,status
                \\{
                        unknown syntax.
                \\}
        \}
}
    


this strings(900 copies):
Code:
GetLastError(GetLastError(GetLastError(GetLastError(GetLastError(GetLastError())))))
    

compilies on my machine for about 0.500 - 0.800 seconds(in radasm).


and i have an idea.
what about to do something like this:
Code:
...
.data
  __int32 a,b

.code
EntryPoint:
    a = 5
    cin << b
    a = sqrt(b)
    cout << a
.end EntryPoint
    


but i have some problems:
1)i can't pass: '>>' value to macro(to do cin >> b) and cin << b - is not very good.
2)i can't do: [a] = 5, because invalid macro name...

how can I solve them?

and may be it will be good to add directive to preprocessor,like:
copyMacro macro_name

this directive will add macro(that was defined) to stack of macroses(so will be able to invoke this macro once more).
with this directive we will be able to do quick recursion.[/code]
Post 17 Jul 2006, 08:42
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3, 4, 5  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.