+2003-01-13 Bernhard Held <bernhard@bernhardheld.de>
+
+ * src/ds390/peeph.def: fix #123; add 14 rules by Fiorenzo D. Ramaglia <fd.ramaglia@tin.it>
+ * src/mcs51/peeph.def: fix #123; add 14 rules by Fiorenzo
+ * src/mcs51/gen.c (genFunction): emit r0 instead of ar0 by Fiorenzo
+ * as/mcs51/lkmem (summary): better fix for sp problem
+ * src/SDCCglue.c (glue): __start_stack - 1, saves 1 byte!
+ * src/ds390/main.c (_ds390_finaliseOptions, _tininative_finaliseOptions): stack_loc = 0x400008
+
2003-01-12 Bernhard Held <bernhard@bernhardheld.de>
* src/SDCCmain.c (main): port->finaliseOptions() moved for z80 linking
}
/*Report the position of the begining of the stack*/
- fprintf(of, "\nStack starts at: 0x%02lx", Stack.Start);
+ /* TODO find flag for DS390 */
+ fprintf(of, "\n%stack starts at: 0x%02lx (sp set to 0x%02lx)",
+ 0 ? "16 bit mode initial s" : "S", Stack.Start, Stack.Start-1);
/*Check that the stack pointer is landing in a safe place:*/
- // if (!flat24Mode) TODO: bypass stack check for ds390
+ if( (dram[Stack.Start] & 0x8000) == 0x8000 )
{
- if( (dram[Stack.Start] & 0x8000) == 0x8000 )
- {
- fprintf(of, ".\n");
- sprintf(buff, "Stack set to unavailable memory.\n");
- REPORT_ERROR(buff, 1);
- }
- else if(dram[Stack.Start+1])
+ fprintf(of, ".\n");
+ sprintf(buff, "Stack set to unavailable memory.\n");
+ REPORT_ERROR(buff, 1);
+ }
+ else if(dram[Stack.Start])
+ {
+ fprintf(of, ".\n");
+ sprintf(buff, "Stack overlaps area ");
+ REPORT_ERROR(buff, 1);
+ for(j=0; j<7; j++)
{
- fprintf(of, ".\n");
- sprintf(buff, "Stack overlaps area ");
- REPORT_ERROR(buff, 1);
- for(j=0; j<7; j++)
+ if(dram[Stack.Start]&Ram[j].flag)
{
- if(dram[Stack.Start+1]&Ram[j].flag)
- {
- sprintf(buff, "'%s'\n", Ram[j].Name);
- break;
- }
+ sprintf(buff, "'%s'\n", Ram[j].Name);
+ break;
}
- if(dram[Stack.Start]&IRam.flag)
- {
- sprintf(buff, "'%s'\n", IRam.Name);
- }
- REPORT_ERROR(buff, 0);
}
- else
+ if(dram[Stack.Start]&IRam.flag)
{
- for(j=Stack.Start, k=0; (j<(int)iram_size)&&(dram[j]==0); j++, k++);
- fprintf(of, " with %d bytes available\n", k);
- if (k<MIN_STACK)
- {
- sprintf(buff, "Only %d byte%s available for stack.\n",
- k, (k==1)?"":"s");
- REPORT_WARNING(buff, 1);
- }
+ sprintf(buff, "'%s'\n", IRam.Name);
+ }
+ REPORT_ERROR(buff, 0);
+ }
+ else
+ {
+ for(j=Stack.Start, k=0; (j<(int)iram_size)&&(dram[j]==0); j++, k++);
+ fprintf(of, " with %d bytes available\n", k);
+ if (k<MIN_STACK)
+ {
+ sprintf(buff, "Only %d byte%s available for stack.\n",
+ k, (k==1)?"":"s");
+ REPORT_WARNING(buff, 1);
}
}
}
/* initialise the stack pointer. JCF: aslink takes care of the location */
- fprintf (asmFile, "\tmov\tsp,#__start__stack\n"); /* MOF */
+ fprintf (asmFile, "\tmov\tsp,#__start__stack - 1\n"); /* MOF */
fprintf (asmFile, "\tlcall\t__sdcc_external_startup\n");
fprintf (asmFile, "\tmov\ta,dpl\n");
fprintf (stderr,
"*** error: ds390 port only supports the 10 bit stack mode.\n");
} else {
- if (!options.stack_loc) options.stack_loc = 0x400007;
+ if (!options.stack_loc) options.stack_loc = 0x400008;
}
/* generate native code 16*16 mul/div */
fprintf(stderr,"TININative supports only stack10bit \n");
}
- if (!options.stack_loc) options.stack_loc = 0x400007;
+ if (!options.stack_loc) options.stack_loc = 0x400008;
/* generate native code 16*16 mul/div */
if (options.useAccelerator)
}
else
{
- /* not callee-saves, we can clobber ar0 */
- emitcode ("mov", "ar0,a");
+ /* not callee-saves, we can clobber r0 */
+ emitcode ("mov", "r0,a");
emitcode ("mov", "a,sp");
emitcode ("add", "a,#0x%02x", ((char) sym->stack & 0xff));
emitcode ("mov", "sp,a");
- emitcode ("mov", "a,ar0");
+ emitcode ("mov", "a,r0");
}
}
else