Re: [cc65] bank switching/retro replay?

From: Marc 'BlackJack Rintsch <>
Date: 2009-11-09 22:14:13
On Monday 09 November 2009, Ullrich von Bassewitz wrote:
> On Mon, Nov 09, 2009 at 09:48:35PM +0100, Marc 'BlackJack Rintsch 
> > `sdcc` has a keyword named `banked` (?) and when you mark a
> > funktion with it you can call such a function just like any other
> > and the compiler emits a jump to trampoline code that does the
> > banking and calling for you transparently, including "banking back"
> > to the caller function.
> Thanks! But how does it know, how banking works on a specific
> hardware?

It doesn't, you have to supply the trampoline code.  Calling such 
a "banked" function puts the bank and address within the bank into 
known locations and then calls the trampoline code 
`__sdcc_banked_call`.  This code saves the current bank onto the stack 
changes the bank and calls the function.  On return `__sdcc_banked_ret` 
is called which switches back to the callers bank.  The two functions 
are of course dependent on the target hardware and have to be supplied 
by the programmer.

	Marc 'BlackJack' Rintsch
Hi! I'm a .signature virus!
Copy me into your ~/.signature to help me spread!

To unsubscribe from the list send mail to with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Nov 9 22:14:27 2009

This archive was generated by hypermail 2.1.8 : 2009-11-09 22:14:29 CET