* src/pic/gen.c (genInline),
[fw/sdcc] / src / pic / device.c
index 67b168d329df16425d58fcffbe358a7d7bfefba8..495eee7db10dacf04cd261fd26b6f8c129ce1a3f 100644 (file)
@@ -58,7 +58,7 @@ static PIC_device Pics[] = {
                        (memRange *)NULL,
                        (memRange *)NULL,
                        0,
-                       0xcf,
+                       0x4f, /* 68 register available 0x0C to 0x4F (0x8C to 0xCF mapped to bank 0) */
                        0x80,
        },
        
@@ -93,8 +93,6 @@ static PIC_device Pics[] = {
 
 static int num_of_supported_PICS = sizeof(Pics)/sizeof(PIC_device);
 
-#define DEFAULT_PIC "f877"
-
 static PIC_device *pic=NULL;
 
 AssignedMemory *finalMapping=NULL;
@@ -161,6 +159,7 @@ void setMaxRAM(int size)
        for(i=0; i<=pic->maxRAMaddress; i++) {
                finalMapping[i].reg = NULL;
                finalMapping[i].isValid = 0;
+               finalMapping[i].bank = (i>>7);
        }
 }
 
@@ -241,9 +240,9 @@ void dump_sfr(FILE *of)
                } else {
                        if(start>=0) {
                                
-                       /* clear the lower 7-bits of the start address of the first
-                       * variable declared in this bank. The upper bits for the mid
-                       * range pics are the bank select bits.
+                               /* clear the lower 7-bits of the start address of the first
+                               * variable declared in this bank. The upper bits for the mid
+                               * range pics are the bank select bits.
                                */
                                
                                bank_base = start & 0xfff8;
@@ -630,5 +629,19 @@ int getConfigWord(int address)
 *-----------------------------------------------------------------*/
 void setDefMaxRam(void)
 {
-       setMaxRAM(pic->defMaxRAMaddrs); // Max RAM has not been included, so use default setting
+       unsigned i;
+       setMaxRAM(pic->defMaxRAMaddrs); /* Max RAM has not been included, so use default setting */
+       /* Validate full memory range for use by general purpose RAM */
+       for (i=pic->defMaxRAMaddrs; i--; ) {
+               finalMapping[i].bank = (i>>7);
+               finalMapping[i].isValid = 1;
+       }
+}
+
+/*-----------------------------------------------------------------*
+*  
+*-----------------------------------------------------------------*/
+unsigned getMaxRam(void)
+{
+       return pic->defMaxRAMaddrs;
 }