Priest of the Order of the Butterfly
Posts: 530 from 2003/2/25
From: France
Quote:
alfie wrote:
OK thanks, but the solution is ?
PS
That doesn't return random values; the library works in a very complex scenario without problems. If I remove the savings, the system freezes.
Missed the ... between the loops. You're doing other stuff in. My bad.
Still, I am a bit puzzled. I never had to mess with emulreg handle directly in my 68k compatible library (camd.library for instance).
Using FUNCARRAY_32BIT_NATIVE is just good enough for most libraries if the compatibility with 68k binary is needed afaik.
Library function looks like
VOID LIB_DummyFunc()
{
struct LibBase *Base = REG_A6;
APTR arg0 = REG_A0; // whatever the function needs as argument
ULONG arg1 = REG_D0;
[[ do interesting stuff ]]
REG_D0 = result;
}
As you can see, no emul context saving needed.
Why are you using FUNCARRAY_RESTORE_NATIVE instead of the more common FUNCARRAY_32BIT_NATIVE?