mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2026-04-20 10:16:48 +00:00
Modifying the manner in which memory is mapped, allows a fairly clean mechanism for loading Intel "hex" files.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
+7
-32
@@ -1,11 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "Board.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <assert.h>
|
||||
|
||||
Board::Board(const Configuration& configuration)
|
||||
: m_configuration(configuration),
|
||||
m_cpu(EightBit::mc6809(*this)),
|
||||
@@ -15,9 +10,7 @@ void Board::initialise() {
|
||||
|
||||
const auto directory = m_configuration.getRomDirectory() + "\\";
|
||||
|
||||
m_extendedBasic.load(directory + "extbas11.rom");
|
||||
m_colorBasic.load(directory + "bas12.rom");
|
||||
m_diskBasic.load(directory + "disk11.rom");
|
||||
loadHexFile(directory + "ExBasROM.hex");
|
||||
|
||||
if (m_configuration.isDebugMode()) {
|
||||
CPU().ExecutingInstruction.connect(std::bind(&Board::Cpu_ExecutingInstruction_Debug, this, std::placeholders::_1));
|
||||
@@ -25,6 +18,8 @@ void Board::initialise() {
|
||||
}
|
||||
|
||||
CPU().powerOn();
|
||||
CPU().raise(CPU().NMI());
|
||||
CPU().raise(CPU().FIRQ());
|
||||
CPU().reset();
|
||||
}
|
||||
|
||||
@@ -38,33 +33,13 @@ void Board::Cpu_ExecutedInstruction_Debug(EightBit::mc6809&) {
|
||||
std::cout << m_disassembler.trace(m_disassembleAt) << std::endl;
|
||||
}
|
||||
|
||||
uint8_t& Board::reference(uint16_t address) {
|
||||
EightBit::MemoryMapping Board::mapping(uint16_t address) {
|
||||
|
||||
// 0x0000 - 0x7fff
|
||||
if (address < 0x8000)
|
||||
return m_ram.reference(address);
|
||||
return { m_ram, 0x0000, EightBit::MemoryMapping::ReadWrite };
|
||||
|
||||
// 0x8000 - 0x9fff
|
||||
if (address < 0xa000)
|
||||
return DATA() = m_extendedBasic.peek(address - 0x8000);
|
||||
|
||||
// 0xa000 - 0xbfff
|
||||
if (address < 0xc000)
|
||||
return DATA() = m_colorBasic.peek(address - 0xa000);
|
||||
return { m_io, 0x8000, EightBit::MemoryMapping::ReadWrite };
|
||||
|
||||
// 0xc000 - 0xdfff
|
||||
if (address < 0xe000)
|
||||
return DATA() = m_diskBasic.peek(address - 0xc000);
|
||||
|
||||
// 0xe000 - 0xfeff
|
||||
if (address < 0xff00)
|
||||
return DATA() = 0xff;
|
||||
|
||||
// 0xe000 - 0xfeff
|
||||
if (address < 0xfff0)
|
||||
return m_io.reference(address - 0xff00);
|
||||
|
||||
// 0xfff0 - 0xffff
|
||||
const auto offset = address - 0xfff0;
|
||||
return DATA() = m_colorBasic.peek(0x1ff0 + offset);
|
||||
return { m_rom, 0xc000, EightBit::MemoryMapping::ReadOnly };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user