Previous 199869 Revisions Next

r33911 Monday 15th December, 2014 at 16:45:45 UTC by Ramiro Polla
Convert steppers to device_t
[src/emu/bus/centronics]epson_lx810l.c epson_lx810l.h
[src/emu/machine]steppers.c steppers.h
[src/mame/drivers]aces1.c bfm_sc1.c bfm_sc2.c bfm_sc4h.c bfmsys85.c ecoinf2.c ecoinf3.c ecoinfr.c jpmimpct.c maygay1b.c mpu3.c mpu4dealem.c mpu4hw.c mpu4vid.c
[src/mame/includes]bfm_sc45.h jpmimpct.h maygay1b.h mpu4.h
[src/mame/video]awpvid.c awpvid.h

trunk/src/emu/bus/centronics/epson_lx810l.c
r242422r242423
160160
161161   /* 256-bit eeprom */
162162   MCFG_EEPROM_SERIAL_93C06_ADD("eeprom")
163
164   /* steppers */
165   MCFG_DEVICE_ADD("pf_stepper", STEPPER, 0)
166   MCFG_DEVICE_ADD("cr_stepper", STEPPER, 0)
163167MACHINE_CONFIG_END
164168
165169//-------------------------------------------------
r242422r242423
278282   device_t(mconfig, EPSON_LX810L, "Epson LX-810L", tag, owner, clock, "lx810l", __FILE__),
279283   device_centronics_peripheral_interface(mconfig, *this),
280284   m_maincpu(*this, "maincpu"),
285   m_pf_stepper(*this, "pf_stepper"),
286   m_cr_stepper(*this, "cr_stepper"),
281287   m_eeprom(*this, "eeprom"),
282288   m_speaker(*this, "speaker"),
283289   m_e05a30(*this, "e05a30"),
r242422r242423
296302   device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__),
297303   device_centronics_peripheral_interface(mconfig, *this),
298304   m_maincpu(*this, "maincpu"),
305   m_pf_stepper(*this, "pf_stepper"),
306   m_cr_stepper(*this, "cr_stepper"),
299307   m_eeprom(*this, "eeprom"),
300308   m_speaker(*this, "speaker"),
301309   m_e05a30(*this, "e05a30"),
r242422r242423
339347
340348void epson_lx810l_t::device_start()
341349{
342   stepper_config(machine(), 0, &lx810l_pf_stepper);
343   stepper_config(machine(), 1, &lx810l_cr_stepper);
350   m_pf_stepper->configure(&lx810l_pf_stepper);
351   m_cr_stepper->configure(&lx810l_cr_stepper);
344352}
345353
346354
r242422r242423
515523
516524WRITE8_MEMBER( epson_lx810l_t::pf_stepper )
517525{
518   stepper_update(0, data);
519   m_pf_pos_abs = 200 - stepper_get_absolute_position(0);
526   m_pf_stepper->update(data);
527   m_pf_pos_abs = 200 - m_pf_stepper->get_absolute_position();
520528
521529   LX810LLOG("%s: %s(%02x); abs %d\n", machine().describe_context(), __func__, data, m_pf_pos_abs);
522530}
r242422r242423
525533{
526534   int m_cr_pos_abs_prev = m_cr_pos_abs;
527535
528   stepper_update(1, data);
529   m_cr_pos_abs = 200 - stepper_get_absolute_position(1);
536   m_cr_stepper->update(data);
537   m_cr_pos_abs = 200 - m_cr_stepper->get_absolute_position();
530538
531539   if (m_cr_pos_abs > m_cr_pos_abs_prev) {
532540      /* going right */
trunk/src/emu/bus/centronics/epson_lx810l.h
r242422r242423
100100
101101private:
102102   required_device<cpu_device> m_maincpu;
103   required_device<stepper_device> m_pf_stepper;
104   required_device<stepper_device> m_cr_stepper;
103105   required_device<eeprom_serial_93cxx_device> m_eeprom;
104106   required_device<speaker_sound_device> m_speaker;
105107   required_device<e05a30_device> m_e05a30;
trunk/src/emu/machine/steppers.c
r242422r242423
2828// 05-03-2004: Re-Animator                                               //
2929//                                                                       //
3030// TODO:  add further types of stepper motors if needed (Konami/IGT?)    //
31//        Someone who understands the device system may want to convert  //
32//        this                                                           //
3331//        200 Step reels can alter their relative opto tab position,     //
3432//        may be worth adding the phase setting to the interface         //
3533//        There are reports that some games use a pulse that is too short//
r242422r242423
4139#include "emu.h"
4240#include "steppers.h"
4341
44/* local prototypes */
45
46static void update_optic(int which);
47
48/* local vars */
49
50struct stepper
51{
52   const stepper_interface *intf;
53   UINT8    pattern,   /* coil pattern */
54         old_pattern,    /* old coil pattern */
55         initphase,
56            phase,  /* motor phase */
57         old_phase,  /* old phase */
58            type;   /* reel type */
59   INT16   step_pos,   /* step position 0 - max_steps */
60         max_steps;  /* maximum step position */
61   INT32   abs_step_pos; /* absolute step position */
62
63   INT16 index_start,  /* start position of index (in half steps) */
64         index_end,  /* end position of index (in half steps) */
65         index_patt; /* pattern needed on coils (0=don't care) */
66
67   UINT8 optic;
68};
69
70static stepper step[MAX_STEPPERS];
71
7242/* useful interfaces (Starpoint is a very common setup)*/
7343const stepper_interface starpoint_interface_48step =
7444{
r242422r242423
10878
10979
11080///////////////////////////////////////////////////////////////////////////
111void stepper_config(running_machine &machine, int which, const stepper_interface *intf)
81void stepper_device::configure(const stepper_interface *intf)
11282{
113   assert_always(machine.phase() == MACHINE_PHASE_INIT, "Can only call stepper_config at init time!");
114   assert_always((which >= 0) && (which < MAX_STEPPERS), "stepper_config called on an invalid stepper motor!");
115   assert_always(intf, "stepper_config called with an invalid interface!");
83   assert_always(machine().phase() == MACHINE_PHASE_INIT, "Can only call configure at init time!");
84   assert_always(intf, "configure called with an invalid interface!");
11685
117   step[which].intf = intf;
86   m_type        = intf->type;
87   m_index_start = intf->index_start; /* location of first index value in half steps */
88   m_index_end   = intf->index_end;   /* location of last index value in half steps */
89   m_index_patt  = intf->index_patt;  /* hex value of coil pattern (0 if not needed)*/
90   m_initphase   = intf->initphase;   /* Phase at 0 steps, for alignment) */
11891
119   step[which].type = intf->type;
120   step[which].index_start = intf->index_start;/* location of first index value in half steps */
121   step[which].index_end   = intf->index_end;  /* location of last index value in half steps */
122   step[which].index_patt  = intf->index_patt; /* hex value of coil pattern (0 if not needed)*/
123   step[which].initphase   = intf->initphase; /* Phase at 0 steps, for alignment) */
12492
93   m_pattern      = 0;
94   m_old_pattern  = 0;
95   m_step_pos     = 0;
96   m_abs_step_pos = 0;
97   m_phase        = m_initphase;
98   m_old_phase    = m_initphase;
12599
126   step[which].pattern     = 0;
127   step[which].old_pattern = 0;
128   step[which].step_pos    = 0;
129   step[which].abs_step_pos= 0;
130   step[which].phase = step[which].initphase;
131   step[which].old_phase = step[which].initphase;
132100
133
134   switch ( step[which].type )
101   switch ( m_type )
135102   {   default:
136103      case STARPOINT_48STEP_REEL:  /* STARPOINT RMxxx */
137104      case BARCREST_48STEP_REEL :  /* Barcrest Reel unit */
138105      case MPU3_48STEP_REEL :
139106      case GAMESMAN_48STEP_REEL :  /* Gamesman GMxxxx */
140107      case PROJECT_48STEP_REEL :
141      step[which].max_steps = (48*2);
108      m_max_steps = (48*2);
142109      break;
143110      case GAMESMAN_100STEP_REEL :
144      step[which].max_steps = (100*2);
111      m_max_steps = (100*2);
145112      break;
146113      case STARPOINT_144STEP_DICE :/* STARPOINT 1DCU DICE mechanism */
147114      //Dice reels are 48 step motors, but complete three full cycles between opto updates
148      step[which].max_steps = ((48*3)*2);
115      m_max_steps = ((48*3)*2);
149116      break;
150117      case STARPOINT_200STEP_REEL :
151118      case GAMESMAN_200STEP_REEL :
152119      case ECOIN_200STEP_REEL :
153      step[which].max_steps = (200*2);
120      m_max_steps = (200*2);
154121      break;
155122   }
156
157   state_save_register_item(machine, "stepper", NULL, which, step[which].index_start);
158   state_save_register_item(machine, "stepper", NULL, which, step[which].index_end);
159   state_save_register_item(machine, "stepper", NULL, which, step[which].index_patt);
160   state_save_register_item(machine, "stepper", NULL, which, step[which].initphase);
161   state_save_register_item(machine, "stepper", NULL, which, step[which].phase);
162   state_save_register_item(machine, "stepper", NULL, which, step[which].old_phase);
163   state_save_register_item(machine, "stepper", NULL, which, step[which].pattern);
164   state_save_register_item(machine, "stepper", NULL, which, step[which].old_pattern);
165   state_save_register_item(machine, "stepper", NULL, which, step[which].step_pos);
166   state_save_register_item(machine, "stepper", NULL, which, step[which].abs_step_pos);
167   state_save_register_item(machine, "stepper", NULL, which, step[which].max_steps);
168   state_save_register_item(machine, "stepper", NULL, which, step[which].type);
169123}
170124
171125///////////////////////////////////////////////////////////////////////////
172int stepper_get_position(int which)
173{
174   return step[which].step_pos;
175}
176126
177///////////////////////////////////////////////////////////////////////////
178int stepper_get_absolute_position(int which)
127void stepper_device::update_optic()
179128{
180   return step[which].abs_step_pos;
181}
129   int pos   = m_step_pos,
130      start = m_index_start,
131      end = m_index_end;
182132
183///////////////////////////////////////////////////////////////////////////
184
185int stepper_get_max(int which)
186{
187   return step[which].max_steps;
188}
189
190///////////////////////////////////////////////////////////////////////////
191
192static void update_optic(int which)
193{
194   int pos   = step[which].step_pos,
195      start = step[which].index_start,
196      end = step[which].index_end;
197
198133   if (start > end) // cope with index patterns that wrap around
199134   {
200135      if ( (( pos > start ) || ( pos < end )) &&
201      ( ( step[which].pattern == step[which].index_patt || step[which].index_patt==0) ||
202      ( step[which].pattern == 0 &&
203      (step[which].old_pattern == step[which].index_patt || step[which].index_patt==0)
136      ( ( m_pattern == m_index_patt || m_index_patt==0) ||
137      ( m_pattern == 0 &&
138      (m_old_pattern == m_index_patt || m_index_patt==0)
204139      ) ) )
205140      {
206         step[which].optic = 1;
141         m_optic = 1;
207142      }
208      else step[which].optic = 0;
143      else m_optic = 0;
209144      }
210145   else
211146   {
212147      if ( (( pos > start ) && ( pos < end )) &&
213      ( ( step[which].pattern == step[which].index_patt || step[which].index_patt==0) ||
214      ( step[which].pattern == 0 &&
215      (step[which].old_pattern == step[which].index_patt || step[which].index_patt==0)
148      ( ( m_pattern == m_index_patt || m_index_patt==0) ||
149      ( m_pattern == 0 &&
150      (m_old_pattern == m_index_patt || m_index_patt==0)
216151      ) ) )
217152      {
218      step[which].optic = 1;
153      m_optic = 1;
219154      }
220      else step[which].optic = 0;
155      else m_optic = 0;
221156   }
157
158   m_optic_cb(m_optic);
222159}
223160///////////////////////////////////////////////////////////////////////////
224161
225void stepper_reset_position(int which)
162void stepper_device::device_start()
226163{
227   step[which].step_pos    = 0x00;
228   step[which].abs_step_pos= 0x00;
229   step[which].pattern     = 0x00;
230   step[which].old_pattern = 0x00;
231   step[which].phase = step[which].initphase;
232   step[which].old_phase = step[which].initphase;
233   update_optic(which);
164   /* resolve callbacks */
165   m_optic_cb.resolve_safe();
166
167   /* register for state saving */
168   save_item(NAME(m_index_start));
169   save_item(NAME(m_index_end));
170   save_item(NAME(m_index_patt));
171   save_item(NAME(m_initphase));
172   save_item(NAME(m_phase));
173   save_item(NAME(m_old_phase));
174   save_item(NAME(m_pattern));
175   save_item(NAME(m_old_pattern));
176   save_item(NAME(m_step_pos));
177   save_item(NAME(m_abs_step_pos));
178   save_item(NAME(m_max_steps));
179   save_item(NAME(m_type));
234180}
235181
236182///////////////////////////////////////////////////////////////////////////
237183
238int stepper_optic_state(int which)
184void stepper_device::device_reset()
239185{
240   int result = 0;
241
242   if ( which < MAX_STEPPERS )
243   {
244      result = step[which].optic;
245   }
246
247   return result;
186   m_step_pos     = 0x00;
187   m_abs_step_pos = 0x00;
188   m_pattern      = 0x00;
189   m_old_pattern  = 0x00;
190   m_phase        = m_initphase;
191   m_old_phase    = m_initphase;
192   update_optic();
248193}
249194
250195///////////////////////////////////////////////////////////////////////////
251196
252int stepper_update(int which, UINT8 pattern)
197int stepper_device::update(UINT8 pattern)
253198{
254199   int changed = 0;
255200
r242422r242423
271216   */
272217
273218   int pos,steps=0;
274   step[which].pattern = pattern;
275   switch ( step[which].type )
219   m_pattern = pattern;
220   switch ( m_type )
276221   {
277222      default:
278      logerror("No reel type specified for %x!\n",which);
223      logerror("No reel type specified!\n");
279224      break;
280225      case STARPOINT_48STEP_REEL : /* STARPOINT RMxxx */
281226      case GAMESMAN_200STEP_REEL : /* Gamesman GMxxxx */
r242422r242423
287232      switch (pattern)
288233      {             //Black  Blue  Red  Yellow
289234         case 0x02://  0     0     1     0
290         step[which].phase = 7;
235         m_phase = 7;
291236         break;
292237         case 0x06://  0     1     1     0
293         step[which].phase = 6;
238         m_phase = 6;
294239         break;
295240         case 0x04://  0     1     0     0
296         step[which].phase = 5;
241         m_phase = 5;
297242         break;
298243         case 0x05://  0     1     0     1
299         step[which].phase = 4;
244         m_phase = 4;
300245         break;
301246         case 0x01://  0     0     0     1
302         step[which].phase = 3;
247         m_phase = 3;
303248         break;
304249         case 0x09://  1     0     0     1
305         step[which].phase = 2;
250         m_phase = 2;
306251         break;
307252         case 0x08://  1     0     0     0
308         step[which].phase = 1;
253         m_phase = 1;
309254         break;
310255         case 0x0A://  1     0     1     0
311         step[which].phase = 0;
256         m_phase = 0;
312257         break;
313258         //          Black  Blue  Red  Yellow
314259         case 0x03://  0     0     1     1
315260         {
316            if ((step[which].old_phase ==6)||(step[which].old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now
261            if ((m_old_phase ==6)||(m_old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now
317262            {
318               step[which].phase = 7;
263               m_phase = 7;
319264            }
320265            else //otherwise it will line up due south
321266            {
322               step[which].phase = 3;
267               m_phase = 3;
323268            }
324269         }
325270         break;
326271         case 0x0C://  1     1     0     0
327272         {
328            if ((step[which].old_phase ==6)||(step[which].old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now
273            if ((m_old_phase ==6)||(m_old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now
329274            {
330               step[which].phase = 5;
275               m_phase = 5;
331276            }
332277            else //otherwise it will line up due west
333278            {
334               step[which].phase = 1;
279               m_phase = 1;
335280            }
336281         }
337282         break;
r242422r242423
347292      {
348293         //             Yellow   Brown  Orange Black
349294         case 0x01://  0        0      0      1
350         step[which].phase = 7;
295         m_phase = 7;
351296         break;
352297         case 0x03://  0        0      1      1
353         step[which].phase = 6;
298         m_phase = 6;
354299         break;
355300         case 0x02://  0        0      1      0
356         step[which].phase = 5;
301         m_phase = 5;
357302         break;
358303         case 0x06://  0        1      1      0
359         step[which].phase = 4;
304         m_phase = 4;
360305         break;
361306         case 0x04://  0        1      0      0
362         step[which].phase = 3;
307         m_phase = 3;
363308         break;
364309         case 0x0C://  1        1      0      0
365         step[which].phase = 2;
310         m_phase = 2;
366311         break;
367312         case 0x08://  1        0      0      0
368         step[which].phase = 1;
313         m_phase = 1;
369314         break;//YOLB
370315         case 0x09://  1        0      0      1
371         step[which].phase = 0;
316         m_phase = 0;
372317         break;
373318
374319         // The below values should not be used by anything sane, as they effectively ignore one stator side entirely
375320         //          Yellow   Brown  Orange Black
376321         case 0x05://   0       1       0     1
377322         {
378            if ((step[which].old_phase ==6)||(step[which].old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now
323            if ((m_old_phase ==6)||(m_old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now
379324            {
380               step[which].phase = 7;
325               m_phase = 7;
381326            }
382327            else //otherwise it will line up due south
383328            {
384               step[which].phase = 3;
329               m_phase = 3;
385330            }
386331         }
387332         break;
388333
389334         case 0x0A://   1       0       1     0
390335         {
391            if ((step[which].old_phase ==6)||(step[which].old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now
336            if ((m_old_phase ==6)||(m_old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now
392337            {
393               step[which].phase = 5;
338               m_phase = 5;
394339            }
395340            else //otherwise it will line up due west
396341            {
397               step[which].phase = 1;
342               m_phase = 1;
398343            }
399344         }
400345         break;
r242422r242423
410355      {
411356      //             Yellow(2)   Brown(1)  Orange(!2) Black(!1)
412357         case 0x00 :// 0          0          1         1
413         step[which].phase = 6;
358         m_phase = 6;
414359         break;
415360         case 0x01 :// 0          1          1         0
416         step[which].phase = 4;
361         m_phase = 4;
417362         break;
418363         case 0x03 :// 1          1          0         0
419         step[which].phase = 2;
364         m_phase = 2;
420365         break;
421366         case 0x02 :// 1          0          0         1
422         step[which].phase = 0;
367         m_phase = 0;
423368         break;
424369      }
425370      break;
r242422r242423
431376      switch (pattern)
432377      {
433378         case 0x08://  0     0     1     0
434         step[which].phase = 7;
379         m_phase = 7;
435380         break;
436381         case 0x0c://  0     1     1     0
437         step[which].phase = 6;
382         m_phase = 6;
438383         break;
439384         case 0x04://  0     1     0     0
440         step[which].phase = 5;
385         m_phase = 5;
441386         break;
442387         case 0x06://  0     1     0     1
443         step[which].phase = 4;
388         m_phase = 4;
444389         break;
445390         case 0x02://  0     0     0     1
446         step[which].phase = 3;
391         m_phase = 3;
447392         break;
448393         case 0x03://  1     0     0     1
449         step[which].phase = 2;
394         m_phase = 2;
450395         break;
451396         case 0x01://  1     0     0     0
452         step[which].phase = 1;
397         m_phase = 1;
453398         break;
454399         case 0x09://  1     0     1     0
455         step[which].phase = 0;
400         m_phase = 0;
456401         break;
457402         case 0x0a://  0     0     1     1
458403         {
459            if ((step[which].old_phase ==6)||(step[which].old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now
404            if ((m_old_phase ==6)||(m_old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now
460405            {
461               step[which].phase = 7;
406               m_phase = 7;
462407            }
463408            else //otherwise it will line up due south
464409            {
465               step[which].phase = 3;
410               m_phase = 3;
466411            }
467412         }
468413         break;
469414         case 0x07://  1     1     0     0
470415         {
471            if ((step[which].old_phase ==6)||(step[which].old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now
416            if ((m_old_phase ==6)||(m_old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now
472417            {
473               step[which].phase = 5;
418               m_phase = 5;
474419            }
475420            else //otherwise it will line up due west
476421            {
477               step[which].phase = 1;
422               m_phase = 1;
478423            }
479424         }
480425         break;
r242422r242423
488433      switch (pattern)
489434      {
490435         case 0x08://  0     0     1     0
491         step[which].phase = 7;
436         m_phase = 7;
492437         break;
493438         case 0x0c://  0     1     1     0
494         step[which].phase = 6;
439         m_phase = 6;
495440         break;
496441         case 0x04://  0     1     0     0
497         step[which].phase = 5;
442         m_phase = 5;
498443         break;
499444         case 0x05://  0     1     0     1
500         step[which].phase = 4;
445         m_phase = 4;
501446         break;
502447         case 0x01://  0     0     0     1
503         step[which].phase = 3;
448         m_phase = 3;
504449         break;
505450         case 0x03://  1     0     0     1
506         step[which].phase = 2;
451         m_phase = 2;
507452         break;
508453         case 0x02://  1     0     0     0
509         step[which].phase = 1;
454         m_phase = 1;
510455         break;
511456         case 0x0a://  1     0     1     0
512         step[which].phase = 0;
457         m_phase = 0;
513458         break;
514459         case 0x09://  0     0     1     1
515460         {
516            if ((step[which].old_phase ==6)||(step[which].old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now
461            if ((m_old_phase ==6)||(m_old_phase == 0)) // if the previous pattern had the drum in the northern quadrant, it will point north now
517462            {
518               step[which].phase = 7;
463               m_phase = 7;
519464            }
520465            else //otherwise it will line up due south
521466            {
522               step[which].phase = 3;
467               m_phase = 3;
523468            }
524469         }
525470         break;
526471         case 0x06://  1     1     0     0
527472         {
528            if ((step[which].old_phase ==6)||(step[which].old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now
473            if ((m_old_phase ==6)||(m_old_phase == 4)) // if the previous pattern had the drum in the eastern quadrant, it will point east now
529474            {
530               step[which].phase = 5;
475               m_phase = 5;
531476            }
532477            else //otherwise it will line up due west
533478            {
534               step[which].phase = 1;
479               m_phase = 1;
535480            }
536481         }
537482         break;
r242422r242423
542487
543488   }
544489
545   steps = step[which].old_phase - step[which].phase;
490   steps = m_old_phase - m_phase;
546491
547492   if (steps < -4)
548493   {
r242422r242423
553498      steps = steps -8;
554499   }
555500
556   step[which].old_phase = step[which].phase;
557   step[which].old_pattern = step[which].pattern;
501   m_old_phase   = m_phase;
502   m_old_pattern = m_pattern;
558503
559   int max = step[which].max_steps;
504   int max = m_max_steps;
560505   pos = 0;
561506
562507   if (max!=0)
563508   {
564      step[which].abs_step_pos += steps;
565      pos = (step[which].step_pos + steps + max) % max;
509      m_abs_step_pos += steps;
510      pos = (m_step_pos + steps + max) % max;
566511   }
567   else
568   {
569      logerror("step[%x].max_steps == 0\n",which);
570   }
571512
572   if (pos != step[which].step_pos)
513   if (pos != m_step_pos)
573514   {
574515      changed++;
575516   }
576517
577   step[which].step_pos = pos;
578   update_optic(which);
518   m_step_pos = pos;
519   update_optic();
579520
580521   return changed;
581522}
trunk/src/emu/machine/steppers.h
r242422r242423
77//                                                                       //
88//                                                                       //
99// TODO:  add further types of stepper motors if needed (Konami/IGT?)    //
10//        Someone who understands the device system may want to convert  //
11//        this                                                           //
1210///////////////////////////////////////////////////////////////////////////
1311
1412
r242422r242423
4947extern const stepper_interface starpoint_interface_200step_reel;
5048extern const stepper_interface ecoin_interface_200step_reel;
5149
52void stepper_config(running_machine &machine, int which, const stepper_interface *intf);
5350
54void stepper_reset_position(int id);        /* reset a motor to position 0 */
51#define MCFG_STEPPER_OPTIC_CALLBACK(_write) \
52   devcb = &stepper_device::set_optic_handler(*device, DEVCB_##_write);
5553
56int  stepper_optic_state(   int id);        /* read a motor's optics */
54class stepper_device;
55const device_type STEPPER = &device_creator<stepper_device>;
5756
58int  stepper_update(int id, UINT8 pattern); /* update a motor */
57class stepper_device : public device_t
58{
59public:
60   stepper_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
61      : device_t(mconfig, STEPPER, "Stepper Motor", tag, owner, clock, "stepper", __FILE__),
62      m_optic_cb(*this)
63   { }
5964
60int  stepper_get_position(int id);          /* get current position in half steps */
65   template<class _Object> static devcb_base &set_optic_handler(device_t &device, _Object object) { return downcast<stepper_device &>(device).m_optic_cb.set_callback(object); }
6166
62int stepper_get_absolute_position(int id); /* get current absolute position in half steps */
67   void configure(const stepper_interface *intf);
6368
64int  stepper_get_max(int id);               /* get maximum position in half steps */
69   /* update a motor */
70   int update(UINT8 pattern);
71
72   /* get current position in half steps */
73   int get_position()          { return m_step_pos; }
74   /* get current absolute position in half steps */
75   int get_absolute_position() { return m_abs_step_pos; }
76   /* get maximum position in half steps */
77   int get_max()               { return m_max_steps; }
78
79protected:
80   // device-level overrides
81   virtual void device_start();
82   virtual void device_reset();
83
84private:
85   UINT8 m_pattern;      /* coil pattern */
86   UINT8 m_old_pattern;  /* old coil pattern */
87   UINT8 m_initphase;
88   UINT8 m_phase;        /* motor phase */
89   UINT8 m_old_phase;    /* old phase */
90   UINT8 m_type;         /* reel type */
91   INT16 m_step_pos;     /* step position 0 - max_steps */
92   INT16 m_max_steps;    /* maximum step position */
93   INT32 m_abs_step_pos; /* absolute step position */
94   INT16 m_index_start;  /* start position of index (in half steps) */
95   INT16 m_index_end;    /* end position of index (in half steps) */
96   INT16 m_index_patt;   /* pattern needed on coils (0=don't care) */
97   UINT8 m_optic;
98
99   void update_optic();
100   devcb_write_line m_optic_cb;
101};
102
65103#endif
trunk/src/mame/drivers/aces1.c
r242422r242423
3838   aces1_state(const machine_config &mconfig, device_type type, const char *tag)
3939      : driver_device(mconfig, type, tag),
4040         m_maincpu(*this, "maincpu"),
41         m_reel0(*this, "reel0"),
42         m_reel1(*this, "reel1"),
43         m_reel2(*this, "reel2"),
44         m_reel3(*this, "reel3"),
4145         m_io1_port(*this, "IO1"),
4246         m_io2_port(*this, "IO2"),
4347         m_io3_port(*this, "IO3"),
r242422r242423
5357   int m_reel_clock[4];
5458   int m_reel_phase[4];
5559   int m_reel_count[4];
60   int m_optic_pattern;
61   DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; }
62   DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; }
63   DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; }
64   DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; }
5665
5766   DECLARE_READ8_MEMBER( aces1_unk_r )
5867   {
r242422r242423
148157            {
149158               int sense = ((data & (4 + (1<<reel))) ? -2:2);
150159               m_reel_phase[reel] = ((m_reel_phase[reel] + sense + 8) % 8);
151               stepper_update(reel, phases[m_reel_phase[reel]]);
160               switch (reel)
161               {
162               case 0: m_reel0->update(phases[m_reel_phase[reel]]); break;
163               case 1: m_reel1->update(phases[m_reel_phase[reel]]); break;
164               case 2: m_reel2->update(phases[m_reel_phase[reel]]); break;
165               case 3: m_reel3->update(phases[m_reel_phase[reel]]); break;
166               }
152167               m_reel_clock[reel] = clock;
153168               if ( m_reel_phase[reel] % 4 ==0)
154169               {
r242422r242423
187202
188203   DECLARE_READ8_MEMBER( ic37_read_c )
189204   {
190      int pattern =0;
191205      int action =0;
192206      for (int reel = 0; reel < 4; reel++)
193207      {
194         if (stepper_optic_state(reel)) pattern |= 1<<reel;
195208         if (m_reel_count[reel]) action |= 1<<reel;
196209      }
197210
198      return ((pattern << 4) | action);
211      return ((m_optic_pattern << 4) | action);
199212   }
200213
201214   // devices
202215   required_device<cpu_device> m_maincpu;
216   required_device<stepper_device> m_reel0;
217   required_device<stepper_device> m_reel1;
218   required_device<stepper_device> m_reel2;
219   required_device<stepper_device> m_reel3;
203220   required_ioport m_io1_port;
204221   required_ioport m_io2_port;
205222   required_ioport m_io3_port;
r242422r242423
236253
237254void aces1_state::machine_start()
238255{
239   stepper_config(machine(), 0, &starpoint_interface_48step);
240   stepper_config(machine(), 1, &starpoint_interface_48step);
241   stepper_config(machine(), 2, &starpoint_interface_48step);
242   stepper_config(machine(), 3, &starpoint_interface_48step);
256   m_reel0->configure(&starpoint_interface_48step);
257   m_reel1->configure(&starpoint_interface_48step);
258   m_reel2->configure(&starpoint_interface_48step);
259   m_reel3->configure(&starpoint_interface_48step);
243260
244261   for (int reel=0; reel <4; reel++)
245262   {
r242422r242423
452469   MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSWA"))
453470   MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSWB"))
454471   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
472
473   /* steppers */
474   MCFG_DEVICE_ADD("reel0", STEPPER, 0)
475   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(aces1_state, reel0_optic_cb))
476   MCFG_DEVICE_ADD("reel1", STEPPER, 0)
477   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(aces1_state, reel1_optic_cb))
478   MCFG_DEVICE_ADD("reel2", STEPPER, 0)
479   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(aces1_state, reel2_optic_cb))
480   MCFG_DEVICE_ADD("reel3", STEPPER, 0)
481   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(aces1_state, reel3_optic_cb))
455482MACHINE_CONFIG_END
456483
457484
trunk/src/mame/drivers/bfm_sc1.c
r242422r242423
111111      : driver_device(mconfig, type, tag),
112112      m_vfd0(*this, "vfd0"),
113113      m_maincpu(*this, "maincpu"),
114      m_reel0(*this, "reel0"),
115      m_reel1(*this, "reel1"),
116      m_reel2(*this, "reel2"),
117      m_reel3(*this, "reel3"),
118      m_reel4(*this, "reel4"),
119      m_reel5(*this, "reel5"),
114120      m_upd7759(*this, "upd") { }
115121
116122   optional_device<bfm_bd1_t> m_vfd0;
r242422r242423
120126   int m_vfd_latch;
121127   int m_irq_status;
122128   int m_optic_pattern;
129   DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; }
130   DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; }
131   DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; }
132   DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; }
133   DECLARE_WRITE_LINE_MEMBER(reel4_optic_cb) { if (state) m_optic_pattern |= 0x10; else m_optic_pattern &= ~0x10; }
134   DECLARE_WRITE_LINE_MEMBER(reel5_optic_cb) { if (state) m_optic_pattern |= 0x20; else m_optic_pattern &= ~0x20; }
123135   int m_acia_status;
124136   int m_locked;
125137   int m_is_timer_enabled;
r242422r242423
181193   int Scorpion1_GetSwitchState(int strobe, int data);
182194   int sc1_find_project_string( );
183195   required_device<cpu_device> m_maincpu;
196   required_device<stepper_device> m_reel0;
197   required_device<stepper_device> m_reel1;
198   required_device<stepper_device> m_reel2;
199   required_device<stepper_device> m_reel3;
200   required_device<stepper_device> m_reel4;
201   required_device<stepper_device> m_reel5;
184202   optional_device<upd7759_device> m_upd7759;
185203};
186204
r242422r242423
251269   }
252270   else
253271   {
254      stepper_update(0, (data>>4)&0x0f);
255      stepper_update(1, data&0x0f   );
256
257      if ( stepper_optic_state(0) ) m_optic_pattern |=  0x01;
258      else                          m_optic_pattern &= ~0x01;
259      if ( stepper_optic_state(1) ) m_optic_pattern |=  0x02;
260      else                          m_optic_pattern &= ~0x02;
272      m_reel0->update((data>>4)&0x0f);
273      m_reel1->update( data    &0x0f);
261274   }
262   awp_draw_reel(0);
263   awp_draw_reel(1);
275   awp_draw_reel(0, m_reel0);
276   awp_draw_reel(1, m_reel1);
264277}
265278
266279///////////////////////////////////////////////////////////////////////////
r242422r242423
273286   }
274287   else
275288   {
276      stepper_update(2, (data>>4)&0x0f);
277      stepper_update(3, data&0x0f   );
278
279      if ( stepper_optic_state(2) ) m_optic_pattern |=  0x04;
280      else                          m_optic_pattern &= ~0x04;
281      if ( stepper_optic_state(3) ) m_optic_pattern |=  0x08;
282      else                          m_optic_pattern &= ~0x08;
289      m_reel2->update((data>>4)&0x0f);
290      m_reel3->update( data    &0x0f);
283291   }
284   awp_draw_reel(2);
285   awp_draw_reel(3);
292   awp_draw_reel(2, m_reel2);
293   awp_draw_reel(3, m_reel3);
286294}
287295
288296///////////////////////////////////////////////////////////////////////////
289297
290298WRITE8_MEMBER(bfm_sc1_state::reel56_w)
291299{
292   stepper_update(4, (data>>4)&0x0f);
293   stepper_update(5, data&0x0f   );
300   m_reel4->update((data>>4)&0x0f);
301   m_reel5->update( data    &0x0f);
294302
295   if ( stepper_optic_state(4) ) m_optic_pattern |=  0x10;
296   else                          m_optic_pattern &= ~0x10;
297   if ( stepper_optic_state(5) ) m_optic_pattern |=  0x20;
298   else                          m_optic_pattern &= ~0x20;
299   awp_draw_reel(5);
300   awp_draw_reel(6);
303   awp_draw_reel(4, m_reel4);
304   awp_draw_reel(5, m_reel5);
301305}
302306
303307///////////////////////////////////////////////////////////////////////////
r242422r242423
612616
613617   m_vfd0->reset();
614618
615// reset stepper motors /////////////////////////////////////////////////////////////
616   {
617      int pattern =0, i;
618
619      for ( i = 0; i < 6; i++)
620      {
621         stepper_reset_position(i);
622         if ( stepper_optic_state(i) ) pattern |= 1<<i;
623      }
624
625      m_optic_pattern = pattern;
626
627   }
628
629619   m_acia_status   = 0x02; // MC6850 transmit buffer empty !!!
630620   m_locked          = 0x07; // hardware is locked
631621
r242422r242423
10611051
10621052   MCFG_NVRAM_ADD_0FILL("nvram")
10631053   MCFG_DEFAULT_LAYOUT(layout_sc1_vfd)
1054
1055   MCFG_DEVICE_ADD("reel0", STEPPER, 0)
1056   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc1_state, reel0_optic_cb))
1057   MCFG_DEVICE_ADD("reel1", STEPPER, 0)
1058   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc1_state, reel1_optic_cb))
1059   MCFG_DEVICE_ADD("reel2", STEPPER, 0)
1060   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc1_state, reel2_optic_cb))
1061   MCFG_DEVICE_ADD("reel3", STEPPER, 0)
1062   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc1_state, reel3_optic_cb))
1063   MCFG_DEVICE_ADD("reel4", STEPPER, 0)
1064   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc1_state, reel4_optic_cb))
1065   MCFG_DEVICE_ADD("reel5", STEPPER, 0)
1066   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc1_state, reel5_optic_cb))
10641067MACHINE_CONFIG_END
10651068
10661069/////////////////////////////////////////////////////////////////////////////////////
r242422r242423
10921095
10931096void bfm_sc1_state::sc1_common_init(int reels, int decrypt, int defaultbank)
10941097{
1095   UINT8 i;
1096
10971098   memset(m_sc1_Inputs, 0, sizeof(m_sc1_Inputs));
10981099
10991100   // setup n default 96 half step reels ///////////////////////////////////////////
1100   for ( i = 0; i < reels; i++ )
1101   switch (reels)
11011102   {
1102      stepper_config(machine(), i, &starpoint_interface_48step);
1103   case 6: m_reel5->configure(&starpoint_interface_48step);
1104   case 5: m_reel4->configure(&starpoint_interface_48step);
1105   case 4: m_reel3->configure(&starpoint_interface_48step);
1106   case 3: m_reel2->configure(&starpoint_interface_48step);
1107   case 2: m_reel1->configure(&starpoint_interface_48step);
1108   case 1: m_reel0->configure(&starpoint_interface_48step);
11031109   }
11041110   if (decrypt) bfm_decode_mainrom(machine(),"maincpu", m_codec_data);    // decode main rom
11051111
trunk/src/mame/drivers/bfm_sc2.c
r242422r242423
181181   bfm_sc2_state(const machine_config &mconfig, device_type type, const char *tag)
182182      : driver_device(mconfig, type, tag),
183183         m_maincpu(*this, "maincpu"),
184         m_reel0(*this, "reel0"),
185         m_reel1(*this, "reel1"),
186         m_reel2(*this, "reel2"),
187         m_reel3(*this, "reel3"),
188         m_reel4(*this, "reel4"),
189         m_reel5(*this, "reel5"),
184190         m_upd7759(*this, "upd"),
185191         m_vfd0(*this, "vfd0"),
186192         m_vfd1(*this, "vfd1"),
187193         m_dm01(*this, "dm01") { }
188194
189195   required_device<cpu_device> m_maincpu;
196   required_device<stepper_device> m_reel0;
197   required_device<stepper_device> m_reel1;
198   required_device<stepper_device> m_reel2;
199   required_device<stepper_device> m_reel3;
200   required_device<stepper_device> m_reel4;
201   required_device<stepper_device> m_reel5;
190202   required_device<upd7759_device> m_upd7759;
191203   optional_device<bfm_bd1_t> m_vfd0;
192204   optional_device<bfm_bd1_t> m_vfd1;
r242422r242423
199211   int m_mmtr_latch;
200212   int m_irq_status;
201213   int m_optic_pattern;
214   DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; }
215   DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; }
216   DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; }
217   DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; }
218   DECLARE_WRITE_LINE_MEMBER(reel4_optic_cb) { if (state) m_optic_pattern |= 0x10; else m_optic_pattern &= ~0x10; }
219   DECLARE_WRITE_LINE_MEMBER(reel5_optic_cb) { if (state) m_optic_pattern |= 0x20; else m_optic_pattern &= ~0x20; }
202220   int m_uart1_data;
203221   int m_uart2_data;
204222   int m_data_to_uart1;
r242422r242423
386404
387405   machine().device("ymsnd")->reset();
388406
389   // reset stepper motors /////////////////////////////////////////////////
390   {
391      int pattern =0, i;
392
393      for ( i = 0; i < m_reels; i++)
394      {
395         stepper_reset_position(i);
396         if ( stepper_optic_state(i) ) pattern |= 1<<i;
397      }
398
399      m_optic_pattern = pattern;
400
401   }
402
403407   // make sure no inputs are overidden ////////////////////////////////////
404408   memset(m_input_override, 0, sizeof(m_input_override));
405409
r242422r242423
546550{
547551   m_reel12_latch = data;
548552
549   stepper_update(0, data&0x0f   );
550   stepper_update(1, (data>>4)&0x0f );
553   m_reel0->update( data    &0x0f);
554   m_reel1->update((data>>4)&0x0f);
551555
552   if ( stepper_optic_state(0) ) m_optic_pattern |=  0x01;
553   else                          m_optic_pattern &= ~0x01;
554   if ( stepper_optic_state(1) ) m_optic_pattern |=  0x02;
555   else                          m_optic_pattern &= ~0x02;
556
557   awp_draw_reel(0);
558   awp_draw_reel(1);
556   awp_draw_reel(0, m_reel0);
557   awp_draw_reel(1, m_reel1);
559558}
560559
561560WRITE8_MEMBER(bfm_sc2_state::reel34_w)
562561{
563562   m_reel34_latch = data;
564563
565   stepper_update(2, data&0x0f );
566   stepper_update(3, (data>>4)&0x0f);
564   m_reel2->update( data    &0x0f);
565   m_reel3->update((data>>4)&0x0f);
567566
568   if ( stepper_optic_state(2) ) m_optic_pattern |=  0x04;
569   else                          m_optic_pattern &= ~0x04;
570   if ( stepper_optic_state(3) ) m_optic_pattern |=  0x08;
571   else                          m_optic_pattern &= ~0x08;
572
573   awp_draw_reel(2);
574   awp_draw_reel(3);
567   awp_draw_reel(2, m_reel2);
568   awp_draw_reel(3, m_reel3);
575569}
576570
577571///////////////////////////////////////////////////////////////////////////
r242422r242423
580574{
581575   m_reel56_latch = data;
582576
583   stepper_update(4, data&0x0f   );
584   stepper_update(5, (data>>4)&0x0f);
577   m_reel4->update( data    &0x0f);
578   m_reel5->update((data>>4)&0x0f);
585579
586   if ( stepper_optic_state(4) ) m_optic_pattern |=  0x10;
587   else                          m_optic_pattern &= ~0x10;
588   if ( stepper_optic_state(5) ) m_optic_pattern |=  0x20;
589   else                          m_optic_pattern &= ~0x20;
590
591   awp_draw_reel(4);
592   awp_draw_reel(5);
580   awp_draw_reel(4, m_reel4);
581   awp_draw_reel(5, m_reel5);
593582}
594583
595584
r242422r242423
21742163
21752164   MCFG_SOUND_ADD("ymsnd", YM2413, XTAL_3_579545MHz)
21762165   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
2166
2167   MCFG_DEVICE_ADD("reel0", STEPPER, 0)
2168   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel0_optic_cb))
2169   MCFG_DEVICE_ADD("reel1", STEPPER, 0)
2170   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel1_optic_cb))
2171   MCFG_DEVICE_ADD("reel2", STEPPER, 0)
2172   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel2_optic_cb))
2173   MCFG_DEVICE_ADD("reel3", STEPPER, 0)
2174   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel3_optic_cb))
2175   MCFG_DEVICE_ADD("reel4", STEPPER, 0)
2176   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel4_optic_cb))
2177   MCFG_DEVICE_ADD("reel5", STEPPER, 0)
2178   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfm_sc2_state, reel5_optic_cb))
2179
21772180MACHINE_CONFIG_END
21782181
21792182
r242422r242423
36643667
36653668void bfm_sc2_state::sc2awp_common_init(int reels, int decrypt)
36663669{
3667   int n;
36683670   sc2_common_init(decrypt);
36693671   /* setup n default 96 half step reels */
36703672
36713673   m_reels=reels;
36723674
3673   for ( n = 0; n < reels; n++ )
3675   switch (reels)
36743676   {
3675      stepper_config(machine(), n, &starpoint_interface_48step);
3677   case 6: m_reel5->configure(&starpoint_interface_48step);
3678   case 5: m_reel4->configure(&starpoint_interface_48step);
3679   case 4: m_reel3->configure(&starpoint_interface_48step);
3680   case 3: m_reel2->configure(&starpoint_interface_48step);
3681   case 2: m_reel1->configure(&starpoint_interface_48step);
3682   case 1: m_reel0->configure(&starpoint_interface_48step);
36763683   }
36773684}
36783685
36793686void bfm_sc2_state::sc2awpdmd_common_init(int reels, int decrypt)
36803687{
3681   int n;
36823688   sc2_common_init(decrypt);
36833689   /* setup n default 96 half step reels */
36843690
36853691   m_reels=reels;
36863692
3687   for ( n = 0; n < reels; n++ )
3693   switch (reels)
36883694   {
3689      stepper_config(machine(), n, &starpoint_interface_48step);
3695   case 6: m_reel5->configure(&starpoint_interface_48step);
3696   case 5: m_reel4->configure(&starpoint_interface_48step);
3697   case 4: m_reel3->configure(&starpoint_interface_48step);
3698   case 3: m_reel2->configure(&starpoint_interface_48step);
3699   case 2: m_reel1->configure(&starpoint_interface_48step);
3700   case 1: m_reel0->configure(&starpoint_interface_48step);
36903701   }
36913702}
36923703
trunk/src/mame/drivers/bfm_sc4h.c
r242422r242423
517517{
518518   m_reel12_latch = data;
519519
520   stepper_update(0, data&0x0f   );
521   stepper_update(1, (data>>4)&0x0f );
520   m_reel0->update( data    &0x0f);
521   m_reel1->update((data>>4)&0x0f);
522522
523   if ( stepper_optic_state(0) ) m_optic_pattern |=  0x01;
524   else                          m_optic_pattern &= ~0x01;
525   if ( stepper_optic_state(1) ) m_optic_pattern |=  0x02;
526   else                          m_optic_pattern &= ~0x02;
527
528   awp_draw_reel(0);
529   awp_draw_reel(1);
523   awp_draw_reel(0, m_reel0);
524   awp_draw_reel(1, m_reel1);
530525}
531526
532527WRITE8_MEMBER( sc4_state::bfm_sc4_reel3_w )
533528{
534529   m_reel3_latch = data;
535530
536   stepper_update(2, data&0x0f );
531   m_reel2->update(data&0x0f);
537532
538   if ( stepper_optic_state(2) ) m_optic_pattern |=  0x04;
539   else                          m_optic_pattern &= ~0x04;
540
541   awp_draw_reel(2);
533   awp_draw_reel(2, m_reel2);
542534}
543535
544536WRITE8_MEMBER( sc4_state::bfm_sc4_reel4_w )
545537{
546538   m_reel4_latch = data;
547539
548   stepper_update(3, data&0x0f );
540   m_reel3->update(data&0x0f );
549541
550   if ( stepper_optic_state(3) ) m_optic_pattern |=  0x08;
551   else                          m_optic_pattern &= ~0x08;
552
553   awp_draw_reel(3);
542   awp_draw_reel(3, m_reel3);
554543}
555544
556545void sc4_state::bfm_sc4_68307_portb_w(address_space &space, bool dedicated, UINT16 data, UINT16 line_mask)
r242422r242423
591580
592581MACHINE_RESET_MEMBER(sc4_state,sc4)
593582{
594   int pattern =0, i;
595
596   for ( i = 0; i < m_reels; i++)
597   {
598      stepper_reset_position(i);
599      if ( stepper_optic_state(i) ) pattern |= 1<<i;
600   }
601
602583   m_dochk41 = true;
603584
604   m_optic_pattern = pattern;
605585   sec.reset();
606586}
607587
r242422r242423
620600   int reels = 6;
621601   m_reels=reels;
622602
623   for ( int n = 0; n < reels; n++ )
624   {
625         if (m_reel_setup[n]) stepper_config(machine(), n, m_reel_setup[n]);
626   }
603   if (m_reel_setup[0]) m_reel0->configure(m_reel_setup[0]);
604   if (m_reel_setup[1]) m_reel1->configure(m_reel_setup[1]);
605   if (m_reel_setup[2]) m_reel2->configure(m_reel_setup[2]);
606   if (m_reel_setup[3]) m_reel3->configure(m_reel_setup[3]);
607   if (m_reel_setup[4]) m_reel4->configure(m_reel_setup[4]);
608   if (m_reel_setup[5]) m_reel5->configure(m_reel_setup[5]);
627609}
628610
629611
r242422r242423
663645//  logerror("bfm_sc4_duart_output_w\n");
664646   m_reel56_latch = data;
665647
666   stepper_update(4, data&0x0f   );
667   stepper_update(5, (data>>4)&0x0f);
648   m_reel4->update( data    &0x0f);
649   m_reel5->update((data>>4)&0x0f);
668650
669   if ( stepper_optic_state(4) ) m_optic_pattern |=  0x10;
670   else                          m_optic_pattern &= ~0x10;
671   if ( stepper_optic_state(5) ) m_optic_pattern |=  0x20;
672   else                          m_optic_pattern &= ~0x20;
673
674   awp_draw_reel(4);
675   awp_draw_reel(5);
651   awp_draw_reel(4, m_reel4);
652   awp_draw_reel(5, m_reel5);
676653}
677654
678655
r242422r242423
728705   MCFG_SOUND_ADD("ymz", YMZ280B, 16000000) // ?? Mhz
729706   MCFG_YMZ280B_IRQ_HANDLER(WRITELINE(sc4_state, bfm_sc4_irqhandler))
730707   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
708
709   MCFG_DEVICE_ADD("reel0", STEPPER, 0)
710   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel0_optic_cb))
711   MCFG_DEVICE_ADD("reel1", STEPPER, 0)
712   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel1_optic_cb))
713   MCFG_DEVICE_ADD("reel2", STEPPER, 0)
714   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel2_optic_cb))
715   MCFG_DEVICE_ADD("reel3", STEPPER, 0)
716   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel3_optic_cb))
717   MCFG_DEVICE_ADD("reel4", STEPPER, 0)
718   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel4_optic_cb))
719   MCFG_DEVICE_ADD("reel5", STEPPER, 0)
720   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(sc4_state, reel5_optic_cb))
731721MACHINE_CONFIG_END
732722
733723
trunk/src/mame/drivers/bfmsys85.c
r242422r242423
7474   bfmsys85_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag),
7575      m_vfd(*this, "vfd"),
7676      m_maincpu(*this, "maincpu"),
77      m_reel0(*this, "reel0"),
78      m_reel1(*this, "reel1"),
79      m_reel2(*this, "reel2"),
80      m_reel3(*this, "reel3"),
7781      m_acia6850_0(*this, "acia6850_0")
7882   {
7983   }
r242422r242423
8488   int m_alpha_clock;
8589   int m_irq_status;
8690   int m_optic_pattern;
91   DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; }
92   DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; }
93   DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; }
94   DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; }
8795   int m_locked;
8896   int m_is_timer_enabled;
8997   int m_coin_inhibits;
r242422r242423
117125   INTERRUPT_GEN_MEMBER(timer_irq);
118126   int b85_find_project_string( );
119127   required_device<cpu_device> m_maincpu;
128   required_device<stepper_device> m_reel0;
129   required_device<stepper_device> m_reel1;
130   required_device<stepper_device> m_reel2;
131   required_device<stepper_device> m_reel3;
120132   required_device<acia6850_device> m_acia6850_0;
121133};
122134
r242422r242423
158170
159171   m_vfd->reset(); // reset display1
160172
161// reset stepper motors ///////////////////////////////////////////////////
162   {
163      int pattern =0, i;
164
165      for ( i = 0; i < 6; i++)
166      {
167         stepper_reset_position(i);
168         if ( stepper_optic_state(i) ) pattern |= 1<<i;
169      }
170   m_optic_pattern = pattern;
171   }
172173   m_locked          = 0x00; // hardware is open
173174}
174175
r242422r242423
204205
205206WRITE8_MEMBER(bfmsys85_state::reel12_w)
206207{
207   stepper_update(0, (data>>4)&0x0f);
208   stepper_update(1, data&0x0f   );
208   m_reel0->update((data>>4)&0x0f);
209   m_reel1->update( data    &0x0f);
209210
210   if ( stepper_optic_state(0) ) m_optic_pattern |=  0x01;
211   else                          m_optic_pattern &= ~0x01;
212   if ( stepper_optic_state(1) ) m_optic_pattern |=  0x02;
213   else                          m_optic_pattern &= ~0x02;
214   awp_draw_reel(0);
215   awp_draw_reel(1);
211   awp_draw_reel(0, m_reel0);
212   awp_draw_reel(1, m_reel1);
216213}
217214
218215///////////////////////////////////////////////////////////////////////////
219216
220217WRITE8_MEMBER(bfmsys85_state::reel34_w)
221218{
222   stepper_update(2, (data>>4)&0x0f);
223   stepper_update(3, data&0x0f   );
219   m_reel2->update((data>>4)&0x0f);
220   m_reel3->update( data    &0x0f);
224221
225   if ( stepper_optic_state(2) ) m_optic_pattern |=  0x04;
226   else                          m_optic_pattern &= ~0x04;
227   if ( stepper_optic_state(3) ) m_optic_pattern |=  0x08;
228   else                          m_optic_pattern &= ~0x08;
229   awp_draw_reel(2);
230   awp_draw_reel(3);
222   awp_draw_reel(2, m_reel2);
223   awp_draw_reel(3, m_reel3);
231224}
232225
233226///////////////////////////////////////////////////////////////////////////
r242422r242423
353346
354347void bfmsys85_state::machine_start()
355348{
356   int i;
357   for ( i = 0; i < 4; i++ )
358   {
359      stepper_config(machine(), i, &starpoint_interface_48step);
360   }
361
349   m_reel0->configure(&starpoint_interface_48step);
350   m_reel1->configure(&starpoint_interface_48step);
351   m_reel2->configure(&starpoint_interface_48step);
352   m_reel3->configure(&starpoint_interface_48step);
362353}
363354
364355// memory map for bellfruit system85 board ////////////////////////////////
r242422r242423
415406
416407   MCFG_NVRAM_ADD_0FILL("nvram")                       // load/save nv RAM
417408
409   MCFG_DEVICE_ADD("reel0", STEPPER, 0)
410   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfmsys85_state, reel0_optic_cb))
411   MCFG_DEVICE_ADD("reel1", STEPPER, 0)
412   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfmsys85_state, reel1_optic_cb))
413   MCFG_DEVICE_ADD("reel2", STEPPER, 0)
414   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfmsys85_state, reel2_optic_cb))
415   MCFG_DEVICE_ADD("reel3", STEPPER, 0)
416   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(bfmsys85_state, reel3_optic_cb))
417
418418   MCFG_DEFAULT_LAYOUT(layout_bfmsys85)
419419MACHINE_CONFIG_END
420420
trunk/src/mame/drivers/ecoinf2.c
r242422r242423
2222   ecoinf2_state(const machine_config &mconfig, device_type type, const char *tag)
2323      : driver_device(mconfig, type, tag),
2424      m_maincpu(*this, "maincpu"),
25      m_reel0(*this, "reel0"),
26      m_reel1(*this, "reel1"),
27      m_reel2(*this, "reel2"),
28      m_reel3(*this, "reel3"),
2529      m_coins(*this, "COINS"),
2630      m_key(*this, "PERKEY"),
2731      m_panel(*this, "PANEL")
r242422r242423
3135   }
3236
3337   required_device<cpu_device> m_maincpu;
38   required_device<stepper_device> m_reel0;
39   required_device<stepper_device> m_reel1;
40   required_device<stepper_device> m_reel2;
41   required_device<stepper_device> m_reel3;
3442   required_ioport m_coins;
3543   required_ioport m_key;
3644   required_ioport m_panel;
r242422r242423
4048   //UINT16 m_chars[14];
4149//  void update_display();
4250   int m_optic_pattern;
51   DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; }
52   DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; }
53   DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; }
54   DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; }
4355   int strobe_addr;
4456   int strobe_amount;
4557
r242422r242423
187199
188200   DECLARE_WRITE8_MEMBER(ppi8255_ic23_write_a_reel01)
189201   {
190      stepper_update(0, data&0x0f);
191      stepper_update(1, (data>>4)&0x0f);
202      m_reel0->update( data    &0x0f);
203      m_reel1->update((data>>4)&0x0f);
192204
193      if ( stepper_optic_state(0) ) m_optic_pattern |=  0x10;
194      else                          m_optic_pattern &= ~0x10;
195      if ( stepper_optic_state(1) ) m_optic_pattern |=  0x20;
196      else                          m_optic_pattern &= ~0x20;
197
198      awp_draw_reel(0);
199      awp_draw_reel(1);
205      awp_draw_reel(0, m_reel0);
206      awp_draw_reel(1, m_reel1);
200207   }
201208
202209   DECLARE_WRITE8_MEMBER(ppi8255_ic23_write_b_reel23)
203210   {
204      stepper_update(2, data&0x0f);
205      stepper_update(3, (data>>4)&0x0f);
211      m_reel2->update( data    &0x0f);
212      m_reel3->update((data>>4)&0x0f);
206213
207      if ( stepper_optic_state(2) ) m_optic_pattern |=  0x40;
208      else                          m_optic_pattern &= ~0x40;
209      if ( stepper_optic_state(3) ) m_optic_pattern |=  0x80;
210      else                          m_optic_pattern &= ~0x80;
211
212      awp_draw_reel(2);
213      awp_draw_reel(3);
214      awp_draw_reel(2, m_reel2);
215      awp_draw_reel(3, m_reel3);
214216   }
215217
216218   DECLARE_READ8_MEMBER(ppi8255_ic23_read_c_key)
r242422r242423
498500MACHINE_START_MEMBER(ecoinf2_state,ecoinf2)
499501{
500502   MechMtr_config(machine(),8);
501   for ( int n = 0; n < 4; n++ )
502   {
503      stepper_config(machine(), n, &ecoin_interface_200step_reel);
504   }
503   m_reel0->configure(&ecoin_interface_200step_reel);
504   m_reel1->configure(&ecoin_interface_200step_reel);
505   m_reel2->configure(&ecoin_interface_200step_reel);
506   m_reel3->configure(&ecoin_interface_200step_reel);
505507}
506508
507509
r242422r242423
541543   MCFG_I8255_OUT_PORTB_CB(WRITE8(ecoinf2_state, ppi8255_ic13_write_b_strobedat1))
542544   MCFG_I8255_IN_PORTC_CB(READ8(ecoinf2_state, ppi8255_ic13_read_c_panel))
543545
546   MCFG_DEVICE_ADD("reel0", STEPPER, 0)
547   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf2_state, reel0_optic_cb))
548   MCFG_DEVICE_ADD("reel1", STEPPER, 0)
549   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf2_state, reel1_optic_cb))
550   MCFG_DEVICE_ADD("reel2", STEPPER, 0)
551   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf2_state, reel2_optic_cb))
552   MCFG_DEVICE_ADD("reel3", STEPPER, 0)
553   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf2_state, reel3_optic_cb))
554
544555//  MCFG_DEVICE_ADD("ic25_dips", I8255, 0)
545556MACHINE_CONFIG_END
546557
trunk/src/mame/drivers/ecoinf3.c
r242422r242423
2323public:
2424   ecoinf3_state(const machine_config &mconfig, device_type type, const char *tag)
2525      : driver_device(mconfig, type, tag),
26      m_maincpu(*this, "maincpu")
26      m_maincpu(*this, "maincpu"),
27      m_reel0(*this, "reel0"),
28      m_reel1(*this, "reel1"),
29      m_reel2(*this, "reel2"),
30      m_reel3(*this, "reel3")
2731   {
2832      strobe_amount = 0;
2933      strobe_addr = 0;
r242422r242423
3135   }
3236
3337   required_device<z180_device> m_maincpu;
38   required_device<stepper_device> m_reel0;
39   required_device<stepper_device> m_reel1;
40   required_device<stepper_device> m_reel2;
41   required_device<stepper_device> m_reel3;
3442
3543   UINT16 m_lamps[16];
3644   UINT16 m_chars[14];
r242422r242423
3947   int strobe_addr;
4048   int strobe_amount;
4149   int m_optic_pattern;
50   DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; }
51   DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; }
52   DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; }
53   DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; }
54
4255   int m_percent_mux;
4356
4457   DECLARE_READ8_MEMBER(ppi8255_intf_a_read_a) { int ret = 0x00; logerror("%04x - ppi8255_intf_a_read_a %02x\n", m_maincpu->pcbase(), ret); return ret; }
r242422r242423
211224   DECLARE_WRITE8_MEMBER(ppi8255_intf_d_write_a_reel01)
212225   {
213226//      logerror("%04x - ppi8255_intf_d_(used)write_a %02x\n", m_maincpu->pcbase(), data);
214      stepper_update(0, data&0x0f);
215      stepper_update(1, (data>>4)&0x0f);
227      m_reel0->update( data    &0x0f);
228      m_reel1->update((data>>4)&0x0f);
216229
217      if ( stepper_optic_state(0) ) m_optic_pattern |=  0x10;
218      else                          m_optic_pattern &= ~0x10;
219      if ( stepper_optic_state(1) ) m_optic_pattern |=  0x20;
220      else                          m_optic_pattern &= ~0x20;
221
222      awp_draw_reel(0);
223      awp_draw_reel(1);
230      awp_draw_reel(0, m_reel0);
231      awp_draw_reel(1, m_reel1);
224232   }
225233
226234   DECLARE_WRITE8_MEMBER(ppi8255_intf_d_write_b_reel23)
227235   {
228236//      logerror("%04x - ppi8255_intf_d_(used)write_b %02x\n", m_maincpu->pcbase(), data);
229237
230      stepper_update(2, data&0x0f);
231      stepper_update(3, (data>>4)&0x0f);
238      m_reel2->update( data    &0x0f);
239      m_reel3->update((data>>4)&0x0f);
232240
233      if ( stepper_optic_state(2) ) m_optic_pattern |=  0x40;
234      else                          m_optic_pattern &= ~0x40;
235      if ( stepper_optic_state(3) ) m_optic_pattern |=  0x80;
236      else                          m_optic_pattern &= ~0x80;
237
238      awp_draw_reel(2);
239      awp_draw_reel(3);
241      awp_draw_reel(2, m_reel2);
242      awp_draw_reel(3, m_reel3);
240243   }
241244
242245   DECLARE_WRITE8_MEMBER(ppi8255_intf_d_write_c) { logerror("%04x - ppi8255_intf_d_(used)write_c %02x\n", m_maincpu->pcbase(), data);}
r242422r242423
654657
655658MACHINE_START_MEMBER(ecoinf3_state,ecoinf3)
656659{
657   for ( int n = 0; n < 4; n++ )
658   {
659      stepper_config(machine(), n, &ecoin_interface_200step_reel);
660   }
660   m_reel0->configure(&ecoin_interface_200step_reel);
661   m_reel1->configure(&ecoin_interface_200step_reel);
662   m_reel2->configure(&ecoin_interface_200step_reel);
663   m_reel3->configure(&ecoin_interface_200step_reel);
661664}
662665
663666static MACHINE_CONFIG_START( ecoinf3_pyramid, ecoinf3_state )
r242422r242423
740743   MCFG_I8255_OUT_PORTB_CB(WRITE8(ecoinf3_state, ppi8255_intf_h_write_b))
741744   MCFG_I8255_IN_PORTC_CB(READ8(ecoinf3_state, ppi8255_intf_h_read_c))
742745   MCFG_I8255_OUT_PORTC_CB(WRITE8(ecoinf3_state, ppi8255_intf_h_write_c))
746
747   MCFG_DEVICE_ADD("reel0", STEPPER, 0)
748   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel0_optic_cb))
749   MCFG_DEVICE_ADD("reel1", STEPPER, 0)
750   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel1_optic_cb))
751   MCFG_DEVICE_ADD("reel2", STEPPER, 0)
752   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel2_optic_cb))
753   MCFG_DEVICE_ADD("reel3", STEPPER, 0)
754   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinf3_state, reel3_optic_cb))
743755MACHINE_CONFIG_END
744756
745757
trunk/src/mame/drivers/ecoinfr.c
r242422r242423
5353public:
5454   ecoinfr_state(const machine_config &mconfig, device_type type, const char *tag)
5555      : driver_device(mconfig, type, tag),
56      m_maincpu(*this, "maincpu") { }
56      m_maincpu(*this, "maincpu"),
57      m_reel0(*this, "reel0"),
58      m_reel1(*this, "reel1"),
59      m_reel2(*this, "reel2"),
60      m_reel3(*this, "reel3")
61      { }
5762
5863   int irq_toggle;
5964   int m_optic_pattern;
65   DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; }
66   DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; }
67   DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; }
68   DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; }
6069
6170   UINT8 port09_value;
6271   UINT8 port10_value;
r242422r242423
108117
109118   DECLARE_MACHINE_START(ecoinfr);
110119   required_device<cpu_device> m_maincpu;
120   required_device<stepper_device> m_reel0;
121   required_device<stepper_device> m_reel1;
122   required_device<stepper_device> m_reel2;
123   required_device<stepper_device> m_reel3;
111124};
112125
113126
r242422r242423
151164      printf("ec_port0a_out_w (reel 1 port) unk bits used %02x\n", data);
152165   }
153166
154   stepper_update(0, data&0x0f);
167   m_reel0->update(data&0x0f);
155168
156   if ( stepper_optic_state(0) ) m_optic_pattern |=  0x01;
157   else                          m_optic_pattern &= ~0x01;
158
159   awp_draw_reel(0);
169   awp_draw_reel(0, m_reel0);
160170}
161171
162172WRITE8_MEMBER(ecoinfr_state::ec_port01_out_w)
r242422r242423
166176      printf("ec_port01_out_w (reel 2 port) unk bits used %02x\n", data);
167177   }
168178
169   stepper_update(1, data&0x0f);
179   m_reel1->update(data&0x0f);
170180
171   if ( stepper_optic_state(1) ) m_optic_pattern |=  0x02;
172   else                          m_optic_pattern &= ~0x02;
173
174   awp_draw_reel(1);
181   awp_draw_reel(1, m_reel1);
175182}
176183
177184WRITE8_MEMBER(ecoinfr_state::ec_port02_out_w)
r242422r242423
181188      printf("ec_port02_out_w (reel 3 port) unk bits used %02x\n", data);
182189   }
183190
184   stepper_update(2, data&0x0f);
191   m_reel2->update(data&0x0f);
185192
186   if ( stepper_optic_state(2) ) m_optic_pattern |=  0x04;
187   else                          m_optic_pattern &= ~0x04;
188
189   awp_draw_reel(2);
193   awp_draw_reel(2, m_reel2);
190194}
191195
192196
r242422r242423
766770
767771MACHINE_START_MEMBER(ecoinfr_state,ecoinfr)
768772{
769   for ( int n = 0; n < 4; n++ )
770   {
771      stepper_config(machine(), n, &ecoin_interface_200step_reel);
772   }
773   m_reel0->configure(&ecoin_interface_200step_reel);
774   m_reel1->configure(&ecoin_interface_200step_reel);
775   m_reel2->configure(&ecoin_interface_200step_reel);
776   m_reel3->configure(&ecoin_interface_200step_reel);
773777}
774778
775779static MACHINE_CONFIG_START( ecoinfr, ecoinfr_state )
r242422r242423
784788   MCFG_MACHINE_START_OVERRIDE(ecoinfr_state, ecoinfr )
785789
786790   MCFG_DEVICE_ADD(UPD8251_TAG, I8251, 0)
791
792   MCFG_DEVICE_ADD("reel0", STEPPER, 0)
793   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinfr_state, reel0_optic_cb))
794   MCFG_DEVICE_ADD("reel1", STEPPER, 0)
795   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinfr_state, reel1_optic_cb))
796   MCFG_DEVICE_ADD("reel2", STEPPER, 0)
797   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(ecoinfr_state, reel2_optic_cb))
787798MACHINE_CONFIG_END
788799
789800
trunk/src/mame/drivers/jpmimpct.c
r242422r242423
965965   save_item(NAME(m_duart_1.IMR));
966966   save_item(NAME(m_duart_1.CT));
967967
968   stepper_config(machine(), 0, &starpoint_interface_48step);
969   stepper_config(machine(), 1, &starpoint_interface_48step);
970   stepper_config(machine(), 2, &starpoint_interface_48step);
971   stepper_config(machine(), 3, &starpoint_interface_48step);
972   stepper_config(machine(), 4, &starpoint_interface_48step);
973   stepper_config(machine(), 5, &starpoint_interface_48step);
974   stepper_config(machine(), 6, &starpoint_interface_48step);
968   m_reel0->configure(&starpoint_interface_48step);
969   m_reel1->configure(&starpoint_interface_48step);
970   m_reel2->configure(&starpoint_interface_48step);
971   m_reel3->configure(&starpoint_interface_48step);
972   m_reel4->configure(&starpoint_interface_48step);
973   m_reel5->configure(&starpoint_interface_48step);
975974}
976975
977976MACHINE_RESET_MEMBER(jpmimpct_state,impctawp)
r242422r242423
10621061
10631062READ16_MEMBER(jpmimpct_state::optos_r)
10641063{
1065   int i;
1066
1067   for (i=0; i<6; i++)
1068   {
1069      if ( stepper_optic_state(i) ) m_optic_pattern |= (1 << i);
1070      else                          m_optic_pattern &= ~(1 << i);
1071   }
10721064   return m_optic_pattern;
10731065}
10741066
r242422r242423
10971089
10981090      case 0x02:
10991091      {
1100         for (i=0; i<4; i++)
1101         {
1102            stepper_update(i, (data >> i)& 0x0F );
1103            awp_draw_reel(i);
1104         }
1092         m_reel0->update((data >> 0)& 0x0F);
1093         m_reel1->update((data >> 1)& 0x0F);
1094         m_reel2->update((data >> 2)& 0x0F);
1095         m_reel3->update((data >> 3)& 0x0F);
1096         awp_draw_reel(0, m_reel0);
1097         awp_draw_reel(1, m_reel1);
1098         awp_draw_reel(2, m_reel2);
1099         awp_draw_reel(3, m_reel3);
11051100         break;
11061101      }
11071102      case 0x04:
11081103      {
1109         for (i=0; i<2; i++)
1110         {
1111            stepper_update(i+4, (data >> (i + 4)& 0x0F ));
1112            awp_draw_reel(i+4);
1113         }
1104         m_reel4->update((data >> 4)& 0x0F);
1105         m_reel5->update((data >> 5)& 0x0F);
1106         awp_draw_reel(4, m_reel4);
1107         awp_draw_reel(5, m_reel5);
11141108         break;
11151109      }
11161110      case 0x06:
trunk/src/mame/drivers/maygay1b.c
r242422r242423
8181// called if board is reset ///////////////////////////////////////////////
8282///////////////////////////////////////////////////////////////////////////
8383
84void maygay1b_state::m1_stepper_reset()
85{
86   int pattern = 0,i;
87   for ( i = 0; i < 6; i++)
88   {
89      stepper_reset_position(i);
90      if ( stepper_optic_state(i) ) pattern |= 1<<i;
91   }
92   m_optic_pattern = pattern;
93}
94
9584void maygay1b_state::machine_reset()
9685{
9786   m_vfd->reset(); // reset display1
98   m1_stepper_reset();
9987   m_Vmm=false;
10088}
10189
r242422r242423
293281
294282void maygay1b_state::machine_start()
295283{
296   int i;
297
298284// setup 8 mechanical meters ////////////////////////////////////////////
299285   MechMtr_config(machine(),8);
300286
301287// setup 6 default 96 half step reels ///////////////////////////////////
302   for ( i = 0; i < 6; i++ )
303   {
304      stepper_config(machine(), i, &starpoint_interface_48step);
305   }
288   m_reel0->configure(&starpoint_interface_48step);
289   m_reel1->configure(&starpoint_interface_48step);
290   m_reel2->configure(&starpoint_interface_48step);
291   m_reel3->configure(&starpoint_interface_48step);
292   m_reel4->configure(&starpoint_interface_48step);
293   m_reel5->configure(&starpoint_interface_48step);
306294
307295}
308296WRITE8_MEMBER(maygay1b_state::reel12_w)
309297{
310   stepper_update(0, data & 0x0F );
311   stepper_update(1, (data>>4) & 0x0F );
298   m_reel0->update( data     & 0x0F);
299   m_reel1->update((data>>4) & 0x0F);
312300
313   if ( stepper_optic_state(0) ) m_optic_pattern |=  0x01;
314   else                          m_optic_pattern &= ~0x01;
315   if ( stepper_optic_state(1) ) m_optic_pattern |=  0x02;
316   else                          m_optic_pattern &= ~0x02;
317
318   awp_draw_reel(0);
319   awp_draw_reel(1);
301   awp_draw_reel(0, m_reel0);
302   awp_draw_reel(1, m_reel1);
320303}
321304
322305WRITE8_MEMBER(maygay1b_state::reel34_w)
323306{
324   stepper_update(2, data & 0x0F );
325   stepper_update(3, (data>>4) & 0x0F );
307   m_reel2->update( data     & 0x0F);
308   m_reel3->update((data>>4) & 0x0F);
326309
327   if ( stepper_optic_state(2) ) m_optic_pattern |=  0x04;
328   else                          m_optic_pattern &= ~0x04;
329   if ( stepper_optic_state(3) ) m_optic_pattern |=  0x08;
330   else                          m_optic_pattern &= ~0x08;
331
332   awp_draw_reel(2);
333   awp_draw_reel(3);
310   awp_draw_reel(2, m_reel2);
311   awp_draw_reel(3, m_reel3);
334312}
335313
336314WRITE8_MEMBER(maygay1b_state::reel56_w)
337315{
338   stepper_update(4, data & 0x0F );
339   stepper_update(5, (data>>4) & 0x0F );
316   m_reel4->update( data     & 0x0F);
317   m_reel5->update((data>>4) & 0x0F);
340318
341   if ( stepper_optic_state(4) ) m_optic_pattern |=  0x10;
342   else                          m_optic_pattern &= ~0x10;
343   if ( stepper_optic_state(5) ) m_optic_pattern |=  0x20;
344   else                          m_optic_pattern &= ~0x20;
345
346   awp_draw_reel(4);
347   awp_draw_reel(5);
319   awp_draw_reel(4, m_reel4);
320   awp_draw_reel(5, m_reel5);
348321}
349322
350323READ8_MEMBER(maygay1b_state::m1_duart_r)
r242422r242423
651624   MCFG_DEVICE_ADD("i8279_2", I8279, M1_MASTER_CLOCK/4)        // unknown clock
652625   MCFG_I8279_OUT_DISP_CB(WRITE8(maygay1b_state, lamp_data_2_w))       // display A&B
653626
627   MCFG_DEVICE_ADD("reel0", STEPPER, 0)
628   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel0_optic_cb))
629   MCFG_DEVICE_ADD("reel1", STEPPER, 0)
630   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel1_optic_cb))
631   MCFG_DEVICE_ADD("reel2", STEPPER, 0)
632   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel2_optic_cb))
633   MCFG_DEVICE_ADD("reel3", STEPPER, 0)
634   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel3_optic_cb))
635   MCFG_DEVICE_ADD("reel4", STEPPER, 0)
636   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel4_optic_cb))
637   MCFG_DEVICE_ADD("reel5", STEPPER, 0)
638   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(maygay1b_state, reel5_optic_cb))
639
654640   MCFG_NVRAM_ADD_0FILL("nvram")
655641
656642   MCFG_DEFAULT_LAYOUT(layout_maygay1b)
trunk/src/mame/drivers/mpu3.c
r242422r242423
132132   mpu3_state(const machine_config &mconfig, device_type type, const char *tag)
133133   : driver_device(mconfig, type, tag),
134134         m_vfd(*this, "vfd"),
135         m_maincpu(*this, "maincpu") { }
135         m_maincpu(*this, "maincpu"),
136         m_reel0(*this, "reel0"),
137         m_reel1(*this, "reel1"),
138         m_reel2(*this, "reel2"),
139         m_reel3(*this, "reel3")
140         { }
136141   optional_device<roc10937_t> m_vfd;
137142
138143
r242422r242423
165170
166171int m_optic_pattern;
167172
173   DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; }
174   DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; }
175   DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; }
176   DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; }
177
168178emu_timer *m_ic21_timer;
169179   DECLARE_WRITE8_MEMBER(characteriser_w);
170180   DECLARE_READ8_MEMBER(characteriser_r);
r242422r242423
198208   TIMER_DEVICE_CALLBACK_MEMBER(gen_50hz);
199209   TIMER_DEVICE_CALLBACK_MEMBER(ic10_callback);
200210   void update_triacs();
201   void mpu3_stepper_reset();
202211   void ic11_update();
203212   void ic21_output(int data);
204213   void ic21_setup();
205214   void mpu3_config_common();
206215   required_device<cpu_device> m_maincpu;
216   required_device<stepper_device> m_reel0;
217   required_device<stepper_device> m_reel1;
218   required_device<stepper_device> m_reel2;
219   required_device<stepper_device> m_reel3;
207220};
208221
209222#define DISPLAY_PORT 0
r242422r242423
224237}
225238
226239/* called if board is reset */
227void mpu3_state::mpu3_stepper_reset()
228{
229   int pattern = 0,reel;
230   for (reel = 0; reel < 6; reel++)
231   {
232      stepper_reset_position(reel);
233      if (stepper_optic_state(reel)) pattern |= 1<<reel;
234   }
235   m_optic_pattern = pattern;
236}
237
238240void mpu3_state::machine_reset()
239241{
240242   m_vfd->reset();
241243
242   mpu3_stepper_reset();
243
244244   m_lamp_strobe   = 0;
245245   m_led_strobe    = 0;
246246
r242422r242423
509509WRITE8_MEMBER(mpu3_state::pia_ic5_porta_w)
510510{
511511   LOG(("%s: IC5 PIA Port A Set to %2x (Reel)\n", machine().describe_context(),data));
512   stepper_update(0, data & 0x03 );
513   stepper_update(1, (data>>2) & 0x03 );
514   stepper_update(2, (data>>4) & 0x03 );
515   stepper_update(3, (data>>6) & 0x03 );
516   awp_draw_reel(0);
517   awp_draw_reel(1);
518   awp_draw_reel(2);
519   awp_draw_reel(3);
520
521   {
522      if ( stepper_optic_state(0) ) m_optic_pattern |=  0x01;
523      else                          m_optic_pattern &= ~0x01;
524
525      if ( stepper_optic_state(1) ) m_optic_pattern |=  0x02;
526      else                          m_optic_pattern &= ~0x02;
527      if ( stepper_optic_state(2) ) m_optic_pattern |=  0x04;
528      else                          m_optic_pattern &= ~0x04;
529
530      if ( stepper_optic_state(3) ) m_optic_pattern |=  0x08;
531      else                          m_optic_pattern &= ~0x08;
532
533   }
534
512   m_reel0->update( data     & 0x03);
513   m_reel1->update((data>>2) & 0x03);
514   m_reel2->update((data>>4) & 0x03);
515   m_reel3->update((data>>6) & 0x03);
516   awp_draw_reel(0, m_reel0);
517   awp_draw_reel(1, m_reel1);
518   awp_draw_reel(2, m_reel2);
519   awp_draw_reel(3, m_reel3);
535520}
536521
537522READ8_MEMBER(mpu3_state::pia_ic5_portb_r)
r242422r242423
723708   MechMtr_config(machine(),8);
724709
725710   /* setup 4 reels */
726   stepper_config(machine(), 0, &mpu3_reel_interface);
727   stepper_config(machine(), 1, &mpu3_reel_interface);
728   stepper_config(machine(), 2, &mpu3_reel_interface);
729   stepper_config(machine(), 3, &mpu3_reel_interface);
711   m_reel0->configure(&mpu3_reel_interface);
712   m_reel1->configure(&mpu3_reel_interface);
713   m_reel2->configure(&mpu3_reel_interface);
714   m_reel3->configure(&mpu3_reel_interface);
730715
731716}
732717/*
r242422r242423
871856   MCFG_PIA_IRQA_HANDLER(WRITELINE(mpu3_state, cpu0_irq))
872857   MCFG_PIA_IRQB_HANDLER(WRITELINE(mpu3_state, cpu0_irq))
873858
859   MCFG_DEVICE_ADD("reel0", STEPPER, 0)
860   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu3_state, reel0_optic_cb))
861   MCFG_DEVICE_ADD("reel1", STEPPER, 0)
862   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu3_state, reel1_optic_cb))
863   MCFG_DEVICE_ADD("reel2", STEPPER, 0)
864   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu3_state, reel2_optic_cb))
865   MCFG_DEVICE_ADD("reel3", STEPPER, 0)
866   MCFG_STEPPER_OPTIC_CALLBACK(WRITELINE(mpu3_state, reel3_optic_cb))
867
874868   MCFG_NVRAM_ADD_0FILL("nvram")
875869
876870   MCFG_DEFAULT_LAYOUT(layout_mpu3)
trunk/src/mame/drivers/mpu4dealem.c
r242422r242423
171171{
172172   m_vfd->reset(); //for debug ports only
173173
174   mpu4_stepper_reset();
175
176174   m_lamp_strobe    = 0;
177175   m_lamp_strobe2   = 0;
178176   m_led_strobe     = 0;
trunk/src/mame/drivers/mpu4hw.c
r242422r242423
375375      break;
376376
377377   case FIVE_REEL_5TO8:
378      stepper_update(4, ((data >> 4) & 0x0f));
378      m_reel4->update(((data >> 4) & 0x0f));
379379      data = (data & 0x0F); //Strip reel data from meter drives, leaving active elements
380      awp_draw_reel(4);
380      awp_draw_reel(4, m_reel4);
381381      break;
382382
383383   case FIVE_REEL_8TO5:
384      stepper_update(4, (((data & 0x01) + ((data & 0x08) >> 2) + ((data & 0x20) >> 3) + ((data & 0x80) >> 4)) & 0x0f)) ;
384      m_reel4->update((((data & 0x01) + ((data & 0x08) >> 2) + ((data & 0x20) >> 3) + ((data & 0x80) >> 4)) & 0x0f)) ;
385385      data = 0x00; //Strip all reel data from meter drives, nothing is connected
386      awp_draw_reel(4);
386      awp_draw_reel(4, m_reel4);
387387      break;
388388
389389   case FIVE_REEL_3TO6:
390      stepper_update(4, ((data >> 2) & 0x0f));
390      m_reel4->update(((data >> 2) & 0x0f));
391391      data = 0x00; //Strip all reel data from meter drives
392      awp_draw_reel(4);
392      awp_draw_reel(4, m_reel4);
393393      break;
394394
395395   case SIX_REEL_1TO8:
396      stepper_update(4, (data & 0x0f));
397      stepper_update(5, ((data >> 4) & 0x0f));
396      m_reel4->update( data       & 0x0f);
397      m_reel5->update((data >> 4) & 0x0f);
398398      data = 0x00; //Strip all reel data from meter drives
399      awp_draw_reel(4);
400      awp_draw_reel(5);
399      awp_draw_reel(4, m_reel4);
400      awp_draw_reel(5, m_reel5);
401401      break;
402402
403403   case SIX_REEL_5TO8:
404      stepper_update(4, ((data >> 4) & 0x0f));
404      m_reel4->update(((data >> 4) & 0x0f));
405405      data = 0x00; //Strip all reel data from meter drives
406      awp_draw_reel(4);
406      awp_draw_reel(4, m_reel4);
407407      break;
408408
409409   case SEVEN_REEL:
410      stepper_update(0, (((data & 0x01) + ((data & 0x08) >> 2) + ((data & 0x20) >> 3) + ((data & 0x80) >> 4)) & 0x0f)) ;
410      m_reel0->update((((data & 0x01) + ((data & 0x08) >> 2) + ((data & 0x20) >> 3) + ((data & 0x80) >> 4)) & 0x0f)) ;
411411      data = 0x00; //Strip all reel data from meter drives
412      awp_draw_reel(0);
412      awp_draw_reel(0, m_reel0);
413413      break;
414414
415415   case FLUTTERBOX: //The backbox fan assembly fits in a reel unit sized box, wired to the remote meter pin, so we can handle it here
r242422r242423
433433}
434434
435435/* called if board is reset */
436void mpu4_state::mpu4_stepper_reset()
437{
438   int pattern = 0,reel;
439   for (reel = 0; reel < 6; reel++)
440   {
441      stepper_reset_position(reel);
442      if(!m_reel_mux)
443      {
444         if (stepper_optic_state(reel)) pattern |= 1<<reel;
445      }
446   }
447   m_optic_pattern = pattern;
448}
449
450
451436MACHINE_RESET_MEMBER(mpu4_state,mpu4)
452437{
453438   m_vfd->reset();
454439
455   mpu4_stepper_reset();
456
457440   m_lamp_strobe    = 0;
458441   m_lamp_strobe2   = 0;
459442   m_led_strobe     = 0;
r242422r242423
788771   }
789772   else
790773   {
791      if (stepper_optic_state(m_active_reel))
774      if (m_optic_pattern & (1<<m_active_reel))
792775      {
793776         m_ic4_input_b |=  0x08;
794777      }
r242422r242423
915898   }
916899   if (m_reel_mux == SIX_REEL_5TO8)
917900   {
918      stepper_update(4, data&0x0F);
919      stepper_update(5, (data >> 4)&0x0F);
920      awp_draw_reel(4);
921      awp_draw_reel(5);
901      m_reel4->update( data      &0x0F);
902      m_reel5->update((data >> 4)&0x0F);
903      awp_draw_reel(4, m_reel4);
904      awp_draw_reel(5, m_reel5);
922905   }
923906   else
924907   if (m_reel_mux == SEVEN_REEL)
925908   {
926      stepper_update(1, data&0x0F);
927      stepper_update(2, (data >> 4)&0x0F);
928      awp_draw_reel(1);
929      awp_draw_reel(2);
909      m_reel1->update( data      &0x0F);
910      m_reel2->update((data >> 4)&0x0F);
911      awp_draw_reel(1, m_reel1);
912      awp_draw_reel(2, m_reel2);
930913   }
931914
932915   if (core_stricmp(machine().system().name, "m4gambal") == 0)
r242422r242423
11391122
11401123   if (m_reel_mux == SEVEN_REEL)
11411124   {
1142      stepper_update(3, data&0x0F);
1143      stepper_update(4, (data >> 4)&0x0F);
1144      awp_draw_reel(3);
1145      awp_draw_reel(4);
1125      m_reel3->update( data      &0x0F);
1126      m_reel4->update((data >> 4)&0x0F);
1127      awp_draw_reel(3, m_reel3);
1128      awp_draw_reel(4, m_reel4);
11461129   }
11471130   else if (m_reels)
11481131   {
1149      stepper_update(0, data & 0x0F );
1150      stepper_update(1, (data>>4) & 0x0F );
1151      awp_draw_reel(0);
1152      awp_draw_reel(1);
1132      m_reel0->update( data      &0x0F);
1133      m_reel1->update((data >> 4)&0x0F);
1134      awp_draw_reel(0, m_reel0);
1135      awp_draw_reel(1, m_reel1);
11531136   }
1154
1155   if (m_reel_flag && (m_reel_mux == STANDARD_REEL) && m_reels)
1156   {
1157      if ( stepper_optic_state(0) ) m_optic_pattern |=  0x01;
1158      else                          m_optic_pattern &= ~0x01;
1159
1160      if ( stepper_optic_state(1) ) m_optic_pattern |=  0x02;
1161      else                          m_optic_pattern &= ~0x02;
1162   }
11631137}
11641138
11651139
r242422r242423
12041178   LOG(("%s: IC7 PIA Port A Set to %2x (Reel C and D)\n", machine().describe_context(),data));
12051179   if (m_reel_mux == SEVEN_REEL)
12061180   {
1207      stepper_update(5, data&0x0F);
1208      stepper_update(6, (data >> 4)&0x0F);
1209      awp_draw_reel(5);
1210      awp_draw_reel(6);
1181      m_reel5->update( data      &0x0F);
1182      m_reel6->update((data >> 4)&0x0F);
1183      awp_draw_reel(5, m_reel5);
1184      awp_draw_reel(6, m_reel6);
12111185   }
12121186   else if (m_reels)
12131187   {
1214      stepper_update(2, data & 0x0F );
1215      stepper_update(3, (data>>4) & 0x0F );
1216      awp_draw_reel(2);
1217      awp_draw_reel(3);
1188      m_reel2->update( data      &0x0F);
1189      m_reel3->update((data >> 4)&0x0F);
1190      awp_draw_reel(2, m_reel2);
1191      awp_draw_reel(3, m_reel3);
12181192   }
1219
1220   if (m_reel_flag && (m_reel_mux == STANDARD_REEL) && m_reels)
1221   {
1222      if ( stepper_optic_state(2) ) m_optic_pattern |=  0x04;
1223      else                          m_optic_pattern &= ~0x04;
1224      if ( stepper_optic_state(3) ) m_optic_pattern |=  0x08;
1225      else                          m_optic_pattern &= ~0x08;
1226   }
12271193}
12281194
12291195WRITE8_MEMBER(mpu4_state::pia_ic7_portb_w)
r242422r242423
22302196
22312197}
22322198
2233void mpu4_state::mpu4_config_common_reels(int reels)
2234{
2235   int n;
2236   /* setup n default 96 half step reels, using the standard optic flag */
2237   for ( n = 0; n < reels; n++ )
2238   {
2239      stepper_config(machine(), n, &barcrest_reel_interface);
2240   }
2241}
2242
22432199MACHINE_START_MEMBER(mpu4_state,mod2)
22442200{
22452201   mpu4_config_common();
r242422r242423
23682324   m_reel_mux=SIX_REEL_1TO8;
23692325   m_reels = 6;
23702326
2371   stepper_config(machine(), 0, &barcrest_opto1_interface);
2372   stepper_config(machine(), 1, &barcrest_opto1_interface);
2373   stepper_config(machine(), 2, &barcrest_opto1_interface);
2374   stepper_config(machine(), 3, &barcrest_opto1_interface);
2375   stepper_config(machine(), 4, &barcrest_opto1_interface);
2376   stepper_config(machine(), 5, &barcrest_opto1_interface);
2327   m_reel0->configure(&barcrest_opto1_interface);
2328   m_reel1->configure(&barcrest_opto1_interface);
2329   m_reel2->configure(&barcrest_opto1_interface);
2330   m_reel3->configure(&barcrest_opto1_interface);
2331   m_reel4->configure(&barcrest_opto1_interface);
2332   m_reel5->configure(&barcrest_opto1_interface);
23772333   DRIVER_INIT_CALL(m4default_banks);
23782334
23792335   m_current_chr_table = oldtmr_data;
r242422r242423
23842340   m_reel_mux=SIX_REEL_1TO8;
23852341   m_reels = 6;
23862342
2387   stepper_config(machine(), 0, &barcrest_opto1_interface);
2388   stepper_config(machine(), 1, &barcrest_opto1_interface);
2389   stepper_config(machine(), 2, &barcrest_opto1_interface);
2390   stepper_config(machine(), 3, &barcrest_opto1_interface);
2391   stepper_config(machine(), 4, &barcrest_opto1_interface);
2392   stepper_config(machine(), 5, &barcrest_opto1_interface);
2343   m_reel0->configure(&barcrest_opto1_interface);
2344   m_reel1->configure(&barcrest_opto1_interface);
2345   m_reel2->configure(&barcrest_opto1_interface);
2346   m_reel3->configure(&barcrest_opto1_interface);
2347   m_reel4->configure(&barcrest_opto1_interface);
2348   m_reel5->configure(&barcrest_opto1_interface);
23932349   DRIVER_INIT_CALL(m4default_banks);
23942350}
23952351
r242422r242423
24122368   m_reels = 5;
24132369   m_lamp_extender=SMALL_CARD;
24142370   // setup 4 default 96 half step reels with the mux board
2415   mpu4_config_common_reels(5);
2371   m_reel0->configure(&barcrest_reel_interface);
2372   m_reel1->configure(&barcrest_reel_interface);
2373   m_reel2->configure(&barcrest_reel_interface);
2374   m_reel3->configure(&barcrest_reel_interface);
2375   m_reel4->configure(&barcrest_reel_interface);
24162376   DRIVER_INIT_CALL(m4default_banks);
24172377
24182378   m_current_chr_table = grtecp_data;
r242422r242423
24232383   m_bwb_bank=1;
24242384   m_reel_mux=FIVE_REEL_5TO8;
24252385   m_reels = 5;
2426   stepper_config(machine(), 0, &bwb_opto1_interface);
2427   stepper_config(machine(), 1, &bwb_opto1_interface);
2428   stepper_config(machine(), 2, &bwb_opto1_interface);
2429   stepper_config(machine(), 3, &bwb_opto1_interface);
2430   stepper_config(machine(), 4, &bwb_opto1_interface);
2386   m_reel0->configure(&bwb_opto1_interface);
2387   m_reel1->configure(&bwb_opto1_interface);
2388   m_reel2->configure(&bwb_opto1_interface);
2389   m_reel3->configure(&bwb_opto1_interface);
2390   m_reel4->configure(&bwb_opto1_interface);
24312391   m_bwb_chr_table1 = blsbys_data1;
24322392   m_current_chr_table = blsbys_data;
24332393   DRIVER_INIT_CALL(m4default_big);
r242422r242423
24372397{
24382398   m_reel_mux=STANDARD_REEL;
24392399   m_reels = 4;
2440   mpu4_config_common_reels(4);
2400   m_reel0->configure(&barcrest_reel_interface);
2401   m_reel1->configure(&barcrest_reel_interface);
2402   m_reel2->configure(&barcrest_reel_interface);
2403   m_reel3->configure(&barcrest_reel_interface);
24412404   m_bwb_bank=0;
24422405}
24432406
r242422r242423
24532416{
24542417   m_reel_mux=STANDARD_REEL;
24552418   m_reels = 8;
2456   stepper_config(machine(), 0, &barcrest_opto2_interface);
2457   stepper_config(machine(), 1, &barcrest_opto2_interface);
2458   stepper_config(machine(), 2, &barcrest_opto2_interface);
2459   stepper_config(machine(), 3, &barcrest_opto2_interface);
2460   stepper_config(machine(), 4, &barcrest_opto2_interface);
2461   stepper_config(machine(), 5, &barcrest_opto2_interface);
2462   stepper_config(machine(), 6, &barcrest_opto2_interface);
2463   stepper_config(machine(), 7, &barcrest_opto2_interface);
2419   m_reel0->configure(&barcrest_opto2_interface);
2420   m_reel1->configure(&barcrest_opto2_interface);
2421   m_reel2->configure(&barcrest_opto2_interface);
2422   m_reel3->configure(&barcrest_opto2_interface);
2423   m_reel4->configure(&barcrest_opto2_interface);
2424   m_reel5->configure(&barcrest_opto2_interface);
2425   m_reel6->configure(&barcrest_opto2_interface);
2426   m_reel7->configure(&barcrest_opto2_interface);
24642427   DRIVER_INIT_CALL(m4default_banks);
24652428
24662429   m_bwb_bank=0;
trunk/src/mame/drivers/mpu4vid.c
r242422r242423
12631263{
12641264   m_vfd->reset(); //for debug ports only
12651265
1266   mpu4_stepper_reset();
1267
12681266   m_lamp_strobe    = 0;
12691267   m_lamp_strobe2   = 0;
12701268   m_led_strobe     = 0;
trunk/src/mame/includes/bfm_sc45.h
r242422r242423
101101         m_maincpu(*this, "maincpu"),
102102         m_cpuregion(*this, "maincpu"),
103103         m_nvram(*this, "nvram"),
104         m_reel0(*this, "reel0"),
105         m_reel1(*this, "reel1"),
106         m_reel2(*this, "reel2"),
107         m_reel3(*this, "reel3"),
108         m_reel4(*this, "reel4"),
109         m_reel5(*this, "reel5"),
104110         m_io1(*this, "IN-0"),
105111         m_io2(*this, "IN-1"),
106112         m_io3(*this, "IN-2"),
r242422r242423
122128   required_memory_region m_cpuregion;
123129   // devices
124130   required_device<nvram_device> m_nvram;
131   required_device<stepper_device> m_reel0;
132   required_device<stepper_device> m_reel1;
133   required_device<stepper_device> m_reel2;
134   required_device<stepper_device> m_reel3;
135   required_device<stepper_device> m_reel4;
136   required_device<stepper_device> m_reel5;
125137
126138
127139   const stepper_interface **m_reel_setup;
r242422r242423
131143   int m_reel4_latch;
132144   int m_reel56_latch;
133145   int m_optic_pattern;
146   DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; }
147   DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; }
148   DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; }
149   DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; }
150   DECLARE_WRITE_LINE_MEMBER(reel4_optic_cb) { if (state) m_optic_pattern |= 0x10; else m_optic_pattern &= ~0x10; }
151   DECLARE_WRITE_LINE_MEMBER(reel5_optic_cb) { if (state) m_optic_pattern |= 0x20; else m_optic_pattern &= ~0x20; }
134152   SEC sec;
135153
136154   int m_meterstatus;
trunk/src/mame/includes/jpmimpct.h
r242422r242423
44
55****************************************************************************/
66#include "machine/roc10937.h"
7#include "machine/steppers.h"
78#include "cpu/tms34010/tms34010.h"
89#include "sound/upd7759.h"
910
r242422r242423
6263      m_maincpu(*this, "maincpu"),
6364      m_upd7759(*this, "upd"),
6465      m_palette(*this, "palette"),
65      m_dsp(*this, "dsp") { }
66      m_dsp(*this, "dsp"),
67      m_reel0(*this, "reel0"),
68      m_reel1(*this, "reel1"),
69      m_reel2(*this, "reel2"),
70      m_reel3(*this, "reel3"),
71      m_reel4(*this, "reel4"),
72      m_reel5(*this, "reel5")
73      { }
6674
6775   UINT8 m_tms_irq;
6876   UINT8 m_duart_1_irq;
r242422r242423
7280   int m_lamp_strobe;
7381   UINT8 m_Lamps[256];
7482   int m_optic_pattern;
83   DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; }
84   DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; }
85   DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; }
86   DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; }
87   DECLARE_WRITE_LINE_MEMBER(reel4_optic_cb) { if (state) m_optic_pattern |= 0x10; else m_optic_pattern &= ~0x10; }
88   DECLARE_WRITE_LINE_MEMBER(reel5_optic_cb) { if (state) m_optic_pattern |= 0x20; else m_optic_pattern &= ~0x20; }
7589   int m_payen;
7690   int m_alpha_clock;
7791   int m_hopinhibit;
r242422r242423
123137   required_device<upd7759_device> m_upd7759;
124138   optional_device<palette_device> m_palette;
125139   optional_device<tms34010_device> m_dsp;
140   required_device<stepper_device> m_reel0;
141   required_device<stepper_device> m_reel1;
142   required_device<stepper_device> m_reel2;
143   required_device<stepper_device> m_reel3;
144   required_device<stepper_device> m_reel4;
145   required_device<stepper_device> m_reel5;
126146};
trunk/src/mame/includes/maygay1b.h
r242422r242423
4444      m_s5_port(*this, "STROBE5"),
4545      m_s6_port(*this, "STROBE6"),
4646      m_s7_port(*this, "STROBE7"),
47      m_bank1(*this, "bank1")
47      m_bank1(*this, "bank1"),
48      m_reel0(*this, "reel0"),
49      m_reel1(*this, "reel1"),
50      m_reel2(*this, "reel2"),
51      m_reel3(*this, "reel3"),
52      m_reel4(*this, "reel4"),
53      m_reel5(*this, "reel5")
4854   {}
4955
5056   required_device<cpu_device> m_maincpu;
r242422r242423
6369   required_ioport m_s6_port;
6470   required_ioport m_s7_port;
6571   required_memory_bank m_bank1;
72   required_device<stepper_device> m_reel0;
73   required_device<stepper_device> m_reel1;
74   required_device<stepper_device> m_reel2;
75   required_device<stepper_device> m_reel3;
76   required_device<stepper_device> m_reel4;
77   required_device<stepper_device> m_reel5;
6678
6779   UINT8 m_lamppos;
6880   int m_lamp_strobe;
r242422r242423
7991   TIMER_DEVICE_CALLBACK_MEMBER( maygay1b_nmitimer_callback );
8092   UINT8 m_Lamps[256];
8193   int m_optic_pattern;
94   DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; }
95   DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; }
96   DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; }
97   DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; }
98   DECLARE_WRITE_LINE_MEMBER(reel4_optic_cb) { if (state) m_optic_pattern |= 0x10; else m_optic_pattern &= ~0x10; }
99   DECLARE_WRITE_LINE_MEMBER(reel5_optic_cb) { if (state) m_optic_pattern |= 0x20; else m_optic_pattern &= ~0x20; }
82100   DECLARE_WRITE8_MEMBER(scanlines_w);
83101   DECLARE_WRITE8_MEMBER(lamp_data_w);
84102   DECLARE_WRITE8_MEMBER(lamp_data_2_w);
r242422r242423
111129   virtual void machine_reset();
112130   void cpu0_firq(int data);
113131   void cpu0_nmi();
114   void m1_stepper_reset();
115132};
116133
117134MACHINE_CONFIG_EXTERN( maygay_m1 );
trunk/src/mame/includes/mpu4.h
r242422r242423
113113         m_aux2_port(*this, "AUX2"),
114114         m_bank1(*this, "bank1"),
115115         m_msm6376(*this, "msm6376"),
116         m_reel0(*this, "reel0"),
117         m_reel1(*this, "reel1"),
118         m_reel2(*this, "reel2"),
119         m_reel3(*this, "reel3"),
120         m_reel4(*this, "reel4"),
121         m_reel5(*this, "reel5"),
122         m_reel6(*this, "reel6"),
123         m_reel7(*this, "reel7"),
116124         m_palette(*this, "palette")
117125   {}
118126
r242422r242423
212220   void lamp_extend_large(int data,int column,int active);
213221   void led_write_latch(int latch, int data, int column);
214222   void update_meters();
215   void mpu4_stepper_reset();
216223   void ic23_update();
217224   void ic24_output(int data);
218225   void ic24_setup();
r242422r242423
242249   required_ioport m_aux2_port;
243250   optional_memory_bank m_bank1;
244251   optional_device<okim6376_device> m_msm6376;
252   required_device<stepper_device> m_reel0;
253   required_device<stepper_device> m_reel1;
254   required_device<stepper_device> m_reel2;
255   required_device<stepper_device> m_reel3;
256   required_device<stepper_device> m_reel4;
257   required_device<stepper_device> m_reel5;
258   required_device<stepper_device> m_reel6;
259   required_device<stepper_device> m_reel7;
245260
246261   enum
247262   {
r242422r242423
280295   UINT8 m_led_strobe;
281296   UINT8 m_ay_data;
282297   int m_optic_pattern;
298   DECLARE_WRITE_LINE_MEMBER(reel0_optic_cb) { if (state) m_optic_pattern |= 0x01; else m_optic_pattern &= ~0x01; }
299   DECLARE_WRITE_LINE_MEMBER(reel1_optic_cb) { if (state) m_optic_pattern |= 0x02; else m_optic_pattern &= ~0x02; }
300   DECLARE_WRITE_LINE_MEMBER(reel2_optic_cb) { if (state) m_optic_pattern |= 0x04; else m_optic_pattern &= ~0x04; }
301   DECLARE_WRITE_LINE_MEMBER(reel3_optic_cb) { if (state) m_optic_pattern |= 0x08; else m_optic_pattern &= ~0x08; }
302   DECLARE_WRITE_LINE_MEMBER(reel4_optic_cb) { if (state) m_optic_pattern |= 0x10; else m_optic_pattern &= ~0x10; }
303   DECLARE_WRITE_LINE_MEMBER(reel5_optic_cb) { if (state) m_optic_pattern |= 0x20; else m_optic_pattern &= ~0x20; }
304   DECLARE_WRITE_LINE_MEMBER(reel6_optic_cb) { if (state) m_optic_pattern |= 0x40; else m_optic_pattern &= ~0x40; }
305   DECLARE_WRITE_LINE_MEMBER(reel7_optic_cb) { if (state) m_optic_pattern |= 0x80; else m_optic_pattern &= ~0x80; }
283306   int m_active_reel;
284307   int m_remote_meter;
285308   int m_reel_mux;
trunk/src/mame/video/awpvid.c
r242422r242423
1818
1919static UINT16 reelpos[MAX_STEPPERS];
2020
21void awp_draw_reel(int rno)
21void awp_draw_reel(int rno, stepper_device &reel)
2222{
2323   int x = rno + 1;
2424   char rg[16];
2525
2626   sprintf(rg,"reel%d", x);
27   reelpos[rno] = stepper_get_position(rno);
27   reelpos[rno] = reel.get_position();
2828   if (reelpos[rno] == output_get_value(rg))
2929   {
3030      // Not moved, no need to update.
r242422r242423
3434      output_set_value(rg,(reelpos[rno]));
3535
3636      // if the reel isn't configured don't do this, otherwise you'll get DIV0
37      if (stepper_get_max(rno))
37      if (reel.get_max())
3838      {
3939         sprintf(rg,"sreel%d", x); // our new scrolling reels are called 'sreel'
4040         // normalize the value
41         int sreelpos = (reelpos[rno] * 0x10000) / stepper_get_max(rno);
41         int sreelpos = (reelpos[rno] * 0x10000) / reel.get_max();
4242
4343         output_set_value(rg,sreelpos);
4444      }
trunk/src/mame/video/awpvid.h
r242422r242423
66#ifndef AWP_VIDEO
77#define AWP_VIDEO
88
9void awp_draw_reel(int rno);
9#include "machine/steppers.h"
1010
11void awp_draw_reel(int rno, stepper_device &reel);
12
1113#endif


Previous 199869 Revisions Next


© 1997-2024 The MAME Team