mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-01-21 21:30:31 +00:00
Tidied up pin management to be synchronised with the .Net code.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
e1f22f6903
commit
254cfbe342
@ -29,7 +29,6 @@ void EightBit::Intel8080::handleRESET() {
|
||||
tick(3);
|
||||
}
|
||||
|
||||
|
||||
void EightBit::Intel8080::handleINT() {
|
||||
IntelProcessor::handleINT();
|
||||
raiseHALT();
|
||||
|
@ -33,7 +33,6 @@ namespace EightBit {
|
||||
|
||||
int execute() final;
|
||||
int step() final;
|
||||
void raisePOWER() final;
|
||||
|
||||
auto& X() { return x; }
|
||||
auto& Y() { return y; }
|
||||
|
@ -2,23 +2,22 @@
|
||||
#include "mos6502.h"
|
||||
|
||||
EightBit::MOS6502::MOS6502(Bus& bus)
|
||||
: LittleEndianProcessor(bus) {}
|
||||
: LittleEndianProcessor(bus) {
|
||||
RaisedPOWER.connect([this](EventArgs) {
|
||||
X() = Bit7;
|
||||
Y() = 0;
|
||||
A() = 0;
|
||||
P() = RF;
|
||||
S() = Mask8;
|
||||
lowerSYNC();
|
||||
});
|
||||
}
|
||||
|
||||
DEFINE_PIN_LEVEL_CHANGERS(NMI, MOS6502);
|
||||
DEFINE_PIN_LEVEL_CHANGERS(SO, MOS6502);
|
||||
DEFINE_PIN_LEVEL_CHANGERS(SYNC, MOS6502);
|
||||
DEFINE_PIN_LEVEL_CHANGERS(RDY, MOS6502);
|
||||
|
||||
void EightBit::MOS6502::raisePOWER() {
|
||||
LittleEndianProcessor::raisePOWER();
|
||||
X() = Bit7;
|
||||
Y() = 0;
|
||||
A() = 0;
|
||||
P() = RF;
|
||||
S() = Mask8;
|
||||
lowerSYNC();
|
||||
}
|
||||
|
||||
int EightBit::MOS6502::step() {
|
||||
resetCycles();
|
||||
ExecutingInstruction.fire(*this);
|
||||
|
@ -60,8 +60,6 @@ namespace EightBit {
|
||||
virtual int execute() final;
|
||||
virtual int step() final;
|
||||
|
||||
virtual void raisePOWER() final;
|
||||
|
||||
auto& D() { return m_d; }
|
||||
auto& A() { return D().high; }
|
||||
auto& B() { return D().low; }
|
||||
|
@ -5,7 +5,12 @@
|
||||
#include <cassert>
|
||||
|
||||
EightBit::mc6809::mc6809(Bus& bus)
|
||||
: BigEndianProcessor(bus) {}
|
||||
: BigEndianProcessor(bus) {
|
||||
RaisedPOWER.connect([this](EventArgs) {
|
||||
lowerBA();
|
||||
lowerBS();
|
||||
});
|
||||
}
|
||||
|
||||
DEFINE_PIN_LEVEL_CHANGERS(NMI, mc6809);
|
||||
DEFINE_PIN_LEVEL_CHANGERS(FIRQ, mc6809);
|
||||
@ -13,12 +18,6 @@ DEFINE_PIN_LEVEL_CHANGERS(HALT, mc6809);
|
||||
DEFINE_PIN_LEVEL_CHANGERS(BA, mc6809);
|
||||
DEFINE_PIN_LEVEL_CHANGERS(BS, mc6809);
|
||||
|
||||
void EightBit::mc6809::raisePOWER() {
|
||||
BigEndianProcessor::raisePOWER();
|
||||
lowerBA();
|
||||
lowerBS();
|
||||
}
|
||||
|
||||
int EightBit::mc6809::step() {
|
||||
resetCycles();
|
||||
ExecutingInstruction.fire(*this);
|
||||
|
@ -10,8 +10,6 @@ namespace EightBit {
|
||||
public:
|
||||
mc6850();
|
||||
|
||||
void raisePOWER() final;
|
||||
|
||||
// +--------+----------------------------------------------------------------------------------+
|
||||
// | | Buffer address |
|
||||
// | +------------------+------------------+--------------------+-----------------------+
|
||||
|
Binary file not shown.
@ -56,8 +56,6 @@ namespace EightBit {
|
||||
int execute() final;
|
||||
int step() final;
|
||||
|
||||
void raisePOWER() final;
|
||||
|
||||
[[nodiscard]] register16_t& AF() final;
|
||||
[[nodiscard]] register16_t& BC() final;
|
||||
[[nodiscard]] register16_t& DE() final;
|
||||
|
@ -6,6 +6,22 @@
|
||||
EightBit::Z80::Z80(Bus& bus, InputOutput& ports)
|
||||
: IntelProcessor(bus),
|
||||
m_ports(ports) {
|
||||
RaisedPOWER.connect([this](EventArgs) {
|
||||
raiseM1();
|
||||
|
||||
di();
|
||||
IM() = 0;
|
||||
|
||||
REFRESH() = 0;
|
||||
IV() = Mask8;
|
||||
|
||||
AF() = IX() = IY() = BC() = DE() = HL() = Mask16;
|
||||
|
||||
exxAF();
|
||||
exx();
|
||||
|
||||
m_prefixCB = m_prefixDD = m_prefixED = m_prefixFD = false;
|
||||
});
|
||||
}
|
||||
|
||||
DEFINE_PIN_LEVEL_CHANGERS(NMI, Z80);
|
||||
@ -27,27 +43,6 @@ EightBit::register16_t& EightBit::Z80::HL() {
|
||||
return m_registers[m_registerSet][HL_IDX];
|
||||
}
|
||||
|
||||
void EightBit::Z80::raisePOWER() {
|
||||
|
||||
IntelProcessor::raisePOWER();
|
||||
|
||||
raiseM1();
|
||||
|
||||
di();
|
||||
IM() = 0;
|
||||
|
||||
REFRESH() = 0;
|
||||
IV() = Mask8;
|
||||
|
||||
exxAF();
|
||||
AF() = Mask16;
|
||||
|
||||
exx();
|
||||
IX() = IY() = BC() = DE() = HL() = Mask16;
|
||||
|
||||
m_prefixCB = m_prefixDD = m_prefixED = m_prefixFD = false;
|
||||
}
|
||||
|
||||
void EightBit::Z80::handleRESET() {
|
||||
IntelProcessor::handleRESET();
|
||||
di();
|
||||
|
16
inc/Device.h
16
inc/Device.h
@ -21,16 +21,20 @@
|
||||
|
||||
#define DEFINE_PIN_LEVEL_RAISE(name, within) \
|
||||
void EightBit:: within ::raise ## name() { \
|
||||
Raising ## name.fire(EventArgs::empty()); \
|
||||
raise( name ()); \
|
||||
Raised ## name.fire(EventArgs::empty()); \
|
||||
if (lowered( name ())) { \
|
||||
Raising ## name.fire(EventArgs::empty()); \
|
||||
raise( name ()); \
|
||||
Raised ## name.fire(EventArgs::empty()); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DEFINE_PIN_LEVEL_LOWER(name, within) \
|
||||
void EightBit:: within ::lower ## name() { \
|
||||
Lowering ## name.fire(EventArgs::empty()); \
|
||||
lower( name ()); \
|
||||
Lowered ## name.fire(EventArgs::empty()); \
|
||||
if (raised( name ())) { \
|
||||
Lowering ## name.fire(EventArgs::empty()); \
|
||||
lower( name ()); \
|
||||
Lowered ## name.fire(EventArgs::empty()); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DEFINE_PIN_LEVEL_CHANGERS(name, within) \
|
||||
|
@ -58,8 +58,6 @@ namespace EightBit {
|
||||
[[nodiscard]] auto& H() { return HL().high; }
|
||||
[[nodiscard]] auto& L() { return HL().low; }
|
||||
|
||||
void raisePOWER() override;
|
||||
|
||||
DECLARE_PIN_INPUT(HALT)
|
||||
|
||||
protected:
|
||||
|
@ -5,16 +5,18 @@ EightBit::IntelProcessor::IntelProcessor(Bus& bus)
|
||||
: LittleEndianProcessor(bus) {
|
||||
for (int i = 0; i < 0x100; ++i)
|
||||
m_decodedOpcodes[i] = i;
|
||||
|
||||
LoweredHALT.connect([this](EventArgs) { --PC(); });
|
||||
RaisedHALT.connect([this](EventArgs) { ++PC(); });
|
||||
|
||||
RaisedPOWER.connect([this](EventArgs) {
|
||||
raiseHALT();
|
||||
SP() = AF() = BC() = DE() = HL() = Mask16;
|
||||
});
|
||||
}
|
||||
|
||||
DEFINE_PIN_LEVEL_CHANGERS(HALT, IntelProcessor);
|
||||
|
||||
void EightBit::IntelProcessor::raisePOWER() {
|
||||
Processor::raisePOWER();
|
||||
raiseHALT();
|
||||
SP() = AF() = BC() = DE() = HL() = Mask16;
|
||||
}
|
||||
|
||||
void EightBit::IntelProcessor::handleRESET() {
|
||||
Processor::handleRESET();
|
||||
PC() = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user