neogeo: start splitting up the state classes for the different variants properly.

This commit is contained in:
Vas Crabb 2018-03-29 01:26:44 +11:00
parent 78eed617d2
commit 8d11ab6ada
4 changed files with 767 additions and 669 deletions

File diff suppressed because it is too large Load Diff

View File

@ -51,11 +51,11 @@ uint8_t* NeoZ80ROMActive;
uint8_t NeoSystem = NEOCD_REGION_JAPAN;
class ngcd_state : public aes_state
class ngcd_state : public aes_base_state
{
public:
ngcd_state(const machine_config &mconfig, device_type type, const char *tag)
: aes_state(mconfig, type, tag)
: aes_base_state(mconfig, type, tag)
, m_tempcdc(*this,"tempcdc")
{
NeoCDDMAAddress1 = 0;
@ -88,9 +88,6 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(aes_jp1);
DECLARE_MACHINE_START(neocd);
DECLARE_MACHINE_RESET(neocd);
// neoCD
int32_t nActiveTransferArea;
@ -137,7 +134,10 @@ public:
void neocd_audio_io_map(address_map &map);
void neocd_audio_map(address_map &map);
void neocd_main_map(address_map &map);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
int32_t SekIdle(int32_t nCycles);
};
@ -828,17 +828,14 @@ if (NeoCDDMAAddress2 == 0x0800) {
*
*************************************/
MACHINE_START_MEMBER(ngcd_state,neocd)
void ngcd_state::machine_start()
{
m_type = NEOGEO_CD;
common_machine_start();
aes_base_state::machine_start();
// set curr_slot to 0, so to allow checking m_slots[m_curr_slot] != nullptr
m_curr_slot = 0;
// initialize sprite to point to memory regions
m_sprgen->m_fixed_layer_bank_type = 0;
m_sprgen->set_screen(m_screen);
m_sprgen->set_sprite_region(m_region_sprites->base(), m_region_sprites->bytes());
m_sprgen->set_fixed_regions(m_region_fixed->base(), m_region_fixed->bytes(), m_region_fixedbios);
m_sprgen->neogeo_set_fixed_layer_source(1);
@ -853,8 +850,6 @@ MACHINE_START_MEMBER(ngcd_state,neocd)
machine().device<nvram_device>("saveram")->set_base(m_meminternal_data.get(), 0x2000);
save_pointer(NAME(m_meminternal_data.get()), 0x2000);
m_use_cart_vectors = 0;
m_tempcdc->reset_cd();
}
@ -865,9 +860,9 @@ MACHINE_START_MEMBER(ngcd_state,neocd)
*
*************************************/
MACHINE_RESET_MEMBER(ngcd_state,neocd)
void ngcd_state::machine_reset()
{
neogeo_state::machine_reset();
aes_base_state::machine_reset();
NeoSpriteRAM = memregion("sprites")->base();
YM2610ADPCMAROM = memregion("ymsnd")->base();
@ -1072,9 +1067,6 @@ MACHINE_CONFIG_START(ngcd_state::neocd)
MCFG_NVRAM_ADD_0FILL("saveram")
MCFG_MACHINE_START_OVERRIDE(ngcd_state,neocd)
MCFG_MACHINE_RESET_OVERRIDE(ngcd_state,neocd)
MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl1", neogeo_controls, "joy", false)
MCFG_NEOGEO_CONTROL_PORT_ADD("ctrl2", neogeo_controls, "joy", false)

View File

@ -6,27 +6,68 @@
#include "emu.h"
#include "includes/neogeo.h"
#include "bus/neogeo/prot_pcm2.h"
#include "bus/neogeo/prot_cmc.h"
#include "bus/neogeo/prot_pvc.h"
class neopcb_state : public ngarcade_base_state
{
public:
neopcb_state(const machine_config &mconfig, device_type type, const char *tag)
: ngarcade_base_state(mconfig, type, tag)
, m_cmc_prot(*this, "cmc50")
, m_pcm2_prot(*this, "pcm2")
, m_pvc_prot(*this, "pvc")
{
}
DECLARE_INPUT_CHANGED_MEMBER(select_bios);
DECLARE_DRIVER_INIT(ms5pcb);
DECLARE_DRIVER_INIT(svcpcb);
DECLARE_DRIVER_INIT(kf2k3pcb);
void neopcb(machine_config &config);
protected:
// device overrides
virtual void machine_start() override;
virtual void neogeo_postload() override;
DECLARE_WRITE16_MEMBER(write_bankpvc);
void install_common();
void install_banked_bios();
void neopcb_postload();
// non-carts
void svcpcb_gfx_decrypt();
void svcpcb_s1data_decrypt();
void kf2k3pcb_gfx_decrypt();
void kf2k3pcb_decrypt_s1data();
void kf2k3pcb_sp1_decrypt();
private:
required_device<cmc_prot_device> m_cmc_prot;
required_device<pcm2_prot_device> m_pcm2_prot;
required_device<pvc_prot_device> m_pvc_prot;
};
void neopcb_state::machine_start()
{
m_type = NEOGEO_MVS;
common_machine_start();
// enable rtc and serial mode
m_upd4990a->cs_w(1);
m_upd4990a->oe_w(1);
m_upd4990a->c0_w(1);
m_upd4990a->c1_w(1);
m_upd4990a->c2_w(1);
ngarcade_base_state::machine_start();
m_sprgen->set_screen(m_screen);
}
void neopcb_state::neopcb_postload()
void neopcb_state::neogeo_postload()
{
m_bank_audio_main->set_entry(m_use_cart_audio);
ngarcade_base_state::neogeo_postload();
membank("cpu_bank")->set_base(m_region_maincpu->base() + m_bank_base);
set_outputs();
}
MACHINE_CONFIG_START(neopcb_state::neopcb)
@ -445,7 +486,6 @@ void neopcb_state::install_banked_bios()
DRIVER_INIT_MEMBER(neopcb_state, ms5pcb)
{
DRIVER_INIT_CALL(neogeo);
install_common();
install_banked_bios();
@ -465,7 +505,6 @@ DRIVER_INIT_MEMBER(neopcb_state, ms5pcb)
DRIVER_INIT_MEMBER(neopcb_state, svcpcb)
{
DRIVER_INIT_CALL(neogeo);
install_common();
install_banked_bios();
@ -485,7 +524,6 @@ DRIVER_INIT_MEMBER(neopcb_state, svcpcb)
DRIVER_INIT_MEMBER(neopcb_state, kf2k3pcb)
{
DRIVER_INIT_CALL(neogeo);
install_common();
m_sprgen->m_fixed_layer_bank_type = 2;

View File

@ -6,6 +6,10 @@
Neo-Geo hardware
*************************************************************************/
#ifndef MAME_INCLUDES_NEOGEO_H
#define MAME_INCLUDES_NEOGEO_H
#pragma once
#include "cpu/m68000/m68000.h"
#include "cpu/z80/z80.h"
@ -34,10 +38,8 @@ public:
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_upd4990a(*this, "upd4990a"),
m_ym(*this, "ymsnd"),
m_sprgen(*this, "spritegen"),
m_save_ram(*this, "saveram"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_memcard(*this, "memcard"),
@ -51,17 +53,12 @@ public:
m_region_audiobios(*this, "audiobios"),
m_region_audiocpu(*this, "audiocpu"),
m_bank_audio_main(*this, "audio_main"),
m_dsw(*this, "DSW"),
m_trackx(*this, "TRACK_X"),
m_tracky(*this, "TRACK_Y"),
m_edge(*this, "edge"),
m_ctrl1(*this, "ctrl1"),
m_ctrl2(*this, "ctrl2"),
m_use_cart_vectors(0),
m_use_cart_audio(0),
m_slots(*this, "cslot%u", 1U),
m_digits(*this, "digit%u", 1U),
m_lamps(*this, "lamp%u", 1U)
m_slots(*this, "cslot%u", 1U)
{ }
DECLARE_READ16_MEMBER(memcard_r);
@ -75,8 +72,6 @@ public:
DECLARE_WRITE16_MEMBER(paletteram_w);
DECLARE_READ16_MEMBER(video_register_r);
DECLARE_WRITE16_MEMBER(video_register_w);
DECLARE_READ16_MEMBER(in0_r);
DECLARE_READ16_MEMBER(in1_r);
DECLARE_CUSTOM_INPUT_MEMBER(get_memcard_status);
DECLARE_CUSTOM_INPUT_MEMBER(get_audio_result);
@ -85,14 +80,9 @@ public:
TIMER_CALLBACK_MEMBER(display_position_vblank_callback);
TIMER_CALLBACK_MEMBER(vblank_interrupt_callback);
// MVS-specific
DECLARE_WRITE_LINE_MEMBER(set_save_ram_unlock);
DECLARE_WRITE16_MEMBER(save_ram_w);
DECLARE_CUSTOM_INPUT_MEMBER(kizuna4p_start_r);
uint32_t screen_update_neogeo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_WRITE8_MEMBER(io_control_w);
virtual DECLARE_WRITE8_MEMBER(io_control_w);
DECLARE_WRITE_LINE_MEMBER(set_use_cart_vectors);
DECLARE_WRITE_LINE_MEMBER(set_use_cart_audio);
DECLARE_READ16_MEMBER(banked_vectors_r);
@ -107,99 +97,23 @@ public:
DECLARE_WRITE_LINE_MEMBER(set_screen_shadow);
DECLARE_WRITE_LINE_MEMBER(set_palette_bank);
DECLARE_DRIVER_INIT(neogeo);
void neogeo_base(machine_config &config);
void neogeo_arcade(machine_config &config);
void mslug3b6(machine_config &config);
void s1945p(machine_config &config);
void rotd(machine_config &config);
void mslug4(machine_config &config);
void kof2003(machine_config &config);
void lans2004(machine_config &config);
void ms5plus(machine_config &config);
void kof2k4se(machine_config &config);
void kof2002(machine_config &config);
void kof2001(machine_config &config);
void svcplus(machine_config &config);
void kf2k5uni(machine_config &config);
void garou(machine_config &config);
void sbp(machine_config &config);
void cthd2k3(machine_config &config);
void ct2k3sp(machine_config &config);
void kof2000n(machine_config &config);
void mslug3(machine_config &config);
void kog(machine_config &config);
void fatfur2(machine_config &config);
void garouh(machine_config &config);
void ganryu(machine_config &config);
void zupapa(machine_config &config);
void neobase(machine_config &config);
void kof10th(machine_config &config);
void mslug5(machine_config &config);
void garoubl(machine_config &config);
void ct2k3sa(machine_config &config);
void nitd(machine_config &config);
void samsh5sp(machine_config &config);
void kof98(machine_config &config);
void kf2k3pl(machine_config &config);
void mvs(machine_config &config);
void ms4plus(machine_config &config);
void samsho5b(machine_config &config);
void popbounc(machine_config &config);
void svcplusa(machine_config &config);
void kof2002b(machine_config &config);
void svcboot(machine_config &config);
void kof2000(machine_config &config);
void samsho5(machine_config &config);
void kf2k2mp2(machine_config &config);
void pnyaa(machine_config &config);
void mslug3h(machine_config &config);
void vliner(machine_config &config);
void jockeygp(machine_config &config);
void matrim(machine_config &config);
void matrimbl(machine_config &config);
void kof97oro(machine_config &config);
void kizuna4p(machine_config &config);
void mslugx(machine_config &config);
void kf2k2pls(machine_config &config);
void kf10thep(machine_config &config);
void sengoku3(machine_config &config);
void neogeo_mj(machine_config &config);
void kf2k3upl(machine_config &config);
void preisle2(machine_config &config);
void svcsplus(machine_config &config);
void kf2k3bl(machine_config &config);
void kof99(machine_config &config);
void svc(machine_config &config);
void kof2003h(machine_config &config);
void kof99k(machine_config &config);
void irrmaze(machine_config &config);
void kf2k2mp(machine_config &config);
void bangbead(machine_config &config);
void audio_io_map(address_map &map);
void audio_map(address_map &map);
void main_map_slot(address_map &map);
void neogeo_main_map(address_map &map);
protected:
void common_machine_start();
void set_outputs();
// device overrides
virtual void machine_start() override;
virtual void machine_reset() override;
void neogeo_postload();
virtual void neogeo_postload();
// devices
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
// MVS-specific devices
optional_device<upd4990a_device> m_upd4990a;
optional_device<ym2610_device> m_ym;
required_device<neosprite_optimized_device> m_sprgen;
optional_shared_ptr<uint16_t> m_save_ram;
required_device<screen_device> m_screen;
optional_device<palette_device> m_palette;
@ -219,12 +133,6 @@ protected:
memory_bank *m_bank_audio_cart[4];
memory_bank *m_bank_cartridge;
// configuration
enum {NEOGEO_MVS, NEOGEO_AES, NEOGEO_CD} m_type;
optional_ioport m_dsw;
optional_ioport m_trackx;
optional_ioport m_tracky;
optional_device<neogeo_ctrl_edge_port_device> m_edge;
optional_device<neogeo_control_port_device> m_ctrl1;
optional_device<neogeo_control_port_device> m_ctrl2;
@ -252,8 +160,6 @@ protected:
uint32_t m_bank_base;
optional_device_array<neogeo_cart_slot_device, 6> m_slots;
output_finder<4> m_digits;
output_finder<6> m_lamps;
int m_curr_slot;
@ -273,22 +179,12 @@ private:
void set_pens();
void audio_cpu_check_nmi();
void set_output_latch(uint8_t data);
void set_output_data(uint8_t data);
// internal state
bool m_recurse;
bool m_audio_cpu_nmi_enabled;
bool m_audio_cpu_nmi_pending;
// MVS-specific state
uint8_t m_save_ram_unlocked;
uint8_t m_output_data;
uint8_t m_output_latch;
uint8_t m_el_value;
uint8_t m_led1_value;
uint8_t m_led2_value;
emu_timer *m_display_position_interrupt_timer;
emu_timer *m_display_position_vblank_timer;
emu_timer *m_vblank_interrupt_timer;
@ -308,65 +204,59 @@ private:
};
class aes_state : public neogeo_state
class ngarcade_base_state : public neogeo_state
{
public:
aes_state(const machine_config &mconfig, device_type type, const char *tag)
: neogeo_state(mconfig, type, tag)
, m_io_in2(*this, "IN2")
{}
DECLARE_READ16_MEMBER(aes_in2_r);
DECLARE_INPUT_CHANGED_MEMBER(aes_jp1);
DECLARE_MACHINE_START(aes);
void aes(machine_config &config);
void aes_main_map(address_map &map);
protected:
required_ioport m_io_in2;
ngarcade_base_state(const machine_config &mconfig, device_type type, const char *tag)
: neogeo_state(mconfig, type, tag)
, m_save_ram(*this, "saveram")
, m_upd4990a(*this, "upd4990a")
, m_dsw(*this, "DSW")
{
}
virtual void machine_start() override;
virtual DECLARE_WRITE8_MEMBER(io_control_w) override;
DECLARE_WRITE_LINE_MEMBER(set_save_ram_unlock);
DECLARE_WRITE16_MEMBER(save_ram_w);
DECLARE_READ16_MEMBER(in0_r);
DECLARE_READ16_MEMBER(in1_r);
void neogeo_arcade(machine_config &config);
void neogeo_main_map(address_map &map);
void main_map_slot(address_map &map);
private:
required_shared_ptr<uint16_t> m_save_ram;
required_device<upd4990a_device> m_upd4990a;
required_ioport m_dsw;
uint8_t m_save_ram_unlocked;
};
#include "bus/neogeo/prot_pcm2.h"
#include "bus/neogeo/prot_cmc.h"
#include "bus/neogeo/prot_pvc.h"
class neopcb_state : public neogeo_state
class aes_base_state : public neogeo_state
{
public:
neopcb_state(const machine_config &mconfig, device_type type, const char *tag)
: neogeo_state(mconfig, type, tag)
, m_cmc_prot(*this, "cmc50")
, m_pcm2_prot(*this, "pcm2")
, m_pvc_prot(*this, "pvc")
{}
public:
DECLARE_INPUT_CHANGED_MEMBER(aes_jp1);
protected:
aes_base_state(const machine_config &mconfig, device_type type, const char *tag)
: neogeo_state(mconfig, type, tag)
, m_io_in2(*this, "IN2")
{
}
DECLARE_READ16_MEMBER(aes_in2_r);
// device overrides
virtual void machine_start() override;
DECLARE_WRITE16_MEMBER(write_bankpvc);
void aes_main_map(address_map &map);
DECLARE_INPUT_CHANGED_MEMBER(select_bios);
DECLARE_DRIVER_INIT(ms5pcb);
DECLARE_DRIVER_INIT(svcpcb);
DECLARE_DRIVER_INIT(kf2k3pcb);
DECLARE_DRIVER_INIT(vliner);
void install_common();
void install_banked_bios();
void neopcb_postload();
// non-carts
void svcpcb_gfx_decrypt();
void svcpcb_s1data_decrypt();
void kf2k3pcb_gfx_decrypt();
void kf2k3pcb_decrypt_s1data();
void kf2k3pcb_sp1_decrypt();
required_device<cmc_prot_device> m_cmc_prot;
required_device<pcm2_prot_device> m_pcm2_prot;
required_device<pvc_prot_device> m_pvc_prot;
void neopcb(machine_config &config);
private:
required_ioport m_io_in2;
};
@ -374,3 +264,5 @@ class neopcb_state : public neogeo_state
INPUT_PORTS_EXTERN(neogeo);
INPUT_PORTS_EXTERN(aes);
#endif // MAME_INCLUDES_NEOGEO_H