hd63705: Split into specific types; move on-chip memory into internal maps

This commit is contained in:
AJR 2023-08-15 08:40:10 -04:00
parent 6b11d2df68
commit 8893ab423e
8 changed files with 173 additions and 42 deletions

View File

@ -341,7 +341,7 @@ m6805_base_device::m6805_base_device(
void m6805_base_device::device_start()
{
if (m_params.m_addr_width > 13) {
if (m_params.m_addr_width > 14) {
space(AS_PROGRAM).cache(m_cprogram16);
space(AS_PROGRAM).specific(m_program16);
} else {
@ -398,7 +398,7 @@ void m6805_base_device::device_reset()
/* IRQ disabled */
SEI;
if (m_params.m_addr_width > 13)
if (m_params.m_addr_width > 14)
rm16<true>(0xfffe & m_params.m_vector_mask, m_pc);
else
rm16<false>(0xfffe & m_params.m_vector_mask, m_pc);
@ -450,7 +450,7 @@ bool m6805_base_device::test_il()
void m6805_base_device::interrupt_vector()
{
if (m_params.m_addr_width > 13)
if (m_params.m_addr_width > 14)
rm16<true>(0xfffa & m_params.m_vector_mask, m_pc);
else
rm16<false>(0xfffa & m_params.m_vector_mask, m_pc);
@ -465,7 +465,7 @@ void m6805_base_device::interrupt()
if (BIT(m_pending_interrupts, HD63705_INT_NMI))
{
if (m_params.m_addr_width > 13) {
if (m_params.m_addr_width > 14) {
pushword<true>(m_pc);
pushbyte<true>(m_x);
pushbyte<true>(m_a);
@ -482,7 +482,7 @@ void m6805_base_device::interrupt()
/* no vectors supported, just do the callback to clear irq_state if needed */
standard_irq_callback(0, m_pc.w.l);
if (m_params.m_addr_width > 13)
if (m_params.m_addr_width > 14)
rm16<true>(0x1ffc, m_pc);
else
rm16<false>(0x1ffc, m_pc);
@ -496,7 +496,7 @@ void m6805_base_device::interrupt()
if ((CC & IFLAG) == 0)
{
/* standard IRQ */
if (m_params.m_addr_width > 13) {
if (m_params.m_addr_width > 14) {
pushword<true>(m_pc);
pushbyte<true>(m_x);
pushbyte<true>(m_a);
@ -606,7 +606,7 @@ void m6805_base_device::execute_run()
debugger_instruction_hook(PC);
u8 const ireg = m_params.m_addr_width > 13 ? rdop<true>(PC++) : rdop<false>(PC++);
u8 const ireg = m_params.m_addr_width > 14 ? rdop<true>(PC++) : rdop<false>(PC++);
(this->*m_params.m_ops[ireg])();
m_icount -= m_params.m_cycles[ireg];
@ -687,26 +687,87 @@ std::unique_ptr<util::disasm_interface> m68hc05eg_device::create_disassembler()
/****************************************************************************
* HD63705 section
****************************************************************************/
hd63705_device::hd63705_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: m6805_base_device(mconfig,
tag,
owner,
clock,
HD63705,
{ s_hmos_b_ops, s_hmos_cycles, 16, 0x017f, 0x0100, 0x1ffa })
hd6305_device::hd6305_device(
machine_config const &mconfig,
char const *tag,
device_t *owner,
uint32_t clock,
device_type const type,
configuration_params const &params,
address_map_constructor internal_map)
: m6805_base_device(mconfig, tag, owner, clock, type, params, internal_map)
{
}
void hd63705_device::device_reset()
hd6305v0_device::hd6305v0_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: hd6305_device(
mconfig,
tag,
owner,
clock,
HD6305V0,
{ s_hmos_s_ops, s_hmos_cycles, 14, 0x00ff, 0x00c0, 0x1ffc },
address_map_constructor(FUNC(hd6305v0_device::internal_map), this))
{
}
void hd6305v0_device::internal_map(address_map &map)
{
// TODO: ports, timer, SCI
map(0x0040, 0x00ff).ram();
map(0x1000, 0x1fff).rom().region(DEVICE_SELF, 0);
}
hd6305y2_device::hd6305y2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: hd6305_device(
mconfig,
tag,
owner,
clock,
HD6305Y2,
{ s_hmos_s_ops, s_hmos_cycles, 14, 0x00ff, 0x00c0, 0x1ffc },
address_map_constructor(FUNC(hd6305y2_device::internal_map), this))
{
}
void hd6305y2_device::internal_map(address_map &map)
{
// TODO: ports, timer, SCI
map(0x0040, 0x013f).ram();
}
hd63705z0_device::hd63705z0_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: hd6305_device(
mconfig,
tag,
owner,
clock,
HD63705Z0,
{ s_hmos_b_ops, s_hmos_cycles, 16, 0x017f, 0x0100, 0x1ffa },
address_map_constructor(FUNC(hd63705z0_device::internal_map), this))
{
}
void hd63705z0_device::internal_map(address_map &map)
{
// TODO: ports, timer, SCI
map(0x0040, 0x01bf).ram();
map(0x01c0, 0x1fff).rom().region(DEVICE_SELF, 0x01c0);
}
void hd6305_device::device_reset()
{
m6805_base_device::device_reset();
m_s.w.l = SP_MASK;
rm16<true>(0x1ffe, m_pc);
if (m_params.m_addr_width > 14)
rm16<true>(0x1ffe, m_pc);
else
rm16<false>(0x1ffe, m_pc);
}
void hd63705_device::execute_set_input(int inputnum, int state)
void hd6305_device::execute_set_input(int inputnum, int state)
{
if (inputnum == INPUT_LINE_NMI)
{
@ -734,7 +795,7 @@ void hd63705_device::execute_set_input(int inputnum, int state)
}
}
void hd63705_device::interrupt_vector()
void hd6305_device::interrupt_vector()
{
/* Need to add emulation of other interrupt sources here KW-2/4/99 */
/* This is just a quick patch for Namco System 2 operation */
@ -742,45 +803,71 @@ void hd63705_device::interrupt_vector()
if ((m_pending_interrupts & (1 << HD63705_INT_IRQ1)) != 0)
{
m_pending_interrupts &= ~(1 << HD63705_INT_IRQ1);
rm16<true>(0x1ff8, m_pc);
if (m_params.m_addr_width > 14)
rm16<true>(0x1ff8, m_pc);
else
rm16<false>(0x1ff8, m_pc);
}
else if ((m_pending_interrupts & (1 << HD63705_INT_IRQ2)) != 0)
{
m_pending_interrupts &= ~(1 << HD63705_INT_IRQ2);
rm16<true>(0x1fec, m_pc);
if (m_params.m_addr_width > 14)
rm16<true>(0x1fec, m_pc);
else
rm16<false>(0x1fec, m_pc);
}
else if ((m_pending_interrupts & (1 << HD63705_INT_ADCONV)) != 0)
{
m_pending_interrupts &= ~(1 << HD63705_INT_ADCONV);
rm16<true>(0x1fea, m_pc);
if (m_params.m_addr_width > 14)
rm16<true>(0x1fea, m_pc);
else
rm16<false>(0x1fea, m_pc);
}
else if ((m_pending_interrupts & (1 << HD63705_INT_TIMER1)) != 0)
{
m_pending_interrupts &= ~(1 << HD63705_INT_TIMER1);
rm16<true>(0x1ff6, m_pc);
if (m_params.m_addr_width > 14)
rm16<true>(0x1ff6, m_pc);
else
rm16<false>(0x1ff6, m_pc);
}
else if ((m_pending_interrupts & (1 << HD63705_INT_TIMER2)) != 0)
{
m_pending_interrupts &= ~(1 << HD63705_INT_TIMER2);
rm16<true>(0x1ff4, m_pc);
if (m_params.m_addr_width > 14)
rm16<true>(0x1ff4, m_pc);
else
rm16<false>(0x1ff4, m_pc);
}
else if ((m_pending_interrupts & (1 << HD63705_INT_TIMER3)) != 0)
{
m_pending_interrupts &= ~(1<<HD63705_INT_TIMER3);
rm16<true>(0x1ff2, m_pc);
if (m_params.m_addr_width > 14)
rm16<true>(0x1ff2, m_pc);
else
rm16<false>(0x1ff2, m_pc);
}
else if ((m_pending_interrupts & (1 << HD63705_INT_PCI)) != 0)
{
m_pending_interrupts &= ~(1 << HD63705_INT_PCI);
rm16<true>(0x1ff0, m_pc);
if (m_params.m_addr_width > 14)
rm16<true>(0x1ff0, m_pc);
else
rm16<false>(0x1ff0, m_pc);
}
else if ((m_pending_interrupts & (1 << HD63705_INT_SCI)) != 0)
{
m_pending_interrupts &= ~(1 << HD63705_INT_SCI);
rm16<true>(0x1fee, m_pc);
if (m_params.m_addr_width > 14)
rm16<true>(0x1fee, m_pc);
else
rm16<false>(0x1fee, m_pc);
}
}
DEFINE_DEVICE_TYPE(M68HC05EG, m68hc05eg_device, "m68hc05eg", "Motorola MC68HC05EG")
DEFINE_DEVICE_TYPE(HD63705, hd63705_device, "hd63705", "Hitachi HD63705")
DEFINE_DEVICE_TYPE(HD6305V0, hd6305v0_device, "hd6305v0", "Hitachi HD6305V0")
DEFINE_DEVICE_TYPE(HD6305Y2, hd6305y2_device, "hd6305y2", "Hitachi HD6305Y2")
DEFINE_DEVICE_TYPE(HD63705Z0, hd63705z0_device, "hd63705z0", "Hitachi HD63705Z0")

View File

@ -13,7 +13,9 @@
// device type definition
DECLARE_DEVICE_TYPE(M68HC05EG, m68hc05eg_device)
DECLARE_DEVICE_TYPE(HD63705, hd63705_device)
DECLARE_DEVICE_TYPE(HD6305V0, hd6305v0_device)
DECLARE_DEVICE_TYPE(HD6305Y2, hd6305y2_device)
DECLARE_DEVICE_TYPE(HD63705Z0, hd63705z0_device)
// ======================> m6805_base_device
@ -326,15 +328,21 @@ protected:
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
};
// ======================> hd63705_device
// ======================> hd6305_device
class hd63705_device : public m6805_base_device
class hd6305_device : public m6805_base_device
{
public:
// construction/destruction
hd63705_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
// construction/destruction
hd6305_device(
machine_config const &mconfig,
char const *tag,
device_t *owner,
uint32_t clock,
device_type const type,
configuration_params const &params,
address_map_constructor internal_map);
// device-level overrides
virtual void device_reset() override;
@ -345,6 +353,42 @@ protected:
virtual bool test_il() override { return m_nmi_state != CLEAR_LINE; }
};
// ======================> hd6305v0_device
class hd6305v0_device : public hd6305_device
{
public:
// construction/destruction
hd6305v0_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
private:
void internal_map(address_map &map);
};
// ======================> hd6305y2_device
class hd6305y2_device : public hd6305_device
{
public:
// construction/destruction
hd6305y2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
private:
void internal_map(address_map &map);
};
// ======================> hd63705z0_device
class hd63705z0_device : public hd6305_device
{
public:
// construction/destruction
hd63705z0_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
private:
void internal_map(address_map &map);
};
#define M6805_IRQ_LINE 0
/****************************************************************************

View File

@ -155,8 +155,8 @@ void namcoc65_device::mcu_map(address_map &map)
map(0x0007, 0x0007).r(FUNC(namcoc65_device::mcuh_r)); /* Usually P1/P2 direction input (R) + Buttons 1,2,3 */
map(0x0010, 0x0010).rw(FUNC(namcoc65_device::namcos2_mcu_analog_ctrl_r), FUNC(namcoc65_device::namcos2_mcu_analog_ctrl_w));
map(0x0011, 0x0011).rw(FUNC(namcoc65_device::namcos2_mcu_analog_port_r), FUNC(namcoc65_device::namcos2_mcu_analog_port_w));
map(0x0040, 0x01bf).ram();
map(0x01c0, 0x1fff).rom(); /* internal ROM */
// map(0x0040, 0x01bf).ram();
// map(0x01c0, 0x1fff).rom(); /* internal ROM */
map(0x2000, 0x2000).r(FUNC(namcoc65_device::mcudsw_r)); /* Dipswitch, including service mode */
map(0x3000, 0x3000).r(FUNC(namcoc65_device::mcudi0_r));
map(0x3001, 0x3001).r(FUNC(namcoc65_device::mcudi1_r));
@ -170,7 +170,7 @@ void namcoc65_device::mcu_map(address_map &map)
void namcoc65_device::device_add_mconfig(machine_config &config)
{
HD63705(config, m_mcu, DERIVED_CLOCK(1, 1));
HD63705Z0(config, m_mcu, DERIVED_CLOCK(1, 1));
m_mcu->set_addrmap(AS_PROGRAM, &namcoc65_device::mcu_map);
}

View File

@ -50,7 +50,7 @@ protected:
virtual void device_reset() override;
private:
required_device<hd63705_device> m_mcu;
required_device<hd63705z0_device> m_mcu;
devcb_read8 m_in_pb_cb;
devcb_read8 m_in_pc_cb;

View File

@ -545,7 +545,7 @@ void psx1_state::psj(machine_config &config)
void psx1_state::psu(machine_config &config)
{
psj(config);
HD63705(config, "subcpu", 4166667).set_addrmap(AS_PROGRAM, &psx1_state::subcpu_map); // MC68HC05G6
HD63705Z0(config, "subcpu", 4166667).set_addrmap(AS_PROGRAM, &psx1_state::subcpu_map); // FIXME: actually MC68HC05G6
}
void psx1_state::pse(machine_config &config)

View File

@ -58,7 +58,7 @@ void an1x_state::an1x(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); // 2x HM628128BLFP-8 + CR2450 battery
HD63705(config, m_pks, 8_MHz_XTAL).set_disable(); // HD63B05V0E65F
HD6305V0(config, m_pks, 8_MHz_XTAL).set_disable(); // HD63B05V0E65F
MULCD(config, "lcd"); // LC7985ND (back-lit)

View File

@ -95,7 +95,7 @@ void psr400_state::psr500(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &psr400_state::program_map);
m_maincpu->set_addrmap(AS_DATA, &psr400_state::data_map);
HD63705(config, m_mpscpu, 8_MHz_XTAL).set_disable(); // HD63B05V0D73P (mislabeled HD63B50 on schematic)
HD6305V0(config, m_mpscpu, 8_MHz_XTAL).set_disable(); // HD63B05V0D73P (mislabeled HD63B50 on schematic)
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();

View File

@ -49,7 +49,7 @@ void yamaha_sy35_state::sy35(machine_config &config)
m_maincpu->set_mode(3); // internal ROM disabled
m_maincpu->set_addrmap(AS_PROGRAM, &yamaha_sy35_state::mem_map);
HD63705(config, m_scancpu, 8_MHz_XTAL).set_disable(); // HD63B05V0C85P
HD6305V0(config, m_scancpu, 8_MHz_XTAL).set_disable(); // HD63B05V0C85P
//TMC3493PH(config, "gew5a", 12.8_MHz_XTAL);
//TMC3493PH(config, "gew5b", 12.8_MHz_XTAL);