flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Macro tutorials

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
dont forget about my tutorial http://decard.net/?body=tajga&chapter=preproc
Post 09 Feb 2005, 13:26
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
hey vid,
its added to the faq we hope it won't be forgotten now, you deserve an A+ for it
Post 09 Feb 2005, 21:11
View user's profile Send private message Visit poster's website Reply with quote
Picnic



Joined: 05 May 2007
Posts: 1288
Location: Paradise Falls
Picnic
wow, fasm macros are fascinating but they sure need practice! Keep posting people. all code examples appreciated. Very Happy
Post 17 May 2007, 16:39
View user's profile Send private message Reply with quote
vinoca



Joined: 22 Nov 2007
Posts: 5
Location: lanzhou
vinoca
@Liu
i am chinese too,may i know your chinese blog site?
Post 22 Nov 2007, 22:20
View user's profile Send private message Send e-mail Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko
Code:

; pushrl 3,2,1 -> push 1 2 3
macro pushrl [values*]{reverse push values}




; bsw name,'s1','s2' -> Borland String Wide
;   jmp @f
;   name#.size = @f-name-2
;   dd -1,name#.size
;   name du 's1','s2',0x00
;   @@:
macro bsw name*, [data]{
common
  if(used name)|(used name#.size)
    common
      jmp @f
      dd -1,?
      label name
    forward
      if ~data eq
        du data
      end if
    common
      name#.size = $-name
      store dword name#.size at name-4
      dw 0
      @@:
  else
    if(defined DEBUG)&(DEBUG=TRUE)
      display 'macro bsw:',13,10,'  "',`name,'" & "',`name,'.size" not defined as not used.',13,10
    end if
  end if
}




; bsw s1,'s1'
; bsw s2,'s2'
; bsw2 name,s1,s1 ->
;   jmp @f
;   name.size = @f-2-name
;   dd -1,name.size
; label name
;   name.s1 dd s1
;   name.s2 dd s2
;   dw 0
;   @@:
macro bsw2 name*,[data]{
common
  if(used name)|(used name#.size)
    common
      jmp @f
      dd -1,?
      label name
    forward
      if(~data eq)
        name#.#data dd data
      end if
    common
      name#.size = $-name
      store dword name#.size at name-4
      dw 0
      @@:
  else
    if(defined DEBUG)&(DEBUG=TRUE)
      display 'macro bsw2:',13,10,'  "',`name,'" & "',`name,'.size" not defined as not used.',13,10
    end if
  end if
}




; Borland String Wide from a file
macro bswf name*,fName*,start,count{  ; start = 0...
if (used name) | (used name#.size)
  jmp @f
  dd -1,?
  label name
  if (start eq) & (count eq)
    file fName
  else if (start eq)
    file fName:0,count
  else if (count eq)
    file fName:start
  else
    file fName:start,count
  end if
  name#.size = $-name
  store dword name#.size at name-4
  dw 0
  @@:
else
  if(defined DEBUG)&(DEBUG=TRUE)
    display 'macro bswf:',13,10,'  "',`name,'" & "',`name,'.size" not defined as not used.',13,10
  end if
end if
}




; Borland-styled iclude:
;   use 'api\kernel32.inc',\
;       'api\shell32.inc',\
;       'api\user32.inc'      -> include 'api\kernel32.inc'
;                                include 'api\shell32.inc'
;                                include 'api\user32.inc'
macro use [files*]{forward include files}




; enum wsActive,wsPassive -> wsActive  = 0
;                            wsPassive = 1
macro enum [names*]{
common
  local count
  count = 0
forward
  names = count
  count = count + 1
}




; dbgstr test  -> db 0,'test',0
; proc test
;         ret
; endp
macro dbgstr procedure*{
  if (defined DEBUG)&(DEBUG=TRUE)&(used procedure)
    db 0,'dbgstr: ',`procedure,0
  end if
}

    
Post 20 Jul 2009, 20:41
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< 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 GitHub, YouTube, Twitter.

Website powered by rwasa.