summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/intellec4/prommemory.cpp
blob: 7af8a5757f2e8074ee7bf6786fb67cf47f3aeba5 (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
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
// license:BSD-3-Clause
// copyright-holders:Vas Crabb
/*
imm6-26 PROM Memory Module

This card has sockets for sixteen 1702A or similar 256×8 PROMs providing
up to 4KiB of program storage.  This card has additional features for
INTELLEC 8 systems, including module select lines and DIP switches for
mapping PROMs in place of console RAM.  These features are not emulated
by this class.

In theory you could populate any combination of sockets, and use
multiple cards provided you don't populate corresponding sockets on two
cards.  To simplify things, we assume contiguous sockets are populated
starting with PROM 0 (A2).  In practice, you'd want to populate this
socket as the boot vector is at address zero.  If you want to simulate
unpopulated sockets, just zero the corresponding area in your image
file.


Universal edge connector

                         1    2
                  GND    3    4  GND
                         5    6
                         7    8
                         9   10
                MAD 0   11   12  MAD 1
                MAD 2   13   14  MAD 3
                MAD 4   15   16  MAD 5
                MAD 6   17   18  MAD 7
                MAD 8   19   20  MAD 9
                        21   22
                MDI 0   23   24
                MDI 1   25   26
                MDI 3   27   28
                MDI 2   29   30
                MDI 5   31   32
                MDI 4   33   34
                MDI 7   35   36
                MDI 6   37   38
                        39   40
                        41   42
                 -10V   43   44  -10V
                        45   46
                        47   48
                        49   50
                        51   52
                        53   54
                        55   56
              /MAD 12   57   58  MS 12
               MAD 13   59   60  MAD 12
                MS 13   61   62  /MAD 13
              /MAD 14   63   64  MS 14
               MAD 15   65   66  MAD 14
                MS 15   67   68  /MAD 15
                        69   70
                        71   72
                        73   74
                        75   76
                        77   78
                        79   80
                        81   82  /ASMB
                        83   84
                        85   86
                        87   88
                        89   90
              /ADR STB  91   92
          RAM MOD ENBL  93   94  MAD 11
                        95   96  MAD 10
       /PROM MOD ENBL   97   98
                  +5V   99  100  +5V

MAD 0...MAD 7       mapped to MA0...MA7 on INTELLEC 4
MAD 8...MAD 11      mapped to C0...C3 on INTELLEC 4
MAD 12...MAD 15     not used on INTELLEC 4, used for module selection on INTELLEC 8
/MAD 12.../MAD 15   not used on INTELLEC 4, used for module selection on INTELLEC 8
MS 12...MS 15       not used on INTELLEC 4, used for module selection on INTELLEC 8
MDI 0...7           data outputs
/ASMB               global enable mapped to /PROM SEL on INTELLEC 4, not jumpered in on INTELLEC 8
/ADR STB            not jumpered in on INTELLEC 4 and INTELLEC 8, latch enables jumpered to GND
RAM MOD ENBL        not jumpered in on INTELLEC 4, allows PROM to overlay RAM on INTELLEC 8
/PROM MOD ENBL      not jumpered in on INTELLEC 4, used as global enable on INTELLEC 8
*/

#include "emu.h"
#include "prommemory.h"


namespace {

class imm6_26_device
		: public device_t
		, public bus::intellec4::device_univ_card_interface
		, public device_image_interface
{
public:
	imm6_26_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);

	virtual image_init_result call_load() override;
	virtual void call_unload() override;

	virtual bool        is_readable()                   const noexcept override { return true; }
	virtual bool        is_writeable()                  const noexcept override { return false; }
	virtual bool        is_creatable()                  const noexcept override { return false; }
	virtual bool        is_reset_on_load()              const noexcept override { return false; }
	virtual char const *file_extensions()               const noexcept override { return "rom,bin"; }
	virtual char const *image_type_name()               const noexcept override { return "promimage"; }
	virtual char const *image_brief_type_name()         const noexcept override { return "prom"; }

protected:
	virtual void device_start() override;

private:
	void allocate();
	void unmap();

	std::unique_ptr<u8 []>  m_data;
};


imm6_26_device::imm6_26_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock)
	: device_t(mconfig, INTELLEC4_PROM_MEMORY, tag, owner, clock)
	, bus::intellec4::device_univ_card_interface(mconfig, *this)
	, device_image_interface(mconfig, *this)
	, m_data()
{
}


image_init_result imm6_26_device::call_load()
{
	if ((length() > 4096U) || (length() % 256U))
		return image_init_result::FAIL;

	unmap();
	allocate();
	if (fread(m_data.get(), length()) != length())
		return image_init_result::FAIL;

	// FIXME: gimme a cookie!
	rom_space().install_rom(0x1000U, offs_t(0x1000U + length()), m_data.get());

	return image_init_result::PASS;
}

void imm6_26_device::call_unload()
{
	unmap();
}


void imm6_26_device::device_start()
{
	allocate();

	save_pointer(NAME(m_data), 4096U);
}


void imm6_26_device::allocate()
{
	if (!m_data)
	{
		m_data = std::make_unique<u8 []>(4096U);
		std::fill(m_data.get(), m_data.get() + 4096U, 0U);
	}
}

void imm6_26_device::unmap()
{
	// FIXME: where's my magic cookie?
	rom_space().unmap_read(0x1000U, 0x1fffU);
}

} // anonymous namespace


DEFINE_DEVICE_TYPE_PRIVATE(INTELLEC4_PROM_MEMORY, bus::intellec4::device_univ_card_interface, imm6_26_device, "intlc4_imm6_26", "Intel imm6-26 PROM Memory Module")