added "jal" command
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
//
|
||||
|
||||
#include "Alu.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "Memory.h"
|
||||
@@ -126,6 +128,14 @@ void Alu::calculate(const std::vector<std::string> &commandVector) {
|
||||
if (register1 != register2) {
|
||||
Manager::getInstance()->setStreamPosition(streamPos);
|
||||
}
|
||||
} else if (command == "jal") {
|
||||
/// Jump and link Befehl
|
||||
/// !!! Funktioniert nicht bei großen Daten aufgrund des casts des stream offsets zu int
|
||||
const auto pos = static_cast<int>(Manager::getInstance()->getStreamPosition().operator std::streamoff());
|
||||
const auto &label = commandVector.at(2);
|
||||
const auto streamPos = ProgramLoader::getInstance()->getStreamPosition(label);
|
||||
Register::getInstance().setRegister(arg1, pos);
|
||||
Manager::getInstance()->setStreamPosition(streamPos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user