/* now generate the name */
if (!val->sym) {
- if (IS_LITERAL (val->etype))
- fprintf(oFile, "\t.byte %s,%s\n", aopLiteral(val, 0),aopLiteral(val, 1));
- else
+ if (port->use_dw_for_init)
+ tfprintf(oFile, "\t!dw %s\n", val->name);
+ else
fprintf(oFile, "\t.byte %s,(%s >> 8)\n", val->name,val->name);
}
- else
- fprintf(oFile, "\t.byte %s,(%s >> 8)\n", val->sym->rname,val->sym->rname);
+ else
+ if (port->use_dw_for_init)
+ tfprintf(oFile, "\t!dws\n", val->sym->rname);
+ else
+ fprintf(oFile, "\t.byte %s,(%s >> 8)\n", val->sym->rname,val->sym->rname);
return;
}
"\t!dbs\n", val->name) ;
break;
case 2:
- tfprintf(oFile, "\t.byte %s,(%s >> 8)\n", val->name, val->name);
+ if (port->use_dw_for_init)
+ tfprintf(oFile, "\t!dws\n", val->name);
+ else
+ fprintf(oFile, "\t.byte %s,(%s >> 8)\n", val->name, val->name);
break;
/* PENDING: probably just 3 */
default:
/* Assign depending on the storage class */
if (sym->onStack || sym->iaccess) {
+ emitcode("", "; AOP_STK for %s", sym->rname);
sym->aop = aop = newAsmop(AOP_STK);
aop->size = getSize(sym->type);
aop->aopu.aop_stk = sym->stack;
if (IS_GB) {
/* if it is in direct space */
- printf("sname %s: regsp %u\n", space->sname, space->regsp);
if (IN_REGSP(space) && !requires_a) {
sym->aop = aop = newAsmop (AOP_SFR);
aop->aopu.aop_dir = sym->rname ;
/* only remaining is far space */
/* in which case DPTR gets the address */
if (IS_GB) {
+ emitcode("", "; AOP_HL for %s", sym->rname);
sym->aop = aop = newAsmop(AOP_HL);
}
else {
if (isPtr(pair)) {
if (pairId == PAIR_HL || pairId == PAIR_IY) {
- if (_G.pairs[pairId].lit && !strcmp(_G.pairs[pairId].lit, l)) {
- if (pairId == PAIR_HL && abs(_G.pairs[pairId].offset - offset) < 3) {
- adjustPair(pair, &_G.pairs[pairId].offset, offset);
- return;
- }
- if (pairId == PAIR_IY && abs(offset)<127) {
- return;
+ if (_G.pairs[pairId].last_type == left->type) {
+ if (_G.pairs[pairId].lit && !strcmp(_G.pairs[pairId].lit, l)) {
+ if (pairId == PAIR_HL && abs(_G.pairs[pairId].offset - offset) < 3) {
+ adjustPair(pair, &_G.pairs[pairId].offset, offset);
+ return;
+ }
+ if (pairId == PAIR_IY && abs(offset)<127) {
+ return;
+ }
}
}
}
) {
int offset = 0;
symbol *tlbl = NULL;
+ tlbl = newiTempLabel(NULL);
while (size--) {
- if (offset) {
- emitIntLabel(tlbl->key+100);
- }
emitcode("inc","%s",aopGet(AOP(IC_RESULT(ic)), offset++, FALSE));
if (size) {
- tlbl = newiTempLabel(NULL);
emit2("!shortjp nz,!tlabel", tlbl->key+100);
}
}
+ emitLabel(tlbl->key+100);
return TRUE;
}
if (AOP_TYPE(left) == AOP_ACC)
emitcode("and","a,%s",aopGet(AOP(right),offset,FALSE));
else {
- MOVA(aopGet(AOP(right),offset,FALSE));
+ MOVA(aopGet(AOP(left),offset,FALSE));
emitcode("and","a,%s",
- aopGet(AOP(left),offset,FALSE));
+ aopGet(AOP(right),offset,FALSE));
}
aopPut(AOP(result),"a",offset);
}
if (AOP_TYPE(left) == AOP_ACC)
emitcode("or","a,%s",aopGet(AOP(right),offset,FALSE));
else {
- MOVA(aopGet(AOP(right),offset,FALSE));
+ MOVA(aopGet(AOP(left),offset,FALSE));
emitcode("or","a,%s",
- aopGet(AOP(left),offset,FALSE));
+ aopGet(AOP(right),offset,FALSE));
}
aopPut(AOP(result),"a",offset);
/* PENDING: something weird is going on here. Add exception. */
switch (argv[*i][2]) {
case 'o':
/* ROM bank */
- sprintf(buffer, "_CODE_%u", bank);
+ sprintf(buffer, "CODE_%u", bank);
gbz80_port.mem.code_name = gc_strdup(buffer);
return TRUE;
case 'a':
/* RAM bank */
- sprintf(buffer, "_DATA_%u", bank);
+ sprintf(buffer, "DATA_%u", bank);
gbz80_port.mem.data_name = gc_strdup(buffer);
return TRUE;
}
0, /* no assembler preamble */
0, /* no local IVT generation code */
_reset_regparm,
- _reg_parm
+ _reg_parm,
+ TRUE
};
/* Globals */
0, /* no local IVT generation code */
_reset_regparm,
_reg_parm,
- _process_pragma
+ _process_pragma,
+ TRUE
};