mirror of
https://github.com/holub/mame
synced 2025-05-22 21:58:57 +03:00
Added CDP1864 sound core for MESS.
This commit is contained in:
parent
b75dfbb386
commit
f53dd256f5
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -795,6 +795,8 @@ src/emu/sound/cdda.c svneol=native#text/plain
|
||||
src/emu/sound/cdda.h svneol=native#text/plain
|
||||
src/emu/sound/cdp1863.c svneol=native#text/plain
|
||||
src/emu/sound/cdp1863.h svneol=native#text/plain
|
||||
src/emu/sound/cdp1864.c svneol=native#text/plain
|
||||
src/emu/sound/cdp1864.h svneol=native#text/plain
|
||||
src/emu/sound/cdp1869.c svneol=native#text/plain
|
||||
src/emu/sound/cdp1869.h svneol=native#text/plain
|
||||
src/emu/sound/cem3394.c svneol=native#text/plain
|
||||
|
523
src/emu/sound/cdp1864.c
Normal file
523
src/emu/sound/cdp1864.c
Normal file
@ -0,0 +1,523 @@
|
||||
/**********************************************************************
|
||||
|
||||
RCA CDP1864C COS/MOS PAL Compatible Color TV Interface
|
||||
|
||||
Copyright MESS Team.
|
||||
Visit http://mamedev.org for licensing and usage restrictions.
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
/*
|
||||
|
||||
TODO:
|
||||
|
||||
- interlace mode
|
||||
- PAL output, currently using RGB
|
||||
- cpu synchronization
|
||||
|
||||
SC1 and SC0 are used to provide CDP1864C-to-CPU synchronization for a jitter-free display.
|
||||
During every horizontal sync the CDP1864C samples SC0 and SC1 for SC0 = 1 and SC1 = 0
|
||||
(CDP1800 execute state). Detection of a fetch cycle causes the CDP1864C to skip cycles to
|
||||
attain synchronization. (i.e. picture moves 8 pixels to the right)
|
||||
|
||||
*/
|
||||
|
||||
#include "driver.h"
|
||||
#include "cdp1864.h"
|
||||
#include "sndintrf.h"
|
||||
#include "streams.h"
|
||||
#include "cpu/cdp1802/cdp1802.h"
|
||||
|
||||
/***************************************************************************
|
||||
PARAMETERS
|
||||
***************************************************************************/
|
||||
|
||||
#define CDP1864_DEFAULT_LATCH 0x35
|
||||
|
||||
#define CDP1864_CYCLES_DMA_START 2*8
|
||||
#define CDP1864_CYCLES_DMA_ACTIVE 8*8
|
||||
#define CDP1864_CYCLES_DMA_WAIT 6*8
|
||||
|
||||
static const int CDP1864_BACKGROUND_COLOR_SEQUENCE[] = { 2, 0, 1, 4 };
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
typedef struct _cdp1864_t cdp1864_t;
|
||||
struct _cdp1864_t
|
||||
{
|
||||
devcb_resolved_read_line in_rdata_func;
|
||||
devcb_resolved_read_line in_bdata_func;
|
||||
devcb_resolved_read_line in_gdata_func;
|
||||
devcb_resolved_write_line out_int_func;
|
||||
devcb_resolved_write_line out_dmao_func;
|
||||
devcb_resolved_write_line out_efx_func;
|
||||
|
||||
const device_config *screen; /* screen */
|
||||
bitmap_t *bitmap; /* bitmap */
|
||||
sound_stream *stream; /* sound output */
|
||||
|
||||
/* video state */
|
||||
int disp; /* display on */
|
||||
int dmaout; /* DMA request active */
|
||||
int bgcolor; /* background color */
|
||||
int con; /* color on */
|
||||
|
||||
/* sound state */
|
||||
int aoe; /* audio on */
|
||||
int latch; /* sound latch */
|
||||
INT16 signal; /* current signal */
|
||||
int incr; /* initial wave state */
|
||||
|
||||
/* timers */
|
||||
emu_timer *int_timer; /* interrupt timer */
|
||||
emu_timer *efx_timer; /* EFx timer */
|
||||
emu_timer *dma_timer; /* DMA timer */
|
||||
|
||||
const device_config *cpu;
|
||||
};
|
||||
|
||||
/***************************************************************************
|
||||
INLINE FUNCTIONS
|
||||
***************************************************************************/
|
||||
|
||||
INLINE cdp1864_t *get_safe_token(const device_config *device)
|
||||
{
|
||||
assert(device != NULL);
|
||||
assert(device->token != NULL);
|
||||
return (cdp1864_t *)device->token;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
IMPLEMENTATION
|
||||
***************************************************************************/
|
||||
|
||||
/*-------------------------------------------------
|
||||
TIMER_CALLBACK( cdp1864_int_tick )
|
||||
-------------------------------------------------*/
|
||||
|
||||
static TIMER_CALLBACK( cdp1864_int_tick )
|
||||
{
|
||||
const device_config *device = ptr;
|
||||
cdp1864_t *cdp1864 = get_safe_token(device);
|
||||
|
||||
int scanline = video_screen_get_vpos(cdp1864->screen);
|
||||
|
||||
if (scanline == CDP1864_SCANLINE_INT_START)
|
||||
{
|
||||
if (cdp1864->disp)
|
||||
{
|
||||
devcb_call_write_line(&cdp1864->out_int_func, ASSERT_LINE);
|
||||
}
|
||||
|
||||
timer_adjust_oneshot(cdp1864->int_timer, video_screen_get_time_until_pos(cdp1864->screen, CDP1864_SCANLINE_INT_END, 0), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cdp1864->disp)
|
||||
{
|
||||
devcb_call_write_line(&cdp1864->out_int_func, CLEAR_LINE);
|
||||
}
|
||||
|
||||
timer_adjust_oneshot(cdp1864->int_timer, video_screen_get_time_until_pos(cdp1864->screen, CDP1864_SCANLINE_INT_START, 0), 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
TIMER_CALLBACK( cdp1864_efx_tick )
|
||||
-------------------------------------------------*/
|
||||
|
||||
static TIMER_CALLBACK( cdp1864_efx_tick )
|
||||
{
|
||||
const device_config *device = ptr;
|
||||
cdp1864_t *cdp1864 = get_safe_token(device);
|
||||
|
||||
int scanline = video_screen_get_vpos(cdp1864->screen);
|
||||
|
||||
switch (scanline)
|
||||
{
|
||||
case CDP1864_SCANLINE_EFX_TOP_START:
|
||||
devcb_call_write_line(&cdp1864->out_efx_func, ASSERT_LINE);
|
||||
timer_adjust_oneshot(cdp1864->efx_timer, video_screen_get_time_until_pos(cdp1864->screen, CDP1864_SCANLINE_EFX_TOP_END, 0), 0);
|
||||
break;
|
||||
|
||||
case CDP1864_SCANLINE_EFX_TOP_END:
|
||||
devcb_call_write_line(&cdp1864->out_efx_func, CLEAR_LINE);
|
||||
timer_adjust_oneshot(cdp1864->efx_timer, video_screen_get_time_until_pos(cdp1864->screen, CDP1864_SCANLINE_EFX_BOTTOM_START, 0), 0);
|
||||
break;
|
||||
|
||||
case CDP1864_SCANLINE_EFX_BOTTOM_START:
|
||||
devcb_call_write_line(&cdp1864->out_efx_func, ASSERT_LINE);
|
||||
timer_adjust_oneshot(cdp1864->efx_timer, video_screen_get_time_until_pos(cdp1864->screen, CDP1864_SCANLINE_EFX_BOTTOM_END, 0), 0);
|
||||
break;
|
||||
|
||||
case CDP1864_SCANLINE_EFX_BOTTOM_END:
|
||||
devcb_call_write_line(&cdp1864->out_efx_func, CLEAR_LINE);
|
||||
timer_adjust_oneshot(cdp1864->efx_timer, video_screen_get_time_until_pos(cdp1864->screen, CDP1864_SCANLINE_EFX_TOP_START, 0), 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
TIMER_CALLBACK( cdp1864_dma_tick )
|
||||
-------------------------------------------------*/
|
||||
|
||||
static TIMER_CALLBACK( cdp1864_dma_tick )
|
||||
{
|
||||
const device_config *device = ptr;
|
||||
cdp1864_t *cdp1864 = get_safe_token(device);
|
||||
|
||||
int scanline = video_screen_get_vpos(cdp1864->screen);
|
||||
|
||||
if (cdp1864->dmaout)
|
||||
{
|
||||
if (cdp1864->disp)
|
||||
{
|
||||
if (scanline >= CDP1864_SCANLINE_DISPLAY_START && scanline < CDP1864_SCANLINE_DISPLAY_END)
|
||||
{
|
||||
devcb_call_write_line(&cdp1864->out_dmao_func, CLEAR_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
timer_adjust_oneshot(cdp1864->dma_timer, cpu_clocks_to_attotime(machine->firstcpu, CDP1864_CYCLES_DMA_WAIT), 0);
|
||||
|
||||
cdp1864->dmaout = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cdp1864->disp)
|
||||
{
|
||||
if (scanline >= CDP1864_SCANLINE_DISPLAY_START && scanline < CDP1864_SCANLINE_DISPLAY_END)
|
||||
{
|
||||
devcb_call_write_line(&cdp1864->out_dmao_func, ASSERT_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
timer_adjust_oneshot(cdp1864->dma_timer, cpu_clocks_to_attotime(machine->firstcpu, CDP1864_CYCLES_DMA_ACTIVE), 0);
|
||||
|
||||
cdp1864->dmaout = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
cdp1864_init_palette - initialize palette
|
||||
-------------------------------------------------*/
|
||||
|
||||
static void cdp1864_init_palette(const device_config *device, const cdp1864_interface *intf)
|
||||
{
|
||||
int i;
|
||||
|
||||
double res_total = intf->res_r + intf->res_g + intf->res_b + intf->res_bkg;
|
||||
|
||||
int weight_r = (intf->res_r / res_total) * 100;
|
||||
int weight_g = (intf->res_g / res_total) * 100;
|
||||
int weight_b = (intf->res_b / res_total) * 100;
|
||||
int weight_bkg = (intf->res_bkg / res_total) * 100;
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
int r, g, b, luma = 0;
|
||||
|
||||
luma += (i & 4) ? weight_r : 0;
|
||||
luma += (i & 1) ? weight_g : 0;
|
||||
luma += (i & 2) ? weight_b : 0;
|
||||
luma += (i & 8) ? 0 : weight_bkg;
|
||||
|
||||
luma = (luma * 0xff) / 100;
|
||||
|
||||
r = (i & 4) ? luma : 0;
|
||||
g = (i & 1) ? luma : 0;
|
||||
b = (i & 2) ? luma : 0;
|
||||
|
||||
palette_set_color_rgb( device->machine, i, r, g, b );
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
cdp1864_aoe_w - audio output enable
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE_LINE_DEVICE_HANDLER( cdp1864_aoe_w )
|
||||
{
|
||||
cdp1864_t *cdp1864 = get_safe_token(device);
|
||||
|
||||
if (!state)
|
||||
{
|
||||
cdp1864->latch = CDP1864_DEFAULT_LATCH;
|
||||
}
|
||||
|
||||
cdp1864->aoe = state;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
cdp1864_dispon_r - turn display on
|
||||
-------------------------------------------------*/
|
||||
|
||||
READ8_DEVICE_HANDLER( cdp1864_dispon_r )
|
||||
{
|
||||
cdp1864_t *cdp1864 = get_safe_token(device);
|
||||
|
||||
cdp1864->disp = 1;
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
cdp1864_dispoff_r - turn display off
|
||||
-------------------------------------------------*/
|
||||
|
||||
READ8_DEVICE_HANDLER( cdp1864_dispoff_r )
|
||||
{
|
||||
cdp1864_t *cdp1864 = get_safe_token(device);
|
||||
|
||||
cdp1864->disp = 0;
|
||||
|
||||
devcb_call_write_line(&cdp1864->out_int_func, CLEAR_LINE);
|
||||
devcb_call_write_line(&cdp1864->out_dmao_func, CLEAR_LINE);
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
cdp1864_step_bgcolor_w - step background color
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE8_DEVICE_HANDLER( cdp1864_step_bgcolor_w )
|
||||
{
|
||||
cdp1864_t *cdp1864 = get_safe_token(device);
|
||||
|
||||
cdp1864->disp = 1;
|
||||
|
||||
if (++cdp1864->bgcolor > 3) cdp1864->bgcolor = 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
cdp1864_con_w - color on write
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE_LINE_DEVICE_HANDLER( cdp1864_con_w )
|
||||
{
|
||||
cdp1864_t *cdp1864 = get_safe_token(device);
|
||||
|
||||
if (!state)
|
||||
{
|
||||
cdp1864->con = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
cdp1864_tone_latch_w - load tone latch
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE8_DEVICE_HANDLER( cdp1864_tone_latch_w )
|
||||
{
|
||||
cdp1864_t *cdp1864 = get_safe_token(device);
|
||||
|
||||
cdp1864->latch = data;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
cdp1864_dma_w - write DMA byte
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE8_DEVICE_HANDLER( cdp1864_dma_w )
|
||||
{
|
||||
cdp1864_t *cdp1864 = get_safe_token(device);
|
||||
|
||||
int rdata = 1, bdata = 1, gdata = 1;
|
||||
int sx = video_screen_get_hpos(cdp1864->screen) + 4;
|
||||
int y = video_screen_get_vpos(cdp1864->screen);
|
||||
int x;
|
||||
|
||||
if (!cdp1864->con)
|
||||
{
|
||||
rdata = devcb_call_read_line(&cdp1864->in_rdata_func);
|
||||
bdata = devcb_call_read_line(&cdp1864->in_bdata_func);
|
||||
gdata = devcb_call_read_line(&cdp1864->in_gdata_func);
|
||||
}
|
||||
|
||||
for (x = 0; x < 8; x++)
|
||||
{
|
||||
int color = CDP1864_BACKGROUND_COLOR_SEQUENCE[cdp1864->bgcolor] + 8;
|
||||
|
||||
if (BIT(data, 7))
|
||||
{
|
||||
color = (gdata << 2) | (bdata << 1) | rdata;
|
||||
}
|
||||
|
||||
*BITMAP_ADDR16(cdp1864->bitmap, y, sx + x) = color;
|
||||
|
||||
data <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
STREAM_UPDATE( cdp1864_stream_update )
|
||||
-------------------------------------------------*/
|
||||
|
||||
static STREAM_UPDATE( cdp1864_stream_update )
|
||||
{
|
||||
cdp1864_t *cdp1864 = get_safe_token(device);
|
||||
|
||||
INT16 signal = cdp1864->signal;
|
||||
stream_sample_t *buffer = outputs[0];
|
||||
|
||||
memset( buffer, 0, samples * sizeof(*buffer) );
|
||||
|
||||
if (cdp1864->aoe)
|
||||
{
|
||||
double frequency = cpu_get_clock(cdp1864->cpu) / 8 / 4 / (cdp1864->latch + 1) / 2;
|
||||
int rate = device->machine->sample_rate / 2;
|
||||
|
||||
/* get progress through wave */
|
||||
int incr = cdp1864->incr;
|
||||
|
||||
if (signal < 0)
|
||||
{
|
||||
signal = -0x7fff;
|
||||
}
|
||||
else
|
||||
{
|
||||
signal = 0x7fff;
|
||||
}
|
||||
|
||||
while( samples-- > 0 )
|
||||
{
|
||||
*buffer++ = signal;
|
||||
incr -= frequency;
|
||||
while( incr < 0 )
|
||||
{
|
||||
incr += rate;
|
||||
signal = -signal;
|
||||
}
|
||||
}
|
||||
|
||||
/* store progress through wave */
|
||||
cdp1864->incr = incr;
|
||||
cdp1864->signal = signal;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
cdp1864_update - update screen
|
||||
-------------------------------------------------*/
|
||||
|
||||
void cdp1864_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect)
|
||||
{
|
||||
cdp1864_t *cdp1864 = get_safe_token(device);
|
||||
|
||||
if (cdp1864->disp)
|
||||
{
|
||||
copybitmap(bitmap, cdp1864->bitmap, 0, 0, 0, 0, cliprect);
|
||||
bitmap_fill(cdp1864->bitmap, cliprect, CDP1864_BACKGROUND_COLOR_SEQUENCE[cdp1864->bgcolor] + 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
bitmap_fill(bitmap, cliprect, get_black_pen(device->machine));
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
DEVICE_START( cdp1864 )
|
||||
-------------------------------------------------*/
|
||||
|
||||
static DEVICE_START( cdp1864 )
|
||||
{
|
||||
cdp1864_t *cdp1864 = get_safe_token(device);
|
||||
const cdp1864_interface *intf = (const cdp1864_interface *) device->static_config;
|
||||
|
||||
/* resolve callbacks */
|
||||
devcb_resolve_read_line(&cdp1864->in_rdata_func, &intf->in_rdata_func, device);
|
||||
devcb_resolve_read_line(&cdp1864->in_bdata_func, &intf->in_bdata_func, device);
|
||||
devcb_resolve_read_line(&cdp1864->in_gdata_func, &intf->in_gdata_func, device);
|
||||
devcb_resolve_write_line(&cdp1864->out_int_func, &intf->out_int_func, device);
|
||||
devcb_resolve_write_line(&cdp1864->out_dmao_func, &intf->out_dmao_func, device);
|
||||
devcb_resolve_write_line(&cdp1864->out_efx_func, &intf->out_efx_func, device);
|
||||
|
||||
/* get the cpu */
|
||||
cdp1864->cpu = cputag_get_cpu(device->machine, intf->cpu_tag);
|
||||
|
||||
/* get the screen device */
|
||||
cdp1864->screen = devtag_get_device(device->machine, intf->screen_tag);
|
||||
assert(cdp1864->screen != NULL);
|
||||
|
||||
/* allocate the temporary bitmap */
|
||||
cdp1864->bitmap = auto_bitmap_alloc(device->machine, video_screen_get_width(cdp1864->screen), video_screen_get_height(cdp1864->screen), video_screen_get_format(cdp1864->screen));
|
||||
bitmap_fill(cdp1864->bitmap, 0, CDP1864_BACKGROUND_COLOR_SEQUENCE[cdp1864->bgcolor] + 8);
|
||||
|
||||
/* initialize the palette */
|
||||
cdp1864_init_palette(device, intf);
|
||||
|
||||
/* create sound stream */
|
||||
cdp1864->stream = stream_create(device, 0, 1, device->machine->sample_rate, cdp1864, cdp1864_stream_update);
|
||||
|
||||
/* create the timers */
|
||||
cdp1864->int_timer = timer_alloc(device->machine, cdp1864_int_tick, (void *)device);
|
||||
cdp1864->efx_timer = timer_alloc(device->machine, cdp1864_efx_tick, (void *)device);
|
||||
cdp1864->dma_timer = timer_alloc(device->machine, cdp1864_dma_tick, (void *)device);
|
||||
|
||||
/* register for state saving */
|
||||
state_save_register_device_item(device, 0, cdp1864->disp);
|
||||
state_save_register_device_item(device, 0, cdp1864->dmaout);
|
||||
state_save_register_device_item(device, 0, cdp1864->bgcolor);
|
||||
state_save_register_device_item(device, 0, cdp1864->con);
|
||||
|
||||
state_save_register_device_item(device, 0, cdp1864->aoe);
|
||||
state_save_register_device_item(device, 0, cdp1864->latch);
|
||||
state_save_register_device_item(device, 0, cdp1864->signal);
|
||||
state_save_register_device_item(device, 0, cdp1864->incr);
|
||||
|
||||
state_save_register_bitmap(device->machine, "cdp1864", device->tag, 0, "cdp1864->bitmap", cdp1864->bitmap);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
DEVICE_RESET( cdp1864 )
|
||||
-------------------------------------------------*/
|
||||
|
||||
static DEVICE_RESET( cdp1864 )
|
||||
{
|
||||
cdp1864_t *cdp1864 = get_safe_token(device);
|
||||
|
||||
timer_adjust_oneshot(cdp1864->int_timer, video_screen_get_time_until_pos(cdp1864->screen, CDP1864_SCANLINE_INT_START, 0), 0);
|
||||
timer_adjust_oneshot(cdp1864->efx_timer, video_screen_get_time_until_pos(cdp1864->screen, CDP1864_SCANLINE_EFX_TOP_START, 0), 0);
|
||||
timer_adjust_oneshot(cdp1864->dma_timer, cpu_clocks_to_attotime(device->machine->firstcpu, CDP1864_CYCLES_DMA_START), 0);
|
||||
|
||||
cdp1864->disp = 0;
|
||||
cdp1864->dmaout = 0;
|
||||
cdp1864->bgcolor = 0;
|
||||
cdp1864->con = 1;
|
||||
|
||||
devcb_call_write_line(&cdp1864->out_int_func, CLEAR_LINE);
|
||||
devcb_call_write_line(&cdp1864->out_dmao_func, CLEAR_LINE);
|
||||
devcb_call_write_line(&cdp1864->out_efx_func, CLEAR_LINE);
|
||||
|
||||
cdp1864_aoe_w(device, 0);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
DEVICE_GET_INFO( cdp1864 )
|
||||
-------------------------------------------------*/
|
||||
|
||||
DEVICE_GET_INFO( cdp1864 )
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
/* --- the following bits of info are returned as 64-bit signed integers --- */
|
||||
case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(cdp1864_t); break;
|
||||
case DEVINFO_INT_INLINE_CONFIG_BYTES: info->i = 0; break;
|
||||
case DEVINFO_INT_CLASS: info->i = DEVICE_CLASS_PERIPHERAL; break;
|
||||
|
||||
/* --- the following bits of info are returned as pointers to data or functions --- */
|
||||
case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(cdp1864); break;
|
||||
case DEVINFO_FCT_STOP: /* Nothing */ break;
|
||||
case DEVINFO_FCT_RESET: info->reset = DEVICE_RESET_NAME(cdp1864); break;
|
||||
|
||||
/* --- the following bits of info are returned as NULL-terminated strings --- */
|
||||
case DEVINFO_STR_NAME: strcpy(info->s, "RCA CDP1864"); break;
|
||||
case DEVINFO_STR_FAMILY: strcpy(info->s, "RCA CDP1800"); break;
|
||||
case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break;
|
||||
case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break;
|
||||
case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright MESS Team"); break;
|
||||
}
|
||||
}
|
156
src/emu/sound/cdp1864.h
Normal file
156
src/emu/sound/cdp1864.h
Normal file
@ -0,0 +1,156 @@
|
||||
/**********************************************************************
|
||||
|
||||
RCA CDP1864C COS/MOS PAL Compatible Color TV Interface
|
||||
|
||||
Copyright MESS Team.
|
||||
Visit http://mamedev.org for licensing and usage restrictions.
|
||||
|
||||
**********************************************************************
|
||||
________________
|
||||
INLACE 1 ---| \/ |--- 40 Vdd
|
||||
CLK IN_ 2 ---| |--- 39 AUD
|
||||
CLR OUT_ 3 ---| |--- 38 CLR IN_
|
||||
AOE 4 ---| |--- 37 DMA0_
|
||||
SC1 5 ---| |--- 36 INT_
|
||||
SC0 6 ---| |--- 35 TPA
|
||||
MRD_ 7 ---| |--- 34 TPB
|
||||
BUS 7 8 ---| |--- 33 EVS
|
||||
BUS 6 9 ---| |--- 32 V SYNC
|
||||
BUS 5 10 ---| CDP1864C |--- 31 H SYNC
|
||||
BUS 4 11 ---| top view |--- 30 C SYNC_
|
||||
BUS 3 12 ---| |--- 29 RED
|
||||
BUS 2 13 ---| |--- 28 BLUE
|
||||
BUS 1 14 ---| |--- 27 GREEN
|
||||
BUS 0 15 ---| |--- 26 BCK GND_
|
||||
CON_ 16 ---| |--- 25 BURST
|
||||
N2 17 ---| |--- 24 ALT
|
||||
EF_ 18 ---| |--- 23 R DATA
|
||||
N0 19 ---| |--- 22 G DATA
|
||||
Vss 20 ---|________________|--- 21 B DATA
|
||||
|
||||
|
||||
http://homepage.mac.com/ruske/cosmacelf/cdp1864.pdf
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef __CDP1864__
|
||||
#define __CDP1864__
|
||||
|
||||
#include "devcb.h"
|
||||
|
||||
/***************************************************************************
|
||||
PARAMETERS
|
||||
***************************************************************************/
|
||||
|
||||
#define CDP1864_CLOCK XTAL_1_75MHz
|
||||
|
||||
#define CDP1864_VISIBLE_COLUMNS 64
|
||||
#define CDP1864_VISIBLE_LINES 192
|
||||
|
||||
#define CDP1864_HBLANK_END 1 * 8
|
||||
#define CDP1864_HBLANK_START 13 * 8
|
||||
#define CDP1864_HSYNC_START 0 * 8
|
||||
#define CDP1864_HSYNC_END 1 * 8
|
||||
#define CDP1864_SCREEN_START 4 * 8
|
||||
#define CDP1864_SCREEN_END 12 * 8
|
||||
#define CDP1864_SCREEN_WIDTH 14 * 8
|
||||
|
||||
#define CDP1864_TOTAL_SCANLINES 312
|
||||
|
||||
#define CDP1864_SCANLINE_VBLANK_START CDP1864_TOTAL_SCANLINES - 4
|
||||
#define CDP1864_SCANLINE_VBLANK_END 20
|
||||
#define CDP1864_SCANLINE_VSYNC_START 0
|
||||
#define CDP1864_SCANLINE_VSYNC_END 4
|
||||
#define CDP1864_SCANLINE_DISPLAY_START 60 // ???
|
||||
#define CDP1864_SCANLINE_DISPLAY_END CDP1864_SCANLINE_DISPLAY_START + CDP1864_VISIBLE_LINES
|
||||
#define CDP1864_SCANLINE_INT_START CDP1864_SCANLINE_DISPLAY_START - 2
|
||||
#define CDP1864_SCANLINE_INT_END CDP1864_SCANLINE_DISPLAY_START
|
||||
#define CDP1864_SCANLINE_EFX_TOP_START CDP1864_SCANLINE_DISPLAY_START - 4
|
||||
#define CDP1864_SCANLINE_EFX_TOP_END CDP1864_SCANLINE_DISPLAY_START
|
||||
#define CDP1864_SCANLINE_EFX_BOTTOM_START CDP1864_SCANLINE_DISPLAY_END - 4
|
||||
#define CDP1864_SCANLINE_EFX_BOTTOM_END CDP1864_SCANLINE_DISPLAY_END
|
||||
|
||||
/***************************************************************************
|
||||
MACROS / CONSTANTS
|
||||
***************************************************************************/
|
||||
|
||||
#define CDP1864 DEVICE_GET_INFO_NAME(cdp1864)
|
||||
#define SOUND_CDP1864 CDP1864
|
||||
|
||||
#define MDRV_CDP1864_ADD(_tag, _clock, _config) \
|
||||
MDRV_DEVICE_ADD(_tag, SOUND, _clock) \
|
||||
MDRV_DEVICE_CONFIG_DATAPTR(sound_config, type, SOUND_CDP1864) \
|
||||
MDRV_DEVICE_CONFIG(_config)
|
||||
|
||||
#define CDP1864_INTERFACE(name) \
|
||||
const cdp1864_interface (name) =
|
||||
|
||||
/***************************************************************************
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
typedef enum _cdp1864_format cdp1864_format;
|
||||
enum _cdp1864_format {
|
||||
CDP1864_NON_INTERLACED = 0,
|
||||
CDP1864_INTERLACED
|
||||
};
|
||||
|
||||
typedef struct _cdp1864_interface cdp1864_interface;
|
||||
struct _cdp1864_interface
|
||||
{
|
||||
const char *cpu_tag; /* cpu we are working with */
|
||||
const char *screen_tag; /* screen we are acting on */
|
||||
|
||||
cdp1864_format interlace; /* interlace */
|
||||
|
||||
devcb_read_line in_rdata_func;
|
||||
devcb_read_line in_bdata_func;
|
||||
devcb_read_line in_gdata_func;
|
||||
|
||||
/* this gets called for every change of the INT pin (pin 36) */
|
||||
devcb_write_line out_int_func;
|
||||
|
||||
/* this gets called for every change of the DMAO pin (pin 37) */
|
||||
devcb_write_line out_dmao_func;
|
||||
|
||||
/* this gets called for every change of the EFX pin (pin 18) */
|
||||
devcb_write_line out_efx_func;
|
||||
|
||||
double res_r; /* red output resistor value */
|
||||
double res_g; /* green output resistor value */
|
||||
double res_b; /* blue output resistor value */
|
||||
double res_bkg; /* background output resistor value */
|
||||
};
|
||||
|
||||
/***************************************************************************
|
||||
PROTOTYPES
|
||||
***************************************************************************/
|
||||
|
||||
/* device interface */
|
||||
DEVICE_GET_INFO( cdp1864 );
|
||||
|
||||
/* display on (0x69) */
|
||||
READ8_DEVICE_HANDLER( cdp1864_dispon_r ) ATTR_NONNULL(1);
|
||||
|
||||
/* display off (0x6c) */
|
||||
READ8_DEVICE_HANDLER( cdp1864_dispoff_r ) ATTR_NONNULL(1);
|
||||
|
||||
/* step background color (0x61) */
|
||||
WRITE8_DEVICE_HANDLER( cdp1864_step_bgcolor_w ) ATTR_NONNULL(1);
|
||||
|
||||
/* color on */
|
||||
WRITE_LINE_DEVICE_HANDLER( cdp1864_con_w ) ATTR_NONNULL(1);
|
||||
|
||||
/* load tone latch (0x64) */
|
||||
WRITE8_DEVICE_HANDLER( cdp1864_tone_latch_w ) ATTR_NONNULL(1);
|
||||
|
||||
/* audio output enable */
|
||||
WRITE_LINE_DEVICE_HANDLER( cdp1864_aoe_w ) ATTR_NONNULL(1);
|
||||
|
||||
/* DMA write */
|
||||
WRITE8_DEVICE_HANDLER( cdp1864_dma_w ) ATTR_NONNULL(1);
|
||||
|
||||
/* screen update */
|
||||
void cdp1864_update(const device_config *device, bitmap_t *bitmap, const rectangle *cliprect) ATTR_NONNULL(1) ATTR_NONNULL(2) ATTR_NONNULL(3);
|
||||
|
||||
#endif
|
@ -92,7 +92,8 @@
|
||||
MDRV_DEVICE_CONFIG_DATAPTR(sound_config, type, SOUND_CDP1869) \
|
||||
MDRV_DEVICE_CONFIG(_config)
|
||||
|
||||
#define CDP1869_INTERFACE(_name) const cdp1869_interface (_name) =
|
||||
#define CDP1869_INTERFACE(_name) \
|
||||
const cdp1869_interface (_name) =
|
||||
|
||||
#define CDP1869_CHAR_RAM_READ(name) UINT8 name(const device_config *device, UINT16 pma, UINT8 cma)
|
||||
#define CDP1869_CHAR_RAM_WRITE(name) void name(const device_config *device, UINT16 pma, UINT8 cma, UINT8 data)
|
||||
|
@ -205,6 +205,18 @@ endif
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------
|
||||
# RCA CDP1864
|
||||
#-------------------------------------------------
|
||||
|
||||
SOUNDDEFS += -DHAS_CDP1864=$(if $(filter CDP1864,$(SOUNDS)),1,0)
|
||||
|
||||
ifneq ($(filter CDP1864,$(SOUNDS)),)
|
||||
SOUNDOBJS += $(SOUNDOBJ)/cdp1864.o
|
||||
endif
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------
|
||||
# RCA CDP1869
|
||||
#-------------------------------------------------
|
||||
|
@ -214,6 +214,7 @@ SOUNDS += WAVE
|
||||
SOUNDS += SP0256
|
||||
SOUNDS += DIGITALKER
|
||||
SOUNDS += CDP1863
|
||||
SOUNDS += CDP1864
|
||||
|
||||
|
||||
#-------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user