Optimize combining bits using shift
This commit is contained in:
parent
7b16d2c795
commit
a9651a4f2e
|
@ -33579,6 +33579,14 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(NativeCodeProcedure* proc, int pass
|
|||
mIns[i + 1].mType = ASMIT_ROR; mIns[i + 1].mMode = ASMIM_IMPLIED;
|
||||
progress = true;
|
||||
}
|
||||
else if (
|
||||
mIns[i + 0].mType == ASMIT_LDA && mIns[i + 0].mMode == ASMIM_ZERO_PAGE && !(mIns[i + 0].mLive & LIVE_MEM) &&
|
||||
mIns[i + 1].IsShift() && mIns[i + 1].mMode == ASMIM_IMPLIED && !(mIns[i + 1].mLive & LIVE_CPU_REG_A))
|
||||
{
|
||||
mIns[i + 0].mType = mIns[i + 1].mType; mIns[i + 0].mLive |= LIVE_CPU_REG_C;
|
||||
mIns[i + 1].mType = ASMIT_NOP; mIns[i + 1].mMode = ASMIM_IMPLIED;
|
||||
progress = true;
|
||||
}
|
||||
else if (
|
||||
mIns[i + 0].IsShift() && mIns[i + 0].mMode == ASMIM_ZERO_PAGE &&
|
||||
mIns[i + 1].mType == ASMIT_LDA && mIns[i + 1].mMode == ASMIM_ZERO_PAGE && mIns[i + 1].mAddress == mIns[i + 0].mAddress && !(mIns[i + 1].mLive & LIVE_MEM))
|
||||
|
@ -35984,7 +35992,6 @@ bool NativeCodeBasicBlock::PeepHoleOptimizer(NativeCodeProcedure* proc, int pass
|
|||
mIns[i + 3].mAddress = mIns[i + 0].mAddress;
|
||||
progress = true;
|
||||
}
|
||||
|
||||
if (
|
||||
mIns[i + 0].mType == ASMIT_LDY && mIns[i + 0].mMode == ASMIM_IMMEDIATE && mIns[i + 0].mAddress == 0 &&
|
||||
mIns[i + 1].mType == ASMIT_LDA && mIns[i + 1].mMode == ASMIM_INDIRECT_Y &&
|
||||
|
|
|
@ -79,6 +79,24 @@ __interrupt void setspr(void)
|
|||
xpos1 += step;
|
||||
}
|
||||
|
||||
// build highbyte for sprite pos
|
||||
char xymask = 0;
|
||||
if (phase & 0x80)
|
||||
{
|
||||
// put MSB into xymask bit
|
||||
#pragma unroll(full)
|
||||
for(char i=0; i<8; i++)
|
||||
xymask = ((unsigned)xymask | (xp[i] & 0xff00)) >> 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
// put MSB into xymask bit
|
||||
#pragma unroll(full)
|
||||
for(char i=0; i<8; i++)
|
||||
xymask = ((unsigned)xymask | (xp[7 - i] & 0xff00)) >> 1;
|
||||
}
|
||||
|
||||
|
||||
// Wait for end of current sprite, xpos will take effect
|
||||
// at start of line, so we need to patch it after the last
|
||||
// pixel line has started
|
||||
|
@ -87,15 +105,10 @@ __interrupt void setspr(void)
|
|||
// Left to right or right to left to get a matching z order
|
||||
if (phase & 0x80)
|
||||
{
|
||||
// MSB mask
|
||||
char xymask = 0;
|
||||
|
||||
// Update all sprite x LSB and color, put MSB into
|
||||
// xymask bit
|
||||
// Update all sprite x LSB and color
|
||||
#pragma unroll(full)
|
||||
for(char i=0; i<8; i++)
|
||||
{
|
||||
xymask = ((unsigned)xymask | (xp[i] & 0xff00)) >> 1;
|
||||
vic.spr_pos[i].x = xp[i];
|
||||
vic.spr_color[i] = VCOL_ORANGE + i;
|
||||
}
|
||||
|
@ -105,22 +118,16 @@ __interrupt void setspr(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
char xymask = 0;
|
||||
|
||||
// Update all sprite x LSB and color, put MSB into
|
||||
// xymask bit
|
||||
|
||||
// Update all sprite x LSB and color
|
||||
#pragma unroll(full)
|
||||
for(char i=0; i<8; i++)
|
||||
{
|
||||
xymask = ((unsigned)xymask | (xp[7 - i] & 0xff00)) >> 1;
|
||||
vic.spr_pos[i].x = xp[7 - i];
|
||||
vic.spr_color[i] = VCOL_ORANGE + (7 - i);
|
||||
}
|
||||
|
||||
}
|
||||
// Update MSB
|
||||
vic.spr_msbx = xymask;
|
||||
}
|
||||
}
|
||||
|
||||
// Eight raster interrupts
|
||||
|
|
Loading…
Reference in New Issue