Only in ../../sdcc/src: Makefile Only in ../../sdcc/src: Makefile.dep diff -cr -x CVS src/SDCCglue.c ../../sdcc/src/SDCCglue.c *** src/SDCCglue.c Sat Jul 24 11:30:13 2004 --- ../../sdcc/src/SDCCglue.c Tue Jul 27 12:31:24 2004 *************** *** 1425,1434 **** --- 1425,1437 ---- { time_t t; time (&t); + /* fprintf (afile, "%s", iComments1); fprintf (afile, "; Version " SDCC_VERSION_STR " #%s (%s)\n", getBuildNumber(), __DATE__); fprintf (afile, "; This file generated %s", asctime (localtime (&t))); fprintf (afile, "%s", iComments2); + */ + tfprintf(afile, "!fileheadercomment\n", getBuildNumber(), __DATE__, asctime (localtime (&t))); } /*-----------------------------------------------------------------*/ *************** *** 1438,1448 **** printPublics (FILE * afile) { symbol *sym; ! fprintf (afile, "%s", iComments2); fprintf (afile, "; Public variables in this module\n"); fprintf (afile, "%s", iComments2); ! for (sym = setFirstItem (publics); sym; sym = setNextItem (publics)) tfprintf (afile, "\t!global\n", sym->rname); --- 1441,1455 ---- printPublics (FILE * afile) { symbol *sym; ! /* fprintf (afile, "%s", iComments2); fprintf (afile, "; Public variables in this module\n"); fprintf (afile, "%s", iComments2); ! */ ! ! tfprintf (afile, "!linecomment\n", "------------------------------------------------"); ! tfprintf (afile, "!linecomment\n", "Public variables in this module"); ! tfprintf (afile, "!linecomment\n", "------------------------------------------------"); for (sym = setFirstItem (publics); sym; sym = setNextItem (publics)) tfprintf (afile, "\t!global\n", sym->rname); *************** *** 1456,1468 **** { symbol *sym; fprintf (afile, "%s", iComments2); fprintf (afile, "; Externals used\n"); fprintf (afile, "%s", iComments2); ! for (sym = setFirstItem (externs); sym; sym = setNextItem (externs)) tfprintf (afile, "\t!extern\n", sym->rname); } /*-----------------------------------------------------------------*/ --- 1463,1480 ---- { symbol *sym; + /* fprintf (afile, "%s", iComments2); fprintf (afile, "; Externals used\n"); fprintf (afile, "%s", iComments2); ! */ ! tfprintf (afile, "!linecomment\n", "------------------------------------------------"); ! tfprintf (afile, "!linecomment\n", "Public variables in this module"); ! tfprintf (afile, "!linecomment\n", "------------------------------------------------"); for (sym = setFirstItem (externs); sym; sym = setNextItem (externs)) tfprintf (afile, "\t!extern\n", sym->rname); + } /*-----------------------------------------------------------------*/ *************** *** 1486,1492 **** if (elementsInSet (ovrset)) { /* output the area informtion */ ! fprintf (afile, "\t.area\t%s\n", port->mem.overlay_name); /* MOF */ } for (sym = setFirstItem (ovrset); sym; --- 1498,1504 ---- if (elementsInSet (ovrset)) { /* output the area informtion */ ! tfprintf (afile, "\t!area\n", port->mem.overlay_name); /* MOF */ } for (sym = setFirstItem (ovrset); sym; *************** *** 1702,1802 **** ||( TARGET_IS_Z80 )) /*.p.t.20030924 need to output SFR table for Z80 as well */ { /* copy the sfr segment */ fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; special function registers\n"); fprintf (asmFile, "%s", iComments2); copyFile (asmFile, sfr->oFile); } if(mcs51_like) { /* copy the sbit segment */ fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; special function bits \n"); fprintf (asmFile, "%s", iComments2); copyFile (asmFile, sfrbit->oFile); /*JCF: Create the areas for the register banks*/ if(RegBankUsed[0]||RegBankUsed[1]||RegBankUsed[2]||RegBankUsed[3]) { fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; overlayable register banks \n"); fprintf (asmFile, "%s", iComments2); if(RegBankUsed[0]) ! fprintf (asmFile, "\t.area REG_BANK_0\t(REL,OVR,DATA)\n\t.ds 8\n"); if(RegBankUsed[1]||options.parms_in_bank1) ! fprintf (asmFile, "\t.area REG_BANK_1\t(REL,OVR,DATA)\n\t.ds 8\n"); if(RegBankUsed[2]) ! fprintf (asmFile, "\t.area REG_BANK_2\t(REL,OVR,DATA)\n\t.ds 8\n"); if(RegBankUsed[3]) ! fprintf (asmFile, "\t.area REG_BANK_3\t(REL,OVR,DATA)\n\t.ds 8\n"); } } /* copy the data segment */ fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; %s ram data\n", mcs51_like?"internal":""); fprintf (asmFile, "%s", iComments2); copyFile (asmFile, data->oFile); /* create the overlay segments */ if (overlay) { fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; overlayable items in %s ram \n", mcs51_like?"internal":""); fprintf (asmFile, "%s", iComments2); copyFile (asmFile, ovrFile); } /* create the stack segment MOF */ if (mainf && IFFUNC_HASBODY(mainf->type)) { fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; Stack segment in internal ram \n"); fprintf (asmFile, "%s", iComments2); ! fprintf (asmFile, "\t.area\tSSEG\t(DATA)\n" ! "__start__stack:\n\t.ds\t1\n\n"); } /* create the idata segment */ if ( (idata) && (mcs51_like) ) { fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; indirectly addressable internal ram data\n"); fprintf (asmFile, "%s", iComments2); copyFile (asmFile, idata->oFile); } /* copy the bit segment */ if (mcs51_like) { fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; bit data\n"); fprintf (asmFile, "%s", iComments2); copyFile (asmFile, bit->oFile); } /* if external stack then reserve space of it */ if (mainf && IFFUNC_HASBODY(mainf->type) && options.useXstack) { fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; external stack \n"); fprintf (asmFile, "%s", iComments2); ! fprintf (asmFile, "\t.area XSEG (XDATA)\n"); /* MOF */ fprintf (asmFile, "\t.ds 256\n"); } /* copy xtern ram data */ if (mcs51_like) { fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; external ram data\n"); fprintf (asmFile, "%s", iComments2); copyFile (asmFile, xdata->oFile); } /* copy xternal initialized ram data */ fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; external initialized ram data\n"); fprintf (asmFile, "%s", iComments2); copyFile (asmFile, xidata->oFile); /* If the port wants to generate any extra areas, let it do so. */ --- 1714,1890 ---- ||( TARGET_IS_Z80 )) /*.p.t.20030924 need to output SFR table for Z80 as well */ { /* copy the sfr segment */ + /* fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; special function registers\n"); fprintf (asmFile, "%s", iComments2); + */ + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); + tfprintf (asmFile, "!linecomment\n", "special function registers "); + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); copyFile (asmFile, sfr->oFile); } if(mcs51_like) { /* copy the sbit segment */ + /* fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; special function bits \n"); fprintf (asmFile, "%s", iComments2); + */ + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); + tfprintf (asmFile, "!linecomment\n", "special function bits "); + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); copyFile (asmFile, sfrbit->oFile); /*JCF: Create the areas for the register banks*/ if(RegBankUsed[0]||RegBankUsed[1]||RegBankUsed[2]||RegBankUsed[3]) { + /* fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; overlayable register banks \n"); fprintf (asmFile, "%s", iComments2); + */ + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); + tfprintf (asmFile, "!linecomment\n", "overlayable register banks "); + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); if(RegBankUsed[0]) ! { ! tfprintf (asmFile, "\t!area\n", "REG_BANK_0\t(REL,OVR,DATA)"); ! tfprintf (asmFile, "\t!ds\n", 8); ! }; if(RegBankUsed[1]||options.parms_in_bank1) ! { ! tfprintf (asmFile, "\t!area\n", "REG_BANK_1\t(REL,OVR,DATA)"); ! tfprintf (asmFile, "\t!ds\n", 8); ! }; if(RegBankUsed[2]) ! { ! tfprintf (asmFile, "\t!area\n", "REG_BANK_2\t(REL,OVR,DATA)"); ! tfprintf (asmFile, "\t!ds\n", 8); ! }; if(RegBankUsed[3]) ! { ! tfprintf (asmFile, "\t!area\n", "REG_BANK_3\t(REL,OVR,DATA)"); ! tfprintf (asmFile, "\t!ds\n", 8); ! }; } } /* copy the data segment */ + /* fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; %s ram data\n", mcs51_like?"internal":""); fprintf (asmFile, "%s", iComments2); + */ + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); + if(mcs51_like) + tfprintf (asmFile, "!linecomment\n", "internal ram data "); + else + tfprintf (asmFile, "!linecomment\n", "ram data "); + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); copyFile (asmFile, data->oFile); /* create the overlay segments */ if (overlay) { + /* fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; overlayable items in %s ram \n", mcs51_like?"internal":""); fprintf (asmFile, "%s", iComments2); + */ + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); + if(mcs51_like) + tfprintf (asmFile, "!linecomment\n", "overlayable items in internal ram "); + else + tfprintf (asmFile, "!linecomment\n", "overlayable items in ram "); + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); copyFile (asmFile, ovrFile); } /* create the stack segment MOF */ if (mainf && IFFUNC_HASBODY(mainf->type)) { + /* fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; Stack segment in internal ram \n"); fprintf (asmFile, "%s", iComments2); ! */ ! tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); ! tfprintf (asmFile, "!linecomment\n", "stack segment in internal ram "); ! tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); ! ! tfprintf (asmFile, "\t!area\n", "SSEG\t(DATA)"); ! tfprintf (asmFile, "__start__stack:\n\t!ds\n\n", 1); } /* create the idata segment */ if ( (idata) && (mcs51_like) ) { + /* fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; indirectly addressable internal ram data\n"); fprintf (asmFile, "%s", iComments2); + */ + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); + tfprintf (asmFile, "!linecomment\n", "indirectly addressable internal ram data "); + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); copyFile (asmFile, idata->oFile); } /* copy the bit segment */ if (mcs51_like) { + /* fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; bit data\n"); fprintf (asmFile, "%s", iComments2); + */ + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); + tfprintf (asmFile, "!linecomment\n", "bit data "); + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); copyFile (asmFile, bit->oFile); } /* if external stack then reserve space of it */ if (mainf && IFFUNC_HASBODY(mainf->type) && options.useXstack) { + /* fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; external stack \n"); fprintf (asmFile, "%s", iComments2); ! fprintf (asmFile, "\t.area XSEG (XDATA)\n"); // MOF fprintf (asmFile, "\t.ds 256\n"); + */ + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); + tfprintf (asmFile, "!linecomment\n", "external stack "); + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); + tfprintf (asmFile, "\t!area\n", "XSEG (XDATA)"); + tfprintf (asmFile, "\t!ds\n", 256); } /* copy xtern ram data */ if (mcs51_like) { + /* fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; external ram data\n"); fprintf (asmFile, "%s", iComments2); + */ + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); + tfprintf (asmFile, "!linecomment\n", "external ram data "); + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); copyFile (asmFile, xdata->oFile); } /* copy xternal initialized ram data */ + /* fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; external initialized ram data\n"); fprintf (asmFile, "%s", iComments2); + */ + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); + tfprintf (asmFile, "!linecomment\n", "external initialized ram data "); + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); copyFile (asmFile, xidata->oFile); /* If the port wants to generate any extra areas, let it do so. */ *************** *** 1809,1824 **** --- 1897,1922 ---- /* copy the interrupt vector table */ if (mainf && IFFUNC_HASBODY(mainf->type)) { + /* fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; interrupt vector \n"); fprintf (asmFile, "%s", iComments2); + */ + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); + tfprintf (asmFile, "!linecomment\n", "interrupt vector "); + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); copyFile (asmFile, vFile); } /* copy global & static initialisations */ + /* fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; global & static initialisations\n"); fprintf (asmFile, "%s", iComments2); + */ + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); + tfprintf (asmFile, "!linecomment\n", "global & static initialisations "); + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); /* Everywhere we generate a reference to the static_name area, * (which is currently only here), we immediately follow it with a *************** *** 1838,1844 **** } else { ! fprintf (asmFile, "__sdcc_gsinit_startup:\n"); /* if external stack is specified then the higher order byte of the xdatalocation is going into P2 and the lower order going into --- 1936,1942 ---- } else { ! fprintf (asmFile, "__sdcc_gsinit_startup: /* standard glue. Bad when not 51-compatible !!! Modify backend!!! */\n"); /* if external stack is specified then the higher order byte of the xdatalocation is going into P2 and the lower order going into *************** *** 1876,1882 **** } copyFile (asmFile, statsg->oFile); ! if (port->general.glue_up_main && mainf && IFFUNC_HASBODY(mainf->type)) { /* This code is generated in the post-static area. * This area is guaranteed to follow the static area --- 1974,1980 ---- } copyFile (asmFile, statsg->oFile); ! if ((mcs51_like) && (port->general.glue_up_main && mainf && IFFUNC_HASBODY(mainf->type))) { /* This code is generated in the post-static area. * This area is guaranteed to follow the static area *************** *** 1886,1902 **** --- 1984,2010 ---- fprintf (asmFile, "\tljmp\t__sdcc_program_startup\n"); } + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); + tfprintf (asmFile, "!linecomment\n", "Home"); + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); + /* fprintf (asmFile, "%s" "; Home\n" "%s", iComments2, iComments2); + */ tfprintf (asmFile, "\t!areahome\n", HOME_NAME); copyFile (asmFile, home->oFile); /* copy over code */ + /* fprintf (asmFile, "%s", iComments2); fprintf (asmFile, "; code\n"); fprintf (asmFile, "%s", iComments2); + */ + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); + tfprintf (asmFile, "!linecomment\n", "code"); + tfprintf (asmFile, "!linecomment\n", "--------------------------------------------------------"); tfprintf (asmFile, "\t!areacode\n", CODE_NAME); if (mainf && IFFUNC_HASBODY(mainf->type)) { *************** *** 1905,1913 **** fprintf (asmFile, "__sdcc_program_startup:\n"); /* put in jump or call to main */ if (options.mainreturn) { ! fprintf (asmFile, "\tljmp\t_main\n"); /* needed? */ fprintf (asmFile, ";\treturn from main will return to caller\n"); } else --- 2013,2022 ---- fprintf (asmFile, "__sdcc_program_startup:\n"); /* put in jump or call to main */ + /* That's PORT-SPECIFIC!! if (options.mainreturn) { ! fprintf (asmFile, "\tljmp\t_main\n"); // needed? fprintf (asmFile, ";\treturn from main will return to caller\n"); } else *************** *** 1916,1921 **** --- 2025,2041 ---- fprintf (asmFile, ";\treturn from main will lock up\n"); fprintf (asmFile, "\tsjmp .\n"); } + */ + if(options.mainreturn) + { + if(port->genCallMain) + port->genCallMain(asmFile); + } + else + { + if(port->genJumpMain) + port->genJumpMain(asmFile); + } } copyFile (asmFile, code->oFile); Only in ../../sdcc/src: SDCClex.c diff -cr -x CVS src/SDCCmem.c ../../sdcc/src/SDCCmem.c *** src/SDCCmem.c Tue May 18 10:21:26 2004 --- ../../sdcc/src/SDCCmem.c Tue Jul 27 09:17:58 2004 *************** *** 972,977 **** --- 972,978 ---- printAllocInfoSeg (memmap * map, symbol * func, FILE * of) { symbol *sym; + char tmp[1024]; if (!map) return; *************** *** 980,1024 **** for (sym = setFirstItem (map->syms); sym; sym = setNextItem (map->syms)) ! { ! ! if (sym->level == 0) ! continue; ! if (sym->localof != func) ! continue; ! fprintf (of, ";%-25s Allocated ", sym->name); ! ! /* if assigned to registers */ ! if (!sym->allocreq && sym->reqv) { int i; ! sym = OP_SYMBOL (sym->reqv); if (!sym->isspilt || sym->remat) ! { ! fprintf (of, "to registers "); ! for (i = 0; i < 4 && sym->regs[i]; i++) ! fprintf (of, "%s ", port->getRegName (sym->regs[i])); ! fprintf (of, "\n"); ! continue; ! } else ! { ! sym = sym->usl.spillLoc; ! } } ! ! /* if on stack */ ! if (sym->onStack) { ! fprintf (of, "to stack - offset %d\n", sym->stack); continue; } ! ! /* otherwise give rname */ ! fprintf (of, "with name '%s'\n", sym->rname); ! } } /*-----------------------------------------------------------------*/ --- 981,1036 ---- for (sym = setFirstItem (map->syms); sym; sym = setNextItem (map->syms)) ! { ! if (sym->level == 0) ! continue; ! if (sym->localof != func) ! continue; ! ! //tfprintf (of, "!linecomment\n", "%-25s Allocated %s", sym->name, ""); ! tsprintf(tmp, 1024, "%-25s Allocated ", sym->name); ! ! /* if assigned to registers */ ! if (!sym->allocreq && sym->reqv) { int i; ! sym = OP_SYMBOL (sym->reqv); if (!sym->isspilt || sym->remat) ! { ! //fprintf (of, "to registers "); ! strcat(tmp, "to registers "); ! for (i = 0; i < 4 && sym->regs[i]; i++) ! { ! //fprintf (of, "%s ", port->getRegName (sym->regs[i])); ! strncat(tmp, port->getRegName(sym->regs[i]), 10); //there shouldn't be registers with more than 10 chars as name ! strcat(tmp, " "); ! }; ! //fprintf(of, "\n"); ! tfprintf (of, "!linecomment\n", tmp); ! continue; ! } else ! { ! sym = sym->usl.spillLoc; ! } } ! ! /* if on stack */ ! if (sym->onStack) { ! //fprintf (of, "to stack - offset %d\n", sym->stack); ! tsprintf(tmp, 1024, "to stack - offset %d\n", sym->stack); ! tfprintf(of, "!linecomment\n", tmp); continue; } ! ! /* otherwise give rname */ ! //fprintf (of, "with name '%s'\n", sym->rname); ! tsprintf(tmp, 1024, "with name '%s'", sym->rname); ! tfprintf(of, "!linecomment\n", tmp); ! } } /*-----------------------------------------------------------------*/ *************** *** 1094,1099 **** --- 1106,1113 ---- void printAllocInfo (symbol * func, FILE * of) { + char tmp[1024]; + if (!func) return; *************** *** 1101,1109 **** of = stdout; /* must be called after register allocation is complete */ ! fprintf (of, ";------------------------------------------------------------\n"); ! fprintf (of, ";Allocation info for local variables in function '%s'\n", func->name); ! fprintf (of, ";------------------------------------------------------------\n"); printAllocInfoSeg (xstack, func, of); printAllocInfoSeg (istack, func, of); --- 1115,1124 ---- of = stdout; /* must be called after register allocation is complete */ ! tfprintf (of, "!linecomment\n", "------------------------------------------------------------"); ! tsprintf (tmp, 1024, "Allocation info for local variables in function '%s'", func->name); ! tfprintf (of, "!linecomment\n", tmp); ! tfprintf (of, "!linecomment\n", "------------------------------------------------------------"); printAllocInfoSeg (xstack, func, of); printAllocInfoSeg (istack, func, of); *************** *** 1128,1132 **** overlay->syms = tempOverlaySyms; } ! fprintf (of, ";------------------------------------------------------------\n"); } --- 1143,1147 ---- overlay->syms = tempOverlaySyms; } ! tfprintf (of, "!linecomment\n", "------------------------------------------------------------"); } Only in ../../sdcc/src: SDCCy.c Only in ../../sdcc/src: SDCCy.h diff -cr -x CVS src/asm.c ../../sdcc/src/asm.c *** src/asm.c Sun Sep 28 18:16:56 2003 --- ../../sdcc/src/asm.c Tue Jul 27 12:13:30 2004 *************** *** 365,370 **** --- 365,372 ---- {"hashedstr", "#%s"}, {"lsbimmeds", "#<%s"}, {"msbimmeds", "#>%s"}, + {"lsbimmedd", "#<%d"}, + {"msbimmedd", "#>%d"}, {"module", ".module %s"}, {"global", ".globl %s"}, {"fileprelude", ""}, *************** *** 388,433 **** {"hihil","(%05d$ >> 16)"}, {"hihihil","(%05d$ >> 24)"}, {"equ","="}, {NULL, NULL} }; static const ASM_MAPPING _gas_mapping[] = { ! {"labeldef", "%s::"}, {"slabeldef", "%s:"}, {"tlabeldef", "%05d$:"}, {"tlabel", "%05d$"}, ! {"immed", "#"}, ! {"zero", "#0x00"}, ! {"one", "#0x01"}, {"area", ".section %s"}, {"areacode", ".section %s"}, {"areadata", ".section %s"}, {"areahome", ".section %s"}, {"ascii", ".ascii \"%s\""}, ! {"ds", ".ds %d"}, ! {"db", ".db"}, ! {"dbs", ".db %s"}, ! {"dw", ".dw"}, ! {"dws", ".dw %s"}, {"constbyte", "0x%02X"}, {"constword", "0x%04X"}, ! {"immedword", "#0x%04X"}, ! {"immedbyte", "#0x%02X"}, ! {"hashedstr", "#%s"}, ! {"lsbimmeds", "#<%s"}, ! {"msbimmeds", "#>%s"}, {"module", ".file \"%s.c\""}, ! {"global", ".globl %s"}, ! {"extern", ".globl %s"}, {"fileprelude", ""}, {"functionheader", ! "; ---------------------------------\n" ! "; Function %s\n" ! "; ---------------------------------" }, {"functionlabeldef", "%s:"}, ! {"bankimmeds", "0 ; PENDING: bank support"}, {NULL, NULL} }; --- 390,467 ---- {"hihil","(%05d$ >> 16)"}, {"hihihil","(%05d$ >> 24)"}, {"equ","="}, + {"fileheadercomment", + ";--------------------------------------------------------\n" + "; File Created by SDCC : FreeWare ANSI-C Compiler\n" + "; Version " SDCC_VERSION_STR " #%s (%s)\n" + "; This file generated %s\n" + ";--------------------------------------------------------" + }, + {"linecomment", "; %s"}, + {"multilinecomment", ""}, //empty string means 'doesn't exist' {NULL, NULL} }; static const ASM_MAPPING _gas_mapping[] = { ! {"labeldef", "%s:"}, {"slabeldef", "%s:"}, {"tlabeldef", "%05d$:"}, {"tlabel", "%05d$"}, ! {"immed", ""}, ! {"zero", "0x00"}, ! {"one", "0x01"}, {"area", ".section %s"}, {"areacode", ".section %s"}, {"areadata", ".section %s"}, {"areahome", ".section %s"}, {"ascii", ".ascii \"%s\""}, ! {"ds", ".ds %d /* ??? */"}, ! {"db", ".byte"}, ! {"dbs", ".byte %s"}, ! {"dw", ".word"}, ! {"dws", ".word %s"}, {"constbyte", "0x%02X"}, {"constword", "0x%04X"}, ! {"immedword", "0x%04X"}, ! {"immedbyte", "0x%02X"}, ! {"hashedstr", "%s"}, ! {"lsbimmeds", "lo8(%s)"}, ! {"msbimmeds", "hi8(%s)"}, ! {"lsbimmedd", "lo8(%d)"}, ! {"msbimmedd", "hi8(%d)"}, ! {"los","lo8(%s & 0xFF)"}, ! {"his","lo8(%s >> 8)"}, ! {"hihis","lo8(%s >> 16)"}, ! {"hihihis","lo8(%s >> 24)"}, ! {"lod","lo8(%d & 0xFF)"}, ! {"hid","lo8(%d >> 8)"}, ! {"hihid","lo8(%d >> 16)"}, ! {"hihihid","lo8(%d >> 24)"}, ! {"lol","lo8(%05d$ & 0xFF)"}, ! {"hil","lo8(%05d$ >> 8)"}, ! {"hihil","lo8(%05d$ >> 16)"}, ! {"hihihil","lo8(%05d$ >> 24)"}, {"module", ".file \"%s.c\""}, ! {"global", ".global %s"}, ! {"extern", ".global %s"}, {"fileprelude", ""}, {"functionheader", ! "/* ---------------------------------\n" ! " Function %s\n" ! " --------------------------------- */" }, {"functionlabeldef", "%s:"}, ! {"bankimmeds", "0 /* PENDING: bank support */"}, ! {"fileheadercomment", ! "/* --------------------------------------------------------\n" ! " File Created by SDCC : FreeWare ANSI-C Compiler\n" ! " Version " SDCC_VERSION_STR " #%s (%s)\n" ! " This file generated %s\n" ! " -------------------------------------------------------- */" ! }, ! {"linecomment", "/* %-70s */"}, ! {"multilinecomment", "/*\n%s\n*/"}, //when a multiline-comment is allowed, the form "%s" is expected {NULL, NULL} }; *************** *** 457,462 **** --- 491,498 ---- {"hashedstr", "#%s"}, {"lsbimmeds", "#<%s"}, {"msbimmeds", "#>%s"}, + {"lsbimmedd", "#<%d"}, + {"msbimmedd", "#>%d"}, {"module", "; .file \"%s.c\""}, {"global", "; .globl %s"}, {"fileprelude", ""}, *************** *** 480,485 **** --- 516,530 ---- {"hihil","((L%05d / 65536) & 0FFh)"}, {"hihihil","((L%09d / 16777216) & 0FFh)"}, {"equ"," equ"}, + {"fileheadercomment", + ";--------------------------------------------------------\n" + "; File Created by SDCC : FreeWare ANSI-C Compiler\n" + "; Version " SDCC_VERSION_STR " #%s (%s)\n" + "; This file generated %s\n" + ";--------------------------------------------------------" + }, + {"linecomment", "; %s"}, + {"multilinecomment", ""}, //empty string means 'doesn't exist' {NULL, NULL} }; *************** *** 509,514 **** --- 554,561 ---- {"hashedstr", "#%s"}, {"lsbimmeds", "#<%s"}, {"msbimmeds", "#>%s"}, + {"lsbimmedd", "#<%d"}, + {"msbimmedd", "#>%d"}, {"module", "; .module %s"}, {"global", ".globl %s"}, {"fileprelude", ""}, *************** *** 532,537 **** --- 579,593 ---- {"hihil","((L%05d / 65536) & 0FFh)"}, {"hihihil","((L%09d / 16777216) & 0FFh)"}, {"equ"," equ"}, + {"fileheadercomment", + ";--------------------------------------------------------\n" + "; File Created by SDCC : FreeWare ANSI-C Compiler\n" + "; Version " SDCC_VERSION_STR " #%s (%s)\n" + "; This file generated %s\n" + ";--------------------------------------------------------" + }, + {"linecomment", "; %s"}, + {"multilinecomment", ""}, //empty string means 'doesn't exist' {NULL, NULL} }; Only in ../../sdcc/src/avr: Makefile.dep diff -cr -x CVS src/avr/gen.c ../../sdcc/src/avr/gen.c *** src/avr/gen.c Thu May 13 23:51:54 2004 --- ../../sdcc/src/avr/gen.c Tue Jul 27 12:06:36 2004 *************** *** 51,57 **** char *fReturnAVR[] = { "r16", "r17", "r18", "r19" }; unsigned fAVRReturnSize = 4; /* shared with ralloc.c */ char **fAVRReturn = fReturnAVR; ! static char *larray[4] = { ">", "<", "hlo8", "hhi8" }; static struct { short xPushed; --- 51,57 ---- char *fReturnAVR[] = { "r16", "r17", "r18", "r19" }; unsigned fAVRReturnSize = 4; /* shared with ralloc.c */ char **fAVRReturn = fReturnAVR; ! static char *larray[4] = { "%s,!lod", "%s,!hid", "%s,!hilod", "%s,!hihid" }; static struct { short xPushed; *************** *** 244,253 **** sprintf (lb, "%s\t", inst); else sprintf (lb, "%s", inst); ! vsprintf (lb + (strlen (lb)), fmt, ap); } else ! vsprintf (lb, fmt, ap); while (isspace (*lbp)) lbp++; --- 244,253 ---- sprintf (lb, "%s\t", inst); else sprintf (lb, "%s", inst); ! tvsprintf (lb + (strlen (lb)), INITIAL_INLINEASM, fmt, ap); } else ! tvsprintf (lb, INITIAL_INLINEASM, fmt, ap); while (isspace (*lbp)) lbp++; *************** *** 462,486 **** _G.nRegsSaved)); } else { ! emitcode ("subi", "%s,<(%d)", aop->aopu.aop_ptr->name, sym->stack - _G.nRegsSaved); ! emitcode ("sbci", "%s,>(%d)", aop->aop_ptr2->name, sym->stack - _G.nRegsSaved); } } else { if (sym->stack <= 63) { ! emitcode ("adiw", "%s,0x%02x", aop->aopu.aop_ptr->name, sym->stack); } else { ! emitcode ("subi", "%s,<(-%d)", aop->aopu.aop_ptr->name, sym->stack); ! emitcode ("sbci", "%s,>(-%d)", aop->aop_ptr2->name, sym->stack); } --- 462,486 ---- _G.nRegsSaved)); } else { ! emitcode ("subi", "%s,!lsbimmedd", aop->aopu.aop_ptr->name, sym->stack - _G.nRegsSaved); ! emitcode ("sbci", "%s,!msbimmedd", aop->aop_ptr2->name, sym->stack - _G.nRegsSaved); } } else { if (sym->stack <= 63) { ! emitcode ("adiw", "%s,!constbyte", aop->aopu.aop_ptr->name, sym->stack); } else { ! emitcode ("subi", "%s,!lsbimmedd", aop->aopu.aop_ptr->name, sym->stack); ! emitcode ("sbci", "%s,!msbimmedd", aop->aop_ptr2->name, sym->stack); } *************** *** 523,530 **** aop->aopu.aop_ptr = getFreePtr (ic, &aop, result, aop->code); aop->size = getSize (sym->type); ! emitcode ("ldi", "%s,<(%s)", aop->aopu.aop_ptr->name, sym->rname); ! emitcode ("ldi", "%s,>(%s)", aop->aop_ptr2); return aop; } --- 523,532 ---- aop->aopu.aop_ptr = getFreePtr (ic, &aop, result, aop->code); aop->size = getSize (sym->type); ! { ! emitcode ("ldi", "%s,!lsbimmeds", aop->aopu.aop_ptr->name, sym->rname); ! emitcode ("ldi", "%s,!msbimmeds", aop->aop_ptr2, sym->rname); ! } return aop; } *************** *** 859,868 **** stk + 1); } else { ! emitcode ("subi", "%s,<(%d)", aop->aopu.aop_ptr->name, -(stk + 1)); ! emitcode ("sbci", "%s,>(%d)", aop->aop_ptr2->name, -(stk + 1)); } --- 861,870 ---- stk + 1); } else { ! emitcode ("subi", "%s,!lsbimmedd", aop->aopu.aop_ptr->name, -(stk + 1)); ! emitcode ("sbci", "%s,!msbimmedd", aop->aop_ptr2->name, -(stk + 1)); } *************** *** 992,998 **** case AOP_LIT: s = aopLiteral (aop->aopu.aop_lit, offset); ! emitcode ("ldi", "%s,<(%s)", (rs = ((offset & 1) ? "r24" : "r25")), s); return rs; --- 994,1000 ---- case AOP_LIT: s = aopLiteral (aop->aopu.aop_lit, offset); ! emitcode ("ldi", "%s,!lsbimmeds", (rs = ((offset & 1) ? "r24" : "r25")), s); return rs; *************** *** 1589,1597 **** emitcode ("sbiw", "r28,%d", ic->parmBytes); } else { ! emitcode ("subi", "r28,<(%d)", ic->parmBytes); ! emitcode ("sbci", "r29,>(%d)", ic->parmBytes); } } --- 1591,1599 ---- emitcode ("sbiw", "r28,%d", ic->parmBytes); } else { ! emitcode ("subi", "r28,!lsbimmedd", ic->parmBytes); ! emitcode ("sbci", "r29,!msbimmedd", ic->parmBytes); } } *************** *** 1672,1680 **** emitcode ("sbiw", "r28,%d", ic->parmBytes); } else { ! emitcode ("subi", "r28,<(%d)", ic->parmBytes); ! emitcode ("sbci", "r29,>(%d)", ic->parmBytes); } } --- 1674,1682 ---- emitcode ("sbiw", "r28,%d", ic->parmBytes); } else { ! emitcode ("subi", "r28,!lsbimmedd", ic->parmBytes); ! emitcode ("sbci", "r29,!msbimmedd", ic->parmBytes); } } *************** *** 1718,1727 **** _G.nRegsSaved = 0; /* create the function header */ ! emitcode (";", "-----------------------------------------"); ! emitcode (";", " function %s", (sym = OP_SYMBOL (IC_LEFT (ic)))->name); ! emitcode (";", "-----------------------------------------"); emitcode ("", "%s:", sym->rname); ftype = operandType (IC_LEFT (ic)); --- 1720,1729 ---- _G.nRegsSaved = 0; /* create the function header */ ! emitcode ("/*", "-----------------------------------------"); ! emitcode (" ", " function %s", (sym = OP_SYMBOL (IC_LEFT (ic)))->name); ! emitcode (" ", "----------------------------------------- */"); emitcode ("", "%s:", sym->rname); ftype = operandType (IC_LEFT (ic)); *************** *** 1767,1774 **** emitcode ("sbiw", "r28,%d", sym->stack); } else { ! emitcode ("subi", "r28,<(%d)", sym->stack); ! emitcode ("sbci", "r29,>(%d)", sym->stack); } emitcode ("out", "__SP_L__,r28"); emitcode ("out", "__SP_H__,r29"); --- 1769,1776 ---- emitcode ("sbiw", "r28,%d", sym->stack); } else { ! emitcode ("subi", "r28,!lsbimmedd", sym->stack); ! emitcode ("sbci", "r29,!msbimmedd", sym->stack); } emitcode ("out", "__SP_L__,r28"); emitcode ("out", "__SP_H__,r29"); *************** *** 1790,1797 **** emitcode ("adiw", "r28,%d", sym->stack); } else { ! emitcode ("subi", "r28,<(-%d)", sym->stack); ! emitcode ("sbci", "r29,>(-%d)", sym->stack); } emitcode ("out", "__SP_L__,r28"); emitcode ("out", "__SP_H__,r29"); --- 1792,1799 ---- emitcode ("adiw", "r28,%d", sym->stack); } else { ! emitcode ("subi", "r28,!lsbimmedd", -sym->stack); ! emitcode ("sbci", "r29,!msbimmedd", -sym->stack); } emitcode ("out", "__SP_L__,r28"); emitcode ("out", "__SP_H__,r29"); *************** *** 1860,1867 **** while (size--) { if (AOP_TYPE (IC_LEFT (ic)) == AOP_LIT) { ! emitcode ("ldi", "%s,%s(%d)", fAVRReturn[offset], ! larray[offset], (int) floatFromVal (AOP (IC_LEFT (ic))-> aopu.aop_lit), offset); } --- 1862,1868 ---- while (size--) { if (AOP_TYPE (IC_LEFT (ic)) == AOP_LIT) { ! emitcode ("ldi", larray[offset], fAVRReturn[offset], (int) floatFromVal (AOP (IC_LEFT (ic))-> aopu.aop_lit), offset); } *************** *** 1942,1948 **** return TRUE; } if (AOP_ISHIGHREG( AOP (IC_LEFT (ic)),0)) { ! emitcode ("subi", "%s,<(%d)", aopGet (AOP (IC_LEFT (ic)), 0), 0-icount); return TRUE; } --- 1943,1949 ---- return TRUE; } if (AOP_ISHIGHREG( AOP (IC_LEFT (ic)),0)) { ! emitcode ("subi", "%s,!lsbimmedd", aopGet (AOP (IC_LEFT (ic)), 0), 0-icount); return TRUE; } *************** *** 1965,1981 **** } /* use subi */ ! emitcode ("subi", "%s,<(%d)", aopGet (AOP (IC_RESULT (ic)), 0), 0-icount); ! emitcode ("sbci", "%s,>(%d)", aopGet (AOP (IC_RESULT (ic)), 1), 0-icount); return TRUE; } /* for 32 bit longs */ ! emitcode ("subi", "%s,<(%d)", aopGet (AOP (IC_RESULT (ic)), 0), 0-icount); ! emitcode ("sbci", "%s,>(%d)", aopGet (AOP (IC_RESULT (ic)), 1), 0-icount); emitcode ("sbci", "%s,hlo8(%d)", aopGet (AOP (IC_RESULT (ic)), 2), 0-icount); --- 1966,1982 ---- } /* use subi */ ! emitcode ("subi", "%s,!lsbimmedd", aopGet (AOP (IC_RESULT (ic)), 0), 0-icount); ! emitcode ("sbci", "%s,!msbimmedd", aopGet (AOP (IC_RESULT (ic)), 1), 0-icount); return TRUE; } /* for 32 bit longs */ ! emitcode ("subi", "%s,!lsbimmedd", aopGet (AOP (IC_RESULT (ic)), 0), 0-icount); ! emitcode ("sbci", "%s,!msbimmedd", aopGet (AOP (IC_RESULT (ic)), 1), 0-icount); emitcode ("sbci", "%s,hlo8(%d)", aopGet (AOP (IC_RESULT (ic)), 2), 0-icount); *************** *** 2130,2136 **** return TRUE; } if (AOP_ISHIGHREG( AOP ( IC_LEFT(ic)),0)) { ! emitcode ("subi", "%s,<(%d)", aopGet (AOP (IC_LEFT (ic)), 0), icount); return TRUE; } --- 2131,2137 ---- return TRUE; } if (AOP_ISHIGHREG( AOP ( IC_LEFT(ic)),0)) { ! emitcode ("subi", "%s,!lsbimmedd", aopGet (AOP (IC_LEFT (ic)), 0), icount); return TRUE; } *************** *** 2153,2168 **** } /* use subi */ ! emitcode ("subi", "%s,<(%d)", aopGet (AOP (IC_RESULT (ic)), 0), icount); ! emitcode ("sbci", "%s,>(%d)", aopGet (AOP (IC_RESULT (ic)), 1), icount); return TRUE; } /* for 32 bit longs */ ! emitcode ("subi", "%s,<(%d)", aopGet (AOP (IC_RESULT (ic)), 0), icount); ! emitcode ("sbci", "%s,>(%d)", aopGet (AOP (IC_RESULT (ic)), 1), icount); emitcode ("sbci", "%s,hlo8(%d)", aopGet (AOP (IC_RESULT (ic)), 2), icount); --- 2154,2169 ---- } /* use subi */ ! emitcode ("subi", "%s,!lsbimmedd", aopGet (AOP (IC_RESULT (ic)), 0), icount); ! emitcode ("sbci", "%s,!msbimmedd", aopGet (AOP (IC_RESULT (ic)), 1), icount); return TRUE; } /* for 32 bit longs */ ! emitcode ("subi", "%s,!lsbimmedd", aopGet (AOP (IC_RESULT (ic)), 0), icount); ! emitcode ("sbci", "%s,!msbimmedd", aopGet (AOP (IC_RESULT (ic)), 1), icount); emitcode ("sbci", "%s,hlo8(%d)", aopGet (AOP (IC_RESULT (ic)), 2), icount); *************** *** 2433,2439 **** if (ifx) { if (size == 1) { if (AOP_TYPE (right) == AOP_LIT) { ! emitcode ("cpi", "%s,<(%d)", aopGet (AOP (left), 0), (int) floatFromVal (AOP (IC_RIGHT (ic))-> --- 2434,2440 ---- if (ifx) { if (size == 1) { if (AOP_TYPE (right) == AOP_LIT) { ! emitcode ("cpi", "%s,!lsbimmedd", aopGet (AOP (left), 0), (int) floatFromVal (AOP (IC_RIGHT (ic))-> *************** *** 2699,2710 **** if (size == 1) { if (eh && AOP_ISHIGHREG(AOP(IC_LEFT(ic)),0)) { emitcode (bopnames_lit[bitop], ! "%s,<(%d)", aopGet (AOP (IC_LEFT (ic)), 0), lit); } else { MOVR24 (aopGet (AOP (IC_LEFT (ic)), 0)); ! emitcode (bopnames_lit[bitop], "r24,<(%d)", lit); } lbl = newiTempLabel (NULL); if (IC_TRUE (ifx)) { --- 2700,2711 ---- if (size == 1) { if (eh && AOP_ISHIGHREG(AOP(IC_LEFT(ic)),0)) { emitcode (bopnames_lit[bitop], ! "%s,!lsbimmed", aopGet (AOP (IC_LEFT (ic)), 0), lit); } else { MOVR24 (aopGet (AOP (IC_LEFT (ic)), 0)); ! emitcode (bopnames_lit[bitop], "r24,!lsbimmedd", lit); } lbl = newiTempLabel (NULL); if (IC_TRUE (ifx)) { *************** *** 2720,2727 **** else if (size == 2) { emitcode ("mov", "r24,%s", aopGet (AOP (IC_LEFT (ic)), 0)); emitcode ("mov", "r25,%s", aopGet (AOP (IC_LEFT (ic)), 1)); ! emitcode (bopnames_lit[bitop], "r24,<(%d)", lit); ! emitcode (bopnames_lit[bitop], "r25,>(%d)", lit); emitcode ("sbiw", "r24,0"); lbl = newiTempLabel (NULL); if (IC_TRUE (ifx)) { --- 2721,2728 ---- else if (size == 2) { emitcode ("mov", "r24,%s", aopGet (AOP (IC_LEFT (ic)), 0)); emitcode ("mov", "r25,%s", aopGet (AOP (IC_LEFT (ic)), 1)); ! emitcode (bopnames_lit[bitop], "r24,!lsbimmedd", lit); ! emitcode (bopnames_lit[bitop], "r25,!msbimmedd", lit); emitcode ("sbiw", "r24,0"); lbl = newiTempLabel (NULL); if (IC_TRUE (ifx)) { *************** *** 2739,2752 **** lbl1 = newiTempLabel (NULL); while (size--) { if (eh && AOP_ISHIGHREG(AOP(IC_LEFT(ic)),offset)) { ! emitcode (bopnames_lit [bitop], "%s,<(%d)", aopGet (AOP (IC_LEFT (ic)), offset), lit); } else { char *l = aopGet (AOP (IC_LEFT (ic)), offset); MOVR24 (l); ! emitcode ("andi", "r24,<(%d)", lit); } emitcode ("brne", "L%05d", lbl->key); offset++; --- 2740,2753 ---- lbl1 = newiTempLabel (NULL); while (size--) { if (eh && AOP_ISHIGHREG(AOP(IC_LEFT(ic)),offset)) { ! emitcode (bopnames_lit [bitop], "%s,!lsbimmedd", aopGet (AOP (IC_LEFT (ic)), offset), lit); } else { char *l = aopGet (AOP (IC_LEFT (ic)), offset); MOVR24 (l); ! emitcode ("andi", "r24,!lsbimmedd", lit); } emitcode ("brne", "L%05d", lbl->key); offset++; *************** *** 3063,3075 **** if (!sameRegs (AOP (left), AOP (result))) { emitcode ("clr", "%s", aopGet (AOP (result), size - 1)); emitcode ("sbrc", "%s,7", aopGet (AOP (left), size - 1)); ! emitcode ("subi", "%s,<(-1)", ! aopGet (AOP (result), size - 1)); } else { emitcode ("clr", "r0"); emitcode ("sbrc", "%s,7", aopGet (AOP (left), size - 1)); ! emitcode ("subi", "r0,<(-1)"); aopPut (AOP (result), "r0", 0); } offset = 1; --- 3064,3076 ---- if (!sameRegs (AOP (left), AOP (result))) { emitcode ("clr", "%s", aopGet (AOP (result), size - 1)); emitcode ("sbrc", "%s,7", aopGet (AOP (left), size - 1)); ! emitcode ("subi", "%s,!lsbimmedd", ! aopGet (AOP (result), size - 1), -1); } else { emitcode ("clr", "r0"); emitcode ("sbrc", "%s,7", aopGet (AOP (left), size - 1)); ! emitcode ("subi", "r0,!lsbimmedd", -1); aopPut (AOP (result), "r0", 0); } offset = 1; *************** *** 3393,3399 **** } } else { ! emitcode ("ldi", "r24,<(%d)", shCount); tlbl = newiTempLabel (NULL); emitcode ("", "L%05d:", tlbl->key); offset = size - 1; --- 3394,3400 ---- } } else { ! emitcode ("ldi", "r24,!lsbimmedd", shCount); tlbl = newiTempLabel (NULL); emitcode ("", "L%05d:", tlbl->key); offset = size - 1; *************** *** 4663,4673 **** emitcode ("mov","%s,r29",aopGet(AOP(IC_RESULT(ic)),1)); } if (sym->stack < 0) { ! emitcode("subi","%s,<(%d)",aopGet(AOP(IC_RESULT(ic)),0),-sym->stack); ! emitcode("sbci","%s,>(%d)",aopGet(AOP(IC_RESULT(ic)),1),-sym->stack); } else { ! emitcode("subi","%s,<(-%d)",aopGet(AOP(IC_RESULT(ic)),0),sym->stack); ! emitcode("sbci","%s,>(-%d)",aopGet(AOP(IC_RESULT(ic)),1),sym->stack); } } else { emitcode("movw","r24,r28"); --- 4664,4674 ---- emitcode ("mov","%s,r29",aopGet(AOP(IC_RESULT(ic)),1)); } if (sym->stack < 0) { ! emitcode("subi","%s,!lsbimmedd",aopGet(AOP(IC_RESULT(ic)),0),-sym->stack); ! emitcode("sbci","%s,!msbimmedd",aopGet(AOP(IC_RESULT(ic)),1),-sym->stack); } else { ! emitcode("subi","%s,!lsbimmedd",aopGet(AOP(IC_RESULT(ic)),0),sym->stack); ! emitcode("sbci","%s,!msbimmedd",aopGet(AOP(IC_RESULT(ic)),1),sym->stack); } } else { emitcode("movw","r24,r28"); *************** *** 4678,4688 **** emitcode("sbiw","r24,%d",sym->stack); } else { if (sym->stack < 0) { ! emitcode("subi","r24,<(%d)",-sym->stack); ! emitcode("sbci","r25,>(%d)",-sym->stack); } else { ! emitcode("subi","r24,<(-%d)",sym->stack); ! emitcode("sbci","r25,>(-%d)",sym->stack); } } --- 4679,4689 ---- emitcode("sbiw","r24,%d",sym->stack); } else { if (sym->stack < 0) { ! emitcode("subi","r24,!lsbimmedd",-sym->stack); ! emitcode("sbci","r25,!msbimmedd",-sym->stack); } else { ! emitcode("subi","r24,!lsbimmedd",sym->stack); ! emitcode("sbci","r25,!msbimmedd",sym->stack); } } *************** *** 4711,4719 **** while (size--) { char s[SDCC_NAME_MAX]; if (offset) ! sprintf (s, ">(%s)", sym->rname); else ! sprintf (s, "<(%s)", sym->rname); aopPut (AOP (IC_RESULT (ic)), s, offset++); } --- 4712,4720 ---- while (size--) { char s[SDCC_NAME_MAX]; if (offset) ! tsprintf (s, SDCC_NAME_MAX, "!msbimmeds", sym->rname); else ! tsprintf (s, SDCC_NAME_MAX, "!lsbimmeds", sym->rname); aopPut (AOP (IC_RESULT (ic)), s, offset++); } *************** *** 4851,4856 **** --- 4852,4861 ---- symbol *jtab; char *l; + /* NOT IMPLEMENTED */ + fprintf(stderr, "Not implemented: avr/gen.c: genJumpTab()!\n"); + exit(1); + aopOp (IC_JTCOND (ic), ic, FALSE); /* get the condition into accumulator */ l = aopGet (AOP (IC_JTCOND (ic)), 0); *************** *** 4883,4888 **** --- 4888,4897 ---- operand *right = IC_RIGHT (ic); int size, offset; + /* NOT IMPLEMENTED */ + fprintf(stderr, "Not implemented: avr/gen.c: genCast()!\n"); + exit(1); + /* if they are equivalent then do nothing */ if (operandsEqu (IC_RESULT (ic), IC_RIGHT (ic))) return; *************** *** 5033,5038 **** --- 5042,5052 ---- genDjnz (iCode * ic, iCode * ifx) { symbol *lbl, *lbl1; + + /* NOT IMPLEMENTED */ + fprintf(stderr, "Not implemented: avr/gen.c: genDjnz()!\n"); + exit(1); + if (!ifx) return 0; *************** *** 5108,5121 **** static void genDummyRead (iCode * ic) { ! emitcode ("; genDummyRead",""); ! emitcode ("; not implemented",""); ic = ic; } /*-----------------------------------------------------------------*/ ! /* gen51Code - generate code for 8051 based controllers */ /*-----------------------------------------------------------------*/ void genAVRCode (iCode * lic) --- 5122,5135 ---- static void genDummyRead (iCode * ic) { ! emitcode ("/* genDummyRead */",""); ! emitcode ("/* not implemented */",""); ic = ic; } /*-----------------------------------------------------------------*/ ! /* genAVRCode - generate code for AVR V3 based controllers */ /*-----------------------------------------------------------------*/ void genAVRCode (iCode * lic) *************** *** 5142,5148 **** if (options.debug) { debugFile->writeCLine (ic); } ! emitcode (";", "%s %d", ic->filename, ic->lineno); cln = ic->lineno; } /* if the result is marked as --- 5156,5162 ---- if (options.debug) { debugFile->writeCLine (ic); } ! emitcode ("/*", "%s %d */", ic->filename, ic->lineno); cln = ic->lineno; } /* if the result is marked as Only in ../../sdcc/src/avr: gen.o diff -cr -x CVS src/avr/main.c ../../sdcc/src/avr/main.c *** src/avr/main.c Tue May 25 12:30:09 2004 --- ../../sdcc/src/avr/main.c Tue Jul 27 13:21:38 2004 *************** *** 38,44 **** static void _avr_init (void) { ! asm_addTree (&asm_asxxxx_mapping); } static void --- 38,44 ---- static void _avr_init (void) { ! asm_addTree (&asm_gas_mapping); } static void *************** *** 124,129 **** --- 124,136 ---- } + /* Generate startup-code */ + static void + _avr_genInitStartup (FILE *of) + { + fprintf (of, "\tjmp\t__sdcc_program_startup\n"); + } + /* Generate interrupt vector table. */ static int _avr_genIVT (FILE * of, symbol ** interrupts, int maxInterrupts) *************** *** 131,136 **** --- 138,158 ---- return TRUE; } + /* generate a call to main() */ + void _avr_genCallMain(FILE *of) + { + fprintf (of, "\tcall\t_main\n"); + fprintf (of, "\t/*return from main will lock up*/\n"); + fprintf (of, "\trjmp .\n"); + } + + /* generate a jump to main() */ + void _avr_genJumpMain(FILE *of) + { + fprintf (of, "\tjmp\t_main\n"); // needed? + fprintf (of, "\t/*return from main will return to caller*/\n"); + } + /* Indicate which extended bit operations this port supports */ static bool hasExtBitOp (int op, int size) *************** *** 161,172 **** MUST be terminated with a NULL. */ static const char *_linkCmd[] = { ! "linkavr", "", "\"$1\"", NULL }; /* $3 is replaced by assembler.debug_opts resp. port->assembler.plain_opts */ static const char *_asmCmd[] = { ! "asavr", "$l" , "$3", "\"$1.s\"", NULL }; /* Globals */ --- 183,195 ---- MUST be terminated with a NULL. */ static const char *_linkCmd[] = { ! "avr-ld", "-o\"$2\"", "\"$1.o\"", NULL }; /* $3 is replaced by assembler.debug_opts resp. port->assembler.plain_opts */ + /* we are usining the GNU Binutils f. AVR toolchain here */ static const char *_asmCmd[] = { ! "avr-as", "$3", "-o\"$2\"" , "\"$1.s\"", NULL }; /* Globals */ *************** *** 184,191 **** { _asmCmd, NULL, ! "-plosgff", /* Options with debug */ ! "-plosgff", /* Options without debug */ 0, ".s", NULL, /* no do_assemble */ --- 207,214 ---- { _asmCmd, NULL, ! "-mavr3 -debug", /* Options with debug */ ! "-mavr3", /* Options without debug */ 0, ".s", NULL, /* no do_assemble */ *************** *** 194,200 **** _linkCmd, NULL, NULL, ! ".rel", 1}, { _defaultRules}, --- 217,223 ---- _linkCmd, NULL, NULL, ! ".o", 1}, { _defaultRules}, *************** *** 244,250 **** NULL, /* no genAssemblerEnd */ _avr_genIVT, NULL, // _avr_genXINIT ! NULL, /* genInitStartup */ _avr_reset_regparm, _avr_regparm, NULL, --- 267,275 ---- NULL, /* no genAssemblerEnd */ _avr_genIVT, NULL, // _avr_genXINIT ! _avr_genInitStartup, /* genInitStartup */ ! _avr_genCallMain, /* genCallMain */ ! _avr_genJumpMain, /* genJumpMain */ _avr_reset_regparm, _avr_regparm, NULL, Only in ../../sdcc/src/avr: main.o Only in ../../sdcc/src/avr: peeph.rul Only in ../../sdcc/src/avr: port.a Only in ../../sdcc/src/avr: ralloc.o Only in ../../sdcc/src/ds390: Makefile.dep Only in ../../sdcc/src/ds390: gen.o diff -cr -x CVS src/ds390/main.c ../../sdcc/src/ds390/main.c *** src/ds390/main.c Wed May 26 00:30:34 2004 --- ../../sdcc/src/ds390/main.c Mon Jul 26 16:46:13 2004 *************** *** 260,265 **** --- 260,280 ---- return TRUE; } + /* generate a call to main() */ + void _ds390_genCallMain(FILE *of) + { + fprintf (of, "\tlcall\t_main\n"); + fprintf (of, ";\treturn from main will lock up\n"); + fprintf (of, "\tsjmp .\n"); + } + + /* generate a jump to main() */ + void _ds390_genJumpMain(FILE *of) + { + fprintf (of, "\tljmp\t_main\n"); // needed? + fprintf (of, ";\treturn from main will return to caller\n"); + } + /* Generate code to copy XINIT to XISEG */ static void _ds390_genXINIT (FILE * of) { fprintf (of, "; _ds390_genXINIT() start\n"); *************** *** 885,890 **** --- 900,907 ---- _ds390_genIVT, _ds390_genXINIT, NULL, /* genInitStartup */ + _ds390_genCallMain, + _ds390_genJumpMain, _ds390_reset_regparm, _ds390_regparm, NULL, *************** *** 1188,1193 **** --- 1205,1212 ---- _tininative_genIVT, NULL, NULL, /* genInitStartup */ + _ds390_genCallMain, + _ds390_genJumpMain, _ds390_reset_regparm, _ds390_regparm, NULL, *************** *** 1406,1411 **** --- 1425,1432 ---- _ds400_genIVT, _ds390_genXINIT, NULL, /* genInitStartup */ + _ds390_genCallMain, + _ds390_genJumpMain, _ds390_reset_regparm, _ds390_regparm, NULL, Only in ../../sdcc/src/ds390: main.o Only in ../../sdcc/src/ds390: peeph.rul Only in ../../sdcc/src/ds390: port.a Only in ../../sdcc/src/ds390: ralloc.o Only in ../../sdcc/src/ds400: Makefile.dep Only in ../../sdcc/src/ds400: main.o Only in ../../sdcc/src/ds400: port.a Only in ../../sdcc/src/hc08: Makefile.dep Only in ../../sdcc/src/hc08: gen.o diff -cr -x CVS src/hc08/main.c ../../sdcc/src/hc08/main.c *** src/hc08/main.c Tue May 25 12:30:09 2004 --- ../../sdcc/src/hc08/main.c Mon Jul 26 16:14:08 2004 *************** *** 275,280 **** --- 275,295 ---- return TRUE; } + /* generate a call to main() */ + void _hc08_genCallMain(FILE *of) + { + fprintf (of, "\tlcall\t_main\n"); + fprintf (of, ";\treturn from main will lock up\n"); + fprintf (of, "\tsjmp .\n"); + } + + /* generate a jump to main() */ + void _hc08_genJumpMain(FILE *of) + { + fprintf (of, "\tljmp\t_main\n"); // needed? + fprintf (of, ";\treturn from main will return to caller\n"); + } + /* Generate code to copy XINIT to XISEG */ static void _hc08_genXINIT (FILE * of) { fprintf (of, "; _hc08_genXINIT() start\n"); *************** *** 477,482 **** --- 492,499 ---- _hc08_genIVT, _hc08_genXINIT, NULL, /* genInitStartup */ + _hc08_genCallMain, + _hc08_genJumpMain, _hc08_reset_regparm, _hc08_regparm, NULL, /* process_pragma */ Only in ../../sdcc/src/hc08: main.o Only in ../../sdcc/src/hc08: peeph.rul Only in ../../sdcc/src/hc08: port.a Only in ../../sdcc/src/hc08: ralloc.o Only in ../../sdcc/src/mcs51: Makefile.dep Only in ../../sdcc/src/mcs51: gen.o diff -cr -x CVS src/mcs51/main.c ../../sdcc/src/mcs51/main.c *** src/mcs51/main.c Wed May 26 00:30:39 2004 --- ../../sdcc/src/mcs51/main.c Mon Jul 26 16:18:27 2004 *************** *** 155,160 **** --- 155,175 ---- return FALSE; } + /* generate a call to main() */ + void _mcs51_genCallMain(FILE *of) + { + fprintf (of, "\tlcall\t_main\n"); + fprintf (of, ";\treturn from main will lock up\n"); + fprintf (of, "\tsjmp .\n"); + } + + /* generate a jump to main() */ + void _mcs51_genJumpMain(FILE *of) + { + fprintf (of, "\tljmp\t_main\n"); // needed? + fprintf (of, ";\treturn from main will return to caller\n"); + } + static void _mcs51_genExtraAreas(FILE *of, bool hasMain) { *************** *** 730,735 **** --- 745,752 ---- _mcs51_genIVT, _mcs51_genXINIT, _mcs51_genInitStartup, + _mcs51_genCallMain, + _mcs51_genJumpMain, _mcs51_reset_regparm, _mcs51_regparm, NULL, Only in ../../sdcc/src/mcs51: main.o Only in ../../sdcc/src/mcs51: peeph.rul Only in ../../sdcc/src/mcs51: port.a Only in ../../sdcc/src/mcs51: ralloc.o Only in ../../sdcc/src/pic: Makefile.dep Only in ../../sdcc/src/pic: device.o Only in ../../sdcc/src/pic: gen.o Only in ../../sdcc/src/pic: genarith.o Only in ../../sdcc/src/pic: glue.o diff -cr -x CVS src/pic/main.c ../../sdcc/src/pic/main.c *** src/pic/main.c Tue May 25 12:30:09 2004 --- ../../sdcc/src/pic/main.c Mon Jul 26 16:27:19 2004 *************** *** 299,304 **** --- 299,320 ---- return TRUE; } + /* generate a call to main() */ + void _pic14_genCallMain(FILE *of) + { + fprintf (of, "\tcall\t_main\n"); + fprintf (of, ";\treturn from main will lock up\n"); + fprintf (of, "\tgoto .\n"); + } + + /* generate a jump to main() */ + void _pic14_genJumpMain(FILE *of) + { + fprintf (of, "\tgoto\t_main\n"); // needed? + fprintf (of, ";\treturn from main will return to caller\n"); + } + + static bool _hasNativeMulFor (iCode *ic, sym_link *left, sym_link *right) { *************** *** 475,480 **** --- 491,498 ---- _pic14_genIVT, NULL, // _pic14_genXINIT NULL, /* genInitStartup */ + _pic14_genCallMain, + _pic14_genJumpMain, _pic14_reset_regparm, _pic14_regparm, _process_pragma, /* process a pragma */ Only in ../../sdcc/src/pic: main.o Only in ../../sdcc/src/pic: pcode.o Only in ../../sdcc/src/pic: pcodeflow.o Only in ../../sdcc/src/pic: pcodepeep.o Only in ../../sdcc/src/pic: pcoderegs.o Only in ../../sdcc/src/pic: peeph.rul Only in ../../sdcc/src/pic: port.a Only in ../../sdcc/src/pic: ralloc.o Only in ../../sdcc/src/pic16: Makefile.dep Only in ../../sdcc/src/pic16: device.o Only in ../../sdcc/src/pic16: gen.o Only in ../../sdcc/src/pic16: genarith.o Only in ../../sdcc/src/pic16: genutils.o Only in ../../sdcc/src/pic16: glue.o diff -cr -x CVS src/pic16/main.c ../../sdcc/src/pic16/main.c *** src/pic16/main.c Sat Jul 24 13:25:54 2004 --- ../../sdcc/src/pic16/main.c Mon Jul 26 16:28:52 2004 *************** *** 653,658 **** --- 653,674 ---- return TRUE; } + /* generate a call to main() */ + void _pic16_genCallMain(FILE *of) + { + fprintf (of, "\tcall\t_main\n"); + fprintf (of, ";\treturn from main will lock up\n"); + fprintf (of, "\tgoto .\n"); + } + + /* generate a jump to main() */ + void _pic16_genJumpMain(FILE *of) + { + fprintf (of, "\tgoto\t_main\n"); // needed? + fprintf (of, ";\treturn from main will return to caller\n"); + } + + /* return True if the port can handle the type, * False to convert it to function call */ static bool _hasNativeMulFor (iCode *ic, sym_link *left, sym_link *right) *************** *** 865,870 **** --- 881,888 ---- _pic16_genIVT, NULL, // _pic16_genXINIT NULL, /* genInitStartup */ + _pic16_genCallMain, + _pic16_genJumpMain, _pic16_reset_regparm, _pic16_regparm, _process_pragma, /* process a pragma */ Only in ../../sdcc/src/pic16: main.o Only in ../../sdcc/src/pic16: pcode.o Only in ../../sdcc/src/pic16: pcodeflow.o Only in ../../sdcc/src/pic16: pcodepeep.o Only in ../../sdcc/src/pic16: pcoderegs.o Only in ../../sdcc/src/pic16: peeph.rul Only in ../../sdcc/src/pic16: port.a Only in ../../sdcc/src/pic16: ralloc.o diff -cr -x CVS src/port.h ../../sdcc/src/port.h *** src/port.h Tue May 25 12:30:09 2004 --- ../../sdcc/src/port.h Mon Jul 26 15:59:44 2004 *************** *** 259,264 **** --- 259,268 ---- /* Write port specific startup code */ void (*genInitStartup) (FILE * of); + + /* Write port specific Call or Jump to main() function */ + void (*genCallMain) (FILE * of); + void (*genJumpMain) (FILE * of); /* parameter passing in register related functions */ void (*reset_regparms) (); /* reset the register count */ Only in ../../sdcc/src: version.h Only in ../../sdcc/src/xa51: Makefile.dep Only in ../../sdcc/src/xa51: gen.o diff -cr -x CVS src/xa51/main.c ../../sdcc/src/xa51/main.c *** src/xa51/main.c Tue May 25 13:34:18 2004 --- ../../sdcc/src/xa51/main.c Mon Jul 26 16:29:54 2004 *************** *** 128,133 **** --- 128,148 ---- return TRUE; } + /* generate a call to main() */ + void _xa51_genCallMain(FILE *of) + { + fprintf (of, "\tlcall\t_main\n"); + fprintf (of, ";\treturn from main will lock up\n"); + fprintf (of, "\tsjmp .\n"); + } + + /* generate a jump to main() */ + void _xa51_genJumpMain(FILE *of) + { + fprintf (of, "\tljmp\t_main\n"); // needed? + fprintf (of, ";\treturn from main will return to caller\n"); + } + /* Generate code to copy XINIT to XISEG */ static void _xa51_genXINIT (FILE * of) { fprintf (of, "; _xa51_genXINIT() start\n"); *************** *** 319,324 **** --- 334,341 ---- _xa51_genIVT, _xa51_genXINIT, NULL, /* genInitStartup */ + _xa51_genCallMain, + _xa51_genJumpMain, _xa51_reset_regparm, _xa51_regparm, NULL, // process_pragma() Only in ../../sdcc/src/xa51: main.o Only in ../../sdcc/src/xa51: peeph.rul Only in ../../sdcc/src/xa51: port.a Only in ../../sdcc/src/xa51: ralloc.o Only in ../../sdcc/src/z80: Makefile.dep Only in ../../sdcc/src/z80: gen.o diff -cr -x CVS src/z80/main.c ../../sdcc/src/z80/main.c *** src/z80/main.c Tue May 25 13:34:19 2004 --- ../../sdcc/src/z80/main.c Mon Jul 26 16:44:11 2004 *************** *** 110,115 **** --- 110,131 ---- z80_opts.sub = SUB_GBZ80; } + /* generate a call to main() */ + void _z80_genCallMain(FILE *of) + { + fprintf (of, "\tlcall\t_main\n"); + fprintf (of, ";\treturn from main will lock up\n"); + fprintf (of, "\tsjp .\n"); + } + + /* generate a jump to main() */ + void _z80_genJumpMain(FILE *of) + { + fprintf (of, "\tljp\t_main\n"); // needed? + fprintf (of, ";\treturn from main will return to caller\n"); + } + + static void _reset_regparm () { *************** *** 641,646 **** --- 657,664 ---- 0, /* no local IVT generation code */ 0, /* no genXINIT code */ NULL, /* genInitStartup */ + _z80_genCallMain, + _z80_genJumpMain, _reset_regparm, _reg_parm, _process_pragma, *************** *** 746,751 **** --- 764,771 ---- 0, /* no local IVT generation code */ 0, /* no genXINIT code */ NULL, /* genInitStartup */ + _z80_genCallMain, + _z80_genJumpMain, _reset_regparm, _reg_parm, _process_pragma, Only in ../../sdcc/src/z80: main.o Only in ../../sdcc/src/z80: peeph-gbz80.rul Only in ../../sdcc/src/z80: peeph-z80.rul Only in ../../sdcc/src/z80: peeph.rul Only in ../../sdcc/src/z80: port.a Only in ../../sdcc/src/z80: ralloc.o Only in ../../sdcc/src/z80: support.o