Previous 15994 Revisions Next

r14858 Thursday 5th April, 2012 at 16:30:33 UTC by Curt Coder
Lots of CBM cartridge work. (nw)
[hash]c128_cart.xml vic1001_cart.xml
[src/mess]mess.mak
[src/mess/drivers]vic20.c
[src/mess/includes]vic20.h
[src/mess/machine]c128_comal80.c* c128_comal80.h* c64exp.c cbmipt.c cbmipt.h vic1010.c vic1010.h vic1110.c vic1110.h vic1111.c vic1111.h vic1112.c vic1112.h vic1210.c vic1210.h vic20_megacart.c* vic20_megacart.h* vic20exp.c vic20exp.h

hash/c128_cart.xml
r14857r14858
1818      </part>
1919   </software>
2020
21   <software name="c128diaga" supported="no">
22      <description>C128 Diagnostic</description>
23      <year>198?</year>
24      <publisher>Commodore</publisher>
25      <sharedfeat name="compatibility" value="NTSC,PAL"/>
26     
27      <part name="cart" interface="c64_cart">
28         <feature name="slot" value="c128diag" />
29         <feature name="game" value="1" />
30         <feature name="exrom" value="1" />
31
32         <dataarea name="roml" size="0x4000">
33            <rom name="325099-01.u1" size="0x4000" crc="285e5bf8" sha1="a110dd331eefe251effdcfa272faf5680db51973" offset="0" />
34         </dataarea>
35      </part>
36   </software>
37
2138   <software name="comal80">
2239      <description>COMAL 80</description>
2340      <year>1985</year>
2441      <publisher>Commodore</publisher>
2542
2643      <part name="cart" interface="c64_cart">
27         <feature name="slot" value="comal80" />
28         <feature name="game" value="0" />
29         <feature name="exrom" value="0" />
44         <feature name="slot" value="c128_comal80" />
45         <feature name="game" value="1" />
46         <feature name="exrom" value="1" />
3047
31         <dataarea name="roml" size="0x10000">
32            <rom name="comal80.u1" size="0x8000" crc="65358f73" sha1="14b032b55d65b4c692ec4f0c0c5da07b28a5822d" offset="0x0000" />
33            <rom name="comal80.u2" size="0x8000" crc="2f9da033" sha1="8dcb465cb7b32af996d43c8a15d70e35e5c7d321" offset="0x8000" />
48         <dataarea name="romh" size="0x18000">
49            <rom name="comal80.u1" size="0x8000" crc="65358f73" sha1="14b032b55d65b4c692ec4f0c0c5da07b28a5822d" offset="0x00000" />
50            <rom name="comal80.u2" size="0x8000" crc="2f9da033" sha1="8dcb465cb7b32af996d43c8a15d70e35e5c7d321" offset="0x08000" />
51            <rom name="comal80.u3" size="0x8000" crc="2f9da033" sha1="8dcb465cb7b32af996d43c8a15d70e35e5c7d321" offset="0x10000" />
3452         </dataarea>
3553      </part>
3654   </software>
hash/vic1001_cart.xml
r14857r14858
19391939            <rom name="megacart.rom" size="0x200000" crc="787551d4" sha1="c4854de023c25dc827af3bebed76d2ff86eaf0ce" offset="0x0000" />
19401940         </dataarea>
19411941         <dataarea name="ram" size="0x8000"/>
1942         <dataarea name="nvram" size="0x2000"/>
19421943      </part>
19431944   </software>
19441945
src/mess/machine/cbmipt.c
r14857r14858
11361136   SLOT_INTERFACE("3k", VIC1210)
11371137   SLOT_INTERFACE("8k", VIC1110)
11381138   SLOT_INTERFACE("16k", VIC1111)
1139
1140   // the following need ROMs from the software list
11391141   SLOT_INTERFACE("ieee488", VIC1112)
1142   SLOT_INTERFACE("megacart", VIC20_MEGACART)
11401143SLOT_INTERFACE_END
11411144
11421145SLOT_INTERFACE_START( vic10_expansion_cards )
r14857r14858
11981201   SLOT_INTERFACE("bn1541", C64_BN1541)
11991202   SLOT_INTERFACE("geocable", C64_GEOCABLE)
12001203SLOT_INTERFACE_END
1204
1205SLOT_INTERFACE_START( c128_expansion_cards )
1206   // the following need ROMs from the software list
1207   SLOT_INTERFACE("c128_comal80", C128_COMAL80)
1208SLOT_INTERFACE_END
src/mess/machine/cbmipt.h
r14857r14858
5151#include "machine/c64_westermann.h"
5252#include "machine/c64_xl80.h"
5353#include "machine/c64_zaxxon.h"
54#include "machine/c128_comal80.h"
5455#include "machine/c1541.h"
5556#include "machine/c1571.h"
5657#include "machine/c1581.h"
r14857r14858
7071#include "machine/vic1210.h"
7172#include "machine/vic10std.h"
7273#include "machine/vic20std.h"
74#include "machine/vic20_megacart.h"
7375
7476
7577#define MCFG_CBM_IEC_ADD(_intf, _default_drive) \
r14857r14858
134136
135137
136138
137extern const slot_interface slot_interface_cbm_iec_devices[];
138extern const slot_interface slot_interface_sx1541_iec_devices[];
139extern const slot_interface slot_interface_cbm_ieee488_devices[];
140extern const slot_interface slot_interface_vic20_expansion_cards[];
141extern const slot_interface slot_interface_vic10_expansion_cards[];
142extern const slot_interface slot_interface_c64_expansion_cards[];
143extern const slot_interface slot_interface_c64_user_port_cards[];
139SLOT_INTERFACE_EXTERN( cbm_iec_devices );
140SLOT_INTERFACE_EXTERN( sx1541_iec_devices );
141SLOT_INTERFACE_EXTERN( cbm_ieee488_devices );
142SLOT_INTERFACE_EXTERN( vic20_expansion_cards );
143SLOT_INTERFACE_EXTERN( vic10_expansion_cards );
144SLOT_INTERFACE_EXTERN( c64_expansion_cards );
145SLOT_INTERFACE_EXTERN( c64_user_port_cards );
146SLOT_INTERFACE_EXTERN( c128_expansion_cards );
144147
145148
146149
src/mess/machine/vic20exp.c
r14857r14858
4444     m_blk2(NULL),
4545     m_blk3(NULL),
4646     m_blk5(NULL),
47     m_ram(NULL)
47     m_ram(NULL),
48     m_nvram(NULL)
4849{
4950   m_slot = dynamic_cast<vic20_expansion_slot_device *>(device.owner());
5051}
r14857r14858
126127
127128
128129//-------------------------------------------------
130//  vic20_nvram_pointer - get NVRAM pointer
131//-------------------------------------------------
132
133UINT8* device_vic20_expansion_card_interface::vic20_nvram_pointer(running_machine &machine, size_t size)
134{
135   if (m_nvram == NULL)
136   {
137      m_nvram = auto_alloc_array(machine, UINT8, size);
138   }
139
140   return m_nvram;
141}
142
143
144//-------------------------------------------------
129145//  ~device_vic20_expansion_card_interface - destructor
130146//-------------------------------------------------
131147
r14857r14858
260276
261277         size = get_software_region_length("ram");
262278         if (size) memcpy(m_cart->vic20_ram_pointer(machine(), size), get_software_region("ram"), size);
279
280         size = get_software_region_length("nvram");
281         if (size) memcpy(m_cart->vic20_nvram_pointer(machine(), size), get_software_region("nvram"), size);
263282      }
264283   }
265284
r14857r14858
290309
291310
292311//-------------------------------------------------
312//  cd_r - cartridge data read
313//-------------------------------------------------
314
315UINT8 vic20_expansion_slot_device::cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
316{
317   UINT8 data = 0;
318
319   if (m_cart != NULL)
320   {
321      data = m_cart->vic20_cd_r(space, offset, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3);
322   }
323
324   return data;
325}
326
327
328//-------------------------------------------------
329//  cd_w - cartridge data write
330//-------------------------------------------------
331
332void vic20_expansion_slot_device::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)
333{
334   if (m_cart != NULL)
335   {
336      m_cart->vic20_cd_w(space, offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3);
337   }
338}
339
340
341//-------------------------------------------------
293342//  screen_update -
294343//-------------------------------------------------
295344
r14857r14858
305354   return value;
306355}
307356
308
309READ8_MEMBER( vic20_expansion_slot_device::ram1_r ) { UINT8 data = 0; if (m_cart != NULL) data = m_cart->vic20_ram1_r(space, offset); return data; }
310WRITE8_MEMBER( vic20_expansion_slot_device::ram1_w ) { if (m_cart != NULL) m_cart->vic20_ram1_w(space, offset, data); }
311READ8_MEMBER( vic20_expansion_slot_device::ram2_r ) { UINT8 data = 0; if (m_cart != NULL) data = m_cart->vic20_ram2_r(space, offset); return data; }
312WRITE8_MEMBER( vic20_expansion_slot_device::ram2_w ) { if (m_cart != NULL) m_cart->vic20_ram2_w(space, offset, data); }
313READ8_MEMBER( vic20_expansion_slot_device::ram3_r ) { UINT8 data = 0; if (m_cart != NULL) data = m_cart->vic20_ram3_r(space, offset); return data; }
314WRITE8_MEMBER( vic20_expansion_slot_device::ram3_w ) { if (m_cart != NULL) m_cart->vic20_ram3_w(space, offset, data); }
315READ8_MEMBER( vic20_expansion_slot_device::blk1_r ) { UINT8 data = 0; if (m_cart != NULL) data = m_cart->vic20_blk1_r(space, offset); return data; }
316WRITE8_MEMBER( vic20_expansion_slot_device::blk1_w ) { if (m_cart != NULL) m_cart->vic20_blk1_w(space, offset, data); }
317READ8_MEMBER( vic20_expansion_slot_device::blk2_r ) { UINT8 data = 0; if (m_cart != NULL) data = m_cart->vic20_blk2_r(space, offset); return data; }
318WRITE8_MEMBER( vic20_expansion_slot_device::blk2_w ) { if (m_cart != NULL) m_cart->vic20_blk2_w(space, offset, data); }
319READ8_MEMBER( vic20_expansion_slot_device::blk3_r ) { UINT8 data = 0; if (m_cart != NULL) data = m_cart->vic20_blk3_r(space, offset); return data; }
320WRITE8_MEMBER( vic20_expansion_slot_device::blk3_w ) { if (m_cart != NULL) m_cart->vic20_blk3_w(space, offset, data); }
321READ8_MEMBER( vic20_expansion_slot_device::blk5_r ) { UINT8 data = 0; if (m_cart != NULL) data = m_cart->vic20_blk5_r(space, offset); return data; }
322WRITE8_MEMBER( vic20_expansion_slot_device::blk5_w ) { if (m_cart != NULL) m_cart->vic20_blk5_w(space, offset, data); }
323READ8_MEMBER( vic20_expansion_slot_device::io2_r ) { UINT8 data = 0; if (m_cart != NULL) data = m_cart->vic20_io2_r(space, offset); return data; }
324WRITE8_MEMBER( vic20_expansion_slot_device::io2_w ) { if (m_cart != NULL) m_cart->vic20_io2_w(space, offset, data); }
325READ8_MEMBER( vic20_expansion_slot_device::io3_r ) { UINT8 data = 0; if (m_cart != NULL) data = m_cart->vic20_io3_r(space, offset); return data; }
326WRITE8_MEMBER( vic20_expansion_slot_device::io3_w ) { if (m_cart != NULL) m_cart->vic20_io3_w(space, offset, data); }
327
328357WRITE_LINE_MEMBER( vic20_expansion_slot_device::irq_w ) { m_out_irq_func(state); }
329358WRITE_LINE_MEMBER( vic20_expansion_slot_device::nmi_w ) { m_out_nmi_func(state); }
330359WRITE_LINE_MEMBER( vic20_expansion_slot_device::res_w ) { m_out_res_func(state); }
src/mess/machine/vic20exp.h
r14857r14858
1616                    CD5       7      H       CA5
1717                    CD6       8      J       CA6
1818                    CD7       9      K       CA7
19                   BLK1      10      L       CA8
20                   BLK2      11      M       CA9
21                   BLK3      12      N       CA10
22                   BLK5      13      P       CA11
19                  _BLK1      10      L       CA8
20                  _BLK2      11      M       CA9
21                  _BLK3      12      N       CA10
22                  _BLK5      13      P       CA11
2323                  _RAM1      14      R       CA12
2424                  _RAM2      15      S       CA13
2525                  _RAM3      16      T       _I/O2
r14857r14858
9292   vic20_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
9393   virtual ~vic20_expansion_slot_device();
9494
95   UINT8 cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
96   void 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);
97
9598   DECLARE_READ8_MEMBER( ram1_r );
9699   DECLARE_WRITE8_MEMBER( ram1_w );
97100   DECLARE_READ8_MEMBER( ram2_r );
r14857r14858
158161   device_vic20_expansion_card_interface(const machine_config &mconfig, device_t &device);
159162   virtual ~device_vic20_expansion_card_interface();
160163
161   // RAM
162   virtual UINT8 vic20_ram1_r(address_space &space, offs_t offset) { return 0; };
163   virtual void vic20_ram1_w(address_space &space, offs_t offset, UINT8 data) { };
164   // memory access
165   virtual UINT8 vic20_cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) { return 0; };
166   virtual void 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) { };
164167
165   virtual UINT8 vic20_ram2_r(address_space &space, offs_t offset) { return 0; };
166   virtual void vic20_ram2_w(address_space &space, offs_t offset, UINT8 data) { };
168   virtual UINT32 vic20_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return false; }
167169
168   virtual UINT8 vic20_ram3_r(address_space &space, offs_t offset) { return 0; };
169   virtual void vic20_ram3_w(address_space &space, offs_t offset, UINT8 data) { };
170
171   // ROM
172   virtual UINT8 vic20_blk1_r(address_space &space, offs_t offset) { return 0; };
173   virtual void vic20_blk1_w(address_space &space, offs_t offset, UINT8 data) { };
174
175   virtual UINT8 vic20_blk2_r(address_space &space, offs_t offset) { return 0; };
176   virtual void vic20_blk2_w(address_space &space, offs_t offset, UINT8 data) { };
177
178   virtual UINT8 vic20_blk3_r(address_space &space, offs_t offset) { return 0; };
179   virtual void vic20_blk3_w(address_space &space, offs_t offset, UINT8 data) { };
180
181   virtual UINT8 vic20_blk5_r(address_space &space, offs_t offset) { return 0; };
182   virtual void vic20_blk5_w(address_space &space, offs_t offset, UINT8 data) { };
183
184170   virtual UINT8* vic20_blk1_pointer(running_machine &machine, size_t size);
185171   virtual UINT8* vic20_blk2_pointer(running_machine &machine, size_t size);
186172   virtual UINT8* vic20_blk3_pointer(running_machine &machine, size_t size);
187173   virtual UINT8* vic20_blk5_pointer(running_machine &machine, size_t size);
188174   virtual UINT8* vic20_ram_pointer(running_machine &machine, size_t size);
175   virtual UINT8* vic20_nvram_pointer(running_machine &machine, size_t size);
189176
190   // I/O
191   virtual UINT8 vic20_io2_r(address_space &space, offs_t offset) { return 0; };
192   virtual void vic20_io2_w(address_space &space, offs_t offset, UINT8 data) { };
193
194   virtual UINT8 vic20_io3_r(address_space &space, offs_t offset) { return 0; };
195   virtual void vic20_io3_w(address_space &space, offs_t offset, UINT8 data) { };
196
197   // video
198   virtual UINT32 vic20_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return false; }
199
200   virtual UINT8* get_cart_base() { return NULL; }
201
202177protected:
203178   vic20_expansion_slot_device *m_slot;
204179
r14857r14858
207182   UINT8 *m_blk3;
208183   UINT8 *m_blk5;
209184   UINT8 *m_ram;
185   UINT8 *m_nvram;
210186};
211187
212188
src/mess/machine/vic1010.c
r14857r14858
103103
104104
105105//-------------------------------------------------
106//  vic20_ram1_r - RAM 1 read
106//  vic20_cd_r - cartridge data read
107107//-------------------------------------------------
108108
109UINT8 vic1010_device::vic20_ram1_r(address_space &space, offs_t offset)
109UINT8 vic1010_device::vic20_cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
110110{
111111   UINT8 data = 0;
112112
113113   for (int i = 0; i < MAX_SLOTS; i++)
114114   {
115      data |= m_expansion_slot[i]->ram1_r(space, offset);
115      data |= m_expansion_slot[i]->cd_r(space, offset, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3);
116116   }
117117
118118   return data;
r14857r14858
120120
121121
122122//-------------------------------------------------
123//  vic20_ram1_w - RAM 1 write
123//  vic20_cd_w - cartridge data write
124124//-------------------------------------------------
125125
126void vic1010_device::vic20_ram1_w(address_space &space, offs_t offset, UINT8 data)
126void vic1010_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)
127127{
128128   for (int i = 0; i < MAX_SLOTS; i++)
129129   {
130      m_expansion_slot[i]->ram1_w(space, offset, data);
130      m_expansion_slot[i]->cd_w(space, offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3);
131131   }
132132}
133
134
135//-------------------------------------------------
136//  vic20_ram2_r - RAM 2 read
137//-------------------------------------------------
138
139UINT8 vic1010_device::vic20_ram2_r(address_space &space, offs_t offset)
140{
141   UINT8 data = 0;
142
143   for (int i = 0; i < MAX_SLOTS; i++)
144   {
145      data |= m_expansion_slot[i]->ram2_r(space, offset);
146   }
147
148   return data;
149}
150
151
152//-------------------------------------------------
153//  vic20_ram2_w - RAM 2 write
154//-------------------------------------------------
155
156void vic1010_device::vic20_ram2_w(address_space &space, offs_t offset, UINT8 data)
157{
158   for (int i = 0; i < MAX_SLOTS; i++)
159   {
160      m_expansion_slot[i]->ram2_w(space, offset, data);
161   }
162}
163
164
165//-------------------------------------------------
166//  vic20_ram3_r - RAM 3 read
167//-------------------------------------------------
168
169UINT8 vic1010_device::vic20_ram3_r(address_space &space, offs_t offset)
170{
171   UINT8 data = 0;
172
173   for (int i = 0; i < MAX_SLOTS; i++)
174   {
175      data |= m_expansion_slot[i]->ram3_r(space, offset);
176   }
177
178   return data;
179}
180
181
182//-------------------------------------------------
183//  vic20_ram3_w - RAM 3 write
184//-------------------------------------------------
185
186void vic1010_device::vic20_ram3_w(address_space &space, offs_t offset, UINT8 data)
187{
188   for (int i = 0; i < MAX_SLOTS; i++)
189   {
190      m_expansion_slot[i]->ram3_w(space, offset, data);
191   }
192}
193
194
195//-------------------------------------------------
196//  vic20_blk1_r - block 1 read
197//-------------------------------------------------
198
199UINT8 vic1010_device::vic20_blk1_r(address_space &space, offs_t offset)
200{
201   UINT8 data = 0;
202
203   for (int i = 0; i < MAX_SLOTS; i++)
204   {
205      data |= m_expansion_slot[i]->blk1_r(space, offset);
206   }
207
208   return data;
209}
210
211
212//-------------------------------------------------
213//  vic20_blk1_w - block 1 write
214//-------------------------------------------------
215
216void vic1010_device::vic20_blk1_w(address_space &space, offs_t offset, UINT8 data)
217{
218   for (int i = 0; i < MAX_SLOTS; i++)
219   {
220      m_expansion_slot[i]->blk1_w(space, offset, data);
221   }
222}
223
224
225//-------------------------------------------------
226//  vic20_blk2_r - block 2 read
227//-------------------------------------------------
228
229UINT8 vic1010_device::vic20_blk2_r(address_space &space, offs_t offset)
230{
231   UINT8 data = 0;
232
233   for (int i = 0; i < MAX_SLOTS; i++)
234   {
235      data |= m_expansion_slot[i]->blk2_r(space, offset);
236   }
237
238   return data;
239}
240
241
242//-------------------------------------------------
243//  vic20_blk2_w - block 2 write
244//-------------------------------------------------
245
246void vic1010_device::vic20_blk2_w(address_space &space, offs_t offset, UINT8 data)
247{
248   for (int i = 0; i < MAX_SLOTS; i++)
249   {
250      m_expansion_slot[i]->blk2_w(space, offset, data);
251   }
252}
253
254
255//-------------------------------------------------
256//  vic20_blk3_r - block 3 read
257//-------------------------------------------------
258
259UINT8 vic1010_device::vic20_blk3_r(address_space &space, offs_t offset)
260{
261   UINT8 data = 0;
262
263   for (int i = 0; i < MAX_SLOTS; i++)
264   {
265      data |= m_expansion_slot[i]->blk3_r(space, offset);
266   }
267
268   return data;
269}
270
271
272//-------------------------------------------------
273//  vic20_blk3_w - block 3 write
274//-------------------------------------------------
275
276void vic1010_device::vic20_blk3_w(address_space &space, offs_t offset, UINT8 data)
277{
278   for (int i = 0; i < MAX_SLOTS; i++)
279   {
280      m_expansion_slot[i]->blk3_w(space, offset, data);
281   }
282}
283
284
285//-------------------------------------------------
286//  vic20_blk5_r - block 5 read
287//-------------------------------------------------
288
289UINT8 vic1010_device::vic20_blk5_r(address_space &space, offs_t offset)
290{
291   UINT8 data = 0;
292
293   for (int i = 0; i < MAX_SLOTS; i++)
294   {
295      data |= m_expansion_slot[i]->blk5_r(space, offset);
296   }
297
298   return data;
299}
300
301
302//-------------------------------------------------
303//  vic20_blk5_w - block 5 write
304//-------------------------------------------------
305
306void vic1010_device::vic20_blk5_w(address_space &space, offs_t offset, UINT8 data)
307{
308   for (int i = 0; i < MAX_SLOTS; i++)
309   {
310      m_expansion_slot[i]->blk5_w(space, offset, data);
311   }
312}
src/mess/machine/vic1010.h
r14857r14858
5454   virtual machine_config_constructor device_mconfig_additions() const;
5555
5656   // device_vic20_expansion_card_interface overrides
57   virtual UINT8 vic20_ram1_r(address_space &space, offs_t offset);
58   virtual void vic20_ram1_w(address_space &space, offs_t offset, UINT8 data);
59   virtual UINT8 vic20_ram2_r(address_space &space, offs_t offset);
60   virtual void vic20_ram2_w(address_space &space, offs_t offset, UINT8 data);
61   virtual UINT8 vic20_ram3_r(address_space &space, offs_t offset);
62   virtual void vic20_ram3_w(address_space &space, offs_t offset, UINT8 data);
63   virtual UINT8 vic20_blk1_r(address_space &space, offs_t offset);
64   virtual void vic20_blk1_w(address_space &space, offs_t offset, UINT8 data);
65   virtual UINT8 vic20_blk2_r(address_space &space, offs_t offset);
66   virtual void vic20_blk2_w(address_space &space, offs_t offset, UINT8 data);
67   virtual UINT8 vic20_blk3_r(address_space &space, offs_t offset);
68   virtual void vic20_blk3_w(address_space &space, offs_t offset, UINT8 data);
69   virtual UINT8 vic20_blk5_r(address_space &space, offs_t offset);
70   virtual void vic20_blk5_w(address_space &space, offs_t offset, UINT8 data);
57   virtual UINT8 vic20_cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
58   virtual void 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);
7159
7260private:
7361   vic20_expansion_slot_device *m_expansion_slot[MAX_SLOTS];
src/mess/machine/vic20_megacart.c
r0r14858
1/**********************************************************************
2
3    Mega-Cart cartridge emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "vic20_megacart.h"
11
12
13
14//**************************************************************************
15//  DEVICE DEFINITIONS
16//**************************************************************************
17
18const device_type VIC20_MEGACART = &device_creator<vic20_megacart_device>;
19
20
21//-------------------------------------------------
22//  MACHINE_DRIVER( vic1112 )
23//-------------------------------------------------
24
25static MACHINE_CONFIG_FRAGMENT( vic1112 )
26
27MACHINE_CONFIG_END
28
29
30//-------------------------------------------------
31//  machine_config_additions - device-specific
32//  machine configurations
33//-------------------------------------------------
34
35machine_config_constructor vic20_megacart_device::device_mconfig_additions() const
36{
37   return MACHINE_CONFIG_NAME( vic1112 );
38}
39
40
41
42//**************************************************************************
43//  LIVE DEVICE
44//**************************************************************************
45
46//-------------------------------------------------
47//  vic20_megacart_device - constructor
48//-------------------------------------------------
49
50vic20_megacart_device::vic20_megacart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
51    : device_t(mconfig, VIC20_MEGACART, "Mega-Cart", tag, owner, clock),
52     device_vic20_expansion_card_interface(mconfig, *this),
53     m_nvram_en(0)
54{
55}
56
57
58//-------------------------------------------------
59//  device_start - device-specific startup
60//-------------------------------------------------
61
62void vic20_megacart_device::device_start()
63{
64   // state saving
65   save_item(NAME(m_nvram_en));
66}
67
68
69//-------------------------------------------------
70//  device_reset - device-specific reset
71//-------------------------------------------------
72
73void vic20_megacart_device::device_reset()
74{
75}
76
77
78//-------------------------------------------------
79//  vic20_cd_r - cartridge data read
80//-------------------------------------------------
81
82UINT8 vic20_megacart_device::vic20_cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
83{
84   UINT8 data = 0;
85
86   if (!ram1 || !ram2 || !ram3 || !io2 || !io3)
87   {
88      if (m_nvram_en)
89      {
90         data = m_nvram[offset & 0x1fff];
91      }
92   }
93   else if (!blk1 || !blk2 || !blk3)
94   {
95   }
96   else if (!blk5)
97   {
98   }
99
100   return data;
101}
102
103
104//-------------------------------------------------
105//  vic20_cd_w - cartridge data write
106//-------------------------------------------------
107
108void vic20_megacart_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)
109{
110   if (!ram1 || !ram2 || !ram3 || !io2)
111   {
112      if (m_nvram_en)
113      {
114         m_nvram[offset & 0x1fff] = data;
115      }
116   }
117   else if (!blk1 || !blk2 || !blk3)
118   {
119   }
120   else if (!blk5)
121   {
122   }
123   else if (!io3)
124   {
125      if (m_nvram_en)
126      {
127         m_nvram[offset & 0x1fff] = data;
128      }
129   }
130}
src/mess/machine/vic20_megacart.h
r0r14858
1/**********************************************************************
2
3    Mega-Cart cartridge emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __VIC20_MEGACART__
13#define __VIC20_MEGACART__
14
15
16#include "emu.h"
17#include "machine/vic20exp.h"
18
19
20
21//**************************************************************************
22//  TYPE DEFINITIONS
23//**************************************************************************
24
25// ======================> vic20_megacart_device
26
27class vic20_megacart_device :  public device_t,
28                        public device_vic20_expansion_card_interface
29{
30public:
31    // construction/destruction
32    vic20_megacart_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
33
34   // optional information overrides
35   virtual machine_config_constructor device_mconfig_additions() const;
36
37protected:
38    // device-level overrides
39    virtual void device_start();
40   virtual void device_reset();
41   virtual void device_config_complete() { m_shortname = "megacart"; }
42
43   // device_vic20_expansion_card_interface overrides
44   virtual UINT8 vic20_cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
45   virtual void 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);
46
47private:
48   int m_nvram_en;
49};
50
51
52// device type definition
53extern const device_type VIC20_MEGACART;
54
55
56
57#endif
src/mess/machine/vic1110.c
r14857r14858
8585
8686
8787//-------------------------------------------------
88//  vic20_blk1_r - block 1 read
88//  vic20_cd_r - cartridge data read
8989//-------------------------------------------------
9090
91UINT8 vic1110_device::vic20_blk1_r(address_space &space, offs_t offset)
91UINT8 vic1110_device::vic20_cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
9292{
9393   UINT8 data = 0;
94   UINT8 sw = input_port_read(*this, "SW");
9495
95   if (input_port_read(*this, "SW") == BLK1)
96   if ((!blk1 && (sw == BLK1)) || (!blk2 && (sw == BLK2)) || (!blk3 && (sw == BLK3)) || (!blk5 && (sw == BLK5)))
9697   {
9798      data = m_ram[offset & 0x1fff];
9899   }
r14857r14858
102103
103104
104105//-------------------------------------------------
105//  vic20_blk1_w - block 1 write
106//  vic20_cd_w - cartridge data write
106107//-------------------------------------------------
107108
108void vic1110_device::vic20_blk1_w(address_space &space, offs_t offset, UINT8 data)
109void 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)
109110{
110   if (input_port_read(*this, "SW") == BLK1)
111   {
112      m_ram[offset & 0x1fff] = data;
113   }
114}
111   UINT8 sw = input_port_read(*this, "SW");
115112
116
117//-------------------------------------------------
118//  vic20_blk2_r - block 2 read
119//-------------------------------------------------
120
121UINT8 vic1110_device::vic20_blk2_r(address_space &space, offs_t offset)
122{
123   UINT8 data = 0;
124
125   if (input_port_read(*this, "SW") == BLK2)
113   if ((!blk1 && (sw == BLK1)) || (!blk2 && (sw == BLK2)) || (!blk3 && (sw == BLK3)) || (!blk5 && (sw == BLK5)))
126114   {
127      data = m_ram[offset & 0x1fff];
128   }
129
130   return data;
131}
132
133
134//-------------------------------------------------
135//  vic20_blk2_w - block 2 write
136//-------------------------------------------------
137
138void vic1110_device::vic20_blk2_w(address_space &space, offs_t offset, UINT8 data)
139{
140   if (input_port_read(*this, "SW") == BLK2)
141   {
142115      m_ram[offset & 0x1fff] = data;
143116   }
144117}
145
146
147//-------------------------------------------------
148//  vic20_blk3_r - block 3 read
149//-------------------------------------------------
150
151UINT8 vic1110_device::vic20_blk3_r(address_space &space, offs_t offset)
152{
153   UINT8 data = 0;
154
155   if (input_port_read(*this, "SW") == BLK3)
156   {
157      data = m_ram[offset & 0x1fff];
158   }
159
160   return data;
161}
162
163
164//-------------------------------------------------
165//  vic20_blk3_w - block 3 write
166//-------------------------------------------------
167
168void vic1110_device::vic20_blk3_w(address_space &space, offs_t offset, UINT8 data)
169{
170   if (input_port_read(*this, "SW") == BLK3)
171   {
172      m_ram[offset & 0x1fff] = data;
173   }
174}
175
176
177//-------------------------------------------------
178//  vic20_blk5_r - block 5 read
179//-------------------------------------------------
180
181UINT8 vic1110_device::vic20_blk5_r(address_space &space, offs_t offset)
182{
183   UINT8 data = 0;
184
185   if (input_port_read(*this, "SW") == BLK5)
186   {
187      data = m_ram[offset & 0x1fff];
188   }
189
190   return data;
191}
192
193
194//-------------------------------------------------
195//  vic20_blk5_w - block 5 write
196//-------------------------------------------------
197
198void vic1110_device::vic20_blk5_w(address_space &space, offs_t offset, UINT8 data)
199{
200   if (input_port_read(*this, "SW") == BLK5)
201   {
202      m_ram[offset & 0x1fff] = data;
203   }
204}
src/mess/machine/vic1110.h
r14857r14858
4040   virtual void device_config_complete() { m_shortname = "vic1110"; }
4141
4242   // device_vic20_expansion_card_interface overrides
43   virtual UINT8 vic20_blk1_r(address_space &space, offs_t offset);
44   virtual void vic20_blk1_w(address_space &space, offs_t offset, UINT8 data);
45   virtual UINT8 vic20_blk2_r(address_space &space, offs_t offset);
46   virtual void vic20_blk2_w(address_space &space, offs_t offset, UINT8 data);
47   virtual UINT8 vic20_blk3_r(address_space &space, offs_t offset);
48   virtual void vic20_blk3_w(address_space &space, offs_t offset, UINT8 data);
49   virtual UINT8 vic20_blk5_r(address_space &space, offs_t offset);
50   virtual void vic20_blk5_w(address_space &space, offs_t offset, UINT8 data);
43   virtual UINT8 vic20_cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
44   virtual void 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);
5145};
5246
5347
src/mess/machine/vic1111.c
r14857r14858
4646
4747
4848//-------------------------------------------------
49//  vic20_blk1_r - block 1 read
49//  vic20_cd_r - cartridge data read
5050//-------------------------------------------------
5151
52UINT8 vic1111_device::vic20_blk1_r(address_space &space, offs_t offset)
52UINT8 vic1111_device::vic20_cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
5353{
54   return m_ram[offset & 0x1fff];
55}
54   UINT8 data = 0;
5655
56   if (!blk1 || !blk2)
57   {
58      data = m_ram[offset & 0x3fff];
59   }
5760
58//-------------------------------------------------
59//  vic20_blk1_w - block 1 write
60//-------------------------------------------------
61
62void vic1111_device::vic20_blk1_w(address_space &space, offs_t offset, UINT8 data)
63{
64   m_ram[offset & 0x1fff] = data;
61   return data;
6562}
6663
6764
6865//-------------------------------------------------
69//  vic20_blk2_r - block 2 read
66//  vic20_cd_w - cartridge data write
7067//-------------------------------------------------
7168
72UINT8 vic1111_device::vic20_blk2_r(address_space &space, offs_t offset)
69void vic1111_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)
7370{
74   return m_ram[0x2000 | (offset & 0x1fff)];
71   if (!blk1 || !blk2)
72   {
73      m_ram[offset & 0x3fff] = data;
74   }
7575}
76
77
78//-------------------------------------------------
79//  vic20_blk2_w - block 2 write
80//-------------------------------------------------
81
82void vic1111_device::vic20_blk2_w(address_space &space, offs_t offset, UINT8 data)
83{
84   m_ram[0x2000 | (offset & 0x1fff)] = data;
85}
src/mess/machine/vic1111.h
r14857r14858
3737   virtual void device_config_complete() { m_shortname = "vic1111"; }
3838
3939   // device_vic20_expansion_card_interface overrides
40   virtual UINT8 vic20_blk1_r(address_space &space, offs_t offset);
41   virtual void vic20_blk1_w(address_space &space, offs_t offset, UINT8 data);
42   virtual UINT8 vic20_blk2_r(address_space &space, offs_t offset);
43   virtual void vic20_blk2_w(address_space &space, offs_t offset, UINT8 data);
40   virtual UINT8 vic20_cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
41   virtual void 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);
4442};
4543
4644
src/mess/machine/vic1210.c
r14857r14858
4747
4848
4949//-------------------------------------------------
50//  vic20_ram1_r - RAM 1 read
50//  vic20_cd_r - cartridge data read
5151//-------------------------------------------------
5252
53UINT8 vic1210_device::vic20_ram1_r(address_space &space, offs_t offset)
53UINT8 vic1210_device::vic20_cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
5454{
55   return m_ram[offset & 0x3ff];
56}
55   UINT8 data = 0;
5756
57   if (!ram1 || !ram2 || !ram3)
58   {
59      data = m_ram[offset & 0xbff];
60   }
61   else if (!blk5 && m_blk5)
62   {
63      data = m_blk5[offset & 0xfff];
64   }
5865
59//-------------------------------------------------
60//  vic20_ram1_w - RAM 1 write
61//-------------------------------------------------
62
63void vic1210_device::vic20_ram1_w(address_space &space, offs_t offset, UINT8 data)
64{
65   m_ram[offset & 0x3ff] = data;
66   return data;
6667}
6768
6869
6970//-------------------------------------------------
70//  vic20_ram2_r - RAM 2 read
71//  vic20_cd_w - cartridge data write
7172//-------------------------------------------------
7273
73UINT8 vic1210_device::vic20_ram2_r(address_space &space, offs_t offset)
74void vic1210_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)
7475{
75   return m_ram[0x400 | (offset & 0x3ff)];
76}
77
78
79//-------------------------------------------------
80//  vic20_ram2_w - RAM 2 write
81//-------------------------------------------------
82
83void vic1210_device::vic20_ram2_w(address_space &space, offs_t offset, UINT8 data)
84{
85   m_ram[0x400 | (offset & 0x3ff)] = data;
86}
87
88
89//-------------------------------------------------
90//  vic20_ram3_r - RAM 3 read
91//-------------------------------------------------
92
93UINT8 vic1210_device::vic20_ram3_r(address_space &space, offs_t offset)
94{
95   return m_ram[0x800 | (offset & 0x3ff)];
96}
97
98
99//-------------------------------------------------
100//  vic20_ram3_w - RAM 3 write
101//-------------------------------------------------
102
103void vic1210_device::vic20_ram3_w(address_space &space, offs_t offset, UINT8 data)
104{
105   m_ram[0x800 | (offset & 0x3ff)] = data;
106}
107
108
109//-------------------------------------------------
110//  vic20_blk5_r - block 5 read
111//-------------------------------------------------
112
113UINT8 vic1210_device::vic20_blk5_r(address_space &space, offs_t offset)
114{
115   UINT8 data = 0;
116
117   if (m_blk5)
76   if (!ram1 || !ram2 || !ram3)
11877   {
119      data = m_blk5[offset & 0xfff];
78      m_ram[offset & 0xbff] = data;
12079   }
121
122   return data;
12380}
src/mess/machine/vic1112.c
r14857r14858
222222
223223
224224//-------------------------------------------------
225//  vic20_io2_r - I/O 2 read
225//  vic20_cd_r - cartridge data read
226226//-------------------------------------------------
227227
228UINT8 vic1112_device::vic20_io2_r(address_space &space, offs_t offset)
228UINT8 vic1112_device::vic20_cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3)
229229{
230230   UINT8 data = 0;
231231
232   if (offset & 0x10)
232   if (!io2)
233233   {
234      data = m_via1->read(space, offset & 0x0f);
234      if (offset & 0x10)
235      {
236         data = m_via1->read(space, offset & 0x0f);
237      }
238      else
239      {
240         data = m_via0->read(space, offset & 0x0f);
241      }
235242   }
236   else
243   else if (!blk5)
237244   {
238      data = m_via0->read(space, offset & 0x0f);
245      if (offset & 0x1000)
246      {
247         data = m_blk5[offset & 0x17ff];
248      }     
239249   }
240250
241251   return data;
r14857r14858
243253
244254
245255//-------------------------------------------------
246//  vic20_io2_r - I/O 2 write
256//  vic20_cd_w - cartridge data write
247257//-------------------------------------------------
248258
249void vic1112_device::vic20_io2_w(address_space &space, offs_t offset, UINT8 data)
259void vic1112_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)
250260{
251   if (offset & 0x10)
261   if (!io2)
252262   {
253      m_via1->write(space, offset & 0x0f, data);
263      if (offset & 0x10)
264      {
265         m_via1->write(space, offset & 0x0f, data);
266      }
267      else
268      {
269         m_via0->write(space, offset & 0x0f, data);
270      }     
254271   }
255   else
256   {
257      m_via0->write(space, offset & 0x0f, data);
258   }
259272}
260
261
262//-------------------------------------------------
263//  vic20_blk5_r - block 5 read
264//-------------------------------------------------
265
266UINT8 vic1112_device::vic20_blk5_r(address_space &space, offs_t offset)
267{
268   UINT8 data = 0;
269
270   if (offset & 0x1000)
271   {
272      data = m_blk5[offset & 0x17ff];
273   }
274
275   return data;
276}
src/mess/machine/vic1210.h
r14857r14858
3838   virtual void device_config_complete() { m_shortname = "vic1210"; }
3939
4040   // device_vic20_expansion_card_interface overrides
41   virtual UINT8 vic20_ram1_r(address_space &space, offs_t offset);
42   virtual void vic20_ram1_w(address_space &space, offs_t offset, UINT8 data);
43   virtual UINT8 vic20_ram2_r(address_space &space, offs_t offset);
44   virtual void vic20_ram2_w(address_space &space, offs_t offset, UINT8 data);
45   virtual UINT8 vic20_ram3_r(address_space &space, offs_t offset);
46   virtual void vic20_ram3_w(address_space &space, offs_t offset, UINT8 data);
47   virtual UINT8 vic20_blk5_r(address_space &space, offs_t offset);
41   virtual UINT8 vic20_cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
42   virtual void 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);
4843};
4944
5045
src/mess/machine/vic1112.h
r14857r14858
5353   virtual void device_config_complete() { m_shortname = "vic1112"; }
5454
5555   // device_vic20_expansion_card_interface overrides
56   virtual UINT8 vic20_io2_r(address_space &space, offs_t offset);
57   virtual void vic20_io2_w(address_space &space, offs_t offset, UINT8 data);
58   virtual UINT8 vic20_blk5_r(address_space &space, offs_t offset);
56   virtual UINT8 vic20_cd_r(address_space &space, offs_t offset, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
57   virtual void 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);
5958
6059private:
6160   required_device<via6522_device> m_via0;
src/mess/machine/c64exp.c
r14857r14858
311311
312312
313313//-------------------------------------------------
314//  cd_r -
314//  cd_r - cartridge data read
315315//-------------------------------------------------
316316
317317UINT8 c64_expansion_slot_device::cd_r(address_space &space, offs_t offset, int roml, int romh, int io1, int io2)
r14857r14858
328328
329329
330330//-------------------------------------------------
331//  cd_w -
331//  cd_w - cartridge data write
332332//-------------------------------------------------
333333
334334void c64_expansion_slot_device::cd_w(address_space &space, offs_t offset, UINT8 data, int roml, int romh, int io1, int io2)
src/mess/machine/c128_comal80.c
r0r14858
1/**********************************************************************
2
3    Commodore 128 COMAL 80 cartridge emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "c128_comal80.h"
11
12
13
14//**************************************************************************
15//  DEVICE DEFINITIONS
16//**************************************************************************
17
18const device_type C128_COMAL80 = &device_creator<c128_comal80_cartridge_device>;
19
20
21
22//**************************************************************************
23//  LIVE DEVICE
24//**************************************************************************
25
26//-------------------------------------------------
27//  c128_comal80_cartridge_device - constructor
28//-------------------------------------------------
29
30c128_comal80_cartridge_device::c128_comal80_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
31   device_t(mconfig, C128_COMAL80, "C128 COMAL 80 cartridge", tag, owner, clock),
32   device_c64_expansion_card_interface(mconfig, *this)
33{
34}
35
36
37//-------------------------------------------------
38//  device_start - device-specific startup
39//-------------------------------------------------
40
41void c128_comal80_cartridge_device::device_start()
42{
43   // state saving
44   save_item(NAME(m_bank));
45}
46
47
48//-------------------------------------------------
49//  device_reset - device-specific reset
50//-------------------------------------------------
51
52void c128_comal80_cartridge_device::device_reset()
53{
54   m_bank = 0;
55}
56
57
58//-------------------------------------------------
59//  c64_cd_r - cartridge data read
60//-------------------------------------------------
61
62UINT8 c128_comal80_cartridge_device::c64_cd_r(address_space &space, offs_t offset, int roml, int romh, int io1, int io2)
63{
64   UINT8 data = 0;
65
66   if (!romh)
67   {
68      offs_t addr = (m_bank << 14) | (offset & 0x3fff);
69      data = m_roml[addr];
70   }
71
72   return data;
73}
74
75
76//-------------------------------------------------
77//  c64_cd_w - cartridge data write
78//-------------------------------------------------
79
80void c128_comal80_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int roml, int romh, int io1, int io2)
81{
82   if (!io1)
83   {
84      /*
85     
86          bit     description
87     
88          0       
89          1       
90          2       
91          3       
92          4       A14
93          5       ROM select bit 0
94          6       ROM select bit 1
95          7       
96     
97      */
98
99      m_bank = (data >> 4) & 0x07;
100   }
101}
src/mess/machine/c128_comal80.h
r0r14858
1/**********************************************************************
2
3    Commodore 128 COMAL 80 cartridge emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __C128_COMAL80__
13#define __C128_COMAL80__
14
15
16#include "emu.h"
17#include "machine/c64exp.h"
18
19
20
21//**************************************************************************
22//  TYPE DEFINITIONS
23//**************************************************************************
24
25// ======================> c128_comal80_cartridge_device
26
27class c128_comal80_cartridge_device : public device_t,
28                             public device_c64_expansion_card_interface
29{
30public:
31   // construction/destruction
32   c128_comal80_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
33
34protected:
35   // device-level overrides
36   virtual void device_start();
37   virtual void device_reset();
38   virtual void device_config_complete() { m_shortname = "c128_comal80"; }
39
40   // device_c64_expansion_card_interface overrides
41   virtual UINT8 c64_cd_r(address_space &space, offs_t offset, int roml, int romh, int io1, int io2);
42   virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int roml, int romh, int io1, int io2);
43
44private:
45   UINT8 m_bank;
46};
47
48
49// device type definition
50extern const device_type C128_COMAL80;
51
52
53#endif
src/mess/includes/vic20.h
r14857r14858
3737        m_via1(*this, M6522_1_TAG),
3838        m_vic(*this, M6560_TAG),
3939        m_iec(*this, CBM_IEC_TAG),
40        m_exp(*this, VIC20_EXPANSION_SLOT_TAG),
4041        m_cassette(*this, CASSETTE_TAG),
4142        m_ram(*this, RAM_TAG),
4243        m_cassette_timer(*this, TIMER_C1530_TAG)
r14857r14858
4748   required_device<via6522_device> m_via1;
4849   required_device<device_t> m_vic;
4950   required_device<cbm_iec_device> m_iec;
51   required_device<vic20_expansion_slot_device> m_exp;
5052   required_device<cassette_image_device> m_cassette;
5153   required_device<ram_device> m_ram;
5254   required_device<timer_device> m_cassette_timer;
5355
5456   virtual void machine_start();
57   
58   DECLARE_READ8_MEMBER( read );
59   DECLARE_WRITE8_MEMBER( write );
5560
5661   DECLARE_READ8_MEMBER( via0_pa_r );
5762   DECLARE_WRITE8_MEMBER( via0_pa_w );
r14857r14858
6368   DECLARE_WRITE8_MEMBER( via1_pb_w );
6469   DECLARE_WRITE_LINE_MEMBER( via1_ca2_w );
6570   DECLARE_WRITE_LINE_MEMBER( via1_cb2_w );
71   
72   // memory state
73   UINT8 *m_basic;
74   UINT8 *m_kernal;
75   UINT8 *m_charom;
6676
77   // video state
78   UINT8 *m_color_ram;
79
6780   // keyboard state
6881   int m_key_col;
6982};
src/mess/drivers/vic20.c
r14857r14858
6161        * In the Chips (Japan, USA).60
6262        * K-Star Patrol (Europe).60
6363        * Seafox (Japan, USA).60
64    - mos6560_port_r/w should respond at 0x1000-0x100f
6465    - SHIFT LOCK
6566    - restore key
6667    - light pen
r14857r14858
7374
7475
7576//**************************************************************************
77//  MACROS/CONSTANTS
78//**************************************************************************
79
80enum
81{
82   BLK0 = 0,
83   BLK1,
84   BLK2,
85   BLK3,
86   BLK4,
87   BLK5,
88   BLK6,
89   BLK7
90};
91
92
93enum
94{
95   RAM0 = 0,
96   RAM1,
97   RAM2,
98   RAM3,
99   RAM4,
100   RAM5,
101   RAM6,
102   RAM7
103};
104
105
106enum
107{
108   IO0 = 4,
109   COLOR = 5,
110   IO2 = 6,
111   IO3 = 7
112};
113
114
115
116//**************************************************************************
117//  MEMORY MANAGEMENT
118//**************************************************************************
119
120//-------------------------------------------------
121//  read -
122//-------------------------------------------------
123
124READ8_MEMBER( vic20_state::read )
125{
126   UINT8 data = 0;
127
128   int ram1 = 1, ram2 = 1, ram3 = 1;
129   int blk1 = 1, blk2 = 1, blk3 = 1, blk5 = 1;
130   int io2 = 1, io3 = 1;
131
132   switch ((offset >> 13) & 0x07)
133   {
134   case BLK0:
135      switch ((offset >> 10) & 0x07)
136      {
137      case RAM0:
138         data = m_ram->pointer()[offset];
139         break;
140
141      case RAM1: ram1 = 0; break;
142      case RAM2: ram2 = 0; break;
143      case RAM3: ram3 = 0; break;
144
145      default:
146         data = m_ram->pointer()[0x400 + (offset & 0xfff)];
147         break;
148      }
149      break;
150
151   case BLK1: blk1 = 0; break;
152   case BLK2: blk2 = 0; break;
153   case BLK3: blk3 = 0; break;
154
155   case BLK4:
156      switch ((offset >> 10) & 0x07)
157      {
158      default:
159         data = m_charom[offset & 0xfff];
160         break;
161
162      case IO0:
163         if (BIT(offset, 4))
164         {
165            data = m_via0->read(space, offset & 0x0f);
166         }
167         else if (BIT(offset, 5))
168         {
169            data = m_via1->read(space, offset & 0x0f);
170         }
171         else if (offset >= 0x9000 && offset < 0x9010)
172         {
173            data = mos6560_port_r(m_vic, offset & 0x0f);
174         }
175         break;
176
177      case COLOR:
178         data = m_color_ram[offset & 0x3ff];
179         break;
180
181      case IO2: io2 = 0; break;
182      case IO3: io3 = 0; break;
183      }
184      break;
185
186   case BLK5: blk5 = 0; break;
187
188   case BLK6:
189      data = m_basic[offset & 0x1fff];
190      break;
191
192   case BLK7:
193      data = m_kernal[offset & 0x1fff];
194      break;
195   }
196
197   data |= m_exp->cd_r(space, offset & 0x1fff, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3);
198
199   return data;
200}
201
202
203//-------------------------------------------------
204//  write -
205//-------------------------------------------------
206
207WRITE8_MEMBER( vic20_state::write )
208{
209   int ram1 = 1, ram2 = 1, ram3 = 1;
210   int blk1 = 1, blk2 = 1, blk3 = 1, blk5 = 1;
211   int io2 = 1, io3 = 1;
212
213   switch ((offset >> 13) & 0x07)
214   {
215   case BLK0:
216      switch ((offset >> 10) & 0x07)
217      {
218      case RAM0:
219         m_ram->pointer()[offset] = data;
220         break;
221
222      case RAM1: ram1 = 0; break;
223      case RAM2: ram2 = 0; break;
224      case RAM3: ram3 = 0; break;
225
226      default:
227         m_ram->pointer()[0x400 + (offset & 0xfff)] = data;
228         break;
229      }
230      break;
231
232   case BLK1: blk1 = 0; break;
233   case BLK2: blk2 = 0; break;
234   case BLK3: blk3 = 0; break;
235
236   case BLK4:
237      switch ((offset >> 10) & 0x07)
238      {
239      case IO0:
240         if (BIT(offset, 4))
241         {
242            m_via0->write(space, offset & 0x0f, data);
243         }
244         else if (BIT(offset, 5))
245         {
246            m_via1->write(space, offset & 0x0f, data);
247         }
248         else if (offset >= 0x9000 && offset < 0x9010)
249         {
250            mos6560_port_w(m_vic, offset & 0x0f, data);
251         }
252         break;
253
254      case COLOR:
255         m_color_ram[offset & 0x3ff] = data;
256         break;
257
258      case IO2: io2 = 0; break;
259      case IO3: io3 = 0; break;
260      }
261      break;
262
263   case BLK5: blk5 = 0; break;
264   }
265
266   m_exp->cd_w(space, offset & 0x1fff, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3);
267}
268
269
270
271//**************************************************************************
76272//  VIDEO
77273//**************************************************************************
78274
r14857r14858
123319//-------------------------------------------------
124320
125321static ADDRESS_MAP_START( vic20_mem, AS_PROGRAM, 8, vic20_state )
126   AM_RANGE(0x0000, 0x03ff) AM_RAM
127   AM_RANGE(0x0400, 0x07ff) AM_DEVREADWRITE(VIC20_EXPANSION_SLOT_TAG, vic20_expansion_slot_device, ram1_r, ram1_w)
128   AM_RANGE(0x0800, 0x0bff) AM_DEVREADWRITE(VIC20_EXPANSION_SLOT_TAG, vic20_expansion_slot_device, ram2_r, ram2_w)
129   AM_RANGE(0x0c00, 0x0fff) AM_DEVREADWRITE(VIC20_EXPANSION_SLOT_TAG, vic20_expansion_slot_device, ram3_r, ram3_w)
130   AM_RANGE(0x1000, 0x1fff) AM_RAM
131   AM_RANGE(0x2000, 0x3fff) AM_DEVREADWRITE(VIC20_EXPANSION_SLOT_TAG, vic20_expansion_slot_device, blk1_r, blk1_w)
132   AM_RANGE(0x4000, 0x5fff) AM_DEVREADWRITE(VIC20_EXPANSION_SLOT_TAG, vic20_expansion_slot_device, blk2_r, blk2_w)
133   AM_RANGE(0x6000, 0x7fff) AM_DEVREADWRITE(VIC20_EXPANSION_SLOT_TAG, vic20_expansion_slot_device, blk3_r, blk3_w)
134   AM_RANGE(0x8000, 0x8fff) AM_ROM
135   AM_RANGE(0x9000, 0x900f) AM_DEVREADWRITE_LEGACY(M6560_TAG, mos6560_port_r, mos6560_port_w)
136   AM_RANGE(0x9110, 0x911f) AM_DEVREADWRITE(M6522_0_TAG, via6522_device, read, write)
137   AM_RANGE(0x9120, 0x912f) AM_DEVREADWRITE(M6522_1_TAG, via6522_device, read, write)
138   AM_RANGE(0x9400, 0x97ff) AM_RAM
139   AM_RANGE(0x9800, 0x9bff) AM_DEVREADWRITE(VIC20_EXPANSION_SLOT_TAG, vic20_expansion_slot_device, io2_r, io2_w)
140   AM_RANGE(0x9c00, 0x9fff) AM_DEVREADWRITE(VIC20_EXPANSION_SLOT_TAG, vic20_expansion_slot_device, io3_r, io3_w)
141   AM_RANGE(0xa000, 0xbfff) AM_DEVREADWRITE(VIC20_EXPANSION_SLOT_TAG, vic20_expansion_slot_device, blk5_r, blk5_w)
142   AM_RANGE(0xc000, 0xffff) AM_ROM
322   AM_RANGE(0x0000, 0xffff) AM_READWRITE(read, write)
143323ADDRESS_MAP_END
144324
145325
r14857r14858
520700
521701static int vic20_dma_read_color( running_machine &machine, int offset )
522702{
523   address_space *program = machine.device(M6502_TAG)->memory().space(AS_PROGRAM);
703   vic20_state *state = machine.driver_data<vic20_state>();
524704
525   return program->read_byte(0x9400 | (offset & 0x3ff));
705   return state->m_color_ram[offset & 0x3ff];
526706}
527707
528708static int vic20_dma_read( running_machine &machine, int offset )
r14857r14858
604784
605785void vic20_state::machine_start()
606786{
787   // find memory regions
788   m_basic = machine().region("basic")->base();
789   m_kernal = machine().region("kernal")->base();
790   m_charom = machine().region("charom")->base();
791
792   // allocate memory
793   m_color_ram = auto_alloc_array(machine(), UINT8, 0x400);
794
607795   // state saving
608796   save_item(NAME(m_key_col));
609797}
r14857r14858
720908//-------------------------------------------------
721909
722910ROM_START( vic1001 )
723   ROM_REGION( 0x10000, M6502_TAG, 0 )
724   ROM_LOAD( "901460-02", 0x8000, 0x1000, CRC(fcfd8a4b) SHA1(dae61ac03065aa2904af5c123ce821855898c555) )
725   ROM_LOAD( "901486-01", 0xc000, 0x2000, CRC(db4c43c1) SHA1(587d1e90950675ab6b12d91248a3f0d640d02e8d) )
726   ROM_LOAD( "901486-02", 0xe000, 0x2000, CRC(336900d7) SHA1(c9ead45e6674d1042ca6199160e8583c23aeac22) )
911   ROM_REGION( 0x2000, "basic", 0 )
912   ROM_LOAD( "901486-01", 0x0000, 0x2000, CRC(db4c43c1) SHA1(587d1e90950675ab6b12d91248a3f0d640d02e8d) )
913
914   ROM_REGION( 0x2000, "kernal", 0 )
915   ROM_LOAD( "901486-02", 0x0000, 0x2000, CRC(336900d7) SHA1(c9ead45e6674d1042ca6199160e8583c23aeac22) )
916
917   ROM_REGION( 0x1000, "charom", 0 )
918   ROM_LOAD( "901460-02", 0x0000, 0x1000, CRC(fcfd8a4b) SHA1(dae61ac03065aa2904af5c123ce821855898c555) )
727919ROM_END
728920
729921
r14857r14858
732924//-------------------------------------------------
733925
734926ROM_START( vic20 )
735   ROM_REGION( 0x10000, M6502_TAG, 0 )
736   ROM_LOAD( "901460-03.ud7",  0x8000, 0x1000, CRC(83e032a6) SHA1(4fd85ab6647ee2ac7ba40f729323f2472d35b9b4) )
737   ROM_LOAD( "901486-01.ue11", 0xc000, 0x2000, CRC(db4c43c1) SHA1(587d1e90950675ab6b12d91248a3f0d640d02e8d) )
927   ROM_REGION( 0x2000, "basic", 0 )
928   ROM_LOAD( "901486-01.ue11", 0x0000, 0x2000, CRC(db4c43c1) SHA1(587d1e90950675ab6b12d91248a3f0d640d02e8d) )
929
930   ROM_REGION( 0x2000, "kernal", 0 )
738931   ROM_SYSTEM_BIOS( 0, "cbm", "Original" )
739   ROMX_LOAD( "901486-06.ue12", 0xe000, 0x2000, CRC(e5e7c174) SHA1(06de7ec017a5e78bd6746d89c2ecebb646efeb19), ROM_BIOS(1) )
932   ROMX_LOAD( "901486-06.ue12", 0x0000, 0x2000, CRC(e5e7c174) SHA1(06de7ec017a5e78bd6746d89c2ecebb646efeb19), ROM_BIOS(1) )
740933   ROM_SYSTEM_BIOS( 1, "jiffydos", "JiffyDOS" )
741   ROMX_LOAD( "jiffydos vic-20 ntsc.ue12", 0xe000, 0x2000, CRC(683a757f) SHA1(83fb83e97b5a840311dbf7e1fe56fe828f41936d), ROM_BIOS(2) )
934   ROMX_LOAD( "jiffydos vic-20 ntsc.ue12", 0x0000, 0x2000, CRC(683a757f) SHA1(83fb83e97b5a840311dbf7e1fe56fe828f41936d), ROM_BIOS(2) )
935
936   ROM_REGION( 0x1000, "charom", 0 )
937   ROM_LOAD( "901460-03.ud7", 0x0000, 0x1000, CRC(83e032a6) SHA1(4fd85ab6647ee2ac7ba40f729323f2472d35b9b4) )
742938ROM_END
743939
744940
r14857r14858
747943//-------------------------------------------------
748944
749945ROM_START( vic20p )
750   ROM_REGION( 0x10000, M6502_TAG, 0 )
751   ROM_LOAD( "901460-03.ud7",  0x8000, 0x1000, CRC(83e032a6) SHA1(4fd85ab6647ee2ac7ba40f729323f2472d35b9b4) )
752   ROM_LOAD( "901486-01.ue11", 0xc000, 0x2000, CRC(db4c43c1) SHA1(587d1e90950675ab6b12d91248a3f0d640d02e8d) )
946   ROM_REGION( 0x2000, "basic", 0 )
947   ROM_LOAD( "901486-01.ue11", 0x0000, 0x2000, CRC(db4c43c1) SHA1(587d1e90950675ab6b12d91248a3f0d640d02e8d) )
948   
949   ROM_REGION( 0x2000, "kernal", 0 )
753950   ROM_SYSTEM_BIOS( 0, "cbm", "Original" )
754   ROMX_LOAD( "901486-07.ue12", 0xe000, 0x2000, CRC(4be07cb4) SHA1(ce0137ed69f003a299f43538fa9eee27898e621e), ROM_BIOS(1) )
951   ROMX_LOAD( "901486-07.ue12", 0x0000, 0x2000, CRC(4be07cb4) SHA1(ce0137ed69f003a299f43538fa9eee27898e621e), ROM_BIOS(1) )
755952   ROM_SYSTEM_BIOS( 1, "jiffydos", "JiffyDOS" )
756   ROMX_LOAD( "jiffydos vic-20 pal.ue12", 0xe000, 0x2000, CRC(705e7810) SHA1(5a03623a4b855531b8bffd756f701306f128be2d), ROM_BIOS(2) )
953   ROMX_LOAD( "jiffydos vic-20 pal.ue12", 0x0000, 0x2000, CRC(705e7810) SHA1(5a03623a4b855531b8bffd756f701306f128be2d), ROM_BIOS(2) )
954
955   ROM_REGION( 0x1000, "charom", 0 )
956   ROM_LOAD( "901460-03.ud7", 0x0000, 0x1000, CRC(83e032a6) SHA1(4fd85ab6647ee2ac7ba40f729323f2472d35b9b4) )
757957ROM_END
758958
759959
r14857r14858
762962//-------------------------------------------------
763963
764964ROM_START( vic20s )
765   ROM_REGION( 0x10000, M6502_TAG, 0 )
766   ROM_LOAD( "nec22101.207",   0x8000, 0x1000, CRC(d808551d) SHA1(f403f0b0ce5922bd61bbd768bdd6f0b38e648c9f) )
767   ROM_LOAD( "901486-01.ue11",   0xc000, 0x2000, CRC(db4c43c1) SHA1(587d1e90950675ab6b12d91248a3f0d640d02e8d) )
768   ROM_LOAD( "nec22081.206",   0xe000, 0x2000, CRC(b2a60662) SHA1(cb3e2f6e661ea7f567977751846ce9ad524651a3) )
965   ROM_REGION( 0x2000, "basic", 0 )
966   ROM_LOAD( "901486-01.ue11",   0x0000, 0x2000, CRC(db4c43c1) SHA1(587d1e90950675ab6b12d91248a3f0d640d02e8d) )
967
968   ROM_REGION( 0x2000, "kernal", 0 )
969   ROM_LOAD( "nec22081.206", 0x0000, 0x2000, CRC(b2a60662) SHA1(cb3e2f6e661ea7f567977751846ce9ad524651a3) )
970
971   ROM_REGION( 0x1000, "charom", 0 )
972   ROM_LOAD( "nec22101.207", 0x0000, 0x1000, CRC(d808551d) SHA1(f403f0b0ce5922bd61bbd768bdd6f0b38e648c9f) )
769973ROM_END
770974
771975
src/mess/mess.mak
r14857r14858
829829   $(MESS_DRIVERS)/vic20.o      \
830830   $(MESS_MACHINE)/vic20exp.o   \
831831   $(MESS_MACHINE)/vic20std.o   \
832   $(MESS_MACHINE)/vic20_megacart.o   \
832833   $(MESS_MACHINE)/vic1010.o   \
833834   $(MESS_MACHINE)/vic1110.o   \
834835   $(MESS_MACHINE)/vic1111.o   \
r14857r14858
845846   $(MESS_MACHINE)/c65.o      \
846847   $(MESS_DRIVERS)/c128.o      \
847848   $(MESS_MACHINE)/c128.o      \
849   $(MESS_MACHINE)/c128_comal80.o      \
848850   $(MESS_MACHINE)/cbmiec.o   \
849851   $(MESS_MACHINE)/c1541.o      \
850852   $(MESS_MACHINE)/c1551.o      \

Previous 15994 Revisions Next


© 1998-2018 The MESS Team