Yet more this==NULL fixes

This commit is contained in:
therealmogminer@gmail.com 2015-11-19 13:45:40 +01:00 committed by Miodrag Milanovic
parent b74eab06c5
commit d617ff8b37
14 changed files with 220 additions and 108 deletions

View File

@ -195,10 +195,39 @@ void es5506_device::device_start()
m_stream = machine().sound().stream_alloc(*this, 0, 2 * channels, clock() / (16*32)); m_stream = machine().sound().stream_alloc(*this, 0, 2 * channels, clock() / (16*32));
/* initialize the regions */ /* initialize the regions */
m_region_base[0] = m_region0 ? (UINT16 *)machine().root_device().memregion(m_region0)->base() : nullptr; m_region_base[0] = m_region_base[1] = m_region_base[2] = m_region_base[3] = nullptr;
m_region_base[1] = m_region1 ? (UINT16 *)machine().root_device().memregion(m_region1)->base() : nullptr; if (m_region0)
m_region_base[2] = m_region2 ? (UINT16 *)machine().root_device().memregion(m_region2)->base() : nullptr; {
m_region_base[3] = m_region3 ? (UINT16 *)machine().root_device().memregion(m_region3)->base() : nullptr; memory_region *region0 = machine().root_device().memregion(m_region0);
if (region0 != nullptr)
{
m_region_base[0] = (UINT16 *)region0->base();
}
}
if (m_region1)
{
memory_region *region1 = machine().root_device().memregion(m_region1);
if (region1 != nullptr)
{
m_region_base[1] = (UINT16 *)region1->base();
}
}
if (m_region2)
{
memory_region *region2 = machine().root_device().memregion(m_region2);
if (region2 != nullptr)
{
m_region_base[2] = (UINT16 *)region2->base();
}
}
if (m_region3)
{
memory_region *region3 = machine().root_device().memregion(m_region3);
if (region3 != nullptr)
{
m_region_base[3] = (UINT16 *)region3->base();
}
}
/* initialize the rest of the structure */ /* initialize the rest of the structure */
m_master_clock = clock(); m_master_clock = clock();

View File

@ -37,18 +37,19 @@ const device_type NAMCO_CUS30 = &device_creator<namco_cus30_device>;
namco_audio_device::namco_audio_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) namco_audio_device::namco_audio_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, __FILE__), : device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__),
device_sound_interface(mconfig, *this), , device_sound_interface(mconfig, *this)
m_last_channel(nullptr), , m_wave_region(*this, tag)
m_soundregs(nullptr), , m_last_channel(nullptr)
m_wavedata(nullptr), , m_soundregs(nullptr)
m_wave_size(0), , m_wavedata(nullptr)
m_sound_enable(0), , m_wave_size(0)
m_stream(nullptr), , m_sound_enable(0)
m_namco_clock(0), , m_stream(nullptr)
m_sample_rate(0), , m_namco_clock(0)
m_f_fracbits(0), , m_sample_rate(0)
m_voices(0), , m_f_fracbits(0)
m_stereo(0) , m_voices(0)
, m_stereo(0)
{ {
} }
@ -95,7 +96,7 @@ void namco_audio_device::device_start()
logerror("Namco: freq fractional bits = %d: internal freq = %d, output freq = %d\n", m_f_fracbits, m_namco_clock, m_sample_rate); logerror("Namco: freq fractional bits = %d: internal freq = %d, output freq = %d\n", m_f_fracbits, m_namco_clock, m_sample_rate);
/* build the waveform table */ /* build the waveform table */
build_decoded_waveform(region()->base()); build_decoded_waveform(m_wave_region != NULL ? m_wave_region->base() : NULL);
/* get stream channels */ /* get stream channels */
if (m_stereo) if (m_stereo)
@ -109,7 +110,11 @@ void namco_audio_device::device_start()
/* register with the save state system */ /* register with the save state system */
save_pointer(NAME(m_soundregs), 0x400); save_pointer(NAME(m_soundregs), 0x400);
<<<<<<< HEAD
if (region() == nullptr) if (region() == nullptr)
=======
if (m_wave_region == NULL)
>>>>>>> Yet more this==NULL fixes
save_pointer(NAME(m_wavedata), 0x400); save_pointer(NAME(m_wavedata), 0x400);
save_item(NAME(m_voices)); save_item(NAME(m_voices));

View File

@ -53,6 +53,9 @@ protected:
void update_namco_waveform(int offset, UINT8 data); void update_namco_waveform(int offset, UINT8 data);
UINT32 namco_update_one(stream_sample_t *buffer, int length, const INT16 *wave, UINT32 counter, UINT32 freq); UINT32 namco_update_one(stream_sample_t *buffer, int length, const INT16 *wave, UINT32 counter, UINT32 freq);
/* waveform region */
optional_memory_region m_wave_region;
/* data about the sound system */ /* data about the sound system */
sound_channel m_channel_list[MAX_VOICES]; sound_channel m_channel_list[MAX_VOICES];
sound_channel *m_last_channel; sound_channel *m_last_channel;

View File

@ -149,6 +149,7 @@ scsp_device::scsp_device(const machine_config &mconfig, const char *tag, device_
m_roffset(0), m_roffset(0),
m_irq_cb(*this), m_irq_cb(*this),
m_main_irq_cb(*this), m_main_irq_cb(*this),
m_ram_region(*this, tag),
m_BUFPTR(0), m_BUFPTR(0),
m_SCSPRAM(nullptr), m_SCSPRAM(nullptr),
m_SCSPRAM_LENGTH(0), m_SCSPRAM_LENGTH(0),
@ -515,13 +516,16 @@ void scsp_device::init()
m_Master=0; m_Master=0;
} }
m_SCSPRAM = region()->base(); if (m_ram_region)
if (m_SCSPRAM)
{ {
m_SCSPRAM_LENGTH = region()->bytes(); m_SCSPRAM = m_ram_region->base();
m_DSP.SCSPRAM = (UINT16 *)m_SCSPRAM; if (m_SCSPRAM)
m_DSP.SCSPRAM_LENGTH = m_SCSPRAM_LENGTH/2; {
m_SCSPRAM += m_roffset; m_SCSPRAM_LENGTH = m_ram_region->bytes();
m_DSP.SCSPRAM = (UINT16 *)m_SCSPRAM;
m_DSP.SCSPRAM_LENGTH = m_SCSPRAM_LENGTH/2;
m_SCSPRAM += m_roffset;
}
} }
m_timerA = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(scsp_device::timerA_cb), this)); m_timerA = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(scsp_device::timerA_cb), this));

View File

@ -104,6 +104,7 @@ private:
int m_roffset; /* offset in the region */ int m_roffset; /* offset in the region */
devcb_write8 m_irq_cb; /* irq callback */ devcb_write8 m_irq_cb; /* irq callback */
devcb_write_line m_main_irq_cb; devcb_write_line m_main_irq_cb;
optional_memory_region m_ram_region;
union union
{ {

View File

@ -1049,7 +1049,11 @@ static const unsigned int example_word_TEN[619]={
void tms5110_device::device_start() void tms5110_device::device_start()
{ {
m_table = region()->base(); m_table = NULL;
if (m_table_region != NULL)
{
m_table = m_table_region->base();
}
set_variant(TMS5110_IS_TMS5110A); set_variant(TMS5110_IS_TMS5110A);
@ -1532,23 +1536,25 @@ const device_type TMS5110 = &device_creator<tms5110_device>;
tms5110_device::tms5110_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) tms5110_device::tms5110_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, TMS5110, "TMS5110", tag, owner, clock, "tms5110", __FILE__), : device_t(mconfig, TMS5110, "TMS5110", tag, owner, clock, "tms5110", __FILE__),
device_sound_interface(mconfig, *this), , device_sound_interface(mconfig, *this)
m_m0_cb(*this), , m_table_region(*this, tag)
m_m1_cb(*this), , m_m0_cb(*this)
m_addr_cb(*this), , m_m1_cb(*this)
m_data_cb(*this), , m_addr_cb(*this)
m_romclk_cb(*this) , m_data_cb(*this)
, m_romclk_cb(*this)
{ {
} }
tms5110_device::tms5110_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) tms5110_device::tms5110_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_t(mconfig, type, name, tag, owner, clock, shortname, source)
device_sound_interface(mconfig, *this), , device_sound_interface(mconfig, *this)
m_m0_cb(*this), , m_table_region(*this, tag)
m_m1_cb(*this), , m_m0_cb(*this)
m_addr_cb(*this), , m_m1_cb(*this)
m_data_cb(*this), , m_addr_cb(*this)
m_romclk_cb(*this) , m_data_cb(*this)
, m_romclk_cb(*this)
{ {
} }

View File

@ -97,6 +97,9 @@ private:
void parse_frame(); void parse_frame();
// internal state // internal state
/* table region */
optional_memory_region m_table_region;
/* coefficient tables */ /* coefficient tables */
int m_variant; /* Variant of the 5110 - see tms5110.h */ int m_variant; /* Variant of the 5110 - see tms5110.h */

View File

@ -788,12 +788,25 @@ void cps3_state::init_crypt(UINT32 key1, UINT32 key2, int altEncryption)
m_altEncryption = altEncryption; m_altEncryption = altEncryption;
// cache pointers to regions // cache pointers to regions
m_user4region = memregion("user4")->base(); if (m_user4_region)
m_user5region = memregion("user5")->base(); {
m_user4 = m_user4_region->base();
}
else
{
m_user4 = auto_alloc_array(machine(), UINT8, USER4REGION_LENGTH);
}
if (!m_user4region) m_user4region = auto_alloc_array(machine(), UINT8, USER4REGION_LENGTH); if (m_user5_region)
if (!m_user5region) m_user5region = auto_alloc_array(machine(), UINT8, USER5REGION_LENGTH); {
m_cps3sound->set_base((INT8*)m_user5region); m_user5 = m_user5_region->base();
}
else
{
m_user5 = auto_alloc_array(machine(), UINT8, USER5REGION_LENGTH);
}
m_cps3sound->set_base((INT8*)m_user5);
// set strict verify // set strict verify
m_maincpu->sh2drc_set_options(SH2DRC_STRICT_VERIFY); m_maincpu->sh2drc_set_options(SH2DRC_STRICT_VERIFY);
@ -1468,7 +1481,7 @@ WRITE32_MEMBER(cps3_state::cps3_gfxflash_w)
/* make a copy in the linear memory region we actually use for drawing etc. having it stored in interleaved flash roms isnt' very useful */ /* make a copy in the linear memory region we actually use for drawing etc. having it stored in interleaved flash roms isnt' very useful */
{ {
UINT32* romdata = (UINT32*)m_user5region; UINT32* romdata = (UINT32*)m_user5;
int real_offset = 0; int real_offset = 0;
UINT32 newdata; UINT32 newdata;
@ -1575,7 +1588,7 @@ void cps3_state::cps3_flashmain_w(int which, UINT32 offset, UINT32 data, UINT32
/* copy data into regions to execute from */ /* copy data into regions to execute from */
{ {
UINT32* romdata = (UINT32*)m_user4region; UINT32* romdata = (UINT32*)m_user4;
UINT32* romdata2 = (UINT32*)m_decrypted_gamerom; UINT32* romdata2 = (UINT32*)m_decrypted_gamerom;
int real_offset = 0; int real_offset = 0;
UINT32 newdata; UINT32 newdata;
@ -1799,7 +1812,7 @@ WRITE32_MEMBER(cps3_state::cps3_palettedma_w)
if (data & 0x0002) if (data & 0x0002)
{ {
int i; int i;
UINT16* src = (UINT16*)m_user5region; UINT16* src = (UINT16*)m_user5;
// if(DEBUG_PRINTF) printf("CPS3 pal dma start %08x (real: %08x) dest %08x fade %08x other2 %08x (length %04x)\n", m_paldma_source, m_paldma_realsource, m_paldma_dest, m_paldma_fade, m_paldma_other2, m_paldma_length); // if(DEBUG_PRINTF) printf("CPS3 pal dma start %08x (real: %08x) dest %08x fade %08x other2 %08x (length %04x)\n", m_paldma_source, m_paldma_realsource, m_paldma_dest, m_paldma_fade, m_paldma_other2, m_paldma_length);
for (i=0;i<m_paldma_length;i++) for (i=0;i<m_paldma_length;i++)
@ -1873,7 +1886,7 @@ UINT32 cps3_state::process_byte( UINT8 real_byte, UINT32 destination, int max_le
void cps3_state::cps3_do_char_dma( UINT32 real_source, UINT32 real_destination, UINT32 real_length ) void cps3_state::cps3_do_char_dma( UINT32 real_source, UINT32 real_destination, UINT32 real_length )
{ {
UINT8* sourcedata = (UINT8*)m_user5region; UINT8* sourcedata = (UINT8*)m_user5;
int length_remaining; int length_remaining;
m_last_normal_byte = 0; m_last_normal_byte = 0;
@ -1956,7 +1969,7 @@ UINT32 cps3_state::ProcessByte8(UINT8 b,UINT32 dst_offset)
void cps3_state::cps3_do_alt_char_dma( UINT32 src, UINT32 real_dest, UINT32 real_length ) void cps3_state::cps3_do_alt_char_dma( UINT32 src, UINT32 real_dest, UINT32 real_length )
{ {
UINT8* px = (UINT8*)m_user5region; UINT8* px = (UINT8*)m_user5;
UINT32 start = real_dest; UINT32 start = real_dest;
UINT32 ds = real_dest; UINT32 ds = real_dest;
@ -2299,7 +2312,7 @@ void cps3_state::machine_reset()
// make a copy in the regions we execute code / draw gfx from // make a copy in the regions we execute code / draw gfx from
void cps3_state::copy_from_nvram() void cps3_state::copy_from_nvram()
{ {
UINT32* romdata = (UINT32*)m_user4region; UINT32* romdata = (UINT32*)m_user4;
UINT32* romdata2 = (UINT32*)m_decrypted_gamerom; UINT32* romdata2 = (UINT32*)m_decrypted_gamerom;
int i; int i;
/* copy + decrypt program roms which have been loaded from flashroms/nvram */ /* copy + decrypt program roms which have been loaded from flashroms/nvram */
@ -2336,7 +2349,7 @@ void cps3_state::copy_from_nvram()
int flashnum = 0; int flashnum = 0;
int countoffset = 0; int countoffset = 0;
romdata = (UINT32*)m_user5region; romdata = (UINT32*)m_user5;
for (thebase = 0;thebase < len/2; thebase+=0x200000) for (thebase = 0;thebase < len/2; thebase+=0x200000)
{ {
// printf("flashnums %d. %d\n",flashnum, flashnum+1); // printf("flashnums %d. %d\n",flashnum, flashnum+1);

View File

@ -427,9 +427,10 @@ void jaguar_state::machine_reset()
} }
/* configure banks for gfx/sound ROMs */ /* configure banks for gfx/sound ROMs */
UINT8 *romboard = memregion("romboard")->base(); if (m_romboard_region != nullptr)
if (romboard != nullptr)
{ {
UINT8 *romboard = m_romboard_region->base();
/* graphics banks */ /* graphics banks */
if (m_is_r3000) if (m_is_r3000)
{ {
@ -617,7 +618,7 @@ WRITE32_MEMBER(jaguar_state::misc_control_w)
} }
/* adjust banking */ /* adjust banking */
if (memregion("romboard")->base()) if (m_romboard_region != NULL)
{ {
membank("mainsndbank")->set_entry((data >> 1) & 7); membank("mainsndbank")->set_entry((data >> 1) & 7);
membank("dspsndbank")->set_entry((data >> 1) & 7); membank("dspsndbank")->set_entry((data >> 1) & 7);
@ -776,10 +777,12 @@ WRITE32_MEMBER(jaguar_state::latch_w)
logerror("%08X:latch_w(%X)\n", space.device().safe_pcbase(), data); logerror("%08X:latch_w(%X)\n", space.device().safe_pcbase(), data);
/* adjust banking */ /* adjust banking */
if (memregion("romboard")->base()) if (m_romboard_region != NULL)
{ {
if (m_is_r3000) if (m_is_r3000)
{
membank("maingfxbank")->set_entry(data & 1); membank("maingfxbank")->set_entry(data & 1);
}
membank("gpugfxbank")->set_entry(data & 1); membank("gpugfxbank")->set_entry(data & 1);
} }
} }
@ -1915,7 +1918,8 @@ MACHINE_CONFIG_END
void jaguar_state::fix_endian( UINT32 addr, UINT32 size ) void jaguar_state::fix_endian( UINT32 addr, UINT32 size )
{ {
UINT8 j[4], *ram = memregion("maincpu")->base(); UINT8 j[4];
UINT8 *ram = memregion("maincpu")->base();
UINT32 i; UINT32 i;
size += addr; size += addr;
logerror("File Loaded to address range %X to %X\n",addr,size-1); logerror("File Loaded to address range %X to %X\n",addr,size-1);

View File

@ -98,11 +98,14 @@ class segac2_state : public md_base_state
{ {
public: public:
segac2_state(const machine_config &mconfig, device_type type, const char *tag) segac2_state(const machine_config &mconfig, device_type type, const char *tag)
: md_base_state(mconfig, type, tag), : md_base_state(mconfig, type, tag)
m_paletteram(*this, "paletteram"), , m_paletteram(*this, "paletteram")
m_upd7759(*this, "upd"), , m_upd_region(*this, "upd")
m_screen(*this, "screen"), , m_upd7759(*this, "upd")
m_palette(*this, "palette") { } , m_screen(*this, "screen")
, m_palette(*this, "palette")
{
}
// for Print Club only // for Print Club only
int m_cam_data; int m_cam_data;
@ -110,6 +113,7 @@ public:
int m_segac2_enable_display; int m_segac2_enable_display;
required_shared_ptr<UINT16> m_paletteram; required_shared_ptr<UINT16> m_paletteram;
optional_memory_region m_upd_region;
/* protection-related tracking */ /* protection-related tracking */
segac2_prot_delegate m_prot_func; /* emulation of protection chip */ segac2_prot_delegate m_prot_func; /* emulation of protection chip */
@ -244,8 +248,10 @@ MACHINE_RESET_MEMBER(segac2_state,segac2)
/* determine how many sound banks */ /* determine how many sound banks */
m_sound_banks = 0; m_sound_banks = 0;
if (memregion("upd")->base()) if (m_upd_region != NULL)
m_sound_banks = memregion("upd")->bytes() / 0x20000; {
m_sound_banks = m_upd_region->bytes() / 0x20000;
}
/* reset the protection */ /* reset the protection */
m_prot_write_buf = 0; m_prot_write_buf = 0;
@ -934,7 +940,7 @@ INPUT_PORTS_END
static INPUT_PORTS_START( wwmarine ) static INPUT_PORTS_START( wwmarine )
PORT_INCLUDE( systemc_generic ) PORT_INCLUDE( systemc_generic )
PORT_MODIFY("P1") PORT_MODIFY("P1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) // Button 1 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) // Button 1
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) // Button 2 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) // Button 2

View File

@ -14,24 +14,28 @@
class cps3_state : public driver_device class cps3_state : public driver_device
{ {
public: public:
<<<<<<< HEAD
cps3_state(const machine_config &mconfig, device_type type, const char *tag) cps3_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag)
m_maincpu(*this, "maincpu"), , m_maincpu(*this, "maincpu")
m_gfxdecode(*this, "gfxdecode"), , m_gfxdecode(*this, "gfxdecode")
m_palette(*this, "palette"), , m_palette(*this, "palette")
m_cps3sound(*this, "cps3sound"), , m_cps3sound(*this, "cps3sound")
m_mainram(*this, "mainram"), , m_mainram(*this, "mainram")
m_spriteram(*this, "spriteram"), , m_spriteram(*this, "spriteram")
m_colourram(*this, "colourram"), , m_colourram(*this, "colourram")
m_tilemap20_regs_base(*this, "tmap20_regs"), , m_tilemap20_regs_base(*this, "tmap20_regs")
m_tilemap30_regs_base(*this, "tmap30_regs"), , m_tilemap30_regs_base(*this, "tmap30_regs")
m_tilemap40_regs_base(*this, "tmap40_regs"), , m_tilemap40_regs_base(*this, "tmap40_regs")
m_tilemap50_regs_base(*this, "tmap50_regs"), , m_tilemap50_regs_base(*this, "tmap50_regs")
m_fullscreenzoom(*this, "fullscreenzoom"), , m_fullscreenzoom(*this, "fullscreenzoom")
m_0xc0000000_ram(*this, "0xc0000000_ram"), , m_0xc0000000_ram(*this, "0xc0000000_ram")
m_decrypted_gamerom(*this, "decrypted_gamerom"), , m_decrypted_gamerom(*this, "decrypted_gamerom")
m_0xc0000000_ram_decrypted(*this, "0xc0000000_ram_decrypted") , m_0xc0000000_ram_decrypted(*this, "0xc0000000_ram_decrypted")
{ } , m_user4_region(*this, "user4")
, m_user5_region(*this, "user5")
{
}
required_device<sh2_device> m_maincpu; required_device<sh2_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode; required_device<gfxdecode_device> m_gfxdecode;
@ -50,6 +54,9 @@ public:
required_shared_ptr<UINT32> m_decrypted_gamerom; required_shared_ptr<UINT32> m_decrypted_gamerom;
required_shared_ptr<UINT32> m_0xc0000000_ram_decrypted; required_shared_ptr<UINT32> m_0xc0000000_ram_decrypted;
optional_memory_region m_user4_region;
optional_memory_region m_user5_region;
fujitsu_29f016a_device *m_simm[7][8]; fujitsu_29f016a_device *m_simm[7][8];
UINT32 m_cram_gfxflash_bank; UINT32 m_cram_gfxflash_bank;
std::unique_ptr<UINT32[]> m_char_ram; std::unique_ptr<UINT32[]> m_char_ram;
@ -61,7 +68,7 @@ public:
std::unique_ptr<UINT32[]> m_mame_colours; std::unique_ptr<UINT32[]> m_mame_colours;
bitmap_rgb32 m_renderbuffer_bitmap; bitmap_rgb32 m_renderbuffer_bitmap;
rectangle m_renderbuffer_clip; rectangle m_renderbuffer_clip;
UINT8* m_user4region; UINT8* m_user4;
UINT32 m_key1; UINT32 m_key1;
UINT32 m_key2; UINT32 m_key2;
int m_altEncryption; int m_altEncryption;
@ -81,7 +88,7 @@ public:
int m_last_normal_byte; int m_last_normal_byte;
unsigned short m_lastb; unsigned short m_lastb;
unsigned short m_lastb2; unsigned short m_lastb2;
UINT8* m_user5region; UINT8* m_user5;
DECLARE_READ32_MEMBER(cps3_ssram_r); DECLARE_READ32_MEMBER(cps3_ssram_r);
DECLARE_WRITE32_MEMBER(cps3_ssram_w); DECLARE_WRITE32_MEMBER(cps3_ssram_w);

View File

@ -43,6 +43,7 @@ public:
m_shared_ram(*this, "sharedram"), m_shared_ram(*this, "sharedram"),
m_gpu_ram(*this, "gpuram"), m_gpu_ram(*this, "gpuram"),
m_gpu_clut(*this, "gpuclut"), m_gpu_clut(*this, "gpuclut"),
m_romboard_region(*this, "romboard"),
m_is_r3000(false), m_is_r3000(false),
m_is_cojag(false), m_is_cojag(false),
m_hacks_enabled(false), m_hacks_enabled(false),
@ -83,6 +84,7 @@ public:
required_shared_ptr<UINT32> m_shared_ram; required_shared_ptr<UINT32> m_shared_ram;
required_shared_ptr<UINT32> m_gpu_ram; required_shared_ptr<UINT32> m_gpu_ram;
required_shared_ptr<UINT32> m_gpu_clut; required_shared_ptr<UINT32> m_gpu_clut;
optional_memory_region m_romboard_region;
// configuration // configuration
bool m_is_r3000; bool m_is_r3000;

View File

@ -1106,7 +1106,7 @@ static device_t* get_expansion_device(running_machine &machine, const char* tag)
amstrad_state *state = machine.driver_data<amstrad_state>(); amstrad_state *state = machine.driver_data<amstrad_state>();
cpc_expansion_slot_device* exp_port = state->m_exp; cpc_expansion_slot_device* exp_port = state->m_exp;
while(exp_port != nullptr) while (exp_port != nullptr)
{ {
device_t* temp; device_t* temp;
@ -1117,11 +1117,16 @@ static device_t* get_expansion_device(running_machine &machine, const char* tag)
// if it's not what we're looking for, then check the expansion port on this expansion device. if it exists. // if it's not what we're looking for, then check the expansion port on this expansion device. if it exists.
temp = dynamic_cast<device_t*>(exp_port->get_card_device()); temp = dynamic_cast<device_t*>(exp_port->get_card_device());
if(temp == nullptr) if (temp == nullptr)
{
return nullptr; // no device attached return nullptr; // no device attached
}
exp_port = temp->subdevice<cpc_expansion_slot_device>("exp"); exp_port = temp->subdevice<cpc_expansion_slot_device>("exp");
if(exp_port == nullptr) if (exp_port == nullptr)
{
return nullptr; // we're at the end of the chain return nullptr; // we're at the end of the chain
}
} }
return nullptr; return nullptr;
} }
@ -2000,18 +2005,22 @@ WRITE8_MEMBER(amstrad_state::rom_select)
// expansion devices know the selected ROM by monitoring I/O writes to DFxx // expansion devices know the selected ROM by monitoring I/O writes to DFxx
// there are no signals related to which ROM is selected // there are no signals related to which ROM is selected
cpc_expansion_slot_device* exp_port = m_exp; cpc_expansion_slot_device* exp_port = m_exp;
while(exp_port != nullptr) while (exp_port != nullptr)
{ {
device_cpc_expansion_card_interface* temp; device_cpc_expansion_card_interface* temp;
device_t* temp_dev; device_t* temp_dev;
temp = dynamic_cast<device_cpc_expansion_card_interface*>(exp_port->get_card_device()); temp = dynamic_cast<device_cpc_expansion_card_interface*>(exp_port->get_card_device());
temp_dev = dynamic_cast<device_t*>(exp_port->get_card_device()); temp_dev = dynamic_cast<device_t*>(exp_port->get_card_device());
if(temp != nullptr) if (temp != nullptr)
{ {
temp->set_rom_bank(data); temp->set_rom_bank(data);
exp_port = temp_dev->subdevice<cpc_expansion_slot_device>("exp");
}
else
{
exp_port = NULL;
} }
exp_port = temp_dev->subdevice<cpc_expansion_slot_device>("exp");
} }
amstrad_rethinkMemory(); amstrad_rethinkMemory();
@ -2906,37 +2915,42 @@ static const UINT8 amstrad_cycle_table_ex[256]=
void amstrad_state::enumerate_roms() void amstrad_state::enumerate_roms()
{ {
UINT8 m_rom_count = 1; UINT8 m_rom_count = 1;
device_t* romexp;
rom_image_device* romimage;
UINT8 *rom = m_region_maincpu->base(); UINT8 *rom = m_region_maincpu->base();
char str[20];
int i;
bool slot3 = false,slot7 = false;
bool slot7 = false;
if (m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000) if (m_system_type == SYSTEM_PLUS || m_system_type == SYSTEM_GX4000)
{ {
UINT8 *crt = m_region_cart->base(); UINT8 *crt = m_region_cart->base();
int bank_mask = (m_cart->get_rom_size() / 0x4000) - 1; int bank_mask = (m_cart->get_rom_size() / 0x4000) - 1;
/* ROMs are stored on the inserted cartridge in the Plus/GX4000 */ /* ROMs are stored on the inserted cartridge in the Plus/GX4000 */
for(i=0; i<128; i++) // fill ROM table for (int i = 0; i < 128; i++) // fill ROM table
{
m_Amstrad_ROM_Table[i] = &crt[0x4000]; m_Amstrad_ROM_Table[i] = &crt[0x4000];
for(i=128;i<160;i++) }
for(int i = 128; i < 160; i++)
{
m_Amstrad_ROM_Table[i] = &crt[((i - 128) & bank_mask) * 0x4000]; m_Amstrad_ROM_Table[i] = &crt[((i - 128) & bank_mask) * 0x4000];
}
m_Amstrad_ROM_Table[7] = &crt[0xc000]; m_Amstrad_ROM_Table[7] = &crt[0xc000];
slot7 = true; slot7 = true;
} }
else else
{ {
/* slot 0 is always BASIC, as is any unused slot */ /* slot 0 is always BASIC, as is any unused slot */
for(i=0; i<256; i++) for (int i = 0; i<256; i++)
{
m_Amstrad_ROM_Table[i] = &rom[0x014000]; m_Amstrad_ROM_Table[i] = &rom[0x014000];
}
/* AMSDOS ROM -- TODO: exclude from 464 unless a DDI-1 device is connected */ /* AMSDOS ROM -- TODO: exclude from 464 unless a DDI-1 device is connected */
m_Amstrad_ROM_Table[7] = &rom[0x018000]; m_Amstrad_ROM_Table[7] = &rom[0x018000];
slot7 = true; slot7 = true;
} }
/* MSX-DOS BIOS - Aleste MSX emulation */ /* MSX-DOS BIOS - Aleste MSX emulation */
bool slot3 = false;
if(m_system_type == SYSTEM_ALESTE) if(m_system_type == SYSTEM_ALESTE)
{ {
m_Amstrad_ROM_Table[3] = &rom[0x01c000]; m_Amstrad_ROM_Table[3] = &rom[0x01c000];
@ -2955,36 +2969,41 @@ void amstrad_state::enumerate_roms()
temp = dynamic_cast<device_t*>(exp_port->get_card_device()); temp = dynamic_cast<device_t*>(exp_port->get_card_device());
if(temp != nullptr) if(temp != nullptr)
{ {
if(temp->memregion("exp_rom")->base() != nullptr) memory_region *temp_region = temp->memregion("exp_rom");
if(temp_region != nullptr && temp_region->base() != nullptr)
{ {
int num = temp->memregion("exp_rom")->bytes() / 0x4000; int num = temp_region->bytes() / 0x4000;
for(i=0;i<num;i++) for (int i = 0; i < num; i++)
{ {
m_Amstrad_ROM_Table[m_rom_count] = temp->memregion("exp_rom")->base()+0x4000*i; m_Amstrad_ROM_Table[m_rom_count] = temp_region->base()+0x4000*i;
NEXT_ROM_SLOT NEXT_ROM_SLOT
} }
} }
exp_port = temp->subdevice<cpc_expansion_slot_device>("exp");
}
else
{
exp_port = NULL;
} }
exp_port = temp->subdevice<cpc_expansion_slot_device>("exp");
} }
/* add ROMs from ROMbox expansion */ /* add ROMs from ROMbox expansion */
romexp = get_expansion_device(machine(),"rom"); device_t* romexp = get_expansion_device(machine(),"rom");
if(romexp) if(romexp)
{ {
for(i=0;i<8;i++) for(int i = 0; i < 8; i++)
{ {
sprintf(str,"rom%i",i+1); char str[20];
romimage = romexp->subdevice<rom_image_device>(str); sprintf(str, "rom%i", i + 1);
if(romimage->base() != nullptr) rom_image_device* romimage = romexp->subdevice<rom_image_device>(str);
if(romimage != NULL && romimage->base() != nullptr)
{ {
m_Amstrad_ROM_Table[m_rom_count] = romimage->base(); m_Amstrad_ROM_Table[m_rom_count] = romimage->base();
NEXT_ROM_SLOT NEXT_ROM_SLOT
} }
} }
} }
} }
void amstrad_state::amstrad_common_init() void amstrad_state::amstrad_common_init()
@ -3106,7 +3125,9 @@ MACHINE_START_MEMBER(amstrad_state,plus)
std::string region_tag; std::string region_tag;
m_region_cart = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str()); m_region_cart = memregion(region_tag.assign(m_cart->tag()).append(GENERIC_ROM_REGION_TAG).c_str());
if (!m_region_cart) // this should never happen, since we make carts mandatory! if (!m_region_cart) // this should never happen, since we make carts mandatory!
{
m_region_cart = memregion("maincpu"); m_region_cart = memregion("maincpu");
}
} }

View File

@ -1344,7 +1344,11 @@ void avg_device::device_start()
avgdvg_vectorram = reinterpret_cast<UINT8 *>(machine().root_device().memshare("vectorram")->ptr()); avgdvg_vectorram = reinterpret_cast<UINT8 *>(machine().root_device().memshare("vectorram")->ptr());
avgdvg_vectorram_size = machine().root_device().memshare("vectorram")->bytes(); avgdvg_vectorram_size = machine().root_device().memshare("vectorram")->bytes();
avgdvg_colorram = reinterpret_cast<UINT8 *>(machine().root_device().memshare("colorram")->ptr()); memory_share *colorram = machine().root_device().memshare("colorram");
if (colorram != NULL)
{
avgdvg_colorram = reinterpret_cast<UINT8 *>(colorram->ptr());
}
xmin = visarea.min_x; xmin = visarea.min_x;
ymin = visarea.min_y; ymin = visarea.min_y;
@ -1380,7 +1384,11 @@ void dvg_device::device_start()
avgdvg_vectorram = reinterpret_cast<UINT8 *>(machine().root_device().memshare("vectorram")->ptr()); avgdvg_vectorram = reinterpret_cast<UINT8 *>(machine().root_device().memshare("vectorram")->ptr());
avgdvg_vectorram_size = machine().root_device().memshare("vectorram")->bytes(); avgdvg_vectorram_size = machine().root_device().memshare("vectorram")->bytes();
avgdvg_colorram = reinterpret_cast<UINT8 *>(machine().root_device().memshare("colorram")->ptr()); memory_share *colorram = machine().root_device().memshare("colorram");
if (colorram != NULL)
{
avgdvg_colorram = reinterpret_cast<UINT8 *>(colorram->ptr());
}
xmin = visarea.min_x; xmin = visarea.min_x;
ymin = visarea.min_y; ymin = visarea.min_y;