mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2026-10-22 07:02:37 +00:00
6809 compiles and kinda runs
This commit is contained in:
1 parent
27b45916bc
commit
da157dada6
11 files changed
+1280
-1008
No files matched your search
+14
-9
@@ -112,7 +112,7 @@ namespace EightBit {
|
||||
// Default push/pop handlers
|
||||
|
||||
void push(uint8_t value) noexcept final;
|
||||
[[nodiscard]] uint8_t pop() noexcept final;
|
||||
void pop() noexcept final;
|
||||
|
||||
// Interrupt (etc.) handlers
|
||||
|
||||
@@ -121,8 +121,13 @@ namespace EightBit {
|
||||
|
||||
// Bus reader/writers
|
||||
|
||||
void busWrite() noexcept final;
|
||||
uint8_t busRead() noexcept final;
|
||||
using Processor::memoryRead;
|
||||
using Processor::memoryWrite;
|
||||
void memoryRead() noexcept override;
|
||||
void memoryWrite() noexcept override;
|
||||
|
||||
void busWrite() noexcept;
|
||||
uint8_t busRead() noexcept;
|
||||
|
||||
void call(register16_t destination) noexcept final;
|
||||
void ret() noexcept final;
|
||||
@@ -236,7 +241,7 @@ namespace EightBit {
|
||||
// Flag adjustment
|
||||
|
||||
template<class T> constexpr void adjustZero(const T datum) { CC() = clearBit(CC(), ZF, datum); }
|
||||
constexpr void adjustZero(const register16_t datum) { CC() = clearBit(CC(), ZF, datum.word); }
|
||||
constexpr void adjustZero(const register16_t datum) { CC() = clearBit(CC(), ZF, datum.joined); }
|
||||
constexpr void adjustNegative(const uint8_t datum) { CC() = setBit(CC(), NF, datum & Bit7); }
|
||||
constexpr void adjustNegative(const register16_t datum) { adjustNegative(datum.high); }
|
||||
constexpr void adjustNegative(const uint16_t datum) { adjustNegative(register16_t(datum)); }
|
||||
@@ -248,11 +253,11 @@ namespace EightBit {
|
||||
|
||||
constexpr void adjustCarry(const uint16_t datum) { CC() = setBit(CC(), CF, datum & Bit8); } // 8-bit addition
|
||||
constexpr void adjustCarry(const uint32_t datum) { CC() = setBit(CC(), CF, datum & Bit16); } // 16-bit addition
|
||||
constexpr void adjustCarry(const register16_t datum) { adjustCarry(datum.word); }
|
||||
constexpr void adjustCarry(const register16_t datum) { adjustCarry(datum.joined); }
|
||||
|
||||
constexpr void adjustBorrow(const uint16_t datum) { CC() = clearBit(CC(), CF, datum & Bit8); } // 8-bit subtraction
|
||||
constexpr void adjustBorrow(const uint32_t datum) { CC() = clearBit(CC(), CF, datum & Bit16); } // 16-bit subtraction
|
||||
constexpr void adjustBorrow(const register16_t datum) { adjustBorrow(datum.word); }
|
||||
constexpr void adjustBorrow(const register16_t datum) { adjustBorrow(datum.joined); }
|
||||
|
||||
constexpr void adjustOverflow(const uint8_t before, const uint8_t data, const register16_t after) {
|
||||
const uint8_t lowAfter = after.low;
|
||||
@@ -267,7 +272,7 @@ namespace EightBit {
|
||||
}
|
||||
|
||||
constexpr void adjustOverflow(const register16_t before, const register16_t data, const register16_t after) {
|
||||
adjustOverflow(before.word, data.word, after.word);
|
||||
adjustOverflow(before.joined, data.joined, after.joined);
|
||||
}
|
||||
|
||||
constexpr void adjustHalfCarry(const uint8_t before, const uint8_t data, const uint8_t after) {
|
||||
@@ -290,7 +295,7 @@ namespace EightBit {
|
||||
}
|
||||
|
||||
constexpr void adjustAddition(const register16_t before, const register16_t data, const uint32_t after) {
|
||||
adjustAddition(before.word, data.word, after);
|
||||
adjustAddition(before.joined, data.joined, after);
|
||||
}
|
||||
|
||||
constexpr void adjustSubtraction(const uint8_t before, const uint8_t data, const register16_t after) {
|
||||
@@ -308,7 +313,7 @@ namespace EightBit {
|
||||
}
|
||||
|
||||
constexpr void adjustSubtraction(const register16_t before, const register16_t data, const uint32_t after) {
|
||||
adjustSubtraction(before.word, data.word, after);
|
||||
adjustSubtraction(before.joined, data.joined, after);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ std::string EightBit::Disassembly::dump_RelativeValue(int8_t value) {
|
||||
}
|
||||
|
||||
std::string EightBit::Disassembly::dump_WordValue(register16_t value) {
|
||||
return dump_WordValue(value.word);
|
||||
return dump_WordValue(value.joined);
|
||||
}
|
||||
|
||||
std::string EightBit::Disassembly::dump_WordValue(uint16_t value) {
|
||||
@@ -53,7 +53,7 @@ std::string EightBit::Disassembly::dump_WordValue(uint16_t value) {
|
||||
}
|
||||
|
||||
std::string EightBit::Disassembly::dump_RelativeValue(register16_t value) {
|
||||
return dump_RelativeValue((int16_t)value.word);
|
||||
return dump_RelativeValue((int16_t)value.joined);
|
||||
}
|
||||
|
||||
std::string EightBit::Disassembly::dump_RelativeValue(int16_t value) {
|
||||
@@ -69,7 +69,7 @@ std::string EightBit::Disassembly::trace() {
|
||||
}
|
||||
|
||||
std::string EightBit::Disassembly::trace(register16_t current) {
|
||||
return trace(current.word);
|
||||
return trace(current.joined);
|
||||
}
|
||||
|
||||
std::string EightBit::Disassembly::trace(uint16_t current) {
|
||||
@@ -99,7 +99,7 @@ std::string EightBit::Disassembly::disassemble() {
|
||||
}
|
||||
|
||||
std::string EightBit::Disassembly::disassemble(register16_t current) {
|
||||
return disassemble(current.word);
|
||||
return disassemble(current.joined);
|
||||
}
|
||||
|
||||
bool EightBit::Disassembly::ignore() {
|
||||
@@ -883,7 +883,7 @@ uint8_t EightBit::Disassembly::getByte(uint16_t address) {
|
||||
}
|
||||
|
||||
uint16_t EightBit::Disassembly::getShort(uint16_t address) {
|
||||
return CPU().peekShort(address).word;
|
||||
return CPU().peekShort(address).joined;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
+74
-49
@@ -36,7 +36,7 @@ void EightBit::mc6809::poweredStep() noexcept {
|
||||
else if (UNLIKELY(lowered(INT()) && !interruptMasked()))
|
||||
handleINT();
|
||||
else
|
||||
BigEndianProcessor::execute(fetchByte());
|
||||
BigEndianProcessor::execute(fetchInstruction());
|
||||
//}
|
||||
//ExecutedInstruction.fire(*this);
|
||||
//assert(cycles() > 0);
|
||||
@@ -62,7 +62,7 @@ void EightBit::mc6809::handleRESET() noexcept {
|
||||
memoryRead();
|
||||
memoryRead();
|
||||
memoryRead();
|
||||
jump(getShort());
|
||||
getPagedInto(PC());
|
||||
eat();
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void EightBit::mc6809::handleNMI() noexcept {
|
||||
eat();
|
||||
CC() = setBit(CC(), IF); // Disable IRQ
|
||||
CC() = setBit(CC(), FF); // Disable FIRQ
|
||||
jump(Processor::getWordPaged(0xff, NMIvector));
|
||||
Processor::getPagedInto(0xff, NMIvector, PC());
|
||||
eat();
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ void EightBit::mc6809::handleINT() noexcept {
|
||||
saveEntireRegisterState();
|
||||
eat();
|
||||
CC() = setBit(CC(), IF); // Disable IRQ
|
||||
jump(Processor::getWordPaged(0xff, IRQvector));
|
||||
Processor::getPagedInto(0xff, IRQvector, PC());
|
||||
eat();
|
||||
}
|
||||
|
||||
@@ -106,12 +106,20 @@ void EightBit::mc6809::handleFIRQ() noexcept {
|
||||
eat();
|
||||
CC() = setBit(CC(), IF); // Disable IRQ
|
||||
CC() = setBit(CC(), FF); // Disable FIRQ
|
||||
jump(Processor::getWordPaged(0xff, FIRQvector));
|
||||
Processor::getPagedInto(0xff, FIRQvector, PC());
|
||||
eat();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
void EightBit::mc6809::memoryRead() noexcept {
|
||||
busRead();
|
||||
}
|
||||
|
||||
void EightBit::mc6809::memoryWrite() noexcept {
|
||||
busWrite();
|
||||
}
|
||||
|
||||
void EightBit::mc6809::busWrite() noexcept {
|
||||
tick();
|
||||
lowerRW();
|
||||
@@ -121,7 +129,8 @@ void EightBit::mc6809::busWrite() noexcept {
|
||||
uint8_t EightBit::mc6809::busRead() noexcept {
|
||||
tick();
|
||||
raiseRW();
|
||||
return BigEndianProcessor::busRead();
|
||||
BigEndianProcessor::busRead();
|
||||
return BUS().DATA();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -129,7 +138,7 @@ uint8_t EightBit::mc6809::busRead() noexcept {
|
||||
void EightBit::mc6809::call(register16_t destination) noexcept {
|
||||
memoryRead(destination);
|
||||
eat();
|
||||
BigEndianProcessor::pushWord(PC());
|
||||
pushShort(PC());
|
||||
jump(destination);
|
||||
}
|
||||
|
||||
@@ -162,8 +171,8 @@ void EightBit::mc6809::executeUnprefixed() {
|
||||
|
||||
switch (opcode()) {
|
||||
|
||||
case 0x10: m_prefix10 = true; Processor::execute(fetchByte()); break;
|
||||
case 0x11: m_prefix11 = true; Processor::execute(fetchByte()); break;
|
||||
case 0x10: m_prefix10 = true; Processor::execute(fetchInstruction()); break;
|
||||
case 0x11: m_prefix11 = true; Processor::execute(fetchInstruction()); break;
|
||||
|
||||
// ABX
|
||||
case 0x3a: memoryRead(); X() += B(); eat(); break; // ABX (inherent)
|
||||
@@ -447,19 +456,19 @@ void EightBit::mc6809::executeUnprefixed() {
|
||||
case 0xf7: memoryWrite(Address_extended(), through(B())); break; // ST (STB extended)
|
||||
|
||||
// STD
|
||||
case 0xdd: Processor::setWord(Address_direct(), through(D())); break; // ST (STD direct)
|
||||
case 0xed: Processor::setWord(Address_indexed(), through(D())); break; // ST (STD indexed)
|
||||
case 0xfd: Processor::setWord(Address_extended(), through(D())); break; // ST (STD extended)
|
||||
case 0xdd: Processor::setShort(Address_direct(), through(D())); break; // ST (STD direct)
|
||||
case 0xed: Processor::setShort(Address_indexed(), through(D())); break; // ST (STD indexed)
|
||||
case 0xfd: Processor::setShort(Address_extended(), through(D())); break; // ST (STD extended)
|
||||
|
||||
// STU
|
||||
case 0xdf: Processor::setWord(Address_direct(), through(U())); break; // ST (STU direct)
|
||||
case 0xef: Processor::setWord(Address_indexed(), through(U())); break; // ST (STU indexed)
|
||||
case 0xff: Processor::setWord(Address_extended(), through(U())); break; // ST (STU extended)
|
||||
case 0xdf: Processor::setShort(Address_direct(), through(U())); break; // ST (STU direct)
|
||||
case 0xef: Processor::setShort(Address_indexed(), through(U())); break; // ST (STU indexed)
|
||||
case 0xff: Processor::setShort(Address_extended(), through(U())); break; // ST (STU extended)
|
||||
|
||||
// STX
|
||||
case 0x9f: Processor::setWord(Address_direct(), through(X())); break; // ST (STX direct)
|
||||
case 0xaf: Processor::setWord(Address_indexed(), through(X())); break; // ST (STX indexed)
|
||||
case 0xbf: Processor::setWord(Address_extended(), through(X())); break; // ST (STX extended)
|
||||
case 0x9f: Processor::setShort(Address_direct(), through(X())); break; // ST (STX direct)
|
||||
case 0xaf: Processor::setShort(Address_indexed(), through(X())); break; // ST (STX indexed)
|
||||
case 0xbf: Processor::setShort(Address_extended(), through(X())); break; // ST (STX extended)
|
||||
|
||||
// SUB
|
||||
|
||||
@@ -579,14 +588,14 @@ void EightBit::mc6809::execute10() {
|
||||
case 0x2f: branchLong(LE()); break; // BLE (LBLE relative)
|
||||
|
||||
// STS
|
||||
case 0xdf: Processor::setWord(Address_direct(), through(S())); break; // ST (STS direct)
|
||||
case 0xef: Processor::setWord(Address_indexed(), through(S())); break; // ST (STS indexed)
|
||||
case 0xff: Processor::setWord(Address_extended(), through(S())); break; // ST (STS extended)
|
||||
case 0xdf: Processor::setShort(Address_direct(), through(S())); break; // ST (STS direct)
|
||||
case 0xef: Processor::setShort(Address_indexed(), through(S())); break; // ST (STS indexed)
|
||||
case 0xff: Processor::setShort(Address_extended(), through(S())); break; // ST (STS extended)
|
||||
|
||||
// STY
|
||||
case 0x9f: Processor::setWord(Address_direct(), through(Y())); break; // ST (STY direct)
|
||||
case 0xaf: Processor::setWord(Address_indexed(), through(Y())); break; // ST (STY indexed)
|
||||
case 0xbf: Processor::setWord(Address_extended(), through(Y())); break; // ST (STY extended)
|
||||
case 0x9f: Processor::setShort(Address_direct(), through(Y())); break; // ST (STY direct)
|
||||
case 0xaf: Processor::setShort(Address_indexed(), through(Y())); break; // ST (STY indexed)
|
||||
case 0xbf: Processor::setShort(Address_extended(), through(Y())); break; // ST (STY extended)
|
||||
|
||||
// SWI
|
||||
case 0x3f: memoryRead(); swi2(); break; // SWI (SWI2 inherent)
|
||||
@@ -631,8 +640,8 @@ void EightBit::mc6809::push(const uint8_t value) noexcept {
|
||||
pushS(value);
|
||||
}
|
||||
|
||||
uint8_t EightBit::mc6809::pop() noexcept {
|
||||
return popS();
|
||||
void EightBit::mc6809::pop() noexcept {
|
||||
(void)popS();
|
||||
}
|
||||
|
||||
void EightBit::mc6809::push(register16_t& stack, const uint8_t value) noexcept {
|
||||
@@ -640,7 +649,8 @@ void EightBit::mc6809::push(register16_t& stack, const uint8_t value) noexcept {
|
||||
}
|
||||
|
||||
uint8_t EightBit::mc6809::pop(register16_t& stack) noexcept {
|
||||
return memoryRead(stack++);
|
||||
memoryRead(stack++);
|
||||
return BUS().DATA();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -663,23 +673,27 @@ EightBit::register16_t& EightBit::mc6809::RR(const int which) {
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::mc6809::Address_relative_byte() {
|
||||
const auto address = PC() + (int8_t)fetchByte();
|
||||
fetchByte();
|
||||
const auto address = PC() + (int8_t)BUS().DATA();
|
||||
eat();
|
||||
return address;
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::mc6809::Address_relative_word() {
|
||||
return PC() + (int16_t)fetchWord().word;
|
||||
fetchShort();
|
||||
return PC() + (int16_t)intermediate().joined;
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::mc6809::Address_direct() {
|
||||
const auto offset = fetchByte();
|
||||
fetchByte();
|
||||
const auto offset = BUS().DATA();
|
||||
eat();
|
||||
return register16_t(offset, DP());
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::mc6809::Address_indexed() {
|
||||
const auto type = fetchByte();
|
||||
fetchByte();
|
||||
const auto type = BUS().DATA();
|
||||
auto& r = RR((type & (Bit6 | Bit5)) >> 5);
|
||||
|
||||
register16_t address = Mask16;
|
||||
@@ -725,11 +739,13 @@ EightBit::register16_t EightBit::mc6809::Address_indexed() {
|
||||
eat();
|
||||
break;
|
||||
case 0b1000: // n,R (eight-bit)
|
||||
address = r + (int8_t)fetchByte();
|
||||
fetchByte();
|
||||
address = r + (int8_t)BUS().DATA();
|
||||
eat();
|
||||
break;
|
||||
case 0b1001: // n,R (sixteen-bit)
|
||||
address = r + (int16_t)fetchWord().word;
|
||||
fetchShort();
|
||||
address = r + (int16_t)intermediate().joined;
|
||||
memoryRead(PC());
|
||||
eat(2);
|
||||
break;
|
||||
@@ -757,7 +773,8 @@ EightBit::register16_t EightBit::mc6809::Address_indexed() {
|
||||
UNREACHABLE;
|
||||
}
|
||||
if (indirect) {
|
||||
address = Processor::getShort(address);
|
||||
getShort(address);
|
||||
address = intermediate();
|
||||
eat();
|
||||
}
|
||||
} else {
|
||||
@@ -770,45 +787,53 @@ EightBit::register16_t EightBit::mc6809::Address_indexed() {
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::mc6809::Address_extended() {
|
||||
const auto ea = fetchWord();
|
||||
fetchShort();
|
||||
eat();
|
||||
return ea;
|
||||
return intermediate();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
uint8_t EightBit::mc6809::AM_immediate_byte() {
|
||||
return fetchByte();
|
||||
fetchByte();
|
||||
return BUS().DATA();
|
||||
}
|
||||
|
||||
uint8_t EightBit::mc6809::AM_direct_byte() {
|
||||
return memoryRead(Address_direct());
|
||||
memoryRead(Address_direct());
|
||||
return BUS().DATA();
|
||||
}
|
||||
|
||||
uint8_t EightBit::mc6809::AM_indexed_byte() {
|
||||
return memoryRead(Address_indexed());
|
||||
memoryRead(Address_indexed());
|
||||
return BUS().DATA();
|
||||
}
|
||||
|
||||
uint8_t EightBit::mc6809::AM_extended_byte() {
|
||||
return memoryRead(Address_extended());
|
||||
memoryRead(Address_extended());
|
||||
return BUS().DATA();
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
EightBit::register16_t EightBit::mc6809::AM_immediate_word() {
|
||||
return fetchWord();
|
||||
fetchShort();
|
||||
return intermediate();
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::mc6809::AM_direct_word() {
|
||||
return Processor::getShort(Address_direct());
|
||||
getShort(Address_direct());
|
||||
return intermediate();
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::mc6809::AM_indexed_word() {
|
||||
return Processor::getShort(Address_indexed());
|
||||
getShort(Address_indexed());
|
||||
return intermediate();
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::mc6809::AM_extended_word() {
|
||||
return Processor::getShort(Address_extended());
|
||||
getShort(Address_extended());
|
||||
return intermediate();
|
||||
}
|
||||
|
||||
//
|
||||
@@ -844,7 +869,7 @@ uint8_t EightBit::mc6809::add(const uint8_t operand, const uint8_t data, const u
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::mc6809::add(const register16_t operand, const register16_t data) {
|
||||
const uint32_t addition = operand.word + data.word;
|
||||
const uint32_t addition = operand.joined + data.joined;
|
||||
adjustAddition(operand, data, addition);
|
||||
eat();
|
||||
return addition & Mask16;
|
||||
@@ -1087,21 +1112,21 @@ void EightBit::mc6809::swi() {
|
||||
saveEntireRegisterState();
|
||||
CC() = setBit(CC(), IF); // Disable IRQ
|
||||
CC() = setBit(CC(), FF); // Disable FIRQ
|
||||
jump(Processor::getWordPaged(0xff, SWIvector));
|
||||
Processor::getPagedInto(0xff, SWIvector, PC());
|
||||
eat();
|
||||
}
|
||||
|
||||
void EightBit::mc6809::swi2() {
|
||||
eat();
|
||||
saveEntireRegisterState();
|
||||
jump(Processor::getWordPaged(0xff, SWI2vector));
|
||||
Processor::getPagedInto(0xff, SWI2vector, PC());
|
||||
eat();
|
||||
}
|
||||
|
||||
void EightBit::mc6809::swi3() {
|
||||
eat();
|
||||
saveEntireRegisterState();
|
||||
jump(Processor::getWordPaged(0xff, SWI3vector));
|
||||
Processor::getPagedInto(0xff, SWI3vector, PC());
|
||||
eat();
|
||||
}
|
||||
|
||||
@@ -1137,7 +1162,7 @@ uint8_t EightBit::mc6809::sub(const uint8_t operand, const uint8_t data, const u
|
||||
}
|
||||
|
||||
EightBit::register16_t EightBit::mc6809::sub(const register16_t operand, const register16_t data) {
|
||||
const uint32_t subtraction = operand.word - data.word;
|
||||
const uint32_t subtraction = operand.joined - data.joined;
|
||||
adjustSubtraction(operand, data, subtraction);
|
||||
eat();
|
||||
return subtraction & Mask16;
|
||||
|
||||
+19
-15
@@ -4,7 +4,7 @@
|
||||
Board::Board(const Configuration& configuration)
|
||||
: m_configuration(configuration) {}
|
||||
|
||||
void Board::raisePOWER() {
|
||||
void Board::raisePOWER() noexcept {
|
||||
|
||||
EightBit::Bus::raisePOWER();
|
||||
|
||||
@@ -26,7 +26,7 @@ void Board::raisePOWER() {
|
||||
accessAcia();
|
||||
}
|
||||
|
||||
void Board::lowerPOWER() {
|
||||
void Board::lowerPOWER() noexcept {
|
||||
|
||||
if (m_configuration.isProfileMode()) {
|
||||
m_profiler.EmitLine.connect([this](EightBit::ProfileLineEventArgs line) {
|
||||
@@ -40,7 +40,7 @@ void Board::lowerPOWER() {
|
||||
EightBit::Bus::lowerPOWER();
|
||||
}
|
||||
|
||||
void Board::initialise() {
|
||||
void Board::initialise() noexcept {
|
||||
|
||||
// Load our BASIC interpreter
|
||||
const auto directory = m_configuration.getRomDirectory() + "\\";
|
||||
@@ -53,14 +53,14 @@ void Board::initialise() {
|
||||
});
|
||||
|
||||
// Marshal data from memory -> ACIA
|
||||
WrittenByte.connect([this] (EightBit::EventArgs&) {
|
||||
CPU().WrittenMemory.connect([this] (EightBit::EventArgs&) {
|
||||
updateAciaPins();
|
||||
if (ACIA().selected())
|
||||
accessAcia();
|
||||
});
|
||||
|
||||
// Marshal data from ACIA -> memory
|
||||
ReadingByte.connect([this] (EightBit::EventArgs&) {
|
||||
CPU().ReadingMemory.connect([this] (EightBit::EventArgs&) {
|
||||
updateAciaPins();
|
||||
if (accessAcia())
|
||||
poke(ACIA().DATA());
|
||||
@@ -84,7 +84,7 @@ void Board::initialise() {
|
||||
m_profiler.addInstruction(peek(cpu.PC()));
|
||||
});
|
||||
m_cpu.ExecutedInstruction.connect([this](EightBit::mc6809& cpu) {
|
||||
m_profiler.addAddress(cpu.PC().word, cpu.cycles());
|
||||
m_profiler.addAddress(cpu.PC().joined, cpu.cycles());
|
||||
});
|
||||
}
|
||||
|
||||
@@ -111,27 +111,31 @@ void Board::initialise() {
|
||||
}
|
||||
}
|
||||
|
||||
EightBit::MemoryMapping Board::mapping(uint16_t address) {
|
||||
const EightBit::MemoryMapping& Board::mapping(uint16_t address) noexcept {
|
||||
|
||||
if (address < 0x8000)
|
||||
return { m_ram, 0x0000, EightBit::Chip::Mask16, EightBit::MemoryMapping::AccessLevel::ReadWrite };
|
||||
return m_ramMapping;
|
||||
//return { m_ram, 0x0000, EightBit::Chip::Mask16, EightBit::MemoryMapping::AccessLevel::ReadWrite };
|
||||
|
||||
if (address < 0xa000)
|
||||
return { m_unused2000, 0x8000, EightBit::Chip::Mask16, EightBit::MemoryMapping::AccessLevel::ReadOnly };
|
||||
return m_unused2000Mapping;
|
||||
//return { m_unused2000, 0x8000, EightBit::Chip::Mask16, EightBit::MemoryMapping::AccessLevel::ReadOnly };
|
||||
|
||||
if (address < 0xc000)
|
||||
return { m_io, 0xa000, EightBit::Chip::Mask16, EightBit::MemoryMapping::AccessLevel::ReadWrite };
|
||||
return m_ioMapping;
|
||||
//return { m_io, 0xa000, EightBit::Chip::Mask16, EightBit::MemoryMapping::AccessLevel::ReadWrite };
|
||||
|
||||
return { m_rom, 0xc000, EightBit::Chip::Mask16, EightBit::MemoryMapping::AccessLevel::ReadOnly };
|
||||
return m_romMapping;
|
||||
//return { m_rom, 0xc000, EightBit::Chip::Mask16, EightBit::MemoryMapping::AccessLevel::ReadOnly };
|
||||
}
|
||||
|
||||
void Board::updateAciaPins() {
|
||||
ACIA().DATA() = DATA();
|
||||
EightBit::Device::match(ACIA().RW(), CPU().RW());
|
||||
EightBit::Device::match(ACIA().RS(), ADDRESS().word & EightBit::Chip::Bit0);
|
||||
EightBit::Device::match(ACIA().CS0(), ADDRESS().word & EightBit::Chip::Bit15);
|
||||
EightBit::Device::match(ACIA().CS1(), ADDRESS().word & EightBit::Chip::Bit13);
|
||||
EightBit::Device::match(ACIA().CS2(), ADDRESS().word & EightBit::Chip::Bit14);
|
||||
EightBit::Device::match(ACIA().RS(), ADDRESS().joined & EightBit::Chip::Bit0);
|
||||
EightBit::Device::match(ACIA().CS0(), ADDRESS().joined & EightBit::Chip::Bit15);
|
||||
EightBit::Device::match(ACIA().CS1(), ADDRESS().joined & EightBit::Chip::Bit13);
|
||||
EightBit::Device::match(ACIA().CS2(), ADDRESS().joined & EightBit::Chip::Bit14);
|
||||
}
|
||||
|
||||
bool Board::accessAcia() {
|
||||
|
||||
+9
-4
@@ -20,13 +20,13 @@ public:
|
||||
auto& CPU() { return m_cpu; }
|
||||
auto& ACIA() { return m_acia; }
|
||||
|
||||
void raisePOWER() final;
|
||||
void lowerPOWER() final;
|
||||
void raisePOWER() noexcept final;
|
||||
void lowerPOWER() noexcept final;
|
||||
|
||||
virtual void initialise() final;
|
||||
virtual void initialise() noexcept final;
|
||||
|
||||
protected:
|
||||
EightBit::MemoryMapping mapping(uint16_t address) final;
|
||||
const EightBit::MemoryMapping& mapping(uint16_t address) noexcept final;
|
||||
|
||||
private:
|
||||
const Configuration& m_configuration;
|
||||
@@ -35,6 +35,11 @@ private:
|
||||
EightBit::Ram m_io = 0x2000; // A000 - BFFF, 8K serial interface, minimally decoded
|
||||
EightBit::Rom m_rom = 0x4000; // C000 - FFFF, 16K ROM
|
||||
|
||||
EightBit::MemoryMapping m_ramMapping = { m_ram, 0x0000, EightBit::Chip::Mask16, EightBit::MemoryMapping::AccessLevel::ReadWrite };
|
||||
EightBit::MemoryMapping m_unused2000Mapping = { m_unused2000, 0x8000, EightBit::Chip::Mask16, EightBit::MemoryMapping::AccessLevel::ReadOnly };
|
||||
EightBit::MemoryMapping m_ioMapping = { m_io, 0xa000, EightBit::Chip::Mask16, EightBit::MemoryMapping::AccessLevel::ReadWrite };
|
||||
EightBit::MemoryMapping m_romMapping = { m_rom, 0xc000, EightBit::Chip::Mask16, EightBit::MemoryMapping::AccessLevel::ReadOnly };
|
||||
|
||||
EightBit::mc6850 m_acia;
|
||||
|
||||
EightBit::mc6809 m_cpu = *this;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
Board::Board() {}
|
||||
|
||||
void Board::raisePOWER() {
|
||||
void Board::raisePOWER() noexcept {
|
||||
EightBit::Bus::raisePOWER();
|
||||
|
||||
CPU().raisePOWER();
|
||||
@@ -16,12 +16,12 @@ void Board::raisePOWER() {
|
||||
CPU().raiseHALT();
|
||||
}
|
||||
|
||||
void Board::lowerPOWER() {
|
||||
void Board::lowerPOWER() noexcept {
|
||||
CPU().lowerPOWER();
|
||||
EightBit::Bus::lowerPOWER();
|
||||
}
|
||||
|
||||
void Board::initialise() {
|
||||
void Board::initialise() noexcept {
|
||||
CPU().ExecutingInstruction.connect([this](EightBit::mc6809& cpu) {
|
||||
m_disassembleAt = CPU().PC();
|
||||
m_ignoreDisassembly = m_disassembler.ignore();
|
||||
@@ -33,6 +33,6 @@ void Board::initialise() {
|
||||
});
|
||||
}
|
||||
|
||||
EightBit::MemoryMapping Board::mapping(uint16_t) {
|
||||
return { m_ram, 0x0000, 0xffff, EightBit::MemoryMapping::AccessLevel::ReadWrite };
|
||||
const EightBit::MemoryMapping& Board::mapping(uint16_t) noexcept {
|
||||
return m_mapping;
|
||||
}
|
||||
@@ -11,16 +11,17 @@ public:
|
||||
|
||||
constexpr EightBit::mc6809& CPU() { return m_cpu; }
|
||||
|
||||
void raisePOWER() final;
|
||||
void lowerPOWER() final;
|
||||
void raisePOWER() noexcept final;
|
||||
void lowerPOWER() noexcept final;
|
||||
|
||||
protected:
|
||||
void initialise() final;
|
||||
void initialise() noexcept final;
|
||||
|
||||
EightBit::MemoryMapping mapping(uint16_t address) final;
|
||||
const EightBit::MemoryMapping& mapping(uint16_t address) noexcept final;
|
||||
|
||||
private:
|
||||
EightBit::Ram m_ram = 0x10000; // 0000 - FFFF, 64K RAM
|
||||
EightBit::MemoryMapping m_mapping = { m_ram, 0x0000, 0xffff, EightBit::MemoryMapping::AccessLevel::ReadWrite };
|
||||
EightBit::mc6809 m_cpu = { *this };
|
||||
EightBit::Disassembly m_disassembler = { *this, m_cpu };
|
||||
|
||||
|
||||
+1145
-913
File diff suppressed because it is too large.
Load diff
Binary file not shown.
Binary file not shown.
@@ -66,19 +66,19 @@
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\MC6850\inc;$(SolutionDir)modules\catch2\single_include\catch2;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\MC6850\inc;C:\Libraries\boost_1_88_0;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\MC6850\inc;$(SolutionDir)modules\catch2\single_include\catch2;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\MC6850\inc;C:\Libraries\boost_1_88_0;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\MC6850\inc;$(SolutionDir)modules\catch2\single_include\catch2;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\MC6850\inc;C:\Libraries\boost_1_88_0;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\MC6850\inc;$(SolutionDir)modules\catch2\single_include\catch2;$(IncludePath)</IncludePath>
|
||||
<IncludePath>..\inc;..\..\inc;..\..\MC6850\inc;C:\Libraries\boost_1_88_0;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
|
||||
Reference in new issue
Block a user