Fix COPY command operation
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
DataHoarder 2020-12-28 22:31:02 +01:00
parent 596aaabb6e
commit 76a55261ea

View file

@ -64,7 +64,7 @@ std::string Instruction::Copy::toString() const {
std::vector<Instruction::OutputFormat> Instruction::Copy::toOutputFormat(const OutputContext &context) const {
return std::vector<OutputFormat>{
OutputFormat{getAddress(), dynamic_cast<std::stringstream&>(std::stringstream("") << "COPY" << " " << std::dec << (uint32_t)count << ", " << getAddressRegisterName(addressAA)).str()},
OutputFormat{getAddress() + 4, dynamic_cast<std::stringstream&>(std::stringstream("") << " SOURCE " << getAddressRegisterName(addressBB)).str()}
OutputFormat{getAddress() + 4, dynamic_cast<std::stringstream&>(std::stringstream("") << " TO " << getAddressRegisterName(addressBB)).str()}
};
}
@ -76,7 +76,7 @@ std::vector<std::pair<uint32_t, std::unordered_map<uint32_t, uint32_t>>>
Instruction::Copy::execute(AnalysisState &state) const {
for (uint32_t i = 0; i < count; ++i) {
state.setRegister(addressAA.offset + addressAA.address + i, state.getRegister(addressBB.offset + addressBB.address + i));
state.setRegister(addressBB.offset + addressBB.address + i, state.getRegister(addressAA.offset + addressAA.address + i));
}
state.current = _endAddress;