Previous 199869 Revisions Next

r32181 Thursday 18th September, 2014 at 18:37:43 UTC by hap
fix - All sets in flyball.c: Controls for Batter and Pitcher are intertwined
[src/mame/drivers]flyball.c

trunk/src/mame/drivers/flyball.c
r32180r32181
99    MADE IN USA
1010    PAT NO 3793483
1111
12
13TODO:
14- discrete sound
15- accurate video timing
16
1217***************************************************************************/
1318
1419#include "emu.h"
1520#include "cpu/m6502/m6502.h"
1621
17#define MASTER_CLOCK ( XTAL_12_096MHz )
22#define MASTER_CLOCK    XTAL_12_096MHz
23#define PIXEL_CLOCK     (MASTER_CLOCK / 2)
1824
1925
20
2126class flyball_state : public driver_device
2227{
2328public:
2429   enum
2530   {
26      TIMER_FLYBALL_JOYSTICK,
31      TIMER_FLYBALL_POT_ASSERT,
32      TIMER_FLYBALL_POT_CLEAR,
2733      TIMER_FLYBALL_QUARTER
2834   };
2935
r32180r32181
105111   int code = data & 63;
106112
107113   if ((flags & TILE_FLIPX) && (flags & TILE_FLIPY))
108   {
109114      code += 64;
110   }
111115
112116   SET_TILE_INFO_MEMBER(0, code, 0, flags);
113117}
r32180r32181
127131   int ballx = m_ball_horz - 1;
128132   int bally = m_ball_vert - 17;
129133
130   int x;
131   int y;
132
133134   m_tmap->mark_all_dirty();
134135
135136   /* draw playfield */
r32180r32181
139140   m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, m_pitcher_pic ^ 0xf, 0, 1, 0, pitcherx, pitchery, 1);
140141
141142   /* draw ball */
142
143   for (y = bally; y < bally + 2; y++)
144      for (x = ballx; x < ballx + 2; x++)
143   for (int y = bally; y < bally + 2; y++)
144      for (int x = ballx; x < ballx + 2; x++)
145145         if (cliprect.contains(x, y))
146146            bitmap.pix16(y, x) = 1;
147
147148   return 0;
148149}
149150
r32180r32181
152153{
153154   switch (id)
154155   {
155   case TIMER_FLYBALL_JOYSTICK:
156   case TIMER_FLYBALL_POT_ASSERT:
156157      flyball_joystick_callback(ptr, param);
157158      break;
159   case TIMER_FLYBALL_POT_CLEAR:
160      m_maincpu->set_input_line(0, CLEAR_LINE);
161      break;
158162   case TIMER_FLYBALL_QUARTER:
159163      flyball_quarter_callback(ptr, param);
160164      break;
165
161166   default:
162167      assert_always(FALSE, "Unknown id in flyball_state::device_timer");
163168   }
r32180r32181
169174   int potsense = param;
170175
171176   if (potsense & ~m_potmask)
172      generic_pulse_irq_line(*m_maincpu, 0, 1);
177   {
178      // pot irq is active at hsync
179      m_maincpu->set_input_line(0, ASSERT_LINE);
180      timer_set(attotime::from_ticks(32, PIXEL_CLOCK), TIMER_FLYBALL_POT_CLEAR, 0);
181   }
173182
174183   m_potsense |= potsense;
175184}
r32180r32181
189198
190199   for (i = 0; i < 64; i++)
191200      if (potsense[i] != 0)
192         timer_set(m_screen->time_until_pos(scanline + i), TIMER_FLYBALL_JOYSTICK, potsense[i]);
201         timer_set(m_screen->time_until_pos(scanline + i), TIMER_FLYBALL_POT_ASSERT, potsense[i]);
193202
194203   scanline += 0x40;
195204   scanline &= 0xff;
r32180r32181
418427
419428void flyball_state::machine_reset()
420429{
421   int i;
422
423430   /* address bits 0 through 8 are inverted */
424431   UINT8* ROM = memregion("maincpu")->base() + 0x2000;
425432
426   for (i = 0; i < 0x1000; i++)
433   for (int i = 0; i < 0x1000; i++)
427434      m_rombase[i] = ROM[i ^ 0x1ff];
428435
429436   m_maincpu->reset();
r32180r32181
445452   /* basic machine hardware */
446453   MCFG_CPU_ADD("maincpu", M6502, MASTER_CLOCK/16)
447454   MCFG_CPU_PROGRAM_MAP(flyball_map)
448   MCFG_CPU_VBLANK_INT_DRIVER("screen", flyball_state, nmi_line_pulse)
455   MCFG_CPU_VBLANK_INT_DRIVER("screen", flyball_state, nmi_line_pulse)
449456
450
451457   /* video hardware */
452458   MCFG_SCREEN_ADD("screen", RASTER)
453459   MCFG_SCREEN_REFRESH_RATE(60)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team