mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-01-21 21:30:31 +00:00
Add more of the MC6850 internals.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
b3faa0bb2e
commit
d77c2a1e9d
@ -33,6 +33,10 @@ void Board::initialise() {
|
||||
CPU().reset();
|
||||
|
||||
ACIA().powerOn();
|
||||
ACIA().RW() = EightBit::Chip::PinLevel::Low; // Write
|
||||
ACIA().RS() = EightBit::Chip::PinLevel::Low; // Registers
|
||||
EightBit::Processor::setFlag(ACIA().DATA(), EightBit::mc6850::CR0 | EightBit::mc6850::CR1);
|
||||
ACIA().step(1); // Get the reset out of the way...
|
||||
}
|
||||
|
||||
void Board::Cpu_ExecutingInstruction_Debug(EightBit::mc6809&) {
|
||||
@ -66,16 +70,15 @@ EightBit::MemoryMapping Board::mapping(uint16_t address) {
|
||||
}
|
||||
|
||||
void Board::Bus_WritingByte_Acia(EightBit::EventArgs&) {
|
||||
ACIA().RW() = EightBit::Chip::Low;
|
||||
updateAciaPins();
|
||||
updateAciaPins(EightBit::Chip::Low);
|
||||
}
|
||||
|
||||
void Board::Bus_ReadingByte_Acia(EightBit::EventArgs&) {
|
||||
ACIA().RW() = EightBit::Chip::High;
|
||||
updateAciaPins();
|
||||
updateAciaPins(EightBit::Chip::High);
|
||||
}
|
||||
|
||||
void Board::updateAciaPins() {
|
||||
void Board::updateAciaPins(const EightBit::Chip::PinLevel rw) {
|
||||
ACIA().RW() = rw;
|
||||
ACIA().DATA() = DATA();
|
||||
ACIA().RS() = ADDRESS().word & EightBit::Chip::Bit0 ? EightBit::Chip::PinLevel::High : EightBit::Chip::PinLevel::Low;
|
||||
ACIA().CS0() = ADDRESS().word & EightBit::Chip::Bit15 ? EightBit::Chip::PinLevel::High : EightBit::Chip::PinLevel::Low;
|
||||
|
@ -48,8 +48,8 @@ private:
|
||||
|
||||
void pollKeyboard();
|
||||
|
||||
void Cpu_ExecutingInstruction_Debug(EightBit::mc6809& cpu);
|
||||
void Cpu_ExecutedInstruction_Debug(EightBit::mc6809& cpu);
|
||||
void Cpu_ExecutingInstruction_Debug(EightBit::mc6809&);
|
||||
void Cpu_ExecutedInstruction_Debug(EightBit::mc6809&);
|
||||
|
||||
void Cpu_ExecutedInstruction_die(EightBit::mc6809&);
|
||||
|
||||
@ -60,5 +60,5 @@ private:
|
||||
|
||||
void Cpu_ExecutedInstruction_Acia(EightBit::mc6809&);
|
||||
|
||||
void updateAciaPins();
|
||||
void updateAciaPins(EightBit::Chip::PinLevel rw);
|
||||
};
|
||||
|
@ -11,7 +11,7 @@ int main(int argc, char* argv[]) {
|
||||
Configuration configuration;
|
||||
|
||||
#ifdef _DEBUG
|
||||
//configuration.setDebugMode(true);
|
||||
configuration.setDebugMode(true);
|
||||
#endif
|
||||
//configuration.setDebugMode(true);
|
||||
|
||||
|
@ -94,13 +94,25 @@ namespace EightBit {
|
||||
|
||||
void step(int cycles);
|
||||
|
||||
// External access to RDR
|
||||
void fillRDR(uint8_t data);
|
||||
|
||||
private:
|
||||
uint8_t& TDR() { return m_TDR; } // Transmit data register;
|
||||
uint8_t& RDR() { return m_RDR; } // Receive data register;
|
||||
|
||||
uint8_t& status() { return m_status; }
|
||||
|
||||
bool selected();
|
||||
|
||||
void reset();
|
||||
|
||||
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
|
||||
|
||||
PinLevel m_RXDATA;
|
||||
PinLevel m_TXDATA;
|
||||
|
||||
@ -130,6 +142,12 @@ namespace EightBit {
|
||||
int m_receiveControl;
|
||||
|
||||
// Status registers
|
||||
bool m_RDRF;
|
||||
uint8_t m_status;
|
||||
|
||||
// Data registers
|
||||
uint8_t m_TDR;
|
||||
uint8_t m_RDR;
|
||||
|
||||
bool m_firstMasterReset = false;
|
||||
};
|
||||
}
|
||||
|
Binary file not shown.
@ -11,6 +11,17 @@
|
||||
namespace EightBit {
|
||||
class Processor : public Chip {
|
||||
public:
|
||||
static void clearFlag(uint8_t& f, const int flag) { f &= ~flag; }
|
||||
static void setFlag(uint8_t& f, const int flag) { f |= flag; }
|
||||
|
||||
static void setFlag(uint8_t& f, const int flag, const int condition) { setFlag(f, flag, !!condition); }
|
||||
static void setFlag(uint8_t& f, const int flag, const uint32_t condition) { setFlag(f, flag, !!condition); }
|
||||
static void setFlag(uint8_t& f, const int flag, const bool condition) { condition ? setFlag(f, flag) : clearFlag(f, flag); }
|
||||
|
||||
static void clearFlag(uint8_t& f, const int flag, const int condition) { clearFlag(f, flag, !!condition); }
|
||||
static void clearFlag(uint8_t& f, const int flag, const uint32_t condition) { clearFlag(f, flag, !!condition); }
|
||||
static void clearFlag(uint8_t& f, const int flag, const bool condition) { setFlag(f, flag, !condition); }
|
||||
|
||||
// b: number of bits representing the number in x
|
||||
// x: sign extend this b-bit number to r
|
||||
static int8_t signExtend(int b, uint8_t x);
|
||||
@ -36,17 +47,6 @@ namespace EightBit {
|
||||
virtual register16_t peekWord(register16_t address) = 0;
|
||||
|
||||
protected:
|
||||
static void clearFlag(uint8_t& f, const int flag) { f &= ~flag; }
|
||||
static void setFlag(uint8_t& f, const int flag) { f |= flag; }
|
||||
|
||||
static void setFlag(uint8_t& f, const int flag, const int condition) { setFlag(f, flag, !!condition); }
|
||||
static void setFlag(uint8_t& f, const int flag, const uint32_t condition) { setFlag(f, flag, !!condition); }
|
||||
static void setFlag(uint8_t& f, const int flag, const bool condition) { condition ? setFlag(f, flag) : clearFlag(f, flag); }
|
||||
|
||||
static void clearFlag(uint8_t& f, const int flag, const int condition) { clearFlag(f, flag, !!condition); }
|
||||
static void clearFlag(uint8_t& f, const int flag, const uint32_t condition) { clearFlag(f, flag, !!condition); }
|
||||
static void clearFlag(uint8_t& f, const int flag, const bool condition) { setFlag(f, flag, !condition); }
|
||||
|
||||
Processor(Bus& memory);
|
||||
virtual ~Processor() = default;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user