flat assembler
Message board for the users of flat assembler.

Index > Windows > Extended enter/return macros

Author
Thread Post new topic Reply to topic
inskipp



Joined: 23 Jun 2003
Posts: 25
Location: Poland
inskipp
In Windows we often use a code:
Code:
proc dummy,...
  enter
  push esi edi ebx
  ..
  pop ebx edi esi
  return
    

I was thinging about replace this by simple:
Code:
proc dummy,...
  enter esi,edi,ebx
  ..
  return
    

Of course esi, edi and ebx are only example, only chosen registers should be saved.
Can someone help me to write such macro?
Extend enter macro to push registers is easy, but i have no idea how to restore proper registers at the end of procedure.
I thing it could be useful.
Post 08 Jul 2003, 21:55
View user's profile Send private message ICQ Number Reply with quote
BiDark



Joined: 22 Jun 2003
Posts: 109
Location: .th
BiDark
Why don't you extend the 'return' macro? Rolling Eyes
Post 09 Jul 2003, 02:13
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7712
Location: Kraków, Poland
Tomasz Grysztar
This should work:
Code:
macro enter [reg]
 { common
    rb (4 - ($-dynamic_data) and 11b) and 11b
    dynamic_size = $ - dynamic_data
    end virtual
    enter dynamic_size,0
    used_regs equ
   forward
    used_regs equ reg used_regs
    if ~ reg eq
     push reg
    end if }

macro return
 { if ~ used_regs eq
    pop used_regs
   end if
   leave
   ret ..ret }    
Post 09 Jul 2003, 20:35
View user's profile Send private message Visit poster's website Reply with quote
inskipp



Joined: 23 Jun 2003
Posts: 25
Location: Poland
inskipp
It works. Thx.
Post 09 Jul 2003, 21:50
View user's profile Send private message ICQ Number 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.