Add alignment for functions
This commit is contained in:
parent
eac12e4559
commit
58ab6818ed
|
@ -32,6 +32,12 @@ __asm bsinit
|
|||
jsr 0xff81
|
||||
sta 0xff01
|
||||
}
|
||||
__asm dswap
|
||||
{
|
||||
sta 0xff00
|
||||
jsr 0xff5f
|
||||
sta 0xff01
|
||||
}
|
||||
#pragma code(code)
|
||||
#elif defined(__PLUS4__)
|
||||
#pragma code(lowcode)
|
||||
|
@ -94,6 +100,31 @@ __asm bsinit
|
|||
#define bsinit 0xff81
|
||||
#endif
|
||||
|
||||
#if defined(__C128__)
|
||||
void dispmode40col(void)
|
||||
{
|
||||
if (*(volatile char *)0xd7 >= 128)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
jsr dswap
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void dispmode80col(void)
|
||||
{
|
||||
if (*(volatile char *)0xd7 < 128)
|
||||
{
|
||||
__asm
|
||||
{
|
||||
jsr dswap
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void iocharmap(IOCharMap chmap)
|
||||
{
|
||||
giocharmap = chmap;
|
||||
|
|
|
@ -18,6 +18,10 @@ extern IOCharMap giocharmap;
|
|||
|
||||
void iocharmap(IOCharMap chmap);
|
||||
|
||||
#if defined(__C128__)
|
||||
void dispmode40col(void);
|
||||
void dispmode80col(void);
|
||||
#endif
|
||||
|
||||
int kbhit(void);
|
||||
|
||||
|
|
|
@ -473,7 +473,7 @@ void InterCodeGenerator::TranslateAssembler(InterCodeModule* mod, Expression* ex
|
|||
|
||||
Declaration* dec = exp->mDecValue;
|
||||
|
||||
dec->mLinkerObject = mLinker->AddObject(dec->mLocation, dec->mQualIdent, dec->mSection, LOT_NATIVE_CODE);
|
||||
dec->mLinkerObject = mLinker->AddObject(dec->mLocation, dec->mQualIdent, dec->mSection, LOT_NATIVE_CODE, dec->mAlignment);
|
||||
|
||||
uint8* d = dec->mLinkerObject->AddSpace(osize);
|
||||
|
||||
|
@ -600,7 +600,20 @@ void InterCodeGenerator::TranslateAssembler(InterCodeModule* mod, Expression* ex
|
|||
}
|
||||
else if (aexp->mType == DT_ARGUMENT || aexp->mType == DT_VARIABLE)
|
||||
{
|
||||
if (refvars)
|
||||
if (aexp->mFlags & DTF_GLOBAL)
|
||||
{
|
||||
InitGlobalVariable(mod, aexp);
|
||||
|
||||
LinkerReference ref;
|
||||
ref.mObject = dec->mLinkerObject;
|
||||
ref.mOffset = offset;
|
||||
ref.mFlags = LREF_LOWBYTE;
|
||||
ref.mRefObject = aexp->mLinkerObject;
|
||||
ref.mRefOffset = 0;
|
||||
ref.mRefObject->mFlags |= LOBJF_RELEVANT;
|
||||
dec->mLinkerObject->AddReference(ref);
|
||||
}
|
||||
else if (refvars)
|
||||
{
|
||||
int j = 0;
|
||||
while (j < refvars->Size() && (*refvars)[j] != aexp)
|
||||
|
@ -4635,7 +4648,7 @@ void InterCodeGenerator::TranslateLogic(Declaration* procType, InterCodeProcedur
|
|||
|
||||
InterCodeProcedure* InterCodeGenerator::TranslateProcedure(InterCodeModule * mod, Expression* exp, Declaration * dec)
|
||||
{
|
||||
InterCodeProcedure* proc = new InterCodeProcedure(mod, dec->mLocation, dec->mQualIdent, mLinker->AddObject(dec->mLocation, dec->mQualIdent, dec->mSection, LOT_BYTE_CODE));
|
||||
InterCodeProcedure* proc = new InterCodeProcedure(mod, dec->mLocation, dec->mQualIdent, mLinker->AddObject(dec->mLocation, dec->mQualIdent, dec->mSection, LOT_BYTE_CODE, dec->mAlignment));
|
||||
|
||||
#if 0
|
||||
if (proc->mIdent && !strcmp(proc->mIdent->mString, "main"))
|
||||
|
|
|
@ -7322,6 +7322,7 @@ Expression* Parser::ParseAssembler(void)
|
|||
if ((ilast->mLeft->mDecValue->mType == DT_CONST_INTEGER && ilast->mLeft->mDecValue->mInteger < 256) ||
|
||||
(ilast->mLeft->mDecValue->mType == DT_VARIABLE_REF && !(ilast->mLeft->mDecValue->mBase->mFlags & DTF_GLOBAL)) ||
|
||||
(ilast->mLeft->mDecValue->mType == DT_VARIABLE && !(ilast->mLeft->mDecValue->mFlags & DTF_GLOBAL)) ||
|
||||
(ilast->mLeft->mDecValue->mType == DT_VARIABLE && (ilast->mLeft->mDecValue->mFlags & DTF_ZEROPAGE)) ||
|
||||
ilast->mLeft->mDecValue->mType == DT_ARGUMENT)
|
||||
{
|
||||
if (ilast->mAsmInsMode == ASMIM_ABSOLUTE && HasAsmInstructionMode(ilast->mAsmInsType, ASMIM_ZERO_PAGE))
|
||||
|
@ -8072,6 +8073,19 @@ void Parser::ParsePragma(void)
|
|||
else
|
||||
mErrors->Error(mScanner->mLocation, EERR_PRAGMA_PARAMETER, "Integer number for alignment expected");
|
||||
}
|
||||
else if (dec && dec->mType == DT_CONST_FUNCTION)
|
||||
{
|
||||
mScanner->NextToken();
|
||||
ConsumeToken(TK_COMMA);
|
||||
|
||||
Expression* exp = ParseRExpression();
|
||||
if (exp->mType == EX_CONSTANT && exp->mDecValue->mType == DT_CONST_INTEGER)
|
||||
{
|
||||
dec->mAlignment = int(exp->mDecValue->mInteger);
|
||||
}
|
||||
else
|
||||
mErrors->Error(mScanner->mLocation, EERR_PRAGMA_PARAMETER, "Integer number for alignment expected");
|
||||
}
|
||||
else
|
||||
{
|
||||
mErrors->Error(mScanner->mLocation, EERR_OBJECT_NOT_FOUND, "Variable not found");
|
||||
|
|
Loading…
Reference in New Issue