flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > converting this complex masm macro argument |
Author |
|
RedGhost 05 Mar 2006, 08:25
Code:
assume edi: IMAGE_IMPORT_DESCRIPTOR
compiler assumes edi points to an IMAGE_IMPORT_DESCRIPTOR structure, so [edi].StructMember will generate edi+that many bytes etc _________________ redghost.ca |
|||
05 Mar 2006, 08:25 |
|
Tomasz Grysztar 05 Mar 2006, 12:50
With the "match-improved" version of the classic assume-emulating macro:
Code: macro assume param { local _reg match reg:struc, param \{ virtual at reg reg equ _reg reg struc end virtual restore reg \} } and with the fasm's official HLL macros it can be written like: Code: assume edi:IMAGE_IMPORT_DESCRIPTOR .while ~([edi.OriginalFirstThunk]=0 & [edi.TimeDateStamp]=0 & [edi.ForwarderChain]=0 & [edi.Name1]=0 & [edi.FirstThunk]=0) |
|||
05 Mar 2006, 12:50 |
|
shism2 05 Mar 2006, 14:05
I knew the assume part but I just put everything else just incase you needed to see the surrounding code
What does ~ do? |
|||
05 Mar 2006, 14:05 |
|
Tomasz Grysztar 05 Mar 2006, 14:12
It's the standard fasm's operator for logical negation. See fasm's manual, section 2.2.2.
|
|||
05 Mar 2006, 14:12 |
|
shism2 05 Mar 2006, 14:24
Is there anyway you can make a table with all of them?
|
|||
05 Mar 2006, 14:24 |
|
Tomasz Grysztar 05 Mar 2006, 14:47
You mean, all three of them?
|
|||
05 Mar 2006, 14:47 |
|
shism2 05 Mar 2006, 17:07
Like ~ means not
= means equal ~= means not equal somethng like that |
|||
05 Mar 2006, 17:07 |
|
LocoDelAssembly 05 Mar 2006, 18:08
Why "assume" is not included in standard package? If you add it please add the possibility to define "reg:nothing", it can be achieved with a structure named "nothing", no?
|
|||
05 Mar 2006, 18:08 |
|
Tomasz Grysztar 05 Mar 2006, 19:28
Be careful not to mix the different kinds of operators. The ~, & and | are operators applied to logical values to calculate more complex logical value, while =, <, >, <> etc. are operators applied to numerical expressions etc. in order to create single logical value.
|
|||
05 Mar 2006, 19:28 |
|
Tomasz Grysztar 05 Mar 2006, 19:29
locodelassembly wrote: Why "assume" is not included in standard package? If you add it please add the possibility to define "reg:nothing", it can be achieved with a structure named "nothing", no? Because this simple trick doesn't support "undefining" the previous assume on the next one. This can be done using the similar mechanism to "local", but it would be much more complex macro, which I have not written yet. |
|||
05 Mar 2006, 19:29 |
|
Tomasz Grysztar 05 Mar 2006, 20:00
OK, something like this should work like I wanted:
Code: macro assume params { match assumed, all@assumed \{ irp name, assumed \\{ restore name \\} \} match reg:struct, params \{ macro label . \\{ \\} struc db [val] \\{ \common def@assumed .,db val \\} struc dw [val] \\{ \common def@assumed .,dw val \\} struc dp [val] \\{ \common def@assumed .,dp val \\} struc dd [val] \\{ \common def@assumed .,dd val \\} struc dt [val] \\{ \common def@assumed .,dt val \\} struc dq [val] \\{ \common def@assumed .,dq val \\} struc rb cnt \\{ def@assumed .,rb cnt \\} struc rw cnt \\{ def@assumed .,rw cnt \\} struc rp cnt \\{ def@assumed .,rp cnt \\} struc rd cnt \\{ def@assumed .,rd cnt \\} struc rt cnt \\{ def@assumed .,rt cnt \\} struc rq cnt \\{ def@assumed .,rq cnt \\} all@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 \} } macro def@assumed name,def { match vars, all@assumed \{ all@assumed equ all@assumed, \} all@assumed equ all@assumed name local ..label name equ ..label ..label def } all@assumed equ struc none { label . } I will include it in official MASM.INC |
|||
05 Mar 2006, 20:00 |
|
LocoDelAssembly 05 Mar 2006, 20:55
Thank you
|
|||
05 Mar 2006, 20:55 |
|
okasvi 05 Mar 2006, 21:16
there should be no official masm.inc in first place
_________________ When We Ride On Our Enemies support reverse smileys |: |
|||
05 Mar 2006, 21:16 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.