From 151d278c459ad32f4da7ae89fa738c686cbb2b58 Mon Sep 17 00:00:00 2001 From: Fabio Priuli Date: Fri, 10 May 2013 15:12:14 +0000 Subject: [PATCH] (MESS) added a bunch of slot-related save registrations. nw. --- src/mess/machine/gb_slot.c | 3 ++- src/mess/machine/md_slot.c | 1 + src/mess/machine/md_stm95.c | 28 +++++++++++++++++++++------- src/mess/machine/md_stm95.h | 10 +++++----- src/mess/machine/md_svp.c | 13 ++++++++++++- src/mess/machine/sns_bsx.c | 5 ++++- src/mess/machine/sns_slot.c | 2 ++ 7 files changed, 47 insertions(+), 15 deletions(-) diff --git a/src/mess/machine/gb_slot.c b/src/mess/machine/gb_slot.c index 724806ac75c..bee57456931 100644 --- a/src/mess/machine/gb_slot.c +++ b/src/mess/machine/gb_slot.c @@ -27,7 +27,7 @@ const device_type GB_CART_SLOT = &device_creator; const device_type MEGADUCK_CART_SLOT = &device_creator; //************************************************************************** -// MD cartridges Interface +// GB cartridges Interface //************************************************************************** //------------------------------------------------- @@ -76,6 +76,7 @@ void device_gb_cart_interface::ram_alloc(running_machine &machine, UINT32 size) { m_ram = auto_alloc_array_clear(machine, UINT8, size); m_ram_size = size; + state_save_register_item_pointer(machine, "GB_CART", NULL, 0, m_ram, m_ram_size); } } diff --git a/src/mess/machine/md_slot.c b/src/mess/machine/md_slot.c index 0c99b92e727..dcf6f1eb6ca 100644 --- a/src/mess/machine/md_slot.c +++ b/src/mess/machine/md_slot.c @@ -103,6 +103,7 @@ void device_md_cart_interface::nvram_alloc(running_machine &machine, size_t size { m_nvram = auto_alloc_array_clear(machine, UINT16, size/sizeof(UINT16)); m_nvram_size = size; + state_save_register_item_pointer(machine, "MD_CART", NULL, 0, m_nvram, m_nvram_size); } } diff --git a/src/mess/machine/md_stm95.c b/src/mess/machine/md_stm95.c index 1a3d1386d86..0239c026732 100644 --- a/src/mess/machine/md_stm95.c +++ b/src/mess/machine/md_stm95.c @@ -16,6 +16,21 @@ #include "machine/md_stm95.h" +stm95_eeprom_device::stm95_eeprom_device(running_machine &machine, UINT8 *eeprom) : + stm_state(IDLE), + stream_pos(0), + m_machine(machine) +{ + eeprom_data = eeprom; + state_save_register_item(machine, "STM95", NULL, 0, latch); + state_save_register_item(machine, "STM95", NULL, 0, reset_line); + state_save_register_item(machine, "STM95", NULL, 0, sck_line); + state_save_register_item(machine, "STM95", NULL, 0, WEL); + state_save_register_item(machine, "STM95", NULL, 0, stream_pos); + state_save_register_item(machine, "STM95", NULL, 0, stream_data); + state_save_register_item(machine, "STM95", NULL, 0, eeprom_addr); +} + void stm95_eeprom_device::set_cs_line(int state) { reset_line = state; @@ -177,11 +192,10 @@ md_eeprom_stm95_device::md_eeprom_stm95_device(const machine_config &mconfig, co void md_eeprom_stm95_device::device_start() { nvram_alloc(machine(), M95320_SIZE); - m_stm95.eeprom_data = (UINT8*)get_nvram_base(); + m_stm95 = auto_alloc(machine(), stm95_eeprom_device(machine(), (UINT8*)get_nvram_base())); save_item(NAME(m_rdcnt)); save_item(NAME(m_bank)); - //TODO: save and restore the m_stm95... } void md_eeprom_stm95_device::device_reset() @@ -227,7 +241,7 @@ READ16_MEMBER(md_eeprom_stm95_device::read_a13) { if (offset == 0x0a/2) { - return m_stm95.get_so_line() & 1; + return m_stm95->get_so_line() & 1; } return 0xffff; } @@ -244,9 +258,9 @@ WRITE16_MEMBER(md_eeprom_stm95_device::write_a13) } else if (offset < 0x0a/2) { - m_stm95.set_si_line(BIT(data, 0)); - m_stm95.set_sck_line(BIT(data, 1)); - m_stm95.set_halt_line(BIT(data, 2)); - m_stm95.set_cs_line(BIT(data, 3)); + m_stm95->set_si_line(BIT(data, 0)); + m_stm95->set_sck_line(BIT(data, 1)); + m_stm95->set_halt_line(BIT(data, 2)); + m_stm95->set_cs_line(BIT(data, 3)); } } diff --git a/src/mess/machine/md_stm95.h b/src/mess/machine/md_stm95.h index 893b9dc4989..6bd0a07c1a7 100644 --- a/src/mess/machine/md_stm95.h +++ b/src/mess/machine/md_stm95.h @@ -26,10 +26,8 @@ enum STMSTATE class stm95_eeprom_device { public: - stm95_eeprom_device() : - stm_state(IDLE), - stream_pos(0) - {}; + stm95_eeprom_device(running_machine &machine, UINT8 *eeprom); + running_machine &machine() const { return m_machine; } UINT8 *eeprom_data; void set_cs_line(int); @@ -48,6 +46,8 @@ protected: int stream_pos; int stream_data; int eeprom_addr; + + running_machine& m_machine; }; @@ -74,7 +74,7 @@ private: UINT8 m_bank[3]; int m_rdcnt; - stm95_eeprom_device m_stm95; + stm95_eeprom_device *m_stm95; }; diff --git a/src/mess/machine/md_svp.c b/src/mess/machine/md_svp.c index 05b0d06284e..5173c2090b4 100644 --- a/src/mess/machine/md_svp.c +++ b/src/mess/machine/md_svp.c @@ -384,13 +384,24 @@ void md_rom_svp_device::device_start() m_xst = 0; m_xst2 = 0; - /* SVP stuff */ + // SVP stuff // DRAM m_dram = auto_alloc_array(machine(), UINT8, 0x20000); // IRAM m_iram = auto_alloc_array(machine(), UINT8, 0x800); this->membank("iram_svp")->set_base(m_iram); // the other bank, "cart_svp", is setup at call_load + + save_item(NAME(m_pmac_read)); + save_item(NAME(m_pmac_write)); + save_item(NAME(m_emu_status)); + save_item(NAME(m_xst)); + save_item(NAME(m_xst2)); + save_item(NAME(m_pmc.d)); + save_item(NAME(m_pmc.w.l)); + save_item(NAME(m_pmc.w.h)); + save_pointer(NAME(m_dram), 0x20000); + save_pointer(NAME(m_iram), 0x800); } READ16_MEMBER(md_rom_svp_device::read) diff --git a/src/mess/machine/sns_bsx.c b/src/mess/machine/sns_bsx.c index 313410c41fa..7509de35a46 100644 --- a/src/mess/machine/sns_bsx.c +++ b/src/mess/machine/sns_bsx.c @@ -73,7 +73,6 @@ void sns_rom_bsx_device::device_start() save_item(NAME(access_60_6f)); save_item(NAME(rom_access)); save_item(NAME(m_pram)); - // TODO: save unit-related items and fix their restore... } void sns_rom_bsx_device::device_reset() @@ -117,6 +116,10 @@ void sns_rom_bsmempak_device::device_reset() BSX_base::BSX_base(running_machine &machine) : m_machine(machine) { + state_save_register_item(machine, "SNES_BSX", NULL, 0, regs); + state_save_register_item(machine, "SNES_BSX", NULL, 0, r2192_counter); + state_save_register_item(machine, "SNES_BSX", NULL, 0, r2192_hour); + state_save_register_item(machine, "SNES_BSX", NULL, 0, r2192_second); } void BSX_base::init() diff --git a/src/mess/machine/sns_slot.c b/src/mess/machine/sns_slot.c index 572286e9ef9..efa03c80d2d 100644 --- a/src/mess/machine/sns_slot.c +++ b/src/mess/machine/sns_slot.c @@ -112,6 +112,7 @@ void device_sns_cart_interface::nvram_alloc(running_machine &machine, UINT32 siz { m_nvram = auto_alloc_array_clear(machine, UINT8, size); m_nvram_size = size; + state_save_register_item_pointer(machine, "SNES_CART", NULL, 0, m_nvram, m_nvram_size); } } @@ -129,6 +130,7 @@ void device_sns_cart_interface::rtc_ram_alloc(running_machine &machine, UINT32 s { m_rtc_ram = auto_alloc_array_clear(machine, UINT8, size); m_rtc_ram_size = size; + state_save_register_item_pointer(machine, "SNES_CART", NULL, 0, m_rtc_ram, m_rtc_ram_size); } }