Fix bug in the first solid word search

This commit is contained in:
Lucas Scharenbroich 2016-12-18 00:03:11 -06:00
parent 53561fbcc8
commit 8850bec117
3 changed files with 5 additions and 7 deletions

View File

@ -48,6 +48,7 @@ namespace SpriteCompiler.Problem
{
_.A = _.A.Add(offset);
_.S = _.A;
_.AllowModeChange = true;
});
}

View File

@ -82,7 +82,7 @@
public override string ToString()
{
return String.Format("A = {0:X4}, X = {1}, Y = {2}, S = {3}, D = {4}, P = {5:X2}", A, X, Y, S, D, P);
return String.Format("A = {0:X4}, X = {1}, Y = {2}, S = {3}, D = {4}, P = {5:X2}, Change? = {6}", A, X, Y, S, D, P, AllowModeChange);
}
public void RemoveWord(ushort offset)

View File

@ -108,7 +108,7 @@
// a second stack adjustment.
//
// 3. Set the stack to the first, right-most offset that end a sequence of solid bytes
if (!state.S.IsScreenOffset && state.A.IsScreenOffset)
if (!state.S.IsScreenOffset && state.A.IsScreenOffset && state.LongA)
{
// If the first byte is within 255 bytes of the accumulator, propose setting
// the stack to the accumulator value
@ -136,7 +136,7 @@
// If the first byte is 256 bytes or more ahead of the current stack location,
// then we need to advance
var firstByteDistance = firstByte.Offset - state.S.Value;
if (state.S.IsScreenOffset && firstByteDistance >= 256)
if (state.S.IsScreenOffset && firstByteDistance >= 256 && state.LongA)
{
// Go to the next byte, or the first solid edge
yield return state.Apply(new MOVE_STACK(firstByteDistance));
@ -297,9 +297,6 @@
yield return state.Apply(new SHORT_M());
}
}
Done:
var z = 0; z += 1;
}
private static bool IsSolidPair(Tuple<SpriteByte, SpriteByte> pair)
@ -340,7 +337,7 @@
trigger = true;
}
if (item.Mask != 0x00 && trigger)
if ((item.Mask != 0x00 || (item.Offset - last.Offset) > 1) && trigger)
{
return new SolidRun(first, last);
}