From eb6cde02a7e132d457eb23c22c94f5e1d1eb86e6 Mon Sep 17 00:00:00 2001 From: Persson-dev Date: Tue, 26 Nov 2024 17:14:22 +0100 Subject: [PATCH] absolute jump --- src/Assembleur.cpp | 11 ++--------- src/Assembleur.h | 1 - 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/Assembleur.cpp b/src/Assembleur.cpp index 9baee9f..2fdf656 100644 --- a/src/Assembleur.cpp +++ b/src/Assembleur.cpp @@ -79,17 +79,11 @@ std::uint32_t Assembleur::ParseOperationImmediate( } std::uint32_t Assembleur::ParseJump(Instruction a_Instruction, const std::string& a_Label) { - std::int32_t jump = ParseLabel(a_Label) - a_Instruction.m_Line; - if (jump < 0) - jump = std::abs(jump) & 0x7FFFFFF | 0x4000000; - return IToInt(a_Instruction) | jump; + return IToInt(a_Instruction) | ParseLabel(a_Label); } std::uint32_t Assembleur::ParseJump(Instruction a_Instruction, std::uint8_t a_R1, std::uint8_t a_R2, const std::string& a_Label) { - std::int32_t jump = ParseLabel(a_Label) - a_Instruction.m_Line; - if (jump < 0) - jump = std::abs(jump) & 0xFFFFF | 0x100000; - return IToInt(a_Instruction) | a_R1 << 24 | a_R2 << 21 | jump; + return IToInt(a_Instruction) | a_R1 << 24 | a_R2 << 21 | ParseLabel(a_Label); } std::uint32_t Assembleur::ParseJump(Instruction a_Instruction) { @@ -134,7 +128,6 @@ std::uint32_t Assembleur::ParseInstruction(const std::string& a_Str, std::uint32 } Instruction instruction = it->second; - instruction.m_Line = a_Line; try { switch (instruction.m_Instruction) { diff --git a/src/Assembleur.h b/src/Assembleur.h index 7ef002e..bcff02f 100644 --- a/src/Assembleur.h +++ b/src/Assembleur.h @@ -13,7 +13,6 @@ enum TypeInstruction : std::uint8_t { struct Instruction { TypeInstruction m_Instruction; std::uint8_t m_SubInstruction; - std::uint32_t m_Line; }; class Assembleur {