Ensure the i8080 unit tests run successfully to completion.

Signed-off-by: Adrian.Conlon <adrian.conlon@gmail.com>
This commit is contained in:
Adrian.Conlon 2017-09-07 00:55:06 +01:00
parent 0665de5951
commit 74a62f554d
3 changed files with 26 additions and 21 deletions

View File

@ -6,21 +6,20 @@
Board::Board(const Configuration& configuration)
: m_configuration(configuration),
m_memory(0xffff),
m_cpu(EightBit::Intel8080(m_memory, m_ports)) {
m_ram(0x10000),
m_cpu(EightBit::Intel8080(*this, m_ports)) {
}
void Board::initialise() {
m_memory.clear();
auto romDirectory = m_configuration.getRomDirectory();
//m_memory.loadRam(romDirectory + "/TEST.COM", 0x100); // Microcosm
//m_memory.loadRam(romDirectory + "/8080PRE.COM", 0x100); // Bartholomew preliminary
m_memory.loadRam(romDirectory + "/8080EX1.COM", 0x100); // Cringle/Bartholomew
//m_memory.loadRam(romDirectory + "/CPUTEST.COM", 0x100); // SuperSoft diagnostics
//m_ram.load(romDirectory + "/TEST.COM", 0x100); // Microcosm
//m_ram.load(romDirectory + "/8080PRE.COM", 0x100); // Bartholomew preliminary
m_ram.load(romDirectory + "/8080EX1.COM", 0x100); // Cringle/Bartholomew
//m_ram.load(romDirectory + "/CPUTEST.COM", 0x100); // SuperSoft diagnostics
m_memory.poke(5, 0xc9); // ret
poke(5, 0xc9); // ret
m_cpu.ExecutingInstruction.connect(std::bind(&Board::Cpu_ExecutingInstruction_Cpm, this, std::placeholders::_1));
if (m_configuration.isProfileMode()) {
@ -61,8 +60,8 @@ void Board::bdos() {
break;
}
case 0x9:
for (uint16_t i = m_cpu.DE().word; m_memory.peek(i) != '$'; ++i) {
std::cout << m_memory.peek(i);
for (uint16_t i = m_cpu.DE().word; peek(i) != '$'; ++i) {
std::cout << peek(i);
}
break;
}
@ -73,7 +72,7 @@ void Board::Cpu_ExecutingInstruction_Profile(const EightBit::Intel8080& cpu) {
const auto pc = m_cpu.PC();
m_profiler.addAddress(pc.word);
m_profiler.addInstruction(m_memory.peek(pc.word));
m_profiler.addInstruction(peek(pc.word));
}
void Board::Cpu_ExecutingInstruction_Debug(const EightBit::Intel8080&) {

View File

@ -1,26 +1,32 @@
#pragma once
#include "Memory.h"
#include "InputOutput.h"
#include "Intel8080.h"
#include "Profiler.h"
#include "EventArgs.h"
#include "Disassembler.h"
#include <Bus.h>
#include <Ram.h>
#include <InputOutput.h>
#include <Intel8080.h>
#include <Profiler.h>
#include <EventArgs.h>
#include <Disassembler.h>
class Configuration;
class Board {
class Board : public EightBit::Bus {
public:
Board(const Configuration& configuration);
EightBit::Memory& Memory() { return m_memory; }
EightBit::Intel8080& CPU() { return m_cpu; }
void initialise();
protected:
virtual uint8_t& reference(uint16_t address, bool& rom) {
rom = false;
return m_ram.reference(address);
}
private:
const Configuration& m_configuration;
EightBit::Memory m_memory;
EightBit::Ram m_ram;
EightBit::InputOutput m_ports;
EightBit::Intel8080 m_cpu;
EightBit::Disassembler m_disassembler;

View File

@ -2,7 +2,7 @@
#include <string>
#include "Memory.h"
#include <Register.h>
class Configuration {
public: