mirror of
https://github.com/holub/mame
synced 2025-04-24 09:20:02 +03:00
Substitute some cases of deprecated tag lookups with device finders (nw)
This commit is contained in:
parent
092798b52f
commit
bdc93df0cf
@ -86,7 +86,8 @@ void mc1502_fdc_device::mc1502_wd17xx_aux_w(uint8_t data)
|
||||
floppy_image_device *floppy = ((data & 0x10) ? floppy1 : floppy0);
|
||||
|
||||
// master reset
|
||||
if ((data & 1) == 0) m_fdc->reset();
|
||||
if ((data & 1) == 0)
|
||||
m_fdc->reset();
|
||||
|
||||
m_fdc->set_floppy(floppy);
|
||||
|
||||
@ -109,13 +110,11 @@ void mc1502_fdc_device::mc1502_wd17xx_aux_w(uint8_t data)
|
||||
*/
|
||||
uint8_t mc1502_fdc_device::mc1502_wd17xx_drq_r()
|
||||
{
|
||||
cpu_device *maincpu = machine().device<cpu_device>("maincpu");
|
||||
|
||||
if (!m_fdc->drq_r() && !m_fdc->intrq_r())
|
||||
{
|
||||
// fake cpu wait by resetting PC one insn back
|
||||
maincpu->set_state_int(I8086_IP, maincpu->state_int(I8086_IP) - 1);
|
||||
maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
|
||||
m_maincpu->set_state_int(I8086_IP, m_maincpu->state_int(I8086_IP) - 1);
|
||||
m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
|
||||
}
|
||||
|
||||
return m_fdc->drq_r();
|
||||
@ -128,9 +127,8 @@ uint8_t mc1502_fdc_device::mc1502_wd17xx_motor_r()
|
||||
|
||||
WRITE_LINE_MEMBER(mc1502_fdc_device::mc1502_fdc_irq_drq)
|
||||
{
|
||||
cpu_device *maincpu = machine().device<cpu_device>("maincpu");
|
||||
|
||||
if (state) maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
|
||||
if (state)
|
||||
m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
|
||||
}
|
||||
|
||||
READ8_MEMBER(mc1502_fdc_device::mc1502_fdc_r)
|
||||
@ -187,12 +185,13 @@ WRITE8_MEMBER(mc1502_fdc_device::mc1502_fdc_w)
|
||||
// mc1502_fdc_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
mc1502_fdc_device::mc1502_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
mc1502_fdc_device::mc1502_fdc_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock)
|
||||
: device_t(mconfig, MC1502_FDC, tag, owner, clock)
|
||||
, device_isa8_card_interface(mconfig, *this)
|
||||
, m_fdc(*this, "fdc")
|
||||
, motor_on(0)
|
||||
, motor_timer(nullptr)
|
||||
, m_maincpu(*this, ":maincpu")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,7 @@ private:
|
||||
required_device<fd1793_device> m_fdc;
|
||||
int motor_on;
|
||||
emu_timer *motor_timer;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
|
||||
public:
|
||||
void mc1502_wd17xx_aux_w(uint8_t data);
|
||||
|
@ -81,13 +81,11 @@ uint8_t p1_fdc_device::p1_wd17xx_motor_r()
|
||||
|
||||
uint8_t p1_fdc_device::p1_wd17xx_aux_r()
|
||||
{
|
||||
cpu_device *maincpu = machine().device<cpu_device>("maincpu");
|
||||
|
||||
if (!m_fdc->drq_r() && !m_fdc->intrq_r())
|
||||
{
|
||||
// fake cpu wait by resetting PC one insn back
|
||||
maincpu->set_state_int(I8086_IP, maincpu->state_int(I8086_IP) - 2);
|
||||
maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
|
||||
m_maincpu->set_state_int(I8086_IP, m_maincpu->state_int(I8086_IP) - 2);
|
||||
m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
|
||||
}
|
||||
|
||||
return m_fdc->drq_r();
|
||||
@ -109,7 +107,8 @@ void p1_fdc_device::p1_wd17xx_aux_w(int data)
|
||||
floppy_image_device *floppy1 = m_fdc->subdevice<floppy_connector>("1")->get_device();
|
||||
floppy_image_device *floppy = ((data & 2) ? floppy1 : floppy0);
|
||||
|
||||
if (!BIT(data, 6)) m_fdc->reset();
|
||||
if (!BIT(data, 6))
|
||||
m_fdc->reset();
|
||||
|
||||
m_fdc->set_floppy(floppy);
|
||||
|
||||
@ -122,9 +121,8 @@ void p1_fdc_device::p1_wd17xx_aux_w(int data)
|
||||
|
||||
WRITE_LINE_MEMBER(p1_fdc_device::p1_fdc_irq_drq)
|
||||
{
|
||||
cpu_device *maincpu = machine().device<cpu_device>("maincpu");
|
||||
|
||||
if (state) maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
|
||||
if (state)
|
||||
m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
|
||||
}
|
||||
|
||||
READ8_MEMBER(p1_fdc_device::p1_fdc_r)
|
||||
@ -162,6 +160,7 @@ p1_fdc_device::p1_fdc_device(const machine_config &mconfig, const char *tag, dev
|
||||
: device_t(mconfig, P1_FDC, tag, owner, clock)
|
||||
, device_isa8_card_interface(mconfig, *this)
|
||||
, m_fdc(*this, "fdc")
|
||||
, m_maincpu(*this, ":maincpu")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@ private:
|
||||
DECLARE_WRITE_LINE_MEMBER(p1_fdc_irq_drq);
|
||||
|
||||
required_device<fd1793_device> m_fdc;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
|
||||
public:
|
||||
void p1_wd17xx_aux_w(int data);
|
||||
|
@ -64,8 +64,8 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "cirrus.h"
|
||||
#include "video/pc_vga.h"
|
||||
#include "cirrus.h"
|
||||
|
||||
#define LOG_PCIACCESS 0
|
||||
|
||||
@ -85,7 +85,8 @@ DEFINE_DEVICE_TYPE(PCI_CIRRUS_SVGA, pci_cirrus_svga_device, "pci_cirrus_svga", "
|
||||
|
||||
pci_cirrus_svga_device::pci_cirrus_svga_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, PCI_CIRRUS_SVGA, tag, owner, clock)
|
||||
, pci_device_interface( mconfig, *this )
|
||||
, pci_device_interface(mconfig, *this)
|
||||
, m_vga(*this, "vga")
|
||||
{
|
||||
}
|
||||
|
||||
@ -160,5 +161,5 @@ void pci_cirrus_svga_device::pci_write(pci_bus_device *pcibus, int function, int
|
||||
WRITE8_MEMBER( pci_cirrus_svga_device::cirrus_42E8_w )
|
||||
{
|
||||
if (data & 0x80)
|
||||
machine().device("vga")->reset();
|
||||
m_vga->reset();
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
required_device<vga_device> m_vga;
|
||||
};
|
||||
|
||||
|
||||
|
@ -38,6 +38,7 @@ i82371sb_device::i82371sb_device(const machine_config &mconfig, const char *tag,
|
||||
, m_apmc(0)
|
||||
, m_apms(0)
|
||||
, m_base(0)
|
||||
, m_maincpu(*this, ":maincpu")
|
||||
{
|
||||
}
|
||||
|
||||
@ -249,7 +250,7 @@ void i82371sb_device::remap(int space_id, offs_t start, offs_t end)
|
||||
|
||||
void i82371sb_device::device_start()
|
||||
{
|
||||
address_space& spaceio = machine().device(":maincpu")->memory().space(AS_IO);
|
||||
address_space& spaceio = ((device_memory_interface *)m_maincpu.target())->memory().space(AS_IO);
|
||||
|
||||
southbridge_device::device_start();
|
||||
m_ide_io_ports_enabled = false;
|
||||
|
@ -61,6 +61,7 @@ private:
|
||||
int m_apmc;
|
||||
int m_apms;
|
||||
uint32_t m_base;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
|
@ -24,7 +24,8 @@ i82439tx_device::i82439tx_device(const machine_config &mconfig, const char *tag,
|
||||
m_cpu_tag(nullptr),
|
||||
m_region_tag(nullptr),
|
||||
m_space(nullptr),
|
||||
m_rom(nullptr)
|
||||
m_rom(nullptr),
|
||||
m_cpu(*this, finder_base::DUMMY_TAG)
|
||||
{
|
||||
m_smram.smiact_n = 1;
|
||||
}
|
||||
@ -442,10 +443,7 @@ void i82439tx_device::device_start()
|
||||
{
|
||||
northbridge_device::device_start();
|
||||
// get address space we are working on
|
||||
device_t *cpu = machine().device(m_cpu_tag);
|
||||
assert(cpu != nullptr);
|
||||
|
||||
m_space = &cpu->memory().space(AS_PROGRAM);
|
||||
m_space = &((device_memory_interface *)m_cpu.target())->memory().space(AS_PROGRAM);
|
||||
|
||||
// get rom region
|
||||
m_rom = machine().root_device().memregion(m_region_tag)->base();
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
// construction/destruction
|
||||
i82439tx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
void set_cpu(const char *tag) { m_cpu_tag = tag; }
|
||||
void set_cpu(const char* tag) { m_cpu_tag = tag; m_cpu.set_tag(m_cpu_tag); }
|
||||
void set_region(const char *tag) { m_region_tag = tag; }
|
||||
|
||||
virtual uint32_t pci_read(pci_bus_device *pcibus, int function, int offset, uint32_t mem_mask) override;
|
||||
@ -47,6 +47,8 @@ private:
|
||||
address_space *m_space;
|
||||
uint8_t *m_rom;
|
||||
|
||||
required_device<cpu_device> m_cpu;
|
||||
|
||||
uint32_t m_regs[8*256];
|
||||
uint32_t m_bios_ram[0x40000 / 4];
|
||||
|
||||
|
@ -9,8 +9,8 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "mpc105.h"
|
||||
#include "machine/ram.h"
|
||||
#include "mpc105.h"
|
||||
|
||||
#define LOG_MPC105 0
|
||||
|
||||
@ -35,7 +35,8 @@ mpc105_device::mpc105_device(const machine_config &mconfig, const char *tag, dev
|
||||
m_bank_base_default(0),
|
||||
m_bank_base(0),
|
||||
m_bank_enable(0),
|
||||
m_maincpu(*this, finder_base::DUMMY_TAG)
|
||||
m_maincpu(*this, finder_base::DUMMY_TAG),
|
||||
m_ram(*this, ":" RAM_TAG)
|
||||
{
|
||||
}
|
||||
|
||||
@ -67,6 +68,7 @@ void mpc105_device::update_memory()
|
||||
int bank;
|
||||
offs_t begin, end;
|
||||
char bank_str[10];
|
||||
u32 ram_size = m_ram->size();
|
||||
|
||||
if (LOG_MPC105)
|
||||
logerror("mpc105_update_memory(machine): Updating memory (bank enable=0x%02X)\n", m_bank_enable);
|
||||
@ -91,17 +93,17 @@ void mpc105_device::update_memory()
|
||||
| (((m_bank_registers[(bank / 4) + 6] >> (bank % 4) * 8)) & 0x03) << 28
|
||||
| 0x000FFFFF;
|
||||
|
||||
end = std::min(end, begin + machine().device<ram_device>(RAM_TAG)->size() - 1);
|
||||
end = std::min(end, begin + ram_size - 1);
|
||||
|
||||
if ((begin + 0x100000) <= end)
|
||||
{
|
||||
if (LOG_MPC105)
|
||||
logerror("\tbank #%d [%02d]: 0x%08X - 0x%08X [%p-%p]\n", bank, bank + m_bank_base, begin, end, machine().device<ram_device>(RAM_TAG)->pointer(), machine().device<ram_device>(RAM_TAG)->pointer() + (end - begin));
|
||||
logerror("\tbank #%d [%02d]: 0x%08X - 0x%08X [%p-%p]\n", bank, bank + m_bank_base, begin, end, m_ram->pointer(), m_ram->pointer() + (end - begin));
|
||||
|
||||
if (m_bank_base > 0)
|
||||
{
|
||||
sprintf(bank_str,"bank%d",uint8_t(bank + m_bank_base));
|
||||
membank(bank_str)->set_base(machine().device<ram_device>(RAM_TAG)->pointer());
|
||||
membank(bank_str)->set_base(m_ram->pointer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ private:
|
||||
uint32_t m_bank_registers[8];
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<ram_device> m_ram;
|
||||
};
|
||||
|
||||
|
||||
|
@ -26,7 +26,7 @@ northbridge_device::northbridge_device(const machine_config &mconfig, device_typ
|
||||
|
||||
void northbridge_device::device_start()
|
||||
{
|
||||
address_space& space = machine().device(":maincpu")->memory().space(AS_PROGRAM);
|
||||
address_space& space = ((device_memory_interface *)m_maincpu.target())->memory().space(AS_PROGRAM);
|
||||
|
||||
machine().root_device().membank("bank10")->set_base(m_ram->pointer());
|
||||
|
||||
|
@ -91,7 +91,8 @@ DEFINE_DEVICE_TYPE(PCI_BUS, pci_bus_device, "pci_bus", "PCI Bus")
|
||||
//-------------------------------------------------
|
||||
pci_bus_device::pci_bus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, PCI_BUS, tag, owner, clock), m_busnum(0),
|
||||
m_father(nullptr), m_address(0), m_devicenum(0), m_busnumber(0), m_busnumaddr(nullptr)
|
||||
m_father(nullptr), m_address(0), m_devicenum(0), m_busnumber(0), m_busnumaddr(nullptr),
|
||||
m_pcifather(*this, finder_base::DUMMY_TAG)
|
||||
{
|
||||
for (auto & elem : m_devtag) {
|
||||
elem= nullptr;
|
||||
@ -284,11 +285,8 @@ void pci_bus_device::device_start()
|
||||
m_device[i] = nullptr;
|
||||
}
|
||||
|
||||
if (m_father != nullptr) {
|
||||
pci_bus_device *father = machine().device<pci_bus_device>(m_father);
|
||||
if (father)
|
||||
father->add_sibling(this, m_busnum);
|
||||
}
|
||||
if (m_pcifather.found())
|
||||
m_pcifather->add_sibling(this, m_busnum);
|
||||
|
||||
/* register pci states */
|
||||
save_item(NAME(m_address));
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
DECLARE_WRITE64_MEMBER( write_64be );
|
||||
|
||||
void set_busnum(int busnum) { m_busnum = busnum; }
|
||||
void set_father(const char *father) { m_father = father; }
|
||||
void set_father(const char* father) { m_father = father; m_pcifather.set_tag(m_father); }
|
||||
void set_device(int num, const char *tag) {
|
||||
m_devtag[num] = tag; }
|
||||
|
||||
@ -109,6 +109,8 @@ private:
|
||||
int8_t m_devicenum; // device number we are addressing
|
||||
int8_t m_busnumber; // pci bus number we are addressing
|
||||
pci_bus_device * m_busnumaddr; // pci bus we are addressing
|
||||
|
||||
optional_device<pci_bus_device> m_pcifather;
|
||||
};
|
||||
|
||||
// device type definition
|
||||
|
@ -48,7 +48,7 @@ WRITE8_MEMBER(at586_state::boot_state_w)
|
||||
|
||||
void at586_state::tx_config(device_t *device)
|
||||
{
|
||||
downcast<i82439tx_device *>(device)->set_cpu("maincpu");
|
||||
downcast<i82439tx_device *>(device)->set_cpu(":maincpu");
|
||||
downcast<i82439tx_device *>(device)->set_region("isa");
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ bool xbox_base_state::find_bios_hash(int bios, uint32_t &crc32)
|
||||
{
|
||||
if (ROMENTRY_ISFILE(re))
|
||||
{
|
||||
if (ROM_GETBIOSFLAGS(re) == (bios + 1))
|
||||
if (ROM_GETBIOSFLAGS(re) == (uint32_t)(bios + 1))
|
||||
{
|
||||
const std::string &h = re.hashdata();
|
||||
util::hash_collection hc(h.c_str());
|
||||
|
Loading…
Reference in New Issue
Block a user