Previous 199869 Revisions Next

r23576 Sunday 9th June, 2013 at 20:49:03 UTC by Curt Coder
(MESS) devcb2. (nw)
[src/emu/sound]cdp1864.c cdp1864.h
[src/emu/video]cdp1861.c cdp1861.h cdp1862.c cdp1862.h
[src/mess/drivers]cosmicos.c elf.c eti660.c pc1512.c studio2.c tandy2k.c tmc2000e.c trs80m2.c vip.c
[src/mess/machine]pc1512kb.c pc1512kb.h tandy2kb.c tandy2kb.h trs80m2kb.c trs80m2kb.h v1050kb.c v1050kb.h vip_byteio.c vip_byteio.h vip_exp.c vip_exp.h vp575.c vp590.c
[src/mess/video]tmc1800.c

trunk/src/emu/video/cdp1862.c
r23575r23576
77
88**********************************************************************/
99
10/*
10#include "cdp1862.h"
1111
12    TODO:
1312
14    - calculate colors from luminance/chrominance resistors
1513
16*/
14//**************************************************************************
15//  MACROS / CONSTANTS
16//**************************************************************************
1717
18#include "emu.h"
19#include "cdp1862.h"
18static const int CDP1862_BACKGROUND_COLOR_SEQUENCE[] = { 2, 0, 1, 4 };
2019
2120
22// device type definition
23const device_type CDP1862 = &device_creator<cdp1862_device>;
2421
25
2622//**************************************************************************
27//  MACROS / CONSTANTS
23//  DEVICE DEFINITIONS
2824//**************************************************************************
2925
30static const int CDP1862_BACKGROUND_COLOR_SEQUENCE[] = { 2, 0, 1, 4 };
26// device type definition
27const device_type CDP1862 = &device_creator<cdp1862_device>;
3128
3229
3330
r23575r23576
8077//-------------------------------------------------
8178
8279cdp1862_device::cdp1862_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
83   : device_t(mconfig, CDP1862, "CDP1862", tag, owner, clock)
80   : device_t(mconfig, CDP1862, "CDP1862", tag, owner, clock),
81     m_read_rd(*this),
82     m_read_bd(*this),
83     m_read_gd(*this)
8484{
8585}
8686
8787
8888//-------------------------------------------------
89//  device_config_complete - perform any
90//  operations now that the configuration is
91//  complete
92//-------------------------------------------------
93
94void cdp1862_device::device_config_complete()
95{
96   // inherit a copy of the static data
97   const cdp1862_interface *intf = reinterpret_cast<const cdp1862_interface *>(static_config());
98   if (intf != NULL)
99      *static_cast<cdp1862_interface *>(this) = *intf;
100
101   // or initialize to defaults if none provided
102   else
103   {
104      memset(&m_in_rd_cb, 0, sizeof(m_in_rd_cb));
105      memset(&m_in_bd_cb, 0, sizeof(m_in_bd_cb));
106      memset(&m_in_gd_cb, 0, sizeof(m_in_gd_cb));
107   }
108}
109
110
111//-------------------------------------------------
11289//  device_start - device-specific startup
11390//-------------------------------------------------
11491
11592void cdp1862_device::device_start()
11693{
11794   // resolve callbacks
118   m_in_rd_func.resolve(m_in_rd_cb, *this);
119   m_in_bd_func.resolve(m_in_bd_cb, *this);
120   m_in_gd_func.resolve(m_in_gd_cb, *this);
95   m_read_rd.resolve_safe(0);
96   m_read_bd.resolve_safe(0);
97   m_read_gd.resolve_safe(0);
12198
12299   // find devices
123   m_screen = machine().device<screen_device>(m_screen_tag);
100   m_screen = machine().device<screen_device>(m_screen_tag);
124101   m_screen->register_screen_bitmap(m_bitmap);
125102
126103   // init palette
r23575r23576
156133
157134   if (!m_con)
158135   {
159      rd = m_in_rd_func();
160      bd = m_in_bd_func();
161      gd = m_in_gd_func();
136      rd = m_read_rd();
137      bd = m_read_bd();
138      gd = m_read_gd();
162139   }
163140
164141   for (x = 0; x < 8; x++)
trunk/src/emu/video/cdp1862.h
r23575r23576
4343//  INTERFACE CONFIGURATION MACROS
4444//**************************************************************************
4545
46#define MCFG_CDP1862_ADD(_tag, _clock, _config) \
46#define MCFG_CDP1862_ADD(_tag, _screen_tag, _clock, _rd, _bd, _gd) \
4747   MCFG_DEVICE_ADD(_tag, CDP1862, _clock) \
48   MCFG_DEVICE_CONFIG(_config)
48   downcast<cdp1862_device *>(device)->set_screen_tag(_screen_tag); \
49   downcast<cdp1862_device *>(device)->set_rd_callback(DEVCB2_##_rd); \
50   downcast<cdp1862_device *>(device)->set_bd_callback(DEVCB2_##_bd); \
51   downcast<cdp1862_device *>(device)->set_gd_callback(DEVCB2_##_gd);
4952
53#define MCFG_CDP1862_LUMINANCE(_r, _b, _g, _bkg) \
54   downcast<cdp1862_device *>(device)->set_luminance_resistors(_r, _b, _g, _bkg);
5055
51#define CDP1862_INTERFACE(name) \
52   const cdp1862_interface (name) =
56#define MCFG_CDP1862_CHROMINANCE(_r, _b, _g, _bkg) \
57   downcast<cdp1862_device *>(device)->set_chrominance_resistors(_r, _b, _g, _bkg);
5358
5459
5560
r23575r23576
5762//  TYPE DEFINITIONS
5863//**************************************************************************
5964
60// ======================> cdp1862_interface
61
62struct cdp1862_interface
63{
64   const char *m_screen_tag;
65
66   devcb_read_line             m_in_rd_cb;
67   devcb_read_line             m_in_bd_cb;
68   devcb_read_line             m_in_gd_cb;
69
70   double m_lum_r;             // red luminance resistor value
71   double m_lum_b;             // blue luminance resistor value
72   double m_lum_g;             // green luminance resistor value
73   double m_lum_bkg;           // background luminance resistor value
74
75   double m_chr_r;             // red chrominance resistor value
76   double m_chr_b;             // blue chrominance resistor value
77   double m_chr_g;             // green chrominance resistor value
78   double m_chr_bkg;           // background chrominance resistor value
79};
80
81
82
8365// ======================> cdp1862_device
8466
85class cdp1862_device :  public device_t,
86                  public cdp1862_interface
67class cdp1862_device :  public device_t
8768{
8869public:
8970   // construction/destruction
9071   cdp1862_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
9172
73   void set_screen_tag(const char *screen_tag) { m_screen_tag = screen_tag; }
74   template<class _rd> void set_rd_callback(_rd rd) { m_read_rd.set_callback(rd); }
75   template<class _bd> void set_bd_callback(_bd bd) { m_read_bd.set_callback(bd); }
76   template<class _gd> void set_gd_callback(_gd gd) { m_read_gd.set_callback(gd); }
77   void set_luminance_resistors(double r, double b, double g, double bkg) { m_lum_r = r; m_lum_b = b; m_lum_g = g; m_lum_bkg = bkg; }
78   void set_chrominance_resistors(double r, double b, double g, double bkg) { m_chr_r = r; m_chr_b = b; m_chr_g = g; m_chr_bkg = bkg; }
79
9280   DECLARE_WRITE8_MEMBER( dma_w );
9381   DECLARE_WRITE_LINE_MEMBER( bkg_w );
9482   DECLARE_WRITE_LINE_MEMBER( con_w );
r23575r23576
9785
9886protected:
9987   // device-level overrides
100   virtual void device_config_complete();
10188   virtual void device_start();
10289   virtual void device_reset();
10390
10491private:
10592   inline void initialize_palette();
10693
107   devcb_resolved_read_line    m_in_rd_func;
108   devcb_resolved_read_line    m_in_bd_func;
109   devcb_resolved_read_line    m_in_gd_func;
94   devcb2_read_line m_read_rd;
95   devcb2_read_line m_read_bd;
96   devcb2_read_line m_read_gd;
11097
98   const char *m_screen_tag;
11199   screen_device *m_screen;        // screen
112100   bitmap_rgb32 m_bitmap;          // bitmap
113101
102   double m_lum_r;             // red luminance resistor value
103   double m_lum_b;             // blue luminance resistor value
104   double m_lum_g;             // green luminance resistor value
105   double m_lum_bkg;           // background luminance resistor value
106
107   double m_chr_r;             // red chrominance resistor value
108   double m_chr_b;             // blue chrominance resistor value
109   double m_chr_g;             // green chrominance resistor value
110   double m_chr_bkg;           // background chrominance resistor value
111
114112   rgb_t m_palette[16];
115113   int m_bgcolor;                  // background color
116114   int m_con;                      // color on
trunk/src/emu/video/cdp1861.c
r23575r23576
2323
2424
2525//**************************************************************************
26//  LIVE DEVICE
26//  DEVICE DEFINITIONS
2727//**************************************************************************
2828
2929// device type definition
3030const device_type CDP1861 = &device_creator<cdp1861_device>;
3131
32//-------------------------------------------------
33//  cdp1861_device - constructor
34//-------------------------------------------------
3532
36cdp1861_device::cdp1861_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
37   : device_t(mconfig, CDP1861, "CDP1861", tag, owner, clock)
38{
39}
4033
34//**************************************************************************
35//  LIVE DEVICE
36//**************************************************************************
4137
4238//-------------------------------------------------
43//  device_config_complete - perform any
44//  operations now that the configuration is
45//  complete
39//  cdp1861_device - constructor
4640//-------------------------------------------------
4741
48void cdp1861_device::device_config_complete()
42cdp1861_device::cdp1861_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
43   : device_t(mconfig, CDP1861, "CDP1861", tag, owner, clock),
44     m_write_irq(*this),
45     m_write_dma_out(*this),
46     m_write_efx(*this)
4947{
50   // inherit a copy of the static data
51   const cdp1861_interface *intf = reinterpret_cast<const cdp1861_interface *>(static_config());
52   if (intf != NULL)
53      *static_cast<cdp1861_interface *>(this) = *intf;
54
55   // or initialize to defaults if none provided
56   else
57   {
58      memset(&m_out_int_cb, 0, sizeof(m_out_int_cb));
59      memset(&m_out_dmao_cb, 0, sizeof(m_out_dmao_cb));
60      memset(&m_out_efx_cb, 0, sizeof(m_out_efx_cb));
61   }
6248}
6349
6450
r23575r23576
6955void cdp1861_device::device_start()
7056{
7157   // resolve callbacks
72   m_out_int_func.resolve(m_out_int_cb, *this);
73   m_out_dmao_func.resolve(m_out_dmao_cb, *this);
74   m_out_efx_func.resolve(m_out_efx_cb, *this);
58   m_write_irq.resolve_safe();
59   m_write_dma_out.resolve_safe();
60   m_write_efx.resolve_safe();
7561
7662   // allocate timers
7763   m_int_timer = timer_alloc(TIMER_INT);
r23575r23576
7965   m_dma_timer = timer_alloc(TIMER_DMA);
8066
8167   // find devices
82   m_cpu = machine().device<cpu_device>(m_cpu_tag);
8368   m_screen =  machine().device<screen_device>(m_screen_tag);
8469   m_screen->register_screen_bitmap(m_bitmap);
8570
r23575r23576
9984{
10085   m_int_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_INT_START, 0));
10186   m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_START, 0));
102   m_dma_timer->adjust(m_cpu->cycles_to_attotime(CDP1861_CYCLES_DMA_START));
87   m_dma_timer->adjust(clocks_to_attotime(CDP1861_CYCLES_DMA_START));
10388
10489   m_disp = 0;
10590   m_dmaout = 0;
10691   m_dispon = 0;
10792
108   m_out_int_func(CLEAR_LINE);
109   m_out_dmao_func(CLEAR_LINE);
110   m_out_efx_func(CLEAR_LINE);
93   m_write_irq(CLEAR_LINE);
94   m_write_dma_out(CLEAR_LINE);
95   m_write_efx(CLEAR_LINE);
11196}
11297
11398
r23575r23576
126111      {
127112         if (m_disp)
128113         {
129            m_out_int_func(ASSERT_LINE);
114            m_write_irq(ASSERT_LINE);
130115         }
131116
132117         m_int_timer->adjust(m_screen->time_until_pos( CDP1861_SCANLINE_INT_END, 0));
r23575r23576
135120      {
136121         if (m_disp)
137122         {
138            m_out_int_func(CLEAR_LINE);
123            m_write_irq(CLEAR_LINE);
139124         }
140125
141126         m_int_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_INT_START, 0));
r23575r23576
146131      switch (scanline)
147132      {
148133      case CDP1861_SCANLINE_EFX_TOP_START:
149         m_out_efx_func(ASSERT_LINE);
134         m_write_efx(ASSERT_LINE);
150135         m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_END, 0));
151136         break;
152137
153138      case CDP1861_SCANLINE_EFX_TOP_END:
154         m_out_efx_func(CLEAR_LINE);
139         m_write_efx(CLEAR_LINE);
155140         m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_BOTTOM_START, 0));
156141         break;
157142
158143      case CDP1861_SCANLINE_EFX_BOTTOM_START:
159         m_out_efx_func(ASSERT_LINE);
144         m_write_efx(ASSERT_LINE);
160145         m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_BOTTOM_END, 0));
161146         break;
162147
163148      case CDP1861_SCANLINE_EFX_BOTTOM_END:
164         m_out_efx_func(CLEAR_LINE);
149         m_write_efx(CLEAR_LINE);
165150         m_efx_timer->adjust(m_screen->time_until_pos(CDP1861_SCANLINE_EFX_TOP_START, 0));
166151         break;
167152      }
r23575r23576
174159         {
175160            if (scanline >= CDP1861_SCANLINE_DISPLAY_START && scanline < CDP1861_SCANLINE_DISPLAY_END)
176161            {
177               m_out_dmao_func(CLEAR_LINE);
162               m_write_dma_out(CLEAR_LINE);
178163            }
179164         }
180165
181         m_dma_timer->adjust(m_cpu->cycles_to_attotime(CDP1861_CYCLES_DMA_WAIT));
166         m_dma_timer->adjust(clocks_to_attotime(CDP1861_CYCLES_DMA_WAIT));
182167
183168         m_dmaout = 0;
184169      }
r23575r23576
188173         {
189174            if (scanline >= CDP1861_SCANLINE_DISPLAY_START && scanline < CDP1861_SCANLINE_DISPLAY_END)
190175            {
191               m_out_dmao_func(ASSERT_LINE);
176               m_write_dma_out(ASSERT_LINE);
192177            }
193178         }
194179
195         m_dma_timer->adjust(m_cpu->cycles_to_attotime(CDP1861_CYCLES_DMA_ACTIVE));
180         m_dma_timer->adjust(clocks_to_attotime(CDP1861_CYCLES_DMA_ACTIVE));
196181
197182         m_dmaout = 1;
198183      }
r23575r23576
242227
243228   m_dispoff = state;
244229
245   m_out_int_func(CLEAR_LINE);
246   m_out_dmao_func(CLEAR_LINE);
230   m_write_irq(CLEAR_LINE);
231   m_write_dma_out(CLEAR_LINE);
247232}
248233
249234
trunk/src/emu/video/cdp1861.h
r23575r23576
6565//  INTERFACE CONFIGURATION MACROS
6666//**************************************************************************
6767
68#define MCFG_CDP1861_ADD(_tag, _clock, _config) \
68#define MCFG_CDP1861_ADD(_tag, _screen_tag, _clock, _irq, _dma_out, _efx) \
6969   MCFG_DEVICE_ADD(_tag, CDP1861, _clock) \
70   MCFG_DEVICE_CONFIG(_config)
70   downcast<cdp1861_device *>(device)->set_screen_tag(_screen_tag); \
71   downcast<cdp1861_device *>(device)->set_irq_callback(DEVCB2_##_irq); \
72   downcast<cdp1861_device *>(device)->set_dma_out_callback(DEVCB2_##_dma_out); \
73   downcast<cdp1861_device *>(device)->set_efx_callback(DEVCB2_##_efx);
7174
72
7375#define MCFG_CDP1861_SCREEN_ADD(_cdptag, _tag, _clock) \
7476   MCFG_SCREEN_ADD(_tag, RASTER) \
7577   MCFG_SCREEN_UPDATE_DEVICE(_cdptag, cdp1861_device, screen_update) \
7678   MCFG_SCREEN_RAW_PARAMS(_clock, CDP1861_SCREEN_WIDTH, CDP1861_HBLANK_END, CDP1861_HBLANK_START, CDP1861_TOTAL_SCANLINES, CDP1861_SCANLINE_VBLANK_END, CDP1861_SCANLINE_VBLANK_START)
7779
7880
79#define CDP1861_INTERFACE(name) \
80   const cdp1861_interface (name) =
8181
82
83
8482//**************************************************************************
8583//  TYPE DEFINITIONS
8684//**************************************************************************
8785
88
89// ======================> cdp1861_interface
90
91struct cdp1861_interface
92{
93   const char *m_cpu_tag;
94   const char *m_screen_tag;
95
96   devcb_write_line        m_out_int_cb;
97   devcb_write_line        m_out_dmao_cb;
98   devcb_write_line        m_out_efx_cb;
99};
100
101
102
10386// ======================> cdp1861_device
10487
105class cdp1861_device :  public device_t,
106                  public cdp1861_interface
88class cdp1861_device :  public device_t
10789{
10890public:
10991   // construction/destruction
11092   cdp1861_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
11193
94   void set_screen_tag(const char *screen_tag) { m_screen_tag = screen_tag; }
95   template<class _irq> void set_irq_callback(_irq irq) { m_write_irq.set_callback(irq); }
96   template<class _dma_out> void set_dma_out_callback(_dma_out dma_out) { m_write_dma_out.set_callback(dma_out); }
97   template<class _efx> void set_efx_callback(_efx efx) { m_write_efx.set_callback(efx); }
98
11299   DECLARE_WRITE8_MEMBER( dma_w );
113100   DECLARE_WRITE_LINE_MEMBER( disp_on_w );
114101   DECLARE_WRITE_LINE_MEMBER( disp_off_w );
r23575r23576
117104
118105protected:
119106   // device-level overrides
120   virtual void device_config_complete();
121107   virtual void device_start();
122108   virtual void device_reset();
123109   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
124110
125111private:
126   static const device_timer_id TIMER_INT = 0;
127   static const device_timer_id TIMER_EFX = 1;
128   static const device_timer_id TIMER_DMA = 2;
112   enum
113   {
114      TIMER_INT,
115      TIMER_EFX,
116      TIMER_DMA
117   };
129118
130   devcb_resolved_write_line   m_out_int_func;
131   devcb_resolved_write_line   m_out_dmao_func;
132   devcb_resolved_write_line   m_out_efx_func;
119   devcb2_write_line m_write_irq;
120   devcb2_write_line m_write_dma_out;
121   devcb2_write_line m_write_efx;
133122
123   const char *m_screen_tag;
134124   screen_device *m_screen;        // screen
135125   bitmap_rgb32 m_bitmap;          // bitmap
136126
r23575r23576
143133   emu_timer *m_int_timer;         // interrupt timer
144134   emu_timer *m_efx_timer;         // EFx timer
145135   emu_timer *m_dma_timer;         // DMA timer
146
147   cpu_device *m_cpu;
148136};
149137
150138
trunk/src/emu/sound/cdp1864.h
r23575r23576
8080//  INTERFACE CONFIGURATION MACROS
8181//**************************************************************************
8282
83#define MCFG_CDP1864_ADD(_tag, _clock, _config) \
83#define MCFG_CDP1864_ADD(_tag, _screen_tag, _clock, _inlace, _irq, _dma_out, _efx, _hsync, _rdata, _bdata, _gdata) \
8484   MCFG_SOUND_ADD(_tag, CDP1864, _clock) \
85   MCFG_DEVICE_CONFIG(_config)
85   downcast<cdp1864_device *>(device)->set_screen_tag(_screen_tag); \
86   downcast<cdp1864_device *>(device)->set_inlace_callback(DEVCB2_##_inlace); \
87   downcast<cdp1864_device *>(device)->set_irq_callback(DEVCB2_##_irq); \
88   downcast<cdp1864_device *>(device)->set_dma_out_callback(DEVCB2_##_dma_out); \
89   downcast<cdp1864_device *>(device)->set_efx_callback(DEVCB2_##_efx); \
90   downcast<cdp1864_device *>(device)->set_hsync_callback(DEVCB2_##_hsync); \
91   downcast<cdp1864_device *>(device)->set_rdata_callback(DEVCB2_##_rdata); \
92   downcast<cdp1864_device *>(device)->set_bdata_callback(DEVCB2_##_bdata); \
93   downcast<cdp1864_device *>(device)->set_gdata_callback(DEVCB2_##_gdata);
8694
95#define MCFG_CDP1864_CHROMINANCE(_r, _b, _g, _bkg) \
96   downcast<cdp1864_device *>(device)->set_chrominance_resistors(_r, _b, _g, _bkg);
8797
8898#define MCFG_CDP1864_SCREEN_ADD(_tag, _clock) \
8999   MCFG_SCREEN_ADD(_tag, RASTER) \
90100   MCFG_SCREEN_RAW_PARAMS(_clock, CDP1864_SCREEN_WIDTH, CDP1864_HBLANK_END, CDP1864_HBLANK_START, CDP1864_TOTAL_SCANLINES, CDP1864_SCANLINE_VBLANK_END, CDP1864_SCANLINE_VBLANK_START)
91101
92102
93#define CDP1864_INTERFACE(name) \
94   const cdp1864_interface (name) =
95103
96
97#define CDP1864_NON_INTERLACED \
98   DEVCB_LINE_VCC
99
100
101#define CDP1864_INTERLACED \
102   DEVCB_LINE_GND
103
104
105
106104//**************************************************************************
107105//  TYPE DEFINITIONS
108106//**************************************************************************
109107
110// ======================> cdp1864_interface
111
112struct cdp1864_interface
113{
114   const char *m_cpu_tag;
115   const char *m_screen_tag;
116
117   devcb_read_line             m_in_inlace_cb;
118
119   devcb_read_line             m_in_rdata_cb;
120   devcb_read_line             m_in_bdata_cb;
121   devcb_read_line             m_in_gdata_cb;
122
123   devcb_write_line            m_out_int_cb;
124   devcb_write_line            m_out_dmao_cb;
125   devcb_write_line            m_out_efx_cb;
126   devcb_write_line            m_out_hsync_cb;
127
128   double m_res_r;             // red output resistor value
129   double m_res_g;             // green output resistor value
130   double m_res_b;             // blue output resistor value
131   double m_res_bkg;           // background output resistor value
132};
133
134
135
136108// ======================> cdp1864_device
137109
138110class cdp1864_device :  public device_t,
139                  public device_sound_interface,
140                  public cdp1864_interface
111                  public device_sound_interface
141112{
142113public:
143114   // construction/destruction
144115   cdp1864_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
145116
117   void set_screen_tag(const char *screen_tag) { m_screen_tag = screen_tag; }
118   template<class _inlace> void set_inlace_callback(_inlace inlace) { m_read_inlace.set_callback(inlace); }
119   template<class _irq> void set_irq_callback(_irq irq) { m_write_irq.set_callback(irq); }
120   template<class _dma_out> void set_dma_out_callback(_dma_out dma_out) { m_write_dma_out.set_callback(dma_out); }
121   template<class _efx> void set_efx_callback(_efx efx) { m_write_efx.set_callback(efx); }
122   template<class _hsync> void set_hsync_callback(_hsync hsync) { m_write_hsync.set_callback(hsync); }
123   template<class _rdata> void set_rdata_callback(_rdata rdata) { m_read_rdata.set_callback(rdata); }
124   template<class _bdata> void set_bdata_callback(_bdata bdata) { m_read_bdata.set_callback(bdata); }
125   template<class _gdata> void set_gdata_callback(_gdata gdata) { m_read_gdata.set_callback(gdata); }
126   void set_chrominance_resistors(double r, double b, double g, double bkg) { m_chr_r = r; m_chr_b = b; m_chr_g = g; m_chr_bkg = bkg; }
127
146128   DECLARE_READ8_MEMBER( dispon_r );
147129   DECLARE_READ8_MEMBER( dispoff_r );
148130
r23575r23576
159141
160142protected:
161143   // device-level overrides
162   virtual void device_config_complete();
163144   virtual void device_start();
164145   virtual void device_reset();
165146   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
r23575r23576
170151private:
171152   inline void initialize_palette();
172153
173   static const device_timer_id TIMER_INT = 0;
174   static const device_timer_id TIMER_EFX = 1;
175   static const device_timer_id TIMER_DMA = 2;
176   static const device_timer_id TIMER_HSYNC = 3;
154   enum
155   {
156      TIMER_INT,
157      TIMER_EFX,
158      TIMER_DMA,
159      TIMER_HSYNC
160   };
177161
178   devcb_resolved_read_line        m_in_inlace_func;
179   devcb_resolved_read_line        m_in_rdata_func;
180   devcb_resolved_read_line        m_in_bdata_func;
181   devcb_resolved_read_line        m_in_gdata_func;
182   devcb_resolved_write_line       m_out_int_func;
183   devcb_resolved_write_line       m_out_dmao_func;
184   devcb_resolved_write_line       m_out_efx_func;
185   devcb_resolved_write_line       m_out_hsync_func;
162   devcb2_read_line        m_read_inlace;
163   devcb2_read_line        m_read_rdata;
164   devcb2_read_line        m_read_bdata;
165   devcb2_read_line        m_read_gdata;
166   devcb2_write_line       m_write_irq;
167   devcb2_write_line       m_write_dma_out;
168   devcb2_write_line       m_write_efx;
169   devcb2_write_line       m_write_hsync;
186170
187   cpu_device *m_cpu;
171   const char *m_screen_tag;
188172   screen_device *m_screen;        // screen
189173   bitmap_rgb32 m_bitmap;          // bitmap
190174   sound_stream *m_stream;         // sound output
191175
192176   // video state
177   double m_chr_r;             // red chrominance resistor value
178   double m_chr_b;             // blue chrominance resistor value
179   double m_chr_g;             // green chrominance resistor value
180   double m_chr_bkg;           // background chrominance resistor value
181
193182   rgb_t m_palette[16];
194183   int m_disp;                     // display on
195184   int m_dmaout;                   // DMA request active
trunk/src/emu/sound/cdp1864.c
r23575r23576
6161
6262inline void cdp1864_device::initialize_palette()
6363{
64   double res_total = m_res_r + m_res_g + m_res_b + m_res_bkg;
64   double res_total = m_chr_r + m_chr_g + m_chr_b + m_chr_bkg;
6565
66   int weight_r = (m_res_r / res_total) * 100;
67   int weight_g = (m_res_g / res_total) * 100;
68   int weight_b = (m_res_b / res_total) * 100;
69   int weight_bkg = (m_res_bkg / res_total) * 100;
66   int weight_r = (m_chr_r / res_total) * 100;
67   int weight_g = (m_chr_g / res_total) * 100;
68   int weight_b = (m_chr_b / res_total) * 100;
69   int weight_bkg = (m_chr_bkg / res_total) * 100;
7070
7171   for (int i = 0; i < 16; i++)
7272   {
r23575r23576
100100cdp1864_device::cdp1864_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
101101   : device_t(mconfig, CDP1864, "CDP1864", tag, owner, clock),
102102      device_sound_interface(mconfig, *this),
103      m_read_inlace(*this),
104      m_read_rdata(*this),
105      m_read_bdata(*this),
106      m_read_gdata(*this),
107      m_write_irq(*this),
108      m_write_dma_out(*this),
109      m_write_efx(*this),
110      m_write_hsync(*this),
103111      m_disp(0),
104112      m_dmaout(0),
105113      m_bgcolor(0),
r23575r23576
111119
112120
113121//-------------------------------------------------
114//  device_config_complete - perform any
115//  operations now that the configuration is
116//  complete
117//-------------------------------------------------
118
119void cdp1864_device::device_config_complete()
120{
121   // inherit a copy of the static data
122   const cdp1864_interface *intf = reinterpret_cast<const cdp1864_interface *>(static_config());
123   if (intf != NULL)
124      *static_cast<cdp1864_interface *>(this) = *intf;
125
126   // or initialize to defaults if none provided
127   else
128   {
129      memset(&m_in_inlace_cb, 0, sizeof(m_in_inlace_cb));
130      memset(&m_in_rdata_cb, 0, sizeof(m_in_rdata_cb));
131      memset(&m_in_bdata_cb, 0, sizeof(m_in_bdata_cb));
132      memset(&m_in_gdata_cb, 0, sizeof(m_in_gdata_cb));
133      memset(&m_out_int_cb, 0, sizeof(m_out_int_cb));
134      memset(&m_out_dmao_cb, 0, sizeof(m_out_dmao_cb));
135      memset(&m_out_efx_cb, 0, sizeof(m_out_efx_cb));
136      memset(&m_out_hsync_cb, 0, sizeof(m_out_hsync_cb));
137   }
138}
139
140
141//-------------------------------------------------
142122//  device_start - device-specific startup
143123//-------------------------------------------------
144124
145125void cdp1864_device::device_start()
146126{
147127   // resolve callbacks
148   m_in_inlace_func.resolve(m_in_inlace_cb, *this);
149   m_in_rdata_func.resolve(m_in_rdata_cb, *this);
150   m_in_bdata_func.resolve(m_in_bdata_cb, *this);
151   m_in_gdata_func.resolve(m_in_gdata_cb, *this);
152   m_out_int_func.resolve(m_out_int_cb, *this);
153   m_out_dmao_func.resolve(m_out_dmao_cb, *this);
154   m_out_efx_func.resolve(m_out_efx_cb, *this);
155   m_out_hsync_func.resolve(m_out_hsync_cb, *this);
128   m_read_inlace.resolve_safe(1);
129   m_read_rdata.resolve_safe(0);
130   m_read_bdata.resolve_safe(0);
131   m_read_gdata.resolve_safe(0);
132   m_write_irq.resolve_safe();
133   m_write_dma_out.resolve_safe();
134   m_write_efx.resolve_safe();
135   m_write_hsync.resolve_safe();
156136
157137   // initialize palette
158138   initialize_palette();
r23575r23576
167147   m_hsync_timer = timer_alloc(TIMER_HSYNC);
168148
169149   // find devices
170   m_cpu = machine().device<cpu_device>(m_cpu_tag);
171150   m_screen = machine().device<screen_device>(m_screen_tag);
172151   m_screen->register_screen_bitmap(m_bitmap);
173152
r23575r23576
191170{
192171   m_int_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_INT_START, 0));
193172   m_efx_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_EFX_TOP_START, 0));
194   m_dma_timer->adjust(m_cpu->cycles_to_attotime(CDP1864_CYCLES_DMA_START));
173   m_dma_timer->adjust(clocks_to_attotime(CDP1864_CYCLES_DMA_START));
195174
196175   m_disp = 0;
197176   m_dmaout = 0;
198177
199   m_out_int_func(CLEAR_LINE);
200   m_out_dmao_func(CLEAR_LINE);
201   m_out_efx_func(CLEAR_LINE);
178   m_write_irq(CLEAR_LINE);
179   m_write_dma_out(CLEAR_LINE);
180   m_write_efx(CLEAR_LINE);
181   m_write_hsync(CLEAR_LINE);
202182}
203183
204184
r23575r23576
217197      {
218198         if (m_disp)
219199         {
220            m_out_int_func(ASSERT_LINE);
200            m_write_irq(ASSERT_LINE);
221201         }
222202
223203         m_int_timer->adjust(m_screen->time_until_pos( CDP1864_SCANLINE_INT_END, 0));
r23575r23576
226206      {
227207         if (m_disp)
228208         {
229            m_out_int_func(CLEAR_LINE);
209            m_write_irq(CLEAR_LINE);
230210         }
231211
232212         m_int_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_INT_START, 0));
r23575r23576
237217      switch (scanline)
238218      {
239219      case CDP1864_SCANLINE_EFX_TOP_START:
240         m_out_efx_func(ASSERT_LINE);
220         m_write_efx(ASSERT_LINE);
241221         m_efx_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_EFX_TOP_END, 0));
242222         break;
243223
244224      case CDP1864_SCANLINE_EFX_TOP_END:
245         m_out_efx_func(CLEAR_LINE);
225         m_write_efx(CLEAR_LINE);
246226         m_efx_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_EFX_BOTTOM_START, 0));
247227         break;
248228
249229      case CDP1864_SCANLINE_EFX_BOTTOM_START:
250         m_out_efx_func(ASSERT_LINE);
230         m_write_efx(ASSERT_LINE);
251231         m_efx_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_EFX_BOTTOM_END, 0));
252232         break;
253233
254234      case CDP1864_SCANLINE_EFX_BOTTOM_END:
255         m_out_efx_func(CLEAR_LINE);
235         m_write_efx(CLEAR_LINE);
256236         m_efx_timer->adjust(m_screen->time_until_pos(CDP1864_SCANLINE_EFX_TOP_START, 0));
257237         break;
258238      }
r23575r23576
265245         {
266246            if (scanline >= CDP1864_SCANLINE_DISPLAY_START && scanline < CDP1864_SCANLINE_DISPLAY_END)
267247            {
268               m_out_dmao_func(CLEAR_LINE);
248               m_write_dma_out(CLEAR_LINE);
269249            }
270250         }
271251
272         m_dma_timer->adjust(m_cpu->cycles_to_attotime(CDP1864_CYCLES_DMA_WAIT));
252         m_dma_timer->adjust(clocks_to_attotime(CDP1864_CYCLES_DMA_WAIT));
273253
274254         m_dmaout = 0;
275255      }
r23575r23576
279259         {
280260            if (scanline >= CDP1864_SCANLINE_DISPLAY_START && scanline < CDP1864_SCANLINE_DISPLAY_END)
281261            {
282               m_out_dmao_func(ASSERT_LINE);
262               m_write_dma_out(ASSERT_LINE);
283263            }
284264         }
285265
286         m_dma_timer->adjust(m_cpu->cycles_to_attotime(CDP1864_CYCLES_DMA_ACTIVE));
266         m_dma_timer->adjust(clocks_to_attotime(CDP1864_CYCLES_DMA_ACTIVE));
287267
288268         m_dmaout = 1;
289269      }
r23575r23576
309289
310290   if (m_aoe)
311291   {
312      double frequency = m_cpu->unscaled_clock() / 8 / 4 / (m_latch + 1) / 2;
292      double frequency = unscaled_clock() / 8 / 4 / (m_latch + 1) / 2;
313293      int rate = machine().sample_rate() / 2;
314294
315295      /* get progress through wave */
r23575r23576
362342{
363343   m_disp = 0;
364344
365   m_out_int_func(CLEAR_LINE);
366   m_out_dmao_func(CLEAR_LINE);
345   m_write_irq(CLEAR_LINE);
346   m_write_dma_out(CLEAR_LINE);
367347
368348   return 0xff;
369349}
r23575r23576
408388
409389   if (!m_con)
410390   {
411      rdata = m_in_rdata_func();
412      bdata = m_in_bdata_func();
413      gdata = m_in_gdata_func();
391      rdata = m_read_rdata();
392      bdata = m_read_bdata();
393      gdata = m_read_gdata();
414394   }
415395
416396   for (int x = 0; x < 8; x++)
trunk/src/mess/drivers/elf.c
r23575r23576
221221   DEVCB_NULL
222222};
223223
224/* CDP1861 Interface */
225
226static CDP1861_INTERFACE( elf2_cdp1861_intf )
227{
228   CDP1802_TAG,
229   SCREEN_TAG,
230   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
231   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT),
232   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1)
233};
234
235224/* Machine Initialization */
236225
237226void elf2_state::machine_start()
r23575r23576
300289
301290   /* video hardware */
302291   MCFG_DEFAULT_LAYOUT( layout_elf2 )
303
304292   MCFG_SCREEN_ADD(SCREEN_TAG, RASTER)
305293   MCFG_SCREEN_UPDATE_DEVICE(CDP1861_TAG, cdp1861_device, screen_update)
306294   MCFG_SCREEN_RAW_PARAMS(XTAL_3_579545MHz/2, CDP1861_SCREEN_WIDTH, CDP1861_HBLANK_END, CDP1861_HBLANK_START, CDP1861_TOTAL_SCANLINES, CDP1861_SCANLINE_VBLANK_END, CDP1861_SCANLINE_VBLANK_START)
307295
296   /* devices */
308297   MCFG_MM74C923_ADD(MM74C923_TAG, keyboard_intf)
309298   MCFG_DM9368_ADD(DM9368_H_TAG, led_h_intf)
310299   MCFG_DM9368_ADD(DM9368_L_TAG, led_l_intf)
311   MCFG_CDP1861_ADD(CDP1861_TAG, XTAL_3_579545MHz/2, elf2_cdp1861_intf)
312
313   /* devices */
300   MCFG_CDP1861_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_3_579545MHz/2, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1))
314301   MCFG_CASSETTE_ADD("cassette", elf_cassette_interface)
315302   MCFG_QUICKLOAD_ADD("quickload", elf2_state, elf, "bin", 0)
316303
trunk/src/mess/drivers/studio2.c
r23575r23576
377377
378378/* Video */
379379
380static CDP1861_INTERFACE( studio2_cdp1861_intf )
381{
382   CDP1802_TAG,
383   SCREEN_TAG,
384   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
385   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT),
386   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1)
387};
388
389380static const rgb_t VISICOM_PALETTE[] =
390381{
391382   MAKE_RGB(0x00, 0x80, 0x00),
r23575r23576
409400   return BIT(m_color, 2);
410401}
411402
412static CDP1864_INTERFACE( mpt02_cdp1864_intf )
413{
414   CDP1802_TAG,
415   SCREEN_TAG,
416   CDP1864_INTERLACED,
417   DEVCB_DRIVER_LINE_MEMBER(mpt02_state, rdata_r),
418   DEVCB_DRIVER_LINE_MEMBER(mpt02_state, bdata_r),
419   DEVCB_DRIVER_LINE_MEMBER(mpt02_state, gdata_r),
420   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
421   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT),
422   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1),
423   DEVCB_NULL,
424   RES_K(2.2), // unverified
425   RES_K(1),   // unverified
426   RES_K(5.1), // unverified
427   RES_K(4.7)  // unverified
428};
429
430403/* CDP1802 Configuration */
431404
432405READ_LINE_MEMBER( studio2_state::clear_r )
r23575r23576
546519
547520   /* video hardware */
548521   MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, 1760000)
549   MCFG_CDP1861_ADD(CDP1861_TAG, 1760000, studio2_cdp1861_intf)
522   MCFG_CDP1861_ADD(CDP1861_TAG, SCREEN_TAG, 1760000, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1))
550523
551524   /* sound hardware */
552525   MCFG_SPEAKER_STANDARD_MONO("mono")
r23575r23576
565538
566539   /* video hardware */
567540   MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_3_579545MHz/2)
568   MCFG_CDP1861_ADD(CDP1861_TAG, XTAL_3_579545MHz/2/8, studio2_cdp1861_intf)
541   MCFG_CDP1861_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_3_579545MHz/2/8, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1))
569542
570543   /* sound hardware */
571544   MCFG_SPEAKER_STANDARD_MONO("mono")
r23575r23576
591564   MCFG_SOUND_ADD("beeper", BEEP, 0)
592565   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
593566
594   MCFG_CDP1864_ADD(CDP1864_TAG, CDP1864_CLOCK, mpt02_cdp1864_intf)
567   MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, CDP1864_CLOCK, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(mpt02_state, rdata_r), READLINE(mpt02_state, bdata_r), READLINE(mpt02_state, gdata_r))
568   MCFG_CDP1864_CHROMINANCE(RES_K(2.2), RES_K(1), RES_K(5.1), RES_K(4.7)) // unverified
569
595570   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
596571
597572   MCFG_FRAGMENT_ADD( studio2_cartslot )
trunk/src/mess/drivers/trs80m2.c
r23575r23576
500500   m_kbclk = state;
501501}
502502
503static TRS80M2_KEYBOARD_INTERFACE( kb_intf )
504{
505   DEVCB_DRIVER_LINE_MEMBER(trs80m2_state, kb_clock_w)
506};
507
508503WRITE8_MEMBER( trs80m2_state::kbd_w )
509504{
510505   // latch key data
r23575r23576
844839   MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":1", trs80m2_floppies, NULL,    floppy_image_device::default_floppy_formats)
845840   MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":2", trs80m2_floppies, NULL,    floppy_image_device::default_floppy_formats)
846841   MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":3", trs80m2_floppies, NULL,    floppy_image_device::default_floppy_formats)
847   MCFG_TRS80M2_KEYBOARD_ADD(kb_intf)
842   MCFG_TRS80M2_KEYBOARD_ADD(WRITELINE(trs80m2_state, kb_clock_w))
848843   MCFG_ASCII_KEYBOARD_ADD(KEYBOARD_TAG, keyboard_intf)
849844
850845   // internal RAM
r23575r23576
895890   MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":2", trs80m2_floppies, NULL,    floppy_image_device::default_floppy_formats)
896891   MCFG_FLOPPY_DRIVE_ADD(FD1791_TAG":3", trs80m2_floppies, NULL,    floppy_image_device::default_floppy_formats)
897892   MCFG_PIC8259_ADD(AM9519A_TAG, INPUTLINE(M68000_TAG, M68K_IRQ_5), VCC, NULL )
898   MCFG_TRS80M2_KEYBOARD_ADD(kb_intf)
893   MCFG_TRS80M2_KEYBOARD_ADD(WRITELINE(trs80m2_state, kb_clock_w))
899894
900895   // internal RAM
901896   MCFG_RAM_ADD(RAM_TAG)
trunk/src/mess/drivers/cosmicos.c
r23575r23576
362362   m_efx = state;
363363}
364364
365static CDP1864_INTERFACE( cosmicos_cdp1864_intf )
366{
367   CDP1802_TAG,
368   SCREEN_TAG,
369   CDP1864_INTERLACED,
370   DEVCB_LINE_VCC,
371   DEVCB_LINE_VCC,
372   DEVCB_LINE_VCC,
373   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
374   DEVCB_DRIVER_LINE_MEMBER(cosmicos_state, dmaout_w),
375   DEVCB_DRIVER_LINE_MEMBER(cosmicos_state, efx_w),
376   DEVCB_NULL,
377   RES_K(2), // R2
378   0, // not connected
379   0, // not connected
380   0  // not connected
381};
382
383365/* CDP1802 Configuration */
384366
385367READ_LINE_MEMBER( cosmicos_state::wait_r )
r23575r23576
582564   MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
583565   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
584566
585   MCFG_CDP1864_ADD(CDP1864_TAG, XTAL_1_75MHz, cosmicos_cdp1864_intf)
567   MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), WRITELINE(cosmicos_state, dmaout_w), WRITELINE(cosmicos_state, efx_w), NULL, VCC, VCC, VCC)
568   MCFG_CDP1864_CHROMINANCE(RES_K(2), 0, 0, 0) // R2
586569   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
587570
588571   /* devices */
trunk/src/mess/drivers/vip.c
r23575r23576
546546   m_vdc_ef1 = state;
547547}
548548
549static CDP1861_INTERFACE( vdc_intf )
550{
551   CDP1802_TAG,
552   SCREEN_TAG,
553   DEVCB_DRIVER_LINE_MEMBER(vip_state, vdc_int_w),
554   DEVCB_DRIVER_LINE_MEMBER(vip_state, vdc_dma_out_w),
555   DEVCB_DRIVER_LINE_MEMBER(vip_state, vdc_ef1_w)
556};
557
558549UINT32 vip_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
559550{
560551   m_vdc->screen_update(screen, bitmap, cliprect);
r23575r23576
609600   }
610601}
611602
612static VIP_BYTEIO_PORT_INTERFACE( byteio_intf )
613{
614   DEVCB_DRIVER_LINE_MEMBER(vip_state, byteio_inst_w)
615};
616603
617
618604//-------------------------------------------------
619605//  VIP_EXPANSION_INTERFACE( expansion_intf )
620606//-------------------------------------------------
r23575r23576
640626   update_interrupts();
641627}
642628
643static VIP_EXPANSION_INTERFACE( expansion_intf )
644{
645   DEVCB_DRIVER_LINE_MEMBER(vip_state, exp_int_w),
646   DEVCB_DRIVER_LINE_MEMBER(vip_state, exp_dma_out_w),
647   DEVCB_DRIVER_LINE_MEMBER(vip_state, exp_dma_in_w)
648};
649629
650630
651
652631//**************************************************************************
653632//  MACHINE INITIALIZATION
654633//**************************************************************************
r23575r23576
772751   // video hardware
773752   MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_3_52128MHz/2)
774753   MCFG_SCREEN_UPDATE_DRIVER(vip_state, screen_update)
754   MCFG_CDP1861_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_3_52128MHz/2, WRITELINE(vip_state, vdc_int_w), WRITELINE(vip_state, vdc_dma_out_w), WRITELINE(vip_state, vdc_ef1_w))
775755
776   MCFG_CDP1861_ADD(CDP1861_TAG, XTAL_3_52128MHz/2, vdc_intf)
777
778756   // sound hardware
779757   MCFG_SPEAKER_STANDARD_MONO("mono")
780758
r23575r23576
782760   MCFG_SOUND_CONFIG_DISCRETE(vip)
783761   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
784762
785   MCFG_VIP_BYTEIO_PORT_ADD(VIP_BYTEIO_PORT_TAG, byteio_intf, vip_byteio_cards, NULL)
786   MCFG_VIP_EXPANSION_SLOT_ADD(VIP_EXPANSION_SLOT_TAG, XTAL_3_52128MHz/2, expansion_intf, vip_expansion_cards, NULL)
763   MCFG_VIP_BYTEIO_PORT_ADD(VIP_BYTEIO_PORT_TAG, vip_byteio_cards, NULL, WRITELINE(vip_state, byteio_inst_w))
764   MCFG_VIP_EXPANSION_SLOT_ADD(VIP_EXPANSION_SLOT_TAG, XTAL_3_52128MHz/2, vip_expansion_cards, NULL)
765    MCFG_VIP_EXPANSION_SLOT_CALLBACKS(WRITELINE(vip_state, exp_int_w), WRITELINE(vip_state, exp_dma_out_w), WRITELINE(vip_state, exp_dma_in_w))
787766
788767   // devices
789768   MCFG_QUICKLOAD_ADD("quickload", vip_state, vip, "bin,c8,c8x", 0)
trunk/src/mess/drivers/pc1512.c
r23575r23576
777777   m_kbclk = state;
778778}
779779
780static PC1512_KEYBOARD_INTERFACE( kb_intf )
781{
782   DEVCB_DRIVER_LINE_MEMBER(pc1512_state, kbdata_w),
783   DEVCB_DRIVER_LINE_MEMBER(pc1512_state, kbclk_w)
784};
785780
786
787781//-------------------------------------------------
788782//  I8237_INTERFACE( dmac_intf )
789783//-------------------------------------------------
r23575r23576
12601254   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
12611255
12621256   // devices
1263   MCFG_PC1512_KEYBOARD_ADD(kb_intf)
1257   MCFG_PC1512_KEYBOARD_ADD(WRITELINE(pc1512_state, kbclk_w), WRITELINE(pc1512_state, kbdata_w))
12641258   MCFG_I8237_ADD(I8237A5_TAG, XTAL_24MHz/6, dmac_intf)
12651259   MCFG_PIC8259_ADD(I8259A2_TAG, INPUTLINE(I8086_TAG, INPUT_LINE_IRQ0), VCC, NULL)
12661260   MCFG_PIT8253_ADD(I8253_TAG, pit_intf)
r23575r23576
13061300   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
13071301
13081302   // devices
1309   MCFG_PC1512_KEYBOARD_ADD(kb_intf)
1303   MCFG_PC1512_KEYBOARD_ADD(WRITELINE(pc1512_state, kbclk_w), WRITELINE(pc1512_state, kbdata_w))
13101304   MCFG_I8237_ADD(I8237A5_TAG, XTAL_24MHz/6, dmac_intf)
13111305   MCFG_PIC8259_ADD(I8259A2_TAG, INPUTLINE(I8086_TAG, INPUT_LINE_IRQ0), VCC, NULL)
13121306   MCFG_PIT8253_ADD(I8253_TAG, pit_intf)
trunk/src/mess/drivers/tandy2k.c
r23575r23576
642642   m_kbddat = state;
643643}
644644
645static TANDY2K_KEYBOARD_INTERFACE( kb_intf )
646{
647   DEVCB_DRIVER_LINE_MEMBER(tandy2k_state, kbdclk_w),
648   DEVCB_DRIVER_LINE_MEMBER(tandy2k_state, kbddat_w)
649};
650
651645// Machine Initialization
652646
653647void tandy2k_state::machine_start()
r23575r23576
720714   MCFG_FLOPPY_DRIVE_ADD(I8272A_TAG ":1", tandy2k_floppies, "525qd", floppy_image_device::default_floppy_formats)
721715   MCFG_CENTRONICS_PRINTER_ADD(CENTRONICS_TAG, standard_centronics)
722716   MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, NULL)
723   MCFG_TANDY2K_KEYBOARD_ADD(kb_intf)
717   MCFG_TANDY2K_KEYBOARD_ADD(WRITELINE(tandy2k_state, kbdclk_w), WRITELINE(tandy2k_state, kbddat_w))
724718
725719   // software lists
726720   MCFG_SOFTWARE_LIST_ADD("flop_list", "tandy2k")
trunk/src/mess/drivers/eti660.c
r23575r23576
100100   return BIT(m_color, 2);
101101}
102102
103static CDP1864_INTERFACE( eti660_cdp1864_intf )
104{
105   CDP1802_TAG,
106   SCREEN_TAG,
107   CDP1864_INTERLACED,
108   DEVCB_DRIVER_LINE_MEMBER(eti660_state, rdata_r),
109   DEVCB_DRIVER_LINE_MEMBER(eti660_state, bdata_r),
110   DEVCB_DRIVER_LINE_MEMBER(eti660_state, gdata_r),
111   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
112   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT),
113   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1),
114   DEVCB_NULL,
115   RES_K(2.2), /* R7 */
116   RES_K(1),   /* R5 */
117   RES_K(4.7), /* R6 */
118   RES_K(4.7)  /* R4 */
119};
120
121103/* CDP1802 Interface */
122104
123105READ_LINE_MEMBER( eti660_state::clear_r )
r23575r23576
262244
263245   /* sound hardware */
264246   MCFG_SPEAKER_STANDARD_MONO("mono")
265   MCFG_CDP1864_ADD(CDP1864_TAG, XTAL_8_867238MHz/5, eti660_cdp1864_intf)
247   MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_8_867238MHz/5, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(eti660_state, rdata_r), READLINE(eti660_state, bdata_r), READLINE(eti660_state, gdata_r))
248   MCFG_CDP1864_CHROMINANCE(RES_K(2.2), RES_K(1), RES_K(4.7), RES_K(4.7)) // R7, R5, R6, R4
266249   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
267250
268251   /* devices */
trunk/src/mess/drivers/tmc2000e.c
r23575r23576
210210   return BIT(m_color, 0);
211211}
212212
213static CDP1864_INTERFACE( tmc2000e_cdp1864_intf )
214{
215   CDP1802_TAG,
216   SCREEN_TAG,
217   CDP1864_INTERLACED,
218   DEVCB_DRIVER_LINE_MEMBER(tmc2000e_state, rdata_r),
219   DEVCB_DRIVER_LINE_MEMBER(tmc2000e_state, bdata_r),
220   DEVCB_DRIVER_LINE_MEMBER(tmc2000e_state, gdata_r),
221   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
222   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT),
223   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1),
224   DEVCB_NULL,
225   RES_K(2.2), // unverified
226   RES_K(1),   // unverified
227   RES_K(5.1), // unverified
228   RES_K(4.7)  // unverified
229};
230
231213/* CDP1802 Interface */
232214
233215READ_LINE_MEMBER( tmc2000e_state::clear_r )
r23575r23576
335317
336318   // sound hardware
337319   MCFG_SPEAKER_STANDARD_MONO("mono")
338   MCFG_CDP1864_ADD(CDP1864_TAG, XTAL_1_75MHz, tmc2000e_cdp1864_intf)
320   MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(tmc2000e_state, rdata_r), READLINE(tmc2000e_state, bdata_r), READLINE(tmc2000e_state, gdata_r))
321   MCFG_CDP1864_CHROMINANCE(RES_K(2.2), RES_K(1), RES_K(5.1), RES_K(4.7)) // unverified
339322   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
340323
341324   /* devices */
trunk/src/mess/machine/vip_exp.c
r23575r23576
4242}
4343
4444
45//-------------------------------------------------
46//  ~device_vip_expansion_card_interface - destructor
47//-------------------------------------------------
4845
49device_vip_expansion_card_interface::~device_vip_expansion_card_interface()
50{
51}
52
53
54
5546//**************************************************************************
5647//  LIVE DEVICE
5748//**************************************************************************
r23575r23576
6152//-------------------------------------------------
6253
6354vip_expansion_slot_device::vip_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
64      device_t(mconfig, VIP_EXPANSION_SLOT, "VIP expansion port", tag, owner, clock),
65      device_slot_interface(mconfig, *this)
55   device_t(mconfig, VIP_EXPANSION_SLOT, "VIP expansion port", tag, owner, clock),
56   device_slot_interface(mconfig, *this),
57   m_write_irq(*this),
58   m_write_dma_out(*this),
59   m_write_dma_in(*this)
6660{
6761}
6862
6963
7064//-------------------------------------------------
71//  vip_expansion_slot_device - destructor
72//-------------------------------------------------
73
74vip_expansion_slot_device::~vip_expansion_slot_device()
75{
76}
77
78
79//-------------------------------------------------
80//  device_config_complete - perform any
81//  operations now that the configuration is
82//  complete
83//-------------------------------------------------
84
85void vip_expansion_slot_device::device_config_complete()
86{
87   // inherit a copy of the static data
88   const vip_expansion_slot_interface *intf = reinterpret_cast<const vip_expansion_slot_interface *>(static_config());
89   if (intf != NULL)
90   {
91      *static_cast<vip_expansion_slot_interface *>(this) = *intf;
92   }
93
94   // or initialize to defaults if none provided
95   else
96   {
97      memset(&m_out_interrupt_cb, 0, sizeof(m_out_interrupt_cb));
98      memset(&m_out_dma_out_cb, 0, sizeof(m_out_dma_out_cb));
99      memset(&m_out_dma_in_cb, 0, sizeof(m_out_dma_in_cb));
100   }
101}
102
103
104//-------------------------------------------------
10565//  device_start - device-specific startup
10666//-------------------------------------------------
10767
10868void vip_expansion_slot_device::device_start()
10969{
110   m_cart = dynamic_cast<device_vip_expansion_card_interface *>(get_card_device());
70   m_card = dynamic_cast<device_vip_expansion_card_interface *>(get_card_device());
11171
11272   // resolve callbacks
113   m_out_interrupt_func.resolve(m_out_interrupt_cb, *this);
114   m_out_dma_out_func.resolve(m_out_dma_out_cb, *this);
115   m_out_dma_in_func.resolve(m_out_dma_in_cb, *this);
73   m_write_irq.resolve_safe();
74   m_write_dma_out.resolve_safe();
75   m_write_dma_in.resolve_safe();
11676}
11777
11878
r23575r23576
12484{
12585   UINT8 data = 0;
12686
127   if (m_cart != NULL)
87   if (m_card != NULL)
12888   {
129      data = m_cart->vip_program_r(space, offset, cs, cdef, minh);
89      data = m_card->vip_program_r(space, offset, cs, cdef, minh);
13090   }
13191
13292   return data;
r23575r23576
13999
140100void vip_expansion_slot_device::program_w(address_space &space, offs_t offset, UINT8 data, int cdef, int *minh)
141101{
142   if (m_cart != NULL)
102   if (m_card != NULL)
143103   {
144      m_cart->vip_program_w(space, offset, data, cdef, minh);
104      m_card->vip_program_w(space, offset, data, cdef, minh);
145105   }
146106}
147107
r23575r23576
154114{
155115   UINT8 data = 0;
156116
157   if (m_cart != NULL)
117   if (m_card != NULL)
158118   {
159      data = m_cart->vip_io_r(space, offset);
119      data = m_card->vip_io_r(space, offset);
160120   }
161121
162122   return data;
r23575r23576
169129
170130void vip_expansion_slot_device::io_w(address_space &space, offs_t offset, UINT8 data)
171131{
172   if (m_cart != NULL)
132   if (m_card != NULL)
173133   {
174      m_cart->vip_io_w(space, offset, data);
134      m_card->vip_io_w(space, offset, data);
175135   }
176136}
177137
r23575r23576
184144{
185145   UINT8 data = 0;
186146
187   if (m_cart != NULL)
147   if (m_card != NULL)
188148   {
189      data = m_cart->vip_dma_r(space, offset);
149      data = m_card->vip_dma_r(space, offset);
190150   }
191151
192152   return data;
r23575r23576
199159
200160void vip_expansion_slot_device::dma_w(address_space &space, offs_t offset, UINT8 data)
201161{
202   if (m_cart != NULL)
162   if (m_card != NULL)
203163   {
204      m_cart->vip_dma_w(space, offset, data);
164      m_card->vip_dma_w(space, offset, data);
205165   }
206166}
207167
r23575r23576
214174{
215175   bool value = false;
216176
217   if (m_cart != NULL)
177   if (m_card != NULL)
218178   {
219      value = m_cart->vip_screen_update(screen, bitmap, cliprect);
179      value = m_card->vip_screen_update(screen, bitmap, cliprect);
220180   }
221181
222182   return value;
223183}
224184
225READ_LINE_MEMBER( vip_expansion_slot_device::ef1_r ) { int state = CLEAR_LINE; if (m_cart != NULL) state = m_cart->vip_ef1_r(); return state; }
226READ_LINE_MEMBER( vip_expansion_slot_device::ef3_r ) { int state = CLEAR_LINE; if (m_cart != NULL) state = m_cart->vip_ef3_r(); return state; }
227READ_LINE_MEMBER( vip_expansion_slot_device::ef4_r ) { int state = CLEAR_LINE; if (m_cart != NULL) state = m_cart->vip_ef4_r(); return state; }
228void vip_expansion_slot_device::sc_w(int data) { if (m_cart != NULL) m_cart->vip_sc_w(data); }
229WRITE_LINE_MEMBER( vip_expansion_slot_device::q_w ) { if (m_cart != NULL) m_cart->vip_q_w(state); }
230WRITE_LINE_MEMBER( vip_expansion_slot_device::run_w ) { if (m_cart != NULL) m_cart->vip_run_w(state); }
185READ_LINE_MEMBER( vip_expansion_slot_device::ef1_r ) { int state = CLEAR_LINE; if (m_card != NULL) state = m_card->vip_ef1_r(); return state; }
186READ_LINE_MEMBER( vip_expansion_slot_device::ef3_r ) { int state = CLEAR_LINE; if (m_card != NULL) state = m_card->vip_ef3_r(); return state; }
187READ_LINE_MEMBER( vip_expansion_slot_device::ef4_r ) { int state = CLEAR_LINE; if (m_card != NULL) state = m_card->vip_ef4_r(); return state; }
188void vip_expansion_slot_device::sc_w(int data) { if (m_card != NULL) m_card->vip_sc_w(data); }
189WRITE_LINE_MEMBER( vip_expansion_slot_device::q_w ) { if (m_card != NULL) m_card->vip_q_w(state); }
190WRITE_LINE_MEMBER( vip_expansion_slot_device::run_w ) { if (m_card != NULL) m_card->vip_run_w(state); }
231191
232WRITE_LINE_MEMBER( vip_expansion_slot_device::interrupt_w ) { m_out_interrupt_func(state); }
233WRITE_LINE_MEMBER( vip_expansion_slot_device::dma_out_w ) { m_out_dma_out_func(state); }
234WRITE_LINE_MEMBER( vip_expansion_slot_device::dma_in_w ) { m_out_dma_in_func(state); }
235192
236193
237
238194//-------------------------------------------------
239195//  SLOT_INTERFACE vip_expansion_cards )
240196//-------------------------------------------------
trunk/src/mess/machine/vip_exp.h
r23575r23576
5353//  INTERFACE CONFIGURATION MACROS
5454//**************************************************************************
5555
56#define VIP_EXPANSION_INTERFACE(_name) \
57   const vip_expansion_slot_interface (_name) =
58
59
60#define MCFG_VIP_EXPANSION_SLOT_ADD(_tag, _clock, _config, _slot_intf, _def_slot) \
56#define MCFG_VIP_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot) \
6157   MCFG_DEVICE_ADD(_tag, VIP_EXPANSION_SLOT, _clock) \
62   MCFG_DEVICE_CONFIG(_config) \
6358   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
6459
60#define MCFG_VIP_EXPANSION_SLOT_CALLBACKS(_irq, _dma_out, _dma_in) \
61   downcast<vip_expansion_slot_device *>(device)->set_irq_callback(DEVCB2_##_irq); \
62   downcast<vip_expansion_slot_device *>(device)->set_dma_out_callback(DEVCB2_##_dma_out); \
63   downcast<vip_expansion_slot_device *>(device)->set_dma_in_callback(DEVCB2_##_dma_in);
6564
6665
66
6767//**************************************************************************
6868//  TYPE DEFINITIONS
6969//**************************************************************************
7070
71// ======================> vip_expansion_slot_interface
72
73struct vip_expansion_slot_interface
74{
75   devcb_write_line    m_out_interrupt_cb;
76   devcb_write_line    m_out_dma_out_cb;
77   devcb_write_line    m_out_dma_in_cb;
78};
79
80
8171// ======================> vip_expansion_slot_device
8272
8373class device_vip_expansion_card_interface;
8474
8575class vip_expansion_slot_device : public device_t,
86                           public vip_expansion_slot_interface,
8776                           public device_slot_interface
8877{
8978public:
9079   // construction/destruction
9180   vip_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
92   virtual ~vip_expansion_slot_device();
9381
82   template<class _irq> void set_irq_callback(_irq irq) { m_write_irq.set_callback(irq); }
83   template<class _dma_out> void set_dma_out_callback(_dma_out dma_out) { m_write_dma_out.set_callback(dma_out); }
84   template<class _dma_in> void set_dma_in_callback(_dma_in dma_in) { m_write_dma_in.set_callback(dma_in); }
85
9486   // computer interface
9587   UINT8 program_r(address_space &space, offs_t offset, int cs, int cdef, int *minh);
9688   void program_w(address_space &space, offs_t offset, UINT8 data, int cdef, int *minh);
r23575r23576
10799   DECLARE_WRITE_LINE_MEMBER( run_w );
108100
109101   // cartridge interface
110   DECLARE_WRITE_LINE_MEMBER( interrupt_w );
111   DECLARE_WRITE_LINE_MEMBER( dma_out_w );
112   DECLARE_WRITE_LINE_MEMBER( dma_in_w );
102   DECLARE_WRITE_LINE_MEMBER( interrupt_w ) { m_write_irq(state); }
103   DECLARE_WRITE_LINE_MEMBER( dma_out_w ) { m_write_dma_out(state); }
104   DECLARE_WRITE_LINE_MEMBER( dma_in_w ) { m_write_dma_in(state); }
113105
114106protected:
115107   // device-level overrides
116   virtual void device_config_complete();
117108   virtual void device_start();
118109
119   devcb_resolved_write_line   m_out_interrupt_func;
120   devcb_resolved_write_line   m_out_dma_out_func;
121   devcb_resolved_write_line   m_out_dma_in_func;
110   devcb2_write_line m_write_irq;
111   devcb2_write_line m_write_dma_out;
112   devcb2_write_line m_write_dma_in;
122113
123   device_vip_expansion_card_interface *m_cart;
114   device_vip_expansion_card_interface *m_card;
124115};
125116
126117
r23575r23576
133124public:
134125   // construction/destruction
135126   device_vip_expansion_card_interface(const machine_config &mconfig, device_t &device);
136   virtual ~device_vip_expansion_card_interface();
137127
138128protected:
139129   // runtime
trunk/src/mess/machine/pc1512kb.c
r23575r23576
1818#define I8048_TAG       "ic801"
1919
2020
21enum
22{
23   LED_CAPS = 0,
24   LED_NUM
25};
2621
27
28
2922//**************************************************************************
3023//  DEVICE DEFINITIONS
3124//**************************************************************************
r23575r23576
3427
3528
3629//-------------------------------------------------
37//  device_config_complete - perform any
38//  operations now that the configuration is
39//  complete
40//-------------------------------------------------
41
42void pc1512_keyboard_device::device_config_complete()
43{
44   // inherit a copy of the static data
45   const pc1512_keyboard_interface *intf = reinterpret_cast<const pc1512_keyboard_interface *>(static_config());
46   if (intf != NULL)
47      *static_cast<pc1512_keyboard_interface *>(this) = *intf;
48
49   // or initialize to defaults if none provided
50   else
51   {
52      memset(&m_out_data_cb, 0, sizeof(m_out_data_cb));
53      memset(&m_out_clock_cb, 0, sizeof(m_out_clock_cb));
54   }
55}
56
57
58//-------------------------------------------------
5930//  ROM( pc1512_keyboard )
6031//-------------------------------------------------
6132
r23575r23576
270241      m_y10(*this, "Y10"),
271242      m_y11(*this, "Y11"),
272243      m_com(*this, "COM"),
244      m_write_clock(*this),
245      m_write_data(*this),
273246      m_data_in(1),
274247      m_clock_in(1),
275248      m_kb_y(0xffff),
r23575r23576
290263   m_reset_timer = timer_alloc();
291264
292265   // resolve callbacks
293   m_out_data_func.resolve(m_out_data_cb, *this);
294   m_out_clock_func.resolve(m_out_clock_cb, *this);
266   m_write_clock.resolve_safe();
267   m_write_data.resolve_safe();
295268
296269   // state saving
297270   save_item(NAME(m_data_in));
r23575r23576
495468   */
496469
497470   // keyboard data
498   m_out_data_func(BIT(data, 0));
471   m_write_data(BIT(data, 0));
499472
500473   // keyboard clock
501   m_out_clock_func(BIT(data, 1));
474   m_write_clock(BIT(data, 1));
502475
503476   // CAPS LOCK
504477   output_set_led_value(LED_CAPS, BIT(data, 2));
trunk/src/mess/machine/pc1512kb.h
r23575r23576
3030//  INTERFACE CONFIGURATION MACROS
3131//**************************************************************************
3232
33#define MCFG_PC1512_KEYBOARD_ADD(_config) \
33#define MCFG_PC1512_KEYBOARD_ADD(_clock, _data) \
3434   MCFG_DEVICE_ADD(PC1512_KEYBOARD_TAG, PC1512_KEYBOARD, 0) \
35   MCFG_DEVICE_CONFIG(_config)
35   downcast<pc1512_keyboard_device *>(device)->set_clock_callback(DEVCB2_##_clock); \
36   downcast<pc1512_keyboard_device *>(device)->set_data_callback(DEVCB2_##_data);
3637
3738
38#define PC1512_KEYBOARD_INTERFACE(_name) \
39   const pc1512_keyboard_interface (_name) =
4039
41
42
4340//**************************************************************************
4441//  TYPE DEFINITIONS
4542//**************************************************************************
4643
47// ======================> pc1512_keyboard_interface
48
49struct pc1512_keyboard_interface
50{
51   devcb_write_line    m_out_data_cb;
52   devcb_write_line    m_out_clock_cb;
53};
54
55
5644// ======================> pc1512_keyboard_device
5745
58class pc1512_keyboard_device :  public device_t,
59                        public pc1512_keyboard_interface
46class pc1512_keyboard_device :  public device_t
6047{
6148public:
6249   // construction/destruction
6350   pc1512_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
6451
52   template<class _clock> void set_clock_callback(_clock clock) { m_write_clock.set_callback(clock); }
53   template<class _data> void set_data_callback(_data data) { m_write_data.set_callback(data); }
54
6555   // optional information overrides
6656   virtual const rom_entry *device_rom_region() const;
6757   virtual machine_config_constructor device_mconfig_additions() const;
r23575r23576
8474   virtual void device_start();
8575   virtual void device_reset();
8676   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
87   virtual void device_config_complete();
8877
8978private:
90   devcb_resolved_write_line   m_out_data_func;
91   devcb_resolved_write_line   m_out_clock_func;
79   enum
80   {
81      LED_CAPS = 0,
82      LED_NUM
83   };
9284
9385   required_device<cpu_device> m_maincpu;
9486   required_ioport m_y1;
r23575r23576
10496   required_ioport m_y11;
10597   required_ioport m_com;
10698
99   devcb2_write_line   m_write_clock;
100   devcb2_write_line   m_write_data;
101
107102   int m_data_in;
108103   int m_clock_in;
109104   int m_kb_y;
trunk/src/mess/machine/vp590.c
r23575r23576
4848   return BIT(m_color, 3);
4949}
5050
51static CDP1862_INTERFACE( cgc_intf )
52{
53   SCREEN_TAG,
54   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp590_device, rd_r),
55   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp590_device, bd_r),
56   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp590_device, gd_r),
57   RES_R(510),     // R3
58   RES_R(360),     // R4
59   RES_K(1),       // R5
60   RES_K(1.5),     // R6
61   RES_K(3.9),     // R7
62   RES_K(10),      // R8
63   RES_K(2),       // R9
64   RES_K(3.3)      // R10
65};
6651
67
6852//-------------------------------------------------
6953//  MACHINE_CONFIG_FRAGMENT( vp590 )
7054//-------------------------------------------------
7155
7256static MACHINE_CONFIG_FRAGMENT( vp590 )
73   MCFG_CDP1862_ADD(CDP1862_TAG, CPD1862_CLOCK, cgc_intf)
57   MCFG_CDP1862_ADD(CDP1862_TAG, SCREEN_TAG, CPD1862_CLOCK, DEVREADLINE(DEVICE_SELF, vp590_device, rd_r), DEVREADLINE(DEVICE_SELF, vp590_device, bd_r), DEVREADLINE(DEVICE_SELF, vp590_device, gd_r))
58   MCFG_CDP1862_LUMINANCE(RES_R(510), RES_R(360), RES_K(1), RES_K(1.5)) // R3, R4, R5, R6
59   MCFG_CDP1862_CHROMINANCE(RES_K(3.9), RES_K(10), RES_K(2), RES_K(3.3)) // R7, R8, R9, R10
7460MACHINE_CONFIG_END
7561
7662
trunk/src/mess/machine/tandy2kb.c
r23575r23576
1717
1818#define I8048_TAG       "m1"
1919
20enum
21{
22   LED_1 = 0,
23   LED_2
24};
2520
2621
2722//**************************************************************************
r23575r23576
246241      m_y9(*this, "Y9"),
247242      m_y10(*this, "Y10"),
248243      m_y11(*this, "Y11"),
244      m_write_clock(*this),
245      m_write_data(*this),
249246      m_keylatch(0xffff),
250247      m_clock(0),
251248      m_data(0)
252249{
253250}
254251
255//-------------------------------------------------
256//  device_config_complete - perform any
257//  operations now that the configuration is
258//  complete
259//-------------------------------------------------
260252
261void tandy2k_keyboard_device::device_config_complete()
262{
263   // inherit a copy of the static data
264   const tandy2k_keyboard_interface *intf = reinterpret_cast<const tandy2k_keyboard_interface *>(static_config());
265   if (intf != NULL)
266      *static_cast<tandy2k_keyboard_interface *>(this) = *intf;
267
268   // or initialize to defaults if none provided
269   else
270   {
271      memset(&m_out_clock_cb, 0, sizeof(m_out_clock_cb));
272      memset(&m_out_data_cb, 0, sizeof(m_out_data_cb));
273   }
274}
275
276253//-------------------------------------------------
277254//  device_start - device-specific startup
278255//-------------------------------------------------
r23575r23576
280257void tandy2k_keyboard_device::device_start()
281258{
282259   // resolve callbacks
283   m_out_clock_func.resolve(m_out_clock_cb, *this);
284   m_out_data_func.resolve(m_out_data_cb, *this);
260   m_write_clock.resolve_safe();
261   m_write_data.resolve_safe();
285262
286263   // state saving
287264   save_item(NAME(m_keylatch));
r23575r23576
441418   {
442419      m_clock = clock;
443420
444      m_out_clock_func(m_clock);
421      m_write_clock(m_clock);
445422   }
446423
447424   // keyboard data
r23575r23576
451428   {
452429      m_data = kbddat;
453430
454      m_out_data_func(m_data);
431      m_write_data(m_data);
455432   }
456433}
trunk/src/mess/machine/tandy2kb.h
r23575r23576
1212#ifndef __TANDY2K_KEYBOARD__
1313#define __TANDY2K_KEYBOARD__
1414
15
1615#include "emu.h"
1716#include "cpu/mcs48/mcs48.h"
1817
r23575r23576
3029//  INTERFACE CONFIGURATION MACROS
3130//**************************************************************************
3231
33#define MCFG_TANDY2K_KEYBOARD_ADD(_config) \
32#define MCFG_TANDY2K_KEYBOARD_ADD(_clock, _data) \
3433   MCFG_DEVICE_ADD(TANDY2K_KEYBOARD_TAG, TANDY2K_KEYBOARD, 0) \
35   MCFG_DEVICE_CONFIG(_config)
34   downcast<tandy2k_keyboard_device *>(device)->set_clock_callback(DEVCB2_##_clock); \
35   downcast<tandy2k_keyboard_device *>(device)->set_data_callback(DEVCB2_##_data);
3636
3737
38#define TANDY2K_KEYBOARD_INTERFACE(_name) \
39   const tandy2k_keyboard_interface (_name) =
4038
41
42
4339//**************************************************************************
4440//  TYPE DEFINITIONS
4541//**************************************************************************
4642
47// ======================> tandy2k_keyboard_interface
48
49struct tandy2k_keyboard_interface
50{
51   devcb_write_line    m_out_clock_cb;
52   devcb_write_line    m_out_data_cb;
53};
54
55
5643// ======================> tandy2k_keyboard_device
5744
58class tandy2k_keyboard_device :  public device_t,
59                           public tandy2k_keyboard_interface
45class tandy2k_keyboard_device :  public device_t
6046{
6147public:
6248   // construction/destruction
6349   tandy2k_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
6450
51   template<class _clock> void set_clock_callback(_clock clock) { m_write_clock.set_callback(clock); }
52   template<class _data> void set_data_callback(_data data) { m_write_data.set_callback(data); }
53
6554   // optional information overrides
6655   virtual const rom_entry *device_rom_region() const;
6756   virtual machine_config_constructor device_mconfig_additions() const;
r23575r23576
8170   // device-level overrides
8271   virtual void device_start();
8372   virtual void device_reset();
84   virtual void device_config_complete();
8573
8674private:
87   devcb_resolved_write_line   m_out_clock_func;
88   devcb_resolved_write_line   m_out_data_func;
75   enum
76   {
77      LED_1 = 0,
78      LED_2
79   };
8980
9081   required_device<cpu_device> m_maincpu;
9182   required_ioport m_y0;
r23575r23576
10192   required_ioport m_y10;
10293   required_ioport m_y11;
10394
95   devcb2_write_line   m_write_clock;
96   devcb2_write_line   m_write_data;
97
10498   UINT16 m_keylatch;
10599
106100   int m_clock;
trunk/src/mess/machine/trs80m2kb.c
r23575r23576
1818#define I8021_TAG       "z4"
1919
2020
21enum
22{
23   LED_0 = 0,
24   LED_1
25};
2621
27
28
2922//**************************************************************************
3023//  DEVICE DEFINITIONS
3124//**************************************************************************
r23575r23576
249242      m_y9(*this, "Y9"),
250243      m_ya(*this, "YA"),
251244      m_yb(*this, "YB"),
245      m_write_clock(*this),
252246      m_busy(1),
253247      m_data(1),
254248      m_clk(0)
r23575r23576
257251
258252
259253//-------------------------------------------------
260//  device_config_complete - perform any
261//  operations now that the configuration is
262//  complete
263//-------------------------------------------------
264
265void trs80m2_keyboard_device::device_config_complete()
266{
267   // inherit a copy of the static data
268   const trs80m2_keyboard_interface *intf = reinterpret_cast<const trs80m2_keyboard_interface *>(static_config());
269   if (intf != NULL)
270      *static_cast<trs80m2_keyboard_interface *>(this) = *intf;
271
272   // or initialize to defaults if none provided
273   else
274   {
275      memset(&m_out_clock_cb, 0, sizeof(m_out_clock_cb));
276   }
277}
278
279
280//-------------------------------------------------
281254//  device_start - device-specific startup
282255//-------------------------------------------------
283256
284257void trs80m2_keyboard_device::device_start()
285258{
286259   // resolve callbacks
287   m_out_clock_func.resolve(m_out_clock_cb, *this);
260   m_write_clock.resolve_safe();
288261
289262   // state saving
290263   save_item(NAME(m_busy));
r23575r23576
386359
387360   if (m_clk != clk)
388361   {
389      m_out_clock_func(clk);
362      m_write_clock(clk);
390363      m_clk = clk;
391364   }
392365
trunk/src/mess/machine/trs80m2kb.h
r23575r23576
1212#ifndef __TRS80M2_KEYBOARD__
1313#define __TRS80M2_KEYBOARD__
1414
15
1615#include "emu.h"
1716#include "cpu/mcs48/mcs48.h"
1817#include "sound/discrete.h"
r23575r23576
3130//  INTERFACE CONFIGURATION MACROS
3231//**************************************************************************
3332
34#define MCFG_TRS80M2_KEYBOARD_ADD(_config) \
33#define MCFG_TRS80M2_KEYBOARD_ADD(_clock) \
3534   MCFG_DEVICE_ADD(TRS80M2_KEYBOARD_TAG, TRS80M2_KEYBOARD, 0) \
36   MCFG_DEVICE_CONFIG(_config)
35   downcast<trs80m2_keyboard_device *>(device)->set_clock_callback(DEVCB2_##_clock);
3736
3837
39#define TRS80M2_KEYBOARD_INTERFACE(_name) \
40   const trs80m2_keyboard_interface (_name) =
4138
42
43
4439//**************************************************************************
4540//  TYPE DEFINITIONS
4641//**************************************************************************
4742
48// ======================> trs80m2_keyboard_interface
49
50struct trs80m2_keyboard_interface
51{
52   devcb_write_line    m_out_clock_cb;
53};
54
55
5643// ======================> trs80m2_keyboard_device
5744
58class trs80m2_keyboard_device :  public device_t,
59                           public trs80m2_keyboard_interface
45class trs80m2_keyboard_device :  public device_t
6046{
6147public:
6248   // construction/destruction
6349   trs80m2_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
6450
51   template<class _clock> void set_clock_callback(_clock clock) { m_write_clock.set_callback(clock); }
52
6553   // optional information overrides
6654   virtual const rom_entry *device_rom_region() const;
6755   virtual machine_config_constructor device_mconfig_additions() const;
r23575r23576
8068   // device-level overrides
8169   virtual void device_start();
8270   virtual void device_reset();
83   virtual void device_config_complete();
8471
8572private:
86   devcb_resolved_write_line   m_out_clock_func;
73   enum
74   {
75      LED_0 = 0,
76      LED_1
77   };
8778
8879   required_device<cpu_device> m_maincpu;
8980   required_ioport m_y0;
r23575r23576
9990   required_ioport m_ya;
10091   required_ioport m_yb;
10192
93   devcb2_write_line   m_write_clock;
94
10295   int m_busy;
10396   int m_data;
10497   int m_clk;
trunk/src/mess/machine/v1050kb.c
r23575r23576
2727const device_type V1050_KEYBOARD = &device_creator<v1050_keyboard_device>;
2828
2929
30
3130//-------------------------------------------------
3231//  ROM( v1050_keyboard )
3332//-------------------------------------------------
trunk/src/mess/machine/v1050kb.h
r23575r23576
1212#ifndef __V1050_KEYBOARD__
1313#define __V1050_KEYBOARD__
1414
15
1615#include "emu.h"
1716#include "cpu/mcs48/mcs48.h"
1817#include "sound/discrete.h"
r23575r23576
3534   MCFG_DEVICE_ADD(V1050_KEYBOARD_TAG, V1050_KEYBOARD, 0)
3635
3736
38#define V1050_KEYBOARD_INTERFACE(_name) \
39   const V1050_keyboard_interface (_name) =
4037
41
42
4338//**************************************************************************
4439//  TYPE DEFINITIONS
4540//**************************************************************************
trunk/src/mess/machine/vp575.c
r23575r23576
5858WRITE_LINE_MEMBER( vp575_device::exp4_dma_in_w ) { m_dma_in[3] = state; update_interrupts(); }
5959WRITE_LINE_MEMBER( vp575_device::exp5_dma_in_w ) { m_dma_in[4] = state; update_interrupts(); }
6060
61static VIP_EXPANSION_INTERFACE( expansion1_intf )
62{
63   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp1_int_w),
64   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp1_dma_out_w),
65   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp1_dma_in_w)
66};
6761
68static VIP_EXPANSION_INTERFACE( expansion2_intf )
69{
70   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp2_int_w),
71   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp2_dma_out_w),
72   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp2_dma_in_w)
73};
74
75static VIP_EXPANSION_INTERFACE( expansion3_intf )
76{
77   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp3_int_w),
78   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp3_dma_out_w),
79   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp3_dma_in_w)
80};
81
82static VIP_EXPANSION_INTERFACE( expansion4_intf )
83{
84   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp4_int_w),
85   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp4_dma_out_w),
86   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp4_dma_in_w)
87};
88
89static VIP_EXPANSION_INTERFACE( expansion5_intf )
90{
91   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp5_int_w),
92   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp5_dma_out_w),
93   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vp575_device, exp5_dma_in_w)
94};
95
96
9762//-------------------------------------------------
9863//  MACHINE_CONFIG_FRAGMENT( vp575 )
9964//-------------------------------------------------
10065
10166static MACHINE_CONFIG_FRAGMENT( vp575 )
102   MCFG_VIP_EXPANSION_SLOT_ADD("exp1", XTAL_3_52128MHz/2, expansion1_intf, vip_expansion_cards, NULL)
103   MCFG_VIP_EXPANSION_SLOT_ADD("exp2", XTAL_3_52128MHz/2, expansion2_intf, vip_expansion_cards, NULL)
104   MCFG_VIP_EXPANSION_SLOT_ADD("exp3", XTAL_3_52128MHz/2, expansion3_intf, vip_expansion_cards, NULL)
105   MCFG_VIP_EXPANSION_SLOT_ADD("exp4", XTAL_3_52128MHz/2, expansion4_intf, vip_expansion_cards, NULL)
106   MCFG_VIP_EXPANSION_SLOT_ADD("exp5", XTAL_3_52128MHz/2, expansion5_intf, vip_expansion_cards, NULL)
67   MCFG_VIP_EXPANSION_SLOT_ADD("exp1", XTAL_3_52128MHz/2, vip_expansion_cards, NULL)
68    MCFG_VIP_EXPANSION_SLOT_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp1_int_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp1_dma_out_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp1_dma_in_w))
69   MCFG_VIP_EXPANSION_SLOT_ADD("exp2", XTAL_3_52128MHz/2, vip_expansion_cards, NULL)
70    MCFG_VIP_EXPANSION_SLOT_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp2_int_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp2_dma_out_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp2_dma_in_w))
71   MCFG_VIP_EXPANSION_SLOT_ADD("exp3", XTAL_3_52128MHz/2, vip_expansion_cards, NULL)
72    MCFG_VIP_EXPANSION_SLOT_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp3_int_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp3_dma_out_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp3_dma_in_w))
73   MCFG_VIP_EXPANSION_SLOT_ADD("exp4", XTAL_3_52128MHz/2, vip_expansion_cards, NULL)
74    MCFG_VIP_EXPANSION_SLOT_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp4_int_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp4_dma_out_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp4_dma_in_w))
75   MCFG_VIP_EXPANSION_SLOT_ADD("exp5", XTAL_3_52128MHz/2, vip_expansion_cards, NULL)
76    MCFG_VIP_EXPANSION_SLOT_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp5_int_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp5_dma_out_w), DEVWRITELINE(DEVICE_SELF_OWNER, vp575_device, exp5_dma_in_w))
10777MACHINE_CONFIG_END
10878
10979
trunk/src/mess/machine/vip_byteio.c
r23575r23576
3434}
3535
3636
37//-------------------------------------------------
38//  ~device_vip_byteio_port_interface - destructor
39//-------------------------------------------------
4037
41device_vip_byteio_port_interface::~device_vip_byteio_port_interface()
42{
43}
44
45
46
4738//**************************************************************************
4839//  LIVE DEVICE
4940//**************************************************************************
r23575r23576
5445
5546vip_byteio_port_device::vip_byteio_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
5647      device_t(mconfig, VIP_BYTEIO_PORT, "VIP byte I/O port", tag, owner, clock),
57      device_slot_interface(mconfig, *this)
48      device_slot_interface(mconfig, *this),
49      m_write_inst(*this)
5850{
5951}
6052
61
6253//-------------------------------------------------
63//  vip_byteio_port_device - destructor
64//-------------------------------------------------
65
66vip_byteio_port_device::~vip_byteio_port_device()
67{
68}
69
70
71//-------------------------------------------------
72//  device_config_complete - perform any
73//  operations now that the configuration is
74//  complete
75//-------------------------------------------------
76
77void vip_byteio_port_device::device_config_complete()
78{
79   // inherit a copy of the static data
80   const vip_byteio_port_interface *intf = reinterpret_cast<const vip_byteio_port_interface *>(static_config());
81   if (intf != NULL)
82   {
83      *static_cast<vip_byteio_port_interface *>(this) = *intf;
84   }
85
86   // or initialize to defaults if none provided
87   else
88   {
89      memset(&m_out_inst_cb, 0, sizeof(m_out_inst_cb));
90   }
91}
92
93
94//-------------------------------------------------
9554//  device_start - device-specific startup
9655//-------------------------------------------------
9756
r23575r23576
10059   m_cart = dynamic_cast<device_vip_byteio_port_interface *>(get_card_device());
10160
10261   // resolve callbacks
103   m_out_inst_func.resolve(m_out_inst_cb, *this);
62   m_write_inst.resolve_safe();
10463}
10564
10665
r23575r23576
11978READ_LINE_MEMBER( vip_byteio_port_device::ef4_r ) { int state = CLEAR_LINE; if (m_cart != NULL) state = m_cart->vip_ef4_r(); return state; }
12079WRITE_LINE_MEMBER( vip_byteio_port_device::q_w ) { if (m_cart != NULL) m_cart->vip_q_w(state); }
12180
122WRITE_LINE_MEMBER( vip_byteio_port_device::inst_w ) { m_out_inst_func(state); }
12381
124
12582//-------------------------------------------------
12683//  SLOT_INTERFACE( vip_byteio_cards )
12784//-------------------------------------------------
trunk/src/mess/machine/vip_byteio.h
r23575r23576
5353//  INTERFACE CONFIGURATION MACROS
5454//**************************************************************************
5555
56#define VIP_BYTEIO_PORT_INTERFACE(_name) \
57   const vip_byteio_port_interface (_name) =
58
59
60#define MCFG_VIP_BYTEIO_PORT_ADD(_tag, _config, _slot_intf, _def_slot) \
56#define MCFG_VIP_BYTEIO_PORT_ADD(_tag, _slot_intf, _def_slot, _inst) \
6157   MCFG_DEVICE_ADD(_tag, VIP_BYTEIO_PORT, 0) \
62   MCFG_DEVICE_CONFIG(_config) \
63   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
58   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false) \
59   downcast<vip_byteio_port_device *>(device)->set_inst_callback(DEVCB2_##_inst);
6460
6561
6662
r23575r23576
6864//  TYPE DEFINITIONS
6965//**************************************************************************
7066
71// ======================> vip_byteio_port_interface
72
73struct vip_byteio_port_interface
74{
75   devcb_write_line    m_out_inst_cb;
76};
77
78
7967// ======================> vip_byteio_port_device
8068
8169class device_vip_byteio_port_interface;
8270
8371class vip_byteio_port_device : public device_t,
84                        public vip_byteio_port_interface,
8572                        public device_slot_interface
8673{
8774public:
8875   // construction/destruction
8976   vip_byteio_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
90   virtual ~vip_byteio_port_device();
9177
78   template<class _inst> void set_inst_callback(_inst inst) { m_write_inst.set_callback(inst); }
79
9280   // computer interface
9381   UINT8 in_r();
9482   void out_w(UINT8 data);
r23575r23576
9785   DECLARE_WRITE_LINE_MEMBER( q_w );
9886
9987   // cartridge interface
100   DECLARE_WRITE_LINE_MEMBER( inst_w );
88   DECLARE_WRITE_LINE_MEMBER( inst_w ) { m_write_inst(state); }
10189
10290protected:
10391   // device-level overrides
10492   virtual void device_start();
10593   virtual void device_reset();
106   virtual void device_config_complete();
10794
108   devcb_resolved_write_line   m_out_inst_func;
95   devcb2_write_line m_write_inst;
10996
11097   device_vip_byteio_port_interface *m_cart;
11198};
r23575r23576
119106public:
120107   // construction/destruction
121108   device_vip_byteio_port_interface(const machine_config &mconfig, device_t &device);
122   virtual ~device_vip_byteio_port_interface();
123109
124110   virtual UINT8 vip_in_r() { return 0xff; };
125111   virtual void vip_out_w(UINT8 data) { };
trunk/src/mess/video/tmc1800.c
r23575r23576
55#include "sound/cdp1864.h"
66#include "machine/rescap.h"
77
8/* Telmac 1800 */
9
10static CDP1861_INTERFACE( tmc1800_cdp1861_intf )
11{
12   CDP1802_TAG,
13   SCREEN_TAG,
14   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
15   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT),
16   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1)
17};
18
198/* Telmac 2000 */
209
2110READ_LINE_MEMBER( tmc2000_state::rdata_r )
r23575r23576
3322   return BIT(m_color, 0);
3423}
3524
36static CDP1864_INTERFACE( tmc2000_cdp1864_intf )
37{
38   CDP1802_TAG,
39   SCREEN_TAG,
40   CDP1864_INTERLACED,
41   DEVCB_DRIVER_LINE_MEMBER(tmc2000_state, rdata_r),
42   DEVCB_DRIVER_LINE_MEMBER(tmc2000_state, bdata_r),
43   DEVCB_DRIVER_LINE_MEMBER(tmc2000_state, gdata_r),
44   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
45   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT),
46   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1),
47   DEVCB_NULL,
48   RES_K(1.21),    // RL64
49   RES_K(2.05),    // RL63
50   RES_K(2.26),    // RL61
51   RES_K(3.92)     // RL65 (also RH62 (2K pot) in series, but ignored here)
52};
53
54/* OSCOM Nano */
55
56static CDP1864_INTERFACE( nano_cdp1864_intf )
57{
58   CDP1802_TAG,
59   SCREEN_TAG,
60   CDP1864_INTERLACED,
61   DEVCB_LINE_VCC,
62   DEVCB_LINE_VCC,
63   DEVCB_LINE_VCC,
64   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT),
65   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT),
66   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1),
67   DEVCB_NULL,
68   RES_K(1.21), // R18 unconfirmed
69   0, // not connected
70   0, // not connected
71   0  // not connected
72};
73
7425/* OSM-200 */
7526
7627UINT32 osc1000b_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
r23575r23576
8233
8334MACHINE_CONFIG_FRAGMENT( tmc1800_video )
8435   MCFG_CDP1861_SCREEN_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_1_75MHz)
85   MCFG_CDP1861_ADD(CDP1861_TAG, XTAL_1_75MHz, tmc1800_cdp1861_intf)
36   MCFG_CDP1861_ADD(CDP1861_TAG, SCREEN_TAG, XTAL_1_75MHz, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1))
8637MACHINE_CONFIG_END
8738
8839MACHINE_CONFIG_FRAGMENT( osc1000b_video )
r23575r23576
9849   MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update)
9950
10051   MCFG_SPEAKER_STANDARD_MONO("mono")
101   MCFG_CDP1864_ADD(CDP1864_TAG, XTAL_1_75MHz, tmc2000_cdp1864_intf)
52   MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, READLINE(tmc2000_state, rdata_r), READLINE(tmc2000_state, bdata_r), READLINE(tmc2000_state, gdata_r))
53   MCFG_CDP1864_CHROMINANCE(RES_K(1.21), RES_K(2.05), RES_K(2.26), RES_K(3.92)) // RL64, RL63, RL61, RL65 (also RH62 (2K pot) in series, but ignored here)
10254   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
10355MACHINE_CONFIG_END
10456
r23575r23576
10759   MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update)
10860
10961   MCFG_SPEAKER_STANDARD_MONO("mono")
110   MCFG_CDP1864_ADD(CDP1864_TAG, XTAL_1_75MHz, nano_cdp1864_intf)
62   MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL_1_75MHz, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NULL, VCC, VCC, VCC)
63   MCFG_CDP1864_CHROMINANCE(RES_K(1.21), 0, 0, 0) // R18 (unconfirmed)
11164   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
11265MACHINE_CONFIG_END

Previous 199869 Revisions Next


© 1997-2024 The MAME Team