Fix byte limit in #embed

This commit is contained in:
drmortalwombat 2022-01-28 14:13:49 +01:00
parent aee284c1d6
commit 2d41edfc97
8 changed files with 64 additions and 14 deletions

View File

@ -1,6 +1,6 @@
#include "memmap.h" #include "memmap.h"
char PLAShadow; volatile char PLAShadow;
__asm DoneTrampoline __asm DoneTrampoline
{ {

View File

@ -159,7 +159,7 @@ void GlobalAnalyzer::AnalyzeProcedure(Expression* exp, Declaration* dec)
mFunctions.Push(dec); mFunctions.Push(dec);
dec->mFlags |= DTF_ANALYZED; dec->mFlags |= DTF_ANALYZED;
if (dec->mFlags & DTF_INTRINSIC) if ((dec->mFlags & DTF_INTRINSIC) && !dec->mValue)
dec->mFlags |= DTF_FUNC_CONSTEXPR; dec->mFlags |= DTF_FUNC_CONSTEXPR;
else if (dec->mFlags & DTF_DEFINED) else if (dec->mFlags & DTF_DEFINED)
{ {

View File

@ -1987,6 +1987,12 @@ bool NativeCodeInstruction::ValueForwarding(NativeRegisterDataSet& data, AsmInsT
changed = true; changed = true;
} }
if (mMode == ASMIM_ABSOLUTE_X && data.mRegs[CPU_REG_X].SameData(data.mRegs[CPU_REG_Y]) && HasAsmInstructionMode(mType, ASMIM_ABSOLUTE_Y))
{
mMode = ASMIM_ABSOLUTE_Y;
changed = true;
}
if (mMode == ASMIM_ZERO_PAGE) if (mMode == ASMIM_ZERO_PAGE)
{ {
switch (mType) switch (mType)
@ -12335,6 +12341,9 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(int pass)
{ {
if (!mIns[i].MayBeChangedOnAddress(mIns[i + 1])) if (!mIns[i].MayBeChangedOnAddress(mIns[i + 1]))
{ {
if (mIns[i + 1].SameEffectiveAddress(mIns[i]))
mIns[i + 1].mLive |= LIVE_MEM;
NativeCodeInstruction ins = mIns[i]; NativeCodeInstruction ins = mIns[i];
mIns[i] = mIns[i + 1]; mIns[i] = mIns[i + 1];
mIns[i + 1] = ins; mIns[i + 1] = ins;
@ -12348,6 +12357,9 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(int pass)
{ {
if (!mIns[i].MayBeChangedOnAddress(mIns[i + 1])) if (!mIns[i].MayBeChangedOnAddress(mIns[i + 1]))
{ {
if (mIns[i + 1].SameEffectiveAddress(mIns[i]))
mIns[i + 1].mLive |= LIVE_MEM;
NativeCodeInstruction ins = mIns[i]; NativeCodeInstruction ins = mIns[i];
mIns[i] = mIns[i + 1]; mIns[i] = mIns[i + 1];
mIns[i + 1] = ins; mIns[i + 1] = ins;
@ -12691,6 +12703,7 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(int pass)
#endif #endif
} }
#if 1
else if (FindGlobalAddressSumY(i, sreg, true, apos, ains, iins, flags, addr)) else if (FindGlobalAddressSumY(i, sreg, true, apos, ains, iins, flags, addr))
{ {
if (iins || (flags & LIVE_CPU_REG_Y) || (flags & LIVE_CPU_REG_X)) //!(mIns[i + 1].mLive & LIVE_CPU_REG_X)) if (iins || (flags & LIVE_CPU_REG_Y) || (flags & LIVE_CPU_REG_X)) //!(mIns[i + 1].mLive & LIVE_CPU_REG_X))
@ -12782,6 +12795,7 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(int pass)
progress = true; progress = true;
} }
} }
#endif
} }
#endif #endif
@ -13175,6 +13189,9 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(int pass)
mIns[i + 0].mAddress = iins->mAddress; mIns[i + 0].mAddress = iins->mAddress;
mIns[i + 0].mLinkerObject = iins->mLinkerObject; mIns[i + 0].mLinkerObject = iins->mLinkerObject;
mIns[i + 0].mFlags = iins->mFlags; mIns[i + 0].mFlags = iins->mFlags;
if (!(flags & LIVE_CPU_REG_Y) && (flags & LIVE_CPU_REG_X))
mIns[i + 0].mType == ASMIT_LDX;
} }
else if (iins->mAddress == sreg) else if (iins->mAddress == sreg)
{ {
@ -13182,7 +13199,7 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(int pass)
if (flags & LIVE_CPU_REG_Y) if (flags & LIVE_CPU_REG_Y)
{ {
mIns.Insert(apos, NativeCodeInstruction(ASMIT_LDY, ASMIM_ZERO_PAGE, iins->mAddress)); mIns.Insert(apos, NativeCodeInstruction(ASMIT_LDY, ASMIM_ZERO_PAGE, iins->mAddress));
mIns[apos].mLive = LIVE_CPU_REG_Y | LIVE_CPU_REG_A | LIVE_MEM; mIns[apos].mLive = mIns[apos + 1].mLive | LIVE_CPU_REG_Y | LIVE_CPU_REG_A | LIVE_MEM;
for (int j = apos; j < i + 2; j++) for (int j = apos; j < i + 2; j++)
mIns[j].mLive |= LIVE_CPU_REG_Y; mIns[j].mLive |= LIVE_CPU_REG_Y;
} }
@ -13190,7 +13207,7 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(int pass)
{ {
PatchGlobalAdressSumYByX(i + 1, sreg, *ains, addr); PatchGlobalAdressSumYByX(i + 1, sreg, *ains, addr);
mIns.Insert(apos, NativeCodeInstruction(ASMIT_LDX, ASMIM_ZERO_PAGE, iins->mAddress)); mIns.Insert(apos, NativeCodeInstruction(ASMIT_LDX, ASMIM_ZERO_PAGE, iins->mAddress));
mIns[apos].mLive = LIVE_CPU_REG_X | LIVE_CPU_REG_A | LIVE_MEM; mIns[apos].mLive = mIns[apos + 1].mLive | LIVE_CPU_REG_X | LIVE_CPU_REG_A | LIVE_MEM;
for (int j = apos; j < i + 2; j++) for (int j = apos; j < i + 2; j++)
mIns[j].mLive |= LIVE_CPU_REG_X; mIns[j].mLive |= LIVE_CPU_REG_X;
} }
@ -13199,6 +13216,9 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(int pass)
{ {
mIns[i + 0].mMode = ASMIM_ZERO_PAGE; mIns[i + 0].mMode = ASMIM_ZERO_PAGE;
mIns[i + 0].mAddress = iins->mAddress; mIns[i + 0].mAddress = iins->mAddress;
if (!(flags & LIVE_CPU_REG_Y) && (flags & LIVE_CPU_REG_X))
mIns[i + 0].mType == ASMIT_LDX;
} }
progress = true; progress = true;

View File

@ -26,6 +26,7 @@ bool SourceFile::ReadLine(char* line)
if (mBinary) if (mBinary)
{ {
if (mLimit) if (mLimit)
{
mLimit--; mLimit--;
int c = fgetc(mFile); int c = fgetc(mFile);
@ -35,6 +36,9 @@ bool SourceFile::ReadLine(char* line)
return true; return true;
} }
} }
else
return false;
}
else else
{ {
if (fgets(line, 1024, mFile)) if (fgets(line, 1024, mFile))

View File

@ -73,7 +73,7 @@ int main(int argc, const char** argv)
#else #else
strcpy(strProductName, "oscar64"); strcpy(strProductName, "oscar64");
strcpy(strProductVersion, "1.2.68"); strcpy(strProductVersion, "1.2.69");
#ifdef __APPLE__ #ifdef __APPLE__
uint32_t length = sizeof(basePath); uint32_t length = sizeof(basePath);

View File

@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,2,68,0 FILEVERSION 1,2,69,0
PRODUCTVERSION 1,2,68,0 PRODUCTVERSION 1,2,69,0
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -43,12 +43,12 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "oscar64" VALUE "CompanyName", "oscar64"
VALUE "FileDescription", "oscar64 compiler" VALUE "FileDescription", "oscar64 compiler"
VALUE "FileVersion", "1.2.68.0" VALUE "FileVersion", "1.2.69.0"
VALUE "InternalName", "oscar64.exe" VALUE "InternalName", "oscar64.exe"
VALUE "LegalCopyright", "Copyright (C) 2021" VALUE "LegalCopyright", "Copyright (C) 2021"
VALUE "OriginalFilename", "oscar64.exe" VALUE "OriginalFilename", "oscar64.exe"
VALUE "ProductName", "oscar64" VALUE "ProductName", "oscar64"
VALUE "ProductVersion", "1.2.68.0" VALUE "ProductVersion", "1.2.69.0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -124,6 +124,12 @@
} }
"Entry" "Entry"
{ {
"MsmKey" = "8:_3277DE1463544F67B7E7390175F8A9CF"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
}
"Entry"
{
"MsmKey" = "8:_343F58F80DF84D40AE23457288C5D7D5" "MsmKey" = "8:_343F58F80DF84D40AE23457288C5D7D5"
"OwnerKey" = "8:_UNDEFINED" "OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED"
@ -1121,6 +1127,26 @@
"IsDependency" = "11:FALSE" "IsDependency" = "11:FALSE"
"IsolateTo" = "8:" "IsolateTo" = "8:"
} }
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_3277DE1463544F67B7E7390175F8A9CF"
{
"SourcePath" = "8:..\\samples\\rasterirq\\autocrawler.c"
"TargetName" = "8:autocrawler.c"
"Tag" = "8:"
"Folder" = "8:_E925E579BC89433389A5D5B048CAA36A"
"Condition" = "8:"
"Transitive" = "11:FALSE"
"Vital" = "11:TRUE"
"ReadOnly" = "11:FALSE"
"Hidden" = "11:FALSE"
"System" = "11:FALSE"
"Permanent" = "11:FALSE"
"SharedLegacy" = "11:FALSE"
"PackageAs" = "3:1"
"Register" = "3:1"
"Exclude" = "11:FALSE"
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_343F58F80DF84D40AE23457288C5D7D5" "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_343F58F80DF84D40AE23457288C5D7D5"
{ {
"SourcePath" = "8:..\\include\\c64\\keyboard.c" "SourcePath" = "8:..\\include\\c64\\keyboard.c"

Binary file not shown.