It's great to see that there are still some working on OnBoardC. Being an old 
school C programmer I thought about refactoring VFSDos, because it seems to 
have many flaws. However, time's limited... :-(

> The inline notation itself is legal (changed that already) however, it's
> the assembly commands themselves which I am worried about: are those legal
> syntax to pass to m68k-palmos-as?
It helps a lot to let the GCC compiler generate assembler source code (option 
"-S") and to study that.

>From my experiences writing Phoinix (phoinix.sf.net) I'd recommend to try:

__asm__("link %a6,#0\n\t"
        "move.l %a6,-(%a7)  ; push a6\n\t"
        "jbsr setA6_00(%pc) ; no need of add #4,a7\n\t"
        "unlk %a6           ; restore stack\n\t"
        "rts\n\t");

and

__asm__("jbsr getA6_00(%pc) ; get value in d0\n\t"
        "move.l %d0,%a6     ; restore a6\n\t"
        "move.w 4(%a7),%d0  ; return value\n\t"
        "unlk %a6           ; restore stack \n\t"
        "rts\n\t");

respectively. You may also replace "%a7" by "%sp", or "%a6" by "%fp", if you 
like it better. The pseudo-op "jbsr" uses "bsr.s", "bsr.w", or "jsr", 
whichever is appropriate.

Anyway, I found the complete source, and it looks better to me to use these 
lines, provided that your A5 point to the globals. It saves some calls and 
returns.

void Tag(void)
{
    __asm__("link %a6,#0                  ; set up %a6 for exit()\n\t"
            "move.l %a6,[email protected](%a5)  ; store %a6 in global memA6\n\t"
            "unlk %a6                     ; restore stack\n\t"
            "rts\n\t");
}

void exit(int code)
{
    __asm__("move.l [email protected](%a5),%a6  ; restore %a6 from global memA6\n\t"
            "move.w 4(%a7),%d0            ; return value\n\t"
            "unlk %a6                     ; restore stack\n\t"
            "rts\n\t");
}

> I am asking for documentation on SysLib* calls because GCC complains about
> this call:
>         err=SysLibClose(StdioLibRef,&usecount); // too many arguments to
> SysLibClose
Well, the header file contains a prototype with the libref only...

HTH, Bodo


-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to