diff --git a/autotest/autotest.bat b/autotest/autotest.bat index a23ff9d..bef2698 100644 --- a/autotest/autotest.bat +++ b/autotest/autotest.bat @@ -54,6 +54,9 @@ rem @echo off @call :testh stdlibtest.c @if %errorlevel% neq 0 goto :error +@call :test mathtest.c +@if %errorlevel% neq 0 goto :error + @call :test testint16.c @if %errorlevel% neq 0 goto :error diff --git a/include/c64/sprites.c b/include/c64/sprites.c index 329d287..5229251 100644 --- a/include/c64/sprites.c +++ b/include/c64/sprites.c @@ -218,22 +218,30 @@ void vspr_hide(char sp) void vspr_sort(void) { - spriteYPos[1] = vspriteYLow[spriteOrder[0]]; + byte rm = vspriteYLow[spriteOrder[0]]; + spriteYPos[1] = rm; for(char i = 1; imString, "interpret_statement"); + CheckFunc = !strcmp(mIdent->mString, "tile_collide"); CheckCase = false; mEntryBlock = mBlocks[0]; diff --git a/oscar64/NativeCodeGenerator.cpp b/oscar64/NativeCodeGenerator.cpp index 9ad80b1..573da2f 100644 --- a/oscar64/NativeCodeGenerator.cpp +++ b/oscar64/NativeCodeGenerator.cpp @@ -28686,6 +28686,15 @@ bool NativeCodeBasicBlock::IsFinalZeroPageUseTail(const NativeCodeBasicBlock* bl } else if (mIns[i].ReferencesZeroPage(to) || (pair && mIns[i].ReferencesZeroPage(to + 1))) return false; + else if (mIns[i].mType == ASMIT_JSR) + { + if (mIns[i].mFlags & NCIF_USE_ZP_32_X) + { + if (to >= mIns[i].mParam && to < mIns[i].mParam + 4 || + from >= mIns[i].mParam && from < mIns[i].mParam + 4) + return false; + } + } } if (mTrueJump && !mTrueJump->IsFinalZeroPageUseTail(block, from, to, pair)) @@ -42657,7 +42666,7 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(NativeCodeProcedure* proc, int pass if (mFalseJump) mFalseJump->CheckLive(); #if 1 - if (pass < 7 && i + 1 < mIns.Size()) + if (pass < 10 && i + 1 < mIns.Size()) { if ( mIns[i + 0].mType == ASMIT_LDA && (mIns[i + 0].mMode == ASMIM_ABSOLUTE || mIns[i + 0].mMode == ASMIM_ABSOLUTE_X || mIns[i + 0].mMode == ASMIM_ABSOLUTE_Y || mIns[i + 0].mMode == ASMIM_INDIRECT_Y) && @@ -45130,7 +45139,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc) { mInterProc = proc; - CheckFunc = !strcmp(mInterProc->mIdent->mString, "test"); + CheckFunc = !strcmp(mInterProc->mIdent->mString, "atan2"); int nblocks = proc->mBlocks.Size(); tblocks = new NativeCodeBasicBlock * [nblocks]; @@ -45936,6 +45945,7 @@ void NativeCodeProcedure::Optimize(void) changed = true; #endif + if (step == 2) { ResetVisited(); @@ -46614,6 +46624,7 @@ void NativeCodeProcedure::Optimize(void) else cnt++; + } while (changed); #if 1 diff --git a/oscar64/Preprocessor.cpp b/oscar64/Preprocessor.cpp index 9c33be9..a2b04b8 100644 --- a/oscar64/Preprocessor.cpp +++ b/oscar64/Preprocessor.cpp @@ -463,6 +463,23 @@ void SourceFile::ReadCharPad(SourceFileDecoder decoder) } return; } + else if (decoder == SFD_CTM_TILES_8_SW) + { + mMemSize = numTiles * tileWidth * tileHeight; + mLimit = mMemSize; + mMemPos = 0; + mMemData = new uint8[mMemSize]; + for (int j = 0; j < numTiles; j++) + { + for (int i = 0; i < tileWidth * tileHeight; i++) + { + int16 d; + fread(&d, 2, 1, mFile); + mMemData[j + i * numTiles] = uint8(d); + } + } + return; + } else fseek(mFile, 2 * numTiles * tileWidth * tileHeight, SEEK_CUR); @@ -564,6 +581,7 @@ void SourceFile::Limit(SourceFileDecoder decoder, int skip, int limit) case SFD_CTM_CHAR_ATTRIB_1: case SFD_CTM_CHAR_ATTRIB_2: case SFD_CTM_TILES_8: + case SFD_CTM_TILES_8_SW: case SFD_CTM_TILES_16: case SFD_CTM_MAP_8: case SFD_CTM_MAP_16: diff --git a/oscar64/Preprocessor.h b/oscar64/Preprocessor.h index a849ba6..16d1684 100644 --- a/oscar64/Preprocessor.h +++ b/oscar64/Preprocessor.h @@ -30,6 +30,7 @@ enum SourceFileDecoder SFD_CTM_CHAR_ATTRIB_1, SFD_CTM_CHAR_ATTRIB_2, SFD_CTM_TILES_8, + SFD_CTM_TILES_8_SW, SFD_CTM_TILES_16, SFD_CTM_MAP_8, SFD_CTM_MAP_16, diff --git a/oscar64/Scanner.cpp b/oscar64/Scanner.cpp index 59ada76..d13cd48 100644 --- a/oscar64/Scanner.cpp +++ b/oscar64/Scanner.cpp @@ -880,6 +880,8 @@ void Scanner::NextPreToken(void) decoder = SFD_CTM_CHAR_ATTRIB_2; else if (!strcmp(mTokenIdent->mString, "ctm_tiles8")) decoder = SFD_CTM_TILES_8; + else if (!strcmp(mTokenIdent->mString, "ctm_tiles8sw")) + decoder = SFD_CTM_TILES_8_SW; else if (!strcmp(mTokenIdent->mString, "ctm_tiles16")) decoder = SFD_CTM_TILES_16; else if (!strcmp(mTokenIdent->mString, "ctm_map8"))