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
|
// license:BSD-3-Clause
// copyright-holders:tim lindner
/***************************************************************************
pak.cpp
Code for emulating standard MC-10 cartridges with only ROM
***************************************************************************/
#include "emu.h"
#include "pak.h"
namespace {
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> mc10_pak_device
class mc10_pak_device :
public device_t,
public device_mc10cart_interface
{
public:
// construction/destruction
mc10_pak_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
virtual int max_rom_length() const override;
virtual std::pair<std::error_condition, std::string> load() override;
protected:
mc10_pak_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
// device_t implementation
virtual void device_start() override ATTR_COLD;
};
//**************************************************************************
// LIVE DEVICE
//**************************************************************************
//-------------------------------------------------
// mc10_pak_device - constructor
//-------------------------------------------------
mc10_pak_device::mc10_pak_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, type, tag, owner, clock)
, device_mc10cart_interface(mconfig, *this)
{
}
mc10_pak_device::mc10_pak_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: mc10_pak_device(mconfig, MC10_PAK, tag, owner, clock)
{
}
//-------------------------------------------------
// rom constraints
//-------------------------------------------------
int mc10_pak_device::max_rom_length() const
{
return 1024 * 16;
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void mc10_pak_device::device_start()
{
}
//-------------------------------------------------
// load - install ROM region
//-------------------------------------------------
std::pair<std::error_condition, std::string> mc10_pak_device::load()
{
memory_region *const romregion(memregion("^rom"));
assert(romregion != nullptr);
// if the host has supplied a ROM space, install it
owning_slot().memspace().install_rom(0x5000, 0x5000 + romregion->bytes(), romregion->base());
return std::make_pair(std::error_condition(), std::string());
}
} // anonymous namespace
DEFINE_DEVICE_TYPE_PRIVATE(MC10_PAK, device_mc10cart_interface, mc10_pak_device, "mc10pak", "MC-10 Program PAK")
|