flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Help renaming register and use it with ASSUME macro

Author
Thread Post new topic Reply to topic
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 24 Oct 2010, 11:24
Hi guys,

I want to do something like this:

Code:
SRC_REG  EQU  esi

assume SRC_REG:sMyStruct   ; <-- seems OK!
assume edi:sMyStruct

mov     [edi.myField], SRC_REG        ; works
mov     [SRC_REG.myField], 0   ; error! ""undefined symbol SRC_REG.myField"
     


How should I define "SRC_REG" so I can use it with the assumed structure?

Thanks!
Post 24 Oct 2010, 11:24
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20629
Location: In your JS exploiting you and your system
revolution 24 Oct 2010, 11:29
Code:
match xyz,SRC_REG {assume xyz:sMyStruct}    
Post 24 Oct 2010, 11:29
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8394
Location: Kraków, Poland
Tomasz Grysztar 24 Oct 2010, 11:45
This is in fact a bug in "assume" macro. Here's the corrected version:
Code:
macro assume params
 {
   local expr
   define expr params
   match reg:struct, expr
   \{
      match assumed, reg\#@assumed \\{ irp name, assumed \\\{ restore name \\\} \\}
      macro label . \\{ local def
                        define def .
                        match =reg, def \\\{ define def \\\}
                        match any,def \\\{ def@assumed reg,.,: \\\} \\}
      struc db [val] \\{ \common def@assumed reg,.,db val \\}
      struc dw [val] \\{ \common def@assumed reg,.,dw val \\}
      struc dp [val] \\{ \common def@assumed reg,.,dp val \\}
      struc dd [val] \\{ \common def@assumed reg,.,dd val \\}
      struc dt [val] \\{ \common def@assumed reg,.,dt val \\}
      struc dq [val] \\{ \common def@assumed reg,.,dq val \\}
      struc rb cnt \\{ def@assumed reg,.,rb cnt \\}
      struc rw cnt \\{ def@assumed reg,.,rw cnt \\}
      struc rp cnt \\{ def@assumed reg,.,rp cnt \\}
      struc rd cnt \\{ def@assumed reg,.,rd cnt \\}
      struc rt cnt \\{ def@assumed reg,.,rt cnt \\}
      struc rq cnt \\{ def@assumed reg,.,rq cnt \\}
      reg\#@assumed equ
      virtual at reg
       reg struct
      end virtual
      purge label
      restruc db,dw,dp,dd,dt,dq
      restruc rb,rw,rp,rd,rt,rq \} }    
Post 24 Oct 2010, 11:45
View user's profile Send private message Visit poster's website Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 24 Oct 2010, 12:03
Thanks revolution and Tomasz!

That really worked! Very Happy
Post 24 Oct 2010, 12:03
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.