Fix call/return
This commit is contained in:
parent
9833656fcf
commit
7927df6d41
|
@ -2142,7 +2142,7 @@ __asm inp_enter
|
||||||
dey
|
dey
|
||||||
beq W1
|
beq W1
|
||||||
|
|
||||||
L1: lda regs - 1, y
|
L1: lda sregs - 1, y
|
||||||
dey
|
dey
|
||||||
sta (sp), y
|
sta (sp), y
|
||||||
bne L1
|
bne L1
|
||||||
|
@ -2180,7 +2180,7 @@ __asm inp_return
|
||||||
dey
|
dey
|
||||||
|
|
||||||
L1: lda (sp), y
|
L1: lda (sp), y
|
||||||
sta regs, y
|
sta sregs, y
|
||||||
dey
|
dey
|
||||||
bpl L1
|
bpl L1
|
||||||
W1:
|
W1:
|
||||||
|
|
|
@ -3670,6 +3670,7 @@ bool ByteCodeBasicBlock::PeepHoleOptimizer(void)
|
||||||
mIns[i + 1].mCode = BC_NOP;
|
mIns[i + 1].mCode = BC_NOP;
|
||||||
progress = true;
|
progress = true;
|
||||||
}
|
}
|
||||||
|
#if 1
|
||||||
else if (
|
else if (
|
||||||
mIns[i + 0].mCode == BC_STORE_REG_16 &&
|
mIns[i + 0].mCode == BC_STORE_REG_16 &&
|
||||||
mIns[i + 1].LoadsRegister(BC_REG_ACCU) &&
|
mIns[i + 1].LoadsRegister(BC_REG_ACCU) &&
|
||||||
|
@ -3679,6 +3680,7 @@ bool ByteCodeBasicBlock::PeepHoleOptimizer(void)
|
||||||
mIns[i + 1].mRegister = mIns[i + 0].mRegister;
|
mIns[i + 1].mRegister = mIns[i + 0].mRegister;
|
||||||
progress = true;
|
progress = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
|
@ -3762,6 +3764,7 @@ bool ByteCodeBasicBlock::PeepHoleOptimizer(void)
|
||||||
mIns[i].mCode = BC_NOP;
|
mIns[i].mCode = BC_NOP;
|
||||||
progress = true;
|
progress = true;
|
||||||
}
|
}
|
||||||
|
#if 1
|
||||||
else if (mIns[i].mCode == BC_STORE_REG_8 && mIns[i + 1].StoresRegister(mIns[i].mRegister) && mIns[i + 1].mRegisterFinal)
|
else if (mIns[i].mCode == BC_STORE_REG_8 && mIns[i + 1].StoresRegister(mIns[i].mRegister) && mIns[i + 1].mRegisterFinal)
|
||||||
{
|
{
|
||||||
mIns[i + 1].mRegister = BC_REG_ACCU;
|
mIns[i + 1].mRegister = BC_REG_ACCU;
|
||||||
|
@ -3790,7 +3793,7 @@ bool ByteCodeBasicBlock::PeepHoleOptimizer(void)
|
||||||
mIns[i].mCode = BC_NOP;
|
mIns[i].mCode = BC_NOP;
|
||||||
progress = true;
|
progress = true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#if 0
|
#if 0
|
||||||
else if ((mIns[i].mCode == BC_LOAD_LOCAL_16 || mIns[i].mCode == BC_LOAD_ABS_16) && mIns[i + 1].mCode == BC_ADDR_REG && mIns[i].mRegister == mIns[i + 1].mRegister && mIns[i + 1].mRegisterFinal)
|
else if ((mIns[i].mCode == BC_LOAD_LOCAL_16 || mIns[i].mCode == BC_LOAD_ABS_16) && mIns[i + 1].mCode == BC_ADDR_REG && mIns[i].mRegister == mIns[i + 1].mRegister && mIns[i + 1].mRegisterFinal)
|
||||||
{
|
{
|
||||||
|
|
|
@ -282,6 +282,8 @@ void InterCodeGenerator::TranslateAssembler(InterCodeModule* mod, Expression* ex
|
||||||
else if (aexp->mType == DT_CONST_INTEGER)
|
else if (aexp->mType == DT_CONST_INTEGER)
|
||||||
d[offset++] = cexp->mLeft->mDecValue->mInteger & 255;
|
d[offset++] = cexp->mLeft->mDecValue->mInteger & 255;
|
||||||
else if (aexp->mType == DT_LABEL_REF)
|
else if (aexp->mType == DT_LABEL_REF)
|
||||||
|
{
|
||||||
|
if (aexp->mBase->mBase)
|
||||||
{
|
{
|
||||||
if (!aexp->mBase->mBase->mLinkerObject)
|
if (!aexp->mBase->mBase->mLinkerObject)
|
||||||
TranslateAssembler(mod, aexp->mBase->mBase->mValue, nullptr);
|
TranslateAssembler(mod, aexp->mBase->mBase->mValue, nullptr);
|
||||||
|
@ -296,6 +298,9 @@ void InterCodeGenerator::TranslateAssembler(InterCodeModule* mod, Expression* ex
|
||||||
ref.mRefObject = aexp->mBase->mBase->mLinkerObject;
|
ref.mRefObject = aexp->mBase->mBase->mLinkerObject;
|
||||||
ref.mRefOffset = aexp->mOffset + aexp->mBase->mInteger;
|
ref.mRefOffset = aexp->mOffset + aexp->mBase->mInteger;
|
||||||
dec->mLinkerObject->AddReference(ref);
|
dec->mLinkerObject->AddReference(ref);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
mErrors->Error(aexp->mLocation, EERR_ASM_INVALD_OPERAND, "Undefined immediate operand", aexp->mBase->mIdent->mString);
|
||||||
|
|
||||||
offset += 1;
|
offset += 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue