delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/05/14:01:35

Message-Id: <m0wviHJ-000S1eC@inti.edu.ar>
Comments: Authenticated sender is <salvador AT natacha DOT inti DOT edu DOT ar>
From: "Salvador Eduardo Tropea (SET)" <salvador AT inti DOT edu DOT ar>
Organization: INTI
To: Brett Leslie Porter <blp01 AT uow DOT edu DOT au>, djgpp AT delorie DOT com
Date: Tue, 5 Aug 1997 15:22:02 +0000
MIME-Version: 1.0
Subject: Re: Calling assembly procedures from DJGPP

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019