Incorporate the concepts of transmission and receipt into the events for the MC6850 (TBC)

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2018-09-24 08:29:11 +01:00
parent d77c2a1e9d
commit 9ab075d0f6
4 changed files with 34 additions and 10 deletions

View File

@ -21,12 +21,13 @@ void Board::initialise() {
CPU().ExecutedInstruction.connect(std::bind(&Board::Cpu_ExecutedInstruction_Debug, this, std::placeholders::_1));
}
CPU().ExecutedInstruction.connect(std::bind(&Board::Cpu_ExecutedInstruction_die, this, std::placeholders::_1));
WritingByte.connect(std::bind(&Board::Bus_WritingByte_Acia, this, std::placeholders::_1));
ReadingByte.connect(std::bind(&Board::Bus_ReadingByte_Acia, this, std::placeholders::_1));
CPU().ExecutedInstruction.connect(std::bind(&Board::Cpu_ExecutedInstruction_Acia, this, std::placeholders::_1));
ACIA().Accessing.connect(std::bind(&Board::Acia_Accessing, this, std::placeholders::_1));
ACIA().Accessed.connect(std::bind(&Board::Acia_Accessed, this, std::placeholders::_1));
CPU().powerOn();
CPU().raise(CPU().NMI());
CPU().raise(CPU().FIRQ());
@ -88,4 +89,14 @@ void Board::updateAciaPins(const EightBit::Chip::PinLevel rw) {
void Board::Cpu_ExecutedInstruction_Acia(EightBit::mc6809&) {
ACIA().step(CPU().cycles());
}
}
void Board::Acia_Accessing(EightBit::EventArgs&) {
if (_kbhit()) {
ACIA().DATA() = _getch();
ACIA().fillRDR();
}
}
void Board::Acia_Accessed(EightBit::EventArgs&) {
}

View File

@ -46,7 +46,8 @@ private:
EightBit::register16_t m_disassembleAt = 0x0000;
bool m_ignoreDisassembly = false;
void pollKeyboard();
uint64_t m_pollCounter = 0UL;
uint64_t m_pollInterval = 2000000 / 50;
void Cpu_ExecutingInstruction_Debug(EightBit::mc6809&);
void Cpu_ExecutedInstruction_Debug(EightBit::mc6809&);
@ -60,5 +61,8 @@ private:
void Cpu_ExecutedInstruction_Acia(EightBit::mc6809&);
void Acia_Accessing(EightBit::EventArgs&);
void Acia_Accessed(EightBit::EventArgs&);
void updateAciaPins(EightBit::Chip::PinLevel rw);
};

View File

@ -3,6 +3,7 @@
#include <cstdint>
#include <Chip.h>
#include <Signal.h>
namespace EightBit {
class mc6850 : public Chip {
@ -94,8 +95,17 @@ namespace EightBit {
void step(int cycles);
// External access to RDR
void fillRDR(uint8_t data);
void fillRDR();
void drainTDR();
Signal<EventArgs> Accessing;
Signal<EventArgs> Accessed;
Signal<EventArgs> Transmitting;
Signal<EventArgs> Transmitted;
Signal<EventArgs> Receiving;
Signal<EventArgs> Received;
private:
uint8_t& TDR() { return m_TDR; } // Transmit data register;
@ -109,9 +119,8 @@ namespace EightBit {
void step();
uint8_t drainRDR(); // External (hacked!) access to RDR
void fillTDR(uint8_t data); // External (hacked!) access to TDR
uint8_t drainTDR(); // External (hacked!) access to TDR
void drainRDR();
void fillTDR();
PinLevel m_RXDATA;
PinLevel m_TXDATA;
@ -148,6 +157,6 @@ namespace EightBit {
uint8_t m_TDR;
uint8_t m_RDR;
bool m_firstMasterReset = false;
bool m_powered = false;
};
}

Binary file not shown.