Previous 199869 Revisions Next

r26887 Thursday 2nd January, 2014 at 05:41:38 UTC by R. Belmont
missed files (nw)
[src/mess/machine]cuda.c cuda.h egret.c egret.h

trunk/src/mess/machine/egret.c
r26886r26887
3838#include "emu.h"
3939#include "egret.h"
4040#include "cpu/m6805/m6805.h"
41#include "machine/6522via.h"
4241#include "sound/asc.h"
4342#include "includes/mac.h"
4443
r26886r26887
131130            adb_in = (data & 0x80) ? true : false;
132131
133132            m_adb_dtime = (int)(machine().time().as_ticks(1000000) - last_adb_time);
134            m_out_adb_func(((data & 0x80) >> 7) ^ 1);
133            write_linechange(((data & 0x80) >> 7) ^ 1);
135134
136135            last_adb = data & 0x80;
137136            last_adb_time = machine().time().as_ticks(1000000);
r26886r26887
153152               printf("EG-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, m_maincpu->pc());
154153               #endif
155154               via_data = (data>>5) & 1;
156               via6522_device *via1 = machine().device<via6522_device>("via6522_0");
157               via1->write_cb2(via_data);
155               write_via_data(via_data);
158156            }
159157            if (via_clock != ((data>>4)&1))
160158            {
r26886r26887
162160               printf("EG-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, m_maincpu->pc());
163161               #endif
164162               via_clock = (data>>4) & 1;
165               via6522_device *via1 = machine().device<via6522_device>("via6522_0");
166               via1->write_cb1(via_clock^1);
163               write_via_clock(via_clock^1);
167164            }
168165         }
169166         break;
r26886r26887
187184               }
188185            }
189186
190            m_out_reset_func((reset_line & 8) ? ASSERT_LINE : CLEAR_LINE);
187            write_reset((reset_line & 8) ? ASSERT_LINE : CLEAR_LINE);
191188         }
192189         break;
193190   }
r26886r26887
337334egret_device::egret_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
338335   : device_t(mconfig, EGRET, "Apple Egret", tag, owner, clock, "egret", __FILE__),
339336   device_nvram_interface(mconfig, *this),
337   write_reset(*this),
338   write_linechange(*this),
339   write_via_clock(*this),
340   write_via_data(*this),
340341   m_maincpu(*this, EGRET_CPU_TAG)
341342{
342343}
r26886r26887
352353   egret.rom_offset = type;
353354}
354355
355void egret_device::device_config_complete()
356{
357   // inherit a copy of the static data
358   const egret_interface *intf = reinterpret_cast<const egret_interface *>(static_config());
359   if (intf != NULL)
360   {
361      *static_cast<egret_interface *>(this) = *intf;
362   }
363   // or initialize to defaults if none provided
364   else
365   {
366      memset(&m_out_reset_cb, 0, sizeof(m_out_reset_cb));
367      memset(&m_out_adb_cb, 0, sizeof(m_out_adb_cb));
368   }
369}
370
371356//-------------------------------------------------
372357//  device_start - device-specific startup
373358//-------------------------------------------------
374359
375360void egret_device::device_start()
376361{
377   m_out_reset_func.resolve(m_out_reset_cb, *this);
378   m_out_adb_func.resolve(m_out_adb_cb, *this);
362   write_reset.resolve_safe();
363   write_linechange.resolve_safe();
364   write_via_clock.resolve_safe();
365   write_via_data.resolve_safe();
379366
380367   m_timer = timer_alloc(0, NULL);
381368   save_item(NAME(ddrs[0]));
trunk/src/mess/machine/egret.h
r26886r26887
2121//  INTERFACE CONFIGURATION MACROS
2222//**************************************************************************
2323
24#define MCFG_EGRET_ADD(_type, _config) \
24#define MCFG_EGRET_ADD(_type) \
2525   MCFG_DEVICE_ADD(EGRET_TAG, EGRET, 0) \
26   MCFG_DEVICE_CONFIG(_config) \
2726   MCFG_EGRET_TYPE(_type)
2827
29#define MCFG_EGRET_REPLACE(_type, _config) \
28#define MCFG_EGRET_REPLACE(_type) \
3029   MCFG_DEVICE_REPLACE(EGRET_TAG, EGRET, 0) \
31   MCFG_DEVICE_CONFIG(_config) \
3230   MCFG_EGRET_TYPE(_type)
3331
3432#define MCFG_EGRET_TYPE(_type) \
r26886r26887
3735#define MCFG_EGRET_REMOVE() \
3836   MCFG_DEVICE_REMOVE(EGRET_TAG)
3937
38#define MCFG_EGRET_RESET_CALLBACK(_cb) \
39   downcast<egret_device *>(device)->set_reset_cb(DEVCB2_##_cb);
40
41#define MCFG_EGRET_LINECHANGE_CALLBACK(_cb) \
42   downcast<egret_device *>(device)->set_linechange_cb(DEVCB2_##_cb);
43
44#define MCFG_EGRET_VIA_CLOCK_CALLBACK(_cb) \
45   downcast<egret_device *>(device)->set_via_clock_cb(DEVCB2_##_cb);
46
47#define MCFG_EGRET_VIA_DATA_CALLBACK(_cb) \
48   downcast<egret_device *>(device)->set_via_data_cb(DEVCB2_##_cb);
49
4050//**************************************************************************
4151//  TYPE DEFINITIONS
4252//**************************************************************************
4353
44struct egret_interface
45{
46   devcb_write_line    m_out_reset_cb;
47   devcb_write_line    m_out_adb_cb;
48};
49
5054// ======================> egret_device
5155
52class egret_device :  public device_t, public device_nvram_interface, public egret_interface
56class egret_device :  public device_t, public device_nvram_interface
5357{
5458public:
5559   // construction/destruction
r26886r26887
9094
9195   int rom_offset;
9296
97   template<class _write> void set_reset_cb(_write wr) { write_reset.set_callback(wr); }
98   template<class _write> void set_linechange_cb(_write wr) { write_linechange.set_callback(wr); }
99   template<class _write> void set_via_clock_cb(_write wr) { write_via_clock.set_callback(wr); }
100   template<class _write> void set_via_data_cb(_write wr) { write_via_data.set_callback(wr); }
101
102   devcb2_write_line write_reset, write_linechange, write_via_clock, write_via_data;
103
93104protected:
94105   // device-level overrides
95106   virtual void device_start();
96107   virtual void device_reset();
97   virtual void device_config_complete();
98108   virtual machine_config_constructor device_mconfig_additions() const;
99109   virtual const rom_entry *device_rom_region() const;
100110
r26886r26887
120130   bool pram_loaded;
121131
122132   void send_port(address_space &space, UINT8 offset, UINT8 data);
123
124   devcb_resolved_write_line   m_out_reset_func;
125   devcb_resolved_write_line   m_out_adb_func;
126133};
127134
128135// device type definition
trunk/src/mess/machine/cuda.c
r26886r26887
3939#include "emu.h"
4040#include "cuda.h"
4141#include "cpu/m6805/m6805.h"
42#include "machine/6522via.h"
4342#include "sound/asc.h"
4443#include "includes/mac.h"
4544
r26886r26887
130129                    printf("CU ADB: 0->1 time %lld\n", machine().time().as_ticks(1000000) - last_adb_time);
131130                }*/
132131
132            // allow the linechange handler to override us
133133            adb_in = (data & 0x80) ? true : false;
134134
135135            m_adb_dtime = (int)(machine().time().as_ticks(1000000) - last_adb_time);
136            m_out_adb_func(((data & 0x80) >> 7) ^ 1);
136            write_linechange(((data & 0x80) >> 7) ^ 1);
137137
138138            last_adb = data & 0x80;
139139            last_adb_time = machine().time().as_ticks(1000000);
r26886r26887
155155               printf("CU-> VIA_DATA: %d (PC=%x)\n", (data>>5)&1, m_maincpu->pc());
156156               #endif
157157               via_data = (data>>5) & 1;
158               via6522_device *via1 = machine().device<via6522_device>("via6522_0");
159               via1->write_cb2(via_data);
158               write_via_data(via_data);
160159            }
161160            if (via_clock != ((data>>4)&1))
162161            {
r26886r26887
164163               printf("CU-> VIA_CLOCK: %d (PC=%x)\n", ((data>>4)&1)^1, m_maincpu->pc());
165164               #endif
166165               via_clock = (data>>4) & 1;
167               via6522_device *via1 = machine().device<via6522_device>("via6522_0");
168               via1->write_cb1(via_clock);
166               write_via_clock(via_clock);
169167            }
170168         }
171169         break;
r26886r26887
180178            // falling edge, should reset the machine too
181179            if ((ports[2] & 8) && !(data&8))
182180            {
183               m_out_reset_func(ASSERT_LINE);
184               m_out_reset_func(CLEAR_LINE);
181               write_reset(ASSERT_LINE);
182               write_reset(CLEAR_LINE);
185183
186184               // if PRAM's waiting to be loaded, transfer it now
187185               if (!pram_loaded)
r26886r26887
385383cuda_device::cuda_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
386384   : device_t(mconfig, CUDA, "Apple Cuda", tag, owner, clock, "cuda", __FILE__),
387385   device_nvram_interface(mconfig, *this),
386   write_reset(*this),
387   write_linechange(*this),
388   write_via_clock(*this),
389   write_via_data(*this),
388390   m_maincpu(*this, CUDA_CPU_TAG)
389391{
390392}
r26886r26887
406408
407409void cuda_device::device_start()
408410{
409   m_out_reset_func.resolve(m_out_reset_cb, *this);
410   m_out_adb_func.resolve(m_out_adb_cb, *this);
411   write_reset.resolve_safe();
412   write_linechange.resolve_safe();
413   write_via_clock.resolve_safe();
414   write_via_data.resolve_safe();
411415
412416   m_timer = timer_alloc(0, NULL);
413417   m_prog_timer = timer_alloc(1, NULL);
r26886r26887
507511   }
508512}
509513
510void cuda_device::device_config_complete()
511{
512   // inherit a copy of the static data
513   const cuda_interface *intf = reinterpret_cast<const cuda_interface *>(static_config());
514   if (intf != NULL)
515   {
516      *static_cast<cuda_interface *>(this) = *intf;
517   }
518   // or initialize to defaults if none provided
519   else
520   {
521      memset(&m_out_reset_cb, 0, sizeof(m_out_reset_cb));
522   }
523}
524
525514// the 6805 program clears PRAM on startup (on h/w it's always running once a battery is inserted)
526515// we deal with that by loading pram from disk to a secondary buffer and then slapping it into "live"
527516// once the cuda reboots the 68k
trunk/src/mess/machine/cuda.h
r26886r26887
1919//  INTERFACE CONFIGURATION MACROS
2020//**************************************************************************
2121
22#define MCFG_CUDA_ADD(_type, _config) \
22#define MCFG_CUDA_ADD(_type) \
2323   MCFG_DEVICE_ADD(CUDA_TAG, CUDA, 0) \
24   MCFG_DEVICE_CONFIG(_config) \
2524   MCFG_CUDA_TYPE(_type)
2625
27#define MCFG_CUDA_REPLACE(_type, _config) \
26#define MCFG_CUDA_REPLACE(_type) \
2827   MCFG_DEVICE_REPLACE(CUDA_TAG, CUDA, 0) \
29   MCFG_DEVICE_CONFIG(_config) \
3028   MCFG_CUDA_TYPE(_type)
3129
3230#define MCFG_CUDA_REMOVE() \
r26886r26887
3836#define MCFG_CUDA_REMOVE() \
3937   MCFG_DEVICE_REMOVE(CUDA_TAG)
4038
39#define MCFG_CUDA_RESET_CALLBACK(_cb) \
40   downcast<cuda_device *>(device)->set_reset_cb(DEVCB2_##_cb);
41
42#define MCFG_CUDA_LINECHANGE_CALLBACK(_cb) \
43   downcast<cuda_device *>(device)->set_linechange_cb(DEVCB2_##_cb);
44
45#define MCFG_CUDA_VIA_CLOCK_CALLBACK(_cb) \
46   downcast<cuda_device *>(device)->set_via_clock_cb(DEVCB2_##_cb);
47
48#define MCFG_CUDA_VIA_DATA_CALLBACK(_cb) \
49   downcast<cuda_device *>(device)->set_via_data_cb(DEVCB2_##_cb);
50
4151//**************************************************************************
4252//  TYPE DEFINITIONS
4353//**************************************************************************
4454
45struct cuda_interface
46{
47   devcb_write_line    m_out_reset_cb;
48   devcb_write_line    m_out_adb_cb;
49};
50
5155// ======================> cuda_device
5256
53class cuda_device :  public device_t, public device_nvram_interface, public cuda_interface
57class cuda_device :  public device_t, public device_nvram_interface
5458{
5559public:
5660   // construction/destruction
r26886r26887
9195
9296   int rom_offset;
9397
98   template<class _write> void set_reset_cb(_write wr) { write_reset.set_callback(wr); }
99   template<class _write> void set_linechange_cb(_write wr) { write_linechange.set_callback(wr); }
100   template<class _write> void set_via_clock_cb(_write wr) { write_via_clock.set_callback(wr); }
101   template<class _write> void set_via_data_cb(_write wr) { write_via_data.set_callback(wr); }
102
103   devcb2_write_line write_reset, write_linechange, write_via_clock, write_via_data;
104
94105protected:
95106   // device-level overrides
96107   virtual void device_start();
97108   virtual void device_reset();
98   virtual void device_config_complete();
99109   virtual machine_config_constructor device_mconfig_additions() const;
100110   virtual const rom_entry *device_rom_region() const;
101111
r26886r26887
121131   bool pram_loaded;
122132
123133   void send_port(address_space &space, UINT8 offset, UINT8 data);
124
125   devcb_resolved_write_line   m_out_reset_func;
126   devcb_resolved_write_line   m_out_adb_func;
127134};
128135
129136// device type definition

Previous 199869 Revisions Next


© 1997-2024 The MAME Team