diff --git a/src/emu/machine.c b/src/emu/machine.c index 3f0eb5a9c15..ae85784ed46 100644 --- a/src/emu/machine.c +++ b/src/emu/machine.c @@ -256,6 +256,7 @@ void running_machine::start() m_memory.initialize(); // initialize the watchdog + m_watchdog_counter = 0; 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) primary_screen->register_vblank_callback(vblank_state_delegate(FUNC(running_machine::watchdog_vblank), this)); diff --git a/src/emu/machine.h b/src/emu/machine.h index a989ba2c874..ae4e514482c 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -226,6 +226,7 @@ public: // watchdog control void watchdog_reset(); void watchdog_enable(bool enable = true); + INT32 get_vblank_watchdog_counter() { return m_watchdog_counter; } // misc void CLIB_DECL vlogerror(const char *format, va_list args); diff --git a/src/mame/drivers/champbas.c b/src/mame/drivers/champbas.c index 8aaad810c17..6a2477cac7d 100644 --- a/src/mame/drivers/champbas.c +++ b/src/mame/drivers/champbas.c @@ -40,7 +40,7 @@ write: 7001 8910 control 8ff0-8fff sprites a000 ? -a006 MCU HALT controll +a006 MCU HALT control a007 NOP (MCU shared RAM switch) a060-a06f sprites a080 command for the sound CPU @@ -86,6 +86,7 @@ TODO: #include "emu.h" #include "cpu/z80/z80.h" #include "cpu/alph8201/alph8201.h" +//#include "cpu/hmcs40/hmcs40.h" #include "sound/ay8910.h" #include "sound/dac.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) { // 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_START_CALL_MEMBER(champbas); @@ -595,7 +597,7 @@ MACHINE_RESET_MEMBER(champbas_state,champbas) INTERRUPT_GEN_MEMBER(champbas_state::vblank_irq) { - if(m_irq_mask) + if (m_irq_mask) 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) /* 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_MACHINE_START_OVERRIDE(champbas_state,champbas) @@ -681,7 +683,7 @@ static MACHINE_CONFIG_DERIVED( champmcu, champbas ) /* basic machine hardware */ /* 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) /* 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 */ /* 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_MACHINE_START_OVERRIDE(champbas_state,exctsccr) diff --git a/src/mame/includes/champbas.h b/src/mame/includes/champbas.h index ac48cbf6b3d..8fb362b399e 100644 --- a/src/mame/includes/champbas.h +++ b/src/mame/includes/champbas.h @@ -6,10 +6,9 @@ *************************************************************************/ - -#define CPUTAG_MCU "mcu" #include "sound/dac.h" + class champbas_state : public driver_device { public: @@ -20,12 +19,13 @@ public: m_spriteram_2(*this, "spriteram_2"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), - m_mcu(*this, CPUTAG_MCU), + m_mcu(*this, "mcu"), m_dac(*this, "dac"), m_dac1(*this, "dac1"), m_dac2(*this, "dac2"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"){ } + m_palette(*this, "palette") + { } /* memory pointers */ required_shared_ptr m_bg_videoram; diff --git a/src/mame/video/champbas.c b/src/mame/video/champbas.c index ac60f292273..7f864aafd92 100644 --- a/src/mame/video/champbas.c +++ b/src/mame/video/champbas.c @@ -1,5 +1,11 @@ // license:BSD-3-Clause // copyright-holders:Ernesto Corvi, Jarek Parchanski, Nicola Salmoria +/************************************************************************* + + Talbot - Champion Base Ball - Exciting Soccer + +*************************************************************************/ + #include "emu.h" #include "video/resnet.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_b [2] = { 470, 220 }; double rweights[3], gweights[3], bweights[2]; - int i; /* compute the color output resistor weights */ compute_resistor_weights(0, 255, -1.0, @@ -37,7 +42,7 @@ PALETTE_INIT_MEMBER(champbas_state,champbas) 2, &resistances_b[0], bweights, 0, 0); /* 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 r, g, b; @@ -64,7 +69,7 @@ PALETTE_INIT_MEMBER(champbas_state,champbas) 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); palette.set_pen_indirect(i, ctabentry); @@ -75,10 +80,9 @@ PALETTE_INIT_MEMBER(champbas_state,champbas) PALETTE_INIT_MEMBER(champbas_state,exctsccr) { const UINT8 *color_prom = memregion("proms")->base(); - int i; /* 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 r, g, b; @@ -108,7 +112,7 @@ PALETTE_INIT_MEMBER(champbas_state,exctsccr) color_prom += 0x20; /* 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); UINT8 ctabentry = (color_prom[swapped_i] & 0x0f) | ((i & 0x80) >> 3); @@ -116,7 +120,7 @@ PALETTE_INIT_MEMBER(champbas_state,exctsccr) } /* sprites (4bpp) */ - for (i = 0; i < 0x100; i++) + for (int i = 0; i < 0x100; i++) { UINT8 ctabentry = (color_prom[0x100 + i] & 0x0f) | 0x10; 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 ) { - int offs; 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 color = (m_spriteram[offs + 1] & 0x1f) | (m_palette_bank << 6); @@ -198,32 +201,29 @@ void champbas_state::champbas_draw_sprites( bitmap_ind16 &bitmap, const rectangl int sx = m_spriteram_2[offs + 1] - 16; int sy = 255 - m_spriteram_2[offs]; - - gfx->transmask(bitmap,cliprect, - code, color, - flipx, flipy, - sx, sy, - m_palette->transpen_mask(*gfx, color, 0)); + gfx->transmask(bitmap,cliprect, + code, color, + flipx, flipy, + sx, sy, + m_palette->transpen_mask(*gfx, color, 0)); // wraparound - - gfx->transmask(bitmap,cliprect, - code, color, - flipx, flipy, - sx + 256, sy, - m_palette->transpen_mask(*gfx, color, 0)); + gfx->transmask(bitmap,cliprect, + code, color, + flipx, flipy, + sx + 256, sy, + m_palette->transpen_mask(*gfx, color, 0)); } } void champbas_state::exctsccr_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - int offs; UINT8 *obj1, *obj2; obj1 = m_bg_videoram; 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; @@ -236,18 +236,17 @@ void champbas_state::exctsccr_draw_sprites( bitmap_ind16 &bitmap, const rectangl color = (obj1[offs + 1]) & 0x0f; bank = ((obj1[offs + 1] >> 4) & 1); - - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code + (bank << 6), - color, - flipx, flipy, - sx,sy,0); + m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, + code + (bank << 6), + color, + flipx, flipy, + sx,sy,0); } obj1 = m_spriteram_2; 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; @@ -259,13 +258,12 @@ void champbas_state::exctsccr_draw_sprites( bitmap_ind16 &bitmap, const rectangl flipy = (~obj1[offs]) & 0x02; color = (obj1[offs + 1]) & 0x0f; - - m_gfxdecode->gfx(2)->transmask(bitmap,cliprect, - code, - color, - flipx, flipy, - sx,sy, - m_palette->transpen_mask(*m_gfxdecode->gfx(2), color, 0x10)); + m_gfxdecode->gfx(2)->transmask(bitmap,cliprect, + code, + color, + flipx, flipy, + sx,sy, + m_palette->transpen_mask(*m_gfxdecode->gfx(2), color, 0x10)); } } diff --git a/src/osd/windows/input.c b/src/osd/windows/input.c index 3099f5e5f20..078fa665098 100644 --- a/src/osd/windows/input.c +++ b/src/osd/windows/input.c @@ -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) goto error; 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; // if this is an RDP name, skip it