flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Assume and Nested Structures

Author
Thread Post new topic Reply to topic
MercuryKnight



Joined: 04 Dec 2010
Posts: 6
MercuryKnight
Hey guys, long time no see!

I've working on a project, and I noticed that assume does not work when passed a structure that contains another structure, such as:

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

struct ListStruct
   Prev         rd 1
   Next         rd 1
ends

struct TestStruct
   Start        rd 1
   End          rd 1
   Shared       ListStruct    <-- assume failed here
ends

format binary
use32

        assume  edi:TestStruct

StartX: mov     [edi+TestStruct.Shared.Next],ecx
        mov     [edi.Shared.Next],ecx   <-- this is never reached by the compiler because of failure on the assume edi line
    


Both include files were taken from the latest fasm package. This is the error message received:

Code:
flat assembler  version 1.69.31  (798550 kilobytes memory)
test.asm [18]:
        assume  edi:TestStruct
masm.inc [49] assume [24]:
       reg struct
struct.inc [139] TestStruct [13]:
     match , value \\\\{ field type def \\\\}
struct.inc [139] match [0]:
     match , value \\\\{ field type def \\\\}
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 am not sure if its inside the "struct" or "assume" macro, because if I used

Code:
struct TestStruct ListStruct
   Start        rd 1
   End          rd 1
ends
    


then "assume" works fine. It just fails whenever there is a substructure within the structure. Since I have several structures that uses several substructures, including more than one ListStruct, either we can figure out what's wrong and fix "struct", "assume", or both macros, or I could start writing the long way which makes reading the source a bit unweildy (at least in my opinion) when many operations are done on the structure pointed to by a single register.

Thanks all! Very Happy
Post 08 Jul 2011, 06:01
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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.