diff --git a/Assembler/AssemblySourceProcessor.CpuInstructions.cs b/Assembler/AssemblySourceProcessor.CpuInstructions.cs index e0923d6..a1b8112 100644 --- a/Assembler/AssemblySourceProcessor.CpuInstructions.cs +++ b/Assembler/AssemblySourceProcessor.CpuInstructions.cs @@ -174,11 +174,17 @@ static string RemoveSpacesAroundParenthesis(string argument) return line; } - // There's at least one variable argument. + // There's (or there should be) at least one variable argument. var firstArgumentType = GetCpuInstructionArgumentPattern(firstArgument); var secondArgumentType = GetCpuInstructionArgumentPattern(secondArgument); + if(firstArgumentType is CpuParsedArgType.Fixed && secondArgumentType is CpuParsedArgType.Fixed or CpuParsedArgType.None) { + AddError(AssemblyErrorCode.InvalidCpuInstruction, $"Invalid {currentCpu} instruction: {instructionSearchKey}"); + walker.DiscardRemaining(); + return new CpuInstructionLine() { IsInvalid = true }; + } + bool isInstructionWithTwoVariableArguments = false; var isLD = string.Equals("LD", opcode, StringComparison.OrdinalIgnoreCase); if(isZ280) {