summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/nes/datach.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/nes/datach.h')
-rw-r--r--src/devices/bus/nes/datach.h31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/devices/bus/nes/datach.h b/src/devices/bus/nes/datach.h
index 404b86732da..17a3ece97e8 100644
--- a/src/devices/bus/nes/datach.h
+++ b/src/devices/bus/nes/datach.h
@@ -1,7 +1,9 @@
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli
-#ifndef __NES_DATACH_H
-#define __NES_DATACH_H
+#ifndef MAME_BUS_NES_DATACH_H
+#define MAME_BUS_NES_DATACH_H
+
+#pragma once
#include "bandai.h"
#include "softlist_dev.h"
@@ -20,7 +22,6 @@ class datach_cart_interface : public device_slot_card_interface
{
public:
// construction/destruction
- datach_cart_interface(const machine_config &mconfig, device_t &device);
virtual ~datach_cart_interface();
// reading and writing
@@ -29,9 +30,11 @@ public:
uint8_t *get_cart_base() { return m_rom; }
void write_prg_bank(uint8_t bank) { m_bank = bank; }
+protected:
+ datach_cart_interface(const machine_config &mconfig, device_t &device);
+
optional_device<i2cmem_device> m_i2cmem;
-protected:
// internal state
uint8_t *m_rom;
// ROM is accessed via two 16K banks, but only the first one can be switched
@@ -40,10 +43,13 @@ protected:
// ======================> nes_datach_slot_device
+class nes_datach_device;
+
class nes_datach_slot_device : public device_t,
public device_image_interface,
public device_slot_interface
{
+ friend class nes_datach_device;
public:
// construction/destruction
nes_datach_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@@ -71,11 +77,12 @@ public:
virtual DECLARE_READ8_MEMBER(read);
void write_prg_bank(uint8_t bank) { if (m_cart) m_cart->write_prg_bank(bank); }
+protected:
datach_cart_interface* m_cart;
};
// device type definition
-extern const device_type NES_DATACH_SLOT;
+DECLARE_DEVICE_TYPE(NES_DATACH_SLOT, nes_datach_slot_device)
#define MCFG_DATACH_MINICART_ADD(_tag, _slot_intf) \
@@ -91,12 +98,10 @@ extern const device_type NES_DATACH_SLOT;
// ======================> nes_datach_rom_device
-class nes_datach_rom_device : public device_t,
- public datach_cart_interface
+class nes_datach_rom_device : public device_t, public datach_cart_interface
{
public:
// construction/destruction
- nes_datach_rom_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, uint32_t clock, const char *shortname, const char *source);
nes_datach_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// optional information overrides
@@ -104,6 +109,8 @@ public:
virtual uint8_t* get_cart_base();
protected:
+ nes_datach_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
@@ -122,8 +129,8 @@ public:
};
// device type definition
-extern const device_type NES_DATACH_ROM;
-extern const device_type NES_DATACH_24C01;
+DECLARE_DEVICE_TYPE(NES_DATACH_ROM, nes_datach_rom_device)
+DECLARE_DEVICE_TYPE(NES_DATACH_24C01, nes_datach_24c01_device)
//---------------------------------
@@ -164,6 +171,6 @@ protected:
// device type definition
-extern const device_type NES_DATACH;
+DECLARE_DEVICE_TYPE(NES_DATACH, nes_datach_device)
-#endif
+#endif // MAME_BUS_NES_DATACH_H