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
|
/**********************************************************************
Commodore VIC-1110 8K RAM Expansion Cartridge emulation
Copyright MESS Team.
Visit http://mamedev.org for licensing and usage restrictions.
**********************************************************************/
#include "vic1110.h"
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
enum
{
BLK1 = 0x07,
BLK2 = 0x0b,
BLK3 = 0x0d,
BLK5 = 0x0e
};
//**************************************************************************
// DEVICE DEFINITIONS
//**************************************************************************
const device_type VIC1110 = &device_creator<vic1110_device>;
//-------------------------------------------------
// INPUT_PORTS( vic1110 )
//-------------------------------------------------
INPUT_PORTS_START( vic1110 )
PORT_START("SW")
PORT_DIPNAME( 0x0f, BLK1, "Memory Location" ) PORT_DIPLOCATION("SW:1,2,3,4")
PORT_DIPSETTING( BLK1, "$2000-$3FFF" )
PORT_DIPSETTING( BLK2, "$4000-$5FFF" )
PORT_DIPSETTING( BLK3, "$6000-$7FFF" )
PORT_DIPSETTING( BLK5, "$A000-B3FFF" )
INPUT_PORTS_END
//-------------------------------------------------
// input_ports - device-specific input ports
//-------------------------------------------------
ioport_constructor vic1110_device::device_input_ports() const
{
return INPUT_PORTS_NAME( vic1110 );
}
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// vic1110_device - constructor
//-------------------------------------------------
vic1110_device::vic1110_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, VIC1110, "VIC1110", tag, owner, clock, "vic1110", __FILE__),
device_vic20_expansion_card_interface(mconfig, *this),
m_sw(*this, "SW")
{
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void vic1110_device::device_start()
{
// allocate memory
vic20_ram_pointer(machine(), 0x2000);
}
//-------------------------------------------------
// vic20_cd_r - cartridge data read
//-------------------------------------------------
UINT8 vic1110_device::vic20_cd_r(address_space &space, offs_t offset, UINT8 data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
UINT8 sw = m_sw->read();
if ((!blk1 && (sw == BLK1)) || (!blk2 && (sw == BLK2)) || (!blk3 && (sw == BLK3)) || (!blk5 && (sw == BLK5)))
{
data = m_ram[offset & 0x1fff];
}
return data;
}
//-------------------------------------------------
// vic20_cd_w - cartridge data write
//-------------------------------------------------
void vic1110_device::vic20_cd_w(address_space &space, offs_t offset, UINT8 data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
{
UINT8 sw = m_sw->read();
if ((!blk1 && (sw == BLK1)) || (!blk2 && (sw == BLK2)) || (!blk3 && (sw == BLK3)) || (!blk5 && (sw == BLK5)))
{
m_ram[offset & 0x1fff] = data;
}
}
|