flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > va_list

Author
Thread Post new topic Reply to topic
roxaz



Joined: 27 Jul 2008
Posts: 25
roxaz
va_list is probably one of the best CRT features, wouldnt it be great to have this thing in asm too? yes it would! thx to uncle roxaz now you will be able to have just that! i made fasm macros for using va_list.

demo app included demonstrating usage of va_list. enjoy ;]

Code:
;ap = register to store va_list in, v = last argument before va_list
;vSize = size of argument v.
macro va_start ap*, v*, vSize*
{
  lea ap, v
   add ap, vSize
}

;ap = va_list, t = size of argument that is being taken out of va_list
;value is returned in eax register.
macro va_arg ap*, t*
{
      mov eax, [ap]
       add ap, t
}

;ap = va_list
;kinda not needed imo.. but it was in crt so..
macro va_end ap*
{
    xor ap, ap
}    


Description:
Download
Filename: va_list.asm
Filesize: 1.85 KB
Downloaded: 64 Time(s)

Post 27 Jul 2008, 11:35
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
I don't see what is this needed for in assembly. You can do this easily yourself, there is no reasong to have macro for adding 4 to register, or macro to save address of variable to register.
Post 27 Jul 2008, 16:22
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
roxaz



Joined: 27 Jul 2008
Posts: 25
roxaz
you can ofcourse, however if you are working with va_lists a lot it saves few seconds, and i value those few seconds ;]
Post 27 Jul 2008, 17:10
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
and i value those few seconds

Then don't code assembly Very Happy You waste A LOT of seconds in assembly, compared to python or something...
Post 27 Jul 2008, 17:23
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
roxaz



Joined: 27 Jul 2008
Posts: 25
roxaz
some things can never be done in high level language ^_^
Post 27 Jul 2008, 19:28
View user's profile Send private message Reply with quote
rCX



Joined: 29 Jul 2007
Posts: 166
Location: Maryland, USA
rCX
It seems that there are at least three reasons why asm programmers use macros.

reason 1. Size optimization
reason 2. Speed optimization
reason 3. Coding optimization (making asm coding faster or easier to understand)
reason ?

I guess this falls more into reason 3. Cool
Post 27 Jul 2008, 20:19
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Quote:
some things can never be done in high level language ^_^

That's why people to whom secons matter, use assembly only for few small parts that can't be done in HLL Razz
Post 27 Jul 2008, 20:23
View user's profile Send private message Visit poster's website AIM Address MSN Messenger 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.