macprtb.cpp: Preliminary MCU configuration

* m5074x: Add preliminary M50753 type; eliminate custom ROM tag
This commit is contained in:
AJR 2020-10-18 19:07:30 -04:00
parent 55f1d2bcb7
commit 1709e60150
4 changed files with 159 additions and 29 deletions

View File

@ -31,6 +31,7 @@
DEFINE_DEVICE_TYPE(M50740, m50740_device, "m50740", "Mitsubishi M50740")
DEFINE_DEVICE_TYPE(M50741, m50741_device, "m50741", "Mitsubishi M50741")
DEFINE_DEVICE_TYPE(M50753, m50753_device, "m50753", "Mitsubishi M50753")
//**************************************************************************
// LIVE DEVICE
@ -39,9 +40,9 @@ DEFINE_DEVICE_TYPE(M50741, m50741_device, "m50741", "Mitsubishi M50741")
//-------------------------------------------------
// m5074x_device - constructor
//-------------------------------------------------
m5074x_device::m5074x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor internal_map) :
m5074x_device::m5074x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int addrbits, address_map_constructor internal_map) :
m740_device(mconfig, type, tag, owner, clock),
m_program_config("program", ENDIANNESS_LITTLE, 8, 13, 0, internal_map),
m_program_config("program", ENDIANNESS_LITTLE, 8, addrbits, 0, internal_map),
m_read_p(*this),
m_write_p(*this),
m_intctrl(0),
@ -319,6 +320,12 @@ uint8_t m5074x_device::ports_r(offs_t offset)
case 9:
return m_ddrs[3];
case 0xa:
return read_port(4);
case 0xb:
return m_ddrs[4];
}
return 0xff;
@ -367,6 +374,16 @@ void m5074x_device::ports_w(offs_t offset, uint8_t data)
send_port(3, m_ports[3] & data);
m_ddrs[3] = data;
break;
case 0xa: // p4
send_port(4, data & m_ddrs[4]);
m_ports[4] = data;
break;
case 0xb: // p4 ddr
send_port(4, m_ports[4] & data);
m_ddrs[4] = data;
break;
}
}
@ -440,13 +457,13 @@ void m5074x_device::tmrirq_w(offs_t offset, uint8_t data)
}
}
/* M50740 - baseline for this familiy */
// M50740 - baseline for this family
void m50740_device::m50740_map(address_map &map)
{
map(0x0000, 0x005f).ram();
map(0x00e0, 0x00e9).rw(FUNC(m50740_device::ports_r), FUNC(m50740_device::ports_w));
map(0x00f9, 0x00ff).rw(FUNC(m50740_device::tmrirq_r), FUNC(m50740_device::tmrirq_w));
map(0x1400, 0x1fff).rom().region(M5074X_INTERNAL_ROM_REGION, 0);
map(0x1400, 0x1fff).rom().region(DEVICE_SELF, 0);
}
m50740_device::m50740_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
@ -455,17 +472,17 @@ m50740_device::m50740_device(const machine_config &mconfig, const char *tag, dev
}
m50740_device::m50740_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
m5074x_device(mconfig, type, tag, owner, clock, address_map_constructor(FUNC(m50740_device::m50740_map), this))
m5074x_device(mconfig, type, tag, owner, clock, 13, address_map_constructor(FUNC(m50740_device::m50740_map), this))
{
}
/* M50741 - 50740 with a larger internal ROM */
// M50741 - 50740 with a larger internal ROM
void m50741_device::m50741_map(address_map &map)
{
map(0x0000, 0x005f).ram();
map(0x00e0, 0x00e9).rw(FUNC(m50741_device::ports_r), FUNC(m50741_device::ports_w));
map(0x00f9, 0x00ff).rw(FUNC(m50741_device::tmrirq_r), FUNC(m50741_device::tmrirq_w));
map(0x1000, 0x1fff).rom().region("internal", 0);
map(0x1000, 0x1fff).rom().region(DEVICE_SELF, 0);
}
m50741_device::m50741_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
@ -474,6 +491,80 @@ m50741_device::m50741_device(const machine_config &mconfig, const char *tag, dev
}
m50741_device::m50741_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
m5074x_device(mconfig, type, tag, owner, clock, address_map_constructor(FUNC(m50741_device::m50741_map), this))
m5074x_device(mconfig, type, tag, owner, clock, 13, address_map_constructor(FUNC(m50741_device::m50741_map), this))
{
}
// M50753 - M5074X with more pins, more RAM, more ROM, A-D, PWM, serial I/O (TODO)
void m50753_device::m50753_map(address_map &map)
{
map(0x0000, 0x00bf).ram();
map(0x00e0, 0x00eb).rw(FUNC(m50753_device::ports_r), FUNC(m50753_device::ports_w));
map(0x00ef, 0x00ef).r(FUNC(m50753_device::ad_r));
map(0x00f2, 0x00f2).w(FUNC(m50753_device::ad_control_w));
map(0x00f3, 0x00f3).rw(FUNC(m50753_device::ad_control_r), FUNC(m50753_device::ad_control_w));
map(0x00f5, 0x00f5).rw(FUNC(m50753_device::pwm_control_r), FUNC(m50753_device::pwm_control_w));
map(0x00f9, 0x00ff).rw(FUNC(m50753_device::tmrirq_r), FUNC(m50753_device::tmrirq_w));
map(0xe800, 0xffff).rom().region(DEVICE_SELF, 0);
}
m50753_device::m50753_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
m50753_device(mconfig, M50753, tag, owner, clock)
{
}
m50753_device::m50753_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
m5074x_device(mconfig, type, tag, owner, clock, 16, address_map_constructor(FUNC(m50753_device::m50753_map), this)),
m_ad_in(*this),
m_ad_control(0),
m_pwm_enabled(false)
{
}
void m50753_device::device_start()
{
m5074x_device::device_start();
m_ad_in.resolve_all_safe(0);
save_item(NAME(m_ad_control));
save_item(NAME(m_pwm_enabled));
}
void m50753_device::device_reset()
{
m5074x_device::device_reset();
m_ad_control = 0;
m_pwm_enabled = false;
}
uint8_t m50753_device::ad_r()
{
return m_ad_in[m_ad_control & 0x07]();
}
void m50753_device::ad_start_w(uint8_t data)
{
logerror("%s: A-D start (IN%d)\n", machine().describe_context(), m_ad_control & 0x07);
}
uint8_t m50753_device::ad_control_r()
{
return m_ad_control;
}
void m50753_device::ad_control_w(uint8_t data)
{
m_ad_control = data & 0x0f;
}
uint8_t m50753_device::pwm_control_r()
{
return m_pwm_enabled ? 0x01 : 0x00;
}
void m50753_device::pwm_control_w(uint8_t data)
{
m_pwm_enabled = BIT(data, 0);
}

View File

@ -7,14 +7,6 @@
#include "m740.h"
//**************************************************************************
// CONSTANTS
//**************************************************************************
// internal ROM region
#define M5074X_INTERNAL_ROM_REGION "internal"
#define M5074X_INTERNAL_ROM(_tag) (_tag ":" M5074X_INTERNAL_ROM_REGION)
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@ -25,6 +17,7 @@ class m5074x_device : public m740_device
{
friend class m50740_device;
friend class m50741_device;
friend class m50753_device;
enum
{
@ -57,7 +50,7 @@ public:
protected:
// construction/destruction
m5074x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor internal_map);
m5074x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int addrbits, address_map_constructor internal_map);
// device-level overrides
virtual void device_start() override;
@ -72,10 +65,10 @@ protected:
void recalc_irqs();
void recalc_timer(int timer);
devcb_read8::array<4> m_read_p;
devcb_write8::array<4> m_write_p;
devcb_read8::array<5> m_read_p;
devcb_write8::array<5> m_write_p;
uint8_t m_ports[6], m_ddrs[6];
uint8_t m_ports[5], m_ddrs[5];
uint8_t m_intctrl, m_tmrctrl;
uint8_t m_tmr12pre, m_tmr1, m_tmr2, m_tmrxpre, m_tmrx;
uint8_t m_tmr1latch, m_tmr2latch, m_tmrxlatch;
@ -90,9 +83,11 @@ class m50740_device : public m5074x_device
public:
m50740_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void m50740_map(address_map &map);
protected:
m50740_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
private:
void m50740_map(address_map &map);
};
class m50741_device : public m5074x_device
@ -100,12 +95,45 @@ class m50741_device : public m5074x_device
public:
m50741_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void m50741_map(address_map &map);
protected:
m50741_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
private:
void m50741_map(address_map &map);
};
class m50753_device : public m5074x_device
{
public:
m50753_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
template <std::size_t Bit> auto ad_in() { return m_ad_in[Bit].bind(); }
protected:
m50753_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
private:
void m50753_map(address_map &map);
uint8_t ad_r();
void ad_start_w(uint8_t data);
uint8_t ad_control_r();
void ad_control_w(uint8_t data);
uint8_t pwm_control_r();
void pwm_control_w(uint8_t data);
devcb_read8::array<8> m_ad_in;
uint8_t m_ad_control;
bool m_pwm_enabled;
};
DECLARE_DEVICE_TYPE(M50740, m50740_device)
DECLARE_DEVICE_TYPE(M50741, m50741_device)
DECLARE_DEVICE_TYPE(M50753, m50753_device)
#endif // MAME_CPU_M6502_M5074X_H

View File

@ -4806,7 +4806,7 @@ void apple2gs_state::apple2gsr1(machine_config &config)
***************************************************************************/
ROM_START(apple2gs)
// M50740/50741 ADB MCU inside the IIgs system unit
ROM_REGION(0x1000,M5074X_INTERNAL_ROM(A2GS_ADBMCU_TAG),0)
ROM_REGION(0x1000, A2GS_ADBMCU_TAG, 0)
ROM_LOAD( "341s0632-2.bin", 0x000000, 0x001000, CRC(e1c11fb0) SHA1(141d18c36a617ab9dce668445440d34354be0672) )
// i8048 microcontroller inside the IIgs ADB Standard Keyboard
@ -4834,7 +4834,7 @@ ROM_START(apple2gs)
ROM_END
ROM_START(apple2gsr3p)
ROM_REGION(0x1000,M5074X_INTERNAL_ROM(A2GS_ADBMCU_TAG),0)
ROM_REGION(0x1000, A2GS_ADBMCU_TAG, 0)
ROM_LOAD( "341s0632-2.bin", 0x000000, 0x001000, CRC(e1c11fb0) SHA1(141d18c36a617ab9dce668445440d34354be0672) )
ROM_REGION(0x400, "kmcu", 0)
@ -4854,7 +4854,7 @@ ROM_START(apple2gsr3p)
ROM_END
ROM_START(apple2gsr1)
ROM_REGION(0xc00,M5074X_INTERNAL_ROM(A2GS_ADBMCU_TAG),0)
ROM_REGION(0xc00, A2GS_ADBMCU_TAG, 0)
ROM_LOAD( "341s0345.bin", 0x000000, 0x000c00, CRC(48cd5779) SHA1(97e421f5247c00a0ca34cd08b6209df573101480) )
ROM_REGION(0x400, "kmcu", 0)
@ -4873,7 +4873,7 @@ ROM_START(apple2gsr1)
ROM_END
ROM_START(apple2gsr0)
ROM_REGION(0xc00,M5074X_INTERNAL_ROM(A2GS_ADBMCU_TAG),0)
ROM_REGION(0xc00, A2GS_ADBMCU_TAG, 0)
ROM_LOAD( "341s0345.bin", 0x000000, 0x000c00, CRC(48cd5779) SHA1(97e421f5247c00a0ca34cd08b6209df573101480) )
ROM_REGION(0x400, "kmcu", 0)
@ -4892,7 +4892,7 @@ ROM_START(apple2gsr0)
ROM_END
ROM_START(apple2gsr0p) // 6/19/1986 Cortland prototype
ROM_REGION(0xc00,M5074X_INTERNAL_ROM(A2GS_ADBMCU_TAG),0)
ROM_REGION(0xc00, A2GS_ADBMCU_TAG, 0)
ROM_LOAD( "341s0345.bin", 0x000000, 0x000c00, CRC(48cd5779) SHA1(97e421f5247c00a0ca34cd08b6209df573101480) )
ROM_REGION(0x400, "kmcu", 0)
@ -4911,7 +4911,7 @@ ROM_START(apple2gsr0p) // 6/19/1986 Cortland prototype
ROM_END
ROM_START(apple2gsr0p2) // 3/10/1986 Cortland prototype, boots as "Apple //'ing - Alpha 2.0"
ROM_REGION(0xc00,M5074X_INTERNAL_ROM(A2GS_ADBMCU_TAG),0)
ROM_REGION(0xc00, A2GS_ADBMCU_TAG, 0)
ROM_LOAD( "341s0345.bin", 0x000000, 0x000c00, CRC(48cd5779) SHA1(97e421f5247c00a0ca34cd08b6209df573101480) )
ROM_REGION(0x400, "kmcu", 0)

View File

@ -27,6 +27,7 @@
#include "machine/macrtc.h"
#include "cpu/m68000/m68000.h"
#include "cpu/m6502/m5074x.h"
#include "machine/6522via.h"
#include "machine/applefdc.h"
#include "machine/ram.h"
@ -415,6 +416,10 @@ void macportable_state::macprtb(machine_config &config)
M68000(config, m_maincpu, C15M);
m_maincpu->set_addrmap(AS_PROGRAM, &macportable_state::macprtb_map);
M50753(config, "pmu", 3.93216_MHz_XTAL);
M50740(config, "kybd", 3.93216_MHz_XTAL).set_disable();
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60.15);
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(1260));
@ -451,7 +456,7 @@ void macportable_state::macprtb(machine_config &config)
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
ASC(config, m_asc, C15M, asc_device::asc_type::ASC);
m_asc->irqf_callback().set(FUNC(macportable_state::asc_irq_w));
m_asc->irqf_callback().set(FUNC(macportable_state::asc_irq_w));
m_asc->add_route(0, "lspeaker", 1.0);
m_asc->add_route(1, "rspeaker", 1.0);
@ -469,6 +474,9 @@ ROM_START(macprtb)
ROM_REGION(0x1800, "pmu", 0)
ROM_LOAD("pmuv1.bin", 0x000000, 0x001800, CRC(01dae148) SHA1(29d2fca7426c31f2b9334832ed3d257974a61bb1))
ROM_REGION(0xc00, "kybd", 0)
ROM_LOAD("342s0740-2.12l", 0x000, 0xc00, NO_DUMP)
ROM_END
ROM_START(macpb100)
@ -477,6 +485,9 @@ ROM_START(macpb100)
ROM_REGION(0x1800, "pmu", 0)
ROM_LOAD("pmuv1.bin", 0x000000, 0x001800, CRC(01dae148) SHA1(29d2fca7426c31f2b9334832ed3d257974a61bb1))
ROM_REGION(0xc00, "kybd", 0)
ROM_LOAD("342s0743-1.u29", 0x000, 0xc00, NO_DUMP)
ROM_END
COMP(1989, macprtb, 0, 0, macprtb, macadb, macportable_state, init_macprtb, "Apple Computer", "Macintosh Portable", MACHINE_NOT_WORKING)