champbas.c driver needs cleanup, i'll continue on that if i can sort out MCU emulation for it (via hmcs40 instead simulation)

This commit is contained in:
hap 2015-10-26 18:18:42 +01:00
parent 44f7998a9a
commit a6094ce5aa
6 changed files with 50 additions and 48 deletions

View File

@ -256,6 +256,7 @@ void running_machine::start()
m_memory.initialize(); m_memory.initialize();
// initialize the watchdog // initialize the watchdog
m_watchdog_counter = 0;
m_watchdog_timer = m_scheduler.timer_alloc(timer_expired_delegate(FUNC(running_machine::watchdog_fired), this)); m_watchdog_timer = m_scheduler.timer_alloc(timer_expired_delegate(FUNC(running_machine::watchdog_fired), this));
if (config().m_watchdog_vblank_count != 0 && primary_screen != NULL) if (config().m_watchdog_vblank_count != 0 && primary_screen != NULL)
primary_screen->register_vblank_callback(vblank_state_delegate(FUNC(running_machine::watchdog_vblank), this)); primary_screen->register_vblank_callback(vblank_state_delegate(FUNC(running_machine::watchdog_vblank), this));

View File

@ -226,6 +226,7 @@ public:
// watchdog control // watchdog control
void watchdog_reset(); void watchdog_reset();
void watchdog_enable(bool enable = true); void watchdog_enable(bool enable = true);
INT32 get_vblank_watchdog_counter() { return m_watchdog_counter; }
// misc // misc
void CLIB_DECL vlogerror(const char *format, va_list args); void CLIB_DECL vlogerror(const char *format, va_list args);

View File

@ -40,7 +40,7 @@ write:
7001 8910 control 7001 8910 control
8ff0-8fff sprites 8ff0-8fff sprites
a000 ? a000 ?
a006 MCU HALT controll a006 MCU HALT control
a007 NOP (MCU shared RAM switch) a007 NOP (MCU shared RAM switch)
a060-a06f sprites a060-a06f sprites
a080 command for the sound CPU a080 command for the sound CPU
@ -86,6 +86,7 @@ TODO:
#include "emu.h" #include "emu.h"
#include "cpu/z80/z80.h" #include "cpu/z80/z80.h"
#include "cpu/alph8201/alph8201.h" #include "cpu/alph8201/alph8201.h"
//#include "cpu/hmcs40/hmcs40.h"
#include "sound/ay8910.h" #include "sound/ay8910.h"
#include "sound/dac.h" #include "sound/dac.h"
#include "includes/champbas.h" #include "includes/champbas.h"
@ -567,7 +568,7 @@ GFXDECODE_END
/************************************* /*************************************
* *
* Machine driver * Machine drivers
* *
*************************************/ *************************************/
@ -581,6 +582,7 @@ MACHINE_START_MEMBER(champbas_state,champbas)
MACHINE_START_MEMBER(champbas_state,exctsccr) MACHINE_START_MEMBER(champbas_state,exctsccr)
{ {
// FIXME // FIXME
// I dun wanna
machine().scheduler().timer_pulse(attotime::from_hz(75), timer_expired_delegate(FUNC(champbas_state::exctsccr_fm_callback),this)); /* updates fm */ machine().scheduler().timer_pulse(attotime::from_hz(75), timer_expired_delegate(FUNC(champbas_state::exctsccr_fm_callback),this)); /* updates fm */
MACHINE_START_CALL_MEMBER(champbas); MACHINE_START_CALL_MEMBER(champbas);
@ -595,7 +597,7 @@ MACHINE_RESET_MEMBER(champbas_state,champbas)
INTERRUPT_GEN_MEMBER(champbas_state::vblank_irq) INTERRUPT_GEN_MEMBER(champbas_state::vblank_irq)
{ {
if(m_irq_mask) if (m_irq_mask)
device.execute().set_input_line(0, ASSERT_LINE); device.execute().set_input_line(0, ASSERT_LINE);
} }
@ -608,7 +610,7 @@ static MACHINE_CONFIG_START( talbot, champbas_state )
MCFG_CPU_VBLANK_INT_DRIVER("screen", champbas_state, vblank_irq) MCFG_CPU_VBLANK_INT_DRIVER("screen", champbas_state, vblank_irq)
/* MCU */ /* MCU */
MCFG_CPU_ADD(CPUTAG_MCU, ALPHA8201, XTAL_18_432MHz/6/8) MCFG_CPU_ADD("mcu", ALPHA8201, XTAL_18_432MHz/6/8)
MCFG_CPU_PROGRAM_MAP(mcu_map) MCFG_CPU_PROGRAM_MAP(mcu_map)
MCFG_MACHINE_START_OVERRIDE(champbas_state,champbas) MCFG_MACHINE_START_OVERRIDE(champbas_state,champbas)
@ -681,7 +683,7 @@ static MACHINE_CONFIG_DERIVED( champmcu, champbas )
/* basic machine hardware */ /* basic machine hardware */
/* MCU */ /* MCU */
MCFG_CPU_ADD(CPUTAG_MCU, ALPHA8201, XTAL_18_432MHz/6/8) MCFG_CPU_ADD("mcu", ALPHA8201, XTAL_18_432MHz/6/8)
MCFG_CPU_PROGRAM_MAP(mcu_map) MCFG_CPU_PROGRAM_MAP(mcu_map)
/* to MCU timeout champbbj */ /* to MCU timeout champbbj */
@ -702,7 +704,7 @@ static MACHINE_CONFIG_START( exctsccr, champbas_state )
MCFG_CPU_PERIODIC_INT_DRIVER(champbas_state, nmi_line_pulse, 4000) /* 4 kHz, updates the dac */ MCFG_CPU_PERIODIC_INT_DRIVER(champbas_state, nmi_line_pulse, 4000) /* 4 kHz, updates the dac */
/* MCU */ /* MCU */
MCFG_CPU_ADD(CPUTAG_MCU, ALPHA8301, XTAL_18_432MHz/6/8) /* Actually 8302 */ MCFG_CPU_ADD("mcu", ALPHA8301, XTAL_18_432MHz/6/8) /* Actually 8302 */
MCFG_CPU_PROGRAM_MAP(mcu_map) MCFG_CPU_PROGRAM_MAP(mcu_map)
MCFG_MACHINE_START_OVERRIDE(champbas_state,exctsccr) MCFG_MACHINE_START_OVERRIDE(champbas_state,exctsccr)

View File

@ -6,10 +6,9 @@
*************************************************************************/ *************************************************************************/
#define CPUTAG_MCU "mcu"
#include "sound/dac.h" #include "sound/dac.h"
class champbas_state : public driver_device class champbas_state : public driver_device
{ {
public: public:
@ -20,12 +19,13 @@ public:
m_spriteram_2(*this, "spriteram_2"), m_spriteram_2(*this, "spriteram_2"),
m_maincpu(*this, "maincpu"), m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"), m_audiocpu(*this, "audiocpu"),
m_mcu(*this, CPUTAG_MCU), m_mcu(*this, "mcu"),
m_dac(*this, "dac"), m_dac(*this, "dac"),
m_dac1(*this, "dac1"), m_dac1(*this, "dac1"),
m_dac2(*this, "dac2"), m_dac2(*this, "dac2"),
m_gfxdecode(*this, "gfxdecode"), m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"){ } m_palette(*this, "palette")
{ }
/* memory pointers */ /* memory pointers */
required_shared_ptr<UINT8> m_bg_videoram; required_shared_ptr<UINT8> m_bg_videoram;

View File

@ -1,5 +1,11 @@
// license:BSD-3-Clause // license:BSD-3-Clause
// copyright-holders:Ernesto Corvi, Jarek Parchanski, Nicola Salmoria // copyright-holders:Ernesto Corvi, Jarek Parchanski, Nicola Salmoria
/*************************************************************************
Talbot - Champion Base Ball - Exciting Soccer
*************************************************************************/
#include "emu.h" #include "emu.h"
#include "video/resnet.h" #include "video/resnet.h"
#include "includes/champbas.h" #include "includes/champbas.h"
@ -28,7 +34,6 @@ PALETTE_INIT_MEMBER(champbas_state,champbas)
static const int resistances_rg[3] = { 1000, 470, 220 }; static const int resistances_rg[3] = { 1000, 470, 220 };
static const int resistances_b [2] = { 470, 220 }; static const int resistances_b [2] = { 470, 220 };
double rweights[3], gweights[3], bweights[2]; double rweights[3], gweights[3], bweights[2];
int i;
/* compute the color output resistor weights */ /* compute the color output resistor weights */
compute_resistor_weights(0, 255, -1.0, compute_resistor_weights(0, 255, -1.0,
@ -37,7 +42,7 @@ PALETTE_INIT_MEMBER(champbas_state,champbas)
2, &resistances_b[0], bweights, 0, 0); 2, &resistances_b[0], bweights, 0, 0);
/* create a lookup table for the palette */ /* create a lookup table for the palette */
for (i = 0; i < 0x20; i++) for (int i = 0; i < 0x20; i++)
{ {
int bit0, bit1, bit2; int bit0, bit1, bit2;
int r, g, b; int r, g, b;
@ -64,7 +69,7 @@ PALETTE_INIT_MEMBER(champbas_state,champbas)
color_prom += 0x20; color_prom += 0x20;
for (i = 0; i < 0x200; i++) for (int i = 0; i < 0x200; i++)
{ {
UINT8 ctabentry = (color_prom[i & 0xff] & 0x0f) | ((i & 0x100) >> 4); UINT8 ctabentry = (color_prom[i & 0xff] & 0x0f) | ((i & 0x100) >> 4);
palette.set_pen_indirect(i, ctabentry); palette.set_pen_indirect(i, ctabentry);
@ -75,10 +80,9 @@ PALETTE_INIT_MEMBER(champbas_state,champbas)
PALETTE_INIT_MEMBER(champbas_state,exctsccr) PALETTE_INIT_MEMBER(champbas_state,exctsccr)
{ {
const UINT8 *color_prom = memregion("proms")->base(); const UINT8 *color_prom = memregion("proms")->base();
int i;
/* create a lookup table for the palette */ /* create a lookup table for the palette */
for (i = 0; i < 0x20; i++) for (int i = 0; i < 0x20; i++)
{ {
int bit0, bit1, bit2; int bit0, bit1, bit2;
int r, g, b; int r, g, b;
@ -108,7 +112,7 @@ PALETTE_INIT_MEMBER(champbas_state,exctsccr)
color_prom += 0x20; color_prom += 0x20;
/* characters / sprites (3bpp) */ /* characters / sprites (3bpp) */
for (i = 0; i < 0x100; i++) for (int i = 0; i < 0x100; i++)
{ {
int swapped_i = BITSWAP8(i, 2, 7, 6, 5, 4, 3, 1, 0); int swapped_i = BITSWAP8(i, 2, 7, 6, 5, 4, 3, 1, 0);
UINT8 ctabentry = (color_prom[swapped_i] & 0x0f) | ((i & 0x80) >> 3); UINT8 ctabentry = (color_prom[swapped_i] & 0x0f) | ((i & 0x80) >> 3);
@ -116,7 +120,7 @@ PALETTE_INIT_MEMBER(champbas_state,exctsccr)
} }
/* sprites (4bpp) */ /* sprites (4bpp) */
for (i = 0; i < 0x100; i++) for (int i = 0; i < 0x100; i++)
{ {
UINT8 ctabentry = (color_prom[0x100 + i] & 0x0f) | 0x10; UINT8 ctabentry = (color_prom[0x100 + i] & 0x0f) | 0x10;
palette.set_pen_indirect(i + 0x100, ctabentry); palette.set_pen_indirect(i + 0x100, ctabentry);
@ -186,10 +190,9 @@ WRITE8_MEMBER(champbas_state::champbas_flipscreen_w)
void champbas_state::champbas_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) void champbas_state::champbas_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
int offs;
gfx_element* const gfx = m_gfxdecode->gfx(1); gfx_element* const gfx = m_gfxdecode->gfx(1);
for (offs = m_spriteram.bytes() - 2; offs >= 0; offs -= 2) for (int offs = m_spriteram.bytes() - 2; offs >= 0; offs -= 2)
{ {
int code = (m_spriteram[offs] >> 2) | (m_gfx_bank << 6); int code = (m_spriteram[offs] >> 2) | (m_gfx_bank << 6);
int color = (m_spriteram[offs + 1] & 0x1f) | (m_palette_bank << 6); int color = (m_spriteram[offs + 1] & 0x1f) | (m_palette_bank << 6);
@ -198,7 +201,6 @@ void champbas_state::champbas_draw_sprites( bitmap_ind16 &bitmap, const rectangl
int sx = m_spriteram_2[offs + 1] - 16; int sx = m_spriteram_2[offs + 1] - 16;
int sy = 255 - m_spriteram_2[offs]; int sy = 255 - m_spriteram_2[offs];
gfx->transmask(bitmap,cliprect, gfx->transmask(bitmap,cliprect,
code, color, code, color,
flipx, flipy, flipx, flipy,
@ -206,7 +208,6 @@ void champbas_state::champbas_draw_sprites( bitmap_ind16 &bitmap, const rectangl
m_palette->transpen_mask(*gfx, color, 0)); m_palette->transpen_mask(*gfx, color, 0));
// wraparound // wraparound
gfx->transmask(bitmap,cliprect, gfx->transmask(bitmap,cliprect,
code, color, code, color,
flipx, flipy, flipx, flipy,
@ -217,13 +218,12 @@ void champbas_state::champbas_draw_sprites( bitmap_ind16 &bitmap, const rectangl
void champbas_state::exctsccr_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) void champbas_state::exctsccr_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
int offs;
UINT8 *obj1, *obj2; UINT8 *obj1, *obj2;
obj1 = m_bg_videoram; obj1 = m_bg_videoram;
obj2 = &(m_spriteram[0x20]); obj2 = &(m_spriteram[0x20]);
for (offs = 0x0e; offs >= 0; offs -= 2) for (int offs = 0x0e; offs >= 0; offs -= 2)
{ {
int sx, sy, code, bank, flipx, flipy, color; int sx, sy, code, bank, flipx, flipy, color;
@ -236,7 +236,6 @@ void champbas_state::exctsccr_draw_sprites( bitmap_ind16 &bitmap, const rectangl
color = (obj1[offs + 1]) & 0x0f; color = (obj1[offs + 1]) & 0x0f;
bank = ((obj1[offs + 1] >> 4) & 1); bank = ((obj1[offs + 1] >> 4) & 1);
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
code + (bank << 6), code + (bank << 6),
color, color,
@ -247,7 +246,7 @@ void champbas_state::exctsccr_draw_sprites( bitmap_ind16 &bitmap, const rectangl
obj1 = m_spriteram_2; obj1 = m_spriteram_2;
obj2 = m_spriteram; obj2 = m_spriteram;
for (offs = 0x0e; offs >= 0; offs -= 2) for (int offs = 0x0e; offs >= 0; offs -= 2)
{ {
int sx, sy, code, flipx, flipy, color; int sx, sy, code, flipx, flipy, color;
@ -259,7 +258,6 @@ void champbas_state::exctsccr_draw_sprites( bitmap_ind16 &bitmap, const rectangl
flipy = (~obj1[offs]) & 0x02; flipy = (~obj1[offs]) & 0x02;
color = (obj1[offs + 1]) & 0x0f; color = (obj1[offs + 1]) & 0x0f;
m_gfxdecode->gfx(2)->transmask(bitmap,cliprect, m_gfxdecode->gfx(2)->transmask(bitmap,cliprect,
code, code,
color, color,

View File

@ -1832,7 +1832,7 @@ static device_info *rawinput_device_create(running_machine &machine, device_info
if ((*get_rawinput_device_info)(device->hDevice, RIDI_DEVICENAME, NULL, &name_length) != 0) if ((*get_rawinput_device_info)(device->hDevice, RIDI_DEVICENAME, NULL, &name_length) != 0)
goto error; goto error;
tname = global_alloc_array_clear(TCHAR, name_length+1); tname = global_alloc_array_clear(TCHAR, name_length+1);
if (name_length != 1 && (*get_rawinput_device_info)(device->hDevice, RIDI_DEVICENAME, tname, &name_length) == -1) if (name_length > 1 && (*get_rawinput_device_info)(device->hDevice, RIDI_DEVICENAME, tname, &name_length) == -1)
goto error; goto error;
// if this is an RDP name, skip it // if this is an RDP name, skip it