flat assembler
Message board for the users of flat assembler.

Index > Unix > Does as/gas have LOCAL like MASM?

Author
Thread Post new topic Reply to topic
drhowarddrfine



Joined: 10 Jul 2007
Posts: 533
drhowarddrfine 18 Nov 2007, 17:45
I don't recall if LOCAL is a macro in MASM either. Does anyone know a way to have labels for items on the stack?
Post 18 Nov 2007, 17:45
View user's profile Send private message Reply with quote
bogdanontanu



Joined: 07 Jan 2004
Posts: 403
Location: Sol. Earth. Europe. Romania. Bucuresti
bogdanontanu 18 Nov 2007, 17:52
IF LOCAL is not implemented you can always try and use a STRUCTURE where you define the stacK layout in you PROC.

Code:
STRUC frame_stru
 local_1 dd ?
 local_2 dd ?
 local_3 dd ?
 ebp dd ?
 eip  dd ?
 arg_1 dd ?
 arg_2 dd ?
ENDS
    


Then you can access local variables by name like this:
Code:
mov eax,[ebp+frame_stru.local_1] ; or minus depending 
    


It is an ancient technique that was used before LOCAL have been implemented. You can always fall back to it when in need.

LOCAL is internally implemented in MASM (not a user macro). Same is true for my own assembler: SOL_ASM. FASM implements it as an user macro AFAIK. GAS does not have it either way but i guess you can implement it this way.
Post 18 Nov 2007, 17:52
View user's profile Send private message Visit poster's website Reply with quote
drhowarddrfine



Joined: 10 Jul 2007
Posts: 533
drhowarddrfine 18 Nov 2007, 22:52
Thanks Bogdan. I was just looking at the docs and it seems what I want is called ".section" and its related directives. Not positive yet but it might do something similar to what you show above with the benefit of labels. If someone knows that's what I want.
Post 18 Nov 2007, 22:52
View user's profile Send private message Reply with quote
Grincheux



Joined: 15 Apr 2008
Posts: 17
Location: Mathenay, France
Grincheux 16 Apr 2008, 09:56
I will perhaps tell a very bad thing, but could FASM (or an other program) convert MASM macros, because LOCAL and INVOKE exist with the same meaning on a macro form ?

I think that if we use FASM it is not for using a MASM clone.

_________________
____________Kenavo_________________

Grincheux
Post 16 Apr 2008, 09:56
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4324
Location: Now
edfed 16 Apr 2008, 09:58
there are some work done to support MASM syntax since 1.64 i think.

bu the best is to code without this syntax and start with sane bases, all in pure fasm syntax.

atchoum!
Post 16 Apr 2008, 09:58
View user's profile Send private message Visit poster's website 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-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.