Replace machine().device with subdevice for NVRAM installation; clean up videopkr.cpp a little more (nw)

I have to figure out a better way to do this...
This commit is contained in:
AJR 2018-06-03 19:18:03 -04:00
parent 269b06a99b
commit 74c566eafd
29 changed files with 45 additions and 82 deletions

View File

@ -931,7 +931,7 @@ MACHINE_START_MEMBER(cat_state,cat)
m_video_enable = 1;
m_video_invert = 0;
m_6ms_timer = timer_alloc(TIMER_COUNTER_6MS);
machine().device<nvram_device>("nvram")->set_base(m_svram, 0x4000);
subdevice<nvram_device>("nvram")->set_base(m_svram, 0x4000);
}
MACHINE_RESET_MEMBER(cat_state,cat)

View File

@ -628,7 +628,7 @@ void esripsys_state::init_esripsys()
m_fdt_b = std::make_unique<uint8_t[]>(FDT_RAM_SIZE);
m_cmos_ram = std::make_unique<uint8_t[]>(CMOS_RAM_SIZE);
machine().device<nvram_device>("nvram")->set_base(m_cmos_ram.get(), CMOS_RAM_SIZE);
subdevice<nvram_device>("nvram")->set_base(m_cmos_ram.get(), CMOS_RAM_SIZE);
membank("bank2")->set_base(&rom[0x0000]);
membank("bank3")->set_base(&rom[0x4000]);

View File

@ -53,7 +53,6 @@ public:
required_device<cpu_device> m_maincpu;
required_device<pc_noppi_mb_device> m_mb;
required_device<pc_keyboard_device> m_keyboard;
isa8_aga_device *m_aga;
DECLARE_WRITE8_MEMBER( europc_pio_w );
DECLARE_READ8_MEMBER( europc_pio_r );
@ -385,9 +384,7 @@ void europc_pc_state::init_europc()
m_rtc_timer->adjust(attotime::zero, 0, attotime(1,0));
// europc_rtc_set_time();
machine().device<nvram_device>("nvram")->set_base(m_rtc_data, sizeof(m_rtc_data));
m_aga = machine().device<isa8_aga_device>("aga:aga");
subdevice<nvram_device>("nvram")->set_base(m_rtc_data, sizeof(m_rtc_data));
}
WRITE8_MEMBER( europc_pc_state::europc_pio_w )

View File

@ -496,7 +496,7 @@ void hitpoker_state::init_hitpoker()
uint8_t *ROM = memregion("maincpu")->base();
// init nvram
machine().device<nvram_device>("nvram")->set_base(m_eeprom_data, sizeof(m_eeprom_data));
subdevice<nvram_device>("nvram")->set_base(m_eeprom_data, sizeof(m_eeprom_data));
ROM[0x1220] = 0x01; //patch eeprom write?
ROM[0x1221] = 0x01;

View File

@ -172,7 +172,7 @@ void magtouch_state::machine_start()
{
m_rombank->configure_entries(0, 0x80, memregion("game_prg")->base(), 0x8000 );
m_rombank->set_entry(0);
machine().device<nvram_device>("nvram")->set_base(memshare("nvram")->ptr(), 0x2000);
subdevice<nvram_device>("nvram")->set_base(memshare("nvram")->ptr(), 0x2000);
}
static void magtouch_isa8_cards(device_slot_interface &device)

View File

@ -1075,7 +1075,7 @@ MACHINE_START_MEMBER(meritm_state,meritm_crt250_crt252_crt258)
MACHINE_START_MEMBER(meritm_state,meritm_crt260)
{
m_ram = std::make_unique<uint8_t[]>( 0x8000 );
machine().device<nvram_device>("nvram")->set_base(m_ram.get(), 0x8000);
subdevice<nvram_device>("nvram")->set_base(m_ram.get(), 0x8000);
memset(m_ram.get(), 0x00, 0x8000);
m_bank1->configure_entries(0, 128, m_region_maincpu->base(), 0x8000);
m_bank2->configure_entries(0, 128, m_region_maincpu->base(), 0x8000);

View File

@ -372,7 +372,7 @@ WRITE16_MEMBER(ngcd_state::neocd_control_w)
// printf("blah %02x\n", byteValue);
if (byteValue == 0x00)
{
machine().device("ymsnd")->reset();
m_ym->reset();
m_audiocpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
}
else m_audiocpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
@ -847,7 +847,7 @@ void ngcd_state::machine_start()
// initialize the memcard data structure
// NeoCD doesn't have memcard slots, rather, it has a larger internal memory which works the same
m_meminternal_data = make_unique_clear<uint8_t[]>(0x2000);
machine().device<nvram_device>("saveram")->set_base(m_meminternal_data.get(), 0x2000);
subdevice<nvram_device>("saveram")->set_base(m_meminternal_data.get(), 0x2000);
save_pointer(NAME(m_meminternal_data.get()), 0x2000);
m_tempcdc->reset_cd();

View File

@ -69,7 +69,7 @@ void pcat_dyn_state::machine_start()
{
m_prgbank->configure_entries(0, 256, memregion("game_prg")->base(), 0x1000);
m_nvram_bank->configure_entries(0, 2, &m_nvram_mem[0], 0x1000);
machine().device<nvram_device>("nvram")->set_base(&m_nvram_mem[0], 0x2000);
subdevice<nvram_device>("nvram")->set_base(&m_nvram_mem[0], 0x2000);
}
void pcat_dyn_state::nvram_init(nvram_device &nvram, void *base, size_t size)

View File

@ -425,7 +425,7 @@ ROM_END
void pcat_nit_state::init_pcat_nit()
{
m_banked_nvram = std::make_unique<uint8_t[]>(0x2000);
machine().device<nvram_device>("nvram")->set_base(m_banked_nvram.get(), 0x2000);
subdevice<nvram_device>("nvram")->set_base(m_banked_nvram.get(), 0x2000);
}
GAME( 1993, streetg, 0, pcat_nit, pcat_nit, pcat_nit_state, init_pcat_nit, ROT0, "New Image Technologies", "Street Games (Revision 4)", MACHINE_NOT_WORKING|MACHINE_NO_SOUND )

View File

@ -870,7 +870,7 @@ void pce220_state::machine_start()
m_vram = (uint8_t*)memregion("lcd_vram")->base();
machine().device<nvram_device>("nvram")->set_base(ram, m_ram->size());
subdevice<nvram_device>("nvram")->set_base(ram, m_ram->size());
}
void pcg850v_state::machine_start()
@ -884,7 +884,7 @@ void pcg850v_state::machine_start()
membank("bank4")->configure_entries(0, 22, rom, 0x4000);
m_vram = (uint8_t*)memregion("lcd_vram")->base();
machine().device<nvram_device>("nvram")->set_base(ram, m_ram->size());
subdevice<nvram_device>("nvram")->set_base(ram, m_ram->size());
}
void pce220_state::machine_reset()

View File

@ -417,7 +417,7 @@ void s7_state::machine_start()
m_digits.resolve();
m_memprotect = 0;
save_item(NAME(m_nvram));
machine().device<nvram_device>("nvram")->set_base(m_nvram, sizeof(m_nvram));
subdevice<nvram_device>("nvram")->set_base(m_nvram, sizeof(m_nvram));
}
MACHINE_RESET_MEMBER( s7_state, s7 )

View File

@ -1184,7 +1184,7 @@ void segas24_state::decrypted_opcodes_map(address_map &map)
void segas24_state::machine_start()
{
if (track_size)
machine().device<nvram_device>("floppy_nvram")->set_base(memregion("floppy")->base(), 2*track_size);
subdevice<nvram_device>("floppy_nvram")->set_base(memregion("floppy")->base(), 2*track_size);
if (m_romboard != nullptr)
{

View File

@ -4221,7 +4221,7 @@ void tmnt_state::init_cuebrick()
{
membank("nvrambank")->configure_entries(0, 0x20, m_cuebrick_nvram, 0x400);
machine().device<nvram_device>("nvram")->set_base(m_cuebrick_nvram, sizeof(m_cuebrick_nvram));
subdevice<nvram_device>("nvram")->set_base(m_cuebrick_nvram, sizeof(m_cuebrick_nvram));
save_item(NAME(m_cuebrick_nvram));
}

View File

@ -300,7 +300,7 @@ void tomcat_state::machine_start()
((uint16_t*)m_shared_ram)[0x0002] = 0xf600;
((uint16_t*)m_shared_ram)[0x0003] = 0x0000;
machine().device<nvram_device>("nvram")->set_base(m_nvram, 0x800);
subdevice<nvram_device>("nvram")->set_base(m_nvram, 0x800);
save_item(NAME(m_nvram));
save_item(NAME(m_dsp_BIO));

View File

@ -18,7 +18,7 @@ Atari Triple Hunt Driver
void triplhnt_state::init_triplhnt()
{
machine().device<nvram_device>("nvram")->set_base(m_cmos, sizeof(m_cmos));
subdevice<nvram_device>("nvram")->set_base(m_cmos, sizeof(m_cmos));
}

View File

@ -157,7 +157,7 @@ void ttchamp_state::machine_start()
m_picmodex = picmode::IDLE;
m_bakram = std::make_unique<uint8_t[]>(0x100);
machine().device<nvram_device>("backram")->set_base(m_bakram.get(), 0x100);
subdevice<nvram_device>("backram")->set_base(m_bakram.get(), 0x100);
save_item(NAME(m_paloff));
save_item(NAME(m_port10));

View File

@ -1262,7 +1262,7 @@ void cuebrickj_state::init_cuebrickj()
membank("nvrambank")->configure_entries(0, 0x20, m_nvram, 0x400);
machine().device<nvram_device>("nvram")->set_base(m_nvram, sizeof(m_nvram));
subdevice<nvram_device>("nvram")->set_base(m_nvram, sizeof(m_nvram));
save_item(NAME(m_nvram));
}

View File

@ -368,7 +368,7 @@ void upscope_state::init_upscope()
m_denise_id = DENISE;
// allocate nvram
machine().device<nvram_device>("nvram")->set_base(m_nvram, sizeof(m_nvram));
subdevice<nvram_device>("nvram")->set_base(m_nvram, sizeof(m_nvram));
}

View File

@ -308,8 +308,8 @@ public:
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_soundcpu(*this, "soundcpu")
, m_dac(*this, "dac")
, m_gfxdecode(*this, "gfxdecode")
, m_aysnd(*this, "aysnd")
, m_digits(*this, "digit%u", 0U)
, m_lamps(*this, "lamp%u", 0U)
{ }
@ -329,10 +329,6 @@ public:
DECLARE_READ8_MEMBER(baby_sound_p0_r);
DECLARE_WRITE8_MEMBER(baby_sound_p0_w);
DECLARE_READ8_MEMBER(baby_sound_p1_r);
DECLARE_WRITE8_MEMBER(baby_sound_p1_w);
DECLARE_READ8_MEMBER(baby_sound_p2_r);
DECLARE_WRITE8_MEMBER(baby_sound_p2_w);
DECLARE_READ8_MEMBER(baby_sound_p3_r);
DECLARE_WRITE8_MEMBER(baby_sound_p3_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
DECLARE_PALETTE_INIT(videopkr);
@ -371,7 +367,6 @@ protected:
uint8_t m_vp_sound_p2;
uint8_t m_p24_data;
uint8_t m_sound_latch;
uint8_t m_baby_latch;
uint8_t m_sound_ant;
uint8_t m_dc_4020;
uint8_t m_dc_40103;
@ -392,13 +387,11 @@ protected:
unsigned long m_count3;
unsigned long m_count4;
uint8_t m_sbp0;
uint8_t m_sbp2;
uint8_t m_sbp3;
tilemap_t *m_bg_tilemap;
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_soundcpu;
required_device<dac_byte_interface> m_dac;
required_device<gfxdecode_device> m_gfxdecode;
optional_device<ay8910_device> m_aysnd;
output_finder<28> m_digits;
output_finder<14> m_lamps;
};
@ -907,60 +900,36 @@ READ8_MEMBER(videopkr_state::baby_sound_p1_r)
m_hp_2 = (~m_p24_data >> 5) & 1;
m_bell = (m_p1 >> 4) & 1;
m_aux3 = (m_p1 >> 3) & 1;
m_baby_latch = m_c_io + (m_hp_1 << 1) + (m_hp_2 << 2) + (m_bell << 3) + (m_aux3 << 4) + 0xe0;
return m_baby_latch;
}
WRITE8_MEMBER(videopkr_state::baby_sound_p1_w)
{
m_baby_latch = m_baby_latch | data;
}
READ8_MEMBER(videopkr_state::baby_sound_p2_r)
{
return m_sbp2;
}
WRITE8_MEMBER(videopkr_state::baby_sound_p2_w)
{
m_sbp2 = data;
m_dac->write(data);
}
READ8_MEMBER(videopkr_state::baby_sound_p3_r)
{
return m_sbp3;
return m_c_io | (m_hp_1 << 1) | (m_hp_2 << 2) | (m_bell << 3) | (m_aux3 << 4) | 0xe0;
}
WRITE8_MEMBER(videopkr_state::baby_sound_p3_w)
{
ay8910_device *ay8910 = machine().device<ay8910_device>("aysnd");
uint8_t lmp_ports, ay_intf;
m_sbp3 = data;
lmp_ports = m_sbp3 >> 1 & 0x07;
lmp_ports = data >> 1 & 0x07;
output().set_value("TOP_1", (lmp_ports >> 0) & 1);
output().set_value("TOP_2", (lmp_ports >> 1) & 1);
output().set_value("TOP_3", (lmp_ports >> 2) & 1);
if (!(m_sbp3 & 0x10))
if (!(data & 0x10))
{
reset();
logerror("AY3-8910: Reset\n");
}
ay_intf = (m_sbp3 >> 5) & 0x07;
ay_intf = (data >> 5) & 0x07;
switch (ay_intf)
{
case 0x00: break;
case 0x01: break;
case 0x02: break;
case 0x03: ay8910->data_w(space, 1, m_sbp0); break;
case 0x03: m_aysnd->data_w(space, 1, m_sbp0); break;
case 0x04: break;
case 0x05: m_sbp0 = ay8910->data_r(space, m_sbp0); break;
case 0x05: m_sbp0 = m_aysnd->data_r(space, m_sbp0); break;
case 0x06: break;
case 0x07: ay8910->address_w(space, 0, m_sbp0); break;
case 0x07: m_aysnd->address_w(space, 0, m_sbp0); break;
}
}
@ -1258,7 +1227,7 @@ void videopkr_state::machine_start()
m_ant_cio = 0;
m_count0 = 0;
machine().device<nvram_device>("nvram")->set_base(m_data_ram, sizeof(m_data_ram));
subdevice<nvram_device>("nvram")->set_base(m_data_ram, sizeof(m_data_ram));
}
/************************
@ -1356,10 +1325,7 @@ MACHINE_CONFIG_START(videopkr_state::babypkr)
MCFG_MCS51_PORT_P0_IN_CB(READ8(*this, videopkr_state, baby_sound_p0_r))
MCFG_MCS51_PORT_P0_OUT_CB(WRITE8(*this, videopkr_state, baby_sound_p0_w))
MCFG_MCS51_PORT_P1_IN_CB(READ8(*this, videopkr_state, baby_sound_p1_r))
MCFG_MCS51_PORT_P1_OUT_CB(WRITE8(*this, videopkr_state, baby_sound_p1_w))
MCFG_MCS51_PORT_P2_IN_CB(READ8(*this, videopkr_state, baby_sound_p2_r))
MCFG_MCS51_PORT_P2_OUT_CB(WRITE8(*this, videopkr_state, baby_sound_p2_w))
MCFG_MCS51_PORT_P3_IN_CB(READ8(*this, videopkr_state, baby_sound_p3_r))
MCFG_MCS51_PORT_P2_OUT_CB(WRITE8("dac", dac_byte_interface, write))
MCFG_MCS51_PORT_P3_OUT_CB(WRITE8(*this, videopkr_state, baby_sound_p3_w))
/* video hardware */

View File

@ -1573,7 +1573,7 @@ void x68k_state::init_x68000()
unsigned char* rom = memregion("maincpu")->base();
unsigned char* user2 = memregion("user2")->base();
machine().device<nvram_device>("nvram")->set_base(&m_nvram[0], m_nvram.size()*sizeof(m_nvram[0]));
subdevice<nvram_device>("nvram")->set_base(&m_nvram[0], m_nvram.size()*sizeof(m_nvram[0]));
#ifdef USE_PREDEFINED_SRAM
{

View File

@ -1183,7 +1183,7 @@ void zn_state::coh1000tb_map(address_map &map)
void zn_state::init_coh1000tb()
{
m_fx1b_fram = std::make_unique<uint8_t[]>(0x200);
machine().device<nvram_device>("fm1208s")->set_base(m_fx1b_fram.get(), 0x200);
subdevice<nvram_device>("fm1208s")->set_base(m_fx1b_fram.get(), 0x200);
save_pointer(NAME(m_fx1b_fram.get()), 0x200);
}
@ -2147,7 +2147,7 @@ void zn_state::nbajamex_bank_map(address_map &map)
void zn_state::init_nbajamex()
{
m_nbajamex_sram = std::make_unique<uint8_t[]>(0x8000);
machine().device<nvram_device>("71256")->set_base(m_nbajamex_sram.get(), 0x8000);
subdevice<nvram_device>("71256")->set_base(m_nbajamex_sram.get(), 0x8000);
save_pointer(NAME(m_nbajamex_sram.get()), 0x8000);

View File

@ -1981,7 +1981,7 @@ MACHINE_START_MEMBER(apple2gs_state,apple2gscommon)
/* setup globals */
m_is_rom3 = true;
machine().device<nvram_device>("nvram")->set_base(m_clock_bram, sizeof(m_clock_bram));
subdevice<nvram_device>("nvram")->set_base(m_clock_bram, sizeof(m_clock_bram));
/* save state stuff. note that the driver takes care of docram. */
uint8_t* ram = m_ram->pointer();

View File

@ -935,7 +935,7 @@ void hp48_state::base_machine_start(hp48_models model)
HP48_GX_MODEL ? (128 * 1024) : (32 * 1024);
uint8_t *ram = auto_alloc_array(machine(), uint8_t, 2 * ram_size);
machine().device<nvram_device>("nvram")->set_base(ram, 2 * ram_size);
subdevice<nvram_device>("nvram")->set_base(ram, 2 * ram_size);
/* ROM load */

View File

@ -136,7 +136,7 @@ MACHINE_START_MEMBER(namcos2_shared_state,namcos2)
{
namcos2_kickstart = nullptr;
m_eeprom = std::make_unique<uint8_t[]>(m_eeprom_size);
machine().device<nvram_device>("nvram")->set_base(m_eeprom.get(), m_eeprom_size);
subdevice<nvram_device>("nvram")->set_base(m_eeprom.get(), m_eeprom_size);
}
MACHINE_RESET_MEMBER(namcos2_shared_state, namcos2)

View File

@ -130,6 +130,6 @@ void pc1350_state::machine_start()
uint8_t *ram = memregion("maincpu")->base() + 0x2000;
uint8_t *cpu = m_maincpu->internal_ram();
machine().device<nvram_device>("cpu_nvram")->set_base(cpu, 96);
machine().device<nvram_device>("ram_nvram")->set_base(ram, 0x5000);
subdevice<nvram_device>("cpu_nvram")->set_base(cpu, 96);
subdevice<nvram_device>("ram_nvram")->set_base(ram, 0x5000);
}

View File

@ -116,8 +116,8 @@ void pc1401_state::machine_start()
uint8_t *ram = memregion("maincpu")->base() + 0x2000;
uint8_t *cpu = m_maincpu->internal_ram();
machine().device<nvram_device>("cpu_nvram")->set_base(cpu, 96);
machine().device<nvram_device>("ram_nvram")->set_base(ram, 0x2800);
subdevice<nvram_device>("cpu_nvram")->set_base(cpu, 96);
subdevice<nvram_device>("ram_nvram")->set_base(ram, 0x2800);
}
void pc1401_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)

View File

@ -143,8 +143,8 @@ void pc1403_state::machine_start()
uint8_t *ram = memregion("maincpu")->base() + 0x8000;
uint8_t *cpu = m_maincpu->internal_ram();
machine().device<nvram_device>("cpu_nvram")->set_base(cpu, 96);
machine().device<nvram_device>("ram_nvram")->set_base(ram, 0x8000);
subdevice<nvram_device>("cpu_nvram")->set_base(cpu, 96);
subdevice<nvram_device>("ram_nvram")->set_base(ram, 0x8000);
}
void pc1403_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)

View File

@ -470,7 +470,7 @@ MACHINE_START_MEMBER(ti85_state,ti86)
membank("bank2")->set_base(m_bios + 0x04000);
membank("bank4")->set_base(m_ti8x_ram.get());
machine().device<nvram_device>("nvram")->set_base(m_ti8x_ram.get(), sizeof(uint8_t)*128*1024);
subdevice<nvram_device>("nvram")->set_base(m_ti8x_ram.get(), sizeof(uint8_t)*128*1024);
m_ti85_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ti85_state::ti85_timer_callback), this));
m_ti85_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256));

View File

@ -175,7 +175,7 @@ void wswan_state::common_start()
register_save();
machine().device<nvram_device>("nvram")->set_base(m_internal_eeprom, INTERNAL_EEPROM_SIZE);
subdevice<nvram_device>("nvram")->set_base(m_internal_eeprom, INTERNAL_EEPROM_SIZE);
if (m_cart->exists())
{