flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > structures in 'proc' macro?

Author
Thread Post new topic Reply to topic
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Is it possible to have structures in the proc macro?
EX: proc var1, var2, systime:SYSTEMTIME
Question
Post 03 Apr 2006, 14:25
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
You don't push the structure on stack, you only push the pointer to structure. And pointer is always DWORD.
Post 03 Apr 2006, 15:14
View user's profile Send private message Visit poster's website Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Yeh, I know, but would it be too difficult to add this feature, it would make coding a bit easier.
Post 03 Apr 2006, 15:36
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
On second thought, just forget about it. It would probably add a lot of extra overhead to the proc, invoke, and stdcall macros, along with copying the data and making sure the stack is aligned properly. Anyways, I may have figured out an easier way around this problem than what I've been doing, !thanks anyways!
madmatt
Post 03 Apr 2006, 15:51
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
no, IMO it would be stupid to add this feature, mainly because people will use it without knowing what they are doing.
Post 03 Apr 2006, 15:52
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Why would someone use this feature if they don't know what it is, or what it does? Anyways, using assembly for ANYTHING requires a good bit of programming skill to start with.
Post 03 Apr 2006, 17:42
View user's profile Send private message Reply with quote
okasvi



Joined: 18 Aug 2005
Posts: 382
Location: Finland
okasvi
so what difference would it make to have ptrSomeStructure:STRUCTURE compared to this code?
Code:
format PE GUI 4.0
entry start
include '%fasminc%\win32ax.inc'

struct Bleh
 asdasd rd 1
 asdasd1 rd 1
 dwTest rd 1
ends

humm dd 69h
bleh_struct Bleh

proc TestProc ptrBleh:dword
 mov edx, [ptrBleh]
 lea ecx, [edx]
 mov eax, [ecx+Bleh.dwTest]
 ret
endp

start:
mov ecx, bleh_struct
lea eax, [ecx]
push dword [humm]
pop [eax+Bleh.dwTest]

push bleh_struct
call TestProc
;eax = 69h    

_________________
When We Ride On Our Enemies
support reverse smileys |:
Post 03 Apr 2006, 21:26
View user's profile Send private message MSN Messenger Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
It would push the whole structure on the stack and not just a pointer.
Post 04 Apr 2006, 11:03
View user's profile Send private message Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7724
Location: Kraków, Poland
Tomasz Grysztar
It's not the "proc" macro that pushes parameters on the stack.
Post 04 Apr 2006, 12:15
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
yes, and macros name which does it ends with "d" Smile
Post 04 Apr 2006, 13:47
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
okasvi



Joined: 18 Aug 2005
Posts: 382
Location: Finland
okasvi
madmatt wrote:
It would push the whole structure on the stack and not just a pointer.



then how would you get them if proc is like this:

Code:
struct humm
 dwInStruct rd 1
 szInStruct rb 8h
ends

proc testproc var1:dword var2:dword blehblah:humm
...
ret
endp    


would it be like "mov eax, [blehblah.dwInStruct]" ?
and how about pushing before calling?

_________________
When We Ride On Our Enemies
support reverse smileys |:
Post 04 Apr 2006, 20:49
View user's profile Send private message MSN Messenger Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
okasvi,
Let me clarify something, the invoke macro would actually push the structure data on the stack. And the proc macro would actually define the stack pointers to the data. And you would access it just like you would a local structure.
Post 05 Apr 2006, 09:25
View user's profile Send private message 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.