summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/z88/ram.h
blob: b02630b67dc63f6247b9eecb40686dd432f91f89 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// license:BSD-3-Clause
// copyright-holders:Sandro Ronco
#pragma once

#ifndef __Z88_RAM_H__
#define __Z88_RAM_H__

#include "emu.h"
#include "z88.h"

//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************

// ======================> z88_32k_ram_device

class z88_32k_ram_device : public device_t,
							public device_z88cart_interface
{
public:
	// construction/destruction
	z88_32k_ram_device(const machine_config &mconfig, std::string tag, device_t *owner, UINT32 clock);
	z88_32k_ram_device(const machine_config &mconfig, device_type type, const char *name, std::string tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);

protected:
	// device-level overrides
	virtual void device_start() override;

	// z88cart_interface overrides
	virtual DECLARE_READ8_MEMBER(read) override;
	virtual DECLARE_WRITE8_MEMBER(write) override;
	virtual UINT8* get_cart_base() override;
	virtual UINT32 get_cart_size() override { return 0x8000; }

protected:
	// internal state
	UINT8 *     m_ram;
};

// ======================> z88_128k_ram_device

class z88_128k_ram_device : public z88_32k_ram_device
{
public:
	// construction/destruction
	z88_128k_ram_device(const machine_config &mconfig, std::string tag, device_t *owner, UINT32 clock);

protected:
	// z88cart_interface overrides
	virtual UINT32 get_cart_size() override { return 0x20000; }
};

// ======================> z88_512k_ram_device

class z88_512k_ram_device : public z88_32k_ram_device
{
public:
	// construction/destruction
	z88_512k_ram_device(const machine_config &mconfig, std::string tag, device_t *owner, UINT32 clock);

protected:
	// z88cart_interface overrides
	virtual UINT32 get_cart_size() override { return 0x80000; }
};

// ======================> z88_1024k_ram_device

class z88_1024k_ram_device : public z88_32k_ram_device
{
public:
	// construction/destruction
	z88_1024k_ram_device(const machine_config &mconfig, std::string tag, device_t *owner, UINT32 clock);

protected:
	// z88cart_interface overrides
	virtual UINT32 get_cart_size() override { return 0x100000; }
};

// device type definition
extern const device_type Z88_32K_RAM;
extern const device_type Z88_128K_RAM;
extern const device_type Z88_512K_RAM;
extern const device_type Z88_1024K_RAM;

#endif  /* __Z88_RAM_H__ */