summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/apf/rom.cpp
blob: c4f89d584dd44a36a6b6749ce72ee0fa95d4cc16 (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
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli
/***********************************************************************************************************


 APF Imagination / M-1000 cart emulation


 ***********************************************************************************************************/


#include "emu.h"
#include "rom.h"


//-------------------------------------------------
//  apf_rom_device - constructor
//-------------------------------------------------

const device_type APF_ROM_STD = &device_creator<apf_rom_device>;
const device_type APF_ROM_BASIC = &device_creator<apf_basic_device>;
const device_type APF_ROM_SPACEDST = &device_creator<apf_spacedst_device>;


apf_rom_device::apf_rom_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)
					: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
						device_apf_cart_interface( mconfig, *this )
{
}

apf_rom_device::apf_rom_device(const machine_config &mconfig, std::string tag, device_t *owner, UINT32 clock)
					: device_t(mconfig, APF_ROM_STD, "APF Standard Carts", tag, owner, clock, "apf_rom", __FILE__),
						device_apf_cart_interface( mconfig, *this )
{
}

apf_basic_device::apf_basic_device(const machine_config &mconfig, std::string tag, device_t *owner, UINT32 clock)
					: apf_rom_device(mconfig, APF_ROM_BASIC, "APF BASIC Carts", tag, owner, clock, "apf_basic", __FILE__)
{
}

apf_spacedst_device::apf_spacedst_device(const machine_config &mconfig, std::string tag, device_t *owner, UINT32 clock)
					: apf_rom_device(mconfig, APF_ROM_SPACEDST, "APF Space Destroyer Cart", tag, owner, clock, "apf_spacedst", __FILE__)
{
}


/*-------------------------------------------------
 mapper specific handlers
 -------------------------------------------------*/

READ8_MEMBER(apf_rom_device::read_rom)
{
	if (offset < m_rom_size)
		return m_rom[offset];
	else
		return 0xff;
}


READ8_MEMBER(apf_basic_device::extra_rom)
{
	if (offset < (m_rom_size - 0x2000))
		return m_rom[offset + 0x2000];
	else
		return 0xff;
}


READ8_MEMBER(apf_spacedst_device::read_ram)
{
	return m_ram[offset];
}

WRITE8_MEMBER(apf_spacedst_device::write_ram)
{
	m_ram[offset] = data;
}