flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Error in ASSUME macro

Author
Thread Post new topic Reply to topic
alorent



Joined: 05 Dec 2005
Posts: 201
alorent
Hi guys,

There seems to be an error in the ASSUME macro. Please, check the following code:

Code:
include 'win32ax.inc' ; you can simply switch between win32ax, win32wx, win64ax and win64wx here
include 'macro\if.inc'
include 'macro\masm.inc'

.data

struct MY_STRUCT_1
  p1          db ?
  p2            dd ?
ends

struct MY_STRUCT_2
  p1          db ?
  union
    u1               db ?
    u2          dd ?
  ends
  p2          dd ?
ends

.code

start:

assume       eax: MY_STRUCT_1
assume  eax: MY_STRUCT_2

.end start
    


It seems that the error appears when there is a "union" inside a "struct".

Thanks for your help
Post 11 Feb 2010, 09:00
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
alorent

Looks like define@union supplementary macro depends on label functionality, but assume macro overloads label with no-op.

I'll investigate that later.
Post 11 Feb 2010, 14:54
View user's profile Send private message Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 201
alorent
Hi baldr, any ideas if there is a workaround for this already?

Maybe Tomasz can help?

Thanks!
Post 26 May 2010, 15:57
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
alorent,

Well, I have one (haven't published it yet because it seems like hack, not solution):
Code:
      match assumed, reg\#@assumed \\{ irp name, assumed \\\{ restore name \\\} \\}
;--- INCLUDE\MACRO\MASM.INC [29] Allow to use unions inside assumed structs
;     macro label . \\{ \\}
;+++
      macro label . \\{
        \\local .name
     match name rest, . \\\{ .name equ name \\\}
 match =.name, .name \\\{ .name equ . \\\}
   if ~ .name eqtype eax
         label .
   end if
      restore .name
      \\}
;===
      struc db [val] \\{ \common def@assumed reg,.,db val \\}    
Neither completely tested, nor clean.
Post 26 May 2010, 18:43
View user's profile Send private message Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 201
alorent
Thanks baldr!!

I'm going to check it. Hopefully nothing is destroyed in my code Smile

Thanks!!!
Post 27 May 2010, 08:46
View user's profile Send private message Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 201
alorent
baldr,

I have checked your assume mods and it seems to work perfectly! Smile

Do you think that some problems could arise in complex structs with unions when using your modified assume?

I'm going to do more tests anyway...

Thanks for your great work!!!
Post 27 May 2010, 11:43
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7720
Location: Kraków, Poland
Tomasz Grysztar
A bit better (I think) fix is included in the latest package.
Post 31 Aug 2010, 09:23
View user's profile Send private message Visit poster's website 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.

Powered by rwasa.