I've been attempting to port MAD to Windows CE running under ARM... it's
tricky going, so far. I'm trying to convert the tons of macros that the
FPM_ARM option uses to function calls, and having some limited success.
The biggest problem is that Embedded Visual C++, quite simply, does NOT
support inline assembler. Ever. Despite what their own docs say. Another
problem is that the macros aren't documented well; they don't explicitly
state what kind of arguments they take or what they return.
Fortunately, EvC DOES support *external* assembly code; you can assemble an
.asm file into an .obj file, turn it into a .lib then link it in with the
rest of the C code. Even more fortunately, EvC is capable of converting C
code to assembly code. This lets me write up a blank framework, compile it,
and modify the resulting .asm file to do what I want.
So now I'm down to deciphering just exactly what each macro does to the
arguments. It looks like mad_f_mul(x,y) takes two mad_fixed_t arguments and
returns a mad_fixed_t value, that's simple enough; but it's unclear how the
others are using their arguments.
Are the macro parameters for MAD_F_MLX, MAD_F_MLA, MAD_F_MLN, and
mad_f_scale64 used ONLY as input parameters? 'cause if not, there's no way
in heck to duplicate the full functionality of the macro in a function
without operator overloading and hidden pointers; and MAD is a C project,
not a C++ one.