flat assembler
Message board for the users of flat assembler.

Index > Main > How to write reusable code ?

Author
Thread Post new topic Reply to topic
LiuJunfeng



Joined: 28 Nov 2003
Posts: 48
Location: China
LiuJunfeng
This may be a big topic, yet it is very important.
I know macro,procedure and function can do this, but don't exactly know how Embarassed
Post 04 Apr 2004, 13:31
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo
What do you mean?
Post 04 Apr 2004, 15:01
View user's profile Send private message Yahoo Messenger Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv
Maybe he is thinking along the lines of static libraries.
Post 04 Apr 2004, 15:02
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
LiuJunfeng



Joined: 28 Nov 2003
Posts: 48
Location: China
LiuJunfeng
pelaillo wrote:
What do you mean?

There exists different calling conventions, which one to choose and why?
Are macros prefered to use than procedures?
Parameters passed may be constant, register or memery, how can the subroutine deal with all the three kinds?
Post 04 Apr 2004, 16:57
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo
Everyone have an own idea about the subject so we need to talk about personal preferences and why.

You need also to define target OS and application. i.e. see the differences between way-to-do callings in win32, linux, freeBSD, Menuet....

My personal preferences are:
proc: A self-contained chunk of reusable code with a defined function.
params passed in registers only in procs encapsulated within modules.
params passed on stack when proc needs to be called from external modules or interfaces.
params passed on memory locations: never.
macros for very special situations (very difficult to explain) and definitely not for chunks of code.
Post 04 Apr 2004, 18:53
View user's profile Send private message Yahoo Messenger 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. Also on YouTube, Twitter.

Website powered by rwasa.