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
86
87
88
89
90
91
|
// license:BSD-3-Clause
// copyright-holders:Curt Coder
/**********************************************************************
GLA 24K RAM cartridge emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************/
#include "24k.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type CBM2_24K = &device_creator<cbm2_24k_cartridge_device>;
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// cbm2_24k_cartridge_device - constructor
//-------------------------------------------------
cbm2_24k_cartridge_device::cbm2_24k_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, CBM2_24K, "24K RAM/ROM cartridge", tag, owner, clock, "cbm2_24k", __FILE__),
device_cbm2_expansion_card_interface(mconfig, *this),
m_ram(*this, "ram")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void cbm2_24k_cartridge_device::device_start()
{
m_ram.allocate(0x6000);
}
//-------------------------------------------------
// cbm2_bd_r - cartridge data read
//-------------------------------------------------
UINT8 cbm2_24k_cartridge_device::cbm2_bd_r(address_space &space, offs_t offset, UINT8 data, int csbank1, int csbank2, int csbank3)
{
if (!csbank1)
{
data = m_ram[offset];
}
else if (!csbank2)
{
data = m_ram[0x2000 | offset];
}
else if (!csbank3)
{
data = m_ram[0x4000 | offset];
}
return data;
}
//-------------------------------------------------
// cbm2_bd_w - cartridge data write
//-------------------------------------------------
void cbm2_24k_cartridge_device::cbm2_bd_w(address_space &space, offs_t offset, UINT8 data, int csbank1, int csbank2, int csbank3)
{
if (!csbank1)
{
m_ram[offset] = data;
}
else if (!csbank2)
{
m_ram[0x2000 | offset] = data;
}
else if (!csbank3)
{
m_ram[0x4000 | offset] = data;
}
}
|