TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: ROB MORLEY
from: DAVID BROWN
date: 2018-03-06 16:35:00
subject: Re: Compile Assembly and

On 06/03/18 15:59, Rob Morley wrote:
> On Tue, 6 Mar 2018 13:53:05 +0000
> druck  wrote:
>
>> The easiest way to do the latter, is to write a C stub for the
>> function which you wish to write in assembler, then compile this with
>> gcc -S to produce a template asm file with the correct register
>> bindings which you can then fill out.
>>
> That's handy.  Although the last time I wrote any assembler was about
> 20 years ago, I still might ...
>

It is not good advice.  At best it gives you a very limited idea of the
calling conventions and registers usage.  If you really want to write
pure assembly functions that interact with code in other languages, you
have to read up on the calling conventions and ABI for the target (and,
if it is Windows, for the compiler you are using - the ABI is not
standardised on Windows).

If you are using gcc (or clang, or icc, or a few other compilers) and
you are writing short pieces of assembly, you would be better off
learning about gcc's inline assembly support.  Then the compiler takes
care of all the interface between the assembly and C.

--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.