Mail Archives: djgpp/1997/08/05/14:01:35
Brett Leslie Porter <blp01 AT uow DOT edu DOT au> wrote:
> OK, I've just looked through the FAQ and can't find anything to help me.
> I know it's probably in INFO, but I can't seem to find it.
>
> I'm looking for information on how to set up a C procedure in an .S file,
> how to get parameters off the stack, how to return a value, how to export
> it so C files can call it, all that sort of assembly stuff.
>
> I've NEVER used an assembler to link to C before (I pretty much always
> use inline assembly, but with DJGPP it makes your code look kinda messy
> with all the "clobbered" registers, etc. I'm not having a go at the
> technique: it is better than any other inline assembly I've ever seen in
> a C compiler, it just messes up my prettily formatted code for biggish
> functions).
>
> If it IS in INFO, can somebody please point me in the right direction??
I guess isn't in any INFO. Just write a function in C in a separated file and
with the same structure than the function you want to write in asm. Compile it
with -S and look in the generated code.
You'll learn how to pass parameters (ever 32 bits in stack) return values
(normally in EAX) and declare public symbols (.global).
Is very easy to understand looking the generated code ;-)
SET
------------------------------------ 0 --------------------------------
Visit my home page: http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013
- Raw text -