*** empty log message ***
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 17 Feb 2002 17:14:23 +0000 (17:14 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 17 Feb 2002 17:14:23 +0000 (17:14 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1930 4a8a32a2-be11-0410-ad9d-d568d2c75423

as/xa51/xa_link.c
as/xa51/xa_main.c
device/examples/xa51/Makefile
device/examples/xa51/hello.c
sim/ucsim/xa.src/glob.cc
sim/ucsim/xa.src/xa.cc
src/xa51/gen.c
src/xa51/main.c
src/xa51/ralloc.c
support/regression/ports/xa51/support.c

index 6eb90101b0f801635980904d17bae7322d58c0d0..f6d708eb0361448266cb3fadd7071fff97b9794d 100644 (file)
@@ -212,7 +212,7 @@ void addToModules (char *name, int isLib) {
   module=calloc(1, sizeof(struct MODULE));
   module->name=strdup(name);
   for (s=0; s<MAX_SEGMENTS; s++) {
-    module->offset[s]=segments[s]._size;
+    module->offset[s]=(segments[s]._size+1)&0xfffffe;
   }
   module->isLib=isLib;
   if (!modules) {
@@ -466,11 +466,6 @@ void writeModule(char *outFileName) {
   unsigned int len;
   unsigned int checksum;
 
-  fprintf (stderr, "writeModule: %s from 0x%04x to 0x%04x\n",
-          outFileName, 
-          address,
-          address+size);
-
   if ((fOut=fopen(outFileName, "w"))==NULL) {
     perror (outFileName);
   }
@@ -522,6 +517,11 @@ int relocate() {
   }
 
   // GSFINAL starts at --code-loc ( -b CSEG = 0x1234 )
+  if (segments[CSEG].start & 1) {
+    fprintf (stderr, "*** error: code doesn't start at "
+            "an even address: %04x\n", segments[CSEG].start);
+    exit (1);
+  }
   segments[GSFINAL].start=segments[CSEG].start;
   memset(gsfinalImage, 0xff, CODESIZE);
 
@@ -531,6 +531,9 @@ int relocate() {
   memcpy(to, from, segments[GSINIT]._size);
   segments[GSINIT].start=segments[GSFINAL].start;
   segments[GSFINAL]._size += segments[GSINIT]._size;
+  if (segments[GSFINAL]._size & 1) {
+    segments[GSFINAL]._size++;
+  }
     
   // append cseg to gsfinal
   from=csegImage;
@@ -538,6 +541,9 @@ int relocate() {
   memcpy(to, from, segments[CSEG]._size);
   segments[CSEG].start=segments[GSFINAL].start+segments[GSFINAL]._size;
   segments[GSFINAL]._size += segments[CSEG]._size;
+  if (segments[GSFINAL]._size & 1) {
+    segments[GSFINAL]._size++;
+  }
 
   // append xinit to gsfinal
   from=xinitImage;
@@ -545,8 +551,19 @@ int relocate() {
   memcpy(to, from, segments[XINIT]._size);
   segments[XINIT].start=segments[GSFINAL].start+segments[GSFINAL]._size;
   segments[GSFINAL]._size += segments[XINIT]._size;
+  if (segments[GSFINAL]._size & 1) {
+    segments[GSFINAL]._size++;
+  }
 
   // XISEG is located after XSEG
+  if (segments[XSEG].start & 1) {
+    fprintf (stderr, "*** warning: xdata doesn't start at "
+            "an even address: %04x\n", segments[XSEG].start);
+  }
+  if (segments[XSEG]._size & 1) {
+    segments[XSEG]._size++;
+  }
+  
   segments[XISEG].start=segments[XSEG].start + 
     segments[XSEG]._size;  
 
@@ -598,7 +615,9 @@ int relocate() {
          break;
        }
        case DIR_70FF:
-         gsfinalImage[reference->address] = (symbol->address<<4)&0x70;
+         gsfinalImage[reference->address] = 
+           (gsfinalImage[reference->address]&~0x70) + 
+           ((symbol->address>>4)&0x70);
          gsfinalImage[reference->address+1] = symbol->address;
          break;
        case ABS_FFFF:
index 50c1d44d0c758c99251f831bb3c574694a5cf778..63152a6216633444a29a76fac3a8e1f8527ca352 100644 (file)
@@ -473,14 +473,16 @@ void out(int *byte_list, int num) {
 
 void pad_with_nop()
 {
-       static int nops[] = {NOP_OPCODE, NOP_OPCODE, NOP_OPCODE, NOP_OPCODE};
-       int num;
-
-       last_line_text[0] = '\0';
-
-       for(num=0; (MEM_POS + num) % BRANCH_SPACING; num++) ;
-       if (p3) out(nops, num);
-       MEM_POS += num;
+  static int nops[] = {NOP_OPCODE, NOP_OPCODE, NOP_OPCODE, NOP_OPCODE};
+  int num;
+  
+  last_line_text[0] = '\0';
+  
+  for(num=0; (MEM_POS + num) % BRANCH_SPACING; num++) {
+    sprintf (last_line_text, "\tnop\t; word allignment");
+  }
+  if (p3) out(nops, num);
+  MEM_POS += num;
 }
 
 /* print branch out of bounds error */
@@ -533,9 +535,8 @@ void relPrelude() {
   }
   for (p=sym_list; p; p=p->next) {
     if (p->isdef) {
-      // skip temp labels, sfr and sbit
-      if (p->name[strlen(p->name)-1]!='$' &&
-         p->area) {
+      // skip temp labels
+      if (p->name[strlen(p->name)-1]!='$') {
        globals++;
       }
     }
index b66486c772d6ed49c243eb8acd1578af29cd4b73..f3cf460fbe325b4271370864677545173730a134 100644 (file)
@@ -2,7 +2,8 @@ CC = sdcc
 
 CFLAGS= -Wa-s 
 MFLAGS= -mxa51
-LFLAGS= --code-loc 0x1000 --xram-loc 0x4000
+#LFLAGS= --code-loc 0x1000 --xram-loc 0x4000
+LFLAGS= --xram-loc 0x4000
 
 all: hello.hex
 
index f908681d735d0ea2370f01f6b6c87ff1b8aec702..224327fccc8b6c264244ccd10cfb26a598719762 100755 (executable)
@@ -13,12 +13,17 @@ xdata at 0x1234 abs;
 extern xdata xee;
 
 void main(void) {
-  //xe=getchar();
-  abs=1;
-  putchar('1');
-  putchar('2');
-  putchar('3');
-  putchar('\n');
   puts ("Hello world.\n\r");
+  _asm ;johan _endasm;
+  if (d2==2) {
+    puts ("d2=2");
+  } else {
+    puts ("d2!=2");
+  }
+  if (d1!=3) {
+    puts ("d1!=3");
+  } else {
+    puts ("d1==3");
+  }
   exit_simulator();
 }
index f9e0fa97b4df4b98a0aeff9b94b8e779fa9214b9..7381bf320c9fd40a93be41bc902ea31c1925ace1 100644 (file)
@@ -229,8 +229,8 @@ struct xa_dis_entry disass_xa[]= {
  {1,0xf600,0xff00,' ',2,BPL, REL8            }, //  BPL rel8                   1 1 1 1 0 1 1 0  rel8
  {1,0xfe00,0xff00,' ',2,BR, REL8             }, //  BR rel8                    1 1 1 1 1 1 1 0  rel8
 
- {1,0xc500,0xff00,'l',3,CALL, REL16          }, //  CALL rel16                 1 1 0 0 0 1 0 1  rel16
- {0,0xc600,0xfff8,'l',2,CALL, IREG           }, //  CALL [Rs]                  1 1 0 0 0 1 1 0  0 0 0 0 0 s s s
+ {1,0xc500,0xff00,'a',3,CALL, REL16          }, //  CALL rel16                 1 1 0 0 0 1 0 1  rel16
+ {0,0xc600,0xfff8,'a',2,CALL, IREG           }, //  CALL [Rs]                  1 1 0 0 0 1 1 0  0 0 0 0 0 s s s
 
  {0,0xe200,0xf708,' ',4,CJNE, REG_DIRECT_REL8}, //  CJNE Rd, direct, rel8      1 1 1 0 S 0 1 0  d d d d 0 x x x
  {0,0xe300,0xff0f,' ',4,CJNE, REG_DATA8_REL8},  //  CJNE Rd, data8, rel8       1 1 1 0 0 0 1 1  d d d d 0 0 0 0
index 0f5ed45498c77f9f6fd3834c79d0cebfbcbb8614..cd6084f18d713b54d0316513ee154f8c786e0ad2 100644 (file)
@@ -619,30 +619,30 @@ cl_xa::disass(t_addr addr, char *sep)
               ((signed char) get_mem(MEM_ROM, addr+immed_offset+1) * 2) & 0xfffe );
     break;
     case REG_DATA8_REL8 :
-      sprintf(parm_str, "%s,#0x%04x,0x%02x",
+      sprintf(parm_str, "%s,#0x%02x,0x%02x",
               reg_strs[((code >> 4) & 0xf)],
-              get_mem(MEM_ROM, addr+immed_offset),
-              ((signed char)get_mem(MEM_ROM, addr+immed_offset+1) * 2) & 0xfffe );
+              get_mem(MEM_ROM, addr+immed_offset+1),
+              ((signed char)get_mem(MEM_ROM, addr+immed_offset) * 2) & 0xfffe );
     break;
     case REG_DATA16_REL8 :
-      sprintf(parm_str, "%s,#0x%02x,0x%02x",
-              w_reg_strs[((code >> 4) & 0x7)*2],
-              get_mem(MEM_ROM, addr+immed_offset+1) +
-                 (get_mem(MEM_ROM, addr+immed_offset+0)<<8),
-              ((signed char)get_mem(MEM_ROM, addr+immed_offset+2) * 2) & 0xfffe );
+      sprintf(parm_str, "%s,#0x%04x,0x%02x",
+              w_reg_strs[(code >> 4) & 0xf],
+              get_mem(MEM_ROM, addr+immed_offset+2) +
+                 (get_mem(MEM_ROM, addr+immed_offset+1)<<8),
+              ((signed char)get_mem(MEM_ROM, addr+immed_offset) * 2) & 0xfffe );
     break;
     case IREG_DATA8_REL8 :
-      sprintf(parm_str, "[%s],#0x%04x,0x%02x",
+      sprintf(parm_str, "[%s],#0x%02x,0x%02x",
               reg_strs[((code >> 4) & 0x7)],
-              get_mem(MEM_ROM, addr+immed_offset),
-              ((signed char)get_mem(MEM_ROM, addr+immed_offset+1) * 2) & 0xfffe );
+              get_mem(MEM_ROM, addr+immed_offset+1),
+              ((signed char)get_mem(MEM_ROM, addr+immed_offset) * 2) & 0xfffe );
     break;
     case IREG_DATA16_REL8 :
-      sprintf(parm_str, "[%s],#0x%02x,0x%02x",
-              w_reg_strs[((code >> 4) & 0x7)*2],
-              get_mem(MEM_ROM, addr+immed_offset+1) +
-                 (get_mem(MEM_ROM, addr+immed_offset+0)<<8),
-              ((signed char)get_mem(MEM_ROM, addr+immed_offset+2) * 2) & 0xfffe );
+      sprintf(parm_str, "[%s],#0x%04x,0x%02x",
+              w_reg_strs[(code >> 4) & 0x7],
+              get_mem(MEM_ROM, addr+immed_offset+2) +
+               (get_mem(MEM_ROM, addr+immed_offset+1)<<8),
+              ((signed char)get_mem(MEM_ROM, addr+immed_offset) * 2) & 0xfffe );
     break;
 
     case A_APLUSDPTR :
@@ -653,6 +653,21 @@ cl_xa::disass(t_addr addr, char *sep)
       strcpy(parm_str, "A, [A+PC]");
     break;
 
+    case REG_REGOFF8 :
+      sprintf(parm_str, "%s,%s+0x%02x", 
+             w_reg_strs[(code >> 4) & 0x7],
+             w_reg_strs[code & 0x7],
+             get_mem(MEM_ROM, addr+immed_offset));
+      break;
+
+    case REG_REGOFF16 :
+      sprintf(parm_str, "%s,%s+0x%02x", 
+             w_reg_strs[(code >> 4) & 0x7],
+             w_reg_strs[code & 0x7],
+             get_mem(MEM_ROM, addr+immed_offset+1) +
+               (get_mem(MEM_ROM, addr+immed_offset+0)<<8));
+      break;
+
     default:
       strcpy(parm_str, "???");
     break;
index aa05c37e10aa3c28815f4f2fa508f09fc24bd5c1..2ce675329ec7837f960900daa215d9692ad2c4c1 100755 (executable)
@@ -583,7 +583,8 @@ char * printOp (operand *op) {
   return line;
 }
 
-void printIc (char *op, iCode * ic, bool result, bool left, bool right) {
+void printIc (bool printToStderr, 
+             char *op, iCode * ic, bool result, bool left, bool right) {
   char line[132];
 
   sprintf (line, "%s(%d)", op, ic->lineno);
@@ -600,6 +601,9 @@ void printIc (char *op, iCode * ic, bool result, bool left, bool right) {
     strcat (line, printOp (IC_RIGHT(ic)));
   }
   emitcode (";", line);
+  if (printToStderr) {
+    fprintf (stderr, "%s\n", line);
+  }
 }
 
 /*-----------------------------------------------------------------*/
@@ -680,21 +684,21 @@ static int resultRemat (iCode * ic) {
 /* genNot - generate code for ! operation                          */
 /*-----------------------------------------------------------------*/
 static void genNot (iCode * ic) {
-  printIc("genNot:", ic, 1,1,0);
+  printIc (0, "genNot:", ic, 1,1,0);
 }
 
 /*-----------------------------------------------------------------*/
 /* genCpl - generate code for complement                           */
 /*-----------------------------------------------------------------*/
 static void genCpl (iCode * ic) {
-  printIc("genCpl", ic, 1,1,0);
+  printIc (0, "genCpl", ic, 1,1,0);
 }
 
 /*-----------------------------------------------------------------*/
 /* genUminus - unary minus code generation                         */
 /*-----------------------------------------------------------------*/
 static void genUminus (iCode * ic) {
-  printIc("genUminus", ic, 1,1,0);
+  printIc (0, "genUminus", ic, 1,1,0);
 }
 
 /*-----------------------------------------------------------------*/
@@ -703,7 +707,7 @@ static void genUminus (iCode * ic) {
 static void genIpush (iCode * ic) {
   operand *left=IC_LEFT(ic);
 
-  printIc ("genIpush", ic, 0,1,0);
+  printIc (0, "genIpush", ic, 0,1,0);
   aopOp(left,FALSE,FALSE);
 
 
@@ -749,7 +753,7 @@ static void genIpush (iCode * ic) {
 /* genIpop - recover the registers: can happen only for spilling   */
 /*-----------------------------------------------------------------*/
 static void genIpop (iCode * ic) {
-  printIc ("genIpop", ic, 0,1,0);
+  printIc (0, "genIpop", ic, 0,1,0);
 }
 
 /*-----------------------------------------------------------------*/
@@ -838,7 +842,7 @@ genEndFunction (iCode * ic)
 {
   symbol *sym = OP_SYMBOL (IC_LEFT (ic));
 
-  printIc ("genEndFunction", ic, 0,0,0);
+  printIc (0, "genEndFunction", ic, 0,0,0);
 
   if (IFFUNC_ISNAKED(sym->type)) {
       emitcode(";", "naked function: no epilogue.");
@@ -863,9 +867,9 @@ genEndFunction (iCode * ic)
 static void genRet (iCode * ic) {
 
   if (!IC_LEFT(ic)) {
-    printIc ("genRet", ic, 0, 0, 0);
+    printIc (0, "genRet", ic, 0, 0, 0);
   } else {
-    printIc ("genRet", ic, 0, 1, 0);
+    printIc (0, "genRet", ic, 0, 1, 0);
     aopOp(IC_LEFT(ic), TRUE, TRUE);
     switch (AOP_SIZE(IC_LEFT(ic)))
       {
@@ -918,7 +922,7 @@ static void genPlus (iCode * ic) {
   int size;
   char *instr;
 
-  printIc ("genPlus", ic, 1,1,1);
+  printIc (0, "genPlus", ic, 1,1,1);
 
   size=aopOp(result, TRUE, TRUE);
 
@@ -992,7 +996,7 @@ static void genPlus (iCode * ic) {
 /* genMinus - generates code for subtraction                       */
 /*-----------------------------------------------------------------*/
 static void genMinus (iCode * ic) {
-  printIc ("genMinus", ic, 1,1,1);
+  printIc (0, "genMinus", ic, 1,1,1);
 }
 
 
@@ -1000,40 +1004,21 @@ static void genMinus (iCode * ic) {
 /* genMult - generates code for multiplication                     */
 /*-----------------------------------------------------------------*/
 static void genMult (iCode * ic) {
-  printIc ("genMult", ic, 1,1,1);
+  printIc (0, "genMult", ic, 1,1,1);
 }
 
 /*-----------------------------------------------------------------*/
 /* genDiv - generates code for division                            */
 /*-----------------------------------------------------------------*/
 static void genDiv (iCode * ic) {
-  printIc ("genDiv", ic, 1,1,1);
+  printIc (0, "genDiv", ic, 1,1,1);
 }
 
 /*-----------------------------------------------------------------*/
 /* genMod - generates code for division                            */
 /*-----------------------------------------------------------------*/
 static void genMod (iCode * ic) {
-  printIc ("genMod", ic, 1,1,1);
-}
-
- /*-----------------------------------------------------------------*/
-/* genCmpGt :- greater than comparison                             */
-/*-----------------------------------------------------------------*/
-static void genCmpGt (iCode * ic) {
-  printIc ("genCmpGt", ic, 1,1,1);
-}
-/*-----------------------------------------------------------------*/
-/* genCmpLt - less than comparisons                                */
-/*-----------------------------------------------------------------*/
-static void genCmpLt (iCode * ic) {
-  printIc ("genCmpLt", ic, 1,1,1);
-}
-/*-----------------------------------------------------------------*/
-/* genCmpEq - generates code for equal to                          */
-/*-----------------------------------------------------------------*/
-static void genCmpEq (iCode * ic) {
-  printIc ("genCmpEq", ic, 1,1,1);
+  printIc (0, "genMod", ic, 1,1,1);
 }
 
 /*-----------------------------------------------------------------*/
@@ -1056,6 +1041,80 @@ static iCode *ifxForOp (operand * op, iCode * ic) {
   return NULL;
 }
 
+/*-----------------------------------------------------------------*/
+/* genCmp - compares whatever                                      */
+/*-----------------------------------------------------------------*/
+static void genCmp (iCode * ic, char *trueInstr, char *falseInstr) {
+  iCode *ifx=ifxForOp(IC_RESULT(ic),ic);
+  operand *left=IC_LEFT(ic), *right=IC_RIGHT(ic);
+  int size;
+  bool isTrue;
+  char *instr;
+  int jlbl;
+
+  if (!ifx) {
+    bailOut("genCmp: no ifx");
+  } else {
+    ifx->generated=1;
+  }
+
+  size=aopOp(left, TRUE, TRUE);
+  aopOp(right, !aopIsPtr(left), TRUE);
+
+  if (IC_TRUE(ifx)) {
+    isTrue=TRUE;
+    jlbl=IC_TRUE(ifx)->key+100;
+  } else {
+    isTrue=FALSE;
+    jlbl=IC_FALSE(ifx)->key+100;
+  }
+
+  if (size==1) {
+    instr="cmp.b";
+  } else {
+    instr="cmp.w";
+  }
+  emitcode(instr, "%s,%s", AOP_NAME(left)[0], AOP_NAME(right)[0]);
+  emitcode(isTrue ? trueInstr : falseInstr, "%05d$", jlbl);
+  if (size>2) {
+    bailOut("genCmp: size > 2");
+  }
+}
+
+/*-----------------------------------------------------------------*/
+/* genCmpEq :- generates code for equal to                         */
+/*-----------------------------------------------------------------*/
+static void genCmpEq (iCode * ic) {
+  printIc (0, "genCmpEq", ic, 0,1,1);
+  genCmp(ic, "beq", "bne"); // no sign
+}
+
+/*-----------------------------------------------------------------*/
+/* genCmpGt :- greater than comparison                             */
+/*-----------------------------------------------------------------*/
+static void genCmpGt (iCode * ic) {
+  printIc (0, "genCmpGt", ic, 0,1,1);
+  if (SPEC_USIGN(operandType(IC_LEFT(ic))) ||
+      SPEC_USIGN(operandType(IC_RIGHT(ic)))) {
+    genCmp(ic, "bg", "bl"); // unsigned
+  } else {
+    genCmp(ic, "bgt", "ble"); // signed
+  }
+}
+
+/*-----------------------------------------------------------------*/
+/* genCmpLt - less than comparisons                                */
+/*-----------------------------------------------------------------*/
+static void genCmpLt (iCode * ic) {
+  printIc (0, "genCmpLt", ic, 0,1,1);
+  if (SPEC_USIGN(operandType(IC_LEFT(ic))) ||
+      SPEC_USIGN(operandType(IC_RIGHT(ic)))) {
+    genCmp(ic, "bcs", "bcc"); // unsigned
+  } else {
+    genCmp(ic, "blt", "bge"); // signed
+  }
+}
+
 /*-----------------------------------------------------------------*/
 /* hasInc - operand is incremented before any other use            */
 /*-----------------------------------------------------------------*/
@@ -1098,21 +1157,21 @@ static iCode *hasInc (operand *op, iCode *ic, int osize) {
 /* genAndOp - for && operation                                     */
 /*-----------------------------------------------------------------*/
 static void genAndOp (iCode * ic) {
-  printIc ("genAndOp(&&)", ic, 1,1,1);
+  printIc (0, "genAndOp(&&)", ic, 1,1,1);
 }
 
 /*-----------------------------------------------------------------*/
 /* genOrOp - for || operation                                      */
 /*-----------------------------------------------------------------*/
 static void genOrOp (iCode * ic) {
-  printIc ("genOrOp(||)", ic, 1,1,1);
+  printIc (0, "genOrOp(||)", ic, 1,1,1);
 }
 
 /*-----------------------------------------------------------------*/
 /* genAnd  - code for and                                            */
 /*-----------------------------------------------------------------*/
 static void genAnd (iCode * ic, iCode * ifx) {
-  printIc ("genAnd", ic, 1,1,1);
+  printIc (0, "genAnd", ic, 1,1,1);
 }
 
 /*-----------------------------------------------------------------*/
@@ -1123,7 +1182,7 @@ static void genOr (iCode * ic, iCode * ifx) {
   int size;
   char *instr;
 
-  printIc ("genOr", ic, 1,1,1);
+  printIc (0, "genOr", ic, 1,1,1);
 
   size=aopOp(result, TRUE, TRUE);
 
@@ -1171,7 +1230,7 @@ static void genOr (iCode * ic, iCode * ifx) {
 /* genXor - code for xclusive or                                   */
 /*-----------------------------------------------------------------*/
 static void genXor (iCode * ic, iCode * ifx) {
-  printIc ("genXor", ic, 1,1,1);
+  printIc (0, "genXor", ic, 1,1,1);
 }
 
 /*-----------------------------------------------------------------*/
@@ -1179,7 +1238,7 @@ static void genXor (iCode * ic, iCode * ifx) {
 /*-----------------------------------------------------------------*/
 static void genInline (iCode * ic) {
 
-  printIc ("genInline", ic, 0,0,0);
+  printIc (0, "genInline", ic, 0,0,0);
   
   emitcode ("", IC_INLINE(ic));
 }
@@ -1188,35 +1247,35 @@ static void genInline (iCode * ic) {
 /* genRRC - rotate right with carry                                */
 /*-----------------------------------------------------------------*/
 static void genRRC (iCode * ic) {
-  printIc ("genRRC", ic, 1,1,0);
+  printIc (0, "genRRC", ic, 1,1,0);
 }
 
 /*-----------------------------------------------------------------*/
 /* genRLC - generate code for rotate left with carry               */
 /*-----------------------------------------------------------------*/
 static void genRLC (iCode * ic) {
-  printIc ("genRLC", ic, 1,1,0);
+  printIc (0, "genRLC", ic, 1,1,0);
 }
 
 /*-----------------------------------------------------------------*/
 /* genGetHbit - generates code get highest order bit               */
 /*-----------------------------------------------------------------*/
 static void genGetHbit (iCode * ic) {
-  printIc ("genGetHbit", ic, 1,1,0);
+  printIc (0, "genGetHbit", ic, 1,1,0);
 }
 
 /*-----------------------------------------------------------------*/
 /* genLeftShift - generates code for left shifting                 */
 /*-----------------------------------------------------------------*/
 static void genLeftShift (iCode * ic) {
-  printIc ("genLeftShift", ic, 1,1,1);
+  printIc (0, "genLeftShift", ic, 1,1,1);
 }
 
 /*-----------------------------------------------------------------*/
 /* genRightShift - generate code for right shifting                */
 /*-----------------------------------------------------------------*/
 static void genRightShift (iCode * ic) {
-  printIc ("genRightShift", ic, 1,1,1);
+  printIc (0, "genRightShift", ic, 1,1,1);
 }
 
 /*-----------------------------------------------------------------*/
@@ -1229,9 +1288,9 @@ static void genPointerGet (iCode * ic, iCode *pi) {
   int size;
 
   if (pi) {
-    printIc ("genPointerGet pi", ic, 1,1,0);
+    printIc (0, "genPointerGet pi", ic, 1,1,0);
   } else {
-    printIc ("genPointerGet", ic, 1,1,0);
+    printIc (0, "genPointerGet", ic, 1,1,0);
   }
 
   if (!IS_PTR(operandType(left))) {
@@ -1360,7 +1419,7 @@ static void genPointerSet (iCode * ic, iCode *pi) {
   operand *result=IC_RESULT(ic), *right=IC_RIGHT(ic);
   int size;
 
-  printIc ("genPointerSet", ic, 1,0,1);
+  printIc (0, "genPointerSet", ic, 1,0,1);
 
   if (!IS_PTR(operandType(result))) {
     bailOut ("genPointerSet: pointer required");
@@ -1474,7 +1533,7 @@ static void genAddrOf (iCode * ic) {
   int size;
   operand *left=IC_LEFT(ic);
 
-  printIc ("genAddrOf", ic, 1,1,0);
+  printIc (0, "genAddrOf", ic, 1,1,0);
 
   size=aopOp (IC_RESULT(ic), FALSE, TRUE);
 
@@ -1517,7 +1576,7 @@ static void genAssign (iCode * ic) {
   int size;
   char *instr;
 
-  printIc ("genAssign", ic, 1,0,1);
+  printIc (0, "genAssign", ic, 1,0,1);
   
   if (!IS_SYMOP(result)) {
     bailOut("genAssign: result is not a symbol");
@@ -1572,7 +1631,7 @@ static void genAssign (iCode * ic) {
 /* genJumpTab - genrates code for jump table                       */
 /*-----------------------------------------------------------------*/
 static void genJumpTab (iCode * ic) {
-  printIc ("genJumpTab", ic, 0,0,0);
+  printIc (0, "genJumpTab", ic, 0,0,0);
 }
 
 /*-----------------------------------------------------------------*/
@@ -1587,7 +1646,7 @@ static void genCast (iCode * ic) {
   sym_link *etype=getSpec(rtype);
   short ptrType, signedness;
 
-  printIc ("genCast", ic, 1,1,1);
+  printIc (0, "genCast", ic, 1,1,1);
 
   aopOp(result, TRUE, TRUE);
   aopOp(right, !aopIsPtr(result), AOP_TYPE(result)!=AOP_DIR);
@@ -1757,7 +1816,7 @@ static bool genDjnz (iCode * ic, iCode * ifx) {
   if (getSize (operandType (IC_RESULT (ic))) > 2)
     return 0;
 
-  printIc ("genDjnz", ic, 1,1,1);
+  printIc (0, "genDjnz", ic, 1,1,1);
 
   /* otherwise we can save BIG */
   lbl = newiTempLabel (NULL);
@@ -1782,7 +1841,7 @@ static bool genDjnz (iCode * ic, iCode * ifx) {
 /* genReceive - generate code for a receive iCode                  */
 /*-----------------------------------------------------------------*/
 static void genReceive (iCode * ic) {
-  printIc ("genReceive", ic, 1,0,0);
+  printIc (0, "genReceive", ic, 1,0,0);
 }
 
 /*-----------------------------------------------------------------*/
index f6ae8c8d8a4228d08778c4e6f1aedfac041203cd..8875d3e7b964b4c88d0985e0afca507e54c1dda1 100755 (executable)
@@ -149,10 +149,12 @@ _xa51_genAssemblerPreamble (FILE * of)
     fprintf (of, "\t.dw\t__sdcc_gsinit_startup\n");
     fprintf (of, "\n");
     fprintf (of, "__sdcc_gsinit_startup:\n");
-    fprintf (of, "\tmov.b\t_SCR,#0x01\t; page zero mode\n");
+    //fprintf (of, ";\tmov.b\t_SCR,#0x01\t; page zero mode\n");
+    fprintf (of, "\t.db 0x96,0x48,0x40,0x01\n");
     fprintf (of, "\tmov\tr7,#0x%04x\n", options.stack_loc);
     fprintf (of, "\tcall\t_external_startup\n");
     _xa51_genXINIT(of);
+    fprintf (of, "\t.area CSEG\t(CODE)\n");
     fprintf (of, "\tcall\t_main\n");
     fprintf (of, "\treset\t;main should not return\n");
   }
index 037e79830a8d88a10e18fd8d78ebcececbf1167a..7274ca78dcff2d4c554acb365abda645769acb0a 100755 (executable)
@@ -1883,8 +1883,6 @@ static void packRegisters (eBBlock * ebp) {
   iCode *ic;
   int change = 0;
   
-  return; // that's it for now
-
   while (1) {
     change = 0;
     
@@ -1899,6 +1897,24 @@ static void packRegisters (eBBlock * ebp) {
 
   for (ic = ebp->sch; ic; ic = ic->next)
     {
+      /* if the condition of an if instruction
+         is defined in the previous instruction and
+        this is the only usage then
+         mark the itemp as a conditional */
+      if ((IS_CONDITIONAL (ic) ||
+          (IS_BITWISE_OP(ic) && isBitwiseOptimizable (ic)))) {
+       if (ic->next && ic->next->op == IFX &&
+           bitVectnBitsOn (OP_USES(IC_RESULT(ic)))==1 &&
+           isOperandEqual (IC_RESULT (ic), IC_COND (ic->next)) &&
+           OP_SYMBOL (IC_RESULT (ic))->liveTo <= ic->next->seq) {
+         OP_SYMBOL (IC_RESULT (ic))->regType = REG_CND;
+         continue;
+       }
+      }
+
+      // that's all for now
+      continue;
+
       /* if this is an itemp & result of an address of a true sym 
          then mark this as rematerialisable   */
       if (ic->op == ADDRESS_OF &&
@@ -1966,21 +1982,6 @@ static void packRegisters (eBBlock * ebp) {
       if (POINTER_GET (ic))
        OP_SYMBOL (IC_LEFT (ic))->uptr = 1;
 
-      /* if the condition of an if instruction
-         is defined in the previous instruction and
-        this is the only usage then
-         mark the itemp as a conditional */
-      if ((IS_CONDITIONAL (ic) ||
-          (IS_BITWISE_OP(ic) && isBitwiseOptimizable (ic))) &&
-         ic->next && ic->next->op == IFX &&
-         bitVectnBitsOn (OP_USES(IC_RESULT(ic)))==1 &&
-         isOperandEqual (IC_RESULT (ic), IC_COND (ic->next)) &&
-         OP_SYMBOL (IC_RESULT (ic))->liveTo <= ic->next->seq)
-       {
-         OP_SYMBOL (IC_RESULT (ic))->regType = REG_CND;
-         continue;
-       }
-
       /* reduce for support function calls */
       if (ic->supportRtn || ic->op == '+' || ic->op == '-')
        packRegsForSupport (ic, ebp);
index a725e4e51c77c2ebec1b6c8e661c6b66efb5d204..8b0919175f2a10777a2ce695f34702ddec64a819 100755 (executable)
@@ -20,7 +20,7 @@
    what you give them.   Help stamp out software-hoarding!
 -------------------------------------------------------------------------*/
 
-#include <tinibios.h>
+#include <80c51xa.h>
 
 void external_startup(void) {
   return;