summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author therealmogminer@gmail.com <therealmogminer@gmail.com>2015-11-18 23:06:35 +0100
committer Miodrag Milanovic <mmicko@gmail.com>2016-01-23 17:30:14 +0100
commitcccc998b20d0a25dce9f0673eca998c6a8b5efe8 (patch)
tree15c4651da7701cb50d1f7b988eef60dc8abf2241 /src
parent5a9fb4c34030492adbaf690627d8f612000db550 (diff)
First round of this==NULL crash fixes
Diffstat (limited to 'src')
-rw-r--r--src/devices/machine/timekpr.cpp10
-rw-r--r--src/devices/sound/2610intf.cpp33
-rw-r--r--src/devices/sound/2610intf.h3
-rw-r--r--src/devices/sound/fm.cpp11
-rw-r--r--src/devices/sound/upd7759.cpp119
-rw-r--r--src/devices/sound/upd7759.h1
-rw-r--r--src/devices/sound/ymz280b.cpp9
-rw-r--r--src/mame/audio/dcs.cpp89
-rw-r--r--src/mame/audio/dcs.h4
-rw-r--r--src/mame/drivers/neogeo_noslot.cpp5
-rw-r--r--src/mame/drivers/sfbonus.cpp49
-rw-r--r--src/mame/includes/btime.h35
-rw-r--r--src/mame/includes/cps1.h4
-rw-r--r--src/mame/video/btime.cpp48
-rw-r--r--src/mame/video/cps1.cpp7
15 files changed, 237 insertions, 190 deletions
diff --git a/src/devices/machine/timekpr.cpp b/src/devices/machine/timekpr.cpp
index ccd849ef21d..bf2dbf2d62f 100644
--- a/src/devices/machine/timekpr.cpp
+++ b/src/devices/machine/timekpr.cpp
@@ -122,6 +122,7 @@ static int counter_from_ram( UINT8 *data, int offset )
timekeeper_device::timekeeper_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_nvram_interface(mconfig, *this)
+ , m_default_data(NULL)
{
}
@@ -230,10 +231,13 @@ void timekeeper_device::device_start()
m_century = make_bcd( systime.local_time.year / 100 );
m_data.resize( m_size );
- m_default_data = region()->base();
- if (m_default_data)
+ if (region())
{
- assert( region()->bytes() == m_size );
+ m_default_data = region()->base();
+ if (m_default_data)
+ {
+ assert( region()->bytes() == m_size );
+ }
}
save_item( NAME(m_control) );
diff --git a/src/devices/sound/2610intf.cpp b/src/devices/sound/2610intf.cpp
index 9111b03502c..4cc7f303795 100644
--- a/src/devices/sound/2610intf.cpp
+++ b/src/devices/sound/2610intf.cpp
@@ -16,6 +16,9 @@
#include "2610intf.h"
#include "fm.h"
+const char* YM2610_TAG = "ymsnd";
+const char* YM2610_DELTAT_TAG = "ymsnd.deltat";
+
static void psg_set_clock(void *param, int clock)
{
ym2610_device *ym2610 = (ym2610_device *) param;
@@ -143,9 +146,6 @@ void ym2610_device::device_start()
ay8910_device::device_start();
int rate = clock()/72;
- void *pcmbufa,*pcmbufb;
- int pcmsizea,pcmsizeb;
- std::string name(tag());
m_irq_handler.resolve();
@@ -155,16 +155,19 @@ void ym2610_device::device_start()
/* stream system initialize */
m_stream = machine().sound().stream_alloc(*this,0,2,rate, stream_update_delegate(FUNC(ym2610_device::stream_generate),this));
+
/* setup adpcm buffers */
- pcmbufa = region()->base();
- pcmsizea = region()->bytes();
- name.append(".deltat");
- pcmbufb = (void *)(machine().root_device().memregion(name.c_str())->base());
- pcmsizeb = machine().root_device().memregion(name.c_str())->bytes();
- if (pcmbufb == nullptr || pcmsizeb == 0)
+ void *pcmbufa = region()->base();
+ int pcmsizea = region()->bytes();
+
+ std::string name = tag() + std::string(".deltat");
+ memory_region *deltat_region = machine().root_device().memregion(name.c_str());
+ void *pcmbufb = pcmbufa;
+ int pcmsizeb = pcmsizea;
+ if (deltat_region != nullptr && deltat_region->base() != nullptr && deltat_region->bytes() != 0)
{
- pcmbufb = pcmbufa;
- pcmsizeb = pcmsizea;
+ pcmbufb = deltat_region->base();
+ pcmsizeb = deltat_region->bytes();
}
/**** initialize YM2610 ****/
@@ -207,14 +210,14 @@ WRITE8_MEMBER( ym2610_device::write )
const device_type YM2610 = &device_creator<ym2610_device>;
ym2610_device::ym2610_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : ay8910_device(mconfig, YM2610, "YM2610", tag, owner, clock, PSG_TYPE_YM, 1, 0, "ym2610", __FILE__),
- m_irq_handler(*this)
+ : ay8910_device(mconfig, YM2610, "YM2610", tag, owner, clock, PSG_TYPE_YM, 1, 0, "ym2610", __FILE__)
+ , m_irq_handler(*this)
{
}
ym2610_device::ym2610_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
- : ay8910_device(mconfig, type, name, tag, owner, clock, PSG_TYPE_YM, 1, 0, shortname, source),
- m_irq_handler(*this)
+ : ay8910_device(mconfig, type, name, tag, owner, clock, PSG_TYPE_YM, 1, 0, shortname, source)
+ , m_irq_handler(*this)
{
}
diff --git a/src/devices/sound/2610intf.h b/src/devices/sound/2610intf.h
index c4409e46f21..dcd0ef01787 100644
--- a/src/devices/sound/2610intf.h
+++ b/src/devices/sound/2610intf.h
@@ -29,6 +29,9 @@ public:
void _timer_handler(int c,int count,int clock);
void _ym2610_update_request();
+ static const char* YM2610_TAG;
+ static const char* YM2610_DELTAT_TAG;
+
protected:
// device-level overrides
virtual void device_start() override;
diff --git a/src/devices/sound/fm.cpp b/src/devices/sound/fm.cpp
index 854fbb61004..fbc45073060 100644
--- a/src/devices/sound/fm.cpp
+++ b/src/devices/sound/fm.cpp
@@ -2423,7 +2423,7 @@ struct YM2610
UINT8 flagmask; /* YM2608 only */
UINT8 irqmask; /* YM2608 only */
- device_t *device;
+ device_t *device;
};
/* here is the virtual YM2608 */
@@ -3686,14 +3686,21 @@ void ym2610_reset_chip(void *chip)
F2610->pcmbuf = (const UINT8 *)dev->machine().root_device().memregion(name.c_str())->base();
F2610->pcm_size = dev->machine().root_device().memregion(name.c_str())->bytes();
name.append(".deltat");
- F2610->deltaT.memory = (UINT8 *)dev->machine().root_device().memregion(name.c_str())->base();
+ memory_region *deltat_region = dev->machine().root_device().memregion(name.c_str());
+ F2610->deltaT.memory = nullptr;
+ if (deltat_region != nullptr)
+ {
+ F2610->deltaT.memory = (UINT8 *)dev->machine().root_device().memregion(name.c_str())->base();
+ }
if(F2610->deltaT.memory == nullptr)
{
F2610->deltaT.memory = (UINT8*)F2610->pcmbuf;
F2610->deltaT.memory_size = F2610->pcm_size;
}
else
+ {
F2610->deltaT.memory_size = dev->machine().root_device().memregion(name.c_str())->bytes();
+ }
/* Reset Prescaler */
OPNSetPres( OPN, 6*24, 6*24, 4*2); /* OPN 1/6 , SSG 1/4 */
diff --git a/src/devices/sound/upd7759.cpp b/src/devices/sound/upd7759.cpp
index a7e0491687f..d5727b6464d 100644
--- a/src/devices/sound/upd7759.cpp
+++ b/src/devices/sound/upd7759.cpp
@@ -145,52 +145,53 @@
upd775x_device::upd775x_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
- : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
- device_sound_interface(mconfig, *this),
- m_channel(nullptr),
- m_sample_offset_shift(0),
- m_pos(0),
- m_step(0),
- m_fifo_in(0),
- m_reset(0),
- m_start(0),
- m_drq(0),
- m_state(0),
- m_clocks_left(0),
- m_nibbles_left(0),
- m_repeat_count(0),
- m_post_drq_state(0),
- m_post_drq_clocks(0),
- m_req_sample(0),
- m_last_sample(0),
- m_block_header(0),
- m_sample_rate(0),
- m_first_valid_header(0),
- m_offset(0),
- m_repeat_offset(0),
- m_adpcm_state(0),
- m_adpcm_data(0),
- m_sample(0),
- m_rom(nullptr),
- m_rombase(nullptr),
- m_romoffset(0),
- m_rommask(0),
- m_drqcallback(*this)
+ : device_t(mconfig, type, name, tag, owner, clock, shortname, source)
+ , device_sound_interface(mconfig, *this)
+ , m_channel(nullptr)
+ , m_sample_offset_shift(0)
+ , m_pos(0)
+ , m_step(0)
+ , m_fifo_in(0)
+ , m_reset(0)
+ , m_start(0)
+ , m_drq(0)
+ , m_state(0)
+ , m_clocks_left(0)
+ , m_nibbles_left(0)
+ , m_repeat_count(0)
+ , m_post_drq_state(0)
+ , m_post_drq_clocks(0)
+ , m_req_sample(0)
+ , m_last_sample(0)
+ , m_block_header(0)
+ , m_sample_rate(0)
+ , m_first_valid_header(0)
+ , m_offset(0)
+ , m_repeat_offset(0)
+ , m_adpcm_state(0)
+ , m_adpcm_data(0)
+ , m_sample(0)
+ , m_rom_region(*this, tag)
+ , m_rom(nullptr)
+ , m_rombase(nullptr)
+ , m_romoffset(0)
+ , m_rommask(0)
+ , m_drqcallback(*this)
{
}
const device_type UPD7759 = &device_creator<upd7759_device>;
upd7759_device::upd7759_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
- : upd775x_device(mconfig, UPD7759, "uPD7759", tag, owner, clock, "upd7759", __FILE__),
- m_timer(nullptr)
+ : upd775x_device(mconfig, UPD7759, "uPD7759", tag, owner, clock, "upd7759", __FILE__)
+ , m_timer(nullptr)
{
}
upd7759_device::upd7759_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
: upd775x_device(mconfig, type, name, tag, owner, clock, shortname, source),
- m_timer(nullptr)
+ , m_timer(nullptr)
{
}
@@ -231,20 +232,27 @@ void upd7759_device::device_start()
/* compute the ROM base or allocate a timer */
m_romoffset = 0;
- m_rom = m_rombase = region()->base();
- if (m_rombase == nullptr)
+ if (m_rom_region != nullptr)
{
- assert(type() == UPD7759); // other chips do not support slave mode
- m_timer = timer_alloc(TIMER_SLAVE_UPDATE);
- m_rommask = 0;
+ m_rom = m_rombase = m_rom_region->base();
+
+ UINT32 romsize = m_rom_region->bytes();
+ if (romsize >= 0x20000)
+ {
+ m_rommask = 0x1ffff;
+ }
+ else
+ {
+ m_rommask = romsize - 1;
+ }
+
+ m_drqcallback.set_callback(DEVCB_NULL);
}
else
{
- UINT32 romsize = region()->bytes();
- if (romsize >= 0x20000) m_rommask = 0x1ffff;
- else m_rommask = romsize - 1;
-
- m_drqcallback.set_callback(DEVCB_NULL);
+ assert(type() == UPD7759); // other chips do not support slave mode
+ m_timer = timer_alloc(TIMER_SLAVE_UPDATE);
+ m_rommask = 0;
}
/* assume /RESET and /START are both high */
@@ -306,19 +314,26 @@ void upd7756_device::device_start()
/* compute the ROM base or allocate a timer */
m_romoffset = 0;
- m_rom = m_rombase = region()->base();
- if (m_rombase == nullptr)
- {
- m_rommask = 0;
- }
- else
+ if (m_rom_region != nullptr)
{
+ m_rom = m_rombase = m_rom_region->base();
+
UINT32 romsize = region()->bytes();
- if (romsize >= 0x20000) m_rommask = 0x1ffff;
- else m_rommask = romsize - 1;
+ if (romsize >= 0x20000)
+ {
+ m_rommask = 0x1ffff;
+ }
+ else
+ {
+ m_rommask = romsize - 1;
+ }
m_drqcallback.set_callback(DEVCB_NULL);
}
+ else
+ {
+ m_rommask = 0;
+ }
/* assume /RESET and /START are both high */
m_reset = 1;
diff --git a/src/devices/sound/upd7759.h b/src/devices/sound/upd7759.h
index 637732b22fa..f42039a785a 100644
--- a/src/devices/sound/upd7759.h
+++ b/src/devices/sound/upd7759.h
@@ -95,6 +95,7 @@ protected:
INT16 m_sample; /* current sample value */
/* ROM access */
+ optional_memory_region m_rom_region; /* ROM data region which may or may not be present */
UINT8 * m_rom; /* pointer to ROM data or NULL for slave mode */
UINT8 * m_rombase; /* pointer to ROM data or NULL for slave mode */
UINT32 m_romoffset; /* ROM offset to make save/restore easier */
diff --git a/src/devices/sound/ymz280b.cpp b/src/devices/sound/ymz280b.cpp
index 02c0283b4ae..fad4f1b7558 100644
--- a/src/devices/sound/ymz280b.cpp
+++ b/src/devices/sound/ymz280b.cpp
@@ -581,10 +581,15 @@ void ymz280b_device::device_start()
/* initialize the rest of the structure */
m_master_clock = (double)clock() / 384.0;
- m_mem_base = region()->base();
- m_mem_size = region()->bytes();
m_irq_handler.resolve();
+ if (region() != NULL)
+ {
+ /* Some systems (e.g. Konami Firebeat) have a YMZ280B on-board that isn't hooked up to ROM, so be safe. */
+ m_mem_base = region()->base();
+ m_mem_size = region()->bytes();
+ }
+
for (int i = 0; i < 8; i++)
{
m_voice[i].timer = timer_alloc(i);
diff --git a/src/mame/audio/dcs.cpp b/src/mame/audio/dcs.cpp
index cad34e38130..33c7d160076 100644
--- a/src/mame/audio/dcs.cpp
+++ b/src/mame/audio/dcs.cpp
@@ -594,31 +594,32 @@ MACHINE_CONFIG_END
void dcs_audio_device::dcs_boot()
{
- UINT8 buffer[0x1000];
-// UINT32 max_banks;
- UINT16 *base;
- int i;
-
switch (m_rev)
{
/* rev 1/1.5: use the last set data bank to boot from */
case 1:
case 15:
-
+ {
/* determine the base */
-// max_banks = m_bootrom_words / 0x1000;
- base = m_bootrom + ((m_sounddata_bank * 0x1000) % m_bootrom_words);
+ // max_banks = m_bootrom_words / 0x1000;
+ UINT16* base = m_bootrom + ((m_sounddata_bank * 0x1000) % m_bootrom_words);
/* convert from 16-bit data to 8-bit data and boot */
- for (i = 0; i < 0x1000; i++)
+ UINT8 buffer[0x1000];
+ for (int i = 0; i < 0x1000; i++)
+ {
buffer[i] = base[i];
+ }
+ assert(m_internal_program_ram != NULL);
m_cpu->load_boot_data(buffer, m_internal_program_ram);
break;
+ }
/* rev 2: use the ROM page in the SDRC to boot from */
case 2:
-
+ {
/* determine the base */
+ UINT16* base;
if (m_bootrom == m_sounddata)
{
/* EPROM case: page is selected from the page register */
@@ -631,10 +632,15 @@ void dcs_audio_device::dcs_boot()
}
/* convert from 16-bit data to 8-bit data and boot */
- for (i = 0; i < 0x1000; i++)
+ UINT8 buffer[0x1000];
+ for (int i = 0; i < 0x1000; i++)
+ {
buffer[i] = base[i];
+ }
+ assert(m_internal_program_ram != NULL);
m_cpu->load_boot_data(buffer, m_internal_program_ram);
break;
+ }
/* rev 3/4: HALT the ADSP-2181 until program is downloaded via IDMA */
case 3:
@@ -665,7 +671,7 @@ TIMER_CALLBACK_MEMBER( dcs_audio_device::dcs_reset )
case 1:
case 15:
m_sounddata_bank = 0;
- membank("databank")->set_entry(0);
+ m_data_bank->set_entry(0);
break;
/* rev 2: reset the SDRC ASIC */
@@ -807,6 +813,9 @@ dcs_audio_device::dcs_audio_device(const machine_config &mconfig, device_type ty
m_sounddata_words(0),
m_sounddata_banks(0),
m_sounddata_bank(0),
+ m_data_bank(*this, "databank"),
+ m_rom_page(NULL),
+ m_dram_page(NULL),
m_auto_ack(0),
m_latch_control(0),
m_input_data(0),
@@ -845,8 +854,16 @@ void dcs_audio_device::device_start()
{
m_sram = nullptr;
- m_internal_program_ram = (UINT32 *)memshare("dcsint")->ptr();
- m_external_program_ram = (UINT32 *)memshare("dcsext")->ptr();
+ memory_share *internal_ram = memshare("dcsint");
+ if (internal_ram != NULL)
+ {
+ m_internal_program_ram = (UINT32 *)internal_ram->ptr();
+ }
+ memory_share *external_ram = memshare("dcsext");
+ if (external_ram != NULL)
+ {
+ m_external_program_ram = (UINT32 *)external_ram->ptr();
+ }
/* find the DCS CPU and the sound ROMs */
m_cpu = subdevice<adsp21xx_device>("dcs");
@@ -866,12 +883,12 @@ void dcs_audio_device::device_start()
if (m_rev == 1)
{
m_sounddata_banks = m_sounddata_words / 0x1000;
- membank("databank")->configure_entries(0, m_sounddata_banks, m_sounddata, 0x1000*2);
+ m_data_bank->configure_entries(0, m_sounddata_banks, m_sounddata, 0x1000*2);
}
else
{
m_sounddata_banks = m_sounddata_words / 0x800;
- membank("databank")->configure_entries(0, m_sounddata_banks, m_sounddata, 0x800*2);
+ m_data_bank->configure_entries(0, m_sounddata_banks, m_sounddata, 0x800*2);
}
/* create the timers */
@@ -891,8 +908,16 @@ void dcs2_audio_device::device_start()
{
int soundbank_words;
- m_internal_program_ram = (UINT32 *)memshare("dcsint")->ptr();
- m_external_program_ram = (UINT32 *)memshare("dcsext")->ptr();
+ memory_share *internal_ram = memshare("dcsint");
+ if (internal_ram != NULL)
+ {
+ m_internal_program_ram = (UINT32 *)internal_ram->ptr();
+ }
+ memory_share *external_ram = memshare("dcsext");
+ if (external_ram != NULL)
+ {
+ m_external_program_ram = (UINT32 *)external_ram->ptr();
+ }
/* find the DCS CPU and the sound ROMs */
m_cpu = subdevice<adsp21xx_device>("dcs2");
@@ -937,7 +962,9 @@ void dcs2_audio_device::device_start()
}
m_sounddata_banks = m_sounddata_words / soundbank_words;
if (m_rev != 2)
- membank("databank")->configure_entries(0, m_sounddata_banks, m_sounddata, soundbank_words*2);
+ {
+ m_data_bank->configure_entries(0, m_sounddata_banks, m_sounddata, soundbank_words*2);
+ }
/* allocate memory for the SRAM */
m_sram = auto_alloc_array(machine(), UINT16, 0x8000*4/2);
@@ -982,12 +1009,14 @@ void dcs_audio_device::set_auto_ack(int state)
READ16_MEMBER( dcs_audio_device::dcs_dataram_r )
{
+ assert(m_external_program_ram != NULL);
return m_external_program_ram[offset] >> 8;
}
WRITE16_MEMBER( dcs_audio_device::dcs_dataram_w )
{
+ assert(m_external_program_ram != NULL);
UINT16 val = m_external_program_ram[offset] >> 8;
COMBINE_DATA(&val);
m_external_program_ram[offset] = (val << 8) | (m_external_program_ram[offset] & 0x0000ff);
@@ -1001,7 +1030,7 @@ WRITE16_MEMBER( dcs_audio_device::dcs_data_bank_select_w )
else
m_sounddata_bank = (m_sounddata_bank & 0xff00) | (data & 0xff);
- membank("databank")->set_entry(m_sounddata_bank % m_sounddata_banks);
+ m_data_bank->set_entry(m_sounddata_bank % m_sounddata_banks);
/* bit 11 = sound board led */
#if 0
@@ -1014,7 +1043,7 @@ WRITE16_MEMBER( dcs_audio_device::dcs_data_bank_select2_w )
{
m_sounddata_bank = (m_sounddata_bank & 0x00ff) | ((data & 0x01) << 8) | ((data & 0xfc) << 7);
- membank("databank")->set_entry(m_sounddata_bank % m_sounddata_banks);
+ m_data_bank->set_entry(m_sounddata_bank % m_sounddata_banks);
}
/*************************************
@@ -1034,15 +1063,21 @@ void dcs_audio_device::sdrc_update_bank_pointers()
{
/* ROM-based; use the memory page to select from ROM */
if (SDRC_ROM_MS == 1 && SDRC_ROM_ST != 3)
- membank("rompage")->set_base(&m_sounddata[(SDRC_EPM_PG * pagesize) % m_sounddata_words]);
+ {
+ m_rom_page->set_base(&m_sounddata[(SDRC_EPM_PG * pagesize) % m_sounddata_words]);
+ }
}
else
{
/* RAM-based; use the ROM page to select from ROM, and the memory page to select from RAM */
if (SDRC_ROM_MS == 1 && SDRC_ROM_ST != 3)
- membank("rompage")->set_base(&m_bootrom[(SDRC_ROM_PG * 4096 /*pagesize*/) % m_bootrom_words]);
+ {
+ m_rom_page->set_base(&m_bootrom[(SDRC_ROM_PG * 4096 /*pagesize*/) % m_bootrom_words]);
+ }
if (SDRC_DM_ST != 0)
- membank("drampage")->set_base(&m_sounddata[(SDRC_DM_PG * 1024) % m_sounddata_words]);
+ {
+ m_dram_page->set_base(&m_sounddata[(SDRC_DM_PG * 1024) % m_sounddata_words]);
+ }
}
}
}
@@ -1087,6 +1122,7 @@ void dcs_audio_device::sdrc_remap_memory()
int baseaddr = (SDRC_ROM_ST == 0) ? 0x0000 : (SDRC_ROM_ST == 1) ? 0x3000 : 0x3400;
int pagesize = (SDRC_ROM_SZ == 0 && SDRC_ROM_ST != 0) ? 4096 : 1024;
m_data->install_read_bank(baseaddr, baseaddr + pagesize - 1, "rompage");
+ m_rom_page = membank("rompage");
}
/* map the DRAM page as bank 26 */
@@ -1094,6 +1130,7 @@ void dcs_audio_device::sdrc_remap_memory()
{
int baseaddr = (SDRC_DM_ST == 1) ? 0x0000 : (SDRC_DM_ST == 2) ? 0x3000 : 0x3400;
m_data->install_readwrite_bank(baseaddr, baseaddr + 0x3ff, "drampage");
+ m_dram_page = membank("drampage");
}
/* update the bank pointers */
@@ -1285,7 +1322,7 @@ WRITE16_MEMBER( dcs_audio_device::dsio_w )
/* offset 2 controls RAM pages */
case 2:
dsio.reg[2] = data;
- membank("databank")->set_entry(DSIO_DM_PG % m_sounddata_banks);
+ m_data_bank->set_entry(DSIO_DM_PG % m_sounddata_banks);
break;
}
}
@@ -1352,7 +1389,7 @@ WRITE16_MEMBER( dcs_audio_device::denver_w )
/* offset 2 controls RAM pages */
case 2:
dsio.reg[2] = data;
- membank("databank")->set_entry(DENV_DM_PG % m_sounddata_banks);
+ m_data_bank->set_entry(DENV_DM_PG % m_sounddata_banks);
break;
/* offset 3 controls FIFO reset */
diff --git a/src/mame/audio/dcs.h b/src/mame/audio/dcs.h
index 7f84d5fed96..538a3e288c5 100644
--- a/src/mame/audio/dcs.h
+++ b/src/mame/audio/dcs.h
@@ -165,6 +165,10 @@ protected:
UINT32 m_sounddata_banks;
UINT16 m_sounddata_bank;
+ optional_memory_bank m_data_bank;
+ memory_bank * m_rom_page;
+ memory_bank * m_dram_page;
+
/* I/O with the host */
UINT8 m_auto_ack;
UINT16 m_latch_control;
diff --git a/src/mame/drivers/neogeo_noslot.cpp b/src/mame/drivers/neogeo_noslot.cpp
index cf7d6d4334f..72dcee47026 100644
--- a/src/mame/drivers/neogeo_noslot.cpp
+++ b/src/mame/drivers/neogeo_noslot.cpp
@@ -2967,8 +2967,7 @@ ROM_END
BANK 2 NOT USED
BANK 3 NOT USED
****************************************/
-
- ROM_START( b2b )
+ROM_START( b2b )
ROM_REGION( 0x100000, "maincpu", 0 )
ROM_LOAD16_WORD_SWAP( "071.p1", 0x000000, 0x080000, CRC(7687197d) SHA1(4bb9cb7819807f7a7e1f85f1c4faac4a2f8761e8) )
@@ -2979,6 +2978,8 @@ ROM_END
ROM_REGION( 0x100000, "ymsnd", 0 )
ROM_LOAD( "071.v1", 0x000000, 0x100000, CRC(50feffb0) SHA1(00127dae0130889995bfa7560bc4b0662f74fba5) )
+ NO_DELTAT_REGION
+
ROM_REGION( 0x400000, "sprites", 0 )
ROM_LOAD16_BYTE( "071.c1", 0x000000, 0x200000, CRC(23d84a7a) SHA1(9034658ad40e2c45558abc3db312aa2764102fc4) ) /* Plane 0,1 */
ROM_LOAD16_BYTE( "071.c2", 0x000001, 0x200000, CRC(ce7b6248) SHA1(ad1cd5adae5c151e183ff88b68afe10f7009f48e) ) /* Plane 2,3 */
diff --git a/src/mame/drivers/sfbonus.cpp b/src/mame/drivers/sfbonus.cpp
index 46843e34271..3fcf0368c39 100644
--- a/src/mame/drivers/sfbonus.cpp
+++ b/src/mame/drivers/sfbonus.cpp
@@ -294,7 +294,9 @@ public:
m_2801_regs(*this, "2801_regs"),
m_2c01_regs(*this, "2c01_regs"),
m_3000_regs(*this, "3000_regs"),
- m_3800_regs(*this, "3800_regs") { }
+ m_3800_regs(*this, "3800_regs")
+ {
+ }
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
@@ -5843,9 +5845,6 @@ ROM_START( amclink )
ROM_REGION( 0x100000, "gfx2", ROMREGION_ERASE00 )
ROM_END
-//ROM_REGION( 0x80000, "user1", 0 ) /* Z80 Code */
-//ROM_LOAD( "dummy.rom", 0x00000, 0x40000, CRC(1) SHA1(1) )
-
DRIVER_INIT_MEMBER(sfbonus_state,sfbonus_common)
{
m_tilemap_ram = std::make_unique<UINT8[]>(0x4000);
@@ -5873,46 +5872,6 @@ DRIVER_INIT_MEMBER(sfbonus_state,sfbonus_common)
memset(m_videoram.get(), 0xff, 0x10000);
save_pointer(NAME(m_videoram.get()), 0x10000);
-
- // dummy.rom helper
- {
- UINT8 *ROM = memregion("maincpu")->base();
- int length = memregion("maincpu")->bytes();
- UINT8* ROM2 = memregion("user1")->base();
-
- if (ROM2)
- {
- printf("X %02x %02x %02x %02x %02x %02x %02x %02x\n", ROM[0x50], ROM[0x51], ROM[0x52], ROM[0x53], ROM[0x54], ROM[0x55],ROM[0x56],ROM[0x57]);
-
- {
- int x;
- int y;
- for (y = 0; y < 0x8; y++)
- {
- printf("@Echo Off\n");
- printf("a.exe ");
- for (x = 0; x < 0x20 * 0x8; x += 0x8)
- {
- printf("%02x %02x ", ROM[x + y], ROM2[x + y]);
- }
- printf("\n");
- }
-
- }
-
- {
- FILE *fp;
- char filename[256];
- sprintf(filename,"decr_%s", machine().system().name);
- fp = fopen(filename, "w+b");
- if (fp)
- {
- fwrite(ROM, length, 1, fp);
- fclose(fp);
- }
- }
- }
- }
}
void sfbonus_state::sfbonus_bitswap(
@@ -6348,8 +6307,6 @@ GAME( 2006, version4o, version4, sfbonus, amcoe1_reels3, sfbonus_state,
// Known sets but no roms dumped at all for these:
// Merry Circus
// Devil Island - 14 Liner version
-// Fruit Bonus 2010 (or is this on the older goldstar.c style hardware)
-
// ?? what is this
GAME( 200?, amclink, 0, sfbonus, amcoe1_reels3, sfbonus_state, sfbonus_common, ROT0, "Amcoe", "Amcoe Link Control Box (Version 2.2)", MACHINE_NOT_WORKING)
diff --git a/src/mame/includes/btime.h b/src/mame/includes/btime.h
index fb27d1722cc..3c9ddb7f2ba 100644
--- a/src/mame/includes/btime.h
+++ b/src/mame/includes/btime.h
@@ -9,22 +9,26 @@
class btime_state : public driver_device
{
public:
+<<<<<<< HEAD
btime_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_rambase(*this, "rambase"),
- m_videoram(*this, "videoram"),
- m_colorram(*this, "colorram"),
- m_bnj_backgroundram(*this, "bnj_bgram"),
- m_zoar_scrollram(*this, "zoar_scrollram"),
- m_lnc_charbank(*this, "lnc_charbank"),
- m_deco_charram(*this, "deco_charram"),
- m_spriteram(*this, "spriteram"),
- m_audio_rambase(*this, "audio_rambase"),
- m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_screen(*this, "screen"),
- m_palette(*this, "palette") { }
+ : driver_device(mconfig, type, tag)
+ , m_rambase(*this, "rambase")
+ , m_videoram(*this, "videoram")
+ , m_colorram(*this, "colorram")
+ , m_bnj_backgroundram(*this, "bnj_bgram")
+ , m_zoar_scrollram(*this, "zoar_scrollram")
+ , m_lnc_charbank(*this, "lnc_charbank")
+ , m_deco_charram(*this, "deco_charram")
+ , m_spriteram(*this, "spriteram")
+ , m_audio_rambase(*this, "audio_rambase")
+ , m_maincpu(*this, "maincpu")
+ , m_audiocpu(*this, "audiocpu")
+ , m_gfxdecode(*this, "gfxdecode")
+ , m_screen(*this, "screen")
+ , m_palette(*this, "palette")
+ , m_prom_region(*this, "proms")
+ {
+ }
/* memory pointers */
optional_shared_ptr<UINT8> m_rambase;
@@ -62,6 +66,7 @@ public:
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
+ optional_memory_region m_prom_region;
DECLARE_WRITE8_MEMBER(audio_nmi_enable_w);
DECLARE_WRITE8_MEMBER(audio_command_w);
diff --git a/src/mame/includes/cps1.h b/src/mame/includes/cps1.h
index 6e3354de437..a26495d923b 100644
--- a/src/mame/includes/cps1.h
+++ b/src/mame/includes/cps1.h
@@ -124,7 +124,8 @@ public:
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
- m_decrypted_opcodes(*this, "decrypted_opcodes")
+ m_decrypted_opcodes(*this, "decrypted_opcodes"),
+ m_region_stars(*this, "stars")
{ }
/* memory pointers */
@@ -232,6 +233,7 @@ public:
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
optional_shared_ptr<UINT16> m_decrypted_opcodes;
+ optional_memory_region m_region_stars;
DECLARE_READ16_MEMBER(cps1_hack_dsw_r);
DECLARE_READ16_MEMBER(cps1_in1_r);
diff --git a/src/mame/video/btime.cpp b/src/mame/video/btime.cpp
index bda913ffd58..07e7a1fde32 100644
--- a/src/mame/video/btime.cpp
+++ b/src/mame/video/btime.cpp
@@ -32,33 +32,34 @@
PALETTE_INIT_MEMBER(btime_state,btime)
{
- const UINT8 *color_prom = memregion("proms")->base();
- int i;
-
-
/* Burger Time doesn't have a color PROM, but Hamburge has. */
/* This function is also used by Eggs. */
- if (color_prom == nullptr) return;
-
- for (i = 0; i < palette.entries(); i++)
+ if (m_prom_region == nullptr)
{
- int bit0, bit1, bit2, r, g, b;
+ return;
+ }
+
+ const UINT8 *color_prom = m_prom_region->base();
+ for (int i = 0; i < palette.entries(); i++)
+ {
/* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int bit0 = (color_prom[i] >> 0) & 0x01;
+ int bit1 = (color_prom[i] >> 1) & 0x01;
+ int bit2 = (color_prom[i] >> 2) & 0x01;
+ int r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
/* green component */
bit0 = (color_prom[i] >> 3) & 0x01;
bit1 = (color_prom[i] >> 4) & 0x01;
bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
/* blue component */
bit0 = 0;
bit1 = (color_prom[i] >> 6) & 0x01;
bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r,g,b));
}
@@ -84,27 +85,26 @@ PALETTE_INIT_MEMBER(btime_state,btime)
PALETTE_INIT_MEMBER(btime_state,lnc)
{
const UINT8 *color_prom = memregion("proms")->base();
- int i;
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
-
/* red component */
- bit0 = (color_prom[i] >> 7) & 0x01;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int bit0 = (color_prom[i] >> 7) & 0x01;
+ int bit1 = (color_prom[i] >> 6) & 0x01;
+ int bit2 = (color_prom[i] >> 5) & 0x01;
+ int r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
/* green component */
bit0 = (color_prom[i] >> 4) & 0x01;
bit1 = (color_prom[i] >> 3) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
/* blue component */
bit0 = 0;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 0) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r,g,b));
}
diff --git a/src/mame/video/cps1.cpp b/src/mame/video/cps1.cpp
index 0b2fe39782c..790db240802 100644
--- a/src/mame/video/cps1.cpp
+++ b/src/mame/video/cps1.cpp
@@ -2806,7 +2806,7 @@ void cps_state::cps2_render_sprites( screen_device &screen, bitmap_ind16 &bitmap
void cps_state::cps1_render_stars( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
{
int offs;
- UINT8 *stars_rom = memregion("stars")->base();
+ UINT8 *stars_rom = m_region_stars->base();
if (!stars_rom && (m_stars_enabled[0] || m_stars_enabled[1]))
{
@@ -2967,7 +2967,10 @@ UINT32 cps_state::screen_update_cps1(screen_device &screen, bitmap_ind16 &bitmap
bitmap.fill(m_palette->black_pen(), cliprect);
}
- cps1_render_stars(screen, bitmap, cliprect);
+ if (m_region_stars)
+ {
+ cps1_render_stars(screen, bitmap, cliprect);
+ }
/* Draw layers (0 = sprites, 1-3 = tilemaps) */
l0 = (layercontrol >> 0x06) & 03;