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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
// license:BSD-3-Clause
// copyright-holders:Nigel Barnes
/**********************************************************************
Ramamp Computers Sideways RAM/ROM Board
http://chrisacorns.computinghistory.org.uk/8bit_Upgrades/RAMAMP_SidewaysRAMROM.html
**********************************************************************/
#include "emu.h"
#include "ramamp.h"
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
DEFINE_DEVICE_TYPE(BBC_RAMAMP, bbc_ramamp_device, "bbc_ramamp", "Ramamp Sideways RAM/ROM Board");
//-------------------------------------------------
// INPUT_PORTS( ramamp )
//-------------------------------------------------
static INPUT_PORTS_START(ramamp)
PORT_START("wp")
PORT_CONFNAME(0x01, 0x00, "Write Protect Sideways RAM")
PORT_CONFSETTING(0x00, DEF_STR(No))
PORT_CONFSETTING(0x01, DEF_STR(Yes))
INPUT_PORTS_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor bbc_ramamp_device::device_input_ports() const
{
return INPUT_PORTS_NAME(ramamp);
}
//-------------------------------------------------
// device_add_mconfig - add device configuration
//-------------------------------------------------
void bbc_ramamp_device::device_add_mconfig(machine_config &config)
{
/* 6 rom sockets, 32K dynamic ram */
BBC_ROMSLOT16(config, m_rom[8], bbc_rom_devices, nullptr);
BBC_ROMSLOT16(config, m_rom[9], bbc_rom_devices, nullptr);
BBC_ROMSLOT16(config, m_rom[10], bbc_rom_devices, "ram").set_fixed_ram(true);
BBC_ROMSLOT16(config, m_rom[11], bbc_rom_devices, nullptr);
BBC_ROMSLOT16(config, m_rom[12], bbc_rom_devices, nullptr);
BBC_ROMSLOT16(config, m_rom[13], bbc_rom_devices, "ram").set_fixed_ram(true);
BBC_ROMSLOT16(config, m_rom[14], bbc_rom_devices, nullptr);
BBC_ROMSLOT16(config, m_rom[15], bbc_rom_devices, nullptr);
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// bbc_ramamp_device - constructor
//-------------------------------------------------
bbc_ramamp_device::bbc_ramamp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, BBC_RAMAMP, tag, owner, clock)
, device_bbc_internal_interface(mconfig, *this)
, m_rom(*this, "romslot%u", 0U)
, m_wp(*this, "wp")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void bbc_ramamp_device::device_start()
{
/* move internal roms to board */
memmove(m_region_swr->base() + 0x2c000, m_region_swr->base(), 0x8000);
memmove(m_region_swr->base() + 0x38000, m_region_swr->base() + 0x8000, 0x8000);
memset(m_region_swr->base(), 0xff, 0x10000);
/* register for save states */
save_item(NAME(m_romsel));
}
//**************************************************************************
// IMPLEMENTATION
//**************************************************************************
uint8_t bbc_ramamp_device::paged_r(offs_t offset)
{
uint8_t data = 0xff;
switch (m_romsel)
{
case 0: case 1: case 2: case 3:
/* motherboard rom sockets */
if (m_mb_rom[m_romsel] && m_mb_rom[m_romsel]->present())
{
data = m_mb_rom[m_romsel]->read(offset);
}
else
{
data = m_region_swr->base()[offset + (m_romsel << 14)];
}
break;
default:
/* expansion board sockets */
if (m_rom[m_romsel] && m_rom[m_romsel]->present())
{
data = m_rom[m_romsel]->read(offset);
}
else
{
data = m_region_swr->base()[offset + (m_romsel << 14)];
}
break;
}
return data;
}
void bbc_ramamp_device::paged_w(offs_t offset, uint8_t data)
{
switch (m_romsel)
{
case 0: case 1: case 2: case 3:
/* motherboard rom sockets */
if (m_mb_rom[m_romsel])
{
m_mb_rom[m_romsel]->write(offset, data);
}
break;
case 10: case 13:
/* expansion board sockets */
if (m_rom[m_romsel] && !m_wp->read())
{
m_rom[m_romsel]->write(offset, data);
}
break;
default:
/* expansion board sockets */
if (m_rom[m_romsel])
{
m_rom[m_romsel]->write(offset, data);
}
break;
}
}
|