You can simply use variables (global or local/automatic depending on what you need) and SDCC+GPUTILS will place them wherever they consider and instructions for switching banks will be generated automatically when accesing/using those variables.

So, unless you need variables to be on specific address/bank you don't need to care about it.

Regards,
Diego




On Thu, Jun 5, 2014 at 4:53 AM, Bob Stewart <bob@evoria.net> wrote:
I've been developing someone else's assembly code in Piklab for 18F2220 for about a year and I'd like to move at least some of it to C as a learning experience for another project I want to do.  I have variables in the Access Bank, Bank0, and Bank1.  I only access the variables in Bank0 via FSR, so I don't have to mess with banking for the rest. I cannot figure out how to duplicate this in C on SDCC.  I'm not new to C, just to C with micros.  I'm certainly new to banking in a C environment.

As an example, the following (which are defined in CBLOCKs in the assembly code).  How do I define them in sdcc, and access them as described above?  Do I use small or large memory model?  I can't even figure out how to begin.

Access ram:
    TEMP1_H                  ;13_Temporary 16-bit var available throughout code execution.
    TEMP1_L                  ;14_ "

Bank0:
    TIC_CAL_0                ;00_Address of first value beginning with 0x00
    TIC_CAL_1                ;01_Address of first value beginning with 0x01
    TIC_CAL_TABLE:.99

Bank1:
    OLD_CCPR1L               ;0_Previous CCPR1L value
    OLD_CCPR1H               ;1_Previous CCPR1H value

Bob - AE6RV

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user