mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2026-04-25 15:18:01 +00:00
Const some more bus/processor usage, and ensure the data bus is a member, not a reference to memory.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
@@ -13,7 +13,7 @@ EightBit::Disassembler::Disassembler() {
|
||||
m_formatter.exceptions(boost::io::all_error_bits ^ boost::io::too_many_args_bit);
|
||||
}
|
||||
|
||||
std::string EightBit::Disassembler::state(Intel8080& cpu) {
|
||||
std::string EightBit::Disassembler::state(const Intel8080& cpu) {
|
||||
|
||||
auto pc = cpu.PC();
|
||||
auto sp = cpu.SP();
|
||||
@@ -160,13 +160,13 @@ std::string EightBit::Disassembler::alu2(int which) {
|
||||
throw std::logic_error("Unhandled alu operation");
|
||||
}
|
||||
|
||||
std::string EightBit::Disassembler::disassemble(Intel8080& cpu) {
|
||||
std::string EightBit::Disassembler::disassemble(const Intel8080& cpu) {
|
||||
std::ostringstream output;
|
||||
disassemble(output, cpu, cpu.PC().word);
|
||||
return output.str();
|
||||
}
|
||||
|
||||
void EightBit::Disassembler::disassemble(std::ostringstream& output, Intel8080& cpu, uint16_t pc) {
|
||||
void EightBit::Disassembler::disassemble(std::ostringstream& output, const Intel8080& cpu, uint16_t pc) {
|
||||
|
||||
auto& bus = cpu.BUS();
|
||||
auto opcode = bus.peek(pc);
|
||||
|
||||
@@ -7,19 +7,37 @@ EightBit::Intel8080::Intel8080(Bus& bus, InputOutput& ports)
|
||||
}
|
||||
|
||||
EightBit::register16_t& EightBit::Intel8080::AF() {
|
||||
auto& f = af.low;
|
||||
f = (f | Bit1) & ~(Bit5 | Bit3);
|
||||
af.low = (af.low | Bit1) & ~(Bit5 | Bit3);
|
||||
return af;
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::Intel8080::AF() const {
|
||||
register16_t returned;
|
||||
returned.low = (af.low | Bit1) & ~(Bit5 | Bit3);
|
||||
returned.high = af.high;
|
||||
return returned;
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::Intel8080::BC() const {
|
||||
return bc;
|
||||
}
|
||||
|
||||
EightBit::register16_t& EightBit::Intel8080::BC() {
|
||||
return bc;
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::Intel8080::DE() const {
|
||||
return de;
|
||||
}
|
||||
|
||||
EightBit::register16_t& EightBit::Intel8080::DE() {
|
||||
return de;
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::Intel8080::HL() const {
|
||||
return hl;
|
||||
}
|
||||
|
||||
EightBit::register16_t& EightBit::Intel8080::HL() {
|
||||
return hl;
|
||||
}
|
||||
@@ -240,7 +258,7 @@ void EightBit::Intel8080::xhtl(register16_t& operand) {
|
||||
void EightBit::Intel8080::writePort(uint8_t port, uint8_t data) {
|
||||
BUS().ADDRESS().low = port;
|
||||
BUS().ADDRESS().high = data;
|
||||
BUS().placeDATA(data);
|
||||
BUS().DATA() = data;
|
||||
writePort();
|
||||
}
|
||||
|
||||
@@ -256,7 +274,7 @@ void EightBit::Intel8080::readPort(uint8_t port, uint8_t& a) {
|
||||
}
|
||||
|
||||
void EightBit::Intel8080::readPort() {
|
||||
BUS().placeDATA(m_ports.read(BUS().ADDRESS().low));
|
||||
BUS().DATA() = m_ports.read(BUS().ADDRESS().low);
|
||||
}
|
||||
|
||||
int EightBit::Intel8080::step() {
|
||||
|
||||
Reference in New Issue
Block a user