• MorphOS Developer
    Piru
    Posts: 593 from 2003/2/24
    From: finland, the l...
    You can use the macros in ppcinline/macros.h for this. If you have return a value and a single argument LP1 macro is appropriate:
    Code:
    int mytoupper(int c)
    {
    return (int) LP1(0x126, int, mytoupper, int, c, d0, , RexxSysBase, 0, 0, 0, 0, 0, 0);
    }

    Or just the code that it will evaluate to:
    Code:
    int mytoupper(int c)
    {
    ULONG res;
    REG_D0 = (ULONG) c;
    REG_A6 = (ULONG) RexxSysBase;
    res = MyEmulHandle->EmulCallDirectOS(-0x126);
    return (int) res;
    }


    Note that it is not a good idea to replace Standard C library toupper in case some other linklibrary calls it and expects specific behaviour which might not be replicated by the RexxSysBase function.

    The 2nd case indeed is a bit special as MorphOS 68k emul interface doesn't support return values in other registers than d0. A stub like that storing the additional return values is the only way.
  • »04.06.24 - 16:11
    Profile