On 21.03.2013 10:27, Hynek Sladky wrote:
> So the last question still remains: is there any example how to write
> application for SDCC/Z180 which uses memory banking for code and/or data?
I don't have a Z180, so I didn't test.
The attached example is a simple one for memory banking in the Z180 for
data.
It assumes CBAR has been set up correctly, and that you take care of the
placement of the memory areas (you'll probably want to use linker
options for that).
In the example, functions that set BBR are defined, and named address
spaces that use these functions (for bigger programs you'll probably
want to place these functions in a different file, and only have the
declarations and the address spaces in a header file; probably you'll
also want to generate the function bodies using the preprocessor instead
of writing them all by hand). Each named address space corresponds to
one nak.
Three variables are defined, one in each address space. When accesing
these, sdcc will automatically insert the necessary calls to the
functions that set BBR (and will only insert the minimum number of such
calls necessary).
Philipp
#include "z180.h"
void setb_0(void)
{
BBR = 0;
}
void setb_1(void)
{
BBR = 1;
}
void setb_2(void)
{
BBR = 2;
}
__addressmod setb_0 b_0;
__addressmod setb_1 b_1;
__addressmod setb_2 b_2;
b_0 int a;
b_1 int b;
b_2 int c;
void g(void)
{
a++;
b++;
c++;
}
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user