1 // license:BSD-3-Clause
2 // copyright-holders:S. Smith,David Haywood,Fabio Priuli
3 #ifndef MAME_BUS_NEOGEO_ROM_H
4 #define MAME_BUS_NEOGEO_ROM_H
5 
6 #pragma once
7 
8 #include "slot.h"
9 #include "machine/nvram.h"
10 
11 // ======================> neogeo_rom_device
12 
13 class neogeo_rom_device : public device_t, public device_neogeo_cart_interface
14 {
15 public:
16 	// construction/destruction
17 	neogeo_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint16_t clock);
18 
19 	// reading and writing
20 	virtual uint16_t rom_r(offs_t offset) override;
21 	virtual void banksel_w(uint16_t data) override;
22 
23 protected:
24 	neogeo_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint16_t clock);
25 
26 	// device-level overrides
27 	virtual void device_start() override;
28 	virtual void device_reset() override;
29 };
30 
31 
32 
33 // device type definition
DECLARE_DEVICE_TYPE(NEOGEO_ROM,neogeo_rom_device)34 DECLARE_DEVICE_TYPE(NEOGEO_ROM, neogeo_rom_device)
35 
36 
37 
38 /*************************************************
39  vliner
40  **************************************************/
41 
42 class neogeo_vliner_cart_device : public neogeo_rom_device
43 {
44 public:
45 	neogeo_vliner_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
46 
47 	virtual uint16_t ram_r(offs_t offset) override { return m_cart_ram[offset]; }
48 	virtual void ram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0) override { COMBINE_DATA(&m_cart_ram[offset]); }
49 
50 	virtual int get_fixed_bank_type() override { return 0; }
51 
52 protected:
53 	virtual void device_start() override;
54 
55 	virtual void device_add_mconfig(machine_config &config) override;
56 
57 private:
58 	std::unique_ptr<uint16_t[]> m_cart_ram;
59 
60 	required_device<nvram_device> m_nvram;
61 };
62 
63 DECLARE_DEVICE_TYPE(NEOGEO_VLINER_CART, neogeo_vliner_cart_device)
64 
65 
66 #endif // MAME_BUS_NEOGEO_ROM_H
67