/* if it has an initial value then do it only if
it is a global variable */
if (sym->ival && sym->level == 0) {
- // can we copy xidata from xinit?
- if (port->genXINIT &&
- SPEC_OCLS(sym->etype)==xdata &&
- !SPEC_ABSA(sym->etype)) {
-
- // create a new "XINIT (CODE)" symbol
+ if (SPEC_OCLS(sym->etype)==xidata) {
+ // create a new "XINIT (CODE)" symbol, that will be emitted later
newSym=copySymbol (sym);
SPEC_OCLS(newSym->etype)=xinit;
sprintf (newSym->name, "_xinit_%s", sym->name);
// add it to the "XINIT (CODE)" segment
addSet(&xinit->syms, newSym);
- // move sym from "XSEG (XDATA)" to "XISEG (XDATA)" segment
- //deleteSetItem(&xdata->syms, sym);
- addSet(&xidata->syms, sym);
- SPEC_OCLS(sym->etype)=xidata;
-
//fprintf (stderr, "moved %s from xdata to xidata\n", sym->rname);
} else {
}
val = list2val (ilist);
+ if (val->type != type) {
+ val = valCastLiteral(type, floatFromVal(val));
+ }
+
switch (getSize (type)) {
case 1:
if (!val)
}
else
{
- /* What is this case? Are these pointers? */
+ // these are literals assigned to pointers
switch (size)
{
case 1:
aopLiteral (val, 0), aopLiteral (val, 1));
break;
case 3:
- werror (E_LITERAL_GENERIC);
+ // mcs51 generic pointer
+ if (floatFromVal(val)!=0) {
+ werror (E_LITERAL_GENERIC);
+ }
fprintf (oFile, "\t.byte %s,%s,%s\n",
aopLiteral (val, 0),
aopLiteral (val, 1),
aopLiteral (val, 2));
break;
case 4:
- werror (E_LITERAL_GENERIC);
+ // ds390 generic pointer
+ if (floatFromVal(val)!=0) {
+ werror (E_LITERAL_GENERIC);
+ }
fprintf (oFile, "\t.byte %s,%s,%s,%s\n",
aopLiteral (val, 0),
aopLiteral (val, 1),
{
symbol *sym;
- fprintf(out, "\t.area\t%s\n", map->sname);
+ /* fprintf(out, "\t.area\t%s\n", map->sname); */
/* for all variables in this segment do */
for (sym = setFirstItem (map->syms); sym;
emitStaticSeg (statsg, code->oFile);
if (port->genXINIT) {
+ fprintf (code->oFile, "\t.area\t%s\n", xinit->sname);
emitStaticSeg (xinit, code->oFile);
}
inInitMode--;