Re: [cc65] __fastcall__

From: Alan Cox <>
Date: 2015-01-13 17:10:35
>> Instead I added --all-fastcall to the compiler (patch attached).
> This is probably not a perfect solution, but I can see it serves your purpose.
> One would need something like __cdecl__ to mark pointers or functions that
> should not be fastcall.

If I get a bit more time I'll take a look at doing that. It doesn't
look too horrendous. Next however I want to take a look at what it
would take to make the linker generate banked binaries. It actually
looks easier than the Z80 banking bits I did for sdcc as the C stack
is not the return stack.

In the 6502 case stuffing an extra byte or two on the 6502 stack when
switching banks ought to be invisible to the C code.

The basic idea would be to spot any calls to a banked function from a
function not in that bank and instead of relocating the JSR address
replace it with a JSR to a stub where any target the first time it is
found gets a stub generated that is something like

LDA bankreg
LDA #newbank
STA bankreg
JSR _realroutine
STA bankreg

or I suspect in implementation

          JSR __tobank0
          JSR _realroutine
          JSR __popbank

or similar, which would live in common space.

At that point all those annoying 12K and 16K banked memories on
AppleII and Atari boxes actually become useful 8)
To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Jan 13 17:10:42 2015

This archive was generated by hypermail 2.1.8 : 2015-01-13 17:10:44 CET