mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-11-05 19:05:32 +00:00
78e5451f93
Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
37 lines
743 B
C++
37 lines
743 B
C++
#include "stdafx.h"
|
|
#include "FuseRegisterState.h"
|
|
#include <Processor.h>
|
|
|
|
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;
|
|
}
|
|
|
|
std::string Fuse::RegisterState::hex(int value) {
|
|
std::ostringstream output;
|
|
output << std::hex
|
|
<< std::setw(4)
|
|
<< std::setfill('0')
|
|
<< value;
|
|
return output.str();
|
|
} |