fix jump forward
This commit is contained in:
@@ -78,16 +78,16 @@ std::uint32_t Assembleur::ParseOperationImmediate(
|
||||
}
|
||||
|
||||
std::uint32_t Assembleur::ParseJump(Instruction a_Instruction, const std::string& a_Label) {
|
||||
int jump = a_Instruction.m_Line - ParseLabel(a_Label);
|
||||
std::int32_t jump = ParseLabel(a_Label) - a_Instruction.m_Line;
|
||||
if (jump < 0)
|
||||
jump = jump & 0x7FFFFFF | 0x4000000;
|
||||
jump = std::abs(jump) & 0x7FFFFFF | 0x4000000;
|
||||
return IToInt(a_Instruction) | jump;
|
||||
}
|
||||
|
||||
std::uint32_t Assembleur::ParseJump(Instruction a_Instruction, std::uint8_t a_R1, std::uint8_t a_R2, const std::string& a_Label) {
|
||||
int jump = a_Instruction.m_Line - ParseLabel(a_Label);
|
||||
std::int32_t jump = ParseLabel(a_Label) - a_Instruction.m_Line;
|
||||
if (jump < 0)
|
||||
jump = jump & 0xFFFFF | 100000;
|
||||
jump = std::abs(jump) & 0xFFFFF | 0x100000;
|
||||
return IToInt(a_Instruction) | a_R1 << 24 | a_R2 << 21 | jump;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user