Previous 199869 Revisions Next

r18912 Thursday 8th November, 2012 at 17:39:28 UTC by Curt Coder
(MESS) adam: Added all 3 expansion slot interfaces, and the 64K RAM expansion card. [Curt Coder]
[src/mess]mess.mak
[src/mess/drivers]adam.c
[src/mess/includes]adam.h
[src/mess/machine]adam_ram.c* adam_ram.h* adamexp.c* adamexp.h* adamlink.c* adamlink.h*

trunk/src/mess/machine/adam_ram.c
r0r18912
1/**********************************************************************
2
3    Coleco Adam Internal 64KB RAM Expansion emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "adam_ram.h"
11
12
13
14//**************************************************************************
15//  DEVICE DEFINITIONS
16//**************************************************************************
17
18const device_type ADAM_RAM = &device_creator<adam_ram_expansion_device>;
19
20
21
22//**************************************************************************
23//  LIVE DEVICE
24//**************************************************************************
25
26//-------------------------------------------------
27//  adam_ram_expansion_device - constructor
28//-------------------------------------------------
29
30adam_ram_expansion_device::adam_ram_expansion_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
31   : device_t(mconfig, ADAM_RAM, "Adam 64KB RAM expansion", tag, owner, clock),
32     device_adam_expansion_slot_card_interface(mconfig, *this)
33{
34}
35
36
37//-------------------------------------------------
38//  device_start - device-specific startup
39//-------------------------------------------------
40
41void adam_ram_expansion_device::device_start()
42{
43   adam_ram_pointer(machine(), 64 * 1024);
44}
45
46
47//-------------------------------------------------
48//  adam_bd_r - buffered data read
49//-------------------------------------------------
50
51UINT8 adam_ram_expansion_device::adam_bd_r(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
52{
53   if (!cas2)
54   {
55      data = m_ram[offset];
56   }
57
58   return data;
59}
60
61
62//-------------------------------------------------
63//  adam_bd_w - buffered data write
64//-------------------------------------------------
65
66void adam_ram_expansion_device::adam_bd_w(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
67{
68   if (!cas2)
69   {
70      m_ram[offset] = data;
71   }
72}
trunk/src/mess/machine/adam_ram.h
r0r18912
1/**********************************************************************
2
3    Coleco Adam Internal 64KB RAM Expansion 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 __ADAM_RAM__
13#define __ADAM_RAM__
14
15#include "emu.h"
16#include "machine/adamexp.h"
17
18
19
20//**************************************************************************
21//  TYPE DEFINITIONS
22//**************************************************************************
23
24// ======================> adam_ram_expansion_device
25
26class adam_ram_expansion_device :  public device_t,
27                           public device_adam_expansion_slot_card_interface
28{
29public:
30   // construction/destruction
31   adam_ram_expansion_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
32
33protected:
34   // device-level overrides
35   virtual void device_config_complete() { m_shortname = "adam_ram"; }
36   virtual void device_start();
37
38   // device_adam_expansion_slot_card_interface overrides
39   virtual UINT8 adam_bd_r(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2);
40   virtual void adam_bd_w(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2);
41};
42
43
44// device type definition
45extern const device_type ADAM_RAM;
46
47
48
49#endif
trunk/src/mess/machine/adamexp.c
r0r18912
1/**********************************************************************
2
3    Coleco Adam Expansion Port emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "machine/adamexp.h"
11
12
13
14//**************************************************************************
15//  MACROS/CONSTANTS
16//**************************************************************************
17
18#define LOG 0
19
20
21
22//**************************************************************************
23//  DEVICE DEFINITIONS
24//**************************************************************************
25
26const device_type ADAM_EXPANSION_SLOT = &device_creator<adam_expansion_slot_device>;
27
28
29
30//**************************************************************************
31//  DEVICE C64_EXPANSION CARD INTERFACE
32//**************************************************************************
33
34//-------------------------------------------------
35//  device_adam_expansion_slot_card_interface - constructor
36//-------------------------------------------------
37
38device_adam_expansion_slot_card_interface::device_adam_expansion_slot_card_interface(const machine_config &mconfig, device_t &device)
39   : device_slot_card_interface(mconfig, device),
40     m_rom(NULL),
41     m_ram(NULL),
42     m_rom_mask(0),
43     m_ram_mask(0)
44{
45   m_slot = dynamic_cast<adam_expansion_slot_device *>(device.owner());
46}
47
48
49//-------------------------------------------------
50//  ~device_adam_expansion_slot_card_interface - destructor
51//-------------------------------------------------
52
53device_adam_expansion_slot_card_interface::~device_adam_expansion_slot_card_interface()
54{
55}
56
57
58//-------------------------------------------------
59//  adam_rom_pointer - get expansion ROM pointer
60//-------------------------------------------------
61
62UINT8* device_adam_expansion_slot_card_interface::adam_rom_pointer(running_machine &machine, size_t size)
63{
64   if (m_rom == NULL)
65   {
66      m_rom = auto_alloc_array(machine, UINT8, size);
67
68      m_rom_mask = size - 1;
69   }
70
71   return m_rom;
72}
73
74
75//-------------------------------------------------
76//  adam_ram_pointer - get expansion ROM pointer
77//-------------------------------------------------
78
79UINT8* device_adam_expansion_slot_card_interface::adam_ram_pointer(running_machine &machine, size_t size)
80{
81   if (m_ram == NULL)
82   {
83      m_ram = auto_alloc_array(machine, UINT8, size);
84
85      m_ram_mask = size - 1;
86   }
87
88   return m_ram;
89}
90
91
92
93//**************************************************************************
94//  LIVE DEVICE
95//**************************************************************************
96
97//-------------------------------------------------
98//  adam_expansion_slot_device - constructor
99//-------------------------------------------------
100
101adam_expansion_slot_device::adam_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
102        device_t(mconfig, ADAM_EXPANSION_SLOT, "ADAM expansion slot", tag, owner, clock),
103      device_slot_interface(mconfig, *this),
104      device_image_interface(mconfig, *this)
105{
106}
107
108
109//-------------------------------------------------
110//  adam_expansion_slot_device - destructor
111//-------------------------------------------------
112
113adam_expansion_slot_device::~adam_expansion_slot_device()
114{
115}
116
117
118//-------------------------------------------------
119//  device_config_complete - perform any
120//  operations now that the configuration is
121//  complete
122//-------------------------------------------------
123
124void adam_expansion_slot_device::device_config_complete()
125{
126   // inherit a copy of the static data
127   const adam_expansion_slot_interface *intf = reinterpret_cast<const adam_expansion_slot_interface *>(static_config());
128   if (intf != NULL)
129   {
130      *static_cast<adam_expansion_slot_interface *>(this) = *intf;
131   }
132
133   // or initialize to defaults if none provided
134   else
135   {
136       memset(&m_out_int_cb, 0, sizeof(m_out_int_cb));
137   }
138
139   // set brief and instance name
140   update_names();
141}
142
143
144//-------------------------------------------------
145//  device_start - device-specific startup
146//-------------------------------------------------
147
148void adam_expansion_slot_device::device_start()
149{
150   m_cart = dynamic_cast<device_adam_expansion_slot_card_interface *>(get_card_device());
151
152   // resolve callbacks
153   m_out_int_func.resolve(m_out_int_cb, *this);
154}
155
156
157//-------------------------------------------------
158//  device_reset - device-specific reset
159//-------------------------------------------------
160
161void adam_expansion_slot_device::device_reset()
162{
163}
164
165
166//-------------------------------------------------
167//  call_load -
168//-------------------------------------------------
169
170bool adam_expansion_slot_device::call_load()
171{
172   if (m_cart)
173   {
174      size_t size = 0;
175
176      if (software_entry() == NULL)
177      {
178         size = length();
179
180         fread(m_cart->adam_rom_pointer(machine(), size), size);
181      }
182      else
183      {
184         size = get_software_region_length("rom");
185         if (size) memcpy(m_cart->adam_rom_pointer(machine(), size), get_software_region("rom"), size);
186
187         size = get_software_region_length("ram");
188         if (size) memcpy(m_cart->adam_ram_pointer(machine(), size), get_software_region("ram"), size);
189      }
190   }
191
192   return IMAGE_INIT_PASS;
193}
194
195
196//-------------------------------------------------
197//  call_softlist_load -
198//-------------------------------------------------
199
200bool adam_expansion_slot_device::call_softlist_load(char *swlist, char *swname, rom_entry *start_entry)
201{
202   load_software_part_region(this, swlist, swname, start_entry);
203
204   return true;
205}
206
207
208//-------------------------------------------------
209//  get_default_card_software -
210//-------------------------------------------------
211
212const char * adam_expansion_slot_device::get_default_card_software(const machine_config &config, emu_options &options)
213{
214   return software_get_default_slot(config, options, this, "standard");
215}
216
217
218//-------------------------------------------------
219//  bd_r - buffered data read
220//-------------------------------------------------
221
222UINT8 adam_expansion_slot_device::bd_r(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
223{
224   if (m_cart != NULL)
225   {
226      data = m_cart->adam_bd_r(space, offset, data, bmreq, biorq, aux_rom_cs, cas1, cas2);
227   }
228
229   return data;
230}
231
232
233//-------------------------------------------------
234//  cd_w - cartridge data write
235//-------------------------------------------------
236
237void adam_expansion_slot_device::bd_w(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
238{
239   if (m_cart != NULL)
240   {
241      m_cart->adam_bd_w(space, offset, data, bmreq, biorq, aux_rom_cs, cas1, cas2);
242   }
243}
244
245WRITE_LINE_MEMBER( adam_expansion_slot_device::int_w ) { m_out_int_func(state); }
246
247
248//-------------------------------------------------
249//  SLOT_INTERFACE( adam_slot1_devices )
250//-------------------------------------------------
251
252SLOT_INTERFACE_START( adam_slot1_devices )
253   SLOT_INTERFACE("adamlink", ADAMLINK)
254SLOT_INTERFACE_END
255
256
257//-------------------------------------------------
258//  SLOT_INTERFACE( adam_slot2_devices )
259//-------------------------------------------------
260
261SLOT_INTERFACE_START( adam_slot2_devices )
262SLOT_INTERFACE_END
263
264
265//-------------------------------------------------
266//  SLOT_INTERFACE( adam_slot3_devices )
267//-------------------------------------------------
268
269SLOT_INTERFACE_START( adam_slot3_devices )
270   SLOT_INTERFACE("ram", ADAM_RAM)
271SLOT_INTERFACE_END
trunk/src/mess/machine/adamlink.c
r0r18912
1/**********************************************************************
2
3    Coleco AdamLink 300 Baud Modem emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "adamlink.h"
11
12
13
14//**************************************************************************
15//  DEVICE DEFINITIONS
16//**************************************************************************
17
18const device_type ADAMLINK = &device_creator<adamlink_device>;
19
20
21
22//**************************************************************************
23//  LIVE DEVICE
24//**************************************************************************
25
26//-------------------------------------------------
27//  adamlink_device - constructor
28//-------------------------------------------------
29
30adamlink_device::adamlink_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
31   : device_t(mconfig, ADAMLINK, "AdamLink modem", tag, owner, clock),
32     device_adam_expansion_slot_card_interface(mconfig, *this)
33{
34}
35
36
37//-------------------------------------------------
38//  device_start - device-specific startup
39//-------------------------------------------------
40
41void adamlink_device::device_start()
42{
43}
44
45
46//-------------------------------------------------
47//  adam_bd_r - buffered data read
48//-------------------------------------------------
49
50UINT8 adamlink_device::adam_bd_r(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
51{
52   if (!biorq)
53   {
54      switch (offset)
55      {
56      case 0x5e:
57         break;
58
59      case 0x5f:
60         break;
61      }
62   }
63
64   return data;
65}
66
67
68//-------------------------------------------------
69//  adam_bd_w - buffered data write
70//-------------------------------------------------
71
72void adamlink_device::adam_bd_w(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2)
73{
74   if (!biorq)
75   {
76      switch (offset)
77      {
78      case 0x5e:
79         break;
80         
81      case 0x5f:
82         break;
83      }
84   }
85}
trunk/src/mess/machine/adamexp.h
r0r18912
1/**********************************************************************
2
3    Coleco Adam Expansion Port 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 __ADAM_EXPANSION_SLOT__
13#define __ADAM_EXPANSION_SLOT__
14
15#include "emu.h"
16
17
18
19//**************************************************************************
20//  CONSTANTS
21//**************************************************************************
22
23#define ADAM_LEFT_EXPANSION_SLOT_TAG      "slot1"
24#define ADAM_CENTER_EXPANSION_SLOT_TAG      "slot2"
25#define ADAM_RIGHT_EXPANSION_SLOT_TAG      "slot3"
26
27
28
29//**************************************************************************
30//  INTERFACE CONFIGURATION MACROS
31//**************************************************************************
32
33#define ADAM_EXPANSION_SLOT_INTERFACE(_name) \
34   const adam_expansion_slot_interface (_name) =
35
36
37#define MCFG_ADAM_EXPANSION_SLOT_ADD(_tag, _clock, _config, _slot_intf, _def_slot, _def_inp) \
38    MCFG_DEVICE_ADD(_tag, ADAM_EXPANSION_SLOT, _clock) \
39    MCFG_DEVICE_CONFIG(_config) \
40   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false)
41
42
43
44//**************************************************************************
45//  TYPE DEFINITIONS
46//**************************************************************************
47
48// ======================> adam_expansion_slot_interface
49
50struct adam_expansion_slot_interface
51{
52   devcb_write_line   m_out_int_cb;
53};
54
55
56// ======================> adam_expansion_slot_device
57
58class device_adam_expansion_slot_card_interface;
59
60class adam_expansion_slot_device : public device_t,
61                           public adam_expansion_slot_interface,
62                           public device_slot_interface,
63                           public device_image_interface
64{
65public:
66   // construction/destruction
67   adam_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
68   virtual ~adam_expansion_slot_device();
69
70   // computer interface
71   UINT8 bd_r(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2);
72   void bd_w(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2);
73
74   // cartridge interface
75   DECLARE_WRITE_LINE_MEMBER( int_w );
76
77protected:
78   // device-level overrides
79   virtual void device_config_complete();
80   virtual void device_start();
81   virtual void device_reset();
82
83   // image-level overrides
84   virtual bool call_load();
85   virtual bool call_softlist_load(char *swlist, char *swname, rom_entry *start_entry);
86
87   virtual iodevice_t image_type() const { return IO_CARTSLOT; }
88
89   virtual bool is_readable()  const { return 1; }
90   virtual bool is_writeable() const { return 0; }
91   virtual bool is_creatable() const { return 0; }
92   virtual bool must_be_loaded() const { return 0; }
93   virtual bool is_reset_on_load() const { return 1; }
94   virtual const char *image_interface() const { return "adam_rom"; }
95   virtual const char *file_extensions() const { return "bin,rom"; }
96   virtual const option_guide *create_option_guide() const { return NULL; }
97
98   // slot interface overrides
99   virtual const char * get_default_card_software(const machine_config &config, emu_options &options);
100
101   devcb_resolved_write_line   m_out_int_func;
102
103   device_adam_expansion_slot_card_interface *m_cart;
104};
105
106
107// ======================> device_adam_expansion_slot_card_interface
108
109class device_adam_expansion_slot_card_interface : public device_slot_card_interface
110{
111   friend class adam_expansion_slot_device;
112
113public:
114   // construction/destruction
115   device_adam_expansion_slot_card_interface(const machine_config &mconfig, device_t &device);
116   virtual ~device_adam_expansion_slot_card_interface();
117
118protected:
119   // initialization
120   virtual UINT8* adam_rom_pointer(running_machine &machine, size_t size);
121   virtual UINT8* adam_ram_pointer(running_machine &machine, size_t size);
122
123   // runtime
124   virtual UINT8 adam_bd_r(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) { return data; }
125   virtual void adam_bd_w(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2) { }
126
127   adam_expansion_slot_device *m_slot;
128
129   UINT8 *m_rom;
130   UINT8 *m_ram;
131
132   size_t m_rom_mask;
133   size_t m_ram_mask;
134};
135
136
137// device type definition
138extern const device_type ADAM_EXPANSION_SLOT;
139
140
141// slot devices
142#include "machine/adamlink.h"
143#include "machine/adam_ram.h"
144
145SLOT_INTERFACE_EXTERN( adam_slot1_devices );
146SLOT_INTERFACE_EXTERN( adam_slot2_devices );
147SLOT_INTERFACE_EXTERN( adam_slot3_devices );
148
149
150
151#endif
trunk/src/mess/machine/adamlink.h
r0r18912
1/**********************************************************************
2
3    Coleco AdamLink 300 Baud Modem 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 __ADAMLINK__
13#define __ADAMLINK__
14
15#include "emu.h"
16#include "machine/adamexp.h"
17
18
19
20//**************************************************************************
21//  TYPE DEFINITIONS
22//**************************************************************************
23
24// ======================> adamlink_device
25
26class adamlink_device :  public device_t,
27                   public device_adam_expansion_slot_card_interface
28{
29public:
30   // construction/destruction
31   adamlink_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
32
33protected:
34   // device-level overrides
35   virtual void device_config_complete() { m_shortname = "adamlink"; }
36   virtual void device_start();
37
38   // device_adam_expansion_slot_card_interface overrides
39   virtual UINT8 adam_bd_r(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2);
40   virtual void adam_bd_w(address_space &space, offs_t offset, UINT8 data, int bmreq, int biorq, int aux_rom_cs, int cas1, int cas2);
41};
42
43
44// device type definition
45extern const device_type ADAMLINK;
46
47
48
49#endif
trunk/src/mess/includes/adam.h
r18911r18912
77#include "cpu/z80/z80.h"
88#include "cpu/m6800/m6800.h"
99#include "imagedev/cartslot.h"
10#include "machine/adamexp.h"
1011#include "machine/adamnet.h"
1112#include "machine/coleco.h"
1213#include "machine/ram.h"
r18911r18912
2627      : driver_device(mconfig, type, tag),
2728         m_maincpu(*this, Z80_TAG),
2829         m_netcpu(*this, M6801_TAG),
30         m_vdc(*this, TMS9928A_TAG),
31         m_psg(*this, SN76489A_TAG),
2932         m_ram(*this, RAM_TAG),
3033         m_adamnet(*this, ADAMNET_TAG),
34         m_slot1(*this, ADAM_LEFT_EXPANSION_SLOT_TAG),
35         m_slot2(*this, ADAM_CENTER_EXPANSION_SLOT_TAG),
36         m_slot3(*this, ADAM_RIGHT_EXPANSION_SLOT_TAG),
37         m_mioc(0),
38         m_game(0),
39         m_an(0),
3140         m_dma(1),
3241         m_bwr(1)
3342   { }
3443
3544   required_device<cpu_device> m_maincpu;
3645   required_device<cpu_device> m_netcpu;
46   required_device<tms9928a_device> m_vdc;
47   required_device<sn76489a_device> m_psg;
3748   required_device<ram_device> m_ram;
3849   required_device<adamnet_device> m_adamnet;
50   required_device<adam_expansion_slot_device> m_slot1;
51   required_device<adam_expansion_slot_device> m_slot2;
52   required_device<adam_expansion_slot_device> m_slot3;
3953
4054   virtual void machine_start();
4155   virtual void machine_reset();
4256
43   void bankswitch();
57   DECLARE_READ8_MEMBER( mreq_r );
58   DECLARE_WRITE8_MEMBER( mreq_w );
59   DECLARE_READ8_MEMBER( iorq_r );
60   DECLARE_WRITE8_MEMBER( iorq_w );
4461
45   DECLARE_WRITE_LINE_MEMBER( os3_w );
46
4762   DECLARE_READ8_MEMBER( adamnet_r );
4863   DECLARE_WRITE8_MEMBER( adamnet_w );
4964   DECLARE_READ8_MEMBER( mioc_r );
r18911r18912
6277
6378   DECLARE_WRITE_LINE_MEMBER( vdc_int_w );
6479
80   DECLARE_WRITE_LINE_MEMBER( os3_w );
81
6582   // memory state
83   const UINT8 *m_wp_rom;
84   const UINT8 *m_os7_rom;
85   const UINT8 *m_cart_rom;
6686   UINT8 m_mioc;
6787   int m_game;
6888
trunk/src/mess/drivers/adam.c
r18911r18912
287287
288288    TODO:
289289
290   - fix MC6801 serial I/O
291   - sort out WP ROM select
290292    - floppy
291    - slot interface
292293    - printer
293294    - SPI
294295    - sound (PSG RDY -> Z80 WAIT)
r18911r18912
341342//**************************************************************************
342343
343344//-------------------------------------------------
344//  bankswitch -
345//  mreq_r - memory request read
345346//-------------------------------------------------
346347
347void adam_state::bankswitch()
348READ8_MEMBER( adam_state::mreq_r )
348349{
349   address_space &program = m_maincpu->space(AS_PROGRAM);
350   UINT8 *ram = m_ram->pointer();
350   int bmreq = 0, biorq = 1, boot_rom_cs = 1, aux_decode_1 = 1, aux_rom_cs = 1, cas1 = 1, cas2 = 1;
351351
352   switch (m_mioc & 0x03)
352   UINT8 data = 0;
353
354   if (offset < 0x8000)
353355   {
354   case LO_SMARTWRITER:
355      if (BIT(m_an, 1))
356      switch (m_mioc & 0x03)
356357      {
357         program.unmap_readwrite(0x0000, 0x5fff);
358         program.install_rom(0x6000, 0x7fff, memregion("wp")->base() + 0x8000);
358      case LO_SMARTWRITER:
359         boot_rom_cs = 0;
360
361         if (BIT(m_an, 1))
362         {
363            if (offset >= 0x6000)
364            {
365               data = m_wp_rom[0x8000 + (offset & 0x1fff)];
366            }
367         }
368         else
369         {
370            data = m_wp_rom[offset];
371         }
372         break;
373
374      case LO_INTERNAL_RAM:
375         cas1 = 0;
376         break;
377
378      case LO_RAM_EXPANSION:
379         cas2 = 0;
380         break;
381
382      case LO_OS7_ROM_INTERNAL_RAM:
383         if (offset < 0x2000)
384         {
385            aux_decode_1 = 0;
386         }
387         else
388         {
389            cas1 = 0;
390         }
391         break;
359392      }
360      else
393   }
394   else
395   {
396      switch ((m_mioc >> 2) & 0x03)
361397      {
362         program.install_rom(0x0000, 0x7fff, memregion("wp")->base());
398      case HI_INTERNAL_RAM:
399         cas1 = 0;
400         break;
401
402      case HI_ROM_EXPANSION:
403         aux_rom_cs = 0;
404         break;
405
406      case HI_RAM_EXPANSION:
407         if (m_game)
408         {
409            aux_decode_1 = 0;
410         }
411         else
412         {
413            cas2 = 0;
414         }
415         break;
416
417      case HI_CARTRIDGE_ROM:
418         aux_decode_1 = 0;
419         break;
363420      }
421   }
422
423   if (!cas1)
424   {
425      data = m_ram->pointer()[offset];
426   }
427
428   if (!boot_rom_cs)
429   {
430      // TODO
431   }
432
433   if (!aux_decode_1)
434   {
435      switch (offset >> 13)
436      {
437      case 0: // U2
438         data = m_os7_rom[offset];
439         break;
440
441      case 1: break;
442      case 2: break;
443
444      case 4: // CS1
445      case 5: // CS2
446      case 6: // CS3
447      case 7: // CS4
448         data = m_cart_rom[offset & 0x7fff];
449         break;
450      }
451   }
452
453   data = m_slot1->bd_r(space, offset & 0xff, data, 1, biorq, 1, 1, 1);
454   data = m_slot2->bd_r(space, offset, data, bmreq, biorq, aux_rom_cs, 1, cas2);
455   data = m_slot3->bd_r(space, offset, data, 1, 1, 1, cas1, cas2);
456
457   return data;
458}
459
460
461//-------------------------------------------------
462// mreq_w - memory request write
463//-------------------------------------------------
464
465WRITE8_MEMBER( adam_state::mreq_w )
466{
467   int bmreq = 0, biorq = 1, aux_rom_cs = 1, cas1 = 1, cas2 = 1;
468
469   if (offset < 0x8000)
470   {
471      switch (m_mioc & 0x03)
472      {
473      case LO_INTERNAL_RAM:
474         cas1 = 0;
475         break;
476
477      case LO_RAM_EXPANSION:
478         cas2 = 0;
479         break;
480
481      case LO_OS7_ROM_INTERNAL_RAM:
482         if (offset >= 0x2000)
483         {
484            cas1 = 0;
485         }
486         break;
487      }
488   }
489   else
490   {
491      switch ((m_mioc >> 2) & 0x03)
492      {
493      case HI_INTERNAL_RAM:
494         cas1 = 0;
495         break;
496
497      case HI_RAM_EXPANSION:
498         if (!m_game)
499         {
500            cas2 = 0;
501         }
502         break;
503      }
504   }
505
506   if (!cas1)
507   {
508      m_ram->pointer()[offset] = data;
509   }
510
511   m_slot1->bd_w(space, offset & 0xff, data, 1, biorq, 1, 1, 1);
512   m_slot2->bd_w(space, offset, data, bmreq, biorq, aux_rom_cs, 1, cas2);
513   m_slot3->bd_w(space, offset, data, 1, 1, 1, cas1, cas2);
514}
515
516
517//-------------------------------------------------
518//  iorq_r - I/O request read
519//-------------------------------------------------
520
521READ8_MEMBER( adam_state::iorq_r )
522{
523   int bmreq = 1, biorq = 0, aux_rom_cs = 1, cas1 = 1, cas2 = 1;
524
525   UINT8 data = 0;
526
527   switch ((offset >> 5) & 0x07)
528   {
529   case 1:
530      data = adamnet_r(space, 0);
364531      break;
365532
366   case LO_INTERNAL_RAM:
367      program.install_ram(0x0000, 0x7fff, ram);
533   case 3:
534      data = mioc_r(space, 0);
368535      break;
369536
370   case LO_RAM_EXPANSION:
371      if (m_ram->size() > 64 * 1024)
372         program.install_ram(0x0000, 0x7fff, ram + 0x10000);
537   case 5:
538      if (BIT(offset, 0))
539      {
540         data = m_vdc->register_read(space, 0);
541      }
373542      else
374         program.unmap_readwrite(0x0000, 0x7fff);
543      {
544         data = m_vdc->vram_read(space, 0);
545      }
375546      break;
376547
377   case LO_OS7_ROM_INTERNAL_RAM:
378      program.install_rom(0x0000, 0x1fff, memregion("os7")->base());
379      program.install_ram(0x2000, 0x7fff, ram + 0x2000);
548   case 7:
549      if (BIT(offset, 1))
550      {
551         data = input2_r(space, 0);
552      }
553      else
554      {
555         data = input1_r(space, 0);
556      }
380557      break;
381558   }
382559
383   switch ((m_mioc >> 2) & 0x03)
560   data = m_slot1->bd_r(space, offset & 0xff, data, 1, biorq, 1, 1, 1);
561   data = m_slot2->bd_r(space, offset, data, bmreq, biorq, aux_rom_cs, 1, cas2);
562   data = m_slot3->bd_r(space, offset, data, 1, 1, 1, cas1, cas2);
563
564   return data;
565}
566
567
568//-------------------------------------------------
569//  iorq_w - I/O request write
570//-------------------------------------------------
571
572WRITE8_MEMBER( adam_state::iorq_w )
573{
574   int bmreq = 1, biorq = 0, aux_rom_cs = 1, cas1 = 1, cas2 = 1;
575
576   switch ((offset >> 5) & 0x07)
384577   {
385   case HI_INTERNAL_RAM:
386      program.install_ram(0x8000, 0xffff, ram + 0x8000);
578   case 1:
579      adamnet_w(space, 0, data);
387580      break;
388581
389   case HI_ROM_EXPANSION:
390      program.install_rom(0x8000, 0xffff, memregion("xrom")->base());
582   case 3:
583      mioc_w(space, 0, data);
391584      break;
392585
393   case HI_RAM_EXPANSION:
394      if (m_game)
586   case 4:
587      paddle_w(space, 0, data);
588      break;
589
590   case 5:
591      if (BIT(offset, 0))
395592      {
396         program.install_rom(0x8000, 0xffff, memregion("cart")->base());
593         m_vdc->register_write(space, 0, data);
397594      }
398595      else
399596      {
400         if (m_ram->size() > 64 * 1024)
401            program.install_ram(0x8000, 0xffff, ram + 0x18000);
402         else
403            program.unmap_readwrite(0x8000, 0xffff);
597         m_vdc->vram_write(space, 0, data);
404598      }
405599      break;
406600
407   case HI_CARTRIDGE_ROM:
408      program.install_rom(0x8000, 0xffff, memregion("cart")->base());
601   case 6:
602      joystick_w(space, 0, data);
409603      break;
604
605   case 7:
606      m_psg->write(space, 0, data);
607      break;
410608   }
609
610   m_slot1->bd_w(space, offset & 0xff, data, 1, biorq, 1, 1, 1);
611   m_slot2->bd_w(space, offset, data, bmreq, biorq, aux_rom_cs, 1, cas2);
612   m_slot3->bd_w(space, offset, data, 1, 1, 1, cas1, cas2);
411613}
412614
413615
r18911r18912
443645   */
444646
445647   m_mioc = data;
446
447   bankswitch();
448648}
449649
450650
r18911r18912
492692   }
493693
494694   m_an = data;
495
496   bankswitch();
497695}
498696
499697
r18911r18912
720918//-------------------------------------------------
721919
722920static ADDRESS_MAP_START( adam_mem, AS_PROGRAM, 8, adam_state )
921   AM_RANGE(0x0000, 0xffff) AM_READWRITE(mreq_r, mreq_w)
723922ADDRESS_MAP_END
724923
725924
r18911r18912
728927//-------------------------------------------------
729928
730929static ADDRESS_MAP_START( adam_io, AS_IO, 8, adam_state )
731   ADDRESS_MAP_GLOBAL_MASK(0xff)
732   AM_RANGE(0x20, 0x20) AM_MIRROR(0x1f) AM_READWRITE(adamnet_r, adamnet_w)
733   AM_RANGE(0x60, 0x60) AM_MIRROR(0x1f) AM_READWRITE(mioc_r, mioc_w)
734   AM_RANGE(0x80, 0x80) AM_MIRROR(0x1f) AM_WRITE(paddle_w)
735   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1e) AM_DEVREADWRITE(TMS9928A_TAG, tms9928a_device, vram_read, vram_write)
736   AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x1e) AM_DEVREADWRITE(TMS9928A_TAG, tms9928a_device, register_read, register_write)
737   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_WRITE(joystick_w)
738   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x1f) AM_DEVWRITE(SN76489A_TAG, sn76489a_device, write)
739   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x1d) AM_READ(input1_r)
740   AM_RANGE(0xe2, 0xe2) AM_MIRROR(0x1d) AM_READ(input2_r)
930   AM_RANGE(0x0000, 0xffff) AM_READWRITE(iorq_r, iorq_w)
741931ADDRESS_MAP_END
742932
743933
r18911r18912
8331023};
8341024
8351025
1026//-------------------------------------------------
1027//  ADAM_EXPANSION_SLOT_INTERFACE( slot1_intf )
1028//-------------------------------------------------
8361029
1030static ADAM_EXPANSION_SLOT_INTERFACE( slot1_intf )
1031{
1032   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0)
1033};
1034
1035
1036//-------------------------------------------------
1037//  ADAM_EXPANSION_SLOT_INTERFACE( slot2_intf )
1038//-------------------------------------------------
1039
1040static ADAM_EXPANSION_SLOT_INTERFACE( slot2_intf )
1041{
1042   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0)
1043};
1044
1045
1046//-------------------------------------------------
1047//  ADAM_EXPANSION_SLOT_INTERFACE( slot3_intf )
1048//-------------------------------------------------
1049
1050static ADAM_EXPANSION_SLOT_INTERFACE( slot3_intf )
1051{
1052   DEVCB_NULL // slot 3 has no INT line
1053};
1054
1055
1056
8371057//**************************************************************************
8381058//  MACHINE INITIALIZATION
8391059//**************************************************************************
r18911r18912
8441064
8451065void adam_state::machine_start()
8461066{
1067   // find memory regions
1068   m_wp_rom = memregion("wp")->base();
1069   m_os7_rom = memregion("os7")->base();
1070   m_cart_rom = memregion("cart")->base();
1071
8471072   // state saving
8481073   save_item(NAME(m_mioc));
8491074   save_item(NAME(m_game));
r18911r18912
8831108
8841109   m_an = 0;
8851110
886   bankswitch();
887
8881111   m_maincpu->reset();
8891112   m_netcpu->reset();
8901113}
r18911r18912
9231146   MCFG_SOUND_CONFIG(psg_intf)
9241147
9251148   // devices
926   MCFG_ADAMNET_BUS_ADD()
927   MCFG_ADAMNET_SLOT_ADD("an1", adamnet_devices, "kb", NULL)
928   MCFG_ADAMNET_SLOT_ADD("an2", adamnet_devices, "prn", NULL)
929   MCFG_ADAMNET_SLOT_ADD("an3", adamnet_devices, "ddp", NULL)
930   MCFG_ADAMNET_SLOT_ADD("an4", adamnet_devices, "fdc", NULL)
931   MCFG_ADAMNET_SLOT_ADD("an5", adamnet_devices, NULL, NULL)
932   MCFG_ADAMNET_SLOT_ADD("an6", adamnet_devices, NULL, NULL)
933   MCFG_ADAMNET_SLOT_ADD("an7", adamnet_devices, NULL, NULL)
934   MCFG_ADAMNET_SLOT_ADD("an8", adamnet_devices, NULL, NULL)
935   MCFG_ADAMNET_SLOT_ADD("an9", adamnet_devices, NULL, NULL)
936   MCFG_ADAMNET_SLOT_ADD("an10", adamnet_devices, NULL, NULL)
937   MCFG_ADAMNET_SLOT_ADD("an11", adamnet_devices, NULL, NULL)
938   MCFG_ADAMNET_SLOT_ADD("an12", adamnet_devices, NULL, NULL)
939   MCFG_ADAMNET_SLOT_ADD("an13", adamnet_devices, NULL, NULL)
940   MCFG_ADAMNET_SLOT_ADD("an14", adamnet_devices, NULL, NULL)
941   MCFG_ADAMNET_SLOT_ADD("an15", adamnet_devices, NULL, NULL)
942   
9431149   MCFG_TIMER_DRIVER_ADD_PERIODIC("paddles", adam_state, paddle_tick, attotime::from_msec(20))
9441150
945   // cartridge
1151   MCFG_ADAMNET_BUS_ADD()
1152   MCFG_ADAMNET_SLOT_ADD("net1", adamnet_devices, "kb", NULL)
1153   MCFG_ADAMNET_SLOT_ADD("net2", adamnet_devices, "prn", NULL)
1154   MCFG_ADAMNET_SLOT_ADD("net3", adamnet_devices, "ddp", NULL)
1155   MCFG_ADAMNET_SLOT_ADD("net4", adamnet_devices, "fdc", NULL)
1156   MCFG_ADAMNET_SLOT_ADD("net5", adamnet_devices, NULL, NULL)
1157   MCFG_ADAMNET_SLOT_ADD("net6", adamnet_devices, NULL, NULL)
1158   MCFG_ADAMNET_SLOT_ADD("net7", adamnet_devices, NULL, NULL)
1159   MCFG_ADAMNET_SLOT_ADD("net8", adamnet_devices, NULL, NULL)
1160   MCFG_ADAMNET_SLOT_ADD("net9", adamnet_devices, NULL, NULL)
1161   MCFG_ADAMNET_SLOT_ADD("net10", adamnet_devices, NULL, NULL)
1162   MCFG_ADAMNET_SLOT_ADD("net11", adamnet_devices, NULL, NULL)
1163   MCFG_ADAMNET_SLOT_ADD("net12", adamnet_devices, NULL, NULL)
1164   MCFG_ADAMNET_SLOT_ADD("net13", adamnet_devices, NULL, NULL)
1165   MCFG_ADAMNET_SLOT_ADD("net14", adamnet_devices, NULL, NULL)
1166   MCFG_ADAMNET_SLOT_ADD("net15", adamnet_devices, NULL, NULL)
1167
9461168   MCFG_CARTSLOT_ADD("cart")
9471169   MCFG_CARTSLOT_EXTENSION_LIST("rom,col,bin")
9481170   MCFG_CARTSLOT_NOT_MANDATORY
9491171   MCFG_CARTSLOT_INTERFACE("coleco_cart")
9501172
951   // ROM expansion
952   MCFG_CARTSLOT_ADD("xrom")
953   MCFG_CARTSLOT_EXTENSION_LIST("rom,bin")
954   MCFG_CARTSLOT_NOT_MANDATORY
955   MCFG_CARTSLOT_INTERFACE("adam_xrom")
956
1173   MCFG_ADAM_EXPANSION_SLOT_ADD(ADAM_LEFT_EXPANSION_SLOT_TAG, XTAL_7_15909MHz/2, slot1_intf, adam_slot1_devices, "adamlink", NULL)
1174   MCFG_ADAM_EXPANSION_SLOT_ADD(ADAM_CENTER_EXPANSION_SLOT_TAG, XTAL_7_15909MHz/2, slot2_intf, adam_slot2_devices, NULL, NULL)
1175   MCFG_ADAM_EXPANSION_SLOT_ADD(ADAM_RIGHT_EXPANSION_SLOT_TAG, XTAL_7_15909MHz/2, slot3_intf, adam_slot3_devices, "ram", NULL)
1176   
9571177   // internal ram
9581178   MCFG_RAM_ADD(RAM_TAG)
9591179   MCFG_RAM_DEFAULT_SIZE("64K")
960   MCFG_RAM_EXTRA_OPTIONS("128K")
9611180
9621181   // software lists
9631182   MCFG_SOFTWARE_LIST_ADD("colec_cart_list", "coleco")
r18911r18912
9921211   ROM_REGION( 0x800, M6801_TAG, 0 )
9931212   ROM_LOAD( "master rev a 174b.u6", 0x000, 0x800, CRC(035a7a3d) SHA1(0426e6eaf18c2be9fe08066570c214ab5951ee14) )
9941213
995   ROM_REGION( 0x8000, "xrom", ROMREGION_ERASE00 )
996   ROM_CART_LOAD( "xrom", 0x0000, 0x8000, ROM_NOMIRROR | ROM_OPTIONAL )
997
9981214   ROM_REGION( 0x8000, "cart", 0 )
9991215   ROM_CART_LOAD( "cart", 0x0000, 0x8000, ROM_NOMIRROR | ROM_OPTIONAL )
10001216ROM_END
trunk/src/mess/mess.mak
r18911r18912
970970   $(MESS_DRIVERS)/coleco.o   \
971971   $(MESS_MACHINE)/coleco.o   \
972972   $(MESS_DRIVERS)/adam.o      \
973   $(MESS_MACHINE)/adamexp.o   \
974   $(MESS_MACHINE)/adamlink.o   \
975   $(MESS_MACHINE)/adam_ram.o   \
973976   $(MESS_MACHINE)/adamnet.o   \
974977   $(MESS_MACHINE)/adam_ddp.o   \
975978   $(MESS_MACHINE)/adam_fdc.o   \

Previous 199869 Revisions Next


© 1997-2024 The MAME Team