From b49b23b7dfa48377bf5e7abfdd45630248cadc01 Mon Sep 17 00:00:00 2001 From: angelosa Date: Wed, 15 Jun 2016 19:38:04 +0200 Subject: Added command strobe callback interface for LDV1000, and hooked it up to esh.cpp driver. [Angelo Salese] (out of whatsnew: also fixed irq 0 hookup, using device_timer to ack an irq for MAME is never a good idea) --- src/devices/machine/ldv1000.cpp | 10 ++++++++-- src/devices/machine/ldv1000.h | 8 ++++++++ src/emu/romload.cpp | 2 -- src/mame/drivers/esh.cpp | 27 ++++++++++++--------------- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/devices/machine/ldv1000.cpp b/src/devices/machine/ldv1000.cpp index 36dae481853..27c874eadf7 100644 --- a/src/devices/machine/ldv1000.cpp +++ b/src/devices/machine/ldv1000.cpp @@ -63,8 +63,8 @@ const device_type PIONEER_LDV1000 = &device_creator; static ADDRESS_MAP_START( ldv1000_map, AS_PROGRAM, 8, pioneer_ldv1000_device ) AM_RANGE(0x0000, 0x1fff) AM_MIRROR(0x6000) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_MIRROR(0x3800) AM_RAM - AM_RANGE(0xc000, 0xc003) AM_MIRROR(0x9ff0) AM_DEVREADWRITE("ldvppi0", i8255_device, read, write) - AM_RANGE(0xc004, 0xc007) AM_MIRROR(0x9ff0) AM_DEVREADWRITE("ldvppi1", i8255_device, read, write) + AM_RANGE(0xc000, 0xc003) AM_MIRROR(0x1ff0) AM_DEVREADWRITE("ldvppi0", i8255_device, read, write) + AM_RANGE(0xc004, 0xc007) AM_MIRROR(0x1ff0) AM_DEVREADWRITE("ldvppi1", i8255_device, read, write) ADDRESS_MAP_END @@ -126,6 +126,7 @@ pioneer_ldv1000_device::pioneer_ldv1000_device(const machine_config &mconfig, co m_z80_cpu(*this, "ldv1000"), m_z80_ctc(*this, "ldvctc"), m_multitimer(nullptr), + m_command_strobe_cb(*this), m_command(0), m_status(0), m_vsync(false), @@ -175,6 +176,8 @@ void pioneer_ldv1000_device::device_start() // allocate timers m_multitimer = timer_alloc(TID_MULTIJUMP); + + m_command_strobe_cb.resolve_safe(); } @@ -648,6 +651,9 @@ WRITE8_MEMBER( pioneer_ldv1000_device::ppi1_portc_w ) printf("\n"); } + // bit 4 sends a command strobe signal to Host CPU + m_command_strobe_cb(bool(data & 0x10)); + // video squelch is controlled by bit 3 set_video_squelch((data & 0x08) == 0); diff --git a/src/devices/machine/ldv1000.h b/src/devices/machine/ldv1000.h index c2f9ead67a6..c7d798d89df 100644 --- a/src/devices/machine/ldv1000.h +++ b/src/devices/machine/ldv1000.h @@ -26,6 +26,10 @@ #define MCFG_LASERDISC_LDV1000_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, PIONEER_LDV1000, 0) +#define MCFG_LASERDISC_LDV1000_COMMAND_STROBE_CB(_cb) \ + downcast(device)->set_command_strobe_callback(DEVCB_##_cb); + + //************************************************************************** // GLOBAL VARIABLES @@ -49,6 +53,8 @@ public: // construction/destruction pioneer_ldv1000_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + template void set_command_strobe_callback(_cmd_strobe_cb latch) { m_command_strobe_cb.set_callback(latch); } + // input and output void data_w(UINT8 data); void enter_w(UINT8 data); @@ -102,6 +108,7 @@ protected: required_device m_z80_cpu; /* CPU index of the Z80 */ required_device m_z80_ctc; /* CTC device */ emu_timer * m_multitimer; /* multi-jump timer device */ + devcb_write_line m_command_strobe_cb; /* communication status */ UINT8 m_command; /* command byte to the player */ @@ -122,6 +129,7 @@ protected: UINT8 m_vbi[7*3]; /* VBI data */ bool m_vbiready; /* VBI ready flag */ UINT8 m_vbiindex; /* index within the VBI data */ + }; diff --git a/src/emu/romload.cpp b/src/emu/romload.cpp index 1f56418cad9..e158f7ea304 100644 --- a/src/emu/romload.cpp +++ b/src/emu/romload.cpp @@ -811,8 +811,6 @@ void rom_load_manager::fill_rom_data(const rom_entry *romp) /* make sure the length was valid */ if (numbytes == 0) fatalerror("Error in RomModule definition: FILL has an invalid length\n"); - - printf("base %08x %02x\n",numbytes,skip); /* fill the data (filling value is stored in place of the hashdata) */ if(skip != 0) diff --git a/src/mame/drivers/esh.cpp b/src/mame/drivers/esh.cpp index f9ce2dfcbf2..b8e99db0e16 100644 --- a/src/mame/drivers/esh.cpp +++ b/src/mame/drivers/esh.cpp @@ -14,11 +14,9 @@ Notes: Eshb has some junk in the IO TEST screen. Maybe a bad dump? Todo: - - LD TROUBLE message pops up after each cycle in attract. NMI-related + - LD TROUBLE appears at POST. Sync/timing issue? - Wrong overlay colors; - Convert to tilemaps (see next ToDo for feasibility). - - Apparently some tiles blink (in at least two different ways). - - 0xfe and 0xff are pretty obviously not NMI enables. They're likely LED's. Do the NMI right (somehow). - Rumor has it there's an analog beep hanging off 0xf5? Implement it and finish off 0xf5 bits. - NVRAM range 0xe000-0xe800 might be too large. It doesn't seem to write past 0xe600... - Maybe some of the IPT_UNKNOWNs do something? @@ -65,13 +63,13 @@ public: DECLARE_PALETTE_INIT(esh); UINT32 screen_update_esh(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_callback_esh); - INTERRUPT_GEN_MEMBER(ld_unk_callback); + DECLARE_WRITE_LINE_MEMBER(ld_command_strobe_cb); required_device m_maincpu; required_device m_gfxdecode; required_device m_palette; protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + //virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; }; @@ -104,7 +102,7 @@ UINT32 esh_state::screen_update_esh(screen_device &screen, bitmap_rgb32 &bitmap, //int blinkChar = (m_tile_control_ram[current_screen_character] & 0x80) >> 7; // TODO: blink timing - if(blinkLine == true && m_screen->frame_number() & 0x10) + if(blinkLine == true && m_screen->frame_number() & 8) gfx = m_gfxdecode->gfx(1); else gfx = m_gfxdecode->gfx(0); @@ -317,6 +315,7 @@ static GFXDECODE_START( esh ) GFXDECODE_ENTRY("gfx2", 0, esh_gfx_layout, 0x0, 0x20) GFXDECODE_END +#if 0 void esh_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { switch (id) @@ -328,19 +327,20 @@ void esh_state::device_timer(emu_timer &timer, device_timer_id id, int param, vo assert_always(FALSE, "Unknown id in esh_state::device_timer"); } } +#endif INTERRUPT_GEN_MEMBER(esh_state::vblank_callback_esh) { // IRQ - device.execute().set_input_line(0, ASSERT_LINE); - timer_set(attotime::from_usec(50), TIMER_IRQ_STOP); + device.execute().set_input_line(0, HOLD_LINE); + //timer_set(attotime::from_usec(50), TIMER_IRQ_STOP); } -// TODO: 0xfe NMI enabled after writing to LD command port, NMI reads LD port. LDV needs command strobe callback? -INTERRUPT_GEN_MEMBER(esh_state::ld_unk_callback) +// TODO: 0xfe NMI enabled after writing to LD command port, NMI reads LD port. +WRITE_LINE_MEMBER(esh_state::ld_command_strobe_cb) { if(m_nmi_enable) - m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); + m_maincpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); } void esh_state::machine_start() @@ -350,19 +350,16 @@ void esh_state::machine_start() /* DRIVER */ static MACHINE_CONFIG_START( esh, esh_state ) - /* main cpu */ MCFG_CPU_ADD("maincpu", Z80, PCB_CLOCK/6) /* The denominator is a Daphne guess based on PacMan's hardware */ MCFG_CPU_PROGRAM_MAP(z80_0_mem) MCFG_CPU_IO_MAP(z80_0_io) MCFG_CPU_VBLANK_INT_DRIVER("screen", esh_state, vblank_callback_esh) - MCFG_CPU_PERIODIC_INT_DRIVER(esh_state, ld_unk_callback, 90) - MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_LASERDISC_LDV1000_ADD("laserdisc") + MCFG_LASERDISC_LDV1000_COMMAND_STROBE_CB(WRITELINE(esh_state, ld_command_strobe_cb)) MCFG_LASERDISC_OVERLAY_DRIVER(256, 256, esh_state, screen_update_esh) MCFG_LASERDISC_OVERLAY_PALETTE("palette") -- cgit v1.2.3