diff options
author | Curt Coder <curtcoder@mail.com> | 2010-10-19 13:03:57 +0000 |
---|---|---|
committer | Curt Coder <curtcoder@mail.com> | 2010-10-19 13:03:57 +0000 |
commit | aa8bd5fbd375e7afae3f78173a3a2d047b062e59 (patch) | |
tree | 886b0ddd8047242f049335d5c46d584b43c7442b | |
parent | 0f268291ed957b76c35a8f91915053dda1147c67 (diff) |
Refactored the CDP1869 chip into a C++ device. [Curt Coder]
-rw-r--r-- | src/emu/cpu/cosmac/cosmac.c | 10 | ||||
-rw-r--r-- | src/emu/cpu/cosmac/cosmac.h | 1 | ||||
-rw-r--r-- | src/emu/drivers/xtal.h | 3 | ||||
-rw-r--r-- | src/emu/sound/cdp1869.c | 1108 | ||||
-rw-r--r-- | src/emu/sound/cdp1869.h | 347 | ||||
-rw-r--r-- | src/mame/drivers/cidelsa.c | 159 | ||||
-rw-r--r-- | src/mame/includes/cidelsa.h | 57 | ||||
-rw-r--r-- | src/mame/video/cidelsa.c | 196 |
8 files changed, 1021 insertions, 860 deletions
diff --git a/src/emu/cpu/cosmac/cosmac.c b/src/emu/cpu/cosmac/cosmac.c index bd8d1b21bba..089458467ad 100644 --- a/src/emu/cpu/cosmac/cosmac.c +++ b/src/emu/cpu/cosmac/cosmac.c @@ -555,6 +555,16 @@ inline void cosmac_device::write_io_byte(offs_t address, UINT8 data) //************************************************************************** //------------------------------------------------- +// get_memory_address - get current memory address +//------------------------------------------------- + +offs_t cosmac_device::get_memory_address() +{ + // this is valid for INP/OUT opcodes + return R[X]; +} + +//------------------------------------------------- // execute_set_input - //------------------------------------------------- diff --git a/src/emu/cpu/cosmac/cosmac.h b/src/emu/cpu/cosmac/cosmac.h index a057f43990e..e2e8888be3e 100644 --- a/src/emu/cpu/cosmac/cosmac.h +++ b/src/emu/cpu/cosmac/cosmac.h @@ -189,6 +189,7 @@ class cosmac_device : public cpu_device public: // public interfaces + offs_t get_memory_address(); protected: // device-level overrides diff --git a/src/emu/drivers/xtal.h b/src/emu/drivers/xtal.h index a54f265880f..59863335eaf 100644 --- a/src/emu/drivers/xtal.h +++ b/src/emu/drivers/xtal.h @@ -62,6 +62,8 @@ enum XTAL_4_9152MHz = 4915200, XTAL_5MHz = 5000000, /* Mutant Night */ XTAL_5_0688MHz = 5068800, /* Xerox 820, DEC VK100 */ + XTAL_5_626MHz = 5626000, /* RCA CDP1869 PAL dot clock */ + XTAL_5_67MHz = 5670000, /* RCA CDP1869 NTSC dot clock */ XTAL_5_7143MHz = 5714300, /* Cidelsa Destroyer */ XTAL_5_9904MHz = 5990400, /* Luxor ABC 800 keyboard */ XTAL_6MHz = 6000000, /* American Poker II */ @@ -74,6 +76,7 @@ enum XTAL_8_2MHz = 8200000, /* Universal Mr. Do - Model 8021 PCB */ XTAL_8_4672MHz = 8467200, /* Subsino's Ying Hua Lian */ XTAL_8_664MHz = 8664000, /* Touchmaster */ + XTAL_8_867236MHz = 8867236, /* RCA CDP1869 PAL color clock */ XTAL_8_867238MHz = 8867238, /* ETI-660 */ XTAL_8_945MHz = 8945000, /* Hit Me */ XTAL_9_828MHz = 9828000, /* Universal PCBs */ diff --git a/src/emu/sound/cdp1869.c b/src/emu/sound/cdp1869.c index 21108cf0576..8f3d067fb2c 100644 --- a/src/emu/sound/cdp1869.c +++ b/src/emu/sound/cdp1869.c @@ -1,25 +1,34 @@ -#include "emu.h" -#include "streams.h" -#include "cpu/cosmac/cosmac.h" -#include "sound/cdp1869.h" +/********************************************************************** + + RCA CDP1869/1870/1876 Video Interface System (VIS) emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +**********************************************************************/ /* TODO: - - remove CDP1802 dependency - - sound base frequencies are TPA/TPB - white noise - scanline based update - CMSEL output */ -/*************************************************************************** - PARAMETERS -***************************************************************************/ +#include "emu.h" +#include "cdp1869.h" + -#define CDP1869_WEIGHT_RED 30 /* % of max luminance */ + +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define LOG 0 + +#define CDP1869_WEIGHT_RED 30 // % of max luminance #define CDP1869_WEIGHT_GREEN 59 #define CDP1869_WEIGHT_BLUE 11 @@ -29,10 +38,6 @@ #define CDP1869_ROWS_FULL_PAL 25 #define CDP1869_ROWS_FULL_NTSC 24 -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - enum { CDB0 = 0, @@ -45,157 +50,232 @@ enum CCB1 }; -typedef struct _cdp1869_t cdp1869_t; -struct _cdp1869_t -{ - devcb_resolved_read8 in_page_ram_func; - devcb_resolved_write8 out_page_ram_func; - devcb_resolved_write_line out_prd_func; - devcb_resolved_read_line in_pal_ntsc_func; - - running_device *device; - const cdp1869_interface *intf; /* interface */ - screen_device *screen; /* screen */ - running_device *cpu; /* CPU */ - sound_stream *stream; /* sound output */ - int color_clock; - - /* video state */ - int prd; /* predisplay */ - int dispoff; /* display off */ - int fresvert; /* full resolution vertical */ - int freshorz; /* full resolution horizontal */ - int cmem; /* character memory access mode */ - int dblpage; /* double page mode */ - int line16; /* 16-line hi-res mode */ - int line9; /* 9 line mode */ - int cfc; /* color format control */ - UINT8 col; /* character color control */ - UINT8 bkg; /* background color */ - UINT16 pma; /* page memory address */ - UINT16 hma; /* home memory address */ - - /* video timer */ - emu_timer *prd_changed_timer; /* predisplay changed timer */ - - /* sound state */ - INT16 signal; /* current signal */ - int incr; /* initial wave state */ - int toneoff; /* tone off */ - int wnoff; /* white noise off */ - UINT8 tonediv; /* tone divisor */ - UINT8 tonefreq; /* tone range select */ - UINT8 toneamp; /* tone output amplitude */ - UINT8 wnfreq; /* white noise range select */ - UINT8 wnamp; /* white noise output amplitude */ -}; -/*************************************************************************** - INLINE FUNCTIONS -***************************************************************************/ -INLINE cdp1869_t *get_safe_token(running_device *device) +//************************************************************************** +// GLOBAL VARIABLES +//************************************************************************** + +// devices +const device_type CDP1869 = cdp1869_device_config::static_alloc_device_config; + + +// default address map +static ADDRESS_MAP_START( cdp1869, 0, 8 ) + AM_RANGE(0x000, 0x7ff) AM_RAM +ADDRESS_MAP_END + + + +//************************************************************************** +// DEVICE CONFIGURATION +//************************************************************************** + +//------------------------------------------------- +// cdp1869_device_config - constructor +//------------------------------------------------- + +cdp1869_device_config::cdp1869_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) + : device_config(mconfig, static_alloc_device_config, "RCA CDP1869", tag, owner, clock), + device_config_sound_interface(mconfig, *this), + device_config_memory_interface(mconfig, *this), + m_space_config("pageram", ENDIANNESS_LITTLE, 8, 11, 0, NULL, *ADDRESS_MAP_NAME(cdp1869)) { - assert(device != NULL); - return (cdp1869_t *)downcast<legacy_device_base *>(device)->token(); } -/*************************************************************************** - IMPLEMENTATION -***************************************************************************/ -#define CDP1869_IS_NTSC \ - (!devcb_call_read_line(&cdp1869->in_pal_ntsc_func)) +//------------------------------------------------- +// static_alloc_device_config - allocate a new +// configuration object +//------------------------------------------------- + +device_config *cdp1869_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock) +{ + return global_alloc(cdp1869_device_config(mconfig, tag, owner, clock)); +} + -/*------------------------------------------------- - update_prd_changed_timer - update predisplay - changed timer --------------------------------------------------*/ +//------------------------------------------------- +// alloc_device - allocate a new device object +//------------------------------------------------- -static void update_prd_changed_timer(cdp1869_t *cdp1869) +device_t *cdp1869_device_config::alloc_device(running_machine &machine) const { - if (cdp1869->prd_changed_timer != NULL) - { - attotime duration; - int start, end, level; - int scanline = cdp1869->screen->vpos(); - int next_scanline; + return auto_alloc(&machine, cdp1869_device(machine, *this)); +} - if (CDP1869_IS_NTSC) - { - start = CDP1869_SCANLINE_PREDISPLAY_START_NTSC; - end = CDP1869_SCANLINE_PREDISPLAY_END_NTSC; - } - else - { - start = CDP1869_SCANLINE_PREDISPLAY_START_PAL; - end = CDP1869_SCANLINE_PREDISPLAY_END_PAL; - } - if (scanline < start) - { - next_scanline = start; - level = ASSERT_LINE; - } - else if (scanline < end) - { - next_scanline = end; - level = CLEAR_LINE; - } - else - { - next_scanline = start; - level = ASSERT_LINE; - } +//------------------------------------------------- +// memory_space_config - return a description of +// any address spaces owned by this device +//------------------------------------------------- + +const address_space_config *cdp1869_device_config::memory_space_config(int spacenum) const +{ + return (spacenum == 0) ? &m_space_config : NULL; +} - if (cdp1869->dispoff) - { - level = CLEAR_LINE; - } - duration = cdp1869->screen->time_until_pos(next_scanline); - timer_adjust_oneshot(cdp1869->prd_changed_timer, duration, level); +//------------------------------------------------- +// device_config_complete - perform any +// operations now that the configuration is +// complete +//------------------------------------------------- + +void cdp1869_device_config::device_config_complete() +{ + // inherit a copy of the static data + const cdp1869_interface *intf = reinterpret_cast<const cdp1869_interface *>(static_config()); + if (intf != NULL) + *static_cast<cdp1869_interface *>(this) = *intf; + + // or initialize to defaults if none provided + else + { + memset(&in_pal_ntsc_func, 0, sizeof(in_pal_ntsc_func)); + memset(&out_prd_func, 0, sizeof(out_prd_func)); + in_pcb_func = NULL; + in_char_ram_func = NULL; + out_char_ram_func = NULL; } } -/*------------------------------------------------- - TIMER_CALLBACK( prd_changed_tick ) --------------------------------------------------*/ -static TIMER_CALLBACK( prd_changed_tick ) + +//************************************************************************** +// INLINE HELPERS +//************************************************************************** + +//------------------------------------------------- +// is_ntsc - is device in NTSC mode +//------------------------------------------------- + +inline bool cdp1869_device::is_ntsc() { - running_device *device = (running_device *)ptr; - cdp1869_t *cdp1869 = get_safe_token(device); + return devcb_call_read_line(&m_in_pal_ntsc_func) ? false : true; +} - devcb_call_write_line(&cdp1869->out_prd_func, param); - cdp1869->prd = param; - update_prd_changed_timer(cdp1869); +//------------------------------------------------- +// read_page_ram_byte - read a page RAM byte at +// the given address +//------------------------------------------------- + +inline UINT8 cdp1869_device::read_page_ram_byte(offs_t pma) +{ + return space()->read_byte(pma); } -/*------------------------------------------------- - STATE_POSTLOAD( cdp1869_state_save_postload ) --------------------------------------------------*/ -static STATE_POSTLOAD( cdp1869_state_save_postload ) +//------------------------------------------------- +// write_page_ram_byte - write a page RAM byte at +// the given address +//------------------------------------------------- + +inline void cdp1869_device::write_page_ram_byte(offs_t pma, UINT8 data) { - update_prd_changed_timer((cdp1869_t *)param); + space()->write_byte(pma, data); } -/*------------------------------------------------- - cdp1802_get_r_x - get CDP1802 R(X) value --------------------------------------------------*/ -static UINT16 cdp1802_get_r_x(cdp1869_t *cdp1869) +//------------------------------------------------- +// read_char_ram_byte - read a char RAM byte at +// the given address +//------------------------------------------------- + +inline UINT8 cdp1869_device::read_char_ram_byte(offs_t pma, offs_t cma, UINT8 pmd) { - return cpu_get_reg(cdp1869->cpu, COSMAC_R0 + cpu_get_reg(cdp1869->cpu, COSMAC_X)); + UINT8 data = 0; + + if (m_in_char_ram_func != NULL) + { + data = m_in_char_ram_func(this, pma, cma, pmd); + } + + return data; } -/*------------------------------------------------- - get_rgb - get RGB value --------------------------------------------------*/ -static rgb_t get_rgb(int i, int c, int l) +//------------------------------------------------- +// write_char_ram_byte - write a char RAM byte at +// the given address +//------------------------------------------------- + +inline void cdp1869_device::write_char_ram_byte(offs_t pma, offs_t cma, UINT8 pmd, UINT8 data) +{ + if (m_out_char_ram_func != NULL) + { + m_out_char_ram_func(this, pma, cma, pmd, data); + } +} + + +//------------------------------------------------- +// read_pcb - read page control bit +//------------------------------------------------- + +inline int cdp1869_device::read_pcb(offs_t pma, offs_t cma, UINT8 pmd) +{ + int pcb = 0; + + if (m_in_pcb_func != NULL) + { + pcb = m_in_pcb_func(this, pma, cma, pmd); + } + + return pcb; +} + + +//------------------------------------------------- +// update_prd_changed_timer - +//------------------------------------------------- + +inline void cdp1869_device::update_prd_changed_timer() +{ + int start = CDP1869_SCANLINE_PREDISPLAY_START_PAL; + int end = CDP1869_SCANLINE_PREDISPLAY_END_PAL; + int next_state; + int scanline = m_screen->vpos(); + int next_scanline; + + if (is_ntsc()) + { + start = CDP1869_SCANLINE_PREDISPLAY_START_NTSC; + end = CDP1869_SCANLINE_PREDISPLAY_END_NTSC; + } + + if (scanline < start) + { + next_scanline = start; + next_state = ASSERT_LINE; + } + else if (scanline < end) + { + next_scanline = end; + next_state = CLEAR_LINE; + } + else + { + next_scanline = start; + next_state = ASSERT_LINE; + } + + if (m_dispoff) + { + next_state = CLEAR_LINE; + } + + attotime duration = m_screen->time_until_pos(next_scanline); + timer_adjust_oneshot(m_prd_timer, duration, next_state); +} + + +//------------------------------------------------- +// get_rgb - get RGB value +//------------------------------------------------- + +inline rgb_t cdp1869_device::get_rgb(int i, int c, int l) { int luma = 0, r, g, b; @@ -212,19 +292,18 @@ static rgb_t get_rgb(int i, int c, int l) return MAKE_RGB(r, g, b); } -/*------------------------------------------------- - get_lines - get number of character lines --------------------------------------------------*/ -static int get_lines(running_device *device) -{ - cdp1869_t *cdp1869 = get_safe_token(device); +//------------------------------------------------- +// get_lines - get number of character lines +//------------------------------------------------- - if (cdp1869->line16 && !cdp1869->dblpage) +inline int cdp1869_device::get_lines() +{ + if (m_line16 && !m_dblpage) { return 16; } - else if (!cdp1869->line9) + else if (!m_line9) { return 9; } @@ -234,51 +313,48 @@ static int get_lines(running_device *device) } } -/*------------------------------------------------- - get_pmemsize - get page memory size --------------------------------------------------*/ -static UINT16 get_pmemsize(running_device *device, int cols, int rows) -{ - cdp1869_t *cdp1869 = get_safe_token(device); +//------------------------------------------------- +// get_pmemsize - get page memory size +//------------------------------------------------- +inline UINT16 cdp1869_device::get_pmemsize(int cols, int rows) +{ int pmemsize = cols * rows; - if (cdp1869->dblpage) pmemsize *= 2; - if (cdp1869->line16) pmemsize *= 2; + if (m_dblpage) pmemsize *= 2; + if (m_line16) pmemsize *= 2; return pmemsize; } -/*------------------------------------------------- - get_pma - get page memory address --------------------------------------------------*/ -static UINT16 get_pma(running_device *device) -{ - cdp1869_t *cdp1869 = get_safe_token(device); +//------------------------------------------------- +// get_pma - get page memory address +//------------------------------------------------- - if (cdp1869->dblpage) +inline UINT16 cdp1869_device::get_pma() +{ + if (m_dblpage) { - return cdp1869->pma; + return m_pma; } else { - return cdp1869->pma & 0x3ff; + return m_pma & 0x3ff; } } -/*------------------------------------------------- - get_pen - get pen for color bits --------------------------------------------------*/ -static int get_pen(running_device *device, int ccb0, int ccb1, int pcb) -{ - cdp1869_t *cdp1869 = get_safe_token(device); +//------------------------------------------------- +// get_pen - get pen for color bits +//------------------------------------------------- - int r = 0, g = 0, b = 0, color; +inline int cdp1869_device::get_pen(int ccb0, int ccb1, int pcb) +{ + int r = 0, g = 0, b = 0; - switch (cdp1869->col) + switch (m_col) { case 0: r = ccb0; @@ -300,11 +376,11 @@ static int get_pen(running_device *device, int ccb0, int ccb1, int pcb) break; } - color = (r << 2) + (b << 1) + g; + int color = (r << 2) + (b << 1) + g; - if (cdp1869->cfc) + if (m_cfc) { - return color + ((cdp1869->bkg + 1) * 8); + return color + ((m_bkg + 1) * 8); } else { @@ -312,14 +388,204 @@ static int get_pen(running_device *device, int ccb0, int ccb1, int pcb) } } -/*------------------------------------------------- - draw_line - draw character line --------------------------------------------------*/ -static void draw_line(running_device *device, bitmap_t *bitmap, int x, int y, int data, int color) + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// cdp1869_device - constructor +//------------------------------------------------- + +cdp1869_device::cdp1869_device(running_machine &_machine, const cdp1869_device_config &config) + : device_t(_machine, config), + device_sound_interface(_machine, config, *this), + device_memory_interface(_machine, config, *this), + m_stream(NULL), + m_config(config) +{ + +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void cdp1869_device::device_start() +{ + // get the screen device + m_screen = m_machine.device<screen_device>(m_config.screen_tag); + assert(m_screen != NULL); + + // resolve callbacks + devcb_resolve_read_line(&m_in_pal_ntsc_func, &m_config.in_pal_ntsc_func, this); + devcb_resolve_write_line(&m_out_prd_func, &m_config.out_prd_func, this); + m_in_pcb_func = m_config.in_pcb_func; + m_in_char_ram_func = m_config.in_char_ram_func; + m_out_char_ram_func = m_config.out_char_ram_func; + + // allocate timers + m_prd_timer = device_timer_alloc(*this); + update_prd_changed_timer(); + + // initialize palette + initialize_palette(); + + // create sound stream + m_stream = stream_create(this, 0, 1, m_machine.sample_rate, this, static_stream_generate); + + // register for state saving + state_save_register_device_item(this, 0, m_prd); + state_save_register_device_item(this, 0, m_dispoff); + state_save_register_device_item(this, 0, m_fresvert); + state_save_register_device_item(this, 0, m_freshorz); + state_save_register_device_item(this, 0, m_cmem); + state_save_register_device_item(this, 0, m_dblpage); + state_save_register_device_item(this, 0, m_line16); + state_save_register_device_item(this, 0, m_line9); + state_save_register_device_item(this, 0, m_cfc); + state_save_register_device_item(this, 0, m_col); + state_save_register_device_item(this, 0, m_bkg); + state_save_register_device_item(this, 0, m_pma); + state_save_register_device_item(this, 0, m_hma); + state_save_register_device_item(this, 0, m_signal); + state_save_register_device_item(this, 0, m_incr); + state_save_register_device_item(this, 0, m_toneoff); + state_save_register_device_item(this, 0, m_wnoff); + state_save_register_device_item(this, 0, m_tonediv); + state_save_register_device_item(this, 0, m_tonefreq); + state_save_register_device_item(this, 0, m_toneamp); + state_save_register_device_item(this, 0, m_wnfreq); + state_save_register_device_item(this, 0, m_wnamp); +} + + +//------------------------------------------------- +// device_post_load - device-specific post-load +//------------------------------------------------- + +void cdp1869_device::device_post_load() +{ + update_prd_changed_timer(); +} + + +//------------------------------------------------- +// device_timer - handler timer events +//------------------------------------------------- + +void cdp1869_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - cdp1869_t *cdp1869 = get_safe_token(device); + devcb_call_write_line(&m_out_prd_func, param); + m_prd = param; + + update_prd_changed_timer(); +} + + +//------------------------------------------------- +// initialize_palette - initialize palette +//------------------------------------------------- +void cdp1869_device::initialize_palette() +{ + // color-on-color display (CFC=0) + int i; + + for (i = 0; i < 8; i++) + { + palette_set_color(machine, i, get_rgb(i, i, 15)); + } + + // tone-on-tone display (CFC=1) + for (int c = 0; c < 8; c++) + { + for (int l = 0; l < 8; l++) + { + palette_set_color(machine, i, get_rgb(i, c, l)); + i++; + } + } +} + + +//------------------------------------------------- +// stream_generate - handle update requests for +// our sound stream +//------------------------------------------------- + +STREAM_UPDATE( cdp1869_device::static_stream_generate ) +{ + reinterpret_cast<cdp1869_device *>(param)->stream_generate(inputs, outputs, samples); +} + +void cdp1869_device::stream_generate(stream_sample_t **inputs, stream_sample_t **outputs, int samples) +{ + // reset the output stream + memset(outputs[0], 0, samples * sizeof(*outputs[0])); + + INT16 signal = m_signal; + stream_sample_t *buffer = outputs[0]; + + if (!m_toneoff && m_toneamp) + { + double frequency = (clock() / 2) / (512 >> m_tonefreq) / (m_tonediv + 1); +// double amplitude = m_toneamp * ((0.78*5) / 15); + + int rate = m_machine.sample_rate / 2; + + /* get progress through wave */ + int incr = m_incr; + + if (signal < 0) + { + signal = -(m_toneamp * (0x07fff / 15)); + } + else + { + signal = m_toneamp * (0x07fff / 15); + } + + while( samples-- > 0 ) + { + *buffer++ = signal; + incr -= frequency; + while( incr < 0 ) + { + incr += rate; + signal = -signal; + } + } + + /* store progress through wave */ + m_incr = incr; + m_signal = signal; + } +/* + if (!m_wnoff) + { + double amplitude = m_wnamp * ((0.78*5) / 15); + + for (int wndiv = 0; wndiv < 128; wndiv++) + { + double frequency = (clock() / 2) / (4096 >> m_wnfreq) / (wndiv + 1): + + sum_square_wave(buffer, frequency, amplitude); + } + } +*/ + +} + + +//------------------------------------------------- +// draw_line - draw character line +//------------------------------------------------- + +void cdp1869_device::draw_line(bitmap_t *bitmap, const rectangle *rect, int x, int y, UINT8 data, int color) +{ int i; data <<= 2; @@ -330,23 +596,23 @@ static void draw_line(running_device *device, bitmap_t *bitmap, int x, int y, in { *BITMAP_ADDR16(bitmap, y, x) = color; - if (!cdp1869->fresvert) + if (!m_fresvert) { *BITMAP_ADDR16(bitmap, y + 1, x) = color; } - if (!cdp1869->freshorz) + if (!m_freshorz) { *BITMAP_ADDR16(bitmap, y, x + 1) = color; - if (!cdp1869->fresvert) + if (!m_fresvert) { *BITMAP_ADDR16(bitmap, y + 1, x + 1) = color; } } } - if (!cdp1869->freshorz) + if (!m_freshorz) { x++; } @@ -357,67 +623,42 @@ static void draw_line(running_device *device, bitmap_t *bitmap, int x, int y, in } } -/*------------------------------------------------- - draw_char - draw character --------------------------------------------------*/ -static void draw_char(running_device *device, bitmap_t *bitmap, int x, int y, UINT16 pma, const rectangle *screenrect) -{ - cdp1869_t *cdp1869 = get_safe_token(device); +//------------------------------------------------- +// draw_char - draw character +//------------------------------------------------- - UINT8 cma = 0; +void cdp1869_device::draw_char(bitmap_t *bitmap, const rectangle *rect, int x, int y, UINT16 pma) +{ + UINT8 pmd = read_page_ram_byte(pma); - for (cma = 0; cma < get_lines(device); cma++) + for (UINT8 cma = 0; cma < get_lines(); cma++) { - UINT8 data = cdp1869->intf->char_ram_r(device, pma, cma); + UINT8 data = read_char_ram_byte(pma, cma, pmd); int ccb0 = BIT(data, CCB0); int ccb1 = BIT(data, CCB1); - int pcb = BIT(cdp1869->intf->pcb_r(device, pma, cma), 0); + int pcb = read_pcb(pma, cma, pmd); - int color = get_pen(device, ccb0, ccb1, pcb); + int color = get_pen(ccb0, ccb1, pcb); - draw_line(device, bitmap, screenrect->min_x + x, screenrect->min_y + y, data, color); + draw_line(bitmap, rect, rect->min_x + x, rect->min_y + y, data, color); y++; - if (!cdp1869->fresvert) + if (!m_fresvert) { y++; } } } -/*------------------------------------------------- - PALETTE_INIT( cdp1869 ) --------------------------------------------------*/ - -PALETTE_INIT( cdp1869 ) -{ - int i, c, l; - - /* color-on-color display (CFC=0) */ - for (i = 0; i < 8; i++) - { - palette_set_color(machine, i, get_rgb(i, i, 15)); - } - - /* tone-on-tone display (CFC=1) */ - for (c = 0; c < 8; c++) - { - for (l = 0; l < 8; l++) - { - palette_set_color(machine, i, get_rgb(i, c, l)); - i++; - } - } -} -/*------------------------------------------------- - cdp1869_out3_w - register 3 write --------------------------------------------------*/ +//------------------------------------------------- +// out3_w - register 3 write +//------------------------------------------------- -WRITE8_DEVICE_HANDLER( cdp1869_out3_w ) +WRITE8_MEMBER( cdp1869_device::out3_w ) { /* bit description @@ -432,20 +673,19 @@ WRITE8_DEVICE_HANDLER( cdp1869_out3_w ) 7 fres horz */ - cdp1869_t *cdp1869 = get_safe_token(device); - - cdp1869->bkg = data & 0x07; - cdp1869->cfc = BIT(data, 3); - cdp1869->dispoff = BIT(data, 4); - cdp1869->col = (data & 0x60) >> 5; - cdp1869->freshorz = BIT(data, 7); + m_bkg = data & 0x07; + m_cfc = BIT(data, 3); + m_dispoff = BIT(data, 4); + m_col = (data & 0x60) >> 5; + m_freshorz = BIT(data, 7); } -/*------------------------------------------------- - cdp1869_out4_w - register 4 write --------------------------------------------------*/ -WRITE8_DEVICE_HANDLER( cdp1869_out4_w ) +//------------------------------------------------- +// out4_w - register 4 write +//------------------------------------------------- + +WRITE8_MEMBER( cdp1869_device::out4_w ) { /* bit description @@ -468,20 +708,20 @@ WRITE8_DEVICE_HANDLER( cdp1869_out4_w ) 15 always 0 */ - cdp1869_t *cdp1869 = get_safe_token(device); - UINT16 word = cdp1802_get_r_x(cdp1869); + m_toneamp = offset & 0x0f; + m_tonefreq = (offset & 0x70) >> 4; + m_toneoff = BIT(offset, 7); + m_tonediv = (offset & 0x7f00) >> 8; - cdp1869->toneamp = word & 0x0f; - cdp1869->tonefreq = (word & 0x70) >> 4; - cdp1869->toneoff = BIT(word, 7); - cdp1869->tonediv = (word & 0x7f00) >> 8; + stream_update(m_stream); } -/*------------------------------------------------- - cdp1869_out5_w - register 5 write --------------------------------------------------*/ -WRITE8_DEVICE_HANDLER( cdp1869_out5_w ) +//------------------------------------------------- +// out5_w - register 5 write +//------------------------------------------------- + +WRITE8_MEMBER( cdp1869_device::out5_w ) { /* bit description @@ -504,39 +744,33 @@ WRITE8_DEVICE_HANDLER( cdp1869_out5_w ) 15 wn off */ - cdp1869_t *cdp1869 = get_safe_token(device); - UINT16 word = cdp1802_get_r_x(cdp1869); + m_cmem = BIT(offset, 0); + m_line9 = BIT(offset, 3); + m_line16 = BIT(offset, 5); + m_dblpage = BIT(offset, 6); + m_fresvert = BIT(offset, 7); + m_wnamp = (offset & 0x0f00) >> 8; + m_wnfreq = (offset & 0x7000) >> 12; + m_wnoff = BIT(offset, 15); - cdp1869->cmem = BIT(word, 0); - cdp1869->line9 = BIT(word, 3); + stream_update(m_stream); - if (CDP1869_IS_NTSC) + if (m_cmem) { - cdp1869->line16 = BIT(word, 5); - } - - cdp1869->dblpage = BIT(word, 6); - cdp1869->fresvert = BIT(word, 7); - - cdp1869->wnamp = (word & 0x0f00) >> 8; - cdp1869->wnfreq = (word & 0x7000) >> 12; - cdp1869->wnoff = BIT(word, 15); - - if (cdp1869->cmem) - { - cdp1869->pma = word; + m_pma = offset; } else { - cdp1869->pma = 0; + m_pma = 0; } } -/*------------------------------------------------- - cdp1869_out6_w - register 6 write --------------------------------------------------*/ -WRITE8_DEVICE_HANDLER( cdp1869_out6_w ) +//------------------------------------------------- +// out6_w - register 6 write +//------------------------------------------------- + +WRITE8_MEMBER( cdp1869_device::out6_w ) { /* bit description @@ -559,17 +793,15 @@ WRITE8_DEVICE_HANDLER( cdp1869_out6_w ) 15 x */ - cdp1869_t *cdp1869 = get_safe_token(device); - UINT16 word = cdp1802_get_r_x(cdp1869); - - cdp1869->pma = word & 0x7ff; + m_pma = offset & 0x7ff; } -/*------------------------------------------------- - cdp1869_out7_w - register 7 write --------------------------------------------------*/ -WRITE8_DEVICE_HANDLER( cdp1869_out7_w ) +//------------------------------------------------- +// out7_w - register 7 write +//------------------------------------------------- + +WRITE8_MEMBER( cdp1869_device::out7_w ) { /* bit description @@ -592,148 +824,139 @@ WRITE8_DEVICE_HANDLER( cdp1869_out7_w ) 15 x */ - cdp1869_t *cdp1869 = get_safe_token(device); - UINT16 word = cdp1802_get_r_x(cdp1869); - - cdp1869->hma = word & 0x7fc; + m_hma = offset & 0x7fc; } -/*------------------------------------------------- - cdp1869_pageram_r - page memory read --------------------------------------------------*/ -READ8_DEVICE_HANDLER( cdp1869_pageram_r ) -{ - cdp1869_t *cdp1869 = get_safe_token(device); +//------------------------------------------------- +// char_ram_r - character RAM read +//------------------------------------------------- +READ8_MEMBER( cdp1869_device::char_ram_r ) +{ + UINT8 cma = offset & 0x0f; UINT16 pma; - if (cdp1869->cmem) + if (m_cmem) { - pma = get_pma(device); + pma = get_pma(); } else { pma = offset; } - return devcb_call_read8(&cdp1869->in_page_ram_func, pma); + if (m_dblpage) + { + cma &= 0x07; + } + + UINT8 pmd = read_page_ram_byte(pma); + + return read_char_ram_byte(pma, cma, pmd); } -/*------------------------------------------------- - cdp1869_pageram_w - page memory write --------------------------------------------------*/ -WRITE8_DEVICE_HANDLER( cdp1869_pageram_w ) -{ - cdp1869_t *cdp1869 = get_safe_token(device); +//------------------------------------------------- +// char_ram_w - character RAM write +//------------------------------------------------- +WRITE8_MEMBER( cdp1869_device::char_ram_w ) +{ + UINT8 cma = offset & 0x0f; UINT16 pma; - if (cdp1869->cmem) + if (m_cmem) { - pma = get_pma(device); + pma = get_pma(); } else { pma = offset; } - devcb_call_write8(&cdp1869->out_page_ram_func, pma, data); + if (m_dblpage) + { + cma &= 0x07; + } + + UINT8 pmd = read_page_ram_byte(pma); + + write_char_ram_byte(pma, cma, pmd, data); } -/*------------------------------------------------- - cdp1869_charram_r - character memory read --------------------------------------------------*/ -READ8_DEVICE_HANDLER( cdp1869_charram_r ) -{ - cdp1869_t *cdp1869 = get_safe_token(device); +//------------------------------------------------- +// page_ram_r - page RAM read +//------------------------------------------------- - UINT8 cma = offset & 0x0f; +READ8_MEMBER( cdp1869_device::page_ram_r ) +{ UINT16 pma; - if (cdp1869->cmem) + if (m_cmem) { - pma = get_pma(device); + pma = get_pma(); } else { pma = offset; } - if (cdp1869->dblpage) - { - cma &= 0x07; - } - - return cdp1869->intf->char_ram_r(device, pma, cma); + return read_page_ram_byte(pma); } -/*------------------------------------------------- - cdp1869_charram_w - character memory write --------------------------------------------------*/ -WRITE8_DEVICE_HANDLER( cdp1869_charram_w ) -{ - cdp1869_t *cdp1869 = get_safe_token(device); +//------------------------------------------------- +// page_ram_w - page RAM write +//------------------------------------------------- - UINT8 cma = offset & 0x0f; +WRITE8_MEMBER( cdp1869_device::page_ram_w ) +{ UINT16 pma; - if (cdp1869->cmem) + if (m_cmem) { - pma = get_pma(device); + pma = get_pma(); } else { pma = offset; } - if (cdp1869->dblpage) - { - cma &= 0x07; - } - - if (cdp1869->intf->char_ram_w) - { - cdp1869->intf->char_ram_w(device, pma, cma, data); - } + write_page_ram_byte(pma, data); } -/*------------------------------------------------- - cdp1869_predisplay_r - predisplay read --------------------------------------------------*/ -READ_LINE_DEVICE_HANDLER( cdp1869_predisplay_r ) -{ - cdp1869_t *cdp1869 = get_safe_token(device); +//------------------------------------------------- +// page_ram_w - predisplay +//------------------------------------------------- - return cdp1869->prd; +READ_LINE_MEMBER( cdp1869_device::predisplay_r ) +{ + return m_prd; } -/*------------------------------------------------- - cdp1869_pal_ntsc_r - PAL/NTSC read --------------------------------------------------*/ -READ_LINE_DEVICE_HANDLER( cdp1869_pal_ntsc_r ) -{ - cdp1869_t *cdp1869 = get_safe_token(device); +//------------------------------------------------- +// pal_ntsc_r - PAL/NTSC +//------------------------------------------------- - return devcb_call_read_line(&cdp1869->in_pal_ntsc_func); +READ_LINE_MEMBER( cdp1869_device::pal_ntsc_r ) +{ + return devcb_call_read_line(&m_in_pal_ntsc_func); } -/*------------------------------------------------- - cdp1869_update - screen update --------------------------------------------------*/ -void cdp1869_update(running_device *device, bitmap_t *bitmap, const rectangle *cliprect) -{ - cdp1869_t *cdp1869 = get_safe_token(device); +//------------------------------------------------- +// update_screen - update screen +//------------------------------------------------- +void cdp1869_device::update_screen(bitmap_t *bitmap, const rectangle *cliprect) +{ rectangle screen_rect, outer; - if (CDP1869_IS_NTSC) + if (is_ntsc()) { outer.min_x = CDP1869_HBLANK_END; outer.max_x = CDP1869_HBLANK_START - 1; @@ -757,42 +980,38 @@ void cdp1869_update(running_device *device, bitmap_t *bitmap, const rectangle *c } sect_rect(&outer, cliprect); - bitmap_fill(bitmap, &outer, device->machine->pens[cdp1869->bkg]); + bitmap_fill(bitmap, &outer, m_bkg); - if (!cdp1869->dispoff) + if (!m_dispoff) { - int sx, sy, rows, cols, width, height; - UINT16 addr, pmemsize; - - width = CDP1869_CHAR_WIDTH; - height = get_lines(device); + int width = CDP1869_CHAR_WIDTH; + int height = get_lines(); - if (!cdp1869->freshorz) + if (!m_freshorz) { width *= 2; } - if (!cdp1869->fresvert) + if (!m_fresvert) { height *= 2; } - cols = cdp1869->freshorz ? CDP1869_COLUMNS_FULL : CDP1869_COLUMNS_HALF; - rows = (screen_rect.max_y - screen_rect.min_y + 1) / height; + int cols = m_freshorz ? CDP1869_COLUMNS_FULL : CDP1869_COLUMNS_HALF; + int rows = (screen_rect.max_y - screen_rect.min_y + 1) / height; - pmemsize = get_pmemsize(device, cols, rows); + UINT16 pmemsize = get_pmemsize(cols, rows); + UINT16 addr = m_hma; - addr = cdp1869->hma; - - for (sy = 0; sy < rows; sy++) + for (int sy = 0; sy < rows; sy++) { - for (sx = 0; sx < cols; sx++) + for (int sx = 0; sx < cols; sx++) { int x = sx * width; int y = sy * height; - draw_char(device, bitmap, x, y, addr, &screen_rect); - + draw_char(bitmap, &screen_rect, x, y, addr); + addr++; if (addr == pmemsize) addr = 0; @@ -800,160 +1019,3 @@ void cdp1869_update(running_device *device, bitmap_t *bitmap, const rectangle *c } } } - -/*------------------------------------------------- - STREAM_UPDATE( cdp1869_stream_update ) --------------------------------------------------*/ - -static STREAM_UPDATE( cdp1869_stream_update ) -{ - cdp1869_t *cdp1869 = (cdp1869_t *)param; - INT16 signal = cdp1869->signal; - stream_sample_t *buffer = outputs[0]; - - memset( buffer, 0, samples * sizeof(*buffer) ); - - if (!cdp1869->toneoff && cdp1869->toneamp) - { - double frequency = (cdp1869->device->clock() / 2) / (512 >> cdp1869->tonefreq) / (cdp1869->tonediv + 1); -// double amplitude = cdp1869->toneamp * ((0.78*5) / 15); - - int rate = cdp1869->device->machine->sample_rate / 2; - - /* get progress through wave */ - int incr = cdp1869->incr; - - if (signal < 0) - { - signal = -(cdp1869->toneamp * (0x07fff / 15)); - } - else - { - signal = cdp1869->toneamp * (0x07fff / 15); - } - - while( samples-- > 0 ) - { - *buffer++ = signal; - incr -= frequency; - while( incr < 0 ) - { - incr += rate; - signal = -signal; - } - } - - /* store progress through wave */ - cdp1869->incr = incr; - cdp1869->signal = signal; - } -/* - if (!cdp1869->wnoff) - { - double amplitude = cdp1869->wnamp * ((0.78*5) / 15); - - for (int wndiv = 0; wndiv < 128; wndiv++) - { - double frequency = (cdp1869->clock / 2) / (4096 >> cdp1869->wnfreq) / (wndiv + 1): - - sum_square_wave(buffer, frequency, amplitude); - } - } -*/ -} - -/*------------------------------------------------- - DEVICE_START( cdp1869 ) --------------------------------------------------*/ - -static DEVICE_START( cdp1869 ) -{ - cdp1869_t *cdp1869 = get_safe_token(device); - - /* validate arguments */ - cdp1869->intf = (const cdp1869_interface *)device->baseconfig().static_config(); - - assert(cdp1869->intf->pcb_r != NULL); - assert(cdp1869->intf->char_ram_r != NULL); - - /* resolve callbacks */ - devcb_resolve_read8(&cdp1869->in_page_ram_func, &cdp1869->intf->in_page_ram_func, device); - devcb_resolve_write8(&cdp1869->out_page_ram_func, &cdp1869->intf->out_page_ram_func, device); - devcb_resolve_write_line(&cdp1869->out_prd_func, &cdp1869->intf->out_prd_func, device); - devcb_resolve_read_line(&cdp1869->in_pal_ntsc_func, &cdp1869->intf->in_pal_ntsc_func, device); - - /* set initial values */ - cdp1869->device = device; - cdp1869->stream = stream_create(device, 0, 1, device->machine->sample_rate, cdp1869, cdp1869_stream_update); - cdp1869->incr = 0; - cdp1869->signal = 0x07fff; - cdp1869->toneoff = 1; - cdp1869->wnoff = 1; - - /* get the screen device */ - cdp1869->screen = downcast<screen_device *>(device->machine->device(cdp1869->intf->screen_tag)); - assert(cdp1869->screen != NULL); - - /* get the CPU device */ - cdp1869->cpu = device->machine->device(cdp1869->intf->cpu_tag); - assert(cdp1869->cpu != NULL); - - /* allocate predisplay timer */ - cdp1869->prd_changed_timer = timer_alloc(device->machine, prd_changed_tick, (void *)device); - update_prd_changed_timer(cdp1869); - - /* register for state saving */ - state_save_register_postload(device->machine, cdp1869_state_save_postload, cdp1869); - - state_save_register_device_item(device, 0, cdp1869->prd); - state_save_register_device_item(device, 0, cdp1869->dispoff); - state_save_register_device_item(device, 0, cdp1869->fresvert); - state_save_register_device_item(device, 0, cdp1869->freshorz); - state_save_register_device_item(device, 0, cdp1869->cmem); - state_save_register_device_item(device, 0, cdp1869->dblpage); - state_save_register_device_item(device, 0, cdp1869->line16); - state_save_register_device_item(device, 0, cdp1869->line9); - state_save_register_device_item(device, 0, cdp1869->cfc); - state_save_register_device_item(device, 0, cdp1869->col); - state_save_register_device_item(device, 0, cdp1869->bkg); - state_save_register_device_item(device, 0, cdp1869->pma); - state_save_register_device_item(device, 0, cdp1869->hma); - - state_save_register_device_item(device, 0, cdp1869->signal); - state_save_register_device_item(device, 0, cdp1869->incr); - state_save_register_device_item(device, 0, cdp1869->toneoff); - state_save_register_device_item(device, 0, cdp1869->wnoff); - state_save_register_device_item(device, 0, cdp1869->tonediv); - state_save_register_device_item(device, 0, cdp1869->tonefreq); - state_save_register_device_item(device, 0, cdp1869->toneamp); - state_save_register_device_item(device, 0, cdp1869->wnfreq); - state_save_register_device_item(device, 0, cdp1869->wnamp); -} - -/*------------------------------------------------- - DEVICE_GET_INFO( cdp1869 ) --------------------------------------------------*/ - -DEVICE_GET_INFO( cdp1869 ) -{ - switch (state) - { - /* --- the following bits of info are returned as 64-bit signed integers --- */ - case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(cdp1869_t); break; - - /* --- the following bits of info are returned as pointers to data or functions --- */ - case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(cdp1869); break; - case DEVINFO_FCT_STOP: /* Nothing */ break; - case DEVINFO_FCT_RESET: /* Nothing */ break; - - /* --- the following bits of info are returned as NULL-terminated strings --- */ - case DEVINFO_STR_NAME: strcpy(info->s, "RCA CDP1869"); 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 Nicola Salmoria and the MAME Team"); break; - } -} - - -DEFINE_LEGACY_SOUND_DEVICE(CDP1869, cdp1869); diff --git a/src/emu/sound/cdp1869.h b/src/emu/sound/cdp1869.h index 1f4d05c3a55..6adb08a130c 100644 --- a/src/emu/sound/cdp1869.h +++ b/src/emu/sound/cdp1869.h @@ -1,50 +1,96 @@ -/* - - RCA CDP1869/70/76 Video Interface System (VIS) - - http://homepage.mac.com/ruske/cosmacelf/cdp1869.pdf - - ________________ ________________ - TPA 1 ---| \/ |--- 40 Vdd PREDISPLAY_ 1 ---| \/ |--- 40 Vdd - TPB 2 ---| |--- 39 PMSEL *DISPLAY_ 2 ---| |--- 39 PAL/NTSC_ - MRD_ 3 ---| |--- 38 PMWR_ PCB 3 ---| |--- 38 CPUCLK - MWR_ 4 ---| |--- 37 *CMSEL CCB1 4 ---| |--- 37 XTAL (DOT) - MA0/8 5 ---| |--- 36 CMWR_ BUS7 5 ---| |--- 36 XTAL (DOT)_ - MA1/9 6 ---| |--- 35 PMA0 CCB0 6 ---| |--- 35 *ADDRSTB_ - MA2/10 7 ---| |--- 34 PMA1 BUS6 7 ---| |--- 34 MRD_ - MA3/11 8 ---| |--- 33 PMA2 CDB5 8 ---| |--- 33 TPB - MA4/12 9 ---| |--- 32 PMA3 BUS5 9 ---| |--- 32 *CMSEL - MA5/13 10 ---| CDP1869C |--- 31 PMA4 CDB4 10 ---| CDP1870/76C |--- 31 BURST - MA6/14 11 ---| top view |--- 30 PMA5 BUS4 11 ---| top view |--- 30 *H SYNC_ - MA7/15 12 ---| |--- 29 PMA6 CDB3 12 ---| |--- 29 COMPSYNC_ - N0 13 ---| |--- 28 PMA7 BUS3 13 ---| |--- 28 LUM / (RED)^ - N1 14 ---| |--- 27 PMA8 CDB2 14 ---| |--- 27 PAL CHROM / (BLUE)^ - N2 15 ---| |--- 26 PMA9 BUS2 15 ---| |--- 26 NTSC CHROM / (GREEN)^ - *H SYNC_ 16 ---| |--- 25 CMA3/PMA10 CDB1 16 ---| |--- 25 XTAL_ (CHROM) - *DISPLAY_ 17 ---| |--- 24 CMA2 BUS1 17 ---| |--- 24 XTAL (CHROM) - *ADDRSTB_ 18 ---| |--- 23 CMA1 CDB0 18 ---| |--- 23 EMS_ - SOUND 19 ---| |--- 22 CMA0 BUS0 19 ---| |--- 22 EVS_ - VSS 20 ---|________________|--- 21 *N=3_ Vss 20 ---|________________|--- 21 *N=3_ - - - * = INTERCHIP CONNECTIONS ^ = FOR THE RGB BOND-OUT OPTION (CDP1876C) _ = ACTIVE LOW - -*/ +/********************************************************************** + + RCA CDP1869/1870/1876 Video Interface System (VIS) emulation + + Copyright MESS Team. + Visit http://mamedev.org for licensing and usage restrictions. + +********************************************************************** + _____ _____ + TPA 1 |* \_/ | 40 Vdd + TPB 2 | | 39 PMSEL + _MRD 3 | | 38 _PMWR + _MWR 4 | | 37 CMSEL + MA0/8 5 | | 36 _CMWR + MA1/9 6 | | 35 PMA0 + MA2/10 7 | | 34 PMA1 + MA3/11 8 | | 33 PMA2 + MA4/12 9 | | 32 PMA3 + MA5/13 10 | | 31 PMA4 + MA6/14 11 | CDP1869 | 30 PMA5 + MA7/15 12 | | 29 PMA6 + N0 13 | | 28 PMA7 + N1 14 | | 27 PMA8 + N2 15 | | 26 PMA9 + _H SYNC 16 | | 25 CMA3/PMA10 + _DISPLAY 17 | | 24 CMA2 + _ADDRSTB 18 | | 23 CMA1 + SOUND 19 | | 22 CMA0 + Vss 20 |_____________| 21 _N=3 + + _____ _____ + _PREDISPLAY 1 |* \_/ | 40 Vdd + _DISPLAY 2 | | 39 PAL/_NTSC + PCB 3 | | 38 CPUCLK + CCB1 4 | | 37 XTAL (DOT) + BUS7 5 | | 36 _XTAL (DOT) + CCB0 6 | | 35 _ADDRSTB + BUS6 7 | | 34 _MRD + CDB5 8 | | 33 TPB + BUS5 9 | | 32 CMSEL + CDB4 10 | | 31 BURST + BUS4 11 | CDP1870 | 30 _H SYNC + CDB3 12 | | 29 _COMPSYNC + BUS3 13 | | 28 LUM + CDB2 14 | | 27 PAL CHROM + BUS2 15 | | 26 NTSC CHROM + CDB1 16 | | 25 _XTAL (CHROM) + BUS1 17 | | 24 XTAL (CHROM) + CDB0 18 | | 23 _EMS + BUS0 19 | | 22 _EVS + Vss 20 |_____________| 21 _N=3 + + _____ _____ + _PREDISPLAY 1 |* \_/ | 40 Vdd + _DISPLAY 2 | | 39 PAL/_NTSC + PCB 3 | | 38 CPUCLK + CCB1 4 | | 37 XTAL (DOT) + BUS7 5 | | 36 _XTAL (DOT) + CCB0 6 | | 35 _ADDRSTB + BUS6 7 | | 34 _MRD + CDB5 8 | | 33 TPB + BUS5 9 | | 32 CMSEL + CDB4 10 | | 31 BURST + BUS4 11 | CDP1876 | 30 _H SYNC + CDB3 12 | | 29 _COMPSYNC + BUS3 13 | | 28 RED + CDB2 14 | | 27 BLUE + BUS2 15 | | 26 GREEN + CDB1 16 | | 25 _XTAL (CHROM) + BUS1 17 | | 24 XTAL (CHROM) + CDB0 18 | | 23 _EMS + BUS0 19 | | 22 _EVS + Vss 20 |_____________| 21 _N=3 + +**********************************************************************/ + +#pragma once #ifndef __CDP1869__ #define __CDP1869__ -#include "devlegcy.h" +#include "emu.h" -/*************************************************************************** - MACROS / CONSTANTS -***************************************************************************/ -#define CDP1869_DOT_CLK_PAL 5626000.0 -#define CDP1869_DOT_CLK_NTSC 5670000.0 -#define CDP1869_COLOR_CLK_PAL 8867236.0 -#define CDP1869_COLOR_CLK_NTSC 7159090.0 +//************************************************************************** +// MACROS / CONSTANTS +//************************************************************************** + +#define CDP1869_DOT_CLK_PAL (float)XTAL_5_626MHz +#define CDP1869_DOT_CLK_NTSC (float)XTAL_5_67MHz +#define CDP1869_COLOR_CLK_PAL (float)XTAL_8_867236MHz +#define CDP1869_COLOR_CLK_NTSC (float)XTAL_7_15909MHz #define CDP1869_CPU_CLK_PAL (CDP1869_DOT_CLK_PAL / 2) #define CDP1869_CPU_CLK_NTSC (CDP1869_DOT_CLK_NTSC / 2) @@ -85,32 +131,35 @@ #define CDP1869_PALETTE_LENGTH 8+64 -DECLARE_LEGACY_SOUND_DEVICE(CDP1869, cdp1869); -#define MDRV_CDP1869_ADD(_tag, _pixclock, _config) \ + +//************************************************************************** +// INTERFACE CONFIGURATION MACROS +//************************************************************************** + +#define MDRV_CDP1869_ADD(_tag, _pixclock, _config, _map) \ MDRV_DEVICE_ADD(_tag, CDP1869, _pixclock) \ - MDRV_DEVICE_CONFIG(_config) + MDRV_DEVICE_CONFIG(_config) \ + MDRV_DEVICE_ADDRESS_MAP(0, _map) #define MDRV_CDP1869_SCREEN_PAL_ADD(_tag, _clock) \ MDRV_SCREEN_ADD(_tag, RASTER) \ MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) \ MDRV_SCREEN_RAW_PARAMS(_clock, CDP1869_SCREEN_WIDTH, CDP1869_HBLANK_END, CDP1869_HBLANK_START, CDP1869_TOTAL_SCANLINES_PAL, CDP1869_SCANLINE_VBLANK_END_PAL, CDP1869_SCANLINE_VBLANK_START_PAL) \ - MDRV_PALETTE_LENGTH(8+64) \ - MDRV_PALETTE_INIT(cdp1869) + MDRV_PALETTE_LENGTH(8+64) #define MDRV_CDP1869_SCREEN_NTSC_ADD(_tag, _clock) \ MDRV_SCREEN_ADD(_tag, RASTER) \ MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) \ MDRV_SCREEN_RAW_PARAMS(_clock, CDP1869_SCREEN_WIDTH, CDP1869_HBLANK_END, CDP1869_HBLANK_START, CDP1869_TOTAL_SCANLINES_NTSC, CDP1869_SCANLINE_VBLANK_END_NTSC, CDP1869_SCANLINE_VBLANK_START_NTSC) \ - MDRV_PALETTE_LENGTH(8+64) \ - MDRV_PALETTE_INIT(cdp1869) + MDRV_PALETTE_LENGTH(8+64) #define CDP1869_INTERFACE(_name) \ const cdp1869_interface (_name) = -#define CDP1869_CHAR_RAM_READ(name) UINT8 name(running_device *device, UINT16 pma, UINT8 cma) -#define CDP1869_CHAR_RAM_WRITE(name) void name(running_device *device, UINT16 pma, UINT8 cma, UINT8 data) -#define CDP1869_PCB_READ(name) int name(running_device *device, UINT16 pma, UINT8 cma) +#define CDP1869_CHAR_RAM_READ(name) UINT8 name(running_device *device, UINT16 pma, UINT8 cma, UINT8 pmd) +#define CDP1869_CHAR_RAM_WRITE(name) void name(running_device *device, UINT16 pma, UINT8 cma, UINT8 pmd, UINT8 data) +#define CDP1869_PCB_READ(name) int name(running_device *device, UINT16 pma, UINT8 cma, UINT8 pmd) #define CDP1869_PAL \ DEVCB_LINE_VCC @@ -118,75 +167,175 @@ DECLARE_LEGACY_SOUND_DEVICE(CDP1869, cdp1869); #define CDP1869_NTSC \ DEVCB_LINE_GND -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ -typedef UINT8 (*cdp1869_char_ram_read_func)(running_device *device, UINT16 pma, UINT8 cma); -typedef void (*cdp1869_char_ram_write_func)(running_device *device, UINT16 pma, UINT8 cma, UINT8 data); -typedef int (*cdp1869_pcb_read_func)(running_device *device, UINT16 pma, UINT8 cma); -/* interface */ -typedef struct _cdp1869_interface cdp1869_interface; -struct _cdp1869_interface +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +typedef UINT8 (*cdp1869_char_ram_read_func)(running_device *device, UINT16 pma, UINT8 cma, UINT8 pmd); +typedef void (*cdp1869_char_ram_write_func)(running_device *device, UINT16 pma, UINT8 cma, UINT8 pmd, UINT8 data); +typedef int (*cdp1869_pcb_read_func)(running_device *device, UINT16 pma, UINT8 cma, UINT8 pmd); + + +// ======================> cdp1869_interface + +struct cdp1869_interface { - const char *cpu_tag; /* CPU we work together with */ - const char *screen_tag; /* screen we are acting on */ + const char *screen_tag; // screen we are acting on - /* pixel clock of the chip is the device clock */ - int color_clock; /* the chroma clock of the chip */ + // pixel clock of the chip is the device clock + int color_clock; // the chroma clock of the chip - /* screen format */ + // screen format devcb_read_line in_pal_ntsc_func; - /* page memory read function */ - devcb_read8 in_page_ram_func; + // page memory color bit read function + cdp1869_pcb_read_func in_pcb_func; - /* page memory write function */ - devcb_write8 out_page_ram_func; + // character memory read function + cdp1869_char_ram_read_func in_char_ram_func; - /* page memory color bit read function */ - cdp1869_pcb_read_func pcb_r; + // character memory write function + cdp1869_char_ram_write_func out_char_ram_func; - /* character memory read function */ - cdp1869_char_ram_read_func char_ram_r; + // if specified, this gets called for every change of the predisplay pin (CDP1870/76 pin 1) + devcb_write_line out_prd_func; +}; - /* character memory write function */ - cdp1869_char_ram_write_func char_ram_w; - /* if specified, this gets called for every change of the predisplay pin (CDP1870/76 pin 1) */ - devcb_write_line out_prd_func; + +// ======================> cdp1869_device_config + +class cdp1869_device_config : public device_config, + public device_config_sound_interface, + public device_config_memory_interface, + public cdp1869_interface +{ + friend class cdp1869_device; + + // construction/destruction + cdp1869_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); + +public: + // allocators + static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock); + virtual device_t *alloc_device(running_machine &machine) const; + +protected: + // device_config overrides + virtual void device_config_complete(); + + // device_config_memory_interface overrides + virtual const address_space_config *memory_space_config(int spacenum = 0) const; + + // address space configurations + const address_space_config m_space_config; }; -/*************************************************************************** - PROTOTYPES -***************************************************************************/ -/* palette initialization */ -PALETTE_INIT( cdp1869 ); -/* register access */ -WRITE8_DEVICE_HANDLER( cdp1869_out3_w ); -WRITE8_DEVICE_HANDLER( cdp1869_out4_w ); -WRITE8_DEVICE_HANDLER( cdp1869_out5_w ); -WRITE8_DEVICE_HANDLER( cdp1869_out6_w ); -WRITE8_DEVICE_HANDLER( cdp1869_out7_w ); +// ======================> cdp1869_device -/* character memory access */ -READ8_DEVICE_HANDLER ( cdp1869_charram_r ); -WRITE8_DEVICE_HANDLER ( cdp1869_charram_w ); +class cdp1869_device : public device_t, + public device_sound_interface, + public device_memory_interface +{ + friend class cdp1869_device_config; + + // construction/destruction + cdp1869_device(running_machine &_machine, const cdp1869_device_config &_config); + +public: + DECLARE_WRITE8_MEMBER( out3_w ); + DECLARE_WRITE8_MEMBER( out4_w ); + DECLARE_WRITE8_MEMBER( out5_w ); + DECLARE_WRITE8_MEMBER( out6_w ); + DECLARE_WRITE8_MEMBER( out7_w ); + + DECLARE_READ8_MEMBER( char_ram_r ); + DECLARE_WRITE8_MEMBER( char_ram_w ); + + DECLARE_READ8_MEMBER( page_ram_r ); + DECLARE_WRITE8_MEMBER( page_ram_w ); + + DECLARE_READ_LINE_MEMBER( predisplay_r ); + DECLARE_READ_LINE_MEMBER( pal_ntsc_r ); + + void update_screen(bitmap_t *bitmap, const rectangle *cliprect); + +protected: + // device-level overrides + virtual void device_start(); + virtual void device_post_load(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + // internal callbacks + static STREAM_UPDATE( static_stream_generate ); + virtual void stream_generate(stream_sample_t **inputs, stream_sample_t **outputs, int samples); + + inline bool is_ntsc(); + inline UINT8 read_page_ram_byte(offs_t address); + inline void write_page_ram_byte(offs_t address, UINT8 data); + inline UINT8 read_char_ram_byte(offs_t pma, offs_t cma, UINT8 pmd); + inline void write_char_ram_byte(offs_t pma, offs_t cma, UINT8 pmd, UINT8 data); + inline int read_pcb(offs_t pma, offs_t cma, UINT8 pmd); + inline void update_prd_changed_timer(); + inline rgb_t get_rgb(int i, int c, int l); + inline int get_lines(); + inline UINT16 get_pmemsize(int cols, int rows); + inline UINT16 get_pma(); + inline int get_pen(int ccb0, int ccb1, int pcb); + + void initialize_palette(); + void draw_line(bitmap_t *bitmap, const rectangle *rect, int x, int y, UINT8 data, int color); + void draw_char(bitmap_t *bitmap, const rectangle *rect, int x, int y, UINT16 pma); + +private: + devcb_resolved_read_line m_in_pal_ntsc_func; + devcb_resolved_write_line m_out_prd_func; + cdp1869_pcb_read_func m_in_pcb_func; + cdp1869_char_ram_read_func m_in_char_ram_func; + cdp1869_char_ram_write_func m_out_char_ram_func; + + screen_device *m_screen; + address_space *m_page_ram; + emu_timer *m_prd_timer; + sound_stream *m_stream; + + // video state + int m_prd; // predisplay + int m_dispoff; // display off + int m_fresvert; // full resolution vertical + int m_freshorz; // full resolution horizontal + int m_cmem; // character memory access mode + int m_dblpage; // double page mode + int m_line16; // 16-line hi-res mode + int m_line9; // 9 line mode + int m_cfc; // color format control + UINT8 m_col; // character color control + UINT8 m_bkg; // background color + UINT16 m_pma; // page memory address + UINT16 m_hma; // home memory address + + // sound state + INT16 m_signal; // current signal + int m_incr; // initial wave state + int m_toneoff; // tone off + int m_wnoff; // white noise off + UINT8 m_tonediv; // tone divisor + UINT8 m_tonefreq; // tone range select + UINT8 m_toneamp; // tone output amplitude + UINT8 m_wnfreq; // white noise range select + UINT8 m_wnamp; // white noise output amplitude + + const cdp1869_device_config &m_config; +}; -/* page memory access */ -READ8_DEVICE_HANDLER ( cdp1869_pageram_r ); -WRITE8_DEVICE_HANDLER ( cdp1869_pageram_w ); -/* predisplay */ -READ_LINE_DEVICE_HANDLER( cdp1869_predisplay_r ); +// device type definition +extern const device_type CDP1869; -/* PAL/NTSC */ -READ_LINE_DEVICE_HANDLER( cdp1869_pal_ntsc_r ); -/* screen update */ -void cdp1869_update(running_device *device, bitmap_t *bitmap, const rectangle *cliprect); #endif diff --git a/src/mame/drivers/cidelsa.c b/src/mame/drivers/cidelsa.c index 973faa0240e..d99229589be 100644 --- a/src/mame/drivers/cidelsa.c +++ b/src/mame/drivers/cidelsa.c @@ -1,3 +1,5 @@ +#define ADDRESS_MAP_MODERN + #include "emu.h" #include "cpu/cosmac/cosmac.h" #include "cpu/cop400/cop400.h" @@ -9,29 +11,25 @@ /* CDP1802 Interface */ -static READ_LINE_DEVICE_HANDLER( clear_r ) +READ_LINE_MEMBER( cidelsa_state::clear_r ) { - cidelsa_state *state = device->machine->driver_data<cidelsa_state>(); - - return state->reset; + return m_reset; } -static WRITE_LINE_DEVICE_HANDLER( cidelsa_q_w ) +WRITE_LINE_MEMBER( cidelsa_state::q_w ) { - cidelsa_state *driver_state = device->machine->driver_data<cidelsa_state>(); - - driver_state->cdp1802_q = state; + m_cdp1802_q = state; } static COSMAC_INTERFACE( cidelsa_cdp1802_config ) { DEVCB_LINE_VCC, - DEVCB_LINE(clear_r), + DEVCB_DRIVER_LINE_MEMBER(cidelsa_state, clear_r), DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, - DEVCB_LINE(cidelsa_q_w), + DEVCB_DRIVER_LINE_MEMBER(cidelsa_state, q_w), DEVCB_NULL, DEVCB_NULL, NULL, @@ -41,7 +39,7 @@ static COSMAC_INTERFACE( cidelsa_cdp1802_config ) /* Sound Interface */ -static WRITE8_HANDLER( draco_sound_bankswitch_w ) +WRITE8_MEMBER( cidelsa_state::draco_sound_bankswitch_w ) { /* @@ -56,13 +54,11 @@ static WRITE8_HANDLER( draco_sound_bankswitch_w ) int bank = BIT(data, 3); - memory_set_bank(space->machine, "bank1", bank); + memory_set_bank(&m_machine, "bank1", bank); } -static WRITE8_DEVICE_HANDLER( draco_sound_g_w ) +WRITE8_MEMBER( cidelsa_state::draco_sound_g_w ) { - cidelsa_state *state = device->machine->driver_data<cidelsa_state>(); - /* G1 G0 description @@ -77,43 +73,37 @@ static WRITE8_DEVICE_HANDLER( draco_sound_g_w ) switch (data) { case 0x01: - ay8910_data_w(device, 0, state->draco_ay_latch); + ay8910_data_w(m_psg, 0, m_draco_ay_latch); break; case 0x02: - state->draco_ay_latch = ay8910_r(device, 0); + m_draco_ay_latch = ay8910_r(m_psg, 0); break; case 0x03: - ay8910_address_w(device, 0, state->draco_ay_latch); + ay8910_address_w(m_psg, 0, m_draco_ay_latch); break; } } -static READ8_HANDLER( draco_sound_in_r ) +READ8_MEMBER( cidelsa_state::draco_sound_in_r ) { - cidelsa_state *state = space->machine->driver_data<cidelsa_state>(); - - return ~(state->draco_sound) & 0x07; + return ~(m_draco_sound) & 0x07; } -static READ8_HANDLER( draco_sound_ay8910_r ) +READ8_MEMBER( cidelsa_state::draco_sound_ay8910_r ) { - cidelsa_state *state = space->machine->driver_data<cidelsa_state>(); - - return state->draco_ay_latch; + return m_draco_ay_latch; } -static WRITE8_HANDLER( draco_sound_ay8910_w ) +WRITE8_MEMBER( cidelsa_state::draco_sound_ay8910_w ) { - cidelsa_state *state = space->machine->driver_data<cidelsa_state>(); - - state->draco_ay_latch = data; + m_draco_ay_latch = data; } /* Read/Write Handlers */ -static WRITE8_HANDLER( destryer_out1_w ) +WRITE8_MEMBER( cidelsa_state::destryer_out1_w ) { /* bit description @@ -131,7 +121,7 @@ static WRITE8_HANDLER( destryer_out1_w ) /* CDP1852 Interfaces */ -static WRITE8_HANDLER( altair_out1_w ) +WRITE8_MEMBER( cidelsa_state::altair_out1_w ) { /* bit description @@ -146,12 +136,12 @@ static WRITE8_HANDLER( altair_out1_w ) 7 CONT. M1 */ - set_led_status(space->machine, 0, data & 0x08); // 1P - set_led_status(space->machine, 1, data & 0x10); // 2P - set_led_status(space->machine, 2, data & 0x20); // FIRE + set_led_status(&m_machine, 0, data & 0x08); // 1P + set_led_status(&m_machine, 1, data & 0x10); // 2P + set_led_status(&m_machine, 2, data & 0x20); // FIRE } -static WRITE8_HANDLER( draco_out1_w ) +WRITE8_MEMBER( cidelsa_state::draco_out1_w ) { /* bit description @@ -166,9 +156,7 @@ static WRITE8_HANDLER( draco_out1_w ) 7 SONIDO C -> COP402 IN2 */ - cidelsa_state *state = space->machine->driver_data<cidelsa_state>(); - - state->draco_sound = (data & 0xe0) >> 5; + m_draco_sound = (data & 0xe0) >> 5; } static CDP1852_INTERFACE( cidelsa_cdp1852_in0_intf ) @@ -199,7 +187,7 @@ static CDP1852_INTERFACE( altair_cdp1852_out1_intf ) { CDP1852_MODE_OUTPUT, DEVCB_NULL, - DEVCB_MEMORY_HANDLER(CDP1802_TAG, PROGRAM, altair_out1_w), + DEVCB_DRIVER_MEMBER(cidelsa_state, altair_out1_w), DEVCB_NULL }; @@ -207,7 +195,7 @@ static CDP1852_INTERFACE( draco_cdp1852_out1_intf ) { CDP1852_MODE_OUTPUT, DEVCB_NULL, - DEVCB_MEMORY_HANDLER(CDP1802_TAG, PROGRAM, draco_out1_w), + DEVCB_DRIVER_MEMBER(cidelsa_state, draco_out1_w), DEVCB_NULL }; @@ -224,75 +212,65 @@ static COP400_INTERFACE( draco_cop_intf ) // Destroyer -static ADDRESS_MAP_START( destryer_map, ADDRESS_SPACE_PROGRAM, 8 ) +static ADDRESS_MAP_START( destryer_map, ADDRESS_SPACE_PROGRAM, 8, cidelsa_state ) AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x2000, 0x20ff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0xf400, 0xf7ff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_charram_r, cdp1869_charram_w) - AM_RANGE(0xf800, 0xffff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_pageram_r, cdp1869_pageram_w) + AM_RANGE(0xf400, 0xf7ff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_device, char_ram_r, char_ram_w) + AM_RANGE(0xf800, 0xffff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_device, page_ram_r, page_ram_w) ADDRESS_MAP_END -static ADDRESS_MAP_START( destryera_map, ADDRESS_SPACE_PROGRAM, 8 ) +static ADDRESS_MAP_START( destryera_map, ADDRESS_SPACE_PROGRAM, 8, cidelsa_state ) AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x3000, 0x30ff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0xf400, 0xf7ff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_charram_r, cdp1869_charram_w) - AM_RANGE(0xf800, 0xffff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_pageram_r, cdp1869_pageram_w) + AM_RANGE(0xf400, 0xf7ff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_device, char_ram_r, char_ram_w) + AM_RANGE(0xf800, 0xffff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_device, page_ram_r, page_ram_w) ADDRESS_MAP_END -static ADDRESS_MAP_START( destryer_io_map, ADDRESS_SPACE_IO, 8 ) +static ADDRESS_MAP_START( destryer_io_map, ADDRESS_SPACE_IO, 8, cidelsa_state ) AM_RANGE(0x01, 0x01) AM_READ_PORT("IN0") AM_WRITE(destryer_out1_w) AM_RANGE(0x02, 0x02) AM_READ_PORT("IN1") - AM_RANGE(0x03, 0x03) AM_DEVWRITE(CDP1869_TAG, cdp1869_out3_w) - AM_RANGE(0x04, 0x04) AM_DEVWRITE(CDP1869_TAG, cdp1869_out4_w) - AM_RANGE(0x05, 0x05) AM_DEVWRITE(CDP1869_TAG, cdp1869_out5_w) - AM_RANGE(0x06, 0x06) AM_DEVWRITE(CDP1869_TAG, cdp1869_out6_w) - AM_RANGE(0x07, 0x07) AM_DEVWRITE(CDP1869_TAG, cdp1869_out7_w) + AM_RANGE(0x03, 0x07) AM_WRITE(cdp1869_w) ADDRESS_MAP_END // Altair -static ADDRESS_MAP_START( altair_map, ADDRESS_SPACE_PROGRAM, 8 ) +static ADDRESS_MAP_START( altair_map, ADDRESS_SPACE_PROGRAM, 8, cidelsa_state ) AM_RANGE(0x0000, 0x2fff) AM_ROM AM_RANGE(0x3000, 0x30ff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0xf400, 0xf7ff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_charram_r, cdp1869_charram_w) - AM_RANGE(0xf800, 0xffff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_pageram_r, cdp1869_pageram_w) + AM_RANGE(0xf400, 0xf7ff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_device, char_ram_r, char_ram_w) + AM_RANGE(0xf800, 0xffff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_device, page_ram_r, page_ram_w) ADDRESS_MAP_END -static ADDRESS_MAP_START( altair_io_map, ADDRESS_SPACE_IO, 8 ) - AM_RANGE(0x01, 0x01) AM_DEVREAD("ic23", cdp1852_data_r) AM_DEVWRITE("ic26", cdp1852_data_w) - AM_RANGE(0x02, 0x02) AM_DEVREAD("ic24", cdp1852_data_r) - AM_RANGE(0x03, 0x03) AM_DEVWRITE(CDP1869_TAG, cdp1869_out3_w) - AM_RANGE(0x04, 0x04) AM_DEVREAD("ic25", cdp1852_data_r) AM_DEVWRITE(CDP1869_TAG, cdp1869_out4_w) - AM_RANGE(0x05, 0x05) AM_DEVWRITE(CDP1869_TAG, cdp1869_out5_w) - AM_RANGE(0x06, 0x06) AM_DEVWRITE(CDP1869_TAG, cdp1869_out6_w) - AM_RANGE(0x07, 0x07) AM_DEVWRITE(CDP1869_TAG, cdp1869_out7_w) +static ADDRESS_MAP_START( altair_io_map, ADDRESS_SPACE_IO, 8, cidelsa_state ) + AM_RANGE(0x01, 0x01) AM_DEVREAD_LEGACY("ic23", cdp1852_data_r) AM_DEVWRITE_LEGACY("ic26", cdp1852_data_w) + AM_RANGE(0x02, 0x02) AM_DEVREAD_LEGACY("ic24", cdp1852_data_r) + AM_RANGE(0x04, 0x04) AM_DEVREAD_LEGACY("ic25", cdp1852_data_r) + AM_RANGE(0x03, 0x07) AM_WRITE(cdp1869_w) ADDRESS_MAP_END // Draco -static ADDRESS_MAP_START( draco_map, ADDRESS_SPACE_PROGRAM, 8 ) +static ADDRESS_MAP_START( draco_map, ADDRESS_SPACE_PROGRAM, 8, cidelsa_state ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x8000, 0x83ff) AM_RAM AM_SHARE("nvram") - AM_RANGE(0xf400, 0xf7ff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_charram_r, cdp1869_charram_w) - AM_RANGE(0xf800, 0xffff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_pageram_r, cdp1869_pageram_w) + AM_RANGE(0xf400, 0xf7ff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_device, char_ram_r, char_ram_w) + AM_RANGE(0xf800, 0xffff) AM_DEVREADWRITE(CDP1869_TAG, cdp1869_device, page_ram_r, page_ram_w) ADDRESS_MAP_END -static ADDRESS_MAP_START( draco_io_map, ADDRESS_SPACE_IO, 8 ) - AM_RANGE(0x01, 0x01) AM_DEVREAD("ic29", cdp1852_data_r) AM_DEVWRITE("ic32", cdp1852_data_w) - AM_RANGE(0x02, 0x02) AM_DEVREAD("ic30", cdp1852_data_r) - AM_RANGE(0x03, 0x03) AM_DEVWRITE(CDP1869_TAG, cdp1869_out3_w) - AM_RANGE(0x04, 0x04) AM_DEVREAD("ic31", cdp1852_data_r) AM_DEVWRITE(CDP1869_TAG, cdp1869_out4_w) - AM_RANGE(0x05, 0x05) AM_DEVWRITE(CDP1869_TAG, cdp1869_out5_w) - AM_RANGE(0x06, 0x06) AM_DEVWRITE(CDP1869_TAG, cdp1869_out6_w) - AM_RANGE(0x07, 0x07) AM_DEVWRITE(CDP1869_TAG, cdp1869_out7_w) +static ADDRESS_MAP_START( draco_io_map, ADDRESS_SPACE_IO, 8, cidelsa_state ) + AM_RANGE(0x01, 0x01) AM_DEVREAD_LEGACY("ic29", cdp1852_data_r) AM_DEVWRITE_LEGACY("ic32", cdp1852_data_w) + AM_RANGE(0x02, 0x02) AM_DEVREAD_LEGACY("ic30", cdp1852_data_r) + AM_RANGE(0x04, 0x04) AM_DEVREAD_LEGACY("ic31", cdp1852_data_r) + AM_RANGE(0x03, 0x07) AM_WRITE(cdp1869_w) ADDRESS_MAP_END -static ADDRESS_MAP_START( draco_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) +static ADDRESS_MAP_START( draco_sound_map, ADDRESS_SPACE_PROGRAM, 8, cidelsa_state ) AM_RANGE(0x000, 0x3ff) AM_ROMBANK("bank1") ADDRESS_MAP_END -static ADDRESS_MAP_START( draco_sound_io_map, ADDRESS_SPACE_IO, 8 ) +static ADDRESS_MAP_START( draco_sound_io_map, ADDRESS_SPACE_IO, 8, cidelsa_state ) AM_RANGE(COP400_PORT_D, COP400_PORT_D) AM_WRITE(draco_sound_bankswitch_w) - AM_RANGE(COP400_PORT_G, COP400_PORT_G) AM_DEVWRITE(AY8910_TAG, draco_sound_g_w) + AM_RANGE(COP400_PORT_G, COP400_PORT_G) AM_WRITE(draco_sound_g_w) AM_RANGE(COP400_PORT_L, COP400_PORT_L) AM_READWRITE(draco_sound_ay8910_r, draco_sound_ay8910_w) AM_RANGE(COP400_PORT_IN, COP400_PORT_IN) AM_READ(draco_sound_in_r) AM_RANGE(COP400_PORT_SIO, COP400_PORT_SIO) AM_NOP @@ -305,7 +283,7 @@ static CUSTOM_INPUT( cdp1869_pcb_r ) { cidelsa_state *state = field->port->machine->driver_data<cidelsa_state>(); - return state->cdp1869_pcb; + return state->m_cdp1869_pcb; } static INPUT_CHANGED( ef_w ) @@ -461,18 +439,15 @@ static TIMER_CALLBACK( set_cpu_mode ) { cidelsa_state *state = machine->driver_data<cidelsa_state>(); - state->reset = 1; + state->m_reset = 1; } static MACHINE_START( cidelsa ) { cidelsa_state *state = machine->driver_data<cidelsa_state>(); - /* find devices */ - state->cdp1802 = machine->device(CDP1802_TAG); - /* register for state saving */ - state_save_register_global(machine, state->reset); + state_save_register_global(machine, state->m_reset); } static MACHINE_START( draco ) @@ -486,19 +461,17 @@ static MACHINE_START( draco ) memory_set_bank(machine, "bank1", 0); /* register for state saving */ - state_save_register_global(machine, state->draco_sound); - state_save_register_global(machine, state->draco_ay_latch); + state_save_register_global(machine, state->m_draco_sound); + state_save_register_global(machine, state->m_draco_ay_latch); } /* Machine Reset */ -static MACHINE_RESET( cidelsa ) +void cidelsa_state::machine_reset() { - cidelsa_state *state = machine->driver_data<cidelsa_state>(); - /* reset the CPU */ - state->reset = 0; - timer_set(machine, ATTOTIME_IN_MSEC(200), NULL, 0, set_cpu_mode); + m_reset = 0; + timer_set(&m_machine, ATTOTIME_IN_MSEC(200), NULL, 0, set_cpu_mode); } /* Machine Drivers */ @@ -512,7 +485,6 @@ static MACHINE_CONFIG_START( destryer, cidelsa_state ) MDRV_NVRAM_ADD_0FILL("nvram") MDRV_MACHINE_START(cidelsa) - MDRV_MACHINE_RESET(cidelsa) /* sound and video hardware */ MDRV_FRAGMENT_ADD(destryer_video) @@ -527,7 +499,6 @@ static MACHINE_CONFIG_START( destryera, cidelsa_state ) MDRV_NVRAM_ADD_0FILL("nvram") MDRV_MACHINE_START(cidelsa) - MDRV_MACHINE_RESET(cidelsa) /* sound and video hardware */ MDRV_FRAGMENT_ADD(destryer_video) @@ -542,7 +513,6 @@ static MACHINE_CONFIG_START( altair, cidelsa_state ) MDRV_NVRAM_ADD_0FILL("nvram") MDRV_MACHINE_START(cidelsa) - MDRV_MACHINE_RESET(cidelsa) /* input/output hardware */ MDRV_CDP1852_ADD("ic23", CDP1852_CLOCK_HIGH, cidelsa_cdp1852_in0_intf) /* clock is really tied to CDP1869 CMSEL (pin 37) */ @@ -563,7 +533,6 @@ static MACHINE_CONFIG_START( draco, cidelsa_state ) MDRV_NVRAM_ADD_0FILL("nvram") MDRV_MACHINE_START(draco) - MDRV_MACHINE_RESET(cidelsa) MDRV_CPU_ADD(COP402N_TAG, COP402, DRACO_SND_CHR1) MDRV_CPU_PROGRAM_MAP(draco_sound_map) diff --git a/src/mame/includes/cidelsa.h b/src/mame/includes/cidelsa.h index beec3c32954..e24e0f1b6fa 100644 --- a/src/mame/includes/cidelsa.h +++ b/src/mame/includes/cidelsa.h @@ -29,27 +29,52 @@ class cidelsa_state : public driver_device { public: cidelsa_state(running_machine &machine, const driver_device_config_base &config) - : driver_device(machine, config) { } + : driver_device(machine, config), + m_maincpu(*this, CDP1802_TAG), + m_vis(*this, CDP1869_TAG), + m_psg(*this, AY8910_TAG) + { } - /* cpu state */ - int reset; + required_device<cosmac_device> m_maincpu; + required_device<cdp1869_device> m_vis; + optional_device<running_device> m_psg; - /* video state */ - int cdp1802_q; - int cdp1869_prd; - int cdp1869_pcb; + virtual void machine_reset(); - UINT8 *pageram; - UINT8 *pcbram; - UINT8 *charram; + virtual void video_start(); + bool video_update(screen_device &screen, bitmap_t &bitmap, const rectangle &cliprect) { m_vis->update_screen(&bitmap, &cliprect); return false; } - /* sound state */ - int draco_sound; - int draco_ay_latch; + DECLARE_READ8_MEMBER( draco_sound_in_r ); + DECLARE_READ8_MEMBER( draco_sound_ay8910_r ); - /* devices */ - running_device *cdp1802; - running_device *cdp1869; + DECLARE_WRITE8_MEMBER( cdp1869_w ); + DECLARE_WRITE8_MEMBER( draco_sound_bankswitch_w ); + DECLARE_WRITE8_MEMBER( draco_sound_g_w ); + DECLARE_WRITE8_MEMBER( draco_sound_ay8910_w ); + DECLARE_WRITE8_MEMBER( destryer_out1_w ); + DECLARE_WRITE8_MEMBER( altair_out1_w ); + DECLARE_WRITE8_MEMBER( draco_out1_w ); + DECLARE_WRITE8_MEMBER( draco_ay8910_port_b_w ); + + DECLARE_READ_LINE_MEMBER( clear_r ); + + DECLARE_WRITE_LINE_MEMBER( q_w ); + DECLARE_WRITE_LINE_MEMBER( prd_w ); + + // cpu state + int m_reset; + + // video state + int m_cdp1802_q; + int m_cdp1869_pcb; + + UINT8 *m_pageram; + UINT8 *m_pcbram; + UINT8 *m_charram; + + // sound state + int m_draco_sound; + int m_draco_ay_latch; }; /*----------- defined in video/cidelsa.c -----------*/ diff --git a/src/mame/video/cidelsa.c b/src/mame/video/cidelsa.c index be53c53e9d4..240915ce42b 100644 --- a/src/mame/video/cidelsa.c +++ b/src/mame/video/cidelsa.c @@ -4,52 +4,34 @@ #include "sound/ay8910.h" #include "includes/cidelsa.h" -/* Page RAM Access */ +/* Register Access */ -static READ8_DEVICE_HANDLER( cidelsa_pageram_r ) +WRITE8_MEMBER( cidelsa_state::cdp1869_w ) { - cidelsa_state *state = device->machine->driver_data<cidelsa_state>(); - - UINT16 addr = offset & CIDELSA_PAGERAM_MASK; + UINT16 ma = m_maincpu->get_memory_address(); - if (BIT(offset, 10)) + switch (offset + 3) { - return 0xff; + case 3: + m_vis->out3_w(space, ma, data); + break; + + case 4: + m_vis->out4_w(space, ma, data); + break; + + case 5: + m_vis->out5_w(space, ma, data); + break; + + case 6: + m_vis->out6_w(space, ma, data); + break; + + case 7: + m_vis->out7_w(space, ma, data); + break; } - - return state->pageram[addr]; -} - -static WRITE8_DEVICE_HANDLER( cidelsa_pageram_w ) -{ - cidelsa_state *state = device->machine->driver_data<cidelsa_state>(); - - UINT16 addr = offset & CIDELSA_PAGERAM_MASK; - - if (BIT(offset, 10)) - { - return; - } - - state->pageram[addr] = data; -} - -static READ8_DEVICE_HANDLER( draco_pageram_r ) -{ - cidelsa_state *state = device->machine->driver_data<cidelsa_state>(); - - UINT16 addr = offset & DRACO_PAGERAM_MASK; - - return state->pageram[addr]; -} - -static WRITE8_DEVICE_HANDLER( draco_pageram_w ) -{ - cidelsa_state *state = device->machine->driver_data<cidelsa_state>(); - - UINT16 addr = offset & DRACO_PAGERAM_MASK; - - state->pageram[addr] = data; } /* Character RAM Access */ @@ -58,11 +40,11 @@ static CDP1869_CHAR_RAM_READ( cidelsa_charram_r ) { cidelsa_state *state = device->machine->driver_data<cidelsa_state>(); - UINT8 column = BIT(pma, 10) ? 0xff : state->pageram[pma & CIDELSA_PAGERAM_MASK]; + UINT8 column = BIT(pma, 10) ? 0xff : pmd; UINT16 addr = ((column << 3) | (cma & 0x07)) & CIDELSA_CHARRAM_MASK; - UINT8 data = state->charram[addr]; - state->cdp1869_pcb = state->pcbram[addr]; + UINT8 data = state->m_charram[addr]; + state->m_cdp1869_pcb = state->m_pcbram[addr]; return data; } @@ -71,22 +53,21 @@ static CDP1869_CHAR_RAM_WRITE( cidelsa_charram_w ) { cidelsa_state *state = device->machine->driver_data<cidelsa_state>(); - UINT8 column = BIT(pma, 10) ? 0xff : state->pageram[pma & CIDELSA_PAGERAM_MASK]; + UINT8 column = BIT(pma, 10) ? 0xff : pmd; UINT16 addr = ((column << 3) | (cma & 0x07)) & CIDELSA_CHARRAM_MASK; - state->charram[addr] = data; - state->pcbram[addr] = state->cdp1802_q; + state->m_charram[addr] = data; + state->m_pcbram[addr] = state->m_cdp1802_q; } static CDP1869_CHAR_RAM_READ( draco_charram_r ) { cidelsa_state *state = device->machine->driver_data<cidelsa_state>(); - UINT8 column = state->pageram[pma & DRACO_PAGERAM_MASK]; - UINT16 addr = ((column << 3) | (cma & 0x07)) & CIDELSA_CHARRAM_MASK; + UINT16 addr = ((pmd << 3) | (cma & 0x07)) & CIDELSA_CHARRAM_MASK; - UINT8 data = state->charram[addr]; - state->cdp1869_pcb = state->pcbram[addr]; + UINT8 data = state->m_charram[addr]; + state->m_cdp1869_pcb = state->m_pcbram[addr]; return data; } @@ -95,11 +76,10 @@ static CDP1869_CHAR_RAM_WRITE( draco_charram_w ) { cidelsa_state *state = device->machine->driver_data<cidelsa_state>(); - UINT8 column = state->pageram[pma & DRACO_PAGERAM_MASK]; - UINT16 addr = ((column << 3) | (cma & 0x07)) & CIDELSA_CHARRAM_MASK; + UINT16 addr = ((pmd << 3) | (cma & 0x07)) & CIDELSA_CHARRAM_MASK; - state->charram[addr] = data; - state->pcbram[addr] = state->cdp1802_q; + state->m_charram[addr] = data; + state->m_pcbram[addr] = state->m_cdp1802_q; } /* Page Color Bit Access */ @@ -108,71 +88,70 @@ static CDP1869_PCB_READ( cidelsa_pcb_r ) { cidelsa_state *state = device->machine->driver_data<cidelsa_state>(); - UINT8 column = state->pageram[pma & CIDELSA_PAGERAM_MASK]; - UINT16 addr = ((column << 3) | (cma & 0x07)) & CIDELSA_CHARRAM_MASK; + UINT16 addr = ((pmd << 3) | (cma & 0x07)) & CIDELSA_CHARRAM_MASK; - return state->pcbram[addr]; + return state->m_pcbram[addr]; } static CDP1869_PCB_READ( draco_pcb_r ) { cidelsa_state *state = device->machine->driver_data<cidelsa_state>(); - UINT8 column = state->pageram[pma & DRACO_PAGERAM_MASK]; - UINT16 addr = ((column << 3) | (cma & 0x07)) & CIDELSA_CHARRAM_MASK; + UINT16 addr = ((pmd << 3) | (cma & 0x07)) & CIDELSA_CHARRAM_MASK; - return state->pcbram[addr]; + return state->m_pcbram[addr]; } /* Predisplay Changed Handler */ -static WRITE_LINE_DEVICE_HANDLER( cidelsa_prd_w ) +WRITE_LINE_MEMBER( cidelsa_state::prd_w ) { - cidelsa_state *driver_state = device->machine->driver_data<cidelsa_state>(); - /* invert PRD signal */ - cpu_set_input_line(driver_state->cdp1802, COSMAC_INPUT_LINE_INT, state ? CLEAR_LINE : ASSERT_LINE); - cpu_set_input_line(driver_state->cdp1802, COSMAC_INPUT_LINE_EF1, state ? CLEAR_LINE : ASSERT_LINE); + cpu_set_input_line(m_maincpu, COSMAC_INPUT_LINE_INT, state ? CLEAR_LINE : ASSERT_LINE); + cpu_set_input_line(m_maincpu, COSMAC_INPUT_LINE_EF1, state ? CLEAR_LINE : ASSERT_LINE); } +/* Page RAM */ + +static ADDRESS_MAP_START( cidelsa_page_ram, 0, 8 ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000, 0x3ff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( draco_page_ram, 0, 8 ) + ADDRESS_MAP_UNMAP_HIGH + AM_RANGE(0x000, 0x7ff) AM_RAM +ADDRESS_MAP_END + /* CDP1869 Interface */ static CDP1869_INTERFACE( destryer_cdp1869_intf ) { - CDP1802_TAG, SCREEN_TAG, 0, CDP1869_PAL, - DEVCB_HANDLER(cidelsa_pageram_r), - DEVCB_HANDLER(cidelsa_pageram_w), cidelsa_pcb_r, cidelsa_charram_r, cidelsa_charram_w, - DEVCB_LINE(cidelsa_prd_w) + DEVCB_DRIVER_LINE_MEMBER(cidelsa_state, prd_w) }; static CDP1869_INTERFACE( altair_cdp1869_intf ) { - CDP1802_TAG, SCREEN_TAG, 0, CDP1869_PAL, - DEVCB_HANDLER(cidelsa_pageram_r), - DEVCB_HANDLER(cidelsa_pageram_w), cidelsa_pcb_r, cidelsa_charram_r, cidelsa_charram_w, - DEVCB_LINE(cidelsa_prd_w) + DEVCB_DRIVER_LINE_MEMBER(cidelsa_state, prd_w) }; static CDP1869_INTERFACE( draco_cdp1869_intf ) { - CDP1802_TAG, SCREEN_TAG, 0, CDP1869_PAL, - DEVCB_HANDLER(draco_pageram_r), - DEVCB_HANDLER(draco_pageram_w), draco_pcb_r, draco_charram_r, draco_charram_w, @@ -181,49 +160,21 @@ static CDP1869_INTERFACE( draco_cdp1869_intf ) /* Video Start */ -static void video_start(running_machine *machine, UINT16 pageram_size) -{ - cidelsa_state *state = machine->driver_data<cidelsa_state>(); - - /* allocate memory */ - state->pageram = auto_alloc_array(machine, UINT8, pageram_size); - state->pcbram = auto_alloc_array(machine, UINT8, CIDELSA_CHARRAM_SIZE); - state->charram = auto_alloc_array(machine, UINT8, CIDELSA_CHARRAM_SIZE); - - /* find devices */ - state->cdp1869 = machine->device(CDP1869_TAG); - - /* register for state saving */ - state_save_register_global(machine, state->cdp1869_pcb); - state_save_register_global_pointer(machine, state->pageram, pageram_size); - state_save_register_global_pointer(machine, state->pcbram, CIDELSA_CHARRAM_SIZE); - state_save_register_global_pointer(machine, state->charram, CIDELSA_CHARRAM_SIZE); -} - -static VIDEO_START(cidelsa) -{ - video_start(machine, CIDELSA_PAGERAM_SIZE); -} - -static VIDEO_START(draco) -{ - video_start(machine, DRACO_PAGERAM_SIZE); -} - -/* Video Update */ - -static VIDEO_UPDATE( cidelsa ) +void cidelsa_state::video_start() { - cidelsa_state *state = screen->machine->driver_data<cidelsa_state>(); - - cdp1869_update(state->cdp1869, bitmap, cliprect); + // allocate memory + m_pcbram = auto_alloc_array(machine, UINT8, CIDELSA_CHARRAM_SIZE); + m_charram = auto_alloc_array(machine, UINT8, CIDELSA_CHARRAM_SIZE); - return 0; + // register for state saving + state_save_register_global(machine, m_cdp1869_pcb); + state_save_register_global_pointer(machine, m_pcbram, CIDELSA_CHARRAM_SIZE); + state_save_register_global_pointer(machine, m_charram, CIDELSA_CHARRAM_SIZE); } /* AY-3-8910 */ -static WRITE8_DEVICE_HANDLER( draco_ay8910_port_b_w ) +WRITE8_MEMBER( cidelsa_state::draco_ay8910_port_b_w ) { /* @@ -248,7 +199,7 @@ static const ay8910_interface ay8910_config = DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, - DEVCB_HANDLER(draco_ay8910_port_b_w) + DEVCB_DRIVER_MEMBER(cidelsa_state, draco_ay8910_port_b_w) }; /* Machine Drivers */ @@ -257,11 +208,8 @@ MACHINE_CONFIG_FRAGMENT( destryer_video ) MDRV_CDP1869_SCREEN_PAL_ADD(SCREEN_TAG, DESTRYER_CHR2) MDRV_SCREEN_DEFAULT_POSITION(1.226, 0.012, 1.4, 0.044) - MDRV_VIDEO_START(cidelsa) - MDRV_VIDEO_UPDATE(cidelsa) - MDRV_SPEAKER_STANDARD_MONO("mono") - MDRV_CDP1869_ADD(CDP1869_TAG, DESTRYER_CHR2, destryer_cdp1869_intf) + MDRV_CDP1869_ADD(CDP1869_TAG, DESTRYER_CHR2, destryer_cdp1869_intf, cidelsa_page_ram) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END @@ -269,11 +217,8 @@ MACHINE_CONFIG_FRAGMENT( altair_video ) MDRV_CDP1869_SCREEN_PAL_ADD(SCREEN_TAG, ALTAIR_CHR2) MDRV_SCREEN_DEFAULT_POSITION(1.226, 0.012, 1.4, 0.044) - MDRV_VIDEO_START(cidelsa) - MDRV_VIDEO_UPDATE(cidelsa) - MDRV_SPEAKER_STANDARD_MONO("mono") - MDRV_CDP1869_ADD(CDP1869_TAG, ALTAIR_CHR2, altair_cdp1869_intf) + MDRV_CDP1869_ADD(CDP1869_TAG, ALTAIR_CHR2, altair_cdp1869_intf, cidelsa_page_ram) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END @@ -281,11 +226,8 @@ MACHINE_CONFIG_FRAGMENT( draco_video ) MDRV_CDP1869_SCREEN_PAL_ADD(SCREEN_TAG, DRACO_CHR2) MDRV_SCREEN_DEFAULT_POSITION(1.226, 0.012, 1.360, 0.024) - MDRV_VIDEO_START(draco) - MDRV_VIDEO_UPDATE(cidelsa) - MDRV_SPEAKER_STANDARD_MONO("mono") - MDRV_CDP1869_ADD(CDP1869_TAG, DRACO_CHR2, draco_cdp1869_intf) + MDRV_CDP1869_ADD(CDP1869_TAG, DRACO_CHR2, draco_cdp1869_intf, draco_page_ram) MDRV_SOUND_ADD(AY8910_TAG, AY8910, DRACO_SND_CHR1) MDRV_SOUND_CONFIG(ay8910_config) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) |