flat assembler
Message board for the users of flat assembler.

Index > Main > Assume...

Author
Thread Post new topic Reply to topic
MercuryKnight



Joined: 04 Dec 2010
Posts: 6
MercuryKnight 04 Dec 2010, 17:05
Has anyone have any trouble with the assume macros in the latest version of fasm? I downloaded the package last month after getting a new laptop, but all my projects failed to compile. After browsing the boards to see if the problem was mentioned, I saw that the package was updated just recently, so I tried again, still same problem: fasm chokes on the line with the assume macro. This is a test file with a minimum needed to show the problem, binary format by default:

Code:
include 'struct.inc'
include 'masm.inc'

struct ListStruct
   Prev         rd 1
   Next         rd 1
ends

use32

StartX: assume  ebx:ListStruct <-- chokes here

        mov     eax,[ebx.Prev]
    


This is the error message I got from the command line:

Code:
flat assembler  version 1.69.27  (1302829 kilobytes memory)
test.asm [12]:
        assume  ebx:ListStruct
masm.inc [49] assume [24]:
       reg struct
struct.inc [144] ListStruct [13]:
   common label . at \\..base \\\}
masm.inc [34] label [3]:
                        match any,def \\\{ def@assumed reg,.,: \\\} \\}
masm.inc [34] match [0]:
                        match any,def \\\{ def@assumed reg,.,: \\\} \\}
masm.inc [59] def@assumed [3]:
   name equ ..label
error: illegal instruction.
    


I like assume, it saves me from having to type things the long way, especially if I have a large structure and one register (usually ebx) serves as a pointer to that structure throughout the program.
Post 04 Dec 2010, 17:05
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 04 Dec 2010, 17:09
mov eax,[ebx+ListStruct.Prev]
Post 04 Dec 2010, 17:09
View user's profile Send private message Visit poster's website Reply with quote
MercuryKnight



Joined: 04 Dec 2010
Posts: 6
MercuryKnight 04 Dec 2010, 17:14
I could do that, but that is not what I want to do. struct works, as I had already done that when I commented out the two lines and added that one in to make sure it was assume and not struct, as struct.inc was modified in the last package.
Post 04 Dec 2010, 17:14
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 04 Dec 2010, 17:18
Code:
virtual at ebx
ListStruct 1,2
end virtual

mov eax,[ebx.Prev] ;eax=1
    

can something like that work?
Post 04 Dec 2010, 17:18
View user's profile Send private message Visit poster's website Reply with quote
MercuryKnight



Joined: 04 Dec 2010
Posts: 6
MercuryKnight 04 Dec 2010, 17:22
Code:
flat assembler  version 1.69.27  (1295447 kilobytes memory)
test.asm [14]:
ListStruct 1,2
struct.inc [153] ListStruct [6]:
                           ..field = $
error: invalid value.
    


nope, don't work...
Post 04 Dec 2010, 17:22
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4330
Location: Now
edfed 04 Dec 2010, 17:29
Sorry
Image
Post 04 Dec 2010, 17:29
View user's profile Send private message Visit poster's website Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6115
Location: Poland
MHajduk 04 Dec 2010, 19:42
MercuryKnight, you may try something like this:
Code:
include 'macro\struct.inc'

struct  ListStruct 
 Prev    rd 1
        Next    rd 1
ends

use32

StartX:

    virtual at ebx
              tmp ListStruct
      end virtual

     mov     ebx, ListElement
    mov     eax, [tmp.Prev]
     ret
 
    align 4
     
    ListElement     ListStruct    
It compiles fine on my machine (FASM version 1.69.27).
Post 04 Dec 2010, 19:42
View user's profile Send private message Visit poster's website Reply with quote
MercuryKnight



Joined: 04 Dec 2010
Posts: 6
MercuryKnight 04 Dec 2010, 20:51
Found it! It was in the define@struct macro. I compared it with my old file and as it turned out, there was one change made in it that broke assume: local ..base

This is the current fragment within define@struct (since I tend to format the include files for improved readability, you can do a quick search for ..base within your files)

Code:
         struc name value
         \\{
            \\local \\..base       <-- here

            match any, fields@struct
            \\\{
               fields@struct equ fields@struct,.,name,<values>
            \\\}
            match , fields@struct
            \\\{
               label \\..base       <-- here

               forward
                 <snip>

               common 
                 label . at \\..base    <-- and here
            \\\}
         \\}
    



I just removed ..base and restored this part back to what it was when I downloaded 1.68 a few months ago.

Code:
         struc name value
         \\{
            match any, fields@struct
            \\\{
               fields@struct equ fields@struct,.,name,<values>
            \\\}
            match , fields@struct
            \\\{
               label .          <-- here

               forward
                  <snip>
               common      <-- and here
            \\\}
         \\}
    


So far I am not sure why this change was made, anybody knows? This is the only change I've made, and everything I've compiled so far works without any erroors.

PS: I am also using 1.69.27 right now, that is the only changes made to the include files (apart from the formatting)
Post 04 Dec 2010, 20:51
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 04 Dec 2010, 22:11
This change in "struct" macro was done in order to make a proper locals context when the structure is defined (it was discussed in some other thread). The "assume" macro has not been updated to work correctly with this new version of "struct", however it is very minor modification that fixes the problem.
Just replace this line:
Code:
match =reg, def \\\{ define def \\\}    
with:
Code:
match =reg =at label, def \\\{ define def \\\}    

I will upload the updated package in a few minutes.
Post 04 Dec 2010, 22:11
View user's profile Send private message Visit poster's website Reply with quote
MercuryKnight



Joined: 04 Dec 2010
Posts: 6
MercuryKnight 05 Dec 2010, 04:53
Ahhhhh that does it lol. I reinserted the three lines back into the file and made the modification in the assume macros, no errors. Thanks Tomasz!
Post 05 Dec 2010, 04:53
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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.