cclimber, battles, crystal, ql, n64, ibmpcjr, tia: Miscellaneous machine().device and MCFG cleanups. (nw)

This commit is contained in:
mooglyguy 2018-05-28 17:42:12 +02:00
parent c92a6ba21c
commit 2fedd39d2b
19 changed files with 178 additions and 167 deletions

View File

@ -14,20 +14,8 @@
#include "sound/samples.h" #include "sound/samples.h"
//**************************************************************************
// GLOBAL VARIABLES
//**************************************************************************
DECLARE_DEVICE_TYPE(CCLIMBER_AUDIO, cclimber_audio_device) DECLARE_DEVICE_TYPE(CCLIMBER_AUDIO, cclimber_audio_device)
//**************************************************************************
// DEVICE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_CCLIMBER_AUDIO_ADD(_tag) \
MCFG_DEVICE_ADD(_tag, CCLIMBER_AUDIO, 0)
// ======================> cclimber_audio_device // ======================> cclimber_audio_device
class cclimber_audio_device : public device_t class cclimber_audio_device : public device_t

View File

@ -393,6 +393,7 @@ galaxian_sound_device::galaxian_sound_device(const machine_config &mconfig, cons
: device_t(mconfig, GALAXIAN, tag, owner, clock) : device_t(mconfig, GALAXIAN, tag, owner, clock)
, device_sound_interface(mconfig, *this) , device_sound_interface(mconfig, *this)
, m_lfo_val(0) , m_lfo_val(0)
, m_discrete(*this, GAL_AUDIO)
{ {
} }
@ -404,8 +405,6 @@ void galaxian_sound_device::device_start()
{ {
m_lfo_val = 0; m_lfo_val = 0;
m_discrete = machine().device<discrete_device>(GAL_AUDIO);
save_item(NAME(m_lfo_val)); save_item(NAME(m_lfo_val));
} }

View File

@ -35,7 +35,7 @@ protected:
private: private:
// internal state // internal state
uint8_t m_lfo_val; uint8_t m_lfo_val;
discrete_device *m_discrete; required_device<discrete_device> m_discrete;
}; };
DECLARE_DEVICE_TYPE(GALAXIAN, galaxian_sound_device) DECLARE_DEVICE_TYPE(GALAXIAN, galaxian_sound_device)

View File

@ -242,7 +242,6 @@ Dip location verified from manual for: cclimber, guzzler, swimmer
#include "audio/cclimber.h" #include "audio/cclimber.h"
#include "cpu/z80/z80.h" #include "cpu/z80/z80.h"
#include "machine/segacrpt_device.h"
#include "sound/ay8910.h" #include "sound/ay8910.h"
#include "sound/samples.h" #include "sound/samples.h"
#include "screen.h" #include "screen.h"
@ -1147,7 +1146,7 @@ MACHINE_CONFIG_START(cclimber_state::cclimber)
/* sound hardware */ /* sound hardware */
SPEAKER(config, "speaker").front_center(); SPEAKER(config, "speaker").front_center();
MCFG_CCLIMBER_AUDIO_ADD("cclimber_audio") MCFG_DEVICE_ADD("cclimber_audio", CCLIMBER_AUDIO, 0)
MACHINE_CONFIG_END MACHINE_CONFIG_END
MACHINE_CONFIG_START(cclimber_state::cclimberx) MACHINE_CONFIG_START(cclimber_state::cclimberx)
@ -2669,18 +2668,8 @@ void cclimber_state::init_toprollr()
{ {
m_opcodes = std::make_unique<uint8_t[]>(0x6000*3); m_opcodes = std::make_unique<uint8_t[]>(0x6000*3);
segacrpt_z80_device* cpu = (segacrpt_z80_device*)machine().device(":maincpu"); m_encrypted_cpu->set_region_p(memregion("user1")->base());
m_encrypted_cpu->set_decrypted_p(m_opcodes.get());
// this seems to be a messy abuse / use of the encryption, investigate
if (!cpu)
{
fatalerror("can't find cpu!\n");
}
else
{
cpu->set_region_p(memregion("user1")->base());
cpu->set_decrypted_p(m_opcodes.get());
}
membank("bank1")->configure_entries(0, 3, memregion("user1")->base(), 0x6000); membank("bank1")->configure_entries(0, 3, memregion("user1")->base(), 0x6000);
membank("bank1d")->configure_entries(0, 3, m_opcodes.get(), 0x6000); membank("bank1d")->configure_entries(0, 3, m_opcodes.get(), 0x6000);

View File

@ -251,6 +251,7 @@ public:
m_reset_patch(*this, "reset_patch"), m_reset_patch(*this, "reset_patch"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_vr0(*this, "vr0"), m_vr0(*this, "vr0"),
m_video(*this, "vrender"),
m_ds1302(*this, "rtc"), m_ds1302(*this, "rtc"),
m_screen(*this, "screen") m_screen(*this, "screen")
{ } { }
@ -266,6 +267,7 @@ public:
/* devices */ /* devices */
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<vr0video_device> m_vr0; required_device<vr0video_device> m_vr0;
required_device<vrender0_device> m_video;
required_device<ds1302_device> m_ds1302; required_device<ds1302_device> m_ds1302;
required_device<screen_device> m_screen; required_device<screen_device> m_screen;
@ -928,8 +930,6 @@ void crystal_state::machine_start()
void crystal_state::machine_reset() void crystal_state::machine_reset()
{ {
int i;
memset(m_sysregs, 0, 0x10000); memset(m_sysregs, 0, 0x10000);
memset(m_vidregs, 0, 0x10000); memset(m_vidregs, 0, 0x10000);
@ -943,13 +943,13 @@ void crystal_state::machine_reset()
m_DMActrl[0] = 0; m_DMActrl[0] = 0;
m_DMActrl[1] = 0; m_DMActrl[1] = 0;
for (i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
*TimerRegsPtr(i) = 0xff << 8; *TimerRegsPtr(i) = 0xff << 8;
m_Timer[i]->adjust(attotime::never); m_Timer[i]->adjust(attotime::never);
} }
machine().device<vrender0_device>("vrender")->set_areas(m_textureram, m_frameram); m_video->set_areas(m_textureram, m_frameram);
#ifdef IDLE_LOOP_SPEEDUP #ifdef IDLE_LOOP_SPEEDUP
m_FlipCntRead = 0; m_FlipCntRead = 0;
#endif #endif
@ -1503,8 +1503,7 @@ MACHINE_CONFIG_START(crystal_state::crystal)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, crystal_state, screen_vblank_crystal)) MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, crystal_state, screen_vblank_crystal))
MCFG_SCREEN_PALETTE("palette") MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("vr0", VIDEO_VRENDER0, 0) MCFG_DEVICE_ADD("vr0", VIDEO_VRENDER0, 0, "maincpu")
MCFG_VIDEO_VRENDER0_CPU("maincpu")
MCFG_PALETTE_ADD_RRRRRGGGGGGBBBBB("palette") MCFG_PALETTE_ADD_RRRRRGGGGGGBBBBB("palette")

View File

@ -825,10 +825,15 @@ void galaga_state::machine_reset()
m_cpu3_interrupt_timer->adjust(m_screen->time_until_pos(64), 64); m_cpu3_interrupt_timer->adjust(m_screen->time_until_pos(64), 64);
} }
MACHINE_RESET_MEMBER(xevious_state,battles) void battles_state::machine_reset()
{ {
galaga_state::machine_reset(); galaga_state::machine_reset();
battles_customio_init();
m_customio_command = 0;
m_customio_prev_command = 0;
m_customio_command_count = 0;
m_customio_data = 0;
m_sound_played = 0;
} }
@ -927,14 +932,14 @@ void galaga_state::galaga_mem4(address_map &map)
map(0x1000, 0x107f).ram(); map(0x1000, 0x107f).ram();
} }
void xevious_state::battles_mem4(address_map &map) void battles_state::battles_mem4(address_map &map)
{ {
map(0x0000, 0x0fff).rom(); map(0x0000, 0x0fff).rom();
map(0x4000, 0x4003).r(this, FUNC(xevious_state::battles_input_port_r)); map(0x4000, 0x4003).r(this, FUNC(battles_state::input_port_r));
map(0x4001, 0x4001).w(this, FUNC(xevious_state::battles_CPU4_coin_w)); map(0x4001, 0x4001).w(this, FUNC(battles_state::cpu4_coin_w));
map(0x5000, 0x5000).w(this, FUNC(xevious_state::battles_noise_sound_w)); map(0x5000, 0x5000).w(this, FUNC(battles_state::noise_sound_w));
map(0x6000, 0x6000).rw(this, FUNC(xevious_state::battles_customio3_r), FUNC(xevious_state::battles_customio3_w)); map(0x6000, 0x6000).rw(this, FUNC(battles_state::customio3_r), FUNC(battles_state::customio3_w));
map(0x7000, 0x7000).rw(this, FUNC(xevious_state::battles_customio_data3_r), FUNC(xevious_state::battles_customio_data3_w)); map(0x7000, 0x7000).rw(this, FUNC(battles_state::customio_data3_r), FUNC(battles_state::customio_data3_w));
map(0x8000, 0x80ff).ram(); map(0x8000, 0x80ff).ram();
} }
@ -1835,11 +1840,10 @@ MACHINE_CONFIG_START(xevious_state::xevious)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.90)
MACHINE_CONFIG_END MACHINE_CONFIG_END
MACHINE_CONFIG_START(xevious_state::battles) MACHINE_CONFIG_START(battles_state::battles)
xevious(config); xevious(config);
/* basic machine hardware */ /* basic machine hardware */
MCFG_DEVICE_REMOVE("50xx") MCFG_DEVICE_REMOVE("50xx")
MCFG_DEVICE_REMOVE("54xx") MCFG_DEVICE_REMOVE("54xx")
MCFG_DEVICE_REMOVE("06xx") MCFG_DEVICE_REMOVE("06xx")
@ -1855,11 +1859,9 @@ MACHINE_CONFIG_START(xevious_state::battles)
MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, galaga_state, vblank_irq)) MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, galaga_state, vblank_irq))
MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, xevious_state, battles_interrupt_4)) MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, battles_state, interrupt_4))
MCFG_TIMER_DRIVER_ADD("battles_nmi", xevious_state, battles_nmi_generate) MCFG_TIMER_DRIVER_ADD("nmi", battles_state, nmi_generate)
MCFG_MACHINE_RESET_OVERRIDE(xevious_state,battles)
/* sound hardware */ /* sound hardware */
MCFG_DEVICE_REMOVE("discrete") MCFG_DEVICE_REMOVE("discrete")
@ -3451,11 +3453,11 @@ void xevious_state::init_xevios()
} }
void xevious_state::init_battles() void battles_state::driver_init()
{ {
/* replace the Namco I/O handlers with interface to the 4th CPU */ /* replace the Namco I/O handlers with interface to the 4th CPU */
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x7000, 0x700f, read8_delegate(FUNC(xevious_state::battles_customio_data0_r),this), write8_delegate(FUNC(xevious_state::battles_customio_data0_w),this) ); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x7000, 0x700f, read8_delegate(FUNC(battles_state::customio_data0_r),this), write8_delegate(FUNC(battles_state::customio_data0_w),this) );
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x7100, 0x7100, read8_delegate(FUNC(xevious_state::battles_customio0_r),this), write8_delegate(FUNC(xevious_state::battles_customio0_w),this) ); m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x7100, 0x7100, read8_delegate(FUNC(battles_state::customio0_r),this), write8_delegate(FUNC(battles_state::customio0_w),this) );
init_xevious(); init_xevious();
} }
@ -3496,7 +3498,7 @@ GAME( 1984, gatsbee, galaga, gatsbee, gatsbee, galaga_state, init_galaga,
GAME( 1981, nebulbee, galaga, galagab, galaga, galaga_state, init_galaga, ROT90, "bootleg", "Nebulous Bee", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND ) GAME( 1981, nebulbee, galaga, galagab, galaga, galaga_state, init_galaga, ROT90, "bootleg", "Nebulous Bee", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_GRAPHICS | MACHINE_IMPERFECT_SOUND )
GAME( 1982, xevios, xevious, xevious, xevious, xevious_state, init_xevios, ROT90, "bootleg", "Xevios", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1982, xevios, xevious, xevious, xevious, xevious_state, init_xevios, ROT90, "bootleg", "Xevios", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1982, battles, xevious, battles, xevious, xevious_state, init_battles, ROT90, "bootleg", "Battles (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1982, battles, xevious, battles, xevious, battles_state, driver_init, ROT90, "bootleg", "Battles (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1982, battles2, xevious, xevious, xevious, xevious_state, init_xevios, ROT90, "bootleg", "Battles (set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE ) GAME( 1982, battles2, xevious, xevious, xevious, xevious_state, init_xevios, ROT90, "bootleg", "Battles (set 2)", MACHINE_IMPERFECT_SOUND | MACHINE_SUPPORTS_SAVE )
GAME( 1982, dzigzag, digdug, dzigzag, digdug, digdug_state, empty_init, ROT90, "bootleg", "Zig Zag (Dig Dug hardware)", MACHINE_SUPPORTS_SAVE ) GAME( 1982, dzigzag, digdug, dzigzag, digdug, digdug_state, empty_init, ROT90, "bootleg", "Zig Zag (Dig Dug hardware)", MACHINE_SUPPORTS_SAVE )

View File

@ -662,7 +662,6 @@ TODO:
#include "cpu/s2650/s2650.h" #include "cpu/s2650/s2650.h"
#include "cpu/z80/z80.h" #include "cpu/z80/z80.h"
#include "machine/watchdog.h" #include "machine/watchdog.h"
#include "sound/discrete.h"
#include "sound/sn76496.h" #include "sound/sn76496.h"
#include "sound/volt_reg.h" #include "sound/volt_reg.h"
#include "screen.h" #include "screen.h"
@ -828,23 +827,23 @@ READ8_MEMBER(galaxian_state::konami_sound_timer_r)
WRITE8_MEMBER(galaxian_state::konami_sound_filter_w) WRITE8_MEMBER(galaxian_state::konami_sound_filter_w)
{ {
discrete_device *discrete = machine().device<discrete_device>("konami");
static const char *const ayname[2] = { "8910.0", "8910.1" };
int which, chan;
/* the offset is used as data, 6 channels * 2 bits each */ /* the offset is used as data, 6 channels * 2 bits each */
/* AV0 .. AV5 ==> AY8910 #2 */ /* AV0 .. AV5 ==> AY8910 #2 */
/* AV6 .. AV11 ==> AY8910 #1 */ /* AV6 .. AV11 ==> AY8910 #1 */
for (which = 0; which < 2; which++) for (int which = 0; which < 2; which++)
if (machine().device(ayname[which]) != nullptr) {
for (chan = 0; chan < 3; chan++) if (m_ay8910[which] != nullptr)
{
for (int chan = 0; chan < 3; chan++)
{ {
uint8_t bits = (offset >> (2 * chan + 6 * (1 - which))) & 3; uint8_t bits = (offset >> (2 * chan + 6 * (1 - which))) & 3;
/* low bit goes to 0.22uF capacitor = 220000pF */ /* low bit goes to 0.22uF capacitor = 220000pF */
/* high bit goes to 0.047uF capacitor = 47000pF */ /* high bit goes to 0.047uF capacitor = 47000pF */
discrete->write(space, NODE(3 * which + chan + 11), bits); m_discrete->write(space, NODE(3 * which + chan + 11), bits);
} }
}
}
} }
@ -6082,7 +6081,7 @@ MACHINE_CONFIG_START(galaxian_state::mshuttle)
MCFG_DEVICE_IO_MAP(mshuttle_portmap) MCFG_DEVICE_IO_MAP(mshuttle_portmap)
/* sound hardware */ /* sound hardware */
MCFG_CCLIMBER_AUDIO_ADD("cclimber_audio") MCFG_DEVICE_ADD("cclimber_audio", CCLIMBER_AUDIO, 0)
MACHINE_CONFIG_END MACHINE_CONFIG_END

View File

@ -922,8 +922,7 @@ MACHINE_CONFIG_START(ql_state::ql)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
// devices // devices
MCFG_DEVICE_ADD(ZX8301_TAG, ZX8301, X1) MCFG_DEVICE_ADD(ZX8301_TAG, ZX8301, X1, M68008_TAG)
MCFG_ZX8301_CPU(M68008_TAG)
MCFG_ZX8301_VSYNC_CALLBACK(WRITELINE(ZX8302_TAG, zx8302_device, vsync_w)) MCFG_ZX8301_VSYNC_CALLBACK(WRITELINE(ZX8302_TAG, zx8302_device, vsync_w))
MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) MCFG_VIDEO_SET_SCREEN(SCREEN_TAG)

View File

@ -3,6 +3,7 @@
#include "machine/74259.h" #include "machine/74259.h"
#include "machine/gen_latch.h" #include "machine/gen_latch.h"
#include "machine/segacrpt_device.h"
class cclimber_state : public driver_device class cclimber_state : public driver_device
{ {
@ -11,6 +12,7 @@ public:
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"), m_audiocpu(*this, "audiocpu"),
m_encrypted_cpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"), m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"), m_palette(*this, "palette"),
m_mainlatch(*this, "mainlatch"), m_mainlatch(*this, "mainlatch"),
@ -24,10 +26,12 @@ public:
m_swimmer_background_color(*this, "bgcolor"), m_swimmer_background_color(*this, "bgcolor"),
m_toprollr_bg_videoram(*this, "bg_videoram"), m_toprollr_bg_videoram(*this, "bg_videoram"),
m_toprollr_bg_coloram(*this, "bg_coloram"), m_toprollr_bg_coloram(*this, "bg_coloram"),
m_decrypted_opcodes(*this, "decrypted_opcodes") { } m_decrypted_opcodes(*this, "decrypted_opcodes")
{ }
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu; optional_device<cpu_device> m_audiocpu;
optional_device<segacrpt_z80_device> m_encrypted_cpu;
required_device<gfxdecode_device> m_gfxdecode; required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette; required_device<palette_device> m_palette;
required_device<ls259_device> m_mainlatch; required_device<ls259_device> m_mainlatch;

View File

@ -12,6 +12,7 @@
#include "sound/ay8910.h" #include "sound/ay8910.h"
#include "sound/dac.h" #include "sound/dac.h"
#include "sound/digitalk.h" #include "sound/digitalk.h"
#include "sound/discrete.h"
#include "screen.h" #include "screen.h"
/* we scale horizontally by 3 to render stars correctly */ /* we scale horizontally by 3 to render stars correctly */
@ -53,6 +54,7 @@ public:
, m_screen(*this, "screen") , m_screen(*this, "screen")
, m_palette(*this, "palette") , m_palette(*this, "palette")
, m_soundlatch(*this, "soundlatch") , m_soundlatch(*this, "soundlatch")
, m_discrete(*this, "konami")
, m_fake_select(*this, "FAKE_SELECT") , m_fake_select(*this, "FAKE_SELECT")
, m_tenspot_game_dsw(*this, {"IN2_GAME0", "IN2_GAME1", "IN2_GAME2", "IN2_GAME3", "IN2_GAME4", "IN2_GAME5", "IN2_GAME6", "IN2_GAME7", "IN2_GAME8", "IN2_GAME9"}) , m_tenspot_game_dsw(*this, {"IN2_GAME0", "IN2_GAME1", "IN2_GAME2", "IN2_GAME3", "IN2_GAME4", "IN2_GAME5", "IN2_GAME6", "IN2_GAME7", "IN2_GAME8", "IN2_GAME9"})
, m_spriteram(*this, "spriteram") , m_spriteram(*this, "spriteram")
@ -379,6 +381,7 @@ protected:
required_device<screen_device> m_screen; required_device<screen_device> m_screen;
required_device<palette_device> m_palette; required_device<palette_device> m_palette;
optional_device<generic_latch_8_device> m_soundlatch; optional_device<generic_latch_8_device> m_soundlatch;
optional_device<discrete_device> m_discrete;
optional_ioport m_fake_select; optional_ioport m_fake_select;
optional_ioport_array<10> m_tenspot_game_dsw; optional_ioport_array<10> m_tenspot_game_dsw;

View File

@ -1,6 +1,11 @@
// license:BSD-3-Clause // license:BSD-3-Clause
// copyright-holders:Nicola Salmoria // copyright-holders:Nicola Salmoria
#ifndef MAME_INCLUDES_XEVIOUS
#define MAME_INCLUDES_XEVIOUS
#pragma once
#include "machine/timer.h" #include "machine/timer.h"
class xevious_state : public galaga_state class xevious_state : public galaga_state
@ -30,16 +35,12 @@ public:
int32_t m_xevious_bs[2]; int32_t m_xevious_bs[2];
void init_xevious(); void init_xevious();
void init_xevios(); void init_xevios();
void init_battles();
TILE_GET_INFO_MEMBER(get_fg_tile_info); TILE_GET_INFO_MEMBER(get_fg_tile_info);
TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_bg_tile_info);
DECLARE_VIDEO_START(xevious); DECLARE_VIDEO_START(xevious);
DECLARE_PALETTE_INIT(xevious); DECLARE_PALETTE_INIT(xevious);
DECLARE_MACHINE_RESET(xevios); DECLARE_MACHINE_RESET(xevios);
DECLARE_MACHINE_RESET(battles);
uint32_t screen_update_xevious(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); uint32_t screen_update_xevious(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(battles_interrupt_4);
TIMER_DEVICE_CALLBACK_MEMBER(battles_nmi_generate);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
DECLARE_WRITE8_MEMBER( xevious_fg_videoram_w ); DECLARE_WRITE8_MEMBER( xevious_fg_videoram_w );
DECLARE_WRITE8_MEMBER( xevious_fg_colorram_w ); DECLARE_WRITE8_MEMBER( xevious_fg_colorram_w );
@ -49,32 +50,54 @@ public:
DECLARE_WRITE8_MEMBER( xevious_bs_w ); DECLARE_WRITE8_MEMBER( xevious_bs_w );
DECLARE_READ8_MEMBER( xevious_bb_r ); DECLARE_READ8_MEMBER( xevious_bb_r );
// Custom I/O
void battles_customio_init();
DECLARE_READ8_MEMBER( battles_customio0_r );
DECLARE_READ8_MEMBER( battles_customio_data0_r );
DECLARE_READ8_MEMBER( battles_customio3_r );
DECLARE_READ8_MEMBER( battles_customio_data3_r );
DECLARE_READ8_MEMBER( battles_input_port_r );
DECLARE_WRITE8_MEMBER( battles_customio0_w );
DECLARE_WRITE8_MEMBER( battles_customio_data0_w );
DECLARE_WRITE8_MEMBER( battles_customio3_w );
DECLARE_WRITE8_MEMBER( battles_customio_data3_w );
DECLARE_WRITE8_MEMBER( battles_CPU4_coin_w );
DECLARE_WRITE8_MEMBER( battles_noise_sound_w );
uint8_t m_customio[16];
char m_battles_customio_command;
char m_battles_customio_prev_command;
char m_battles_customio_command_count;
char m_battles_customio_data;
char m_battles_sound_played;
optional_device<cpu_device> m_subcpu3; optional_device<cpu_device> m_subcpu3;
void xevious(machine_config &config); void xevious(machine_config &config);
void battles(machine_config &config);
void battles_mem4(address_map &map);
void xevious_map(address_map &map); void xevious_map(address_map &map);
}; };
class battles_state : public xevious_state
{
public:
battles_state(const machine_config &mconfig, device_type type, const char *tag)
: xevious_state(mconfig, type, tag),
m_nmi_timer(*this, "nmi")
{
}
void driver_init() override;
void battles(machine_config &config);
protected:
void machine_reset() override;
DECLARE_WRITE_LINE_MEMBER(interrupt_4);
TIMER_DEVICE_CALLBACK_MEMBER(nmi_generate);
void battles_mem4(address_map &map);
// Custom I/O
DECLARE_READ8_MEMBER( customio0_r );
DECLARE_READ8_MEMBER( customio_data0_r );
DECLARE_READ8_MEMBER( customio3_r );
DECLARE_READ8_MEMBER( customio_data3_r );
DECLARE_READ8_MEMBER( input_port_r );
DECLARE_WRITE8_MEMBER( customio0_w );
DECLARE_WRITE8_MEMBER( customio_data0_w );
DECLARE_WRITE8_MEMBER( customio3_w );
DECLARE_WRITE8_MEMBER( customio_data3_w );
DECLARE_WRITE8_MEMBER( cpu4_coin_w );
DECLARE_WRITE8_MEMBER( noise_sound_w );
required_device<timer_device> m_nmi_timer;
uint8_t m_customio[16];
char m_customio_command;
char m_customio_prev_command;
char m_customio_command_count;
char m_customio_data;
char m_sound_played;
};
#endif // MAME_INCLUDES_XEVIOUS

View File

@ -20,23 +20,13 @@
***************************************************************************/ ***************************************************************************/
void xevious_state::battles_customio_init() TIMER_DEVICE_CALLBACK_MEMBER(battles_state::nmi_generate)
{ {
m_battles_customio_command = 0; m_customio_prev_command = m_customio_command;
m_battles_customio_prev_command = 0;
m_battles_customio_command_count = 0;
m_battles_customio_data = 0;
m_battles_sound_played = 0;
}
if( m_customio_command & 0x10 )
TIMER_DEVICE_CALLBACK_MEMBER(xevious_state::battles_nmi_generate)
{
m_battles_customio_prev_command = m_battles_customio_command;
if( m_battles_customio_command & 0x10 )
{ {
if( m_battles_customio_command_count == 0 ) if( m_customio_command_count == 0 )
{ {
m_subcpu3->pulse_input_line(INPUT_LINE_NMI, attotime::zero); m_subcpu3->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
} }
@ -51,29 +41,29 @@ TIMER_DEVICE_CALLBACK_MEMBER(xevious_state::battles_nmi_generate)
m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
m_subcpu3->pulse_input_line(INPUT_LINE_NMI, attotime::zero); m_subcpu3->pulse_input_line(INPUT_LINE_NMI, attotime::zero);
} }
m_battles_customio_command_count++; m_customio_command_count++;
} }
READ8_MEMBER( xevious_state::battles_customio0_r ) READ8_MEMBER( battles_state::customio0_r )
{ {
logerror("%s: custom I/O Read = %02x\n", machine().describe_context(), m_battles_customio_command); logerror("%s: custom I/O Read = %02x\n", machine().describe_context(), m_customio_command);
return m_battles_customio_command; return m_customio_command;
} }
READ8_MEMBER( xevious_state::battles_customio3_r ) READ8_MEMBER( battles_state::customio3_r )
{ {
int return_data; int return_data;
if( m_subcpu3->pc() == 0xAE ){ if( m_subcpu3->pc() == 0xAE ){
/* CPU4 0xAA - 0xB9 : waiting for MB8851 ? */ /* CPU4 0xAA - 0xB9 : waiting for MB8851 ? */
return_data = ( (m_battles_customio_command & 0x10) << 3) return_data = ( (m_customio_command & 0x10) << 3)
| 0x00 | 0x00
| (m_battles_customio_command & 0x0f); | (m_customio_command & 0x0f);
}else{ }else{
return_data = ( (m_battles_customio_prev_command & 0x10) << 3) return_data = ( (m_customio_prev_command & 0x10) << 3)
| 0x60 | 0x60
| (m_battles_customio_prev_command & 0x0f); | (m_customio_prev_command & 0x0f);
} }
logerror("%s: custom I/O Read = %02x\n", machine().describe_context(), return_data); logerror("%s: custom I/O Read = %02x\n", machine().describe_context(), return_data);
@ -81,62 +71,60 @@ READ8_MEMBER( xevious_state::battles_customio3_r )
} }
WRITE8_MEMBER( xevious_state::battles_customio0_w ) WRITE8_MEMBER( battles_state::customio0_w )
{ {
timer_device *timer = machine().device<timer_device>("battles_nmi");
logerror("%s: custom I/O Write = %02x\n", machine().describe_context(), data); logerror("%s: custom I/O Write = %02x\n", machine().describe_context(), data);
m_battles_customio_command = data; m_customio_command = data;
m_battles_customio_command_count = 0; m_customio_command_count = 0;
switch (data) switch (data)
{ {
case 0x10: case 0x10:
timer->reset(); m_nmi_timer->reset();
return; /* nop */ return; /* nop */
} }
timer->adjust(attotime::from_usec(166), 0, attotime::from_usec(166)); m_nmi_timer->adjust(attotime::from_usec(166), 0, attotime::from_usec(166));
} }
WRITE8_MEMBER( xevious_state::battles_customio3_w ) WRITE8_MEMBER( battles_state::customio3_w )
{ {
logerror("%s: custom I/O Write = %02x\n", machine().describe_context(), data); logerror("%s: custom I/O Write = %02x\n", machine().describe_context(), data);
m_battles_customio_command = data; m_customio_command = data;
} }
READ8_MEMBER( xevious_state::battles_customio_data0_r ) READ8_MEMBER( battles_state::customio_data0_r )
{ {
logerror("%s: custom I/O parameter %02x Read = %02x\n", machine().describe_context(), offset, m_battles_customio_data); logerror("%s: custom I/O parameter %02x Read = %02x\n", machine().describe_context(), offset, m_customio_data);
return m_battles_customio_data; return m_customio_data;
} }
READ8_MEMBER( xevious_state::battles_customio_data3_r ) READ8_MEMBER( battles_state::customio_data3_r )
{ {
logerror("%s: custom I/O parameter %02x Read = %02x\n", machine().describe_context(), offset, m_battles_customio_data); logerror("%s: custom I/O parameter %02x Read = %02x\n", machine().describe_context(), offset, m_customio_data);
return m_battles_customio_data; return m_customio_data;
} }
WRITE8_MEMBER( xevious_state::battles_customio_data0_w ) WRITE8_MEMBER( battles_state::customio_data0_w )
{ {
logerror("%s: custom I/O parameter %02x Write = %02x\n", machine().describe_context(), offset, data); logerror("%s: custom I/O parameter %02x Write = %02x\n", machine().describe_context(), offset, data);
m_battles_customio_data = data; m_customio_data = data;
} }
WRITE8_MEMBER( xevious_state::battles_customio_data3_w ) WRITE8_MEMBER( battles_state::customio_data3_w )
{ {
logerror("%s: custom I/O parameter %02x Write = %02x\n", machine().describe_context(), offset, data); logerror("%s: custom I/O parameter %02x Write = %02x\n", machine().describe_context(), offset, data);
m_battles_customio_data = data; m_customio_data = data;
} }
WRITE8_MEMBER( xevious_state::battles_CPU4_coin_w ) WRITE8_MEMBER( battles_state::cpu4_coin_w )
{ {
m_leds[0] = BIT(data, 1); // Start 1 m_leds[0] = BIT(data, 1); // Start 1
m_leds[1] = BIT(data, 0); // Start 2 m_leds[1] = BIT(data, 0); // Start 2
@ -147,10 +135,10 @@ WRITE8_MEMBER( xevious_state::battles_CPU4_coin_w )
} }
WRITE8_MEMBER( xevious_state::battles_noise_sound_w ) WRITE8_MEMBER( battles_state::noise_sound_w )
{ {
logerror("%s: 50%02x Write = %02x\n", machine().describe_context(), offset, data); logerror("%s: 50%02x Write = %02x\n", machine().describe_context(), offset, data);
if( (m_battles_sound_played == 0) && (data == 0xFF) ){ if( (m_sound_played == 0) && (data == 0xFF) ){
if( m_customio[0] == 0x40 ){ if( m_customio[0] == 0x40 ){
m_samples->start(0, 0); m_samples->start(0, 0);
} }
@ -158,11 +146,11 @@ WRITE8_MEMBER( xevious_state::battles_noise_sound_w )
m_samples->start(0, 1); m_samples->start(0, 1);
} }
} }
m_battles_sound_played = data; m_sound_played = data;
} }
READ8_MEMBER( xevious_state::battles_input_port_r ) READ8_MEMBER( battles_state::input_port_r )
{ {
switch ( offset ) switch ( offset )
{ {
@ -175,7 +163,7 @@ READ8_MEMBER( xevious_state::battles_input_port_r )
} }
WRITE_LINE_MEMBER(xevious_state::battles_interrupt_4) WRITE_LINE_MEMBER(battles_state::interrupt_4)
{ {
if (state) if (state)
m_subcpu3->set_input_line(0, HOLD_LINE); m_subcpu3->set_input_line(0, HOLD_LINE);

View File

@ -112,16 +112,14 @@ void n64_state::video_start()
uint32_t n64_state::screen_update_n64(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) uint32_t n64_state::screen_update_n64(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{ {
n64_periphs* n64 = machine().device<n64_periphs>("rcp"); //uint16_t* frame_buffer = (uint16_t*)&rdram[(m_rcp_periphs->vi_origin & 0xffffff) >> 2];
//uint8_t* cvg_buffer = &m_rdp.m_hidden_bits[((m_rcp_periphs->vi_origin & 0xffffff) >> 2) >> 1];
//uint16_t* frame_buffer = (uint16_t*)&rdram[(n64->vi_origin & 0xffffff) >> 2]; //int32_t vibuffering = ((m_rcp_periphs->vi_control & 2) && fsaa && divot);
//uint8_t* cvg_buffer = &m_rdp.m_hidden_bits[((n64->vi_origin & 0xffffff) >> 2) >> 1];
//int32_t vibuffering = ((n64->vi_control & 2) && fsaa && divot);
//vibuffering = 0; // Disabled for now //vibuffering = 0; // Disabled for now
/* /*
if (vibuffering && ((n64->vi_control & 3) == 2)) if (vibuffering && ((m_rcp_periphs->vi_control & 3) == 2))
{ {
if (frame_buffer) if (frame_buffer)
{ {
@ -134,7 +132,7 @@ uint32_t n64_state::screen_update_n64(screen_device &screen, bitmap_rgb32 &bitma
curpixel_cvg = ((pix & 1) << 2) | (cvg_buffer[pixels ^ BYTE_ADDR_XOR] & 3); // Reuse of this variable curpixel_cvg = ((pix & 1) << 2) | (cvg_buffer[pixels ^ BYTE_ADDR_XOR] & 3); // Reuse of this variable
if (curpixel_cvg < 7 && i > 1 && j > 1 && i < (hres - 2) && j < (vres - 2) && fsaa) if (curpixel_cvg < 7 && i > 1 && j > 1 && i < (hres - 2) && j < (vres - 2) && fsaa)
{ {
newc = video_filter16(&frame_buffer[pixels ^ WORD_ADDR_XOR], &cvg_buffer[pixels ^ BYTE_ADDR_XOR], n64->vi_width); newc = video_filter16(&frame_buffer[pixels ^ WORD_ADDR_XOR], &cvg_buffer[pixels ^ BYTE_ADDR_XOR], m_rcp_periphs->vi_width);
ViBuffer[i][j] = newc; ViBuffer[i][j] = newc;
} }
else else
@ -154,13 +152,13 @@ uint32_t n64_state::screen_update_n64(screen_device &screen, bitmap_rgb32 &bitma
m_rdp->mark_frame(); m_rdp->mark_frame();
if (n64->vi_blank) if (m_rcp_periphs->vi_blank)
{ {
bitmap.fill(0, screen.visible_area()); bitmap.fill(0, screen.visible_area());
return 0; return 0;
} }
n64->video_update(bitmap); m_rcp_periphs->video_update(bitmap);
return 0; return 0;
} }

View File

@ -13,7 +13,6 @@
#include "emu.h" #include "emu.h"
#include "pc_t1t.h" #include "pc_t1t.h"
#include "machine/pic8259.h"
#include "machine/ram.h" #include "machine/ram.h"
#include "screen.h" #include "screen.h"
@ -65,6 +64,7 @@ pcvideo_t1000_device::pcvideo_t1000_device(const machine_config &mconfig, const
pcvideo_pcjr_device::pcvideo_pcjr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) pcvideo_pcjr_device::pcvideo_pcjr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: pc_t1t_device(mconfig, PCVIDEO_PCJR, tag, owner, clock), : pc_t1t_device(mconfig, PCVIDEO_PCJR, tag, owner, clock),
m_pic8259(*this, ":pic8259"),
m_jxkanji(nullptr) m_jxkanji(nullptr)
{ {
} }
@ -1034,5 +1034,5 @@ WRITE_LINE_MEMBER( pcvideo_pcjr_device::pcjr_vsync_changed )
{ {
m_pc_framecnt++; m_pc_framecnt++;
} }
machine().device<pic8259_device>("pic8259")->ir5_w(state); m_pic8259->ir5_w(state);
} }

View File

@ -6,6 +6,7 @@
#include "video/mc6845.h" #include "video/mc6845.h"
#include "machine/ram.h" #include "machine/ram.h"
#include "machine/bankdev.h" #include "machine/bankdev.h"
#include "machine/pic8259.h"
#define T1000_SCREEN_NAME "screen" #define T1000_SCREEN_NAME "screen"
#define T1000_MC6845_NAME "mc6845_t1000" #define T1000_MC6845_NAME "mc6845_t1000"
@ -132,6 +133,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override; virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override; virtual void device_start() override;
required_device<pic8259_device> m_pic8259;
uint8_t *m_jxkanji; uint8_t *m_jxkanji;
private: private:

View File

@ -8,7 +8,6 @@
#include "emu.h" #include "emu.h"
#include "tia.h" #include "tia.h"
#include "sound/tiaintf.h"
#include "screen.h" #include "screen.h"
static const int nusiz[8][3] = static const int nusiz[8][3] =
@ -359,6 +358,7 @@ tia_video_device::tia_video_device(const machine_config &mconfig, device_type ty
, m_databus_contents_cb(*this) , m_databus_contents_cb(*this)
, m_vsync_cb(*this) , m_vsync_cb(*this)
, m_maincpu(*this, "^maincpu") , m_maincpu(*this, "^maincpu")
, m_tia(*this, finder_base::DUMMY_TAG)
{ {
} }
@ -2015,7 +2015,7 @@ WRITE8_MEMBER( tia_video_device::write )
case 0x18: /* AUDF1 */ case 0x18: /* AUDF1 */
case 0x19: /* AUDV0 */ case 0x19: /* AUDV0 */
case 0x1A: /* AUDV1 */ case 0x1A: /* AUDV1 */
machine().device<tia_device>("tia")->tia_sound_w(space, offset, data); m_tia->tia_sound_w(space, offset, data);
break; break;
case 0x1B: case 0x1B:

View File

@ -5,6 +5,8 @@
#pragma once #pragma once
#include "sound/tiaintf.h"
//************************************************************************** //**************************************************************************
// MACROS / CONSTANTS // MACROS / CONSTANTS
//************************************************************************** //**************************************************************************
@ -65,6 +67,8 @@ protected:
// construction/destruction // construction/destruction
tia_video_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); tia_video_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
template <typename T> void set_tia_tag(T &&tag) { m_tia.set_tag(std::forward<T>(tag)); }
// device-level overrides // device-level overrides
virtual void device_start() override; virtual void device_start() override;
virtual void device_reset() override; virtual void device_reset() override;
@ -117,6 +121,7 @@ private:
devcb_write16 m_vsync_cb; devcb_write16 m_vsync_cb;
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<tia_device> m_tia;
struct player_gfx p0gfx; struct player_gfx p0gfx;
struct player_gfx p1gfx; struct player_gfx p1gfx;
@ -212,6 +217,12 @@ private:
class tia_pal_video_device : public tia_video_device class tia_pal_video_device : public tia_video_device
{ {
public: public:
template <typename T> tia_pal_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&tia_tag)
: tia_pal_video_device(mconfig, tag, owner, clock)
{
m_tia.set_tag(std::forward<T>(tia_tag));
}
tia_pal_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); tia_pal_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected: protected:
@ -224,6 +235,12 @@ private:
class tia_ntsc_video_device : public tia_video_device class tia_ntsc_video_device : public tia_video_device
{ {
public: public:
template <typename T> tia_ntsc_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&tia_tag)
: tia_ntsc_video_device(mconfig, tag, owner, clock)
{
m_tia.set_tag(std::forward<T>(tia_tag));
}
tia_ntsc_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); tia_ntsc_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected: protected:

View File

@ -13,13 +13,16 @@
class vr0video_device : public device_t class vr0video_device : public device_t
{ {
public: public:
template <typename T> vr0video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu_tag)
: vr0video_device(mconfig, tag, owner, clock)
{
m_cpu.set_tag(std::forward<T>(cpu_tag));
}
vr0video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); vr0video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
~vr0video_device() {}
int vrender0_ProcessPacket(uint32_t PacketPtr, uint16_t *Dest, uint8_t *TEXTURE); int vrender0_ProcessPacket(uint32_t PacketPtr, uint16_t *Dest, uint8_t *TEXTURE);
void set_cpu_tag(const char *tag) { m_cpu.set_tag(tag); }
protected: protected:
// device-level overrides // device-level overrides
virtual void device_start() override; virtual void device_start() override;
@ -61,8 +64,4 @@ private:
DECLARE_DEVICE_TYPE(VIDEO_VRENDER0, vr0video_device) DECLARE_DEVICE_TYPE(VIDEO_VRENDER0, vr0video_device)
#define MCFG_VIDEO_VRENDER0_CPU(_tag) \
downcast<vr0video_device &>(*device).set_cpu_tag(_tag);
#endif // MAME_VIDEO_VRENDER0_H #endif // MAME_VIDEO_VRENDER0_H

View File

@ -41,9 +41,6 @@
// INTERFACE CONFIGURATION MACROS // INTERFACE CONFIGURATION MACROS
///************************************************************************* ///*************************************************************************
#define MCFG_ZX8301_CPU(_tag) \
downcast<zx8301_device &>(*device).set_cpu_tag(_tag);
#define MCFG_ZX8301_VSYNC_CALLBACK(_write) \ #define MCFG_ZX8301_VSYNC_CALLBACK(_write) \
devcb = &downcast<zx8301_device &>(*device).set_vsync_wr_callback(DEVCB_##_write); devcb = &downcast<zx8301_device &>(*device).set_vsync_wr_callback(DEVCB_##_write);
@ -61,10 +58,15 @@ class zx8301_device : public device_t,
{ {
public: public:
// construction/destruction // construction/destruction
template <typename T> zx8301_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&cpu_tag)
: zx8301_device(mconfig, tag, owner, clock)
{
m_cpu.set_tag(std::forward<T>(cpu_tag));
}
zx8301_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); zx8301_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
template <class Object> devcb_base &set_vsync_wr_callback(Object &&cb) { return m_write_vsync.set_callback(std::forward<Object>(cb)); } template <class Object> devcb_base &set_vsync_wr_callback(Object &&cb) { return m_write_vsync.set_callback(std::forward<Object>(cb)); }
void set_cpu_tag(const char *tag) { m_cpu.set_tag(tag); }
DECLARE_WRITE8_MEMBER( control_w ); DECLARE_WRITE8_MEMBER( control_w );
DECLARE_READ8_MEMBER( data_r ); DECLARE_READ8_MEMBER( data_r );