Implementing MVN

This commit is contained in:
Anonymus Raccoon
2020-05-13 23:12:31 +02:00
parent 7fe28a8bcc
commit d0e4caf12e
5 changed files with 53 additions and 4 deletions
@@ -2,6 +2,7 @@
// Created by anonymus-raccoon on 2/28/20.
//
#include <iostream>
#include "../CPU.hpp"
namespace ComSquare::CPU
@@ -150,4 +151,21 @@ namespace ComSquare::CPU
this->_registers.p.z = this->_registers.y == 0;
return 0;
}
int CPU::MVN(uint24_t params, AddressingMode)
{
uint8_t srcBank = params;
uint8_t destBank = params >> 8u;
int length = this->_registers.a + 1;
this->_registers.dbr = destBank;
while (this->_registers.a != 0xFFFF) {
uint8_t data = this->_bus->read(srcBank << 24u | this->_registers.x);
this->_bus->write(destBank << 24u | this->_registers.y, data);
this->_registers.x++;
this->_registers.y++;
this->_registers.a--;
}
return 7 * length;
}
}