diff --git a/src/devices/cpu/tms1000/smc1102.cpp b/src/devices/cpu/tms1000/smc1102.cpp index cf8e1dceb6c..e3a28ebc9a3 100644 --- a/src/devices/cpu/tms1000/smc1102.cpp +++ b/src/devices/cpu/tms1000/smc1102.cpp @@ -5,7 +5,7 @@ Suwa Seikosha (now Seiko Epson) SMC1102, SMC1112 SMC1102 is a CMOS MCU based on TMS1100, keeping the same ALU and opcode mnemonics. -The stack(CALL/RETN) works a bit differently. They added a timer, interrupts, +The stack(CALL/RETN) works a bit differently. They also added a timer, interrupts, and a built-in LCD controller. In the USA, it was marketed by S-MOS Systems, an affiliate of Seiko Group. @@ -112,16 +112,16 @@ void smc1102_cpu_device::device_reset() m_timeout = false; // changed/added fixed instructions (mostly handled in op_extra) - m_fixed_decode[0x0a] = F_EXTRA; - m_fixed_decode[0x71] = F_EXTRA; - m_fixed_decode[0x74] = F_EXTRA; - m_fixed_decode[0x75] = F_EXTRA; - m_fixed_decode[0x76] = F_RETN; - m_fixed_decode[0x78] = F_EXTRA; - m_fixed_decode[0x7b] = F_EXTRA; + m_fixed_decode[0x0a] = F_EXTRA; // TASR + m_fixed_decode[0x71] = F_EXTRA; // HALT + m_fixed_decode[0x74] = F_EXTRA; // INTEN + m_fixed_decode[0x75] = F_EXTRA; // INTDIS + m_fixed_decode[0x76] = F_RETN; // INTRTN + m_fixed_decode[0x78] = F_EXTRA; // SELIN + m_fixed_decode[0x7b] = F_EXTRA; // TMSET - m_fixed_decode[0x72] = m_fixed_decode[0x73] = F_EXTRA; - m_fixed_decode[0x7c] = m_fixed_decode[0x7d] = F_EXTRA; + m_fixed_decode[0x72] = m_fixed_decode[0x73] = F_EXTRA; // TSG + m_fixed_decode[0x7c] = m_fixed_decode[0x7d] = F_EXTRA; // " } u32 smc1102_cpu_device::decode_micro(offs_t offset) diff --git a/src/mame/midway/midwayic.h b/src/mame/midway/midwayic.h index 789a6709c82..5a4c06e1696 100644 --- a/src/mame/midway/midwayic.h +++ b/src/mame/midway/midwayic.h @@ -45,14 +45,14 @@ protected: required_ioport m_io_serial_digit; - uint8_t m_data[16]{}; // reused by other devices + uint8_t m_data[16]{}; // reused by other devices int m_upper = 0; private: - uint8_t m_buff = 0; - uint8_t m_idx = 0; - uint8_t m_status = 0; - uint8_t m_bits = 0; + uint8_t m_buff = 0; + uint8_t m_idx = 0; + uint8_t m_status = 0; + uint8_t m_bits = 0; }; @@ -129,10 +129,10 @@ protected: private: void pic_register_state(); - TIMER_CALLBACK_MEMBER( reset_timer ); + TIMER_CALLBACK_MEMBER(reset_timer); uint16_t m_latch = 0; - attotime m_latch_expire_time{}; + attotime m_latch_expire_time; uint8_t m_state = 0; uint8_t m_index = 0; uint8_t m_total = 0; diff --git a/src/mame/midway/midzeus.cpp b/src/mame/midway/midzeus.cpp index 6b1c34d5cb3..9f8430bfedc 100644 --- a/src/mame/midway/midzeus.cpp +++ b/src/mame/midway/midzeus.cpp @@ -358,6 +358,7 @@ void midzeus2_state::disk_asic_w(offs_t offset, uint32_t data) * Disk ASIC JR registers * *************************************/ + uint32_t midzeus_state::disk_asic_jr_r(offs_t offset) { uint32_t retVal = m_disk_asic_jr[offset]; @@ -366,19 +367,21 @@ uint32_t midzeus_state::disk_asic_jr_r(offs_t offset) // miscellaneous hw wait states case 1: break; + /* CMOS/ZPRAM write enable; only low bit is used */ case 2: + //return m_disk_asic_jr[offset] | ~1; break; - // return m_disk_asic_jr[offset] | ~1; /* reset status; bit 0 is watchdog reset; mk4/invasn/thegrid read at startup; invasn freaks if it is 1 at startup */ case 3: + //return m_disk_asic_jr[offset] | ~1; break; - // return m_disk_asic_jr[offset] | ~1; /* ROM bank selection on Zeus 2; two bits are used */ case 5: - // return m_disk_asic_jr[offset] | ~3; + //return m_disk_asic_jr[offset] | ~3; + break; /* disk asic jr id; crusnexo reads at startup: if (val & 0xf0) == 0xa0 it affects */ /* how the Zeus is used (reg 0x5d is set to 0x54580006) */ @@ -478,29 +481,27 @@ uint32_t midzeus2_state::crusnexo_leds_r(offs_t offset) void midzeus2_state::crusnexo_leds_w(offs_t offset, uint32_t data) { - int bit, led; - switch (offset) { case 0: /* unknown purpose */ break; case 1: /* controls lamps */ - for (bit = 0; bit < 8; bit++) + for (int bit = 0; bit < 8; bit++) m_lamps[bit] = BIT(data, bit); break; case 2: /* sets state of selected LEDs */ /* selection bits 4-6 select the 3 7-segment LEDs */ - for (bit = 4; bit < 7; bit++) + for (int bit = 4; bit < 7; bit++) if ((m_crusnexo_leds_select & (1 << bit)) == 0) m_digits[bit] = ~data & 0xff; /* selection bits 0-2 select the tachometer LEDs */ - for (bit = 0; bit < 3; bit++) + for (int bit = 0; bit < 3; bit++) if ((m_crusnexo_leds_select & (1 << bit)) == 0) - for (led = 0; led < 8; led++) + for (int led = 0; led < 8; led++) m_leds[bit * 8 + led] = BIT(~data, led); break; diff --git a/src/mame/midway/midzeus.h b/src/mame/midway/midzeus.h index f0090d7a077..f8a8e8185a7 100644 --- a/src/mame/midway/midzeus.h +++ b/src/mame/midway/midzeus.h @@ -22,21 +22,21 @@ struct mz_poly_extra_data { - const void * palbase; - const void * texbase; - uint16_t solidcolor = 0; - uint16_t voffset = 0; - int16_t zoffset = 0; - uint16_t transcolor = 0; - uint16_t texwidth = 0; - uint16_t color = 0; - uint32_t alpha = 0; - uint32_t ctrl_word = 0; + const void *palbase; + const void *texbase; + uint16_t solidcolor = 0; + uint16_t voffset = 0; + int16_t zoffset = 0; + uint16_t transcolor = 0; + uint16_t texwidth = 0; + uint16_t color = 0; + uint32_t alpha = 0; + uint32_t ctrl_word = 0; bool blend_enable = false; bool depth_test_enable = false; bool depth_write_enable = false; - uint32_t blend = 0; - uint8_t (*get_texel)(const void *, int, int, int); + uint32_t blend = 0; + uint8_t (*get_texel)(const void *, int, int, int); }; @@ -65,8 +65,8 @@ class midzeus_state : public driver_device friend class midzeus_renderer; public: - midzeus_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + midzeus_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_nvram(*this, "nvram"), m_ram_base(*this, "ram_base"), m_tms32031_control(*this, "tms32031_ctl"), diff --git a/src/mame/misc/micro3d.h b/src/mame/misc/micro3d.h index cf50c115477..c5d9ae696f3 100644 --- a/src/mame/misc/micro3d.h +++ b/src/mame/misc/micro3d.h @@ -12,10 +12,11 @@ #include "cpu/tms34010/tms34010.h" #include "cpu/mcs51/mcs51.h" -#include "sound/upd7759.h" #include "machine/adc0844.h" #include "machine/mc68681.h" #include "machine/scn_pci.h" +#include "sound/upd7759.h" + #include "emupal.h" @@ -36,6 +37,7 @@ public: m_upd7759(*this, "upd7759"), m_drmath(*this, "drmath"), m_vgb(*this, "vgb"), + m_vgb_uart(*this, "uart"), m_palette(*this, "palette"), m_duart(*this, "duart"), m_noise_1(*this, "noise_1"), @@ -48,8 +50,7 @@ public: m_joystick_y(*this, "JOYSTICK_Y"), m_shared_ram(*this, "shared_ram"), m_mac_sram(*this, "mac_sram"), - m_sprite_vram(*this, "sprite_vram"), - m_vgb_uart(*this, "uart") + m_sprite_vram(*this, "sprite_vram") { } void micro3d(machine_config &config); @@ -89,6 +90,7 @@ private: required_device m_upd7759; required_device m_drmath; required_device m_vgb; + required_device m_vgb_uart; required_device m_palette; required_device m_duart; required_device m_noise_1; @@ -102,48 +104,48 @@ private: optional_ioport m_joystick_y; required_shared_ptr m_shared_ram; - uint8_t m_m68681_tx0 = 0; + uint8_t m_m68681_tx0 = 0; /* Sound */ - uint8_t m_sound_port_latch[4]{}; + uint8_t m_sound_port_latch[4]{}; /* Hardware version-check latch for BOTSS 1.1a */ - uint8_t m_botss_latch = 0; + uint8_t m_botss_latch = 0; /* MAC */ required_shared_ptr m_mac_sram; - emu_timer *m_mac_done_timer = nullptr; - uint32_t m_sram_r_addr = 0; - uint32_t m_sram_w_addr = 0; - uint32_t m_vtx_addr = 0; - uint32_t m_mrab11 = 0; - uint32_t m_mac_stat = 0; - uint32_t m_mac_inst = 0; + emu_timer *m_mac_done_timer = nullptr; + uint32_t m_sram_r_addr = 0; + uint32_t m_sram_w_addr = 0; + uint32_t m_vtx_addr = 0; + uint32_t m_mrab11 = 0; + uint32_t m_mac_stat = 0; + uint32_t m_mac_inst = 0; /* 2D video */ required_shared_ptr m_sprite_vram; - uint16_t m_creg = 0; - uint16_t m_xfer3dk = 0; + uint16_t m_creg = 0; + uint16_t m_xfer3dk = 0; /* 3D pipeline */ - uint32_t m_pipe_data = 0; - uint32_t m_pipeline_state = 0; - int32_t m_vtx_fifo[512]{}; - uint32_t m_fifo_idx = 0; - uint32_t m_draw_cmd = 0; + uint32_t m_pipe_data = 0; + uint32_t m_pipeline_state = 0; + int32_t m_vtx_fifo[512]{}; + uint32_t m_fifo_idx = 0; + uint32_t m_draw_cmd = 0; int m_draw_state = 0; - int32_t m_x_min = 0; - int32_t m_x_max = 0; - int32_t m_y_min = 0; - int32_t m_y_max = 0; - int32_t m_z_min = 0; - int32_t m_z_max = 0; - int32_t m_x_mid = 0; - int32_t m_y_mid = 0; + int32_t m_x_min = 0; + int32_t m_x_max = 0; + int32_t m_y_min = 0; + int32_t m_y_max = 0; + int32_t m_z_min = 0; + int32_t m_z_max = 0; + int32_t m_x_mid = 0; + int32_t m_y_mid = 0; int m_dpram_bank = 0; - uint32_t m_draw_dpram[1024]{}; - std::unique_ptr m_frame_buffers[2]; - std::unique_ptr m_tmp_buffer; + uint32_t m_draw_dpram[1024]{}; + std::unique_ptr m_frame_buffers[2]; + std::unique_ptr m_tmp_buffer; int m_drawing_buffer = 0; int m_display_buffer = 0; @@ -200,8 +202,6 @@ private: void soundmem_io(address_map &map); void soundmem_prg(address_map &map); void vgbmem(address_map &map); - - required_device m_vgb_uart; }; #endif // MAME_MISC_MICRO3D_H diff --git a/src/mame/misc/micro3d_a.cpp b/src/mame/misc/micro3d_a.cpp index e21e588935a..b0dc9eb4900 100644 --- a/src/mame/misc/micro3d_a.cpp +++ b/src/mame/misc/micro3d_a.cpp @@ -162,17 +162,18 @@ void micro3d_sound_device::noise_sh_w(u8 data) DEFINE_DEVICE_TYPE(MICRO3D_SOUND, micro3d_sound_device, "micro3d_sound", "Microprose Custom Sound") -micro3d_sound_device::micro3d_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) - : device_t(mconfig, MICRO3D_SOUND, tag, owner, clock), - device_sound_interface(mconfig, *this), - m_gain(0), - m_noise_shift(0), - m_noise_value(0), - m_noise_subcount(0), - m_stream(nullptr) +micro3d_sound_device::micro3d_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : + device_t(mconfig, MICRO3D_SOUND, tag, owner, clock), + device_sound_interface(mconfig, *this), + m_dac_data(0), + m_gain(0), + m_noise_shift(0), + m_noise_value(0), + m_noise_subcount(0), + m_stream(nullptr) { - memset(m_dac, 0, sizeof(u8)*4); + memset(m_dac, 0, sizeof(m_dac)); } //------------------------------------------------- diff --git a/src/mame/misc/micro3d_a.h b/src/mame/misc/micro3d_a.h index 22a165393fa..5e533e9e123 100644 --- a/src/mame/misc/micro3d_a.h +++ b/src/mame/misc/micro3d_a.h @@ -45,23 +45,23 @@ private: void init(double fs); void recompute(double k, double q, double fc); - float history[2 * 2]{}; - float coef[4 * 2 + 1]{}; - double fs = 0; - biquad proto_coef[2]{}; + float history[2 * 2]; + float coef[4 * 2 + 1]; + double fs; + biquad proto_coef[2]; }; struct m3d_filter_state { void configure(double r, double c); - double capval = 0; - double exponent = 0; + double capval; + double exponent; }; - u8 m_dac_data = 0; + u8 m_dac_data; - u8 m_dac[4]{}; + u8 m_dac[4]; float m_gain; u32 m_noise_shift; diff --git a/src/mame/seta/seta.cpp b/src/mame/seta/seta.cpp index c76688d02b9..7e44f102d49 100644 --- a/src/mame/seta/seta.cpp +++ b/src/mame/seta/seta.cpp @@ -122,7 +122,6 @@ TODO: stage 2: when BOX-MEN gets angry - games using 6bpp gfx switch tilemaps color mode. Only blandia uses both, while the other ones use only mode 1, thus mode 0 is untested for them - ***************************************************************************/ /*************************************************************************** @@ -197,7 +196,6 @@ Custom: X1-001A X1-002A ***************************************************************************/ - /*************************************************************************** Athena no Hatena? @@ -539,7 +537,6 @@ X1-010 X1-006 /*************************************************************************** - Mad Shark Allumer, 1993 @@ -574,6 +571,7 @@ Notes: ***************************************************************************/ /*************************************************************************** + Magical Speed (c)1994 Allumer @@ -699,11 +697,8 @@ ROMs : 02.bin + 03.bin OKI Samples 06.bin to 11.bin GFX - - ***************************************************************************/ - /*************************************************************************** Quiz Kokology @@ -807,7 +802,6 @@ Notes: VSync: 58Hz HSync: 15.22kHz - ***************************************************************************/ /*************************************************************************** @@ -878,10 +872,10 @@ BP-U-002.U2 4M mask (40 pin, 512k x 8), read as MX27C4100 / BP-U-003.U13 8M mask (32 pin, 1M x 8), read as MX27C8000 Sound - ***************************************************************************/ /*************************************************************************** + Ultra Toukon Densetsu Banpresto, 1993 Hardware info by Guru @@ -976,7 +970,6 @@ X1-010 5168-10 68000-16 *************************************************************************** - Pairs Love Allumer, 199x Hardware info by Guru @@ -1012,7 +1005,6 @@ Notes: 68000 clock: 8.000MHz VSync: 60Hz - *************************************************************************** Rezon (Taito License) diff --git a/src/mame/shared/dcs.cpp b/src/mame/shared/dcs.cpp index 0bb292a282d..826a48b0eda 100644 --- a/src/mame/shared/dcs.cpp +++ b/src/mame/shared/dcs.cpp @@ -599,7 +599,6 @@ TIMER_CALLBACK_MEMBER( dcs_audio_device::dcs_reset ) /* reset the HLE transfer states */ m_transfer.dcs_state = m_transfer.state = 0; - } diff --git a/src/mame/vsystem/aerofgt.cpp b/src/mame/vsystem/aerofgt.cpp index 9dc6d0ae205..352e785e989 100644 --- a/src/mame/vsystem/aerofgt.cpp +++ b/src/mame/vsystem/aerofgt.cpp @@ -83,11 +83,21 @@ void aerofgt_sound_cpu_state::karatblzbl_soundlatch_w(uint8_t data) m_audiocpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); } -uint8_t aerofgt_sound_cpu_state::pending_command_r() +uint8_t aerofgt_sound_cpu_state::soundlatch_pending_r() { return m_soundlatch->pending_r(); } +void aerofgt_sound_cpu_state::soundlatch_pending_w(int state) +{ + m_audiocpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); + + // sound comms is 2-way (see soundlatch_pending_r), + // NMI routine is very short, so briefly set perfect_quantum to make sure that the timing is right + if (state) + machine().scheduler().perfect_quantum(attotime::from_usec(100)); +} + void aerofgt_banked_sound_state::sh_bankswitch_w(uint8_t data) { m_soundbank->set_entry(data & 0x03); @@ -159,7 +169,7 @@ void aerofgt_banked_sound_state::pspikes_map(address_map &map) map(0xfff002, 0xfff003).portr("IN1"); map(0xfff003, 0xfff003).w(FUNC(aerofgt_banked_sound_state::pspikes_gfxbank_w)); map(0xfff004, 0xfff005).portr("DSW").w(FUNC(aerofgt_banked_sound_state::scrolly_w<0>)); - map(0xfff007, 0xfff007).r(FUNC(aerofgt_banked_sound_state::pending_command_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); + map(0xfff007, 0xfff007).r(FUNC(aerofgt_banked_sound_state::soundlatch_pending_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); map(0xfff400, 0xfff403).w("gga", FUNC(vsystem_gga_device::write)).umask16(0x00ff); } @@ -200,7 +210,7 @@ void aerofgt_sound_cpu_state::spikes91_map(address_map &map) map(0xfff002, 0xfff003).portr("IN1"); map(0xfff003, 0xfff003).w(FUNC(aerofgt_sound_cpu_state::pspikes_gfxbank_w)); map(0xfff004, 0xfff005).portr("DSW").w(FUNC(aerofgt_sound_cpu_state::scrolly_w<0>)); - map(0xfff007, 0xfff007).r(FUNC(aerofgt_sound_cpu_state::pending_command_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); + map(0xfff007, 0xfff007).r(FUNC(aerofgt_sound_cpu_state::soundlatch_pending_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); map(0xfff008, 0xfff009).w(FUNC(aerofgt_sound_cpu_state::spikes91_lookup_w)); } @@ -237,7 +247,7 @@ void aerofgt_sound_cpu_state::kickball_map(address_map &map) map(0xfff002, 0xfff003).portr("IN1"); map(0xfff003, 0xfff003).w(FUNC(aerofgt_sound_cpu_state::kickball_gfxbank_w)); map(0xfff004, 0xfff005).portr("DSW").w(FUNC(aerofgt_sound_cpu_state::scrolly_w<0>)); - map(0xfff007, 0xfff007).r(FUNC(aerofgt_sound_cpu_state::pending_command_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); + map(0xfff007, 0xfff007).r(FUNC(aerofgt_sound_cpu_state::soundlatch_pending_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); map(0xfff400, 0xfff403).nopw(); // GGA access } @@ -261,7 +271,7 @@ void aerofgt_banked_sound_state::karatblz_map(address_map &map) map(0x0ff006, 0x0ff007).portr("IN3"); map(0x0ff007, 0x0ff007).w(m_soundlatch, FUNC(generic_latch_8_device::write)); map(0x0ff008, 0x0ff009).portr("DSW").w(FUNC(aerofgt_banked_sound_state::scrollx_w<0>)); - map(0x0ff00b, 0x0ff00b).r(FUNC(aerofgt_banked_sound_state::pending_command_r)); + map(0x0ff00b, 0x0ff00b).r(FUNC(aerofgt_banked_sound_state::soundlatch_pending_r)); map(0x0ff00a, 0x0ff00b).w(FUNC(aerofgt_banked_sound_state::scrolly_w<0>)); map(0x0ff00c, 0x0ff00d).w(FUNC(aerofgt_banked_sound_state::scrollx_w<1>)); map(0x0ff00e, 0x0ff00f).w(FUNC(aerofgt_banked_sound_state::scrolly_w<1>)); @@ -288,7 +298,7 @@ void aerofgt_sound_cpu_state::karatblzbl_map(address_map &map) map(0x0ff006, 0x0ff007).portr("IN3"); map(0x0ff007, 0x0ff007).w(FUNC(aerofgt_sound_cpu_state::karatblzbl_soundlatch_w)); map(0x0ff008, 0x0ff009).portr("DSW").w(FUNC(aerofgt_sound_cpu_state::scrollx_w<0>)); - map(0x0ff00b, 0x0ff00b).r(FUNC(aerofgt_sound_cpu_state::pending_command_r)); + map(0x0ff00b, 0x0ff00b).r(FUNC(aerofgt_sound_cpu_state::soundlatch_pending_r)); map(0x0ff00a, 0x0ff00b).w(FUNC(aerofgt_sound_cpu_state::scrolly_w<0>)); map(0x0ff00c, 0x0ff00d).w(FUNC(aerofgt_sound_cpu_state::scrollx_w<1>)); map(0x0ff00e, 0x0ff00f).w(FUNC(aerofgt_sound_cpu_state::scrolly_w<1>)); @@ -332,7 +342,7 @@ void aerofgt_banked_sound_state::turbofrc_map(address_map &map) map(0x0ff001, 0x0ff001).w(FUNC(aerofgt_banked_sound_state::turbofrc_flip_screen_w)); map(0x0ff002, 0x0ff003).portr("IN1").w(FUNC(aerofgt_banked_sound_state::scrolly_w<0>)); map(0x0ff004, 0x0ff005).portr("DSW").w(FUNC(aerofgt_banked_sound_state::scrollx_w<1>)); - map(0x0ff007, 0x0ff007).r(FUNC(aerofgt_banked_sound_state::pending_command_r)); + map(0x0ff007, 0x0ff007).r(FUNC(aerofgt_banked_sound_state::soundlatch_pending_r)); map(0x0ff006, 0x0ff007).w(FUNC(aerofgt_banked_sound_state::scrolly_w<1>)); map(0x0ff008, 0x0ff009).portr("IN2"); map(0x0ff008, 0x0ff00b).w(FUNC(aerofgt_banked_sound_state::turbofrc_gfxbank_w)); @@ -356,7 +366,7 @@ void aerofgt_banked_sound_state::aerofgtb_map(address_map &map) map(0x0fe001, 0x0fe001).w(FUNC(aerofgt_banked_sound_state::turbofrc_flip_screen_w)); map(0x0fe002, 0x0fe003).portr("IN1").w(FUNC(aerofgt_banked_sound_state::scrolly_w<0>)); map(0x0fe004, 0x0fe005).portr("DSW1").w(FUNC(aerofgt_banked_sound_state::scrollx_w<1>)); - map(0x0fe007, 0x0fe007).r(FUNC(aerofgt_banked_sound_state::pending_command_r)); + map(0x0fe007, 0x0fe007).r(FUNC(aerofgt_banked_sound_state::soundlatch_pending_r)); map(0x0fe006, 0x0fe007).w(FUNC(aerofgt_banked_sound_state::scrolly_w<1>)); map(0x0fe008, 0x0fe009).portr("DSW2"); map(0x0fe008, 0x0fe00b).w(FUNC(aerofgt_banked_sound_state::turbofrc_gfxbank_w)); @@ -456,7 +466,7 @@ void aerofgt_sound_cpu_state::wbbc97_map(address_map &map) map(0xfff002, 0xfff003).portr("IN1"); map(0xfff003, 0xfff003).w(FUNC(aerofgt_sound_cpu_state::pspikes_gfxbank_w)); map(0xfff004, 0xfff005).portr("DSW").w(FUNC(aerofgt_sound_cpu_state::scrolly_w<0>)); - map(0xfff007, 0xfff007).r(FUNC(aerofgt_sound_cpu_state::pending_command_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); + map(0xfff007, 0xfff007).r(FUNC(aerofgt_sound_cpu_state::soundlatch_pending_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); map(0xfff00e, 0xfff00f).w(FUNC(aerofgt_sound_cpu_state::wbbc97_bitmap_enable_w)); map(0xfff400, 0xfff403).nopw(); // GGA access } @@ -1477,7 +1487,7 @@ void aerofgt_banked_sound_state::pspikes(machine_config &config) SPEAKER(config, "rspeaker").front_right(); GENERIC_LATCH_8(config, m_soundlatch); - m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); + m_soundlatch->data_pending_callback().set(FUNC(aerofgt_banked_sound_state::soundlatch_pending_w)); m_soundlatch->set_separate_acknowledge(true); ym2610_device &ymsnd(YM2610(config, "ymsnd", 8000000)); @@ -1598,7 +1608,7 @@ void aerofgt_sound_cpu_state::kickball(machine_config &config) SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch); - m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); + m_soundlatch->data_pending_callback().set(FUNC(aerofgt_sound_cpu_state::soundlatch_pending_w)); m_soundlatch->set_separate_acknowledge(true); ym3812_device &ymsnd(YM3812(config, "ymsnd", XTAL(4'000'000))); // K-666 (YM3812) @@ -1686,7 +1696,7 @@ void aerofgt_banked_sound_state::karatblz(machine_config &config) SPEAKER(config, "rspeaker").front_right(); GENERIC_LATCH_8(config, m_soundlatch); - m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); + m_soundlatch->data_pending_callback().set(FUNC(aerofgt_banked_sound_state::soundlatch_pending_w)); m_soundlatch->set_separate_acknowledge(true); ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(8'000'000))); /* verified on pcb */ @@ -1792,7 +1802,7 @@ void aerofgt_banked_sound_state::spinlbrk(machine_config &config) SPEAKER(config, "rspeaker").front_right(); GENERIC_LATCH_8(config, m_soundlatch); - m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); + m_soundlatch->data_pending_callback().set(FUNC(aerofgt_banked_sound_state::soundlatch_pending_w)); m_soundlatch->set_separate_acknowledge(true); ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(8'000'000))); /* verified on pcb */ @@ -1845,7 +1855,7 @@ void aerofgt_banked_sound_state::turbofrc(machine_config &config) SPEAKER(config, "rspeaker").front_right(); GENERIC_LATCH_8(config, m_soundlatch); - m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); + m_soundlatch->data_pending_callback().set(FUNC(aerofgt_banked_sound_state::soundlatch_pending_w)); m_soundlatch->set_separate_acknowledge(true); ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(8'000'000))); /* verified on pcb */ @@ -1898,7 +1908,7 @@ void aerofgt_banked_sound_state::aerofgtb(machine_config &config) SPEAKER(config, "rspeaker").front_right(); GENERIC_LATCH_8(config, m_soundlatch); - m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); + m_soundlatch->data_pending_callback().set(FUNC(aerofgt_banked_sound_state::soundlatch_pending_w)); m_soundlatch->set_separate_acknowledge(true); ym2610_device &ymsnd(YM2610(config, "ymsnd", 8000000)); @@ -1956,7 +1966,7 @@ void aerofgt_banked_sound_state::aerofgt(machine_config &config) SPEAKER(config, "rspeaker").front_right(); GENERIC_LATCH_8(config, m_soundlatch); - m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); + m_soundlatch->data_pending_callback().set(FUNC(aerofgt_banked_sound_state::soundlatch_pending_w)); m_soundlatch->set_separate_acknowledge(true); ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(8'000'000))); /* verified on pcb */ diff --git a/src/mame/vsystem/aerofgt.h b/src/mame/vsystem/aerofgt.h index 34993d1b4e2..530fb4807f2 100644 --- a/src/mame/vsystem/aerofgt.h +++ b/src/mame/vsystem/aerofgt.h @@ -142,7 +142,8 @@ protected: DECLARE_VIDEO_START(wbbc97); - uint8_t pending_command_r(); + uint8_t soundlatch_pending_r(); + void soundlatch_pending_w(int state); void spinlbrk_flip_screen_w(uint8_t data); uint32_t aerofgt_ol2_tile_callback(uint32_t code); diff --git a/src/mame/vsystem/crshrace.cpp b/src/mame/vsystem/crshrace.cpp index cee339f0cf1..85b52617627 100644 --- a/src/mame/vsystem/crshrace.cpp +++ b/src/mame/vsystem/crshrace.cpp @@ -213,6 +213,7 @@ private: uint32_t tile_callback(uint32_t code); void sh_bankswitch_w(uint8_t data); + void soundlatch_pending_w(int state); template void videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0) { COMBINE_DATA(&m_videoram[Which][offset]); m_tilemap[Which]->mark_tile_dirty(offset); } void roz_bank_w(offs_t offset, uint8_t data); void gfxctrl_w(offs_t offset, uint8_t data); @@ -259,7 +260,6 @@ TILE_GET_INFO_MEMBER(crshrace_state::get_bgtile_info) ***************************************************************************/ - uint32_t crshrace_state::tile_callback(uint32_t code) { return m_spriteram[1]->buffer()[code&0x7fff]; @@ -283,7 +283,6 @@ void crshrace_state::video_start() ***************************************************************************/ - void crshrace_state::roz_bank_w(offs_t offset, uint8_t data) { if (m_roz_bank != data) @@ -329,8 +328,6 @@ uint32_t crshrace_state::screen_update(screen_device &screen, bitmap_ind16 &bitm bitmap.fill(0x1ff, cliprect); - - switch (m_gfxctrl & 0xfb) { case 0x00: // high score screen @@ -359,6 +356,16 @@ void crshrace_state::sh_bankswitch_w(uint8_t data) m_z80bank->set_entry(data & 0x03); } +void crshrace_state::soundlatch_pending_w(int state) +{ + m_audiocpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); + + // sound comms is 2-way (see pending_r in "DSW2"), + // NMI routine is very short, so briefly set perfect_quantum to make sure that the timing is right + if (state) + machine().scheduler().perfect_quantum(attotime::from_usec(100)); +} + void crshrace_state::main_map(address_map &map) { @@ -544,7 +551,7 @@ static INPUT_PORTS_START( crshrace ) PORT_DIPSETTING( 0x0e00, "5" ) PORT_DIPSETTING( 0x0f00, "5" ) */ - PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("soundlatch", generic_latch_8_device, pending_r) // pending sound command + PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("soundlatch", generic_latch_8_device, pending_r) // pending sound command INPUT_PORTS_END // Same as 'crshrace', but additional "unknown" Dip Switch (see notes) @@ -635,7 +642,7 @@ void crshrace_state::crshrace(machine_config &config) // TODO: PCB sports 32 MHz SPEAKER(config, "rspeaker").front_right(); GENERIC_LATCH_8(config, m_soundlatch); - m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); + m_soundlatch->data_pending_callback().set(FUNC(crshrace_state::soundlatch_pending_w)); m_soundlatch->set_separate_acknowledge(true); ym2610_device &ymsnd(YM2610(config, "ymsnd", 8'000'000)); diff --git a/src/mame/vsystem/f1gp.cpp b/src/mame/vsystem/f1gp.cpp index eba5d8704c1..6ab299a99b3 100644 --- a/src/mame/vsystem/f1gp.cpp +++ b/src/mame/vsystem/f1gp.cpp @@ -122,7 +122,8 @@ protected: required_device m_acia; void sh_bankswitch_w(uint8_t data); - uint8_t command_pending_r(); + uint8_t soundlatch_pending_r(); + void soundlatch_pending_w(int state); void rozvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); void fgvideoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); void fgscroll_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); @@ -467,12 +468,21 @@ void f1gp_state::sh_bankswitch_w(uint8_t data) m_z80bank->set_entry(data & 0x01); } - -uint8_t f1gp_state::command_pending_r() +uint8_t f1gp_state::soundlatch_pending_r() { return (m_soundlatch->pending_r() ? 0xff : 0); } +void f1gp_state::soundlatch_pending_w(int state) +{ + m_audiocpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); + + // sound comms is 2-way (see soundlatch_pending_r), + // NMI routine is very short, so briefly set perfect_quantum to make sure that the timing is right + if (state) + machine().scheduler().perfect_quantum(attotime::from_usec(100)); +} + void f1gp_state::f1gp_cpu1_map(address_map &map) { @@ -495,7 +505,7 @@ void f1gp_state::f1gp_cpu1_map(address_map &map) map(0xfff004, 0xfff005).portr("DSW1"); map(0xfff002, 0xfff005).w(FUNC(f1gp_state::fgscroll_w)); map(0xfff006, 0xfff007).portr("DSW2"); - map(0xfff009, 0xfff009).r(FUNC(f1gp_state::command_pending_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); + map(0xfff009, 0xfff009).r(FUNC(f1gp_state::soundlatch_pending_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); map(0xfff020, 0xfff023).w("gga", FUNC(vsystem_gga_device::write)).umask16(0x00ff); map(0xfff040, 0xfff05f).w(m_k053936, FUNC(k053936_device::ctrl_w)); map(0xfff050, 0xfff051).portr("DSW3"); @@ -518,7 +528,7 @@ void f1gp2_state::f1gp2_cpu1_map(address_map &map) map(0xfff002, 0xfff003).portr("WHEEL"); map(0xfff004, 0xfff005).portr("DSW1"); map(0xfff006, 0xfff007).portr("DSW2"); - map(0xfff009, 0xfff009).r(FUNC(f1gp2_state::command_pending_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); + map(0xfff009, 0xfff009).r(FUNC(f1gp2_state::soundlatch_pending_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); map(0xfff00a, 0xfff00b).portr("DSW3"); map(0xfff020, 0xfff03f).w(m_k053936, FUNC(k053936_device::ctrl_w)); map(0xfff044, 0xfff047).w(FUNC(f1gp2_state::fgscroll_w)); @@ -844,7 +854,7 @@ void f1gp_state::f1gp(machine_config &config) SPEAKER(config, "rspeaker").front_right(); GENERIC_LATCH_8(config, m_soundlatch); - m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); + m_soundlatch->data_pending_callback().set(FUNC(f1gp_state::soundlatch_pending_w)); m_soundlatch->set_separate_acknowledge(true); ym2610_device &ymsnd(YM2610(config, "ymsnd", XTAL(8'000'000))); diff --git a/src/mame/vsystem/gstriker.cpp b/src/mame/vsystem/gstriker.cpp index aac65c42f10..81c17e0a3ce 100644 --- a/src/mame/vsystem/gstriker.cpp +++ b/src/mame/vsystem/gstriker.cpp @@ -379,8 +379,6 @@ GFXDECODE_END /*** MEMORY LAYOUTS **********************************************************/ - - void gstriker_state::twcup94_map(address_map &map) { map(0x000000, 0x0fffff).rom(); @@ -1277,7 +1275,6 @@ GAME( 1993, gstriker, 0, gstriker, gstriker, gstriker_state, empty_init, GAME( 1993, gstrikera, gstriker, gstriker, gstriker, gstriker_state, empty_init, ROT0, "Human", "Grand Striker (Americas)", MACHINE_NOT_WORKING | MACHINE_NODEVICE_LAN | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) GAME( 1993, gstrikerj, gstriker, gstriker, gstriker, gstriker_state, empty_init, ROT0, "Human", "Grand Striker (Japan)", MACHINE_NOT_WORKING | MACHINE_NODEVICE_LAN | MACHINE_IMPERFECT_GRAPHICS | MACHINE_SUPPORTS_SAVE ) - // Similar, but not identical hardware, appear to be protected by an MCU GAME( 1994, vgoalsoc, 0, vgoal, vgoalsoc, gstriker_state, init_vgoalsoc, ROT0, "Tecmo", "V Goal Soccer (Europe)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // has ger/hol/arg/bra/ita/eng/spa/fra GAME( 1994, vgoalsoca, vgoalsoc, vgoal, vgoalsoc, gstriker_state, init_vgoalsoc, ROT0, "Tecmo", "V Goal Soccer (US/Japan/Korea)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // has ger/hol/arg/bra/ita/kor/usa/jpn diff --git a/src/mame/vsystem/inufuku.cpp b/src/mame/vsystem/inufuku.cpp index 182daa7aac4..78a0012984c 100644 --- a/src/mame/vsystem/inufuku.cpp +++ b/src/mame/vsystem/inufuku.cpp @@ -110,12 +110,12 @@ public: , m_spr(*this, "vsystem_spr") , m_soundlatch(*this, "soundlatch") , m_sprattrram(*this, "sprattrram") - { } + { } void inufuku(machine_config &config); void _3on3dunk(machine_config &config); - int soundflag_r(); + int soundlatch_pending_r(); protected: virtual void machine_start() override; @@ -335,7 +335,7 @@ void inufuku_state::soundrombank_w(u8 data) ******************************************************************************/ -int inufuku_state::soundflag_r() +int inufuku_state::soundlatch_pending_r() { return m_soundlatch->pending_r() ? 0 : 1; } @@ -460,7 +460,7 @@ static INPUT_PORTS_START( inufuku ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read) - PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(inufuku_state, soundflag_r) // pending sound command + PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_MEMBER(inufuku_state, soundlatch_pending_r) // pending sound command PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN ) // 3on3dunk cares about something in here, possibly a vblank flag PORT_START( "EEPROMOUT" ) diff --git a/src/mame/vsystem/pipedrm.cpp b/src/mame/vsystem/pipedrm.cpp index a9096600b48..baa24151b39 100644 --- a/src/mame/vsystem/pipedrm.cpp +++ b/src/mame/vsystem/pipedrm.cpp @@ -201,7 +201,7 @@ protected: private: void bankswitch_w(uint8_t data); - uint8_t pending_command_r(); + uint8_t soundlatch_pending_r(); }; class pipedrm_state : public hatris_state @@ -273,7 +273,7 @@ void pipedrm_state::sound_bankswitch_w(uint8_t data) * *************************************/ -uint8_t hatris_state::pending_command_r() +uint8_t hatris_state::soundlatch_pending_r() { return m_soundlatch->pending_r(); } @@ -342,7 +342,7 @@ void hatris_state::main_portmap(address_map &map) map(0x22, 0x22).portr("DSW1"); map(0x23, 0x23).portr("DSW2"); map(0x24, 0x24).portr("SYSTEM"); - map(0x25, 0x25).r(FUNC(hatris_state::pending_command_r)); + map(0x25, 0x25).r(FUNC(hatris_state::soundlatch_pending_r)); } @@ -376,7 +376,7 @@ void hatris_state::sound_portmap(address_map &map) map.global_mask(0xff); map(0x00, 0x03).mirror(0x08).rw("ymsnd", FUNC(ym2608_device::read), FUNC(ym2608_device::write)); map(0x04, 0x04).r(m_soundlatch, FUNC(generic_latch_8_device::read)); - map(0x05, 0x05).r(FUNC(hatris_state::pending_command_r)).w(m_soundlatch, FUNC(generic_latch_8_device::acknowledge_w)); + map(0x05, 0x05).r(FUNC(hatris_state::soundlatch_pending_r)).w(m_soundlatch, FUNC(generic_latch_8_device::acknowledge_w)); } diff --git a/src/mame/vsystem/tail2nos.cpp b/src/mame/vsystem/tail2nos.cpp index 5e4ddb6a50e..462e62f6275 100644 --- a/src/mame/vsystem/tail2nos.cpp +++ b/src/mame/vsystem/tail2nos.cpp @@ -88,7 +88,8 @@ private: void zoomdata_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); void gfxbank_w(uint8_t data); void sound_bankswitch_w(uint8_t data); - uint8_t sound_semaphore_r(); + uint8_t soundlatch_pending_r(); + void soundlatch_pending_w(int state); TILE_GET_INFO_MEMBER(get_tile_info); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void postload(); @@ -269,11 +270,21 @@ uint32_t tail2nos_state::screen_update(screen_device &screen, bitmap_ind16 &bitm // machine -uint8_t tail2nos_state::sound_semaphore_r() +uint8_t tail2nos_state::soundlatch_pending_r() { return m_soundlatch->pending_r(); } +void tail2nos_state::soundlatch_pending_w(int state) +{ + m_audiocpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); + + // sound comms is 2-way (see soundlatch_pending_r), + // NMI routine is very short, so briefly set perfect_quantum to make sure that the timing is right + if (state) + machine().scheduler().perfect_quantum(attotime::from_usec(100)); +} + void tail2nos_state::sound_bankswitch_w(uint8_t data) { m_soundbank->set_entry(data & 0x01); @@ -296,7 +307,7 @@ void tail2nos_state::main_map(address_map &map) map(0xfff001, 0xfff001).w(FUNC(tail2nos_state::gfxbank_w)); map(0xfff002, 0xfff003).portr("IN1"); map(0xfff004, 0xfff005).portr("DSW"); - map(0xfff009, 0xfff009).r(FUNC(tail2nos_state::sound_semaphore_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); + map(0xfff009, 0xfff009).r(FUNC(tail2nos_state::soundlatch_pending_r)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff); map(0xfff020, 0xfff023).w("gga", FUNC(vsystem_gga_device::write)).umask16(0x00ff); map(0xfff030, 0xfff033).rw(m_acia, FUNC(acia6850_device::read), FUNC(acia6850_device::write)).umask16(0x00ff); } @@ -473,11 +484,11 @@ void tail2nos_state::machine_start() void tail2nos_state::tail2nos(machine_config &config) { // basic machine hardware - M68000(config, m_maincpu, XTAL(20'000'000) / 2); // verified on PCB + M68000(config, m_maincpu, XTAL(20'000'000) / 2); // verified on PCB m_maincpu->set_addrmap(AS_PROGRAM, &tail2nos_state::main_map); m_maincpu->set_vblank_int("screen", FUNC(tail2nos_state::irq6_line_hold)); - Z80(config, m_audiocpu, XTAL(20'000'000) / 4); // verified on PCB + Z80(config, m_audiocpu, XTAL(20'000'000) / 4); // verified on PCB m_audiocpu->set_addrmap(AS_PROGRAM, &tail2nos_state::sound_map); m_audiocpu->set_addrmap(AS_IO, &tail2nos_state::sound_port_map); // IRQs are triggered by the YM2608 @@ -513,10 +524,10 @@ void tail2nos_state::tail2nos(machine_config &config) SPEAKER(config, "rspeaker").front_right(); GENERIC_LATCH_8(config, m_soundlatch); - m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); + m_soundlatch->data_pending_callback().set(FUNC(tail2nos_state::soundlatch_pending_w)); m_soundlatch->set_separate_acknowledge(true); - ym2608_device &ymsnd(YM2608(config, "ymsnd", XTAL(8'000'000))); // verified on PCB + ym2608_device &ymsnd(YM2608(config, "ymsnd", XTAL(8'000'000))); // verified on PCB ymsnd.irq_handler().set_inputline(m_audiocpu, 0); ymsnd.port_b_write_callback().set(FUNC(tail2nos_state::sound_bankswitch_w)); ymsnd.add_route(0, "lspeaker", 0.25); diff --git a/src/mame/vsystem/taotaido.cpp b/src/mame/vsystem/taotaido.cpp index b49b4d9b895..0291baadcee 100644 --- a/src/mame/vsystem/taotaido.cpp +++ b/src/mame/vsystem/taotaido.cpp @@ -146,7 +146,8 @@ private: uint8_t m_bgbank[8]{}; tilemap_t *m_bg_tilemap = nullptr; - uint16_t pending_command_r(); + uint16_t soundlatch_pending_r(); + void soundlatch_pending_w(int state); void unknown_output_w(uint8_t data); void sh_bankswitch_w(uint8_t data); void spritebank_w(offs_t offset, uint8_t data); @@ -296,12 +297,22 @@ void taotaido_state::machine_start() } -uint16_t taotaido_state::pending_command_r() +uint16_t taotaido_state::soundlatch_pending_r() { // Only bit 0 is tested return m_soundlatch->pending_r(); } +void taotaido_state::soundlatch_pending_w(int state) +{ + m_audiocpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); + + // sound comms is 2-way (see soundlatch_pending_r), + // NMI routine is very short, so briefly set perfect_quantum to make sure that the timing is right + if (state) + machine().scheduler().perfect_quantum(attotime::from_usec(100)); +} + void taotaido_state::unknown_output_w(uint8_t data) { m_watchdog->write_line_ck(BIT(data, 7)); @@ -325,7 +336,7 @@ void taotaido_state::main_map(address_map &map) map(0xffff20, 0xffff21).nopw(); // unknown - flip screen related map(0xffff40, 0xffff47).w(FUNC(taotaido_state::spritebank_w)); map(0xffffc1, 0xffffc1).w(m_soundlatch, FUNC(generic_latch_8_device::write)); // seems right - map(0xffffe0, 0xffffe1).r(FUNC(taotaido_state::pending_command_r)); // guess - seems to be needed for all the sounds to work + map(0xffffe0, 0xffffe1).r(FUNC(taotaido_state::soundlatch_pending_r)); // guess - seems to be needed for all the sounds to work } // sound CPU - same as aerofgt @@ -596,7 +607,7 @@ void taotaido_state::taotaido(machine_config &config) SPEAKER(config, "rspeaker").front_right(); GENERIC_LATCH_8(config, m_soundlatch); - m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); + m_soundlatch->data_pending_callback().set(FUNC(taotaido_state::soundlatch_pending_w)); m_soundlatch->set_separate_acknowledge(true); ym2610_device &ymsnd(YM2610(config, "ymsnd", 8'000'000)); diff --git a/src/mame/vsystem/welltris.cpp b/src/mame/vsystem/welltris.cpp index 0ea89707b62..eb6b92aad3a 100644 --- a/src/mame/vsystem/welltris.cpp +++ b/src/mame/vsystem/welltris.cpp @@ -339,6 +339,7 @@ public: m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_spr_old(*this, "vsystem_spr_old"), + m_soundlatch(*this, "soundlatch"), m_gfxdecode(*this, "gfxdecode"), m_spriteram(*this, "spriteram"), m_pixelram(*this, "pixelram"), @@ -360,6 +361,7 @@ private: required_device m_maincpu; required_device m_audiocpu; required_device m_spr_old; + required_device m_soundlatch; required_device m_gfxdecode; required_shared_ptr m_spriteram; @@ -376,6 +378,7 @@ private: int m_scrolly; void sound_bankswitch_w(uint8_t data); + void soundlatch_pending_w(int state); void palette_bank_w(offs_t offset, uint8_t data); void gfxbank_w(offs_t offset, uint8_t data); void scrollreg_w(offs_t offset, uint16_t data); @@ -492,6 +495,16 @@ void welltris_state::sound_bankswitch_w(uint8_t data) m_soundbank->set_entry(data & 0x03); } +void welltris_state::soundlatch_pending_w(int state) +{ + m_audiocpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE); + + // sound comms is 2-way (see pending_r in "SYSTEM"), + // NMI routine is very short, so briefly set perfect_quantum to make sure that the timing is right + if (state) + machine().scheduler().perfect_quantum(attotime::from_usec(100)); +} + void welltris_state::main_map(address_map &map) { @@ -510,7 +523,7 @@ void welltris_state::main_map(address_map &map) map(0xfff004, 0xfff007).w(FUNC(welltris_state::scrollreg_w)); map(0xfff006, 0xfff007).portr("P4"); // right side controls map(0xfff008, 0xfff009).portr("SYSTEM"); // bit 5 tested at start of IRQ 1 */ - map(0xfff009, 0xfff009).w("soundlatch", FUNC(generic_latch_8_device::write)); + map(0xfff009, 0xfff009).w(m_soundlatch, FUNC(generic_latch_8_device::write)); map(0xfff00a, 0xfff00b).portr("EXTRA"); // P3+P4 coin + start buttons map(0xfff00c, 0xfff00d).portr("DSW1"); map(0xfff00e, 0xfff00f).portr("DSW2"); @@ -529,8 +542,8 @@ void welltris_state::sound_port_map(address_map &map) map.global_mask(0xff); map(0x00, 0x00).w(FUNC(welltris_state::sound_bankswitch_w)); map(0x08, 0x0b).rw("ymsnd", FUNC(ym2610_device::read), FUNC(ym2610_device::write)); - map(0x10, 0x10).r("soundlatch", FUNC(generic_latch_8_device::read)); - map(0x18, 0x18).w("soundlatch", FUNC(generic_latch_8_device::acknowledge_w)); + map(0x10, 0x10).r(m_soundlatch, FUNC(generic_latch_8_device::read)); + map(0x18, 0x18).w(m_soundlatch, FUNC(generic_latch_8_device::acknowledge_w)); } static INPUT_PORTS_START( welltris ) @@ -854,9 +867,9 @@ void welltris_state::welltris(machine_config &config) // sound hardware SPEAKER(config, "mono").front_center(); - generic_latch_8_device &soundlatch(GENERIC_LATCH_8(config, "soundlatch")); - soundlatch.data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); - soundlatch.set_separate_acknowledge(true); + GENERIC_LATCH_8(config, m_soundlatch); + m_soundlatch->data_pending_callback().set(FUNC(welltris_state::soundlatch_pending_w)); + m_soundlatch->set_separate_acknowledge(true); ym2610_device &ymsnd(YM2610(config, "ymsnd", 8000000)); ymsnd.irq_handler().set_inputline(m_audiocpu, 0);