2017-08-10 19:34:17 +00:00
|
|
|
#include "stdafx.h"
|
|
|
|
#include "FuseRegisterState.h"
|
2017-08-11 22:16:24 +00:00
|
|
|
#include <Processor.h>
|
2017-08-10 19:34:17 +00:00
|
|
|
|
|
|
|
Fuse::RegisterState::RegisterState()
|
|
|
|
: registers(NUMBER_OF_REGISTERS) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void Fuse::RegisterState::read(std::ifstream& file) {
|
|
|
|
readExternal(file);
|
|
|
|
readInternal(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Fuse::RegisterState::readExternal(std::ifstream& file) {
|
|
|
|
for (int idx = 0; idx < registers.size(); ++idx) {
|
|
|
|
int input;
|
|
|
|
file >> input;
|
|
|
|
registers[idx].word = input;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Fuse::RegisterState::readInternal(std::ifstream& file) {
|
|
|
|
file >> halted;
|
|
|
|
|
|
|
|
file >> std::dec;
|
|
|
|
file >> tstates;
|
|
|
|
file >> std::hex;
|
|
|
|
}
|
2017-08-10 22:46:41 +00:00
|
|
|
|
|
|
|
std::string Fuse::RegisterState::hex(int value) {
|
|
|
|
std::ostringstream output;
|
|
|
|
output << std::hex
|
|
|
|
<< std::setw(4)
|
|
|
|
<< std::setfill('0')
|
|
|
|
<< value;
|
|
|
|
return output.str();
|
|
|
|
}
|