flat assembler
Message board for the users of flat assembler.

Index > Main > flat assembler 1.66

Goto page Previous  1, 2, 3  Next
Author
Thread Post new topic Reply to topic
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8358
Location: Kraków, Poland
Tomasz Grysztar 12 May 2006, 13:54
The thing of making lines in the middle of processing some other line is still a bit of a problem for current architecture.
Post 12 May 2006, 13:54
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 12 May 2006, 14:46
isn't it same as expanding macro?
or do you mean case like when there are 2 inline macros in same line?
Post 12 May 2006, 14:46
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: 8358
Location: Kraków, Poland
Tomasz Grysztar 12 May 2006, 15:07
As I already wrote, expanding macro adds new lines after the line that invoked the macro, with inlined macros it wouldn't work this way.
Post 12 May 2006, 15:07
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 12 May 2006, 15:19
you could also add original line at the end, without expanded macro or with "returned" value instead of macro.

returning would be another problem...
Post 12 May 2006, 15:19
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: 8358
Location: Kraków, Poland
Tomasz Grysztar 12 May 2006, 15:31
But when there were multiple ones in a single line, you'd have to copy the original line each time and start processing it further from the point where you stopped. Not to mention the fact that returned value would be uncoditional unless there were some conditional-processing-capable macro directives ("match" is not a macro directive). From my point of view, this would be not really worth one's while to do such things with this architecture, as it was designed to not work this way - which is also another reason why I wouldn't want to add such feature; fasm is just different. And the mentioned fasm 2.0 design would aloow this and many other powerful things, but it would be a completely DIFFERENT assembler!
Post 12 May 2006, 15:31
View user's profile Send private message Visit poster's website Reply with quote
dead_body



Joined: 21 Sep 2005
Posts: 187
Location: Ukraine,Kharkov
dead_body 13 May 2006, 08:23
fasm 2.0 will be after fasm 1.9 ?
Post 13 May 2006, 08:23
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8358
Location: Kraków, Poland
Tomasz Grysztar 13 May 2006, 11:49
Since it's a different desing, it could come in parallell, actually. It has nothing to do with how many versions of 1.xx are released.
Post 13 May 2006, 11:49
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 14 May 2006, 18:23
0xDEADB0D7: 1.10 comes after 1.9 Wink
Post 14 May 2006, 18:23
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Big Red



Joined: 25 Feb 2005
Posts: 43
Big Red 29 May 2006, 13:40
Nice. This version works pretty well so far, thanks again Mr. Grysztar. Also good to be back to having only one official version, it was getting confusing (with 1.64-1.65) to have to use one version for the editor (for the international symbols) and the other to compile.
Post 29 May 2006, 13:40
View user's profile Send private message Reply with quote
quiveror



Joined: 20 Jun 2003
Posts: 34
quiveror 01 Jun 2006, 18:32
I found 'label' bug in PE64 and COFF64. Please try to insert the below code into '.data' section and compile:
Code:
x dd ?
label y byte at x
    

and you'll got error: invalid use of symbol.
Post 01 Jun 2006, 18:32
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8358
Location: Kraków, Poland
Tomasz Grysztar 01 Jun 2006, 21:45
Right, too strict error checking leftover... Thanks for the report.
I made a quick fix into the 1.66 packages.
Post 01 Jun 2006, 21:45
View user's profile Send private message Visit poster's website Reply with quote
quiveror



Joined: 20 Jun 2003
Posts: 34
quiveror 04 Jun 2006, 16:53
This 2-line code got error. I think this is a bug.
Code:
align x
x=8
    

By the way,
Code:
x=8
align x
    

works OK
Post 04 Jun 2006, 16:53
View user's profile Send private message Reply with quote
halyavin



Joined: 21 Aug 2004
Posts: 42
halyavin 05 Jun 2006, 09:39
I suggest that by default x=0 and align 0 gives division by zero.
Post 05 Jun 2006, 09:39
View user's profile Send private message Visit poster's website Reply with quote
quiveror



Joined: 20 Jun 2003
Posts: 34
quiveror 05 Jun 2006, 15:23
halyavin wrote:
I suggest that by default x=0 and align 0 gives division by zero.

from the manual 1.2.3
Quote:
When a constant is defined only once in source, it is – like the label –
accessible from anywhere.
Post 05 Jun 2006, 15:23
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8358
Location: Kraków, Poland
Tomasz Grysztar 05 Jun 2006, 18:31
However with the forward-referencing the code resolving algorithms have to come into view, see 2.2.6 and also chapter about code resolving here.

Nevertheless this particular case can still be corrected to be resolvable - I will look into it.
Post 05 Jun 2006, 18:31
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20445
Location: In your JS exploiting you and your system
revolution 05 Jun 2006, 21:48
Yes, this is a bug. At line 1902 of ASSEMBLE.INC we can see that the value 0 causes an immediate invalid value error.

You can fix this by changing line 1902 (jz invalid_value) to this:
Code:
        jnz     alignment_positive
        cmp     [error_line],0
        jne     instruction_assembled
        mov     eax,[current_line]
        mov     [error_line],eax
        mov     [error],invalid_value
        jmp     instruction_assembled
      alignment_positive:    
Post 05 Jun 2006, 21:48
View user's profile Send private message Visit poster's website Reply with quote
wise



Joined: 05 Jun 2006
Posts: 2
wise 05 Jun 2006, 22:20
Hey everybody.

I am new to fasm's macro syntax and capabilities, however I was thinking of a way to use it to allow function call syntax that is somewhat easier to apprehend. I did read the thread, and while it may serve the same purpose, no , it is not about return values, at least not all and definetely not in the way you discussed.
I was thinking of a macro named func say, which would enable the declaration of functions in the following syntax:
Code:
func func_name (in_reg_1, ,..., in_reg_n)(out_reg_1, ..., out_reg_n)    

some notes:
1) I usually pass all my params in registers, which will be all the more true for x64 which is the reason i'm intrested in fasm.
2) This syntax would actually allow more than one return value which is usefull in light of (1) among other things.
3) the declaration would define the respective registers used in the function.
it would also define a new macro with the function's name in order to call the function using a similar double-parenthesis style, "mov"ing values between registers where needed.
4) actually I would like to allow local aliasing for the registers but that would complicate the question (and syntax) too much.

unless I missed something, and I did RTFM Very Happy this is not currently possible because i would need to parse the passed lists either with RegExp (best but unavailable) or some other way, because while it does say how to make comma'ed lists, and pass them ( in <>) I see no way to get the elements back. I'm thinking of a stub Perl script to act as an additional preprocessor, but i'm wandering whether it might be indeed possible, not to say closer existing capabilities than what you are proposing.

This is rather longer than I expected so thank you for bearing with me
Rolling Eyes
Post 05 Jun 2006, 22:20
View user's profile Send private message ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8358
Location: Kraków, Poland
Tomasz Grysztar 05 Jun 2006, 22:36
revolution: I would rather call it a "lack of resolving feature" than a bug - there are still other places (perhaps mainly in formatter) where invalid values cause errors immediatelly*, some of them are inevitable (that is: they are errors that make correct resolving impossible to continue), while some other are simply because I didn't think they would need such more sophisticated handling. The code resolving "declaration" (that says that the only sure thing is that if assembler succeeds, the results should be correct) is a kind of "excuse" for such lacks. Unfortunately it didn't came to my mind that someone might need forward-referenced alignment value, so I didn't add such feature - I guess now I should add it also for section alignments?

*Some sample of other such case:
Code:
format PE

data alpha
end data

data beta
end data

alpha = 5
beta = 6    
Post 05 Jun 2006, 22:36
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8358
Location: Kraków, Poland
Tomasz Grysztar 05 Jun 2006, 22:55
wise: this is not at all a working macro package for functions nor anything like that, but it shows how to do the parsing:
Code:
macro func [params]
{
 common match funcname(in)(out) ,params
 \{
    macro funcname [funcparms]
    \\{
        \\common match (inv)(outv), funcparms
        \\\{
             display 'Input:',13,10
             show_values <in>,<inv>
             display 'Output:',13,10
             show_values <out>,<outv>
        \\\}
    \\}
 \}
}

macro show_values in,inv
{
  define values inv,0
  irp name,in
  \{
     match value=,rest,values
     \\{
         define values rest

         display \`name,' = ',\\`value,13,10

     \\}
  \}
}


func testfunc (a,b,c) (d,e)  ; this defines the "testfunc" macro


testfunc (1,2,3) (eax,ebx)   ; this shows the assigned values    

Actually the are many other options how you can do such things with various combinations of standard and "instantaneous" macros, and some may be even better than this, this is just a quick example - just note that even more complex parsing is possible with fasm's preprocessor, see http://board.flatassembler.net/topic.php?t=4608

If you can specify some more details on how you would expect your macros to work, I can give some further help (but please start a separate thread in "Macroinstructions" in such case).
Post 05 Jun 2006, 22:55
View user's profile Send private message Visit poster's website Reply with quote
wise



Joined: 05 Jun 2006
Posts: 2
wise 05 Jun 2006, 23:30
thanks, Tomasz.
Now it makes much more sense. it will take me some time to pore over the whole example, but meanwhile, do i understand correctly that any literal string in the "match" pattern is treated as a name of a capture group unless preceded with "="? if that's so you really should be more clear on this in the manual as well as mention RegExp's and other familiar terms in the context of "match", because at first the connection wasn't apparent at to me all, and just left me wondering what is it for.

Good Night
Post 05 Jun 2006, 23:30
View user's profile Send private message ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3  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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.