From 9cfad0ef4b25ba1a03bae257a475506e636612af Mon Sep 17 00:00:00 2001 From: Ettore Ricci Date: Tue, 2 Jul 2024 11:40:27 +0200 Subject: [PATCH] Fixed definetly the bug, now no extra instruction is kept --- src/app/asm/assembly.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/asm/assembly.rs b/src/app/asm/assembly.rs index f66afc4..3929280 100644 --- a/src/app/asm/assembly.rs +++ b/src/app/asm/assembly.rs @@ -329,7 +329,7 @@ impl App { loop { if current_byte >= maximum_code_byte { - to_byte = maximum_code_byte.saturating_sub(1); + to_byte = maximum_code_byte; break; } let bytes = &self.data.bytes[current_byte..maximum_code_byte]; @@ -363,7 +363,7 @@ impl App { return; } - let to_instruction = self.assembly_offsets[to_byte]; + let to_instruction = self.assembly_offsets.get(to_byte).cloned().unwrap_or(self.assembly_instructions.len()); let mut original_instruction_count = 1; let mut original_instruction_ip = self.assembly_offsets[from_byte]; @@ -396,6 +396,10 @@ impl App { ), ); } + else + { + break; + } } for instruction in instructions.iter() { if let AssemblyLine::Instruction(instruction_tag) = instruction {