flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > How overcome this.

Author
Thread Post new topic Reply to topic
halyavin



Joined: 21 Aug 2004
Posts: 42
halyavin 09 Sep 2004, 16:26
I wrote
Code:
macro wordstoreg arg1,arg2
{
  if (arg1 eqtype 0) & (arg2 eqtype 0)
    mov eax, (arg1)*65536+arg2
  else
    mov eax,arg1
    shl eax,16
    add eax,arg2
  end if
}
start:
  wordstoreg dword [start],dword [start]
    

This works, but this isn't compiled:
Code:
macro wordstoreg arg1,arg2
{
  if (arg1 eqtype 0) & (arg2 eqtype 0)
    mov eax, (arg1)*65536+(arg2) ;difference from previous
  else
    mov eax,arg1
    shl eax,16
    add eax,arg2
  end if
}
start:
  wordstoreg dword [start],dword [start]
    

In this case the question haven't sense, but how another similar macros had to be written?
Post 09 Sep 2004, 16:26
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8395
Location: Kraków, Poland
Tomasz Grysztar 09 Sep 2004, 18:50
Do something like:
Code:
    v1=arg1
    v2=arg2
    mov eax,(v1)*65536+(v2)    
Post 09 Sep 2004, 18:50
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.