summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/heromem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/heromem.cpp')
-rw-r--r--src/mame/drivers/heromem.cpp148
1 files changed, 129 insertions, 19 deletions
diff --git a/src/mame/drivers/heromem.cpp b/src/mame/drivers/heromem.cpp
index 8920d2ceace..cc8550e6496 100644
--- a/src/mame/drivers/heromem.cpp
+++ b/src/mame/drivers/heromem.cpp
@@ -19,10 +19,15 @@
1 x 8-dip switch
1 x 16.0000MHz Osc
+TODO:
+- currently stuck at 'communication error'.
+- everything is guesswork and should be verified.
+
*/
#include "emu.h"
#include "cpu/z80/z80.h"
+#include "machine/timer.h"
#include "sound/ymopn.h"
#include "machine/gen_latch.h"
#include "machine/i8255.h"
@@ -41,38 +46,126 @@ class heromem_state : public driver_device
{
public:
heromem_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag)
+ : driver_device(mconfig, type, tag),
+ m_tc0091lvc_l(*this, "tc0091lvc_l"),
+ m_tc0091lvc_r(*this, "tc0091lvc_r")
{ }
void heromem(machine_config &config);
private:
+ required_device<tc0091lvc_device> m_tc0091lvc_l;
+ required_device<tc0091lvc_device> m_tc0091lvc_r;
+
void maincpu_prg_map(address_map &map);
void audiocpu_l_prg_map(address_map &map);
void audiocpu_r_prg_map(address_map &map);
void tc0091lvc_l_prg_map(address_map &map);
void tc0091lvc_r_prg_map(address_map &map);
+
+ DECLARE_WRITE_LINE_MEMBER(screen_vblank_l) { if (state) { m_tc0091lvc_l->screen_eof(); } }
+ DECLARE_WRITE_LINE_MEMBER(screen_vblank_r) { if (state) { m_tc0091lvc_l->screen_eof(); } }
+
+ TIMER_DEVICE_CALLBACK_MEMBER(irq_scanline_l);
+ TIMER_DEVICE_CALLBACK_MEMBER(irq_scanline_r);
};
+TIMER_DEVICE_CALLBACK_MEMBER(heromem_state::irq_scanline_l)
+{
+ int scanline = param;
+
+ if (scanline == 240 && (m_tc0091lvc_l->irq_enable() & 4))
+ {
+ m_tc0091lvc_l->set_input_line_and_vector(0, HOLD_LINE, m_tc0091lvc_l->irq_vector(2));
+ }
+
+ if (scanline == 0 && (m_tc0091lvc_l->irq_enable() & 2))
+ {
+ m_tc0091lvc_l->set_input_line_and_vector(0, HOLD_LINE, m_tc0091lvc_l->irq_vector(1));
+ }
+}
+
+TIMER_DEVICE_CALLBACK_MEMBER(heromem_state::irq_scanline_r)
+{
+ int scanline = param;
+
+ if (scanline == 240 && (m_tc0091lvc_r->irq_enable() & 4))
+ {
+ m_tc0091lvc_r->set_input_line_and_vector(0, HOLD_LINE, m_tc0091lvc_r->irq_vector(2));
+ }
+
+ if (scanline == 0 && (m_tc0091lvc_r->irq_enable() & 2))
+ {
+ m_tc0091lvc_r->set_input_line_and_vector(0, HOLD_LINE, m_tc0091lvc_r->irq_vector(1));
+ }
+}
+
+
void heromem_state::maincpu_prg_map(address_map &map)
{
+ map(0x0000, 0xafff).rom().region("maincpu", 0);
+ map(0xd000, 0xefff).ram();
+ // TODO: from here on it needs verification
+ map(0xf000, 0xf000).nopr().w("ciu_l", FUNC(pc060ha_device::master_port_w));
+ map(0xf001, 0xf001).rw("ciu_l", FUNC(pc060ha_device::master_comm_r), FUNC(pc060ha_device::master_comm_w));
+ map(0xf100, 0xf100).nopr().w("ciu_r", FUNC(pc060ha_device::master_port_w));
+ map(0xf101, 0xf101).rw("ciu_r", FUNC(pc060ha_device::master_comm_r), FUNC(pc060ha_device::master_comm_w));
+ map(0xf200, 0xf200).w("tc0140syt_l", FUNC(tc0140syt_device::master_port_w));
+ map(0xf201, 0xf201).rw("tc0140syt_l", FUNC(tc0140syt_device::master_comm_r), FUNC(tc0140syt_device::master_comm_w));
+ map(0xf300, 0xf300).w("tc0140syt_r", FUNC(tc0140syt_device::master_port_w));
+ map(0xf301, 0xf301).rw("tc0140syt_r", FUNC(tc0140syt_device::master_comm_r), FUNC(tc0140syt_device::master_comm_w));
+ // TODO: lots more writes
}
void heromem_state::audiocpu_l_prg_map(address_map &map)
{
+ map(0x0000, 0x7fff).rom().region("audiocpu_l", 0);
+ // TODO: banking?
+ map(0xc000, 0xdfff).ram();
+ // TODO: from here on verify when it works
+ map(0xe000, 0xe003).rw("ym_l", FUNC(ym2610b_device::read), FUNC(ym2610b_device::write));
+ map(0xe200, 0xe200).w("tc0140syt_l", FUNC(tc0140syt_device::slave_port_w));
+ map(0xe201, 0xe201).rw("tc0140syt_l", FUNC(tc0140syt_device::slave_comm_r), FUNC(tc0140syt_device::slave_comm_w));
+ // TODO: lots more writes
}
void heromem_state::audiocpu_r_prg_map(address_map &map)
{
+ map(0x0000, 0x7fff).rom().region("audiocpu_r", 0);
+ // TODO: banking?
+ map(0xc000, 0xdfff).ram();
+ // TODO: from here on verify when it works
+ map(0xe000, 0xe003).rw("ym_r", FUNC(ym2610b_device::read), FUNC(ym2610b_device::write));
+ map(0xe200, 0xe200).w("tc0140syt_r", FUNC(tc0140syt_device::slave_port_w));
+ map(0xe201, 0xe201).rw("tc0140syt_r", FUNC(tc0140syt_device::slave_comm_r), FUNC(tc0140syt_device::slave_comm_w));
+ // TODO: lots more writes
}
void heromem_state::tc0091lvc_l_prg_map(address_map &map)
{
+ map(0x8000, 0x9fff).ram();
+ // TODO: where is the PC060HA hooked up?
+ //map(0xa004, 0xa004).nopr().w("ciu_l", FUNC(pc060ha_device::slave_port_w));
+ //map(0xa005, 0xa005).rw("ciu_l", FUNC(pc060ha_device::slave_comm_r), FUNC(pc060ha_device::slave_comm_w));
+ map(0xfe00, 0xfeff).rw(m_tc0091lvc_l, FUNC(tc0091lvc_device::vregs_r), FUNC(tc0091lvc_device::vregs_w));
+ map(0xff00, 0xff02).rw(m_tc0091lvc_l, FUNC(tc0091lvc_device::irq_vector_r), FUNC(tc0091lvc_device::irq_vector_w));
+ map(0xff03, 0xff03).rw(m_tc0091lvc_l, FUNC(tc0091lvc_device::irq_enable_r), FUNC(tc0091lvc_device::irq_enable_w));
+ map(0xff04, 0xff07).rw(m_tc0091lvc_l, FUNC(tc0091lvc_device::ram_bank_r), FUNC(tc0091lvc_device::ram_bank_w));
+ map(0xff08, 0xff08).rw(m_tc0091lvc_l, FUNC(tc0091lvc_device::rom_bank_r), FUNC(tc0091lvc_device::rom_bank_w));
}
void heromem_state::tc0091lvc_r_prg_map(address_map &map)
{
+ map(0x8000, 0x9fff).ram();
+ // TODO: where is the PC060HA hooked up?
+ //map(0xa004, 0xa004).nopr().w("ciu_r", FUNC(pc060ha_device::slave_port_w));
+ //map(0xa005, 0xa005).rw("ciu_r", FUNC(pc060ha_device::slave_comm_r), FUNC(pc060ha_device::slave_comm_w));
+ map(0xfe00, 0xfeff).rw(m_tc0091lvc_r, FUNC(tc0091lvc_device::vregs_r), FUNC(tc0091lvc_device::vregs_w));
+ map(0xff00, 0xff02).rw(m_tc0091lvc_r, FUNC(tc0091lvc_device::irq_vector_r), FUNC(tc0091lvc_device::irq_vector_w));
+ map(0xff03, 0xff03).rw(m_tc0091lvc_r, FUNC(tc0091lvc_device::irq_enable_r), FUNC(tc0091lvc_device::irq_enable_w));
+ map(0xff04, 0xff07).rw(m_tc0091lvc_r, FUNC(tc0091lvc_device::ram_bank_r), FUNC(tc0091lvc_device::ram_bank_w));
+ map(0xff08, 0xff08).rw(m_tc0091lvc_r, FUNC(tc0091lvc_device::rom_bank_r), FUNC(tc0091lvc_device::rom_bank_w));
}
@@ -120,6 +213,9 @@ void heromem_state::heromem(machine_config &config)
z80_device &audiocpu_r(Z80(config, "audiocpu_r", 16000000 / 4)); // divider unverified
audiocpu_r.set_addrmap(AS_PROGRAM, &heromem_state::audiocpu_r_prg_map);
+ TIMER(config, "scantimer_l").configure_scanline(FUNC(heromem_state::irq_scanline_l), "lscreen", 0, 1);
+ TIMER(config, "scantimer_r").configure_scanline(FUNC(heromem_state::irq_scanline_r), "rscreen", 0, 1);
+
I8255(config, "ppi"); // MB89255B
TE7750(config, "io"); // TE7751
@@ -130,7 +226,8 @@ void heromem_state::heromem(machine_config &config)
lscreen.set_vblank_time(ATTOSECONDS_IN_USEC(2500));
lscreen.set_size(64*8, 32*8);
lscreen.set_visarea(0*8, 40*8-1, 2*8, 30*8-1);
- lscreen.set_screen_update("tc0091lvc_l", FUNC(tc0091lvc_device::screen_update));
+ lscreen.set_screen_update(m_tc0091lvc_l, FUNC(tc0091lvc_device::screen_update));
+ lscreen.screen_vblank().set(FUNC(heromem_state::screen_vblank_l));
lscreen.set_palette("tc0091lvc_l:palette");
screen_device &rscreen(SCREEN(config, "rscreen", SCREEN_TYPE_RASTER)); // all wrong
@@ -138,25 +235,28 @@ void heromem_state::heromem(machine_config &config)
rscreen.set_vblank_time(ATTOSECONDS_IN_USEC(2500));
rscreen.set_size(64*8, 32*8);
rscreen.set_visarea(0*8, 40*8-1, 2*8, 30*8-1);
- rscreen.set_screen_update("tc0091lvc_r", FUNC(tc0091lvc_device::screen_update));
+ rscreen.set_screen_update(m_tc0091lvc_r, FUNC(tc0091lvc_device::screen_update));
+ rscreen.screen_vblank().set(FUNC(heromem_state::screen_vblank_r));
rscreen.set_palette("tc0091lvc_r:palette");
pc060ha_device &ciu_l(PC060HA(config, "ciu_l", 0));
ciu_l.set_master_tag("maincpu");
- ciu_l.set_slave_tag("tc0091lvc_l");
+ ciu_l.set_slave_tag(m_tc0091lvc_l);
pc060ha_device &ciu_r(PC060HA(config, "ciu_r", 0));
ciu_r.set_master_tag("maincpu");
- ciu_r.set_slave_tag("tc0091lvc_r");
+ ciu_r.set_slave_tag(m_tc0091lvc_r);
- tc0091lvc_device &vdp_l(TC0091LVC(config, "tc0091lvc_l", 16000000 / 4));
+ tc0091lvc_device &vdp_l(TC0091LVC(config, m_tc0091lvc_l, 16000000 / 4));
vdp_l.set_addrmap(AS_PROGRAM, &heromem_state::tc0091lvc_l_prg_map);
- tc0091lvc_device &vdp_r(TC0091LVC(config, "tc0091lvc_r", 16000000 / 4));
+ tc0091lvc_device &vdp_r(TC0091LVC(config, m_tc0091lvc_r, 16000000 / 4));
vdp_r.set_addrmap(AS_PROGRAM, &heromem_state::tc0091lvc_r_prg_map);
// sound hardware
- SPEAKER(config, "mono").front_center();
+ SPEAKER(config, "lspeaker").front_left();
+
+ SPEAKER(config, "rspeaker").front_right();
tc0140syt_device &syt_l(TC0140SYT(config, "tc0140syt_l", 0));
syt_l.set_master_tag("maincpu");
@@ -166,9 +266,19 @@ void heromem_state::heromem(machine_config &config)
syt_r.set_master_tag("maincpu");
syt_r.set_slave_tag("audiocpu_r");
- YM2610B(config, "ym_l", 16000000 / 2);
-
- YM2610B(config, "ym_r", 16000000 / 2);
+ ym2610b_device &ym_l(YM2610B(config, "ym_l", 16000000 / 2));
+ ym_l.irq_handler().set_inputline("audiocpu_l", 0);
+ ym_l.add_route(0, "lspeaker", 0.25);
+ ym_l.add_route(0, "lspeaker", 0.25);
+ ym_l.add_route(1, "lspeaker", 1.0);
+ ym_l.add_route(2, "lspeaker", 1.0);
+
+ ym2610b_device &ym_r(YM2610B(config, "ym_r", 16000000 / 2));
+ ym_r.irq_handler().set_inputline("audiocpu_r", 0);
+ ym_r.add_route(0, "rspeaker", 0.25);
+ ym_r.add_route(0, "rspeaker", 0.25);
+ ym_r.add_route(1, "rspeaker", 1.0);
+ ym_r.add_route(2, "rspeaker", 1.0);
}
@@ -187,19 +297,19 @@ ROM_START( heromem )
ROM_LOAD( "e34-07.ic40", 0x00000, 0x80000, CRC(7f4d2664) SHA1(6d249f1e5f341da5923b45c2863ee418bb057586) ) // 1xxxxxxxxxxxxxxxxxx = 0xFF
ROM_REGION( 0x200000, "tc0091lvc_l:gfx", 0 ) // marked LV-CHR0-3 on PCB (LV probably stands for left video)
- ROM_LOAD( "e34-08.ic41", 0x000000, 0x80000, CRC(a8c572f8) SHA1(f98de6a9eaa49e037f02f9e56da9edbebc535cd7) )
- ROM_LOAD( "e34-09.ic43", 0x080000, 0x80000, CRC(2c8849b7) SHA1(090ab881b0a98b8b1522282f46b70edeb83681d9) )
- ROM_LOAD( "e34-10.ic42", 0x100000, 0x80000, CRC(e7986216) SHA1(43fea3f1c80f9e7e051e9321d8d28e9ce5ae22f3) )
- ROM_LOAD( "e34-11.ic44", 0x180000, 0x80000, CRC(4da5904d) SHA1(280a63444af25d143c7543607cd942d0ffc33a56) )
+ ROM_LOAD16_BYTE( "e34-08.ic41", 0x000000, 0x80000, CRC(a8c572f8) SHA1(f98de6a9eaa49e037f02f9e56da9edbebc535cd7) )
+ ROM_LOAD16_BYTE( "e34-09.ic43", 0x000001, 0x80000, CRC(2c8849b7) SHA1(090ab881b0a98b8b1522282f46b70edeb83681d9) )
+ ROM_LOAD16_BYTE( "e34-10.ic42", 0x080000, 0x80000, CRC(e7986216) SHA1(43fea3f1c80f9e7e051e9321d8d28e9ce5ae22f3) )
+ ROM_LOAD16_BYTE( "e34-11.ic44", 0x080001, 0x80000, CRC(4da5904d) SHA1(280a63444af25d143c7543607cd942d0ffc33a56) )
ROM_REGION( 0x80000, "tc0091lvc_r", 0 )
ROM_LOAD( "e34-07.ic54", 0x00000, 0x80000, CRC(7f4d2664) SHA1(6d249f1e5f341da5923b45c2863ee418bb057586) ) // 1xxxxxxxxxxxxxxxxxx = 0xFF
ROM_REGION( 0x200000, "tc0091lvc_r:gfx", 0 ) // marked RV-CHR0-3 on PCB (RV probably stands for right video)
- ROM_LOAD( "e34-08.ic55", 0x000000, 0x80000, CRC(a8c572f8) SHA1(f98de6a9eaa49e037f02f9e56da9edbebc535cd7) )
- ROM_LOAD( "e34-09.ic57", 0x080000, 0x80000, CRC(2c8849b7) SHA1(090ab881b0a98b8b1522282f46b70edeb83681d9) )
- ROM_LOAD( "e34-10.ic56", 0x100000, 0x80000, CRC(e7986216) SHA1(43fea3f1c80f9e7e051e9321d8d28e9ce5ae22f3) )
- ROM_LOAD( "e34-11.ic58", 0x180000, 0x80000, CRC(4da5904d) SHA1(280a63444af25d143c7543607cd942d0ffc33a56) )
+ ROM_LOAD16_BYTE( "e34-08.ic55", 0x000000, 0x80000, CRC(a8c572f8) SHA1(f98de6a9eaa49e037f02f9e56da9edbebc535cd7) )
+ ROM_LOAD16_BYTE( "e34-09.ic57", 0x000001, 0x80000, CRC(2c8849b7) SHA1(090ab881b0a98b8b1522282f46b70edeb83681d9) )
+ ROM_LOAD16_BYTE( "e34-10.ic56", 0x080000, 0x80000, CRC(e7986216) SHA1(43fea3f1c80f9e7e051e9321d8d28e9ce5ae22f3) )
+ ROM_LOAD16_BYTE( "e34-11.ic58", 0x080001, 0x80000, CRC(4da5904d) SHA1(280a63444af25d143c7543607cd942d0ffc33a56) )
ROM_REGION( 0x200000, "ym_l:adpcma", 0 ) // marked LS-PCM0 to LS-PCM3 on PCB (LS probably stands for left sound), same ROM content for the two YMs
ROM_LOAD( "e34-12.ic29", 0x000000, 0x80000, CRC(7bb1f476) SHA1(c06c27a2c59953f9ff1eb7679257970fd9c346a3) )