Re: [AD] some questions

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Shawn Hargreaves <shawn@xxxxxxxxxx> writes:

> Really? Well, it seems to work ok without any parameters: perhaps the two 
> colons at the end of the asm statement are enough to switch the compiler 
> into extended asm mode, even though there are no actual input or output 
> variables?

Yes, it seems colons make difference.

> > I don't know how to do that.  It must be included only when this 
> > convention is used, but __GNUC__ is not defined in asm with preprocessing, 
> > so I can not test for that same condition which is used for including this 
> > convention.  I can modify asmdef utility to output ALLEGRO_GCC and 
> > ALLEGRO_I386 if they are defined, but it does not smell good.
> 
> I think that is the best option. Yes, it smells bad, but it works, and at 
> least it keeps all the ugly stuff in that one file, which already 
> reeks badly enough that a bit more crap won't be noticed :-)

It is not good, because bank switch convention compiled in library is
determined on compilation of library, while convention used by
programs is determined on compilation of program and it will be
impossible to use different compiler.

I have another idea: calling convention for bank switch is determined
by new define which is set by configure script (*).  It will work in
both C (library code and user programs) and asm (by exporting this
define with asmdef utility).  We add new define which tells whether
platform has C versions of bank switch routines or not.  If there are
no C versions and C convention is used, then set_gfx_mode after
setting graphics mode, stores old bank switchers (selected by gfx
driver) and points bank switchers to C versions which just load %eax,
%edx and call saved bank switchers.

(*) For platforms which don't use configure script, we need
automatically generated header file.  To solve problems with
overwriting this file by building library for different platforms, we
can place it in platform specific directory.  This file will be copied
to the system include directory together with other header files.

-- 
Michael Bukin



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/