mirror of
https://github.com/fadden/6502bench.git
synced 2024-09-06 17:54:25 +00:00
Strip single-byte format items on single-byte instructions
It's possible to have format descriptors on instructions that are left over from when the bytes were treated as data. Single-byte formats were being allowed on single-byte instructions, which confused things later when the code tried to apply the format to an instruction with no operand.
This commit is contained in:
parent
e6b0438d5d
commit
4639af8b0e
@ -532,20 +532,29 @@ namespace SourceGen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mAnattribs[offset].IsInstructionStart) {
|
if (mAnattribs[offset].IsInstructionStart) {
|
||||||
// Check length for instruction formatters.
|
// Check length for instruction formatters. This can happen if you format
|
||||||
|
// a bunch of bytes as single-byte data items and then add a code entry
|
||||||
|
// point.
|
||||||
if (kvp.Value.Length != mAnattribs[offset].Length) {
|
if (kvp.Value.Length != mAnattribs[offset].Length) {
|
||||||
genLog.LogW("Unexpected length on instr format descriptor (" +
|
genLog.LogW("+" + offset.ToString("x6") +
|
||||||
|
": unexpected length on instr format descriptor (" +
|
||||||
kvp.Value.Length + " vs " + mAnattribs[offset].Length + ")");
|
kvp.Value.Length + " vs " + mAnattribs[offset].Length + ")");
|
||||||
continue; // ignore this one
|
continue; // ignore this one
|
||||||
}
|
}
|
||||||
|
if (kvp.Value.Length == 1) {
|
||||||
|
// No operand to format!
|
||||||
|
genLog.LogW("+" + offset.ToString("x6") +
|
||||||
|
": unexpected format descriptor on single-byte op");
|
||||||
|
continue; // ignore this one
|
||||||
|
}
|
||||||
if (!kvp.Value.IsValidForInstruction) {
|
if (!kvp.Value.IsValidForInstruction) {
|
||||||
genLog.LogW("Descriptor not valid for instruction: " + kvp.Value);
|
genLog.LogW("Descriptor not valid for instruction: " + kvp.Value);
|
||||||
continue; // ignore this one
|
continue; // ignore this one
|
||||||
}
|
}
|
||||||
} else if (mAnattribs[offset].IsInstruction) {
|
} else if (mAnattribs[offset].IsInstruction) {
|
||||||
// Mid-instruction format.
|
// Mid-instruction format.
|
||||||
genLog.LogW("Unexpected mid-instruction format descriptor at +" +
|
genLog.LogW("+" + offset.ToString("x6") +
|
||||||
offset.ToString("x6"));
|
": unexpected mid-instruction format descriptor");
|
||||||
continue; // ignore this one
|
continue; // ignore this one
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1096,8 +1096,11 @@ namespace SourceGen {
|
|||||||
operandForSymbol = attr.OperandAddress;
|
operandForSymbol = attr.OperandAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check Length to watch for bogus descriptors (?)
|
// Check Length to watch for bogus descriptors. ApplyFormatDescriptors() should
|
||||||
|
// have discarded anything appropriate, so we might be able to eliminate this test.
|
||||||
if (attr.DataDescriptor != null && attr.Length == attr.DataDescriptor.Length) {
|
if (attr.DataDescriptor != null && attr.Length == attr.DataDescriptor.Length) {
|
||||||
|
Debug.Assert(operandLen > 0);
|
||||||
|
|
||||||
// Format operand as directed.
|
// Format operand as directed.
|
||||||
if (op.AddrMode == OpDef.AddressMode.BlockMove) {
|
if (op.AddrMode == OpDef.AddressMode.BlockMove) {
|
||||||
// Special handling for the double-operand block move.
|
// Special handling for the double-operand block move.
|
||||||
|
Loading…
Reference in New Issue
Block a user