// File: 16c56a_g.lkr
// Generic linker script for the PIC16C56A processor

#DEFINE _CODEEND _DEBUGCODESTART - 1
#DEFINE _CEND _CODEEND + _DEBUGCODELEN
#DEFINE _DATAEND _DEBUGDATASTART - 1
#DEFINE _DEND _DATAEND + _DEBUGDATALEN

LIBPATH .

CODEPAGE   NAME=page0      START=0x0               END=0x1FF                    

#IFDEF _DEBUGCODESTART
  CODEPAGE   NAME=page1      START=0x200             END=_CODEEND
  CODEPAGE   NAME=debug      START=_DEBUGCODESTART   END=_CEND        PROTECTED
#ELSE
  CODEPAGE   NAME=page1      START=0x200             END=0x3FF                    
#FI

CODEPAGE   NAME=.idlocs    START=0x400             END=0x403          PROTECTED 
CODEPAGE   NAME=.config    START=0xFFF             END=0xFFF          PROTECTED 

DATABANK   NAME=sfrs       START=0x0               END=0x6            PROTECTED


#IFDEF _DEBUGDATASTART
  DATABANK   NAME=gprs       START=0x7               END=_DATAEND     
  DATABANK   NAME=dbgspr     START=_DEBUGDATASTART   END=_DEND        PROTECTED
#ELSE //no debug
  DATABANK   NAME=gprs       START=0x7               END=0x1F           
#FI


SECTION    NAME=PROG1      ROM=page0           // ROM code space - page0
SECTION    NAME=PROG2      ROM=page1           // ROM code space - page1
SECTION    NAME=IDLOCS     ROM=.idlocs         // ID locations

