m6805: put hd63705 functions in hd63705z0_device class instead of base class

This commit is contained in:
hap 2024-11-17 21:29:00 +01:00
parent ce44d4bf34
commit a58b0daae5
2 changed files with 23 additions and 27 deletions

View File

@ -395,7 +395,7 @@ void m6805_base_device::device_reset()
m_nmi_state = 0; m_nmi_state = 0;
/* IRQ disabled */ // IRQ disabled
SEI; SEI;
if (m_params.m_addr_width > 14) if (m_params.m_addr_width > 14)
@ -456,12 +456,12 @@ void m6805_base_device::interrupt_vector()
rm16<false>(0xfffa & m_params.m_vector_mask, m_pc); rm16<false>(0xfffa & m_params.m_vector_mask, m_pc);
} }
/* Generate interrupts */ // Generate interrupts
void m6805_base_device::interrupt() void m6805_base_device::interrupt()
{ {
/* the 6805 latches interrupt requests internally, so we don't clear */ // the 6805 latches interrupt requests internally, so we don't clear
/* pending_interrupts until the interrupt is taken, no matter what the */ // pending_interrupts until the interrupt is taken, no matter what the
/* external IRQ pin does. */ // external IRQ pin does.
if (BIT(m_pending_interrupts, HD63705_INT_NMI)) if (BIT(m_pending_interrupts, HD63705_INT_NMI))
{ {
@ -479,7 +479,7 @@ void m6805_base_device::interrupt()
pushbyte<false>(m_cc); pushbyte<false>(m_cc);
} }
SEI; SEI;
/* no vectors supported, just do the callback to clear irq_state if needed */ // no vectors supported, just do the callback to clear irq_state if needed
standard_irq_callback(0, m_pc.w.l); standard_irq_callback(0, m_pc.w.l);
if (m_params.m_addr_width > 14) if (m_params.m_addr_width > 14)
@ -495,7 +495,7 @@ void m6805_base_device::interrupt()
{ {
if ((CC & IFLAG) == 0) if ((CC & IFLAG) == 0)
{ {
/* standard IRQ */ // standard IRQ
if (m_params.m_addr_width > 14) { if (m_params.m_addr_width > 14) {
pushword<true>(m_pc); pushword<true>(m_pc);
pushbyte<true>(m_x); pushbyte<true>(m_x);
@ -510,7 +510,8 @@ void m6805_base_device::interrupt()
pushbyte<false>(m_cc); pushbyte<false>(m_cc);
} }
SEI; SEI;
/* no vectors supported, just do the callback to clear irq_state if needed */
// no vectors supported, just do the callback to clear irq_state if needed
standard_irq_callback(0, m_pc.w.l); standard_irq_callback(0, m_pc.w.l);
interrupt_vector(); interrupt_vector();
@ -581,10 +582,10 @@ uint32_t m6805_base_device::execute_max_cycles() const noexcept
} }
/* execute instructions on this CPU until icount expires */ // execute instructions on this CPU until icount expires
void m6805_base_device::execute_run() void m6805_base_device::execute_run()
{ {
S = SP_ADJUST( S ); /* Taken from CPU_SET_CONTEXT when pointer'afying */ S = SP_ADJUST( S ); // Taken from CPU_SET_CONTEXT when pointer'ifying
do do
{ {
@ -621,6 +622,7 @@ void m6805_base_device::execute_set_input(int inputnum, int state)
/**************************************************************************** /****************************************************************************
* M68HC05EG section * M68HC05EG section
****************************************************************************/ ****************************************************************************/
m68hc05eg_device::m68hc05eg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) m68hc05eg_device::m68hc05eg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: m6805_base_device( : m6805_base_device(
mconfig, mconfig,
@ -674,8 +676,9 @@ std::unique_ptr<util::disasm_interface> m68hc05eg_device::create_disassembler()
} }
/**************************************************************************** /****************************************************************************
* HD63705 section * HD6305 section
****************************************************************************/ ****************************************************************************/
hd6305_device::hd6305_device( hd6305_device::hd6305_device(
machine_config const &mconfig, machine_config const &mconfig,
char const *tag, char const *tag,
@ -701,7 +704,6 @@ hd6305v0_device::hd6305v0_device(const machine_config &mconfig, const char *tag,
m_write_port(*this), m_write_port(*this),
m_sci_clk(*this), m_sci_clk(*this),
m_sci_tx(*this) m_sci_tx(*this)
{ {
} }
@ -1086,12 +1088,7 @@ void hd63705z0_device::internal_map(address_map &map)
map(0x01c0, 0x1fff).rom().region(DEVICE_SELF, 0x01c0); map(0x01c0, 0x1fff).rom().region(DEVICE_SELF, 0x01c0);
} }
void hd6305_device::device_reset() void hd63705z0_device::execute_set_input(int inputnum, int state)
{
m6805_base_device::device_reset();
}
void hd6305_device::execute_set_input(int inputnum, int state)
{ {
if (inputnum == INPUT_LINE_NMI) if (inputnum == INPUT_LINE_NMI)
{ {
@ -1119,10 +1116,10 @@ void hd6305_device::execute_set_input(int inputnum, int state)
} }
} }
void hd6305_device::interrupt_vector() void hd63705z0_device::interrupt_vector()
{ {
/* Need to add emulation of other interrupt sources here KW-2/4/99 */ // Need to add emulation of other interrupt sources here KW-2/4/99
/* This is just a quick patch for Namco System 2 operation */ // This is just a quick patch for Namco System 2 operation
if ((m_pending_interrupts & (1 << HD63705_INT_IRQ1)) != 0) if ((m_pending_interrupts & (1 << HD63705_INT_IRQ1)) != 0)
{ {

View File

@ -342,13 +342,8 @@ protected:
configuration_params const &params, configuration_params const &params,
address_map_constructor internal_map); address_map_constructor internal_map);
// device-level overrides
virtual void device_reset() override ATTR_COLD;
virtual void execute_set_input(int inputnum, int state) override;
virtual bool execute_input_edge_triggered(int inputnum) const noexcept override { return inputnum == INPUT_LINE_NMI; } virtual bool execute_input_edge_triggered(int inputnum) const noexcept override { return inputnum == INPUT_LINE_NMI; }
virtual void interrupt_vector() override;
virtual bool test_il() override { return m_nmi_state != CLEAR_LINE; } virtual bool test_il() override { return m_nmi_state != CLEAR_LINE; }
}; };
@ -454,6 +449,10 @@ public:
// construction/destruction // construction/destruction
hd63705z0_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); hd63705z0_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
virtual void execute_set_input(int inputnum, int state) override;
virtual void interrupt_vector() override;
private: private:
void internal_map(address_map &map) ATTR_COLD; void internal_map(address_map &map) ATTR_COLD;
}; };