Previous 15994 Revisions Next

r4228 Wednesday 4th February, 2009 at 11:46:21 UTC by Curt Coder
[CDP1864] Refactored to use devcb.
[docs]messnew.txt
[src/mess/drivers]studio2.c tmc2000e.c vip.c
[src/mess/video]cdp1861.c cdp1861.h cdp1864.c cdp1864.h tmc1800.c

src/mess/video/tmc1800.c
r4227r4228
3434
3535/* Telmac 2000 */
3636
37static CDP1864_ON_INT_CHANGED( tmc2000_int_w )
37static WRITE_LINE_DEVICE_HANDLER( tmc2000_efx_w )
3838{
39   cpu_set_input_line(device->machine->cpu[0], CDP1802_INPUT_LINE_INT, level);
40}
39   tmc2000_state *driver_state = device->machine->driver_data;
4140
42static CDP1864_ON_DMAO_CHANGED( tmc2000_dmao_w )
43{
44   cpu_set_input_line(device->machine->cpu[0], CDP1802_INPUT_LINE_DMAOUT, level);
41   driver_state->cdp1864_efx = state;
4542}
4643
47static CDP1864_ON_EFX_CHANGED( tmc2000_efx_w )
48{
49   tmc2000_state *state = device->machine->driver_data;
50
51   state->cdp1864_efx = level;
52}
53
5444static CDP1864_INTERFACE( tmc2000_cdp1864_intf )
5545{
46   CDP1802_TAG,
5647   SCREEN_TAG,
5748   CDP1864_INTERLACED,
58   tmc2000_int_w,
59   tmc2000_dmao_w,
60   tmc2000_efx_w,
49   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, CDP1802_INPUT_LINE_INT),
50   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, CDP1802_INPUT_LINE_DMAOUT),
51   DEVCB_LINE(tmc2000_efx_w),
6152   RES_K(1.21),   // RL64
6253   RES_K(2.05),   // RL63
6354   RES_K(2.26),   // RL61
r4227r4228
7566
7667/* OSCOM Nano */
7768
78static CDP1864_ON_INT_CHANGED( oscnano_int_w )
69static WRITE_LINE_DEVICE_HANDLER( oscnano_efx_w )
7970{
80   cpu_set_input_line(device->machine->cpu[0], CDP1802_INPUT_LINE_INT, level);
81}
71   oscnano_state *driver_state = device->machine->driver_data;
8272
83static CDP1864_ON_DMAO_CHANGED( oscnano_dmao_w )
84{
85   cpu_set_input_line(device->machine->cpu[0], CDP1802_INPUT_LINE_DMAOUT, level);
73   driver_state->cdp1864_efx = state;
8674}
8775
88static CDP1864_ON_EFX_CHANGED( oscnano_efx_w )
89{
90   oscnano_state *state = device->machine->driver_data;
91
92   state->cdp1864_efx = level;
93}
94
9576static CDP1864_INTERFACE( oscnano_cdp1864_intf )
9677{
78   CDP1802_TAG,
9779   SCREEN_TAG,
9880   CDP1864_INTERLACED,
99   oscnano_int_w,
100   oscnano_dmao_w,
101   oscnano_efx_w,
81   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, CDP1802_INPUT_LINE_INT),
82   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, CDP1802_INPUT_LINE_DMAOUT),
83   DEVCB_LINE(oscnano_efx_w),
10284   RES_K(1.21), // R18 unconfirmed
10385   0, // not connected
10486   0, // not connected
r4227r4228
136118   MDRV_PALETTE_INIT(black_and_white)
137119   MDRV_VIDEO_UPDATE(tmc1800)
138120
139   MDRV_CDP1861_ADD(CDP1861_TAG, tmc1800_cdp1861_intf, XTAL_1_75MHz)
121   MDRV_CDP1861_ADD(CDP1861_TAG, XTAL_1_75MHz, tmc1800_cdp1861_intf)
140122MACHINE_DRIVER_END
141123
142124MACHINE_DRIVER_START( osc1000b_video )
src/mess/video/cdp1864.c
r4227r4228
2121#include "sound/beep.h"
2222#include "video/cdp1864.h"
2323
24/***************************************************************************
25    PARAMETERS
26***************************************************************************/
27
2428#define CDP1864_DEFAULT_LATCH   0x35
2529
2630#define CDP1864_CYCLES_DMA_START   2*8
2731#define CDP1864_CYCLES_DMA_ACTIVE   8*8
2832#define CDP1864_CYCLES_DMA_WAIT      6*8
2933
34static const int CDP1864_BACKGROUND_COLOR_SEQUENCE[] = { 2, 0, 1, 4 };
35
36/***************************************************************************
37    TYPE DEFINITIONS
38***************************************************************************/
39
3040typedef struct _cdp1864_t cdp1864_t;
3141struct _cdp1864_t
3242{
33   const cdp1864_interface *intf;   /* interface */
43   devcb_resolved_write_line   out_int_func;
44   devcb_resolved_write_line   out_dmao_func;
45   devcb_resolved_write_line   out_efx_func;
3446
3547   const device_config *screen;   /* screen */
3648   bitmap_t *bitmap;            /* bitmap */
r4227r4228
5163   emu_timer *int_timer;         /* interrupt timer */
5264   emu_timer *efx_timer;         /* EFx timer */
5365   emu_timer *dma_timer;         /* DMA timer */
66
67   const device_config *cpu;
5468};
5569
56static const int CDP1864_BACKGROUND_COLOR_SEQUENCE[] = { 2, 0, 1, 4 };
70/***************************************************************************
71    INLINE FUNCTIONS
72***************************************************************************/
5773
5874INLINE cdp1864_t *get_safe_token(const device_config *device)
5975{
r4227r4228
6379   return (cdp1864_t *)device->token;
6480}
6581
66/* Timer Callbacks */
82INLINE const cdp1864_interface *get_interface(const device_config *device)
83{
84   assert(device != NULL);
85   assert((device->type == CDP1864));
86   return (const cdp1864_interface *) device->static_config;
87}
6788
68static TIMER_CALLBACK(cdp1864_int_tick)
89/***************************************************************************
90    IMPLEMENTATION
91***************************************************************************/
92
93/*-------------------------------------------------
94    TIMER_CALLBACK( cdp1864_int_tick )
95-------------------------------------------------*/
96
97static TIMER_CALLBACK( cdp1864_int_tick )
6998{
7099   const device_config *device = ptr;
71100   cdp1864_t *cdp1864 = get_safe_token(device);
r4227r4228
76105   {
77106      if (cdp1864->disp)
78107      {
79         cdp1864->intf->on_int_changed(device, HOLD_LINE);
108         devcb_call_write_line(&cdp1864->out_int_func, ASSERT_LINE);
80109      }
81110
82111      timer_adjust_oneshot(cdp1864->int_timer, video_screen_get_time_until_pos(cdp1864->screen, CDP1864_SCANLINE_INT_END, 0), 0);
r4227r4228
85114   {
86115      if (cdp1864->disp)
87116      {
88         cdp1864->intf->on_int_changed(device, CLEAR_LINE);
117         devcb_call_write_line(&cdp1864->out_int_func, CLEAR_LINE);
89118      }
90119
91120      timer_adjust_oneshot(cdp1864->int_timer, video_screen_get_time_until_pos(cdp1864->screen, CDP1864_SCANLINE_INT_START, 0), 0);
92121   }
93122}
94123
95static TIMER_CALLBACK(cdp1864_efx_tick)
124/*-------------------------------------------------
125    TIMER_CALLBACK( cdp1864_efx_tick )
126-------------------------------------------------*/
127
128static TIMER_CALLBACK( cdp1864_efx_tick )
96129{
97130   const device_config *device = ptr;
98131   cdp1864_t *cdp1864 = get_safe_token(device);
r4227r4228
102135   switch (scanline)
103136   {
104137   case CDP1864_SCANLINE_EFX_TOP_START:
105      cdp1864->intf->on_efx_changed(device, ASSERT_LINE);
138      devcb_call_write_line(&cdp1864->out_efx_func, ASSERT_LINE);
106139      timer_adjust_oneshot(cdp1864->efx_timer, video_screen_get_time_until_pos(cdp1864->screen, CDP1864_SCANLINE_EFX_TOP_END, 0), 0);
107140      break;
108141
109142   case CDP1864_SCANLINE_EFX_TOP_END:
110      cdp1864->intf->on_efx_changed(device, CLEAR_LINE);
143      devcb_call_write_line(&cdp1864->out_efx_func, CLEAR_LINE);
111144      timer_adjust_oneshot(cdp1864->efx_timer, video_screen_get_time_until_pos(cdp1864->screen, CDP1864_SCANLINE_EFX_BOTTOM_START, 0), 0);
112145      break;
113146
114147   case CDP1864_SCANLINE_EFX_BOTTOM_START:
115      cdp1864->intf->on_efx_changed(device, ASSERT_LINE);
148      devcb_call_write_line(&cdp1864->out_efx_func, ASSERT_LINE);
116149      timer_adjust_oneshot(cdp1864->efx_timer, video_screen_get_time_until_pos(cdp1864->screen, CDP1864_SCANLINE_EFX_BOTTOM_END, 0), 0);
117150      break;
118151
119152   case CDP1864_SCANLINE_EFX_BOTTOM_END:
120      cdp1864->intf->on_efx_changed(device, CLEAR_LINE);
153      devcb_call_write_line(&cdp1864->out_efx_func, CLEAR_LINE);
121154      timer_adjust_oneshot(cdp1864->efx_timer, video_screen_get_time_until_pos(cdp1864->screen, CDP1864_SCANLINE_EFX_TOP_START, 0), 0);
122155      break;
123156   }
124157}
125158
126static TIMER_CALLBACK(cdp1864_dma_tick)
159/*-------------------------------------------------
160    TIMER_CALLBACK( cdp1864_dma_tick )
161-------------------------------------------------*/
162
163static TIMER_CALLBACK( cdp1864_dma_tick )
127164{
128165   const device_config *device = ptr;
129166   cdp1864_t *cdp1864 = get_safe_token(device);
r4227r4228
136173      {
137174         if (scanline >= CDP1864_SCANLINE_DISPLAY_START && scanline < CDP1864_SCANLINE_DISPLAY_END)
138175         {
139            cdp1864->intf->on_dmao_changed(device, CLEAR_LINE);
176            devcb_call_write_line(&cdp1864->out_dmao_func, CLEAR_LINE);
140177         }
141178      }
142179
r4227r4228
150187      {
151188         if (scanline >= CDP1864_SCANLINE_DISPLAY_START && scanline < CDP1864_SCANLINE_DISPLAY_END)
152189         {
153            cdp1864->intf->on_dmao_changed(device, HOLD_LINE);
190            devcb_call_write_line(&cdp1864->out_dmao_func, ASSERT_LINE);
154191         }
155192      }
156193
r4227r4228
160197   }
161198}
162199
163/* Palette Initialization */
200/*-------------------------------------------------
201    cdp1864_init_palette - initialize palette
202-------------------------------------------------*/
164203
165static void cdp1864_init_palette(const device_config *device)
204static void cdp1864_init_palette(const device_config *device, const cdp1864_interface *intf)
166205{
167206   cdp1864_t *cdp1864 = get_safe_token(device);
168207   int i;
169208
170   double res_total = cdp1864->intf->res_r + cdp1864->intf->res_g + cdp1864->intf->res_b + cdp1864->intf->res_bkg;
209   double res_total = intf->res_r + intf->res_g + intf->res_b + intf->res_bkg;
171210
172   int weight_r = (cdp1864->intf->res_r / res_total) * 100;
173   int weight_g = (cdp1864->intf->res_g / res_total) * 100;
174   int weight_b = (cdp1864->intf->res_b / res_total) * 100;
175   int weight_bkg = (cdp1864->intf->res_bkg / res_total) * 100;
211   int weight_r = (intf->res_r / res_total) * 100;
212   int weight_g = (intf->res_g / res_total) * 100;
213   int weight_b = (intf->res_b / res_total) * 100;
214   int weight_bkg = (intf->res_bkg / res_total) * 100;
176215
177216   for (i = 0; i < 16; i++)
178217   {
r4227r4228
193232   }
194233}
195234
196/* Audio Output Enable */
235/*-------------------------------------------------
236    cdp1864_aoe_w - audio output enable
237-------------------------------------------------*/
197238
198239void cdp1864_aoe_w(const device_config *device, int level)
199240{
r4227r4228
209250   beep_set_state(0, level); // TODO: remove this
210251}
211252
212/* Display On/Off */
253/*-------------------------------------------------
254    cdp1864_dispon_r - turn display on
255-------------------------------------------------*/
213256
214257READ8_DEVICE_HANDLER( cdp1864_dispon_r )
215258{
r4227r4228
220263   return 0xff;
221264}
222265
266/*-------------------------------------------------
267    cdp1864_dispoff_r - turn display off
268-------------------------------------------------*/
269
223270READ8_DEVICE_HANDLER( cdp1864_dispoff_r )
224271{
225272   cdp1864_t *cdp1864 = get_safe_token(device);
226273
227274   cdp1864->disp = 0;
228275
229   cdp1864->intf->on_int_changed(device, CLEAR_LINE);
230   cdp1864->intf->on_dmao_changed(device, CLEAR_LINE);
276   devcb_call_write_line(&cdp1864->out_int_func, CLEAR_LINE);
277   devcb_call_write_line(&cdp1864->out_dmao_func, CLEAR_LINE);
231278
232279   return 0xff;
233280}
234281
235/* Step Background Color */
282/*-------------------------------------------------
283    cdp1864_step_bgcolor_w - step background color
284-------------------------------------------------*/
236285
237286WRITE8_DEVICE_HANDLER( cdp1864_step_bgcolor_w )
238287{
r4227r4228
243292   if (++cdp1864->bgcolor > 3) cdp1864->bgcolor = 0;
244293}
245294
246/* Load Tone Latch */
295/*-------------------------------------------------
296    cdp1864_tone_latch_w - load tone latch
297-------------------------------------------------*/
247298
248299WRITE8_DEVICE_HANDLER( cdp1864_tone_latch_w )
249300{
r4227r4228
253304   beep_set_frequency(0, CDP1864_CLOCK / 8 / 4 / (data + 1) / 2); // TODO: remove this
254305}
255306
256/* DMA Write */
307/*-------------------------------------------------
308    cdp1864_dma_w - write DMA byte
309-------------------------------------------------*/
257310
258311void cdp1864_dma_w(const device_config *device, UINT8 data, int color_on, int rdata, int gdata, int bdata)
259312{
r4227r4228
285338   }
286339}
287340
288/* Sound Update */
341/*-------------------------------------------------
342    cdp1864_sound_update - update sound
343-------------------------------------------------*/
289344
290345#ifdef UNUSED_FUNCTION
291346static void cdp1864_sound_update(const device_config *device, stream_sample_t **inputs, stream_sample_t **_buffer, int length)
r4227r4228
333388}
334389#endif
335390
336/* Screen Update */
391/*-------------------------------------------------
392    cdp1864_update - update screen
393-------------------------------------------------*/
337394
338395void cdp1864_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect)
339396{
r4227r4228
350407   }
351408}
352409
353/* Device Interface */
410/*-------------------------------------------------
411    DEVICE_START( cdp1864 )
412-------------------------------------------------*/
354413
355414static DEVICE_START( cdp1864 )
356415{
357416   cdp1864_t *cdp1864 = get_safe_token(device);
417   const cdp1864_interface *intf = get_interface(device);
358418
359   /* validate arguments */
360   assert(device != NULL);
361   assert(device->tag != NULL);
362   assert(device->clock > 0);
419   /* resolve callbacks */
420   devcb_resolve_write_line(&cdp1864->out_int_func, &intf->out_int_func, device);
421   devcb_resolve_write_line(&cdp1864->out_dmao_func, &intf->out_dmao_func, device);
422   devcb_resolve_write_line(&cdp1864->out_efx_func, &intf->out_efx_func, device);
363423
364   cdp1864->intf = device->static_config;
424   /* get the cpu */
425   cdp1864->cpu = cputag_get_cpu(device->machine, intf->cpu_tag);
365426
366   assert(cdp1864->intf != NULL);
367   assert(cdp1864->intf->on_int_changed != NULL);
368   assert(cdp1864->intf->on_dmao_changed != NULL);
369   assert(cdp1864->intf->on_efx_changed != NULL);
370
371427   /* get the screen device */
372   cdp1864->screen = devtag_get_device(device->machine, VIDEO_SCREEN, cdp1864->intf->screen_tag);
428   cdp1864->screen = devtag_get_device(device->machine, VIDEO_SCREEN, intf->screen_tag);
373429   assert(cdp1864->screen != NULL);
374430
375431   /* allocate the temporary bitmap */
r4227r4228
377433   bitmap_fill(cdp1864->bitmap, 0, CDP1864_BACKGROUND_COLOR_SEQUENCE[cdp1864->bgcolor] + 8);
378434
379435   /* initialize the palette */
380   cdp1864_init_palette(device);
436   cdp1864_init_palette(device, intf);
381437
382438   /* create the timers */
383439   cdp1864->int_timer = timer_alloc(device->machine, cdp1864_int_tick, (void *)device);
r4227r4228
397453   state_save_register_bitmap(device->machine, "cdp1864", device->tag, 0, "cdp1864->bitmap", cdp1864->bitmap);
398454}
399455
456/*-------------------------------------------------
457    DEVICE_RESET( cdp1861 )
458-------------------------------------------------*/
459
400460static DEVICE_RESET( cdp1864 )
401461{
402462   cdp1864_t *cdp1864 = get_safe_token(device);
r4227r4228
409469   cdp1864->dmaout = 0;
410470   cdp1864->bgcolor = 0;
411471
412   cdp1864->intf->on_int_changed(device, CLEAR_LINE);
413   cdp1864->intf->on_dmao_changed(device, CLEAR_LINE);
414   cdp1864->intf->on_efx_changed(device, CLEAR_LINE);
472   devcb_call_write_line(&cdp1864->out_int_func, CLEAR_LINE);
473   devcb_call_write_line(&cdp1864->out_dmao_func, CLEAR_LINE);
474   devcb_call_write_line(&cdp1864->out_efx_func, CLEAR_LINE);
415475
416476   cdp1864_aoe_w(device, 0);
417477}
418478
479/*-------------------------------------------------
480    DEVICE_SET_INFO( cdp1861 )
481-------------------------------------------------*/
482
419483static DEVICE_SET_INFO( cdp1864 )
420484{
421485   switch (state)
r4227r4228
424488   }
425489}
426490
491/*-------------------------------------------------
492    DEVICE_GET_INFO( cdp1861 )
493-------------------------------------------------*/
494
427495DEVICE_GET_INFO( cdp1864 )
428496{
429497   switch (state)
430498   {
431499      /* --- the following bits of info are returned as 64-bit signed integers --- */
432      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(cdp1864_t);            break;
433      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                        break;
434      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;         break;
500      case DEVINFO_INT_TOKEN_BYTES:               info->i = sizeof(cdp1864_t);                  break;
501      case DEVINFO_INT_INLINE_CONFIG_BYTES:         info->i = 0;                              break;
502      case DEVINFO_INT_CLASS:                     info->i = DEVICE_CLASS_PERIPHERAL;               break;
435503
436504      /* --- the following bits of info are returned as pointers to data or functions --- */
437      case DEVINFO_FCT_SET_INFO:                  info->set_info = DEVICE_SET_INFO_NAME(cdp1864); break;
438      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(cdp1864);   break;
439      case DEVINFO_FCT_STOP:                     /* Nothing */                        break;
440      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(cdp1864);   break;
505      case DEVINFO_FCT_SET_INFO:                  info->set_info = DEVICE_SET_INFO_NAME(cdp1864);      break;
506      case DEVINFO_FCT_START:                     info->start = DEVICE_START_NAME(cdp1864);         break;
507      case DEVINFO_FCT_STOP:                     /* Nothing */                              break;
508      case DEVINFO_FCT_RESET:                     info->reset = DEVICE_RESET_NAME(cdp1864);         break;
441509
442510      /* --- the following bits of info are returned as NULL-terminated strings --- */
443      case DEVINFO_STR_NAME:                     strcpy(info->s, "RCA CDP1861");               break;
444      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "RCA CDP1800");               break;
445      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                     break;
511      case DEVINFO_STR_NAME:                     strcpy(info->s, "RCA CDP1864");                  break;
512      case DEVINFO_STR_FAMILY:                  strcpy(info->s, "RCA CDP1800");                  break;
513      case DEVINFO_STR_VERSION:                  strcpy(info->s, "1.0");                        break;
446514      case DEVINFO_STR_SOURCE_FILE:               strcpy(info->s, __FILE__);                     break;
447      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");         break;
515      case DEVINFO_STR_CREDITS:                  strcpy(info->s, "Copyright MESS Team");            break;
448516   }
449517}
src/mess/video/cdp1864.h
r4227r4228
3232#ifndef __CDP1864__
3333#define __CDP1864__
3434
35#include "devcb.h"
36
37/***************************************************************************
38    PARAMETERS
39***************************************************************************/
40
3541#define CDP1864_CLOCK   XTAL_1_75MHz
3642
3743#define CDP1864_VISIBLE_COLUMNS   64
r4227r4228
6066#define CDP1864_SCANLINE_EFX_BOTTOM_START   CDP1864_SCANLINE_DISPLAY_END - 4
6167#define CDP1864_SCANLINE_EFX_BOTTOM_END      CDP1864_SCANLINE_DISPLAY_END
6268
63typedef void (*cdp1864_on_int_changed_func) (const device_config *device, int level);
64#define CDP1864_ON_INT_CHANGED(name) void name(const device_config *device, int level)
69/***************************************************************************
70    MACROS / CONSTANTS
71***************************************************************************/
6572
66typedef void (*cdp1864_on_dmao_changed_func) (const device_config *device, int level);
67#define CDP1864_ON_DMAO_CHANGED(name) void name(const device_config *device, int level)
68
69typedef void (*cdp1864_on_efx_changed_func) (const device_config *device, int level);
70#define CDP1864_ON_EFX_CHANGED(name) void name(const device_config *device, int level)
71
7273#define CDP1864      DEVICE_GET_INFO_NAME(cdp1864)
7374
7475#define MDRV_CDP1864_ADD(_tag, _clock, _config) \
7576   MDRV_DEVICE_ADD(_tag, CDP1864, _clock) \
7677   MDRV_DEVICE_CONFIG(_config)
7778
79#define CDP1864_INTERFACE(name) const cdp1864_interface (name)=
80
81/***************************************************************************
82    TYPE DEFINITIONS
83***************************************************************************/
84
7885typedef enum _cdp1864_format cdp1864_format;
7986enum _cdp1864_format {
8087   CDP1864_NON_INTERLACED = 0,
8188   CDP1864_INTERLACED
8289};
8390
84/* interface */
8591typedef struct _cdp1864_interface cdp1864_interface;
8692struct _cdp1864_interface
8793{
94   const char *cpu_tag;      /* cpu we are working with */
8895   const char *screen_tag;      /* screen we are acting on */
8996
9097   cdp1864_format interlace;   /* interlace */
9198
9299   /* this gets called for every change of the INT pin (pin 36) */
93   cdp1864_on_int_changed_func      on_int_changed;
100   devcb_write_line      out_int_func;
94101
95102   /* this gets called for every change of the DMAO pin (pin 37) */
96   cdp1864_on_dmao_changed_func   on_dmao_changed;
103   devcb_write_line      out_dmao_func;
97104
98105   /* this gets called for every change of the EFX pin (pin 18) */
99   cdp1864_on_efx_changed_func      on_efx_changed;
106   devcb_write_line      out_efx_func;
100107
101108   double res_r;            /* red output resistor value */
102109   double res_g;            /* green output resistor value */
103110   double res_b;            /* blue output resistor value */
104111   double res_bkg;            /* background output resistor value */
105112};
106#define CDP1864_INTERFACE(name) const cdp1864_interface (name)=
107113
114/***************************************************************************
115    PROTOTYPES
116***************************************************************************/
117
108118/* device interface */
109119DEVICE_GET_INFO( cdp1864 );
110120
src/mess/video/cdp1861.c
r4227r4228
5757    IMPLEMENTATION
5858***************************************************************************/
5959
60/* Timer Callbacks */
60/*-------------------------------------------------
61    TIMER_CALLBACK( cdp1861_int_tick )
62-------------------------------------------------*/
6163
6264static TIMER_CALLBACK( cdp1861_int_tick )
6365{
r4227r4228
8688   }
8789}
8890
91/*-------------------------------------------------
92    TIMER_CALLBACK( cdp1861_efx_tick )
93-------------------------------------------------*/
94
8995static TIMER_CALLBACK( cdp1861_efx_tick )
9096{
9197   const device_config *device = ptr;
r4227r4228
117123   }
118124}
119125
126/*-------------------------------------------------
127    TIMER_CALLBACK( cdp1861_dma_tick )
128-------------------------------------------------*/
129
120130static TIMER_CALLBACK( cdp1861_dma_tick )
121131{
122132   const device_config *device = ptr;
r4227r4228
154164   }
155165}
156166
157/* Display On/Off */
167/*-------------------------------------------------
168    cdp1861_dispon_r - turn display on
169-------------------------------------------------*/
158170
159171READ8_DEVICE_HANDLER( cdp1861_dispon_r )
160172{
r4227r4228
165177   return 0xff;
166178}
167179
180/*-------------------------------------------------
181    cdp1861_dispoff_r - turn display off
182-------------------------------------------------*/
183
168184WRITE8_DEVICE_HANDLER( cdp1861_dispoff_w )
169185{
170186   cdp1861_t *cdp1861 = get_safe_token(device);
r4227r4228
175191   devcb_call_write_line(&cdp1861->out_dmao_func, CLEAR_LINE);
176192}
177193
178/* DMA Write */
194/*-------------------------------------------------
195    cdp1861_dma_w - write DMA byte
196-------------------------------------------------*/
179197
180198void cdp1861_dma_w(const device_config *device, UINT8 data)
181199{
r4227r4228
193211   }
194212}
195213
196/* Screen Update */
214/*-------------------------------------------------
215    cdp1861_update - update screen
216-------------------------------------------------*/
197217
198218void cdp1861_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect)
199219{
r4227r4228
209229   }
210230}
211231
212/* Device Interface */
232/*-------------------------------------------------
233    DEVICE_START( cdp1861 )
234-------------------------------------------------*/
213235
214236static DEVICE_START( cdp1861 )
215237{
r4227r4228
242264   state_save_register_device_item_bitmap(device, 0, cdp1861->bitmap);
243265}
244266
267/*-------------------------------------------------
268    DEVICE_RESET( cdp1861 )
269-------------------------------------------------*/
270
245271static DEVICE_RESET( cdp1861 )
246272{
247273   cdp1861_t *cdp1861 = get_safe_token(device);
r4227r4228
258284   devcb_call_write_line(&cdp1861->out_efx_func, CLEAR_LINE);
259285}
260286
287/*-------------------------------------------------
288    DEVICE_SET_INFO( cdp1861 )
289-------------------------------------------------*/
290
261291static DEVICE_SET_INFO( cdp1861 )
262292{
263293   switch (state)
r4227r4228
266296   }
267297}
268298
299/*-------------------------------------------------
300    DEVICE_GET_INFO( cdp1861 )
301-------------------------------------------------*/
302
269303DEVICE_GET_INFO( cdp1861 )
270304{
271305   switch (state)
src/mess/video/cdp1861.h
r4227r4228
6060
6161#define CDP1861      DEVICE_GET_INFO_NAME(cdp1861)
6262
63#define MDRV_CDP1861_ADD(_tag, _config, _clock) \
63#define MDRV_CDP1861_ADD(_tag, _clock, _config) \
6464   MDRV_DEVICE_ADD(_tag, CDP1861, _clock) \
6565   MDRV_DEVICE_CONFIG(_config)
6666
src/mess/drivers/vip.c
r4227r4228
681681   MDRV_PALETTE_INIT(black_and_white)
682682   MDRV_VIDEO_UPDATE(vip)
683683
684   MDRV_CDP1861_ADD(CDP1861_TAG, vip_cdp1861_intf, XTAL_3_52128MHz)
684   MDRV_CDP1861_ADD(CDP1861_TAG, XTAL_3_52128MHz, vip_cdp1861_intf)
685685   MDRV_CDP1862_ADD(CDP1862_TAG, CPD1862_CLOCK, vip_cdp1862_intf)
686686
687687   /* sound hardware */
src/mess/drivers/studio2.c
r4227r4228
302302   return 0;
303303}
304304
305static CDP1864_ON_INT_CHANGED( mpt02_int_w )
305static WRITE_LINE_DEVICE_HANDLER( mpt02_efx_w )
306306{
307   cputag_set_input_line(device->machine, CDP1802_TAG, CDP1802_INPUT_LINE_INT, level);
308}
307   studio2_state *driver_state = device->machine->driver_data;
309308
310static CDP1864_ON_DMAO_CHANGED( mpt02_dmao_w )
311{
312   cputag_set_input_line(device->machine, CDP1802_TAG, CDP1802_INPUT_LINE_DMAOUT, level);
309   driver_state->cdp1864_efx = state;
313310}
314311
315static CDP1864_ON_EFX_CHANGED( mpt02_efx_w )
316{
317   studio2_state *state = device->machine->driver_data;
318
319   state->cdp1864_efx = level;
320}
321
322312static CDP1864_INTERFACE( mpt02_cdp1864_intf )
323313{
314   CDP1802_TAG,
324315   SCREEN_TAG,
325316   CDP1864_INTERLACED,
326   mpt02_int_w,
327   mpt02_dmao_w,
328   mpt02_efx_w,
317   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, CDP1802_INPUT_LINE_INT),
318   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, CDP1802_INPUT_LINE_DMAOUT),
319   DEVCB_LINE(mpt02_efx_w),
329320   RES_K(2.2),   // unverified
330321   RES_K(1),   // unverified
331322   RES_K(5.1),   // unverified
r4227r4228
542533   MDRV_PALETTE_INIT(black_and_white)
543534   MDRV_VIDEO_UPDATE(studio2)
544535
545   MDRV_CDP1861_ADD(CDP1861_TAG, studio2_cdp1861_intf, XTAL_3_52128MHz)
536   MDRV_CDP1861_ADD(CDP1861_TAG, XTAL_3_52128MHz, studio2_cdp1861_intf)
546537
547538   // sound hardware
548539
r4227r4228
576567   MDRV_PALETTE_INIT(black_and_white)
577568   MDRV_VIDEO_UPDATE(studio2)
578569
579   MDRV_CDP1861_ADD(CDP1861_TAG, studio2_cdp1861_intf, XTAL_3_579545MHz/2/8)
570   MDRV_CDP1861_ADD(CDP1861_TAG, XTAL_3_579545MHz/2/8, studio2_cdp1861_intf)
580571
581572   // sound hardware
582573
src/mess/drivers/tmc2000e.c
r4227r4228
130130
131131/* Video */
132132
133static CDP1864_ON_INT_CHANGED( tmc2000e_int_w )
133static WRITE_LINE_DEVICE_HANDLER( tmc2000e_efx_w )
134134{
135   cpu_set_input_line(device->machine->cpu[0], CDP1802_INPUT_LINE_INT, level);
136}
135   tmc2000e_state *driver_state = device->machine->driver_data;
137136
138static CDP1864_ON_DMAO_CHANGED( tmc2000e_dmao_w )
139{
140   cpu_set_input_line(device->machine->cpu[0], CDP1802_INPUT_LINE_DMAOUT, level);
137   driver_state->cdp1864_efx = state;
141138}
142139
143static CDP1864_ON_EFX_CHANGED( tmc2000e_efx_w )
144{
145   tmc2000e_state *state = device->machine->driver_data;
146
147   state->cdp1864_efx = level;
148}
149
150140static CDP1864_INTERFACE( tmc2000e_cdp1864_intf )
151141{
142   CDP1802_TAG,
152143   SCREEN_TAG,
153144   CDP1864_INTERLACED,
154   tmc2000e_int_w,
155   tmc2000e_dmao_w,
156   tmc2000e_efx_w,
145   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, CDP1802_INPUT_LINE_INT),
146   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, CDP1802_INPUT_LINE_DMAOUT),
147   DEVCB_LINE(tmc2000e_efx_w),
157148   RES_K(2.2),   // unverified
158149   RES_K(1),   // unverified
159150   RES_K(5.1),   // unverified
r4227r4228
300291
301292   // basic system hardware
302293
303   MDRV_CPU_ADD("main", CDP1802, XTAL_1_75MHz)
294   MDRV_CPU_ADD(CDP1802_TAG, CDP1802, XTAL_1_75MHz)
304295   MDRV_CPU_PROGRAM_MAP(tmc2000e_map, 0)
305296   MDRV_CPU_IO_MAP(tmc2000e_io_map, 0)
306297   MDRV_CPU_CONFIG(tmc2000e_config)
r4227r4228
328319   /* printer */
329320   MDRV_PRINTER_ADD("printer")
330321
331   MDRV_CASSETTE_ADD( "cassette", tmc2000_cassette_config )
322   MDRV_CASSETTE_ADD("cassette", tmc2000_cassette_config)
332323MACHINE_DRIVER_END
333324
334325/* ROMs */
335326
336327ROM_START( tmc2000e )
337   ROM_REGION( 0x10000, "main", 0 )
328   ROM_REGION( 0x10000, CDP1802_TAG, 0 )
338329   ROM_LOAD( "1", 0xc000, 0x0800, NO_DUMP )
339330   ROM_LOAD( "2", 0xc800, 0x0800, NO_DUMP )
340331   ROM_LOAD( "3", 0xd000, 0x0800, NO_DUMP )
docs/messnew.txt
r4227r4228
7979
8080- Fixed image loading related memory leaks. [Curt Coder]
8181
82- Refactored the CDP1861, CDP1864, and CDP1871 devices to use devcb callbacks.
83  [Curt Coder]
8284
8385
86
84870.129
8588
8689New System Drivers Supported (in no particular order):

Previous 15994 Revisions Next


© 1998-2018 The MESS Team