mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-23 15:29:24 +00:00
Start adding definition of BA/BS flags.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
1212e8d4f0
commit
ab78ba5db0
@ -73,6 +73,9 @@ namespace EightBit {
|
||||
PinLevel& NMI() { return m_nmiLine; } // In
|
||||
PinLevel& FIRQ() { return m_firqLine; } // In
|
||||
|
||||
PinLevel& BA() { return m_baLine; } // Out
|
||||
PinLevel& BS() { return m_bsLine; } // Out
|
||||
|
||||
protected:
|
||||
virtual void powerOn() final;
|
||||
|
||||
@ -125,6 +128,7 @@ namespace EightBit {
|
||||
|
||||
// Interrupt (etc.) handlers
|
||||
|
||||
void handleHALT();
|
||||
void handleNMI();
|
||||
void handleFIRQ();
|
||||
|
||||
@ -326,6 +330,9 @@ namespace EightBit {
|
||||
PinLevel m_nmiLine = Low;
|
||||
PinLevel m_firqLine = Low;
|
||||
|
||||
PinLevel m_baLine = Low;
|
||||
PinLevel m_bsLine = Low;
|
||||
|
||||
bool m_prefix10 = false;
|
||||
bool m_prefix11 = false;
|
||||
};
|
||||
|
@ -11,6 +11,8 @@ void EightBit::mc6809::powerOn() {
|
||||
Processor::powerOn();
|
||||
raise(NMI());
|
||||
raise(FIRQ());
|
||||
lower(BA());
|
||||
lower(BS());
|
||||
}
|
||||
|
||||
int EightBit::mc6809::step() {
|
||||
@ -18,7 +20,9 @@ int EightBit::mc6809::step() {
|
||||
if (LIKELY(powered())) {
|
||||
m_prefix10 = m_prefix11 = false;
|
||||
ExecutingInstruction.fire(*this);
|
||||
if (UNLIKELY(lowered(RESET())))
|
||||
if (UNLIKELY(lowered(HALT())))
|
||||
handleHALT();
|
||||
else if (UNLIKELY(lowered(RESET())))
|
||||
handleRESET();
|
||||
else if (UNLIKELY(lowered(NMI())))
|
||||
handleNMI();
|
||||
@ -35,9 +39,16 @@ int EightBit::mc6809::step() {
|
||||
|
||||
// Interrupt (etc.) handlers
|
||||
|
||||
void EightBit::mc6809::handleHALT() {
|
||||
raise(BA());
|
||||
raise(BS());
|
||||
}
|
||||
|
||||
void EightBit::mc6809::handleRESET() {
|
||||
Processor::handleRESET();
|
||||
raise(NMI());
|
||||
lower(BA());
|
||||
raise(BS());
|
||||
DP() = 0;
|
||||
setFlag(CC(), IF | FF); // Disable all IRQs
|
||||
jump(getWordPaged(0xff, RESETvector));
|
||||
@ -45,13 +56,18 @@ void EightBit::mc6809::handleRESET() {
|
||||
|
||||
void EightBit::mc6809::handleNMI() {
|
||||
raise(NMI());
|
||||
lower(BA());
|
||||
raise(BS());
|
||||
saveEntireRegisterState();
|
||||
setFlag(CC(), IF | FF); // Disable all IRQs
|
||||
jump(getWordPaged(0xff, NMIvector));
|
||||
addCycles(21);
|
||||
}
|
||||
|
||||
void EightBit::mc6809::handleIRQ() {
|
||||
Processor::handleIRQ();
|
||||
lower(BA());
|
||||
raise(BS());
|
||||
saveEntireRegisterState();
|
||||
setFlag(CC(), IF); // Disable IRQ
|
||||
jump(getWordPaged(0xff, IRQvector));
|
||||
@ -60,6 +76,8 @@ void EightBit::mc6809::handleIRQ() {
|
||||
|
||||
void EightBit::mc6809::handleFIRQ() {
|
||||
raise(FIRQ());
|
||||
lower(BA());
|
||||
raise(BS());
|
||||
clearFlag(CC(), EF);
|
||||
pushWordS(PC());
|
||||
pushS(CC());
|
||||
@ -71,6 +89,8 @@ void EightBit::mc6809::handleFIRQ() {
|
||||
//
|
||||
|
||||
int EightBit::mc6809::execute(uint8_t opcode) {
|
||||
lower(BA());
|
||||
lower(BS());
|
||||
if (UNLIKELY(m_prefix10))
|
||||
execute10(opcode);
|
||||
else if (UNLIKELY(m_prefix11))
|
||||
|
Loading…
Reference in New Issue
Block a user