Previous 15994 Revisions Next

r2957 Thursday 17th July, 2008 at 10:53:34 UTC by Nathan Woods
Updated to MAME 0.126u1 core; the file manager and (probably) the tape control
have some residual bugs; will address this soon
[docs]messnew.txt
[src/emu]cheat.c emu.mak inptport.c inptport.h input.c input.h mame.c mame.h render.c render.h romload.c romload.h ui.c ui.h uigfx.c uiinput.c* uiinput.h* uimenu.c uimenu.h video.c
[src/emu/cpu]cpu.mak drcfe.c
[src/emu/cpu/i386]i386.c
[src/emu/cpu/i960]i960.c
[src/emu/cpu/konami]konami.c
[src/emu/cpu/sh2]sh2.c sh2.h sh2comn.c sh2comn.h sh2drc.c* sh2fe.c*
[src/emu/cpu/sh4]sh4.c sh4dasm.c
[src/emu/debug]debugcmd.c debugcon.c debugcpu.c debugcpu.h debugvw.c express.c express.h
[src/emu/machine]eeprom.c eeprom.h pit8253.c
[src/lib]lib.mak
[src/lib/util]astring.c astring.h aviio.c unicode.h vbiparse.c* vbiparse.h*
[src/mame]mame.mak mamedriv.c tiny.c tiny.mak
[src/mame/drivers]aliens.c bbusters.c cabal.c cave.c champbas.c changela.c cps1.c cps3.c deco32.c dkong.c fcrash.c galastrm.c itech32.c legionna.c model2.c namcos12.c naomi.c pntnpuzl.c psikyo4.c psikyosh.c pushman.c royalmah.c sbowling.c sderby.c seattle.c segae.c segahang.c segaorun.c segas16a.c segas16b.c segas24.c segas32.c segaxbd.c segaybd.c seibuspi.c seicross.c sengokmj.c seta.c seta2.c sf.c shadfrce.c shisen.c shootout.c shuuz.c sidearms.c silkroad.c simpl156.c simpsons.c skykid.c skyraid.c slapfght.c slapshot.c snk.c snk68.c snookr10.c spdodgeb.c speedatk.c spiders.c sprint2.c sprint4.c sprint8.c srmp2.c srmp5.c srmp6.c ssfindo.c sshangha.c ssingles.c ssozumo.c ssrj.c ssv.c st0016.c stactics.c starfire.c starshp1.c starwars.c stfight.c stlforce.c stv.c stvinit.c subs.c suna8.c supbtime.c superchs.c superqix.c suprnova.c system16.c system18.c taito_b.c taito_f2.c taito_f3.c taito_l.c taito_z.c taitojc.c taitosj.c tankbatt.c tatsumi.c tceptor.c tehkanwc.c tempest.c tetrisp2.c thedeep.c thepit.c tickee.c tmnt.c tnzs.c toaplan1.c toaplan2.c toratora.c tourtabl.c toypop.c travrusa.c triplhnt.c truco.c tryout.c tugboat.c tumbleb.c tumblep.c turbo.c twin16.c tx1.c vegas.c
[src/mame/includes]slapfght.h system16.h
[src/mame/machine]gdcrypt.c* namcos1.c scramble.c seicop.c simpsons.c slapfght.c starwars.c stfight.c subs.c tait8741.c taitosj.c tatsumi.c tnzs.c toaplan1.c
[src/mame/video]champbas.c galaxian.c namcofl.c pushman.c rastan.c shisen.c snk68.c superqix.c taito_f3.c thepit.c travrusa.c
[src/mess]filemngr.c tapectrl.c uimess.c uimess.h
[src/mess/drivers]ip20.c x68k.c
[src/mess/osd/windows]menu.c
[src/osd/windows]debugwin.c input.c input.h video.c window.c window.h
[src/tools]makemeta.c romcmp.c

src/mame/machine/tnzs.c
r2956r2957
7777
7878   switch (tnzs_input_select & 0x0f)
7979   {
80      case 0x0a:   data = input_port_read_indexed(machine, 4); break;
81      case 0x0c:   data = input_port_read_indexed(machine, 2); break;
82      case 0x0d:   data = input_port_read_indexed(machine, 3); break;
80      case 0x0a:   data = input_port_read(machine, "IN2"); break;
81      case 0x0c:   data = input_port_read(machine, "IN0"); break;
82      case 0x0d:   data = input_port_read(machine, "IN1"); break;
8383      default:   data = 0xff; break;
8484   }
8585
r2956r2957
9090
9191READ8_HANDLER( tnzs_port2_r )
9292{
93   int data = input_port_read_indexed(machine, 4);
93   int data = input_port_read(machine, "IN2");
9494
9595//  logerror("I8742:%04x  Read %02x from port 2\n", activecpu_get_previouspc(), data);
9696
r2956r2957
117117
118118//  logerror("PC %04x: read input %04x\n", activecpu_get_pc(), 0xf000 + offset);
119119
120   val = input_port_read_indexed(machine, 7 + offset/2);
120   val = input_port_read_safe(machine, (offset/2) ? "AN2" : "AN1", 0);
121121   if (offset & 1)
122122   {
123123      return ((val >> 8) & 0xff);
r2956r2957
247247               }
248248               else return mcu_credits;
249249            }
250            else return input_port_read_indexed(machine, 2);   /* buttons */
250            else return input_port_read(machine, "IN0");   /* buttons */
251251
252252         default:
253253            logerror("error, unknown mcu command\n");
r2956r2957
338338      switch (mcu_command)
339339      {
340340         case 0x01:
341            return input_port_read_indexed(machine, 2) ^ 0xff;   /* player 1 joystick + buttons */
341            return input_port_read(machine, "IN0") ^ 0xff;   /* player 1 joystick + buttons */
342342
343343         case 0x02:
344            return input_port_read_indexed(machine, 3) ^ 0xff;   /* player 2 joystick + buttons */
344            return input_port_read(machine, "IN1") ^ 0xff;   /* player 2 joystick + buttons */
345345
346346         case 0x1a:
347            return (input_port_read_indexed(machine, 5) | (input_port_read_indexed(machine, 6) << 1));
347            return (input_port_read(machine, "COIN1") | (input_port_read(machine, "COIN2") << 1));
348348
349349         case 0x21:
350            return input_port_read_indexed(machine, 4) & 0x0f;
350            return input_port_read(machine, "IN2") & 0x0f;
351351
352352         case 0x41:
353353            return mcu_credits;
r2956r2957
375375               else return mcu_credits;
376376            }
377377            /* buttons */
378            else return ((input_port_read_indexed(machine, 2) & 0xf0) | (input_port_read_indexed(machine, 3) >> 4)) ^ 0xff;
378            else return ((input_port_read(machine, "IN0") & 0xf0) | (input_port_read(machine, "IN1") >> 4)) ^ 0xff;
379379
380380         default:
381381            logerror("error, unknown mcu command\n");
r2956r2957
660660      case MCU_DRTOPPEL:
661661      case MCU_PLUMPOP:
662662         coin  = 0;
663         coin |= ((input_port_read_indexed(machine, 5) & 1) << 0);
664         coin |= ((input_port_read_indexed(machine, 6) & 1) << 1);
665         coin |= ((input_port_read_indexed(machine, 4) & 3) << 2);
663         coin |= ((input_port_read(machine, "COIN1") & 1) << 0);
664         coin |= ((input_port_read(machine, "COIN2") & 1) << 1);
665         coin |= ((input_port_read(machine, "IN2") & 3) << 2);
666666         coin ^= 0x0c;
667667         mcu_handle_coins(coin);
668668         break;
src/mame/machine/slapfght.c
r2956r2957
2222
2323static UINT8 mcu_val;
2424
25
26/* used for MCU simulation of 'getstar' and its clones */
27static UINT8 getstar_cmd;
28/* copy of some Z80 registers for 'getstar' and its clones */
29static UINT8 gs_a, gs_d, gs_e;
30
31/* used for MCU simulation of 'tigerhb1' */
32static UINT8 tigerhb_cmd;
33
34
2535/* Perform basic machine initialisation */
2636MACHINE_RESET( slapfight )
2737{
r2956r2957
114124}
115125
116126
117
118/*
119 Reads at e803 expect a sequence of values such that:
120 - first value is different from successive
121 - third value is (first+5)^0x56
122 I don't know what writes to this address do (connected to port 0 reads?).
123*/
124127READ8_HANDLER( getstar_e803_r )
125128{
126   static const UINT8 seq[] = { 0, 1, ((0+5)^0x56) };
127UINT8 val;
129   UINT16 tmp = 0;  /* needed for values computed on 16 bits */
130   UINT8 getstar_val = 0;
131   UINT8 phase_lookup_table[] = {0x00, 0x01, 0x03, 0xff, 0xff, 0x02, 0x05, 0xff, 0xff, 0x05}; /* table at 0x0e05 in 'gtstarb1' */
132   UINT8 lives_lookup_table[] = {0x03, 0x05, 0x01, 0x02};                                     /* table at 0x0e62 in 'gtstarb1' */
133   UINT8 lgsb2_lookup_table[] = {0x00, 0x03, 0x04, 0x05};                                     /* fake tanle for "test mode" in 'gtstarb2' */
128134
129   val = seq[getstar_sequence_index];
130   getstar_sequence_index = (getstar_sequence_index+1)%3;
131   return val;
135   switch (getstar_id)
136   {
137      case GETSTAR:
138      case GETSTARJ:
139         switch (getstar_cmd)
140         {
141            case 0x20:  /* continue play */
142               getstar_val = ((gs_a & 0x30) == 0x30) ? 0x20 : 0x80;
143               break;
144            case 0x21:  /* lose life */
145               getstar_val = (gs_a << 1) | (gs_a >> 7);
146               break;
147            case 0x22:  /* starting difficulty */
148               getstar_val = ((gs_a & 0x0c) >> 2) + 1;
149               break;
150            case 0x23:  /* starting lives */
151               getstar_val = lives_lookup_table[gs_a];
152               break;
153            case 0x24:  /* game phase */
154               getstar_val = phase_lookup_table[((gs_a & 0x18) >> 1) | (gs_a & 0x03)];
155               break;
156            case 0x25:  /* players inputs */
157               getstar_val = BITSWAP8(gs_a, 3, 2, 1, 0, 7, 5, 6, 4);
158               break;
159            case 0x26:  /* background (1st read) */
160               tmp = 0x8800 + (0x001f * gs_a);
161               getstar_val = (tmp & 0x00ff) >> 0;
162               getstar_cmd |= 0x80;     /* to allow a second consecutive read */
163               break;
164            case 0xa6:  /* background (2nd read) */
165               tmp = 0x8800 + (0x001f * gs_a);
166               getstar_val = (tmp & 0xff00) >> 8;
167               break;
168            case 0x29:  /* unknown effect */
169               getstar_val = 0x00;
170               break;
171            case 0x2a:  /* change player (if 2 players game) */
172               getstar_val = (gs_a ^ 0x40);
173               break;
174            case 0x37:  /* foreground (1st read) */
175               tmp = ((0xd0 + ((gs_e >> 2) & 0x0f)) << 8) | (0x40 * (gs_e & 03) + gs_d);
176               getstar_val = (tmp & 0x00ff) >> 0;
177               getstar_cmd |= 0x80;     /* to allow a second consecutive read */
178               break;
179            case 0xb7:  /* foreground (2nd read) */
180               tmp = ((0xd0 + ((gs_e >> 2) & 0x0f)) << 8) | (0x40 * (gs_e & 03) + gs_d);
181               getstar_val = (tmp & 0xff00) >> 8;
182               break;
183            case 0x38:  /* laser position (1st read) */
184               tmp = 0xf740 - (((gs_e >> 4) << 8) | ((gs_e & 0x08) ? 0x80 : 0x00)) + (0x02 + (gs_d >> 2));
185               getstar_val = (tmp & 0x00ff) >> 0;
186               getstar_cmd |= 0x80;     /* to allow a second consecutive read */
187               break;
188            case 0xb8:  /* laser position (2nd read) */
189               tmp = 0xf740 - (((gs_e >> 4) << 8) | ((gs_e & 0x08) ? 0x80 : 0x00)) + (0x02 + (gs_d >> 2));
190               getstar_val = (tmp & 0xff00) >> 8;
191               break;
192            case 0x73:  /* avoid "BAD HW" message */
193               getstar_val = 0x76;
194               break;
195            default:
196               logerror("%04x: getstar_e803_r - cmd = %02x\n",activecpu_get_pc(),getstar_cmd);
197               break;
198         }
199         break;
200      case GTSTARB1:
201         /* value isn't computed by the bootleg but we want to please the "test mode" */
202         if (activecpu_get_pc() == 0x6b04) return (lives_lookup_table[gs_a]);
203         break;
204      case GTSTARB2:
205         /*
206            056B: 21 03 E8      ld   hl,$E803
207            056E: 7E            ld   a,(hl)
208            056F: BE            cp   (hl)
209            0570: 28 FD         jr   z,$056F
210            0572: C6 05         add  a,$05
211            0574: EE 56         xor  $56
212            0576: BE            cp   (hl)
213            0577: C2 6E 05      jp   nz,$056E
214            */
215         if (activecpu_get_pc() == 0x056e) return (getstar_val);
216         if (activecpu_get_pc() == 0x0570) return (getstar_val+1);
217         if (activecpu_get_pc() == 0x0577) return ((getstar_val+0x05) ^ 0x56);
218         /* value isn't computed by the bootleg but we want to please the "test mode" */
219         if (activecpu_get_pc() == 0x6b04) return (lgsb2_lookup_table[gs_a]);
220         break;
221      default:
222         logerror("%04x: getstar_e803_r - cmd = %02x - unknown set !\n",activecpu_get_pc(),getstar_cmd);
223         break;
224   }
225   return getstar_val;
132226}
133227
228WRITE8_HANDLER( getstar_e803_w )
229{
230   switch (getstar_id)
231   {
232      case GETSTAR:
233         /* unknown effect - not read back */
234         if (activecpu_get_pc() == 0x00bf)
235         {
236            getstar_cmd = 0x00;
237            GS_RESET_REGS
238         }
239         /* players inputs */
240         if (activecpu_get_pc() == 0x0560)
241         {
242            getstar_cmd = 0x25;
243            GS_RESET_REGS
244         }
245         if (activecpu_get_pc() == 0x056d)
246         {
247            getstar_cmd = 0x25;
248            GS_SAVE_REGS
249         }
250         /* lose life */
251         if (activecpu_get_pc() == 0x0a0a)
252         {
253            getstar_cmd = 0x21;
254            GS_RESET_REGS
255         }
256         if (activecpu_get_pc() == 0x0a17)
257         {
258            getstar_cmd = 0x21;
259            GS_SAVE_REGS
260         }
261         /* unknown effect */
262         if (activecpu_get_pc() == 0x0a51)
263         {
264            getstar_cmd = 0x29;
265            GS_RESET_REGS
266         }
267         if (activecpu_get_pc() == 0x0a6e)
268         {
269            getstar_cmd = 0x29;
270            GS_SAVE_REGS
271         }
272         /* continue play */
273         if (activecpu_get_pc() == 0x0ae3)
274         {
275            getstar_cmd = 0x20;
276            GS_RESET_REGS
277         }
278         if (activecpu_get_pc() == 0x0af0)
279         {
280            getstar_cmd = 0x20;
281            GS_SAVE_REGS
282         }
283         /* unknown effect - not read back */
284         if (activecpu_get_pc() == 0x0b62)
285         {
286            getstar_cmd = 0x00;     /* 0x1f */
287            GS_RESET_REGS
288         }
289         /* change player (if 2 players game) */
290         if (activecpu_get_pc() == 0x0bab)
291         {
292            getstar_cmd = 0x2a;
293            GS_RESET_REGS
294         }
295         if (activecpu_get_pc() == 0x0bb8)
296         {
297            getstar_cmd = 0x2a;
298            GS_SAVE_REGS
299         }
300         /* game phase */
301         if (activecpu_get_pc() == 0x0d37)
302         {
303            getstar_cmd = 0x24;
304            GS_RESET_REGS
305         }
306         if (activecpu_get_pc() == 0x0d44)
307         {
308            getstar_cmd = 0x24;
309            GS_SAVE_REGS
310         }
311         /* starting lives */
312         if (activecpu_get_pc() == 0x0d79)
313         {
314            getstar_cmd = 0x23;
315            GS_RESET_REGS
316         }
317         if (activecpu_get_pc() == 0x0d8a)
318         {
319            getstar_cmd = 0x23;
320            GS_SAVE_REGS
321         }
322         /* starting difficulty */
323         if (activecpu_get_pc() == 0x0dc1)
324         {
325            getstar_cmd = 0x22;
326            GS_RESET_REGS
327         }
328         if (activecpu_get_pc() == 0x0dd0)
329         {
330            getstar_cmd = 0x22;
331            GS_SAVE_REGS
332         }
333         /* starting lives (again) */
334         if (activecpu_get_pc() == 0x1011)
335         {
336            getstar_cmd = 0x23;
337            GS_RESET_REGS
338         }
339         if (activecpu_get_pc() == 0x101e)
340         {
341            getstar_cmd = 0x23;
342            GS_SAVE_REGS
343         }
344         /* hardware test */
345         if (activecpu_get_pc() == 0x107a)
346         {
347            getstar_cmd = 0x73;
348            GS_RESET_REGS
349         }
350         /* game phase (again) */
351         if (activecpu_get_pc() == 0x10c6)
352         {
353            getstar_cmd = 0x24;
354            GS_RESET_REGS
355         }
356         if (activecpu_get_pc() == 0x10d3)
357         {
358            getstar_cmd = 0x24;
359            GS_SAVE_REGS
360         }
361         /* background */
362         if (activecpu_get_pc() == 0x1910)
363         {
364            getstar_cmd = 0x26;
365            GS_RESET_REGS
366         }
367         if (activecpu_get_pc() == 0x191d)
368         {
369            getstar_cmd = 0x26;
370            GS_SAVE_REGS
371         }
372         /* foreground */
373         if (activecpu_get_pc() == 0x19d5)
374         {
375            getstar_cmd = 0x37;
376            GS_RESET_REGS
377         }
378         if (activecpu_get_pc() == 0x19e4)
379         {
380            getstar_cmd = 0x37;
381            GS_SAVE_REGS
382         }
383         if (activecpu_get_pc() == 0x19f1)
384         {
385            getstar_cmd = 0x37;
386            /* do NOT update the registers because there are 2 writes before 2 reads ! */
387         }
388         /* laser position */
389         if (activecpu_get_pc() == 0x26af)
390         {
391            getstar_cmd = 0x38;
392            GS_RESET_REGS
393         }
394         if (activecpu_get_pc() == 0x26be)
395         {
396            getstar_cmd = 0x38;
397            GS_SAVE_REGS
398         }
399         if (activecpu_get_pc() == 0x26cb)
400         {
401            getstar_cmd = 0x38;
402            /* do NOT update the registers because there are 2 writes before 2 reads ! */
403         }
404         /* starting lives (for "test mode") */
405         if (activecpu_get_pc() == 0x6a27)
406         {
407            getstar_cmd = 0x23;
408            GS_RESET_REGS
409         }
410         if (activecpu_get_pc() == 0x6a38)
411         {
412            getstar_cmd = 0x23;
413            GS_SAVE_REGS
414         }
415         break;
416      case GETSTARJ:
417         /* unknown effect - not read back */
418         if (activecpu_get_pc() == 0x00bf)
419         {
420            getstar_cmd = 0x00;
421            GS_RESET_REGS
422         }
423         /* players inputs */
424         if (activecpu_get_pc() == 0x0560)
425         {
426            getstar_cmd = 0x25;
427            GS_RESET_REGS
428         }
429         if (activecpu_get_pc() == 0x056d)
430         {
431            getstar_cmd = 0x25;
432            GS_SAVE_REGS
433         }
434         /* lose life */
435         if (activecpu_get_pc() == 0x0ad5)
436         {
437            getstar_cmd = 0x21;
438            GS_RESET_REGS
439         }
440         if (activecpu_get_pc() == 0x0ae2)
441         {
442            getstar_cmd = 0x21;
443            GS_SAVE_REGS
444         }
445         /* unknown effect */
446         if (activecpu_get_pc() == 0x0b1c)
447         {
448            getstar_cmd = 0x29;
449            GS_RESET_REGS
450         }
451         if (activecpu_get_pc() == 0x0b29)
452         {
453            getstar_cmd = 0x29;
454            GS_SAVE_REGS
455         }
456         /* continue play */
457         if (activecpu_get_pc() == 0x0bae)
458         {
459            getstar_cmd = 0x20;
460            GS_RESET_REGS
461         }
462         if (activecpu_get_pc() == 0x0bbb)
463         {
464            getstar_cmd = 0x20;
465            GS_SAVE_REGS
466         }
467         /* unknown effect - not read back */
468         if (activecpu_get_pc() == 0x0c2d)
469         {
470            getstar_cmd = 0x00;     /* 0x1f */
471            GS_RESET_REGS
472         }
473         /* change player (if 2 players game) */
474         if (activecpu_get_pc() == 0x0c76)
475         {
476            getstar_cmd = 0x2a;
477            GS_RESET_REGS
478         }
479         if (activecpu_get_pc() == 0x0c83)
480         {
481            getstar_cmd = 0x2a;
482            GS_SAVE_REGS
483         }
484         /* game phase */
485         if (activecpu_get_pc() == 0x0e02)
486         {
487            getstar_cmd = 0x24;
488            GS_RESET_REGS
489         }
490         if (activecpu_get_pc() == 0x0e0f)
491         {
492            getstar_cmd = 0x24;
493            GS_SAVE_REGS
494         }
495         /* starting lives */
496         if (activecpu_get_pc() == 0x0e44)
497         {
498            getstar_cmd = 0x23;
499            GS_RESET_REGS
500         }
501         if (activecpu_get_pc() == 0x0e55)
502         {
503            getstar_cmd = 0x23;
504            GS_SAVE_REGS
505         }
506         /* starting difficulty */
507         if (activecpu_get_pc() == 0x0e8c)
508         {
509            getstar_cmd = 0x22;
510            GS_RESET_REGS
511         }
512         if (activecpu_get_pc() == 0x0e9b)
513         {
514            getstar_cmd = 0x22;
515            GS_SAVE_REGS
516         }
517         /* starting lives (again) */
518         if (activecpu_get_pc() == 0x10d6)
519         {
520            getstar_cmd = 0x23;
521            GS_RESET_REGS
522         }
523         if (activecpu_get_pc() == 0x10e3)
524         {
525            getstar_cmd = 0x23;
526            GS_SAVE_REGS
527         }
528         /* hardware test */
529         if (activecpu_get_pc() == 0x113f)
530         {
531            getstar_cmd = 0x73;
532            GS_RESET_REGS
533         }
534         /* game phase (again) */
535         if (activecpu_get_pc() == 0x118b)
536         {
537            getstar_cmd = 0x24;
538            GS_RESET_REGS
539         }
540         if (activecpu_get_pc() == 0x1198)
541         {
542            getstar_cmd = 0x24;
543            GS_SAVE_REGS
544         }
545         /* background */
546         if (activecpu_get_pc() == 0x19f8)
547         {
548            getstar_cmd = 0x26;
549            GS_RESET_REGS
550         }
551         if (activecpu_get_pc() == 0x1a05)
552         {
553            getstar_cmd = 0x26;
554            GS_SAVE_REGS
555         }
556         /* foreground */
557         if (activecpu_get_pc() == 0x1abd)
558         {
559            getstar_cmd = 0x37;
560            GS_RESET_REGS
561         }
562         if (activecpu_get_pc() == 0x1acc)
563         {
564            getstar_cmd = 0x37;
565            GS_SAVE_REGS
566         }
567         if (activecpu_get_pc() == 0x1ad9)
568         {
569            getstar_cmd = 0x37;
570            /* do NOT update the registers because there are 2 writes before 2 reads ! */
571         }
572         /* laser position */
573         if (activecpu_get_pc() == 0x2792)
574         {
575            getstar_cmd = 0x38;
576            GS_RESET_REGS
577         }
578         if (activecpu_get_pc() == 0x27a1)
579         {
580            getstar_cmd = 0x38;
581            GS_SAVE_REGS
582         }
583         if (activecpu_get_pc() == 0x27ae)
584         {
585            getstar_cmd = 0x38;
586            /* do NOT update the registers because there are 2 writes before 2 reads ! */
587         }
588         /* starting lives (for "test mode") */
589         if (activecpu_get_pc() == 0x6ae2)
590         {
591            getstar_cmd = 0x23;
592            GS_RESET_REGS
593         }
594         if (activecpu_get_pc() == 0x6af3)
595         {
596            getstar_cmd = 0x23;
597            GS_SAVE_REGS
598         }
599         break;
600      case GTSTARB1:
601         /* "Test mode" doesn't compute the lives value :
602                6ADA: 3E 23         ld   a,$23
603                6ADC: CD 52 11      call $1152
604                6ADF: 32 03 E8      ld   ($E803),a
605                6AE2: DB 00         in   a,($00)
606                6AE4: CB 4F         bit  1,a
607                6AE6: 28 FA         jr   z,$6AE2
608                6AE8: 3A 0A C8      ld   a,($C80A)
609                6AEB: E6 03         and  $03
610                6AED: CD 52 11      call $1152
611                6AF0: 32 03 E8      ld   ($E803),a
612                6AF3: DB 00         in   a,($00)
613                6AF5: CB 57         bit  2,a
614                6AF7: 20 FA         jr   nz,$6AF3
615                6AF9: 00            nop
616                6AFA: 00            nop
617                6AFB: 00            nop
618                6AFC: 00            nop
619                6AFD: 00            nop
620                6AFE: 00            nop
621                6AFF: 00            nop
622                6B00: 00            nop
623                6B01: 3A 03 E8      ld   a,($E803)
624               We save the regs though to hack it in 'getstar_e803_r' read handler.
625            */
626         if (activecpu_get_pc() == 0x6ae2)
627         {
628            getstar_cmd = 0x00;
629            GS_RESET_REGS
630         }
631         if (activecpu_get_pc() == 0x6af3)
632         {
633            getstar_cmd = 0x00;
634            GS_SAVE_REGS
635         }
636         break;
637      case GTSTARB2:
638         /* "Test mode" doesn't compute the lives value :
639                6ADA: 3E 23         ld   a,$23
640                6ADC: CD 52 11      call $1152
641                6ADF: 32 03 E8      ld   ($E803),a
642                6AE2: DB 00         in   a,($00)
643                6AE4: CB 4F         bit  1,a
644                6AE6: 00            nop
645                6AE7: 00            nop
646                6AE8: 3A 0A C8      ld   a,($C80A)
647                6AEB: E6 03         and  $03
648                6AED: CD 52 11      call $1152
649                6AF0: 32 03 E8      ld   ($E803),a
650                6AF3: DB 00         in   a,($00)
651                6AF5: CB 57         bit  2,a
652                6AF7: 00            nop
653                6AF8: 00            nop
654                6AF9: 00            nop
655                6AFA: 00            nop
656                6AFB: 00            nop
657                6AFC: 00            nop
658                6AFD: 00            nop
659                6AFE: 00            nop
660                6AFF: 00            nop
661                6B00: 00            nop
662                6B01: 3A 03 E8      ld   a,($E803)
663               We save the regs though to hack it in 'getstar_e803_r' read handler.
664            */
665         if (activecpu_get_pc() == 0x6ae2)
666         {
667            getstar_cmd = 0x00;
668            GS_RESET_REGS
669         }
670         if (activecpu_get_pc() == 0x6af3)
671         {
672            getstar_cmd = 0x00;
673            GS_SAVE_REGS
674         }
675         break;
676      default:
677         logerror("%04x: getstar_e803_w - data = %02x - unknown set !\n",activecpu_get_pc(),data);
678         break;
679   }
680}
681
134682/* Enable hardware interrupt of sound cpu */
135683WRITE8_HANDLER( getstar_sh_intenable_w )
136684{
r2956r2957
249797   return res;
250798}
251799
800
801READ8_HANDLER( tigerhb_e803_r )
802{
803   UINT8 tigerhb_val = 0;
804   switch (tigerhb_cmd)
805   {
806      case 0x73:  /* avoid "BAD HW" message */
807         tigerhb_val = 0x83;
808         break;
809      default:
810         logerror("%04x: tigerhb_e803_r - cmd = %02x\n",activecpu_get_pc(),getstar_cmd);
811         break;
812   }
813   return tigerhb_val;
814}
815
816WRITE8_HANDLER( tigerhb_e803_w )
817{
818   switch (data)
819   {
820      /* hardware test */
821      case 0x73:
822         tigerhb_cmd = 0x73;
823         break;
824      default:
825         logerror("%04x: tigerhb_e803_w - data = %02x\n",activecpu_get_pc(),data);
826         tigerhb_cmd = 0x00;
827         break;
828   }
829}
src/mame/machine/toaplan1.c
r2956r2957
159159{
160160   /* Bit 0x80 is secondary CPU (HD647180) ready signal */
161161   logerror("PC:%04x Warning !!! IO reading from $14000a\n",activecpu_get_previouspc());
162   return (0x80 | input_port_read_indexed(machine,6)) & 0xff;
162   return (0x80 | input_port_read(machine, "TJUMP")) & 0xff;
163163}
164164
165165READ16_HANDLER( vimana_input_port_5_word_r )
166166{
167167   int data, p;
168168
169   p = input_port_read_indexed(machine,5);
169   p = input_port_read(machine, "SYSTEM");
170170   vimana_latch ^= p;
171171   data = (vimana_latch & p );
172172
src/mame/machine/scramble.c
r2956r2957
6565
6666static READ8_HANDLER( ckongs_input_port_1_r )
6767{
68   return (input_port_read_indexed(machine, 1) & 0xfc) | ((input_port_read_indexed(machine, 2) & 0x06) >> 1);
68   return (input_port_read(machine, "IN1") & 0xfc) | ((input_port_read(machine, "IN2") & 0x06) >> 1);
6969}
7070
7171static READ8_HANDLER( ckongs_input_port_2_r )
7272{
73   return (input_port_read_indexed(machine, 2) & 0xf9) | ((input_port_read_indexed(machine, 1) & 0x03) << 1);
73   return (input_port_read(machine, "IN2") & 0xf9) | ((input_port_read(machine, "IN1") & 0x03) << 1);
7474}
7575
7676
7777/* the coinage DIPs are spread accross two input ports */
7878static READ8_HANDLER( stratgyx_input_port_2_r )
7979{
80   return (input_port_read_indexed(machine, 2) & ~0x06) | ((input_port_read_indexed(machine, 4) << 1) & 0x06);
80   return (input_port_read(machine, "IN2") & ~0x06) | ((input_port_read(machine, "IN4") << 1) & 0x06);
8181}
8282
8383static READ8_HANDLER( stratgyx_input_port_3_r )
8484{
85   return (input_port_read_indexed(machine, 3) & ~0x03) | ((input_port_read_indexed(machine, 4) >> 2) & 0x03);
85   return (input_port_read(machine, "IN3") & ~0x03) | ((input_port_read(machine, "IN4") >> 2) & 0x03);
8686}
8787
8888
r2956r2957
9898                       0x27, 0x26, 0x24, 0x25, 0x05, 0x04, 0x06, 0x07 };
9999   UINT8 val;
100100
101   val = input_port_read_indexed(machine, 1);
101   val = input_port_read(machine, "IN1");
102102
103103   return ((val & 0x03) | (remap[val >> 2] << 2));
104104}
src/mame/machine/namcos1.c
r2956r2957
14541454            case 0:
14551455               stored_input[0] = input_port_read(machine, "IN0") & 0x1f;
14561456               stored_input[1] = (input_port_read(machine, "IN3") & 0x07) << 3;
1457               break;
14571458
14581459            case 3:
14591460               stored_input[0] = input_port_read(machine, "IN2") & 0x1f;
1461               break;
14601462
14611463            case 4:
14621464               stored_input[0] = input_port_read(machine, "IN1") & 0x1f;
14631465               stored_input[1] = input_port_read(machine, "IN3") & 0x18;
1466               break;
1467
1468            default:
1469               stored_input[0] = 0x1f;
1470               stored_input[1] = 0x1f;
1471               break;
14641472         }
14651473
14661474         input_count = (input_count + 1) & 7;
src/mame/machine/stfight.c
r2956r2957
119119// Perhaps define dipswitches as active low?
120120READ8_HANDLER( stfight_dsw_r )
121121{
122    return( ~input_port_read_indexed(machine, 3+offset ) );
122    return( ~input_port_read(machine, offset ? "DSW1" : "DSW0") );
123123}
124124
125125static int stfight_coin_mech_query_active = 0;
r2956r2957
146146     *        since it's read by the 30Hz interrupt ISR
147147     */
148148
149    coin_mech_data = input_port_read_indexed(machine, 5 );
149    coin_mech_data = input_port_read(machine, "COIN");
150150
151151    for( i=0; i<2; i++ )
152152    {
src/mame/machine/tait8741.c
r2956r2957
469469         break;
470470      case 2:
471471#if 1
472         mcu->rxd = input_port_read_indexed(machine, 4);  /* DSW2 */
472         mcu->rxd = input_port_read(machine, "DSW2");
473473         mcu->sts |= 0x01; /* RD ready */
474474#endif
475475         break;
src/mame/machine/taitosj.c
r2956r2957
316316
317317READ8_HANDLER( alpine_port_2_r )
318318{
319   return input_port_read_indexed(machine,2) | protection_value;
319   return input_port_read(machine, "IN2") | protection_value;
320320}
src/mame/machine/tatsumi.c
r2956r2957
131131READ8_HANDLER( apache3_adc_r )
132132{
133133   if (apache3_adc==0)
134      return input_port_read_indexed(machine, 1);
135   return input_port_read_indexed(machine, 2);
134      return input_port_read(machine, "STICKX");
135   return input_port_read(machine, "STICKY");
136136}
137137
138138WRITE8_HANDLER( apache3_adc_w )
src/mame/machine/gdcrypt.c
r0r2957
1
2/* DES decryption, used by GD-ROM based titles (Naomi etc.) */
3
4#include "driver.h"
5
6static UINT32 des_subkeys[32];
7
8static const UINT32 DES_LEFTSWAP[] =
9{
10  0x00000000, 0x00000001, 0x00000100, 0x00000101, 0x00010000, 0x00010001, 0x00010100, 0x00010101,
11  0x01000000, 0x01000001, 0x01000100, 0x01000101, 0x01010000, 0x01010001, 0x01010100, 0x01010101
12};
13
14static const UINT32 DES_RIGHTSWAP[] =
15{
16  0x00000000, 0x01000000, 0x00010000, 0x01010000, 0x00000100, 0x01000100, 0x00010100, 0x01010100,
17  0x00000001, 0x01000001, 0x00010001, 0x01010001, 0x00000101, 0x01000101, 0x00010101, 0x01010101,
18};
19
20static const UINT32 DES_SBOX1[] =
21{
22  0x00808200, 0x00000000, 0x00008000, 0x00808202, 0x00808002, 0x00008202, 0x00000002, 0x00008000,
23  0x00000200, 0x00808200, 0x00808202, 0x00000200, 0x00800202, 0x00808002, 0x00800000, 0x00000002,
24  0x00000202, 0x00800200, 0x00800200, 0x00008200, 0x00008200, 0x00808000, 0x00808000, 0x00800202,
25  0x00008002, 0x00800002, 0x00800002, 0x00008002, 0x00000000, 0x00000202, 0x00008202, 0x00800000,
26  0x00008000, 0x00808202, 0x00000002, 0x00808000, 0x00808200, 0x00800000, 0x00800000, 0x00000200,
27  0x00808002, 0x00008000, 0x00008200, 0x00800002, 0x00000200, 0x00000002, 0x00800202, 0x00008202,
28  0x00808202, 0x00008002, 0x00808000, 0x00800202, 0x00800002, 0x00000202, 0x00008202, 0x00808200,
29  0x00000202, 0x00800200, 0x00800200, 0x00000000, 0x00008002, 0x00008200, 0x00000000, 0x00808002
30};
31
32static const UINT32 DES_SBOX2[] =
33{
34  0x40084010, 0x40004000, 0x00004000, 0x00084010, 0x00080000, 0x00000010, 0x40080010, 0x40004010,
35  0x40000010, 0x40084010, 0x40084000, 0x40000000, 0x40004000, 0x00080000, 0x00000010, 0x40080010,
36  0x00084000, 0x00080010, 0x40004010, 0x00000000, 0x40000000, 0x00004000, 0x00084010, 0x40080000,
37  0x00080010, 0x40000010, 0x00000000, 0x00084000, 0x00004010, 0x40084000, 0x40080000, 0x00004010,
38  0x00000000, 0x00084010, 0x40080010, 0x00080000, 0x40004010, 0x40080000, 0x40084000, 0x00004000,
39  0x40080000, 0x40004000, 0x00000010, 0x40084010, 0x00084010, 0x00000010, 0x00004000, 0x40000000,
40  0x00004010, 0x40084000, 0x00080000, 0x40000010, 0x00080010, 0x40004010, 0x40000010, 0x00080010,
41  0x00084000, 0x00000000, 0x40004000, 0x00004010, 0x40000000, 0x40080010, 0x40084010, 0x00084000
42};
43
44static const UINT32 DES_SBOX3[] =
45{
46  0x00000104, 0x04010100, 0x00000000, 0x04010004, 0x04000100, 0x00000000, 0x00010104, 0x04000100,
47  0x00010004, 0x04000004, 0x04000004, 0x00010000, 0x04010104, 0x00010004, 0x04010000, 0x00000104,
48  0x04000000, 0x00000004, 0x04010100, 0x00000100, 0x00010100, 0x04010000, 0x04010004, 0x00010104,
49  0x04000104, 0x00010100, 0x00010000, 0x04000104, 0x00000004, 0x04010104, 0x00000100, 0x04000000,
50  0x04010100, 0x04000000, 0x00010004, 0x00000104, 0x00010000, 0x04010100, 0x04000100, 0x00000000,
51  0x00000100, 0x00010004, 0x04010104, 0x04000100, 0x04000004, 0x00000100, 0x00000000, 0x04010004,
52  0x04000104, 0x00010000, 0x04000000, 0x04010104, 0x00000004, 0x00010104, 0x00010100, 0x04000004,
53  0x04010000, 0x04000104, 0x00000104, 0x04010000, 0x00010104, 0x00000004, 0x04010004, 0x00010100
54};
55
56static const UINT32 DES_SBOX4[] =
57{
58  0x80401000, 0x80001040, 0x80001040, 0x00000040, 0x00401040, 0x80400040, 0x80400000, 0x80001000,
59  0x00000000, 0x00401000, 0x00401000, 0x80401040, 0x80000040, 0x00000000, 0x00400040, 0x80400000,
60  0x80000000, 0x00001000, 0x00400000, 0x80401000, 0x00000040, 0x00400000, 0x80001000, 0x00001040,
61  0x80400040, 0x80000000, 0x00001040, 0x00400040, 0x00001000, 0x00401040, 0x80401040, 0x80000040,
62  0x00400040, 0x80400000, 0x00401000, 0x80401040, 0x80000040, 0x00000000, 0x00000000, 0x00401000,
63  0x00001040, 0x00400040, 0x80400040, 0x80000000, 0x80401000, 0x80001040, 0x80001040, 0x00000040,
64  0x80401040, 0x80000040, 0x80000000, 0x00001000, 0x80400000, 0x80001000, 0x00401040, 0x80400040,
65  0x80001000, 0x00001040, 0x00400000, 0x80401000, 0x00000040, 0x00400000, 0x00001000, 0x00401040
66};
67
68static const UINT32 DES_SBOX5[] =
69{
70  0x00000080, 0x01040080, 0x01040000, 0x21000080, 0x00040000, 0x00000080, 0x20000000, 0x01040000,
71  0x20040080, 0x00040000, 0x01000080, 0x20040080, 0x21000080, 0x21040000, 0x00040080, 0x20000000,
72  0x01000000, 0x20040000, 0x20040000, 0x00000000, 0x20000080, 0x21040080, 0x21040080, 0x01000080,
73  0x21040000, 0x20000080, 0x00000000, 0x21000000, 0x01040080, 0x01000000, 0x21000000, 0x00040080,
74  0x00040000, 0x21000080, 0x00000080, 0x01000000, 0x20000000, 0x01040000, 0x21000080, 0x20040080,
75  0x01000080, 0x20000000, 0x21040000, 0x01040080, 0x20040080, 0x00000080, 0x01000000, 0x21040000,
76  0x21040080, 0x00040080, 0x21000000, 0x21040080, 0x01040000, 0x00000000, 0x20040000, 0x21000000,
77  0x00040080, 0x01000080, 0x20000080, 0x00040000, 0x00000000, 0x20040000, 0x01040080, 0x20000080
78};
79
80static const UINT32 DES_SBOX6[] =
81{
82  0x10000008, 0x10200000, 0x00002000, 0x10202008, 0x10200000, 0x00000008, 0x10202008, 0x00200000,
83  0x10002000, 0x00202008, 0x00200000, 0x10000008, 0x00200008, 0x10002000, 0x10000000, 0x00002008,
84  0x00000000, 0x00200008, 0x10002008, 0x00002000, 0x00202000, 0x10002008, 0x00000008, 0x10200008,
85  0x10200008, 0x00000000, 0x00202008, 0x10202000, 0x00002008, 0x00202000, 0x10202000, 0x10000000,
86  0x10002000, 0x00000008, 0x10200008, 0x00202000, 0x10202008, 0x00200000, 0x00002008, 0x10000008,
87  0x00200000, 0x10002000, 0x10000000, 0x00002008, 0x10000008, 0x10202008, 0x00202000, 0x10200000,
88  0x00202008, 0x10202000, 0x00000000, 0x10200008, 0x00000008, 0x00002000, 0x10200000, 0x00202008,
89  0x00002000, 0x00200008, 0x10002008, 0x00000000, 0x10202000, 0x10000000, 0x00200008, 0x10002008
90};
91
92static const UINT32 DES_SBOX7[] =
93{
94  0x00100000, 0x02100001, 0x02000401, 0x00000000, 0x00000400, 0x02000401, 0x00100401, 0x02100400,
95  0x02100401, 0x00100000, 0x00000000, 0x02000001, 0x00000001, 0x02000000, 0x02100001, 0x00000401,
96  0x02000400, 0x00100401, 0x00100001, 0x02000400, 0x02000001, 0x02100000, 0x02100400, 0x00100001,
97  0x02100000, 0x00000400, 0x00000401, 0x02100401, 0x00100400, 0x00000001, 0x02000000, 0x00100400,
98  0x02000000, 0x00100400, 0x00100000, 0x02000401, 0x02000401, 0x02100001, 0x02100001, 0x00000001,
99  0x00100001, 0x02000000, 0x02000400, 0x00100000, 0x02100400, 0x00000401, 0x00100401, 0x02100400,
100  0x00000401, 0x02000001, 0x02100401, 0x02100000, 0x00100400, 0x00000000, 0x00000001, 0x02100401,
101  0x00000000, 0x00100401, 0x02100000, 0x00000400, 0x02000001, 0x02000400, 0x00000400, 0x00100001
102};
103
104static const UINT32 DES_SBOX8[] =
105{
106  0x08000820, 0x00000800, 0x00020000, 0x08020820, 0x08000000, 0x08000820, 0x00000020, 0x08000000,
107  0x00020020, 0x08020000, 0x08020820, 0x00020800, 0x08020800, 0x00020820, 0x00000800, 0x00000020,
108  0x08020000, 0x08000020, 0x08000800, 0x00000820, 0x00020800, 0x00020020, 0x08020020, 0x08020800,
109  0x00000820, 0x00000000, 0x00000000, 0x08020020, 0x08000020, 0x08000800, 0x00020820, 0x00020000,
110  0x00020820, 0x00020000, 0x08020800, 0x00000800, 0x00000020, 0x08020020, 0x00000800, 0x00020820,
111  0x08000800, 0x00000020, 0x08000020, 0x08020000, 0x08020020, 0x08000000, 0x00020000, 0x08000820,
112  0x00000000, 0x08020820, 0x00020020, 0x08000020, 0x08020000, 0x08000800, 0x08000820, 0x00000000,
113  0x08020820, 0x00020800, 0x00020800, 0x00000820, 0x00000820, 0x00020020, 0x08000000, 0x08020800
114};
115
116static const UINT32 DES_MASK_TABLE[] =
117{
118   0x24000000, 0x10000000, 0x08000000, 0x02080000, 0x01000000,
119   0x00200000, 0x00100000, 0x00040000, 0x00020000, 0x00010000,
120   0x00002000, 0x00001000, 0x00000800, 0x00000400, 0x00000200,
121   0x00000100, 0x00000020, 0x00000010, 0x00000008, 0x00000004,
122   0x00000002, 0x00000001, 0x20000000, 0x10000000, 0x08000000,
123   0x04000000, 0x02000000, 0x01000000, 0x00200000, 0x00100000,
124   0x00080000, 0x00040000, 0x00020000, 0x00010000, 0x00002000,
125   0x00001000, 0x00000808, 0x00000400, 0x00000200, 0x00000100,
126   0x00000020, 0x00000011, 0x00000004, 0x00000002
127};
128
129static const UINT8 DES_ROTATE_TABLE[16] =
130{
131  1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1
132};
133
134
135INLINE void permutate(UINT32*a, UINT32*b, UINT32 m, int shift)
136{
137   UINT32 temp;
138    temp = ((*a>>shift) ^ *b) & m;
139    *a ^= temp<<shift;
140    *b ^= temp;
141}
142
143
144static void des_generate_subkeys(const UINT64 key, UINT32 *subkeys)
145{
146   UINT32 l, r;
147   int round;
148
149   l  = (key & 0xffffffff00000000ULL)>>32;
150   r = (key & 0x00000000ffffffffULL)>>0;;
151
152   permutate(&r, &l, 0x0f0f0f0f, 4);
153   permutate(&r, &l, 0x10101010, 0);
154
155   l  = (DES_LEFTSWAP[(l >> 0)  & 0xf] << 3) |
156           (DES_LEFTSWAP[(l >> 8)  & 0xf] << 2) |
157            (DES_LEFTSWAP[(l >> 16) & 0xf] << 1) |
158           (DES_LEFTSWAP[(l >> 24) & 0xf] << 0) |
159           (DES_LEFTSWAP[(l >> 5)  & 0xf] << 7) |
160           (DES_LEFTSWAP[(l >> 13) & 0xf] << 6) |
161           (DES_LEFTSWAP[(l >> 21) & 0xf] << 5) |
162           (DES_LEFTSWAP[(l >> 29) & 0xf] << 4);
163
164   r = (DES_RIGHTSWAP[(r >> 1)  & 0xf] << 3) |
165           (DES_RIGHTSWAP[(r >> 9)  & 0xf] << 2) |
166          (DES_RIGHTSWAP[(r >> 17) & 0xf] << 1) |
167          (DES_RIGHTSWAP[(r >> 25) & 0xf] << 0) |
168          (DES_RIGHTSWAP[(r >> 4)  & 0xf] << 7) |
169          (DES_RIGHTSWAP[(r >> 12) & 0xf] << 6) |
170          (DES_RIGHTSWAP[(r >> 20) & 0xf] << 5) |
171          (DES_RIGHTSWAP[(r >> 28) & 0xf] << 4);
172
173     l &= 0x0fffffff;
174   r &= 0x0fffffff;
175
176
177   for (round = 0; round < 16; round++)
178   {
179      l = ((l << DES_ROTATE_TABLE[round]) | (l >> (28 - DES_ROTATE_TABLE[round]))) & 0x0fffffff;
180      r = ((r << DES_ROTATE_TABLE[round]) | (r >> (28 - DES_ROTATE_TABLE[round]))) & 0x0fffffff;
181
182      subkeys[round*2] =
183         ((l << 4)  & DES_MASK_TABLE[0]) |
184          ((l << 28) & DES_MASK_TABLE[1]) |
185          ((l << 14) & DES_MASK_TABLE[2]) |
186          ((l << 18) & DES_MASK_TABLE[3]) |
187          ((l << 6)  & DES_MASK_TABLE[4]) |
188          ((l << 9)  & DES_MASK_TABLE[5]) |
189          ((l >> 1)  & DES_MASK_TABLE[6]) |
190          ((l << 10) & DES_MASK_TABLE[7]) |
191          ((l << 2)  & DES_MASK_TABLE[8]) |
192          ((l >> 10) & DES_MASK_TABLE[9]) |
193          ((r >> 13) & DES_MASK_TABLE[10])|
194          ((r >> 4)  & DES_MASK_TABLE[11])|
195          ((r << 6)  & DES_MASK_TABLE[12])|
196          ((r >> 1)  & DES_MASK_TABLE[13])|
197          ((r >> 14) & DES_MASK_TABLE[14])|
198          ((r >> 0)  & DES_MASK_TABLE[15])|
199          ((r >> 5)  & DES_MASK_TABLE[16])|
200          ((r >> 10) & DES_MASK_TABLE[17])|
201          ((r >> 3)  & DES_MASK_TABLE[18])|
202          ((r >> 18) & DES_MASK_TABLE[19])|
203          ((r >> 26) & DES_MASK_TABLE[20])|
204          ((r >> 24) & DES_MASK_TABLE[21]);
205
206        subkeys[round*2+1] =
207          ((l << 15) & DES_MASK_TABLE[22])|
208          ((l << 17) & DES_MASK_TABLE[23])|
209          ((l << 10) & DES_MASK_TABLE[24])|
210          ((l << 22) & DES_MASK_TABLE[25])|
211          ((l >> 2)  & DES_MASK_TABLE[26])|
212          ((l << 1)  & DES_MASK_TABLE[27])|
213          ((l << 16) & DES_MASK_TABLE[28])|
214          ((l << 11) & DES_MASK_TABLE[29])|
215          ((l << 3)  & DES_MASK_TABLE[30])|
216          ((l >> 6)  & DES_MASK_TABLE[31])|
217          ((l << 15) & DES_MASK_TABLE[32])|
218          ((l >> 4)  & DES_MASK_TABLE[33])|
219          ((r >> 2)  & DES_MASK_TABLE[34])|
220          ((r << 8)  & DES_MASK_TABLE[35])|
221          ((r >> 14) & DES_MASK_TABLE[36])|
222          ((r >> 9)  & DES_MASK_TABLE[37])|
223          ((r >> 0)  & DES_MASK_TABLE[38])|
224          ((r << 7)  & DES_MASK_TABLE[39])|
225          ((r >> 7)  & DES_MASK_TABLE[40])|
226          ((r >> 3)  & DES_MASK_TABLE[41])|
227          ((r << 2)  & DES_MASK_TABLE[42])|
228          ((r >> 21) & DES_MASK_TABLE[43]);
229    }
230}
231
232
233static UINT64 des_encrypt_decrypt(int decrypt, UINT64 ret)
234{
235   UINT32 l;
236   UINT32 r;
237   int i;
238   int subkey;
239
240   r = (ret & 0x00000000ffffffffULL) >> 0;
241   l = (ret & 0xffffffff00000000ULL) >> 32;
242
243   permutate(&l,  &r, 0x0f0f0f0f, 4);
244   permutate(&l,  &r, 0x0000ffff, 16);
245   permutate(&r,  &l, 0x33333333, 2);
246   permutate(&r,  &l, 0x00ff00ff, 8);
247   permutate(&l,  &r, 0x55555555, 1);
248
249   if (decrypt) subkey = 30;
250   else subkey = 0;
251
252   for (i = 0; i < 32 ; i+=4)
253   {
254      UINT32 temp;
255
256       temp = ((r<<1) | (r>>31)) ^ des_subkeys[subkey];
257       l ^= DES_SBOX8[ (temp>>0)  & 0x3f ];
258       l ^= DES_SBOX6[ (temp>>8)  & 0x3f ];
259       l ^= DES_SBOX4[ (temp>>16) & 0x3f ];
260       l ^= DES_SBOX2[ (temp>>24) & 0x3f ];
261      subkey++;
262
263       temp = ((r>>3) | (r<<29)) ^ des_subkeys[subkey];
264       l ^= DES_SBOX7[ (temp>>0)  & 0x3f ];
265       l ^= DES_SBOX5[ (temp>>8)  & 0x3f ];
266       l ^= DES_SBOX3[ (temp>>16) & 0x3f ];
267       l ^= DES_SBOX1[ (temp>>24) & 0x3f ];
268      subkey++;
269      if (decrypt) subkey-=4;
270
271       temp = ((l<<1) | (l>>31)) ^ des_subkeys[subkey];
272       r ^= DES_SBOX8[ (temp>>0)  & 0x3f ];
273       r ^= DES_SBOX6[ (temp>>8)  & 0x3f ];
274       r ^= DES_SBOX4[ (temp>>16) & 0x3f ];
275       r ^= DES_SBOX2[ (temp>>24) & 0x3f ];
276        subkey++;
277
278        temp = ((l>>3) | (l<<29)) ^ des_subkeys[subkey];
279       r ^= DES_SBOX7[ (temp>>0)  & 0x3f ];
280       r ^= DES_SBOX5[ (temp>>8)  & 0x3f ];
281       r ^= DES_SBOX3[ (temp>>16) & 0x3f ];
282       r ^= DES_SBOX1[ (temp>>24) & 0x3f ];
283      subkey++;
284      if (decrypt) subkey-=4;
285   }
286
287   permutate(&r, &l,  0x55555555, 1);
288   permutate(&l, &r,  0x00ff00ff, 8);
289   permutate(&l, &r,  0x33333333, 2);
290   permutate(&r, &l,  0x0000ffff, 16);
291   permutate(&r, &l,  0x0f0f0f0f, 4);
292
293   return ((UINT64)r << 32) | ((UINT64)l);
294}
295
296static UINT64 rev64(UINT64 src)
297{
298   UINT64 ret;
299
300   ret = ((src & 0x00000000000000ffULL) << 56)
301       | ((src & 0x000000000000ff00ULL) << 40)
302       | ((src & 0x0000000000ff0000ULL) << 24)
303       | ((src & 0x00000000ff000000ULL) << 8 )
304       | ((src & 0x000000ff00000000ULL) >> 8 )
305       | ((src & 0x0000ff0000000000ULL) >> 24)
306       | ((src & 0x00ff000000000000ULL) >> 40)
307       | ((src & 0xff00000000000000ULL) >> 56);
308
309   return ret;
310}
311
312static UINT64 read_to_qword(UINT8* region)
313{
314   int i;
315   UINT64 ret = 0;
316
317   for (i=0;i<8;i++)
318   {
319      UINT8 byte = region[i];
320      ret += (UINT64)byte << (56-(8*i));
321   }
322
323   return ret;
324}
325
326
327static void write_from_qword(UINT8* region, UINT64 qword)
328{
329   int i;
330   for (i=0;i<8;i++)
331   {
332      region[i] = qword >> (56-(i*8));
333   }
334}
335
336void naomi_game_decrypt(UINT64 key, UINT8* region, int length)
337{
338   int i;
339
340   des_generate_subkeys (rev64(key), des_subkeys);
341
342   for(i=0;i<length;i+=8)
343   {
344      UINT64 ret;
345      ret = read_to_qword(region+i);
346      ret = rev64(ret);
347      ret = des_encrypt_decrypt(1, ret);
348      ret = rev64(ret);
349       write_from_qword(region+i, ret);
350   }
351}
352
src/mame/machine/starwars.c
r2956r2957
128128
129129READ8_HANDLER( starwars_input_1_r )
130130{
131   int x = input_port_read_indexed(machine, 1);
131   int x = input_port_read(machine, "IN1");
132132
133133   /* set the matrix processor flag */
134134   if (math_run)
r2956r2957
157157{
158158   /* pitch */
159159   if (control_num == kPitch)
160      return input_port_read_indexed(machine, 4);
160      return input_port_read(machine, "STICKY");
161161
162162   /* yaw */
163163   else if (control_num == kYaw)
164      return input_port_read_indexed(machine, 5);
164      return input_port_read(machine, "STICKX");
165165
166166   /* default to unused thrust */
167167   else
src/mame/machine/simpsons.c
r2956r2957
5353
5454   res |= 0x20;//konami_eeprom_ack() << 5; /* add the ack */
5555
56   res |= input_port_read_indexed(machine, 5 ) & 1; /* test switch */
56   res |= input_port_read(machine, "TEST") & 1; /* test switch */
5757
5858   if (init_eeprom_count)
5959   {
src/mame/machine/subs.c
r2956r2957
2929INTERRUPT_GEN( subs_interrupt )
3030{
3131   /* only do NMI interrupt if not in TEST mode */
32   if ((input_port_read_indexed(machine, 2) & 0x40)==0x40)
32   if ((input_port_read(machine, "IN1") & 0x40)==0x40)
3333      cpunum_set_input_line(machine, 0,INPUT_LINE_NMI,PULSE_LINE);
3434}
3535
r2956r2957
4646   int this_val;
4747   int delta;
4848
49   this_val=input_port_read_indexed(machine, 3);
49   this_val=input_port_read(machine, "DIAL2");
5050
5151   delta=this_val-last_val;
5252   last_val=this_val;
r2956r2957
7575   int this_val;
7676   int delta;
7777
78   this_val=input_port_read_indexed(machine, 4);
78   this_val=input_port_read(machine, "DIAL1");
7979
8080   delta=this_val-last_val;
8181   last_val=this_val;
r2956r2957
112112***************************************************************************/
113113READ8_HANDLER( subs_control_r )
114114{
115   int inport = input_port_read_indexed(machine, 1);
115   int inport = input_port_read(machine, "IN0");
116116
117117   switch (offset & 0x07)
118118   {
r2956r2957
134134***************************************************************************/
135135READ8_HANDLER( subs_coin_r )
136136{
137   int inport = input_port_read_indexed(machine, 2);
137   int inport = input_port_read(machine, "IN1");
138138
139139   switch (offset & 0x07)
140140   {
r2956r2957
156156***************************************************************************/
157157READ8_HANDLER( subs_options_r )
158158{
159   int opts = input_port_read_indexed(machine, 0);
159   int opts = input_port_read(machine, "DSW");
160160
161161   switch (offset & 0x03)
162162   {
src/mame/machine/seicop.c
r2956r2957
765765      //case (0x5b4/2):
766766      //  return cop_mcu_ram[offset];
767767
768      case (0x700/2): return input_port_read_indexed(machine,1);
769      case (0x704/2):   return input_port_read_indexed(machine,2);
770      case (0x708/2):   return input_port_read_indexed(machine,4);
771      case (0x70c/2):   return input_port_read_indexed(machine,3);
772      case (0x71c/2): return input_port_read_indexed(machine,5);
768      case (0x700/2): return input_port_read(machine, "DSW1");
769      case (0x704/2):   return input_port_read(machine, "PLAYERS12");
770      case (0x708/2):   return input_port_read(machine, "PLAYERS34");
771      case (0x70c/2):   return input_port_read(machine, "SYSTEM");
772      case (0x71c/2): return input_port_read(machine, "DSW2");
773773   }
774774}
775775
r2956r2957
13151315      case (0x3d4/2): return seibu_main_word_r(machine,5,0xffff);
13161316
13171317      /* Inputs */
1318      case (0x340/2): return input_port_read_indexed(machine,1);
1319      case (0x344/2):   return input_port_read_indexed(machine,2);
1320      case (0x348/2): return input_port_read_indexed(machine,4);
1321      case (0x34c/2): return input_port_read_indexed(machine,3);
1318      case (0x340/2): return input_port_read(machine, "DSW1");
1319      case (0x344/2):   return input_port_read(machine, "PLAYERS12");
1320      case (0x348/2): return input_port_read(machine, "PLAYERS34");
1321      case (0x34c/2): return input_port_read(machine, "SYSTEM");
13221322
13231323   }
13241324}
r2956r2957
14211421
14221422      /* returning 0xffff for some inputs for now, breaks coinage but
14231423           allows cupsoc to boot */
1424      case (0x300/2): return input_port_read_indexed(machine,1);
1425      case (0x304/2): return input_port_read_indexed(machine,2);
1426      case (0x308/2): return input_port_read_indexed(machine,4);
1427      case (0x30c/2): return input_port_read_indexed(machine,3);
1424      case (0x300/2): return input_port_read(machine, "DSW1");
1425      case (0x304/2): return input_port_read(machine, "PLAYERS12");
1426      case (0x308/2): return input_port_read(machine, "PLAYERS34");
1427      case (0x30c/2): return input_port_read(machine, "SYSTEM");
14281428      case (0x314/2): return 0xffff;
1429      case (0x31c/2): return input_port_read_indexed(machine,5);
1429      case (0x31c/2): return input_port_read(machine, "DSW2");
14301430
14311431      case (0x340/2): return 0xffff;
14321432      case (0x344/2): return 0xffff;
r2956r2957
15731573      case (0x314/2):   return seibu_main_word_r(machine,5,0xffff);
15741574
15751575      /* Inputs */
1576      case (0x340/2): return input_port_read_indexed(machine,1);
1577      case (0x344/2): return input_port_read_indexed(machine,2);
1578      case (0x348/2): return input_port_read_indexed(machine,4);
1579      case (0x34c/2): return input_port_read_indexed(machine,3);
1576      case (0x340/2): return input_port_read(machine, "DSW1");
1577      case (0x344/2): return input_port_read(machine, "PLAYERS12");
1578      case (0x348/2): return input_port_read(machine, "PLAYERS34");
1579      case (0x34c/2): return input_port_read(machine, "SYSTEM");
15801580   }
15811581}
15821582
r2956r2957
16241624      case (0x314/2): return seibu_main_word_r(machine,5,0xffff);
16251625
16261626      /* Inputs */
1627      case (0x340/2): return input_port_read_indexed(machine,1);
1628      case (0x344/2):   return input_port_read_indexed(machine,2);
1629      case (0x348/2): return input_port_read_indexed(machine,4);
1630      case (0x34c/2): return input_port_read_indexed(machine,3);
1631      case (0x35c/2): return input_port_read_indexed(machine,5);
1627      case (0x340/2): return input_port_read(machine, "DSW1");
1628      case (0x344/2):   return input_port_read(machine, "PLAYERS12");
1629      case (0x348/2): return input_port_read(machine, "PLAYERS34");
1630      case (0x34c/2): return input_port_read(machine, "SYSTEM");
1631      case (0x35c/2): return input_port_read(machine, "DSW2");
16321632   }
16331633}
16341634
r2956r2957
16961696      case (0x314/2): return seibu_main_word_r(machine,5,0xffff);
16971697
16981698      /* Inputs */
1699      case (0x340/2): return input_port_read_indexed(machine,1);
1700      case (0x344/2):   return input_port_read_indexed(machine,2);
1701      case (0x348/2): return input_port_read_indexed(machine,4);
1702      case (0x34c/2): return input_port_read_indexed(machine,3);
1703      case (0x35c/2): return input_port_read_indexed(machine,5);
1699      case (0x340/2): return input_port_read(machine, "DSW1");
1700      case (0x344/2):   return input_port_read(machine, "PLAYERS12");
1701      case (0x348/2): return input_port_read(machine, "PLAYERS34");
1702      case (0x34c/2): return input_port_read(machine, "SYSTEM");
1703      case (0x35c/2): return input_port_read(machine, "DSW2");
17041704   }
17051705}
17061706
r2956r2957
19071907      case (0x314/2): return seibu_main_word_r(machine,5,0xffff);
19081908
19091909      /* Inputs */
1910      case (0x340/2): return input_port_read_indexed(machine,1);
1911      case (0x344/2):   return input_port_read_indexed(machine,2);
1912      case (0x348/2):   return input_port_read_indexed(machine,0);
1913      case (0x34c/2):   return input_port_read_indexed(machine,3);
1910      case (0x340/2): return input_port_read(machine, "DSW1");
1911      case (0x344/2):   return input_port_read(machine, "PLAYERS12");
1912      case (0x348/2):   return input_port_read(machine, "COIN");
1913      case (0x34c/2):   return input_port_read(machine, "SYSTEM");
19141914
19151915   }
19161916}
r2956r2957
19861986         return generic_cop_r(machine, offset, mem_mask);
19871987         break;
19881988
1989      case (0x340/2): return input_port_read_indexed(machine, 3) | (input_port_read_indexed(machine, 4) << 8);
1990      case (0x344/2): return input_port_read_indexed(machine, 1) | (input_port_read_indexed(machine, 2) << 8);
1991      case (0x34c/2): return input_port_read_indexed(machine, 5) | 0xff00;
1989      case (0x340/2): return input_port_read(machine, "DSWA") | (input_port_read(machine, "DSWB") << 8);
1990      case (0x344/2): return input_port_read(machine, "P1") | (input_port_read(machine, "P2") << 8);
1991      case (0x34c/2): return input_port_read(machine, "SYSTEM") | 0xff00;
19921992
19931993      /* Inputs */
19941994      case (0x308/2):   return seibu_main_word_r(machine,2,0xffff);
src/mame/tiny.c
r2956r2957
5454   DRIVER( starfira )   /* (c) 1979 Exidy */
5555   DRIVER( fireone )   /* (c) 1979 Exidy */
5656   DRIVER( starfir2 )   /* (c) 1979 Exidy */
57   DRIVER( wrally )   /* (c) 1993 - Ref 930705 */
5758
5859#endif   /* DRIVER_RECURSIVE */
src/mame/mamedriv.c
r2956r2957
20292029   DRIVER( perfrman )   /* (c) 1985 Data East Corporation (Japan) */
20302030   DRIVER( perfrmau )   /* (c) 1985 Data East USA (US) */
20312031   DRIVER( tigerh )   /* A47 (c) 1985 Taito America  Corporation   GX-551 [not a Konami board!] */
2032   DRIVER( tigerh2 )   /* A47 (c) 1985 Taito Corporation   GX-551 [not a Konami board!] */
20332032   DRIVER( tigerhj )   /* A47 (c) 1985 Taito Corporation   GX-551 [not a Konami board!] */
20342033   DRIVER( tigerhb1 )   /* bootleg but (c) 1985 Taito Corporation */
20352034   DRIVER( tigerhb2 )   /* bootleg but (c) 1985 Taito Corporation */
2035   DRIVER( tigerhb3 )   /* bootleg but (c) 1985 Taito Corporation */
20362036   DRIVER( slapfigh )   /* A76 / TP-??? */
20372037   DRIVER( slapfiga )   /* A76 / TP-??? */
20382038   DRIVER( slapbtjp )   /* bootleg but (c) 1986 Taito Corporation */
r2956r2957
20412041   DRIVER( alcon )      /* A76 / TP-??? */
20422042   DRIVER( getstar )   /* A68 (c) 1986 Taito Corporation */
20432043   DRIVER( getstarj )   /* A68 (c) 1986 Taito Corporation */
2044   DRIVER( getstarb )   /* GX-006 bootleg but (c) 1986 Taito Corporation */
2045   DRIVER( gtstarba )   /* GX-006 bootleg but (c) 1986 Taito Corporation */
2044   DRIVER( gtstarb1 )   /* GX-006 bootleg but (c) 1986 Taito Corporation */
2045   DRIVER( gtstarb2 )   /* GX-006 bootleg but (c) 1986 Taito Corporation */
20462046   DRIVER( mjsister )   /* (c) 1986 Toaplan */
20472047
20482048   DRIVER( fshark )   /* B02 / TP-007 (c) 1987 Taito Corporation (World) */
r2956r2957
31093109   DRIVER( wcbowl )   /* (c) 1995 Incredible Technologies */
31103110   DRIVER( wcbwl165 )   /* (c) 1995 Incredible Technologies */
31113111   DRIVER( wcbwl161 )   /* (c) 1995 Incredible Technologies */
3112   DRIVER( wcbwl16 )   /* (c) 1995 Incredible Technologies */
31123113   DRIVER( wcbwl140 )   /* (c) 1995 Incredible Technologies */
31133114   DRIVER( wcbwl15 )   /* (c) 1995 Incredible Technologies */
31143115   DRIVER( wcbwl13 )   /* (c) 1995 Incredible Technologies */
r2956r2957
37773778
37783779   /* Model 2 (TGPs, Model 1 sound board) */
37793780   DRIVER( daytona )   /* 1993 */
3781   DRIVER( dayton93 )   /* 1993 */
37803782   DRIVER( daytonas )   /* 1993 */
37813783   DRIVER( daytonat )   /* 1993, hack */
37823784   DRIVER( daytonam )   /* 1993, hack */
r2956r2957
37893791   DRIVER( srallyc )   /* 1995 */
37903792   DRIVER( vf2 )      /* 1995 */
37913793   DRIVER( vf2b )      /* 1995 */
3794   DRIVER( vf2a )      /* 1995 */
37923795   DRIVER( vf2o )      /* 1995 */
37933796   DRIVER( vcop2 )      /* 1995 */
37943797   DRIVER( doaa )      /* 1996 */
r2956r2957
40584061
40594062   DRIVER( naomigd )
40604063   DRIVER( sfz3ugd )
4064   DRIVER( cvs2gd )
40614065
4066   DRIVER( hod2bios )
4067
40624068   DRIVER( naomi2 )
40634069
40644070   /* Atomiswave (Dreamcast-based) games */
r2956r2957
54725478   DRIVER( legofair )   /* A7003 'KK' (c) 1988 */
54735479   DRIVER( fsoccer )   /* A6006 'FS' (c) 1988 */
54745480   DRIVER( fsoccerj )   /* A6006 'FS' (c) 1988 */
5475
54765481   DRIVER( fsoccerb )   /*            (c) 1988 */
54775482   DRIVER( tdfever )   /* A6006 'TD' (c) 1987 */
54785483   DRIVER( tdfeverj )   /* A6006 'TD' (c) 1987 */
src/mame/includes/system16.h
r2956r2957
139139
140140GFXDECODE_EXTERN( sys16 );
141141
142
143#define SYS16_JOY1 PORT_START_TAG("IN0")\
144   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) \
145   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) \
146   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) \
147   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
148   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY \
149   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY \
150   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY \
151   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
152
153#define SYS16_JOY2 PORT_START_TAG("IN1") \
154   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL \
155   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL \
156   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL \
157   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
158   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL \
159   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL \
160   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL \
161   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
162
163#define SYS16_SERVICE PORT_START_TAG("IN2") \
164   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) \
165   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) \
166   PORT_SERVICE_NO_TOGGLE(0x04, IP_ACTIVE_LOW) \
167   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 ) \
168   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 ) \
169   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) \
170   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
171   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
172
173#define SYS16_COINAGE PORT_START_TAG("DSW1") \
174   PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3,4") \
175   PORT_DIPSETTING(    0x07, DEF_STR( 4C_1C ) ) \
176   PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) ) \
177   PORT_DIPSETTING(    0x09, DEF_STR( 2C_1C ) ) \
178   PORT_DIPSETTING(    0x05, "2 Coins/1 Credit 5/3 6/4" ) \
179   PORT_DIPSETTING(    0x04, "2 Coins/1 Credit 4/3" ) \
180   PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) ) \
181   PORT_DIPSETTING(    0x01, "1 Coin/1 Credit 2/3" ) \
182   PORT_DIPSETTING(    0x02, "1 Coin/1 Credit 4/5" ) \
183   PORT_DIPSETTING(    0x03, "1 Coin/1 Credit 5/6" ) \
184   PORT_DIPSETTING(    0x06, DEF_STR( 2C_3C ) ) \
185   PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) ) \
186   PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) ) \
187   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) ) \
188   PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) ) \
189   PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) ) \
190   PORT_DIPSETTING(    0x00, "Free Play (if Coin B too) or 1/1" ) \
191   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:5,6,7,8") \
192   PORT_DIPSETTING(    0x70, DEF_STR( 4C_1C ) ) \
193   PORT_DIPSETTING(    0x80, DEF_STR( 3C_1C ) ) \
194   PORT_DIPSETTING(    0x90, DEF_STR( 2C_1C ) ) \
195   PORT_DIPSETTING(    0x50, "2 Coins/1 Credit 5/3 6/4" ) \
196   PORT_DIPSETTING(    0x40, "2 Coins/1 Credit 4/3" ) \
197   PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) ) \
198   PORT_DIPSETTING(    0x10, "1 Coin/1 Credit 2/3" ) \
199   PORT_DIPSETTING(    0x20, "1 Coin/1 Credit 4/5" ) \
200   PORT_DIPSETTING(    0x30, "1 Coin/1 Credit 5/6" ) \
201   PORT_DIPSETTING(    0x60, DEF_STR( 2C_3C ) ) \
202   PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) ) \
203   PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) ) \
204   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) ) \
205   PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) ) \
206   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) ) \
207   PORT_DIPSETTING(    0x00, "Free Play (if Coin A too) or 1/1" )
208
209
210142/*----------- defined in video/system16.c -----------*/
211143
212144/* video hardware */
src/mame/includes/slapfght.h
r2956r2957
1#include "cpu/z80/z80.h"
2
3
4/* This it the best way to allow game specific kludges until the system is fully understood */
5enum {
6   GETSTUNK=0,  /* unknown for inclusion of possible new sets */
7   GETSTAR,
8   GETSTARJ,
9   GTSTARB1,    /* "good" bootleg with same behaviour as 'getstarj' */
10   GTSTARB2,    /* "lame" bootleg with lots of ingame bugs */
11};
12
13
14/*----------- defines -----------*/
15
16/* due to code at 0x108d (GUARDIAN) or 0x1152 (GETSTARJ),
17   register C is a unaltered copy of register A */
18
19# define GS_SAVE_REGS  gs_a = activecpu_get_reg(Z80_BC) >> 0; \
20                       gs_d = activecpu_get_reg(Z80_DE) >> 8; \
21                       gs_e = activecpu_get_reg(Z80_DE) >> 0;
22
23# define GS_RESET_REGS gs_a = 0; \
24                       gs_d = 0; \
25                       gs_e = 0;
26
27
28/*----------- defined in drivers/slapfght.c -----------*/
29
30extern int getstar_id;
31
32
133/*----------- defined in machine/slapfght.c -----------*/
234
335MACHINE_RESET( slapfight );
r2956r2957
1547WRITE8_HANDLER( slapfight_port_08_w );
1648WRITE8_HANDLER( slapfight_port_09_w );
1749
50
1851READ8_HANDLER( getstar_e803_r );
52WRITE8_HANDLER( getstar_e803_w );
1953
54
2055READ8_HANDLER ( tigerh_68705_portA_r );
2156WRITE8_HANDLER( tigerh_68705_portA_w );
2257READ8_HANDLER ( tigerh_68705_portB_r );
r2956r2957
3065READ8_HANDLER ( tigerh_mcu_r );
3166READ8_HANDLER ( tigerh_mcu_status_r );
3267
68READ8_HANDLER( tigerhb_e803_r );
69WRITE8_HANDLER( tigerhb_e803_w );
70
71
3372WRITE8_HANDLER( getstar_sh_intenable_w );
3473INTERRUPT_GEN( getstar_interrupt );
3574
src/mame/mame.mak
r2956r2957
446446   $(DRIVERS)/alpha68k.o $(VIDEO)/alpha68k.o \
447447   $(DRIVERS)/champbas.o $(VIDEO)/champbas.o \
448448   $(DRIVERS)/equites.o $(VIDEO)/equites.o \
449   $(DRIVERS)/exctsccr.o $(VIDEO)/exctsccr.o \
450449   $(DRIVERS)/meijinsn.o \
451450   $(DRIVERS)/shougi.o \
452451
r2956r2957
11591158   $(DRIVERS)/model1.o $(MACHINE)/model1.o $(VIDEO)/model1.o \
11601159   $(DRIVERS)/model2.o $(VIDEO)/model2.o \
11611160   $(DRIVERS)/model3.o $(VIDEO)/model3.o $(MACHINE)/model3.o \
1162   $(DRIVERS)/naomi.o $(MACHINE)/dc.o $(VIDEO)/dc.o \
1161   $(DRIVERS)/naomi.o $(MACHINE)/dc.o $(VIDEO)/dc.o $(MACHINE)/gdcrypt.o \
11631162   $(DRIVERS)/puckpkmn.o \
11641163   $(DRIVERS)/segac2.o \
11651164   $(DRIVERS)/segag80r.o $(MACHINE)/segag80.o $(AUDIO)/segag80r.o $(VIDEO)/segag80r.o \
src/mame/video/namcofl.c
r2956r2957
181181{
182182   credits1 = credits2 = 0;
183183   old_coin_state = 0x00;
184   //input_port_read_indexed(machine, 3)&0x30;
184   //input_port_read(machine, "IN3") & 0x30;
185185
186186   namco_tilemap_init( NAMCONB1_TILEGFX, memory_region(machine, NAMCONB1_TILEMASKREGION), TilemapCB );
187187   namco_obj_init(NAMCONB1_SPRITEGFX,0x0,FLobjcode2tile);
src/mame/video/travrusa.c
r2956r2957
274274WRITE8_HANDLER( travrusa_flipscreen_w )
275275{
276276   /* screen flip is handled both by software and hardware */
277   data ^= ~input_port_read_indexed(machine, 4) & 1;
277   data ^= ~input_port_read(machine, "DSW2") & 1;
278278
279279   flip_screen_set(data & 1);
280280
src/mame/video/galaxian.c
r2956r2957
596596{
597597   rectangle clip = *cliprect;
598598   int sprnum;
599   int clip_ofs = (flipscreen_x ? 16 : 0);
599600
600601   /* 16 of the 256 pixels of the sprites are hard-clipped at the line buffer */
601602   /* according to the schematics, it should be the first 16 pixels; however, */
602603   /* some bootlegs demonstrate that this can be shifted to other positions. */
603   clip.min_x = MAX(clip.min_x, galaxian_sprite_clip_start * GALAXIAN_XSCALE);
604   clip.max_x = MIN(clip.max_x, (galaxian_sprite_clip_end + 1) * GALAXIAN_XSCALE - 1);
604   clip.min_x = MAX(clip.min_x, (galaxian_sprite_clip_start - clip_ofs) * GALAXIAN_XSCALE);
605   clip.max_x = MIN(clip.max_x, (galaxian_sprite_clip_end - clip_ofs + 1) * GALAXIAN_XSCALE - 1);
605606
606607   /* The line buffer is only written if it contains a '0' currently; */
607608   /* it is cleared during the visible area, and populated during HBLANK */
r2956r2957
627628      /* apply flipscreen in X direction */
628629      if (flipscreen_x)
629630      {
630         sx = 240 - sx;
631         sx = 242 - sx; // + 8 - HOFS
631632         flipx = !flipx;
632633      }
633634
r2956r2957
995996{
996997   rectangle draw;
997998
998   /* color split point verified on real machine */
999   /* hmmm, according to schematics it is at 128+8; which is right? */
1000   draw = *cliprect;
1001   draw.max_x = MIN(draw.max_x, (128+8) * GALAXIAN_XSCALE - 1);
1002   if (draw.min_x <= draw.max_x)
1003      fillbitmap(bitmap, MAKE_RGB(0,0,0x47), &draw);
999   if (flipscreen_x)
1000   {
1001      /* color split point verified on real machine */
1002      /* hmmm, according to schematics it is at 128+8; which is right? */
1003      draw = *cliprect;
1004      draw.max_x = MIN(draw.max_x, (128-8) * GALAXIAN_XSCALE - 1);
1005      if (draw.min_x <= draw.max_x)
1006         fillbitmap(bitmap, RGB_BLACK, &draw);
10041007
1005   draw = *cliprect;
1006   draw.min_x = MAX(draw.min_x, (128+8) * GALAXIAN_XSCALE);
1007   if (draw.min_x <= draw.max_x)
1008      fillbitmap(bitmap, RGB_BLACK, &draw);
1008      draw = *cliprect;
1009      draw.min_x = MAX(draw.min_x, (128-8) * GALAXIAN_XSCALE);
1010      if (draw.min_x <= draw.max_x)
1011         fillbitmap(bitmap, MAKE_RGB(0,0,0x47), &draw);
1012   }
1013   else
1014   {
1015      /* color split point verified on real machine */
1016      /* hmmm, according to schematics it is at 128+8; which is right? */
1017      draw = *cliprect;
1018      draw.max_x = MIN(draw.max_x, (128+8) * GALAXIAN_XSCALE - 1);
1019      if (draw.min_x <= draw.max_x)
1020         fillbitmap(bitmap, MAKE_RGB(0,0,0x47), &draw);
1021
1022      draw = *cliprect;
1023      draw.min_x = MAX(draw.min_x, (128+8) * GALAXIAN_XSCALE);
1024      if (draw.min_x <= draw.max_x)
1025         fillbitmap(bitmap, RGB_BLACK, &draw);
1026   }
1027
10091028}
10101029
10111030
src/mame/video/pushman.c
r2956r2957
9999      flipx=spriteram16[offs+1]&2;
100100      flipy=spriteram16[offs+1]&1;   /* flip y untested */
101101
102      if (flip_screen_get())
103      {
104         x = 240 - x;
105         y = 240 - y;
106         flipx = !flipx;
107         flipy = !flipy;
108      }
109
102110      drawgfx(bitmap,machine->gfx[1],
103111            sprite,
104112                color,flipx,flipy,x,y,
src/mame/video/snk68.c
r2956r2957
1414
1515#include "driver.h"
1616
17static int sprite_flip, pow_charbase=0; //*
18static tilemap *fix_tilemap;
17UINT16* pow_fg_videoram;
1918
19static int pow_charbank;
20static int sprite_flip_axis;
21static tilemap *fg_tilemap;
22static int flipscreen;
23
2024/***************************************************************************
2125
2226  Callbacks for the TileMap code
r2956r2957
2529
2630static TILE_GET_INFO( get_pow_tile_info )
2731{
28   int tile=videoram16[2*tile_index]&0xff;
29   int color=videoram16[2*tile_index+1];
32   int tile = (pow_fg_videoram[2*tile_index] & 0xff) | (pow_charbank << 8);
33   int color = pow_fg_videoram[2*tile_index+1] & 0x07;
3034
31   tile += pow_charbase; //AT: (powj36rc2gre)
32   color&=0xf;
33
34   SET_TILE_INFO(
35         0,
36         tile,
37         color,
38         0);
35   SET_TILE_INFO(0, tile, color, 0);
3936}
4037
41static TILE_GET_INFO( get_sar_tile_info )
38static TILE_GET_INFO( get_searchar_tile_info )
4239{
43   int tile=videoram16[2*tile_index];
44   int color=tile >> 12;
40   int data = pow_fg_videoram[2*tile_index];
41   int tile = data & 0x7ff;
42   int color = (data & 0x7000) >> 12;
4543
46   tile=tile&0xfff;
44   // used in the ikari3 intro
45   int flags = (data & 0x8000) ? TILE_FORCE_LAYER0 : 0;
4746
48   SET_TILE_INFO(
49         0,
50         tile,
51         color,
52         0);
47   SET_TILE_INFO(0, tile, color, flags);
5348}
5449
55static TILE_GET_INFO( get_ikari3_tile_info )
56{
57   int tile=videoram16[2*tile_index];
58   int color=tile >> 12;
59
60   /* Kludge - Tile 0x80ff is meant to be opaque black, but isn't.  This fixes it */
61   if (tile==0x80ff) {
62      tile=0x2ca;
63      color=7;
64   } else
65      tile=tile&0xfff;
66
67   SET_TILE_INFO(
68         0,
69         tile,
70         color,
71         0);
72}
73
7450/***************************************************************************
7551
7652  Start the video hardware emulation.
7753
7854***************************************************************************/
7955
80VIDEO_START( pow )
56static void common_video_start(running_machine *machine)
8157{
82   fix_tilemap = tilemap_create(get_pow_tile_info,tilemap_scan_cols,8,8,32,32);
58   tilemap_set_transparent_pen(fg_tilemap,0);
8359
84   tilemap_set_transparent_pen(fix_tilemap,0);
60   tilemap_set_scrolldx(fg_tilemap, 0, video_screen_get_width(machine->primary_screen) - 256);
61   tilemap_set_scrolldy(fg_tilemap, 0, video_screen_get_height(machine->primary_screen) - 256);
8562}
8663
87VIDEO_START( searchar )
64VIDEO_START( pow )
8865{
89   fix_tilemap = tilemap_create(get_sar_tile_info,tilemap_scan_cols,8,8,32,32);
66   fg_tilemap = tilemap_create(get_pow_tile_info,tilemap_scan_cols,8,8,32,32);
9067
91   tilemap_set_transparent_pen(fix_tilemap,0);
68   common_video_start(machine);
9269}
9370
94VIDEO_START( ikari3 )
71VIDEO_START( searchar )
9572{
96   fix_tilemap = tilemap_create(get_ikari3_tile_info,tilemap_scan_cols,8,8,32,32);
73   fg_tilemap = tilemap_create(get_searchar_tile_info,tilemap_scan_cols,8,8,32,32);
9774
98   tilemap_set_transparent_pen(fix_tilemap,0);
75   common_video_start(machine);
9976}
10077
10178/***************************************************************************
r2956r2957
10481
10582***************************************************************************/
10683
84READ16_HANDLER( pow_spriteram_r )
85{
86   // streetsj expects the MSB of every 32-bit word to be FF. Presumably RAM
87   // exists only for 3 bytes out of 4 and the fourth is unmapped.
88   if (!(offset & 1))
89      return spriteram16[offset] | 0xff00;
90   else
91      return spriteram16[offset];
92}
93
94WRITE16_HANDLER( pow_spriteram_w )
95{
96   UINT16 newword = spriteram16[offset];
97
98   if (!(offset & 1))
99      data |= 0xff00;
100
101   COMBINE_DATA(&newword);
102
103   if (spriteram16[offset] != newword)
104   {
105      int vpos = video_screen_get_vpos(machine->primary_screen);
106
107      if (vpos > 0)
108         video_screen_update_partial(machine->primary_screen, vpos - 1);
109
110      spriteram16[offset] = newword;
111   }
112}
113
114READ16_HANDLER( pow_fg_videoram_r )
115{
116   // RAM is only 8-bit
117   return pow_fg_videoram[offset] | 0xff00;
118}
119
120WRITE16_HANDLER( pow_fg_videoram_w )
121{
122   data |= 0xff00;
123   COMBINE_DATA(&pow_fg_videoram[offset]);
124   tilemap_mark_tile_dirty(fg_tilemap, offset >> 1);
125}
126
127WRITE16_HANDLER( searchar_fg_videoram_w )
128{
129   // RAM is full 16-bit, though only half of it is used by the hardware
130   COMBINE_DATA(&pow_fg_videoram[offset]);
131   tilemap_mark_tile_dirty(fg_tilemap, offset >> 1);
132}
133
107134WRITE16_HANDLER( pow_flipscreen16_w )
108135{
109136   if (ACCESSING_BITS_0_7)
110137   {
111       flip_screen_set(data & 0x08);
112       sprite_flip=data&0x4;
113       pow_charbase = (data & 0x70) << 4;
138      flipscreen = data & 0x08;
139      tilemap_set_flip(ALL_TILEMAPS, flipscreen ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
140
141      sprite_flip_axis = data & 0x04;   // for streetsm? though might not be present on this board
142
143      if (pow_charbank != ((data & 0x70) >> 4))
144      {
145         pow_charbank = (data & 0x70) >> 4;
146         tilemap_mark_all_tiles_dirty(fg_tilemap);
147      }
114148   }
115149}
116150
151WRITE16_HANDLER( searchar_flipscreen16_w )
152{
153   if (ACCESSING_BITS_0_7)
154   {
155      flipscreen = data & 0x08;
156      tilemap_set_flip(ALL_TILEMAPS, flipscreen ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
157
158      sprite_flip_axis = data & 0x04;
159   }
160}
161
117162WRITE16_HANDLER( pow_paletteram16_word_w )
118163{
119164   UINT16 newword;
r2956r2957
129174   palette_set_color_rgb(machine,offset,pal5bit(r),pal5bit(g),pal5bit(b));
130175}
131176
132WRITE16_HANDLER( pow_video16_w )
133{
134   COMBINE_DATA(&videoram16[offset]);
135   tilemap_mark_tile_dirty(fix_tilemap,offset>>1);
136}
137177
138
139178/***************************************************************************
140179
141180  Display refresh
142181
143182***************************************************************************/
144183
145static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int j,int pos)
184static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int group)
146185{
147   int offs,mx,my,color,tile,fx,fy,i;
186   const UINT16* tiledata = &spriteram16[0x800*group];
148187
149   for (offs = pos; offs < pos+0x800; offs += 0x80 )
188   // pow has 0x4000 tiles and independent x/y flipping
189   // the other games have > 0x4000 tiles and flipping in only one direction
190   // (globally selected)
191   int const is_pow = (machine->gfx[1]->total_elements <= 0x4000);
192   int offs;
193
194   for (offs = 0; offs < 0x800; offs += 0x40)
150195   {
151      mx=(spriteram16[(offs+4+(4*j))>>1]&0xff)<<4;
152      my=spriteram16[(offs+6+(4*j))>>1];
153      mx=mx+(my>>12);
154      mx=((mx+16)&0x1ff)-16;
196      int mx = (spriteram16[offs + 2*group] & 0xff) << 4;
197      int my = spriteram16[offs + 2*group + 1];
198      int i;
155199
156      mx=((mx+0x100)&0x1ff)-0x100;
157      my=((my+0x100)&0x1ff)-0x100;
200      mx = mx | (my >> 12);
158201
159      my=0x200 - my;
160      my-=0x200;
202      mx = ((mx + 16) & 0x1ff) - 16;
203      my = -my;
161204
162      if (flip_screen_get()) {
163         mx=240-mx;
164         my=240-my;
205      if (flipscreen)
206      {
207         mx = 240 - mx;
208         my = 240 - my;
165209      }
166210
167      for (i=0; i<0x80; i+=4) {
168         color=spriteram16[(offs+i+(0x1000*j)+0x1000)>>1]&0x7f;
211      // every sprite is a column 32 tiles (512 pixels) tall
212      for (i = 0; i < 0x20; ++i)
213      {
214         my &= 0x1ff;
169215
170         if (color) {
171            tile=spriteram16[(offs+2+i+(0x1000*j)+0x1000)>>1];
172            fy=tile&0x8000;
173            fx=tile&0x4000;
174            tile&=0x3fff;
216         if (my <= cliprect->max_y && my + 15 >= cliprect->min_y)
217         {
218            int color = *(tiledata++) & 0x7f;
219            int tile = *(tiledata++);
220            int fx,fy;
175221
176            if (flip_screen_get()) {
177               if (fx) fx=0; else fx=1;
178               if (fy) fy=0; else fy=1;
222            if (is_pow)
223            {
224               fx = tile & 0x4000;
225               fy = tile & 0x8000;
226               tile &= 0x3fff;
179227            }
180
181            drawgfx(bitmap,machine->gfx[1],
182               tile,
183               color,
184               fx,fy,
185               mx,my,
186               cliprect,TRANSPARENCY_PEN,0);
187         }
188
189         if (flip_screen_get()) {
190            my-=16;
191            if (my < -0x100) my+=0x200;
192         }
193         else {
194            my+=16;
195            if (my > 0x100) my-=0x200;
196         }
197      }
198   }
199}
200
201
202VIDEO_UPDATE( pow )
203{
204   fillbitmap(bitmap,2047,cliprect);
205
206   /* This appears to be correct priority */
207   draw_sprites(screen->machine, bitmap,cliprect,1,0x000);
208   draw_sprites(screen->machine, bitmap,cliprect,1,0x800);
209   draw_sprites(screen->machine, bitmap,cliprect,2,0x000);
210   draw_sprites(screen->machine, bitmap,cliprect,2,0x800);
211   draw_sprites(screen->machine, bitmap,cliprect,0,0x000); //AT: (pow37b5yel)
212   draw_sprites(screen->machine, bitmap,cliprect,0,0x800);
213
214   tilemap_draw(bitmap,cliprect,fix_tilemap,0,0);
215   return 0;
216}
217
218
219static void draw_sprites2(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int j, int z, int pos)
220{
221   int offs,mx,my,color,tile,fx,fy,i;
222
223   for (offs = pos; offs < pos+0x800 ; offs += 0x80 )
224   {
225      mx=spriteram16[(offs+j)>>1];
226      my=spriteram16[(offs+j+2)>>1];
227
228      mx=mx<<4;
229      mx=mx|((my>>12)&0xf);
230      my=my&0x1ff;
231
232      mx=(mx+0x100)&0x1ff;
233      my=(my+0x100)&0x1ff;
234      mx-=0x100;
235      my-=0x100;
236      my=0x200 - my;
237      my-=0x200;
238
239      if (flip_screen_get()) {
240         mx=240-mx;
241         my=240-my;
242      }
243
244      for (i=0; i<0x80; i+=4) {
245         color=spriteram16[(offs+i+z)>>1]&0x7f;
246         if (color) {
247            tile=spriteram16[(offs+2+i+z)>>1];
248            if (sprite_flip) {
249               fx=0;
250               fy=tile&0x8000;
251            } else {
252               fy=0;
253               fx=tile&0x8000;
228            else
229            {
230               if (sprite_flip_axis)
231               {
232                  fx = 0;
233                  fy = tile & 0x8000;
234               }
235               else
236               {
237                  fx = tile & 0x8000;
238                  fy = 0;
239               }
240               tile &= 0x7fff;
254241            }
255242
256            if (flip_screen_get()) {
257               if (fx) fx=0; else fx=1;
258               if (fy) fy=0; else fy=1;
243            if (flipscreen)
244            {
245               fx = !fx;
246               fy = !fy;
259247            }
260248
261            tile&=0x7fff;
262            if (tile>0x5fff) break;
263
264249            drawgfx(bitmap,machine->gfx[1],
265               tile,
266               color,
267               fx,fy,
268               mx,my,
269               cliprect,TRANSPARENCY_PEN,0);
250                  tile,
251                  color,
252                  fx, fy,
253                  mx, my,
254                  cliprect, TRANSPARENCY_PEN, 0);
270255         }
271         if (flip_screen_get()) {
272            my-=16;
273            if (my < -0x100) my+=0x200;
256         else
257         {
258            tiledata += 2;
274259         }
275         else {
276            my+=16;
277            if (my > 0x100) my-=0x200;
278         }
260
261         if (flipscreen)
262            my -= 16;
263         else
264            my += 16;
279265      }
280266   }
281267}
282268
283269
284VIDEO_UPDATE( searchar )
270VIDEO_UPDATE( pow )
285271{
286   fillbitmap(bitmap,2047,cliprect);
272   fillbitmap(bitmap, 0x7ff, cliprect);
287273
288   /* This appears to be correct priority */
289   draw_sprites2(screen->machine, bitmap,cliprect,8,0x2000,0x000);
290   draw_sprites2(screen->machine, bitmap,cliprect,8,0x2000,0x800);
291   draw_sprites2(screen->machine, bitmap,cliprect,12,0x3000,0x000);
292   draw_sprites2(screen->machine, bitmap,cliprect,12,0x3000,0x800);
293   draw_sprites2(screen->machine, bitmap,cliprect,4,0x1000,0x000);
294   draw_sprites2(screen->machine, bitmap,cliprect,4,0x1000,0x800);
274   /* This appears to be the correct priority order */
275   draw_sprites(screen->machine, bitmap, cliprect, 2);
276   draw_sprites(screen->machine, bitmap, cliprect, 3);
277   draw_sprites(screen->machine, bitmap, cliprect, 1);
295278
296   tilemap_draw(bitmap,cliprect,fix_tilemap,0,0);
279   tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);
297280   return 0;
298281}
299
src/mame/video/superqix.c
r2956r2957
235235   {
236236      int curr_power;
237237
238      curr_power = ((input_port_read_indexed(screen->machine, 4)&0x3f)*100)/0x3f;
238      curr_power = ((input_port_read(screen->machine, "PADDLE1") & 0x3f) * 100) / 0x3f;
239239      if (last_power[0] != curr_power)
240240      {
241241         popmessage   ("Power %d%%", curr_power);
242242         last_power[0] = curr_power;
243243      }
244244
245      curr_power = ((input_port_read_indexed(screen->machine, 6)&0x3f)*100)/0x3f;
245      curr_power = ((input_port_read(screen->machine, "PADDLE2") & 0x3f) * 100) / 0x3f;
246246      if (last_power[1] != curr_power)
247247      {
248248         popmessage   ("Power %d%%", curr_power);
src/mame/video/rastan.c
r2956r2957
129129
130130   PC090OJ_draw_sprites(screen->machine,bitmap,cliprect,1);
131131
132//  if (input_port_read_indexed(machine,5))
132//  if (input_port_read(machine, "P1X"))
133//  popmessage("%d %d", input_port_read(machine, "P1X"), input_port_read(machine, "P1Y"));
133134
134//  popmessage("%d %d",input_port_read_indexed(machine,5),input_port_read_indexed(machine,6));
135
136135   return 0;
137136}
138137
src/mame/video/taito_f3.c
r2956r2957
236236   int name;
237237   int extend;
238238   int sprite_lag;
239   int sprite_bpp;
240   int tile_bpp;
239241};
240242
241243static const struct F3config *f3_game_config;
242244
243245static const struct F3config f3_config_table[] =
244246{
245   /* Name    Extend  Sprite Lag */
246   { RINGRAGE,  0,       2 },
247   { ARABIANM,  0,       2 },
248   { RIDINGF,   1,       1 },
249   { GSEEKER,   0,       1 },
250   { TRSTAR,    1,       0 },
251   { GUNLOCK,   1,       2 },
252   { TWINQIX,   1,       1 },
253   { SCFINALS,  0,       1 },
254   { LIGHTBR,   1,       2 },
255   { KAISERKN,  0,       2 },
256   { DARIUSG,   0,       2 },
257   { BUBSYMPH,  1,       1 },
258   { SPCINVDX,  1,       1 },
259   { QTHEATER,  1,       1 },
260   { HTHERO95,  0,       1 },
261   { SPCINV95,  0,       1 },
262   { EACTION2,  1,       2 },
263   { QUIZHUHU,  1,       1 },
264   { PBOBBLE2,  0,       1 },
265   { GEKIRIDO,  0,       1 },
266   { KTIGER2,   0,       0 },
267   { BUBBLEM,   1,       1 },
268   { CLEOPATR,  0,       1 },
269   { PBOBBLE3,  0,       1 },
270   { ARKRETRN,  1,       1 },
271   { KIRAMEKI,  0,       1 },
272   { PUCHICAR,  1,       1 },
273   { PBOBBLE4,  0,       1 },
274   { POPNPOP,   1,       1 },
275   { LANDMAKR,  1,       1 },
276   { RECALH,    1,       1 },
277   { COMMANDW,  1,       1 },
247   /* Name    Extend  Lag   Bpp */
248   { RINGRAGE,  0,     2,   5, 6 },
249   { ARABIANM,  0,     2,   5, 5 },   /* sprites 1200-120F contain 6bpp pixels but this seems to be a data error */
250   { RIDINGF,   1,     1,   4, 4 },
251   { GSEEKER,   0,     1,   4, 4 },
252   { COMMANDW,  1,     1,   5, 5 },
253   { SCFINALS,  0,     1,   5, 5 },
254   { TRSTAR,    1,     0,   5, 5 },
255   { GUNLOCK,   1,     2,   5, 5 },
256   { LIGHTBR,   1,     2,   5, 5 },
257   { KAISERKN,  0,     2,   5, 5 },
258   { DARIUSG,   0,     2,   5, 5 },
259   { BUBSYMPH,  1,     1,   5, 5 },
260   { SPCINVDX,  1,     1,   4, 4 },
261   { HTHERO95,  0,     1,   6, 6 },
262   { QTHEATER,  1,     1,   4, 4 },
263   { EACTION2,  1,     2,   5, 5 },
264   { RECALH,    1,     1,   4, 4 },
265   { SPCINV95,  0,     1,   5, 5 },
266   { TWINQIX,   1,     1,   4, 6 },
267   { QUIZHUHU,  1,     1,   6, 6 },
268   { PBOBBLE2,  0,     1,   4, 6 },
269   { GEKIRIDO,  0,     1,   5, 5 },
270   { KTIGER2,   0,     0,   4, 4 },
271   { BUBBLEM,   1,     1,   4, 5 },
272   { CLEOPATR,  0,     1,   4, 6 },
273   { PBOBBLE3,  0,     1,   4, 6 },
274   { ARKRETRN,  1,     1,   5, 6 },
275   { KIRAMEKI,  0,     1,   5, 6 },
276   { PUCHICAR,  1,     1,   5, 6 },
277   { PBOBBLE4,  0,     1,   4, 6 },
278   { POPNPOP,   1,     1,   6, 6 },
279   { LANDMAKR,  1,     1,   5, 6 },
278280   {0}
279281};
280282
r2956r2957
443445{
444446   UINT32 tile=gfx_base[tile_index];
445447   UINT8 abtype=(tile>>(16+9))&0x1f;
448   int color_mask;
446449
450   // if tiles use more than 4bpp, the bottom bits of the color code must be masked out.
451   // This fixes (at least) the rain in round 6 of Arabian Magic.
452   color_mask = ~((1 << (f3_game_config->tile_bpp - 4)) - 1);
453
447454   SET_TILE_INFO(
448455         1,
449456         tile&0xffff,
450         (tile>>16)&0x1ff,
457         (tile>>16) & 0x1ff & color_mask,
451458         TILE_FLIPYX( tile >> 30 ));
452459   tileinfo->category =  abtype&1;      /* alpha blending type */
453460}
r2956r2957
617624   tilemap_set_transparent_pen(vram_layer,0);
618625   tilemap_set_transparent_pen(pixel_layer,0);
619626
620   /* Palettes have 4 bpp indexes despite up to 6 bpp data */
627   // Palettes have 4 bpp indexes despite up to 6 bpp data. The unused
628   // top bits in the gfx data are cleared later.
621629   machine->gfx[1]->color_granularity=16;
622630   machine->gfx[2]->color_granularity=16;
623631
632   assert(f3_game_config->tile_bpp >= 4 && f3_game_config->tile_bpp <= 6);
633   assert(f3_game_config->sprite_bpp >= 4 && f3_game_config->sprite_bpp <= 6);
634
624635   flipscreen = 0;
625636   memset(spriteram32_buffered,0,spriteram_size);
626637   memset(spriteram32,0,spriteram_size);
r2956r2957
642653   {
643654      const gfx_element *sprite_gfx = machine->gfx[2];
644655      int c;
656      int bpp_mask = (1 << f3_game_config->sprite_bpp) - 1;
645657
646658      for (c = 0;c < sprite_gfx->total_elements;c++)
647659      {
r2956r2957
652664         {
653665            for (x = 0;x < sprite_gfx->width;x++)
654666            {
667               // clear unused top bits from gfx data
668               dp[x] &= bpp_mask;
669
655670               if(!dp[x]) chk_trans_or_opa|=2;
656671               else      chk_trans_or_opa|=1;
657672            }
r2956r2957
666681   {
667682      const gfx_element *pf_gfx = machine->gfx[1];
668683      int c;
684      int bpp_mask = (1 << f3_game_config->tile_bpp) - 1;
669685
670686      for (c = 0;c < pf_gfx->total_elements;c++)
671687      {
r2956r2957
676692         {
677693            for (x = 0;x < pf_gfx->width;x++)
678694            {
695               // clear unused top bits from gfx data
696               dp[x] &= bpp_mask;
697
679698               if(!dp[x]) chk_trans_or_opa|=2;
680699               else      chk_trans_or_opa|=1;
681700            }
r2956r2957
31573176{
31583177   const struct tempsprite *sprite_ptr;
31593178   const gfx_element *sprite_gfx = machine->gfx[2];
3179   int color_mask;
31603180
31613181   sprite_ptr = sprite_end;
31623182   sprite_pri_usage=0;
3183
3184   // if sprites use more than 4bpp, the bottom bits of the color code must be masked out.
3185   // This fixes (at least) stage 1 battle ships and attract mode explosions in Ray Force.
3186   color_mask = ~((1 << (f3_game_config->sprite_bpp - 4)) - 1);
3187
31633188   while (sprite_ptr != spritelist)
31643189   {
31653190      int pri;
r2956r2957
31723197         f3_drawgfx(machine,
31733198               bitmap,sprite_gfx,
31743199               sprite_ptr->code,
3175               sprite_ptr->color,
3200               sprite_ptr->color & color_mask,
31763201               sprite_ptr->flipx,sprite_ptr->flipy,
31773202               sprite_ptr->x,sprite_ptr->y,
31783203               cliprect,
r2956r2957
31813206         f3_drawgfxzoom(machine,
31823207               bitmap,sprite_gfx,
31833208               sprite_ptr->code,
3184               sprite_ptr->color,
3209               sprite_ptr->color & color_mask,
31853210               sprite_ptr->flipx,sprite_ptr->flipy,
31863211               sprite_ptr->x,sprite_ptr->y,
31873212               cliprect,
src/mame/video/champbas.c
r2956r2957
7272
7373   for (i = 0; i < 0x200; i++)
7474   {
75      UINT8 ctabentry = ((i & 0x100) >> 4) | (color_prom[i & 0xff] & 0x0f);
75      UINT8 ctabentry = (color_prom[i & 0xff] & 0x0f) | ((i & 0x100) >> 4);
7676      colortable_entry_set_value(machine->colortable, i, ctabentry);
7777   }
7878}
7979
8080
81PALETTE_INIT( exctsccr )
82{
83   int i;
8184
85   /* allocate the colortable */
86   machine->colortable = colortable_alloc(machine, 0x20);
8287
83static TILE_GET_INFO( get_bg_tile_info )
88   /* create a lookup table for the palette */
89   for (i = 0; i < 0x20; i++)
90   {
91      int bit0, bit1, bit2;
92      int r, g, b;
93
94      /* red component */
95      bit0 = (color_prom[i] >> 0) & 0x01;
96      bit1 = (color_prom[i] >> 1) & 0x01;
97      bit2 = (color_prom[i] >> 2) & 0x01;
98      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
99
100      /* green component */
101      bit0 = (color_prom[i] >> 3) & 0x01;
102      bit1 = (color_prom[i] >> 4) & 0x01;
103      bit2 = (color_prom[i] >> 5) & 0x01;
104      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
105
106      /* blue component */
107      bit0 = 0;
108      bit1 = (color_prom[i] >> 6) & 0x01;
109      bit2 = (color_prom[i] >> 7) & 0x01;
110      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
111
112      colortable_palette_set_color(machine->colortable, i, MAKE_RGB(r, g, b));
113   }
114
115   /* color_prom now points to the beginning of the lookup table */
116   color_prom += 0x20;
117
118   /* characters / sprites (3bpp) */
119   for (i = 0; i < 0x100; i++)
120   {
121      int swapped_i = BITSWAP8(i,2,7,6,5,4,3,1,0);
122      UINT8 ctabentry = (color_prom[swapped_i] & 0x0f) | ((i & 0x80) >> 3);
123      colortable_entry_set_value(machine->colortable, i, ctabentry);
124   }
125
126   /* sprites (4bpp) */
127   for (i = 0; i < 0x100; i++)
128   {
129      UINT8 ctabentry = (color_prom[0x100 + i] & 0x0f) | 0x10;
130      colortable_entry_set_value(machine->colortable, i + 0x100, ctabentry);
131   }
132}
133
134
135
136static TILE_GET_INFO( champbas_get_bg_tile_info )
84137{
85138   int code = champbas_bg_videoram[tile_index] | (gfx_bank << 8);
86   int color = (champbas_bg_videoram[tile_index + 0x400] & 0x1f) | 0x20 | (palette_bank << 6);
139   int color = (champbas_bg_videoram[tile_index + 0x400] & 0x1f) | 0x20;
87140
88141   SET_TILE_INFO(0, code, color, 0);
89142}
90143
144static TILE_GET_INFO( exctsccr_get_bg_tile_info )
145{
146   int code = champbas_bg_videoram[tile_index] | (gfx_bank << 8);
147   int color = champbas_bg_videoram[tile_index + 0x400] & 0x0f;
91148
149   SET_TILE_INFO(0, code, color, 0);
150}
92151
152
153
93154VIDEO_START( champbas )
94155{
95   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
156   bg_tilemap = tilemap_create(champbas_get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
96157
97158   // talbot has only 1 bank
98159   gfx_bank = 0;
99160   palette_bank = 0;
100161}
101162
163VIDEO_START( exctsccr )
164{
165   bg_tilemap = tilemap_create(exctsccr_get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
166}
102167
103168
104169
r2956r2957
120185
121186WRITE8_HANDLER( champbas_palette_bank_w )
122187{
123   data &= 1;
124   if (palette_bank != data)
125   {
126      palette_bank = data;
127      tilemap_mark_all_tiles_dirty(bg_tilemap);
128   }
188   palette_bank = data & 1;
189   tilemap_set_palette_offset(bg_tilemap, palette_bank << 8);
129190}
130191
131192WRITE8_HANDLER( champbas_flipscreen_w )
r2956r2957
135196
136197
137198
138static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
199static void champbas_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
139200{
140201   int offs;
141202   const gfx_element* const gfx = machine->gfx[1];
r2956r2957
168229   }
169230}
170231
232static void exctsccr_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
233{
234   int offs;
235   UINT8 *obj1, *obj2;
171236
237   obj1 = champbas_bg_videoram;
238   obj2 = &(spriteram[0x20]);
172239
240   for ( offs = 0x0e; offs >= 0; offs -= 2 )
241   {
242      int sx,sy,code,bank,flipx,flipy,color;
243
244      sx = obj2[offs+1] - 16;
245      sy = 255 - obj2[offs];
246
247      code = ( obj1[offs] >> 2 ) & 0x3f;
248      flipx = ( ~obj1[offs] ) & 0x01;
249      flipy = ( ~obj1[offs] ) & 0x02;
250      color = ( obj1[offs+1] ) & 0x0f;
251      bank = ( ( obj1[offs+1] >> 4 ) & 1 );
252
253      drawgfx(bitmap,machine->gfx[1],
254            code + (bank << 6),
255            color,
256            flipx, flipy,
257            sx,sy,
258            cliprect,
259            TRANSPARENCY_PEN,0);
260   }
261
262   obj1 = spriteram_2;
263   obj2 = spriteram;
264
265   for ( offs = 0x0e; offs >= 0; offs -= 2 )
266   {
267      int sx,sy,code,flipx,flipy,color;
268
269      sx = obj2[offs+1] - 16;
270      sy = 255 - obj2[offs];
271
272      code = ( obj1[offs] >> 2 ) & 0x3f;
273      flipx = ( ~obj1[offs] ) & 0x01;
274      flipy = ( ~obj1[offs] ) & 0x02;
275      color = ( obj1[offs+1] ) & 0x0f;
276
277      drawgfx(bitmap,machine->gfx[2],
278            code,
279            color,
280            flipx, flipy,
281            sx,sy,
282            cliprect,
283            TRANSPARENCY_PENS,
284            colortable_get_transpen_mask(machine->colortable, machine->gfx[2], color, 0x10));
285   }
286}
287
288
289
173290VIDEO_UPDATE( champbas )
174291{
175292   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
176   draw_sprites(screen->machine, bitmap, cliprect);
293   champbas_draw_sprites(screen->machine, bitmap, cliprect);
177294   return 0;
178295}
296
297VIDEO_UPDATE( exctsccr )
298{
299   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
300   exctsccr_draw_sprites(screen->machine, bitmap, cliprect);
301   return 0;
302}
src/mame/video/thepit.c
r2956r2957
233233       horizontal flip switch. (This is how the real PCB does it) */
234234   if (thepit_flip_screen_x)
235235   {
236      return input_port_read_indexed(machine, 3);
236      return input_port_read(machine, "IN2");
237237   }
238238   else
239239   {
240      return input_port_read_indexed(machine, 0);
240      return input_port_read(machine, "IN0");
241241   }
242242}
243243
src/mame/video/shisen.c
r2956r2957
6060
6161VIDEO_UPDATE( sichuan2 )
6262{
63   // on Irem boards, screen flip is handled in both hardware and software.
64   // this game doesn't have cocktail mode so if there's software control we don't
65   // know where it is mapped.
66   flip_screen_set(~input_port_read(screen->machine, "DSW2") & 1);
67
68
6369   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
6470   return 0;
6571}
src/mame/tiny.mak
r2956r2957
3737CPUS += M6502
3838CPUS += M6808
3939CPUS += M6809
40CPUS += M68000
41CPUS += DS5002FP
4042
4143
4244
r2956r2957
5557SOUNDS += TMS5220
5658SOUNDS += OKIM6295
5759SOUNDS += HC55516
60SOUNDS += YM3812
5861
5962
6063
r2956r2957
7881   $(DRIVERS)/williams.o $(MACHINE)/williams.o $(AUDIO)/williams.o $(VIDEO)/williams.o \
7982   $(AUDIO)/gorf.o \
8083   $(AUDIO)/wow.o \
84   $(DRIVERS)/gaelco.o $(VIDEO)/gaelco.o $(MACHINE)/gaelcrpt.o \
85   $(DRIVERS)/wrally.o $(MACHINE)/wrally.o $(VIDEO)/wrally.o \
8186
8287
8388
src/mame/drivers/tryout.c
r2956r2957
6161   AM_RANGE(0xc800, 0xc87f) AM_RAM AM_BASE(&spriteram)
6262   AM_RANGE(0xcc00, 0xcc7f) AM_RAM AM_BASE(&spriteram_2)
6363   AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(tryout_vram_r, tryout_vram_w)
64   AM_RANGE(0xe000, 0xe000) AM_READ(input_port_0_r)
65   AM_RANGE(0xe001, 0xe001) AM_READ(input_port_1_r)
66   AM_RANGE(0xe002, 0xe002) AM_READ(input_port_2_r)
67   AM_RANGE(0xe003, 0xe003) AM_READ(input_port_3_r)
64   AM_RANGE(0xe000, 0xe000) AM_READ_PORT("DSW")
65   AM_RANGE(0xe001, 0xe001) AM_READ_PORT("P1")
66   AM_RANGE(0xe002, 0xe002) AM_READ_PORT("P2")
67   AM_RANGE(0xe003, 0xe003) AM_READ_PORT("SYSTEM")
6868   AM_RANGE(0xe301, 0xe301) AM_WRITE(tryout_flipscreen_w)
6969   AM_RANGE(0xe302, 0xe302) AM_WRITE(tryout_bankswitch_w)
7070   AM_RANGE(0xe401, 0xe401) AM_WRITE(tryout_vram_bankswitch_w)
r2956r2957
8484ADDRESS_MAP_END
8585
8686static INPUT_PORTS_START( tryout )
87   PORT_START
87   PORT_START_TAG("DSW")
8888   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
8989   PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
9090   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
r2956r2957
108108   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
109109   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
110110
111   PORT_START
111   PORT_START_TAG("P1")
112112   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
113113   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
114114   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
r2956r2957
118118   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
119119   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
120120
121   PORT_START
121   PORT_START_TAG("P2")
122122   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT   ) PORT_4WAY PORT_COCKTAIL
123123   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_4WAY PORT_COCKTAIL
124124   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_4WAY PORT_COCKTAIL
r2956r2957
128128   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
129129   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
130130
131   PORT_START
131   PORT_START_TAG("SYSTEM")
132132   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
133133   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
134134   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(2)
r2956r2957
183183
184184static INTERRUPT_GEN( tryout_interrupt )
185185{
186   if ((input_port_read_indexed(machine, 3) & 0x1c)!=0x1c)
186   if ((input_port_read(machine, "SYSTEM") & 0x1c) != 0x1c)
187187      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, ASSERT_LINE);
188188}
189189
src/mame/drivers/tempest.c
r2956r2957
348348
349349static READ8_HANDLER( tempest_IN0_r )
350350{
351   int res = input_port_read_indexed(machine, 0);
351   int res = input_port_read(machine, "IN0");
352352
353353   if (avgdvg_done())
354354      res |= 0x40;
r2956r2957
363363
364364static READ8_HANDLER( input_port_1_bit_r )
365365{
366   return (input_port_read_indexed(machine, 1) & (1 << offset)) ? 0 : 228;
366   return (input_port_read(machine, "IN1/DSW0") & (1 << offset)) ? 0 : 228;
367367}
368368
369369
370370static READ8_HANDLER( input_port_2_bit_r )
371371{
372   return (input_port_read_indexed(machine, 2) & (1 << offset)) ? 0 : 228;
372   return (input_port_read(machine, "IN2") & (1 << offset)) ? 0 : 228;
373373}
374374
375375
r2956r2957
410410   AM_RANGE(0x0000, 0x07ff) AM_RAM
411411   AM_RANGE(0x0800, 0x080f) AM_WRITE(SMH_RAM) AM_BASE(&tempest_colorram)
412412   AM_RANGE(0x0c00, 0x0c00) AM_READ(tempest_IN0_r)   /* IN0 */
413   AM_RANGE(0x0d00, 0x0d00) AM_READ(input_port_3_r)   /* DSW1 */
414   AM_RANGE(0x0e00, 0x0e00) AM_READ(input_port_4_r)   /* DSW2 */
413   AM_RANGE(0x0d00, 0x0d00) AM_READ_PORT("DSW1")   /* DSW1 */
414   AM_RANGE(0x0e00, 0x0e00) AM_READ_PORT("DSW2")   /* DSW2 */
415415   AM_RANGE(0x2000, 0x2fff) AM_RAM AM_BASE(&vectorram) AM_SIZE(&vectorram_size) AM_REGION(REGION_CPU1, 0x2000)
416416   AM_RANGE(0x3000, 0x3fff) AM_READ(SMH_ROM)
417417   AM_RANGE(0x4000, 0x4000) AM_WRITE(tempest_coin_w)
src/mame/drivers/segaxbd.c
r2956r2957
289289                D6: /INTR of ADC0804
290290                D5-D0: CN C pin 24-19 (switch state 0= open, 1= closed)
291291            */
292         return iochip_r(0, 0, input_port_read_indexed(machine, 0));
292         return iochip_r(0, 0, input_port_read(machine, "IO0PORTA"));
293293
294294      case 1:
295295         /* I/O port: CN C pins 17,15,13,11,9,7,5,3 */
296         return iochip_r(0, 1, input_port_read_indexed(machine, 1));
296         return iochip_r(0, 1, input_port_read(machine, "IO0PORTB"));
297297
298298      case 2:
299299         /* Output port */
r2956r2957
364364   {
365365      case 0:
366366         /* Input port: switches, CN D pin A1-8 (switch state 1= open, 0= closed) */
367         return iochip_r(1, 0, input_port_read_indexed(machine, 2));
367         return iochip_r(1, 0, input_port_read(machine, "IO1PORTA"));
368368
369369      case 1:
370370         /* Input port: switches, CN D pin A9-16 (switch state 1= open, 0= closed) */
371         return iochip_r(1, 1, input_port_read_indexed(machine, 3));
371         return iochip_r(1, 1, input_port_read(machine, "IO1PORTB"));
372372
373373      case 2:
374374         /* Input port: DIP switches (1= off, 0= on) */
375         return iochip_r(1, 2, input_port_read_indexed(machine, 4));
375         return iochip_r(1, 2, input_port_read(machine, "IO1PORTC"));
376376
377377      case 3:
378378         /* Input port: DIP switches (1= off, 0= on) */
379         return iochip_r(1, 3, input_port_read_indexed(machine, 5));
379         return iochip_r(1, 3, input_port_read(machine, "IO1PORTD"));
380380
381381      case 4:
382382         /* Unused */
src/mame/drivers/simpl156.c
r2956r2957
104104
105105
106106static INPUT_PORTS_START( simpl156 )
107   PORT_START   /* 16bit */
107   PORT_START_TAG("IN0")   /* 16bit */
108108   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
109109   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
110110   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
113113   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_SPECIAL ) // eeprom?..
114114
115115
116   PORT_START   /* 16bit */
116   PORT_START_TAG("IN1")   /* 16bit */
117117   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
118118   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
119119   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
138138   int eep = eeprom_read_bit();
139139   UINT32 returndata;
140140
141   returndata = input_port_read_indexed(machine, 0)^0xffff0000;
141   returndata = input_port_read(machine, "IN0") ^ 0xffff0000;
142142
143143   returndata^= ( (eep<<8)  );
144144   return returndata;
r2956r2957
169169{
170170   UINT32 returndata;
171171
172   returndata = input_port_read_indexed(machine, 1);
172   returndata = input_port_read(machine, "IN1");
173173
174174   return returndata;
175175}
src/mame/drivers/sprint2.c
r2956r2957
4949
5050static int service_mode(running_machine *machine)
5151{
52   UINT8 v = input_port_read_indexed(machine, 2);
52   UINT8 v = input_port_read(machine, "INB");
5353
5454   if (GAME_IS_SPRINT1)
5555   {
r2956r2957
8080
8181      for (i = 0; i < 2; i++)
8282      {
83         signed char delta = input_port_read_indexed(machine, 6 + i) - dial[i];
83         signed char delta = input_port_read(machine, i ? "DIAL_P2" : "DIAL_P1") - dial[i];
8484
8585         if (delta < 0)
8686         {
r2956r2957
9393
9494         dial[i] += delta;
9595
96         switch (input_port_read_indexed(machine, 4 + i) & 15)
96         switch (input_port_read(machine, i ? "GEAR_P2" : "GEAR_P1") & 15)
9797         {
9898         case 1: gear[i] = 1; break;
9999         case 2: gear[i] = 2; break;
r2956r2957
124124
125125static READ8_HANDLER( sprint2_dip_r )
126126{
127   return (input_port_read_indexed(machine, 0) << (2 * ((offset & 3) ^ 3))) & 0xc0;
127   return (input_port_read(machine, "DSW") << (2 * ((offset & 3) ^ 3))) & 0xc0;
128128}
129129
130130
131131static READ8_HANDLER( sprint2_input_A_r )
132132{
133   UINT8 val = input_port_read_indexed(machine, 1);
133   UINT8 val = input_port_read(machine, "INA");
134134
135135   if (GAME_IS_SPRINT2)
136136   {
r2956r2957
148148
149149static READ8_HANDLER( sprint2_input_B_r )
150150{
151   UINT8 val = input_port_read_indexed(machine, 2);
151   UINT8 val = input_port_read(machine, "INB");
152152
153153   if (GAME_IS_SPRINT1)
154154   {
r2956r2957
250250   AM_RANGE(0x0818, 0x081f) AM_READ(sprint2_input_A_r)
251251   AM_RANGE(0x0828, 0x082f) AM_READ(sprint2_input_B_r)
252252   AM_RANGE(0x0830, 0x0837) AM_READ(sprint2_dip_r)
253   AM_RANGE(0x0840, 0x087f) AM_READ(input_port_3_r)
253   AM_RANGE(0x0840, 0x087f) AM_READ_PORT("COIN")
254254   AM_RANGE(0x0880, 0x08bf) AM_READ(sprint2_steering1_r)
255255   AM_RANGE(0x08c0, 0x08ff) AM_READ(sprint2_steering2_r)
256256   AM_RANGE(0x0c00, 0x0fff) AM_READ(sprint2_sync_r)
r2956r2957
283283
284284
285285static INPUT_PORTS_START( sprint2 )
286   PORT_START
286   PORT_START_TAG("DSW")
287287   PORT_DIPNAME( 0x01, 0x00, "Tracks on Demo" )
288288   PORT_DIPSETTING(    0x00, "Easy Track Only" )
289289   PORT_DIPSETTING(    0x01, "Cycle 12 Tracks" )
r2956r2957
307307   PORT_DIPSETTING(    0x40, "120 seconds" )
308308   PORT_DIPSETTING(    0x00, "150 seconds" )
309309
310   PORT_START /* input A */
310   PORT_START_TAG("INA")   /* input A */
311311   PORT_BIT (0x01, IP_ACTIVE_LOW, IPT_UNUSED ) /* P1 1st gear */
312312   PORT_BIT (0x02, IP_ACTIVE_LOW, IPT_UNUSED ) /* P2 1st gear */
313313   PORT_BIT (0x04, IP_ACTIVE_LOW, IPT_UNUSED ) /* P1 2nd gear */
r2956r2957
315315   PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_UNUSED ) /* P1 3rd gear */
316316   PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_UNUSED ) /* P2 3rd gear */
317317
318   PORT_START /* input B */
318   PORT_START_TAG("INB")   /* input B */
319319   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 1 Gas") PORT_PLAYER(1)
320320   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Player 2 Gas") PORT_PLAYER(2)
321321   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
r2956r2957
324324   PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_START2 )
325325   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE)
326326
327   PORT_START
327   PORT_START_TAG("COIN")
328328   PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
329329   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
330330
331   PORT_START
331   PORT_START_TAG("GEAR_P1")
332332   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Player 1 Gear 1") PORT_CODE(KEYCODE_Z) PORT_PLAYER(1)
333333   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Player 1 Gear 2") PORT_CODE(KEYCODE_X) PORT_PLAYER(1)
334334   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Player 1 Gear 3") PORT_CODE(KEYCODE_C) PORT_PLAYER(1)
335335   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Player 1 Gear 4") PORT_CODE(KEYCODE_V) PORT_PLAYER(1)
336336
337   PORT_START
337   PORT_START_TAG("GEAR_P2")
338338   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Player 2 Gear 1") PORT_CODE(KEYCODE_Q) PORT_PLAYER(2)
339339   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Player 2 Gear 2") PORT_CODE(KEYCODE_W) PORT_PLAYER(2)
340340   PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Player 2 Gear 3") PORT_CODE(KEYCODE_E) PORT_PLAYER(2)
341341   PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Player 2 Gear 4") PORT_CODE(KEYCODE_R) PORT_PLAYER(2)
342342
343   PORT_START
343   PORT_START_TAG("DIAL_P1")
344344   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
345345
346   PORT_START
346   PORT_START_TAG("DIAL_P2")
347347   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
348348
349349   PORT_START_TAG("MOTOR1")
r2956r2957
355355
356356
357357static INPUT_PORTS_START( sprint1 )
358   PORT_START
358   PORT_START_TAG("DSW")
359359   PORT_DIPNAME( 0x01, 0x00, "Change Track" )
360360   PORT_DIPSETTING(    0x01, "Every Lap" )
361361   PORT_DIPSETTING(    0x00, "Every 2 Laps" )
r2956r2957
379379   PORT_DIPSETTING(    0x40, "120 seconds" )
380380   PORT_DIPSETTING(    0x00, "150 seconds" )
381381
382   PORT_START /* input A */
382   PORT_START_TAG("INA")   /* input A */
383383
384   PORT_START /* input B */
384   PORT_START_TAG("INB")   /* input B */
385385   PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) /* 1st gear */
386386   PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) /* 2nd gear */
387387   PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) /* 3rd gear */
r2956r2957
389389   PORT_SERVICE( 0x10, IP_ACTIVE_LOW )
390390   PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_START1 )
391391
392   PORT_START
392   PORT_START_TAG("COIN")
393393   PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
394394   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
395395
396   PORT_START
396   PORT_START_TAG("GEAR_P1")
397397   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Gear 1") PORT_CODE(KEYCODE_Z)
398398   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Gear 2") PORT_CODE(KEYCODE_X)
399399   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Gear 3") PORT_CODE(KEYCODE_C)
400400   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Gear 4") PORT_CODE(KEYCODE_V)
401401
402   PORT_START
402   PORT_START_TAG("GEAR_P2")
403403
404   PORT_START
404   PORT_START_TAG("DIAL_P1")
405405   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10)
406406
407   PORT_START
407   PORT_START_TAG("DIAL_P2")
408408
409409   PORT_START_TAG("MOTOR")
410410   PORT_ADJUSTER( 30, "Motor RPM" )
r2956r2957
412412
413413
414414static INPUT_PORTS_START( dominos )
415   PORT_START
415   PORT_START_TAG("DSW")
416416   PORT_DIPNAME( 0x03, 0x01, "Points to Win" )
417417   PORT_DIPSETTING(   0x03, "6" )
418418   PORT_DIPSETTING(   0x02, "5" )
r2956r2957
435435   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
436436   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
437437
438   PORT_START /* input A */
438   PORT_START_TAG("INA")   /* input A */
439439   PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2)
440440   PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2)
441441   PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2)
442442   PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2)
443443
444   PORT_START /* input B */
444   PORT_START_TAG("INB")   /* input B */
445445   PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1)
446446   PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1)
447447   PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1)
r2956r2957
450450   PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_START2 )
451451   PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
452452
453   PORT_START
453   PORT_START_TAG("COIN")
454454   PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
455455   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
456456
src/mame/drivers/seibuspi.c
r2956r2957
890890
891891static READ32_HANDLER( spi_controls1_r )
892892{
893   if( ACCESSING_BITS_0_7 ) {
894      return (input_port_read_indexed(machine, 1) << 8) | input_port_read_indexed(machine, 0) | 0xffff0000;
893   if( ACCESSING_BITS_0_7 )
894   {
895      return (input_port_read(machine, "P2") << 8) | input_port_read(machine, "P1") | 0xffff0000;
895896   }
896897   return 0xffffffff;
897898}
898899
899900static READ32_HANDLER( spi_controls2_r )
900901{
901   if( ACCESSING_BITS_0_7 ) {
902      return ((input_port_read_indexed(machine, 2) | 0xffffff00) & ~0x40) | (eeprom_read_bit() << 6);
902   if( ACCESSING_BITS_0_7 )
903   {
904      return ((input_port_read(machine, "SYSTEM") | 0xffffff00) & ~0x40) | (eeprom_read_bit() << 6);
903905   }
904906   return 0xffffffff;
905907}
r2956r2957
963965
964966static READ8_HANDLER( z80_jp1_r )
965967{
966   return input_port_read_indexed(machine, 3);
968   return input_port_read(machine, "JP1");
967969}
968970
969971static READ8_HANDLER( z80_coin_r )
970972{
971   return input_port_read_indexed(machine, 4);
973   return input_port_read(machine, "COIN");
972974}
973975
974976static READ32_HANDLER( soundrom_r )
r2956r2957
11171119/********************************************************************/
11181120
11191121static INPUT_PORTS_START( spi_2button )
1120   PORT_START_TAG("IN0")
1122   PORT_START_TAG("P1")
11211123   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
11221124   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
11231125   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
11261128   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
11271129   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
11281130   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
1129   PORT_START_TAG("IN1")
1131
1132   PORT_START_TAG("P2")
11301133   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
11311134   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
11321135   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
11361139   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
11371140   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
11381141
1139   PORT_START_TAG("IN2")
1142   PORT_START_TAG("SYSTEM")
11401143   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
11411144   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
11421145   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW) /* Test Button */
r2956r2957
11501153   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
11511154   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
11521155
1153   PORT_START_TAG("IN3")
1156   PORT_START_TAG("COIN")
11541157   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
11551158   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
11561159   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
11571160INPUT_PORTS_END
11581161
11591162static INPUT_PORTS_START( spi_3button )
1160   PORT_START_TAG("IN0")
1163   PORT_START_TAG("P1")
11611164   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
11621165   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
11631166   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
11661169   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
11671170   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
11681171   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
1169   PORT_START_TAG("IN1")
1172
1173   PORT_START_TAG("P2")
11701174   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
11711175   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
11721176   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
11761180   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
11771181   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
11781182
1179   PORT_START_TAG("IN2")
1183   PORT_START_TAG("SYSTEM")
11801184   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
11811185   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
11821186   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )
r2956r2957
11901194   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
11911195   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
11921196
1193   PORT_START_TAG("IN3")
1197   PORT_START_TAG("COIN")
11941198   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
11951199   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
11961200   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
11971201INPUT_PORTS_END
11981202
11991203static INPUT_PORTS_START( seibu386_2button )
1200   PORT_START_TAG("IN0")
1204   PORT_START_TAG("P1")
12011205   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
12021206   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
12031207   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
12061210   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
12071211   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
12081212   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
1209   PORT_START_TAG("IN1")
1213
1214   PORT_START_TAG("P2")
12101215   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
12111216   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
12121217   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
12161221   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
12171222   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
12181223
1219   PORT_START_TAG("IN2")
1224   PORT_START_TAG("SYSTEM")
12201225   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
12211226   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
12221227   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW) /* Test Button */
r2956r2957
12701275}
12711276
12721277static INPUT_PORTS_START( spi_ejanhs )
1273   PORT_START_TAG("IN0")
1278   PORT_START_TAG("P1")
12741279   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(ejanhs_encode, "IN0BITS")
12751280
1276   PORT_START_TAG("IN1")
1281   PORT_START_TAG("P2")
12771282   PORT_BIT( 0x3f, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(ejanhs_encode, "IN1BITS")
12781283
1279   PORT_START_TAG("IN2")
1284   PORT_START_TAG("SYSTEM")
12801285   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )
12811286   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service Coin") PORT_CODE(KEYCODE_7)
12821287   PORT_BIT( 0xf3, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
12881293   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
12891294   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
12901295
1291   PORT_START_TAG("IN3")
1296   PORT_START_TAG("COIN")
12921297   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
12931298   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
12941299   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
19571962      cpu_spinuntil_int(); // idle
19581963      // Hack to enter test mode
19591964      r = spimainram[(0x002894c-0x800)/4] & (~0x400);
1960      return r | (((input_port_read_indexed(machine, 2) ^ 0xFF)<<8) & 0x400);
1965      return r | (((input_port_read(machine, "SYSTEM") ^ 0xff)<<8) & 0x400);
19611966   }
19621967
19631968   /* rfjetj */
src/mame/drivers/speedatk.c
r2956r2957
9696   {
9797      case 0x02:
9898      {
99         switch(input_port_read_indexed(machine, 1))
99         switch(input_port_read(machine, "P1"))
100100         {
101101            case 0x002: return 0x02;
102102            case 0x001: return 0x01;
r2956r2957
115115      }
116116      case 0x04:
117117      {
118         switch(input_port_read_indexed(machine, 2))
118         switch(input_port_read(machine, "P2"))
119119         {
120120            case 0x002: return 0x02;
121121            case 0x001: return 0x01;
r2956r2957
171171
172172static ADDRESS_MAP_START( readport, ADDRESS_SPACE_IO, 8 )
173173   ADDRESS_MAP_GLOBAL_MASK(0xff)
174   AM_RANGE(0x40, 0x40) AM_READ(input_port_0_r)
174   AM_RANGE(0x40, 0x40) AM_READ_PORT("DSW")
175175   /* are these not used? after they're read it sets bit 7 */
176176   AM_RANGE(0x60, 0x60) AM_READ(SMH_NOP)
177177   AM_RANGE(0x61, 0x61) AM_READ(SMH_NOP)
r2956r2957
186186ADDRESS_MAP_END
187187
188188static INPUT_PORTS_START( speedatk )
189   PORT_START
189   PORT_START_TAG("DSW")
190190   PORT_SERVICE( 0x01, IP_ACTIVE_HIGH )
191191   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Flip_Screen ) )
192192   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
r2956r2957
209209   PORT_DIPSETTING(    0x80, DEF_STR( 1C_5C ) )
210210   PORT_DIPSETTING(    0xc0, "1 Coin/10 Credits" )
211211
212   PORT_START
212   PORT_START_TAG("P1")
213213   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) //P1 A
214214   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) //P1 B
215215   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1) //P1 C
r2956r2957
223223   PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_UNUSED )
224224   PORT_BIT( 0x800, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(2)
225225
226   PORT_START
226   PORT_START_TAG("P2")
227227   PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) //P2 A
228228   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) //P2 B
229229   PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2) //P2 C
src/mame/drivers/suprnova.c
r2956r2957
186186#include "driver.h"
187187#include "deprecat.h"
188188#include "sound/ymz280b.h"
189#include "cpu/sh2/sh2.h"
189190
190191#define BIOS_SKIP 1 // Skip Bios as it takes too long and doesn't complete atm.
191192
r2956r2957
702703
703704static READ32_HANDLER( nova_input_port_0_r )
704705{
705   return input_port_read_indexed(machine, 0)<<24 | input_port_read_indexed(machine, 1)<<16 | input_port_read_indexed(machine, 2)<<8 | input_port_read_indexed(machine, 3);
706   return input_port_read(machine, "IN0")<<24 | input_port_read(machine, "IN1")<<16 | input_port_read(machine, "IN2")<<8 | input_port_read(machine, "IN3");
706707}
707708
708709static READ32_HANDLER( nova_input_port_3_r )
709710{
710   return input_port_read_indexed(machine, 8) | 0xffffff00;
711   return input_port_read(machine, "Paddle D") | 0xffffff00;
711712}
712713
713714static READ32_HANDLER( nova_input_port_dip_r )
714715{
715   return input_port_read_indexed(machine, 4)<<24 | input_port_read_indexed(machine, 5)<<16 | input_port_read_indexed(machine, 6)<<8 | input_port_read_indexed(machine, 7);
716   return input_port_read(machine, "Paddle A")<<24 | input_port_read(machine, "Paddle B")<<16 | input_port_read(machine, "Paddle C")<<8 | input_port_read(machine, "DSW");
716717}
717718
718719static UINT32 timer_0_temp[4];
r2956r2957
770771                cpunum_set_input_line(machine, 0,0xf,CLEAR_LINE);*/
771772
772773         /* idle skip for vblokbrk/sarukani, i can't find a better place to put it :-( but i think it works ok unless its making the game too fast */
773         if (activecpu_get_pc()==0x04013B44)
774         if (activecpu_get_pc()==0x04013B42)
774775         {
775776            if (!strcmp(machine->gamedrv->name,"vblokbrk") ||
776777               !strcmp(machine->gamedrv->name,"sarukani"))
r2956r2957
986987static READ32_HANDLER( bios_skip_r )
987988{
988989#if BIOS_SKIP
989   if (activecpu_get_pc()==0x6fa) program_write_byte(0x06000029,1);
990   if ((activecpu_get_pc()==0x6f8) || (activecpu_get_pc()==0x6fa)) program_write_byte(0x06000029,1);
990991#endif
991992   return skns_main_ram[0x00028/4];
992993}
r2956r2957
10031004    04022072: CMP/EQ  R2,R3
10041005    04022074: BT      $0402206C
10051006*/
1006   if (activecpu_get_pc()==0x4022070)
1007   if (activecpu_get_pc()==0x402206e)
10071008   {
10081009      if(skns_main_ram[0x00078/4] == skns_main_ram[0x0c780/4])
10091010         cpu_spinuntil_int();
r2956r2957
10131014
10141015static READ32_HANDLER( cyvern_speedup_r )
10151016{
1016   if (activecpu_get_pc()==0x402ebd4) cpu_spinuntil_int();
1017   if (activecpu_get_pc()==0x402ebd2) cpu_spinuntil_int();
10171018   return skns_main_ram[0x4d3c8/4];
10181019}
10191020
10201021static READ32_HANDLER( puzloopj_speedup_r )
10211022{
1022   if (activecpu_get_pc()==0x401dca2) cpu_spinuntil_int();
1023   if (activecpu_get_pc()==0x401dca0) cpu_spinuntil_int();
10231024   return skns_main_ram[0x86714/4];
10241025}
10251026
10261027static READ32_HANDLER( puzloopu_speedup_r )
10271028{
1028   if (activecpu_get_pc()==0x401dab2) cpu_spinuntil_int();
1029   if (activecpu_get_pc()==0x401dab0) cpu_spinuntil_int();
10291030   return skns_main_ram[0x85cec/4];
10301031}
10311032
r2956r2957
10381039    0401DA18: BF      $0401DA26
10391040    0401DA26: BRA     $0401DA12
10401041*/
1041   if (activecpu_get_pc()==0x401da16) cpu_spinuntil_int();
1042   if (activecpu_get_pc()==0x401da14) cpu_spinuntil_int();
10421043   return skns_main_ram[0x81d38/4];
10431044}
10441045
10451046static READ32_HANDLER( senknow_speedup_r )
10461047{
1047   if (activecpu_get_pc()==0x4017dd0) cpu_spinuntil_int();
1048   if (activecpu_get_pc()==0x4017dce) cpu_spinuntil_int();
10481049   return skns_main_ram[0x0000dc/4];
10491050}
10501051
10511052static READ32_HANDLER( teljan_speedup_r )
10521053{
1053   if (activecpu_get_pc()==0x401ba34) cpu_spinuntil_int();
1054   if (activecpu_get_pc()==0x401ba32) cpu_spinuntil_int();
10541055   return skns_main_ram[0x002fb4/4];
10551056}
10561057
10571058static READ32_HANDLER( jjparads_speedup_r )
10581059{
1059   if (activecpu_get_pc()==0x4015e86) cpu_spinuntil_int();
1060   if (activecpu_get_pc()==0x4015e84) cpu_spinuntil_int();
10601061   return skns_main_ram[0x000994/4];
10611062}
10621063
10631064static READ32_HANDLER( jjparad2_speedup_r )
10641065{
1065   if (activecpu_get_pc()==0x401620c) cpu_spinuntil_int();
1066   if (activecpu_get_pc()==0x401620a) cpu_spinuntil_int();
10661067   return skns_main_ram[0x000984/4];
10671068}
10681069
10691070static READ32_HANDLER( ryouran_speedup_r )
10701071{
1071   if (activecpu_get_pc()==0x40182d0) cpu_spinuntil_int();
1072   if (activecpu_get_pc()==0x40182ce) cpu_spinuntil_int();
10721073   return skns_main_ram[0x000a14/4];
10731074}
10741075
10751076static READ32_HANDLER( galpans2_speedup_r )
10761077{
1077   if (activecpu_get_pc()==0x4049ae4) cpu_spinuntil_int();
1078   if (activecpu_get_pc()==0x4049ae2) cpu_spinuntil_int();
10781079   return skns_main_ram[0x0fb6bc/4];
10791080}
10801081
10811082static READ32_HANDLER( panicstr_speedup_r )
10821083{
1083   if (activecpu_get_pc()==0x404e68c) cpu_spinuntil_int();
1084   if (activecpu_get_pc()==0x404e68a) cpu_spinuntil_int();
10841085   return skns_main_ram[0x0f19e4/4];
10851086}
10861087
10871088static READ32_HANDLER( sengekis_speedup_r ) // 60006ee  600308e
10881089{
1089   if (activecpu_get_pc()==0x60006ee) cpu_spinuntil_int();
1090   if (activecpu_get_pc()==0x60006ec) cpu_spinuntil_int();
10901091   return skns_main_ram[0xb74bc/4];
10911092}
10921093
10931094static READ32_HANDLER( sengekij_speedup_r ) // 60006ee  600308e
10941095{
1095   if (activecpu_get_pc()==0x60006ee) cpu_spinuntil_int();
1096   if (activecpu_get_pc()==0x60006ec) cpu_spinuntil_int();
10961097   return skns_main_ram[0xb7380/4];
10971098}
10981099
10991100static void init_skns(running_machine *machine)
11001101{
1102   // init DRC to fastest options
1103   cpunum_set_info_int(0, CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1104
1105   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
1106   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6f8);
11011107   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000028, 0x600002b, 0, 0, bios_skip_r );
11021108}
11031109
1104static DRIVER_INIT( galpani4 ) { skns_sprite_kludge(-5,-1); init_skns(machine);  } // Idle Loop caught by sh-2 core
1105static DRIVER_INIT( galpanis ) { skns_sprite_kludge(-5,-1); init_skns(machine);  } // Idle Loop caught by sh-2 core
1106static DRIVER_INIT( cyvern )   { skns_sprite_kludge(+0,+2); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x604d3c8, 0x604d3cb, 0, 0, cyvern_speedup_r );   }
1107static DRIVER_INIT( galpans2 ) { skns_sprite_kludge(-1,-1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60fb6bc, 0x60fb6bf, 0, 0, galpans2_speedup_r );  }
1108static DRIVER_INIT( gutsn )    { skns_sprite_kludge(+0,+0); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x600c780, 0x600c783, 0, 0, gutsn_speedup_r );  }
1109static DRIVER_INIT( panicstr ) { skns_sprite_kludge(-1,-1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60f19e4, 0x60f19e7, 0, 0, panicstr_speedup_r );  }
1110static DRIVER_INIT( senknow )  { skns_sprite_kludge(+1,+1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60000dc, 0x60000df, 0, 0, senknow_speedup_r );  }
1111static DRIVER_INIT( puzzloop ) { skns_sprite_kludge(-9,-1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6081d38, 0x6081d3b, 0, 0, puzzloop_speedup_r ); }
1112static DRIVER_INIT( puzloopj ) { skns_sprite_kludge(-9,-1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6086714, 0x6086717, 0, 0, puzloopj_speedup_r ); }
1113static DRIVER_INIT( puzloopu ) { skns_sprite_kludge(-9,-1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6085cec, 0x6085cef, 0, 0, puzloopu_speedup_r ); }
1114static DRIVER_INIT( jjparads ) { skns_sprite_kludge(+5,+1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000994, 0x6000997, 0, 0, jjparads_speedup_r );  }
1115static DRIVER_INIT( jjparad2 ) { skns_sprite_kludge(+5,+1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000984, 0x6000987, 0, 0, jjparad2_speedup_r );  }
1116static DRIVER_INIT( ryouran )  { skns_sprite_kludge(+5,+1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000a14, 0x6000a17, 0, 0, ryouran_speedup_r );  }
1117static DRIVER_INIT( teljan )   { skns_sprite_kludge(+5,+1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6002fb4, 0x6002fb7, 0, 0, teljan_speedup_r );  }
1118static DRIVER_INIT( sengekis ) { skns_sprite_kludge(-192,-272); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60b74bc, 0x60b74bf, 0, 0, sengekis_speedup_r ); }
1119static DRIVER_INIT( sengekij ) { skns_sprite_kludge(-192,-272); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60b7380, 0x60b7383, 0, 0, sengekij_speedup_r ); }
1120static DRIVER_INIT( sarukani ) { skns_sprite_kludge(-1,-1); init_skns(machine);  } // Speedup is in skns_io_w()
1110static void set_drc_pcflush(UINT32 addr)
1111{
1112   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
1113   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, addr);
1114}
11211115
1116static DRIVER_INIT( galpani4 ) { skns_sprite_kludge(-5,-1); init_skns(machine);  }
1117static DRIVER_INIT( galpanis ) { skns_sprite_kludge(-5,-1); init_skns(machine);  }
1118static DRIVER_INIT( cyvern )   { skns_sprite_kludge(+0,+2); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x604d3c8, 0x604d3cb, 0, 0, cyvern_speedup_r );  set_drc_pcflush(0x402ebd2);  }
1119static DRIVER_INIT( galpans2 ) { skns_sprite_kludge(-1,-1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60fb6bc, 0x60fb6bf, 0, 0, galpans2_speedup_r ); set_drc_pcflush(0x4049ae2); }
1120static DRIVER_INIT( gutsn )    { skns_sprite_kludge(+0,+0); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x600c780, 0x600c783, 0, 0, gutsn_speedup_r ); set_drc_pcflush(0x402206e); }
1121static DRIVER_INIT( panicstr ) { skns_sprite_kludge(-1,-1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60f19e4, 0x60f19e7, 0, 0, panicstr_speedup_r ); set_drc_pcflush(0x404e68a);  }
1122static DRIVER_INIT( senknow )  { skns_sprite_kludge(+1,+1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60000dc, 0x60000df, 0, 0, senknow_speedup_r ); set_drc_pcflush(0x4017dce);  }
1123static DRIVER_INIT( puzzloop ) { skns_sprite_kludge(-9,-1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6081d38, 0x6081d3b, 0, 0, puzzloop_speedup_r ); set_drc_pcflush(0x401da14); }
1124static DRIVER_INIT( puzloopj ) { skns_sprite_kludge(-9,-1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6086714, 0x6086717, 0, 0, puzloopj_speedup_r ); set_drc_pcflush(0x401dca0); }
1125static DRIVER_INIT( puzloopu ) { skns_sprite_kludge(-9,-1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6085cec, 0x6085cef, 0, 0, puzloopu_speedup_r ); set_drc_pcflush(0x401dab0); }
1126static DRIVER_INIT( jjparads ) { skns_sprite_kludge(+5,+1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000994, 0x6000997, 0, 0, jjparads_speedup_r ); set_drc_pcflush(0x4015e84); }
1127static DRIVER_INIT( jjparad2 ) { skns_sprite_kludge(+5,+1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000984, 0x6000987, 0, 0, jjparad2_speedup_r ); set_drc_pcflush(0x401620a); }
1128static DRIVER_INIT( ryouran )  { skns_sprite_kludge(+5,+1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000a14, 0x6000a17, 0, 0, ryouran_speedup_r );  set_drc_pcflush(0x40182ce); }
1129static DRIVER_INIT( teljan )   { skns_sprite_kludge(+5,+1); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6002fb4, 0x6002fb7, 0, 0, teljan_speedup_r ); set_drc_pcflush(0x401ba32); }
1130static DRIVER_INIT( sengekis ) { skns_sprite_kludge(-192,-272); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60b74bc, 0x60b74bf, 0, 0, sengekis_speedup_r ); set_drc_pcflush(0x60006ec); }
1131static DRIVER_INIT( sengekij ) { skns_sprite_kludge(-192,-272); init_skns(machine); memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60b7380, 0x60b7383, 0, 0, sengekij_speedup_r ); set_drc_pcflush(0x60006ec); }
1132static DRIVER_INIT( sarukani ) { skns_sprite_kludge(-1,-1); init_skns(machine); set_drc_pcflush(0x4013b42); } // Speedup is in skns_io_w()
11221133
11231134
1135
11241136/***** ROM LOADING *****/
11251137
11261138ROM_START( skns )
src/mame/drivers/seta2.c
r2956r2957
453453}
454454
455455static ADDRESS_MAP_START( grdians_readmem, ADDRESS_SPACE_PROGRAM, 16 )
456   AM_RANGE(0x000000, 0x1fffff) AM_READ(SMH_ROM               )   // ROM
457   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM               )   // RAM
458   AM_RANGE(0x304000, 0x30ffff) AM_READ(SMH_RAM               )   // ? seems tile data
459   AM_RANGE(0x600000, 0x600001) AM_READ(input_port_0_word_r      )   // DSW 1
460   AM_RANGE(0x600002, 0x600003) AM_READ(input_port_1_word_r      )   // DSW 2
461   AM_RANGE(0x700000, 0x700001) AM_READ(input_port_2_word_r      )   // P1
462   AM_RANGE(0x700002, 0x700003) AM_READ(input_port_3_word_r      )   // P2
463   AM_RANGE(0x700004, 0x700005) AM_READ(input_port_4_word_r      )   // Coins
456   AM_RANGE(0x000000, 0x1fffff) AM_READ(SMH_ROM            )   // ROM
457   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM            )   // RAM
458   AM_RANGE(0x304000, 0x30ffff) AM_READ(SMH_RAM            )   // ? seems tile data
459   AM_RANGE(0x600000, 0x600001) AM_READ_PORT("DSW1")            // DSW 1
460   AM_RANGE(0x600002, 0x600003) AM_READ_PORT("DSW2")            // DSW 2
461   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("P1")               // P1
462   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("P2")               // P2
463   AM_RANGE(0x700004, 0x700005) AM_READ_PORT("SYSTEM")            // Coins
464464   AM_RANGE(0x70000c, 0x70000d) AM_READ(watchdog_reset16_r      )   // Watchdog
465465   AM_RANGE(0xb00000, 0xb03fff) AM_READ(seta_sound_word_r       )   // Sound
466   AM_RANGE(0xc00000, 0xc3ffff) AM_READ(SMH_RAM               )   // Sprites
467   AM_RANGE(0xc40000, 0xc4ffff) AM_READ(SMH_RAM               )   // Palette
468   AM_RANGE(0xfffc00, 0xffffff) AM_READ(SMH_RAM               )   // TMP68301 Registers
466   AM_RANGE(0xc00000, 0xc3ffff) AM_READ(SMH_RAM            )   // Sprites
467   AM_RANGE(0xc40000, 0xc4ffff) AM_READ(SMH_RAM            )   // Palette
468   AM_RANGE(0xfffc00, 0xffffff) AM_READ(SMH_RAM            )   // TMP68301 Registers
469469ADDRESS_MAP_END
470470
471471static ADDRESS_MAP_START( grdians_writemem, ADDRESS_SPACE_PROGRAM, 16 )
r2956r2957
501501      }
502502      else
503503      {
504         int length;
505         UINT8 *dat;
504         UINT32 length, size;
505         UINT16 *dat;
506506
507         dat = eeprom_get_data_pointer(&length);
508         dat[0]=0x70;
509         dat[1]=0x08;
507         dat = eeprom_get_data_pointer(&length, &size);
508         dat[0] = 0x7008;
510509      }
511510   }
512511}
r2956r2957
524523}
525524
526525static ADDRESS_MAP_START( gundamex_readmem, ADDRESS_SPACE_PROGRAM, 16 )
527   AM_RANGE(0x000000, 0x1fffff) AM_READ(SMH_ROM               )   // ROM
528   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM               )   // RAM
529   AM_RANGE(0x500000, 0x57ffff) AM_READ(SMH_ROM               )   // ROM
530   AM_RANGE(0x600000, 0x600001) AM_READ(input_port_0_word_r      )   // DSW 1
531   AM_RANGE(0x600002, 0x600003) AM_READ(input_port_1_word_r      )   // DSW 2
532   AM_RANGE(0x700000, 0x700001) AM_READ(input_port_2_word_r      )   // P1
533   AM_RANGE(0x700002, 0x700003) AM_READ(input_port_3_word_r      )   // P2
534   AM_RANGE(0x700004, 0x700005) AM_READ(input_port_4_word_r      )   // Coins
535   AM_RANGE(0x700008, 0x700009) AM_READ(input_port_5_word_r      )   // P1
536   AM_RANGE(0x70000a, 0x70000b) AM_READ(input_port_6_word_r      )   // P2
526   AM_RANGE(0x000000, 0x1fffff) AM_READ(SMH_ROM            )   // ROM
527   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM            )   // RAM
528   AM_RANGE(0x500000, 0x57ffff) AM_READ(SMH_ROM            )   // ROM
529   AM_RANGE(0x600000, 0x600001) AM_READ_PORT("DSW1")            // DSW 1
530   AM_RANGE(0x600002, 0x600003) AM_READ_PORT("DSW2")            // DSW 2
531   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("P1")               // P1
532   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("P2")               // P2
533   AM_RANGE(0x700004, 0x700005) AM_READ_PORT("SYSTEM")            // Coins
534   AM_RANGE(0x700008, 0x700009) AM_READ_PORT("IN0")            // P1
535   AM_RANGE(0x70000a, 0x70000b) AM_READ_PORT("IN1")            // P2
537536   AM_RANGE(0xb00000, 0xb03fff) AM_READ(seta_sound_word_r       )   // Sound
538537   AM_RANGE(0xfffd0a, 0xfffd0b) AM_READ(gundamex_eeprom_r      )   // parallel data register
539538ADDRESS_MAP_END
r2956r2957
564563{
565564   switch (keyboard_row)
566565   {
567      case 0x01: return input_port_read_indexed(machine, 3);
568      case 0x02: return input_port_read_indexed(machine, 4);
569      case 0x04: return input_port_read_indexed(machine, 5);
570      case 0x08: return input_port_read_indexed(machine, 6);
571      case 0x10: return input_port_read_indexed(machine, 7);
566      case 0x01: return input_port_read(machine, "KEY0");
567      case 0x02: return input_port_read(machine, "KEY1");
568      case 0x04: return input_port_read(machine, "KEY2");
569      case 0x08: return input_port_read(machine, "KEY3");
570      case 0x10: return input_port_read(machine, "KEY4");
572571      default:   logerror("p1_r with keyboard_row = %02x\n",keyboard_row); return 0xffff;
573572   }
574573}
r2956r2957
580579}
581580
582581static ADDRESS_MAP_START( mj4simai_readmem, ADDRESS_SPACE_PROGRAM, 16 )
583   AM_RANGE(0x000000, 0x1fffff) AM_READ(SMH_ROM               )   // ROM
584   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM               )   // RAM
585   AM_RANGE(0x600000, 0x600001) AM_READ(mj4simai_p1_r            )   // P1
586   AM_RANGE(0x600002, 0x600003) AM_READ(mj4simai_p1_r            )   // P2, but I'm using P1 again
582   AM_RANGE(0x000000, 0x1fffff) AM_READ(SMH_ROM            )   // ROM
583   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM            )   // RAM
584   AM_RANGE(0x600000, 0x600001) AM_READ(mj4simai_p1_r         )   // P1
585   AM_RANGE(0x600002, 0x600003) AM_READ(mj4simai_p1_r         )   // P2, but I'm using P1 again
587586   AM_RANGE(0x600006, 0x600007) AM_READ(watchdog_reset16_r      )   // Watchdog
588   AM_RANGE(0x600100, 0x600101) AM_READ(input_port_2_word_r      )   //
589   AM_RANGE(0x600300, 0x600301) AM_READ(input_port_0_word_r      )   // DSW 1
590   AM_RANGE(0x600302, 0x600303) AM_READ(input_port_1_word_r      )   // DSW 2
587   AM_RANGE(0x600100, 0x600101) AM_READ_PORT("SYSTEM")            //
588   AM_RANGE(0x600300, 0x600301) AM_READ_PORT("DSW1")            // DSW 1
589   AM_RANGE(0x600302, 0x600303) AM_READ_PORT("DSW2")            // DSW 2
591590   AM_RANGE(0xb00000, 0xb03fff) AM_READ(seta_sound_word_r       )   // Sound
592   AM_RANGE(0xc00000, 0xc3ffff) AM_READ(SMH_RAM               )   // Sprites
593   AM_RANGE(0xc40000, 0xc4ffff) AM_READ(SMH_RAM               )   // Palette
594   AM_RANGE(0xfffc00, 0xffffff) AM_READ(SMH_RAM               )   // TMP68301 Registers
591   AM_RANGE(0xc00000, 0xc3ffff) AM_READ(SMH_RAM            )   // Sprites
592   AM_RANGE(0xc40000, 0xc4ffff) AM_READ(SMH_RAM            )   // Palette
593   AM_RANGE(0xfffc00, 0xffffff) AM_READ(SMH_RAM            )   // TMP68301 Registers
595594ADDRESS_MAP_END
596595
597596static ADDRESS_MAP_START( mj4simai_writemem, ADDRESS_SPACE_PROGRAM, 16 )
r2956r2957
613612***************************************************************************/
614613
615614static ADDRESS_MAP_START( myangel_readmem, ADDRESS_SPACE_PROGRAM, 16 )
616   AM_RANGE(0x000000, 0x1fffff) AM_READ(SMH_ROM               )   // ROM
617   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM               )   // RAM
618   AM_RANGE(0x700000, 0x700001) AM_READ(input_port_2_word_r      )   // P1
619   AM_RANGE(0x700002, 0x700003) AM_READ(input_port_3_word_r      )   // P2
620   AM_RANGE(0x700004, 0x700005) AM_READ(input_port_4_word_r      )   // Coins
615   AM_RANGE(0x000000, 0x1fffff) AM_READ(SMH_ROM            )   // ROM
616   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM            )   // RAM
617   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("P1")               // P1
618   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("P2")               // P2
619   AM_RANGE(0x700004, 0x700005) AM_READ_PORT("SYSTEM")            // Coins
621620   AM_RANGE(0x700006, 0x700007) AM_READ(watchdog_reset16_r      )   // Watchdog
622   AM_RANGE(0x700300, 0x700301) AM_READ(input_port_0_word_r      )   // DSW 1
623   AM_RANGE(0x700302, 0x700303) AM_READ(input_port_1_word_r      )   // DSW 2
621   AM_RANGE(0x700300, 0x700301) AM_READ_PORT("DSW1")            // DSW 1
622   AM_RANGE(0x700302, 0x700303) AM_READ_PORT("DSW2")            // DSW 2
624623   AM_RANGE(0xb00000, 0xb03fff) AM_READ(seta_sound_word_r       )   // Sound
625   AM_RANGE(0xc00000, 0xc3ffff) AM_READ(SMH_RAM               )   // Sprites
626   AM_RANGE(0xc40000, 0xc4ffff) AM_READ(SMH_RAM               )   // Palette
627   AM_RANGE(0xfffc00, 0xffffff) AM_READ(SMH_RAM               )   // TMP68301 Registers
624   AM_RANGE(0xc00000, 0xc3ffff) AM_READ(SMH_RAM            )   // Sprites
625   AM_RANGE(0xc40000, 0xc4ffff) AM_READ(SMH_RAM            )   // Palette
626   AM_RANGE(0xfffc00, 0xffffff) AM_READ(SMH_RAM            )   // TMP68301 Registers
628627ADDRESS_MAP_END
629628
630629static ADDRESS_MAP_START( myangel_writemem, ADDRESS_SPACE_PROGRAM, 16 )
r2956r2957
645644***************************************************************************/
646645
647646static ADDRESS_MAP_START( myangel2_readmem, ADDRESS_SPACE_PROGRAM, 16 )
648   AM_RANGE(0x000000, 0x1fffff) AM_READ(SMH_ROM               )   // ROM
649   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM               )   // RAM
650   AM_RANGE(0x600000, 0x600001) AM_READ(input_port_2_word_r      )   // P1
651   AM_RANGE(0x600002, 0x600003) AM_READ(input_port_3_word_r      )   // P2
652   AM_RANGE(0x600004, 0x600005) AM_READ(input_port_4_word_r      )   // Coins
647   AM_RANGE(0x000000, 0x1fffff) AM_READ(SMH_ROM            )   // ROM
648   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM            )   // RAM
649   AM_RANGE(0x600000, 0x600001) AM_READ_PORT("P1")               // P1
650   AM_RANGE(0x600002, 0x600003) AM_READ_PORT("P2")               // P2
651   AM_RANGE(0x600004, 0x600005) AM_READ_PORT("SYSTEM")            // Coins
653652   AM_RANGE(0x600006, 0x600007) AM_READ(watchdog_reset16_r      )   // Watchdog
654   AM_RANGE(0x600300, 0x600301) AM_READ(input_port_0_word_r      )   // DSW 1
655   AM_RANGE(0x600302, 0x600303) AM_READ(input_port_1_word_r      )   // DSW 2
653   AM_RANGE(0x600300, 0x600301) AM_READ_PORT("DSW1")            // DSW 1
654   AM_RANGE(0x600302, 0x600303) AM_READ_PORT("DSW0")            // DSW 2
656655   AM_RANGE(0xb00000, 0xb03fff) AM_READ(seta_sound_word_r       )   // Sound
657   AM_RANGE(0xd00000, 0xd3ffff) AM_READ(SMH_RAM               )   // Sprites
658   AM_RANGE(0xd40000, 0xd4ffff) AM_READ(SMH_RAM               )   // Palette
659   AM_RANGE(0xfffc00, 0xffffff) AM_READ(SMH_RAM               )   // TMP68301 Registers
656   AM_RANGE(0xd00000, 0xd3ffff) AM_READ(SMH_RAM            )   // Sprites
657   AM_RANGE(0xd40000, 0xd4ffff) AM_READ(SMH_RAM            )   // Palette
658   AM_RANGE(0xfffc00, 0xffffff) AM_READ(SMH_RAM            )   // TMP68301 Registers
660659ADDRESS_MAP_END
661660
662661static ADDRESS_MAP_START( myangel2_writemem, ADDRESS_SPACE_PROGRAM, 16 )
r2956r2957
686685
687686static READ16_HANDLER( pzlbowl_coins_r )
688687{
689   return input_port_read_indexed(machine, 4) | (mame_rand(machine) & 0x80 );
688   return input_port_read(machine, "SYSTEM") | (mame_rand(machine) & 0x80 );
690689}
691690
692691static WRITE16_HANDLER( pzlbowl_coin_counter_w )
r2956r2957
701700static ADDRESS_MAP_START( pzlbowl_readmem, ADDRESS_SPACE_PROGRAM, 16 )
702701   AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM               )   // ROM
703702   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM               )   // RAM
704   AM_RANGE(0x400300, 0x400301) AM_READ(input_port_0_word_r      )   // DSW 1
705   AM_RANGE(0x400302, 0x400303) AM_READ(input_port_1_word_r      )   // DSW 2
706   AM_RANGE(0x500000, 0x500001) AM_READ(input_port_2_word_r      )   // P1
707   AM_RANGE(0x500002, 0x500003) AM_READ(input_port_3_word_r      )   // P2
703   AM_RANGE(0x400300, 0x400301) AM_READ_PORT("DSW1")            // DSW 1
704   AM_RANGE(0x400302, 0x400303) AM_READ_PORT("DSW2")            // DSW 2
705   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")            // P1
706   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")            // P2
708707   AM_RANGE(0x500004, 0x500005) AM_READ(pzlbowl_coins_r         )   // Coins + Protection?
709708   AM_RANGE(0x500006, 0x500007) AM_READ(watchdog_reset16_r      )   // Watchdog
710709   AM_RANGE(0x700000, 0x700001) AM_READ(pzlbowl_protection_r      )   // Protection
r2956r2957
732731***************************************************************************/
733732
734733static ADDRESS_MAP_START( penbros_readmem, ADDRESS_SPACE_PROGRAM, 16 )
735   AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM               )   // ROM
736   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM               )   // RAM
737   AM_RANGE(0x210000, 0x23ffff) AM_READ(SMH_RAM               )   // RAM
738   AM_RANGE(0x300000, 0x30ffff) AM_READ(SMH_RAM               )   // RAM
739   AM_RANGE(0x500300, 0x500301) AM_READ(input_port_0_word_r      )   // DSW 1
740   AM_RANGE(0x500302, 0x500303) AM_READ(input_port_1_word_r      )   // DSW 2
741   AM_RANGE(0x600000, 0x600001) AM_READ(input_port_2_word_r      )   // P1
742   AM_RANGE(0x600002, 0x600003) AM_READ(input_port_3_word_r      )   // P2
743   AM_RANGE(0x600004, 0x600005) AM_READ(input_port_4_word_r      )   // Coins
734   AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM            )   // ROM
735   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM            )   // RAM
736   AM_RANGE(0x210000, 0x23ffff) AM_READ(SMH_RAM            )   // RAM
737   AM_RANGE(0x300000, 0x30ffff) AM_READ(SMH_RAM            )   // RAM
738   AM_RANGE(0x500300, 0x500301) AM_READ_PORT("DSW1")            // DSW 1
739   AM_RANGE(0x500302, 0x500303) AM_READ_PORT("DSW2")            // DSW 2
740   AM_RANGE(0x600000, 0x600001) AM_READ_PORT("P1")               // P1
741   AM_RANGE(0x600002, 0x600003) AM_READ_PORT("P2")               // P2
742   AM_RANGE(0x600004, 0x600005) AM_READ_PORT("SYSTEM")            // Coins
744743   AM_RANGE(0x600006, 0x600007) AM_READ(watchdog_reset16_r      )   // Watchdog
745//  AM_RANGE(0x700000, 0x700001) AM_READ(pzlbowl_protection_r       )   // Protection
746   AM_RANGE(0xb00000, 0xb3ffff) AM_READ(SMH_RAM               )   // Sprites
747   AM_RANGE(0xb40000, 0xb4ffff) AM_READ(SMH_RAM               )   // Palette
744//  AM_RANGE(0x700000, 0x700001) AM_READ(pzlbowl_protection_r   )   // Protection
745   AM_RANGE(0xb00000, 0xb3ffff) AM_READ(SMH_RAM            )   // Sprites
746   AM_RANGE(0xb40000, 0xb4ffff) AM_READ(SMH_RAM            )   // Palette
748747   AM_RANGE(0xa00000, 0xa03fff) AM_READ(seta_sound_word_r       )   // Sound
749   AM_RANGE(0xfffc00, 0xffffff) AM_READ(SMH_RAM               )   // TMP68301 Registers
748   AM_RANGE(0xfffc00, 0xffffff) AM_READ(SMH_RAM            )   // TMP68301 Registers
750749ADDRESS_MAP_END
751750
752751static ADDRESS_MAP_START( penbros_writemem, ADDRESS_SPACE_PROGRAM, 16 )
r2956r2957
770769
771770static READ16_HANDLER( samshoot_lightgun1_r )
772771{
773//  popmessage("%02x %02x",input_port_read_indexed(machine, 3),input_port_read_indexed(machine, 2));
774   return (input_port_read_indexed(machine, 2) << 8) | input_port_read_indexed(machine, 3);
772//  popmessage("%02x %02x",input_port_read(machine, "GUN1X"),input_port_read(machine, "GUN1Y"));
773   return (input_port_read(machine, "GUN1Y") << 8) | input_port_read(machine, "GUN1X");
775774}
776775static READ16_HANDLER( samshoot_lightgun2_r )
777776{
778   return (input_port_read_indexed(machine, 4) << 8) | input_port_read_indexed(machine, 5);
777   return (input_port_read(machine, "GUN2Y") << 8) | input_port_read(machine, "GUN2X");
779778}
780779
781780static WRITE16_HANDLER( samshoot_coin_w )
r2956r2957
796795   AM_RANGE( 0x200000, 0x20ffff ) AM_RAM
797796   AM_RANGE( 0x300000, 0x30ffff ) AM_RAM AM_BASE(&generic_nvram16) AM_SIZE(&generic_nvram_size)
798797
799   AM_RANGE( 0x400000, 0x400001 ) AM_READ( input_port_0_word_r )   // DSW 1
800   AM_RANGE( 0x400002, 0x400003 ) AM_READ( input_port_9_word_r )   // Buttons
798   AM_RANGE( 0x400000, 0x400001 ) AM_READ_PORT("DSW1")            // DSW 1
799   AM_RANGE( 0x400002, 0x400003 ) AM_READ_PORT("BUTTONS")         // Buttons
801800
802801   AM_RANGE( 0x400300, 0x40030f ) AM_WRITE( seta2_sound_bank_w )   // Samples Banks
803802
804803   AM_RANGE( 0x500000, 0x500001 ) AM_READ( samshoot_lightgun1_r )   // P1
805804   AM_RANGE( 0x580000, 0x580001 ) AM_READ( samshoot_lightgun2_r )   // P2
806805
807   AM_RANGE( 0x700000, 0x700001 ) AM_READ( input_port_6_word_r )   // Trigger
808   AM_RANGE( 0x700002, 0x700003 ) AM_READ( input_port_7_word_r )   // Pump
809   AM_RANGE( 0x700004, 0x700005 ) AM_READWRITE( input_port_8_word_r, samshoot_coin_w )   // Coins
806   AM_RANGE( 0x700000, 0x700001 ) AM_READ_PORT("TRIGGER")         // Trigger
807   AM_RANGE( 0x700002, 0x700003 ) AM_READ_PORT("PUMP")            // Pump
808   AM_RANGE( 0x700004, 0x700005 ) AM_READ_PORT("COIN")   AM_WRITE( samshoot_coin_w )   // Coins
810809   AM_RANGE( 0x700006, 0x700007 ) AM_READ( watchdog_reset16_r )   // Watchdog?
811810
812811   AM_RANGE( 0x800000, 0x83ffff ) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)   // Sprites
r2956r2957
815814
816815   AM_RANGE( 0x900000, 0x903fff ) AM_READWRITE( seta_sound_word_r, seta_sound_word_w   )   // Sound
817816
818   AM_RANGE( 0xfffd0a, 0xfffd0b ) AM_READ( input_port_1_word_r )   // parallel data register (DSW 2)
817   AM_RANGE( 0xfffd0a, 0xfffd0b ) AM_READ_PORT("DSW2")            // parallel data register (DSW 2)
819818   AM_RANGE( 0xfffc00, 0xffffff ) AM_READWRITE( SMH_RAM, tmp68301_regs_w) AM_BASE(&tmp68301_regs )   // TMP68301 Registers
820819ADDRESS_MAP_END
821820
r2956r2957
832831***************************************************************************/
833832
834833static INPUT_PORTS_START( gundamex )
835   PORT_START_TAG("IN0")   // $600000.w
834   PORT_START_TAG("DSW1")   // $600000.w
836835   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:1")
837836   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
838837   PORT_DIPSETTING(      0x0001, DEF_STR( On ) )
r2956r2957
854853   PORT_SERVICE_DIPLOC(  0x0080, IP_ACTIVE_LOW, "SW1:8" )
855854   PORT_BIT(             0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
856855
857   PORT_START_TAG("IN1")   // $600002.w
856   PORT_START_TAG("DSW2")   // $600002.w
858857   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3")
859858   PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
860859   PORT_DIPSETTING(      0x0001, DEF_STR( 3C_1C ) )
r2956r2957
881880   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
882881   PORT_BIT(             0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
883882
884   PORT_START_TAG("IN2")   // $700000.w
883   PORT_START_TAG("P1")   // $700000.w
885884   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
886885   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
887886   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
r2956r2957
892891   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START1 )
893892   PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
894893
895   PORT_START_TAG("IN3")   // $700002.w
894   PORT_START_TAG("P2")   // $700002.w
896895   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
897896   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
898897   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
r2956r2957
903902   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START2 )
904903   PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
905904
906   PORT_START_TAG("IN4")   // $700004.w
905   PORT_START_TAG("SYSTEM")   // $700004.w
907906   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
908907   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
909908   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
916915   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
917916   PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
918917
919   PORT_START_TAG("IN5")   // $700008.w
918   PORT_START_TAG("IN0")   // $700008.w
920919   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
921920   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
922921   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
927926   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
928927   PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
929928
930   PORT_START_TAG("IN6")   // $70000a.w
929   PORT_START_TAG("IN1")   // $70000a.w
931930   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
932931   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
933932   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
944943***************************************************************************/
945944
946945static INPUT_PORTS_START( grdians )
947   PORT_START_TAG("IN0")   // $600000.w
946   PORT_START_TAG("DSW1")   // $600000.w
948947   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:1,2")
949948   PORT_DIPSETTING(      0x0002, DEF_STR( Easy )    )   // 0
950949   PORT_DIPSETTING(      0x0003, DEF_STR( Normal )  )   // 1
r2956r2957
967966   PORT_DIPSETTING(      0x0080, DEF_STR( On ) )
968967   PORT_BIT(             0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
969968
970   PORT_START_TAG("IN1")   // $600002.w
969   PORT_START_TAG("DSW2")   // $600002.w
971970   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3,4")
972971   PORT_DIPSETTING(      0x0002, DEF_STR( 4C_1C ) )
973972   PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
r2956r2957
10041003   PORT_DIPSETTING(      0x0000, DEF_STR( Free_Play ) )
10051004   PORT_BIT(             0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
10061005
1007   PORT_START_TAG("IN2")   // $700000.w
1006   PORT_START_TAG("P1")   // $700000.w
10081007   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
10091008   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
10101009   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
r2956r2957
10151014   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START1 )
10161015   PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
10171016
1018   PORT_START_TAG("IN3")   // $700002.w
1017   PORT_START_TAG("P2")   // $700002.w
10191018   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
10201019   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
10211020   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
r2956r2957
10261025   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START2 )
10271026   PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
10281027
1029   PORT_START_TAG("IN4")   // $700004.w
1028   PORT_START_TAG("SYSTEM")   // $700004.w
10301029   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
10311030   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
10321031   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
10441043***************************************************************************/
10451044
10461045static INPUT_PORTS_START( mj4simai )
1047   PORT_START_TAG("IN0")   // $600300.w
1046   PORT_START_TAG("DSW1")   // $600300.w
10481047   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2,3")
10491048   PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
10501049   PORT_DIPSETTING(      0x0001, DEF_STR( 4C_1C ) )
r2956r2957
10691068   PORT_SERVICE_DIPLOC(  0x0080, IP_ACTIVE_LOW, "SW1:8" )
10701069   PORT_BIT(             0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
10711070
1072   PORT_START_TAG("IN1")   // $600302.w
1071   PORT_START_TAG("DSW2")   // $600302.w
10731072   PORT_DIPNAME( 0x0007, 0x0004, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2,3")
10741073   PORT_DIPSETTING(      0x0004, "0" )
10751074   PORT_DIPSETTING(      0x0003, "1" )
r2956r2957
10961095   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
10971096   PORT_BIT(             0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
10981097
1099   PORT_START_TAG("IN2")   // $600100.w
1098   PORT_START_TAG("SYSTEM")   // $600100.w
11001099   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
11011100   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
11021101   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
11071106   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
11081107   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
11091108
1110   PORT_START_TAG("IN3")   // $600000(0)
1109   PORT_START_TAG("KEY0")   // $600000(0)
11111110   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_A )
11121111   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_E )
11131112   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_I )
r2956r2957
11161115   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START1  )
11171116   PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
11181117
1119   PORT_START_TAG("IN4")   // $600000(1)
1118   PORT_START_TAG("KEY1")   // $600000(1)
11201119   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_B )
11211120   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_F )
11221121   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_J )
r2956r2957
11251124   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
11261125   PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNKNOWN)
11271126
1128   PORT_START_TAG("IN5")   // $600000(2)
1127   PORT_START_TAG("KEY2")   // $600000(2)
11291128   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_C )
11301129   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_G )
11311130   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_K )
r2956r2957
11331132   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
11341133   PORT_BIT( 0xffe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
11351134
1136   PORT_START_TAG("IN6")   // $600000(3)
1135   PORT_START_TAG("KEY3")   // $600000(3)
11371136   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_D )
11381137   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_H )
11391138   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_L )
11401139   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
11411140   PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
11421141
1143   PORT_START_TAG("IN7")   // $600000(4)
1142   PORT_START_TAG("KEY4")   // $600000(4)
11441143   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
11451144   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
11461145   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
r2956r2957
11571156***************************************************************************/
11581157
11591158static INPUT_PORTS_START( myangel )
1160   PORT_START_TAG("IN0")   // $700300.w
1159   PORT_START_TAG("DSW1")   // $700300.w
11611160   PORT_SERVICE_DIPLOC(  0x0001, IP_ACTIVE_LOW, "SW1:1" )
11621161   PORT_DIPUNUSED_DIPLOC( 0x0002, 0x0002, "SW1:2" ) /* Listed as "Unused" */
11631162   PORT_DIPUNUSED_DIPLOC( 0x0004, 0x0004, "SW1:3" ) /* Listed as "Unused" */
r2956r2957
11771176   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
11781177   PORT_BIT(             0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
11791178
1180   PORT_START_TAG("IN1")   // $700302.w
1179   PORT_START_TAG("DSW2")   // $700302.w
11811180   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:1,2,3,4")
11821181   PORT_DIPSETTING(      0x0002, DEF_STR( 4C_1C ) )
11831182   PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
r2956r2957
12031202   PORT_DIPSETTING(      0x0000, DEF_STR( Yes ) )
12041203   PORT_BIT(             0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
12051204
1206   PORT_START_TAG("IN2") //$700000.w
1205   PORT_START_TAG("P1") //$700000.w
12071206   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
12081207   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
12091208   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
12141213   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START1  )
12151214   PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
12161215
1217   PORT_START_TAG("IN3") //$700002.w
1216   PORT_START_TAG("P2") //$700002.w
12181217   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
12191218   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
12201219   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
12251224   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START2  )
12261225   PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
12271226
1228   PORT_START_TAG("IN4") //$700004.w
1227   PORT_START_TAG("SYSTEM") //$700004.w
12291228   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
12301229   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
12311230   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
12431242***************************************************************************/
12441243
12451244static INPUT_PORTS_START( myangel2 )
1246   PORT_START_TAG("IN0") //$600300.w
1245   PORT_START_TAG("DSW1") //$600300.w
12471246   PORT_SERVICE_DIPLOC(  0x0001, IP_ACTIVE_LOW, "SW1:1" )
12481247   PORT_DIPUNUSED_DIPLOC( 0x0002, 0x0002, "SW1:2" ) /* Listed as "Unused" */
12491248   PORT_DIPUNUSED_DIPLOC( 0x0004, 0x0004, "SW1:3" ) /* Listed as "Unused" */
r2956r2957
12611260   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8")
12621261   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
12631262   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
1264
12651263   PORT_BIT(     0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
12661264
1267   PORT_START_TAG("IN1") //$600302.w
1265   PORT_START_TAG("DSW2") //$600302.w
12681266   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:1,2,3,4")
12691267   PORT_DIPSETTING(      0x0002, DEF_STR( 4C_1C ) )
12701268   PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
r2956r2957
12881286   PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "SW2:8" ) /* Listed as "Unused" */
12891287   PORT_BIT(             0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
12901288
1291   PORT_START_TAG("IN2") //$600000.w
1289   PORT_START_TAG("P1") //$600000.w
12921290   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
12931291   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
12941292   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
12991297   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START1  )
13001298   PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
13011299
1302   PORT_START_TAG("IN3") //$600002.w
1300   PORT_START_TAG("P2") //$600002.w
13031301   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
13041302   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
13051303   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
13101308   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START2  )
13111309   PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
13121310
1313   PORT_START_TAG("IN4") //$600004.w
1311   PORT_START_TAG("SYSTEM") //$600004.w
13141312   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
13151313   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
13161314   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
13281326***************************************************************************/
13291327
13301328static INPUT_PORTS_START( pzlbowl )
1331   PORT_START_TAG("IN0") //$400300.w
1329   PORT_START_TAG("DSW1") //$400300.w
13321330   PORT_SERVICE_DIPLOC(  0x0001, IP_ACTIVE_LOW, "SW1:1" )
13331331   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:2")
13341332   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
r2956r2957
13521350   PORT_DIPSETTING(      0x0000, "5" )
13531351   PORT_BIT(             0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
13541352
1355   PORT_START_TAG("IN1") //$400302.w
1353   PORT_START_TAG("DSW2") //$400302.w
13561354   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:1,2,3,4")
13571355   PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
13581356   PORT_DIPSETTING(      0x0008, DEF_STR( 2C_1C ) )
r2956r2957
13821380   PORT_DIPSETTING(      0x0080, DEF_STR( Japanese ) )
13831381   PORT_BIT(             0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
13841382
1385   PORT_START_TAG("IN2") //$500000.w
1383   PORT_START_TAG("P1") //$500000.w
13861384   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
13871385   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
13881386   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
r2956r2957
13931391   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START1 )
13941392   PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
13951393
1396   PORT_START_TAG("IN3") //$500002.w
1394   PORT_START_TAG("P2") //$500002.w
13971395   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
13981396   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
13991397   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
r2956r2957
14041402   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START2 )
14051403   PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
14061404
1407   PORT_START_TAG("IN4") //$500004.w
1405   PORT_START_TAG("SYSTEM") //$500004.w
14081406   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
14091407   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)   // unused, test mode shows it
14101408   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
14221420***************************************************************************/
14231421
14241422static INPUT_PORTS_START( penbros )
1425   PORT_START_TAG("IN0") //$500300.w
1423   PORT_START_TAG("DSW1") //$500300.w
14261424   PORT_SERVICE_DIPLOC(  0x0001, IP_ACTIVE_LOW, "SW1:1" )
14271425   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:2")
14281426   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
r2956r2957
14431441   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_2C ) )
14441442   PORT_BIT(             0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
14451443
1446   PORT_START_TAG("IN1") //$500302.w
1444   PORT_START_TAG("DSW2") //$500302.w
14471445   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2")
14481446   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )
14491447   PORT_DIPSETTING(      0x0003, DEF_STR( Normal ) )
r2956r2957
14661464   PORT_DIPSETTING(      0x0000, "5" )
14671465   PORT_BIT(             0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
14681466
1469   PORT_START_TAG("IN2") //$600000.w
1467   PORT_START_TAG("P1") //$600000.w
14701468   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
14711469   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
14721470   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
r2956r2957
14771475   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START1 )
14781476   PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
14791477
1480   PORT_START_TAG("IN3") //$600002.w
1478   PORT_START_TAG("P2") //$600002.w
14811479   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
14821480   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
14831481   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
r2956r2957
14881486   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START2 )
14891487   PORT_BIT(  0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
14901488
1491   PORT_START_TAG("IN4") //$600004.w
1489   PORT_START_TAG("SYSTEM") //$600004.w
14921490   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
14931491   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)   // unused, test mode shows it
14941492   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
src/mame/drivers/shootout.c
r2956r2957
7878
7979static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
8080   AM_RANGE(0x0000, 0x0fff) AM_READ(SMH_RAM)
81   AM_RANGE(0x1000, 0x1000) AM_READ(input_port_0_r)
82   AM_RANGE(0x1001, 0x1001) AM_READ(input_port_1_r)
83   AM_RANGE(0x1002, 0x1002) AM_READ(input_port_2_r)
84   AM_RANGE(0x1003, 0x1003) AM_READ(input_port_3_r)
81   AM_RANGE(0x1000, 0x1000) AM_READ_PORT("DSW1")
82   AM_RANGE(0x1001, 0x1001) AM_READ_PORT("P1")
83   AM_RANGE(0x1002, 0x1002) AM_READ_PORT("P2")
84   AM_RANGE(0x1003, 0x1003) AM_READ_PORT("DSW2")
8585   AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM)   /* foreground */
8686   AM_RANGE(0x2800, 0x2fff) AM_READ(SMH_RAM)   /* background */
8787   AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
r2956r2957
168168   PORT_DIPSETTING(   0x80, DEF_STR( Off ) )
169169   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
170170
171   PORT_START_TAG("IN0")
171   PORT_START_TAG("P1")
172172   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
173173   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
174174   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
r2956r2957
178178   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
179179   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
180180
181   PORT_START_TAG("IN1")
181   PORT_START_TAG("P2")
182182   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
183183   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
184184   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
r2956r2957
299299{
300300   static int coin = 0;
301301
302   if ( input_port_read_indexed(machine, 2 ) & 0xc0 ) {
302   if ( input_port_read(machine, "P2") & 0xc0 ) {
303303      if ( coin == 0 ) {
304304         coin = 1;
305305         nmi_line_pulse(machine, cpunum);
src/mame/drivers/itech32.c
r2956r2957
1212        * Hard Yardage (2 sets)
1313        * Pairs (3 sets)
1414        * Driver's Edge (1 set)
15        * World Class Bowling (8 sets)
15        * World Class Bowling (9 sets)
1616        * Street Fighter: The Movie (4 sets)
1717        * Shuffleshot (3 sets)
1818        * Golden Tee 3D Golf (11 sets)
r2956r2957
21252125   ROM_LOAD32_BYTE( "wcb_prm3.161", 0x00003, 0x20000, CRC(e5081f85) SHA1(a5513b8dd917a35f1c8b7f833c2d5622353d39f0) )
21262126
21272127   ROM_REGION( 0x28000, REGION_CPU2, 0 )
2128   ROM_LOAD( "wcbo_snd.u88", 0x10000, 0x18000, CRC(194a51d7) SHA1(c67b042008ff2a2713562d3789e5bc3a312fae17) ) /* Version 4.0 */
2128   ROM_LOAD( "wcb_sndv4.u88", 0x10000, 0x18000, CRC(194a51d7) SHA1(c67b042008ff2a2713562d3789e5bc3a312fae17) ) /* Version 4.0 */
21292129   ROM_CONTINUE(             0x08000, 0x08000 )
21302130
21312131   ROM_REGION( 0x880000, REGION_GFX1, 0 )
r2956r2957
21412141
21422142   ROM_REGION16_BE( 0x400000, REGION_SOUND1, ROMREGION_ERASE00 )
21432143   ROM_LOAD16_BYTE( "wcbosrom.0",  0x000000, 0x080000, CRC(c3821cb5) SHA1(3c2c27d1e577201cbd0d28cc48fc80ae7747faa1) ) /* Older sound sample roms */
2144   ROM_LOAD16_BYTE( "wcbosrom.1",  0x200000, 0x080000, CRC(afa24888) SHA1(169eaedd09e0214ac72c932903a11bbb2ebc5bf1) ) /* Older sound sample roms */
2144   ROM_LOAD16_BYTE( "wcbosrom.1",  0x200000, 0x080000, CRC(37bfa3c7) SHA1(98c98296acaa55e6fd12a62305ff387c863fc5ed) ) /* Older sound sample roms */
21452145
21462146   ROM_REGION16_BE( 0x400000, REGION_SOUND2, ROMREGION_ERASE00 )
21472147   ROM_LOAD16_BYTE( "wcbosrom.2",  0x000000, 0x080000, CRC(f82c08fd) SHA1(8f6f47f5a4b68a31df4c2eb330dc95a9963e55c1) ) /* Older sound sample roms */
r2956r2957
21492149ROM_END
21502150
21512151
2152ROM_START( wcbwl16 )   /* Version 1.6 (PCB P/N 1082 Rev 2), This is the first set to move to the single board platform */
2153   ROM_REGION32_BE( CODE_SIZE, REGION_USER1, 0 )
2154   ROM_LOAD32_BYTE( "wcb_prm0.16n", 0x00000, 0x20000, CRC(332c558f) SHA1(179b763e2189c11cf6751eb6c419fe4417b288a8) ) /* Program roms labeled as "WCB PROM0 V1.6N" ect */
2155   ROM_LOAD32_BYTE( "wcb_prm1.16n", 0x00001, 0x20000, CRC(c5750857) SHA1(8121b56d304ab405b06d4aa4c7d2db2f912f0bf2) )
2156   ROM_LOAD32_BYTE( "wcb_prm2.16n", 0x00002, 0x20000, CRC(28f4ee8a) SHA1(a6a2b9cca622df0b9d181c35f4d01e8ab00392a0) )
2157   ROM_LOAD32_BYTE( "wcb_prm3.16n", 0x00003, 0x20000, CRC(f0a58979) SHA1(c837b2a5b0e5ae993f1e453b59e3fbd9ed5de2a7) )
2158
2159   ROM_REGION( 0x28000, REGION_CPU2, 0 )
2160   ROM_LOAD( "wcb_sndv3.u88", 0x10000, 0x18000, CRC(45c4f659) SHA1(cfd140b9947654f677409a0fb4fa0c7b65992f95) ) /* Version 3.0N */
2161   ROM_CONTINUE(              0x08000, 0x08000 )
2162
2163   ROM_REGION( 0x880000, REGION_GFX1, 0 )
2164   ROM_LOAD32_BYTE( "wcb_grom.0_0", 0x000000, 0x080000, CRC(6fcb4246) SHA1(91fb5d18ea9494b08251d1e611c80414df3aad66) )
2165   ROM_LOAD32_BYTE( "wcb_grom.0_1", 0x000001, 0x080000, CRC(2ae31f45) SHA1(85218aa9a7ca7c6870427ffbd08b78255813ff90) )
2166   ROM_LOAD32_BYTE( "wcb_grom.0_2", 0x000002, 0x080000, CRC(bccc0f35) SHA1(2389662e881e86f8cdb36eb2a082923d976676c8) )
2167   ROM_LOAD32_BYTE( "wcb_grom.0_3", 0x000003, 0x080000, CRC(ab1da462) SHA1(3f3a4a083483d2d95d5ef540eea077cad799fcb7) )
2168   ROM_LOAD32_BYTE( "wcb_grom.1_0", 0x200000, 0x080000, CRC(bdfafd1f) SHA1(bc0e6fe83d3f8e88c2e55ba3a436875d5470de5b) )
2169   ROM_LOAD32_BYTE( "wcb_grom.1_1", 0x200001, 0x080000, CRC(7d6baa2e) SHA1(c47854b064aa96d2581c23afe13cd05a36f9dae3) )
2170   ROM_LOAD32_BYTE( "wcb_grom.1_2", 0x200002, 0x080000, CRC(7513d3de) SHA1(b17650ed5210860c3bde53647a30f8fce67aaa38) )
2171   ROM_LOAD32_BYTE( "wcb_grom.1_3", 0x200003, 0x080000, CRC(e46877e6) SHA1(f50c904ec5b2b8cbc92f2b28641433c91ee17af5) )
2172   ROM_FILL(                        0x400000, 0x480000, 0xff )
2173
2174   ROM_REGION16_BE( 0x400000, REGION_SOUND1, ROMREGION_ERASE00 )
2175   ROM_LOAD16_BYTE( "wcbosrom.0",  0x000000, 0x080000, CRC(c3821cb5) SHA1(3c2c27d1e577201cbd0d28cc48fc80ae7747faa1) ) /* Older sound sample roms */
2176   ROM_LOAD16_BYTE( "wcbosrom.1",  0x200000, 0x080000, CRC(37bfa3c7) SHA1(98c98296acaa55e6fd12a62305ff387c863fc5ed) ) /* Older sound sample roms */
2177
2178   ROM_REGION16_BE( 0x400000, REGION_SOUND2, ROMREGION_ERASE00 )
2179   ROM_LOAD16_BYTE( "wcbosrom.2",  0x000000, 0x080000, CRC(f82c08fd) SHA1(8f6f47f5a4b68a31df4c2eb330dc95a9963e55c1) ) /* Older sound sample roms */
2180   ROM_LOAD16_BYTE( "wcbosrom.3",  0x200000, 0x020000, CRC(1c2efdee) SHA1(d306c9e7f9c4c2662561401170439a10a9ee89ed) ) /* Older sound sample roms, rom is a 27C010 in this set */
2181ROM_END
2182
2183
21522184ROM_START( wcbwl15 )   /* Version 1.5 (3-tier board set: P/N 1059 Rev 3, P/N 1079 Rev 1 & P/N 1060 Rev 0) */
21532185   /* v1.0 for this platform has been confirmed, but not dumped */
21542186   ROM_REGION16_BE( 0x80000, REGION_USER1, 0 )
r2956r2957
39093941GAME( 1995, wcbowl,   0,        sftm,     wcbowln,  wcbowln,  ROT0, "Incredible Technologies",        "World Class Bowling (v1.66)" , 0) /* PIC 16C54 labeled as ITBWL-3 */
39103942GAME( 1995, wcbwl165, wcbowl,   sftm,     shufbowl, wcbowln,  ROT0, "Incredible Technologies",        "World Class Bowling (v1.65)" , 0) /* PIC 16C54 labeled as ITBWL-3 */
39113943GAME( 1995, wcbwl161, wcbowl,   sftm,     shufbowl, wcbowln,  ROT0, "Incredible Technologies",        "World Class Bowling (v1.61)" , 0) /* PIC 16C54 labeled as ITBWL-3 */
3944GAME( 1995, wcbwl16,  wcbowl,   sftm,     shufbowl, wcbowln,  ROT0, "Incredible Technologies",        "World Class Bowling (v1.6)" , 0) /* PIC 16C54 labeled as ITBWL-3 */
39123945GAME( 1995, wcbwl15,  wcbowl,   bloodstm, wcbowl,   wcbowl,   ROT0, "Incredible Technologies",        "World Class Bowling (v1.5)" , 0) /* PIC 16C54 labeled as ITBWL-1 */
39133946GAME( 1995, wcbwl13,  wcbowl,   bloodstm, wcbowl,   wcbowl,   ROT0, "Incredible Technologies",        "World Class Bowling (v1.3)" , 0) /* PIC 16C54 labeled as ITBWL-1 */
39143947GAME( 1995, wcbwl12,  wcbowl,   bloodstm, wcbowl,   wcbowl,   ROT0, "Incredible Technologies",        "World Class Bowling (v1.2)" , 0) /* PIC 16C54 labeled as ITBWL-1 */
src/mame/drivers/deco32.c
r2956r2957
487487   static int pendingCommand=0; /* 1 = read, 2 = write */
488488   static int readBitCount=0;
489489   static int byteAddr=0;
490   UINT8 *eeprom=eeprom_get_data_pointer(0);
490   UINT8 *eeprom=eeprom_get_data_pointer(NULL,NULL);
491491
492492   /* Eprom in low byte */
493493   if (mem_mask==0x000000ff) { /* Byte write to low byte only (different from word writing including low byte) */
r2956r2957
18461846      eeprom_save(file);
18471847   else
18481848   {
1849      int len;
18501849      eeprom_init(&eeprom_interface_tattass);
18511850      if (file) eeprom_load(file);
1852      else memcpy(eeprom_get_data_pointer(&len),tattass_default_eprom,0x160);
1851      else memcpy(eeprom_get_data_pointer(NULL,NULL),tattass_default_eprom,0x160);
18531852   }
18541853}
18551854
src/mame/drivers/vegas.c
r2956r2957
24332433
24342434ROM_START( sf2049 )
24352435   ROM_REGION32_LE( 0x80000, REGION_USER1, 0 )   /* EPROM 1.02 7/9/1999 */
2436   ROM_LOAD( "u27a.dat", 0x000000, 0x80000, CRC(174ba8fe) SHA1(baba83b811eca659f00514a008a86ef0ac9680ee) )
2436   ROM_LOAD( "sf2049.u27", 0x000000, 0x80000, CRC(174ba8fe) SHA1(baba83b811eca659f00514a008a86ef0ac9680ee) )
24372437
24382438   DISK_REGION( REGION_DISKS )   /* Guts 1.03 9/3/1999 Game 9/8/1999 */
24392439   DISK_IMAGE( "sf2049", 0, MD5(2f56375670c0f72b69c1b5ec6a54ba70) SHA1(e08d026ab2745cac6b8c820f010b28dffd5388dd) )
r2956r2957
24422442
24432443ROM_START( sf2049se )
24442444   ROM_REGION32_LE( 0x80000, REGION_USER1, 0 )
2445   ROM_LOAD( "sf2049te.bin", 0x000000, 0x80000, BAD_DUMP CRC(cc7c8601) SHA1(3f37dbd1b32b3ac5caa300725468e8e426f0fb83) )
2445   ROM_LOAD( "sf2049se.u27", 0x000000, 0x80000, CRC(da4ecd9c) SHA1(2574ff3d608ebcc59a63cf6dea13ee7650ae8921) )
24462446
24472447   DISK_REGION( REGION_DISKS )
24482448   DISK_IMAGE( "sf2049se", 0, MD5(3ea8c0f8394cb73e96176b1a70c03219) SHA1(b195f98756d9d7cde71b6467409faed33134a2d7) )
r2956r2957
24512451
24522452ROM_START( sf2049te )
24532453   ROM_REGION32_LE( 0x80000, REGION_USER1, 0 )
2454   ROM_LOAD( "sf2049te.bin", 0x000000, 0x80000, CRC(cc7c8601) SHA1(3f37dbd1b32b3ac5caa300725468e8e426f0fb83) )
2454   ROM_LOAD( "sf2049te.u27", 0x000000, 0x80000, CRC(cc7c8601) SHA1(3f37dbd1b32b3ac5caa300725468e8e426f0fb83) )
24552455
24562456   DISK_REGION( REGION_DISKS )
24572457   DISK_IMAGE( "sf2049te", 0, MD5(476abcfbeb0d2817cb38ca36e78cddc6) SHA1(c01972f1b642f013d760f29f1e2ed7dcf78896c4) )
src/mame/drivers/segaybd.c
r2956r2957
237237
238238static READ16_HANDLER( io_chip_r )
239239{
240   static const char *portnames[] = { "P1", "GENERAL", "PORTC", "PORTD", "PORTE", "DSW", "COINAGE", "PORTH" };
240241   offset &= 0x1f/2;
241242
242243   switch (offset)
r2956r2957
255256            return misc_io_data[offset];
256257
257258         /* otherwise, return an input port */
258         return input_port_read_indexed(machine, offset);
259         return input_port_read(machine, portnames[offset]);
259260
260261      /* 'SEGA' protection */
261262      case 0x10/2:
src/mame/drivers/shuuz.c
r2956r2957
9999   /* when reading the even ports, do a real analog port update */
100100   if (which == 0)
101101   {
102      int dx = (INT8)input_port_read_indexed(machine, 2);
103      int dy = (INT8)input_port_read_indexed(machine, 3);
102      int dx = (INT8)input_port_read(machine, "TRACKX");
103      int dy = (INT8)input_port_read(machine, "TRACKY");
104104
105105      cur[0] = dx + dy;
106106      cur[1] = dx - dy;
r2956r2957
140140
141141static READ16_HANDLER( special_port0_r )
142142{
143   int result = input_port_read_indexed(machine, 0);
143   int result = input_port_read(machine, "SYSTEM");
144144
145145   if ((result & 0x0800) && atarigen_get_hblank(machine->primary_screen))
146146      result &= ~0x0800;
r2956r2957
163163   AM_RANGE(0x102000, 0x102001) AM_WRITE(watchdog_reset16_w)
164164   AM_RANGE(0x103000, 0x103003) AM_READ(leta_r)
165165   AM_RANGE(0x105000, 0x105001) AM_READWRITE(special_port0_r, latch_w)
166   AM_RANGE(0x105002, 0x105003) AM_READ(input_port_1_word_r)
166   AM_RANGE(0x105002, 0x105003) AM_READ_PORT("BUTTONS")
167167   AM_RANGE(0x106000, 0x106001) AM_READWRITE(adpcm_r, adpcm_w)
168168   AM_RANGE(0x107000, 0x107007) AM_NOP
169169   AM_RANGE(0x3e0000, 0x3e087f) AM_RAM_WRITE(atarigen_666_paletteram_w) AM_BASE(&paletteram16)
r2956r2957
186186 *************************************/
187187
188188static INPUT_PORTS_START( shuuz )
189   PORT_START
189   PORT_START_TAG("SYSTEM")
190190   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
191191   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
192192   PORT_BIT( 0x07fc, IP_ACTIVE_LOW, IPT_UNUSED )
193193   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_VBLANK )
194194   PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
195195
196   PORT_START
196   PORT_START_TAG("BUTTONS")
197197   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
198198   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
199199   PORT_BIT( 0x07fc, IP_ACTIVE_LOW, IPT_UNUSED )
200200   PORT_SERVICE( 0x0800, IP_ACTIVE_LOW )
201201   PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
202202
203   PORT_START
203   PORT_START_TAG("TRACKX")
204204    PORT_BIT( 0xff, 0, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(30) PORT_PLAYER(1)
205205   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
206206
207   PORT_START
207   PORT_START_TAG("TRACKY")
208208    PORT_BIT( 0xff, 0, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(30) PORT_REVERSE PORT_PLAYER(1)
209209   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
210210INPUT_PORTS_END
211211
212212
213213static INPUT_PORTS_START( shuuz2 )
214   PORT_START
214   PORT_START_TAG("SYSTEM")
215215   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
216216   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
217217   PORT_BIT( 0x00fc, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
223223   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Crosshair Debug SW") PORT_CODE(KEYCODE_C)
224224   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("Freeze Debug SW") PORT_CODE(KEYCODE_F)
225225
226   PORT_START
226   PORT_START_TAG("BUTTONS")
227227   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
228228   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
229229   PORT_BIT( 0x00fc, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
235235   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
236236   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
237237
238   PORT_START
238   PORT_START_TAG("TRACKX")
239239    PORT_BIT( 0xff, 0, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(30) PORT_PLAYER(1)
240240   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
241241
242   PORT_START
242   PORT_START_TAG("TRACKY")
243243    PORT_BIT( 0xff, 0, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(50) PORT_KEYDELTA(30) PORT_REVERSE PORT_PLAYER(1)
244244   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
245245INPUT_PORTS_END
src/mame/drivers/segaorun.c
r2956r2957
382382         return ppi8255_r(device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), offset & 3);
383383
384384      case 0x10/2:
385         return input_port_read_indexed(machine, offset & 3);
385      {
386         static const char *const sysports[] = { "SERVICE", "UNKNOWN", "COINAGE", "DSW" };
387         return input_port_read(machine, sysports[offset & 3]);
388      }
386389
387390      case 0x30/2:
388391      {
r2956r2957
445448      case 0x1002/2:
446449      case 0x1004/2:
447450      case 0x1006/2:
448         return input_port_read_indexed(machine, offset & 3);
451      {
452         static const char *const sysports[] = { "SERVICE", "UNKNOWN", "COINAGE", "DSW" };
453         return input_port_read(machine, sysports[offset & 3]);
454      }
449455
450456      case 0x3020/2:
451457      {
src/mame/drivers/dkong.c
r2956r2957
726726
727727static READ8_HANDLER( strtheat_inputport_0_r )
728728{
729   if(input_port_read_indexed(machine, 3) & 0x40)
729   if(input_port_read(machine, "DSW0") & 0x40)
730730   {
731731      /* Joystick inputs */
732      return input_port_read_indexed(machine, 0);
732      return input_port_read(machine, "IN0");
733733   }
734734   else
735735   {
736736      /* Steering Wheel inputs */
737      return (input_port_read_indexed(machine, 0) & ~3) | (input_port_read_indexed(machine, 4) & 3);
737      return (input_port_read(machine, "IN0") & ~3) | (input_port_read(machine, "IN4") & 3);
738738   }
739739}
740740
741741static READ8_HANDLER( strtheat_inputport_1_r )
742742{
743   if(input_port_read_indexed(machine, 3) & 0x40)
743   if(input_port_read(machine, "DSW0") & 0x40)
744744   {
745745      /* Joystick inputs */
746      return input_port_read_indexed(machine, 1);
746      return input_port_read(machine, "IN1");
747747   }
748748   else
749749   {
750750      /* Steering Wheel inputs */
751      return (input_port_read_indexed(machine, 1) & ~3) | (input_port_read_indexed(machine, 5) & 3);
751      return (input_port_read(machine, "IN1") & ~3) | (input_port_read(machine, "IN5") & 3);
752752   }
753753}
754754
src/mame/drivers/sprint4.c
r2956r2957
115115
116116   /* NMI and watchdog are disabled during service mode */
117117
118   watchdog_enable(machine, input_port_read_indexed(machine, 0) & 0x40);
118   watchdog_enable(machine, input_port_read(machine, "IN0") & 0x40);
119119
120   if (input_port_read_indexed(machine, 0) & 0x40)
120   if (input_port_read(machine, "IN0") & 0x40)
121121      cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
122122
123123   timer_set(video_screen_get_time_until_pos(machine->primary_screen, scanline, 0), NULL, scanline, nmi_callback);
src/mame/drivers/skyraid.c
r2956r2957
5252
5353static READ8_HANDLER( skyraid_port_0_r )
5454{
55   UINT8 val = input_port_read_indexed(machine, 0);
55   UINT8 val = input_port_read(machine, "LANGUAGE");
5656
57   if (input_port_read_indexed(machine, 4) > analog_range)
57   if (input_port_read(machine, "STICKY") > analog_range)
5858      val |= 0x40;
59   if (input_port_read_indexed(machine, 5) > analog_range)
59   if (input_port_read(machine, "STICKX") > analog_range)
6060      val |= 0x80;
6161
6262   return val;
r2956r2957
105105   AM_RANGE(0x0800, 0x087f) AM_READ(SMH_RAM)
106106   AM_RANGE(0x0880, 0x0bff) AM_READ(skyraid_alpha_num_r)
107107   AM_RANGE(0x1000, 0x1000) AM_READ(skyraid_port_0_r)
108   AM_RANGE(0x1000, 0x1001) AM_READ(input_port_1_r)
109   AM_RANGE(0x1400, 0x1400) AM_READ(input_port_2_r)
110   AM_RANGE(0x1400, 0x1401) AM_READ(input_port_3_r)
108   AM_RANGE(0x1000, 0x1001) AM_READ_PORT("DSW")
109   AM_RANGE(0x1400, 0x1400) AM_READ_PORT("COIN")
110   AM_RANGE(0x1400, 0x1401) AM_READ_PORT("SYSTEM")
111111   AM_RANGE(0x7000, 0x7fff) AM_READ(SMH_ROM)
112112   AM_RANGE(0xf000, 0xffff) AM_READ(SMH_ROM)
113113ADDRESS_MAP_END
r2956r2957
130130
131131
132132static INPUT_PORTS_START( skyraid )
133   PORT_START
133   PORT_START_TAG("LANGUAGE")
134134   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Language ) )
135135   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
136136   PORT_DIPSETTING(    0x10, DEF_STR( French ) )
r2956r2957
139139   PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_UNUSED) /* POT1 */
140140   PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_UNUSED) /* POT0 */
141141
142   PORT_START
142   PORT_START_TAG("DSW")
143143   PORT_DIPNAME( 0x30, 0x10, "Play Time" )
144144   PORT_DIPSETTING(    0x00, "60 Seconds" )
145145   PORT_DIPSETTING(    0x10, "80 Seconds" )
r2956r2957
154154
155155   /* coinage settings are insane, refer to the manual */
156156
157   PORT_START
157   PORT_START_TAG("COIN")
158158   PORT_DIPNAME( 0x0F, 0x01, DEF_STR( Coinage )) /* dial */
159159   PORT_DIPSETTING(    0x00, "Mode 0" )
160160   PORT_DIPSETTING(    0x01, "Mode 1" )
r2956r2957
179179   PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_COIN1)
180180   PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_COIN2)
181181
182   PORT_START
182   PORT_START_TAG("SYSTEM")
183183   PORT_BIT (0x10, IP_ACTIVE_LOW, IPT_TILT)
184184   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Hiscore Reset") PORT_CODE(KEYCODE_H)
185185   PORT_BIT (0x40, IP_ACTIVE_LOW, IPT_START1)
186186   PORT_SERVICE(0x80, IP_ACTIVE_LOW)
187187
188   PORT_START
188   PORT_START_TAG("STICKY")
189189   PORT_BIT( 0x3f, 0x20, IPT_AD_STICK_Y ) PORT_MINMAX(0,63) PORT_SENSITIVITY(10) PORT_KEYDELTA(10) PORT_REVERSE
190190
191   PORT_START
191   PORT_START_TAG("STICKX")
192192   PORT_BIT( 0x3f, 0x20, IPT_AD_STICK_X ) PORT_MINMAX(0,63) PORT_SENSITIVITY(10) PORT_KEYDELTA(10)
193193INPUT_PORTS_END
194194
src/mame/drivers/travrusa.c
r2956r2957
7373   AM_RANGE(0xc800, 0xc9ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
7474   AM_RANGE(0xd000, 0xd000) AM_WRITE(irem_sound_cmd_w)
7575   AM_RANGE(0xd001, 0xd001) AM_WRITE(travrusa_flipscreen_w)   /* + coin counters - not written by shtrider */
76   AM_RANGE(0xd000, 0xd000) AM_READ(input_port_0_r)   /* IN0 */
77   AM_RANGE(0xd001, 0xd001) AM_READ(input_port_1_r)   /* IN1 */
78   AM_RANGE(0xd002, 0xd002) AM_READ(input_port_2_r)   /* IN2 */
79   AM_RANGE(0xd003, 0xd003) AM_READ(input_port_3_r)   /* DSW1 */
80   AM_RANGE(0xd004, 0xd004) AM_READ(input_port_4_r)   /* DSW2 */
76   AM_RANGE(0xd000, 0xd000) AM_READ_PORT("SYSTEM")      /* IN0 */
77   AM_RANGE(0xd001, 0xd001) AM_READ_PORT("P1")         /* IN1 */
78   AM_RANGE(0xd002, 0xd002) AM_READ_PORT("P2")         /* IN2 */
79   AM_RANGE(0xd003, 0xd003) AM_READ_PORT("DSW1")      /* DSW1 */
80   AM_RANGE(0xd004, 0xd004) AM_READ_PORT("DSW2")      /* DSW2 */
8181   AM_RANGE(0xe000, 0xefff) AM_RAM
8282ADDRESS_MAP_END
8383
84#define TRAV_COMMON\
85   PORT_START_TAG("IN0")\
86   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )\
87   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )\
88   /* coin input must be active for 19 frames to be consistently recognized */\
89   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_IMPULSE(19)\
90   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )\
91   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )\
92   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )\
93   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )\
94   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )\
95   PORT_START_TAG("IN1")\
96   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY\
97   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY\
98   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )\
99   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )\
100   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )\
101   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )\
102   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )\
103   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 )\
104   PORT_START_TAG("IN2")\
105   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL\
106   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL\
107   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )\
108   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )\
109   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 )\
110   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL\
111   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )\
112   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL\
113   PORT_START_TAG("DSW1")\
114   PORT_DIPNAME( 0x03, 0x03, "Fuel Reduced on Collision" )\
115   PORT_DIPSETTING(    0x03, DEF_STR( Low ) )\
116   PORT_DIPSETTING(    0x02, "Med" )\
117   PORT_DIPSETTING(    0x01, "Hi" )\
118   PORT_DIPSETTING(    0x00, "Max" )\
119   PORT_DIPNAME( 0x04, 0x04, "Fuel Consumption" )\
120   PORT_DIPSETTING(    0x04, DEF_STR( Low ) )\
121   PORT_DIPSETTING(    0x00, "Hi" )\
122   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Allow_Continue ) )\
123   PORT_DIPSETTING(    0x08, DEF_STR( No ) )\
124   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )\
125   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) )\
126   PORT_DIPSETTING(    0xa0, DEF_STR( 6C_1C ) )\
127   PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )\
128   PORT_DIPSETTING(    0xc0, DEF_STR( 4C_1C ) )\
129   PORT_DIPSETTING(    0xd0, DEF_STR( 3C_1C ) )\
130   PORT_DIPSETTING(    0xe0, DEF_STR( 2C_1C ) )\
131   PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )\
132   PORT_DIPSETTING(    0x70, DEF_STR( 1C_2C ) )\
133   PORT_DIPSETTING(    0x60, DEF_STR( 1C_3C ) )\
134   PORT_DIPSETTING(    0x50, DEF_STR( 1C_4C ) )\
135   PORT_DIPSETTING(    0x40, DEF_STR( 1C_5C ) )\
136   PORT_DIPSETTING(    0x30, DEF_STR( 1C_6C ) )\
137   PORT_DIPSETTING(    0x20, DEF_STR( 1C_7C ) )\
138   /* PORT_DIPSETTING( 0x10, "INVALID" ) */\
139   /* PORT_DIPSETTING( 0x00, "INVALID" ) */
140
14184static INPUT_PORTS_START( travrusa )
142TRAV_COMMON
85   PORT_START_TAG("SYSTEM")
86   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
87   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
88   /* coin input must be active for 19 frames to be consistently recognized */
89   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_IMPULSE(19)
90   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
91   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
92   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
93   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
94   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
14395
96   PORT_START_TAG("P1")
97   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY
98   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY
99   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
100   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
101   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
102   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
103   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
104   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 )
105
106   PORT_START_TAG("P2")
107   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL
108   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL
109   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
110   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
111   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 )
112   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
113   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
114   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
115
116   PORT_START_TAG("DSW1")
117   PORT_DIPNAME( 0x03, 0x03, "Fuel Reduced on Collision" )
118   PORT_DIPSETTING(    0x03, DEF_STR( Low ) )
119   PORT_DIPSETTING(    0x02, "Med" )
120   PORT_DIPSETTING(    0x01, "Hi" )
121   PORT_DIPSETTING(    0x00, "Max" )
122   PORT_DIPNAME( 0x04, 0x04, "Fuel Consumption" )
123   PORT_DIPSETTING(    0x04, DEF_STR( Low ) )
124   PORT_DIPSETTING(    0x00, "Hi" )
125   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Allow_Continue ) )
126   PORT_DIPSETTING(    0x08, DEF_STR( No ) )
127   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
128   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) )
129   PORT_DIPSETTING(    0xa0, DEF_STR( 6C_1C ) )
130   PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )
131   PORT_DIPSETTING(    0xc0, DEF_STR( 4C_1C ) )
132   PORT_DIPSETTING(    0xd0, DEF_STR( 3C_1C ) )
133   PORT_DIPSETTING(    0xe0, DEF_STR( 2C_1C ) )
134   PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
135   PORT_DIPSETTING(    0x70, DEF_STR( 1C_2C ) )
136   PORT_DIPSETTING(    0x60, DEF_STR( 1C_3C ) )
137   PORT_DIPSETTING(    0x50, DEF_STR( 1C_4C ) )
138   PORT_DIPSETTING(    0x40, DEF_STR( 1C_5C ) )
139   PORT_DIPSETTING(    0x30, DEF_STR( 1C_6C ) )
140   PORT_DIPSETTING(    0x20, DEF_STR( 1C_7C ) )
141   /* PORT_DIPSETTING( 0x10, "INVALID" ) */
142   /* PORT_DIPSETTING( 0x00, "INVALID" ) */
143
144144   PORT_START_TAG("DSW2")
145145   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
146146   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
r2956r2957
169169
170170/* same as travrusa, no "Title" switch */
171171static INPUT_PORTS_START( motorace )
172TRAV_COMMON
172   PORT_INCLUDE( travrusa )
173173
174   PORT_START   /* DSW2 */
175   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
176   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
177   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
178   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
179   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
180   PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
181   PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
182   PORT_DIPSETTING(    0x04, "Mode 1" )
183   PORT_DIPSETTING(    0x00, "Mode 2" )
184   PORT_DIPNAME( 0x08, 0x08, "Speed Type" )
185   PORT_DIPSETTING(    0x08, "M/H" ) //mph?
186   PORT_DIPSETTING(    0x00, "Km/H" )
187   /* In stop mode, press 2 to stop and 1 to restart */
188   PORT_DIPNAME( 0x10, 0x10, "Stop Mode (Cheat)")
189   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
190   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
174   PORT_MODIFY("DSW2")
191175   PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW )
192   PORT_DIPNAME( 0x40, 0x40, "Invulnerability (Cheat)")
193   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
194   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
195   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
196176INPUT_PORTS_END
197177
198178static INPUT_PORTS_START( shtrider )
199   PORT_START_TAG("IN0")
179   PORT_START_TAG("SYSTEM")
200180   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
201181   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
202182   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
204184   PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED )
205185   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
206186
207   PORT_START_TAG("IN1")
187   PORT_START_TAG("P1")
208188   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY
209189   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY
210190   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
r2956r2957
214194   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
215195   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 )
216196
217   PORT_START_TAG("IN2")
197   PORT_START_TAG("P2")
218198   PORT_BIT( 0x03, IP_ACTIVE_LOW, IPT_UNUSED )
219199   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL
220200   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL
221201   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
222202
223   PORT_START_TAG("DSW0")
203   PORT_START_TAG("DSW1")
224204   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
225205   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
226206   PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
r2956r2957
245225   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
246226   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
247227
248   PORT_START_TAG("DSW1")
228   PORT_START_TAG("DSW2")
249229   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
250230   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
251231   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
src/mame/drivers/aliens.c
r2956r2957
236236static MACHINE_DRIVER_START( aliens )
237237
238238   /* basic machine hardware */
239   MDRV_CPU_ADD(KONAMI, 3000000)      /* ? */
239
240   /* external clock should be 12MHz probably, CPU internal divider and precise cycle timings */
241   /* are unknown though. 3MHz is too low, sprites flicker in the pseudo-3D levels */
242   MDRV_CPU_ADD(KONAMI, 6000000)      /* ? */
240243   MDRV_CPU_PROGRAM_MAP(aliens_map,0)
241244   MDRV_CPU_VBLANK_INT("main", aliens_interrupt)
242245
r2956r2957
507510{
508511   konami_rom_deinterleave_2(REGION_GFX1);
509512   konami_rom_deinterleave_2(REGION_GFX2);
513
514   state_save_register_global(palette_selected);
510515}
511516
512517
513518
514GAME( 1990, aliens,   0,      aliens, aliens, aliens, ROT0, "Konami", "Aliens (World set 1)", 0 )
515GAME( 1990, aliens2,  aliens, aliens, aliens, aliens, ROT0, "Konami", "Aliens (World set 2)", 0 )
516GAME( 1990, aliens3,  aliens, aliens, aliens, aliens, ROT0, "Konami", "Aliens (World set 3)", 0 )
517GAME( 1990, aliensu,  aliens, aliens, aliens, aliens, ROT0, "Konami", "Aliens (US)", 0 )
518GAME( 1990, aliensj,  aliens, aliens, aliens, aliens, ROT0, "Konami", "Aliens (Japan set 1)", 0 )
519GAME( 1990, aliensj2, aliens, aliens, aliens, aliens, ROT0, "Konami", "Aliens (Japan set 2)", 0 )
519GAME( 1990, aliens,   0,      aliens, aliens, aliens, ROT0, "Konami", "Aliens (World set 1)", GAME_SUPPORTS_SAVE )
520GAME( 1990, aliens2,  aliens, aliens, aliens, aliens, ROT0, "Konami", "Aliens (World set 2)", GAME_SUPPORTS_SAVE )
521GAME( 1990, aliens3,  aliens, aliens, aliens, aliens, ROT0, "Konami", "Aliens (World set 3)", GAME_SUPPORTS_SAVE )
522GAME( 1990, aliensu,  aliens, aliens, aliens, aliens, ROT0, "Konami", "Aliens (US)", GAME_SUPPORTS_SAVE )
523GAME( 1990, aliensj,  aliens, aliens, aliens, aliens, ROT0, "Konami", "Aliens (Japan set 1)", GAME_SUPPORTS_SAVE )
524GAME( 1990, aliensj2, aliens, aliens, aliens, aliens, ROT0, "Konami", "Aliens (Japan set 2)", GAME_SUPPORTS_SAVE )
src/mame/drivers/seicross.c
r2956r2957
9191
9292static READ8_HANDLER( friskyt_portB_r )
9393{
94   return (portb & 0x9f) | (input_port_read_indexed(machine, 6) & 0x60);
94   return (portb & 0x9f) | (input_port_read_safe(machine, "DEBUG", 0) & 0x60);
9595}
9696
9797static WRITE8_HANDLER( friskyt_portB_w )
r2956r2957
123123   AM_RANGE(0x9800, 0x981f) AM_RAM AM_BASE(&seicross_row_scroll)
124124   AM_RANGE(0x9880, 0x989f) AM_WRITE(SMH_RAM) AM_BASE(&spriteram_2) AM_SIZE(&spriteram_2_size)
125125   AM_RANGE(0x9c00, 0x9fff) AM_RAM_WRITE(seicross_colorram_w) AM_BASE(&colorram)
126   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r)   /* IN0 */
127   AM_RANGE(0xa800, 0xa800) AM_READ(input_port_1_r)   /* IN1 */
128   AM_RANGE(0xb000, 0xb000) AM_READ(input_port_2_r)   /* test */
126   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("IN0")      /* IN0 */
127   AM_RANGE(0xa800, 0xa800) AM_READ_PORT("IN1")      /* IN1 */
128   AM_RANGE(0xb000, 0xb000) AM_READ_PORT("TEST")      /* test */
129129   AM_RANGE(0xb800, 0xb800) AM_READ(watchdog_reset_r)
130130ADDRESS_MAP_END
131131
r2956r2957
150150
151151static ADDRESS_MAP_START( mcu_no_nvram_map, ADDRESS_SPACE_PROGRAM, 8 )
152152   AM_RANGE(0x0000, 0x007f) AM_RAM
153   AM_RANGE(0x1003, 0x1003) AM_READ(input_port_3_r)   /* DSW1 */
154   AM_RANGE(0x1005, 0x1005) AM_READ(input_port_4_r)   /* DSW2 */
155   AM_RANGE(0x1006, 0x1006) AM_READ(input_port_5_r)   /* DSW3 */
153   AM_RANGE(0x1003, 0x1003) AM_READ_PORT("DSW1")      /* DSW1 */
154   AM_RANGE(0x1005, 0x1005) AM_READ_PORT("DSW2")      /* DSW2 */
155   AM_RANGE(0x1006, 0x1006) AM_READ_PORT("DSW3")      /* DSW3 */
156156   AM_RANGE(0x2000, 0x2000) AM_WRITE(DAC_0_data_w)
157157   AM_RANGE(0x8000, 0xf7ff) AM_ROM
158158   AM_RANGE(0xf800, 0xffff) AM_RAM AM_SHARE(1)
r2956r2957
162162
163163
164164static INPUT_PORTS_START( friskyt )
165   PORT_START      /* IN0 */
165   PORT_START_TAG("IN0")      /* IN0 */
166166   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
167167   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
168168   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2956r2957
172172   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1 )
173173   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START2 )
174174
175   PORT_START      /* IN1 */
175   PORT_START_TAG("IN1")      /* IN1 */
176176   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
177177   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
178178   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
r2956r2957
184184   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
185185   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
186186
187   PORT_START      /* Test */
187   PORT_START_TAG("TEST")      /* Test */
188188   PORT_DIPNAME( 0x01, 0x00, "Test Mode" )
189189   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
190190   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
r2956r2957
195195INPUT_PORTS_END
196196
197197static INPUT_PORTS_START( radrad )
198   PORT_START      /* IN0 */
198   PORT_START_TAG("IN0")      /* IN0 */
199199   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
200200   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
201201   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2956r2957
205205   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1 )
206206   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START2 )
207207
208   PORT_START      /* IN1 */
208   PORT_START_TAG("IN1")      /* IN1 */
209209   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
210210   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
211211   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
r2956r2957
215215   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 )
216216   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
217217
218   PORT_START      /* Test */
218   PORT_START_TAG("TEST")      /* Test */
219219   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
220220   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_COCKTAIL
221221   PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* probably unused */
222222
223   PORT_START   /* DSW1 */
223   PORT_START_TAG("DSW1")         /* DSW1 */
224224   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
225225   PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
226226   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
r2956r2957
234234   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
235235   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
236236
237   PORT_START   /* DSW2 */
237   PORT_START_TAG("DSW2")      /* DSW2 */
238238   PORT_DIPNAME( 0x0f, 0x01, DEF_STR( Coin_A ) )
239239   PORT_DIPSETTING(    0x07, DEF_STR( 7C_1C ) )
240240   PORT_DIPSETTING(    0x06, DEF_STR( 6C_1C ) )
r2956r2957
253253   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
254254   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
255255
256   PORT_START   /* DSW3 */
256   PORT_START_TAG("DSW3")      /* DSW3 */
257257   PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_B ) )
258258   PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
259259   PORT_DIPSETTING(    0x09, DEF_STR( 2C_2C ) )
r2956r2957
275275INPUT_PORTS_END
276276
277277static INPUT_PORTS_START( seicross )
278   PORT_START      /* IN0 */
278   PORT_START_TAG("IN0")      /* IN0 */
279279   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
280280   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
281281   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2956r2957
285285   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1 )
286286   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START2 )
287287
288   PORT_START      /* IN1 */
288   PORT_START_TAG("IN1")      /* IN1 */
289289   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
290290   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
291291   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
r2956r2957
295295   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 )
296296   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
297297
298   PORT_START      /* Test */
298   PORT_START_TAG("TEST")      /* Test */
299299   PORT_SERVICE( 0x01, IP_ACTIVE_HIGH )
300300   PORT_DIPNAME( 0x02, 0x00, "Connection Error" )
301301   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
302302   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
303303   PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* probably unused */
304304
305   PORT_START   /* DSW1 */
305   PORT_START_TAG("DSW1")      /* DSW1 */
306306   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Unknown ) )
307307   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
308308   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
r2956r2957
316316   PORT_DIPSETTING(    0x0c, "30000 60000 90000" )
317317   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
318318
319   PORT_START   /* DSW2 */
319   PORT_START_TAG("DSW2")      /* DSW2 */
320320   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
321321   PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
322322   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
r2956r2957
330330   PORT_DIPSETTING(    0x0c, "5" )
331331   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
332332
333   PORT_START   /* DSW3 */
333   PORT_START_TAG("DSW3")      /* DSW3 */
334334   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) )
335335   PORT_DIPSETTING(    0x03, DEF_STR( 4C_1C ) )
336336   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
r2956r2957
343343   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_6C ) )
344344   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
345345
346   PORT_START   /* Debug */
346   PORT_START_TAG("DEBUG")      /* Debug */
347347   PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_UNKNOWN )
348348   PORT_DIPNAME( 0x20, 0x20, "Debug Mode" )
349349   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
src/mame/drivers/system16.c
r2956r2957
226226}
227227
228228
229
230229/***************************************************************************/
231230/*
232231    Tough Turf (Datsu bootleg) sound emulation
r2956r2957
423422
424423//static UINT16 coinctrl;
425424
426
427425static WRITE16_HANDLER( sys16_coinctrl_w )
428426{
429427   if( ACCESSING_BITS_0_7 )
r2956r2957
492490   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "right", 0.48)
493491MACHINE_DRIVER_END
494492
495
496
497493/***************************************************************************/
498494
499495static WRITE16_HANDLER( sys16_tilebank_w )
r2956r2957
542538   sys16_bg_page[3] = data&0xf;
543539}
544540
545
546
547
548
549541/***************************************************************************/
550/***************************************************************************/
551/***************************************************************************/
552542
543static INPUT_PORTS_START( sys16_common )
544   PORT_START_TAG("P1")
545   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 )
546   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
547   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 )
548   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
549   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
550   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
551   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
552   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
553553
554   PORT_START_TAG("P2")
555   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
556   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
557   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
558   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
559   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
560   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
561   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
562   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
554563
564   PORT_START_TAG("SERVICE")
565   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
566   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
567   PORT_SERVICE_NO_TOGGLE(0x04, IP_ACTIVE_LOW)
568   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
569   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
570   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
571   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
572   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
555573
556/***************************************************************************/
574   PORT_START_TAG("DSW1")
575   PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3,4")
576   PORT_DIPSETTING(    0x07, DEF_STR( 4C_1C ) )
577   PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) )
578   PORT_DIPSETTING(    0x09, DEF_STR( 2C_1C ) )
579   PORT_DIPSETTING(    0x05, "2 Coins/1 Credit 5/3 6/4" )
580   PORT_DIPSETTING(    0x04, "2 Coins/1 Credit 4/3" )
581   PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
582   PORT_DIPSETTING(    0x01, "1 Coin/1 Credit 2/3" )
583   PORT_DIPSETTING(    0x02, "1 Coin/1 Credit 4/5" )
584   PORT_DIPSETTING(    0x03, "1 Coin/1 Credit 5/6" )
585   PORT_DIPSETTING(    0x06, DEF_STR( 2C_3C ) )
586   PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
587   PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
588   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
589   PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
590   PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
591   PORT_DIPSETTING(    0x00, "Free Play (if Coin B too) or 1/1" )
592   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:5,6,7,8")
593   PORT_DIPSETTING(    0x70, DEF_STR( 4C_1C ) )
594   PORT_DIPSETTING(    0x80, DEF_STR( 3C_1C ) )
595   PORT_DIPSETTING(    0x90, DEF_STR( 2C_1C ) )
596   PORT_DIPSETTING(    0x50, "2 Coins/1 Credit 5/3 6/4" )
597   PORT_DIPSETTING(    0x40, "2 Coins/1 Credit 4/3" )
598   PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
599   PORT_DIPSETTING(    0x10, "1 Coin/1 Credit 2/3" )
600   PORT_DIPSETTING(    0x20, "1 Coin/1 Credit 4/5" )
601   PORT_DIPSETTING(    0x30, "1 Coin/1 Credit 5/6" )
602   PORT_DIPSETTING(    0x60, DEF_STR( 2C_3C ) )
603   PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
604   PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
605   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
606   PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
607   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
608   PORT_DIPSETTING(    0x00, "Free Play (if Coin A too) or 1/1" )
609INPUT_PORTS_END
557610
558
559611/***************************************************************************/
560612
561
562/***************************************************************************/
563
564/***************************************************************************/
565
566
567/***************************************************************************/
568
569
570/***************************************************************************/
571
572
573
574/***************************************************************************/
575
576613#ifdef UNUSED_DEFINITION
577614static INPUT_PORTS_START( aliensyn )
578   SYS16_JOY1
579   SYS16_JOY2
580   SYS16_SERVICE
581   SYS16_COINAGE
615   PORT_INCLUDE( sys16_common )
582616
583617   PORT_START_TAG("DSW2")
584618   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW2:1" ) /* Listed as "Unused" */
r2956r2957
604638#endif
605639/****************************************************************************/
606640
607
608/***************************************************************************/
609
610
611641static ADDRESS_MAP_START( bayroute_readmem, ADDRESS_SPACE_PROGRAM, 16 )
612642   AM_RANGE(0x000000, 0x0bffff) AM_READ(SMH_ROM)
613643   AM_RANGE(0x500000, 0x503fff) AM_READ(SYS16_MRA16_WORKINGRAM)
r2956r2957
615645   AM_RANGE(0x700000, 0x70ffff) AM_READ(SYS16_MRA16_TILERAM)
616646   AM_RANGE(0x710000, 0x710fff) AM_READ(SYS16_MRA16_TEXTRAM)
617647   AM_RANGE(0x800000, 0x800fff) AM_READ(SYS16_MRA16_PALETTERAM)
618   AM_RANGE(0x901002, 0x901003) AM_READ(input_port_0_word_r) // player1
619   AM_RANGE(0x901006, 0x901007) AM_READ(input_port_1_word_r) // player2
620   AM_RANGE(0x901000, 0x901001) AM_READ(input_port_2_word_r) // service
621   AM_RANGE(0x902002, 0x902003) AM_READ(input_port_3_word_r) // dip1
622   AM_RANGE(0x902000, 0x902001) AM_READ(input_port_4_word_r) // dip2
648   AM_RANGE(0x901002, 0x901003) AM_READ_PORT("P1")
649   AM_RANGE(0x901006, 0x901007) AM_READ_PORT("P2")
650   AM_RANGE(0x901000, 0x901001) AM_READ_PORT("SERVICE")
651   AM_RANGE(0x902002, 0x902003) AM_READ_PORT("DSW1")
652   AM_RANGE(0x902000, 0x902001) AM_READ_PORT("DSW2")
623653ADDRESS_MAP_END
624654
625655static ADDRESS_MAP_START( bayroute_writemem, ADDRESS_SPACE_PROGRAM, 16 )
r2956r2957
664694{
665695   MACHINE_RESET_CALL(sys16_onetime);
666696}
697
667698/***************************************************************************/
668699
669700static INPUT_PORTS_START( bayroute )
670   SYS16_JOY1
671   SYS16_JOY2
672   SYS16_SERVICE
673   SYS16_COINAGE
701   PORT_INCLUDE( sys16_common )
674702
675703   PORT_START_TAG("DSW2")
676704   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW2:1")
r2956r2957
708736   MDRV_MACHINE_RESET(bayroute)
709737MACHINE_DRIVER_END
710738
711/***************************************************************************
712
713   Body Slam
714
715***************************************************************************/
716
717
718739/***************************************************************************/
719740
720
721/***************************************************************************/
722
723
724/***************************************************************************/
725
726
727/***************************************************************************/
728
729741static ADDRESS_MAP_START( dduxbl_readmem, ADDRESS_SPACE_PROGRAM, 16 )
730742   AM_RANGE(0x000000, 0x0bffff) AM_READ(SMH_ROM)
731743   AM_RANGE(0x400000, 0x40ffff) AM_READ(SYS16_MRA16_TILERAM)
732744   AM_RANGE(0x410000, 0x410fff) AM_READ(SYS16_MRA16_TEXTRAM)
733745   AM_RANGE(0x440000, 0x440fff) AM_READ(SYS16_MRA16_SPRITERAM)
734746   AM_RANGE(0x840000, 0x840fff) AM_READ(SYS16_MRA16_PALETTERAM)
735   AM_RANGE(0xc41002, 0xc41003) AM_READ(input_port_0_word_r) // player1
736   AM_RANGE(0xc41004, 0xc41005) AM_READ(input_port_1_word_r) // player2
737   AM_RANGE(0xc41000, 0xc41001) AM_READ(input_port_2_word_r) // service
738   AM_RANGE(0xc42002, 0xc42003) AM_READ(input_port_3_word_r) // dip1
739   AM_RANGE(0xc42000, 0xc42001) AM_READ(input_port_4_word_r) // dip2
747   AM_RANGE(0xc41002, 0xc41003) AM_READ_PORT("P1")
748   AM_RANGE(0xc41004, 0xc41005) AM_READ_PORT("P2")
749   AM_RANGE(0xc41000, 0xc41001) AM_READ_PORT("SERVICE")
750   AM_RANGE(0xc42002, 0xc42003) AM_READ_PORT("DSW1")
751   AM_RANGE(0xc42000, 0xc42001) AM_READ_PORT("DSW2")
740752   AM_RANGE(0xffc000, 0xffffff) AM_READ(SYS16_MRA16_WORKINGRAM)
741753ADDRESS_MAP_END
742754
r2956r2957
823835   MACHINE_RESET_CALL(sys16_onetime);
824836   sys16_video_config(dduxbl_update_proc, -0x48, bank);
825837}
838
826839/***************************************************************************/
827840
828841static INPUT_PORTS_START( ddux )
829   SYS16_JOY1
830   SYS16_JOY2
831   SYS16_SERVICE
832   SYS16_COINAGE
842   PORT_INCLUDE( sys16_common )
833843
834844   PORT_START_TAG("DSW2")
835845   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:1")
r2956r2957
867877
868878/***************************************************************************/
869879
870
871
872880static ADDRESS_MAP_START( eswat_readmem, ADDRESS_SPACE_PROGRAM, 16 )
873881   AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM)
874882   AM_RANGE(0x400000, 0x40ffff) AM_READ(SYS16_MRA16_TILERAM)
875883   AM_RANGE(0x410000, 0x418fff) AM_READ(SYS16_MRA16_TEXTRAM) //*
876884   AM_RANGE(0x440000, 0x440fff) AM_READ(SYS16_MRA16_SPRITERAM)
877885   AM_RANGE(0x840000, 0x840fff) AM_READ(SYS16_MRA16_PALETTERAM)
878   AM_RANGE(0xc41002, 0xc41003) AM_READ(input_port_0_word_r) // player1
879   AM_RANGE(0xc41006, 0xc41007) AM_READ(input_port_1_word_r) // player2
880   AM_RANGE(0xc41000, 0xc41001) AM_READ(input_port_2_word_r) // service
881   AM_RANGE(0xc42002, 0xc42003) AM_READ(input_port_3_word_r) // dip1
882   AM_RANGE(0xc42000, 0xc42001) AM_READ(input_port_4_word_r) // dip2
886   AM_RANGE(0xc41002, 0xc41003) AM_READ_PORT("P1")
887   AM_RANGE(0xc41006, 0xc41007) AM_READ_PORT("P2")
888   AM_RANGE(0xc41000, 0xc41001) AM_READ_PORT("SERVICE")
889   AM_RANGE(0xc42002, 0xc42003) AM_READ_PORT("DSW1")
890   AM_RANGE(0xc42000, 0xc42001) AM_READ_PORT("DSW2")
883891   AM_RANGE(0xffc000, 0xffffff) AM_READ(SYS16_MRA16_WORKINGRAM)
884892ADDRESS_MAP_END
885893
r2956r2957
894902}
895903
896904
897
898905static ADDRESS_MAP_START( eswatbl_writemem, ADDRESS_SPACE_PROGRAM, 16 )
899906   AM_RANGE(0x000000, 0x07ffff) AM_WRITE(SMH_ROM)
900907   AM_RANGE(0x3e2000, 0x3e2001) AM_WRITE(eswat_tilebank0_w)
r2956r2957
908915   AM_RANGE(0xffc000, 0xffffff) AM_WRITE(SYS16_MWA16_WORKINGRAM) AM_BASE(&sys16_workingram)
909916ADDRESS_MAP_END
910917
911
912918/***************************************************************************/
913919
914920static void eswatbl_update_proc( void )
r2956r2957
952958/***************************************************************************/
953959
954960static INPUT_PORTS_START( eswat )
955   SYS16_JOY1
956   SYS16_JOY2
957   SYS16_SERVICE
958   SYS16_COINAGE
961   PORT_INCLUDE( sys16_common )
959962
960963   PORT_START_TAG("DSW2")
961964   PORT_DIPNAME( 0x01, 0x01, "Credits To Start" ) PORT_DIPLOCATION("SW2:1")
r2956r2957
996999
9971000/***************************************************************************/
9981001
999
1000/***************************************************************************/
1001
1002
1003/***************************************************************************/
1004
1005
1006/***************************************************************************/
1007
1008
10091002static ADDRESS_MAP_START( fpointbl_map, ADDRESS_SPACE_PROGRAM, 16 )
10101003   AM_RANGE(0x000000, 0x01ffff) AM_ROM
10111004//  AM_RANGE(0x02002e, 0x020049) AM_READ(fp_io_service_dummy_r)
10121005   AM_RANGE(0x600006, 0x600007) AM_WRITE(sound_command_w)
1013   AM_RANGE(0x601000, 0x601001) AM_READ(input_port_0_word_r) // service
1014   AM_RANGE(0x601002, 0x601003) AM_READ(input_port_1_word_r) // player1
1015   AM_RANGE(0x601004, 0x601005) AM_READ(input_port_2_word_r) // player2
1016   AM_RANGE(0x600000, 0x600001) AM_READ(input_port_3_word_r) // dip1
1017   AM_RANGE(0x600002, 0x600003) AM_READ(input_port_4_word_r) // dip2
1006   AM_RANGE(0x601000, 0x601001) AM_READ_PORT("SERVICE")
1007   AM_RANGE(0x601002, 0x601003) AM_READ_PORT("P1")
1008   AM_RANGE(0x601004, 0x601005) AM_READ_PORT("P2")
1009   AM_RANGE(0x600000, 0x600001) AM_READ_PORT("DSW2")
1010   AM_RANGE(0x600002, 0x600003) AM_READ_PORT("DSW1")
10181011   AM_RANGE(0x400000, 0x40ffff) AM_READWRITE(SYS16_MRA16_TILERAM, SYS16_MWA16_TILERAM) AM_BASE(&sys16_tileram)
10191012   AM_RANGE(0x410000, 0x410fff) AM_READWRITE(SYS16_MRA16_TEXTRAM, SYS16_MWA16_TEXTRAM) AM_BASE(&sys16_textram)
10201013   AM_RANGE(0x440000, 0x440fff) AM_READWRITE(SYS16_MRA16_SPRITERAM, SYS16_MWA16_SPRITERAM) AM_BASE(&sys16_spriteram)
r2956r2957
10711064   MACHINE_RESET_CALL(sys16_onetime);
10721065   sys16_video_config(fpoint_update_proc, -0xb8, NULL);
10731066}
1067
10741068/***************************************************************************/
10751069
1076static INPUT_PORTS_START( fpoint )
1077   SYS16_SERVICE
10781070
1079   PORT_START_TAG("IN0")
1080   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
1081   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 )
1082   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
1083   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1084   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
1085   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
1086   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
1087   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
1071static INPUT_PORTS_START( fpointbl )
1072   PORT_START_TAG("SERVICE")
1073   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1074   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
1075   PORT_SERVICE_NO_TOGGLE(0x04, IP_ACTIVE_LOW)
1076   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
1077   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
1078   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
1079   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1080   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
10881081
1089   PORT_START_TAG("IN1")
1090   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
1091
1092   PORT_START_TAG("IN3")
1093   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1094   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1095   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
1096   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1097   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
1098   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
1099   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
1100   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
1101
1102   PORT_START_TAG("DSW2")
1103   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW2:1" ) /* Listed as "Unused" */
1104   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:2")
1105   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1106   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1107   PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "SW2:3" ) /* Listed as "Unused" */
1108   PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW2:4" ) /* Listed as "Unused" */
1109   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,6")
1110   PORT_DIPSETTING(    0x20, DEF_STR( Easy ) )
1111   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
1112   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
1113   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
1114   PORT_DIPNAME( 0x40, 0x40, "Clear Round Allowed" ) PORT_DIPLOCATION("SW2:7") /* Use button 3 */
1115   PORT_DIPSETTING(    0x00, "1" )
1116   PORT_DIPSETTING(    0x40, "2" )
1117   /* The mode in which a block falls at twice [ usual ] speed as this when playing 25 minutes or more on one coin. */
1118   PORT_DIPNAME( 0x80, 0x80, "2 Cell Move" ) PORT_DIPLOCATION("SW2:8")
1119   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1120   PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
1121
1122   SYS16_COINAGE
1123INPUT_PORTS_END
1124
1125
1126static INPUT_PORTS_START( fpointbj )
1127   SYS16_SERVICE
1128
1129   PORT_START_TAG("IN0")
1082   PORT_START_TAG("P1")
11301083   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
11311084   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 )
11321085   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
r2956r2957
11361089   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
11371090   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
11381091
1139   PORT_START_TAG("IN1")
1092   PORT_START_TAG("P2")
11401093   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
11411094   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
11421095   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
r2956r2957
11661119   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
11671120   PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
11681121
1169   SYS16_COINAGE
1122   PORT_START_TAG("DSW1")
1123   PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3,4")
1124   PORT_DIPSETTING(    0x07, DEF_STR( 4C_1C ) )
1125   PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) )
1126   PORT_DIPSETTING(    0x09, DEF_STR( 2C_1C ) )
1127   PORT_DIPSETTING(    0x05, "2 Coins/1 Credit 5/3 6/4" )
1128   PORT_DIPSETTING(    0x04, "2 Coins/1 Credit 4/3" )
1129   PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
1130   PORT_DIPSETTING(    0x01, "1 Coin/1 Credit 2/3" )
1131   PORT_DIPSETTING(    0x02, "1 Coin/1 Credit 4/5" )
1132   PORT_DIPSETTING(    0x03, "1 Coin/1 Credit 5/6" )
1133   PORT_DIPSETTING(    0x06, DEF_STR( 2C_3C ) )
1134   PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
1135   PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
1136   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
1137   PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
1138   PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
1139   PORT_DIPSETTING(    0x00, "Free Play (if Coin B too) or 1/1" )
1140   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:5,6,7,8")
1141   PORT_DIPSETTING(    0x70, DEF_STR( 4C_1C ) )
1142   PORT_DIPSETTING(    0x80, DEF_STR( 3C_1C ) )
1143   PORT_DIPSETTING(    0x90, DEF_STR( 2C_1C ) )
1144   PORT_DIPSETTING(    0x50, "2 Coins/1 Credit 5/3 6/4" )
1145   PORT_DIPSETTING(    0x40, "2 Coins/1 Credit 4/3" )
1146   PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
1147   PORT_DIPSETTING(    0x10, "1 Coin/1 Credit 2/3" )
1148   PORT_DIPSETTING(    0x20, "1 Coin/1 Credit 4/5" )
1149   PORT_DIPSETTING(    0x30, "1 Coin/1 Credit 5/6" )
1150   PORT_DIPSETTING(    0x60, DEF_STR( 2C_3C ) )
1151   PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
1152   PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
1153   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
1154   PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
1155   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
1156   PORT_DIPSETTING(    0x00, "Free Play (if Coin A too) or 1/1" )
11701157INPUT_PORTS_END
11711158
11721159/***************************************************************************/
r2956r2957
11971184/***************************************************************************/
11981185
11991186static READ16_HANDLER( ga_io_players_r ) {
1200   return (input_port_read_indexed(machine, 0) << 8) | input_port_read_indexed(machine, 1);
1187   return (input_port_read(machine, "P1") << 8) | input_port_read(machine, "P2");
12011188}
12021189static READ16_HANDLER( ga_io_service_r )
12031190{
1204   return (input_port_read_indexed(machine,2) << 8) | (sys16_workingram[0x2c96/2] & 0x00ff);
1191   return (input_port_read(machine,"SERVICE") << 8) | (sys16_workingram[0x2c96/2] & 0x00ff);
12051192}
12061193
12071194static ADDRESS_MAP_START( goldnaxe_readmem, ADDRESS_SPACE_PROGRAM, 16 )
r2956r2957
12111198   AM_RANGE(0x140000, 0x140fff) AM_READ(SYS16_MRA16_PALETTERAM)
12121199   AM_RANGE(0x1f0000, 0x1f0003) AM_READ(SYS16_MRA16_EXTRAM)
12131200   AM_RANGE(0x200000, 0x200fff) AM_READ(SYS16_MRA16_SPRITERAM)
1214   AM_RANGE(0xc41002, 0xc41003) AM_READ(input_port_0_word_r) // player1
1215   AM_RANGE(0xc41006, 0xc41007) AM_READ(input_port_1_word_r) // player2
1216   AM_RANGE(0xc41000, 0xc41001) AM_READ(input_port_2_word_r) // service
1217   AM_RANGE(0xc42002, 0xc42003) AM_READ(input_port_3_word_r) // dip1
1218   AM_RANGE(0xc42000, 0xc42001) AM_READ(input_port_4_word_r) // dip2
1201   AM_RANGE(0xc41002, 0xc41003) AM_READ_PORT("P1")
1202   AM_RANGE(0xc41006, 0xc41007) AM_READ_PORT("P2")
1203   AM_RANGE(0xc41000, 0xc41001) AM_READ_PORT("SERVICE")
1204   AM_RANGE(0xc42002, 0xc42003) AM_READ_PORT("DSW1")
1205   AM_RANGE(0xc42000, 0xc42001) AM_READ_PORT("DSW2")
12191206   AM_RANGE(0xffecd0, 0xffecd1) AM_READ(ga_io_players_r)
12201207   AM_RANGE(0xffec96, 0xffec97) AM_READ(ga_io_service_r)
12211208   AM_RANGE(0xffc000, 0xffffff) AM_READ(SYS16_MRA16_WORKINGRAM)
r2956r2957
12881275   sys16_update_proc = goldnaxe_update_proc;
12891276}
12901277
1291
1292
12931278static DRIVER_INIT( goldnabl )
12941279{
12951280   MACHINE_RESET_CALL(sys16_onetime);
r2956r2957
12981283/***************************************************************************/
12991284
13001285static INPUT_PORTS_START( goldnaxe )
1301   SYS16_JOY1
1302   SYS16_JOY2
1303   SYS16_SERVICE
1304   SYS16_COINAGE
1286   PORT_INCLUDE( sys16_common )
13051287
13061288   PORT_START_TAG("DSW2")
13071289   PORT_DIPNAME( 0x01, 0x01, "Credits Needed" ) PORT_DIPLOCATION("SW2:1")
r2956r2957
13491331
13501332/***************************************************************************/
13511333
1352
1353
1354/***************************************************************************/
1355
1356
1357/***************************************************************************/
1358
1359
1360/***************************************************************************/
1361
1362
1363/***************************************************************************/
1364
1365
1366/***************************************************************************/
1367
13681334static ADDRESS_MAP_START( passsht_readmem, ADDRESS_SPACE_PROGRAM, 16 )
13691335   AM_RANGE(0x000000, 0x01ffff) AM_READ(SMH_ROM)
13701336   AM_RANGE(0x400000, 0x40ffff) AM_READ(SYS16_MRA16_TILERAM)
13711337   AM_RANGE(0x410000, 0x410fff) AM_READ(SYS16_MRA16_TEXTRAM)
13721338   AM_RANGE(0x440000, 0x440fff) AM_READ(SYS16_MRA16_SPRITERAM)
13731339   AM_RANGE(0x840000, 0x840fff) AM_READ(SYS16_MRA16_PALETTERAM)
1374   AM_RANGE(0xc41002, 0xc41003) AM_READ(input_port_0_word_r) // player1
1375   AM_RANGE(0xc41004, 0xc41005) AM_READ(input_port_1_word_r) // player2
1376   AM_RANGE(0xc41000, 0xc41001) AM_READ(input_port_2_word_r) // service
1377   AM_RANGE(0xc42002, 0xc42003) AM_READ(input_port_3_word_r) // dip1
1378   AM_RANGE(0xc42000, 0xc42001) AM_READ(input_port_4_word_r) // dip2
1340   AM_RANGE(0xc41002, 0xc41003) AM_READ_PORT("P1")
1341   AM_RANGE(0xc41004, 0xc41005) AM_READ_PORT("P2")
1342   AM_RANGE(0xc41000, 0xc41001) AM_READ_PORT("SERVICE")
1343   AM_RANGE(0xc42002, 0xc42003) AM_READ_PORT("DSW1")
1344   AM_RANGE(0xc42000, 0xc42001) AM_READ_PORT("DSW2")
13791345   AM_RANGE(0xffc000, 0xffffff) AM_READ(SYS16_MRA16_WORKINGRAM)
13801346ADDRESS_MAP_END
13811347
r2956r2957
13961362
13971363static READ16_HANDLER( passht4b_service_r )
13981364{
1399   UINT16 val=input_port_read_indexed(machine,2);
1400   if(!(input_port_read_indexed(machine, 0) & 0x40)) val&=0xef;
1401   if(!(input_port_read_indexed(machine, 1) & 0x40)) val&=0xdf;
1402   if(!(input_port_read_indexed(machine, 5) & 0x40)) val&=0xbf;
1403   if(!(input_port_read_indexed(machine, 6) & 0x40)) val&=0x7f;
1365   UINT16 val=input_port_read(machine, "SERVICE");
1366   if(!(input_port_read(machine, "P1") & 0x40)) val&=0xef;
1367   if(!(input_port_read(machine, "P2") & 0x40)) val&=0xdf;
1368   if(!(input_port_read(machine, "P3") & 0x40)) val&=0xbf;
1369   if(!(input_port_read(machine, "P4") & 0x40)) val&=0x7f;
14041370
1405   passht4b_io3_val=(input_port_read_indexed(machine, 0)<<4) | (input_port_read_indexed(machine, 5)&0xf);
1406   passht4b_io2_val=(input_port_read_indexed(machine, 1)<<4) | (input_port_read_indexed(machine, 6)&0xf);
1371   passht4b_io3_val=(input_port_read(machine, "P1") << 4) | (input_port_read(machine, "P3") & 0xf);
1372   passht4b_io2_val=(input_port_read(machine, "P2") << 4) | (input_port_read(machine, "P4") & 0xf);
14071373
14081374   passht4b_io1_val=0xff;
14091375
14101376   // player 1 buttons
1411   if(!(input_port_read_indexed(machine, 0) & 0x10)) passht4b_io1_val &=0xfe;
1412   if(!(input_port_read_indexed(machine, 0) & 0x20)) passht4b_io1_val &=0xfd;
1413   if(!(input_port_read_indexed(machine, 0) & 0x80)) passht4b_io1_val &=0xfc;
1377   if(!(input_port_read(machine, "P1") & 0x10)) passht4b_io1_val &=0xfe;
1378   if(!(input_port_read(machine, "P1") & 0x20)) passht4b_io1_val &=0xfd;
1379   if(!(input_port_read(machine, "P1") & 0x80)) passht4b_io1_val &=0xfc;
14141380
14151381   // player 2 buttons
1416   if(!(input_port_read_indexed(machine, 1) & 0x10)) passht4b_io1_val &=0xfb;
1417   if(!(input_port_read_indexed(machine, 1) & 0x20)) passht4b_io1_val &=0xf7;
1418   if(!(input_port_read_indexed(machine, 1) & 0x80)) passht4b_io1_val &=0xf3;
1382   if(!(input_port_read(machine, "P2") & 0x10)) passht4b_io1_val &=0xfb;
1383   if(!(input_port_read(machine, "P2") & 0x20)) passht4b_io1_val &=0xf7;
1384   if(!(input_port_read(machine, "P2") & 0x80)) passht4b_io1_val &=0xf3;
14191385
14201386   // player 3 buttons
1421   if(!(input_port_read_indexed(machine, 5) & 0x10)) passht4b_io1_val &=0xef;
1422   if(!(input_port_read_indexed(machine, 5) & 0x20)) passht4b_io1_val &=0xdf;
1423   if(!(input_port_read_indexed(machine, 5) & 0x80)) passht4b_io1_val &=0xcf;
1387   if(!(input_port_read(machine, "P3") & 0x10)) passht4b_io1_val &=0xef;
1388   if(!(input_port_read(machine, "P3") & 0x20)) passht4b_io1_val &=0xdf;
1389   if(!(input_port_read(machine, "P3") & 0x80)) passht4b_io1_val &=0xcf;
14241390
14251391   // player 4 buttons
1426   if(!(input_port_read_indexed(machine, 6) & 0x10)) passht4b_io1_val &=0xbf;
1427   if(!(input_port_read_indexed(machine, 6) & 0x20)) passht4b_io1_val &=0x7f;
1428   if(!(input_port_read_indexed(machine, 6) & 0x80)) passht4b_io1_val &=0x3f;
1392   if(!(input_port_read(machine, "P4") & 0x10)) passht4b_io1_val &=0xbf;
1393   if(!(input_port_read(machine, "P4") & 0x20)) passht4b_io1_val &=0x7f;
1394   if(!(input_port_read(machine, "P4") & 0x80)) passht4b_io1_val &=0x3f;
14291395
14301396   return val;
14311397}
14321398
1433static READ16_HANDLER( passht4b_io1_r ) {   return passht4b_io1_val;}
1434static READ16_HANDLER( passht4b_io2_r ) {   return passht4b_io2_val;}
1435static READ16_HANDLER( passht4b_io3_r ) {   return passht4b_io3_val;}
1399static READ16_HANDLER( passht4b_io1_r )
1400{
1401   return passht4b_io1_val;
1402}
14361403
1404static READ16_HANDLER( passht4b_io2_r )
1405{
1406   return passht4b_io2_val;
1407}
1408
1409static READ16_HANDLER( passht4b_io3_r )
1410{
1411   return passht4b_io3_val;
1412}
1413
14371414static ADDRESS_MAP_START( passht4b_readmem, ADDRESS_SPACE_PROGRAM, 16 )
14381415   AM_RANGE(0x000000, 0x01ffff) AM_READ(SMH_ROM)
14391416   AM_RANGE(0x400000, 0x40ffff) AM_READ(SYS16_MRA16_TILERAM)
r2956r2957
14441421   AM_RANGE(0xc41002, 0xc41003) AM_READ(passht4b_io1_r)
14451422   AM_RANGE(0xc41004, 0xc41005) AM_READ(passht4b_io2_r)
14461423   AM_RANGE(0xc41006, 0xc41007) AM_READ(passht4b_io3_r)
1447   AM_RANGE(0xc42002, 0xc42003) AM_READ(input_port_3_word_r) // dip1
1448   AM_RANGE(0xc42000, 0xc42001) AM_READ(input_port_4_word_r) // dip2
1449   AM_RANGE(0xc43000, 0xc43001) AM_READ(input_port_0_word_r) // player1        // test mode only
1450   AM_RANGE(0xc43002, 0xc43003) AM_READ(input_port_1_word_r) // player2
1451   AM_RANGE(0xc43004, 0xc43005) AM_READ(input_port_5_word_r) // player3
1452   AM_RANGE(0xc43006, 0xc43007) AM_READ(input_port_6_word_r) // player4
1424   AM_RANGE(0xc42002, 0xc42003) AM_READ_PORT("DSW1")
1425   AM_RANGE(0xc42000, 0xc42001) AM_READ_PORT("DSW2")
1426   AM_RANGE(0xc43000, 0xc43001) AM_READ_PORT("P1")      // test mode only
1427   AM_RANGE(0xc43002, 0xc43003) AM_READ_PORT("P2")
1428   AM_RANGE(0xc43004, 0xc43005) AM_READ_PORT("P3")
1429   AM_RANGE(0xc43006, 0xc43007) AM_READ_PORT("P4")
14531430   AM_RANGE(0xffc000, 0xffffff) AM_READ(SYS16_MRA16_WORKINGRAM)
14541431ADDRESS_MAP_END
14551432
r2956r2957
15231500/***************************************************************************/
15241501
15251502static INPUT_PORTS_START( passsht )
1526   PORT_START_TAG("IN0")
1527   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 )
1528   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
1529   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 )
1503   PORT_INCLUDE( sys16_common )
1504
1505   PORT_MODIFY("P1")
15301506   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 )
1531   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
1532   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
1533   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
1534   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
15351507
1536   PORT_START_TAG("IN1")
1537   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
1538   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
1539   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
1508   PORT_MODIFY("P2")
15401509   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
1541   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
1542   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
1543   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
1544   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
15451510
1546   SYS16_SERVICE
1547   SYS16_COINAGE
1548
15491511   PORT_START_TAG("DSW2")
15501512   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:1")
15511513   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
r2956r2957
15721534INPUT_PORTS_END
15731535
15741536static INPUT_PORTS_START( passht4b )
1575   PORT_START_TAG("IN0")
1537   PORT_INCLUDE( passsht )
1538
1539   PORT_MODIFY("P1")
15761540   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
15771541   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
15781542   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
r2956r2957
15821546   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
15831547   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 )
15841548
1585   PORT_START_TAG("IN1")
1549   PORT_MODIFY("P2")
15861550   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
15871551   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
15881552   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
r2956r2957
15921556   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL
15931557   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_COCKTAIL
15941558
1595   PORT_START_TAG("IN2")
1596   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1597   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
1598   PORT_SERVICE_NO_TOGGLE(0x04, IP_ACTIVE_LOW)
1599   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
1600   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
1601   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
1559   PORT_MODIFY("SERVICE")
16021560   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START3 )
16031561   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
16041562
1605   SYS16_COINAGE
1606
1607   PORT_START_TAG("DSW2")
1608   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:1")
1609   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1610   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1611   PORT_DIPNAME( 0x0e, 0x0e, "Initial Point" ) PORT_DIPLOCATION("SW2:2,3,4")
1612   PORT_DIPSETTING(    0x06, "2000" )
1613   PORT_DIPSETTING(    0x0a, "3000" )
1614   PORT_DIPSETTING(    0x0c, "4000" )
1615   PORT_DIPSETTING(    0x0e, "5000" )
1616   PORT_DIPSETTING(    0x08, "6000" )
1617   PORT_DIPSETTING(    0x04, "7000" )
1618   PORT_DIPSETTING(    0x02, "8000" )
1619   PORT_DIPSETTING(    0x00, "9000" )
1620   PORT_DIPNAME( 0x30, 0x30, "Point Table" ) PORT_DIPLOCATION("SW2:5,6")
1621   PORT_DIPSETTING(    0x20, DEF_STR( Easy ) )
1622   PORT_DIPSETTING(    0x30, DEF_STR( Normal ) )
1623   PORT_DIPSETTING(    0x10, DEF_STR( Hard ) )
1624   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
1625   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:7,8")
1626   PORT_DIPSETTING(    0x80, DEF_STR( Easy ) )
1627   PORT_DIPSETTING(    0xc0, DEF_STR( Normal ) )
1628   PORT_DIPSETTING(    0x40, DEF_STR( Hard ) )
1629   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
1630
1631   PORT_START_TAG("IN5")
1563   PORT_START_TAG("P3")
16321564   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
16331565   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
16341566   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
r2956r2957
16381570   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
16391571   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(3)
16401572
1641   PORT_START_TAG("IN6")
1573   PORT_START_TAG("P4")
16421574   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(4)
16431575   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4)
16441576   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
r2956r2957
16471579   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
16481580   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
16491581   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(4)
1650
16511582INPUT_PORTS_END
16521583
16531584/***************************************************************************/
r2956r2957
16751606
16761607/***************************************************************************/
16771608
1678
1679/***************************************************************************/
1680
1681
1682/***************************************************************************/
1683
1684
1685/***************************************************************************/
1686
16871609static INPUT_PORTS_START( shinobi )
1688   SYS16_JOY1
1689   SYS16_JOY2
1690   SYS16_SERVICE
1691   SYS16_COINAGE
1610   PORT_INCLUDE( sys16_common )
16921611
16931612   PORT_START_TAG("DSW2")
16941613   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:1")
r2956r2957
17171636
17181637/***************************************************************************/
17191638
1720
1721/***************************************************************************/
1722
17231639static ADDRESS_MAP_START( shinobl_readmem, ADDRESS_SPACE_PROGRAM, 16 )
17241640   AM_RANGE(0x000000, 0x03ffff) AM_READ(SMH_ROM)
17251641   AM_RANGE(0x400000, 0x40ffff) AM_READ(SYS16_MRA16_TILERAM)
17261642   AM_RANGE(0x410000, 0x410fff) AM_READ(SYS16_MRA16_TEXTRAM)
17271643   AM_RANGE(0x440000, 0x440fff) AM_READ(SYS16_MRA16_SPRITERAM)
17281644   AM_RANGE(0x840000, 0x840fff) AM_READ(SYS16_MRA16_PALETTERAM)
1729   AM_RANGE(0xc41002, 0xc41003) AM_READ(input_port_0_word_r) // player1
1730   AM_RANGE(0xc41006, 0xc41007) AM_READ(input_port_1_word_r) // player2
1731   AM_RANGE(0xc41000, 0xc41001) AM_READ(input_port_2_word_r) // service
1732   AM_RANGE(0xc42000, 0xc42001) AM_READ(input_port_3_word_r) // dip1
1733   AM_RANGE(0xc42002, 0xc42003) AM_READ(input_port_4_word_r) // dip2
1645   AM_RANGE(0xc41002, 0xc41003) AM_READ_PORT("P1")
1646   AM_RANGE(0xc41006, 0xc41007) AM_READ_PORT("P2")
1647   AM_RANGE(0xc41000, 0xc41001) AM_READ_PORT("SERVICE")
1648   AM_RANGE(0xc42000, 0xc42001) AM_READ_PORT("DSW1")
1649   AM_RANGE(0xc42002, 0xc42003) AM_READ_PORT("DSW2")
17341650   AM_RANGE(0xffc000, 0xffffff) AM_READ(SYS16_MRA16_WORKINGRAM)
17351651ADDRESS_MAP_END
17361652
r2956r2957
17781694   MACHINE_RESET_CALL(sys16_onetime);
17791695}
17801696
1781
17821697/***************************************************************************/
17831698
1784
1785
17861699static MACHINE_DRIVER_START( shinob2 )
17871700
17881701   /* basic machine hardware */
r2956r2957
17931706   MDRV_MACHINE_RESET(shinobl)
17941707MACHINE_DRIVER_END
17951708
1796
17971709/***************************************************************************/
17981710
1799
1800
18011711/* bootleg has extra ram for regs? */
18021712
18031713static ADDRESS_MAP_START( tetrisbl_readmem, ADDRESS_SPACE_PROGRAM, 16 )
r2956r2957
18071717   AM_RANGE(0x418000, 0x41803f) AM_READ(SYS16_MRA16_EXTRAM2)
18081718   AM_RANGE(0x440000, 0x440fff) AM_READ(SYS16_MRA16_SPRITERAM)
18091719   AM_RANGE(0x840000, 0x840fff) AM_READ(SYS16_MRA16_PALETTERAM)
1810   AM_RANGE(0xc41002, 0xc41003) AM_READ(input_port_0_word_r) // player1
1811   AM_RANGE(0xc41006, 0xc41007) AM_READ(input_port_1_word_r) // player2
1812   AM_RANGE(0xc41000, 0xc41001) AM_READ(input_port_2_word_r) // service
1813   AM_RANGE(0xc42002, 0xc42003) AM_READ(input_port_3_word_r) // dip1
1814   AM_RANGE(0xc42000, 0xc42001) AM_READ(input_port_4_word_r) // dip2
1720   AM_RANGE(0xc41002, 0xc41003) AM_READ_PORT("P1")
1721   AM_RANGE(0xc41006, 0xc41007) AM_READ_PORT("P2")
1722   AM_RANGE(0xc41000, 0xc41001) AM_READ_PORT("SERVICE")
1723   AM_RANGE(0xc42002, 0xc42003) AM_READ_PORT("DSW1")
1724   AM_RANGE(0xc42000, 0xc42001) AM_READ_PORT("DSW2")
18151725   AM_RANGE(0xc80000, 0xc80001) AM_READ(SMH_NOP)
18161726   AM_RANGE(0xffc000, 0xffffff) AM_READ(SYS16_MRA16_WORKINGRAM)
18171727ADDRESS_MAP_END
r2956r2957
18311741ADDRESS_MAP_END
18321742
18331743
1834
18351744static READ16_HANDLER(beautyb_unk1_r)
18361745{
18371746
r2956r2957
18681777
18691778/***************************************************************************/
18701779
1871
1872
18731780static void tetris_bootleg_update_proc( void )
18741781{
18751782   sys16_fg_scrolly = sys16_textram[0x748];
r2956r2957
19011808/***************************************************************************/
19021809
19031810static INPUT_PORTS_START( tetris )
1904   SYS16_JOY1
1905   SYS16_JOY2
1906   SYS16_SERVICE
1907   SYS16_COINAGE /* unconfirmed */
1811   PORT_INCLUDE( sys16_common )   /* unconfirmed coinage dip */
19081812
19091813   PORT_START_TAG("DSW2")
19101814   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW2:1" ) /* Listed as "Unused" */
r2956r2957
19471851   MDRV_MACHINE_RESET(tetrisbl)
19481852MACHINE_DRIVER_END
19491853
1950
19511854/***************************************************************************/
19521855
19531856static READ16_HANDLER( tt_io_player1_r )
1954{ return input_port_read_indexed(machine,0) << 8; }
1857{
1858   return input_port_read(machine, "P1") << 8;
1859}
1860
19551861static READ16_HANDLER( tt_io_player2_r )
1956{ return input_port_read_indexed(machine,1) << 8; }
1862{
1863   return input_port_read(machine, "P2") << 8;
1864}
1865
19571866static READ16_HANDLER( tt_io_service_r )
1958{ return input_port_read_indexed(machine,2) << 8; }
1867{
1868   return input_port_read(machine, "SERVICE") << 8;
1869}
19591870
1960
1961
1962/***************************************************************************/
1963
19641871/*
19651872    This game has a MCU which does the following:
19661873    - Get Z80 sound command out of work RAM and write to Z80 sound command register
r2956r2957
19881895    be tricky, tturfbl handles it correctly.
19891896*/
19901897
1991
1992/***************************************************************************/
1993
19941898static INPUT_PORTS_START( tturf )
1995   SYS16_JOY1
1996   SYS16_JOY2
1997   SYS16_SERVICE
1998   SYS16_COINAGE
1899   PORT_INCLUDE( sys16_common )
19991900
20001901   PORT_START_TAG("DSW2")
20011902   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Continues ) ) PORT_DIPLOCATION("SW2:1,2")
r2956r2957
20341935   AM_RANGE(0x400000, 0x40ffff) AM_READ(SYS16_MRA16_TILERAM)
20351936   AM_RANGE(0x410000, 0x410fff) AM_READ(SYS16_MRA16_TEXTRAM)
20361937   AM_RANGE(0x500000, 0x500fff) AM_READ(SYS16_MRA16_PALETTERAM)
2037   AM_RANGE(0x600002, 0x600003) AM_READ(input_port_3_word_r) // dip1
2038   AM_RANGE(0x600000, 0x600001) AM_READ(input_port_4_word_r) // dip2
2039   AM_RANGE(0x601002, 0x601003) AM_READ(input_port_0_word_r) // player1
2040   AM_RANGE(0x601004, 0x601005) AM_READ(input_port_1_word_r) // player2
2041   AM_RANGE(0x601000, 0x601001) AM_READ(input_port_2_word_r) // service
2042   AM_RANGE(0x602002, 0x602003) AM_READ(input_port_3_word_r) // dip1
2043   AM_RANGE(0x602000, 0x602001) AM_READ(input_port_4_word_r) // dip2
1938   AM_RANGE(0x600002, 0x600003) AM_READ_PORT("DSW1")
1939   AM_RANGE(0x600000, 0x600001) AM_READ_PORT("DSW2")
1940   AM_RANGE(0x601002, 0x601003) AM_READ_PORT("P1")
1941   AM_RANGE(0x601004, 0x601005) AM_READ_PORT("P2")
1942   AM_RANGE(0x601000, 0x601001) AM_READ_PORT("SERVICE")
1943   AM_RANGE(0x602002, 0x602003) AM_READ_PORT("DSW1")
1944   AM_RANGE(0x602000, 0x602001) AM_READ_PORT("DSW2")
20441945   AM_RANGE(0xc46000, 0xc4601f) AM_READ(SYS16_MRA16_EXTRAM3)
20451946ADDRESS_MAP_END
20461947
r2956r2957
21082009
21092010   mem = memory_region(machine, REGION_CPU2);
21102011   memcpy(mem, mem+0x10000, 0x8000);
2111
21122012}
2013
21132014/***************************************************************************/
21142015// sound ??
21152016static MACHINE_DRIVER_START( tturfbl )
r2956r2957
21362037
21372038/***************************************************************************/
21382039
2139
2140/***************************************************************************/
2141
2142
2143
2144
2145
2146/***************************************************************************/
2147
21482040static INPUT_PORTS_START( wb3b )
2149   SYS16_JOY1
2150   SYS16_JOY2
2151   SYS16_SERVICE
2152   SYS16_COINAGE
2041   PORT_INCLUDE( sys16_common )
21532042
21542043   PORT_START_TAG("DSW2")
21552044   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW2:1" ) /* Listed as "Unused" */
r2956r2957
21752064
21762065/***************************************************************************/
21772066
2178
2179/***************************************************************************/
2180
21812067static ADDRESS_MAP_START( wb3bbl_readmem, ADDRESS_SPACE_PROGRAM, 16 )
21822068   AM_RANGE(0x000000, 0x03ffff) AM_READ(SMH_ROM)
21832069   AM_RANGE(0x400000, 0x40ffff) AM_READ(SYS16_MRA16_TILERAM)
21842070   AM_RANGE(0x410000, 0x410fff) AM_READ(SYS16_MRA16_TEXTRAM)
21852071   AM_RANGE(0x440000, 0x440fff) AM_READ(SYS16_MRA16_SPRITERAM)
21862072   AM_RANGE(0x840000, 0x840fff) AM_READ(SYS16_MRA16_PALETTERAM)
2187   AM_RANGE(0xc41002, 0xc41003) AM_READ(input_port_0_word_r) // player1
2188   AM_RANGE(0xc41004, 0xc41005) AM_READ(input_port_1_word_r) // player2
2189   AM_RANGE(0xc41000, 0xc41001) AM_READ(input_port_2_word_r) // service
2190   AM_RANGE(0xc42002, 0xc42003) AM_READ(input_port_3_word_r) // dip1
2191   AM_RANGE(0xc42000, 0xc42001) AM_READ(input_port_4_word_r) // dip2
2073   AM_RANGE(0xc41002, 0xc41003) AM_READ_PORT("P1")
2074   AM_RANGE(0xc41004, 0xc41005) AM_READ_PORT("P2")
2075   AM_RANGE(0xc41000, 0xc41001) AM_READ_PORT("SERVICE")
2076   AM_RANGE(0xc42002, 0xc42003) AM_READ_PORT("DSW1")
2077   AM_RANGE(0xc42000, 0xc42001) AM_READ_PORT("DSW2")
21922078   AM_RANGE(0xc46000, 0xc4601f) AM_READ(SYS16_MRA16_EXTRAM3)
21932079   AM_RANGE(0xff0000, 0xffffff) AM_READ(SYS16_MRA16_WORKINGRAM)
21942080ADDRESS_MAP_END
r2956r2957
22772163   MDRV_MACHINE_RESET(wb3bbl)
22782164MACHINE_DRIVER_END
22792165
2280
2281
22822166/*****************************************************************************/
22832167
2284
22852168ROM_START( bayrtbl1 )
22862169   ROM_REGION( 0xc0000, REGION_CPU1, 0 ) /* 68000 code */
22872170   ROM_LOAD16_BYTE( "b4.bin", 0x000000, 0x10000, CRC(eb6646ae) SHA1(073bc0a3868e70785f44e497a949cd9e3b591a33) )
r2956r2957
23422225ROM_END
23432226
23442227// sys16B
2345
23462228ROM_START( dduxbl )
23472229   ROM_REGION( 0x0c0000, REGION_CPU1, 0 ) /* 68000 code */
23482230   ROM_LOAD16_BYTE( "dduxb03.bin", 0x000000, 0x20000, CRC(e7526012) SHA1(a1798008bfa1ce9b87dc330f3817b1978052fcfd) )
r2956r2957
23732255ROM_END
23742256
23752257// sys16B
2376
2377
23782258ROM_START( eswatbl )
23792259   ROM_REGION( 0x080000, REGION_CPU1, 0 ) /* 68000 code */
23802260   ROM_LOAD16_BYTE( "eswat_c.rom", 0x000000, 0x10000, CRC(1028cc81) SHA1(24b4cd182419a44f3d6afa1c4273353024eb278f) )
r2956r2957
24032283ROM_END
24042284
24052285// sys16B
2406
2407
24082286ROM_START( fpointbl )
24092287   ROM_REGION( 0x020000, REGION_CPU1, 0 ) /* 68000 code */
24102288   ROM_LOAD16_BYTE( "flpoint.003", 0x000000, 0x10000, CRC(4d6df514) SHA1(168aa1629ab7152ba1984605155406b236954a2c) )
r2956r2957
25132391
25142392*/
25152393
2516
25172394ROM_START( goldnab2 )
25182395   ROM_REGION( 0x0c0000, REGION_CPU1, 0 ) /* 68000 code */
25192396   ROM_LOAD16_BYTE( "ic39.1", 0x00000, 0x10000, CRC(71489c9a) SHA1(ec25463a2c63027d2635f0e27f5a971d68938fe3) )
r2956r2957
25652442   ROM_LOAD( "ic46.9",  0x10000, 0x10000, CRC(634dd54e) SHA1(ac4ab0ad9c1ac634ff4dfb83232b0fa5cfb26fdd) )
25662443ROM_END
25672444
2568
2569// pre16
2570#ifdef UNUSED_DEFINITION
2571ROM_START( mjleague )
2572   ROM_REGION( 0x030000, REGION_CPU1, 0 ) /* 68000 code */
2573   ROM_LOAD16_BYTE( "epr-7404.09b", 0x000000, 0x8000, CRC(ec1655b5) SHA1(5c1df364fa9733daa4478c5f88298089e4963c33) )
2574   ROM_LOAD16_BYTE( "epr-7401.06b", 0x000001, 0x8000, CRC(2befa5e0) SHA1(0a1681a4c7d62a5754ba6f3845436b4d08324246) )
2575   ROM_LOAD16_BYTE( "epr-7405.10b", 0x010000, 0x8000, CRC(7a4f4e38) SHA1(65a22097dd933e83f326bd64b3863915897780a6) )
2576   ROM_LOAD16_BYTE( "epr-7402.07b", 0x010001, 0x8000, CRC(b7bef762) SHA1(214450e0b094f99ef38dec2a3e5cbdb0b30e917d) )
2577   ROM_LOAD16_BYTE( "epra7406.11b", 0x020000, 0x8000, CRC(bb743639) SHA1(5d99638a79f02ce14374d3b1f3d9fbfc5c13c6e1) )
2578   ROM_LOAD16_BYTE( "epra7403.08b", 0x020001, 0x8000, CRC(d86250cf) SHA1(fb5dabb7b9b9fe0bbe93e28c60311c7b3256107a) )   // Fails memory test. Bad rom?
2579
2580   ROM_REGION( 0x18000, REGION_GFX1, ROMREGION_DISPOSE ) /* tiles */
2581   ROM_LOAD( "epr-7051.09a", 0x00000, 0x08000, CRC(10ca255a) SHA1(ccf58ffcac2f7fbdbfbdf32601a1b97f359cbd91) )
2582   ROM_LOAD( "epr-7052.10a", 0x08000, 0x08000, CRC(2550db0e) SHA1(28f8d68f43d26f12793fe295c205cc86adc4e96a) )
2583   ROM_LOAD( "epr-7053.11a", 0x10000, 0x08000, CRC(5bfea038) SHA1(01dc6e14cc7bba9f7930e68573c441fa2841f49a) )
2584
2585   ROM_REGION( 0x50000, REGION_GFX2, 0 ) /* sprites */
2586   ROM_LOAD16_BYTE( "epr-7055.05a", 0x000001, 0x8000, CRC(1fb860bd) SHA1(4a4155d0352dfae9e402a2b2f1558ef17b1303b4) )
2587   ROM_LOAD16_BYTE( "epr-7059.02b", 0x000000, 0x8000, CRC(3d14091d) SHA1(36208415b2012b6e948fefa15b0f7041748066be) )
2588   ROM_LOAD16_BYTE( "epr-7056.06a", 0x010001, 0x8000, CRC(b35dd968) SHA1(e306b5e38acf583d7b2089302622ad25ae5564b0) )
2589   ROM_LOAD16_BYTE( "epr-7060.03b", 0x010000, 0x8000, CRC(61bb3757) SHA1(5c87cf23be22b84e3dae746527ca057d870d6397) )
2590   ROM_LOAD16_BYTE( "epr-7057.07a", 0x020001, 0x8000, CRC(3e5a2b6f) SHA1(d3dbafb4acb916e02c978a156008bd75ba122fb7) )
2591   ROM_LOAD16_BYTE( "epr-7061.04b", 0x020000, 0x8000, CRC(c808dad5) SHA1(9b65acc8dc23b16e56327298188d1a6ab48b2b5d) )
2592   ROM_LOAD16_BYTE( "epr-7058.08a", 0x030001, 0x8000, CRC(b543675f) SHA1(35ffc9295a8849a18fabe156fdbc9801ea2179cd) )
2593   ROM_LOAD16_BYTE( "epr-7062.05b", 0x030000, 0x8000, CRC(9168eb47) SHA1(daaa7836e627a0679e65373d8f20a9383ba4c905) )
2594//  ROM_LOAD16_BYTE( "epr-7055.05a", 0x040001, 0x8000, CRC(1fb860bd) SHA1(4a4155d0352dfae9e402a2b2f1558ef17b1303b4) ) loaded twice??
2595//  ROM_LOAD16_BYTE( "epr-7059.02b", 0x040000, 0x8000, CRC(3d14091d) SHA1(36208415b2012b6e948fefa15b0f7041748066be) ) loaded twice??
2596
2597   ROM_REGION( 0x20000, REGION_CPU2, 0 ) /* sound CPU */
2598   ROM_LOAD( "eprc7054.01b", 0x00000, 0x8000, CRC(4443b744) SHA1(73359a6e9d62b382dee47fea31b9e17eb26a0321) )
2599
2600   ROM_REGION( 0x1000, REGION_CPU3, 0 )      /* 4k for 7751 onboard ROM */
2601   ROM_LOAD( "7751.bin",     0x0000, 0x0400, CRC(6a9534fc) SHA1(67ad94674db5c2aab75785668f610f6f4eccd158) ) /* 7751 - U34 */
2602
2603   ROM_REGION( 0x20000, REGION_SOUND1, 0 ) /* 7751 sound data */
2604   ROM_LOAD( "epr-7063.01a", 0x00000, 0x8000, CRC(45d8908a) SHA1(e61f81f953c1a744ded36fed3b55774e4747af29) )
2605   ROM_LOAD( "epr-7065.02a", 0x08000, 0x8000, CRC(8c8f8cff) SHA1(fca5a916a8b25800ee5e8771e2ced0ed9bd737f4) )
2606   ROM_LOAD( "epr-7064.03a", 0x10000, 0x8000, CRC(159f6636) SHA1(66fa3f3e95a6ef3d3ff4ded09c05ab1131d9fbbb) )
2607   ROM_LOAD( "epr-7066.04a", 0x18000, 0x8000, CRC(f5cfa91f) SHA1(c85d68cbcd03fe1436bed12235c033610acc11ee) )
2608ROM_END
2609#endif
2610
26112445ROM_START( passht4b )
26122446   ROM_REGION( 0x20000, REGION_CPU1, 0 ) /* 68000 code */
26132447   ROM_LOAD16_BYTE( "pas4p.3", 0x000000, 0x10000, CRC(2d8bc946) SHA1(35d3e529d4815543d9876fd0545c3d686467abaa) )
r2956r2957
26322466ROM_END
26332467
26342468/* Passing Shot Bootleg is a decrypted version of Passing Shot Japanese (passshtj). It has been heavily modified */
2635
26362469ROM_START( passshtb )
26372470   ROM_REGION( 0x020000, REGION_CPU1, 0 ) /* 68000 code */
26382471   ROM_LOAD16_BYTE( "pass3_2p.bin", 0x000000, 0x10000, CRC(26bb9299) SHA1(11bacf86dfdd8bcfbfb61f0ebc59890325c48adc) )
r2956r2957
27332566   ROM_LOAD( "16.bin", 0x0000, 0x10000, CRC(52c8364e) SHA1(01d30b82f92498d155d2e31d43d58dff0285cce3) )
27342567ROM_END
27352568
2736
27372569// sys16B
2738
2739// sys16A custom
2740
2741/*
2742
2743
2744*/
2745
2746// sys16B
27472570ROM_START( tetrisbl )
27482571   ROM_REGION( 0x040000, REGION_CPU1, ROMREGION_ERASEFF ) /* 68000 code */
27492572   ROM_LOAD16_BYTE( "rom2.bin", 0x000000, 0x10000, CRC(4d165c38) SHA1(04706b1977ae18bd09bafaf8ea65f8e5f32e04b8) )
r2956r2957
27902613   ROM_LOAD( "tt0246ff.rom", 0x20000, 0x10000, CRC(bb4bba8f) SHA1(b182a7e1d0425e93c2c1b93472aafd30a6af6907) )
27912614ROM_END
27922615
2793
27942616// sys16B
27952617ROM_START( wb3bbl )
27962618   ROM_REGION( 0x040000, REGION_CPU1, 0 ) /* 68000 code */
r2956r2957
28302652
28312653/* System16B */
28322654/*          rom       parent    machine   inp       init */
2833
28342655GAME( 1989, bayrtbl1, bayroute, bayroute, bayroute, bayrtbl1, ROT0,   "bootleg", "Bay Route (bootleg set 1)", GAME_NOT_WORKING )
28352656GAME( 1989, bayrtbl2, bayroute, bayroute, bayroute, bayrtbl1, ROT0,   "bootleg", "Bay Route (bootleg set 2)", GAME_NOT_WORKING )
28362657GAME( 1989, dduxbl,   ddux,     dduxbl,   ddux,     dduxbl,   ROT0,   "bootleg", "Dynamite Dux (bootleg)", 0 )
28372658GAME( 1989, eswatbl,  eswat,    eswatbl,  eswat,    eswatbl,  ROT0,   "bootleg", "E-Swat - Cyber Police (bootleg)", GAME_IMPERFECT_SOUND )
2838GAME( 1989, fpointbl, fpoint,   fpointbl, fpoint,   fpointbl, ROT0,   "bootleg", "Flash Point (World, bootleg)", 0 )
2839GAME( 1989, fpointbj, fpoint,   fpointbl, fpointbj, fpointbl, ROT0,   "bootleg", "Flash Point (Japan, bootleg)", 0 )
2659GAME( 1989, fpointbl, fpoint,   fpointbl, fpointbl, fpointbl, ROT0,   "bootleg", "Flash Point (World, bootleg)", 0 )
2660GAME( 1989, fpointbj, fpoint,   fpointbl, fpointbl, fpointbl, ROT0,   "bootleg", "Flash Point (Japan, bootleg)", 0 )
28402661
28412662GAME( 1989, goldnabl, goldnaxe, goldnaxe, goldnaxe, goldnabl, ROT0,   "bootleg", "Golden Axe (bootleg, encrypted)", GAME_NOT_WORKING )
28422663GAME( 1989, goldnab2, goldnaxe, goldnaxe, goldnaxe, goldnabl, ROT0,   "bootleg", "Golden Axe (bootleg)", GAME_NOT_WORKING )
r2956r2957
29012722
29022723
29032724GAME( 1991, beautyb,    0,        beautyb,    tetris,    beautyb, ROT0,  "AMT", "Beauty Block", GAME_NO_SOUND|GAME_NOT_WORKING )
2904
src/mame/drivers/simpsons.c
r2956r2957
2525
2626static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
2727   AM_RANGE(0x0000, 0x0fff) AM_RAM
28   AM_RANGE(0x1f80, 0x1f80) AM_READ(input_port_4_r)
28   AM_RANGE(0x1f80, 0x1f80) AM_READ_PORT("COIN")
2929   AM_RANGE(0x1f81, 0x1f81) AM_READ(simpsons_eeprom_r)
30   AM_RANGE(0x1f90, 0x1f90) AM_READ(input_port_0_r)
31   AM_RANGE(0x1f91, 0x1f91) AM_READ(input_port_1_r)
32   AM_RANGE(0x1f92, 0x1f92) AM_READ(input_port_2_r)
33   AM_RANGE(0x1f93, 0x1f93) AM_READ(input_port_3_r)
30   AM_RANGE(0x1f90, 0x1f90) AM_READ_PORT("P1")
31   AM_RANGE(0x1f91, 0x1f91) AM_READ_PORT("P2")
32   AM_RANGE(0x1f92, 0x1f92) AM_READ_PORT("P3")
33   AM_RANGE(0x1f93, 0x1f93) AM_READ_PORT("P4")
3434   AM_RANGE(0x1fa0, 0x1fa7) AM_WRITE(K053246_w)
3535   AM_RANGE(0x1fb0, 0x1fbf) AM_WRITE(K053251_w)
3636   AM_RANGE(0x1fc0, 0x1fc0) AM_WRITE(simpsons_coin_counter_w)
r2956r2957
9292***************************************************************************/
9393
9494static INPUT_PORTS_START( simpsons )
95   PORT_START /* IN0 - Player 1 */
95   PORT_START_TAG("P1") /* IN0 - Player 1 */
9696   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
9797   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
9898   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
102102   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) //BUTTON3 Unused
103103   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
104104
105   PORT_START   /* IN1 - Player 2 */
105   PORT_START_TAG("P2")   /* IN1 - Player 2 */
106106   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
107107   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
108108   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
112112   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) //BUTTON3 Unused
113113   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
114114
115   PORT_START   /* IN2 - Player 3 - Used on the 4p version */
115   PORT_START_TAG("P3")   /* IN2 - Player 3 - Used on the 4p version */
116116   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
117117   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
118118   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
r2956r2957
122122   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) //BUTTON3 Unused
123123   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 )
124124
125   PORT_START   /* IN3 - Player 4 - Used on the 4p version */
125   PORT_START_TAG("P4")   /* IN3 - Player 4 - Used on the 4p version */
126126   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
127127   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
128128   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4)
r2956r2957
132132   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) //BUTTON3 Unused
133133   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
134134
135   PORT_START /* IN4 */
135   PORT_START_TAG("COIN") /* IN4 */
136136   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
137137   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
138138   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
r2956r2957
142142   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) //SERVICE3 Unused
143143   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) //SERVICE4 Unused
144144
145   PORT_START /* IN5 */
145   PORT_START_TAG("TEST") /* IN5 */
146146   PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_LOW )
147147   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
148148INPUT_PORTS_END
149149
150150static INPUT_PORTS_START( simpsn2p )
151   PORT_START /* IN0 - Player 1 */
151   PORT_START_TAG("P1") /* IN0 - Player 1 */
152152   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
153153   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
154154   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
158158   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) //BUTTON3 Unused
159159   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
160160
161   PORT_START   /* IN1 - Player 2 */
161   PORT_START_TAG("P2")   /* IN1 - Player 2 */
162162   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
163163   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
164164   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
168168   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) //BUTTON3 Unused
169169   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
170170
171   PORT_START   /* IN2 - Player 3 - Used on the 4p version */
171   PORT_START_TAG("P3")   /* IN2 - Player 3 - Used on the 4p version */
172172//  PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
173173//  PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
174174//  PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
r2956r2957
178178//  PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) //BUTTON3 Unused
179179//  PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 )
180180
181   PORT_START   /* IN3 - Player 4 - Used on the 4p version */
181   PORT_START_TAG("P4")   /* IN3 - Player 4 - Used on the 4p version */
182182//  PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(4)
183183//  PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(4)
184184//  PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(4)
r2956r2957
188188//  PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) //BUTTON3 Unused
189189//  PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
190190
191   PORT_START /* IN4 */
191   PORT_START_TAG("COINS") /* IN4 */
192192   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
193193   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
194194   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) //COIN3 Unused
r2956r2957
198198   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) //SERVICE3 Unused
199199   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) //SERVICE4 Unused
200200
201   PORT_START /* IN5 */
201   PORT_START_TAG("TEST") /* IN5 */
202202   PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_LOW )
203203   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNKNOWN )
204204INPUT_PORTS_END
src/mame/drivers/taito_b.c
r2956r2957
169169
170170#include "driver.h"
171171#include "deprecat.h"
172#include "taitoipt.h"
172173#include "cpu/m68000/m68000.h"
173174#include "video/taitoic.h"
174175#include "machine/eeprom.h"
r2956r2957
328329
329330static READ16_HANDLER( tracky1_hi_r )
330331{
331   return input_port_read_indexed(machine,5);
332   return input_port_read(machine, "TRACKX1");
332333}
333334static READ16_HANDLER( tracky1_lo_r )
334335{
335   return (input_port_read_indexed(machine,5) & 0xff) <<8;
336   return (input_port_read(machine, "TRACKX1") & 0xff) <<8;
336337}
337338static READ16_HANDLER( trackx1_hi_r )
338339{
339   return input_port_read_indexed(machine,6);
340   return input_port_read(machine, "TRACKY1");
340341}
341342static READ16_HANDLER( trackx1_lo_r )
342343{
343   return (input_port_read_indexed(machine,6) & 0xff) <<8;
344   return (input_port_read(machine, "TRACKY1") & 0xff) <<8;
344345}
345346static READ16_HANDLER( tracky2_hi_r )
346347{
347   return input_port_read_indexed(machine,7);
348   return input_port_read(machine, "TRACKX2");
348349}
349350static READ16_HANDLER( tracky2_lo_r )
350351{
351   return (input_port_read_indexed(machine,7) & 0xff) <<8;
352   return (input_port_read(machine, "TRACKX2") & 0xff) <<8;
352353}
353354static READ16_HANDLER( trackx2_hi_r )
354355{
355   return input_port_read_indexed(machine,8);
356   return input_port_read(machine, "TRACKY2");
356357}
357358static READ16_HANDLER( trackx2_lo_r )
358359{
359   return (input_port_read_indexed(machine,8) & 0xff) <<8;
360   return (input_port_read(machine, "TRACKY2") & 0xff) <<8;
360361}
361362
362363
r2956r2957
413414   int res;
414415
415416   res = (eeprom_read_bit() & 0x01);
416   res |= input_port_read_indexed(machine,1) & 0xfe; /* coin inputs */
417   res |= input_port_read(machine, "IN1") & 0xfe;   /* coin inputs */
417418
418419   return res;
419420}
r2956r2957
482483   switch (offset)
483484   {
484485      case 0x01:
485         return eeprom_r(machine,0,mem_mask) << 8;
486         return eeprom_r(machine, 0, mem_mask) << 8;
486487
487488      default:
488         return TC0640FIO_r( machine,offset ) << 8;
489         return TC0640FIO_r(machine, offset) << 8;
489490   }
490491}
491492
r2956r2957
633634   TC0180VCU_MEMR( 0x400000 )
634635
635636   AM_RANGE(0x600000, 0x60000f) AM_READ(TC0220IOC_halfword_byteswap_r)
636   AM_RANGE(0x610000, 0x610001) AM_READ(input_port_5_word_r)      /* player 3,4 inputs*/
637   AM_RANGE(0x610000, 0x610001) AM_READ_PORT("P3_P4")
637638
638639   AM_RANGE(0x700000, 0x700001) AM_READ(SMH_NOP)
639640   AM_RANGE(0x700002, 0x700003) AM_READ(taitosound_comm16_msb_r)
r2956r2957
707708   TC0180VCU_MEMR( 0x400000 )
708709
709710   AM_RANGE(0x500000, 0x50000f) AM_READ(pbobble_input_bypass_r)
710   AM_RANGE(0x500024, 0x500025) AM_READ(input_port_5_word_r)   /* shown in service mode, game omits to read it */
711   AM_RANGE(0x500024, 0x500025) AM_READ_PORT("IN5")      /* shown in service mode, game omits to read it */
711712   AM_RANGE(0x500026, 0x500027) AM_READ(eep_latch_r)   /* not read by this game */
712   AM_RANGE(0x50002e, 0x50002f) AM_READ(input_port_6_word_r)   /* shown in service mode, game omits to read it */
713   AM_RANGE(0x50002e, 0x50002f) AM_READ_PORT("IN6")      /* shown in service mode, game omits to read it */
713714
714715   AM_RANGE(0x700000, 0x700001) AM_READ(SMH_NOP)
715716   AM_RANGE(0x700002, 0x700003) AM_READ(taitosound_comm16_msb_r)
r2956r2957
741742   TC0180VCU_MEMR( 0x400000 )
742743
743744   AM_RANGE(0x500000, 0x50000f) AM_READ(pbobble_input_bypass_r)
744   AM_RANGE(0x500024, 0x500025) AM_READ(input_port_5_word_r)
745   AM_RANGE(0x500024, 0x500025) AM_READ_PORT("IN5")
745746   AM_RANGE(0x500026, 0x500027) AM_READ(eep_latch_r)
746   AM_RANGE(0x50002e, 0x50002f) AM_READ(input_port_6_word_r)
747   AM_RANGE(0x50002e, 0x50002f) AM_READ_PORT("IN6")
747748
748749   AM_RANGE(0x700000, 0x700001) AM_READ(SMH_NOP)
749750   AM_RANGE(0x700002, 0x700003) AM_READ(taitosound_comm16_msb_r)
r2956r2957
775776   TC0180VCU_MEMR( 0x500000 )
776777
777778   AM_RANGE(0x200000, 0x20000f) AM_READ(TC0220IOC_halfword_r)
778   AM_RANGE(0x210000, 0x210001) AM_READ(input_port_5_word_r)
779   AM_RANGE(0x220000, 0x220001) AM_READ(input_port_6_word_r)
780   AM_RANGE(0x230000, 0x230001) AM_READ(input_port_7_word_r)
779   AM_RANGE(0x210000, 0x210001) AM_READ_PORT("IN5")
780   AM_RANGE(0x220000, 0x220001) AM_READ_PORT("IN6")
781   AM_RANGE(0x230000, 0x230001) AM_READ_PORT("IN7")
781782
782783   AM_RANGE(0x100000, 0x100001) AM_READ(SMH_NOP)
783784   AM_RANGE(0x100002, 0x100003) AM_READ(taitosound_comm16_msb_r)
r2956r2957
806807   TC0180VCU_MEMR( 0x400000 )
807808
808809   AM_RANGE(0x200000, 0x20000f) AM_READ(pbobble_input_bypass_r)
809   AM_RANGE(0x200024, 0x200025) AM_READ(input_port_5_word_r)   /* player 3,4 start */
810   AM_RANGE(0x200024, 0x200025) AM_READ_PORT("IN5")   /* player 3,4 start */
810811   AM_RANGE(0x200028, 0x200029) AM_READ(player_34_coin_ctrl_r)
811   AM_RANGE(0x20002e, 0x20002f) AM_READ(input_port_6_word_r)   /* player 3,4 buttons */
812   AM_RANGE(0x20002e, 0x20002f) AM_READ_PORT("IN6")   /* player 3,4 buttons */
812813
813814   AM_RANGE(0x600000, 0x600001) AM_READ(SMH_NOP)
814815   AM_RANGE(0x600002, 0x600003) AM_READ(taitosound_comm16_msb_r)
r2956r2957
901902   TC0180VCU_MEMR( 0x500000 )
902903
903904   AM_RANGE(0x200000, 0x20000f) AM_READ(TC0220IOC_halfword_r)
904   AM_RANGE(0x210000, 0x210001) AM_READ(input_port_5_word_r)
905   AM_RANGE(0x220000, 0x220001) AM_READ(input_port_6_word_r)
906   AM_RANGE(0x230000, 0x230001) AM_READ(input_port_7_word_r)
905   AM_RANGE(0x210000, 0x210001) AM_READ_PORT("IN5")
906   AM_RANGE(0x220000, 0x220001) AM_READ_PORT("IN6")
907   AM_RANGE(0x230000, 0x230001) AM_READ_PORT("IN7")
907908//  AM_RANGE(0x240000, 0x240001) AM_READ(SMH_NOP) /* read 4 times at init */
908909
909910   AM_RANGE(0x100000, 0x100001) AM_READ(SMH_NOP)
r2956r2957
10581059             INPUT PORTS, DIPs
10591060***********************************************************/
10601061
1061#define TAITO_COINAGE_JAPAN_8 \
1062   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
1063   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) ) \
1064   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
1065   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) ) \
1066   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) ) \
1067   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
1068   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
1069   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) ) \
1070   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) ) \
1071   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
1072
1073#define TAITO_COINAGE_WORLD_8 \
1074   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
1075   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
1076   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) \
1077   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) ) \
1078   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
1079   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
1080   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) ) \
1081   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) ) \
1082   PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) ) \
1083   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
1084
1085#define TAITO_COINAGE_US_8 \
1086   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coinage ) ) \
1087   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
1088   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) \
1089   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) ) \
1090   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
1091   PORT_DIPNAME( 0xc0, 0xc0, "Price to Continue" ) \
1092   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) ) \
1093   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
1094   PORT_DIPSETTING(    0x80, DEF_STR( 1C_1C ) ) \
1095   PORT_DIPSETTING(    0xc0, "Same as Start" )
1096
1097#define TAITO_COINAGE_JAPAN_NEW_8 \
1098   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
1099   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) ) \
1100   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) ) \
1101   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
1102   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) ) \
1103   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
1104   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) ) \
1105   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
1106   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) ) \
1107   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
1108
1109#define TAITO_DIFFICULTY_8 \
1110   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) \
1111   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) ) \
1112   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) ) \
1113   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) ) \
1114   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
1115
1116
1117/* Included only the bits that are common to all sets (viofight has 3 buttons) */
1118#define TAITO_B_PLAYERS_INPUT( player ) \
1119   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(player) PORT_8WAY \
1120   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(player) PORT_8WAY \
1121   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(player) PORT_8WAY \
1122   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(player) PORT_8WAY \
1123   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(player) \
1124   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(player)
1125
11261062#define TAITO_B_SYSTEM_INPUT \
11271063   PORT_START_TAG("IN2") \
11281064   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT ) \
r2956r2957
11341070   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) \
11351071   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
11361072
1137#define TAITO_B_DSWA_2_4 \
1138   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) \
1139   PORT_DIPSETTING(    0x02, DEF_STR( Off ) ) \
1140   PORT_DIPSETTING(    0x00, DEF_STR( On ) ) \
1141   PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) \
1142   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) \
1143   PORT_DIPSETTING(    0x00, DEF_STR( Off ) ) \
1144   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
11451073
1146
11471074static INPUT_PORTS_START( rastsag2 )
11481075   PORT_START_TAG("DSWA")
1149   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )  // all 2 "unused" in manual
1150   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1151   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1152   TAITO_B_DSWA_2_4
1153   TAITO_COINAGE_JAPAN_8
1076   TAITO_MACHINE_NO_COCKTAIL  // all 2 "unused" in manual
1077   TAITO_COINAGE_JAPAN_OLD
11541078
11551079   PORT_START_TAG("DSWB")
1156   TAITO_DIFFICULTY_8
1080   TAITO_DIFFICULTY
11571081   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
11581082   PORT_DIPSETTING(    0x0c, "100k only" )
11591083   PORT_DIPSETTING(    0x08, "150k only" )
r2956r2957
11721096   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
11731097
11741098   PORT_START_TAG("IN0")
1175   TAITO_B_PLAYERS_INPUT( 1 )
1176   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1177   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1099   TAITO_JOY_UDLR_2_BUTTONS( 1 )
11781100
11791101   PORT_START_TAG("IN1")
1180   TAITO_B_PLAYERS_INPUT( 2 )
1181   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1182   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1102   TAITO_JOY_UDLR_2_BUTTONS( 2 )
11831103
1184   /* IN2 */
11851104   TAITO_B_SYSTEM_INPUT
11861105INPUT_PORTS_END
11871106
11881107static INPUT_PORTS_START( nastar )
11891108   PORT_START_TAG("DSWA")
1190   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
1191   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1192   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1193   TAITO_B_DSWA_2_4
1194   TAITO_COINAGE_WORLD_8
1109   TAITO_MACHINE_NO_COCKTAIL
1110   TAITO_COINAGE_WORLD
11951111
11961112   PORT_START_TAG("DSWB")
1197   TAITO_DIFFICULTY_8
1113   TAITO_DIFFICULTY
11981114   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
11991115   PORT_DIPSETTING(    0x0c, "100k only" )
12001116   PORT_DIPSETTING(    0x08, "150k only" )
r2956r2957
12121128   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
12131129   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
12141130
1215   PORT_START      /* IN0 */
1216   TAITO_B_PLAYERS_INPUT( 1 )
1217   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1218   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1131   PORT_START_TAG("IN0")
1132   TAITO_JOY_UDLR_2_BUTTONS( 1 )
12191133
1220   PORT_START      /* IN1 */
1221   TAITO_B_PLAYERS_INPUT( 2 )
1222   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1223   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1134   PORT_START_TAG("IN1")
1135   TAITO_JOY_UDLR_2_BUTTONS( 2 )
12241136
1225   /* IN2 */
12261137   TAITO_B_SYSTEM_INPUT
12271138INPUT_PORTS_END
12281139
12291140static INPUT_PORTS_START( nastarw )
12301141   PORT_START_TAG("DSWA")
1231   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
1232   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1233   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
1234   TAITO_B_DSWA_2_4
1235   TAITO_COINAGE_US_8
1142   TAITO_MACHINE_COCKTAIL
1143   TAITO_COINAGE_US
12361144
12371145   PORT_START_TAG("DSWB")
1238   TAITO_DIFFICULTY_8
1146   TAITO_DIFFICULTY
12391147   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
12401148   PORT_DIPSETTING(    0x0c, "100k only" )
12411149   PORT_DIPSETTING(    0x08, "150k only" )
r2956r2957
12541162   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
12551163
12561164   PORT_START_TAG("IN0")
1257   TAITO_B_PLAYERS_INPUT( 1 )
1258   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1259   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1165   TAITO_JOY_UDLR_2_BUTTONS( 1 )
12601166
12611167   PORT_START_TAG("IN1")
1262   TAITO_B_PLAYERS_INPUT( 2 )
1263   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1264   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1168   TAITO_JOY_UDLR_2_BUTTONS( 2 )
12651169
1266   /* IN2 */
12671170   TAITO_B_SYSTEM_INPUT
12681171INPUT_PORTS_END
12691172
12701173static INPUT_PORTS_START( masterw )
12711174   PORT_START_TAG("DSWA")
1272   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
1273   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1274   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
1275   TAITO_B_DSWA_2_4
1276   TAITO_COINAGE_WORLD_8
1175   TAITO_MACHINE_COCKTAIL
1176   TAITO_COINAGE_WORLD
12771177
12781178   PORT_START_TAG("DSWB")
1279   TAITO_DIFFICULTY_8
1179   TAITO_DIFFICULTY
12801180   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
12811181   PORT_DIPSETTING(    0x08, "500k, 1000k and 1500k" )
12821182   PORT_DIPSETTING(    0x0c, "500k and 1000k" )
r2956r2957
12951195   PORT_DIPSETTING(    0x00, "Hover Cycle" )
12961196
12971197   PORT_START_TAG("IN0")
1298   TAITO_B_PLAYERS_INPUT( 1 )
1299   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1300   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1198   TAITO_JOY_UDLR_2_BUTTONS( 1 )
13011199
13021200   PORT_START_TAG("IN1")
1303   TAITO_B_PLAYERS_INPUT( 2 )
1304   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1305   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1201   TAITO_JOY_UDLR_2_BUTTONS( 2 )
13061202
1307   /* IN2 */
13081203   TAITO_B_SYSTEM_INPUT
1309
13101204INPUT_PORTS_END
13111205
13121206static INPUT_PORTS_START( crimec )
r2956r2957
13141208   PORT_DIPNAME( 0x01, 0x01, "Hi Score" )
13151209   PORT_DIPSETTING(    0x01, "Scribble" )
13161210   PORT_DIPSETTING(    0x00, "3 Characters" )
1317   TAITO_B_DSWA_2_4
1318   TAITO_COINAGE_WORLD_8
1211   TAITO_DSWA_BITS_1_TO_3
1212   TAITO_COINAGE_WORLD
13191213
13201214   PORT_START_TAG("DSWB")
1321   TAITO_DIFFICULTY_8
1215   TAITO_DIFFICULTY
13221216   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
13231217   PORT_DIPSETTING(    0x08, "every 80k" )
13241218   PORT_DIPSETTING(    0x0c, "80k only" )
r2956r2957
13361230   PORT_DIPSETTING( 0xc0, DEF_STR( On ) )
13371231
13381232   PORT_START_TAG("IN0")
1339   TAITO_B_PLAYERS_INPUT( 1 )
1340   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1341   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1233   TAITO_JOY_UDLR_2_BUTTONS( 1 )
13421234
13431235   PORT_START_TAG("IN1")
1344   TAITO_B_PLAYERS_INPUT( 2 )
1345   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1346   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1236   TAITO_JOY_UDLR_2_BUTTONS( 2 )
13471237
1348   /* IN2 */
13491238   TAITO_B_SYSTEM_INPUT
13501239INPUT_PORTS_END
13511240
r2956r2957
13541243   PORT_DIPNAME( 0x01, 0x01, "Hi Score" )
13551244   PORT_DIPSETTING(    0x01, "Scribble" )
13561245   PORT_DIPSETTING(    0x00, "3 Characters" )
1357   TAITO_B_DSWA_2_4
1358   TAITO_COINAGE_JAPAN_8
1246   TAITO_DSWA_BITS_1_TO_3
1247   TAITO_COINAGE_JAPAN_OLD
13591248
13601249   PORT_START_TAG("DSWB")
1361   TAITO_DIFFICULTY_8
1250   TAITO_DIFFICULTY
13621251   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
13631252   PORT_DIPSETTING(    0x08, "every 80k" )
13641253   PORT_DIPSETTING(    0x0c, "80k only" )
r2956r2957
13761265   PORT_DIPSETTING( 0xc0, DEF_STR( On ) )
13771266
13781267   PORT_START_TAG("IN0")
1379   TAITO_B_PLAYERS_INPUT( 1 )
1380   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1381   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1268   TAITO_JOY_UDLR_2_BUTTONS( 1 )
13821269
13831270   PORT_START_TAG("IN1")
1384   TAITO_B_PLAYERS_INPUT( 2 )
1385   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1386   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1271   TAITO_JOY_UDLR_2_BUTTONS( 2 )
13871272
1388   /* IN2 */
13891273   TAITO_B_SYSTEM_INPUT
13901274INPUT_PORTS_END
13911275
r2956r2957
13941278   PORT_DIPNAME( 0x01, 0x01, "Hi Score" )
13951279   PORT_DIPSETTING(    0x01, "Scribble" )
13961280   PORT_DIPSETTING(    0x00, "3 Characters" )
1397   TAITO_B_DSWA_2_4
1398   TAITO_COINAGE_US_8
1281   TAITO_DSWA_BITS_1_TO_3
1282   TAITO_COINAGE_US
13991283
14001284   PORT_START_TAG("DSWB")
1401   TAITO_DIFFICULTY_8
1285   TAITO_DIFFICULTY
14021286   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
14031287   PORT_DIPSETTING(    0x08, "every 80k" )
14041288   PORT_DIPSETTING(    0x0c, "80k only" )
r2956r2957
14161300   PORT_DIPSETTING( 0xc0, DEF_STR( On ) )
14171301
14181302   PORT_START_TAG("IN0")
1419   TAITO_B_PLAYERS_INPUT( 1 )
1420   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1421   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1303   TAITO_JOY_UDLR_2_BUTTONS( 1 )
14221304
14231305   PORT_START_TAG("IN1")
1424   TAITO_B_PLAYERS_INPUT( 2 )
1425   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1426   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1306   TAITO_JOY_UDLR_2_BUTTONS( 2 )
14271307
1428   /* IN2 */
14291308   TAITO_B_SYSTEM_INPUT
14301309INPUT_PORTS_END
14311310
r2956r2957
14341313   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
14351314   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
14361315   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1437   TAITO_B_DSWA_2_4
1438   TAITO_COINAGE_JAPAN_8
1316   TAITO_DSWA_BITS_1_TO_3
1317   TAITO_COINAGE_JAPAN_OLD
14391318
14401319   PORT_START_TAG("DSWB")
1441   TAITO_DIFFICULTY_8
1320   TAITO_DIFFICULTY
14421321   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
14431322   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
14441323   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
14591338   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
14601339
14611340   PORT_START_TAG("IN0")
1462   TAITO_B_PLAYERS_INPUT( 1 )
1463   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1464   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1341   TAITO_JOY_UDLR_2_BUTTONS( 1 )
14651342
14661343   PORT_START_TAG("IN1")
1467   TAITO_B_PLAYERS_INPUT( 2 )
1468   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1469   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1344   TAITO_JOY_UDLR_2_BUTTONS( 2 )
14701345
1471   /* IN2 */
14721346   TAITO_B_SYSTEM_INPUT
14731347INPUT_PORTS_END
14741348
14751349static INPUT_PORTS_START( ashura )
14761350   PORT_START_TAG("DSWA")
1477   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
1478   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1479   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
1480   TAITO_B_DSWA_2_4
1481   TAITO_COINAGE_JAPAN_8
1351   TAITO_MACHINE_COCKTAIL
1352   TAITO_COINAGE_JAPAN_OLD
14821353
14831354   PORT_START_TAG("DSWB")
1484   TAITO_DIFFICULTY_8
1355   TAITO_DIFFICULTY
14851356   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
14861357   PORT_DIPSETTING(    0x08, "every 100k" )
14871358   PORT_DIPSETTING(    0x0c, "every 150k" )
r2956r2957
15001371   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
15011372
15021373   PORT_START_TAG("IN0")
1503   TAITO_B_PLAYERS_INPUT( 1 )
1504   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1505   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1374   TAITO_JOY_UDLR_2_BUTTONS( 1 )
15061375
15071376   PORT_START_TAG("IN1")
1508   TAITO_B_PLAYERS_INPUT( 2 )
1509   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1510   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1377   TAITO_JOY_UDLR_2_BUTTONS( 2 )
15111378
1512   /* IN2 */
15131379   TAITO_B_SYSTEM_INPUT
15141380INPUT_PORTS_END
15151381
15161382static INPUT_PORTS_START( ashurau )
15171383   PORT_START_TAG("DSWA")
1518   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
1519   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1520   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
1521   TAITO_B_DSWA_2_4
1522   TAITO_COINAGE_US_8
1384   TAITO_MACHINE_COCKTAIL
1385   TAITO_COINAGE_US
15231386
15241387   PORT_START_TAG("DSWB")
1525   TAITO_DIFFICULTY_8
1388   TAITO_DIFFICULTY
15261389   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
15271390   PORT_DIPSETTING(    0x08, "every 100k" )
15281391   PORT_DIPSETTING(    0x0c, "every 150k" )
r2956r2957
15411404   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
15421405
15431406   PORT_START_TAG("IN0")
1544   TAITO_B_PLAYERS_INPUT( 1 )
1545   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1546   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1407   TAITO_JOY_UDLR_2_BUTTONS( 1 )
15471408
15481409   PORT_START_TAG("IN1")
1549   TAITO_B_PLAYERS_INPUT( 2 )
1550   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1551   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1410   TAITO_JOY_UDLR_2_BUTTONS( 2 )
15521411
1553   /* IN2 */
15541412   TAITO_B_SYSTEM_INPUT
15551413INPUT_PORTS_END
15561414
r2956r2957
16111469   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
16121470   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
16131471   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1614   TAITO_COINAGE_JAPAN_8
1472   TAITO_COINAGE_JAPAN_OLD
16151473
16161474   PORT_START_TAG("DSWB")
1617   TAITO_DIFFICULTY_8
1475   TAITO_DIFFICULTY
16181476   PORT_DIPNAME( 0x0c, 0x0c, "Timer count" )
16191477   PORT_DIPSETTING(    0x0c, "1 sec = 58/60" )
16201478   PORT_DIPSETTING(    0x04, "1 sec = 56/60" )
r2956r2957
16631521   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
16641522   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
16651523
1666   PORT_START_TAG("IN56")      /* IN5 IN6 */
1524   PORT_START_TAG("P3_P4")      /* IN5 IN6 */
16671525   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
16681526   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
16691527   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
r2956r2957
16841542
16851543static INPUT_PORTS_START( rambo3 )
16861544   PORT_START_TAG("DSWA")
1687   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )  // all 5 "unused" in manual
1688   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1689   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1690   TAITO_B_DSWA_2_4
1691   TAITO_COINAGE_WORLD_8
1545   TAITO_MACHINE_NO_COCKTAIL   // all 5 "unused" in manual
1546   TAITO_COINAGE_WORLD
16921547
16931548   PORT_START_TAG("DSWB")
1694   TAITO_DIFFICULTY_8
1549   TAITO_DIFFICULTY
16951550   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
16961551   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
16971552   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
17121567   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
17131568
17141569   PORT_START_TAG("IN0")
1715   TAITO_B_PLAYERS_INPUT( 1 )
1716   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1717   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1570   TAITO_JOY_UDLR_2_BUTTONS( 1 )
17181571
17191572   PORT_START_TAG("IN1")
1720   TAITO_B_PLAYERS_INPUT( 2 )
1721   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1722   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1573   TAITO_JOY_UDLR_2_BUTTONS( 2 )
17231574
1724   /* IN2 */
17251575   TAITO_B_SYSTEM_INPUT
17261576INPUT_PORTS_END
17271577
17281578static INPUT_PORTS_START( rambo3a )
1729   PORT_START /* DSW A */
1730   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
1731   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1732   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1733   TAITO_B_DSWA_2_4
1579   PORT_START_TAG("DSWA")   /* DSW A */
1580   TAITO_MACHINE_NO_COCKTAIL
17341581   /* Coinage similar to US, but there are some differences */
17351582   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coinage ) )
17361583   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
r2956r2957
17441591   PORT_DIPSETTING(    0x00, "Same as Start or 1C/1C (if Coinage 4C/3C)" )
17451592
17461593   PORT_START_TAG("DSWB")
1747   TAITO_DIFFICULTY_8
1594   TAITO_DIFFICULTY
17481595   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
17491596   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
17501597   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
17941641   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
17951642   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
17961643
1797   PORT_START_TAG("IN3")
1644   PORT_START_TAG("TRACKX1")
17981645   PORT_BIT( 0xffff, 0x0000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_REVERSE PORT_PLAYER(1)
17991646
1800   PORT_START_TAG("IN4")
1647   PORT_START_TAG("TRACKY1")
18011648   PORT_BIT( 0xffff, 0x0000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_PLAYER(1)
18021649
1803   PORT_START_TAG("IN5")
1650   PORT_START_TAG("TRACKX2")
18041651   PORT_BIT( 0xffff, 0x0000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_REVERSE PORT_PLAYER(2)
18051652
1806   PORT_START_TAG("IN6")
1653   PORT_START_TAG("TRACKY2")
18071654   PORT_BIT( 0xffff, 0x0000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_PLAYER(2)
18081655INPUT_PORTS_END
18091656
r2956r2957
18841731
18851732static INPUT_PORTS_START( spacedxo )
18861733   PORT_START_TAG("DSWA")
1887   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
1888   PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
1889   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
1890   TAITO_B_DSWA_2_4
1891   TAITO_COINAGE_JAPAN_NEW_8
1734   TAITO_MACHINE_COCKTAIL
1735   TAITO_COINAGE_JAPAN_NEW
18921736
18931737   PORT_START_TAG("DSWB")
1894   TAITO_DIFFICULTY_8
1738   TAITO_DIFFICULTY
18951739   PORT_DIPNAME( 0x0c, 0x0c, "Match Point" )
18961740   PORT_DIPSETTING(    0x08, "4" )
18971741   PORT_DIPSETTING(    0x0c, "3" )
r2956r2957
19681812   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
19691813   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
19701814   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1971
19721815INPUT_PORTS_END
19731816
19741817static INPUT_PORTS_START( qzshowby )
r2956r2957
20451888
20461889static INPUT_PORTS_START( viofight )
20471890   PORT_START_TAG("DSWA")
2048   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )  // all 7 "unused" in manual
2049   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
2050   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2051   TAITO_B_DSWA_2_4
2052   TAITO_COINAGE_WORLD_8
1891   TAITO_MACHINE_NO_COCKTAIL   // all 7 "unused" in manual
1892   TAITO_COINAGE_WORLD
20531893
20541894   PORT_START_TAG("DSWB")
2055   TAITO_DIFFICULTY_8
1895   TAITO_DIFFICULTY
20561896   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
20571897   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
20581898   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
20731913   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
20741914
20751915   PORT_START_TAG("IN0")
2076   TAITO_B_PLAYERS_INPUT( 1 )
2077   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
2078   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1916   TAITO_JOY_UDLR_3_BUTTONS( 1 )
20791917
20801918   PORT_START_TAG("IN1")
2081   TAITO_B_PLAYERS_INPUT( 2 )
2082   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2083   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1919   TAITO_JOY_UDLR_2_BUTTONS( 2 )
20841920
2085   /* IN2 */
20861921   TAITO_B_SYSTEM_INPUT
20871922INPUT_PORTS_END
20881923
20891924static INPUT_PORTS_START( silentd )   /* World Version */
20901925   PORT_START_TAG("DSWA")
2091   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )   /* Listed as "NOT USED" in the manual and only shown as "OFF" */
2092   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
2093   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2094   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
2095   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
2096   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2097   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
2098   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
2099   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2100   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1926   TAITO_MACHINE_NO_COCKTAIL   /* Listed as "NOT USED" in the manual and only shown as "OFF" */
21011927   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coinage ) )
21021928   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
21031929   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
r2956r2957
21211947   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
21221948
21231949   PORT_START_TAG("DSWB")
2124   TAITO_DIFFICULTY_8
1950   TAITO_DIFFICULTY
21251951   PORT_DIPNAME( 0x04, 0x04, "Invulnerability (Cheat)" )
21261952   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
21271953   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
22122038
22132039static INPUT_PORTS_START( silentdj )
22142040   PORT_START_TAG("DSWA")
2215   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )   /* Listed as "NOT USED" in the manual and only shown as "OFF" */
2216   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
2217   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2218   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
2219   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
2220   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2221   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
2222   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
2223   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2224   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2225   TAITO_COINAGE_JAPAN_8
2041   TAITO_MACHINE_NO_COCKTAIL   /* Listed as "NOT USED" in the manual and only shown as "OFF" */
2042   TAITO_COINAGE_JAPAN_OLD
22262043
22272044   PORT_START_TAG("DSWB")
2228   TAITO_DIFFICULTY_8
2045   TAITO_DIFFICULTY
22292046   PORT_DIPNAME( 0x04, 0x04, "Invulnerability (Cheat)" )
22302047   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
22312048   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
23072124
23082125static INPUT_PORTS_START( selfeena )
23092126   PORT_START_TAG("DSWA")
2310   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
2311   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
2312   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2313   TAITO_B_DSWA_2_4
2314   TAITO_COINAGE_JAPAN_NEW_8
2127   TAITO_MACHINE_NO_COCKTAIL
2128   TAITO_COINAGE_JAPAN_NEW
23152129
23162130   PORT_START_TAG("DSWB")
2317   TAITO_DIFFICULTY_8
2131   TAITO_DIFFICULTY
23182132   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
23192133   PORT_DIPSETTING(    0x0c, "100k only" )
23202134   PORT_DIPSETTING(    0x08, "200k only" )
r2956r2957
23652179
23662180static INPUT_PORTS_START( ryujin )
23672181   PORT_START_TAG("DSWA")
2368   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
2369   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
2370   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2371   TAITO_B_DSWA_2_4
2372   TAITO_COINAGE_JAPAN_NEW_8
2182   TAITO_MACHINE_NO_COCKTAIL
2183   TAITO_COINAGE_JAPAN_NEW
23732184
23742185   PORT_START_TAG("DSWB")
2375   TAITO_DIFFICULTY_8
2186   TAITO_DIFFICULTY
23762187   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
23772188   PORT_DIPSETTING(    0x00, "1" )
23782189   PORT_DIPSETTING(    0x04, "2" )
r2956r2957
24472258   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
24482259
24492260   PORT_START_TAG("DSWB") /* DSW B */ //+-ok
2450   TAITO_DIFFICULTY_8
2261   TAITO_DIFFICULTY
24512262   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
24522263   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
24532264   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
src/mame/drivers/suna8.c
r2956r2957
490490{
491491   switch (*hardhead_ip)
492492   {
493      case 0:   return input_port_read_indexed(machine, 0);
494      case 1:   return input_port_read_indexed(machine, 1);
495      case 2:   return input_port_read_indexed(machine, 2);
496      case 3:   return input_port_read_indexed(machine, 3);
493      case 0:   return input_port_read(machine, "P1");
494      case 1:   return input_port_read(machine, "P2");
495      case 2:   return input_port_read(machine, "DSW1");
496      case 3:   return input_port_read(machine, "DSW2");
497497      default:
498498         logerror("CPU #0 - PC %04X: Unknown IP read: %02X\n",activecpu_get_pc(),*hardhead_ip);
499499         return 0xff;
r2956r2957
606606   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM            )   // ROM
607607   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1            )   // Banked ROM
608608   AM_RANGE(0xc000, 0xc000) AM_READ(watchdog_reset_r      )   // Watchdog (Tested!)
609   AM_RANGE(0xc002, 0xc002) AM_READ(input_port_0_r      )   // P1 (Inputs)
610   AM_RANGE(0xc003, 0xc003) AM_READ(input_port_1_r      )   // P2
609   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P1")               // P1 (Inputs)
610   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("P2")               // P2
611611   AM_RANGE(0xc004, 0xc004) AM_READ(rranger_soundstatus_r   )   // Latch Status?
612612   AM_RANGE(0xc200, 0xc200) AM_READ(SMH_NOP            )   // Protection?
613   AM_RANGE(0xc280, 0xc280) AM_READ(input_port_2_r      )   // DSW 1
614   AM_RANGE(0xc2c0, 0xc2c0) AM_READ(input_port_3_r      )   // DSW 2
613   AM_RANGE(0xc280, 0xc280) AM_READ_PORT("DSW1")            // DSW 1
614   AM_RANGE(0xc2c0, 0xc2c0) AM_READ_PORT("DSW2")            // DSW 2
615615   AM_RANGE(0xc600, 0xc7ff) AM_READ(SMH_RAM            )   // Palette
616616   AM_RANGE(0xc800, 0xdfff) AM_READ(SMH_RAM            )   // RAM
617617   AM_RANGE(0xe000, 0xffff) AM_READ(SMH_RAM            )   // Sprites
r2956r2957
696696static ADDRESS_MAP_START( brickzn_readmem, ADDRESS_SPACE_PROGRAM, 8 )
697697   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM               )   // ROM
698698   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1               )   // Banked ROM
699   AM_RANGE(0xc100, 0xc100) AM_READ(input_port_0_r         )   // P1 (Buttons)
700   AM_RANGE(0xc101, 0xc101) AM_READ(input_port_1_r         )   // P2
701   AM_RANGE(0xc102, 0xc102) AM_READ(input_port_2_r         )   // DSW 1
702   AM_RANGE(0xc103, 0xc103) AM_READ(input_port_3_r         )   // DSW 2
703   AM_RANGE(0xc108, 0xc108) AM_READ(input_port_4_r         )   // P1 (Analog)
704   AM_RANGE(0xc10c, 0xc10c) AM_READ(input_port_5_r         )   // P2
705   AM_RANGE(0xc140, 0xc140) AM_READ(brickzn_c140_r         )   // ???
699   AM_RANGE(0xc100, 0xc100) AM_READ_PORT("P1")                  // P1 (Buttons)
700   AM_RANGE(0xc101, 0xc101) AM_READ_PORT("P2")                  // P2
701   AM_RANGE(0xc102, 0xc102) AM_READ_PORT("DSW1")               // DSW 1
702   AM_RANGE(0xc103, 0xc103) AM_READ_PORT("DSW2")               // DSW 2
703   AM_RANGE(0xc108, 0xc108) AM_READ_PORT("TRACK1")               // P1 (Analog)
704   AM_RANGE(0xc10c, 0xc10c) AM_READ_PORT("TRACK2")               // P2
705   AM_RANGE(0xc140, 0xc140) AM_READ(brickzn_c140_r            )   // ???
706706   AM_RANGE(0xc600, 0xc7ff) AM_READ(suna8_banked_paletteram_r   )   // Palette (Banked)
707707   AM_RANGE(0xc800, 0xdfff) AM_READ(SMH_RAM               )   // RAM
708708   AM_RANGE(0xe000, 0xffff) AM_READ(suna8_banked_spriteram_r   )   // Sprites (Banked)
r2956r2957
805805
806806
807807static ADDRESS_MAP_START( hardhea2_readmem, ADDRESS_SPACE_PROGRAM, 8 )
808   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM                  )   // ROM
809   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1                  )   // Banked ROM
810   AM_RANGE(0xc000, 0xc000) AM_READ(input_port_0_r               )   // P1 (Inputs)
811   AM_RANGE(0xc001, 0xc001) AM_READ(input_port_1_r               )   // P2
812   AM_RANGE(0xc002, 0xc002) AM_READ(input_port_2_r               )   // DSW 1
813   AM_RANGE(0xc003, 0xc003) AM_READ(input_port_3_r               )   // DSW 2
814   AM_RANGE(0xc080, 0xc080) AM_READ(input_port_4_r               )   // vblank?
815   AM_RANGE(0xc600, 0xc7ff) AM_READ(SMH_RAM                  )   // Palette (Banked??)
816   AM_RANGE(0xc800, 0xdfff) AM_READ(SMH_BANK2                  )   // RAM (Banked?)
817   AM_RANGE(0xe000, 0xffff) AM_READ(suna8_banked_spriteram_r      )   // Sprites (Banked)
808   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM               )   // ROM
809   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1               )   // Banked ROM
810   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("P1")                  // P1 (Inputs)
811   AM_RANGE(0xc001, 0xc001) AM_READ_PORT("P2")                  // P2
812   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("DSW1")               // DSW 1
813   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW2")               // DSW 2
814   AM_RANGE(0xc080, 0xc080) AM_READ_PORT("BUTTONS")            // vblank?
815   AM_RANGE(0xc600, 0xc7ff) AM_READ(SMH_RAM               )   // Palette (Banked??)
816   AM_RANGE(0xc800, 0xdfff) AM_READ(SMH_BANK2               )   // RAM (Banked?)
817   AM_RANGE(0xe000, 0xffff) AM_READ(suna8_banked_spriteram_r   )   // Sprites (Banked)
818818ADDRESS_MAP_END
819819
820820static ADDRESS_MAP_START( hardhea2_writemem, ADDRESS_SPACE_PROGRAM, 8 )
r2956r2957
872872static ADDRESS_MAP_START( starfigh_readmem, ADDRESS_SPACE_PROGRAM, 8 )
873873   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM               )   // ROM
874874   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1               )   // Banked ROM
875   AM_RANGE(0xc000, 0xc000) AM_READ(input_port_0_r         )   // P1 (Inputs)
876   AM_RANGE(0xc001, 0xc001) AM_READ(input_port_1_r         )   // P2
877   AM_RANGE(0xc002, 0xc002) AM_READ(input_port_2_r         )   // DSW 1
878   AM_RANGE(0xc003, 0xc003) AM_READ(input_port_3_r         )   // DSW 2
875   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("P1")                  // P1 (Inputs)
876   AM_RANGE(0xc001, 0xc001) AM_READ_PORT("P2")                  // P2
877   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("DSW1")               // DSW 1
878   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW2")               // DSW 2
879879   AM_RANGE(0xc600, 0xc7ff) AM_READ(suna8_banked_paletteram_r   )   // Palette (Banked??)
880880   AM_RANGE(0xc800, 0xdfff) AM_READ(SMH_RAM               )   // RAM
881881   AM_RANGE(0xe000, 0xffff) AM_READ(suna8_banked_spriteram_r   )   // Sprites (Banked)
r2956r2957
966966static ADDRESS_MAP_START( sparkman_readmem, ADDRESS_SPACE_PROGRAM, 8 )
967967   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM               )   // ROM
968968   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1               )   // Banked ROM
969   AM_RANGE(0xc000, 0xc000) AM_READ(input_port_0_r         )   // P1 (Inputs)
970   AM_RANGE(0xc001, 0xc001) AM_READ(input_port_1_r         )   // P2
971   AM_RANGE(0xc002, 0xc002) AM_READ(input_port_2_r         )   // DSW 1
972   AM_RANGE(0xc003, 0xc003) AM_READ(input_port_3_r         )   // DSW 2
973   AM_RANGE(0xc080, 0xc080) AM_READ(input_port_4_r         )   // Buttons
969   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("P1")                  // P1 (Inputs)
970   AM_RANGE(0xc001, 0xc001) AM_READ_PORT("P2")                  // P2
971   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("DSW1")               // DSW 1
972   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW2")               // DSW 2
973   AM_RANGE(0xc080, 0xc080) AM_READ_PORT("BUTTONS")            // Buttons
974974   AM_RANGE(0xc0a3, 0xc0a3) AM_READ(sparkman_c0a3_r         )   // ???
975975   AM_RANGE(0xc600, 0xc7ff) AM_READ(SMH_RAM               )   // Palette (Banked??)
976976   AM_RANGE(0xc800, 0xdfff) AM_READ(SMH_RAM               )   // RAM
r2956r2957
11401140
11411141static INPUT_PORTS_START( hardhead )
11421142
1143   PORT_START_TAG("IN0")   // Player 1 - $da00 (ip = 0)
1143   PORT_START_TAG("P1")   // Player 1 - $da00 (ip = 0)
11441144   JOY(1)
11451145
1146   PORT_START_TAG("IN1")   // Player 2 - $da00 (ip = 1)
1146   PORT_START_TAG("P2")   // Player 2 - $da00 (ip = 1)
11471147   JOY(2)
11481148
1149   PORT_START_TAG("IN2")   // DSW 1 - $da00 (ip = 2)
1149   PORT_START_TAG("DSW1")   // DSW 1 - $da00 (ip = 2)
11501150   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
11511151   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
11521152   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
11721172   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
11731173   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
11741174
1175   PORT_START_TAG("IN3") //DSW 2 - $da00 (ip = 3)
1175   PORT_START_TAG("DSW2") //DSW 2 - $da00 (ip = 3)
11761176   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
11771177   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
11781178   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
12041204
12051205static INPUT_PORTS_START( rranger )
12061206
1207   PORT_START_TAG("IN0")   // Player 1 - $c002
1207   PORT_START_TAG("P1")   // Player 1 - $c002
12081208   JOY(1)
12091209
1210   PORT_START_TAG("IN1") // Player 2 - $c003
1210   PORT_START_TAG("P2") // Player 2 - $c003
12111211   JOY(2)
12121212
1213   PORT_START_TAG("IN2") //DSW 1 - $c280
1213   PORT_START_TAG("DSW1") //DSW 1 - $c280
12141214   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
12151215   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
12161216   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
r2956r2957
12351235   PORT_DIPSETTING(    0x40, DEF_STR( Harder ) )
12361236   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
12371237
1238   PORT_START_TAG("IN3") // DSW 2 - $c2c0
1238   PORT_START_TAG("DSW2") // DSW 2 - $c2c0
12391239   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
12401240   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
12411241   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
12691269
12701270static INPUT_PORTS_START( brickzn )
12711271
1272   PORT_START_TAG("IN0") // Player 1 - $c100
1272   PORT_START_TAG("P1") // Player 1 - $c100
12731273   JOY(1)
12741274
1275   PORT_START_TAG("IN1") // Player 2 - $c101
1275   PORT_START_TAG("P2") // Player 2 - $c101
12761276   JOY(2)
12771277
1278   PORT_START_TAG("IN2") // DSW 1 - $c102
1278   PORT_START_TAG("DSW1") // DSW 1 - $c102
12791279   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )   // rom 38:b840
12801280   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
12811281   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
r2956r2957
13021302   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
13031303   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
13041304
1305   PORT_START_TAG("IN3") // DSW 2 - $c103
1305   PORT_START_TAG("DSW2") // DSW 2 - $c103
13061306   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
13071307   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
13081308   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
13271327   PORT_DIPSETTING(    0x40, "4" )
13281328   PORT_DIPSETTING(    0x00, "5" )
13291329
1330   PORT_START_TAG("IN4") // Player 1 - $c108
1330   PORT_START_TAG("TRACK1") // Player 1 - $c108
13311331   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) PORT_REVERSE
13321332
1333   PORT_START_TAG("IN5") // Player 2 - $c10c
1333   PORT_START_TAG("TRACK2") // Player 2 - $c10c
13341334   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(0) PORT_REVERSE
13351335
13361336INPUT_PORTS_END
r2956r2957
13421342
13431343static INPUT_PORTS_START( hardhea2 )
13441344
1345   PORT_START_TAG("IN0") // Player 1 - $c000
1345   PORT_START_TAG("P1") // Player 1 - $c000
13461346   JOY(1)
13471347
1348   PORT_START_TAG("IN1") // Player 2 - $c001
1348   PORT_START_TAG("P2") // Player 2 - $c001
13491349   JOY(2)
13501350
1351   PORT_START_TAG("IN2") // DSW 1 - $c002
1351   PORT_START_TAG("DSW1") // DSW 1 - $c002
13521352   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
13531353   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
13541354   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
r2956r2957
13721372   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
13731373   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
13741374
1375   PORT_START_TAG("IN3") // DSW 2 - $c003
1375   PORT_START_TAG("DSW2") // DSW 2 - $c003
13761376   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
13771377   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
13781378   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
13971397   PORT_DIPSETTING(    0x40, "4" )
13981398   PORT_DIPSETTING(    0x00, "5" )
13991399
1400   PORT_START_TAG("IN4") // Buttons - $c080
1400   PORT_START_TAG("BUTTONS") // Buttons - $c080
14011401   PORT_BIT(  0x01, IP_ACTIVE_LOW,  IPT_UNKNOWN )
14021402   PORT_BIT(  0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
14031403   PORT_BIT(  0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )
r2956r2957
14161416
14171417static INPUT_PORTS_START( sparkman )
14181418
1419   PORT_START_TAG("IN0") // Player 1 - $c000
1419   PORT_START_TAG("P1") // Player 1 - $c000
14201420   JOY(1)
14211421
1422   PORT_START_TAG("IN1") // Player 2 - $c001
1422   PORT_START_TAG("P2") // Player 2 - $c001
14231423   JOY(2)
14241424
1425   PORT_START_TAG("IN2") // DSW 1 - $c002
1425   PORT_START_TAG("DSW1") // DSW 1 - $c002
14261426   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
14271427   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
14281428   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
r2956r2957
14461446   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
14471447   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
14481448
1449   PORT_START_TAG("IN3") // DSW 2 - $c003
1449   PORT_START_TAG("DSW2") // DSW 2 - $c003
14501450   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
14511451   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
14521452   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
14711471   PORT_DIPSETTING(    0x40, "4" )
14721472   PORT_DIPSETTING(    0x00, "5" )
14731473
1474   PORT_START_TAG("IN4") // Buttons - $c080
1474   PORT_START_TAG("BUTTONS") // Buttons - $c080
14751475   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
14761476   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
14771477   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
src/mame/drivers/cps1.c
r2956r2957
61076107   ROM_LOAD( "kd19.bin",      0x20000, 0x20000, CRC(92941b80) SHA1(5fa7c2793e6febee54a83042d118ddd4f2b7d127) )
61086108ROM_END
61096109
6110/*
6111CPU
61126110
61131x TS68000CP12 (main)
61141x TPC1020AFN-084C
61151x Z8400BB1-Z80CPU (sound)
61161x YM2151 (sound)
61171x YM3012A (sound)
61181x OKI-M6295 (sound)
61192x LM324N (sound)
61201x TDA2003 (sound)
61211x oscillator 10.0 MHz
61221x oscillator 22.1184 MHz
61236111
6124ROMs
6125
61261x AM27C512 (1)(sound)
61271x AM27C020 (2)(sound)
61282x AM27C040 (3,4)(main)
61291x Am27C040 (bp)(gfx)
61307x maskrom (ai,bi,ci,di,ap,cp,dp)(gfx)
61311x GAL20V8A (not dumped)
61323x GAL16V8A (not dumped)
61331x PALCE20V8H (not dumped)
61341x GAL20V8S (not dumped)
6135
6136Note
6137
61381x JAMMA edge connector
61391x trimmer (volume)
61403x 8 switches dip
6141
6142*/
6143
6144ROM_START( kodb )
6145   ROM_REGION( CODE_SIZE, REGION_CPU1, 0 )      /* 68000 code */
6146   ROM_LOAD16_BYTE( "3.ic172",    0x00000, 0x080000, CRC(036dd74c) SHA1(489344e56863429e86b4c362b82d89819c1d6afb) )
6147   ROM_LOAD16_BYTE( "4.ic171",    0x00001, 0x080000, CRC(3e4b7295) SHA1(3245640bae7d141238051dfe5c7683d05c6d3848) )
6148
6149   ROM_REGION( 0x400000, REGION_GFX1, 0 )
6150   ROMX_LOAD( "cp.ic90",   0x000000, 0x80000, CRC(e3b8589e) SHA1(775f97e43cb995b93da40063a1f1e4d73b34437c), ROM_SKIP(7) )
6151   ROMX_LOAD( "dp.ic89",   0x000001, 0x80000, CRC(3eec9580) SHA1(3d8d0cfbeae077544e514a5eb96cc83f716e494f), ROM_SKIP(7) )
6152   ROMX_LOAD( "ap.ic88",   0x000002, 0x80000, CRC(fdf5f163) SHA1(271ee96886c958accaca9a82484ab80fe32bd38e), ROM_SKIP(7) )
6153   ROMX_LOAD( "bp.ic87",   0x000003, 0x80000, CRC(4e1c52b7) SHA1(74570e7d577c999c62203c97b3d449e3b61a678a), ROM_SKIP(7) )
6154   ROMX_LOAD( "ci.ic91",   0x000004, 0x80000, CRC(22228bc5) SHA1(d48a09ee284d9e4b986f5c3c1c865930f76986e2), ROM_SKIP(7) )
6155   ROMX_LOAD( "di.ic92",   0x000005, 0x80000, CRC(ab031763) SHA1(5bcd89b1debf029b779aa1bb73b3a572d27154ec), ROM_SKIP(7) )
6156   ROMX_LOAD( "ai.ic93",   0x000006, 0x80000, CRC(cffbf4be) SHA1(f805bafc855d4a656c055a76eaeb26e36835541e), ROM_SKIP(7) )
6157   ROMX_LOAD( "bi.ic94",   0x000007, 0x80000, CRC(4a1b43fe) SHA1(7957f45b2862825c9509043c63c7da7108bd251b), ROM_SKIP(7) )
6158
6159   ROM_REGION( 0x8000, REGION_GFX2, 0 )
6160   ROM_COPY( REGION_GFX1, 0x000000, 0x000000, 0x8000 )   /* stars */
6161
6162   ROM_REGION( 0x18000, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */
6163   ROM_LOAD( "1.ic28",        0x00000, 0x08000, CRC(01cae60c) SHA1(b2cdd883fd859f0b701230831aca1f1a74ad6087) )
6164   ROM_CONTINUE(              0x10000, 0x08000 )
6165
6166   ROM_REGION( 0x40000, REGION_SOUND1, 0 )   /* Samples */
6167   ROM_LOAD( "2.ic19",      0x00000, 0x40000, CRC(a2db1575) SHA1(1a4a29e4b045af50700adf1665697feab12cc234) )
6168ROM_END
6169
61706112/* B-Board 91635B */
61716113ROM_START( captcomm )
61726114   ROM_REGION( CODE_SIZE, REGION_CPU1, 0 )      /* 68000 code */
r2956r2957
85828524GAME( 1991, kod,      0,        cps1_10MHz, kod,      cps1,     ROT0,   "Capcom", "The King of Dragons (World 910711)" , 0)            // "ETC"
85838525GAME( 1991, kodu,     kod,      cps1_10MHz, kodj,     cps1,     ROT0,   "Capcom", "The King of Dragons (US 910910)", 0 )
85848526GAME( 1991, kodj,     kod,      cps1_10MHz, kodj,     cps1,     ROT0,   "Capcom", "The King of Dragons (Japan 910805)", 0 )
8585GAME( 1991, kodb,     kod,      cps1_10MHz, kod,      cps1,     ROT0,   "Capcom", "The King of Dragons (bootleg)", GAME_NOT_WORKING )   // 910731  "ETC"
85868527GAME( 1991, captcomm, 0,        cps1_10MHz, captcomm, cps1,     ROT0,   "Capcom", "Captain Commando (World 911014)" , 0)            // "OTHER COUNTRY"
85878528GAME( 1991, captcomu, captcomm, cps1_10MHz, captcomm, cps1,     ROT0,   "Capcom", "Captain Commando (US 910928)", 0 )
85888529GAME( 1991, captcomj, captcomm, cps1_10MHz, captcomm, cps1,     ROT0,   "Capcom", "Captain Commando (Japan 911202)", 0 )
src/mame/drivers/stactics.c
r2956r2957
8383    /* monitor motor under joystick control */
8484    if (*state->motor_on & 0x01)
8585    {
86      int ip3 = input_port_read_indexed(machine, 3);
87      int ip4 = input_port_read_indexed(machine, 4);
86      int ip3 = input_port_read(machine, "IN3");
87      int ip4 = input_port_read(machine, "FAKE");
8888
8989      /* up */
9090      if (((ip4 & 0x01) == 0) && (state->vert_pos > -128))
r2956r2957
173173static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
174174    AM_RANGE(0x0000, 0x2fff) AM_ROM
175175    AM_RANGE(0x4000, 0x47ff) AM_RAM
176    AM_RANGE(0x5000, 0x5000) AM_MIRROR(0x0fff) AM_READ(input_port_0_r)
177    AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_READ(input_port_1_r)
176    AM_RANGE(0x5000, 0x5000) AM_MIRROR(0x0fff) AM_READ_PORT("IN0")
177    AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_READ_PORT("IN1")
178178    AM_RANGE(0x6000, 0x6001) AM_MIRROR(0x0f08) AM_WRITE(stactics_coin_lockout_w)
179179    AM_RANGE(0x6002, 0x6005) AM_MIRROR(0x0f08) AM_WRITE(SMH_NOP)
180180    AM_RANGE(0x6006, 0x6007) AM_MIRROR(0x0f08) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(stactics_state, palette)
r2956r2957
188188    AM_RANGE(0x6070, 0x609f) AM_MIRROR(0x0f00) AM_WRITE(SMH_NOP)
189189 /* AM_RANGE(0x60a0, 0x60ef) AM_MIRROR(0x0f00) AM_WRITE(stactics_sound2_w) */
190190    AM_RANGE(0x60f0, 0x60ff) AM_MIRROR(0x0f00) AM_WRITE(SMH_NOP)
191    AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_READ(input_port_2_r)
192    AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0fff) AM_READ(input_port_3_r)
191    AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_READ_PORT("IN2")
192    AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0fff) AM_READ_PORT("IN3")
193193    AM_RANGE(0x8000, 0x87ff) AM_MIRROR(0x0800) AM_WRITE(stactics_scroll_ram_w)
194194    AM_RANGE(0x9000, 0x9000) AM_MIRROR(0x0fff) AM_READ(vert_pos_r)
195195    AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x0fff) AM_READ(horiz_pos_r)
r2956r2957
209209 *************************************/
210210
211211static INPUT_PORTS_START( stactics )
212
213    PORT_START  /*  IN0 */
212    PORT_START_TAG("IN0")   /*  IN0 */
214213    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON7 )
215214    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON6 )
216215    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 )
r2956r2957
218217    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 )
219218    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
220219    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
221    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_motor_not_ready, 0)
220    PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_motor_not_ready, 0)
222221
223    PORT_START  /* IN1 */
222    PORT_START_TAG("IN1")   /* IN1 */
224223    PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_B ) )
225224    PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
226225    PORT_DIPSETTING(    0x05, DEF_STR( 2C_1C ) )
r2956r2957
246245    PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
247246    PORT_DIPSETTING(    0x00, DEF_STR( On ) )
248247
249    PORT_START  /* IN2 */
250    PORT_BIT (0x07, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_rng, 0)
251    PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stactics_get_frame_count_d3, 0)
248    PORT_START_TAG("IN2")   /* IN2 */
249    PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_rng, 0)
250    PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stactics_get_frame_count_d3, 0)
252251    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
253252    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
254253    PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
255    PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
256    PORT_DIPSETTING( 0x00, DEF_STR( On ) )
254    PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
255    PORT_DIPSETTING(   0x00, DEF_STR( On ) )
257256   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
258257
259    PORT_START  /* IN3 */
258    PORT_START_TAG("IN3")   /* IN3 */
260259    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
261    PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stactics_get_shot_standby, 0)
260    PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stactics_get_shot_standby, 0)
262261    PORT_DIPNAME( 0x04, 0x04, "Number of Barriers" )
263262    PORT_DIPSETTING(    0x04, "4" )
264263    PORT_DIPSETTING(    0x00, "6" )
r2956r2957
270269    PORT_DIPSETTING(    0x00, DEF_STR( On ) )
271270    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
272271    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
273    PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stactics_get_not_shot_arrive, 0)
272    PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stactics_get_not_shot_arrive, 0)
274273
275   PORT_START   /* FAKE */
274   PORT_START_TAG("FAKE")   /* FAKE */
276275    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
277276    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
278277INPUT_PORTS_END
src/mame/drivers/bbusters.c
r2956r2957
260260
261261static READ16_HANDLER( control_3_r )
262262{
263   /* gun_select seems to assume only values 5,6,7... is this correct? */
264   return input_port_read_indexed(machine, gun_select);
263   static const char *port[] = { "GUNX1", "GUNY1", "GUNX2", "GUNY2", "GUNX3", "GUNY3" };
264
265   return input_port_read(machine, port[gun_select]);
265266}
266267
267268static WRITE16_HANDLER( gun_select_w )
268269{
269270   logerror("%08x: gun r\n",activecpu_get_pc());
270271
271   gun_select=5 + (data&0xff);
272   gun_select = data & 0xff;
272273}
273274
274275static READ16_HANDLER( kludge_r )
275276{
276   bbuster_ram[0xa692/2]=input_port_read(machine, "IN5")<<1;
277   bbuster_ram[0xa694/2]=input_port_read(machine, "IN6")<<1;
278   bbuster_ram[0xa696/2]=input_port_read(machine, "IN7")<<1;
279   bbuster_ram[0xa698/2]=input_port_read(machine, "IN8")<<1;
280   bbuster_ram[0xa69a/2]=input_port_read(machine, "IN9")<<1;
281   bbuster_ram[0xa69c/2]=input_port_read(machine, "IN10")<<1;
277   bbuster_ram[0xa692/2] = input_port_read(machine, "GUNX1")<<1;
278   bbuster_ram[0xa694/2] = input_port_read(machine, "GUNY1")<<1;
279   bbuster_ram[0xa696/2] = input_port_read(machine, "GUNX2")<<1;
280   bbuster_ram[0xa698/2] = input_port_read(machine, "GUNY2")<<1;
281   bbuster_ram[0xa69a/2] = input_port_read(machine, "GUNX3")<<1;
282   bbuster_ram[0xa69c/2] = input_port_read(machine, "GUNY3")<<1;
282283   return 0;
283284}
284285
285286static WRITE16_HANDLER( sound_cpu_w )
286287{
287   soundlatch_w(machine,0,data&0xff);
288   cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
288   soundlatch_w(machine, 0, data&0xff);
289   cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
289290}
290291
291292static READ16_HANDLER( mechatt_gun_r )
292293{
293   int baseport=0,x,y;
294   static const char *port[] = { "IN2", "IN3", "IN4", "IN5" };
294   int x, y;
295295
296   if (offset) baseport=2; /* Player 2 */
296   x = input_port_read(machine, offset ? "GUNX2" : "GUNX1");
297   y = input_port_read(machine, offset ? "GUNY2" : "GUNY1");
297298
298   x=input_port_read(machine, port[baseport]);
299   y=input_port_read(machine, port[baseport+1]);
300
301299   /* Todo - does the hardware really clamp like this? */
302   x+=0x18;
303   if (x>0xff) x=0xff;
304   if (y>0xef) y=0xef;
300   x += 0x18;
301   if (x > 0xff) x = 0xff;
302   if (y > 0xef) y = 0xef;
305303
306   return x|(y<<8);
304   return x | (y<<8);
307305}
308306
309307/*******************************************************************************/
r2956r2957
317315   AM_RANGE(0x0b0000, 0x0b1fff) AM_READ(SMH_RAM)
318316   AM_RANGE(0x0b2000, 0x0b3fff) AM_READ(SMH_RAM)
319317   AM_RANGE(0x0d0000, 0x0d0fff) AM_READ(SMH_RAM)
320   AM_RANGE(0x0e0000, 0x0e0001) AM_READ(input_port_2_word_r) /* Coins */
321   AM_RANGE(0x0e0002, 0x0e0003) AM_READ(input_port_0_word_r) /* Player 1 & 2 */
322   AM_RANGE(0x0e0004, 0x0e0005) AM_READ(input_port_1_word_r) /* Player 3 */
323   AM_RANGE(0x0e0008, 0x0e0009) AM_READ(input_port_3_word_r) /* Dip 1 */
324   AM_RANGE(0x0e000a, 0x0e000b) AM_READ(input_port_4_word_r) /* Dip 2 */
318   AM_RANGE(0x0e0000, 0x0e0001) AM_READ_PORT("COINS")   /* Coins */
319   AM_RANGE(0x0e0002, 0x0e0003) AM_READ_PORT("IN0")   /* Player 1 & 2 */
320   AM_RANGE(0x0e0004, 0x0e0005) AM_READ_PORT("IN1")   /* Player 3 */
321   AM_RANGE(0x0e0008, 0x0e0009) AM_READ_PORT("DSW1")   /* Dip 1 */
322   AM_RANGE(0x0e000a, 0x0e000b) AM_READ_PORT("DSW2")   /* Dip 2 */
325323   AM_RANGE(0x0e0018, 0x0e0019) AM_READ(sound_cpu_r)
326324   AM_RANGE(0x0e8000, 0x0e8001) AM_READ(kludge_r)
327325   AM_RANGE(0x0e8002, 0x0e8003) AM_READ(control_3_r)
r2956r2957
355353   AM_RANGE(0x0b0000, 0x0b3fff) AM_READ(SMH_RAM)
356354   AM_RANGE(0x0c0000, 0x0c3fff) AM_READ(SMH_RAM)
357355   AM_RANGE(0x0d0000, 0x0d07ff) AM_READ(SMH_RAM)
358   AM_RANGE(0x0e0000, 0x0e0001) AM_READ(input_port_0_word_r)
359   AM_RANGE(0x0e0002, 0x0e0003) AM_READ(input_port_1_word_r)
356   AM_RANGE(0x0e0000, 0x0e0001) AM_READ_PORT("IN0")
357   AM_RANGE(0x0e0002, 0x0e0003) AM_READ_PORT("DSW1")
360358   AM_RANGE(0x0e0004, 0x0e0007) AM_READ(mechatt_gun_r)
361359   AM_RANGE(0x0e8000, 0x0e8001) AM_READ(sound_cpu_r)
362360ADDRESS_MAP_END
r2956r2957
442440   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
443441   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
444442
445   PORT_START_TAG("IN2")
443   PORT_START_TAG("COINS")
446444   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
447445   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
448446   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
r2956r2957
504502   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW2:7" )         /* Listed as "Unused" */
505503   PORT_SERVICE_DIPLOC(0x80, IP_ACTIVE_LOW, "SW2:8" )
506504
507   PORT_START_TAG("IN5")
505   PORT_START_TAG("GUNX1")
508506   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1)
509   PORT_START_TAG("IN6")
507   PORT_START_TAG("GUNY1")
510508   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1)
511509
512   PORT_START_TAG("IN7")
510   PORT_START_TAG("GUNX2")
513511   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(2)
514   PORT_START_TAG("IN8")
512   PORT_START_TAG("GUNY2")
515513   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(2)
516514
517   PORT_START_TAG("IN9")
515   PORT_START_TAG("GUNX3")
518516   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(3)
519   PORT_START_TAG("IN10")
517   PORT_START_TAG("GUNY3")
520518   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(3)
521519
522520#if BBUSTERS_HACK
r2956r2957
585583   PORT_DIPUNUSED_DIPLOC(0x4000, 0x4000, "SW2:7" )         /* Listed as "Unused" */
586584   PORT_SERVICE_DIPLOC(  0x8000, IP_ACTIVE_LOW, "SW2:8" )
587585
588   PORT_START_TAG("IN2")
586   PORT_START_TAG("GUNX1")
589587   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1)
590   PORT_START_TAG("IN3")
588   PORT_START_TAG("GUNY1")
591589   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1)
592590
593   PORT_START_TAG("IN4")
591   PORT_START_TAG("GUNX2")
594592   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(2)
595   PORT_START_TAG("IN5")
593   PORT_START_TAG("GUNY2")
596594   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(2)
597595
598596#if MECHATT_HACK
src/mame/drivers/snk.c
r2956r2957
31793179   PORT_DIPNAME( 0x40 ,0x00, DEF_STR( Allow_Continue ) )
31803180   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
31813181   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
3182   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
3183   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
3184   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
3182   PORT_DIPNAME( 0x80, 0x80, "Credits Buy Lives During Play" )
3183   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
3184   PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
31853185INPUT_PORTS_END
31863186
31873187
src/mame/drivers/fcrash.c
r2956r2957
1/* Final Crash */
1/* Final Crash & other CPS1 bootlegs */
22
33/*
44
r2956r2957
123123static void fcrash_render_sprites(running_machine *machine, bitmap_t *bitmap,const rectangle *cliprect)
124124{
125125   int pos;
126   int base=0x50c8/2; // and 10c8/2 for the buffer?
126   int base=0x50c8/2;
127127
128   // sprite base registers need hooking up properly.. on fcrash it is NOT cps1_cps_a_regs[0]
129   //  on kodb, it might still be, unless that's just a leftover and it writes somewhere else too
130//  if (cps1_cps_a_regs[0] & 0x00ff) base=0x10c8/2;
131//  printf("cps1_cps_a_regs %04x\n", cps1_cps_a_regs[0]);
132
128133   for (pos=0x1ffc;pos>=0x0000;pos-=4)
129134   {
130135      int tileno;
r2956r2957
269274   return 0;
270275}
271276
277// doesn't have the scroll offsets like fcrash
278static VIDEO_UPDATE( kodb )
279{
280   int layercontrol,l0,l1,l2,l3;
281   int videocontrol=cps1_cps_a_regs[0x22/2];
272282
273283
284   flip_screen_set(videocontrol & 0x8000);
285
286    layercontrol = cps1_cps_b_regs[0x20/2];
287
288   /* Get video memory base registers */
289   cps1_get_video_base();
290
291   /* Build palette */
292   fcrash_build_palette(screen->machine);
293
294   fcrash_update_transmasks();
295
296   tilemap_set_scrollx(cps1_bg_tilemap[0],0,cps1_scroll1x);
297   tilemap_set_scrolly(cps1_bg_tilemap[0],0,cps1_scroll1y);
298   if (videocontrol & 0x01)   /* linescroll enable */
299   {
300      int scrly=-cps1_scroll2y;
301      int i;
302      int otheroffs;
303
304      tilemap_set_scroll_rows(cps1_bg_tilemap[1],1024);
305
306      otheroffs = cps1_cps_a_regs[CPS1_ROWSCROLL_OFFS];
307
308      for (i = 0;i < 256;i++)
309         tilemap_set_scrollx(cps1_bg_tilemap[1],(i - scrly) & 0x3ff,cps1_scroll2x + cps1_other[(i + otheroffs) & 0x3ff]);
310   }
311   else
312   {
313      tilemap_set_scroll_rows(cps1_bg_tilemap[1],1);
314      tilemap_set_scrollx(cps1_bg_tilemap[1],0,cps1_scroll2x);
315   }
316   tilemap_set_scrolly(cps1_bg_tilemap[1],0,cps1_scroll2y);
317   tilemap_set_scrollx(cps1_bg_tilemap[2],0,cps1_scroll3x);
318   tilemap_set_scrolly(cps1_bg_tilemap[2],0,cps1_scroll3y);
319
320
321   /* turn all tilemaps on regardless of settings in get_video_base() */
322   /* write a custom get_video_base for this bootleg hardware? */
323   tilemap_set_enable(cps1_bg_tilemap[0],1);
324   tilemap_set_enable(cps1_bg_tilemap[1],1);
325   tilemap_set_enable(cps1_bg_tilemap[2],1);
326
327   /* Blank screen */
328   fillbitmap(bitmap,0xbff,cliprect);
329
330   fillbitmap(priority_bitmap,0,cliprect);
331   l0 = (layercontrol >> 0x06) & 03;
332   l1 = (layercontrol >> 0x08) & 03;
333   l2 = (layercontrol >> 0x0a) & 03;
334   l3 = (layercontrol >> 0x0c) & 03;
335
336   fcrash_render_layer(screen->machine,bitmap,cliprect,l0,0);
337   if (l1 == 0) fcrash_render_high_layer(bitmap,cliprect,l0);
338   fcrash_render_layer(screen->machine,bitmap,cliprect,l1,0);
339   if (l2 == 0) fcrash_render_high_layer(bitmap,cliprect,l1);
340   fcrash_render_layer(screen->machine,bitmap,cliprect,l2,0);
341   if (l3 == 0) fcrash_render_high_layer(bitmap,cliprect,l2);
342   fcrash_render_layer(screen->machine,bitmap,cliprect,l3,0);
343
344
345   return 0;
346}
347
348
274349static ADDRESS_MAP_START( fcrash_map, ADDRESS_SPACE_PROGRAM, 16 )
275350   AM_RANGE(0x000000, 0x1fffff) AM_ROM
276351   AM_RANGE(0x800030, 0x800031) AM_WRITE(cps1_coinctrl_w)
r2956r2957
299374ADDRESS_MAP_END
300375
301376
377static ADDRESS_MAP_START( kodb_map, ADDRESS_SPACE_PROGRAM, 16 )
378   AM_RANGE(0x000000, 0x3fffff) AM_ROM
379   AM_RANGE(0x800000, 0x800007) AM_READ(cps1_in1_r)            /* Player input ports */
380   /* forgottn, willow, cawing, nemo, varth read from 800010. Probably debug input leftover from development */
381   AM_RANGE(0x800018, 0x80001f) AM_READ(cps1_dsw_r)            /* System input ports / Dip Switches */
382   AM_RANGE(0x800020, 0x800021) AM_READNOP                     /* ? Used by Rockman ? not mapped according to PAL */
383   AM_RANGE(0x800030, 0x800037) AM_WRITE(cps1_coinctrl_w)
384   /* Forgotten Worlds has dial controls on B-board mapped at 800040-80005f. See DRIVER_INIT */
385   AM_RANGE(0x800100, 0x80013f) AM_WRITE(cps1_cps_a_w) AM_BASE(&cps1_cps_a_regs)   /* CPS-A custom */
386   AM_RANGE(0x800140, 0x80017f) AM_READWRITE(cps1_cps_b_r, cps1_cps_b_w) AM_BASE(&cps1_cps_b_regs)   /* CPS-B custom */
387//  AM_RANGE(0x800180, 0x800187) AM_WRITE(cps1_soundlatch_w)    /* Sound command */
388//  AM_RANGE(0x800188, 0x80018f) AM_WRITE(cps1_soundlatch2_w)   /* Sound timer fade */
389   AM_RANGE(0x8001c0, 0x8001ff) AM_READWRITE(cps1_cps_b_r, cps1_cps_b_w)   /* mirror (SF2 revision "E" US 910228) */
390   AM_RANGE(0x900000, 0x92ffff) AM_RAM_WRITE(cps1_gfxram_w) AM_BASE(&cps1_gfxram) AM_SIZE(&cps1_gfxram_size)   /* SF2CE executes code from here */
391   AM_RANGE(0xff0000, 0xffffff) AM_RAM
392ADDRESS_MAP_END
393
394
302395#define CPS1_COINAGE_1 \
303396   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) \
304397   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
r2956r2957
319412   PORT_DIPSETTING(    0x20, DEF_STR( 1C_4C ) ) \
320413   PORT_DIPSETTING(    0x18, DEF_STR( 1C_6C ) )
321414
415
416#define CPS1_COINAGE_2(diploc) \
417   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) PORT_DIPLOCATION(diploc ":1,2,3") \
418   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
419   PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) ) \
420   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) ) \
421   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) ) \
422   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) ) \
423   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) ) \
424   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) ) \
425   PORT_DIPSETTING(    0x03, DEF_STR( 1C_6C ) )
426
427#define CPS1_COINAGE_3(diploc) \
428   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION(diploc ":1,2,3") \
429   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) ) \
430   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) ) \
431   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) ) \
432   PORT_DIPSETTING(    0x00, "2 Coins/1 Credit (1 to continue)" ) \
433   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) ) \
434   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) ) \
435   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) ) \
436   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) ) \
437   PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_DIPLOCATION(diploc ":4,5,6") \
438   PORT_DIPSETTING(    0x08, DEF_STR( 4C_1C ) ) \
439   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) \
440   PORT_DIPSETTING(    0x18, DEF_STR( 2C_1C ) ) \
441   PORT_DIPSETTING(    0x00, "2 Coins/1 Credit (1 to continue)" ) \
442   PORT_DIPSETTING(    0x38, DEF_STR( 1C_1C ) ) \
443   PORT_DIPSETTING(    0x30, DEF_STR( 1C_2C ) ) \
444   PORT_DIPSETTING(    0x28, DEF_STR( 1C_3C ) ) \
445   PORT_DIPSETTING(    0x20, DEF_STR( 1C_4C ) )
446
447#define CPS1_DIFFICULTY_1(diploc) \
448   PORT_DIPNAME( 0x07, 0x04, DEF_STR( Difficulty ) ) PORT_DIPLOCATION(diploc ":1,2,3") \
449   PORT_DIPSETTING(    0x07, "1 (Easiest)" ) \
450   PORT_DIPSETTING(    0x06, "2" ) \
451   PORT_DIPSETTING(    0x05, "3" ) \
452   PORT_DIPSETTING(    0x04, "4 (Normal)" ) \
453   PORT_DIPSETTING(    0x03, "5" ) \
454   PORT_DIPSETTING(    0x02, "6" ) \
455   PORT_DIPSETTING(    0x01, "7" ) \
456   PORT_DIPSETTING(    0x00, "8 (Hardest)" )
457
458#define CPS1_DIFFICULTY_2(diploc) \
459   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) ) PORT_DIPLOCATION(diploc ":1,2,3") \
460   PORT_DIPSETTING(    0x04, "1 (Easiest)" ) \
461   PORT_DIPSETTING(    0x05, "2" ) \
462   PORT_DIPSETTING(    0x06, "3" ) \
463   PORT_DIPSETTING(    0x07, "4 (Normal)" ) \
464   PORT_DIPSETTING(    0x03, "5" ) \
465   PORT_DIPSETTING(    0x02, "6" ) \
466   PORT_DIPSETTING(    0x01, "7" ) \
467   PORT_DIPSETTING(    0x00, "8 (Hardest)" )
468
469
322470static INPUT_PORTS_START( fcrash )
323471   PORT_START_TAG("IN0")
324472   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
r2956r2957
404552INPUT_PORTS_END
405553
406554
555static INPUT_PORTS_START( kodb )
556   PORT_START_TAG("IN0")
557   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
558   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
559   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
560   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
561   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
562   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
563   PORT_SERVICE_NO_TOGGLE( 0x40, IP_ACTIVE_LOW )
564   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
407565
566   PORT_START_TAG("DSWA")
567   CPS1_COINAGE_2( "SW(A)" )
568   PORT_DIPNAME( 0x08, 0x08, "Coin Slots" )                  PORT_DIPLOCATION("SW(A):4")
569   PORT_DIPSETTING(    0x00, "1" )
570   PORT_DIPSETTING(    0x08, "3" )
571   PORT_DIPNAME( 0x10, 0x10, "Play Mode" )                     PORT_DIPLOCATION("SW(A):5")
572   PORT_DIPSETTING(    0x00, "2 Players" )
573   PORT_DIPSETTING(    0x10, "3 Players" )
574   PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW(A):6" )
575   PORT_DIPNAME( 0x40, 0x40, "2 Coins to Start, 1 to Continue" )   PORT_DIPLOCATION("SW(A):7")
576   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
577   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
578   PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW(A):8" )
579
580   PORT_START_TAG("DSWB")
581   CPS1_DIFFICULTY_1( "SW(B)" )
582   PORT_DIPNAME( 0x38, 0x38, DEF_STR( Lives ) )               PORT_DIPLOCATION("SW(B):4,5,6")
583   PORT_DIPSETTING(    0x30, "1" )
584   PORT_DIPSETTING(    0x38, "2" )
585   PORT_DIPSETTING(    0x28, "3" )
586   PORT_DIPSETTING(    0x20, "4" )
587   PORT_DIPSETTING(    0x18, "5" )
588   PORT_DIPSETTING(    0x10, "6" )
589   PORT_DIPSETTING(    0x08, "7" )
590   PORT_DIPSETTING(    0x00, "8" )
591   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Bonus_Life ) )            PORT_DIPLOCATION("SW(B):7,8")
592   PORT_DIPSETTING(    0x80, "80k and every 400k" )
593   PORT_DIPSETTING(    0xc0, "100k and every 450k" )
594   PORT_DIPSETTING(    0x40, "160k and every 450k" )
595   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
596
597   PORT_START_TAG("DSWC")
598   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW(C):1" )
599   PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW(C):2" )
600   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Free_Play ) )            PORT_DIPLOCATION("SW(C):3")
601   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
602   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
603   PORT_DIPNAME( 0x08, 0x08, "Freeze" )                     PORT_DIPLOCATION("SW(C):4")
604   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
605   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
606   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Flip_Screen ) )            PORT_DIPLOCATION("SW(C):5")
607   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
608   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
609   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) )            PORT_DIPLOCATION("SW(C):6")
610   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
611   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
612   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) )         PORT_DIPLOCATION("SW(C):7")
613   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
614   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
615   PORT_DIPNAME( 0x80, 0x80, "Game Mode")                     PORT_DIPLOCATION("SW(C):8")
616   PORT_DIPSETTING(    0x80, "Game" )
617   PORT_DIPSETTING(    0x00, DEF_STR( Test ) )
618
619   PORT_START_TAG("IN1")
620   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
621   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
622   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
623   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
624   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
625   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
626   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
627   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
628   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
629   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
630   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
631   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
632   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
633   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
634   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
635   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
636
637   PORT_START_TAG("IN2")      /* Player 3 */
638   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
639   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
640   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
641   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
642   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
643   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
644   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 )
645   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 )
646INPUT_PORTS_END
647
648
408649static const struct MSM5205interface msm5205_interface1 =
409650{
410651   m5205_int1,   /* interrupt function */
r2956r2957
467708   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
468709MACHINE_DRIVER_END
469710
711static MACHINE_DRIVER_START( kodb )
470712
713   /* basic machine hardware */
714   MDRV_CPU_ADD_TAG("main", M68000, 10000000)
715   MDRV_CPU_PROGRAM_MAP(kodb_map,0)
716   MDRV_CPU_VBLANK_INT("main", cps1_interrupt)
717
718//  MDRV_CPU_ADD_TAG("sound", Z80, 3579545)
719   /* audio CPU */
720//  MDRV_CPU_PROGRAM_MAP(sub_map,0)
721
722   /* video hardware */
723   MDRV_SCREEN_ADD("main", RASTER)
724   MDRV_SCREEN_REFRESH_RATE(60)
725   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
726   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
727   MDRV_SCREEN_SIZE(64*8, 32*8)
728   MDRV_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 2*8, 30*8-1 )
729
730   MDRV_GFXDECODE(cps1)
731   MDRV_PALETTE_LENGTH(0xc00)
732
733   MDRV_VIDEO_START(cps1)
734   MDRV_VIDEO_EOF(cps1)
735   MDRV_VIDEO_UPDATE(kodb)
736
737   /* sound hardware */
738//  MDRV_SPEAKER_STANDARD_MONO("mono")
739
740//  MDRV_SOUND_ADD_TAG("2151", YM2151, 3579545)
741//  MDRV_SOUND_CONFIG(ym2151_interface)
742//  MDRV_SOUND_ROUTE(0, "mono", 0.35)
743//  MDRV_SOUND_ROUTE(1, "mono", 0.35)
744
745//  MDRV_SOUND_ADD_TAG("okim", OKIM6295, 1000000)
746//  MDRV_SOUND_CONFIG(okim6295_interface_region_1_pin7high) // pin 7 can be changed by the game code, see f006 on z80
747//  MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
748MACHINE_DRIVER_END
749
750
751
471752ROM_START( fcrash )
472753   ROM_REGION( 0x200000, REGION_CPU1, 0 )      /* 68000 code */
473754   ROM_LOAD16_BYTE( "9.bin",  0x00000, 0x20000, CRC(c6854c91) SHA1(29f01cc65be5eaa3f86e99eebdd284104623abb0) )
r2956r2957
505786   ROM_RELOAD(          0x10000, 0x20000 )
506787ROM_END
507788
508GAME( 1990, fcrash,   ffight,  fcrash,     fcrash,   cps1,     ROT0,   "Playmark, bootleg [Capcom]", "Final Crash (World, bootleg)", 0 )
789/*
790CPU
791
7921x TS68000CP12 (main)
7931x TPC1020AFN-084C
7941x Z8400BB1-Z80CPU (sound)
7951x YM2151 (sound)
7961x YM3012A (sound)
7971x OKI-M6295 (sound)
7982x LM324N (sound)
7991x TDA2003 (sound)
8001x oscillator 10.0 MHz
8011x oscillator 22.1184 MHz
802
803ROMs
804
8051x AM27C512 (1)(sound)
8061x AM27C020 (2)(sound)
8072x AM27C040 (3,4)(main)
8081x Am27C040 (bp)(gfx)
8097x maskrom (ai,bi,ci,di,ap,cp,dp)(gfx)
8101x GAL20V8A (not dumped)
8113x GAL16V8A (not dumped)
8121x PALCE20V8H (not dumped)
8131x GAL20V8S (not dumped)
814
815Note
816
8171x JAMMA edge connector
8181x trimmer (volume)
8193x 8 switches dip
820
821*/
822
823ROM_START( kodb )
824   ROM_REGION( 0x400000, REGION_CPU1, 0 )      /* 68000 code */
825   ROM_LOAD16_BYTE( "3.ic172",    0x00000, 0x080000, CRC(036dd74c) SHA1(489344e56863429e86b4c362b82d89819c1d6afb) )
826   ROM_LOAD16_BYTE( "4.ic171",    0x00001, 0x080000, CRC(3e4b7295) SHA1(3245640bae7d141238051dfe5c7683d05c6d3848) )
827
828   ROM_REGION( 0x400000, REGION_GFX1, 0 )
829   ROMX_LOAD( "cp.ic90",   0x000000, 0x80000, CRC(e3b8589e) SHA1(775f97e43cb995b93da40063a1f1e4d73b34437c), ROM_SKIP(7) )
830   ROMX_LOAD( "dp.ic89",   0x000001, 0x80000, CRC(3eec9580) SHA1(3d8d0cfbeae077544e514a5eb96cc83f716e494f), ROM_SKIP(7) )
831   ROMX_LOAD( "ap.ic88",   0x000002, 0x80000, CRC(fdf5f163) SHA1(271ee96886c958accaca9a82484ab80fe32bd38e), ROM_SKIP(7) )
832   ROMX_LOAD( "bp.ic87",   0x000003, 0x80000, CRC(4e1c52b7) SHA1(74570e7d577c999c62203c97b3d449e3b61a678a), ROM_SKIP(7) )
833   ROMX_LOAD( "ci.ic91",   0x000004, 0x80000, CRC(22228bc5) SHA1(d48a09ee284d9e4b986f5c3c1c865930f76986e2), ROM_SKIP(7) )
834   ROMX_LOAD( "di.ic92",   0x000005, 0x80000, CRC(ab031763) SHA1(5bcd89b1debf029b779aa1bb73b3a572d27154ec), ROM_SKIP(7) )
835   ROMX_LOAD( "ai.ic93",   0x000006, 0x80000, CRC(cffbf4be) SHA1(f805bafc855d4a656c055a76eaeb26e36835541e), ROM_SKIP(7) )
836   ROMX_LOAD( "bi.ic94",   0x000007, 0x80000, CRC(4a1b43fe) SHA1(7957f45b2862825c9509043c63c7da7108bd251b), ROM_SKIP(7) )
837
838   ROM_REGION( 0x8000, REGION_GFX2, 0 )
839   ROM_COPY( REGION_GFX1, 0x000000, 0x000000, 0x8000 )   /* stars */
840
841   ROM_REGION( 0x18000, REGION_CPU2, 0 ) /* 64k for the audio CPU (+banks) */
842   ROM_LOAD( "1.ic28",        0x00000, 0x08000, CRC(01cae60c) SHA1(b2cdd883fd859f0b701230831aca1f1a74ad6087) )
843   ROM_CONTINUE(              0x10000, 0x08000 )
844
845   ROM_REGION( 0x40000, REGION_SOUND1, 0 )   /* Samples */
846   ROM_LOAD( "2.ic19",      0x00000, 0x40000, CRC(a2db1575) SHA1(1a4a29e4b045af50700adf1665697feab12cc234) )
847ROM_END
848
849GAME( 1990, fcrash,   ffight,  fcrash,     fcrash,   cps1,     ROT0,   "[Capcom] (Playmark bootleg)", "Final Crash (bootleg of Final Fight)", 0 )
850GAME( 1991, kodb,     kod,     kodb,       kodb,     cps1,     ROT0,   "[Capcom] (Playmark bootleg)", "The King of Dragons (bootleg)", GAME_NOT_WORKING | GAME_NO_SOUND )   // 910731  "ETC"
src/mame/drivers/model2.c
r2956r2957
21542154   ROM_REGION( 0x800000, REGION_SOUND1, 0 ) // Samples
21552155   ROM_LOAD( "mpr-17573.31", 0x000000, 0x200000, CRC(e43557fe) SHA1(4c61a135819862df02347c118dc4d88a0adac273) )
21562156   ROM_LOAD( "mpr-17572.32", 0x200000, 0x200000, CRC(4febecc8) SHA1(9683ea9bedfc5cd7b4a28e9a68792c0dc549d911) )
2157   ROM_LOAD( "mpr-17571.36", 0x400000, 0x200000, CRC(d22dc8ca) SHA1(3bba7780fa4ec23e40127a5b0104fba7d5e30b5f) )
2157   ROM_LOAD( "mpr-17571.36", 0x400000, 0x200000, CRC(51caa584) SHA1(cbbde1c55eddbeeefd283bb5afd79a670a282e3a) )
21582158   ROM_LOAD( "mpr-17570.37", 0x600000, 0x200000, CRC(bccd324b) SHA1(4c7ebdea08b2dedf621f121785ed1c40ebae4236) )
21592159
21602160   MODEL2_CPU_BOARD
r2956r2957
22002200   ROM_REGION( 0x800000, REGION_SOUND1, 0 ) // Samples
22012201   ROM_LOAD( "mpr-17573.31", 0x000000, 0x200000, CRC(e43557fe) SHA1(4c61a135819862df02347c118dc4d88a0adac273) )
22022202   ROM_LOAD( "mpr-17572.32", 0x200000, 0x200000, CRC(4febecc8) SHA1(9683ea9bedfc5cd7b4a28e9a68792c0dc549d911) )
2203   ROM_LOAD( "mpr-17571.36", 0x400000, 0x200000, CRC(d22dc8ca) SHA1(3bba7780fa4ec23e40127a5b0104fba7d5e30b5f) )
2203   ROM_LOAD( "mpr-17571.36", 0x400000, 0x200000, CRC(51caa584) SHA1(cbbde1c55eddbeeefd283bb5afd79a670a282e3a) )
22042204   ROM_LOAD( "mpr-17570.37", 0x600000, 0x200000, CRC(bccd324b) SHA1(4c7ebdea08b2dedf621f121785ed1c40ebae4236) )
22052205
22062206   MODEL2_CPU_BOARD
22072207   MODEL2A_VID_BOARD
22082208ROM_END
22092209
2210ROM_START( vf2a )
2211   ROM_REGION( 0x200000, REGION_CPU1, 0 ) // i960 program
2212   ROM_LOAD32_WORD( "epr-17568a.12", 0x000000, 0x020000, CRC(5b10f232) SHA1(04df1eb9cf094d8dc5118b95028b544b47d5d328) )
2213   ROM_LOAD32_WORD( "epr-17569a.13", 0x000002, 0x020000, CRC(17c208e0) SHA1(260c762d7853fb1d6f894d4dd954d82dfbc92d2d) )
2214   ROM_LOAD32_WORD( "epr-17562a.14", 0x040000, 0x020000, CRC(db68a01a) SHA1(1e9d3f09821596d3560bf54f6323ba295ee430d8) )
2215   ROM_LOAD32_WORD( "epr-17563a.15", 0x040002, 0x020000, CRC(4696439d) SHA1(846fa1435a1a5c9f7f9690e1c810ca89008d1626) )
2216
2217   ROM_REGION32_LE( 0x2400000, REGION_USER1, 0 ) // Data
2218   ROM_LOAD32_WORD( "mpr-17560.10", 0x000000, 0x200000, CRC(d1389864) SHA1(88e9a8b6b0f58c96957015179e7ff10f837040e6) )
2219   ROM_LOAD32_WORD( "mpr-17561.11", 0x000002, 0x200000, CRC(b98d0101) SHA1(e154877380b9250d8119dd4c14ba306c7b337dcd) )
2220   ROM_LOAD32_WORD( "mpr-17558.8",  0x400000, 0x200000, CRC(4b15f5a6) SHA1(9a34724958fef9b49eae39c6ea136e0cf532154b) )
2221   ROM_LOAD32_WORD( "mpr-17559.9",  0x400002, 0x200000, CRC(d3264de6) SHA1(2f094ff0b95bf1cd5c283414634ea9597204d374) )
2222   ROM_LOAD32_WORD( "mpr-17566.6",  0x800000, 0x200000, CRC(fb41ef98) SHA1(ad4d1ba5e5b39b2d87105ae80750284867aa4ed3) )
2223   ROM_LOAD32_WORD( "mpr-17567.7",  0x800002, 0x200000, CRC(c3396922) SHA1(7e0700ded530e4eb58e9a68cdb92791284c91431) )
2224   ROM_LOAD32_WORD( "mpr-17564.4",  0xc00000, 0x200000, CRC(d8062489) SHA1(57666b6937f79bb65c43ed02b04a454882d01e61) )
2225   ROM_LOAD32_WORD( "mpr-17565.5",  0xc00002, 0x200000, CRC(0517c6e9) SHA1(d9ba93998286713758385033119416714674c8d8) )
2226
2227   ROM_REGION( 0x800000, REGION_CPU3, ROMREGION_ERASE00 ) // TGP data (COPRO sockets)
2228
2229   ROM_REGION( 0x2000000, REGION_USER2, 0 ) // Models
2230   ROM_LOAD32_WORD( "mpr-17554.16", 0x000000, 0x200000, CRC(27896d82) SHA1(c0624e58de2e427465daaa10dbb02ea2a1fd0f1b) )
2231   ROM_LOAD32_WORD( "mpr-17548.20", 0x000002, 0x200000, CRC(c95facc2) SHA1(09d19abe5d75a335df7510df8abb2d4425159cdf) )
2232   ROM_LOAD32_WORD( "mpr-17555.17", 0x400000, 0x200000, CRC(4df2810b) SHA1(720c4628d7783f0323b5723b441e13741556241e) )
2233   ROM_LOAD32_WORD( "mpr-17549.21", 0x400002, 0x200000, CRC(e0bce0e6) SHA1(0570604dc2007288795a3125ffd480bc4b3b0802) )
2234   ROM_LOAD32_WORD( "mpr-17556.18", 0x800000, 0x200000, CRC(41a47616) SHA1(55b909d2bc2079d0dfed5036c78c9e09bce09843) )
2235   ROM_LOAD32_WORD( "mpr-17550.22", 0x800002, 0x200000, CRC(c36ff3f5) SHA1(f14fdf275905a90a0d4cc534d90b0302f26676d8) )
2236
2237   ROM_REGION( 0x1000000, REGION_USER3, 0 ) // Textures
2238   ROM_LOAD32_WORD( "mpr-17553.25", 0x000000, 0x200000, CRC(5da1c5d3) SHA1(c627b25a1f61a9fe9182e2199f70f6e485503c7b) )
2239   ROM_LOAD32_WORD( "mpr-17552.24", 0x000002, 0x200000, CRC(e91e7427) SHA1(0ac1111f2ecb4f924b5119eaaac8fa7bc87ab9d1) )
2240   ROM_LOAD32_WORD( "mpr-17547.27", 0x400000, 0x200000, CRC(be940431) SHA1(5c1196a6454a4fead79a930979f2e69639ec2bb9) )
2241   ROM_LOAD32_WORD( "mpr-17546.26", 0x400002, 0x200000, CRC(042a194b) SHA1(c6d8524dc0a879394f1234b7bb04836081bb3830) )
2242
2243   ROM_REGION( 0x100000, REGION_CPU2, 0 ) // Sound program
2244   ROM_LOAD16_WORD_SWAP( "epr-17574.30", 0x080000, 0x080000, CRC(4d4c3a55) SHA1(b6c0c3f0473bd7fc3ef4f5146110dfcc899a5af9) )
2245
2246   ROM_REGION( 0x800000, REGION_SOUND1, 0 ) // Samples
2247   ROM_LOAD( "mpr-17573.31", 0x000000, 0x200000, CRC(e43557fe) SHA1(4c61a135819862df02347c118dc4d88a0adac273) )
2248   ROM_LOAD( "mpr-17572.32", 0x200000, 0x200000, CRC(4febecc8) SHA1(9683ea9bedfc5cd7b4a28e9a68792c0dc549d911) )
2249   ROM_LOAD( "mpr-17571.36", 0x400000, 0x200000, CRC(51caa584) SHA1(cbbde1c55eddbeeefd283bb5afd79a670a282e3a) )
2250   ROM_LOAD( "mpr-17570.37", 0x600000, 0x200000, CRC(bccd324b) SHA1(4c7ebdea08b2dedf621f121785ed1c40ebae4236) )
2251
2252   MODEL2_CPU_BOARD
2253   MODEL2A_VID_BOARD
2254ROM_END
2255
22102256ROM_START( vf2o )
22112257   ROM_REGION( 0x200000, REGION_CPU1, 0 ) // i960 program
22122258   ROM_LOAD32_WORD( "epr-17568.12", 0x000000, 0x020000, CRC(cf5d53d1) SHA1(4ed907bbfc1a47e51c9cc11f55645752574adaef) )
r2956r2957
22462292   ROM_REGION( 0x800000, REGION_SOUND1, 0 ) // Samples
22472293   ROM_LOAD( "mpr-17573.31", 0x000000, 0x200000, CRC(e43557fe) SHA1(4c61a135819862df02347c118dc4d88a0adac273) )
22482294   ROM_LOAD( "mpr-17572.32", 0x200000, 0x200000, CRC(4febecc8) SHA1(9683ea9bedfc5cd7b4a28e9a68792c0dc549d911) )
2249   ROM_LOAD( "mpr-17571.36", 0x400000, 0x200000, CRC(d22dc8ca) SHA1(3bba7780fa4ec23e40127a5b0104fba7d5e30b5f) )
2295   ROM_LOAD( "mpr-17571.36", 0x400000, 0x200000, CRC(51caa584) SHA1(cbbde1c55eddbeeefd283bb5afd79a670a282e3a) )
22502296   ROM_LOAD( "mpr-17570.37", 0x600000, 0x200000, CRC(bccd324b) SHA1(4c7ebdea08b2dedf621f121785ed1c40ebae4236) )
22512297
22522298   MODEL2_CPU_BOARD
r2956r2957
37653811
37663812ROM_START( daytona )
37673813   ROM_REGION( 0x200000, REGION_CPU1, 0 ) // i960 program
3768   ROM_LOAD32_WORD("epr16722a.12", 0x000000, 0x020000, CRC(48b94318) SHA1(a476a9a3531beef760c88c9634ed4a7d270e8ee7) )
3769   ROM_LOAD32_WORD("epr16723a.13", 0x000002, 0x020000, CRC(8af8b32d) SHA1(2039ec1f8da524176fcf85473c10a8b6e49e139a) )
3814   ROM_LOAD32_WORD("epr-16722a.12", 0x000000, 0x020000, CRC(48b94318) SHA1(a476a9a3531beef760c88c9634ed4a7d270e8ee7) )
3815   ROM_LOAD32_WORD("epr-16723a.13", 0x000002, 0x020000, CRC(8af8b32d) SHA1(2039ec1f8da524176fcf85473c10a8b6e49e139a) )
37703816
37713817   ROM_REGION32_LE( 0x2000000, REGION_USER1, 0 ) // Data
37723818   ROM_LOAD32_WORD("mpr-16528.10",   0x000000, 0x200000, CRC(9ce591f6) SHA1(e22fc8a70b533f7a6191f5952c581fb8f9627906) )
r2956r2957
38213867   MODEL2_CPU_BOARD /* Model 2 CPU board extra roms */
38223868
38233869   ROM_REGION( 0x10000, REGION_USER7, 0 ) // Unknown ROM
3824   ROM_LOAD("14869c.25", 0x000000, 0x010000, CRC(24b68e64) SHA1(c19d044d4c2fe551474492aa51922587394dd371) )
3870   ROM_LOAD("epr-14869c.25", 0x000000, 0x010000, CRC(24b68e64) SHA1(c19d044d4c2fe551474492aa51922587394dd371) )
38253871ROM_END
38263872
3873/* Deluxe '93 version (There is said to be a Deluxe '94 edition) */
3874
3875ROM_START( dayton93 )
3876   ROM_REGION( 0x200000, REGION_CPU1, 0 ) // i960 program
3877   ROM_LOAD32_WORD("epr-16530a.12", 0x000000, 0x020000, CRC(39e962b5) SHA1(b98a1faabb4f1eff707a94c32224c7820f259874) )
3878   ROM_LOAD32_WORD("epr-16531a.13", 0x000002, 0x020000, CRC(693126eb) SHA1(779734ba536db67e14760d52e8d8d7db07816481) )
3879
3880   ROM_REGION32_LE( 0x2000000, REGION_USER1, 0 ) // Data
3881   ROM_LOAD32_WORD("mpr-16528.10",   0x000000, 0x200000, CRC(9ce591f6) SHA1(e22fc8a70b533f7a6191f5952c581fb8f9627906) )
3882   ROM_LOAD32_WORD("mpr-16529.11",   0x000002, 0x200000, CRC(f7095eaf) SHA1(da3c922f950dd730ea348eae12aa1cb69cee9a58) )
3883   ROM_LOAD32_WORD("mpr-16526.8",    0x400000, 0x200000, CRC(5273b8b5) SHA1(f505910394d41a9ffecfdea7b45ef25b21469b7a) )
3884   ROM_LOAD32_WORD("mpr-16527.9",    0x400002, 0x200000, CRC(fc4cb0ef) SHA1(1bf3aec88ef9fb40bde054f5f0b884bf715cbcc8) )
3885   ROM_LOAD32_WORD("epr-16534a.6",   0x800000, 0x100000, CRC(1bb0d72d) SHA1(814004e3426b5638e9c8b226594f4f2a9138ffed) )
3886   ROM_LOAD32_WORD("epr-16535a.7",   0x800002, 0x100000, CRC(459a8bfb) SHA1(607bc0f6c478c3d83ce81f34b7f69997361f906f) )
3887   ROM_COPY( REGION_USER1, 0x900000, 0xa00000, 0x100000 ) // rgn,srcoffset,offset,length.
3888   ROM_COPY( REGION_USER1, 0x900000, 0xb00000, 0x100000 )
3889   ROM_COPY( REGION_USER1, 0x900000, 0xc00000, 0x100000 )
3890   ROM_COPY( REGION_USER1, 0x900000, 0xd00000, 0x100000 )
3891   ROM_COPY( REGION_USER1, 0x900000, 0xe00000, 0x100000 )
3892   ROM_COPY( REGION_USER1, 0x900000, 0xf00000, 0x100000 )
3893
3894   ROM_REGION( 0x800000, REGION_CPU3, 0 ) // TGP program? (COPRO socket)
3895   ROM_LOAD32_WORD("mpr-16537.ic28", 0x000000, 0x200000, CRC(36b7c35a) SHA1(b32fd1d3fc8983fb5f2a7b236b665a8c9b52769f) )
3896   ROM_LOAD32_WORD("mpr-16536.ic29", 0x000002, 0x200000, CRC(6d6afed9) SHA1(2018468d7d849854b3d0cfbcd217317e2fc93555) )
3897
3898   ROM_REGION32_LE( 0x1000000, REGION_USER2, 0 ) // Models
3899   ROM_LOAD32_WORD("mpr-16523.ic16", 0x000000, 0x200000, CRC(2f484d42) SHA1(0b83a3fc92b7d913a14cfb01d688c63555c17c41) )
3900   ROM_LOAD32_WORD("mpr-16518.ic20", 0x000002, 0x200000, CRC(df683bf7) SHA1(16afe5029591f3536b5b75d9cf50a34d0ea72c3d) )
3901   ROM_LOAD32_WORD("mpr-16524.ic17", 0x400000, 0x200000, CRC(34658bd7) SHA1(71b47626ffe5b26d1140afe1b830a9a2be86c88f) )
3902   ROM_LOAD32_WORD("mpr-16519.ic21", 0x400002, 0x200000, CRC(facd1c81) SHA1(dac8c281a5e9a6c4b60197e6676f3727264ee420) )
3903   ROM_LOAD32_WORD("mpr-16525.ic18", 0x800000, 0x200000, CRC(fb517521) SHA1(33f5f37ea2e09fc73eed5388b46fdf1fa9e285e6) )
3904   ROM_LOAD32_WORD("mpr-16520.ic22", 0x800002, 0x200000, CRC(d66bd9bd) SHA1(660171674484375a27595630e5e2d2ad76a06d1a) )
3905   ROM_LOAD32_WORD("epr-16646.ic19", 0xc00000, 0x080000, CRC(7ba9fd6b) SHA1(6bcae009e8264bf038fe5d4bc436ec4fc1674831) )
3906   ROM_LOAD32_WORD("epr-16645.ic23", 0xc00002, 0x080000, CRC(78fe0b8a) SHA1(488fd6c0246752b7d9c25d7ba6cdc5b3911d1836) )
3907
3908   ROM_REGION16_LE( 0x1000000, REGION_USER3, 0 ) // Textures
3909   ROM_LOAD32_WORD("mpr-16522.25", 0x000000, 0x200000, CRC(55d39a57) SHA1(abf7b0fc0f111f90da42463d600db9fa32e95efe) )
3910   ROM_LOAD32_WORD("mpr-16521.24", 0x000002, 0x200000, CRC(af1934fb) SHA1(a6a21a23cd34d0de6d3e6a5c3c2687f905d0dc2a) )
3911   ROM_LOAD32_WORD("mpr-16517.27", 0x800000, 0x200000, CRC(4705d3dd) SHA1(99be9c5d9d99f7016199ffa8404fc471d09e360d) )
3912   ROM_LOAD32_WORD("mpr-16516.26", 0x800002, 0x200000, CRC(a260d45d) SHA1(a2ed7c586dfcb7980190b7057fa5366239035fe8) )
3913
3914   ROM_REGION( 0x20000, REGION_CPU4, 0) // Communication program
3915   ROM_LOAD( "epr-16726.bin", 0x000000, 0x020000, CRC(c179b8c7) SHA1(86d3e65c77fb53b1d380b629348f4ab5b3d39228) )
3916
3917   ROM_REGION( 0x80000, REGION_CPU2, 0 ) // Sound program
3918   ROM_LOAD16_WORD_SWAP("epr-16720.7", 0x000000, 0x020000, CRC(8e73cffd) SHA1(9933ccc0757e8c86e0adb938d1c89210b26841ea) )
3919   ROM_LOAD16_WORD_SWAP("epr-16721.8", 0x020000, 0x020000, CRC(1bb3b7b7) SHA1(ee2fd1480e535fc37e9932e6fe4e31344559fc87) )
3920
3921   ROM_REGION( 0x400000, REGION_SOUND1, 0 ) // Samples
3922   ROM_LOAD("mpr-16491.32", 0x000000, 0x200000, CRC(89920903) SHA1(06d1d55470ae99f8de0f8c88c694f34c4eb13668) )
3923   ROM_LOAD("mpr-16492.33", 0x200000, 0x200000, CRC(459e701b) SHA1(2054f69cecad677eb00c6a3051f5b5d90885e19b) )
3924
3925   ROM_REGION( 0x400000, REGION_SOUND2, 0 ) // Samples
3926   ROM_LOAD("mpr-16493.4", 0x000000, 0x200000, CRC(9990db15) SHA1(ea9a8b45a07dccaae62be7cf095532ce7596a70c) )
3927   ROM_LOAD("mpr-16494.5", 0x200000, 0x200000, CRC(600e1d6c) SHA1(d4e246fc57a16ff562bbcbccf6a739b706f58696) )
3928
3929   MODEL2_CPU_BOARD /* Model 2 CPU board extra roms */
3930
3931   ROM_REGION( 0x10000, REGION_USER7, 0 ) // Unknown ROM
3932   ROM_LOAD("epr-14869c.25", 0x000000, 0x010000, CRC(24b68e64) SHA1(c19d044d4c2fe551474492aa51922587394dd371) )
3933ROM_END
3934
38273935/* alt revision with Saturn Adverts */
38283936
38293937ROM_START( daytonas )
38303938   ROM_REGION( 0x200000, REGION_CPU1, 0 ) // i960 program
3831   ROM_LOAD32_WORD("epr17965.ic12", 0x000000, 0x020000, CRC(f022b3da) SHA1(3c337d12f4e12141b412a7289df46f44c66964b2) )
3832   ROM_LOAD32_WORD("epr17966.ic13", 0x000002, 0x020000, CRC(f9e4ece5) SHA1(2df03455a00ae7066c30bace5c2b81581529e6f4) )
3939   ROM_LOAD32_WORD("epr-17965.ic12", 0x000000, 0x020000, CRC(f022b3da) SHA1(3c337d12f4e12141b412a7289df46f44c66964b2) )
3940   ROM_LOAD32_WORD("epr-17966.ic13", 0x000002, 0x020000, CRC(f9e4ece5) SHA1(2df03455a00ae7066c30bace5c2b81581529e6f4) )
38333941
38343942   ROM_REGION32_LE( 0x2000000, REGION_USER1, 0 ) // Data
38353943   ROM_LOAD32_WORD("mpr-16528.10",   0x000000, 0x200000, CRC(9ce591f6) SHA1(e22fc8a70b533f7a6191f5952c581fb8f9627906) )
38363944   ROM_LOAD32_WORD("mpr-16529.11",   0x000002, 0x200000, CRC(f7095eaf) SHA1(da3c922f950dd730ea348eae12aa1cb69cee9a58) )
38373945   ROM_LOAD32_WORD("mpr-16808.8",    0x400000, 0x200000, CRC(44f1f5a0) SHA1(343866a6e2187a8ebc17f6727080f9f2f9ac9200) )
38383946   ROM_LOAD32_WORD("mpr-16809.9",    0x400002, 0x200000, CRC(37a2dd12) SHA1(8192d8698d6bd52ee11cc28917aff5840c447627) )
3839   ROM_LOAD32_WORD("epr17967.ic6",   0x800000, 0x080000, CRC(a94d8690) SHA1(a716646be6be0b87a550cb88b40e62a5c203ffdf) )
3840   ROM_LOAD32_WORD("epr17968.ic7",   0x800002, 0x080000, CRC(9d5a92c6) SHA1(9eb43314f3dc6acbbe0aa991d7a5fa44afe9cdd0) )
3947   ROM_LOAD32_WORD("epr-17967.ic6",  0x800000, 0x080000, CRC(a94d8690) SHA1(a716646be6be0b87a550cb88b40e62a5c203ffdf) )
3948   ROM_LOAD32_WORD("epr-17968.ic7",  0x800002, 0x080000, CRC(9d5a92c6) SHA1(9eb43314f3dc6acbbe0aa991d7a5fa44afe9cdd0) )
38413949   ROM_COPY( REGION_USER1, 0x800000, 0x900000, 0x100000 ) // rgn,srcoffset,offset,length.
38423950   ROM_COPY( REGION_USER1, 0x800000, 0xa00000, 0x100000 )
38433951   ROM_COPY( REGION_USER1, 0x800000, 0xb00000, 0x100000 )
r2956r2957
38843992   MODEL2_CPU_BOARD /* Model 2 CPU board extra roms */
38853993
38863994   ROM_REGION( 0x10000, REGION_USER7, 0 ) // Unknown ROM
3887   ROM_LOAD("14869c.25", 0x000000, 0x010000, CRC(24b68e64) SHA1(c19d044d4c2fe551474492aa51922587394dd371) )
3995   ROM_LOAD("epr-14869c.25", 0x000000, 0x010000, CRC(24b68e64) SHA1(c19d044d4c2fe551474492aa51922587394dd371) )
38883996ROM_END
38893997
38903998ROM_START( daytonat )
r2956r2957
39454053   MODEL2_CPU_BOARD /* Model 2 CPU board extra roms */
39464054
39474055   ROM_REGION( 0x10000, REGION_USER7, 0 ) // Unknown ROM
3948   ROM_LOAD("14869c.25", 0x000000, 0x010000, CRC(24b68e64) SHA1(c19d044d4c2fe551474492aa51922587394dd371) )
4056   ROM_LOAD("epr-14869c.25", 0x000000, 0x010000, CRC(24b68e64) SHA1(c19d044d4c2fe551474492aa51922587394dd371) )
39494057ROM_END
39504058
39514059ROM_START( daytonam )
r2956r2957
40074115   MODEL2_CPU_BOARD /* Model 2 CPU board extra roms */
40084116
40094117   ROM_REGION( 0x10000, REGION_USER7, 0 ) // Unknown ROM
4010   ROM_LOAD("14869c.25", 0x000000, 0x010000, CRC(24b68e64) SHA1(c19d044d4c2fe551474492aa51922587394dd371) )
4118   ROM_LOAD("epr-14869c.25", 0x000000, 0x010000, CRC(24b68e64) SHA1(c19d044d4c2fe551474492aa51922587394dd371) )
40114119ROM_END
40124120
40134121ROM_START( vcop )
r2956r2957
41544262
41554263// Model 2 (TGPs, Model 1 sound board)
41564264GAME( 1993, daytona,         0, model2o, daytona, 0,        ROT0, "Sega", "Daytona USA (Japan) (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
4265GAME( 1993, dayton93,  daytona, model2o, daytona, 0,        ROT0, "Sega", "Daytona USA Deluxe '93", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
41574266GAME( 1993, daytonas,  daytona, model2o, daytona, 0,        ROT0, "Sega", "Daytona USA (With Saturn Adverts)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
41584267GAME( 1993, daytonat,  daytona, model2o, daytona, 0,        ROT0, "Sega", "Daytona USA (Japan, Turbo hack)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
41594268GAME( 1993, daytonam,  daytona, model2o, daytona, daytonam, ROT0, "Sega", "Daytona USA (Japan, To The MAXX)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
r2956r2957
41664275GAME( 1995, srallyc,         0, model2a, model2, 0,       ROT0, "Sega", "Sega Rally Championship", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
41674276GAME( 1995, vf2,             0, model2a, model2, 0,       ROT0, "Sega", "Virtua Fighter 2 (ver 2.1)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
41684277GAME( 1995, vf2b,          vf2, model2a, model2, 0,       ROT0, "Sega", "Virtua Fighter 2 (Revision B)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
4278GAME( 1995, vf2a,          vf2, model2a, model2, 0,       ROT0, "Sega", "Virtua Fighter 2 (Revision A)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
41694279GAME( 1995, vf2o,          vf2, model2a, model2, 0,       ROT0, "Sega", "Virtua Fighter 2", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
41704280GAME( 1995, vcop2,           0, model2a, model2, 0,       ROT0, "Sega", "Virtua Cop 2", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
41714281GAME( 1995, skytargt,        0, model2a, model2, 0,       ROT0, "Sega", "Sky Target", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS )
src/mame/drivers/sshangha.c
r2956r2957
9898   switch (offset)
9999   {
100100      case 0x050 >> 1: /* Player 1 & Player 2 joysticks & fire buttons */
101         return (input_port_read_indexed(machine, 0) + (input_port_read_indexed(machine, 1) << 8));
101         return (input_port_read(machine, "P1") + (input_port_read(machine, "P2") << 8));
102102      case 0x76a >> 1: /* Credits */
103         return input_port_read_indexed(machine, 2);
103         return input_port_read(machine, "SYSTEM");
104104      case 0x0ac >> 1: /* DIPS */
105         return (input_port_read_indexed(machine, 3) + (input_port_read_indexed(machine, 4) << 8));
105         return (input_port_read(machine, "DSW1") + (input_port_read(machine, "DSW2") << 8));
106106
107107      // Protection TODO
108108   }
r2956r2957
116116   switch (offset)
117117   {
118118      case 0x050 >> 1: /* Player 1 & Player 2 joysticks & fire buttons */
119         return (input_port_read_indexed(machine, 0) + (input_port_read_indexed(machine, 1) << 8));
119         return (input_port_read(machine, "P1") + (input_port_read(machine, "P2") << 8));
120120      case 0x76a >> 1: /* Credits */
121         return input_port_read_indexed(machine, 2);
121         return input_port_read(machine, "SYSTEM");
122122      case 0x0ac >> 1: /* DIPS */
123         return (input_port_read_indexed(machine, 3) + (input_port_read_indexed(machine, 4) << 8));
123         return (input_port_read(machine, "DSW1") + (input_port_read(machine, "DSW2") << 8));
124124   }
125125   return sshangha_prot_data[offset];
126126}
r2956r2957
202202/******************************************************************************/
203203
204204static INPUT_PORTS_START( sshangha )
205   PORT_START_TAG("IN0")   /* Player 1 controls (0xfec047.b) */
205   PORT_START_TAG("P1")   /* Player 1 controls (0xfec047.b) */
206206   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
207207   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
208208   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
212212   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)   PORT_NAME("P1 Help")
213213   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
214214
215   PORT_START_TAG("IN1")   /* Player 2 controls (0xfec046.b) */
215   PORT_START_TAG("P2")   /* Player 2 controls (0xfec046.b) */
216216   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
217217   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
218218   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
222222   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)   PORT_NAME("P2 Help")
223223   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
224224
225   PORT_START_TAG("IN2")   /* Credits */
225   PORT_START_TAG("SYSTEM")   /* Credits */
226226   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
227227   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
228228   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
src/mame/drivers/pushman.c
r2956r2957
3838
3939/******************************************************************************/
4040
41static WRITE16_HANDLER( pushman_flipscreen_w )
42{
43   if (ACCESSING_BITS_8_15)
44   {
45      flip_screen_set(data & 0x0200);
46      coin_counter_w(0, data & 0x4000);
47      coin_counter_w(1, data & 0x8000);
48   }
49}
50
4151static WRITE16_HANDLER( pushman_control_w )
4252{
4353   if (ACCESSING_BITS_8_15)
r2956r2957
150160   AM_RANGE(0x000000, 0x01ffff) AM_WRITE(SMH_ROM)
151161   AM_RANGE(0x060000, 0x060007) AM_WRITE(pushman_68705_w)
152162   AM_RANGE(0xfe0800, 0xfe17ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16)
163   AM_RANGE(0xfe4000, 0xfe4001) AM_WRITE(pushman_flipscreen_w)
153164   AM_RANGE(0xfe4002, 0xfe4003) AM_WRITE(pushman_control_w)
154165   AM_RANGE(0xfe8000, 0xfe8003) AM_WRITE(pushman_scroll_w)
155166   AM_RANGE(0xfe800e, 0xfe800f) AM_WRITE(SMH_NOP) /* ? */
r2956r2957
207218   AM_RANGE(0x00000, 0x1ffff) AM_WRITE(SMH_ROM)
208219   AM_RANGE(0x60000, 0x60007) AM_WRITE(bballs_68705_w)
209220   AM_RANGE(0xe0800, 0xe17ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16)
221   AM_RANGE(0xe4000, 0xe4001) AM_WRITE(pushman_flipscreen_w)
210222   AM_RANGE(0xe4002, 0xe4003) AM_WRITE(pushman_control_w)
211223   AM_RANGE(0xe8000, 0xe8003) AM_WRITE(pushman_scroll_w)
212224   AM_RANGE(0xe800e, 0xe800f) AM_WRITE(SMH_NOP) /* ? */
r2956r2957
257269   PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Level_Select ) )
258270   PORT_DIPSETTING(      0x0004, DEF_STR( Off ) )
259271   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
260   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Flip_Screen ) )
261   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
262   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
272   PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Cabinet ) )
273   PORT_DIPSETTING(      0x0008, DEF_STR( Upright ) )
274   PORT_DIPSETTING(      0x0000, DEF_STR( Cocktail ) )
263275   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Demo_Sounds ) )
264276   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
265277   PORT_DIPSETTING(      0x0010, DEF_STR( On ) )
src/mame/drivers/toaplan1.c
r2956r2957
7979   AM_RANGE(0x100002, 0x100003) AM_READWRITE(toaplan1_tileram_offs_r, toaplan1_tileram_offs_w)
8080   AM_RANGE(0x100004, 0x100007) AM_READWRITE(rallybik_tileram16_r, toaplan1_tileram16_w)
8181   AM_RANGE(0x100010, 0x10001f) AM_READWRITE(toaplan1_scroll_regs_r, toaplan1_scroll_regs_w)
82   AM_RANGE(0x140000, 0x140001) AM_READ(input_port_0_word_r)
82   AM_RANGE(0x140000, 0x140001) AM_READ_PORT("VBLANK")
8383//  AM_RANGE(0x140000, 0x140001) AM_WRITE(?? video frame related ??)
8484   AM_RANGE(0x140002, 0x140003) AM_WRITE(toaplan1_intenable_w)
8585   AM_RANGE(0x140008, 0x14000f) AM_WRITE(toaplan1_bcu_control_w)
r2956r2957
101101   AM_RANGE(0x100002, 0x100003) AM_READWRITE(toaplan1_tileram_offs_r, toaplan1_tileram_offs_w)
102102   AM_RANGE(0x100004, 0x100007) AM_READWRITE(toaplan1_tileram16_r, toaplan1_tileram16_w)
103103   AM_RANGE(0x100010, 0x10001f) AM_READWRITE(toaplan1_scroll_regs_r, toaplan1_scroll_regs_w)
104   AM_RANGE(0x140000, 0x140001) AM_READ(input_port_0_word_r)
104   AM_RANGE(0x140000, 0x140001) AM_READ_PORT("VBLANK")
105105//  AM_RANGE(0x140000, 0x140001) AM_WRITE(?? video frame related ??)
106106   AM_RANGE(0x140002, 0x140003) AM_WRITE(toaplan1_intenable_w)
107107   AM_RANGE(0x140008, 0x14000f) AM_WRITE(toaplan1_bcu_control_w)
r2956r2957
116116static ADDRESS_MAP_START( hellfire_main_map, ADDRESS_SPACE_PROGRAM, 16 )
117117   AM_RANGE(0x000000, 0x03ffff) AM_ROM
118118   AM_RANGE(0x040000, 0x047fff) AM_RAM
119   AM_RANGE(0x080000, 0x080001) AM_READ(input_port_0_word_r)
119   AM_RANGE(0x080000, 0x080001) AM_READ_PORT("VBLANK")
120120//  AM_RANGE(0x080000, 0x080001) AM_WRITE(?? video frame related ??)
121121   AM_RANGE(0x080002, 0x080003) AM_WRITE(toaplan1_intenable_w)
122122   AM_RANGE(0x080008, 0x08000f) AM_WRITE(toaplan1_bcu_control_w)
r2956r2957
142142   AM_RANGE(0x080000, 0x087fff) AM_RAM
143143   AM_RANGE(0x0c0000, 0x0c0003) AM_WRITE(toaplan1_tile_offsets_w)
144144   AM_RANGE(0x0c0006, 0x0c0007) AM_WRITE(toaplan1_fcu_flipscreen_w)
145   AM_RANGE(0x400000, 0x400001) AM_READ(input_port_0_word_r)
145   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("VBLANK")
146146//  AM_RANGE(0x400000, 0x400001) AM_WRITE(?? video frame related ??)
147147   AM_RANGE(0x400002, 0x400003) AM_WRITE(toaplan1_intenable_w)
148148   AM_RANGE(0x400008, 0x40000f) AM_WRITE(toaplan1_bcu_control_w)
r2956r2957
161161
162162static ADDRESS_MAP_START( demonwld_main_map, ADDRESS_SPACE_PROGRAM, 16 )
163163   AM_RANGE(0x000000, 0x03ffff) AM_ROM
164   AM_RANGE(0x400000, 0x400001) AM_READ(input_port_0_word_r)
164   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("VBLANK")
165165//  AM_RANGE(0x400000, 0x400001) AM_WRITE(?? video frame related ??)
166166   AM_RANGE(0x400002, 0x400003) AM_WRITE(toaplan1_intenable_w)
167167   AM_RANGE(0x400008, 0x40000f) AM_WRITE(toaplan1_bcu_control_w)
r2956r2957
189189   AM_RANGE(0x080000, 0x080003) AM_WRITE(toaplan1_tile_offsets_w)
190190   AM_RANGE(0x080006, 0x080007) AM_WRITE(toaplan1_fcu_flipscreen_w)
191191   AM_RANGE(0x0c0000, 0x0c3fff) AM_RAM         /* Frame done at $c1ada */
192   AM_RANGE(0x100000, 0x100001) AM_READ(input_port_0_word_r)
192   AM_RANGE(0x100000, 0x100001) AM_READ_PORT("VBLANK")
193193//  AM_RANGE(0x100000, 0x100001) AM_WRITE(?? video frame related ??)
194194   AM_RANGE(0x100002, 0x100003) AM_WRITE(toaplan1_intenable_w)
195195   AM_RANGE(0x100008, 0x10000f) AM_WRITE(toaplan1_bcu_control_w)
196196   AM_RANGE(0x104000, 0x1047ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE(&toaplan1_colorram1) AM_SIZE(&toaplan1_colorram1_size)
197197   AM_RANGE(0x106000, 0x1067ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE(&toaplan1_colorram2) AM_SIZE(&toaplan1_colorram2_size)
198   AM_RANGE(0x140000, 0x140001) AM_READ(input_port_1_word_r)
199   AM_RANGE(0x140002, 0x140003) AM_READ(input_port_2_word_r)
200   AM_RANGE(0x140004, 0x140005) AM_READ(input_port_3_word_r)
201   AM_RANGE(0x140006, 0x140007) AM_READ(input_port_4_word_r)
202   AM_RANGE(0x140008, 0x140009) AM_READ(input_port_5_word_r)
198   AM_RANGE(0x140000, 0x140001) AM_READ_PORT("P1")
199   AM_RANGE(0x140002, 0x140003) AM_READ_PORT("P2")
200   AM_RANGE(0x140004, 0x140005) AM_READ_PORT("DSWA")
201   AM_RANGE(0x140006, 0x140007) AM_READ_PORT("DSWB")
202   AM_RANGE(0x140008, 0x140009) AM_READ_PORT("SYSTEM")
203203   AM_RANGE(0x14000a, 0x14000b) AM_READ(samesame_port_6_word_r)   /* Territory, and MCU ready */
204204   AM_RANGE(0x14000c, 0x14000d) AM_WRITE(samesame_coin_w)   /* Coin counter/lockout */
205205//  AM_RANGE(0x14000e, 0x14000f) AM_WRITE(samesame_mcu_w)   /* Commands sent to HD647180 */
r2956r2957
226226   AM_RANGE(0x200004, 0x200007) AM_READWRITE(toaplan1_tileram16_r, toaplan1_tileram16_w)
227227   AM_RANGE(0x200010, 0x20001f) AM_READWRITE(toaplan1_scroll_regs_r, toaplan1_scroll_regs_w)
228228   AM_RANGE(0x240000, 0x243fff) AM_RAM
229   AM_RANGE(0x300000, 0x300001) AM_READ(input_port_0_word_r)
229   AM_RANGE(0x300000, 0x300001) AM_READ_PORT("VBLANK")
230230//  AM_RANGE(0x300000, 0x300001) AM_WRITE(?? video frame related ??)
231231   AM_RANGE(0x300002, 0x300003) AM_WRITE(toaplan1_intenable_w)
232232   AM_RANGE(0x300008, 0x30000f) AM_WRITE(toaplan1_bcu_control_w)
r2956r2957
244244   AM_RANGE(0x0c0002, 0x0c0003) AM_READWRITE(toaplan1_spriteram_offs_r, toaplan1_spriteram_offs_w)
245245   AM_RANGE(0x0c0004, 0x0c0005) AM_READWRITE(toaplan1_spriteram16_r, toaplan1_spriteram16_w)
246246   AM_RANGE(0x0c0006, 0x0c0007) AM_READWRITE(toaplan1_spritesizeram16_r, toaplan1_spritesizeram16_w)
247   AM_RANGE(0x400000, 0x400001) AM_READ(input_port_0_word_r)
247   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("VBLANK")
248248//  AM_RANGE(0x400000, 0x400001) AM_WRITE(?? video frame related ??)
249249   AM_RANGE(0x400002, 0x400003) AM_WRITE(toaplan1_intenable_w)
250250   AM_RANGE(0x400008, 0x40000f) AM_WRITE(toaplan1_bcu_control_w)
251251   AM_RANGE(0x404000, 0x4047ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE(&toaplan1_colorram1) AM_SIZE(&toaplan1_colorram1_size)
252252   AM_RANGE(0x406000, 0x4067ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE(&toaplan1_colorram2) AM_SIZE(&toaplan1_colorram2_size)
253253   AM_RANGE(0x440000, 0x440005) AM_READWRITE(vimana_mcu_r, vimana_mcu_w)
254   AM_RANGE(0x440006, 0x440007) AM_READ(input_port_3_word_r)
254   AM_RANGE(0x440006, 0x440007) AM_READ_PORT("DSWA")
255255   AM_RANGE(0x440008, 0x440009) AM_READ(vimana_input_port_5_word_r)
256   AM_RANGE(0x44000a, 0x44000b) AM_READ(input_port_1_word_r)
257   AM_RANGE(0x44000c, 0x44000d) AM_READ(input_port_2_word_r)
258   AM_RANGE(0x44000e, 0x44000f) AM_READ(input_port_4_word_r)
259   AM_RANGE(0x440010, 0x440011) AM_READ(input_port_6_word_r)
256   AM_RANGE(0x44000a, 0x44000b) AM_READ_PORT("P1")
257   AM_RANGE(0x44000c, 0x44000d) AM_READ_PORT("P2")
258   AM_RANGE(0x44000e, 0x44000f) AM_READ_PORT("DSWB")
259   AM_RANGE(0x440010, 0x440011) AM_READ_PORT("TJUMP")
260260   AM_RANGE(0x480000, 0x487fff) AM_RAM
261261   AM_RANGE(0x4c0000, 0x4c0001) AM_WRITE(toaplan1_bcu_flipscreen_w)
262262   AM_RANGE(0x4c0002, 0x4c0003) AM_READWRITE(toaplan1_tileram_offs_r, toaplan1_tileram_offs_w)
r2956r2957
274274
275275static ADDRESS_MAP_START( rallybik_sound_io_map, ADDRESS_SPACE_IO, 8 )
276276   ADDRESS_MAP_GLOBAL_MASK(0xff)
277   AM_RANGE(0x00, 0x00) AM_READ(input_port_1_r)   /* Player 1 */
278   AM_RANGE(0x10, 0x10) AM_READ(input_port_2_r)   /* Player 2 */
279   AM_RANGE(0x20, 0x20) AM_READ(input_port_5_r)   /* Coin/Start inputs */
277   AM_RANGE(0x00, 0x00) AM_READ_PORT("P1")
278   AM_RANGE(0x10, 0x10) AM_READ_PORT("P2")
279   AM_RANGE(0x20, 0x20) AM_READ_PORT("SYSTEM")
280280   AM_RANGE(0x30, 0x30) AM_WRITE(rallybik_coin_w)   /* Coin counter/lockout */
281   AM_RANGE(0x40, 0x40) AM_READ(input_port_3_r)   /* DSW1 */
282   AM_RANGE(0x50, 0x50) AM_READ(input_port_4_r)   /* DSW2 */
281   AM_RANGE(0x40, 0x40) AM_READ_PORT("DSWA")
282   AM_RANGE(0x50, 0x50) AM_READ_PORT("DSWB")
283283   AM_RANGE(0x60, 0x60) AM_READWRITE(YM3812_status_port_0_r, YM3812_control_port_0_w)
284284   AM_RANGE(0x61, 0x61) AM_WRITE(YM3812_write_port_0_w)
285   AM_RANGE(0x70, 0x70) AM_READ(input_port_6_r)   /* Territory Jumper Block for Truxton */
285   AM_RANGE(0x70, 0x70) AM_READ_PORT("TJUMP")
286286ADDRESS_MAP_END
287287
288288static ADDRESS_MAP_START( truxton_sound_io_map, ADDRESS_SPACE_IO, 8 )
289289   ADDRESS_MAP_GLOBAL_MASK(0xff)
290   AM_RANGE(0x00, 0x00) AM_READ(input_port_1_r)   /* Player 1 */
291   AM_RANGE(0x10, 0x10) AM_READ(input_port_2_r)   /* Player 2 */
292   AM_RANGE(0x20, 0x20) AM_READ(input_port_5_r)   /* Coin/Start inputs */
290   AM_RANGE(0x00, 0x00) AM_READ_PORT("P1")
291   AM_RANGE(0x10, 0x10) AM_READ_PORT("P2")
292   AM_RANGE(0x20, 0x20) AM_READ_PORT("SYSTEM")
293293   AM_RANGE(0x30, 0x30) AM_WRITE(toaplan1_coin_w)   /* Coin counter/lockout */
294   AM_RANGE(0x40, 0x40) AM_READ(input_port_3_r)   /* DSW1 */
295   AM_RANGE(0x50, 0x50) AM_READ(input_port_4_r)   /* DSW2 */
294   AM_RANGE(0x40, 0x40) AM_READ_PORT("DSWA")
295   AM_RANGE(0x50, 0x50) AM_READ_PORT("DSWB")
296296   AM_RANGE(0x60, 0x60) AM_READWRITE(YM3812_status_port_0_r, YM3812_control_port_0_w)
297297   AM_RANGE(0x61, 0x61) AM_WRITE(YM3812_write_port_0_w)
298   AM_RANGE(0x70, 0x70) AM_READ(input_port_6_r)   /* Territory Jumper Block for Truxton */
298   AM_RANGE(0x70, 0x70) AM_READ_PORT("TJUMP")
299299ADDRESS_MAP_END
300300
301301static ADDRESS_MAP_START( hellfire_sound_io_map, ADDRESS_SPACE_IO, 8 )
302302   ADDRESS_MAP_GLOBAL_MASK(0xff)
303   AM_RANGE(0x00, 0x00) AM_READ(input_port_3_r)   /* DSW1 */
304   AM_RANGE(0x10, 0x10) AM_READ(input_port_4_r)   /* DSW2 */
305   AM_RANGE(0x20, 0x20) AM_READ(input_port_6_r)   /* Territory Jumper Block */
303   AM_RANGE(0x00, 0x00) AM_READ_PORT("DSWA")
304   AM_RANGE(0x10, 0x10) AM_READ_PORT("DSWB")
305   AM_RANGE(0x20, 0x20) AM_READ_PORT("TJUMP")
306306   AM_RANGE(0x30, 0x30) AM_WRITE(toaplan1_coin_w)   /* Coin counter/lockout */
307   AM_RANGE(0x40, 0x40) AM_READ(input_port_1_r)   /* Player 1 */
308   AM_RANGE(0x50, 0x50) AM_READ(input_port_2_r)   /* Player 2 */
309   AM_RANGE(0x60, 0x60) AM_READ(input_port_5_r)   /* Coin/Start inputs */
307   AM_RANGE(0x40, 0x40) AM_READ_PORT("P1")
308   AM_RANGE(0x50, 0x50) AM_READ_PORT("P2")
309   AM_RANGE(0x60, 0x60) AM_READ_PORT("SYSTEM")
310310   AM_RANGE(0x70, 0x70) AM_READWRITE(YM3812_status_port_0_r, YM3812_control_port_0_w)
311311   AM_RANGE(0x71, 0x71) AM_WRITE(YM3812_write_port_0_w)
312312ADDRESS_MAP_END
313313
314314static ADDRESS_MAP_START( zerowing_sound_io_map, ADDRESS_SPACE_IO, 8 )
315315   ADDRESS_MAP_GLOBAL_MASK(0xff)
316   AM_RANGE(0x00, 0x00) AM_READ(input_port_1_r)   /* Player 1 */
317   AM_RANGE(0x08, 0x08) AM_READ(input_port_2_r)   /* Player 2 */
318   AM_RANGE(0x20, 0x20) AM_READ(input_port_3_r)   /* DSW1 */
319   AM_RANGE(0x28, 0x28) AM_READ(input_port_4_r)   /* DSW2 */
320   AM_RANGE(0x80, 0x80) AM_READ(input_port_5_r)   /* Coin/Start inputs */
321   AM_RANGE(0x88, 0x88) AM_READ(input_port_6_r)   /* Territory Jumper Block */
316   AM_RANGE(0x00, 0x00) AM_READ_PORT("P1")
317   AM_RANGE(0x08, 0x08) AM_READ_PORT("P2")
318   AM_RANGE(0x20, 0x20) AM_READ_PORT("DSWA")
319   AM_RANGE(0x28, 0x28) AM_READ_PORT("DSWB")
320   AM_RANGE(0x80, 0x80) AM_READ_PORT("SYSTEM")
321   AM_RANGE(0x88, 0x88) AM_READ_PORT("TJUMP")
322322   AM_RANGE(0xa0, 0xa0) AM_WRITE(toaplan1_coin_w)   /* Coin counter/lockout */
323323   AM_RANGE(0xa8, 0xa8) AM_READWRITE(YM3812_status_port_0_r, YM3812_control_port_0_w)
324324   AM_RANGE(0xa9, 0xa9) AM_WRITE(YM3812_write_port_0_w)
r2956r2957
328328   ADDRESS_MAP_GLOBAL_MASK(0xff)
329329   AM_RANGE(0x00, 0x00) AM_READWRITE(YM3812_status_port_0_r, YM3812_control_port_0_w)
330330   AM_RANGE(0x01, 0x01) AM_WRITE(YM3812_write_port_0_w)
331   AM_RANGE(0x20, 0x20) AM_READ(input_port_6_r)
331   AM_RANGE(0x20, 0x20) AM_READ_PORT("TJUMP")
332332   AM_RANGE(0x40, 0x40) AM_WRITE(toaplan1_coin_w)   /* Coin counter/lockout */
333   AM_RANGE(0x60, 0x60) AM_READ(input_port_5_r)
334   AM_RANGE(0x80, 0x80) AM_READ(input_port_1_r)
335   AM_RANGE(0xa0, 0xa0) AM_READ(input_port_4_r)
336   AM_RANGE(0xc0, 0xc0) AM_READ(input_port_2_r)
337   AM_RANGE(0xe0, 0xe0) AM_READ(input_port_3_r)
333   AM_RANGE(0x60, 0x60) AM_READ_PORT("SYSTEM")
334   AM_RANGE(0x80, 0x80) AM_READ_PORT("P1")
335   AM_RANGE(0xa0, 0xa0) AM_READ_PORT("DSWB")
336   AM_RANGE(0xc0, 0xc0) AM_READ_PORT("P2")
337   AM_RANGE(0xe0, 0xe0) AM_READ_PORT("DSWA")
338338ADDRESS_MAP_END
339339
340340static ADDRESS_MAP_START( outzone_sound_io_map, ADDRESS_SPACE_IO, 8 )
r2956r2957
342342   AM_RANGE(0x00, 0x00) AM_READWRITE(YM3812_status_port_0_r, YM3812_control_port_0_w)
343343   AM_RANGE(0x01, 0x01) AM_WRITE(YM3812_write_port_0_w)
344344   AM_RANGE(0x04, 0x04) AM_WRITE(toaplan1_coin_w)   /* Coin counter/lockout */
345   AM_RANGE(0x08, 0x08) AM_READ(input_port_3_r)
346   AM_RANGE(0x0c, 0x0c) AM_READ(input_port_4_r)
347   AM_RANGE(0x10, 0x10) AM_READ(input_port_5_r)
348   AM_RANGE(0x14, 0x14) AM_READ(input_port_1_r)
349   AM_RANGE(0x18, 0x18) AM_READ(input_port_2_r)
350   AM_RANGE(0x1c, 0x1c) AM_READ(input_port_6_r)
345   AM_RANGE(0x08, 0x08) AM_READ_PORT("DSWA")
346   AM_RANGE(0x0c, 0x0c) AM_READ_PORT("DSWB")
347   AM_RANGE(0x10, 0x10) AM_READ_PORT("SYSTEM")
348   AM_RANGE(0x14, 0x14) AM_READ_PORT("P1")
349   AM_RANGE(0x18, 0x18) AM_READ_PORT("P2")
350   AM_RANGE(0x1c, 0x1c) AM_READ_PORT("TJUMP")
351351ADDRESS_MAP_END
352352
353353
r2956r2957
373373*****************************************************************************/
374374
375375#define  TOAPLAN1_PLAYER_INPUT( player, button3, options )                              \
376   PORT_START                                                   \
377   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(player) options PORT_8WAY   \
376   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(player) options PORT_8WAY      \
378377   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(player) options PORT_8WAY   \
379378   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(player) options PORT_8WAY   \
380379   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(player) options PORT_8WAY   \
381   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(player) options                   \
382   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(player) options                   \
383   PORT_BIT( 0x40, IP_ACTIVE_HIGH, button3 ) PORT_PLAYER(player) options                            \
380   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(player) options                \
381   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(player) options                \
382   PORT_BIT( 0x40, IP_ACTIVE_HIGH, button3 ) PORT_PLAYER(player) options                   \
384383   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
385384
386385#define  TOAPLAN1_SYSTEM_INPUTS                  \
387   PORT_START                              \
386   PORT_START_TAG("SYSTEM")                  \
388387   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE1 )    \
389388   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_TILT )      \
390389   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )   \
r2956r2957
395394   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
396395
397396#define  TOAPLAN1_VBLANK_INPUT                  \
398   PORT_START                              \
397   PORT_START_TAG("VBLANK")                  \
399398   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_VBLANK )   \
400399   PORT_BIT( 0xfffe, IP_ACTIVE_HIGH, IPT_UNKNOWN )
401400
r2956r2957
403402static INPUT_PORTS_START( rallybik )
404403   TOAPLAN1_VBLANK_INPUT
405404
405   PORT_START_TAG("P1")
406406   TOAPLAN1_PLAYER_INPUT( 1, IPT_UNKNOWN, )
407407
408   PORT_START_TAG("P2")
408409   TOAPLAN1_PLAYER_INPUT( 2, IPT_UNKNOWN, PORT_COCKTAIL )
409410
410   PORT_START      /* DSW A */
411   PORT_START_TAG("DSWA")   /* DSW A */
411412   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
412413   PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
413414   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
r2956r2957
429430   PORT_DIPSETTING(    0xc0, DEF_STR( 2C_3C ) )
430431   PORT_DIPSETTING(    0x40, DEF_STR( 1C_2C ) )
431432
432   PORT_START      /* DSW B */
433   PORT_START_TAG("DSWB")   /* DSW B */
433434   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Difficulty ) )
434435   PORT_DIPSETTING(    0x01, DEF_STR( Easy ) )
435436   PORT_DIPSETTING(    0x00, DEF_STR( Medium ) )
r2956r2957
454455   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
455456
456457   TOAPLAN1_SYSTEM_INPUTS
457
458458INPUT_PORTS_END
459459
460460static INPUT_PORTS_START( truxton )
461461   TOAPLAN1_VBLANK_INPUT
462462
463   PORT_START_TAG("P1")
463464   TOAPLAN1_PLAYER_INPUT( 1, IPT_UNKNOWN, )
464465
466   PORT_START_TAG("P2")
465467   TOAPLAN1_PLAYER_INPUT( 2, IPT_UNKNOWN, PORT_COCKTAIL )
466468
467   PORT_START      /* DSW A */
469   PORT_START_TAG("DSWA")   /* DSW A */
468470   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
469471   PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
470472   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
r2956r2957
499501    PORT_DIPSETTING(    0xc0, DEF_STR( 1C_6C ) )
500502*/
501503
502   PORT_START      /* DSW B */
504   PORT_START_TAG("DSWB")   /* DSW B */
503505   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Difficulty ) )
504506   PORT_DIPSETTING(    0x01, DEF_STR( Easy ) )
505507   PORT_DIPSETTING(    0x00, DEF_STR( Medium ) )
r2956r2957
524526
525527   TOAPLAN1_SYSTEM_INPUTS
526528
527   PORT_START      /* Territory Jumper Block */
529   PORT_START_TAG("TJUMP")   /* Territory Jumper Block */
528530   PORT_DIPNAME( 0x07, 0x02, "Territory/Copyright" )
529531   PORT_DIPSETTING(    0x02, "World/Taito Corp" )
530532   PORT_DIPSETTING(    0x06, "World/Taito America" )
r2956r2957
543545static INPUT_PORTS_START( hellfire )
544546   TOAPLAN1_VBLANK_INPUT
545547
548   PORT_START_TAG("P1")
546549   TOAPLAN1_PLAYER_INPUT( 1, IPT_UNKNOWN, )
547550
551   PORT_START_TAG("P2")
548552   TOAPLAN1_PLAYER_INPUT( 2, IPT_UNKNOWN, )
549553
550554   PORT_START_TAG("DSWA")      /* DSW A */
r2956r2957
621625static INPUT_PORTS_START( zerowing )
622626   TOAPLAN1_VBLANK_INPUT
623627
628   PORT_START_TAG("P1")
624629   TOAPLAN1_PLAYER_INPUT( 1, IPT_UNKNOWN, )
625630
631   PORT_START_TAG("P2")
626632   TOAPLAN1_PLAYER_INPUT( 2, IPT_UNKNOWN, PORT_COCKTAIL )
627633
628634   PORT_START_TAG("DSWA")      /* DSW A */
r2956r2957
703709static INPUT_PORTS_START( demonwld )
704710   TOAPLAN1_VBLANK_INPUT
705711
712   PORT_START_TAG("P1")
706713   TOAPLAN1_PLAYER_INPUT( 1, IPT_BUTTON3, )
707714
715   PORT_START_TAG("P2")
708716   TOAPLAN1_PLAYER_INPUT( 2, IPT_BUTTON3, )
709717
710718   PORT_START_TAG("DSWA")      /* DSW A */
r2956r2957
784792static INPUT_PORTS_START( samesame )
785793   TOAPLAN1_VBLANK_INPUT
786794
795   PORT_START_TAG("P1")
787796   TOAPLAN1_PLAYER_INPUT( 1, IPT_UNKNOWN, )
788797
798   PORT_START_TAG("P2")
789799   TOAPLAN1_PLAYER_INPUT( 2, IPT_UNKNOWN, PORT_COCKTAIL )
790800
791801   PORT_START_TAG("DSWA")      /* DSW A */
r2956r2957
910920static INPUT_PORTS_START( outzone )
911921   TOAPLAN1_VBLANK_INPUT
912922
923   PORT_START_TAG("P1")
913924   TOAPLAN1_PLAYER_INPUT( 1, IPT_BUTTON3, )
914925
926   PORT_START_TAG("P2")
915927   TOAPLAN1_PLAYER_INPUT( 2, IPT_BUTTON3, )
916928
917929   PORT_START_TAG("DSWA")      /* DSW A */
r2956r2957
10271039static INPUT_PORTS_START( vimana )
10281040   TOAPLAN1_VBLANK_INPUT
10291041
1042   PORT_START_TAG("P1")
10301043   TOAPLAN1_PLAYER_INPUT( 1, IPT_BUTTON3, )
10311044
1045   PORT_START_TAG("P2")
10321046   TOAPLAN1_PLAYER_INPUT( 2, IPT_BUTTON3, )
10331047
10341048   PORT_START_TAG("DSWA")      /* DSW A */
src/mame/drivers/tmnt.c
r2956r2957
491491
492492   /* bit 3 is service button */
493493   /* bit 6 is ??? VBLANK? OBJMPX? */
494   res = input_port_read_indexed(machine,2);
494   res = input_port_read(machine, "COINS");
495495   if (init_eeprom_count)
496496   {
497497      init_eeprom_count--;
r2956r2957
507507
508508   /* bit 0 is EEPROM data */
509509   /* bit 1 is EEPROM ready */
510   res = eeprom_read_bit() | input_port_read_indexed(machine,3);
510   res = eeprom_read_bit() | input_port_read(machine, "EEPROM");
511511   return res;
512512}
513513
r2956r2957
520520   /* bit 1 is EEPROM ready */
521521   /* bit 2 is VBLANK (???) */
522522   /* bit 7 is service button */
523   res = eeprom_read_bit() | input_port_read_indexed(machine,3);
523   res = eeprom_read_bit() | input_port_read(machine, "EEPROM");
524524   if (init_eeprom_count)
525525   {
526526      init_eeprom_count--;
r2956r2957
539539   /* bit 1 is EEPROM ready */
540540   /* bit 2 is VBLANK (???) */
541541   /* bit 3 is service button */
542   res = eeprom_read_bit() | input_port_read_indexed(machine,3);
542   res = eeprom_read_bit() | input_port_read(machine, "EEPROM");
543543   if (init_eeprom_count)
544544   {
545545      init_eeprom_count--;
r2956r2957
598598{
599599   int res;
600600
601   res = input_port_read_indexed(machine,0);
601   res = input_port_read(machine, "P1/COINS");
602602   if (init_eeprom_count)
603603   {
604604      init_eeprom_count--;
r2956r2957
616616   /* bit 1 is EEPROM ready */
617617   /* bit 3 is VBLANK (???) */
618618   /* bit 7 is service button */
619   res = (eeprom_read_bit() << 8) | input_port_read_indexed(machine,1);
619   res = (eeprom_read_bit() << 8) | input_port_read(machine, "P2/EEPROM");
620620   toggle ^= 0x0800;
621621   return (res ^ toggle);
622622}
r2956r2957
650650   /* bit 9 is service button */
651651   int res;
652652
653   res = input_port_read_indexed(machine,0);
653   res = input_port_read(machine, "P1/COINS");
654654   if (init_eeprom_count)
655655   {
656656      init_eeprom_count--;
r2956r2957
663663{
664664   /* bit 8 is EEPROM data */
665665   /* bit 9 is EEPROM ready */
666   return (eeprom_read_bit() << 8) | input_port_read_indexed(machine,1);
666   return (eeprom_read_bit() << 8) | input_port_read(machine, "P2/EEPROM");
667667}
668668
669669static WRITE16_HANDLER( prmrsocr_eeprom_w )
r2956r2957
721721   AM_RANGE(0x040000, 0x043fff) AM_RAM   /* main RAM */
722722   AM_RANGE(0x060000, 0x063fff) AM_RAM   /* main RAM */
723723   AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(tmnt_paletteram_word_w) AM_BASE(&paletteram16)
724   AM_RANGE(0x0a0000, 0x0a0001) AM_READWRITE(input_port_0_word_r, tmnt_0a0000_w)
725   AM_RANGE(0x0a0002, 0x0a0003) AM_READ(input_port_1_word_r)
726   AM_RANGE(0x0a0004, 0x0a0005) AM_READ(input_port_2_word_r)
724   AM_RANGE(0x0a0000, 0x0a0001) AM_READ_PORT("COINS") AM_WRITE(tmnt_0a0000_w)
725   AM_RANGE(0x0a0002, 0x0a0003) AM_READ_PORT("P1")
726   AM_RANGE(0x0a0004, 0x0a0005) AM_READ_PORT("P2")
727727   AM_RANGE(0x0a0008, 0x0a0009) AM_WRITE(tmnt_sound_command_w)
728   AM_RANGE(0x0a0010, 0x0a0011) AM_READWRITE(input_port_3_word_r, watchdog_reset16_w)
729   AM_RANGE(0x0a0012, 0x0a0013) AM_READ(input_port_4_word_r)
730   AM_RANGE(0x0a0018, 0x0a0019) AM_READ(input_port_5_word_r)
728   AM_RANGE(0x0a0010, 0x0a0011) AM_READ_PORT("DSW1") AM_WRITE(watchdog_reset16_w)
729   AM_RANGE(0x0a0012, 0x0a0013) AM_READ_PORT("DSW2")
730   AM_RANGE(0x0a0018, 0x0a0019) AM_READ_PORT("DSW3")
731731   AM_RANGE(0x0b0000, 0x0b03ff) AM_READWRITE(cuebrick_nv_r, cuebrick_nv_w)
732732   AM_RANGE(0x0b0400, 0x0b0401) AM_WRITE(cuebrick_nvbank_w)
733733   AM_RANGE(0x0c0000, 0x0c0003) AM_READWRITE(cuebrick_snd_r, cuebrick_snd_w)
r2956r2957
742742   AM_RANGE(0x040000, 0x043fff) AM_RAM   /* main RAM */
743743   AM_RANGE(0x060000, 0x063fff) AM_RAM   /* main RAM */
744744   AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(tmnt_paletteram_word_w) AM_BASE(&paletteram16)
745   AM_RANGE(0x0a0000, 0x0a0001) AM_READWRITE(input_port_0_word_r, tmnt_0a0000_w)
746   AM_RANGE(0x0a0002, 0x0a0003) AM_READ(input_port_1_word_r)
747   AM_RANGE(0x0a0004, 0x0a0005) AM_READ(input_port_2_word_r)
745   AM_RANGE(0x0a0000, 0x0a0001) AM_READ_PORT("COINS") AM_WRITE(tmnt_0a0000_w)
746   AM_RANGE(0x0a0002, 0x0a0003) AM_READ_PORT("P1")
747   AM_RANGE(0x0a0004, 0x0a0005) AM_READ_PORT("P2")
748748   AM_RANGE(0x0a0008, 0x0a0009) AM_WRITE(tmnt_sound_command_w)
749   AM_RANGE(0x0a0010, 0x0a0011) AM_READWRITE(input_port_3_word_r, watchdog_reset16_w)
750   AM_RANGE(0x0a0012, 0x0a0013) AM_READ(input_port_4_word_r)
751   AM_RANGE(0x0a0018, 0x0a0019) AM_READ(input_port_5_word_r)
749   AM_RANGE(0x0a0010, 0x0a0011) AM_READ_PORT("DSW1") AM_WRITE(watchdog_reset16_w)
750   AM_RANGE(0x0a0012, 0x0a0013) AM_READ_PORT("DSW2")
751   AM_RANGE(0x0a0018, 0x0a0019) AM_READ_PORT("DSW3")
752752#if 0
753753   AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(tmnt_priority_w)
754754#endif
r2956r2957
763763   AM_RANGE(0x000000, 0x05ffff) AM_ROM
764764   AM_RANGE(0x060000, 0x063fff) AM_RAM   /* main RAM */
765765   AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(tmnt_paletteram_word_w) AM_BASE(&paletteram16)
766   AM_RANGE(0x0a0000, 0x0a0001) AM_READWRITE(input_port_0_word_r, tmnt_0a0000_w)
767   AM_RANGE(0x0a0002, 0x0a0003) AM_READ(input_port_1_word_r)
768   AM_RANGE(0x0a0004, 0x0a0005) AM_READ(input_port_2_word_r)
769   AM_RANGE(0x0a0006, 0x0a0007) AM_READ(input_port_3_word_r)
766   AM_RANGE(0x0a0000, 0x0a0001) AM_READ_PORT("COINS") AM_WRITE(tmnt_0a0000_w)
767   AM_RANGE(0x0a0002, 0x0a0003) AM_READ_PORT("P1")
768   AM_RANGE(0x0a0004, 0x0a0005) AM_READ_PORT("P2")
769   AM_RANGE(0x0a0006, 0x0a0007) AM_READ_PORT("P3")
770770   AM_RANGE(0x0a0008, 0x0a0009) AM_WRITE(tmnt_sound_command_w)
771   AM_RANGE(0x0a0010, 0x0a0011) AM_READWRITE(input_port_4_word_r, watchdog_reset16_w)
772   AM_RANGE(0x0a0012, 0x0a0013) AM_READ(input_port_5_word_r)
773   AM_RANGE(0x0a0014, 0x0a0015) AM_READ(input_port_6_word_r)
774   AM_RANGE(0x0a0018, 0x0a0019) AM_READ(input_port_7_word_r)
771   AM_RANGE(0x0a0010, 0x0a0011) AM_READ_PORT("DSW1") AM_WRITE(watchdog_reset16_w)
772   AM_RANGE(0x0a0012, 0x0a0013) AM_READ_PORT("DSW2")
773   AM_RANGE(0x0a0014, 0x0a0015) AM_READ_PORT("P4")
774   AM_RANGE(0x0a0018, 0x0a0019) AM_READ_PORT("DSW3")
775775   AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(tmnt_priority_w)
776776   AM_RANGE(0x100000, 0x107fff) AM_READWRITE(K052109_word_noA12_r, K052109_word_noA12_w)
777777//  AM_RANGE(0x10e800, 0x10e801) AM_WRITE(SMH_NOP) ???
r2956r2957
784784   AM_RANGE(0x000000, 0x03ffff) AM_ROM
785785   AM_RANGE(0x080000, 0x083fff) AM_RAM /* main RAM */
786786   AM_RANGE(0x090000, 0x090fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
787   AM_RANGE(0x0a0000, 0x0a0001) AM_READ(input_port_0_word_r)
788   AM_RANGE(0x0a0002, 0x0a0003) AM_READ(input_port_1_word_r)
789   AM_RANGE(0x0a0004, 0x0a0005) AM_READ(input_port_3_word_r)
790   AM_RANGE(0x0a0006, 0x0a0007) AM_READ(input_port_2_word_r)
787   AM_RANGE(0x0a0000, 0x0a0001) AM_READ_PORT("DSW1/DSW2")
788   AM_RANGE(0x0a0002, 0x0a0003) AM_READ_PORT("COINS/DSW3")
789   AM_RANGE(0x0a0004, 0x0a0005) AM_READ_PORT("P3/P4")
790   AM_RANGE(0x0a0006, 0x0a0007) AM_READ_PORT("P1/P2")
791791   AM_RANGE(0x0a0020, 0x0a0021) AM_WRITE(punkshot_0a0020_w)
792792   AM_RANGE(0x0a0040, 0x0a0043) AM_READ(punkshot_sound_r)   /* K053260 */
793793   AM_RANGE(0x0a0040, 0x0a0041) AM_WRITE(K053260_0_lsb_w)
r2956r2957
804804   AM_RANGE(0x000000, 0x03ffff) AM_ROM
805805   AM_RANGE(0x080000, 0x080fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
806806   AM_RANGE(0x090000, 0x093fff) AM_RAM   /*main RAM */
807   AM_RANGE(0x0a0000, 0x0a0001) AM_READ(input_port_0_word_r)
808   AM_RANGE(0x0a0002, 0x0a0003) AM_READ(input_port_1_word_r)
809   AM_RANGE(0x0a0004, 0x0a0005) AM_READ(input_port_2_word_r)
810   AM_RANGE(0x0a0006, 0x0a0007) AM_READ(input_port_3_word_r)
811   AM_RANGE(0x0a0008, 0x0a0009) AM_READ(input_port_4_word_r)
812   AM_RANGE(0x0a0010, 0x0a0011) AM_READ(input_port_5_word_r)
807   AM_RANGE(0x0a0000, 0x0a0001) AM_READ_PORT("COINS")
808   AM_RANGE(0x0a0002, 0x0a0003) AM_READ_PORT("P1")
809   AM_RANGE(0x0a0004, 0x0a0005) AM_READ_PORT("P2")
810   AM_RANGE(0x0a0006, 0x0a0007) AM_READ_PORT("DSW1")
811   AM_RANGE(0x0a0008, 0x0a0009) AM_READ_PORT("DSW2")
812   AM_RANGE(0x0a0010, 0x0a0011) AM_READ_PORT("DSW3")
813813   AM_RANGE(0x0a0018, 0x0a0019) AM_WRITE(lgtnfght_0a0018_w)
814814   AM_RANGE(0x0a0020, 0x0a0023) AM_READ(punkshot_sound_r)   /* K053260 */
815815   AM_RANGE(0x0a0020, 0x0a0021) AM_WRITE(K053260_0_lsb_w)
r2956r2957
835835   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
836836   AM_RANGE(0x500000, 0x50003f) AM_READWRITE(K054000_lsb_r, K054000_lsb_w)
837837   AM_RANGE(0x680000, 0x68001f) AM_READWRITE(K053244_word_noA1_r, K053244_word_noA1_w)
838   AM_RANGE(0x700000, 0x700001) AM_READ(input_port_0_word_r)
839   AM_RANGE(0x700002, 0x700003) AM_READ(input_port_1_word_r)
838   AM_RANGE(0x700000, 0x700001) AM_READ_PORT("P1")
839   AM_RANGE(0x700002, 0x700003) AM_READ_PORT("P2")
840840   AM_RANGE(0x700004, 0x700005) AM_READ(blswhstl_coin_r)
841841   AM_RANGE(0x700006, 0x700007) AM_READ(blswhstl_eeprom_r)
842842   AM_RANGE(0x700200, 0x700201) AM_WRITE(blswhstl_eeprom_w)
r2956r2957
859859   AM_RANGE(0x114000, 0x11401f) AM_READWRITE(K053244_lsb_r, K053244_lsb_w)   /* duplicate! */
860860   AM_RANGE(0x118000, 0x11801f) AM_WRITE(SMH_RAM) AM_BASE(&K053936_0_ctrl)
861861   AM_RANGE(0x11c000, 0x11c01f) AM_WRITE(K053251_msb_w)
862   AM_RANGE(0x120000, 0x120001) AM_READ(input_port_0_word_r)
863   AM_RANGE(0x120002, 0x120003) AM_READ(input_port_1_word_r)
864   AM_RANGE(0x120004, 0x120005) AM_READ(input_port_3_word_r)
865   AM_RANGE(0x120006, 0x120007) AM_READ(input_port_2_word_r)
862   AM_RANGE(0x120000, 0x120001) AM_READ_PORT("P1/P2")
863   AM_RANGE(0x120002, 0x120003) AM_READ_PORT("P3/P4")
864   AM_RANGE(0x120004, 0x120005) AM_READ_PORT("COINS/DSW3")
865   AM_RANGE(0x120006, 0x120007) AM_READ_PORT("DSW1/DSW2")
866866   AM_RANGE(0x121000, 0x121001) AM_READ(glfgreat_ball_r)   /* returns the color of the center pixel of the roz layer */
867867   AM_RANGE(0x122000, 0x122001) AM_WRITE(glfgreat_122000_w)
868868   AM_RANGE(0x124000, 0x124001) AM_WRITE(watchdog_reset16_w)
r2956r2957
11301130   AM_RANGE(0x104000, 0x107fff) AM_RAM AM_BASE(&sunset_104000)   /* main RAM */
11311131   AM_RANGE(0x140000, 0x140fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
11321132   AM_RANGE(0x180000, 0x183fff) AM_RAM_WRITE(K053245_scattered_word_w) AM_BASE(&spriteram16)   // K053245_scattered_word_r
1133   AM_RANGE(0x1c0000, 0x1c0001) AM_READ(input_port_0_word_r)
1134   AM_RANGE(0x1c0002, 0x1c0003) AM_READ(input_port_1_word_r)
1135   AM_RANGE(0x1c0004, 0x1c0005) AM_READ(input_port_4_word_r)
1136   AM_RANGE(0x1c0006, 0x1c0007) AM_READ(input_port_5_word_r)
1137   AM_RANGE(0x1c0100, 0x1c0101) AM_READ(input_port_2_word_r)
1133   AM_RANGE(0x1c0000, 0x1c0001) AM_READ_PORT("P1")
1134   AM_RANGE(0x1c0002, 0x1c0003) AM_READ_PORT("P2")
1135   AM_RANGE(0x1c0004, 0x1c0005) AM_READ_PORT("P3")
1136   AM_RANGE(0x1c0006, 0x1c0007) AM_READ_PORT("P4")
1137   AM_RANGE(0x1c0100, 0x1c0101) AM_READ_PORT("COINS")
11381138   AM_RANGE(0x1c0102, 0x1c0103) AM_READ(ssriders_eeprom_r)
11391139   AM_RANGE(0x1c0200, 0x1c0201) AM_WRITE(ssriders_eeprom_w)   /* EEPROM and gfx control */
11401140   AM_RANGE(0x1c0300, 0x1c0301) AM_WRITE(ssriders_1c0300_w)
r2956r2957
11561156   AM_RANGE(0x104000, 0x107fff) AM_RAM   /* main RAM */
11571157   AM_RANGE(0x140000, 0x140fff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
11581158   AM_RANGE(0x180000, 0x183fff) AM_READWRITE(K053245_scattered_word_r, K053245_scattered_word_w) AM_BASE(&spriteram16)
1159   AM_RANGE(0x1c0000, 0x1c0001) AM_READ(input_port_0_word_r)
1160   AM_RANGE(0x1c0002, 0x1c0003) AM_READ(input_port_1_word_r)
1161   AM_RANGE(0x1c0004, 0x1c0005) AM_READ(input_port_4_word_r)
1162   AM_RANGE(0x1c0006, 0x1c0007) AM_READ(input_port_5_word_r)
1163   AM_RANGE(0x1c0100, 0x1c0101) AM_READ(input_port_2_word_r)
1159   AM_RANGE(0x1c0000, 0x1c0001) AM_READ_PORT("P1")
1160   AM_RANGE(0x1c0002, 0x1c0003) AM_READ_PORT("P2")
1161   AM_RANGE(0x1c0004, 0x1c0005) AM_READ_PORT("P3")
1162   AM_RANGE(0x1c0006, 0x1c0007) AM_READ_PORT("P4")
1163   AM_RANGE(0x1c0100, 0x1c0101) AM_READ_PORT("COINS")
11641164   AM_RANGE(0x1c0102, 0x1c0103) AM_READ(ssriders_eeprom_r)
11651165   AM_RANGE(0x1c0200, 0x1c0201) AM_WRITE(ssriders_eeprom_w)   /* EEPROM and gfx control */
11661166   AM_RANGE(0x1c0300, 0x1c0301) AM_WRITE(ssriders_1c0300_w)
r2956r2957
11911191   AM_RANGE(0x604020, 0x60402f) AM_WRITE(SMH_NOP)   /* written every frame */
11921192   AM_RANGE(0x604200, 0x604201) AM_WRITE(SMH_NOP)   /* watchdog */
11931193   AM_RANGE(0x6119e2, 0x6119e3) AM_WRITE(SMH_NOP)   /* written a lot in some test menus (PC=18204) */
1194   AM_RANGE(0xc00000, 0xc00001) AM_READ(input_port_0_word_r)
1195   AM_RANGE(0xc00002, 0xc00003) AM_READ(input_port_1_word_r)
1196   AM_RANGE(0xc00004, 0xc00005) AM_READ(input_port_4_word_r)
1197   AM_RANGE(0xc00006, 0xc00007) AM_READ(input_port_5_word_r)
1194   AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("P1")
1195   AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("P2")
1196   AM_RANGE(0xc00004, 0xc00005) AM_READ_PORT("P3")
1197   AM_RANGE(0xc00006, 0xc00007) AM_READ_PORT("P4")
11981198   AM_RANGE(0xc00200, 0xc00201) AM_WRITE(ssriders_eeprom_w)   /* EEPROM and gfx control */
1199   AM_RANGE(0xc00404, 0xc00405) AM_READ(input_port_2_word_r)
1199   AM_RANGE(0xc00404, 0xc00405) AM_READ_PORT("COINS")
12001200   AM_RANGE(0xc00406, 0xc00407) AM_READ(sunsetbl_eeprom_r)
12011201   AM_RANGE(0xc00600, 0xc00601) AM_READWRITE(OKIM6295_status_0_lsb_r, OKIM6295_data_0_lsb_w)
12021202   AM_RANGE(0x75d288, 0x75d289) AM_READ(SMH_NOP)   // read repeatedly in some test menus (PC=181f2)
r2956r2957
13371337   PORT_BIT(  0x8000, IP_ACTIVE_LOW, start )
13381338
13391339static INPUT_PORTS_START( cuebrick )
1340   PORT_START      /* COINS */
1340   PORT_START_TAG("COINS")   /* COINS */
13411341   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
13421342   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
13431343   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
13471347   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
13481348   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
13491349
1350   PORT_START      /* PLAYER 1 */
1350   PORT_START_TAG("P1")   /* PLAYER 1 */
13511351   KONAMI_PLAYERS_INPUT_LSB( 1, IPT_BUTTON3, IPT_UNUSED )
13521352
1353   PORT_START      /* PLAYER 2 */
1353   PORT_START_TAG("P2")   /* PLAYER 2 */
13541354   KONAMI_PLAYERS_INPUT_LSB( 2, IPT_BUTTON3, IPT_UNUSED )
13551355
1356   PORT_START   /* DSW1 */
1356   PORT_START_TAG("DSW1")   /* DSW1 */
13571357   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
13581358   PORT_DIPSETTING(    0x03, "2" )
13591359   PORT_DIPSETTING(    0x02, "3" )
r2956r2957
13741374   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
13751375   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
13761376
1377   PORT_START   /* DSW2 */
1377   PORT_START_TAG("DSW2")   /* DSW2 */
13781378   PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
13791379   PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
13801380   PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
r2956r2957
14101410   PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
14111411//  PORT_DIPSETTING(    0x00, "Invalid" )
14121412
1413   PORT_START   /* DSW3 */
1413   PORT_START_TAG("DSW3")   /* DSW3 */
14141414   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
14151415   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
14161416   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
14221422INPUT_PORTS_END
14231423
14241424static INPUT_PORTS_START( mia )
1425   PORT_START      /* COINS */
1425   PORT_START_TAG("COINS")   /* COINS */
14261426   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
14271427   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
14281428   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
14321432   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
14331433   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
14341434
1435   PORT_START      /* PLAYER 1 */
1435   PORT_START_TAG("P1")   /* PLAYER 1 */
14361436   KONAMI_PLAYERS_INPUT_LSB( 1, IPT_BUTTON3, IPT_UNUSED )
14371437
1438   PORT_START      /* PLAYER 2 */
1438   PORT_START_TAG("P2")   /* PLAYER 2 */
14391439   KONAMI_PLAYERS_INPUT_LSB( 2, IPT_BUTTON3, IPT_UNUSED )
14401440
1441   PORT_START   /* DSW1 */
1441   PORT_START_TAG("DSW1")   /* DSW1 */
14421442   PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
14431443   PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
14441444   PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
r2956r2957
14741474   PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
14751475//  PORT_DIPSETTING(    0x00, "Invalid" )
14761476
1477   PORT_START   /* DSW2 */
1477   PORT_START_TAG("DSW2")   /* DSW2 */
14781478   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
14791479   PORT_DIPSETTING(    0x03, "2" )
14801480   PORT_DIPSETTING(    0x02, "3" )
r2956r2957
14951495   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
14961496   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
14971497
1498   PORT_START   /* DSW3 */
1498   PORT_START_TAG("DSW3")   /* DSW3 */
14991499   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
15001500   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
15011501   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
15071507INPUT_PORTS_END
15081508
15091509static INPUT_PORTS_START( tmnt )
1510   PORT_START      /* COINS */
1510   PORT_START_TAG("COINS")   /* COINS */
15111511   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
15121512   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
15131513   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
r2956r2957
15171517   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 )
15181518   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE4 )
15191519
1520   PORT_START      /* PLAYER 1 */
1520   PORT_START_TAG("P1")   /* PLAYER 1 */
15211521   KONAMI_PLAYERS_INPUT_LSB( 1, IPT_UNKNOWN, IPT_UNKNOWN )
15221522
1523   PORT_START      /* PLAYER 2 */
1523   PORT_START_TAG("P2")   /* PLAYER 2 */
15241524   KONAMI_PLAYERS_INPUT_LSB( 2, IPT_UNKNOWN, IPT_UNKNOWN )
15251525
1526   PORT_START      /* PLAYER 3 */
1526   PORT_START_TAG("P3")   /* PLAYER 3 */
15271527   KONAMI_PLAYERS_INPUT_LSB( 3, IPT_UNKNOWN, IPT_UNKNOWN )
15281528
1529   PORT_START   /* DSW1 */
1529   PORT_START_TAG("DSW1")   /* DSW1 */
15301530   PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coinage ) )
15311531   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
15321532   PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
r2956r2957
15451545   PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
15461546   PORT_DIPSETTING(    0x09, DEF_STR( 1C_7C ) )
15471547
1548   PORT_START   /* DSW2 */
1548   PORT_START_TAG("DSW2")   /* DSW2 */
15491549   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
15501550   PORT_DIPSETTING(    0x03, "1" )
15511551   PORT_DIPSETTING(    0x02, "2" )
r2956r2957
15691569   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
15701570   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
15711571
1572   PORT_START      /* PLAYER 4 */
1572   PORT_START_TAG("P4")   /* PLAYER 4 */
15731573   KONAMI_PLAYERS_INPUT_LSB( 4, IPT_UNKNOWN, IPT_UNKNOWN )
15741574
1575   PORT_START   /* DSW3 */
1575   PORT_START_TAG("DSW3")   /* DSW3 */
15761576   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
15771577   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
15781578   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
15871587INPUT_PORTS_END
15881588
15891589static INPUT_PORTS_START( tmnt2p )
1590   PORT_START      /* COINS */
1590   PORT_START_TAG("COINS")   /* COINS */
15911591   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
15921592   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
15931593   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
15971597   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
15981598   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
15991599
1600   PORT_START      /* PLAYER 1 */
1600   PORT_START_TAG("P1")   /* PLAYER 1 */
16011601   KONAMI_PLAYERS_INPUT_LSB( 1, IPT_UNKNOWN, IPT_START1 )
16021602
1603   PORT_START      /* PLAYER 2 */
1603   PORT_START_TAG("P2")   /* PLAYER 2 */
16041604   KONAMI_PLAYERS_INPUT_LSB( 2, IPT_UNKNOWN, IPT_START2 )
16051605
1606   PORT_START      /* PLAYER 3 */
1607//  KONAMI_PLAYERS_INPUT_LSB( 3, IPT_UNKNOWN, IPT_START3 )
1606   PORT_START_TAG("P3")   /* PLAYER 3 */
1607   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
16081608
1609   PORT_START   /* DSW1 */
1609   PORT_START_TAG("DSW1")   /* DSW1 */
16101610   PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
16111611   PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
16121612   PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
r2956r2957
16421642   PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
16431643//  PORT_DIPSETTING(    0x00, "Invalid" )
16441644
1645   PORT_START   /* DSW2 */
1645   PORT_START_TAG("DSW2")   /* DSW2 */
16461646   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
16471647   PORT_DIPSETTING(    0x03, "1" )
16481648   PORT_DIPSETTING(    0x02, "2" )
r2956r2957
16661666   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
16671667   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
16681668
1669   PORT_START      /* PLAYER 4 */
1670//  KONAMI_PLAYERS_INPUT_LSB( 4, IPT_UNKNOWN, IPT_START4 )
1669   PORT_START_TAG("P4")   /* PLAYER 4 */
1670   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
16711671
1672   PORT_START   /* DSW3 */
1672   PORT_START_TAG("DSW3")   /* DSW3 */
16731673   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
16741674   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
16751675   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
16841684INPUT_PORTS_END
16851685
16861686static INPUT_PORTS_START( punkshot )
1687   PORT_START   /* DSW1/DSW2 */
1687   PORT_START_TAG("DSW1/DSW2")   /* DSW1/DSW2 */
16881688   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coinage ) )
16891689   PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
16901690   PORT_DIPSETTING(      0x0002, DEF_STR( 4C_1C ) )
r2956r2957
17361736   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
17371737   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
17381738
1739   PORT_START   /* COIN/DSW3 */
1739   PORT_START_TAG("COINS/DSW3")   /* COIN/DSW3 */
17401740   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
17411741   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
17421742   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 )
r2956r2957
17601760   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
17611761   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
17621762
1763   PORT_START   /* IN0/IN1 */
1763   PORT_START_TAG("P1/P2")   /* IN0/IN1 */
17641764   KONAMI_PLAYERS_INPUT_LSB( 1, IPT_UNKNOWN, IPT_UNKNOWN )
17651765   KONAMI_PLAYERS_INPUT_MSB( 2, IPT_UNKNOWN, IPT_UNKNOWN )
17661766
1767   PORT_START   /* IN2/IN3 */
1767   PORT_START_TAG("P3/P4")   /* IN2/IN3 */
17681768   KONAMI_PLAYERS_INPUT_LSB( 3, IPT_UNKNOWN, IPT_UNKNOWN )
17691769   KONAMI_PLAYERS_INPUT_MSB( 4, IPT_UNKNOWN, IPT_UNKNOWN )
17701770INPUT_PORTS_END
17711771
17721772static INPUT_PORTS_START( punksht2 )
1773   PORT_START   /* DSW1/DSW2 */
1773   PORT_START_TAG("DSW1/DSW2")   /* DSW1/DSW2 */
17741774   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coinage ) )
17751775   PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
17761776   PORT_DIPSETTING(      0x0002, DEF_STR( 4C_1C ) )
r2956r2957
18221822   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
18231823   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
18241824
1825   PORT_START   /* COIN/DSW3 */
1825   PORT_START_TAG("COINS/DSW3")   /* COIN/DSW3 */
18261826   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
18271827   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
18281828   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
18461846   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
18471847   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
18481848
1849   PORT_START   /* IN0/IN1 */
1849   PORT_START_TAG("P1/P2")   /* IN0/IN1 */
18501850   KONAMI_PLAYERS_INPUT_LSB( 1, IPT_UNKNOWN, IPT_UNKNOWN )
18511851   KONAMI_PLAYERS_INPUT_MSB( 2, IPT_UNKNOWN, IPT_UNKNOWN )
1852
1853   PORT_START_TAG("P3/P4")   /* IN2/IN3 */
1854   PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED )
18521855INPUT_PORTS_END
18531856
18541857static INPUT_PORTS_START( lgtnfght )
1855   PORT_START
1858   PORT_START_TAG("COINS")
18561859   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
18571860   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
18581861   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )   /* vblank? checked during boot */
r2956r2957
18621865   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
18631866   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
18641867
1865   PORT_START
1868   PORT_START_TAG("P1")
18661869   KONAMI_PLAYERS_INPUT_LSB( 1, IPT_BUTTON3, IPT_UNKNOWN )
18671870
1868   PORT_START
1871   PORT_START_TAG("P2")
18691872   KONAMI_PLAYERS_INPUT_LSB( 2, IPT_BUTTON3, IPT_UNKNOWN )
18701873
1871   PORT_START   /* DSW1 */
1874   PORT_START_TAG("DSW1")   /* DSW1 */
18721875   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
18731876   PORT_DIPSETTING(    0x03, "2" )
18741877   PORT_DIPSETTING(    0x02, "3" )
r2956r2957
18911894   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
18921895   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
18931896
1894   PORT_START   /* DSW2 */
1897   PORT_START_TAG("DSW2")   /* DSW2 */
18951898   PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) )
18961899   PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
18971900   PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
r2956r2957
19271930   PORT_DIPSETTING(    0x90, DEF_STR( 1C_7C ) )
19281931//  PORT_DIPSETTING(    0x00, "Invalid" )
19291932
1930   PORT_START   /* DSW3 */
1933   PORT_START_TAG("DSW3")   /* DSW3 */
19311934   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
19321935   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
19331936   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
19421945INPUT_PORTS_END
19431946
19441947static INPUT_PORTS_START( blswhstl )
1945   PORT_START   /* IN0 */
1948   PORT_START_TAG("P1")   /* IN0 */
19461949   KONAMI_PLAYERS_INPUT_LSB( 1, IPT_UNKNOWN, IPT_UNKNOWN )
19471950
1948   PORT_START   /* IN1 */
1951   PORT_START_TAG("P2")   /* IN1 */
19491952   KONAMI_PLAYERS_INPUT_LSB( 2, IPT_UNKNOWN, IPT_UNKNOWN )
19501953
1951   PORT_START   /* COIN */
1954   PORT_START_TAG("COINS")   /* COIN */
19521955   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
19531956   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
19541957   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
19581961   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* VBLANK? OBJMPX? */
19591962   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
19601963
1961   PORT_START   /* EEPROM */
1964   PORT_START_TAG("EEPROM")   /* EEPROM */
19621965   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* EEPROM data */
19631966   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL )   /* EEPROM status? - always 1 */
19641967   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
19651968INPUT_PORTS_END
19661969
19671970static INPUT_PORTS_START( glfgreat )
1968   PORT_START   /* IN0 */
1971   PORT_START_TAG("P1/P2")   /* IN0 */
19691972   KONAMI_PLAYERS_INPUT_LSB( 1, IPT_BUTTON3, IPT_BUTTON4 ) PORT_PLAYER(1)
19701973   KONAMI_PLAYERS_INPUT_MSB( 2, IPT_BUTTON3, IPT_BUTTON4 ) PORT_PLAYER(2)
19711974
1972   PORT_START   /* IN1 */
1975   PORT_START_TAG("P3/P4")   /* IN1 */
19731976   KONAMI_PLAYERS_INPUT_LSB( 3, IPT_BUTTON3, IPT_BUTTON4 ) PORT_PLAYER(3)
19741977   KONAMI_PLAYERS_INPUT_MSB( 4, IPT_BUTTON3, IPT_BUTTON4 ) PORT_PLAYER(4)
19751978
1976   PORT_START
1979   PORT_START_TAG("DSW1/DSW2")
19771980   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_A ) )
19781981   PORT_DIPSETTING(      0x0002, DEF_STR( 4C_1C ) )
19791982   PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
r2956r2957
20302033   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
20312034   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
20322035
2033   PORT_START
2036   PORT_START_TAG("COINS/DSW3")
20342037   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
20352038   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
20362039   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_COIN3 )
r2956r2957
20592062INPUT_PORTS_END
20602063
20612064static INPUT_PORTS_START( ssriders )
2062   PORT_START   /* IN0 */
2065   PORT_START_TAG("P1")   /* IN0 */
20632066   KONAMI_PLAYERS_INPUT_LSB( 1, IPT_UNKNOWN, IPT_START1 )
20642067
2065   PORT_START   /* IN1 */
2068   PORT_START_TAG("P2")   /* IN1 */
20662069   KONAMI_PLAYERS_INPUT_LSB( 2, IPT_UNKNOWN, IPT_START2 )
20672070
2068   PORT_START   /* COIN */
2071   PORT_START_TAG("COINS")   /* COIN */
20692072   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
20702073   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
20712074   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
20752078   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
20762079   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
20772080
2078   PORT_START   /* EEPROM and service */
2081   PORT_START_TAG("EEPROM")   /* EEPROM and service */
20792082   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* EEPROM data */
20802083   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL )   /* EEPROM status? - always 1 */
20812084   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* ?? TMNT2: OBJMPX */
r2956r2957
20832086   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* ?? TMNT2: IPL0 */
20842087   PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* unused? */
20852088   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
2089
2090   PORT_START_TAG("P3")   /* IN2 */
2091   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
2092
2093   PORT_START_TAG("P4")   /* IN3 */
2094   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
20862095INPUT_PORTS_END
20872096
20882097static INPUT_PORTS_START( ssridr4p )
2089   PORT_START   /* IN0 */
2098   PORT_START_TAG("P1")   /* IN0 */
20902099   KONAMI_PLAYERS_INPUT_LSB( 1, IPT_UNKNOWN, IPT_UNKNOWN )
20912100
2092   PORT_START   /* IN1 */
2101   PORT_START_TAG("P2")   /* IN1 */
20932102   KONAMI_PLAYERS_INPUT_LSB( 2, IPT_UNKNOWN, IPT_UNKNOWN )
20942103
2095   PORT_START   /* COIN */
2104   PORT_START_TAG("COINS")   /* COIN */
20962105   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
20972106   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
20982107   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
r2956r2957
21022111   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 )
21032112   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE4 )
21042113
2105   PORT_START   /* EEPROM and service */
2114   PORT_START_TAG("EEPROM")   /* EEPROM and service */
21062115   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* EEPROM data */
21072116   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL )   /* EEPROM status? - always 1 */
21082117   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* ?? TMNT2: OBJMPX */
r2956r2957
21112120   PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* unused? */
21122121   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
21132122
2114   PORT_START   /* IN2 */
2123   PORT_START_TAG("P3")   /* IN2 */
21152124   KONAMI_PLAYERS_INPUT_LSB( 3, IPT_UNKNOWN, IPT_UNKNOWN )
21162125
2117   PORT_START   /* IN3 */
2126   PORT_START_TAG("P4")   /* IN3 */
21182127   KONAMI_PLAYERS_INPUT_LSB( 4, IPT_UNKNOWN, IPT_UNKNOWN )
21192128INPUT_PORTS_END
21202129
21212130/* Same as 'ssridr4p', but additional Start button for each player.
21222131   COIN3, COIN4, SERVICE3 and SERVICE4 only have an effect in the "test mode". */
21232132static INPUT_PORTS_START( ssrid4ps )
2124   PORT_START   /* IN0 */
2133   PORT_START_TAG("P1")   /* IN0 */
21252134   KONAMI_PLAYERS_INPUT_LSB( 1, IPT_UNKNOWN, IPT_START1 )
21262135
2127   PORT_START   /* IN1 */
2136   PORT_START_TAG("P2")   /* IN1 */
21282137   KONAMI_PLAYERS_INPUT_LSB( 2, IPT_UNKNOWN, IPT_START2 )
21292138
2130   PORT_START   /* COIN */
2139   PORT_START_TAG("COINS")   /* COIN */
21312140   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
21322141   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
21332142   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
r2956r2957
21372146   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 )
21382147   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE4 )
21392148
2140   PORT_START   /* EEPROM and service */
2149   PORT_START_TAG("EEPROM")   /* EEPROM and service */
21412150   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* EEPROM data */
21422151   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL )   /* EEPROM status? - always 1 */
21432152   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* ?? TMNT2: OBJMPX */
r2956r2957
21462155   PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* unused? */
21472156   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
21482157
2149   PORT_START   /* IN2 */
2158   PORT_START_TAG("P3")   /* IN2 */
21502159   KONAMI_PLAYERS_INPUT_LSB( 3, IPT_UNKNOWN, IPT_START3 )
21512160
2152   PORT_START   /* IN3 */
2161   PORT_START_TAG("P4")   /* IN3 */
21532162   KONAMI_PLAYERS_INPUT_LSB( 4, IPT_UNKNOWN, IPT_START4 )
21542163INPUT_PORTS_END
21552164
21562165/* Version for the bootleg, which has the service switch a little different */
21572166static INPUT_PORTS_START( sunsetbl )
2158   PORT_START   /* IN0 */
2167   PORT_START_TAG("P1")   /* IN0 */
21592168   KONAMI_PLAYERS_INPUT_LSB( 1, IPT_UNKNOWN, IPT_START1 )
21602169
2161   PORT_START   /* IN1 */
2170   PORT_START_TAG("P2")   /* IN1 */
21622171   KONAMI_PLAYERS_INPUT_LSB( 2, IPT_UNKNOWN, IPT_START2 )
21632172
2164   PORT_START   /* COIN */
2173   PORT_START_TAG("COINS")   /* COIN */
21652174   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
21662175   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
21672176   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
r2956r2957
21712180   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 )
21722181   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE4 )
21732182
2174   PORT_START   /* EEPROM and service */
2183   PORT_START_TAG("EEPROM")   /* EEPROM and service */
21752184   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* EEPROM data */
21762185   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL )   /* EEPROM status? - always 1 */
21772186   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
21802189   PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* unused? */
21812190   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
21822191
2183   PORT_START   /* IN2 */
2192   PORT_START_TAG("P3")   /* IN2 */
21842193   KONAMI_PLAYERS_INPUT_LSB( 3, IPT_UNKNOWN, IPT_START3 )
21852194
2186   PORT_START   /* IN3 */
2195   PORT_START_TAG("P4")   /* IN3 */
21872196   KONAMI_PLAYERS_INPUT_LSB( 4, IPT_UNKNOWN, IPT_START4 )
21882197INPUT_PORTS_END
21892198
21902199static INPUT_PORTS_START( qgakumon )
2191   PORT_START   /* IN0 */
2200   PORT_START_TAG("P1")   /* IN0 */
21922201   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)   // Joystick control : Left
21932202   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)   // Joystick control : Right
21942203   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)   // Joystick control : Up
r2956r2957
21982207   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
21992208   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
22002209
2201   PORT_START   /* IN1 */
2210   PORT_START_TAG("P2")   /* IN1 */
22022211   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)   // Joystick control : Left
22032212   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)   // Joystick control : Right
22042213   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)   // Joystick control : Up
r2956r2957
22082217   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
22092218   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
22102219
2211   PORT_START   /* COIN */
2220   PORT_START_TAG("COINS")   /* COIN */
22122221   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
22132222   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
22142223   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
22182227   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
22192228   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
22202229
2221   PORT_START   /* EEPROM and service */
2230   PORT_START_TAG("EEPROM")   /* EEPROM and service */
22222231   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* EEPROM data */
22232232   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL )   /* EEPROM status? - always 1 */
22242233   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* ?? TMNT2: OBJMPX */
r2956r2957
22262235   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* ?? TMNT2: IPL0 */
22272236   PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* unused? */
22282237   PORT_SERVICE_NO_TOGGLE( 0x80, IP_ACTIVE_LOW )
2238
2239   PORT_START_TAG("P3")   /* IN2 */
2240   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
2241
2242   PORT_START_TAG("P4")   /* IN3 */
2243   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
22292244INPUT_PORTS_END
22302245
22312246static INPUT_PORTS_START( thndrx2 )
2232   PORT_START
2247   PORT_START_TAG("P1/COINS")
22332248   KONAMI_PLAYERS_INPUT_LSB( 1, IPT_UNKNOWN, IPT_START1 )
22342249   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 )
22352250   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN2 )
r2956r2957
22402255   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
22412256   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
22422257
2243   PORT_START   /* EEPROM and service */
2258   PORT_START_TAG("P2/EEPROM")   /* EEPROM and service */
22442259   KONAMI_PLAYERS_INPUT_LSB( 2, IPT_UNKNOWN, IPT_START2 )
22452260   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* EEPROM data */
22462261   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SPECIAL )   /* EEPROM status? - always 1 */
r2956r2957
22532268INPUT_PORTS_END
22542269
22552270static INPUT_PORTS_START( prmrsocr )
2256   PORT_START
2271   PORT_START_TAG("P1/COINS")
22572272   KONAMI_PLAYERS_INPUT_LSB( 1, IPT_UNKNOWN, IPT_START1 )
22582273   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_SERVICE1 )
22592274   PORT_SERVICE_NO_TOGGLE( 0x0200, IP_ACTIVE_LOW )
r2956r2957
22722287   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
22732288   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
22742289
2275   PORT_START
2290   PORT_START_TAG("P2/EEPROM")
22762291   KONAMI_PLAYERS_INPUT_LSB( 2, IPT_UNKNOWN, IPT_START2 )
22772292   PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* EEPROM data */
22782293   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SPECIAL )   /* EEPROM status? - always 1 */
src/mame/drivers/namcos12.c
r2956r2957
17511751   ROM_LOAD16_WORD_SWAP( "gls1vera.11s", 0x0000000, 0x080000, CRC(a1e68d02) SHA1(bcacea12531539776d5ad5d34b64f7f4a10a0b97) )
17521752
17531753   ROM_REGION( 0x1000000, REGION_SOUND1, 0 ) /* samples */
1754   ROM_LOAD( "gls1wave0.ic1",         0x0090000, 0x800000, CRC(9de10ef5) SHA1(c391998ed3d882d49d6dbe7079414a2bfd180b49) )
1754   ROM_LOAD( "gls1wave0.ic1",         0x0000000, 0x800000, CRC(9de10ef5) SHA1(c391998ed3d882d49d6dbe7079414a2bfd180b49) )
17551755   ROM_LOAD( "gls1wave1.ic13",        0x0800000, 0x800000, CRC(4c92b6bf) SHA1(a463b5825f635efe402a6ea6c1ed8ecdc3d466e0) )
17561756ROM_END
17571757
src/mame/drivers/system18.c
r2956r2957
7777
7878/***************************************************************************/
7979
80
81
82
8380static WRITE16_HANDLER( sys18_refreshenable_w )
8481{
8582   if(ACCESSING_BITS_0_7)
r2956r2957
486483                  if(io_reg[0x0F] & 0x01)
487484                     return io_reg[0x00];
488485                  else
489                     return input_port_read_indexed(machine, 0);
486                     return input_port_read(machine, "P1");
490487                  break;
491488
492489               case 0x01: /* Port B - 2P controls */
493490                  if(io_reg[0x0F] & 0x02)
494491                     return io_reg[0x01];
495492                  else
496                     return input_port_read_indexed(machine, 1);
493                     return input_port_read(machine, "P2");
497494                  break;
498495
499496               case 0x02: /* Port C - Bidirectional I/O port */
r2956r2957
514511                  if(io_reg[0x0F] & 0x10)
515512                     return io_reg[0x04];
516513                  else
517                     return input_port_read_indexed(machine, 2);
514                     return input_port_read(machine, "SERVICE");
518515                  break;
519516
520517               case 0x05: /* Port F - DIP switch #1 */
521518                  if(io_reg[0x0F] & 0x20)
522519                     return io_reg[0x05];
523520                  else
524                     return input_port_read_indexed(machine, 3);
521                     return input_port_read(machine, "DSW1");
525522                  break;
526523
527524               case 0x06: /* Port G - DIP switch #2 */
528525                  if(io_reg[0x0F] & 0x40)
529526                     return io_reg[0x06];
530527                  else
531                     return input_port_read_indexed(machine, 4);
528                     return input_port_read(machine, "P3");
532529                  break;
533530
534531               case 0x07: /* Port H - Tile banking control */
r2956r2957
641638}
642639
643640
644
645641/***************************************************************************/
646
647
648
649
650
651/***************************************************************************/
652642/*
653643    Shadow Dancer (Bootleg)
654644
r2956r2957
698688   AM_RANGE(0x840000, 0x840fff) AM_READ(SYS16_MRA16_PALETTERAM)
699689   AM_RANGE(0xc00000, 0xc0ffff) AM_READ(vdp_r)
700690   AM_RANGE(0xe40000, 0xe4ffff) AM_READ(sys18_io_r)
701   AM_RANGE(0xc40000, 0xc40001) AM_READ(input_port_3_word_r) // dip1
702   AM_RANGE(0xc40002, 0xc40003) AM_READ(input_port_4_word_r) // dip2
703   AM_RANGE(0xc41002, 0xc41003) AM_READ(input_port_0_word_r) // player1
704   AM_RANGE(0xc41004, 0xc41005) AM_READ(input_port_1_word_r) // player2
705   AM_RANGE(0xc41000, 0xc41001) AM_READ(input_port_2_word_r) // service
691   AM_RANGE(0xc40000, 0xc40001) AM_READ_PORT("COINAGE")
692   AM_RANGE(0xc40002, 0xc40003) AM_READ_PORT("DSW1")
693   AM_RANGE(0xc41002, 0xc41003) AM_READ_PORT("P1")
694   AM_RANGE(0xc41004, 0xc41005) AM_READ_PORT("P2")
695   AM_RANGE(0xc41000, 0xc41001) AM_READ_PORT("SERVICE")
706696   AM_RANGE(0xffc000, 0xffffff) AM_READ(SYS16_MRA16_WORKINGRAM)
707697ADDRESS_MAP_END
708698
r2956r2957
803793   AM_RANGE(0x440000, 0x440fff) AM_READ(SYS16_MRA16_SPRITERAM)
804794   AM_RANGE(0x840000, 0x840fff) AM_READ(SYS16_MRA16_PALETTERAM)
805795   AM_RANGE(0xc00000, 0xc0ffff) AM_READ(vdp_r)
806   AM_RANGE(0xc40000, 0xc40001) AM_READ(input_port_3_word_r) // dip1
807   AM_RANGE(0xc40002, 0xc40003) AM_READ(input_port_4_word_r) // dip2
808   AM_RANGE(0xc41002, 0xc41003) AM_READ(input_port_0_word_r) // player1
809   AM_RANGE(0xc41004, 0xc41005) AM_READ(input_port_1_word_r) // player2
810   AM_RANGE(0xc41006, 0xc41007) AM_READ(input_port_5_word_r) // player3
796   AM_RANGE(0xc40000, 0xc40001) AM_READ_PORT("COINAGE")
797   AM_RANGE(0xc40002, 0xc40003) AM_READ_PORT("DSW1")
798   AM_RANGE(0xc41002, 0xc41003) AM_READ_PORT("P1")
799   AM_RANGE(0xc41004, 0xc41005) AM_READ_PORT("P2")
800   AM_RANGE(0xc41006, 0xc41007) AM_READ_PORT("P3")
811801   AM_RANGE(0xc41008, 0xc41009) AM_READ(SMH_NOP) // figure this out, extra input for 3p?
812   AM_RANGE(0xc41000, 0xc41001) AM_READ(input_port_2_word_r) // service
802   AM_RANGE(0xc41000, 0xc41001) AM_READ_PORT("SERVICE")
813803   AM_RANGE(0xe40000, 0xe4ffff) AM_READ(SYS16_MRA16_EXTRAM2)
814804   AM_RANGE(0xffe02c, 0xffe02d) AM_READ(mwalkbl_skip_r)
815805   AM_RANGE(0xffc000, 0xffffff) AM_READ(SYS16_MRA16_WORKINGRAM)
r2956r2957
925915
926916/***************************************************************************/
927917
928
929
930918/* bootleg doesn't have real vdp or i/o */
931919
932920static ADDRESS_MAP_START( astormbl_readmem, ADDRESS_SPACE_PROGRAM, 16 )
r2956r2957
935923   AM_RANGE(0x110000, 0x110fff) AM_READ(SYS16_MRA16_TEXTRAM)
936924   AM_RANGE(0x140000, 0x140fff) AM_READ(SYS16_MRA16_PALETTERAM)
937925   AM_RANGE(0x200000, 0x200fff) AM_READ(SYS16_MRA16_SPRITERAM)
938   AM_RANGE(0xa00000, 0xa00001) AM_READ(input_port_3_word_r) // dip1
939   AM_RANGE(0xa00002, 0xa00003) AM_READ(input_port_4_word_r) // dip2
940   AM_RANGE(0xa01002, 0xa01003) AM_READ(input_port_0_word_r) // player1
941   AM_RANGE(0xa01004, 0xa01005) AM_READ(input_port_1_word_r) // player2
942   AM_RANGE(0xa01006, 0xa01007) AM_READ(input_port_5_word_r) // player3
943   AM_RANGE(0xa01000, 0xa01001) AM_READ(input_port_2_word_r) // service
926   AM_RANGE(0xa00000, 0xa00001) AM_READ_PORT("COINAGE")
927   AM_RANGE(0xa00002, 0xa00003) AM_READ_PORT("DSW1")
928   AM_RANGE(0xa01002, 0xa01003) AM_READ_PORT("P1")
929   AM_RANGE(0xa01004, 0xa01005) AM_READ_PORT("P2")
930   AM_RANGE(0xa01006, 0xa01007) AM_READ_PORT("P3")
931   AM_RANGE(0xa01000, 0xa01001) AM_READ_PORT("SERVICE")
944932   AM_RANGE(0xc00000, 0xc0ffff) AM_READ(vdp_r)
945933   AM_RANGE(0xffc000, 0xffffff) AM_READ(SYS16_MRA16_WORKINGRAM)
946934ADDRESS_MAP_END
r2956r2957
961949ADDRESS_MAP_END
962950
963951
964
965
966
967952/***************************************************************************/
968953
969
970
971954static void astormbl_update_proc( void ){
972955   UINT16 data;
973956   sys16_fg_scrollx = sys16_textram[0x0e98/2];
r2956r2957
10821065}
10831066
10841067
1085
1086
1087
1088
10891068static DRIVER_INIT( astormbl ){
10901069   UINT8 *RAM= memory_region(machine, REGION_CPU2);
10911070   static const int astormbl_sound_info[] =
r2956r2957
11061085}
11071086
11081087
1109
1110
11111088/*****************************************************************************/
11121089
11131090static MACHINE_DRIVER_START( system18 )
r2956r2957
11561133MACHINE_DRIVER_END
11571134
11581135
1159
11601136static MACHINE_DRIVER_START( astormbl )
11611137
11621138   /* basic machine hardware */
r2956r2957
11681144MACHINE_DRIVER_END
11691145
11701146
1171
1172
11731147static MACHINE_DRIVER_START( mwalkbl )
11741148
11751149   /* basic machine hardware */
r2956r2957
11811155MACHINE_DRIVER_END
11821156
11831157
1184
1185
11861158static MACHINE_DRIVER_START( shdancbl )
11871159
11881160   /* basic machine hardware */
r2956r2957
12071179
12081180/***************************************************************************/
12091181
1210
1211
12121182static INPUT_PORTS_START( astormbl )
1213   PORT_START /* player 1 */
1183   PORT_START_TAG("P1")   /* player 1 */
12141184   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
12151185   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
12161186   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
r2956r2957
12191189   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
12201190   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
12211191   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
1222   PORT_START /* player 2 */
1192
1193   PORT_START_TAG("P2")   /* player 2 */
12231194   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
12241195   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
12251196   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
r2956r2957
12281199   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
12291200   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
12301201   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
1231   PORT_START
1202
1203   PORT_START_TAG("SERVICE")
12321204   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
12331205   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
12341206   PORT_SERVICE_NO_TOGGLE(0x04, IP_ACTIVE_LOW)
r2956r2957
12371209   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
12381210   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START3 )
12391211   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
1240   SYS16_COINAGE
1241   PORT_START   /* DSW1 */
1212
1213   PORT_START_TAG("COINAGE")
1214   PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3,4")
1215   PORT_DIPSETTING(    0x07, DEF_STR( 4C_1C ) )
1216   PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) )
1217   PORT_DIPSETTING(    0x09, DEF_STR( 2C_1C ) )
1218   PORT_DIPSETTING(    0x05, "2 Coins/1 Credit 5/3 6/4" )
1219   PORT_DIPSETTING(    0x04, "2 Coins/1 Credit 4/3" )
1220   PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
1221   PORT_DIPSETTING(    0x01, "1 Coin/1 Credit 2/3" )
1222   PORT_DIPSETTING(    0x02, "1 Coin/1 Credit 4/5" )
1223   PORT_DIPSETTING(    0x03, "1 Coin/1 Credit 5/6" )
1224   PORT_DIPSETTING(    0x06, DEF_STR( 2C_3C ) )
1225   PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
1226   PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
1227   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
1228   PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
1229   PORT_DIPSETTING(    0x0a, DEF_STR( 1C_6C ) )
1230   PORT_DIPSETTING(    0x00, "Free Play (if Coin B too) or 1/1" )
1231   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:5,6,7,8")
1232   PORT_DIPSETTING(    0x70, DEF_STR( 4C_1C ) )
1233   PORT_DIPSETTING(    0x80, DEF_STR( 3C_1C ) )
1234   PORT_DIPSETTING(    0x90, DEF_STR( 2C_1C ) )
1235   PORT_DIPSETTING(    0x50, "2 Coins/1 Credit 5/3 6/4" )
1236   PORT_DIPSETTING(    0x40, "2 Coins/1 Credit 4/3" )
1237   PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
1238   PORT_DIPSETTING(    0x10, "1 Coin/1 Credit 2/3" )
1239   PORT_DIPSETTING(    0x20, "1 Coin/1 Credit 4/5" )
1240   PORT_DIPSETTING(    0x30, "1 Coin/1 Credit 5/6" )
1241   PORT_DIPSETTING(    0x60, DEF_STR( 2C_3C ) )
1242   PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
1243   PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
1244   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
1245   PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
1246   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_6C ) )
1247   PORT_DIPSETTING(    0x00, "Free Play (if Coin A too) or 1/1" )
1248
1249   PORT_START_TAG("DSW1")   /* DSW1 */
12421250   PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" )
12431251   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
12441252   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
12631271   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
12641272   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
12651273   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1266   PORT_START /* player 3 */
1274
1275   PORT_START_TAG("P3")   /* player 3 */
12671276   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
12681277   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
12691278   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
r2956r2957
12751284INPUT_PORTS_END
12761285
12771286static INPUT_PORTS_START( mwalkbl )
1278   PORT_START /* player 1 */
1279   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
1280   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
1281   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
1282   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1283   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
1284   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
1285   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
1286   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
1287   PORT_START /* player 2 */
1288   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1289   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1290   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
1291   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1292   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
1293   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
1294   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
1295   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
1296   PORT_START /* service */
1287   PORT_INCLUDE( astormbl )
1288
1289   PORT_MODIFY("SERVICE")   /* service */
12971290   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1298   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
1299   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )
1300   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
1301   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
1302   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
13031291   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
13041292   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1305   SYS16_COINAGE
1306   PORT_START   /* DSW1 */
1307   PORT_DIPNAME( 0x01, 0x01, "2 Credits to Start" )
1308   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1309   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1310   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
1311   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1312   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1293
1294   PORT_MODIFY("DSW1")   /* DSW1 */
13131295   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Lives ) )
13141296   PORT_DIPSETTING(    0x04, "2" )
13151297   PORT_DIPSETTING(    0x00, "3" )
r2956r2957
13271309   PORT_DIPSETTING(    0xc0, DEF_STR( Normal ) )
13281310   PORT_DIPSETTING(    0x40, DEF_STR( Hard ) )
13291311   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
1330   PORT_START /* player 3 */
1331   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
1332   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
1333   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
1334//  PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1312
1313   PORT_MODIFY("P3")   /* player 3 */
13351314   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START3 )
1336   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
1337   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
1338   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
1339   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
13401315INPUT_PORTS_END
13411316
1342
13431317/*****************************************************************************/
13441318
1345
1346
13471319ROM_START( astormbl )
13481320   ROM_REGION( 0x080000, REGION_CPU1, 0 ) /* 68000 code */
13491321   ROM_LOAD16_BYTE( "astorm.a6", 0x000000, 0x40000, CRC(7682ed3e) SHA1(b857352ad9c66488e91f60989472638c483e4ae8) )
r2956r2957
15741546
15751547GAME( 1990, mwalkbl,  mwalk,    mwalkbl,  mwalkbl,  mwalkbl,  ROT0, "bootleg", "Michael Jackson's Moonwalker (bootleg)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
15761548
1577GAME( 1989, shdancbl, shdancer, shdancbl, mwalkbl, shdancbl, ROT0, "bootleg", "Shadow Dancer (bootleg)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
1578
1549GAME( 1989, shdancbl, shdancer, shdancbl, mwalkbl,  shdancbl, ROT0, "bootleg", "Shadow Dancer (bootleg)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
src/mame/drivers/taitojc.c
r2956r2957
420420      {
421421         if (ACCESSING_BITS_24_31)
422422         {
423            r |= ((input_port_read_indexed(machine, 0) & 0x2) << 2) << 24;
423            r |= ((input_port_read(machine, "COINS") & 0x2) << 2) << 24;
424424         }
425425         return r;
426426      }
r2956r2957
429429         if (ACCESSING_BITS_24_31)
430430         {
431431            UINT32 data = eeprom_read_bit() & 1;
432            data |= input_port_read_indexed(machine, 0) & 0xfe;
432            data |= input_port_read(machine, "COINS") & 0xfe;
433433            r |= data << 24;
434434         }
435435         return r;
r2956r2957
438438      {
439439         if (ACCESSING_BITS_24_31)
440440         {
441            r |= input_port_read_indexed(machine, 1) << 24;
441            r |= input_port_read(machine, "START") << 24;
442442         }
443443         return r;
444444      }
r2956r2957
446446      {
447447         if (ACCESSING_BITS_24_31)
448448         {
449            r |= input_port_read_indexed(machine, 2) << 24;
449            r |= input_port_read(machine, "UNUSED") << 24;
450450         }
451451         return r;
452452      }
r2956r2957
462462      {
463463         if (ACCESSING_BITS_24_31)
464464         {
465            r |= input_port_read_indexed(machine, 3) << 24;
465            r |= input_port_read(machine, "BUTTONS") << 24;
466466         }
467467         return r;
468468      }
r2956r2957
868868
869869static READ8_HANDLER(hc11_analog_r)
870870{
871   return input_port_read_indexed(machine, 4 + offset);
871   static const char *portnames[] = { "ANALOG1", "ANALOG2", "ANALOG3", "ANALOG4",
872                              "ANALOG5", "ANALOG6", "ANALOG7", "ANALOG8" };
873
874   return input_port_read_safe(machine, portnames[offset], 0);
872875}
873876
874877
r2956r2957
10821085
10831086#ifdef UNUSED_DEFINITION
10841087static INPUT_PORTS_START( taitojc )
1085   PORT_START
1086      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_COIN4)
1087      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_COIN3)
1088      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_COIN2)
1089      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_COIN1)
1090      PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 )
1091      //PORT_SERVICE(0x02, 0x00)
1088   PORT_START_TAG("COINS")
1089   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_COIN4)
1090   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_COIN3)
1091   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_COIN2)
1092   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_COIN1)
1093   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 )
1094   //PORT_SERVICE(0x02, 0x00)
10921095
1093   PORT_START
1094      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_START4)
1095      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_START3)
1096      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_START2)
1097      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_START1)
1098      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_SERVICE3)
1099      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_SERVICE2)
1100      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
1101      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_TILT)
1096   PORT_START_TAG("START")
1097   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_START4)
1098   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_START3)
1099   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_START2)
1100   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_START1)
1101   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_SERVICE3)
1102   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_SERVICE2)
1103   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
1104   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_TILT)
11021105
1103   PORT_START
1104      PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
1106   PORT_START_TAG("UNUSED")
1107   PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
11051108
1106   PORT_START
1107      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON1)
1108      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON2)
1109      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON3)
1110      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON4)
1111      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_BUTTON5)
1112      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON6)
1113      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON7)
1114      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON8)
1115
1109   PORT_START_TAG("BUTTONS")
1110   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON1)
1111   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON2)
1112   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON3)
1113   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON4)
1114   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_BUTTON5)
1115   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON6)
1116   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON7)
1117   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON8)
11161118INPUT_PORTS_END
11171119#endif
11181120
11191121static INPUT_PORTS_START( dendeg )
1120   PORT_START
1121      PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
1122      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_COIN1)
1123      PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 )
1122   PORT_START_TAG("COINS")
1123   PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
1124   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_COIN1)
1125   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 )
11241126
1125   PORT_START
1126      PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
1127      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_START1)
1128      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
1129      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_TILT)
1127   PORT_START_TAG("START")
1128   PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
1129   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_START1)
1130   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
1131   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_TILT)
11301132
1131   PORT_START
1132      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON7)       // Horn
1133      PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED)
1133   PORT_START_TAG("UNUSED")
1134   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON7)       // Horn
1135   PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED)
11341136
1135   PORT_START
1136      PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
1137      PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON6)      // Mascon 5
1138      PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON4)      // Mascon 3
1139      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON2)      // Mascon 1
1140      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1141      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON5)      // Mascon 4
1142      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON3)      // Mascon 2
1143      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1)      // Mascon 0
1137   PORT_START_TAG("BUTTONS")
1138   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
1139   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_BUTTON6)      // Mascon 5
1140   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON4)      // Mascon 3
1141   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_BUTTON2)      // Mascon 1
1142   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
1143   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_BUTTON5)      // Mascon 4
1144   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON3)      // Mascon 2
1145   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1)      // Mascon 0
11441146
11451147   PORT_START_TAG("ANALOG1")      // Brake
1146      PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
1147
1148   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
11481149INPUT_PORTS_END
11491150
11501151static INPUT_PORTS_START( landgear )
1151   PORT_START
1152      PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
1153      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_COIN1)
1154      PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 )
1152   PORT_START_TAG("COINS")
1153   PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
1154   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_COIN1)
1155   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 )
11551156
1156   PORT_START
1157      PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
1158      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_START1)
1159      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
1160      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_TILT)
1157   PORT_START_TAG("START")
1158   PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
1159   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_START1)
1160   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
1161   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_TILT)
11611162
1162   PORT_START
1163      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1)      // View button
1164      PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED)
1163   PORT_START_TAG("UNUSED")
1164   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1)      // View button
1165   PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED)
11651166
1166   PORT_START
1167      PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
1167   PORT_START_TAG("BUTTONS")
1168   PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
11681169
11691170   PORT_START_TAG("ANALOG1")      // Lever X
1170      PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0xff, 0x00) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
1171   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0xff, 0x00) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
11711172
11721173   PORT_START_TAG("ANALOG2")      // Lever Y
1173      PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y )  PORT_MINMAX(0xff, 0x00) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
1174   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y )  PORT_MINMAX(0xff, 0x00) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
11741175
11751176   PORT_START_TAG("ANALOG3")      // Throttle
1176      PORT_BIT( 0xff, 0x00, IPT_PEDAL )  PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
1177
1177   PORT_BIT( 0xff, 0x00, IPT_PEDAL )  PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
11781178INPUT_PORTS_END
11791179
11801180static INPUT_PORTS_START( sidebs )
1181   PORT_START
1182      PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
1183      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_COIN1)
1184      PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 )
1181   PORT_START_TAG("COINS")
1182   PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
1183   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_COIN1)
1184   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 )
11851185
1186   PORT_START
1187      PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
1188      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_START1)
1189      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_SERVICE3)
1190      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_SERVICE2)
1191      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
1192      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_TILT)
1186   PORT_START_TAG("START")
1187   PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
1188   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_START1)
1189   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_SERVICE3)
1190   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_SERVICE2)
1191   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
1192   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_TILT)
11931193
1194   PORT_START
1195      PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED)
1196      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1)      // View button
1194   PORT_START_TAG("UNUSED")
1195   PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED)
1196   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1)      // View button
11971197
1198   PORT_START
1199      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON2)      // Shift down
1200      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON3)      // Shift up
1201      PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED)
1198   PORT_START_TAG("BUTTONS")
1199   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON2)      // Shift down
1200   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON3)      // Shift up
1201   PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED)
12021202
12031203   PORT_START_TAG("ANALOG1")      // Steering
1204      PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
1204   PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
12051205
12061206   PORT_START_TAG("ANALOG2")      // Acceleration
1207      PORT_BIT( 0xff, 0x00, IPT_PEDAL )  PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
1207   PORT_BIT( 0xff, 0x00, IPT_PEDAL )  PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
12081208
12091209   PORT_START_TAG("ANALOG3")      // Brake
1210      PORT_BIT( 0xff, 0x00, IPT_PEDAL2 )  PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
1211
1210   PORT_BIT( 0xff, 0x00, IPT_PEDAL2 )  PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
12121211INPUT_PORTS_END
12131212
12141213// TODO
12151214static INPUT_PORTS_START( dangcurv )
1216   PORT_START
1217      PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
1218      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_COIN1)
1219      PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 )
1215   PORT_START_TAG("COINS")
1216   PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
1217   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_COIN1)
1218   PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_SERVICE1 )
12201219
1221   PORT_START
1222      PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
1223      PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_START1)
1224      PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_SERVICE3)
1225      PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_SERVICE2)
1226      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
1227      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_TILT)
1220   PORT_START_TAG("START")
1221   PORT_BIT(0xe0, IP_ACTIVE_LOW, IPT_UNUSED)
1222   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_START1)
1223   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_SERVICE3)
1224   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_SERVICE2)
1225   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
1226   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_TILT)
12281227
1229   PORT_START
1230      PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED)
1231      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1)      // View button
1228   PORT_START_TAG("UNUSED")
1229   PORT_BIT(0xfe, IP_ACTIVE_LOW, IPT_UNUSED)
1230   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON1)      // View button
12321231
1233   PORT_START
1234      PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON2)      // Shift down
1235      PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON3)      // Shift up
1236      PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED)
1232   PORT_START_TAG("BUTTONS")
1233   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_BUTTON2)      // Shift down
1234   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_BUTTON3)      // Shift up
1235   PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED)
12371236
12381237   PORT_START_TAG("ANALOG1")      // Steering
1239      PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
1238   PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
12401239
12411240   PORT_START_TAG("ANALOG2")      // Acceleration
1242      PORT_BIT( 0xff, 0x00, IPT_PEDAL )  PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
1241   PORT_BIT( 0xff, 0x00, IPT_PEDAL )  PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
12431242
12441243   PORT_START_TAG("ANALOG3")      // Brake
1245      PORT_BIT( 0xff, 0x00, IPT_PEDAL2 )  PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
1246
1244   PORT_BIT( 0xff, 0x00, IPT_PEDAL2 )  PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(35) PORT_KEYDELTA(5)
12471245INPUT_PORTS_END
12481246
12491247
src/mame/drivers/tehkanwc.c
r2956r2957
132132{
133133   int joy;
134134
135   joy = input_port_read_indexed(machine, 10) >> (2*offset);
135   joy = input_port_read(machine, "FAKE") >> (2 * offset);
136136   if (joy & 1) return -63;
137137   if (joy & 2) return 63;
138   return input_port_read_indexed(machine, 3 + offset) - track0[offset];
138   return input_port_read(machine, offset ? "P1Y" : "P1X") - track0[offset];
139139}
140140
141141static READ8_HANDLER( tehkanwc_track_1_r )
142142{
143143   int joy;
144144
145   joy = input_port_read_indexed(machine, 10) >> (4+2*offset);
145   joy = input_port_read(machine, "FAKE") >> (4 + 2 * offset);
146146   if (joy & 1) return -63;
147147   if (joy & 2) return 63;
148   return input_port_read_indexed(machine, 6 + offset) - track1[offset];
148   return input_port_read(machine, offset ? "P2Y" : "P2X") - track1[offset];
149149}
150150
151151static WRITE8_HANDLER( tehkanwc_track_0_reset_w )
152152{
153153   /* reset the trackball counters */
154   track0[offset] = input_port_read_indexed(machine, 3 + offset) + data;
154   track0[offset] = input_port_read(machine, offset ? "P1Y" : "P1X") + data;
155155}
156156
157157static WRITE8_HANDLER( tehkanwc_track_1_reset_w )
158158{
159159   /* reset the trackball counters */
160   track1[offset] = input_port_read_indexed(machine, 6 + offset) + data;
160   track1[offset] = input_port_read(machine, offset ? "P2Y" : "P2X") + data;
161161}
162162
163163
r2956r2957
246246   AM_RANGE(0xe800, 0xebff) AM_RAM AM_SHARE(7) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) /* sprites */
247247   AM_RANGE(0xec00, 0xec01) AM_RAM_WRITE(tehkanwc_scroll_x_w)
248248   AM_RANGE(0xec02, 0xec02) AM_RAM_WRITE(tehkanwc_scroll_y_w)
249   AM_RANGE(0xf800, 0xf801) AM_READWRITE(tehkanwc_track_0_r, tehkanwc_track_0_reset_w) /* track 0 x/y */
250   AM_RANGE(0xf802, 0xf802) AM_READWRITE(input_port_9_r, gridiron_led0_w) /* Coin & Start */
251   AM_RANGE(0xf803, 0xf803) AM_READ(input_port_5_r) /* joy0 - button */
252   AM_RANGE(0xf806, 0xf806) AM_READ(input_port_9_r) /* Start */
253   AM_RANGE(0xf810, 0xf811) AM_READWRITE(tehkanwc_track_1_r, tehkanwc_track_1_reset_w) /* track 1 x/y */
249   AM_RANGE(0xf800, 0xf801) AM_READWRITE(tehkanwc_track_0_r, tehkanwc_track_0_reset_w)   /* track 0 x/y */
250   AM_RANGE(0xf802, 0xf802) AM_READWRITE(input_port_9_r, gridiron_led0_w)   /* Coin & Start */
251   AM_RANGE(0xf803, 0xf803) AM_READ_PORT("P1BUT")                     /* joy0 - button */
252   AM_RANGE(0xf806, 0xf806) AM_READ_PORT("SYSTEM")                     /* Start */
253   AM_RANGE(0xf810, 0xf811) AM_READWRITE(tehkanwc_track_1_r, tehkanwc_track_1_reset_w)   /* track 1 x/y */
254254   AM_RANGE(0xf812, 0xf812) AM_WRITE(gridiron_led1_w)
255   AM_RANGE(0xf813, 0xf813) AM_READ(input_port_8_r) /* joy1 - button */
255   AM_RANGE(0xf813, 0xf813) AM_READ_PORT("P2BUT")                     /* joy1 - button */
256256   AM_RANGE(0xf820, 0xf820) AM_READWRITE(soundlatch2_r, sound_command_w)   /* answer from the sound CPU */
257   AM_RANGE(0xf840, 0xf840) AM_READWRITE(input_port_0_r, sub_cpu_halt_w) /* DSW1 */
258   AM_RANGE(0xf850, 0xf850) AM_READWRITE(input_port_1_r, SMH_NOP)   /* DSW2, ?? writes 0x00 or 0xff */
257   AM_RANGE(0xf840, 0xf840) AM_READ_PORT("DSW1") AM_WRITE(sub_cpu_halt_w)   /* DSW1 */
258   AM_RANGE(0xf850, 0xf850) AM_READ_PORT("DSW2") AM_WRITE(SMH_NOP)         /* DSW2, ?? writes 0x00 or 0xff */
259259   AM_RANGE(0xf860, 0xf860) AM_READWRITE(watchdog_reset_r, tehkanwc_flipscreen_x_w)
260   AM_RANGE(0xf870, 0xf870) AM_READWRITE(input_port_2_r, tehkanwc_flipscreen_y_w) /* DSW3 */
260   AM_RANGE(0xf870, 0xf870) AM_READ_PORT("DSW3") AM_WRITE(tehkanwc_flipscreen_y_w)   /* DSW3 */
261261ADDRESS_MAP_END
262262
263263static ADDRESS_MAP_START( sub_mem, ADDRESS_SPACE_PROGRAM, 8 )
r2956r2957
295295
296296
297297static INPUT_PORTS_START( tehkanwc )
298   PORT_START /* DSW1 - Active LOW */
298   PORT_START_TAG("DSW1")   /* DSW1 - Active LOW */
299299   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
300300   PORT_DIPSETTING (   0x01, DEF_STR( 2C_1C ) )
301301   PORT_DIPSETTING (   0x07, DEF_STR( 1C_1C ) )
r2956r2957
320320   PORT_DIPSETTING (   0x40, "2&2/100%" )
321321   PORT_DIPSETTING (   0x00, "2&3/67%" )
322322
323   PORT_START /* DSW2 - Active LOW */
323   PORT_START_TAG("DSW2")   /* DSW2 - Active LOW */
324324   PORT_DIPNAME( 0x03, 0x03, "1P Game Time" )
325325   PORT_DIPSETTING (   0x00, "2:30" )
326326   PORT_DIPSETTING (   0x01, "2:00" )
r2956r2957
363363   PORT_DIPSETTING (   0x80, "Timer In" )
364364   PORT_DIPSETTING (   0x00, "Credit In" )
365365
366   PORT_START /* DSW3 - Active LOW */
366   PORT_START_TAG("DSW3")   /* DSW3 - Active LOW */
367367   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
368368   PORT_DIPSETTING (   0x02, DEF_STR( Easy ) )
369369   PORT_DIPSETTING (   0x03, DEF_STR( Normal ) )
r2956r2957
376376   PORT_DIPSETTING (   0x00, DEF_STR( Off ) )
377377   PORT_DIPSETTING (   0x08, DEF_STR( On ) )
378378
379   PORT_START /* IN0 - X AXIS */
379   PORT_START_TAG("P1X")   /* IN0 - X AXIS */
380380   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
381381
382   PORT_START /* IN0 - Y AXIS */
382   PORT_START_TAG("P1Y")   /* IN0 - Y AXIS */
383383   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
384384
385   PORT_START /* IN0 - BUTTON */
385   PORT_START_TAG("P1BUT")   /* IN0 - BUTTON */
386386   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
387387
388   PORT_START /* IN1 - X AXIS */
388   PORT_START_TAG("P2X")    /* IN1 - X AXIS */
389389   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(2)
390390
391   PORT_START /* IN1 - Y AXIS */
391   PORT_START_TAG("P2Y")   /* IN1 - Y AXIS */
392392   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(2)
393393
394   PORT_START /* IN1 - BUTTON */
394   PORT_START_TAG("P2BUT")   /* IN1 - BUTTON */
395395   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
396396
397   PORT_START /* IN2 - Active LOW */
397   PORT_START_TAG("SYSTEM")   /* IN2 - Active LOW */
398398   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
399399   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
400400   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
401401   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
402402
403   PORT_START   /* fake port to emulate trackballs with keyboard */
403   PORT_START_TAG("FAKE")   /* fake port to emulate trackballs with keyboard */
404404   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
405405   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
406406   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
413413
414414
415415static INPUT_PORTS_START( gridiron )
416   PORT_START /* DSW1 - Active LOW */
416   PORT_START_TAG("DSW1")   /* DSW1 - Active LOW */
417417   PORT_DIPNAME( 0x03, 0x03, "Start Credits (P1&P2)/Extra" )
418418   PORT_DIPSETTING (   0x01, "1&1/200%" )
419419   PORT_DIPSETTING (   0x03, "1&2/100%" )
r2956r2957
439439   PORT_DIPSETTING (   0xc0, "15" )
440440   PORT_DIPSETTING (   0x80, "10" )
441441
442   PORT_START /* DSW2 - Active LOW */
442   PORT_START_TAG("DSW2")   /* DSW2 - Active LOW */
443443   PORT_DIPNAME( 0x03, 0x03, "1P Game Time" )
444444   PORT_DIPSETTING (   0x00, "2:30" )
445445   PORT_DIPSETTING (   0x01, "2:00" )
r2956r2957
482482   PORT_DIPSETTING (   0x00, DEF_STR( Off ) )
483483   PORT_DIPSETTING (   0x80, DEF_STR( On ) )
484484
485   PORT_START /* no DSW3 */
485   PORT_START_TAG("DSW3")   /* no DSW3 */
486486   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED )
487487
488   PORT_START /* IN0 - X AXIS */
488   PORT_START_TAG("P1X")   /* IN0 - X AXIS */
489489   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(63) PORT_PLAYER(1)
490490
491   PORT_START /* IN0 - Y AXIS */
491   PORT_START_TAG("P1Y")   /* IN0 - Y AXIS */
492492   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(63) PORT_PLAYER(1)
493493
494   PORT_START /* IN0 - BUTTON */
494   PORT_START_TAG("P1BUT")   /* IN0 - BUTTON */
495495   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
496496
497   PORT_START /* IN1 - X AXIS */
497   PORT_START_TAG("P2X")   /* IN1 - X AXIS */
498498   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(63) PORT_PLAYER(2)
499499
500   PORT_START /* IN1 - Y AXIS */
500   PORT_START_TAG("P2Y")   /* IN1 - Y AXIS */
501501   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(63) PORT_PLAYER(2)
502502
503   PORT_START /* IN1 - BUTTON */
503   PORT_START_TAG("P2BUT")   /* IN1 - BUTTON */
504504   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
505505
506   PORT_START /* IN2 - Active LOW */
506   PORT_START_TAG("SYSTEM")   /* IN2 - Active LOW */
507507   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
508508   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
509509   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
510510   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
511511
512   PORT_START   /* no fake port here */
512   PORT_START_TAG("FAKE")   /* no fake port here */
513513   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
514514INPUT_PORTS_END
515515
516516
517517static INPUT_PORTS_START( teedoff )
518   PORT_START /* DSW1 - Active LOW */
518   PORT_START_TAG("DSW1")   /* DSW1 - Active LOW */
519519   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
520520   PORT_DIPSETTING (   0x02, DEF_STR( 2C_1C ) )
521521   PORT_DIPSETTING (   0x03, DEF_STR( 1C_1C ) )
r2956r2957
538538   PORT_DIPSETTING (   0x00, DEF_STR( Off ) )
539539   PORT_DIPSETTING (   0x80, DEF_STR( On ) )
540540
541   PORT_START /* DSW2 - Active LOW */
541   PORT_START_TAG("DSW2")   /* DSW2 - Active LOW */
542542   PORT_BIT( 0x07, IP_ACTIVE_LOW, IPT_UNUSED )
543543   PORT_DIPNAME( 0x18, 0x18, "Penalty (Over Par)" )      // Check table at 0x2d67
544544   PORT_DIPSETTING (   0x10, "1/1/2/3/4" )            // +1 / +2 / +3 / +4 / +5 or +6
r2956r2957
554554   PORT_DIPSETTING (   0x40, DEF_STR( Hard ) )
555555   PORT_DIPSETTING (   0x00, DEF_STR( Hardest ) )
556556
557   PORT_START /* no DSW3 */
557   PORT_START_TAG("DSW3")   /* no DSW3 */
558558   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED )
559559
560   PORT_START /* IN0 - X AXIS */
560   PORT_START_TAG("P1X")   /* IN0 - X AXIS */
561561   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(63) PORT_PLAYER(1)
562562
563   PORT_START /* IN0 - Y AXIS */
563   PORT_START_TAG("P1Y")   /* IN0 - Y AXIS */
564564   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(63) PORT_PLAYER(1)
565565
566   PORT_START /* IN0 - BUTTON */
566   PORT_START_TAG("P1BUT")   /* IN0 - BUTTON */
567567   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
568568
569   PORT_START /* IN1 - X AXIS */
569   PORT_START_TAG("P2X")   /* IN1 - X AXIS */
570570   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(63) PORT_PLAYER(2)
571571
572   PORT_START /* IN1 - Y AXIS */
572   PORT_START_TAG("P2Y")   /* IN1 - Y AXIS */
573573   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(63) PORT_PLAYER(2)
574574
575   PORT_START /* IN1 - BUTTON */
575   PORT_START_TAG("P2BUT")   /* IN1 - BUTTON */
576576   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
577577
578   PORT_START /* IN2 - Active LOW */
578   PORT_START_TAG("SYSTEM")   /* IN2 - Active LOW */
579579   /* "Coin"  buttons are read from address 0xf802 */
580580   /* "Start" buttons are read from address 0xf806 */
581581   /* coin input must be active between 2 and 15 frames to be consistently recognized */
r2956r2957
584584   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
585585   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
586586
587   PORT_START   /* no fake port here */
587   PORT_START_TAG("FAKE")   /* no fake port here */
588588   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED )
589589INPUT_PORTS_END
590590
src/mame/drivers/ssingles.c
r2956r2957
147147static READ8_HANDLER(controls_r)
148148{
149149   int data=7;
150   switch(input_port_read_indexed(machine, 1)) //multiplexed
150   switch(input_port_read(machine, "IN1"))      //multiplexed
151151   {
152      case 0x01: data=1; break;
153      case 0x02: data=2; break;
154      case 0x04: data=3; break;
155      case 0x08: data=4; break;
156      case 0x10: data=5; break;
157      case 0x20: data=6; break;
158      case 0x40: data=0; break;
152      case 0x01: data = 1; break;
153      case 0x02: data = 2; break;
154      case 0x04: data = 3; break;
155      case 0x08: data = 4; break;
156      case 0x10: data = 5; break;
157      case 0x20: data = 6; break;
158      case 0x40: data = 0; break;
159159   }
160   return (input_port_read_indexed(machine, 0)&(~0x1c))|(data<<2);
160   return (input_port_read(machine, "IN0") & (~0x1c)) | (data << 2);
161161}
162162
163163static ADDRESS_MAP_START( ssingles_map, ADDRESS_SPACE_PROGRAM, 8 )
r2956r2957
177177   AM_RANGE(0x06, 0x06) AM_WRITE(AY8910_control_port_1_w)
178178   AM_RANGE(0x08, 0x08) AM_READNOP
179179   AM_RANGE(0x0a, 0x0a) AM_WRITE(AY8910_write_port_1_w)
180   AM_RANGE(0x16, 0x16) AM_READ(input_port_2_r)
181   AM_RANGE(0x18, 0x18) AM_READ(input_port_3_r)
180   AM_RANGE(0x16, 0x16) AM_READ_PORT("DSW0")
181   AM_RANGE(0x18, 0x18) AM_READ_PORT("DSW1")
182182   AM_RANGE(0x1c, 0x1c) AM_READ(controls_r)
183183   AM_RANGE(0x1a, 0x1a) AM_WRITENOP //video/crt related
184184   AM_RANGE(0xfe, 0xfe) AM_DEVWRITE(MC6845, "crtc", mc6845_address_w)
r2956r2957
187187ADDRESS_MAP_END
188188
189189static INPUT_PORTS_START( ssingles )
190PORT_START_TAG("IN0")
190   PORT_START_TAG("IN0")
191191   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
192192   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) //must be LOW
193
194193   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON4 )
195194   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 )
196195   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 )
197196
198PORT_START_TAG("IN1")
197   PORT_START_TAG("IN1")
199198   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
200199   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
201200   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
r2956r2957
204203   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START2 )
205204   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 )
206205
207PORT_START_TAG("DSW0")
208PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_A ) )
209   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
210   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
211   PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
212   PORT_DIPSETTING(    0x03, DEF_STR( Free_Play ) )
213PORT_DIPNAME( 0x20, 0x20, DEF_STR( Difficulty ) )
214   PORT_DIPSETTING(    0x20, DEF_STR( Easy ) )
215   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
206   PORT_START_TAG("DSW0")
207   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_A ) )
208   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
209   PORT_DIPSETTING(   0x01, DEF_STR( 1C_2C ) )
210   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
211   PORT_DIPSETTING(   0x03, DEF_STR( Free_Play ) )
212   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Difficulty ) )
213   PORT_DIPSETTING(   0x20, DEF_STR( Easy ) )
214   PORT_DIPSETTING(   0x00, DEF_STR( Hard ) )
215   PORT_DIPNAME( 0x04, 0x04, "Unk1" )
216   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
217   PORT_DIPSETTING(   0x04, DEF_STR( Yes ) )
218   PORT_DIPNAME( 0x08, 0x08, "Unk2" )
219   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
220   PORT_DIPSETTING(   0x08, DEF_STR( Yes ) )
221   PORT_DIPNAME( 0x10, 0x10, "Unk3" )
222   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
223   PORT_DIPSETTING(   0x10, DEF_STR( Yes ) )
224   PORT_DIPNAME( 0x40, 0x40, "Unk4" ) //tested in game, every frame, could be difficulty related
225   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
226   PORT_DIPSETTING(   0x40, DEF_STR( Yes ) )
227   PORT_DIPNAME( 0x80, 0x80, "Unk5" )
228   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
229   PORT_DIPSETTING(   0x80, DEF_STR( Yes ) )
216230
217PORT_DIPNAME( 0x04, 0x04, "Unk1" )
218   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
219   PORT_DIPSETTING(    0x04, DEF_STR( Yes ) )
220PORT_DIPNAME( 0x08, 0x08, "Unk2" )
221   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
222   PORT_DIPSETTING(    0x08, DEF_STR( Yes ) )
223PORT_DIPNAME( 0x10, 0x10, "Unk3" )
224   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
225   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
226
227PORT_DIPNAME( 0x40, 0x40, "Unk4" ) //tested in game, every frame, could be difficulty related
228   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
229   PORT_DIPSETTING(    0x40, DEF_STR( Yes ) )
230PORT_DIPNAME( 0x80, 0x80, "Unk5" )
231   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
232   PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
233
234PORT_START_TAG("DSW1")
235PORT_DIPNAME( 0x03, 0x03, "Unk 6" )
236   PORT_DIPSETTING(    0x01, "Pos 1" )
237   PORT_DIPSETTING(    0x03, "Pos 2" )
238   PORT_DIPSETTING(    0x00, "Pos 3" )
239   PORT_DIPSETTING(    0x02, "Pos 4" )
240PORT_DIPNAME( 0x04, 0x04, "Unk7" )
241   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
242   PORT_DIPSETTING(    0x04, DEF_STR( Yes ) )
243PORT_DIPNAME( 0x08, 0x08, "Unk8" )
244   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
245   PORT_DIPSETTING(    0x08, DEF_STR( Yes ) )
246PORT_DIPNAME( 0x10, 0x10, "Unk9" )
247   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
248   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
249PORT_DIPNAME( 0x20, 0x20, "UnkA" )
250   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
251   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
252PORT_DIPNAME( 0x40, 0x40, "UnkB" )
253   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
254   PORT_DIPSETTING(    0x40, DEF_STR( Yes ) )
255PORT_DIPNAME( 0x80, 0x80, "UnkC" )
256   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
257   PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
231   PORT_START_TAG("DSW1")
232   PORT_DIPNAME( 0x03, 0x03, "Unk 6" )
233   PORT_DIPSETTING(   0x01, "Pos 1" )
234   PORT_DIPSETTING(   0x03, "Pos 2" )
235   PORT_DIPSETTING(   0x00, "Pos 3" )
236   PORT_DIPSETTING(   0x02, "Pos 4" )
237   PORT_DIPNAME( 0x04, 0x04, "Unk7" )
238   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
239   PORT_DIPSETTING(   0x04, DEF_STR( Yes ) )
240   PORT_DIPNAME( 0x08, 0x08, "Unk8" )
241   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
242   PORT_DIPSETTING(   0x08, DEF_STR( Yes ) )
243   PORT_DIPNAME( 0x10, 0x10, "Unk9" )
244   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
245   PORT_DIPSETTING(   0x10, DEF_STR( Yes ) )
246   PORT_DIPNAME( 0x20, 0x20, "UnkA" )
247   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
248   PORT_DIPSETTING(   0x20, DEF_STR( Yes ) )
249   PORT_DIPNAME( 0x40, 0x40, "UnkB" )
250   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
251   PORT_DIPSETTING(   0x40, DEF_STR( Yes ) )
252   PORT_DIPNAME( 0x80, 0x80, "UnkC" )
253   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
254   PORT_DIPSETTING(   0x80, DEF_STR( Yes ) )
258255INPUT_PORTS_END
259256
260257static MACHINE_DRIVER_START( ssingles )
src/mame/drivers/st0016.c
r2956r2957
4444        xxxx - input port #2
4545    xxxx     - dip switches (2x8 bits) (multiplexed)
4646*/
47   int retval=input_port_read_indexed(machine, 2)&0x0f;
48   switch(mux_port&0x30)
47   int retval = input_port_read(machine, "SYSTEM") & 0x0f;
48   switch(mux_port & 0x30)
4949   {
50      case 0x00: retval|=((input_port_read_indexed(machine, 4)&1)<<4)|((input_port_read_indexed(machine, 4)&0x10)<<1)|((input_port_read_indexed(machine, 5)&1)<<6)|((input_port_read_indexed(machine, 5)&0x10)<<3);break;
51      case 0x10: retval|=((input_port_read_indexed(machine, 4)&2)<<3)|((input_port_read_indexed(machine, 4)&0x20)   )|((input_port_read_indexed(machine, 5)&2)<<5)|((input_port_read_indexed(machine, 5)&0x20)<<2);break;
52      case 0x20: retval|=((input_port_read_indexed(machine, 4)&4)<<2)|((input_port_read_indexed(machine, 4)&0x40)>>1)|((input_port_read_indexed(machine, 5)&4)<<4)|((input_port_read_indexed(machine, 5)&0x40)<<1);break;
53      case 0x30: retval|=((input_port_read_indexed(machine, 4)&8)<<1)|((input_port_read_indexed(machine, 4)&0x80)>>2)|((input_port_read_indexed(machine, 5)&8)<<3)|((input_port_read_indexed(machine, 5)&0x80)   );break;
50      case 0x00: retval |= ((input_port_read(machine, "DSW1") & 1) << 4) | ((input_port_read(machine, "DSW1") & 0x10) << 1)
51                        | ((input_port_read(machine, "DSW2") & 1) << 6) | ((input_port_read(machine, "DSW2") & 0x10) <<3); break;
52      case 0x10: retval |= ((input_port_read(machine, "DSW1") & 2) << 3) | ((input_port_read(machine, "DSW1") & 0x20)   )
53                        | ((input_port_read(machine, "DSW2") & 2) << 5) | ((input_port_read(machine, "DSW2") & 0x20) <<2); break;
54      case 0x20: retval |= ((input_port_read(machine, "DSW1") & 4) << 2) | ((input_port_read(machine, "DSW1") & 0x40) >> 1)
55                        | ((input_port_read(machine, "DSW2") & 4) << 4) | ((input_port_read(machine, "DSW2") & 0x40) <<1); break;
56      case 0x30: retval |= ((input_port_read(machine, "DSW1") & 8) << 1) | ((input_port_read(machine, "DSW1") & 0x80) >> 2)
57                        | ((input_port_read(machine, "DSW2") & 8) << 3) | ((input_port_read(machine, "DSW2") & 0x80)    ); break;
5458   }
5559   return retval;
5660}
r2956r2957
7175static ADDRESS_MAP_START( st0016_io, ADDRESS_SPACE_IO, 8 )
7276   ADDRESS_MAP_GLOBAL_MASK(0xff)
7377   AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w) /* video/crt regs ? */
74   AM_RANGE(0xc0, 0xc0) AM_READ(input_port_0_r) AM_WRITE(mux_select_w)
75   AM_RANGE(0xc1, 0xc1) AM_READ(input_port_1_r) AM_WRITENOP
78   AM_RANGE(0xc0, 0xc0) AM_READ_PORT("P1") AM_WRITE(mux_select_w)
79   AM_RANGE(0xc1, 0xc1) AM_READ_PORT("P2") AM_WRITENOP
7680   AM_RANGE(0xc2, 0xc2) AM_READ(mux_r) AM_WRITENOP
77   AM_RANGE(0xc3, 0xc3) AM_READ(input_port_1_r) AM_WRITENOP
81   AM_RANGE(0xc3, 0xc3) AM_READ_PORT("P2") AM_WRITENOP
7882   AM_RANGE(0xe0, 0xe0) AM_WRITENOP /* renju = $40, neratte = 0 */
7983   AM_RANGE(0xe1, 0xe1) AM_WRITE(st0016_rom_bank_w)
8084   AM_RANGE(0xe2, 0xe2) AM_WRITE(st0016_sprite_bank_w)
r2956r2957
135139static ADDRESS_MAP_START( st0016_m2_io, ADDRESS_SPACE_IO, 8 )
136140   ADDRESS_MAP_GLOBAL_MASK(0xff)
137141   AM_RANGE(0x00, 0xbf) AM_READ(st0016_vregs_r) AM_WRITE(st0016_vregs_w)
138   AM_RANGE(0xc0, 0xc3)   AM_READ(latch8_r) AM_WRITE(latch8_w)
139
140   AM_RANGE(0xd0, 0xd0) AM_READ(input_port_0_r) AM_WRITE(mux_select_w)
141   AM_RANGE(0xd1, 0xd1) AM_READ(input_port_1_r) AM_WRITENOP
142   AM_RANGE(0xc0, 0xc3) AM_READ(latch8_r) AM_WRITE(latch8_w)
143   AM_RANGE(0xd0, 0xd0) AM_READ_PORT("P1") AM_WRITE(mux_select_w)
144   AM_RANGE(0xd1, 0xd1) AM_READ_PORT("P2") AM_WRITENOP
142145   AM_RANGE(0xd2, 0xd2) AM_READ(mux_r) AM_WRITENOP
143   AM_RANGE(0xd3, 0xd3) AM_READ(input_port_1_r) AM_WRITENOP
146   AM_RANGE(0xd3, 0xd3) AM_READ_PORT("P2") AM_WRITENOP
144147   AM_RANGE(0xe0, 0xe0) AM_WRITENOP
145148   AM_RANGE(0xe1, 0xe1) AM_WRITE(st0016_rom_bank_w)
146149   AM_RANGE(0xe2, 0xe2) AM_WRITE(st0016_sprite_bank_w)
r2956r2957
157160 *
158161 *************************************/
159162static INPUT_PORTS_START( st0016 )
160   PORT_START_TAG("IN0")
163   PORT_START_TAG("P1")
161164   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
162165   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
163166   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
r2956r2957
167170   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
168171   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
169172
170   PORT_START_TAG("IN1")
173   PORT_START_TAG("P2")
171174   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
172175   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
173176   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
r2956r2957
177180   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
178181   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
179182
180   PORT_START_TAG("IN2")
183   PORT_START_TAG("SYSTEM")
181184   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
182185   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
183186   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
184187   PORT_SERVICE( 0x08, IP_ACTIVE_LOW)
185188
186   PORT_START_TAG("IN3")
189   PORT_START_TAG("UNK")
187190   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* unused ? */
188191
189192   PORT_START_TAG("DSW1")
190193   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
191   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
192   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
194   PORT_DIPSETTING(   0x01, DEF_STR( Off ) )
195   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
193196   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
194   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
195   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
197   PORT_DIPSETTING(   0x02, DEF_STR( Off ) )
198   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
196199   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
197   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
198   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
200   PORT_DIPSETTING(   0x04, DEF_STR( Off ) )
201   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
199202   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
200   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
201   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
203   PORT_DIPSETTING(   0x08, DEF_STR( Off ) )
204   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
202205   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
203   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
204   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
206   PORT_DIPSETTING(   0x10, DEF_STR( Off ) )
207   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
205208   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
206   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
207   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
209   PORT_DIPSETTING(   0x20, DEF_STR( Off ) )
210   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
208211   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
209   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
210   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
212   PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
213   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
211214   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
212   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
213   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
215   PORT_DIPSETTING(   0x80, DEF_STR( Off ) )
216   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
214217
215218   PORT_START_TAG("DSW2")
216219   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
217   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
218   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
220   PORT_DIPSETTING(   0x01, DEF_STR( Off ) )
221   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
219222   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
220   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
221   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
223   PORT_DIPSETTING(   0x02, DEF_STR( Off ) )
224   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
222225   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
223   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
224   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
226   PORT_DIPSETTING(   0x04, DEF_STR( Off ) )
227   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
225228   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
226   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
227   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
229   PORT_DIPSETTING(   0x08, DEF_STR( Off ) )
230   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
228231   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
229   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
230   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
232   PORT_DIPSETTING(   0x10, DEF_STR( Off ) )
233   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
231234   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
232   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
233   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
235   PORT_DIPSETTING(   0x20, DEF_STR( Off ) )
236   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
234237   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
235   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
236   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
238   PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
239   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
237240   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
238   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
239   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
241   PORT_DIPSETTING(   0x80, DEF_STR( Off ) )
242   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
240243INPUT_PORTS_END
241244
242245/*************************************
r2956r2957
248251static INPUT_PORTS_START( renju )
249252   PORT_INCLUDE( st0016 )
250253
251   PORT_MODIFY("IN2")
254   PORT_MODIFY("SYSTEM")
252255   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
253256   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
254257
255258   PORT_MODIFY("DSW1")   /* Dip switch A  */
256259   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
257260   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
258   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
259   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
261   PORT_DIPSETTING(   0x02, DEF_STR( Off ) )
262   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
260263   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
261264   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
262   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
263   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
265   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
266   PORT_DIPSETTING(   0x08, DEF_STR( On ) )
264267   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
265   PORT_DIPSETTING(      0x20, DEF_STR( 2C_1C ) )
266   PORT_DIPSETTING(      0x30, DEF_STR( 1C_1C ) )
267   PORT_DIPSETTING(      0x00, DEF_STR( 2C_3C ) )
268   PORT_DIPSETTING(      0x10, DEF_STR( 1C_2C ) )
268   PORT_DIPSETTING(   0x20, DEF_STR( 2C_1C ) )
269   PORT_DIPSETTING(   0x30, DEF_STR( 1C_1C ) )
270   PORT_DIPSETTING(   0x00, DEF_STR( 2C_3C ) )
271   PORT_DIPSETTING(   0x10, DEF_STR( 1C_2C ) )
269272   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
270   PORT_DIPSETTING(      0x80, DEF_STR( 2C_1C ) )
271   PORT_DIPSETTING(      0xc0, DEF_STR( 1C_1C ) )
272   PORT_DIPSETTING(      0x00, DEF_STR( 2C_3C ) )
273   PORT_DIPSETTING(      0x80, DEF_STR( 1C_2C ) )
273   PORT_DIPSETTING(   0x80, DEF_STR( 2C_1C ) )
274   PORT_DIPSETTING(   0xc0, DEF_STR( 1C_1C ) )
275   PORT_DIPSETTING(   0x00, DEF_STR( 2C_3C ) )
276   PORT_DIPSETTING(   0x80, DEF_STR( 1C_2C ) )
274277
275278   PORT_MODIFY("DSW2")   /* Dip switch B */
276279   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
277   PORT_DIPSETTING(      0x00, DEF_STR( Very_Hard ) )
278   PORT_DIPSETTING(      0x01, DEF_STR( Hard ) )
279   PORT_DIPSETTING(      0x02, DEF_STR( Easy ) )
280   PORT_DIPSETTING(      0x03, DEF_STR( Normal ) )
280   PORT_DIPSETTING(   0x00, DEF_STR( Very_Hard ) )
281   PORT_DIPSETTING(   0x01, DEF_STR( Hard ) )
282   PORT_DIPSETTING(   0x02, DEF_STR( Easy ) )
283   PORT_DIPSETTING(   0x03, DEF_STR( Normal ) )
281284INPUT_PORTS_END
282285
283286static INPUT_PORTS_START( koikois )
284287   PORT_INCLUDE( st0016 )
285288
286
287   PORT_MODIFY("IN0")
289   PORT_MODIFY("P1")
288290   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
289291   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
290292   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
291293
292   PORT_MODIFY("IN2")
294   PORT_MODIFY("SYSTEM")
293295   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
294296   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
295297
296298   PORT_MODIFY("DSW1")   /* Dip switch A  */
297299   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
298300   PORT_DIPNAME( 0x02, 0x02, "Crt Mode" ) //flip screen ?
299   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
300   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
301   PORT_DIPSETTING(   0x02, DEF_STR( Off ) )
302   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
301303   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
302304   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
303   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
304   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
305   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
306   PORT_DIPSETTING(   0x08, DEF_STR( On ) )
305307   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
306   PORT_DIPSETTING(      0x10, DEF_STR( 2C_1C ) )
307   PORT_DIPSETTING(      0x30, DEF_STR( 1C_1C ) )
308   PORT_DIPSETTING(      0x00, DEF_STR( 2C_3C ) )
309   PORT_DIPSETTING(      0x20, DEF_STR( 1C_2C ) )
308   PORT_DIPSETTING(   0x10, DEF_STR( 2C_1C ) )
309   PORT_DIPSETTING(   0x30, DEF_STR( 1C_1C ) )
310   PORT_DIPSETTING(   0x00, DEF_STR( 2C_3C ) )
311   PORT_DIPSETTING(   0x20, DEF_STR( 1C_2C ) )
310312   PORT_DIPNAME( 0x40, 0x40,  DEF_STR( Controls ) )
311   PORT_DIPSETTING(    0x00, "Majyan Panel" )
312   PORT_DIPSETTING(    0x40, DEF_STR( Joystick ) )
313   PORT_DIPSETTING(   0x00, "Majyan Panel" )
314   PORT_DIPSETTING(   0x40, DEF_STR( Joystick ) )
313315
314316   PORT_MODIFY("DSW2")   /* Dip switch B */
315317   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
316   PORT_DIPSETTING(      0x00, DEF_STR( Very_Hard ) )
317   PORT_DIPSETTING(      0x01, DEF_STR( Hard ) )
318   PORT_DIPSETTING(      0x02, DEF_STR( Easy ) )
319   PORT_DIPSETTING(      0x03, DEF_STR( Normal ) )
318   PORT_DIPSETTING(   0x00, DEF_STR( Very_Hard ) )
319   PORT_DIPSETTING(   0x01, DEF_STR( Hard ) )
320   PORT_DIPSETTING(   0x02, DEF_STR( Easy ) )
321   PORT_DIPSETTING(   0x03, DEF_STR( Normal ) )
320322INPUT_PORTS_END
321323
322324static INPUT_PORTS_START( nratechu )
r2956r2957
324326
325327   PORT_MODIFY("DSW1")   /* Dip switch A  */
326328   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
327   PORT_DIPSETTING(      0x01, DEF_STR( 4C_1C ) )
328   PORT_DIPSETTING(      0x02, DEF_STR( 3C_1C ) )
329   PORT_DIPSETTING(      0x03, DEF_STR( 2C_1C ) )
330   PORT_DIPSETTING(      0x07, DEF_STR( 1C_1C ) )
331   PORT_DIPSETTING(      0x06, DEF_STR( 1C_2C ) )
332   PORT_DIPSETTING(      0x05, DEF_STR( 1C_3C ) )
333   PORT_DIPSETTING(      0x04, DEF_STR( 1C_4C ) )
329   PORT_DIPSETTING(   0x01, DEF_STR( 4C_1C ) )
330   PORT_DIPSETTING(   0x02, DEF_STR( 3C_1C ) )
331   PORT_DIPSETTING(   0x03, DEF_STR( 2C_1C ) )
332   PORT_DIPSETTING(   0x07, DEF_STR( 1C_1C ) )
333   PORT_DIPSETTING(   0x06, DEF_STR( 1C_2C ) )
334   PORT_DIPSETTING(   0x05, DEF_STR( 1C_3C ) )
335   PORT_DIPSETTING(   0x04, DEF_STR( 1C_4C ) )
334336   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Language ) )
335   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
336   PORT_DIPSETTING(    0x80, DEF_STR( Japanese ) )
337   PORT_DIPSETTING(   0x00, DEF_STR( English ) )
338   PORT_DIPSETTING(   0x80, DEF_STR( Japanese ) )
337339
338340   PORT_MODIFY("DSW2")   /* Dip switch B */
339341   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) //  speed / time..
340   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
341   PORT_DIPSETTING(    0x03, DEF_STR( Normal ))
342   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )
343   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
342   PORT_DIPSETTING(   0x02, DEF_STR( Easy ) )
343   PORT_DIPSETTING(   0x03, DEF_STR( Normal ))
344   PORT_DIPSETTING(   0x01, DEF_STR( Hard ) )
345   PORT_DIPSETTING(   0x00, DEF_STR( Hardest ) )
344346   PORT_DIPNAME( 0x0C, 0x0C, "VS Round" )
345   PORT_DIPSETTING(    0x00, "1" )
346   PORT_DIPSETTING(    0x0C, "2" )
347   PORT_DIPSETTING(    0x08, "3" )
348   PORT_DIPSETTING(    0x04, "4" )
347   PORT_DIPSETTING(   0x00, "1" )
348   PORT_DIPSETTING(   0x0C, "2" )
349   PORT_DIPSETTING(   0x08, "3" )
350   PORT_DIPSETTING(   0x04, "4" )
349351   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) )
350   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
351   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
352   PORT_DIPSETTING(   0x20, DEF_STR( Off ) )
353   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
352354   PORT_DIPNAME( 0x80, 0x80, "Test Mode" )
353   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
354   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
355   PORT_DIPSETTING(   0x80, DEF_STR( Off ) )
356   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
355357INPUT_PORTS_END
356358
357359static INPUT_PORTS_START( mayjisn2 )
r2956r2957
359361
360362   PORT_MODIFY("DSW1")   /* Dip switch A  */
361363   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
362   PORT_DIPSETTING(      0x01, DEF_STR( 4C_1C ) )
363   PORT_DIPSETTING(      0x02, DEF_STR( 3C_1C ) )
364   PORT_DIPSETTING(      0x03, DEF_STR( 2C_1C ) )
365   PORT_DIPSETTING(      0x07, DEF_STR( 1C_1C ) )
366   PORT_DIPSETTING(      0x06, DEF_STR( 1C_2C ) )
367   PORT_DIPSETTING(      0x05, DEF_STR( 1C_3C ) )
368   PORT_DIPSETTING(      0x04, DEF_STR( 1C_4C ) )
364   PORT_DIPSETTING(   0x01, DEF_STR( 4C_1C ) )
365   PORT_DIPSETTING(   0x02, DEF_STR( 3C_1C ) )
366   PORT_DIPSETTING(   0x03, DEF_STR( 2C_1C ) )
367   PORT_DIPSETTING(   0x07, DEF_STR( 1C_1C ) )
368   PORT_DIPSETTING(   0x06, DEF_STR( 1C_2C ) )
369   PORT_DIPSETTING(   0x05, DEF_STR( 1C_3C ) )
370   PORT_DIPSETTING(   0x04, DEF_STR( 1C_4C ) )
369371   PORT_DIPNAME( 0x18, 0x18, "Timer" )
370   PORT_DIPSETTING(    0x00, "6:00" )
371   PORT_DIPSETTING(    0x08, "5:00" )
372   PORT_DIPSETTING(    0x18, "4:00" )
373   PORT_DIPSETTING(    0x10, "3:00" )
372   PORT_DIPSETTING(   0x00, "6:00" )
373   PORT_DIPSETTING(   0x08, "5:00" )
374   PORT_DIPSETTING(   0x18, "4:00" )
375   PORT_DIPSETTING(   0x10, "3:00" )
374376
375377   PORT_MODIFY("DSW2")   /* Dip switch B */
376378   PORT_DIPNAME( 0x18, 0x18, "Music in Game"  )
377   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
378   PORT_DIPSETTING(    0x08, "Remixed" )
379   PORT_DIPSETTING(    0x18, "Only Intro" )
380   PORT_DIPSETTING(    0x10, "Classic" )
379   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
380   PORT_DIPSETTING(   0x08, "Remixed" )
381   PORT_DIPSETTING(   0x18, "Only Intro" )
382   PORT_DIPSETTING(   0x10, "Classic" )
381383   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) )
382   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
383   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
384   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
385   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
384386   PORT_DIPNAME( 0x40, 0x40, "Position of Title" )
385   PORT_DIPSETTING(    0x00, "B" )
386   PORT_DIPSETTING(    0x40, "A" )
387   PORT_DIPSETTING(   0x00, "B" )
388   PORT_DIPSETTING(   0x40, "A" )
387389   PORT_DIPNAME( 0x80, 0x80, "Test mode" )
388   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
389   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
390   PORT_DIPSETTING(   0x80, DEF_STR( Off ) )
391   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
390392INPUT_PORTS_END
391393
392394static GFXDECODE_START( st0016 )
src/mame/drivers/cps3.c
r2956r2957
726726#endif
727727}
728728
729
730
731
732729static DRIVER_INIT( cps3crpt )
733730{
734731   const char *gamename = machine->gamedrv->name;
735732   const struct game_keys2 *k = &keys_table2[0];
736733   int i;
737734
735   // set strict verify
736   cpunum_set_info_int(0, CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_STRICT_VERIFY);
737
738738   cps3_key1 = -1;
739739   cps3_key2 = -1;
740740   cps3_isSpecial = -1;
r2956r2957
15781578static const struct cps3_test_hacks testhack_table[] =
15791579{
15801580   // name        mainram address  code address
1581   { "jojo",      0x0011c2c,         0x6172568  },
1582   { "jojon",     0x0011c2c,         0x6172568  },
1583   { "jojoalt",   0x0011c2c,         0x6172798  },
1584   { "jojoaltn",  0x0011c2c,         0x6172798  },
1585   { "jojoba",    0x0011c90,         0x61c45bc  },
1586   { "jojoban",   0x0011c90,         0x61c45bc  },
1587   { "jojobane",  0x0011c90,         0x61c45bc  },
1588   { "sfiii",     0x00166b4,         0x63cdff4  },
1589   { "sfiiiu",    0x00166b4,         0x63cdff4  },
1590   { "sfiiin",    0x00166b4,         0x63cdff4  },
1581   { "jojo",      0x0011c2a,         0x6172566  },
1582   { "jojon",     0x0011c2a,         0x6172566  },
1583   { "jojoalt",   0x0011c2a,         0x6172796  },
1584   { "jojoaltn",  0x0011c2a,         0x6172796  },
1585   { "jojoba",    0x0011c8e,         0x61c45ba  },
1586   { "jojoban",   0x0011c8e,         0x61c45ba  },
1587   { "jojobane",  0x0011c8e,         0x61c45ba  },
1588   { "sfiii",     0x00166b2,         0x63cdff2  },
1589   { "sfiiiu",    0x00166b2,         0x63cdff2  },
1590   { "sfiiin",    0x00166b2,         0x63cdff2  },
15911591   { "sfiii2",    0,                 0          },
15921592   { "sfiii2u",   0,                 0          },
15931593   { "sfiii2n",   0,                 0          },
1594   { "sfiii3",    0x0011c44,         0x613a9fc  },
1595   { "sfiii3n",   0x0011c44,         0x613a9fc  },
1596   { "sfiii3a",   0x0011c44,         0x613ab48  },
1597   { "sfiii3an",  0x0011c44,         0x613ab48  },
1598   { "warzard",   0x0016530,         0x60105f0  },
1599   { "redearth",  0x0016530,         0x60105f0  },
1594   { "sfiii3",    0x0011c42,         0x613a9fa  },
1595   { "sfiii3n",   0x0011c42,         0x613a9fa  },
1596   { "sfiii3a",   0x0011c42,         0x613ab46  },
1597   { "sfiii3an",  0x0011c42,         0x613ab46  },
1598   { "warzard",   0x001652e,         0x60105ee  },
1599   { "redearth",  0x001652e,         0x60105ee  },
16001600   { 0 }   // end of table
16011601};
16021602
r2956r2957
16141614      {
16151615         cps3_bios_test_hack = k->bios_test_hack;
16161616         cps3_game_test_hack = k->game_test_hack;
1617
1618         cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
1619         cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, cps3_bios_test_hack);
1620         cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 2);
1621         cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, cps3_game_test_hack);
1622
16171623         break;
16181624      }
16191625      ++k;
r2956r2957
29802986static const struct cps3_speedups speedup_table[] =
29812987{
29822988   // name        mainram address  code address
2983   { "jojo",      0x223c0,         0x600065c  },
2984   { "jojon",     0x223c0,         0x600065c  },
2985   { "jojoalt",   0x223d8,         0x600065c  },
2986   { "jojoaltn",  0x223d8,         0x600065c  },
2987   { "jojoba",    0x267dc,         0x600065c  },
2988   { "jojoban",   0x267dc,         0x600065c  },
2989   { "jojobane",  0x267dc,         0x600065c  },
2990   { "sfiii",     0x0cc6c,         0x6000884  },
2991   { "sfiiiu",    0x0cc6c,         0x6000884  },
2992   { "sfiiin",    0x0cc6c,         0x6000884  },
2993   { "sfiii2",    0x0dfe4,         0x6000884  },
2994   { "sfiii2u",   0x0dfe4,         0x6000884  },
2995   { "sfiii2n",   0x0dfe4,         0x6000884  },
2996   { "sfiii3",    0x0d794,         0x6000884  },
2997   { "sfiii3n",   0x0d794,         0x6000884  },
2998   { "sfiii3a",   0x0d794,         0x6000884  },
2999   { "sfiii3an",  0x0d794,         0x6000884  },
3000   { "warzard",   0x2136c,         0x600194e  },
3001   { "redearth",  0x2136c,         0x600194e  },
2989   { "jojo",      0x223c0,         0x600065a  },
2990   { "jojon",     0x223c0,         0x600065a  },
2991   { "jojoalt",   0x223d8,         0x600065a  },
2992   { "jojoaltn",  0x223d8,         0x600065a  },
2993   { "jojoba",    0x267dc,         0x600065a  },
2994   { "jojoban",   0x267dc,         0x600065a  },
2995   { "jojobane",  0x267dc,         0x600065a  },
2996   { "sfiii",     0x0cc6c,         0x6000882  },
2997   { "sfiiiu",    0x0cc6c,         0x6000882  },
2998   { "sfiiin",    0x0cc6c,         0x6000882  },
2999   { "sfiii2",    0x0dfe4,         0x6000882  },
3000   { "sfiii2u",   0x0dfe4,         0x6000882  },
3001   { "sfiii2n",   0x0dfe4,         0x6000882  },
3002   { "sfiii3",    0x0d794,         0x6000882  },
3003   { "sfiii3n",   0x0d794,         0x6000882  },
3004   { "sfiii3a",   0x0d794,         0x6000882  },
3005   { "sfiii3an",  0x0d794,         0x6000882  },
3006   { "warzard",   0x2136c,         0x600194c  },
3007   { "redearth",  0x2136c,         0x600194c  },
30023008   { 0 }   // end of table
30033009};
30043010
r2956r2957
30323038
30333039   //printf("speedup %08x %08x\n",cps3_speedup_ram_address,cps3_speedup_code_address);
30343040
3035   if (cps3_speedup_code_address!=0) memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, cps3_speedup_ram_address+0x02000000, cps3_speedup_ram_address+0x02000003, 0, 0, cps3_speedup_r );
3041   if (cps3_speedup_code_address!=0)
3042   {
3043      cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
3044      cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, cps3_speedup_code_address);
3045
3046      memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, cps3_speedup_ram_address+0x02000000, cps3_speedup_ram_address+0x02000003, 0, 0, cps3_speedup_r );
3047   }
30363048}
30373049
30383050
src/mame/drivers/spiders.c
r2956r2957
272272   /* update the different PIA pins from the input ports */
273273
274274   /* CA1 - copy of PA1 (COIN1) */
275   pia_1_ca1_w(machine, 0, input_port_read_indexed(machine,0) & 0x02);
275   pia_1_ca1_w(machine, 0, input_port_read(machine, "IN0") & 0x02);
276276
277277   /* CA2 - copy of PA0 (SERVICE1) */
278   pia_1_ca2_w(machine, 0, input_port_read_indexed(machine,0) & 0x01);
278   pia_1_ca2_w(machine, 0, input_port_read(machine, "IN0") & 0x01);
279279
280280   /* CB1 - (crosshatch) */
281   pia_1_cb1_w(machine, 0, input_port_read_indexed(machine,5));
281   pia_1_cb1_w(machine, 0, input_port_read(machine, "XHATCH"));
282282
283283   /* CB2 - NOT CONNECTED */
284284}
r2956r2957
573573   AM_RANGE(0xc044, 0xc047) AM_READWRITE(pia_1_r, pia_1_w)
574574   AM_RANGE(0xc048, 0xc04b) AM_READWRITE(pia_2_alt_r, pia_2_alt_w)
575575   AM_RANGE(0xc050, 0xc053) AM_READWRITE(pia_3_r, pia_3_w)
576   AM_RANGE(0xc060, 0xc060) AM_READ(input_port_2_r)
577   AM_RANGE(0xc080, 0xc080) AM_READ(input_port_3_r)
578   AM_RANGE(0xc0a0, 0xc0a0) AM_READ(input_port_4_r)
576   AM_RANGE(0xc060, 0xc060) AM_READ_PORT("DSW1")
577   AM_RANGE(0xc080, 0xc080) AM_READ_PORT("DSW2")
578   AM_RANGE(0xc0a0, 0xc0a0) AM_READ_PORT("DSW3")
579579   AM_RANGE(0xc100, 0xffff) AM_ROM
580580ADDRESS_MAP_END
581581
r2956r2957
596596
597597static INPUT_PORTS_START( spiders )
598598    /* PIA1 PA0 - PA7 */
599    PORT_START      /* IN0 */
599    PORT_START_TAG("IN0")   /* IN0 */
600600   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE1 )
601601   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN1 )
602602   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_HIGH )
r2956r2957
607607    PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE2 )
608608
609609   /* PIA1 PB0 - PB7 */
610    PORT_START      /* IN1 */
610    PORT_START_TAG("IN1")   /* IN1 */
611611   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT  ) PORT_2WAY PORT_PLAYER(2)
612612    PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(2)
613613    PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(1)
614614    PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(1)
615615    PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED )
616616
617    PORT_START  /* IN2, DSW1 */
617    PORT_START_TAG("DSW1")   /* IN2, DSW1 */
618618    PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )   PORT_DIPLOCATION("SW1:1,2,3")
619619    PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
620620    PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
r2956r2957
624624    PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
625625    PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
626626
627    PORT_START  /* IN3, DSW2 */
627    PORT_START_TAG("DSW2")   /* IN3, DSW2 */
628628    PORT_DIPNAME( 0x03, 0x03, "Play Mode" ) PORT_DIPLOCATION("SW2:1,2")
629629    PORT_DIPSETTING(    0x00, "A A'" )
630630    PORT_DIPSETTING(    0x01, "A B'" )
r2956r2957
647647    PORT_DIPSETTING(    0x00, "First Screen" )
648648    PORT_DIPSETTING(    0x80, "Every Screen" )
649649
650    PORT_START  /* IN4, DSW3 */
650    PORT_START_TAG("DSW3")   /* IN4, DSW3 */
651651    PORT_DIPNAME( 0x01, 0x00, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW3:1")
652652    PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
653653    PORT_DIPSETTING(    0x01, DEF_STR( On ) )
r2956r2957
673673    PORT_DIPSETTING(    0xc0, "6" )
674674    PORT_DIPSETTING(    0xe0, "7" )
675675
676    PORT_START      /* connected to PIA1 CB1 input */
676    PORT_START_TAG("XHATCH")   /* connected to PIA1 CB1 input */
677677    PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("PS1 (Crosshatch)") PORT_CODE(KEYCODE_F1)
678678
679679INPUT_PORTS_END
src/mame/drivers/toaplan2.c
r2956r2957
754754   }
755755   if (mcu_data == 0xff) mcu_data = 0x10;
756756   else mcu_data = 0x00;
757   return ( mcu_data | input_port_read_indexed(machine, 6) );
757   return ( mcu_data | input_port_read(machine, "JMPR") );
758758}
759759
760760static READ16_HANDLER( pipibibi_z80_status_r )
r2956r2957
774774{
775775   INT8 value, new_value;
776776
777   new_value = input_port_read_indexed(machine, 7);
777   new_value = input_port_read(machine, "PAD1");
778778   if (new_value == old_p1_paddle_h) return 0;
779779   value = new_value - old_p1_paddle_h;
780780   old_p1_paddle_h = new_value;
r2956r2957
785785{
786786   INT8 value, new_value;
787787
788   new_value = input_port_read_indexed(machine, 8);
788   new_value = input_port_read(machine, "PAD2");
789789   if (new_value == old_p2_paddle_h) return 0;
790790   value = new_value - old_p2_paddle_h;
791791   old_p2_paddle_h = new_value;
src/mame/drivers/seattle.c
r2956r2957
26502650   ROM_REGION32_LE( 0x80000, REGION_USER1, 0 )
26512651   ROM_LOAD( "vtrxboot.bin", 0x000000, 0x80000, CRC(ee487a6c) SHA1(fb9efda85047cf615f24f7276a9af9fd542f3354) )
26522652
2653   DISK_REGION( REGION_DISKS )
2653   DISK_REGION( REGION_DISKS ) /* Guts: Apr 10 1998 11:03:14  Main: Apr 10 1998 11:27:44 */
26542654   DISK_IMAGE( "vaportrp", 0, MD5(fac4d37e049bc649696f4834044860e6) SHA1(75e2eaf81c69d2a337736dbead804ac339fd0675) )
26552655
26562656   ROM_REGION16_LE( 0x10000, REGION_SOUND1, 0 )   /* ADSP-2115 data Version 1.02 */
r2956r2957
26622662   ROM_REGION16_LE( 0x10000, REGION_SOUND1, 0 )   /* ADSP-2115 data Version 1.02 */
26632663   ROM_LOAD16_BYTE( "sound102.u95", 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) )
26642664
2665   ROM_REGION32_LE( 0x80000, REGION_USER1, 0 )
2665   ROM_REGION32_LE( 0x80000, REGION_USER1, 0 ) /* Seattle System Boot ROM Version 0.1i Apr 14 1997  14:52:53 */
26662666   ROM_LOAD( "biofreak.u32", 0x000000, 0x80000, CRC(cefa00bb) SHA1(7e171610ede1e8a448fb8d175f9cb9e7d549de28) )
26672667
2668   DISK_REGION( REGION_DISKS )
2668   DISK_REGION( REGION_DISKS ) /* Build Date 12/11/97 */
26692669   DISK_IMAGE( "biofreak", 0, MD5(f4663a3fd0ceed436756710b97d283e4) SHA1(88b87cb651b97eac117c9342127938e30dc8c138) )
26702670ROM_END
26712671
r2956r2957
27222722   ROM_REGION16_LE( 0x10000, REGION_SOUND1, 0 )   /* ADSP-2115 data Version 1.02 */
27232723   ROM_LOAD16_BYTE( "sound102.u95", 0x000000, 0x8000, CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) )
27242724
2725   ROM_REGION32_LE( 0x80000, REGION_USER1, 0 )
2726   ROM_LOAD( "boot.u32", 0x000000, 0x80000, CRC(82c07f2e) SHA1(fa51c58022ce251c53bad12fc6ffadb35adb8162) )
2725   ROM_REGION32_LE( 0x80000, REGION_USER1, 0 ) /* Boot Rom Version 1.9 */
2726   ROM_LOAD( "carnevil1_9.u32", 0x000000, 0x80000, CRC(82c07f2e) SHA1(fa51c58022ce251c53bad12fc6ffadb35adb8162) )
27272727
2728   DISK_REGION( REGION_DISKS )
2728   DISK_REGION( REGION_DISKS )   /* Hard Drive v1.0.1  12/11/99 */
27292729   DISK_IMAGE( "carnevil", 0, BAD_DUMP MD5(6eafae86091c0a915cf8cfdc3d73adc2) SHA1(5e6524d4b97de141c38e301a17e8af15661cb5d6) )
27302730ROM_END
27312731
r2956r2957
27342734   ROM_REGION16_LE( 0x10000, REGION_SOUND1, 0 )   /* ADSP-2115 data Version 1.02 */
27352735   ROM_LOAD16_BYTE( "seattle.snd", 0x000000, 0x8000, BAD_DUMP CRC(bec7d3ae) SHA1(db80aa4a645804a4574b07b9f34dec6b6b64190d) )
27362736
2737   ROM_REGION32_LE( 0x80000, REGION_USER1, 0 )
2737   ROM_REGION32_LE( 0x80000, REGION_USER1, 0 ) /* Boot Rom Version 9. */
27382738   ROM_LOAD( "hyprdrve.u32", 0x000000, 0x80000, CRC(3e18cb80) SHA1(b18cc4253090ee1d65d72a7ec0c426ed08c4f238) )
27392739
2740   DISK_REGION( REGION_DISKS )
2740   DISK_REGION( REGION_DISKS )   /* Version 1.40  Oct 23 1998  15:16:00 */
27412741   DISK_IMAGE( "hyprdriv", 0, MD5(480c43735b0b83eb10c0223283d4226c) SHA1(2e42fecbb8722c736cccdca7ed3b21fbc75e345a) )
27422742ROM_END
27432743
r2956r2957
29462946/* Atari */
29472947GAME( 1996, wg3dh,    0,        phoenixsa,         wg3dh,    wg3dh,    ROT0, "Atari Games",  "Wayne Gretzky's 3D Hockey", GAME_SUPPORTS_SAVE )
29482948GAME( 1996, mace,     0,        seattle150,        mace,     mace,     ROT0, "Atari Games",  "Mace: The Dark Age (boot ROM 1.0ce, HDD 1.0b)", GAME_SUPPORTS_SAVE )
2949GAME( 1997, macea,    mace,     seattle150,        mace,     mace,     ROT0, "Atari Games",  "Mace: The Dark Age (HDD 1.0a", GAME_SUPPORTS_SAVE )
2949GAME( 1997, macea,    mace,     seattle150,        mace,     mace,     ROT0, "Atari Games",  "Mace: The Dark Age (HDD 1.0a)", GAME_SUPPORTS_SAVE )
29502950GAME( 1996, sfrush,   0,        flagstaff,         sfrush,   sfrush,   ROT0, "Atari Games",  "San Francisco Rush", GAME_SUPPORTS_SAVE )
29512951GAME( 1996, sfrushrk, 0,        flagstaff,         sfrushrk, sfrushrk, ROT0, "Atari Games",  "San Francisco Rush: The Rock", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE )
29522952GAME( 1998, calspeed, 0,        seattle150_widget, calspeed, calspeed, ROT0, "Atari Games",  "California Speed (Version 2.1a, 4/17/98)", GAME_SUPPORTS_SAVE )
src/mame/drivers/galastrm.c
r2956r2957
103103   {
104104      case 0x00:
105105      {
106         return (input_port_read_indexed(machine,0) << 16) | input_port_read_indexed(machine,1) |
106         return (input_port_read(machine, "IN0") << 16) | input_port_read(machine, "IN1") |
107107              (eeprom_read_bit() << 7) | frame_counter << 9;
108108      }
109109
110110      case 0x01:
111111      {
112         return input_port_read_indexed(machine,2) | (coin_word << 16);
112         return input_port_read(machine, "IN2") | (coin_word << 16);
113113      }
114114    }
115115//logerror("CPU #0 PC %06x: read input %06x\n",activecpu_get_pc(),offset);
r2956r2957
170170   if (offset == 0x00)
171171   {
172172      if (ACCESSING_BITS_24_31)
173         return input_port_read_indexed(machine, 3) << 24;
173         return input_port_read(machine, "STICKX") << 24;
174174      if (ACCESSING_BITS_16_23)
175         return input_port_read_indexed(machine, 4) << 16;
175         return input_port_read(machine, "STICKY") << 16;
176176   }
177177   return 0;
178178}
r2956r2957
221221***********************************************************/
222222
223223static INPUT_PORTS_START( galastrm )
224   PORT_START      /* IN0 */
224   PORT_START_TAG("IN0")   /* IN0 */
225225   PORT_BIT( 0xFFFF, IP_ACTIVE_LOW,  IPT_UNKNOWN )
226226
227   PORT_START      /* IN1 */
227   PORT_START_TAG("IN1")   /* IN1 */
228228   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1)   /* Freeze input */
229229   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_UNKNOWN )
230230   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_UNKNOWN )
r2956r2957
242242   PORT_BIT( 0x4000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
243243   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
244244
245   PORT_START      /* IN2 */
245   PORT_START_TAG("IN2")   /* IN2 */
246246   PORT_SERVICE_NO_TOGGLE( 0x0001, IP_ACTIVE_LOW )
247247   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_SERVICE1)
248248   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_COIN1   )
r2956r2957
260260   PORT_BIT( 0x4000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
261261   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
262262
263   PORT_START
263   PORT_START_TAG("STICKX")
264264   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(60) PORT_KEYDELTA(15) PORT_PLAYER(1)
265265
266   PORT_START
266   PORT_START_TAG("STICKY")
267267   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(60) PORT_KEYDELTA(15) PORT_REVERSE PORT_PLAYER(1)
268268INPUT_PORTS_END
269269
src/mame/drivers/tetrisp2.c
r2956r2957
263263
264264static READ16_HANDLER( tetrisp2_ip_1_word_r )
265265{
266   return   ( input_port_read(machine, "IN1") &  0xfcff ) |
266   return   ( input_port_read(machine, "SYSTEM") &  0xfcff ) |
267267         (           mame_rand(machine) & ~0xfcff ) |
268268         (      1 << (8 + (mame_rand(machine)&1)) );
269269}
r2956r2957
339339
340340static READ16_HANDLER( rocknms_port_0_r )
341341{
342   return ((input_port_read_indexed(machine, 0) & 0xfffc ) | (rocknms_sub2main & 0x0003));
342   return ((input_port_read(machine, "PLAYERS") & 0xfffc ) | (rocknms_sub2main & 0x0003));
343343}
344344
345345static WRITE16_HANDLER( rocknms_sub2main_w )
r2956r2957
377377   AM_RANGE(0x600000, 0x60ffff) AM_READ(SMH_RAM            )   // Rotation
378378   AM_RANGE(0x650000, 0x651fff) AM_READ(SMH_RAM            )   // Rotation (mirror)
379379   AM_RANGE(0x800002, 0x800003) AM_READ(tetrisp2_sound_r      )   // Sound
380   AM_RANGE(0x900000, 0x903fff) AM_READ(tetrisp2_nvram_r   )   // NVRAM
381   AM_RANGE(0x904000, 0x907fff) AM_READ(tetrisp2_nvram_r   )   // NVRAM (mirror)
380   AM_RANGE(0x900000, 0x903fff) AM_READ(tetrisp2_nvram_r      )   // NVRAM
381   AM_RANGE(0x904000, 0x907fff) AM_READ(tetrisp2_nvram_r      )   // NVRAM (mirror)
382382   AM_RANGE(0xbe0000, 0xbe0001) AM_READ(SMH_NOP            )   // INT-level1 dummy read
383   AM_RANGE(0xbe0002, 0xbe0003) AM_READ(input_port_0_word_r   )   // Inputs
383   AM_RANGE(0xbe0002, 0xbe0003) AM_READ_PORT("PLAYERS")         // Inputs
384384   AM_RANGE(0xbe0004, 0xbe0005) AM_READ(tetrisp2_ip_1_word_r   )   // Inputs & protection
385   AM_RANGE(0xbe0008, 0xbe0009) AM_READ(input_port_2_word_r   )   // Inputs
386   AM_RANGE(0xbe000a, 0xbe000b) AM_READ(watchdog_reset16_r   )   // Watchdog
385   AM_RANGE(0xbe0008, 0xbe0009) AM_READ_PORT("DSW")            // Inputs
386   AM_RANGE(0xbe000a, 0xbe000b) AM_READ(watchdog_reset16_r      )   // Watchdog
387387ADDRESS_MAP_END
388388
389389static ADDRESS_MAP_START( tetrisp2_writemem, ADDRESS_SPACE_PROGRAM, 16 )
r2956r2957
494494   AM_RANGE(0x408000, 0x409fff) AM_READ(SMH_RAM            )   // ???
495495   AM_RANGE(0x500000, 0x50ffff) AM_READ(SMH_RAM            )   // Line
496496   AM_RANGE(0x600000, 0x60ffff) AM_READ(SMH_RAM            )   // Rotation
497   AM_RANGE(0x900000, 0x903fff) AM_READ(rockn_nvram_r      )   // NVRAM
497   AM_RANGE(0x900000, 0x903fff) AM_READ(rockn_nvram_r         )   // NVRAM
498498   AM_RANGE(0xa30000, 0xa30001) AM_READ(rockn_soundvolume_r   )   // Sound Volume
499499   AM_RANGE(0xa40002, 0xa40003) AM_READ(tetrisp2_sound_r      )   // Sound
500500   AM_RANGE(0xa44000, 0xa44001) AM_READ(rockn_adpcmbank_r      )   // Sound Bank
501501   AM_RANGE(0xbe0000, 0xbe0001) AM_READ(SMH_NOP            )   // INT-level1 dummy read
502   AM_RANGE(0xbe0002, 0xbe0003) AM_READ(input_port_0_word_r   )   // Inputs
503   AM_RANGE(0xbe0004, 0xbe0005) AM_READ(input_port_1_word_r   )   // Inputs
504   AM_RANGE(0xbe0008, 0xbe0009) AM_READ(input_port_2_word_r   )   // Inputs
505   AM_RANGE(0xbe000a, 0xbe000b) AM_READ(watchdog_reset16_r   )   // Watchdog
502   AM_RANGE(0xbe0002, 0xbe0003) AM_READ_PORT("PLAYERS")         // Inputs
503   AM_RANGE(0xbe0004, 0xbe0005) AM_READ_PORT("SYSTEM")            // Inputs
504   AM_RANGE(0xbe0008, 0xbe0009) AM_READ_PORT("DSW")            // Inputs
505   AM_RANGE(0xbe000a, 0xbe000b) AM_READ(watchdog_reset16_r)      // Watchdog
506506ADDRESS_MAP_END
507507
508508static ADDRESS_MAP_START( rockn1_writemem, ADDRESS_SPACE_PROGRAM, 16 )
r2956r2957
545545   AM_RANGE(0x800000, 0x803fff) AM_READ(SMH_RAM            )   // Foreground
546546   AM_RANGE(0x804000, 0x807fff) AM_READ(SMH_RAM            )   // Background
547547   AM_RANGE(0x808000, 0x809fff) AM_READ(SMH_RAM            )   // ???
548   AM_RANGE(0x900000, 0x903fff) AM_READ(rockn_nvram_r      )   // NVRAM
548   AM_RANGE(0x900000, 0x903fff) AM_READ(rockn_nvram_r         )   // NVRAM
549549   AM_RANGE(0xa30000, 0xa30001) AM_READ(rockn_soundvolume_r   )   // Sound Volume
550550   AM_RANGE(0xa40002, 0xa40003) AM_READ(tetrisp2_sound_r      )   // Sound
551551   AM_RANGE(0xa44000, 0xa44001) AM_READ(rockn_adpcmbank_r      )   // Sound Bank
552552   AM_RANGE(0xbe0000, 0xbe0001) AM_READ(SMH_NOP            )   // INT-level1 dummy read
553   AM_RANGE(0xbe0002, 0xbe0003) AM_READ(input_port_0_word_r   )   // Inputs
554   AM_RANGE(0xbe0004, 0xbe0005) AM_READ(input_port_1_word_r   )   // Inputs
555   AM_RANGE(0xbe0008, 0xbe0009) AM_READ(input_port_2_word_r   )   // Inputs
556   AM_RANGE(0xbe000a, 0xbe000b) AM_READ(watchdog_reset16_r   )   // Watchdog
553   AM_RANGE(0xbe0002, 0xbe0003) AM_READ_PORT("PLAYERS")         // Inputs
554   AM_RANGE(0xbe0004, 0xbe0005) AM_READ_PORT("SYSTEM")            // Inputs
555   AM_RANGE(0xbe0008, 0xbe0009) AM_READ_PORT("DSW")            // Inputs
556   AM_RANGE(0xbe000a, 0xbe000b) AM_READ(watchdog_reset16_r)      // Watchdog
557557ADDRESS_MAP_END
558558
559559static ADDRESS_MAP_START( rockn2_writemem, ADDRESS_SPACE_PROGRAM, 16 )
r2956r2957
591591   AM_RANGE(0x108000, 0x10ffff) AM_READ(SMH_RAM            )   // Work RAM
592592   AM_RANGE(0x200000, 0x23ffff) AM_READ(tetrisp2_priority_r   )   // Priority
593593   AM_RANGE(0x300000, 0x31ffff) AM_READ(SMH_RAM            )   // Palette
594//  AM_RANGE(0x500000, 0x50ffff) AM_READ(SMH_RAM              )   // Line
594//  AM_RANGE(0x500000, 0x50ffff) AM_READ(SMH_RAM                )   // Line
595595   AM_RANGE(0x600000, 0x60ffff) AM_READ(SMH_RAM            )   // Rotation
596596   AM_RANGE(0x800000, 0x803fff) AM_READ(SMH_RAM            )   // Foreground
597597   AM_RANGE(0x804000, 0x807fff) AM_READ(SMH_RAM            )   // Background
598//  AM_RANGE(0x808000, 0x809fff) AM_READ(SMH_RAM              )   // ???
599   AM_RANGE(0x900000, 0x903fff) AM_READ(rockn_nvram_r      )   // NVRAM
598//  AM_RANGE(0x808000, 0x809fff) AM_READ(SMH_RAM                )   // ???
599   AM_RANGE(0x900000, 0x903fff) AM_READ(rockn_nvram_r         )   // NVRAM
600600   AM_RANGE(0xa30000, 0xa30001) AM_READ(rockn_soundvolume_r   )   // Sound Volume
601601   AM_RANGE(0xa40002, 0xa40003) AM_READ(tetrisp2_sound_r      )   // Sound
602602   AM_RANGE(0xa44000, 0xa44001) AM_READ(rockn_adpcmbank_r      )   // Sound Bank
603603   AM_RANGE(0xbe0000, 0xbe0001) AM_READ(SMH_NOP            )   // INT-level1 dummy read
604604   AM_RANGE(0xbe0002, 0xbe0003) AM_READ(rocknms_port_0_r      )   // Inputs
605   AM_RANGE(0xbe0004, 0xbe0005) AM_READ(input_port_1_word_r   )   // Inputs
606   AM_RANGE(0xbe0008, 0xbe0009) AM_READ(input_port_2_word_r   )   // Inputs
607   AM_RANGE(0xbe000a, 0xbe000b) AM_READ(watchdog_reset16_r   )   // Watchdog
605   AM_RANGE(0xbe0004, 0xbe0005) AM_READ_PORT("SYSTEM")            // Inputs
606   AM_RANGE(0xbe0008, 0xbe0009) AM_READ_PORT("DSW")            // Inputs
607   AM_RANGE(0xbe000a, 0xbe000b) AM_READ(watchdog_reset16_r)      // Watchdog
608608ADDRESS_MAP_END
609609
610610static ADDRESS_MAP_START( rocknms_main_writemem, ADDRESS_SPACE_PROGRAM, 16 )
r2956r2957
699699
700700static INPUT_PORTS_START( tetrisp2 )
701701
702   PORT_START_TAG("IN0") /*$be0002.w*/
702   PORT_START_TAG("PLAYERS") /*$be0002.w*/
703703   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
704704   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
705705   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
r2956r2957
717717   PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
718718   PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
719719
720   PORT_START_TAG("IN1") /*$be0004.w*/
720   PORT_START_TAG("SYSTEM") /*$be0004.w*/
721721   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )
722722   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
723723   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_START1   )
r2956r2957
735735   PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN  )
736736   PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN  )
737737
738   PORT_START_TAG("IN2") //$be0008.w
738   PORT_START_TAG("DSW") //$be0008.w
739739   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3")
740740   PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
741741   PORT_DIPSETTING(      0x0001, DEF_STR( 4C_1C ) )
r2956r2957
796796static INPUT_PORTS_START( teplus2j )
797797   PORT_INCLUDE(tetrisp2)
798798
799   PORT_MODIFY("IN2")   // $be0008.w
799   PORT_MODIFY("DSW")   // $be0008.w
800800   PORT_DIPNAME( 0x0040, 0x0040, "Unknown 1-7" ) PORT_DIPLOCATION("SW1:7") /* Free Play in "World" set */
801801   PORT_DIPSETTING(      0x0040, DEF_STR( Off ) )
802802   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
932932
933933
934934static INPUT_PORTS_START( rockn )
935   PORT_START_TAG("IN0")   //$be0002.w
935   PORT_START_TAG("PLAYERS")   //$be0002.w
936936   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )
937937   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
938938   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
r2956r2957
950950   PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
951951   PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
952952
953   PORT_START_TAG("IN1")   //$be0004.w
953   PORT_START_TAG("SYSTEM")   //$be0004.w
954954   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )
955955   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
956956   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_START1   )
r2956r2957
968968   PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN  )
969969   PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN  )
970970
971   PORT_START_TAG("IN2")   //$be0008.w
971   PORT_START_TAG("DSW")   //$be0008.w
972972   PORT_DIPNAME( 0x0001, 0x0001, "DIPSW 1-1") // All these used to be marked 'Cheat', can't think why.
973973   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
974974   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
10221022
10231023
10241024static INPUT_PORTS_START( rocknms )
1025   PORT_START   // IN0 - $be0002.w
1026
1025   PORT_START_TAG("PLAYERS")   // IN0 - $be0002.w
10271026   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_SPECIAL )      // MAIN -> SUB Communication
10281027   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_SPECIAL )      // MAIN -> SUB Communication
10291028   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
r2956r2957
10321031   PORT_BIT(  0x0020, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)
10331032   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
10341033   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
1035
10361034   PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN  )
10371035   PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN  )
10381036   PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
r2956r2957
10421040   PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
10431041   PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
10441042
1045   PORT_START   // IN1 - $be0004.w
1043   PORT_START_TAG("SYSTEM")   // IN1 - $be0004.w
10461044   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )
10471045   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
10481046   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_START1   )
r2956r2957
10511049   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
10521050   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_COIN1    )
10531051   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_COIN2    )
1054
10551052   PORT_BIT(  0x0100, IP_ACTIVE_LOW, IPT_UNKNOWN  )
10561053   PORT_BIT(  0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN  )
10571054   PORT_BIT(  0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN  )
r2956r2957
10611058   PORT_BIT(  0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN  )
10621059   PORT_BIT(  0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN  )
10631060
1064   PORT_START_TAG("IN2")   //$be0008.w
1061   PORT_START_TAG("DSW")   //$be0008.w
10651062   PORT_DIPNAME( 0x0001, 0x0001, "DIPSW 1-1") // All these used to be marked 'Cheat', can't think why.
10661063   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
10671064   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
src/mame/drivers/starfire.c
r2956r2957
105105{
106106   switch (offset & 15)
107107   {
108      case 0:   return input_port_read_indexed(machine, 0);
109      case 1:   return input_port_read_indexed(machine, 1);   /* Note: need to loopback sounds lengths on that one */
110      case 5: return input_port_read_indexed(machine, 4);
111      case 6:   return input_port_read_indexed(machine, 2);
112      case 7:   return input_port_read_indexed(machine, 3);
108      case 0:   return input_port_read(machine, "DSW");
109      case 1:   return input_port_read(machine, "SYSTEM");   /* Note: need to loopback sounds lengths on that one */
110      case 5: return input_port_read(machine, "STICKZ");
111      case 6:   return input_port_read(machine, "STICKX");
112      case 7:   return input_port_read(machine, "STICKY");
113113      default: return 0xff;
114114   }
115115}
r2956r2957
132132
133133   switch (offset & 15)
134134   {
135      case 0:   return input_port_read_indexed(machine, 0);
136      case 1: return input_port_read_indexed(machine, 1);
135      case 0:   return input_port_read(machine, "DSW");
136      case 1:   return input_port_read(machine, "SYSTEM");
137137      case 2:
138         temp = fireone_select ? input_port_read_indexed(machine, 2) : input_port_read_indexed(machine, 3);
138         temp = fireone_select ? input_port_read(machine, "P1") : input_port_read(machine, "P2");
139139         temp = (temp & 0xc0) | fireone_paddle_map[temp & 0x3f];
140140         return temp;
141141      default: return 0xff;
r2956r2957
166166 *************************************/
167167
168168static INPUT_PORTS_START( starfire )
169   PORT_START      /* DSW0 */
169   PORT_START_TAG("DSW")   /* DSW0 */
170170   PORT_DIPNAME( 0x03, 0x00, "Time" )
171171   PORT_DIPSETTING(    0x00, "90 Sec" )
172172   PORT_DIPSETTING(    0x01, "80 Sec" )
r2956r2957
188188   PORT_DIPSETTING(    0x40, "fixed length+fire" )
189189   PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
190190
191   PORT_START      /* IN1 */
191   PORT_START_TAG("SYSTEM")   /* IN1 */
192192   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
193193   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START1 )
194194   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 )
r2956r2957
198198   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
199199   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
200200
201   PORT_START  /* IN2 */
201   PORT_START_TAG("STICKX")   /* IN2 */
202202   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10)
203203
204   PORT_START  /* IN3 */
204   PORT_START_TAG("STICKY")   /* IN3 */
205205   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE
206206
207   PORT_START  /* IN4 */ /* throttle */
207   PORT_START_TAG("STICKZ")   /* IN4 */ /* throttle */
208208   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Z ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_REVERSE
209209INPUT_PORTS_END
210210
211211
212212static INPUT_PORTS_START( fireone )
213   PORT_START      /* DSW0 */
213   PORT_START_TAG("DSW")   /* DSW0 */
214214   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coinage ) )
215215   PORT_DIPSETTING(    0x03, "2 Coins/1 Player" )
216216   PORT_DIPSETTING(    0x02, "2 Coins/1 or 2 Players" )
r2956r2957
231231   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
232232   PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
233233
234   PORT_START      /* IN1 */
234   PORT_START_TAG("SYSTEM")   /* IN1 */
235235   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
236236   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
237237   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
r2956r2957
241241   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
242242   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
243243
244   PORT_START  /* IN2 */
244   PORT_START_TAG("P1")   /* IN2 */
245245   PORT_BIT( 0x3f, 0x20, IPT_PADDLE ) PORT_MINMAX(0,63) PORT_SENSITIVITY(50) PORT_KEYDELTA(1) PORT_PLAYER(1)
246246   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)
247247   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
248248
249   PORT_START  /* IN3 */
249   PORT_START_TAG("P2")   /* IN3 */
250250   PORT_BIT( 0x3f, 0x20, IPT_PADDLE ) PORT_MINMAX(0,63) PORT_SENSITIVITY(50) PORT_KEYDELTA(1) PORT_PLAYER(2)
251251   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)
252252   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
src/mame/drivers/sprint8.c
r2956r2957
2828static TIMER_CALLBACK( input_callback )
2929{
3030   static UINT8 dial[8];
31   static const char *dialnames[] = { "DIAL1", "DIAL2", "DIAL3", "DIAL4", "DIAL5", "DIAL6", "DIAL7", "DIAL8" };
3132
3233   int i;
3334
3435   for (i = 0; i < 8; i++)
3536   {
36      UINT8 val = input_port_read_indexed(machine, 8 + i) >> 4;
37      UINT8 val = input_port_read(machine, dialnames[i]) >> 4;
3738
3839      signed char delta = (val - dial[i]) & 15;
3940
r2956r2957
7071
7172static READ8_HANDLER( sprint8_input_r )
7273{
73   UINT8 val = input_port_read_indexed(machine, offset);
74   static const char *portnames[] = { "P1", "P2", "P3", "P4", "P5", "P6", "P7", "P8" };
75   UINT8 val = input_port_read(machine, portnames[offset]);
7476
7577   if (steer_dir[offset])
7678   {
r2956r2957
114116   AM_RANGE(0x0000, 0x00ff) AM_READ(SMH_RAM)
115117   AM_RANGE(0x1c00, 0x1c00) AM_READ(sprint8_collision_r)
116118   AM_RANGE(0x1c01, 0x1c08) AM_READ(sprint8_input_r)
117   AM_RANGE(0x1c09, 0x1c09) AM_READ(input_port_16_r)
118   AM_RANGE(0x1c0a, 0x1c0a) AM_READ(input_port_17_r)
119   AM_RANGE(0x1c0f, 0x1c0f) AM_READ(input_port_18_r)
119   AM_RANGE(0x1c09, 0x1c09) AM_READ_PORT("IN0")
120   AM_RANGE(0x1c0a, 0x1c0a) AM_READ_PORT("IN1")
121   AM_RANGE(0x1c0f, 0x1c0f) AM_READ_PORT("VBLANK")
120122   AM_RANGE(0x2000, 0x3fff) AM_READ(SMH_ROM)
121123   AM_RANGE(0xf800, 0xffff) AM_READ(SMH_ROM)
122124ADDRESS_MAP_END
r2956r2957
145147
146148static INPUT_PORTS_START( sprint8 )
147149
148   PORT_START
149   PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 )
150   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P1 */
151   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P1 */
152   PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(1)
153   PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(1)
154   PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
155   PORT_BIT ( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
156   PORT_BIT ( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
150   PORT_START_TAG("P1")
151   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 )
152   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P1 */
153   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P1 */
154   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(1)
155   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(1)
156   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
157   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
158   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
157159
158   PORT_START
159   PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN2 )
160   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P2 */
161   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P2 */
162   PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(2)
163   PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(2)
164   PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
165   PORT_BIT ( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
166   PORT_BIT ( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
160   PORT_START_TAG("P2")
161   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN2 )
162   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P2 */
163   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P2 */
164   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(2)
165   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(2)
166   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
167   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
168   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
167169
168   PORT_START
169   PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN3 )
170   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P3 */
171   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P3 */
172   PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(3)
173   PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(3)
174   PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
175   PORT_BIT ( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
176   PORT_BIT ( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
170   PORT_START_TAG("P3")
171   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN3 )
172   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P3 */
173   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P3 */
174   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(3)
175   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(3)
176   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
177   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
178   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
177179
178   PORT_START
179   PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN4 )
180   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P4 */
181   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P4 */
182   PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(4)
183   PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(4)
184   PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
185   PORT_BIT ( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
186   PORT_BIT ( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
180   PORT_START_TAG("P4")
181   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN4 )
182   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P4 */
183   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P4 */
184   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(4)
185   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(4)
186   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
187   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
188   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
187189
188   PORT_START
189   PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN5 )
190   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P5 */
191   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P5 */
192   PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(5)
193   PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(5)
194   PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
195   PORT_BIT ( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
190   PORT_START_TAG("P5")
191   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN5 )
192   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P5 */
193   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P5 */
194   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(5)
195   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(5)
196   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
197   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
196198   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
197199
198   PORT_START
199   PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN6 )
200   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P6 */
201   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P6 */
202   PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(6)
203   PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(6)
204   PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
205   PORT_BIT ( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
206   PORT_BIT ( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
200   PORT_START_TAG("P6")
201   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN6 )
202   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P6 */
203   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P6 */
204   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(6)
205   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(6)
206   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
207   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
208   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
207209
208   PORT_START
209   PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN7 )
210   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P7 */
211   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P7 */
212   PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(7)
213   PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(7)
214   PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
215   PORT_BIT ( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
216   PORT_BIT ( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
210   PORT_START_TAG("P7")
211   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN7 )
212   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P7 */
213   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P7 */
214   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(7)
215   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(7)
216   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
217   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
218   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
217219
218   PORT_START
219   PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN8 )
220   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P8 */
221   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P8 */
222   PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(8)
223   PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(8)
224   PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
225   PORT_BIT ( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
226   PORT_BIT ( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
220   PORT_START_TAG("P8")
221   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN8 )
222   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P8 */
223   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P8 */
224   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(8)
225   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(8)
226   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
227   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
228   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
227229
228   PORT_START
230   PORT_START_TAG("DIAL1")
229231   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
230232
231   PORT_START
233   PORT_START_TAG("DIAL2")
232234   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
233235
234   PORT_START
236   PORT_START_TAG("DIAL3")
235237   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(3)
236238
237   PORT_START
239   PORT_START_TAG("DIAL4")
238240   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(4)
239241
240   PORT_START
242   PORT_START_TAG("DIAL5")
241243   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(5)
242244
243   PORT_START
245   PORT_START_TAG("DIAL6")
244246   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(6)
245247
246   PORT_START
248   PORT_START_TAG("DIAL7")
247249   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(7)
248250
249   PORT_START
251   PORT_START_TAG("DIAL8")
250252   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(8)
251253
252   PORT_START
254   PORT_START_TAG("IN0")
253255   PORT_DIPNAME( 0x0f, 0x08, "Play Time" )
254256   PORT_DIPSETTING(    0x0f, "60 seconds" )
255257   PORT_DIPSETTING(    0x0e, "69 seconds" )
r2956r2957
267269   PORT_DIPSETTING(    0x02, "172 seconds" )
268270   PORT_DIPSETTING(    0x01, "181 seconds" )
269271   PORT_DIPSETTING(    0x00, "189 seconds" )
270   PORT_BIT ( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
272   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
271273
272   PORT_START
274   PORT_START_TAG("IN1")
273275   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE)
274276
275   PORT_START
276   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )
277   PORT_START_TAG("VBLANK")
278   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )
277279
278280INPUT_PORTS_END
279281
280282
281283static INPUT_PORTS_START( sprint8p )
282284
283   PORT_START
284   PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 )
285   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P1 */
286   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P1 */
287   PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(1)
288   PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(1)
289   PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
290   PORT_BIT ( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
291   PORT_BIT ( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
285   PORT_START_TAG("P1")
286   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1 )
287   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P1 */
288   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P1 */
289   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(1)
290   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(1)
291   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
292   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
293   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
292294
293   PORT_START
294   PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN2 )
295   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P2 */
296   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P2 */
297   PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(2)
298   PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(2)
299   PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
300   PORT_BIT ( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
301   PORT_BIT ( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
295   PORT_START_TAG("P2")
296   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN2 )
297   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P2 */
298   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P2 */
299   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(2)
300   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(2)
301   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
302   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
303   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
302304
303   PORT_START
304   PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN3 )
305   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P3 */
306   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P3 */
307   PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(3)
308   PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(3)
309   PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
310   PORT_BIT ( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
311   PORT_BIT ( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
305   PORT_START_TAG("P3")
306   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN3 )
307   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P3 */
308   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P3 */
309   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(3)
310   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(3)
311   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
312   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
313   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
312314
313   PORT_START
314   PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN4 )
315   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P4 */
316   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P4 */
317   PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(4)
318   PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(4)
319   PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
320   PORT_BIT ( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
321   PORT_BIT ( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
315   PORT_START_TAG("P4")
316   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN4 )
317   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P4 */
318   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P4 */
319   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(4)
320   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(4)
321   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
322   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
323   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
322324
323   PORT_START
324   PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN5 )
325   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P5 */
326   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P5 */
327   PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(5)
328   PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(5)
329   PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
330   PORT_BIT ( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
325   PORT_START_TAG("P5")
326   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN5 )
327   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P5 */
328   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P5 */
329   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(5)
330   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(5)
331   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
332   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
331333   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
332334
333   PORT_START
334   PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN6 )
335   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P6 */
336   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P6 */
337   PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(6)
338   PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(6)
339   PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
340   PORT_BIT ( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
341   PORT_BIT ( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
335   PORT_START_TAG("P6")
336   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN6 )
337   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P6 */
338   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P6 */
339   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(6)
340   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(6)
341   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
342   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
343   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
342344
343   PORT_START
344   PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN7 )
345   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P7 */
346   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P7 */
347   PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(7)
348   PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(7)
349   PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
350   PORT_BIT ( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
351   PORT_BIT ( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
345   PORT_START_TAG("P7")
346   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN7 )
347   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P7 */
348   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P7 */
349   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(7)
350   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(7)
351   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
352   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
353   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
352354
353   PORT_START
354   PORT_BIT ( 0x01, IP_ACTIVE_LOW,  IPT_COIN8 )
355   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P8 */
356   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P8 */
357   PORT_BIT ( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(8)
358   PORT_BIT ( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(8)
359   PORT_BIT ( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
360   PORT_BIT ( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
361   PORT_BIT ( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
355   PORT_START_TAG("P8")
356   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN8 )
357   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER DIR P8 */
358   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* STEER FLAG P8 */
359   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(8)
360   PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(8)
361   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNUSED )
362   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNUSED )
363   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNUSED )
362364
363   PORT_START
365   PORT_START_TAG("DIAL1")
364366   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
365367
366   PORT_START
368   PORT_START_TAG("DIAL2")
367369   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
368370
369   PORT_START
371   PORT_START_TAG("DIAL3")
370372   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(3)
371373
372   PORT_START
374   PORT_START_TAG("DIAL4")
373375   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(4)
374376
375   PORT_START
377   PORT_START_TAG("DIAL5")
376378   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(5)
377379
378   PORT_START
380   PORT_START_TAG("DIAL6")
379381   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(6)
380382
381   PORT_START
383   PORT_START_TAG("DIAL7")
382384   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(7)
383385
384   PORT_START
386   PORT_START_TAG("DIAL8")
385387   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(8)
386388
387   PORT_START
389   PORT_START_TAG("IN0")
388390   PORT_DIPNAME( 0x03, 0x03, "Play Time" )
389391   PORT_DIPSETTING(    0x00, "54 seconds" )
390392   PORT_DIPSETTING(    0x01, "108 seconds" )
391393   PORT_DIPSETTING(    0x03, "216 seconds" )
392   PORT_BIT ( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
394   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
393395
394   PORT_START
396   PORT_START_TAG("IN1")
395397   PORT_DIPNAME( 0x01, 0x01, "Play Mode" )
396398   PORT_DIPSETTING(    0x00, "Chase" )
397399   PORT_DIPSETTING(    0x01, "Tag" )
398400
399   PORT_START
400   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )
401   PORT_START_TAG("VBLANK")
402   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )
401403
402404INPUT_PORTS_END
403405
src/mame/drivers/ssv.c
r2956r2957
491491
492492static READ16_HANDLER( gdfs_eeprom_r )
493493{
494   return (((gdfs_lightgun_select & 1) ? 0 : 0xff) ^ input_port_read_indexed(machine, 5 + gdfs_lightgun_select)) | (eeprom_read_bit() << 8);
494   static const char *gunnames[] = { "GUNX1", "GUNY1", "GUNX2", "GUNY2" };
495
496   return (((gdfs_lightgun_select & 1) ? 0 : 0xff) ^ input_port_read(machine, gunnames[gdfs_lightgun_select])) | (eeprom_read_bit() << 8);
495497}
496498
497499static WRITE16_HANDLER( gdfs_eeprom_w )
r2956r2957
644646static READ16_HANDLER( hypreact_input_r )
645647{
646648   UINT16 input_sel = *ssv_input_sel;
647   if (input_sel & 0x0001)   return input_port_read_indexed(machine, 5);
648   if (input_sel & 0x0002)   return input_port_read_indexed(machine, 6);
649   if (input_sel & 0x0004)   return input_port_read_indexed(machine, 7);
650   if (input_sel & 0x0008)   return input_port_read_indexed(machine, 8);
649   if (input_sel & 0x0001)   return input_port_read(machine, "KEY0");
650   if (input_sel & 0x0002)   return input_port_read(machine, "KEY1");
651   if (input_sel & 0x0004)   return input_port_read(machine, "KEY2");
652   if (input_sel & 0x0008)   return input_port_read(machine, "KEY3");
651653   logerror("CPU #0 PC %06X: unknown input read: %04X\n",activecpu_get_pc(),input_sel);
652654   return 0xffff;
653655}
r2956r2957
792794static READ16_HANDLER( srmp4_input_r )
793795{
794796   UINT16 input_sel = *ssv_input_sel;
795   if (input_sel & 0x0002)   return input_port_read_indexed(machine, 5);
796   if (input_sel & 0x0004)   return input_port_read_indexed(machine, 6);
797   if (input_sel & 0x0008)   return input_port_read_indexed(machine, 7);
798   if (input_sel & 0x0010)   return input_port_read_indexed(machine, 8);
797   if (input_sel & 0x0002)   return input_port_read(machine, "KEY0");
798   if (input_sel & 0x0004)   return input_port_read(machine, "KEY1");
799   if (input_sel & 0x0008)   return input_port_read(machine, "KEY2");
800   if (input_sel & 0x0010)   return input_port_read(machine, "KEY3");
799801   logerror("CPU #0 PC %06X: unknown input read: %04X\n",activecpu_get_pc(),input_sel);
800802   return 0xffff;
801803}
r2956r2957
841843static READ16_HANDLER( srmp7_input_r )
842844{
843845   UINT16 input_sel = *ssv_input_sel;
844   if (input_sel & 0x0002)   return input_port_read_indexed(machine, 5);
845   if (input_sel & 0x0004)   return input_port_read_indexed(machine, 6);
846   if (input_sel & 0x0008)   return input_port_read_indexed(machine, 7);
847   if (input_sel & 0x0010)   return input_port_read_indexed(machine, 8);
846   if (input_sel & 0x0002)   return input_port_read(machine, "KEY0");
847   if (input_sel & 0x0004)   return input_port_read(machine, "KEY1");
848   if (input_sel & 0x0008)   return input_port_read(machine, "KEY2");
849   if (input_sel & 0x0010)   return input_port_read(machine, "KEY3");
848850   logerror("CPU #0 PC %06X: unknown input read: %04X\n",activecpu_get_pc(),input_sel);
849851   return 0xffff;
850852}
r2956r2957
874876
875877static ADDRESS_MAP_START( survarts_readmem, ADDRESS_SPACE_PROGRAM, 16 )
876878   AM_RANGE(0x210000, 0x210001) AM_READ(watchdog_reset16_r   )   // Watchdog
877//  AM_RANGE(0x290000, 0x290001) AM_READ(SMH_NOP              )   // ?
878//  AM_RANGE(0x2a0000, 0x2a0001) AM_READ(SMH_NOP              )   // ?
879//  AM_RANGE(0x290000, 0x290001) AM_READ(SMH_NOP              ) // ?
880//  AM_RANGE(0x2a0000, 0x2a0001) AM_READ(SMH_NOP              ) // ?
879881
880   AM_RANGE(0x400000, 0x43ffff) AM_READ(SMH_RAM) // dyna
882   AM_RANGE(0x400000, 0x43ffff) AM_READ(SMH_RAM)            // dyna
881883
882   AM_RANGE(0x500008, 0x500009) AM_READ(input_port_5_word_r   )   // Extra Buttons
884   AM_RANGE(0x500008, 0x500009) AM_READ_PORT("ADD_BUTTONS")   // Extra Buttons
883885   SSV_READMEM( 0xf00000 )
884886ADDRESS_MAP_END
885887static ADDRESS_MAP_START( survarts_writemem, ADDRESS_SPACE_PROGRAM, 16 )
886//  AM_RANGE(0x210002, 0x210003) AM_WRITE(SMH_NOP             )   // ? 0,4 at the start
887   AM_RANGE(0x400000, 0x43ffff) AM_WRITE(SMH_RAM) // dyna
888//  AM_RANGE(0x210002, 0x210003) AM_WRITE(SMH_NOP             ) // ? 0,4 at the start
889   AM_RANGE(0x400000, 0x43ffff) AM_WRITE(SMH_RAM)            // dyna
888890
889891   SSV_WRITEMEM
890892ADDRESS_MAP_END
r2956r2957
898900
899901static READ16_HANDLER( sxyreact_ballswitch_r )
900902{
901   return input_port_read_indexed(machine, 5);
903   return input_port_read_safe(machine, "SERVICE", 0);
902904}
903905
904906static READ16_HANDLER( sxyreact_dial_r )
r2956r2957
913915      static int old;
914916
915917      if (data & 0x20)
916         serial = input_port_read_indexed(machine, 6) & 0xff;
918         serial = input_port_read_safe(machine, "PADDLE", 0) & 0xff;
917919
918920      if ( (old & 0x40) && !(data & 0x40) )   // $40 -> $00
919921         serial <<= 1;                  // shift 1 bit
r2956r2957
10711073{
10721074   switch(trackball_select)
10731075   {
1074      case 0x60:   return (input_port_read_indexed(machine, 5) >> 8) & 0xff;
1075      case 0x40:   return (input_port_read_indexed(machine, 5) >> 0) & 0xff;
1076      case 0x60:   return (input_port_read(machine, "TRACKX") >> 8) & 0xff;
1077      case 0x40:   return (input_port_read(machine, "TRACKX") >> 0) & 0xff;
10761078
1077      case 0x70:   return (input_port_read_indexed(machine, 6) >> 8) & 0xff;
1078      case 0x50:   return (input_port_read_indexed(machine, 6) >> 0) & 0xff;
1079      case 0x70:   return (input_port_read(machine, "TRACKY") >> 8) & 0xff;
1080      case 0x50:   return (input_port_read(machine, "TRACKY") >> 0) & 0xff;
10791081   }
10801082   return 0;
10811083}
r2956r2957
11921194   PORT_START_TAG("DSW2")   // IN1 - $210004
11931195   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* Modified below */
11941196
1195   PORT_START_TAG("IN2")   // IN2 - $210008
1197   PORT_START_TAG("P1")   // IN2 - $210008
11961198   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
11971199   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
11981200   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
r2956r2957
12021204   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
12031205   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
12041206
1205   PORT_START_TAG("IN3")   // IN3 - $21000a
1207   PORT_START_TAG("P2")   // IN3 - $21000a
12061208   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
12071209   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
12081210   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
r2956r2957
12121214   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
12131215   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
12141216
1215   PORT_START_TAG("IN4")   // IN4 - $21000c
1217   PORT_START_TAG("SYSTEM")   // IN4 - $21000c
12161218   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
12171219   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
12181220   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
12291231static INPUT_PORTS_START( ssv_mahjong )
12301232   PORT_INCLUDE(ssv_joystick)
12311233
1232   PORT_START_TAG("IN5")   // IN5 - $800002(0)
1234   PORT_START_TAG("KEY0")   // IN5 - $800002(0)
12331235   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
12341236   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
12351237   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
r2956r2957
12391241   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
12401242   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
12411243
1242   PORT_START_TAG("IN6")   // IN6 - $800002(1)
1244   PORT_START_TAG("KEY1")   // IN6 - $800002(1)
12431245   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
12441246   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
12451247   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
r2956r2957
12491251   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
12501252   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
12511253
1252   PORT_START_TAG("IN7")   // IN7 - $800002(2)
1254   PORT_START_TAG("KEY2")   // IN7 - $800002(2)
12531255   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
12541256   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
12551257   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_N )
r2956r2957
12591261   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
12601262   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
12611263
1262   PORT_START_TAG("IN8")   // IN8 - $800002(3)
1264   PORT_START_TAG("KEY3")   // IN8 - $800002(3)
12631265   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
12641266   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
12651267   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_M )
r2956r2957
12961298   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )   /* 8 sec */
12971299   PORT_BIT( 0x00fc, IP_ACTIVE_LOW, IPT_UNKNOWN )      /* Modified below */
12981300
1299   PORT_START_TAG("IN2")   // IN2 - $210008
1301   PORT_START_TAG("P1")   // IN2 - $210008
13001302   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1  )
13011303   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
13021304   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
13061308   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
13071309   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
13081310
1309   PORT_START_TAG("IN3")   // IN3 - $21000a
1311   PORT_START_TAG("P2")   // IN3 - $21000a
13101312   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2  )
13111313   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
13121314   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
13161318   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
13171319   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
13181320
1319   PORT_START_TAG("IN4")   // IN4 - $21000c
1321   PORT_START_TAG("SYSTEM")   // IN4 - $21000c
13201322   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
13211323   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
13221324   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
14861488   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
14871489   PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "DSW2:8" )
14881490
1489   PORT_START   // IN5 - trackball x ($d00000)
1491   PORT_START_TAG("TRACKX")   // IN5 - trackball x ($d00000)
14901492    PORT_BIT( 0x0fff, 0x0000, IPT_TRACKBALL_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_RESET PORT_PLAYER(1)
14911493
1492   PORT_START   // IN6 - trackball y ($d00000)
1494   PORT_START_TAG("TRACKY")   // IN6 - trackball y ($d00000)
14931495    PORT_BIT( 0x0fff, 0x0000, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_RESET PORT_PLAYER(1)
14941496INPUT_PORTS_END
14951497
r2956r2957
15521554   PORT_DIPSETTING(      0x0080, "Light" )
15531555   PORT_DIPSETTING(      0x0000, "Heavy" )
15541556
1555   PORT_START   // IN5 - $540000(0)
1557   PORT_START_TAG("GUNX1")   // IN5 - $540000(0)
15561558   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_SENSITIVITY(35) PORT_KEYDELTA(10) PORT_PLAYER(1)
15571559
1558   PORT_START   // IN6 - $540000(1)
1560   PORT_START_TAG("GUNY1")   // IN6 - $540000(1)
15591561   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_SENSITIVITY(35) PORT_KEYDELTA(10) PORT_PLAYER(1)
15601562
1561   PORT_START   // IN7 - $540000(2)
1563   PORT_START_TAG("GUNX2")   // IN7 - $540000(2)
15621564   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_SENSITIVITY(35) PORT_KEYDELTA(10) PORT_PLAYER(2)
15631565
1564   PORT_START   // IN8 - $540000(3)
1566   PORT_START_TAG("GUNY2")   // IN8 - $540000(3)
15651567   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_SENSITIVITY(35) PORT_KEYDELTA(10) PORT_PLAYER(2)
15661568INPUT_PORTS_END
15671569
r2956r2957
15711573***************************************************************************/
15721574
15731575static INPUT_PORTS_START( hypreact )
1574   PORT_START   // IN0 - $210002
1576   PORT_START_TAG("DSW1")   // IN0 - $210002
15751577   SSV_COINAGE_STANDARD( 0, 0x07, DEF_STR( Coin_A ), "DSWA:1,2,3" )
15761578   SSV_COINAGE_STANDARD( 3, 0x07, DEF_STR( Coin_B ), "DSWA:4,5,6" )
15771579   PORT_DIPNAME( 0x0040, 0x0040, "Half Coins To Continue" )   PORT_DIPLOCATION( "DSWA:7" )
r2956r2957
15811583   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
15821584   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
15831585
1584   PORT_START   // IN1 - $210004
1586   PORT_START_TAG("DSW2")   // IN1 - $210004
15851587   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )      PORT_DIPLOCATION( "DSWB:1" )
15861588   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
15871589   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
15961598   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Controls ) )         PORT_DIPLOCATION( "DSWB:5" )
15971599   PORT_DIPSETTING(      0x0010, "Keyboard" )
15981600   PORT_DIPSETTING(      0x0000, DEF_STR( Joystick ) )
1599   PORT_DIPUNKNOWN_DIPLOC( 0x0020, 0x0020, "DSWB:6" )
1600   PORT_DIPUNKNOWN_DIPLOC( 0x0040, 0x0040, "DSWB:7" )
1601   PORT_DIPNAME( 0x0020, 0x0020, "Multiple coins" )         PORT_DIPLOCATION( "DSWB:6" )
1602   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
1603   PORT_DIPSETTING(      0x0020, DEF_STR( On ) )
1604   PORT_DIPNAME( 0x0040, 0x0040, "Keep Status On Continue" )   PORT_DIPLOCATION( "DSWB:7" )
1605   PORT_DIPSETTING(      0x0000, DEF_STR( No ) )
1606   PORT_DIPSETTING(      0x0040, DEF_STR( Yes ) )
16011607   PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "DSWB:8" )
16021608
1603   PORT_START   // IN2 - $210008 (used in joystick mode)
1609   PORT_START_TAG("P1")   // IN2 - $210008 (used in joystick mode)
16041610   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
16051611   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
16061612   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
r2956r2957
16101616   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
16111617   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   )
16121618
1613   PORT_START   // IN3 - $21000a (used in joystick mode)
1619   PORT_START_TAG("P2")   // IN3 - $21000a (used in joystick mode)
16141620   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
16151621   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
16161622   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
r2956r2957
16201626   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN        )
16211627   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN        )
16221628
1623   PORT_START   // IN4 - $21000c
1629   PORT_START_TAG("SYSTEM")   // IN4 - $21000c
16241630   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
16251631   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
16261632   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )   // service coin & bet
16271633   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
16281634   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
16291635
1630   PORT_START   // IN5 - $c00000(0)
1636   PORT_START_TAG("KEY0")   // IN5 - $c00000(0)
16311637   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_A )
16321638   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_E )
16331639   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_I )
16341640   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_M )
16351641   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
16361642   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START1  )
1637   PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
1643   PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
16381644
1639   PORT_START   // IN6 - $c00000(1)
1645   PORT_START_TAG("KEY1")   // IN6 - $c00000(1)
16401646   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_B )
16411647   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_F )
16421648   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_J )
16431649   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_N )
16441650   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
16451651   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
1646   PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
1652   PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
16471653
1648   PORT_START   // IN7 - $c00000(2)
1654   PORT_START_TAG("KEY2")   // IN7 - $c00000(2)
16491655   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_C )
16501656   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_G )
16511657   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_K )
16521658   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
16531659   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
1654   PORT_BIT( 0xffe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
1660   PORT_BIT( 0xffe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
16551661
1656   PORT_START   // IN8 - $c00000(3)
1662   PORT_START_TAG("KEY3")   // IN8 - $c00000(3)
16571663   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_D )
16581664   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_H )
16591665   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_L )
16601666   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
1661   PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
1667   PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
16621668INPUT_PORTS_END
16631669
16641670
r2956r2957
17021708   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
17031709   PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "DSWB:8" )
17041710
1705   PORT_START   // IN5 - $500000(0)
1711   PORT_START_TAG("KEY0")   // IN5 - $500000(0)
17061712   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_A )
17071713   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_E )
17081714   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_I )
17091715   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_M )
17101716   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
17111717   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START1  )
1712   PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
1718   PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
17131719
1714   PORT_START   // IN6 - $500000(1)
1720   PORT_START_TAG("KEY1")   // IN6 - $500000(1)
17151721   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_B )
17161722   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_F )
17171723   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_J )
17181724   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_N )
17191725   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
1720   PORT_BIT( 0xffe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
1726   PORT_BIT( 0xffe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
17211727
1722   PORT_START   // IN7 - $500000(2)
1728   PORT_START_TAG("KEY2")   // IN7 - $500000(2)
17231729   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_C )
17241730   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_G )
17251731   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_K )
17261732   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
17271733   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
1728   PORT_BIT( 0xffe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
1734   PORT_BIT( 0xffe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
17291735
1730   PORT_START   // IN8 - $500000(3)
1736   PORT_START_TAG("KEY3")   // IN8 - $500000(3)
17311737   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_D )
17321738   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_H )
17331739   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_L )
17341740   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
1735   PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
1741   PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
17361742INPUT_PORTS_END
17371743
17381744
r2956r2957
19611967***************************************************************************/
19621968
19631969static INPUT_PORTS_START( meosism )
1964   PORT_START   // IN0 - $210002
1970   PORT_START_TAG("DSW1")   // IN0 - $210002
19651971   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Coinage ) )      PORT_DIPLOCATION( "DSW1:1,2" )
19661972   PORT_DIPSETTING(      0x0003, "1 Medal/1 Credit" )
19671973   PORT_DIPSETTING(      0x0001, "1 Medal/5 Credits" )
r2956r2957
19861992   PORT_DIPSETTING(      0x0080, DEF_STR( Low ) )
19871993   PORT_DIPSETTING(      0x0000, DEF_STR( High ) )
19881994
1989   PORT_START   // IN1 - $210004
1995   PORT_START_TAG("DSW2")   // IN1 - $210004
19901996   PORT_DIPNAME( 0x0003, 0x0003, "Game Rate" )            PORT_DIPLOCATION( "DSW2:1,2" )
19911997   PORT_DIPSETTING(      0x0000, "80%" )
19921998   PORT_DIPSETTING(      0x0002, "85%" )
r2956r2957
20052011   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
20062012   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
20072013
2008   PORT_START   // IN2 - $210008
2014   PORT_START_TAG("P1")   // IN2 - $210008
20092015   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON4        )   //bet
20102016   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3        )   //stop/r
20112017   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2        )   //stop/c
r2956r2957
20152021   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_START1         )   //start
20162022   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN        )   //-
20172023
2018   PORT_START   // IN3 - $21000a
2024   PORT_START_TAG("P2")   // IN3 - $21000a
20192025   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )   //-
20202026   PORT_SERVICE_NO_TOGGLE( 0x0002, IP_ACTIVE_LOW )
20212027   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN  )   //-
r2956r2957
20252031   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )   //-
20262032   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )   //-
20272033
2028   PORT_START   // IN4 - $21000c
2034   PORT_START_TAG("SYSTEM")   // IN4 - $21000c
20292035   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
20302036   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
20312037   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )   //service coin
r2956r2957
21512157***************************************************************************/
21522158
21532159static INPUT_PORTS_START( srmp7 )
2154   PORT_START   // IN0 - $210002
2160   PORT_START_TAG("DSW1")   // IN0 - $210002
21552161   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) )         PORT_DIPLOCATION( "DSW1:1,2,3" )
21562162   PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
21572163   PORT_DIPSETTING(      0x0001, DEF_STR( 4C_1C ) )
r2956r2957
21712177   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
21722178   PORT_DIPSETTING(      0x0080, DEF_STR( On ) )
21732179
2174   PORT_START   // IN1 - $210004
2180   PORT_START_TAG("DSW2")   // IN1 - $210004
21752181   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Difficulty ) )      PORT_DIPLOCATION( "DSW2:1,2,3" )
21762182   PORT_DIPSETTING(      0x0006, DEF_STR( Easiest ) )
21772183   PORT_DIPSETTING(      0x0005, DEF_STR( Easier ) )
r2956r2957
21952201   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
21962202   PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "DSW2:8" )
21972203
2198   PORT_START   // IN2 - $210008
2204   PORT_START_TAG("P1")   // IN2 - $210008
21992205   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )
22002206
2201   PORT_START   // IN3 - $21000a
2207   PORT_START_TAG("P2")   // IN3 - $21000a
22022208   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNKNOWN )
22032209
2204   PORT_START   // IN4 - $21000c
2210   PORT_START_TAG("SYSTEM")   // IN4 - $21000c
22052211   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(10)
22062212   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(10)
22072213   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
22092215   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )   // tested
22102216   PORT_BIT( 0x00e0, IP_ACTIVE_LOW, IPT_UNKNOWN  )
22112217
2212   PORT_START   // IN6 - $600000(0)
2218   PORT_START_TAG("KEY0")   // IN6 - $600000(0)
22132219   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
22142220   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
22152221   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
r2956r2957
22192225   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
22202226   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
22212227
2222   PORT_START   // IN7 - $600000(1)
2228   PORT_START_TAG("KEY1")   // IN7 - $600000(1)
22232229   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
22242230   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
22252231   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_N )
r2956r2957
22292235   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
22302236   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
22312237
2232   PORT_START   // IN8 - $600000(2)
2238   PORT_START_TAG("KEY2")   // IN8 - $600000(2)
22332239   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
22342240   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
22352241   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_M )
r2956r2957
22392245   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
22402246   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
22412247
2242   PORT_START   // IN5 - $600000(3)
2248   PORT_START_TAG("KEY3")   // IN5 - $600000(3)
22432249   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
22442250   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
22452251   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
r2956r2957
23272333   PORT_DIPSETTING(      0x0080, "Heavy" )
23282334   PORT_DIPSETTING(      0x0000, "Heaviest" )
23292335
2330   PORT_START   // IN5 - $500008
2336   PORT_START_TAG("ADD_BUTTONS")   // IN5 - $500008
23312337   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
23322338   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
23332339   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
r2956r2957
23802386   PORT_SERVICE_DIPLOC( 0x0040, IP_ACTIVE_LOW, "DSW2:7" )
23812387   PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "DSW2:8" )
23822388
2383   PORT_START   // IN5 - $500002
2389   PORT_START_TAG("SERVICE")   // IN5 - $500002
23842390   PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_SERVICE2 )   // ball switch on -> handle motor off
23852391
2386   PORT_START   // IN6 - $500004
2392   PORT_START_TAG("PADDLE")   // IN6 - $500004
23872393   PORT_BIT( 0xff, 0x00, IPT_PADDLE ) PORT_MINMAX(0,0xcf) PORT_SENSITIVITY(15) PORT_KEYDELTA(15) PORT_CENTERDELTA(0) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M)
23882394INPUT_PORTS_END
23892395
r2956r2957
24252431   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
24262432   PORT_SERVICE_DIPLOC( 0x0080, IP_ACTIVE_LOW, "DSW2:8" )
24272433
2428   PORT_MODIFY("IN4")   // IN4 - $21000c
2434   PORT_MODIFY("SYSTEM")   // IN4 - $21000c
24292435   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE2 )
24302436   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE4 )
24312437   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_START3 )
src/mame/drivers/tceptor.c
r2956r2957
150150
151151static READ8_HANDLER( dsw0_r )
152152{
153   return fix_input0(input_port_read_indexed(machine, 0), input_port_read_indexed(machine, 1));
153   return fix_input0(input_port_read(machine, "DSW1"), input_port_read(machine, "DSW2"));
154154}
155155
156156static READ8_HANDLER( dsw1_r )
157157{
158   return fix_input1(input_port_read_indexed(machine, 0), input_port_read_indexed(machine, 1));
158   return fix_input1(input_port_read(machine, "DSW1"), input_port_read(machine, "DSW2"));
159159}
160160
161161static READ8_HANDLER( input0_r )
162162{
163   return fix_input0(input_port_read_indexed(machine, 2), input_port_read_indexed(machine, 3));
163   return fix_input0(input_port_read(machine, "BUTTONS"), input_port_read(machine, "SERVICE"));
164164}
165165
166166static READ8_HANDLER( input1_r )
167167{
168   return fix_input1(input_port_read_indexed(machine, 2), input_port_read_indexed(machine, 3));
168   return fix_input1(input_port_read(machine, "BUTTONS"), input_port_read(machine, "SERVICE"));
169169}
170170
171171static READ8_HANDLER( readFF )
r2956r2957
183183   AM_RANGE(0x4000, 0x43ff) AM_READWRITE(namcos1_cus30_r, namcos1_cus30_w)
184184   AM_RANGE(0x4800, 0x4800) AM_WRITE(SMH_NOP)            // 3D scope left/right?
185185   AM_RANGE(0x4f00, 0x4f00) AM_READ(SMH_NOP)            // unknown
186   AM_RANGE(0x4f01, 0x4f01) AM_READ(input_port_4_r)      // analog input (accel)
187   AM_RANGE(0x4f02, 0x4f02) AM_READ(input_port_5_r)      // analog input (left/right)
188   AM_RANGE(0x4f03, 0x4f03) AM_READ(input_port_6_r)      // analog input (up/down)
186   AM_RANGE(0x4f01, 0x4f01) AM_READ_PORT("PEDAL")         // analog input (accel)
187   AM_RANGE(0x4f02, 0x4f02) AM_READ_PORT("STICKX")         // analog input (left/right)
188   AM_RANGE(0x4f03, 0x4f03) AM_READ_PORT("STICKY")         // analog input (up/down)
189189   AM_RANGE(0x4f00, 0x4f03) AM_WRITE(SMH_NOP)            // analog input control?
190190   AM_RANGE(0x5000, 0x5006) AM_WRITE(tceptor_bg_scroll_w)   // bg scroll
191191   AM_RANGE(0x6000, 0x7fff) AM_RAM AM_SHARE(1) AM_BASE(&m68k_shared_ram) // COM RAM
r2956r2957
259259/*******************************************************************/
260260
261261static INPUT_PORTS_START( tceptor )
262   PORT_START      /* DSW 1 */
262   PORT_START_TAG("DSW1")   /* DSW 1 */
263263   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
264264   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
265265   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
r2956r2957
282282   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
283283   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
284284
285   PORT_START      /* DSW 2 */
285   PORT_START_TAG("DSW2")   /* DSW 2 */
286286   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
287287   PORT_DIPSETTING(    0x02, "A" )
288288   PORT_DIPSETTING(    0x03, "B" )
r2956r2957
290290   PORT_DIPSETTING(    0x00, "D" )
291291   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNKNOWN )
292292
293   PORT_START      /* Memory Mapped Port */
293   PORT_START_TAG("BUTTONS")   /* Memory Mapped Port */
294294   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )   // shot
295295   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )   // bomb
296296   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )   // shot
297297   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 )   // bomb
298298   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
299299
300   PORT_START      /* Memory Mapped Port */
300   PORT_START_TAG("SERVICE")   /* Memory Mapped Port */
301301   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 )
302302   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 )
303303   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )      // TEST SW
304304   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
305305   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
306306
307   PORT_START   /* ADC0809 - 8 CHANNEL ANALOG - CHANNEL 1 */
307   PORT_START_TAG("PEDAL")   /* ADC0809 - 8 CHANNEL ANALOG - CHANNEL 1 */
308308   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0xd6) PORT_SENSITIVITY(100) PORT_KEYDELTA(16) PORT_CODE_INC(KEYCODE_Z)
309309
310   PORT_START   /* ADC0809 - 8 CHANNEL ANALOG - CHANNEL 2 */
310   PORT_START_TAG("STICKX")   /* ADC0809 - 8 CHANNEL ANALOG - CHANNEL 2 */
311311   PORT_BIT(  0xff, 0x7f, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xfe) PORT_SENSITIVITY(100) PORT_KEYDELTA(16)
312312
313   PORT_START   /* ADC08090 - 8 CHANNEL ANALOG - CHANNEL 3 */
313   PORT_START_TAG("STICKY")   /* ADC08090 - 8 CHANNEL ANALOG - CHANNEL 3 */
314314   PORT_BIT(  0xff, 0x7f, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xfe) PORT_SENSITIVITY(100) PORT_KEYDELTA(16)
315315INPUT_PORTS_END
316316
317317static INPUT_PORTS_START( tceptor2 )
318   PORT_START      /* DSW 1 */
319   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
320   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
321   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
322   PORT_DIPSETTING(    0x01, DEF_STR( 3C_2C ) )
323   PORT_DIPSETTING(    0x00, DEF_STR( 4C_3C ) )
324   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
325   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
326   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
327   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
328   PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) )
329   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
330   PORT_DIPSETTING(    0x08, DEF_STR( 3C_2C ) )
331   PORT_DIPSETTING(    0x00, DEF_STR( 4C_3C ) )
332   PORT_DIPSETTING(    0x18, DEF_STR( 1C_1C ) )
333   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) )
334   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
335   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
336   PORT_DIPNAME( 0x40, 0x40, "Freeze" )
337   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
338   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
339   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
318   PORT_INCLUDE( tceptor )
340319
341   PORT_START      /* DSW 2 */
342   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
343   PORT_DIPSETTING(    0x02, "A" )
344   PORT_DIPSETTING(    0x03, "B" )
345   PORT_DIPSETTING(    0x01, "C" )
346   PORT_DIPSETTING(    0x00, "D" )
320   PORT_MODIFY("DSW2")
347321   PORT_DIPNAME( 0x04, 0x04, "MODE" )
348322   PORT_DIPSETTING(    0x00, "2D" )
349323   PORT_DIPSETTING(    0x04, "3D" )
350324   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNKNOWN )
351
352   PORT_START      /* Memory Mapped Port */
353   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )   // shot
354   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )   // bomb
355   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )   // shot
356   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 )   // bomb
357   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
358
359   PORT_START      /* Memory Mapped Port */
360   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 )
361   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 )
362   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )      // TEST SW
363   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
364   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
365
366   PORT_START   /* ADC0809 - 8 CHANNEL ANALOG - CHANNEL 1 */
367   PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0xd6) PORT_SENSITIVITY(100) PORT_KEYDELTA(16) PORT_CODE_INC(KEYCODE_Z)
368
369   PORT_START   /* ADC0809 - 8 CHANNEL ANALOG - CHANNEL 2 */
370   PORT_BIT(  0xff, 0x7f, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xfe) PORT_SENSITIVITY(100) PORT_KEYDELTA(16)
371
372   PORT_START   /* ADC08090 - 8 CHANNEL ANALOG - CHANNEL 3 */
373   PORT_BIT(  0xff, 0x7f, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xfe) PORT_SENSITIVITY(100) PORT_KEYDELTA(16)
374325INPUT_PORTS_END
375326
376327
src/mame/drivers/shadfrce.c
r2956r2957
191191   switch (offset)
192192   {
193193      case 0 :
194         data = (input_port_read_indexed(machine, 0) & 0xff) | ((input_port_read_indexed(machine, 7) & 0xc0) << 6) | ((input_port_read_indexed(machine, 4) & 0x0f) << 8);
194         data = (input_port_read(machine, "P1") & 0xff) | ((input_port_read(machine, "DSW2") & 0xc0) << 6) | ((input_port_read(machine, "SYSTEM") & 0x0f) << 8);
195195         break;
196196      case 1 :
197         data = (input_port_read_indexed(machine, 1) & 0xff) | ((input_port_read_indexed(machine, 7) & 0x3f) << 8);
197         data = (input_port_read(machine, "P2") & 0xff) | ((input_port_read(machine, "DSW2") & 0x3f) << 8);
198198         break;
199199      case 2 :
200         data = (input_port_read_indexed(machine, 2) & 0xff) | ((input_port_read_indexed(machine, 6) & 0x3f) << 8);
200         data = (input_port_read(machine, "EXTRA") & 0xff) | ((input_port_read(machine, "DSW1") & 0x3f) << 8);
201201         break;
202202      case 3 :
203         data = (input_port_read_indexed(machine, 3) & 0xff) | ((input_port_read_indexed(machine, 6) & 0xc0) << 2) | ((input_port_read_indexed(machine, 5) & 0x3c) << 8);
203         data = (input_port_read(machine, "OTHER") & 0xff) | ((input_port_read(machine, "DSW1") & 0xc0) << 2) | ((input_port_read(machine, "MISC") & 0x3c) << 8);
204204         break;
205205   }
206206
r2956r2957
242242#if USE_SHADFRCE_FAKE_INPUT_PORTS
243243   AM_RANGE(0x1d0020, 0x1d0027) AM_READ(shadfrce_input_ports_r)
244244#else
245   AM_RANGE(0x1d0020, 0x1d0021) AM_READ(input_port_0_word_r)
246   AM_RANGE(0x1d0022, 0x1d0023) AM_READ(input_port_1_word_r)
247   AM_RANGE(0x1d0024, 0x1d0025) AM_READ(input_port_2_word_r)
248   AM_RANGE(0x1d0026, 0x1d0027) AM_READ(input_port_3_word_r)
245   AM_RANGE(0x1d0020, 0x1d0021) AM_READ_PORT("IN0")
246   AM_RANGE(0x1d0022, 0x1d0023) AM_READ_PORT("IN1")
247   AM_RANGE(0x1d0024, 0x1d0025) AM_READ_PORT("IN2")
248   AM_RANGE(0x1d0026, 0x1d0027) AM_READ_PORT("IN3")
249249#endif
250250   AM_RANGE(0x1F0000, 0x1FFFFF) AM_READ(SMH_RAM)
251251ADDRESS_MAP_END
r2956r2957
323323
324324#if USE_SHADFRCE_FAKE_INPUT_PORTS
325325static INPUT_PORTS_START( shadfrce )
326   PORT_START   /* Fake IN0 (player 1 inputs) */
326   PORT_START_TAG("P1")   /* Fake IN0 (player 1 inputs) */
327327   SHADFRCE_PLAYER_INPUT( 1, IPT_START1 )
328328
329   PORT_START   /* Fake IN1 (player 2 inputs) */
329   PORT_START_TAG("P2")   /* Fake IN1 (player 2 inputs) */
330330   SHADFRCE_PLAYER_INPUT( 2, IPT_START2 )
331331
332   PORT_START   /* Fake IN2 (players 1 & 2 extra inputs */
332   PORT_START_TAG("EXTRA")   /* Fake IN2 (players 1 & 2 extra inputs */
333333   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
334334   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
335335   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
r2956r2957
339339   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
340340   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
341341
342   PORT_START   /* Fake IN3 (other extra inputs ?) */
342   PORT_START_TAG("OTHER")   /* Fake IN3 (other extra inputs ?) */
343343   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
344344
345   PORT_START   /* Fake IN4 (system inputs) */
345   PORT_START_TAG("SYSTEM")   /* Fake IN4 (system inputs) */
346346   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
347347   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )                   /* only in "test mode" ? */
348348   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )                /* only in "test mode" ? */
349349   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
350350
351   PORT_START   /* Fake IN5 (misc) */
351   PORT_START_TAG("MISC")   /* Fake IN5 (misc) */
352352   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_VBLANK )                  /* guess */
353353   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )                 /* must be ACTIVE_LOW or 'shadfrcj' jumps to the end (code at 0x04902e) */
354354   PORT_BIT( 0xeb, IP_ACTIVE_LOW, IPT_UNUSED )
355355
356   PORT_START   /* Fake IN6 (DIP1) */
356   PORT_START_TAG("DSW1")   /* Fake IN6 (DIP1) */
357357   PORT_DIPNAME( 0x01, 0x01, "Unused DIP 1-1" )
358358   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
359359   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
376376   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
377377   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
378378
379   PORT_START   /* Fake IN7 (DIP2) */
379   PORT_START_TAG("DSW2")   /* Fake IN7 (DIP2) */
380380   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
381381   PORT_DIPSETTING(    0x01, DEF_STR( Easy ) )
382382   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )
r2956r2957
402402INPUT_PORTS_END
403403#else
404404static INPUT_PORTS_START( shadfrce )
405   PORT_START   /* IN0 - $1d0020.w */
405   PORT_START_TAG("IN0")   /* IN0 - $1d0020.w */
406406   SHADFRCE_PLAYER_INPUT( 1, IPT_START1 )
407407   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 )
408408   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN2 )                 /* only in "test mode" ? */
r2956r2957
417417   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
418418   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
419419
420   PORT_START   /* IN1 - $1d0022.w */
420   PORT_START_TAG("IN1")   /* IN1 - $1d0022.w */
421421   SHADFRCE_PLAYER_INPUT( 2, IPT_START2 )
422422   PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Difficulty ) )
423423   PORT_DIPSETTING(      0x0100, DEF_STR( Easy ) )
r2956r2957
438438   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
439439   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
440440
441   PORT_START   /* IN2 - $1d0024.w */
441   PORT_START_TAG("IN2")   /* IN2 - $1d0024.w */
442442   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
443443   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
444444   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
r2956r2957
467467   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
468468   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
469469
470   PORT_START   /* IN3 - $1d0026.w */
470   PORT_START_TAG("IN3")   /* IN3 - $1d0026.w */
471471   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED )
472472   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNUSED )
473473   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED )
src/mame/drivers/spdodgeb.c
r2956r2957
111111   int p,j;
112112
113113   /* update running state */
114   for (p = 0;p <= 1;p++)
114   for (p = 0; p <= 1; p++)
115115   {
116116      static int prev[2][2],countup[2][2],countdown[2][2];
117117      int curr[2][2];
118118
119      curr[p][0] = input_port_read_indexed(machine, 2+p) & 0x01;
120      curr[p][1] = input_port_read_indexed(machine, 2+p) & 0x02;
119      curr[p][0] = input_port_read(machine, p ? "P2" : "P1") & 0x01;
120      curr[p][1] = input_port_read(machine, p ? "P2" : "P1") & 0x02;
121121
122122      for (j = 0;j <= 1;j++)
123123      {
r2956r2957
147147   }
148148
149149   /* update jumping and buttons state */
150   for (p = 0;p <= 1;p++)
150   for (p = 0; p <= 1; p++)
151151   {
152152      static int prev[2];
153153      int curr[2];
154154
155      curr[p] = input_port_read_indexed(machine, 2+p) & 0x30;
155      curr[p] = input_port_read(machine, p ? "P2" : "P1") & 0x30;
156156
157157      if (jumped[p]) buttons[p] = 0;   /* jump only momentarily flips the buttons */
158158      else buttons[p] = curr[p];
r2956r2957
163163      prev[p] = curr[p];
164164   }
165165
166   inputs[0] = input_port_read_indexed(machine, 2) & 0xcf;
167   inputs[1] = input_port_read_indexed(machine, 3) & 0x0f;
166   inputs[0] = input_port_read(machine, "P1") & 0xcf;
167   inputs[1] = input_port_read(machine, "P2") & 0x0f;
168168   inputs[2] = running[0] | buttons[0];
169169   inputs[3] = running[1] | buttons[1];
170170}
r2956r2957
187187
188188   for (p=0; p<=1; p++)
189189   {
190      curr_port[p] = input_port_read_indexed(machine, p+2);
190      curr_port[p] = input_port_read(machine, p ? "P2" : "P1");
191191      curr_dash[p] = 0;
192192
193193      if (curr_port[p] & R)
r2956r2957
242242      case 1: return inputs[1];
243243      case 2: return inputs[2];
244244      case 3: return inputs[3];
245      case 4: return input_port_read_indexed(machine, 4);
245      case 4: return input_port_read(machine, "IN1");
246246   }
247247}
248248
r2956r2957
256256
257257static READ8_HANDLER( port_0_r )
258258{
259   int port = input_port_read_indexed(machine, 0);
259   int port = input_port_read(machine, "IN0");
260260
261261   toggle^=0x02;   /* mcu63701_busy flag */
262262
r2956r2957
269269   AM_RANGE(0x0000, 0x0fff) AM_READ(SMH_RAM)
270270   AM_RANGE(0x2000, 0x2fff) AM_READ(SMH_RAM)
271271   AM_RANGE(0x3000, 0x3000) AM_READ(port_0_r)
272   AM_RANGE(0x3001, 0x3001) AM_READ(input_port_1_r)   /* DIPs */
272   AM_RANGE(0x3001, 0x3001) AM_READ_PORT("DSW")   /* DIPs */
273273   AM_RANGE(0x3801, 0x3805) AM_READ(mcu63701_r)
274274   AM_RANGE(0x4000, 0x7fff) AM_READ(SMH_BANK1)
275275   AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
r2956r2957
284284   AM_RANGE(0x3002, 0x3002) AM_WRITE(sound_command_w)
285285//  AM_RANGE(0x3003, 0x3003) AM_WRITE(SMH_RAM)
286286   AM_RANGE(0x3004, 0x3004) AM_WRITE(spdodgeb_scrollx_lo_w)
287//  AM_RANGE(0x3005, 0x3005) AM_WRITE(SMH_RAM) /* mcu63701_output_w */
287//  AM_RANGE(0x3005, 0x3005) AM_WRITE(SMH_RAM)          /* mcu63701_output_w */
288288   AM_RANGE(0x3006, 0x3006) AM_WRITE(spdodgeb_ctrl_w)   /* scroll hi, flip screen, bank switch, palette select */
289289   AM_RANGE(0x3800, 0x3800) AM_WRITE(mcu63701_w)
290290   AM_RANGE(0x4000, 0xffff) AM_WRITE(SMH_ROM)
r2956r2957
306306
307307
308308static INPUT_PORTS_START( spdodgeb )
309   PORT_START
309   PORT_START_TAG("IN0")
310310   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_VBLANK )
311311   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* mcu63701_busy flag */
312312   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
319319   PORT_DIPSETTING(    0x40, DEF_STR( Hard ))
320320   PORT_DIPSETTING(    0x00, DEF_STR( Very_Hard ))
321321
322   PORT_START
322   PORT_START_TAG("DSW")
323323   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
324324   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
325325   PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) )
r2956r2957
345345   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
346346   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
347347
348   PORT_START
348   PORT_START_TAG("P1")
349349   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
350350   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
351351   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
355355   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1 )
356356   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START2 )
357357
358   PORT_START
358   PORT_START_TAG("P2")
359359   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
360360   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
361361   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
365365   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
366366   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
367367
368   PORT_START
368   PORT_START_TAG("IN1")
369369   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNKNOWN )
370370   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN )
371371   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )
src/mame/drivers/turbo.c
r2956r2957
490490      {
491491         /* read sensor RAM */
492492         case 0x40:
493            result = ~input_port_read_indexed(machine, 1);  /* DSW 1 - inverted! */
493            result = ~input_port_read(machine, "DSW1");  /* DSW 1 - inverted! */
494494            break;
495495
496496         /* read display RAM */
r2956r2957
625625{
626626   turbo_state *state = machine->driver_data;
627627   video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen));
628   return input_port_read_indexed(machine, 3) | (state->turbo_collision & 15);
628   return input_port_read(machine, "DSW3") | (state->turbo_collision & 15);
629629}
630630
631631
r2956r2957
640640static READ8_HANDLER( turbo_analog_r )
641641{
642642   turbo_state *state = machine->driver_data;
643   return input_port_read_indexed(machine, 4) - state->turbo_last_analog;
643   return input_port_read(machine, "DIAL") - state->turbo_last_analog;
644644}
645645
646646
647647static WRITE8_HANDLER( turbo_analog_reset_w )
648648{
649649   turbo_state *state = machine->driver_data;
650   state->turbo_last_analog = input_port_read_indexed(machine, 4);
650   state->turbo_last_analog = input_port_read(machine, "DIAL");
651651}
652652
653653
r2956r2957
686686
687687static READ8_HANDLER( buckrog_port_2_r )
688688{
689   int inp1 = input_port_read_indexed(machine, 2);
690   int inp2 = input_port_read_indexed(machine, 3);
689   int inp1 = input_port_read(machine, "DSW1");
690   int inp2 = input_port_read(machine, "DSW2");
691691
692692   return  (((inp2 >> 6) & 1) << 7) |
693693         (((inp2 >> 4) & 1) << 6) |
r2956r2957
702702
703703static READ8_HANDLER( buckrog_port_3_r )
704704{
705   int inp1 = input_port_read_indexed(machine, 2);
706   int inp2 = input_port_read_indexed(machine, 3);
705   int inp1 = input_port_read(machine, "DSW1");
706   int inp2 = input_port_read(machine, "DSW2");
707707
708708   return  (((inp2 >> 7) & 1) << 7) |
709709         (((inp2 >> 5) & 1) << 6) |
r2956r2957
751751   AM_RANGE(0xfa00, 0xfa03) AM_MIRROR(0x00fc) AM_DEVREADWRITE(PPI8255, "ppi8255_2", ppi8255_r, ppi8255_w)
752752   AM_RANGE(0xfb00, 0xfb03) AM_MIRROR(0x00fc) AM_DEVREADWRITE(PPI8255, "ppi8255_3", ppi8255_r, ppi8255_w)
753753   AM_RANGE(0xfc00, 0xfc01) AM_MIRROR(0x00fe) AM_READWRITE(turbo_8279_r, turbo_8279_w)
754   AM_RANGE(0xfd00, 0xfdff) AM_READ(input_port_0_r)
754   AM_RANGE(0xfd00, 0xfdff) AM_READ_PORT("INPUT")
755755   AM_RANGE(0xfe00, 0xfeff) AM_READ(turbo_collision_r)
756756ADDRESS_MAP_END
757757
r2956r2957
767767   AM_RANGE(0x0000, 0x9fff) AM_ROM
768768   AM_RANGE(0xa000, 0xa3ff) AM_RAM AM_BASE_MEMBER(turbo_state, sprite_position)   // CONT RAM
769769   AM_RANGE(0xa400, 0xa7ff) AM_RAM AM_BASE_MEMBER(turbo_state, spriteram)         // CONT RAM
770   AM_RANGE(0xa800, 0xa800) AM_MIRROR(0x07fc) AM_READ(input_port_0_r)            // INPUT 253
771   AM_RANGE(0xa801, 0xa801) AM_MIRROR(0x07fc) AM_READ(input_port_1_r)            // INPUT 253
772   AM_RANGE(0xa802, 0xa802) AM_MIRROR(0x07fc) AM_READ(input_port_2_r)            // INPUT 253
773   AM_RANGE(0xa803, 0xa803) AM_MIRROR(0x07fc) AM_READ(input_port_3_r)            // INPUT 253
770   AM_RANGE(0xa800, 0xa800) AM_MIRROR(0x07fc) AM_READ_PORT("IN0")               // INPUT 253
771   AM_RANGE(0xa801, 0xa801) AM_MIRROR(0x07fc) AM_READ_PORT("IN1")               // INPUT 253
772   AM_RANGE(0xa802, 0xa802) AM_MIRROR(0x07fc) AM_READ_PORT("DSW2")               // INPUT 253
773   AM_RANGE(0xa803, 0xa803) AM_MIRROR(0x07fc) AM_READ_PORT("DSW3")               // INPUT 253
774774   AM_RANGE(0xb000, 0xb7ff) AM_RAM                                     // SCRATCH
775775   AM_RANGE(0xb800, 0xbfff)                                           // HANDLE CL
776776   AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(turbo_videoram_w) AM_BASE_MEMBER(turbo_state, videoram)   // FIX PAGE
r2956r2957
796796   AM_RANGE(0xd800, 0xd801) AM_MIRROR(0x07fe) AM_READWRITE(turbo_8279_r, turbo_8279_w)         // 8279
797797   AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_BASE_MEMBER(turbo_state, sprite_position)            // CONT RAM
798798   AM_RANGE(0xe400, 0xe7ff) AM_RAM AM_BASE_MEMBER(turbo_state, spriteram)                  // CONT RAM
799   AM_RANGE(0xe800, 0xe800) AM_MIRROR(0x07fc) AM_READ(input_port_0_r)                     // INPUT
800   AM_RANGE(0xe801, 0xe801) AM_MIRROR(0x07fc) AM_READ(input_port_1_r)
799   AM_RANGE(0xe800, 0xe800) AM_MIRROR(0x07fc) AM_READ_PORT("IN0")                        // INPUT
800   AM_RANGE(0xe801, 0xe801) AM_MIRROR(0x07fc) AM_READ_PORT("IN1")
801801   AM_RANGE(0xe802, 0xe802) AM_MIRROR(0x07fc) AM_READ(buckrog_port_2_r)
802802   AM_RANGE(0xe803, 0xe803) AM_MIRROR(0x07fc) AM_READ(buckrog_port_3_r)
803803   AM_RANGE(0xf000, 0xf000)
r2956r2957
826826 *************************************/
827827
828828static INPUT_PORTS_START( turbo )
829   PORT_START      /* IN0 */
829   PORT_START_TAG("INPUT")   /* IN0 */
830830   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )            /* ACCEL B */
831831   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )            /* ACCEL A */
832832   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_TOGGLE   /* SHIFT */
r2956r2957
836836   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
837837   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
838838
839   PORT_START   /* DSW 1 */
839   PORT_START_TAG("DSW1")   /* DSW 1 */
840840   PORT_DIPNAME( 0x03, 0x03, "Car On Extended Play" ) PORT_DIPLOCATION("SW1:1,2")
841841   PORT_DIPSETTING(    0x00, "1" )
842842   PORT_DIPSETTING(    0x01, "2" )
r2956r2957
861861   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
862862   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
863863
864   PORT_START   /* DSW 2 */
864   PORT_START_TAG("DSW2")   /* DSW 2 */
865865   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Game_Time ) ) PORT_DIPLOCATION("SW2:1,2")
866866   PORT_DIPSETTING(    0x00, "60 seconds" )
867867   PORT_DIPSETTING(    0x01, "70 seconds" )
r2956r2957
886886   PORT_DIPSETTING(   0x40, DEF_STR( 1C_3C ))
887887   PORT_DIPSETTING(   0x60, DEF_STR( 1C_6C ))
888888
889   PORT_START   /* Collision and DSW 3 */
889   PORT_START_TAG("DSW3")   /* Collision and DSW 3 */
890890   PORT_BIT( 0x0f,     0x00, IPT_SPECIAL )   /* Merged with collision bits */
891891   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:1")
892892   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
r2956r2957
901901   PORT_DIPSETTING(   0x80, DEF_STR( Upright ) )
902902   PORT_DIPSETTING(   0x00, "Cockpit")
903903
904   PORT_START      /* IN0 */
904   PORT_START_TAG("DIAL")   /* IN0 */
905905   PORT_BIT( 0xff, 0, IPT_DIAL ) PORT_SENSITIVITY(10) PORT_KEYDELTA(30)
906906
907907   /* this is actually a variable resistor */
r2956r2957
915915
916916
917917static INPUT_PORTS_START( subroc3d )
918   PORT_START
918   PORT_START_TAG("IN0")
919919   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
920920   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
921921
922   PORT_START
922   PORT_START_TAG("IN1")
923923   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
924924   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
925925   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
r2956r2957
929929   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
930930   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
931931
932   PORT_START  /* DSW 2 */
932   PORT_START_TAG("DSW2")  /* DSW 2 */
933933   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_A )) PORT_DIPLOCATION("SW2:1,2,3")
934934   PORT_DIPSETTING(    0x07, DEF_STR( 5C_1C ) )
935935   PORT_DIPSETTING(    0x06, DEF_STR( 4C_1C ) )
r2956r2957
954954   PORT_DIPSETTING(    0x80, "4" )
955955   PORT_DIPSETTING(    0xc0, "5" )
956956
957   PORT_START  /* DSW 3 */
957   PORT_START_TAG("DSW3")  /* DSW 3 */
958958   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW3:1,2")
959959   PORT_DIPSETTING(    0x00, "20000" )
960960   PORT_DIPSETTING(    0x01, "40000" )
r2956r2957
979979   PORT_DIPSETTING(    0x00, "Endless" )
980980   PORT_DIPSETTING(    0x80, DEF_STR( Normal ) )
981981
982   PORT_START  /* DSW 1 */               /* Unused */
982   PORT_START_TAG("DSW1")  /* DSW 1 */               /* Unused */
983983INPUT_PORTS_END
984984
985985
986986static INPUT_PORTS_START( buckrog )
987   PORT_START
987   PORT_START_TAG("IN0")
988988   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
989989   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) // Accel Hi
990990   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) // Accel Lo
991991   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
992992   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
993993
994   PORT_START /* Inputs */
994   PORT_START_TAG("IN1")   /* Inputs */
995995   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
996996   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
997997   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
r2956r2957
10011001   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
10021002   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
10031003
1004   PORT_START  /* DSW 1 */
1004   PORT_START_TAG("DSW1")  /* DSW 1 */
10051005   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_A )) PORT_DIPLOCATION("SW1:1,2,3")
10061006   PORT_DIPSETTING(    0x07, DEF_STR( 5C_1C ) )
10071007   PORT_DIPSETTING(    0x06, DEF_STR( 4C_1C ) )
r2956r2957
10271027   PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
10281028   PORT_DIPSETTING( 0x00, DEF_STR( On ) )
10291029
1030
1031   PORT_START  /* DSW 2 */
1030   PORT_START_TAG("DSW2")  /* DSW 2 */
10321031   PORT_DIPNAME( 0x01, 0x00, "Collisions" ) PORT_DIPLOCATION("SW2:1")
10331032   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
10341033   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
src/mame/drivers/seta.c
r2956r2957
15221522/* DSW reading for 16 bit CPUs */
15231523static READ16_HANDLER( seta_dsw_r )
15241524{
1525   UINT16 dsw = input_port_read_indexed(machine, 3);
1525   UINT16 dsw = input_port_read(machine, "DSW");
15261526   if (offset == 0)   return (dsw >> 8) & 0xff;
15271527   else            return (dsw >> 0) & 0xff;
15281528}
r2956r2957
15321532
15331533static READ8_HANDLER( dsw1_r )
15341534{
1535   return (input_port_read_indexed(machine, 3) >> 8) & 0xff;
1535   return (input_port_read(machine, "DSW") >> 8) & 0xff;
15361536}
15371537
15381538static READ8_HANDLER( dsw2_r )
15391539{
1540   return (input_port_read_indexed(machine, 3) >> 0) & 0xff;
1540   return (input_port_read(machine, "DSW") >> 0) & 0xff;
15411541}
15421542
15431543
r2956r2957
16211621   AM_RANGE(0x000000, 0x09ffff) AM_READ(SMH_ROM            )   // ROM
16221622   AM_RANGE(0x100000, 0x103fff) AM_READ(seta_sound_word_r      )   // Sound
16231623   AM_RANGE(0x200000, 0x200001) AM_READ(SMH_NOP            )   // watchdog? (twineagl)
1624   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r         )   // DSW
1624   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r            )   // DSW
16251625   AM_RANGE(0x700000, 0x7003ff) AM_READ(SMH_RAM            )   // Palette
16261626   AM_RANGE(0x900000, 0x901fff) AM_READ(SMH_RAM            )   // VRAM
16271627   AM_RANGE(0x902000, 0x903fff) AM_READ(SMH_RAM            )   // VRAM
r2956r2957
16351635   AM_RANGE(0x000000, 0x09ffff) AM_WRITE(SMH_ROM                  )   // ROM
16361636   AM_RANGE(0x100000, 0x103fff) AM_WRITE(seta_sound_word_w            )   // Sound
16371637   AM_RANGE(0x200000, 0x200001) AM_WRITE(SMH_NOP                  )   // watchdog?
1638   AM_RANGE(0x300000, 0x300001) AM_WRITE(SMH_NOP                )   // IRQ enable/acknowledge?
1638   AM_RANGE(0x300000, 0x300001) AM_WRITE(SMH_NOP                  )   // IRQ enable/acknowledge?
16391639   AM_RANGE(0x400000, 0x400007) AM_WRITE(twineagl_tilebank_w         )   // special tile banking to animate water in twineagl
16401640   AM_RANGE(0x500000, 0x500001) AM_WRITE(SMH_NOP                  )   // ?
16411641   AM_RANGE(0x700000, 0x7003ff) AM_WRITE(SMH_RAM) AM_BASE(&paletteram16   ) AM_SIZE(&seta_paletteram_size)   // Palette
r2956r2957
16561656
16571657static READ16_HANDLER ( calibr50_ip_r )
16581658{
1659   int dir1 = input_port_read(machine, "IN4") & 0xfff;   // analog port
1660   int dir2 = input_port_read(machine, "IN5") & 0xfff;   // analog port
1659   int dir1 = input_port_read(machine, "ROT1") & 0xfff;   // analog port
1660   int dir2 = input_port_read(machine, "ROT2") & 0xfff;   // analog port
16611661
16621662   switch (offset)
16631663   {
1664      case 0x00/2:   return input_port_read(machine, "IN0");   // p1
1665      case 0x02/2:   return input_port_read(machine, "IN1");   // p2
1664      case 0x00/2:   return input_port_read(machine, "P1");   // p1
1665      case 0x02/2:   return input_port_read(machine, "P2");   // p2
16661666
1667      case 0x08/2:   return input_port_read_indexed(machine, 2);   // Coins
1667      case 0x08/2:   return input_port_read(machine, "COINS");   // Coins
16681668
16691669      case 0x10/2:   return (dir1&0xff);         // lower 8 bits of p1 rotation
16701670      case 0x12/2:   return (dir1>>8);         // upper 4 bits of p1 rotation
r2956r2957
16931693   AM_RANGE(0x100000, 0x100007) AM_READ(SMH_NOP            )   // ? (same as a00010-a00017?)
16941694   AM_RANGE(0x200000, 0x200fff) AM_READ(SMH_RAM            )   // NVRAM
16951695   AM_RANGE(0x300000, 0x300001) AM_READ(SMH_NOP            )   // ? (value's read but not used)
1696   AM_RANGE(0x400000, 0x400001) AM_READ(watchdog_reset16_r   )   // Watchdog
1697   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r         )   // DSW
1696   AM_RANGE(0x400000, 0x400001) AM_READ(watchdog_reset16_r      )   // Watchdog
1697   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r            )   // DSW
16981698   AM_RANGE(0x700000, 0x7003ff) AM_READ(SMH_RAM            )   // Palette
16991699   AM_RANGE(0x900000, 0x901fff) AM_READ(SMH_RAM            )   // VRAM
17001700   AM_RANGE(0x902000, 0x903fff) AM_READ(SMH_RAM            )   // VRAM
r2956r2957
17021702   AM_RANGE(0xa00000, 0xa00019) AM_READ(calibr50_ip_r         )   // Input Ports
17031703/**/AM_RANGE(0xd00000, 0xd00607) AM_READ(SMH_RAM            )   // Sprites Y
17041704   AM_RANGE(0xe00000, 0xe03fff) AM_READ(SMH_RAM            )   // Sprites Code + X + Attr
1705   AM_RANGE(0xb00000, 0xb00001) AM_READ(soundlatch2_word_r   )   // From Sub CPU
1705   AM_RANGE(0xb00000, 0xb00001) AM_READ(soundlatch2_word_r      )   // From Sub CPU
17061706/**/AM_RANGE(0xc00000, 0xc00001) AM_READ(SMH_RAM            )   // ? $4000
17071707ADDRESS_MAP_END
17081708
r2956r2957
18251825   AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM            )   // ROM
18261826   AM_RANGE(0x900000, 0x9fffff) AM_READ(SMH_RAM            )   // RAM
18271827   AM_RANGE(0x100000, 0x103fff) AM_READ(seta_sound_word_r      )   // Sound
1828   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r         )   // DSW
1828   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r            )   // DSW
18291829   AM_RANGE(0x700000, 0x7003ff) AM_READ(SMH_RAM            )   // Palette
18301830   AM_RANGE(0xa00000, 0xa00607) AM_READ(SMH_RAM            )   // Sprites Y
1831   AM_RANGE(0xb00000, 0xb00001) AM_READ(input_port_0_word_r   )   // P1
1832   AM_RANGE(0xb00002, 0xb00003) AM_READ(input_port_1_word_r   )   // P2
1833   AM_RANGE(0xb00004, 0xb00005) AM_READ(input_port_2_word_r   )   // Coins
1831   AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1")               // P1
1832   AM_RANGE(0xb00002, 0xb00003) AM_READ_PORT("P2")               // P2
1833   AM_RANGE(0xb00004, 0xb00005) AM_READ_PORT("COINS")            // Coins
18341834/**/AM_RANGE(0xc00000, 0xc00001) AM_READ(SMH_RAM            )   // ? 0x4000
18351835   AM_RANGE(0xe00000, 0xe03fff) AM_READ(SMH_RAM            )   // Sprites Code + X + Attr
18361836ADDRESS_MAP_END
r2956r2957
18581858   AM_RANGE(0x210000, 0x21ffff) AM_READ(SMH_RAM            )   // RAM (gundhara)
18591859   AM_RANGE(0x300000, 0x30ffff) AM_READ(SMH_RAM            )   // RAM (wrofaero only?)
18601860   AM_RANGE(0x500000, 0x500005) AM_READ(SMH_RAM            )   // (gundhara)
1861   AM_RANGE(0x400000, 0x400001) AM_READ(input_port_0_word_r   )   // P1
1862   AM_RANGE(0x400002, 0x400003) AM_READ(input_port_1_word_r   )   // P2
1863   AM_RANGE(0x400004, 0x400005) AM_READ(input_port_2_word_r   )   // Coins
1864   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r         )   // DSW
1861   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1")               // P1
1862   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")               // P2
1863   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
1864   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r            )   // DSW
18651865   AM_RANGE(0x700000, 0x7003ff) AM_READ(SMH_RAM            )   // (rezon,jjsquawk)
18661866   AM_RANGE(0x700400, 0x700fff) AM_READ(SMH_RAM            )   // Palette
18671867   AM_RANGE(0x701000, 0x70ffff) AM_READ(SMH_RAM            )   //
r2956r2957
19131913   AM_RANGE(0x210000, 0x21ffff) AM_READ(SMH_RAM            )   // RAM (gundhara)
19141914   AM_RANGE(0x300000, 0x30ffff) AM_READ(SMH_RAM            )   // RAM (wrofaero only?)
19151915   AM_RANGE(0x500000, 0x500005) AM_READ(SMH_RAM            )   // (gundhara)
1916   AM_RANGE(0x400000, 0x400001) AM_READ(input_port_0_word_r   )   // P1
1917   AM_RANGE(0x400002, 0x400003) AM_READ(input_port_1_word_r   )   // P2
1918   AM_RANGE(0x400004, 0x400005) AM_READ(input_port_2_word_r   )   // Coins
1919   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r         )   // DSW
1916   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1")               // P1
1917   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")               // P2
1918   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
1919   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r            )   // DSW
19201920   AM_RANGE(0x700000, 0x7003ff) AM_READ(SMH_RAM            )   // (rezon,jjsquawk)
19211921   AM_RANGE(0x700400, 0x700fff) AM_READ(SMH_RAM            )   // Palette
19221922   AM_RANGE(0x701000, 0x70ffff) AM_READ(SMH_RAM            )   //
r2956r2957
19661966
19671967static READ16_HANDLER( zombraid_gun_r ) // Serial interface
19681968{
1969   int data = input_port_read_indexed(machine, 4 + gun_input_src); // Input Ports 5-8
1969   static const char *portnames[] = { "GUNX1", "GUNY1", "GUNX2", "GUNY2" };
1970
1971   int data = input_port_read(machine, portnames[gun_input_src]);   // Input Ports 5-8
19701972   return (data >> gun_input_bit) & 1;
19711973}
19721974
r2956r2957
20092011   AM_RANGE(0x210000, 0x21ffff) AM_READ(SMH_RAM            )   // RAM (gundhara)
20102012   AM_RANGE(0x300000, 0x30ffff) AM_READ(SMH_RAM            )   // RAM (wrofaero only?)
20112013   AM_RANGE(0x500000, 0x500005) AM_READ(SMH_RAM            )   // (gundhara)
2012   AM_RANGE(0x400000, 0x400001) AM_READ(input_port_0_word_r   )   // P1
2013   AM_RANGE(0x400002, 0x400003) AM_READ(input_port_1_word_r   )   // P2
2014   AM_RANGE(0x400004, 0x400005) AM_READ(input_port_2_word_r   )   // Coins
2015   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r         )   // DSW
2014   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1")               // P1
2015   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")               // P2
2016   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
2017   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r            )   // DSW
20162018   AM_RANGE(0x700000, 0x7003ff) AM_READ(SMH_RAM            )   // (rezon,jjsquawk)
20172019   AM_RANGE(0x700400, 0x700fff) AM_READ(SMH_RAM            )   // Palette
20182020   AM_RANGE(0x701000, 0x70ffff) AM_READ(SMH_RAM            )   //
r2956r2957
20652067   AM_RANGE(0xf00000, 0xf0ffff) AM_READ(SMH_RAM            )   // RAM
20662068   AM_RANGE(0x100000, 0x100001) AM_READ(SMH_NOP            )   // ?
20672069   AM_RANGE(0x200000, 0x200001) AM_READ(SMH_NOP            )   // ?
2068   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r         )   // DSW
2069   AM_RANGE(0x500000, 0x500001) AM_READ(input_port_0_word_r   )   // P1
2070   AM_RANGE(0x500002, 0x500003) AM_READ(input_port_1_word_r   )   // P2
2071   AM_RANGE(0x500004, 0x500005) AM_READ(input_port_2_word_r   )   // Coins
2070   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r            )   // DSW
2071   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")               // P1
2072   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")               // P2
2073   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("COINS")            // Coins
20722074   //AM_RANGE(0x600000, 0x60000f) AM_READ(krzybowl_input_r     )   // P1
20732075   AM_RANGE(0x8000f0, 0x8000f1) AM_READ(SMH_RAM            )   // NVRAM
20742076   AM_RANGE(0x800100, 0x8001ff) AM_READ(SMH_RAM            )   // NVRAM
r2956r2957
21032105   AM_RANGE(0xf00000, 0xf03fff) AM_READ(SMH_RAM            )   // RAM
21042106   AM_RANGE(0xf04000, 0xf041ff) AM_READ(SMH_RAM            )   // Backup RAM?
21052107   AM_RANGE(0xf05000, 0xf050ff) AM_READ(SMH_RAM            )   // Backup RAM?
2106   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r         )   // DSW
2107   AM_RANGE(0x500000, 0x500001) AM_READ(input_port_0_word_r   )   // P1
2108   AM_RANGE(0x500002, 0x500003) AM_READ(input_port_1_word_r   )   // P2
2109   AM_RANGE(0x500004, 0x500005) AM_READ(input_port_2_word_r   )   // Coins
2108   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r            )   // DSW
2109   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")               // P1
2110   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")               // P2
2111   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("COINS")            // Coins
21102112   AM_RANGE(0xa00000, 0xa03fff) AM_READ(seta_sound_word_r      )   // Sound
21112113   AM_RANGE(0xb00000, 0xb003ff) AM_READ(SMH_RAM            )   // Palette
21122114   AM_RANGE(0xc00000, 0xc03fff) AM_READ(SMH_RAM            )   // Sprites Code + X + Attr
r2956r2957
21382140static ADDRESS_MAP_START( daioh_readmem, ADDRESS_SPACE_PROGRAM, 16 )
21392141   AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM            )   // ROM
21402142   AM_RANGE(0x100000, 0x10ffff) AM_READ(SMH_RAM            )   // RAM
2141   AM_RANGE(0x400000, 0x400001) AM_READ(input_port_0_word_r   )   // P1
2142   AM_RANGE(0x400002, 0x400003) AM_READ(input_port_1_word_r   )   // P2
2143   AM_RANGE(0x400004, 0x400005) AM_READ(input_port_2_word_r   )   // Coins
2144   AM_RANGE(0x500006, 0x500007) AM_READ(input_port_4_word_r   )   // Buttons 4,5,6
2145   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r         )   // DSW
2143   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1")               // P1
2144   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")               // P2
2145   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
2146   AM_RANGE(0x500006, 0x500007) AM_READ_PORT("EXTRA")            // Buttons 4,5,6
2147   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r            )   // DSW
21462148   AM_RANGE(0x700000, 0x7003ff) AM_READ(SMH_RAM            )
21472149   AM_RANGE(0x700400, 0x700fff) AM_READ(SMH_RAM            )  // Palette
21482150   AM_RANGE(0x701000, 0x70ffff) AM_READ(SMH_RAM            )
r2956r2957
21902192   AM_RANGE(0xf00000, 0xf0ffff) AM_READ(SMH_RAM            )   // RAM (qzkklogy)
21912193   AM_RANGE(0xffc000, 0xffffff) AM_READ(SMH_RAM            )   // RAM (drgnunit,stg)
21922194   AM_RANGE(0x100000, 0x103fff) AM_READ(seta_sound_word_r      )   // Sound
2193   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r         )   // DSW
2195   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r            )   // DSW
21942196   AM_RANGE(0x700000, 0x7003ff) AM_READ(SMH_RAM            )   // Palette
21952197   AM_RANGE(0x900000, 0x901fff) AM_READ(SMH_RAM            )   // VRAM
21962198   AM_RANGE(0x902000, 0x903fff) AM_READ(SMH_RAM            )   // VRAM
2197   AM_RANGE(0xb00000, 0xb00001) AM_READ(input_port_0_word_r   )   // P1
2198   AM_RANGE(0xb00002, 0xb00003) AM_READ(input_port_1_word_r   )   // P2
2199   AM_RANGE(0xb00004, 0xb00005) AM_READ(input_port_2_word_r   )   // Coins
2199   AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1")               // P1
2200   AM_RANGE(0xb00002, 0xb00003) AM_READ_PORT("P2")               // P2
2201   AM_RANGE(0xb00004, 0xb00005) AM_READ_PORT("COINS")            // Coins
22002202   AM_RANGE(0xb00006, 0xb00007) AM_READ(SMH_NOP            )   // unused (qzkklogy)
22012203/**/AM_RANGE(0xc00000, 0xc00001) AM_READ(SMH_RAM            )   // ? $4000
22022204/**/AM_RANGE(0xd00000, 0xd00607) AM_READ(SMH_RAM            )   // Sprites Y
r2956r2957
22302232   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM            )   // RAM
22312233   AM_RANGE(0x210000, 0x21ffff) AM_READ(SMH_RAM            )   // RAM
22322234   AM_RANGE(0x220000, 0x23ffff) AM_READ(SMH_RAM            )   // RAM (sokonuke)
2233   AM_RANGE(0x400000, 0x400001) AM_READ(input_port_0_word_r   )   // P1
2234   AM_RANGE(0x400002, 0x400003) AM_READ(input_port_1_word_r   )   // P2
2235   AM_RANGE(0x400004, 0x400005) AM_READ(input_port_2_word_r   )   // Coins
2236   AM_RANGE(0x400008, 0x40000b) AM_READ(seta_dsw_r         )   // DSW
2237   AM_RANGE(0x40000c, 0x40000d) AM_READ(watchdog_reset16_r   )   // Watchdog (extdwnhl, MUST RETURN $FFFF)
2235   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1")               // P1
2236   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")               // P2
2237   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
2238   AM_RANGE(0x400008, 0x40000b) AM_READ(seta_dsw_r            )   // DSW
2239   AM_RANGE(0x40000c, 0x40000d) AM_READ(watchdog_reset16_r      )   // Watchdog (extdwnhl, MUST RETURN $FFFF)
22382240   AM_RANGE(0x500004, 0x500007) AM_READ(SMH_NOP            )   // IRQ Ack  (extdwnhl)
22392241   AM_RANGE(0x600400, 0x600fff) AM_READ(SMH_RAM            )   // Palette
22402242   AM_RANGE(0x601000, 0x610bff) AM_READ(SMH_RAM            )   //
r2956r2957
22812283static ADDRESS_MAP_START( kamenrid_readmem, ADDRESS_SPACE_PROGRAM, 16 )
22822284   AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM            )   // ROM
22832285   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM            )   // ROM
2284   AM_RANGE(0x500000, 0x500001) AM_READ(input_port_0_word_r   )   // P1
2285   AM_RANGE(0x500002, 0x500003) AM_READ(input_port_1_word_r   )   // P2
2286   AM_RANGE(0x500004, 0x500007) AM_READ(seta_dsw_r      )   // DSW
2287   AM_RANGE(0x500008, 0x500009) AM_READ(input_port_2_word_r   )   // Coins
2288   AM_RANGE(0x50000c, 0x50000d) AM_READ(watchdog_reset16_r   )   // xx Watchdog?
2286   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")               // P1
2287   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")               // P2
2288   AM_RANGE(0x500004, 0x500007) AM_READ(seta_dsw_r            )   // DSW
2289   AM_RANGE(0x500008, 0x500009) AM_READ_PORT("COINS")            // Coins
2290   AM_RANGE(0x50000c, 0x50000d) AM_READ(watchdog_reset16_r      )   // xx Watchdog?
22892291   AM_RANGE(0x700000, 0x7003ff) AM_READ(SMH_RAM            )   // Palette
22902292   AM_RANGE(0x700400, 0x700fff) AM_READ(SMH_RAM            )   // Palette
22912293   AM_RANGE(0x701000, 0x703fff) AM_READ(SMH_RAM            )   // Palette
r2956r2957
23322334static ADDRESS_MAP_START( madshark_readmem, ADDRESS_SPACE_PROGRAM, 16 )
23332335   AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM            )   // ROM
23342336   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM            )   // ROM
2335   AM_RANGE(0x500000, 0x500001) AM_READ(input_port_0_word_r   )   // P1
2336   AM_RANGE(0x500002, 0x500003) AM_READ(input_port_1_word_r   )   // P2
2337   AM_RANGE(0x500004, 0x500005) AM_READ(input_port_2_word_r   )   // Coins
2338   AM_RANGE(0x500008, 0x50000b) AM_READ(seta_dsw_r         )   // DSW
2337   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")               // P1
2338   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")               // P2
2339   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("COINS")            // Coins
2340   AM_RANGE(0x500008, 0x50000b) AM_READ(seta_dsw_r            )   // DSW
23392341   AM_RANGE(0x700400, 0x700fff) AM_READ(SMH_RAM            )   // Palette
23402342   AM_RANGE(0x800000, 0x801fff) AM_READ(SMH_RAM            )   // VRAM 0
23412343   AM_RANGE(0x802000, 0x803fff) AM_READ(SMH_RAM            )   // VRAM 1
r2956r2957
23772379static READ16_HANDLER( krzybowl_input_r )
23782380{
23792381   // analog ports
2380   int dir1x = input_port_read_indexed(machine, 4) & 0xfff;
2381   int dir1y = input_port_read_indexed(machine, 5) & 0xfff;
2382   int dir2x = input_port_read_indexed(machine, 6) & 0xfff;
2383   int dir2y = input_port_read_indexed(machine, 7) & 0xfff;
2382   int dir1x = input_port_read(machine, "TRACK1_X") & 0xfff;
2383   int dir1y = input_port_read(machine, "TRACK1_Y") & 0xfff;
2384   int dir2x = input_port_read(machine, "TRACK2_X") & 0xfff;
2385   int dir2y = input_port_read(machine, "TRACK2_Y") & 0xfff;
23842386
23852387   switch (offset)
23862388   {
r2956r2957
24032405   AM_RANGE(0xf00000, 0xf0ffff) AM_READ(SMH_RAM            )   // RAM
24042406   AM_RANGE(0x100000, 0x100001) AM_READ(SMH_NOP            )   // ?
24052407   AM_RANGE(0x200000, 0x200001) AM_READ(SMH_NOP            )   // ?
2406   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r         )   // DSW
2407   AM_RANGE(0x500000, 0x500001) AM_READ(input_port_0_word_r   )   // P1
2408   AM_RANGE(0x500002, 0x500003) AM_READ(input_port_1_word_r   )   // P2
2409   AM_RANGE(0x500004, 0x500005) AM_READ(input_port_2_word_r   )   // Coins
2408   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r            )   // DSW
2409   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")               // P1
2410   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")               // P2
2411   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("COINS")            // Coins
24102412   AM_RANGE(0x600000, 0x60000f) AM_READ(krzybowl_input_r      )   // P1
24112413   AM_RANGE(0x8000f0, 0x8000f1) AM_READ(SMH_RAM            )   // NVRAM
24122414   AM_RANGE(0x800100, 0x8001ff) AM_READ(SMH_RAM            )   // NVRAM
r2956r2957
24522454   AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM            )   // ROM
24532455   AM_RANGE(0x100000, 0x1fffff) AM_READ(SMH_ROM            )   // ROM
24542456   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM            )   // RAM
2455   AM_RANGE(0x400000, 0x400001) AM_READ(input_port_0_word_r   )   // P1
2456   AM_RANGE(0x400002, 0x400003) AM_READ(input_port_1_word_r   )   // P2
2457   AM_RANGE(0x400004, 0x400005) AM_READ(input_port_2_word_r   )   // Coins
2458   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r         )   // DSW
2457   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1")               // P1
2458   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")               // P2
2459   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
2460   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r            )   // DSW
24592461   AM_RANGE(0x700400, 0x700fff) AM_READ(SMH_RAM            )   // Palette
24602462   AM_RANGE(0x800000, 0x800607) AM_READ(SMH_RAM            )   // Sprites Y
24612463   AM_RANGE(0x900000, 0x903fff) AM_READ(SMH_RAM            )   // Sprites Code + X + Attr
r2956r2957
25062508   AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM            )   // ROM
25072509   AM_RANGE(0x100000, 0x17ffff) AM_READ(SMH_ROM            )   // ROM
25082510   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM            )   // RAM
2509   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r         )   // DSW
2510   AM_RANGE(0x400000, 0x400001) AM_READ(input_port_0_word_r   )   // P1
2511   AM_RANGE(0x400002, 0x400003) AM_READ(input_port_1_word_r   )   // P2
2512   AM_RANGE(0x400004, 0x400005) AM_READ(input_port_2_word_r   )   // Coins
2511   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r            )   // DSW
2512   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1")               // P1
2513   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")               // P2
2514   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
25132515   AM_RANGE(0x700000, 0x703fff) AM_READ(seta_sound_word_r      )   // Sound
25142516   AM_RANGE(0x800000, 0x803fff) AM_READ(SMH_RAM            )   // VRAM 0&1
25152517   AM_RANGE(0x880000, 0x883fff) AM_READ(SMH_RAM            )   // VRAM 2&3
r2956r2957
25482550   AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM            )   // ROM
25492551   AM_RANGE(0x100000, 0x17ffff) AM_READ(SMH_ROM            )   // ROM
25502552   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM            )   // RAM
2551   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r         )   // DSW
2552   AM_RANGE(0x400000, 0x400001) AM_READ(input_port_0_word_r   )   // P1
2553   AM_RANGE(0x400002, 0x400003) AM_READ(input_port_1_word_r   )   // P2
2554   AM_RANGE(0x400004, 0x400005) AM_READ(input_port_2_word_r   )   // Coins
2553   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r            )   // DSW
2554   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1")               // P1
2555   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")               // P2
2556   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
25552557   AM_RANGE(0x500006, 0x500007) AM_READ(OKIM6295_status_0_lsb_r) // tfun sound
25562558   AM_RANGE(0x700000, 0x703fff) AM_READ(SMH_RAM            )   // old sound
25572559   AM_RANGE(0x800000, 0x803fff) AM_READ(SMH_RAM            )   // VRAM 0&1
r2956r2957
26022604{
26032605   int row_select = kiwame_nvram_r( machine,0x10a/2,0x00ff ) & 0x1f;
26042606   int i;
2607   static const char *keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4" };
26052608
26062609   for(i = 0; i < 5; i++)
26072610      if (row_select & (1<<i))   break;
26082611
2609   i = 4 + (i % 5);
2610
26112612   switch( offset )
26122613   {
2613      case 0x00/2:   return input_port_read_indexed(machine, i );
2614      case 0x00/2:   return input_port_read(machine, keynames[i]);
26142615      case 0x02/2:   return 0xffff;
2615      case 0x04/2:   return input_port_read_indexed(machine, 2 );
2616      case 0x04/2:   return input_port_read(machine, "COINS");
26162617//      case 0x06/2:
26172618      case 0x08/2:   return 0xffff;
26182619
r2956r2957
26252626static ADDRESS_MAP_START( kiwame_readmem, ADDRESS_SPACE_PROGRAM, 16 )
26262627   AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM            )   // ROM
26272628   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM            )   // RAM
2628   AM_RANGE(0xfffc00, 0xffffff) AM_READ(kiwame_nvram_r      )   // NVRAM + Regs ?
2629   AM_RANGE(0xfffc00, 0xffffff) AM_READ(kiwame_nvram_r         )   // NVRAM + Regs ?
26292630   AM_RANGE(0x800000, 0x803fff) AM_READ(SMH_RAM            )   // Sprites Code + X + Attr
26302631/**/AM_RANGE(0x900000, 0x900001) AM_READ(SMH_RAM            )   // ? 0x4000
26312632/**/AM_RANGE(0xa00000, 0xa00607) AM_READ(SMH_RAM            )   // Sprites Y
26322633   AM_RANGE(0xb00000, 0xb003ff) AM_READ(SMH_RAM            )   // Palette
26332634   AM_RANGE(0xc00000, 0xc03fff) AM_READ(seta_sound_word_r      )   // Sound
2634   AM_RANGE(0xd00000, 0xd00009) AM_READ(kiwame_input_r      )
2635   AM_RANGE(0xe00000, 0xe00003) AM_READ(seta_dsw_r         )   // DSW
2635   AM_RANGE(0xd00000, 0xd00009) AM_READ(kiwame_input_r         )
2636   AM_RANGE(0xe00000, 0xe00003) AM_READ(seta_dsw_r            )   // DSW
26362637ADDRESS_MAP_END
26372638
26382639static ADDRESS_MAP_START( kiwame_writemem, ADDRESS_SPACE_PROGRAM, 16 )
r2956r2957
26692670   AM_RANGE(0x100000, 0x103fff) AM_READ(seta_sound_word_r      )   // Sound
26702671   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r            )   // DSW
26712672   AM_RANGE(0x700000, 0x7003ff) AM_READ(SMH_RAM            )   // Palette
2672   AM_RANGE(0xb00000, 0xb00001) AM_READ(input_port_0_word_r   )   // P1
2673   AM_RANGE(0xb00002, 0xb00003) AM_READ(input_port_1_word_r   )   // P2
2674   AM_RANGE(0xb00004, 0xb00005) AM_READ(input_port_2_word_r   )   // Coins
2673   AM_RANGE(0xb00000, 0xb00001) AM_READ_PORT("P1")               // P1
2674   AM_RANGE(0xb00002, 0xb00003) AM_READ_PORT("P2")               // P2
2675   AM_RANGE(0xb00004, 0xb00005) AM_READ_PORT("COINS")            // Coins
26752676   AM_RANGE(0xb0000c, 0xb0000d) AM_READ(thunderl_protection_r   )   // Protection (not in wits)
2676   AM_RANGE(0xb00008, 0xb00009) AM_READ(input_port_4_word_r   )   // P3 (wits)
2677   AM_RANGE(0xb0000a, 0xb0000b) AM_READ(input_port_5_word_r   )   // P4 (wits)
2677   AM_RANGE(0xb00008, 0xb00009) AM_READ_PORT("P3")               // P3 (wits)
2678   AM_RANGE(0xb0000a, 0xb0000b) AM_READ_PORT("P4")               // P4 (wits)
26782679/**/AM_RANGE(0xc00000, 0xc00001) AM_READ(SMH_RAM            )   // ? 0x4000
26792680/**/AM_RANGE(0xd00000, 0xd00607) AM_READ(SMH_RAM            )   // Sprites Y
26802681   AM_RANGE(0xe00000, 0xe03fff) AM_READ(SMH_RAM            )   // Sprites Code + X + Attr
r2956r2957
27362737   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM            )   // RAM
27372738   AM_RANGE(0x300000, 0x3003ff) AM_READ(SMH_RAM            )   // Palette
27382739   AM_RANGE(0x300400, 0x300fff) AM_READ(SMH_RAM            )   //
2739   AM_RANGE(0x400000, 0x400001) AM_READ(input_port_0_word_r   )   // P1
2740   AM_RANGE(0x400002, 0x400003) AM_READ(input_port_1_word_r   )   // P2
2741   AM_RANGE(0x400004, 0x400005) AM_READ(input_port_2_word_r   )   // Coins
2742   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r         )   // DSW
2740   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1")               // P1
2741   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")               // P2
2742   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
2743   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r            )   // DSW
27432744   AM_RANGE(0xa00000, 0xa00607) AM_READ(SMH_RAM            )   // Sprites Y
27442745/**/AM_RANGE(0xa80000, 0xa80001) AM_READ(SMH_RAM            )   // ? 0x4000
27452746   AM_RANGE(0xb00000, 0xb03fff) AM_READ(SMH_RAM            )   // Sprites Code + X + Attr
r2956r2957
27762777static ADDRESS_MAP_START( utoukond_readmem, ADDRESS_SPACE_PROGRAM, 16 )
27772778   AM_RANGE(0x000000, 0x0fffff) AM_READ(SMH_ROM            )   // ROM
27782779   AM_RANGE(0x200000, 0x20ffff) AM_READ(SMH_RAM            )   // ROM
2779   AM_RANGE(0x400000, 0x400001) AM_READ(input_port_0_word_r   )   // P1
2780   AM_RANGE(0x400002, 0x400003) AM_READ(input_port_1_word_r   )   // P2
2781   AM_RANGE(0x400004, 0x400005) AM_READ(input_port_2_word_r   )   // Coins
2782   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r         )   // DSW
2780   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("P1")               // P1
2781   AM_RANGE(0x400002, 0x400003) AM_READ_PORT("P2")               // P2
2782   AM_RANGE(0x400004, 0x400005) AM_READ_PORT("COINS")            // Coins
2783   AM_RANGE(0x600000, 0x600003) AM_READ(seta_dsw_r            )   // DSW
27832784   AM_RANGE(0x700400, 0x700fff) AM_READ(SMH_RAM            )   // Palette
27842785   AM_RANGE(0x800000, 0x801fff) AM_READ(SMH_RAM            )   // VRAM 0
27852786   AM_RANGE(0x802000, 0x803fff) AM_READ(SMH_RAM            )   // VRAM 1
r2956r2957
28382839   AM_RANGE(0x0800, 0x0800) AM_READ(ff_r               )   // ? (bits 0/1/2/3: 1 -> do test 0-ff/100-1e0/5001-57ff/banked rom)
28392840//  AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_r           )   //
28402841//  AM_RANGE(0x0801, 0x0801) AM_READ(soundlatch2_r          )   //
2841   AM_RANGE(0x1000, 0x1000) AM_READ(input_port_0_r      )   // P1
2842   AM_RANGE(0x1001, 0x1001) AM_READ(input_port_1_r      )   // P2
2843   AM_RANGE(0x1002, 0x1002) AM_READ(input_port_2_r      )   // Coins
2842   AM_RANGE(0x1000, 0x1000) AM_READ_PORT("P1")               // P1
2843   AM_RANGE(0x1001, 0x1001) AM_READ_PORT("P2")               // P2
2844   AM_RANGE(0x1002, 0x1002) AM_READ_PORT("COINS")            // Coins
28442845   AM_RANGE(0x2001, 0x2001) AM_READ(YM2203_read_port_0_r   )
28452846   AM_RANGE(0x5000, 0x57ff) AM_READ(SMH_RAM            )   // Shared RAM
28462847   AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_ROM            )   // ROM
r2956r2957
28672868   AM_RANGE(0x0000, 0x01ff) AM_READ(SMH_RAM         )   // RAM
28682869   AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_r      )   //
28692870   AM_RANGE(0x0801, 0x0801) AM_READ(soundlatch2_r      )   //
2870   AM_RANGE(0x1000, 0x1000) AM_READ(input_port_0_r   )   // P1
2871   AM_RANGE(0x1001, 0x1001) AM_READ(input_port_1_r   )   // P2
2872   AM_RANGE(0x1002, 0x1002) AM_READ(input_port_2_r   )   // Coins
2871   AM_RANGE(0x1000, 0x1000) AM_READ_PORT("P1")            // P1
2872   AM_RANGE(0x1001, 0x1001) AM_READ_PORT("P2")            // P2
2873   AM_RANGE(0x1002, 0x1002) AM_READ_PORT("COINS")         // Coins
28732874   AM_RANGE(0x5000, 0x57ff) AM_READ(SMH_RAM         )   // Shared RAM
28742875   AM_RANGE(0x7000, 0x7fff) AM_READ(SMH_ROM         )   // ROM
28752876   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1         )   // Banked ROM
r2956r2957
28912892
28922893static READ8_HANDLER( downtown_ip_r )
28932894{
2894   int dir1 = input_port_read_indexed(machine, 4);   // analog port
2895   int dir2 = input_port_read_indexed(machine, 5);   // analog port
2895   int dir1 = input_port_read(machine, "ROT1");   // analog port
2896   int dir2 = input_port_read(machine, "ROT2");   // analog port
28962897
28972898   dir1 = (~ (0x800 >> ((dir1 * 12)/0x100)) ) & 0xfff;
28982899   dir2 = (~ (0x800 >> ((dir2 * 12)/0x100)) ) & 0xfff;
28992900
29002901   switch (offset)
29012902   {
2902      case 0:   return (input_port_read_indexed(machine, 2) & 0xf0) + (dir1>>8);   // upper 4 bits of p1 rotation + coins
2903      case 1:   return (dir1&0xff);         // lower 8 bits of p1 rotation
2904      case 2:   return input_port_read_indexed(machine, 0);   // p1
2905      case 3:   return 0xff;            // ?
2906      case 4:   return (dir2>>8);         // upper 4 bits of p2 rotation + ?
2907      case 5:   return (dir2&0xff);         // lower 8 bits of p2 rotation
2908      case 6:   return input_port_read_indexed(machine, 1);   // p2
2909      case 7:   return 0xff;            // ?
2903      case 0:   return (input_port_read(machine, "COINS") & 0xf0) + (dir1 >> 8);   // upper 4 bits of p1 rotation + coins
2904      case 1:   return (dir1 & 0xff);               // lower 8 bits of p1 rotation
2905      case 2:   return input_port_read(machine, "P1");   // p1
2906      case 3:   return 0xff;                     // ?
2907      case 4:   return (dir2 >> 8);                  // upper 4 bits of p2 rotation + ?
2908      case 5:   return (dir2 & 0xff);               // lower 8 bits of p2 rotation
2909      case 6:   return input_port_read(machine, "P2");   // p2
2910      case 7:   return 0xff;                     // ?
29102911   }
29112912
29122913   return 0;
r2956r2957
29682969   AM_RANGE(0x0000, 0x01ff) AM_READ(SMH_RAM         )   // RAM
29692970   AM_RANGE(0x0800, 0x0800) AM_READ(soundlatch_r      )   //
29702971   AM_RANGE(0x0801, 0x0801) AM_READ(soundlatch2_r      )   //
2971   AM_RANGE(0x1000, 0x1000) AM_READ(input_port_2_r   )   // Coins
2972   AM_RANGE(0x1002, 0x1002) AM_READ(input_port_0_r   )   // P1
2973//  AM_RANGE(0x1004, 0x1004) AM_READ(SMH_NOP           )   // ?
2974   AM_RANGE(0x1006, 0x1006) AM_READ(input_port_1_r   )   // P2
2972   AM_RANGE(0x1000, 0x1000) AM_READ_PORT("COINS")         // Coins
2973   AM_RANGE(0x1002, 0x1002) AM_READ_PORT("P1")            // P1
2974//  AM_RANGE(0x1004, 0x1004) AM_READ(SMH_NOP            )   // ?
2975   AM_RANGE(0x1006, 0x1006) AM_READ_PORT("P2")            // P2
29752976   AM_RANGE(0x5000, 0x57ff) AM_READ(SMH_RAM         )   // Shared RAM
29762977   AM_RANGE(0x7000, 0x7fff) AM_READ(SMH_ROM         )   // ROM
29772978   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1         )   // Banked ROM
r2956r2957
30433044
30443045static ADDRESS_MAP_START( pairlove_readmem, ADDRESS_SPACE_PROGRAM, 16 )
30453046   AM_RANGE(0x000000, 0x03ffff) AM_READ(SMH_ROM            )   // ROM
3046   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r         )   // DSW
3047   AM_RANGE(0x500000, 0x500001) AM_READ(input_port_0_word_r   )   // P1
3048   AM_RANGE(0x500002, 0x500003) AM_READ(input_port_1_word_r   )   // P2
3049   AM_RANGE(0x500004, 0x500005) AM_READ(input_port_2_word_r   )   // Coins
3047   AM_RANGE(0x300000, 0x300003) AM_READ(seta_dsw_r            )   // DSW
3048   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("P1")               // P1
3049   AM_RANGE(0x500002, 0x500003) AM_READ_PORT("P2")               // P2
3050   AM_RANGE(0x500004, 0x500005) AM_READ_PORT("COINS")            // Coins
30503051   AM_RANGE(0x900000, 0x9001ff) AM_READ(pairlove_prot_r)
30513052   AM_RANGE(0xa00000, 0xa03fff) AM_READ(seta_sound_word_r      )   // Sound
30523053   AM_RANGE(0xb00000, 0xb00fff) AM_READ(SMH_RAM            )   // Palette
r2956r2957
30813082static ADDRESS_MAP_START( crazyfgt_map, ADDRESS_SPACE_PROGRAM, 16 )
30823083   AM_RANGE(0x000000, 0x07ffff) AM_ROM
30833084   AM_RANGE(0x400000, 0x40ffff) AM_RAM
3084   AM_RANGE(0x610000, 0x610001) AM_READ(input_port_0_word_r   )
3085   AM_RANGE(0x610002, 0x610003) AM_READ(input_port_1_word_r   )
3086   AM_RANGE(0x610004, 0x610005) AM_READ(input_port_2_word_r   )
3085   AM_RANGE(0x610000, 0x610001) AM_READ_PORT("COINS")
3086   AM_RANGE(0x610002, 0x610003) AM_READ_PORT("UNK")
3087   AM_RANGE(0x610004, 0x610005) AM_READ_PORT("INPUT")
30873088   AM_RANGE(0x610006, 0x610007) AM_WRITENOP
30883089   AM_RANGE(0x620000, 0x620003) AM_WRITENOP   // protection
30893090   AM_RANGE(0x630000, 0x630003) AM_READ(seta_dsw_r)
r2956r2957
31083109static READ16_HANDLER( inttoote_dsw_r )
31093110{
31103111   int shift = offset * 4;
3111   return   ((((input_port_read_indexed(machine, 0) >> shift)     & 0xf)) << 0) |
3112         ((((input_port_read_indexed(machine, 1) >> shift)     & 0xf)) << 4) |
3113         ((((input_port_read_indexed(machine, 1) >> (shift+8)) & 0xf)) << 8) ;
3112   return   ((((input_port_read(machine, "DSW1") >> shift)       & 0xf)) << 0) |
3113         ((((input_port_read(machine, "DSW2_3") >> shift)     & 0xf)) << 4) |
3114         ((((input_port_read(machine, "DSW2_3") >> (shift+8)) & 0xf)) << 8) ;
31143115}
31153116
31163117static UINT16 *inttoote_key_select;
r2956r2957
31183119{
31193120   switch( *inttoote_key_select )
31203121   {
3121      case 0x08:   return input_port_read_indexed(machine, 4+0);
3122      case 0x10:   return input_port_read_indexed(machine, 4+1);
3123      case 0x20:   return input_port_read_indexed(machine, 4+2);
3124      case 0x40:   return input_port_read_indexed(machine, 4+3);
3125      case 0x80:   return input_port_read_indexed(machine, 4+4);
3122      case 0x08:   return input_port_read(machine, "BET0");
3123      case 0x10:   return input_port_read(machine, "BET1");
3124      case 0x20:   return input_port_read(machine, "BET2");
3125      case 0x40:   return input_port_read(machine, "BET3");
3126      case 0x80:   return input_port_read(machine, "BET4");
31263127   }
31273128   logerror("%06X: unknown read, select = %04x\n",activecpu_get_pc(),*inttoote_key_select);
31283129   return 0xffff;
r2956r2957
31383139   AM_RANGE(0x000000, 0x1fffff) AM_ROM   // ROM (up to 2MB)
31393140
31403141   AM_RANGE(0x200000, 0x200001) AM_READWRITE(inttoote_key_r, SMH_RAM) AM_BASE(&inttoote_key_select)
3141   AM_RANGE(0x200002, 0x200003) AM_READ(input_port_2_word_r)
3142   AM_RANGE(0x200010, 0x200011) AM_READWRITE(input_port_3_word_r, SMH_NOP)
3142   AM_RANGE(0x200002, 0x200003) AM_READ_PORT("P1")
3143   AM_RANGE(0x200010, 0x200011) AM_READ_PORT("P2") AM_WRITENOP
31433144
31443145   AM_RANGE(0x300000, 0x300001) AM_WRITE(watchdog_reset16_w)   // Watchdog
31453146
r2956r2957
31773178***************************************************************************/
31783179
31793180#define   JOY_TYPE1_1BUTTON(_n_) \
3180   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_PLAYER(_n_) \
3181   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(_n_) \
3182   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_PLAYER(_n_) \
3183   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_PLAYER(_n_) \
3184   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1      ) PORT_PLAYER(_n_) \
3185   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN                  ) \
3186   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN                  ) \
3187   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START##_n_               )
3181   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_PLAYER(_n_) \
3182   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(_n_) \
3183   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_PLAYER(_n_) \
3184   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_PLAYER(_n_) \
3185   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1      ) PORT_PLAYER(_n_) \
3186   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN                  ) \
3187   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN                  ) \
3188   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START##_n_               )
31883189
31893190#define   JOY_TYPE1_2BUTTONS(_n_) \
3190   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_PLAYER(_n_) \
3191   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(_n_) \
3192   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_PLAYER(_n_) \
3193   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_PLAYER(_n_) \
3194   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1      ) PORT_PLAYER(_n_) \
3195   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2      ) PORT_PLAYER(_n_) \
3196   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN                  ) \
3197   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START##_n_               )
3191   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_PLAYER(_n_) \
3192   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(_n_) \
3193   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_PLAYER(_n_) \
3194   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_PLAYER(_n_) \
3195   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1      ) PORT_PLAYER(_n_) \
3196   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2      ) PORT_PLAYER(_n_) \
3197   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN                  ) \
3198   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START##_n_               )
31983199
31993200#define   JOY_TYPE1_3BUTTONS(_n_) \
3200   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_PLAYER(_n_) \
3201   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(_n_) \
3202   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_PLAYER(_n_) \
3203   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_PLAYER(_n_) \
3204   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1      ) PORT_PLAYER(_n_) \
3205   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2      ) PORT_PLAYER(_n_) \
3206   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_BUTTON3      ) PORT_PLAYER(_n_) \
3207   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START##_n_               )
3201   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_PLAYER(_n_) \
3202   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(_n_) \
3203   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_PLAYER(_n_) \
3204   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_PLAYER(_n_) \
3205   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1      ) PORT_PLAYER(_n_) \
3206   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2      ) PORT_PLAYER(_n_) \
3207   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3      ) PORT_PLAYER(_n_) \
3208   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START##_n_               )
32083209
32093210
3210
32113211#define   JOY_TYPE2_1BUTTON(_n_) \
3212   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_PLAYER(_n_) \
3213   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_PLAYER(_n_) \
3214   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_PLAYER(_n_) \
3215   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(_n_) \
3216   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1      ) PORT_PLAYER(_n_) \
3217   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN                  ) \
3218   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN                  ) \
3219   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START##_n_               )
3212   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_PLAYER(_n_) \
3213   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_PLAYER(_n_) \
3214   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_PLAYER(_n_) \
3215   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(_n_) \
3216   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1      ) PORT_PLAYER(_n_) \
3217   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN                  ) \
3218   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN                  ) \
3219   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START##_n_               )
32203220
32213221#define   JOY_TYPE2_2BUTTONS(_n_) \
3222   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_PLAYER(_n_) \
3223   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_PLAYER(_n_) \
3224   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_PLAYER(_n_) \
3225   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(_n_) \
3226   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1      ) PORT_PLAYER(_n_) \
3227   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2      ) PORT_PLAYER(_n_) \
3228   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN                  ) \
3229   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START##_n_               )
3222   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_PLAYER(_n_) \
3223   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_PLAYER(_n_) \
3224   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_PLAYER(_n_) \
3225   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(_n_) \
3226   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1      ) PORT_PLAYER(_n_) \
3227   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2      ) PORT_PLAYER(_n_) \
3228   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN                  ) \
3229   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START##_n_               )
32303230
32313231#define   JOY_TYPE2_3BUTTONS(_n_) \
3232   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_PLAYER(_n_) \
3233   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_PLAYER(_n_) \
3234   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_PLAYER(_n_) \
3235   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(_n_) \
3236   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1      ) PORT_PLAYER(_n_) \
3237   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2      ) PORT_PLAYER(_n_) \
3238   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_BUTTON3      ) PORT_PLAYER(_n_) \
3239   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START##_n_               )
3232   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_PLAYER(_n_) \
3233   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_PLAYER(_n_) \
3234   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_PLAYER(_n_) \
3235   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_PLAYER(_n_) \
3236   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1      ) PORT_PLAYER(_n_) \
3237   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2      ) PORT_PLAYER(_n_) \
3238   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3      ) PORT_PLAYER(_n_) \
3239   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START##_n_               )
32403240
32413241
32423242#define JOY_ROTATION(_n_, _left_, _right_ ) \
r2956r2957
32493249***************************************************************************/
32503250
32513251static INPUT_PORTS_START( arbalest )
3252   PORT_START_TAG("IN0")   // Player 1
3252   PORT_START_TAG("P1")   // Player 1
32533253   JOY_TYPE2_2BUTTONS(1)
32543254
3255   PORT_START_TAG("IN1")   // Player 2
3255   PORT_START_TAG("P2")   // Player 2
32563256   JOY_TYPE2_2BUTTONS(2)
32573257
3258   PORT_START_TAG("IN2")   // Coins
3259   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3260   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3261   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3262   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3263   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_TILT     )
3264   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
3258   PORT_START_TAG("COINS")   // Coins
3259   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3260   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3261   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3262   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3263   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_TILT     )
3264   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
32653265   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
32663266   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
32673267
3268   PORT_START_TAG("IN3")   // 2 DSWs - $600001 & 3.b
3268   PORT_START_TAG("DSW")   // 2 DSWs - $600001 & 3.b
32693269   PORT_DIPNAME( 0x4001, 0x0000, "Licensed To" )
32703270   PORT_DIPSETTING(      0x0000, "Taito" )
32713271//  PORT_DIPSETTING(      0x4000, "Taito" )
r2956r2957
33163316***************************************************************************/
33173317
33183318static INPUT_PORTS_START( atehate )
3319   PORT_START_TAG("IN0")   // Player 1
3320   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
3321   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
3322   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
3323   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
3324   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
3325   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
3326   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
3327   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START1  )
3319   PORT_START_TAG("P1")   // Player 1
3320   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
3321   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
3322   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
3323   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
3324   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
3325   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
3326   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
3327   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1  )
33283328
3329   PORT_START_TAG("IN1")   // Player 2
3330   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
3331   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
3332   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
3333   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
3334   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
3335   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
3336   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
3337   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START2  )
3329   PORT_START_TAG("P2")   // Player 2
3330   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
3331   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
3332   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
3333   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
3334   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
3335   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
3336   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
3337   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2  )
33383338
3339   PORT_START_TAG("IN2")   // Coins
3339   PORT_START_TAG("COINS")   // Coins
33403340   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
33413341   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
33423342   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(5)
3343   PORT_BIT(  0x0008, IP_ACTIVE_LOW,  IPT_UNKNOWN )
3344   PORT_BIT(  0x0010, IP_ACTIVE_LOW,  IPT_UNKNOWN ) // 4 Bits Called "Cut DSW"
3345   PORT_BIT(  0x0020, IP_ACTIVE_LOW,  IPT_UNKNOWN )
3346   PORT_BIT(  0x0040, IP_ACTIVE_LOW,  IPT_UNKNOWN )
3347   PORT_BIT(  0x0080, IP_ACTIVE_LOW,  IPT_UNKNOWN )
3343   PORT_BIT( 0x0008, IP_ACTIVE_LOW,  IPT_UNKNOWN )
3344   PORT_BIT( 0x0010, IP_ACTIVE_LOW,  IPT_UNKNOWN ) // 4 Bits Called "Cut DSW"
3345   PORT_BIT( 0x0020, IP_ACTIVE_LOW,  IPT_UNKNOWN )
3346   PORT_BIT( 0x0040, IP_ACTIVE_LOW,  IPT_UNKNOWN )
3347   PORT_BIT( 0x0080, IP_ACTIVE_LOW,  IPT_UNKNOWN )
33483348
3349   PORT_START_TAG("IN3")   // 2 DSWs - $e00001 & 3.b
3349   PORT_START_TAG("DSW")   // 2 DSWs - $e00001 & 3.b
33503350   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3")
33513351   PORT_DIPSETTING(      0x0001, DEF_STR( 4C_1C ) )
33523352   PORT_DIPSETTING(      0x0002, DEF_STR( 3C_1C ) )
r2956r2957
33973397***************************************************************************/
33983398
33993399static INPUT_PORTS_START( blandia )
3400   PORT_START_TAG("IN0")   //Player 1 - $400000.w
3400   PORT_START_TAG("P1")   //Player 1 - $400000.w
34013401   JOY_TYPE1_3BUTTONS(1)
34023402
3403   PORT_START_TAG("IN1")   //Player 2 - $400002.w
3403   PORT_START_TAG("P2")   //Player 2 - $400002.w
34043404   JOY_TYPE1_3BUTTONS(2)
34053405
3406   PORT_START_TAG("IN2")   //Coins - $400004.w
3406   PORT_START_TAG("COINS")   //Coins - $400004.w
34073407   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
34083408   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
3409   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
3410   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_TILT     )
3411   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3412   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3413   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3414   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3409   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
3410   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
3411   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3412   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3413   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3414   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
34153415
3416   PORT_START_TAG("IN3")   //2 DSWs - $600001 & 3.b
3416   PORT_START_TAG("DSW")   //2 DSWs - $600001 & 3.b
34173417   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:1")
34183418   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
34193419   PORT_DIPSETTING(      0x0001, DEF_STR( On ) )
r2956r2957
34683468***************************************************************************/
34693469
34703470static INPUT_PORTS_START( blockcar )
3471   PORT_START_TAG("IN0")   //Player 1 - $500001.b
3471   PORT_START_TAG("P1")   //Player 1 - $500001.b
34723472   JOY_TYPE1_2BUTTONS(1)   // button2 = speed up
34733473
3474   PORT_START_TAG("IN1")   //Player 2 - $500003.b
3474   PORT_START_TAG("P2")   //Player 2 - $500003.b
34753475   JOY_TYPE1_2BUTTONS(2)
34763476
3477   PORT_START_TAG("IN2")   //Coins + DSW - $500005.b
3477   PORT_START_TAG("COINS")   //Coins + DSW - $500005.b
34783478   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
34793479   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
3480   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
3481   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_TILT     )
3480   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
3481   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
34823482   PORT_DIPNAME( 0x0010, 0x0000, "Title" )      /* This is a jumper pad */
34833483   PORT_DIPSETTING(      0x0010, "Thunder & Lightning 2" )
34843484   PORT_DIPSETTING(      0x0000, "Block Carnival" )
34853485
3486   PORT_START_TAG("IN3")   //2 DSWs - $300003 & 1.b
3486   PORT_START_TAG("DSW")   //2 DSWs - $300003 & 1.b
34873487   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2")
34883488   PORT_DIPSETTING(      0x0002, DEF_STR( Easy )    )
34893489   PORT_DIPSETTING(      0x0003, DEF_STR( Normal )  )
r2956r2957
35333533***************************************************************************/
35343534
35353535static INPUT_PORTS_START( calibr50 )
3536   PORT_START_TAG("IN0")   //Player 1
3536   PORT_START_TAG("P1")   //Player 1
35373537   JOY_TYPE2_2BUTTONS(1)
35383538
3539   PORT_START_TAG("IN1")   //Player 2
3539   PORT_START_TAG("P2")   //Player 2
35403540   JOY_TYPE2_2BUTTONS(2)
35413541
3542   PORT_START_TAG("IN2")   //Coins
3543   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3544   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3545   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3546   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3547   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_TILT     )
3548   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
3542   PORT_START_TAG("COINS")   //Coins
3543   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3544   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3545   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3546   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3547   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_TILT     )
3548   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
35493549   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
35503550   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
35513551
3552   PORT_START_TAG("IN3")   //2 DSWs - $600001 & 3.b
3552   PORT_START_TAG("DSW")   //2 DSWs - $600001 & 3.b
35533553   PORT_DIPNAME( 0x4001, 0x4000, "Licensed To" )
35543554   PORT_DIPSETTING(      0x0001, "Romstar"       )
35553555   PORT_DIPSETTING(      0x4001, "Taito America" )
r2956r2957
35953595   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
35963596   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
35973597
3598   PORT_START_TAG("IN4")   // Rotation Player 1
3598   PORT_START_TAG("ROT1")   // Rotation Player 1
35993599   JOY_ROTATION(1, Z, X)
36003600
3601   PORT_START_TAG("IN5")   // Rotation Player 2
3601   PORT_START_TAG("ROT2")   // Rotation Player 2
36023602   JOY_ROTATION(2, N, M)
36033603INPUT_PORTS_END
36043604
r2956r2957
36073607***************************************************************************/
36083608
36093609static INPUT_PORTS_START( daioh )
3610   PORT_START_TAG("IN0")
3610   PORT_START_TAG("P1")
36113611   JOY_TYPE1_3BUTTONS(1)
36123612
3613   PORT_START_TAG("IN1")
3613   PORT_START_TAG("P2")
36143614   JOY_TYPE1_3BUTTONS(2)
36153615
3616   PORT_START_TAG("IN2")
3616   PORT_START_TAG("COINS")
36173617   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
36183618   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
3619   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
3620   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
3619   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
3620   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
36213621   /* These are NOT Dip Switches but jumpers */
36223622   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) )   // JP9
36233623   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
r2956r2957
36323632   PORT_DIPSETTING(      0x0080, "USA (6 buttons)" )
36333633   PORT_DIPSETTING(      0x0000, "Japan (2 buttons)" )
36343634
3635   PORT_START_TAG("IN3")
3635   PORT_START_TAG("DSW")
36363636   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3")
36373637   PORT_DIPSETTING(      0x0001, DEF_STR( 4C_1C ) )
36383638   PORT_DIPSETTING(      0x0002, DEF_STR( 3C_1C ) )
r2956r2957
36783678   PORT_DIPSETTING(      0x4000, "800k and 2000k only" )
36793679   PORT_DIPSETTING(      0x0000, "1000k Only" )
36803680
3681   PORT_START_TAG("IN4")
3682   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
3683   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
3684   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
3685   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
3686   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
3687   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
3688   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
3689   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
3681   PORT_START_TAG("EXTRA")
3682   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
3683   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
3684   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
3685   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
3686   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
3687   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
3688   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
3689   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
36903690INPUT_PORTS_END
36913691
36923692/***************************************************************************
r2956r2957
36943694***************************************************************************/
36953695
36963696static INPUT_PORTS_START( drgnunit )
3697   PORT_START_TAG("IN0")   //Player 1
3697   PORT_START_TAG("P1")   //Player 1
36983698   JOY_TYPE1_3BUTTONS(1)
36993699
3700   PORT_START_TAG("IN1")   //Player 2
3700   PORT_START_TAG("P2")   //Player 2
37013701   JOY_TYPE1_3BUTTONS(2)
37023702
3703   PORT_START_TAG("IN2")   //Coins
3703   PORT_START_TAG("COINS")   //Coins
37043704   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
37053705   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
3706   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
3707   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_TILT     )
3706   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
3707   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
37083708   PORT_DIPNAME( 0x0010, 0x0010, "Coinage Type" ) // not supported
37093709   PORT_DIPSETTING(      0x0010, "1" )
37103710   PORT_DIPSETTING(      0x0000, "2" )
r2956r2957
37173717   PORT_DIPSETTING(      0x0040, "Seta USA / Taito America" )
37183718   PORT_DIPSETTING(      0x0000, "Seta USA / Romstar" )
37193719
3720   PORT_START_TAG("IN3")   //2 DSWs - $600001 & 3.b
3720   PORT_START_TAG("DSW")   //2 DSWs - $600001 & 3.b
37213721   PORT_DIPNAME( 0x0003, 0x0002, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:1,2")
37223722   PORT_DIPSETTING(      0x0003, DEF_STR( Easy ) )
37233723   PORT_DIPSETTING(      0x0002, DEF_STR( Normal ) )
r2956r2957
37653765***************************************************************************/
37663766
37673767static INPUT_PORTS_START( downtown )
3768   PORT_START_TAG("IN0")   //Player 1
3768   PORT_START_TAG("P1")   //Player 1
37693769   JOY_TYPE2_2BUTTONS(1)
37703770
3771   PORT_START_TAG("IN1")   //Player 2
3771   PORT_START_TAG("P2")   //Player 2
37723772   JOY_TYPE2_2BUTTONS(2)
37733773
3774   PORT_START_TAG("IN2")   //Coins
3775   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3776   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3777   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3778   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3779   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_TILT     )
3780   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
3774   PORT_START_TAG("COINS")   //Coins
3775   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3776   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3777   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3778   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3779   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_TILT     )
3780   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
37813781   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
37823782   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
37833783
3784   PORT_START_TAG("IN3")   //2 DSWs - $600001 & 3.b
3784   PORT_START_TAG("DSW")   //2 DSWs - $600001 & 3.b
37853785   PORT_DIPNAME( 0x0001, 0x0000, "Sales" )   PORT_DIPLOCATION("SW1:1")      /* Manual for USA version says "Always Off" */
37863786   PORT_DIPSETTING(      0x0001, "Japan Only" )
37873787   PORT_DIPSETTING(      0x0000, DEF_STR( World ) )
r2956r2957
38383838   PORT_DIPSETTING(      0x8000, "1" )
38393839   PORT_DIPSETTING(      0x0000, "2" )
38403840
3841   PORT_START_TAG("IN4")   //Rotation Player 1
3841   PORT_START_TAG("ROT1")   //Rotation Player 1
38423842   JOY_ROTATION(1, Z, X)
38433843
3844   PORT_START_TAG("IN5")   //Rotation Player 2
3844   PORT_START_TAG("ROT2")   //Rotation Player 2
38453845   JOY_ROTATION(2, N, M)
38463846INPUT_PORTS_END
38473847
r2956r2957
38523852***************************************************************************/
38533853
38543854static INPUT_PORTS_START( eightfrc )
3855   PORT_START_TAG("IN0")   //Player 1
3855   PORT_START_TAG("P1")   //Player 1
38563856   JOY_TYPE1_2BUTTONS(1)
38573857
3858   PORT_START_TAG("IN1")   //Player 2
3858   PORT_START_TAG("P2")   //Player 2
38593859   JOY_TYPE1_2BUTTONS(2)
38603860
3861   PORT_START_TAG("IN2")   //Coins
3861   PORT_START_TAG("COINS")   //Coins
38623862   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
38633863   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
3864   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
3865   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_TILT     )
3866   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
3867   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
3868   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
3869   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
3864   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
3865   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
3866   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
3867   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
3868   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
3869   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
38703870
3871   PORT_START_TAG("IN3")   //2 DSWs - $600001 & 3.b
3871   PORT_START_TAG("DSW")   //2 DSWs - $600001 & 3.b
38723872   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3")
38733873   PORT_DIPSETTING(      0x0004, DEF_STR( 4C_1C ) )
38743874   PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
r2956r2957
39233923***************************************************************************/
39243924
39253925static INPUT_PORTS_START( extdwnhl )
3926   PORT_START_TAG("IN0") //Player 1
3927   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(1)
3928   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(1)
3929   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
3930   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
3931   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
3932   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
3933   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
3934   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START1  )
3926   PORT_START_TAG("P1") //Player 1
3927   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(1)
3928   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(1)
3929   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
3930   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
3931   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
3932   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
3933   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
3934   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1  )
39353935
3936   PORT_START_TAG("IN1") //Player 2
3937   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(2)
3938   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(2)
3939   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
3940   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
3941   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
3942   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
3943   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
3944   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START2  )
3936   PORT_START_TAG("P2") //Player 2
3937   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(2)
3938   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(2)
3939   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
3940   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
3941   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
3942   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
3943   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
3944   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2  )
39453945
3946   PORT_START_TAG("IN2") //Coins
3946   PORT_START_TAG("COINS") //Coins
39473947   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
39483948   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
3949   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
3950   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_SERVICE )   // "test"
3949   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
3950   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE )   // "test"
39513951   /* These are NOT Dip Switches but jumpers */
39523952   PORT_DIPNAME( 0x0030, 0x0030, "Country" )
39533953   PORT_DIPSETTING(      0x0030, DEF_STR( World ) )
r2956r2957
39613961   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
39623962   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
39633963
3964   PORT_START_TAG("IN3") //2 DSWs - $400009 & b.b
3964   PORT_START_TAG("DSW") //2 DSWs - $400009 & b.b
39653965   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
39663966   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
39673967   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
40174017***************************************************************************/
40184018
40194019static INPUT_PORTS_START( gundhara )
4020   PORT_START_TAG("IN0") //Player 1
4020   PORT_START_TAG("P1") //Player 1
40214021   JOY_TYPE1_3BUTTONS(1)
40224022
4023   PORT_START_TAG("IN1") //Player 2
4023   PORT_START_TAG("P2") //Player 2
40244024   JOY_TYPE1_3BUTTONS(2)
40254025
4026   PORT_START_TAG("IN2") //Coins
4026   PORT_START_TAG("COINS") //Coins
40274027   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
40284028   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
4029   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4029   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
40304030   PORT_SERVICE_NO_TOGGLE( 0x0008, IP_ACTIVE_LOW)
4031   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4032   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4033   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4034   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4031   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4032   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4033   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4034   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
40354035
4036   PORT_START_TAG("IN3") //2 DSWs - $600001 & 3.b
4036   PORT_START_TAG("DSW") //2 DSWs - $600001 & 3.b
40374037   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3,4")
40384038   PORT_DIPSETTING(      0x0002, DEF_STR( 4C_1C ) )
40394039   PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
r2956r2957
40864086***************************************************************************/
40874087
40884088static INPUT_PORTS_START( zombraid )
4089   PORT_START_TAG("IN0") //Player 1
4090   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4091   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4092   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4093   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4094   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1  ) PORT_PLAYER(1)   PORT_NAME("P1 Trigger")
4095   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2  ) PORT_PLAYER(1)   PORT_NAME("P1 Reload")
4096   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4097   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START1   )
4089   PORT_START_TAG("P1") //Player 1
4090   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4091   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4092   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4093   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4094   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1  ) PORT_PLAYER(1)   PORT_NAME("P1 Trigger")
4095   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2  ) PORT_PLAYER(1)   PORT_NAME("P1 Reload")
4096   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4097   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1   )
40984098
4099   PORT_START_TAG("IN1") //Player 2
4100   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4101   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4102   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4103   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4104   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON1  ) PORT_PLAYER(2)   PORT_NAME("P2 Trigger")
4105   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_BUTTON2  ) PORT_PLAYER(2)   PORT_NAME("P2 Reload")
4106   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4107   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START2   )
4099   PORT_START_TAG("P2") //Player 2
4100   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4101   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4102   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4103   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4104   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1  ) PORT_PLAYER(2)   PORT_NAME("P2 Trigger")
4105   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2  ) PORT_PLAYER(2)   PORT_NAME("P2 Reload")
4106   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4107   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2   )
41084108
4109   PORT_START_TAG("IN2") //Coins
4109   PORT_START_TAG("COINS") //Coins
41104110   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
41114111   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
4112   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4113   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
4114   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4115   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4116   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4117   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4112   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4113   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
4114   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4115   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4116   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4117   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
41184118
4119   PORT_START_TAG("IN3")
4119   PORT_START_TAG("DSW")
41204120   PORT_DIPNAME( 0x0001, 0x0001, "Vertical Screen Flip" ) PORT_DIPLOCATION("SW2:1")
41214121   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
41224122   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
41644164   /* The user calibrated values are lost each time MAME starts, so the gun always needs to be re-calibrated. */
41654165   /* Either NVRAM or battery backed up RAM is not emulated. */
41664166   /* For now it is best to just use a Save State after calibration to remember the setting. */
4167   PORT_START_TAG("IN5")   /* Player 1 Gun X       ($f00003) */
4167   PORT_START_TAG("GUNX1")   /* Player 1 Gun X       ($f00003) */
41684168   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, -1, 0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_REVERSE PORT_PLAYER(1)
4169   PORT_START_TAG("IN6")   /* Player 1 Gun Y       ($f00003) */
4169   PORT_START_TAG("GUNY1")   /* Player 1 Gun Y       ($f00003) */
41704170   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y,  1, 0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1)
41714171
4172   PORT_START_TAG("IN7")   /* Player 2 Gun X       ($f00003) */
4172   PORT_START_TAG("GUNX2")   /* Player 2 Gun X       ($f00003) */
41734173   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, -1, 0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_REVERSE PORT_PLAYER(2)
4174   PORT_START_TAG("IN8")   /* Player 2 Gun Y       ($f00003) */
4174   PORT_START_TAG("GUNY2")   /* Player 2 Gun Y       ($f00003) */
41754175   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y,  1, 0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(2)
41764176INPUT_PORTS_END
41774177
r2956r2957
41814181***************************************************************************/
41824182
41834183static INPUT_PORTS_START( jjsquawk )
4184   PORT_START_TAG("IN0") //Player 1 - $400000.w
4184   PORT_START_TAG("P1") //Player 1 - $400000.w
41854185   JOY_TYPE1_2BUTTONS(1)
41864186
4187   PORT_START_TAG("IN1") //Player 2 - $400002.w
4187   PORT_START_TAG("P2") //Player 2 - $400002.w
41884188   JOY_TYPE1_2BUTTONS(2)
41894189
4190   PORT_START_TAG("IN2") //Coins - $400004.w
4190   PORT_START_TAG("COINS") //Coins - $400004.w
41914191   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
41924192   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
4193   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4194   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4195   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4196   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4197   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4198   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4193   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4194   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4195   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4196   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4197   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4198   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
41994199
4200   PORT_START_TAG("IN3") //2 DSWs - $600001 & 3.b
4200   PORT_START_TAG("DSW") //2 DSWs - $600001 & 3.b
42014201   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3")
42024202   PORT_DIPSETTING(      0x0001, DEF_STR( 4C_1C ) )
42034203   PORT_DIPSETTING(      0x0002, DEF_STR( 3C_1C ) )
r2956r2957
42494249***************************************************************************/
42504250
42514251static INPUT_PORTS_START( kamenrid )
4252   PORT_START_TAG("IN0") //Player 1
4252   PORT_START_TAG("P1") //Player 1
42534253   JOY_TYPE1_2BUTTONS(1)   // BUTTON3 in "test mode" only
42544254
4255   PORT_START_TAG("IN1") //Player 2
4255   PORT_START_TAG("P2") //Player 2
42564256   JOY_TYPE1_2BUTTONS(2)   // BUTTON3 in "test mode" only
42574257
4258   PORT_START_TAG("IN2") //Coins
4258   PORT_START_TAG("COINS") //Coins
42594259   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
42604260   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
4261   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4262   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_TILT     )
4261   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4262   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
42634263   /* These are NOT Dip Switches but jumpers */
42644264   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) )
42654265   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
r2956r2957
42744274   PORT_DIPSETTING(      0x0080, DEF_STR( USA ) )
42754275   PORT_DIPSETTING(      0x0000, DEF_STR( Japan ) )
42764276
4277   PORT_START   // IN3 - 2 DSWs - $500005 & 7.b
4277   PORT_START_TAG("DSW")   // IN3 - 2 DSWs - $500005 & 7.b
42784278   PORT_SERVICE( 0x0001, IP_ACTIVE_LOW )
42794279   PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unused ) )
42804280   PORT_DIPSETTING(      0x0002, DEF_STR( Off ) )
r2956r2957
43354335   PORT_BIT( 0x0fff, 0x0000, IPT_TRACKBALL_##_dir_ ) PORT_PLAYER(_n_) PORT_SENSITIVITY(70) PORT_KEYDELTA(30) PORT_REVERSE
43364336
43374337static INPUT_PORTS_START( krzybowl )
4338   PORT_START_TAG("IN0") //Player 1
4338   PORT_START_TAG("P1") //Player 1
43394339   JOY_TYPE1_3BUTTONS(1)
43404340
4341   PORT_START_TAG("IN1") //Player 2
4341   PORT_START_TAG("P2") //Player 2
43424342   JOY_TYPE1_3BUTTONS(2)
43434343
4344   PORT_START_TAG("IN2") //Coins
4344   PORT_START_TAG("COINS") //Coins
43454345   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
43464346   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
43474347   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(5)
4348   PORT_BIT(  0x0008, IP_ACTIVE_LOW,  IPT_UNKNOWN )
4349   PORT_BIT(  0x0010, IP_ACTIVE_LOW,  IPT_UNKNOWN )
4350   PORT_BIT(  0x0020, IP_ACTIVE_LOW,  IPT_UNKNOWN )
4351   PORT_BIT(  0x0040, IP_ACTIVE_LOW,  IPT_UNKNOWN )
4352   PORT_BIT(  0x0080, IP_ACTIVE_LOW,  IPT_UNKNOWN )
4348   PORT_BIT( 0x0008, IP_ACTIVE_LOW,  IPT_UNKNOWN )
4349   PORT_BIT( 0x0010, IP_ACTIVE_LOW,  IPT_UNKNOWN )
4350   PORT_BIT( 0x0020, IP_ACTIVE_LOW,  IPT_UNKNOWN )
4351   PORT_BIT( 0x0040, IP_ACTIVE_LOW,  IPT_UNKNOWN )
4352   PORT_BIT( 0x0080, IP_ACTIVE_LOW,  IPT_UNKNOWN )
43534353
4354   PORT_START_TAG("IN3") //2 DSWs - $600001 & 3.b
4354   PORT_START_TAG("DSW") //2 DSWs - $600001 & 3.b
43554355   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:1")
43564356   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
43574357   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
43994399   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
44004400   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
44014401
4402   PORT_START_TAG("IN4") //Rotation X Player 1
4402   PORT_START_TAG("TRACK1_X") //Rotation X Player 1
44034403   KRZYBOWL_TRACKBALL(X,1)
44044404
4405   PORT_START_TAG("IN5") //Rotation Y Player 1
4405   PORT_START_TAG("TRACK1_Y") //Rotation Y Player 1
44064406   KRZYBOWL_TRACKBALL(Y,1)
44074407
4408   PORT_START_TAG("IN6") //Rotation X Player 2
4408   PORT_START_TAG("TRACK2_X") //Rotation X Player 2
44094409   KRZYBOWL_TRACKBALL(X,2) PORT_REVERSE
44104410
4411   PORT_START_TAG("IN7") //Rotation Y Player 2
4411   PORT_START_TAG("TRACK2_Y") //Rotation Y Player 2
44124412   KRZYBOWL_TRACKBALL(Y,2)
44134413INPUT_PORTS_END
44144414
r2956r2957
44184418***************************************************************************/
44194419
44204420static INPUT_PORTS_START( madshark )
4421   PORT_START_TAG("IN0") //Player 1
4421   PORT_START_TAG("P1") //Player 1
44224422   JOY_TYPE1_2BUTTONS(1)
44234423
4424   PORT_START_TAG("IN1") //Player 2
4424   PORT_START_TAG("P2") //Player 2
44254425   JOY_TYPE1_2BUTTONS(2)
44264426
4427   PORT_START_TAG("IN2") //Coins
4427   PORT_START_TAG("COINS") //Coins
44284428   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
44294429   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
4430   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4431   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_TILT     )
4430   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4431   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
44324432   /* These are NOT Dip Switches but jumpers */
44334433   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) )
44344434   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
r2956r2957
44434443   PORT_DIPSETTING(      0x0080, DEF_STR( Japan ) )
44444444   PORT_DIPSETTING(      0x0000, DEF_STR( World ) )
44454445
4446   PORT_START_TAG("IN3") //2 DSWs
4446   PORT_START_TAG("DSW") //2 DSWs
44474447   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
44484448   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
44494449   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
44944494***************************************************************************/
44954495
44964496static INPUT_PORTS_START( metafox )
4497   PORT_START_TAG("IN0") //Player 1
4497   PORT_START_TAG("P1") //Player 1
44984498   JOY_TYPE2_2BUTTONS(1)
44994499
4500   PORT_START_TAG("IN1") //Player 2
4500   PORT_START_TAG("P2") //Player 2
45014501   JOY_TYPE2_2BUTTONS(2)
45024502
4503   PORT_START_TAG("IN2") //Coins
4504   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4505   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4506   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4507   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4508   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_TILT     )
4509   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
4503   PORT_START_TAG("COINS") //Coins
4504   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4505   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4506   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4507   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4508   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_TILT     )
4509   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
45104510   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
45114511   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
45124512
4513   PORT_START_TAG("IN3") //$600001 & 3.b
4513   PORT_START_TAG("DSW") //$600001 & 3.b
45144514   PORT_DIPNAME( 0x4001, 0x4001, "Licensed To"    )
45154515   PORT_DIPSETTING(      0x0001, "Jordan"        )
45164516   PORT_DIPSETTING(      0x4001, "Romstar"       )
r2956r2957
45634563
45644564
45654565static INPUT_PORTS_START( msgundam )
4566   PORT_START_TAG("IN0") //Player 1 - $400000.w
4566   PORT_START_TAG("P1") //Player 1 - $400000.w
45674567   JOY_TYPE1_2BUTTONS(1)
45684568
4569   PORT_START_TAG("IN1") //Player 2 - $400002.w
4569   PORT_START_TAG("P2") //Player 2 - $400002.w
45704570   JOY_TYPE1_2BUTTONS(2)
45714571
4572   PORT_START_TAG("IN2") //Coins - $400004.w
4572   PORT_START_TAG("COINS") //Coins - $400004.w
45734573   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
45744574   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
4575   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4576   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_TILT     )
4577   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4578   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4579   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4575   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4576   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
4577   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4578   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4579   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
45804580   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Language ) )
45814581   PORT_DIPSETTING(      0x0080, DEF_STR( English ) )
45824582   PORT_DIPSETTING(      0x0000, DEF_STR( Japanese ) )
45834583
4584   PORT_START_TAG("IN3") //2 DSWs - $600001 & 3.b
4584   PORT_START_TAG("DSW") //2 DSWs - $600001 & 3.b
45854585   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3")
45864586   PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
45874587   PORT_DIPSETTING(      0x0001, DEF_STR( 3C_1C ) )
r2956r2957
46334633static INPUT_PORTS_START( msgunda1 )
46344634   PORT_INCLUDE(msgundam)
46354635
4636   PORT_MODIFY("IN2") // IN2 - Coins - $400004.w
4636   PORT_MODIFY("COINS") // IN2 - Coins - $400004.w
46374637   /* this set seems to be a japan set, english mode doesn't work correctly */
46384638   PORT_DIPNAME( 0x0080, 0x0000, DEF_STR( Language ) )
46394639//  PORT_DIPSETTING(      0x0080, DEF_STR( English ) )
r2956r2957
46464646***************************************************************************/
46474647
46484648static INPUT_PORTS_START( oisipuzl )
4649   PORT_START_TAG("IN0") //Player 1
4649   PORT_START_TAG("P1") //Player 1
46504650   JOY_TYPE1_2BUTTONS(1)
46514651
4652   PORT_START_TAG("IN1") //Player 2
4652   PORT_START_TAG("P2") //Player 2
46534653   JOY_TYPE1_2BUTTONS(2)
46544654
4655   PORT_START_TAG("IN2") //Coins
4656   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
4657   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
4658   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4655   PORT_START_TAG("COINS") //Coins
4656   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
4657   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
4658   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
46594659   PORT_SERVICE_NO_TOGGLE( 0x0008, IP_ACTIVE_LOW )
4660   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
4661   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
4662   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
4663   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
4660   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
4661   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
4662   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
4663   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
46644664
4665   PORT_START_TAG("IN3") //2 DSWs - $600001 & 3.b
4665   PORT_START_TAG("DSW") //2 DSWs - $600001 & 3.b
46664666   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2")
46674667   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )
46684668   PORT_DIPSETTING(      0x0003, DEF_STR( Normal ) )
r2956r2957
47064706***************************************************************************/
47074707
47084708static INPUT_PORTS_START( kiwame )
4709   PORT_START_TAG("IN0") //Unused
4710   PORT_START_TAG("IN1") //Unused
4709   PORT_START_TAG("P1") //Unused
4710   PORT_START_TAG("P2") //Unused
47114711
4712   PORT_START_TAG("IN2") //Coins
4712   PORT_START_TAG("COINS") //Coins
47134713   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
47144714   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
47154715   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(5)
47164716
4717   PORT_START_TAG("IN3") //2 DSWs - $e00001 & 3.b
4717   PORT_START_TAG("DSW") //2 DSWs - $e00001 & 3.b
47184718   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3")
47194719   PORT_DIPSETTING(      0x0001, DEF_STR( 4C_1C ) )
47204720   PORT_DIPSETTING(      0x0002, DEF_STR( 3C_1C ) )
r2956r2957
47734773    5       st  bt
47744774*/
47754775
4776   PORT_START_TAG("IN4")
4777   PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
4778   PORT_BIT (0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
4779   PORT_BIT (0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
4780   PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP )
4781   PORT_BIT (0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
4776   PORT_START_TAG("KEY0")
4777   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
4778   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
4779   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
4780   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP )
4781   PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
47824782
4783   PORT_START_TAG("IN5")
4784   PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_B )
4785   PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_F )
4786   PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_J )
4787   PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_N )
4788   PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
4789   PORT_BIT(0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
4790   PORT_BIT (0xffc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
4783   PORT_START_TAG("KEY1")
4784   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_B )
4785   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_F )
4786   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_J )
4787   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_N )
4788   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
4789   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
4790   PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
47914791
4792   PORT_START_TAG("IN6")
4793   PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_A )
4794   PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_E )
4795   PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_I )
4796   PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_M )
4797   PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
4792   PORT_START_TAG("KEY2")
4793   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_A )
4794   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_E )
4795   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_I )
4796   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_M )
4797   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
47984798   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_START1  )
4799   PORT_BIT (0xffc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
4799   PORT_BIT( 0xffc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
48004800
4801   PORT_START_TAG("IN7")
4802   PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_C )
4803   PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_G )
4804   PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_K )
4805   PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
4806   PORT_BIT(0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
4807   PORT_BIT (0xffe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
4801   PORT_START_TAG("KEY3")
4802   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_C )
4803   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_G )
4804   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_K )
4805   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
4806   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
4807   PORT_BIT( 0xffe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
48084808
4809   PORT_START_TAG("IN8")
4810   PORT_BIT(0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_D )
4811   PORT_BIT(0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_H )
4812   PORT_BIT(0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_L )
4813   PORT_BIT(0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
4814   PORT_BIT (0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
4809   PORT_START_TAG("KEY4")
4810   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_D )
4811   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_H )
4812   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_L )
4813   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
4814   PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
48154815INPUT_PORTS_END
48164816
48174817
r2956r2957
48214821***************************************************************************/
48224822
48234823static INPUT_PORTS_START( qzkklogy )
4824   PORT_START_TAG("IN0") //Player 1 - $b00001.b
4825   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
4826   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
4827   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
4828   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
4829   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_BUTTON5 )   PORT_PLAYER(1) PORT_NAME("P1 Pause (Cheat)")// pause (cheat)
4830   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
4831   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
4832   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START1  )
4824   PORT_START_TAG("P1") //Player 1 - $b00001.b
4825   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
4826   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
4827   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
4828   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
4829   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON5 )   PORT_PLAYER(1) PORT_NAME("P1 Pause (Cheat)")// pause (cheat)
4830   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
4831   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
4832   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1  )
48334833
4834   PORT_START_TAG("IN1") //Player 2 - $b00003.b
4835   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
4836   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
4837   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
4838   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
4839   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )   PORT_PLAYER(2) PORT_NAME("P2 Pause (Cheat)")// pause (cheat)
4840   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
4841   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
4842   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START2  )
4834   PORT_START_TAG("P2") //Player 2 - $b00003.b
4835   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
4836   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
4837   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
4838   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
4839   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )   PORT_PLAYER(2) PORT_NAME("P2 Pause (Cheat)")// pause (cheat)
4840   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
4841   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
4842   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2  )
48434843
4844   PORT_START_TAG("IN2") //Coins - $b00005.b
4844   PORT_START_TAG("COINS") //Coins - $b00005.b
48454845   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
48464846   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
4847   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4848   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4847   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4848   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
48494849
4850   PORT_START_TAG("IN3") //2 DSWs - $600001 & 3.b
4850   PORT_START_TAG("DSW") //2 DSWs - $600001 & 3.b
48514851   PORT_DIPNAME( 0x0003, 0x0003, "Unknown 1-0&1*" ) /* Manual States dips 1-5 are unused */
48524852   PORT_DIPSETTING(      0x0000, "0" )
48534853   PORT_DIPSETTING(      0x0001, "1" )
r2956r2957
49014901***************************************************************************/
49024902
49034903static INPUT_PORTS_START( qzkklgy2 )
4904   PORT_START_TAG("IN0") //Player 1 - $b00001.b
4905   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
4906   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
4907   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
4908   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
4909   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
4910   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
4911   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
4912   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START1  )
4904   PORT_START_TAG("P1") //Player 1 - $b00001.b
4905   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
4906   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
4907   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
4908   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
4909   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
4910   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
4911   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
4912   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1  )
49134913
4914   PORT_START_TAG("IN1") //Player 2 - $b00003.b
4915   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
4916   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
4917   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
4918   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
4919   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
4920   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
4921   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
4922   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_START2  )
4914   PORT_START_TAG("P2") //Player 2 - $b00003.b
4915   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
4916   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
4917   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
4918   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
4919   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
4920   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
4921   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
4922   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2  )
49234923
4924   PORT_START_TAG("IN2") //Coins - $b00005.b
4924   PORT_START_TAG("COINS") //Coins - $b00005.b
49254925   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
49264926   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
4927   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4928   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
4927   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4928   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
49294929
4930   PORT_START_TAG("IN3") //2 DSWs - $600001 & 3.b
4930   PORT_START_TAG("DSW") //2 DSWs - $600001 & 3.b
49314931   PORT_DIPNAME( 0x0003, 0x0003, "Unknown 1-0&1*" ) /* Manual States dips 1-5 are unused */
49324932   PORT_DIPSETTING(      0x0000, "0" )
49334933   PORT_DIPSETTING(      0x0001, "1" )
r2956r2957
49804980***************************************************************************/
49814981
49824982static INPUT_PORTS_START( rezon )
4983   PORT_START_TAG("IN0") //Player 1
4983   PORT_START_TAG("P1") //Player 1
49844984   JOY_TYPE1_3BUTTONS(1)   // 1 used??
49854985
4986   PORT_START_TAG("IN1") //Player 2
4986   PORT_START_TAG("P2") //Player 2
49874987   JOY_TYPE1_3BUTTONS(2)   // 1 used ??
49884988
4989   PORT_START_TAG("IN2") //Coins
4989   PORT_START_TAG("COINS") //Coins
49904990   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
49914991   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
4992   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
4992   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
49934993   PORT_SERVICE_NO_TOGGLE( 0x0008, IP_ACTIVE_LOW)
4994   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no taito logo
4995   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
4996   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
4997   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
4994   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN ) // no taito logo
4995   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
4996   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
4997   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
49984998
4999   PORT_START_TAG("IN3") //2 DSWs - $600001 & 3.b
4999   PORT_START_TAG("DSW") //2 DSWs - $600001 & 3.b
50005000   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
50015001   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
50025002   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
50465046
50475047   PORT_INCLUDE( rezon )
50485048
5049   PORT_MODIFY("IN2")
5050   PORT_BIT(  0x0010, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // gives the taito logo
5049   PORT_MODIFY("COINS")
5050   PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // gives the taito logo
50515051INPUT_PORTS_END
50525052
50535053/***************************************************************************
r2956r2957
50595059    pressing P1's button3 freezes the game (pressing P2's button3 resumes it).
50605060*/
50615061static INPUT_PORTS_START( neobattl )
5062   PORT_START_TAG("IN0") // Player 1 - $400000.w
5062   PORT_START_TAG("P1") // Player 1 - $400000.w
50635063   JOY_TYPE1_1BUTTON(1)   // bump to 3 buttons for freezing to work
50645064
5065   PORT_START_TAG("IN1") //Player 2 - $400002.w
5065   PORT_START_TAG("P2") //Player 2 - $400002.w
50665066   JOY_TYPE1_1BUTTON(2)   // bump to 3 buttons for freezing to work
50675067
5068   PORT_START_TAG("IN2") //Coins - $400004.w
5068   PORT_START_TAG("COINS") //Coins - $400004.w
50695069   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
50705070   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
5071   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5072   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_TILT     )
5073   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5074   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5075   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5076   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5071   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5072   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
5073   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5074   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5075   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5076   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
50775077
5078   PORT_START_TAG("IN3") //2 DSWs - $600001 & 3.b
5078   PORT_START_TAG("DSW") //2 DSWs - $600001 & 3.b
50795079   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )
50805080   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
50815081   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
51355135***************************************************************************/
51365136
51375137static INPUT_PORTS_START( sokonuke )
5138   PORT_START_TAG("IN0") //Player 1
5138   PORT_START_TAG("P1") //Player 1
51395139   JOY_TYPE1_1BUTTON(1)
51405140
5141   PORT_START_TAG("IN1") //Player 2
5141   PORT_START_TAG("P2") //Player 2
51425142   JOY_TYPE1_1BUTTON(2)
51435143
5144   PORT_START_TAG("IN2") //Coins
5144   PORT_START_TAG("COINS") //Coins
51455145   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
51465146   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
5147   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5147   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
51485148   PORT_SERVICE_NO_TOGGLE( 0x0008, IP_ACTIVE_LOW )
5149   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
5150   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
5151   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
5152   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
5149   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
5150   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
5151   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
5152   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
51535153
5154   PORT_START_TAG("IN3") //2 DSWs - $400009 & b.b
5154   PORT_START_TAG("DSW") //2 DSWs - $400009 & b.b
51555155   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )
51565156   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
51575157   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
52075207***************************************************************************/
52085208
52095209static INPUT_PORTS_START( stg )
5210   PORT_START_TAG("IN0") //Player 1 - $b00001.b
5210   PORT_START_TAG("P1") //Player 1 - $b00001.b
52115211   JOY_TYPE1_2BUTTONS(1)
52125212
5213   PORT_START_TAG("IN1") //Player 2 - $b00003.b
5213   PORT_START_TAG("P2") //Player 2 - $b00003.b
52145214   JOY_TYPE1_2BUTTONS(2)
52155215
5216   PORT_START_TAG("IN2") //Coins - $b00005.b
5216   PORT_START_TAG("COINS") //Coins - $b00005.b
52175217   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
5218   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5219   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5220   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5218   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5219   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5220   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
52215221//  PORT_DIPNAME( 0x00f0, 0x00f0, "Title" )
52225222   /* This is the index in a table with pointers to the
52235223       title logo, but the table is filled with just 1 value */
52245224
5225   PORT_START_TAG("IN3") //2 DSWs - $600001 & 3.b
5225   PORT_START_TAG("DSW") //2 DSWs - $600001 & 3.b
52265226   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2")
52275227   PORT_DIPSETTING(      0x0002, DEF_STR( Easy )    ) // 0
52285228   PORT_DIPSETTING(      0x0003, DEF_STR( Normal )  ) // 4
r2956r2957
52645264***************************************************************************/
52655265
52665266static INPUT_PORTS_START( thunderl )
5267   PORT_START_TAG("IN0") //Player 1
5267   PORT_START_TAG("P1") //Player 1
52685268   JOY_TYPE1_2BUTTONS(1)   // button2 = speed up
52695269
5270   PORT_START_TAG("IN1") //Player 2
5270   PORT_START_TAG("P2") //Player 2
52715271   JOY_TYPE1_2BUTTONS(2)
52725272
5273   PORT_START_TAG("IN2") //Coins + DSW
5273   PORT_START_TAG("COINS") //Coins + DSW
52745274   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
52755275   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
5276   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5277   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_TILT     )
5276   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5277   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
52785278   PORT_DIPNAME( 0x0010, 0x0000, "Force 1 Life" )
52795279   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
52805280   PORT_DIPSETTING(      0x0010, DEF_STR( On ) )
r2956r2957
52885288//  PORT_DIPSETTING(      0x0020, DEF_STR( None ) )
52895289//  PORT_DIPSETTING(      0x0000, DEF_STR( None ) )
52905290
5291   PORT_START_TAG("IN3") //2 DSWs - $600003 & 1.b
5291   PORT_START_TAG("DSW") //2 DSWs - $600003 & 1.b
52925292   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3,4")
52935293   PORT_DIPSETTING(      0x000c, DEF_STR( 4C_1C ) )
52945294   PORT_DIPSETTING(      0x000d, DEF_STR( 3C_1C ) )
r2956r2957
53455345   PORT_DIPSETTING(      0xc000, DEF_STR( Normal ) )
53465346   PORT_DIPSETTING(      0x4000, DEF_STR( Hard ) )
53475347   PORT_DIPSETTING(      0x0000, DEF_STR( Hardest ) )
5348
5349   /* These are needed due to the memory map shared with Wit's */
5350   PORT_START_TAG("P3")
5351   PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED )
5352
5353   PORT_START_TAG("P4") //Player 4
5354   PORT_BIT( 0xffff, IP_ACTIVE_LOW, IPT_UNUSED )
53485355INPUT_PORTS_END
53495356
53505357
r2956r2957
53545361***************************************************************************/
53555362
53565363static INPUT_PORTS_START( tndrcade )
5357   PORT_START_TAG("IN0") //Player 1
5364   PORT_START_TAG("P1") //Player 1
53585365   JOY_TYPE1_2BUTTONS(1)
53595366
5360   PORT_START_TAG("IN1") //Player 2
5367   PORT_START_TAG("P2") //Player 2
53615368   JOY_TYPE1_2BUTTONS(2)
53625369
5363   PORT_START_TAG("IN2") //Coins
5370   PORT_START_TAG("COINS") //Coins
53645371   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
53655372   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
5366   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_START1   )
5367   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_START2   )
5368   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
5369   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_TILT     )
5370   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5371   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5373   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1   )
5374   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START2   )
5375   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
5376   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_TILT     )
5377   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5378   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
53725379
5373   PORT_START_TAG("IN3") //2 DSWs - $600001 & 3.b
5380   PORT_START_TAG("DSW") //2 DSWs - $600001 & 3.b
53745381   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2")
53755382   PORT_DIPSETTING(      0x0002, DEF_STR( Easy )    )
53765383   PORT_DIPSETTING(      0x0003, DEF_STR( Normal )  )
r2956r2957
54235430static INPUT_PORTS_START( tndrcadj )
54245431   PORT_INCLUDE(tndrcade)
54255432
5426   PORT_MODIFY("IN3") //2 DSWs - $600001 & 3.b
5433   PORT_MODIFY("DSW") //2 DSWs - $600001 & 3.b
54275434   PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW2:8")
54285435   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
54295436   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
54405447***************************************************************************/
54415448
54425449static INPUT_PORTS_START( twineagl )
5443   PORT_START_TAG("IN0") //Player 1
5450   PORT_START_TAG("P1") //Player 1
54445451   JOY_TYPE1_2BUTTONS(1)
54455452
5446   PORT_START_TAG("IN1") //Player 2
5453   PORT_START_TAG("P2") //Player 2
54475454   JOY_TYPE1_2BUTTONS(2)
54485455
5449   PORT_START_TAG("IN2") //Coins
5456   PORT_START_TAG("COINS") //Coins
54505457   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
54515458   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
5452   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_START1   )
5453   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_START2   )
5454   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
5455   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_TILT     )
5456   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5457   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5459   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1   )
5460   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START2   )
5461   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_SERVICE1 )
5462   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_TILT     )
5463   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5464   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
54585465
5459   PORT_START_TAG("IN3") //2 DSWs - $600001 & 3.b
5466   PORT_START_TAG("DSW") //2 DSWs - $600001 & 3.b
54605467   PORT_DIPNAME( 0x4001, 0x4001, "Copyright" )      // Always "Seta" if sim. players = 1
54615468   PORT_DIPSETTING(      0x4001, "Seta (Taito license)" )
54625469   PORT_DIPSETTING(      0x0001, "Taito" )
r2956r2957
55065513***************************************************************************/
55075514
55085515static INPUT_PORTS_START( umanclub )
5509   PORT_START_TAG("IN0") //Player 1
5516   PORT_START_TAG("P1") //Player 1
55105517   JOY_TYPE1_2BUTTONS(1)
55115518
5512   PORT_START_TAG("IN1") //Player 2
5519   PORT_START_TAG("P2") //Player 2
55135520   JOY_TYPE1_2BUTTONS(2)
55145521
5515   PORT_START_TAG("IN2") //Coins
5522   PORT_START_TAG("COINS") //Coins
55165523   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
55175524   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
5518   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5519   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_TILT     )
5520   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5521   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5522   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5523   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5525   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5526   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
5527   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5528   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5529   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5530   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
55245531
5525   PORT_START_TAG("IN3") //2 DSWs
5532   PORT_START_TAG("DSW") //2 DSWs
55265533   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) )
55275534   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
55285535   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
55815588***************************************************************************/
55825589
55835590static INPUT_PORTS_START( utoukond )
5584   PORT_START_TAG("IN0") //Player 1
5591   PORT_START_TAG("P1") //Player 1
55855592   JOY_TYPE1_3BUTTONS(1)
55865593
5587   PORT_START_TAG("IN1") //Player 2
5594   PORT_START_TAG("P2") //Player 2
55885595   JOY_TYPE1_3BUTTONS(2)
55895596
5590   PORT_START_TAG("IN2") //Coins
5597   PORT_START_TAG("COINS") //Coins
55915598   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
55925599   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
5593   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5594   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5600   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5601   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN  )
55955602   /* These are NOT Dip Switches but jumpers */
55965603   PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) )
55975604   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
r2956r2957
56065613   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
56075614   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
56085615
5609   PORT_START_TAG("IN3") //2 DSWs
5616   PORT_START_TAG("DSW") //2 DSWs
56105617   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3,4")
56115618   PORT_DIPSETTING(      0x0002, DEF_STR( 4C_1C ) )
56125619   PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
r2956r2957
57605767***************************************************************************/
57615768
57625769static INPUT_PORTS_START( wrofaero )
5763   PORT_START_TAG("IN0") //Player 1 - $400000.w
5770   PORT_START_TAG("P1") //Player 1 - $400000.w
57645771   JOY_TYPE1_3BUTTONS(1)   // 3rd button selects the weapon
57655772                     // when the dsw for cheating is on
57665773
5767   PORT_START_TAG("IN1") //Player 2 - $400002.w
5774   PORT_START_TAG("P2") //Player 2 - $400002.w
57685775   JOY_TYPE1_3BUTTONS(2)
57695776
5770   PORT_START_TAG("IN2") //Coins - $400004.w
5777   PORT_START_TAG("COINS") //Coins - $400004.w
57715778   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
57725779   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
5773   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5774   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_TILT     )
5775   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5776   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5777   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5778   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5780   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5781   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
5782   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5783   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5784   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5785   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
57795786
5780   PORT_START_TAG("IN3") //2 DSWs - $600001 & 3.b
5787   PORT_START_TAG("DSW") //2 DSWs - $600001 & 3.b
57815788   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:1")
57825789   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
57835790   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
58315838***************************************************************************/
58325839
58335840static INPUT_PORTS_START( wits )
5834   PORT_START_TAG("IN0") //Player 1
5841   PORT_START_TAG("P1") //Player 1
58355842   JOY_TYPE1_2BUTTONS(1)
58365843
5837   PORT_START_TAG("IN1") //Player 2
5844   PORT_START_TAG("P2") //Player 2
58385845   JOY_TYPE1_2BUTTONS(2)
58395846
5840   PORT_START_TAG("IN2") //Coins + DSW
5847   PORT_START_TAG("COINS") //Coins + DSW
58415848   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
58425849   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
5843   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5844   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_TILT     )
5850   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5851   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
58455852   PORT_DIPNAME( 0x0010, 0x0010, "Unknown 3-4*" )   // Jumpers, I guess
58465853   PORT_DIPSETTING(      0x0010, DEF_STR( Off ) )
58475854   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
58545861   PORT_DIPSETTING(      0x0040, "Visco (Japan Only)" )
58555862   PORT_DIPSETTING(      0x0000, "Athena (Japan Only)" )
58565863
5857   PORT_START_TAG("IN3") //2 DSWs - $600003 & 1.b
5864   PORT_START_TAG("DSW") //2 DSWs - $600003 & 1.b
58585865   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2")
58595866   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )
58605867   PORT_DIPSETTING(      0x0003, DEF_STR( Normal ) )
r2956r2957
58985905   PORT_DIPSETTING(      0x4000, DEF_STR( 1C_4C ) )
58995906   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_6C ) )
59005907
5901   PORT_START_TAG("IN4") //Player 3
5908   PORT_START_TAG("P3") //Player 3
59025909   JOY_TYPE1_2BUTTONS(3)
59035910
5904   PORT_START_TAG("IN5") //Player 4
5911   PORT_START_TAG("P4") //Player 4
59055912   JOY_TYPE1_2BUTTONS(4)
59065913INPUT_PORTS_END
59075914
r2956r2957
59115918***************************************************************************/
59125919
59135920static INPUT_PORTS_START( zingzip )
5914   PORT_START_TAG("IN0") //Player 1 - $400000.w
5921   PORT_START_TAG("P1") //Player 1 - $400000.w
59155922   JOY_TYPE1_2BUTTONS(1)
59165923
5917   PORT_START_TAG("IN1") //Player 2 - $400002.w
5924   PORT_START_TAG("P2") //Player 2 - $400002.w
59185925   JOY_TYPE1_2BUTTONS(2)
59195926
5920   PORT_START_TAG("IN2") //Coins - $400004.w
5927   PORT_START_TAG("COINS") //Coins - $400004.w
59215928   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
5922   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  ) // no coin 2
5923   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5924   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_TILT     )
5925   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5926   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5927   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5928   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5929   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN  ) // no coin 2
5930   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5931   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
5932   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5933   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5934   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
5935   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN  )
59295936
5930   PORT_START_TAG("IN3") //2 DSWs - $600001 & 3.b
5937   PORT_START_TAG("DSW") //2 DSWs - $600001 & 3.b
59315938   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
59325939   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
59335940   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
59755982*************************************/
59765983
59775984static INPUT_PORTS_START( pairlove )
5978   PORT_START_TAG("IN0") //Player 1 - $500001.b
5985   PORT_START_TAG("P1") //Player 1 - $500001.b
59795986   JOY_TYPE1_2BUTTONS(1)   // button2 = speed up
59805987
5981   PORT_START_TAG("IN1") //Player 2 - $500003.b
5988   PORT_START_TAG("P2") //Player 2 - $500003.b
59825989   JOY_TYPE1_2BUTTONS(2)
59835990
5984   PORT_START_TAG("IN2") //Coins + DSW - $500005.b
5991   PORT_START_TAG("COINS") //Coins + DSW - $500005.b
59855992   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
59865993   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
5987   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5988   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_TILT     )
5994   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
5995   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_TILT     )
59895996
59905997   PORT_START_TAG("DSW")    // 2 DIP switches
59915998   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
r2956r2957
60326039***************************************************************************/
60336040
60346041static INPUT_PORTS_START( orbs )
6035   PORT_START_TAG("IN0") //Player 1
6042   PORT_START_TAG("P1") //Player 1
60366043   JOY_TYPE1_1BUTTON(1)
60376044
6038   PORT_START_TAG("IN1") //Player 2 ??
6045   PORT_START_TAG("P2") //Player 2 ??
60396046   JOY_TYPE1_1BUTTON(2)
60406047
6041   PORT_START_TAG("IN2") //Coins
6048   PORT_START_TAG("COINS") //Coins
60426049   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
60436050   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(5)
60446051   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(5)
6045   PORT_BIT(  0x0008, IP_ACTIVE_LOW,  IPT_UNKNOWN )
6046   PORT_BIT(  0x0010, IP_ACTIVE_LOW,  IPT_UNKNOWN )
6047   PORT_BIT(  0x0020, IP_ACTIVE_LOW,  IPT_UNKNOWN )
6048   PORT_BIT(  0x0040, IP_ACTIVE_LOW,  IPT_UNKNOWN )
6049   PORT_BIT(  0x0080, IP_ACTIVE_LOW,  IPT_UNKNOWN )
6052   PORT_BIT( 0x0008, IP_ACTIVE_LOW,  IPT_UNKNOWN )
6053   PORT_BIT( 0x0010, IP_ACTIVE_LOW,  IPT_UNKNOWN )
6054   PORT_BIT( 0x0020, IP_ACTIVE_LOW,  IPT_UNKNOWN )
6055   PORT_BIT( 0x0040, IP_ACTIVE_LOW,  IPT_UNKNOWN )
6056   PORT_BIT( 0x0080, IP_ACTIVE_LOW,  IPT_UNKNOWN )
60506057
6051   PORT_START_TAG("IN3") //2 DSWs - $600001 & 3.b
6058   PORT_START_TAG("DSW") //2 DSWs - $600001 & 3.b
60526059   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:1")
60536060   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
60546061   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
61026109***************************************************************************/
61036110
61046111static INPUT_PORTS_START( crazyfgt )
6105   PORT_START_TAG("IN0") //Coins - $610000.w
6112   PORT_START_TAG("COINS") //Coins - $610000.w
61066113   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
61076114   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
61086115   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
61126119   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
61136120   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL )   // protection
61146121
6115   PORT_START_TAG("IN1") //? - $610002.w
6116   PORT_BIT(  0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
6117   PORT_BIT(  0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
6118   PORT_BIT(  0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
6119   PORT_BIT(  0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
6120   PORT_BIT(  0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
6121   PORT_BIT(  0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
6122   PORT_BIT(  0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
6123   PORT_BIT(  0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
6122   PORT_START_TAG("UNK") //? - $610002.w
6123   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
6124   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
6125   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
6126   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
6127   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
6128   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
6129   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
6130   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
61246131
6125   PORT_START_TAG("IN2") //Player - $610004.w
6132   PORT_START_TAG("INPUT") //Player - $610004.w
61266133   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("top-center")    PORT_CODE(KEYCODE_5_PAD)
61276134   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("bottom-center") PORT_CODE(KEYCODE_2_PAD)
61286135   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("top-left")      PORT_CODE(KEYCODE_4_PAD)
r2956r2957
61326139   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN  )
61336140   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SERVICE1 )   // ticket
61346141
6135   PORT_START_TAG("IN3") //2 DSWs - $630001 & 3.b
6142   PORT_START_TAG("DSW") //2 DSWs - $630001 & 3.b
61366143   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3")
61376144   PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
61386145   PORT_DIPSETTING(      0x0001, DEF_STR( 3C_1C ) )
r2956r2957
61836190***************************************************************************/
61846191
61856192static INPUT_PORTS_START( inttoote )
6186   PORT_START_TAG("IN0")   // DSW 1
6193   PORT_START_TAG("DSW1")   // DSW 1
61876194   PORT_DIPNAME( 0x03, 0x03, "Max Bet" )
61886195   PORT_DIPSETTING(    0x03, "10" )
61896196   PORT_DIPSETTING(    0x02, "20" )
r2956r2957
62086215   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
62096216   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
62106217
6211   PORT_START_TAG("IN1")   // DSW 2&3
6218   PORT_START_TAG("DSW2_3")   // DSW 2&3
62126219   PORT_DIPNAME( 0x0001, 0x0001, "Unknown 2-0" )
62136220   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
62146221   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
62626269   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
62636270   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
62646271
6265   PORT_START_TAG("IN2")
6272   PORT_START_TAG("IN0")
62666273   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
62676274   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
62686275   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SPECIAL ) // P1 coin out
r2956r2957
62806287   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
62816288   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
62826289
6283   PORT_START_TAG("IN3")
6290   PORT_START_TAG("IN1")
62846291   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_NAME("Door Open") PORT_TOGGLE
62856292   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START1 )
62866293   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Question Mark")
r2956r2957
63066313    5 1-6                 (5H)
63076314    6                     (6)
63086315*/
6309   PORT_START_TAG("IN4")   // 200000.w (0x08)
6316   PORT_START_TAG("BET0")   // 200000.w (0x08)
63106317   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 1") PORT_CODE(KEYCODE_1_PAD)
63116318   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 2") PORT_CODE(KEYCODE_2_PAD)
63126319   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 3") PORT_CODE(KEYCODE_3_PAD)
r2956r2957
63246331   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
63256332   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
63266333
6327   PORT_START_TAG("IN5")   // 200000.w (0x10)
6334   PORT_START_TAG("BET1")   // 200000.w (0x10)
63286335   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 6") PORT_CODE(KEYCODE_6_PAD)
63296336   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("P1 Collect")
63306337   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
63426349   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
63436350   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
63446351
6345   PORT_START_TAG("IN6")   // 200000.w (0x20)
6352   PORT_START_TAG("BET2")   // 200000.w (0x20)
63466353   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 1-2") PORT_CODE(KEYCODE_Q)
63476354   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 1-3") PORT_CODE(KEYCODE_A)
63486355   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 1-4") PORT_CODE(KEYCODE_Z)
r2956r2957
63606367   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
63616368   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
63626369
6363   PORT_START_TAG("IN7")   // 200000.w (0x40)
6370   PORT_START_TAG("BET3")   // 200000.w (0x40)
63646371   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 2-3") PORT_CODE(KEYCODE_W)
63656372   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 2-4") PORT_CODE(KEYCODE_S)
63666373   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 2-5") PORT_CODE(KEYCODE_X)
r2956r2957
63786385   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
63796386   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
63806387
6381   PORT_START_TAG("IN8")   // 200000.w (0x80)
6388   PORT_START_TAG("BET4")   // 200000.w (0x80)
63826389   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 3-5") PORT_CODE(KEYCODE_D)
63836390   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 3-6") PORT_CODE(KEYCODE_C)
63846391   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_OTHER ) PORT_NAME("P1 Bet 4-5") PORT_CODE(KEYCODE_R)
src/mame/drivers/truco.c
r2956r2957
3030
3131
3232static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
33   AM_RANGE(0x0000, 0x17ff) AM_RAM                           /* general purpose ram */
34   AM_RANGE(0x1800, 0x7bff) AM_RAM AM_BASE(&videoram)            /* video ram */
35   AM_RANGE(0x7c00, 0x7fff) AM_RAM AM_BASE(&battery_ram)         /* battery backed ram */
36   AM_RANGE(0x8000, 0x8000) AM_READWRITE(input_port_0_r, SMH_NOP)   /* controls (and irq ack?) */
37   AM_RANGE(0x8001, 0x8001) AM_READWRITE(SMH_NOP, SMH_NOP)         /* unknown */
38   AM_RANGE(0x8002, 0x8002) AM_READWRITE(input_port_1_r, DAC_0_data_w)   /* dipswitches */
39   AM_RANGE(0x8003, 0x8007) AM_READWRITE(SMH_NOP, SMH_NOP)         /* unknown */
33   AM_RANGE(0x0000, 0x17ff) AM_RAM                              /* general purpose ram */
34   AM_RANGE(0x1800, 0x7bff) AM_RAM AM_BASE(&videoram)               /* video ram */
35   AM_RANGE(0x7c00, 0x7fff) AM_RAM AM_BASE(&battery_ram)            /* battery backed ram */
36   AM_RANGE(0x8000, 0x8000) AM_READ_PORT("P1") AM_WRITENOP            /* controls (and irq ack?) */
37   AM_RANGE(0x8001, 0x8001) AM_READWRITE(SMH_NOP, SMH_NOP)            /* unknown */
38   AM_RANGE(0x8002, 0x8002) AM_READ_PORT("DSW") AM_WRITE(DAC_0_data_w)   /* dipswitches */
39   AM_RANGE(0x8003, 0x8007) AM_READWRITE(SMH_NOP, SMH_NOP)            /* unknown */
4040   AM_RANGE(0x8008, 0xffff) AM_ROM
4141ADDRESS_MAP_END
4242
4343static INPUT_PORTS_START( truco )
44   PORT_START   /* IN0 */
44   PORT_START_TAG("P1")   /* IN0 */
4545   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
4646   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
4747   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
5151   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
5252   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
5353
54   PORT_START /* DSW1 */
54   PORT_START_TAG("DSW")   /* DSW1 */
5555   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
5656   PORT_DIPSETTING (   0x01, DEF_STR( Off ) )
5757   PORT_DIPSETTING (   0x00, DEF_STR( On ) )
r2956r2957
7777   PORT_DIPSETTING (   0x80, DEF_STR( Off ) )
7878   PORT_DIPSETTING (   0x00, DEF_STR( On ) )
7979
80   PORT_START   /* IN1 - FAKE - Used for coinup */
80   PORT_START_TAG("COIN")   /* IN1 - FAKE - Used for coinup */
8181   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
8282   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
8383   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
123123   /* coinup */
124124   static int trigger = 0;
125125
126   if ( input_port_read_indexed(machine,  2 ) & 1 )
126   if ( input_port_read(machine,  "COIN") & 1 )
127127   {
128128      if ( trigger == 0 )
129129      {
src/mame/drivers/tnzs.c
r2956r2957
247247
248248#include "driver.h"
249249#include "deprecat.h"
250#include "taitoipt.h"
250251#include "cpu/i8x41/i8x41.h"
251252#include "sound/2203intf.h"
252253#include "sound/dac.h"
r2956r2957
444445   AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_BANK2)
445446   AM_RANGE(0xb000, 0xb000) AM_READ(YM2203_status_port_0_r)
446447   AM_RANGE(0xb001, 0xb001) AM_READ(YM2203_read_port_0_r)
447   AM_RANGE(0xc000, 0xc000) AM_READ(input_port_2_r)
448   AM_RANGE(0xc001, 0xc001) AM_READ(input_port_3_r)
449   AM_RANGE(0xc002, 0xc002) AM_READ(input_port_4_r)
448   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("IN0")
449   AM_RANGE(0xc001, 0xc001) AM_READ_PORT("IN1")
450   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("IN2")
450451   AM_RANGE(0xd000, 0xdfff) AM_READ(SMH_RAM)
451452   AM_RANGE(0xe000, 0xefff) AM_READ(tnzs_sharedram_r)
452453ADDRESS_MAP_END
r2956r2957
472473   AM_RANGE(0x0000, 0x7fff) AM_ROM
473474   AM_RANGE(0x8000, 0x9fff) AM_ROMBANK(2)
474475   AM_RANGE(0xa000, 0xa000) AM_WRITE(tnzs_bankswitch1_w)
475   AM_RANGE(0xb002, 0xb002) AM_READ(input_port_0_r)
476   AM_RANGE(0xb003, 0xb003) AM_READ(input_port_1_r)
476   AM_RANGE(0xb002, 0xb002) AM_READ_PORT("DSWA")
477   AM_RANGE(0xb003, 0xb003) AM_READ_PORT("DSWB")
477478   AM_RANGE(0xb004, 0xb004) AM_WRITE(tnzsb_sound_command_w)
478   AM_RANGE(0xc000, 0xc000) AM_READ(input_port_2_r)
479   AM_RANGE(0xc001, 0xc001) AM_READ(input_port_3_r)
480   AM_RANGE(0xc002, 0xc002) AM_READ(input_port_4_r)
479   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("IN0")
480   AM_RANGE(0xc001, 0xc001) AM_READ_PORT("IN1")
481   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("IN2")
481482   AM_RANGE(0xd000, 0xdfff) AM_RAM
482483   AM_RANGE(0xe000, 0xefff) AM_READWRITE(tnzs_sharedram_r, tnzs_sharedram_w)
483484   AM_RANGE(0xf000, 0xf003) AM_READ(SMH_RAM)
r2956r2957
488489   AM_RANGE(0x0000, 0x7fff) AM_ROM
489490   AM_RANGE(0x8000, 0x9fff) AM_ROMBANK(2)
490491   AM_RANGE(0xa000, 0xa000) AM_WRITE(tnzs_bankswitch1_w)
491   AM_RANGE(0xb002, 0xb002) AM_READ(input_port_0_r)
492   AM_RANGE(0xb003, 0xb003) AM_READ(input_port_1_r)
492   AM_RANGE(0xb002, 0xb002) AM_READ_PORT("DSWA")
493   AM_RANGE(0xb003, 0xb003) AM_READ_PORT("DSWB")
493494   AM_RANGE(0xb004, 0xb004) AM_WRITE(tnzsb_sound_command_w)
494   AM_RANGE(0xc000, 0xc000) AM_READ(input_port_2_r)
495   AM_RANGE(0xc001, 0xc001) AM_READ(input_port_3_r)
496   AM_RANGE(0xc002, 0xc002) AM_READ(input_port_4_r)
495   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("IN0")
496   AM_RANGE(0xc001, 0xc001) AM_READ_PORT("IN1")
497   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("IN2")
497498   AM_RANGE(0xd000, 0xdfff) AM_RAM
498499   AM_RANGE(0xe000, 0xefff) AM_READWRITE(tnzs_sharedram_r, tnzs_sharedram_w)
499500   AM_RANGE(0xf800, 0xfbff) AM_WRITE(paletteram_xRRRRRGGGGGBBBBB_le_w) AM_BASE(&paletteram)
r2956r2957
536537static ADDRESS_MAP_START( i8742_readport, ADDRESS_SPACE_IO, 8 )
537538   AM_RANGE(I8X41_p1, I8X41_p1) AM_READ(tnzs_port1_r)
538539   AM_RANGE(I8X41_p2, I8X41_p2) AM_READ(tnzs_port2_r)
539   AM_RANGE(I8X41_t0, I8X41_t0) AM_READ(input_port_5_r)
540   AM_RANGE(I8X41_t1, I8X41_t1) AM_READ(input_port_6_r)
540   AM_RANGE(I8X41_t0, I8X41_t0) AM_READ_PORT("COIN1")
541   AM_RANGE(I8X41_t1, I8X41_t1) AM_READ_PORT("COIN2")
541542ADDRESS_MAP_END
542543
543544static ADDRESS_MAP_START( i8742_writeport, ADDRESS_SPACE_IO, 8 )
r2956r2957
602603   AM_RANGE(0x8000, 0x9fff) AM_READWRITE(SMH_BANK2, SMH_ROM)
603604
604605   AM_RANGE(0xa000, 0xa000) AM_WRITE(jpopnics_subbankswitch_w)
605   AM_RANGE(0xb000, 0xb000) AM_READ(input_port_0_r) AM_WRITE(YM2151_register_port_0_w)
606   AM_RANGE(0xb000, 0xb000) AM_READ_PORT("IN0") AM_WRITE(YM2151_register_port_0_w)
606607   AM_RANGE(0xb001, 0xb001) AM_READWRITE(YM2151_status_port_0_r, YM2151_data_port_0_w)
607   AM_RANGE(0xc000, 0xc000) AM_READ(input_port_1_r)
608   AM_RANGE(0xc001, 0xc001) AM_READ(input_port_2_r)
609   AM_RANGE(0xc600, 0xc600) AM_READ(input_port_3_r)
610   AM_RANGE(0xc601, 0xc601) AM_READ(input_port_4_r)
608   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("IN1")
609   AM_RANGE(0xc001, 0xc001) AM_READ_PORT("IN2")
610   AM_RANGE(0xc600, 0xc600) AM_READ_PORT("DSWA")
611   AM_RANGE(0xc601, 0xc601) AM_READ_PORT("DSWB")
611612
612613   AM_RANGE(0xd000, 0xdfff) AM_RAM
613614   AM_RANGE(0xe000, 0xefff) AM_RAM AM_SHARE(1)
r2956r2957
615616   AM_RANGE(0xf000, 0xf003) AM_READ(arknoid2_sh_f000_r)
616617ADDRESS_MAP_END
617618
618#define TNZS_PLAYER_INPUT(_n_)\
619   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(_n_)\
620   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(_n_)\
621   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(_n_)\
622   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(_n_)\
623   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(_n_)\
624   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(_n_)\
625   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )\
626   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START##_n_ )
627
628619#define COMMON_IN2\
629620   PORT_START_TAG("IN2")\
630621   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )\
r2956r2957
646637   PORT_BIT( 0x01, coinstate, IPT_COIN2 )\
647638   PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNUSED )
648639
649#define TAITO_COINAGE_JAPAN_8\
650   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )\
651   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )\
652   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )\
653   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )\
654   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )\
655   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )\
656   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )\
657   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) )\
658   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )\
659   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
660
661#define TAITO_COINAGE_WORLD_8\
662   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )\
663   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )\
664   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )\
665   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )\
666   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )\
667   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )\
668   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )\
669   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )\
670   PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) )\
671   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
672
673640static INPUT_PORTS_START( extrmatn )
674641   PORT_START_TAG("DSWA")
675642   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
r2956r2957
682649   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
683650   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
684651   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
685   TAITO_COINAGE_JAPAN_8
652   TAITO_COINAGE_JAPAN_OLD
686653
687654   PORT_START_TAG("DSWB")
688655   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
r2956r2957
709676   PORT_DIPSETTING(    0x00, "*3" )
710677
711678   PORT_START_TAG("IN0")
712   TNZS_PLAYER_INPUT(1)
679   TAITO_JOY_LRUD_2_BUTTONS_START( 1 )
713680
714
715681   PORT_START_TAG("IN1")
716   TNZS_PLAYER_INPUT(2)
682   TAITO_JOY_LRUD_2_BUTTONS_START( 2 )
717683
718684   COMMON_IN2
719685   COMMON_COIN1(IP_ACTIVE_HIGH)
720686   COMMON_COIN2(IP_ACTIVE_HIGH)
721687INPUT_PORTS_END
722688
723#define ARKNOI2_COMMON\
724   PORT_START_TAG("DSWB")\
725   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )\
726   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )\
727   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )\
728   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )\
729   PORT_DIPSETTING(    0x00, DEF_STR( Very_Hard ) )\
730   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )\
731   PORT_DIPSETTING(    0x00, "50k 150k" )\
732   PORT_DIPSETTING(    0x0c, "100k 200k" )\
733   PORT_DIPSETTING(    0x04, "50k Only" )\
734   PORT_DIPSETTING(    0x08, "100k Only" )\
735   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )\
736   PORT_DIPSETTING(    0x20, "2" )\
737   PORT_DIPSETTING(    0x30, "3" )\
738   PORT_DIPSETTING(    0x10, "4" )\
739   PORT_DIPSETTING(    0x00, "5" )\
740   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )\
741   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )\
742   PORT_DIPSETTING(    0x00, DEF_STR( On ) )\
743   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Allow_Continue ) )\
744   PORT_DIPSETTING(    0x80, DEF_STR( No ) )\
745   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )\
746   PORT_START_TAG("IN1")      /* read at c000 (sound cpu) */\
747   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)\
748   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )\
749   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )\
750   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )\
751   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )\
752   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )\
753   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )\
754   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )\
755   PORT_START_TAG("EMPTY")\
756   COMMON_IN2\
757   COMMON_COIN1(IP_ACTIVE_HIGH)\
758   COMMON_COIN2(IP_ACTIVE_HIGH)\
759   PORT_START_TAG("AN1")      /* spinner 1 - read at f000/1 */\
760   PORT_BIT   ( 0x0fff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(70) PORT_KEYDELTA(15)\
761   PORT_BIT   ( 0x1000, IP_ACTIVE_LOW,  IPT_COIN2 )   /* Mirrored for service mode */\
762   PORT_BIT   ( 0x2000, IP_ACTIVE_HIGH, IPT_SERVICE1 )   /* Mirrored for service mode */\
763   PORT_BIT   ( 0x4000, IP_ACTIVE_LOW,  IPT_COIN1 )   /* Mirrored for service mode */\
764   PORT_BIT   ( 0x8000, IP_ACTIVE_LOW,  IPT_UNKNOWN )\
765   PORT_START_TAG("AN2")      /* spinner 2 - read at f002/3 */\
766   PORT_BIT   ( 0x0fff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(70) PORT_KEYDELTA(15) PORT_PLAYER(2)\
767   PORT_BIT   ( 0xf000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
768
769689static INPUT_PORTS_START( arknoid2 )
770690   PORT_START_TAG("DSWA")
771691   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
r2956r2957
778698   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
779699   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
780700   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
781   TAITO_COINAGE_WORLD_8
782   ARKNOI2_COMMON
701   TAITO_COINAGE_WORLD
702
703   PORT_START_TAG("DSWB")
704   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
705   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
706   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )
707   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )
708   PORT_DIPSETTING(    0x00, DEF_STR( Very_Hard ) )
709   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
710   PORT_DIPSETTING(    0x00, "50k 150k" )
711   PORT_DIPSETTING(    0x0c, "100k 200k" )
712   PORT_DIPSETTING(    0x04, "50k Only" )
713   PORT_DIPSETTING(    0x08, "100k Only" )
714   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
715   PORT_DIPSETTING(    0x20, "2" )
716   PORT_DIPSETTING(    0x30, "3" )
717   PORT_DIPSETTING(    0x10, "4" )
718   PORT_DIPSETTING(    0x00, "5" )
719   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
720   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
721   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
722   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Allow_Continue ) )
723   PORT_DIPSETTING(    0x80, DEF_STR( No ) )
724   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
725
726   PORT_START_TAG("IN0")      /* read at c000 (sound cpu) */
727   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
728   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
729   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
730   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
731   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
732   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
733   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
734   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
735
736   PORT_START_TAG("IN1")
737   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
738
739   COMMON_IN2
740   COMMON_COIN1(IP_ACTIVE_HIGH)
741   COMMON_COIN2(IP_ACTIVE_HIGH)
742
743   PORT_START_TAG("AN1")      /* spinner 1 - read at f000/1 */\
744   PORT_BIT   ( 0x0fff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(70) PORT_KEYDELTA(15)\
745   PORT_BIT   ( 0x1000, IP_ACTIVE_LOW,  IPT_COIN2 )   /* Mirrored for service mode */\
746   PORT_BIT   ( 0x2000, IP_ACTIVE_HIGH, IPT_SERVICE1 )   /* Mirrored for service mode */\
747   PORT_BIT   ( 0x4000, IP_ACTIVE_LOW,  IPT_COIN1 )   /* Mirrored for service mode */\
748   PORT_BIT   ( 0x8000, IP_ACTIVE_LOW,  IPT_UNKNOWN )\
749
750   PORT_START_TAG("AN2")      /* spinner 2 - read at f002/3 */\
751   PORT_BIT   ( 0x0fff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(70) PORT_KEYDELTA(15) PORT_PLAYER(2)\
752   PORT_BIT   ( 0xf000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
783753INPUT_PORTS_END
784754
785755static INPUT_PORTS_START( arknid2u )
786   PORT_START_TAG("DSWA")
787   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
788   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
789   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
790   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
791   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
792   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
793   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
794   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
795   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
796   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
797   TAITO_COINAGE_JAPAN_8
798   ARKNOI2_COMMON
756   PORT_INCLUDE( arknoid2 )
757
758   PORT_MODIFY("DSWA")
759   TAITO_COINAGE_JAPAN_OLD
799760INPUT_PORTS_END
800761
801762static INPUT_PORTS_START( plumppop )
r2956r2957
810771   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
811772   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
812773   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
813   TAITO_COINAGE_JAPAN_8
774   TAITO_COINAGE_JAPAN_OLD
814775
815776   PORT_START_TAG("DSWB")
816777   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
r2956r2957
877838
878839
879840static INPUT_PORTS_START( jpopnics )
880   PORT_START
841   PORT_START_TAG("IN0")
881842   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
882843
883   PORT_START
844   PORT_START_TAG("IN1")
884845   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
885846   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
886847   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P1 Button 2 (Cheat)")
887848   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
888849   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
889850
890
891   PORT_START
851   PORT_START_TAG("IN2")
892852   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
893853   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
894854   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("P2 Button 2 (Cheat)") PORT_PLAYER(2)
895855   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
896856   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
897857
898    PORT_START
858    PORT_START_TAG("DSWA")
899859   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
900860   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
901861   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
906866   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
907867   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
908868   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
909   TAITO_COINAGE_JAPAN_8
869   TAITO_COINAGE_JAPAN_OLD
910870
911     PORT_START
871     PORT_START_TAG("DSWB")
912872     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
913873     PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
914874     PORT_DIPSETTING(    0x03, DEF_STR( Medium ) )
r2956r2957
931891     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
932892     PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
933893
934     PORT_START
935     PORT_START
894   PORT_START_TAG("COIN1")
895   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
936896
897   PORT_START_TAG("COIN2")
898   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
937899
938900   PORT_START_TAG("AN1")      /* spinner 1 - read at f000/1 */
939901   PORT_BIT( 0xffff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(70) PORT_KEYDELTA(15)
r2956r2957
942904   PORT_BIT( 0xffff, 0x0000, IPT_DIAL ) PORT_SENSITIVITY(70) PORT_KEYDELTA(15) PORT_PLAYER(2)
943905INPUT_PORTS_END
944906
945
946#define DRTOPP_COMMON\
947   PORT_START_TAG("DSWB")\
948   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )\
949   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )\
950   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) )\
951   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )\
952   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )\
953   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )\
954   PORT_DIPSETTING(    0x0c, "30000" )\
955   PORT_DIPSETTING(    0x00, DEF_STR( Unknown ) )\
956   PORT_DIPSETTING(    0x04, DEF_STR( Unknown ) )\
957   PORT_DIPSETTING(    0x08, DEF_STR( Unknown ) )\
958   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )\
959   PORT_DIPSETTING(    0x20, "2" )\
960   PORT_DIPSETTING(    0x30, "3" )\
961   PORT_DIPSETTING(    0x10, "4" )\
962   PORT_DIPSETTING(    0x00, "5" )\
963   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )\
964   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )\
965   PORT_DIPSETTING(    0x00, DEF_STR( On ) )\
966   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )\
967   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )\
968   PORT_DIPSETTING(    0x00, DEF_STR( On ) )\
969   PORT_START_TAG("IN0")\
970   TNZS_PLAYER_INPUT(1)\
971   PORT_START_TAG("IN1")\
972   TNZS_PLAYER_INPUT(2)\
973   COMMON_IN2\
974   COMMON_COIN1(IP_ACTIVE_HIGH)\
975   COMMON_COIN2(IP_ACTIVE_HIGH)
976
977907static INPUT_PORTS_START( drtoppel )
978908   PORT_START_TAG("DSWA")
979909   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
r2956r2957
986916   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
987917   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
988918   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
989   TAITO_COINAGE_WORLD_8
990   DRTOPP_COMMON
991INPUT_PORTS_END
919   TAITO_COINAGE_WORLD
992920
993static INPUT_PORTS_START( drtopplu )
994   PORT_START_TAG("DSWA")
995   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
996   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
997   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
998   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
999   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
921   PORT_START_TAG("DSWB")
922   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
923   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
924   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) )
925   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )
926   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
927   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
928   PORT_DIPSETTING(    0x0c, "30000" )
929   PORT_DIPSETTING(    0x00, DEF_STR( Unknown ) )
930   PORT_DIPSETTING(    0x04, DEF_STR( Unknown ) )
931   PORT_DIPSETTING(    0x08, DEF_STR( Unknown ) )
932   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
933   PORT_DIPSETTING(    0x20, "2" )
934   PORT_DIPSETTING(    0x30, "3" )
935   PORT_DIPSETTING(    0x10, "4" )
936   PORT_DIPSETTING(    0x00, "5" )
937   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
938   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1000939   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1001   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
1002   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
1003   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1004   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1005   TAITO_COINAGE_JAPAN_8
1006   DRTOPP_COMMON
1007INPUT_PORTS_END
940   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
941   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
942   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1008943
1009#define CHUKA_COMMON\
1010   PORT_START_TAG("DSWB")\
1011   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )\
1012   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )\
1013   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) )\
1014   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )\
1015   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )\
1016   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )\
1017   PORT_DIPSETTING(    0x08, "100k 300k 440k" )\
1018   PORT_DIPSETTING(    0x00, "100k 300k 500k" )\
1019   PORT_DIPSETTING(    0x0c, "100k 400k" )\
1020   PORT_DIPSETTING(    0x04, "100k 500k" )\
1021   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )\
1022   PORT_DIPSETTING(    0x00, "1" )\
1023   PORT_DIPSETTING(    0x10, "2" )\
1024   PORT_DIPSETTING(    0x30, "3" )\
1025   PORT_DIPSETTING(    0x20, "4" )\
1026   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )\
1027   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )\
1028   PORT_DIPSETTING(    0x00, DEF_STR( On ) )\
1029   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )\
1030   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )\
1031   PORT_DIPSETTING(    0x00, DEF_STR( On ) )\
1032   PORT_START_TAG("IN0")\
1033   TNZS_PLAYER_INPUT(1)\
1034   PORT_START_TAG("IN1")\
1035   TNZS_PLAYER_INPUT(2)\
1036   COMMON_IN2\
1037   COMMON_COIN1(IP_ACTIVE_HIGH)\
944   PORT_START_TAG("IN0")
945   TAITO_JOY_LRUD_2_BUTTONS_START( 1 )
946
947   PORT_START_TAG("IN1")
948   TAITO_JOY_LRUD_2_BUTTONS_START( 2 )
949
950   COMMON_IN2
951   COMMON_COIN1(IP_ACTIVE_HIGH)
1038952   COMMON_COIN2(IP_ACTIVE_HIGH)
953INPUT_PORTS_END
1039954
955static INPUT_PORTS_START( drtopplu )
956   PORT_INCLUDE( drtoppel )
957
958   PORT_MODIFY("DSWA")
959   TAITO_COINAGE_JAPAN_OLD
960INPUT_PORTS_END
961
1040962static INPUT_PORTS_START( chukatai )
1041963   PORT_START_TAG("DSWA")
1042964   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
r2956r2957
1049971   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
1050972   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1051973   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1052   TAITO_COINAGE_WORLD_8
974   TAITO_COINAGE_WORLD
1053975
1054   CHUKA_COMMON
976   PORT_START_TAG("DSWB")
977   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
978   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
979   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) )
980   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )
981   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
982   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
983   PORT_DIPSETTING(    0x08, "100k 300k 440k" )
984   PORT_DIPSETTING(    0x00, "100k 300k 500k" )
985   PORT_DIPSETTING(    0x0c, "100k 400k" )
986   PORT_DIPSETTING(    0x04, "100k 500k" )
987   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
988   PORT_DIPSETTING(    0x00, "1" )
989   PORT_DIPSETTING(    0x10, "2" )
990   PORT_DIPSETTING(    0x30, "3" )
991   PORT_DIPSETTING(    0x20, "4" )
992   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
993   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
994   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
995   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
996   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
997   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
998
999   PORT_START_TAG("IN0")
1000   TAITO_JOY_LRUD_2_BUTTONS_START( 1 )
1001
1002   PORT_START_TAG("IN1")
1003   TAITO_JOY_LRUD_2_BUTTONS_START( 2 )
1004
1005   COMMON_IN2
1006   COMMON_COIN1(IP_ACTIVE_HIGH)
1007   COMMON_COIN2(IP_ACTIVE_HIGH)
10551008INPUT_PORTS_END
10561009
10571010static INPUT_PORTS_START( chukatau )
1058   PORT_START_TAG("DSWA")
1059   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
1060   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1061   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
1062   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
1063   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1064   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1065   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
1066   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
1067   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1068   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1069   TAITO_COINAGE_JAPAN_8
1011   PORT_INCLUDE( chukatai )
10701012
1071   CHUKA_COMMON
1013   PORT_MODIFY("DSWA")
1014   TAITO_COINAGE_JAPAN_OLD
10721015INPUT_PORTS_END
10731016
1074#define TNZS_COMMON\
1075   PORT_START_TAG("DSWB")\
1076   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )\
1077   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )\
1078   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) )\
1079   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )\
1080   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )\
1081   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )\
1082   PORT_DIPSETTING(    0x00, "50000 150000" )\
1083   PORT_DIPSETTING(    0x0c, "70000 200000" )\
1084   PORT_DIPSETTING(    0x04, "100000 250000" )\
1085   PORT_DIPSETTING(    0x08, "200000 300000" )\
1086   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )\
1087   PORT_DIPSETTING(    0x20, "2" )\
1088   PORT_DIPSETTING(    0x30, "3" )\
1089   PORT_DIPSETTING(    0x00, "4" )\
1090   PORT_DIPSETTING(    0x10, "5" )\
1091   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) )\
1092   PORT_DIPSETTING(    0x00, DEF_STR( No ) )\
1093   PORT_DIPSETTING(    0x40, DEF_STR( Yes ) )\
1094   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )\
1095   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )\
1096   PORT_DIPSETTING(    0x00, DEF_STR( On ) )\
1097   PORT_START_TAG("IN0")\
1098   TNZS_PLAYER_INPUT(1)
1099
11001017static INPUT_PORTS_START( tnzs )
11011018   PORT_START_TAG("DSWA")
11021019   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
r2956r2957
11091026   PORT_DIPNAME( 0x08, 0x08, "Invulnerability (Debug)" )   // see notes
11101027   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
11111028   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1112   TAITO_COINAGE_JAPAN_8
1029   TAITO_COINAGE_JAPAN_OLD
11131030
1114   TNZS_COMMON
1031   PORT_START_TAG("DSWB")
1032   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
1033   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
1034   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) )
1035   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )
1036   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
1037   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
1038   PORT_DIPSETTING(    0x00, "50000 150000" )
1039   PORT_DIPSETTING(    0x0c, "70000 200000" )
1040   PORT_DIPSETTING(    0x04, "100000 250000" )
1041   PORT_DIPSETTING(    0x08, "200000 300000" )
1042   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
1043   PORT_DIPSETTING(    0x20, "2" )
1044   PORT_DIPSETTING(    0x30, "3" )
1045   PORT_DIPSETTING(    0x00, "4" )
1046   PORT_DIPSETTING(    0x10, "5" )
1047   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) )
1048   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1049   PORT_DIPSETTING(    0x40, DEF_STR( Yes ) )
1050   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1051   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1052   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
11151053
1054   PORT_START_TAG("IN0")
1055   TAITO_JOY_LRUD_2_BUTTONS_START( 1 )
1056
11161057   PORT_START_TAG("IN1")
1117   TNZS_PLAYER_INPUT(2)
1058   TAITO_JOY_LRUD_2_BUTTONS_START( 2 )
11181059
11191060   COMMON_IN2
11201061   COMMON_COIN1(IP_ACTIVE_LOW)
11211062   COMMON_COIN2(IP_ACTIVE_LOW)
1122
11231063INPUT_PORTS_END
11241064
11251065static INPUT_PORTS_START( tnzsb )
1126   PORT_START_TAG("DSWA")
1127   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
1128   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1129   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
1130   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
1131   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1132   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1133   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
1134   PORT_DIPNAME( 0x08, 0x08, "Invulnerability (Debug)" )   // see notes
1135   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1136   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1137   TAITO_COINAGE_WORLD_8
1066   PORT_INCLUDE( tnzs )
11381067
1139   TNZS_COMMON
1068   PORT_MODIFY("DSWA")
1069   TAITO_COINAGE_WORLD
11401070
1141   PORT_START_TAG("IN1")
1071   PORT_MODIFY("IN1")
11421072   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL
11431073   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
11441074   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_COCKTAIL
r2956r2957
11481078   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
11491079   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2)
11501080
1151   PORT_START_TAG("IN2")
1152   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
1153   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT )
1154   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1155   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1081   PORT_MODIFY("IN2")
11561082   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
11571083   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
1158   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1159   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
11601084
1085   PORT_MODIFY("COIN1")   /* not present in the bootleg */
1086   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1087
1088   PORT_MODIFY("COIN2")   /* not present in the bootleg */
1089   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
11611090INPUT_PORTS_END
11621091
11631092static INPUT_PORTS_START( tnzs2 )
1164   PORT_START_TAG("DSWA")
1165   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
1166   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1167   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
1168   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
1169   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1170   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1171   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
1093   PORT_INCLUDE( tnzs )
1094
1095   PORT_MODIFY("DSWA")
11721096   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
11731097   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
11741098   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1175   TAITO_COINAGE_WORLD_8
1099   TAITO_COINAGE_WORLD
11761100
1177   PORT_START_TAG("DSWB")
1178   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
1179   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
1180   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) )
1181   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )
1182   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
1101   PORT_MODIFY("DSWB")
11831102   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
11841103   PORT_DIPSETTING(    0x00, "10000 100000" )
11851104   PORT_DIPSETTING(    0x0c, "10000 150000" )
11861105   PORT_DIPSETTING(    0x08, "10000 200000" )
11871106   PORT_DIPSETTING(    0x04, "10000 300000" )
1188   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
1189   PORT_DIPSETTING(    0x20, "2" )
1190   PORT_DIPSETTING(    0x30, "3" )
1191   PORT_DIPSETTING(    0x00, "4" )
1192   PORT_DIPSETTING(    0x10, "5" )
1193   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) )
1194   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1195   PORT_DIPSETTING(    0x40, DEF_STR( Yes ) )
1196   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
1197   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1198   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1199
1200   PORT_START_TAG("IN0")
1201   TNZS_PLAYER_INPUT(1)
1202
1203   PORT_START_TAG("IN1")
1204   TNZS_PLAYER_INPUT(2)
1205
1206   COMMON_IN2
1207   COMMON_COIN1(IP_ACTIVE_LOW)
1208   COMMON_COIN2(IP_ACTIVE_LOW)
12091107INPUT_PORTS_END
12101108
12111109static INPUT_PORTS_START( kabukiz )
r2956r2957
12451143   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
12461144   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
12471145   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1248   TAITO_COINAGE_JAPAN_8
1146   TAITO_COINAGE_JAPAN_OLD
12491147
12501148   PORT_START_TAG("IN0")
1251   TNZS_PLAYER_INPUT(1)
1149   TAITO_JOY_LRUD_2_BUTTONS_START( 1 )
12521150
12531151   PORT_START_TAG("IN1")
12541152   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL
r2956r2957
12841182   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
12851183   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
12861184   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1287   TAITO_COINAGE_WORLD_8
1185   TAITO_COINAGE_WORLD
12881186
12891187   PORT_START_TAG("DSWB")
12901188   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
r2956r2957
13101208   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
13111209
13121210   PORT_START_TAG("IN0")
1313   TNZS_PLAYER_INPUT(1)
1211   TAITO_JOY_LRUD_2_BUTTONS_START( 1 )
1212
13141213   PORT_START_TAG("IN1")
1315   TNZS_PLAYER_INPUT(2)
1214   TAITO_JOY_LRUD_2_BUTTONS_START( 2 )
13161215
13171216   PORT_START_TAG("IN2")
13181217   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
13371236   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
13381237   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
13391238   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1340   TAITO_COINAGE_JAPAN_8
1239   TAITO_COINAGE_JAPAN_OLD
13411240
13421241   PORT_START_TAG("DSWB")
13431242   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
r2956r2957
13651264   PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
13661265
13671266   PORT_START_TAG("IN0")
1368   TNZS_PLAYER_INPUT(1)
1267   TAITO_JOY_LRUD_2_BUTTONS_START( 1 )
1268
13691269   PORT_START_TAG("IN1")
1370   TNZS_PLAYER_INPUT(2)
1270   TAITO_JOY_LRUD_2_BUTTONS_START( 2 )
13711271
13721272   PORT_START_TAG("IN2")
13731273   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
src/mame/drivers/naomi.c
r2956r2957
816816
817817Info from roms starting at 0x1ffd60
818818
819EPR-21576h - NAOMI BOOT ROM 2002 07/08  1.8- (Japan)
819820EPR-21576g - NAOMI BOOT ROM 2001 09/10  1.70 (Japan)
820821EPR-21576e - NAOMI BOOT ROM 2000 08/25  1.50 (Japan)
821822EPR-21576d - NAOMI BOOT ROM 1999 06/04  1.40 (Japan)
r2956r2957
872873  NOTE: this doesn't work for the HOTD2 or multi screen boot roms
873874
874875*/
876// game specific bios roms quite clearly don't belong in here.
875877
876878#define NAOMI_BIOS \
877879   ROM_SYSTEM_BIOS( 0, "bios0", "epr-21578e (Export)" ) \
r2956r2957
884886   ROM_LOAD16_WORD_SWAP_BIOS( 3, "epr-21577e.bin",  0x000000, 0x200000, CRC(cf36e97b) SHA1(b085305982e7572e58b03a9d35f17ae319c3bbc6) ) \
885887   ROM_SYSTEM_BIOS( 4, "bios4", "epr-21577d (USA)" ) \
886888   ROM_LOAD16_WORD_SWAP_BIOS( 4, "epr-21577d.bin",  0x000000, 0x200000, CRC(60ddcbbe) SHA1(58b15096d269d6df617ca1810b66b47deb184958) ) \
887   ROM_SYSTEM_BIOS( 5, "bios5", "epr-21576g (Japan)" ) \
888   ROM_LOAD16_WORD_SWAP_BIOS( 5, "epr-21576g.bin",  0x000000, 0x200000, CRC(d2a1c6bf) SHA1(6d27d71aec4dfba98f66316ae74a1426d567698a) ) \
889   ROM_SYSTEM_BIOS( 6, "bios6", "epr-21576e (Japan)" ) \
890   ROM_LOAD16_WORD_SWAP_BIOS( 6, "epr-21576e.bin",  0x000000, 0x200000, CRC(08c0add7) SHA1(e7c1a7673cb2ccb21748ef44105e46d1bad7266d) ) \
891   ROM_SYSTEM_BIOS( 7, "bios7", "epr-21576d (Japan)" ) \
892   ROM_LOAD16_WORD_SWAP_BIOS( 7, "epr-21576d.bin",  0x000000, 0x200000, CRC(3b2afa7b) SHA1(d007e1d321c198a38c5baff86eb2ab84385d150a) ) \
893   ROM_SYSTEM_BIOS( 8, "bios8", "epr-21576b (Japan)" ) \
894   ROM_LOAD16_WORD_SWAP_BIOS( 8, "epr-21576b.bin",  0x000000, 0x200000, CRC(755a6e07) SHA1(7e8b8ccfc063144d89668e7224dcd8a36c54f3b3) ) \
895   ROM_SYSTEM_BIOS( 9, "bios9", "epr-21576 (Japan)" ) \
896   ROM_LOAD16_WORD_SWAP_BIOS( 9, "epr-21576.bin",   0x000000, 0x200000, CRC(9dad3495) SHA1(5fb66f9a2b68d120f059c72758e65d34f461044a) ) \
897   ROM_SYSTEM_BIOS( 10, "bios10", "Ferrari F355 (Export)" ) \
898   ROM_LOAD16_WORD_SWAP_BIOS( 10,  "epr-22851.bin", 0x000000, 0x200000, CRC(62483677) SHA1(3e3bcacf5f972c376b569f45307ee7fd0b5031b7) ) \
899   ROM_SYSTEM_BIOS( 11, "bios11", "Ferrari F355 (USA)" ) \
900   ROM_LOAD16_WORD_SWAP_BIOS( 11,  "epr-22850.bin", 0x000000, 0x200000, CRC(28aa539d) SHA1(14485368656af80504b212da620179c49f84c1a2) ) \
901   ROM_SYSTEM_BIOS( 12, "bios12", "HOTD2 (US)" ) \
902   ROM_LOAD16_WORD_SWAP_BIOS( 12,  "epr-21330.bin", 0x000000, 0x200000, CRC(9e3bfa1b) SHA1(b539d38c767b0551b8e7956c1ff795de8bbe2fbc) ) \
903   ROM_SYSTEM_BIOS( 13, "bios13", "HOTD2 (Export)" ) \
904   ROM_LOAD16_WORD_SWAP_BIOS( 13,  "epr-21331.bin", 0x000000, 0x200000, CRC(065f8500) SHA1(49a3881e8d76f952ef5e887200d77b4a415d47fe) ) \
905   ROM_SYSTEM_BIOS( 14, "bios14", "Naomi Dev BIOS" ) \
906   ROM_LOAD16_WORD_SWAP_BIOS( 14,  "dcnaodev.bios", 0x000000, 0x080000, CRC(7a50fab9) SHA1(ef79f448e0bf735d1264ad4f051d24178822110f) ) /* This one comes from a dev / beta board. The eprom was a 27C4096 */
889   ROM_SYSTEM_BIOS( 5, "bios5", "epr-21576h (Japan)" ) \
890   ROM_LOAD16_WORD_SWAP_BIOS( 5, "epr-21576h.bin",  0x000000, 0x200000, CRC(d4895685) SHA1(91424d481ff99a8d3f4c45cea6d3f0eada049a6d) ) \
891   ROM_SYSTEM_BIOS( 6, "bios6", "epr-21576g (Japan)" ) \
892   ROM_LOAD16_WORD_SWAP_BIOS( 6, "epr-21576g.bin",  0x000000, 0x200000, CRC(d2a1c6bf) SHA1(6d27d71aec4dfba98f66316ae74a1426d567698a) ) \
893   ROM_SYSTEM_BIOS( 7, "bios7", "epr-21576e (Japan)" ) \
894   ROM_LOAD16_WORD_SWAP_BIOS( 7, "epr-21576e.bin",  0x000000, 0x200000, CRC(08c0add7) SHA1(e7c1a7673cb2ccb21748ef44105e46d1bad7266d) ) \
895   ROM_SYSTEM_BIOS( 8, "bios8", "epr-21576d (Japan)" ) \
896   ROM_LOAD16_WORD_SWAP_BIOS( 8, "epr-21576d.bin",  0x000000, 0x200000, CRC(3b2afa7b) SHA1(d007e1d321c198a38c5baff86eb2ab84385d150a) ) \
897   ROM_SYSTEM_BIOS( 9, "bios9", "epr-21576b (Japan)" ) \
898   ROM_LOAD16_WORD_SWAP_BIOS( 9, "epr-21576b.bin",  0x000000, 0x200000, CRC(755a6e07) SHA1(7e8b8ccfc063144d89668e7224dcd8a36c54f3b3) ) \
899   ROM_SYSTEM_BIOS( 10, "bios10", "epr-21576 (Japan)" ) \
900   ROM_LOAD16_WORD_SWAP_BIOS( 10,  "epr-21576.bin", 0x000000, 0x200000, CRC(9dad3495) SHA1(5fb66f9a2b68d120f059c72758e65d34f461044a) ) \
901   ROM_SYSTEM_BIOS( 11, "bios11", "Ferrari F355 (Export)" ) \
902   ROM_LOAD16_WORD_SWAP_BIOS( 11,  "epr-22851.bin", 0x000000, 0x200000, CRC(62483677) SHA1(3e3bcacf5f972c376b569f45307ee7fd0b5031b7) ) \
903   ROM_SYSTEM_BIOS( 12, "bios12", "Ferrari F355 (USA)" ) \
904   ROM_LOAD16_WORD_SWAP_BIOS( 12,  "epr-22850.bin", 0x000000, 0x200000, CRC(28aa539d) SHA1(14485368656af80504b212da620179c49f84c1a2) ) \
905   ROM_SYSTEM_BIOS( 13, "bios13", "Naomi Dev BIOS" ) \
906   ROM_LOAD16_WORD_SWAP_BIOS( 13,  "dcnaodev.bios", 0x000000, 0x080000, CRC(7a50fab9) SHA1(ef79f448e0bf735d1264ad4f051d24178822110f) ) /* This one comes from a dev / beta board. The eprom was a 27C4096 */
907907
908// bios for House of the Dead 2
909#define HOTD2_BIOS \
910   ROM_SYSTEM_BIOS( 0, "bios0", "HOTD2 (Export)" ) \
911   ROM_LOAD16_WORD_SWAP_BIOS( 0,  "epr-21331.bin", 0x000000, 0x200000, CRC(065f8500) SHA1(49a3881e8d76f952ef5e887200d77b4a415d47fe) ) \
912   ROM_SYSTEM_BIOS( 1, "bios1", "HOTD2 (US)" ) \
913   ROM_LOAD16_WORD_SWAP_BIOS( 1,  "epr-21330.bin", 0x000000, 0x200000, CRC(9e3bfa1b) SHA1(b539d38c767b0551b8e7956c1ff795de8bbe2fbc) ) \
914
915
908916/* only revisions d and higher support the GDROM, and there is an additional bios (and SH4!) on the DIMM board for the CD Controller */
909917#define NAOMIGD_BIOS \
910918   ROM_REGION( 0x200000, REGION_CPU1, 0) \
r2956r2957
912920   ROM_LOAD16_WORD_SWAP_BIOS( 0, "epr-21578e.bin",  0x000000, 0x200000, CRC(087f09a3) SHA1(0418eb2cf9766f0b1b874a4e92528779e22c0a4a) ) \
913921   ROM_SYSTEM_BIOS( 1, "bios1", "epr-21578d (Export)" ) \
914922   ROM_LOAD16_WORD_SWAP_BIOS( 1, "epr-21578d.bin",  0x000000, 0x200000, CRC(dfd5f42a) SHA1(614a0db4743a5e5a206190d6786ade24325afbfd) ) \
915   ROM_SYSTEM_BIOS( 2, "bios3", "epr-21577e (USA)" ) \
923   ROM_SYSTEM_BIOS( 2, "bios2", "epr-21577e (USA)" ) \
916924   ROM_LOAD16_WORD_SWAP_BIOS( 2, "epr-21577e.bin",  0x000000, 0x200000, CRC(cf36e97b) SHA1(b085305982e7572e58b03a9d35f17ae319c3bbc6) ) \
917   ROM_SYSTEM_BIOS( 3, "bios4", "epr-21577d (USA)" ) \
925   ROM_SYSTEM_BIOS( 3, "bios3", "epr-21577d (USA)" ) \
918926   ROM_LOAD16_WORD_SWAP_BIOS( 3, "epr-21577d.bin",  0x000000, 0x200000, CRC(60ddcbbe) SHA1(58b15096d269d6df617ca1810b66b47deb184958) ) \
919   ROM_SYSTEM_BIOS( 4, "bios5", "epr-21576g (Japan)" ) \
920   ROM_LOAD16_WORD_SWAP_BIOS( 4, "epr-21576g.bin",  0x000000, 0x200000, CRC(d2a1c6bf) SHA1(6d27d71aec4dfba98f66316ae74a1426d567698a) ) \
921   ROM_SYSTEM_BIOS( 5, "bios6", "epr-21576e (Japan)" ) \
922   ROM_LOAD16_WORD_SWAP_BIOS( 5, "epr-21576e.bin",  0x000000, 0x200000, CRC(08c0add7) SHA1(e7c1a7673cb2ccb21748ef44105e46d1bad7266d) ) \
923   ROM_SYSTEM_BIOS( 6, "bios7", "epr-21576d (Japan)" ) \
924   ROM_LOAD16_WORD_SWAP_BIOS( 6, "epr-21576d.bin",  0x000000, 0x200000, CRC(3b2afa7b) SHA1(d007e1d321c198a38c5baff86eb2ab84385d150a) ) \
927   ROM_SYSTEM_BIOS( 4, "bios4", "epr-21576h (Japan)" ) \
928   ROM_LOAD16_WORD_SWAP_BIOS( 4, "epr-21576h.bin",  0x000000, 0x200000, CRC(d4895685) SHA1(91424d481ff99a8d3f4c45cea6d3f0eada049a6d) ) \
929   ROM_SYSTEM_BIOS( 5, "bios5", "epr-21576g (Japan)" ) \
930   ROM_LOAD16_WORD_SWAP_BIOS( 5, "epr-21576g.bin",  0x000000, 0x200000, CRC(d2a1c6bf) SHA1(6d27d71aec4dfba98f66316ae74a1426d567698a) ) \
931   ROM_SYSTEM_BIOS( 6, "bios6", "epr-21576e (Japan)" ) \
932   ROM_LOAD16_WORD_SWAP_BIOS( 6, "epr-21576e.bin",  0x000000, 0x200000, CRC(08c0add7) SHA1(e7c1a7673cb2ccb21748ef44105e46d1bad7266d) ) \
933   ROM_SYSTEM_BIOS( 7, "bios7", "epr-21576d (Japan)" ) \
934   ROM_LOAD16_WORD_SWAP_BIOS( 7, "epr-21576d.bin",  0x000000, 0x200000, CRC(3b2afa7b) SHA1(d007e1d321c198a38c5baff86eb2ab84385d150a) ) \
925935   ROM_REGION( 0x200000, REGION_USER2, 0) \
926936   ROM_LOAD16_WORD_SWAP( "fpr-23489c.ic14", 0x000000, 0x200000, CRC(bc38bea1) SHA1(b36fcc6902f397d9749e9d02de1bbb7a5e29d468) ) \
927937
r2956r2957
987997   ROM_REGION( 0x8400000, REGION_USER1, ROMREGION_ERASE)
988998ROM_END
989999
1000ROM_START( hod2bios )
1001   ROM_REGION( 0x200000, REGION_CPU1, 0)
1002   HOTD2_BIOS
9901003
1004   ROM_REGION( 0x8400000, REGION_USER1, ROMREGION_ERASE)
1005ROM_END
1006
9911007ROM_START( naomi2 )
9921008   ROM_REGION( 0x200000, REGION_CPU1, 0)
9931009   NAOMI2_BIOS
r2956r2957
23242340ROM_START( sfz3ugd )
23252341   NAOMIGD_BIOS
23262342
2327   ROM_REGION( 0x8400000, REGION_USER1, ROMREGION_ERASE)
2343   ROM_REGION( 0xac00000, REGION_USER1, ROMREGION_ERASE) // this is the 'rom' file from the GDROM DISC, once the GDROM is emulated this won't be loaded
2344   ROM_LOAD_OPTIONAL("zero3rom.bin", 0x0000000, 0xac00000, CRC(4eabda58) SHA1(e70db0e93c821838c77510fd47c91f0c4cfb09c9) )
23282345
23292346   /* GD-ROM dump, this will be replaced once an appropriate CHD format has been decided upon for the GD images*/
23302347   ROM_REGION( 0x3d8ab000, REGION_USER3, ROMREGION_ERASE)
r2956r2957
23352352
23362353ROM_END
23372354
2355extern void naomi_game_decrypt(UINT64 key, UINT8* region, int length);
23382356
2357DRIVER_INIT( cvs2gd )
2358{
2359   // move key to game.key file?
2360   naomi_game_decrypt( 0x2f3226165b9e407cULL, memory_region(machine,REGION_USER1), memory_region_length(machine,REGION_USER1));
2361}
23392362
2363
2364ROM_START( cvs2gd )
2365   NAOMIGD_BIOS
2366
2367   ROM_REGION( 0x9800000, REGION_USER1, ROMREGION_ERASE) // this is the 'rom' file from the GDROM DISC, once the GDROM is emulated this won't be loaded
2368   ROM_LOAD("snkgd_sl.bin", 0x0000000, 0x9800000,  CRC(f153421d) SHA1(0c2b935ae3cfb6c85410a209fec4eab497066d84) )
2369
2370   /* GD-ROM dump, this will be replaced once an appropriate CHD format has been decided upon for the GD images*/
2371   ROM_REGION( 0x26ad4620, REGION_USER3, ROMREGION_ERASE)
2372   ROM_LOAD("capcom_vs_snk2.txt",  0x0000000, 0x00000141, CRC(0db478be) SHA1(a18f87b76139e4a845ecc1456b6195574110e30c) )
2373   ROM_LOAD("track01.bin",0x0000000, 0x00ac440,  CRC(d48bd072) SHA1(2fc840586c655dee2686ee3b520c7760bd3b8dcb) )
2374   ROM_LOAD("track02.raw",0x0000000, 0x004c8cf0, CRC(3b3a2e7b) SHA1(fd8e5cac5bd387229f4ffbe05d1bf2fabf7ea3f9) )
2375   ROM_LOAD("track03.bin",0x0000000, 0x26ad4620, CRC(670d2182) SHA1(a99ceb7bb74e4a0fe6ae80b33cd2963465ae9d14) )
2376   ROM_CONTINUE(0x0000000, 0x20000000)
2377ROM_END
2378
2379
2380
23402381/* All games have the regional titles at the start of the IC22 rom in the following order
23412382
23422383  JAPAN
r2956r2957
23872428GAME( 2000, doa2m,    doa2,     naomi,    naomi,    0, ROT0, "Tecmo",           "Dead or Alive 2 Millennium (JPN, USA, EXP, KOR, AUS)", GAME_NO_SOUND|GAME_NOT_WORKING )
23882429GAME( 1998, dybbnao,  naomi,    naomi,    naomi,    0, ROT0, "Sega",            "Dynamite Baseball NAOMI (JPN)", GAME_NO_SOUND|GAME_NOT_WORKING )
23892430
2431/* Games with game specific bios sets */
2432GAME( 2001, hod2bios, 0,        naomi,    naomi,    0, ROT0, "Sega",            "Naomi House of the Dead 2 Bios", GAME_NO_SOUND|GAME_NOT_WORKING|GAME_IS_BIOS_ROOT )
2433/* HOTD2 isn't dumped */
23902434
23912435
23922436/* No GD-Rom Sets Supported */
23932437GAME( 2001, naomigd,   0,        naomi,    naomi,    0, ROT0, "Sega",            "Naomi GD-ROM Bios", GAME_NO_SOUND|GAME_NOT_WORKING|GAME_IS_BIOS_ROOT )
2394GAME( 2001, sfz3ugd,   naomigd,  naomi,    naomi,    0, ROT0, "Capcom",          "Street Fighter Zero 3 Upper", GAME_NO_SOUND|GAME_NOT_WORKING|GAME_IS_BIOS_ROOT )
2438GAME( 2001, sfz3ugd,   naomigd,  naomi,    naomi,    0, ROT0, "Capcom",          "Street Fighter Zero 3 Upper", GAME_NO_SOUND|GAME_NOT_WORKING )
2439GAME( 2001, cvs2gd,    naomigd,  naomi,    naomi,    cvs2gd, ROT0, "Capcom",          "Capcom Vs. SNK 2", GAME_NO_SOUND|GAME_NOT_WORKING )
23952440
23962441
23972442/* Naomi 2 & Naomi 2 GD-ROM */
src/mame/drivers/stv.c
r2956r2957
468468      return_data = 0x20 ^ 0xff;
469469
470470   if (offset == 0x75)//PDR1 read
471      return_data = input_port_read_indexed(machine, 0);
471      return_data = input_port_read(machine, "DSW1");
472472
473473   if (offset == 0x77)//PDR2 read
474474      return_data=  (0xfe | eeprom_read_bit());
475475
476476//  if (offset == 0x33) //country code
477//      return_data = input_port_read_indexed(machine, 7);
477//      return_data = input_port_read(machine, "FAKE");
478478
479479   if (activecpu_get_pc()==0x060020E6) return_data = 0x10;//???
480480
r2956r2957
633633
634634            smpc_ram[0x31]=0x00;  //?
635635
636            //smpc_ram[0x33]=input_port_read_indexed(machine, 7);
636            //smpc_ram[0x33]=input_port_read(machine, "FAKE");
637637
638638            smpc_ram[0x35]=0x00;
639639            smpc_ram[0x37]=0x00;
r2956r2957
902902      case 0:
903903      switch(port_sel)
904904      {
905         case 0x77: return 0xff000000|(input_port_read_indexed(machine, 2) << 16) |0x0000ff00|(input_port_read_indexed(machine, 3));
905         case 0x77: return 0xff000000|(input_port_read(machine, "P1") << 16) |0x0000ff00|(input_port_read(machine, "P2"));
906906         case 0x67:
907907         {
908908            switch(mux_data)
909909            {
910910               /*Mahjong panel interface,bit wise(ACTIVE LOW)*/
911               case 0xfe:   return 0xff000000 | (input_port_read_indexed(machine, 7)  << 16) | 0x0000ff00 | (input_port_read_indexed(machine, 12));
912               case 0xfd:  return 0xff000000 | (input_port_read_indexed(machine, 8)  << 16) | 0x0000ff00 | (input_port_read_indexed(machine, 13));
913               case 0xfb:   return 0xff000000 | (input_port_read_indexed(machine, 9)  << 16) | 0x0000ff00 | (input_port_read_indexed(machine, 14));
914               case 0xf7:   return 0xff000000 | (input_port_read_indexed(machine, 10) << 16) | 0x0000ff00 | (input_port_read_indexed(machine, 15));
915               case 0xef:  return 0xff000000 | (input_port_read_indexed(machine, 11) << 16) | 0x0000ff00 | (input_port_read_indexed(machine, 16));
911               case 0xfe:   return 0xff000000 | (input_port_read_safe(machine, "KEY0", 0)  << 16) | 0x0000ff00 | (input_port_read_safe(machine, "KEY5", 0));
912               case 0xfd:  return 0xff000000 | (input_port_read_safe(machine, "KEY1", 0)  << 16) | 0x0000ff00 | (input_port_read_safe(machine, "KEY6", 0));
913               case 0xfb:   return 0xff000000 | (input_port_read_safe(machine, "KEY2", 0)  << 16) | 0x0000ff00 | (input_port_read_safe(machine, "KEY7", 0));
914               case 0xf7:   return 0xff000000 | (input_port_read_safe(machine, "KEY3", 0) << 16) | 0x0000ff00 | (input_port_read_safe(machine, "KEY8", 0));
915               case 0xef:  return 0xff000000 | (input_port_read_safe(machine, "KEY4", 0) << 16) | 0x0000ff00 | (input_port_read_safe(machine, "KEY9", 0));
916916               /*Joystick panel*/
917917               default:
918918               //popmessage("%02x MUX DATA",mux_data);
919                return (input_port_read_indexed(machine, 2) << 16) | (input_port_read_indexed(machine, 3));
919                return (input_port_read(machine, "P1") << 16) | (input_port_read(machine, "P2"));
920920            }
921921         }
922922         case 0x47:
r2956r2957
926926               int data1 = 0, data2 = 0;
927927
928928               /* Critter Crusher */
929               data1 = input_port_read_indexed(machine, 7);
929               data1 = input_port_read(machine, "LIGHTX");
930930               data1 = BITSWAP8(data1, 2, 3, 0, 1, 6, 7, 5, 4) & 0xf3;
931               data1 |= (input_port_read_indexed(machine, 2) & 1) ? 0x0 : 0x4;
932               data2 = input_port_read_indexed(machine, 8);
931               data1 |= (input_port_read(machine, "P1") & 1) ? 0x0 : 0x4;
932               data2 = input_port_read(machine, "LIGHTY");
933933               data2 = BITSWAP8(data2, 2, 3, 0, 1, 6, 7, 5, 4) & 0xf3;
934               data2 |= (input_port_read_indexed(machine, 2) & 1) ? 0x0 : 0x4;
934               data2 |= (input_port_read(machine, "P1") & 1) ? 0x0 : 0x4;
935935
936936               return 0xff000000 | data1 << 16 | 0x0000ff00 | data2;
937937            }
r2956r2957
939939         //default:
940940         default:
941941         //popmessage("%02x PORT SEL",port_sel);
942         return (input_port_read_indexed(machine, 2) << 16) | (input_port_read_indexed(machine, 3));
942         return (input_port_read(machine, "P1") << 16) | (input_port_read(machine, "P2"));
943943      }
944944      case 1:
945945      if ( strcmp(machine->gamedrv->name,"critcrsh") == 0 )
946946      {
947         return ((input_port_read_indexed(machine, 4) << 16) & ((input_port_read_indexed(machine, 2) & 1) ? 0xffef0000 : 0xffff0000)) | (ioga[1]);
947         return ((input_port_read(machine, "SYSTEM") << 16) & ((input_port_read(machine, "P1") & 1) ? 0xffef0000 : 0xffff0000)) | (ioga[1]);
948948      }
949949      else
950950      {
951         return (input_port_read_indexed(machine, 4) << 16) | (ioga[1]);
951         return (input_port_read(machine, "SYSTEM") << 16) | (ioga[1]);
952952      }
953953      case 2:
954954      switch(port_sel)
955955      {
956         case 0x77:   return (input_port_read_indexed(machine, 5) << 16) | (input_port_read_indexed(machine, 6));
956         case 0x77:   return (input_port_read(machine, "UNUSED") << 16) | (input_port_read(machine, "EXTRA"));
957957         case 0x67:   return 0xffffffff;/**/
958958         case 0x20:  return 0xffff0000 | (ioga[2] & 0xffff);
959959         case 0x10:  return ((ioga[2] & 0xffff) << 16) | 0xffff;
r2956r2957
20192019#endif
20202020
20212021static ADDRESS_MAP_START( stv_mem, ADDRESS_SPACE_PROGRAM, 32 )
2022   AM_RANGE(0x00000000, 0x0007ffff) AM_ROM   // bios
2022   AM_RANGE(0x00000000, 0x0007ffff) AM_ROM AM_SHARE(6)  // bios
20232023   AM_RANGE(0x00100000, 0x0010007f) AM_READWRITE(stv_SMPC_r32, stv_SMPC_w32)
20242024   AM_RANGE(0x00180000, 0x0018ffff) AM_RAM AM_SHARE(1) AM_BASE(&stv_backupram)
20252025   AM_RANGE(0x00200000, 0x002fffff) AM_RAM AM_MIRROR(0x100000) AM_SHARE(2) AM_BASE(&stv_workram_l)
r2956r2957
20282028   AM_RANGE(0x01406f40, 0x01406f43) AM_WRITE(minit_w) // prikura seems to write here ..
20292029//  AM_RANGE(0x01000000, 0x01000003) AM_WRITE(minit_w) AM_MIRROR(0x00080000)
20302030   AM_RANGE(0x01800000, 0x01800003) AM_WRITE(sinit_w)
2031   AM_RANGE(0x02000000, 0x04ffffff) AM_ROM AM_ROMBANK(1) AM_REGION(REGION_USER1, 0) // cartridge
2031   AM_RANGE(0x02000000, 0x04ffffff) AM_ROM AM_ROMBANK(1) AM_SHARE(7) AM_REGION(REGION_USER1, 0) // cartridge
20322032   AM_RANGE(0x05800000, 0x0589ffff) AM_READWRITE(stvcd_r, stvcd_w)
20332033   /* Sound */
20342034   AM_RANGE(0x05a00000, 0x05a7ffff) AM_READWRITE(stv_sh2_soundram_r, stv_sh2_soundram_w)
r2956r2957
20472047   AM_RANGE(0x05f80000, 0x05fbffff) AM_READWRITE(stv_vdp2_regs_r, stv_vdp2_regs_w)
20482048   AM_RANGE(0x05fe0000, 0x05fe00cf) AM_READWRITE(stv_scu_r32, stv_scu_w32)
20492049   AM_RANGE(0x06000000, 0x060fffff) AM_RAM AM_MIRROR(0x01f00000) AM_SHARE(3) AM_BASE(&stv_workram_h)
2050   AM_RANGE(0x20000000, 0x2007ffff) AM_ROM AM_SHARE(6)  // bios mirror
2051   AM_RANGE(0x22000000, 0x24ffffff) AM_ROM AM_SHARE(7)  // cart mirror
20502052ADDRESS_MAP_END
20512053
20522054static ADDRESS_MAP_START( sound_mem, ADDRESS_SPACE_PROGRAM, 16 )
r2956r2957
20652067   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  ) PORT_PLAYER(_n_)
20662068
20672069static INPUT_PORTS_START( stv )
2068   PORT_START
2070   PORT_START_TAG("DSW1")
20692071   PORT_DIPNAME( 0x01, 0x01, "PDR1" )
20702072   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
20712073   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
20912093   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
20922094   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
20932095
2094   PORT_START
2096   PORT_START_TAG("DSW2")
20952097   PORT_DIPNAME( 0x01, 0x01, "PDR2" )
20962098   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
20972099   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
21172119   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
21182120   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
21192121
2120   PORT_START
2122   PORT_START_TAG("P1")
21212123   STV_PLAYER_INPUTS(1, BUTTON1, BUTTON2, BUTTON3, BUTTON4)
21222124
2123   PORT_START
2125   PORT_START_TAG("P2")
21242126   STV_PLAYER_INPUTS(2, BUTTON1, BUTTON2, BUTTON3, BUTTON4)
21252127/*
2126    PORT_START
2128    PORT_START_TAG("P3")
21272129    STV_PLAYER_INPUTS(3, BUTTON1, BUTTON2, BUTTON3, BUTTON4)
21282130
2129    PORT_START
2131    PORT_START_TAG("P4")
21302132    STV_PLAYER_INPUTS(4, BUTTON1, BUTTON2, BUTTON3, BUTTON4)
21312133*/
21322134
2133   PORT_START
2135   PORT_START_TAG("SYSTEM")
21342136   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
21352137   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
21362138   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )
r2956r2957
21402142   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("1P Push Switch") PORT_CODE(KEYCODE_7)
21412143   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("2P Push Switch") PORT_CODE(KEYCODE_8)
21422144
2143   /*This *might* be unused...*/
2144   PORT_START
2145   /* This *might* be unused... */
2146   PORT_START_TAG("UNUSED")
21452147   PORT_BIT ( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
21462148
2147   /*Extra button layout,used by Power Instinct 3 & Suikoenbu*/
2148   PORT_START
2149   /* Extra button layout,used by Power Instinct 3 & Suikoenbu */
2150   PORT_START_TAG("EXTRA")
21492151   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
21502152   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
21512153   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
r2956r2957
21552157   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
21562158   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
21572159
2158   /*We don't need these,AFAIK the country code doesn't work either...*/
2160   /* We don't need these, AFAIK the country code doesn't work either... */
21592161   #if 0
2160   PORT_START                     //7
2162   PORT_START_TAG("FAKE")   //7
21612163   PORT_DIPNAME( 0x0f, 0x01, "Country" )
21622164   PORT_DIPSETTING(    0x01, DEF_STR( Japan ) )
21632165   PORT_DIPSETTING(    0x02, "Asia Ntsc" )
r2956r2957
21682170   PORT_DIPSETTING(    0x0c, "Europe/Other Pal" )
21692171   PORT_DIPSETTING(    0x0d, "Sud America Pal" )
21702172
2171   PORT_START   /* Pad data 1a */
2173   PORT_START_TAG("PAD1A")   /* Pad data 1a */
21722174   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("B") PORT_CODE(KEYCODE_U)
21732175   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("C") PORT_CODE(KEYCODE_Y)
21742176   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("A") PORT_CODE(KEYCODE_T)
r2956r2957
21782180   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Left") PORT_CODE(KEYCODE_J)
21792181   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Right") PORT_CODE(KEYCODE_L)
21802182
2181   PORT_START   /* Pad data 1b */
2183   PORT_START_TAG("PAD1B")   /* Pad data 1b */
21822184   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("L trig") PORT_CODE(KEYCODE_A)
21832185   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Z") PORT_CODE(KEYCODE_Q)
21842186   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_OTHER ) PORT_NAME("Y") PORT_CODE(KEYCODE_W)
r2956r2957
21882190INPUT_PORTS_END
21892191
21902192static INPUT_PORTS_START( critcrsh )
2191
21922193   PORT_INCLUDE( stv )
21932194
21942195   /* IN 7 */
2195   PORT_START /* mask default type                     sens delta min max */
2196   PORT_START_TAG("LIGHTX") /* mask default type                     sens delta min max */
21962197   PORT_BIT( 0x3f, 0x00, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(0,0x3f) PORT_SENSITIVITY(50) PORT_KEYDELTA(1) PORT_PLAYER(1)
21972198
21982199   /* IN 8 */
2199   PORT_START
2200   PORT_START_TAG("LIGHTY")
22002201   PORT_BIT( 0x3f, 0x00, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0x0,0x3f) PORT_SENSITIVITY(50) PORT_KEYDELTA(1) PORT_PLAYER(1)
22012202
22022203INPUT_PORTS_END
22032204
2204/*Same as the regular one,but with an additional & optional mahjong panel*/
2205/* Same as the regular one,but with an additional & optional mahjong panel */
22052206static INPUT_PORTS_START( stvmp )
2206   PORT_START
2207   PORT_DIPNAME( 0x01, 0x01, "PDR1" )
2208   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
2209   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2210   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
2211   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
2212   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2213   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
2214   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
2215   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2216   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
2217   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
2218   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2219   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
2220   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
2221   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2222   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
2223   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
2224   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2225   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
2226   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
2227   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2228   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
2229   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
2230   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2207   PORT_INCLUDE( stv )
22312208
2232   PORT_START
2233   PORT_DIPNAME( 0x01, 0x01, "PDR2" )
2234   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
2235   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2236   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
2237   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
2238   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2239   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
2240   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
2241   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2242   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
2243   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
2244   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2245   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
2246   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
2247   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2248   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
2249   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
2250   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2251   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
2252   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
2253   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2254   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
2255   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
2256   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2257
2258   PORT_START
2259   STV_PLAYER_INPUTS(1, BUTTON1, BUTTON2, BUTTON3, BUTTON4)
2260
2261   PORT_START
2262   STV_PLAYER_INPUTS(2, BUTTON1, BUTTON2, BUTTON3, BUTTON4)
2263/*
2264    PORT_START
2265    STV_PLAYER_INPUTS(3, BUTTON1, BUTTON2, BUTTON3, BUTTON4)
2266
2267    PORT_START
2268    STV_PLAYER_INPUTS(4, BUTTON1, BUTTON2, BUTTON3, BUTTON4)
2269*/
2270
2271   PORT_START
2272   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
2273   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
2274   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )
2275   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
2276   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
2277   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
2278   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("1P Push Switch") PORT_CODE(KEYCODE_7)
2279   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("2P Push Switch") PORT_CODE(KEYCODE_8)
2280
2281   /*This *might* be unused...*/
2282   PORT_START
2283   PORT_BIT ( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
2284
2285   /*Extra button layout,used by Power Instinct 3*/
2286   PORT_START
2287   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
2288   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
2289   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
2290   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
2291   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
2292   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
2293   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
2294   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
2295
2296   /*Mahjong panel/player 1 side*/
2297   PORT_START/*7*/
2209   /* Mahjong panel/player 1 side */
2210   PORT_START_TAG("KEY0")   /*7*/
22982211   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
22992212   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
23002213   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
23042217   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_MAHJONG_M )
23052218   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_MAHJONG_I )
23062219
2307   PORT_START/*8*/
2220   PORT_START_TAG("KEY1")   /*8*/
23082221   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
23092222   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
23102223   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
23142227   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_MAHJONG_N )
23152228   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_MAHJONG_J )
23162229
2317   PORT_START/*9*/
2230   PORT_START_TAG("KEY2")   /*9*/
23182231   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
23192232   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
23202233   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
23242237   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
23252238   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_MAHJONG_K )
23262239
2327   PORT_START/*10*/
2240   PORT_START_TAG("KEY3")   /*10*/
23282241   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
23292242   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
23302243   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
23342247   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
23352248   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_MAHJONG_L )
23362249
2337   PORT_START/*11*/
2250   PORT_START_TAG("KEY4")   /*11*/
23382251   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
23392252   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
23402253   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
23442257   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP )
23452258   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
23462259
2347   /*Mahjong panel/player 2 side*/
2348   PORT_START/*12*/
2260   /* Mahjong panel/player 2 side */
2261   PORT_START_TAG("KEY5")   /*12*/
23492262   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_PLAYER(2)
23502263   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
23512264   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
23552268   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(2)
23562269   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_PLAYER(2)
23572270
2358   PORT_START/*13*/
2271   PORT_START_TAG("KEY6")   /*13*/
23592272   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) PORT_PLAYER(2)
23602273   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
23612274   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
23652278   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(2)
23662279   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_MAHJONG_J ) PORT_PLAYER(2)
23672280
2368   PORT_START/*14*/
2281   PORT_START_TAG("KEY7")   /*14*/
23692282   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_PLAYER(2)
23702283   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
23712284   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
23752288   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) PORT_PLAYER(2)
23762289   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_MAHJONG_K ) PORT_PLAYER(2)
23772290
2378   PORT_START/*15*/
2291   PORT_START_TAG("KEY8")   /*15*/
23792292   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
23802293   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
23812294   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
23852298   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_PLAYER(2)
23862299   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_MAHJONG_L ) PORT_PLAYER(2)
23872300
2388   PORT_START/*16*/
2301   PORT_START_TAG("KEY9")   /*16*/
23892302   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
23902303   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
23912304   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
24342347
24352348   install_stvbios_speedups(machine);
24362349
2350   // do strict overwrite verification - maruchan and rsgun crash after coinup without this.
2351   // todo: test what games need this and don't turn it on for them...
2352   cpunum_set_info_int(0, CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_STRICT_VERIFY);
2353   cpunum_set_info_int(1, CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_STRICT_VERIFY);
2354
24372355   /* debug .. watch the command buffer rsgun, cottonbm etc. appear to use to communicate between cpus */
24382356   memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffc44, 0x60ffc47, 0, 0, w60ffc44_write );
24392357   memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffc48, 0x60ffc4b, 0, 0, w60ffc48_write );
r2956r2957
24482366    smpc_ram[0x2d] = DectoBCD(systime.local_time.minute);
24492367    smpc_ram[0x2f] = DectoBCD(systime.local_time.second);
24502368    smpc_ram[0x31] = 0x00; //CTG1=0 CTG0=0 (correct??)
2451//  smpc_ram[0x33] = input_port_read_indexed(machine, 7);
2369//  smpc_ram[0x33] = input_port_read(machine, "FAKE");
24522370    smpc_ram[0x5f] = 0x10;
24532371
24542372    #ifdef MAME_DEBUG
r2956r2957
27012619#define ROM_LOAD16_WORD_SWAP_BIOS(bios,name,offset,length,hash) \
27022620      ROMX_LOAD(name, offset, length, hash, ROM_GROUPWORD | ROM_REVERSE | ROM_BIOS(bios+1)) /* Note '+1' */
27032621
2622/* BIOS rev info found at 0x800 (byte swapped):
2623
2624erp-17740  - Japan   STVB1.10J0950131  95/01/31 v1.10  - Found on a early board dated 02/1995
2625epr-17951a - Japan   STVB1.13J0950425  95/04/25 v1.13
2626epr-17952a - USA     STVB1.13U0950425  95/04/25 v1.13
2627epr-17953a - Taiwan  STVB1.13T0950425  95/04/25 v1.13
2628epr-17954a - Europe  STVB1.13E0950425  95/04/25 v1.13
2629
2630epr-18343  - ?????   STVB1.30S0950727  95/07/27 v1.30 - Special version used on Sports Fishing 2 (CD based)
2631epr-19730  - Japan   PCD11.13J0970217  97/02/17 v1.13 - Enhanced version for CD based units?
2632epr-20091  - Japan   PCS11.13J0970821  97/08/21 v1.13 - Enhanced version for ???
2633
2634stv110.bin  - Debug  STVB1.10D0950113  95/01/13 v1.10
2635stv1061.bin - ST-V Dev Bios (1.061) - Sega 1994, Noted "ST-V Ver 1.061 94/11/25" on EPROM sticker, Coming from a S-TV SG5001A dev board
2636
2637Regions found listed in the BIOS:
2638    Japan
2639    Taiwan and Philipines
2640    USA and Canada
2641    Brazil
2642    Korea
2643    Asia PAL area
2644    Europe
2645    Latin America
2646
2647ROM_SYSTEM_BIOS( x, "saturn",      "Saturn bios" ) \
2648ROM_LOAD16_WORD_SWAP_BIOS( x, "saturn.bin", 0x000000, 0x080000, CRC(653ff2d8) SHA1(20994ae7ee177ddaf3a430b010c7620dca000fb4) ) - Saturn Eu Bios
2649
2650*/
2651
27042652#define STV_BIOS \
27052653   ROM_REGION( 0x080000, REGION_CPU1, 0 ) /* SH2 code */ \
2706   ROM_SYSTEM_BIOS( 0, "japan",       "Japan (bios epr19730)" ) \
2707   ROM_LOAD16_WORD_SWAP_BIOS( 0, "epr19730.ic8",   0x000000, 0x080000, CRC(d0e0889d) SHA1(fae53107c894e0c41c49e191dbe706c9cd6e50bd) ) /* jp */ \
2708   ROM_SYSTEM_BIOS( 1, "japana",      "Japan (bios mp17951a)" ) \
2709   ROM_LOAD16_WORD_SWAP_BIOS( 1, "mp17951a.s",     0x000000, 0x080000, CRC(2672f9d8) SHA1(63cf4a6432f6c87952f9cf3ab0f977aed2367303) ) /* jp alt */ \
2710   ROM_SYSTEM_BIOS( 2, "us",          "USA (bios mp17952a)" ) \
2711   ROM_LOAD16_WORD_SWAP_BIOS( 2, "mp17952a.s",     0x000000, 0x080000, CRC(d1be2adf) SHA1(eaf1c3e5d602e1139d2090a78d7e19f04f916794) ) /* us */ \
2712   ROM_SYSTEM_BIOS( 3, "japanb",      "Japan (bios 20091)" ) \
2713   ROM_LOAD16_WORD_SWAP_BIOS( 3, "20091.bin",      0x000000, 0x080000, CRC(59ed40f4) SHA1(eff0f54c70bce05ff3a289bf30b1027e1c8cd117) ) /* jp alt 2 */ \
2714   ROM_SYSTEM_BIOS( 4, "taiwan",      "Taiwan (bios mp17953a)" ) \
2715   ROM_LOAD16_WORD_SWAP_BIOS( 4, "mp17953a.ic8",   0x000000, 0x080000, CRC(a4c47570) SHA1(9efc73717ec8a13417e65c54344ded9fc25bf5ef) ) /* taiwan */ \
2716   ROM_SYSTEM_BIOS( 5, "europe",      "Europe (bios mp17954a)" ) \
2717   ROM_LOAD16_WORD_SWAP_BIOS( 5, "mp17954a.s",     0x000000, 0x080000, CRC(f7722da3) SHA1(af79cff317e5b57d49e463af16a9f616ed1eee08) ) /* Europe */ \
2718   ROM_SYSTEM_BIOS( 6, "unknown",     "Unknown (debug?)" ) \
2719   ROM_LOAD16_WORD_SWAP_BIOS( 6, "stv110.bin",     0x000000, 0x080000, CRC(3dfeda92) SHA1(8eb33192a57df5f3a1dfb57263054867c6b2db6d) ) /* ?? */ \
2720   ROM_SYSTEM_BIOS( 7, "dev1061",     "Development (bios 1.061)" ) \
2721   ROM_LOAD16_WORD_SWAP_BIOS( 7, "stv1061.bin",    0x000000, 0x080000, CRC(728dbca3) SHA1(0ed2030177f0aa8285645c395ae9ad9f568ab1d6) ) /* ST-V Dev Bios (1.061) - Sega 1994, Noted "ST-V Ver 1.061 94/11/25" on EPROM sticker, Coming from a S-TV SG5001A dev board */ \
2722   ROM_SYSTEM_BIOS( 8, "japanc",      "Japan (bios epr17740)" ) \
2723   ROM_LOAD16_WORD_SWAP_BIOS( 8, "epr-17740.bin",  0x000000, 0x080000, CRC(5c5aa63d) SHA1(06860d96923b81afbc21e0ad32ee19487d8ff6e7) ) /* ST-V Bios (Japan early) - Sega 1995, Found on a early board dated 02/1995 */ \
2724   /*ROM_SYSTEM_BIOS( 9, "saturn",      "Saturn bios :)" ) */ \
2725   /*ROM_LOAD16_WORD_SWAP_BIOS( 9, "saturn.bin",       0x000000, 0x080000, CRC(653ff2d8) SHA1(20994ae7ee177ddaf3a430b010c7620dca000fb4) )*/ /* Saturn Eu Bios */ \
2654   ROM_SYSTEM_BIOS( 0, "Japan (97/08/21)",  "Japan (bios epr-20091)" ) \
2655   ROM_LOAD16_WORD_SWAP_BIOS( 0, "epr-20091.ic8",   0x000000, 0x080000, CRC(59ed40f4) SHA1(eff0f54c70bce05ff3a289bf30b1027e1c8cd117) ) \
2656   ROM_SYSTEM_BIOS( 1, "Japan (97/02/17)",  "Japan (bios epr-19730)" ) \
2657   ROM_LOAD16_WORD_SWAP_BIOS( 1, "epr-19730.ic8",   0x000000, 0x080000, CRC(d0e0889d) SHA1(fae53107c894e0c41c49e191dbe706c9cd6e50bd) ) \
2658   ROM_SYSTEM_BIOS( 2, "Japan (95/04/25)",  "Japan (bios epr-17951a)" ) \
2659   ROM_LOAD16_WORD_SWAP_BIOS( 2, "epr-17951a.ic8",  0x000000, 0x080000, CRC(2672f9d8) SHA1(63cf4a6432f6c87952f9cf3ab0f977aed2367303) ) \
2660   ROM_SYSTEM_BIOS( 3, "Japan (95/01/31)",  "Japan (bios epr-17740)" ) \
2661   ROM_LOAD16_WORD_SWAP_BIOS( 3, "epr-17740.ic8",   0x000000, 0x080000, CRC(5c5aa63d) SHA1(06860d96923b81afbc21e0ad32ee19487d8ff6e7) ) \
2662   ROM_SYSTEM_BIOS( 4, "Europe (95/04/25)", "Europe (bios epr-17954a)" ) \
2663   ROM_LOAD16_WORD_SWAP_BIOS( 4, "epr-17954a.ic8",  0x000000, 0x080000, CRC(f7722da3) SHA1(af79cff317e5b57d49e463af16a9f616ed1eee08) ) \
2664   ROM_SYSTEM_BIOS( 5, "USA (95/04/25)",    "USA (bios epr-17952a)" ) \
2665   ROM_LOAD16_WORD_SWAP_BIOS( 5, "epr-17952a.ic8",  0x000000, 0x080000, CRC(d1be2adf) SHA1(eaf1c3e5d602e1139d2090a78d7e19f04f916794) ) \
2666   ROM_SYSTEM_BIOS( 6, "Taiwan (95/04/25)", "Taiwan (bios epr-17953a)" ) \
2667   ROM_LOAD16_WORD_SWAP_BIOS( 6, "epr-17953a.ic8",  0x000000, 0x080000, CRC(a4c47570) SHA1(9efc73717ec8a13417e65c54344ded9fc25bf5ef) ) \
2668   ROM_SYSTEM_BIOS( 7, "Debug (95/01/13)",   "Debug" ) \
2669   ROM_LOAD16_WORD_SWAP_BIOS( 7, "stv110.bin",      0x000000, 0x080000, CRC(3dfeda92) SHA1(8eb33192a57df5f3a1dfb57263054867c6b2db6d) ) \
2670   ROM_SYSTEM_BIOS( 8, "Dev1061","Development (bios 1.061)" ) \
2671   ROM_LOAD16_WORD_SWAP_BIOS( 8, "stv1061.bin",     0x000000, 0x080000, CRC(728dbca3) SHA1(0ed2030177f0aa8285645c395ae9ad9f568ab1d6) ) \
27262672   ROM_REGION( 0x080000, REGION_CPU2, 0 ) /* SH2 code */ \
27272673   ROM_COPY( REGION_CPU1,0,0,0x080000) \
27282674
r2956r2957
28542800   ROM_LOAD16_WORD_SWAP( "mpr18972.6",    0x1400000, 0x0400000, CRC(45c64fca) SHA1(ae2f678b9885426ce99b615b7f62a451f9ef83f9) ) // good (was .5)
28552801ROM_END
28562802
2857ROM_START( diehard )
2858    STV_BIOS // must use USA
2803ROM_START( diehard ) /* must use USA, Europe or Taiwan BIOS */
2804   STV_BIOS
2805
28592806   ROM_REGION32_BE( 0x3000000, REGION_USER1, 0 ) /* SH2 code */
28602807   ROM_LOAD( "fpr19119.13",               0x0000000, 0x0100000, CRC(de5c4f7c) SHA1(35f670a15e9c86edbe2fe718470f5a75b5b096ac) )
28612808   ROM_RELOAD ( 0x0100000, 0x0100000 )
r2956r2957
32243171   STV_BIOS
32253172
32263173   ROM_REGION32_BE( 0x3000000, REGION_USER1, 0 ) /* SH2 code */
3227   ROM_FILL(                             0x0000000, 0x0200000, 0x00 )
3174   ROM_FILL(                           0x0000000, 0x0200000, 0x00 )
32283175   ROM_LOAD16_BYTE( "th-ic7_2.stv",    0x0200000, 0x0080000, CRC(c4e993de) SHA1(7aa433bc2623cb19a09d4ef4c8233a2d29901020) )
32293176   ROM_LOAD16_BYTE( "th-ic7_1.stv",    0x0200001, 0x0080000, CRC(1355cc18) SHA1(a9b731228a807b2b01f933fe0f7dcdbadaf89b7e) )
32303177
r2956r2957
32383185   STV_BIOS
32393186
32403187   ROM_REGION32_BE( 0x3000000, REGION_USER1, 0 ) /* SH2 code */
3241   ROM_FILL(                             0x0000000, 0x0400000, 0x00 )
3242   ROM_LOAD16_BYTE( "2.ic13_2",               0x0200000, 0x0080000, CRC(6cae2926) SHA1(e8d5745b4228de24672da5017cb3dab58344f59f) )
3188   ROM_FILL(                       0x0000000, 0x0400000, 0x00 )
3189   ROM_LOAD16_BYTE( "2.ic13_2",    0x0200000, 0x0080000, CRC(6cae2926) SHA1(e8d5745b4228de24672da5017cb3dab58344f59f) )
32433190   ROM_LOAD16_BYTE( "1.ic13_1",    0x0200001, 0x0080000, CRC(460727c8) SHA1(da7171b65734264e10692e3408ac93beb374c65e) )
32443191
32453192   ROM_LOAD( "bom210-10.ic2",   0x1c00000, 0x0400000, CRC(f59d0827) SHA1(2bed4b2c78e9b4e9332f576e1b264a6343f4cfff) )
3246   ROM_RELOAD(                           0x0400000, 0x0400000 )
3193   ROM_RELOAD(                  0x0400000, 0x0400000 )
32473194   ROM_LOAD( "bom210-11.ic3",   0x2000000, 0x0400000, CRC(44e5a13e) SHA1(aee3c06662a1d083f3bd01292cf2694132f63533) )
3248   ROM_RELOAD(                           0x0800000, 0x0400000 )
3195   ROM_RELOAD(                  0x0800000, 0x0400000 )
32493196   ROM_LOAD( "bom210-12.ic4",   0x2400000, 0x0400000, CRC(deabc701) SHA1(cb313ae9bf6f115682fc76647a999e12c98f6120) )
3250   ROM_RELOAD(                           0x0c00000, 0x0400000 )
3197   ROM_RELOAD(                  0x0c00000, 0x0400000 )
32513198   ROM_LOAD( "bom210-13.ic5",   0x2800000, 0x0400000, CRC(5ece1d5c) SHA1(6d88f71b485bf2b3c164fa22f1c7ecaba4b3f5b1) )
3252   ROM_RELOAD(                           0x1000000, 0x0400000 )
3199   ROM_RELOAD(                  0x1000000, 0x0400000 )
32533200ROM_END
32543201
32553202
r2956r2957
33303277   ROM_LOAD16_WORD_SWAP( "mpr19633.3",    0x0800000, 0x0400000, CRC(e2f0b037) SHA1(97861d09e10ce5d2b10bf5559574b3f489e28077) ) // good
33313278ROM_END
33323279
3333ROM_START( smleague )
3334   STV_BIOS // must use USA
3280ROM_START( smleague ) /* must use USA BIOS so we include it in this set */
3281
3282   ROM_REGION( 0x080000, REGION_CPU1, 0 ) /* SH2 code */
3283   ROM_LOAD16_WORD_SWAP( "epr-17952a.ic8",  0x000000, 0x080000, CRC(d1be2adf) SHA1(eaf1c3e5d602e1139d2090a78d7e19f04f916794) )
3284   ROM_REGION( 0x080000, REGION_CPU2, 0 ) /* SH2 code */
3285   ROM_COPY( REGION_CPU1,0,0,0x080000)
3286
33353287   ROM_REGION32_BE( 0x3000000, REGION_USER1, 0 ) /* SH2 code */
33363288   ROM_LOAD( "epr18777.13",               0x0000000, 0x0080000, CRC(8d180866) SHA1(d47ebabab6e06400312d39f68cd818852e496b96) )
33373289   ROM_RELOAD ( 0x0080000, 0x0080000 )
r2956r2957
35773529
35783530*/
35793531
3580ROM_START( critcrsh )
3532ROM_START( critcrsh ) /* Must use Europe or Asia BIOS */
35813533   STV_BIOS
35823534
35833535   ROM_REGION32_BE( 0x3000000, REGION_USER1, 0 ) /* SH2 code */
src/mame/drivers/superchs.c
r2956r2957
115115   switch (offset)
116116   {
117117      case 0x00:
118         return (input_port_read_indexed(machine,0) << 16) | input_port_read_indexed(machine,1) |
118         return (input_port_read(machine, "SYSTEM") << 16) | input_port_read(machine, "INPUT") |
119119              (eeprom_read_bit() << 7);
120120
121121      case 0x01:
r2956r2957
176176
177177static READ32_HANDLER( superchs_stick_r )
178178{
179   int fake = input_port_read_indexed(machine,6);
179   int fake = input_port_read(machine, "FAKE");
180180   int accel;
181181
182182   if (!(fake &0x10))   /* Analogue steer (the real control method) */
183183   {
184      steer = input_port_read_indexed(machine,2);
184      steer = input_port_read(machine, "WHEEL");
185185   }
186186   else   /* Digital steer, with smoothing - speed depends on how often stick_r is called */
187187   {
r2956r2957
206206   }
207207
208208   /* Accelerator is an analogue input but the game treats it as digital (on/off) */
209   if (input_port_read_indexed(machine,6) & 0x1)   /* pressing B1 */
209   if (input_port_read(machine,  "FAKE") & 0x1)   /* pressing B1 */
210210      accel = 0x0;
211211   else
212212      accel = 0xff;
213213
214214   /* Todo: Verify brake - and figure out other input */
215   return (steer << 24) | (accel << 16) | (input_port_read_indexed(machine,4) << 8) | input_port_read_indexed(machine,5);
215   return (steer << 24) | (accel << 16) | (input_port_read(machine, "SOUND") << 8) | input_port_read(machine, "UNKNOWN");
216216}
217217
218218static WRITE32_HANDLER( superchs_stick_w )
r2956r2957
273273/***********************************************************/
274274
275275static INPUT_PORTS_START( superchs )
276   PORT_START      /* IN0 */
276   PORT_START_TAG("SYSTEM")   /* IN0 */
277277   PORT_BIT( 0x0001, IP_ACTIVE_LOW,  IPT_UNKNOWN )
278278   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_UNKNOWN )
279279   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_UNKNOWN )
r2956r2957
291291   PORT_BIT( 0x4000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
292292   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
293293
294   PORT_START      /* IN1 */
294   PORT_START_TAG("INPUT")      /* IN1 */
295295   PORT_BIT( 0x0001, IP_ACTIVE_LOW,  IPT_UNKNOWN )
296296   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_UNKNOWN )
297297   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_UNKNOWN )
r2956r2957
304304   PORT_BIT( 0x0200, IP_ACTIVE_LOW,  IPT_UNKNOWN )
305305   PORT_BIT( 0x0400, IP_ACTIVE_LOW,  IPT_UNKNOWN )
306306   PORT_BIT( 0x0800, IP_ACTIVE_LOW,  IPT_UNKNOWN )
307   PORT_BIT(0x1000, IP_ACTIVE_LOW,  IPT_BUTTON3 ) PORT_NAME("Nitro")
308   PORT_BIT(0x2000, IP_ACTIVE_LOW,  IPT_BUTTON4 ) PORT_NAME("Gear Shift")
309   PORT_BIT(0x4000, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_NAME("Brake")
307   PORT_BIT( 0x1000, IP_ACTIVE_LOW,  IPT_BUTTON3 ) PORT_NAME("Nitro")
308   PORT_BIT( 0x2000, IP_ACTIVE_LOW,  IPT_BUTTON4 ) PORT_NAME("Gear Shift")
309   PORT_BIT( 0x4000, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_NAME("Brake")
310310   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_START1 )
311311
312   PORT_START   /* IN 2, steering wheel */
312   PORT_START_TAG("WHEEL")      /* IN 2, steering wheel */
313313   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_REVERSE PORT_PLAYER(1)
314314
315   PORT_START   /* IN 3, accel [effectively also brake for the upright] */
315   PORT_START_TAG("ACCEL")      /* IN 3, accel [effectively also brake for the upright] */
316316   PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_PLAYER(1)
317317
318   PORT_START   /* IN 4, sound volume */
318   PORT_START_TAG("SOUND")      /* IN 4, sound volume */
319319   PORT_BIT( 0xff, 0x00, IPT_AD_STICK_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(2)
320320
321   PORT_START   /* IN 5, unknown */
321   PORT_START_TAG("UNKNOWN")   /* IN 5, unknown */
322322   PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_PLAYER(2)
323323
324   PORT_START   /* IN 6, inputs and DSW all fake */
324   PORT_START_TAG("FAKE")      /* IN 6, inputs and DSW all fake */
325325   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
326326   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(1)
327327   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(1)
src/mame/drivers/sbowling.c
r2956r2957
176176
177177static READ8_HANDLER (controls_r)
178178{
179   if(sbw_system&2)
180      return input_port_read_indexed(machine, 2);
179   if(sbw_system & 2)
180      return input_port_read(machine, "TRACKY");
181181   else
182      return input_port_read_indexed(machine, 3);
182      return input_port_read(machine, "TRACKX");
183183}
184184
185185static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
r2956r2957
192192
193193
194194static ADDRESS_MAP_START( port_map, ADDRESS_SPACE_IO, 8 )
195   AM_RANGE(0x00, 0x00) AM_READWRITE(input_port_0_r, watchdog_reset_w)
195   AM_RANGE(0x00, 0x00) AM_READ_PORT("IN0") AM_WRITE(watchdog_reset_w)
196196   AM_RANGE(0x01, 0x01) AM_READWRITE(controls_r, pix_data_w)
197197   AM_RANGE(0x02, 0x02) AM_READWRITE(pix_data_r, pix_shift_w)
198   AM_RANGE(0x03, 0x03) AM_READWRITE(input_port_1_r, SMH_NOP)
199   AM_RANGE(0x04, 0x04) AM_READWRITE(input_port_4_r, system_w)
200   AM_RANGE(0x05, 0x05) AM_READWRITE(input_port_5_r, graph_control_w)
198   AM_RANGE(0x03, 0x03) AM_READ_PORT("IN1") AM_WRITENOP
199   AM_RANGE(0x04, 0x04) AM_READ_PORT("DSW0") AM_WRITE(system_w)
200   AM_RANGE(0x05, 0x05) AM_READ_PORT("DSW1") AM_WRITE(graph_control_w)
201201ADDRESS_MAP_END
202202
203203
204204
205205static INPUT_PORTS_START( sbowling )
206   PORT_START
206   PORT_START_TAG("IN0")
207207   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN1   )
208208   PORT_BIT( 0x20, IP_ACTIVE_HIGH,   IPT_TILT )
209209
210   PORT_START
210   PORT_START_TAG("IN1")
211211   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN2 )
212212   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_START1 )
213213   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_START2 )
214214
215   PORT_START
215   PORT_START_TAG("TRACKY")
216216   PORT_BIT( 0xff, 0, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30)
217217
218   PORT_START
218   PORT_START_TAG("TRACKX")
219219   PORT_BIT( 0xff, 0, IPT_TRACKBALL_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_REVERSE
220220
221   PORT_START   /* coin slots: A 4 LSB, B 4 MSB */
221   PORT_START_TAG("DSW0")   /* coin slots: A 4 LSB, B 4 MSB */
222222   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
223223   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
224224   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
244244   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
245245   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
246246
247   PORT_START
247   PORT_START_TAG("DSW1")
248248   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
249249   PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
250250   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
src/mame/drivers/slapshot.c
r2956r2957
201201   switch (offset)
202202   {
203203      case 0x03:
204         return ((input_port_read_indexed(machine,3) & 0xef) |
205              (input_port_read_indexed(machine,5) & 0x10))  << 8;   /* IN3 + service switch */
204         return ((input_port_read(machine, "IN3") & 0xef) |
205              (input_port_read(machine, "IN5") & 0x10))  << 8;   /* IN3 + service switch */
206206
207207      default:
208208         return TC0640FIO_r(machine,offset) << 8;
r2956r2957
211211
212212static READ16_HANDLER( opwolf3_adc_r )
213213{
214   return input_port_read_indexed(machine, 6 + offset)<<8;
214   static const char *adcnames[] = { "GUN1X", "GUN1Y", "GUN2X", "GUN2Y" };
215
216   return input_port_read(machine, adcnames[offset]) << 8;
215217}
216218
217219static WRITE16_HANDLER( opwolf3_adc_req_w )
r2956r2957
475477   PORT_START_TAG("IN5")      /* IN5, so we can OR in service switch */
476478   PORT_SERVICE_NO_TOGGLE(0x10, IP_ACTIVE_LOW)
477479
478   PORT_START_TAG("IN6")   /* IN 6, P1X */
480   PORT_START_TAG("GUN1X")   /* IN 6, P1X */
479481   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_REVERSE PORT_PLAYER(1)
480482
481   PORT_START_TAG("IN7")   /* IN 7, P1Y */
483   PORT_START_TAG("GUN1Y")   /* IN 7, P1Y */
482484   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_PLAYER(1)
483485
484   PORT_START_TAG("IN8")   /* IN 8, P2X */
486   PORT_START_TAG("GUN2X")   /* IN 8, P2X */
485487   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_REVERSE PORT_PLAYER(2)
486488
487   PORT_START_TAG("IN9")   /* IN 9, P2Y */
489   PORT_START_TAG("GUN2Y")   /* IN 9, P2Y */
488490   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(30) PORT_KEYDELTA(20) PORT_PLAYER(2)
489491INPUT_PORTS_END
490492
src/mame/drivers/psikyo4.c
r2956r2957
188188      }
189189      else   // these games want the eeprom all zeros by default
190190      {
191         int length;
191         UINT32 length, size;
192192         UINT8 *dat;
193193
194         dat = eeprom_get_data_pointer(&length);
195         memset(dat, 0, length);
194         dat = eeprom_get_data_pointer(&length, &size);
195         memset(dat, 0, length * size);
196196      }
197197   }
198198}
src/mame/drivers/sidearms.c
r2956r2957
7474static READ8_HANDLER( turtship_ports_r )
7575{
7676   int i,res;
77   static const char *portnames[] = { "SYSTEM", "P1", "P2", "DSW0", "DSW1", "NOT_PRESENT", "NOT_PRESENT", "NOT_PRESENT" };   // only inputs 0-4 are present
7778
78
7979   res = 0;
8080   for (i = 0;i < 8;i++)
81      res |= ((input_port_read_indexed(machine, i) >> offset) & 1) << i;
81      res |= ((input_port_read_safe(machine, portnames[i], 0) >> offset) & 1) << i;
8282
8383   return res;
8484}
r2956r2957
8787static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
8888   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
8989   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1)
90   AM_RANGE(0xc800, 0xc800) AM_READ(input_port_0_r)
91   AM_RANGE(0xc801, 0xc801) AM_READ(input_port_1_r)
92   AM_RANGE(0xc802, 0xc802) AM_READ(input_port_2_r)
93   AM_RANGE(0xc803, 0xc803) AM_READ(input_port_3_r)
94   AM_RANGE(0xc804, 0xc804) AM_READ(input_port_4_r)
95   AM_RANGE(0xc805, 0xc805) AM_READ(input_port_5_r)
90   AM_RANGE(0xc800, 0xc800) AM_READ_PORT("SYSTEM")
91   AM_RANGE(0xc801, 0xc801) AM_READ_PORT("P1")
92   AM_RANGE(0xc802, 0xc802) AM_READ_PORT("P2")
93   AM_RANGE(0xc803, 0xc803) AM_READ_PORT("DSW0")
94   AM_RANGE(0xc804, 0xc804) AM_READ_PORT("DSW1")
95   AM_RANGE(0xc805, 0xc805) AM_READ_PORT("DSW2")
9696   AM_RANGE(0xd000, 0xffff) AM_READ(SMH_RAM)
9797ADDRESS_MAP_END
9898
r2956r2957
184184static ADDRESS_MAP_START( whizz_readmem, ADDRESS_SPACE_PROGRAM, 8 )
185185   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
186186   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1)
187   AM_RANGE(0xc800, 0xc800) AM_READ(input_port_0_r)
188   AM_RANGE(0xc801, 0xc801) AM_READ(input_port_1_r)
189   AM_RANGE(0xc802, 0xc802) AM_READ(input_port_2_r)
190   AM_RANGE(0xc803, 0xc803) AM_READ(input_port_3_r)
191   AM_RANGE(0xc804, 0xc804) AM_READ(input_port_4_r)
192   AM_RANGE(0xc805, 0xc805) AM_READ(input_port_5_r)
193   AM_RANGE(0xc806, 0xc806) AM_READ(input_port_6_r)
194   AM_RANGE(0xc807, 0xc807) AM_READ(input_port_7_r)
187   AM_RANGE(0xc800, 0xc800) AM_READ_PORT("DSW0")
188   AM_RANGE(0xc801, 0xc801) AM_READ_PORT("DSW1")
189   AM_RANGE(0xc802, 0xc802) AM_READ_PORT("DSW2")
190   AM_RANGE(0xc803, 0xc803) AM_READ_PORT("IN0")
191   AM_RANGE(0xc804, 0xc804) AM_READ_PORT("IN1")
192   AM_RANGE(0xc805, 0xc805) AM_READ_PORT("IN2")
193   AM_RANGE(0xc806, 0xc806) AM_READ_PORT("IN3")
194   AM_RANGE(0xc807, 0xc807) AM_READ_PORT("IN4")
195195   AM_RANGE(0xd000, 0xffff) AM_READ(SMH_RAM)
196196ADDRESS_MAP_END
197197
r2956r2957
241241
242242
243243static INPUT_PORTS_START( sidearms )
244   PORT_START_TAG("IN0")
244   PORT_START_TAG("SYSTEM")
245245   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
246246   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
247247   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
253253   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
254254   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
255255
256   PORT_START_TAG("IN1")
256   PORT_START_TAG("P1")
257257   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
258258   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
259259   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
r2956r2957
263263   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
264264   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
265265
266   PORT_START_TAG("IN2")
266   PORT_START_TAG("P2")
267267   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
268268   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
269269   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
r2956r2957
328328INPUT_PORTS_END
329329
330330static INPUT_PORTS_START( turtship )
331   PORT_START_TAG("IN0")
331   PORT_START_TAG("SYSTEM")
332332   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
333333   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
334334   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
338338   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
339339   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
340340
341   PORT_START_TAG("IN1")
341   PORT_START_TAG("P1")
342342   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
343343   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
344344   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
r2956r2957
348348   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
349349   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
350350
351   PORT_START_TAG("IN2")
351   PORT_START_TAG("P2")
352352   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
353353   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
354354   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
r2956r2957
409409INPUT_PORTS_END
410410
411411static INPUT_PORTS_START( dyger )
412   PORT_START_TAG("IN0")
412   PORT_START_TAG("SYSTEM")
413413   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
414414   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* seems to be 1-player only */
415415   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
419419   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
420420   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
421421
422   PORT_START_TAG("IN1")
422   PORT_START_TAG("P1")
423423   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
424424   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
425425   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
r2956r2957
429429   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
430430   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
431431
432   PORT_START_TAG("IN2")
432   PORT_START_TAG("P2")
433433   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* seems to be 1-player only */
434434
435435   PORT_START_TAG("DSW0")
r2956r2957
560560   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
561561   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
562562
563   PORT_START_TAG("IN3")
563   PORT_START_TAG("IN0")
564564   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
565565   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
566566   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
r2956r2957
578578   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
579579   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
580580
581   PORT_START_TAG("IN4")   /* 8-bit */
581   PORT_START_TAG("IN1")   /* 8-bit */
582582   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
583583   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
584584   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
586586   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
587587   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
588588
589   PORT_START_TAG("IN5")   /* 8-bit */
589   PORT_START_TAG("IN2")   /* 8-bit */
590590   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
591591   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
592592   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
593593   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
594594   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
595595
596   PORT_START_TAG("IN6")
596   PORT_START_TAG("IN3")
597597   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
598598   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
599599   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
603603   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
604604   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
605605
606   PORT_START_TAG("IN7")
606   PORT_START_TAG("IN4")
607607   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
608608   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
609609   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
src/mame/drivers/tumblep.c
r2956r2957
9090    switch (offset<<1)
9191   {
9292      case 0: /* Player 1 & Player 2 joysticks & fire buttons */
93         return (input_port_read_indexed(machine, 0) + (input_port_read_indexed(machine, 1) << 8));
93         return (input_port_read(machine, "P1") + (input_port_read(machine, "P2") << 8));
9494      case 2: /* Dips */
95         return (input_port_read_indexed(machine, 3) + (input_port_read_indexed(machine, 4) << 8));
95         return (input_port_read(machine, "DSW1") + (input_port_read(machine, "DSW2") << 8));
9696      case 8: /* Credits */
97         return input_port_read_indexed(machine, 2);
97         return input_port_read(machine, "SYSTEM");
9898      case 10: /* ? */
9999      case 12:
100100           return 0;
r2956r2957
155155/******************************************************************************/
156156
157157static INPUT_PORTS_START( tumblep )
158   PORT_START   /* Player 1 controls */
158   PORT_START_TAG("P1")   /* Player 1 controls */
159159   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
160160   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
161161   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
165165   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* button 3 - unused */
166166   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
167167
168   PORT_START   /* Player 2 controls */
168   PORT_START_TAG("P2")   /* Player 2 controls */
169169   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
170170   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
171171   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
175175   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* button 3 - unused */
176176   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
177177
178   PORT_START   /* Credits */
178   PORT_START_TAG("SYSTEM")   /* Credits */
179179   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
180180   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
181181   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
185185   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
186186   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
187187
188   PORT_START   /* Dip switch bank 1 */
188   PORT_START_TAG("DSW1")   /* Dip switch bank 1 */
189189   PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) )
190190   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
191191   PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
r2956r2957
211211   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
212212   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
213213
214   PORT_START   /* Dip switch bank 2 */
214   PORT_START_TAG("DSW2")   /* Dip switch bank 2 */
215215   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
216216   PORT_DIPSETTING(    0x80, "1" )
217217   PORT_DIPSETTING(    0x00, "2" )
src/mame/drivers/taitosj.c
r2956r2957
214214   AM_RANGE(0xd300, 0xd300) AM_MIRROR(0x00ff) AM_WRITE(SMH_RAM) AM_BASE(&taitosj_video_priority)
215215   AM_RANGE(0xd400, 0xd403) AM_MIRROR(0x00f0) AM_READ(SMH_RAM) AM_BASE(&taitosj_collision_reg)
216216   AM_RANGE(0xd404, 0xd404) AM_MIRROR(0x00f3) AM_READ(taitosj_gfxrom_r)
217   AM_RANGE(0xd408, 0xd408) AM_MIRROR(0x00f0) AM_READ(input_port_0_r)     /* IN0 */
218   AM_RANGE(0xd409, 0xd409) AM_MIRROR(0x00f0) AM_READ(input_port_1_r)     /* IN1 */
219   AM_RANGE(0xd40a, 0xd40a) AM_MIRROR(0x00f0) AM_READ(input_port_5_r)     /* DSW1 */
220   AM_RANGE(0xd40b, 0xd40b) AM_MIRROR(0x00f0) AM_READ(input_port_2_r)     /* IN2 */
221   AM_RANGE(0xd40c, 0xd40c) AM_MIRROR(0x00f0) AM_READ(input_port_3_r)     /* Service */
222   AM_RANGE(0xd40d, 0xd40d) AM_MIRROR(0x00f0) AM_READ(input_port_4_r)
217   AM_RANGE(0xd408, 0xd408) AM_MIRROR(0x00f0) AM_READ_PORT("IN0")
218   AM_RANGE(0xd409, 0xd409) AM_MIRROR(0x00f0) AM_READ_PORT("IN1")
219   AM_RANGE(0xd40a, 0xd40a) AM_MIRROR(0x00f0) AM_READ_PORT("DSW1")         /* DSW1 */
220   AM_RANGE(0xd40b, 0xd40b) AM_MIRROR(0x00f0) AM_READ_PORT("IN2")
221   AM_RANGE(0xd40c, 0xd40c) AM_MIRROR(0x00f0) AM_READ_PORT("IN3")         /* Service */
222   AM_RANGE(0xd40d, 0xd40d) AM_MIRROR(0x00f0) AM_READ_PORT("IN4")
223223   AM_RANGE(0xd40e, 0xd40e) AM_MIRROR(0x00f0) AM_WRITE(AY8910_control_port_0_w)
224224   AM_RANGE(0xd40f, 0xd40f) AM_MIRROR(0x00f0) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w)   /* DSW2 and DSW3 */
225225   AM_RANGE(0xd500, 0xd505) AM_MIRROR(0x00f0) AM_WRITE(SMH_RAM) AM_BASE(&taitosj_scroll)
r2956r2957
254254   AM_RANGE(0xd300, 0xd300) AM_MIRROR(0x00ff) AM_WRITE(SMH_RAM) AM_BASE(&taitosj_video_priority)
255255   AM_RANGE(0xd400, 0xd403) AM_MIRROR(0x00f0) AM_READ(SMH_RAM) AM_BASE(&taitosj_collision_reg)
256256   AM_RANGE(0xd404, 0xd404) AM_MIRROR(0x00f3) AM_READ(taitosj_gfxrom_r)
257   AM_RANGE(0xd408, 0xd408) AM_MIRROR(0x00f0) AM_READ(input_port_0_r)     /* IN0 */
258   AM_RANGE(0xd409, 0xd409) AM_MIRROR(0x00f0) AM_READ(input_port_1_r)     /* IN1 */
259   AM_RANGE(0xd40a, 0xd40a) AM_MIRROR(0x00f0) AM_READ(input_port_5_r)     /* DSW1 */
260   AM_RANGE(0xd40b, 0xd40b) AM_MIRROR(0x00f0) AM_READ(input_port_2_r)     /* IN2 */
261   AM_RANGE(0xd40c, 0xd40c) AM_MIRROR(0x00f0) AM_READ(input_port_3_r)     /* Service */
262   AM_RANGE(0xd40d, 0xd40d) AM_MIRROR(0x00f0) AM_READ(input_port_4_r)
257   AM_RANGE(0xd408, 0xd408) AM_MIRROR(0x00f0) AM_READ_PORT("IN0")
258   AM_RANGE(0xd409, 0xd409) AM_MIRROR(0x00f0) AM_READ_PORT("IN1")
259   AM_RANGE(0xd40a, 0xd40a) AM_MIRROR(0x00f0) AM_READ_PORT("DSW1")         /* DSW1 */
260   AM_RANGE(0xd40b, 0xd40b) AM_MIRROR(0x00f0) AM_READ_PORT("IN2")
261   AM_RANGE(0xd40c, 0xd40c) AM_MIRROR(0x00f0) AM_READ_PORT("IN3")         /* Service */
262   AM_RANGE(0xd40d, 0xd40d) AM_MIRROR(0x00f0) AM_READ_PORT("IN4")
263263   AM_RANGE(0xd40e, 0xd40e) AM_MIRROR(0x00f0) AM_WRITE(AY8910_control_port_0_w)
264264   AM_RANGE(0xd40f, 0xd40f) AM_MIRROR(0x00f0) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w)   /* DSW2 and DSW3 */
265265   AM_RANGE(0xd500, 0xd505) AM_MIRROR(0x00f0) AM_WRITE(SMH_RAM) AM_BASE(&taitosj_scroll)
r2956r2957
320320   AM_RANGE(0xd300, 0xd300) AM_WRITE(SMH_RAM) AM_BASE(&taitosj_video_priority)
321321   AM_RANGE(0xd400, 0xd403) AM_READ(SMH_RAM) AM_BASE(&taitosj_collision_reg)
322322   AM_RANGE(0xd404, 0xd404) AM_READ(taitosj_gfxrom_r)
323   AM_RANGE(0xd408, 0xd408) AM_READ(input_port_0_r)   /* IN0 */
324   AM_RANGE(0xd409, 0xd409) AM_READ(input_port_1_r)   /* IN1 */
325   AM_RANGE(0xd40a, 0xd40a) AM_READ(input_port_5_r)   /* DSW1 */
326   AM_RANGE(0xd40b, 0xd40b) AM_READ(input_port_2_r)   /* IN2 */
327   AM_RANGE(0xd40c, 0xd40c) AM_READ(input_port_3_r)   /* IN3 */
328   AM_RANGE(0xd40d, 0xd40d) AM_READ(input_port_4_r)   /* IN4 */
323   AM_RANGE(0xd408, 0xd408) AM_MIRROR(0x00f0) AM_READ_PORT("IN0")
324   AM_RANGE(0xd409, 0xd409) AM_MIRROR(0x00f0) AM_READ_PORT("IN1")
325   AM_RANGE(0xd40a, 0xd40a) AM_MIRROR(0x00f0) AM_READ_PORT("DSW1")         /* DSW1 */
326   AM_RANGE(0xd40b, 0xd40b) AM_MIRROR(0x00f0) AM_READ_PORT("IN2")
327   AM_RANGE(0xd40c, 0xd40c) AM_MIRROR(0x00f0) AM_READ_PORT("IN3")         /* Service */
328   AM_RANGE(0xd40d, 0xd40d) AM_MIRROR(0x00f0) AM_READ_PORT("IN4")
329329   AM_RANGE(0xd40e, 0xd40e) AM_WRITE(AY8910_control_port_0_w)
330330   AM_RANGE(0xd40f, 0xd40f) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w)   /* DSW2 and DSW3 */
331331   AM_RANGE(0xd508, 0xd508) AM_WRITE(taitosj_collision_reg_clear_w)
r2956r2957
363363ADDRESS_MAP_END
364364
365365
366
367366#define DSW2_PORT \
368367   PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) ) \
369368   PORT_DIPSETTING(    0x0f, DEF_STR( 9C_1C ) ) \
r2956r2957
481480   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_8WAY PORT_COCKTAIL\
482481   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL )   // from sound CPU
483482
484
485
486
487483static INPUT_PORTS_START( spaceskr )
488484   COMMON_IN0
489485
src/mame/drivers/tx1.c
r2956r2957
113113 *************************************/
114114
115115static INPUT_PORTS_START( tx1 )
116PORT_START_TAG("DSW")
116   PORT_START_TAG("DSW")
117117   PORT_DIPNAME( 0x001c, 0x0000, DEF_STR( Coin_A ) )
118118   PORT_DIPSETTING(      0x0008, DEF_STR( 3C_1C ) )
119119   PORT_DIPSETTING(      0x0004, DEF_STR( 2C_1C ) )
r2956r2957
160160   PORT_DIPSETTING(      0xc000, "6" )
161161   PORT_DIPSETTING(      0xe000, "7" )
162162
163PORT_START_TAG("AN_STEERING")
163   PORT_START_TAG("AN_STEERING")
164164   PORT_BIT( 0x0f, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
165165
166PORT_START_TAG("AN_ACCELERATOR")
166   PORT_START_TAG("AN_ACCELERATOR")
167167   PORT_BIT( 0x1f, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x1f) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
168168
169PORT_START_TAG("AN_BRAKE")
169   PORT_START_TAG("AN_BRAKE")
170170   PORT_BIT( 0x1f, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00,0x1f) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
171171
172PORT_START_TAG("PPI_PORTC")
172   PORT_START_TAG("PPI_PORTC")
173173   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
174174   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
175175   PORT_SERVICE( 0x04, IP_ACTIVE_HIGH )
176176   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gear Change") PORT_CODE(KEYCODE_SPACE) PORT_TOGGLE
177177
178PORT_START_TAG("PPI_PORTD")
178   PORT_START_TAG("PPI_PORTD")
179179   /* Wire jumper setting on sound PCB */
180180   PORT_DIPNAME( 0xf0, 0x80,  DEF_STR( Unknown ) )
181181   PORT_DIPSETTING(    0x10, "1" )
r2956r2957
218218
219219
220220static INPUT_PORTS_START( buggyboy )
221PORT_START_TAG("DSW")
221   PORT_START_TAG("DSW")
222222   /* Dipswitch 0 is unconnected */
223223   PORT_DIPNAME( 0x0003, 0x0003, "Do not change 2" )
224224   PORT_DIPSETTING(      0x0000, "0" )
r2956r2957
272272   PORT_DIPSETTING(      0x0600, "6" )
273273   PORT_DIPSETTING(      0x0700, "7" )
274274
275PORT_START_TAG("PPI_PORTA")
275   PORT_START_TAG("PPI_PORTA")
276276   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
277277   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
278278   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN3 )
279279   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gear Change") PORT_CODE(KEYCODE_SPACE) PORT_TOGGLE
280280   PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
281281
282PORT_START_TAG("PPI_PORTC")
282   PORT_START_TAG("PPI_PORTC")
283283   PORT_DIPNAME( 0xff, 0x80, "Sound PCB Jumper:" )
284284   PORT_DIPSETTING(    0x00, "0" )
285285   PORT_DIPSETTING(    0x01, "1" )
r2956r2957
291291   PORT_DIPSETTING(    0x40, "Buggy Boy/Taito" )
292292   PORT_DIPSETTING(    0x80, "Buggy Boy/Tatsumi" )
293293
294PORT_START_TAG("AN_STEERING")
294   PORT_START_TAG("AN_STEERING")
295295   PORT_BIT( 0x0f, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(25)
296296
297PORT_START_TAG("AN_ACCELERATOR")
297   PORT_START_TAG("AN_ACCELERATOR")
298298   PORT_BIT( 0x1f, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00,0x1f) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
299299
300PORT_START_TAG("AN_BRAKE")
300   PORT_START_TAG("AN_BRAKE")
301301   PORT_BIT( 0x1f, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00,0x1f) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
302302INPUT_PORTS_END
303303
304304static INPUT_PORTS_START( buggybjr )
305PORT_START_TAG("DSW")
305   PORT_START_TAG("DSW")
306306   /* Dipswitch 0 is unconnected */
307307   PORT_DIPNAME( 0x0003, 0x0003, "Do not change 2" )
308308   PORT_DIPSETTING(      0x0000, "0" )
r2956r2957
356356   PORT_DIPSETTING(      0x0600, "6" )
357357   PORT_DIPSETTING(      0x0700, "7" )
358358
359PORT_START_TAG("YM2149_IC19_A")
359   PORT_START_TAG("YM2149_IC19_A")
360360   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
361361   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
362362   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN3 )
363363   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gear Change") PORT_CODE(KEYCODE_SPACE) PORT_TOGGLE
364364   PORT_SERVICE( 0x80, IP_ACTIVE_HIGH )
365365
366/* Wire jumper setting on sound PCB */
367PORT_START_TAG("YM2149_IC19_B")
366   /* Wire jumper setting on sound PCB */
367   PORT_START_TAG("YM2149_IC19_B")
368368   PORT_DIPNAME( 0xff, 0x80, "Sound PCB Jumper:" )
369369   PORT_DIPSETTING(    0x00, "0" )
370370   PORT_DIPSETTING(    0x01, "1" )
r2956r2957
376376   PORT_DIPSETTING(    0x40, "Buggy Boy/Taito" )
377377   PORT_DIPSETTING(    0x80, "Buggy Boy/Tatsumi" )
378378
379PORT_START_TAG("AN_STEERING")
379   PORT_START_TAG("AN_STEERING")
380380   PORT_BIT( 0x0f, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(25)
381381
382PORT_START_TAG("AN_ACCELERATOR")
382   PORT_START_TAG("AN_ACCELERATOR")
383383   PORT_BIT( 0x1f, 0x00, IPT_PEDAL ) PORT_MINMAX(0x00, 0x1f) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
384384
385PORT_START_TAG("AN_BRAKE")
385   PORT_START_TAG("AN_BRAKE")
386386   PORT_BIT( 0x1f, 0x00, IPT_PEDAL2 ) PORT_MINMAX(0x00, 0x1f) PORT_SENSITIVITY(25) PORT_KEYDELTA(10)
387387INPUT_PORTS_END
388388
389389static READ16_HANDLER( dipswitches_r )
390390{
391   return (input_port_read_indexed(machine, 0) & 0xfffe) | ts;
391   return (input_port_read(machine, "DSW") & 0xfffe) | ts;
392392}
393393
394394/*
src/mame/drivers/ssrj.c
r2956r2957
5050static MACHINE_RESET(ssrj)
5151{
5252   UINT8 *rom = memory_region(machine, REGION_CPU1);
53   memset(&rom[0xc000],0,0x3fff); /* req for some control types */
54   oldport=0x80;
53   memset(&rom[0xc000], 0 ,0x3fff); /* req for some control types */
54   oldport = 0x80;
5555}
5656
5757static READ8_HANDLER(ssrj_wheel_r)
5858{
59   int port= input_port_read_indexed(machine, 1) -0x80;
60   int retval=port-oldport;
61   oldport=port;
59   int port = input_port_read(machine, "IN1") - 0x80;
60   int retval = port-oldport;
61   oldport = port;
6262   return retval;
6363}
6464
r2956r2957
7070   AM_RANGE(0xd800, 0xdfff) AM_READ(ssrj_vram4_r)
7171   AM_RANGE(0xe000, 0xe7ff) AM_READ(SMH_RAM)
7272   AM_RANGE(0xe800, 0xefff) AM_READ(SMH_RAM)
73   AM_RANGE(0xf000, 0xf000) AM_READ(input_port_0_r)
73   AM_RANGE(0xf000, 0xf000) AM_READ_PORT("IN0")
7474   AM_RANGE(0xf001, 0xf001) AM_READ(ssrj_wheel_r)
75   AM_RANGE(0xf002, 0xf002) AM_READ(input_port_2_r)
75   AM_RANGE(0xf002, 0xf002) AM_READ_PORT("IN2")
7676   AM_RANGE(0xf401, 0xf401) AM_READ(AY8910_read_port_0_r)
7777ADDRESS_MAP_END
7878
r2956r2957
9292ADDRESS_MAP_END
9393
9494static INPUT_PORTS_START( ssrj )
95
96PORT_START
95   PORT_START_TAG("IN0")
9796   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
9897   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN2 )
9998   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_TILT )
10099   PORT_BIT( 0xe0, 0x00, IPT_PEDAL ) PORT_MINMAX(0,0xe0) PORT_SENSITIVITY(50) PORT_KEYDELTA(0x20)
101100
102 PORT_START
101   PORT_START_TAG("IN1")
103102   PORT_BIT( 0xff, 0x00, IPT_DIAL  ) PORT_SENSITIVITY(50) PORT_KEYDELTA(4) PORT_REVERSE
104103
104   PORT_START_TAG("IN2")
105   PORT_BIT( 0xf, IP_ACTIVE_LOW, IPT_BUTTON2  )  /* code @ $eef  , tested when controls = type4 */
106   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Difficulty ) ) /* ??? code @ $62c */
107   PORT_DIPSETTING(   0x10, DEF_STR( Easy ) )
108   PORT_DIPSETTING(   0x00, DEF_STR( Normal ) )
109   PORT_DIPSETTING(   0x20, "Difficult" )
110   PORT_DIPSETTING(   0x30, "Very Difficult" )
111   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
112   PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
113   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
114   PORT_DIPNAME( 0x80, 0x80, "No Hit" )
115   PORT_DIPSETTING(   0x80, DEF_STR( Off ) )
116   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
105117
106 PORT_START
107
108 PORT_BIT( 0xf, IP_ACTIVE_LOW, IPT_BUTTON2  )  /* code @ $eef  , tested when controls = type4 */
109
110 PORT_DIPNAME(0x30, 0x00, DEF_STR( Difficulty ) ) /* ??? code @ $62c */
111 PORT_DIPSETTING(   0x10, DEF_STR( Easy ) )
112 PORT_DIPSETTING(   0x00, DEF_STR( Normal ) )
113 PORT_DIPSETTING(   0x20, "Difficult" )
114 PORT_DIPSETTING(   0x30, "Very Difficult" )
115
116 PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
117 PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
118 PORT_DIPSETTING(    0x00, DEF_STR( On ) )
119
120 PORT_DIPNAME( 0x80, 0x80, "No Hit" )
121 PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
122 PORT_DIPSETTING(    0x00, DEF_STR( On ) )
123
124 PORT_START
125
118   PORT_START_TAG("IN3")
126119   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coinage ) )
127   PORT_DIPSETTING(    0x07, DEF_STR( 4C_1C ) )
128   PORT_DIPSETTING(    0x06, DEF_STR( 3C_1C ) )
129   PORT_DIPSETTING(    0x05, DEF_STR( 2C_1C ) )
130   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
131   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
132   PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
133   PORT_DIPSETTING(    0x03, DEF_STR( 1C_4C ) )
120   PORT_DIPSETTING(   0x07, DEF_STR( 4C_1C ) )
121   PORT_DIPSETTING(   0x06, DEF_STR( 3C_1C ) )
122   PORT_DIPSETTING(   0x05, DEF_STR( 2C_1C ) )
123   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
124   PORT_DIPSETTING(   0x01, DEF_STR( 1C_2C ) )
125   PORT_DIPSETTING(   0x02, DEF_STR( 1C_3C ) )
126   PORT_DIPSETTING(   0x03, DEF_STR( 1C_4C ) )
134127   PORT_DIPNAME( 0x08, 0x08, "Freeze" )
135   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
136   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
137
138   PORT_DIPNAME( 0x030, 0x000, DEF_STR( Controls ) ) /* 'press button to start' message, and wait for button2 */
139   PORT_DIPSETTING(    0x00, "Type 1" )
140   PORT_DIPSETTING(    0x10, "Type 2" )
141   PORT_DIPSETTING(    0x20, "Type 3" )
142   PORT_DIPSETTING(    0x30, "Type 4" )
143
128   PORT_DIPSETTING(   0x08, DEF_STR( Off ) )
129   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
130   PORT_DIPNAME( 0x30, 0x00, DEF_STR( Controls ) ) /* 'press button to start' message, and wait for button2 */
131   PORT_DIPSETTING(   0x00, "Type 1" )
132   PORT_DIPSETTING(   0x10, "Type 2" )
133   PORT_DIPSETTING(   0x20, "Type 3" )
134   PORT_DIPSETTING(   0x30, "Type 4" )
144135   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* sometimes hangs after game over ($69b) */
145
146
147136INPUT_PORTS_END
148137
149138static const gfx_layout charlayout =
src/mame/drivers/tatsumi.c
r2956r2957
161161static READ16_HANDLER(cyclwarr_palette_r) { return paletteram16[offset]; }
162162static READ16_HANDLER(cyclwarr_sprite_r) { return spriteram16[offset]; }
163163static WRITE16_HANDLER(cyclwarr_sprite_w) { COMBINE_DATA(&spriteram16[offset]); }
164static READ16_HANDLER(cyclwarr_input_r) { return input_port_read_indexed(machine, offset); }
165static READ16_HANDLER(cyclwarr_input2_r) { return input_port_read_indexed(machine, offset+4); }
166164static WRITE16_HANDLER(bigfight_a20000_w) { COMBINE_DATA(&bigfight_a20000[offset]); }
167165static WRITE16_HANDLER(bigfight_a40000_w) { COMBINE_DATA(&bigfight_a40000[offset]); }
168166static WRITE16_HANDLER(bigfight_a60000_w) { COMBINE_DATA(&bigfight_a60000[offset]); }
169167
168static READ16_HANDLER(cyclwarr_input_r)
169{
170   static const char *port[] = { "SERVICE", "P1", "P2", "DSW3" };
171   return input_port_read(machine, port[offset]);
172}
173
174static READ16_HANDLER(cyclwarr_input2_r)
175{
176   static const char *port2[] = { "DSW1", "DSW2", "P3", "P4" };
177   return input_port_read(machine, port2[offset]);
178}
179
170180static WRITE16_HANDLER(cyclwarr_sound_w)
171181{
172182   soundlatch_w(machine, 0, data >> 8);
r2956r2957
180190   AM_RANGE(0x08000, 0x08fff) AM_RAM_WRITE(apache3_palette_w) AM_BASE(&paletteram16)
181191   AM_RANGE(0x0c000, 0x0dfff) AM_RAM_WRITE(roundup5_text_w) AM_BASE(&videoram16)
182192   AM_RANGE(0x0e800, 0x0e803) AM_WRITE(SMH_NOP) // CRT
183   AM_RANGE(0x0f000, 0x0f001) AM_READ(input_port_3_word_r) // Dip 1+2
193   AM_RANGE(0x0f000, 0x0f001) AM_READ_PORT("DSW")
184194   AM_RANGE(0x0f000, 0x0f001) AM_WRITE(SMH_NOP) // todo
185195   AM_RANGE(0x0f800, 0x0f801) AM_READWRITE(apache3_bank_r, apache3_bank_w)
186196   AM_RANGE(0x10000, 0x1ffff) AM_READWRITE(apache3_v30_v20_r, apache3_v30_v20_w)
r2956r2957
203213static ADDRESS_MAP_START( apache3_v20_map, ADDRESS_SPACE_PROGRAM, 8 )
204214   AM_RANGE(0x00000, 0x01fff) AM_RAM
205215   AM_RANGE(0x04000, 0x04003) AM_NOP // piu select .. ?
206   AM_RANGE(0x06000, 0x06001) AM_READ(input_port_0_r) // esw
216   AM_RANGE(0x06000, 0x06001) AM_READ_PORT("IN0") // esw
207217   AM_RANGE(0x08000, 0x08000) AM_WRITE(YM2151_register_port_0_w)
208218   AM_RANGE(0x08001, 0x08001) AM_READWRITE(tatsumi_hack_ym2151_r, YM2151_data_port_0_w)
209219   AM_RANGE(0x0a000, 0x0a000) AM_READWRITE(tatsumi_hack_oki_r, OKIM6295_data_0_w)
r2956r2957
222232   AM_RANGE(0x00000, 0x07fff) AM_RAM
223233   AM_RANGE(0x08000, 0x0bfff) AM_RAM_WRITE(roundup5_text_w) AM_BASE(&videoram16)
224234   AM_RANGE(0x0c000, 0x0c003) AM_WRITE(roundup5_crt_w)
225   AM_RANGE(0x0d000, 0x0d001) AM_READ(input_port_3_word_r) /* Dip 1+2 */
235   AM_RANGE(0x0d000, 0x0d001) AM_READ_PORT("DSW")
226236   AM_RANGE(0x0d400, 0x0d40f) AM_WRITE(SMH_RAM) AM_BASE(&roundup5_unknown0)
227237   AM_RANGE(0x0d800, 0x0d801) AM_WRITE(SMH_RAM) AM_BASE(&roundup5_unknown1) // VRAM2 X scroll (todo)
228238   AM_RANGE(0x0dc00, 0x0dc01) AM_WRITE(SMH_RAM) AM_BASE(&roundup5_unknown2) // VRAM2 Y scroll (todo)
r2956r2957
252262   AM_RANGE(0xfff0, 0xfff0) AM_WRITE(YM2151_register_port_0_w)
253263   AM_RANGE(0xfff1, 0xfff1) AM_READWRITE(tatsumi_hack_ym2151_r, YM2151_data_port_0_w)
254264   AM_RANGE(0xfff4, 0xfff4) AM_READWRITE(tatsumi_hack_oki_r, OKIM6295_data_0_w)
255   AM_RANGE(0xfff8, 0xfff8) AM_READ(input_port_0_r)
256   AM_RANGE(0xfff9, 0xfff9) AM_READ(input_port_1_r)
257   AM_RANGE(0xfffc, 0xfffc) AM_READ(input_port_2_r)
265   AM_RANGE(0xfff8, 0xfff8) AM_READ_PORT("IN0")
266   AM_RANGE(0xfff9, 0xfff9) AM_READ_PORT("IN1")
267   AM_RANGE(0xfffc, 0xfffc) AM_READ_PORT("STICKX")
258268   AM_RANGE(0xfff9, 0xfff9) AM_WRITE(SMH_NOP) //irq ack?
259269   AM_RANGE(0xfffa, 0xfffa) AM_WRITE(SMH_NOP) //irq ack?
260270ADDRESS_MAP_END
r2956r2957
362372/******************************************************************************/
363373
364374static INPUT_PORTS_START( apache3 )
365   PORT_START
375   PORT_START_TAG("IN0")
366376   PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_LOW )
367377   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME( "Trigger" )
368378   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME( "Power" )
r2956r2957
372382   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
373383   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME( "Missile" )
374384
375   PORT_START
385   PORT_START_TAG("STICKX")
376386   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1)
377387
378   PORT_START
388   PORT_START_TAG("STICKY")
379389   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1)
380390
381   PORT_START
391   PORT_START_TAG("DSW")
382392   PORT_DIPNAME( 0x0003, 0x0000, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2")
383393   PORT_DIPSETTING(    0x0000, "3" )
384394   PORT_DIPSETTING(    0x0001, "4" )
r2956r2957
428438INPUT_PORTS_END
429439
430440static INPUT_PORTS_START( roundup5 )
431   PORT_START
441   PORT_START_TAG("IN0")
432442   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("Accelerator")
433443   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
434444   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("Brake")
r2956r2957
438448   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
439449   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
440450
441   PORT_START
451   PORT_START_TAG("IN1")
442452   PORT_SERVICE_NO_TOGGLE( 0x01, IP_ACTIVE_LOW )
443453   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 )
444454   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
r2956r2957
448458   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("Extra 3") PORT_TOGGLE
449459   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("Extra 4") PORT_TOGGLE
450460
451   PORT_START
461   PORT_START_TAG("STICKX")
452462   PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1)
453463
454   PORT_START
464   PORT_START_TAG("DSW")
455465   PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Unknown ) )
456466   PORT_DIPSETTING(    0x0000, DEF_STR( Off ) )
457467   PORT_DIPSETTING(    0x0001, DEF_STR( On ) )
r2956r2957
503513INPUT_PORTS_END
504514
505515static INPUT_PORTS_START( cyclwarr )
506   PORT_START
516   PORT_START_TAG("SERVICE")
507517   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
508518   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
509519   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
r2956r2957
513523   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 )
514524   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE4 )
515525
516   PORT_START
526   PORT_START_TAG("P1")
517527   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
518528   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
519529   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
r2956r2957
523533   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_8WAY PORT_PLAYER(1)
524534   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_PLAYER(1)
525535
526   PORT_START
536   PORT_START_TAG("P2")
527537   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
528538   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
529539   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
r2956r2957
533543   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_8WAY PORT_PLAYER(2)
534544   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_PLAYER(2)
535545
536   PORT_START
546   PORT_START_TAG("DSW3")
537547   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:1")
538548   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
539549   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
547557   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
548558   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
549559
550   PORT_START
560   PORT_START_TAG("DSW1")
551561   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3,4")
552562   PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
553563   PORT_DIPSETTING(      0x0002, DEF_STR( 4C_1C ) )
r2956r2957
583593   PORT_DIPSETTING(      0x00a0, DEF_STR( 1C_6C ) )
584594   PORT_DIPSETTING(      0x0090, DEF_STR( 1C_7C ) )
585595
586   PORT_START
596   PORT_START_TAG("DSW2")
587597   PORT_DIPNAME( 0x0003, 0x0002, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2")
588598   PORT_DIPSETTING(      0x0000, "5" )
589599   PORT_DIPSETTING(      0x0001, "3" )
r2956r2957
606616   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
607617   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
608618
609   PORT_START
619   PORT_START_TAG("P3")
610620   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START3 )
611621   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
612622   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
r2956r2957
616626   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_8WAY PORT_PLAYER(3)
617627   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_PLAYER(3)
618628
619   PORT_START
629   PORT_START_TAG("P4")
620630   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START4 )
621631   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4)
622632   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
r2956r2957
628638INPUT_PORTS_END
629639
630640static INPUT_PORTS_START( bigfight )
631   PORT_START
641   PORT_START_TAG("SERVICE")
632642   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
633643   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
634644   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
r2956r2957
638648   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE3 )
639649   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE4 )
640650
641   PORT_START
651   PORT_START_TAG("P1")
642652   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
643653   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
644654   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
r2956r2957
648658   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_8WAY PORT_PLAYER(1)
649659   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_PLAYER(1)
650660
651   PORT_START
661   PORT_START_TAG("P2")
652662   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START2 )
653663   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
654664   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
r2956r2957
658668   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_8WAY PORT_PLAYER(2)
659669   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_PLAYER(2)
660670
661   PORT_START
671   PORT_START_TAG("DSW3")
662672   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW3:1")
663673   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
664674   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
672682   PORT_DIPSETTING(      0x0008, DEF_STR( Off ) )
673683   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
674684
675   PORT_START
685   PORT_START_TAG("DSW1")
676686   PORT_DIPNAME( 0x000f, 0x000f, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3,4")
677687   PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
678688   PORT_DIPSETTING(      0x0002, DEF_STR( 4C_1C ) )
r2956r2957
708718   PORT_DIPSETTING(      0x00a0, DEF_STR( 1C_6C ) )
709719   PORT_DIPSETTING(      0x0090, DEF_STR( 1C_7C ) )
710720
711   PORT_START
721   PORT_START_TAG("DSW2")
712722   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2")
713723   PORT_DIPSETTING(      0x0000, "1" )
714724   PORT_DIPSETTING(      0x0003, "2" )
r2956r2957
732742   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
733743   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
734744
735   PORT_START
745   PORT_START_TAG("P3")
736746   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START3 )
737747   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
738748   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
r2956r2957
742752   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_8WAY PORT_PLAYER(3)
743753   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_PLAYER(3)
744754
745   PORT_START
755   PORT_START_TAG("P4")
746756   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START4 )
747757   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4)
748758   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(4)
src/mame/drivers/supbtime.c
r2956r2957
3636    switch (offset<<1)
3737   {
3838      case 0: /* Player 1 & Player 2 joysticks & fire buttons */
39         return (input_port_read_indexed(machine, 0) + (input_port_read_indexed(machine, 1) << 8));
39         return (input_port_read(machine, "P1") + (input_port_read(machine, "P2") << 8));
4040      case 2: /* Dips */
41         return (input_port_read_indexed(machine, 3) + (input_port_read_indexed(machine, 4) << 8));
41         return (input_port_read(machine, "DSW1") + (input_port_read(machine, "DSW2") << 8));
4242      case 8: /* Credits */
43         return input_port_read_indexed(machine, 2);
43         return input_port_read(machine, "COIN");
4444      case 10: /* ?  Not used for anything */
4545      case 12:
4646         return 0;
r2956r2957
153153/******************************************************************************/
154154
155155static INPUT_PORTS_START( supbtime )
156   PORT_START   /* Player 1 controls */
156   PORT_START_TAG("P1")   /* Player 1 controls */
157157   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
158158   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
159159   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2956r2957
163163   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* button 3 - unused */
164164   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
165165
166   PORT_START   /* Player 2 controls */
166   PORT_START_TAG("P2")   /* Player 2 controls */
167167   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
168168   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
169169   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
173173   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* button 3 - unused */
174174   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
175175
176   PORT_START   /* Credits */
176   PORT_START_TAG("COIN")   /* Credits */
177177   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
178178   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
179179   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
r2956r2957
183183   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
184184   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
185185
186   PORT_START   /* Dip switch bank 1 - inverted with respect to other Deco games */
186   PORT_START_TAG("DSW1")   /* Dip switch bank 1 - inverted with respect to other Deco games */
187187   PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) )
188188   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
189189   PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
r2956r2957
209209   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
210210   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
211211
212   PORT_START   /* Dip switch bank 2 */
212   PORT_START_TAG("DSW2")   /* Dip switch bank 2 */
213213   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
214214   PORT_DIPSETTING(    0x80, "1" )
215215   PORT_DIPSETTING(    0x00, "2" )
r2956r2957
235235INPUT_PORTS_END
236236
237237static INPUT_PORTS_START( chinatwn )
238   PORT_START   /* Player 1 controls */
238   PORT_START_TAG("P1")   /* Player 1 controls */
239239   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
240240   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
241241   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2956r2957
245245   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )   /* button 3 - unused */
246246   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
247247
248   PORT_START   /* Player 2 controls */
248   PORT_START_TAG("P2")   /* Player 2 controls */
249249   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
250250   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
251251   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
255255   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* button 3 - unused */
256256   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
257257
258   PORT_START   /* Credits */
258   PORT_START_TAG("COIN")   /* Credits */
259259   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
260260   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
261261   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
r2956r2957
265265   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
266266   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
267267
268   PORT_START   /* Dip switch bank 1 - inverted with respect to other Deco games */
268   PORT_START_TAG("DSW1")   /* Dip switch bank 1 - inverted with respect to other Deco games */
269269   PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) )
270270   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
271271   PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
r2956r2957
291291   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
292292   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
293293
294   PORT_START   /* Dip switch bank 2 */
294   PORT_START_TAG("DSW2")   /* Dip switch bank 2 */
295295   PORT_DIPNAME( 0xc0, 0xc0, "Time" )
296296   PORT_DIPSETTING(    0x00, "1500" )
297297   PORT_DIPSETTING(    0x80, "2000" )
src/mame/drivers/toratora.c
r2956r2957
3838static READ8_HANDLER( port_b_u3_r )
3939{
4040   logerror("%04x: read DIP\n",activecpu_get_pc());
41   return input_port_read_indexed(machine, 1);
41   return input_port_read(machine, "DSW");
4242}
4343
4444
r2956r2957
139139   if (timer & 0x100) popmessage("watchdog!");
140140
141141
142   if (last != (input_port_read_indexed(machine, 0) & 0x0f))
142   if (last != (input_port_read(machine, "INPUT") & 0x0f))
143143   {
144      last = input_port_read_indexed(machine, 0) & 0x0f;
144      last = input_port_read(machine, "INPUT") & 0x0f;
145145      cpunum_set_input_line(machine, 0, 0, PULSE_LINE);
146146   }
147   pia_set_input_a(0, input_port_read_indexed(machine, 0) & 0x0f, 0);
147   pia_set_input_a(0, input_port_read(machine, "INPUT") & 0x0f, 0);
148148
149   pia_set_input_ca1(0, input_port_read_indexed(machine, 0) & 0x10);
149   pia_set_input_ca1(0, input_port_read(machine, "INPUT") & 0x10);
150150
151   pia_set_input_ca2(0, input_port_read_indexed(machine, 0) & 0x20);
151   pia_set_input_ca2(0, input_port_read(machine, "INPUT") & 0x20);
152152}
153153
154154static READ8_HANDLER( timer_r )
r2956r2957
357357 *************************************/
358358
359359static INPUT_PORTS_START( toratora )
360   PORT_START
360   PORT_START_TAG("INPUT")
361361   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
362362   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
363363   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 )
r2956r2957
367367   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNUSED )
368368   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
369369
370   PORT_START
370   PORT_START_TAG("DSW")
371371   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
372372   PORT_DIPSETTING(    0x03, "3" )
373373   PORT_DIPSETTING(    0x02, "2" )
src/mame/drivers/srmp2.c
r2956r2957
288288    ---x xxxx : Key code
289289    --x- ---- : Player 1 and 2 side flag
290290*/
291   static const char *keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3" };
291292
292293   if (!ACCESSING_BITS_0_7)
293294   {
r2956r2957
300301
301302      for (i = 0x00 ; i < 0x20 ; i += 8)
302303      {
303         j = (i / 0x08) + 3;
304         j = (i / 0x08);
304305
305306         for (t = 0 ; t < 8 ; t ++)
306307         {
307            if (!(input_port_read_indexed(machine, j) & ( 1 << t )))
308            if (!(input_port_read(machine, keynames[j]) & ( 1 << t )))
308309            {
309310               return (i + t);
310311            }
r2956r2957
313314   }
314315   else                        /* Analizer and memory reset keys */
315316   {
316      return input_port_read(machine, "IN7");
317      return input_port_read(machine, "SERVICE");
317318   }
318319
319320   return 0xffff;
r2956r2957
388389   AM_RANGE(0x0c0000, 0x0c3fff) AM_READ(SMH_RAM)
389390   AM_RANGE(0x140000, 0x143fff) AM_READ(SMH_RAM)            /* Sprites Code + X + Attr */
390391   AM_RANGE(0x180000, 0x180607) AM_READ(SMH_RAM)            /* Sprites Y */
391   AM_RANGE(0x900000, 0x900001) AM_READ(input_port_0_word_r)   /* Coinage */
392   AM_RANGE(0x900000, 0x900001) AM_READ_PORT("SYSTEM")         /* Coinage */
392393   AM_RANGE(0xa00000, 0xa00001) AM_READ(srmp2_input_1_r)      /* I/O port 1 */
393394   AM_RANGE(0xa00002, 0xa00003) AM_READ(srmp2_input_2_r)      /* I/O port 2 */
394395   AM_RANGE(0xb00000, 0xb00001) AM_READ(srmp2_cchip_status_0_r)   /* Custom chip status ??? */
r2956r2957
417418
418419static ADDRESS_MAP_START( mjyuugi_readmem, ADDRESS_SPACE_PROGRAM, 16 )
419420   AM_RANGE(0x000000, 0x07ffff) AM_READ(SMH_ROM)
420   AM_RANGE(0x100000, 0x100001) AM_READ(input_port_0_word_r)   /* Coinage */
421   AM_RANGE(0x100000, 0x100001) AM_READ_PORT("SYSTEM")         /* Coinage */
421422   AM_RANGE(0x100010, 0x100011) AM_READ(SMH_NOP)            /* ??? */
422423   AM_RANGE(0x200000, 0x200001) AM_READ(SMH_NOP)            /* ??? */
423424   AM_RANGE(0x300000, 0x300001) AM_READ(SMH_NOP)            /* ??? */
424   AM_RANGE(0x500000, 0x500001) AM_READ(input_port_8_word_r)   /* DSW 3-1 */
425   AM_RANGE(0x500010, 0x500011) AM_READ(input_port_9_word_r)   /* DSW 3-2 */
425   AM_RANGE(0x500000, 0x500001) AM_READ_PORT("DSW3-1")         /* DSW 3-1 */
426   AM_RANGE(0x500010, 0x500011) AM_READ_PORT("DSW3-2")         /* DSW 3-2 */
426427   AM_RANGE(0x700000, 0x7003ff) AM_READ(SMH_RAM)
427428   AM_RANGE(0x800000, 0x800001) AM_READ(SMH_NOP)            /* ??? */
428429   AM_RANGE(0x900000, 0x900001) AM_READ(srmp2_input_1_r)      /* I/O port 1 */
r2956r2957
511512   /* Currently I/O port of srmp3 is fully understood. */
512513
513514   int keydata = 0xff;
515   static const char *keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3" };
514516
515517   logerror("PC:%04X          srmp3_input_r\n", activecpu_get_pc());
516518
r2956r2957
523525
524526      for (i = 0x00 ; i < 0x20 ; i += 8)
525527      {
526         j = (i / 0x08) + 3;
528         j = (i / 0x08);
527529
528530         for (t = 0 ; t < 8 ; t ++)
529531         {
530            if (!(input_port_read_indexed(machine, j) & ( 1 << t )))
532            if (!(input_port_read(machine, keynames[j]) & ( 1 << t )))
531533            {
532534               keydata = (i + t);
533535            }
r2956r2957
540542
541543   if ((activecpu_get_pc() == 0x8926) || (activecpu_get_pc() == 0x7822))   /* Analizer and memory reset keys */
542544   {
543      keydata = input_port_read_indexed(machine, 7);
545      keydata = input_port_read(machine, "SERVICE");
544546   }
545547
546548   return keydata;
r2956r2957
582584
583585static ADDRESS_MAP_START( srmp3_readport, ADDRESS_SPACE_IO, 8 )
584586   ADDRESS_MAP_GLOBAL_MASK(0xff)
585   AM_RANGE(0x40, 0x40) AM_READ(input_port_0_r)                  /* coin, service */
587   AM_RANGE(0x40, 0x40) AM_READ_PORT("SYSTEM")                     /* coin, service */
586588   AM_RANGE(0xa1, 0xa1) AM_READ(srmp3_cchip_status_0_r)            /* custom chip status ??? */
587589   AM_RANGE(0xc0, 0xc0) AM_READ(srmp3_input_r)                  /* key matrix */
588590   AM_RANGE(0xc1, 0xc1) AM_READ(srmp3_cchip_status_1_r)            /* custom chip status ??? */
r2956r2957
608610
609611***************************************************************************/
610612
611#define SETAMJCTRL_PORT3 \
612   PORT_START_TAG("KMI3")   /* KEY MATRIX INPUT (3) */ \
613   PORT_BIT ( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
614   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL ) \
615   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP ) \
616   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_BIG ) \
617   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE ) \
618   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) \
619   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE ) \
620   PORT_BIT ( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
621   PORT_BIT ( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
613static INPUT_PORTS_START( seta_mjctrl )
614   PORT_START_TAG("KEY0")   /* KEY MATRIX INPUT (3) */
615   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
616   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL )
617   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
618   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_BIG )
619   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
620   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP )
621   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
622   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
623   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
622624
623#define SETAMJCTRL_PORT4 \
624   PORT_START_TAG("KMI4")   /* KEY MATRIX INPUT (4) */ \
625   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_K ) \
626   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) \
627   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_G ) \
628   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) \
629   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_C ) \
630   PORT_BIT ( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
631   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_MAHJONG_L ) \
632   PORT_BIT ( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
633   PORT_BIT ( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
625   PORT_START_TAG("KEY1")   /* KEY MATRIX INPUT (4) */
626   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_K )
627   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
628   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_G )
629   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
630   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_C )
631   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
632   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_MAHJONG_L )
633   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
634   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
634635
635#define SETAMJCTRL_PORT5 \
636   PORT_START_TAG("KMI5")   /* KEY MATRIX INPUT (5) */ \
637   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_H ) \
638   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) \
639   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_D ) \
640   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START1 ) \
641   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_I ) \
642   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) \
643   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_MAHJONG_E ) \
644   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_MAHJONG_M ) \
645   PORT_BIT ( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
636   PORT_START_TAG("KEY2")   /* KEY MATRIX INPUT (5) */
637   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_H )
638   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
639   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_D )
640   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START1 )
641   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_I )
642   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
643   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_MAHJONG_E )
644   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_MAHJONG_M )
645   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
646646
647#define SETAMJCTRL_PORT6 \
648   PORT_START_TAG("KMI6")   /* KEY MATRIX INPUT (6) */ \
649   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_A ) \
650   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) \
651   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_J ) \
652   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) \
653   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_F ) \
654   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_N ) \
655   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_MAHJONG_B ) \
656   PORT_BIT ( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
657   PORT_BIT ( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
647   PORT_START_TAG("KEY3")   /* KEY MATRIX INPUT (6) */
648   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_MAHJONG_A )
649   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
650   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_J )
651   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
652   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_F )
653   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_N )
654   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_MAHJONG_B )
655   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
656   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
657INPUT_PORTS_END
658658
659659static INPUT_PORTS_START( srmp2 )
660   PORT_START_TAG("IN0")         /* Coinage (0) */
661   PORT_BIT ( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
662   PORT_BIT ( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
663   PORT_BIT ( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
664   PORT_BIT ( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
665   PORT_BIT ( 0x0010, IP_ACTIVE_LOW, IPT_COIN1 )
666   PORT_BIT ( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
667   PORT_BIT ( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
668   PORT_BIT ( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
669   PORT_BIT ( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
660   PORT_START_TAG("SYSTEM")         /* Coinage (0) */
661   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
662   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
663   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
664   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
665   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_COIN1 )
666   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
667   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
668   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
669   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
670670
671671   PORT_START_TAG("DSW1")
672672   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
r2956r2957
717717   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
718718   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
719719
720   SETAMJCTRL_PORT3   /* INPUT1 (3) */
721   SETAMJCTRL_PORT4   /* INPUT1 (4) */
722   SETAMJCTRL_PORT5   /* INPUT1 (5) */
723   SETAMJCTRL_PORT6   /* INPUT1 (6) */
720   PORT_INCLUDE( seta_mjctrl )
724721
725   PORT_START_TAG("IN7")
726   PORT_BIT ( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
727   PORT_BIT ( 0x0002, IP_ACTIVE_LOW, IPT_SERVICE3 )
728   PORT_BIT ( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
729   PORT_BIT ( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE2 )
730   PORT_BIT ( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
731   PORT_BIT ( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
732   PORT_BIT ( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
733   PORT_BIT ( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
734   PORT_BIT ( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
722   PORT_START_TAG("SERVICE")
723   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
724   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SERVICE3 )
725   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
726   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE2 )
727   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
728   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
729   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
730   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
731   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
735732INPUT_PORTS_END
736733
737734
738735static INPUT_PORTS_START( srmp3 )
739   PORT_START_TAG("IN0")         /* Coinage (0) */
740   PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
741   PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 )
742   PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
743   PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
744   PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
745   PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
746   PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
747   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
736   PORT_START_TAG("SYSTEM")         /* Coinage (0) */
737   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
738   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 )
739   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
740   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
741   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
742   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
743   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
744   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
748745
749746   PORT_START_TAG("DSW1")
750747   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
r2956r2957
795792   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
796793   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
797794
798   SETAMJCTRL_PORT3   /* INPUT1 (3) */
799   SETAMJCTRL_PORT4   /* INPUT1 (4) */
800   SETAMJCTRL_PORT5   /* INPUT1 (5) */
801   SETAMJCTRL_PORT6   /* INPUT1 (6) */
795   PORT_INCLUDE( seta_mjctrl )
802796
803   PORT_START_TAG("IN7")
804   PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
805   PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_SERVICE3 )
806   PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
807   PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_SERVICE2 )
808   PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
809   PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
810   PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
811   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
797   PORT_START_TAG("SERVICE")
798   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
799   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE3 )
800   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
801   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE2 )
802   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
803   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
804   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
805   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
812806INPUT_PORTS_END
813807
814808
815809static INPUT_PORTS_START( mjyuugi )
816   PORT_START_TAG("IN0")         /* Coinage (0) */
817   PORT_BIT ( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
818   PORT_BIT ( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
819   PORT_BIT ( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
820   PORT_BIT ( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
821   PORT_BIT ( 0x0010, IP_ACTIVE_LOW, IPT_COIN1 )
822   PORT_BIT ( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
823   PORT_BIT ( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
824   PORT_BIT ( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
825   PORT_BIT ( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
810   PORT_START_TAG("SYSTEM")         /* Coinage (0) */
811   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
812   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
813   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
814   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
815   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_COIN1 )
816   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
817   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
818   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
819   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
826820
827821   PORT_START_TAG("DSW1")
828822   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) )
r2956r2957
873867   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
874868   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
875869
876   SETAMJCTRL_PORT3   /* INPUT1 (3) */
877   SETAMJCTRL_PORT4   /* INPUT1 (4) */
878   SETAMJCTRL_PORT5   /* INPUT1 (5) */
879   SETAMJCTRL_PORT6   /* INPUT1 (6) */
870   PORT_INCLUDE( seta_mjctrl )
880871
881   PORT_START_TAG("IN7")
882   PORT_BIT ( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
883   PORT_BIT ( 0x0002, IP_ACTIVE_LOW, IPT_SERVICE3 )
872   PORT_START_TAG("SERVICE")
873   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
874   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SERVICE3 )
884875   PORT_DIPNAME( 0x0004, 0x0004, "Debug Mode (Cheat)")
885876   PORT_DIPSETTING(   0x0004, DEF_STR( Off ) )
886877   PORT_DIPSETTING(   0x0000, DEF_STR( On ) )
887   PORT_BIT ( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE2 )
888   PORT_BIT ( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
889   PORT_BIT ( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
890   PORT_BIT ( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
891   PORT_BIT ( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
892   PORT_BIT ( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
878   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE2 )
879   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
880   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
881   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
882   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
883   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
893884
894885   PORT_START_TAG("DSW3-1")         /* [Debug switch] */
895886   PORT_DIPNAME( 0x0001, 0x0001, "Debug  0 (Cheat)")
r2956r2957
904895   PORT_DIPNAME( 0x0008, 0x0008, "Debug  3 (Cheat)")
905896   PORT_DIPSETTING(   0x0008, DEF_STR( Off ) )
906897   PORT_DIPSETTING(   0x0000, DEF_STR( On ) )
907   PORT_BIT ( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
898   PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
908899
909900   PORT_START_TAG("DSW3-2")         /* [Debug switch] */
910901   PORT_DIPNAME( 0x0001, 0x0001, "Debug  4 (Cheat)")
r2956r2957
919910   PORT_DIPNAME( 0x0008, 0x0008, "Debug  7 (Cheat)")
920911   PORT_DIPSETTING(   0x0008, DEF_STR( Off ) )
921912   PORT_DIPSETTING(   0x0000, DEF_STR( On ) )
922   PORT_BIT ( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
913   PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
923914INPUT_PORTS_END
924915
925916static INPUT_PORTS_START( ponchin )
926   PORT_START_TAG("IN0")         /* Coinage (0) */
927   PORT_BIT ( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
928   PORT_BIT ( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
929   PORT_BIT ( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
930   PORT_BIT ( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
931   PORT_BIT ( 0x0010, IP_ACTIVE_LOW, IPT_COIN1 )
932   PORT_BIT ( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
933   PORT_BIT ( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
934   PORT_BIT ( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
935   PORT_BIT ( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
917   PORT_START_TAG("SYSTEM")         /* Coinage (0) */
918   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
919   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
920   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
921   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
922   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_COIN1 )
923   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_SERVICE1 )
924   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
925   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
926   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
936927
937928   PORT_START_TAG("DSW1")
938929   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Difficulty ) )
r2956r2957
982973   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
983974   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
984975
985   SETAMJCTRL_PORT3   /* INPUT1 (3) */
986   SETAMJCTRL_PORT4   /* INPUT1 (4) */
987   SETAMJCTRL_PORT5   /* INPUT1 (5) */
988   SETAMJCTRL_PORT6   /* INPUT1 (6) */
976   PORT_INCLUDE( seta_mjctrl )
989977
990   PORT_START_TAG("IN7")
991   PORT_BIT ( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
992   PORT_BIT ( 0x0002, IP_ACTIVE_LOW, IPT_SERVICE3 )
993   PORT_BIT ( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
994   PORT_BIT ( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE2 )
995   PORT_BIT ( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
996   PORT_BIT ( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
997   PORT_BIT ( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
998   PORT_BIT ( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
999   PORT_BIT ( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
978   PORT_START_TAG("SERVICE")
979   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNKNOWN )
980   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_SERVICE3 )
981   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
982   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_SERVICE2 )
983   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
984   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
985   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
986   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
987   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
1000988
1001989   PORT_START_TAG("DSW3-1")         /* [Debug switch] */
1002990   PORT_DIPNAME( 0x0001, 0x0001, "Debug  0 (Cheat)")
r2956r2957
1011999   PORT_DIPNAME( 0x0008, 0x0008, "Debug  3 (Cheat)")
10121000   PORT_DIPSETTING(   0x0008, DEF_STR( Off ) )
10131001   PORT_DIPSETTING(   0x0000, DEF_STR( On ) )
1014   PORT_BIT ( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
1002   PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
10151003
10161004   PORT_START_TAG("DSW3-2")         /* [Debug switch] */
10171005   PORT_DIPNAME( 0x0001, 0x0001, "Debug  4 (Cheat)")
r2956r2957
10261014   PORT_DIPNAME( 0x0008, 0x0008, "Debug  7 (Cheat)")
10271015   PORT_DIPSETTING(   0x0008, DEF_STR( Off ) )
10281016   PORT_DIPSETTING(   0x0000, DEF_STR( On ) )
1029   PORT_BIT ( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
1017   PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )
10301018INPUT_PORTS_END
10311019
10321020
src/mame/drivers/snk68.c
r2956r2957
1313
1414    For some strange reason version 2 of Street Smart runs on Pow hardware!
1515
16    Emulation by Bryan McPhail, mish@tendril.co.uk
16    Driver by Bryan McPhail, Acho A. Tang, Nicola Salmoria
1717
1818
19Change Log:
20
21FEB-2003 (AT)
22
23- bug fixes:
24
25    pow37b5yel: incorrect sprite priority
26  powj36rc2gre: scrambled Japanese text in cut scenes
27
2819Notes:
20------
21- All evidence suggests that the sprite hardware doesn't have a frame buffer
22  but just a raster line buffer, like NeoGeo (unsurprisingly). The maths
23  confirm this:
24  384 pixels per raster line at 4 clocks per pixel = 1536 clocks per line
25  96 sprites * 16 pixels per sprite  = 1536 clocks to draw the sprites
2926
30  Sprite flickerings and pop-up's not fixed. They look more like
31  sloppy programming than emulation issues. Also suggest redumping
32  sound ROM "dg7", it might be the cause of pow060gre.
27  While this board doesn't have a raster interrupt capability, the way how
28  sprites are drawn needs to be kept in consideration because at least in one
29  case the program modifies the sprite list in the middle of the frame:
30  bug 00871: pow: At 3/4 of the 1st level, there is a large pillar, which pops up too late.
31  The problem in this case is that the sprite list is built by the IRQ handler,
32  however there is code in the main loop that clears some portions of sprite
33  RAM under certain conditions. Usually, this isn't a problem, but in that
34  specific point the sprites added by the IRQ handler are erased during the
35  frame.
36  To avoid glitches in that case, we force a partial screen update every time
37  sprite RAM changes. It's possible that there are other unknown small glitches
38  fixed by this (earlier notes in this driver talked about "sprite flickerings
39  and pop-ups" but I don't know where they happened).
3340
41TODO:
42-----
43- Number of raster lines unknown. Currently set to 264 which gives a 59.19Hz
44  refresh rate.
45
3446***************************************************************************/
3547
3648#include "driver.h"
r2956r2957
3850#include "sound/3812intf.h"
3951#include "sound/upd7759.h"
4052
53extern UINT16* pow_fg_videoram;
54
4155VIDEO_START( pow );
4256VIDEO_START( searchar );
43VIDEO_START( ikari3 );
4457VIDEO_UPDATE( pow );
45VIDEO_UPDATE( searchar );
4658WRITE16_HANDLER( pow_paletteram16_word_w );
4759WRITE16_HANDLER( pow_flipscreen16_w );
48WRITE16_HANDLER( pow_video16_w );
60WRITE16_HANDLER( searchar_flipscreen16_w );
61READ16_HANDLER( pow_spriteram_r );
62WRITE16_HANDLER( pow_spriteram_w );
63READ16_HANDLER( pow_fg_videoram_r );
64WRITE16_HANDLER( pow_fg_videoram_w );
65WRITE16_HANDLER( searchar_fg_videoram_w );
4966
5067static int invert_controls;
68static int sound_status;
5169
5270/******************************************************************************/
5371
54static READ16_HANDLER( sound_cpu_r )
72static READ16_HANDLER( sound_status_r )
5573{
56   return 0x0100;
74   return (sound_status << 8);
5775}
5876
59static READ16_HANDLER( pow_video16_r )
77static WRITE8_HANDLER( sound_status_w )
6078{
61   UINT16 data = videoram16[offset];
62   return data;
79   sound_status = data;
6380}
6481
65static WRITE16_HANDLER( pow_spriteram16_w )
66{
67   /* DWORD aligned bytes should be $ff */
68   if (!(offset & 1))
69      data |= 0xff00;
70   COMBINE_DATA(&spriteram16[offset]);
71}
72
73static READ16_HANDLER( pow_spriteram16_r )
74{
75   return spriteram16[offset];
76}
77
7882static READ16_HANDLER( control_1_r )
7983{
80   return (input_port_read(machine, "IN0") + (input_port_read(machine, "IN1") << 8));
84   return (input_port_read(machine, "P1") + (input_port_read(machine, "P2") << 8));
8185}
8286
8387static READ16_HANDLER( control_2_r )
8488{
85   return input_port_read(machine, "IN2");
89   return input_port_read(machine, "SYSTEM");
8690}
8791
88static READ16_HANDLER( dip_1_r )
89{
90   return input_port_read(machine, "DSW1") << 8;
91}
92
93static READ16_HANDLER( dip_2_r )
94{
95   return input_port_read(machine, "DSW2") << 8;
96}
97
9892static READ16_HANDLER( rotary_1_r )
9993{
10094   return (( ~(1 << input_port_read(machine, "ROT1")) )<<8)&0xff00;
r2956r2957
113107
114108static READ16_HANDLER( protcontrols_r )
115109{
116   return input_port_read_indexed(machine, offset) ^ invert_controls;
110   static const char *portnames[] = { "P1", "P2", "SYSTEM" };
111   return input_port_read(machine, portnames[offset]) ^ invert_controls;
117112}
118113
119114static WRITE16_HANDLER( protection_w )
r2956r2957
126121
127122static WRITE16_HANDLER( sound_w )
128123{
129   soundlatch_w(machine,0,(data>>8)&0xff);
130   cpunum_set_input_line(machine, 1,INPUT_LINE_NMI,PULSE_LINE);
124   if (ACCESSING_BITS_8_15)
125   {
126      soundlatch_w(machine, 0, data >> 8);
127      cpunum_set_input_line(machine, 1, INPUT_LINE_NMI, PULSE_LINE);
128   }
131129}
132130
133131/*******************************************************************************/
134132
135static ADDRESS_MAP_START( pow_readmem, ADDRESS_SPACE_PROGRAM, 16 )
136   AM_RANGE(0x000000, 0x03ffff) AM_READ(SMH_ROM)
137   AM_RANGE(0x040000, 0x043fff) AM_READ(SMH_RAM)
133static ADDRESS_MAP_START( pow_map, ADDRESS_SPACE_PROGRAM, 16 )
134   AM_RANGE(0x000000, 0x03ffff) AM_ROM
135   AM_RANGE(0x040000, 0x043fff) AM_RAM
138136   AM_RANGE(0x080000, 0x080001) AM_READ(control_1_r)
137   AM_RANGE(0x080000, 0x080001) AM_WRITE(sound_w)
139138   AM_RANGE(0x0c0000, 0x0c0001) AM_READ(control_2_r)
140   AM_RANGE(0x0e0000, 0x0e0001) AM_READ(SMH_NOP) /* Watchdog or IRQ ack */
141   AM_RANGE(0x0e8000, 0x0e8001) AM_READ(SMH_NOP) /* Watchdog or IRQ ack */
142   AM_RANGE(0x0f0000, 0x0f0001) AM_READ(dip_1_r)
143   AM_RANGE(0x0f0008, 0x0f0009) AM_READ(dip_2_r)
144   AM_RANGE(0x100000, 0x100fff) AM_READ(pow_video16_r)
145   AM_RANGE(0x200000, 0x207fff) AM_READ(pow_spriteram16_r)
146   AM_RANGE(0x400000, 0x400fff) AM_READ(SMH_RAM)
139   AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(pow_flipscreen16_w)   // + char bank
140   AM_RANGE(0x0e0000, 0x0e0001) AM_READNOP /* Watchdog or IRQ ack */
141   AM_RANGE(0x0e8000, 0x0e8001) AM_READNOP /* Watchdog or IRQ ack */
142   AM_RANGE(0x0f0000, 0x0f0001) AM_READ_PORT("DSW1")
143   AM_RANGE(0x0f0008, 0x0f0009) AM_READ_PORT("DSW2")
144//  AM_RANGE(0x0f0008, 0x0f0009) AM_WRITENOP    /* ?? */
145   AM_RANGE(0x100000, 0x100fff) AM_READWRITE(pow_fg_videoram_r, pow_fg_videoram_w) AM_MIRROR(0x1000) AM_BASE(&pow_fg_videoram)   // 8-bit
146   AM_RANGE(0x200000, 0x207fff) AM_READWRITE(pow_spriteram_r, pow_spriteram_w) AM_BASE(&spriteram16)   // only partially populated
147   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(pow_paletteram16_word_w) AM_BASE(&paletteram16)
147148ADDRESS_MAP_END
148149
149static ADDRESS_MAP_START( pow_writemem, ADDRESS_SPACE_PROGRAM, 16 )
150   AM_RANGE(0x000000, 0x03ffff) AM_WRITE(SMH_ROM)
151   AM_RANGE(0x040000, 0x043fff) AM_WRITE(SMH_RAM)
152   AM_RANGE(0x080000, 0x080001) AM_WRITE(sound_w)
153   AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(pow_flipscreen16_w)
154   AM_RANGE(0x0f0008, 0x0f0009) AM_WRITE(SMH_NOP)
155   AM_RANGE(0x100000, 0x100fff) AM_WRITE(pow_video16_w) AM_BASE(&videoram16)
156   AM_RANGE(0x101000, 0x101fff) AM_WRITE(SMH_NOP) // unknown register writes
157   AM_RANGE(0x200000, 0x207fff) AM_WRITE(pow_spriteram16_w) AM_BASE(&spriteram16)
158   AM_RANGE(0x400000, 0x400fff) AM_WRITE(pow_paletteram16_word_w) AM_BASE(&paletteram16)
159ADDRESS_MAP_END
160
161static ADDRESS_MAP_START( searchar_readmem, ADDRESS_SPACE_PROGRAM, 16 )
162   AM_RANGE(0x000000, 0x03ffff) AM_READ(SMH_ROM)
163   AM_RANGE(0x040000, 0x043fff) AM_READ(SMH_RAM)
150static ADDRESS_MAP_START( searchar_map, ADDRESS_SPACE_PROGRAM, 16 )
151   AM_RANGE(0x000000, 0x03ffff) AM_ROM
152   AM_RANGE(0x040000, 0x043fff) AM_RAM
164153   AM_RANGE(0x080000, 0x080005) AM_READ(protcontrols_r) /* Player 1 & 2 */
154   AM_RANGE(0x080000, 0x080001) AM_WRITE(sound_w)
155   AM_RANGE(0x080006, 0x080007) AM_WRITE(protection_w) /* top byte unknown, bottom is protection in ikari3 and streetsm */
156   AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(searchar_flipscreen16_w)
165157   AM_RANGE(0x0c0000, 0x0c0001) AM_READ(rotary_1_r) /* Player 1 rotary */
166158   AM_RANGE(0x0c8000, 0x0c8001) AM_READ(rotary_2_r) /* Player 2 rotary */
167159   AM_RANGE(0x0d0000, 0x0d0001) AM_READ(rotary_lsb_r) /* Extra rotary bits */
168   AM_RANGE(0x0e0000, 0x0e0001) AM_READ(SMH_NOP)   /* Watchdog or IRQ ack */
169   AM_RANGE(0x0e8000, 0x0e8001) AM_READ(SMH_NOP)   /* Watchdog or IRQ ack */
170   AM_RANGE(0x0f0000, 0x0f0001) AM_READ(dip_1_r)
171   AM_RANGE(0x0f0008, 0x0f0009) AM_READ(dip_2_r)
172   AM_RANGE(0x0f8000, 0x0f8001) AM_READ(sound_cpu_r)
173   AM_RANGE(0x100000, 0x107fff) AM_READ(pow_spriteram16_r)
174   AM_RANGE(0x200000, 0x200fff) AM_READ(pow_video16_r)
175   AM_RANGE(0x300000, 0x33ffff) AM_READ(SMH_BANK1) /* Extra code bank */
176   AM_RANGE(0x400000, 0x400fff) AM_READ(SMH_RAM)
160   AM_RANGE(0x0e0000, 0x0e0001) AM_READNOP   /* Watchdog or IRQ ack */
161   AM_RANGE(0x0e8000, 0x0e8001) AM_READNOP   /* Watchdog or IRQ ack */
162//  AM_RANGE(0x0f0000, 0x0f0001) AM_WRITENOP    /* ?? */
163   AM_RANGE(0x0f0000, 0x0f0001) AM_READ_PORT("DSW1")
164   AM_RANGE(0x0f0008, 0x0f0009) AM_READ_PORT("DSW2")
165   AM_RANGE(0x0f8000, 0x0f8001) AM_READ(sound_status_r)
166   AM_RANGE(0x100000, 0x107fff) AM_READWRITE(pow_spriteram_r, pow_spriteram_w) AM_BASE(&spriteram16)   // only partially populated
167   AM_RANGE(0x200000, 0x200fff) AM_RAM_WRITE(searchar_fg_videoram_w) AM_MIRROR(0x1000) AM_BASE(&pow_fg_videoram) /* Mirror is used by Ikari 3 */
168   AM_RANGE(0x300000, 0x33ffff) AM_ROMBANK(1) /* Extra code bank */
169   AM_RANGE(0x400000, 0x400fff) AM_RAM_WRITE(pow_paletteram16_word_w) AM_BASE(&paletteram16)
177170ADDRESS_MAP_END
178171
179static ADDRESS_MAP_START( searchar_writemem, ADDRESS_SPACE_PROGRAM, 16 )
180   AM_RANGE(0x000000, 0x03ffff) AM_WRITE(SMH_ROM)
181   AM_RANGE(0x040000, 0x043fff) AM_WRITE(SMH_RAM)
182   AM_RANGE(0x080000, 0x080001) AM_WRITE(sound_w)
183   AM_RANGE(0x080006, 0x080007) AM_WRITE(protection_w) /* top byte unknown, bottom is protection in ikari3 and streetsm */
184   AM_RANGE(0x0c0000, 0x0c0001) AM_WRITE(pow_flipscreen16_w)
185   AM_RANGE(0x0f0000, 0x0f0001) AM_WRITE(SMH_NOP)
186   AM_RANGE(0x100000, 0x107fff) AM_WRITE(pow_spriteram16_w) AM_BASE(&spriteram16)
187   AM_RANGE(0x200000, 0x200fff) AM_WRITE(pow_video16_w) AM_BASE(&videoram16)
188   AM_RANGE(0x201000, 0x201fff) AM_WRITE(pow_video16_w) /* Mirror used by Ikari 3 */
189   AM_RANGE(0x400000, 0x400fff) AM_WRITE(pow_paletteram16_word_w) AM_BASE(&paletteram16)
190ADDRESS_MAP_END
191
192172/******************************************************************************/
193173
194static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
195   AM_RANGE(0x0000, 0xefff) AM_READ(SMH_ROM)
196   AM_RANGE(0xf000, 0xf7ff) AM_READ(SMH_RAM)
197   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r)
174static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
175   AM_RANGE(0x0000, 0xefff) AM_ROM
176   AM_RANGE(0xf000, 0xf7ff) AM_RAM
177   AM_RANGE(0xf800, 0xf800) AM_READ(soundlatch_r) AM_WRITE(sound_status_w)
198178ADDRESS_MAP_END
199179
200static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
201   AM_RANGE(0x0000, 0xefff) AM_WRITE(SMH_ROM)
202   AM_RANGE(0xf000, 0xf7ff) AM_WRITE(SMH_RAM)
203ADDRESS_MAP_END
204
205180static WRITE8_HANDLER( D7759_write_port_0_w )
206181{
207182   upd7759_port_w(offset,data);
208   upd7759_start_w (0,0);
209   upd7759_start_w (0,1);
183   upd7759_start_w(0,0);
184   upd7759_start_w(0,1);
210185}
211186
212static ADDRESS_MAP_START( sound_readport, ADDRESS_SPACE_IO, 8 )
187static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 )
213188   ADDRESS_MAP_GLOBAL_MASK(0xff)
214   AM_RANGE(0x00, 0x00) AM_READ(YM3812_status_port_0_r)
215ADDRESS_MAP_END
216
217static ADDRESS_MAP_START( sound_writeport, ADDRESS_SPACE_IO, 8 )
218   ADDRESS_MAP_GLOBAL_MASK(0xff)
219   AM_RANGE(0x00, 0x00) AM_WRITE(YM3812_control_port_0_w)
189   AM_RANGE(0x00, 0x00) AM_READWRITE(YM3812_status_port_0_r, YM3812_control_port_0_w)
220190   AM_RANGE(0x20, 0x20) AM_WRITE(YM3812_write_port_0_w)
221191   AM_RANGE(0x40, 0x40) AM_WRITE(D7759_write_port_0_w)
222192   AM_RANGE(0x80, 0x80) AM_WRITE(upd7759_0_reset_w)
223193ADDRESS_MAP_END
224194
225195/******************************************************************************/
226#define POW_IN0\
227   PORT_START_TAG("IN0")   /* Player 1 controls */\
228   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY\
229   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY\
230   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY\
231   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY\
232   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )\
233   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )\
234   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )\
196
197static INPUT_PORTS_START( pow )
198   PORT_START_TAG("P1")   /* Player 1 controls */
199   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY
200   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
201   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
202   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
203   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
204   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
205   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
235206   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
236207
237#define POW_IN1\
238   PORT_START_TAG("IN1")   /* Player 2 controls */\
239   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_PLAYER(2)\
240   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)\
241   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)\
242   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)\
243   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)\
244   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)\
245   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)\
246   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2  )
208   PORT_START_TAG("P2")   /* Player 2 controls */
209   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_PLAYER(2)
210   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
211   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
212   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
213   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
214   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
215   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
216   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
247217
248#define POW_IN2\
249   PORT_START_TAG("IN2")\
250   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )\
251   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE )   /* same as the service mode dsw */\
252   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )\
253   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )\
254   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )\
255   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )\
256   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )\
218   PORT_START_TAG("SYSTEM")
219   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
220   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE )   /* same as the service mode dsw */
221   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
222   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
223   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
224   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
225   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
257226   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
258227
259#define POW_DSW2\
260   PORT_START_TAG("DSW2")   /* Dip switch bank 2, all active high */\
261   PORT_SERVICE( 0x01, IP_ACTIVE_HIGH )\
262   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Allow_Continue ) )\
263   PORT_DIPSETTING(   0x02, DEF_STR( No ) )\
264   PORT_DIPSETTING(   0x00, DEF_STR( Yes ) )\
265   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) )\
266   PORT_DIPSETTING(   0x00, "20k 50k" )\
267   PORT_DIPSETTING(   0x08, "40k 100k" )\
268   PORT_DIPSETTING(   0x04, "60k 150k" )\
269   PORT_DIPSETTING(   0x0c, DEF_STR( None ) )\
270   PORT_DIPNAME( 0x30, 0x00, "Game Mode" )\
271   PORT_DIPSETTING(   0x00, "Demo Sounds On" )\
272   PORT_DIPSETTING(   0x20, "Demo Sounds Off" )\
273   PORT_DIPSETTING(   0x30, "Freeze" )\
274   PORT_DIPSETTING(   0x10, "Infinite Lives (Cheat)")\
275   PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Difficulty ) )\
276   PORT_DIPSETTING(   0x80, DEF_STR( Easy ) )\
277   PORT_DIPSETTING(   0x00, DEF_STR( Normal ) )\
278   PORT_DIPSETTING(   0x40, DEF_STR( Hard ) )\
279   PORT_DIPSETTING(   0xc0, DEF_STR( Hardest ) )
228   PORT_START_TAG("DSW1")
229   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
230   PORT_DIPNAME( 0x0300, 0x0000, DEF_STR( Coin_B ) )
231   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_1C ) )
232   PORT_DIPSETTING(      0x0200, DEF_STR( 1C_2C ) )
233   PORT_DIPSETTING(      0x0100, DEF_STR( 1C_3C ) )
234   PORT_DIPSETTING(      0x0300, DEF_STR( 1C_4C ) )
235   PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Coin_A ) )
236   PORT_DIPSETTING(      0x0c00, DEF_STR( 4C_1C ) )
237   PORT_DIPSETTING(      0x0400, DEF_STR( 3C_1C ) )
238   PORT_DIPSETTING(      0x0800, DEF_STR( 2C_1C ) )
239   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_1C ) )
240   PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Lives ) )
241   PORT_DIPSETTING(      0x0000, "2" )
242   PORT_DIPSETTING(      0x1000, "3" )
243   PORT_DIPNAME( 0x2000, 0x0000, "Bonus Occurrence" )
244   PORT_DIPSETTING(      0x0000, "1st & 2nd only" )
245   PORT_DIPSETTING(      0x2000, "1st & every 2nd" )
246   PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Language ) )
247   PORT_DIPSETTING(      0x0000, DEF_STR( English ) )
248   PORT_DIPSETTING(      0x4000, DEF_STR( Japanese ) )
249   PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Flip_Screen ) )
250   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
251   PORT_DIPSETTING(      0x8000, DEF_STR( On ) )
280252
281static INPUT_PORTS_START( pow )
282POW_IN0
283POW_IN1
284POW_IN2
285
286   PORT_START_TAG("DSW1")   /* Dip switch bank 1, all active high */
287   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) )
288   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
289   PORT_DIPSETTING(   0x02, DEF_STR( 1C_2C ) )
290   PORT_DIPSETTING(   0x01, DEF_STR( 1C_3C ) )
291   PORT_DIPSETTING(   0x03, DEF_STR( 1C_4C ) )
292   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coin_A ) )
293   PORT_DIPSETTING(   0x0c, DEF_STR( 4C_1C ) )
294   PORT_DIPSETTING(   0x04, DEF_STR( 3C_1C ) )
295   PORT_DIPSETTING(   0x08, DEF_STR( 2C_1C ) )
296   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
297   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Lives ) )
298   PORT_DIPSETTING(   0x00, "2" )
299   PORT_DIPSETTING(   0x10, "3" )
300   PORT_DIPNAME( 0x20, 0x00, "Bonus Occurrence" )
301   PORT_DIPSETTING(   0x00, "1st & 2nd only" )
302   PORT_DIPSETTING(   0x20, "1st & every 2nd" )
303   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Language ) )
304   PORT_DIPSETTING(   0x00, DEF_STR( English ) )
305   PORT_DIPSETTING(   0x40, DEF_STR( Japanese ) )
306   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Flip_Screen ) )
307   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
308   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
309
310POW_DSW2
253   PORT_START_TAG("DSW2")
254   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
255   PORT_SERVICE( 0x0100, IP_ACTIVE_HIGH )
256   PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Allow_Continue ) )
257   PORT_DIPSETTING(      0x0200, DEF_STR( No ) )
258   PORT_DIPSETTING(      0x0000, DEF_STR( Yes ) )
259   PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Bonus_Life ) )
260   PORT_DIPSETTING(      0x0000, "20k 50k" )
261   PORT_DIPSETTING(      0x0800, "40k 100k" )
262   PORT_DIPSETTING(      0x0400, "60k 150k" )
263   PORT_DIPSETTING(      0x0c00, DEF_STR( None ) )
264   PORT_DIPNAME( 0x3000, 0x0000, "Game Mode" )
265   PORT_DIPSETTING(      0x2000, "Demo Sounds Off" )
266   PORT_DIPSETTING(      0x0000, "Demo Sounds On" )
267   PORT_DIPSETTING(      0x3000, "Freeze" )
268   PORT_DIPSETTING(      0x1000, "Infinite Lives (Cheat)")
269   PORT_DIPNAME( 0xc000, 0x0000, DEF_STR( Difficulty ) )
270   PORT_DIPSETTING(      0x8000, DEF_STR( Easy ) )
271   PORT_DIPSETTING(      0x0000, DEF_STR( Normal ) )
272   PORT_DIPSETTING(      0x4000, DEF_STR( Hard ) )
273   PORT_DIPSETTING(      0xc000, DEF_STR( Hardest ) )
311274INPUT_PORTS_END
312275
313276/* Identical to pow, but the Language dip switch has no effect */
314277static INPUT_PORTS_START( powj )
315POW_IN0
316POW_IN1
317POW_IN2
278   PORT_INCLUDE( pow )
318279
319   PORT_START_TAG("DSW1")   /* Dip switch bank 1, all active high */
320   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_B ) )
321   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
322   PORT_DIPSETTING(   0x02, DEF_STR( 1C_2C ) )
323   PORT_DIPSETTING(   0x01, DEF_STR( 1C_3C ) )
324   PORT_DIPSETTING(   0x03, DEF_STR( 1C_4C ) )
325   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coin_A ) )
326   PORT_DIPSETTING(   0x0c, DEF_STR( 4C_1C ) )
327   PORT_DIPSETTING(   0x04, DEF_STR( 3C_1C ) )
328   PORT_DIPSETTING(   0x08, DEF_STR( 2C_1C ) )
329   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
330   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Lives ) )
331   PORT_DIPSETTING(   0x00, "2" )
332   PORT_DIPSETTING(   0x10, "3" )
333   PORT_DIPNAME( 0x20, 0x00, "Bonus Occurrence" )
334   PORT_DIPSETTING(   0x00, "1st & 2nd only" )
335   PORT_DIPSETTING(   0x20, "1st & every 2nd" )
336   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
337   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
338   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
339   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Flip_Screen ) )
340   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
341   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
342
343POW_DSW2
280   PORT_MODIFY("DSW1")
281   PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Unknown ) )
282   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
283   PORT_DIPSETTING(      0x4000, DEF_STR( On ) )
344284INPUT_PORTS_END
345285
286
346287static INPUT_PORTS_START( searchar )
347   PORT_START_TAG("IN0")   /* Player 1 controls */
288   PORT_START_TAG("P1")   /* Player 1 controls */
348289   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY
349290   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
350291   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2956r2957
354295   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
355296   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
356297
357   PORT_START_TAG("IN1")   /* Player 2 controls */
298   PORT_START_TAG("P2")   /* Player 2 controls */
358299   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_PLAYER(2)
359300   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
360301   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
362303   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
363304   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
364305   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
365   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
306   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
366307
367POW_IN2
308   PORT_START_TAG("SYSTEM")
309   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
310   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE )   /* same as the service mode dsw */
311   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
312   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
313   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
314   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
315   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
316   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
368317
369318   PORT_START_TAG("DSW1")
370   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Joystick ) )
371   PORT_DIPSETTING(   0x00, "Rotary Joystick" )
372   PORT_DIPSETTING(   0x01, "Standard Joystick" )
373   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) )
374   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
375   PORT_DIPSETTING(   0x02, DEF_STR( On ) )
376   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives ) )
377   PORT_DIPSETTING(   0x08, "2" )
378   PORT_DIPSETTING(   0x00, "3" )
379   PORT_DIPSETTING(   0x04, "4" )
380   PORT_DIPSETTING(   0x0c, "5" )
381   PORT_DIPNAME( 0x30, 0x00, "Coin A & B" )
382   PORT_DIPSETTING(   0x20, DEF_STR( 2C_1C ) )
383   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
384   PORT_DIPSETTING(   0x10, DEF_STR( 1C_2C ) )
385   PORT_DIPSETTING(   0x30, DEF_STR( Free_Play ) )
386   PORT_DIPNAME( 0x40, 0x00, "Bonus Occurrence" )
387   PORT_DIPSETTING(   0x00, "1st & 2nd only" )
388   PORT_DIPSETTING(   0x40, "1st & every 2nd" )
389   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Flip_Screen ) )
390   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
391   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
319   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
320   PORT_DIPNAME( 0x0100, 0x0000, DEF_STR( Joystick ) )
321   PORT_DIPSETTING(      0x0000, "Rotary Joystick" )
322   PORT_DIPSETTING(      0x0100, "Standard Joystick" )
323   PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Unknown ) )
324   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
325   PORT_DIPSETTING(      0x0200, DEF_STR( On ) )
326   PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Lives ) )
327   PORT_DIPSETTING(      0x0800, "2" )
328   PORT_DIPSETTING(      0x0000, "3" )
329   PORT_DIPSETTING(      0x0400, "4" )
330   PORT_DIPSETTING(      0x0c00, "5" )
331   PORT_DIPNAME( 0x3000, 0x0000, "Coin A & B" )
332   PORT_DIPSETTING(      0x2000, DEF_STR( 2C_1C ) )
333   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_1C ) )
334   PORT_DIPSETTING(      0x1000, DEF_STR( 1C_2C ) )
335   PORT_DIPSETTING(      0x3000, DEF_STR( Free_Play ) )
336   PORT_DIPNAME( 0x4000, 0x0000, "Bonus Occurrence" )
337   PORT_DIPSETTING(      0x0000, "1st & 2nd only" )
338   PORT_DIPSETTING(      0x4000, "1st & every 2nd" )
339   PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Flip_Screen ) )
340   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
341   PORT_DIPSETTING(      0x8000, DEF_STR( On ) )
392342
393343   PORT_START_TAG("DSW2")
394   PORT_SERVICE( 0x01, IP_ACTIVE_HIGH )
395   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Allow_Continue ) )
396   PORT_DIPSETTING(   0x02, DEF_STR( No ) )
397   PORT_DIPSETTING(   0x00, DEF_STR( Yes ) )
398   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) )
399   PORT_DIPSETTING(   0x00, "50k 200k" )
400   PORT_DIPSETTING(   0x08, "70k 270k" )
401   PORT_DIPSETTING(   0x04, "90k 350k" )
402   PORT_DIPSETTING(   0x0c, DEF_STR( None ) )
403   PORT_DIPNAME( 0x30, 0x00, "Game Mode" )
404   PORT_DIPSETTING(   0x20, "Demo Sounds Off" )
405   PORT_DIPSETTING(   0x00, "Demo Sounds On" )
406   PORT_DIPSETTING(   0x30, "Freeze" )
407   PORT_DIPSETTING(   0x10, "Infinite Lives (Cheat)")
408   PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Difficulty ) )
409   PORT_DIPSETTING(   0x80, DEF_STR( Easy ) )
410   PORT_DIPSETTING(   0x00, DEF_STR( Normal ) )
411   PORT_DIPSETTING(   0x40, DEF_STR( Hard ) )
412   PORT_DIPSETTING(   0xc0, DEF_STR( Hardest ) )
344   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
345   PORT_SERVICE( 0x0100, IP_ACTIVE_HIGH )
346   PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Allow_Continue ) )
347   PORT_DIPSETTING(      0x0200, DEF_STR( No ) )
348   PORT_DIPSETTING(      0x0000, DEF_STR( Yes ) )
349   PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Bonus_Life ) )
350   PORT_DIPSETTING(      0x0000, "50k 200k" )
351   PORT_DIPSETTING(      0x0800, "70k 270k" )
352   PORT_DIPSETTING(      0x0400, "90k 350k" )
353   PORT_DIPSETTING(      0x0c00, DEF_STR( None ) )
354   PORT_DIPNAME( 0x3000, 0x0000, "Game Mode" )
355   PORT_DIPSETTING(      0x2000, "Demo Sounds Off" )
356   PORT_DIPSETTING(      0x0000, "Demo Sounds On" )
357   PORT_DIPSETTING(      0x3000, "Freeze" )
358   PORT_DIPSETTING(      0x1000, "Infinite Lives (Cheat)")
359   PORT_DIPNAME( 0xc000, 0x0000, DEF_STR( Difficulty ) )
360   PORT_DIPSETTING(      0x8000, DEF_STR( Easy ) )
361   PORT_DIPSETTING(      0x0000, DEF_STR( Normal ) )
362   PORT_DIPSETTING(      0x4000, DEF_STR( Hard ) )
363   PORT_DIPSETTING(      0xc000, DEF_STR( Hardest ) )
413364
414365   PORT_START_TAG("ROT1")   /* player 1 12-way rotary control  */
415366   PORT_BIT( 0x0f, 0x00, IPT_POSITIONAL )  PORT_POSITIONS(12) PORT_WRAPS PORT_SENSITIVITY(5) PORT_KEYDELTA(5) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_REVERSE PORT_FULL_TURN_COUNT(12)
r2956r2957
418369   PORT_BIT( 0x0f, 0x00, IPT_POSITIONAL )  PORT_POSITIONS(12) PORT_WRAPS PORT_SENSITIVITY(5) PORT_KEYDELTA(5) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) PORT_PLAYER(2) PORT_REVERSE PORT_FULL_TURN_COUNT(12)
419370INPUT_PORTS_END
420371
421#define STREETS_IN0\
422   PORT_START_TAG("IN0")   /* Player 1 controls */\
423   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY\
424   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY\
425   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY\
426   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY\
427   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )\
428   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )\
429   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )\
372
373static INPUT_PORTS_START( streetsm )
374   PORT_START_TAG("P1")   /* Player 1 controls */
375   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY
376   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
377   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
378   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
379   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
380   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 )
381   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
430382   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
431383
432#define STREETS_IN1\
433   PORT_START_TAG("IN1")   /* Player 2 controls */\
434   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_PLAYER(2)\
435   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)\
436   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)\
437   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)\
438   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)\
439   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)\
440   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)\
441   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2  )
384   PORT_START_TAG("P2")   /* Player 2 controls */
385   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_PLAYER(2)
386   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
387   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
388   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
389   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
390   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
391   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
392   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
442393
443#define STREETS_REST\
444   PORT_START_TAG("DSW2") /* Dip switches (Active high) */\
445   PORT_SERVICE( 0x01, IP_ACTIVE_HIGH )\
446   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Allow_Continue ) )\
447   PORT_DIPSETTING(   0x02, DEF_STR( No ) )\
448   PORT_DIPSETTING(   0x00, DEF_STR( Yes ) )\
449   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) )\
450   PORT_DIPSETTING(   0x00, "200k 400k" )\
451   PORT_DIPSETTING(   0x08, "400k 600k" )\
452   PORT_DIPSETTING(   0x04, "600k 800k" )\
453   PORT_DIPSETTING(   0x0c, DEF_STR( None ) )\
454   PORT_DIPNAME( 0x30, 0x00, "Game Mode" )\
455   PORT_DIPSETTING(   0x20, "Demo Sounds Off" )\
456   PORT_DIPSETTING(   0x00, "Demo Sounds On" )\
457   PORT_DIPSETTING(   0x30, "Freeze" )\
458   PORT_DIPSETTING(   0x10, "Infinite Lives (Cheat)")\
459   PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Difficulty ) )\
460   PORT_DIPSETTING(   0x80, DEF_STR( Easy ) )\
461   PORT_DIPSETTING(   0x00, DEF_STR( Normal ) )\
462   PORT_DIPSETTING(   0x40, DEF_STR( Hard ) )\
463   PORT_DIPSETTING(   0xc0, DEF_STR( Hardest ) )\
464   PORT_START_TAG("ROT1")   /* player 1 12-way rotary control - not used in this game */\
465   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )\
466   PORT_START_TAG("ROT2")   /* player 2 12-way rotary control - not used in this game */\
467   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
394   PORT_START_TAG("SYSTEM")
395   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
396   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE )   /* same as the service mode dsw */
397   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
398   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
399   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
400   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
401   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
402   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
468403
469static INPUT_PORTS_START( streetsm )
470STREETS_IN0
471STREETS_IN1
472POW_IN2
473
474404   PORT_START_TAG("DSW1")   /* Dip switches (Active high) */
475   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
476   PORT_DIPSETTING(   0x02, "1" )
477   PORT_DIPSETTING(   0x00, "2" )
478   PORT_DIPSETTING(   0x01, "3" )
479   PORT_DIPSETTING(   0x03, "4" )
480   PORT_DIPNAME( 0x0c, 0x00, "Coin A & B" )
481   PORT_DIPSETTING(   0x08, DEF_STR( 2C_1C ) )
482   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
483   PORT_DIPSETTING(   0x04, DEF_STR( 1C_2C ) )
484   PORT_DIPSETTING(   0x0c, DEF_STR( Free_Play ) )
485   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
486   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
487   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
488   PORT_DIPNAME( 0x20, 0x00, "Bonus Occurrence" )
489   PORT_DIPSETTING(   0x00, "1st & 2nd only" )
490   PORT_DIPSETTING(   0x20, "1st & every 2nd" )
491   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
492   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
493   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
494   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Flip_Screen ) )
495   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
496   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
497STREETS_REST
405   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
406   PORT_DIPNAME( 0x0300, 0x0000, DEF_STR( Lives ) )
407   PORT_DIPSETTING(      0x0200, "1" )
408   PORT_DIPSETTING(      0x0000, "2" )
409   PORT_DIPSETTING(      0x0100, "3" )
410   PORT_DIPSETTING(      0x0300, "4" )
411   PORT_DIPNAME( 0x0c00, 0x0000, "Coin A & B" )
412   PORT_DIPSETTING(      0x0800, DEF_STR( 2C_1C ) )
413   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_1C ) )
414   PORT_DIPSETTING(      0x0400, DEF_STR( 1C_2C ) )
415   PORT_DIPSETTING(      0x0c00, DEF_STR( Free_Play ) )
416   PORT_DIPNAME( 0x1000, 0x0000, DEF_STR( Unknown ) )
417   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
418   PORT_DIPSETTING(      0x1000, DEF_STR( On ) )
419   PORT_DIPNAME( 0x2000, 0x0000, "Bonus Occurrence" )
420   PORT_DIPSETTING(      0x0000, "1st & 2nd only" )
421   PORT_DIPSETTING(      0x2000, "1st & every 2nd" )
422   PORT_DIPNAME( 0x4000, 0x0000, DEF_STR( Unknown ) )
423   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
424   PORT_DIPSETTING(      0x4000, DEF_STR( On ) )
425   PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Flip_Screen ) )
426   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
427   PORT_DIPSETTING(      0x8000, DEF_STR( On ) )
498428
429   PORT_START_TAG("DSW2") /* Dip switches (Active high) */
430   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
431   PORT_SERVICE( 0x0100, IP_ACTIVE_HIGH )
432   PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Allow_Continue ) )
433   PORT_DIPSETTING(      0x0200, DEF_STR( No ) )
434   PORT_DIPSETTING(      0x0000, DEF_STR( Yes ) )
435   PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Bonus_Life ) )
436   PORT_DIPSETTING(      0x0000, "200k 400k" )
437   PORT_DIPSETTING(      0x0800, "400k 600k" )
438   PORT_DIPSETTING(      0x0400, "600k 800k" )
439   PORT_DIPSETTING(      0x0c00, DEF_STR( None ) )
440   PORT_DIPNAME( 0x3000, 0x0000, "Game Mode" )
441   PORT_DIPSETTING(      0x2000, "Demo Sounds Off" )
442   PORT_DIPSETTING(      0x0000, "Demo Sounds On" )
443   PORT_DIPSETTING(      0x3000, "Freeze" )
444   PORT_DIPSETTING(      0x1000, "Infinite Lives (Cheat)")
445   PORT_DIPNAME( 0xc000, 0x0000, DEF_STR( Difficulty ) )
446   PORT_DIPSETTING(      0x8000, DEF_STR( Easy ) )
447   PORT_DIPSETTING(      0x0000, DEF_STR( Normal ) )
448   PORT_DIPSETTING(      0x4000, DEF_STR( Hard ) )
449   PORT_DIPSETTING(      0xc000, DEF_STR( Hardest ) )
450
451   PORT_START_TAG("ROT1")   /* player 1 12-way rotary control - not used in this game */
452   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
453
454   PORT_START_TAG("ROT2")   /* player 2 12-way rotary control - not used in this game */
455   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
499456INPUT_PORTS_END
500457
501458/* Same as streetsm, but Coinage is different */
502459static INPUT_PORTS_START( streetsj )
503STREETS_IN0
504STREETS_IN1
505POW_IN2
460   PORT_INCLUDE( streetsm )
506461
507   PORT_START_TAG("DSW1")   /* Dip switches (Active high) */
508   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
509   PORT_DIPSETTING(   0x02, "1" )
510   PORT_DIPSETTING(   0x00, "2" )
511   PORT_DIPSETTING(   0x01, "3" )
512   PORT_DIPSETTING(   0x03, "4" )
513   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coinage ) )
514   PORT_DIPSETTING(   0x0c, "A 4/1 B 1/4" )
515   PORT_DIPSETTING(   0x04, "A 3/1 B 1/3" )
516   PORT_DIPSETTING(   0x08, "A 2/1 B 1/2" )
517   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
518   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
519   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
520   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
521   PORT_DIPNAME( 0x20, 0x00, "Bonus Occurrence" )
522   PORT_DIPSETTING(   0x00, "1st & 2nd only" )
523   PORT_DIPSETTING(   0x20, "1st & every 2nd" )
524   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
525   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
526   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
527   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Flip_Screen ) )
528   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
529   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
530
531STREETS_REST
462   PORT_MODIFY("DSW1")
463   PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Coinage ) )
464   PORT_DIPSETTING(      0x0c00, "A 4/1 B 1/4" )
465   PORT_DIPSETTING(      0x0400, "A 3/1 B 1/3" )
466   PORT_DIPSETTING(      0x0800, "A 2/1 B 1/2" )
467   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_1C ) )
532468INPUT_PORTS_END
533469
470
534471static INPUT_PORTS_START( ikari3 )
535   PORT_START_TAG("IN0")   /* Player 1 controls, maybe all are active_high? */
472   PORT_START_TAG("P1")   /* Player 1 controls, maybe all are active_high? */
536473   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY
537474   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
538475   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2956r2957
542479   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
543480   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
544481
545   PORT_START_TAG("IN1")   /* Player 2 controls */
482   PORT_START_TAG("P2")   /* Player 2 controls */
546483   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_PLAYER(2)
547484   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
548485   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
550487   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
551488   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
552489   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
553   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
490   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
554491
555POW_IN2
492   PORT_START_TAG("SYSTEM")
493   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
494   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE )   /* same as the service mode dsw */
495   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
496   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
497   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
498   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
499   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
500   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
556501
557502   PORT_START_TAG("DSW1")   /* Dip switches (Active high) */
558   PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
559   PORT_DIPSETTING(   0x02, "2" )
560   PORT_DIPSETTING(   0x00, "3" )
561   PORT_DIPSETTING(   0x01, "4" )
562   PORT_DIPSETTING(   0x03, "5" )
563   PORT_DIPNAME( 0x0c, 0x00, "Coin A & B" )
564   PORT_DIPSETTING(   0x08, "First 2 Coins/1 Credit then 1/1" )
565   PORT_DIPSETTING(   0x00, DEF_STR( 1C_1C ) )
566   PORT_DIPSETTING(   0x04, "First 1 Coin/2 Credits then 1/1" )
567   PORT_DIPSETTING(   0x0c, DEF_STR( Free_Play ) )
568   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unknown ) )
569   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
570   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
571   PORT_DIPNAME( 0x20, 0x00, "Bonus Occurrence" )
572   PORT_DIPSETTING(   0x00, "1st & 2nd only" )
573   PORT_DIPSETTING(   0x20, "1st & every 2nd" )
574   PORT_DIPNAME( 0x40, 0x00, "Blood" )
575   PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
576   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
577   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Flip_Screen ) )
578   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
579   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
503   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
504   PORT_DIPNAME( 0x0300, 0x0000, DEF_STR( Lives ) )
505   PORT_DIPSETTING(      0x0200, "2" )
506   PORT_DIPSETTING(      0x0000, "3" )
507   PORT_DIPSETTING(      0x0100, "4" )
508   PORT_DIPSETTING(      0x0300, "5" )
509   PORT_DIPNAME( 0x0c00, 0x0000, "Coin A & B" )
510   PORT_DIPSETTING(      0x0800, "First 2 Coins/1 Credit then 1/1" )
511   PORT_DIPSETTING(      0x0000, DEF_STR( 1C_1C ) )
512   PORT_DIPSETTING(      0x0400, "First 1 Coin/2 Credits then 1/1" )
513   PORT_DIPSETTING(      0x0c00, DEF_STR( Free_Play ) )
514   PORT_DIPNAME( 0x1000, 0x0000, DEF_STR( Unknown ) )
515   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
516   PORT_DIPSETTING(      0x1000, DEF_STR( On ) )
517   PORT_DIPNAME( 0x2000, 0x0000, "Bonus Occurrence" )
518   PORT_DIPSETTING(      0x0000, "1st & 2nd only" )
519   PORT_DIPSETTING(      0x2000, "1st & every 2nd" )
520   PORT_DIPNAME( 0x4000, 0x0000, "Blood" )
521   PORT_DIPSETTING(      0x4000, DEF_STR( Off ) )
522   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
523   PORT_DIPNAME( 0x8000, 0x0000, DEF_STR( Flip_Screen ) )
524   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
525   PORT_DIPSETTING(      0x8000, DEF_STR( On ) )
580526
581527   PORT_START_TAG("DSW2") /* Dip switches (Active high) */
582   PORT_SERVICE( 0x01, IP_ACTIVE_HIGH )
583   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Allow_Continue ) )
584   PORT_DIPSETTING(   0x02, DEF_STR( No ) )
585   PORT_DIPSETTING(   0x00, DEF_STR( Yes ) )
586   PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Bonus_Life ) )
587   PORT_DIPSETTING(   0x00, "20k 50k" )
588   PORT_DIPSETTING(   0x08, "40k 100k" )
589   PORT_DIPSETTING(   0x04, "60k 150k" )
590   PORT_DIPSETTING(   0x0c, DEF_STR( None ) )
591   PORT_DIPNAME( 0x30, 0x00, "Game Mode" )
592   PORT_DIPSETTING(   0x20, "Demo Sounds Off" )
593   PORT_DIPSETTING(   0x00, "Demo Sounds On" )
594   PORT_DIPSETTING(   0x30, "Freeze" )
595   PORT_DIPSETTING(   0x10, "Infinite Lives (Cheat)")
596   PORT_DIPNAME( 0xc0, 0x80, DEF_STR( Difficulty ) )
597   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
598   PORT_DIPSETTING(   0x80, DEF_STR( Normal ) )
599   PORT_DIPSETTING(   0x40, DEF_STR( Hard ) )
600   PORT_DIPSETTING(   0xc0, DEF_STR( Hardest ) )
528   PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
529   PORT_SERVICE( 0x0100, IP_ACTIVE_HIGH )
530   PORT_DIPNAME( 0x0200, 0x0000, DEF_STR( Allow_Continue ) )
531   PORT_DIPSETTING(      0x0200, DEF_STR( No ) )
532   PORT_DIPSETTING(      0x0000, DEF_STR( Yes ) )
533   PORT_DIPNAME( 0x0c00, 0x0000, DEF_STR( Bonus_Life ) )
534   PORT_DIPSETTING(      0x0000, "20k 50k" )
535   PORT_DIPSETTING(      0x0800, "40k 100k" )
536   PORT_DIPSETTING(      0x0400, "60k 150k" )
537   PORT_DIPSETTING(      0x0c00, DEF_STR( None ) )
538   PORT_DIPNAME( 0x3000, 0x0000, "Game Mode" )
539   PORT_DIPSETTING(      0x2000, "Demo Sounds Off" )
540   PORT_DIPSETTING(      0x0000, "Demo Sounds On" )
541   PORT_DIPSETTING(      0x3000, "Freeze" )
542   PORT_DIPSETTING(      0x1000, "Infinite Lives (Cheat)")
543   PORT_DIPNAME( 0xc000, 0x8000, DEF_STR( Difficulty ) )
544   PORT_DIPSETTING(      0x0000, DEF_STR( Easy ) )
545   PORT_DIPSETTING(      0x8000, DEF_STR( Normal ) )
546   PORT_DIPSETTING(      0x4000, DEF_STR( Hard ) )
547   PORT_DIPSETTING(      0xc000, DEF_STR( Hardest ) )
601548
602549   PORT_START_TAG("ROT1")   /* player 1 12-way rotary control */
603550   PORT_BIT( 0x0f, 0x00, IPT_POSITIONAL )  PORT_POSITIONS(12) PORT_WRAPS PORT_SENSITIVITY(5) PORT_KEYDELTA(5) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_REVERSE PORT_FULL_TURN_COUNT(12)
r2956r2957
610557
611558static const gfx_layout charlayout =
612559{
613   8,8,   /* 8*8 chars */
614   2048,
615   4,      /* 4 bits per pixel  */
616   { 0, 4, 0x8000*8, (0x8000*8)+4 },
617   { 8*8+3, 8*8+2, 8*8+1, 8*8+0, 3, 2, 1, 0 },
618   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
619   16*8   /* every char takes 8 consecutive bytes */
560   8,8,
561   RGN_FRAC(1,2),
562   4,
563   { 0, 4, RGN_FRAC(1,2), RGN_FRAC(1,2)+4 },
564   { STEP4(8*8+3,-1), STEP4(3,-1) },
565   { STEP8(0,8) },
566   16*8
620567};
621568
622static const gfx_layout pow_spritelayout =
569static const gfx_layout spritelayout =
623570{
624   16,16,   /* 16*16 sprites */
625   4096*4,
626   4,      /* 4 bits per pixel */
627   { 0, 0x80000*8, 0x100000*8, 0x180000*8 },
628   { 16*8+7, 16*8+6, 16*8+5, 16*8+4, 16*8+3, 16*8+2, 16*8+1, 16*8+0,
629     7, 6, 5, 4, 3, 2, 1, 0 },
630   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
631     8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
632   8*32   /* every sprite takes 32 consecutive bytes */
633};
634
635static const gfx_layout searchar_spritelayout =
636{
637571   16,16,
638   0x6000,
572   RGN_FRAC(1,2),
639573   4,
640   { 0, 8,0x180000*8, 0x180000*8+8 },
641   { 32*8+7, 32*8+6, 32*8+5, 32*8+4, 32*8+3, 32*8+2, 32*8+1, 32*8+0,
642      7, 6, 5, 4, 3, 2, 1, 0
643   },
644   { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
645      8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16
646   },
574   { 0, 8, RGN_FRAC(1,2), RGN_FRAC(1,2)+8 },
575   { STEP8(32*8+7,-1), STEP8(7,-1) },
576   { STEP16(0,16) },
647577   64*8
648578};
649579
650static const gfx_layout ikari3_spritelayout =
651{
652   16,16,   /* 16*16 sprites */
653   4096*5,
654   4,      /* 4 bits per pixel */
655   { 0x140000*8, 0, 0xa0000*8, 0x1e0000*8 },
656   { 16*8+7, 16*8+6, 16*8+5, 16*8+4, 16*8+3, 16*8+2, 16*8+1, 16*8+0,
657     7, 6, 5, 4, 3, 2, 1, 0 },
658   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
659     8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
660   8*32   /* every sprite takes 32 consecutive bytes */
661};
662
663580static GFXDECODE_START( pow )
664   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout,       0, 128 )
665   GFXDECODE_ENTRY( REGION_GFX2, 0, pow_spritelayout, 0, 128 )
581   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout,   0,  0x80>>4 )
582   GFXDECODE_ENTRY( REGION_GFX2, 0, spritelayout, 0, 0x800>>4 )
666583GFXDECODE_END
667584
668static GFXDECODE_START( searchar )
669   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout,           0,  16 )
670   GFXDECODE_ENTRY( REGION_GFX2, 0, searchar_spritelayout, 0, 128 )
671GFXDECODE_END
672
673static GFXDECODE_START( ikari3 )
674   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout,         0,   16 )
675   GFXDECODE_ENTRY( REGION_GFX2, 0, ikari3_spritelayout, 0, 128 )
676GFXDECODE_END
677
678585/******************************************************************************/
679586
680587static void irqhandler(running_machine *machine, int irq)
r2956r2957
694601
695602/******************************************************************************/
696603
697static MACHINE_DRIVER_START( ikari3 )
698
699   /* basic machine hardware */
700   MDRV_CPU_ADD(M68000, 10000000)   /* Accurate */
701   MDRV_CPU_PROGRAM_MAP(searchar_readmem,searchar_writemem)
702   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
703
704   MDRV_CPU_ADD(Z80, 4000000)
705   /* audio CPU */   /* Accurate */
706   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
707   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
708
709   /* video hardware */
710   MDRV_SCREEN_ADD("main", RASTER)
711   MDRV_SCREEN_REFRESH_RATE(60)
712   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
713   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
714   MDRV_SCREEN_SIZE(32*8, 32*8)
715   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
716
717   MDRV_GFXDECODE(ikari3)
718   MDRV_PALETTE_LENGTH(2048)
719
720   MDRV_VIDEO_START(ikari3)
721   MDRV_VIDEO_UPDATE(searchar)
722
723   /* sound hardware */
724   MDRV_SPEAKER_STANDARD_MONO("mono")
725
726   MDRV_SOUND_ADD(YM3812, 4000000)
727   MDRV_SOUND_CONFIG(ym3812_interface)
728   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
729
730   MDRV_SOUND_ADD(UPD7759, UPD7759_STANDARD_CLOCK)
731   MDRV_SOUND_CONFIG(upd7759_interface)
732   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
733MACHINE_DRIVER_END
734
735
736604static MACHINE_DRIVER_START( pow )
737605
738606   /* basic machine hardware */
739   MDRV_CPU_ADD(M68000, 10000000)   /* Accurate */
740   MDRV_CPU_PROGRAM_MAP(pow_readmem,pow_writemem)
607   MDRV_CPU_ADD_TAG("main", M68000, XTAL_18MHz/2) /* verified on pcb */
608   MDRV_CPU_PROGRAM_MAP(pow_map,0)
741609   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
742610
743   MDRV_CPU_ADD(Z80, 4000000)
744   /* audio CPU */   /* Accurate */
745   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
746   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
611   MDRV_CPU_ADD_TAG("sound", Z80, XTAL_8MHz/2) /* verified on pcb */
612   MDRV_CPU_PROGRAM_MAP(sound_map,0)
613   MDRV_CPU_IO_MAP(sound_io_map,0)
747614
748615   /* video hardware */
749616   MDRV_SCREEN_ADD("main", RASTER)
750   MDRV_SCREEN_REFRESH_RATE(60)
751   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
752617   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
753   MDRV_SCREEN_SIZE(32*8, 32*8)
754   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
618   MDRV_SCREEN_RAW_PARAMS(XTAL_24MHz/4, 384, 0, 256, 264, 16, 240)   // inaccurate
755619
756620   MDRV_GFXDECODE(pow)
757   MDRV_PALETTE_LENGTH(2048)
621   MDRV_PALETTE_LENGTH(0x800)
758622
759623   MDRV_VIDEO_START(pow)
760624   MDRV_VIDEO_UPDATE(pow)
r2956r2957
762626   /* sound hardware */
763627   MDRV_SPEAKER_STANDARD_MONO("mono")
764628
765   MDRV_SOUND_ADD(YM3812, 4000000)
629   MDRV_SOUND_ADD(YM3812, XTAL_8MHz/2) /* verified on pcb  */
766630   MDRV_SOUND_CONFIG(ym3812_interface)
767631   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
768632
r2956r2957
774638
775639static MACHINE_DRIVER_START( searchar )
776640
777   /* basic machine hardware */
778   MDRV_CPU_ADD(M68000, XTAL_18MHz/2) /* verified on pcb  */
779   MDRV_CPU_PROGRAM_MAP(searchar_readmem,searchar_writemem)
780   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
641   MDRV_IMPORT_FROM(pow)
781642
782   MDRV_CPU_ADD(Z80, XTAL_8MHz/2) /* verified on pcb  */
783   /* audio CPU */
784   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
785   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
643   MDRV_CPU_MODIFY("main")
644   MDRV_CPU_PROGRAM_MAP(searchar_map,0)
786645
787   /* video hardware */
788   MDRV_SCREEN_ADD("main", RASTER)
789   MDRV_SCREEN_REFRESH_RATE(60)
790   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
791   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
792   MDRV_SCREEN_SIZE(32*8, 32*8)
793   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
794
795   MDRV_GFXDECODE(searchar)
796   MDRV_PALETTE_LENGTH(2048)
797
798646   MDRV_VIDEO_START(searchar)
799   MDRV_VIDEO_UPDATE(searchar)
800
801   /* sound hardware */
802   MDRV_SPEAKER_STANDARD_MONO("mono")
803
804   MDRV_SOUND_ADD(YM3812, XTAL_8MHz/2) /* verified on pcb  */
805   MDRV_SOUND_CONFIG(ym3812_interface)
806   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
807
808   MDRV_SOUND_ADD(UPD7759, UPD7759_STANDARD_CLOCK)
809   MDRV_SOUND_CONFIG(upd7759_interface)
810   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
811647MACHINE_DRIVER_END
812648
813649
814static MACHINE_DRIVER_START( streetsm )
815
816   /* basic machine hardware */
817   MDRV_CPU_ADD(M68000, 10000000)   /* Accurate */
818   MDRV_CPU_PROGRAM_MAP(pow_readmem,pow_writemem)
819   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
820
821   MDRV_CPU_ADD(Z80, 4000000)
822   /* audio CPU */   /* Accurate */
823   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
824   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
825
826   /* video hardware */
827   MDRV_SCREEN_ADD("main", RASTER)
828   MDRV_SCREEN_REFRESH_RATE(60)
829   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
830   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
831   MDRV_SCREEN_SIZE(32*8, 32*8)
832   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
833
834   MDRV_GFXDECODE(searchar)
835   MDRV_PALETTE_LENGTH(2048)
836
837   MDRV_VIDEO_START(pow)
838   MDRV_VIDEO_UPDATE(searchar)
839
840   /* sound hardware */
841   MDRV_SPEAKER_STANDARD_MONO("mono")
842
843   MDRV_SOUND_ADD(YM3812, 4000000)
844   MDRV_SOUND_CONFIG(ym3812_interface)
845   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
846
847   MDRV_SOUND_ADD(UPD7759, UPD7759_STANDARD_CLOCK)
848   MDRV_SOUND_CONFIG(upd7759_interface)
849   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
850MACHINE_DRIVER_END
851
852650/******************************************************************************/
853651
854652ROM_START( pow )
r2956r2957
864662   ROM_LOAD( "dg10.m25",  0x008000, 0x08000, CRC(9e470d53) SHA1(f7dc6ac39ade573480e87170a2781f0f72930580) )
865663
866664   ROM_REGION( 0x200000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
867   ROM_LOAD( "snk880.11a", 0x000000, 0x20000, CRC(e70fd906) SHA1(b9e734c074ee1c8ae73e6041d739ab30d2df7d62) )
868   ROM_LOAD( "snk880.12a", 0x020000, 0x20000, CRC(628b1aed) SHA1(1065ef835da03f7d9776e81c225c3ecdd2affae2) )
869   ROM_LOAD( "snk880.13a", 0x040000, 0x20000, CRC(19dc8868) SHA1(82aaf93fc8f4b3bf947d373d0f41cc0044207c34) ) /* Also can be labeled as DG13 */
870   ROM_LOAD( "snk880.14a", 0x060000, 0x20000, CRC(47cd498b) SHA1(7fbc007f2d817c26af02fef233f5e0681a17052a) )
871   ROM_LOAD( "snk880.15a", 0x080000, 0x20000, CRC(7a90e957) SHA1(9650d7cdbcbbbcdd7f75a1c3c08a195aa456e169) )
872   ROM_LOAD( "snk880.16a", 0x0a0000, 0x20000, CRC(e40a6c13) SHA1(7ad9dfc65f8c8b316933f0fdd3bc7a243d6eff65) )
873   ROM_LOAD( "snk880.17a", 0x0c0000, 0x20000, CRC(c7931cc2) SHA1(908313d9b7fa4395b5fb79925d068e4f5d354b21) )
874   ROM_LOAD( "snk880.18a", 0x0e0000, 0x20000, CRC(eed72232) SHA1(ad614e752cf1d3eac9a04cbc90435f988e90ace7) )
875   ROM_LOAD( "snk880.19a", 0x100000, 0x20000, CRC(1775b8dd) SHA1(c01154749379be6e18baa99f4d94d97942f3dd85) )
876   ROM_LOAD( "snk880.20a", 0x120000, 0x20000, CRC(f8e752ec) SHA1(1e1e178303f9af84cbb15249c49a870193ef805f) )
877   ROM_LOAD( "snk880.21a", 0x140000, 0x20000, CRC(27e9fffe) SHA1(e8058db40832b986c5addd22dd69b0308d10ec71) )
878   ROM_LOAD( "snk880.22a", 0x160000, 0x20000, CRC(aa9c00d8) SHA1(1017ed1cc036c6084b71204a998fd05557a6e59f) )
879   ROM_LOAD( "snk880.23a", 0x180000, 0x20000, CRC(adb6ad68) SHA1(ed4323d2dfa3efaa496b17f4719f9566d56725e5) )
880   ROM_LOAD( "snk880.24a", 0x1a0000, 0x20000, CRC(dd41865a) SHA1(c86f14342beca896784b88920d9e0879af4179ab) )
881   ROM_LOAD( "snk880.25a", 0x1c0000, 0x20000, CRC(055759ad) SHA1(f9b12320f142075d49d447fb107af99272567d58) )
882   ROM_LOAD( "snk880.26a", 0x1e0000, 0x20000, CRC(9bc261c5) SHA1(f07fef465191d48ccc149d1a62e6382d3fc0ef9f) )
665   ROM_LOAD16_BYTE( "snk880.11a", 0x000000, 0x20000, CRC(e70fd906) SHA1(b9e734c074ee1c8ae73e6041d739ab30d2df7d62) )
666   ROM_LOAD16_BYTE( "snk880.15a", 0x000001, 0x20000, CRC(7a90e957) SHA1(9650d7cdbcbbbcdd7f75a1c3c08a195aa456e169) )
667   ROM_LOAD16_BYTE( "snk880.12a", 0x040000, 0x20000, CRC(628b1aed) SHA1(1065ef835da03f7d9776e81c225c3ecdd2affae2) )
668   ROM_LOAD16_BYTE( "snk880.16a", 0x040001, 0x20000, CRC(e40a6c13) SHA1(7ad9dfc65f8c8b316933f0fdd3bc7a243d6eff65) )
669   ROM_LOAD16_BYTE( "snk880.13a", 0x080000, 0x20000, CRC(19dc8868) SHA1(82aaf93fc8f4b3bf947d373d0f41cc0044207c34) ) /* Also can be labeled as DG13 */
670   ROM_LOAD16_BYTE( "snk880.17a", 0x080001, 0x20000, CRC(c7931cc2) SHA1(908313d9b7fa4395b5fb79925d068e4f5d354b21) )
671   ROM_LOAD16_BYTE( "snk880.14a", 0x0c0000, 0x20000, CRC(47cd498b) SHA1(7fbc007f2d817c26af02fef233f5e0681a17052a) )
672   ROM_LOAD16_BYTE( "snk880.18a", 0x0c0001, 0x20000, CRC(eed72232) SHA1(ad614e752cf1d3eac9a04cbc90435f988e90ace7) )
673   ROM_LOAD16_BYTE( "snk880.19a", 0x100000, 0x20000, CRC(1775b8dd) SHA1(c01154749379be6e18baa99f4d94d97942f3dd85) )
674   ROM_LOAD16_BYTE( "snk880.23a", 0x100001, 0x20000, CRC(adb6ad68) SHA1(ed4323d2dfa3efaa496b17f4719f9566d56725e5) )
675   ROM_LOAD16_BYTE( "snk880.20a", 0x140000, 0x20000, CRC(f8e752ec) SHA1(1e1e178303f9af84cbb15249c49a870193ef805f) )
676   ROM_LOAD16_BYTE( "snk880.24a", 0x140001, 0x20000, CRC(dd41865a) SHA1(c86f14342beca896784b88920d9e0879af4179ab) )
677   ROM_LOAD16_BYTE( "snk880.21a", 0x180000, 0x20000, CRC(27e9fffe) SHA1(e8058db40832b986c5addd22dd69b0308d10ec71) )
678   ROM_LOAD16_BYTE( "snk880.25a", 0x180001, 0x20000, CRC(055759ad) SHA1(f9b12320f142075d49d447fb107af99272567d58) )
679   ROM_LOAD16_BYTE( "snk880.22a", 0x1c0000, 0x20000, CRC(aa9c00d8) SHA1(1017ed1cc036c6084b71204a998fd05557a6e59f) )
680   ROM_LOAD16_BYTE( "snk880.26a", 0x1c0001, 0x20000, CRC(9bc261c5) SHA1(f07fef465191d48ccc149d1a62e6382d3fc0ef9f) )
883681
884682   ROM_REGION( 0x10000, REGION_SOUND1, 0 )   /* UPD7759 samples */
885683   ROM_LOAD( "dg7.d20",  0x000000, 0x10000, CRC(aba9a9d3) SHA1(5098cd3a064b8ede24797de8879a277d79e79d75) )
r2956r2957
901699   ROM_LOAD( "dg10.m25",  0x008000, 0x08000, CRC(9e470d53) SHA1(f7dc6ac39ade573480e87170a2781f0f72930580) )
902700
903701   ROM_REGION( 0x200000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
904   ROM_LOAD( "snk880.11a", 0x000000, 0x20000, CRC(e70fd906) SHA1(b9e734c074ee1c8ae73e6041d739ab30d2df7d62) )
905   ROM_LOAD( "snk880.12a", 0x020000, 0x20000, CRC(628b1aed) SHA1(1065ef835da03f7d9776e81c225c3ecdd2affae2) )
906   ROM_LOAD( "snk880.13a", 0x040000, 0x20000, CRC(19dc8868) SHA1(82aaf93fc8f4b3bf947d373d0f41cc0044207c34) ) /* Also can be labeled as DG13 */
907   ROM_LOAD( "snk880.14a", 0x060000, 0x20000, CRC(47cd498b) SHA1(7fbc007f2d817c26af02fef233f5e0681a17052a) )
908   ROM_LOAD( "snk880.15a", 0x080000, 0x20000, CRC(7a90e957) SHA1(9650d7cdbcbbbcdd7f75a1c3c08a195aa456e169) )
909   ROM_LOAD( "snk880.16a", 0x0a0000, 0x20000, CRC(e40a6c13) SHA1(7ad9dfc65f8c8b316933f0fdd3bc7a243d6eff65) )
910   ROM_LOAD( "snk880.17a", 0x0c0000, 0x20000, CRC(c7931cc2) SHA1(908313d9b7fa4395b5fb79925d068e4f5d354b21) )
911   ROM_LOAD( "snk880.18a", 0x0e0000, 0x20000, CRC(eed72232) SHA1(ad614e752cf1d3eac9a04cbc90435f988e90ace7) )
912   ROM_LOAD( "snk880.19a", 0x100000, 0x20000, CRC(1775b8dd) SHA1(c01154749379be6e18baa99f4d94d97942f3dd85) )
913   ROM_LOAD( "snk880.20a", 0x120000, 0x20000, CRC(f8e752ec) SHA1(1e1e178303f9af84cbb15249c49a870193ef805f) )
914   ROM_LOAD( "snk880.21a", 0x140000, 0x20000, CRC(27e9fffe) SHA1(e8058db40832b986c5addd22dd69b0308d10ec71) )
915   ROM_LOAD( "snk880.22a", 0x160000, 0x20000, CRC(aa9c00d8) SHA1(1017ed1cc036c6084b71204a998fd05557a6e59f) )
916   ROM_LOAD( "snk880.23a", 0x180000, 0x20000, CRC(adb6ad68) SHA1(ed4323d2dfa3efaa496b17f4719f9566d56725e5) )
917   ROM_LOAD( "snk880.24a", 0x1a0000, 0x20000, CRC(dd41865a) SHA1(c86f14342beca896784b88920d9e0879af4179ab) )
918   ROM_LOAD( "snk880.25a", 0x1c0000, 0x20000, CRC(055759ad) SHA1(f9b12320f142075d49d447fb107af99272567d58) )
919   ROM_LOAD( "snk880.26a", 0x1e0000, 0x20000, CRC(9bc261c5) SHA1(f07fef465191d48ccc149d1a62e6382d3fc0ef9f) )
702   ROM_LOAD16_BYTE( "snk880.11a", 0x000000, 0x20000, CRC(e70fd906) SHA1(b9e734c074ee1c8ae73e6041d739ab30d2df7d62) )
703   ROM_LOAD16_BYTE( "snk880.15a", 0x000001, 0x20000, CRC(7a90e957) SHA1(9650d7cdbcbbbcdd7f75a1c3c08a195aa456e169) )
704   ROM_LOAD16_BYTE( "snk880.12a", 0x040000, 0x20000, CRC(628b1aed) SHA1(1065ef835da03f7d9776e81c225c3ecdd2affae2) )
705   ROM_LOAD16_BYTE( "snk880.16a", 0x040001, 0x20000, CRC(e40a6c13) SHA1(7ad9dfc65f8c8b316933f0fdd3bc7a243d6eff65) )
706   ROM_LOAD16_BYTE( "snk880.13a", 0x080000, 0x20000, CRC(19dc8868) SHA1(82aaf93fc8f4b3bf947d373d0f41cc0044207c34) ) /* Also can be labeled as DG13 */
707   ROM_LOAD16_BYTE( "snk880.17a", 0x080001, 0x20000, CRC(c7931cc2) SHA1(908313d9b7fa4395b5fb79925d068e4f5d354b21) )
708   ROM_LOAD16_BYTE( "snk880.14a", 0x0c0000, 0x20000, CRC(47cd498b) SHA1(7fbc007f2d817c26af02fef233f5e0681a17052a) )
709   ROM_LOAD16_BYTE( "snk880.18a", 0x0c0001, 0x20000, CRC(eed72232) SHA1(ad614e752cf1d3eac9a04cbc90435f988e90ace7) )
710   ROM_LOAD16_BYTE( "snk880.19a", 0x100000, 0x20000, CRC(1775b8dd) SHA1(c01154749379be6e18baa99f4d94d97942f3dd85) )
711   ROM_LOAD16_BYTE( "snk880.23a", 0x100001, 0x20000, CRC(adb6ad68) SHA1(ed4323d2dfa3efaa496b17f4719f9566d56725e5) )
712   ROM_LOAD16_BYTE( "snk880.20a", 0x140000, 0x20000, CRC(f8e752ec) SHA1(1e1e178303f9af84cbb15249c49a870193ef805f) )
713   ROM_LOAD16_BYTE( "snk880.24a", 0x140001, 0x20000, CRC(dd41865a) SHA1(c86f14342beca896784b88920d9e0879af4179ab) )
714   ROM_LOAD16_BYTE( "snk880.21a", 0x180000, 0x20000, CRC(27e9fffe) SHA1(e8058db40832b986c5addd22dd69b0308d10ec71) )
715   ROM_LOAD16_BYTE( "snk880.25a", 0x180001, 0x20000, CRC(055759ad) SHA1(f9b12320f142075d49d447fb107af99272567d58) )
716   ROM_LOAD16_BYTE( "snk880.22a", 0x1c0000, 0x20000, CRC(aa9c00d8) SHA1(1017ed1cc036c6084b71204a998fd05557a6e59f) )
717   ROM_LOAD16_BYTE( "snk880.26a", 0x1c0001, 0x20000, CRC(9bc261c5) SHA1(f07fef465191d48ccc149d1a62e6382d3fc0ef9f) )
920718
921719   ROM_REGION( 0x10000, REGION_SOUND1, 0 )   /* UPD7759 samples */
922720   ROM_LOAD( "dg7.d20",  0x000000, 0x10000, CRC(aba9a9d3) SHA1(5098cd3a064b8ede24797de8879a277d79e79d75) )
r2956r2957
925723   ROM_LOAD( "pal20l10.a6", 0x0000, 0x00cc, CRC(c3d9e729) SHA1(f05f03eecf12b4d0793124ecd3195307be04046b) )
926724ROM_END
927725
928ROM_START( searchar )
929   ROM_REGION( 0x40000, REGION_CPU1, 0 )
930   ROM_LOAD16_BYTE( "bhw.2", 0x000000, 0x20000, CRC(e1430138) SHA1(eddc192524a13b2c09bd2bddcd5f8e8b771ceb21) )
931   ROM_LOAD16_BYTE( "bhw.3", 0x000001, 0x20000, CRC(ee1f9374) SHA1(fd41c74fd69d65713d8e1a9b8078328381119379) )
932
933   ROM_REGION( 0x10000, REGION_CPU2, 0 )   /* Sound CPU */
934   ROM_LOAD( "bh.5",       0x000000, 0x10000, CRC(53e2fa76) SHA1(cf25b1def82545a1fd013822ab3cf02483074623) )
935
936   ROM_REGION( 0x010000, REGION_GFX1, ROMREGION_DISPOSE )   /* characters */
937   ROM_LOAD( "bh.7",       0x000000, 0x08000, CRC(b0f1b049) SHA1(ec276984d91b5759a5e2b6815d1db2abc37b99f8) )
938   ROM_LOAD( "bh.8",       0x008000, 0x08000, CRC(174ddba7) SHA1(7b19087cd2ccc409878aefe7fa08bb2e9953d352) )
939
940   ROM_REGION( 0x300000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
941   ROM_LOAD( "bh.c1",      0x000000, 0x80000, CRC(1fb8f0ae) SHA1(d63c7376aa5f01bc009176b23324e720bada4286) )
942   ROM_LOAD( "bh.c3",      0x080000, 0x80000, CRC(fd8bc407) SHA1(88d750293808bf6ea23864b22070314b14fbee3c) )
943   ROM_LOAD( "bh.c5",      0x100000, 0x80000, CRC(1d30acc3) SHA1(e5ca39853779475b83fe37304e7bed2c293bd587) )
944   ROM_LOAD( "bh.c2",      0x180000, 0x80000, CRC(7c803767) SHA1(992516fbb28d00feabbed5769fa3a5748199a7d8) )
945   ROM_LOAD( "bh.c4",      0x200000, 0x80000, CRC(eede7c43) SHA1(7645acf0beb4fff9ec92205dcf34124360cd52f6) )
946   ROM_LOAD( "bh.c6",      0x280000, 0x80000, CRC(9f785cd9) SHA1(e5c7797ae7a3139e1814b068c5ecfe5c6bf30d0f) )
947
948   ROM_REGION( 0x20000, REGION_SOUND1, 0 )   /* UPD7759 samples */
949   ROM_LOAD( "bh.v1",      0x000000, 0x20000, CRC(07a6114b) SHA1(224df4616b77a56f33974d3b1793473d48ad52ca) )
950
951   ROM_REGION16_BE( 0x40000, REGION_USER1, 0 ) /* Extra code bank */
952   ROM_LOAD16_BYTE( "bhw.1", 0x000000, 0x20000, CRC(62b60066) SHA1(f7e7985c8f5f8191c580e777e1b7ed29d944d23f) )
953   ROM_LOAD16_BYTE( "bhw.4", 0x000001, 0x20000, CRC(16d8525c) SHA1(0098b0a7fcb23de2661bbec9a05254aa46579bb2) )
954ROM_END
955
956ROM_START( sercharu )
957   ROM_REGION( 0x40000, REGION_CPU1, 0 )
958   ROM_LOAD16_BYTE( "bh.2",  0x000000, 0x20000, CRC(c852e2e2) SHA1(c4b1b366f452122549046a3dec9b6b375bc273af) )
959   ROM_LOAD16_BYTE( "bh.3",  0x000001, 0x20000, CRC(bc04a4a1) SHA1(aa91583b987248a3e99813ab5e8ee03c02dac9b9) )
960
961   ROM_REGION( 0x10000, REGION_CPU2, 0 )   /* Sound CPU */
962   ROM_LOAD( "bh.5",       0x000000, 0x10000, CRC(53e2fa76) SHA1(cf25b1def82545a1fd013822ab3cf02483074623) )
963
964   ROM_REGION( 0x010000, REGION_GFX1, ROMREGION_DISPOSE )   /* characters */
965   ROM_LOAD( "bh.7",       0x000000, 0x08000, CRC(b0f1b049) SHA1(ec276984d91b5759a5e2b6815d1db2abc37b99f8) )
966   ROM_LOAD( "bh.8",       0x008000, 0x08000, CRC(174ddba7) SHA1(7b19087cd2ccc409878aefe7fa08bb2e9953d352) )
967
968   ROM_REGION( 0x300000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
969   ROM_LOAD( "bh.c1",      0x000000, 0x80000, CRC(1fb8f0ae) SHA1(d63c7376aa5f01bc009176b23324e720bada4286) )
970   ROM_LOAD( "bh.c3",      0x080000, 0x80000, CRC(fd8bc407) SHA1(88d750293808bf6ea23864b22070314b14fbee3c) )
971   ROM_LOAD( "bh.c5",      0x100000, 0x80000, CRC(1d30acc3) SHA1(e5ca39853779475b83fe37304e7bed2c293bd587) )
972   ROM_LOAD( "bh.c2",      0x180000, 0x80000, CRC(7c803767) SHA1(992516fbb28d00feabbed5769fa3a5748199a7d8) )
973   ROM_LOAD( "bh.c4",      0x200000, 0x80000, CRC(eede7c43) SHA1(7645acf0beb4fff9ec92205dcf34124360cd52f6) )
974   ROM_LOAD( "bh.c6",      0x280000, 0x80000, CRC(9f785cd9) SHA1(e5c7797ae7a3139e1814b068c5ecfe5c6bf30d0f) )
975
976   ROM_REGION( 0x20000, REGION_SOUND1, 0 )   /* UPD7759 samples */
977   ROM_LOAD( "bh.v1",      0x000000, 0x20000, CRC(07a6114b) SHA1(224df4616b77a56f33974d3b1793473d48ad52ca) )
978
979   ROM_REGION16_BE( 0x40000, REGION_USER1, 0 ) /* Extra code bank */
980   ROM_LOAD16_BYTE( "bh.1",  0x000000, 0x20000, CRC(ba9ca70b) SHA1(c46727473673554cbe4bbbc0288d66357f99a80e) )
981   ROM_LOAD16_BYTE( "bh.4",  0x000001, 0x20000, CRC(eabc5ddf) SHA1(08a2a8fcdf6a08a2694e00f4232a5bfbec98fd27) )
982ROM_END
983
984ROM_START( sercharj )
985   ROM_REGION( 0x40000, REGION_CPU1, 0 )
986   ROM_LOAD16_BYTE( "bh2ver3j.9c", 0x000000, 0x20000, CRC(7ef7b172) SHA1(85669ba72f59e4ff3a483bf611bf41c73f4e1930) )
987   ROM_LOAD16_BYTE( "bh3ver3j.10c", 0x000001, 0x20000, CRC(3fdea793) SHA1(49bafb53466afb7e4486a4894e4fd6fa08ea2eb2) )
988
989   ROM_REGION( 0x10000, REGION_CPU2, 0 )   /* Sound CPU */
990   ROM_LOAD( "bh.5",       0x000000, 0x10000, CRC(53e2fa76) SHA1(cf25b1def82545a1fd013822ab3cf02483074623) )
991
992   ROM_REGION( 0x010000, REGION_GFX1, ROMREGION_DISPOSE )   /* characters */
993   ROM_LOAD( "bh.7",       0x000000, 0x08000, CRC(b0f1b049) SHA1(ec276984d91b5759a5e2b6815d1db2abc37b99f8) )
994   ROM_LOAD( "bh.8",       0x008000, 0x08000, CRC(174ddba7) SHA1(7b19087cd2ccc409878aefe7fa08bb2e9953d352) )
995
996   ROM_REGION( 0x300000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
997   ROM_LOAD( "bh.c1",      0x000000, 0x80000, CRC(1fb8f0ae) SHA1(d63c7376aa5f01bc009176b23324e720bada4286) )
998   ROM_LOAD( "bh.c3",      0x080000, 0x80000, CRC(fd8bc407) SHA1(88d750293808bf6ea23864b22070314b14fbee3c) )
999   ROM_LOAD( "bh.c5",      0x100000, 0x80000, CRC(1d30acc3) SHA1(e5ca39853779475b83fe37304e7bed2c293bd587) )
1000   ROM_LOAD( "bh.c2",      0x180000, 0x80000, CRC(7c803767) SHA1(992516fbb28d00feabbed5769fa3a5748199a7d8) )
1001   ROM_LOAD( "bh.c4",      0x200000, 0x80000, CRC(eede7c43) SHA1(7645acf0beb4fff9ec92205dcf34124360cd52f6) )
1002   ROM_LOAD( "bh.c6",      0x280000, 0x80000, CRC(9f785cd9) SHA1(e5c7797ae7a3139e1814b068c5ecfe5c6bf30d0f) )
1003
1004   ROM_REGION( 0x20000, REGION_SOUND1, 0 )   /* UPD7759 samples */
1005   ROM_LOAD( "bh.v1",      0x000000, 0x20000, CRC(07a6114b) SHA1(224df4616b77a56f33974d3b1793473d48ad52ca) )
1006
1007   ROM_REGION16_BE( 0x40000, REGION_USER1, 0 ) /* Extra code bank */
1008   ROM_LOAD16_BYTE( "bhw.1", 0x000000, 0x20000, CRC(62b60066) SHA1(f7e7985c8f5f8191c580e777e1b7ed29d944d23f) )
1009   ROM_LOAD16_BYTE( "bhw.4", 0x000001, 0x20000, CRC(16d8525c) SHA1(0098b0a7fcb23de2661bbec9a05254aa46579bb2) )
1010ROM_END
1011
1012726ROM_START( streetsm )
1013727   ROM_REGION( 0x40000, REGION_CPU1, 0 )
1014728   ROM_LOAD16_BYTE( "s2-1ver2.14h", 0x00000, 0x20000, CRC(655f4773) SHA1(5374a6cf0b895c5ff839b0f52402df4cc53241cf) )
r2956r2957
1021735   ROM_LOAD( "s2-9.25l",    0x000000, 0x08000, CRC(09b6ac67) SHA1(0b1ef51d9cd755eacc25b33360811cc86c32c0b7) )
1022736   ROM_LOAD( "s2-10.25m",   0x008000, 0x08000, CRC(89e4ee6f) SHA1(21797286836ad71d2497e3e6d4df1fbe545562ab) )
1023737
1024   ROM_REGION( 0x300000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
738   ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
1025739   ROM_LOAD( "stsmart.900", 0x000000, 0x80000, CRC(a8279a7e) SHA1(244bdacb29b00f71da93ed8ddddbcffcce110be8) )
1026740   ROM_LOAD( "stsmart.902", 0x080000, 0x80000, CRC(2f021aa1) SHA1(699d0b5ac79e34e4fc4cef70eb448f21f1c3e9e2) )
1027741   ROM_LOAD( "stsmart.904", 0x100000, 0x80000, CRC(167346f7) SHA1(fb4ea412622245db49ec15449ee4fa0d90922f06) )
1028   ROM_LOAD( "stsmart.901", 0x180000, 0x80000, CRC(c305af12) SHA1(18b5d448fe9608efcd2e5bb8faa24808d1489ec8) )
1029   ROM_LOAD( "stsmart.903", 0x200000, 0x80000, CRC(73c16d35) SHA1(40cf7a58926c649f89b08917afb35b08918d1a0f) )
1030   ROM_LOAD( "stsmart.905", 0x280000, 0x80000, CRC(a5beb4e2) SHA1(c26b7eee2ca32bd73fb7a09c6ef52c2ae1c7fc1c) )
742   // 180000-1fffff empty
743   ROM_LOAD( "stsmart.901", 0x200000, 0x80000, CRC(c305af12) SHA1(18b5d448fe9608efcd2e5bb8faa24808d1489ec8) )
744   ROM_LOAD( "stsmart.903", 0x280000, 0x80000, CRC(73c16d35) SHA1(40cf7a58926c649f89b08917afb35b08918d1a0f) )
745   ROM_LOAD( "stsmart.905", 0x300000, 0x80000, CRC(a5beb4e2) SHA1(c26b7eee2ca32bd73fb7a09c6ef52c2ae1c7fc1c) )
746   // 380000-3fffff empty
1031747
1032748   ROM_REGION( 0x20000, REGION_SOUND1, 0 )   /* UPD7759 samples */
1033749   ROM_LOAD( "s2-6.18d",    0x000000, 0x20000, CRC(47db1605) SHA1(ae00e633eb98567f04ff97e3d63e04e049d955ec) )
r2956r2957
1048764   ROM_LOAD( "s2-7.15l",    0x000000, 0x08000, CRC(22bedfe5) SHA1(64efb2281c32afe5a06f35cce939e6a53226c6ed) )
1049765   ROM_LOAD( "s2-8.15m",    0x008000, 0x08000, CRC(6a1c70ab) SHA1(019538ddcb713d0810b26b6aa65f6e4596931621) )
1050766
1051   ROM_REGION( 0x300000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
767   ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
1052768   ROM_LOAD( "stsmart.900", 0x000000, 0x80000, CRC(a8279a7e) SHA1(244bdacb29b00f71da93ed8ddddbcffcce110be8) )
1053769   ROM_LOAD( "stsmart.902", 0x080000, 0x80000, CRC(2f021aa1) SHA1(699d0b5ac79e34e4fc4cef70eb448f21f1c3e9e2) )
1054770   ROM_LOAD( "stsmart.904", 0x100000, 0x80000, CRC(167346f7) SHA1(fb4ea412622245db49ec15449ee4fa0d90922f06) )
1055   ROM_LOAD( "stsmart.901", 0x180000, 0x80000, CRC(c305af12) SHA1(18b5d448fe9608efcd2e5bb8faa24808d1489ec8) )
1056   ROM_LOAD( "stsmart.903", 0x200000, 0x80000, CRC(73c16d35) SHA1(40cf7a58926c649f89b08917afb35b08918d1a0f) )
1057   ROM_LOAD( "stsmart.905", 0x280000, 0x80000, CRC(a5beb4e2) SHA1(c26b7eee2ca32bd73fb7a09c6ef52c2ae1c7fc1c) )
771   // 180000-1fffff empty
772   ROM_LOAD( "stsmart.901", 0x200000, 0x80000, CRC(c305af12) SHA1(18b5d448fe9608efcd2e5bb8faa24808d1489ec8) )
773   ROM_LOAD( "stsmart.903", 0x280000, 0x80000, CRC(73c16d35) SHA1(40cf7a58926c649f89b08917afb35b08918d1a0f) )
774   ROM_LOAD( "stsmart.905", 0x300000, 0x80000, CRC(a5beb4e2) SHA1(c26b7eee2ca32bd73fb7a09c6ef52c2ae1c7fc1c) )
775   // 380000-3fffff empty
1058776
1059777   ROM_REGION( 0x20000, REGION_SOUND1, 0 )   /* UPD7759 samples */
1060778   ROM_LOAD( "s2-6.18d",    0x000000, 0x20000, CRC(47db1605) SHA1(ae00e633eb98567f04ff97e3d63e04e049d955ec) )
r2956r2957
1072790   ROM_LOAD( "s2-7.15l",    0x000000, 0x08000, CRC(22bedfe5) SHA1(64efb2281c32afe5a06f35cce939e6a53226c6ed) )
1073791   ROM_LOAD( "s2-8.15m",    0x008000, 0x08000, CRC(6a1c70ab) SHA1(019538ddcb713d0810b26b6aa65f6e4596931621) )
1074792
1075   ROM_REGION( 0x300000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
793   ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
1076794   ROM_LOAD( "stsmart.900", 0x000000, 0x80000, CRC(a8279a7e) SHA1(244bdacb29b00f71da93ed8ddddbcffcce110be8) )
1077795   ROM_LOAD( "stsmart.902", 0x080000, 0x80000, CRC(2f021aa1) SHA1(699d0b5ac79e34e4fc4cef70eb448f21f1c3e9e2) )
1078796   ROM_LOAD( "stsmart.904", 0x100000, 0x80000, CRC(167346f7) SHA1(fb4ea412622245db49ec15449ee4fa0d90922f06) )
1079   ROM_LOAD( "stsmart.901", 0x180000, 0x80000, CRC(c305af12) SHA1(18b5d448fe9608efcd2e5bb8faa24808d1489ec8) )
1080   ROM_LOAD( "stsmart.903", 0x200000, 0x80000, CRC(73c16d35) SHA1(40cf7a58926c649f89b08917afb35b08918d1a0f) )
1081   ROM_LOAD( "stsmart.905", 0x280000, 0x80000, CRC(a5beb4e2) SHA1(c26b7eee2ca32bd73fb7a09c6ef52c2ae1c7fc1c) )
797   // 180000-1fffff empty
798   ROM_LOAD( "stsmart.901", 0x200000, 0x80000, CRC(c305af12) SHA1(18b5d448fe9608efcd2e5bb8faa24808d1489ec8) )
799   ROM_LOAD( "stsmart.903", 0x280000, 0x80000, CRC(73c16d35) SHA1(40cf7a58926c649f89b08917afb35b08918d1a0f) )
800   ROM_LOAD( "stsmart.905", 0x300000, 0x80000, CRC(a5beb4e2) SHA1(c26b7eee2ca32bd73fb7a09c6ef52c2ae1c7fc1c) )
801   // 380000-3fffff empty
1082802
1083803   ROM_REGION( 0x20000, REGION_SOUND1, 0 )   /* UPD7759 samples */
1084804   ROM_LOAD( "s2-6.18d",    0x000000, 0x20000, CRC(47db1605) SHA1(ae00e633eb98567f04ff97e3d63e04e049d955ec) )
r2956r2957
1096816   ROM_LOAD( "s2-7.15l",    0x000000, 0x08000, CRC(22bedfe5) SHA1(64efb2281c32afe5a06f35cce939e6a53226c6ed) )
1097817   ROM_LOAD( "s2-8.15m",    0x008000, 0x08000, CRC(6a1c70ab) SHA1(019538ddcb713d0810b26b6aa65f6e4596931621) )
1098818
1099   ROM_REGION( 0x300000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
819   ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
1100820   ROM_LOAD( "stsmart.900", 0x000000, 0x80000, CRC(a8279a7e) SHA1(244bdacb29b00f71da93ed8ddddbcffcce110be8) )
1101821   ROM_LOAD( "stsmart.902", 0x080000, 0x80000, CRC(2f021aa1) SHA1(699d0b5ac79e34e4fc4cef70eb448f21f1c3e9e2) )
1102822   ROM_LOAD( "stsmart.904", 0x100000, 0x80000, CRC(167346f7) SHA1(fb4ea412622245db49ec15449ee4fa0d90922f06) )
1103   ROM_LOAD( "stsmart.901", 0x180000, 0x80000, CRC(c305af12) SHA1(18b5d448fe9608efcd2e5bb8faa24808d1489ec8) )
1104   ROM_LOAD( "stsmart.903", 0x200000, 0x80000, CRC(73c16d35) SHA1(40cf7a58926c649f89b08917afb35b08918d1a0f) )
1105   ROM_LOAD( "stsmart.905", 0x280000, 0x80000, CRC(a5beb4e2) SHA1(c26b7eee2ca32bd73fb7a09c6ef52c2ae1c7fc1c) )
823   // 180000-1fffff empty
824   ROM_LOAD( "stsmart.901", 0x200000, 0x80000, CRC(c305af12) SHA1(18b5d448fe9608efcd2e5bb8faa24808d1489ec8) )
825   ROM_LOAD( "stsmart.903", 0x280000, 0x80000, CRC(73c16d35) SHA1(40cf7a58926c649f89b08917afb35b08918d1a0f) )
826   ROM_LOAD( "stsmart.905", 0x300000, 0x80000, CRC(a5beb4e2) SHA1(c26b7eee2ca32bd73fb7a09c6ef52c2ae1c7fc1c) )
827   // 380000-3fffff empty
1106828
1107829   ROM_REGION( 0x20000, REGION_SOUND1, 0 )   /* UPD7759 samples */
1108830   ROM_LOAD( "s2-6.18d",    0x000000, 0x20000, CRC(47db1605) SHA1(ae00e633eb98567f04ff97e3d63e04e049d955ec) )
r2956r2957
1120842   ROM_LOAD( "ik3-7.bin",  0x000000, 0x08000, CRC(0b4804df) SHA1(66d16d245bfc404366164823faaea0bfec83e487) )
1121843   ROM_LOAD( "ik3-8.bin",  0x008000, 0x08000, CRC(10ab4e50) SHA1(dee8416eb720848cf6471e568dadc1cfc6c2e67f) )
1122844
1123   ROM_REGION( 0x280000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
1124   ROM_LOAD( "ik3-13.bin", 0x000000, 0x20000, CRC(9a56bd32) SHA1(9301b48f970b71a909fb44514b2e93c3f1516b38) )
1125   ROM_LOAD( "ik3-12.bin", 0x020000, 0x20000, CRC(0ce6a10a) SHA1(13a231aa0002b2c5a0d9404ba05a879e212d638e) )
1126   ROM_LOAD( "ik3-11.bin", 0x040000, 0x20000, CRC(e4e2be43) SHA1(959d2799708ddae909b017c0696694c46a52697e) )
1127   ROM_LOAD( "ik3-10.bin", 0x060000, 0x20000, CRC(ac222372) SHA1(8a17e37699d691b962a6d0256a18550cc73ddfef) )
1128   ROM_LOAD( "ik3-9.bin",  0x080000, 0x20000, CRC(c33971c2) SHA1(91f3eb301803f5a7027da1ff7dd2a28bc97e5125) )
1129   ROM_LOAD( "ik3-14.bin", 0x0a0000, 0x20000, CRC(453bea77) SHA1(f8f8d0c048fcf32ad99e1de622d9ab635bb86eae) )
1130   ROM_LOAD( "ik3-15.bin", 0x0c0000, 0x20000, CRC(781a81fc) SHA1(e08a6cf9c632d1002176afe618605bc06168e8aa) )
1131   ROM_LOAD( "ik3-16.bin", 0x0e0000, 0x20000, CRC(80ba400b) SHA1(2cc3e53c45f239516a60c461ad9cfa5955164262) )
1132   ROM_LOAD( "ik3-17.bin", 0x100000, 0x20000, CRC(0cc3ce4a) SHA1(7b34435d0bbb089055a183b821ab255170db6bec) )
1133   ROM_LOAD( "ik3-18.bin", 0x120000, 0x20000, CRC(ba106245) SHA1(ac609ec3046c21fe6058f91dd4528c5c6448dc15) )
1134   ROM_LOAD( "ik3-23.bin", 0x140000, 0x20000, CRC(d0fd5c77) SHA1(c171c64ad252f0ba5b0bbdf37808102fca37b488) )
1135   ROM_LOAD( "ik3-22.bin", 0x160000, 0x20000, CRC(4878d883) SHA1(8cdb541bad00e707fb65399d637b7cc9288ada77) )
1136   ROM_LOAD( "ik3-21.bin", 0x180000, 0x20000, CRC(50d0fbf0) SHA1(9ff5fbea8d35d0f9a38ddd7eb093edcd91d9f874) )
1137   ROM_LOAD( "ik3-20.bin", 0x1a0000, 0x20000, CRC(9a851efc) SHA1(bc7be338ee4da7fbfe6fe44a9c7889817416bc44) )
1138   ROM_LOAD( "ik3-19.bin", 0x1c0000, 0x20000, CRC(4ebdba89) SHA1(f3ecfef4c9d2aba58dc3e6aa3cf5813d68686909) )
1139   ROM_LOAD( "ik3-24.bin", 0x1e0000, 0x20000, CRC(e9b26d68) SHA1(067d582d33157ed4b7980bd87f2f260ab74c347b) )
1140   ROM_LOAD( "ik3-25.bin", 0x200000, 0x20000, CRC(073b03f1) SHA1(b8053139799fa06c7324cee928154c89d4425ab1) )
1141   ROM_LOAD( "ik3-26.bin", 0x220000, 0x20000, CRC(9c613561) SHA1(fc7c9a642b18faa94e6a2ba53f35a4d756a25da3) )
1142   ROM_LOAD( "ik3-27.bin", 0x240000, 0x20000, CRC(16dd227e) SHA1(db3b1718dea65bc9a1a736aa62aa2be389313baf) )
1143   ROM_LOAD( "ik3-28.bin", 0x260000, 0x20000, CRC(711715ae) SHA1(90978c86884ca3d23c138d95b654e2fb3afc6f9a) )
845   ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
846   ROM_LOAD16_BYTE( "ik3-23.bin", 0x000000, 0x20000, CRC(d0fd5c77) SHA1(c171c64ad252f0ba5b0bbdf37808102fca37b488) )
847   ROM_LOAD16_BYTE( "ik3-13.bin", 0x000001, 0x20000, CRC(9a56bd32) SHA1(9301b48f970b71a909fb44514b2e93c3f1516b38) )
848   ROM_LOAD16_BYTE( "ik3-22.bin", 0x040000, 0x20000, CRC(4878d883) SHA1(8cdb541bad00e707fb65399d637b7cc9288ada77) )
849   ROM_LOAD16_BYTE( "ik3-12.bin", 0x040001, 0x20000, CRC(0ce6a10a) SHA1(13a231aa0002b2c5a0d9404ba05a879e212d638e) )
850   ROM_LOAD16_BYTE( "ik3-21.bin", 0x080000, 0x20000, CRC(50d0fbf0) SHA1(9ff5fbea8d35d0f9a38ddd7eb093edcd91d9f874) )
851   ROM_LOAD16_BYTE( "ik3-11.bin", 0x080001, 0x20000, CRC(e4e2be43) SHA1(959d2799708ddae909b017c0696694c46a52697e) )
852   ROM_LOAD16_BYTE( "ik3-20.bin", 0x0c0000, 0x20000, CRC(9a851efc) SHA1(bc7be338ee4da7fbfe6fe44a9c7889817416bc44) )
853   ROM_LOAD16_BYTE( "ik3-10.bin", 0x0c0001, 0x20000, CRC(ac222372) SHA1(8a17e37699d691b962a6d0256a18550cc73ddfef) )
854   ROM_LOAD16_BYTE( "ik3-19.bin", 0x100000, 0x20000, CRC(4ebdba89) SHA1(f3ecfef4c9d2aba58dc3e6aa3cf5813d68686909) )
855   ROM_LOAD16_BYTE( "ik3-9.bin",  0x100001, 0x20000, CRC(c33971c2) SHA1(91f3eb301803f5a7027da1ff7dd2a28bc97e5125) )
856   // 140000-1fffff empty
857   ROM_LOAD16_BYTE( "ik3-14.bin", 0x200000, 0x20000, CRC(453bea77) SHA1(f8f8d0c048fcf32ad99e1de622d9ab635bb86eae) )
858   ROM_LOAD16_BYTE( "ik3-24.bin", 0x200001, 0x20000, CRC(e9b26d68) SHA1(067d582d33157ed4b7980bd87f2f260ab74c347b) )
859   ROM_LOAD16_BYTE( "ik3-15.bin", 0x240000, 0x20000, CRC(781a81fc) SHA1(e08a6cf9c632d1002176afe618605bc06168e8aa) )
860   ROM_LOAD16_BYTE( "ik3-25.bin", 0x240001, 0x20000, CRC(073b03f1) SHA1(b8053139799fa06c7324cee928154c89d4425ab1) )
861   ROM_LOAD16_BYTE( "ik3-16.bin", 0x280000, 0x20000, CRC(80ba400b) SHA1(2cc3e53c45f239516a60c461ad9cfa5955164262) )
862   ROM_LOAD16_BYTE( "ik3-26.bin", 0x280001, 0x20000, CRC(9c613561) SHA1(fc7c9a642b18faa94e6a2ba53f35a4d756a25da3) )
863   ROM_LOAD16_BYTE( "ik3-17.bin", 0x2c0000, 0x20000, CRC(0cc3ce4a) SHA1(7b34435d0bbb089055a183b821ab255170db6bec) )
864   ROM_LOAD16_BYTE( "ik3-27.bin", 0x2c0001, 0x20000, CRC(16dd227e) SHA1(db3b1718dea65bc9a1a736aa62aa2be389313baf) )
865   ROM_LOAD16_BYTE( "ik3-18.bin", 0x300000, 0x20000, CRC(ba106245) SHA1(ac609ec3046c21fe6058f91dd4528c5c6448dc15) )
866   ROM_LOAD16_BYTE( "ik3-28.bin", 0x300001, 0x20000, CRC(711715ae) SHA1(90978c86884ca3d23c138d95b654e2fb3afc6f9a) )
867   // 340000-3fffff empty
1144868
1145869   ROM_REGION( 0x20000, REGION_SOUND1, 0 )   /* UPD7759 samples */
1146870   ROM_LOAD( "ik3-6.bin",  0x000000, 0x20000, CRC(59d256a4) SHA1(1e7b33329f761c695bc9a817bbc0c5e13386d073) )
r2956r2957
1162886   ROM_LOAD( "ik3-7.bin",  0x000000, 0x08000, CRC(0b4804df) SHA1(66d16d245bfc404366164823faaea0bfec83e487) )
1163887   ROM_LOAD( "ik3-8.bin",  0x008000, 0x08000, CRC(10ab4e50) SHA1(dee8416eb720848cf6471e568dadc1cfc6c2e67f) )
1164888
1165   ROM_REGION( 0x280000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
1166   ROM_LOAD( "ik3-13.bin", 0x000000, 0x20000, CRC(9a56bd32) SHA1(9301b48f970b71a909fb44514b2e93c3f1516b38) )
1167   ROM_LOAD( "ik3-12.bin", 0x020000, 0x20000, CRC(0ce6a10a) SHA1(13a231aa0002b2c5a0d9404ba05a879e212d638e) )
1168   ROM_LOAD( "ik3-11.bin", 0x040000, 0x20000, CRC(e4e2be43) SHA1(959d2799708ddae909b017c0696694c46a52697e) )
1169   ROM_LOAD( "ik3-10.bin", 0x060000, 0x20000, CRC(ac222372) SHA1(8a17e37699d691b962a6d0256a18550cc73ddfef) )
1170   ROM_LOAD( "ik3-9.bin",  0x080000, 0x20000, CRC(c33971c2) SHA1(91f3eb301803f5a7027da1ff7dd2a28bc97e5125) )
1171   ROM_LOAD( "ik3-14.bin", 0x0a0000, 0x20000, CRC(453bea77) SHA1(f8f8d0c048fcf32ad99e1de622d9ab635bb86eae) )
1172   ROM_LOAD( "ik3-15.bin", 0x0c0000, 0x20000, CRC(781a81fc) SHA1(e08a6cf9c632d1002176afe618605bc06168e8aa) )
1173   ROM_LOAD( "ik3-16.bin", 0x0e0000, 0x20000, CRC(80ba400b) SHA1(2cc3e53c45f239516a60c461ad9cfa5955164262) )
1174   ROM_LOAD( "ik3-17.bin", 0x100000, 0x20000, CRC(0cc3ce4a) SHA1(7b34435d0bbb089055a183b821ab255170db6bec) )
1175   ROM_LOAD( "ik3-18.bin", 0x120000, 0x20000, CRC(ba106245) SHA1(ac609ec3046c21fe6058f91dd4528c5c6448dc15) )
1176   ROM_LOAD( "ik3-23.bin", 0x140000, 0x20000, CRC(d0fd5c77) SHA1(c171c64ad252f0ba5b0bbdf37808102fca37b488) )
1177   ROM_LOAD( "ik3-22.bin", 0x160000, 0x20000, CRC(4878d883) SHA1(8cdb541bad00e707fb65399d637b7cc9288ada77) )
1178   ROM_LOAD( "ik3-21.bin", 0x180000, 0x20000, CRC(50d0fbf0) SHA1(9ff5fbea8d35d0f9a38ddd7eb093edcd91d9f874) )
1179   ROM_LOAD( "ik3-20.bin", 0x1a0000, 0x20000, CRC(9a851efc) SHA1(bc7be338ee4da7fbfe6fe44a9c7889817416bc44) )
1180   ROM_LOAD( "ik3-19.bin", 0x1c0000, 0x20000, CRC(4ebdba89) SHA1(f3ecfef4c9d2aba58dc3e6aa3cf5813d68686909) )
1181   ROM_LOAD( "ik3-24.bin", 0x1e0000, 0x20000, CRC(e9b26d68) SHA1(067d582d33157ed4b7980bd87f2f260ab74c347b) )
1182   ROM_LOAD( "ik3-25.bin", 0x200000, 0x20000, CRC(073b03f1) SHA1(b8053139799fa06c7324cee928154c89d4425ab1) )
1183   ROM_LOAD( "ik3-26.bin", 0x220000, 0x20000, CRC(9c613561) SHA1(fc7c9a642b18faa94e6a2ba53f35a4d756a25da3) )
1184   ROM_LOAD( "ik3-27.bin", 0x240000, 0x20000, CRC(16dd227e) SHA1(db3b1718dea65bc9a1a736aa62aa2be389313baf) )
1185   ROM_LOAD( "ik3-28.bin", 0x260000, 0x20000, CRC(711715ae) SHA1(90978c86884ca3d23c138d95b654e2fb3afc6f9a) )
889   ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
890   ROM_LOAD16_BYTE( "ik3-23.bin", 0x000000, 0x20000, CRC(d0fd5c77) SHA1(c171c64ad252f0ba5b0bbdf37808102fca37b488) )
891   ROM_LOAD16_BYTE( "ik3-13.bin", 0x000001, 0x20000, CRC(9a56bd32) SHA1(9301b48f970b71a909fb44514b2e93c3f1516b38) )
892   ROM_LOAD16_BYTE( "ik3-22.bin", 0x040000, 0x20000, CRC(4878d883) SHA1(8cdb541bad00e707fb65399d637b7cc9288ada77) )
893   ROM_LOAD16_BYTE( "ik3-12.bin", 0x040001, 0x20000, CRC(0ce6a10a) SHA1(13a231aa0002b2c5a0d9404ba05a879e212d638e) )
894   ROM_LOAD16_BYTE( "ik3-21.bin", 0x080000, 0x20000, CRC(50d0fbf0) SHA1(9ff5fbea8d35d0f9a38ddd7eb093edcd91d9f874) )
895   ROM_LOAD16_BYTE( "ik3-11.bin", 0x080001, 0x20000, CRC(e4e2be43) SHA1(959d2799708ddae909b017c0696694c46a52697e) )
896   ROM_LOAD16_BYTE( "ik3-20.bin", 0x0c0000, 0x20000, CRC(9a851efc) SHA1(bc7be338ee4da7fbfe6fe44a9c7889817416bc44) )
897   ROM_LOAD16_BYTE( "ik3-10.bin", 0x0c0001, 0x20000, CRC(ac222372) SHA1(8a17e37699d691b962a6d0256a18550cc73ddfef) )
898   ROM_LOAD16_BYTE( "ik3-19.bin", 0x100000, 0x20000, CRC(4ebdba89) SHA1(f3ecfef4c9d2aba58dc3e6aa3cf5813d68686909) )
899   ROM_LOAD16_BYTE( "ik3-9.bin",  0x100001, 0x20000, CRC(c33971c2) SHA1(91f3eb301803f5a7027da1ff7dd2a28bc97e5125) )
900   // 140000-1fffff empty
901   ROM_LOAD16_BYTE( "ik3-14.bin", 0x200000, 0x20000, CRC(453bea77) SHA1(f8f8d0c048fcf32ad99e1de622d9ab635bb86eae) )
902   ROM_LOAD16_BYTE( "ik3-24.bin", 0x200001, 0x20000, CRC(e9b26d68) SHA1(067d582d33157ed4b7980bd87f2f260ab74c347b) )
903   ROM_LOAD16_BYTE( "ik3-15.bin", 0x240000, 0x20000, CRC(781a81fc) SHA1(e08a6cf9c632d1002176afe618605bc06168e8aa) )
904   ROM_LOAD16_BYTE( "ik3-25.bin", 0x240001, 0x20000, CRC(073b03f1) SHA1(b8053139799fa06c7324cee928154c89d4425ab1) )
905   ROM_LOAD16_BYTE( "ik3-16.bin", 0x280000, 0x20000, CRC(80ba400b) SHA1(2cc3e53c45f239516a60c461ad9cfa5955164262) )
906   ROM_LOAD16_BYTE( "ik3-26.bin", 0x280001, 0x20000, CRC(9c613561) SHA1(fc7c9a642b18faa94e6a2ba53f35a4d756a25da3) )
907   ROM_LOAD16_BYTE( "ik3-17.bin", 0x2c0000, 0x20000, CRC(0cc3ce4a) SHA1(7b34435d0bbb089055a183b821ab255170db6bec) )
908   ROM_LOAD16_BYTE( "ik3-27.bin", 0x2c0001, 0x20000, CRC(16dd227e) SHA1(db3b1718dea65bc9a1a736aa62aa2be389313baf) )
909   ROM_LOAD16_BYTE( "ik3-18.bin", 0x300000, 0x20000, CRC(ba106245) SHA1(ac609ec3046c21fe6058f91dd4528c5c6448dc15) )
910   ROM_LOAD16_BYTE( "ik3-28.bin", 0x300001, 0x20000, CRC(711715ae) SHA1(90978c86884ca3d23c138d95b654e2fb3afc6f9a) )
911   // 340000-3fffff empty
1186912
1187913   ROM_REGION( 0x20000, REGION_SOUND1, 0 )   /* UPD7759 samples */
1188914   ROM_LOAD( "ik3-6.bin",  0x000000, 0x20000, CRC(59d256a4) SHA1(1e7b33329f761c695bc9a817bbc0c5e13386d073) )
r2956r2957
1192918   ROM_LOAD16_BYTE( "ik3-4.c12",  0x000001, 0x10000, CRC(a43af6b5) SHA1(1ad3acadbadd21642932028ecd7c282f7fd02856) )
1193919ROM_END
1194920
921ROM_START( searchar )
922   ROM_REGION( 0x40000, REGION_CPU1, 0 )
923   ROM_LOAD16_BYTE( "bhw.2", 0x000000, 0x20000, CRC(e1430138) SHA1(eddc192524a13b2c09bd2bddcd5f8e8b771ceb21) )
924   ROM_LOAD16_BYTE( "bhw.3", 0x000001, 0x20000, CRC(ee1f9374) SHA1(fd41c74fd69d65713d8e1a9b8078328381119379) )
925
926   ROM_REGION( 0x10000, REGION_CPU2, 0 )   /* Sound CPU */
927   ROM_LOAD( "bh.5",       0x000000, 0x10000, CRC(53e2fa76) SHA1(cf25b1def82545a1fd013822ab3cf02483074623) )
928
929   ROM_REGION( 0x010000, REGION_GFX1, ROMREGION_DISPOSE )   /* characters */
930   ROM_LOAD( "bh.7",       0x000000, 0x08000, CRC(b0f1b049) SHA1(ec276984d91b5759a5e2b6815d1db2abc37b99f8) )
931   ROM_LOAD( "bh.8",       0x008000, 0x08000, CRC(174ddba7) SHA1(7b19087cd2ccc409878aefe7fa08bb2e9953d352) )
932
933   ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
934   ROM_LOAD( "bh.c1",      0x000000, 0x80000, CRC(1fb8f0ae) SHA1(d63c7376aa5f01bc009176b23324e720bada4286) )
935   ROM_LOAD( "bh.c3",      0x080000, 0x80000, CRC(fd8bc407) SHA1(88d750293808bf6ea23864b22070314b14fbee3c) )
936   ROM_LOAD( "bh.c5",      0x100000, 0x80000, CRC(1d30acc3) SHA1(e5ca39853779475b83fe37304e7bed2c293bd587) )
937   // 180000-1fffff empty
938   ROM_LOAD( "bh.c2",      0x200000, 0x80000, CRC(7c803767) SHA1(992516fbb28d00feabbed5769fa3a5748199a7d8) )
939   ROM_LOAD( "bh.c4",      0x280000, 0x80000, CRC(eede7c43) SHA1(7645acf0beb4fff9ec92205dcf34124360cd52f6) )
940   ROM_LOAD( "bh.c6",      0x300000, 0x80000, CRC(9f785cd9) SHA1(e5c7797ae7a3139e1814b068c5ecfe5c6bf30d0f) )
941   // 380000-3fffff empty
942
943   ROM_REGION( 0x20000, REGION_SOUND1, 0 )   /* UPD7759 samples */
944   ROM_LOAD( "bh.v1",      0x000000, 0x20000, CRC(07a6114b) SHA1(224df4616b77a56f33974d3b1793473d48ad52ca) )
945
946   ROM_REGION16_BE( 0x40000, REGION_USER1, 0 ) /* Extra code bank */
947   ROM_LOAD16_BYTE( "bhw.1", 0x000000, 0x20000, CRC(62b60066) SHA1(f7e7985c8f5f8191c580e777e1b7ed29d944d23f) )
948   ROM_LOAD16_BYTE( "bhw.4", 0x000001, 0x20000, CRC(16d8525c) SHA1(0098b0a7fcb23de2661bbec9a05254aa46579bb2) )
949ROM_END
950
951ROM_START( sercharu )
952   ROM_REGION( 0x40000, REGION_CPU1, 0 )
953   ROM_LOAD16_BYTE( "bh.2",  0x000000, 0x20000, CRC(c852e2e2) SHA1(c4b1b366f452122549046a3dec9b6b375bc273af) )
954   ROM_LOAD16_BYTE( "bh.3",  0x000001, 0x20000, CRC(bc04a4a1) SHA1(aa91583b987248a3e99813ab5e8ee03c02dac9b9) )
955
956   ROM_REGION( 0x10000, REGION_CPU2, 0 )   /* Sound CPU */
957   ROM_LOAD( "bh.5",       0x000000, 0x10000, CRC(53e2fa76) SHA1(cf25b1def82545a1fd013822ab3cf02483074623) )
958
959   ROM_REGION( 0x010000, REGION_GFX1, ROMREGION_DISPOSE )   /* characters */
960   ROM_LOAD( "bh.7",       0x000000, 0x08000, CRC(b0f1b049) SHA1(ec276984d91b5759a5e2b6815d1db2abc37b99f8) )
961   ROM_LOAD( "bh.8",       0x008000, 0x08000, CRC(174ddba7) SHA1(7b19087cd2ccc409878aefe7fa08bb2e9953d352) )
962
963   ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
964   ROM_LOAD( "bh.c1",      0x000000, 0x80000, CRC(1fb8f0ae) SHA1(d63c7376aa5f01bc009176b23324e720bada4286) )
965   ROM_LOAD( "bh.c3",      0x080000, 0x80000, CRC(fd8bc407) SHA1(88d750293808bf6ea23864b22070314b14fbee3c) )
966   ROM_LOAD( "bh.c5",      0x100000, 0x80000, CRC(1d30acc3) SHA1(e5ca39853779475b83fe37304e7bed2c293bd587) )
967   // 180000-1fffff empty
968   ROM_LOAD( "bh.c2",      0x200000, 0x80000, CRC(7c803767) SHA1(992516fbb28d00feabbed5769fa3a5748199a7d8) )
969   ROM_LOAD( "bh.c4",      0x280000, 0x80000, CRC(eede7c43) SHA1(7645acf0beb4fff9ec92205dcf34124360cd52f6) )
970   ROM_LOAD( "bh.c6",      0x300000, 0x80000, CRC(9f785cd9) SHA1(e5c7797ae7a3139e1814b068c5ecfe5c6bf30d0f) )
971   // 380000-3fffff empty
972
973   ROM_REGION( 0x20000, REGION_SOUND1, 0 )   /* UPD7759 samples */
974   ROM_LOAD( "bh.v1",      0x000000, 0x20000, CRC(07a6114b) SHA1(224df4616b77a56f33974d3b1793473d48ad52ca) )
975
976   ROM_REGION16_BE( 0x40000, REGION_USER1, 0 ) /* Extra code bank */
977   ROM_LOAD16_BYTE( "bh.1",  0x000000, 0x20000, CRC(ba9ca70b) SHA1(c46727473673554cbe4bbbc0288d66357f99a80e) )
978   ROM_LOAD16_BYTE( "bh.4",  0x000001, 0x20000, CRC(eabc5ddf) SHA1(08a2a8fcdf6a08a2694e00f4232a5bfbec98fd27) )
979ROM_END
980
981ROM_START( sercharj )
982   ROM_REGION( 0x40000, REGION_CPU1, 0 )
983   ROM_LOAD16_BYTE( "bh2ver3j.9c", 0x000000, 0x20000, CRC(7ef7b172) SHA1(85669ba72f59e4ff3a483bf611bf41c73f4e1930) )
984   ROM_LOAD16_BYTE( "bh3ver3j.10c", 0x000001, 0x20000, CRC(3fdea793) SHA1(49bafb53466afb7e4486a4894e4fd6fa08ea2eb2) )
985
986   ROM_REGION( 0x10000, REGION_CPU2, 0 )   /* Sound CPU */
987   ROM_LOAD( "bh.5",       0x000000, 0x10000, CRC(53e2fa76) SHA1(cf25b1def82545a1fd013822ab3cf02483074623) )
988
989   ROM_REGION( 0x010000, REGION_GFX1, ROMREGION_DISPOSE )   /* characters */
990   ROM_LOAD( "bh.7",       0x000000, 0x08000, CRC(b0f1b049) SHA1(ec276984d91b5759a5e2b6815d1db2abc37b99f8) )
991   ROM_LOAD( "bh.8",       0x008000, 0x08000, CRC(174ddba7) SHA1(7b19087cd2ccc409878aefe7fa08bb2e9953d352) )
992
993   ROM_REGION( 0x400000, REGION_GFX2, ROMREGION_DISPOSE )   /* sprites */
994   ROM_LOAD( "bh.c1",      0x000000, 0x80000, CRC(1fb8f0ae) SHA1(d63c7376aa5f01bc009176b23324e720bada4286) )
995   ROM_LOAD( "bh.c3",      0x080000, 0x80000, CRC(fd8bc407) SHA1(88d750293808bf6ea23864b22070314b14fbee3c) )
996   ROM_LOAD( "bh.c5",      0x100000, 0x80000, CRC(1d30acc3) SHA1(e5ca39853779475b83fe37304e7bed2c293bd587) )
997   // 180000-1fffff empty
998   ROM_LOAD( "bh.c2",      0x200000, 0x80000, CRC(7c803767) SHA1(992516fbb28d00feabbed5769fa3a5748199a7d8) )
999   ROM_LOAD( "bh.c4",      0x280000, 0x80000, CRC(eede7c43) SHA1(7645acf0beb4fff9ec92205dcf34124360cd52f6) )
1000   ROM_LOAD( "bh.c6",      0x300000, 0x80000, CRC(9f785cd9) SHA1(e5c7797ae7a3139e1814b068c5ecfe5c6bf30d0f) )
1001   // 380000-3fffff empty
1002
1003   ROM_REGION( 0x20000, REGION_SOUND1, 0 )   /* UPD7759 samples */
1004   ROM_LOAD( "bh.v1",      0x000000, 0x20000, CRC(07a6114b) SHA1(224df4616b77a56f33974d3b1793473d48ad52ca) )
1005
1006   ROM_REGION16_BE( 0x40000, REGION_USER1, 0 ) /* Extra code bank */
1007   ROM_LOAD16_BYTE( "bhw.1", 0x000000, 0x20000, CRC(62b60066) SHA1(f7e7985c8f5f8191c580e777e1b7ed29d944d23f) )
1008   ROM_LOAD16_BYTE( "bhw.4", 0x000001, 0x20000, CRC(16d8525c) SHA1(0098b0a7fcb23de2661bbec9a05254aa46579bb2) )
1009ROM_END
1010
11951011/******************************************************************************/
11961012
11971013static DRIVER_INIT( searchar )
r2956r2957
12011017
12021018/******************************************************************************/
12031019
1204GAME( 1988, pow,      0,        pow,     pow,       0,        ROT0,  "SNK", "P.O.W. - Prisoners of War (US version 1)", 0 )
1205GAME( 1988, powj,     pow,      pow,     powj,      0,        ROT0,  "SNK", "Datsugoku - Prisoners of War (Japan)", 0 )
1206GAME( 1989, searchar, 0,        searchar, searchar, searchar, ROT90, "SNK", "SAR - Search And Rescue (World)", 0 )
1207GAME( 1989, sercharu, searchar, searchar, searchar, searchar, ROT90, "SNK", "SAR - Search And Rescue (US)", 0 )
1208GAME( 1989, sercharj, searchar, searchar, searchar, searchar, ROT90, "SNK", "SAR - Search And Rescue (Japan)", 0 )
1209GAME( 1989, streetsm, 0,        streetsm, streetsm, 0,        ROT0,  "SNK", "Street Smart (US version 2)", 0 )
1020GAME( 1988, pow,      0,        pow,      pow,      0,        ROT0,  "SNK", "P.O.W. - Prisoners of War (US version 1)", 0 )
1021GAME( 1988, powj,     pow,      pow,      powj,     0,        ROT0,  "SNK", "Datsugoku - Prisoners of War (Japan)", 0 )
1022GAME( 1989, streetsm, 0,        pow,      streetsm, 0,        ROT0,  "SNK", "Street Smart (US version 2)", 0 )
12101023GAME( 1989, streets1, streetsm, searchar, streetsm, 0,        ROT0,  "SNK", "Street Smart (US version 1)", 0 )
12111024GAME( 1989, streetsw, streetsm, searchar, streetsj, 0,        ROT0,  "SNK", "Street Smart (World version 1)", 0 )
12121025GAME( 1989, streetsj, streetsm, searchar, streetsj, 0,        ROT0,  "SNK", "Street Smart (Japan version 1)", 0 )
1213GAME( 1989, ikari3,   0,        ikari3,   ikari3,   searchar, ROT0,  "SNK", "Ikari III - The Rescue (Rotary Joystick)", 0 )
1214GAME( 1989, ikari3nr, ikari3,   ikari3,   ikari3,   searchar, ROT0,  "SNK", "Ikari III - The Rescue (8-Way Joystick)", 0 )
1215
1026GAME( 1989, ikari3,   0,        searchar, ikari3,   searchar, ROT0,  "SNK", "Ikari III - The Rescue (Rotary Joystick)", 0 )
1027GAME( 1989, ikari3nr, ikari3,   searchar, ikari3,   searchar, ROT0,  "SNK", "Ikari III - The Rescue (8-Way Joystick)", 0 )
1028GAME( 1989, searchar, 0,        searchar, searchar, searchar, ROT90, "SNK", "SAR - Search And Rescue (World)", 0 )
1029GAME( 1989, sercharu, searchar, searchar, searchar, searchar, ROT90, "SNK", "SAR - Search And Rescue (US)", 0 )
1030GAME( 1989, sercharj, searchar, searchar, searchar, searchar, ROT90, "SNK", "SAR - Search And Rescue (Japan)", 0 )
src/mame/drivers/thedeep.c
r2956r2957
154154   AM_RANGE(0xd000, 0xdfff) AM_READ(SMH_RAM            )   // RAM (MCU data copied here)
155155   AM_RANGE(0xe000, 0xe000) AM_READ(thedeep_protection_r   )   // From MCU
156156   AM_RANGE(0xe004, 0xe004) AM_READ(thedeep_e004_r      )   // ?
157   AM_RANGE(0xe008, 0xe008) AM_READ(input_port_0_r      )   // P1 (Inputs)
158   AM_RANGE(0xe009, 0xe009) AM_READ(input_port_1_r      )   // P2
159   AM_RANGE(0xe00a, 0xe00a) AM_READ(input_port_2_r      )   // DSW1
160   AM_RANGE(0xe00b, 0xe00b) AM_READ(input_port_3_r      )   // DSW2
157   AM_RANGE(0xe008, 0xe008) AM_READ_PORT("e008")         // P1 (Inputs)
158   AM_RANGE(0xe009, 0xe009) AM_READ_PORT("e009")         // P2
159   AM_RANGE(0xe00a, 0xe00a) AM_READ_PORT("e00a")         // DSW1
160   AM_RANGE(0xe00b, 0xe00b) AM_READ_PORT("e00b")         // DSW2
161161   AM_RANGE(0xe400, 0xe7ff) AM_READ(SMH_RAM            )   // Sprites
162162   AM_RANGE(0xe800, 0xefff) AM_READ(SMH_RAM            )   // Text Layer
163163   AM_RANGE(0xf000, 0xf7ff) AM_READ(SMH_RAM            )   // Background Layer
r2956r2957
209209***************************************************************************/
210210
211211static INPUT_PORTS_START( thedeep )
212   PORT_START_TAG("IN0")   //  e008
212   PORT_START_TAG("e008")
213213   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    )   // Up / down shown in service mode
214214   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  )
215215   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  )
r2956r2957
219219   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
220220   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_START1  )
221221
222   PORT_START_TAG("IN1")   // e009
222   PORT_START_TAG("e009")
223223   PORT_BIT(  0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
224224   PORT_BIT(  0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
225225   PORT_BIT(  0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
r2956r2957
229229   PORT_BIT(  0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
230230   PORT_BIT(  0x80, IP_ACTIVE_LOW, IPT_START2  )
231231
232   PORT_START_TAG("IN2")   // e00a
232   PORT_START_TAG("e00a")
233233   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
234234   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
235235   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
r2956r2957
253253   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
254254   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
255255
256   PORT_START_TAG("IN3")   // e00b
256   PORT_START_TAG("e00b")
257257   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
258258   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
259259   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )
r2956r2957
274274   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
275275   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
276276
277   PORT_START_TAG("IN4")   // Read by the mcu
277   PORT_START_TAG("MCU")   // Read by the mcu
278278   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
279279   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(1)
280280   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 ) PORT_IMPULSE(1)
r2956r2957
344344   {
345345      if (protection_command != 0x59)
346346      {
347         int coins = input_port_read_indexed(machine, 4);
347         int coins = input_port_read(machine, "MCU");
348348         if      (coins & 1)   protection_data = 1;
349349         else if   (coins & 2)   protection_data = 2;
350350         else if   (coins & 4)   protection_data = 3;
r2956r2957
501501
502502GAME( 1987, thedeep, 0,      thedeep, thedeep, 0, ROT270, "Woodplace Inc.", "The Deep (Japan)", 0 )
503503GAME( 1988, rundeep, thedeep,thedeep, thedeep, 0, ROT270, "Cream",     "Run Deep", 0 )
504
src/mame/drivers/stlforce.c
r2956r2957
8686
8787static READ16_HANDLER( stlforce_input_port_1_r )
8888{
89   return (input_port_read_indexed(machine, 1) & ~0x40) | (eeprom_read_bit() << 6);
89   return (input_port_read(machine, "SYSTEM") & ~0x40) | (eeprom_read_bit() << 6);
9090}
9191
9292static WRITE16_HANDLER( eeprom_w )
r2956r2957
119119   AM_RANGE(0x105000, 0x107fff) AM_RAM /* unknown / ram */
120120   AM_RANGE(0x108000, 0x108fff) AM_RAM AM_BASE(&stlforce_spriteram)
121121   AM_RANGE(0x109000, 0x11ffff) AM_RAM
122   AM_RANGE(0x400000, 0x400001) AM_READ(input_port_0_word_r)
122   AM_RANGE(0x400000, 0x400001) AM_READ_PORT("INPUT")
123123   AM_RANGE(0x400002, 0x400003) AM_READ(stlforce_input_port_1_r)
124124   AM_RANGE(0x400010, 0x400011) AM_WRITE(eeprom_w)
125125   AM_RANGE(0x400012, 0x400013) AM_WRITE(oki_bank_w)
r2956r2957
128128ADDRESS_MAP_END
129129
130130static INPUT_PORTS_START( stlforce )
131   PORT_START
131   PORT_START_TAG("INPUT")
132132   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
133133   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
134134   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
146146   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
147147   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
148148
149   PORT_START
149   PORT_START_TAG("SYSTEM")
150150   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
151151   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
152152   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNUSED )
src/mame/drivers/segae.c
r2956r2957
22732273   temp = 0;
22742274
22752275   if (port_fa_last == 0x08)  /* 0000 1000 */ /* Angle */
2276      temp = input_port_read_indexed(machine, 4);
2276      temp = input_port_read(machine, "IN2");
22772277
22782278   if (port_fa_last == 0x09)  /* 0000 1001 */ /* Accel */
2279      temp = input_port_read_indexed(machine, 5);
2279      temp = input_port_read(machine, "IN3");
22802280
22812281   return temp;
22822282}
r2956r2957
23122312
23132313   if (data & 1)
23142314   {
2315      int curr = input_port_read_indexed(machine, 4);
2315      int curr = input_port_read(machine, "IN2");
23162316      diff1 = ((curr - last1) & 0x0fff) | (curr & 0xf000);
23172317      last1 = curr;
23182318   }
23192319   if (data & 2)
23202320   {
2321      int curr = input_port_read_indexed(machine, 5) & 0x0fff;
2321      int curr = input_port_read(machine, "IN3") & 0x0fff;
23222322      diff2 = ((curr - last2) & 0x0fff) | (curr & 0xf000);
23232323      last2 = curr;
23242324   }
src/mame/drivers/legionna.c
r2956r2957
221221static INPUT_PORTS_START( legionna )
222222   SEIBU_COIN_INPUTS   /* coin inputs read through sound cpu */
223223
224   PORT_START
224   PORT_START_TAG("DSW1")
225225   PORT_DIPNAME( 0x001f, 0x001f, DEF_STR( Coinage ) )
226226   PORT_DIPSETTING(      0x0015, DEF_STR( 6C_1C ) )
227227   PORT_DIPSETTING(      0x0017, DEF_STR( 5C_1C ) )
r2956r2957
275275   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
276276   PORT_DIPSETTING(      0x8000, DEF_STR( On ) )
277277
278   PORT_START
278   PORT_START_TAG("PLAYERS12")
279279   PORT_BIT( 0x0001, IP_ACTIVE_LOW,  IPT_JOYSTICK_UP ) PORT_8WAY
280280   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_JOYSTICK_DOWN ) PORT_8WAY
281281   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_JOYSTICK_LEFT ) PORT_8WAY
r2956r2957
293293   PORT_BIT( 0x4000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
294294   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
295295
296   PORT_START
296   PORT_START_TAG("SYSTEM")
297297   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
298298   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
299299   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
309309static INPUT_PORTS_START( heatbrl )
310310   SEIBU_COIN_INPUTS   /* coin inputs read through sound cpu */
311311
312   PORT_START
312   PORT_START_TAG("DSW1")
313313   PORT_DIPNAME( 0x001f, 0x001f, DEF_STR( Coinage ) )
314314   PORT_DIPSETTING(      0x0015, DEF_STR( 6C_1C ) )
315315   PORT_DIPSETTING(      0x0017, DEF_STR( 5C_1C ) )
r2956r2957
361361   PORT_DIPSETTING(      0x0000, DEF_STR( Off ) )
362362   PORT_DIPSETTING(      0x8000, DEF_STR( On ) )
363363
364   PORT_START
364   PORT_START_TAG("PLAYERS12")
365365   PORT_BIT( 0x0001, IP_ACTIVE_LOW,  IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
366366   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
367367   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
379379   PORT_BIT( 0x4000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
380380   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
381381
382   PORT_START
382   PORT_START_TAG("SYSTEM")
383383   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
384384   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
385385   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
390390   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN4 )   // haven't found coin4, maybe it doesn't exist
391391//  PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
392392
393   PORT_START
393   PORT_START_TAG("PLAYERS34")
394394   PORT_BIT( 0x0001, IP_ACTIVE_LOW,  IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
395395   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
396396   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
r2956r2957
413413static INPUT_PORTS_START( godzilla )
414414   SEIBU_COIN_INPUTS   /* coin inputs read through sound cpu */
415415
416   PORT_START
416   PORT_START_TAG("DSW1")
417417   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
418418   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
419419   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
463463   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
464464   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
465465
466   PORT_START
466   PORT_START_TAG("PLAYERS12")
467467   PORT_BIT( 0x0001, IP_ACTIVE_LOW,  IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
468468   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
469469   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
481481   PORT_BIT( 0x4000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
482482   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
483483
484   PORT_START
484   PORT_START_TAG("SYSTEM")
485485   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
486486   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
487487   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
492492   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
493493   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
494494
495   PORT_START
495   PORT_START_TAG("PLAYERS34")
496496   PORT_BIT( 0x0001, IP_ACTIVE_LOW,  IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
497497   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
498498   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
r2956r2957
514514static INPUT_PORTS_START( sdgndmrb )
515515   SEIBU_COIN_INPUTS   /* coin inputs read through sound cpu */
516516
517   PORT_START
517   PORT_START_TAG("DSW1")
518518   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
519519   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
520520   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
564564   PORT_DIPSETTING(      0x8000, DEF_STR( Off ) )
565565   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
566566
567   PORT_START
567   PORT_START_TAG("PLAYERS12")
568568   PORT_BIT( 0x0001, IP_ACTIVE_LOW,  IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
569569   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
570570   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
582582   PORT_BIT( 0x4000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
583583   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
584584
585   PORT_START
585   PORT_START_TAG("SYSTEM")
586586   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
587587   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
588588   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
593593   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
594594   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
595595
596   PORT_START
596   PORT_START_TAG("PLAYERS34")
597597   PORT_BIT( 0x0001, IP_ACTIVE_LOW,  IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
598598   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
599599   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
r2956r2957
611611   PORT_BIT( 0x4000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
612612   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
613613
614   PORT_START
614   PORT_START_TAG("DSW2")
615615   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
616616   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
617617   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
665665static INPUT_PORTS_START( denjinmk )
666666   SEIBU_COIN_INPUTS   /* coin inputs read through sound cpu */
667667
668   PORT_START
668   PORT_START_TAG("DSW1")
669669   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
670670   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
671671   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
691691   PORT_DIPSETTING(      0x0080, DEF_STR( Off ) )
692692   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
693693
694
695694   PORT_DIPNAME( 0x0f00, 0x0f00, DEF_STR( Coin_A ) )
696695   PORT_DIPSETTING(      0x0200, DEF_STR( 4C_1C ) )
697696   PORT_DIPSETTING(      0x0500, DEF_STR( 3C_1C ) )
r2956r2957
727726   PORT_DIPSETTING(      0xe000, "e" )
728727   PORT_DIPSETTING(      0xf000, "f" )
729728
730   PORT_START
729   PORT_START_TAG("PLAYERS12")
731730   PORT_BIT( 0x0001, IP_ACTIVE_LOW,  IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
732731   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
733732   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
745744   PORT_BIT( 0x4000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
746745   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
747746
748   PORT_START
747   PORT_START_TAG("SYSTEM")
749748   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
750749   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
751750   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
756755   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
757756   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
758757
759   PORT_START
758   PORT_START_TAG("PLAYERS34")
760759   PORT_BIT( 0x0001, IP_ACTIVE_LOW,  IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
761760   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
762761   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
r2956r2957
774773   PORT_BIT( 0x4000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
775774   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_UNKNOWN )
776775
777   PORT_START
776   PORT_START_TAG("DSW2")
778777   PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
779778   PORT_DIPSETTING(      0x0001, DEF_STR( Off ) )
780779   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
r2956r2957
829828static INPUT_PORTS_START( cupsoc )
830829   SEIBU_COIN_INPUTS   /* coin inputs read through sound cpu */
831830
832   PORT_START
831   PORT_START_TAG("DSW1")
833832   PORT_DIPNAME( 0x0007, 0x0007, "Coin 1 (3)" )
834833   PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
835834   PORT_DIPSETTING(      0x0001, DEF_STR( 3C_1C ) )
r2956r2957
872871   PORT_DIPSETTING(      0xc000, "3:30" )
873872   PORT_DIPSETTING(      0x4000, "4:00" )
874873
875   PORT_START
874   PORT_START_TAG("PLAYERS12")
876875   PORT_BIT( 0x0001, IP_ACTIVE_LOW,  IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
877876   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
878877   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
890889   PORT_BIT( 0x4000, IP_ACTIVE_LOW,  IPT_BUTTON3 ) PORT_PLAYER(2)
891890   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_COIN2 )
892891
893   PORT_START
892   PORT_START_TAG("SYSTEM")
894893   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
895894   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
896895   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN ) //TEST
r2956r2957
900899   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START4 )
901900   PORT_BIT( 0xfc00, IP_ACTIVE_LOW, IPT_UNKNOWN )
902901
903   PORT_START
902   PORT_START_TAG("PLAYERS34")
904903   PORT_BIT( 0x0001, IP_ACTIVE_LOW,  IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
905904   PORT_BIT( 0x0002, IP_ACTIVE_LOW,  IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
906905   PORT_BIT( 0x0004, IP_ACTIVE_LOW,  IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
r2956r2957
918917   PORT_BIT( 0x4000, IP_ACTIVE_LOW,  IPT_BUTTON3 ) PORT_PLAYER(4)
919918   PORT_BIT( 0x8000, IP_ACTIVE_LOW,  IPT_SERVICE1 )
920919
921   PORT_START
920   PORT_START_TAG("DSW2")
922921   PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Difficulty ) )
923922   PORT_DIPSETTING(     0x0003, DEF_STR( Normal ) )
924923   PORT_DIPSETTING(      0x0002, DEF_STR( Easy ) )
src/mame/drivers/silkroad.c
r2956r2957
147147/* player inputs */
148148static READ32_HANDLER(io32_r)
149149{
150   return ((input_port_read_indexed(machine, 0) << 16) |  (input_port_read_indexed(machine, 1) << 0));
150   return ((input_port_read(machine, "PLAYERS") << 16) |  (input_port_read(machine, "SYSTEM") << 0));
151151}
152152
153153/* dipswitches */
154154static READ32_HANDLER(io32_1_r)
155155{
156   return input_port_read_indexed(machine, 2)<<16;
156   return input_port_read(machine, "DSW")<<16;
157157}
158158
159159/* sound I/O */
r2956r2957
217217   AM_RANGE(0x808000, 0x80bfff) AM_READ(SMH_RAM)
218218
219219   AM_RANGE(0xC00000, 0xC00003) AM_READ(io32_r)   // player inputs
220   AM_RANGE(0xC00004, 0xC00007) AM_READ(io32_1_r) // dip switches
220   AM_RANGE(0xC00004, 0xC00007) AM_READ(io32_1_r)   // dip switches
221221   AM_RANGE(0xC00024, 0xC00027) AM_READ(silk_6295_0_r)
222222   AM_RANGE(0xC0002C, 0xC0002f) AM_READ(silk_ym_r)
223223   AM_RANGE(0xC00030, 0xC00033) AM_READ(silk_6295_1_r)
r2956r2957
259259
260260
261261static INPUT_PORTS_START( silkroad )
262   PORT_START   /* Players inputs */
262   PORT_START_TAG("PLAYERS")   /* Players inputs */
263263   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_UNUSED )
264264   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
265265   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
r2956r2957
277277   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
278278   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
279279
280   PORT_START   /* System inputs */
280   PORT_START_TAG("SYSTEM")   /* System inputs */
281281   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
282282   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
283283   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
r2956r2957
295295   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
296296   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
297297
298   PORT_START   /* DSW */
298   PORT_START_TAG("DSW")   /* DSW */
299299   PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Lives ) )
300300   PORT_DIPSETTING(      0x0001, "1" )
301301   PORT_DIPSETTING(      0x0000, "2" )
r2956r2957
345345   PORT_DIPSETTING( 0xa000, DEF_STR(1C_3C))
346346   PORT_DIPSETTING( 0x8000, DEF_STR(1C_4C))
347347
348//  PORT_START  /* Misc inputs */
348//  PORT_START_TAG("MISC")  /* Misc inputs */
349349//  PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* VBLANK ? */
350350//  PORT_BIT( 0xff7f, IP_ACTIVE_LOW, IPT_UNUSED ) /* unknown / unused */
351351INPUT_PORTS_END
src/mame/drivers/toypop.c
r2956r2957
5555
5656***************************************************************************/
5757
58static READ8_HANDLER( in0_l )   { return input_port_read_indexed(machine, 0); }      // P1 joystick
59static READ8_HANDLER( in0_h )   { return input_port_read_indexed(machine, 0) >> 4; }   // P2 joystick
60static READ8_HANDLER( in1_l )   { return input_port_read_indexed(machine, 1); }      // fire and start buttons
61static READ8_HANDLER( in1_h )   { return input_port_read_indexed(machine, 1) >> 4; }   // coins
62static READ8_HANDLER( dipA_l )   { return input_port_read_indexed(machine, 2); }      // dips A
63static READ8_HANDLER( dipA_h )   { return input_port_read_indexed(machine, 2) >> 4; }   // dips A
64static READ8_HANDLER( dipB_l )   { return input_port_read_indexed(machine, 3); }      // dips B
65static READ8_HANDLER( dipB_h )   { return input_port_read_indexed(machine, 3) >> 4; }   // dips B
66static READ8_HANDLER( in2_l )   { return input_port_read_indexed(machine, 4); }      // P1 joystick left in liblrabl
67static READ8_HANDLER( in2_h )   { return input_port_read_indexed(machine, 4) >> 4; }   // P2 joystick left in liblrabl
68static READ8_HANDLER( in3 )      { return input_port_read_indexed(machine, 5); }      // test, cocktail, optional buttons
58static READ8_HANDLER( in0_l )   { return input_port_read(machine, "INPUT_RIGHT"); }         // P1 joystick
59static READ8_HANDLER( in0_h )   { return input_port_read(machine, "INPUT_RIGHT") >> 4; }   // P2 joystick
60static READ8_HANDLER( in1_l )   { return input_port_read(machine, "SYSTEM"); }            // fire and start buttons
61static READ8_HANDLER( in1_h )   { return input_port_read(machine, "SYSTEM") >> 4; }         // coins
62static READ8_HANDLER( dipA_l )   { return input_port_read(machine, "DSW1"); }            // dips A
63static READ8_HANDLER( dipA_h )   { return input_port_read(machine, "DSW1") >> 4; }         // dips A
64static READ8_HANDLER( dipB_l )   { return input_port_read(machine, "DSW2"); }            // dips B
65static READ8_HANDLER( dipB_h )   { return input_port_read(machine, "DSW2") >> 4; }         // dips B
66static READ8_HANDLER( in2_l )   { return input_port_read(machine, "INPUT_LEFT"); }         // P1 joystick left in liblrabl
67static READ8_HANDLER( in2_h )   { return input_port_read(machine, "INPUT_LEFT") >> 4; }      // P2 joystick left in liblrabl
68static READ8_HANDLER( in3 )      { return input_port_read(machine, "SERVICE"); }            // test, cocktail, optional buttons
6969static WRITE8_HANDLER( out_coin0 )
7070{
7171   coin_lockout_global_w(data & 4);
r2956r2957
358358
359359static INPUT_PORTS_START( liblrabl )
360360   /* The inputs are not memory mapped, they are handled by three I/O chips. */
361   PORT_START   /* 58XX #0 pins 22-29 */
361   PORT_START_TAG("INPUT_RIGHT")   /* 58XX #0 pins 22-29 */
362362   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_8WAY
363363   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_8WAY
364364   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_8WAY
r2956r2957
368368   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_8WAY PORT_COCKTAIL
369369   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_8WAY PORT_COCKTAIL
370370
371   PORT_START   /* 58XX #0 pins 30-33 and 38-41 */
371   PORT_START_TAG("SYSTEM")   /* 58XX #0 pins 30-33 and 38-41 */
372372   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
373373   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
374374   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
r2956r2957
378378   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
379379   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
380380
381   PORT_START   /* 56XX #1 pins 22-29 */
381   PORT_START_TAG("DSW1")   /* 56XX #1 pins 22-29 */
382382   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
383383   PORT_DIPSETTING(    0x02, "1" )
384384   PORT_DIPSETTING(    0x00, "2" )
r2956r2957
404404   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_3C ) )
405405   PORT_DIPSETTING(    0x20, DEF_STR( 1C_6C ) )
406406
407   PORT_START   /* 56XX #1 pins 30-33 and 38-41 */
407   PORT_START_TAG("DSW2")   /* 56XX #1 pins 30-33 and 38-41 */
408408   PORT_DIPNAME( 0x01, 0x01, "Freeze" )
409409   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
410410   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
428428   PORT_DIPSETTING(    0x80, "C" )
429429   PORT_DIPSETTING(    0x00, "D" )
430430
431   PORT_START   /* 56XX #2 pins 22-29 */
431   PORT_START_TAG("INPUT_LEFT")   /* 56XX #2 pins 22-29 */
432432   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_8WAY
433433   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_8WAY
434434   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_8WAY
r2956r2957
438438   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_8WAY PORT_COCKTAIL
439439   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_8WAY PORT_COCKTAIL
440440
441   PORT_START   /* 56XX #2 pins 30-33 */
441   PORT_START_TAG("SERVICE")   /* 56XX #2 pins 30-33 */
442442   PORT_BIT( 0x03, IP_ACTIVE_LOW, IPT_UNUSED )
443443   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet ) )
444444   PORT_DIPSETTING(    0x04, DEF_STR( Upright ) )
r2956r2957
448448
449449static INPUT_PORTS_START( toypop )
450450   /* The inputs are not memory mapped, they are handled by three I/O chips. */
451   PORT_START   /* 58XX #0 pins 22-29 */
451   PORT_START_TAG("INPUT_RIGHT")   /* 58XX #0 pins 22-29 */
452452   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
453453   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
454454   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
r2956r2957
458458   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2)
459459   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2)
460460
461   PORT_START   /* 58XX #0 pins 30-33 and 38-41 */
461   PORT_START_TAG("SYSTEM")   /* 58XX #0 pins 30-33 and 38-41 */
462462   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
463463   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
464464   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
r2956r2957
468468   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
469469   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
470470
471   PORT_START   /* 56XX #1 pins 22-29 */
471   PORT_START_TAG("DSW1")   /* 56XX #1 pins 22-29 */
472472   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
473473   PORT_DIPSETTING(    0x02, "1" )
474474   PORT_DIPSETTING(    0x01, "2" )
r2956r2957
489489   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
490490   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
491491
492   PORT_START   /* 56XX #1 pins 30-33 and 38-41 */
492   PORT_START_TAG("DSW2")   /* 56XX #1 pins 30-33 and 38-41 */
493493   PORT_DIPNAME( 0x01, 0x01, "Freeze" )
494494   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
495495   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
514514   PORT_DIPSETTING(    0x80, "Every 15000 points" )
515515   PORT_DIPSETTING(    0x00, "Every 20000 points" )
516516
517   PORT_START   /* 56XX #2 pins 22-29 */
517   PORT_START_TAG("INPUT_LEFT")   /* 56XX #2 pins 22-29 */
518518   PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED )
519519
520   PORT_START   /* 56XX #2 pins 30-33 */
520   PORT_START_TAG("SERVICE")   /* 56XX #2 pins 30-33 */
521521   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
522522   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
523523   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )   // would be Cabinet, but this game has no cocktail mode
src/mame/drivers/tumbleb.c
r2956r2957
401401    switch (offset<<1)
402402   {
403403      case 0: /* Player 1 & Player 2 joysticks & fire buttons */
404         return (input_port_read(machine, "IN0") | (input_port_read(machine, "IN1") << 8));
404         return (input_port_read(machine, "P1") | (input_port_read(machine, "P2") << 8));
405405      case 2: /* Dips */
406406         return (input_port_read(machine, "DSW1") | (input_port_read(machine, "DSW2") << 8));
407407      case 8: /* Credits */
408         return input_port_read(machine, "IN2");
408         return input_port_read(machine, "SYSTEM");
409409      case 10: /* ? */
410410      case 12:
411411           return 0;
r2956r2957
800800   AM_RANGE(0x140000, 0x1407ff) AM_READ(SMH_RAM)
801801   AM_RANGE(0x160000, 0x160fff) AM_READ(SMH_RAM)
802802
803   AM_RANGE(0x180002, 0x180003) AM_READ_PORT("IN0")
804   AM_RANGE(0x180004, 0x180005) AM_READ_PORT("COINS")
803   AM_RANGE(0x180002, 0x180003) AM_READ_PORT("PLAYERS")
804   AM_RANGE(0x180004, 0x180005) AM_READ_PORT("SYSTEM")
805805   AM_RANGE(0x180006, 0x180007) AM_READ_PORT("DSW")
806806
807807   AM_RANGE(0x1a0000, 0x1a7fff) AM_READ(SMH_RAM)
r2956r2957
843843   AM_RANGE(0xa22000, 0xa22fff) AM_RAM_WRITE(tumblepb_pf2_data_w) AM_BASE(&tumblepb_pf2_data)
844844   AM_RANGE(0xcf0000, 0xcf05ff) AM_RAM_WRITE(paletteram16_xBBBBBGGGGGRRRRR_word_w) AM_BASE(&paletteram16)
845845
846   AM_RANGE(0xe00000, 0xe00001) AM_READ_PORT("IN0") AM_WRITE(suprtrio_tilebank_w)
846   AM_RANGE(0xe00000, 0xe00001) AM_READ_PORT("PLAYERS") AM_WRITE(suprtrio_tilebank_w)
847847
848   AM_RANGE(0xe40000, 0xe40001) AM_READ_PORT("COINS")
848   AM_RANGE(0xe40000, 0xe40001) AM_READ_PORT("SYSTEM")
849849   AM_RANGE(0xe80002, 0xe80003) AM_READ_PORT("DSW")
850850   AM_RANGE(0xec0000, 0xec0001) AM_WRITE(semicom_soundcmd_w)
851851   AM_RANGE(0xf00000, 0xf07fff) AM_RAM
r2956r2957
10041004/******************************************************************************/
10051005
10061006static INPUT_PORTS_START( tumblepb )
1007   PORT_START_TAG("IN0")   /* Player 1 controls */
1007   PORT_START_TAG("P1")   /* Player 1 controls */
10081008   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
10091009   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
10101010   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
10141014   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* button 3 - unused */
10151015   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
10161016
1017   PORT_START_TAG("IN1")   /* Player 2 controls */
1017   PORT_START_TAG("P2")   /* Player 2 controls */
10181018   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
10191019   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
10201020   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
10241024   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* button 3 - unused */
10251025   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
10261026
1027   PORT_START_TAG("IN2")   /* Credits */
1027   PORT_START_TAG("SYSTEM")   /* Credits */
10281028   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
10291029   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
10301030   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
10941094INPUT_PORTS_END
10951095
10961096static INPUT_PORTS_START( metlsavr )
1097   PORT_START_TAG("IN0")   /* Player 1 controls */
1097   PORT_START_TAG("P1")   /* Player 1 controls */
10981098   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
10991099   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
11001100   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
11041104   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
11051105   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
11061106
1107   PORT_START_TAG("IN1")   /* Player 2 controls */
1107   PORT_START_TAG("P2")   /* Player 2 controls */
11081108   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
11091109   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
11101110   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
11141114   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
11151115   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
11161116
1117   PORT_START_TAG("IN2")   /* Credits */
1117   PORT_START_TAG("SYSTEM")   /* Credits */
11181118   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
11191119   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
11201120   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
11691169INPUT_PORTS_END
11701170
11711171static INPUT_PORTS_START( suprtrio )
1172   PORT_START_TAG("IN0")
1172   PORT_START_TAG("PLAYERS")
11731173   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
11741174   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
11751175   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
11871187   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
11881188   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 )
11891189
1190   PORT_START_TAG("COINS")
1190   PORT_START_TAG("SYSTEM")
11911191   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
11921192   PORT_BIT( 0xfffe, IP_ACTIVE_LOW, IPT_UNKNOWN )
11931193
r2956r2957
12171217INPUT_PORTS_END
12181218
12191219static INPUT_PORTS_START( fncywld )
1220   PORT_START_TAG("IN0")   /* Player 1 controls */
1220   PORT_START_TAG("P1")   /* Player 1 controls */
12211221   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
12221222   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
12231223   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
12271227   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
12281228   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
12291229
1230   PORT_START_TAG("IN1")   /* Player 2 controls */
1230   PORT_START_TAG("P2")   /* Player 2 controls */
12311231   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
12321232   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
12331233   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
12371237   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
12381238   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
12391239
1240   PORT_START_TAG("IN2")   /* Credits */
1240   PORT_START_TAG("SYSTEM")   /* Credits */
12411241   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
12421242   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
12431243   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
13081308INPUT_PORTS_END
13091309
13101310static INPUT_PORTS_START( htchctch )
1311   PORT_START_TAG("IN0")   /* Player 1 controls */
1311   PORT_START_TAG("P1")   /* Player 1 controls */
13121312   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
13131313   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
13141314   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
13181318   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* button 3 - unused */
13191319   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
13201320
1321   PORT_START_TAG("IN1")   /* Player 2 controls */
1321   PORT_START_TAG("P2")   /* Player 2 controls */
13221322   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
13231323   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
13241324   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
13281328   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* button 3 - unused */
13291329   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
13301330
1331   PORT_START_TAG("IN2")   /* Credits */
1331   PORT_START_TAG("SYSTEM")   /* Credits */
13321332   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
13331333   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
13341334   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
13731373INPUT_PORTS_END
13741374
13751375static INPUT_PORTS_START( cookbib )
1376   PORT_START_TAG("IN0")   /* Player 1 controls */
1376   PORT_START_TAG("P1")   /* Player 1 controls */
13771377   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
13781378   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
13791379   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
13831383   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* button 3 - unused */
13841384   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
13851385
1386   PORT_START_TAG("IN1")   /* Player 2 controls */
1386   PORT_START_TAG("P2")   /* Player 2 controls */
13871387   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
13881388   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
13891389   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
13931393   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* button 3 - unused */
13941394   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
13951395
1396   PORT_START_TAG("IN2")   /* Credits */
1396   PORT_START_TAG("SYSTEM")   /* Credits */
13971397   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
13981398   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
13991399   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
14381438INPUT_PORTS_END
14391439
14401440static INPUT_PORTS_START( chokchok )
1441   PORT_START_TAG("IN0")   /* Player 1 controls */
1441   PORT_START_TAG("P1")   /* Player 1 controls */
14421442   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
14431443   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
14441444   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
14481448   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* button 3 - unused */
14491449   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
14501450
1451   PORT_START_TAG("IN1")   /* Player 2 controls */
1451   PORT_START_TAG("P2")   /* Player 2 controls */
14521452   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
14531453   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
14541454   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
14581458   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* button 3 - unused */
14591459   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
14601460
1461   PORT_START_TAG("IN2")   /* Credits */
1461   PORT_START_TAG("SYSTEM")   /* Credits */
14621462   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
14631463   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
14641464   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
15161516INPUT_PORTS_END
15171517
15181518static INPUT_PORTS_START( wlstar )
1519   PORT_START_TAG("IN0")   /* Player 1 controls */
1519   PORT_START_TAG("P1")   /* Player 1 controls */
15201520   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
15211521   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
15221522   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
15261526   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
15271527   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
15281528
1529   PORT_START_TAG("IN1")   /* Player 2 controls */
1529   PORT_START_TAG("P2")   /* Player 2 controls */
15301530   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
15311531   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
15321532   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
15361536   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
15371537   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
15381538
1539   PORT_START_TAG("IN2")   /* Credits */
1539   PORT_START_TAG("SYSTEM")   /* Credits */
15401540   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
15411541   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
15421542   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
15891589INPUT_PORTS_END
15901590
15911591static INPUT_PORTS_START( wondl96 )
1592   PORT_START_TAG("IN0")   /* Player 1 controls */
1592   PORT_START_TAG("P1")   /* Player 1 controls */
15931593   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
15941594   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
15951595   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
15991599   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
16001600   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
16011601
1602   PORT_START_TAG("IN1")   /* Player 2 controls */
1602   PORT_START_TAG("P2")   /* Player 2 controls */
16031603   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
16041604   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
16051605   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
16091609   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
16101610   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
16111611
1612   PORT_START_TAG("IN2")   /* Credits */
1612   PORT_START_TAG("SYSTEM")   /* Credits */
16131613   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
16141614   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
16151615   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN )      // must be high to avoid endless loops
r2956r2957
16691669INPUT_PORTS_END
16701670
16711671static INPUT_PORTS_START( sdfight )
1672   PORT_START_TAG("IN0")   /* Player 1 controls */
1672   PORT_START_TAG("P1")   /* Player 1 controls */
16731673   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
16741674   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
16751675   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
16791679   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
16801680   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
16811681
1682   PORT_START_TAG("IN1")   /* Player 2 controls */
1682   PORT_START_TAG("P2")   /* Player 2 controls */
16831683   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
16841684   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
16851685   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
16891689   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
16901690   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
16911691
1692   PORT_START_TAG("IN2")   /* Credits */
1692   PORT_START_TAG("SYSTEM")   /* Credits */
16931693   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
16941694   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
16951695   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
17501750INPUT_PORTS_END
17511751
17521752static INPUT_PORTS_START( bcstory )
1753   PORT_START_TAG("IN0")   /* Player 1 controls */
1753   PORT_START_TAG("P1")   /* Player 1 controls */
17541754   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
17551755   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
17561756   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
17601760   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
17611761   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
17621762
1763   PORT_START_TAG("IN1")   /* Player 2 controls */
1763   PORT_START_TAG("P2")   /* Player 2 controls */
17641764   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
17651765   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
17661766   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
17701770   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
17711771   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
17721772
1773   PORT_START_TAG("IN2")   /* Credits */
1773   PORT_START_TAG("SYSTEM")   /* Credits */
17741774   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
17751775   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
17761776   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
18241824INPUT_PORTS_END
18251825
18261826static INPUT_PORTS_START( semibase )
1827   PORT_START_TAG("IN0")   /* Player 1 controls */
1827   PORT_START_TAG("P1")   /* Player 1 controls */
18281828   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
18291829   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
18301830   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
18341834   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
18351835   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
18361836
1837   PORT_START_TAG("IN1")   /* Player 2 controls */
1837   PORT_START_TAG("P2")   /* Player 2 controls */
18381838   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
18391839   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
18401840   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
18441844   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
18451845   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
18461846
1847   PORT_START_TAG("IN2")   /* Credits */
1847   PORT_START_TAG("SYSTEM")   /* Credits */
18481848   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
18491849   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
18501850   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )                                            // See notes
r2956r2957
18981898INPUT_PORTS_END
18991899
19001900static INPUT_PORTS_START( dquizgo )
1901   PORT_START_TAG("IN0")   /* Player 1 controls */
1901   PORT_START_TAG("P1")   /* Player 1 controls */
19021902   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
19031903   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
19041904   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
19081908   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
19091909   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
19101910
1911   PORT_START_TAG("IN1")   /* Player 2 controls */
1911   PORT_START_TAG("P2")   /* Player 2 controls */
19121912   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
19131913   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
19141914   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
19181918   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
19191919   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
19201920
1921   PORT_START_TAG("IN2")   /* Credits */
1921   PORT_START_TAG("SYSTEM")   /* Credits */
19221922   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
19231923   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
19241924   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
19691969INPUT_PORTS_END
19701970
19711971static INPUT_PORTS_START( jumppop )
1972   PORT_START_TAG("IN0")   /* Controls */
1972   PORT_START_TAG("PLAYERS")   /* Controls */
19731973   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
19741974   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
19751975   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
19871987   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
19881988   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
19891989
1990   PORT_START_TAG("COINS")   /* Coins / Start Buttons */
1990   PORT_START_TAG("SYSTEM")   /* Coins / Start Buttons */
19911991   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
19921992   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
19931993   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
r2956r2957
34783478   //mame_printf_debug("bcstory_io %06x\n",activecpu_get_pc());
34793479
34803480   if (activecpu_get_pc()==0x0560) return 0x1a0;
3481   else return input_port_read_indexed(machine, 2);
3481   else return input_port_read(machine, "SYSTEM");
34823482}
34833483
34843484static DRIVER_INIT ( bcstory )
src/mame/drivers/tugboat.c
r2956r2957
130130static READ8_HANDLER( tugboat_input_r )
131131{
132132   if (~ctrl & 0x80)
133      return input_port_read_indexed(machine, 0);
133      return input_port_read(machine, "IN0");
134134   else if (~ctrl & 0x40)
135      return input_port_read_indexed(machine, 1);
135      return input_port_read(machine, "IN1");
136136   else if (~ctrl & 0x20)
137      return input_port_read_indexed(machine, 2);
137      return input_port_read(machine, "IN2");
138138   else if (~ctrl & 0x10)
139      return input_port_read_indexed(machine, 3);
139      return input_port_read(machine, "IN3");
140140   else
141      return input_port_read_indexed(machine, 4);
141      return input_port_read(machine, "IN4");
142142}
143143
144144static READ8_HANDLER( tugboat_ctrl_r )
r2956r2957
202202
203203
204204static INPUT_PORTS_START( tugboat )
205   PORT_START
205   PORT_START_TAG("IN0")
206206   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
207207   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
208208   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
212212   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
213213   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
214214
215   PORT_START
215   PORT_START_TAG("IN1")
216216   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY
217217   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY
218218   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
r2956r2957
222222   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
223223   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
224224
225   PORT_START
225   PORT_START_TAG("IN2")
226226   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
227227   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
228228   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
232232   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
233233   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
234234
235   PORT_START
235   PORT_START_TAG("IN3")
236236   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1)
237237   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
238238   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
242242   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
243243   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
244244
245   PORT_START
245   PORT_START_TAG("IN4")
246246   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
247247   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
248248   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
254254   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
255255   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
256256
257   PORT_START
257   PORT_START_TAG("DSW")
258258   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
259259   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
260260   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
273273INPUT_PORTS_END
274274
275275static INPUT_PORTS_START( noahsark )
276   PORT_START
277   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
278   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
279   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
280   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
281   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
282   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
283   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
284   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
276   PORT_INCLUDE( tugboat )
285277
286   PORT_START
278   PORT_MODIFY("IN1")
287279   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
288280   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
289   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
290281   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
291282   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
292   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
293   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
294   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
295
296   PORT_START
297   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
298   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
299   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
300   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
301   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
302   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
303   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
304   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
305
306   PORT_START
307   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1)
308   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
309   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
310   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
311   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
312   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
313   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
314   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
315
316   PORT_START
317   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
318   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
319   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
320   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
321   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
322   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
323   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unknown ) )
324   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
325   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
326   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
327
328   PORT_START
329   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
330   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
331   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
332   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
333   PORT_DIPNAME( 0x30, 0x10, DEF_STR( Coinage ) )
334   PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
335   PORT_DIPSETTING(    0x10, DEF_STR( 1C_1C ) )
336   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
337   PORT_DIPSETTING(    0x30, DEF_STR( 1C_4C ) )
338   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Lives ) )
339   PORT_DIPSETTING(    0x00, "3" )
340   PORT_DIPSETTING(    0x40, "5" )
341   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) )
342   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
343   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
344283INPUT_PORTS_END
345284
346285
src/mame/drivers/taito_z.c
r2956r2957
771771***************************************************************************/
772772
773773#include "driver.h"
774#include "taitoipt.h"
774775#include "cpu/m68000/m68000.h"
775776#include "machine/eeprom.h"
776777#include "video/taitoic.h"
r2956r2957
10131014         break;
10141015
10151016      default:
1016         TC0220IOC_w( machine,offset,data );   /* might be a 510NIO ! */
1017         TC0220IOC_w(machine, offset, data);   /* might be a 510NIO ! */
10171018   }
10181019}
10191020
r2956r2957
10261027{
10271028   /* Bypass TC0220IOC controller for analog input */
10281029
1029   UINT8 port = TC0220IOC_port_r(machine,0);   /* read port number */
1030   UINT8 port = TC0220IOC_port_r(machine, 0);   /* read port number */
10301031   int steer = 0;
1031   int fake = input_port_read_indexed(machine,6);
1032   int fake = input_port_read(machine, "FAKE");
10321033
1033   if (!(fake &0x10))   /* Analogue steer (the real control method) */
1034   if (!(fake & 0x10))   /* Analogue steer (the real control method) */
10341035   {
10351036      /* center around zero and reduce span to 0xc0 */
1036      steer = ((input_port_read_indexed(machine,5) - 0x80) * 0xc0) / 0x100;
1037      steer = ((input_port_read(machine, "STEER") - 0x80) * 0xc0) / 0x100;
10371038
10381039   }
10391040   else   /* Digital steer */
10401041   {
1041      if (fake &0x4)
1042      if (fake & 0x04)
10421043      {
10431044         steer = 0x60;
10441045      }
1045      else if (fake &0x8)
1046      else if (fake & 0x08)
10461047      {
10471048         steer = 0xff9f;
10481049      }
r2956r2957
10511052   switch (port)
10521053   {
10531054      case 0x08:
1054         return steer &0xff;
1055         return steer & 0xff;
10551056
10561057      case 0x09:
10571058         return steer >> 8;
10581059
10591060      default:
1060         return TC0220IOC_portreg_r( machine,offset );
1061         return TC0220IOC_portreg_r(machine, offset);
10611062   }
10621063}
10631064
r2956r2957
10661067{
10671068   /* Bypass TC0220IOC controller for extra inputs */
10681069
1069   UINT8 port = TC0220IOC_port_r(machine,0);   /* read port number */
1070   UINT8 port = TC0220IOC_port_r(machine, 0);   /* read port number */
10701071   int steer = 0;
1071   int fake = input_port_read_indexed(machine,10);
1072   int fake = input_port_read(machine, "FAKE");
10721073
1073   if (!(fake &0x10))   /* Analogue steer (the real control method) */
1074   if (!(fake & 0x10))   /* Analogue steer (the real control method) */
10741075   {
10751076      /* center around zero */
1076      steer = input_port_read_indexed(machine,9) - 0x80;
1077      steer = input_port_read(machine, "STEER") - 0x80;
10771078   }
10781079   else   /* Digital steer */
10791080   {
1080      if (fake &0x4)
1081      if (fake & 0x04)
10811082      {
10821083         steer = 0xff80;
10831084      }
1084      else if (fake &0x8)
1085      else if (fake & 0x08)
10851086      {
10861087         steer = 0x7f;
10871088      }
r2956r2957
10901091   switch (port)
10911092   {
10921093      case 0x08:
1093         return input_port_read_indexed(machine,5);
1094         return input_port_read(machine, "UNK1");
10941095
10951096      case 0x09:
1096         return input_port_read_indexed(machine,6);
1097         return input_port_read(machine, "UNK2");
10971098
10981099      case 0x0a:
1099         return input_port_read_indexed(machine,7);
1100         return input_port_read(machine, "UNK3");
11001101
11011102      case 0x0b:
1102         return input_port_read_indexed(machine,8);
1103         return input_port_read(machine, "UNK4");
11031104
11041105      case 0x0c:
1105         return steer &0xff;
1106         return steer & 0xff;
11061107
11071108      case 0x0d:
11081109         return steer >> 8;
11091110
11101111      default:
1111         return TC0220IOC_portreg_r( machine, offset );
1112         return TC0220IOC_portreg_r(machine, offset);
11121113   }
11131114}
11141115
r2956r2957
11181119   switch (offset)
11191120   {
11201121      case 0x00:
1121         return input_port_read_indexed(machine,5);
1122         return input_port_read(machine, "STICKX");
11221123
11231124      case 0x01:
1124         return input_port_read_indexed(machine,6);
1125         return input_port_read(machine, "X_ADJUST");
11251126
11261127      case 0x02:
1127         return input_port_read_indexed(machine,7);
1128         return input_port_read(machine, "STICKY");
11281129
11291130      case 0x03:
1130         return input_port_read_indexed(machine,8);
1131         return input_port_read(machine, "Y_ADJUST");
11311132   }
11321133
1133logerror("CPU #0 PC %06x: warning - read unmapped stick offset %06x\n",activecpu_get_pc(),offset);
1134   logerror("CPU #0 PC %06x: warning - read unmapped stick offset %06x\n", activecpu_get_pc(), offset);
11341135
11351136   return 0xff;
11361137}
r2956r2957
11411142   switch (offset)
11421143   {
11431144      case 0x00:
1144         return input_port_read_indexed(machine,5);
1145         return input_port_read(machine, "STICKX");
11451146
11461147      case 0x01:
1147         return input_port_read_indexed(machine,6);
1148         return input_port_read(machine, "STICKY");
11481149
11491150      case 0x02:
1150         return input_port_read_indexed(machine,7);
1151         return input_port_read(machine, "X_ADJUST");
11511152
11521153      case 0x03:
1153         return input_port_read_indexed(machine,8);
1154         return input_port_read(machine, "Y_ADJUST");
11541155   }
11551156
1156logerror("CPU #0 PC %06x: warning - read unmapped stick offset %06x\n",activecpu_get_pc(),offset);
1157   logerror("CPU #0 PC %06x: warning - read unmapped stick offset %06x\n", activecpu_get_pc(), offset);
11571158
11581159   return 0xff;
11591160}
r2956r2957
11731174static READ16_HANDLER( sci_steer_input_r )
11741175{
11751176   int steer = 0;
1176   int fake = input_port_read_indexed(machine,6);
1177   int fake = input_port_read(machine, "FAKE");
11771178
1178   if (!(fake &0x10))   /* Analogue steer (the real control method) */
1179   if (!(fake & 0x10))   /* Analogue steer (the real control method) */
11791180   {
11801181      /* center around zero and reduce span to 0xc0 */
1181      steer = ((input_port_read_indexed(machine,5) - 0x80) * 0xc0) / 0x100;
1182      steer = ((input_port_read(machine, "STEER") - 0x80) * 0xc0) / 0x100;
11821183   }
11831184   else   /* Digital steer */
11841185   {
1185      if (fake &0x4)
1186      if (fake & 0x04)
11861187      {
11871188         steer = 0xffa0;
11881189      }
1189      else if (fake &0x8)
1190      else if (fake & 0x08)
11901191      {
11911192         steer = 0x5f;
11921193      }
r2956r2957
12011202         return (steer & 0xff00) >> 8;
12021203   }
12031204
1204logerror("CPU #0 PC %06x: warning - read unmapped steer input offset %06x\n",activecpu_get_pc(),offset);
1205   logerror("CPU #0 PC %06x: warning - read unmapped steer input offset %06x\n", activecpu_get_pc(), offset);
12051206
12061207   return 0xff;
12071208}
r2956r2957
12151216         return eeprom_r();
12161217
12171218      default:
1218         return TC0220IOC_r( machine, offset );   /* might be a 510NIO ! */
1219         return TC0220IOC_r(machine, offset);   /* might be a 510NIO ! */
12191220   }
12201221}
12211222
r2956r2957
12241225   switch (offset)
12251226   {
12261227      case 0x00:
1227         return input_port_read_indexed(machine,5);   /* P1X */
1228         return input_port_read(machine, "STICKX1");
12281229
12291230      case 0x01:
1230         return input_port_read_indexed(machine,6);   /* P1Y */
1231         return input_port_read(machine, "STICKY1");
12311232
12321233      case 0x02:
1233         return input_port_read_indexed(machine,7);   /* P2X */
1234         return input_port_read(machine, "STICKX2");
12341235
12351236      case 0x03:
1236         return input_port_read_indexed(machine,8);   /* P2Y */
1237         return input_port_read(machine, "STICKY2");
12371238   }
12381239
1239   return 0x0;
1240   return 0x00;
12401241}
12411242
12421243static WRITE16_HANDLER( spacegun_lightgun_w )
r2956r2957
12561257static READ16_HANDLER( dblaxle_steer_input_r )
12571258{
12581259   int steer = 0;
1259   int fake = input_port_read_indexed(machine,6);
1260   int fake = input_port_read(machine, "FAKE");
12601261
1261   if (!(fake &0x10))   /* Analogue steer (the real control method) */
1262   if (!(fake & 0x10))   /* Analogue steer (the real control method) */
12621263   {
12631264      /* center around zero and reduce span to 0x80 */
1264      steer = ((input_port_read_indexed(machine,5) - 0x80) * 0x80) / 0x100;
1265      steer = ((input_port_read(machine, "STEER") - 0x80) * 0x80) / 0x100;
12651266   }
12661267   else   /* Digital steer */
12671268   {
1268      if (fake &0x4)
1269      if (fake & 0x04)
12691270      {
12701271         steer = 0xffc0;
12711272      }
1272      else if (fake &0x8)
1273      else if (fake & 0x08)
12731274      {
12741275         steer = 0x3f;
12751276      }
r2956r2957
12811282         return steer >> 8;
12821283
12831284      case 0x05:
1284         return steer &0xff;
1285         return steer & 0xff;
12851286   }
12861287
1287logerror("CPU #0 PC %06x: warning - read unmapped steer input offset %02x\n",activecpu_get_pc(),offset);
1288   logerror("CPU #0 PC %06x: warning - read unmapped steer input offset %02x\n", activecpu_get_pc(), offset);
1289
12881290   return 0x00;
12891291}
12901292
r2956r2957
14051407static WRITE16_HANDLER( spacegun_pancontrol )
14061408{
14071409   if (ACCESSING_BITS_0_7)
1408      taitoz_pancontrol(machine,offset,data & 0xff);
1410      taitoz_pancontrol(machine, offset, data & 0xff);
14091411}
14101412
14111413
r2956r2957
21892191   PORT_DIPSETTING(    0xfe, "+7E" ) \
21902192   PORT_DIPSETTING(    0xff, "+7F" )
21912193
2192#define TAITO_Z_COINAGE_JAPAN_8 \
2193   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW A:5,6") \
2194   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) ) \
2195   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
2196   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) ) \
2197   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) ) \
2198   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW A:7,8") \
2199   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
2200   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) ) \
2201   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) ) \
2202   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
22032194
2204#define TAITO_Z_COINAGE_WORLD_8 \
2205   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW A:5,6") \
2206   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
2207   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) \
2208   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) ) \
2209   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
2210   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW A:7,8") \
2211   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) ) \
2212   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) ) \
2213   PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) ) \
2214   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
2215
2216#define TAITO_Z_COINAGE_US_8 \
2217   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW A:5,6") \
2218   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
2219   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) \
2220   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) ) \
2221   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
2222   PORT_DIPNAME( 0xc0, 0xc0, "Price to Continue" ) PORT_DIPLOCATION("SW A:7,8") \
2223   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) ) \
2224   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
2225   PORT_DIPSETTING(    0x80, DEF_STR( 1C_1C ) ) \
2226   PORT_DIPSETTING(    0xc0, "Same as Start" )
2227
2228#define TAITO_Z_DIFFICULTY_8 \
2229   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW B:1,2")\
2230   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) ) \
2231   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) ) \
2232   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) ) \
2233   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
2234
2235
22362195static INPUT_PORTS_START( contcirc )
2237   PORT_START_TAG("DSW1") /* DSW A */
2196   PORT_START_TAG("DSWA") /* DSW A */
22382197   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW A:1")
22392198   PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
22402199   PORT_DIPSETTING(    0x00, "Cockpit" )   // analogue accelerator pedal
r2956r2957
22452204   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW A:4")
22462205   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
22472206   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2248   TAITO_Z_COINAGE_WORLD_8
2207   TAITO_COINAGE_WORLD_LOC(SW A)
22492208
2250   PORT_START_TAG("DSW2") /* DSW B */
2209   PORT_START_TAG("DSWB") /* DSW B */
22512210   PORT_DIPNAME( 0x03, 0x03, "Difficulty 1 (time/speed)" ) PORT_DIPLOCATION("SW B:1,2")
22522211   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
22532212   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )
r2956r2957
22672226   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW B:7" )
22682227   PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW B:8" )
22692228
2270   PORT_START      /* IN0 */
2229   PORT_START_TAG("IN0")   /* IN0 */
22712230   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_UNKNOWN )
22722231   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
22732232   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN2 )
r2956r2957
22772236   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1)
22782237   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)   /* main accel key */
22792238
2280   PORT_START      /* IN1: b3 not mapped: standardized on holding b4=lo gear */
2239   PORT_START_TAG("IN1")   /* IN1: b3 not mapped: standardized on holding b4=lo gear */
22812240   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_UNKNOWN )
22822241   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
22832242   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_TILT )
r2956r2957
22872246   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1)
22882247   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)   /* main brake key */
22892248
2290   PORT_START      /* IN2, unused */
2249   PORT_START_TAG("IN2")   /* IN2, unused */
2250   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
22912251
2292   PORT_START      /* IN3, "handle" i.e. steering */
2252   PORT_START_TAG("STEER")   /* IN3, "handle" i.e. steering */
22932253   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_REVERSE PORT_PLAYER(1)
22942254
2295   PORT_START      /* IN4, fake allowing digital steer */
2255   PORT_START_TAG("FAKE")   /* IN4, fake allowing digital steer */
22962256   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(1)
22972257   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(1)
22982258   PORT_DIPNAME( 0x10, 0x00, "Steering type" )
r2956r2957
23032263static INPUT_PORTS_START( contcrcu )
23042264   PORT_INCLUDE(contcirc)
23052265
2306   PORT_MODIFY("DSW1")
2307   TAITO_Z_COINAGE_JAPAN_8      // confirmed
2266   PORT_MODIFY("DSWA")      // confirmed
2267   TAITO_COINAGE_JAPAN_OLD_LOC(SW A)
23082268INPUT_PORTS_END
23092269
23102270static INPUT_PORTS_START( chasehq )   // IN3-6 perhaps used with cockpit setup? //
2311   PORT_START_TAG("DSW1") /* DSW A */
2271   PORT_START_TAG("DSWA") /* DSW A */
23122272   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW A:1,2")   /* US Manual states DIPS 1 & 2 "MUST REMAIN OFF" */
23132273   PORT_DIPSETTING(    0x03, "Upright / Steering Lock" )
23142274   PORT_DIPSETTING(    0x02, "Upright / No Steering Lock" )
r2956r2957
23182278   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW A:4")
23192279   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
23202280   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2321   TAITO_Z_COINAGE_WORLD_8
2281   TAITO_COINAGE_WORLD_LOC(SW A)
23222282
2323   PORT_START_TAG("DSW2") /* DSW B */
2324   TAITO_Z_DIFFICULTY_8
2283   PORT_START_TAG("DSWB") /* DSW B */
2284   TAITO_DIFFICULTY_LOC(SW B)
23252285   PORT_DIPNAME( 0x0c, 0x0c, "Timer Setting" ) PORT_DIPLOCATION("SW B:3,4")
23262286   PORT_DIPSETTING(    0x08, "70 Seconds" )
23272287   PORT_DIPSETTING(    0x04, "65 Seconds" )
r2956r2957
23402300   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
23412301   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
23422302
2343   PORT_START      /* IN0 */
2303   PORT_START_TAG("IN0")   /* IN0 */
23442304   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_UNKNOWN )
23452305   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
23462306   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 )
r2956r2957
23502310   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
23512311   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
23522312
2353   PORT_START      /* IN1 */
2313   PORT_START_TAG("IN1")   /* IN1 */
23542314   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_BUTTON3 ) PORT_PLAYER(1)   /* turbo */
23552315   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_TILT )
23562316   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_UNKNOWN )
r2956r2957
23602320   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
23612321   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
23622322
2363   PORT_START      /* IN2, unused */
2323   PORT_START_TAG("IN2")   /* IN2, unused */
2324   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
23642325
2365   PORT_START      /* IN3, ??? */
2326   PORT_START_TAG("UNK1")   /* IN3, ??? */
23662327   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
23672328   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
23682329   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
23722333   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
23732334   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
23742335
2375   PORT_START      /* IN4, ??? */
2336   PORT_START_TAG("UNK2")   /* IN4, ??? */
23762337   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
23772338   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
23782339   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
23822343   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
23832344   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
23842345
2385   PORT_START      /* IN5, ??? */
2346   PORT_START_TAG("UNK3")   /* IN5, ??? */
23862347   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
23872348   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
23882349   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
23922353   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
23932354   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
23942355
2395   PORT_START      /* IN6, ??? */
2356   PORT_START_TAG("UNK4")   /* IN6, ??? */
23962357   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
23972358   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
23982359   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
24022363   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
24032364   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
24042365
2405   PORT_START      /* IN7, steering */
2366   PORT_START_TAG("STEER")   /* IN7, steering */
24062367   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_PLAYER(1)
24072368
2408   PORT_START      /* IN8, fake allowing digital steer */
2369   PORT_START_TAG("FAKE")   /* IN8, fake allowing digital steer */
24092370   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(1)
24102371   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(1)
24112372   PORT_DIPNAME( 0x10, 0x00, "Steering type" )
r2956r2957
24162377static INPUT_PORTS_START( chasehqj )
24172378   PORT_INCLUDE(chasehq)
24182379
2419   PORT_MODIFY("DSW1")
2420   TAITO_Z_COINAGE_JAPAN_8
2380   PORT_MODIFY("DSWA")
2381   TAITO_COINAGE_JAPAN_OLD_LOC(SW A)
24212382INPUT_PORTS_END
24222383
24232384static INPUT_PORTS_START( enforce )
2424   PORT_START /* DSW A */
2385   PORT_START_TAG("DSWA")   /* DSW A */
24252386   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW A:1" )
24262387   PORT_DIPUNUSED_DIPLOC( 0x02, 0x02, "SW A:2" )
24272388   PORT_SERVICE_DIPLOC( 0x04, 0x04, "SW A:3" )
24282389   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW A:4")
2429   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )   // Says SHIFT HI in test mode !?
2390   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )      // Says SHIFT HI in test mode !?
24302391   PORT_DIPSETTING(    0x08, DEF_STR( On ) )      // Says SHIFT LO in test mode !?
2431   TAITO_Z_COINAGE_JAPAN_8
2392   TAITO_COINAGE_JAPAN_OLD_LOC(SW A)
24322393
2433   PORT_START /* DSW B */
2434   TAITO_Z_DIFFICULTY_8
2394   PORT_START_TAG("DSWB")   /* DSW B */
2395   TAITO_DIFFICULTY_LOC(SW B)
24352396   PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "SW B:3" )
24362397   PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW B:4" )
24372398   PORT_DIPNAME( 0x10, 0x00, "Background scenery" ) PORT_DIPLOCATION("SW B:5")
r2956r2957
24412402   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW B:7" )
24422403   PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW B:8" )
24432404
2444   PORT_START      /* IN0 */
2405   PORT_START_TAG("IN0")   /* IN0 */
24452406   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_UNKNOWN )
24462407   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_UNKNOWN )
24472408   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN2 )
r2956r2957
24512412   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
24522413   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
24532414
2454   PORT_START      /* IN1 */
2415   PORT_START_TAG("IN1")   /* IN1 */
24552416   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_BUTTON2 ) PORT_PLAYER(1)   /* Bomb */
24562417   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_BUTTON1 ) PORT_PLAYER(1)   /* Laser */
24572418   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_TILT )
r2956r2957
24602421   PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNKNOWN )
24612422   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
24622423   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
2424
2425   PORT_START_TAG("IN2")   /* IN2, unused */
2426   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
24632427INPUT_PORTS_END
24642428
24652429static INPUT_PORTS_START( bshark )
2466   PORT_START_TAG("DSW1") /* DSW A */
2430   PORT_START_TAG("DSWA") /* DSW A */
24672431   PORT_DIPNAME( 0x01, 0x01, "Mirror screen" ) PORT_DIPLOCATION("SW A:1")   // manual says it must be off
24682432   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
24692433   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
24722436   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW A:4")
24732437   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
24742438   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2475   TAITO_Z_COINAGE_US_8
2439   TAITO_COINAGE_US_LOC(SW A)
24762440
2477   PORT_START_TAG("DSW2") /* DSW B */
2478   TAITO_Z_DIFFICULTY_8
2441   PORT_START_TAG("DSWB") /* DSW B */
2442   TAITO_DIFFICULTY_LOC(SW B)
24792443   PORT_DIPNAME( 0x0c, 0x04, "Speed of Sight" ) PORT_DIPLOCATION("SW B:3,4")
24802444   PORT_DIPSETTING(    0x0c, "Slow" )
24812445   PORT_DIPSETTING(    0x08, DEF_STR( Medium ) )
r2956r2957
24862450   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW B:7" )
24872451   PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW B:8" )
24882452
2489   PORT_START      /* IN0 */
2453   PORT_START_TAG("IN0")   /* IN0 */
24902454   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 )
24912455   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 )
24922456   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
24962460   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
24972461   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
24982462
2499   PORT_START      /* IN1, unused */
2463   PORT_START_TAG("IN1")   /* IN1, unused */
2464   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
25002465
2501   PORT_START      /* IN2, b2-5 affect sound num in service mode but otherwise useless (?) */
2466   PORT_START_TAG("IN2")   /* IN2, b2-5 affect sound num in service mode but otherwise useless (?) */
25022467   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
25032468   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
25042469   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
r2956r2957
25082473   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)   /* "Fire" */
25092474   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)   /* same as "Fire" */
25102475
2511   PORT_START   /* values chosen to match allowed crosshair area */
2476   PORT_START_TAG("STICKX")   /* values chosen to match allowed crosshair area */
25122477   PORT_BIT( 0xff, 0x00, IPT_AD_STICK_X ) PORT_MINMAX(0xcc,0x35) PORT_SENSITIVITY(20) PORT_KEYDELTA(4) PORT_REVERSE PORT_PLAYER(1)
25132478
2514   PORT_START   /* "X adjust" */  /* declare as DIP SWITCH instead of VARIABLE REGISTER */
2479   PORT_START_TAG("X_ADJUST")   /* declare as DIP SWITCH instead of VARIABLE REGISTER */
25152480   TAITO_Z_ANALOG_ADJUST( "Adjust Stick H (VARIABLE REGISTER)" )
25162481
2517   PORT_START   /* values chosen to match allowed crosshair area */
2482   PORT_START_TAG("STICKY")   /* values chosen to match allowed crosshair area */
25182483   PORT_BIT( 0xff, 0x00, IPT_AD_STICK_Y ) PORT_MINMAX(0xd5,0x32) PORT_SENSITIVITY(20) PORT_KEYDELTA(4) PORT_PLAYER(1)
25192484
2520   PORT_START   /* "Y adjust" */  /* declare as DIP SWITCH instead of VARIABLE REGISTER */
2485   PORT_START_TAG("Y_ADJUST")   /* declare as DIP SWITCH instead of VARIABLE REGISTER */
25212486   TAITO_Z_ANALOG_ADJUST( "Adjust Stick V (VARIABLE REGISTER)" )
25222487INPUT_PORTS_END
25232488
25242489static INPUT_PORTS_START( bsharkj )
25252490   PORT_INCLUDE(bshark)
25262491
2527   PORT_MODIFY("DSW1")
2528   TAITO_Z_COINAGE_JAPAN_8
2492   PORT_MODIFY("DSWA")
2493   TAITO_COINAGE_JAPAN_OLD_LOC(SW A)
25292494INPUT_PORTS_END
25302495
25312496static INPUT_PORTS_START( sci )
2532   PORT_START_TAG("DSW1") /* DSW A */
2497   PORT_START_TAG("DSWA") /* DSW A */
25332498   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW A:1")
25342499   PORT_DIPSETTING(    0x01, "Cockpit" )
25352500   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
r2956r2957
25382503   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW A:4")
25392504   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
25402505   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2541   TAITO_Z_COINAGE_WORLD_8
2506   TAITO_COINAGE_WORLD_LOC(SW A)
25422507
2543   PORT_START_TAG("DSW2") /* DSW B */
2544   TAITO_Z_DIFFICULTY_8
2508   PORT_START_TAG("DSWB") /* DSW B */
2509   TAITO_DIFFICULTY_LOC(SW B)
25452510   PORT_DIPNAME( 0x0c, 0x0c, "Timer Setting" ) PORT_DIPLOCATION("SW B:3,4")
25462511   PORT_DIPSETTING(    0x08, "70 Seconds" )
25472512   PORT_DIPSETTING(    0x04, "65 Seconds" )
r2956r2957
25602525   PORT_DIPSETTING(    0x80, DEF_STR( Normal ) )
25612526   PORT_DIPSETTING(    0x00, DEF_STR( Low ) )
25622527
2563   PORT_START      /* IN0 */
2528   PORT_START_TAG("IN0")   /* IN0 */
25642529   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
25652530   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)   /* fire */
25662531   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
r2956r2957
25702535   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
25712536   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
25722537
2573   PORT_START      /* IN1 */
2538   PORT_START_TAG("IN1")   /* IN1 */
25742539   PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_BUTTON5 ) PORT_PLAYER(1)   /* turbo */
25752540   PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_TILT )
25762541   PORT_BIT( 0x04, IP_ACTIVE_LOW,  IPT_BUTTON6 ) PORT_PLAYER(1)   /* "center" */
r2956r2957
25802545   PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_UNKNOWN )
25812546   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_UNKNOWN )
25822547
2583   PORT_START      /* IN2, unused */
2548   PORT_START_TAG("IN2")   /* IN2, unused */
2549   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
25842550
2585   PORT_START      /* IN3, steering */
2551   PORT_START_TAG("STEER")   /* IN3, steering */
25862552   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(15) PORT_PLAYER(1)
25872553
2588   PORT_START      /* IN4, fake allowing digital steer */
2554   PORT_START_TAG("FAKE")   /* IN4, fake allowing digital steer */
25892555   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(1)
25902556   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(1)
25912557   PORT_DIPNAME( 0x10, 0x00, "Steering type" )
r2956r2957
25962562static INPUT_PORTS_START( sciu )
25972563   PORT_INCLUDE(sci)
25982564
2599   PORT_MODIFY("DSW1")
2600   TAITO_Z_COINAGE_US_8
2565   PORT_MODIFY("DSWA")
2566   TAITO_COINAGE_US_LOC(SW A)
26012567INPUT_PORTS_END
26022568
26032569static INPUT_PORTS_START( scij )
26042570   PORT_INCLUDE(sci)
26052571
2606   PORT_MODIFY("DSW1")
2607   TAITO_Z_COINAGE_JAPAN_8
2572   PORT_MODIFY("DSWA")
2573   TAITO_COINAGE_JAPAN_OLD_LOC(SW A)
26082574INPUT_PORTS_END
26092575
26102576static INPUT_PORTS_START( nightstr )
2611   PORT_START_TAG("DSW1") /* DSW A */
2577   PORT_START_TAG("DSWA") /* DSW A */
26122578   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW A:1")
26132579   PORT_DIPSETTING(    0x01, "Cockpit" )
26142580   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
r2956r2957
26172583   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW A:4")
26182584   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
26192585   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2620   TAITO_Z_COINAGE_WORLD_8
2586   TAITO_COINAGE_WORLD_LOC(SW A)
26212587
2622   PORT_START_TAG("DSW2") /* DSW B */
2623   TAITO_Z_DIFFICULTY_8
2588   PORT_START_TAG("DSWB") /* DSW B */
2589   TAITO_DIFFICULTY_LOC(SW B)
26242590   PORT_DIPNAME( 0x0c, 0x0c, "Bonus Shields" ) PORT_DIPLOCATION("SW B:3,4")
26252591   PORT_DIPSETTING(    0x08, "3" )
26262592   PORT_DIPSETTING(    0x04, "2" )
r2956r2957
26382604   PORT_DIPSETTING(    0x80, "7 Shots / Second" )
26392605   PORT_DIPSETTING(    0x00, "10 Shots / Second" )
26402606
2641   PORT_START      /* IN0 */
2607   PORT_START_TAG("IN0")   /* IN0 */
26422608   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
26432609   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
26442610   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
26482614   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
26492615   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_TILT )
26502616
2651   PORT_START      /* IN1, unused */
2617   PORT_START_TAG("IN1")   /* IN1, unused */
2618   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
26522619
2653   PORT_START      /* IN2 */
2620   PORT_START_TAG("IN2")   /* IN2 */
26542621   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
26552622   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
26562623   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
26602627   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
26612628   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
26622629
2663   PORT_START
2630   PORT_START_TAG("STICKX")
26642631   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(60) PORT_KEYDELTA(15) PORT_PLAYER(1)
26652632
2666   PORT_START
2633   PORT_START_TAG("STICKY")
26672634   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(60) PORT_KEYDELTA(15) PORT_REVERSE PORT_PLAYER(1)
26682635
2669   PORT_START   /* X offset */  /* declare as DIP SWITCH instead of VARIABLE REGISTER */
2636   PORT_START_TAG("X_ADJUST")   /* declare as DIP SWITCH instead of VARIABLE REGISTER */
26702637   TAITO_Z_ANALOG_ADJUST( "Adjust Stick H (VARIABLE REGISTER)" )
26712638
2672   PORT_START   /* Y offset */  /* declare as DIP SWITCH instead of VARIABLE REGISTER */
2639   PORT_START_TAG("Y_ADJUST")   /* declare as DIP SWITCH instead of VARIABLE REGISTER */
26732640   TAITO_Z_ANALOG_ADJUST( "Adjust Stick V (VARIABLE REGISTER)" )
26742641INPUT_PORTS_END
26752642
26762643static INPUT_PORTS_START( nghtstrj )
26772644   PORT_INCLUDE( nightstr )
26782645
2679   PORT_MODIFY("DSW1")
2680   TAITO_Z_COINAGE_JAPAN_8
2646   PORT_MODIFY("DSWA")
2647   TAITO_COINAGE_JAPAN_OLD_LOC(SW A)
26812648INPUT_PORTS_END
26822649
26832650static INPUT_PORTS_START( nghtstru )
26842651   PORT_INCLUDE( nightstr )
26852652
2686   PORT_MODIFY("DSW1")
2687   TAITO_Z_COINAGE_US_8
2653   PORT_MODIFY("DSWA")
2654   TAITO_COINAGE_US_LOC(SW A)
26882655INPUT_PORTS_END
26892656
26902657static INPUT_PORTS_START( aquajack )
2691   PORT_START_TAG("DSW1") /* DSW A */
2658   PORT_START_TAG("DSWA") /* DSW A */
26922659   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW A:1")
26932660   PORT_DIPSETTING(    0x80, "Cockpit" )
26942661   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
r2956r2957
27082675   PORT_DIPSETTING(    0x02, DEF_STR( 1C_4C ) )   /* 2 Coins to Continue */
27092676   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )   /* 3 Coins to Continue */
27102677
2711   PORT_START_TAG("DSW2") /* DSW B */
2678   PORT_START_TAG("DSWB") /* DSW B */
27122679   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW B:2,1")
27132680   PORT_DIPSETTING(    0x40, DEF_STR( Easy ) )
27142681   PORT_DIPSETTING(    0xc0, DEF_STR( Normal ) )
r2956r2957
27342701   /* PORT_DIPSETTING(    0x01, "Normal Game" ) */
27352702   /* PORT_DIPSETTING(    0x00, "Endless Game" ) */
27362703
2737   PORT_START      /* IN0 */
2704   PORT_START_TAG("IN0")   /* IN0 */
27382705   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
27392706   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
27402707   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
r2956r2957
27442711   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
27452712   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
27462713
2747   PORT_START      /* IN1 */
2714   PORT_START_TAG("IN1")   /* IN1 */
27482715   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
27492716   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
27502717   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
27542721   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
27552722   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
27562723
2757   PORT_START      /* IN2, what is it ??? */
2724   PORT_START_TAG("IN2")   /* IN2, what is it ??? */
27582725   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)
27592726INPUT_PORTS_END
27602727
27612728static INPUT_PORTS_START( aquajckj )
27622729   PORT_INCLUDE(aquajack)
27632730
2764   PORT_MODIFY("DSW1")
2731   PORT_MODIFY("DSWA")
27652732   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW A:6,5")
27662733   PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
27672734   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
r2956r2957
27752742INPUT_PORTS_END
27762743
27772744static INPUT_PORTS_START( spacegun )
2778   PORT_START /* DSW A */
2745   PORT_START_TAG("DSWA")   /* DSW A */
27792746   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW A:1" )   // Manual says Always Off
27802747   PORT_DIPNAME( 0x02, 0x02, "Always have gunsight power up" ) PORT_DIPLOCATION("SW A:2")
27812748   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
r2956r2957
27842751   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW A:4")
27852752   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
27862753   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2787   TAITO_Z_COINAGE_WORLD_8
2754   TAITO_COINAGE_WORLD_LOC(SW A)
27882755
2789   PORT_START /* DSW B */
2790   TAITO_Z_DIFFICULTY_8
2756   PORT_START_TAG("DSWB")   /* DSW B */
2757   TAITO_DIFFICULTY_LOC(SW B)
27912758   PORT_DIPUNUSED_DIPLOC( 0x04, 0x04, "SW B:3" )   // Manual lists dips 3 through 6 and 8 as Always off
27922759   PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "SW B:4" )
27932760   PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW B:5" )
r2956r2957
27992766   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
28002767   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
28012768
2802   PORT_START      /* IN0 */
2769   PORT_START_TAG("IN0")   /* IN0 */
28032770   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
28042771   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
28052772   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
r2956r2957
28092776   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1)
28102777   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2)
28112778
2812   PORT_START      /* IN1, unused */
2779   PORT_START_TAG("IN1")   /* IN1, unused */
2780   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
28132781
2814   PORT_START      /* IN2 */
2782   PORT_START_TAG("IN2")   /* IN2 */
28152783   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
28162784   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
28172785   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
r2956r2957
28212789   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
28222790   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
28232791
2824   PORT_START
2792   PORT_START_TAG("STICKX1")
28252793   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(22) PORT_REVERSE PORT_PLAYER(1)
28262794
2827   PORT_START
2795   PORT_START_TAG("STICKY1")
28282796   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(22) PORT_PLAYER(1)
28292797
2830   PORT_START
2798   PORT_START_TAG("STICKX2")
28312799   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(20) PORT_KEYDELTA(22) PORT_REVERSE PORT_PLAYER(2)
28322800
2833   PORT_START
2801   PORT_START_TAG("STICKY2")
28342802   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(22) PORT_PLAYER(2)
28352803INPUT_PORTS_END
28362804
28372805static INPUT_PORTS_START( dblaxle )
2838   PORT_START_TAG("DSW1") /* DSW A */
2806   PORT_START_TAG("DSWA") /* DSW A */
28392807   PORT_DIPUNUSED_DIPLOC( 0x01, 0x01, "SW A:1" )
28402808   PORT_DIPNAME( 0x02, 0x02, "Gear shift" ) PORT_DIPLOCATION("SW A:2")
28412809   PORT_DIPSETTING(    0x02, DEF_STR( Normal ) )
r2956r2957
28442812   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW A:4")
28452813   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
28462814   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2847   TAITO_Z_COINAGE_US_8
2815   TAITO_COINAGE_US_LOC(SW A)
28482816
2849   PORT_START_TAG("DSW2") /* DSW B */
2850   TAITO_Z_DIFFICULTY_8
2817   PORT_START_TAG("DSWB") /* DSW B */
2818   TAITO_DIFFICULTY_LOC(SW B)
28512819   PORT_DIPNAME( 0x04, 0x00, "Multi-machine hookup ?" ) PORT_DIPLOCATION("SW B:3")   // doesn't boot if on
28522820   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
28532821   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
r2956r2957
28612829   PORT_DIPUNUSED_DIPLOC( 0x40, 0x40, "SW B:7" )
28622830   PORT_DIPUNUSED_DIPLOC( 0x80, 0x80, "SW B:8" )
28632831
2864   PORT_START      /* IN0 */
2832   PORT_START_TAG("IN0")   /* IN0 */
28652833   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
28662834   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)   /* shift */
28672835   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
r2956r2957
28712839   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
28722840   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)   /* "back" */
28732841
2874   PORT_START      /* IN1 */
2842   PORT_START_TAG("IN1")   /* IN1 */
28752843   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)   /* nitro */
28762844   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_TILT )
28772845   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)   /* "center" */
r2956r2957
28812849   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
28822850   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
28832851
2884   PORT_START      /* IN2, unused */
2852   PORT_START_TAG("IN2")   /* IN2, unused */
2853   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
28852854
2886   PORT_START      /* IN3, steering */
2855   PORT_START_TAG("STEER")   /* IN3, steering */
28872856   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(40) PORT_KEYDELTA(10) PORT_PLAYER(1)
28882857
2889   PORT_START      /* IN4, fake allowing digital steer */
2858   PORT_START_TAG("FAKE")   /* IN4, fake allowing digital steer */
28902859   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(1)
28912860   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(1)
28922861   PORT_DIPNAME( 0x10, 0x00, "Steering type" )
r2956r2957
28972866static INPUT_PORTS_START( pwheelsj )
28982867   PORT_INCLUDE(dblaxle)
28992868
2900   PORT_MODIFY("DSW1")
2901   TAITO_Z_COINAGE_JAPAN_8
2869   PORT_MODIFY("DSWA")
2870   TAITO_COINAGE_JAPAN_OLD_LOC(SW A)
29022871INPUT_PORTS_END
29032872
29042873
r2956r2957
46934662GAME( 1991, dblaxle,  0,        dblaxle,  dblaxle,  taitoz,   ROT0,               "Taito America Corporation", "Double Axle (US)", GAME_IMPERFECT_GRAPHICS )
46944663GAME( 1991, pwheelsj, dblaxle,  dblaxle,  pwheelsj, taitoz,   ROT0,               "Taito Corporation", "Power Wheels (Japan)", GAME_IMPERFECT_GRAPHICS )
46954664GAME( 1991, racingb,  0,        racingb,  dblaxle,  taitoz,   ROT0,               "Taito Corporation Japan", "Racing Beat (World)", GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING )
4696
src/mame/drivers/superqix.c
r2956r2957
195195static READ8_HANDLER( in4_mcu_r )
196196{
197197//  logerror("%04x: in4_mcu_r\n",activecpu_get_pc());
198   return input_port_read_indexed(machine, 4) | (from_mcu_pending << 6) | (from_z80_pending << 7);
198   return input_port_read(machine, "P2") | (from_mcu_pending << 6) | (from_z80_pending << 7);
199199}
200200
201201static READ8_HANDLER( sqix_from_mcu_r )
r2956r2957
268268{
269269   if ((port1 & 0x10) == 0)
270270   {
271      return input_port_read_indexed(machine, 0);
271      return input_port_read(machine, "DSW1");
272272   }
273273   else if ((port1 & 0x20) == 0)
274274   {
275      return input_port_read_indexed(machine, 2) | (from_mcu_pending << 6) | (from_z80_pending << 7);
275      return input_port_read(machine, "SYSTEM") | (from_mcu_pending << 6) | (from_z80_pending << 7);
276276   }
277277   else if ((port1 & 0x40) == 0)
278278   {
r2956r2957
297297
298298static READ8_HANDLER( bootleg_in0_r )
299299{
300   return BITSWAP8(input_port_read_indexed(machine, 0), 0,1,2,3,4,5,6,7);
300   return BITSWAP8(input_port_read(machine, "DSW1"), 0,1,2,3,4,5,6,7);
301301}
302302
303303static WRITE8_HANDLER( bootleg_flipscreen_w )
r2956r2957
325325   static int sign[2];
326326
327327   /* get the new position and adjust the result */
328   newpos = input_port_read_indexed(machine, 3 + player);
328   newpos = input_port_read(machine, player ? "DIAL2" : "DIAL1");
329329   if (newpos != oldpos[player])
330330   {
331331      sign[player] = ((newpos - oldpos[player]) & 0x80) >> 7;
r2956r2957
401401      switch (data & 0x07)
402402      {
403403         case 0x0:   // dsw A
404            portA_in = input_port_read_indexed(machine, 0);
404            portA_in = input_port_read(machine, "DSW1");
405405            break;
406406
407407         case 0x1:   // dsw B
408            portA_in = input_port_read_indexed(machine, 1);
408            portA_in = input_port_read(machine, "DSW2");
409409            break;
410410
411411         case 0x2:
r2956r2957
449449static READ8_HANDLER(hotsmash_ay_port_a_r)
450450{
451451//logerror("%04x: ay_port_a_r and mcu_pending is %d\n",activecpu_get_pc(),from_mcu_pending);
452   return input_port_read_indexed(machine, 2) | ((from_mcu_pending^1) << 7);
452   return input_port_read(machine, "SYSTEM") | ((from_mcu_pending^1) << 7);
453453}
454454
455455/**************************************************************************
r2956r2957
469469
470470   switch (from_z80)
471471   {
472      case 0x01: return input_port_read_indexed(machine, 4 + 2 * curr_player);
473      case 0x02: return input_port_read_indexed(machine, 5 + 2 * curr_player);
474      case 0x04: return input_port_read_indexed(machine, 0);
475      case 0x08: return input_port_read_indexed(machine, 1);
472      case 0x01: return input_port_read(machine, curr_player ? "PADDLE2" : "PADDLE1");
473      case 0x02: return input_port_read(machine, curr_player ? "DIAL2" : "DIAL1");
474      case 0x04: return input_port_read(machine, "DSW1");
475      case 0x08: return input_port_read(machine, "DSW2");
476476      case 0x80: curr_player = 0; return 0;
477477      case 0x81: curr_player = 1; return 0;
478478   }
r2956r2957
485485{
486486//  logerror("%04x: ay_port_a_r\n",activecpu_get_pc());
487487    /* bits 76------  MCU status bits */
488   return (mame_rand(machine)&0xc0)|input_port_read_indexed(machine, 3);
488   return (mame_rand(machine) & 0xc0) | input_port_read(machine, "BUTTONS");
489489}
490490
491491
r2956r2957
586586   AM_RANGE(0x0407, 0x0407) AM_WRITE(AY8910_control_port_1_w)
587587   AM_RANGE(0x0408, 0x0408) AM_WRITE(bootleg_flipscreen_w)
588588   AM_RANGE(0x0410, 0x0410) AM_WRITE(superqix_0410_w)   /* ROM bank, NMI enable, tile bank */
589   AM_RANGE(0x0418, 0x0418) AM_READ(input_port_2_r)
589   AM_RANGE(0x0418, 0x0418) AM_READ_PORT("SYSTEM")
590590   AM_RANGE(0x0800, 0x77ff) AM_RAM_WRITE(superqix_bitmapram_w) AM_BASE(&superqix_bitmapram)
591591   AM_RANGE(0x8800, 0xf7ff) AM_RAM_WRITE(superqix_bitmapram2_w) AM_BASE(&superqix_bitmapram2)
592592ADDRESS_MAP_END
r2956r2957
615615
616616
617617static INPUT_PORTS_START( pbillian )
618   PORT_START
618   PORT_START_TAG("DSW1")
619619   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) )
620   PORT_DIPSETTING(    0x03, DEF_STR( 5C_1C ) )
621   PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
622   PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
623   PORT_DIPSETTING(    0x06, DEF_STR( 2C_1C ) )
624   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
625   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
626   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
627   PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
620   PORT_DIPSETTING(   0x03, DEF_STR( 5C_1C ) )
621   PORT_DIPSETTING(   0x04, DEF_STR( 4C_1C ) )
622   PORT_DIPSETTING(   0x05, DEF_STR( 3C_1C ) )
623   PORT_DIPSETTING(   0x06, DEF_STR( 2C_1C ) )
624   PORT_DIPSETTING(   0x07, DEF_STR( 1C_1C ) )
625   PORT_DIPSETTING(   0x00, DEF_STR( 2C_3C ) )
626   PORT_DIPSETTING(   0x02, DEF_STR( 1C_2C ) )
627   PORT_DIPSETTING(   0x01, DEF_STR( 1C_3C ) )
628628   PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) )
629   PORT_DIPSETTING(    0x18, DEF_STR( 5C_1C ) )
630   PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
631   PORT_DIPSETTING(    0x28, DEF_STR( 3C_1C ) )
632   PORT_DIPSETTING(    0x30, DEF_STR( 2C_1C ) )
633   PORT_DIPSETTING(    0x38, DEF_STR( 1C_1C ) )
634   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
635   PORT_DIPSETTING(    0x10, DEF_STR( 1C_2C ) )
636   PORT_DIPSETTING(    0x08, DEF_STR( 1C_3C ) )
629   PORT_DIPSETTING(   0x18, DEF_STR( 5C_1C ) )
630   PORT_DIPSETTING(   0x20, DEF_STR( 4C_1C ) )
631   PORT_DIPSETTING(   0x28, DEF_STR( 3C_1C ) )
632   PORT_DIPSETTING(   0x30, DEF_STR( 2C_1C ) )
633   PORT_DIPSETTING(   0x38, DEF_STR( 1C_1C ) )
634   PORT_DIPSETTING(   0x00, DEF_STR( 2C_3C ) )
635   PORT_DIPSETTING(   0x10, DEF_STR( 1C_2C ) )
636   PORT_DIPSETTING(   0x08, DEF_STR( 1C_3C ) )
637637   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) )
638   PORT_DIPSETTING(    0x40, DEF_STR( No ) )
639   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
638   PORT_DIPSETTING(   0x40, DEF_STR( No ) )
639   PORT_DIPSETTING(   0x00, DEF_STR( Yes ) )
640640   PORT_DIPNAME( 0x80, 0x80, "Freeze" )
641   PORT_DIPSETTING(    0x80, DEF_STR( No ) )
642   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
641   PORT_DIPSETTING(   0x80, DEF_STR( No ) )
642   PORT_DIPSETTING(   0x00, DEF_STR( Yes ) )
643643
644   PORT_START
644   PORT_START_TAG("DSW2")
645645   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
646   PORT_DIPSETTING(    0x03, "2" )
647   PORT_DIPSETTING(    0x02, "3" )
648   PORT_DIPSETTING(    0x01, "4" )
649   PORT_DIPSETTING(    0x00, "5" )
646   PORT_DIPSETTING(   0x03, "2" )
647   PORT_DIPSETTING(   0x02, "3" )
648   PORT_DIPSETTING(   0x01, "4" )
649   PORT_DIPSETTING(   0x00, "5" )
650650   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
651   PORT_DIPSETTING(    0x0c, "10/20/300K Points" )
652   PORT_DIPSETTING(    0x00, "10/30/500K Points" )
653   PORT_DIPSETTING(    0x08, "20/30/400K Points" )
654   PORT_DIPSETTING(    0x04, "30/40/500K Points" )
651   PORT_DIPSETTING(   0x0c, "10/20/300K Points" )
652   PORT_DIPSETTING(   0x00, "10/30/500K Points" )
653   PORT_DIPSETTING(   0x08, "20/30/400K Points" )
654   PORT_DIPSETTING(   0x04, "30/40/500K Points" )
655655   PORT_DIPNAME( 0x30, 0x10, DEF_STR( Difficulty ) )
656   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
657   PORT_DIPSETTING(    0x10, DEF_STR( Normal ) )
658   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
659   PORT_DIPSETTING(    0x30, DEF_STR( Very_Hard ) )
656   PORT_DIPSETTING(   0x00, DEF_STR( Easy ) )
657   PORT_DIPSETTING(   0x10, DEF_STR( Normal ) )
658   PORT_DIPSETTING(   0x20, DEF_STR( Hard ) )
659   PORT_DIPSETTING(   0x30, DEF_STR( Very_Hard ) )
660660   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
661   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
662   PORT_DIPSETTING(    0x40, DEF_STR( Cocktail ) )
661   PORT_DIPSETTING(   0x00, DEF_STR( Upright ) )
662   PORT_DIPSETTING(   0x40, DEF_STR( Cocktail ) )
663663   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Flip_Screen ) )
664   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
665   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
664   PORT_DIPSETTING(   0x80, DEF_STR( Off ) )
665   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
666666
667   PORT_START
667   PORT_START_TAG("SYSTEM")
668668   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
669669   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 )
670670   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
r2956r2957
674674   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
675675   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )
676676
677   PORT_START
677   PORT_START_TAG("BUTTONS")
678678   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON3 )   // high score initials
679679   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )   // fire (M powerup) + high score initials
680680   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL   // high score initials
r2956r2957
684684   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL )   // mcu status (pending mcu->z80)
685685   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )   // mcu status (pending z80->mcu)
686686
687   PORT_START
687   PORT_START_TAG("PADDLE1")
688688   PORT_BIT( 0x3f, 0x00, IPT_PADDLE_V  ) PORT_MINMAX(0,0x3f) PORT_SENSITIVITY(30) PORT_KEYDELTA(3) PORT_CENTERDELTA(0) PORT_REVERSE
689689   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 )
690690
691   PORT_START
691   PORT_START_TAG("DIAL1")
692692   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10)
693693
694   PORT_START
694   PORT_START_TAG("PADDLE2")
695695   PORT_BIT( 0x3f, 0x00, IPT_PADDLE_V  ) PORT_MINMAX(0,0x3f) PORT_SENSITIVITY(30) PORT_KEYDELTA(3) PORT_CENTERDELTA(0) PORT_REVERSE  PORT_COCKTAIL
696696   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
697697
698   PORT_START
698   PORT_START_TAG("DIAL2")
699699   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_COCKTAIL
700700INPUT_PORTS_END
701701
702702static INPUT_PORTS_START( hotsmash )
703   PORT_START
703   PORT_START_TAG("DSW1")
704704   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
705   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
706   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
705   PORT_DIPSETTING(   0x01, DEF_STR( Off ) )
706   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
707707   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
708   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
709   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
708   PORT_DIPSETTING(   0x02, DEF_STR( Off ) )
709   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
710710   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
711   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
712   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
711   PORT_DIPSETTING(   0x04, DEF_STR( Off ) )
712   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
713713   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
714   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
715   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
714   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
715   PORT_DIPSETTING(   0x08, DEF_STR( On ) )
716716   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
717   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
718   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
719   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
720   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
717   PORT_DIPSETTING(   0x10, DEF_STR( 2C_1C ) )
718   PORT_DIPSETTING(   0x30, DEF_STR( 1C_1C ) )
719   PORT_DIPSETTING(   0x00, DEF_STR( 2C_3C ) )
720   PORT_DIPSETTING(   0x20, DEF_STR( 1C_2C ) )
721721   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
722   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
723   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) )
724   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) )
725   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
722   PORT_DIPSETTING(   0x40, DEF_STR( 2C_1C ) )
723   PORT_DIPSETTING(   0xc0, DEF_STR( 1C_1C ) )
724   PORT_DIPSETTING(   0x00, DEF_STR( 2C_3C ) )
725   PORT_DIPSETTING(   0x80, DEF_STR( 1C_2C ) )
726726
727   PORT_START
727   PORT_START_TAG("DSW2")
728728   PORT_DIPNAME( 0x03, 0x03, "Difficulty vs. CPU" )
729   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
730   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )
731   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )
732   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
729   PORT_DIPSETTING(   0x02, DEF_STR( Easy ) )
730   PORT_DIPSETTING(   0x03, DEF_STR( Normal ) )
731   PORT_DIPSETTING(   0x01, DEF_STR( Hard ) )
732   PORT_DIPSETTING(   0x00, DEF_STR( Hardest ) )
733733   PORT_DIPNAME( 0x0c, 0x0c, "Difficulty vs. 2P" )
734   PORT_DIPSETTING(    0x08, DEF_STR( Easy ) )
735   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
736   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
737   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
734   PORT_DIPSETTING(   0x08, DEF_STR( Easy ) )
735   PORT_DIPSETTING(   0x0c, DEF_STR( Normal ) )
736   PORT_DIPSETTING(   0x04, DEF_STR( Hard ) )
737   PORT_DIPSETTING(   0x00, DEF_STR( Hardest ) )
738738   PORT_DIPNAME( 0x10, 0x10, "Points per game" )
739   PORT_DIPSETTING(    0x00, "3" )
740   PORT_DIPSETTING(    0x10, "4" )
739   PORT_DIPSETTING(   0x00, "3" )
740   PORT_DIPSETTING(   0x10, "4" )
741741   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
742   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
743   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
742   PORT_DIPSETTING(   0x20, DEF_STR( Off ) )
743   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
744744   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
745   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
746   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
745   PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
746   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
747747   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
748   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
749   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
748   PORT_DIPSETTING(   0x80, DEF_STR( Off ) )
749   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
750750
751   PORT_START
751   PORT_START_TAG("SYSTEM")
752752   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
753753   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 )
754754   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
r2956r2957
758758   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
759759   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )   // mcu status (0 = pending mcu->z80)
760760
761   PORT_START
761   PORT_START_TAG("DIAL1")
762762   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(15) PORT_KEYDELTA(30) PORT_CENTERDELTA(0) PORT_PLAYER(1)
763763
764   PORT_START
764   PORT_START_TAG("DIAL2")
765765   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(15) PORT_KEYDELTA(30) PORT_CENTERDELTA(0) PORT_PLAYER(2)
766766
767767INPUT_PORTS_END
768768
769769
770770static INPUT_PORTS_START( superqix )
771   PORT_START   /* DSW1 */
771   PORT_START_TAG("DSW1")   /* DSW1 */
772772   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
773   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
774   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
773   PORT_DIPSETTING(   0x00, DEF_STR( Upright ) )
774   PORT_DIPSETTING(   0x01, DEF_STR( Cocktail ) )
775775   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
776   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
777   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
776   PORT_DIPSETTING(   0x02, DEF_STR( Off ) )
777   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
778778   PORT_DIPNAME( 0x04, 0x04, "Freeze" )
779   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
780   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
779   PORT_DIPSETTING(   0x04, DEF_STR( Off ) )
780   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
781781   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Allow_Continue ) )
782   PORT_DIPSETTING(    0x08, DEF_STR( No ) )
783   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
782   PORT_DIPSETTING(   0x08, DEF_STR( No ) )
783   PORT_DIPSETTING(   0x00, DEF_STR( Yes ) )
784784   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
785   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
786   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
787   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ))
788   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
785   PORT_DIPSETTING(   0x10, DEF_STR( 2C_1C ) )
786   PORT_DIPSETTING(   0x30, DEF_STR( 1C_1C ) )
787   PORT_DIPSETTING(   0x00, DEF_STR( 2C_3C ))
788   PORT_DIPSETTING(   0x20, DEF_STR( 1C_2C ) )
789789   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
790   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) )
791   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) )
792   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ))
793   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
790   PORT_DIPSETTING(   0x40, DEF_STR( 2C_1C ) )
791   PORT_DIPSETTING(   0xc0, DEF_STR( 1C_1C ) )
792   PORT_DIPSETTING(   0x00, DEF_STR( 2C_3C ))
793   PORT_DIPSETTING(   0x80, DEF_STR( 1C_2C ) )
794794
795   PORT_START   /* DSW2 */
795   PORT_START_TAG("DSW2")   /* DSW2 */
796796   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
797   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) )
798   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )
799   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) )
800   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
797   PORT_DIPSETTING(   0x02, DEF_STR( Easy ) )
798   PORT_DIPSETTING(   0x03, DEF_STR( Normal ) )
799   PORT_DIPSETTING(   0x01, DEF_STR( Hard ) )
800   PORT_DIPSETTING(   0x00, DEF_STR( Hardest ) )
801801   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
802   PORT_DIPSETTING(    0x08, "20000 50000" )
803   PORT_DIPSETTING(    0x0c, "30000 100000" )
804   PORT_DIPSETTING(    0x04, "50000 100000" )
805   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
802   PORT_DIPSETTING(   0x08, "20000 50000" )
803   PORT_DIPSETTING(   0x0c, "30000 100000" )
804   PORT_DIPSETTING(   0x04, "50000 100000" )
805   PORT_DIPSETTING(   0x00, DEF_STR( None ) )
806806   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Lives ) )
807   PORT_DIPSETTING(    0x20, "2" )
808   PORT_DIPSETTING(    0x30, "3" )
809   PORT_DIPSETTING(    0x10, "4" )
810   PORT_DIPSETTING(    0x00, "5" )
807   PORT_DIPSETTING(   0x20, "2" )
808   PORT_DIPSETTING(   0x30, "3" )
809   PORT_DIPSETTING(   0x10, "4" )
810   PORT_DIPSETTING(   0x00, "5" )
811811   PORT_DIPNAME( 0xc0, 0xc0, "Fill Area" )
812   PORT_DIPSETTING(    0x80, "70%" )
813   PORT_DIPSETTING(    0xc0, "75%" )
814   PORT_DIPSETTING(    0x40, "80%" )
815   PORT_DIPSETTING(    0x00, "85%" )
812   PORT_DIPSETTING(   0x80, "70%" )
813   PORT_DIPSETTING(   0xc0, "75%" )
814   PORT_DIPSETTING(   0x40, "80%" )
815   PORT_DIPSETTING(   0x00, "85%" )
816816
817   PORT_START
817   PORT_START_TAG("SYSTEM")
818818   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
819819   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
820820   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
r2956r2957
824824   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
825825   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL )   // Z80 status (pending z80->mcu)
826826
827   PORT_START
827   PORT_START_TAG("P1")
828828   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
829829   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
830830   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
r2956r2957
834834   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_VBLANK )   /* ??? */
835835   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
836836
837   PORT_START
837   PORT_START_TAG("P2")
838838   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL
839839   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL
840840   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL
src/mame/drivers/pntnpuzl.c
r2956r2957
147147         eeprom_load(file);
148148      else
149149      {
150         int length;
150         UINT32 length, size;
151151         UINT8 *dat;
152152
153         dat = eeprom_get_data_pointer(&length);
154         memset(dat, 0, length);
153         dat = eeprom_get_data_pointer(&length, &size);
154         memset(dat, 0, length * size);
155155      }
156156   }
157157}
src/mame/drivers/segas32.c
r2956r2957
586586
587587static UINT16 common_io_chip_r(running_machine *machine, int which, offs_t offset, UINT16 mem_mask)
588588{
589   static const char *const portnames[2][8] =
590         {
591            { "P1_A", "P2_A", "PORTC_A", "PORTD_A", "SERVICE12_A", "SERVICE34_A", "PORTG_A", "PORTH_A" },
592            { "P1_B", "P2_B", "PORTC_B", "PORTD_B", "SERVICE12_B", "SERVICE34_B", "PORTG_B", "PORTH_B" },
593         };
589594   offset &= 0x1f/2;
590595
591596   switch (offset)
r2956r2957
604609            return misc_io_data[which][offset];
605610
606611         /* otherwise, return an input port */
607         return input_port_read_indexed(machine, which*8 + offset);
612         return input_port_read_safe(machine, portnames[which][offset], 0xffff);
608613
609614      /* 'SEGA' protection */
610615      case 0x10/2:
r2956r2957
12941299 *************************************/
12951300
12961301static INPUT_PORTS_START( system32_generic )
1297   PORT_START_TAG("P1")
1302   PORT_START_TAG("P1_A")
12981303   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
12991304   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
13001305   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
r2956r2957
13041309   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
13051310   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
13061311
1307   PORT_START_TAG("P2")
1312   PORT_START_TAG("P2_A")
13081313   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
13091314   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
13101315   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
r2956r2957
13141319   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
13151320   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
13161321
1317   PORT_START_TAG("PORTC")
1322   PORT_START_TAG("PORTC_A")
13181323   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
13191324
1320   PORT_START_TAG("PORTD")
1325   PORT_START_TAG("PORTD_A")
13211326   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
13221327
1323   PORT_START_TAG("SERVICE12")
1328   PORT_START_TAG("SERVICE12_A")
13241329   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
13251330   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
13261331   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
r2956r2957
13291334   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
13301335   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNKNOWN )
13311336
1332   PORT_START_TAG("SERVICE34")
1337   PORT_START_TAG("SERVICE34_A")
13331338   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN )
13341339   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE3 )   /* sometimes mirrors SERVICE1 */
13351340   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE4 )   /* tends to also work as a test switch */
13361341   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
13371342   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(eeprom_bit_r, NULL)
13381343
1339   PORT_START_TAG("PORTG")
1344   PORT_START_TAG("PORTG_A")
13401345   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
13411346
1342   PORT_START_TAG("PORTH")
1347   PORT_START_TAG("PORTH_A")
13431348   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
13441349INPUT_PORTS_END
13451350
13461351
13471352static INPUT_PORTS_START( multi32_generic )
1348   PORT_START_TAG("P1_A")
1349   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1353   PORT_INCLUDE( system32_generic )
13501354
1351   PORT_START_TAG("P2_A")
1352   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1353
1354   PORT_START_TAG("PORTC_A")
1355   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1356
1357   PORT_START_TAG("PORTD_A")
1358   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1359
1360   PORT_START_TAG("SERVICE12_A")
1361   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
1362   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
1363   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
1364   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1365   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
1366   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNKNOWN )
1367
1368   PORT_START_TAG("SERVICE34_A")
1369   PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNKNOWN )
1370   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE3 )   /* sometimes mirrors SERVICE1 */
1371   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE4 )   /* tends to also work as a test switch */
1372   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1373   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1374
1375   PORT_START_TAG("PORTG_A")
1376   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1377
1378   PORT_START_TAG("PORTH_A")
1379   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
1380
13811355   PORT_START_TAG("P1_B")
13821356   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
13831357
r2956r2957
14201394static INPUT_PORTS_START( arescue )
14211395   PORT_INCLUDE( system32_generic )
14221396
1423   PORT_MODIFY("P1")
1397   PORT_MODIFY("P1_A")
14241398   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
14251399
1426   PORT_MODIFY("P2")
1400   PORT_MODIFY("P2_A")
14271401   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
14281402
1429   PORT_MODIFY("SERVICE12")
1403   PORT_MODIFY("SERVICE12_A")
14301404   PORT_BIT( 0x38, IP_ACTIVE_LOW, IPT_UNUSED )
14311405
1432   PORT_MODIFY("SERVICE34")
1406   PORT_MODIFY("SERVICE34_A")
14331407   PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED )
14341408
14351409   PORT_START_TAG("ANALOG1")
r2956r2957
14461420static INPUT_PORTS_START( alien3 )
14471421   PORT_INCLUDE( system32_generic )
14481422
1449   PORT_MODIFY("P1")
1423   PORT_MODIFY("P1_A")
14501424   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
14511425
1452   PORT_MODIFY("P2")
1426   PORT_MODIFY("P2_A")
14531427   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
14541428
1455   PORT_MODIFY("SERVICE12")
1429   PORT_MODIFY("SERVICE12_A")
14561430   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
14571431   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
14581432   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE2 )
r2956r2957
14751449static INPUT_PORTS_START( arabfgt )
14761450   PORT_INCLUDE( system32_generic )
14771451
1478   PORT_MODIFY("P1")
1452   PORT_MODIFY("P1_A")
14791453   PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
14801454
1481   PORT_MODIFY("P2")
1455   PORT_MODIFY("P2_A")
14821456   PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
14831457
14841458   PORT_START_TAG("EXTRA1")
r2956r2957
15081482static INPUT_PORTS_START( arabfgtu )
15091483   PORT_INCLUDE( arabfgt )
15101484
1511   PORT_MODIFY("SERVICE12")
1485   PORT_MODIFY("SERVICE12_A")
15121486   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN4 )
15131487   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
15141488
r2956r2957
15211495static INPUT_PORTS_START( brival )
15221496   PORT_INCLUDE( system32_generic )
15231497
1524   PORT_MODIFY("P1")
1498   PORT_MODIFY("P1_A")
15251499   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
15261500
1527   PORT_MODIFY("P2")
1501   PORT_MODIFY("P2_A")
15281502   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
15291503
15301504   PORT_START_TAG("EXTRA2")
r2956r2957
15421516static INPUT_PORTS_START( darkedge )
15431517   PORT_INCLUDE( system32_generic )
15441518
1545   PORT_MODIFY("P1")
1519   PORT_MODIFY("P1_A")
15461520   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
15471521   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
15481522   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 )
15491523
1550   PORT_MODIFY("P2")
1524   PORT_MODIFY("P2_A")
15511525   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
15521526   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
15531527   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
r2956r2957
15721546static INPUT_PORTS_START( f1en )
15731547   PORT_INCLUDE( system32_generic )
15741548
1575   PORT_MODIFY("P1")
1549   PORT_MODIFY("P1_A")
15761550   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Gear Up")
15771551   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("Gear Down")
15781552   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
15791553
1580   PORT_MODIFY("P2")
1554   PORT_MODIFY("P2_A")
15811555   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
15821556
1583   PORT_MODIFY("SERVICE12")
1557   PORT_MODIFY("SERVICE12_A")
15841558   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
15851559   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
15861560
1587   PORT_MODIFY("SERVICE34")
1561   PORT_MODIFY("SERVICE34_A")
15881562   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
15891563   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
15901564   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
16131587static INPUT_PORTS_START( f1lap )
16141588   PORT_INCLUDE( f1en )
16151589
1616   PORT_MODIFY("P1")
1590   PORT_MODIFY("P1_A")
16171591   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Gear Up")
16181592   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("Gear Down")
16191593   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_CODE(KEYCODE_Z)
r2956r2957
16521626static INPUT_PORTS_START( ga2u )
16531627   PORT_INCLUDE( ga2 )
16541628
1655   PORT_MODIFY("SERVICE12")
1629   PORT_MODIFY("SERVICE12_A")
16561630   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN4 )
16571631   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
16581632
r2956r2957
17451719static INPUT_PORTS_START( holo )
17461720   PORT_INCLUDE( system32_generic )
17471721
1748   PORT_MODIFY("P1")
1722   PORT_MODIFY("P1_A")
17491723   PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
17501724
1751   PORT_MODIFY("P2")
1725   PORT_MODIFY("P2_A")
17521726   PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
17531727INPUT_PORTS_END
17541728
r2956r2957
17561730static INPUT_PORTS_START( jpark )
17571731   PORT_INCLUDE( system32_generic )
17581732
1759   PORT_MODIFY("P1")
1733   PORT_MODIFY("P1_A")
17601734   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
17611735
1762   PORT_MODIFY("P2")
1736   PORT_MODIFY("P2_A")
17631737   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
17641738
17651739   PORT_START_TAG("ANALOG1")
r2956r2957
18241798static INPUT_PORTS_START( radm )
18251799   PORT_INCLUDE( system32_generic )
18261800
1827   PORT_MODIFY("P1")
1801   PORT_MODIFY("P1_A")
18281802   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
18291803   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Light")
18301804   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_CODE(KEYCODE_LSHIFT) PORT_NAME("Wiper")
18311805   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
18321806
1833   PORT_MODIFY("P2")
1807   PORT_MODIFY("P2_A")
18341808   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
18351809
1836   PORT_MODIFY("SERVICE12")
1810   PORT_MODIFY("SERVICE12_A")
18371811   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
18381812   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
18391813
1840   PORT_MODIFY("SERVICE34")
1814   PORT_MODIFY("SERVICE34_A")
18411815   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
18421816   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
18431817   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
18661840static INPUT_PORTS_START( radr )
18671841   PORT_INCLUDE( system32_generic )
18681842
1869   PORT_MODIFY("P1")
1843   PORT_MODIFY("P1_A")
18701844   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Gear Change") PORT_TOGGLE
18711845   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
18721846
1873   PORT_MODIFY("P2")
1847   PORT_MODIFY("P2_A")
18741848   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
18751849
1876   PORT_MODIFY("SERVICE12")
1850   PORT_MODIFY("SERVICE12_A")
18771851   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
18781852   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
18791853
1880   PORT_MODIFY("SERVICE34")
1854   PORT_MODIFY("SERVICE34_A")
18811855   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
18821856   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
18831857   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
19351909static INPUT_PORTS_START( slipstrm )
19361910   PORT_INCLUDE( system32_generic )
19371911
1938   PORT_MODIFY("P1")
1912   PORT_MODIFY("P1_A")
19391913   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_CODE(KEYCODE_SPACE) PORT_NAME("Gear Change") PORT_TOGGLE
19401914   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
19411915
1942   PORT_MODIFY("P2")
1916   PORT_MODIFY("P2_A")
19431917   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
19441918
1945   PORT_MODIFY("SERVICE12")
1919   PORT_MODIFY("SERVICE12_A")
19461920   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
19471921   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
19481922
1949   PORT_MODIFY("SERVICE34")
1923   PORT_MODIFY("SERVICE34_A")
19501924   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
19511925   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
19521926   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
19751949static INPUT_PORTS_START( sonic )
19761950   PORT_INCLUDE( system32_generic )
19771951
1978   PORT_MODIFY("P1")
1952   PORT_MODIFY("P1_A")
19791953   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
19801954   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
19811955   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
19821956
1983   PORT_MODIFY("P2")
1957   PORT_MODIFY("P2_A")
19841958   PORT_BIT( 0xfe, IP_ACTIVE_LOW, IPT_UNUSED )
19851959
1986   PORT_MODIFY("SERVICE12")
1960   PORT_MODIFY("SERVICE12_A")
19871961   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 )
19881962   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 )
19891963
r2956r2957
20101984static INPUT_PORTS_START( spidman )
20111985   PORT_INCLUDE( system32_generic )
20121986
2013   PORT_MODIFY("P1")
1987   PORT_MODIFY("P1_A")
20141988   PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
20151989
2016   PORT_MODIFY("P2")
1990   PORT_MODIFY("P2_A")
20171991   PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
20181992
20191993   PORT_START_TAG("EXTRA1")
r2956r2957
20442018static INPUT_PORTS_START( spidmanu )
20452019   PORT_INCLUDE( spidman )
20462020
2047   PORT_MODIFY("SERVICE12")
2021   PORT_MODIFY("SERVICE12_A")
20482022   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN4 )
20492023   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN3 )
20502024
src/mame/drivers/slapfght.c
r2956r2957
183183$8609 - $860f    High score characters to display to screen for highest score
184184
185185
186****************************************************************************
187
188Stephh's notes (based on the games Z80 code and some tests) :
189
1900) all games
191
192  - All these games have a specific way of handling inputs :
193      * when cabinet is set to "Upright", any player can use inputs
194        from player 1 OR from player 2
195      * when cabinet is set to "Cocktail", each player has its own inputs
196    See Mantis bug ID 01746 attached files with Z80 explanations
197
198
1991) 'tigerh' and clones
200
2011a) 'tigerh'
202
203  - US version
204  - MCU dumped and emulated
205  - Game inputs aren't working after heliport 4 (area 35);
206    I can't tell at the moment if it's an ingame bug or not.
207    See Mantis bug ID 01785 for more details.
208
2091b) 'tigerhj'
210
211  - Japan version
212  - MCU dumped and emulated
213  - Game inputs aren't working after heliport 4 (area 35);
214    I can't tell at the moment if it's an ingame bug or not.
215    See Mantis bug ID 01785 for more details.
216
2171c) 'tigerhb1'
218
219  - Bootleg based on 'tigerhj'
220  - I can't tell if a specific MCU is required for this game :
221      * MCU status doesn't seem to be required
222        (see nop instructions at 0x10da, 0x10db, 0x10e5 and 0x10e6)
223      * there is patched code at 0x0f9c which is called instead of
224        standard call to 0x10cc, and there is no call to 0x0f88
225      * there are writes to unknown ports 0x0e and 0x0f
226      * hardware test is still computed at 0x109d but there is
227        no delay to wait for correct value (0x83) to be returned
228        (thus the need of specific read/write handlers)
229  - Game inputs aren't working after heliport 4 (area 35);
230    I can't tell at the moment if it's an ingame bug or not.
231    See Mantis bug ID 01785 for more details.
232
2331d) 'tigerhb2'
234
235  - Bootleg based on 'tigerhj'
236  - MCU reads/writes are patched.as well as ROM check
237  - Game inputs are still working after heliport 4 (area 35);
238    This is the ONLY set with this behaviour !
239    See Mantis bug ID 01785 for more details.
240
2411e) 'tigerhb3'
242
243  - Bootleg based on 'tigerhj'
244  - MCU reads/writes are patched.
245  - There is extra code at 0x10e2 (where MCU status was checked)
246    that prevents player to get any extra lives (even by collecting
247    10 diamonds) when Dip Switch is set to "20k then every 80k"
248    (see Mantis bug ID 00652 with Z80 explanations).
249  - Game inputs aren't working after heliport 4 (area 35);
250    I can't tell at the moment if it's an ingame bug or not.
251    See Mantis bug ID 01785 for more details.
252
253
2542) 'getstar' and clones
255
2562a) 'getstar'
257
258  - US version, licenced to Kitkorp - name "Guardian".
259  - MCU missing and simulated.
260  - Difficulty determines the number of energy bars you get.
261  - Each hit removes 1 enegy bar.
262  - According to the manual, default difficulty shall be set to "Hard".
263  - You can only get ONE extra life.
264  - I don't know if it's an ingame bug, but you always have to enter
265    your initials after a game ends, even if you score less than 10th place.
266
2672b) 'getstarj'
268
269  - Japan version - name "Get Star".
270  - MCU missing and simulated.
271  - You always get 4 energy bars.
272  - Difficulty determines how many energy bars you lose when you get hit.
273  - I don't know what default difficulty shall be, so I set it to "Easy".
274  - You can get multiple extra lives.
275
2762c) 'gtstarb1'
277
278  - Bootleg based on 'getstarj'
279  - MCU reads/writes are patched, but this hasn't been done in the "test mode".
280  - The game seems to have its own protection on startup (check code at 0x6d1a).
281
2822d) 'gtstarb2'
283
284  - Bootleg based on 'getstarj'
285  - MCU reads/writes are patched, but this hasn't been done in the "test mode".
286  - The game seems to have its own protection (check code at 0x0569 and 0x0ac6).
287  - Patches are coded diffrently than in 'gtstarb1' and code isn't always perfect
288    (lazy coding ?) which causes LOTS of ingames bugs or strange behaviours :
289      * patched command 0x20 : NO continue play
290      * patched command 0x21 : as soon as a player loses all his lives,
291        the game is over (even if other player still has lives)
292      * patched command 0x22 : difficulty is ALWAYS set to "Easy" at start
293        so "Difficulty" Dip Switches have no effect when you are playing
294        (it still has an effect in the "test mode" though)
295      * patched command 0x23 : different lives settings
296        (thus the need of a specific INPUT_PORTS definition for this game)
297      * patched command 0x25 : right and down directions are swapped
298        (thus the need of a specific INPUT_PORTS definition for this game)
299      * patched command 0x2a : player flag (which determines if player 1 or
300        player 2 is playing) is NOT updated, causing the following things :
301          . current player score will ALWAYS be dusplayed under player 1
302          . when cabinet is set to "Cocktail", player 2 uses player 1 inputs
303      * patched command 0x38 : laser position does NOT change according to
304        player position (it ALWATS starts from the middle of the screen)
305
186306***************************************************************************/
187307
188308#include "driver.h"
r2956r2957
191311#include "sound/ay8910.h"
192312#include "includes/slapfght.h"
193313
314int getstar_id;
315
316
194317static ADDRESS_MAP_START( perfrman_readmem, ADDRESS_SPACE_PROGRAM, 8 )
195318   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
196319   AM_RANGE(0x8000, 0x87ff) AM_READ(SMH_RAM)
r2956r2957
382505   AM_RANGE(0xd000, 0xffff) AM_WRITE(SMH_RAM)
383506ADDRESS_MAP_END
384507
385#define COMMON_START\
386   PORT_START_TAG("IN0")\
387   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY\
388   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY\
389   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY\
390   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY\
391   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL\
392   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL\
393   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL\
394   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL\
395   PORT_START_TAG("IN1")\
396   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )\
397   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )\
398   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL\
399   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL\
400   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )\
401   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )\
402   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )\
508
509static INPUT_PORTS_START( slapfght_generic )
510   PORT_START_TAG("IN0")
511   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY
512   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_8WAY
513   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
514   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  ) PORT_8WAY
515   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_COCKTAIL
516   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_8WAY PORT_COCKTAIL
517   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
518   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  ) PORT_8WAY PORT_COCKTAIL
519
520   PORT_START_TAG("IN1")
521   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
522   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
523   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
524   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
525   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
526   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
527   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
403528   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
404529
405static INPUT_PORTS_START( perfrman )
406COMMON_START
407530   PORT_START_TAG("DSW1")
408   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
409   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
410   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
411   PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
412   /* Actually, the following DIPSW doesnt seem to do anything */
413   PORT_DIPNAME( 0x20, 0x20, "Screen Test" ) PORT_CODE(KEYCODE_F1) PORT_TOGGLE
414   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
415   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
416   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) )
417   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
418   PORT_DIPSETTING(    0x10, DEF_STR( Cocktail ) )
419   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
420   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
421   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
422   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
423   PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) )
424//  PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
531   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )          PORT_DIPLOCATION("SW1:8,7,6")
532//  PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) )
533   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
425534   PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
426535   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
427536   PORT_DIPSETTING(    0x03, DEF_STR( 2C_3C ) )
428537   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
429538   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
430539   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
540   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )      PORT_DIPLOCATION("SW1:5")
541   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
542   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
543   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) )          PORT_DIPLOCATION("SW1:4")
544   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
545   PORT_DIPSETTING(    0x10, DEF_STR( Cocktail ) )
546   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) )      PORT_DIPLOCATION("SW1:3")
547   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
548   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
549   PORT_SERVICE_DIPLOC(0x40, IP_ACTIVE_LOW, "SW1:2" )
550   PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:1" )
431551
432552   PORT_START_TAG("DSW2")
433   PORT_DIPNAME( 0xf0, 0x70, DEF_STR( Bonus_Life ) )
434   PORT_DIPSETTING(    0xb0, "20k, then each 100k" )
435   PORT_DIPSETTING(    0xa0, "40k, then each 100k" )
436   PORT_DIPSETTING(    0x90, "60k, then each 100k" )
437   PORT_DIPSETTING(    0x70, "20k, then each 200k" )
438   PORT_DIPSETTING(    0x60, "40k, then each 200k" )
439   PORT_DIPSETTING(    0x50, "60k, then each 200k" )
440   PORT_DIPSETTING(    0x30, "20k, then each 300k" )
441   PORT_DIPSETTING(    0x20, "40k, then each 300k" )
442   PORT_DIPSETTING(    0x10, "60k, then each 300k" )
443   PORT_DIPSETTING(    0xf0, "20k" )
444   PORT_DIPSETTING(    0xe0, "40k" )
445   PORT_DIPSETTING(    0xd0, "60k" )
446   PORT_DIPSETTING(    0xc0, DEF_STR( None ) )
447   PORT_DIPNAME( 0x0c, 0x0c, "Game Level" )
448   PORT_DIPSETTING(    0x0c, "0" )
449   PORT_DIPSETTING(    0x08, "1" )
450   PORT_DIPSETTING(    0x04, "2" )
451   PORT_DIPSETTING(    0x00, "3" )
452   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
553   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )            PORT_DIPLOCATION("SW2:8,7")
453554   PORT_DIPSETTING(    0x01, "1" )
454555   PORT_DIPSETTING(    0x00, "2" )
455556   PORT_DIPSETTING(    0x03, "3" )
456557   PORT_DIPSETTING(    0x02, "5" )
558   PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Difficulty ) )       PORT_DIPLOCATION("SW2:6,5")
559   PORT_DIPSETTING(    0x0c, DEF_STR( Easy ) )
560   PORT_DIPSETTING(    0x08, DEF_STR( Medium ) )
561   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
562   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
563   /* Filled by "Bonus Lives" settings */
564   PORT_DIPUNUSED_DIPLOC( 0x10, IP_ACTIVE_LOW, "SW2:4" )
565   PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW2:3" )
566   PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW2:2" )
567   PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW2:1" )
457568INPUT_PORTS_END
458569
459static INPUT_PORTS_START( tigerh )
460COMMON_START
461   PORT_START_TAG("DSW1")
462   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
463   PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) )
464//  PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
465   PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
466   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
467   PORT_DIPSETTING(    0x03, DEF_STR( 2C_3C ) )
468   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
469   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
470   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
471   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
472   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
473   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
474   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) )
475   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
476   PORT_DIPSETTING(    0x10, DEF_STR( Cocktail ) )
477   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) )
570
571static INPUT_PORTS_START( perfrman )
572   PORT_INCLUDE(slapfght_generic)
573
574   PORT_MODIFY("DSW1")
575   PORT_DIPNAME( 0x20, 0x20, "Intermissions" )             PORT_DIPLOCATION("SW1:3")     /* "Screen Test" in the "test mode" */
478576   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
479577   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
480   PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
481   PORT_DIPNAME( 0x80, 0x80, "Player Speed" )
578
579   PORT_MODIFY("DSW2")
580   PORT_DIPNAME( 0xf0, 0x70, DEF_STR( Bonus_Life ) )       PORT_DIPLOCATION("SW2:4,3,2,1")
581   PORT_DIPSETTING(    0xb0, "20k, 120k, then every 100k" )
582   PORT_DIPSETTING(    0xa0, "40k, 120k, then every 100k" )
583   PORT_DIPSETTING(    0x90, "60k, 160k, then every 100k" )
584   PORT_DIPSETTING(    0x80, "Every 100k" )
585   PORT_DIPSETTING(    0x70, "20k, 220k, then every 200k" )
586   PORT_DIPSETTING(    0x60, "40k, 240k, then every 200k" )
587   PORT_DIPSETTING(    0x50, "60k, 260k, then every 200k" )
588   PORT_DIPSETTING(    0x40, "Every 200k" )
589   PORT_DIPSETTING(    0x30, "20k, 320k, then every 300k" )
590   PORT_DIPSETTING(    0x20, "40k, 340k, then every 300k" )
591   PORT_DIPSETTING(    0x10, "60k, 360k, then every 300k" )
592   PORT_DIPSETTING(    0x00, "Every 300k" )
593   PORT_DIPSETTING(    0xf0, "20k only" )
594   PORT_DIPSETTING(    0xe0, "40k only" )
595   PORT_DIPSETTING(    0xd0, "60k only" )
596   PORT_DIPSETTING(    0xc0, DEF_STR( None ) )
597INPUT_PORTS_END
598
599
600static INPUT_PORTS_START( tigerh )
601   PORT_INCLUDE(slapfght_generic)
602
603   PORT_MODIFY("DSW1")
604   PORT_DIPNAME( 0x80, 0x80, "Player Speed" )              PORT_DIPLOCATION("SW1:1")
482605   PORT_DIPSETTING(    0x80, DEF_STR( Normal ) )
483606   PORT_DIPSETTING(    0x00, "Fast" )
484607
485   PORT_START_TAG("DSW2")
486   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
608   PORT_MODIFY("DSW2")
609   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )            PORT_DIPLOCATION("SW2:8,7")
487610   PORT_DIPSETTING(    0x01, "1" )
488611   PORT_DIPSETTING(    0x00, "2" )
489612   PORT_DIPSETTING(    0x03, "3" )
490613   PORT_DIPSETTING(    0x02, "5" )
491   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
614   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )       PORT_DIPLOCATION("SW1:6,5")
492615   PORT_DIPSETTING(    0x0c, DEF_STR( Easy ) )
493616   PORT_DIPSETTING(    0x08, DEF_STR( Medium ) )
494617   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
495618   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
496   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) )
497   PORT_DIPSETTING(    0x10, "20000 80000" )
498   PORT_DIPSETTING(    0x00, "50000 120000" )
499   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
500   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
501   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
502   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
503   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
504   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
505   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
506   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
507   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
619   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) )       PORT_DIPLOCATION("SW1:4")
620   PORT_DIPSETTING(    0x10, "20k, 100k, then every 80k" )                               // see notes for 'tigerhb3'
621   PORT_DIPSETTING(    0x00, "50k, 170k, then every 120k" )
622   PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW2:3" )
623   PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW2:2" )
624   PORT_DIPUNUSED_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW2:1" )
508625INPUT_PORTS_END
509626
627
510628static INPUT_PORTS_START( slapfigh )
511COMMON_START
512   PORT_START_TAG("DSW1")
629   PORT_INCLUDE(slapfght_generic)
630
631   PORT_MODIFY("DSW1")
513632   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_B ) )
514633   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
515634   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
r2956r2957
533652   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
534653   PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) )
535654
536   PORT_START_TAG("DSW2")
655   PORT_MODIFY("DSW2")
537656   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
538657   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
539658   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
557676
558677
559678static INPUT_PORTS_START( getstar )
560   PORT_START_TAG("IN0")
561   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
562   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
563   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
564   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
565   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
566   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
567   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
568   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
569   PORT_START_TAG("IN1")
570   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
571   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
572   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
573   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
574   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
575   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
576   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
577   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
679   PORT_INCLUDE(slapfght_generic)
578680
579   PORT_START_TAG("DSW1")
580   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
581   PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) )
582//  PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
583   PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
584   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
585   PORT_DIPSETTING(    0x03, DEF_STR( 2C_3C ) )
586   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
587   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
588   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
589   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
590   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
591   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
592   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) )
593   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
594   PORT_DIPSETTING(    0x10, DEF_STR( Cocktail ) )
595   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) )
596   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
597   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
598   PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
599   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
600   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
601   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
681   PORT_MODIFY("DSW2")
682   /* harder default difficulty (confirmed by manual) */
683   PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Difficulty ) )       PORT_DIPLOCATION("SW2:6,5")
684   PORT_DIPSETTING(    0x0c, DEF_STR( Easy ) )
685   PORT_DIPSETTING(    0x08, DEF_STR( Medium ) )
686   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
687   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
688   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) )       PORT_DIPLOCATION("SW2:4,3")
689   PORT_DIPSETTING(    0x30, "50k only" )
690   PORT_DIPSETTING(    0x20, "100k only" )
691   PORT_DIPSETTING(    0x10, "150k only" )
692   PORT_DIPSETTING(    0x00, "200k only" )
693INPUT_PORTS_END
602694
603   PORT_START_TAG("DSW2")
604   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
605   PORT_DIPSETTING(    0x02, "3" )
606   PORT_DIPSETTING(    0x01, "4" )
607   PORT_DIPSETTING(    0x00, "5" )
608   PORT_DIPSETTING(    0x03, "240 (Cheat)")
609   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
695static INPUT_PORTS_START( getstarj )
696   PORT_INCLUDE(getstar)
697
698   /* easier default difficulty (to be confirmed) and different bonus lives settings */
699   PORT_MODIFY("DSW2")
700   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )       PORT_DIPLOCATION("SW2:6,5")
610701   PORT_DIPSETTING(    0x0c, DEF_STR( Easy ) )
611702   PORT_DIPSETTING(    0x08, DEF_STR( Medium ) )
612703   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
613704   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
614   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) )
615   PORT_DIPSETTING(    0x10, "30000 100000" )
616   PORT_DIPSETTING(    0x00, "50000 150000" )
617   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
618   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
619   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
620   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
621   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
622   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
623   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
624   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
625   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
705   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) )       PORT_DIPLOCATION("SW2:4")
706   PORT_DIPSETTING(    0x10, "30k, 130k, then every 100k" )
707   PORT_DIPSETTING(    0x00, "50k, 200k, then every 150k" )
708   PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW2:3" )
626709INPUT_PORTS_END
627710
628static INPUT_PORTS_START( gtstarba )
629   PORT_START_TAG("IN0")
630   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
631   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
632   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
633   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
634   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
635   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
636   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
637   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
638   PORT_START_TAG("IN1")
639   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
640   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
641   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
642   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
643   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
644   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
645   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
646   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
711static INPUT_PORTS_START( gtstarb2 )
712   PORT_INCLUDE(getstarj)
647713
648   PORT_START_TAG("DSW1")
649   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
650   PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) )
651//  PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
652   PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
653   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
654   PORT_DIPSETTING(    0x03, DEF_STR( 2C_3C ) )
655   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
656   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
657   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
658   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
659   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
660   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
661   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) )
662   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
663   PORT_DIPSETTING(    0x10, DEF_STR( Cocktail ) )
664   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) )
665   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
666   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
667   PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
668   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
669   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
670   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
714   /* RIGHT and DOWN are swapped due to code at 0x0551 */
715   PORT_MODIFY("IN0")
716   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
717   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_8WAY
718   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
719   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_8WAY PORT_COCKTAIL
671720
672   PORT_START_TAG("DSW2")
673   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
721   /* different lives settings due to code at 0x0e36 */
722   PORT_MODIFY("DSW2")
723   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )            PORT_DIPLOCATION("SW2:8,7")
674724   PORT_DIPSETTING(    0x02, "3" )
675725   PORT_DIPSETTING(    0x01, "4" )
676726   PORT_DIPSETTING(    0x00, "5" )
677727   PORT_DIPSETTING(    0x03, "240 (Cheat)")
678   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
679   PORT_DIPSETTING(    0x0c, DEF_STR( Easy ) )
680   PORT_DIPSETTING(    0x08, DEF_STR( Medium ) )
681   PORT_DIPSETTING(    0x04, DEF_STR( Hard ) )
682   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
683   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Bonus_Life ) )
684   PORT_DIPSETTING(    0x10, "30000 100000" )
685   PORT_DIPSETTING(    0x00, "50000 150000" )
686   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
687   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
688   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
689   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
690   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
691   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
692   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
693   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
694   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
728   /* difficulty settings have no effect due to code at 0x0e7c */
729   /* I don't mark the Dips as "unused" because they are still read in the "test mode" */
695730INPUT_PORTS_END
696731
697732
r2956r2957
935970   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
936971MACHINE_DRIVER_END
937972
973
938974static MACHINE_DRIVER_START( slapfigh )
939975
940976   /* basic machine hardware */
r2956r2957
9811017   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
9821018MACHINE_DRIVER_END
9831019
984
9851020/* identical to slapfigh_ but writemem has different scroll registers */
9861021static MACHINE_DRIVER_START( slapbtuk )
9871022
r2956r2957
10871122   ROM_LOAD( "pal16r4a.2e", 0x0000, 0x0104, NO_DUMP ) /* PAL is read protected */
10881123ROM_END
10891124
1090ROM_START( tigerh2 )
1125ROM_START( tigerhj )
10911126   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1092   ROM_LOAD( "b0.5",         0x00000, 0x4000, CRC(6ae7e13c) SHA1(47ef34635f8648e883a850293d92a46e95976a50) )
1127   ROM_LOAD( "a47_00.bin",   0x00000, 0x4000, CRC(cbdbe3cc) SHA1(5badf76cdf4a7f0ae9e85ee602420ba5c128efef) )
10931128   ROM_LOAD( "a47_01.bin",   0x04000, 0x4000, CRC(65df2152) SHA1(8e1516905a4af379cb0d0b9d42ff1cc3179c3589) )
10941129   ROM_LOAD( "a47_02.bin",   0x08000, 0x4000, CRC(633d324b) SHA1(70a17d17ebe003bfb2246e92e925a343a92553e5) )
10951130
r2956r2957
10971132   ROM_LOAD( "a47_03.bin",   0x0000,  0x2000, CRC(d105260f) SHA1(f6a0e393e29354bb37fb723828f3267d030a45ea) )
10981133
10991134   ROM_REGION( 0x0800, REGION_CPU3, 0 )
1100   /* is this the right mcu for this set? the mcu handling code in the roms seems patched and it doesn't
1101       work correctly */
11021135   ROM_LOAD( "a47_14.6a",   0x0000, 0x0800, CRC(4042489f) SHA1(b977e0821b6b1aa5a0a0f349cd78150af1a231df) )
11031136
11041137   ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )
r2956r2957
11231156   ROM_LOAD( "82s129.12n",   0x0200,  0x0100, CRC(25f273f2) SHA1(2c696745f42fa09b64295a39536aeba08ab58d67) )
11241157ROM_END
11251158
1126ROM_START( tigerhj )
1159ROM_START( tigerhb1 )
11271160   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1128   ROM_LOAD( "a47_00.bin",   0x00000, 0x4000, CRC(cbdbe3cc) SHA1(5badf76cdf4a7f0ae9e85ee602420ba5c128efef) )
1161   ROM_LOAD( "b0.5",         0x00000, 0x4000, CRC(6ae7e13c) SHA1(47ef34635f8648e883a850293d92a46e95976a50) )
11291162   ROM_LOAD( "a47_01.bin",   0x04000, 0x4000, CRC(65df2152) SHA1(8e1516905a4af379cb0d0b9d42ff1cc3179c3589) )
11301163   ROM_LOAD( "a47_02.bin",   0x08000, 0x4000, CRC(633d324b) SHA1(70a17d17ebe003bfb2246e92e925a343a92553e5) )
11311164
11321165   ROM_REGION( 0x10000, REGION_CPU2, 0 )
11331166   ROM_LOAD( "a47_03.bin",   0x0000,  0x2000, CRC(d105260f) SHA1(f6a0e393e29354bb37fb723828f3267d030a45ea) )
11341167
1135   ROM_REGION( 0x0800, REGION_CPU3, 0 )
1136   ROM_LOAD( "a47_14.6a",   0x0000, 0x0800, CRC(4042489f) SHA1(b977e0821b6b1aa5a0a0f349cd78150af1a231df) )
1168   ROM_REGION( 0x0800, REGION_CPU3, ROMREGION_ERASEFF ) // probably doesn't have an MCU
1169   /* is this the right mcu for this set? the mcu handling code in the roms seems patched and it doesn't work correctly */
1170//  ROM_LOAD( "a47_14.6a",   0x0000, 0x0800, CRC(4042489f) SHA1(b977e0821b6b1aa5a0a0f349cd78150af1a231df) )
11371171
11381172   ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )
11391173   ROM_LOAD( "a47_05.bin",   0x00000, 0x2000, CRC(c5325b49) SHA1(6df9051e7545dcac4995340f80957510457aaf64) )  /* Chars */
r2956r2957
11571191   ROM_LOAD( "82s129.12n",   0x0200,  0x0100, CRC(25f273f2) SHA1(2c696745f42fa09b64295a39536aeba08ab58d67) )
11581192ROM_END
11591193
1160ROM_START( tigerhb1 )
1194ROM_START( tigerhb2 )
11611195   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1162   ROM_LOAD( "14",           0x00000, 0x4000, CRC(ca59dd73) SHA1(c07961fcc209ec10ace3830d79c8ccc1cfda9765) )
1163   ROM_LOAD( "13",           0x04000, 0x4000, CRC(38bd54db) SHA1(75e999f606c410d7481bc4d29c4b523d45847649) )
1164   ROM_LOAD( "a47_02.bin",   0x08000, 0x4000, CRC(633d324b) SHA1(70a17d17ebe003bfb2246e92e925a343a92553e5) )
1196   ROM_LOAD( "rom00_09.bin", 0x00000, 0x4000, CRC(ef738c68) SHA1(c78c802d885b7f7c5e312ec079d52b8817590735) )
1197   ROM_LOAD( "a47_01.bin",   0x04000, 0x4000, CRC(65df2152) SHA1(8e1516905a4af379cb0d0b9d42ff1cc3179c3589) )
1198   ROM_LOAD( "rom02_07.bin", 0x08000, 0x4000, CRC(36e250b9) SHA1(79bd86bde81981e4d0dbee420bc0a10c80b5241e) )
11651199
11661200   ROM_REGION( 0x10000, REGION_CPU2, 0 )
11671201   ROM_LOAD( "a47_03.bin",   0x0000,  0x2000, CRC(d105260f) SHA1(f6a0e393e29354bb37fb723828f3267d030a45ea) )
r2956r2957
11881222   ROM_LOAD( "82s129.12n",   0x0200,  0x0100, CRC(25f273f2) SHA1(2c696745f42fa09b64295a39536aeba08ab58d67) )
11891223ROM_END
11901224
1191ROM_START( tigerhb2 )
1225ROM_START( tigerhb3 )
11921226   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1193   ROM_LOAD( "rom00_09.bin", 0x00000, 0x4000, CRC(ef738c68) SHA1(c78c802d885b7f7c5e312ec079d52b8817590735) )
1194   ROM_LOAD( "a47_01.bin",   0x04000, 0x4000, CRC(65df2152) SHA1(8e1516905a4af379cb0d0b9d42ff1cc3179c3589) )
1195   ROM_LOAD( "rom02_07.bin", 0x08000, 0x4000, CRC(36e250b9) SHA1(79bd86bde81981e4d0dbee420bc0a10c80b5241e) )
1227   ROM_LOAD( "14",           0x00000, 0x4000, CRC(ca59dd73) SHA1(c07961fcc209ec10ace3830d79c8ccc1cfda9765) )
1228   ROM_LOAD( "13",           0x04000, 0x4000, CRC(38bd54db) SHA1(75e999f606c410d7481bc4d29c4b523d45847649) )
1229   ROM_LOAD( "a47_02.bin",   0x08000, 0x4000, CRC(633d324b) SHA1(70a17d17ebe003bfb2246e92e925a343a92553e5) )
11961230
11971231   ROM_REGION( 0x10000, REGION_CPU2, 0 )
11981232   ROM_LOAD( "a47_03.bin",   0x0000,  0x2000, CRC(d105260f) SHA1(f6a0e393e29354bb37fb723828f3267d030a45ea) )
r2956r2957
12551289/* dump labeled Alcon, but GFX in tile roms clearly read Slap Fight */
12561290ROM_START( slapfiga )
12571291   ROM_REGION( 0x18000, REGION_CPU1, 0 )
1258   ROM_LOAD( "a76-00.bin", 0x00000, 0x4000, CRC(ac22bb86) SHA1(3ecff006fc487d494f21adb7bff6f8c56eb5d707) )
1259   ROM_LOAD( "a76-01.bin", 0x04000, 0x4000, CRC(d6b4f02e) SHA1(37f840c444ba7dcc75810580c9da83289670d5cc) )
1260   ROM_LOAD( "a76-02.bin", 0x10000, 0x8000, CRC(9dd0971f) SHA1(92bd0b54635bf5c4118a53e0f897c65f5eb2984a) )   /* banked at 8000 */
1292   ROM_LOAD( "a76-00.bin",   0x00000, 0x4000, CRC(ac22bb86) SHA1(3ecff006fc487d494f21adb7bff6f8c56eb5d707) )
1293   ROM_LOAD( "a76-01.bin",   0x04000, 0x4000, CRC(d6b4f02e) SHA1(37f840c444ba7dcc75810580c9da83289670d5cc) )
1294   ROM_LOAD( "a76-02.bin",   0x10000, 0x8000, CRC(9dd0971f) SHA1(92bd0b54635bf5c4118a53e0f897c65f5eb2984a) )   /* banked at 8000 */
12611295
12621296   ROM_REGION( 0x10000, REGION_CPU2, 0 )
12631297   ROM_LOAD( "a76-03.bin",   0x0000,  0x2000, CRC(87f4705a) SHA1(a90d5644ce268f3321047a4f96df96ac294d2f1b) )
r2956r2957
12871321   ROM_LOAD( "sf_col19.bin", 0x0200,  0x0100, CRC(5cbf9fbf) SHA1(abfa58fa4e44ebc56f2e0fac9bcc36164c845fa3) )
12881322ROM_END
12891323
1290ROM_START( slapbtjp )
1324ROM_START( alcon )
12911325   ROM_REGION( 0x18000, REGION_CPU1, 0 )
1292   ROM_LOAD( "sf_r19jb.bin", 0x00000, 0x8000, CRC(9a7ac8b3) SHA1(01fbad9b4fc80f2406eff18db20e196e212d0c17) )
1293   ROM_LOAD( "sf_rh.bin",    0x10000, 0x8000, CRC(3c42e4a7) SHA1(8e4da1e6e73603e484ba4f5609ac9ea92999a526) )   /* banked at 8000 */
1326   ROM_LOAD( "00",           0x00000, 0x8000, CRC(2ba82d60) SHA1(b37659aa18a3f96a3cc7fa93db2439f36487b8c8) )
1327   ROM_LOAD( "01",           0x10000, 0x8000, CRC(18bb2f12) SHA1(7c16d4bbb8b5e22f227aff170e5e6326c5968968) )   /* banked at 8000 */
12941328
12951329   ROM_REGION( 0x10000, REGION_CPU2, 0 )
12961330   ROM_LOAD( "sf_r05.bin",   0x0000,  0x2000, CRC(87f4705a) SHA1(a90d5644ce268f3321047a4f96df96ac294d2f1b) )
12971331
1332   ROM_REGION( 0x0800, REGION_CPU3, 0 )   /* 2k for the microcontroller */
1333   ROM_LOAD( "68705.bin",    0x0000,  0x0800, NO_DUMP )
1334
12981335   ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )
1299   ROM_LOAD( "sf_r11.bin",   0x00000, 0x2000, CRC(2ac7b943) SHA1(d0c3560bb1f0c2647aeff807cb4b09450237b955) )  /* Chars */
1300   ROM_LOAD( "sf_r10.bin",   0x02000, 0x2000, CRC(33cadc93) SHA1(59ffc206c62a651d2ac0ef52f519dd56edf2c021) )
1336   ROM_LOAD( "04",           0x00000, 0x2000, CRC(31003483) SHA1(7014ceb6313ac5a3d2dcb735643dfd8bfabaa185) )  /* Chars */
1337   ROM_LOAD( "03",           0x02000, 0x2000, CRC(404152c0) SHA1(d05bc9baa1f336475fffc2f19f1018e9f0547f10) )
13011338
13021339   ROM_REGION( 0x20000, REGION_GFX2, ROMREGION_DISPOSE )
13031340   ROM_LOAD( "sf_r06.bin",   0x00000, 0x8000, CRC(b6358305) SHA1(c7bb4236a75ec6b88f011bc30f8fb9a718e2ca3e) )  /* Tiles */
r2956r2957
13171354   ROM_LOAD( "sf_col19.bin", 0x0200,  0x0100, CRC(5cbf9fbf) SHA1(abfa58fa4e44ebc56f2e0fac9bcc36164c845fa3) )
13181355ROM_END
13191356
1320ROM_START( slapbtuk )
1357ROM_START( slapbtjp )
13211358   ROM_REGION( 0x18000, REGION_CPU1, 0 )
1322   ROM_LOAD( "sf_r19eb.bin", 0x00000, 0x4000, CRC(2efe47af) SHA1(69ce3e83a0d8fa5ee4737c741d31cf32db6b9919) )
1323   ROM_LOAD( "sf_r20eb.bin", 0x04000, 0x4000, CRC(f42c7951) SHA1(d76e7a72f6ced67b550ba68cd42987f7111f5468) )
1359   ROM_LOAD( "sf_r19jb.bin", 0x00000, 0x8000, CRC(9a7ac8b3) SHA1(01fbad9b4fc80f2406eff18db20e196e212d0c17) )
13241360   ROM_LOAD( "sf_rh.bin",    0x10000, 0x8000, CRC(3c42e4a7) SHA1(8e4da1e6e73603e484ba4f5609ac9ea92999a526) )   /* banked at 8000 */
13251361
13261362   ROM_REGION( 0x10000, REGION_CPU2, 0 )
r2956r2957
13481384   ROM_LOAD( "sf_col19.bin", 0x0200,  0x0100, CRC(5cbf9fbf) SHA1(abfa58fa4e44ebc56f2e0fac9bcc36164c845fa3) )
13491385ROM_END
13501386
1351/* very similar to slapbtuk, is slapbtuk missing the logo rom? */
1352ROM_START( slapfgtr )
1387ROM_START( slapbtuk )
13531388   ROM_REGION( 0x18000, REGION_CPU1, 0 )
1354   ROM_LOAD( "k1-10.u90", 0x00000, 0x4000, CRC(2efe47af) SHA1(69ce3e83a0d8fa5ee4737c741d31cf32db6b9919) )
1355   ROM_LOAD( "k1-09.u89", 0x04000, 0x4000, CRC(17c187c5) SHA1(6e1fd651f56036d1c6c830de8479df25fc182c10) )
1356   ROM_LOAD( "k1-08.u88", 0x0e000, 0x2000, CRC(945af97f) SHA1(4d901be477b6101338eb1d86497e1bdc57f9c1b4) ) // contains another copy of the logo tilemap read at ec00!
1357   ROM_LOAD( "k1-07.u87",    0x10000, 0x8000, CRC(3c42e4a7) SHA1(8e4da1e6e73603e484ba4f5609ac9ea92999a526) )   /* banked at 8000 */
1389   ROM_LOAD( "sf_r19eb.bin", 0x00000, 0x4000, CRC(2efe47af) SHA1(69ce3e83a0d8fa5ee4737c741d31cf32db6b9919) )
1390   ROM_LOAD( "sf_r20eb.bin", 0x04000, 0x4000, CRC(f42c7951) SHA1(d76e7a72f6ced67b550ba68cd42987f7111f5468) )
1391   ROM_LOAD( "sf_rh.bin",    0x10000, 0x8000, CRC(3c42e4a7) SHA1(8e4da1e6e73603e484ba4f5609ac9ea92999a526) )   /* banked at 8000 */
13581392
13591393   ROM_REGION( 0x10000, REGION_CPU2, 0 )
1360   ROM_LOAD( "k1-11.u89",   0x0000,  0x2000, CRC(87f4705a) SHA1(a90d5644ce268f3321047a4f96df96ac294d2f1b) )
1394   ROM_LOAD( "sf_r05.bin",   0x0000,  0x2000, CRC(87f4705a) SHA1(a90d5644ce268f3321047a4f96df96ac294d2f1b) )
13611395
13621396   ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )
1363   ROM_LOAD( "k1-02.u57",   0x00000, 0x2000, CRC(2ac7b943) SHA1(d0c3560bb1f0c2647aeff807cb4b09450237b955) )  /* Chars */
1364   ROM_LOAD( "k1-03.u58",   0x02000, 0x2000, CRC(33cadc93) SHA1(59ffc206c62a651d2ac0ef52f519dd56edf2c021) )
1397   ROM_LOAD( "sf_r11.bin",   0x00000, 0x2000, CRC(2ac7b943) SHA1(d0c3560bb1f0c2647aeff807cb4b09450237b955) )  /* Chars */
1398   ROM_LOAD( "sf_r10.bin",   0x02000, 0x2000, CRC(33cadc93) SHA1(59ffc206c62a651d2ac0ef52f519dd56edf2c021) )
13651399
13661400   ROM_REGION( 0x20000, REGION_GFX2, ROMREGION_DISPOSE )
1367   ROM_LOAD( "k1-01.u49",   0x00000, 0x8000, CRC(b6358305) SHA1(c7bb4236a75ec6b88f011bc30f8fb9a718e2ca3e) )  /* Tiles */
1368   ROM_LOAD( "k1-04.u62",   0x08000, 0x8000, CRC(e92d9d60) SHA1(2554617e0e6615ca8c85a49299a4a0e762478339) )
1369   ROM_LOAD( "k1-05.u63",   0x10000, 0x8000, CRC(5faeeea3) SHA1(696fba24bcf1f3a7e914a4403854da5eededaf7f) )
1370   ROM_LOAD( "k1-06.u64",   0x18000, 0x8000, CRC(974e2ea9) SHA1(3840550fc3a833828dad8f3e300d2ea583d69ce7) )
1401   ROM_LOAD( "sf_r06.bin",   0x00000, 0x8000, CRC(b6358305) SHA1(c7bb4236a75ec6b88f011bc30f8fb9a718e2ca3e) )  /* Tiles */
1402   ROM_LOAD( "sf_r09.bin",   0x08000, 0x8000, CRC(e92d9d60) SHA1(2554617e0e6615ca8c85a49299a4a0e762478339) )
1403   ROM_LOAD( "sf_r08.bin",   0x10000, 0x8000, CRC(5faeeea3) SHA1(696fba24bcf1f3a7e914a4403854da5eededaf7f) )
1404   ROM_LOAD( "sf_r07.bin",   0x18000, 0x8000, CRC(974e2ea9) SHA1(3840550fc3a833828dad8f3e300d2ea583d69ce7) )
13711405
13721406   ROM_REGION( 0x20000, REGION_GFX3, ROMREGION_DISPOSE )
1373   ROM_LOAD( "k1-15.u60",   0x00000, 0x8000, CRC(8545d397) SHA1(9a1fd5bfd8fb830b8e46643c08eef32ba968fc23) )  /* Sprites */
1374   ROM_LOAD( "k1-13.u50",   0x08000, 0x8000, CRC(b1b7b925) SHA1(199b0b52bbeb384211171eca5c50a1c0ebf6826f) )
1375   ROM_LOAD( "k1-14.u59",   0x10000, 0x8000, CRC(422d946b) SHA1(c251ef9597a11ec8de39be4fcbddaba84e649ef2) )
1376   ROM_LOAD( "k1-12.u49",   0x18000, 0x8000, CRC(587113ae) SHA1(90abe961494a1af7c87693a419fbabf7a58a5dee) )
1407   ROM_LOAD( "sf_r03.bin",   0x00000, 0x8000, CRC(8545d397) SHA1(9a1fd5bfd8fb830b8e46643c08eef32ba968fc23) )  /* Sprites */
1408   ROM_LOAD( "sf_r01.bin",   0x08000, 0x8000, CRC(b1b7b925) SHA1(199b0b52bbeb384211171eca5c50a1c0ebf6826f) )
1409   ROM_LOAD( "sf_r04.bin",   0x10000, 0x8000, CRC(422d946b) SHA1(c251ef9597a11ec8de39be4fcbddaba84e649ef2) )
1410   ROM_LOAD( "sf_r02.bin",   0x18000, 0x8000, CRC(587113ae) SHA1(90abe961494a1af7c87693a419fbabf7a58a5dee) )
13771411
13781412   ROM_REGION( 0x0300, REGION_PROMS, 0 )
13791413   ROM_LOAD( "sf_col21.bin", 0x0000,  0x0100, CRC(a0efaf99) SHA1(5df01663480acad1f89abab8662d437617a66d1c) )
r2956r2957
13811415   ROM_LOAD( "sf_col19.bin", 0x0200,  0x0100, CRC(5cbf9fbf) SHA1(abfa58fa4e44ebc56f2e0fac9bcc36164c845fa3) )
13821416ROM_END
13831417
1384ROM_START( alcon )
1418/* very similar to slapbtuk, is slapbtuk missing the logo rom? */
1419ROM_START( slapfgtr )
13851420   ROM_REGION( 0x18000, REGION_CPU1, 0 )
1386   ROM_LOAD( "00",           0x00000, 0x8000, CRC(2ba82d60) SHA1(b37659aa18a3f96a3cc7fa93db2439f36487b8c8) )
1387   ROM_LOAD( "01",           0x10000, 0x8000, CRC(18bb2f12) SHA1(7c16d4bbb8b5e22f227aff170e5e6326c5968968) )   /* banked at 8000 */
1421   ROM_LOAD( "k1-10.u90",    0x00000, 0x4000, CRC(2efe47af) SHA1(69ce3e83a0d8fa5ee4737c741d31cf32db6b9919) )
1422   ROM_LOAD( "k1-09.u89",    0x04000, 0x4000, CRC(17c187c5) SHA1(6e1fd651f56036d1c6c830de8479df25fc182c10) )
1423   ROM_LOAD( "k1-08.u88",    0x0e000, 0x2000, CRC(945af97f) SHA1(4d901be477b6101338eb1d86497e1bdc57f9c1b4) ) // contains another copy of the logo tilemap read at ec00!
1424   ROM_LOAD( "k1-07.u87",    0x10000, 0x8000, CRC(3c42e4a7) SHA1(8e4da1e6e73603e484ba4f5609ac9ea92999a526) )   /* banked at 8000 */
13881425
13891426   ROM_REGION( 0x10000, REGION_CPU2, 0 )
1390   ROM_LOAD( "sf_r05.bin",   0x0000,  0x2000, CRC(87f4705a) SHA1(a90d5644ce268f3321047a4f96df96ac294d2f1b) )
1427   ROM_LOAD( "k1-11.u89",    0x0000,  0x2000, CRC(87f4705a) SHA1(a90d5644ce268f3321047a4f96df96ac294d2f1b) )
13911428
1392   ROM_REGION( 0x0800, REGION_CPU3, 0 )   /* 2k for the microcontroller */
1393   ROM_LOAD( "68705.bin",    0x0000,  0x0800, NO_DUMP )
1394
13951429   ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )
1396   ROM_LOAD( "04",           0x00000, 0x2000, CRC(31003483) SHA1(7014ceb6313ac5a3d2dcb735643dfd8bfabaa185) )  /* Chars */
1397   ROM_LOAD( "03",           0x02000, 0x2000, CRC(404152c0) SHA1(d05bc9baa1f336475fffc2f19f1018e9f0547f10) )
1430   ROM_LOAD( "k1-02.u57",    0x00000, 0x2000, CRC(2ac7b943) SHA1(d0c3560bb1f0c2647aeff807cb4b09450237b955) )  /* Chars */
1431   ROM_LOAD( "k1-03.u58",    0x02000, 0x2000, CRC(33cadc93) SHA1(59ffc206c62a651d2ac0ef52f519dd56edf2c021) )
13981432
13991433   ROM_REGION( 0x20000, REGION_GFX2, ROMREGION_DISPOSE )
1400   ROM_LOAD( "sf_r06.bin",   0x00000, 0x8000, CRC(b6358305) SHA1(c7bb4236a75ec6b88f011bc30f8fb9a718e2ca3e) )  /* Tiles */
1401   ROM_LOAD( "sf_r09.bin",   0x08000, 0x8000, CRC(e92d9d60) SHA1(2554617e0e6615ca8c85a49299a4a0e762478339) )
1402   ROM_LOAD( "sf_r08.bin",   0x10000, 0x8000, CRC(5faeeea3) SHA1(696fba24bcf1f3a7e914a4403854da5eededaf7f) )
1403   ROM_LOAD( "sf_r07.bin",   0x18000, 0x8000, CRC(974e2ea9) SHA1(3840550fc3a833828dad8f3e300d2ea583d69ce7) )
1434   ROM_LOAD( "k1-01.u49",    0x00000, 0x8000, CRC(b6358305) SHA1(c7bb4236a75ec6b88f011bc30f8fb9a718e2ca3e) )  /* Tiles */
1435   ROM_LOAD( "k1-04.u62",    0x08000, 0x8000, CRC(e92d9d60) SHA1(2554617e0e6615ca8c85a49299a4a0e762478339) )
1436   ROM_LOAD( "k1-05.u63",    0x10000, 0x8000, CRC(5faeeea3) SHA1(696fba24bcf1f3a7e914a4403854da5eededaf7f) )
1437   ROM_LOAD( "k1-06.u64",    0x18000, 0x8000, CRC(974e2ea9) SHA1(3840550fc3a833828dad8f3e300d2ea583d69ce7) )
14041438
14051439   ROM_REGION( 0x20000, REGION_GFX3, ROMREGION_DISPOSE )
1406   ROM_LOAD( "sf_r03.bin",   0x00000, 0x8000, CRC(8545d397) SHA1(9a1fd5bfd8fb830b8e46643c08eef32ba968fc23) )  /* Sprites */
1407   ROM_LOAD( "sf_r01.bin",   0x08000, 0x8000, CRC(b1b7b925) SHA1(199b0b52bbeb384211171eca5c50a1c0ebf6826f) )
1408   ROM_LOAD( "sf_r04.bin",   0x10000, 0x8000, CRC(422d946b) SHA1(c251ef9597a11ec8de39be4fcbddaba84e649ef2) )
1409   ROM_LOAD( "sf_r02.bin",   0x18000, 0x8000, CRC(587113ae) SHA1(90abe961494a1af7c87693a419fbabf7a58a5dee) )
1440   ROM_LOAD( "k1-15.u60",    0x00000, 0x8000, CRC(8545d397) SHA1(9a1fd5bfd8fb830b8e46643c08eef32ba968fc23) )  /* Sprites */
1441   ROM_LOAD( "k1-13.u50",    0x08000, 0x8000, CRC(b1b7b925) SHA1(199b0b52bbeb384211171eca5c50a1c0ebf6826f) )
1442   ROM_LOAD( "k1-14.u59",    0x10000, 0x8000, CRC(422d946b) SHA1(c251ef9597a11ec8de39be4fcbddaba84e649ef2) )
1443   ROM_LOAD( "k1-12.u49",    0x18000, 0x8000, CRC(587113ae) SHA1(90abe961494a1af7c87693a419fbabf7a58a5dee) )
14101444
14111445   ROM_REGION( 0x0300, REGION_PROMS, 0 )
14121446   ROM_LOAD( "sf_col21.bin", 0x0000,  0x0100, CRC(a0efaf99) SHA1(5df01663480acad1f89abab8662d437617a66d1c) )
r2956r2957
14771511   ROM_LOAD( "a68-10",       0x18000, 0x8000, CRC(83161ed0) SHA1(a6aa28f22f487dc3a2ec07935e6d42bcdd1eff81) )
14781512
14791513   ROM_REGION( 0x0300, REGION_PROMS, 0 )
1480   ROM_LOAD( "rom21",        0x0000, 0x0100, CRC(d6360b4d) SHA1(3e64548c82a3378fc091e104cdc2b0c7e592fc44) )
1481   ROM_LOAD( "rom20",        0x0100, 0x0100, CRC(4ca01887) SHA1(2892c89d5e60f1d10593adffff55c1a9654e8209) )
1482   ROM_LOAD( "rom19",        0x0200, 0x0100, CRC(513224f0) SHA1(15b34612206138f6fc5f7478925b1fff2ed56aa8) )
1514   ROM_LOAD( "rom21",        0x0000,  0x0100, CRC(d6360b4d) SHA1(3e64548c82a3378fc091e104cdc2b0c7e592fc44) )
1515   ROM_LOAD( "rom20",        0x0100,  0x0100, CRC(4ca01887) SHA1(2892c89d5e60f1d10593adffff55c1a9654e8209) )
1516   ROM_LOAD( "rom19",        0x0200,  0x0100, CRC(513224f0) SHA1(15b34612206138f6fc5f7478925b1fff2ed56aa8) )
14831517ROM_END
14841518
1485ROM_START( getstarb )
1519ROM_START( gtstarb1 )
14861520   ROM_REGION( 0x18000, REGION_CPU1, 0 )      /* Region 0 - main cpu code */
1487   ROM_LOAD( "gs_14.rom",    0x00000, 0x4000, CRC(1a57a920) SHA1(b1e9d5b29c0e3632eec3ad1ee51bf3392e4b816d) )
1488   ROM_LOAD( "gs_13.rom",    0x04000, 0x4000, CRC(805f8e77) SHA1(c3ad6eae842d2d10f716998d5a803038fa7b338f) )
1489   ROM_LOAD( "a68_02.bin",   0x10000, 0x8000, CRC(3567da17) SHA1(29d698606d0bd30abfc3171d79bfad95b0de89fc) )
1521   ROM_LOAD( "gs_rb_1.bin",  0x00000, 0x4000, CRC(9afad7e0) SHA1(6b2e82a6b7fcbfed5f4d250959ecc571fdf0cbc2) )
1522   ROM_LOAD( "gs_rb_2.bin",  0x04000, 0x4000, CRC(5feb0a60) SHA1(b1300055180ddf6ca96475eb3a27a17722273fc6) )
1523   ROM_LOAD( "gs_rb_3.bin",  0x10000, 0x8000, CRC(e3cfb1ba) SHA1(bd21655c82a14e18ff9df4539c4d0bb2484c73f1) )
14901524
14911525   ROM_REGION( 0x10000, REGION_CPU2, 0 )      /* Region 3 - sound cpu code */
1492   ROM_LOAD( "a68-03",       0x0000, 0x2000, CRC(18daa44c) SHA1(1a3d22a186c591321d1b836ee30d89fba4771122) )
1526   ROM_LOAD( "a68-03",       0x00000, 0x2000, CRC(18daa44c) SHA1(1a3d22a186c591321d1b836ee30d89fba4771122) )
14931527
14941528   ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )   /* Region 1 - temporary for gfx */
1529   /* these roms were in the set, but they're corrupt */
1530//  ROM_LOAD( "gs_rb_8.bin",  0x00000, 0x2000, CRC(a30aaf04) SHA1(2509554c3851a68eaec1cadc01f4d69c7aa2c09d) )  /* Chars */
1531//  ROM_LOAD( "gs_rb_7.bin",  0x02000, 0x2000, CRC(f47a93c6) SHA1(441fee1fb195bb2583d220f30dfcff617a31742a) )
1532   /* use the original roms instead */
14951533   ROM_LOAD( "a68_05.bin",   0x00000, 0x2000, CRC(e3d409e7) SHA1(0b6be4767f110729f4dd1a472ef8d9a0c718b684) )  /* Chars */
14961534   ROM_LOAD( "a68_04.bin",   0x02000, 0x2000, CRC(6e5ac9d4) SHA1(74f90b7a1ceb3b1c2fd92dff100d92dea0155530) )
14971535
1536
14981537   ROM_REGION( 0x20000, REGION_GFX2, ROMREGION_DISPOSE )   /* Region 1 - temporary for gfx */
14991538   ROM_LOAD( "a68_09",       0x00000, 0x8000, CRC(a293cc2e) SHA1(a2c2598e92982d13b51cbb6efb4b963142233433) )  /* Tiles */
15001539   ROM_LOAD( "a68_08",       0x08000, 0x8000, CRC(37662375) SHA1(46ba8a3f0b553d476ecf431d0d20556896b4ca43) )
r2956r2957
15081547   ROM_LOAD( "a68-10",       0x18000, 0x8000, CRC(83161ed0) SHA1(a6aa28f22f487dc3a2ec07935e6d42bcdd1eff81) )
15091548
15101549   ROM_REGION( 0x0300, REGION_PROMS, 0 )
1511   ROM_LOAD( "rom21",        0x0000, 0x0100, CRC(d6360b4d) SHA1(3e64548c82a3378fc091e104cdc2b0c7e592fc44) )
1512   ROM_LOAD( "rom20",        0x0100, 0x0100, CRC(4ca01887) SHA1(2892c89d5e60f1d10593adffff55c1a9654e8209) )
1513   ROM_LOAD( "rom19",        0x0200, 0x0100, CRC(513224f0) SHA1(15b34612206138f6fc5f7478925b1fff2ed56aa8) )
1550   ROM_LOAD( "rom21",        0x0000,  0x0100, CRC(d6360b4d) SHA1(3e64548c82a3378fc091e104cdc2b0c7e592fc44) )
1551   ROM_LOAD( "rom20",        0x0100,  0x0100, CRC(4ca01887) SHA1(2892c89d5e60f1d10593adffff55c1a9654e8209) )
1552   ROM_LOAD( "rom19",        0x0200,  0x0100, CRC(513224f0) SHA1(15b34612206138f6fc5f7478925b1fff2ed56aa8) )
15141553ROM_END
15151554
1516ROM_START( gtstarba )
1555ROM_START( gtstarb2 )
15171556   ROM_REGION( 0x18000, REGION_CPU1, 0 )      /* Region 0 - main cpu code */
1518   ROM_LOAD( "gs_rb_1.bin",   0x00000, 0x4000, CRC(9afad7e0) SHA1(6b2e82a6b7fcbfed5f4d250959ecc571fdf0cbc2) )
1519   ROM_LOAD( "gs_rb_2.bin",   0x04000, 0x4000, CRC(5feb0a60) SHA1(b1300055180ddf6ca96475eb3a27a17722273fc6) )
1520   ROM_LOAD( "gs_rb_3.bin",   0x10000, 0x8000, CRC(e3cfb1ba) SHA1(bd21655c82a14e18ff9df4539c4d0bb2484c73f1) )
1557   ROM_LOAD( "gs_14.rom",    0x00000, 0x4000, CRC(1a57a920) SHA1(b1e9d5b29c0e3632eec3ad1ee51bf3392e4b816d) )
1558   ROM_LOAD( "gs_13.rom",    0x04000, 0x4000, CRC(805f8e77) SHA1(c3ad6eae842d2d10f716998d5a803038fa7b338f) )
1559   ROM_LOAD( "a68_02.bin",   0x10000, 0x8000, CRC(3567da17) SHA1(29d698606d0bd30abfc3171d79bfad95b0de89fc) )
15211560
15221561   ROM_REGION( 0x10000, REGION_CPU2, 0 )      /* Region 3 - sound cpu code */
1523   ROM_LOAD( "a68-03",       0x00000, 0x2000, CRC(18daa44c) SHA1(1a3d22a186c591321d1b836ee30d89fba4771122) )
1562   ROM_LOAD( "a68-03",       0x0000, 0x2000, CRC(18daa44c) SHA1(1a3d22a186c591321d1b836ee30d89fba4771122) )
15241563
15251564   ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )   /* Region 1 - temporary for gfx */
1526   /* these roms were in the set, but they're corrupt */
1527//  ROM_LOAD( "gs_rb_8.bin",   0x00000, 0x2000, CRC(a30aaf04) SHA1(2509554c3851a68eaec1cadc01f4d69c7aa2c09d) )  /* Chars */
1528//  ROM_LOAD( "gs_rb_7.bin",   0x02000, 0x2000, CRC(f47a93c6) SHA1(441fee1fb195bb2583d220f30dfcff617a31742a) )
1529   /* use the original roms instead */
15301565   ROM_LOAD( "a68_05.bin",   0x00000, 0x2000, CRC(e3d409e7) SHA1(0b6be4767f110729f4dd1a472ef8d9a0c718b684) )  /* Chars */
15311566   ROM_LOAD( "a68_04.bin",   0x02000, 0x2000, CRC(6e5ac9d4) SHA1(74f90b7a1ceb3b1c2fd92dff100d92dea0155530) )
15321567
1533
15341568   ROM_REGION( 0x20000, REGION_GFX2, ROMREGION_DISPOSE )   /* Region 1 - temporary for gfx */
15351569   ROM_LOAD( "a68_09",       0x00000, 0x8000, CRC(a293cc2e) SHA1(a2c2598e92982d13b51cbb6efb4b963142233433) )  /* Tiles */
15361570   ROM_LOAD( "a68_08",       0x08000, 0x8000, CRC(37662375) SHA1(46ba8a3f0b553d476ecf431d0d20556896b4ca43) )
r2956r2957
15441578   ROM_LOAD( "a68-10",       0x18000, 0x8000, CRC(83161ed0) SHA1(a6aa28f22f487dc3a2ec07935e6d42bcdd1eff81) )
15451579
15461580   ROM_REGION( 0x0300, REGION_PROMS, 0 )
1547   ROM_LOAD( "rom21",        0x0000, 0x0100, CRC(d6360b4d) SHA1(3e64548c82a3378fc091e104cdc2b0c7e592fc44) )
1548   ROM_LOAD( "rom20",        0x0100, 0x0100, CRC(4ca01887) SHA1(2892c89d5e60f1d10593adffff55c1a9654e8209) )
1549   ROM_LOAD( "rom19",        0x0200, 0x0100, CRC(513224f0) SHA1(15b34612206138f6fc5f7478925b1fff2ed56aa8) )
1581   ROM_LOAD( "rom21",        0x0000,  0x0100, CRC(d6360b4d) SHA1(3e64548c82a3378fc091e104cdc2b0c7e592fc44) )
1582   ROM_LOAD( "rom20",        0x0100,  0x0100, CRC(4ca01887) SHA1(2892c89d5e60f1d10593adffff55c1a9654e8209) )
1583   ROM_LOAD( "rom19",        0x0200,  0x0100, CRC(513224f0) SHA1(15b34612206138f6fc5f7478925b1fff2ed56aa8) )
15501584ROM_END
15511585
1586
15521587static DRIVER_INIT( tigerh )
15531588{
15541589   memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe803, 0xe803, 0, 0, tigerh_mcu_r, tigerh_mcu_w  );
1555
15561590}
15571591
1558static READ8_HANDLER( getstar_mcu_r )
1592static DRIVER_INIT( tigerhb )
15591593{
1560   /* pass the first check only */
1561   return 0x76;
1594   memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe803, 0xe803, 0, 0, tigerhb_e803_r, tigerhb_e803_w  );
15621595}
15631596
1564static DRIVER_INIT( getstar )
1565{
1566   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe803, 0xe803, 0, 0, getstar_mcu_r );
1567//  memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe803, 0xe803, 0, 0, getstar_mcu_w  );
1568}
15691597
1570static DRIVER_INIT( getstarb )
1598static READ8_HANDLER( gtstarb1_port_0_read )
15711599{
1572   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe803, 0xe803, 0, 0, getstar_e803_r );
1573}
1600   /* The bootleg has it's own 'protection' on startup ?
1601        6D1A: 06 04         ld   b,$04
1602        6D1C: DB 00         in   a,($00)
1603        6D1E: E6 06         and  $06
1604        6D20: 20 FA         jr   nz,$6D1C
1605        6D22: DB 00         in   a,($00)
1606        6D24: E6 06         and  $06
1607        6D26: FE 06         cp   $06
1608        6D28: 20 F8         jr   nz,$6D22
1609        6D2A: DB 00         in   a,($00)
1610        6D2C: E6 06         and  $06
1611        6D2E: FE 02         cp   $02
1612        6D30: 20 F8         jr   nz,$6D2A
1613        6D32: DB 00         in   a,($00)
1614        6D34: E6 06         and  $06
1615        6D36: FE 04         cp   $04
1616        6D38: 20 F8         jr   nz,$6D32
1617        6D3A: 10 E0         djnz $6D1C
1618    */
1619   if (activecpu_get_pc() == 0x6d1e) return 0;
1620   if (activecpu_get_pc() == 0x6d24) return 6;
1621   if (activecpu_get_pc() == 0x6d2c) return 2;
1622   if (activecpu_get_pc() == 0x6d34) return 4;
15741623
1575static READ8_HANDLER( gtstarba_port_0_read )
1576{
1577   /* the bootleg has it's own 'protection' on startup? */
1578   if (activecpu_get_pc()==0x6d1e) return 0;
1579   if (activecpu_get_pc()==0x6d24) return 6;
1580   if (activecpu_get_pc()==0x6d2c) return 2;
1581   if (activecpu_get_pc()==0x6d34) return 4;
1624   /* The bootleg hangs in the "test mode" before diplaying (wrong) lives settings :
1625        6AD4: DB 00         in   a,($00)
1626        6AD6: CB 4F         bit  1,a
1627        6AD8: 28 FA         jr   z,$6AD4
1628        6ADA: 3E 23         ld   a,$23
1629        6ADC: CD 52 11      call $1152
1630        6ADF: 32 03 E8      ld   ($E803),a
1631        6AE2: DB 00         in   a,($00)
1632        6AE4: CB 4F         bit  1,a
1633        6AE6: 28 FA         jr   z,$6AE2
1634        6AE8: 3A 0A C8      ld   a,($C80A)
1635        6AEB: E6 03         and  $03
1636        6AED: CD 52 11      call $1152
1637        6AF0: 32 03 E8      ld   ($E803),a
1638        6AF3: DB 00         in   a,($00)
1639        6AF5: CB 57         bit  2,a
1640        6AF7: 20 FA         jr   nz,$6AF3
1641       This seems to be what used to be the MCU status.
1642    */
1643   if (activecpu_get_pc() == 0x6ad6) return 2; /* bit 1 must be ON */
1644   if (activecpu_get_pc() == 0x6ae4) return 2; /* bit 1 must be ON */
1645   if (activecpu_get_pc() == 0x6af5) return 0; /* bit 2 must be OFF */
15821646
15831647   logerror("Port Read PC=%04x\n",activecpu_get_pc());
15841648
15851649   return 0;
15861650}
15871651
1588static READ8_HANDLER( gtstarba_dpram_r )
1652static READ8_HANDLER( gtstarb1_dpram_r )
15891653{
15901654   /* requires this or it gets stuck with 'rom test' on screen */
15911655   /* it is possible the program roms are slighly corrupt like the gfx roms, or
1592       that the bootleg simply shouldn't execute the code due to the modified
1593       roms */
1656       that the bootleg simply shouldn't execute the code due to the modified roms */
15941657   if (activecpu_get_pc()==0x6d54) return 0xff;
15951658   return slapfight_dpram[offset];
15961659}
15971660
1598static DRIVER_INIT( gtstarba )
1661static void getstar_init( running_machine *machine )
15991662{
1600   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0, 0x0, 0, 0, gtstarba_port_0_read );
1601   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc800, 0xc80f, 0, 0, gtstarba_dpram_r );
1663   memory_install_readwrite8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xe803, 0xe803, 0, 0, getstar_e803_r, getstar_e803_w  );
16021664}
16031665
1666static DRIVER_INIT( getstar )
1667{
1668   getstar_id = GETSTAR;
1669   getstar_init(machine);
1670}
16041671
1672static DRIVER_INIT( getstarj )
1673{
1674   getstar_id = GETSTARJ;
1675   getstar_init(machine);
1676}
1677
1678static DRIVER_INIT( gtstarb1 )
1679{
1680   getstar_id = GTSTARB1;
1681   getstar_init(machine);
1682
1683   /* specific handlers for this bootleg */
1684   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_IO, 0x0, 0x0, 0, 0, gtstarb1_port_0_read );
1685   memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xc800, 0xc80f, 0, 0, gtstarb1_dpram_r );
1686}
1687
1688static DRIVER_INIT( gtstarb2 )
1689{
1690   getstar_id = GTSTARB2;
1691   getstar_init(machine);
1692}
1693
1694
16051695static int slapfigh_prot_pos;
16061696
16071697static READ8_HANDLER( slapfigh_mcu_r )
r2956r2957
16381728GAME( 1985, perfrman, 0,        perfrman, perfrman, 0,        ROT270, "[Toaplan] Data East Corporation", "Performan (Japan)", 0 )
16391729GAME( 1985, perfrmau, perfrman, perfrman, perfrman, 0,        ROT270, "[Toaplan] Data East USA",         "Performan (US)", 0 )
16401730GAME( 1985, tigerh,   0,        tigerh,   tigerh,   tigerh,   ROT270, "Taito America Corp.", "Tiger Heli (US)", GAME_NO_COCKTAIL )
1641GAME( 1985, tigerh2,  tigerh,   tigerh,   tigerh,   tigerh,   ROT270, "Taito",   "Tiger Heli (Japan set 1)", GAME_NOT_WORKING | GAME_NO_COCKTAIL )
1642GAME( 1985, tigerhj,  tigerh,   tigerh,   tigerh,   tigerh,   ROT270, "Taito",   "Tiger Heli (Japan set 2)", GAME_NO_COCKTAIL )
1643GAME( 1985, tigerhb1, tigerh,   tigerhb,  tigerh,   0,        ROT270, "bootleg", "Tiger Heli (bootleg set 1)", 0 )
1731GAME( 1985, tigerhj,  tigerh,   tigerh,   tigerh,   tigerh,   ROT270, "Taito",   "Tiger Heli (Japan)", GAME_NO_COCKTAIL )
1732GAME( 1985, tigerhb1, tigerh,   tigerhb,  tigerh,   tigerhb,  ROT270, "bootleg", "Tiger Heli (bootleg set 1)", GAME_NO_COCKTAIL )
16441733GAME( 1985, tigerhb2, tigerh,    tigerhb,  tigerh,   0,        ROT270, "bootleg", "Tiger Heli (bootleg set 2)", GAME_NO_COCKTAIL )
1734GAME( 1985, tigerhb3, tigerh,   tigerhb,  tigerh,   0,        ROT270, "bootleg", "Tiger Heli (bootleg set 3)", GAME_NO_COCKTAIL )
16451735GAME( 1986, slapfigh, 0,        slapfigh, slapfigh, slapfigh, ROT270, "Taito",   "Slap Fight (set 1)", GAME_NOT_WORKING | GAME_NO_COCKTAIL )
16461736GAME( 1986, slapfiga, slapfigh, slapfigh, slapfigh, slapfigh, ROT270, "Taito",   "Slap Fight (set 2)", GAME_NOT_WORKING | GAME_NO_COCKTAIL )
1737GAME( 1986, alcon,    slapfigh, slapfigh, slapfigh, slapfigh, ROT270, "Taito America Corp.", "Alcon", GAME_NOT_WORKING | GAME_NO_COCKTAIL )
16471738GAME( 1986, slapbtjp, slapfigh, slapfigh, slapfigh, 0,        ROT270, "bootleg", "Slap Fight (Japan bootleg)", GAME_NO_COCKTAIL )
16481739GAME( 1986, slapbtuk, slapfigh, slapbtuk, slapfigh, 0,        ROT270, "bootleg", "Slap Fight (English bootleg)", GAME_NO_COCKTAIL )
16491740GAME( 1986, slapfgtr, slapfigh, slapbtuk, slapfigh, 0,        ROT270, "bootleg", "Slap Fight (bootleg)", GAME_NO_COCKTAIL ) // PCB labeled 'slap fighter'
1650GAME( 1986, alcon,    slapfigh, slapfigh, slapfigh, slapfigh, ROT270, "Taito America Corp.", "Alcon", GAME_NOT_WORKING | GAME_NO_COCKTAIL )
1651GAME( 1986, getstar,  0,        slapfigh, getstar,  getstar,  ROT0,   "Taito",   "Guardian", GAME_NOT_WORKING | GAME_NO_COCKTAIL )
1652GAME( 1986, getstarj, getstar,  slapfigh, getstar,  getstar,  ROT0,   "Taito",   "Get Star (Japan)", GAME_NOT_WORKING | GAME_NO_COCKTAIL )
1653GAME( 1986, getstarb, getstar,  slapfigh, getstar,  getstarb, ROT0,   "bootleg", "Get Star (bootleg set 1)", GAME_NO_COCKTAIL )
1654GAME( 1986, gtstarba, getstar,  slapfigh, gtstarba, gtstarba, ROT0,   "bootleg", "Get Star (bootleg set 2)", GAME_NO_COCKTAIL )
1741GAME( 1986, getstar,  0,        slapfigh, getstar,  getstar,  ROT0,   "Taito America Corporation (Kitkorp license)", "Guardian (US)", GAME_NO_COCKTAIL )
1742GAME( 1986, getstarj, getstar,  slapfigh, getstarj, getstarj, ROT0,   "Taito",   "Get Star (Japan)", GAME_NO_COCKTAIL )
1743GAME( 1986, gtstarb1, getstar,  slapfigh, getstarj, gtstarb1, ROT0,   "bootleg", "Get Star (bootleg set 1)", GAME_NO_COCKTAIL )
1744GAME( 1986, gtstarb2, getstar,  slapfigh, gtstarb2, gtstarb2, ROT0,   "bootleg", "Get Star (bootleg set 2)", GAME_NO_COCKTAIL )
src/mame/drivers/psikyosh.c
r2956r2957
346346      }
347347      else   // these games want the eeprom all zeros by default
348348      {
349         int length;
349         UINT32 length, size;
350350         UINT8 *dat;
351351
352         dat = eeprom_get_data_pointer(&length);
353         memset(dat, 0, length);
352         dat = eeprom_get_data_pointer(&length, &size);
353         memset(dat, 0, length * size);
354354
355355          if (use_factory_eeprom!=eeprom_0) /* Set the EEPROM to Factory Defaults for games needing them*/
356356          {
r2956r2957
10951095PC  : 0001AE7E: TST     R0,R0
10961096PC  : 0001AE80: BT      $0001AE74
10971097*/
1098   if (activecpu_get_pc()==0x0001AFAC) cpu_spinuntil_int(); // Character Select + InGame
1099   if (activecpu_get_pc()==0x0001AE76) cpu_spinuntil_int(); // Everything Else?
1098   if (activecpu_get_pc()==0x0001AFAA) cpu_spinuntil_int(); // Character Select + InGame
1099   if (activecpu_get_pc()==0x0001AE74) cpu_spinuntil_int(); // Everything Else?
11001100
11011101   return psh_ram[0x00000C/4];
11021102}
r2956r2957
11121112PC  : 0609FC72: TST     R0,R0 // test
11131113PC  : 0609FC74: BT      $0609FC68
11141114*/
1115   if (activecpu_get_pc()==0x609FC6A) cpu_spinuntil_int(); // Title Screens
1116   if (activecpu_get_pc()==0x609FED4) cpu_spinuntil_int(); // In Game
1117   if (activecpu_get_pc()==0x60A0172) cpu_spinuntil_int(); // Attract Demo
1115   if (activecpu_get_pc()==0x609FC68) cpu_spinuntil_int(); // Title Screens
1116   if (activecpu_get_pc()==0x609FED2) cpu_spinuntil_int(); // In Game
1117   if (activecpu_get_pc()==0x60A0170) cpu_spinuntil_int(); // Attract Demo
11181118
11191119   return psh_ram[0x00000C/4];
11201120}
r2956r2957
11311131PC  : 00047624: TST     R0,R0
11321132PC  : 00047626: BT      $00047618
11331133*/
1134   if (activecpu_get_pc()==0x0004761C) cpu_spinuntil_int(); // title
1135   if (activecpu_get_pc()==0x00047978) cpu_spinuntil_int(); // ingame
1134   if (activecpu_get_pc()==0x0004761a) cpu_spinuntil_int(); // title
1135   if (activecpu_get_pc()==0x00047976) cpu_spinuntil_int(); // ingame
11361136
11371137   return psh_ram[0x00000C/4];
11381138}
r2956r2957
11481148PC  : 060A10F6: TST     R2,R2
11491149PC  : 060A10F8: BT      $060A10EC
11501150*/
1151   if (activecpu_get_pc()==0x060A10EE) cpu_spinuntil_int(); // title
1152   if (activecpu_get_pc()==0x060A165A) cpu_spinuntil_int(); // attract
1153   if (activecpu_get_pc()==0x060A1382) cpu_spinuntil_int(); // game
1151   if (activecpu_get_pc()==0x060A10EC) cpu_spinuntil_int(); // title
1152   if (activecpu_get_pc()==0x060A1658) cpu_spinuntil_int(); // attract
1153   if (activecpu_get_pc()==0x060A1380) cpu_spinuntil_int(); // game
11541154
11551155   return psh_ram[0x00000C/4];
11561156}
r2956r2957
11661166PC  : 0602897C: TST     R2,R2
11671167PC  : 0602897E: BT      $06028972
11681168*/
1169   if (activecpu_get_pc()==0x06028974) cpu_spinuntil_int();
1170   if (activecpu_get_pc()==0x06028E64) cpu_spinuntil_int();
1171   if (activecpu_get_pc()==0x06028BE6) cpu_spinuntil_int();
1169   if (activecpu_get_pc()==0x06028972) cpu_spinuntil_int();
1170   if (activecpu_get_pc()==0x06028E62) cpu_spinuntil_int();
1171   if (activecpu_get_pc()==0x06028BE4) cpu_spinuntil_int();
11721172
11731173   return psh_ram[0x04000C/4];
11741174}
11751175
11761176static READ32_HANDLER( s1945iii_speedup_r )
11771177{
1178   if (activecpu_get_pc()==0x0602B464) cpu_spinuntil_int(); // start up text
1179   if (activecpu_get_pc()==0x0602B6E2) cpu_spinuntil_int(); // intro attract
1180   if (activecpu_get_pc()==0x0602BC1E) cpu_spinuntil_int(); // game attract
1181   if (activecpu_get_pc()==0x0602B97C) cpu_spinuntil_int(); // game
1178   if (activecpu_get_pc()==0x0602B462) cpu_spinuntil_int(); // start up text
1179   if (activecpu_get_pc()==0x0602B6E0) cpu_spinuntil_int(); // intro attract
1180   if (activecpu_get_pc()==0x0602BC1C) cpu_spinuntil_int(); // game attract
1181   if (activecpu_get_pc()==0x0602B97A) cpu_spinuntil_int(); // game
11821182
11831183   return psh_ram[0x06000C/4];
11841184}
r2956r2957
11861186
11871187static READ32_HANDLER( dragnblz_speedup_r )
11881188{
1189   if (activecpu_get_pc()==0x06027440) cpu_spinuntil_int(); // startup texts
1190   if (activecpu_get_pc()==0x060276E6) cpu_spinuntil_int(); // attract intro
1191   if (activecpu_get_pc()==0x06027C74) cpu_spinuntil_int(); // attract game
1192   if (activecpu_get_pc()==0x060279A8) cpu_spinuntil_int(); // game
1189   if (activecpu_get_pc()==0x0602743e) cpu_spinuntil_int(); // startup texts
1190   if (activecpu_get_pc()==0x060276e4) cpu_spinuntil_int(); // attract intro
1191   if (activecpu_get_pc()==0x06027C72) cpu_spinuntil_int(); // attract game
1192   if (activecpu_get_pc()==0x060279A6) cpu_spinuntil_int(); // game
11931193
11941194   return psh_ram[0x006000C/4];
11951195}
r2956r2957
12061206PC  :0602CAF2: BT      $0602CAE6
12071207*/
12081208
1209   if (activecpu_get_pc()==0x0602CAE8) cpu_spinuntil_int(); // title logos
1210   if (activecpu_get_pc()==0x0602CD88) cpu_spinuntil_int(); // attract intro
1211   if (activecpu_get_pc()==0x0602D2F0) cpu_spinuntil_int(); // game attract
1212   if (activecpu_get_pc()==0x0602D042) cpu_spinuntil_int(); // game play
1209   if (activecpu_get_pc()==0x0602CAE6) cpu_spinuntil_int(); // title logos
1210   if (activecpu_get_pc()==0x0602CD86) cpu_spinuntil_int(); // attract intro
1211   if (activecpu_get_pc()==0x0602D2ee) cpu_spinuntil_int(); // game attract
1212   if (activecpu_get_pc()==0x0602D040) cpu_spinuntil_int(); // game play
12131213
12141214   return psh_ram[0x006000C/4];
12151215}
r2956r2957
12171217static READ32_HANDLER( mjgtaste_speedup_r )
12181218{
12191219
1220   if (activecpu_get_pc()==0x6031f04) {cpu_spinuntil_int();return psh_ram[0x006000C/4];} // title logos
1221   if (activecpu_get_pc()==0x603214c) {cpu_spinuntil_int();return psh_ram[0x006000C/4];} // attract game
1220   if (activecpu_get_pc()==0x6031f02) {cpu_spinuntil_int();return psh_ram[0x006000C/4];} // title logos
1221   if (activecpu_get_pc()==0x603214a) {cpu_spinuntil_int();return psh_ram[0x006000C/4];} // attract game
12221222
12231223//  mame_printf_debug("at %08x\n",activecpu_get_pc());
12241224
12251225   return psh_ram[0x006000C/4];
12261226}
12271227
1228
1229
12301228static DRIVER_INIT( soldivid )
12311229{
1230   cpunum_set_info_int(0, CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1231   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
1232   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x1afaa);
1233   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
1234   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x1ae74);
12321235   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x600000c, 0x600000f, 0, 0, soldivid_speedup_r );
12331236   use_factory_eeprom=eeprom_0;
12341237}
12351238
12361239static DRIVER_INIT( s1945ii )
12371240{
1241   cpunum_set_info_int(0, CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1242   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
1243   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x609fc68);
1244   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
1245   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x609fed2);
1246   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 2);
1247   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60a0170);
12381248   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x600000c, 0x600000f, 0, 0, s1945ii_speedup_r );
12391249   use_factory_eeprom=eeprom_DEFAULT;
12401250}
r2956r2957
12421252static DRIVER_INIT( daraku )
12431253{
12441254   UINT8 *RAM = memory_region(machine, REGION_CPU1);
1255   cpunum_set_info_int(0, CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1256   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
1257   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x4761a);
1258   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
1259   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x47976);
12451260   memory_set_bankptr(1,&RAM[0x100000]);
12461261   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x600000c, 0x600000f, 0, 0, daraku_speedup_r );
12471262   use_factory_eeprom=eeprom_DARAKU;
r2956r2957
12491264
12501265static DRIVER_INIT( sbomberb )
12511266{
1267   cpunum_set_info_int(0, CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1268   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
1269   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60a10ec);
1270   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
1271   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60a1658);
1272   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 2);
1273   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60a1380);
12521274   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x600000c, 0x600000f, 0, 0, sbomberb_speedup_r );
12531275   use_factory_eeprom=eeprom_DEFAULT;
12541276}
r2956r2957
12561278static DRIVER_INIT( gunbird2 )
12571279{
12581280   UINT8 *RAM = memory_region(machine, REGION_CPU1);
1281   cpunum_set_info_int(0, CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1282   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
1283   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6028972);
1284   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
1285   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6028e62);
1286   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 2);
1287   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6028be4);
12591288   memory_set_bankptr(1,&RAM[0x100000]);
12601289   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x604000c, 0x604000f, 0, 0, gunbird2_speedup_r );
12611290   use_factory_eeprom=eeprom_DEFAULT;
r2956r2957
12641293static DRIVER_INIT( s1945iii )
12651294{
12661295   UINT8 *RAM = memory_region(machine, REGION_CPU1);
1296   cpunum_set_info_int(0, CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1297   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
1298   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602b462);
1299   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
1300   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602b6e0);
1301   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 2);
1302   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602bc1c);
1303   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 3);
1304   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602b97a);
12671305   memory_set_bankptr(1,&RAM[0x100000]);
12681306   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x606000c, 0x606000f, 0, 0, s1945iii_speedup_r );
12691307   use_factory_eeprom=eeprom_S1945III;
r2956r2957
12711309
12721310static DRIVER_INIT( dragnblz )
12731311{
1312   cpunum_set_info_int(0, CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1313   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
1314   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602743e);
1315   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
1316   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60276e4);
1317   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 2);
1318   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6027c72);
1319   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 3);
1320   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60279a6);
12741321   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x606000c, 0x606000f, 0, 0, dragnblz_speedup_r );
12751322   use_factory_eeprom=eeprom_DRAGNBLZ;
12761323}
12771324
12781325static DRIVER_INIT( gnbarich )
12791326{
1327   cpunum_set_info_int(0, CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1328   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
1329   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602cae6);
1330   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
1331   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602cd86);
1332   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 2);
1333   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602d2ee);
1334   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 3);
1335   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602d040);
12801336   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x606000c, 0x606000f, 0, 0, gnbarich_speedup_r );
12811337   use_factory_eeprom=eeprom_GNBARICH;
12821338}
12831339
12841340static DRIVER_INIT( mjgtaste )
12851341{
1342   cpunum_set_info_int(0, CPUINFO_INT_SH2_DRC_OPTIONS, SH2DRC_FASTEST_OPTIONS);
1343   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
1344   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6031f02);
1345   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
1346   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x603214a);
12861347   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x606000c, 0x606000f, 0, 0, mjgtaste_speedup_r );
12871348   use_factory_eeprom=eeprom_MJGTASTE;
12881349   /* needs to install mahjong controls too (can select joystick in test mode tho) */
src/mame/drivers/skykid.c
r2956r2957
5252   switch (inputport_selected)
5353   {
5454      case 0x00:   /* DSW B (bits 0-4) */
55         return (input_port_read_indexed(machine, 1) & 0xf8) >> 3; break;
55         return (input_port_read(machine, "DSWB") & 0xf8) >> 3; break;
5656      case 0x01:   /* DSW B (bits 5-7), DSW A (bits 0-1) */
57         return ((input_port_read_indexed(machine, 1) & 0x07) << 2) | ((input_port_read_indexed(machine, 0) & 0xc0) >> 6); break;
57         return ((input_port_read(machine, "DSWB") & 0x07) << 2) | ((input_port_read(machine, "DSWA") & 0xc0) >> 6); break;
5858      case 0x02:   /* DSW A (bits 2-6) */
59         return (input_port_read_indexed(machine, 0) & 0x3e) >> 1; break;
59         return (input_port_read(machine, "DSWA") & 0x3e) >> 1; break;
6060      case 0x03:   /* DSW A (bit 7), DSW C (bits 0-3) */
61         return ((input_port_read_indexed(machine, 0) & 0x01) << 4) | (input_port_read_indexed(machine, 2) & 0x0f); break;
61         return ((input_port_read(machine, "DSWA") & 0x01) << 4) | (input_port_read(machine, "BUTTON2") & 0x0f); break;
6262      case 0x04:   /* coins, start */
63         return input_port_read_indexed(machine, 3); break;
63         return input_port_read(machine, "SYSTEM"); break;
6464      case 0x05:   /* 2P controls */
65         return input_port_read_indexed(machine, 5); break;
65         return input_port_read(machine, "P2"); break;
6666      case 0x06:   /* 1P controls */
67         return input_port_read_indexed(machine, 4); break;
67         return input_port_read(machine, "P1"); break;
6868      default:
6969         return 0xff;
7070   }
r2956r2957
156156
157157
158158static INPUT_PORTS_START( skykid )
159   PORT_START   /* DSW A */
159   PORT_START_TAG("DSWA")   /* DSW A */
160160   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
161161   PORT_DIPNAME( 0x60, 0x60, DEF_STR( Coin_A ) )
162162   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
r2956r2957
178178   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
179179   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
180180
181   PORT_START   /* DSW B */
181   PORT_START_TAG("DSWB")   /* DSW B */
182182   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
183183   PORT_DIPSETTING(    0x80, "1" )
184184   PORT_DIPSETTING(    0x40, "2" )
r2956r2957
202202   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
203203   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
204204
205   PORT_START
205   PORT_START_TAG("BUTTON2")
206206   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
207207   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
208208   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
209209   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
210210   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
211211
212   PORT_START   /* IN 0 */
212   PORT_START_TAG("SYSTEM")   /* IN 0 */
213213   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
214214   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 )
215215   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
r2956r2957
217217   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
218218   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
219219
220   PORT_START   /* IN 1 */
220   PORT_START_TAG("P1")   /* IN 1 */
221221   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
222222   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
223223   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
225225   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
226226   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
227227
228   PORT_START   /* IN 2 */
228   PORT_START_TAG("P2")   /* IN 2 */
229229   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
230230   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
231231   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
235235INPUT_PORTS_END
236236
237237static INPUT_PORTS_START( skykids )
238   PORT_START   /* DSW A */
238   PORT_START_TAG("DSWA")   /* DSW A */
239239   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
240240   PORT_DIPNAME( 0x60, 0x60, DEF_STR( Coin_A ) )
241241   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
r2956r2957
257257   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
258258   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
259259
260   PORT_START   /* DSW B */
260   PORT_START_TAG("DSWB")   /* DSW B */
261261   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
262262   PORT_DIPSETTING(    0x80, "1" )
263263   PORT_DIPSETTING(    0x40, "2" )
r2956r2957
281281   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
282282   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
283283
284   PORT_START
284   PORT_START_TAG("BUTTON2")
285285   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
286286   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
287287   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
288288   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
289289   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
290290
291   PORT_START   /* IN 0 */
291   PORT_START_TAG("SYSTEM")   /* IN 0 */
292292   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
293293   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 )
294294   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
r2956r2957
296296   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
297297   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
298298
299   PORT_START   /* IN 1 */
299   PORT_START_TAG("P1")   /* IN 1 */
300300   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
301301   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
302302   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
304304   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
305305   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
306306
307   PORT_START   /* IN 2 */
307   PORT_START_TAG("P2")   /* IN 2 */
308308   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
309309   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
310310   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
314314INPUT_PORTS_END
315315
316316static INPUT_PORTS_START( drgnbstr )
317   PORT_START   /* DSW A */
317   PORT_START_TAG("DSWA")   /* DSW A */
318318   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
319319   PORT_DIPNAME( 0x60, 0x60, DEF_STR( Coin_A ) )
320320   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
r2956r2957
336336   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
337337   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
338338
339   PORT_START   /* DSW B */
339   PORT_START_TAG("DSWB")   /* DSW B */
340340   PORT_DIPNAME( 0x80, 0x80, "Spurt Time" )
341341   PORT_DIPSETTING(    0x80, DEF_STR( Normal ) )
342342   PORT_DIPSETTING(    0x00, "Difficult" )
r2956r2957
360360   PORT_DIPSETTING(    0x01, DEF_STR( No ) )
361361   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
362362
363   PORT_START
363   PORT_START_TAG("BUTTON2")
364364   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
365365   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Cabinet ) )
366366   PORT_DIPSETTING(    0x02, DEF_STR( Upright ) )
r2956r2957
369369   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
370370   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
371371
372   PORT_START   /* IN 0 */
372   PORT_START_TAG("SYSTEM")   /* IN 0 */
373373   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
374374   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 )
375375   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )
r2956r2957
377377   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
378378   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
379379
380   PORT_START   /* IN 1 */
380   PORT_START_TAG("P1")   /* IN 1 */
381381   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
382382   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
383383   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
r2956r2957
385385   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
386386   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
387387
388   PORT_START   /* IN 2 */
388   PORT_START_TAG("P2")   /* IN 2 */
389389   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL
390390   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
391391   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL
src/mame/drivers/ssfindo.c
r2956r2957
319319
320320      case IOLINES: //TODO: eeprom  24c01
321321#if 0
322      mame_printf_debug("IOLINESR %i @%x\n",offset,activecpu_get_pc());
322      mame_printf_debug("IOLINESR %i @%x\n", offset, activecpu_get_pc());
323323#endif
324324
325      if(flashType==1)
325      if(flashType == 1)
326326         return 0;
327327      else
328328         return mame_rand(machine);
329329
330330      case IRQSTA:
331         return (PS7500_IO[offset]&(~2))|0x80;
331         return (PS7500_IO[offset] & (~2)) | 0x80;
332332
333333      case IRQRQA:
334         return (PS7500_IO[IRQSTA]&PS7500_IO[IRQMSKA])|0x80;
334         return (PS7500_IO[IRQSTA] & PS7500_IO[IRQMSKA]) | 0x80;
335335
336336      case IOCR: //TODO: nINT1, OD[n] p.81
337         return (input_port_read_indexed(machine, 0)&0x80)|0x34|3;
337         return (input_port_read(machine, "PS7500") & 0x80) | 0x34 | 3;
338338
339339      case VIDCR:
340         return (PS7500_IO[offset]|0x50)&0xfffffff0;
340         return (PS7500_IO[offset] | 0x50) & 0xfffffff0;
341341
342342      case T1low:
343343      case T0low:
r2956r2957
496496   AM_RANGE(0x03012ff0, 0x03012ff3) AM_NOP
497497   AM_RANGE(0x03012ff4, 0x03012ff7) AM_WRITENOP AM_READ(ff4_r) //status flag ?
498498   AM_RANGE(0x03012ff8, 0x03012fff) AM_NOP
499   AM_RANGE(0x03240000, 0x03240003) AM_WRITENOP AM_READ(input_port_1_dword_r)
500   AM_RANGE(0x03241000, 0x03241003) AM_WRITENOP AM_READ(input_port_2_dword_r)
499   AM_RANGE(0x03240000, 0x03240003) AM_READ_PORT("IN0") AM_WRITENOP
500   AM_RANGE(0x03241000, 0x03241003) AM_READ_PORT("IN1") AM_WRITENOP
501501   AM_RANGE(0x03242000, 0x03242003) AM_READ(io_r) AM_WRITE(io_w)
502   AM_RANGE(0x03243000, 0x03243003) AM_WRITENOP AM_READ(input_port_3_dword_r)
502   AM_RANGE(0x03243000, 0x03243003) AM_READ_PORT("DSW") AM_WRITENOP
503503   AM_RANGE(0x0324f000, 0x0324f003) AM_READ(SIMPLEIO_r)
504504   AM_RANGE(0x03245000, 0x03245003) AM_WRITENOP /* sound ? */
505505   AM_RANGE(0x03400000, 0x03400003) AM_WRITE(FIFO_w)
r2956r2957
511511   AM_RANGE(0x03200000, 0x032001ff) AM_READWRITE(PS7500_IO_r,PS7500_IO_w)
512512   AM_RANGE(0x03012b00, 0x03012bff) AM_READ(randomized_r) AM_WRITENOP
513513   AM_RANGE(0x03012e60, 0x03012e67) AM_WRITENOP
514   AM_RANGE(0x03012ff8   ,0x03012ffb) AM_WRITENOP AM_READ(input_port_1_dword_r)
515   AM_RANGE(0x032c0000, 0x032c0003) AM_WRITENOP AM_READ(input_port_2_dword_r)
514   AM_RANGE(0x03012ff8, 0x03012ffb) AM_READ_PORT("IN0") AM_WRITENOP
515   AM_RANGE(0x032c0000, 0x032c0003) AM_READ_PORT("IN1") AM_WRITENOP
516516   AM_RANGE(0x03340000, 0x03340007) AM_WRITENOP
517517   AM_RANGE(0x03341000, 0x0334101f) AM_WRITENOP
518518   AM_RANGE(0x033c0000, 0x033c0003) AM_READ(io_r) AM_WRITE(io_w)
r2956r2957
531531   PORT_START_TAG("PS7500")
532532   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
533533
534   PORT_START_TAG("IN 0")
534   PORT_START_TAG("IN0")
535535   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNUSED   )            // IPT_START2 ??
536536   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON1   ) PORT_PLAYER(1)
537537   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT   ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
541541   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START1   )
542542   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN1   )
543543
544   PORT_START_TAG("IN 1")
545
544   PORT_START_TAG("IN1")
546545   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON1   ) PORT_PLAYER(2)
547546   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT   ) PORT_8WAY PORT_PLAYER(2)
548547   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
551550   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_START2   )
552551
553552   PORT_START_TAG("DSW")
554
555553   PORT_DIPNAME( 0x01, 0x01, "Test Mode" )
556      PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
557      PORT_DIPSETTING(    0x00, DEF_STR( On ) )
558
554   PORT_DIPSETTING(   0x01, DEF_STR( Off ) )
555   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
559556   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Free_Play ) )
560      PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
561      PORT_DIPSETTING(    0x00, DEF_STR( On ) )
562
557   PORT_DIPSETTING(   0x02, DEF_STR( Off ) )
558   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
563559   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Service_Mode ) )
564      PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
565      PORT_DIPSETTING(    0x00, DEF_STR( On ) )
566
560   PORT_DIPSETTING(   0x80, DEF_STR( Off ) )
561   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
567562   PORT_DIPNAME( 0x04, 0x04, "DSW 2" )
568      PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
569      PORT_DIPSETTING(    0x00, DEF_STR( On ) )
570
563   PORT_DIPSETTING(   0x04, DEF_STR( Off ) )
564   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
571565   PORT_DIPNAME( 0x08, 0x08, "DSW 3" )
572      PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
573      PORT_DIPSETTING(    0x00, DEF_STR( On ) )
574
566   PORT_DIPSETTING(   0x08, DEF_STR( Off ) )
567   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
575568   PORT_DIPNAME( 0x10, 0x010, "DSW 4" )
576      PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
577      PORT_DIPSETTING(    0x00, DEF_STR( On ) )
578
569   PORT_DIPSETTING(   0x10, DEF_STR( Off ) )
570   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
579571   PORT_DIPNAME( 0x20, 0x20, "DSW 5" )
580      PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
581      PORT_DIPSETTING(    0x00, DEF_STR( On ) )
582
572   PORT_DIPSETTING(   0x20, DEF_STR( Off ) )
573   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
583574   PORT_DIPNAME( 0x40, 0x040, "DSW 6" )
584      PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
585      PORT_DIPSETTING(    0x00, DEF_STR( On ) )
586
575   PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
576   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
587577INPUT_PORTS_END
588578
589579
r2956r2957
591581   PORT_START_TAG("PS7500")
592582   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
593583
594   PORT_START_TAG("IN 0")
595      PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_COIN1   )
584   PORT_START_TAG("IN0")
585   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN1   )
596586
597   PORT_START_TAG("IN 1")
598      PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2   ) PORT_PLAYER(1)
599      PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON1   ) PORT_PLAYER(1)
600      PORT_BIT( 0x008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT   ) PORT_8WAY PORT_PLAYER(1)
601      PORT_BIT( 0x010, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_8WAY PORT_PLAYER(1)
602      PORT_BIT( 0x020, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_8WAY PORT_PLAYER(1)
603      PORT_BIT( 0x040, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_8WAY PORT_PLAYER(1)
604      PORT_BIT( 0x080, IP_ACTIVE_LOW, IPT_START1   )
605
587   PORT_START_TAG("IN1")
588   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2   ) PORT_PLAYER(1)
589   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1   ) PORT_PLAYER(1)
590   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT   ) PORT_8WAY PORT_PLAYER(1)
591   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT   ) PORT_8WAY PORT_PLAYER(1)
592   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN   ) PORT_8WAY PORT_PLAYER(1)
593   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_UP   ) PORT_8WAY PORT_PLAYER(1)
594   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1   )
606595INPUT_PORTS_END
607596
608597
r2956r2957
716705   PS7500timer1 = timer_alloc(PS7500_Timer1_callback, NULL);
717706}
718707
719GAME( 1999, ssfindo, 0,        ssfindo,  ssfindo,  ssfindo, ROT0, "Icarus", "See See Find Out", GAME_NO_SOUND )
720GAME( 1999, ppcar,   0,        ppcar,    ppcar,    ppcar, ROT0, "Icarus", "Pang Pang Car", GAME_NO_SOUND )
721
722
708GAME( 1999, ssfindo, 0,        ssfindo,  ssfindo,  ssfindo,   ROT0, "Icarus", "See See Find Out", GAME_NO_SOUND )
709GAME( 1999, ppcar,   0,        ppcar,    ppcar,    ppcar,   ROT0, "Icarus", "Pang Pang Car", GAME_NO_SOUND )
src/mame/drivers/segas24.c
r2956r2957
508508
509509static UINT8 hotrod_io_r(running_machine *machine, int port)
510510{
511   switch(port) {
511   switch(port)
512   {
512513   case 0:
513      return input_port_read_indexed(machine, 0);
514      return input_port_read(machine, "P1");
514515   case 1:
515      return input_port_read_indexed(machine, 1);
516      return input_port_read(machine, "P2");
516517   case 2:
517      return 0xff;
518      return input_port_read_safe(machine, "P3", 0xff);
518519   case 3:
519520      return 0xff;
520521   case 4:
521      return input_port_read_indexed(machine, 2);
522      return input_port_read(machine, "SERVICE");
522523   case 5: // Dip switches
523      return input_port_read_indexed(machine, 3);
524      return input_port_read(machine, "COINAGE");
524525   case 6:
525      return input_port_read_indexed(machine, 4);
526      return input_port_read(machine, "DSW");
526527   case 7: // DAC
527528      return 0xff;
528529   }
r2956r2957
531532
532533static UINT8 dcclub_io_r(running_machine *machine, int port)
533534{
534   switch(port) {
535   case 0: {
535   switch(port)
536   {
537   case 0:
538   {
536539      static const UINT8 pos[16] = { 0, 1, 3, 2, 6, 4, 12, 8, 9 };
537      return (input_port_read_indexed(machine, 0) & 0xf) | ((~pos[input_port_read_indexed(machine, 5)>>4]<<4) & 0xf0);
540      return (input_port_read(machine, "P1") & 0xf) | ((~pos[input_port_read(machine, "PADDLE")>>4]<<4) & 0xf0);
538541   }
539542   case 1:
540      return input_port_read_indexed(machine, 1);
543      return input_port_read(machine, "P2");
541544   case 2:
542545      return 0xff;
543546   case 3:
544547      return 0xff;
545548   case 4:
546      return input_port_read_indexed(machine, 2);
549      return input_port_read(machine, "SERVICE");
547550   case 5: // Dip switches
548      return input_port_read_indexed(machine, 3);
551      return input_port_read(machine, "COINAGE");
549552   case 6:
550      return input_port_read_indexed(machine, 4);
553      return input_port_read(machine, "DSW");
551554   case 7: // DAC
552555      return 0xff;
553556   }
r2956r2957
558561
559562static UINT8 mahmajn_io_r(running_machine *machine, int port)
560563{
561   switch(port) {
564   static const char *keynames[] = { "MJ0", "MJ1", "MJ2", "MJ3", "MJ4", "MJ5", "P1", "P2" };
565
566   switch(port)
567   {
562568   case 0:
563569      return ~(1 << cur_input_line);
564570   case 1:
565571      return 0xff;
566572   case 2:
567      return input_port_read_indexed(machine, cur_input_line);
573      return input_port_read(machine, keynames[cur_input_line]);
568574   case 3:
569575      return 0xff;
570576   case 4:
571      return input_port_read_indexed(machine, 8);
577      return input_port_read(machine, "SERVICE");
572578   case 5: // Dip switches
573      return input_port_read_indexed(machine, 9);
579      return input_port_read(machine, "COINAGE");
574580   case 6:
575      return input_port_read_indexed(machine, 10);
581      return input_port_read(machine, "DSW");
576582   case 7: // DAC
577583      return 0xff;
578584   }
579585   return 0x00;
580586}
581587
582static UINT8 gground_io_r(running_machine *machine, int port)
583{
584   switch(port) {
585   case 0:
586      return input_port_read_indexed(machine, 0);
587   case 1:
588      return input_port_read_indexed(machine, 1);
589   case 2: // P3 inputs
590      return input_port_read_indexed(machine, 2);
591   case 3:
592      return 0xff;
593   case 4:
594      return input_port_read_indexed(machine, 3);
595   case 5: // Dip switches
596      return input_port_read_indexed(machine, 4);
597   case 6:
598      return input_port_read_indexed(machine, 5);
599   case 7: // DAC
600      return 0xff;
601   }
602   return 0x00;
603}
604
605588static void mahmajn_io_w(running_machine *machine, int port, UINT8 data)
606589{
607   switch(port) {
590   switch(port)
591   {
608592   case 3:
609593      if(data & 4)
610594         cur_input_line = (cur_input_line + 1) & 7;
r2956r2957
619603
620604static void hotrod_io_w(running_machine *machine, int port, UINT8 data)
621605{
622   switch(port) {
606   switch(port)
607   {
623608   case 3: // Lamps
624609      break;
625610   case 7: // DAC
r2956r2957
634619
635620static WRITE16_HANDLER( hotrod3_ctrl_w )
636621{
637   if(ACCESSING_BITS_0_7) {
622   static const char *portnames[] = { "PEDAL1", "PEDAL2", "PEDAL3", "PEDAL4" };
623
624   if(ACCESSING_BITS_0_7)
625   {
638626      data &= 3;
639      hotrod_ctrl_cur = input_port_read_indexed(machine, 9+data);
627      hotrod_ctrl_cur = input_port_read_safe(machine, portnames[data], 0);
640628   }
641629}
642630
643631static READ16_HANDLER( hotrod3_ctrl_r )
644632{
645   if(ACCESSING_BITS_0_7) {
646      switch(offset) {
633   if(ACCESSING_BITS_0_7)
634   {
635      switch(offset)
636      {
647637         // Steering dials
648      case 0:
649         return input_port_read_indexed(machine, 5) & 0xff;
650      case 1:
651         return input_port_read_indexed(machine, 5) >> 8;
652      case 2:
653         return input_port_read_indexed(machine, 6) & 0xff;
654      case 3:
655         return input_port_read_indexed(machine, 6) >> 8;
656      case 4:
657         return input_port_read_indexed(machine, 7) & 0xff;
658      case 5:
659         return input_port_read_indexed(machine, 7) >> 8;
660      case 6:
661         return input_port_read_indexed(machine, 8) & 0xff;
662      case 7:
663         return input_port_read_indexed(machine, 8) >> 8;
638         case 0:
639            return input_port_read_safe(machine, "DIAL1", 0) & 0xff;
640         case 1:
641            return input_port_read_safe(machine, "DIAL1", 0) >> 8;
642         case 2:
643            return input_port_read_safe(machine, "DIAL2", 0) & 0xff;
644         case 3:
645            return input_port_read_safe(machine, "DIAL2", 0) >> 8;
646         case 4:
647            return input_port_read_safe(machine, "DIAL3", 0) & 0xff;
648         case 5:
649            return input_port_read_safe(machine, "DIAL3", 0) >> 8;
650         case 6:
651            return input_port_read_safe(machine, "DIAL4", 0) & 0xff;
652         case 7:
653            return input_port_read_safe(machine, "DIAL4", 0) >> 8;
664654
665      case 8: { // Serial ADCs for the accel
666         int v = hotrod_ctrl_cur & 0x80;
667         hotrod_ctrl_cur <<= 1;
668         return v ? 0xff : 0;
655         case 8:
656         {
657            // Serial ADCs for the accel
658            int v = hotrod_ctrl_cur & 0x80;
659            hotrod_ctrl_cur <<= 1;
660            return v ? 0xff : 0;
661         }
669662      }
670      }
671663   }
672664   return 0;
673665}
r2956r2957
11051097
11061098static DRIVER_INIT(qrouka)
11071099{
1108   system24temp_sys16_io_set_callbacks(gground_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
1100   system24temp_sys16_io_set_callbacks(hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
11091101   mlatch_table = qrouka_mlt;
11101102   track_size = 0;
11111103}
11121104
11131105static DRIVER_INIT(quizmeku)
11141106{
1115   system24temp_sys16_io_set_callbacks(gground_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
1107   system24temp_sys16_io_set_callbacks(hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
11161108   mlatch_table = quizmeku_mlt;
11171109   track_size = 0;
11181110}
r2956r2957
11961188}
11971189
11981190
1199
1200
12011191static DRIVER_INIT(sgmast)
12021192{
12031193   system24temp_sys16_io_set_callbacks(hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
r2956r2957
12171207
12181208static DRIVER_INIT(gground)
12191209{
1220   system24temp_sys16_io_set_callbacks(gground_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
1210   system24temp_sys16_io_set_callbacks(hotrod_io_r, hotrod_io_w, resetcontrol_w, iod_r, iod_w);
12211211   mlatch_table = 0;
12221212   track_size = 0x2d00;
12231213   s24_fd1094_driver_init(machine);
r2956r2957
14261416   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
14271417   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
14281418
1429   PORT_START
1419   PORT_START_TAG("DIAL1")
14301420   PORT_BIT( 0xfff, 0x000, IPT_DIAL ) PORT_MINMAX(0x000,0xfff) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1)
14311421
1432   PORT_START
1422   PORT_START_TAG("DIAL2")
14331423   PORT_BIT( 0xfff, 0x000, IPT_DIAL ) PORT_MINMAX(0x000,0xfff) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(2)
14341424
1435   PORT_START
1425   PORT_START_TAG("DIAL3")
14361426   PORT_BIT( 0xfff, 0x000, IPT_DIAL ) PORT_MINMAX(0x000,0xfff) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(3)
14371427
1438   PORT_START
1428   PORT_START_TAG("DIAL4")
14391429   PORT_BIT( 0xfff, 0x000, IPT_DIAL ) PORT_MINMAX(0x000,0xfff) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(4)
14401430
1441   PORT_START
1431   PORT_START_TAG("PEDAL1")
14421432   PORT_BIT( 0xff, 0x01, IPT_PEDAL ) PORT_MINMAX(0x01,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1)
14431433
1444   PORT_START
1434   PORT_START_TAG("PEDAL2")
14451435   PORT_BIT( 0xff, 0x01, IPT_PEDAL ) PORT_MINMAX(0x01,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(2)
14461436
1447   PORT_START
1437   PORT_START_TAG("PEDAL3")
14481438   PORT_BIT( 0xff, 0x01, IPT_PEDAL ) PORT_MINMAX(0x01,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(3)
14491439
1450   PORT_START
1440   PORT_START_TAG("PEDAL4")
14511441   PORT_BIT( 0xff, 0x01, IPT_PEDAL ) PORT_MINMAX(0x01,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(4)
14521442INPUT_PORTS_END
14531443
r2956r2957
15371527   PORT_DIPSETTING(    0x80, "10" )
15381528   PORT_DIPSETTING(    0x00, "15" )
15391529
1540   PORT_START
1530   PORT_START_TAG("DIAL1")
15411531   PORT_BIT( 0xfff, 0x000, IPT_DIAL ) PORT_MINMAX(0x000,0xfff) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(1)
15421532
1543   PORT_START
1533   PORT_START_TAG("DIAL2")
15441534   PORT_BIT( 0xfff, 0x000, IPT_DIAL ) PORT_MINMAX(0x000,0xfff) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(2)
15451535INPUT_PORTS_END
15461536
r2956r2957
16521642   PORT_DIPSETTING(    0x40, DEF_STR( Hard ) )
16531643   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
16541644
1655   PORT_START
1645   PORT_START_TAG("PADDLE")
16561646   PORT_BIT( 0xff, 0x00, IPT_PADDLE ) PORT_MINMAX(0x00,0x8f) PORT_SENSITIVITY(64) PORT_KEYDELTA(64) PORT_PLAYER(1)
16571647INPUT_PORTS_END
16581648
r2956r2957
17021692   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
17031693   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
17041694
1705   PORT_START
1695   PORT_START_TAG("DIAL1")
17061696   PORT_BIT( 0xfff, 0x000, IPT_DIAL ) PORT_MINMAX(0x000,0xfff) PORT_SENSITIVITY(25) PORT_KEYDELTA(15) PORT_PLAYER(2)
17071697INPUT_PORTS_END
17081698
src/mame/drivers/segas16a.c
r2956r2957
272272         return ppi8255_r(device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255" ), offset & 3);
273273
274274      case 0x1000/2:
275         return input_port_read_indexed(machine, offset & 3);
275      {
276         static const char *const sysports[] = { "SERVICE", "P1", "UNUSED", "P2" };
277         return input_port_read(machine, sysports[offset & 3]);
278      }
276279
277280      case 0x2000/2:
278         return input_port_read_indexed(machine, 4 + (offset & 1));
281         return input_port_read(machine, (offset & 1) ? "DSW2" : "DSW1");
279282   }
280283   logerror("%06X:standard_io_r - unknown read access to address %04X\n", activecpu_get_pc(), offset * 2);
281284   return 0xffff;
src/mame/drivers/snookr10.c
r2956r2957
388388    BIT 7 = Complement of DS1, bit 7
389389------------------------------------*/
390390{
391return input_port_read_indexed(machine,3);
391return input_port_read(machine, "SW1");
392392}
393393
394394/**********************
r2956r2957
431431   bit1 = (data >> 3) & 1;
432432   bit2 = (data >> 5) & 1;
433433   bit3 = (data >> 7) & 1;
434   bit4 = (input_port_read_indexed(machine,5) & 1);
434   bit4 = (input_port_read_safe(machine, "IN5", 0) & 1); /* "IN5" has yet to be implemented! */
435435
436436   output_set_lamp_value(1, (bit1 & bit3));   /* Lamp 1 - START  */
437437   output_set_lamp_value(2, (bit0 & bit3));   /* Lamp 2 - CANCEL */
r2956r2957
456456{
457457   int bit0, bit1, bit4;
458458
459   bit0 = (input_port_read_indexed(machine,4) >> 1) & 1;
460   bit1 = (input_port_read_indexed(machine,4) >> 3) & 1;
459   bit0 = (input_port_read_safe(machine, "IN4", 0) >> 1) & 1; /* "IN4" has yet to be implemented! */
460   bit1 = (input_port_read_safe(machine, "IN4", 0) >> 3) & 1; /* "IN4" has yet to be implemented! */
461461   bit4 = (data & 1);
462462
463463   output_set_lamp_value(6, (bit1 & bit4));   /* Lamp 6 - STOP4  */
r2956r2957
472472static ADDRESS_MAP_START( snookr10_map, ADDRESS_SPACE_PROGRAM, 8 )
473473   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
474474   AM_RANGE(0x1000, 0x1000) AM_READWRITE(OKIM6295_status_0_r, OKIM6295_data_0_w)
475   AM_RANGE(0x3000, 0x3000) AM_READ(input_port_0_r)   /* IN0 */
476   AM_RANGE(0x3001, 0x3001) AM_READ(input_port_1_r)   /* IN1 */
477   AM_RANGE(0x3002, 0x3002) AM_READ(input_port_2_r)   /* IN2 */
478   AM_RANGE(0x3003, 0x3003) AM_READ(input_port_3_r)   /* DS1 */
475   AM_RANGE(0x3000, 0x3000) AM_READ_PORT("IN0")      /* IN0 */
476   AM_RANGE(0x3001, 0x3001) AM_READ_PORT("IN1")      /* IN1 */
477   AM_RANGE(0x3002, 0x3002) AM_READ_PORT("IN2")      /* IN2 */
478   AM_RANGE(0x3003, 0x3003) AM_READ_PORT("SW1")      /* DS1 */
479479   AM_RANGE(0x3004, 0x3004) AM_READ(dsw_port_1_r)      /* complement of DS1, bit 7 */
480480   AM_RANGE(0x5000, 0x5000) AM_WRITE(output_port_0_w)   /* OUT0 */
481481   AM_RANGE(0x5001, 0x5001) AM_WRITE(output_port_1_w)   /* OUT1 */
r2956r2957
487487static ADDRESS_MAP_START( tenballs_map, ADDRESS_SPACE_PROGRAM, 8 )
488488   AM_RANGE(0x0000, 0x0fff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
489489   AM_RANGE(0x1000, 0x1000) AM_READWRITE(OKIM6295_status_0_r, OKIM6295_data_0_w)
490   AM_RANGE(0x4000, 0x4000) AM_READ(input_port_0_r)   /* IN0 */
491   AM_RANGE(0x4001, 0x4001) AM_READ(input_port_1_r)   /* IN1 */
492   AM_RANGE(0x4002, 0x4002) AM_READ(input_port_2_r)   /* IN2 */
493   AM_RANGE(0x4003, 0x4003) AM_READ(input_port_3_r)   /* DS1 */
490   AM_RANGE(0x4000, 0x4000) AM_READ_PORT("IN0")      /* IN0 */
491   AM_RANGE(0x4001, 0x4001) AM_READ_PORT("IN1")      /* IN1 */
492   AM_RANGE(0x4002, 0x4002) AM_READ_PORT("IN2")      /* IN2 */
493   AM_RANGE(0x4003, 0x4003) AM_READ_PORT("SW1")      /* DS1 */
494494   AM_RANGE(0x5000, 0x5000) AM_WRITE(output_port_0_w)   /* OUT0 */
495495   AM_RANGE(0x5001, 0x5001) AM_WRITE(output_port_1_w)   /* OUT1 */
496496   AM_RANGE(0x6000, 0x6fff) AM_RAM_WRITE(snookr10_videoram_w) AM_BASE(&videoram)
src/mame/drivers/segahang.c
r2956r2957
157157         return ppi8255_r(device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_0" ), offset & 3);
158158
159159      case 0x1000/2: /* Input ports and DIP switches */
160         return input_port_read_indexed(machine, offset & 3);
160      {
161         static const char *sysports[] = { "SERVICE", "COINAGE", "DSW", "UNKNOWN" };
162         return input_port_read(machine, sysports[offset & 3]);
163      }
161164
162165      case 0x3000/2: /* PPI @ 4C */
163166         return ppi8255_r(device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_1" ), offset & 3);
164167
165168      case 0x3020/2: /* ADC0804 data output */
166         return input_port_read_indexed(machine, 4 + adc_select);
169      {
170         static const char *adcports[] = { "ADC0", "ADC1", "ADC2", "ADC3" };
171         return input_port_read_safe(machine, adcports[adc_select], 0);
172      }
167173   }
168174
169175   logerror("%06X:hangon_io_r - unknown read access to address %04X\n", activecpu_get_pc(), offset * 2);
r2956r2957
202208         return ppi8255_r(device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_0" ), offset & 3);
203209
204210      case 0x0010/2: /* Input ports and DIP switches */
205         return input_port_read_indexed(machine, offset & 3);
211      {
212         static const char *sysports[] = { "SERVICE", "UNKNOWN", "COINAGE", "DSW" };
213         return input_port_read(machine, sysports[offset & 3]);
214      }
206215
207216      case 0x0020/2: /* PPI @ 4C */
208217         if (offset == 2) return 0;
209218         return ppi8255_r(device_list_find_by_tag( machine->config->devicelist, PPI8255, "ppi8255_1" ), offset & 3);
210219
211220      case 0x0030/2: /* ADC0804 data output */
212         return input_port_read_indexed(machine, 4 + adc_select);
221      {
222         static const char *adcports[] = { "ADC0", "ADC1", "ADC2", "ADC3" };
223         return input_port_read_safe(machine, adcports[adc_select], 0);
224      }
213225   }
214226
215227   logerror("%06X:sharrier_io_r - unknown read access to address %04X\n", activecpu_get_pc(), offset * 2);
r2956r2957
333345
334346static void sharrier_i8751_sim(running_machine *machine)
335347{
336   workram[0x492/2] = (input_port_read_indexed(machine, 4) << 8) | input_port_read_indexed(machine, 5);
348   workram[0x492/2] = (input_port_read(machine, "ADC0") << 8) | input_port_read(machine, "ADC1");
337349}
338350
339351
src/mame/drivers/stvinit.c
r2956r2957
1111#include "machine/stvprot.h"
1212#include "includes/stv.h"
1313
14#define FIRST_SPEEDUP_SLOT   (2)         // in case we remove/alter the BIOS speedups later
15
1416/*
1517IC-13 rom shifter routine,on 2000000-21fffff the game maps the rom bytes on the
1618ODD (in every sense) bytes.This gets the IC-13 rom status to good and ends a emulation
r2956r2957
174176
175177static READ32_HANDLER( stv_speedup_r )
176178{
177   if (activecpu_get_pc()==0x60154b4) cpu_spinuntil_int(); // bios menus..
179   if (activecpu_get_pc()==0x60154b2) cpu_spinuntil_int(); // bios menus..
180   cpu_spinuntil_int();
178181
179182   return stv_workram_h[0x0335d0/4];
180183}
181184
182185static READ32_HANDLER( stv_speedup2_r )
183186{
184   if (activecpu_get_pc()==0x6013af0) cpu_spinuntil_int(); // for use in japan
187   if (activecpu_get_pc()==0x6013aee) cpu_spinuntil_int(); // for use in japan
185188
189   cpu_spinuntil_int();
190
186191   return stv_workram_h[0x0335bc/4];
187192}
188193
189194void install_stvbios_speedups(running_machine *machine)
190195{
196   // flushes 0 & 1 on both CPUs are for the BIOS speedups
197   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
198   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60154b2);
199   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
200   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6013aee);
201
202   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, 0);
203   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60154b2);
204   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, 1);
205   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6013aee);
206
191207/* idle skip bios? .. not 100% sure this is safe .. we'll see */
192208   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60335d0, 0x60335d3, 0, 0, stv_speedup_r );
193209   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60335bc, 0x60335bf, 0, 0, stv_speedup2_r );
r2956r2957
195211
196212static READ32_HANDLER( shienryu_slave_speedup_r )
197213{
198 if (activecpu_get_pc()==0x06004410)
214 if (activecpu_get_pc()==0x0600440e)
199215  cpu_spinuntil_time(ATTOTIME_IN_USEC(20)); // is this safe... we can't skip till vbl because its not a vbl wait loop
200216
201217 return stv_workram_h[0x0ae8e4/4];
r2956r2957
204220
205221static READ32_HANDLER( shienryu_speedup_r )
206222{
207   if (activecpu_get_pc()==0x060041C8) cpu_spinuntil_int(); // after you enable the sound cpu ...
223   if (activecpu_get_pc()==0x060041C6) cpu_spinuntil_int(); // after you enable the sound cpu ...
208224   return stv_workram_h[0x0ae8e0/4];
209225}
210226
r2956r2957
214230   stv_default_eeprom = shienryu_default_eeprom;
215231   stv_default_eeprom_length = sizeof(shienryu_default_eeprom);
216232
233   // master
234   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
235   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60041c6);
236   // slave
237   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
238   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x600440e);
239
217240   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ae8e0, 0x60ae8e3, 0, 0, shienryu_speedup_r ); // after you enable sound cpu
218241   memory_install_read32_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x60ae8e4, 0x60ae8e7, 0, 0, shienryu_slave_speedup_r ); // after you enable sound cpu
219242
r2956r2957
222245
223246static READ32_HANDLER( prikura_speedup_r )
224247{
225   if (activecpu_get_pc()==0x6018642) cpu_spinuntil_int(); // after you enable the sound cpu ...
248   if (activecpu_get_pc()==0x6018640) cpu_spinuntil_int(); // after you enable the sound cpu ...
226249   return stv_workram_h[0x0b9228/4];
227250}
228251
229252static void prikura_slave_speedup( UINT32 data )
230253{
231   if ( activecpu_get_pc() == 0x06018c70 )
254   if ( activecpu_get_pc() == 0x06018c6e )
232255      if ( (data & 0x00800000) == 0 )
233256         cpunum_spinuntil_trigger(1, 1000);
234257}
r2956r2957
242265
243266    (loops for 263473 instructions)
244267*/
268   // master
269   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
270   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6018640);
271   // slave
272   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
273   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6018c6e);
274
245275   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60b9228, 0x60b922b, 0, 0, prikura_speedup_r );
246276   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)prikura_slave_speedup );
247277
r2956r2957
255285
256286static READ32_HANDLER( hanagumi_speedup_r )
257287{
258   if (activecpu_get_pc()==0x06010162) cpu_spinuntil_int(); // title logos
288   if (activecpu_get_pc()==0x06010160) cpu_spinuntil_int(); // title logos
259289
260290   return stv_workram_h[0x94188/4];
261291}
r2956r2957
287317
288318   (loops for 288688 instructions)
289319*/
320   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
321   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6010160);
322
290323      memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6094188, 0x609418b, 0, 0, hanagumi_speedup_r );
291324      memory_install_read32_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x6015438, 0x601543b, 0, 0, hanagumi_slave_off );
292325
r2956r2957
314347
315348static READ32_HANDLER( puyosun_speedup_r )
316349{
317   if (activecpu_get_pc()==0x6021CF2) cpu_spinuntil_time(ATTOTIME_IN_USEC(400)); // spinuntilint breaks controls again .. urgh
350   if (activecpu_get_pc()==0x6021CF0) cpu_spinuntil_time(ATTOTIME_IN_USEC(400)); // spinuntilint breaks controls again .. urgh
318351
319352
320353   return stv_workram_h[0x0ffc10/4];
r2956r2957
322355
323356static void puyosun_slave_speedup( UINT32 data )
324357{
325   if ( activecpu_get_pc() == 0x6023700 )
358   if ( activecpu_get_pc() == 0x60236fe )
326359      if ( (data & 0x00800000) == 0 )
327360         cpunum_spinuntil_trigger(1, 1000);
328361}
329362
330363DRIVER_INIT(puyosun)
331364{
365   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
366   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6021cf0);
367
368   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
369   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60236fe);
370
332371      memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffc10, 0x60ffc13, 0, 0, puyosun_speedup_r ); // idle loop of main cpu
333372   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)puyosun_slave_speedup );
334373
r2956r2957
350389
351390static READ32_HANDLER( mausuke_speedup_r )
352391{
353   if (activecpu_get_pc()==0x060461A2) cpu_spinuntil_time(ATTOTIME_IN_USEC(20)); // spinuntilint breaks controls again .. urgh
392   if (activecpu_get_pc()==0x060461A0) cpu_spinuntil_time(ATTOTIME_IN_USEC(20)); // spinuntilint breaks controls again .. urgh
354393
355394   return stv_workram_h[0x0ffc10/4];
356395}
357396
358397DRIVER_INIT(mausuke)
359398{
399   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
400   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60461A0);
401
360402      memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffc10, 0x60ffc13, 0, 0, mausuke_speedup_r ); // idle loop of main cpu
361403
362404   DRIVER_INIT_CALL(ic13);
r2956r2957
367409
368410static READ32_HANDLER( cottonbm_speedup_r )
369411{
370   if (activecpu_get_pc()==0x06030EE4) cpu_spinuntil_time(ATTOTIME_IN_USEC(20)); // spinuntilint breaks lots of things
412   if (activecpu_get_pc()==0x06030EE2) cpu_spinuntil_time(ATTOTIME_IN_USEC(20)); // spinuntilint breaks lots of things
371413
372414   return stv_workram_h[0x0ffc10/4];
373415}
374416
375417static void cottonbm_slave_speedup( UINT32 data )
376418{
377   if (activecpu_get_pc() == 0x6032b54)
419   if (activecpu_get_pc() == 0x6032b52)
378420      if ( (data & 0x00800000) == 0 )
379421      {
380422         if (
r2956r2957
394436
395437DRIVER_INIT(cottonbm)
396438{
439   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
440   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6030EE2);
441   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
442   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6032b52);
443
397444      memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffc10, 0x60ffc13, 0, 0, cottonbm_speedup_r ); // idle loop of main cpu
398445   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)cottonbm_slave_speedup );
399446
r2956r2957
404451
405452static READ32_HANDLER( cotton2_speedup_r )
406453{
407   if (activecpu_get_pc()==0x06031c7c) cpu_spinuntil_time(ATTOTIME_IN_USEC(20)); // spinuntilint breaks lots of things
454   if (activecpu_get_pc()==0x06031c7a) cpu_spinuntil_time(ATTOTIME_IN_USEC(20)); // spinuntilint breaks lots of things
408455
409456   return stv_workram_h[0x0ffc10/4];
410457}
411458
412459static void cotton2_slave_speedup( UINT32 data )
413460{
414   if (activecpu_get_pc() == 0x60338ec)
461   if (activecpu_get_pc() == 0x60338ea)
415462      if ( (data & 0x00800000) == 0 )
416463      {
417464         if (
r2956r2957
430477
431478DRIVER_INIT(cotton2)
432479{
480   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
481   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6031c7a);
482   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
483   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60338ea);
484
433485      memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffc10, 0x60ffc13, 0, 0, cotton2_speedup_r ); // idle loop of main cpu
434486   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)cotton2_slave_speedup );
435487
r2956r2957
442494
443495static READ32_HANDLER( dnmtdeka_speedup_r )
444496{
445   if (activecpu_get_pc()==0x6027c92) cpu_spinuntil_int();//cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
497   if (activecpu_get_pc()==0x6027c90) cpu_spinuntil_int();//cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
446498   return stv_workram_h[0x0985a0/4];
447499}
448500
449501static WRITE32_HANDLER(dnmtdeka_cmd_write)
450502{
451503   COMBINE_DATA(&stv_workram_h[0x0e0ad4/4 + offset]);
452   if ( (cpu_getactivecpu() == 0) && (activecpu_get_pc() == 0x00000d06) )
504   if ( (cpu_getactivecpu() == 0) && (activecpu_get_pc() == 0x00000d04) )
453505      return;
454506
455507   if ( data != 0 ) dnmtdeka_pending_commands++;
r2956r2957
460512static READ32_HANDLER(dnmtdeka_cmd_read)
461513{
462514   //logerror( "CMD: Read by cpu=%d, at = %08X, offset = %08X, data = %08X, commands = %d\n", cpu_getactivecpu(), activecpu_get_pc(), offset, stv_workram_h[0xe0bd0/4 + offset], dnmtdeka_pending_commands );
463   if ( activecpu_get_pc() == 0x060051f4 )
515   if ( activecpu_get_pc() == 0x060051f2 )
464516   {
465517      if ( stv_workram_h[0x0e0ad4/4 + offset] == 0 )
466518      {
r2956r2957
479531
480532DRIVER_INIT(dnmtdeka)
481533{
534   // install all 3 speedups on both master and slave
535   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
536   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6027c90);
537   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
538   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0xd04);
539   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
540   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60051f2);
541
542   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
543   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6027c90);
544   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
545   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0xd04);
546   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
547   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60051f2);
548
482549   dnmtdeka_pending_commands = 0;
483550
484551   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60985a0, 0x60985a3, 0, 0, dnmtdeka_speedup_r ); // idle loop of main cpu
r2956r2957
491558
492559static READ32_HANDLER(diehard_speedup_r)
493560{
494   if ( activecpu_get_pc() == 0x06027c9a ) cpu_spinuntil_int();
561   if ( activecpu_get_pc() == 0x06027c98 ) cpu_spinuntil_int();
495562   return stv_workram_h[0x000986ac/4];
496563}
497564
498565static WRITE32_HANDLER(diehard_cmd_write)
499566{
500567   COMBINE_DATA(&stv_workram_h[0xe0bd0/4 + offset]);
501   if ( (cpu_getactivecpu() == 0) && (activecpu_get_pc() == 0x00000d06) )
568   if ( (cpu_getactivecpu() == 0) && (activecpu_get_pc() == 0x00000d04) )
502569      return;
503570
504571   if ( data != 0 ) diehard_pending_commands++;
r2956r2957
509576static READ32_HANDLER(diehard_cmd_read)
510577{
511578   //logerror( "CMD: Read by cpu=%d, at = %08X, offset = %08X, data = %08X, commands = %d\n", cpu_getactivecpu(), activecpu_get_pc(), offset, stv_workram_h[0xe0bd0/4 + offset], diehard_pending_commands );
512   if ( activecpu_get_pc() == 0x060051f4 )
579   if ( activecpu_get_pc() == 0x060051f2 )
513580   {
514581      if ( stv_workram_h[0xe0bd0/4 + offset] == 0 )
515582      {
r2956r2957
553620{
554621   diehard_pending_commands = 0;
555622
623   // install all 3 speedups on both master and slave
624   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
625   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6027c98);
626   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
627   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0xd04);
628   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
629   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60051f2);
630
631   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
632   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6027c98);
633   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
634   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0xd04);
635   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
636   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60051f2);
637
638
556639   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x060986ac, 0x060986af, 0, 0, diehard_speedup_r );
557640   memory_install_write32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x060e0bd0, 0x060e0dcf, 0, 0, diehard_cmd_write );
558641   memory_install_read32_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x060e0bd0, 0x060e0dcf, 0, 0, diehard_cmd_read );
r2956r2957
562645
563646
564647   DRIVER_INIT_CALL(ic13);
565
566648}
567649
568650static READ32_HANDLER( fhboxers_speedup_r )
569651{
570   if (activecpu_get_pc()==0x060041c4) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
652   if (activecpu_get_pc()==0x060041c2) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
571653
572654   return stv_workram_h[0x00420c/4];
573655}
574656
575657static READ32_HANDLER( fhboxers_speedup2_r )
576658{
577   if (activecpu_get_pc()==0x0600bb0c) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
659   if (activecpu_get_pc()==0x0600bb0a) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
578660
579661
580662   return stv_workram_h[0x090740/4];
r2956r2957
582664
583665static READ32_HANDLER( fhboxers_speedup3_r )
584666{
585   if (activecpu_get_pc()==0x0600b320 )
667   if (activecpu_get_pc()==0x0600b31e )
586668      cpu_spinuntil_int();
587669
588670   return stv_workram_h[0x90bb4/4];
r2956r2957
590672
591673DRIVER_INIT(fhboxers)
592674{
675   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
676   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60041c2);
677   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
678   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x600bb0a);
679   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
680   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x600b31e);
681
593682      memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x600420c, 0x600420f, 0, 0, fhboxers_speedup_r ); // idle loop of main cpu
594683      memory_install_read32_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x6090740, 0x6090743, 0, 0, fhboxers_speedup2_r ); // idle loop of second cpu
595684     memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x06090bb4, 0x06090bb7, 0, 0, fhboxers_speedup3_r ); // idle loop of main cpu
r2956r2957
600689
601690static READ32_HANDLER( bakubaku_speedup_r )
602691{
603   if (activecpu_get_pc()==0x06036dc8) cpu_spinuntil_int(); // title logos
692   if (activecpu_get_pc()==0x06036dc6) cpu_spinuntil_int(); // title logos
604693
605694   return stv_workram_h[0x0833f0/4];
606695}
607696
608697static READ32_HANDLER( bakubaku_speedup2_r )
609698{
610   if (activecpu_get_pc()==0x06033762)    cpunum_set_input_line(machine, 1, INPUT_LINE_HALT, ASSERT_LINE);
699   if (activecpu_get_pc()==0x06033760)    cpunum_set_input_line(machine, 1, INPUT_LINE_HALT, ASSERT_LINE);
611700
612701   return stv_workram_h[0x0033762/4];
613702}
614703
615#ifdef UNUSED_FUNCTION
616static READ32_HANDLER( bakubaku_hangskip_r )
704DRIVER_INIT(bakubaku)
617705{
618   if (activecpu_get_pc()==0x060335e4) stv_workram_h[0x0335e6/4] = 0x32300909;
706   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
707   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6036dc6);
708   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
709   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6033760);
619710
620   return stv_workram_h[0x033660/4];
621}
622#endif
623
624DRIVER_INIT(bakubaku)
625{
626711      memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60833f0, 0x60833f3, 0, 0, bakubaku_speedup_r ); // idle loop of main cpu
627712      memory_install_read32_handler(machine, 1, ADDRESS_SPACE_PROGRAM, 0x60fdfe8, 0x60fdfeb, 0, 0, bakubaku_speedup2_r ); // turn off slave sh2, is it needed after boot ??
628      //memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6033660, 0x6033663, 0, 0, bakubaku_hangskip_r ); // it waits for a ram address to change what should change it?
629713
630714   DRIVER_INIT_CALL(ic13);
631715}
632716
633717static READ32_HANDLER( groovef_hack1_r )
634718{
635   if(activecpu_get_pc() == 0x6005e7e) stv_workram_h[0x0fffcc/4] = 0x00000000;
719   if(activecpu_get_pc() == 0x6005e7c) stv_workram_h[0x0fffcc/4] = 0x00000000;
636720//  popmessage("1 %08x",activecpu_get_pc());
637721   return stv_workram_h[0x0fffcc/4];
638722}
639723
640724static READ32_HANDLER( groovef_hack2_r )
641725{
642   if(activecpu_get_pc() == 0x6005e88) stv_workram_h[0x0ca6cc/4] = 0x00000000;
726   if(activecpu_get_pc() == 0x6005e86) stv_workram_h[0x0ca6cc/4] = 0x00000000;
643727//  popmessage("2 %08x",activecpu_get_pc());
644728   return stv_workram_h[0x0ca6cc/4];
645729}
r2956r2957
647731static READ32_HANDLER( groovef_speedup_r )
648732{
649733//  logerror ("groove speedup \n");
650   if (activecpu_get_pc()==0x060a4972)
734   if (activecpu_get_pc()==0x060a4970)
651735   {
652736      cpu_spinuntil_int(); // title logos
653737//      logerror ("groove speedup skipping\n");
r2956r2957
666750
667751static void groovef_slave_speedup( UINT32 data )
668752{
669   if ( activecpu_get_pc() == 0x060060c4 )
753   if ( activecpu_get_pc() == 0x060060c2 )
670754      if ( (data & 0x00800000) == 0 )
671755         cpunum_spinuntil_trigger(1, 1000);
672756}
673757
674758DRIVER_INIT( groovef )
675759{
760   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
761   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6005e7c);
762   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
763   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6005e86);
764   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+2);
765   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60a4970);
766
767   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
768   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60060c2);
769
676770   /* prevent game from hanging on startup -- todo: remove these hacks */
677771   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ca6cc, 0x60ca6cf, 0, 0, groovef_hack2_r );
678772   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60fffcc, 0x60fffcf, 0, 0, groovef_hack1_r );
r2956r2957
717811static READ32_HANDLER( danchih_hack_r )
718812{
719813   logerror( "DMASt_SCU1: Read at PC=%08x, value = %08x\n", activecpu_get_pc(), stv_workram_h[0x0ffcbc/4] );
720   if (activecpu_get_pc()==0x06028b2a) return 0x0e0c0000;
814   if (activecpu_get_pc()==0x06028b28) return 0x0e0c0000;
721815
722816   return stv_workram_h[0x0ffcbc/4];
723817}
724818
725819static READ32_HANDLER( danchih_speedup_r )
726820{
727   if (activecpu_get_pc()==0x06028c90) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
821   if (activecpu_get_pc()==0x06028c8e) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
728822   return stv_workram_h[0x0ffc10/4];
729823}
730824
731825static void danchih_slave_speedup( UINT32 data )
732826{
733   if ( activecpu_get_pc() == 0x0602ae28 )
827   if ( activecpu_get_pc() == 0x0602ae26 )
734828      if ( (data & 0x00800000) == 0 )
735829         cpunum_spinuntil_trigger(1, 1000);
736830}
737831
738832DRIVER_INIT( danchih )
739833{
834   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
835   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6028b28);
836   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
837   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6028c8e);
838   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
839   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602ae26);
840
740841   /* prevent game from hanging on title screen -- todo: remove these hacks */
741842   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffcbc, 0x60ffcbf, 0, 0, danchih_hack_r );
742843
r2956r2957
771872
772873static READ32_HANDLER( astrass_hack_r )
773874{
774   if(activecpu_get_pc()==0x60011bc) return 0x00000000;
875   if(activecpu_get_pc()==0x60011b8) return 0x00000000;
775876
776877   return stv_workram_h[0x000770/4];
777878}
778879
779880static READ32_HANDLER( astrass_speedup_r )
780881{
781   if(activecpu_get_pc() == 0x0605b9dc )
882   if(activecpu_get_pc() == 0x0605b9da )
782883      cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
783884
784885   return stv_workram_h[0x8e4d8/4];
r2956r2957
786887
787888DRIVER_INIT( astrass )
788889{
890   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
891   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60011b8);
892   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
893   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x605b9da);
894
789895   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000770, 0x6000773, 0, 0, astrass_hack_r );
790896
791897   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0608e4d8, 0x0608e4db, 0, 0, astrass_speedup_r );
r2956r2957
799905
800906static READ32_HANDLER(thunt_speedup_r)
801907{
802   if (activecpu_get_pc() == 0x0602A026) cpu_spinuntil_int();
908   if (activecpu_get_pc() == 0x0602A024) cpu_spinuntil_int();
803909   return stv_workram_h[0x00031424/4];
804910}
805911
806912static READ32_HANDLER(thunt_speedup2_r)
807913{
808   if (activecpu_get_pc() == 0x06013EEC) cpu_spinuntil_int();
914   if (activecpu_get_pc() == 0x06013EEA) cpu_spinuntil_int();
809915   return stv_workram_h[0x00075958/4];
810916}
811917
812918static void thunt_slave_speedup(UINT32 data)
813919{
814   if (activecpu_get_pc() == 0x0602AAFA)
920   if (activecpu_get_pc() == 0x0602AAF8)
815921      if ( (data & 0x00800000) == 0 )
816922         cpunum_spinuntil_trigger(1, 1000);
817923}
818924
819925DRIVER_INIT(thunt)
820926{
927   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
928   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602A024);
929   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
930   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6013EEA);
931   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
932   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602AAF8);
933
821934/*
8229350602A024: MOV.L   @R6,R0    // 06031424
8239360602A026: TST     R0,R0
r2956r2957
854967
855968static READ32_HANDLER(sandor_speedup_r)
856969{
857   if (activecpu_get_pc() == 0x0602a0fa) cpu_spinuntil_int();
970   if (activecpu_get_pc() == 0x0602a0f8) cpu_spinuntil_int();
858971   return stv_workram_h[0x000314f8/4];
859972}
860973
861974static READ32_HANDLER(sandor_speedup2_r)
862975{
863   if (activecpu_get_pc() == 0x06013fc0) cpu_spinuntil_int();
976   if (activecpu_get_pc() == 0x06013fbe) cpu_spinuntil_int();
864977   return stv_workram_h[0x00075a2c/4];
865978}
866979
867980
868981static void sandor_slave_speedup(UINT32 data)
869982{
870   if (activecpu_get_pc() == 0x0602abce)
983   if (activecpu_get_pc() == 0x0602abcc)
871984      if ( (data & 0x00800000) == 0 )
872985         cpunum_spinuntil_trigger(1, 1000);
873986}
874987
875988DRIVER_INIT(sandor)
876989{
990   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
991   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602a0f8);
992   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT+1);
993   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6013fbe);
994   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
995   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602abcc);
996
877997   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x060314f8, 0x060314fb, 0, 0, sandor_speedup_r );
878998   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x06075a2c, 0x06075a2f, 0, 0, sandor_speedup2_r );
879999   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf *)sandor_slave_speedup);
r2956r2957
8841004
8851005static READ32_HANDLER(grdforce_speedup_r)
8861006{
887   if ( activecpu_get_pc() == 0x06041E34 ) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
1007   if ( activecpu_get_pc() == 0x06041E32 ) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
8881008   return stv_workram_h[0x000ffc10/4];
8891009}
8901010
8911011static void grdforce_slave_speedup( UINT32 data )
8921012{
893   if (activecpu_get_pc() == 0x06043aa4)
1013   if (activecpu_get_pc() == 0x06043aa2)
8941014      if ( (data & 0x00800000) == 0 )
8951015      {
8961016         if (
r2956r2957
9101030
9111031DRIVER_INIT(grdforce)
9121032{
1033   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1034   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6041e32);
1035   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1036   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6043aa2);
9131037/*
914103806041E2C: MOV.L   @($03C8,GBR),R0
915103906041E2E: JSR     R0
r2956r2957
9321056static READ32_HANDLER( batmanfr_speedup_r )
9331057{
9341058   //logerror( "batmanfr speedup: pc = %08x, mem = %08x\n", activecpu_get_pc(), stv_workram_h[0x0002acf0/4] );
935   if ( activecpu_get_pc() != 0x060121c2 )
1059   if ( activecpu_get_pc() != 0x060121c0 )
9361060      cpu_spinuntil_int();
9371061
9381062   return stv_workram_h[0x0002acf0/4];
r2956r2957
9401064
9411065static void batmanfr_slave_speedup( UINT32 data )
9421066{
943   if (activecpu_get_pc() == 0x060125be )
1067   if (activecpu_get_pc() == 0x060125bc )
9441068      if ( (data & 0x00800000) == 0 )
9451069         cpunum_spinuntil_trigger(1, 1000);
9461070}
r2956r2957
9481072
9491073DRIVER_INIT(batmanfr)
9501074{
1075   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1076   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60121c0);
1077   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1078   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60125bc);
1079
9511080   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0602acf0, 0x0602acf3, 0, 0, batmanfr_speedup_r );
9521081   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)batmanfr_slave_speedup );
9531082
r2956r2957
9591088
9601089static void colmns97_slave_speedup( UINT32 data )
9611090{
962   if (activecpu_get_pc() == 0x060298a4 )
1091   if (activecpu_get_pc() == 0x060298a2 )
9631092      if ( (data & 0x00800000) == 0 )
9641093         if ( (stv_workram_h[0x0ffc48/4] != 0x260ef3fc) )
9651094         {
r2956r2957
9711100
9721101DRIVER_INIT(colmns97)
9731102{
1103   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1104   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60298a2);
1105
9741106   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)colmns97_slave_speedup );
9751107
9761108   DRIVER_INIT_CALL(ic13);
r2956r2957
9811113
9821114static READ32_HANDLER(winterht_speedup_r)
9831115{
984   if ( activecpu_get_pc() == 0x06098aec ) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));//cpu_spinuntil_int();
1116   if ( activecpu_get_pc() == 0x06098aea ) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));//cpu_spinuntil_int();
9851117   return stv_workram_h[0x000ffc10/4];
9861118}
9871119
9881120static void winterht_slave_speedup( UINT32 data )
9891121{
990   if (activecpu_get_pc() == 0x0609ae50 )
1122   if (activecpu_get_pc() == 0x0609ae4e )
9911123      if ( (data & 0x00800000) == 0 )
9921124         cpunum_spinuntil_trigger(1, 1000);
9931125}
9941126
9951127DRIVER_INIT(winterht)
9961128{
1129   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1130   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6098aea);
1131   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1132   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x609ae4e);
1133
9971134   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x060ffc10, 0x060ffc13, 0, 0, winterht_speedup_r );
9981135
9991136   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)winterht_slave_speedup );
r2956r2957
10051142
10061143static READ32_HANDLER(seabass_speedup_r)
10071144{
1008   if ( activecpu_get_pc() == 0x0602cbfc ) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
1145   if ( activecpu_get_pc() == 0x0602cbfa ) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
10091146   return stv_workram_h[0x000ffc10/4];
10101147}
10111148
10121149static void seabass_slave_speedup( UINT32 data )
10131150{
1014   if (activecpu_get_pc() == 0x060321f0 )
1151   if (activecpu_get_pc() == 0x060321ee )
10151152      if ( (data & 0x00800000) == 0 )
10161153         cpunum_spinuntil_trigger(1, 1000);
10171154}
r2956r2957
10191156
10201157DRIVER_INIT(seabass)
10211158{
1159   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1160   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602cbfa);
1161   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1162   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60321ee);
1163
10221164   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x060ffc10, 0x060ffc13, 0, 0, seabass_speedup_r );
10231165
10241166   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)seabass_slave_speedup );
r2956r2957
10301172
10311173static void vfremix_slave_speedup( UINT32 data )
10321174{
1033   if (activecpu_get_pc() == 0x0604C334 )
1175   if (activecpu_get_pc() == 0x0604C332 )
10341176      if ( (data & 0x00800000) == 0 )
10351177         cpunum_spinuntil_trigger(1, 1000);
10361178}
10371179
10381180static READ32_HANDLER(vfremix_speedup_r)
10391181{
1040   if ( activecpu_get_pc() == 0x0602c30e ) cpu_spinuntil_int();
1182   if ( activecpu_get_pc() == 0x0602c30c ) cpu_spinuntil_int();
10411183   return stv_workram_h[0x00074f98/4];
10421184}
10431185
10441186DRIVER_INIT(vfremix)
10451187{
1188   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1189   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602c30c);
1190   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1191   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x604c332);
1192
10461193   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x06074f98, 0x06074f9b, 0, 0, vfremix_speedup_r );
10471194   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)vfremix_slave_speedup );
10481195
r2956r2957
10541201
10551202static READ32_HANDLER(sss_speedup_r)
10561203{
1057   if ( activecpu_get_pc() == 0x0602639a ) cpu_spinuntil_int();
1204   if ( activecpu_get_pc() == 0x06026398 ) cpu_spinuntil_int();
10581205   return stv_workram_h[0x000ffc10/4];
10591206}
10601207
10611208static void sss_slave_speedup( UINT32 data )
10621209{
1063   if (activecpu_get_pc() == 0x06028cd8 )
1210   if (activecpu_get_pc() == 0x06028cd6 )
10641211      if ( (data & 0x00800000) == 0 )
10651212         cpunum_spinuntil_trigger(1, 1000);
10661213}
10671214
10681215DRIVER_INIT(sss)
10691216{
1217   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1218   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6026398);
1219   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1220   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6028cd6);
1221
10701222   install_standard_protection(machine);
10711223   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x060ffc10, 0x060ffc13, 0, 0, sss_speedup_r );
10721224   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)sss_slave_speedup );
r2956r2957
10781230
10791231static READ32_HANDLER(othellos_speedup_r)
10801232{
1081   if ( activecpu_get_pc() == 0x0602bcc0 ) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
1233   if ( activecpu_get_pc() == 0x0602bcbe ) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
10821234   return stv_workram_h[0x000ffc10/4];
10831235}
10841236
10851237static void othellos_slave_speedup( UINT32 data )
10861238{
1087   if (activecpu_get_pc() == 0x0602d930 )
1239   if (activecpu_get_pc() == 0x0602d92e )
10881240      if ( (data & 0x00800000) == 0 )
10891241         if ( (stv_workram_h[0x0ffc48/4] != 0x260fd25c ) )
10901242         {
r2956r2957
10951247
10961248DRIVER_INIT(othellos)
10971249{
1250   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1251   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602bcbe);
1252   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1253   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602d92e);
1254
10981255   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x060ffc10, 0x060ffc13, 0, 0, othellos_speedup_r );
10991256   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)othellos_slave_speedup );
11001257
r2956r2957
11061263
11071264static void sasissu_slave_speedup( UINT32 data )
11081265{
1109   if ( activecpu_get_pc() == 0x060710C0 )
1266   if ( activecpu_get_pc() == 0x060710be )
11101267      if ( (data & 0x00800000) == 0 )
11111268         cpunum_spinuntil_trigger(1, 1000);
11121269}
11131270
11141271DRIVER_INIT(sasissu)
11151272{
1273   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1274   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60710be);
1275
11161276   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)sasissu_slave_speedup );
11171277
11181278   DRIVER_INIT_CALL(ic13);
r2956r2957
11221282
11231283static READ32_HANDLER(gaxeduel_speedup_r)
11241284{
1125   if ( activecpu_get_pc() == 0x06012ee6 ) cpu_spinuntil_int();
1285   if ( activecpu_get_pc() == 0x06012ee4 ) cpu_spinuntil_int();
11261286   return stv_workram_l[0x000f4068 / 4];
11271287}
11281288
11291289DRIVER_INIT(gaxeduel)
11301290{
1291   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1292   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6012ee4);
1293
11311294   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x002f4068, 0x002f406b, 0, 0, gaxeduel_speedup_r);
11321295   DRIVER_INIT_CALL(ic13);
11331296}
11341297
11351298static READ32_HANDLER(suikoenb_speedup_r)
11361299{
1137   if ( activecpu_get_pc() == 0x06013f7c ) cpu_spinuntil_int();
1300   if ( activecpu_get_pc() == 0x06013f7a ) cpu_spinuntil_int();
11381301   return stv_workram_h[0x000705d0 / 4];
11391302}
11401303
11411304DRIVER_INIT(suikoenb)
11421305{
1306   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1307   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6013f7a);
1308
11431309   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x060705d0, 0x060705d3, 0, 0, suikoenb_speedup_r);
11441310   DRIVER_INIT_CALL(ic13);
11451311}
r2956r2957
11481314{
11491315   logerror( "SlaveSH2: Idle loop skip, data = %08X\n", data );
11501316   if (stv_enable_slave_sh2)
1151      if ( activecpu_get_pc() == 0x0605eec2 )
1317      if ( activecpu_get_pc() == 0x0605eec0 )
11521318         if ( (data & 0x00800000) == 0 )
11531319            cpunum_spinuntil_trigger(1, 1000);
11541320}
11551321
11561322static READ32_HANDLER(sokyugrt_speedup_r)
11571323{
1158   if ( activecpu_get_pc() == 0x0605d9dc ) cpu_spinuntil_int();
1324   if ( activecpu_get_pc() == 0x0605d9da ) cpu_spinuntil_int();
11591325   return stv_workram_h[0x000788cc / 4];
11601326}
11611327
11621328DRIVER_INIT(sokyugrt)
11631329{
1330   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1331   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x605d9da);
1332   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1333   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x605eec0);
1334
11641335   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)sokyugrt_slave_speedup );
11651336   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x060788cc, 0x060788cf, 0, 0, sokyugrt_speedup_r);
11661337   DRIVER_INIT_CALL(ic13);
r2956r2957
11701341
11711342static READ32_HANDLER( znpwfv_speedup_r )
11721343{
1173   if (activecpu_get_pc()==0x6012ec4) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
1344   if (activecpu_get_pc()==0x6012ec2) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
11741345   return stv_workram_h[0x0ffc10/4];
11751346}
11761347
11771348static void znpwfv_slave_speedup( UINT32 data )
11781349{
1179   if ( activecpu_get_pc() == 0x060175a8 )
1350   if ( activecpu_get_pc() == 0x060175a6 )
11801351      if ( (data & 0x00800000) == 0 )
11811352      {
11821353         if (
r2956r2957
11941365
11951366DRIVER_INIT(znpwfv)
11961367{
1368   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1369   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6012ec2);
1370   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1371   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x60175a6);
1372
11971373   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)znpwfv_slave_speedup );
11981374   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffc10, 0x60ffc13, 0, 0, znpwfv_speedup_r );
11991375
r2956r2957
12031379
12041380static READ32_HANDLER( twcup98_speedup_r )
12051381{
1206   if (activecpu_get_pc()==0x605ede0) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
1382   if (activecpu_get_pc()==0x605edde) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
12071383   return stv_workram_h[0x0ffc10/4];
12081384}
12091385
12101386static void twcup98_slave_speedup( UINT32 data )
12111387{
1212   if ( activecpu_get_pc() == 0x06062bcc )
1388   if ( activecpu_get_pc() == 0x06062bca )
12131389      if ( (data & 0x00800000) == 0 )
12141390         cpunum_spinuntil_trigger(1, 1000);
12151391}
12161392
12171393DRIVER_INIT(twcup98)
12181394{
1395   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1396   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x605edde);
1397   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1398   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6062bca);
1399
12191400   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)twcup98_slave_speedup );
12201401   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffc10, 0x60ffc13, 0, 0, twcup98_speedup_r );
12211402
r2956r2957
12271408
12281409static READ32_HANDLER( smleague_speedup_r )
12291410{
1230   if (activecpu_get_pc()==0x6063bf6) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
1411   if (activecpu_get_pc()==0x6063bf4) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
12311412   return stv_workram_h[0x0ffc10/4];
12321413}
12331414
12341415static void smleague_slave_speedup( UINT32 data )
12351416{
1236   if ( activecpu_get_pc() == 0x06062bcc )
1417   if ( activecpu_get_pc() == 0x06062bca )
12371418      if ( (data & 0x00800000) == 0 )
12381419         cpunum_spinuntil_trigger(1, 1000);
12391420}
12401421
12411422DRIVER_INIT(smleague)
12421423{
1424   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1425   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6063bf4);
1426   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1427   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6062bca);
1428
12431429   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)smleague_slave_speedup );
12441430   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffc10, 0x60ffc13, 0, 0, smleague_speedup_r );
12451431
r2956r2957
12501436
12511437static READ32_HANDLER( finlarch_speedup_r )
12521438{
1253   if (activecpu_get_pc()==0x6064d62) cpu_spinuntil_int();
1439   if (activecpu_get_pc()==0x6064d60) cpu_spinuntil_int();
12541440   return stv_workram_h[0x0ffc10/4];
12551441}
12561442
12571443
12581444DRIVER_INIT(finlarch)
12591445{
1446   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1447   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6064d60);
1448
12601449   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffc10, 0x60ffc13, 0, 0, finlarch_speedup_r );
12611450
12621451   DRIVER_INIT_CALL(ic13);
r2956r2957
12651454
12661455static READ32_HANDLER( maruchan_speedup_r )
12671456{
1268   if (activecpu_get_pc()==0x06012a54) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
1457   if (activecpu_get_pc()==0x06012a52) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
12691458   return stv_workram_h[0x0ffc10/4];
12701459}
12711460
12721461static void maruchan_slave_speedup( UINT32 data )
12731462{
1274   if ( activecpu_get_pc() == 0x0601ba48 )
1463   if ( activecpu_get_pc() == 0x0601ba46 )
12751464      if ( (data & 0x00800000) == 0 )
12761465         if (
12771466         (stv_workram_h[0x0ffc48/4] != 0x260ef3c8) &&
r2956r2957
12871476
12881477DRIVER_INIT(maruchan)
12891478{
1479   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1480   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x601ba46);
1481   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1482   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x601ba46);
1483
12901484   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)maruchan_slave_speedup );
12911485   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffc10, 0x60ffc13, 0, 0, maruchan_speedup_r );
12921486
r2956r2957
12971491
12981492static READ32_HANDLER( pblbeach_speedup_r )
12991493{
1300   if (activecpu_get_pc()==0x0605eb7a)
1494   if (activecpu_get_pc()==0x0605eb78)
13011495      if (stv_workram_h[0x006c398/4] != 0)
13021496         cpu_spinuntil_int();
13031497   return stv_workram_h[0x006c398/4];
r2956r2957
13051499
13061500DRIVER_INIT(pblbeach)
13071501{
1502   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1503   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x605eb78);
1504
13081505   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0606c398, 0x0606c39b, 0, 0, pblbeach_speedup_r );
13091506
13101507   DRIVER_INIT_CALL(ic13);
r2956r2957
13121509
13131510static READ32_HANDLER( shanhigw_speedup_r )
13141511{
1315   if (activecpu_get_pc()==0x06020c5e)
1512   if (activecpu_get_pc()==0x06020c5c)
13161513         cpu_spinuntil_int();
13171514   return stv_workram_h[0x95cd8/4];
13181515}
13191516
13201517DRIVER_INIT(shanhigw)
13211518{
1519   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1520   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6020c5c);
1521
13221522   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x06095cd8, 0x06095cdb, 0, 0, shanhigw_speedup_r );
13231523
13241524   DRIVER_INIT_CALL(stv);
r2956r2957
13261526
13271527static READ32_HANDLER( elandore_speedup_r )
13281528{
1329   if (activecpu_get_pc()==0x0604eac2) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
1529   if (activecpu_get_pc()==0x0604eac0) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
13301530   return stv_workram_h[0x0ffc10/4];
13311531}
13321532
13331533
13341534static void elandore_slave_speedup(UINT32 data)
13351535{
1336   if (activecpu_get_pc() == 0x0605340c)
1536   if (activecpu_get_pc() == 0x0605340a)
13371537      if ( (data & 0x00800000) == 0 )
13381538         if ( (stv_workram_h[0x0ffc48/4] != 0x260ee018) )
13391539         {
r2956r2957
13451545
13461546DRIVER_INIT(elandore)
13471547{
1548   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1549   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x604eac0);
1550   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1551   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x605340a);
1552
13481553   install_standard_protection(machine);
13491554   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffc10, 0x60ffc13, 0, 0, elandore_speedup_r );
13501555   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf *)elandore_slave_speedup);
r2956r2957
13551560
13561561static READ32_HANDLER( rsgun_speedup_r )
13571562{
1358   if (activecpu_get_pc()==0x06034d06) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
1563   if (activecpu_get_pc()==0x06034d04) cpu_spinuntil_time(ATTOTIME_IN_USEC(20));
13591564   return stv_workram_h[0x0ffc10/4];
13601565}
13611566
13621567static void rsgun_slave_speedup(UINT32 data)
13631568{
1364   if (activecpu_get_pc() == 0x06036154)
1569   if (activecpu_get_pc() == 0x06036152)
13651570      if ( (data & 0x00800000) == 0 )
13661571         if ((stv_workram_h[0x0ffc48/4] != 0x260efc50))
13671572         {
r2956r2957
13731578
13741579DRIVER_INIT(rsgun)
13751580{
1581   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1582   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6034d04);
1583   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1584   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x6036152);
1585
13761586   install_standard_protection(machine);
13771587   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60ffc10, 0x60ffc13, 0, 0, rsgun_speedup_r );
13781588   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf *)rsgun_slave_speedup);
r2956r2957
13971607
13981608static READ32_HANDLER( nameclv3_speedup_r )
13991609{
1400   if (activecpu_get_pc()==0x601eb4e) cpu_spinuntil_time(ATTOTIME_IN_USEC(30));
1610   if (activecpu_get_pc()==0x601eb4c) cpu_spinuntil_time(ATTOTIME_IN_USEC(30));
14011611   return stv_workram_h[0x0452c0/4];
14021612}
14031613
14041614static void nameclv3_slave_speedup( UINT32 data )
14051615{
1406   if ( activecpu_get_pc() == 0x0602B810 )
1616   if ( activecpu_get_pc() == 0x0602B80e )
14071617      if ( (data & 0x00800000) == 0 )
14081618         cpunum_spinuntil_trigger(1, 1000);
14091619}
14101620
14111621DRIVER_INIT(nameclv3)
14121622{
1623   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1624   cpunum_set_info_int(0, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x601eb4c);
1625   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_SELECT, FIRST_SPEEDUP_SLOT);
1626   cpunum_set_info_int(1, CPUINFO_INT_SH2_PCFLUSH_ADDR, 0x602b80e);
1627
14131628   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x60452c0, 0x60452c3, 0, 0, nameclv3_speedup_r );
14141629   cpunum_set_info_fct(1, CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK, (genf*)nameclv3_slave_speedup );
14151630   DRIVER_INIT_CALL(stv);
src/mame/drivers/starshp1.c
r2956r2957
1717
1818static INTERRUPT_GEN( starshp1_interrupt )
1919{
20   if ((input_port_read_indexed(machine, 0) & 0x90) != 0x90)
20   if ((input_port_read(machine, "SYSTEM") & 0x90) != 0x90)
2121      cpunum_set_input_line(machine, 0, 0, PULSE_LINE);
2222}
2323
r2956r2957
6969   switch (starshp1_analog_in_select)
7070   {
7171   case 0:
72      val = input_port_read_indexed(machine, 4);
72      val = input_port_read(machine, "STICKY");
7373      break;
7474   case 1:
75      val = input_port_read_indexed(machine, 5);
75      val = input_port_read(machine, "STICKX");
7676      break;
7777   case 2:
7878      val = 0x20; /* DAC feedback, not used */
7979      break;
8080   case 3:
81      val = input_port_read_indexed(machine, 3);
81      val = input_port_read(machine, "PLAYTIME");
8282      break;
8383   }
8484
85   return (val & 0x3f) | input_port_read_indexed(machine, 1);
85   return (val & 0x3f) | input_port_read(machine, "VBLANK");
8686}
8787
8888
8989static READ8_HANDLER( starshp1_port_2_r )
9090{
91   return input_port_read_indexed(machine, 2) | (starshp1_collision_latch & 0x0f);
91   return input_port_read(machine, "COINAGE") | (starshp1_collision_latch & 0x0f);
9292}
9393
9494
r2956r2957
190190
191191
192192static INPUT_PORTS_START( starshp1 )
193   PORT_START
193   PORT_START_TAG("SYSTEM")
194194   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
195195   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* SWA1? */
196196   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 )
197197   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
198198   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 )
199199   PORT_DIPNAME( 0x20, 0x20, "Extended Play" )
200   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
201   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
200   PORT_DIPSETTING(   0x00, DEF_STR( No ) )
201   PORT_DIPSETTING(   0x20, DEF_STR( Yes ) )
202202   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_TOGGLE
203203   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
204204
205   PORT_START
205   PORT_START_TAG("VBLANK")
206206   PORT_BIT( 0x3f, IP_ACTIVE_HIGH, IPT_UNUSED ) /* analog in */
207207   PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
208208   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
209209
210   PORT_START
210   PORT_START_TAG("COINAGE")
211211   PORT_BIT( 0x0f, IP_ACTIVE_HIGH, IPT_UNUSED ) /* collision latch */
212212   PORT_DIPNAME( 0x70, 0x20, DEF_STR( Coinage ))
213   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ))
214   PORT_DIPSETTING(    0x20, DEF_STR( 1C_1C ))
215   PORT_DIPSETTING(    0x40, DEF_STR( 1C_2C ))
213   PORT_DIPSETTING(   0x10, DEF_STR( 2C_1C ))
214   PORT_DIPSETTING(   0x20, DEF_STR( 1C_1C ))
215   PORT_DIPSETTING(   0x40, DEF_STR( 1C_2C ))
216216   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_UNUSED ) /* ground */
217217
218   PORT_START
218   PORT_START_TAG("PLAYTIME")
219219   PORT_DIPNAME( 0x3f, 0x20, "Play Time" ) /* potentiometer */
220   PORT_DIPSETTING(    0x00, "60 Seconds" )
221   PORT_DIPSETTING(    0x20, "90 Seconds" )
222   PORT_DIPSETTING(    0x3f, "120 Seconds" )
220   PORT_DIPSETTING(   0x00, "60 Seconds" )
221   PORT_DIPSETTING(   0x20, "90 Seconds" )
222   PORT_DIPSETTING(   0x3f, "120 Seconds" )
223223
224   PORT_START
224   PORT_START_TAG("STICKY")
225225   PORT_BIT( 0x3f, 0x20, IPT_AD_STICK_Y ) PORT_MINMAX(0,63) PORT_SENSITIVITY(10) PORT_KEYDELTA(10) PORT_REVERSE
226226
227   PORT_START
227   PORT_START_TAG("STICKX")
228228   PORT_BIT( 0x3f, 0x20, IPT_AD_STICK_X ) PORT_MINMAX(0,63) PORT_SENSITIVITY(10) PORT_KEYDELTA(10) PORT_REVERSE
229229INPUT_PORTS_END
230230
src/mame/drivers/taito_f2.c
r2956r2957
289289***************************************************************************/
290290
291291#include "driver.h"
292#include "taitoipt.h"
292293#include "cpu/m68000/m68000.h"
293294#include "video/taitoic.h"
294295#include "audio/taitosnd.h"
r2956r2957
359360    switch (offset)
360361    {
361362         case 0x00:
362              return input_port_read_indexed(machine,3); /* DSW A */
363              return input_port_read(machine, "DSWA");
363364
364365         case 0x01:
365              return input_port_read_indexed(machine,4); /* DSW B */
366              return input_port_read(machine, "DSWB");
366367    }
367368
368logerror("CPU #0 PC %06x: warning - read unmapped dsw_r offset %06x\n",activecpu_get_pc(),offset);
369   logerror("CPU #0 PC %06x: warning - read unmapped dsw_r offset %06x\n", activecpu_get_pc(), offset);
369370
370371   return 0xff;
371372}
r2956r2957
375376    switch (offset)
376377    {
377378         case 0x00:
378              return input_port_read_indexed(machine,0); /* IN0 */
379              return input_port_read(machine, "IN0");
379380
380381         case 0x01:
381              return input_port_read_indexed(machine,1); /* IN1 */
382              return input_port_read(machine, "IN1");
382383
383384         case 0x02:
384              return input_port_read_indexed(machine,2); /* IN2 */
385              return input_port_read(machine, "IN2");
385386
386387    }
387388
388logerror("CPU #0 PC %06x: warning - read unmapped input_r offset %06x\n",activecpu_get_pc(),offset);
389   logerror("CPU #0 PC %06x: warning - read unmapped input_r offset %06x\n", activecpu_get_pc(), offset);
389390
390391   return 0xff;
391392}
r2956r2957
395396   switch (offset)
396397   {
397398      case 0x00:
398         return input_port_read_indexed(machine,3); /* DSW A */
399         return input_port_read(machine, "DSWA");
399400
400401      case 0x01:
401         return input_port_read_indexed(machine,4); /* DSW B */
402         return input_port_read(machine, "DSWB");
402403
403404      case 0x02:
404         return input_port_read_indexed(machine,2); /* IN2 */
405         return input_port_read(machine, "IN2");
405406
406407//      case 0x03:
407408//          return (coin_word & mem_mask);
408409
409410      case 0x05:
410         return input_port_read_indexed(machine,0); /* IN0 */
411         return input_port_read(machine, "IN0");
411412
412413      case 0x06:
413         return input_port_read_indexed(machine,1); /* IN1 */
414         return input_port_read(machine, "IN1");
414415
415416      case 0x07:
416         return input_port_read_indexed(machine,5); /* IN3 */
417         return input_port_read(machine, "IN3");
417418
418419      case 0x08:
419         return input_port_read_indexed(machine,6); /* IN4 */
420         return input_port_read(machine, "IN4");
420421    }
421422
422logerror("CPU #0 PC %06x: warning - read unmapped input offset %06x\n",activecpu_get_pc(),offset);
423   logerror("CPU #0 PC %06x: warning - read unmapped input offset %06x\n", activecpu_get_pc(), offset);
423424
424425   return 0xff;
425426}
r2956r2957
429430   switch (offset)
430431   {
431432      case 0x00:
432         return (input_port_read_indexed(machine,3) << 8); /* DSW A */
433         return (input_port_read(machine, "DSWA") << 8);
433434
434435      case 0x01:
435         return (input_port_read_indexed(machine,4) << 8); /* DSW B */
436         return (input_port_read(machine, "DSWB") << 8);
436437
437438      case 0x02:
438         return (input_port_read_indexed(machine,0) << 8); /* IN 0 */
439         return (input_port_read(machine, "IN0") << 8);
439440
440441      case 0x03:
441         return (input_port_read_indexed(machine,1) << 8); /* IN 1 */
442         return (input_port_read(machine, "IN1") << 8);
442443
443444      case 0x04:
444         return (input_port_read_indexed(machine,5) << 8); /* IN 3 */
445         return (input_port_read(machine, "IN3") << 8);
445446
446447      case 0x05:
447         return (input_port_read_indexed(machine,6) << 8); /* IN 4 */
448         return (input_port_read(machine, "IN4") << 8);
448449
449450      case 0x06:
450         return (input_port_read_indexed(machine,2) << 8); /* IN 2 */
451         return (input_port_read(machine, "IN2") << 8);
451452
452453//      case 0x07:
453454//          return (coin_word & mem_mask);
454455   }
455456
456logerror("CPU #0 PC %06x: warning - read unmapped input offset %06x\n",activecpu_get_pc(),offset);
457   logerror("CPU #0 PC %06x: warning - read unmapped input offset %06x\n", activecpu_get_pc(), offset);
457458
458459   return 0xff;
459460}
r2956r2957
466467   switch (offset)
467468   {
468469      case 0x00:
469         curr = input_port_read_indexed(machine,5); /* Paddle A */
470         curr = input_port_read(machine, "PADDLE1");
470471         res = curr - last[0];
471472         last[0] = curr;
472473         return res;
473474
474475      case 0x02:
475         curr = input_port_read_indexed(machine,6); /* Paddle B */
476         curr = input_port_read(machine, "PADDLE2");
476477         res = curr - last[1];
477478         last[1] = curr;
478479         return res;
479480   }
480481
481logerror("CPU #0 PC %06x: warning - read unmapped paddle offset %06x\n",activecpu_get_pc(),offset);
482   logerror("CPU #0 PC %06x: warning - read unmapped paddle offset %06x\n", activecpu_get_pc(), offset);
482483
483484   return 0;
484485}
r2956r2957
488489    switch (offset)
489490    {
490491         case 0x00:
491              return input_port_read_indexed(machine,5); /* Paddle A */
492              return input_port_read(machine, "PADDLE1");
492493
493494         case 0x01:
494              return input_port_read_indexed(machine,6); /* Paddle B */
495              return input_port_read(machine, "PADDLE2");
495496    }
496497
497logerror("CPU #0 PC %06x: warning - read unmapped paddle offset %06x\n",activecpu_get_pc(),offset);
498   logerror("CPU #0 PC %06x: warning - read unmapped paddle offset %06x\n", activecpu_get_pc(), offset);
498499
499500        return 0xff;
500501}
r2956r2957
504505   switch (offset)
505506   {
506507      case 0x00:
507         return input_port_read_indexed(machine,3); /* DSW A */
508         return input_port_read(machine, "DSWA");
508509
509510      case 0x01:
510         return input_port_read_indexed(machine,4); /* DSW B */
511         return input_port_read(machine, "DSWB");
511512
512513      case 0x02:
513         return input_port_read_indexed(machine,2); /* IN2 */
514         return input_port_read(machine, "IN2");
514515
515516//      case 0x03:
516517//          return (coin_word & mem_mask);
517518
518519      case 0x05:
519         return input_port_read_indexed(machine,0); /* IN0 */
520         return input_port_read(machine, "IN0");
520521
521522      case 0x06:
522         return input_port_read_indexed(machine,1); /* IN1 */
523         return input_port_read(machine, "IN1");
523524    }
524525
525logerror("CPU #0 PC %06x: warning - read unmapped input offset %06x\n",activecpu_get_pc(),offset);
526   logerror("CPU #0 PC %06x: warning - read unmapped input offset %06x\n", activecpu_get_pc(), offset);
526527
527528   return 0xff;
528529}
r2956r2957
533534    {
534535        case 0x00:
535536        {
536         return (input_port_read_indexed(machine,5) << 8) + input_port_read_indexed(machine,7); /* DSW A + coin */
537         return (input_port_read(machine, "IN5") << 8) + input_port_read(machine, "DSWA");   /* DSW A + coin */
537538        }
538539
539540        case 0x01:
540541        {
541         return (input_port_read_indexed(machine,6) << 8) + input_port_read_indexed(machine,8); /* DSW B + coin */
542         return (input_port_read(machine, "IN6") << 8) + input_port_read(machine, "DSWB");   /* DSW B + coin */
542543        }
543544    }
544545
545    logerror("CPU #0 PC %06x: warning - read unmapped dsw_r offset %06x\n",activecpu_get_pc(),offset);
546    logerror("CPU #0 PC %06x: warning - read unmapped dsw_r offset %06x\n", activecpu_get_pc(), offset);
546547
547548    return 0xff;
548549}
r2956r2957
552553    switch (mjnquest_input)
553554    {
554555         case 0x01:
555              return input_port_read_indexed(machine,0); /* IN0 */
556              return input_port_read(machine, "IN0");
556557
557558         case 0x02:
558              return input_port_read_indexed(machine,1); /* IN1 */
559              return input_port_read(machine, "IN1");
559560
560561         case 0x04:
561              return input_port_read_indexed(machine,2); /* IN2 */
562              return input_port_read(machine, "IN2");
562563
563564         case 0x08:
564              return input_port_read_indexed(machine,3); /* IN3 */
565              return input_port_read(machine, "IN3");
565566
566567         case 0x10:
567              return input_port_read_indexed(machine,4); /* IN4 */
568              return input_port_read(machine, "IN4");
568569
569570    }
570571
571logerror("CPU #0 mjnquest_input %06x: warning - read unknown input %06x\n",activecpu_get_pc(),mjnquest_input);
572   logerror("CPU #0 mjnquest_input %06x: warning - read unknown input %06x\n", activecpu_get_pc(), mjnquest_input);
572573
573574   return 0xff;
574575}
r2956r2957
583584    switch (offset)
584585    {
585586         case 0x00:
586              return input_port_read_indexed(machine,4); /* DSW B */
587              return input_port_read(machine, "DSWB");
587588
588589         case 0x01:
589              return input_port_read_indexed(machine,0); /* IN0 */
590              return input_port_read(machine, "IN0");
590591    }
591592
592logerror("CPU #0 PC %06x: warning - read unmapped input_r offset %06x\n",activecpu_get_pc(),offset);
593   logerror("CPU #0 PC %06x: warning - read unmapped input_r offset %06x\n", activecpu_get_pc(), offset);
593594
594595   return 0xff;
595596}
r2956r2957
599600    switch (offset)
600601    {
601602         case 0x00:
602              return input_port_read_indexed(machine,3); /* DSW A */
603              return input_port_read(machine, "DSWA");
603604
604605         case 0x01:
605              return input_port_read_indexed(machine,1); /* IN1 */
606              return input_port_read(machine, "IN1");
606607
607608         case 0x02:
608              return input_port_read_indexed(machine,2); /* IN2 */
609              return input_port_read(machine, "IN2");
609610    }
610611
611logerror("CPU #0 PC %06x: warning - read unmapped input_r offset %06x\n",activecpu_get_pc(),offset);
612   logerror("CPU #0 PC %06x: warning - read unmapped input_r offset %06x\n", activecpu_get_pc(), offset);
612613
613614   return 0xff;
614615}
r2956r2957
618619    switch (offset)
619620    {
620621         case 0x00:
621              return input_port_read_indexed(machine,0);   /* IN0 */
622              return input_port_read(machine, "IN0");
622623
623624/* case 0x01 only used if "printer" DSW is on, and appears to
624625   be printer status byte */
625626
626627         case 0x02:
627              return input_port_read_indexed(machine,1); /* IN1 */
628              return input_port_read(machine, "IN1");
628629    }
629630
630logerror("CPU #0 PC %06x: warning - read unmapped input_r offset %06x\n",activecpu_get_pc(),offset);
631   logerror("CPU #0 PC %06x: warning - read unmapped input_r offset %06x\n", activecpu_get_pc(), offset);
631632
632633   return 0x0;
633634}
r2956r2957
635636static READ16_HANDLER( yesnoj_dsw_r )
636637{
637638#ifdef MAME_DEBUG
638   logerror("CPU #0 PC = %06x: read yesnoj DSW %01x\n",activecpu_get_pc(),yesnoj_dsw);
639   logerror("CPU #0 PC = %06x: read yesnoj DSW %01x\n", activecpu_get_pc(), yesnoj_dsw);
639640#endif
640641
641642   yesnoj_dsw = 1 - yesnoj_dsw;   /* game reads same word twice to get DSW A then B so we toggle */
642643
643644   if (yesnoj_dsw)
644645   {
645      return input_port_read_indexed(machine,2);
646      return input_port_read(machine, "DSWA");
646647   }
647648   else
648649   {
649      return input_port_read_indexed(machine,3);
650      return input_port_read(machine, "DSWB");
650651   }
651652}
652653
r2956r2957
11661167   AM_RANGE(0x300000, 0x30000f) AM_READ(growl_dsw_r)
11671168   AM_RANGE(0x320000, 0x32000f) AM_READ(growl_input_r)
11681169   AM_RANGE(0x400000, 0x400003) AM_READ(taitof2_msb_sound_r)
1169   AM_RANGE(0x508000, 0x50800f) AM_READ(input_port_5_word_r)   /* IN3 */
1170   AM_RANGE(0x50c000, 0x50c00f) AM_READ(input_port_6_word_r)   /* IN4 */
1170   AM_RANGE(0x508000, 0x50800f) AM_READ_PORT("IN3")
1171   AM_RANGE(0x50c000, 0x50c00f) AM_READ_PORT("IN4")
11711172   AM_RANGE(0x800000, 0x80ffff) AM_READ(TC0100SCN_word_0_r)   /* tilemaps */
11721173   AM_RANGE(0x820000, 0x82000f) AM_READ(TC0100SCN_ctrl_word_0_r)
11731174   AM_RANGE(0x900000, 0x90ffff) AM_READ(SMH_RAM)
r2956r2957
17411742                     INPUT PORTS, DIPs
17421743***********************************************************/
17431744
1744#define TAITO_COINAGE_WORLD_8 \
1745   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
1746   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
1747   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) \
1748   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) ) \
1749   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
1750   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
1751   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) ) \
1752   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) ) \
1753   PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) ) \
1754   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
1755
1756#define TAITO_COINAGE_JAPAN_8 \
1757   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
1758   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) ) \
1759   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
1760   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) ) \
1761   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) ) \
1762   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
1763   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
1764   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) ) \
1765   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) ) \
1766   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
1767
1768/* This is a new Japanese coinage used in later TAITO games */
1769#define TAITO_COINAGE_JAPAN_NEW_8 \
1770   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
1771   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) ) \
1772   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) ) \
1773   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
1774   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) ) \
1775   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
1776   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) ) \
1777   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
1778   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) ) \
1779   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
1780
1781#define TAITO_COINAGE_US_8 \
1782   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coinage ) ) \
1783   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
1784   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) \
1785   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) ) \
1786   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
1787   PORT_DIPNAME( 0xc0, 0xc0, "Price to Continue" ) \
1788   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) ) \
1789   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
1790   PORT_DIPSETTING(    0x80, DEF_STR( 1C_1C ) ) \
1791   PORT_DIPSETTING(    0xc0, "Same as Start" )
1792
1793#define TAITO_DIFFICULTY_8 \
1794   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) \
1795   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) ) \
1796   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) ) \
1797   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) ) \
1798   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
1799
1800#define TAITO_F2_PLAYERS_INPUT( player ) \
1801   PORT_START \
1802   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(player) PORT_8WAY \
1803   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(player) PORT_8WAY \
1804   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(player) PORT_8WAY \
1805   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(player) PORT_8WAY \
1806   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(player) \
1807   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(player)
1808/* 0x40 and 0x80 are not always the same in all games, so they are not included here */
1809
18101745#define TAITO_F2_SYSTEM_INPUT \
1811   PORT_START \
18121746   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT ) \
18131747   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 ) \
18141748   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 ) \
r2956r2957
18291763   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
18301764   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
18311765   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1832   TAITO_COINAGE_WORLD_8
1766   TAITO_COINAGE_WORLD
18331767
18341768   PORT_START_TAG("DSWB")
1835   TAITO_DIFFICULTY_8
1769   TAITO_DIFFICULTY
18361770   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
18371771   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
18381772   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
18521786   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
18531787   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
18541788
1855   /* IN0 */
1856   TAITO_F2_PLAYERS_INPUT( 1 )
1857   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
1858   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
1789   PORT_START_TAG("IN0")
1790   TAITO_JOY_UDLR_3_BUTTONS_START( 1 )
18591791
1860   /* IN1 */
1861   TAITO_F2_PLAYERS_INPUT( 2 )
1862   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
1863   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
1792   PORT_START_TAG("IN1")
1793   TAITO_JOY_UDLR_3_BUTTONS_START( 2 )
18641794
1865   /* IN2 */
1795   PORT_START_TAG("IN2")
18661796   TAITO_F2_SYSTEM_INPUT   /* controls below are DIP selectable */
18671797   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)   /* 1P sen.sw.? */
18681798   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)   /* 1P ducking? */
r2956r2957
18741804   PORT_INCLUDE(finalb)
18751805
18761806   PORT_MODIFY("DSWA")
1877   TAITO_COINAGE_JAPAN_8
1807   TAITO_COINAGE_JAPAN_OLD
18781808INPUT_PORTS_END
18791809
18801810
r2956r2957
18901820   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
18911821   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
18921822   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1893   TAITO_COINAGE_WORLD_8
1823   TAITO_COINAGE_WORLD
18941824
18951825   PORT_START_TAG("DSWB")
1896   TAITO_DIFFICULTY_8
1826   TAITO_DIFFICULTY
18971827   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
18981828   PORT_DIPSETTING(    0x0c, "10k and 100k" )
18991829   PORT_DIPSETTING(    0x08, "10k and 150k" )
r2956r2957
19111841   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
19121842   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
19131843
1914   /* IN0 */
1915   TAITO_F2_PLAYERS_INPUT( 1 )
1916   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1917   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
1844   PORT_START_TAG("IN0")
1845   TAITO_JOY_UDLR_2_BUTTONS_START( 1 )
19181846
1919   /* IN1 */
1920   TAITO_F2_PLAYERS_INPUT( 2 )
1921   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1922   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
1847   PORT_START_TAG("IN1")
1848   TAITO_JOY_UDLR_2_BUTTONS_START( 2 )
19231849
1924   /* IN2 */
1850   PORT_START_TAG("IN2")
19251851   TAITO_F2_SYSTEM_INPUT
19261852   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
19271853   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
19331859   PORT_INCLUDE(dondokod)
19341860
19351861   PORT_MODIFY("DSWA")
1936   TAITO_COINAGE_US_8
1862   TAITO_COINAGE_US
19371863INPUT_PORTS_END
19381864
19391865static INPUT_PORTS_START( dondokdj )
19401866   PORT_INCLUDE(dondokod)
19411867
19421868   PORT_MODIFY("DSWA")
1943   TAITO_COINAGE_JAPAN_8
1869   TAITO_COINAGE_JAPAN_OLD
19441870INPUT_PORTS_END
19451871
19461872
r2956r2957
19561882   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
19571883   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
19581884   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1959   TAITO_COINAGE_WORLD_8
1885   TAITO_COINAGE_WORLD
19601886
19611887   PORT_START_TAG("DSWB")
1962   TAITO_DIFFICULTY_8
1888   TAITO_DIFFICULTY
19631889   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
19641890   PORT_DIPSETTING(    0x0c, "100k only" )
19651891   PORT_DIPSETTING(    0x04, "150k only" )
r2956r2957
19771903   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
19781904   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
19791905
1980   /* IN0 */
1981   TAITO_F2_PLAYERS_INPUT( 1 )
1982   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1983   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1906   PORT_START_TAG("IN0")
1907   TAITO_JOY_UDLR_2_BUTTONS( 1 )
19841908
1985   /* IN1 */
1986   TAITO_F2_PLAYERS_INPUT( 2 )
1987   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1988   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1909   PORT_START_TAG("IN1")
1910   TAITO_JOY_UDLR_2_BUTTONS( 2 )
19891911
1990   /* IN2 */
1912   PORT_START_TAG("IN2")
19911913   TAITO_F2_SYSTEM_INPUT
19921914   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START1 )
19931915   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
r2956r2957
19991921   PORT_INCLUDE(megab)
20001922
20011923   PORT_MODIFY("DSWA")
2002   TAITO_COINAGE_JAPAN_8
1924   TAITO_COINAGE_JAPAN_OLD
20031925INPUT_PORTS_END
20041926
20051927
r2956r2957
20151937   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
20161938   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
20171939   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2018   TAITO_COINAGE_WORLD_8
1940   TAITO_COINAGE_WORLD
20191941
20201942   PORT_START_TAG("DSWB")
2021   TAITO_DIFFICULTY_8
1943   TAITO_DIFFICULTY
20221944   PORT_DIPNAME( 0x04, 0x04, "Timer" )
20231945   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
20241946   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
r2956r2957
20371959   PORT_DIPSETTING(    0x00, DEF_STR( Single ) )
20381960   PORT_DIPSETTING(    0x80, DEF_STR( Dual ) )
20391961
2040   /* IN0 */
2041   TAITO_F2_PLAYERS_INPUT( 1 )
2042   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
2043   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
1962   PORT_START_TAG("IN0")
1963   TAITO_JOY_UDLR_3_BUTTONS_START( 1 )
20441964
2045   /* IN0 */
2046   TAITO_F2_PLAYERS_INPUT( 2 )
2047   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2048   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
1965   PORT_START_TAG("IN1")
1966   TAITO_JOY_UDLR_3_BUTTONS_START( 2 )
20491967
2050   /* IN2 */
1968   PORT_START_TAG("IN2")
20511969   TAITO_F2_SYSTEM_INPUT
20521970   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
20531971   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
20591977   PORT_INCLUDE(thundfox)
20601978
20611979   PORT_MODIFY("DSWA")
2062   TAITO_COINAGE_US_8
1980   TAITO_COINAGE_US
20631981INPUT_PORTS_END
20641982
20651983static INPUT_PORTS_START( thndfoxj )
20661984   PORT_INCLUDE(thundfox)
20671985
20681986   PORT_MODIFY("DSWA")
2069   TAITO_COINAGE_JAPAN_NEW_8
1987   TAITO_COINAGE_JAPAN_NEW
20701988INPUT_PORTS_END
20711989
20721990
r2956r2957
20822000   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
20832001   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
20842002   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2085   TAITO_COINAGE_US_8
2003   TAITO_COINAGE_US
20862004
20872005   PORT_START_TAG("DSWB")
2088   TAITO_DIFFICULTY_8
2006   TAITO_DIFFICULTY
20892007   PORT_DIPNAME( 0x0c, 0x0c, "Start remain time" )
20902008   PORT_DIPSETTING(    0x00, "35" )
20912009   PORT_DIPSETTING(    0x04, "40" )
r2956r2957
21032021   PORT_DIPSETTING(    0x80, DEF_STR( Single ) )
21042022   PORT_DIPSETTING(    0x00, DEF_STR( Dual ) )
21052023
2106   PORT_START      /* IN0 */
2024   PORT_START_TAG("IN0")
21072025   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
21082026   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
21092027   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
21132031   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
21142032   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
21152033
2116   PORT_START      /* IN1 */
2034   PORT_START_TAG("IN1")
21172035   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
21182036   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
21192037   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
21232041   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
21242042   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
21252043
2126   /* IN2 */
2044   PORT_START_TAG("IN2")
21272045   TAITO_F2_SYSTEM_INPUT
21282046   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
21292047   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
21302048   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
21312049   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
21322050
2133   PORT_START  /* Paddle A */
2051   PORT_START_TAG("PADDLE1")   /* Paddle A */
21342052   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_PLAYER(1)
21352053
2136   PORT_START  /* Paddle B */
2054   PORT_START_TAG("PADDLE2")   /* Paddle B */
21372055   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_PLAYER(2)
21382056INPUT_PORTS_END
21392057
r2956r2957
21412059   PORT_INCLUDE(cameltry)
21422060
21432061   PORT_MODIFY("DSWA")
2144   TAITO_COINAGE_JAPAN_8
2062   TAITO_COINAGE_JAPAN_OLD
21452063INPUT_PORTS_END
21462064
21472065static INPUT_PORTS_START( qtorimon )
r2956r2957
21562074   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) )
21572075   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
21582076   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2159   TAITO_COINAGE_JAPAN_8
2077   TAITO_COINAGE_JAPAN_OLD
21602078
21612079   PORT_START_TAG("DSWB")
2162   TAITO_DIFFICULTY_8
2080   TAITO_DIFFICULTY
21632081   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
21642082   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
21652083   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
21782096   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
21792097   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
21802098
2181   PORT_START      /* IN0 */
2099   PORT_START_TAG("IN0")
21822100   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
21832101   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
21842102   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
r2956r2957
21882106   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
21892107   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
21902108
2191   PORT_START      /* IN1 */
2109   PORT_START_TAG("IN1")
21922110   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
21932111   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
21942112   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
r2956r2957
21982116   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
21992117   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
22002118
2201   /* IN2 */
2119   PORT_START_TAG("IN2")
22022120   TAITO_F2_SYSTEM_INPUT
22032121   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
22042122   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
22182136   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
22192137   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
22202138   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2221   TAITO_COINAGE_WORLD_8
2139   TAITO_COINAGE_WORLD
22222140
22232141   PORT_START_TAG("DSWB")
2224   TAITO_DIFFICULTY_8
2142   TAITO_DIFFICULTY
22252143   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
22262144   PORT_DIPSETTING(    0x0c, "30k and 100k" )
22272145   PORT_DIPSETTING(    0x08, "30k and 150k" )
r2956r2957
22392157   PORT_DIPSETTING(    0x80, DEF_STR( Single ) )
22402158   PORT_DIPSETTING(    0x00, DEF_STR( Dual ) )
22412159
2242   /* IN0 */
2243   TAITO_F2_PLAYERS_INPUT( 1 )
2244   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2245   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
2160   PORT_START_TAG("IN0")
2161   TAITO_JOY_UDLR_2_BUTTONS_START( 1 )
22462162
2247   /* IN1 */
2248   TAITO_F2_PLAYERS_INPUT( 2 )
2249   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2250   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
2163   PORT_START_TAG("IN1")
2164   TAITO_JOY_UDLR_2_BUTTONS_START( 2 )
22512165
2252   /* IN2 */
2166   PORT_START_TAG("IN2")
22532167   TAITO_F2_SYSTEM_INPUT
22542168   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
22552169   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
22612175   PORT_INCLUDE(liquidk)
22622176
22632177   PORT_MODIFY("DSWA")
2264   TAITO_COINAGE_US_8
2178   TAITO_COINAGE_US
22652179INPUT_PORTS_END
22662180
22672181
r2956r2957
22772191   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
22782192   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
22792193   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2280   TAITO_COINAGE_JAPAN_NEW_8
2194   TAITO_COINAGE_JAPAN_NEW
22812195
22822196   PORT_START_TAG("DSWB")
2283   TAITO_DIFFICULTY_8
2197   TAITO_DIFFICULTY
22842198   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
22852199   PORT_DIPSETTING(    0x0c, "30k and 100k" )
22862200   PORT_DIPSETTING(    0x08, "30k and 150k" )
r2956r2957
22982212   PORT_DIPSETTING(    0x80, DEF_STR( Single ) )
22992213   PORT_DIPSETTING(    0x00, DEF_STR( Dual ) )
23002214
2301   /* IN0 */
2302   TAITO_F2_PLAYERS_INPUT( 1 )
2303   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2304   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
2215   PORT_START_TAG("IN0")
2216   TAITO_JOY_UDLR_2_BUTTONS_START( 1 )
23052217
2306   /* IN1 */
2307   TAITO_F2_PLAYERS_INPUT( 2 )
2308   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2309   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
2218   PORT_START_TAG("IN1")
2219   TAITO_JOY_UDLR_2_BUTTONS_START( 2 )
23102220
2311   /* IN2 */
2221   PORT_START_TAG("IN2")
23122222   TAITO_F2_SYSTEM_INPUT
23132223   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
23142224   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
23282238   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
23292239   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
23302240   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2331   TAITO_COINAGE_WORLD_8
2241   TAITO_COINAGE_WORLD
23322242
23332243   PORT_START_TAG("DSWB")
2334   TAITO_DIFFICULTY_8
2244   TAITO_DIFFICULTY
23352245   PORT_DIPNAME( 0x0c, 0x0c, "Shields" )
23362246   PORT_DIPSETTING(    0x00, DEF_STR( None ))
23372247   PORT_DIPSETTING(    0x0c, "1")
r2956r2957
23492259   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
23502260   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
23512261
2352   /* IN0 */
2353   TAITO_F2_PLAYERS_INPUT( 1 )
2354   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2355   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
2262   PORT_START_TAG("IN0")
2263   TAITO_JOY_UDLR_2_BUTTONS_START( 1 )
23562264
2357   /* IN1 */
2358   TAITO_F2_PLAYERS_INPUT( 2 )
2359   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2360   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
2265   PORT_START_TAG("IN1")
2266   TAITO_JOY_UDLR_2_BUTTONS_START( 2 )
23612267
2362   /* IN2 */
2268   PORT_START_TAG("IN2")
23632269   TAITO_F2_SYSTEM_INPUT
23642270   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
23652271   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
23712277   PORT_INCLUDE(ssi)
23722278
23732279   PORT_MODIFY("DSWA")
2374   TAITO_COINAGE_JAPAN_NEW_8
2280   TAITO_COINAGE_JAPAN_NEW
23752281INPUT_PORTS_END
23762282
23772283
23782284static INPUT_PORTS_START( growl )
2379   /* IN0 */
2380   TAITO_F2_PLAYERS_INPUT( 1 )
2381   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
2382   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
2285   PORT_START_TAG("IN0")
2286   TAITO_JOY_UDLR_3_BUTTONS_START( 1 )
23832287
2384   /* IN1 */
2385   TAITO_F2_PLAYERS_INPUT( 2 )
2386   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2387   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
2288   PORT_START_TAG("IN1")
2289   TAITO_JOY_UDLR_3_BUTTONS_START( 2 )
23882290
2389   /* IN2 */
2291   PORT_START_TAG("IN2")
23902292   TAITO_F2_SYSTEM_INPUT
23912293   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
23922294   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
24042306   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
24052307   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
24062308   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2407   TAITO_COINAGE_WORLD_8
2309   TAITO_COINAGE_WORLD
24082310
24092311   PORT_START_TAG("DSWB")
2410   TAITO_DIFFICULTY_8
2312   TAITO_DIFFICULTY
24112313   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
24122314   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
24132315   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
24262328   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
24272329   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
24282330
2429   PORT_START      /* IN3 */
2331   PORT_START_TAG("IN3")
24302332   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
24312333   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
24322334   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
r2956r2957
24442346   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4)
24452347   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START4 )
24462348
2447   PORT_START      /* IN4 */
2349   PORT_START_TAG("IN4")
24482350   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
24492351   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN4 )
24502352   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE2 )
r2956r2957
24592361   PORT_INCLUDE(growl)
24602362
24612363   PORT_MODIFY("DSWA")
2462   TAITO_COINAGE_US_8
2364   TAITO_COINAGE_US
24632365INPUT_PORTS_END
24642366
24652367static INPUT_PORTS_START( runark )
24662368   PORT_INCLUDE(growl)
24672369
24682370   PORT_MODIFY("DSWA")
2469   TAITO_COINAGE_JAPAN_NEW_8
2371   TAITO_COINAGE_JAPAN_NEW
24702372INPUT_PORTS_END
24712373
24722374
r2956r2957
24822384   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
24832385   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
24842386   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2485   TAITO_COINAGE_WORLD_8
2387   TAITO_COINAGE_WORLD
24862388
24872389   PORT_START_TAG("DSWB")
2488   TAITO_DIFFICULTY_8
2390   TAITO_DIFFICULTY
24892391   PORT_DIPNAME( 0x0c, 0x0c, "Magic" )
24902392   PORT_DIPSETTING(    0x0c, "3" )
24912393   PORT_DIPSETTING(    0x08, "4" )
r2956r2957
25032405   PORT_DIPSETTING(    0x00, DEF_STR( Single ) )
25042406   PORT_DIPSETTING(    0x80, DEF_STR( Dual ) )
25052407
2506   /* IN0 */
2507   TAITO_F2_PLAYERS_INPUT( 1 )
2508   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
2509   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
2408   PORT_START_TAG("IN0")
2409   TAITO_JOY_UDLR_3_BUTTONS_START( 1 )
25102410
2511   /* IN1 */
2512   TAITO_F2_PLAYERS_INPUT( 2 )
2513   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2514   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
2411   PORT_START_TAG("IN1")
2412   TAITO_JOY_UDLR_3_BUTTONS_START( 2 )
25152413
2516   /* IN2 */
2414   PORT_START_TAG("IN2")
25172415   TAITO_F2_SYSTEM_INPUT
25182416   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
25192417   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
25252423   PORT_INCLUDE(pulirula)
25262424
25272425   PORT_MODIFY("DSWA")
2528   TAITO_COINAGE_JAPAN_NEW_8
2426   TAITO_COINAGE_JAPAN_NEW
25292427INPUT_PORTS_END
25302428
25312429
r2956r2957
25412439   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
25422440   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
25432441   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2544   TAITO_COINAGE_JAPAN_NEW_8
2442   TAITO_COINAGE_JAPAN_NEW
25452443
25462444   PORT_START_TAG("DSWB")
2547   TAITO_DIFFICULTY_8  //??
2445   TAITO_DIFFICULTY  //??
25482446   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
25492447   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
25502448   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
25642462   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
25652463   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
25662464
2567   PORT_START      /* IN0 */
2465   PORT_START_TAG("IN0")
25682466   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
25692467   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
25702468   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
r2956r2957
25742472   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
25752473   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
25762474
2577   PORT_START      /* IN1 */
2475   PORT_START_TAG("IN1")
25782476   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
25792477   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
25802478   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
r2956r2957
25842482   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
25852483   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
25862484
2587   /* IN2 */
2485   PORT_START_TAG("IN2")
25882486   TAITO_F2_SYSTEM_INPUT
25892487   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
25902488   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
26042502   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
26052503   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
26062504   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2607   TAITO_COINAGE_JAPAN_NEW_8
2505   TAITO_COINAGE_JAPAN_NEW
26082506
26092507   PORT_START_TAG("DSWB")
2610   TAITO_DIFFICULTY_8  //??
2508   TAITO_DIFFICULTY  //??
26112509   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
26122510   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
26132511   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
26272525   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
26282526   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
26292527
2630   PORT_START      /* IN0 */
2528   PORT_START_TAG("IN0")
26312529   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
26322530   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
26332531   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
r2956r2957
26372535   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
26382536   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
26392537
2640   PORT_START      /* IN1 */
2538   PORT_START_TAG("IN1")
26412539   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
26422540   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
26432541   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
r2956r2957
26472545   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
26482546   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
26492547
2650   /* IN2 */
2548   PORT_START_TAG("IN2")
26512549   TAITO_F2_SYSTEM_INPUT
26522550   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
26532551   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
26562554INPUT_PORTS_END
26572555
26582556static INPUT_PORTS_START( footchmp )
2659   /* IN0 */
2660   TAITO_F2_PLAYERS_INPUT( 1 )
2661   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2662   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
2557   PORT_START_TAG("IN0")
2558   TAITO_JOY_UDLR_2_BUTTONS_START( 1 )
26632559
2664   /* IN1 */
2665   TAITO_F2_PLAYERS_INPUT( 2 )
2666   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2667   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
2560   PORT_START_TAG("IN1")
2561   TAITO_JOY_UDLR_2_BUTTONS_START( 2 )
26682562
2669   PORT_START      /* IN2 */
2563   PORT_START_TAG("IN2")
26702564   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
26712565   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
26722566   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
r2956r2957
26872581   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
26882582   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
26892583   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2690   TAITO_COINAGE_WORLD_8
2584   TAITO_COINAGE_WORLD
26912585
26922586   PORT_START_TAG("DSWB")
2693   TAITO_DIFFICULTY_8
2587   TAITO_DIFFICULTY
26942588   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Game_Time ) )
26952589   PORT_DIPSETTING(    0x00, "1.5 Minutes" )
26962590   PORT_DIPSETTING(    0x0c, " 2  Minutes" )
r2956r2957
27082602   PORT_DIPSETTING(    0x00, DEF_STR( Normal ) )
27092603   PORT_DIPSETTING(    0x80, "European" )
27102604
2711   /* IN3 */
2712   TAITO_F2_PLAYERS_INPUT( 3 )
2713   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2714   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 )
2605   PORT_START_TAG("IN3")
2606   TAITO_JOY_UDLR_2_BUTTONS_START( 3 )
27152607
2716   /* IN4 */
2717   TAITO_F2_PLAYERS_INPUT( 4 )
2718   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2719   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
2608   PORT_START_TAG("IN4")
2609   TAITO_JOY_UDLR_2_BUTTONS_START( 4 )
27202610INPUT_PORTS_END
27212611
27222612static INPUT_PORTS_START( hthero )
r2956r2957
27692659INPUT_PORTS_END
27702660
27712661static INPUT_PORTS_START( ninjak )
2772   /* IN0 */
2773   TAITO_F2_PLAYERS_INPUT( 1 )
2774   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2775   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
2662   PORT_START_TAG("IN0")
2663   TAITO_JOY_UDLR_2_BUTTONS_START( 1 )
27762664
2777   /* IN1 */
2778   TAITO_F2_PLAYERS_INPUT( 2 )
2779   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2780   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
2665   PORT_START_TAG("IN1")
2666   TAITO_JOY_UDLR_2_BUTTONS_START( 2 )
27812667
2782   PORT_START      /* IN2 */
2668   PORT_START_TAG("IN2")
27832669   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT )
27842670   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 )
27852671   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE2 )
r2956r2957
28002686   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
28012687   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
28022688   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2803   TAITO_COINAGE_WORLD_8
2689   TAITO_COINAGE_WORLD
28042690
28052691   PORT_START_TAG("DSWB")
2806   TAITO_DIFFICULTY_8
2692   TAITO_DIFFICULTY
28072693   PORT_DIPNAME( 0x0c, 0x0c, "Cabinet Type" )
28082694   PORT_DIPSETTING(    0x0c, "2 players" )
28092695   PORT_DIPSETTING(    0x08, "TROG (4 players / 2 coin slots)" )
r2956r2957
28212707   PORT_DIPSETTING(    0x00, "1 Player only" )
28222708   PORT_DIPSETTING(    0x80, "Multiplayer" )
28232709
2824   /* IN3 */
2825   TAITO_F2_PLAYERS_INPUT( 3 )
2826   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2827   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START3 )
2710   PORT_START_TAG("IN3")
2711   TAITO_JOY_UDLR_2_BUTTONS_START( 3 )
28282712
2829   /* IN4 */
2830   TAITO_F2_PLAYERS_INPUT( 4 )
2831   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2832   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START4 )
2713   PORT_START_TAG("IN4")
2714   TAITO_JOY_UDLR_2_BUTTONS_START( 4 )
28332715INPUT_PORTS_END
28342716
28352717static INPUT_PORTS_START( ninjaku )
28362718   PORT_INCLUDE(ninjak)
28372719
28382720   PORT_MODIFY("DSWA")
2839   TAITO_COINAGE_US_8
2721   TAITO_COINAGE_US
28402722INPUT_PORTS_END
28412723
28422724static INPUT_PORTS_START( ninjakj )
28432725   PORT_INCLUDE(ninjak)
28442726
28452727   PORT_MODIFY("DSWA")
2846   TAITO_COINAGE_JAPAN_NEW_8
2728   TAITO_COINAGE_JAPAN_NEW
28472729INPUT_PORTS_END
28482730
28492731
r2956r2957
28592741   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
28602742   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
28612743   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2862   TAITO_COINAGE_JAPAN_8
2744   TAITO_COINAGE_JAPAN_OLD
28632745
28642746   PORT_START_TAG("DSWB")
2865   TAITO_DIFFICULTY_8
2747   TAITO_DIFFICULTY
28662748   PORT_DIPNAME( 0x0c, 0x0c, "Control" )   /* correct acc. to service mode */
28672749   PORT_DIPSETTING(    0x0c, DEF_STR( Joystick ) )
28682750   PORT_DIPSETTING(    0x08, "Paddle" )
r2956r2957
28812763   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
28822764   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
28832765
2884   /* IN0 */
2885   TAITO_F2_PLAYERS_INPUT( 1 )
2886   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2887   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
2766   PORT_START_TAG("IN0")
2767   TAITO_JOY_UDLR_2_BUTTONS_START( 1 )
28882768
2889   PORT_START      /* IN1 */
2769   PORT_START_TAG("IN1")
28902770   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* 2P not used? */
28912771
2892   /* IN2 */
2772   PORT_START_TAG("IN2")
28932773   TAITO_F2_SYSTEM_INPUT
28942774   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
28952775   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
28962776   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
28972777   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
28982778
2899   PORT_START  /* Paddle A */
2779   PORT_START_TAG("PADDLE1")   /* Paddle A */
29002780   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(1)
29012781
2902   PORT_START  /* Paddle B */
2782   PORT_START_TAG("PADDLE2")   /* Paddle B */
29032783   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2)
29042784INPUT_PORTS_END
29052785
r2956r2957
29152795   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
29162796   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
29172797   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2918   TAITO_COINAGE_WORLD_8
2798   TAITO_COINAGE_WORLD
29192799
29202800   PORT_START_TAG("DSWB")
2921   TAITO_DIFFICULTY_8
2801   TAITO_DIFFICULTY
29222802   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
29232803   PORT_DIPSETTING(    0x08, "10k and every 80k" )
29242804   PORT_DIPSETTING(    0x0c, "20k and every 80k" )
r2956r2957
29362816   PORT_DIPSETTING(    0x00, DEF_STR( Single ) )
29372817   PORT_DIPSETTING(    0x80, DEF_STR( Dual ) )
29382818
2939   /* IN0 */
2940   TAITO_F2_PLAYERS_INPUT( 1 )
2941   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2942   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
2819   PORT_START_TAG("IN0")
2820   TAITO_JOY_UDLR_2_BUTTONS_START( 1 )
29432821
2944   /* IN1 */
2945   TAITO_F2_PLAYERS_INPUT( 2 )
2946   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2947   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
2822   PORT_START_TAG("IN1")
2823   TAITO_JOY_UDLR_2_BUTTONS_START( 2 )
29482824
2949   /* IN2 */
2825   PORT_START_TAG("IN2")
29502826   TAITO_F2_SYSTEM_INPUT
29512827   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
29522828   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
29582834   PORT_INCLUDE(gunfront)
29592835
29602836   PORT_MODIFY("DSWA")
2961   TAITO_COINAGE_JAPAN_NEW_8
2837   TAITO_COINAGE_JAPAN_NEW
29622838INPUT_PORTS_END
29632839
29642840
r2956r2957
29742850   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
29752851   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
29762852   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2977   TAITO_COINAGE_WORLD_8
2853   TAITO_COINAGE_WORLD
29782854
29792855   PORT_START_TAG("DSWB")
2980   TAITO_DIFFICULTY_8
2856   TAITO_DIFFICULTY
29812857   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
29822858   PORT_DIPSETTING(    0x04, "80k and every 160k" )
29832859   PORT_DIPSETTING(    0x0c, "70k and every 150k" )
r2956r2957
29952871   PORT_DIPSETTING(    0x00, DEF_STR( Single ) )
29962872   PORT_DIPSETTING(    0x80, DEF_STR( Dual ) )
29972873
2998   /* IN0 */
2999   TAITO_F2_PLAYERS_INPUT( 1 )
3000   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
3001   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
2874   PORT_START_TAG("IN0")
2875   TAITO_JOY_UDLR_3_BUTTONS_START( 1 )
30022876
3003   /* IN1 */
3004   TAITO_F2_PLAYERS_INPUT( 2 )
3005   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
3006   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
2877   PORT_START_TAG("IN1")
2878   TAITO_JOY_UDLR_3_BUTTONS_START( 2 )
30072879
3008   /* IN2 */
2880   PORT_START_TAG("IN2")
30092881   TAITO_F2_SYSTEM_INPUT
30102882   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
30112883   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
30172889   PORT_INCLUDE(metalb)
30182890
30192891   PORT_MODIFY("DSWA")
3020   TAITO_COINAGE_JAPAN_NEW_8
2892   TAITO_COINAGE_JAPAN_NEW
30212893INPUT_PORTS_END
30222894
30232895
30242896static INPUT_PORTS_START( deadconx )
3025   /* IN0 */
3026   TAITO_F2_PLAYERS_INPUT( 1 )
3027   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
3028   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
2897   PORT_START_TAG("IN0")
2898   TAITO_JOY_UDLR_2_BUTTONS_START( 1 )
30292899
3030   /* IN1 */
3031   TAITO_F2_PLAYERS_INPUT( 2 )
3032   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
3033   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
2900   PORT_START_TAG("IN1")
2901   TAITO_JOY_UDLR_2_BUTTONS_START( 2 )
30342902
3035   PORT_START      /* IN2 */
2903   PORT_START_TAG("IN2")
30362904   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
30372905   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
3038   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service A") PORT_CODE(KEYCODE_9)
3039   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service B") PORT_CODE(KEYCODE_0)
3040   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service C") PORT_CODE(KEYCODE_MINUS)
2906   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service A") PORT_CODE(KEYCODE_9)
2907   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service B") PORT_CODE(KEYCODE_0)
2908   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Service C") PORT_CODE(KEYCODE_MINUS)
30412909   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_TILT )
30422910
30432911   PORT_START_TAG("DSWA")
r2956r2957
30512919   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
30522920   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
30532921   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
3054   TAITO_COINAGE_WORLD_8
2922   TAITO_COINAGE_WORLD
30552923
30562924   PORT_START_TAG("DSWB") /* DSW B, missing a timer speed maybe? */
3057   TAITO_DIFFICULTY_8
2925   TAITO_DIFFICULTY
30582926   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
30592927   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
30602928   PORT_DIPSETTING(    0x00, DEF_STR( On) )
r2956r2957
30782946   PORT_INCLUDE(deadconx)
30792947
30802948   PORT_MODIFY("DSWA")
3081   TAITO_COINAGE_JAPAN_NEW_8
2949   TAITO_COINAGE_JAPAN_NEW
30822950INPUT_PORTS_END
30832951
30842952
r2956r2957
30942962   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
30952963   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
30962964   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
3097   TAITO_COINAGE_WORLD_8
2965   TAITO_COINAGE_WORLD
30982966
30992967   PORT_START_TAG("DSWB")
3100   TAITO_DIFFICULTY_8
2968   TAITO_DIFFICULTY
31012969   PORT_DIPNAME( 0x0c, 0x0c, "Damage" )
31022970   PORT_DIPSETTING(    0x08, "Small" )
31032971   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
r2956r2957
31162984   PORT_DIPSETTING(    0x00, DEF_STR( Single ) )
31172985   PORT_DIPSETTING(    0x80, DEF_STR( Dual ) )
31182986
3119   /* IN0 */
3120   TAITO_F2_PLAYERS_INPUT( 1 )
3121   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
3122   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
2987   PORT_START_TAG("IN0")
2988   TAITO_JOY_UDLR_3_BUTTONS_START( 1 )
31232989
3124   /* IN1 */
3125   TAITO_F2_PLAYERS_INPUT( 2 )
3126   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
3127   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
2990   PORT_START_TAG("IN1")
2991   TAITO_JOY_UDLR_3_BUTTONS_START( 2 )
31282992
3129   /* IN2 */
2993   PORT_START_TAG("IN2")
31302994   TAITO_F2_SYSTEM_INPUT
31312995   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
31322996   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
31383002   PORT_INCLUDE(dinorex)
31393003
31403004   PORT_MODIFY("DSWA")
3141   TAITO_COINAGE_JAPAN_NEW_8
3005   TAITO_COINAGE_JAPAN_NEW
31423006INPUT_PORTS_END
31433007
31443008
31453009static INPUT_PORTS_START( solfigtr )
3146   /* IN0 */
3147   TAITO_F2_PLAYERS_INPUT( 1 )
3148   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
3149   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
3010   PORT_START_TAG("IN0")
3011   TAITO_JOY_UDLR_3_BUTTONS_START( 1 )
31503012
3151   /* IN1 */
3152   TAITO_F2_PLAYERS_INPUT( 2 )
3153   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
3154   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
3013   PORT_START_TAG("IN1")
3014   TAITO_JOY_UDLR_3_BUTTONS_START( 2 )
31553015
3156   /* IN2 */
3016   PORT_START_TAG("IN2")
31573017   TAITO_F2_SYSTEM_INPUT
31583018   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
31593019   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
31713031   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
31723032   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
31733033   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
3174   TAITO_COINAGE_WORLD_8
3034   TAITO_COINAGE_WORLD
31753035
31763036   PORT_START_TAG("DSWB")
3177   TAITO_DIFFICULTY_8
3037   TAITO_DIFFICULTY
31783038   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
31793039   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
31803040   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
31963056INPUT_PORTS_END
31973057
31983058static INPUT_PORTS_START( koshien )
3199   PORT_START /* DSW A, one lets you control fielders ? */
3059   PORT_START_TAG("DSWA")   /* DSW A, one lets you control fielders ? */
32003060   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
32013061   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
32023062   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
32073067   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
32083068   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
32093069   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
3210   TAITO_COINAGE_JAPAN_NEW_8
3070   TAITO_COINAGE_JAPAN_NEW
32113071
32123072   PORT_START_TAG("DSWB")
3213   TAITO_DIFFICULTY_8
3073   TAITO_DIFFICULTY
32143074   PORT_DIPNAME( 0x04, 0x04, "Timer" )
32153075   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
32163076   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
r2956r2957
32293089   PORT_DIPSETTING(    0x00, DEF_STR( Single ) )
32303090   PORT_DIPSETTING(    0x80, DEF_STR( Dual ) )
32313091
3232   PORT_START      /* IN1 */
3092   PORT_START_TAG("IN0")
32333093   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
32343094   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
32353095   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
r2956r2957
32393099   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
32403100   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
32413101
3242   /* IN2 */
3102   PORT_START_TAG("IN1")
32433103   TAITO_F2_SYSTEM_INPUT
32443104   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
32453105   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
32463106   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
32473107   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
32483108
3249   PORT_START      /* IN0 */
3109   PORT_START_TAG("IN2")
32503110   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
32513111   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
32523112   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
32583118INPUT_PORTS_END
32593119
32603120static INPUT_PORTS_START( quizhq )
3261   PORT_START      /* IN0 */
3121   PORT_START_TAG("IN0")
32623122   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
32633123   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
32643124   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
r2956r2957
32683128   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
32693129   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
32703130
3271   PORT_START      /* IN1 */
3131   PORT_START_TAG("IN1")
32723132   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
32733133   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
32743134   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
r2956r2957
32783138   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
32793139   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
32803140
3281   /* IN2 */
3141   PORT_START_TAG("IN2")
32823142   TAITO_F2_SYSTEM_INPUT
32833143   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
32843144   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
32963156   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
32973157   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
32983158   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
3299   TAITO_COINAGE_JAPAN_NEW_8
3159   TAITO_COINAGE_JAPAN_NEW
33003160
33013161   PORT_START_TAG("DSWB")
3302   TAITO_DIFFICULTY_8
3162   TAITO_DIFFICULTY
33033163   PORT_DIPNAME( 0x0c, 0x0c, "Time" )
33043164   PORT_DIPSETTING(    0x0c, "5 seconds" )
33053165   PORT_DIPSETTING(    0x08, "10 seconds" )
r2956r2957
33303190   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
33313191   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
33323192   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
3333   TAITO_COINAGE_JAPAN_NEW_8
3193   TAITO_COINAGE_JAPAN_NEW
33343194
33353195   PORT_START_TAG("DSWB")
3336   TAITO_DIFFICULTY_8
3196   TAITO_DIFFICULTY
33373197   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
33383198   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
33393199   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
33533213   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
33543214   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
33553215
3356   PORT_START      /* IN0 */
3216   PORT_START_TAG("IN0")
33573217   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
33583218   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
33593219   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
r2956r2957
33633223   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
33643224   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
33653225
3366   PORT_START      /* IN1 */
3226   PORT_START_TAG("IN1")
33673227   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
33683228   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
33693229   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
r2956r2957
33733233   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
33743234   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
33753235
3376   /* IN2 */
3236   PORT_START_TAG("IN2")
33773237   TAITO_F2_SYSTEM_INPUT
33783238   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
33793239   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
33913251   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
33923252   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
33933253   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
3394   TAITO_COINAGE_JAPAN_NEW_8
3254   TAITO_COINAGE_JAPAN_NEW
33953255
33963256   PORT_START_TAG("DSWB")
3397   TAITO_DIFFICULTY_8
3257   TAITO_DIFFICULTY
33983258   PORT_DIPNAME( 0x0c, 0x0c, "Default Time" )              /* Can be affected ingame by some items and/or player location */
33993259   PORT_DIPSETTING(    0x00, "6 seconds" )
34003260   PORT_DIPSETTING(    0x04, "7 seconds" )
r2956r2957
34053265   PORT_DIPUNUSED( 0x40, IP_ACTIVE_LOW )
34063266   PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW )
34073267
3408   PORT_START      /* IN0 */
3268   PORT_START_TAG("IN0")
34093269   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
34103270   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
34113271   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
r2956r2957
34153275   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
34163276   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
34173277
3418   PORT_START      /* IN1 */
3278   PORT_START_TAG("IN1")
34193279   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
34203280   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
34213281   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
r2956r2957
34253285   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
34263286   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
34273287
3428   /* IN2 */
3288   PORT_START_TAG("IN2")
34293289   TAITO_F2_SYSTEM_INPUT
34303290   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
34313291   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
34433303   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
34443304   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
34453305   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
3446   TAITO_COINAGE_JAPAN_NEW_8
3306   TAITO_COINAGE_JAPAN_NEW
34473307
34483308   PORT_START_TAG("DSWB")
3449   TAITO_DIFFICULTY_8
3309   TAITO_DIFFICULTY
34503310   PORT_DIPUNUSED( 0x04, IP_ACTIVE_LOW )         /* These 2 Dip Switches were designed to change the default timer */
34513311   PORT_DIPUNUSED( 0x08, IP_ACTIVE_LOW )         /* but the 10 seconds setting is duplicated 4 times in the tables */
34523312   PORT_DIPUNUSED( 0x10, IP_ACTIVE_LOW )
r2956r2957
34563316   PORT_DIPSETTING(    0x80, DEF_STR( Joystick ) )
34573317   PORT_DIPSETTING(    0x00, "4 Buttons" )
34583318
3459   PORT_START      /* IN0 */
3319   PORT_START_TAG("IN0")
34603320   /* Joystick Control */
34613321   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x80)
34623322   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_8WAY PORT_PLAYER(1) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x80)
r2956r2957
34763336   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )                                 PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x00)
34773337   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )                                 PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x00)
34783338
3479   PORT_START      /* IN1 */
3339   PORT_START_TAG("IN1")
34803340   /* Joystick Control */
34813341   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x80)
34823342   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_8WAY PORT_PLAYER(2) PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x80)
r2956r2957
34963356   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )                                 PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x00)
34973357   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )                                 PORT_CONDITION("DSWB",0x80,PORTCOND_EQUALS,0x00)
34983358
3499   /* IN2 */
3359   PORT_START_TAG("IN2")
35003360   TAITO_F2_SYSTEM_INPUT
35013361   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
35023362   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
35163376   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
35173377   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
35183378   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
3519   TAITO_COINAGE_JAPAN_NEW_8
3379   TAITO_COINAGE_JAPAN_NEW
35203380
35213381   PORT_START_TAG("DSWB")
3522   TAITO_DIFFICULTY_8
3382   TAITO_DIFFICULTY
35233383   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
35243384   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
35253385   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
35393399   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
35403400   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
35413401
3542   PORT_START      /* IN0 */
3402   PORT_START_TAG("IN0")
35433403   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
35443404   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
35453405   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
r2956r2957
35493409   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
35503410   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
35513411
3552   PORT_START      /* IN1 */
3412   PORT_START_TAG("IN1")
35533413   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
35543414   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
35553415   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
r2956r2957
35593419   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
35603420   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
35613421
3562   /* IN2 */
3422   PORT_START_TAG("IN2")
35633423   TAITO_F2_SYSTEM_INPUT
35643424   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
35653425   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
35683428INPUT_PORTS_END
35693429
35703430static INPUT_PORTS_START( mjnquest )
3571   PORT_START      /* IN0 */
3572   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
3573   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
3574   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
3575   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
3576   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
3431   PORT_START_TAG("IN0")
3432   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
3433   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
3434   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
3435   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
3436   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
35773437   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
35783438   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
35793439
3580   PORT_START      /* IN1 */
3581   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
3582   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
3583   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
3584   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
3585   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
3440   PORT_START_TAG("IN1")
3441   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
3442   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
3443   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
3444   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
3445   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
35863446   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
35873447
3588   PORT_START      /* IN2 */
3589   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
3590   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
3591   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
3592   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
3593   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
3448   PORT_START_TAG("IN2")
3449   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
3450   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
3451   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
3452   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
3453   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
35943454   PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
35953455
3596   PORT_START      /* IN3 */
3597   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
3598   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
3599   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
3600   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
3456   PORT_START_TAG("IN3")
3457   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
3458   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
3459   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
3460   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
36013461   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
36023462
3603   PORT_START      /* IN4 */
3463   PORT_START_TAG("IN4")
36043464   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
36053465
3606   PORT_START      /* IN5 */
3466   PORT_START_TAG("IN5")
36073467   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT )
36083468   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )      // ?
36093469   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
36103470
3611   PORT_START      /* IN6 */
3471   PORT_START_TAG("IN6")
36123472   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE1 )
36133473   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 )
36143474   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
36153475
3616   PORT_START      /* IN7:DSW A */
3476   PORT_START_TAG("DSWA")
36173477   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
36183478   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
36193479   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
36243484   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
36253485   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
36263486   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
3627   TAITO_COINAGE_JAPAN_NEW_8
3487   TAITO_COINAGE_JAPAN_NEW
36283488
3629   PORT_START      /* IN8:DSW B */
3630   TAITO_DIFFICULTY_8
3489   PORT_START_TAG("DSWB")
3490   TAITO_DIFFICULTY
36313491   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
36323492   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
36333493   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
36493509INPUT_PORTS_END
36503510
36513511static INPUT_PORTS_START( yesnoj )   // apparently no test mode, though text in rom suggests printer test
3652   PORT_START      /* IN0 */
3512   PORT_START_TAG("IN0")
36533513   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
36543514   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
36553515   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
36563516   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
36573517   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
36583518
3659   /* IN1 */
3519   PORT_START_TAG("IN1")
36603520   TAITO_F2_SYSTEM_INPUT
36613521   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
36623522
3663   PORT_START /* DSW A ??? */
3523   PORT_START_TAG("DSWA")   /* DSW A ??? */
36643524   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
36653525   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
36663526   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
36863546   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
36873547   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
36883548
3689   PORT_START /* DSW B ? */
3549   PORT_START_TAG("DSWB")   /* DSW B ? */
36903550   PORT_DIPNAME( 0x01, 0x00, "Results Printer" )
36913551   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
36923552   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
src/mame/drivers/stfight.c
r2956r2957
235235
236236static ADDRESS_MAP_START( readmem_cpu1, ADDRESS_SPACE_PROGRAM, 8 )
237237   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
238   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1)          /* sf02.bin */
239   AM_RANGE(0xc000, 0xc1ff) AM_READ(SMH_RAM)            /* palette ram */
240   AM_RANGE(0xc200, 0xc200) AM_READ(input_port_0_r)     /* IN1 */
241   AM_RANGE(0xc201, 0xc201) AM_READ(input_port_1_r)     /* IN2 */
242   AM_RANGE(0xc202, 0xc202) AM_READ(input_port_2_r)     /* IN3 */
243   AM_RANGE(0xc203, 0xc204) AM_READ(stfight_dsw_r)      /* DS0,1 */
244   AM_RANGE(0xc205, 0xc205) AM_READ(stfight_coin_r)     /* coin mech */
245   AM_RANGE(0xd000, 0xd7ff) AM_READ(SMH_RAM)            /* video */
238   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1)         /* sf02.bin */
239   AM_RANGE(0xc000, 0xc1ff) AM_READ(SMH_RAM)         /* palette ram */
240   AM_RANGE(0xc200, 0xc200) AM_READ_PORT("P1")         /* IN1 */
241   AM_RANGE(0xc201, 0xc201) AM_READ_PORT("P2")         /* IN2 */
242   AM_RANGE(0xc202, 0xc202) AM_READ_PORT("START")      /* IN3 */
243   AM_RANGE(0xc203, 0xc204) AM_READ(stfight_dsw_r)      /* DS0,1 */
244   AM_RANGE(0xc205, 0xc205) AM_READ(stfight_coin_r)   /* coin mech */
245   AM_RANGE(0xd000, 0xd7ff) AM_READ(SMH_RAM)         /* video */
246246   AM_RANGE(0xe000, 0xffff) AM_READ(SMH_RAM)
247247
248248ADDRESS_MAP_END
r2956r2957
287287
288288
289289static INPUT_PORTS_START( stfight )
290   PORT_START   /* PLAYER 1 */
290   PORT_START_TAG("P1")   /* PLAYER 1 */
291291   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
292292   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
293293   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2956r2957
297297   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
298298   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
299299
300   PORT_START   /* PLAYER 2 */
300   PORT_START_TAG("P2")   /* PLAYER 2 */
301301   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
302302   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
303303   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
r2956r2957
307307   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
308308   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
309309
310   PORT_START   /* START BUTTONS */
310   PORT_START_TAG("START")   /* START BUTTONS */
311311   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
312312   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
313313   PORT_BIT( 0xe7, IP_ACTIVE_LOW, IPT_UNUSED )
314314
315   PORT_START   /* DSW0 */
316
315   PORT_START_TAG("DSW0")   /* DSW0 */
317316   PORT_DIPNAME( 0x07, 0x00, DEF_STR( Coin_A ) )
318317   PORT_DIPSETTING(    0x07, DEF_STR( 5C_1C ) )
319318   PORT_DIPSETTING(    0x03, DEF_STR( 4C_1C ) )
r2956r2957
336335   PORT_DIPSETTING(    0x80, "Red" )
337336   PORT_DIPSETTING(    0x00, "Blue" )
338337
339   PORT_START   /* DSW1 */
338   PORT_START_TAG("DSW1")   /* DSW1 */
340339   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
341340   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
342341   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
r2956r2957
359358   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
360359   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
361360
362   PORT_START   /* COIN MECH */
361   PORT_START_TAG("COIN")   /* COIN MECH */
363362   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
364363   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2)
365364INPUT_PORTS_END
src/mame/drivers/taito_l.c
r2956r2957
4949
5050*/
5151
52
5352#include "driver.h"
5453#include "deprecat.h"
54#include "taitoipt.h"
5555#include "cpu/z80/z80.h"
5656#include "audio/taitosnd.h"
5757#include "sound/2203intf.h"
r2956r2957
540540   switch(mux_ctrl)
541541   {
542542   case 0:
543      return input_port_read_indexed(machine, 0);
543      return input_port_read(machine, "DSWA");
544544   case 1:
545      return input_port_read_indexed(machine, 1);
545      return input_port_read(machine, "DSWB");
546546   case 2:
547      return input_port_read_indexed(machine, 2);
547      return input_port_read(machine, "IN0");
548548   case 3:
549      return input_port_read_indexed(machine, 3);
549      return input_port_read(machine, "IN1");
550550   case 7:
551      return input_port_read_indexed(machine, 4);
551      return input_port_read(machine, "IN2");
552552   default:
553553      logerror("Mux read from unknown port %d (%04x)\n", mux_ctrl, activecpu_get_pc());
554554      return 0xff;
r2956r2957
660660
661661
662662
663
664663#define COMMON_BANKS_READ \
665664   AM_RANGE(0x0000, 0x5fff) AM_READ(SMH_ROM)         \
666665   AM_RANGE(0x6000, 0x7fff) AM_READ(SMH_BANK1)         \
r2956r2957
719718   AM_RANGE(0xc800, 0xc800) AM_READ(SMH_NOP)
720719   AM_RANGE(0xc801, 0xc801) AM_READ(taitosound_comm_r)
721720   AM_RANGE(0xe000, 0xffff) AM_READ(shared_r)
722   AM_RANGE(0xd000, 0xd000) AM_READ(input_port_0_r)
723   AM_RANGE(0xd001, 0xd001) AM_READ(input_port_1_r)
724   AM_RANGE(0xd002, 0xd002) AM_READ(input_port_2_r)
725   AM_RANGE(0xd003, 0xd003) AM_READ(input_port_3_r)
726   AM_RANGE(0xd007, 0xd007) AM_READ(input_port_4_r)
721   AM_RANGE(0xd000, 0xd000) AM_READ_PORT("DSWA")
722   AM_RANGE(0xd001, 0xd001) AM_READ_PORT("DSWB")
723   AM_RANGE(0xd002, 0xd002) AM_READ_PORT("IN0")
724   AM_RANGE(0xd003, 0xd003) AM_READ_PORT("IN1")
725   AM_RANGE(0xd007, 0xd007) AM_READ_PORT("IN2")
727726ADDRESS_MAP_END
728727
729728static ADDRESS_MAP_START( fhawk_2_writemem, ADDRESS_SPACE_PROGRAM, 8 )
r2956r2957
840839   AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM)
841840   AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK6)
842841   AM_RANGE(0xc000, 0xdfff) AM_READ(shared_r)
843   AM_RANGE(0xe000, 0xe000) AM_READ(input_port_0_r)
844   AM_RANGE(0xe001, 0xe001) AM_READ(input_port_1_r)
845   AM_RANGE(0xe002, 0xe002) AM_READ(input_port_2_r)
846   AM_RANGE(0xe003, 0xe003) AM_READ(input_port_3_r)
847   AM_RANGE(0xe007, 0xe007) AM_READ(input_port_4_r)
842   AM_RANGE(0xe000, 0xe000) AM_READ_PORT("DSWA")
843   AM_RANGE(0xe001, 0xe001) AM_READ_PORT("DSWB")
844   AM_RANGE(0xe002, 0xe002) AM_READ_PORT("IN0")
845   AM_RANGE(0xe003, 0xe003) AM_READ_PORT("IN1")
846   AM_RANGE(0xe007, 0xe007) AM_READ_PORT("IN2")
848847   AM_RANGE(0xe008, 0xe00f) AM_READ(SMH_NOP)
849848   AM_RANGE(0xe800, 0xe800) AM_READ(SMH_NOP)
850849   AM_RANGE(0xe801, 0xe801) AM_READ(taitosound_comm_r)
r2956r2957
907906   AM_RANGE(0xe000, 0xe7ff) AM_READ(shared_r)
908907   AM_RANGE(0xe800, 0xe800) AM_READ(YM2203_status_port_0_r)
909908#if 0
910   AM_RANGE(0xd000, 0xd000) AM_READ(input_port_0_r)
911   AM_RANGE(0xd001, 0xd001) AM_READ(input_port_1_r)
912   AM_RANGE(0xd002, 0xd002) AM_READ(input_port_2_r)
913   AM_RANGE(0xd003, 0xd003) AM_READ(input_port_3_r)
914   AM_RANGE(0xd007, 0xd007) AM_READ(input_port_4_r)
909   AM_RANGE(0xd000, 0xd000) AM_READ_PORT("DSWA")
910   AM_RANGE(0xd001, 0xd001) AM_READ_PORT("DSWB")
911   AM_RANGE(0xd002, 0xd002) AM_READ_PORT("IN0")
912   AM_RANGE(0xd003, 0xd003) AM_READ_PORT("IN1")
913   AM_RANGE(0xd007, 0xd007) AM_READ_PORT("IN2")
915914#endif
916915ADDRESS_MAP_END
917916
r2956r2957
982981static ADDRESS_MAP_START( palamed_readmem, ADDRESS_SPACE_PROGRAM, 8 )
983982   COMMON_BANKS_READ
984983   COMMON_SINGLE_READ
985   AM_RANGE(0xa800, 0xa800) AM_READ(input_port_2_r)
986   AM_RANGE(0xa801, 0xa801) AM_READ(input_port_3_r)
987   AM_RANGE(0xa802, 0xa802) AM_READ(input_port_4_r)
984   AM_RANGE(0xa800, 0xa800) AM_READ_PORT("IN0")
985   AM_RANGE(0xa801, 0xa801) AM_READ_PORT("IN1")
986   AM_RANGE(0xa802, 0xa802) AM_READ_PORT("IN2")
988987   AM_RANGE(0xb001, 0xb001) AM_READ(SMH_NOP)   // Watchdog or interrupt ack
989988ADDRESS_MAP_END
990989
r2956r2957
999998static ADDRESS_MAP_START( cachat_readmem, ADDRESS_SPACE_PROGRAM, 8 )
1000999   COMMON_BANKS_READ
10011000   COMMON_SINGLE_READ
1002   AM_RANGE(0xa800, 0xa800) AM_READ(input_port_2_r)
1003   AM_RANGE(0xa801, 0xa801) AM_READ(input_port_3_r)
1004   AM_RANGE(0xa802, 0xa802) AM_READ(input_port_4_r)
1001   AM_RANGE(0xa800, 0xa800) AM_READ_PORT("IN0")
1002   AM_RANGE(0xa801, 0xa801) AM_READ_PORT("IN1")
1003   AM_RANGE(0xa802, 0xa802) AM_READ_PORT("IN2")
10051004   AM_RANGE(0xb001, 0xb001) AM_READ(SMH_NOP)   // Watchdog or interrupt ack (value ignored)
10061005   AM_RANGE(0xfff8, 0xfff8) AM_READ(rombankswitch_r)
10071006ADDRESS_MAP_END
r2956r2957
10381037   COMMON_BANKS_READ
10391038   AM_RANGE(0x8000, 0x9fff) AM_READ(SMH_RAM)
10401039   AM_RANGE(0xa000, 0xa7ff) AM_READ(SMH_RAM)
1041   AM_RANGE(0xa800, 0xa800) AM_READ(input_port_0_r)
1042   AM_RANGE(0xa801, 0xa801) AM_READ(input_port_1_r)
1043   AM_RANGE(0xa802, 0xa802) AM_READ(input_port_2_r)
1044   AM_RANGE(0xa803, 0xa803) AM_READ(input_port_3_r)
1045   AM_RANGE(0xa807, 0xa807) AM_READ(input_port_4_r)
1040   AM_RANGE(0xa800, 0xa800) AM_READ_PORT("DSWA")
1041   AM_RANGE(0xa801, 0xa801) AM_READ_PORT("DSWB")
1042   AM_RANGE(0xa802, 0xa802) AM_READ_PORT("IN0")
1043   AM_RANGE(0xa803, 0xa803) AM_READ_PORT("IN1")
1044   AM_RANGE(0xa807, 0xa807) AM_READ_PORT("IN2")
10461045ADDRESS_MAP_END
10471046
10481047
r2956r2957
10871086             INPUT PORTS, DIPs
10881087***********************************************************/
10891088
1090#define TAITO_COINAGE_WORLD_8 \
1091   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
1092   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
1093   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) \
1094   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) ) \
1095   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
1096   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
1097   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) ) \
1098   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) ) \
1099   PORT_DIPSETTING(    0x40, DEF_STR( 1C_4C ) ) \
1100   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
1101
1102#define TAITO_COINAGE_JAPAN_8 \
1103   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
1104   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) ) \
1105   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
1106   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) ) \
1107   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) ) \
1108   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
1109   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
1110   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) ) \
1111   PORT_DIPSETTING(    0x00, DEF_STR( 2C_3C ) ) \
1112   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
1113
1114#define TAITO_COINAGE_JAPAN_NEW_8 \
1115   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) \
1116   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) ) \
1117   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) ) \
1118   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
1119   PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) ) \
1120   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) ) \
1121   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) ) \
1122   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
1123   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) ) \
1124   PORT_DIPSETTING(    0x80, DEF_STR( 1C_2C ) )
1125
1126#define TAITO_COINAGE_US_8 \
1127   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coinage ) ) \
1128   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) ) \
1129   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) ) \
1130   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) ) \
1131   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) ) \
1132   PORT_DIPNAME( 0xc0, 0xc0, "Price to Continue" ) \
1133   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) ) \
1134   PORT_DIPSETTING(    0x40, DEF_STR( 2C_1C ) ) \
1135   PORT_DIPSETTING(    0x80, DEF_STR( 1C_1C ) ) \
1136   PORT_DIPSETTING(    0xc0, "Same as Start" )
1137
1138#define TAITO_DIFFICULTY_8 \
1139   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) \
1140   PORT_DIPSETTING(    0x02, DEF_STR( Easy ) ) \
1141   PORT_DIPSETTING(    0x03, DEF_STR( Medium ) ) \
1142   PORT_DIPSETTING(    0x01, DEF_STR( Hard ) ) \
1143   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
1144
1145#define TAITO_L_PLAYERS_INPUT( player ) \
1146   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(player) PORT_8WAY \
1147   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(player) PORT_8WAY \
1148   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(player) PORT_8WAY \
1149   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(player) PORT_8WAY \
1150   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(player) \
1151   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(player) \
1152   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
1153   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1154
11551089#define TAITO_L_SYSTEM_INPUT( type, impulse ) \
1156   PORT_START_TAG("IN3")\
1090   PORT_START_TAG("IN2")\
11571091   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_TILT ) \
11581092   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 ) \
11591093   PORT_BIT( 0x04, type, IPT_COIN1 ) PORT_IMPULSE(impulse) \
r2956r2957
11631097   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) \
11641098   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
11651099
1166#define TAITO_L_DSWA_2_4 \
1167   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) ) \
1168   PORT_DIPSETTING(    0x02, DEF_STR( Off ) ) \
1169   PORT_DIPSETTING(    0x00, DEF_STR( On ) ) \
1170   PORT_SERVICE( 0x04, IP_ACTIVE_LOW ) \
1171   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) \
1172   PORT_DIPSETTING(    0x00, DEF_STR( Off ) ) \
1173   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1174
11751100static INPUT_PORTS_START( fhawk )
11761101   PORT_START_TAG("DSWA")
1177   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
1178   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1179   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
1180   TAITO_L_DSWA_2_4
1181   TAITO_COINAGE_WORLD_8
1102   TAITO_MACHINE_COCKTAIL
1103   TAITO_COINAGE_WORLD
11821104
11831105   PORT_START_TAG("DSWB")
1184   TAITO_DIFFICULTY_8
1106   TAITO_DIFFICULTY
11851107   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )  // all in manual
11861108   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
11871109   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
12011123   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
12021124
12031125   PORT_START_TAG("IN0")
1204   TAITO_L_PLAYERS_INPUT( 1 )
1126   TAITO_JOY_UDLR_2_BUTTONS( 1 )
1127
12051128   PORT_START_TAG("IN1")
1206   TAITO_L_PLAYERS_INPUT( 2 )
1129   TAITO_JOY_UDLR_2_BUTTONS( 2 )
12071130
12081131   TAITO_L_SYSTEM_INPUT( IP_ACTIVE_LOW, 4 )
12091132INPUT_PORTS_END
12101133
12111134static INPUT_PORTS_START( fhawkj )
12121135   PORT_START_TAG("DSWA")
1213   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
1214   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1215   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
1216   TAITO_L_DSWA_2_4
1217   TAITO_COINAGE_JAPAN_8
1136   TAITO_MACHINE_COCKTAIL
1137   TAITO_COINAGE_JAPAN_OLD
12181138
12191139   PORT_START_TAG("DSWB")
1220   TAITO_DIFFICULTY_8
1140   TAITO_DIFFICULTY
12211141   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )  // all in manual
12221142   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
12231143   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
12371157   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
12381158
12391159   PORT_START_TAG("IN0")
1240   TAITO_L_PLAYERS_INPUT( 1 )
1160   TAITO_JOY_UDLR_2_BUTTONS( 1 )
1161
12411162   PORT_START_TAG("IN1")
1242   TAITO_L_PLAYERS_INPUT( 2 )
1163   TAITO_JOY_UDLR_2_BUTTONS( 2 )
1164
12431165   TAITO_L_SYSTEM_INPUT( IP_ACTIVE_LOW, 4 )
12441166INPUT_PORTS_END
12451167
12461168static INPUT_PORTS_START( raimais )
12471169   PORT_START_TAG("DSWA")
1248   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
1249   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1250   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
1251   TAITO_L_DSWA_2_4
1252   TAITO_COINAGE_WORLD_8
1170   TAITO_MACHINE_COCKTAIL
1171   TAITO_COINAGE_WORLD
12531172
12541173   PORT_START_TAG("DSWB")
1255   TAITO_DIFFICULTY_8
1174   TAITO_DIFFICULTY
12561175   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
12571176   PORT_DIPSETTING(    0x08, "80k and 160k" )
12581177   PORT_DIPSETTING(    0x0c, "80k only" )
r2956r2957
12711190   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
12721191
12731192   PORT_START_TAG("IN0")
1274   TAITO_L_PLAYERS_INPUT( 1 )
1193   TAITO_JOY_UDLR_2_BUTTONS( 1 )
12751194
1195
12761196   PORT_START_TAG("IN1")
1277   TAITO_L_PLAYERS_INPUT( 2 )
1197   TAITO_JOY_UDLR_2_BUTTONS( 2 )
12781198
12791199   TAITO_L_SYSTEM_INPUT( IP_ACTIVE_HIGH, 1 )
12801200INPUT_PORTS_END
12811201
12821202static INPUT_PORTS_START( raimaisj )
12831203   PORT_START_TAG("DSWA")
1284   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
1285   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1286   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
1287   TAITO_L_DSWA_2_4
1288   TAITO_COINAGE_JAPAN_8
1204   TAITO_MACHINE_COCKTAIL
1205   TAITO_COINAGE_JAPAN_OLD
12891206
12901207   PORT_START_TAG("DSWB")
1291   TAITO_DIFFICULTY_8
1208   TAITO_DIFFICULTY
12921209   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
12931210   PORT_DIPSETTING(    0x08, "80k and 160k" )
12941211   PORT_DIPSETTING(    0x0c, "80k only" )
r2956r2957
13071224   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
13081225
13091226   PORT_START_TAG("IN0")
1310   TAITO_L_PLAYERS_INPUT( 1 )
1227   TAITO_JOY_UDLR_2_BUTTONS( 1 )
13111228
13121229   PORT_START_TAG("IN1")
1313   TAITO_L_PLAYERS_INPUT( 2 )
1230   TAITO_JOY_UDLR_2_BUTTONS( 2 )
13141231
13151232   TAITO_L_SYSTEM_INPUT( IP_ACTIVE_HIGH, 1 )
13161233INPUT_PORTS_END
13171234
1318#define CHAMPWR_DSWB \
1319   PORT_START_TAG("DSWB") \
1320   TAITO_DIFFICULTY_8 \
1321   PORT_DIPNAME( 0x0c, 0x0c, "Time" ) \
1322   PORT_DIPSETTING(    0x08, "2 minutes" ) \
1323   PORT_DIPSETTING(    0x0c, "3 minutes" ) \
1324   PORT_DIPSETTING(    0x04, "4 minutes" ) \
1325   PORT_DIPSETTING(    0x00, "5 minutes" ) \
1326   PORT_DIPNAME( 0x30, 0x30, "'1 minute' Lasts:" ) \
1327   PORT_DIPSETTING(    0x00, "30 sec" ) \
1328   PORT_DIPSETTING(    0x10, "40 sec" ) \
1329   PORT_DIPSETTING(    0x30, "50 sec" ) \
1330   PORT_DIPSETTING(    0x20, "60 sec" ) \
1331   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) ) \
1332   PORT_DIPSETTING(    0x00, DEF_STR( Off ) ) \
1333   PORT_DIPSETTING(    0x40, DEF_STR( On ) ) \
1334   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) \
1335   PORT_DIPSETTING(    0x80, DEF_STR( Off ) ) \
1336   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1337
1338#define CHAMPWR_INPUTS \
1339    PORT_START_TAG("IN0") \
1340   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) \
1341   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) \
1342   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) \
1343   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) \
1344   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) \
1345   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) \
1346   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT ) \
1347   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) \
1348 \
1349   PORT_START_TAG("IN1") \
1350   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1) \
1351   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1) \
1352   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
1353   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
1354   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
1355   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
1356   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
1357   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
1358 \
1359   PORT_START_TAG("IN2") \
1360   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) \
1361   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) \
1362   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) \
1363   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) \
1364   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) \
1365   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) \
1366   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) \
1367   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
1368
13691235static INPUT_PORTS_START( champwr )
13701236   PORT_START_TAG("DSWA")
1371   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )  // all 2 in manual
1372   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1237   TAITO_MACHINE_NO_COCKTAIL   // all 2 in manual
1238   TAITO_COINAGE_WORLD
1239
1240   PORT_START_TAG("DSWB")
1241   TAITO_DIFFICULTY
1242   PORT_DIPNAME( 0x0c, 0x0c, "Time" )
1243   PORT_DIPSETTING(    0x08, "2 minutes" )
1244   PORT_DIPSETTING(    0x0c, "3 minutes" )
1245   PORT_DIPSETTING(    0x04, "4 minutes" )
1246   PORT_DIPSETTING(    0x00, "5 minutes" )
1247   PORT_DIPNAME( 0x30, 0x30, "'1 minute' Lasts:" )
1248   PORT_DIPSETTING(    0x00, "30 sec" )
1249   PORT_DIPSETTING(    0x10, "40 sec" )
1250   PORT_DIPSETTING(    0x30, "50 sec" )
1251   PORT_DIPSETTING(    0x20, "60 sec" )
1252   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Allow_Continue ) )
1253   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1254   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
1255   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
1256   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
13731257   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1374   TAITO_L_DSWA_2_4
1375   TAITO_COINAGE_WORLD_8
13761258
1377   CHAMPWR_DSWB
1259    PORT_START_TAG("IN0")
1260   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
1261   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
1262   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
1263   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
1264   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1265   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1266   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT )
1267   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 )
13781268
1379   CHAMPWR_INPUTS
1269   PORT_START_TAG("IN1")
1270   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(1)
1271   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(1)
1272   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1273   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1274   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1275   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1276   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1277   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1278
1279   PORT_START_TAG("IN2")
1280   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
1281   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
1282   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
1283   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
1284   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
1285   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
1286   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
1287   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
13801288INPUT_PORTS_END
13811289
13821290static INPUT_PORTS_START( champwrj )
1383   PORT_START_TAG("DSWA")
1384   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
1385   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1386   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1387   TAITO_L_DSWA_2_4
1388   TAITO_COINAGE_JAPAN_8
1291   PORT_INCLUDE( champwr )
13891292
1390   CHAMPWR_DSWB
1391
1392   CHAMPWR_INPUTS
1293   PORT_MODIFY("DSWA")
1294   TAITO_COINAGE_JAPAN_OLD
13931295INPUT_PORTS_END
13941296
13951297static INPUT_PORTS_START( champwru )
1396   PORT_START_TAG("DSWA")
1397   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) )
1398   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1399   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1400   TAITO_L_DSWA_2_4
1401   TAITO_COINAGE_US_8
1298   PORT_INCLUDE( champwr )
14021299
1403   CHAMPWR_DSWB
1404
1405   CHAMPWR_INPUTS
1300   PORT_MODIFY("DSWA")
1301   TAITO_COINAGE_US
14061302INPUT_PORTS_END
14071303
1408#define KURIKIN_DSWB \
1409   PORT_START_TAG("DSWB") \
1410   TAITO_DIFFICULTY_8 \
1411   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) \
1412   PORT_DIPSETTING(    0x04, DEF_STR( Off ) ) \
1413   PORT_DIPSETTING(    0x00, DEF_STR( On ) ) \
1414   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) \
1415   PORT_DIPSETTING(    0x08, DEF_STR( Off ) ) \
1416   PORT_DIPSETTING(    0x00, DEF_STR( On ) ) \
1417   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) \
1418   PORT_DIPSETTING(    0x10, DEF_STR( Off ) ) \
1419   PORT_DIPSETTING(    0x00, DEF_STR( On ) ) \
1420   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) \
1421   PORT_DIPSETTING(    0x20, DEF_STR( Off ) ) \
1422   PORT_DIPSETTING(    0x00, DEF_STR( On ) ) \
1423   PORT_DIPNAME( 0x40, 0x40, "Bosses' messages" ) \
1424   PORT_DIPSETTING(    0x00, DEF_STR( Off ) ) \
1425   PORT_DIPSETTING(    0x40, DEF_STR( On ) ) \
1426   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Allow_Continue ) ) \
1427   PORT_DIPSETTING(    0x80, "5 Times" ) \
1428   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1429
14301304static INPUT_PORTS_START( kurikint )
14311305   PORT_START_TAG("DSWA")
1432   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
1433   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1434   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
1435   TAITO_L_DSWA_2_4
1436   TAITO_COINAGE_WORLD_8
1306   TAITO_MACHINE_COCKTAIL
1307   TAITO_COINAGE_WORLD
14371308
1438   KURIKIN_DSWB
1309   PORT_START_TAG("DSWB")
1310   TAITO_DIFFICULTY
1311   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
1312   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
1313   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1314   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
1315   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1316   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1317   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
1318   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1319   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1320   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
1321   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
1322   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1323   PORT_DIPNAME( 0x40, 0x40, "Bosses' messages" )
1324   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1325   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
1326   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Allow_Continue ) )
1327   PORT_DIPSETTING(    0x80, "5 Times" )
1328   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
14391329
14401330   PORT_START_TAG("IN0")
1441   TAITO_L_PLAYERS_INPUT( 1 )
1331   TAITO_JOY_UDLR_2_BUTTONS( 1 )
14421332
14431333   PORT_START_TAG("IN1")
1444   TAITO_L_PLAYERS_INPUT( 2 )
1334   TAITO_JOY_UDLR_2_BUTTONS( 2 )
14451335
14461336   TAITO_L_SYSTEM_INPUT( IP_ACTIVE_HIGH, 4 )
14471337INPUT_PORTS_END
14481338
14491339static INPUT_PORTS_START( kurikinj )
1450   PORT_START_TAG("DSWA")
1451   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
1452   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1453   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
1454   TAITO_L_DSWA_2_4
1455   TAITO_COINAGE_JAPAN_8
1340   PORT_INCLUDE( kurikint )
14561341
1457   KURIKIN_DSWB
1458
1459   PORT_START_TAG("IN0")
1460   TAITO_L_PLAYERS_INPUT( 1 )
1461
1462   PORT_START_TAG("IN1")
1463   TAITO_L_PLAYERS_INPUT( 2 )
1464
1465   TAITO_L_SYSTEM_INPUT( IP_ACTIVE_HIGH, 4 )
1342   PORT_MODIFY("DSWA")
1343   TAITO_COINAGE_JAPAN_OLD
14661344INPUT_PORTS_END
14671345
14681346static INPUT_PORTS_START( kurikina )
1469   PORT_START_TAG("DSWA")
1347   PORT_INCLUDE( kurikint )
1348
1349   PORT_MODIFY("DSWA")
14701350   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
14711351   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
14721352   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
r2956r2957
14791359   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
14801360   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
14811361   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1482   TAITO_COINAGE_WORLD_8
1362   TAITO_COINAGE_WORLD
14831363
1484   PORT_START_TAG("DSWB")
1364   PORT_MODIFY("DSWB")
14851365   PORT_DIPNAME( 0x01, 0x01, "Level Select (Cheat)")
14861366   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
14871367   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
15051385   PORT_DIPNAME( 0x80, 0x80, "Slow Motion (Cheat)")
15061386   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
15071387   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1508
1509   PORT_START_TAG("IN0")
1510   TAITO_L_PLAYERS_INPUT( 1 )
1511
1512   PORT_START_TAG("IN1")
1513   TAITO_L_PLAYERS_INPUT( 2 )
1514
1515   TAITO_L_SYSTEM_INPUT( IP_ACTIVE_HIGH, 4 )
15161388INPUT_PORTS_END
15171389
15181390static INPUT_PORTS_START( puzznic )
15191391   PORT_START_TAG("DSWA")
1520   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
1521   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
1522   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
1523   TAITO_L_DSWA_2_4
1392   TAITO_MACHINE_COCKTAIL
15241393   /* There is no Coin B in the Manuals */
15251394   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coinage ) )
15261395   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
r2956r2957
15361405
15371406   PORT_START_TAG("DSWB")
15381407   /* Difficulty controls the Timer Speed (how many seconds are there in a minute) */
1539   TAITO_DIFFICULTY_8
1408   TAITO_DIFFICULTY
15401409   PORT_DIPNAME( 0x0c, 0x0c, "Retries" )
15411410   PORT_DIPSETTING(    0x00, "0" )
15421411   PORT_DIPSETTING(    0x04, "1" )
r2956r2957
15901459   PORT_DIPNAME( 0x01, 0x01, "Play Mode" )
15911460   PORT_DIPSETTING(    0x00, "1 Player" )
15921461   PORT_DIPSETTING(    0x01, "2 Player" )
1593   TAITO_L_DSWA_2_4
1594   TAITO_COINAGE_WORLD_8
1462   TAITO_DSWA_BITS_1_TO_3
1463   TAITO_COINAGE_WORLD
15951464
15961465   PORT_START_TAG("DSWB")
1597   TAITO_DIFFICULTY_8
1466   TAITO_DIFFICULTY
15981467   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
15991468   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
16001469   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
16391508   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
16401509   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
16411510   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1642   TAITO_L_DSWA_2_4
1643   TAITO_COINAGE_JAPAN_NEW_8
1511   TAITO_DSWA_BITS_1_TO_3
1512   TAITO_COINAGE_JAPAN_NEW
16441513
16451514   PORT_START_TAG("DSWB")
16461515   /* Difficulty controls how fast the dice lines fall*/
1647   TAITO_DIFFICULTY_8
1516   TAITO_DIFFICULTY
16481517   PORT_DIPNAME( 0x0c, 0x0c, "Games for VS Victory" )
16491518   PORT_DIPSETTING(    0x08, "1 Game" )
16501519   PORT_DIPSETTING(    0x0c, "2 Games" )
r2956r2957
16981567   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
16991568   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
17001569   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1701   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Flip_Screen ) )
1702   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1703   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
1704   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
1705   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
1706   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1707   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1708   TAITO_COINAGE_JAPAN_NEW_8
1570   TAITO_DSWA_BITS_1_TO_3
1571   TAITO_COINAGE_JAPAN_NEW
17091572
17101573   PORT_START_TAG("DSWB")
1711   TAITO_DIFFICULTY_8
1574   TAITO_DIFFICULTY
17121575   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
17131576   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
17141577   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
17641627   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
17651628   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
17661629   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1767   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Flip_Screen ) )
1768   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1769   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
1770   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
1771   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
1772   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1773   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1774   TAITO_COINAGE_WORLD_8
1630   TAITO_DSWA_BITS_1_TO_3
1631   TAITO_COINAGE_WORLD
17751632
17761633   PORT_START_TAG("DSWB")
1777   TAITO_DIFFICULTY_8
1634   TAITO_DIFFICULTY
17781635   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
17791636   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
17801637   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
18301687   PORT_DIPNAME( 0x01, 0x01, "Beer Frame Message" )
18311688   PORT_DIPSETTING(    0x01, "Break Time" )
18321689   PORT_DIPSETTING(    0x00, "Beer Frame" )
1833   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Flip_Screen ) )
1834   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1835   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1836   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
1837   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
1838   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1839   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1840   TAITO_COINAGE_US_8   /* According to the "United States Version" manual listing */
1690   TAITO_DSWA_BITS_1_TO_3
1691   TAITO_COINAGE_US   /* According to the "United States Version" manual listing */
18411692
18421693   PORT_START_TAG("DSWB")
18431694   /* Not for sure, the CPU seems to play better when set to Hardest */
1844   TAITO_DIFFICULTY_8
1695   TAITO_DIFFICULTY
18451696   PORT_DIPNAME( 0x0c, 0x0c, "Time" )
18461697   PORT_DIPSETTING(    0x08, "20 sec" )
18471698   PORT_DIPSETTING(    0x0c, "30 sec" )
r2956r2957
19141765
19151766   PORT_START_TAG("DSWB")
19161767   /* Difficulty controls the Ball Speed */
1917   TAITO_DIFFICULTY_8
1768   TAITO_DIFFICULTY
19181769   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
19191770   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
19201771   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
19771828   PORT_DIPNAME( 0x08, 0x08, "Coin Mode" ) /* Coin Mode B not supported yet */
19781829   PORT_DIPSETTING(    0x08, "Mode A" )
19791830   PORT_DIPSETTING(    0x00, "Mode B" )
1980   TAITO_COINAGE_JAPAN_8
1831   TAITO_COINAGE_JAPAN_OLD
19811832/*
19821833
19831834Coin 1 is DSW 1, 5&6 - Coin 2 is DSW 1, 7&8
r2956r2957
19971848
19981849   PORT_START_TAG("DSWB")
19991850   /* Difficulty controls the number of hits requiered to destroy enemies */
2000   TAITO_DIFFICULTY_8
1851   TAITO_DIFFICULTY
20011852   PORT_DIPNAME( 0x04, 0x04, "Time" ) /* Simply listed as "Time", what exactly does it refer to? */
20021853   PORT_DIPSETTING(    0x04, "2 Seconds" )
20031854   PORT_DIPSETTING(    0x00, "3 Seconds" )
r2956r2957
20591910   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
20601911   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
20611912   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2062   TAITO_COINAGE_JAPAN_NEW_8
1913   TAITO_COINAGE_JAPAN_NEW
20631914
20641915   PORT_START_TAG("DSWB")
2065   TAITO_DIFFICULTY_8
1916   TAITO_DIFFICULTY
20661917   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
20671918   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
20681919   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
21141965INPUT_PORTS_END
21151966
21161967static INPUT_PORTS_START( evilston )
2117
21181968   PORT_START_TAG("DSWA")
2119   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
2120   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
2121   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
2122   TAITO_L_DSWA_2_4
2123   TAITO_COINAGE_WORLD_8
1969   TAITO_MACHINE_COCKTAIL
1970   TAITO_COINAGE_WORLD
21241971
21251972   PORT_START_TAG("DSWB")
2126   TAITO_DIFFICULTY_8
1973   TAITO_DIFFICULTY
21271974   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) )
21281975   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
21291976   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
21351982   PORT_DIPSETTING(    0x20, "2" )
21361983   PORT_DIPSETTING(    0x10, "1" )
21371984   PORT_DIPSETTING(    0x00, "4" )
2138  PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Language ) )
2139  PORT_DIPSETTING(    0x00, DEF_STR( English ) )
2140  PORT_DIPSETTING(    0x80, DEF_STR( English ) )
2141  PORT_DIPSETTING(    0x40, DEF_STR( English ) )
2142  PORT_DIPSETTING(    0xc0, DEF_STR( Japanese ) )
1985   PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Language ) )
1986   PORT_DIPSETTING(    0x00, DEF_STR( English ) )
1987   PORT_DIPSETTING(    0x80, DEF_STR( English ) )
1988   PORT_DIPSETTING(    0x40, DEF_STR( English ) )
1989   PORT_DIPSETTING(    0xc0, DEF_STR( Japanese ) )
21431990
21441991   PORT_START_TAG("IN0")
21451992   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
r2956r2957
21642011   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL
21652012   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL
21662013   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
2167
21682014INPUT_PORTS_END
21692015
21702016
src/mame/drivers/cabal.c
r2956r2957
118118
119119
120120
121static ADDRESS_MAP_START( readmem_cpu, ADDRESS_SPACE_PROGRAM, 16 )
122   AM_RANGE(0x00000, 0x3ffff) AM_READ(SMH_ROM)
123   AM_RANGE(0x40000, 0x437ff) AM_READ(SMH_RAM)
124   AM_RANGE(0x43800, 0x43fff) AM_READ(SMH_RAM)
125   AM_RANGE(0x44000, 0x4ffff) AM_READ(SMH_RAM)
126   AM_RANGE(0x60000, 0x607ff) AM_READ(SMH_RAM)
127   AM_RANGE(0x80000, 0x801ff) AM_READ(SMH_RAM)
128   AM_RANGE(0x80200, 0x803ff) AM_READ(SMH_RAM)
121static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
122   AM_RANGE(0x00000, 0x3ffff) AM_ROM
123   AM_RANGE(0x40000, 0x437ff) AM_RAM
124   AM_RANGE(0x43800, 0x43fff) AM_RAM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
125   AM_RANGE(0x44000, 0x4ffff) AM_RAM
126   AM_RANGE(0x60000, 0x607ff) AM_RAM_WRITE(cabal_text_videoram16_w) AM_BASE(&colorram16)
127   AM_RANGE(0x80000, 0x801ff) AM_RAM_WRITE(cabal_background_videoram16_w) AM_BASE(&videoram16) AM_SIZE(&videoram_size)
128   AM_RANGE(0x80200, 0x803ff) AM_RAM_WRITE(SMH_RAM)
129129   AM_RANGE(0xa0000, 0xa0001) AM_READ(input_port_0_word_r)
130130   AM_RANGE(0xa0008, 0xa000f) AM_READ(track_r)
131131   AM_RANGE(0xa0010, 0xa0011) AM_READ(input_port_1_word_r)
132   AM_RANGE(0xe0000, 0xe07ff) AM_READ(SMH_RAM)
133   AM_RANGE(0xe8000, 0xe800d) AM_READ(seibu_main_word_r)
134ADDRESS_MAP_END
135
136static ADDRESS_MAP_START( writemem_cpu, ADDRESS_SPACE_PROGRAM, 16 )
137   AM_RANGE(0x00000, 0x3ffff) AM_WRITE(SMH_ROM)
138   AM_RANGE(0x40000, 0x437ff) AM_WRITE(SMH_RAM)
139   AM_RANGE(0x43800, 0x43fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
140   AM_RANGE(0x44000, 0x4ffff) AM_WRITE(SMH_RAM)
141   AM_RANGE(0x60000, 0x607ff) AM_WRITE(cabal_text_videoram16_w) AM_BASE(&colorram16)
142   AM_RANGE(0x80000, 0x801ff) AM_WRITE(cabal_background_videoram16_w) AM_BASE(&videoram16) AM_SIZE(&videoram_size)
143   AM_RANGE(0x80200, 0x803ff) AM_WRITE(SMH_RAM)
144132   AM_RANGE(0xc0000, 0xc0001) AM_WRITE(track_reset_w)
145133   AM_RANGE(0xc0040, 0xc0041) AM_WRITE(SMH_NOP) /* ??? */
146134   AM_RANGE(0xc0080, 0xc0081) AM_WRITE(cabal_flipscreen_w)
147   AM_RANGE(0xe0000, 0xe07ff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16)
135   AM_RANGE(0xe0000, 0xe07ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16)
148136   AM_RANGE(0xe8008, 0xe8009) AM_WRITE(cabal_sound_irq_trigger_word_w)   // fix coin insertion
149   AM_RANGE(0xe8000, 0xe800d) AM_WRITE(seibu_main_word_w)
137   AM_RANGE(0xe8000, 0xe800d) AM_READWRITE(seibu_main_word_r, seibu_main_word_w)
150138ADDRESS_MAP_END
151139
152static ADDRESS_MAP_START( cabalbl_readmem_cpu, ADDRESS_SPACE_PROGRAM, 16 )
153   AM_RANGE(0x00000, 0x3ffff) AM_READ(SMH_ROM)
154   AM_RANGE(0x40000, 0x437ff) AM_READ(SMH_RAM)
155   AM_RANGE(0x43800, 0x43fff) AM_READ(SMH_RAM)
156   AM_RANGE(0x44000, 0x4ffff) AM_READ(SMH_RAM)
157   AM_RANGE(0x60000, 0x607ff) AM_READ(SMH_RAM)
158   AM_RANGE(0x80000, 0x801ff) AM_READ(SMH_RAM)
159   AM_RANGE(0x80200, 0x803ff) AM_READ(SMH_RAM)
140static ADDRESS_MAP_START( cabalbl_main_map, ADDRESS_SPACE_PROGRAM, 16 )
141   AM_RANGE(0x00000, 0x3ffff) AM_ROM
142   AM_RANGE(0x40000, 0x437ff) AM_RAM
143   AM_RANGE(0x43800, 0x43fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
144   AM_RANGE(0x44000, 0x4ffff) AM_RAM
145   AM_RANGE(0x60000, 0x607ff) AM_RAM_WRITE(cabal_text_videoram16_w) AM_BASE(&colorram16)
146   AM_RANGE(0x80000, 0x801ff) AM_RAM_WRITE(cabal_background_videoram16_w) AM_BASE(&videoram16) AM_SIZE(&videoram_size)
147   AM_RANGE(0x80200, 0x803ff) AM_RAM
160148   AM_RANGE(0xa0000, 0xa0001) AM_READ(input_port_0_word_r)
161149   AM_RANGE(0xa0008, 0xa0009) AM_READ(input_port_1_word_r)
162150   AM_RANGE(0xa0010, 0xa0011) AM_READ(input_port_2_word_r)
163   AM_RANGE(0xe0000, 0xe07ff) AM_READ(SMH_RAM)
164   AM_RANGE(0xe8004, 0xe8005) AM_READ(soundlatch2_word_r)
165ADDRESS_MAP_END
166
167static ADDRESS_MAP_START( cabalbl_writemem_cpu, ADDRESS_SPACE_PROGRAM, 16 )
168   AM_RANGE(0x00000, 0x3ffff) AM_WRITE(SMH_ROM)
169   AM_RANGE(0x40000, 0x437ff) AM_WRITE(SMH_RAM)
170   AM_RANGE(0x43800, 0x43fff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size)
171   AM_RANGE(0x44000, 0x4ffff) AM_WRITE(SMH_RAM)
172   AM_RANGE(0x60000, 0x607ff) AM_WRITE(cabal_text_videoram16_w) AM_BASE(&colorram16)
173   AM_RANGE(0x80000, 0x801ff) AM_WRITE(cabal_background_videoram16_w) AM_BASE(&videoram16) AM_SIZE(&videoram_size)
174   AM_RANGE(0x80200, 0x803ff) AM_WRITE(SMH_RAM)
175151   AM_RANGE(0xc0040, 0xc0041) AM_WRITE(SMH_NOP) /* ??? */
176152   AM_RANGE(0xc0080, 0xc0081) AM_WRITE(cabal_flipscreen_w)
177   AM_RANGE(0xe0000, 0xe07ff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16)
153   AM_RANGE(0xe0000, 0xe07ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16)
178154   AM_RANGE(0xe8000, 0xe8003) AM_WRITE(cabalbl_sndcmd_w)
155   AM_RANGE(0xe8004, 0xe8005) AM_READ(soundlatch2_word_r)
179156   AM_RANGE(0xe8008, 0xe8009) AM_WRITE(cabalbl_sound_irq_trigger_word_w)
180157ADDRESS_MAP_END
181158
r2956r2957
184161
185162static READ8_HANDLER( cabalbl_snd2_r )
186163{
187   return cabal_sound_command2;
164   return BITSWAP8(cabal_sound_command2, 7,2,4,5,3,6,1,0);
188165}
189166
190167static READ8_HANDLER( cabalbl_snd1_r )
191168{
192   return cabal_sound_command1;
169   return BITSWAP8(cabal_sound_command1, 7,2,4,5,3,6,1,0);
193170}
194171
195172static WRITE8_HANDLER( cabalbl_coin_w )
r2956r2957
200177   //data & 0x40? video enable?
201178}
202179
203static ADDRESS_MAP_START( readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
204   AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_ROM)
205   AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM)
206   AM_RANGE(0x4009, 0x4009) AM_READ(YM2151_status_port_0_r)
207   AM_RANGE(0x4010, 0x4011) AM_READ(seibu_soundlatch_r)
208   AM_RANGE(0x4012, 0x4012) AM_READ(seibu_main_data_pending_r)
209   AM_RANGE(0x4013, 0x4013) AM_READ(input_port_2_r)
210   AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
211ADDRESS_MAP_END
212
213static ADDRESS_MAP_START( writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
214   AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_ROM)
215   AM_RANGE(0x2000, 0x27ff) AM_WRITE(SMH_RAM)
180static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
181   AM_RANGE(0x0000, 0x1fff) AM_ROM
182   AM_RANGE(0x2000, 0x27ff) AM_RAM
216183   AM_RANGE(0x4001, 0x4001) AM_WRITE(seibu_irq_clear_w)
217184   AM_RANGE(0x4002, 0x4002) AM_WRITE(seibu_rst10_ack_w)
218185   AM_RANGE(0x4003, 0x4003) AM_WRITE(seibu_rst18_ack_w)
219186   AM_RANGE(0x4005, 0x4006) AM_WRITE(seibu_adpcm_adr_1_w)
220   AM_RANGE(0x401a, 0x401a) AM_WRITE(seibu_adpcm_ctl_1_w)
221187   AM_RANGE(0x4008, 0x4008) AM_WRITE(YM2151_register_port_0_w)
222   AM_RANGE(0x4009, 0x4009) AM_WRITE(YM2151_data_port_0_w)
188   AM_RANGE(0x4009, 0x4009) AM_READWRITE(YM2151_status_port_0_r, YM2151_data_port_0_w)
189   AM_RANGE(0x4010, 0x4011) AM_READ(seibu_soundlatch_r)
190   AM_RANGE(0x4012, 0x4012) AM_READ(seibu_main_data_pending_r)
191   AM_RANGE(0x4013, 0x4013) AM_READ(input_port_2_r)
223192   AM_RANGE(0x4018, 0x4019) AM_WRITE(seibu_main_data_w)
193   AM_RANGE(0x401a, 0x401a) AM_WRITE(seibu_adpcm_ctl_1_w)
224194   AM_RANGE(0x401b, 0x401b) AM_WRITE(seibu_coin_w)
225195   AM_RANGE(0x6005, 0x6006) AM_WRITE(seibu_adpcm_adr_2_w)
226196   AM_RANGE(0x601a, 0x601a) AM_WRITE(seibu_adpcm_ctl_2_w)
227   AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM)
197   AM_RANGE(0x8000, 0xffff) AM_ROM
228198ADDRESS_MAP_END
229199
230static ADDRESS_MAP_START( cabalbl_readmem_sound, ADDRESS_SPACE_PROGRAM, 8 )
231   AM_RANGE(0x0000, 0x1fff) AM_READ(SMH_ROM)
232   AM_RANGE(0x2000, 0x2fff) AM_READ(SMH_RAM)
233   AM_RANGE(0x4008, 0x4008) AM_READ(cabalbl_snd2_r)
234   AM_RANGE(0x400a, 0x400a) AM_READ(cabalbl_snd1_r)
235   AM_RANGE(0x4006, 0x4006) AM_READ(input_port_3_r)
236   AM_RANGE(0x400f, 0x400f) AM_READ(YM2151_status_port_0_r)
237   AM_RANGE(0x8000, 0xffff) AM_READ(SMH_ROM)
238ADDRESS_MAP_END
239
240static ADDRESS_MAP_START( cabalbl_writemem_sound, ADDRESS_SPACE_PROGRAM, 8 )
241   AM_RANGE(0x0000, 0x1fff) AM_WRITE(SMH_ROM)
242   AM_RANGE(0x2000, 0x2fff) AM_WRITE(SMH_RAM)
200static ADDRESS_MAP_START( cabalbl_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
201   AM_RANGE(0x0000, 0x1fff) AM_ROM
202   AM_RANGE(0x2000, 0x2fff) AM_RAM
243203   AM_RANGE(0x4000, 0x4000) AM_WRITE(soundlatch3_w)
244204   AM_RANGE(0x4002, 0x4002) AM_WRITE(soundlatch4_w)
245205   AM_RANGE(0x4004, 0x4004) AM_WRITE(cabalbl_coin_w)
206   AM_RANGE(0x4006, 0x4006) AM_READ(input_port_3_r)
207   AM_RANGE(0x4008, 0x4008) AM_READ(cabalbl_snd2_r)
208   AM_RANGE(0x400a, 0x400a) AM_READ(cabalbl_snd1_r)
246209   AM_RANGE(0x400c, 0x400c) AM_WRITE(soundlatch2_w)
247210   AM_RANGE(0x400e, 0x400e) AM_WRITE(YM2151_register_port_0_w)
248   AM_RANGE(0x400f, 0x400f) AM_WRITE(YM2151_data_port_0_w)
211   AM_RANGE(0x400f, 0x400f) AM_READWRITE(YM2151_status_port_0_r, YM2151_data_port_0_w)
249212   AM_RANGE(0x6000, 0x6000) AM_WRITE(SMH_NOP)  /* ??? */
250   AM_RANGE(0x8000, 0xffff) AM_WRITE(SMH_ROM)
213   AM_RANGE(0x8000, 0xffff) AM_ROM
251214ADDRESS_MAP_END
252215
253216/* the bootleg has 2x z80 sample players */
r2956r2957
539502
540503   /* basic machine hardware */
541504   MDRV_CPU_ADD(M68000, XTAL_20MHz/2) /* verified on pcb */
542   MDRV_CPU_PROGRAM_MAP(readmem_cpu,writemem_cpu)
505   MDRV_CPU_PROGRAM_MAP(main_map,0)
543506   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
544507
545508   MDRV_CPU_ADD(Z80, XTAL_3_579545MHz) /* verified on pcb */
546509   /* audio CPU */
547   MDRV_CPU_PROGRAM_MAP(readmem_sound,writemem_sound)
510   MDRV_CPU_PROGRAM_MAP(sound_map,0)
548511
549512   MDRV_MACHINE_RESET(seibu_sound_1)
550513
r2956r2957
584547
585548   /* basic machine hardware */
586549   MDRV_CPU_ADD(M68000, XTAL_20MHz/2) /* verified on pcb */
587   MDRV_CPU_PROGRAM_MAP(cabalbl_readmem_cpu,cabalbl_writemem_cpu)
550   MDRV_CPU_PROGRAM_MAP(cabalbl_main_map,0)
588551   MDRV_CPU_VBLANK_INT("main", irq1_line_hold)
589552
590553   MDRV_CPU_ADD(Z80, XTAL_3_579545MHz) /* verified on pcb */
591   MDRV_CPU_PROGRAM_MAP(cabalbl_readmem_sound,cabalbl_writemem_sound)
554   MDRV_CPU_PROGRAM_MAP(cabalbl_sound_map,0)
592555
593556   /* there are 2x z80s for the ADPCM */
594557   MDRV_CPU_ADD(Z80, XTAL_3_579545MHz) /* verified on pcb */
src/mame/drivers/tickee.c
r2956r2957
4343{
4444   const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen);
4545
46   *x = (((input_port_read_indexed(machine, 4 + player * 2) & 0xff) * (visarea->max_x - visarea->min_x)) >> 8) + visarea->min_x;
47   *y = (((input_port_read_indexed(machine, 5 + player * 2) & 0xff) * (visarea->max_y - visarea->min_y)) >> 8) + visarea->min_y;
46   *x = (((input_port_read(machine, player ? "GUNX2" : "GUNX1") & 0xff) * (visarea->max_x - visarea->min_x)) >> 8) + visarea->min_x;
47   *y = (((input_port_read(machine, player ? "GUNY2" : "GUNY1") & 0xff) * (visarea->max_y - visarea->min_y)) >> 8) + visarea->min_y;
4848}
4949
5050
r2956r2957
161161
162162static READ8_HANDLER( port1_r )
163163{
164   return input_port_read_indexed(machine,1) | (ticket_dispenser_0_r(machine, 0) >> 5) | (ticket_dispenser_1_r(machine, 0) >> 6);
164   return input_port_read(machine, "IN0") | (ticket_dispenser_0_r(machine, 0) >> 5) | (ticket_dispenser_1_r(machine, 0) >> 6);
165165}
166166
167167static READ8_HANDLER( port2_r )
168168{
169   return input_port_read_indexed(machine,3) | (ticket_dispenser_0_r(machine, 0) >> 5) | (ticket_dispenser_1_r(machine, 0) >> 6);
169   return input_port_read(machine, "IN2") | (ticket_dispenser_0_r(machine, 0) >> 5) | (ticket_dispenser_1_r(machine, 0) >> 6);
170170}
171171
172172
r2956r2957
218218   AM_RANGE(0x04200100, 0x0420010f) AM_READWRITE(AY8910_read_port_1_lsb_r, AY8910_control_port_1_lsb_w)
219219   AM_RANGE(0x04200110, 0x0420011f) AM_WRITE(AY8910_write_port_1_lsb_w)
220220   AM_RANGE(0x04400000, 0x0440007f) AM_WRITE(tickee_control_w) AM_BASE(&tickee_control)
221   AM_RANGE(0x04400040, 0x0440004f) AM_READ(input_port_3_word_r)
221   AM_RANGE(0x04400040, 0x0440004f) AM_READ_PORT("IN2")
222222   AM_RANGE(0xc0000000, 0xc00001ff) AM_READWRITE(tms34010_io_register_r, tms34010_io_register_w)
223223   AM_RANGE(0xc0000240, 0xc000025f) AM_WRITENOP      /* seems to be a bug in their code */
224224   AM_RANGE(0xff000000, 0xffffffff) AM_ROM AM_REGION(REGION_USER1, 0)
r2956r2957
250250 *************************************/
251251
252252static INPUT_PORTS_START( tickee )
253   PORT_START
253   PORT_START_TAG("DSW")
254254   PORT_DIPNAME( 0x03, 0x01, "Game Time/Diff" )
255255   PORT_DIPSETTING(    0x03, "Very Fast/Very Easy" )
256256   PORT_DIPSETTING(    0x02, "Fast/Easy" )
r2956r2957
273273   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ))
274274   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ))
275275
276   PORT_START
276   PORT_START_TAG("IN0")
277277   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
278278   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* right ticket status */
279279   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* left ticket status */
280280   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
281281
282   PORT_START
282   PORT_START_TAG("IN1")
283283   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
284284   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
285285   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
r2956r2957
288288   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
289289   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
290290
291   PORT_START
291   PORT_START_TAG("IN2")
292292   PORT_SERVICE( 0x0001, IP_ACTIVE_LOW )
293293   PORT_BIT( 0xfffe, IP_ACTIVE_LOW, IPT_UNUSED )
294294
295   PORT_START            /* fake analog X */
295   PORT_START_TAG("GUNX1")         /* fake analog X */
296296   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
297297
298   PORT_START            /* fake analog Y */
298   PORT_START_TAG("GUNY1")         /* fake analog Y */
299299   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
300300
301   PORT_START            /* fake analog X */
301   PORT_START_TAG("GUNX2")         /* fake analog X */
302302   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2)
303303
304   PORT_START            /* fake analog Y */
304   PORT_START_TAG("GUNY2")         /* fake analog Y */
305305   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) PORT_PLAYER(2)
306306INPUT_PORTS_END
307307
308308static INPUT_PORTS_START( ghoshunt )
309   PORT_START
309   PORT_START_TAG("DSW")
310310   PORT_DIPNAME( 0x01, 0x01, "Messages in Play")
311311   PORT_DIPSETTING(    0x01, DEF_STR( Off ))
312312   PORT_DIPSETTING(    0x00, DEF_STR( On ))
r2956r2957
330330   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ))
331331   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ))
332332
333   PORT_START
333   PORT_START_TAG("IN0")
334334   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
335335   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* right ticket status */
336336   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* left ticket status */
337337   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
338338   PORT_BIT( 0xd8, IP_ACTIVE_LOW, IPT_UNUSED )
339339
340   PORT_START
340   PORT_START_TAG("IN1")
341341   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
342342   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
343343   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
r2956r2957
346346   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
347347   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
348348
349   PORT_START
349   PORT_START_TAG("IN2")
350350   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
351351   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* right ticket status */
352352   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL )   /* left ticket status */
353353   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
354354   PORT_BIT( 0xd8, IP_ACTIVE_LOW, IPT_UNUSED )
355355
356   PORT_START            /* fake analog X */
356   PORT_START_TAG("GUNX1")         /* fake analog X */
357357   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10)
358358
359   PORT_START            /* fake analog Y */
359   PORT_START_TAG("GUNY1")         /* fake analog Y */
360360   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10)
361361
362   PORT_START            /* fake analog X */
362   PORT_START_TAG("GUNX2")         /* fake analog X */
363363   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_PLAYER(2)
364364
365   PORT_START            /* fake analog Y */
365   PORT_START_TAG("GUNY2")         /* fake analog Y */
366366   PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(70) PORT_KEYDELTA(10) PORT_PLAYER(2)
367367INPUT_PORTS_END
368368
src/mame/drivers/srmp5.c
r2956r2957
2828
2929*/
3030
31
3132#include "driver.h"
3233#include "deprecat.h"
3334#include "cpu/mips/r3000.h"
r2956r2957
216217ADDRESS_MAP_END
217218
218219
219static const struct r3000_config config =
220{
221   1,   /* 1 if we have an FPU, 0 otherwise */
222   4096,   /* code cache size */
223   4096   /* data cache size */
224};
225
226220static INPUT_PORTS_START( srmp5 )
227221   PORT_START
228222   PORT_DIPNAME( 0x0001, 0x0001, "0-0" )
r2956r2957
623617   &st0016_charram
624618};
625619
620 static INTERRUPT_GEN( irq4_gen )
621{
622   cpunum_set_input_line(machine, 1, R3000_IRQ4, ASSERT_LINE);
623}
624
625static const struct r3000_config config =
626{
627   1,   /* 1 if we have an FPU, 0 otherwise */
628   4096,   /* code cache size */
629   4096   /* data cache size */
630};
631
626632static MACHINE_DRIVER_START( srmp5 )
633   /* basic machine hardware */
627634   MDRV_CPU_ADD_TAG("main",Z80,8000000)
628635   MDRV_CPU_PROGRAM_MAP(st0016_mem,0)
629636   MDRV_CPU_IO_MAP(st0016_io,0)
630637   MDRV_CPU_VBLANK_INT("main", irq0_line_hold)
631638
632   MDRV_CPU_ADD(R3000LE, 40000000)
639   MDRV_CPU_ADD(R3000LE, 25000000)
633640   MDRV_CPU_CONFIG(config)
634   MDRV_CPU_VBLANK_INT_HACK(irq4_line_hold,2)
635641   MDRV_CPU_PROGRAM_MAP(srmp5_mem,0)
642   MDRV_CPU_VBLANK_INT("main", irq4_gen)
636643
644   MDRV_INTERLEAVE(100)
637645
646   /* video hardware */
638647   MDRV_SCREEN_ADD("main", RASTER)
639648   MDRV_SCREEN_REFRESH_RATE(60)
640649   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
641650   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
642   MDRV_SCREEN_SIZE(64*8, 64*8)
643   MDRV_SCREEN_VISIBLE_AREA(0*8, 350, 30, 280)
651   MDRV_SCREEN_SIZE(512, 512)
652   MDRV_SCREEN_VISIBLE_AREA(4, 339, 32, 271)
644653
645654   MDRV_PALETTE_LENGTH(16*16*4+1)
646655
r2956r2957
658667ROM_START( srmp5 )
659668   ROM_REGION( 0x410000, REGION_CPU1, 0 )
660669   ROM_LOAD( "sx008-08.bin",   0x010000, 0x200000,   CRC(d4ac54f4) SHA1(c3dc76cd71485796a0b6a960294ea96eae8c946e) )
661   ROM_LOAD( "sx008-09.bin",   0x200000, 0x200000,   CRC(5a3e6560) SHA1(92ea398f3c5e3035869f0ca5dfe7b05c90095318) )
670   ROM_LOAD( "sx008-09.bin",   0x210000, 0x200000,   CRC(5a3e6560) SHA1(92ea398f3c5e3035869f0ca5dfe7b05c90095318) )
662671   ROM_COPY( REGION_CPU1,  0x10000, 0x00000, 0x08000 )
663672
664673   ROM_REGION32_BE( 0x200000, REGION_USER1, 0 )
r2956r2957
667676   ROM_LOAD32_BYTE( "sx008-12.bin",   0x00002, 0x80000,   CRC(43e9bb98) SHA1(e46dd98d2e1babfa12ddf2fa9b31377e8691d3a1) )
668677   ROM_LOAD32_BYTE( "sx008-11.bin",   0x00003, 0x80000,   CRC(ca15ff45) SHA1(5ee610e0bb835568c36898210a6f8394902d5b54) )
669678
670   ROM_REGION( 0x200000*8, REGION_USER2,0) /* gfx ? */
679   ROM_REGION( 0xf00000, REGION_USER2,0) /* gfx ? */
671680   ROM_LOAD( "sx008-01.bin",   0x000000, 0x200000,   CRC(82dabf48) SHA1(c53e9ed0056c431eab13ab362936c25d3cc5abba) )
672681   ROM_LOAD( "sx008-02.bin",   0x200000, 0x200000,   CRC(cfd2be0f) SHA1(a21f2928e08047c97443123aceba7ff4e95c6d3d) )
673682   ROM_LOAD( "sx008-03.bin",   0x400000, 0x200000,   CRC(d7323b10) SHA1(94ecc17b6b8b071cf2c61bbef4aec2c6c7693c62) )
src/mame/drivers/segas16b.c
r2956r2957
11351135   switch (offset & (0x3000/2))
11361136   {
11371137      case 0x1000/2:
1138         return input_port_read_indexed(machine, offset & 3);
1138      {
1139         static const char *const sysports[] = { "SERVICE", "P1", "UNUSED", "P2" };
1140         return input_port_read(machine, sysports[offset & 3]);
1141      }
11391142
11401143      case 0x2000/2:
1141         return input_port_read_indexed(machine, 4 + (offset & 1));
1144         return input_port_read(machine, (offset & 1) ? "DSW2" : "DSW1");
11421145   }
11431146   logerror("%06X:standard_io_r - unknown read access to address %04X\n", activecpu_get_pc(), offset * 2);
11441147   return segaic16_open_bus_r(machine,0,mem_mask);
r2956r2957
13941397   }
13951398
13961399   /* read inputs */
1397   workram[inputoffs] = ~input_port_read_indexed(machine, 0) << 8;
1400   workram[inputoffs] = ~input_port_read(machine, "SERVICE") << 8;
13981401}
13991402
14001403static void altbeasj_i8751_sim(running_machine *machine)
r2956r2957
14731476   }
14741477
14751478   /* read inputs */
1476   workram[0x2cd0/2] = (input_port_read_indexed(machine, 1) << 8) | input_port_read_indexed(machine, 3);
1477   workram[0x2c96/2] = input_port_read_indexed(machine, 0) << 8;
1479   workram[0x2cd0/2] = (input_port_read(machine, "P1") << 8) | input_port_read(machine, "P2");
1480   workram[0x2c96/2] = input_port_read(machine, "SERVICE") << 8;
14781481}
14791482
14801483
r2956r2957
14941497   }
14951498
14961499   /* read inputs */
1497   workram[0x01e6/2] = input_port_read_indexed(machine, 0) << 8;
1498   workram[0x01e8/2] = input_port_read_indexed(machine, 1) << 8;
1499   workram[0x01ea/2] = input_port_read_indexed(machine, 3) << 8;
1500   workram[0x01e6/2] = input_port_read(machine, "SERVICE") << 8;
1501   workram[0x01e8/2] = input_port_read(machine, "P1") << 8;
1502   workram[0x01ea/2] = input_port_read(machine, "P2") << 8;
15001503}
15011504
15021505
r2956r2957
15331536   }
15341537
15351538   /* read inputs */
1536   workram[0x2082/2] = input_port_read_indexed(machine, 0);
1539   workram[0x2082/2] = input_port_read(machine, "SERVICE");
15371540}
15381541
15391542
r2956r2957
30563059INPUT_PORTS_END
30573060
30583061
3062/* we use common sys16b tags to simplify port reads */
30593063static INPUT_PORTS_START( atomicp )
3060   PORT_START_TAG("IN0")
3064   PORT_START_TAG("SERVICE")   /* P1 */
30613065   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
30623066   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
30633067   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2956r2957
30673071   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
30683072   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
30693073
3070   PORT_START_TAG("IN1")
3074   PORT_START_TAG("P1")   /* P2 */
30713075   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
30723076   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
30733077   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
30773081   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
30783082   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
30793083
3080   PORT_START_TAG("DSW1")
3084   PORT_START_TAG("UNUSED")   /* DSW1 */
30813085   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:1,2,3")
30823086   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
30833087   PORT_DIPSETTING(    0x04, DEF_STR( 3C_1C ) )
r2956r2957
31023106   PORT_DIPSETTING(    0x40, "3" )
31033107   PORT_DIPSETTING(    0x00, "5" )
31043108
3105   PORT_START_TAG("DSW2")
3109   PORT_START_TAG("P2")   /* DSW2 */
31063110   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2")
31073111   PORT_DIPSETTING(    0x01, DEF_STR( Easy ) )
31083112   PORT_DIPSETTING(    0x03, DEF_STR( Normal ) )
r2956r2957
31253129   PORT_DIPSETTING(    0x00, "Atomic Point" )
31263130   PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_HIGH, "SW2:8" )
31273131
3128   PORT_START_TAG("DUMMY1")
3132   PORT_START_TAG("DSW2")   /* DUMMY */
31293133
3130   PORT_START_TAG("DUMMY2")
3134   PORT_START_TAG("DSW1")   /* DUMMY */
31313135INPUT_PORTS_END
31323136
31333137
3138/* we use common sys16b tags to simplify port reads */
31343139static INPUT_PORTS_START( snapper )
3135   PORT_START_TAG("IN0")
3140   PORT_START_TAG("SERVICE")   /* P1 */
31363141   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
31373142   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
31383143   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2956r2957
31423147   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
31433148   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
31443149
3145   PORT_START_TAG("IN1")
3150   PORT_START_TAG("P1")   /* SYSTEM */
31463151   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
31473152   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 )
31483153   PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
31493154
3150   PORT_START_TAG("DSW0")
3155   PORT_START_TAG("UNUSED")   /* DSW0 */
31513156   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW0:1,2,3")
31523157   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
31533158   PORT_DIPSETTING(    0x04, DEF_STR( 3C_1C ) )
r2956r2957
31723177   PORT_DIPSETTING(    0x40, "3" )
31733178   PORT_DIPSETTING(    0x00, "5" )
31743179
3175   PORT_START_TAG("DSW1")
3180   PORT_START_TAG("P2")   /* DSW1 */
31763181   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:1")
31773182   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
31783183   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
31963201   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
31973202   PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW1:8" )
31983203
3199   PORT_START_TAG("DUMMY1")
3204   PORT_START_TAG("DSW2")   /* DUMMY */
32003205
3201   PORT_START_TAG("DUMMY2")
3206   PORT_START_TAG("DSW1")   /* DUMMY */
32023207INPUT_PORTS_END
32033208
32043209
src/mame/drivers/sderby.c
r2956r2957
9393   switch (offset)
9494   {
9595      case 0x00 >> 1:
96         return input_port_read_indexed(machine, 0);
96         return input_port_read(machine, "IN0");
9797      case 0x02 >> 1:
9898         return 0xffff;         // to avoid game to reset (needs more work)
9999   }
r2956r2957
108108   switch (offset)
109109   {
110110   case 0x00 >>1:
111      return input_port_read_indexed(machine, 0);
111      return input_port_read(machine, "IN0");
112112   case 0x02 >>1:
113      return input_port_read_indexed(machine, 1);
113      return input_port_read(machine, "IN1");
114114   case 0x04 >>1:
115      return input_port_read_indexed(machine, 2);
115      return input_port_read(machine, "IN2");
116116   }
117117   return 0xffff;
118118
r2956r2957
165165
166166
167167static INPUT_PORTS_START( sderby )
168   PORT_START   /* 0x308000.w */
168   PORT_START_TAG("IN0")   /* 0x308000.w */
169169   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
170170   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  ) PORT_4WAY
171171   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_4WAY
r2956r2957
185185INPUT_PORTS_END
186186
187187static INPUT_PORTS_START( pmroulet )
188   PORT_START
188   PORT_START_TAG("IN0")
189189   PORT_BIT( 0x000f, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ?
190190   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_VBLANK ) // it must be toggled to boot anyway
191191   PORT_SERVICE_NO_TOGGLE(0x0020, IP_ACTIVE_LOW) // seems to be ..
r2956r2957
193193   PORT_BIT( 0x0f00, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ?
194194   PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ?
195195
196   PORT_START
196   PORT_START_TAG("IN1")
197197   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
198198   PORT_BIT( 0x000e, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ?
199199   PORT_BIT( 0x00f0, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ?
200200   PORT_BIT( 0x0f00, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ?
201201   PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // ?
202202
203   PORT_START
203   PORT_START_TAG("IN2")
204204   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
205205   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
206206   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
src/mame/drivers/taito_f3.c
r2956r2957
5656   switch (offset)
5757   {
5858      case 0x0: /* MSW: Test switch, coins, eeprom access, LSW: Player Buttons, Start, Tilt, Service */
59         e=eeprom_read_bit();
60         e=e|(e<<8);
61         return ((e | input_port_read_indexed(machine, 2) | (input_port_read_indexed(machine, 2)<<8))<<16) /* top byte may be mirror of bottom byte??  see bubblem */
62               | input_port_read_indexed(machine, 1);
59         e = eeprom_read_bit();
60         e = e | (e<<8);
61         return ((e | input_port_read(machine, "EEPROM") | (input_port_read(machine, "EEPROM")<<8))<<16)      /* top byte may be mirror of bottom byte??  see bubblem */
62               | input_port_read(machine, "IN1");
6363
6464      case 0x1: /* MSW: Coin counters/lockouts are readable, LSW: Joysticks (Player 1 & 2) */
65         return (coin_word[0]<<16) | input_port_read_indexed(machine, 0) | 0xff00;
65         return (coin_word[0]<<16) | input_port_read(machine, "IN0") | 0xff00;
6666
6767      case 0x2: /* Analog control 1 */
68         return ((input_port_read_indexed(machine, 3)&0xf)<<12) | ((input_port_read_indexed(machine, 3)&0xff0)>>4);
68         return ((input_port_read(machine, "DIAL1") & 0xf)<<12) | ((input_port_read(machine, "DIAL1") & 0xff0)>>4);
6969
7070      case 0x3: /* Analog control 2 */
71         return ((input_port_read_indexed(machine, 4)&0xf)<<12) | ((input_port_read_indexed(machine, 4)&0xff0)>>4);
71         return ((input_port_read(machine, "DIAL2") & 0xf)<<12) | ((input_port_read(machine, "DIAL2") & 0xff0)>>4);
7272
7373      case 0x4: /* Player 3 & 4 fire buttons (Player 2 top fire buttons in Kaiser Knuckle) */
74         return input_port_read_indexed(machine, 5)<<8;
74         return input_port_read(machine, "IN2")<<8;
7575
7676      case 0x5: /* Player 3 & 4 joysticks (Player 1 top fire buttons in Kaiser Knuckle) */
77         return (coin_word[1]<<16) | input_port_read_indexed(machine, 6);
77         return (coin_word[1]<<16) | input_port_read(machine, "IN3");
7878   }
7979
80   logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n",activecpu_get_pc(),offset);
80   logerror("CPU #0 PC %06x: warning - read unmapped control address %06x\n", activecpu_get_pc(), offset);
8181   return 0xffffffff;
8282}
8383
r2956r2957
8888      case 0x00: /* Watchdog */
8989         watchdog_reset(machine);
9090         return;
91
9192      case 0x01: /* Coin counters & lockouts */
92         if (ACCESSING_BITS_24_31) {
93         if (ACCESSING_BITS_24_31)
94         {
9395            coin_lockout_w(0,~data & 0x01000000);
9496            coin_lockout_w(1,~data & 0x02000000);
9597            coin_counter_w(0, data & 0x04000000);
r2956r2957
9799            coin_word[0]=(data>>16)&0xffff;
98100         }
99101         return;
102
100103      case 0x04: /* Eeprom */
101         if (ACCESSING_BITS_0_7) {
104         if (ACCESSING_BITS_0_7)
105         {
102106            eeprom_set_clock_line((data & 0x08) ? ASSERT_LINE : CLEAR_LINE);
103107            eeprom_write_bit(data & 0x04);
104108            eeprom_set_cs_line((data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
105109         }
106110         return;
111
107112      case 0x05:   /* Player 3 & 4 coin counters */
108         if (ACCESSING_BITS_24_31) {
113         if (ACCESSING_BITS_24_31)
114         {
109115            coin_lockout_w(2,~data & 0x01000000);
110116            coin_lockout_w(3,~data & 0x02000000);
111117            coin_counter_w(2, data & 0x04000000);
r2956r2957
189195/******************************************************************************/
190196
191197static INPUT_PORTS_START( f3 )
192   PORT_START
198   PORT_START_TAG("IN0")
193199   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
194200   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
195201   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2956r2957
199205   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
200206   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
201207
202   PORT_START
208   PORT_START_TAG("IN1")
203209   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
204210   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
205211   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
r2956r2957
217223   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START3 )
218224   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START4 )
219225
220   PORT_START
226   PORT_START_TAG("EEPROM")
221227   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* Eprom data bit */
222228   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
223229   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
227233   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 )
228234   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN4 )
229235
230   PORT_START
236   PORT_START_TAG("DIAL1")
231237   PORT_BIT( 0xfff, 0x000, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_PLAYER(1)
232238
233   PORT_START
239   PORT_START_TAG("DIAL2")
234240   PORT_BIT( 0xfff, 0x000, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) PORT_PLAYER(2)
235241
236   PORT_START
242   PORT_START_TAG("IN2")
237243   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
238244   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(3)
239245   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
r2956r2957
243249   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(4)
244250   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(4)
245251
246   PORT_START
252   PORT_START_TAG("IN3")
247253   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
248254   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(3)
249255   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
r2956r2957
255261INPUT_PORTS_END
256262
257263static INPUT_PORTS_START( kn )
258   PORT_START
259   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
260   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
261   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
262   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
263   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
264   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
265   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
266   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
264   PORT_INCLUDE( f3 )
267265
268   PORT_START
269   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
270   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
271   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
272   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
273   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
274   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
275   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
276   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
277   PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_TILT )
278   PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_SERVICE1 ) /* Service */
279   PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_SERVICE2 ) /* Only on some games */
280   PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_SERVICE3 )
281   PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_START1 )
282   PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_START2 )
283   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_START3 )
284   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START4 )
266   PORT_MODIFY("IN2")
267     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
268     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
269     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
270     PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
285271
286   PORT_START
287   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) /* Eprom data bit */
288   PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW )
289   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
290   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) /* Another service mode */
291   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
292   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
293   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN3 )
294   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN4 )
295
296   PORT_START
297   PORT_BIT( 0xfff, 0x000, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_CODE_DEC(KEYCODE_Z) PORT_CODE_INC(KEYCODE_X) PORT_PLAYER(1)
298
299   PORT_START
300   PORT_BIT( 0xfff, 0x000, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_CODE_DEC(KEYCODE_N) PORT_CODE_INC(KEYCODE_M) PORT_PLAYER(2)
301
302   PORT_START
303   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
304   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(2)
305   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(2)
306   PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
307
308   PORT_START
272   PORT_MODIFY("IN3")
309273   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
310274   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_PLAYER(1)
311275   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
r2956r2957
348312{
349313   16,16,
350314   RGN_FRAC(1,2),
351   6,
315   6,   /* Palettes have 4 bpp indexes despite up to 6 bpp data */
352316   { RGN_FRAC(1,2)+0, RGN_FRAC(1,2)+1, 0, 1, 2, 3 },
353317   {
354318   4, 0, 12, 8,
r2956r2957
364328{
365329   16,16,
366330   RGN_FRAC(1,2),
367   6,
331   6,   /* Palettes have 4 bpp indexes despite up to 6 bpp data */
368332   { RGN_FRAC(1,2)+2, RGN_FRAC(1,2)+3, 0, 1, 2, 3 },
369333   {
370334   4, 0, 16+4, 16+0,
r2956r2957
378342};
379343
380344static GFXDECODE_START( taito_f3 )
381   GFXDECODE_ENTRY( 0,           0x000000, charlayout,          0,  64 ) /* Dynamically modified */
382   GFXDECODE_ENTRY( REGION_GFX2, 0x000000, tile_layout,           0, 512 ) /* Tiles area */
383   GFXDECODE_ENTRY( REGION_GFX1, 0x000000, spriteram_layout, 4096, 256 ) /* Sprites area */
384   GFXDECODE_ENTRY( 0,           0x000000, pivotlayout,         0,  64 ) /* Dynamically modified */
345   GFXDECODE_ENTRY( 0,           0x000000, charlayout,       0x0000,  0x400>>4 ) /* Dynamically modified */
346   GFXDECODE_ENTRY( REGION_GFX2, 0x000000, tile_layout,        0x0000, 0x2000>>4 ) /* Tiles area */
347   GFXDECODE_ENTRY( REGION_GFX1, 0x000000, spriteram_layout, 0x1000, 0x1000>>4 ) /* Sprites area */
348   GFXDECODE_ENTRY( 0,           0x000000, pivotlayout,      0x0000,  0x400>>4 ) /* Dynamically modified */
385349GFXDECODE_END
386350
387351/******************************************************************************/
r2956r2957
462426   MDRV_SCREEN_VISIBLE_AREA(46, 40*8-1 + 46, 24, 24+232-1)
463427
464428   MDRV_GFXDECODE(taito_f3)
465   MDRV_PALETTE_LENGTH(8192)
429   MDRV_PALETTE_LENGTH(0x2000)
466430
467431   MDRV_VIDEO_START(f3)
468432   MDRV_VIDEO_EOF(f3)
r2956r2957
32513215
32523216/******************************************************************************/
32533217
3254static void tile_decode(running_machine *machine, int uses_5bpp_tiles)
3218static void tile_decode(running_machine *machine)
32553219{
32563220   UINT8 lsb,msb;
32573221   UINT32 offset,i;
32583222   UINT8 *gfx = memory_region(machine, REGION_GFX2);
32593223   int size=memory_region_length(machine, REGION_GFX2);
3260   int half=size/2,data;
3224   int data;
32613225
32623226   /* Setup ROM formats:
32633227
r2956r2957
32663230        are tied low on the game board if unused.  This is backed up by the fact the palette
32673231        indices are always related to 4 bpp data, even in 6 bpp games.
32683232
3233        Most (all?) games with 5bpp tiles have the sixth bit set. Also, in Arabian Magic
3234        sprites 1200-120f contain 6bpp data which is probably bogus.
3235        VIDEO_START( f3 ) clears the fifth and sixth bit of the decoded graphics according
3236        to the bit depth specified in f3_config_table.
3237
32693238    */
3270   if (uses_5bpp_tiles)
3271      for (i=half; i<size; i+=2)
3272         gfx[i+1]=0;
32733239
32743240   offset = size/2;
32753241   for (i = size/2+size/4; i<size; i+=2)
r2956r2957
33683334static DRIVER_INIT( ringrage )
33693335{
33703336   f3_game=RINGRAGE;
3371   tile_decode(machine, 0);
3337   tile_decode(machine);
33723338}
33733339
33743340static DRIVER_INIT( arabianm )
33753341{
33763342   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x408124, 0x408127, 0, 0, irq_speedup_r_arabianm );
33773343   f3_game=ARABIANM;
3378   tile_decode(machine, 1);
3344   tile_decode(machine);
33793345}
33803346
33813347static DRIVER_INIT( ridingf )
33823348{
33833349   f3_game=RIDINGF;
3384   tile_decode(machine, 1);
3350   tile_decode(machine);
33853351}
33863352
33873353static DRIVER_INIT( gseeker )
33883354{
33893355   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x40ad94, 0x40ad97, 0, 0, irq_speedup_r_gseeker );
33903356   f3_game=GSEEKER;
3391   tile_decode(machine, 0);
3357   tile_decode(machine);
33923358}
33933359
33943360static DRIVER_INIT( gunlock )
33953361{
33963362   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400004, 0x400007, 0, 0, irq_speedup_r_gunlock );
33973363   f3_game=GUNLOCK;
3398   tile_decode(machine, 1);
3364   tile_decode(machine);
33993365}
34003366
34013367static DRIVER_INIT( elvactr )
34023368{
34033369   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4007a0, 0x4007a3, 0, 0, irq_speedup_r_eaction2 );
34043370   f3_game=EACTION2;
3405   tile_decode(machine, 1);
3371   tile_decode(machine);
34063372}
34073373
34083374static DRIVER_INIT( cupfinal )
34093375{
34103376   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x408114, 0x408117, 0, 0, irq_speedup_r_cupfinal );
34113377   f3_game=SCFINALS;
3412   tile_decode(machine, 1);
3378   tile_decode(machine);
34133379}
34143380
34153381static DRIVER_INIT( trstaroj )
34163382{
34173383   f3_game=TRSTAR;
3418   tile_decode(machine, 1);
3384   tile_decode(machine);
34193385}
34203386
34213387static DRIVER_INIT( scfinals )
r2956r2957
34303396
34313397   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x408114, 0x408117, 0, 0, irq_speedup_r_scfinals );
34323398   f3_game=SCFINALS;
3433   tile_decode(machine, 1);
3399   tile_decode(machine);
34343400}
34353401
34363402static DRIVER_INIT( lightbr )
34373403{
34383404   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400130, 0x400133, 0, 0, irq_speedup_r_lightbr );
34393405   f3_game=LIGHTBR;
3440   tile_decode(machine, 1);
3406   tile_decode(machine);
34413407}
34423408
34433409static DRIVER_INIT( kaiserkn )
34443410{
34453411   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x408110, 0x408113, 0, 0, irq_speedup_r_kaiserkn );
34463412   f3_game=KAISERKN;
3447   tile_decode(machine, 1);
3413   tile_decode(machine);
34483414}
34493415
34503416static DRIVER_INIT( dariusg )
34513417{
34523418   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x406ba8, 0x406bab, 0, 0, irq_speedup_r_dariusg );
34533419   f3_game=DARIUSG;
3454   tile_decode(machine, 0);
3420   tile_decode(machine);
34553421}
34563422
34573423static DRIVER_INIT( spcinvdj )
34583424{
34593425   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400230, 0x400233, 0, 0, irq_speedup_r_spcinvdj );
34603426   f3_game=SPCINVDX;
3461   tile_decode(machine, 0);
3427   tile_decode(machine);
34623428}
34633429
34643430static DRIVER_INIT( qtheater )
34653431{
34663432   f3_game=QTHEATER;
3467   tile_decode(machine, 0);
3433   tile_decode(machine);
34683434}
34693435
34703436static DRIVER_INIT( spcinv95 )
34713437{
34723438   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x408114, 0x408117, 0, 0, irq_speedup_r_spcinv95 );
34733439   f3_game=SPCINV95;
3474   tile_decode(machine, 1);
3440   tile_decode(machine);
34753441}
34763442
34773443static DRIVER_INIT( gekirido )
34783444{
34793445   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x406bb0, 0x406bb3, 0, 0, irq_speedup_r_gekirido );
34803446   f3_game=GEKIRIDO;
3481   tile_decode(machine, 1);
3447   tile_decode(machine);
34823448}
34833449
34843450static DRIVER_INIT( ktiger2 )
34853451{
34863452   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400570, 0x400573, 0, 0, irq_speedup_r_ktiger2 );
34873453   f3_game=KTIGER2;
3488   tile_decode(machine, 0);
3454   tile_decode(machine);
34893455}
34903456
34913457static DRIVER_INIT( bubsymph )
34923458{
34933459   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400134, 0x400137, 0, 0, irq_speedup_r_bubsymph );
34943460   f3_game=BUBSYMPH;
3495   tile_decode(machine, 1);
3461   tile_decode(machine);
34963462}
34973463
34983464
r2956r2957
35233489{
35243490   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400134, 0x400137, 0, 0, irq_speedup_r_bubsymph );
35253491   f3_game=BUBSYMPH;
3526   //tile_decode(machine, 1);
3492   //tile_decode(machine);
35273493
35283494   /* expand gfx rom */
35293495   {
r2956r2957
35533519{
35543520   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400134, 0x400137, 0, 0, irq_speedup_r_bubblem );
35553521   f3_game=BUBBLEM;
3556   tile_decode(machine, 1);
3522   tile_decode(machine);
35573523}
35583524
35593525static DRIVER_INIT( cleopatr )
35603526{
35613527   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x408114, 0x408117, 0, 0, irq_speedup_r_cleopatr );
35623528   f3_game=CLEOPATR;
3563   tile_decode(machine, 0);
3529   tile_decode(machine);
35643530}
35653531
35663532static DRIVER_INIT( popnpop )
35673533{
35683534   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x401cf8, 0x401cfb, 0, 0, irq_speedup_r_popnpop );
35693535   f3_game=POPNPOP;
3570   tile_decode(machine, 0);
3536   tile_decode(machine);
35713537}
35723538
35733539static DRIVER_INIT( landmakr )
35743540{
35753541   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400824, 0x400827, 0, 0, irq_speedup_r_landmakr );
35763542   f3_game=LANDMAKR;
3577   tile_decode(machine, 0);
3543   tile_decode(machine);
35783544}
35793545
35803546static DRIVER_INIT( landmkrp )
r2956r2957
35903556
35913557   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400824, 0x400827, 0, 0, irq_speedup_r_landmakr );
35923558   f3_game=LANDMAKR;
3593   tile_decode(machine, 0);
3559   tile_decode(machine);
35943560}
35953561
35963562static DRIVER_INIT( pbobble3 )
35973563{
35983564   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x405af4, 0x405af7, 0, 0, irq_speedup_r_pbobble3 );
35993565   f3_game=PBOBBLE3;
3600   tile_decode(machine, 0);
3566   tile_decode(machine);
36013567}
36023568
36033569static DRIVER_INIT( pbobble4 )
36043570{
36053571   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4058f4, 0x4058f7, 0, 0, irq_speedup_r_pbobble4 );
36063572   f3_game=PBOBBLE4;
3607   tile_decode(machine, 0);
3573   tile_decode(machine);
36083574}
36093575
36103576static DRIVER_INIT( quizhuhu )
36113577{
36123578   f3_game=QUIZHUHU;
3613   tile_decode(machine, 0);
3579   tile_decode(machine);
36143580}
36153581
36163582static DRIVER_INIT( pbobble2 )
36173583{
36183584   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x404a50, 0x404a53, 0, 0, irq_speedup_r_pbobble2 );
36193585   f3_game=PBOBBLE2;
3620   tile_decode(machine, 0);
3586   tile_decode(machine);
36213587}
36223588
36233589static DRIVER_INIT( pbobbl2x )
36243590{
36253591   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x405c58, 0x405c5b, 0, 0, irq_speedup_r_pbobbl2x );
36263592   f3_game=PBOBBLE2;
3627   tile_decode(machine, 0);
3593   tile_decode(machine);
36283594}
36293595
36303596static DRIVER_INIT( hthero95 )
36313597{
36323598   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x408114, 0x408117, 0, 0, irq_speedup_r_pwrgoal );
36333599   f3_game=HTHERO95;
3634   tile_decode(machine, 0);
3600   tile_decode(machine);
36353601}
36363602
36373603static DRIVER_INIT( kirameki )
36383604{
36393605   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400414, 0x400417, 0, 0, irq_speedup_r_kirameki );
36403606   f3_game=KIRAMEKI;
3641   tile_decode(machine, 0);
3607   tile_decode(machine);
36423608}
36433609
36443610static DRIVER_INIT( puchicar )
36453611{
36463612   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4024d8, 0x4024db, 0, 0, irq_speedup_r_puchicar );
36473613   f3_game=PUCHICAR;
3648   tile_decode(machine, 0);
3614   tile_decode(machine);
36493615}
36503616
36513617static DRIVER_INIT( twinqix )
36523618{
36533619   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x400134, 0x400137, 0, 0, irq_speedup_r_twinqix );
36543620   f3_game=TWINQIX;
3655   tile_decode(machine, 0);
3621   tile_decode(machine);
36563622}
36573623
36583624static DRIVER_INIT( arkretrn )
36593625{
36603626   memory_install_read32_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x402154, 0x402157, 0, 0, irq_speedup_r_arkretrn );
36613627   f3_game=ARKRETRN;
3662   tile_decode(machine, 0);
3628   tile_decode(machine);
36633629}
36643630
36653631static DRIVER_INIT( intcup94 )
36663632{
36673633   f3_game=SCFINALS;
3668   tile_decode(machine, 1);
3634   tile_decode(machine);
36693635}
36703636
36713637static DRIVER_INIT( recalh )
36723638{
36733639   f3_game=RECALH;
3674   tile_decode(machine, 0);
3640   tile_decode(machine);
36753641}
36763642
36773643static DRIVER_INIT( commandw )
36783644{
36793645   f3_game=COMMANDW;
3680   tile_decode(machine, 1);
3646   tile_decode(machine);
36813647}
36823648
36833649/******************************************************************************/
src/mame/drivers/champbas.c
r2956r2957
11/***************************************************************************
22
3Championship Baseball
3Talbot                     - (c) 1982 Alpha Denshi Co.
4Champion Base Ball         - (c) 1983 Alpha Denshi Co.
5Champion Base Ball Part-2  - (c) 1983 Alpha Denshi Co.
6Exciting Soccer            - (c) 1983 Alpha Denshi Co.
7Exciting Soccer II         - (c) 1984 Alpha Denshi Co.
48
5driver by Nicola Salmoria
9driver by Ernesto Corvi, Jarek Parchanski, Nicola Salmoria
610ALPHA 8201 MCU handling by Tatsuyuki satoh
711
812Note: the Champion Baseball II unofficial schematics show a 8302 instead of
913the 8201, however the MCU is used like a plain 8201, 830x extra instructions
1014are not used.
1115
12TODO:
13  champbb2 , sometime mcu err and ACCESS VIOLATION trap.
14
1516champbbj and champbb2 has Alpha8201 mcu for protection.
1617champbja is a patched version of champbbj with different protection.
1718
r2956r2957
6364  it on boot and hang if it is not 0. Also, the Talbot MCU does a security check
6465  and crashes if the bit doesn't match bit 2 of RAM location 0x8c00.
6566
67- The Exciting Soccer bootleg runs on a modified Champion Baseball board. The
68  original board has vastly improved sound hardware which is thereforew missing
69  from the bootleg.
70
71TODO:
72-----
73- champbb2, sometime mcu err and ACCESS VIOLATION trap.
74
75- Exciting Soccer: interrupt source for sound CPU is unknown.
76
77- Exciting Soccer: sound CPU writes to unknown ports on startup. Timer configure?
78
79- Exciting Soccer: Unknown writes to 8910 I/O ports (filters?)
80
6681***************************************************************************/
6782
6883#include "driver.h"
r2956r2957
7388#define CPUTAG_MCU "MCU"
7489
7590extern UINT8 *champbas_bg_videoram;
76WRITE8_HANDLER( champbas_bg_videoram_w );
77WRITE8_HANDLER( champbas_gfxbank_w );
78WRITE8_HANDLER( champbas_palette_bank_w );
79WRITE8_HANDLER( champbas_flipscreen_w );
8091
81PALETTE_INIT( champbas );
82VIDEO_START( champbas );
83VIDEO_UPDATE( champbas );
92extern WRITE8_HANDLER( champbas_bg_videoram_w );
93extern WRITE8_HANDLER( champbas_gfxbank_w );
94extern WRITE8_HANDLER( champbas_palette_bank_w );
95extern WRITE8_HANDLER( champbas_flipscreen_w );
8496
97extern PALETTE_INIT( champbas );
98extern PALETTE_INIT( exctsccr );
99extern VIDEO_START( champbas );
100extern VIDEO_START( exctsccr );
101extern VIDEO_UPDATE( champbas );
102extern VIDEO_UPDATE( exctsccr );
85103
104
86105static int champbas_watchdog_count;
87106
88107
r2956r2957
105124}
106125
107126
108static WRITE8_HANDLER( irq_ack_w )
127static WRITE8_HANDLER( irq_enable_w )
109128{
110   cpunum_set_input_line(machine, 0, 0, CLEAR_LINE);
129   int bit = data & 1;
130
131   cpu_interrupt_enable(0,bit);
132   if (!bit)
133      cpunum_set_input_line(machine, 0, 0, CLEAR_LINE);
111134}
112135
113136
137static TIMER_CALLBACK( exctsccr_fm_callback )
138{
139   cpunum_set_input_line_and_vector(machine, 1, 0, HOLD_LINE, 0xff );
140}
141
142static MACHINE_START( exctsccr )
143{
144   // FIXME
145   timer_pulse(ATTOTIME_IN_HZ(75), NULL, 0, exctsccr_fm_callback); /* updates fm */
146}
147
148
149// Champion Baseball has only one DAC
114150static WRITE8_HANDLER( champbas_dac_w )
115151{
116   DAC_signed_data_w(0,data<<2);
152   DAC_signed_data_w(0, data << 2);
117153}
118154
155// Exciting Soccer has two
156static WRITE8_HANDLER( exctsccr_DAC_data_w )
157{
158   DAC_signed_data_w(offset, data << 2);
159}
160
161
119162///////////////////////////////////////////////////////////////////////////
120163// protection handling
121164///////////////////////////////////////////////////////////////////////////
r2956r2957
138181   cpunum_set_input_line(machine, cpunum, INPUT_LINE_HALT, data ? ASSERT_LINE : CLEAR_LINE);
139182}
140183
184
141185/* champbja another protection */
142186static READ8_HANDLER( champbja_alt_protection_r )
143187{
r2956r2957
170214
171215
172216
173static ADDRESS_MAP_START( talbot_main_map, ADDRESS_SPACE_PROGRAM, 8 )
217static ADDRESS_MAP_START( talbot_map, ADDRESS_SPACE_PROGRAM, 8 )
174218   AM_RANGE(0x0000, 0x5fff) AM_ROM
175219   AM_RANGE(0x6000, 0x63ff) AM_RAM AM_SHARE(1) /* MCU shared RAM */
176220   AM_RANGE(0x7000, 0x7000) AM_WRITE(AY8910_write_port_0_w)
r2956r2957
179223   AM_RANGE(0x8800, 0x8fef) AM_RAM
180224   AM_RANGE(0x8ff0, 0x8fff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
181225
182   AM_RANGE(0xa000, 0xa000) AM_WRITE(irq_ack_w)
226   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r)
227   AM_RANGE(0xa040, 0xa040) AM_READ(input_port_1_r)
228   AM_RANGE(0xa080, 0xa080) AM_READ(input_port_2_r)
229   AM_RANGE(0xa0c0, 0xa0c0) AM_READ(input_port_3_r)
230
231   AM_RANGE(0xa000, 0xa000) AM_WRITE(irq_enable_w)
183232   AM_RANGE(0xa001, 0xa001) AM_WRITENOP   // !WORK board output (no use?)
184233   AM_RANGE(0xa002, 0xa002) AM_WRITENOP
185234   AM_RANGE(0xa003, 0xa003) AM_WRITE(champbas_flipscreen_w)
r2956r2957
188237   AM_RANGE(0xa006, 0xa006) AM_WRITE(champbas_mcu_halt_w)
189238   AM_RANGE(0xa007, 0xa007) AM_WRITE(champbas_mcu_switch_w)
190239
191   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r)
192   AM_RANGE(0xa040, 0xa040) AM_READ(input_port_1_r)
193240   AM_RANGE(0xa060, 0xa06f) AM_WRITE(SMH_RAM) AM_BASE(&spriteram_2)
194   AM_RANGE(0xa080, 0xa080) AM_READ(input_port_2_r)
195   AM_RANGE(0xa0c0, 0xa0c0) AM_READWRITE(input_port_3_r, champbas_watchdog_reset_w)
241   AM_RANGE(0xa0c0, 0xa0c0) AM_WRITE(champbas_watchdog_reset_w)
196242ADDRESS_MAP_END
197243
198static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
244
245static ADDRESS_MAP_START( champbas_main_map, ADDRESS_SPACE_PROGRAM, 8 )
199246   AM_RANGE(0x0000, 0x5fff) AM_ROM
200247   AM_RANGE(0x6000, 0x63ff) AM_RAM AM_SHARE(1)
201
202248   AM_RANGE(0x7000, 0x7000) AM_WRITE(AY8910_write_port_0_w)
203249   AM_RANGE(0x7001, 0x7001) AM_WRITE(AY8910_control_port_0_w)
204250   AM_RANGE(0x7800, 0x7fff) AM_ROM   // champbb2 only
205
206251   AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(champbas_bg_videoram_w) AM_BASE(&champbas_bg_videoram)
207252   AM_RANGE(0x8800, 0x8fef) AM_RAM
208253   AM_RANGE(0x8ff0, 0x8fff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
209254
210   AM_RANGE(0xa000, 0xa000) AM_WRITE(irq_ack_w) AM_READ(input_port_0_r)
255   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r)
256   AM_RANGE(0xa040, 0xa040) AM_READ(input_port_1_r)
257   AM_RANGE(0xa080, 0xa080) AM_READ(input_port_2_r)
258   AM_RANGE(0xa0c0, 0xa0c0) AM_READ(input_port_3_r)
259
260   AM_RANGE(0xa000, 0xa000) AM_WRITE(irq_enable_w)
211261   AM_RANGE(0xa001, 0xa001) AM_WRITENOP   // !WORK board output (no use?)
212262   AM_RANGE(0xa002, 0xa002) AM_WRITE(champbas_gfxbank_w)
213263   AM_RANGE(0xa003, 0xa003) AM_WRITE(champbas_flipscreen_w)
r2956r2957
216266   AM_RANGE(0xa006, 0xa006) AM_WRITE(champbas_mcu_halt_w)   // MCU not present/not used in champbas
217267   AM_RANGE(0xa007, 0xa007) AM_WRITE(champbas_mcu_switch_w)   // MCU not present/not used in champbas
218268
219   AM_RANGE(0xa040, 0xa040)                            AM_READ(input_port_1_r)
220269   AM_RANGE(0xa060, 0xa06f) AM_RAM AM_BASE(&spriteram_2)
221   AM_RANGE(0xa080, 0xa080) AM_WRITE(soundlatch_w)     AM_READ(input_port_2_r)
270   AM_RANGE(0xa080, 0xa080) AM_WRITE(soundlatch_w)
222271/*  AM_RANGE(0xa0a0, 0xa0a0)    ???? */
223   AM_RANGE(0xa0c0, 0xa0c0) AM_WRITE(champbas_watchdog_reset_w) AM_READ(input_port_3_r)
272   AM_RANGE(0xa0c0, 0xa0c0) AM_WRITE(champbas_watchdog_reset_w)
224273
225274   /* champbja only */
226275   AM_RANGE(0x6800, 0x68ff) AM_READ(champbja_alt_protection_r)
276ADDRESS_MAP_END
227277
278static ADDRESS_MAP_START( exctsccb_main_map, ADDRESS_SPACE_PROGRAM, 8 )
279   AM_RANGE(0x0000, 0x5fff) AM_ROM
280//  AM_RANGE(0x6000, 0x63ff) AM_RAM AM_SHARE(1) // MCU not used (though it's present on the board)
281   AM_RANGE(0x7000, 0x7000) AM_WRITE(AY8910_write_port_0_w)
282   AM_RANGE(0x7001, 0x7001) AM_WRITE(AY8910_control_port_0_w)
283//  AM_RANGE(0x7800, 0x7fff) AM_ROM // champbb2 only
284   AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(champbas_bg_videoram_w) AM_BASE(&champbas_bg_videoram)
285   AM_RANGE(0x8800, 0x8fff) AM_RAM AM_BASE(&spriteram_2) /* ??? */
286
287   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r)
288   AM_RANGE(0xa040, 0xa040) AM_READ(input_port_1_r)
289   AM_RANGE(0xa080, 0xa080) AM_READ(input_port_2_r)
290   AM_RANGE(0xa0c0, 0xa0c0) AM_READ(input_port_3_r)
291
292   AM_RANGE(0xa000, 0xa000) AM_WRITE(irq_enable_w)
293   AM_RANGE(0xa001, 0xa001) AM_WRITENOP   /* ??? */
294   AM_RANGE(0xa002, 0xa002) AM_WRITE(champbas_gfxbank_w)
295   AM_RANGE(0xa003, 0xa003) AM_WRITE(champbas_flipscreen_w)
296   AM_RANGE(0xa006, 0xa006) AM_WRITENOP   /* MCU is not used, but some leftover code still writes here */
297   AM_RANGE(0xa007, 0xa007) AM_WRITENOP   /* MCU is not used, but some leftover code still writes here */
298
299   AM_RANGE(0xa040, 0xa06f) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) /* Sprite Pos */
300   AM_RANGE(0xa080, 0xa080) AM_WRITE(soundlatch_w)
301   AM_RANGE(0xa0c0, 0xa0c0) AM_WRITE(watchdog_reset_w)
228302ADDRESS_MAP_END
229303
230static ADDRESS_MAP_START( sub_map, ADDRESS_SPACE_PROGRAM, 8 )
304
305static ADDRESS_MAP_START( exctsccr_main_map, ADDRESS_SPACE_PROGRAM, 8 )
231306   AM_RANGE(0x0000, 0x5fff) AM_ROM
307   AM_RANGE(0x6000, 0x63ff) AM_RAM AM_SHARE(1)
308   AM_RANGE(0x7c00, 0x7fff) AM_RAM
309   AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(champbas_bg_videoram_w) AM_BASE(&champbas_bg_videoram)
310   AM_RANGE(0x8800, 0x8bff) AM_RAM AM_BASE(&spriteram_2) /* ??? */
311
312   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r)
313   AM_RANGE(0xa040, 0xa040) AM_READ(input_port_1_r)
314   AM_RANGE(0xa080, 0xa080) AM_READ(input_port_2_r)
315   AM_RANGE(0xa0c0, 0xa0c0) AM_READ(input_port_3_r)
316
317   AM_RANGE(0xa000, 0xa000) AM_WRITE(irq_enable_w)
318//  AM_RANGE(0xa001, 0xa001) AM_WRITENOP    /* ??? */
319   AM_RANGE(0xa002, 0xa002) AM_WRITE(champbas_gfxbank_w)
320   AM_RANGE(0xa003, 0xa003) AM_WRITE(champbas_flipscreen_w)
321   AM_RANGE(0xa006, 0xa006) AM_WRITE(champbas_mcu_halt_w)
322   AM_RANGE(0xa007, 0xa007) AM_WRITENOP /* This is also MCU control, but i dont need it */
323
324   AM_RANGE(0xa040, 0xa06f) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) /* Sprite pos */
325   AM_RANGE(0xa080, 0xa080) AM_WRITE(soundlatch_w)
326   AM_RANGE(0xa0c0, 0xa0c0) AM_WRITE(watchdog_reset_w)
327ADDRESS_MAP_END
328
329
330
331static ADDRESS_MAP_START( champbas_sub_map, ADDRESS_SPACE_PROGRAM, 8 )
332   AM_RANGE(0x0000, 0x5fff) AM_ROM
232333   AM_RANGE(0x6000, 0x7fff) AM_READ(soundlatch_r)
233334   AM_RANGE(0x8000, 0x9fff) AM_WRITENOP   // 4-bit return code to main CPU (not used)
234335   AM_RANGE(0xa000, 0xbfff) AM_WRITE(soundlatch_clear_w)
r2956r2957
236337   AM_RANGE(0xe000, 0xe3ff) AM_MIRROR(0x1c00) AM_RAM
237338ADDRESS_MAP_END
238339
340
341static ADDRESS_MAP_START( exctsccr_sub_map, ADDRESS_SPACE_PROGRAM, 8 )
342   AM_RANGE(0x0000, 0x8fff) AM_ROM
343   AM_RANGE(0xa000, 0xa7ff) AM_RAM
344   AM_RANGE(0xc008, 0xc009) AM_WRITE(exctsccr_DAC_data_w)
345   AM_RANGE(0xc00c, 0xc00c) AM_WRITE(soundlatch_clear_w)
346   AM_RANGE(0xc00d, 0xc00d) AM_READ(soundlatch_r)
347//  AM_RANGE(0xc00f, 0xc00f) AM_WRITENOP /* ??? */
348ADDRESS_MAP_END
349
350static ADDRESS_MAP_START( exctsccr_sound_writeport, ADDRESS_SPACE_IO, 8 )
351   ADDRESS_MAP_GLOBAL_MASK( 0x00ff )
352   AM_RANGE(0x82, 0x82) AM_WRITE(AY8910_write_port_0_w)
353   AM_RANGE(0x83, 0x83) AM_WRITE(AY8910_control_port_0_w)
354   AM_RANGE(0x86, 0x86) AM_WRITE(AY8910_write_port_1_w)
355   AM_RANGE(0x87, 0x87) AM_WRITE(AY8910_control_port_1_w)
356   AM_RANGE(0x8a, 0x8a) AM_WRITE(AY8910_write_port_2_w)
357   AM_RANGE(0x8b, 0x8b) AM_WRITE(AY8910_control_port_2_w)
358   AM_RANGE(0x8e, 0x8e) AM_WRITE(AY8910_write_port_3_w)
359   AM_RANGE(0x8f, 0x8f) AM_WRITE(AY8910_control_port_3_w)
360ADDRESS_MAP_END
361
362
239363static ADDRESS_MAP_START( mcu_map, ADDRESS_SPACE_PROGRAM, 8 )
240364   AM_RANGE(0x0000, 0x03ff) AM_RAM AM_SHARE(1) /* main CPU shared RAM */
241365ADDRESS_MAP_END
r2956r2957
351475   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
352476INPUT_PORTS_END
353477
478static INPUT_PORTS_START( exctsccr )
479   PORT_START      /* IN0 */
480   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
481   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
482   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
483   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON2 )
484   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
485   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
486   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
487   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
354488
489   PORT_START      /* IN1 */
490   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
491   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
492   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
493   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
494   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
495   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
496   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
497   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
355498
499   PORT_START      /* DSW0 */
500   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
501   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
502   PORT_DIPSETTING(    0x03, "A 1C/1C B 3C/1C" )
503   PORT_DIPSETTING(    0x01, "A 1C/2C B 1C/4C" )
504   PORT_DIPSETTING(    0x00, "A 1C/3C B 1C/6C" )
505   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) )
506   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
507   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
508   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) )
509   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
510   PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ) )
511   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Difficulty ) )
512   PORT_DIPSETTING(    0x10, DEF_STR( Easy ) )
513   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
514   PORT_DIPNAME( 0x60, 0x00, DEF_STR( Game_Time ) )
515   PORT_DIPSETTING(    0x20, "1 Min." )
516   PORT_DIPSETTING(    0x00, "2 Min." )
517   PORT_DIPSETTING(    0x60, "3 Min." )
518   PORT_DIPSETTING(    0x40, "4 Min." )
519   PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(champbas_watchdog_bit2, 0)   // bit 2 of the watchdog counter
520
521   PORT_START      /* IN2 */
522   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
523   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
524   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
525   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2 )
526   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
527   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
528   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
529   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
530INPUT_PORTS_END
531
532
533
356534static const gfx_layout charlayout =
357535{
358536   8,8,
r2956r2957
376554};
377555
378556static GFXDECODE_START( talbot )
379   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout,   0x100, 0x100/4 )
380   GFXDECODE_ENTRY( REGION_GFX2, 0, spritelayout, 0x000, 0x100/4 )
557   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout,   0x100, 0x100>>2 )
558   GFXDECODE_ENTRY( REGION_GFX2, 0, spritelayout, 0x000, 0x100>>2 )
381559GFXDECODE_END
382560
383561static GFXDECODE_START( champbas )
384   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout,   0, 0x200/4 )
385   GFXDECODE_ENTRY( REGION_GFX2, 0, spritelayout, 0, 0x200/4 )
562   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout,   0, 0x200>>2 )
563   GFXDECODE_ENTRY( REGION_GFX2, 0, spritelayout, 0, 0x200>>2 )
386564GFXDECODE_END
387565
388566
389567
568static const gfx_layout charlayout_3bpp =
569{
570   8,8,
571   RGN_FRAC(1,2),
572   3,
573   { RGN_FRAC(1,2)+4, 0, 4 },
574   { STEP4(8*8,1), STEP4(0,1) },
575   { STEP8(0,8) },
576   16*8
577};
390578
579static const gfx_layout spritelayout_3bpp =
580{
581   16,16,
582   RGN_FRAC(1,2),
583   3,
584   { RGN_FRAC(1,2)+4, 0, 4 },
585   { STEP4(8*8,1), STEP4(16*8,1), STEP4(24*8,1), STEP4(0,1) },
586   { STEP8(0,8), STEP8(32*8,8) },
587   64*8
588};
589
590static const gfx_layout spritelayout_4bpp =
591{
592   16,16,
593   RGN_FRAC(1,2),
594   4,
595   { RGN_FRAC(1,2)+0, RGN_FRAC(1,2)+4, 0, 4 },
596   { STEP4(8*8,1), STEP4(16*8,1), STEP4(24*8,1), STEP4(0,1) },
597   { STEP8(0,8), STEP8(32*8,8) },
598   64*8
599};
600
601static GFXDECODE_START( exctsccr )
602   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout_3bpp,   0x000, 0x080>>3 ) /* chars */
603   GFXDECODE_ENTRY( REGION_GFX2, 0, spritelayout_3bpp, 0x080, 0x080>>3 ) /* sprites */
604   GFXDECODE_ENTRY( REGION_GFX3, 0, spritelayout_4bpp, 0x100, 0x100>>4 ) /* sprites */
605GFXDECODE_END
606
607
608
609
391610static MACHINE_DRIVER_START( talbot )
392611
393612   /* basic machine hardware */
394613
395614   MDRV_CPU_ADD(Z80, XTAL_18_432MHz/6)
396   MDRV_CPU_PROGRAM_MAP(talbot_main_map, 0)
615   MDRV_CPU_PROGRAM_MAP(talbot_map, 0)
397616   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
398617
399618   /* MCU */
r2956r2957
423642
424643
425644static MACHINE_DRIVER_START( champbas )
426
427645   /* basic machine hardware */
428646
429647   /* main cpu */
430648   MDRV_CPU_ADD(Z80, XTAL_18_432MHz/6)
431   MDRV_CPU_PROGRAM_MAP(main_map,0)
649   MDRV_CPU_PROGRAM_MAP(champbas_main_map,0)
432650   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
433651
434652   /* audio CPU */
435653   MDRV_CPU_ADD(Z80, XTAL_18_432MHz/6)
436   MDRV_CPU_PROGRAM_MAP(sub_map,0)
654   MDRV_CPU_PROGRAM_MAP(champbas_sub_map,0)
437655
438656   /* video hardware */
439657   MDRV_SCREEN_ADD("main", RASTER)
r2956r2957
473691   MDRV_INTERLEAVE(50)
474692MACHINE_DRIVER_END
475693
476/***************************************************************************
477694
478  Game driver(s)
695static MACHINE_DRIVER_START( exctsccr )
479696
480***************************************************************************/
697   /* basic machine hardware */
698   MDRV_CPU_ADD(Z80, 4000000)   /* 4.0 MHz (?) */
699   MDRV_CPU_PROGRAM_MAP(exctsccr_main_map,0)
700   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
481701
702   MDRV_CPU_ADD(Z80, 4123456)   /* ??? with 4 MHz, nested NMIs might happen */
703   MDRV_CPU_PROGRAM_MAP(exctsccr_sub_map,0)
704   MDRV_CPU_IO_MAP(0,exctsccr_sound_writeport)
705   MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 4000) /* 4 kHz, updates the dac */
706
707   /* MCU */
708   MDRV_CPU_ADD_TAG(CPUTAG_MCU, ALPHA8301, XTAL_18_432MHz/6/8)
709   MDRV_CPU_PROGRAM_MAP(mcu_map,0)
710
711   MDRV_MACHINE_START(exctsccr)
712
713   /* video hardware */
714   MDRV_SCREEN_ADD("main", RASTER)
715   MDRV_SCREEN_REFRESH_RATE(60)
716   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
717   MDRV_SCREEN_SIZE(32*8, 32*8)
718   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
719
720   MDRV_GFXDECODE(exctsccr)
721   MDRV_PALETTE_LENGTH(0x200)
722
723   MDRV_PALETTE_INIT(exctsccr)
724   MDRV_VIDEO_START(exctsccr)
725   MDRV_VIDEO_UPDATE(exctsccr)
726   MDRV_VIDEO_EOF(champbas)
727
728   /* sound hardware */
729   MDRV_SPEAKER_STANDARD_MONO("mono")
730
731   MDRV_SOUND_ADD(AY8910, 1500000)
732   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.08)
733
734   MDRV_SOUND_ADD(AY8910, 1500000)
735   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.08)
736
737   MDRV_SOUND_ADD(AY8910, 1500000)
738   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.08)
739
740   MDRV_SOUND_ADD(AY8910, 1500000)
741   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.08)
742
743   MDRV_SOUND_ADD(DAC, 0)
744   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
745
746   MDRV_SOUND_ADD(DAC, 0)
747   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
748MACHINE_DRIVER_END
749
750/* Bootleg running on a modified Champion Baseball board */
751static MACHINE_DRIVER_START( exctsccb )
752
753   /* basic machine hardware */
754   MDRV_CPU_ADD(Z80, XTAL_18_432MHz/6)
755   MDRV_CPU_PROGRAM_MAP(exctsccb_main_map,0)
756   MDRV_CPU_VBLANK_INT("main", irq0_line_assert)
757
758   MDRV_CPU_ADD(Z80, XTAL_18_432MHz/6)
759   MDRV_CPU_PROGRAM_MAP(champbas_sub_map,0)
760
761   /* video hardware */
762   MDRV_SCREEN_ADD("main", RASTER)
763   MDRV_SCREEN_REFRESH_RATE(60)
764   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
765   MDRV_SCREEN_SIZE(32*8, 32*8)
766   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
767
768   MDRV_GFXDECODE(exctsccr)
769   MDRV_PALETTE_LENGTH(0x200)
770
771   MDRV_PALETTE_INIT(exctsccr)
772   MDRV_VIDEO_START(exctsccr)
773   MDRV_VIDEO_UPDATE(exctsccr)
774   MDRV_VIDEO_EOF(champbas)
775
776   /* sound hardware */
777   MDRV_SPEAKER_STANDARD_MONO("mono")
778
779   MDRV_SOUND_ADD(AY8910, XTAL_18_432MHz/12)
780   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
781
782   MDRV_SOUND_ADD(DAC, 0)
783   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
784MACHINE_DRIVER_END
785
786
787
482788ROM_START( talbot )
483789   ROM_REGION( 0x10000, REGION_CPU1, 0 )
484790   ROM_LOAD( "11.10g", 0x0000, 0x1000, CRC(0368607d) SHA1(275a29fb018bd327e64cf4fcc04590099c90290a) )
r2956r2957
624930   ROM_LOAD( "pr5956", 0x0020, 0x100, CRC(872dd450) SHA1(6c1e2c4a2fc072f4bf4996c731adb0b01b347506) ) /* look-up table */
625931ROM_END
626932
933ROM_START( exctsccr )
934   ROM_REGION( 0x10000, REGION_CPU1, 0 )
935   ROM_LOAD( "1_g10.bin",    0x0000, 0x2000, CRC(aa68df66) SHA1(f10cac5a4c5aad1e1eb8835174dc8d517bb2921a) )
936   ROM_LOAD( "2_h10.bin",    0x2000, 0x2000, CRC(2d8f8326) SHA1(8809e7b081fa2a1966cb51ac969fd7b468d35be0) )
937   ROM_LOAD( "3_j10.bin",    0x4000, 0x2000, CRC(dce4a04d) SHA1(9c015e4597ec8921bea213d9841fc69c776a4e6d) )
627938
939   ROM_REGION( 0x10000, REGION_CPU2, 0 )
940   ROM_LOAD( "0_h6.bin",     0x0000, 0x2000, CRC(3babbd6b) SHA1(b81bd47c4449f4f21f2d55d01eb9cb6db10664c7) )
941   ROM_LOAD( "9_f6.bin",     0x2000, 0x2000, CRC(639998f5) SHA1(c4ff5e5e75d53dea38449f323186d08d5b57bf90) )
942   ROM_LOAD( "8_d6.bin",     0x4000, 0x2000, CRC(88651ee1) SHA1(2052e1b3f9784439369f464e31f4a2b0d1bb0565) )
943   ROM_LOAD( "7_c6.bin",     0x6000, 0x2000, CRC(6d51521e) SHA1(2809bd2e61f40dcd31d43c62520982bdcfb0a865) )
944   ROM_LOAD( "1_a6.bin",     0x8000, 0x1000, CRC(20f2207e) SHA1(b1ed2237d0bd50ddbe593fd2fbff9f1d67c1eb11) )
628945
946   ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )   // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only chars
947   ROM_LOAD( "4_a5.bin",     0x0000, 0x2000, CRC(c342229b) SHA1(a989d6c12521c77882a7e17d4d80afe7eae05906) ) /* planes 0,1 */
948   ROM_LOAD( "6_c5.bin",     0x2000, 0x2000, CRC(eda40e32) SHA1(6c08fd4f4fb35fd354d02e04548e960c545f6a88) ) /* plane 3 */
949
950   ROM_REGION( 0x04000, REGION_GFX2, ROMREGION_DISPOSE )   // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only sprites
951   ROM_LOAD( "5_b5.bin",     0x0000, 0x2000, CRC(35f4f8c9) SHA1(cdf5bbfea9abdd338938e5f4499d2d71ce3c6237) ) /* planes 0,1 */
952
953   ROM_REGION( 0x02000, REGION_GFX3, ROMREGION_DISPOSE )   // 4bpp sprites
954   ROM_LOAD( "2_k5.bin",     0x0000, 0x1000, CRC(7f9cace2) SHA1(bf05a31716f3ca1c2fd1034cd1f39e2d21cdaed3) )
955   ROM_LOAD( "3_l5.bin",     0x1000, 0x1000, CRC(db2d9e0d) SHA1(6ec09a47f7aea6bf31eb0ee78f44012f4d92de8a) )
956
957   ROM_REGION( 0x0220, REGION_PROMS, 0 )
958   ROM_LOAD( "prom1.e1",     0x0000, 0x0020, CRC(d9b10bf0) SHA1(bc1263331968f4bf37eb70ec4f56a8cb763c29d2) ) /* palette */
959   ROM_LOAD( "prom3.k5",     0x0020, 0x0100, CRC(b5db1c2c) SHA1(900aaaac6b674a9c5c7b7804a4b0c3d5cce761aa) ) /* lookup table */
960   ROM_LOAD( "prom2.8r",     0x0120, 0x0100, CRC(8a9c0edf) SHA1(8aad387e9409cff0eeb42eeb57e9ea88770a8c9a) ) /* lookup table */
961ROM_END
962
963ROM_START( exctscca )
964   ROM_REGION( 0x10000, REGION_CPU1, 0 )
965   ROM_LOAD( "1_g10.bin",    0x0000, 0x2000, CRC(aa68df66) SHA1(f10cac5a4c5aad1e1eb8835174dc8d517bb2921a) )
966   ROM_LOAD( "2_h10.bin",    0x2000, 0x2000, CRC(2d8f8326) SHA1(8809e7b081fa2a1966cb51ac969fd7b468d35be0) )
967   ROM_LOAD( "3_j10.bin",    0x4000, 0x2000, CRC(dce4a04d) SHA1(9c015e4597ec8921bea213d9841fc69c776a4e6d) )
968
969   ROM_REGION( 0x10000, REGION_CPU2, 0 )
970   ROM_LOAD( "exctsccc.000", 0x0000, 0x2000, CRC(642fc42f) SHA1(cfc849d18e347e3e23fc31c1ce7f2580d5d9b2b0) )
971   ROM_LOAD( "exctsccc.009", 0x2000, 0x2000, CRC(d88b3236) SHA1(80f083fb15243e9e68978677caed8aee8e3109a0) )
972   ROM_LOAD( "8_d6.bin",     0x4000, 0x2000, CRC(88651ee1) SHA1(2052e1b3f9784439369f464e31f4a2b0d1bb0565) )
973   ROM_LOAD( "7_c6.bin",     0x6000, 0x2000, CRC(6d51521e) SHA1(2809bd2e61f40dcd31d43c62520982bdcfb0a865) )
974   ROM_LOAD( "1_a6.bin",     0x8000, 0x1000, CRC(20f2207e) SHA1(b1ed2237d0bd50ddbe593fd2fbff9f1d67c1eb11) )
975
976   ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )   // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only chars
977   ROM_LOAD( "4_a5.bin",     0x0000, 0x2000, CRC(c342229b) SHA1(a989d6c12521c77882a7e17d4d80afe7eae05906) ) /* planes 0,1 */
978   ROM_LOAD( "6_c5.bin",     0x2000, 0x2000, CRC(eda40e32) SHA1(6c08fd4f4fb35fd354d02e04548e960c545f6a88) ) /* plane 3 */
979
980   ROM_REGION( 0x04000, REGION_GFX2, ROMREGION_DISPOSE )   // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only sprites
981   ROM_LOAD( "5_b5.bin",     0x0000, 0x2000, CRC(35f4f8c9) SHA1(cdf5bbfea9abdd338938e5f4499d2d71ce3c6237) ) /* planes 0,1 */
982
983   ROM_REGION( 0x02000, REGION_GFX3, ROMREGION_DISPOSE )   // 4bpp sprites
984   ROM_LOAD( "2_k5.bin",     0x0000, 0x1000, CRC(7f9cace2) SHA1(bf05a31716f3ca1c2fd1034cd1f39e2d21cdaed3) )
985   ROM_LOAD( "3_l5.bin",     0x1000, 0x1000, CRC(db2d9e0d) SHA1(6ec09a47f7aea6bf31eb0ee78f44012f4d92de8a) )
986
987   ROM_REGION( 0x0220, REGION_PROMS, 0 )
988   ROM_LOAD( "prom1.e1",     0x0000, 0x0020, CRC(d9b10bf0) SHA1(bc1263331968f4bf37eb70ec4f56a8cb763c29d2) ) /* palette */
989   ROM_LOAD( "prom3.k5",     0x0020, 0x0100, CRC(b5db1c2c) SHA1(900aaaac6b674a9c5c7b7804a4b0c3d5cce761aa) ) /* lookup table */
990   ROM_LOAD( "prom2.8r",     0x0120, 0x0100, CRC(8a9c0edf) SHA1(8aad387e9409cff0eeb42eeb57e9ea88770a8c9a) ) /* lookup table */
991ROM_END
992
993/*
994The Kazutomi bootleg board is a conversion from Champion Baseball:
995Alpha denshi co. LTD made in Japan
996cpu board 58AS1
997Display board 58AS2
998Voice board 58AS3
999KAZUTOMI board
10001x Alpha8201 (CPU board)
10011x AY-3-8910 (CPU board)
10021x Sharp Z80ACPU (CPU board)
10031x Sharp Z80ACPU (VOICE board)
10043x 2764 (CPU board) (1-2-3)
10053x 2764 (VOICE board) (a-b-c)
10062x 2764 (DISPLAY board) (4-5)
10071x 2764 (daughter board kazutomi) (6)
10082x 2732 (daughter board kazutomi) (7-8)
1009*/
1010ROM_START( exctsccb )
1011   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1012   ROM_LOAD( "es-1.e2",      0x0000, 0x2000, CRC(997c6a82) SHA1(60fe27a12eedd22c775b7e65c5ba692cfcf5ac74) )
1013   ROM_LOAD( "es-2.g2",      0x2000, 0x2000, CRC(5c66e792) SHA1(f7a7f32806965fa926261217cee3159ccd198d49) )
1014   ROM_LOAD( "es-3.h2",      0x4000, 0x2000, CRC(e0d504c0) SHA1(d9a9f37b3a44a05a3f3389aa9617c419a2cee661) )
1015
1016   ROM_REGION( 0x10000, REGION_CPU2, 0 )   /* sound */
1017   ROM_LOAD( "es-a.k2",      0x0000, 0x2000, CRC(99e87b78) SHA1(f12006ff3f6f3c706e06288c97a1446141373432) )
1018   ROM_LOAD( "es-b.l2",      0x2000, 0x2000, CRC(8b3db794) SHA1(dbfed2357c7631bfca6bbd63a23617bc3abf6ca3) )
1019   ROM_LOAD( "es-c.m2",      0x4000, 0x2000, CRC(7bed2f81) SHA1(cbbb0480519cc04a99e8983228b18c9e49a9985d) )
1020
1021   /* the national flags are wrong. This happens on the real board */
1022   ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )   // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only chars
1023   ROM_LOAD( "4_a5.bin",     0x0000, 0x2000, CRC(c342229b) SHA1(a989d6c12521c77882a7e17d4d80afe7eae05906) ) /* planes 0,1 */
1024   ROM_LOAD( "6_c5.bin",     0x2000, 0x2000, CRC(eda40e32) SHA1(6c08fd4f4fb35fd354d02e04548e960c545f6a88) ) /* plane 3 */
1025
1026   ROM_REGION( 0x04000, REGION_GFX2, ROMREGION_DISPOSE )   // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only sprites
1027   ROM_LOAD( "5_b5.bin",     0x0000, 0x2000, CRC(35f4f8c9) SHA1(cdf5bbfea9abdd338938e5f4499d2d71ce3c6237) ) /* planes 0,1 */
1028
1029   ROM_REGION( 0x02000, REGION_GFX3, ROMREGION_DISPOSE )   // 4bpp sprites
1030   ROM_LOAD( "2_k5.bin",     0x0000, 0x1000, CRC(7f9cace2) SHA1(bf05a31716f3ca1c2fd1034cd1f39e2d21cdaed3) )
1031   ROM_LOAD( "3_l5.bin",     0x1000, 0x1000, CRC(db2d9e0d) SHA1(6ec09a47f7aea6bf31eb0ee78f44012f4d92de8a) )
1032
1033   ROM_REGION( 0x0220, REGION_PROMS, 0 )
1034   ROM_LOAD( "prom1.e1",     0x0000, 0x0020, CRC(d9b10bf0) SHA1(bc1263331968f4bf37eb70ec4f56a8cb763c29d2) ) /* palette */
1035   ROM_LOAD( "prom3.k5",     0x0020, 0x0100, CRC(b5db1c2c) SHA1(900aaaac6b674a9c5c7b7804a4b0c3d5cce761aa) ) /* lookup table */
1036   ROM_LOAD( "prom2.8r",     0x0120, 0x0100, CRC(8a9c0edf) SHA1(8aad387e9409cff0eeb42eeb57e9ea88770a8c9a) ) /* lookup table */
1037ROM_END
1038
1039ROM_START( exctscc2 )
1040   ROM_REGION( 0x10000, REGION_CPU1, 0 )
1041   ROM_LOAD( "vr.3j",        0x0000, 0x2000, CRC(c6115362) SHA1(6a258631abd72ef6b8d7968bb4b2bc88e89e597d) )
1042   ROM_LOAD( "vr.3k",        0x2000, 0x2000, CRC(de36ba00) SHA1(0a0d92e710b8c749f145571bc8a204609456d19d) )
1043   ROM_LOAD( "vr.3l",        0x4000, 0x2000, CRC(1ddfdf65) SHA1(313d0a7f13fc2de15aa32492c38a59fbafad9f01) )
1044
1045   ROM_REGION( 0x10000, REGION_CPU2, 0 )
1046   ROM_LOAD( "vr.7d",        0x0000, 0x2000, CRC(2c675a43) SHA1(aa0a8dbcae955e3da92c435202f2a1ed238c377e) )
1047   ROM_LOAD( "vr.7e",        0x2000, 0x2000, CRC(e571873d) SHA1(2dfff24f5dac86e92612f40cf3642005c7f36ad3) )
1048   ROM_LOAD( "8_d6.bin",     0x4000, 0x2000, CRC(88651ee1) SHA1(2052e1b3f9784439369f464e31f4a2b0d1bb0565) )   /* vr.7f */
1049   ROM_LOAD( "7_c6.bin",     0x6000, 0x2000, CRC(6d51521e) SHA1(2809bd2e61f40dcd31d43c62520982bdcfb0a865) )   /* vr.7h */
1050   ROM_LOAD( "1_a6.bin",     0x8000, 0x1000, CRC(20f2207e) SHA1(b1ed2237d0bd50ddbe593fd2fbff9f1d67c1eb11) )   /* vr.7k */
1051
1052   ROM_REGION( 0x04000, REGION_GFX1, ROMREGION_DISPOSE )   // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only chars
1053   ROM_LOAD( "vr.5a",        0x0000, 0x2000, CRC(4ff1783d) SHA1(c45074864c3a4bcbf3a87d164027ae16dca53d9c) ) /* planes 0,1 */
1054   ROM_LOAD( "vr.5c",        0x2000, 0x2000, CRC(1fb84ee6) SHA1(56ceb86c509be783f806403ac21e7c9684760d5f) ) /* plane 3 */
1055
1056   ROM_REGION( 0x04000, REGION_GFX2, ROMREGION_DISPOSE )   // 3bpp chars + sprites: rearranged by DRIVER_INIT to leave only sprites
1057   ROM_LOAD( "vr.5b",        0x0000, 0x2000, CRC(5605b60b) SHA1(19d5909896ae4a3d7552225c369d30475c56793b) ) /* planes 0,1 */
1058
1059   ROM_REGION( 0x02000, REGION_GFX3, ROMREGION_DISPOSE )   // 4bpp sprites
1060   ROM_LOAD( "vr.5k",        0x0000, 0x1000, CRC(1d37edfa) SHA1(184fa6dd7b1b3fff4c5fc19b42301ccb7979ac84) )
1061   ROM_LOAD( "vr.5l",        0x1000, 0x1000, CRC(b97f396c) SHA1(4ffe512acf047230bd593911a615fc0ef66b481d) )
1062
1063   ROM_REGION( 0x0220, REGION_PROMS, 0 )
1064   ROM_LOAD( "prom1.e1",     0x0000, 0x0020, CRC(d9b10bf0) SHA1(bc1263331968f4bf37eb70ec4f56a8cb763c29d2) ) /* palette */
1065   ROM_LOAD( "prom3.k5",     0x0020, 0x0100, CRC(b5db1c2c) SHA1(900aaaac6b674a9c5c7b7804a4b0c3d5cce761aa) ) /* lookup table */
1066   ROM_LOAD( "prom2.8r",     0x0120, 0x0100, CRC(8a9c0edf) SHA1(8aad387e9409cff0eeb42eeb57e9ea88770a8c9a) ) /* lookup table */
1067ROM_END
1068
1069
1070
6291071static DRIVER_INIT(champbas)
6301072{
6311073   // chars and sprites are mixed in the same ROMs, so rearrange them for easier decoding
r2956r2957
6431085}
6441086
6451087
1088static DRIVER_INIT( exctsccr )
1089{
1090   // chars and sprites are mixed in the same ROMs, so rearrange them for easier decoding
1091   UINT8 *rom1 = memory_region(machine, REGION_GFX1);
1092   UINT8 *rom2 = memory_region(machine, REGION_GFX2);
1093   int i;
6461094
1095   // planes 0,1
1096   for (i = 0; i < 0x1000; ++i)
1097   {
1098      UINT8 t = rom1[i + 0x1000];
1099      rom1[i + 0x1000] = rom2[i];
1100      rom2[i] = t;
1101   }
1102
1103   // plane 3
1104   for (i = 0; i < 0x1000; ++i)
1105   {
1106      rom2[i + 0x3000] = rom1[i + 0x3000] >> 4;
1107      rom2[i + 0x2000] = rom1[i + 0x3000] & 0x0f;
1108   }
1109   for (i = 0; i < 0x1000; ++i)
1110   {
1111      rom1[i + 0x3000] = rom1[i + 0x2000] >> 4;
1112      rom1[i + 0x2000] &= 0x0f;
1113   }
1114}
1115
1116
1117
6471118GAME( 1982, talbot,   0,        talbot,   talbot,   0,        ROT270, "Alpha Denshi Co. (Volt Electronics license)", "Talbot", 0 )
6481119
6491120GAME( 1983, champbas, 0,        champbas, champbas, champbas, ROT0,   "[Alpha Denshi Co.] (Sega license)", "Champion Base Ball", 0 )
r2956r2957
6511122GAME( 1983, champbja, champbas, champbas, champbas, champbas, ROT0,   "Alpha Denshi Co.", "Champion Base Ball (Japan set 2)", 0 )
6521123GAME( 1983, champbb2, 0,        champmcu, champbas, champbas, ROT0,   "[Alpha Denshi Co.] (Sega license)", "Champion Base Ball Part-2: Pair Play (set 1)", 0 )
6531124GAME( 1983, champb2a, champbb2, champmcu, champbas, champbas, ROT0,   "Alpha Denshi Co.", "Champion Baseball II (set 2)", GAME_NOT_WORKING)   // no dump
1125
1126GAME( 1983, exctsccr, 0,        exctsccr, exctsccr, exctsccr, ROT270, "Alpha Denshi Co.", "Exciting Soccer", 0 )
1127GAME( 1983, exctscca, exctsccr, exctsccr, exctsccr, exctsccr, ROT270, "Alpha Denshi Co.", "Exciting Soccer (alternate music)", 0 )
1128GAME( 1983, exctsccb, exctsccr, exctsccb, exctsccr, exctsccr, ROT270, "bootleg",          "Exciting Soccer (bootleg)", 0 )
1129GAME( 1984, exctscc2, 0,        exctsccr, exctsccr, exctsccr, ROT270, "Alpha Denshi Co.", "Exciting Soccer II", GAME_IMPERFECT_GRAPHICS )
src/mame/drivers/ssozumo.c
r2956r2957
3434{
3535   static int coin;
3636
37   if ((input_port_read_indexed(machine, 0) & 0xc0) != 0xc0)
37   if ((input_port_read(machine, "P1") & 0xc0) != 0xc0)
3838   {
3939      if (coin == 0)
4040      {
r2956r2957
6262   AM_RANGE(0x2000, 0x27ff) AM_READ(SMH_RAM)
6363   AM_RANGE(0x3000, 0x31ff) AM_READ(SMH_RAM)
6464
65   AM_RANGE(0x4000, 0x4000) AM_READ(input_port_0_r)
66   AM_RANGE(0x4010, 0x4010) AM_READ(input_port_1_r)
67   AM_RANGE(0x4020, 0x4020) AM_READ(input_port_2_r)
68   AM_RANGE(0x4030, 0x4030) AM_READ(input_port_3_r)
65   AM_RANGE(0x4000, 0x4000) AM_READ_PORT("P1")
66   AM_RANGE(0x4010, 0x4010) AM_READ_PORT("P2")
67   AM_RANGE(0x4020, 0x4020) AM_READ_PORT("DSW2")
68   AM_RANGE(0x4030, 0x4030) AM_READ_PORT("DSW1")
6969
7070   AM_RANGE(0x6000, 0xffff) AM_READ(SMH_ROM)
7171ADDRESS_MAP_END
r2956r2957
112112
113113
114114static INPUT_PORTS_START( ssozumo )
115   PORT_START   /* IN0 */
115   PORT_START_TAG("P1")   /* IN0 */
116116   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
117117   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
118118   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
r2956r2957
122122   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
123123   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
124124
125   PORT_START   /* IN1 */
125   PORT_START_TAG("P2")   /* IN1 */
126126   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
127127   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
128128   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
132132   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
133133   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
134134
135   PORT_START      /* DSW2 */
135   PORT_START_TAG("DSW2")   /* DSW2 */
136136   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Difficulty ) )
137137   PORT_DIPSETTING(    0x01, DEF_STR( Normal ) )
138138   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
r2956r2957
158158   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
159159   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
160160
161   PORT_START      /* DSW1 */
161   PORT_START_TAG("DSW1")   /* DSW1 */
162162   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_B ) )
163163   PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
164164   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
src/mame/drivers/twin16.c
r2956r2957
218218{
219219   switch( offset )
220220   {
221      case 0x00: return input_port_read_indexed(machine, 0); // coin
222      case 0x01: return input_port_read_indexed(machine, 1); // p1
223      case 0x02: return input_port_read_indexed(machine, 2); // p2
224      case 0x03: return input_port_read_indexed(machine, 3); // p3 (Dark Adventure)
225      case 0x08: return input_port_read_indexed(machine, 5); // DSW1
226      case 0x09: return input_port_read_indexed(machine, 4); // DSW2
227      case 0x0c: return input_port_read_indexed(machine, 6); // DSW3
221      case 0x00: return input_port_read(machine, "SYSTEM");
222      case 0x01: return input_port_read(machine, "P1");
223      case 0x02: return input_port_read(machine, "P2");
224      case 0x03: return input_port_read(machine, "P3");
225      case 0x08: return input_port_read(machine, "DSW2");
226      case 0x09: return input_port_read(machine, "DSW1");
227      case 0x0c: return input_port_read(machine, "DSW3");
228228   }
229229   return 0;
230230}
r2956r2957
327327
328328/* Input Ports */
329329
330#define KONAMI_TWIN_COINAGE PORT_START \
330#define KONAMI_TWIN_COINAGE PORT_START_TAG("DSW1") \
331331   PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_A ) ) \
332332   PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) ) \
333333   PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) ) \
r2956r2957
364364   PORT_DIPSETTING(    0x00, "Disabled" )
365365
366366static INPUT_PORTS_START( devilw )
367   PORT_START      /* 0xa0001 */
367   PORT_START_TAG("SYSTEM")   /* 0xa0001 */
368368   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
369369   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
370370   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
374374   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
375375   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
376376
377   PORT_START      /* 0xa0003 */
377   PORT_START_TAG("P1")   /* 0xa0003 */
378378   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
379379   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
380380   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
384384   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )   // jump
385385   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
386386
387   PORT_START      /* 0xa0005 */
387   PORT_START_TAG("P2")   /* 0xa0005 */
388388   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
389389   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
390390   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
394394   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
395395   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
396396
397   PORT_START      /* 0xa0007 */
397   PORT_START_TAG("P3")   /* 0xa0007 */
398398   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
399399
400400   KONAMI_TWIN_COINAGE
401401
402   PORT_START   /* DSW2 */
402   PORT_START_TAG("DSW2")   /* DSW2 */
403403   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
404404   PORT_DIPSETTING(    0x03, "2" )
405405   PORT_DIPSETTING(    0x02, "3" )
r2956r2957
415415   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
416416   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
417417
418   PORT_START   /* DSW3 0xa0019 */
418   PORT_START_TAG("DSW3")   /* DSW3 0xa0019 */
419419   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
420420   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
421421   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
426426INPUT_PORTS_END
427427
428428static INPUT_PORTS_START( darkadv )
429   PORT_START      /* 0xa0001 */
429   PORT_START_TAG("SYSTEM")   /* 0xa0001 */
430430   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
431431   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
432432   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 )
r2956r2957
436436   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
437437   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE2 )
438438
439   PORT_START      /* 0xa0003 */
439   PORT_START_TAG("P1")   /* 0xa0003 */
440440   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
441441   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
442442   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
446446   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )   // dynamite
447447   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE3 )
448448
449   PORT_START      /* 0xa0005 */
449   PORT_START_TAG("P2")   /* 0xa0005 */
450450   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
451451   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
452452   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
456456   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
457457   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
458458
459   PORT_START      /* 0xa0007 */
459   PORT_START_TAG("P3")   /* 0xa0007 */
460460   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(3)
461461   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(3)
462462   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(3)
r2956r2957
466466   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(3)
467467   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
468468
469   PORT_START   /* Coinage */
469   PORT_START_TAG("DSW1")   /* Coinage */
470470   PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coinage ) )
471471   PORT_DIPSETTING(    0x02, DEF_STR( 4C_1C ) )
472472   PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
r2956r2957
486486   PORT_DIPSETTING(    0x00, "Invalid" )
487487   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED)
488488
489   PORT_START   /* DSW2 */
489   PORT_START_TAG("DSW2")   /* DSW2 */
490490   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
491491   PORT_DIPSETTING(    0x03, "2" )
492492   PORT_DIPSETTING(    0x02, "3" )
r2956r2957
502502   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
503503   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
504504
505   PORT_START   /* DSW3 0xa0019 */
505   PORT_START_TAG("DSW3")   /* DSW3 0xa0019 */
506506   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
507507   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
508508   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
513513INPUT_PORTS_END
514514
515515static INPUT_PORTS_START( vulcan )
516   PORT_START      /* 0xa0001 */
516   PORT_START_TAG("SYSTEM")   /* 0xa0001 */
517517   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
518518   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
519519   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
523523   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
524524   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
525525
526   PORT_START      /* 0xa0003 */
526   PORT_START_TAG("P1")   /* 0xa0003 */
527527   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
528528   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
529529   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
533533   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )   // missile
534534   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
535535
536   PORT_START      /* 0xa0005 */
536   PORT_START_TAG("P2")   /* 0xa0005 */
537537   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
538538   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
539539   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
543543   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
544544   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
545545
546   PORT_START      /* 0xa0007 */
546   PORT_START_TAG("P3")   /* 0xa0007 */
547547   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
548548
549549   KONAMI_TWIN_COINAGE
550550
551   PORT_START   /* DSW2 */
551   PORT_START_TAG("DSW2")   /* DSW2 */
552552   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
553553   PORT_DIPSETTING(    0x03, "2" )
554554   PORT_DIPSETTING(    0x02, "3" )
r2956r2957
571571   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
572572   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
573573
574   PORT_START   /* DSW3 0xa0018 */
574   PORT_START_TAG("DSW3")   /* DSW3 0xa0018 */
575575   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
576576   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
577577   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
585585
586586
587587static INPUT_PORTS_START( gradius2 )   // same as vulcan, different bonus
588   PORT_START      /* 0xa0001 */
588   PORT_START_TAG("SYSTEM")   /* 0xa0001 */
589589   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
590590   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
591591   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
595595   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
596596   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
597597
598   PORT_START      /* 0xa0003 */
598   PORT_START_TAG("P1")   /* 0xa0003 */
599599   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
600600   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
601601   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
605605   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )   // missile
606606   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
607607
608   PORT_START      /* 0xa0005 */
608   PORT_START_TAG("P2")   /* 0xa0005 */
609609   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
610610   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
611611   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
615615   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
616616   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
617617
618   PORT_START      /* 0xa0007 */
618   PORT_START_TAG("P3")   /* 0xa0007 */
619619   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
620620
621621   KONAMI_TWIN_COINAGE
622622
623   PORT_START   /* DSW2 */
623   PORT_START_TAG("DSW2")   /* DSW2 */
624624   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
625625   PORT_DIPSETTING(    0x03, "2" )
626626   PORT_DIPSETTING(    0x02, "3" )
r2956r2957
643643   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
644644   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
645645
646   PORT_START   /* DSW3 0xa0018 */
646   PORT_START_TAG("DSW3")   /* DSW3 0xa0018 */
647647   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
648648   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
649649   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
656656INPUT_PORTS_END
657657
658658static INPUT_PORTS_START( fround )
659   PORT_START      /* 0xa0001 */
659   PORT_START_TAG("SYSTEM")   /* 0xa0001 */
660660   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
661661   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
662662   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
666666   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
667667   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
668668
669   PORT_START      /* 0xa0003 */
669   PORT_START_TAG("P1")   /* 0xa0003 */
670670   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
671671   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
672672   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
676676   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )   // defend
677677   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
678678
679   PORT_START      /* 0xa0005 */
679   PORT_START_TAG("P2")   /* 0xa0005 */
680680   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
681681   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
682682   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
686686   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
687687   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED)
688688
689   PORT_START      /* 0xa0007 */
689   PORT_START_TAG("P3")   /* 0xa0007 */
690690   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
691691
692692   KONAMI_TWIN_COINAGE
693693
694   PORT_START   /* DSW2 */
694   PORT_START_TAG("DSW2")   /* DSW2 */
695695   PORT_DIPNAME( 0x03, 0x02, "Energy" )
696696   PORT_DIPSETTING(    0x03, "18" )
697697   PORT_DIPSETTING(    0x02, "20" )
r2956r2957
707707   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
708708   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
709709
710   PORT_START   /* DSW3 0xa0018 */
710   PORT_START_TAG("DSW3")   /* DSW3 0xa0018 */
711711   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
712712   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
713713   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
718718INPUT_PORTS_END
719719
720720static INPUT_PORTS_START( miaj )
721   PORT_START      /* 0xa0001 */
721   PORT_START_TAG("SYSTEM")   /* 0xa0001 */
722722   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
723723   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
724724   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
728728   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
729729   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
730730
731   PORT_START      /* 0xa0003 */
731   PORT_START_TAG("P1")   /* 0xa0003 */
732732   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
733733   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
734734   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
738738   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )   // choice
739739   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
740740
741   PORT_START      /* 0xa0005 */
741   PORT_START_TAG("P2")   /* 0xa0005 */
742742   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
743743   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
744744   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
748748   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
749749   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
750750
751   PORT_START      /* 0xa0007 */
751   PORT_START_TAG("P3")   /* 0xa0007 */
752752   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
753753
754754   KONAMI_TWIN_COINAGE
755755
756   PORT_START   /* DSW2 */
756   PORT_START_TAG("DSW2")   /* DSW2 */
757757   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
758758   PORT_DIPSETTING(    0x03, "2" )
759759   PORT_DIPSETTING(    0x02, "3" )
r2956r2957
774774   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
775775   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
776776
777   PORT_START   /* DSW3 0xa0018 */
777   PORT_START_TAG("DSW3")   /* DSW3 0xa0018 */
778778   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
779779   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
780780   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
787787INPUT_PORTS_END
788788
789789static INPUT_PORTS_START( cuebrckj )
790   PORT_START      /* 0xa0001 */
790   PORT_START_TAG("SYSTEM")   /* 0xa0001 */
791791   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
792792   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
793793   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
r2956r2957
797797   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 )
798798   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
799799
800   PORT_START      /* 0xa0003 */
800   PORT_START_TAG("P1")   /* 0xa0003 */
801801   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
802802   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
803803   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
807807   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )   // stop
808808   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
809809
810   PORT_START      /* 0xa0005 */
810   PORT_START_TAG("P2")   /* 0xa0005 */
811811   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
812812   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
813813   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
r2956r2957
817817   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
818818   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
819819
820   PORT_START      /* 0xa0007 */
820   PORT_START_TAG("P3")   /* 0xa0007 */
821821   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
822822
823823   KONAMI_TWIN_COINAGE
824824
825   PORT_START   /* DSW2 */
825   PORT_START_TAG("DSW2")   /* DSW2 */
826826   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
827827   PORT_DIPSETTING(    0x03, "1" )
828828   PORT_DIPSETTING(    0x02, "2" )
r2956r2957
845845   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
846846   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
847847
848   PORT_START   /* DSW3 0xa0018 */
848   PORT_START_TAG("DSW3")   /* DSW3 0xa0018 */
849849   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
850850   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
851851   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
src/mame/drivers/srmp6.c
r2956r2957
317317static READ16_HANDLER( srmp6_inputs_r )
318318{
319319   if (offset == 0)         // DSW
320      return input_port_read_indexed(machine, 4);
320      return input_port_read(machine, "DSW");
321321
322322   switch(srmp6_input_select)   // inputs
323323   {
324      case 1<<0: return input_port_read_indexed(machine, 0);
325      case 1<<1: return input_port_read_indexed(machine, 1);
326      case 1<<2: return input_port_read_indexed(machine, 2);
327      case 1<<3: return input_port_read_indexed(machine, 3);
324      case 1<<0: return input_port_read(machine, "KEY0");
325      case 1<<1: return input_port_read(machine, "KEY1");
326      case 1<<2: return input_port_read(machine, "KEY2");
327      case 1<<3: return input_port_read(machine, "KEY3");
328328   }
329329
330330   return 0;
r2956r2957
578578
579579static INPUT_PORTS_START( srmp6 )
580580
581   PORT_START
582   PORT_BIT ( 0xfe01, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded
583   PORT_BIT ( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_A )
584   PORT_BIT ( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_E )
585   PORT_BIT ( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_I )
586   PORT_BIT ( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_M )
587   PORT_BIT ( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
588   PORT_BIT ( 0x0040, IP_ACTIVE_LOW, IPT_START1 )
589   PORT_BIT ( 0x0080, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
581   PORT_START_TAG("KEY0")
582   PORT_BIT( 0xfe01, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded
583   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_A )
584   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_E )
585   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_I )
586   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_M )
587   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
588   PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_START1 )
589   PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
590590   PORT_SERVICE_NO_TOGGLE( 0x0100, IP_ACTIVE_LOW )
591591
592   PORT_START
593   PORT_BIT ( 0xfe41, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded
594   PORT_BIT ( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_B )
595   PORT_BIT ( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_F )
596   PORT_BIT ( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_J )
597   PORT_BIT ( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_N )
598   PORT_BIT ( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
599   PORT_BIT ( 0x0180, IP_ACTIVE_LOW, IPT_UNUSED )
592   PORT_START_TAG("KEY1")
593   PORT_BIT( 0xfe41, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded
594   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_B )
595   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_F )
596   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_J )
597   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_N )
598   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
599   PORT_BIT( 0x0180, IP_ACTIVE_LOW, IPT_UNUSED )
600600
601   PORT_START
602   PORT_BIT ( 0xfe41, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded
603   PORT_BIT ( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_C )
604   PORT_BIT ( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_G )
605   PORT_BIT ( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_K )
606   PORT_BIT ( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
607   PORT_BIT ( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
608   PORT_BIT ( 0x0180, IP_ACTIVE_LOW, IPT_UNUSED )
601   PORT_START_TAG("KEY2")
602   PORT_BIT( 0xfe41, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded
603   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_C )
604   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_G )
605   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_K )
606   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
607   PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
608   PORT_BIT( 0x0180, IP_ACTIVE_LOW, IPT_UNUSED )
609609
610   PORT_START
611   PORT_BIT ( 0xfe61, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded
612   PORT_BIT ( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_D )
613   PORT_BIT ( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_H )
614   PORT_BIT ( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_L )
615   PORT_BIT ( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
616   PORT_BIT ( 0x0180, IP_ACTIVE_LOW, IPT_UNUSED )
610   PORT_START_TAG("KEY3")
611   PORT_BIT( 0xfe61, IP_ACTIVE_LOW, IPT_UNUSED ) // explicitely discarded
612   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_MAHJONG_D )
613   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_MAHJONG_H )
614   PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_MAHJONG_L )
615   PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
616   PORT_BIT( 0x0180, IP_ACTIVE_LOW, IPT_UNUSED )
617617
618   PORT_START   /* 16-bit DSW1+DSW2 */
618   PORT_START_TAG("DSW")   /* 16-bit DSW1+DSW2 */
619619   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coinage ) )      // DSW1
620620   PORT_DIPSETTING(      0x0000, DEF_STR( 5C_1C ) )
621621   PORT_DIPSETTING(      0x0001, DEF_STR( 4C_1C ) )
r2956r2957
741741
742742/*GAME( YEAR,NAME,PARENT,MACHINE,INPUT,INIT,MONITOR,COMPANY,FULLNAME,FLAGS)*/
743743GAME( 1995, srmp6, 0, srmp6, srmp6, 0, ROT0, "Seta", "Super Real Mahjong P6 (Japan)", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND)
744
src/mame/drivers/sf.c
r2956r2957
165165
166166static READ16_HANDLER( button1_r )
167167{
168   return (scale[input_port_read_indexed(machine, 7)]<<8)|scale[input_port_read_indexed(machine, 5)];
168   return (scale[input_port_read(machine, "IN3")]<<8) | scale[input_port_read(machine, "IN1")];
169169}
170170
171171static READ16_HANDLER( button2_r )
172172{
173   return (scale[input_port_read_indexed(machine, 8)]<<8)|scale[input_port_read_indexed(machine, 6)];
173   return (scale[input_port_read(machine, "IN4")]<<8) | scale[input_port_read(machine, "IN2")];
174174}
175175
176176
r2956r2957
194194static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 16 )
195195   AM_RANGE(0x000000, 0x04ffff) AM_READ(SMH_ROM)
196196   AM_RANGE(0x800000, 0x800fff) AM_READ(SMH_RAM)
197   AM_RANGE(0xc00000, 0xc00001) AM_READ(input_port_3_word_r)
198   AM_RANGE(0xc00002, 0xc00003) AM_READ(input_port_4_word_r)
197   AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("COINS")
198   AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("IN0")
199199   AM_RANGE(0xc00004, 0xc00005) AM_READ(button1_r)
200200   AM_RANGE(0xc00006, 0xc00007) AM_READ(button2_r)
201   AM_RANGE(0xc00008, 0xc00009) AM_READ(input_port_0_word_r)
202   AM_RANGE(0xc0000a, 0xc0000b) AM_READ(input_port_1_word_r)
203   AM_RANGE(0xc0000c, 0xc0000d) AM_READ(input_port_2_word_r)
201   AM_RANGE(0xc00008, 0xc00009) AM_READ_PORT("DSW1")
202   AM_RANGE(0xc0000a, 0xc0000b) AM_READ_PORT("DSW2")
203   AM_RANGE(0xc0000c, 0xc0000d) AM_READ_PORT("SYSTEM")
204204   AM_RANGE(0xc0000e, 0xc0000f) AM_READ(dummy_r)
205205   AM_RANGE(0xff8000, 0xffdfff) AM_READ(SMH_RAM)
206206   AM_RANGE(0xffe000, 0xffffff) AM_READ(SMH_RAM)
r2956r2957
209209static ADDRESS_MAP_START( readmemus, ADDRESS_SPACE_PROGRAM, 16 )
210210   AM_RANGE(0x000000, 0x04ffff) AM_READ(SMH_ROM)
211211   AM_RANGE(0x800000, 0x800fff) AM_READ(SMH_RAM)
212   AM_RANGE(0xc00000, 0xc00001) AM_READ(input_port_3_word_r)
213   AM_RANGE(0xc00002, 0xc00003) AM_READ(input_port_4_word_r)
212   AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("IN0")
213   AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("IN1")
214214   AM_RANGE(0xc00004, 0xc00005) AM_READ(dummy_r)
215215   AM_RANGE(0xc00006, 0xc00007) AM_READ(dummy_r)
216   AM_RANGE(0xc00008, 0xc00009) AM_READ(input_port_0_word_r)
217   AM_RANGE(0xc0000a, 0xc0000b) AM_READ(input_port_1_word_r)
218   AM_RANGE(0xc0000c, 0xc0000d) AM_READ(input_port_2_word_r)
216   AM_RANGE(0xc00008, 0xc00009) AM_READ_PORT("DSW1")
217   AM_RANGE(0xc0000a, 0xc0000b) AM_READ_PORT("DSW2")
218   AM_RANGE(0xc0000c, 0xc0000d) AM_READ_PORT("SYSTEM")
219219   AM_RANGE(0xc0000e, 0xc0000f) AM_READ(dummy_r)
220220   AM_RANGE(0xff8000, 0xffdfff) AM_READ(SMH_RAM)
221221   AM_RANGE(0xffe000, 0xffffff) AM_READ(SMH_RAM)
r2956r2957
224224static ADDRESS_MAP_START( readmemjp, ADDRESS_SPACE_PROGRAM, 16 )
225225   AM_RANGE(0x000000, 0x04ffff) AM_READ(SMH_ROM)
226226   AM_RANGE(0x800000, 0x800fff) AM_READ(SMH_RAM)
227   AM_RANGE(0xc00000, 0xc00001) AM_READ(input_port_3_word_r)
228   AM_RANGE(0xc00002, 0xc00003) AM_READ(input_port_4_word_r)
229   AM_RANGE(0xc00004, 0xc00005) AM_READ(input_port_5_word_r)
227   AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("COINS")
228   AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("P1")
229   AM_RANGE(0xc00004, 0xc00005) AM_READ_PORT("P2")
230230   AM_RANGE(0xc00006, 0xc00007) AM_READ(dummy_r)
231   AM_RANGE(0xc00008, 0xc00009) AM_READ(input_port_0_word_r)
232   AM_RANGE(0xc0000a, 0xc0000b) AM_READ(input_port_1_word_r)
233   AM_RANGE(0xc0000c, 0xc0000d) AM_READ(input_port_2_word_r)
231   AM_RANGE(0xc00008, 0xc00009) AM_READ_PORT("DSW1")
232   AM_RANGE(0xc0000a, 0xc0000b) AM_READ_PORT("DSW2")
233   AM_RANGE(0xc0000c, 0xc0000d) AM_READ_PORT("SYSTEM")
234234   AM_RANGE(0xc0000e, 0xc0000f) AM_READ(dummy_r)
235235   AM_RANGE(0xff8000, 0xffdfff) AM_READ(SMH_RAM)
236236   AM_RANGE(0xffe000, 0xffffff) AM_READ(SMH_RAM)
r2956r2957
291291
292292
293293static INPUT_PORTS_START( sf )
294   PORT_START
294   PORT_START_TAG("DSW1")
295295   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )
296296   PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
297297   PORT_DIPSETTING(      0x0001, DEF_STR( 3C_1C ) )
r2956r2957
339339   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
340340   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )
341341
342   PORT_START
342   PORT_START_TAG("DSW2")
343343   PORT_DIPNAME( 0x0007, 0x0007, "Continuation max stage" )
344344   PORT_DIPSETTING(      0x0007, "5th" )
345345   PORT_DIPSETTING(      0x0006, "4th" )
r2956r2957
373373   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
374374   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
375375
376   PORT_START
376   PORT_START_TAG("SYSTEM")
377377   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
378378   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
379379   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
391391   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
392392   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
393393
394   PORT_START
394   PORT_START_TAG("COINS")
395395   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
396396   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
397397   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
409409   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
410410   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
411411
412   PORT_START
412   PORT_START_TAG("IN0")
413413   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
414414   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
415415   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
427427   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
428428   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
429429
430   PORT_START
430   PORT_START_TAG("IN1")
431431   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
432432   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)
433433   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(1)
r2956r2957
437437   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
438438   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
439439
440   PORT_START
440   PORT_START_TAG("IN2")
441441   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(1)
442442   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(1)
443443   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(1)
r2956r2957
447447   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
448448   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
449449
450   PORT_START
450   PORT_START_TAG("IN3")
451451   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
452452   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)
453453   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2)
r2956r2957
457457   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
458458   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
459459
460   PORT_START
460   PORT_START_TAG("IN4")
461461   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2)
462462   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_PLAYER(2)
463463   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_PLAYER(2)
r2956r2957
469469INPUT_PORTS_END
470470
471471static INPUT_PORTS_START( sfus )
472   PORT_START
472   PORT_START_TAG("DSW1")
473473   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )
474474   PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
475475   PORT_DIPSETTING(      0x0001, DEF_STR( 3C_1C ) )
r2956r2957
517517   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
518518   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )
519519
520   PORT_START
520   PORT_START_TAG("DSW2")
521521   PORT_DIPNAME( 0x0007, 0x0007, "Continuation max stage" )
522522   PORT_DIPSETTING(      0x0007, "5th" )
523523   PORT_DIPSETTING(      0x0006, "4th" )
r2956r2957
551551   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
552552   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
553553
554   PORT_START
554   PORT_START_TAG("SYSTEM")
555555   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
556556   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
557557   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
569569   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
570570   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
571571
572   PORT_START
572   PORT_START_TAG("IN0")
573573   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
574574   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
575575   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
r2956r2957
587587   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
588588   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
589589
590   PORT_START
590   PORT_START_TAG("IN1")
591591   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
592592   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
593593   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
607607INPUT_PORTS_END
608608
609609static INPUT_PORTS_START( sfjp )
610   PORT_START
610   PORT_START_TAG("DSW1")
611611   PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) )
612612   PORT_DIPSETTING(      0x0000, DEF_STR( 4C_1C ) )
613613   PORT_DIPSETTING(      0x0001, DEF_STR( 3C_1C ) )
r2956r2957
655655   PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
656656   PORT_SERVICE( 0x8000, IP_ACTIVE_LOW )
657657
658   PORT_START
658   PORT_START_TAG("DSW2")
659659   PORT_DIPNAME( 0x0007, 0x0007, "Continuation max stage" )
660660   PORT_DIPSETTING(      0x0007, "5th" )
661661   PORT_DIPSETTING(      0x0006, "4th" )
r2956r2957
689689   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
690690   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
691691
692   PORT_START
692   PORT_START_TAG("SYSTEM")
693693   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1 )
694694   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2 )
695695   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
707707   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
708708   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
709709
710   PORT_START
710   PORT_START_TAG("COINS")
711711   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
712712   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
713713   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
r2956r2957
725725   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
726726   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
727727
728   PORT_START
728   PORT_START_TAG("P1")
729729   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
730730   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
731731   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
r2956r2957
743743   PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_PLAYER(1)
744744   PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
745745
746   PORT_START
746   PORT_START_TAG("P2")
747747   PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
748748   PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
749749   PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
src/mame/drivers/sengokmj.c
r2956r2957
6767{
6868   switch(sengokumj_mux_data)
6969   {
70      case 1:    return input_port_read_indexed(machine, 2);
71      case 2:    return input_port_read_indexed(machine, 3);
72      case 4:    return input_port_read_indexed(machine, 4);
73      case 8:    return input_port_read_indexed(machine, 5);
74      case 0x10: return input_port_read_indexed(machine, 6);
75      case 0x20: return input_port_read_indexed(machine, 7);
70      case 1:    return input_port_read(machine, "KEY0");
71      case 2:    return input_port_read(machine, "KEY1");
72      case 4:    return input_port_read(machine, "KEY2");
73      case 8:    return input_port_read(machine, "KEY3");
74      case 0x10: return input_port_read(machine, "KEY4");
75      case 0x20: return input_port_read(machine, "UNUSED");
7676   }
7777
7878   return 0xffff;
r2956r2957
130130   AM_RANGE(0x8080, 0x8081) AM_WRITENOP // ?
131131   AM_RANGE(0x80c0, 0x80c1) AM_WRITENOP // ?
132132   AM_RANGE(0x8140, 0x8141) AM_WRITE(mahjong_panel_w)
133   AM_RANGE(0xc000, 0xc001) AM_READ(input_port_1_word_r)
133   AM_RANGE(0xc000, 0xc001) AM_READ_PORT("DSW1")
134134   AM_RANGE(0xc002, 0xc003) AM_READ(mahjong_panel_r)
135   AM_RANGE(0xc004, 0xc005) AM_READ(input_port_8_word_r)
135   AM_RANGE(0xc004, 0xc005) AM_READ_PORT("DSW2")
136136ADDRESS_MAP_END
137137
138138
139139static INPUT_PORTS_START( sengokmj )
140140   SEIBU_COIN_INPUTS   /* coin inputs read through sound cpu */
141141
142   PORT_START
142   PORT_START_TAG("DSW1")
143143   PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Demo_Sounds ) )
144144   PORT_DIPSETTING(     0x0001, DEF_STR( Off ) )
145145   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
r2956r2957
166166   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
167167   PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
168168
169   PORT_START
169   PORT_START_TAG("KEY0")
170170   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
171171   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
172172   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
r2956r2957
176176   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
177177   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
178178
179   PORT_START
179   PORT_START_TAG("KEY1")
180180   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
181181   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
182182   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
r2956r2957
186186   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
187187   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
188188
189   PORT_START
189   PORT_START_TAG("KEY2")
190190   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
191191   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
192192   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
r2956r2957
196196   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
197197   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
198198
199   PORT_START
199   PORT_START_TAG("KEY3")
200200   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
201201   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
202202   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
r2956r2957
206206   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
207207   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
208208
209   PORT_START
209   PORT_START_TAG("KEY4")
210210   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
211211   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
212212   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
r2956r2957
216216   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
217217   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
218218
219   PORT_START
219   PORT_START_TAG("UNUSED")
220220   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
221221
222   PORT_START
222   PORT_START_TAG("DSW2")
223223   PORT_DIPNAME( 0x0001, 0x0001, "Door" )
224224   PORT_DIPSETTING(     0x0001, DEF_STR( Off ) )
225225   PORT_DIPSETTING(     0x0000, DEF_STR( On ) )
src/mame/drivers/cave.c
r2956r2957
19631963   /* modify the eeprom on a reset with the desired region for the games that have the
19641964       region factory set in eeprom */
19651965   if (cave_region_byte >= 0)
1966      eeprom_get_data_pointer(0)[cave_region_byte] =  input_port_read(machine, "EEPROM");
1966      ((UINT8 *)eeprom_get_data_pointer(NULL,NULL))[cave_region_byte] =  input_port_read(machine, "EEPROM");
19671967}
19681968
19691969static const struct YMZ280Binterface ymz280b_intf =
src/mame/drivers/tourtabl.c
r2956r2957
5454
5555static READ16_HANDLER( tourtabl_read_input_port )
5656{
57   return input_port_read_indexed(machine, offset);
57   static const char *tianames[] = { "PADDLE4", "PADDLE3", "PADDLE2", "PADDLE1", "TIA_IN4", "TIA_IN5" };
58
59   return input_port_read(machine, tianames[offset]);
5860}
5961
6062static READ8_HANDLER( tourtabl_get_databus_contents )
r2956r2957
130132
131133static INPUT_PORTS_START( tourtabl )
132134
133   PORT_START
135   PORT_START_TAG("PADDLE4")
134136   PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_SENSITIVITY(40) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_REVERSE PORT_PLAYER(4)
135137
136   PORT_START
138   PORT_START_TAG("PADDLE3")
137139   PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_SENSITIVITY(40) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_REVERSE PORT_PLAYER(3)
138140
139   PORT_START
141   PORT_START_TAG("PADDLE2")
140142   PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_SENSITIVITY(40) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_REVERSE PORT_PLAYER(2)
141143
142   PORT_START
144   PORT_START_TAG("PADDLE1")
143145   PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_SENSITIVITY(40) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_REVERSE PORT_PLAYER(1)
144146
145   PORT_START /* TIA INPT4 */
147   PORT_START_TAG("TIA_IN4")   /* TIA INPT4 */
146148   PORT_DIPNAME( 0x80, 0x80, "Breakout Replay" )
147149   PORT_DIPSETTING(    0x00, DEF_STR( Off ))
148150   PORT_DIPSETTING(    0x80, DEF_STR( On ))
149151
150   PORT_START /* TIA INPT5 */
152   PORT_START_TAG("TIA_IN5")   /* TIA INPT5 */
151153   PORT_DIPNAME( 0x80, 0x80, "Game Length" )
152154   PORT_DIPSETTING(    0x00, "11 points (3 balls)" )
153155   PORT_DIPSETTING(    0x80, "15 points (5 balls)" )
154156
155   PORT_START /* RIOT #0 SWCHA */
157   PORT_START_TAG("RIOT0_SWA")   /* RIOT #0 SWCHA */
156158   PORT_DIPNAME( 0x0F, 0x0E, "Replay Level" )
157159   PORT_DIPSETTING(    0x0B, "200 points" )
158160   PORT_DIPSETTING(    0x0C, "250 points" )
159161   PORT_DIPSETTING(    0x0D, "300 points" )
160162   PORT_DIPSETTING(    0x0E, "400 points" )
161163   PORT_DIPSETTING(    0x0F, "450 points" )
162   PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
163   PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
164   PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
165   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
164   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(4)
165   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(3)
166   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
167   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
166168
167   PORT_START /* RIOT #0 SWCHB */
169   PORT_START_TAG("RIOT0_SWB")   /* RIOT #0 SWCHB */
168170   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Game Select") PORT_CODE(KEYCODE_SPACE)
169   PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_TILT )
170   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
171   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT )
172   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
171173
172   PORT_START /* RIOT #1 SWCHA */
174   PORT_START_TAG("RIOT1_SWA")/* RIOT #1 SWCHA */
173175   PORT_DIPNAME( 0x0F, 0x07, DEF_STR( Coinage ))
174176   PORT_DIPSETTING(    0x00, "Mode A" )
175177   PORT_DIPSETTING(    0x01, "Mode B" )
r2956r2957
193195   PORT_DIPSETTING(    0x20, DEF_STR( German ) )
194196   PORT_DIPSETTING(    0x30, DEF_STR( Spanish ) )
195197   PORT_SERVICE( 0x40, IP_ACTIVE_HIGH )
196   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
198   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
197199
198   PORT_START /* RIOT #1 SWCHB */
199   PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_START4 )
200   PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_START2 )
201   PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_START1 )
200   PORT_START_TAG("RIOT1_SWB")   /* RIOT #1 SWCHB */
201   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START4 )
202   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 )
203   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
202204
203205INPUT_PORTS_END
204206
src/mame/drivers/thepit.c
r2956r2957
544544   PORT_DIPSETTING(    0x20, "Number of Wrong Answer" )
545545   PORT_DIPSETTING(    0x00, "Number of Good Answer for Bonus Question" )
546546   PORT_DIPNAME( 0xc0, 0x40, "Gaming Option Number" )
547   PORT_DIPSETTING(    0x00, "2" ) PORT_CONDITION("DSW",0x20,PORTCOND_EQUALS,0x20)
548   PORT_DIPSETTING(    0x40, "3" ) PORT_CONDITION("DSW",0x20,PORTCOND_EQUALS,0x20)
549   PORT_DIPSETTING(    0x80, "4" ) PORT_CONDITION("DSW",0x20,PORTCOND_EQUALS,0x20)
550   PORT_DIPSETTING(    0xc0, "5" ) PORT_CONDITION("DSW",0x20,PORTCOND_EQUALS,0x20)
551   PORT_DIPSETTING(    0x00, "4" ) PORT_CONDITION("DSW",0x20,PORTCOND_NOTEQUALS,0x20)
552   PORT_DIPSETTING(    0x40, "5" ) PORT_CONDITION("DSW",0x20,PORTCOND_NOTEQUALS,0x20)
553   PORT_DIPSETTING(    0x80, "6" ) PORT_CONDITION("DSW",0x20,PORTCOND_NOTEQUALS,0x20)
554   PORT_DIPSETTING(    0xc0, "7" ) PORT_CONDITION("DSW",0x20,PORTCOND_NOTEQUALS,0x20)
547   PORT_DIPSETTING(    0x00, "2" ) PORT_CONDITION("DSW", 0x20, PORTCOND_EQUALS, 0x20)
548   PORT_DIPSETTING(    0x40, "3" ) PORT_CONDITION("DSW", 0x20, PORTCOND_EQUALS, 0x20)
549   PORT_DIPSETTING(    0x80, "4" ) PORT_CONDITION("DSW", 0x20, PORTCOND_EQUALS, 0x20)
550   PORT_DIPSETTING(    0xc0, "5" ) PORT_CONDITION("DSW", 0x20, PORTCOND_EQUALS, 0x20)
551   PORT_DIPSETTING(    0x00, "4" ) PORT_CONDITION("DSW", 0x20, PORTCOND_NOTEQUALS, 0x20)
552   PORT_DIPSETTING(    0x40, "5" ) PORT_CONDITION("DSW", 0x20, PORTCOND_NOTEQUALS, 0x20)
553   PORT_DIPSETTING(    0x80, "6" ) PORT_CONDITION("DSW", 0x20, PORTCOND_NOTEQUALS, 0x20)
554   PORT_DIPSETTING(    0xc0, "7" ) PORT_CONDITION("DSW", 0x20, PORTCOND_NOTEQUALS, 0x20)
555555
556556   /* Since the real inputs are multiplexed, we used this fake port
557557       to read the 2nd player controls when the screen is flipped */
558558   PORT_START_TAG("IN2")
559   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 )
560   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 )
561   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 )
562   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 )
559   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
560   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)
561   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_PLAYER(2)
562   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2)
563563   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
564564   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
565565   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
src/mame/drivers/changela.c
r2956r2957
319319
320320static INPUT_PORTS_START( changela )
321321   PORT_START_TAG("DSWA")   /* DSWA */
322   PORT_DIPNAME( 0x07, 0x01, "Steering Wheel Ratio" )
323   PORT_DIPSETTING(    0x01, "Recommended" )
324   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) )
322   PORT_DIPNAME( 0x07, 0x01, "Steering Wheel Ratio" )      PORT_DIPLOCATION("SWA:1,2,3")
323   //PORT_DIPSETTING(    0x00, "?" ) /* Not documented */
324   PORT_DIPSETTING(    0x01, "Recommended Setting" )
325   //PORT_DIPSETTING(    0x02, "?" ) /* Not documented */
326   //PORT_DIPSETTING(    0x03, "?" ) /* Not documented */
327   //PORT_DIPSETTING(    0x04, "?" ) /* Not documented */
328   //PORT_DIPSETTING(    0x05, "?" ) /* Not documented */
329   //PORT_DIPSETTING(    0x06, "?" ) /* Not documented */
330   //PORT_DIPSETTING(    0x07, "?" ) /* Not documented */
331   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) )      PORT_DIPLOCATION("SWA:4")
325332   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
326333   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
327   PORT_DIPNAME( 0x10, 0x00, "Ignore Memory Failures" )
334   PORT_DIPNAME( 0x10, 0x00, "Ignore Memory Failures" )   PORT_DIPLOCATION("SWA:5")
328335   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
329336   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
330   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Controls ) )
337   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Controls ) )         PORT_DIPLOCATION("SWA:6")
331338   PORT_DIPSETTING(    0x20, DEF_STR( Joystick ) )
332339   PORT_DIPSETTING(    0x00, "Steering Wheel" )
333   PORT_DIPNAME( 0x40, 0x40, "Diagnostic" )
340   PORT_DIPNAME( 0x40, 0x40, "Diagnostic" )            PORT_DIPLOCATION("SWA:7")
334341   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
335342   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
336   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Players ) )
343   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Players ) )         PORT_DIPLOCATION("SWA:8")
337344   PORT_DIPSETTING(    0x80, "1" )
338345   PORT_DIPSETTING(    0x00, "2" )
339346
340347   PORT_START_TAG("DSWB")   /* DSWB */
341   PORT_DIPNAME( 0x03, 0x00, "Max Bonus Fuels" )
348   PORT_DIPNAME( 0x03, 0x00, "Max Bonus Fuels" )         PORT_DIPLOCATION("SWB:1,2")
342349   PORT_DIPSETTING(    0x01, "1" )
343350   PORT_DIPSETTING(    0x02, "2" )
344351   PORT_DIPSETTING(    0x03, "3" )
345352   PORT_DIPSETTING(    0x00, "99" )
346   PORT_DIPNAME( 0x0c, 0x08, "Game Difficulty" )
353   PORT_DIPNAME( 0x0c, 0x08, "Game Difficulty" )         PORT_DIPLOCATION("SWB:3,4")
347354   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy) )
348355   PORT_DIPSETTING(    0x04, DEF_STR( Easy ) )
349356   PORT_DIPSETTING(    0x08, DEF_STR( Medium ) )
350357   PORT_DIPSETTING(    0x0c, DEF_STR( Hard ) )
351   PORT_DIPNAME( 0x30, 0x20, "Traffic Difficulty" )
358   PORT_DIPNAME( 0x30, 0x20, "Traffic Difficulty" )      PORT_DIPLOCATION("SWB:5,6")
352359   PORT_DIPSETTING(    0x00, DEF_STR( Very_Easy) )
353360   PORT_DIPSETTING(    0x10, DEF_STR( Easy ) )
354361   PORT_DIPSETTING(    0x20, DEF_STR( Medium ) )
355362   PORT_DIPSETTING(    0x30, DEF_STR( Hard ) )
356   PORT_DIPNAME( 0x40, 0x00, "Land Collisions Enabled" )
363   PORT_DIPNAME( 0x40, 0x00, "Land Collisions Enabled" )   PORT_DIPLOCATION("SWB:7")
357364   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
358365   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
359   PORT_DIPNAME( 0x80, 0x00, "Car Collisions Enabled" )
366   PORT_DIPNAME( 0x80, 0x00, "Car Collision Enabled" )      PORT_DIPLOCATION("SWB:8")
360367   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
361368   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
362369
363370   PORT_START_TAG("DSWC")   /* DSWC - coinage */
364   PORT_DIPNAME( 0xf0, 0x10, DEF_STR( Coin_A ) )
371   PORT_DIPNAME( 0xf0, 0x10, DEF_STR( Coin_A ) )         PORT_DIPLOCATION("SWC:5,6,7,8")
365372   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
366373   PORT_DIPSETTING(   0x90, DEF_STR( 2C_1C ) )
367374   PORT_DIPSETTING(   0xa0, DEF_STR( 2C_2C ) )
r2956r2957
377384   PORT_DIPSETTING(   0x50, DEF_STR( 1C_5C ) )
378385   PORT_DIPSETTING(   0x60, DEF_STR( 1C_6C ) )
379386   PORT_DIPSETTING(   0x70, DEF_STR( 1C_7C ) )
380   PORT_DIPNAME( 0x0f, 0x01, DEF_STR( Coin_B ) )
387   PORT_DIPNAME( 0x0f, 0x01, DEF_STR( Coin_B ) )         PORT_DIPLOCATION("SWC:1,2,3,4")
381388   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
382389   PORT_DIPSETTING(   0x09, DEF_STR( 2C_1C ) )
383390   PORT_DIPSETTING(   0x0a, DEF_STR( 2C_2C ) )
r2956r2957
395402   PORT_DIPSETTING(   0x07, DEF_STR( 1C_7C ) )
396403
397404   PORT_START_TAG("DSWD")   /* DSWD - bonus */
398   PORT_DIPNAME( 0x01, 0x01, "Right Coin Counter" )
399   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
400   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
401   PORT_DIPNAME( 0x02, 0x02, "Left Coin Counter" )
402   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
403   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
404   PORT_DIPNAME( 0x1c, 0x00, "Credits for Bonus" )
405   PORT_DIPNAME( 0x01, 0x01, "Right Slot" )            PORT_DIPLOCATION("SWD:1")
406   PORT_DIPSETTING(    0x01, "On Right (Bottom) Counter" )
407   PORT_DIPSETTING(    0x00, "On Left (Top) Counter" )
408   PORT_DIPNAME( 0x02, 0x02, "Left Slot" )               PORT_DIPLOCATION("SWD:2")
409   PORT_DIPSETTING(    0x02, "On Right (Bottom) Counter" )
410   PORT_DIPSETTING(    0x00, "On Left (Top) Counter" )
411   PORT_DIPNAME( 0x1c, 0x00, "Credits For Bonus" )         PORT_DIPLOCATION("SWD:3,4,5")
405412   PORT_DIPSETTING(    0x00, "0" )
406413   PORT_DIPSETTING(    0x04, "1" )
407414   PORT_DIPSETTING(    0x08, "2" )
r2956r2957
410417   PORT_DIPSETTING(    0x14, "5" )
411418   PORT_DIPSETTING(    0x18, "6" )
412419   PORT_DIPSETTING(    0x1c, "7" )
413   PORT_DIPUNUSED( 0x20, IP_ACTIVE_LOW )
414   PORT_DIPNAME( 0xc0, 0x00, "King of the World" )
415   PORT_DIPSETTING(    0x80, "No Name" )
416   PORT_DIPSETTING(    0x40, "Short Name" )
417   PORT_DIPSETTING(    0x00, "Long Name" )
420   PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SWD:6" )   /* Listed as "Unused" */
421   PORT_DIPNAME( 0x40, 0x00, "'King Of The World' Name Length" )PORT_DIPLOCATION("SWD:7")
422   PORT_DIPSETTING(    0x40, "3 Letters" )
423   PORT_DIPSETTING(    0x00, "Long" )
424   PORT_DIPNAME( 0x80, 0x00, "'King Of The World' Name" )   PORT_DIPLOCATION("SWD:8")
425   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
426   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
418427
419428   PORT_START_TAG("MCU") /* MCU */
420429   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
421430   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
422   PORT_SERVICE( 0x04, IP_ACTIVE_LOW )
431   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE )
423432   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
424   PORT_DIPNAME( 0x10, 0x00, DEF_STR(Free_Play) )
425   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
426   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
427   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN3 )   /* NC */
433   PORT_DIPNAME( 0x30, 0x30, "Self Test Switch" )         PORT_DIPLOCATION("SWT:1,2")
434   //PORT_DIPSETTING(    0x00, "?" )                       /* Not possible, 3-state switch */
435   PORT_DIPSETTING(    0x20, "Free Game" )               /* "Puts a credit on the game without increasing the coin counter." */
436   PORT_DIPSETTING(    0x10, DEF_STR( Test ) )
437   PORT_DIPSETTING(    0x30, DEF_STR( Off ) )
428438   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
429439   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
430440
431441   PORT_START_TAG("IN0") /* 0xDx2C */
432   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gear Shift") PORT_CODE(KEYCODE_SPACE) PORT_TOGGLE /* Gear shift */
442   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Gear Shift") PORT_CODE(KEYCODE_SPACE) PORT_TOGGLE /* Gear shift */
433443   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
434444   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
435445   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* FWD - negated bit 7 */
r2956r2957
444454
445455   PORT_START_TAG("WHEEL") /* 0xDx30 DRIVING_WHEEL */
446456   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_MINMAX(0x00, 0xff) PORT_SENSITIVITY(50) PORT_KEYDELTA(8)
447
448
449457INPUT_PORTS_END
450458
451459
src/mame/drivers/triplhnt.c
r2956r2957
7575   discrete_sound_w(machine, TRIPLHNT_LAMP_EN, triplhnt_misc_flags & 0x02);   // Lamp is used to reset noise
7676   discrete_sound_w(machine, TRIPLHNT_BEAR_EN, triplhnt_misc_flags & 0x80);   // bear
7777
78   is_witch_hunt = input_port_read_indexed(machine, 2) == 0x40;
78   is_witch_hunt = input_port_read(machine, "0C09") == 0x40;
7979   bit = ~triplhnt_misc_flags & 0x40;
8080
8181   /* if we're not playing the sample yet, start it */
r2956r2957
107107static READ8_HANDLER( triplhnt_input_port_4_r )
108108{
109109   watchdog_reset_w(machine, 0, 0);
110   return input_port_read_indexed(machine, 4);
110   return input_port_read(machine, "0C0B");
111111}
112112
113113
114114static READ8_HANDLER( triplhnt_misc_r )
115115{
116116   triplhnt_update_misc(machine, offset);
117   return input_port_read_indexed(machine, 7) | triplhnt_hit_code;
117   return input_port_read(machine, "VBLANK") | triplhnt_hit_code;
118118}
119119
120120
121121static READ8_HANDLER( triplhnt_da_latch_r )
122122{
123   int cross_x = input_port_read_indexed(machine, 8);
124   int cross_y = input_port_read_indexed(machine, 9);
123   int cross_x = input_port_read(machine, "STICKX");
124   int cross_y = input_port_read(machine, "STICKY");
125125
126126   triplhnt_da_latch = offset;
127127
r2956r2957
133133
134134static ADDRESS_MAP_START( triplhnt_readmem, ADDRESS_SPACE_PROGRAM, 8 )
135135   AM_RANGE(0x0000, 0x00ff) AM_READ(SMH_RAM) AM_MIRROR(0x300)
136   AM_RANGE(0x0c00, 0x0c00) AM_READ(input_port_0_r)
137   AM_RANGE(0x0c08, 0x0c08) AM_READ(input_port_1_r)
138   AM_RANGE(0x0c09, 0x0c09) AM_READ(input_port_2_r)
139   AM_RANGE(0x0c0a, 0x0c0a) AM_READ(input_port_3_r)
136   AM_RANGE(0x0c00, 0x0c00) AM_READ_PORT("0C00")
137   AM_RANGE(0x0c08, 0x0c08) AM_READ_PORT("0C08")
138   AM_RANGE(0x0c09, 0x0c09) AM_READ_PORT("0C09")
139   AM_RANGE(0x0c0a, 0x0c0a) AM_READ_PORT("0C0A")
140140   AM_RANGE(0x0c0b, 0x0c0b) AM_READ(triplhnt_input_port_4_r)
141141   AM_RANGE(0x0c10, 0x0c1f) AM_READ(triplhnt_da_latch_r)
142142   AM_RANGE(0x0c20, 0x0c2f) AM_READ(triplhnt_cmos_r)
143143   AM_RANGE(0x0c30, 0x0c3f) AM_READ(triplhnt_misc_r)
144   AM_RANGE(0x0c40, 0x0c40) AM_READ(input_port_5_r)
145   AM_RANGE(0x0c48, 0x0c48) AM_READ(input_port_6_r)
144   AM_RANGE(0x0c40, 0x0c40) AM_READ_PORT("0C40")
145   AM_RANGE(0x0c48, 0x0c48) AM_READ_PORT("0C48")
146146   AM_RANGE(0x7000, 0x7fff) AM_READ(SMH_ROM) /* program */
147147   AM_RANGE(0xf800, 0xffff) AM_READ(SMH_ROM) /* program mirror */
148148ADDRESS_MAP_END
r2956r2957
161161
162162
163163static INPUT_PORTS_START( triplhnt )
164   PORT_START /* 0C00 */
164   PORT_START_TAG("0C00")   /* 0C00 */
165165   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
166166   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
167167
168   PORT_START /* 0C08 */
168   PORT_START_TAG("0C08")   /* 0C08 */
169169   PORT_DIPNAME( 0xc0, 0x00, "Play Time" )
170170   PORT_DIPSETTING( 0x00, "32 seconds / 16 raccoons" )
171171   PORT_DIPSETTING( 0x40, "64 seconds / 32 raccoons" )
172172   PORT_DIPSETTING( 0x80, "96 seconds / 48 raccoons" )
173173   PORT_DIPSETTING( 0xc0, "128 seconds / 64 raccoons" )
174174
175   PORT_START /* 0C09 */
175   PORT_START_TAG("0C09")   /* 0C09 */
176176   PORT_DIPNAME( 0xc0, 0x40, "Game Select" )
177177   PORT_DIPSETTING( 0x00, "Hit the Bear" )
178178   PORT_DIPSETTING( 0x40, "Witch Hunt" )
179179   PORT_DIPSETTING( 0xc0, "Raccoon Hunt" )
180180
181   PORT_START /* 0C0A */
181   PORT_START_TAG("0C0A")   /* 0C0A */
182182   PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coinage ))
183183   PORT_DIPSETTING( 0x40, DEF_STR( 2C_1C ))
184184   PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ))
185185   PORT_DIPSETTING( 0x80, DEF_STR( 1C_2C ))
186186
187   PORT_START /* 0C0B */
187   PORT_START_TAG("0C0B")   /* 0C0B */
188188   PORT_DIPNAME( 0x80, 0x00, "Extended Play" )
189189   PORT_DIPSETTING( 0x80, DEF_STR( Off ))
190190   PORT_DIPSETTING( 0x00, DEF_STR( On ))
191191
192   PORT_START /* 0C40 */
192   PORT_START_TAG("0C40")   /* 0C40 */
193193   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_TILT )
194194   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN2 )
195195
196   PORT_START /* 0C48 */
196   PORT_START_TAG("0C48")   /* 0C48 */
197197// default to service enabled to make users calibrate gun
198198//  PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
199199   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Service_Mode )) PORT_TOGGLE PORT_CODE(KEYCODE_F2)
r2956r2957
201201   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
202202   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
203203
204   PORT_START
204   PORT_START_TAG("VBLANK")
205205   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
206206
207   PORT_START
207   PORT_START_TAG("STICKX")
208208   PORT_BIT( 0xfc, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x00,0xfc)  PORT_CROSSHAIR(X, 62.0/64, 1.0/64, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15)
209209
210   PORT_START
210   PORT_START_TAG("STICKY")
211211   PORT_BIT( 0xfc, 0x78, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xec)  PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_SENSITIVITY(25) PORT_KEYDELTA(15)
212212
213213   PORT_START_TAG("BEAR")   /* 10 */
src/mame/drivers/starwars.c
r2956r2957
158158static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
159159   AM_RANGE(0x0000, 0x2fff) AM_RAM AM_BASE(&vectorram) AM_SIZE(&vectorram_size) AM_REGION(REGION_CPU1, 0)
160160   AM_RANGE(0x3000, 0x3fff) AM_ROM                        /* vector_rom */
161   AM_RANGE(0x4300, 0x431f) AM_READ(input_port_0_r)         /* Memory mapped input port 0 */
161   AM_RANGE(0x4300, 0x431f) AM_READ_PORT("IN0")            /* Memory mapped input port 0 */
162162   AM_RANGE(0x4320, 0x433f) AM_READ(starwars_input_1_r)      /* Memory mapped input port 1 */
163   AM_RANGE(0x4340, 0x435f) AM_READ(input_port_2_r)         /* DIP switches bank 0 */
164   AM_RANGE(0x4360, 0x437f) AM_READ(input_port_3_r)         /* DIP switches bank 1 */
163   AM_RANGE(0x4340, 0x435f) AM_READ_PORT("DSW0")            /* DIP switches bank 0 */
164   AM_RANGE(0x4360, 0x437f) AM_READ_PORT("DSW1")            /* DIP switches bank 1 */
165165   AM_RANGE(0x4380, 0x439f) AM_READ(starwars_adc_r)         /* a-d control result */
166166   AM_RANGE(0x4400, 0x4400) AM_READWRITE(starwars_main_read_r, starwars_main_wr_w)
167167   AM_RANGE(0x4401, 0x4401) AM_READ(starwars_main_ready_flag_r)
r2956r2957
212212 *************************************/
213213
214214static INPUT_PORTS_START( starwars )
215   PORT_START   /* IN0 */
215   PORT_START_TAG("IN0")   /* IN0 */
216216   PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_COIN2 )
217217   PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_COIN1 )
218218   PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
222222   PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 )
223223   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
224224
225   PORT_START   /* IN1 */
225   PORT_START_TAG("IN1")   /* IN1 */
226226   PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
227227   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
228228   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1)
r2956r2957
234234   /* Bit 7 is VG_HALT - see machine/starwars.c */
235235   PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
236236
237   PORT_START   /* DSW0 */
237   PORT_START_TAG("DSW0")   /* DSW0 */
238238   PORT_DIPNAME(0x03, 0x00, "Starting Shields" )
239239   PORT_DIPSETTING (  0x00, "6" )
240240   PORT_DIPSETTING (  0x01, "7" )
r2956r2957
257257   PORT_DIPSETTING (  0x80, DEF_STR( Off ) )
258258   PORT_DIPSETTING (  0x00, DEF_STR( On ) )
259259
260   PORT_START   /* DSW1 */
260   PORT_START_TAG("DSW1")   /* DSW1 */
261261   PORT_DIPNAME(0x03, 0x02, DEF_STR( Coinage ) )
262262   PORT_DIPSETTING (  0x03, DEF_STR( 2C_1C ) )
263263   PORT_DIPSETTING (  0x02, DEF_STR( 1C_1C ) )
r2956r2957
280280   PORT_DIPSETTING (  0x00, DEF_STR( None ) )
281281/* 0xc0 and 0xe0 None */
282282
283   PORT_START   /* IN4 */
283   PORT_START_TAG("STICKY")   /* IN4 */
284284   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30)
285285
286   PORT_START   /* IN5 */
286   PORT_START_TAG("STICKX")   /* IN5 */
287287   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(30)
288288INPUT_PORTS_END
289289
290290
291291static INPUT_PORTS_START( esb )
292   PORT_START   /* IN0 */
292   PORT_START_TAG("IN0")   /* IN0 */
293293   PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_COIN2 )
294294   PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_COIN1 )
295295   PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
r2956r2957
299299   PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_BUTTON4 )
300300   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
301301
302   PORT_START   /* IN1 */
302   PORT_START_TAG("IN1")   /* IN1 */
303303   PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED )
304304   PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED )
305305   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Diagnostic Step") PORT_CODE(KEYCODE_F1)
r2956r2957
311311   /* Bit 7 is VG_HALT - see machine/starwars.c */
312312   PORT_BIT ( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
313313
314   PORT_START   /* DSW0 */
314   PORT_START_TAG("DSW0")   /* DSW0 */
315315   PORT_DIPNAME(0x03, 0x03, "Starting Shields" )
316316   PORT_DIPSETTING (  0x01, "2" )
317317   PORT_DIPSETTING (  0x00, "3" )
r2956r2957
334334   PORT_DIPSETTING (  0x80, DEF_STR( Off ) )
335335   PORT_DIPSETTING (  0x00, DEF_STR( On ) )
336336
337   PORT_START   /* DSW1 */
337   PORT_START_TAG("DSW1")   /* DSW1 */
338338   PORT_DIPNAME(0x03, 0x02, DEF_STR( Coinage ) )
339339   PORT_DIPSETTING (  0x03, DEF_STR( 2C_1C ) )
340340   PORT_DIPSETTING (  0x02, DEF_STR( 1C_1C ) )
r2956r2957
357357   PORT_DIPSETTING (  0xe0, DEF_STR( None ) )
358358/* 0xc0 and 0x00 None */
359359
360   PORT_START   /* IN4 */
360   PORT_START_TAG("STICKY")   /* IN4 */
361361   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(70) PORT_KEYDELTA(30)
362362
363   PORT_START   /* IN5 */
363   PORT_START_TAG("STICKX")   /* IN5 */
364364   PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(30)
365365INPUT_PORTS_END
366366
src/mame/drivers/tankbatt.c
r2956r2957
8080{
8181   int val;
8282
83   val = input_port_read_indexed(machine, 0);
84   return ((val << (7-offset)) & 0x80);
83   val = input_port_read(machine, "P1");
84   return ((val << (7 - offset)) & 0x80);
8585}
8686
8787static READ8_HANDLER( tankbatt_in1_r )
8888{
8989   int val;
9090
91   val = input_port_read_indexed(machine, 1);
92   return ((val << (7-offset)) & 0x80);
91   val = input_port_read(machine, "P2");
92   return ((val << (7 - offset)) & 0x80);
9393}
9494
9595static READ8_HANDLER( tankbatt_dsw_r )
9696{
9797   int val;
9898
99   val = input_port_read_indexed(machine, 2);
100   return ((val << (7-offset)) & 0x80);
99   val = input_port_read(machine, "DSW");
100   return ((val << (7 - offset)) & 0x80);
101101}
102102
103103static WRITE8_HANDLER( tankbatt_interrupt_enable_w )
r2956r2957
173173
174174static INTERRUPT_GEN( tankbatt_interrupt )
175175{
176   if ((input_port_read_indexed(machine, 0) & 0x60) == 0) cpunum_set_input_line(machine, 0,0,HOLD_LINE);
176   if ((input_port_read(machine, "P1") & 0x60) == 0) cpunum_set_input_line(machine, 0,0,HOLD_LINE);
177177   else if (tankbatt_nmi_enable) cpunum_set_input_line(machine, 0,INPUT_LINE_NMI,PULSE_LINE);
178178}
179179
180180static INPUT_PORTS_START( tankbatt )
181   PORT_START   /* IN0 */
182   PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
183   PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
184   PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
185   PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
186   PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
181   PORT_START_TAG("P1")   /* IN0 */
182   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
183   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
184   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
185   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
186   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
187187   PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
188   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_TILT )
188   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_TILT )
189189
190   PORT_START   /* IN1 */
191   PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL
192   PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL
193   PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL
194   PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
195   PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
196   PORT_BIT ( 0x20, IP_ACTIVE_LOW, IPT_START1 )
197   PORT_BIT ( 0x40, IP_ACTIVE_LOW, IPT_START2 )
190   PORT_START_TAG("P2")   /* IN1 */
191   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL
192   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL
193   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL
194   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
195   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
196   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
197   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
198198   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
199199
200   PORT_START   /* DSW */
200   PORT_START_TAG("DSW")   /* DSW */
201201   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Cabinet ) )
202   PORT_DIPSETTING(    0x01, DEF_STR( Upright ) )
203   PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
202   PORT_DIPSETTING(   0x01, DEF_STR( Upright ) )
203   PORT_DIPSETTING(   0x00, DEF_STR( Cocktail ) )
204204    PORT_DIPNAME( 0x06, 0x06, DEF_STR( Coinage ) )
205   PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
206   PORT_DIPSETTING(    0x06, DEF_STR( 1C_1C ) )
207   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
208   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
205   PORT_DIPSETTING(   0x04, DEF_STR( 2C_1C ) )
206   PORT_DIPSETTING(   0x06, DEF_STR( 1C_1C ) )
207   PORT_DIPSETTING(   0x02, DEF_STR( 1C_2C ) )
208   PORT_DIPSETTING(   0x00, DEF_STR( Free_Play ) )
209209   PORT_DIPNAME( 0x18, 0x08, DEF_STR( Bonus_Life ) )
210   PORT_DIPSETTING(    0x00, "10000" )
211   PORT_DIPSETTING(    0x10, "15000" )
212   PORT_DIPSETTING(    0x08, "20000" )
213   PORT_DIPSETTING(    0x18, DEF_STR( None ) )
210   PORT_DIPSETTING(   0x00, "10000" )
211   PORT_DIPSETTING(   0x10, "15000" )
212   PORT_DIPSETTING(   0x08, "20000" )
213   PORT_DIPSETTING(   0x18, DEF_STR( None ) )
214214   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Lives ) )
215   PORT_DIPSETTING(    0x20, "2" )
216   PORT_DIPSETTING(    0x00, "3" )
215   PORT_DIPSETTING(   0x20, "2" )
216   PORT_DIPSETTING(   0x00, "3" )
217217   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
218   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
219   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
218   PORT_DIPSETTING(   0x40, DEF_STR( Off ) )
219   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
220220   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
221   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
222   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
221   PORT_DIPSETTING(   0x80, DEF_STR( Off ) )
222   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
223223INPUT_PORTS_END
224224
225225
src/mame/drivers/royalmah.c
r2956r2957
316316
317317static READ8_HANDLER( mjapinky_dsw_r )
318318{
319   if (rombank == 0x0e)   return input_port_read_indexed(machine, 13);
319   if (rombank == 0x0e)   return input_port_read(machine, "DSW3");
320320   else               return *(memory_region(machine, REGION_CPU1) + 0x10000 + 0x8000 * rombank);
321321}
322322
src/mame/drivers/subs.c
r2956r2957
8484 *************************************/
8585
8686static INPUT_PORTS_START( subs )
87   PORT_START /* OPTIONS */
87   PORT_START_TAG("DSW") /* OPTIONS */
8888   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
8989   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
9090   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
r2956r2957
109109   PORT_DIPSETTING(    0xc0, "3:30 Minutes" )
110110   PORT_DIPSETTING(    0xe0, "4:00 Minutes" )
111111
112   PORT_START /* IN1 */
112   PORT_START_TAG("IN0") /* IN1 */
113113   PORT_BIT ( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Diag Step */
114114   PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* Diag Hold */
115115   PORT_BIT ( 0x04, IP_ACTIVE_LOW, IPT_TILT )    /* Slam */
116116   PORT_BIT ( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )  /* Spare */
117117   PORT_BIT ( 0xf0, IP_ACTIVE_HIGH, IPT_UNUSED ) /* Filled in with steering information */
118118
119   PORT_START /* IN2 */
119   PORT_START_TAG("IN1") /* IN2 */
120120   PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_COIN2 )
121121   PORT_BIT ( 0x02, IP_ACTIVE_LOW, IPT_START2 )
122122   PORT_BIT ( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 )
r2956r2957
126126   PORT_SERVICE_NO_TOGGLE( 0x40, IP_ACTIVE_LOW )
127127   PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
128128
129   PORT_START      /* IN3 */
129   PORT_START_TAG("DIAL2")   /* IN3 */
130130   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) PORT_PLAYER(2)
131131
132   PORT_START      /* IN4 */
132   PORT_START_TAG("DIAL1")   /* IN4 */
133133   PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20)
134134
135135INPUT_PORTS_END
src/mame/drivers/shisen.c
r2956r2957
2020
2121static READ8_HANDLER( sichuan2_dsw1_r )
2222{
23   int ret = input_port_read_indexed(machine,3);
23   int ret = input_port_read(machine, "DSW1");
2424
2525   /* Based on the coin mode fill in the upper bits */
26   if (input_port_read_indexed(machine,4) & 0x04)
26   if (input_port_read(machine, "DSW2") & 0x04)
2727   {
2828      /* Mode 1 */
29      ret   |= (input_port_read_indexed(machine,5) << 4);
29      ret   |= (input_port_read(machine, "DSW1") << 4);
3030   }
3131   else
3232   {
3333      /* Mode 2 */
34      ret   |= (input_port_read_indexed(machine,5) & 0xf0);
34      ret   |= (input_port_read(machine, "DSW1") & 0xf0);
3535   }
3636
3737   return ret;
r2956r2957
6464static ADDRESS_MAP_START( readport, ADDRESS_SPACE_IO, 8 )
6565   ADDRESS_MAP_GLOBAL_MASK(0xff)
6666   AM_RANGE(0x00, 0x00) AM_READ(sichuan2_dsw1_r)
67   AM_RANGE(0x01, 0x01) AM_READ(input_port_4_r)
68   AM_RANGE(0x02, 0x02) AM_READ(input_port_0_r)
69   AM_RANGE(0x03, 0x03) AM_READ(input_port_1_r)
70   AM_RANGE(0x04, 0x04) AM_READ(input_port_2_r)
67   AM_RANGE(0x01, 0x01) AM_READ_PORT("DSW2")
68   AM_RANGE(0x02, 0x02) AM_READ_PORT("P1")
69   AM_RANGE(0x03, 0x03) AM_READ_PORT("P2")
70   AM_RANGE(0x04, 0x04) AM_READ_PORT("COIN")
7171ADDRESS_MAP_END
7272
7373static ADDRESS_MAP_START( writeport, ADDRESS_SPACE_IO, 8 )
r2956r2957
105105
106106
107107static INPUT_PORTS_START( shisen )
108   PORT_START_TAG("IN0")
108   PORT_START_TAG("P1")
109109   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
110110   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
111111   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
r2956r2957
115115   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
116116   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
117117
118   PORT_START_TAG("IN1")
118   PORT_START_TAG("P2")
119119   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
120120   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
121121   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
src/tools/makemeta.c
r2956r2957
1717         1   = internal flags:
1818                bit 0 = previous field is the same frame
1919                bit 1 = next field is the same frame
20         2   = white flag
20         2   = white flag (from line 11)
2121        3-5  = line 16 Philips code
2222        6-8  = line 17 Philips code
2323        9-11 = line 18 Philips code
r2956r2957
2828#include <ctype.h>
2929#include "aviio.h"
3030#include "bitmap.h"
31#include "vbiparse.h"
3132
3233
3334
r2956r2957
6061***************************************************************************/
6162
6263/*-------------------------------------------------
63    parse_line - parse a Philips code from a
64    line of video data
65-------------------------------------------------*/
66
67static int parse_line(bitmap_t *bitmap, int line, int expected_bits, UINT8 *result)
68{
69   const UINT16 *source = BITMAP_ADDR16(bitmap, line, 0);
70   int x, edges = 0, bits = 0;
71   int minwidth = 1000;
72   UINT8 bit[720];
73   int edge[720];
74   int error = 0;
75
76   /* clamp expected bits */
77   expected_bits *= 2;
78   if (expected_bits > ARRAY_LENGTH(edge) - 1)
79      expected_bits = ARRAY_LENGTH(edge) - 1;
80
81   /* find the edges in the line */
82   for (x = 1; x < bitmap->width && edges < ARRAY_LENGTH(edge); x++)
83      if (source[x] >= 0xc000 && source[x - 1] < 0xc000)
84         edge[edges++] = x;
85      else if (source[x] <= 0x4000 && source[x - 1] > 0x4000)
86         edge[edges++] = x;
87
88   /* find the minimum width */
89   for (x = 1; x < edges; x++)
90   {
91      int width = edge[x] - edge[x - 1];
92      if (width > 3 && width < minwidth)
93         minwidth = edge[x] - edge[x - 1];
94   }
95
96   /* now generate the bits */
97   for (x = 1; x < edges; x++)
98   {
99      int width = edge[x] - edge[x - 1];
100      if (width > 3)
101      {
102         int count = (width > 3 * minwidth / 2) ? 2 : 1;
103         while (count--)
104            bit[bits++] = (source[edge[x - 1]] >= 0x8000) ? 1 : 0;
105      }
106   }
107
108   /* look for improperly paired bits in the sequence */
109   if (bits < expected_bits)
110   {
111      /* look for two bits in a row of the same type on an even boundary */
112      for (x = 0; x < bits; x += 2)
113         if (bit[x] == bit[x + 1])
114            break;
115
116      /* if we got something wrong, assume we're missing an opening 0 bit */
117      if (x < bits)
118      {
119         memmove(&bit[1], &bit[0], bits);
120         bit[0] = 0;
121         bits++;
122      }
123   }
124
125   /* trailing bits are 0 */
126   while (bits < expected_bits)
127      bit[bits++] = 0;
128
129   /* output */
130   for (x = 0; x < MIN(bits, expected_bits); x += 2)
131   {
132      static const UINT8 trans[4] = { 0x80, 1, 0, 0xff };
133      result[x/2] = trans[(bit[x] << 1) | bit[x + 1]];
134      if (result[x/2] > 1)
135         error++;
136   }
137   return error ? -(bits / 2) : (bits / 2);
138}
139
140
141/*-------------------------------------------------
14264    output_meta - output a line of metadata
14365-------------------------------------------------*/
14466
145static void output_meta(UINT8 flags, UINT8 white, UINT32 line12, UINT32 line13, UINT32 line14, UINT32 framenum, UINT32 chapternum)
67static void output_meta(UINT8 flags, UINT8 white, UINT32 line16, UINT32 line17, UINT32 line18, UINT32 framenum, UINT32 chapternum)
14668{
14769   /* start with the raw metadata, followed by a comment */
14870   printf("02%02X%02X%06X%06X%06X   ; ",
149      flags, white, line12, line13, line14);
71      flags, white, line16, line17, line18);
15072
15173   /* separate comments for leadin/leadout */
152   if (line13 == 0x88ffff)
74   if (line17 == 0x88ffff)
15375      printf("leadin\n");
154   else if (line13 == 0x80eeee)
76   else if (line17 == 0x80eeee)
15577      printf("leadout\n");
15678
15779   /* otherwise, display the frame and chapter, and indicate white flag/stop code */
r2956r2957
16082      printf("frame %05x ch %02x", framenum, chapternum);
16183      if (white)
16284         printf(" (white)");
163      if (line12 == 0x82cfff)
85      if (line16 == 0x82cfff)
16486         printf(" (stop)");
16587      printf("\n");
16688   }
r2956r2957
17496
17597static int generate_from_avi(const char *aviname)
17698{
177   UINT32 line12 = 0, line13 = 0, line14 = 0, framenum = 0, chapternum = 0;
99   UINT32 line16 = 0, line17 = 0, line18 = 0, framenum = 0, chapternum = 0;
178100   const avi_movie_info *info;
179101   bitmap_t *bitmap;
180102   avi_error avierr;
r2956r2957
193115   /* extract movie info */
194116   info = avi_get_movie_info(avi);
195117   fprintf(stderr, "%dx%d - %d frames total\n", info->video_width, info->video_height, info->video_numsamples);
196   if (info->video_height != 39)
118   if (info->video_height < 22*2)
197119   {
198      fprintf(stderr, "Unknown VANC capture format: expected 39 rows\n");
120      fprintf(stderr, "Unknown VBI capture format: expected at least 44 rows\n");
199121      return 1;
200122   }
201123
r2956r2957
227149         int prevwhite = white;
228150         int i;
229151
230         /* line 7 contains the white flag */
231         white = 0;
232         if (*BITMAP_ADDR16(bitmap, 20 * field + 7, bitmap->width / 2) > 0x8000)
233            white = 1;
152         /* line 11 contains the white flag */
153         white = vbi_parse_white_flag(BITMAP_ADDR16(bitmap, 11*2 + field, 0), bitmap->width, 8);
234154
235155         /* output metadata for *previous* field */
236156         if (frame > 0 || field > 0)
r2956r2957
239159
240160            if (!prevwhite) flags |= 0x01;
241161            if (!white) flags |= 0x02;
242            output_meta(flags, prevwhite, line12, line13, line14, framenum, chapternum);
162            output_meta(flags, prevwhite, line16, line17, line18, framenum, chapternum);
243163         }
244164
245         /* line 12 contains stop code and other interesting bits */
246         line12 = 0;
247         if (parse_line(bitmap, 20 * field + 12, 24, bits) == 24)
165         /* line 16 contains stop code and other interesting bits */
166         line16 = 0;
167         if (vbi_parse_manchester_code(BITMAP_ADDR16(bitmap, 16*2 + field, 0), bitmap->width, 8, 24, bits) == 24)
248168            for (i = 0; i < 24; i++)
249               line12 = (line12 << 1) | bits[i];
169               line16 = (line16 << 1) | bits[i];
250170
251         /* line 13 and 14 contain frame/chapter/lead in/out encodings */
252         line13 = 0;
253         if (parse_line(bitmap, 20 * field + 13, 24, bits) == 24)
171         /* line 17 and 18 contain frame/chapter/lead in/out encodings */
172         line17 = 0;
173         if (vbi_parse_manchester_code(BITMAP_ADDR16(bitmap, 17*2 + field, 0), bitmap->width, 8, 24, bits) == 24)
254174            for (i = 0; i < 24; i++)
255               line13 = (line13 << 1) | bits[i];
175               line17 = (line17 << 1) | bits[i];
256176
257         line14 = 0;
258         if (parse_line(bitmap, 20 * field + 14, 24, bits) == 24)
177         line18 = 0;
178         if (vbi_parse_manchester_code(BITMAP_ADDR16(bitmap, 18*2 + field, 0), bitmap->width, 8, 24, bits) == 24)
259179            for (i = 0; i < 24; i++)
260               line14 = (line14 << 1) | bits[i];
180               line18 = (line18 << 1) | bits[i];
261181
262182         /* the two lines must match */
263//          if (line13 != 0 && line14 != 0 && line13 != line14)
264//              line13 = line14 = 0;
183//          if (line17 != 0 && line18 != 0 && line17 != line18)
184//              line17 = line18 = 0;
265185
266186         /* is this a frame number? */
267         if ((line13 & 0xf00000) == 0xf00000)
268            framenum = line13 & 0x7ffff;
269         if ((line13 & 0xf00fff) == 0x800ddd)
270            chapternum = (line13 >> 12) & 0x7f;
187         if ((line17 & 0xf00000) == 0xf00000)
188            framenum = line17 & 0x7ffff;
189         if ((line17 & 0xf00fff) == 0x800ddd)
190            chapternum = (line17 >> 12) & 0x7f;
271191      }
272192   }
273193
r2956r2957
276196      int flags = 0;
277197
278198      if (!white) flags |= 0x01;
279      output_meta(flags, white, line12, line13, line14, framenum, chapternum);
199      output_meta(flags, white, line16, line17, line18, framenum, chapternum);
280200   }
281201
282202   bitmap_free(bitmap);
src/tools/romcmp.c
r2956r2957
726726         for (i = 0;i < found[0];i++)
727727         {
728728            if (files[0][i].listed == 0) printname(&files[0][i],0,0.0,0,0);
729            freefile(&files[0][i]);
730729         }
731730         for (i = 0;i < found[1];i++)
732731         {
733732            if (files[1][i].listed == 0) printname(0,&files[1][i],0.0,0,0);
734            freefile(&files[1][i]);
735733         }
736734      }
735
736
737      for (i = 0;i < found[0];i++)
738      {
739         freefile(&files[0][i]);
740      }
741      for (i = 0;i < found[1];i++)
742      {
743         freefile(&files[1][i]);
744      }
737745   }
738746
739747   zip_file_cache_clear();
src/osd/windows/input.c
r2956r2957
593593//  wininput_handle_mouse_button
594594//============================================================
595595
596void wininput_handle_mouse_button(int button, int down, int x, int y)
596BOOL wininput_handle_mouse_button(int button, int down, int x, int y)
597597{
598598   device_info *devinfo;
599599
600600   // ignore if not enabled
601601   if (!input_enabled)
602      return;
602      return FALSE;
603603
604604   // only need this for shared axis hack
605605   if (!lightgun_shared_axis_mode || button >= 4)
606      return;
606      return FALSE;
607607
608608   // choose a device based on the button
609609   devinfo = lightgun_list;
r2956r2957
636636
637637   // release the lock
638638   osd_lock_release(input_lock);
639   return TRUE;
639640}
640641
641642
src/osd/windows/debugwin.c
r2956r2957
1818
1919// MAME headers
2020#include "driver.h"
21#include "uiinput.h"
2122#include "debug/debugvw.h"
2223#include "debug/debugcon.h"
2324#include "debug/debugcpu.h"
r2956r2957
426427   {
427428      // see if the interrupt key is pressed and break if it is
428429      temporarily_fake_that_we_are_not_visible = TRUE;
429      if (input_ui_pressed(Machine, IPT_UI_DEBUG_BREAK))
430      if (ui_input_pressed(Machine, IPT_UI_DEBUG_BREAK))
430431      {
431432         debugwin_info *info;
432433         HWND focuswnd = GetFocus();
r2956r2957
28902891   int ignoreme;
28912892
28922893   /* ignore any keys that are received while the debug key is down */
2893   ignoreme = input_ui_pressed(Machine, IPT_UI_DEBUG_BREAK);
2894   ignoreme = ui_input_pressed(Machine, IPT_UI_DEBUG_BREAK);
28942895   if (ignoreme)
28952896      return 1;
28962897
src/osd/windows/input.h
r2956r2957
1818void wininput_init(running_machine *machine);
1919void wininput_poll(running_machine *machine);
2020
21void wininput_handle_mouse_button(int button, int down, int x, int y);
21BOOL wininput_handle_mouse_button(int button, int down, int x, int y);
2222BOOL wininput_handle_raw(HANDLE device);
2323
2424int wininput_should_hide_mouse(void);
src/osd/windows/video.c
r2956r2957
2727#include "render.h"
2828#include "rendutil.h"
2929#include "ui.h"
30#include "uiinput.h"
3031
3132// MAMEOS headers
3233#include "winmain.h"
r2956r2957
351352static void check_osd_inputs(running_machine *machine)
352353{
353354   // check for toggling fullscreen mode
354   if (input_ui_pressed(machine, IPT_OSD_1))
355   if (ui_input_pressed(machine, IPT_OSD_1))
355356      winwindow_toggle_full_screen();
356357
357358#ifdef MESS
358359   // check for toggling menu bar
359   if (input_ui_pressed(machine, IPT_OSD_2))
360   if (ui_input_pressed(machine, IPT_OSD_2))
360361      win_toggle_menubar();
361362#endif
362363}
src/osd/windows/window.c
r2956r2957
2727#include "osdepend.h"
2828#include "driver.h"
2929#include "deprecat.h"
30#include "uiinput.h"
3031
3132// MAMEOS headers
3233#include "winmain.h"
r2956r2957
376377               // ignore keyboard messages
377378               case WM_SYSKEYUP:
378379               case WM_SYSKEYDOWN:
379#ifndef MESS
380               case WM_KEYUP:
381               case WM_KEYDOWN:
382               case WM_CHAR:
383#endif
384380                  dispatch = FALSE;
385381                  break;
386382
387383               // forward mouse button downs to the input system
388384               case WM_LBUTTONDOWN:
389                  wininput_handle_mouse_button(0, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
390                  dispatch = FALSE;
385                  dispatch = !wininput_handle_mouse_button(0, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
391386                  break;
392387
393388               case WM_RBUTTONDOWN:
394                  wininput_handle_mouse_button(1, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
395                  dispatch = FALSE;
389                  dispatch = !wininput_handle_mouse_button(1, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
396390                  break;
397391
398392               case WM_MBUTTONDOWN:
399                  wininput_handle_mouse_button(2, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
400                  dispatch = FALSE;
393                  dispatch = !wininput_handle_mouse_button(2, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
401394                  break;
402395
403396               case WM_XBUTTONDOWN:
404                  wininput_handle_mouse_button(3, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
405                  dispatch = FALSE;
397                  dispatch = !wininput_handle_mouse_button(3, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
406398                  break;
407399
408400               // forward mouse button ups to the input system
409401               case WM_LBUTTONUP:
410                  wininput_handle_mouse_button(0, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
411                  dispatch = FALSE;
402                  dispatch = !wininput_handle_mouse_button(0, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
412403                  break;
413404
414405               case WM_RBUTTONUP:
415                  wininput_handle_mouse_button(1, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
416                  dispatch = FALSE;
406                  dispatch = !wininput_handle_mouse_button(1, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
417407                  break;
418408
419409               case WM_MBUTTONUP:
420                  wininput_handle_mouse_button(2, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
421                  dispatch = FALSE;
410                  dispatch = !wininput_handle_mouse_button(2, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
422411                  break;
423412
424413               case WM_XBUTTONUP:
425                  wininput_handle_mouse_button(3, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
426                  dispatch = FALSE;
414                  dispatch = !wininput_handle_mouse_button(3, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
427415                  break;
428416            }
429417         }
r2956r2957
10251013            // ignore input messages here
10261014            case WM_SYSKEYUP:
10271015            case WM_SYSKEYDOWN:
1028#ifndef MESS
1029            case WM_KEYUP:
1030            case WM_KEYDOWN:
1031            case WM_CHAR:
1032#endif // MESS
10331016               dispatch = FALSE;
10341017               break;
10351018
10361019            // forward mouse button downs to the input system
10371020            case WM_LBUTTONDOWN:
1038               wininput_handle_mouse_button(0, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
1039               dispatch = FALSE;
1021               dispatch = !wininput_handle_mouse_button(0, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
10401022               break;
10411023
10421024            case WM_RBUTTONDOWN:
1043               wininput_handle_mouse_button(1, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
1044               dispatch = FALSE;
1025               dispatch = !wininput_handle_mouse_button(1, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
10451026               break;
10461027
10471028            case WM_MBUTTONDOWN:
1048               wininput_handle_mouse_button(2, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
1049               dispatch = FALSE;
1029               dispatch = !wininput_handle_mouse_button(2, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
10501030               break;
10511031
10521032            case WM_XBUTTONDOWN:
1053               wininput_handle_mouse_button(3, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
1054               dispatch = FALSE;
1033               dispatch = !wininput_handle_mouse_button(3, TRUE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
10551034               break;
10561035
10571036            // forward mouse button ups to the input system
10581037            case WM_LBUTTONUP:
1059               wininput_handle_mouse_button(0, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
1060               dispatch = FALSE;
1038               dispatch = !wininput_handle_mouse_button(0, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
10611039               break;
10621040
10631041            case WM_RBUTTONUP:
1064               wininput_handle_mouse_button(1, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
1065               dispatch = FALSE;
1042               dispatch = !wininput_handle_mouse_button(1, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
10661043               break;
10671044
10681045            case WM_MBUTTONUP:
1069               wininput_handle_mouse_button(2, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
1070               dispatch = FALSE;
1046               dispatch = !wininput_handle_mouse_button(2, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
10711047               break;
10721048
10731049            case WM_XBUTTONUP:
1074               wininput_handle_mouse_button(3, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
1075               dispatch = FALSE;
1050               dispatch = !wininput_handle_mouse_button(3, FALSE, GET_X_LPARAM(message.lParam), GET_Y_LPARAM(message.lParam));
10761051               break;
10771052
10781053            // a terminate message to the thread posts a quit
r2956r2957
12311206      case WM_SYSKEYDOWN:
12321207         break;
12331208
1209      // input events
1210      case WM_MOUSEMOVE:
1211         ui_input_push_mouse_move_event(Machine, window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
1212         break;
1213
1214      case WM_MOUSELEAVE:
1215         ui_input_push_mouse_leave_event(Machine, window->target);
1216         break;
1217
1218      case WM_LBUTTONDOWN:
1219      {
1220         DWORD ticks = GetTickCount();
1221         ui_input_push_mouse_click_event(Machine, window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
1222
1223         // check for a double-click
1224         if (ticks - window->lastclicktime < GetDoubleClickTime() &&
1225            GET_X_LPARAM(lparam) >= window->lastclickx - 4 && GET_X_LPARAM(lparam) <= window->lastclickx + 4 &&
1226            GET_Y_LPARAM(lparam) >= window->lastclicky - 4 && GET_Y_LPARAM(lparam) <= window->lastclicky + 4)
1227         {
1228            window->lastclicktime = 0;
1229            ui_input_push_mouse_double_click_event(Machine, window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
1230         }
1231         else
1232         {
1233            window->lastclicktime = ticks;
1234            window->lastclickx = GET_X_LPARAM(lparam);
1235            window->lastclicky = GET_Y_LPARAM(lparam);
1236         }
1237         break;
1238      }
1239
1240      case WM_CHAR:
1241         ui_input_push_char_event(Machine, window->target, (unicode_char) wparam);
1242         break;
1243
12341244      // pause the system when we start a menu or resize
12351245      case WM_ENTERSIZEMOVE:
12361246         window->resize_state = RESIZE_STATE_RESIZING;
src/osd/windows/window.h
r2956r2957
7171   int               targetlayerconfig;
7272   const render_primitive_list *primlist;
7373
74   // input info
75   DWORD            lastclicktime;
76   int               lastclickx;
77   int               lastclicky;
78
7479   // drawing data
7580   void *            drawdata;
7681};
src/emu/romload.h
r2956r2957
2727enum
2828{
2929   ROMENTRYTYPE_REGION = 1,   /* this entry marks the start of a region */
30   ROMENTRYTYPE_END,      /* this entry marks the end of a region */
30   ROMENTRYTYPE_END,         /* this entry marks the end of a region */
3131   ROMENTRYTYPE_RELOAD,      /* this entry reloads the previous ROM */
3232   ROMENTRYTYPE_CONTINUE,      /* this entry continues loading the previous ROM */
33   ROMENTRYTYPE_FILL,      /* this entry fills an area with a constant value */
34   ROMENTRYTYPE_COPY,      /* this entry copies data from another region/offset */
33   ROMENTRYTYPE_FILL,         /* this entry fills an area with a constant value */
34   ROMENTRYTYPE_COPY,         /* this entry copies data from another region/offset */
3535   ROMENTRYTYPE_CARTRIDGE,      /* this entry specifies a cartridge (MESS) */
3636   ROMENTRYTYPE_IGNORE,      /* this entry continues loading the previous ROM but throws the data away */
3737   ROMENTRYTYPE_SYSTEM_BIOS,   /* this entry specifies a bios */
src/emu/debug/express.h
r2956r2957
4545#define EXPSPACE_PROGRAM               (0)
4646#define EXPSPACE_DATA                  (1)
4747#define EXPSPACE_IO                     (2)
48#define EXPSPACE_OPCODE                  (3)
49#define EXPSPACE_RAMWRITE               (4)
50#define EXPSPACE_EEPROM                  (5)
51#define EXPSPACE_CPU                  (6)
52#define EXPSPACE_USER                  (7)
53#define EXPSPACE_GFX                  (8)
54#define EXPSPACE_SOUND                  (9)
4855
4956
5057
r2956r2957
7986    TYPE DEFINITIONS
8087***************************************************************************/
8188
89/* callback functions for getting/setting a symbol value */
90typedef UINT64 (*symbol_getter_func)(UINT32 ref);
91typedef void (*symbol_setter_func)(UINT32 ref, UINT64 value);
92
93/* callback function for execution a function */
94typedef UINT64 (*function_execute_func)(UINT32 ref, UINT32 numparams, const UINT64 *paramlist);
95
96/* callback function for memory reads/writes */
97typedef UINT64 (*express_read_func)(int space, int index, UINT32 offset, int size);
98typedef void (*express_write_func)(int space, int index, UINT32 offset, int size, UINT64 value);
99
100
101/* callback parameter for executing expressions */
102typedef struct _express_callbacks express_callbacks;
103struct _express_callbacks
104{
105   express_read_func   read;               /* read callback */
106   express_write_func   write;               /* write callback */
107};
108
109
82110/* symbol_entry describes a symbol in a symbol table */
83111typedef struct _symbol_entry symbol_entry;
84112struct _symbol_entry
r2956r2957
90118      /* register info */
91119      struct
92120      {
93         UINT64         (*getter)(UINT32);         /* value getter */
94         void         (*setter)(UINT32, UINT64);   /* value setter */
121         symbol_getter_func       getter;      /* value getter */
122         symbol_setter_func       setter;      /* value setter */
95123      } reg;
96124
97125      /* function info */
98126      struct
99127      {
100         UINT16         minparams;               /* minimum expected parameters */
101         UINT16         maxparams;               /* maximum expected parameters */
102         UINT64         (*execute)(UINT32, UINT32, UINT64 *);/* execute */
128         UINT16               minparams;   /* minimum expected parameters */
129         UINT16               maxparams;   /* maximum expected parameters */
130         function_execute_func    execute;   /* execute callback */
103131      } func;
104132
105133      /* generic info */
106134      struct generic_info
107135      {
108         void *         ptr;                  /* generic pointer */
109         UINT64         value;                  /* generic value */
136         void *               ptr;      /* generic pointer */
137         UINT64               value;      /* generic value */
110138      } gen;
111139   } info;
112140};
r2956r2957
126154
127155
128156/***************************************************************************
129    EXTERNAL DEPENDENCIES
130***************************************************************************/
131
132/* These must be provided by the caller */
133UINT64    external_read_memory(int space, UINT32 offset, int size);
134void   external_write_memory(int space, UINT32 offset, int size, UINT64 value);
135
136
137
138/***************************************************************************
139157    FUNCTION PROTOTYPES
140158***************************************************************************/
141159
142160/* expression evaluation */
143EXPRERR                expression_evaluate(const char *expression, const symbol_table *table, UINT64 *result);
144EXPRERR                expression_parse(const char *expression, const symbol_table *table, parsed_expression **result);
161EXPRERR                expression_evaluate(const char *expression, const symbol_table *table, const express_callbacks *callbacks, UINT64 *result);
162EXPRERR                expression_parse(const char *expression, const symbol_table *table, const express_callbacks *callbacks, parsed_expression **result);
145163EXPRERR                expression_execute(parsed_expression *expr, UINT64 *result);
146164void                   expression_free(parsed_expression *expr);
147165const char *            expression_original_string(parsed_expression *expr);
r2956r2957
150168/* symbol table manipulation */
151169symbol_table *            symtable_alloc(symbol_table *parent);
152170int                   symtable_add(symbol_table *table, const char *name, const symbol_entry *entry);
153int                   symtable_add_register(symbol_table *table, const char *name, UINT32 ref, UINT64 (*getter)(UINT32), void (*setter)(UINT32, UINT64));
154int                   symtable_add_function(symbol_table *table, const char *name, UINT32 ref, UINT16 minparams, UINT16 maxparams, UINT64 (*execute)(UINT32, UINT32, UINT64 *));
171int                   symtable_add_register(symbol_table *table, const char *name, UINT32 ref, symbol_getter_func getter, symbol_setter_func setter);
172int                   symtable_add_function(symbol_table *table, const char *name, UINT32 ref, UINT16 minparams, UINT16 maxparams, function_execute_func execute);
155173int                     symtable_add_value(symbol_table *table, const char *name, UINT64 value);
156174const symbol_entry *      symtable_find(const symbol_table *table, const char *name);
157175const char *            symtable_find_indexed(const symbol_table *table, int index, const symbol_entry **entry);
src/emu/debug/debugcpu.c
r2956r2957
2525#include "debugvw.h"
2626#include "debugger.h"
2727#include "deprecat.h"
28#include "uiinput.h"
29#include "machine/eeprom.h"
2830#include <ctype.h>
2931
3032
r2956r2957
8385
8486
8587
86
8788/***************************************************************************
8889    FUNCTION PROTOTYPES
8990***************************************************************************/
r2956r2957
9697static void watchpoint_check(int cpunum, int spacenum, int type, offs_t address, UINT64 value_to_write, UINT64 mem_mask);
9798static void check_hotspots(int cpunum, int spacenum, offs_t address);
9899
100/* expression handlers */
101static UINT64 expression_read_memory(int space, int index, UINT32 address, int size);
102static UINT64 expression_read_address_space(int cpuindex, int space, offs_t address, int size);
103static UINT64 expression_read_program_direct(int cpuindex, int opcode, offs_t address, int size);
104static UINT64 expression_read_memory_region(int rgnindex, int rgntype, offs_t address, int size);
105static UINT64 expression_read_eeprom(offs_t address, int size);
106static void expression_write_memory(int space, int index, UINT32 address, int size, UINT64 data);
107static void expression_write_address_space(int cpuindex, int space, offs_t address, int size, UINT64 data);
108static void expression_write_program_direct(int cpuindex, int opcode, offs_t address, int size, UINT64 data);
109static void expression_write_memory_region(int rgnindex, int rgntype, offs_t address, int size, UINT64 data);
110static void expression_write_eeprom(offs_t address, int size, UINT64 data);
111
99112/* variable getters/setters */
100113static UINT64 get_wpaddr(UINT32 ref);
101114static UINT64 get_wpdata(UINT32 ref);
r2956r2957
112125static void set_cpu_reg(UINT32 ref, UINT64 value);
113126
114127
128/***************************************************************************
129    GLOBAL CONSTANTS
130***************************************************************************/
115131
132const express_callbacks debug_expression_callbacks =
133{
134   expression_read_memory,
135   expression_write_memory
136};
137
138
139
116140/***************************************************************************
117141    FRONTENDS FOR OLDER FUNCTIONS
118142***************************************************************************/
r2956r2957
408432      }
409433
410434      /* check for debug keypresses */
411      else if (input_ui_pressed(machine, IPT_UI_DEBUG_BREAK))
435      else if (ui_input_pressed(machine, IPT_UI_DEBUG_BREAK))
412436      {
413437         global.execution_state = EXECUTION_STATE_STOPPED;
414438         debug_console_printf("User-initiated break\n");
r2956r2957
572596      while (global.execution_state == EXECUTION_STATE_STOPPED)
573597      {
574598         /* clear the memory modified flag and wait */
575         global.memory_modified = 0;
599         global.memory_modified = FALSE;
576600         osd_wait_for_debugger();
577601
578602         /* if something modified memory, update the screen */
579603         if (global.memory_modified)
604         {
605            debug_disasm_update_all();
580606            debugger_refresh_display(machine);
607         }
581608
582609         /* check for commands in the source file */
583610         process_source_file();
r2956r2957
20972124
20982125
20992126/*-------------------------------------------------
2100    external_read_memory - read 1,2,4 or 8 bytes at
2101    the given offset in the given address space
2127    expression_read_memory - read 1,2,4 or 8 bytes
2128    at the given offset in the given address
2129    space
21022130-------------------------------------------------*/
21032131
2104UINT64 external_read_memory(int space, UINT32 offset, int size)
2132static UINT64 expression_read_memory(int space, int index, UINT32 address, int size)
21052133{
2106   const debug_cpu_info *info = &global.cpuinfo[cpu_getactivecpu()];
2107   if (info->space[space].databytes == 0)
2108      return ~0;
2134   int cpuindex;
21092135
2110   /* adjust the address into a byte address */
2111   offset = ADDR2BYTE(offset, info, space);
2112   switch (size)
2136   switch (space)
21132137   {
2114      case 1:      return debug_read_byte(space, offset, TRUE);
2115      case 2:      return debug_read_word(space, offset, TRUE);
2116      case 4:      return debug_read_dword(space, offset, TRUE);
2117      case 8:      return debug_read_qword(space, offset, TRUE);
2138      case EXPSPACE_PROGRAM:
2139      case EXPSPACE_DATA:
2140      case EXPSPACE_IO:
2141         cpuindex = (index == -1) ? cpu_getactivecpu() : index;
2142         space = ADDRESS_SPACE_PROGRAM + (space - EXPSPACE_PROGRAM);
2143         return expression_read_address_space(cpuindex, space, address, size);
2144
2145      case EXPSPACE_OPCODE:
2146      case EXPSPACE_RAMWRITE:
2147         cpuindex = (index == -1) ? cpu_getactivecpu() : index;
2148         return expression_read_program_direct(cpuindex, (space == EXPSPACE_OPCODE), address, size);
2149
2150      case EXPSPACE_EEPROM:
2151         return expression_read_eeprom(address, size);
2152
2153      case EXPSPACE_CPU:
2154      case EXPSPACE_USER:
2155      case EXPSPACE_GFX:
2156      case EXPSPACE_SOUND:
2157         if (index < 1)
2158            break;
2159         space = ADDRESS_SPACE_PROGRAM + (space - EXPSPACE_PROGRAM);
2160         return expression_read_memory_region(index, space, address, size);
21182161   }
2119   return ~0;
2162   return ~(UINT64)0 >> (64 - 8*size);
21202163}
21212164
21222165
21232166/*-------------------------------------------------
2124    external_write_memory - write 1,2,4 or 8 bytes to
2125    the given offset in the given address space
2167    expression_read_address_space - read memory
2168    from a specific CPU's address space
21262169-------------------------------------------------*/
21272170
2128void external_write_memory(int space, UINT32 offset, int size, UINT64 value)
2171static UINT64 expression_read_address_space(int cpuindex, int space, offs_t address, int size)
21292172{
2130   const debug_cpu_info *info = &global.cpuinfo[cpu_getactivecpu()];
2131   if (info->space[space].databytes == 0)
2132      return;
2173   const debug_cpu_info *info = &global.cpuinfo[cpuindex];
2174   UINT64 result = ~(UINT64)0 >> (64 - 8*size);
21332175
2134   /* adjust the address into a byte address */
2135   offset = ADDR2BYTE(offset, info, space);
2136   switch (size)
2176   /* only process if in of range and we have a bus */
2177   if (cpuindex < ARRAY_LENGTH(global.cpuinfo) && info->space[space].databytes != 0)
21372178   {
2138      case 1:      debug_write_byte(space, offset, value, TRUE); break;
2139      case 2:      debug_write_word(space, offset, value, TRUE); break;
2140      case 4:      debug_write_dword(space, offset, value, TRUE); break;
2141      case 8:      debug_write_qword(space, offset, value, TRUE); break;
2179      /* adjust the address into a byte address */
2180      address = ADDR2BYTE(address, info, space);
2181
2182      /* switch contexts and do the read */
2183      cpuintrf_push_context(cpuindex);
2184      switch (size)
2185      {
2186         case 1:      result = debug_read_byte(space, address, TRUE);      break;
2187         case 2:      result = debug_read_word(space, address, TRUE);      break;
2188         case 4:      result = debug_read_dword(space, address, TRUE);   break;
2189         case 8:      result = debug_read_qword(space, address, TRUE);   break;
2190      }
2191      cpuintrf_pop_context();
21422192   }
2193   return result;
21432194}
21442195
21452196
21462197/*-------------------------------------------------
2198    expression_read_program_direct - read memory
2199    directly from an opcode or RAM pointer
2200-------------------------------------------------*/
2201
2202static UINT64 expression_read_program_direct(int cpuindex, int opcode, offs_t address, int size)
2203{
2204   const debug_cpu_info *info = &global.cpuinfo[cpuindex];
2205   UINT64 result = ~(UINT64)0 >> (64 - 8*size);
2206   UINT8 *base;
2207
2208   /* only process if in of range and we have a bus */
2209   if (cpuindex < ARRAY_LENGTH(global.cpuinfo) && info->space[ADDRESS_SPACE_PROGRAM].databytes != 0)
2210   {
2211      /* adjust the address into a byte address, but not if being called recursively */
2212      if ((opcode & 2) == 0)
2213         address = ADDR2BYTE(address, info, ADDRESS_SPACE_PROGRAM);
2214
2215      /* call ourself recursively until we are byte-sized */
2216      if (size > 1)
2217      {
2218         int halfsize = size / 2;
2219         UINT64 r0, r1;
2220
2221         /* read each half, from lower address to upper address */
2222         r0 = expression_read_program_direct(cpuindex, opcode | 2, address + 0, halfsize);
2223         r1 = expression_read_program_direct(cpuindex, opcode | 2, address + halfsize, halfsize);
2224
2225         /* assemble based on the target endianness */
2226         if (info->endianness == CPU_IS_LE)
2227            result = r0 | (r1 << (8 * halfsize));
2228         else
2229            result = r1 | (r0 << (8 * halfsize));
2230      }
2231
2232      /* handle the byte-sized final requests */
2233      else
2234      {
2235         /* lowmask specified which address bits are within the databus width */
2236         offs_t lowmask = info->space[ADDRESS_SPACE_PROGRAM].databytes - 1;
2237
2238         /* get the base of memory, aligned to the address minus the lowbits */
2239         if (opcode & 1)
2240            base = memory_get_op_ptr(cpuindex, address & ~lowmask, FALSE);
2241         else
2242            base = memory_get_read_ptr(cpuindex, ADDRESS_SPACE_PROGRAM, address & ~lowmask);
2243
2244         /* if we have a valid base, return the appropriate byte */
2245         if (base != NULL)
2246         {
2247            if (info->endianness == CPU_IS_LE)
2248               result = base[BYTE8_XOR_LE(address) & lowmask];
2249            else
2250               result = base[BYTE8_XOR_BE(address) & lowmask];
2251         }
2252      }
2253   }
2254   return result;
2255}
2256
2257
2258/*-------------------------------------------------
2259    expression_read_memory_region - read memory
2260    from a memory region
2261-------------------------------------------------*/
2262
2263static UINT64 expression_read_memory_region(int rgnindex, int rgntype, offs_t address, int size)
2264{
2265   UINT64 result = ~(UINT64)0 >> (64 - 8*size);
2266   int rgnnum = -1;
2267
2268   /* convert to a region number */
2269   switch (rgntype)
2270   {
2271      case EXPSPACE_CPU:      rgnnum = REGION_CPU1 + (rgnindex - 1);      break;
2272      case EXPSPACE_USER:      rgnnum = REGION_USER1 + (rgnindex - 1);      break;
2273      case EXPSPACE_GFX:      rgnnum = REGION_GFX1 + (rgnindex - 1);      break;
2274      case EXPSPACE_SOUND:   rgnnum = REGION_SOUND1 + (rgnindex - 1);   break;
2275   }
2276
2277   /* process if it exists */
2278   if (rgnnum != -1)
2279   {
2280      UINT8 *base = memory_region(Machine, rgnnum);
2281
2282      /* make sure we get a valid base before proceeding */
2283      if (base != NULL)
2284      {
2285         UINT32 length = memory_region_length(Machine, rgnnum);
2286         UINT32 flags = memory_region_flags(Machine, rgnnum);
2287
2288         /* call ourself recursively until we are byte-sized */
2289         if (size > 1)
2290         {
2291            int halfsize = size / 2;
2292            UINT64 r0, r1;
2293
2294            /* read each half, from lower address to upper address */
2295            r0 = expression_read_memory_region(rgnindex, rgntype, address + 0, halfsize);
2296            r1 = expression_read_memory_region(rgnindex, rgntype, address + halfsize, halfsize);
2297
2298            /* assemble based on the target endianness */
2299            if ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE)
2300               result = r0 | (r1 << (8 * halfsize));
2301            else
2302               result = r1 | (r0 << (8 * halfsize));
2303         }
2304
2305         /* only process if we're within range */
2306         else if (address < length)
2307         {
2308            /* lowmask specified which address bits are within the databus width */
2309            UINT32 lowmask = (1 << (flags & ROMREGION_WIDTHMASK)) - 1;
2310            base += address & ~lowmask;
2311
2312            /* if we have a valid base, return the appropriate byte */
2313            if ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE)
2314               result = base[BYTE8_XOR_LE(address) & lowmask];
2315            else
2316               result = base[BYTE8_XOR_BE(address) & lowmask];
2317         }
2318      }
2319   }
2320   return result;
2321}
2322
2323
2324/*-------------------------------------------------
2325    expression_read_eeprom - read EEPROM data
2326-------------------------------------------------*/
2327
2328static UINT64 expression_read_eeprom(offs_t address, int size)
2329{
2330   UINT64 result = ~(UINT64)0 >> (64 - 8*size);
2331   UINT32 eelength, eesize;
2332   void *base;
2333
2334   /* make sure we get a valid base before proceeding */
2335   base = eeprom_get_data_pointer(&eelength, &eesize);
2336   if (base != NULL && address < eelength)
2337   {
2338      /* switch off the size */
2339      switch (eesize)
2340      {
2341         case 1:      result &= ((UINT8 *)base)[address];                     break;
2342         case 2:      result &= BIG_ENDIANIZE_INT16(((UINT16 *)base)[address]);   break;
2343      }
2344   }
2345   return result;
2346}
2347
2348
2349/*-------------------------------------------------
2350    expression_write_memory - write 1,2,4 or 8
2351    bytes at the given offset in the given address
2352    space
2353-------------------------------------------------*/
2354
2355static void expression_write_memory(int space, int index, UINT32 address, int size, UINT64 data)
2356{
2357   int cpuindex;
2358
2359   switch (space)
2360   {
2361      case EXPSPACE_PROGRAM:
2362      case EXPSPACE_DATA:
2363      case EXPSPACE_IO:
2364         cpuindex = (index == -1) ? cpu_getactivecpu() : index;
2365         space = ADDRESS_SPACE_PROGRAM + (space - EXPSPACE_PROGRAM);
2366         expression_write_address_space(cpuindex, space, address, size, data);
2367         break;
2368
2369      case EXPSPACE_OPCODE:
2370      case EXPSPACE_RAMWRITE:
2371         cpuindex = (index == -1) ? cpu_getactivecpu() : index;
2372         expression_write_program_direct(cpuindex, (space == EXPSPACE_OPCODE), address, size, data);
2373         break;
2374
2375      case EXPSPACE_EEPROM:
2376         expression_write_eeprom(address, size, data);
2377         break;
2378
2379      case EXPSPACE_CPU:
2380      case EXPSPACE_USER:
2381      case EXPSPACE_GFX:
2382      case EXPSPACE_SOUND:
2383         if (index < 1)
2384            break;
2385         space = ADDRESS_SPACE_PROGRAM + (space - EXPSPACE_PROGRAM);
2386         expression_write_memory_region(index, space, address, size, data);
2387         break;
2388   }
2389}
2390
2391
2392/*-------------------------------------------------
2393    expression_write_address_space - write memory
2394    to a specific CPU's address space
2395-------------------------------------------------*/
2396
2397static void expression_write_address_space(int cpuindex, int space, offs_t address, int size, UINT64 data)
2398{
2399   const debug_cpu_info *info = &global.cpuinfo[cpuindex];
2400
2401   /* only process if in of range and we have a bus */
2402   if (cpuindex < ARRAY_LENGTH(global.cpuinfo) && info->space[space].databytes != 0)
2403   {
2404      /* adjust the address into a byte address */
2405      address = ADDR2BYTE(address, info, space);
2406
2407      /* switch contexts and do the write */
2408      cpuintrf_push_context(cpuindex);
2409      switch (size)
2410      {
2411         case 1:      debug_write_byte(space, address, data, TRUE);   break;
2412         case 2:      debug_write_word(space, address, data, TRUE);   break;
2413         case 4:      debug_write_dword(space, address, data, TRUE);   break;
2414         case 8:      debug_write_qword(space, address, data, TRUE);   break;
2415      }
2416      cpuintrf_pop_context();
2417   }
2418}
2419
2420
2421/*-------------------------------------------------
2422    expression_write_program_direct - write memory
2423    directly to an opcode or RAM pointer
2424-------------------------------------------------*/
2425
2426static void expression_write_program_direct(int cpuindex, int opcode, offs_t address, int size, UINT64 data)
2427{
2428   const debug_cpu_info *info = &global.cpuinfo[cpuindex];
2429   UINT8 *base;
2430
2431   /* only process if in of range and we have a bus */
2432   if (cpuindex < ARRAY_LENGTH(global.cpuinfo) && info->space[ADDRESS_SPACE_PROGRAM].databytes != 0)
2433   {
2434      /* adjust the address into a byte address, but not if being called recursively */
2435      if ((opcode & 2) == 0)
2436         address = ADDR2BYTE(address, info, ADDRESS_SPACE_PROGRAM);
2437
2438      /* call ourself recursively until we are byte-sized */
2439      if (size > 1)
2440      {
2441         int halfsize = size / 2;
2442         UINT64 r0, r1, halfmask;
2443
2444         /* break apart based on the target endianness */
2445         halfmask = ~(UINT64)0 >> (64 - 8 * halfsize);
2446         if (info->endianness == CPU_IS_LE)
2447         {
2448            r0 = data & halfmask;
2449            r1 = (data >> (8 * halfsize)) & halfmask;
2450         }
2451         else
2452         {
2453            r0 = (data >> (8 * halfsize)) & halfmask;
2454            r1 = data & halfmask;
2455         }
2456
2457         /* write each half, from lower address to upper address */
2458         expression_write_program_direct(cpuindex, opcode | 2, address + 0, halfsize, r0);
2459         expression_write_program_direct(cpuindex, opcode | 2, address + halfsize, halfsize, r1);
2460      }
2461
2462      /* handle the byte-sized final case */
2463      else
2464      {
2465         /* lowmask specified which address bits are within the databus width */
2466         offs_t lowmask = info->space[ADDRESS_SPACE_PROGRAM].databytes - 1;
2467
2468         /* get the base of memory, aligned to the address minus the lowbits */
2469         if (opcode & 1)
2470            base = memory_get_op_ptr(cpuindex, address & ~lowmask, FALSE);
2471         else
2472            base = memory_get_read_ptr(cpuindex, ADDRESS_SPACE_PROGRAM, address & ~lowmask);
2473
2474         /* if we have a valid base, write the appropriate byte */
2475         if (base != NULL)
2476         {
2477            if (info->endianness == CPU_IS_LE)
2478               base[BYTE8_XOR_LE(address) & lowmask] = data;
2479            else
2480               base[BYTE8_XOR_BE(address) & lowmask] = data;
2481            global.memory_modified = TRUE;
2482         }
2483      }
2484   }
2485}
2486
2487
2488/*-------------------------------------------------
2489    expression_write_memory_region - write memory
2490    from a memory region
2491-------------------------------------------------*/
2492
2493static void expression_write_memory_region(int rgnindex, int rgntype, offs_t address, int size, UINT64 data)
2494{
2495   int rgnnum = -1;
2496
2497   /* convert to a region number */
2498   switch (rgntype)
2499   {
2500      case EXPSPACE_CPU:      rgnnum = REGION_CPU1 + (rgnindex - 1);      break;
2501      case EXPSPACE_USER:      rgnnum = REGION_USER1 + (rgnindex - 1);      break;
2502      case EXPSPACE_GFX:      rgnnum = REGION_GFX1 + (rgnindex - 1);      break;
2503      case EXPSPACE_SOUND:   rgnnum = REGION_SOUND1 + (rgnindex - 1);   break;
2504   }
2505
2506   /* process if it exists */
2507   if (rgnnum != -1)
2508   {
2509      UINT8 *base = memory_region(Machine, rgnnum);
2510
2511      /* make sure we get a valid base before proceeding */
2512      if (base != NULL)
2513      {
2514         UINT32 length = memory_region_length(Machine, rgnnum);
2515         UINT32 flags = memory_region_flags(Machine, rgnnum);
2516
2517         /* call ourself recursively until we are byte-sized */
2518         if (size > 1)
2519         {
2520            int halfsize = size / 2;
2521            UINT64 r0, r1, halfmask;
2522
2523            /* break apart based on the target endianness */
2524            halfmask = ~(UINT64)0 >> (64 - 8 * halfsize);
2525            if ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE)
2526            {
2527               r0 = data & halfmask;
2528               r1 = (data >> (8 * halfsize)) & halfmask;
2529            }
2530            else
2531            {
2532               r0 = (data >> (8 * halfsize)) & halfmask;
2533               r1 = data & halfmask;
2534            }
2535
2536            /* write each half, from lower address to upper address */
2537            expression_write_memory_region(rgnindex, rgntype, address + 0, halfsize, r0);
2538            expression_write_memory_region(rgnindex, rgntype, address + halfsize, halfsize, r1);
2539         }
2540
2541         /* only process if we're within range */
2542         else if (address < length)
2543         {
2544            /* lowmask specified which address bits are within the databus width */
2545            UINT32 lowmask = (1 << (flags & ROMREGION_WIDTHMASK)) - 1;
2546            base += address & ~lowmask;
2547
2548            /* if we have a valid base, set the appropriate byte */
2549            if ((flags & ROMREGION_ENDIANMASK) == ROMREGION_LE)
2550               base[BYTE8_XOR_LE(address) & lowmask] = data;
2551            else
2552               base[BYTE8_XOR_BE(address) & lowmask] = data;
2553            global.memory_modified = TRUE;
2554         }
2555      }
2556   }
2557}
2558
2559
2560/*-------------------------------------------------
2561    expression_write_eeprom - write EEPROM data
2562-------------------------------------------------*/
2563
2564static void expression_write_eeprom(offs_t address, int size, UINT64 data)
2565{
2566   UINT32 eelength, eesize;
2567   void *vbase = eeprom_get_data_pointer(&eelength, &eesize);
2568
2569   /* make sure we get a valid base before proceeding */
2570   if (vbase != NULL && address < eelength)
2571   {
2572      UINT64 mask = ~(UINT64)0 >> (64 - 8*size);
2573
2574      /* switch off the size */
2575      switch (eesize)
2576      {
2577         case 1:
2578         {
2579            UINT8 *base = (UINT8 *)vbase + address;
2580            *base = (*base & ~mask) | (data & mask);
2581            break;
2582         }
2583
2584         case 2:
2585         {
2586            UINT16 *base = (UINT16 *)vbase + address;
2587            UINT16 value = BIG_ENDIANIZE_INT16(*base);
2588            value = (value & ~mask) | (data & mask);
2589            *base = BIG_ENDIANIZE_INT16(value);
2590            break;
2591         }
2592      }
2593      global.memory_modified = TRUE;
2594   }
2595}
2596
2597
2598/*-------------------------------------------------
21472599    debug_cpu_trace_printf - writes text to a given
21482600    CPU's trace file
21492601-------------------------------------------------*/
src/emu/debug/debugvw.c
r2956r2957
16351635      parsed_expression *expr;
16361636
16371637      /* parse the new expression */
1638      exprerr = expression_parse(dasmdata->expression_string, debug_get_cpu_info(dasmdata->cpunum)->symtable, &expr);
1638      exprerr = expression_parse(dasmdata->expression_string, debug_get_cpu_info(dasmdata->cpunum)->symtable, &debug_expression_callbacks, &expr);
16391639
16401640      /* if it worked, update the expression */
16411641      if (exprerr == EXPRERR_NONE)
r2956r2957
27062706      parsed_expression *expr;
27072707
27082708      /* parse the new expression */
2709      exprerr = expression_parse(memdata->expression_string, debug_get_cpu_info(memdata->cpunum)->symtable, &expr);
2709      exprerr = expression_parse(memdata->expression_string, debug_get_cpu_info(memdata->cpunum)->symtable, &debug_expression_callbacks, &expr);
27102710
27112711      /* if it worked, update the expression */
27122712      if (exprerr == EXPRERR_NONE)
src/emu/debug/debugcpu.h
r2956r2957
204204
205205extern FILE *debug_source_file;
206206extern symbol_table *global_symtable;
207extern const express_callbacks debug_expression_callbacks;
207208
208209
209210
src/emu/debug/debugcmd.c
r2956r2957
4949
5050static void debug_command_exit(running_machine *machine);
5151
52static UINT64 execute_min(UINT32 ref, UINT32 params, UINT64 *param);
53static UINT64 execute_max(UINT32 ref, UINT32 params, UINT64 *param);
54static UINT64 execute_if(UINT32 ref, UINT32 params, UINT64 *param);
52static UINT64 execute_min(UINT32 ref, UINT32 params, const UINT64 *param);
53static UINT64 execute_max(UINT32 ref, UINT32 params, const UINT64 *param);
54static UINT64 execute_if(UINT32 ref, UINT32 params, const UINT64 *param);
5555
5656static UINT64 global_get(UINT32 ref);
5757static void global_set(UINT32 ref, UINT64 value);
r2956r2957
279279    execute_min - return the minimum of two values
280280-------------------------------------------------*/
281281
282static UINT64 execute_min(UINT32 ref, UINT32 params, UINT64 *param)
282static UINT64 execute_min(UINT32 ref, UINT32 params, const UINT64 *param)
283283{
284284   return (param[0] < param[1]) ? param[0] : param[1];
285285}
r2956r2957
289289    execute_max - return the maximum of two values
290290-------------------------------------------------*/
291291
292static UINT64 execute_max(UINT32 ref, UINT32 params, UINT64 *param)
292static UINT64 execute_max(UINT32 ref, UINT32 params, const UINT64 *param)
293293{
294294   return (param[0] > param[1]) ? param[0] : param[1];
295295}
r2956r2957
299299    execute_if - if (a) return b; else return c;
300300-------------------------------------------------*/
301301
302static UINT64 execute_if(UINT32 ref, UINT32 params, UINT64 *param)
302static UINT64 execute_if(UINT32 ref, UINT32 params, const UINT64 *param)
303303{
304304   return param[0] ? param[1] : param[2];
305305}
r2956r2957
361361
362362int debug_command_parameter_number(const char *param, UINT64 *result)
363363{
364   EXPRERR err = expression_evaluate(param, debug_get_cpu_info(cpu_getactivecpu())->symtable, result);
364   EXPRERR err = expression_evaluate(param, debug_get_cpu_info(cpu_getactivecpu())->symtable, &debug_expression_callbacks, result);
365365   if (err == EXPRERR_NONE)
366366      return 1;
367367   debug_console_printf("Error in expression: %s\n", param);
r2956r2957
378378
379379static int debug_command_parameter_expression(const char *param, parsed_expression **result)
380380{
381   EXPRERR err = expression_parse(param, debug_get_cpu_info(cpu_getactivecpu())->symtable, result);
381   EXPRERR err = expression_parse(param, debug_get_cpu_info(cpu_getactivecpu())->symtable, &debug_expression_callbacks, result);
382382   if (err == EXPRERR_NONE)
383383      return 1;
384384   debug_console_printf("Error in expression: %s\n", param);
src/emu/debug/debugcon.c
r2956r2957
329329      if (isexpr && paramcount == 1)
330330      {
331331         UINT64 expresult;
332         EXPRERR exprerr = expression_evaluate(command_start, debug_get_cpu_info(cpu_getactivecpu())->symtable, &expresult);
332         EXPRERR exprerr = expression_evaluate(command_start, debug_get_cpu_info(cpu_getactivecpu())->symtable, &debug_expression_callbacks, &expresult);
333333         if (exprerr != EXPRERR_NONE)
334334            return MAKE_CMDERR_EXPRESSION_ERROR(EXPRERR_ERROR_OFFSET(exprerr));
335335      }
src/emu/debug/express.c
r2956r2957
8080   TIN_MEMORY_DWORD      = (2 << TIN_MEMORY_SIZE_SHIFT),
8181   TIN_MEMORY_QWORD      = (3 << TIN_MEMORY_SIZE_SHIFT),
8282
83   TIN_MEMORY_SPACE_SHIFT   = 10,
84   TIN_MEMORY_SPACE_MASK   = (3 << TIN_MEMORY_SPACE_SHIFT),
85   TIN_MEMORY_PROGRAM      = (EXPSPACE_PROGRAM << TIN_MEMORY_SPACE_SHIFT),
86   TIN_MEMORY_DATA         = (EXPSPACE_DATA    << TIN_MEMORY_SPACE_SHIFT),
87   TIN_MEMORY_IO         = (EXPSPACE_IO      << TIN_MEMORY_SPACE_SHIFT),
83   TIN_MEMORY_SPACE_SHIFT   = 12,
84   TIN_MEMORY_SPACE_MASK   = (0xf << TIN_MEMORY_SPACE_SHIFT),
85   TIN_MEMORY_PROGRAM      = (EXPSPACE_PROGRAM   << TIN_MEMORY_SPACE_SHIFT),
86   TIN_MEMORY_DATA         = (EXPSPACE_DATA      << TIN_MEMORY_SPACE_SHIFT),
87   TIN_MEMORY_IO         = (EXPSPACE_IO        << TIN_MEMORY_SPACE_SHIFT),
88   TIN_MEMORY_OPCODE      = (EXPSPACE_OPCODE    << TIN_MEMORY_SPACE_SHIFT),
89   TIN_MEMORY_RAMWRITE      = (EXPSPACE_RAMWRITE  << TIN_MEMORY_SPACE_SHIFT),
90   TIN_MEMORY_EEPROM      = (EXPSPACE_EEPROM     << TIN_MEMORY_SPACE_SHIFT),
91   TIN_MEMORY_CPU         = (EXPSPACE_CPU       << TIN_MEMORY_SPACE_SHIFT),
92   TIN_MEMORY_USER         = (EXPSPACE_USER      << TIN_MEMORY_SPACE_SHIFT),
93   TIN_MEMORY_GFX         = (EXPSPACE_GFX       << TIN_MEMORY_SPACE_SHIFT),
94   TIN_MEMORY_SOUND      = (EXPSPACE_SOUND     << TIN_MEMORY_SPACE_SHIFT),
95
96   TIN_MEMORY_INDEX_SHIFT   = 16,
97   TIN_MEMORY_INDEX_MASK   = (0xf << TIN_MEMORY_INDEX_SHIFT)
8898};
8999
90100
r2956r2957
146156typedef union _int_ptr int_ptr;
147157union _int_ptr
148158{
149   void *         p;            /* pointer value */
150   UINT64         i;            /* integer value */
159   void *               p;                        /* pointer value */
160   UINT64               i;                        /* integer value */
151161};
152162
153163
164typedef UINT32 token_type;
165typedef UINT32 token_info;
166
167
154168typedef struct _parse_token parse_token;
155169struct _parse_token
156170{
157   UINT16         type;         /* type of token */
158   UINT16         info;         /* info for token */
159   UINT32         offset;         /* offset within the string */
160   int_ptr         value;         /* value of token */
171   token_type            type;                     /* type of token */
172   token_info            info;                     /* info for token */
173   UINT32               offset;                     /* offset within the string */
174   int_ptr               value;                     /* value of token */
161175};
162176
163177
164178typedef struct _internal_symbol_entry internal_symbol_entry;
165179struct _internal_symbol_entry
166180{
167   internal_symbol_entry *next;   /* pointer to the next entry */
168   const char *   name;         /* name of the symbol */
169   symbol_entry   entry;      /* actual entry data */
181   internal_symbol_entry *   next;                     /* pointer to the next entry */
182   const char *         name;                     /* name of the symbol */
183   symbol_entry         entry;                     /* actual entry data */
170184};
171185
172186
173187/* typedef struct _symbol_table symbol_table -- defined in express.h */
174188struct _symbol_table
175189{
176   symbol_table *parent;   /* pointer to the parent symbol table */
177   internal_symbol_entry *hash[SYM_TABLE_HASH_SIZE]; /* hash table */
190   symbol_table *         parent;                     /* pointer to the parent symbol table */
191   internal_symbol_entry *   hash[SYM_TABLE_HASH_SIZE];       /* hash table */
178192};
179193
180194
181195/* typedef struct _parsed_expression parsed_expression -- defined in express.h */
182196struct _parsed_expression
183197{
184   const symbol_table *table; /* symbol table */
185   char *         original_string;/* original string (prior to parsing) */
186   char *         string[MAX_EXPRESSION_STRINGS]; /* string table */
187   parse_token      token[MAX_TOKENS];/* array of tokens */
188   int            token_stack_ptr;/* stack poointer */
189   parse_token      token_stack[MAX_STACK_DEPTH];/* token stack */
198   const symbol_table *   table;                      /* symbol table */
199   char *               original_string;            /* original string (prior to parsing) */
200   express_callbacks       callbacks;                  /* callbacks */
201   char *               string[MAX_EXPRESSION_STRINGS]; /* string table */
202   parse_token            token[MAX_TOKENS];            /* array of tokens */
203   int                  token_stack_ptr;            /* stack poointer */
204   parse_token            token_stack[MAX_STACK_DEPTH];   /* token stack */
190205};
191206
192207
r2956r2957
313328   /* memory tokens get resolved down to number tokens */
314329   else if (token->type == TOK_MEMORY)
315330   {
331      int index = (token->info & TIN_MEMORY_INDEX_MASK) >> TIN_MEMORY_INDEX_SHIFT;
316332      int space = (token->info & TIN_MEMORY_SPACE_MASK) >> TIN_MEMORY_SPACE_SHIFT;
317333      int size = (token->info & TIN_MEMORY_SIZE_MASK) >> TIN_MEMORY_SIZE_SHIFT;
334      if ((token->info & TIN_MEMORY_INDEX_MASK) == TIN_MEMORY_INDEX_MASK)
335         index = -1;
318336      token->type = TOK_NUMBER;
319      token->value.i = external_read_memory(space, token->value.i, 1 << size);
337      if (expr->callbacks.read != NULL)
338         token->value.i = (*expr->callbacks.read)(space, index, token->value.i, 1 << size);
339      else
340         token->value.i = 0;
320341   }
321342
322343   /* to be an rval, the token must be a number */
r2956r2957
331352    for a SYMBOL token
332353-------------------------------------------------*/
333354
334INLINE UINT64 get_lval_value(parse_token *token, const symbol_table *table)
355INLINE UINT64 get_lval_value(parsed_expression *expr, parse_token *token, const symbol_table *table)
335356{
336357   if (token->type == TOK_SYMBOL)
337358   {
r2956r2957
341362   }
342363   else if (token->type == TOK_MEMORY)
343364   {
365      int index = (token->info & TIN_MEMORY_INDEX_MASK) >> TIN_MEMORY_INDEX_SHIFT;
344366      int space = (token->info & TIN_MEMORY_SPACE_MASK) >> TIN_MEMORY_SPACE_SHIFT;
345367      int size = (token->info & TIN_MEMORY_SIZE_MASK) >> TIN_MEMORY_SIZE_SHIFT;
346      return external_read_memory(space, token->value.i, 1 << size);
368      if ((token->info & TIN_MEMORY_INDEX_MASK) == TIN_MEMORY_INDEX_MASK)
369         index = -1;
370      if (expr->callbacks.read != NULL)
371         return (*expr->callbacks.read)(space, index, token->value.i, 1 << size);
347372   }
348373   return 0;
349374}
r2956r2957
354379    for a SYMBOL token
355380-------------------------------------------------*/
356381
357INLINE void set_lval_value(parse_token *token, const symbol_table *table, UINT64 value)
382INLINE void set_lval_value(parsed_expression *expr, parse_token *token, const symbol_table *table, UINT64 value)
358383{
359384   if (token->type == TOK_SYMBOL)
360385   {
r2956r2957
364389   }
365390   else if (token->type == TOK_MEMORY)
366391   {
392      int index = (token->info & TIN_MEMORY_INDEX_MASK) >> TIN_MEMORY_INDEX_SHIFT;
367393      int space = (token->info & TIN_MEMORY_SPACE_MASK) >> TIN_MEMORY_SPACE_SHIFT;
368394      int size = (token->info & TIN_MEMORY_SIZE_MASK) >> TIN_MEMORY_SIZE_SHIFT;
369      external_write_memory(space, token->value.i, 1 << size, value);
395      if ((token->info & TIN_MEMORY_INDEX_MASK) == TIN_MEMORY_INDEX_MASK)
396         index = -1;
397      if (expr->callbacks.write != NULL)
398         (*expr->callbacks.write)(space, index, token->value.i, 1 << size, value);
370399   }
371400}
372401
r2956r2957
480509    forms of memory operators
481510-------------------------------------------------*/
482511
483static int parse_memory_operator(const char *buffer, UINT16 *flags)
512static int parse_memory_operator(const char *buffer, token_info *flags)
484513{
485514   int length = (int)strlen(buffer);
486515   int space = 'p', size;
516   int index = -1;
487517
488518   *flags = 0;
489519
490   /* length 2 means space, then size */
491   if (length == 2)
520   /* length 2 or more means space, optional index, then size */
521   if (length >= 2)
492522   {
493523      space = buffer[0];
494      size = buffer[1];
524      if (length >= 3)
525         sscanf(&buffer[1], "%d", &index);
526      size = buffer[length - 1];
495527   }
496528
497529   /* length 1 means size */
r2956r2957
508540      case 'p':   *flags |= TIN_MEMORY_PROGRAM;   break;
509541      case 'd':   *flags |= TIN_MEMORY_DATA;      break;
510542      case 'i':   *flags |= TIN_MEMORY_IO;      break;
543      case 'o':   *flags |= TIN_MEMORY_OPCODE;   break;
544      case 'r':   *flags |= TIN_MEMORY_RAMWRITE;   break;
545      case 'e':   *flags |= TIN_MEMORY_EEPROM;   break;
546      case 'c':   *flags |= TIN_MEMORY_CPU;      break;
547      case 'u':   *flags |= TIN_MEMORY_USER;      break;
548      case 'g':   *flags |= TIN_MEMORY_GFX;      break;
549      case 's':   *flags |= TIN_MEMORY_SOUND;      break;
511550      default:   return 0;
512551   }
513552
r2956r2957
520559      case 'q':   *flags |= TIN_MEMORY_QWORD;      break;
521560      default:   return 0;
522561   }
562
563   /* add the index to flags */
564   *flags |= index << TIN_MEMORY_INDEX_SHIFT;
565
523566   return 1;
524567}
525568
r2956r2957
781824            /* check for memory @ operators */
782825            if (string[0] == '@')
783826            {
784               UINT16 info;
827               token_info info;
785828               if (parse_memory_operator(buffer, &info))
786829               {
787830                  SET_TOKEN_INFO(1, TOK_OPERATOR, TVL_MEMORYAT, TIN_PRECEDENCE_2 | info);
r2956r2957
11961239            {
11971240               case TVL_PREINCREMENT:
11981241                  exprerr = pop_token_lval(expr, &t1, expr->table); if (exprerr != 0) return exprerr;
1199                  tempnum.value.i = get_lval_value(&t1, expr->table) + 1;
1242                  tempnum.value.i = get_lval_value(expr, &t1, expr->table) + 1;
12001243                  tempnum.offset = t1.offset;
12011244                  exprerr = push_token(expr, &tempnum); if (exprerr != 0) return exprerr;
1202                  set_lval_value(&t1, expr->table, tempnum.value.i);
1245                  set_lval_value(expr, &t1, expr->table, tempnum.value.i);
12031246                  break;
12041247
12051248               case TVL_PREDECREMENT:
12061249                  exprerr = pop_token_lval(expr, &t1, expr->table); if (exprerr != 0) return exprerr;
1207                  tempnum.value.i = get_lval_value(&t1, expr->table) - 1;
1250                  tempnum.value.i = get_lval_value(expr, &t1, expr->table) - 1;
12081251                  tempnum.offset = t1.offset;
12091252                  exprerr = push_token(expr, &tempnum); if (exprerr != 0) return exprerr;
1210                  set_lval_value(&t1, expr->table, tempnum.value.i);
1253                  set_lval_value(expr, &t1, expr->table, tempnum.value.i);
12111254                  break;
12121255
12131256               case TVL_POSTINCREMENT:
12141257                  exprerr = pop_token_lval(expr, &t1, expr->table); if (exprerr != 0) return exprerr;
1215                  tempnum.value.i = get_lval_value(&t1, expr->table);
1258                  tempnum.value.i = get_lval_value(expr, &t1, expr->table);
12161259                  tempnum.offset = t1.offset;
12171260                  exprerr = push_token(expr, &tempnum); if (exprerr != 0) return exprerr;
1218                  set_lval_value(&t1, expr->table, tempnum.value.i + 1);
1261                  set_lval_value(expr, &t1, expr->table, tempnum.value.i + 1);
12191262                  break;
12201263
12211264               case TVL_POSTDECREMENT:
12221265                  exprerr = pop_token_lval(expr, &t1, expr->table); if (exprerr != 0) return exprerr;
1223                  tempnum.value.i = get_lval_value(&t1, expr->table);
1266                  tempnum.value.i = get_lval_value(expr, &t1, expr->table);
12241267                  tempnum.offset = t1.offset;
12251268                  exprerr = push_token(expr, &tempnum); if (exprerr != 0) return exprerr;
1226                  set_lval_value(&t1, expr->table, tempnum.value.i - 1);
1269                  set_lval_value(expr, &t1, expr->table, tempnum.value.i - 1);
12271270                  break;
12281271
12291272               case TVL_COMPLEMENT:
r2956r2957
14041447                  exprerr = pop_token_rval(expr, &t2, expr->table); if (exprerr != 0) return exprerr;
14051448                  exprerr = pop_token_lval(expr, &t1, expr->table); if (exprerr != 0) return exprerr;
14061449                  push_token(expr, &t2);
1407                  set_lval_value(&t1, expr->table, t2.value.i);
1450                  set_lval_value(expr, &t1, expr->table, t2.value.i);
14081451                  break;
14091452
14101453               case TVL_ASSIGNMULTIPLY:
14111454                  exprerr = pop_token_rval(expr, &t2, expr->table); if (exprerr != 0) return exprerr;
14121455                  exprerr = pop_token_lval(expr, &t1, expr->table); if (exprerr != 0) return exprerr;
1413                  tempnum.value.i = get_lval_value(&t1, expr->table);
1456                  tempnum.value.i = get_lval_value(expr, &t1, expr->table);
14141457                  tempnum.value.i *= t2.value.i;
14151458                  tempnum.offset = (t1.offset < t2.offset) ? t1.offset : t2.offset;
14161459                  exprerr = push_token(expr, &tempnum); if (exprerr != 0) return exprerr;
1417                  set_lval_value(&t1, expr->table, tempnum.value.i);
1460                  set_lval_value(expr, &t1, expr->table, tempnum.value.i);
14181461                  break;
14191462
14201463               case TVL_ASSIGNDIVIDE:
14211464                  exprerr = pop_token_rval(expr, &t2, expr->table); if (exprerr != 0) return exprerr;
14221465                  exprerr = pop_token_lval(expr, &t1, expr->table); if (exprerr != 0) return exprerr;
1423                  tempnum.value.i = get_lval_value(&t1, expr->table);
1466                  tempnum.value.i = get_lval_value(expr, &t1, expr->table);
14241467                  if (t2.value.i == 0) return MAKE_EXPRERR_DIVIDE_BY_ZERO(t2.offset);
14251468                  tempnum.value.i /= t2.value.i;
14261469                  tempnum.offset = (t1.offset < t2.offset) ? t1.offset : t2.offset;
14271470                  exprerr = push_token(expr, &tempnum); if (exprerr != 0) return exprerr;
1428                  set_lval_value(&t1, expr->table, tempnum.value.i);
1471                  set_lval_value(expr, &t1, expr->table, tempnum.value.i);
14291472                  break;
14301473
14311474               case TVL_ASSIGNMODULO:
14321475                  exprerr = pop_token_rval(expr, &t2, expr->table); if (exprerr != 0) return exprerr;
14331476                  exprerr = pop_token_lval(expr, &t1, expr->table); if (exprerr != 0) return exprerr;
1434                  tempnum.value.i = get_lval_value(&t1, expr->table);
1477                  tempnum.value.i = get_lval_value(expr, &t1, expr->table);
14351478                  if (t2.value.i == 0) return MAKE_EXPRERR_DIVIDE_BY_ZERO(t2.offset);
14361479                  tempnum.value.i %= t2.value.i;
14371480                  tempnum.offset = (t1.offset < t2.offset) ? t1.offset : t2.offset;
14381481                  exprerr = push_token(expr, &tempnum); if (exprerr != 0) return exprerr;
1439                  set_lval_value(&t1, expr->table, tempnum.value.i);
1482                  set_lval_value(expr, &t1, expr->table, tempnum.value.i);
14401483                  break;
14411484
14421485               case TVL_ASSIGNADD:
14431486                  exprerr = pop_token_rval(expr, &t2, expr->table); if (exprerr != 0) return exprerr;
14441487                  exprerr = pop_token_lval(expr, &t1, expr->table); if (exprerr != 0) return exprerr;
1445                  tempnum.value.i = get_lval_value(&t1, expr->table);
1488                  tempnum.value.i = get_lval_value(expr, &t1, expr->table);
14461489                  tempnum.value.i += t2.value.i;
14471490                  tempnum.offset = (t1.offset < t2.offset) ? t1.offset : t2.offset;
14481491                  exprerr = push_token(expr, &tempnum); if (exprerr != 0) return exprerr;
1449                  set_lval_value(&t1, expr->table, tempnum.value.i);
1492                  set_lval_value(expr, &t1, expr->table, tempnum.value.i);
14501493                  break;
14511494
14521495               case TVL_ASSIGNSUBTRACT:
14531496                  exprerr = pop_token_rval(expr, &t2, expr->table); if (exprerr != 0) return exprerr;
14541497                  exprerr = pop_token_lval(expr, &t1, expr->table); if (exprerr != 0) return exprerr;
1455                  tempnum.value.i = get_lval_value(&t1, expr->table);
1498                  tempnum.value.i = get_lval_value(expr, &t1, expr->table);
14561499                  tempnum.value.i -= t2.value.i;
14571500                  tempnum.offset = (t1.offset < t2.offset) ? t1.offset : t2.offset;
14581501                  exprerr = push_token(expr, &tempnum); if (exprerr != 0) return exprerr;
1459                  set_lval_value(&t1, expr->table, tempnum.value.i);
1502                  set_lval_value(expr, &t1, expr->table, tempnum.value.i);
14601503                  break;
14611504
14621505               case TVL_ASSIGNLSHIFT:
14631506                  exprerr = pop_token_rval(expr, &t2, expr->table); if (exprerr != 0) return exprerr;
14641507                  exprerr = pop_token_lval(expr, &t1, expr->table); if (exprerr != 0) return exprerr;
1465                  tempnum.value.i = get_lval_value(&t1, expr->table);
1508                  tempnum.value.i = get_lval_value(expr, &t1, expr->table);
14661509                  tempnum.value.i <<= t2.value.i;
14671510                  tempnum.offset = (t1.offset < t2.offset) ? t1.offset : t2.offset;
14681511                  exprerr = push_token(expr, &tempnum); if (exprerr != 0) return exprerr;
1469                  set_lval_value(&t1, expr->table, tempnum.value.i);
1512                  set_lval_value(expr, &t1, expr->table, tempnum.value.i);
14701513                  break;
14711514
14721515               case TVL_ASSIGNRSHIFT:
14731516                  exprerr = pop_token_rval(expr, &t2, expr->table); if (exprerr != 0) return exprerr;
14741517                  exprerr = pop_token_lval(expr, &t1, expr->table); if (exprerr != 0) return exprerr;
1475                  tempnum.value.i = get_lval_value(&t1, expr->table);
1518                  tempnum.value.i = get_lval_value(expr, &t1, expr->table);
14761519                  tempnum.value.i >>= t2.value.i;
14771520                  tempnum.offset = (t1.offset < t2.offset) ? t1.offset : t2.offset;
14781521                  exprerr = push_token(expr, &tempnum); if (exprerr != 0) return exprerr;
1479                  set_lval_value(&t1, expr->table, tempnum.value.i);
1522                  set_lval_value(expr, &t1, expr->table, tempnum.value.i);
14801523                  break;
14811524
14821525               case TVL_ASSIGNBAND:
14831526                  exprerr = pop_token_rval(expr, &t2, expr->table); if (exprerr != 0) return exprerr;
14841527                  exprerr = pop_token_lval(expr, &t1, expr->table); if (exprerr != 0) return exprerr;
1485                  tempnum.value.i = get_lval_value(&t1, expr->table);
1528                  tempnum.value.i = get_lval_value(expr, &t1, expr->table);
14861529                  tempnum.value.i &= t2.value.i;
14871530                  tempnum.offset = (t1.offset < t2.offset) ? t1.offset : t2.offset;
14881531                  exprerr = push_token(expr, &tempnum); if (exprerr != 0) return exprerr;
1489                  set_lval_value(&t1, expr->table, tempnum.value.i);
1532                  set_lval_value(expr, &t1, expr->table, tempnum.value.i);
14901533                  break;
14911534
14921535               case TVL_ASSIGNBXOR:
14931536                  exprerr = pop_token_rval(expr, &t2, expr->table); if (exprerr != 0) return exprerr;
14941537                  exprerr = pop_token_lval(expr, &t1, expr->table); if (exprerr != 0) return exprerr;
1495                  tempnum.value.i = get_lval_value(&t1, expr->table);
1538                  tempnum.value.i = get_lval_value(expr, &t1, expr->table);
14961539                  tempnum.value.i ^= t2.value.i;
14971540                  tempnum.offset = (t1.offset < t2.offset) ? t1.offset : t2.offset;
14981541                  exprerr = push_token(expr, &tempnum); if (exprerr != 0) return exprerr;
1499                  set_lval_value(&t1, expr->table, tempnum.value.i);
1542                  set_lval_value(expr, &t1, expr->table, tempnum.value.i);
15001543                  break;
15011544
15021545               case TVL_ASSIGNBOR:
15031546                  exprerr = pop_token_rval(expr, &t2, expr->table); if (exprerr != 0) return exprerr;
15041547                  exprerr = pop_token_lval(expr, &t1, expr->table); if (exprerr != 0) return exprerr;
1505                  tempnum.value.i = get_lval_value(&t1, expr->table);
1548                  tempnum.value.i = get_lval_value(expr, &t1, expr->table);
15061549                  tempnum.value.i |= t2.value.i;
15071550                  tempnum.offset = (t1.offset < t2.offset) ? t1.offset : t2.offset;
15081551                  exprerr = push_token(expr, &tempnum); if (exprerr != 0) return exprerr;
1509                  set_lval_value(&t1, expr->table, tempnum.value.i);
1552                  set_lval_value(expr, &t1, expr->table, tempnum.value.i);
15101553                  break;
15111554
15121555               case TVL_COMMA:
r2956r2957
15891632    expression using the passed symbol table
15901633-------------------------------------------------*/
15911634
1592EXPRERR expression_evaluate(const char *expression, const symbol_table *table, UINT64 *result)
1635EXPRERR expression_evaluate(const char *expression, const symbol_table *table, const express_callbacks *callbacks, UINT64 *result)
15931636{
15941637   parsed_expression temp_expression;
15951638   EXPRERR exprerr;
r2956r2957
16101653   /* debugging */
16111654   print_tokens(stdout, &temp_expression);
16121655
1656   /* copy the callbacks */
1657   if (callbacks != NULL)
1658      temp_expression.callbacks = *callbacks;
1659
16131660   /* execute the expression to get the result */
16141661   exprerr = execute_tokens(&temp_expression, result);
16151662
r2956r2957
16241671    return an allocated token array
16251672-------------------------------------------------*/
16261673
1627EXPRERR expression_parse(const char *expression, const symbol_table *table, parsed_expression **result)
1674EXPRERR expression_parse(const char *expression, const symbol_table *table, const express_callbacks *callbacks, parsed_expression **result)
16281675{
16291676   parsed_expression temp_expression;
16301677   EXPRERR exprerr;
r2956r2957
16471694      goto cleanup;
16481695   }
16491696
1697   /* copy the callbacks */
1698   if (callbacks != NULL)
1699      temp_expression.callbacks = *callbacks;
1700
16501701   /* copy the final expression and return */
16511702   **result = temp_expression;
16521703   return EXPRERR_NONE;
r2956r2957
18531904    function symbol to a symbol table
18541905-------------------------------------------------*/
18551906
1856int symtable_add_function(symbol_table *table, const char *name, UINT32 ref, UINT16 minparams, UINT16 maxparams, UINT64 (*execute)(UINT32, UINT32, UINT64 *))
1907int symtable_add_function(symbol_table *table, const char *name, UINT32 ref, UINT16 minparams, UINT16 maxparams, function_execute_func execute)
18571908{
18581909   symbol_entry symbol;
18591910
src/emu/cpu/cpu.mak
r2956r2957
465465
466466ifneq ($(filter SH2,$(CPUS)),)
467467OBJDIRS += $(CPUOBJ)/sh2
468CPUOBJS += $(CPUOBJ)/sh2/sh2.o $(CPUOBJ)/sh2/sh2comn.o
468CPUOBJS += $(CPUOBJ)/sh2/sh2.o $(CPUOBJ)/sh2/sh2comn.o $(CPUOBJ)/sh2/sh2drc.o $(CPUOBJ)/sh2/sh2fe.o
469469DBGOBJS += $(CPUOBJ)/sh2/sh2dasm.o
470470endif
471471
r2956r2957
477477         $(CPUSRC)/sh2/sh2comn.h \
478478         $(CPUSRC)/sh2/sh2.h
479479
480$(CPUOBJ)/sh2/sh2drc.o:   $(CPUSRC)/sh2/sh2drc.c \
481         $(CPUSRC)/sh2/sh2.h \
482         $(CPUSRC)/sh2/sh2comn.h
483
484$(CPUOBJ)/sh2/sh2fe.o:   $(CPUSRC)/sh2/sh2fe.c \
485         $(CPUSRC)/sh2/sh2.h \
486         $(CPUSRC)/sh2/sh2comn.h
487
480488#-------------------------------------------------
481489# Hitachi SH4
482490#-------------------------------------------------
src/emu/cpu/drcfe.c
r2956r2957
397397
398398         /* if we are the last instruction, indicate end-of-sequence and redispatch */
399399         if (nextdesc == NULL)
400            curdesc->flags |= OPFLAG_END_SEQUENCE | endflag;
400         {
401            curdesc->flags |= OPFLAG_END_SEQUENCE;
402            if (endflag != OPFLAG_RETURN_TO_START || nextdescnum == end)
403               curdesc->flags |= endflag;
404         }
401405
402406         /* otherwise, do some analysis based on the next instruction */
403407         else
src/emu/cpu/i386/i386.c
r2956r2957
441441
442442/*************************************************************************/
443443
444static UINT64 i386_debug_segbase(UINT32 ref, UINT32 params, UINT64 *param)
444static UINT64 i386_debug_segbase(UINT32 ref, UINT32 params, const UINT64 *param)
445445{
446446   UINT32 result;
447447   I386_SREG seg;
r2956r2957
460460   return result;
461461}
462462
463static UINT64 i386_debug_seglimit(UINT32 ref, UINT32 params, UINT64 *param)
463static UINT64 i386_debug_seglimit(UINT32 ref, UINT32 params, const UINT64 *param)
464464{
465465   UINT32 result = 0;
466466   I386_SREG seg;
src/emu/cpu/sh2/sh2comn.h
r2956r2957
99#ifndef _SH2_COMMON_H_
1010#define _SH2_COMMON_H_
1111
12#define USE_SH2DRC
13
14#ifdef USE_SH2DRC
15#include "cpu/drcfe.h"
16#include "cpu/drcuml.h"
17#include "cpu/drcumlsh.h"
18#endif
19
1220typedef struct
1321{
1422   int irq_vector;
r2956r2957
3543#define Rn   ((opcode>>8)&15)
3644#define Rm   ((opcode>>4)&15)
3745
46#define REGFLAG_R(n)                                        (1 << (n))
47
48/* register flags 1 */
49#define REGFLAG_PR                  (1 << 0)
50#define REGFLAG_MACL                  (1 << 1)
51#define REGFLAG_MACH                  (1 << 2)
52#define REGFLAG_GBR                  (1 << 3)
53#define REGFLAG_VBR                  (1 << 4)
54#define REGFLAG_SR                  (1 << 5)
55
3856#define CHECK_PENDING_IRQ(message)            \
3957do {                                 \
4058   int irq = -1;                        \
r2956r2957
7391   UINT32   cpu_off;
7492   UINT32   dvsr, dvdnth, dvdntl, dvcr;
7593   UINT32   pending_irq;
76   UINT32    test_irq;
94   UINT32   test_irq;
95   UINT32   pending_nmi;
96   UINT32   evec;            // exception vector for DRC
97   UINT32  irqsr;            // IRQ-time old SR for DRC
98   UINT32 target;            // target for jmp/jsr/etc so the delay slot can't kill it
7799   irq_entry     irq_queue[16];
78100
101   int pcfsel;                 // last pcflush entry set
102   int maxpcfsel;            // highest valid pcflush entry
103   UINT32 pcflushes[16];         // pcflush entries
104
79105   INT8   irq_line_state[17];
80106   int    (*irq_callback)(int irqline);
81107   UINT32   *m;
r2956r2957
96122   int     is_slave, cpu_number;
97123
98124   void   (*ftcsr_read_callback)(UINT32 data);
125
126#ifdef USE_SH2DRC
127   drccache *         cache;                   /* pointer to the DRC code cache */
128   drcuml_state *      drcuml;               /* DRC UML generator state */
129   drcfe_state *      drcfe;               /* pointer to the DRC front-end state */
130   UINT32            drcoptions;         /* configurable DRC options */
131
132   int            icount;
133
134   /* internal stuff */
135   UINT8            cache_dirty;             /* true if we need to flush the cache */
136
137   /* parameters for subroutines */
138   UINT64            numcycles;             /* return value from gettotalcycles */
139   UINT32            arg0;                /* print_debug argument 1 */
140   UINT32            arg1;                /* print_debug argument 2 */
141   UINT32            irq;            /* irq we're taking */
142
143   /* register mappings */
144   drcuml_parameter   regmap[16];                 /* parameter to register mappings for all 16 integer registers */
145
146   drcuml_codehandle *   entry;                   /* entry point */
147   drcuml_codehandle *   read8;               /* read byte */
148   drcuml_codehandle *   write8;               /* write byte */
149   drcuml_codehandle *   read16;               /* read half */
150   drcuml_codehandle *   write16;                /* write half */
151   drcuml_codehandle *   read32;               /* read word */
152   drcuml_codehandle *   write32;                /* write word */
153
154   drcuml_codehandle *   interrupt;            /* interrupt */
155   drcuml_codehandle *   nocode;               /* nocode */
156   drcuml_codehandle *   out_of_cycles;            /* out of cycles exception handler */
157#endif
99158} SH2;
100159
101160TIMER_CALLBACK( sh2_timer_callback );
102161TIMER_CALLBACK( sh2_dmac_callback );
103162
104void sh2_common_init(int index, int clock, const void *config, int (*irqcallback)(int));
163void sh2_common_init(int alloc, int index, int clock, const void *config, int (*irqcallback)(int));
105164void sh2_recalc_irq(void);
106165void sh2_set_irq_line(int irqline, int state);
107166void sh2_set_frt_input(int cpunum, int state);
src/emu/cpu/sh2/sh2.h
r2956r2957
5757
5858enum
5959{
60   CPUINFO_INT_SH2_FRT_INPUT = CPUINFO_INT_CPU_SPECIFIC
60   CPUINFO_INT_SH2_FRT_INPUT = CPUINFO_INT_CPU_SPECIFIC,
61
62   CPUINFO_INT_SH2_DRC_OPTIONS,
63
64   CPUINFO_INT_SH2_FASTRAM_SELECT,
65   CPUINFO_INT_SH2_FASTRAM_START,
66   CPUINFO_INT_SH2_FASTRAM_END,
67   CPUINFO_INT_SH2_FASTRAM_READONLY,
68
69   CPUINFO_INT_SH2_HOTSPOT_SELECT,
70   CPUINFO_INT_SH2_HOTSPOT_PC,
71   CPUINFO_INT_SH2_HOTSPOT_OPCODE,
72   CPUINFO_INT_SH2_HOTSPOT_CYCLES,
73
74   CPUINFO_INT_SH2_PCFLUSH_SELECT,
75   CPUINFO_INT_SH2_PCFLUSH_ADDR
6176};
6277
6378enum
6479{
6580   CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK = CPUINFO_PTR_CPU_SPECIFIC,
81
82   CPUINFO_PTR_SH2_FASTRAM_BASE
6683};
6784
6885struct sh2_config
r2956r2957
7794
7895extern unsigned DasmSH2( char *dst, unsigned pc, UINT16 opcode );
7996
97/***************************************************************************
98    COMPILER-SPECIFIC OPTIONS
99***************************************************************************/
100
101#define SH2DRC_STRICT_VERIFY      0x0001         /* verify all instructions */
102#define SH2DRC_FLUSH_PC         0x0002         /* flush the PC value before each memory access */
103
104#define SH2DRC_COMPATIBLE_OPTIONS   (SH2DRC_STRICT_VERIFY | SH2DRC_FLUSH_PC)
105#define SH2DRC_FASTEST_OPTIONS   (0)
106
80107#endif /* _SH2_H */
81108
src/emu/cpu/sh2/sh2drc.c
r0r2957
1/***************************************************************************
2
3    sh2drc.c
4    Universal machine language-based SH-2 emulator.
5    By R. Belmont
6
7    Released for general non-commercial use under the MAME license
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10    ST-V status:
11    colmns97 & stress crash due to SCSP stream->machine getting corrupted.
12
13    cottonbm w/US bios: run to 60323B4 on master, then MOV insn @ 602f5aa crashes?
14    actually crash on slave @ 6032b38 after above.  reading wrong addr for jump vector.
15
16***************************************************************************/
17
18#include "debugger.h"
19#include "deprecat.h"
20#include "sh2.h"
21#include "sh2comn.h"
22
23#ifdef USE_SH2DRC
24
25/***************************************************************************
26    DEBUGGING
27***************************************************************************/
28
29#define FORCE_C_BACKEND               (0)   // use the C backend even when a native one is available
30#define LOG_UML                  (1)   // log UML assembly
31#define LOG_NATIVE               (0)   // log native assembly
32
33#define SET_EA                  (0)   // makes slower but "shows work" in the EA fake register like the interpreter
34
35#define DISABLE_FAST_REGISTERS            (0)   // set to 1 to turn off usage of register caching
36#define SINGLE_INSTRUCTION_MODE            (0)
37
38#define VERBOSE 0
39#define LOG(x)   do { if (VERBOSE) logerror x; } while (0)
40
41#if SET_EA
42#define SETEA(x) UML_MOV(block, MEM(&sh2->ea), IREG(x))
43#else
44#define SETEA(x)
45#endif
46
47/***************************************************************************
48    CONSTANTS
49***************************************************************************/
50
51/* map variables */
52#define MAPVAR_PC                 MVAR(0)
53#define MAPVAR_CYCLES               MVAR(1)
54
55/* size of the execution code cache */
56#define CACHE_SIZE               (32 * 1024 * 1024)
57
58/* compilation boundaries -- how far back/forward does the analysis extend? */
59#define COMPILE_BACKWARDS_BYTES         64
60#define COMPILE_FORWARDS_BYTES         256
61#define COMPILE_MAX_INSTRUCTIONS      ((COMPILE_BACKWARDS_BYTES/2) + (COMPILE_FORWARDS_BYTES/2))
62#define COMPILE_MAX_SEQUENCE         64
63
64/* exit codes */
65#define EXECUTE_OUT_OF_CYCLES         0
66#define EXECUTE_MISSING_CODE         1
67#define EXECUTE_UNMAPPED_CODE         2
68#define EXECUTE_RESET_CACHE         3
69
70#define PROBE_ADDRESS               ~0
71
72extern int sh2_describe(void *param, opcode_desc *desc, const opcode_desc *prev);
73
74/***************************************************************************
75    MACROS
76***************************************************************************/
77
78#define R32(reg)       sh2->regmap[reg].type, sh2->regmap[reg].value
79
80/***************************************************************************
81    STRUCTURES & TYPEDEFS
82***************************************************************************/
83
84/* internal compiler state */
85typedef struct _compiler_state compiler_state;
86struct _compiler_state
87{
88   UINT32         cycles;                  /* accumulated cycles */
89   UINT8         checkints;               /* need to check interrupts before next instruction */
90   drcuml_codelabel   labelnum;               /* index for local labels */
91};
92
93/***************************************************************************
94    FUNCTION PROTOTYPES
95***************************************************************************/
96
97static void static_generate_entry_point(drcuml_state *drcuml);
98static void static_generate_nocode_handler(drcuml_state *drcuml);
99static void static_generate_out_of_cycles(drcuml_state *drcuml);
100static void static_generate_memory_accessor(drcuml_state *drcuml, int size, int iswrite, const char *name, drcuml_codehandle **handleptr);
101
102static void generate_update_cycles(drcuml_block *block, compiler_state *compiler, drcuml_ptype ptype, UINT64 pvalue, int allow_exception);
103static void generate_checksum_block(drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast);
104static void generate_sequence_instruction(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc);
105static void generate_delay_slot(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc);
106
107static int generate_opcode(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc);
108static int generate_group_0(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot);
109static int generate_group_2(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot);
110static int generate_group_3(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode);
111static int generate_group_4(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot);
112static int generate_group_6(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot);
113static int generate_group_8(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot);
114static int generate_group_12(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot);
115
116static void code_compile_block(drcuml_state *drcuml, UINT8 mode, offs_t pc);
117
118static void log_opcode_desc(drcuml_state *drcuml, const opcode_desc *desclist, int indent);
119static void log_register_list(drcuml_state *drcuml, const char *string, const UINT32 *reglist, const UINT32 *regnostarlist);
120static void log_add_disasm_comment(drcuml_block *block, UINT32 pc, UINT32 op);
121static const char *log_desc_flags_to_string(UINT32 flags);
122
123static void cfunc_printf_probe(void *param);
124static void cfunc_unimplemented(void *param);
125static void cfunc_checkirqs(void *param);
126static void cfunc_MAC_W(void *param);
127static void cfunc_MAC_L(void *param);
128static void cfunc_DIV1(void *param);
129
130/***************************************************************************
131    PRIVATE GLOBAL VARIABLES
132***************************************************************************/
133
134SH2 *sh2;
135
136/***************************************************************************
137    INLINE FUNCTIONS
138***************************************************************************/
139
140/*-------------------------------------------------
141    epc - compute the exception PC from a
142    descriptor
143-------------------------------------------------*/
144
145INLINE UINT32 epc(const opcode_desc *desc)
146{
147   return (desc->flags & OPFLAG_IN_DELAY_SLOT) ? (desc->pc - 1) : desc->pc;
148}
149
150/*-------------------------------------------------
151    alloc_handle - allocate a handle if not
152    already allocated
153-------------------------------------------------*/
154
155INLINE void alloc_handle(drcuml_state *drcuml, drcuml_codehandle **handleptr, const char *name)
156{
157   if (*handleptr == NULL)
158      *handleptr = drcuml_handle_alloc(drcuml, name);
159}
160
161/*-------------------------------------------------
162    load_fast_iregs - load any fast integer
163    registers
164-------------------------------------------------*/
165
166INLINE void load_fast_iregs(drcuml_block *block)
167{
168   int regnum;
169
170   for (regnum = 0; regnum < ARRAY_LENGTH(sh2->regmap); regnum++)
171   {
172      if (sh2->regmap[regnum].type == DRCUML_PTYPE_INT_REGISTER)
173      {
174         UML_MOV(block, IREG(sh2->regmap[regnum].value - DRCUML_REG_I0), MEM(&sh2->r[regnum]));
175      }
176   }
177}
178
179
180/*-------------------------------------------------
181    save_fast_iregs - save any fast integer
182    registers
183-------------------------------------------------*/
184
185INLINE void save_fast_iregs(drcuml_block *block)
186{
187   int regnum;
188
189   for (regnum = 0; regnum < ARRAY_LENGTH(sh2->regmap); regnum++)
190   {
191      if (sh2->regmap[regnum].type == DRCUML_PTYPE_INT_REGISTER)
192      {
193         UML_MOV(block, MEM(&sh2->r[regnum]), IREG(sh2->regmap[regnum].value - DRCUML_REG_I0));
194      }
195   }
196}
197
198/*-------------------------------------------------
199    cfunc_printf_probe - print the current CPU
200    state and return
201-------------------------------------------------*/
202
203static void cfunc_printf_probe(void *param)
204{
205   UINT32 pc = (UINT32)(FPTR)param;
206
207   printf(" PC=%08X          r0=%08X  r1=%08X  r2=%08X\n",
208      pc,
209      (UINT32)sh2->r[0],
210      (UINT32)sh2->r[1],
211      (UINT32)sh2->r[2]);
212   printf(" r3=%08X  r4=%08X  r5=%08X  r6=%08X\n",
213      (UINT32)sh2->r[3],
214      (UINT32)sh2->r[4],
215      (UINT32)sh2->r[5],
216      (UINT32)sh2->r[6]);
217   printf(" r7=%08X  r8=%08X  r9=%08X  r10=%08X\n",
218      (UINT32)sh2->r[7],
219      (UINT32)sh2->r[8],
220      (UINT32)sh2->r[9],
221      (UINT32)sh2->r[10]);
222   printf(" r11=%08X  r12=%08X  r13=%08X  r14=%08X\n",
223      (UINT32)sh2->r[11],
224      (UINT32)sh2->r[12],
225      (UINT32)sh2->r[13],
226      (UINT32)sh2->r[14]);
227   printf(" r15=%08X  macl=%08X  mach=%08X  gbr=%08X\n",
228      (UINT32)sh2->r[15],
229      (UINT32)sh2->macl,
230      (UINT32)sh2->mach,
231      (UINT32)sh2->gbr);
232   printf(" evec %x irqsr %x pc=%08x\n",
233      (UINT32)sh2->evec,
234      (UINT32)sh2->irqsr, (UINT32)sh2->pc);
235}
236
237/*-------------------------------------------------
238    cfunc_unimplemented - handler for
239    unimplemented opcdes
240-------------------------------------------------*/
241
242static void cfunc_unimplemented(void *param)
243{
244   UINT16 opcode = (FPTR)param;
245   fatalerror("PC=%08X: Unimplemented op %04X", sh2->pc, opcode);
246}
247
248/*-------------------------------------------------
249    cfunc_checkirqs - checks for pending IRQs
250-------------------------------------------------*/
251static void cfunc_checkirqs(void *param)
252{
253   // if NMI is pending, evec etc are already set up
254   if (sh2->pending_nmi)
255   {
256      sh2->pending_nmi = 0;
257   }
258   else
259   {
260      sh2->evec = 0xffffffff;
261      CHECK_PENDING_IRQ("cfunc_checkirqs");
262   }
263}
264
265INLINE UINT16 RW(offs_t A)
266{
267   if (A >= 0xe0000000)
268      return sh2_internal_r(Machine, (A & 0x1fc)>>2, 0xffff << (((~A) & 2)*8)) >> (((~A) & 2)*8);
269
270   if (A >= 0xc0000000)
271      return program_read_word_32be(A);
272
273   return program_read_word_32be(A & AM);
274}
275
276/*-------------------------------------------------
277    cfunc_MAC_W - implementation of MAC_W Rm,Rn
278-------------------------------------------------*/
279static void cfunc_MAC_W(void *param)
280{
281   INT32 tempm, tempn, dest, src, ans;
282   UINT32 templ;
283   UINT16 *opptr, opcode;
284   int n, m;
285
286   // recover the opcode
287   opptr = (UINT16 *)param;
288   opcode = *opptr;
289
290   // extract the operands
291   n = Rn;
292   m = Rm;
293
294   tempn = (INT32) RW( sh2->r[n] );
295   sh2->r[n] += 2;
296   tempm = (INT32) RW( sh2->r[m] );
297   sh2->r[m] += 2;
298   templ = sh2->macl;
299   tempm = ((INT32) (short) tempn * (INT32) (short) tempm);
300   if ((INT32) sh2->macl >= 0)
301      dest = 0;
302   else
303      dest = 1;
304   if ((INT32) tempm >= 0)
305   {
306      src = 0;
307      tempn = 0;
308   }
309   else
310   {
311      src = 1;
312      tempn = 0xffffffff;
313   }
314   src += dest;
315   sh2->macl += tempm;
316   if ((INT32) sh2->macl >= 0)
317      ans = 0;
318   else
319      ans = 1;
320   ans += dest;
321   if (sh2->sr & S)
322   {
323      if (ans == 1)
324         {
325            if (src == 0)
326               sh2->macl = 0x7fffffff;
327            if (src == 2)
328               sh2->macl = 0x80000000;
329         }
330   }
331   else
332   {
333      sh2->mach += tempn;
334      if (templ > sh2->macl)
335         sh2->mach += 1;
336   }
337}
338
339INLINE UINT32 RL(offs_t A)
340{
341   if (A >= 0xe0000000)
342      return sh2_internal_r(Machine, (A & 0x1fc)>>2, 0xffffffff);
343
344   if (A >= 0xc0000000)
345      return program_read_dword_32be(A);
346
347   return program_read_dword_32be(A & AM);
348}
349
350/*-------------------------------------------------
351    cfunc_MAC_L - implementation of MAC_L Rm,Rn
352-------------------------------------------------*/
353static void cfunc_MAC_L(void *param)
354{
355   UINT32 RnL, RnH, RmL, RmH, Res0, Res1, Res2;
356   UINT32 temp0, temp1, temp2, temp3;
357   INT32 tempm, tempn, fnLmL;
358   UINT16 *opptr, opcode;
359   int n, m;
360
361   // recover the opcode
362   opptr = (UINT16 *)param;
363   opcode = *opptr;
364
365   // extract the operands
366   n = Rn;
367   m = Rm;
368
369   tempn = (INT32) RL( sh2->r[n] );
370   sh2->r[n] += 4;
371   tempm = (INT32) RL( sh2->r[m] );
372   sh2->r[m] += 4;
373   if ((INT32) (tempn ^ tempm) < 0)
374      fnLmL = -1;
375   else
376      fnLmL = 0;
377   if (tempn < 0)
378      tempn = 0 - tempn;
379   if (tempm < 0)
380      tempm = 0 - tempm;
381   temp1 = (UINT32) tempn;
382   temp2 = (UINT32) tempm;
383   RnL = temp1 & 0x0000ffff;
384   RnH = (temp1 >> 16) & 0x0000ffff;
385   RmL = temp2 & 0x0000ffff;
386   RmH = (temp2 >> 16) & 0x0000ffff;
387   temp0 = RmL * RnL;
388   temp1 = RmH * RnL;
389   temp2 = RmL * RnH;
390   temp3 = RmH * RnH;
391   Res2 = 0;
392   Res1 = temp1 + temp2;
393   if (Res1 < temp1)
394      Res2 += 0x00010000;
395   temp1 = (Res1 << 16) & 0xffff0000;
396   Res0 = temp0 + temp1;
397   if (Res0 < temp0)
398      Res2++;
399   Res2 = Res2 + ((Res1 >> 16) & 0x0000ffff) + temp3;
400   if (fnLmL < 0)
401   {
402      Res2 = ~Res2;
403      if (Res0 == 0)
404         Res2++;
405      else
406         Res0 = (~Res0) + 1;
407   }
408   if (sh2->sr & S)
409   {
410      Res0 = sh2->macl + Res0;
411      if (sh2->macl > Res0)
412         Res2++;
413      Res2 += (sh2->mach & 0x0000ffff);
414      if (((INT32) Res2 < 0) && (Res2 < 0xffff8000))
415      {
416         Res2 = 0x00008000;
417         Res0 = 0x00000000;
418      }
419      else if (((INT32) Res2 > 0) && (Res2 > 0x00007fff))
420      {
421         Res2 = 0x00007fff;
422         Res0 = 0xffffffff;
423      }
424      sh2->mach = Res2;
425      sh2->macl = Res0;
426   }
427   else
428   {
429      Res0 = sh2->macl + Res0;
430      if (sh2->macl > Res0)
431         Res2++;
432      Res2 += sh2->mach;
433      sh2->mach = Res2;
434      sh2->macl = Res0;
435   }
436}
437
438/*-------------------------------------------------
439    cfunc_DIV1 - implementation of DIV1 Rm,Rn
440-------------------------------------------------*/
441static void cfunc_DIV1(void *param)
442{
443   UINT32 tmp0;
444   UINT32 old_q;
445   UINT16 *opptr, opcode;
446   int n, m;
447
448   // recover the opcode
449   opptr = (UINT16 *)param;
450   opcode = *opptr;
451
452   // extract the operands
453   n = Rn;
454   m = Rm;
455
456   old_q = sh2->sr & Q;
457   if (0x80000000 & sh2->r[n])
458      sh2->sr |= Q;
459   else
460      sh2->sr &= ~Q;
461
462   sh2->r[n] = (sh2->r[n] << 1) | (sh2->sr & T);
463
464   if (!old_q)
465   {
466      if (!(sh2->sr & M))
467      {
468         tmp0 = sh2->r[n];
469         sh2->r[n] -= sh2->r[m];
470         if(!(sh2->sr & Q))
471            if(sh2->r[n] > tmp0)
472               sh2->sr |= Q;
473            else
474               sh2->sr &= ~Q;
475         else
476            if(sh2->r[n] > tmp0)
477               sh2->sr &= ~Q;
478            else
479               sh2->sr |= Q;
480      }
481      else
482      {
483         tmp0 = sh2->r[n];
484         sh2->r[n] += sh2->r[m];
485         if(!(sh2->sr & Q))
486         {
487            if(sh2->r[n] < tmp0)
488               sh2->sr &= ~Q;
489            else
490               sh2->sr |= Q;
491         }
492         else
493         {
494            if(sh2->r[n] < tmp0)
495               sh2->sr |= Q;
496            else
497               sh2->sr &= ~Q;
498         }
499      }
500   }
501   else
502   {
503      if (!(sh2->sr & M))
504      {
505         tmp0 = sh2->r[n];
506         sh2->r[n] += sh2->r[m];
507         if(!(sh2->sr & Q))
508            if(sh2->r[n] < tmp0)
509               sh2->sr |= Q;
510            else
511               sh2->sr &= ~Q;
512         else
513            if(sh2->r[n] < tmp0)
514               sh2->sr &= ~Q;
515            else
516               sh2->sr |= Q;
517      }
518      else
519      {
520         tmp0 = sh2->r[n];
521         sh2->r[n] -= sh2->r[m];
522         if(!(sh2->sr & Q))
523            if(sh2->r[n] > tmp0)
524               sh2->sr &= ~Q;
525            else
526               sh2->sr |= Q;
527         else
528            if(sh2->r[n] > tmp0)
529               sh2->sr |= Q;
530            else
531               sh2->sr &= ~Q;
532      }
533   }
534
535   tmp0 = (sh2->sr & (Q | M));
536   if((!tmp0) || (tmp0 == 0x300)) /* if Q == M set T else clear T */
537      sh2->sr |= T;
538   else
539      sh2->sr &= ~T;
540}
541
542/*-------------------------------------------------
543    sh2_init - initialize the processor
544-------------------------------------------------*/
545
546static void sh2_init(int index, int clock, const void *config, int (*irqcallback)(int))
547{
548   drcfe_config feconfig =
549   {
550      COMPILE_BACKWARDS_BYTES,   /* code window start offset = startpc - window_start */
551      COMPILE_FORWARDS_BYTES,      /* code window end offset = startpc + window_end */
552      COMPILE_MAX_SEQUENCE,      /* maximum instructions to include in a sequence */
553      sh2_describe         /* callback to describe a single instruction */
554   };
555   drccache *cache;
556   drcbe_info beinfo;
557   UINT32 flags = 0;
558   int regnum;
559
560   /* allocate enough space for the cache and the core */
561   cache = drccache_alloc(CACHE_SIZE + sizeof(SH2));
562   if (cache == NULL)
563      fatalerror("Unable to allocate cache of size %d", (UINT32)(CACHE_SIZE + sizeof(SH2)));
564
565   /* allocate the core memory */
566   sh2 = drccache_memory_alloc_near(cache, sizeof(SH2));
567   memset(sh2, 0, sizeof(SH2));
568
569   /* initialize the common core parts */
570   sh2_common_init(0, index, clock, config, irqcallback);
571
572   /* allocate the implementation-specific state from the full cache */
573   sh2->cache = cache;
574
575   /* reset per-driver pcflushes */
576   sh2->pcfsel = sh2->maxpcfsel = -1;
577
578   /* initialize the UML generator */
579   if (FORCE_C_BACKEND)
580      flags |= DRCUML_OPTION_USE_C;
581   if (LOG_UML)
582      flags |= DRCUML_OPTION_LOG_UML;
583   if (LOG_NATIVE)
584      flags |= DRCUML_OPTION_LOG_NATIVE;
585   sh2->drcuml = drcuml_alloc(cache, flags, 1, 32, 1);
586   if (sh2->drcuml == NULL)
587      fatalerror("Error initializing the UML");
588
589   /* add symbols for our stuff */
590   drcuml_symbol_add(sh2->drcuml, &sh2->pc, sizeof(sh2->pc), "pc");
591   drcuml_symbol_add(sh2->drcuml, &sh2->icount, sizeof(sh2->icount), "icount");
592   for (regnum = 0; regnum < 16; regnum++)
593   {
594      char buf[10];
595      sprintf(buf, "r%d", regnum);
596      drcuml_symbol_add(sh2->drcuml, &sh2->r[regnum], sizeof(sh2->r[regnum]), buf);
597   }
598   drcuml_symbol_add(sh2->drcuml, &sh2->pr, sizeof(sh2->pr), "pr");
599   drcuml_symbol_add(sh2->drcuml, &sh2->sr, sizeof(sh2->sr), "sr");
600   drcuml_symbol_add(sh2->drcuml, &sh2->gbr, sizeof(sh2->gbr), "gbr");
601   drcuml_symbol_add(sh2->drcuml, &sh2->vbr, sizeof(sh2->vbr), "vbr");
602   drcuml_symbol_add(sh2->drcuml, &sh2->macl, sizeof(sh2->macl), "macl");
603   drcuml_symbol_add(sh2->drcuml, &sh2->mach, sizeof(sh2->macl), "mach");
604
605   /* initialize the front-end helper */
606   if (SINGLE_INSTRUCTION_MODE)
607      feconfig.max_sequence = 1;
608   sh2->drcfe = drcfe_init(&feconfig, sh2);
609
610   /* compute the register parameters */
611   for (regnum = 0; regnum < 16; regnum++)
612   {
613      sh2->regmap[regnum].type = DRCUML_PTYPE_MEMORY;
614      sh2->regmap[regnum].value = (FPTR)&sh2->r[regnum];
615   }
616
617   /* if we have registers to spare, assign r0, r1, r2 to leftovers */
618   /* WARNING: do not use synthetic registers that are mapped here! */
619   if (!DISABLE_FAST_REGISTERS)
620   {
621      drcuml_get_backend_info(sh2->drcuml, &beinfo);
622      if (beinfo.direct_iregs > 4)
623      {
624         sh2->regmap[0].type = DRCUML_PTYPE_INT_REGISTER;
625         sh2->regmap[0].value = DRCUML_REG_I4;
626      }
627      if (beinfo.direct_iregs > 5)
628      {
629         sh2->regmap[1].type = DRCUML_PTYPE_INT_REGISTER;
630         sh2->regmap[1].value = DRCUML_REG_I5;
631      }
632      if (beinfo.direct_iregs > 6)
633      {
634         sh2->regmap[2].type = DRCUML_PTYPE_INT_REGISTER;
635         sh2->regmap[2].value = DRCUML_REG_I6;
636      }
637   }
638
639   /* mark the cache dirty so it is updated on next execute */
640   sh2->cache_dirty = TRUE;
641}
642
643/*-------------------------------------------------
644    sh2_exit - cleanup from execution
645-------------------------------------------------*/
646
647static void sh2_exit(void)
648{
649   /* clean up the DRC */
650   drcfe_exit(sh2->drcfe);
651   drcuml_free(sh2->drcuml);
652   drccache_free(sh2->cache);
653}
654
655
656/*-------------------------------------------------
657    sh2_reset - reset the processor
658-------------------------------------------------*/
659
660static void sh2_reset(void)
661{
662   void *tsave, *tsaved0, *tsaved1;
663   UINT32 *m;
664   int cpunum;
665
666   void (*f)(UINT32 data);
667   int (*save_irqcallback)(int);
668
669   cpunum = sh2->cpu_number;
670   m = sh2->m;
671   tsave = sh2->timer;
672   tsaved0 = sh2->dma_timer[0];
673   tsaved1 = sh2->dma_timer[1];
674
675   f = sh2->ftcsr_read_callback;
676   save_irqcallback = sh2->irq_callback;
677
678   sh2->ppc = sh2->pc = sh2->pr = sh2->sr = sh2->gbr = sh2->vbr = sh2->mach = sh2->macl = 0;
679   sh2->evec = sh2->irqsr = 0;
680   memset(&sh2->r[0], 0, sizeof(sh2->r[0])*16);
681   sh2->ea = sh2->delay = sh2->cpu_off = sh2->dvsr = sh2->dvdnth = sh2->dvdntl = sh2->dvcr = 0;
682   sh2->pending_irq = sh2->test_irq = 0;
683   memset(&sh2->irq_queue[0], 0, sizeof(sh2->irq_queue[0])*16);
684   memset(&sh2->irq_line_state[0], 0, sizeof(sh2->irq_line_state[0])*17);
685   sh2->frc = sh2->ocra = sh2->ocrb = sh2->icr = 0;
686   sh2->frc_base = 0;
687   sh2->frt_input = sh2->internal_irq_level = sh2->internal_irq_vector = 0;
688   sh2->dma_timer_active[0] = sh2->dma_timer_active[1] = 0;
689
690   sh2->ftcsr_read_callback = f;
691   sh2->irq_callback = save_irqcallback;
692
693   sh2->timer = tsave;
694   sh2->dma_timer[0] = tsaved0;
695   sh2->dma_timer[1] = tsaved1;
696   sh2->cpu_number = cpunum;
697   sh2->m = m;
698   memset(sh2->m, 0, 0x200);
699
700   sh2->pc = program_read_dword_32be(0);
701   sh2->r[15] = program_read_dword_32be(4);
702   sh2->sr = I;
703   change_pc(sh2->pc & AM);
704
705   sh2->internal_irq_level = -1;
706
707   sh2->cache_dirty = TRUE;
708}
709
710/*-------------------------------------------------
711    code_flush_cache - flush the cache and
712    regenerate static code
713-------------------------------------------------*/
714
715static void code_flush_cache(drcuml_state *drcuml)
716{
717   /* empty the transient cache contents */
718   drcuml_reset(drcuml);
719
720   /* generate the entry point and out-of-cycles handlers */
721   static_generate_nocode_handler(drcuml);
722   static_generate_out_of_cycles(drcuml);
723   static_generate_entry_point(drcuml);
724
725   /* add subroutines for memory accesses */
726   static_generate_memory_accessor(drcuml, 1, FALSE, "read8", &sh2->read8);
727   static_generate_memory_accessor(drcuml, 1, TRUE,  "write8", &sh2->write8);
728   static_generate_memory_accessor(drcuml, 2, FALSE, "read16", &sh2->read16);
729   static_generate_memory_accessor(drcuml, 2, TRUE,  "write16", &sh2->write16);
730   static_generate_memory_accessor(drcuml, 4, FALSE, "read32", &sh2->read32);
731   static_generate_memory_accessor(drcuml, 4, TRUE,  "write32", &sh2->write32);
732
733   sh2->cache_dirty = FALSE;
734}
735
736/* Execute cycles - returns number of cycles actually run */
737static int sh2_execute(int cycles)
738{
739   drcuml_state *drcuml = sh2->drcuml;
740   int execute_result;
741
742   /* reset the cache if dirty */
743   if (sh2->cache_dirty)
744      code_flush_cache(drcuml);
745
746   /* execute */
747   sh2->icount = cycles;
748   do
749   {
750      /* run as much as we can */
751      execute_result = drcuml_execute(drcuml, sh2->entry);
752
753      /* if we need to recompile, do it */
754         if (execute_result == EXECUTE_MISSING_CODE)
755      {
756         code_compile_block(drcuml, 0, sh2->pc);
757      }
758      else if (execute_result == EXECUTE_UNMAPPED_CODE)
759      {
760         fatalerror("Attempted to execute unmapped code at PC=%08X\n", sh2->pc);
761      }
762      else if (execute_result == EXECUTE_RESET_CACHE)
763      {
764         code_flush_cache(drcuml);
765      }
766   } while (execute_result != EXECUTE_OUT_OF_CYCLES);
767
768   /* return the number of cycles executed */
769   return cycles - sh2->icount;
770}
771
772/*-------------------------------------------------
773    code_compile_block - compile a block of the
774    given mode at the specified pc
775-------------------------------------------------*/
776
777static void code_compile_block(drcuml_state *drcuml, UINT8 mode, offs_t pc)
778{
779   compiler_state compiler = { 0 };
780   const opcode_desc *seqhead, *seqlast;
781   const opcode_desc *desclist;
782   int override = FALSE;
783   drcuml_block *block;
784   jmp_buf errorbuf;
785
786   /* get a description of this sequence */
787   desclist = drcfe_describe_code(sh2->drcfe, pc);
788   if (LOG_UML || LOG_NATIVE)
789      log_opcode_desc(drcuml, desclist, 0);
790
791   /* if we get an error back, flush the cache and try again */
792   if (setjmp(errorbuf) != 0)
793      code_flush_cache(drcuml);
794
795   /* start the block */
796   block = drcuml_block_begin(drcuml, 4096, &errorbuf);
797
798   /* loop until we get through all instruction sequences */
799   for (seqhead = desclist; seqhead != NULL; seqhead = seqlast->next)
800   {
801      const opcode_desc *curdesc;
802      UINT32 nextpc;
803
804      /* add a code log entry */
805      if (LOG_UML)
806         UML_COMMENT(block, "-------------------------");                  // comment
807
808      /* determine the last instruction in this sequence */
809      for (seqlast = seqhead; seqlast != NULL; seqlast = seqlast->next)
810         if (seqlast->flags & OPFLAG_END_SEQUENCE)
811            break;
812      assert(seqlast != NULL);
813
814      /* if we don't have a hash for this mode/pc, or if we are overriding all, add one */
815      if (override || !drcuml_hash_exists(drcuml, mode, seqhead->pc))
816         UML_HASH(block, mode, seqhead->pc);                              // hash    mode,pc
817
818      /* if we already have a hash, and this is the first sequence, assume that we */
819      /* are recompiling due to being out of sync and allow future overrides */
820      else if (seqhead == desclist)
821      {
822         override = TRUE;
823         UML_HASH(block, mode, seqhead->pc);                              // hash    mode,pc
824      }
825
826      /* otherwise, redispatch to that fixed PC and skip the rest of the processing */
827      else
828      {
829         UML_LABEL(block, seqhead->pc | 0x80000000);                        // label   seqhead->pc | 0x80000000
830         UML_HASHJMP(block, IMM(0), IMM(seqhead->pc), sh2->nocode);
831                                                               // hashjmp <mode>,seqhead->pc,nocode
832         continue;
833      }
834
835      /* validate this code block if we're not pointing into ROM */
836      if (memory_get_write_ptr(cpu_getactivecpu(), ADDRESS_SPACE_PROGRAM, seqhead->physpc) != NULL)
837         generate_checksum_block(block, &compiler, seqhead, seqlast);
838
839      /* label this instruction, if it may be jumped to locally */
840      if (seqhead->flags & OPFLAG_IS_BRANCH_TARGET)
841      {
842         UML_LABEL(block, seqhead->pc | 0x80000000);                        // label   seqhead->pc | 0x80000000
843      }
844
845      /* iterate over instructions in the sequence and compile them */
846      for (curdesc = seqhead; curdesc != seqlast->next; curdesc = curdesc->next)
847      {
848         generate_sequence_instruction(block, &compiler, curdesc);
849      }
850
851      /* if we need to return to the start, do it */
852      if (seqlast->flags & OPFLAG_RETURN_TO_START)
853      {
854         nextpc = pc;
855      }
856      /* otherwise we just go to the next instruction */
857      else
858      {
859         nextpc = seqlast->pc + (seqlast->skipslots + 1) * 2;
860      }
861
862      /* count off cycles and go there */
863      generate_update_cycles(block, &compiler, IMM(nextpc), TRUE);            // <subtract cycles>
864
865      /* SH2 has no modes */
866      if (seqlast->next == NULL || seqlast->next->pc != nextpc)
867      {
868         UML_HASHJMP(block, IMM(0), IMM(nextpc), sh2->nocode);
869      }
870                                                               // hashjmp <mode>,nextpc,nocode
871   }
872
873   /* end the sequence */
874   drcuml_block_end(block);
875}
876
877/*-------------------------------------------------
878    static_generate_entry_point - generate a
879    static entry point
880-------------------------------------------------*/
881
882static void static_generate_entry_point(drcuml_state *drcuml)
883{
884   drcuml_codelabel skip = 1;
885   drcuml_block *block;
886   jmp_buf errorbuf;
887
888   /* if we get an error back, we're screwed */
889   if (setjmp(errorbuf) != 0)
890      fatalerror("Unrecoverable error in static_generate_entry_point");
891
892   /* begin generating */
893   block = drcuml_block_begin(drcuml, 200, &errorbuf);
894
895   /* forward references */
896   alloc_handle(drcuml, &sh2->nocode, "nocode");
897   alloc_handle(drcuml, &sh2->write32, "write32");      // necessary?
898   alloc_handle(drcuml, &sh2->entry, "entry");
899   UML_HANDLE(block, sh2->entry);                     // handle  entry
900
901   /* load fast integer registers */
902   load_fast_iregs(block);
903
904   /* check for interrupts */
905   UML_CALLC(block, cfunc_checkirqs, NULL);
906
907   UML_CMP(block, MEM(&sh2->evec), IMM(0xffffffff));      // cmp evec, 0xffffffff
908   UML_JMPc(block, IF_Z, skip);                  // jz skip
909
910   UML_SUB(block, R32(15), R32(15), IMM(4));            // sub R15, R15, #4
911   UML_MOV(block, IREG(0), R32(15));            // mov r0, R15
912   UML_MOV(block, IREG(1), MEM(&sh2->irqsr));           // mov r1, irqsr
913   UML_CALLH(block, sh2->write32);               // call write32
914
915   UML_SUB(block, R32(15), R32(15), IMM(4));            // sub R15, R15, #4
916   UML_MOV(block, IREG(0), R32(15));            // mov r0, R15
917   UML_MOV(block, IREG(1), MEM(&sh2->pc));            // mov r1, pc
918   UML_CALLH(block, sh2->write32);               // call write32
919
920   UML_MOV(block, MEM(&sh2->pc), MEM(&sh2->evec));             // mov pc, evec
921
922   UML_LABEL(block, skip);                      // skip:
923
924   /* generate a hash jump via the current mode and PC */
925   UML_HASHJMP(block, IMM(0), MEM(&sh2->pc), sh2->nocode);      // hashjmp <mode>,<pc>,nocode
926
927   drcuml_block_end(block);
928}
929
930/*-------------------------------------------------
931    static_generate_nocode_handler - generate an
932    exception handler for "out of code"
933-------------------------------------------------*/
934
935static void static_generate_nocode_handler(drcuml_state *drcuml)
936{
937   drcuml_block *block;
938   jmp_buf errorbuf;
939
940   /* if we get an error back, we're screwed */
941   if (setjmp(errorbuf) != 0)
942      fatalerror("Unrecoverable error in static_generate_nocode_handler");
943
944   /* begin generating */
945   block = drcuml_block_begin(drcuml, 10, &errorbuf);
946
947   /* generate a hash jump via the current mode and PC */
948   alloc_handle(drcuml, &sh2->nocode, "nocode");
949   UML_HANDLE(block, sh2->nocode);                           // handle  nocode
950   UML_GETEXP(block, IREG(0));                           // getexp  i0
951   UML_MOV(block, MEM(&sh2->pc), IREG(0));                        // mov     [pc],i0
952   save_fast_iregs(block);
953   UML_EXIT(block, IMM(EXECUTE_MISSING_CODE));                     // exit    EXECUTE_MISSING_CODE
954
955   drcuml_block_end(block);
956}
957
958
959/*-------------------------------------------------
960    static_generate_out_of_cycles - generate an
961    out of cycles exception handler
962-------------------------------------------------*/
963
964static void static_generate_out_of_cycles(drcuml_state *drcuml)
965{
966   drcuml_block *block;
967   jmp_buf errorbuf;
968
969   /* if we get an error back, we're screwed */
970   if (setjmp(errorbuf) != 0)
971      fatalerror("Unrecoverable error in static_generate_out_of_cycles");
972
973   /* begin generating */
974   block = drcuml_block_begin(drcuml, 10, &errorbuf);
975
976   /* generate a hash jump via the current mode and PC */
977   alloc_handle(drcuml, &sh2->out_of_cycles, "out_of_cycles");
978   UML_HANDLE(block, sh2->out_of_cycles);                        // handle  out_of_cycles
979   UML_GETEXP(block, IREG(0));                           // getexp  i0
980   UML_MOV(block, MEM(&sh2->pc), IREG(0));                        // mov     <pc>,i0
981   save_fast_iregs(block);
982   UML_EXIT(block, IMM(EXECUTE_OUT_OF_CYCLES));                     // exit    EXECUTE_OUT_OF_CYCLES
983
984   drcuml_block_end(block);
985}
986
987/*------------------------------------------------------------------
988    static_generate_memory_accessor
989------------------------------------------------------------------*/
990
991static void static_generate_memory_accessor(drcuml_state *drcuml, int size, int iswrite, const char *name, drcuml_codehandle **handleptr)
992{
993   /* on entry, address is in I0; data for writes is in I1 */
994   /* on exit, read result is in I0 */
995   /* routine trashes I0 */
996   drcuml_block *block;
997   jmp_buf errorbuf;
998   int label = 1;
999
1000   /* if we get an error back, we're screwed */
1001   if (setjmp(errorbuf) != 0)
1002      fatalerror("Unrecoverable error in static_generate_memory_accessor");
1003
1004   /* begin generating */
1005   block = drcuml_block_begin(drcuml, 1024, &errorbuf);
1006
1007   /* add a global entry for this */
1008   alloc_handle(drcuml, handleptr, name);
1009   UML_HANDLE(block, *handleptr);                     // handle  *handleptr
1010
1011   // with internal handlers this becomes easier.
1012   // if addr < 0x40000000 AND it with AM and do the read/write, else just do the read/write
1013   UML_TEST(block, IREG(0), IMM(0x80000000));      // test r0, #0x80000000
1014   UML_JMPc(block, IF_NZ, label);            // if high bit is set, don't mask
1015
1016   UML_CMP(block, IREG(0), IMM(0x40000000));      // cmp #0x40000000, r0
1017   UML_JMPc(block, IF_AE, label);             // bae label
1018
1019   UML_AND(block, IREG(0), IREG(0), IMM(AM));      // and r0, r0, #AM (0xc7ffffff)
1020
1021   UML_LABEL(block, label++);            // label:
1022
1023   if (iswrite)
1024   {
1025      switch (size)
1026      {
1027         case 1:
1028            UML_WRITE(block, IREG(0), IREG(1), PROGRAM_BYTE);   // write r0, r1, program_byte
1029            break;
1030
1031         case 2:
1032            UML_WRITE(block, IREG(0), IREG(1), PROGRAM_WORD);   // write r0, r1, program_word
1033            break;
1034
1035         case 4:
1036            UML_WRITE(block, IREG(0), IREG(1), PROGRAM_DWORD);   // write r0, r1, program_dword
1037            break;
1038      }
1039   }
1040   else
1041   {
1042      switch (size)
1043      {
1044         case 1:
1045            UML_READ(block, IREG(0), IREG(0), PROGRAM_BYTE);   // read r0, program_byte
1046            break;
1047
1048         case 2:
1049            UML_READ(block, IREG(0), IREG(0), PROGRAM_WORD);   // read r0, program_word
1050            break;
1051
1052         case 4:
1053            UML_READ(block, IREG(0), IREG(0), PROGRAM_DWORD);   // read r0, program_dword
1054            break;
1055      }
1056   }
1057
1058   UML_RET(block);                       // ret
1059
1060   drcuml_block_end(block);
1061}
1062
1063/*-------------------------------------------------
1064    log_desc_flags_to_string - generate a string
1065    representing the instruction description
1066    flags
1067-------------------------------------------------*/
1068
1069static const char *log_desc_flags_to_string(UINT32 flags)
1070{
1071   static char tempbuf[30];
1072   char *dest = tempbuf;
1073
1074   /* branches */
1075   if (flags & OPFLAG_IS_UNCONDITIONAL_BRANCH)
1076      *dest++ = 'U';
1077   else if (flags & OPFLAG_IS_CONDITIONAL_BRANCH)
1078      *dest++ = 'C';
1079   else
1080      *dest++ = '.';
1081
1082   /* intrablock branches */
1083   *dest++ = (flags & OPFLAG_INTRABLOCK_BRANCH) ? 'i' : '.';
1084
1085   /* branch targets */
1086   *dest++ = (flags & OPFLAG_IS_BRANCH_TARGET) ? 'B' : '.';
1087
1088   /* delay slots */
1089   *dest++ = (flags & OPFLAG_IN_DELAY_SLOT) ? 'D' : '.';
1090
1091   /* exceptions */
1092   if (flags & OPFLAG_WILL_CAUSE_EXCEPTION)
1093      *dest++ = 'E';
1094   else if (flags & OPFLAG_CAN_CAUSE_EXCEPTION)
1095      *dest++ = 'e';
1096   else
1097      *dest++ = '.';
1098
1099   /* read/write */
1100   if (flags & OPFLAG_READS_MEMORY)
1101      *dest++ = 'R';
1102   else if (flags & OPFLAG_WRITES_MEMORY)
1103      *dest++ = 'W';
1104   else
1105      *dest++ = '.';
1106
1107   /* TLB validation */
1108   *dest++ = (flags & OPFLAG_VALIDATE_TLB) ? 'V' : '.';
1109
1110   /* TLB modification */
1111   *dest++ = (flags & OPFLAG_MODIFIES_TRANSLATION) ? 'T' : '.';
1112
1113   /* redispatch */
1114   *dest++ = (flags & OPFLAG_REDISPATCH) ? 'R' : '.';
1115   return tempbuf;
1116}
1117
1118
1119/*-------------------------------------------------
1120    log_register_list - log a list of GPR registers
1121-------------------------------------------------*/
1122
1123static void log_register_list(drcuml_state *drcuml, const char *string, const UINT32 *reglist, const UINT32 *regnostarlist)
1124{
1125   int count = 0;
1126   int regnum;
1127
1128   /* skip if nothing */
1129   if (reglist[0] == 0 && reglist[1] == 0 && reglist[2] == 0)
1130      return;
1131
1132   drcuml_log_printf(drcuml, "[%s:", string);
1133
1134   for (regnum = 0; regnum < 16; regnum++)
1135   {
1136      if (reglist[0] & REGFLAG_R(regnum))
1137      {
1138         drcuml_log_printf(drcuml, "%sr%d", (count++ == 0) ? "" : ",", regnum);
1139         if (regnostarlist != NULL && !(regnostarlist[0] & REGFLAG_R(regnum)))
1140            drcuml_log_printf(drcuml, "*");
1141      }
1142   }
1143
1144   if (reglist[1] & REGFLAG_PR)
1145   {
1146      drcuml_log_printf(drcuml, "%spr", (count++ == 0) ? "" : ",");
1147      if (regnostarlist != NULL && !(regnostarlist[1] & REGFLAG_PR))
1148         drcuml_log_printf(drcuml, "*");
1149   }
1150
1151   if (reglist[1] & REGFLAG_SR)
1152   {
1153      drcuml_log_printf(drcuml, "%ssr", (count++ == 0) ? "" : ",");
1154      if (regnostarlist != NULL && !(regnostarlist[1] & REGFLAG_SR))
1155         drcuml_log_printf(drcuml, "*");
1156   }
1157
1158   if (reglist[1] & REGFLAG_MACL)
1159   {
1160      drcuml_log_printf(drcuml, "%smacl", (count++ == 0) ? "" : ",");
1161      if (regnostarlist != NULL && !(regnostarlist[1] & REGFLAG_MACL))
1162         drcuml_log_printf(drcuml, "*");
1163   }
1164
1165   if (reglist[1] & REGFLAG_MACH)
1166   {
1167      drcuml_log_printf(drcuml, "%smach", (count++ == 0) ? "" : ",");
1168      if (regnostarlist != NULL && !(regnostarlist[1] & REGFLAG_MACH))
1169         drcuml_log_printf(drcuml, "*");
1170   }
1171
1172   if (reglist[1] & REGFLAG_GBR)
1173   {
1174      drcuml_log_printf(drcuml, "%sgbr", (count++ == 0) ? "" : ",");
1175      if (regnostarlist != NULL && !(regnostarlist[1] & REGFLAG_GBR))
1176         drcuml_log_printf(drcuml, "*");
1177   }
1178
1179   if (reglist[1] & REGFLAG_VBR)
1180   {
1181      drcuml_log_printf(drcuml, "%svbr", (count++ == 0) ? "" : ",");
1182      if (regnostarlist != NULL && !(regnostarlist[1] & REGFLAG_VBR))
1183         drcuml_log_printf(drcuml, "*");
1184   }
1185
1186   drcuml_log_printf(drcuml, "] ");
1187}
1188
1189/*-------------------------------------------------
1190    log_opcode_desc - log a list of descriptions
1191-------------------------------------------------*/
1192
1193static void log_opcode_desc(drcuml_state *drcuml, const opcode_desc *desclist, int indent)
1194{
1195   /* open the file, creating it if necessary */
1196   if (indent == 0)
1197      drcuml_log_printf(drcuml, "\nDescriptor list @ %08X\n", desclist->pc);
1198
1199   /* output each descriptor */
1200   for ( ; desclist != NULL; desclist = desclist->next)
1201   {
1202      char buffer[100];
1203
1204      /* disassemle the current instruction and output it to the log */
1205#if (LOG_UML || LOG_NATIVE)
1206      if (desclist->flags & OPFLAG_VIRTUAL_NOOP)
1207         strcpy(buffer, "<virtual nop>");
1208      else
1209         DasmSH2(buffer, desclist->pc, *desclist->opptr.w);
1210#else
1211      strcpy(buffer, "???");
1212#endif
1213      drcuml_log_printf(drcuml, "%08X [%08X] t:%08X f:%s: %-30s", desclist->pc, desclist->physpc, desclist->targetpc, log_desc_flags_to_string(desclist->flags), buffer);
1214
1215      /* output register states */
1216      log_register_list(drcuml, "use", desclist->regin, NULL);
1217      log_register_list(drcuml, "mod", desclist->regout, desclist->regreq);
1218      drcuml_log_printf(drcuml, "\n");
1219
1220      /* if we have a delay slot, output it recursively */
1221      if (desclist->delay != NULL)
1222         log_opcode_desc(drcuml, desclist->delay, indent + 1);
1223
1224      /* at the end of a sequence add a dividing line */
1225      if (desclist->flags & OPFLAG_END_SEQUENCE)
1226         drcuml_log_printf(drcuml, "-----\n");
1227   }
1228}
1229
1230/*-------------------------------------------------
1231    log_add_disasm_comment - add a comment
1232    including disassembly of a MIPS instruction
1233-------------------------------------------------*/
1234
1235static void log_add_disasm_comment(drcuml_block *block, UINT32 pc, UINT32 op)
1236{
1237#if (LOG_UML)
1238   char buffer[100];
1239   DasmSH2(buffer, pc, op);
1240   UML_COMMENT(block, "%08X: %s", pc, buffer);                              // comment
1241#endif
1242}
1243
1244/*-------------------------------------------------
1245    generate_update_cycles - generate code to
1246    subtract cycles from the icount and generate
1247    an exception if out
1248-------------------------------------------------*/
1249static void generate_update_cycles(drcuml_block *block, compiler_state *compiler, drcuml_ptype ptype, UINT64 pvalue, int allow_exception)
1250{
1251   /* check full interrupts if pending */
1252   if (compiler->checkints)
1253   {
1254      drcuml_codelabel skip = compiler->labelnum++;
1255
1256      compiler->checkints = FALSE;
1257
1258      /* check for interrupts */
1259      UML_CALLC(block, cfunc_checkirqs, NULL);
1260
1261      UML_CMP(block, MEM(&sh2->evec), IMM(0xffffffff));      // cmp evec, 0xffffffff
1262      UML_JMPc(block, IF_Z, skip);                  // jz skip
1263
1264      UML_SUB(block, R32(15), R32(15), IMM(4));            // sub R15, R15, #4
1265      UML_MOV(block, IREG(0), R32(15));            // mov r0, R15
1266      UML_MOV(block, IREG(1), MEM(&sh2->irqsr));           // mov r1, irqsr
1267      UML_CALLH(block, sh2->write32);               // call write32
1268
1269      UML_SUB(block, R32(15), R32(15), IMM(4));            // sub R15, R15, #4
1270      UML_MOV(block, IREG(0), R32(15));            // mov r0, R15
1271      UML_MOV(block, IREG(1), PARAM(ptype, pvalue));              // mov r1, nextpc
1272      UML_CALLH(block, sh2->write32);               // call write32
1273
1274      UML_HASHJMP(block, IMM(0), MEM(&sh2->evec), sh2->nocode);        // hashjmp sh2->evec
1275
1276      UML_LABEL(block, skip);                      // skip:
1277   }
1278
1279   /* account for cycles */
1280   if (compiler->cycles > 0)
1281   {
1282      UML_SUB(block, MEM(&sh2->icount), MEM(&sh2->icount), MAPVAR_CYCLES);   // sub     icount,icount,cycles
1283      UML_MAPVAR(block, MAPVAR_CYCLES, 0);                              // mapvar  cycles,0
1284      if (allow_exception)
1285         UML_EXHc(block, IF_S, sh2->out_of_cycles, PARAM(ptype, pvalue));
1286                                                               // exh     out_of_cycles,nextpc
1287   }
1288   compiler->cycles = 0;
1289}
1290
1291/*-------------------------------------------------
1292    generate_checksum_block - generate code to
1293    validate a sequence of opcodes
1294-------------------------------------------------*/
1295
1296static void generate_checksum_block(drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast)
1297{
1298   const opcode_desc *curdesc;
1299   if (LOG_UML)
1300      UML_COMMENT(block, "[Validation for %08X]", seqhead->pc);               // comment
1301
1302   /* loose verify or single instruction: just compare and fail */
1303   if (!(sh2->drcoptions & SH2DRC_STRICT_VERIFY) || seqhead->next == NULL)
1304   {
1305      if (!(seqhead->flags & OPFLAG_VIRTUAL_NOOP))
1306      {
1307         UML_LOAD(block, IREG(0), seqhead->opptr.l, IMM(0), DWORD);            // load    i0,*opptr,0,dword
1308         UML_CMP(block, IREG(0), IMM(*seqhead->opptr.l));                  // cmp     i0,*opptr
1309         UML_EXHc(block, IF_NE, sh2->nocode, IMM(epc(seqhead)));      // exne    nocode,seqhead->pc
1310      }
1311   }
1312
1313   /* full verification; sum up everything */
1314   else
1315   {
1316#if 0
1317      for (curdesc = seqhead->next; curdesc != seqlast->next; curdesc = curdesc->next)
1318         if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
1319         {
1320            UML_LOAD(block, IREG(0), curdesc->opptr.w, IMM(0), WORD);         // load    i0,*opptr,0,word
1321            UML_CMP(block, IREG(0), IMM(*curdesc->opptr.w));               // cmp     i0,*opptr
1322            UML_EXHc(block, IF_NE, sh2->nocode, IMM(epc(seqhead)));   // exne    nocode,seqhead->pc
1323         }
1324#else
1325      UINT32 sum = 0;
1326      UML_LOAD(block, IREG(0), seqhead->opptr.l, IMM(0), DWORD);               // load    i0,*opptr,0,dword
1327      sum += *seqhead->opptr.l;
1328      for (curdesc = seqhead->next; curdesc != seqlast->next; curdesc = curdesc->next)
1329         if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
1330         {
1331            UML_LOAD(block, IREG(1), curdesc->opptr.l, IMM(0), DWORD);         // load    i1,*opptr,dword
1332            UML_ADD(block, IREG(0), IREG(0), IREG(1));                     // add     i0,i0,i1
1333            sum += *curdesc->opptr.l;
1334         }
1335      UML_CMP(block, IREG(0), IMM(sum));                                 // cmp     i0,sum
1336      UML_EXHc(block, IF_NE, sh2->nocode, IMM(epc(seqhead)));         // exne    nocode,seqhead->pc
1337#endif
1338   }
1339}
1340
1341
1342/*-------------------------------------------------
1343    generate_sequence_instruction - generate code
1344    for a single instruction in a sequence
1345-------------------------------------------------*/
1346
1347static void generate_sequence_instruction(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
1348{
1349   offs_t expc;
1350
1351   /* add an entry for the log */
1352   if (LOG_UML && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
1353      log_add_disasm_comment(block, desc->pc, *desc->opptr.l);
1354
1355   /* set the PC map variable */
1356   expc = (desc->flags & OPFLAG_IN_DELAY_SLOT) ? desc->pc - 1 : desc->pc;
1357   UML_MAPVAR(block, MAPVAR_PC, expc);                                    // mapvar  PC,expc
1358
1359   /* accumulate total cycles */
1360   compiler->cycles += desc->cycles;
1361
1362   /* update the icount map variable */
1363   UML_MAPVAR(block, MAPVAR_CYCLES, compiler->cycles);                        // mapvar  CYCLES,compiler->cycles
1364
1365   /* if we want a probe, add it here */
1366   if (desc->pc == PROBE_ADDRESS)
1367      UML_CALLC(block, cfunc_printf_probe, desc->pc);                        // callc   cfunc_printf_probe,desc->pc
1368
1369   /* if we are debugging, call the debugger */
1370   if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
1371   {
1372      UML_MOV(block, MEM(&sh2->pc), IMM(desc->pc));                        // mov     [pc],desc->pc
1373      save_fast_iregs(block);
1374      UML_DEBUG(block, IMM(desc->pc));                                 // debug   desc->pc
1375   }
1376   else   // not debug, see what other reasons there are for flushing the PC
1377   {
1378      if (sh2->drcoptions & SH2DRC_FLUSH_PC)   // always flush?
1379      {
1380         UML_MOV(block, MEM(&sh2->pc), IMM(desc->pc));      // mov sh2->pc, desc->pc
1381      }
1382      else   // check for driver-selected flushes
1383      {
1384         if (sh2->maxpcfsel != -1)
1385         {
1386            int pcflush;
1387
1388            for (pcflush = 0; pcflush <= sh2->maxpcfsel; pcflush++)
1389            {
1390               if (desc->pc == sh2->pcflushes[pcflush])
1391               {
1392                  UML_MOV(block, MEM(&sh2->pc), IMM(desc->pc));      // mov sh2->pc, desc->pc
1393               }
1394            }
1395         }
1396      }
1397   }
1398
1399
1400   /* if we hit an unmapped address, fatal error */
1401   if (desc->flags & OPFLAG_COMPILER_UNMAPPED)
1402   {
1403      UML_MOV(block, MEM(&sh2->pc), IMM(desc->pc));                        // mov     [pc],desc->pc
1404      save_fast_iregs(block);
1405      UML_EXIT(block, IMM(EXECUTE_UNMAPPED_CODE));                        // exit    EXECUTE_UNMAPPED_CODE
1406   }
1407
1408   /* if this is an invalid opcode, die */
1409   if (desc->flags & OPFLAG_INVALID_OPCODE)
1410   {
1411      fatalerror("SH2DRC: invalid opcode!\n");
1412   }
1413
1414   /* otherwise, unless this is a virtual no-op, it's a regular instruction */
1415   else if (!(desc->flags & OPFLAG_VIRTUAL_NOOP))
1416   {
1417      /* compile the instruction */
1418      if (!generate_opcode(block, compiler, desc))
1419      {
1420         UML_MOV(block, MEM(&sh2->pc), IMM(desc->pc));                     // mov     [pc],desc->pc
1421         UML_CALLC(block, cfunc_unimplemented, (void *)(FPTR)*desc->opptr.w);   // callc   cfunc_unimplemented
1422      }
1423   }
1424}
1425
1426/*------------------------------------------------------------------
1427    generate_delay_slot
1428------------------------------------------------------------------*/
1429
1430static void generate_delay_slot(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
1431{
1432   compiler_state compiler_temp = *compiler;
1433
1434   /* compile the delay slot using temporary compiler state */
1435   assert(desc->delay != NULL);
1436   generate_sequence_instruction(block, &compiler_temp, desc->delay);            // <next instruction>
1437
1438   /* update the label */
1439   compiler->labelnum = compiler_temp.labelnum;
1440}
1441
1442/*-------------------------------------------------
1443    generate_opcode - generate code for a specific
1444    opcode
1445-------------------------------------------------*/
1446
1447static int generate_opcode(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc)
1448{
1449   UINT32 scratch, scratch2;
1450   INT32 disp;
1451   UINT16 opcode = *desc->opptr.w;
1452   UINT8 opswitch = opcode >> 12;
1453   int in_delay_slot = ((desc->flags & OPFLAG_IN_DELAY_SLOT) != 0);
1454
1455   switch (opswitch)
1456   {
1457      case  0:
1458         return generate_group_0(block, compiler, desc, opcode, in_delay_slot);
1459         break;
1460
1461      case  1:    // MOVLS4
1462         scratch = (opcode & 0x0f) * 4;
1463         UML_ADD(block, IREG(0), R32(Rn), IMM(scratch));   // add r0, Rn, scratch
1464         UML_MOV(block, IREG(1), R32(Rm));      // mov r1, Rm
1465         SETEA(0);                  // set ea for debug
1466         UML_CALLH(block, sh2->write32);
1467
1468         if (!in_delay_slot)
1469            generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
1470         return TRUE;
1471         break;
1472
1473      case  2:
1474         return generate_group_2(block, compiler, desc, opcode, in_delay_slot);
1475         break;
1476      case  3:
1477         return generate_group_3(block, compiler, desc, opcode);
1478         break;
1479      case  4:
1480         return generate_group_4(block, compiler, desc, opcode, in_delay_slot);
1481         break;
1482
1483      case  5:    // MOVLL4
1484         scratch = (opcode & 0x0f) * 4;
1485         UML_ADD(block, IREG(0), R32(Rm), IMM(scratch));      // add r0, Rm, scratch
1486         SETEA(0);                  // set ea for debug
1487         UML_CALLH(block, sh2->read32);            // call read32
1488         UML_MOV(block, R32(Rn), IREG(0));         // mov Rn, r0
1489
1490         if (!in_delay_slot)
1491            generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
1492         return TRUE;
1493         break;
1494
1495      case  6:
1496         return generate_group_6(block, compiler, desc, opcode, in_delay_slot);
1497         break;
1498
1499      case  7:    // ADDI
1500         scratch = opcode & 0xff;
1501         scratch2 = (UINT32)(INT32)(INT16)(INT8)scratch;
1502         UML_ADD(block, R32(Rn), R32(Rn), IMM(scratch2));   // add Rn, Rn, scratch2
1503         return TRUE;
1504         break;
1505
1506      case  8:
1507         return generate_group_8(block, compiler, desc, opcode, in_delay_slot);
1508         break;
1509
1510      case  9:    // MOVWI
1511         scratch = (desc->pc + 2) + ((opcode & 0xff) * 2) + 2;
1512         UML_MOV(block, IREG(0), IMM(scratch));         // mov r0, scratch
1513         SETEA(0);                  // set ea for debug
1514         UML_CALLH(block, sh2->read16);            // read16(r0, r1)
1515         UML_SEXT(block, R32(Rn), IREG(0), WORD);            // sext Rn, r0, WORD
1516
1517         if (!in_delay_slot)
1518            generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
1519         return TRUE;
1520         break;
1521
1522      case 10:    // BRA
1523         generate_delay_slot(block, compiler, desc);
1524
1525            disp = ((INT32)opcode << 20) >> 20;
1526
1527         sh2->ea = (desc->pc + 2) + disp * 2 + 2;         // sh2->ea = pc+4 + disp*2 + 2
1528
1529         generate_update_cycles(block, compiler, IMM(sh2->ea), TRUE);   // <subtract cycles>
1530         UML_HASHJMP(block, IMM(0), IMM(sh2->ea), sh2->nocode);   // hashjmp sh2->ea
1531         return TRUE;
1532         break;
1533
1534      case 11:    // BSR
1535         generate_delay_slot(block, compiler, desc);
1536
1537            disp = ((INT32)opcode << 20) >> 20;
1538
1539         UML_ADD(block, MEM(&sh2->pr), IMM(desc->pc), IMM(4));   // add sh2->pr, desc->pc, #4 (skip the current insn & delay slot)
1540
1541         sh2->ea = (desc->pc + 2) + disp * 2 + 2;         // sh2->ea = pc+4 + disp*2 + 2
1542         generate_update_cycles(block, compiler, IMM(sh2->ea), TRUE);   // <subtract cycles>
1543         UML_HASHJMP(block, IMM(0), IMM(sh2->ea), sh2->nocode);   // hashjmp sh2->ea
1544         return TRUE;
1545         break;
1546
1547      case 12:
1548         return generate_group_12(block, compiler, desc, opcode, in_delay_slot);
1549         break;
1550
1551      case 13:    // MOVLI
1552         scratch = ((desc->pc + 4) & ~3) + ((opcode & 0xff) * 4);
1553         UML_MOV(block, IREG(0), IMM(scratch));         // mov r0, scratch
1554         UML_CALLH(block, sh2->read32);            // read32(r0, r1)
1555         UML_MOV(block, R32(Rn), IREG(0));         // mov Rn, r0
1556
1557         if (!in_delay_slot)
1558            generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
1559         return TRUE;
1560         break;
1561
1562      case 14:    // MOVI
1563         scratch = opcode & 0xff;
1564         scratch2 = (UINT32)(INT32)(INT16)(INT8)scratch;
1565         UML_MOV(block, R32(Rn), IMM(scratch2));
1566         return TRUE;
1567         break;
1568
1569      case 15:    // NOP
1570         return TRUE;
1571         break;
1572   }
1573
1574   return FALSE;
1575}
1576
1577static int generate_group_0(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot)
1578{
1579   switch (opcode & 0x3F)
1580   {
1581   case 0x00: // NOP();
1582   case 0x01: // NOP();
1583   case 0x09: // NOP();
1584   case 0x10: // NOP();
1585   case 0x11: // NOP();
1586   case 0x13: // NOP();
1587   case 0x20: // NOP();
1588   case 0x21: // NOP();
1589   case 0x30: // NOP();
1590   case 0x31: // NOP();
1591   case 0x32: // NOP();
1592   case 0x33: // NOP();
1593   case 0x38: // NOP();
1594   case 0x39: // NOP();
1595   case 0x3a: // NOP();
1596   case 0x3b: // NOP();
1597      return TRUE;
1598      break;
1599
1600   case 0x02: // STCSR(Rn);
1601      UML_MOV(block, R32(Rn), MEM(&sh2->sr));
1602      return TRUE;
1603      break;
1604
1605   case 0x03: // BSRF(Rn);
1606      UML_ADD(block, MEM(&sh2->target), R32(Rn), IMM(4));   // add target, Rm, #4
1607      UML_ADD(block, MEM(&sh2->target), MEM(&sh2->target), IMM(desc->pc));   // add target, target, pc
1608
1609      generate_delay_slot(block, compiler, desc);
1610
1611      UML_ADD(block, MEM(&sh2->pr), IMM(desc->pc), IMM(4));   // add sh2->pr, desc->pc, #4 (skip the current insn & delay slot)
1612
1613      generate_update_cycles(block, compiler, MEM(&sh2->target), TRUE);   // <subtract cycles>
1614      UML_HASHJMP(block, IMM(0), MEM(&sh2->target), sh2->nocode);   // jmp target
1615      return TRUE;
1616      break;
1617
1618   case 0x04: // MOVBS0(Rm, Rn);
1619   case 0x14: // MOVBS0(Rm, Rn);
1620   case 0x24: // MOVBS0(Rm, Rn);
1621   case 0x34: // MOVBS0(Rm, Rn);
1622      UML_ADD(block, IREG(0), R32(0), R32(Rn));      // add r0, R0, Rn
1623      UML_MOV(block, IREG(1), R32(Rm));         // mov r1, Rm
1624      UML_AND(block, IREG(1), IREG(1), IMM(0x000000ff));      // and r1, r1, 0xff
1625      UML_CALLH(block, sh2->write8);            // call write8
1626
1627      if (!in_delay_slot)
1628         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
1629      return TRUE;
1630      break;
1631
1632   case 0x05: // MOVWS0(Rm, Rn);
1633   case 0x15: // MOVWS0(Rm, Rn);
1634   case 0x25: // MOVWS0(Rm, Rn);
1635   case 0x35: // MOVWS0(Rm, Rn);
1636      UML_ADD(block, IREG(0), R32(0), R32(Rn));      // add r0, R0, Rn
1637      UML_MOV(block, IREG(1), R32(Rm));         // mov r1, Rm
1638      UML_AND(block, IREG(1), IREG(1), IMM(0x0000ffff));     // and r1, r1, 0xffff
1639      UML_CALLH(block, sh2->write16);            // call write16
1640
1641      if (!in_delay_slot)
1642         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
1643      return TRUE;
1644      break;
1645
1646   case 0x06: // MOVLS0(Rm, Rn);
1647   case 0x16: // MOVLS0(Rm, Rn);
1648   case 0x26: // MOVLS0(Rm, Rn);
1649   case 0x36: // MOVLS0(Rm, Rn);
1650      UML_ADD(block, IREG(0), R32(0), R32(Rn));      // add r0, R0, Rn
1651      UML_MOV(block, IREG(1), R32(Rm));         // mov r1, Rm
1652      UML_CALLH(block, sh2->write32);            // call write32
1653
1654      if (!in_delay_slot)
1655         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
1656      return TRUE;
1657      break;
1658
1659   case 0x07: // MULL(Rm, Rn);
1660   case 0x17: // MULL(Rm, Rn);
1661   case 0x27: // MULL(Rm, Rn);
1662   case 0x37: // MULL(Rm, Rn);
1663      UML_MULU(block, MEM(&sh2->macl), MEM(&sh2->ea), R32(Rn), R32(Rm));   // mulu macl, ea, Rn, Rm
1664      return TRUE;
1665      break;
1666
1667   case 0x08: // CLRT();
1668      UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T));   // and r0, sr, ~T (clear the T bit)
1669      return TRUE;
1670      break;
1671
1672   case 0x0a: // STSMACH(Rn);
1673      UML_MOV(block, R32(Rn), MEM(&sh2->mach));      // mov Rn, mach
1674      return TRUE;
1675      break;
1676
1677   case 0x0b: // RTS();
1678      UML_MOV(block, MEM(&sh2->target), MEM(&sh2->pr));   // mov target, pr (in case of d-slot shenanigans)
1679
1680      generate_delay_slot(block, compiler, desc);
1681
1682      generate_update_cycles(block, compiler, MEM(&sh2->target), TRUE);   // <subtract cycles>
1683      UML_HASHJMP(block, IMM(0), MEM(&sh2->target), sh2->nocode);
1684      return TRUE;
1685      break;
1686
1687   case 0x0c: // MOVBL0(Rm, Rn);
1688   case 0x1c: // MOVBL0(Rm, Rn);
1689   case 0x2c: // MOVBL0(Rm, Rn);
1690   case 0x3c: // MOVBL0(Rm, Rn);
1691      UML_ADD(block, IREG(0), R32(0), R32(Rm));      // add r0, R0, Rm
1692      UML_CALLH(block, sh2->read8);            // call read8
1693      UML_SEXT(block, R32(Rn), IREG(0), BYTE);      // sext Rn, r0, BYTE
1694
1695      if (!in_delay_slot)
1696         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
1697      return TRUE;
1698      break;
1699
1700   case 0x0d: // MOVWL0(Rm, Rn);
1701   case 0x1d: // MOVWL0(Rm, Rn);
1702   case 0x2d: // MOVWL0(Rm, Rn);
1703   case 0x3d: // MOVWL0(Rm, Rn);
1704      UML_ADD(block, IREG(0), R32(0), R32(Rm));      // add r0, R0, Rm
1705      UML_CALLH(block, sh2->read16);            // call read16
1706      UML_SEXT(block, R32(Rn), IREG(0), WORD);      // sext Rn, r0, WORD
1707
1708      if (!in_delay_slot)
1709         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
1710      return TRUE;
1711      break;
1712
1713   case 0x0e: // MOVLL0(Rm, Rn);
1714   case 0x1e: // MOVLL0(Rm, Rn);
1715   case 0x2e: // MOVLL0(Rm, Rn);
1716   case 0x3e: // MOVLL0(Rm, Rn);
1717      UML_ADD(block, IREG(0), R32(0), R32(Rm));      // add r0, R0, Rm
1718      UML_CALLH(block, sh2->read32);            // call read32
1719      UML_MOV(block, R32(Rn), IREG(0));         // mov Rn, r0
1720
1721      if (!in_delay_slot)
1722         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
1723      return TRUE;
1724      break;
1725
1726   case 0x0f: // MAC_L(Rm, Rn);
1727   case 0x1f: // MAC_L(Rm, Rn);
1728   case 0x2f: // MAC_L(Rm, Rn);
1729   case 0x3f: // MAC_L(Rm, Rn);
1730      save_fast_iregs(block);
1731      UML_CALLC(block, cfunc_MAC_L, desc->opptr.w);
1732      load_fast_iregs(block);
1733      return TRUE;
1734      break;
1735
1736   case 0x12: // STCGBR(Rn);
1737      UML_MOV(block, R32(Rn), MEM(&sh2->gbr));      // mov Rn, gbr
1738      return TRUE;
1739      break;
1740
1741   case 0x18: // SETT();
1742      UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(T));   // or sr, sr, T
1743      return TRUE;
1744      break;
1745
1746   case 0x19: // DIV0U();
1747      UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~(M|Q|T)));   // and sr, sr, ~(M|Q|T)
1748      return TRUE;
1749      break;
1750
1751   case 0x1a: // STSMACL(Rn);
1752      UML_MOV(block, R32(Rn), MEM(&sh2->macl));      // mov Rn, macl
1753      return TRUE;
1754      break;
1755
1756   case 0x1b: // SLEEP();
1757      // inlined special version of generate_update_cycles here
1758      // if an interrupt is taken, the return address is set to the next instruction
1759      UML_CALLC(block, cfunc_checkirqs, NULL);
1760
1761      UML_MOV(block, IREG(0), MEM(&sh2->evec));         // mov r0, evec
1762      UML_CMP(block, IREG(0), IMM(0xffffffff));         // cmp r0, 0xffffffff
1763      UML_JMPc(block, IF_Z, compiler->labelnum);              // jz skip
1764
1765      UML_SUB(block, R32(15), R32(15), IMM(4));            // sub R15, R15, #4
1766      UML_MOV(block, IREG(0), R32(15));            // mov r0, R15
1767      UML_MOV(block, IREG(1), MEM(&sh2->irqsr));           // mov r1, irqsr
1768      UML_CALLH(block, sh2->write32);               // call write32
1769
1770      UML_SUB(block, R32(15), R32(15), IMM(4));            // sub R15, R15, #4
1771      UML_MOV(block, IREG(0), R32(15));            // mov r0, R15
1772      UML_MOV(block, IREG(1), IMM(desc->pc+2));              // mov r1, nextpc
1773      UML_CALLH(block, sh2->write32);               // call write32
1774
1775      UML_HASHJMP(block, IMM(0), MEM(&sh2->evec), sh2->nocode);        // hashjmp sh2->evec
1776
1777      UML_LABEL(block, compiler->labelnum++);                   // skip:
1778
1779      // now go "out of cycles"
1780      if (compiler->cycles > 0)
1781      {
1782         UML_MOV(block, MEM(&sh2->icount), IMM(0));         // mov icount, #0
1783         UML_MAPVAR(block, MAPVAR_CYCLES, 0);            // mapvar  cycles,0
1784         UML_EXH(block, sh2->out_of_cycles, IMM(desc->pc));      // go out of cycles
1785      }
1786      else
1787      {
1788         UML_HASHJMP(block, IMM(0), IMM(desc->pc), sh2->nocode);
1789      }
1790
1791      return TRUE;
1792      break;
1793
1794   case 0x22: // STCVBR(Rn);
1795      UML_MOV(block, R32(Rn), MEM(&sh2->vbr));      // mov Rn, vbr
1796      return TRUE;
1797      break;
1798
1799   case 0x23: // BRAF(Rn);    0x40 + 9054 = 9098
1800      UML_ADD(block, MEM(&sh2->target), R32(Rn), IMM(desc->pc+4));   // add target, Rn, pc+4
1801
1802      generate_delay_slot(block, compiler, desc);
1803
1804      generate_update_cycles(block, compiler, MEM(&sh2->target), TRUE);   // <subtract cycles>
1805      UML_HASHJMP(block, IMM(0), MEM(&sh2->target), sh2->nocode);   // jmp target
1806      break;
1807
1808   case 0x28: // CLRMAC();
1809      UML_MOV(block, MEM(&sh2->macl), IMM(0));      // mov macl, #0
1810      UML_MOV(block, MEM(&sh2->mach), IMM(0));      // mov mach, #0
1811      return TRUE;
1812      break;
1813
1814   case 0x29: // MOVT(Rn);
1815      UML_AND(block, R32(Rn), MEM(&sh2->sr), IMM(T));      // and Rn, sr, T
1816      return TRUE;
1817      break;
1818
1819   case 0x2a: // STSPR(Rn);
1820      UML_MOV(block, R32(Rn), MEM(&sh2->pr));         // mov Rn, pr
1821      return TRUE;
1822      break;
1823
1824   case 0x2b: // RTE();
1825      generate_delay_slot(block, compiler, desc);
1826
1827      UML_MOV(block, IREG(0), R32(15));         // mov r0, R15
1828      UML_CALLH(block, sh2->read32);            // call read32
1829      UML_MOV(block, MEM(&sh2->pc), IREG(0));         // mov pc, r0
1830      UML_ADD(block, R32(15), R32(15), IMM(4));      // add R15, R15, #4
1831
1832      UML_MOV(block, IREG(0), R32(15));         // mov r0, R15
1833      UML_CALLH(block, sh2->read32);            // call read32
1834      UML_MOV(block, MEM(&sh2->sr), IREG(0));         // mov sr, r0
1835      UML_ADD(block, R32(15), R32(15), IMM(4));      // add R15, R15, #4
1836
1837      compiler->checkints = TRUE;
1838      UML_MOV(block, MEM(&sh2->ea), MEM(&sh2->pc));      // mov ea, pc
1839      generate_update_cycles(block, compiler, MEM(&sh2->ea), TRUE);   // <subtract cycles>
1840      UML_HASHJMP(block, IMM(0), MEM(&sh2->pc), sh2->nocode);   // and jump to the "resume PC"
1841
1842      return TRUE;
1843      break;
1844   }
1845
1846   return FALSE;
1847}
1848
1849static int generate_group_2(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot)
1850{
1851   switch (opcode & 15)
1852   {
1853   case  0: // MOVBS(Rm, Rn);
1854      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
1855      UML_MOV(block, IREG(1), R32(Rm));      // mov r1, Rm
1856      UML_AND(block, IREG(1), IREG(1), IMM(0xff));   // and r1, r1, 0xff
1857      UML_CALLH(block, sh2->write8);
1858
1859      if (!in_delay_slot)
1860         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
1861      return TRUE;
1862      break;
1863
1864   case  1: // MOVWS(Rm, Rn);
1865      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
1866      UML_MOV(block, IREG(1), R32(Rm));      // mov r1, Rm
1867      UML_AND(block, IREG(1), IREG(1), IMM(0xffff));   // and r1, r1, 0xffff
1868      UML_CALLH(block, sh2->write16);
1869
1870      if (!in_delay_slot)
1871         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
1872      return TRUE;
1873      break;
1874
1875   case  2: // MOVLS(Rm, Rn);
1876      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
1877      UML_MOV(block, IREG(1), R32(Rm));      // mov r1, Rm
1878      UML_CALLH(block, sh2->write32);
1879
1880      if (!in_delay_slot)
1881         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
1882      return TRUE;
1883      break;
1884
1885   case  3: // NOP();
1886      return TRUE;
1887      break;
1888
1889   case  4: // MOVBM(Rm, Rn);
1890      UML_MOV(block, IREG(1), R32(Rm));      // mov r1, Rm
1891      UML_SUB(block, R32(Rn), R32(Rn), IMM(1));      // sub Rn, Rn, 1
1892      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
1893      UML_CALLH(block, sh2->write8);         // call write8
1894
1895      if (!in_delay_slot)
1896         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
1897      return TRUE;
1898      break;
1899
1900   case  5: // MOVWM(Rm, Rn);
1901      UML_MOV(block, IREG(1), R32(Rm));      // mov r1, Rm
1902      UML_SUB(block, R32(Rn), R32(Rn), IMM(2));   // sub Rn, Rn, 2
1903      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
1904      UML_CALLH(block, sh2->write16);         // call write16
1905
1906      if (!in_delay_slot)
1907         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
1908      return TRUE;
1909      break;
1910
1911   case  6: // MOVLM(Rm, Rn);
1912      UML_MOV(block, IREG(1), R32(Rm));      // mov r1, Rm
1913      UML_SUB(block, R32(Rn), R32(Rn), IMM(4));   // sub Rn, Rn, 4
1914      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
1915      UML_CALLH(block, sh2->write32);         // call write32
1916
1917      if (!in_delay_slot)
1918         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
1919      return TRUE;
1920      break;
1921
1922   case 13: // XTRCT(Rm, Rn);
1923      UML_SHL(block, IREG(0), R32(Rm), IMM(16));      // shl r0, Rm, #16
1924      UML_AND(block, IREG(0), IREG(0), IMM(0xffff0000));   // and r0, r0, #0xffff0000
1925
1926      UML_SHR(block, IREG(1), R32(Rn), IMM(16));      // shr, r1, Rn, #16
1927      UML_AND(block, IREG(1), IREG(1), IMM(0xffff));      // and r1, r1, #0x0000ffff
1928
1929      UML_OR(block, R32(Rn), IREG(0), IREG(1));      // or Rn, r0, r1
1930      return TRUE;
1931      break;
1932
1933   case  7: // DIV0S(Rm, Rn);
1934      UML_MOV(block, IREG(0), MEM(&sh2->sr));            // move r0, sr
1935      UML_AND(block, IREG(0), IREG(0), IMM(~(Q|M|T)));      // and r0, r0, ~(Q|M|T) (clear the Q,M, and T bits)
1936
1937      UML_TEST(block, R32(Rn), IMM(0x80000000));         // test Rn, #0x80000000
1938      UML_JMPc(block, IF_Z, compiler->labelnum);         // jz labelnum
1939
1940      UML_OR(block, IREG(0), IREG(0), IMM(Q));               // or r0, r0, Q
1941      UML_LABEL(block, compiler->labelnum++);            // labelnum:
1942
1943      UML_TEST(block, R32(Rm), IMM(0x80000000));         // test Rm, #0x80000000
1944      UML_JMPc(block, IF_Z, compiler->labelnum);         // jz labelnum
1945
1946      UML_OR(block, IREG(0), IREG(0), IMM(M));                // or r0, r0, M
1947      UML_LABEL(block, compiler->labelnum++);            // labelnum:
1948
1949      UML_XOR(block, IREG(1), R32(Rn), R32(Rm));         // xor r1, Rn, Rm
1950      UML_TEST(block, IREG(1), IMM(0x80000000));         // test r1, #0x80000000
1951      UML_JMPc(block, IF_Z, compiler->labelnum);         // jz labelnum
1952
1953      UML_OR(block, IREG(0), IREG(0), IMM(T));               // or r0, r0, T
1954      UML_LABEL(block, compiler->labelnum++);            // labelnum:
1955      UML_MOV(block, MEM(&sh2->sr), IREG(0));            // mov sr, r0
1956      return TRUE;
1957      break;
1958
1959   case  8: // TST(Rm, Rn);
1960      UML_AND(block, IREG(0), MEM(&sh2->sr), IMM(~T));   // and r0, sr, ~T (clear the T bit)
1961      UML_TEST(block, R32(Rm), R32(Rn));      // test Rm, Rn
1962      UML_JMPc(block, IF_NZ, compiler->labelnum);     // jnz compiler->labelnum
1963
1964      UML_OR(block, IREG(0), IREG(0), IMM(T));   // or r0, r0, T
1965      UML_LABEL(block, compiler->labelnum++);           // desc->pc:
1966
1967      UML_MOV(block, MEM(&sh2->sr), IREG(0));      // mov sh2->sr, r0
1968      return TRUE;
1969      break;
1970
1971   case 12: // CMPSTR(Rm, Rn);
1972      UML_XOR(block, IREG(0), R32(Rn), R32(Rm));   // xor r0, Rn, Rm       (temp)
1973
1974      UML_SHR(block, IREG(1), IREG(0), IMM(24));   // shr r1, r0, #24  (HH)
1975      UML_AND(block, IREG(1), IREG(1), IMM(0xff));   // and r1, r1, #0xff
1976
1977      UML_SHR(block, IREG(2), IREG(0), IMM(16));   // shr r2, r0, #16  (HL)
1978      UML_AND(block, IREG(2), IREG(2), IMM(0xff));   // and r2, r2, #0xff
1979
1980      UML_SHR(block, IREG(3), IREG(0), IMM(8));   // shr r3, r0, #8   (LH)
1981      UML_AND(block, IREG(3), IREG(3), IMM(0xff));   // and r3, r3, #0xff
1982
1983      UML_AND(block, IREG(7), IREG(0), IMM(0xff));   // and r7, r0, #0xff    (LL)
1984
1985      UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T));   // and sr, sr, ~T (clear the T bit)
1986
1987      UML_CMP(block, IREG(1), IMM(0));      // cmp r1, #0
1988      UML_JMPc(block, IF_Z, compiler->labelnum);   // jnz labelnum
1989      UML_CMP(block, IREG(2), IMM(0));      // cmp r2, #0
1990      UML_JMPc(block, IF_Z, compiler->labelnum);   // jnz labelnum
1991      UML_CMP(block, IREG(3), IMM(0));      // cmp r3, #0
1992      UML_JMPc(block, IF_Z, compiler->labelnum);   // jnz labelnum
1993      UML_CMP(block, IREG(7), IMM(0));      // cmp r7, #0
1994      UML_JMPc(block, IF_NZ, compiler->labelnum+1);   // jnz labelnum
1995
1996      UML_LABEL(block, compiler->labelnum++);      // labelnum:
1997      UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(T));   // or sr, sr, T
1998
1999      UML_LABEL(block, compiler->labelnum++);      // labelnum+1:
2000      return TRUE;
2001      break;
2002
2003   case  9: // AND(Rm, Rn);
2004      UML_AND(block, R32(Rn), R32(Rn), R32(Rm));   // and Rn, Rn, Rm
2005      return TRUE;
2006      break;
2007
2008   case 10: // XOR(Rm, Rn);
2009      UML_XOR(block, R32(Rn), R32(Rn), R32(Rm));   // xor Rn, Rn, Rm
2010      return TRUE;
2011      break;
2012
2013   case 11: // OR(Rm, Rn);
2014      UML_OR(block, R32(Rn), R32(Rn), R32(Rm));   // or Rn, Rn, Rm
2015      return TRUE;
2016      break;
2017
2018   case 14: // MULU(Rm, Rn);
2019      UML_AND(block, IREG(0), R32(Rm), IMM(0xffff));            // and r0, Rm, 0xffff
2020      UML_AND(block, IREG(1), R32(Rn), IMM(0xffff));            // and r1, Rn, 0xffff
2021      UML_MULU(block, MEM(&sh2->macl), MEM(&sh2->ea), IREG(0), IREG(1));   // mulu macl, ea, r0, r1
2022      return TRUE;
2023      break;
2024
2025   case 15: // MULS(Rm, Rn);
2026      UML_SEXT(block, IREG(0), R32(Rm), WORD);            // sext r0, Rm
2027      UML_SEXT(block, IREG(1), R32(Rn), WORD);            // sext r1, Rn
2028      UML_MULS(block, MEM(&sh2->macl), MEM(&sh2->ea), IREG(0), IREG(1));   // muls macl, ea, r0, r1
2029      return TRUE;
2030      break;
2031   }
2032
2033   return FALSE;
2034}
2035
2036static int generate_group_3(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode)
2037{
2038   switch (opcode & 15)
2039   {
2040   case  0: // CMPEQ(Rm, Rn); (equality)
2041      UML_CMP(block, R32(Rn), R32(Rm));      // cmp Rn, Rm
2042      UML_SETc(block, IF_E, IREG(0));         // set E, r0
2043      UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(1));   // rolins sr, r0, 0, 1
2044      return TRUE;
2045      break;
2046
2047   case  2: // CMPHS(Rm, Rn); (unsigned greater than or equal)
2048      UML_CMP(block, R32(Rn), R32(Rm));      // cmp Rn, Rm
2049      UML_SETc(block, IF_AE, IREG(0));      // set AE, r0
2050      UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(1));   // rolins sr, r0, 0, 1
2051      return TRUE;
2052      break;
2053
2054   case  3: // CMPGE(Rm, Rn); (signed greater than or equal)
2055      UML_CMP(block, R32(Rn), R32(Rm));      // cmp Rn, Rm
2056      UML_SETc(block, IF_GE, IREG(0));      // set GE, r0
2057      UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(1));   // rolins sr, r0, 0, 1
2058      return TRUE;
2059      break;
2060
2061   case  6: // CMPHI(Rm, Rn); (unsigned greater than)
2062      UML_CMP(block, R32(Rn), R32(Rm));      // cmp Rn, Rm
2063      UML_SETc(block, IF_A, IREG(0));         // set A, r0
2064      UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(1));   // rolins sr, r0, 0, 1
2065      return TRUE;
2066      break;
2067
2068   case  7: // CMPGT(Rm, Rn); (signed greater than)
2069      UML_CMP(block, R32(Rn), R32(Rm));      // cmp Rn, Rm
2070      UML_SETc(block, IF_G, IREG(0));         // set G, r0
2071      UML_ROLINS(block, MEM(&sh2->sr), IREG(0), IMM(0), IMM(1));   // rolins sr, r0, 0, 1
2072      return TRUE;
2073      break;
2074
2075   case  1: // NOP();
2076   case  9: // NOP();
2077      return TRUE;
2078      break;
2079
2080   case  4: // DIV1(Rm, Rn);
2081      save_fast_iregs(block);
2082      UML_CALLC(block, cfunc_DIV1, desc->opptr.w);
2083      load_fast_iregs(block);
2084      return TRUE;
2085      break;
2086
2087   case  5: // DMULU(Rm, Rn);
2088      UML_MULU(block, MEM(&sh2->macl), MEM(&sh2->mach), R32(Rn), R32(Rm));
2089      return TRUE;
2090      break;
2091
2092   case 13: // DMULS(Rm, Rn);
2093      UML_MULS(block, MEM(&sh2->macl), MEM(&sh2->mach), R32(Rn), R32(Rm));
2094      return TRUE;
2095      break;
2096
2097   case  8: // SUB(Rm, Rn);
2098      UML_SUB(block, R32(Rn), R32(Rn), R32(Rm));   // sub Rn, Rn, Rm
2099      return TRUE;
2100      break;
2101
2102   case 12: // ADD(Rm, Rn);
2103      UML_ADD(block, R32(Rn), R32(Rn), R32(Rm));   // add Rn, Rn, Rm
2104      return TRUE;
2105      break;
2106
2107   case 10: // SUBC(Rm, Rn);
2108
2109      UML_MOV(block, IREG(0), MEM(&sh2->sr));      // mov r0, sr (save SR)
2110      UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T));   // and sr, sr, ~T (clear the T bit)
2111      UML_CARRY(block, IREG(0), IMM(0));   // carry = T (T is bit 0 of SR)
2112      UML_SUBB(block, R32(Rn), R32(Rn), R32(Rm));   // subb Rn, Rn, Rm
2113
2114      UML_JMPc(block, IF_NC, compiler->labelnum);   // jnc labelnum
2115
2116      UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(T));   // or sr, sr, T
2117
2118      UML_LABEL(block, compiler->labelnum++);      // labelnum:
2119
2120      return TRUE;
2121      break;
2122
2123   case 11: // SUBV(Rm, Rn);
2124      break;
2125
2126   case 14: // ADDC(Rm, Rn);
2127      UML_MOV(block, IREG(0), MEM(&sh2->sr));      // mov r0, sr (save SR)
2128      UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T));   // and sr, sr, ~T (clear the T bit)
2129      UML_CARRY(block, IREG(0), IMM(0));   // carry = T (T is bit 0 of SR)
2130      UML_ADDC(block, R32(Rn), R32(Rn), R32(Rm));   // addc Rn, Rn, Rm
2131      UML_JMPc(block, IF_NC, compiler->labelnum);   // jnc labelnum
2132
2133      UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(T));   // or sr, sr, T
2134
2135      UML_LABEL(block, compiler->labelnum++);      // labelnum:
2136      return TRUE;
2137      break;
2138
2139   case 15: // ADDV(Rm, Rn);
2140      UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T));   // and sr, sr, ~T (clear the T bit)
2141      UML_ADD(block, R32(Rn), R32(Rn), R32(Rm));      // add Rn, Rn, Rm
2142      UML_JMPc(block, IF_NV, compiler->labelnum);      // jnc labelnum
2143
2144      UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(T));   // or sr, sr, T
2145
2146      UML_LABEL(block, compiler->labelnum++);      // labelnum:
2147      return TRUE;
2148      break;
2149   }
2150   return FALSE;
2151}
2152
2153static int generate_group_4(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot)
2154{
2155   switch (opcode & 0x3F)
2156   {
2157   case 0x00: // SHLL(Rn);
2158      UML_AND(block, IREG(0), MEM(&sh2->sr), IMM(~T));   // and r0, sr, ~T (clear the T bit)
2159      UML_SHR(block, IREG(1), R32(Rn), IMM(31));      // shr r1, Rn, 31
2160      UML_AND(block, IREG(1), IREG(1), IMM(T));      // and r1, r1, T
2161      UML_OR(block, MEM(&sh2->sr), IREG(1), IREG(0));      // or sr, r1, r0
2162      UML_SHL(block, R32(Rn), R32(Rn), IMM(1));      // shl Rn, Rn, 1
2163      return TRUE;
2164      break;
2165
2166   case 0x01: // SHLR(Rn);
2167      UML_AND(block, IREG(0), MEM(&sh2->sr), IMM(~T));   // and r0, sr, ~T (clear the T bit)
2168      UML_AND(block, IREG(1), R32(Rn), IMM(T));      // and r1, Rn, T
2169      UML_OR(block, MEM(&sh2->sr), IREG(0), IREG(1));      // or sr, r0, r1
2170      UML_SHR(block, R32(Rn), R32(Rn), IMM(1));      // shr Rn, Rn, 1
2171      return TRUE;
2172      break;
2173
2174   case 0x04: // ROTL(Rn);
2175      UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T));   // and sr, sr, ~T (clear the T bit)
2176      UML_CARRY(block, R32(Rn), IMM(31));   // carry = high bit of source
2177      UML_ROLC(block, R32(Rn), R32(Rn), IMM(1));   // rolc Rn, Rn, #1
2178
2179      UML_JMPc(block, IF_NC, compiler->labelnum);   // jnc labelnum
2180
2181      UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(T));   // or sr, sr, T
2182
2183      UML_LABEL(block, compiler->labelnum++);      // labelnum:
2184
2185      return TRUE;
2186      break;
2187
2188   case 0x05: // ROTR(Rn);
2189      UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T));   // and sr, sr, ~T (clear the T bit)
2190      UML_CARRY(block, R32(Rn), IMM(0));   // carry = low bit of source
2191      UML_RORC(block, R32(Rn), R32(Rn), IMM(1));   // rorc Rn, Rn, #1
2192
2193      UML_JMPc(block, IF_NC, compiler->labelnum);   // jnc labelnum
2194
2195      UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(T));   // or sr, sr, T
2196
2197      UML_LABEL(block, compiler->labelnum++);      // labelnum:
2198
2199      return TRUE;
2200      break;
2201
2202   case 0x02: // STSMMACH(Rn);
2203      UML_SUB(block, R32(Rn), R32(Rn), IMM(4));   // sub Rn, Rn, #4
2204      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
2205      UML_MOV(block, IREG(1), MEM(&sh2->mach));   // mov r1, mach
2206      SETEA(0);               // set ea for debug
2207      UML_CALLH(block, sh2->write32);         // call write32
2208
2209      if (!in_delay_slot)
2210         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2211      return TRUE;
2212      break;
2213
2214   case 0x03: // STCMSR(Rn);
2215      UML_SUB(block, R32(Rn), R32(Rn), IMM(4));   // sub Rn, Rn, #4
2216      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
2217      UML_MOV(block, IREG(1), MEM(&sh2->sr));      // mov r1, sr
2218      SETEA(0);               // set ea for debug
2219      UML_CALLH(block, sh2->write32);         // call write32
2220
2221      if (!in_delay_slot)
2222         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2223      return TRUE;
2224      break;
2225
2226   case 0x06: // LDSMMACH(Rn);
2227      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
2228      SETEA(0);
2229      UML_CALLH(block, sh2->read32);         // call read32
2230      UML_ADD(block, R32(Rn), R32(Rn), IMM(4));     // add Rn, #4
2231      UML_MOV(block, MEM(&sh2->mach), IREG(0));   // mov mach, r0
2232
2233      if (!in_delay_slot)
2234         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2235      return TRUE;
2236      break;
2237
2238   case 0x07: // LDCMSR(Rn);
2239      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
2240      SETEA(0);
2241      UML_CALLH(block, sh2->read32);         // call read32
2242      UML_ADD(block, R32(Rn), R32(Rn), IMM(4));     // add Rn, #4
2243      UML_MOV(block, MEM(&sh2->sr), IREG(0));      // mov sr, r0
2244
2245      compiler->checkints = TRUE;
2246      if (!in_delay_slot)
2247         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2248      return TRUE;
2249      break;
2250
2251   case 0x08: // SHLL2(Rn);
2252      UML_SHL(block, R32(Rn), R32(Rn), IMM(2));
2253      return TRUE;
2254      break;
2255
2256   case 0x09: // SHLR2(Rn);
2257      UML_SHR(block, R32(Rn), R32(Rn), IMM(2));
2258      return TRUE;
2259      break;
2260
2261   case 0x18: // SHLL8(Rn);
2262      UML_SHL(block, R32(Rn), R32(Rn), IMM(8));
2263      return TRUE;
2264      break;
2265
2266   case 0x19: // SHLR8(Rn);
2267      UML_SHR(block, R32(Rn), R32(Rn), IMM(8));
2268      return TRUE;
2269      break;
2270
2271   case 0x28: // SHLL16(Rn);
2272      UML_SHL(block, R32(Rn), R32(Rn), IMM(16));
2273      return TRUE;
2274      break;
2275
2276   case 0x29: // SHLR16(Rn);
2277      UML_SHR(block, R32(Rn), R32(Rn), IMM(16));
2278      return TRUE;
2279      break;
2280
2281   case 0x0a: // LDSMACH(Rn);
2282      UML_MOV(block, MEM(&sh2->mach), R32(Rn));      // mov mach, Rn
2283      return TRUE;
2284      break;
2285
2286   case 0x0b: // JSR(Rn);
2287      UML_MOV(block, MEM(&sh2->target), R32(Rn));      // mov target, Rn
2288
2289      generate_delay_slot(block, compiler, desc);
2290
2291      UML_ADD(block, MEM(&sh2->pr), IMM(desc->pc), IMM(4));   // add sh2->pr, desc->pc, #4 (skip the current insn & delay slot)
2292
2293      generate_update_cycles(block, compiler, MEM(&sh2->target), TRUE);   // <subtract cycles>
2294      UML_HASHJMP(block, IMM(0), MEM(&sh2->target), sh2->nocode);   // and do the jump
2295      return TRUE;
2296      break;
2297
2298   case 0x0e: // LDCSR(Rn);
2299      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
2300      UML_AND(block, IREG(0), IREG(0), IMM(FLAGS));   // and r0, r0, FLAGS
2301      UML_MOV(block, MEM(&sh2->sr), IREG(0));
2302
2303      compiler->checkints = TRUE;
2304      return TRUE;
2305      break;
2306
2307   case 0x0f: // MAC_W(Rm, Rn);
2308   case 0x1f: // MAC_W(Rm, Rn);
2309   case 0x2f: // MAC_W(Rm, Rn);
2310   case 0x3f: // MAC_W(Rm, Rn);
2311      save_fast_iregs(block);
2312      UML_CALLC(block, cfunc_MAC_W, desc->opptr.w);
2313      load_fast_iregs(block);
2314      return TRUE;
2315      break;
2316
2317   case 0x10: // DT(Rn);
2318      UML_AND(block, IREG(0), MEM(&sh2->sr), IMM(~T));   // and r0, sr, ~T (clear the T bit)
2319      UML_SUB(block, R32(Rn), R32(Rn), IMM(1));   // sub Rn, Rn, 1
2320      UML_JMPc(block, IF_NZ, compiler->labelnum);     // jz compiler->labelnum
2321
2322      UML_OR(block, IREG(0), IREG(0), IMM(T));   // or r0, r0, T
2323      UML_LABEL(block, compiler->labelnum++);           // desc->pc:
2324
2325      UML_MOV(block, MEM(&sh2->sr), IREG(0));      // mov sh2->sr, r0
2326      return TRUE;
2327      break;
2328
2329   case 0x11: // CMPPZ(Rn);
2330      UML_AND(block, IREG(0), MEM(&sh2->sr), IMM(~T));   // and r0, sr, ~T (clear the T bit)
2331
2332      UML_CMP(block, R32(Rn), IMM(0));      // cmp Rn, 0
2333      UML_JMPc(block, IF_S, compiler->labelnum);     // js compiler->labelnum    (if negative)
2334
2335      UML_OR(block, IREG(0), IREG(0), IMM(T));   // or r0, r0, T
2336      UML_LABEL(block, compiler->labelnum++);           // desc->pc:
2337
2338      UML_MOV(block, MEM(&sh2->sr), IREG(0));      // mov sh2->sr, r0
2339      return TRUE;
2340      break;
2341
2342   case 0x15: // CMPPL(Rn);
2343      UML_AND(block, IREG(0), MEM(&sh2->sr), IMM(~T));   // and r0, sr, ~T (clear the T bit)
2344
2345      UML_CMP(block, R32(Rn), IMM(0));      // cmp Rn, 0
2346
2347      UML_JMPc(block, IF_S, compiler->labelnum);     // js compiler->labelnum    (if negative)
2348      UML_JMPc(block, IF_Z, compiler->labelnum);      // jz compiler->labelnum    (if zero)
2349
2350      UML_OR(block, IREG(0), IREG(0), IMM(T));   // or r0, r0, T
2351
2352      UML_LABEL(block, compiler->labelnum++);           // desc->pc:
2353      UML_MOV(block, MEM(&sh2->sr), IREG(0));      // mov sh2->sr, r0
2354      return TRUE;
2355      break;
2356
2357   case 0x12: // STSMMACL(Rn);
2358      UML_SUB(block, R32(Rn), R32(Rn), IMM(4));   // sub Rn, Rn, #4
2359      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
2360      UML_MOV(block, IREG(1), MEM(&sh2->macl));   // mov r1, macl
2361      SETEA(0);               // set ea for debug
2362      UML_CALLH(block, sh2->write32);         // call write32
2363
2364      if (!in_delay_slot)
2365         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2366      return TRUE;
2367      break;
2368
2369   case 0x13: // STCMGBR(Rn);
2370      UML_SUB(block, R32(Rn), R32(Rn), IMM(4));   // sub Rn, Rn, #4
2371      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
2372      UML_MOV(block, IREG(1), MEM(&sh2->gbr));   // mov r1, gbr
2373      SETEA(0);               // set ea for debug
2374      UML_CALLH(block, sh2->write32);         // call write32
2375
2376      if (!in_delay_slot)
2377         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2378      return TRUE;
2379      break;
2380
2381   case 0x16: // LDSMMACL(Rn);
2382      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
2383      SETEA(0);
2384      UML_CALLH(block, sh2->read32);         // call read32
2385      UML_ADD(block, R32(Rn), R32(Rn), IMM(4));     // add Rn, #4
2386      UML_MOV(block, MEM(&sh2->macl), IREG(0));   // mov macl, r0
2387
2388      if (!in_delay_slot)
2389         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2390      return TRUE;
2391      break;
2392
2393   case 0x17: // LDCMGBR(Rn);
2394      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
2395      SETEA(0);
2396      UML_CALLH(block, sh2->read32);         // call read32
2397      UML_ADD(block, R32(Rn), R32(Rn), IMM(4));     // add Rn, #4
2398      UML_MOV(block, MEM(&sh2->gbr), IREG(0));   // mov gbr, r0
2399
2400      if (!in_delay_slot)
2401         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2402      return TRUE;
2403      break;
2404
2405   case 0x1a: // LDSMACL(Rn);
2406      UML_MOV(block, MEM(&sh2->macl), R32(Rn));      // mov macl, Rn
2407      return TRUE;
2408      break;
2409
2410   case 0x1b: // TAS(Rn);
2411      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
2412      SETEA(0);
2413      UML_CALLH(block, sh2->read8);         // call read8
2414
2415      UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T));   // and sr, sr, ~T
2416
2417      UML_CMP(block, IREG(0), IMM(0));      // cmp r0, #0
2418      UML_JMPc(block, IF_NZ, compiler->labelnum);   // jnz labelnum
2419
2420      UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(T));   // or sr, sr, T
2421
2422      UML_LABEL(block, compiler->labelnum++);      // labelnum:
2423
2424      UML_OR(block, IREG(1), IREG(0), IMM(0x80));   // or r1, r0, #0x80
2425
2426      UML_MOV(block, IREG(0), R32(Rn));      // mov r0, Rn
2427      UML_CALLH(block, sh2->write8);         // write the value back
2428
2429      if (!in_delay_slot)
2430         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2431      return TRUE;
2432      break;
2433
2434   case 0x1e: // LDCGBR(Rn);
2435      UML_MOV(block, MEM(&sh2->gbr), R32(Rn));   // mov gbr, Rn
2436      return TRUE;
2437      break;
2438
2439   case 0x20: // SHAL(Rn);
2440      UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T));   // and sr, sr, ~T
2441      UML_SHR(block, IREG(0), R32(Rn), IMM(31));      // shr r0, Rn, 31
2442      UML_AND(block, IREG(0), IREG(0), IMM(T));      // and r0, r0, T
2443      UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IREG(0));   // or sr, sr, r0
2444      UML_SHL(block, R32(Rn), R32(Rn), IMM(1));      // shl Rn, Rn, 1
2445      return TRUE;
2446      break;
2447
2448   case 0x21: // SHAR(Rn);
2449      UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T));   // and sr, sr, ~T
2450      UML_AND(block, IREG(0), R32(Rn), IMM(T));      // and r0, Rn, T
2451      UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IREG(0));   // or sr, sr, r0
2452      UML_SAR(block, R32(Rn), R32(Rn), IMM(1));      // sar Rn, Rn, 1
2453      return TRUE;
2454      break;
2455
2456   case 0x22: // STSMPR(Rn);
2457      UML_SUB(block, R32(Rn), R32(Rn), IMM(4));      // sub Rn, Rn, 4
2458      UML_MOV(block, IREG(0), R32(Rn));         // mov r0, Rn
2459      SETEA(0);
2460      UML_MOV(block, IREG(1), MEM(&sh2->pr));         // mov r1, pr
2461      UML_CALLH(block, sh2->write32);            // call write32
2462
2463      if (!in_delay_slot)
2464         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2465      return TRUE;
2466      break;
2467
2468   case 0x23: // STCMVBR(Rn);
2469      UML_SUB(block, R32(Rn), R32(Rn), IMM(4));      // sub Rn, Rn, 4
2470      UML_MOV(block, IREG(0), R32(Rn));         // mov r0, Rn
2471      SETEA(0);
2472      UML_MOV(block, IREG(1), MEM(&sh2->vbr));       // mov r1, vbr
2473      UML_CALLH(block, sh2->write32);            // call write32
2474
2475      if (!in_delay_slot)
2476         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2477      return TRUE;
2478      break;
2479
2480   case 0x24: // ROTCL(Rn);
2481      UML_SHR(block, IREG(0), R32(Rn), IMM(31));      // shr r0, Rn, 31
2482      UML_AND(block, IREG(0), IREG(0), IMM(T));      // and r0, r0, T
2483
2484      UML_AND(block, IREG(1), MEM(&sh2->sr), IMM(T));      // and r1, sr, T
2485
2486      UML_SHL(block, R32(Rn), R32(Rn), IMM(1));      // shl Rn, Rn, 1
2487      UML_OR(block, R32(Rn), R32(Rn), IREG(1));      // or Rn, Rn, r1
2488
2489      UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T));   // and sr, sr, ~T
2490      UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IREG(0));   // or sr, sr, r0
2491      return TRUE;
2492      break;
2493
2494   case 0x25: // ROTCR(Rn);
2495      UML_AND(block, IREG(0), MEM(&sh2->sr), IMM(T));      // and r0, sr, T
2496      UML_SHL(block, IREG(0), IREG(0), IMM(31));      // shl r0, r0, #31 (r0 = temp)
2497
2498      UML_AND(block, IREG(1), R32(Rn), IMM(T));      // and r1, Rn, T  (r1 = Rn & T)
2499
2500      UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T));   // and sr, sr, ~T
2501
2502      UML_CMP(block, IREG(1), IMM(0));         // cmp r1, #0
2503      UML_JMPc(block, IF_Z, compiler->labelnum);      // jz labelnum
2504
2505      UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(T));   // or sr, sr, T
2506
2507      UML_LABEL(block, compiler->labelnum++);         // labelnum:
2508
2509      UML_SHR(block, R32(Rn), R32(Rn), IMM(1));      // shr Rn, Rn, #1
2510      UML_OR(block, R32(Rn), R32(Rn), IREG(0));      // or Rn, Rn, r0
2511      return TRUE;
2512      break;
2513
2514   case 0x26: // LDSMPR(Rn);
2515      UML_MOV(block, IREG(0), R32(Rn));         // mov r0, Rn
2516      SETEA(0);
2517      UML_CALLH(block, sh2->read32);            // call read32
2518      UML_MOV(block, MEM(&sh2->pr), IREG(0));         // mov sh2->pr, r0
2519      UML_ADD(block, R32(Rn), R32(Rn), IMM(4));      // add Rn, Rn, #4
2520
2521      if (!in_delay_slot)
2522         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2523      return TRUE;
2524      break;
2525
2526   case 0x27: // LDCMVBR(Rn);
2527      UML_MOV(block, IREG(0), R32(Rn));         // mov r0, Rn
2528      SETEA(0);
2529      UML_CALLH(block, sh2->read32);            // call read32
2530      UML_MOV(block, MEM(&sh2->vbr), IREG(0));        // mov sh2->vbr, r0
2531      UML_ADD(block, R32(Rn), R32(Rn), IMM(4));      // add Rn, Rn, #4
2532
2533      if (!in_delay_slot)
2534         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2535      return TRUE;
2536      break;
2537
2538   case 0x2a: // LDSPR(Rn);
2539      UML_MOV(block, MEM(&sh2->pr), R32(Rn));         // mov sh2->pr, Rn
2540      return TRUE;
2541      break;
2542
2543   case 0x2b: // JMP(Rn);
2544      UML_MOV(block, MEM(&sh2->target), R32(Rn));      // mov target, Rn
2545
2546      generate_delay_slot(block, compiler, desc);
2547
2548      generate_update_cycles(block, compiler, MEM(&sh2->target), TRUE);   // <subtract cycles>
2549      UML_HASHJMP(block, IMM(0), MEM(&sh2->target), sh2->nocode);   // jmp (target)
2550      return TRUE;
2551      break;
2552
2553   case 0x2e: // LDCVBR(Rn);
2554      UML_MOV(block, MEM(&sh2->vbr), R32(Rn));      //  mov vbr, Rn
2555      return TRUE;
2556      break;
2557
2558   case 0x0c: // NOP();
2559   case 0x0d: // NOP();
2560   case 0x14: // NOP();
2561   case 0x1c: // NOP();
2562   case 0x1d: // NOP();
2563   case 0x2c: // NOP();
2564   case 0x2d: // NOP();
2565   case 0x30: // NOP();
2566   case 0x31: // NOP();
2567   case 0x32: // NOP();
2568   case 0x33: // NOP();
2569   case 0x34: // NOP();
2570   case 0x35: // NOP();
2571   case 0x36: // NOP();
2572   case 0x37: // NOP();
2573   case 0x38: // NOP();
2574   case 0x39: // NOP();
2575   case 0x3a: // NOP();
2576   case 0x3b: // NOP();
2577   case 0x3c: // NOP();
2578   case 0x3d: // NOP();
2579   case 0x3e: // NOP();
2580      return TRUE;
2581      break;
2582
2583   }
2584
2585   return FALSE;
2586}
2587
2588static int generate_group_6(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot)
2589{
2590   switch (opcode & 15)
2591   {
2592   case  0: // MOVBL(Rm, Rn);
2593      UML_MOV(block, IREG(0), R32(Rm));      // mov r0, Rm
2594      SETEA(0);               // debug: ea = r0
2595      UML_CALLH(block, sh2->read8);         // call read8
2596      UML_SEXT(block, R32(Rn), IREG(0), BYTE);   // sext Rn, r0, BYTE
2597
2598      if (!in_delay_slot)
2599         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2600      return TRUE;
2601      break;
2602
2603   case  1: // MOVWL(Rm, Rn);
2604      UML_MOV(block, IREG(0), R32(Rm));      // mov r0, Rm
2605      SETEA(0);               // debug: ea = r0
2606      UML_CALLH(block, sh2->read16);         // call read16
2607      UML_SEXT(block, R32(Rn), IREG(0), WORD);   // sext Rn, r0, WORD
2608
2609      if (!in_delay_slot)
2610         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2611      return TRUE;
2612      break;
2613
2614   case  2: // MOVLL(Rm, Rn);
2615      UML_MOV(block, IREG(0), R32(Rm));      // mov r0, Rm
2616      SETEA(0);               // debug: ea = r0
2617      UML_CALLH(block, sh2->read32);         // call read32
2618      UML_MOV(block, R32(Rn), IREG(0));      // mov Rn, r0
2619
2620      if (!in_delay_slot)
2621         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2622      return TRUE;
2623      break;
2624
2625   case  3: // MOV(Rm, Rn);
2626      UML_MOV(block, R32(Rn), R32(Rm));      // mov Rn, Rm
2627      return TRUE;
2628      break;
2629
2630   case  7: // NOT(Rm, Rn);
2631      UML_XOR(block, R32(Rn), R32(Rm), IMM(0xffffffff));   // xor Rn, Rm, 0xffffffff
2632      return TRUE;
2633      break;
2634
2635   case  9: // SWAPW(Rm, Rn);
2636      UML_ROL(block, R32(Rn), R32(Rm), IMM(16));   // rol Rn, Rm, 16
2637      return TRUE;
2638      break;
2639
2640   case 11: // NEG(Rm, Rn);
2641      UML_SUB(block, R32(Rn), IMM(0), R32(Rm));   // sub Rn, 0, Rm
2642      return TRUE;
2643      break;
2644
2645   case 12: // EXTUB(Rm, Rn);
2646      UML_AND(block, R32(Rn), R32(Rm), IMM(0x000000ff));   // and Rn, Rm, 0xff
2647      return TRUE;
2648      break;
2649
2650   case 13: // EXTUW(Rm, Rn);
2651      UML_AND(block, R32(Rn), R32(Rm), IMM(0x0000ffff));   // and Rn, Rm, 0xffff
2652      return TRUE;
2653      break;
2654
2655   case 14: // EXTSB(Rm, Rn);
2656      UML_SEXT(block, R32(Rn), R32(Rm), BYTE);      // sext Rn, Rm, BYTE
2657      return TRUE;
2658      break;
2659
2660   case 15: // EXTSW(Rm, Rn);
2661      UML_SEXT(block, R32(Rn), R32(Rm), WORD);      // sext Rn, Rm, WORD
2662      return TRUE;
2663      break;
2664
2665   case  4: // MOVBP(Rm, Rn);
2666      UML_MOV(block, IREG(0), R32(Rm));      // mov r0, Rm
2667      UML_CALLH(block, sh2->read8);         // call read8
2668      UML_SEXT(block, R32(Rn), IREG(0), BYTE);        // sext Rn, r0, BYTE
2669
2670      UML_CMP(block, IMM(Rn), IMM(Rm));      // cmp N, M
2671      UML_JMPc(block, IF_Z, compiler->labelnum);       // jz compiler->labelnum
2672
2673      UML_ADD(block, R32(Rm), R32(Rm), IMM(1));   // add Rm, Rm, #1
2674
2675      UML_LABEL(block, compiler->labelnum++);            // labelnum:
2676
2677      if (!in_delay_slot)
2678         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2679      return TRUE;
2680      break;
2681
2682   case  5: // MOVWP(Rm, Rn);
2683      UML_MOV(block, IREG(0), R32(Rm));      // mov r0, Rm
2684      UML_CALLH(block, sh2->read16);         // call read16
2685      UML_SEXT(block, R32(Rn), IREG(0), WORD);        // sext Rn, r0, WORD
2686
2687      UML_CMP(block, IMM(Rn), IMM(Rm));      // cmp N, M
2688      UML_JMPc(block, IF_Z, compiler->labelnum);       // jz compiler->labelnum
2689
2690      UML_ADD(block, R32(Rm), R32(Rm), IMM(2));   // add Rm, Rm, #2
2691
2692      UML_LABEL(block, compiler->labelnum++);            // labelnum:
2693
2694      if (!in_delay_slot)
2695         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2696      return TRUE;
2697      break;
2698
2699   case  6: // MOVLP(Rm, Rn);
2700      UML_MOV(block, IREG(0), R32(Rm));      // mov r0, Rm
2701      UML_CALLH(block, sh2->read32);         // call read32
2702      UML_MOV(block, R32(Rn), IREG(0));      // mov Rn, r0
2703
2704      UML_CMP(block, IMM(Rn), IMM(Rm));      // cmp N, M
2705      UML_JMPc(block, IF_Z, compiler->labelnum);    // jz compiler->labelnum
2706
2707      UML_ADD(block, R32(Rm), R32(Rm), IMM(4));   // add Rm, Rm, #4
2708
2709      UML_LABEL(block, compiler->labelnum++);      // labelnum:
2710
2711      if (!in_delay_slot)
2712         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2713      return TRUE;
2714      break;
2715
2716   case  8: // SWAPB(Rm, Rn);
2717      UML_AND(block, IREG(0), R32(Rm), IMM(0xffff0000));   // and r0, Rm, #0xffff0000
2718      UML_AND(block, IREG(1), R32(Rm), IMM(0x000000ff));   // and r0, Rm, #0x000000ff
2719      UML_AND(block, IREG(2), R32(Rm), IMM(0x0000ff00));   // and r0, Rm, #0x0000ff00
2720      UML_SHL(block, IREG(1), IREG(1), IMM(8));      // shl r1, r1, #8
2721      UML_SHR(block, IREG(2), IREG(2), IMM(8));      // shr r2, r2, #8
2722      UML_OR(block, IREG(0), IREG(0), IREG(1));      // or r0, r0, r1
2723      UML_OR(block, R32(Rn), IREG(0), IREG(2));      // or Rn, r0, r2
2724      return TRUE;
2725      break;
2726
2727   case 10: // NEGC(Rm, Rn);
2728      UML_MOV(block, IREG(0), MEM(&sh2->sr));      // mov r0, sr (save SR)
2729      UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T));   // and sr, sr, ~T (clear the T bit)
2730      UML_CARRY(block, IREG(0), IMM(0));   // carry = T (T is bit 0 of SR)
2731      UML_SUBB(block, R32(Rn), IMM(0), R32(Rm));   // subb Rn, #0, Rm
2732
2733      UML_JMPc(block, IF_NC, compiler->labelnum);   // jnc labelnum
2734
2735      UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(T));   // or sr, sr, T
2736
2737      UML_LABEL(block, compiler->labelnum++);      // labelnum:
2738
2739      return TRUE;
2740      break;
2741   }
2742
2743   return FALSE;
2744}
2745
2746static int generate_group_8(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot)
2747{
2748   INT32 disp;
2749   UINT32 udisp;
2750   drcuml_codelabel templabel;
2751
2752   switch ( opcode  & (15<<8) )
2753   {
2754   case  0 << 8: // MOVBS4(opcode & 0x0f, Rm);
2755      udisp = (opcode & 0x0f);
2756      UML_ADD(block, IREG(0), R32(Rm), IMM(udisp));      // add r0, Rm, udisp
2757      UML_MOV(block, IREG(1), R32(0));         // mov r1, R0
2758      UML_CALLH(block, sh2->write8);            // call write8
2759
2760      if (!in_delay_slot)
2761         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2762      return TRUE;
2763      break;
2764
2765   case  1 << 8: // MOVWS4(opcode & 0x0f, Rm);
2766      udisp = (opcode & 0x0f) * 2;
2767      UML_ADD(block, IREG(0), R32(Rm), IMM(udisp));      // add r0, Rm, udisp
2768      UML_MOV(block, IREG(1), R32(0));         // mov r1, R0
2769      UML_CALLH(block, sh2->write16);            // call write16
2770
2771      if (!in_delay_slot)
2772         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2773      return TRUE;
2774      break;
2775
2776   case  2<< 8: // NOP();
2777   case  3<< 8: // NOP();
2778   case  6<< 8: // NOP();
2779   case  7<< 8: // NOP();
2780   case 10<< 8: // NOP();
2781   case 12<< 8: // NOP();
2782   case 14<< 8: // NOP();
2783      return TRUE;
2784      break;
2785
2786   case  4<< 8: // MOVBL4(Rm, opcode & 0x0f);
2787      udisp = opcode & 0x0f;
2788      UML_ADD(block, IREG(0), R32(Rm), IMM(udisp));      // add r0, Rm, udisp
2789      SETEA(0);
2790      UML_CALLH(block, sh2->read8);            // call read8
2791      UML_SEXT(block, R32(0), IREG(0), BYTE);         // sext R0, r0, BYTE
2792
2793      if (!in_delay_slot)
2794         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2795      return TRUE;
2796      break;
2797
2798   case  5<< 8: // MOVWL4(Rm, opcode & 0x0f);
2799      udisp = (opcode & 0x0f)*2;
2800      UML_ADD(block, IREG(0), R32(Rm), IMM(udisp));      // add r0, Rm, udisp
2801      SETEA(0);
2802      UML_CALLH(block, sh2->read16);            // call read16
2803      UML_SEXT(block, R32(0), IREG(0), WORD);         // sext R0, r0, WORD
2804
2805      if (!in_delay_slot)
2806         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2807      return TRUE;
2808      break;
2809
2810   case  8<< 8: // CMPIM(opcode & 0xff);
2811      UML_AND(block, IREG(0), MEM(&sh2->sr), IMM(~T));   // and r0, sr, ~T (clear the T bit)
2812
2813      UML_SEXT(block, IREG(1), IMM(opcode&0xff), BYTE);   // sext r1, opcode&0xff, BYTE
2814      UML_CMP(block, IREG(1), R32(0));         // cmp r1, R0
2815      UML_JMPc(block, IF_NZ, compiler->labelnum);     // jnz compiler->labelnum   (if negative)
2816
2817      UML_OR(block, IREG(0), IREG(0), IMM(T));   // or r0, r0, T
2818
2819      UML_LABEL(block, compiler->labelnum++);           // labelnum:
2820      UML_MOV(block, MEM(&sh2->sr), IREG(0));      // mov sh2->sr, r0
2821      return TRUE;
2822      break;
2823
2824   case  9<< 8: // BT(opcode & 0xff);
2825      UML_TEST(block, MEM(&sh2->sr), IMM(T));      // test sh2->sr, T
2826      UML_JMPc(block, IF_Z, compiler->labelnum);      // jz compiler->labelnum
2827
2828      disp = ((INT32)opcode << 24) >> 24;
2829      sh2->ea = (desc->pc + 2) + disp * 2 + 2;     // sh2->ea = destination
2830
2831      generate_update_cycles(block, compiler, IMM(sh2->ea), TRUE);   // <subtract cycles>
2832      UML_HASHJMP(block, IMM(0), IMM(sh2->ea), sh2->nocode);   // jmp sh2->ea
2833
2834      UML_LABEL(block, compiler->labelnum++);           // labelnum:
2835      return TRUE;
2836      break;
2837
2838   case 11<< 8: // BF(opcode & 0xff);
2839      UML_TEST(block, MEM(&sh2->sr), IMM(T));      // test sh2->sr, T
2840      UML_JMPc(block, IF_NZ, compiler->labelnum);     // jnz compiler->labelnum
2841
2842      disp = ((INT32)opcode << 24) >> 24;
2843      sh2->ea = (desc->pc + 2) + disp * 2 + 2;        // sh2->ea = destination
2844
2845      generate_update_cycles(block, compiler, IMM(sh2->ea), TRUE);   // <subtract cycles>
2846      UML_HASHJMP(block, IMM(0), IMM(sh2->ea), sh2->nocode);   // jmp sh2->ea
2847
2848      UML_LABEL(block, compiler->labelnum++);           // labelnum:
2849      return TRUE;
2850      break;
2851
2852   case 13<< 8: // BTS(opcode & 0xff);
2853      UML_TEST(block, MEM(&sh2->sr), IMM(T));      // test sh2->sr, T
2854      UML_JMPc(block, IF_Z, compiler->labelnum);     // jz compiler->labelnum
2855
2856      templabel = compiler->labelnum;         // save our label
2857      compiler->labelnum++;            // make sure the delay slot doesn't use it
2858      generate_delay_slot(block, compiler, desc);
2859
2860      disp = ((INT32)opcode << 24) >> 24;
2861      sh2->ea = (desc->pc + 2) + disp * 2 + 2;        // sh2->ea = destination
2862
2863      generate_update_cycles(block, compiler, IMM(sh2->ea), TRUE);   // <subtract cycles>
2864      UML_HASHJMP(block, IMM(0), IMM(sh2->ea), sh2->nocode);   // jmp sh2->ea
2865
2866      UML_LABEL(block, templabel);           // labelnum:
2867      return TRUE;
2868      break;
2869
2870   case 15<< 8: // BFS(opcode & 0xff);
2871      UML_TEST(block, MEM(&sh2->sr), IMM(T));      // test sh2->sr, T
2872      UML_JMPc(block, IF_NZ, compiler->labelnum);     // jnz compiler->labelnum
2873
2874      templabel = compiler->labelnum;         // save our label
2875      compiler->labelnum++;            // make sure the delay slot doesn't use it
2876      generate_delay_slot(block, compiler, desc);   // delay slot only if the branch is taken
2877
2878      disp = ((INT32)opcode << 24) >> 24;
2879      sh2->ea = (desc->pc + 2) + disp * 2 + 2;        // sh2->ea = destination
2880
2881      generate_update_cycles(block, compiler, IMM(sh2->ea), TRUE);   // <subtract cycles>
2882      UML_HASHJMP(block, IMM(0), IMM(sh2->ea), sh2->nocode);   // jmp sh2->ea
2883
2884      UML_LABEL(block, templabel);           // labelnum:
2885      return TRUE;
2886      break;
2887   }
2888
2889   return FALSE;
2890}
2891
2892static int generate_group_12(drcuml_block *block, compiler_state *compiler, const opcode_desc *desc, UINT16 opcode, int in_delay_slot)
2893{
2894   UINT32 scratch;
2895
2896   switch (opcode & (15<<8))
2897   {
2898   case  0<<8: // MOVBSG(opcode & 0xff);
2899      scratch = (opcode & 0xff);
2900      UML_ADD(block, IREG(0), MEM(&sh2->gbr), IMM(scratch));   // add r0, gbr, scratch
2901      UML_AND(block, IREG(1), R32(0), IMM(0xff));      // and r1, R0, 0xff
2902      UML_CALLH(block, sh2->write8);            // call write8
2903
2904      if (!in_delay_slot)
2905         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2906      return TRUE;
2907      break;
2908
2909   case  1<<8: // MOVWSG(opcode & 0xff);
2910      scratch = (opcode & 0xff) * 2;
2911      UML_ADD(block, IREG(0), MEM(&sh2->gbr), IMM(scratch));   // add r0, gbr, scratch
2912      UML_AND(block, IREG(1), R32(0), IMM(0xffff));      // and r1, R0, 0xffff
2913      UML_CALLH(block, sh2->write16);            // call write16
2914
2915      if (!in_delay_slot)
2916         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2917      return TRUE;
2918      break;
2919
2920   case  2<<8: // MOVLSG(opcode & 0xff);
2921      scratch = (opcode & 0xff) * 4;
2922      UML_ADD(block, IREG(0), MEM(&sh2->gbr), IMM(scratch));   // add r0, gbr, scratch
2923      UML_MOV(block, IREG(1), R32(0));         // mov r1, R0
2924      UML_CALLH(block, sh2->write32);            // call write32
2925
2926      if (!in_delay_slot)
2927         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2928      return TRUE;
2929      break;
2930
2931   case  3<<8: // TRAPA(opcode & 0xff);
2932      scratch = (opcode & 0xff) * 4;
2933      UML_ADD(block, MEM(&sh2->ea), MEM(&sh2->vbr), IMM(scratch));   // add ea, vbr, scratch
2934
2935      UML_SUB(block, R32(15), R32(15), IMM(4));         // sub R15, R15, #4
2936      UML_MOV(block, IREG(0), R32(15));            // mov r0, R15
2937      UML_MOV(block, IREG(1), MEM(&sh2->sr));            // mov r1, sr
2938      UML_CALLH(block, sh2->write32);               // write32
2939
2940      UML_SUB(block, R32(15), R32(15), IMM(4));         // sub R15, R15, #4
2941      UML_MOV(block, IREG(0), R32(15));            // mov r0, R15
2942      UML_MOV(block, IREG(1), IMM(desc->pc+2));              // mov r1, pc+2
2943      UML_CALLH(block, sh2->write32);               // write32
2944
2945      UML_MOV(block, IREG(0), MEM(&sh2->ea));            // mov r0, ea
2946      UML_CALLH(block, sh2->read32);               // read32
2947      UML_HASHJMP(block, IMM(0), IREG(0), sh2->nocode);      // jmp (r0)
2948
2949      return TRUE;
2950      break;
2951
2952   case  4<<8: // MOVBLG(opcode & 0xff);
2953      scratch = (opcode & 0xff);
2954      UML_ADD(block, IREG(0), MEM(&sh2->gbr), IMM(scratch));   // add r0, gbr, scratch
2955      UML_CALLH(block, sh2->read8);            // call read16
2956      UML_SEXT(block, R32(0), IREG(0), BYTE);         // sext R0, r0, BYTE
2957
2958      if (!in_delay_slot)
2959         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2960      return TRUE;
2961      break;
2962
2963   case  5<<8: // MOVWLG(opcode & 0xff);
2964      scratch = (opcode & 0xff) * 2;
2965      UML_ADD(block, IREG(0), MEM(&sh2->gbr), IMM(scratch));   // add r0, gbr, scratch
2966      UML_CALLH(block, sh2->read16);            // call read16
2967      UML_SEXT(block, R32(0), IREG(0), WORD);         // sext R0, r0, WORD
2968
2969      if (!in_delay_slot)
2970         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2971      return TRUE;
2972      break;
2973
2974   case  6<<8: // MOVLLG(opcode & 0xff);
2975      scratch = (opcode & 0xff) * 4;
2976      UML_ADD(block, IREG(0), MEM(&sh2->gbr), IMM(scratch));   // add r0, gbr, scratch
2977      UML_CALLH(block, sh2->read32);            // call read32
2978      UML_MOV(block, R32(0), IREG(0));         // mov R0, r0
2979
2980      if (!in_delay_slot)
2981         generate_update_cycles(block, compiler, IMM(desc->pc + 2), TRUE);
2982      return TRUE;
2983      break;
2984
2985   case  7<<8: // MOVA(opcode & 0xff);
2986      scratch = (opcode & 0xff) * 4;
2987      scratch += ((desc->pc + 4) & ~3);
2988
2989      UML_MOV(block, R32(0), IMM(scratch));         // mov R0, scratch
2990      return TRUE;
2991      break;
2992
2993   case  8<<8: // TSTI(opcode & 0xff);
2994      scratch = opcode & 0xff;
2995
2996      UML_AND(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(~T));   // and sr, sr, ~T (clear the T bit)
2997      UML_AND(block, IREG(0), R32(0), IMM(scratch));      // and r0, R0, scratch
2998      UML_CMP(block, IREG(0), IMM(0));         // cmp r0, #0
2999      UML_JMPc(block, IF_NZ, compiler->labelnum);      // jnz labelnum
3000
3001      UML_OR(block, MEM(&sh2->sr), MEM(&sh2->sr), IMM(T));   // or sr, sr, T
3002
3003      UML_LABEL(block, compiler->labelnum++);         // labelnum:
3004      return TRUE;
3005      break;
3006
3007   case  9<<8: // ANDI(opcode & 0xff);
3008      UML_AND(block, R32(0), R32(0), IMM(opcode & 0xff));   // and r0, r0, opcode & 0xff
3009      return TRUE;
3010      break;
3011
3012   case 10<<8: // XORI(opcode & 0xff);
3013      UML_XOR(block, R32(0), R32(0), IMM(opcode & 0xff));   // xor r0, r0, opcode & 0xff
3014      return TRUE;
3015      break;
3016
3017   case 11<<8: // ORI(opcode & 0xff);
3018      UML_OR(block, R32(0), R32(0), IMM(opcode & 0xff));   // or r0, r0, opcode & 0xff
3019      return TRUE;
3020      break;
3021
3022   case 12<<8: // TSTM(opcode & 0xff);
3023   case 13<<8: // ANDM(opcode & 0xff);
3024   case 14<<8: // XORM(opcode & 0xff);
3025      break;
3026
3027   case 15<<8: // ORM(opcode & 0xff);
3028      UML_ADD(block, IREG(0), R32(0), MEM(&sh2->gbr));   // add r0, R0, gbr
3029      UML_CALLH(block, sh2->read8);            // read8
3030
3031      UML_OR(block, IREG(1), IREG(0), IMM(opcode&0xff));   // or r1, r0, #opcode&0xff
3032      UML_ADD(block, IREG(0), R32(0), MEM(&sh2->gbr));   // add r0, R0, gbr
3033      SETEA(0);
3034      UML_CALLH(block, sh2->write8);            // write8
3035      return TRUE;
3036      break;
3037   }
3038
3039   return FALSE;
3040}
3041
3042/***************************************************************************
3043    CORE CALLBACKS
3044***************************************************************************/
3045
3046/*-------------------------------------------------
3047    sh2_get_context - return a copy of the
3048    current context
3049-------------------------------------------------*/
3050
3051static void sh2_get_context(void *dst)
3052{
3053   if( dst )
3054      *(SH2 **)dst = sh2;
3055}
3056
3057/*-------------------------------------------------
3058    sh2_set_context - copy the current context
3059    into the global state
3060-------------------------------------------------*/
3061
3062static void sh2_set_context(void *src)
3063{
3064   if( src )
3065      sh2 = *(SH2 **)src;
3066}
3067
3068/*-------------------------------------------------
3069    sh2_dasm - disassemble an instruction
3070-------------------------------------------------*/
3071
3072static offs_t sh2_dasm(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram)
3073{
3074   return DasmSH2( buffer, pc, (oprom[0] << 8) | oprom[1] );
3075}
3076
3077/*-------------------------------------------------
3078    sh2_internal_a5 - read handler for
3079    SH2 internal map
3080-------------------------------------------------*/
3081
3082static READ32_HANDLER(sh2_internal_a5)
3083{
3084   return 0xa5a5a5a5;
3085}
3086
3087
3088/*-------------------------------------------------
3089    sh2_internal_map - maps SH2 built-ins
3090-------------------------------------------------*/
3091
3092static ADDRESS_MAP_START( sh2_internal_map, ADDRESS_SPACE_PROGRAM, 32 )
3093   AM_RANGE(0x40000000, 0xbfffffff) AM_READ(sh2_internal_a5)
3094   AM_RANGE(0xe0000000, 0xffffffff) AM_READWRITE(sh2_internal_r, sh2_internal_w)
3095ADDRESS_MAP_END
3096
3097/*-------------------------------------------------
3098    sh2_set_info - set information about a given
3099    CPU instance
3100-------------------------------------------------*/
3101
3102static void sh2_set_info(UINT32 state, cpuinfo *info)
3103{
3104   switch (state)
3105   {
3106      /* --- the following bits of info are set as 64-bit signed integers --- */
3107      case CPUINFO_INT_SH2_DRC_OPTIONS:      sh2->drcoptions = info->i;            break;
3108
3109      case CPUINFO_INT_SH2_PCFLUSH_SELECT:      sh2->pcfsel = info->i;   if (sh2->pcfsel > sh2->maxpcfsel) sh2->maxpcfsel = sh2->pcfsel;   break;
3110      case CPUINFO_INT_SH2_PCFLUSH_ADDR:      sh2->pcflushes[sh2->pcfsel] = info->i;      break;
3111
3112      case CPUINFO_INT_INPUT_STATE + SH2_INT_VBLIN:   sh2_set_irq_line(SH2_INT_VBLIN, info->i);   break;
3113      case CPUINFO_INT_INPUT_STATE + SH2_INT_VBLOUT:   sh2_set_irq_line(SH2_INT_VBLOUT, info->i);   break;
3114      case CPUINFO_INT_INPUT_STATE + SH2_INT_HBLIN:   sh2_set_irq_line(SH2_INT_HBLIN, info->i);   break;
3115      case CPUINFO_INT_INPUT_STATE + SH2_INT_TIMER0:   sh2_set_irq_line(SH2_INT_TIMER0, info->i);   break;
3116      case CPUINFO_INT_INPUT_STATE + SH2_INT_TIMER1:   sh2_set_irq_line(SH2_INT_TIMER1, info->i);   break;
3117      case CPUINFO_INT_INPUT_STATE + SH2_INT_DSP:      sh2_set_irq_line(SH2_INT_DSP, info->i);      break;
3118      case CPUINFO_INT_INPUT_STATE + SH2_INT_SOUND:   sh2_set_irq_line(SH2_INT_SOUND, info->i);   break;
3119      case CPUINFO_INT_INPUT_STATE + SH2_INT_SMPC:   sh2_set_irq_line(SH2_INT_SMPC, info->i);   break;
3120      case CPUINFO_INT_INPUT_STATE + SH2_INT_PAD:      sh2_set_irq_line(SH2_INT_PAD, info->i);      break;
3121      case CPUINFO_INT_INPUT_STATE + SH2_INT_DMA2:   sh2_set_irq_line(SH2_INT_DMA2, info->i);   break;
3122      case CPUINFO_INT_INPUT_STATE + SH2_INT_DMA1:   sh2_set_irq_line(SH2_INT_DMA1, info->i);   break;
3123      case CPUINFO_INT_INPUT_STATE + SH2_INT_DMA0:   sh2_set_irq_line(SH2_INT_DMA0, info->i);   break;
3124      case CPUINFO_INT_INPUT_STATE + SH2_INT_DMAILL:   sh2_set_irq_line(SH2_INT_DMAILL, info->i);   break;
3125      case CPUINFO_INT_INPUT_STATE + SH2_INT_SPRITE:   sh2_set_irq_line(SH2_INT_SPRITE, info->i);   break;
3126      case CPUINFO_INT_INPUT_STATE + SH2_INT_14:      sh2_set_irq_line(SH2_INT_14, info->i);      break;
3127      case CPUINFO_INT_INPUT_STATE + SH2_INT_15:      sh2_set_irq_line(SH2_INT_15, info->i);      break;
3128      case CPUINFO_INT_INPUT_STATE + SH2_INT_ABUS:   sh2_set_irq_line(SH2_INT_ABUS, info->i);   break;
3129      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   sh2_set_irq_line(INPUT_LINE_NMI, info->i);   break;
3130
3131      case CPUINFO_INT_REGISTER + SH2_PC:
3132      case CPUINFO_INT_PC:                     sh2->pc = info->i; sh2->delay = 0;      break;
3133      case CPUINFO_INT_SP:                     sh2->r[15] = info->i;                break;
3134      case CPUINFO_INT_REGISTER + SH2_PR:            sh2->pr = info->i;                     break;
3135      case CPUINFO_INT_REGISTER + SH2_SR:            sh2->sr = info->i;                break;
3136      case CPUINFO_INT_REGISTER + SH2_GBR:         sh2->gbr = info->i;                  break;
3137      case CPUINFO_INT_REGISTER + SH2_VBR:         sh2->vbr = info->i;                  break;
3138      case CPUINFO_INT_REGISTER + SH2_MACH:          sh2->mach = info->i;                  break;
3139      case CPUINFO_INT_REGISTER + SH2_MACL:         sh2->macl = info->i;                  break;
3140      case CPUINFO_INT_REGISTER + SH2_R0:            sh2->r[ 0] = info->i;               break;
3141      case CPUINFO_INT_REGISTER + SH2_R1:            sh2->r[ 1] = info->i;               break;
3142      case CPUINFO_INT_REGISTER + SH2_R2:            sh2->r[ 2] = info->i;               break;
3143      case CPUINFO_INT_REGISTER + SH2_R3:            sh2->r[ 3] = info->i;               break;
3144      case CPUINFO_INT_REGISTER + SH2_R4:            sh2->r[ 4] = info->i;               break;
3145      case CPUINFO_INT_REGISTER + SH2_R5:            sh2->r[ 5] = info->i;               break;
3146      case CPUINFO_INT_REGISTER + SH2_R6:            sh2->r[ 6] = info->i;               break;
3147      case CPUINFO_INT_REGISTER + SH2_R7:            sh2->r[ 7] = info->i;               break;
3148      case CPUINFO_INT_REGISTER + SH2_R8:            sh2->r[ 8] = info->i;               break;
3149      case CPUINFO_INT_REGISTER + SH2_R9:            sh2->r[ 9] = info->i;               break;
3150      case CPUINFO_INT_REGISTER + SH2_R10:         sh2->r[10] = info->i;               break;
3151      case CPUINFO_INT_REGISTER + SH2_R11:         sh2->r[11] = info->i;               break;
3152      case CPUINFO_INT_REGISTER + SH2_R12:         sh2->r[12] = info->i;               break;
3153      case CPUINFO_INT_REGISTER + SH2_R13:         sh2->r[13] = info->i;               break;
3154      case CPUINFO_INT_REGISTER + SH2_R14:         sh2->r[14] = info->i;               break;
3155      case CPUINFO_INT_REGISTER + SH2_R15:         sh2->r[15] = info->i;               break;
3156      case CPUINFO_INT_REGISTER + SH2_EA:            sh2->ea = info->i;                  break;
3157
3158      case CPUINFO_INT_SH2_FRT_INPUT:               sh2_set_frt_input(cpu_getactivecpu(), info->i); break;
3159
3160      /* --- the following bits of info are set as pointers to data or functions --- */
3161      case CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK:      sh2->ftcsr_read_callback = (void (*) (UINT32 ))info->f; break;
3162   }
3163}
3164
3165/*-------------------------------------------------
3166    sh2_get_info - return information about a
3167    given CPU instance
3168-------------------------------------------------*/
3169
3170void sh2_get_info(UINT32 state, cpuinfo *info)
3171{
3172   switch (state)
3173   {
3174      /* --- the following bits of info are returned as 64-bit signed integers --- */
3175      case CPUINFO_INT_CONTEXT_SIZE:               info->i = sizeof(SH2);               break;
3176      case CPUINFO_INT_INPUT_LINES:               info->i = 16;                     break;
3177      case CPUINFO_INT_DEFAULT_IRQ_VECTOR:         info->i = 0;                     break;
3178      case CPUINFO_INT_ENDIANNESS:               info->i = CPU_IS_BE;               break;
3179      case CPUINFO_INT_CLOCK_MULTIPLIER:            info->i = 1;                     break;
3180      case CPUINFO_INT_CLOCK_DIVIDER:               info->i = 1;                     break;
3181      case CPUINFO_INT_MIN_INSTRUCTION_BYTES:         info->i = 2;                     break;
3182      case CPUINFO_INT_MAX_INSTRUCTION_BYTES:         info->i = 2;                     break;
3183      case CPUINFO_INT_MIN_CYCLES:               info->i = 1;                     break;
3184      case CPUINFO_INT_MAX_CYCLES:               info->i = 4;                     break;
3185
3186      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_PROGRAM:   info->i = 32;               break;
3187      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_PROGRAM: info->i = 32;               break;
3188      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_PROGRAM: info->i = 0;               break;
3189      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_DATA:   info->i = 0;               break;
3190      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_DATA:    info->i = 0;               break;
3191      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_DATA:    info->i = 0;               break;
3192      case CPUINFO_INT_DATABUS_WIDTH + ADDRESS_SPACE_IO:      info->i = 0;               break;
3193      case CPUINFO_INT_ADDRBUS_WIDTH + ADDRESS_SPACE_IO:       info->i = 0;               break;
3194      case CPUINFO_INT_ADDRBUS_SHIFT + ADDRESS_SPACE_IO:       info->i = 0;               break;
3195
3196      // Internal maps
3197      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_PROGRAM: info->internal_map32 = address_map_sh2_internal_map; break;
3198      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_DATA:    info->internal_map32 = NULL;   break;
3199      case CPUINFO_PTR_INTERNAL_MEMORY_MAP + ADDRESS_SPACE_IO:      info->internal_map32 = NULL;   break;
3200
3201      case CPUINFO_INT_INPUT_STATE + SH2_INT_VBLIN:   info->i = sh2->irq_line_state[SH2_INT_VBLIN]; break;
3202      case CPUINFO_INT_INPUT_STATE + SH2_INT_VBLOUT:   info->i = sh2->irq_line_state[SH2_INT_VBLOUT]; break;
3203      case CPUINFO_INT_INPUT_STATE + SH2_INT_HBLIN:   info->i = sh2->irq_line_state[SH2_INT_HBLIN]; break;
3204      case CPUINFO_INT_INPUT_STATE + SH2_INT_TIMER0:   info->i = sh2->irq_line_state[SH2_INT_TIMER0]; break;
3205      case CPUINFO_INT_INPUT_STATE + SH2_INT_TIMER1:   info->i = sh2->irq_line_state[SH2_INT_TIMER1]; break;
3206      case CPUINFO_INT_INPUT_STATE + SH2_INT_DSP:      info->i = sh2->irq_line_state[SH2_INT_DSP]; break;
3207      case CPUINFO_INT_INPUT_STATE + SH2_INT_SOUND:   info->i = sh2->irq_line_state[SH2_INT_SOUND]; break;
3208      case CPUINFO_INT_INPUT_STATE + SH2_INT_SMPC:   info->i = sh2->irq_line_state[SH2_INT_SMPC];   break;
3209      case CPUINFO_INT_INPUT_STATE + SH2_INT_PAD:      info->i = sh2->irq_line_state[SH2_INT_PAD]; break;
3210      case CPUINFO_INT_INPUT_STATE + SH2_INT_DMA2:   info->i = sh2->irq_line_state[SH2_INT_DMA2];   break;
3211      case CPUINFO_INT_INPUT_STATE + SH2_INT_DMA1:   info->i = sh2->irq_line_state[SH2_INT_DMA1];   break;
3212      case CPUINFO_INT_INPUT_STATE + SH2_INT_DMA0:   info->i = sh2->irq_line_state[SH2_INT_DMA0];   break;
3213      case CPUINFO_INT_INPUT_STATE + SH2_INT_DMAILL:   info->i = sh2->irq_line_state[SH2_INT_DMAILL]; break;
3214      case CPUINFO_INT_INPUT_STATE + SH2_INT_SPRITE:   info->i = sh2->irq_line_state[SH2_INT_SPRITE]; break;
3215      case CPUINFO_INT_INPUT_STATE + SH2_INT_14:      info->i = sh2->irq_line_state[SH2_INT_14]; break;
3216      case CPUINFO_INT_INPUT_STATE + SH2_INT_15:      info->i = sh2->irq_line_state[SH2_INT_15]; break;
3217      case CPUINFO_INT_INPUT_STATE + SH2_INT_ABUS:   info->i = sh2->irq_line_state[SH2_INT_ABUS];   break;
3218      case CPUINFO_INT_INPUT_STATE + INPUT_LINE_NMI:   info->i = sh2->nmi_line_state;         break;
3219
3220      case CPUINFO_INT_PREVIOUSPC:               info->i = sh2->ppc;                  break;
3221
3222      case CPUINFO_INT_PC:
3223      case CPUINFO_INT_REGISTER + SH2_PC:            info->i = (sh2->delay) ? (sh2->delay & AM) : (sh2->pc & AM); break;
3224      case CPUINFO_INT_SP:                        info->i = sh2->r[15];               break;
3225      case CPUINFO_INT_REGISTER + SH2_PR:            info->i = sh2->pr;                  break;
3226      case CPUINFO_INT_REGISTER + SH2_SR:            info->i = sh2->sr;                  break;
3227      case CPUINFO_INT_REGISTER + SH2_GBR:         info->i = sh2->gbr;                  break;
3228      case CPUINFO_INT_REGISTER + SH2_VBR:         info->i = sh2->vbr;                  break;
3229      case CPUINFO_INT_REGISTER + SH2_MACH:         info->i = sh2->mach;                  break;
3230      case CPUINFO_INT_REGISTER + SH2_MACL:         info->i = sh2->macl;                  break;
3231      case CPUINFO_INT_REGISTER + SH2_R0:            info->i = sh2->r[ 0];               break;
3232      case CPUINFO_INT_REGISTER + SH2_R1:            info->i = sh2->r[ 1];               break;
3233      case CPUINFO_INT_REGISTER + SH2_R2:            info->i = sh2->r[ 2];               break;
3234      case CPUINFO_INT_REGISTER + SH2_R3:            info->i = sh2->r[ 3];               break;
3235      case CPUINFO_INT_REGISTER + SH2_R4:            info->i = sh2->r[ 4];               break;
3236      case CPUINFO_INT_REGISTER + SH2_R5:            info->i = sh2->r[ 5];               break;
3237      case CPUINFO_INT_REGISTER + SH2_R6:            info->i = sh2->r[ 6];               break;
3238      case CPUINFO_INT_REGISTER + SH2_R7:            info->i = sh2->r[ 7];               break;
3239      case CPUINFO_INT_REGISTER + SH2_R8:            info->i = sh2->r[ 8];               break;
3240      case CPUINFO_INT_REGISTER + SH2_R9:            info->i = sh2->r[ 9];               break;
3241      case CPUINFO_INT_REGISTER + SH2_R10:         info->i = sh2->r[10];               break;
3242      case CPUINFO_INT_REGISTER + SH2_R11:         info->i = sh2->r[11];               break;
3243      case CPUINFO_INT_REGISTER + SH2_R12:         info->i = sh2->r[12];               break;
3244      case CPUINFO_INT_REGISTER + SH2_R13:         info->i = sh2->r[13];               break;
3245      case CPUINFO_INT_REGISTER + SH2_R14:         info->i = sh2->r[14];               break;
3246      case CPUINFO_INT_REGISTER + SH2_R15:         info->i = sh2->r[15];               break;
3247      case CPUINFO_INT_REGISTER + SH2_EA:            info->i = sh2->ea;                  break;
3248
3249      /* --- the following bits of info are returned as pointers to data or functions --- */
3250      case CPUINFO_PTR_SET_INFO:                  info->setinfo = sh2_set_info;         break;
3251      case CPUINFO_PTR_GET_CONTEXT:               info->getcontext = sh2_get_context;      break;
3252      case CPUINFO_PTR_SET_CONTEXT:               info->setcontext = sh2_set_context;      break;
3253      case CPUINFO_PTR_INIT:                     info->init = sh2_init;               break;
3254      case CPUINFO_PTR_RESET:                     info->reset = sh2_reset;            break;
3255      case CPUINFO_PTR_EXIT:                     info->exit = sh2_exit;               break;
3256      case CPUINFO_PTR_EXECUTE:                  info->execute = sh2_execute;         break;
3257      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
3258      case CPUINFO_PTR_DISASSEMBLE:               info->disassemble = sh2_dasm;         break;
3259      case CPUINFO_PTR_INSTRUCTION_COUNTER:         info->icount = &sh2->icount;            break;
3260
3261      /* --- the following bits of info are returned as NULL-terminated strings --- */
3262      case CPUINFO_STR_NAME:                     strcpy(info->s, "SH-2");            break;
3263      case CPUINFO_STR_CORE_FAMILY:               strcpy(info->s, "Hitachi SH7600");      break;
3264      case CPUINFO_STR_CORE_VERSION:               strcpy(info->s, "2.0");            break;
3265      case CPUINFO_STR_CORE_FILE:                  strcpy(info->s, __FILE__);            break;
3266      case CPUINFO_STR_CORE_CREDITS:               strcpy(info->s, "Copyright Nicola Salmoria and the MAME team, all rights reserved."); break;
3267
3268      case CPUINFO_STR_FLAGS:
3269         sprintf(info->s, "%c%c%d%c%c",
3270               sh2->sr & M ? 'M':'.',
3271               sh2->sr & Q ? 'Q':'.',
3272               (sh2->sr & I) >> 4,
3273               sh2->sr & S ? 'S':'.',
3274               sh2->sr & T ? 'T':'.');
3275         break;
3276
3277      case CPUINFO_STR_REGISTER + SH2_PC:            sprintf(info->s, "PC  :%08X", sh2->pc); break;
3278      case CPUINFO_STR_REGISTER + SH2_SR:            sprintf(info->s, "SR  :%08X", sh2->sr); break;
3279      case CPUINFO_STR_REGISTER + SH2_PR:            sprintf(info->s, "PR  :%08X", sh2->pr); break;
3280      case CPUINFO_STR_REGISTER + SH2_GBR:         sprintf(info->s, "GBR :%08X", sh2->gbr); break;
3281      case CPUINFO_STR_REGISTER + SH2_VBR:         sprintf(info->s, "VBR :%08X", sh2->vbr); break;
3282      case CPUINFO_STR_REGISTER + SH2_MACH:         sprintf(info->s, "MACH:%08X", sh2->mach); break;
3283      case CPUINFO_STR_REGISTER + SH2_MACL:         sprintf(info->s, "MACL:%08X", sh2->macl); break;
3284      case CPUINFO_STR_REGISTER + SH2_R0:            sprintf(info->s, "R0  :%08X", sh2->r[ 0]); break;
3285      case CPUINFO_STR_REGISTER + SH2_R1:            sprintf(info->s, "R1  :%08X", sh2->r[ 1]); break;
3286      case CPUINFO_STR_REGISTER + SH2_R2:            sprintf(info->s, "R2  :%08X", sh2->r[ 2]); break;
3287      case CPUINFO_STR_REGISTER + SH2_R3:            sprintf(info->s, "R3  :%08X", sh2->r[ 3]); break;
3288      case CPUINFO_STR_REGISTER + SH2_R4:            sprintf(info->s, "R4  :%08X", sh2->r[ 4]); break;
3289      case CPUINFO_STR_REGISTER + SH2_R5:            sprintf(info->s, "R5  :%08X", sh2->r[ 5]); break;
3290      case CPUINFO_STR_REGISTER + SH2_R6:            sprintf(info->s, "R6  :%08X", sh2->r[ 6]); break;
3291      case CPUINFO_STR_REGISTER + SH2_R7:            sprintf(info->s, "R7  :%08X", sh2->r[ 7]); break;
3292      case CPUINFO_STR_REGISTER + SH2_R8:            sprintf(info->s, "R8  :%08X", sh2->r[ 8]); break;
3293      case CPUINFO_STR_REGISTER + SH2_R9:            sprintf(info->s, "R9  :%08X", sh2->r[ 9]); break;
3294      case CPUINFO_STR_REGISTER + SH2_R10:         sprintf(info->s, "R10 :%08X", sh2->r[10]); break;
3295      case CPUINFO_STR_REGISTER + SH2_R11:         sprintf(info->s, "R11 :%08X", sh2->r[11]); break;
3296      case CPUINFO_STR_REGISTER + SH2_R12:         sprintf(info->s, "R12 :%08X", sh2->r[12]); break;
3297      case CPUINFO_STR_REGISTER + SH2_R13:         sprintf(info->s, "R13 :%08X", sh2->r[13]); break;
3298      case CPUINFO_STR_REGISTER + SH2_R14:         sprintf(info->s, "R14 :%08X", sh2->r[14]); break;
3299      case CPUINFO_STR_REGISTER + SH2_R15:         sprintf(info->s, "R15 :%08X", sh2->r[15]); break;
3300      case CPUINFO_STR_REGISTER + SH2_EA:            sprintf(info->s, "EA  :%08X", sh2->ea);    break;
3301
3302      case CPUINFO_PTR_SH2_FTCSR_READ_CALLBACK:      info->f = (genf*)sh2->ftcsr_read_callback; break;
3303
3304   }
3305}
3306
3307#endif   // USE_SH2DRC
src/emu/cpu/sh2/sh2fe.c
r0r2957
1/***************************************************************************
2
3    sh2fe.c
4
5    Front end for SH-2 recompiler
6
7    Released for general non-commercial use under the MAME license
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#include "cpuintrf.h"
13#include "sh2.h"
14#include "sh2comn.h"
15#include "cpu/drcfe.h"
16
17/***************************************************************************
18    FUNCTION PROTOTYPES
19***************************************************************************/
20
21static int describe_group_0(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode);
22static int describe_group_2(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode);
23static int describe_group_3(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode);
24static int describe_group_4(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode);
25static int describe_group_6(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode);
26static int describe_group_8(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode);
27static int describe_group_12(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode);
28
29/***************************************************************************
30    INSTRUCTION PARSERS
31***************************************************************************/
32
33/*-------------------------------------------------
34    describe_instruction - build a description
35    of a single instruction
36-------------------------------------------------*/
37
38int sh2_describe(void *param, opcode_desc *desc, const opcode_desc *prev)
39{
40   UINT16 opcode = *desc->opptr.w;
41   SH2 *context = (SH2 *)param;
42
43   /* all instructions are 2 bytes and most are a single cycle */
44   desc->length = 2;
45   desc->cycles = 1;
46
47   switch (opcode>>12)
48   {
49      case  0:
50         return describe_group_0(context, desc, prev, opcode);
51         break;
52
53      case  1:    // MOVLS4
54         desc->regin[0] |= REGFLAG_R(Rn) | REGFLAG_R(Rm);
55         desc->flags |= OPFLAG_WRITES_MEMORY;
56         return TRUE;
57         break;
58
59      case  2:
60         return describe_group_2(context, desc, prev, opcode);
61         break;
62
63      case  3:
64         return describe_group_3(context, desc, prev, opcode);
65         break;
66
67      case  4:
68         return describe_group_4(context, desc, prev, opcode);
69         break;
70
71      case  5:    // MOVLL4
72         desc->regin[0] |= REGFLAG_R(Rm);
73         desc->regout[0] |= REGFLAG_R(Rn);
74         desc->flags |= OPFLAG_READS_MEMORY;
75         return TRUE;
76         break;
77
78      case  6:
79         return describe_group_6(context, desc, prev, opcode);
80         break;
81
82      case  7:    // ADDI
83         desc->regin[0] |= REGFLAG_R(Rn);
84         desc->regout[0] |= REGFLAG_R(Rn);
85         return TRUE;
86         break;
87
88      case  8:
89         return describe_group_8(context, desc, prev, opcode);
90         break;
91
92      case  9:    // MOVWI
93         desc->regout[0] |= REGFLAG_R(Rn);
94         desc->flags |= OPFLAG_READS_MEMORY;
95         return TRUE;
96         break;
97
98      case 11:    // BSR
99         desc->regout[1] |= REGFLAG_PR;
100         // (intentional fallthrough - BSR is BRA with the addition of PR = the return address)
101      case 10:    // BRA
102         {
103            INT32 disp = ((INT32)opcode << 20) >> 20;
104
105            desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE;
106            desc->targetpc = (desc->pc + 2) + disp * 2 + 2;
107            desc->delayslots = 1;
108            desc->cycles = 2;
109            return TRUE;
110         }
111         break;
112
113      case 12:
114         return describe_group_12(context, desc, prev, opcode);
115         break;
116
117      case 13:    // MOVLI
118         desc->regout[0] |= REGFLAG_R(Rn);
119         desc->flags |= OPFLAG_READS_MEMORY;
120         return TRUE;
121         break;
122
123      case 14:    // MOVI
124         desc->regout[0] |= REGFLAG_R(Rn);
125         return TRUE;
126         break;
127
128      case 15:    // NOP
129         return TRUE;
130         break;
131   }
132
133   return FALSE;
134}
135
136static int describe_group_0(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode)
137{
138   switch (opcode & 0x3F)
139   {
140   case 0x00: // NOP();
141   case 0x01: // NOP();
142   case 0x09: // NOP();
143   case 0x10: // NOP();
144   case 0x11: // NOP();
145   case 0x13: // NOP();
146   case 0x20: // NOP();
147   case 0x21: // NOP();
148   case 0x30: // NOP();
149   case 0x31: // NOP();
150   case 0x32: // NOP();
151   case 0x33: // NOP();
152   case 0x38: // NOP();
153   case 0x39: // NOP();
154   case 0x3a: // NOP();
155   case 0x3b: // NOP();
156      return TRUE;
157      break;
158
159   case 0x02: // STCSR(Rn);
160      desc->regout[0] |= REGFLAG_R(Rn);
161      return TRUE;
162      break;
163
164   case 0x03: // BSRF(Rn);
165      desc->regout[1] |= REGFLAG_PR;
166
167      desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE;
168      desc->targetpc = BRANCH_TARGET_DYNAMIC;
169      desc->delayslots = 1;
170
171      return TRUE;
172      break;
173
174   case 0x04: // MOVBS0(Rm, Rn);
175   case 0x05: // MOVWS0(Rm, Rn);
176   case 0x06: // MOVLS0(Rm, Rn);
177   case 0x14: // MOVBS0(Rm, Rn);
178   case 0x15: // MOVWS0(Rm, Rn);
179   case 0x16: // MOVLS0(Rm, Rn);
180   case 0x24: // MOVBS0(Rm, Rn);
181   case 0x25: // MOVWS0(Rm, Rn);
182   case 0x26: // MOVLS0(Rm, Rn);
183   case 0x34: // MOVBS0(Rm, Rn);
184   case 0x35: // MOVWS0(Rm, Rn);
185   case 0x36: // MOVLS0(Rm, Rn);
186      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn) | REGFLAG_R(0);
187      desc->flags |= OPFLAG_READS_MEMORY;
188      return TRUE;
189      break;
190
191   case 0x07: // MULL(Rm, Rn);
192   case 0x17: // MULL(Rm, Rn);
193   case 0x27: // MULL(Rm, Rn);
194   case 0x37: // MULL(Rm, Rn);
195      desc->regin[0] |= REGFLAG_R(Rn) | REGFLAG_R(Rm);
196      desc->regout[1] |= REGFLAG_MACL;
197      desc->cycles = 2;
198      return TRUE;
199      break;
200
201   case 0x08: // CLRT();
202      desc->regout[1] |= REGFLAG_SR;
203      return TRUE;
204      break;
205
206   case 0x0a: // STSMACH(Rn);
207      desc->regout[0] |= REGFLAG_R(Rn);
208      desc->regout[1] |= REGFLAG_MACH;
209      return TRUE;
210      break;
211
212   case 0x0b: // RTS();
213      desc->regin[1] |= REGFLAG_PR;
214
215      desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE;
216      desc->targetpc = BRANCH_TARGET_DYNAMIC;
217      desc->delayslots = 1;
218      desc->cycles = 2;
219
220      return TRUE;
221      break;
222
223   case 0x0c: // MOVBL0(Rm, Rn);
224   case 0x0d: // MOVWL0(Rm, Rn);
225   case 0x0e: // MOVLL0(Rm, Rn);
226   case 0x1c: // MOVBL0(Rm, Rn);
227   case 0x1d: // MOVWL0(Rm, Rn);
228   case 0x1e: // MOVLL0(Rm, Rn);
229   case 0x2c: // MOVBL0(Rm, Rn);
230   case 0x2d: // MOVWL0(Rm, Rn);
231   case 0x2e: // MOVLL0(Rm, Rn);
232   case 0x3c: // MOVBL0(Rm, Rn);
233   case 0x3d: // MOVWL0(Rm, Rn);
234   case 0x3e: // MOVLL0(Rm, Rn);
235      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(0);
236      desc->regout[0] |= REGFLAG_R(Rn);
237      desc->flags |= OPFLAG_READS_MEMORY;
238      return TRUE;
239      break;
240
241   case 0x0f: // MAC_L(Rm, Rn);
242   case 0x1f: // MAC_L(Rm, Rn);
243   case 0x2f: // MAC_L(Rm, Rn);
244   case 0x3f: // MAC_L(Rm, Rn);
245      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
246      desc->regout[1] |= REGFLAG_MACL | REGFLAG_MACH;
247      desc->cycles = 3;
248      return TRUE;
249      break;
250
251   case 0x12: // STCGBR(Rn);
252      desc->regout[0] |= REGFLAG_R(Rn);
253      desc->regin[1] |= REGFLAG_GBR;
254      return TRUE;
255      break;
256
257   case 0x18: // SETT();
258      desc->regout[1] |= REGFLAG_SR;
259      return TRUE;
260      break;
261
262   case 0x19: // DIV0U();
263      desc->regout[1] |= REGFLAG_SR;
264      return TRUE;
265      break;
266
267   case 0x1a: // STSMACL(Rn);
268      desc->regin[1] |= REGFLAG_MACL;
269      desc->regout[0] |= REGFLAG_R(Rn);
270      return TRUE;
271      break;
272
273   case 0x1b: // SLEEP();
274      desc->cycles = 3;
275      return TRUE;
276      break;
277
278   case 0x22: // STCVBR(Rn);
279      desc->regin[0] |= REGFLAG_R(Rn);
280      desc->regout[1] |= REGFLAG_VBR;
281      return TRUE;
282      break;
283
284   case 0x23: // BRAF(Rn);
285      desc->regin[0] |= REGFLAG_R(Rm);
286      desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE;
287      desc->targetpc = BRANCH_TARGET_DYNAMIC;
288      desc->delayslots = 1;
289      desc->cycles = 2;
290      return TRUE;
291      break;
292
293   case 0x28: // CLRMAC();
294      desc->regout[1] |= REGFLAG_MACL | REGFLAG_MACH;
295      return TRUE;
296      break;
297
298   case 0x29: // MOVT(Rn);
299      desc->regin[1] |= REGFLAG_SR;
300      desc->regout[0] |= REGFLAG_R(Rn);
301      return TRUE;
302      break;
303
304   case 0x2a: // STSPR(Rn);
305      desc->regin[1] |= REGFLAG_PR;
306      desc->regout[0] |= REGFLAG_R(Rn);
307      return TRUE;
308      break;
309
310   case 0x2b: // RTE();
311      desc->regin[0] |= REGFLAG_R(15);
312      desc->regout[0] |= REGFLAG_R(15);
313
314      desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE | OPFLAG_CAN_EXPOSE_EXTERNAL_INT;
315      desc->targetpc = BRANCH_TARGET_DYNAMIC;
316      desc->delayslots = 1;
317      desc->cycles = 4;
318
319      return TRUE;
320      break;
321   }
322
323   return FALSE;
324}
325
326static int describe_group_2(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode)
327{
328   switch (opcode & 15)
329   {
330   case  0: // MOVBS(Rm, Rn);
331   case  1: // MOVWS(Rm, Rn);
332   case  2: // MOVLS(Rm, Rn);
333      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
334      desc->flags |= OPFLAG_WRITES_MEMORY;
335      return TRUE;
336      break;
337
338   case  3: // NOP();
339      return TRUE;
340      break;
341
342   case  4: // MOVBM(Rm, Rn);
343   case  5: // MOVWM(Rm, Rn);
344   case  6: // MOVLM(Rm, Rn);
345   case 13: // XTRCT(Rm, Rn);
346      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
347      desc->regout[0] |= REGFLAG_R(Rn);
348      desc->flags |= OPFLAG_WRITES_MEMORY;
349      return TRUE;
350      break;
351
352   case  7: // DIV0S(Rm, Rn);
353   case  8: // TST(Rm, Rn);
354   case 12: // CMPSTR(Rm, Rn);
355      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
356      desc->regout[1] |= REGFLAG_SR;
357      return TRUE;
358      break;
359
360   case  9: // AND(Rm, Rn);
361   case 10: // XOR(Rm, Rn);
362   case 11: // OR(Rm, Rn);
363      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
364      desc->regout[0] |= REGFLAG_R(Rn);
365      return TRUE;
366      break;
367
368   case 14: // MULU(Rm, Rn);
369   case 15: // MULS(Rm, Rn);
370      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
371      desc->regout[1] |= REGFLAG_MACL | REGFLAG_MACH;
372      desc->cycles = 2;
373      return TRUE;
374      break;
375   }
376
377   return FALSE;
378}
379
380static int describe_group_3(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode)
381{
382   switch (opcode & 15)
383   {
384   case  0: // CMPEQ(Rm, Rn);
385   case  2: // CMPHS(Rm, Rn);
386   case  3: // CMPGE(Rm, Rn);
387   case  6: // CMPHI(Rm, Rn);
388   case  7: // CMPGT(Rm, Rn);
389      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
390      desc->regout[1] |= REGFLAG_SR;
391      return TRUE;
392      break;
393
394   case  1: // NOP();
395   case  9: // NOP();
396      return TRUE;
397      break;
398
399   case  4: // DIV1(Rm, Rn);
400      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
401      desc->regout[0] |= REGFLAG_R(Rn);
402      desc->regout[1] |= REGFLAG_SR;
403      return TRUE;
404      break;
405
406   case  5: // DMULU(Rm, Rn);
407   case 13: // DMULS(Rm, Rn);
408      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
409      desc->regout[1] |= REGFLAG_MACL | REGFLAG_MACH;
410      desc->cycles = 2;
411      return TRUE;
412      break;
413
414   case  8: // SUB(Rm, Rn);
415   case 12: // ADD(Rm, Rn);
416      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
417      desc->regout[0] |= REGFLAG_R(Rn);
418      return TRUE;
419      break;
420
421   case 10: // SUBC(Rm, Rn);
422   case 11: // SUBV(Rm, Rn);
423   case 14: // ADDC(Rm, Rn);
424   case 15: // ADDV(Rm, Rn);
425      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
426      desc->regin[1] |= REGFLAG_SR;
427      desc->regout[0] |= REGFLAG_R(Rn);
428      desc->regout[1] |= REGFLAG_SR;
429      return TRUE;
430      break;
431   }
432   return FALSE;
433}
434
435static int describe_group_4(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode)
436{
437   switch (opcode & 0x3F)
438   {
439   case 0x00: // SHLL(Rn);
440   case 0x01: // SHLR(Rn);
441   case 0x04: // ROTL(Rn);
442   case 0x05: // ROTR(Rn);
443      desc->regin[0] |= REGFLAG_R(Rn);
444      desc->regout[0] |= REGFLAG_R(Rn);
445      desc->regout[1] |= REGFLAG_SR;
446      return TRUE;
447      break;
448
449   case 0x02: // STSMMACH(Rn);
450      desc->regin[0] |= REGFLAG_R(Rn);
451      desc->regin[1] |= REGFLAG_MACH;
452      desc->regout[0] |= REGFLAG_R(Rn);
453      desc->flags |= OPFLAG_WRITES_MEMORY;
454      return TRUE;
455      break;
456
457   case 0x03: // STCMSR(Rn);
458      desc->regin[0] |= REGFLAG_R(Rn);
459      desc->regout[0] |= REGFLAG_R(Rn);
460      desc->cycles = 2;
461      desc->flags |= OPFLAG_WRITES_MEMORY;
462      return TRUE;
463      break;
464
465   case 0x06: // LDSMMACH(Rn);
466      desc->regin[0] |= REGFLAG_R(Rn);
467      desc->regout[0] |= REGFLAG_R(Rn);
468      desc->regout[1] |= REGFLAG_MACH;
469      desc->flags |= OPFLAG_READS_MEMORY;
470      return TRUE;
471      break;
472
473   case 0x07: // LDCMSR(Rn);
474      desc->regin[0] |= REGFLAG_R(Rn);
475      desc->regout[0] |= REGFLAG_R(Rn);
476      desc->regout[1] |= REGFLAG_SR;
477      desc->cycles = 3;
478      desc->flags |= OPFLAG_READS_MEMORY | OPFLAG_CAN_EXPOSE_EXTERNAL_INT | OPFLAG_END_SEQUENCE;
479      return TRUE;
480      break;
481
482   case 0x08: // SHLL2(Rn);
483   case 0x09: // SHLR2(Rn);
484   case 0x18: // SHLL8(Rn);
485   case 0x19: // SHLR8(Rn);
486   case 0x28: // SHLL16(Rn);
487   case 0x29: // SHLR16(Rn);
488      desc->regin[0] |= REGFLAG_R(Rn);
489      desc->regout[0] |= REGFLAG_R(Rn);
490      return TRUE;
491      break;
492
493   case 0x0a: // LDSMACH(Rn);
494      desc->regin[0] |= REGFLAG_R(Rn);
495      desc->regout[1] |= REGFLAG_MACH;
496      return TRUE;
497      break;
498
499   case 0x0b: // JSR(Rn);
500      desc->regin[0] |= REGFLAG_R(Rn);
501      desc->regout[1] |= REGFLAG_PR;
502      desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE;
503      desc->targetpc = BRANCH_TARGET_DYNAMIC;
504      desc->delayslots = 1;
505      return TRUE;
506      break;
507
508   case 0x0e: // LDCSR(Rn);
509      desc->regin[0] |= REGFLAG_R(Rn);
510      desc->regout[1] |= REGFLAG_SR;
511      desc->flags |= OPFLAG_CAN_EXPOSE_EXTERNAL_INT | OPFLAG_END_SEQUENCE;
512      return TRUE;
513      break;
514
515   case 0x0f: // MAC_W(Rm, Rn);
516   case 0x1f: // MAC_W(Rm, Rn);
517   case 0x2f: // MAC_W(Rm, Rn);
518   case 0x3f: // MAC_W(Rm, Rn);
519      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
520      desc->regin[1] |= REGFLAG_MACL | REGFLAG_MACH;
521      desc->regout[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
522      desc->regout[1] |= REGFLAG_MACL | REGFLAG_MACH;
523      desc->cycles = 3;
524      return TRUE;
525      break;
526
527   case 0x10: // DT(Rn);
528      desc->regin[0] |= REGFLAG_R(Rn);
529      desc->regin[1] |= REGFLAG_SR;
530      desc->regout[0] |= REGFLAG_R(Rn);
531      desc->regout[1] |= REGFLAG_SR;
532      return TRUE;
533      break;
534
535   case 0x11: // CMPPZ(Rn);
536   case 0x15: // CMPPL(Rn);
537      desc->regin[0] |= REGFLAG_R(Rn);
538      desc->regin[1] |= REGFLAG_SR;
539      desc->regout[1] |= REGFLAG_SR;
540      return TRUE;
541      break;
542
543   case 0x12: // STSMMACL(Rn);
544      desc->regin[0] |= REGFLAG_R(Rn);
545      desc->regin[1] |= REGFLAG_MACL;
546      desc->regout[0] |= REGFLAG_R(Rn);
547      desc->flags |= OPFLAG_WRITES_MEMORY;
548      return TRUE;
549      break;
550
551   case 0x13: // STCMGBR(Rn);
552      desc->regin[0] |= REGFLAG_R(Rn);
553      desc->regin[1] |= REGFLAG_GBR;
554      desc->regout[0] |= REGFLAG_R(Rn);
555      desc->flags |= OPFLAG_WRITES_MEMORY;
556      return TRUE;
557      break;
558
559   case 0x16: // LDSMMACL(Rn);
560      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
561      desc->regout[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
562      desc->regout[1] |= REGFLAG_MACL;
563      desc->flags |= OPFLAG_READS_MEMORY;
564      return TRUE;
565      break;
566
567   case 0x17: // LDCMGBR(Rn);
568      desc->regin[0] |= REGFLAG_R(Rn);
569      desc->regout[0] |= REGFLAG_R(Rn);
570      desc->regout[1] |= REGFLAG_GBR;
571      desc->flags |= OPFLAG_READS_MEMORY;
572      return TRUE;
573      break;
574
575   case 0x1a: // LDSMACL(Rn);
576      desc->regin[0] |= REGFLAG_R(Rn);
577      desc->regout[1] |= REGFLAG_MACL;
578      return TRUE;
579      break;
580
581   case 0x1b: // TAS(Rn);
582      desc->regin[0] |= REGFLAG_R(Rn);
583      desc->regin[1] |= REGFLAG_SR;
584      desc->regout[1] |= REGFLAG_SR;
585      desc->cycles = 4;
586      desc->flags |= OPFLAG_READS_MEMORY | OPFLAG_WRITES_MEMORY;
587      return TRUE;
588      break;
589
590   case 0x1e: // LDCGBR(Rn);
591      desc->regin[0] |= REGFLAG_R(Rn);
592      desc->regout[1] |= REGFLAG_GBR;
593      return TRUE;
594      break;
595
596   case 0x20: // SHAL(Rn);
597   case 0x21: // SHAR(Rn);
598      desc->regin[0] |= REGFLAG_R(Rn);
599      desc->regout[0] |= REGFLAG_R(Rn);
600      desc->regout[1] |= REGFLAG_SR;
601      return TRUE;
602      break;
603
604   case 0x22: // STSMPR(Rn);
605      desc->regin[0] |= REGFLAG_R(Rn);
606      desc->regin[1] |= REGFLAG_PR;
607      desc->regout[0] |= REGFLAG_R(Rn);
608      desc->flags |= OPFLAG_WRITES_MEMORY;
609      return TRUE;
610      break;
611
612   case 0x23: // STCMVBR(Rn);
613      desc->regin[0] |= REGFLAG_R(Rn);
614      desc->regin[1] |= REGFLAG_VBR;
615      desc->regout[0] |= REGFLAG_R(Rn);
616      desc->flags |= OPFLAG_WRITES_MEMORY;
617      return TRUE;
618      break;
619
620   case 0x24: // ROTCL(Rn);
621   case 0x25: // ROTCR(Rn);
622      desc->regin[0] |= REGFLAG_R(Rn);
623      desc->regin[1] |= REGFLAG_SR;
624      desc->regout[0] |= REGFLAG_R(Rn);
625      desc->regout[1] |= REGFLAG_SR;
626      return TRUE;
627      break;
628
629   case 0x26: // LDSMPR(Rn);
630      desc->regin[0] |= REGFLAG_R(Rn);
631      desc->regout[0] |= REGFLAG_R(Rn);
632      desc->regout[1] |= REGFLAG_PR;
633      desc->flags |= OPFLAG_READS_MEMORY;
634      return TRUE;
635      break;
636
637   case 0x27: // LDCMVBR(Rn);
638      desc->regin[0] |= REGFLAG_R(Rn);
639      desc->regout[0] |= REGFLAG_R(Rn);
640      desc->regout[1] |= REGFLAG_VBR;
641      desc->flags |= OPFLAG_READS_MEMORY;
642      return TRUE;
643      break;
644
645   case 0x2a: // LDSPR(Rn);
646      desc->regin[0] |= REGFLAG_R(Rn);
647      desc->regout[1] |= REGFLAG_PR;
648      return TRUE;
649      break;
650
651   case 0x2b: // JMP(Rm);
652      desc->regin[0] |= REGFLAG_R(Rm);
653      desc->flags |= OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE;
654      desc->targetpc = BRANCH_TARGET_DYNAMIC;
655      desc->delayslots = 1;
656      return TRUE;
657      break;
658
659   case 0x2e: // LDCVBR(Rn);
660      desc->regin[0] |= REGFLAG_R(Rn);
661      desc->regout[1] |= REGFLAG_VBR;
662      return TRUE;
663      break;
664
665   case 0x0c: // NOP();
666   case 0x0d: // NOP();
667   case 0x14: // NOP();
668   case 0x1c: // NOP();
669   case 0x1d: // NOP();
670   case 0x2c: // NOP();
671   case 0x2d: // NOP();
672   case 0x30: // NOP();
673   case 0x31: // NOP();
674   case 0x32: // NOP();
675   case 0x33: // NOP();
676   case 0x34: // NOP();
677   case 0x35: // NOP();
678   case 0x36: // NOP();
679   case 0x37: // NOP();
680   case 0x38: // NOP();
681   case 0x39: // NOP();
682   case 0x3a: // NOP();
683   case 0x3b: // NOP();
684   case 0x3c: // NOP();
685   case 0x3d: // NOP();
686   case 0x3e: // NOP();
687      return TRUE;
688      break;
689
690   }
691
692   return FALSE;
693}
694
695static int describe_group_6(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode)
696{
697   switch (opcode & 15)
698   {
699   case  0: // MOVBL(Rm, Rn);
700   case  1: // MOVWL(Rm, Rn);
701   case  2: // MOVLL(Rm, Rn);
702   case  3: // MOV(Rm, Rn);
703   case  7: // NOT(Rm, Rn);
704   case  9: // SWAPW(Rm, Rn);
705   case 11: // NEG(Rm, Rn);
706   case 12: // EXTUB(Rm, Rn);
707   case 13: // EXTUW(Rm, Rn);
708   case 14: // EXTSB(Rm, Rn);
709   case 15: // EXTSW(Rm, Rn);
710      desc->regin[0] |= REGFLAG_R(Rm);
711      desc->regout[0] |= REGFLAG_R(Rn);
712      return TRUE;
713      break;
714
715   case  4: // MOVBP(Rm, Rn);
716   case  5: // MOVWP(Rm, Rn);
717   case  6: // MOVLP(Rm, Rn);
718      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
719      desc->regout[0] |= REGFLAG_R(Rn);
720      desc->flags |= OPFLAG_READS_MEMORY;
721      return TRUE;
722      break;
723
724   case  8: // SWAPB(Rm, Rn);
725      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(Rn);
726      desc->regout[0] |= REGFLAG_R(Rn);
727      return TRUE;
728      break;
729
730   case 10: // NEGC(Rm, Rn);
731      desc->regin[0] |= REGFLAG_R(Rm);
732      desc->regout[0] |= REGFLAG_R(Rn);
733      desc->regout[1] |= REGFLAG_SR;
734      return TRUE;
735      break;
736   }
737   return FALSE;
738}
739
740static int describe_group_8(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode)
741{
742   INT32 disp;
743
744   switch ( opcode  & (15<<8) )
745   {
746   case  0 << 8: // MOVBS4(opcode & 0x0f, Rm);
747   case  1 << 8: // MOVWS4(opcode & 0x0f, Rm);
748      desc->regin[0] |= REGFLAG_R(Rm) | REGFLAG_R(0);
749      desc->flags |= OPFLAG_WRITES_MEMORY;
750      return TRUE;
751      break;
752
753   case  2<< 8: // NOP();
754   case  3<< 8: // NOP();
755   case  6<< 8: // NOP();
756   case  7<< 8: // NOP();
757   case 10<< 8: // NOP();
758   case 12<< 8: // NOP();
759   case 14<< 8: // NOP();
760      return TRUE;
761      break;
762
763   case  4<< 8: // MOVBL4(Rm, opcode & 0x0f);
764   case  5<< 8: // MOVWL4(Rm, opcode & 0x0f);
765      desc->regin[0] |= REGFLAG_R(Rm);
766      desc->regout[0] |= REGFLAG_R(0);
767      desc->flags |= OPFLAG_READS_MEMORY;
768      return TRUE;
769      break;
770
771   case  8<< 8: // CMPIM(opcode & 0xff);
772      desc->regin[0] |= REGFLAG_R(Rm);
773      desc->regin[1] |= REGFLAG_SR;
774      desc->regout[1] |= REGFLAG_SR;
775      return TRUE;
776      break;
777
778   case  9<< 8: // BT(opcode & 0xff);
779   case 11<< 8: // BF(opcode & 0xff);
780      desc->flags |= OPFLAG_IS_CONDITIONAL_BRANCH;
781      desc->cycles = 3;
782      disp = ((INT32)opcode << 24) >> 24;
783      desc->targetpc = (desc->pc + 2) + disp * 2 + 2;
784      return TRUE;
785      break;
786
787   case 13<< 8: // BTS(opcode & 0xff);
788   case 15<< 8: // BFS(opcode & 0xff);
789      desc->flags |= OPFLAG_IS_CONDITIONAL_BRANCH;
790      desc->cycles = 2;
791      disp = ((INT32)opcode << 24) >> 24;
792      desc->targetpc = (desc->pc + 2) + disp * 2 + 2;
793      desc->delayslots = 1;
794      return TRUE;
795      break;
796   }
797
798   return FALSE;
799}
800
801static int describe_group_12(SH2 *context, opcode_desc *desc, const opcode_desc *prev, UINT16 opcode)
802{
803   switch (opcode & (15<<8))
804   {
805   case  0<<8: // MOVBSG(opcode & 0xff);
806   case  1<<8: // MOVWSG(opcode & 0xff);
807   case  2<<8: // MOVLSG(opcode & 0xff);
808      desc->regin[0] |= REGFLAG_R(0);
809      desc->flags |= OPFLAG_WRITES_MEMORY;
810      return TRUE;
811      break;
812
813   case  3<<8: // TRAPA(opcode & 0xff);
814      desc->regin[0] |= REGFLAG_R(15);
815      desc->regin[1] |= REGFLAG_VBR;
816      desc->regout[0] |= REGFLAG_R(15);
817      desc->cycles = 8;
818      desc->targetpc = BRANCH_TARGET_DYNAMIC;
819      desc->flags |= OPFLAG_READS_MEMORY | OPFLAG_IS_UNCONDITIONAL_BRANCH | OPFLAG_END_SEQUENCE;
820      return TRUE;
821      break;
822
823   case  4<<8: // MOVBLG(opcode & 0xff);
824   case  5<<8: // MOVWLG(opcode & 0xff);
825   case  6<<8: // MOVLLG(opcode & 0xff);
826   case  7<<8: // MOVA(opcode & 0xff);
827      desc->regout[0] |= REGFLAG_R(0);
828      desc->flags |= OPFLAG_READS_MEMORY;
829      return TRUE;
830      break;
831
832   case  8<<8: // TSTI(opcode & 0xff);
833      desc->regin[0] |= REGFLAG_R(0);
834      desc->regin[1] |= REGFLAG_SR;
835      desc->regout[1] |= REGFLAG_SR;
836      return TRUE;
837      break;
838
839   case  9<<8: // ANDI(opcode & 0xff);
840   case 10<<8: // XORI(opcode & 0xff);
841   case 11<<8: // ORI(opcode & 0xff);
842      desc->regin[0] |= REGFLAG_R(0);
843      desc->regout[0] |= REGFLAG_R(0);
844      return TRUE;
845      break;
846
847   case 12<<8: // TSTM(opcode & 0xff);
848   case 13<<8: // ANDM(opcode & 0xff);
849   case 14<<8: // XORM(opcode & 0xff);
850   case 15<<8: // ORM(opcode & 0xff);
851      desc->regin[0] |= REGFLAG_R(0);
852      desc->regin[1] |= REGFLAG_SR | REGFLAG_GBR;
853      desc->regout[1] |= REGFLAG_SR;
854      desc->flags |= OPFLAG_READS_MEMORY;
855      return TRUE;
856      break;
857   }
858
859   return FALSE;
860}
861
src/emu/cpu/sh2/sh2comn.c
r2956r2957
259259
260260WRITE32_HANDLER( sh2_internal_w )
261261{
262   UINT32 old = sh2->m[offset];
262   UINT32 old;
263
264#ifdef USE_SH2DRC
265   offset &= 0x7f;
266#endif
267
268   old = sh2->m[offset];
263269   COMBINE_DATA(sh2->m+offset);
264270
265271   //  if(offset != 0x20)
266272   //      logerror("sh2_internal_w:  Write %08x (%x), %08x @ %08x\n", 0xfffffe00+offset*4, offset, data, mem_mask);
267273
274//    if(offset != 0x20)
275//        printf("sh2_internal_w:  Write %08x (%x), %08x @ %08x (PC %x)\n", 0xfffffe00+offset*4, offset, data, mem_mask, activecpu_get_pc());
276
268277   switch( offset )
269278   {
270279      // Timers
271280   case 0x04: // TIER, FTCSR, FRC
272281      if((mem_mask & 0x00ffffff) != 0)
273282         sh2_timer_resync();
274      logerror("SH2.%d: TIER write %04x @ %04x\n", sh2->cpu_number, data >> 16, mem_mask>>16);
283//      printf("SH2.%d: TIER write %04x @ %04x\n", sh2->cpu_number, data >> 16, mem_mask>>16);
275284      sh2->m[4] = (sh2->m[4] & ~(ICF|OCFA|OCFB|OVF)) | (old & sh2->m[4] & (ICF|OCFA|OCFB|OVF));
276285      COMBINE_DATA(&sh2->frc);
277286      if((mem_mask & 0x00ffffff) != 0)
r2956r2957
279288      sh2_recalc_irq();
280289      break;
281290   case 0x05: // OCRx, TCR, TOCR
282      logerror("SH2.%d: TCR write %08x @ %08x\n", sh2->cpu_number, data, mem_mask);
291//      printf("SH2.%d: TCR write %08x @ %08x\n", sh2->cpu_number, data, mem_mask);
283292      sh2_timer_resync();
284293      if(sh2->m[5] & 0x10)
285294         sh2->ocrb = (sh2->ocrb & (~mem_mask >> 16)) | ((data & mem_mask) >> 16);
r2956r2957
427436
428437READ32_HANDLER( sh2_internal_r )
429438{
439#ifdef USE_SH2DRC
440   offset &= 0x7f;
441#endif
430442   //  logerror("sh2_internal_r:  Read %08x (%x) @ %08x\n", 0xfffffe00+offset*4, offset, mem_mask);
431443   switch( offset )
432444   {
r2956r2957
513525      else
514526      {
515527         LOG(("SH-2 #%d assert nmi\n", cpu_getactivecpu()));
516         sh2_exception("sh2_set_irq_line/nmi", 16);
528
529         sh2_exception("Set IRQ line", 16);
530
531         #ifdef USE_SH2DRC
532         sh2->pending_nmi = 1;
533         #endif
517534      }
518535   }
519536   else
r2956r2957
531548      {
532549         LOG(("SH-2 #%d assert irq #%d\n", cpu_getactivecpu(), irqline));
533550         sh2->pending_irq |= 1 << irqline;
551         #ifdef USE_SH2DRC
552         sh2->test_irq = 1;
553         #else
534554         if(sh2->delay)
535555            sh2->test_irq = 1;
536556         else
537557            CHECK_PENDING_IRQ("sh2_set_irq_line");
558         #endif
538559      }
539560   }
540561}
r2956r2957
578599      }
579600   }
580601
581
582602   sh2->internal_irq_level = irq;
583603   sh2->internal_irq_vector = vector;
584604   sh2->test_irq = 1;
r2956r2957
620640      LOG(("SH-2 #%d nmi exception (autovector: $%x) after [%s]\n", cpu_getactivecpu(), vector, message));
621641   }
622642
643   #ifdef USE_SH2DRC
644   sh2->evec = RL( sh2->vbr + vector * 4 );
645   sh2->evec &= AM;
646   sh2->irqsr = sh2->sr;
647
648   /* set I flags in SR */
649   if (irqline > SH2_INT_15)
650      sh2->sr = sh2->sr | I;
651   else
652      sh2->sr = (sh2->sr & ~I) | (irqline << 4);
653
654//  printf("sh2_exception [%s] irqline %x evec %x save SR %x new SR %x\n", message, irqline, sh2->evec, sh2->irqsr, sh2->sr);
655   #else
623656   sh2->r[15] -= 4;
624657   WL( sh2->r[15], sh2->sr );      /* push SR onto stack */
625658   sh2->r[15] -= 4;
r2956r2957
634667   /* fetch PC */
635668   sh2->pc = RL( sh2->vbr + vector * 4 );
636669   change_pc(sh2->pc & AM);
670   #endif
637671}
638672
639void sh2_common_init(int index, int clock, const void *config, int (*irqcallback)(int))
673void sh2_common_init(int alloc, int index, int clock, const void *config, int (*irqcallback)(int))
640674{
641675   const struct sh2_config *conf = config;
642676
643   sh2 = (SH2 *)auto_malloc(sizeof(SH2));
644   memset(sh2, 0, sizeof(SH2));
677   if (alloc)
678   {
679      sh2 = (SH2 *)auto_malloc(sizeof(SH2));
680      memset(sh2, 0, sizeof(SH2));
681   }
645682
646683   sh2->timer = timer_alloc(sh2_timer_callback, NULL);
647684   timer_adjust_oneshot(sh2->timer, attotime_never, 0);
src/emu/cpu/sh2/sh2.c
r2956r2957
105105#include "sh2.h"
106106#include "sh2comn.h"
107107
108#ifndef USE_SH2DRC
109
108110/* speed up delay loops, bail out of tight loops */
109111#define BUSY_LOOP_HACKS    1
110112
r2956r2957
22512253   return DasmSH2( buffer, pc, (oprom[0] << 8) | oprom[1] );
22522254}
22532255
2256static void sh2_init(int index, int clock, const void *config, int (*irqcallback)(int))
2257{
2258   /* allocate the core memory */
2259   sh2 = auto_malloc(sizeof(SH2));
2260   memset(sh2, 0, sizeof(SH2));
2261
2262   /* initialize the common core parts */
2263   sh2_common_init(0, index, clock, config, irqcallback);
2264}
2265
22542266/**************************************************************************
22552267 * Generic set_info
22562268 **************************************************************************/
r2956r2957
23972409      case CPUINFO_PTR_SET_INFO:                  info->setinfo = sh2_set_info;         break;
23982410      case CPUINFO_PTR_GET_CONTEXT:               info->getcontext = sh2_get_context;      break;
23992411      case CPUINFO_PTR_SET_CONTEXT:               info->setcontext = sh2_set_context;      break;
2400      case CPUINFO_PTR_INIT:                     info->init = sh2_common_init;               break;
2412      case CPUINFO_PTR_INIT:                     info->init = sh2_init;               break;
24012413      case CPUINFO_PTR_RESET:                     info->reset = sh2_reset;            break;
24022414      case CPUINFO_PTR_EXECUTE:                  info->execute = sh2_execute;         break;
24032415      case CPUINFO_PTR_BURN:                     info->burn = NULL;                  break;
r2956r2957
24492461
24502462   }
24512463}
2464
2465#endif
src/emu/cpu/sh4/sh4.c
r2956r2957
20592059{
20602060   UINT32 imm = i & 0xff;
20612061
2062   sh4.ea = sh4.vbr + imm * 4;
2062   sh4.m[TRA] = imm;
2063   sh4.ssr = sh4.sr;
2064   sh4.spc = sh4.pc;
2065   sh4.sgr = sh4.r[15];
20632066
2064   sh4.r[15] -= 4;
2065   WL( sh4.r[15], sh4.sr );
2066   sh4.r[15] -= 4;
2067   WL( sh4.r[15], sh4.pc );
2067   sh4.sr |= MD;
2068   if ((Machine->debug_flags & DEBUG_FLAG_ENABLED) != 0)
2069      sh4_syncronize_register_bank((sh4.sr & sRB) >> 29);
2070   if (!(sh4.sr & sRB))
2071      sh4_change_register_bank(1);
2072   sh4.sr |= sRB;
2073   sh4.sr |= BL;
2074   sh4_exception_recompute();
20682075
2069   sh4.pc = RL( sh4.ea );
2076   sh4.m[EXPEVT] = 0x00000160;
2077   sh4.pc = sh4.vbr + 0x00000100;
20702078   change_pc(sh4.pc & AM);
20712079
20722080   sh4_icount -= 7;
r2956r2957
28912899
28922900/*  FMOV.S  @Rm+,FRn PR=0 SZ=0 1111nnnnmmmm1001 */
28932901/*  FMOV    @Rm+,DRn PR=0 SZ=1 1111nnn0mmmm1001 */
2902/*  FMOV    @Rm+,XDn PR=0 SZ=1 1111nnn1mmmm1001 */
28942903/*  FMOV    @Rm+,XDn PR=1      1111nnn1mmmm1001 */
28952904INLINE void FMOVMRIFR(UINT32 m,UINT32 n)
28962905{
r2956r2957
29312940
29322941/*  FMOV.S  FRm,@Rn PR=0 SZ=0 1111nnnnmmmm1010 */
29332942/*  FMOV    DRm,@Rn PR=0 SZ=1 1111nnnnmmm01010 */
2943/*  FMOV    XDm,@Rn PR=0 SZ=1 1111nnnnmmm11010 */
29342944/*  FMOV    XDm,@Rn PR=1      1111nnnnmmm11010 */
29352945INLINE void FMOVFRMR(UINT32 m,UINT32 n)
29362946{
r2956r2957
29462956#endif
29472957   } else {              /* PR = 0 */
29482958      if (sh4.fpu_sz) { /* SZ = 1 */
2949         m= m & 14;
2950         sh4.ea = sh4.r[n];
2951         WL( sh4.ea,sh4.fr[m] );
2952         WL( sh4.ea+4,sh4.fr[m+1] );
2959         if (m & 1) {
2960            m= m & 14;
2961            sh4.ea = sh4.r[n];
2962            WL( sh4.ea,sh4.xf[m] );
2963            WL( sh4.ea+4,sh4.xf[m+1] );
2964         } else {
2965            sh4.ea = sh4.r[n];
2966            WL( sh4.ea,sh4.fr[m] );
2967            WL( sh4.ea+4,sh4.fr[m+1] );
2968         }
29532969      } else {              /* SZ = 0 */
29542970         sh4.ea = sh4.r[n];
29552971         WL( sh4.ea,sh4.fr[m] );
r2956r2957
29592975
29602976/*  FMOV.S  FRm,@-Rn PR=0 SZ=0 1111nnnnmmmm1011 */
29612977/*  FMOV    DRm,@-Rn PR=0 SZ=1 1111nnnnmmm01011 */
2978/*  FMOV    XDm,@-Rn PR=0 SZ=1 1111nnnnmmm11011 */
29622979/*  FMOV    XDm,@-Rn PR=1      1111nnnnmmm11011 */
29632980INLINE void FMOVFRMDR(UINT32 m,UINT32 n)
29642981{
r2956r2957
29973014
29983015/*  FMOV.S  FRm,@(R0,Rn) PR=0 SZ=0 1111nnnnmmmm0111 */
29993016/*  FMOV    DRm,@(R0,Rn) PR=0 SZ=1 1111nnnnmmm00111 */
3017/*  FMOV    XDm,@(R0,Rn) PR=0 SZ=1 1111nnnnmmm10111 */
30003018/*  FMOV    XDm,@(R0,Rn) PR=1      1111nnnnmmm10111 */
30013019INLINE void FMOVFRS0(UINT32 m,UINT32 n)
30023020{
r2956r2957
30123030#endif
30133031   } else {              /* PR = 0 */
30143032      if (sh4.fpu_sz) { /* SZ = 1 */
3015         m= m & 14;
3016         sh4.ea = sh4.r[0] + sh4.r[n];
3017         WL( sh4.ea,sh4.fr[m] );
3018         WL( sh4.ea+4,sh4.fr[m+1] );
3033         if (m & 1) {
3034            m= m & 14;
3035            sh4.ea = sh4.r[0] + sh4.r[n];
3036            WL( sh4.ea,sh4.xf[m] );
3037            WL( sh4.ea+4,sh4.xf[m+1] );
3038         } else {
3039            sh4.ea = sh4.r[0] + sh4.r[n];
3040            WL( sh4.ea,sh4.fr[m] );
3041            WL( sh4.ea+4,sh4.fr[m+1] );
3042         }
30193043      } else {              /* SZ = 0 */
30203044         sh4.ea = sh4.r[0] + sh4.r[n];
30213045         WL( sh4.ea,sh4.fr[m] );
r2956r2957
30253049
30263050/*  FMOV.S  @(R0,Rm),FRn PR=0 SZ=0 1111nnnnmmmm0110 */
30273051/*  FMOV    @(R0,Rm),DRn PR=0 SZ=1 1111nnn0mmmm0110 */
3052/*  FMOV    @(R0,Rm),XDn PR=0 SZ=1 1111nnn1mmmm0110 */
30283053/*  FMOV    @(R0,Rm),XDn PR=1      1111nnn1mmmm0110 */
30293054INLINE void FMOVS0FR(UINT32 m,UINT32 n)
30303055{
r2956r2957
30403065#endif
30413066   } else {              /* PR = 0 */
30423067      if (sh4.fpu_sz) { /* SZ = 1 */
3043         n= n & 14;
3044         sh4.ea = sh4.r[0] + sh4.r[m];
3045         sh4.fr[n] = RL( sh4.ea );
3046         sh4.fr[n+1] = RL( sh4.ea+4 );
3068         if (n & 1) {
3069            n= n & 14;
3070            sh4.ea = sh4.r[0] + sh4.r[m];
3071            sh4.xf[n] = RL( sh4.ea );
3072            sh4.xf[n+1] = RL( sh4.ea+4 );
3073         } else {
3074            sh4.ea = sh4.r[0] + sh4.r[m];
3075            sh4.fr[n] = RL( sh4.ea );
3076            sh4.fr[n+1] = RL( sh4.ea+4 );
3077         }
30473078      } else {              /* SZ = 0 */
30483079         sh4.ea = sh4.r[0] + sh4.r[m];
30493080         sh4.fr[n] = RL( sh4.ea );
r2956r2957
33573388      n = n & 14;
33583389      if (FP_RFD(n) < 0)
33593390         return;
3360      FP_RFD(n) = sqrt(FP_RFD(n));
3391      FP_RFD(n) = sqrtf(FP_RFD(n));
33613392   } else {              /* PR = 0 */
33623393      if (FP_RFS(n) < 0)
33633394         return;
r2956r2957
34083439      sum[i] = 0;
34093440      for (j=0;j < 4;j++)
34103441         sum[i] += FP_XFS((j << 2) + i)*FP_RFS(n + j);
3442   }
3443   for (i = 0;i < 4;i++)
34113444      FP_RFS(n + i) = sum[i];
3412   }
34133445}
34143446
34153447INLINE void op1111(UINT16 opcode)
r2956r2957
36343666      else
36353667         opcode = cpu_readop16(WORD2_XOR_LE((UINT32)(sh4.pc & AM)));
36363668
3637      debugger_instruction_hook(Machine, sh4.pc);
3669      debugger_instruction_hook(Machine, sh4.pc & AM);
36383670
36393671      sh4.delay = 0;
36403672      sh4.pc += 2;
r2956r2957
51985230      case CPUINFO_STR_REGISTER + SH4_FPSCR:         sprintf(info->s, "FPSCR :%08X", sh4.fpscr); break;
51995231      case CPUINFO_STR_REGISTER + SH4_FPUL:         sprintf(info->s, "FPUL :%08X", sh4.fpul); break;
52005232#ifdef LSB_FIRST
5201      case CPUINFO_STR_REGISTER + SH4_FR0:         sprintf(info->s, "FR0  :%08X %01.2e", FP_RS2( 0),(double)FP_RFS2( 0)); break;
5202      case CPUINFO_STR_REGISTER + SH4_FR1:         sprintf(info->s, "FR1  :%08X %01.2e", FP_RS2( 1),(double)FP_RFS2( 1)); break;
5203      case CPUINFO_STR_REGISTER + SH4_FR2:         sprintf(info->s, "FR2  :%08X %01.2e", FP_RS2( 2),(double)FP_RFS2( 2)); break;
5204      case CPUINFO_STR_REGISTER + SH4_FR3:         sprintf(info->s, "FR3  :%08X %01.2e", FP_RS2( 3),(double)FP_RFS2( 3)); break;
5205      case CPUINFO_STR_REGISTER + SH4_FR4:         sprintf(info->s, "FR4  :%08X %01.2e", FP_RS2( 4),(double)FP_RFS2( 4)); break;
5206      case CPUINFO_STR_REGISTER + SH4_FR5:         sprintf(info->s, "FR5  :%08X %01.2e", FP_RS2( 5),(double)FP_RFS2( 5)); break;
5207      case CPUINFO_STR_REGISTER + SH4_FR6:         sprintf(info->s, "FR6  :%08X %01.2e", FP_RS2( 6),(double)FP_RFS2( 6)); break;
5208      case CPUINFO_STR_REGISTER + SH4_FR7:         sprintf(info->s, "FR7  :%08X %01.2e", FP_RS2( 7),(double)FP_RFS2( 7)); break;
5209      case CPUINFO_STR_REGISTER + SH4_FR8:         sprintf(info->s, "FR8  :%08X %01.2e", FP_RS2( 8),(double)FP_RFS2( 8)); break;
5210      case CPUINFO_STR_REGISTER + SH4_FR9:         sprintf(info->s, "FR9  :%08X %01.2e", FP_RS2( 9),(double)FP_RFS2( 9)); break;
5211      case CPUINFO_STR_REGISTER + SH4_FR10:         sprintf(info->s, "FR10 :%08X %01.2e", FP_RS2(10),(double)FP_RFS2(10)); break;
5212      case CPUINFO_STR_REGISTER + SH4_FR11:         sprintf(info->s, "FR11 :%08X %01.2e", FP_RS2(11),(double)FP_RFS2(11)); break;
5213      case CPUINFO_STR_REGISTER + SH4_FR12:         sprintf(info->s, "FR12 :%08X %01.2e", FP_RS2(12),(double)FP_RFS2(12)); break;
5214      case CPUINFO_STR_REGISTER + SH4_FR13:         sprintf(info->s, "FR13 :%08X %01.2e", FP_RS2(13),(double)FP_RFS2(13)); break;
5215      case CPUINFO_STR_REGISTER + SH4_FR14:         sprintf(info->s, "FR14 :%08X %01.2e", FP_RS2(14),(double)FP_RFS2(14)); break;
5216      case CPUINFO_STR_REGISTER + SH4_FR15:         sprintf(info->s, "FR15 :%08X %01.2e", FP_RS2(15),(double)FP_RFS2(15)); break;
5217      case CPUINFO_STR_REGISTER + SH4_XF0:         sprintf(info->s, "XF0  :%08X %01.2e", FP_XS2( 0),(double)FP_XFS2( 0)); break;
5218      case CPUINFO_STR_REGISTER + SH4_XF1:         sprintf(info->s, "XF1  :%08X %01.2e", FP_XS2( 1),(double)FP_XFS2( 1)); break;
5219      case CPUINFO_STR_REGISTER + SH4_XF2:         sprintf(info->s, "XF2  :%08X %01.2e", FP_XS2( 2),(double)FP_XFS2( 2)); break;
5220      case CPUINFO_STR_REGISTER + SH4_XF3:         sprintf(info->s, "XF3  :%08X %01.2e", FP_XS2( 3),(double)FP_XFS2( 3)); break;
5221      case CPUINFO_STR_REGISTER + SH4_XF4:         sprintf(info->s, "XF4  :%08X %01.2e", FP_XS2( 4),(double)FP_XFS2( 4)); break;
5222      case CPUINFO_STR_REGISTER + SH4_XF5:         sprintf(info->s, "XF5  :%08X %01.2e", FP_XS2( 5),(double)FP_XFS2( 5)); break;
5223      case CPUINFO_STR_REGISTER + SH4_XF6:         sprintf(info->s, "XF6  :%08X %01.2e", FP_XS2( 6),(double)FP_XFS2( 6)); break;
5224      case CPUINFO_STR_REGISTER + SH4_XF7:         sprintf(info->s, "XF7  :%08X %01.2e", FP_XS2( 7),(double)FP_XFS2( 7)); break;
5225      case CPUINFO_STR_REGISTER + SH4_XF8:         sprintf(info->s, "XF8  :%08X %01.2e", FP_XS2( 8),(double)FP_XFS2( 8)); break;
5226      case CPUINFO_STR_REGISTER + SH4_XF9:         sprintf(info->s, "XF9  :%08X %01.2e", FP_XS2( 9),(double)FP_XFS2( 9)); break;
5227      case CPUINFO_STR_REGISTER + SH4_XF10:         sprintf(info->s, "XF10 :%08X %01.2e", FP_XS2(10),(double)FP_XFS2(10)); break;
5228      case CPUINFO_STR_REGISTER + SH4_XF11:         sprintf(info->s, "XF11 :%08X %01.2e", FP_XS2(11),(double)FP_XFS2(11)); break;
5229      case CPUINFO_STR_REGISTER + SH4_XF12:         sprintf(info->s, "XF12 :%08X %01.2e", FP_XS2(12),(double)FP_XFS2(12)); break;
5230      case CPUINFO_STR_REGISTER + SH4_XF13:         sprintf(info->s, "XF13 :%08X %01.2e", FP_XS2(13),(double)FP_XFS2(13)); break;
5231      case CPUINFO_STR_REGISTER + SH4_XF14:         sprintf(info->s, "XF14 :%08X %01.2e", FP_XS2(14),(double)FP_XFS2(14)); break;
5232      case CPUINFO_STR_REGISTER + SH4_XF15:         sprintf(info->s, "XF15 :%08X %01.2e", FP_XS2(15),(double)FP_XFS2(15)); break;
5233      case CPUINFO_STR_REGISTER + SH4_FR0:         sprintf(info->s, "FR0  :%08X %f", FP_RS2( 0),(double)FP_RFS2( 0)); break;
5234      case CPUINFO_STR_REGISTER + SH4_FR1:         sprintf(info->s, "FR1  :%08X %f", FP_RS2( 1),(double)FP_RFS2( 1)); break;
5235      case CPUINFO_STR_REGISTER + SH4_FR2:         sprintf(info->s, "FR2  :%08X %f", FP_RS2( 2),(double)FP_RFS2( 2)); break;
5236      case CPUINFO_STR_REGISTER + SH4_FR3:         sprintf(info->s, "FR3  :%08X %f", FP_RS2( 3),(double)FP_RFS2( 3)); break;
5237      case CPUINFO_STR_REGISTER + SH4_FR4:         sprintf(info->s, "FR4  :%08X %f", FP_RS2( 4),(double)FP_RFS2( 4)); break;
5238      case CPUINFO_STR_REGISTER + SH4_FR5:         sprintf(info->s, "FR5  :%08X %f", FP_RS2( 5),(double)FP_RFS2( 5)); break;
5239      case CPUINFO_STR_REGISTER + SH4_FR6:         sprintf(info->s, "FR6  :%08X %f", FP_RS2( 6),(double)FP_RFS2( 6)); break;
5240      case CPUINFO_STR_REGISTER + SH4_FR7:         sprintf(info->s, "FR7  :%08X %f", FP_RS2( 7),(double)FP_RFS2( 7)); break;
5241      case CPUINFO_STR_REGISTER + SH4_FR8:         sprintf(info->s, "FR8  :%08X %f", FP_RS2( 8),(double)FP_RFS2( 8)); break;
5242      case CPUINFO_STR_REGISTER + SH4_FR9:         sprintf(info->s, "FR9  :%08X %f", FP_RS2( 9),(double)FP_RFS2( 9)); break;
5243      case CPUINFO_STR_REGISTER + SH4_FR10:         sprintf(info->s, "FR10 :%08X %f", FP_RS2(10),(double)FP_RFS2(10)); break;
5244      case CPUINFO_STR_REGISTER + SH4_FR11:         sprintf(info->s, "FR11 :%08X %f", FP_RS2(11),(double)FP_RFS2(11)); break;
5245      case CPUINFO_STR_REGISTER + SH4_FR12:         sprintf(info->s, "FR12 :%08X %f", FP_RS2(12),(double)FP_RFS2(12)); break;
5246      case CPUINFO_STR_REGISTER + SH4_FR13:         sprintf(info->s, "FR13 :%08X %f", FP_RS2(13),(double)FP_RFS2(13)); break;
5247      case CPUINFO_STR_REGISTER + SH4_FR14:         sprintf(info->s, "FR14 :%08X %f", FP_RS2(14),(double)FP_RFS2(14)); break;
5248      case CPUINFO_STR_REGISTER + SH4_FR15:         sprintf(info->s, "FR15 :%08X %f", FP_RS2(15),(double)FP_RFS2(15)); break;
5249      case CPUINFO_STR_REGISTER + SH4_XF0:         sprintf(info->s, "XF0  :%08X %f", FP_XS2( 0),(double)FP_XFS2( 0)); break;
5250      case CPUINFO_STR_REGISTER + SH4_XF1:         sprintf(info->s, "XF1  :%08X %f", FP_XS2( 1),(double)FP_XFS2( 1)); break;
5251      case CPUINFO_STR_REGISTER + SH4_XF2:         sprintf(info->s, "XF2  :%08X %f", FP_XS2( 2),(double)FP_XFS2( 2)); break;
5252      case CPUINFO_STR_REGISTER + SH4_XF3:         sprintf(info->s, "XF3  :%08X %f", FP_XS2( 3),(double)FP_XFS2( 3)); break;
5253      case CPUINFO_STR_REGISTER + SH4_XF4:         sprintf(info->s, "XF4  :%08X %f", FP_XS2( 4),(double)FP_XFS2( 4)); break;
5254      case CPUINFO_STR_REGISTER + SH4_XF5:         sprintf(info->s, "XF5  :%08X %f", FP_XS2( 5),(double)FP_XFS2( 5)); break;
5255      case CPUINFO_STR_REGISTER + SH4_XF6:         sprintf(info->s, "XF6  :%08X %f", FP_XS2( 6),(double)FP_XFS2( 6)); break;
5256      case CPUINFO_STR_REGISTER + SH4_XF7:         sprintf(info->s, "XF7  :%08X %f", FP_XS2( 7),(double)FP_XFS2( 7)); break;
5257      case CPUINFO_STR_REGISTER + SH4_XF8:         sprintf(info->s, "XF8  :%08X %f", FP_XS2( 8),(double)FP_XFS2( 8)); break;
5258      case CPUINFO_STR_REGISTER + SH4_XF9:         sprintf(info->s, "XF9  :%08X %f", FP_XS2( 9),(double)FP_XFS2( 9)); break;
5259      case CPUINFO_STR_REGISTER + SH4_XF10:         sprintf(info->s, "XF10 :%08X %f", FP_XS2(10),(double)FP_XFS2(10)); break;
5260      case CPUINFO_STR_REGISTER + SH4_XF11:         sprintf(info->s, "XF11 :%08X %f", FP_XS2(11),(double)FP_XFS2(11)); break;
5261      case CPUINFO_STR_REGISTER + SH4_XF12:         sprintf(info->s, "XF12 :%08X %f", FP_XS2(12),(double)FP_XFS2(12)); break;
5262      case CPUINFO_STR_REGISTER + SH4_XF13:         sprintf(info->s, "XF13 :%08X %f", FP_XS2(13),(double)FP_XFS2(13)); break;
5263      case CPUINFO_STR_REGISTER + SH4_XF14:         sprintf(info->s, "XF14 :%08X %f", FP_XS2(14),(double)FP_XFS2(14)); break;
5264      case CPUINFO_STR_REGISTER + SH4_XF15:         sprintf(info->s, "XF15 :%08X %f", FP_XS2(15),(double)FP_XFS2(15)); break;
52335265#else
5234      case CPUINFO_STR_REGISTER + SH4_FR0:         sprintf(info->s, "FR0  :%08X %01.2e", FP_RS( 0),(double)FP_RFS( 0)); break;
5235      case CPUINFO_STR_REGISTER + SH4_FR1:         sprintf(info->s, "FR1  :%08X %01.2e", FP_RS( 1),(double)FP_RFS( 1)); break;
5236      case CPUINFO_STR_REGISTER + SH4_FR2:         sprintf(info->s, "FR2  :%08X %01.2e", FP_RS( 2),(double)FP_RFS( 2)); break;
5237      case CPUINFO_STR_REGISTER + SH4_FR3:         sprintf(info->s, "FR3  :%08X %01.2e", FP_RS( 3),(double)FP_RFS( 3)); break;
5238      case CPUINFO_STR_REGISTER + SH4_FR4:         sprintf(info->s, "FR4  :%08X %01.2e", FP_RS( 4),(double)FP_RFS( 4)); break;
5239      case CPUINFO_STR_REGISTER + SH4_FR5:         sprintf(info->s, "FR5  :%08X %01.2e", FP_RS( 5),(double)FP_RFS( 5)); break;
5240      case CPUINFO_STR_REGISTER + SH4_FR6:         sprintf(info->s, "FR6  :%08X %01.2e", FP_RS( 6),(double)FP_RFS( 6)); break;
5241      case CPUINFO_STR_REGISTER + SH4_FR7:         sprintf(info->s, "FR7  :%08X %01.2e", FP_RS( 7),(double)FP_RFS( 7)); break;
5242      case CPUINFO_STR_REGISTER + SH4_FR8:         sprintf(info->s, "FR8  :%08X %01.2e", FP_RS( 8),(double)FP_RFS( 8)); break;
5243      case CPUINFO_STR_REGISTER + SH4_FR9:         sprintf(info->s, "FR9  :%08X %01.2e", FP_RS( 9),(double)FP_RFS( 9)); break;
5244      case CPUINFO_STR_REGISTER + SH4_FR10:         sprintf(info->s, "FR10 :%08X %01.2e", FP_RS(10),(double)FP_RFS(10)); break;
5245      case CPUINFO_STR_REGISTER + SH4_FR11:         sprintf(info->s, "FR11 :%08X %01.2e", FP_RS(11),(double)FP_RFS(11)); break;
5246      case CPUINFO_STR_REGISTER + SH4_FR12:         sprintf(info->s, "FR12 :%08X %01.2e", FP_RS(12),(double)FP_RFS(12)); break;
5247      case CPUINFO_STR_REGISTER + SH4_FR13:         sprintf(info->s, "FR13 :%08X %01.2e", FP_RS(13),(double)FP_RFS(13)); break;
5248      case CPUINFO_STR_REGISTER + SH4_FR14:         sprintf(info->s, "FR14 :%08X %01.2e", FP_RS(14),(double)FP_RFS(14)); break;
5249      case CPUINFO_STR_REGISTER + SH4_FR15:         sprintf(info->s, "FR15 :%08X %01.2e", FP_RS(15),(double)FP_RFS(15)); break;
5250      case CPUINFO_STR_REGISTER + SH4_XF0:         sprintf(info->s, "XF0  :%08X %01.2e", FP_XS( 0),(double)FP_XFS( 0)); break;
5251      case CPUINFO_STR_REGISTER + SH4_XF1:         sprintf(info->s, "XF1  :%08X %01.2e", FP_XS( 1),(double)FP_XFS( 1)); break;
5252      case CPUINFO_STR_REGISTER + SH4_XF2:         sprintf(info->s, "XF2  :%08X %01.2e", FP_XS( 2),(double)FP_XFS( 2)); break;
5253      case CPUINFO_STR_REGISTER + SH4_XF3:         sprintf(info->s, "XF3  :%08X %01.2e", FP_XS( 3),(double)FP_XFS( 3)); break;
5254      case CPUINFO_STR_REGISTER + SH4_XF4:         sprintf(info->s, "XF4  :%08X %01.2e", FP_XS( 4),(double)FP_XFS( 4)); break;
5255      case CPUINFO_STR_REGISTER + SH4_XF5:         sprintf(info->s, "XF5  :%08X %01.2e", FP_XS( 5),(double)FP_XFS( 5)); break;
5256      case CPUINFO_STR_REGISTER + SH4_XF6:         sprintf(info->s, "XF6  :%08X %01.2e", FP_XS( 6),(double)FP_XFS( 6)); break;
5257      case CPUINFO_STR_REGISTER + SH4_XF7:         sprintf(info->s, "XF7  :%08X %01.2e", FP_XS( 7),(double)FP_XFS( 7)); break;
5258      case CPUINFO_STR_REGISTER + SH4_XF8:         sprintf(info->s, "XF8  :%08X %01.2e", FP_XS( 8),(double)FP_XFS( 8)); break;
5259      case CPUINFO_STR_REGISTER + SH4_XF9:         sprintf(info->s, "XF9  :%08X %01.2e", FP_XS( 9),(double)FP_XFS( 9)); break;
5260      case CPUINFO_STR_REGISTER + SH4_XF10:         sprintf(info->s, "XF10 :%08X %01.2e", FP_XS(10),(double)FP_XFS(10)); break;
5261      case CPUINFO_STR_REGISTER + SH4_XF11:         sprintf(info->s, "XF11 :%08X %01.2e", FP_XS(11),(double)FP_XFS(11)); break;
5262      case CPUINFO_STR_REGISTER + SH4_XF12:         sprintf(info->s, "XF12 :%08X %01.2e", FP_XS(12),(double)FP_XFS(12)); break;
5263      case CPUINFO_STR_REGISTER + SH4_XF13:         sprintf(info->s, "XF13 :%08X %01.2e", FP_XS(13),(double)FP_XFS(13)); break;
5264      case CPUINFO_STR_REGISTER + SH4_XF14:         sprintf(info->s, "XF14 :%08X %01.2e", FP_XS(14),(double)FP_XFS(14)); break;
5265      case CPUINFO_STR_REGISTER + SH4_XF15:         sprintf(info->s, "XF15 :%08X %01.2e", FP_XS(15),(double)FP_XFS(15)); break;
5266      case CPUINFO_STR_REGISTER + SH4_FR0:         sprintf(info->s, "FR0  :%08X %f", FP_RS( 0),(double)FP_RFS( 0)); break;
5267      case CPUINFO_STR_REGISTER + SH4_FR1:         sprintf(info->s, "FR1  :%08X %f", FP_RS( 1),(double)FP_RFS( 1)); break;
5268      case CPUINFO_STR_REGISTER + SH4_FR2:         sprintf(info->s, "FR2  :%08X %f", FP_RS( 2),(double)FP_RFS( 2)); break;
5269      case CPUINFO_STR_REGISTER + SH4_FR3:         sprintf(info->s, "FR3  :%08X %f", FP_RS( 3),(double)FP_RFS( 3)); break;
5270      case CPUINFO_STR_REGISTER + SH4_FR4:         sprintf(info->s, "FR4  :%08X %f", FP_RS( 4),(double)FP_RFS( 4)); break;
5271      case CPUINFO_STR_REGISTER + SH4_FR5:         sprintf(info->s, "FR5  :%08X %f", FP_RS( 5),(double)FP_RFS( 5)); break;
5272      case CPUINFO_STR_REGISTER + SH4_FR6:         sprintf(info->s, "FR6  :%08X %f", FP_RS( 6),(double)FP_RFS( 6)); break;
5273      case CPUINFO_STR_REGISTER + SH4_FR7:         sprintf(info->s, "FR7  :%08X %f", FP_RS( 7),(double)FP_RFS( 7)); break;
5274      case CPUINFO_STR_REGISTER + SH4_FR8:         sprintf(info->s, "FR8  :%08X %f", FP_RS( 8),(double)FP_RFS( 8)); break;
5275      case CPUINFO_STR_REGISTER + SH4_FR9:         sprintf(info->s, "FR9  :%08X %f", FP_RS( 9),(double)FP_RFS( 9)); break;
5276      case CPUINFO_STR_REGISTER + SH4_FR10:         sprintf(info->s, "FR10 :%08X %f", FP_RS(10),(double)FP_RFS(10)); break;
5277      case CPUINFO_STR_REGISTER + SH4_FR11:         sprintf(info->s, "FR11 :%08X %f", FP_RS(11),(double)FP_RFS(11)); break;
5278      case CPUINFO_STR_REGISTER + SH4_FR12:         sprintf(info->s, "FR12 :%08X %f", FP_RS(12),(double)FP_RFS(12)); break;
5279      case CPUINFO_STR_REGISTER + SH4_FR13:         sprintf(info->s, "FR13 :%08X %f", FP_RS(13),(double)FP_RFS(13)); break;
5280      case CPUINFO_STR_REGISTER + SH4_FR14:         sprintf(info->s, "FR14 :%08X %f", FP_RS(14),(double)FP_RFS(14)); break;
5281      case CPUINFO_STR_REGISTER + SH4_FR15:         sprintf(info->s, "FR15 :%08X %f", FP_RS(15),(double)FP_RFS(15)); break;
5282      case CPUINFO_STR_REGISTER + SH4_XF0:         sprintf(info->s, "XF0  :%08X %f", FP_XS( 0),(double)FP_XFS( 0)); break;
5283      case CPUINFO_STR_REGISTER + SH4_XF1:         sprintf(info->s, "XF1  :%08X %f", FP_XS( 1),(double)FP_XFS( 1)); break;
5284      case CPUINFO_STR_REGISTER + SH4_XF2:         sprintf(info->s, "XF2  :%08X %f", FP_XS( 2),(double)FP_XFS( 2)); break;
5285      case CPUINFO_STR_REGISTER + SH4_XF3:         sprintf(info->s, "XF3  :%08X %f", FP_XS( 3),(double)FP_XFS( 3)); break;
5286      case CPUINFO_STR_REGISTER + SH4_XF4:         sprintf(info->s, "XF4  :%08X %f", FP_XS( 4),(double)FP_XFS( 4)); break;
5287      case CPUINFO_STR_REGISTER + SH4_XF5:         sprintf(info->s, "XF5  :%08X %f", FP_XS( 5),(double)FP_XFS( 5)); break;
5288      case CPUINFO_STR_REGISTER + SH4_XF6:         sprintf(info->s, "XF6  :%08X %f", FP_XS( 6),(double)FP_XFS( 6)); break;
5289      case CPUINFO_STR_REGISTER + SH4_XF7:         sprintf(info->s, "XF7  :%08X %f", FP_XS( 7),(double)FP_XFS( 7)); break;
5290      case CPUINFO_STR_REGISTER + SH4_XF8:         sprintf(info->s, "XF8  :%08X %f", FP_XS( 8),(double)FP_XFS( 8)); break;
5291      case CPUINFO_STR_REGISTER + SH4_XF9:         sprintf(info->s, "XF9  :%08X %f", FP_XS( 9),(double)FP_XFS( 9)); break;
5292      case CPUINFO_STR_REGISTER + SH4_XF10:         sprintf(info->s, "XF10 :%08X %f", FP_XS(10),(double)FP_XFS(10)); break;
5293      case CPUINFO_STR_REGISTER + SH4_XF11:         sprintf(info->s, "XF11 :%08X %f", FP_XS(11),(double)FP_XFS(11)); break;
5294      case CPUINFO_STR_REGISTER + SH4_XF12:         sprintf(info->s, "XF12 :%08X %f", FP_XS(12),(double)FP_XFS(12)); break;
5295      case CPUINFO_STR_REGISTER + SH4_XF13:         sprintf(info->s, "XF13 :%08X %f", FP_XS(13),(double)FP_XFS(13)); break;
5296      case CPUINFO_STR_REGISTER + SH4_XF14:         sprintf(info->s, "XF14 :%08X %f", FP_XS(14),(double)FP_XFS(14)); break;
5297      case CPUINFO_STR_REGISTER + SH4_XF15:         sprintf(info->s, "XF15 :%08X %f", FP_XS(15),(double)FP_XFS(15)); break; //%01.2e
52665298#endif
52675299      case CPUINFO_PTR_SH4_FTCSR_READ_CALLBACK:      info->f = (genf*)sh4.ftcsr_read_callback; break;
52685300
src/emu/cpu/sh4/sh4dasm.c
r2956r2957
568568
569569static UINT32 op1001(char *buffer, UINT32 pc, UINT16 opcode)
570570{
571   sprintf(buffer, "MOV.W   @($%04X,PC),%s", (opcode & 0xff) * 2, regname[Rn]);
571UINT32 ea=(pc+((opcode & 0xff) * 2)+2);
572
573   sprintf(buffer, "MOV.W   @($%04X,PC),%s [%08X]", (opcode & 0xff) * 2, regname[Rn], ea);
572574   return 0;
573575}
574576
r2956r2957
612614      sprintf(buffer, "MOV.L   @($%04X,GBR),R0", (opcode & 0xff) * 4);
613615      break;
614616   case  7:
615      sprintf(buffer, "MOVA    @($%04X,PC),R0", (opcode & 0xff) * 4);
617      sprintf(buffer, "MOVA    @($%04X,PC),R0 [%08X]", (opcode & 0xff) * 4, ((pc + 2) & ~3) + (opcode & 0xff) * 4);
616618      break;
617619   case  8:
618620      sprintf(buffer, "TST     #$%02X,R0", opcode & 0xff);
r2956r2957
644646
645647static UINT32 op1101(char *buffer, UINT32 pc, UINT16 opcode)
646648{
647   sprintf(buffer, "MOV.L   @($%02X,PC),%s", (opcode * 4) & 0xff, regname[Rn]);
649UINT32 ea=((pc + 2) & ~3) + (opcode & 0xff) * 4;
650
651   sprintf(buffer, "MOV.L   @($%04X,PC),%s [%08X]", (opcode & 0xff) * 4, regname[Rn], ea);
648652   return 0;
649653}
650654
r2956r2957
737741               sprintf(buffer, "FCNVDS  D%s, FPUL", regname[Rn]);
738742               break;
739743            case 0xE0:
740               sprintf(buffer, "FIPR    FV%d, FV%d", Rn << 2, Rn & 12);
744               sprintf(buffer, "FIPR    FV%d, FV%d", (Rn & 3) << 2, Rn & 12);
741745               break;
742746            case 0xF0:
743747               if (opcode & 0x100) {
r2956r2957
758762                     sprintf(buffer, "FTRV    XMTRX, FV%d", Rn & 12);
759763                  }
760764               } else {
761                  sprintf(buffer, "FSSCA    FPUL, F%d", Rn & 14);
765                  sprintf(buffer, "FSCA   FPUL, F%s", regname[Rn & 14]);
762766               }
763767               break;
764768            default:
src/emu/cpu/i960/i960.c
r2956r2957
15661566         case 0x0: // cvtri
15671567            i960_icount -= 33;
15681568            t1f = get_1_rif(opcode);
1569            set_ri(opcode, (INT32)t1f);
1569            // apply rounding mode
1570            // we do this a little indirectly to avoid some odd GCC warnings
1571            t2f = 0.0;
1572            switch((i960.AC>>30)&3)
1573            {
1574               case 0: t2f = floor(t1f+0.5); break;
1575               case 1: t2f = floor(t1f); break;
1576               case 2: t2f = ceil(t1f); break;
1577               case 3: t2f = t1f; break;
1578            }
1579            set_ri(opcode, (INT32)t2f);
15701580            break;
15711581
15721582         case 0x2: // cvtzri
src/emu/cpu/konami/konami.c
r2956r2957
387387static void konami_init(int index, int clock, const void *config, int (*irqcallback)(int))
388388{
389389   konami.irq_callback = irqcallback;
390
391   state_save_register_item("KONAMI", index, PC);
392   state_save_register_item("KONAMI", index, U);
393   state_save_register_item("KONAMI", index, S);
394   state_save_register_item("KONAMI", index, X);
395   state_save_register_item("KONAMI", index, Y);
396   state_save_register_item("KONAMI", index, D);
397   state_save_register_item("KONAMI", index, DP);
398   state_save_register_item("KONAMI", index, CC);
399   state_save_register_item("KONAMI", index, konami.int_state);
400   state_save_register_item("KONAMI", index, konami.nmi_state);
401   state_save_register_item("KONAMI", index, konami.irq_state[0]);
402   state_save_register_item("KONAMI", index, konami.irq_state[1]);
390403}
391404
392405static void konami_reset(void)
r2956r2957
458471   }
459472}
460473
461#if 0
462/****************************************************************************
463 * Save CPU state
464 ****************************************************************************/
465static void state_save(void *file, const char *module)
466{
467   int cpu = cpu_getactivecpu();
468   state_save_register_item(file, cpu, module, PC);
469   state_save_register_item(file, cpu, module, U);
470   state_save_register_item(file, cpu, module, S);
471   state_save_register_item(file, cpu, module, X);
472   state_save_register_item(file, cpu, module, Y);
473   state_save_register_item(file, cpu, module, DP);
474   state_save_register_item(file, cpu, module, CC);
475   state_save_register_item(file, cpu, module, konami.int_state);
476   state_save_register_item(file, cpu, module, konami.nmi_state);
477   state_save_register_item(file, cpu, module, konami.irq_state[0]);
478   state_save_register_item(file, cpu, module, konami.irq_state[1]);
479}
480#endif
481
482474/* includes the static function prototypes and the master opcode table */
483475#include "konamtbl.c"
484476
src/emu/uigfx.c
r2956r2957
1010*********************************************************************/
1111
1212#include "ui.h"
13#include "uiinput.h"
1314#include "render.h"
1415#include "rendfont.h"
1516#include "rendutil.h"
r2956r2957
201202   }
202203
203204   /* handle keys */
204   if (input_ui_pressed(machine, IPT_UI_SELECT))
205   if (ui_input_pressed(machine, IPT_UI_SELECT))
205206   {
206207      state->mode = (state->mode + 1) % 3;
207208      state->bitmap_dirty = TRUE;
208209   }
209210
210   if (input_ui_pressed(machine, IPT_UI_PAUSE))
211   if (ui_input_pressed(machine, IPT_UI_PAUSE))
211212      mame_pause(machine, !mame_is_paused(machine));
212213
213   if (input_ui_pressed(machine, IPT_UI_CANCEL) || input_ui_pressed(machine, IPT_UI_SHOW_GFX))
214   if (ui_input_pressed(machine, IPT_UI_CANCEL) || ui_input_pressed(machine, IPT_UI_SHOW_GFX))
214215      goto cancel;
215216
216217   return uistate;
r2956r2957
359360   int total;
360361
361362   /* handle zoom (minus,plus) */
362   if (input_ui_pressed(machine, IPT_UI_ZOOM_OUT))
363   if (ui_input_pressed(machine, IPT_UI_ZOOM_OUT))
363364      state->palette.count /= 2;
364   if (input_ui_pressed(machine, IPT_UI_ZOOM_IN))
365   if (ui_input_pressed(machine, IPT_UI_ZOOM_IN))
365366      state->palette.count *= 2;
366367
367368   /* clamp within range */
r2956r2957
371372      state->palette.count = 64;
372373
373374   /* handle colormap selection (open bracket,close bracket) */
374   if (input_ui_pressed(machine, IPT_UI_PREV_GROUP))
375   if (ui_input_pressed(machine, IPT_UI_PREV_GROUP))
375376      state->palette.which--;
376   if (input_ui_pressed(machine, IPT_UI_NEXT_GROUP))
377   if (ui_input_pressed(machine, IPT_UI_NEXT_GROUP))
377378      state->palette.which++;
378379
379380   /* clamp within range */
r2956r2957
390391   screencount = rowcount * rowcount;
391392
392393   /* handle keyboard navigation */
393   if (input_ui_pressed_repeat(machine, IPT_UI_UP, 4))
394   if (ui_input_pressed_repeat(machine, IPT_UI_UP, 4))
394395      state->palette.offset -= rowcount;
395   if (input_ui_pressed_repeat(machine, IPT_UI_DOWN, 4))
396   if (ui_input_pressed_repeat(machine, IPT_UI_DOWN, 4))
396397      state->palette.offset += rowcount;
397   if (input_ui_pressed_repeat(machine, IPT_UI_PAGE_UP, 6))
398   if (ui_input_pressed_repeat(machine, IPT_UI_PAGE_UP, 6))
398399      state->palette.offset -= screencount;
399   if (input_ui_pressed_repeat(machine, IPT_UI_PAGE_DOWN, 6))
400   if (ui_input_pressed_repeat(machine, IPT_UI_PAGE_DOWN, 6))
400401      state->palette.offset += screencount;
401   if (input_ui_pressed_repeat(machine, IPT_UI_HOME, 4))
402   if (ui_input_pressed_repeat(machine, IPT_UI_HOME, 4))
402403      state->palette.offset = 0;
403   if (input_ui_pressed_repeat(machine, IPT_UI_END, 4))
404   if (ui_input_pressed_repeat(machine, IPT_UI_END, 4))
404405      state->palette.offset = total;
405406
406407   /* clamp within range */
r2956r2957
594595   int temp, set;
595596
596597   /* handle gfxset selection (open bracket,close bracket) */
597   if (input_ui_pressed(machine, IPT_UI_PREV_GROUP))
598   if (ui_input_pressed(machine, IPT_UI_PREV_GROUP))
598599   {
599600      for (temp = state->gfxset.set - 1; temp >= 0; temp--)
600601         if (Machine->gfx[temp] != NULL)
r2956r2957
602603      if (temp >= 0)
603604         state->gfxset.set = temp;
604605   }
605   if (input_ui_pressed(machine, IPT_UI_NEXT_GROUP))
606   if (ui_input_pressed(machine, IPT_UI_NEXT_GROUP))
606607   {
607608      for (temp = state->gfxset.set + 1; temp < MAX_GFX_ELEMENTS; temp++)
608609         if (Machine->gfx[temp] != NULL)
r2956r2957
616617   gfx = Machine->gfx[set];
617618
618619   /* handle cells per line (minus,plus) */
619   if (input_ui_pressed(machine, IPT_UI_ZOOM_OUT))
620   if (ui_input_pressed(machine, IPT_UI_ZOOM_OUT))
620621      state->gfxset.count[set] = xcells - 1;
621   if (input_ui_pressed(machine, IPT_UI_ZOOM_IN))
622   if (ui_input_pressed(machine, IPT_UI_ZOOM_IN))
622623      state->gfxset.count[set] = xcells + 1;
623624
624625   /* clamp within range */
r2956r2957
628629      state->gfxset.count[set] = 32;
629630
630631   /* handle rotation (R) */
631   if (input_ui_pressed(machine, IPT_UI_ROTATE))
632   if (ui_input_pressed(machine, IPT_UI_ROTATE))
632633      state->gfxset.rotate[set] = orientation_add(ROT90, state->gfxset.rotate[set]);
633634
634635   /* handle navigation within the cells (up,down,pgup,pgdown) */
635   if (input_ui_pressed_repeat(machine, IPT_UI_UP, 4))
636   if (ui_input_pressed_repeat(machine, IPT_UI_UP, 4))
636637      state->gfxset.offset[set] -= xcells;
637   if (input_ui_pressed_repeat(machine, IPT_UI_DOWN, 4))
638   if (ui_input_pressed_repeat(machine, IPT_UI_DOWN, 4))
638639      state->gfxset.offset[set] += xcells;
639   if (input_ui_pressed_repeat(machine, IPT_UI_PAGE_UP, 6))
640   if (ui_input_pressed_repeat(machine, IPT_UI_PAGE_UP, 6))
640641      state->gfxset.offset[set] -= xcells * ycells;
641   if (input_ui_pressed_repeat(machine, IPT_UI_PAGE_DOWN, 6))
642   if (ui_input_pressed_repeat(machine, IPT_UI_PAGE_DOWN, 6))
642643      state->gfxset.offset[set] += xcells * ycells;
643   if (input_ui_pressed_repeat(machine, IPT_UI_HOME, 4))
644   if (ui_input_pressed_repeat(machine, IPT_UI_HOME, 4))
644645      state->gfxset.offset[set] = 0;
645   if (input_ui_pressed_repeat(machine, IPT_UI_END, 4))
646   if (ui_input_pressed_repeat(machine, IPT_UI_END, 4))
646647      state->gfxset.offset[set] = gfx->total_elements;
647648
648649   /* clamp within range */
r2956r2957
652653      state->gfxset.offset[set] = 0;
653654
654655   /* handle color selection (left,right) */
655   if (input_ui_pressed_repeat(machine, IPT_UI_LEFT, 4))
656   if (ui_input_pressed_repeat(machine, IPT_UI_LEFT, 4))
656657      state->gfxset.color[set] -= 1;
657   if (input_ui_pressed_repeat(machine, IPT_UI_RIGHT, 4))
658   if (ui_input_pressed_repeat(machine, IPT_UI_RIGHT, 4))
658659      state->gfxset.color[set] += 1;
659660
660661   /* clamp within range */
r2956r2957
955956   int step;
956957
957958   /* handle tilemap selection (open bracket,close bracket) */
958   if (input_ui_pressed(machine, IPT_UI_PREV_GROUP))
959   if (ui_input_pressed(machine, IPT_UI_PREV_GROUP))
959960      state->tilemap.which--;
960   if (input_ui_pressed(machine, IPT_UI_NEXT_GROUP))
961   if (ui_input_pressed(machine, IPT_UI_NEXT_GROUP))
961962      state->tilemap.which++;
962963
963964   /* clamp within range */
r2956r2957
970971   tilemap_size_by_index(state->tilemap.which, &mapwidth, &mapheight);
971972
972973   /* handle zoom (minus,plus) */
973   if (input_ui_pressed(machine, IPT_UI_ZOOM_OUT))
974   if (ui_input_pressed(machine, IPT_UI_ZOOM_OUT))
974975      state->tilemap.zoom--;
975   if (input_ui_pressed(machine, IPT_UI_ZOOM_IN))
976   if (ui_input_pressed(machine, IPT_UI_ZOOM_IN))
976977      state->tilemap.zoom++;
977978
978979   /* clamp within range */
r2956r2957
989990   }
990991
991992   /* handle rotation (R) */
992   if (input_ui_pressed(machine, IPT_UI_ROTATE))
993   if (ui_input_pressed(machine, IPT_UI_ROTATE))
993994      state->tilemap.rotate = orientation_add(ROT90, state->tilemap.rotate);
994995
995996   /* handle navigation (up,down,left,right) */
996997   step = 8;
997998   if (input_code_pressed(KEYCODE_LSHIFT)) step = 1;
998999   if (input_code_pressed(KEYCODE_LCONTROL)) step = 64;
999   if (input_ui_pressed_repeat(machine, IPT_UI_UP, 4))
1000   if (ui_input_pressed_repeat(machine, IPT_UI_UP, 4))
10001001      state->tilemap.yoffs -= step;
1001   if (input_ui_pressed_repeat(machine, IPT_UI_DOWN, 4))
1002   if (ui_input_pressed_repeat(machine, IPT_UI_DOWN, 4))
10021003      state->tilemap.yoffs += step;
1003   if (input_ui_pressed_repeat(machine, IPT_UI_LEFT, 6))
1004   if (ui_input_pressed_repeat(machine, IPT_UI_LEFT, 6))
10041005      state->tilemap.xoffs -= step;
1005   if (input_ui_pressed_repeat(machine, IPT_UI_RIGHT, 6))
1006   if (ui_input_pressed_repeat(machine, IPT_UI_RIGHT, 6))
10061007      state->tilemap.xoffs += step;
10071008
10081009   /* clamp within range */
src/emu/uiinput.c
r0r2957
1/***************************************************************************
2
3    uiinput.c
4
5    Internal MAME user interface input state.
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#include "uiinput.h"
13#include "mame.h"
14#include "inptport.h"
15#include "profiler.h"
16#include "render.h"
17#include "deprecat.h"
18
19
20/***************************************************************************
21    CONSTANTS
22***************************************************************************/
23
24#define EVENT_QUEUE_SIZE      128
25
26enum
27{
28   SEQ_PRESSED_FALSE = 0,      /* not pressed */
29   SEQ_PRESSED_TRUE,         /* pressed */
30   SEQ_PRESSED_RESET         /* reset -- converted to FALSE once detected as not pressed */
31};
32
33
34
35/***************************************************************************
36    TYPE DEFINITIONS
37***************************************************************************/
38
39/* private input port state */
40struct _ui_input_private
41{
42   /* pressed states; retrieved with ui_input_pressed() */
43   osd_ticks_t               next_repeat[__ipt_max];
44   UINT8                  seqpressed[__ipt_max];
45
46   /* mouse position/info */
47   render_target *            current_mouse_target;
48   INT32                  current_mouse_x;
49   INT32                  current_mouse_y;
50
51   /* popped states; ring buffer of ui_events */
52   ui_event               events[EVENT_QUEUE_SIZE];
53   int                     events_start;
54   int                     events_end;
55};
56
57
58
59/***************************************************************************
60    FUNCTION PROTOYPES
61***************************************************************************/
62
63static void ui_input_frame_update(running_machine *machine);
64
65
66
67/***************************************************************************
68    INITIALIZATION
69***************************************************************************/
70
71/*-------------------------------------------------
72    ui_input_init - initializes the UI input
73    system
74-------------------------------------------------*/
75
76void ui_input_init(running_machine *machine)
77{
78   /* create the private data */
79   machine->ui_input_data = auto_malloc(sizeof(*machine->ui_input_data));
80   memset(machine->ui_input_data, 0, sizeof(*machine->ui_input_data));
81   machine->ui_input_data->current_mouse_x = -1;
82   machine->ui_input_data->current_mouse_y = -1;
83
84   /* add a frame callback to poll inputs */
85   add_frame_callback(machine, ui_input_frame_update);
86}
87
88
89
90/***************************************************************************
91    EVENT HANDLING
92***************************************************************************/
93
94/*-------------------------------------------------
95    ui_input_frame_update - looks through pressed
96    input as per events pushed our way and posts
97    corresponding IPT_UI_* events
98-------------------------------------------------*/
99
100static void ui_input_frame_update(running_machine *machine)
101{
102   ui_input_private *uidata = machine->ui_input_data;
103   int code;
104
105   /* update the state of all the UI keys */
106   for (code = __ipt_ui_start; code <= __ipt_ui_end; code++)
107   {
108      int pressed = input_seq_pressed(input_type_seq(machine, code, 0, SEQ_TYPE_STANDARD));
109      if (!pressed || uidata->seqpressed[code] != SEQ_PRESSED_RESET)
110         uidata->seqpressed[code] = pressed;
111   }
112}
113
114
115/*-------------------------------------------------
116    ui_input_push_event - pushes a single event
117    onto the queue
118-------------------------------------------------*/
119
120int ui_input_push_event(running_machine *machine, ui_event evt)
121{
122   ui_input_private *uidata = machine->ui_input_data;
123
124   /* we may be called before the UI is initialized */
125   if (uidata == NULL)
126      return FALSE;
127
128   /* some pre-processing (this is an icky place to do this stuff!) */
129   switch (evt.event_type)
130   {
131      case UI_EVENT_MOUSE_MOVE:
132         uidata->current_mouse_target = evt.target;
133         uidata->current_mouse_x = evt.mouse_x;
134         uidata->current_mouse_y = evt.mouse_y;
135         break;
136
137      case UI_EVENT_MOUSE_LEAVE:
138         if (uidata->current_mouse_target == evt.target)
139         {
140            uidata->current_mouse_target = NULL;
141            uidata->current_mouse_x = -1;
142            uidata->current_mouse_y = -1;
143         }
144         break;
145
146      default:
147         /* do nothing */
148         break;
149   }
150
151   /* is the queue filled up? */
152   if ((uidata->events_end + 1) % ARRAY_LENGTH(uidata->events) == uidata->events_start)
153      return FALSE;
154
155   uidata->events[uidata->events_end++] = evt;
156   uidata->events_end %= ARRAY_LENGTH(uidata->events);
157   return TRUE;
158}
159
160
161/*-------------------------------------------------
162    ui_input_pop_event - pops an event off of the queue
163-------------------------------------------------*/
164
165int ui_input_pop_event(running_machine *machine, ui_event *evt)
166{
167   ui_input_private *uidata = machine->ui_input_data;
168   int result;
169
170   if (uidata->events_start != uidata->events_end)
171   {
172      *evt = uidata->events[uidata->events_start++];
173      uidata->events_start %= ARRAY_LENGTH(uidata->events);
174      result = TRUE;
175   }
176   else
177   {
178      memset(evt, 0, sizeof(*evt));
179      result = FALSE;
180   }
181   return result;
182}
183
184
185/*-------------------------------------------------
186    ui_input_reset - clears all outstanding events
187    and resets the sequence states
188-------------------------------------------------*/
189
190void ui_input_reset(running_machine *machine)
191{
192   ui_input_private *uidata = machine->ui_input_data;
193   int code;
194
195   uidata->events_start = 0;
196   uidata->events_end = 0;
197   for (code = __ipt_ui_start; code <= __ipt_ui_end; code++)
198   {
199      uidata->seqpressed[code] = SEQ_PRESSED_RESET;
200      uidata->next_repeat[code] = 0;
201   }
202}
203
204
205/*-------------------------------------------------
206    ui_input_find_mouse - retrieves the current
207    location of the mouse
208-------------------------------------------------*/
209
210render_target *ui_input_find_mouse(running_machine *machine, INT32 *x, INT32 *y)
211{
212   ui_input_private *uidata = machine->ui_input_data;
213   if (x != NULL)
214      *x = uidata->current_mouse_x;
215   if (y != NULL)
216      *y = uidata->current_mouse_y;
217   return uidata->current_mouse_target;
218}
219
220
221
222/***************************************************************************
223    USER INTERFACE SEQUENCE READING
224***************************************************************************/
225
226/*-------------------------------------------------
227    ui_input_pressed - return TRUE if a key down
228    for the given user interface sequence is
229    detected
230-------------------------------------------------*/
231
232int ui_input_pressed(running_machine *machine, int code)
233{
234   return ui_input_pressed_repeat(machine, code, 0);
235}
236
237
238/*-------------------------------------------------
239    ui_input_pressed_repeat - return TRUE if a key
240    down for the given user interface sequence is
241    detected, or if autorepeat at the given speed
242    is triggered
243-------------------------------------------------*/
244
245int ui_input_pressed_repeat(running_machine *machine, int code, int speed)
246{
247   ui_input_private *uidata = machine->ui_input_data;
248   int pressed = FALSE;
249
250profiler_mark(PROFILER_INPUT);
251
252   /* get the status of this key (assumed to be only in the defaults) */
253   assert(code >= IPT_UI_CONFIGURE && code <= IPT_OSD_16);
254   pressed = (uidata->seqpressed[code] == SEQ_PRESSED_TRUE);
255
256   /* if down, handle it specially */
257   if (pressed)
258   {
259      osd_ticks_t tps = osd_ticks_per_second();
260
261      /* if this is the first press, set a 3x delay and leave pressed = 1 */
262      if (uidata->next_repeat[code] == 0)
263         uidata->next_repeat[code] = osd_ticks() + 3 * speed * tps / 60;
264
265      /* if this is an autorepeat case, set a 1x delay and leave pressed = 1 */
266      else if (speed > 0 && (osd_ticks() + tps - uidata->next_repeat[code]) >= tps)
267         uidata->next_repeat[code] += 1 * speed * tps / 60;
268
269      /* otherwise, reset pressed = 0 */
270      else
271         pressed = FALSE;
272   }
273
274   /* if we're not pressed, reset the memory field */
275   else
276      uidata->next_repeat[code] = 0;
277
278profiler_mark(PROFILER_END);
279
280   return pressed;
281}
src/emu/uiinput.h
r0r2957
1/***************************************************************************
2
3    uiinput.h
4
5    Internal MAME user interface input state.
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#pragma once
13
14#ifndef __UIINPUT_H__
15#define __UIINPUT_H__
16
17#include "mamecore.h"
18#include "render.h"
19#include "unicode.h"
20
21
22/***************************************************************************
23    TYPE DEFINITIONS
24***************************************************************************/
25
26enum _ui_event_type
27{
28   UI_EVENT_NONE,
29   UI_EVENT_MOUSE_MOVE,
30   UI_EVENT_MOUSE_LEAVE,
31   UI_EVENT_MOUSE_CLICK,
32   UI_EVENT_MOUSE_DOUBLE_CLICK,
33   UI_EVENT_CHAR
34};
35typedef enum _ui_event_type ui_event_type;
36
37
38typedef struct _ui_event ui_event;
39struct _ui_event
40{
41   ui_event_type       event_type;
42   render_target *      target;
43   INT32             mouse_x;
44   INT32             mouse_y;
45   input_item_id       key;
46   unicode_char       ch;
47};
48
49
50
51/***************************************************************************
52    FUNCTION PROTOTYPES
53***************************************************************************/
54
55
56/* ----- core system management ----- */
57
58/* initialization */
59void ui_input_init(running_machine *machine);
60
61
62
63/* ----- event handling ----- */
64
65/* pushes a single event onto the queue */
66int ui_input_push_event(running_machine *machine, ui_event event);
67
68/* pops an event off of the queue */
69int ui_input_pop_event(running_machine *machine, ui_event *event);
70
71/* clears all outstanding events */
72void ui_input_reset(running_machine *machine);
73
74/* retrieves the current location of the mouse */
75render_target *ui_input_find_mouse(running_machine *machine, INT32 *x, INT32 *y);
76
77
78
79/* ----- user interface sequence reading ----- */
80
81/* return TRUE if a key down for the given user interface sequence is detected */
82int ui_input_pressed(running_machine *machine, int code);
83
84/* return TRUE if a key down for the given user interface sequence is detected, or if
85   autorepeat at the given speed is triggered */
86int ui_input_pressed_repeat(running_machine *machine, int code, int speed);
87
88
89
90/***************************************************************************
91    INLINE FUNCTIONS
92***************************************************************************/
93
94/*-------------------------------------------------
95    ui_input_push_mouse_move_event - pushes a mouse
96    move event to the specified render_target
97-------------------------------------------------*/
98
99INLINE void ui_input_push_mouse_move_event(running_machine *machine, render_target *target, INT32 x, INT32 y)
100{
101   ui_event event = { UI_EVENT_NONE };
102   event.event_type = UI_EVENT_MOUSE_MOVE;
103   event.target = target;
104   event.mouse_x = x;
105   event.mouse_y = y;
106   ui_input_push_event(machine, event);
107}
108
109
110/*-------------------------------------------------
111    ui_input_push_mouse_leave_event - pushes a
112    mouse leave event to the specified render_target
113-------------------------------------------------*/
114
115INLINE void ui_input_push_mouse_leave_event(running_machine *machine, render_target *target)
116{
117   ui_event event = { UI_EVENT_NONE };
118   event.event_type = UI_EVENT_MOUSE_LEAVE;
119   event.target = target;
120   ui_input_push_event(machine, event);
121}
122
123
124/*-------------------------------------------------
125    ui_input_push_mouse_click_event - pushes a mouse
126    click event to the specified render_target
127-------------------------------------------------*/
128
129INLINE void ui_input_push_mouse_click_event(running_machine *machine, render_target *target, INT32 x, INT32 y)
130{
131   ui_event event = { UI_EVENT_NONE };
132   event.event_type = UI_EVENT_MOUSE_CLICK;
133   event.target = target;
134   event.mouse_x = x;
135   event.mouse_y = y;
136   ui_input_push_event(machine, event);
137}
138
139
140/*-------------------------------------------------
141    ui_input_push_mouse_double_click_event - pushes
142    a mouse double-click event to the specified
143    render_target
144-------------------------------------------------*/
145
146INLINE void ui_input_push_mouse_double_click_event(running_machine *machine, render_target *target, INT32 x, INT32 y)
147{
148   ui_event event = { UI_EVENT_NONE };
149   event.event_type = UI_EVENT_MOUSE_DOUBLE_CLICK;
150   event.target = target;
151   event.mouse_x = x;
152   event.mouse_y = y;
153   ui_input_push_event(machine, event);
154}
155
156
157/*-------------------------------------------------
158    ui_input_push_char_event - pushes a char event
159    to the specified render_target
160-------------------------------------------------*/
161
162INLINE void ui_input_push_char_event(running_machine *machine, render_target *target, unicode_char ch)
163{
164   ui_event event = { UI_EVENT_NONE };
165   event.event_type = UI_EVENT_CHAR;
166   event.target = target;
167   event.ch = ch;
168   ui_input_push_event(machine, event);
169}
170
171
172#endif   /* __UIINPUT_H__ */
src/emu/uimenu.c
r2956r2957
1212#include "ui.h"
1313#include "rendutil.h"
1414#include "cheat.h"
15#include "uiinput.h"
1516#include "uimenu.h"
1617#include "audit.h"
1718#include "deprecat.h"
19#include "eminline.h"
1820
1921#ifdef MESS
2022#include "uimess.h"
r2956r2957
2931    CONSTANTS
3032***************************************************************************/
3133
32#define MENU_STACK_DEPTH      8
33#define MENU_STRING_POOL_SIZE   (64*1024)
34#define UI_MENU_POOL_SIZE      65536
35#define UI_MENU_ALLOC_ITEMS      256
3436
3537#define MENU_TEXTCOLOR         ARGB_WHITE
3638#define MENU_SELECTCOLOR      MAKE_ARGB(0xff,0xff,0xff,0x00)
r2956r2957
5658{
5759   INPUT_TYPE_DIGITAL = 0,
5860   INPUT_TYPE_ANALOG = 1,
59   INPUT_TYPE_ANALOG_DEC = 2,
60   INPUT_TYPE_ANALOG_INC = 3
61   INPUT_TYPE_ANALOG_DEC = INPUT_TYPE_ANALOG + SEQ_TYPE_DECREMENT,
62   INPUT_TYPE_ANALOG_INC = INPUT_TYPE_ANALOG + SEQ_TYPE_INCREMENT,
63   INPUT_TYPE_TOTAL = INPUT_TYPE_ANALOG + SEQ_TYPE_TOTAL
6164};
6265
6366enum
r2956r2957
6972   ANALOG_ITEM_COUNT
7073};
7174
75enum
76{
77   MEMCARD_ITEM_SELECT = 1,
78   MEMCARD_ITEM_LOAD,
79   MEMCARD_ITEM_EJECT,
80   MEMCARD_ITEM_CREATE
81};
7282
83enum
84{
85   VIDEO_ITEM_ROTATE = 0x80000000,
86   VIDEO_ITEM_VIEW
87};
7388
89
90
7491/***************************************************************************
7592    TYPE DEFINITIONS
7693***************************************************************************/
7794
78typedef struct _menu_state menu_state;
79struct _menu_state
95typedef struct _ui_menu_pool ui_menu_pool;
96struct _ui_menu_pool
8097{
98   ui_menu_pool *      next;         /* chain to next one */
99   UINT8 *            top;         /* top of the pool */
100   UINT8 *            end;         /* end of the pool */
101};
102
103
104typedef struct _ui_menu_item ui_menu_item;
105struct _ui_menu_item
106{
107   const char *         text;
108   const char *         subtext;
109   UINT32             flags;
110   void *            ref;
111};
112
113
114struct _ui_menu
115{
116   running_machine *   machine;         /* machine we are attached to */
81117   ui_menu_handler_func handler;         /* handler callback */
82   UINT32         state;            /* state value */
118   void *            parameter;         /* parameter */
119   ui_menu_event      event;            /* the UI event that occurred */
120   ui_menu *         parent;            /* pointer to parent menu */
121   void *            state;            /* menu-specific state */
122   int               resetpos;         /* reset position */
123   void *            resetref;         /* reset reference */
124   int               selected;         /* which item is selected */
125   int               hover;            /* which item is being hovered over */
126   int               visitems;         /* number of visible items */
127   int               numitems;         /* number of items in the menu */
128   int               allocitems;         /* allocated size of array */
129   ui_menu_item *      item;            /* pointer to array of items */
130   ui_menu_custom_func custom;            /* callback for custom rendering */
131   float            customtop;         /* amount of extra height to add at the top */
132   float            custombottom;      /* amount of extra height to add at the bottom */
133   ui_menu_pool *      pool;            /* list of memory pools */
83134};
84135
85136
137/* internal input menu item data */
86138typedef struct _input_item_data input_item_data;
87139struct _input_item_data
88140{
89   const input_type_desc *typedesc;      /* reference to type description for global inputs */
90   const input_field_config *field;      /* reference to field for game inputs */
91   int            seqtype;            /* sequence type */
92   input_seq      seq;               /* copy of the live sequence */
93   const input_seq *defseq;            /* pointer to the default sequence */
94   const char *   name;
95   const char *   seqname;
96   UINT16          sortorder;            /* sorting information */
97   UINT8          type;               /* type of port */
98   UINT8          invert;               /* type of port */
141   input_item_data *   next;            /* pointer to next item in the list */
142   const void *      ref;            /* reference to type description for global inputs or field for game inputs */
143   int               seqtype;         /* sequence type */
144   input_seq         seq;            /* copy of the live sequence */
145   const input_seq *   defseq;            /* pointer to the default sequence */
146   const char *      name;            /* pointer to the base name of the item */
147   UINT16             sortorder;         /* sorting information */
148   UINT8             type;            /* type of port */
99149};
100150
101151
152/* internal analog menu item data */
153typedef struct _analog_item_data analog_item_data;
154struct _analog_item_data
155{
156   const input_field_config *field;
157   int               type;
158   int               min, max;
159   int               cur;
160};
161
162
163/* DIP switch descriptor */
102164typedef struct _dip_descriptor dip_descriptor;
103165struct _dip_descriptor
104166{
105   const char *    dip_name;
106   UINT16         total_dip_mask;
107   UINT16         total_dip_settings;
108   UINT16         dip_invert_mask;
109   UINT16          selected_dip_feature_mask;
167   dip_descriptor *   next;
168   const char *       name;
169   UINT32            mask;
170   UINT32            state;
110171};
111172
112173
174/* extended settings menu state */
175typedef struct _settings_menu_state settings_menu_state;
176struct _settings_menu_state
177{
178   dip_descriptor *   diplist;
179};
113180
181
182/* extended input menu state */
183typedef struct _input_menu_state input_menu_state;
184struct _input_menu_state
185{
186   const void *      lastref;
187   const void *      pollingref;
188   input_item_data *   pollingitem;
189   UINT8            record_next;
190   input_seq          starting_seq;
191};
192
193
194/* extended select game menu state */
195typedef struct _select_game_state select_game_state;
196struct _select_game_state
197{
198   UINT8            error;
199   UINT8            rerandomize;
200   char            search[40];
201   const game_driver *   matchlist[VISIBLE_GAMES_IN_LIST];
202   const game_driver *   driverlist[1];
203};
204
205
206
114207/***************************************************************************
115208    GLOBAL VARIABLES
116209***************************************************************************/
117210
118211/* menu states */
119static int menu_stack_index;
120static menu_state menu_stack[MENU_STACK_DEPTH];
212static ui_menu *menu_stack;
213static ui_menu *menu_free;
121214
122static UINT32 menu_string_pool_offset;
123static char menu_string_pool[MENU_STRING_POOL_SIZE];
124
125static input_seq starting_seq;
126
127static char select_game_buffer[40];
128static const game_driver *select_game_list[VISIBLE_GAMES_IN_LIST];
129static const game_driver **select_game_driver_list;
130
131static dip_descriptor dip_switch_model[MAX_PHYSICAL_DIPS + 1];
132
133215static bitmap_t *hilight_bitmap;
134216static render_texture *hilight_texture;
135217
136218static render_texture *arrow_texture;
137219
138static const char *const input_format[] =
139{
140   "%s",
141   "%s Analog",
142   "%s Dec",
143   "%s Inc"
144};
220static const char *priortext = "Return to Prior Menu";
221static const char *backtext = "Return to " CAPSTARTGAMENOUN;
222static const char *exittext = "Exit";
145223
146224static const rgb_t text_fgcolor = MAKE_ARGB(0xff,0xff,0xff,0xff);
147225static const rgb_t text_bgcolor = MAKE_ARGB(0xe0,0x80,0x80,0x80);
148226static const rgb_t sel_fgcolor = MAKE_ARGB(0xff,0xff,0xff,0x00);
149227static const rgb_t sel_bgcolor = MAKE_ARGB(0xe0,0x80,0x80,0x00);
228static const rgb_t mouseover_fgcolor = MAKE_ARGB(0xff,0xff,0xff,0x80);
229static const rgb_t mouseover_bgcolor = MAKE_ARGB(0x70,0x40,0x40,0x00);
230static const rgb_t mousedown_fgcolor = MAKE_ARGB(0xff,0xff,0xff,0x80);
231static const rgb_t mousedown_bgcolor = MAKE_ARGB(0xB0,0x60,0x60,0x00);
150232
151233
152234
r2956r2957
156238
157239static void ui_menu_exit(running_machine *machine);
158240
241/* internal menu processing */
242static void ui_menu_draw(ui_menu *menu);
243static void ui_menu_draw_text_box(ui_menu *menu);
244static void ui_menu_handle_events(ui_menu *menu);
245static void ui_menu_handle_keys(ui_menu *menu, UINT32 flags);
246static void ui_menu_validate_selection(ui_menu *menu, int scandir);
247static void ui_menu_clear_free_list(running_machine *machine);
248
159249/* menu handlers */
160static UINT32 menu_main(running_machine *machine, UINT32 state);
161static UINT32 menu_input_groups(running_machine *machine, UINT32 state);
162static UINT32 menu_input(running_machine *machine, UINT32 state);
163static UINT32 menu_switches(running_machine *machine, UINT32 state);
164static UINT32 menu_analog(running_machine *machine, UINT32 state);
250static void menu_main(running_machine *machine, ui_menu *menu, void *parameter, void *state);
251static void menu_main_populate(running_machine *machine, ui_menu *menu, void *state);
252static void menu_input_groups(running_machine *machine, ui_menu *menu, void *parameter, void *state);
253static void menu_input_groups_populate(running_machine *machine, ui_menu *menu, void *state);
254static void menu_input_general(running_machine *machine, ui_menu *menu, void *parameter, void *state);
255static void menu_input_general_populate(running_machine *machine, ui_menu *menu, input_menu_state *menustate, int group);
256static void menu_input_specific(running_machine *machine, ui_menu *menu, void *parameter, void *state);
257static void menu_input_specific_populate(running_machine *machine, ui_menu *menu, input_menu_state *menustate);
258static void menu_input_common(running_machine *machine, ui_menu *menu, void *parameter, void *state);
259static int CLIB_DECL menu_input_compare_items(const void *i1, const void *i2);
260static void menu_input_populate_and_sort(ui_menu *menu, input_item_data *itemlist, input_menu_state *menustate);
261static void menu_settings_dip_switches(running_machine *machine, ui_menu *menu, void *parameter, void *state);
262static void menu_settings_driver_config(running_machine *machine, ui_menu *menu, void *parameter, void *state);
263static void menu_settings_categories(running_machine *machine, ui_menu *menu, void *parameter, void *state);
264static void menu_settings_common(running_machine *machine, ui_menu *menu, void *state, UINT32 type);
265static void menu_settings_populate(running_machine *machine, ui_menu *menu, settings_menu_state *menustate, UINT32 type);
266static void menu_analog(running_machine *machine, ui_menu *menu, void *parameter, void *state);
267static void menu_analog_populate(running_machine *machine, ui_menu *menu);
165268#ifndef MESS
166static UINT32 menu_bookkeeping(running_machine *machine, UINT32 state);
269static void menu_bookkeeping(running_machine *machine, ui_menu *menu, void *parameter, void *state);
270static void menu_bookkeeping_populate(running_machine *machine, ui_menu *menu, attotime *curtime);
167271#endif
168static UINT32 menu_game_info(running_machine *machine, UINT32 state);
169static UINT32 menu_cheat(running_machine *machine, UINT32 state);
170static UINT32 menu_memory_card(running_machine *machine, UINT32 state);
171static UINT32 menu_video(running_machine *machine, UINT32 state);
172static UINT32 menu_quit_game(running_machine *machine, UINT32 state);
173static UINT32 menu_select_game(running_machine *machine, UINT32 state);
272static void menu_game_info(running_machine *machine, ui_menu *menu, void *parameter, void *state);
273static void menu_memory_card(running_machine *machine, ui_menu *menu, void *parameter, void *state);
274static void menu_memory_card_populate(running_machine *machine, ui_menu *menu, int cardnum);
275static void menu_video_targets(running_machine *machine, ui_menu *menu, void *parameter, void *state);
276static void menu_video_targets_populate(running_machine *machine, ui_menu *menu);
277static void menu_video_options(running_machine *machine, ui_menu *menu, void *parameter, void *state);
278static void menu_video_options_populate(running_machine *machine, ui_menu *menu, render_target *target);
279static void menu_quit_game(running_machine *machine, ui_menu *menu, void *parameter, void *state);
280static void menu_select_game(running_machine *machine, ui_menu *menu, void *parameter, void *state);
281static void menu_select_game_populate(running_machine *machine, ui_menu *menu, select_game_state *menustate);
282static int CLIB_DECL menu_select_game_driver_compare(const void *elem1, const void *elem2);
283static void menu_select_game_build_driver_list(ui_menu *menu, select_game_state *menustate);
284static void menu_select_game_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
174285
175286/* menu helpers */
176287static void menu_render_triangle(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param);
288static void menu_settings_custom_render_one(float x1, float y1, float x2, float y2, const dip_descriptor *dip, UINT32 selectedmask);
289static void menu_settings_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
177290
178static int input_menu_get_items(running_machine *machine, input_item_data *itemlist, int group);
179static int input_menu_get_game_items(running_machine *machine, input_item_data *itemlist);
180static void input_menu_toggle_none_default(input_seq *selected_seq, input_seq *original_seq, const input_seq *selected_defseq);
181static int input_menu_compare_items(const void *i1, const void *i2);
182static void switches_menu_add_item(ui_menu_item *item, const input_field_config *field);
183static void analog_menu_add_item(ui_menu_item *item, const input_field_config *field, const char *append_string, int which_item);
184291
185/* DIP switch helpers */
186static void dip_switch_build_model(const input_field_config *field, int item_is_selected);
187static void dip_switch_draw_one(float dip_menu_x1, float dip_menu_y1, float dip_menu_x2, float dip_menu_y2, int model_index);
188static void dip_switch_render(const menu_extra *extra, float x1, float y1, float x2, float y2);
189292
190static int CLIB_DECL select_game_driver_compare(const void *elem1, const void *elem2);
191static void select_game_build_driver_list(void);
192static void select_game_render(const menu_extra *extra, float x1, float y1, float x2, float y2);
193static int select_game_handle_key(input_code keycode, char value);
194
195
196293/***************************************************************************
197294    INLINE FUNCTIONS
198295***************************************************************************/
199296
200297/*-------------------------------------------------
201    menu_string_pool_add - add a formatted string
202    to the string pool
298    get_field_default_seq - return a pointer
299    to the default sequence for the given field
203300-------------------------------------------------*/
204301
205INLINE const char *CLIB_DECL ATTR_PRINTF(1,2) menu_string_pool_add(const char *format, ...)
302INLINE const input_seq *get_field_default_seq(const input_field_config *field, int seqtype)
206303{
207   char *result = &menu_string_pool[menu_string_pool_offset];
208   va_list arg;
304   if (input_seq_get_1(&field->seq[seqtype]) == SEQCODE_DEFAULT)
305      return input_type_seq(field->port->machine, field->type, field->player, seqtype);
306   else
307      return &field->seq[seqtype];
308}
209309
210   /* print to the string pool */
211   va_start(arg, format);
212   menu_string_pool_offset += vsprintf(result, format, arg) + 1;
213   va_end(arg);
214310
215   return result;
311/*-------------------------------------------------
312    toggle_none_default - toggle between "NONE"
313    and the default item
314-------------------------------------------------*/
315
316INLINE void toggle_none_default(input_seq *selected_seq, input_seq *original_seq, const input_seq *selected_defseq)
317{
318   /* if we used to be "none", toggle to the default value */
319   if (input_seq_get_1(original_seq) == SEQCODE_END)
320      *selected_seq = *selected_defseq;
321
322   /* otherwise, toggle to "none" */
323   else
324      input_seq_set_1(selected_seq, SEQCODE_END);
216325}
217326
218327
219328/*-------------------------------------------------
220    get_num_dips - return the number of physical
221    DIP switches that are to be drawn
329    item_is_selectable - return TRUE if the given
330    item is selectable
222331-------------------------------------------------*/
223332
224INLINE int get_num_dips(void)
333INLINE int item_is_selectable(const ui_menu_item *item)
225334{
226   int num;
227   for (num = 0; num < MAX_PHYSICAL_DIPS; num++)
228      if (dip_switch_model[num].dip_name == NULL)
229         break;
335   return ((item->flags & MENU_FLAG_MULTILINE) == 0 && strcmp(item->text, MENU_SEPARATOR_ITEM) != 0);
336}
230337
231   return num;
338
339/*-------------------------------------------------
340    exclusive_input_pressed - return TRUE if the
341    given key is pressed and we haven't already
342    reported a key
343-------------------------------------------------*/
344
345INLINE int exclusive_input_pressed(ui_menu *menu, int key, int repeat)
346{
347   if (menu->event.iptkey == IPT_INVALID && ui_input_pressed_repeat(menu->machine, key, repeat))
348   {
349      menu->event.iptkey = key;
350      return TRUE;
351   }
352   return FALSE;
232353}
233354
234355
235356
236357/***************************************************************************
237    CORE IMPLEMENTATION
358    CORE SYSTEM MANAGEMENT
238359***************************************************************************/
239360
240361/*-------------------------------------------------
r2956r2957
246367   int x;
247368
248369   /* initialize the menu stack */
249   ui_menu_stack_reset();
250   select_game_buffer[0] = 0;
370   ui_menu_stack_reset(machine);
251371
252372   /* create a texture for hilighting items */
253373   hilight_bitmap = bitmap_alloc(256, 1, BITMAP_FORMAT_ARGB32);
r2956r2957
275395
276396static void ui_menu_exit(running_machine *machine)
277397{
398   /* free menus */
399   ui_menu_stack_reset(machine);
400   ui_menu_clear_free_list(machine);
401
278402   /* free textures */
279403   render_texture_free(hilight_texture);
280404   bitmap_free(hilight_bitmap);
281405   render_texture_free(arrow_texture);
406}
282407
283   /* free the driver list */
284   if (select_game_driver_list != NULL)
285      free((void *)select_game_driver_list);
286   select_game_driver_list = NULL;
408
409
410/***************************************************************************
411    CORE MENU MANAGEMENT
412***************************************************************************/
413
414/*-------------------------------------------------
415    ui_menu_alloc - allocate a new menu
416-------------------------------------------------*/
417
418ui_menu *ui_menu_alloc(running_machine *machine, ui_menu_handler_func handler, void *parameter)
419{
420   ui_menu *menu;
421
422   /* allocate and clear memory for the menu and the state */
423   menu = malloc_or_die(sizeof(*menu));
424   memset(menu, 0, sizeof(*menu));
425
426   /* initialize the state */
427   menu->machine = machine;
428   menu->handler = handler;
429   menu->parameter = parameter;
430
431   /* reset the menu (adds a default entry) */
432   ui_menu_reset(menu, UI_MENU_RESET_SELECT_FIRST);
433   return menu;
287434}
288435
289436
290437/*-------------------------------------------------
438    ui_menu_free - free a menu
439-------------------------------------------------*/
440
441void ui_menu_free(ui_menu *menu)
442{
443   /* free the pools */
444   while (menu->pool != NULL)
445   {
446      ui_menu_pool *pool = menu->pool;
447      menu->pool = pool->next;
448      free(pool);
449   }
450
451   /* free the item array */
452   if (menu->item != NULL)
453      free(menu->item);
454
455   /* free the state */
456   if (menu->state != NULL)
457      free(menu->state);
458
459   /* free the menu */
460   free(menu);
461}
462
463
464/*-------------------------------------------------
465    ui_menu_reset - free all items in the menu,
466    and all memory allocated from the memory pool
467-------------------------------------------------*/
468
469void ui_menu_reset(ui_menu *menu, ui_menu_reset_options options)
470{
471   ui_menu_pool *pool;
472
473   /* based on the reset option, set the reset info */
474   menu->resetpos = 0;
475   menu->resetref = NULL;
476   if (options == UI_MENU_RESET_REMEMBER_POSITION)
477      menu->resetpos = menu->selected;
478   else if (options == UI_MENU_RESET_REMEMBER_REF)
479      menu->resetref = menu->item[menu->selected].ref;
480
481   /* reset all the pools and the numitems back to 0 */
482   for (pool = menu->pool; pool != NULL; pool = pool->next)
483      pool->top = (UINT8 *)(pool + 1);
484   menu->numitems = 0;
485   menu->visitems = 0;
486   menu->selected = 0;
487
488   /* add an item to return */
489   if (menu->parent == NULL)
490      ui_menu_item_append(menu, backtext, NULL, 0, NULL);
491   else if (menu->parent->handler == menu_quit_game)
492      ui_menu_item_append(menu, exittext, NULL, 0, NULL);
493   else
494      ui_menu_item_append(menu, priortext, NULL, 0, NULL);
495}
496
497
498/*-------------------------------------------------
499    ui_menu_populated - returns TRUE if the menu
500    has any non-default items in it
501-------------------------------------------------*/
502
503int ui_menu_populated(ui_menu *menu)
504{
505   return (menu->numitems > 1);
506}
507
508
509/*-------------------------------------------------
510    ui_menu_item_append - append a new item to the
511    end of the menu
512-------------------------------------------------*/
513
514void ui_menu_item_append(ui_menu *menu, const char *text, const char *subtext, UINT32 flags, void *ref)
515{
516   ui_menu_item *item;
517   int index;
518
519   /* only allow multiline as the first item */
520   if ((flags & MENU_FLAG_MULTILINE) != 0)
521      assert(menu->numitems == 1);
522
523   /* only allow a single multi-line item */
524   else if (menu->numitems >= 2)
525      assert((menu->item[0].flags & MENU_FLAG_MULTILINE) == 0);
526
527   /* realloc the item array if necessary */
528   if (menu->numitems >= menu->allocitems)
529   {
530      menu->allocitems += UI_MENU_ALLOC_ITEMS;
531      menu->item = realloc(menu->item, menu->allocitems * sizeof(*item));
532   }
533   index = menu->numitems++;
534
535   /* copy the previous last item to the next one */
536   if (index != 0)
537   {
538      index--;
539      menu->item[index + 1] = menu->item[index];
540   }
541
542   /* allocate a new item and populte it */
543   item = &menu->item[index];
544   item->text = (text != NULL) ? ui_menu_pool_strdup(menu, text) : NULL;
545   item->subtext = (subtext != NULL) ? ui_menu_pool_strdup(menu, subtext) : NULL;
546   item->flags = flags;
547   item->ref = ref;
548
549   /* update the selection if we need to */
550   if (menu->resetpos == index || (menu->resetref != NULL && menu->resetref == ref))
551      menu->selected = index;
552}
553
554
555/*-------------------------------------------------
556    ui_menu_process - process a menu, drawing it
557    and returning any interesting events
558-------------------------------------------------*/
559
560const ui_menu_event *ui_menu_process(ui_menu *menu, UINT32 flags)
561{
562   /* reset the event */
563   menu->event.iptkey = IPT_INVALID;
564
565   /* first make sure our selection is valid */
566   ui_menu_validate_selection(menu, 1);
567
568   /* draw the menu */
569   if (menu->numitems > 1 && (menu->item[0].flags & MENU_FLAG_MULTILINE) != 0)
570      ui_menu_draw_text_box(menu);
571   else
572      ui_menu_draw(menu);
573
574   /* process input */
575   if (!(flags & UI_MENU_PROCESS_NOKEYS))
576   {
577      /* read events */
578      ui_menu_handle_events(menu);
579
580      /* handle the keys if we don't already have an event */
581      if (menu->event.iptkey == IPT_INVALID)
582         ui_menu_handle_keys(menu, flags);
583   }
584
585   /* update the selected item in the event */
586   if (menu->event.iptkey != IPT_INVALID && menu->selected >= 0 && menu->selected < menu->numitems)
587   {
588      menu->event.itemref = menu->item[menu->selected].ref;
589      return &menu->event;
590   }
591   return NULL;
592}
593
594
595/*-------------------------------------------------
596    ui_menu_set_custom_render - configure the menu
597    for custom rendering
598-------------------------------------------------*/
599
600void ui_menu_set_custom_render(ui_menu *menu, ui_menu_custom_func custom, float top, float bottom)
601{
602   menu->custom = custom;
603   menu->customtop = top;
604   menu->custombottom = bottom;
605}
606
607
608/*-------------------------------------------------
609    ui_menu_alloc_state - allocate permanent
610    memory to represent the menu's state
611-------------------------------------------------*/
612
613void *ui_menu_alloc_state(ui_menu *menu, size_t size)
614{
615   if (menu->state != NULL)
616      free(menu->state);
617   menu->state = malloc_or_die(size);
618   memset(menu->state, 0, size);
619
620   return menu->state;
621}
622
623
624/*-------------------------------------------------
625    ui_menu_pool_alloc - allocate temporary memory
626    from the menu's memory pool
627-------------------------------------------------*/
628
629void *ui_menu_pool_alloc(ui_menu *menu, size_t size)
630{
631   ui_menu_pool *pool;
632
633   assert(size < UI_MENU_POOL_SIZE);
634
635   /* find a pool with enough room */
636   for (pool = menu->pool; pool != NULL; pool = pool->next)
637      if (pool->end - pool->top >= size)
638      {
639         void *result = pool->top;
640         pool->top += size;
641         return result;
642      }
643
644   /* allocate a new pool */
645   pool = malloc_or_die(sizeof(*pool) + UI_MENU_POOL_SIZE);
646   memset(pool, 0, sizeof(*pool));
647
648   /* wire it up */
649   pool->next = menu->pool;
650   menu->pool = pool;
651   pool->top = (UINT8 *)(pool + 1);
652   pool->end = pool->top + UI_MENU_POOL_SIZE;
653   return ui_menu_pool_alloc(menu, size);
654}
655
656
657/*-------------------------------------------------
658    ui_menu_pool_strdup - make a temporary string
659    copy in the menu's memory pool
660-------------------------------------------------*/
661
662const char *ui_menu_pool_strdup(ui_menu *menu, const char *string)
663{
664   return strcpy(ui_menu_pool_alloc(menu, strlen(string) + 1), string);
665}
666
667
668/*-------------------------------------------------
669    ui_menu_get_selection - retrieves the index
670    of the currently selected menu item
671-------------------------------------------------*/
672
673void *ui_menu_get_selection(ui_menu *menu)
674{
675   return (menu->selected >= 0 && menu->selected < menu->numitems) ? menu->item[menu->selected].ref : NULL;
676}
677
678
679/*-------------------------------------------------
680    ui_menu_set_selection - changes the index
681    of the currently selected menu item
682-------------------------------------------------*/
683
684void ui_menu_set_selection(ui_menu *menu, void *selected_itemref)
685{
686   int itemnum;
687
688   menu->selected = -1;
689   for (itemnum = 0; itemnum < menu->numitems; itemnum++)
690      if (menu->item[itemnum].ref == selected_itemref)
691      {
692         menu->selected = itemnum;
693         break;
694      }
695}
696
697
698
699/***************************************************************************
700    INTERNAL MENU PROCESSING
701***************************************************************************/
702
703/*-------------------------------------------------
291704    ui_menu_draw - draw a menu
292705-------------------------------------------------*/
293706
294int ui_menu_draw(const ui_menu_item *items, int numitems, int selected, const menu_extra *extra)
707static void ui_menu_draw(ui_menu *menu)
295708{
296709   float line_height = ui_get_line_height();
297710   float lr_arrow_width = 0.4f * line_height * render_get_ui_aspect();
r2956r2957
307720   int visible_lines;
308721   int top_line;
309722   int itemnum, linenum;
723   int mouse_hit;
724   render_target *mouse_target;
725   INT32 mouse_target_x, mouse_target_y;
726   float mouse_x = -1, mouse_y = -1;
310727
311728   /* compute the width and height of the full menu */
312729   visible_width = 0;
313730   visible_main_menu_height = 0;
314   for (itemnum = 0; itemnum < numitems; itemnum++)
731   for (itemnum = 0; itemnum < menu->numitems; itemnum++)
315732   {
316      const ui_menu_item *item = &items[itemnum];
733      const ui_menu_item *item = &menu->item[itemnum];
317734      float total_width;
318735
319736      /* compute width of left hand side */
r2956r2957
331748      visible_main_menu_height += line_height;
332749   }
333750
334   /* if agumenting the menu, find out how much extra space is needed */
335   if (extra != NULL)
336      visible_extra_menu_height = extra->top + extra->bottom;
751   /* account for extra space at the top and bottom */
752   visible_extra_menu_height = menu->customtop + menu->custombottom;
337753
338754   /* add a little bit of slop for rounding */
339755   visible_width += 0.01f;
r2956r2957
355771   visible_top = (1.0f - (visible_main_menu_height + visible_extra_menu_height)) * 0.5f;
356772
357773   /* if the menu is at the bottom of the extra, adjust */
358   if (extra != NULL)
359      visible_top += extra->top;
774   visible_top += menu->customtop;
360775
361776   /* first add us a box */
362777   x1 = visible_left - UI_BOX_LR_BORDER;
r2956r2957
366781   ui_draw_outlined_box(x1, y1, x2, y2, UI_FILLCOLOR);
367782
368783   /* determine the first visible line based on the current selection */
369   top_line = selected - visible_lines / 2;
784   top_line = menu->selected - visible_lines / 2;
370785   if (top_line < 0)
371786      top_line = 0;
372   if (top_line + visible_lines >= numitems)
373      top_line = numitems - visible_lines;
787   if (top_line + visible_lines >= menu->numitems)
788      top_line = menu->numitems - visible_lines;
374789
375790   /* determine effective positions taking into account the hilighting arrows */
376791   effective_width = visible_width - 2.0f * gutter_width;
377792   effective_left = visible_left + gutter_width;
378793
794   /* locate mouse */
795   mouse_hit = FALSE;
796   mouse_target = ui_input_find_mouse(Machine, &mouse_target_x, &mouse_target_y);
797   if (mouse_target != NULL)
798      if (render_target_map_point_container(mouse_target, mouse_target_x, mouse_target_y, render_container_get_ui(), &mouse_x, &mouse_y))
799         mouse_hit = TRUE;
800
379801   /* loop over visible lines */
802   menu->hover = menu->numitems + 1;
380803   for (linenum = 0; linenum < visible_lines; linenum++)
381804   {
382805      float line_y = visible_top + (float)linenum * line_height;
383806      int itemnum = top_line + linenum;
384      const ui_menu_item *item = &items[itemnum];
807      const ui_menu_item *item = &menu->item[itemnum];
385808      const char *itemtext = item->text;
386809      rgb_t fgcolor = text_fgcolor;
387810      rgb_t bgcolor = text_bgcolor;
811      float line_x0 = x1 + 0.5f * UI_LINE_WIDTH;
812      float line_y0 = line_y;
813      float line_x1 = x2 - 0.5f * UI_LINE_WIDTH;
814      float line_y1 = line_y + line_height;
388815
816      /* set the hover if this is our item */
817      if (mouse_hit && line_x0 <= mouse_x && line_x1 > mouse_x && line_y0 <= mouse_y && line_y1 > mouse_y && item_is_selectable(item))
818         menu->hover = itemnum;
819
389820      /* if we're selected, draw with a different background */
390      if (itemnum == selected)
821      if (itemnum == menu->selected)
391822      {
392823         fgcolor = sel_fgcolor;
393824         bgcolor = sel_bgcolor;
394         render_ui_add_quad(   x1 + 0.5f * UI_LINE_WIDTH,
395                        line_y,
396                        x2 - 0.5f * UI_LINE_WIDTH,
397                        line_y + line_height,
398                        bgcolor,
399                        hilight_texture,
400                        PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
401825      }
402826
827      /* else if the mouse is over this item, draw with a different background */
828      else if (menu->hover == itemnum)
829      {
830         fgcolor = mouseover_fgcolor;
831         bgcolor = mouseover_bgcolor;
832      }
833
834      /* if we have some background hilighting to do, add a quad behind everything else */
835      if (bgcolor != text_bgcolor)
836         render_ui_add_quad(line_x0, line_y0, line_x1, line_y1, bgcolor, hilight_texture,
837                        PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
838
403839      /* if we're on the top line, display the up arrow */
404840      if (linenum == 0 && top_line != 0)
405841      {
r2956r2957
410846                        fgcolor,
411847                        arrow_texture,
412848                        PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT0));
849         if (menu->hover == itemnum)
850            menu->hover = -2;
413851      }
414852
415853      /* if we're on the bottom line, display the down arrow */
416      else if (linenum == visible_lines - 1 && itemnum != numitems - 1)
854      else if (linenum == visible_lines - 1 && itemnum != menu->numitems - 1)
417855      {
418856         render_ui_add_quad(   0.5f * (x1 + x2) - 0.5f * ud_arrow_width,
419857                        line_y + 0.25f * line_height,
r2956r2957
422860                        fgcolor,
423861                        arrow_texture,
424862                        PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT0 ^ ORIENTATION_FLIP_Y));
863         if (menu->hover == itemnum)
864            menu->hover = -1;
425865      }
426866
427867      /* if we're just a divider, draw a line */
r2956r2957
451891         if (ui_get_string_width(subitem_text) > effective_width - item_width)
452892         {
453893            subitem_text = "...";
454            if (itemnum == selected)
894            if (itemnum == menu->selected)
455895               selected_subitem_too_big = 1;
456896         }
457897
r2956r2957
460900                  JUSTIFY_RIGHT, WRAP_TRUNCATE, subitem_invert ? DRAW_OPAQUE : DRAW_NORMAL, fgcolor, bgcolor, &subitem_width, NULL);
461901
462902         /* apply arrows */
463         if (itemnum == selected && (item->flags & MENU_FLAG_LEFT_ARROW))
903         if (itemnum == menu->selected && (item->flags & MENU_FLAG_LEFT_ARROW))
464904         {
465905            render_ui_add_quad(   effective_left + effective_width - subitem_width - gutter_width,
466906                           line_y + 0.1f * line_height,
r2956r2957
470910                           arrow_texture,
471911                           PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(ROT90 ^ ORIENTATION_FLIP_X));
472912         }
473         if (itemnum == selected && (item->flags & MENU_FLAG_RIGHT_ARROW))
913         if (itemnum == menu->selected && (item->flags & MENU_FLAG_RIGHT_ARROW))
474914         {
475915            render_ui_add_quad(   effective_left + effective_width + gutter_width - lr_arrow_width,
476916                           line_y + 0.1f * line_height,
r2956r2957
486926   /* if the selected subitem is too big, display it in a separate offset box */
487927   if (selected_subitem_too_big)
488928   {
489      const ui_menu_item *item = &items[selected];
929      const ui_menu_item *item = &menu->item[menu->selected];
490930      int subitem_invert = item->flags & MENU_FLAG_INVERT;
491      int linenum = selected - top_line;
931      int linenum = menu->selected - top_line;
492932      float line_y = visible_top + (float)linenum * line_height;
493933      float target_width, target_height;
494934      float target_x, target_y;
r2956r2957
513953   }
514954
515955   /* if there is somthing special to add, do it by calling the passed routine */
516   if (extra != NULL)
517      (*extra->render)(extra, x1, y1, x2, y2);
956   if (menu->custom != NULL)
957   {
958      void *selectedref = (menu->selected >= 0 && menu->selected < menu->numitems) ? menu->item[menu->selected].ref : NULL;
959      (*menu->custom)(menu->machine, menu, menu->state, selectedref, menu->customtop, menu->custombottom, x1, y1, x2, y2);
960   }
518961
519962   /* return the number of visible lines, minus 1 for top arrow and 1 for bottom arrow */
520   return visible_lines - (top_line != 0) - (top_line + visible_lines != numitems);
963   menu->visitems = visible_lines - (top_line != 0) - (top_line + visible_lines != menu->numitems);
521964}
522965
523966
r2956r2957
527970    bottom
528971-------------------------------------------------*/
529972
530static void ui_menu_draw_text_box(const char *text)
973static void ui_menu_draw_text_box(ui_menu *menu)
531974{
532   const char *priortext = "Return to Prior Menu";
975   const char *text = menu->item[0].text;
976   const char *backtext = menu->item[1].text;
533977   float line_height = ui_get_line_height();
534978   float lr_arrow_width = 0.4f * line_height * render_get_ui_aspect();
535979   float gutter_width = lr_arrow_width;
r2956r2957
544988      target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / line_height) * line_height;
545989
546990   /* maximum against "return to prior menu" text */
547   prior_width = ui_get_string_width(priortext) + 2.0f * gutter_width;
991   prior_width = ui_get_string_width(backtext) + 2.0f * gutter_width;
548992   target_width = MAX(target_width, prior_width);
549993
550994   /* determine the target location */
r2956r2957
5651009   ui_draw_outlined_box(target_x - UI_BOX_LR_BORDER - gutter_width,
5661010                target_y - UI_BOX_TB_BORDER,
5671011                target_x + target_width + gutter_width + UI_BOX_LR_BORDER,
568                target_y + target_height + UI_BOX_TB_BORDER, UI_FILLCOLOR);
1012                target_y + target_height + UI_BOX_TB_BORDER, (menu->item[0].flags & MENU_FLAG_REDTEXT) ?  UI_REDCOLOR : UI_FILLCOLOR);
5691013   ui_draw_text_full(text, target_x, target_y, target_width,
5701014            JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
5711015
r2956r2957
5771021                  sel_bgcolor,
5781022                  hilight_texture,
5791023                  PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
580   ui_draw_text_full(priortext, target_x, target_y + target_height - line_height, target_width,
1024   ui_draw_text_full(backtext, target_x, target_y + target_height - line_height, target_width,
5811025            JUSTIFY_CENTER, WRAP_TRUNCATE, DRAW_NORMAL, sel_fgcolor, sel_bgcolor, NULL, NULL);
1026
1027   /* artificially set the hover to the last item so a double-click exits */
1028   menu->hover = menu->numitems - 1;
5821029}
5831030
5841031
5851032/*-------------------------------------------------
586    ui_menu_generic_keys - generically handle
1033    ui_menu_handle_events - generically handle
1034    input events for a menu
1035-------------------------------------------------*/
1036
1037static void ui_menu_handle_events(ui_menu *menu)
1038{
1039   int stop = FALSE;
1040   ui_event event;
1041
1042   /* loop while we have interesting events */
1043   while (ui_input_pop_event(menu->machine, &event) && !stop)
1044   {
1045      switch (event.event_type)
1046      {
1047         /* if we are hovering over a valid item, select it with a single click */
1048         case UI_EVENT_MOUSE_CLICK:
1049            if (menu->hover >= 0 && menu->hover < menu->numitems)
1050               menu->selected = menu->hover;
1051            else if (menu->hover == -2)
1052            {
1053               menu->selected -= menu->visitems - 1;
1054               ui_menu_validate_selection(menu, 1);
1055            }
1056            else if (menu->hover == -1)
1057            {
1058               menu->selected += menu->visitems - 1;
1059               ui_menu_validate_selection(menu, 1);
1060            }
1061            break;
1062
1063         /* if we are hovering over a valid item, fake a UI_SELECT with a double-click */
1064         case UI_EVENT_MOUSE_DOUBLE_CLICK:
1065            if (menu->hover >= 0 && menu->hover < menu->numitems)
1066            {
1067               menu->selected = menu->hover;
1068               if (event.event_type == UI_EVENT_MOUSE_DOUBLE_CLICK)
1069               {
1070                  menu->event.iptkey = IPT_UI_SELECT;
1071                  if (menu->selected == menu->numitems - 1)
1072                  {
1073                     menu->event.iptkey = IPT_UI_CANCEL;
1074                     ui_menu_stack_pop(menu->machine);
1075                  }
1076               }
1077               stop = TRUE;
1078            }
1079            break;
1080
1081         /* translate CHAR events into specials */
1082         case UI_EVENT_CHAR:
1083            menu->event.iptkey = IPT_SPECIAL;
1084            menu->event.unichar = event.ch;
1085            stop = TRUE;
1086            break;
1087
1088         /* ignore everything else */
1089         default:
1090            break;
1091      }
1092   }
1093}
1094
1095
1096/*-------------------------------------------------
1097    ui_menu_handle_keys - generically handle
5871098    keys for a menu
5881099-------------------------------------------------*/
5891100
590int ui_menu_generic_keys(running_machine *machine, UINT32 *selected, int num_items, int visible_items)
1101static void ui_menu_handle_keys(ui_menu *menu, UINT32 flags)
5911102{
592   /* hitting cancel or selecting the last item returns to the previous menu */
593   if (input_ui_pressed(machine, IPT_UI_CANCEL) || (*selected == num_items - 1 && input_ui_pressed(machine, IPT_UI_SELECT)))
1103   int ignorepause = ui_menu_is_force_game_select();
1104   int ignoreright = FALSE;
1105   int ignoreleft = FALSE;
1106   int code;
1107
1108   /* bail if no items */
1109   if (menu->numitems == 0)
1110      return;
1111
1112   /* if we hit select, return TRUE or pop the stack, depending on the item */
1113   if (exclusive_input_pressed(menu, IPT_UI_SELECT, 0))
5941114   {
595      *selected = ui_menu_stack_pop();
596      return 1;
1115      if (menu->selected == menu->numitems - 1)
1116      {
1117         menu->event.iptkey = IPT_UI_CANCEL;
1118         ui_menu_stack_pop(menu->machine);
1119      }
1120      return;
5971121   }
5981122
1123   /* hitting cancel also pops the stack */
1124   if (exclusive_input_pressed(menu, IPT_UI_CANCEL, 0))
1125   {
1126      ui_menu_stack_pop(menu->machine);
1127      return;
1128   }
1129
1130   /* validate the current selection */
1131   ui_menu_validate_selection(menu, 1);
1132
1133   /* swallow left/right keys if they are not appropriate */
1134   ignoreleft = ((menu->item[menu->selected].flags & MENU_FLAG_LEFT_ARROW) == 0);
1135   ignoreright = ((menu->item[menu->selected].flags & MENU_FLAG_RIGHT_ARROW) == 0);
1136
1137   /* accept left/right keys as-is with repeat */
1138   if (!ignoreleft && exclusive_input_pressed(menu, IPT_UI_LEFT, (flags & UI_MENU_PROCESS_LR_REPEAT) ? 6 : 0))
1139      return;
1140   if (!ignoreright && exclusive_input_pressed(menu, IPT_UI_RIGHT, (flags & UI_MENU_PROCESS_LR_REPEAT) ? 6 : 0))
1141      return;
1142
5991143   /* up backs up by one item */
600   if (input_ui_pressed_repeat(machine, IPT_UI_UP, 6))
601      *selected = (*selected + num_items - 1) % num_items;
1144   if (exclusive_input_pressed(menu, IPT_UI_UP, 6))
1145   {
1146      menu->selected = (menu->selected + menu->numitems - 1) % menu->numitems;
1147      ui_menu_validate_selection(menu, -1);
1148   }
6021149
6031150   /* down advances by one item */
604   if (input_ui_pressed_repeat(machine, IPT_UI_DOWN, 6))
605      *selected = (*selected + 1) % num_items;
1151   if (exclusive_input_pressed(menu, IPT_UI_DOWN, 6))
1152   {
1153      menu->selected = (menu->selected + 1) % menu->numitems;
1154      ui_menu_validate_selection(menu, 1);
1155   }
6061156
607   /* page up backs up by visible_items */
608   if (input_ui_pressed_repeat(machine, IPT_UI_PAGE_UP, 6))
1157   /* page up backs up by visitems */
1158   if (exclusive_input_pressed(menu, IPT_UI_PAGE_UP, 6))
6091159   {
610      if (*selected >= visible_items - 1)
611         *selected -= visible_items - 1;
612      else
613         *selected = 0;
1160      menu->selected -= menu->visitems - 1;
1161      ui_menu_validate_selection(menu, 1);
6141162   }
6151163
616   /* page down advances by visible_items */
617   if (input_ui_pressed_repeat(machine, IPT_UI_PAGE_DOWN, 6))
1164   /* page down advances by visitems */
1165   if (exclusive_input_pressed(menu, IPT_UI_PAGE_DOWN, 6))
6181166   {
619      *selected += visible_items - 1;
620      if (*selected >= num_items)
621         *selected = num_items - 1;
1167      menu->selected += menu->visitems - 1;
1168      ui_menu_validate_selection(menu, -1);
6221169   }
6231170
6241171   /* home goes to the start */
625   if (input_ui_pressed(machine, IPT_UI_HOME))
626      *selected = 0;
1172   if (exclusive_input_pressed(menu, IPT_UI_HOME, 0))
1173   {
1174      menu->selected = 0;
1175      ui_menu_validate_selection(menu, 1);
1176   }
6271177
6281178   /* end goes to the last */
629   if (input_ui_pressed(machine, IPT_UI_END))
630      *selected = num_items - 1;
1179   if (exclusive_input_pressed(menu, IPT_UI_END, 0))
1180   {
1181      menu->selected = menu->numitems - 1;
1182      ui_menu_validate_selection(menu, -1);
1183   }
6311184
6321185   /* pause enables/disables pause */
633   if (input_ui_pressed(machine, IPT_UI_PAUSE))
634      mame_pause(Machine, !mame_is_paused(Machine));
1186   if (!ignorepause && exclusive_input_pressed(menu, IPT_UI_PAUSE, 0))
1187      mame_pause(menu->machine, !mame_is_paused(menu->machine));
6351188
636   return 0;
1189   /* see if any other UI keys are pressed */
1190   if (menu->event.iptkey == IPT_INVALID)
1191      for (code = __ipt_ui_start; code <= __ipt_ui_end; code++)
1192      {
1193         if ((code == IPT_UI_LEFT && ignoreleft) || (code == IPT_UI_RIGHT && ignoreright) || (code == IPT_UI_PAUSE && ignorepause))
1194            continue;
1195         if (exclusive_input_pressed(menu, code, 0))
1196            break;
1197      }
6371198}
6381199
6391200
6401201/*-------------------------------------------------
1202    ui_menu_validate_selection - validate the
1203    current selection and ensure it is on a
1204    correct item
1205-------------------------------------------------*/
1206
1207static void ui_menu_validate_selection(ui_menu *menu, int scandir)
1208{
1209   /* clamp to be in range */
1210   if (menu->selected < 0)
1211      menu->selected = 0;
1212   else if (menu->selected >= menu->numitems)
1213      menu->selected = menu->numitems - 1;
1214
1215   /* skip past unselectable items */
1216   while (!item_is_selectable(&menu->item[menu->selected]))
1217      menu->selected = (menu->selected + menu->numitems + scandir) % menu->numitems;
1218}
1219
1220
1221
1222/*-------------------------------------------------
1223    ui_menu_clear_free_list - clear out anything
1224    accumulated in the free list
1225-------------------------------------------------*/
1226
1227static void ui_menu_clear_free_list(running_machine *machine)
1228{
1229   while (menu_free != NULL)
1230   {
1231      ui_menu *menu = menu_free;
1232      menu_free = menu->parent;
1233      ui_menu_free(menu);
1234   }
1235}
1236
1237
1238
1239/***************************************************************************
1240    MENU STACK MANAGEMENT
1241***************************************************************************/
1242
1243/*-------------------------------------------------
6411244    ui_menu_stack_reset - reset the menu stack
6421245-------------------------------------------------*/
6431246
644void ui_menu_stack_reset(void)
1247void ui_menu_stack_reset(running_machine *machine)
6451248{
646   menu_state *state = &menu_stack[menu_stack_index = 0];
647   state->handler = NULL;
648   state->state = 0;
1249   while (menu_stack != NULL)
1250      ui_menu_stack_pop(machine);
6491251}
6501252
6511253
r2956r2957
6541256    stack
6551257-------------------------------------------------*/
6561258
657UINT32 ui_menu_stack_push(ui_menu_handler_func new_handler, UINT32 new_state)
1259void ui_menu_stack_push(ui_menu *menu)
6581260{
659   menu_state *state = &menu_stack[++menu_stack_index];
660   assert(menu_stack_index < MENU_STACK_DEPTH);
661   state->handler = new_handler;
662   state->state = new_state;
663   return new_state;
1261   menu->parent = menu_stack;
1262   menu_stack = menu;
1263   ui_menu_reset(menu, UI_MENU_RESET_SELECT_FIRST);
1264   ui_input_reset(menu->machine);
6641265}
6651266
6661267
r2956r2957
6681269    ui_menu_stack_pop - pop a menu from the stack
6691270-------------------------------------------------*/
6701271
671UINT32 ui_menu_stack_pop(void)
1272void ui_menu_stack_pop(running_machine *machine)
6721273{
673   menu_state *state = &menu_stack[--menu_stack_index];
674   assert(menu_stack_index >= 0);
675   return state->state;
1274   if (menu_stack != NULL)
1275   {
1276      ui_menu *menu = menu_stack;
1277      menu_stack = menu->parent;
1278      menu->parent = menu_free;
1279      menu_free = menu;
1280      ui_input_reset(machine);
1281   }
6761282}
6771283
6781284
1285
1286/***************************************************************************
1287    UI SYSTEM INTERACTION
1288***************************************************************************/
1289
6791290/*-------------------------------------------------
6801291    ui_menu_ui_handler - displays the current menu
6811292    and calls the menu handler
r2956r2957
6831294
6841295UINT32 ui_menu_ui_handler(running_machine *machine, UINT32 state)
6851296{
686   UINT32 newstate;
687
6881297   /* if we have no menus stacked up, start with the main menu */
689   if (menu_stack[menu_stack_index].handler == NULL)
690      ui_menu_stack_push(menu_main, 0);
1298   if (menu_stack == NULL)
1299      ui_menu_stack_push(ui_menu_alloc(machine, menu_main, NULL));
6911300
6921301   /* update the menu state */
693   newstate = (*menu_stack[menu_stack_index].handler)(machine, menu_stack[menu_stack_index].state);
694   menu_stack[menu_stack_index].state = newstate;
1302   if (menu_stack != NULL)
1303   {
1304      ui_menu *menu = menu_stack;
1305      (*menu->handler)(machine, menu, menu->parameter, menu->state);
1306   }
6951307
1308   /* clear up anything pending to be released */
1309   ui_menu_clear_free_list(machine);
1310
6961311   /* if the menus are to be hidden, return a cancel here */
697   if ((input_ui_pressed(machine, IPT_UI_CONFIGURE) && !ui_menu_is_force_game_select()) || menu_stack[menu_stack_index].handler == NULL)
1312   if ((ui_input_pressed(machine, IPT_UI_CONFIGURE) && !ui_menu_is_force_game_select()) || menu_stack == NULL)
6981313      return UI_HANDLER_CANCEL;
6991314
7001315   return 0;
r2956r2957
7081323
7091324void ui_menu_force_game_select(void)
7101325{
1326   char *gamename = (char *)options_get_string(mame_options(), OPTION_GAMENAME);
1327
7111328   /* reset the menu stack */
712   ui_menu_stack_reset();
1329   ui_menu_stack_reset(Machine);
7131330
7141331   /* add the quit entry followed by the game select entry */
715   ui_menu_stack_push(menu_quit_game, 0);
716   ui_menu_stack_push(menu_select_game, 1 << 16);
1332   ui_menu_stack_push(ui_menu_alloc(Machine, menu_quit_game, NULL));
1333   ui_menu_stack_push(ui_menu_alloc(Machine, menu_select_game, gamename));
7171334
718   /* initialize the game name buffer */
719   select_game_buffer[0] = 0;
720   strcpy(select_game_buffer, options_get_string(mame_options(), OPTION_GAMENAME));
721
7221335   /* force the menus on */
7231336   ui_show_menu();
7241337
r2956r2957
7351348
7361349int ui_menu_is_force_game_select(void)
7371350{
738   return (menu_stack_index >= 2 && menu_stack[1].handler == menu_quit_game);
1351   ui_menu *menu;
1352
1353   for (menu = menu_stack; menu != NULL; menu = menu->parent)
1354      if (menu->handler == menu_quit_game && menu->parent == NULL)
1355         return TRUE;
1356
1357   return FALSE;
7391358}
7401359
7411360
r2956r2957
7451364***************************************************************************/
7461365
7471366/*-------------------------------------------------
748    menu_main - main UI menu
1367    menu_main - handle the main menu
7491368-------------------------------------------------*/
7501369
751static UINT32 menu_main(running_machine *machine, UINT32 state)
1370static void menu_main(running_machine *machine, ui_menu *menu, void *parameter, void *state)
7521371{
753#define ADD_MENU(name, _handler, _param) \
754do { \
755   item_list[menu_items].text = name; \
756   handler_list[menu_items].handler = _handler; \
757   handler_list[menu_items].state = _param; \
758   menu_items++; \
759} while (0)
1372   const ui_menu_event *event;
7601373
1374   /* if the menu isn't built, populate now */
1375   if (!ui_menu_populated(menu))
1376      menu_main_populate(machine, menu, state);
1377
1378   /* process the menu */
1379   event = ui_menu_process(menu, 0);
1380   if (event != NULL && event->iptkey == IPT_UI_SELECT)
1381      ui_menu_stack_push(ui_menu_alloc(machine, event->itemref, NULL));
1382}
1383
1384
1385/*-------------------------------------------------
1386    menu_main_populate - populate the main menu
1387-------------------------------------------------*/
1388
1389static void menu_main_populate(running_machine *machine, ui_menu *menu, void *state)
1390{
1391   const input_field_config *field;
7611392   const input_port_config *port;
762   const input_field_config *field;
763   menu_state handler_list[20];
764   ui_menu_item item_list[20];
7651393   int has_categories = FALSE;
7661394   int has_configs = FALSE;
7671395   int has_analog = FALSE;
7681396   int has_dips = FALSE;
769   int menu_items = 0;
770   int visible_items;
7711397
7721398   /* scan the input port array to see what options we need to enable */
7731399   for (port = machine->portconfig; port != NULL; port = port->next)
r2956r2957
7831409            has_analog = TRUE;
7841410      }
7851411
786   /* reset the menu */
787   memset(item_list, 0, sizeof(item_list));
788
7891412   /* add input menu items */
790   ADD_MENU("Input (general)", menu_input_groups, 0);
791   ADD_MENU("Input (this " CAPSTARTGAMENOUN ")", menu_input, 1000 << 16);
1413   ui_menu_item_append(menu, "Input (general)", NULL, 0, menu_input_groups);
1414   ui_menu_item_append(menu, "Input (this " CAPSTARTGAMENOUN ")", NULL, 0, menu_input_specific);
7921415
7931416   /* add optional input-related menus */
7941417   if (has_dips)
795      ADD_MENU("Dip Switches", menu_switches, IPT_DIPSWITCH << 16);
1418      ui_menu_item_append(menu, "Dip Switches", NULL, 0, menu_settings_dip_switches);
7961419   if (has_configs)
797      ADD_MENU("Driver Configuration", menu_switches, IPT_CONFIG << 16);
798#ifdef MESS
1420      ui_menu_item_append(menu, "Driver Configuration", NULL, 0, menu_settings_driver_config);
7991421   if (has_categories)
800      ADD_MENU("Categories", menu_switches, IPT_CATEGORY << 16);
801#endif
1422      ui_menu_item_append(menu, "Categories", NULL, 0, menu_settings_categories);
8021423   if (has_analog)
803      ADD_MENU("Analog Controls", menu_analog, 0);
1424      ui_menu_item_append(menu, "Analog Controls", NULL, 0, menu_analog);
8041425
8051426#ifndef MESS
8061427     /* add bookkeeping menu */
807   ADD_MENU("Bookkeeping Info", menu_bookkeeping, 0);
1428   ui_menu_item_append(menu, "Bookkeeping Info", NULL, 0, menu_bookkeeping);
8081429#endif
8091430
8101431   /* add game info menu */
811   ADD_MENU(CAPSTARTGAMENOUN " Information", menu_game_info, 0);
1432   ui_menu_item_append(menu, CAPSTARTGAMENOUN " Information", NULL, 0, menu_game_info);
8121433
8131434#ifdef MESS
8141435     /* add image info menu */
815   ADD_MENU("Image Information", ui_menu_image_info, 0);
1436   ui_menu_item_append(menu, "Image Information", NULL, 0, ui_menu_image_info);
8161437
8171438     /* add image info menu */
818   ADD_MENU("File Manager", menu_file_manager, 1);
1439   ui_menu_item_append(menu, "File Manager", NULL, 0, menu_file_manager);
8191440
8201441#if HAS_WAVE
8211442     /* add tape control menu */
8221443   if (device_find_from_machine(machine, IO_CASSETTE))
823      ADD_MENU("Tape Control", menu_tape_control, 1);
1444      ui_menu_item_append(menu, "Tape Control", NULL, 0, menu_tape_control);
8241445#endif /* HAS_WAVE */
8251446#endif /* MESS */
8261447
8271448   /* add video options menu */
828   ADD_MENU("Video Options", menu_video, 1000 << 16);
1449   ui_menu_item_append(menu, "Video Options", NULL, 0, (render_target_get_indexed(1) != NULL) ? menu_video_targets : menu_video_options);
8291450
8301451   /* add cheat menu */
831   if (options_get_bool(mame_options(), OPTION_CHEAT))
832      ADD_MENU("Cheat", menu_cheat, 1);
1452//  if (options_get_bool(mame_options(), OPTION_CHEAT))
1453//      ui_menu_item_append(menu, "Cheat", NULL, 0, menu_cheat);
8331454
8341455   /* add memory card menu */
8351456   if (machine->config->memcard_handler != NULL)
836      ADD_MENU("Memory Card", menu_memory_card, 0);
1457      ui_menu_item_append(menu, "Memory Card", NULL, 0, menu_memory_card);
8371458
8381459   /* add reset and exit menus */
839   ADD_MENU("Select New " CAPSTARTGAMENOUN, menu_select_game, 1 << 16);
840   ADD_MENU("Return to " CAPSTARTGAMENOUN, NULL, 0);
1460   ui_menu_item_append(menu, "Select New " CAPSTARTGAMENOUN, NULL, 0, menu_select_game);
1461}
8411462
842   /* draw the menu */
843   visible_items = ui_menu_draw(item_list, menu_items, state, NULL);
8441463
845   /* handle the keys */
846   if (ui_menu_generic_keys(machine, &state, menu_items, visible_items))
847      return state;
848   if (input_ui_pressed(machine, IPT_UI_SELECT))
849      return ui_menu_stack_push(handler_list[state].handler, handler_list[state].state);
1464/*-------------------------------------------------
1465    menu_input_groups - handle the input groups
1466    menu
1467-------------------------------------------------*/
8501468
851   return state;
1469static void menu_input_groups(running_machine *machine, ui_menu *menu, void *parameter, void *state)
1470{
1471   const ui_menu_event *event;
8521472
853#undef ADD_MENU
1473   /* if the menu isn't built, populate now */
1474   if (!ui_menu_populated(menu))
1475      menu_input_groups_populate(machine, menu, state);
1476
1477   /* process the menu */
1478   event = ui_menu_process(menu, 0);
1479   if (event != NULL && event->iptkey == IPT_UI_SELECT)
1480      ui_menu_stack_push(ui_menu_alloc(machine, menu_input_general, event->itemref));
8541481}
8551482
8561483
8571484/*-------------------------------------------------
858    menu_input_groups - menu displaying input
859    groups
1485    menu_input_groups_populate - populate the
1486    input groups menu
8601487-------------------------------------------------*/
8611488
862static UINT32 menu_input_groups(running_machine *machine, UINT32 state)
1489static void menu_input_groups_populate(running_machine *machine, ui_menu *menu, void *state)
8631490{
864   ui_menu_item item_list[IPG_TOTAL_GROUPS + 2];
865   int menu_items = 0;
866   int visible_items;
8671491   int player;
8681492
869   /* reset the menu */
870   memset(item_list, 0, sizeof(item_list));
871   menu_string_pool_offset = 0;
872
8731493   /* build up the menu */
874   item_list[menu_items++].text = "User Interface";
1494   ui_menu_item_append(menu, "User Interface", NULL, 0, (void *)(IPG_UI + 1));
8751495   for (player = 0; player < MAX_PLAYERS; player++)
876      item_list[menu_items++].text = menu_string_pool_add("Player %d Controls", player + 1);
877   item_list[menu_items++].text = "Other Controls";
1496   {
1497      char buffer[40];
1498      sprintf(buffer, "Player %d Controls", player + 1);
1499      ui_menu_item_append(menu, buffer, NULL, 0, (void *)(FPTR)(IPG_PLAYER1 + player + 1));
1500   }
1501   ui_menu_item_append(menu, "Other Controls", NULL, 0, (void *)(FPTR)(IPG_OTHER + 1));
1502}
8781503
879   /* add an item for the return */
880   item_list[menu_items++].text = "Return to Prior Menu";
8811504
882   /* draw the menu */
883   visible_items = ui_menu_draw(item_list, menu_items, state, NULL);
8841505
885   /* handle the keys */
886   if (ui_menu_generic_keys(machine, &state, menu_items, visible_items))
887      return state;
888   if (input_ui_pressed(machine, IPT_UI_SELECT))
889      return ui_menu_stack_push(menu_input, state << 16);
1506/*-------------------------------------------------
1507    menu_input_general - handle the general
1508    input menu
1509-------------------------------------------------*/
8901510
891   return state;
1511static void menu_input_general(running_machine *machine, ui_menu *menu, void *parameter, void *state)
1512{
1513   menu_input_common(machine, menu, parameter, state);
8921514}
8931515
8941516
8951517/*-------------------------------------------------
896    menu_input - display a menu for inputs
1518    menu_input_general_populate - populate the
1519    general input menu
8971520-------------------------------------------------*/
8981521
899static UINT32 menu_input(running_machine *machine, UINT32 state)
1522static void menu_input_general_populate(running_machine *machine, ui_menu *menu, input_menu_state *menustate, int group)
9001523{
901   ui_menu_item item_list[MAX_INPUT_PORTS * MAX_BITS_PER_PORT / 2];
902   input_item_data item_data[MAX_INPUT_PORTS * MAX_BITS_PER_PORT / 2];
903   input_item_data *selected_item_data;
904   UINT32 selected = state & 0x3fff;
905   int record_next = (state >> 14) & 1;
906   int polling = (state >> 15) & 1;
907   int group = state >> 16;
908   int changed = FALSE;
909   int visible_items;
910   int menu_items;
911   int item;
1524   astring *tempstring = astring_alloc();
1525   input_item_data *itemlist = NULL;
1526   const input_type_desc *typedesc;
1527   int suborder[SEQ_TYPE_TOTAL];
1528   int sortorder = 1;
9121529
913   /* get the list of items */
914   menu_string_pool_offset = 0;
1530   /* create a mini lookup table for sort order based on sequence type */
1531   suborder[SEQ_TYPE_STANDARD] = 0;
1532   suborder[SEQ_TYPE_DECREMENT] = 1;
1533   suborder[SEQ_TYPE_INCREMENT] = 2;
9151534
916   /* an out of range group is special; it just means the game-specific inputs */
917   if (group > IPG_TOTAL_GROUPS)
918      menu_items = input_menu_get_game_items(machine, item_data);
919   else
920      menu_items = input_menu_get_items(machine, item_data, group);
1535   /* iterate over the input ports and add menu items */
1536   for (typedesc = input_type_list(machine); typedesc != NULL; typedesc = typedesc->next)
9211537
922   /* build the menu */
923   memset(item_list, 0, sizeof(item_list));
924   for (item = 0; item < menu_items; item++)
925   {
926      input_item_data *id = &item_data[item];
1538      /* add if we match the group and we have a valid name */
1539      if (typedesc->group == group && typedesc->name != NULL && typedesc->name[0] != 0)
1540      {
1541         input_seq_type seqtype;
9271542
928      /* set the item text from the precomputed data */
929      item_list[item].text = id->name;
930      item_list[item].subtext = id->seqname;
931      if (id->invert)
932         item_list[item].flags |= MENU_FLAG_INVERT;
1543         /* loop over all sequence types */
1544         sortorder++;
1545         for (seqtype = SEQ_TYPE_STANDARD; seqtype < SEQ_TYPE_TOTAL; seqtype++)
1546         {
1547            /* build an entry for the standard sequence */
1548            input_item_data *item = ui_menu_pool_alloc(menu, sizeof(*item));
1549            memset(item, 0, sizeof(*item));
1550            item->ref = typedesc;
1551            item->seqtype = seqtype;
1552            item->seq = *input_type_seq(machine, typedesc->type, typedesc->player, seqtype);
1553            item->defseq = &typedesc->seq[seqtype];
1554            item->sortorder = sortorder * 4 + suborder[seqtype];
1555            item->type = input_type_is_analog(typedesc->type) ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
1556            item->name = typedesc->name;
1557            item->next = itemlist;
1558            itemlist = item;
9331559
934      /* keep the sequence pointer as a ref */
935      item_list[item].ref = id;
936   }
1560            /* stop after one, unless we're analog */
1561            if (item->type == INPUT_TYPE_DIGITAL)
1562               break;
1563         }
1564      }
9371565
938   /* sort the list canonically */
939   qsort(item_list, menu_items, sizeof(item_list[0]), input_menu_compare_items);
1566   /* sort and populate the menu in a standard fashion */
1567   menu_input_populate_and_sort(menu, itemlist, menustate);
1568   astring_free(tempstring);
1569}
9401570
941   /* add an item to return */
942   item_list[menu_items++].text = "Return to Prior Menu";
9431571
944   /* if we're polling, just put an empty entry and arrows for the subitem */
945   if (polling)
1572/*-------------------------------------------------
1573    menu_input_specific - handle the game-specific
1574    input menu
1575-------------------------------------------------*/
1576
1577static void menu_input_specific(running_machine *machine, ui_menu *menu, void *parameter, void *state)
1578{
1579   menu_input_common(machine, menu, NULL, state);
1580}
1581
1582
1583/*-------------------------------------------------
1584    menu_input_specific_populate - populate
1585    the input menu with game-specific items
1586-------------------------------------------------*/
1587
1588static void menu_input_specific_populate(running_machine *machine, ui_menu *menu, input_menu_state *menustate)
1589{
1590   astring *tempstring = astring_alloc();
1591   input_item_data *itemlist = NULL;
1592   const input_field_config *field;
1593   const input_port_config *port;
1594   int suborder[SEQ_TYPE_TOTAL];
1595
1596   /* create a mini lookup table for sort order based on sequence type */
1597   suborder[SEQ_TYPE_STANDARD] = 0;
1598   suborder[SEQ_TYPE_DECREMENT] = 1;
1599   suborder[SEQ_TYPE_INCREMENT] = 2;
1600
1601   /* iterate over the input ports and add menu items */
1602   for (port = machine->portconfig; port != NULL; port = port->next)
1603      for (field = port->fieldlist; field != NULL; field = field->next)
1604      {
1605         const char *name = input_field_name(field);
1606
1607         /* add if we match the group and we have a valid name */
1608         if (name != NULL && input_condition_true(machine, &field->condition) &&
1609#ifdef MESS
1610            (field->category == 0 || input_category_active(machine, field->category)) &&
1611#endif /* MESS */
1612            ((field->type == IPT_OTHER && field->name != NULL) || input_type_group(machine, field->type, field->player) != IPG_INVALID))
1613         {
1614            input_seq_type seqtype;
1615            UINT16 sortorder;
1616
1617            /* determine the sorting order */
1618            if (field->type >= IPT_START1 && field->type <= __ipt_analog_end)
1619               sortorder = (field->type << 2) | (field->player << 12);
1620            else
1621               sortorder = field->type | 0xf000;
1622
1623            /* loop over all sequence types */
1624            for (seqtype = SEQ_TYPE_STANDARD; seqtype < SEQ_TYPE_TOTAL; seqtype++)
1625            {
1626               /* build an entry for the standard sequence */
1627               input_item_data *item = ui_menu_pool_alloc(menu, sizeof(*item));
1628               memset(item, 0, sizeof(*item));
1629               item->ref = field;
1630               item->seqtype = seqtype;
1631               item->seq = *input_field_seq(field, seqtype);
1632               item->defseq = get_field_default_seq(field, seqtype);
1633               item->sortorder = sortorder + suborder[seqtype];
1634               item->type = input_type_is_analog(field->type) ? (INPUT_TYPE_ANALOG + seqtype) : INPUT_TYPE_DIGITAL;
1635               item->name = name;
1636               item->next = itemlist;
1637               itemlist = item;
1638
1639               /* stop after one, unless we're analog */
1640               if (item->type == INPUT_TYPE_DIGITAL)
1641                  break;
1642            }
1643         }
1644      }
1645
1646   /* sort and populate the menu in a standard fashion */
1647   menu_input_populate_and_sort(menu, itemlist, menustate);
1648   astring_free(tempstring);
1649}
1650
1651
1652/*-------------------------------------------------
1653    menu_input - display a menu for inputs
1654-------------------------------------------------*/
1655
1656static void menu_input_common(running_machine *machine, ui_menu *menu, void *parameter, void *state)
1657{
1658   input_item_data *seqchangeditem = NULL;
1659   input_menu_state *menustate;
1660   const ui_menu_event *event;
1661   int invalidate = FALSE;
1662
1663   /* if no state, allocate now */
1664   if (state == NULL)
1665      state = ui_menu_alloc_state(menu, sizeof(*menustate));
1666   menustate = state;
1667
1668   /* if the menu isn't built, populate now */
1669   if (!ui_menu_populated(menu))
9461670   {
947      item_list[selected].subtext = "   ";
948      item_list[selected].flags = MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW;
1671      if (parameter != NULL)
1672         menu_input_general_populate(machine, menu, menustate, (FPTR)parameter - 1);
1673      else
1674         menu_input_specific_populate(machine, menu, menustate);
9491675   }
9501676
951   /* draw the menu */
952   visible_items = ui_menu_draw(item_list, menu_items, selected, NULL);
1677   /* process the menu */
1678   event = ui_menu_process(menu, (menustate->pollingitem != NULL) ? UI_MENU_PROCESS_NOKEYS : 0);
9531679
954   /* if we're polling, read the sequence */
955   selected_item_data = item_list[selected].ref;
956   if (polling)
1680   /* if we are polling, handle as a special case */
1681   if (menustate->pollingitem != NULL)
9571682   {
1683      input_item_data *item = menustate->pollingitem;
9581684      input_seq newseq;
9591685
9601686      /* if UI_CANCEL is pressed, abort */
961      if (input_ui_pressed(machine, IPT_UI_CANCEL))
1687      if (ui_input_pressed(machine, IPT_UI_CANCEL))
9621688      {
963         record_next = polling = FALSE;
964         input_menu_toggle_none_default(&selected_item_data->seq, &starting_seq, selected_item_data->defseq);
965         changed = TRUE;
1689         menustate->pollingitem = NULL;
1690         menustate->record_next = FALSE;
1691         toggle_none_default(&item->seq, &menustate->starting_seq, item->defseq);
1692         seqchangeditem = item;
9661693      }
9671694
9681695      /* poll again; if finished, update the sequence */
9691696      if (input_seq_poll(&newseq))
9701697      {
971         record_next = TRUE;
972         polling = FALSE;
973         selected_item_data->seq = newseq;
974         changed = TRUE;
1698         menustate->pollingitem = NULL;
1699         menustate->record_next = TRUE;
1700         item->seq = newseq;
1701         seqchangeditem = item;
9751702      }
9761703   }
9771704
978   /* otherwise, handle the keys */
979   else
1705   /* otherwise, handle the events */
1706   else if (event != NULL && event->itemref != NULL)
9801707   {
981      int prevsel = selected;
982
983      /* handle generic menu keys */
984      if (ui_menu_generic_keys(machine, &selected, menu_items, visible_items))
985         return selected;
986
987      /* if an item was selected, start polling on it */
988      if (input_ui_pressed(machine, IPT_UI_SELECT))
1708      input_item_data *item = event->itemref;
1709      switch (event->iptkey)
9891710      {
990         input_seq_poll_start((selected_item_data->type == INPUT_TYPE_ANALOG) ? ITEM_CLASS_ABSOLUTE : ITEM_CLASS_SWITCH, record_next ? &selected_item_data->seq : NULL);
991         starting_seq = selected_item_data->seq;
992         polling = TRUE;
993      }
1711         /* an item was selected: begin polling */
1712         case IPT_UI_SELECT:
1713            menustate->pollingitem = item;
1714            menustate->lastref = item->ref;
1715            menustate->starting_seq = item->seq;
1716            input_seq_poll_start((item->type == INPUT_TYPE_ANALOG) ? ITEM_CLASS_ABSOLUTE : ITEM_CLASS_SWITCH, menustate->record_next ? &item->seq : NULL);
1717            invalidate = TRUE;
1718            break;
9941719
995      /* if the clear key was pressed, reset the selected item */
996      if (input_ui_pressed(machine, IPT_UI_CLEAR))
997      {
998         input_menu_toggle_none_default(&selected_item_data->seq, &selected_item_data->seq, selected_item_data->defseq);
999         record_next = FALSE;
1000         changed = TRUE;
1720         /* if the clear key was pressed, reset the selected item */
1721         case IPT_UI_CLEAR:
1722            toggle_none_default(&item->seq, &item->seq, item->defseq);
1723            menustate->record_next = FALSE;
1724            seqchangeditem = item;
1725            break;
10011726      }
10021727
1003      /* if the selection changed, update and reset the "record first" flag */
1004      if (selected != prevsel)
1005         record_next = FALSE;
1728      /* if the selection changed, reset the "record next" flag */
1729      if (item->ref != menustate->lastref)
1730         menustate->record_next = FALSE;
1731      menustate->lastref = item->ref;
10061732   }
10071733
10081734   /* if the sequence changed, update it */
1009   if (changed)
1735   if (seqchangeditem != NULL)
10101736   {
1011      if (group > IPG_TOTAL_GROUPS)
1737      /* update a general input */
1738      if (parameter != NULL)
10121739      {
1013         input_field_user_settings settings;
1740         const input_type_desc *typedesc = seqchangeditem->ref;
1741         input_type_set_seq(machine, typedesc->type, typedesc->player, seqchangeditem->seqtype, &seqchangeditem->seq);
1742      }
10141743
1015         input_field_get_user_settings(selected_item_data->field, &settings);
1016         settings.seq[selected_item_data->seqtype] = selected_item_data->seq;
1017         input_field_set_user_settings(selected_item_data->field, &settings);
1018      }
1744      /* update a game-specific input */
10191745      else
10201746      {
1021         const input_type_desc *typedesc = selected_item_data->typedesc;
1022         input_type_set_seq(machine, typedesc->type, typedesc->player, selected_item_data->seqtype, &selected_item_data->seq);
1747         input_field_user_settings settings;
1748
1749         input_field_get_user_settings(seqchangeditem->ref, &settings);
1750         settings.seq[seqchangeditem->seqtype] = seqchangeditem->seq;
1751         input_field_set_user_settings(seqchangeditem->ref, &settings);
10231752      }
1753
1754      /* invalidate the menu to force an update */
1755      invalidate = TRUE;
10241756   }
10251757
1026   return selected | (record_next << 14) | (polling << 15) | (group << 16);
1758   /* if the menu is invalidated, clear it now */
1759   if (invalidate)
1760   {
1761      menustate->pollingref = NULL;
1762      if (menustate->pollingitem != NULL)
1763         menustate->pollingref = menustate->pollingitem->ref;
1764      ui_menu_reset(menu, UI_MENU_RESET_REMEMBER_POSITION);
1765   }
10271766}
10281767
10291768
10301769/*-------------------------------------------------
1031    menu_switches - display a menu for DIP
1032    switches
1770    menu_input_compare_items - compare two
1771    items for quicksort
10331772-------------------------------------------------*/
10341773
1035static UINT32 menu_switches(running_machine *machine, UINT32 state)
1774static int menu_input_compare_items(const void *i1, const void *i2)
10361775{
1037   ui_menu_item item_list[MAX_INPUT_PORTS * MAX_BITS_PER_PORT / 2];
1038   int switch_name = (state >> 16) & 0xff;
1039   UINT32 selected = state & 0xffff;
1040   const input_port_config *port;
1041   const input_field_config *field;
1042   const input_field_config *selected_field = NULL;
1043   int menu_items = 0;
1044   int changed = FALSE;
1045   int visible_items;
1046   menu_extra extra;
1776   const input_item_data * const *data1 = i1;
1777   const input_item_data * const *data2 = i2;
1778   if ((*data1)->sortorder < (*data2)->sortorder)
1779      return -1;
1780   if ((*data1)->sortorder > (*data2)->sortorder)
1781      return 1;
1782   return 0;
1783}
10471784
1048   /* reset the menu */
1049   memset(item_list, 0, sizeof(item_list));
1050   /* reset the dip switch model */
1051   memset(dip_switch_model, 0, sizeof(dip_switch_model));
10521785
1053   /* loop over input ports and set up the current values */
1054   for (port = machine->portconfig; port != NULL; port = port->next)
1055      for (field = port->fieldlist; field != NULL; field = field->next)
1056         if (field->type == switch_name && input_condition_true(machine, &field->condition))
1057         {
1058            switches_menu_add_item(&item_list[menu_items], field);
1059            if (field->type == IPT_DIPSWITCH)
1060               dip_switch_build_model(field, menu_items == selected);
1061            menu_items++;
1062         }
1786/*-------------------------------------------------
1787    menu_input_populate_and_sort - take a list
1788    of input_item_data objects and build up the
1789    menu from them
1790-------------------------------------------------*/
10631791
1064   /* sort the list */
1065   selected_field = item_list[selected].ref;
1792static void menu_input_populate_and_sort(ui_menu *menu, input_item_data *itemlist, input_menu_state *menustate)
1793{
1794   const char *nameformat[INPUT_TYPE_TOTAL] = { 0 };
1795   input_item_data **itemarray, *item;
1796   astring *subtext = astring_alloc();
1797   astring *text = astring_alloc();
1798   int numitems = 0, curitem;
10661799
1067   /* add an item to return */
1068   item_list[menu_items++].text = "Return to Prior Menu";
1800   /* create a mini lookup table for name format based on type */
1801   nameformat[INPUT_TYPE_DIGITAL] = "%s";
1802   nameformat[INPUT_TYPE_ANALOG] = "%s Analog";
1803   nameformat[INPUT_TYPE_ANALOG_INC] = "%s Analog Inc";
1804   nameformat[INPUT_TYPE_ANALOG_DEC] = "%s Analog Dec";
10691805
1070   /* configure the extra menu */
1071   extra.top = 0;
1072   extra.bottom = get_num_dips() * (DIP_SWITCH_HEIGHT + DIP_SWITCH_SPACING) + DIP_SWITCH_SPACING;
1073   extra.render = dip_switch_render;
1806   /* first count the number of items */
1807   for (item = itemlist; item != NULL; item = item->next)
1808      numitems++;
10741809
1075   /* go through the port map and create masks that are easy to use when drawing DIP graphics. */
1076   /* draw the menu, augment the regular menue drawing with an additional box for DIPs */
1077   visible_items = ui_menu_draw(item_list, menu_items, selected, (dip_switch_model[0].dip_name) ? &extra : NULL);
1810   /* now allocate an array of items and fill it up */
1811   itemarray = ui_menu_pool_alloc(menu, sizeof(*itemarray) * numitems);
1812   for (item = itemlist, curitem = 0; item != NULL; item = item->next)
1813      itemarray[curitem++] = item;
10781814
1079   /* handle generic menu keys */
1080   if (ui_menu_generic_keys(machine, &selected, menu_items, visible_items))
1081      return selected;
1815   /* sort it */
1816   qsort(itemarray, numitems, sizeof(*itemarray), menu_input_compare_items);
10821817
1083   /* handle left/right arrows */
1084   if (input_ui_pressed(machine, IPT_UI_LEFT) && (item_list[selected].flags & MENU_FLAG_LEFT_ARROW))
1818   /* build the menu */
1819   for (curitem = 0; curitem < numitems; curitem++)
10851820   {
1086      input_field_select_previous_setting(selected_field);
1087      changed = TRUE;
1088   }
1089   if (input_ui_pressed(machine, IPT_UI_RIGHT) && (item_list[selected].flags & MENU_FLAG_RIGHT_ARROW))
1090   {
1091      input_field_select_next_setting(selected_field);
1092      changed = TRUE;
1093   }
1821      UINT32 flags = 0;
10941822
1095   /* select resets to the default value */
1096   if (input_ui_pressed(machine, IPT_UI_SELECT))
1097   {
1098      input_field_user_settings settings;
1099      input_field_get_user_settings(selected_field, &settings);
1100      settings.value = selected_field->defvalue;
1101      input_field_set_user_settings(selected_field, &settings);
1102   }
1823      /* generate the name of the item itself, based off the base name and the type */
1824      item = itemarray[curitem];
1825      assert(nameformat[item->type] != NULL);
1826      astring_printf(text, nameformat[item->type], item->name);
11031827
1104   /* update the selection to match the existing entry in case things got shuffled */
1105   /* due to conditional DIPs changing things */
1106   if (changed)
1107   {
1108      int newselected = 0;
1109      for (port = machine->portconfig; port != NULL; port = port->next)
1110         for (field = port->fieldlist; field != NULL; field = field->next)
1111            if (field->type == switch_name && input_condition_true(machine, &field->condition))
1112            {
1113               if (field == selected_field)
1114               {
1115                  selected = newselected;
1116                  break;
1117               }
1118               newselected++;
1119            }
1828      /* if we're polling this item, use some spaces with left/right arrows */
1829      if (menustate->pollingref == item->ref)
1830      {
1831         astring_cpyc(subtext, "   ");
1832         flags |= MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW;
1833      }
1834
1835      /* otherwise, generate the sequence name and invert it if different from the default */
1836      else
1837      {
1838         input_seq_name(subtext, &item->seq);
1839         flags |= input_seq_cmp(&item->seq, item->defseq) ? MENU_FLAG_INVERT : 0;
1840      }
1841
1842      /* add the item */
1843      ui_menu_item_append(menu, astring_c(text), astring_c(subtext), flags, item);
11201844   }
11211845
1122   return selected | (switch_name << 16);
1846   /* free our temporary strings */
1847   astring_free(subtext);
1848   astring_free(text);
11231849}
11241850
11251851
11261852/*-------------------------------------------------
1127    menu_analog - display a menu for analog
1128    control settings
1853    menu_settings_dip_switches - handle the DIP
1854    switches menu
11291855-------------------------------------------------*/
11301856
1131static UINT32 menu_analog(running_machine *machine, UINT32 state)
1857static void menu_settings_dip_switches(running_machine *machine, ui_menu *menu, void *parameter, void *state)
11321858{
1133   ui_menu_item item_list[MAX_INPUT_PORTS * 4 * ANALOG_ITEM_COUNT];
1134   const input_port_config *port;
1135   const input_field_config *field;
1136   const input_field_config *selected_field = NULL;
1137   int menu_items = 0;
1138   int selected_item = 0;
1139   int visible_items;
1140   int delta = 0;
1141   int use_autocenter;
1859   menu_settings_common(machine, menu, state, IPT_DIPSWITCH);
1860}
11421861
1143   /* reset the menu and string pool */
1144   memset(item_list, 0, sizeof(item_list));
1145   menu_string_pool_offset = 0;
11461862
1147   /* loop over input ports and add the items */
1148   for (port = Machine->portconfig; port != NULL; port = port->next)
1149      for (field = port->fieldlist; field != NULL; field = field->next)
1150         if (input_type_is_analog(field->type))
1151         {
1152            use_autocenter = FALSE;
1153            switch (field->type)
1154            {
1155               /* Autocenter Speed is only used for these devices */
1156               case IPT_POSITIONAL:
1157               case IPT_POSITIONAL_V:
1158                  if (field->flags & ANALOG_FLAG_WRAPS)
1159                     break;
1863/*-------------------------------------------------
1864    menu_settings_driver_config - handle the
1865    driver config menu
1866-------------------------------------------------*/
11601867
1161               case IPT_PEDAL:
1162               case IPT_PEDAL2:
1163               case IPT_PEDAL3:
1164               case IPT_PADDLE:
1165               case IPT_PADDLE_V:
1166               case IPT_AD_STICK_X:
1167               case IPT_AD_STICK_Y:
1168               case IPT_AD_STICK_Z:
1169                  use_autocenter = TRUE;
1170                  break;
1171            }
1868static void menu_settings_driver_config(running_machine *machine, ui_menu *menu, void *parameter, void *state)
1869{
1870   menu_settings_common(machine, menu, state, IPT_CONFIG);
1871}
11721872
1173            /* track the selected item */
1174            if (state >= menu_items && state < menu_items + 3 + use_autocenter)
1175            {
1176               selected_field = field;
1177               selected_item = state - menu_items;
1178               // shift menu for missing Autocenter
1179               if (selected_item && !use_autocenter)
1180                  selected_item++;
1181            }
11821873
1183            /* add the needed items for each analog input */
1184            analog_menu_add_item(&item_list[menu_items++], field, "Digital Speed", ANALOG_ITEM_KEYSPEED);
1185            if (use_autocenter)
1186               analog_menu_add_item(&item_list[menu_items++], field, "Autocenter Speed", ANALOG_ITEM_CENTERSPEED);
1187            analog_menu_add_item(&item_list[menu_items++], field, "Reverse", ANALOG_ITEM_REVERSE);
1188            analog_menu_add_item(&item_list[menu_items++], field, "Sensitivity", ANALOG_ITEM_SENSITIVITY);
1189         }
1874/*-------------------------------------------------
1875    menu_settings_categories - handle the
1876    categories menu
1877-------------------------------------------------*/
11901878
1191   /* add an item to return */
1192   item_list[menu_items++].text = "Return to Prior Menu";
1879static void menu_settings_categories(running_machine *machine, ui_menu *menu, void *parameter, void *state)
1880{
1881   menu_settings_common(machine, menu, state, IPT_CATEGORY);
1882}
11931883
1194   /* draw the menu */
1195   visible_items = ui_menu_draw(item_list, menu_items, state, NULL);
11961884
1197   /* handle generic menu keys */
1198   if (ui_menu_generic_keys(machine, &state, menu_items, visible_items))
1199      return state;
1885/*-------------------------------------------------
1886    menu_settings_common - handle one of the
1887    switches menus
1888-------------------------------------------------*/
12001889
1201   /* handle left/right arrows */
1202   if (input_ui_pressed_repeat(machine, IPT_UI_LEFT,6) && (item_list[state].flags & MENU_FLAG_LEFT_ARROW))
1203      delta = -1;
1204   if (input_ui_pressed_repeat(machine, IPT_UI_RIGHT,6) && (item_list[state].flags & MENU_FLAG_RIGHT_ARROW))
1205      delta = 1;
1206   if (input_code_pressed(KEYCODE_LSHIFT))
1207      delta *= 10;
1890static void menu_settings_common(running_machine *machine, ui_menu *menu, void *state, UINT32 type)
1891{
1892   settings_menu_state *menustate;
1893   const ui_menu_event *event;
12081894
1209   /* adjust the appropriate value */
1210   if (delta != 0 && selected_field != NULL)
1895   /* if no state, allocate now */
1896   if (state == NULL)
1897      state = ui_menu_alloc_state(menu, sizeof(*menustate));
1898   menustate = state;
1899
1900   /* if the menu isn't built, populate now */
1901   if (!ui_menu_populated(menu))
1902      menu_settings_populate(machine, menu, menustate, type);
1903
1904   /* process the menu */
1905   event = ui_menu_process(menu, 0);
1906
1907   /* handle events */
1908   if (event != NULL && event->itemref != NULL)
12111909   {
1910      const input_field_config *field = event->itemref;
12121911      input_field_user_settings settings;
1912      int changed = FALSE;
12131913
1214      input_field_get_user_settings(selected_field, &settings);
1215      switch (selected_item)
1914      switch (event->iptkey)
12161915      {
1217         case ANALOG_ITEM_KEYSPEED:      settings.delta += delta;      break;
1218         case ANALOG_ITEM_CENTERSPEED:   settings.centerdelta += delta;   break;
1219         case ANALOG_ITEM_REVERSE:      settings.reverse += delta;      break;
1220         case ANALOG_ITEM_SENSITIVITY:   settings.sensitivity += delta;   break;
1916         /* if selected, reset to default value */
1917         case IPT_UI_SELECT:
1918            input_field_get_user_settings(field, &settings);
1919            settings.value = field->defvalue;
1920            input_field_set_user_settings(field, &settings);
1921            changed = TRUE;
1922            break;
1923
1924         /* left goes to previous setting */
1925         case IPT_UI_LEFT:
1926            input_field_select_previous_setting(field);
1927            changed = TRUE;
1928            break;
1929
1930         /* right goes to next setting */
1931         case IPT_UI_RIGHT:
1932            input_field_select_next_setting(field);
1933            changed = TRUE;
1934            break;
12211935      }
1222      input_field_set_user_settings(selected_field, &settings);
1936
1937      /* if anything changed, rebuild the menu, trying to stay on the same field */
1938      if (changed)
1939         ui_menu_reset(menu, UI_MENU_RESET_REMEMBER_REF);
12231940   }
1224
1225   return state;
12261941}
12271942
12281943
12291944/*-------------------------------------------------
1230    menu_bookkeeping - display a "menu" for
1231    bookkeeping information
1945    menu_settings_populate - populate one of the
1946    switches menus
12321947-------------------------------------------------*/
12331948
1234#ifndef MESS
1235static UINT32 menu_bookkeeping(running_machine *machine, UINT32 state)
1949static void menu_settings_populate(running_machine *machine, ui_menu *menu, settings_menu_state *menustate, UINT32 type)
12361950{
1237   char buf[2048];
1238   char *bufptr = buf;
1239   UINT32 selected = 0;
1240   int ctrnum;
1241   attotime total_time;
1951   const input_field_config *field;
1952   const input_port_config *port;
1953   dip_descriptor **diplist_tailptr;
1954   int dipcount = 0;
12421955
1243   /* show total time first */
1244   total_time = timer_get_time();
1245   if (total_time.seconds >= 60 * 60)
1246      bufptr += sprintf(bufptr, "Uptime: %d:%02d:%02d\n\n", total_time.seconds / (60*60), (total_time.seconds / 60) % 60, total_time.seconds % 60);
1247   else
1248      bufptr += sprintf(bufptr, "Uptime: %d:%02d\n\n", (total_time.seconds / 60) % 60, total_time.seconds % 60);
1956   /* reset the dip switch tracking */
1957   menustate->diplist = NULL;
1958   diplist_tailptr = &menustate->diplist;
12491959
1250   /* show tickets at the top */
1251   if (dispensed_tickets)
1252      bufptr += sprintf(bufptr, "Tickets dispensed: %d\n\n", dispensed_tickets);
1960   /* loop over input ports and set up the current values */
1961   for (port = machine->portconfig; port != NULL; port = port->next)
1962      for (field = port->fieldlist; field != NULL; field = field->next)
1963         if (field->type == type && input_condition_true(machine, &field->condition))
1964         {
1965            UINT32 flags = 0;
12531966
1254   /* loop over coin counters */
1255   for (ctrnum = 0; ctrnum < COIN_COUNTERS; ctrnum++)
1256   {
1257      /* display the coin counter number */
1258      bufptr += sprintf(bufptr, "Coin %c: ", ctrnum + 'A');
1967            /* set the left/right flags appropriately */
1968            if (input_field_has_previous_setting(field))
1969               flags |= MENU_FLAG_LEFT_ARROW;
1970            if (input_field_has_next_setting(field))
1971               flags |= MENU_FLAG_RIGHT_ARROW;
12591972
1260      /* display how many coins */
1261      if (!coin_count[ctrnum])
1262         bufptr += sprintf(bufptr, "NA");
1263      else
1264         bufptr += sprintf(bufptr, "%d", coin_count[ctrnum]);
1973            /* add the menu item */
1974            ui_menu_item_append(menu, input_field_name(field), input_field_setting_name(field), flags, (void *)field);
12651975
1266      /* display whether or not we are locked out */
1267      if (coinlockedout[ctrnum])
1268         bufptr += sprintf(bufptr, " (locked)");
1269      *bufptr++ = '\n';
1270   }
1271   *bufptr = 0;
1976            /* for DIP switches, build up the model */
1977            if (type == IPT_DIPSWITCH && field->diploclist != NULL)
1978            {
1979               const input_field_diplocation *diploc;
1980               input_field_user_settings settings;
1981               UINT32 accummask = field->mask;
12721982
1273   /* draw the text */
1274   ui_menu_draw_text_box(buf);
1983               /* get current settings */
1984               input_field_get_user_settings(field, &settings);
12751985
1276   /* handle the keys */
1277   ui_menu_generic_keys(machine, &selected, 1, 0);
1278   return selected;
1986               /* iterate over each bit in the field */
1987               for (diploc = field->diploclist; diploc != NULL; diploc = diploc->next)
1988               {
1989                  UINT32 mask = accummask & ~(accummask - 1);
1990                  dip_descriptor *dip;
1991
1992                  /* find the matching switch name */
1993                  for (dip = menustate->diplist; dip != NULL; dip = dip->next)
1994                     if (strcmp(dip->name, diploc->swname) == 0)
1995                        break;
1996
1997                  /* allocate new if none */
1998                  if (dip == NULL)
1999                  {
2000                     dip = ui_menu_pool_alloc(menu, sizeof(*dip));
2001                     dip->next = NULL;
2002                     dip->name = diploc->swname;
2003                     dip->mask = dip->state = 0;
2004                     *diplist_tailptr = dip;
2005                     diplist_tailptr = &dip->next;
2006                     dipcount++;
2007                  }
2008
2009                  /* apply the bits */
2010                  dip->mask |= 1 << (diploc->swnum - 1);
2011                  if (((settings.value & mask) != 0 && !diploc->invert) || ((settings.value & mask) == 0 && diploc->invert))
2012                     dip->state |= 1 << (diploc->swnum - 1);
2013
2014                  /* clear the relevant bit in the accumulated mask */
2015                  accummask &= ~mask;
2016               }
2017            }
2018         }
2019
2020   /* configure the extra menu */
2021   if (type == IPT_DIPSWITCH && menustate->diplist != NULL)
2022      ui_menu_set_custom_render(menu, menu_settings_custom_render, 0.0f, dipcount * (DIP_SWITCH_HEIGHT + DIP_SWITCH_SPACING) + DIP_SWITCH_SPACING);
12792023}
1280#endif
12812024
12822025
12832026/*-------------------------------------------------
1284    menu_game_info - display a "menu" for
1285    game information
2027    menu_settings_custom_render - perform our special
2028    rendering
12862029-------------------------------------------------*/
12872030
1288static UINT32 menu_game_info(running_machine *machine, UINT32 state)
2031static void menu_settings_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x1, float y1, float x2, float y2)
12892032{
1290   char buf[2048];
1291   char *bufptr = buf;
1292   UINT32 selected = 0;
2033   const input_field_config *field = selectedref;
2034   settings_menu_state *menustate = state;
2035   dip_descriptor *dip;
12932036
1294   /* add the game info */
1295   bufptr += sprintf_game_info(machine, bufptr);
2037   /* add borders */
2038   y1 = y2 + UI_BOX_TB_BORDER;
2039   y2 = y1 + bottom;
12962040
1297   /* draw the text */
1298   ui_menu_draw_text_box(buf);
2041   /* draw extra menu area */
2042   ui_draw_outlined_box(x1, y1, x2, y2, UI_FILLCOLOR);
2043   y1 += (float)DIP_SWITCH_SPACING;
12992044
1300   /* handle the keys */
1301   ui_menu_generic_keys(machine, &selected, 1, 0);
1302   return selected;
1303}
2045   /* iterate over DIP switches */
2046   for (dip = menustate->diplist; dip != NULL; dip = dip->next)
2047   {
2048      const input_field_diplocation *diploc;
2049      UINT32 selectedmask = 0;
13042050
2051      /* determine the mask of selected bits */
2052      if (field != NULL)
2053         for (diploc = field->diploclist; diploc != NULL; diploc = diploc->next)
2054            if (strcmp(dip->name, diploc->swname) == 0)
2055               selectedmask |= 1 << (diploc->swnum - 1);
13052056
1306/*-------------------------------------------------
1307    menu_cheat - display a menu for cheat options
1308-------------------------------------------------*/
1309
1310static UINT32 menu_cheat(running_machine *machine, UINT32 state)
1311{
1312   int result = cheat_menu(machine, state);
1313   if (result == 0)
1314      return ui_menu_stack_pop();
1315   return result;
2057      /* draw one switch */
2058      menu_settings_custom_render_one(x1, y1, x2, y1 + DIP_SWITCH_HEIGHT, dip, selectedmask);
2059      y1 += (float)(DIP_SWITCH_SPACING + DIP_SWITCH_HEIGHT);
2060   }
13162061}
13172062
13182063
13192064/*-------------------------------------------------
1320    menu_memory_card - display a menu for memory
1321    card options
2065    menu_settings_custom_render_one - draw a single
2066    DIP switch
13222067-------------------------------------------------*/
13232068
1324static UINT32 menu_memory_card(running_machine *machine, UINT32 state)
2069static void menu_settings_custom_render_one(float x1, float y1, float x2, float y2, const dip_descriptor *dip, UINT32 selectedmask)
13252070{
1326   ui_menu_item item_list[5];
1327   int menu_items = 0;
1328   int cardnum = state >> 16;
1329   UINT32 selected = state & 0xffff;
1330   int insertindex = -1, ejectindex = -1, createindex = -1;
1331   int visible_items;
2071   int numtoggles, toggle;
2072   float switch_toggle_gap;
2073   float y1_off, y1_on;
13322074
1333   /* reset the menu and string pool */
1334   memset(item_list, 0, sizeof(item_list));
1335   menu_string_pool_offset = 0;
2075   /* determine the number of toggles in the DIP */
2076   numtoggles = 32 - count_leading_zeros(dip->mask);
13362077
1337   /* add the card select menu */
1338   item_list[menu_items].text = "Card Number:";
1339   item_list[menu_items].subtext = menu_string_pool_add("%d", cardnum);
1340   if (cardnum > 0)
1341      item_list[menu_items].flags |= MENU_FLAG_LEFT_ARROW;
1342   if (cardnum < 1000)
1343      item_list[menu_items].flags |= MENU_FLAG_RIGHT_ARROW;
1344   menu_items++;
2078   /* center based on the number of switches */
2079    x1 += (x2 - x1 - numtoggles * SINGLE_TOGGLE_SWITCH_FIELD_WIDTH) / 2;
13452080
1346   /* add the remaining items */
1347   item_list[insertindex = menu_items++].text = "Load Selected Card";
1348   if (memcard_present() != -1)
1349      item_list[ejectindex = menu_items++].text = "Eject Current Card";
1350   item_list[createindex = menu_items++].text = "Create New Card";
2081   /* draw the dip switch name */
2082   ui_draw_text_full(   dip->name,
2083                  0,
2084                  y1 + (DIP_SWITCH_HEIGHT - UI_TARGET_FONT_HEIGHT) / 2,
2085                  x1 - ui_get_string_width(" "),
2086                  JUSTIFY_RIGHT,
2087                  WRAP_NEVER,
2088                  DRAW_NORMAL,
2089                  ARGB_WHITE,
2090                  PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA),
2091                  NULL ,
2092                  NULL);
13512093
1352   /* add an item for the return */
1353   item_list[menu_items++].text = "Return to Prior Menu";
2094   /* compute top and bottom for on and off positions */
2095   switch_toggle_gap = ((DIP_SWITCH_HEIGHT/2) - SINGLE_TOGGLE_SWITCH_HEIGHT)/2;
2096   y1_off = y1 + UI_LINE_WIDTH + switch_toggle_gap;
2097   y1_on = y1 + DIP_SWITCH_HEIGHT/2 + switch_toggle_gap;
13542098
1355   /* draw the menu */
1356   visible_items = ui_menu_draw(item_list, menu_items, selected, NULL);
2099   /* iterate over toggles */
2100   for (toggle = 0; toggle < numtoggles; toggle++)
2101   {
2102      float innerx1;
13572103
1358   /* handle the keys */
1359   if (ui_menu_generic_keys(machine, &selected, menu_items, visible_items))
1360      return selected;
1361   if (selected == 0 && input_ui_pressed(machine, IPT_UI_LEFT) && cardnum > 0)
1362      cardnum--;
1363   if (selected == 0 && input_ui_pressed(machine, IPT_UI_RIGHT) && cardnum < 1000)
1364      cardnum++;
2104      /* first outline the switch */
2105      ui_draw_outlined_box(x1, y1, x1 + SINGLE_TOGGLE_SWITCH_FIELD_WIDTH, y2, UI_FILLCOLOR);
13652106
1366   /* handle actions */
1367   if (input_ui_pressed(machine, IPT_UI_SELECT))
1368   {
1369      /* handle load */
1370      if (selected == insertindex)
2107      /* compute x1/x2 for the inner filled in switch */
2108      innerx1 = x1 + (SINGLE_TOGGLE_SWITCH_FIELD_WIDTH - SINGLE_TOGGLE_SWITCH_WIDTH) / 2;
2109
2110      /* see if the switch is actually used */
2111      if (dip->mask & (1 << toggle))
13712112      {
1372         if (memcard_insert(machine, cardnum) == 0)
1373         {
1374            popmessage("Memory card loaded");
1375            ui_menu_stack_reset();
1376            return 0;
1377         }
1378         else
1379            popmessage("Error loading memory card");
2113         float innery1 = (dip->state & (1 << toggle)) ? y1_on : y1_off;
2114         render_ui_add_rect(innerx1, innery1, innerx1 + SINGLE_TOGGLE_SWITCH_WIDTH, innery1 + SINGLE_TOGGLE_SWITCH_HEIGHT,
2115                        (selectedmask & (1 << toggle)) ? MENU_SELECTCOLOR : ARGB_WHITE,
2116                        PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
13802117      }
1381
1382      /* handle eject */
1383      else if (selected == ejectindex)
2118      else
13842119      {
1385         memcard_eject(machine);
1386         popmessage("Memory card ejected");
2120         render_ui_add_rect(innerx1, y1_off, innerx1 + SINGLE_TOGGLE_SWITCH_WIDTH, y1_on + SINGLE_TOGGLE_SWITCH_HEIGHT,
2121                        MENU_UNAVAILABLECOLOR,
2122                        PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
13872123      }
13882124
1389      /* handle create */
1390      else if (selected == createindex)
1391      {
1392         if (memcard_create(machine, cardnum, FALSE) == 0)
1393            popmessage("Memory card created");
1394         else
1395            popmessage("Error creating memory card\n(Card may already exist)");
1396      }
2125      /* advance to the next switch */
2126      x1 += SINGLE_TOGGLE_SWITCH_FIELD_WIDTH;
13972127   }
1398
1399   return selected | (cardnum << 16);
14002128}
14012129
14022130
14032131/*-------------------------------------------------
1404    menu_video - display a menu for video options
2132    menu_analog - handle the analog settings menu
14052133-------------------------------------------------*/
14062134
1407static UINT32 menu_video(running_machine *machine, UINT32 state)
2135static void menu_analog(running_machine *machine, ui_menu *menu, void *parameter, void *state)
14082136{
1409   ui_menu_item item_list[100];
1410   render_target *targetlist[16];
1411   int curtarget = state >> 16;
1412   UINT32 selected = state & 0xffff;
1413   int menu_items = 0;
1414   int visible_items;
1415   int targets;
2137   const ui_menu_event *event;
14162138
1417   /* reset the menu and string pool */
1418   memset(item_list, 0, sizeof(item_list));
1419   menu_string_pool_offset = 0;
2139   /* if the menu isn't built, populate now */
2140   if (!ui_menu_populated(menu))
2141      menu_analog_populate(machine, menu);
14202142
1421   /* find the targets */
1422   for (targets = 0; targets < ARRAY_LENGTH(targetlist); targets++)
1423   {
1424      targetlist[targets] = render_target_get_indexed(targets);
1425      if (targetlist[targets] == NULL)
1426         break;
1427   }
2143   /* process the menu */
2144   event = ui_menu_process(menu, UI_MENU_PROCESS_LR_REPEAT);
14282145
1429   /* if we have a current target of 1000, we may need to select from multiple targets */
1430   if (curtarget == 1000)
2146   /* handle events */
2147   if (event != NULL && event->itemref != NULL)
14312148   {
1432      /* count up the targets, creating menu items for them */
1433      for (; menu_items < targets; menu_items++)
1434         item_list[menu_items].text = menu_string_pool_add("Screen #%d", menu_items);
2149      analog_item_data *data = event->itemref;
2150      int newval = data->cur;
14352151
1436      /* if we only ended up with one, auto-select it */
1437      if (menu_items == 1)
1438         return menu_video(machine, 0 << 16 | render_target_get_view(render_target_get_indexed(0)));
1439
1440      /* add an item for moving the UI */
1441      item_list[menu_items++].text = "Move User Interface";
1442
1443      /* add an item to return */
1444      item_list[menu_items++].text = "Return to Prior Menu";
1445
1446      /* draw the menu */
1447      visible_items = ui_menu_draw(item_list, menu_items, selected, NULL);
1448
1449      /* handle the keys */
1450      if (ui_menu_generic_keys(machine, &selected, menu_items, visible_items))
1451         return selected;
1452
1453      /* handle actions */
1454      if (input_ui_pressed(machine, IPT_UI_SELECT))
2152      switch (event->iptkey)
14552153      {
1456         if (selected == menu_items - 2)
1457         {
1458            render_target *uitarget = render_get_ui_target();
1459            int targnum;
2154         /* if selected, reset to default value */
2155         case IPT_UI_SELECT:
2156            newval = data->field->defvalue;
2157            break;
14602158
1461            for (targnum = 0; targnum < targets; targnum++)
1462               if (targetlist[targnum] == uitarget)
1463                  break;
1464            targnum = (targnum + 1) % targets;
1465            render_set_ui_target(targetlist[targnum]);
1466         }
1467         else
1468            return ui_menu_stack_push(menu_video, (selected << 16) | render_target_get_view(render_target_get_indexed(selected)));
1469      }
1470   }
2159         /* left decrements */
2160         case IPT_UI_LEFT:
2161            newval -= input_code_pressed(KEYCODE_LSHIFT) ? 10 : 1;
2162            break;
14712163
1472   /* otherwise, draw the list of layouts */
1473   else
1474   {
1475      render_target *target = targetlist[curtarget];
1476      int layermask;
1477      assert(target != NULL);
1478
1479      /* add all the views */
1480      for ( ; menu_items < ARRAY_LENGTH(item_list); menu_items++)
1481      {
1482         const char *name = render_target_get_view_name(target, menu_items);
1483         if (name == NULL)
2164         /* right increments */
2165         case IPT_UI_RIGHT:
2166            newval += input_code_pressed(KEYCODE_LSHIFT) ? 10 : 1;
14842167            break;
1485
1486         /* create a string for the item */
1487         item_list[menu_items].text = name;
14882168      }
14892169
1490      /* add an item to rotate */
1491      item_list[menu_items++].text = "Rotate View";
2170      /* clamp to range */
2171      if (newval < data->min)
2172         newval = data->min;
2173      if (newval > data->max)
2174         newval = data->max;
14922175
1493      /* add an item to enable/disable backdrops */
1494      layermask = render_target_get_layer_config(target);
1495      if (layermask & LAYER_CONFIG_ENABLE_BACKDROP)
1496         item_list[menu_items++].text = "Hide Backdrops";
1497      else
1498         item_list[menu_items++].text = "Show Backdrops";
1499
1500      /* add an item to enable/disable overlays */
1501      if (layermask & LAYER_CONFIG_ENABLE_OVERLAY)
1502         item_list[menu_items++].text = "Hide Overlays";
1503      else
1504         item_list[menu_items++].text = "Show Overlays";
1505
1506      /* add an item to enable/disable bezels */
1507      if (layermask & LAYER_CONFIG_ENABLE_BEZEL)
1508         item_list[menu_items++].text = "Hide Bezels";
1509      else
1510         item_list[menu_items++].text = "Show Bezels";
1511
1512      /* add an item to enable/disable cropping */
1513      if (layermask & LAYER_CONFIG_ZOOM_TO_SCREEN)
1514         item_list[menu_items++].text = "Show Full Artwork";
1515      else
1516         item_list[menu_items++].text = "Crop to Screen";
1517
1518      /* add an item to return */
1519      item_list[menu_items++].text = "Return to Prior Menu";
1520
1521      /* draw the menu */
1522      visible_items = ui_menu_draw(item_list, menu_items, selected, NULL);
1523
1524      /* handle the keys */
1525      if (ui_menu_generic_keys(machine, &selected, menu_items, visible_items))
1526         return selected;
1527
1528      /* handle actions */
1529      if (input_ui_pressed(machine, IPT_UI_SELECT))
2176      /* if things changed, update */
2177      if (newval != data->cur)
15302178      {
1531         /* rotate */
1532         if (selected == menu_items - 6)
1533         {
1534            render_target_set_orientation(target, orientation_add(ROT90, render_target_get_orientation(target)));
1535            if (target == render_get_ui_target())
1536               render_container_set_orientation(render_container_get_ui(), orientation_add(ROT270, render_container_get_orientation(render_container_get_ui())));
1537         }
2179         input_field_user_settings settings;
15382180
1539         /* show/hide backdrops */
1540         else if (selected == menu_items - 5)
2181         /* get the settings and set the new value */
2182         input_field_get_user_settings(data->field, &settings);
2183         switch (data->type)
15412184         {
1542            layermask ^= LAYER_CONFIG_ENABLE_BACKDROP;
1543            render_target_set_layer_config(target, layermask);
2185            case ANALOG_ITEM_KEYSPEED:      settings.delta = newval;      break;
2186            case ANALOG_ITEM_CENTERSPEED:   settings.centerdelta = newval;   break;
2187            case ANALOG_ITEM_REVERSE:      settings.reverse = newval;      break;
2188            case ANALOG_ITEM_SENSITIVITY:   settings.sensitivity = newval;   break;
15442189         }
2190         input_field_set_user_settings(data->field, &settings);
15452191
1546         /* show/hide overlays */
1547         else if (selected == menu_items - 4)
1548         {
1549            layermask ^= LAYER_CONFIG_ENABLE_OVERLAY;
1550            render_target_set_layer_config(target, layermask);
1551         }
1552
1553         /* show/hide bezels */
1554         else if (selected == menu_items - 3)
1555         {
1556            layermask ^= LAYER_CONFIG_ENABLE_BEZEL;
1557            render_target_set_layer_config(target, layermask);
1558         }
1559
1560         /* crop/uncrop artwork */
1561         else if (selected == menu_items - 2)
1562         {
1563            layermask ^= LAYER_CONFIG_ZOOM_TO_SCREEN;
1564            render_target_set_layer_config(target, layermask);
1565         }
1566
1567         /* else just set the selected view */
1568         else
1569            render_target_set_view(target, selected);
2192         /* rebuild the menu */
2193         ui_menu_reset(menu, UI_MENU_RESET_REMEMBER_POSITION);
15702194      }
15712195   }
1572
1573   return selected | (curtarget << 16);
15742196}
15752197
15762198
15772199/*-------------------------------------------------
1578    menu_quit_game - handle the "menu" for
1579    quitting the game
2200    menu_analog_populate - populate the analog
2201    settings menu
15802202-------------------------------------------------*/
15812203
1582static UINT32 menu_quit_game(running_machine *machine, UINT32 state)
2204static void menu_analog_populate(running_machine *machine, ui_menu *menu)
15832205{
1584   /* request a reset */
1585   mame_schedule_exit(machine);
2206   astring *subtext = astring_alloc();
2207   astring *text = astring_alloc();
2208   const input_field_config *field;
2209   const input_port_config *port;
15862210
1587   /* reset the menu stack */
1588   ui_menu_stack_reset();
1589   return 0;
1590}
2211   /* loop over input ports and add the items */
2212   for (port = machine->portconfig; port != NULL; port = port->next)
2213      for (field = port->fieldlist; field != NULL; field = field->next)
2214         if (input_type_is_analog(field->type))
2215         {
2216            input_field_user_settings settings;
2217            int use_autocenter = FALSE;
2218            int type;
15912219
2220            /* based on the type, determine if we enable autocenter */
2221            switch (field->type)
2222            {
2223               case IPT_POSITIONAL:
2224               case IPT_POSITIONAL_V:
2225                  if (field->flags & ANALOG_FLAG_WRAPS)
2226                     break;
15922227
1593/*-------------------------------------------------
1594    menu_select_game - handle the game select
1595    menu
1596-------------------------------------------------*/
2228               case IPT_PEDAL:
2229               case IPT_PEDAL2:
2230               case IPT_PEDAL3:
2231               case IPT_PADDLE:
2232               case IPT_PADDLE_V:
2233               case IPT_AD_STICK_X:
2234               case IPT_AD_STICK_Y:
2235               case IPT_AD_STICK_Z:
2236                  use_autocenter = TRUE;
2237                  break;
2238            }
15972239
1598static UINT32 menu_select_game(running_machine *machine, UINT32 state)
1599{
1600   ui_menu_item item_list[VISIBLE_GAMES_IN_LIST + 2];
1601   int error = (state >> 17) & 1;
1602   int recompute = (state >> 16) & 1;
1603   UINT32 selected = state & 0xffff;
1604   int visible_items;
1605   int menu_items = 0;
1606   int curitem, curkey;
1607   menu_extra extra;
1608   int matchcount;
2240            /* get the user settings */
2241            input_field_get_user_settings(field, &settings);
16092242
1610   /* update our driver list if necessary */
1611   if (select_game_driver_list == NULL)
1612      select_game_build_driver_list();
1613   for (curitem = matchcount = 0; select_game_driver_list[curitem] != NULL && matchcount < VISIBLE_GAMES_IN_LIST; curitem++)
1614      if (!(select_game_driver_list[curitem]->flags & GAME_NO_STANDALONE))
1615         matchcount++;
2243            /* iterate over types */
2244            for (type = 0; type < ANALOG_ITEM_COUNT; type++)
2245               if (type != ANALOG_ITEM_CENTERSPEED || use_autocenter)
2246               {
2247                  analog_item_data *data;
2248                  UINT32 flags = 0;
16162249
1617   /* if nothing there, just display an error message and exit */
1618   if (matchcount == 0)
1619   {
1620      ui_draw_text_box("No games found. Please check the rompath specified in the mame.ini file.\n\n"
1621                   "If this is your first time using MAME, please see the config.txt file in "
1622                   "the docs directory for information on configuring MAME.\n\n"
1623                   "Press any key to exit",
1624                       JUSTIFY_CENTER, 0.5f, 0.5f, UI_REDCOLOR);
1625      if (input_code_poll_switches(FALSE))
1626         return ui_menu_stack_pop();
1627      return 0;
1628   }
2250                  /* allocate a data item for tracking what this menu item refers to */
2251                  data = ui_menu_pool_alloc(menu, sizeof(*data));
2252                  data->field = field;
2253                  data->type = type;
16292254
1630   /* reset the menu and string pool */
1631   memset(item_list, 0, sizeof(item_list));
1632   menu_string_pool_offset = 0;
2255                  /* determine the properties of this item */
2256                  switch (type)
2257                  {
2258                     default:
2259                     case ANALOG_ITEM_KEYSPEED:
2260                        astring_printf(text, "%s Digital Speed", input_field_name(field));
2261                        astring_printf(subtext, "%d", settings.delta);
2262                        data->min = 0;
2263                        data->max = 255;
2264                        data->cur = settings.delta;
2265                        break;
16332266
1634   /* reset the text and recompute if necessary */
1635   if (recompute)
1636      driver_list_get_approx_matches(select_game_driver_list, select_game_buffer, matchcount, select_game_list);
1637   recompute = 0;
2267                     case ANALOG_ITEM_CENTERSPEED:
2268                        astring_printf(text, "%s Autocenter Speed", input_field_name(field));
2269                        astring_printf(subtext, "%d", settings.centerdelta);
2270                        data->min = 0;
2271                        data->max = 255;
2272                        data->cur = settings.centerdelta;
2273                        break;
16382274
1639   /* iterate over entries */
1640   for (curitem = 0; curitem < matchcount; curitem++)
1641   {
1642      const game_driver *driver = select_game_list[curitem];
1643      if (driver != NULL)
1644      {
1645         const game_driver *cloneof = driver_get_clone(driver);
1646         item_list[menu_items].text = menu_string_pool_add("%s", driver->name);
1647         item_list[menu_items].subtext = menu_string_pool_add("%s", driver->description);
1648         item_list[menu_items++].flags = (cloneof == NULL || (cloneof->flags & GAME_IS_BIOS_ROOT)) ? 0 : MENU_FLAG_INVERT;
1649      }
1650   }
2275                     case ANALOG_ITEM_REVERSE:
2276                        astring_printf(text, "%s Reverse", input_field_name(field));
2277                        astring_cpyc(subtext, settings.reverse ? "On" : "Off");
2278                        data->min = 0;
2279                        data->max = 1;
2280                        data->cur = settings.reverse;
2281                        break;
16512282
1652   /* add an item to return, but only if we're not going to pop to the quit handler */
1653   if (!ui_menu_is_force_game_select())
1654      item_list[menu_items++].text = "Return to Prior Menu";
2283                     case ANALOG_ITEM_SENSITIVITY:
2284                        astring_printf(text, "%s Sensitivity", input_field_name(field));
2285                        astring_printf(subtext, "%d", settings.sensitivity);
2286                        data->min = 1;
2287                        data->max = 255;
2288                        data->cur = settings.sensitivity;
2289                        break;
2290                  }
16552291
1656   /* otherwise, add a general input configuration and exit menus */
1657   else
1658   {
1659      item_list[menu_items++].text = "Configure General Inputs";
1660      item_list[menu_items++].text = "Exit";
1661   }
2292                  /* put on arrows */
2293                  if (data->cur > data->min)
2294                     flags |= MENU_FLAG_LEFT_ARROW;
2295                  if (data->cur < data->max)
2296                     flags |= MENU_FLAG_RIGHT_ARROW;
16622297
1663   /* configure the extra menu */
1664   extra.top = ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER;
1665   extra.bottom = 4.0f * ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER;
1666   extra.render = select_game_render;
1667   extra.param = (selected < matchcount) ? (void *)select_game_list[selected] : NULL;
1668
1669   /* draw the menu */
1670   visible_items = ui_menu_draw(item_list, menu_items, selected, &extra);
1671
1672   /* if we have an error, overlay with the error message and look for a keypress */
1673   if (error)
1674   {
1675      ui_draw_text_box("The selected game is missing one or more required ROM or CHD images. "
1676                       "Please select a different game.\n\nPress any key to continue.",
1677                       JUSTIFY_CENTER, 0.5f, 0.5f, UI_REDCOLOR);
1678      if (input_code_poll_switches(FALSE))
1679         error = FALSE;
1680   }
1681
1682   /* non-error case process normally */
1683   else
1684   {
1685      /* handle typeahead */
1686      recompute |= select_game_handle_key(KEYCODE_BACKSPACE, 8);
1687      recompute |= select_game_handle_key(KEYCODE_SPACE, ' ');
1688      for (curkey = KEYCODE_A; curkey <= KEYCODE_Z; curkey++)
1689         recompute |= select_game_handle_key(curkey, curkey - KEYCODE_A + 'a');
1690      for (curkey = KEYCODE_0; curkey <= KEYCODE_9; curkey++)
1691         recompute |= select_game_handle_key(curkey, curkey - KEYCODE_0 + '0');
1692      for (curkey = KEYCODE_0_PAD; curkey <= KEYCODE_9_PAD; curkey++)
1693         recompute |= select_game_handle_key(curkey, curkey - KEYCODE_0_PAD + '0');
1694
1695      /* escape pressed with non-empty text clears the text */
1696      if (input_ui_pressed(machine, IPT_UI_CANCEL))
1697      {
1698         if (select_game_buffer[0] == 0)
1699            return ui_menu_stack_pop();
1700         else
1701         {
1702            select_game_buffer[0] = 0;
1703            recompute = TRUE;
2298                  /* append a menu item */
2299                  ui_menu_item_append(menu, astring_c(text), astring_c(subtext), flags, data);
2300               }
17042301         }
1705      }
17062302
1707      /* if we're recomputing, reselect the first item */
1708      if (recompute)
1709         selected = 0;
2303   /* release our temporary strings */
2304   astring_free(subtext);
2305   astring_free(text);
2306}
17102307
1711      /* ignore pause keys by swallowing them */
1712      input_ui_pressed(machine, IPT_UI_PAUSE);
17132308
1714      /* handle the generic keys */
1715      if (!recompute && ui_menu_generic_keys(machine, &selected, menu_items, visible_items))
1716         return selected;
2309/*-------------------------------------------------
2310    menu_bookkeeping - handle the bookkeeping
2311    information menu
2312-------------------------------------------------*/
17172313
1718      /* handle actions */
1719      if (input_ui_pressed(machine, IPT_UI_SELECT))
1720      {
1721         /* control config */
1722         if (ui_menu_is_force_game_select() && selected == menu_items - 2)
1723            return ui_menu_stack_push(menu_input_groups, 0);
2314#ifndef MESS
2315static void menu_bookkeeping(running_machine *machine, ui_menu *menu, void *parameter, void *state)
2316{
2317   attotime *prevtime;
2318   attotime curtime;
17242319
1725         /* valid selected game */
1726         if (selected < ARRAY_LENGTH(select_game_list) && select_game_list[selected] != NULL)
1727         {
1728            audit_record *audit;
1729            int audit_records;
1730            int audit_result;
2320   /* if no state, allocate some */
2321   if (state == NULL)
2322      state = ui_menu_alloc_state(menu, sizeof(*prevtime));
2323   prevtime = state;
17312324
1732            /* audit the game first to see if we're going to work */
1733            audit_records = audit_images(mame_options(), select_game_list[selected], AUDIT_VALIDATE_FAST, &audit);
1734            audit_result = audit_summary(select_game_list[selected], audit_records, audit, FALSE);
1735            if (audit_records > 0)
1736               free(audit);
1737
1738            /* if everything looks good, schedule the new driver */
1739            if (audit_result == CORRECT || audit_result == BEST_AVAILABLE)
1740            {
1741               mame_schedule_new_driver(machine, select_game_list[selected]);
1742               ui_menu_stack_reset();
1743               return 0;
1744            }
1745
1746            /* otherwise, display an error */
1747            else
1748            {
1749               error = TRUE;
1750               input_code_poll_switches(TRUE);
1751            }
1752         }
1753      }
2325   /* if the time has rolled over another second, regenerate */
2326   curtime = timer_get_time();
2327   if (prevtime->seconds != curtime.seconds)
2328   {
2329      ui_menu_reset(menu, UI_MENU_RESET_SELECT_FIRST);
2330      *prevtime = curtime;
2331      menu_bookkeeping_populate(machine, menu, prevtime);
17542332   }
17552333
1756   return selected | (recompute << 16) | (error << 17);
2334   /* process the menu */
2335   ui_menu_process(menu, 0);
17572336}
2337#endif
17582338
17592339
1760
1761/***************************************************************************
1762    MENU HELPERS
1763***************************************************************************/
1764
17652340/*-------------------------------------------------
1766    menu_render_triangle - render a triangle that
1767    is used for up/down arrows and left/right
1768    indicators
2341    menu_bookkeeping - handle the bookkeeping
2342    information menu
17692343-------------------------------------------------*/
17702344
1771static void menu_render_triangle(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param)
2345#ifndef MESS
2346static void menu_bookkeeping_populate(running_machine *machine, ui_menu *menu, attotime *curtime)
17722347{
1773   int halfwidth = dest->width / 2;
1774   int height = dest->height;
1775   int x, y;
2348   astring *tempstring = astring_alloc();
2349   int ctrnum;
17762350
1777   /* start with all-transparent */
1778   bitmap_fill(dest, NULL, MAKE_ARGB(0x00,0x00,0x00,0x00));
2351   /* show total time first */
2352   if (curtime->seconds >= 60 * 60)
2353      astring_catprintf(tempstring, "Uptime: %d:%02d:%02d\n\n", curtime->seconds / (60*60), (curtime->seconds / 60) % 60, curtime->seconds % 60);
2354   else
2355      astring_catprintf(tempstring, "Uptime: %d:%02d\n\n", (curtime->seconds / 60) % 60, curtime->seconds % 60);
17792356
1780   /* render from the tip to the bottom */
1781   for (y = 0; y < height; y++)
2357   /* show tickets at the top */
2358   if (dispensed_tickets > 0)
2359      astring_catprintf(tempstring, "Tickets dispensed: %d\n\n", dispensed_tickets);
2360
2361   /* loop over coin counters */
2362   for (ctrnum = 0; ctrnum < COIN_COUNTERS; ctrnum++)
17822363   {
1783      int linewidth = (y * (halfwidth - 1) + (height / 2)) * 255 * 2 / height;
1784      UINT32 *target = BITMAP_ADDR32(dest, y, halfwidth);
2364      /* display the coin counter number */
2365      astring_catprintf(tempstring, "Coin %c: ", ctrnum + 'A');
17852366
1786      /* don't antialias if height < 12 */
1787      if (dest->height < 12)
1788      {
1789         int pixels = (linewidth + 254) / 255;
1790         if (pixels % 2 == 0) pixels++;
1791         linewidth = pixels * 255;
1792      }
2367      /* display how many coins */
2368      if (coin_count[ctrnum] == 0)
2369         astring_catc(tempstring, "NA");
2370      else
2371         astring_catprintf(tempstring, "%d", coin_count[ctrnum]);
17932372
1794      /* loop while we still have data to generate */
1795      for (x = 0; linewidth > 0; x++)
1796      {
1797         int dalpha;
2373      /* display whether or not we are locked out */
2374      if (coinlockedout[ctrnum])
2375         astring_catc(tempstring, " (locked)");
2376      astring_catc(tempstring, "\n");
2377   }
17982378
1799         /* first colum we only consume one pixel */
1800         if (x == 0)
1801         {
1802            dalpha = MIN(0xff, linewidth);
1803            target[x] = MAKE_ARGB(dalpha,0xff,0xff,0xff);
1804         }
1805
1806         /* remaining columns consume two pixels, one on each side */
1807         else
1808         {
1809            dalpha = MIN(0x1fe, linewidth);
1810            target[x] = target[-x] = MAKE_ARGB(dalpha/2,0xff,0xff,0xff);
1811         }
1812
1813         /* account for the weight we consumed */
1814         linewidth -= dalpha;
1815      }
1816   }
2379   /* append the single item */
2380   ui_menu_item_append(menu, astring_c(tempstring), NULL, MENU_FLAG_MULTILINE, NULL);
2381   astring_free(tempstring);
18172382}
2383#endif
18182384
18192385
18202386/*-------------------------------------------------
1821    input_menu_get_items - build a list of items
1822    for a given group of inputs
2387    menu_game_info - handle the game information
2388    menu
18232389-------------------------------------------------*/
18242390
1825static int input_menu_get_items(running_machine *machine, input_item_data *itemlist, int group)
2391static void menu_game_info(running_machine *machine, ui_menu *menu, void *parameter, void *state)
18262392{
1827   input_item_data *item = itemlist;
1828   const input_type_desc *typedesc;
1829   astring *seqstring;
2393   /* if the menu isn't built, populate now */
2394   if (!ui_menu_populated(menu))
2395   {
2396      astring *tempstring = game_info_astring(machine, astring_alloc());
2397      ui_menu_item_append(menu, astring_c(tempstring), NULL, MENU_FLAG_MULTILINE, NULL);
2398      astring_free(tempstring);
2399   }
18302400
1831   /* iterate over the input ports and add menu items */
1832   seqstring = astring_alloc();
1833   for (typedesc = input_type_list(machine); typedesc != NULL; typedesc = typedesc->next)
1834
1835      /* add if we match the group and we have a valid name */
1836      if (typedesc->group == group && typedesc->name != NULL && typedesc->name[0] != 0)
1837      {
1838         /* build an entry for the standard sequence */
1839         item->typedesc = typedesc;
1840         item->seqtype = SEQ_TYPE_STANDARD;
1841         item->seq = *input_type_seq(machine, typedesc->type, typedesc->player, item->seqtype);
1842         item->defseq = &typedesc->seq[item->seqtype];
1843         item->sortorder = item - itemlist;
1844         item->type = input_type_is_analog(typedesc->type) ? INPUT_TYPE_ANALOG : INPUT_TYPE_DIGITAL;
1845         item->name = menu_string_pool_add(input_format[item->type], typedesc->name);
1846         item->seqname = menu_string_pool_add("%s", astring_c(input_seq_name(seqstring, &item->seq)));
1847         item->invert = input_seq_cmp(&item->seq, item->defseq);
1848         item++;
1849
1850         /* if we're analog, add more entries */
1851         if (item[-1].type == INPUT_TYPE_ANALOG)
1852         {
1853            /* build an entry for the decrement sequence */
1854            item->typedesc = typedesc;
1855            item->seqtype = SEQ_TYPE_DECREMENT;
1856            item->seq = *input_type_seq(machine, typedesc->type, typedesc->player, item->seqtype);
1857            item->defseq = &typedesc->seq[item->seqtype];
1858            item->sortorder = item - itemlist;
1859            item->type = INPUT_TYPE_ANALOG_DEC;
1860            item->name = menu_string_pool_add(input_format[item->type], typedesc->name);
1861            item->seqname = menu_string_pool_add("%s", astring_c(input_seq_name(seqstring, &item->seq)));
1862            item->invert = input_seq_cmp(&item->seq, item->defseq);
1863            item++;
1864
1865            /* build an entry for the increment sequence */
1866            item->typedesc = typedesc;
1867            item->seqtype = SEQ_TYPE_INCREMENT;
1868            item->seq = *input_type_seq(machine, typedesc->type, typedesc->player, item->seqtype);
1869            item->defseq = &typedesc->seq[item->seqtype];
1870            item->sortorder = item - itemlist;
1871            item->type = INPUT_TYPE_ANALOG_INC;
1872            item->name = menu_string_pool_add(input_format[item->type], typedesc->name);
1873            item->seqname = menu_string_pool_add("%s", astring_c(input_seq_name(seqstring, &item->seq)));
1874            item->invert = input_seq_cmp(&item->seq, item->defseq);
1875            item++;
1876         }
1877      }
1878
1879   /* return the number of items */
1880   astring_free(seqstring);
1881   return item - itemlist;
2401   /* process the menu */
2402   ui_menu_process(menu, 0);
18822403}
18832404
18842405
18852406/*-------------------------------------------------
1886    get_field_default_seq - return a pointer
1887    to the default sequence for the given field
2407    menu_memory_card - handle the memory card
2408    menu
18882409-------------------------------------------------*/
18892410
1890static const input_seq *get_field_default_seq(const input_field_config *field, int seqtype)
2411static void menu_memory_card(running_machine *machine, ui_menu *menu, void *parameter, void *state)
18912412{
1892   if (input_seq_get_1(&field->seq[seqtype]) == SEQCODE_DEFAULT)
1893      return input_type_seq(field->port->machine, field->type, field->player, seqtype);
1894   else
1895      return &field->seq[seqtype];
1896}
2413   const ui_menu_event *event;
2414   int *cardnum;
18972415
2416   /* if no state, allocate some */
2417   if (state == NULL)
2418      state = ui_menu_alloc_state(menu, sizeof(*cardnum));
2419   cardnum = state;
18982420
1899/*-------------------------------------------------
1900    input_menu_get_game_items - build a list of
1901    items for the game-specific inputs
1902-------------------------------------------------*/
2421   /* if the menu isn't built, populate now */
2422   if (!ui_menu_populated(menu))
2423      menu_memory_card_populate(machine, menu, *cardnum);
19032424
1904static int input_menu_get_game_items(running_machine *machine, input_item_data *itemlist)
1905{
1906   astring *seqstring = astring_alloc();
1907   input_item_data *item = itemlist;
1908   const input_port_config *port;
1909   const input_field_config *field;
2425   /* process the menu */
2426   event = ui_menu_process(menu, UI_MENU_PROCESS_LR_REPEAT);
19102427
1911   /* iterate over the input ports and add menu items */
1912   for (port = machine->portconfig; port != NULL; port = port->next)
1913      for (field = port->fieldlist; field != NULL; field = field->next)
2428   /* if something was selected, act on it */
2429   if (event != NULL && event->itemref != NULL)
2430   {
2431      FPTR item = (FPTR)event->itemref;
2432
2433      /* select executes actions on some of the items */
2434      if (event->iptkey == IPT_UI_SELECT)
19142435      {
1915         const char *name = input_field_name(field);
1916
1917         /* add if we match the group and we have a valid name */
1918         if (name != NULL && input_condition_true(machine, &field->condition) &&
1919#ifdef MESS
1920            (field->category == 0 || input_category_active(machine, field->category)) &&
1921#endif /* MESS */
1922            ((field->type == IPT_OTHER && field->name != NULL) || input_type_group(machine, field->type, field->player) != IPG_INVALID))
2436         switch (item)
19232437         {
1924            UINT16 sortorder;
2438            /* handle card loading; if we succeed, clear the menus */
2439            case MEMCARD_ITEM_LOAD:
2440               if (memcard_insert(menu->machine, *cardnum) == 0)
2441               {
2442                  popmessage("Memory card loaded");
2443                  ui_menu_stack_reset(menu->machine);
2444               }
2445               else
2446                  popmessage("Error loading memory card");
2447               break;
19252448
1926            /* determine the sorting order */
1927            if (field->type >= IPT_START1 && field->type <= __ipt_analog_end)
1928               sortorder = (field->type << 2) | (field->player << 12);
1929            else
1930               sortorder = field->type | 0xf000;
2449            /* handle card ejecting */
2450            case MEMCARD_ITEM_EJECT:
2451               memcard_eject(menu->machine);
2452               popmessage("Memory card ejected");
2453               break;
19312454
1932            /* build an entry for the standard sequence */
1933            item->field = field;
1934            item->seqtype = SEQ_TYPE_STANDARD;
1935            item->seq = *input_field_seq(field, item->seqtype);
1936            item->defseq = get_field_default_seq(field, item->seqtype);
1937            item->sortorder = sortorder;
1938            item->type = input_type_is_analog(field->type) ? INPUT_TYPE_ANALOG : INPUT_TYPE_DIGITAL;
1939            item->name = menu_string_pool_add(input_format[item->type], name);
1940            item->seqname = menu_string_pool_add("%s", astring_c(input_seq_name(seqstring, &item->seq)));
1941            item->invert = input_seq_cmp(&item->seq, item->defseq);
1942            item++;
2455            /* handle card creating */
2456            case MEMCARD_ITEM_CREATE:
2457               if (memcard_create(menu->machine, *cardnum, FALSE) == 0)
2458                  popmessage("Memory card created");
2459               else
2460                  popmessage("Error creating memory card\n(Card may already exist)");
2461               break;
2462         }
2463      }
19432464
1944            /* if we're analog, add more entries */
1945            if (item[-1].type == INPUT_TYPE_ANALOG)
1946            {
1947               /* build an entry for the decrement sequence */
1948               item->field = field;
1949               item->seqtype = SEQ_TYPE_DECREMENT;
1950               item->seq = *input_field_seq(field, item->seqtype);
1951               item->defseq = get_field_default_seq(field, item->seqtype);
1952               item->sortorder = sortorder;
1953               item->type = INPUT_TYPE_ANALOG_DEC;
1954               item->name = menu_string_pool_add(input_format[item->type], name);
1955               item->seqname = menu_string_pool_add("%s", astring_c(input_seq_name(seqstring, &item->seq)));
1956               item->invert = input_seq_cmp(&item->seq, item->defseq);
1957               item++;
2465      /* the select item has extra keys */
2466      else if (item == MEMCARD_ITEM_SELECT)
2467      {
2468         switch (event->iptkey)
2469         {
2470            /* left decrements the card number */
2471            case IPT_UI_LEFT:
2472               *cardnum -= 1;
2473               break;
19582474
1959               /* build an entry for the increment sequence */
1960               item->field = field;
1961               item->seqtype = SEQ_TYPE_INCREMENT;
1962               item->seq = *input_field_seq(field, item->seqtype);
1963               item->defseq = get_field_default_seq(field, item->seqtype);
1964               item->sortorder = sortorder;
1965               item->type = INPUT_TYPE_ANALOG_INC;
1966               item->name = menu_string_pool_add(input_format[item->type], name);
1967               item->seqname = menu_string_pool_add("%s", astring_c(input_seq_name(seqstring, &item->seq)));
1968               item->invert = input_seq_cmp(&item->seq, item->defseq);
1969               item++;
1970            }
2475            /* right decrements the card number */
2476            case IPT_UI_RIGHT:
2477               *cardnum += 1;
2478               break;
19712479         }
19722480      }
1973
1974   /* return the number of items */
1975   astring_free(seqstring);
1976   return item - itemlist;
2481   }
19772482}
19782483
19792484
19802485/*-------------------------------------------------
1981    input_menu_toggle_none_default - toggle
1982    between "NONE" and the default item
2486    menu_memory_card_populate - populate the
2487    memory card menu
19832488-------------------------------------------------*/
19842489
1985static void input_menu_toggle_none_default(input_seq *selected_seq, input_seq *original_seq, const input_seq *selected_defseq)
2490static void menu_memory_card_populate(running_machine *machine, ui_menu *menu, int cardnum)
19862491{
1987   /* if we used to be "none", toggle to the default value */
1988   if (input_seq_get_1(original_seq) == SEQCODE_END)
1989      *selected_seq = *selected_defseq;
2492   char tempstring[20];
2493   UINT32 flags = 0;
19902494
1991   /* otherwise, toggle to "none" */
1992   else
1993      input_seq_set_1(selected_seq, SEQCODE_END);
2495   /* add the card select menu */
2496   sprintf(tempstring, "%d", cardnum);
2497   if (cardnum > 0)
2498      flags |= MENU_FLAG_LEFT_ARROW;
2499   if (cardnum < 1000)
2500      flags |= MENU_FLAG_RIGHT_ARROW;
2501   ui_menu_item_append(menu, "Card Number:", tempstring, flags, (void *)MEMCARD_ITEM_SELECT);
2502
2503   /* add the remaining items */
2504   ui_menu_item_append(menu, "Load Selected Card", NULL, 0, (void *)MEMCARD_ITEM_LOAD);
2505   if (memcard_present() != -1)
2506      ui_menu_item_append(menu, "Eject Current Card", NULL, 0, (void *)MEMCARD_ITEM_EJECT);
2507   ui_menu_item_append(menu, "Create New Card", NULL, 0, (void *)MEMCARD_ITEM_CREATE);
19942508}
19952509
19962510
19972511/*-------------------------------------------------
1998    input_menu_compare_items - compare two
1999    items for quicksort
2512    menu_video_targets - handle the video targets
2513    menu
20002514-------------------------------------------------*/
20012515
2002static int input_menu_compare_items(const void *i1, const void *i2)
2516static void menu_video_targets(running_machine *machine, ui_menu *menu, void *parameter, void *state)
20032517{
2004   const ui_menu_item *item1 = i1;
2005   const ui_menu_item *item2 = i2;
2006   const input_item_data *data1 = item1->ref;
2007   const input_item_data *data2 = item2->ref;
2008   if (data1->sortorder < data2->sortorder)
2009      return -1;
2010   if (data1->sortorder > data2->sortorder)
2011      return 1;
2012   if (data1->type < data2->type)
2013      return -1;
2014   if (data1->type > data2->type)
2015      return 1;
2016   return 0;
2518   const ui_menu_event *event;
2519
2520   /* if the menu isn't built, populate now */
2521   if (!ui_menu_populated(menu))
2522      menu_video_targets_populate(machine, menu);
2523
2524   /* process the menu */
2525   event = ui_menu_process(menu, 0);
2526   if (event != NULL && event->iptkey == IPT_UI_SELECT)
2527      ui_menu_stack_push(ui_menu_alloc(machine, menu_video_options, event->itemref));
20172528}
20182529
20192530
20202531/*-------------------------------------------------
2021    switches_menu_add_item - add an item to the
2022    switches menu list
2532    menu_video_targets_populate - populate the
2533    video targets menu
20232534-------------------------------------------------*/
20242535
2025static void switches_menu_add_item(ui_menu_item *item, const input_field_config *field)
2536static void menu_video_targets_populate(running_machine *machine, ui_menu *menu)
20262537{
2027   const input_setting_config *setting;
2028   input_field_user_settings settings;
2538   int targetnum;
20292539
2030   /* set the text to the name and the subitem text to invalid */
2031   input_field_get_user_settings(field, &settings);
2032   item->text = input_field_name(field);
2033   item->subtext = NULL;
2540   /* find the targets */
2541   for (targetnum = 0; ; targetnum++)
2542   {
2543      render_target *target = render_target_get_indexed(targetnum);
2544      char buffer[40];
20342545
2035   /* scan for the current selection in the list */
2036   for (setting = field->settinglist; setting != NULL; setting = setting->next)
2037      if (input_condition_true(field->port->machine, &setting->condition))
2038      {
2039         /* if this is a match, set the subtext */
2040         if (setting->value == settings.value)
2041            item->subtext = setting->name;
2546      /* stop when we run out */
2547      if (target == NULL)
2548         break;
20422549
2043         /* else if we haven't seen a match yet, show a left arrow */
2044         else if (item->subtext == NULL)
2045            item->flags |= MENU_FLAG_LEFT_ARROW;
2046
2047         /* else if we have seen a match, show a right arrow */
2048         else
2049            item->flags |= MENU_FLAG_RIGHT_ARROW;
2050      }
2051
2052   /* if no matches, we're invalid */
2053   if (item->subtext == NULL)
2054      item->subtext = "INVALID";
2055
2056   /* stash our reference */
2057   item->ref = (void *)field;
2550      /* add a menu item */
2551      sprintf(buffer, "Screen #%d", targetnum);
2552      ui_menu_item_append(menu, buffer, NULL, 0, target);
2553   }
20582554}
20592555
20602556
20612557/*-------------------------------------------------
2062    analog_menu_add_item - add an item to the
2063    analog controls menu
2558    menu_video_options - handle the video options
2559    menu
20642560-------------------------------------------------*/
20652561
2066static void analog_menu_add_item(ui_menu_item *item, const input_field_config *field, const char *append_string, int which_item)
2562static void menu_video_options(running_machine *machine, ui_menu *menu, void *parameter, void *state)
20672563{
2068   input_field_user_settings settings;
2069   int value, minval, maxval;
2564   render_target *target = (parameter != NULL) ? parameter : render_target_get_indexed(0);
2565   const ui_menu_event *event;
2566   int changed = FALSE;
20702567
2071   input_field_get_user_settings(field, &settings);
2568   /* if the menu isn't built, populate now */
2569   if (!ui_menu_populated(menu))
2570      menu_video_options_populate(machine, menu, target);
20722571
2073   /* set the item text using the formatting string provided */
2074   item->text = menu_string_pool_add("%s %s", input_field_name(field), append_string);
2075
2076   /* set the subitem text */
2077   switch (which_item)
2572   /* process the menu */
2573   event = ui_menu_process(menu, 0);
2574   if (event != NULL && event->itemref != NULL)
20782575   {
2079      default:
2080      case ANALOG_ITEM_KEYSPEED:
2081         value = settings.delta;
2082         minval = 0;
2083         maxval = 255;
2084         item->subtext = menu_string_pool_add("%d", value);
2085         break;
2576      switch ((FPTR)event->itemref)
2577      {
2578         /* rotate adds rotation depending on the direction */
2579         case VIDEO_ITEM_ROTATE:
2580            if (event->iptkey == IPT_UI_LEFT || event->iptkey == IPT_UI_RIGHT)
2581            {
2582               int delta = (event->iptkey == IPT_UI_LEFT) ? ROT270 : ROT90;
2583               render_target_set_orientation(target, orientation_add(delta, render_target_get_orientation(target)));
2584               if (target == render_get_ui_target())
2585               {
2586                  render_container_user_settings settings;
2587                  render_container_get_user_settings(render_container_get_ui(), &settings);
2588                  settings.orientation = orientation_add(delta ^ ROT180, settings.orientation);
2589                  render_container_set_user_settings(render_container_get_ui(), &settings);
2590               }
2591               changed = TRUE;
2592            }
2593            break;
20862594
2087      case ANALOG_ITEM_CENTERSPEED:
2088         value = settings.centerdelta;
2089         minval = 0;
2090         maxval = 255;
2091         item->subtext = menu_string_pool_add("%d", value);
2092         break;
2595         /* layer config bitmasks handle left/right keys the same (toggle) */
2596         case LAYER_CONFIG_ENABLE_BACKDROP:
2597         case LAYER_CONFIG_ENABLE_OVERLAY:
2598         case LAYER_CONFIG_ENABLE_BEZEL:
2599         case LAYER_CONFIG_ZOOM_TO_SCREEN:
2600            if (event->iptkey == IPT_UI_LEFT || event->iptkey == IPT_UI_RIGHT)
2601            {
2602               render_target_set_layer_config(target, render_target_get_layer_config(target) ^ (FPTR)event->itemref);
2603               changed = TRUE;
2604            }
2605            break;
20932606
2094      case ANALOG_ITEM_REVERSE:
2095         value = settings.reverse;
2096         minval = 0;
2097         maxval = 1;
2098         item->subtext = value ? "On" : "Off";
2099         break;
2100
2101      case ANALOG_ITEM_SENSITIVITY:
2102         value = settings.sensitivity;
2103         minval = 1;
2104         maxval = 255;
2105         item->subtext = menu_string_pool_add("%d%%", value);
2106         break;
2607         /* anything else is a view item */
2608         default:
2609            if (event->iptkey == IPT_UI_SELECT && (int)(FPTR)event->itemref >= VIDEO_ITEM_VIEW)
2610            {
2611               render_target_set_view(target, (FPTR)event->itemref - VIDEO_ITEM_VIEW);
2612               changed = TRUE;
2613            }
2614            break;
2615      }
21072616   }
21082617
2109   /* put on arrows */
2110   if (value > minval)
2111      item->flags |= MENU_FLAG_LEFT_ARROW;
2112   if (value < maxval)
2113      item->flags |= MENU_FLAG_RIGHT_ARROW;
2618   /* if something changed, rebuild the menu */
2619   if (changed)
2620      ui_menu_reset(menu, UI_MENU_RESET_REMEMBER_REF);
21142621}
21152622
21162623
21172624/*-------------------------------------------------
2118    dip_switch_build_model - build up the model
2119    for DIP switches
2625    menu_video_options_populate - populate the
2626    video options menu
21202627-------------------------------------------------*/
21212628
2122static void dip_switch_build_model(const input_field_config *field, int item_is_selected)
2629static void menu_video_options_populate(running_machine *machine, ui_menu *menu, render_target *target)
21232630{
2124   input_port_value value_mask_temp = field->mask;
2125   const input_field_diplocation *diploc;
2126   input_port_value toggle_switch_mask;
2127   input_field_user_settings settings;
2128   int value_mask_bit = 0;
2129   int model_index;
2130   int toggle_num;
2631   int layermask = render_target_get_layer_config(target);
2632   astring *tempstring = astring_alloc();
2633   const char *subtext = "";
2634   int viewnum;
2635   int enabled;
21312636
2132   diploc = field->diploclist;
2133   if (diploc == NULL || diploc->swname == NULL)
2134      return;
2135
2136   input_field_get_user_settings(field, &settings);
2137
2138   /* get the entry in the model to work with */
2139   for (model_index = 0; model_index < MAX_PHYSICAL_DIPS; model_index++)
2637   /* add items for each view */
2638   for (viewnum = 0; ; viewnum++)
21402639   {
2141      /* use this entry if it's not used */
2142      if (dip_switch_model[model_index].dip_name == NULL)
2143      {
2144         dip_switch_model[model_index].dip_name = diploc->swname;
2640      const char *name = render_target_get_view_name(target, viewnum);
2641      if (name == NULL)
21452642         break;
2146      }
21472643
2148      /* reuse this entry if the switch name matches */
2149      if (!strcmp(diploc->swname, dip_switch_model[model_index].dip_name))
2150         break;
2151
2152      // todo: add a check here to see if we go over the max dips and throw an error.
2644      /* create a string for the item, replacing underscores with spaces */
2645      astring_replacec(astring_cpyc(tempstring, name), 0, "_", " ");
2646      ui_menu_item_append(menu, astring_c(tempstring), NULL, 0, (void *)(FPTR)(VIDEO_ITEM_VIEW + viewnum));
21532647   }
21542648
2155   /* Create a mask depicting the number of toggles on the physical switch */
2156   for ( ; diploc != NULL; diploc = diploc->next)
2649   /* add a separator */
2650   ui_menu_item_append(menu, MENU_SEPARATOR_ITEM, NULL, 0, NULL);
2651
2652   /* add a rotate item */
2653   switch (render_target_get_orientation(target))
21572654   {
2158      /* get the Nth DIP toggle number */
2159      toggle_num = diploc->swnum;
2655      case ROT0:      subtext = "None";               break;
2656      case ROT90:      subtext = "CW 90" UTF8_DEGREES;    break;
2657      case ROT180:   subtext = "180" UTF8_DEGREES;       break;
2658      case ROT270:   subtext = "CCW 90" UTF8_DEGREES;    break;
2659   }
2660   ui_menu_item_append(menu, "Rotate", subtext, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_ROTATE);
21602661
2161      /* get the Nth mask bit -
2162         * should probably put a check here to avoid bad driver definitions
2163         * which could put us into an infinite loop. */
2164      while (!(value_mask_temp & 1))
2165      {
2166         value_mask_temp >>= 1;
2167         ++value_mask_bit;
2168      }
2169      /* clear out the lsb to keep it moving next iteration. */
2170      value_mask_temp &= ~1;
2662   /* backdrop item */
2663   enabled = layermask & LAYER_CONFIG_ENABLE_BACKDROP;
2664   ui_menu_item_append(menu, "Backdrops", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)LAYER_CONFIG_ENABLE_BACKDROP);
21712665
2172      toggle_switch_mask = 1 << (toggle_num - 1);
2666   /* overlay item */
2667   enabled = layermask & LAYER_CONFIG_ENABLE_OVERLAY;
2668   ui_menu_item_append(menu, "Overlays", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)LAYER_CONFIG_ENABLE_OVERLAY);
21732669
2174      /* indicate the toggle exists in the switch */
2175      dip_switch_model[model_index].total_dip_mask |= toggle_switch_mask;
2670   /* bezel item */
2671   enabled = layermask & LAYER_CONFIG_ENABLE_BEZEL;
2672   ui_menu_item_append(menu, "Bezels", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)LAYER_CONFIG_ENABLE_BEZEL);
21762673
2177      /* if it's inverted, mark it as such */
2178      if (diploc->invert)
2179         dip_switch_model[model_index].dip_invert_mask |= toggle_switch_mask;
2674   /* cropping */
2675   enabled = layermask & LAYER_CONFIG_ZOOM_TO_SCREEN;
2676   ui_menu_item_append(menu, "View", enabled ? "Cropped" : "Full", enabled ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)LAYER_CONFIG_ZOOM_TO_SCREEN);
21802677
2181      /* if isolated bit is on, set the toggle on */
2182      if ((1 << value_mask_bit) & settings.value)
2183         dip_switch_model[model_index].total_dip_settings |= toggle_switch_mask;
2184
2185      /* indicate if the toggle is selected */
2186      if (item_is_selected)
2187         dip_switch_model[model_index].selected_dip_feature_mask |= toggle_switch_mask;
2188   }
2678   astring_free(tempstring);
21892679}
21902680
21912681
21922682/*-------------------------------------------------
2193    dip_switch_draw_one - draw a single DIP
2194    switch
2683    menu_quit_game - handle the "menu" for
2684    quitting the game
21952685-------------------------------------------------*/
21962686
2197static void dip_switch_draw_one(float dip_menu_x1, float dip_menu_y1, float dip_menu_x2, float dip_menu_y2, int model_index)
2687static void menu_quit_game(running_machine *machine, ui_menu *menu, void *parameter, void *state)
21982688{
2199   int toggle_index;
2200   int num_toggles = 0;
2201   float segment_start_x;
2202   float dip_field_y;
2203   float y1_on, y2_on, y1_off, y2_off;
2204   float switch_toggle_gap;
2205   float name_width;
2689   /* request a reset */
2690   mame_schedule_exit(machine);
22062691
2207   /* determine the number of toggles in the DIP */
2208   for (toggle_index = 0; toggle_index < 16; toggle_index++)
2209      if (dip_switch_model[model_index].total_dip_mask & (1 << toggle_index))
2210         num_toggles = toggle_index + 1;
2692   /* reset the menu stack */
2693   ui_menu_stack_reset(machine);
2694}
22112695
2212   /* calculate the starting x coordinate so that the entire switch is centered */
2213   dip_field_y = dip_menu_y1 + DIP_SWITCH_SPACING + (model_index * (DIP_SWITCH_SPACING + DIP_SWITCH_HEIGHT));
22142696
2215   switch_toggle_gap = ((DIP_SWITCH_HEIGHT/2) - SINGLE_TOGGLE_SWITCH_HEIGHT)/2;
2697/*-------------------------------------------------
2698    menu_select_game - handle the game select
2699    menu
2700-------------------------------------------------*/
22162701
2217    segment_start_x = dip_menu_x1 + (dip_menu_x2 - dip_menu_x1 - num_toggles * SINGLE_TOGGLE_SWITCH_FIELD_WIDTH) / 2;
2702static void menu_select_game(running_machine *machine, ui_menu *menu, void *parameter, void *state)
2703{
2704   select_game_state *menustate;
2705   const ui_menu_event *event;
2706   int changed = FALSE;
22182707
2219   y1_off = dip_field_y + UI_LINE_WIDTH + switch_toggle_gap;
2220   y2_off = y1_off + SINGLE_TOGGLE_SWITCH_HEIGHT;
2708   /* if no state, allocate some */
2709   if (state == NULL)
2710   {
2711      state = ui_menu_alloc_state(menu, sizeof(*menustate) + sizeof(menustate->driverlist) * driver_list_get_count(drivers));
2712      if (parameter != NULL)
2713         strcpy(((select_game_state *)state)->search, parameter);
2714   }
2715   menustate = state;
22212716
2222   y1_on = dip_field_y + DIP_SWITCH_HEIGHT/2 + switch_toggle_gap;
2223   y2_on = y1_on + SINGLE_TOGGLE_SWITCH_HEIGHT;
2717   /* if the menu isn't built, populate now */
2718   if (!ui_menu_populated(menu))
2719      menu_select_game_populate(machine, menu, menustate);
22242720
2225   for (toggle_index = 0; toggle_index < num_toggles; toggle_index++)
2721   /* ignore pause keys by swallowing them before we process the menu */
2722   ui_input_pressed(machine, IPT_UI_PAUSE);
2723
2724   /* process the menu */
2725   event = ui_menu_process(menu, 0);
2726   if (event != NULL && event->itemref != NULL)
22262727   {
2227      int bit_mask, dip_on;
2228      float dip_field_x1, x1, x2;
2728      /* reset the error on any future event */
2729      if (menustate->error)
2730         menustate->error = FALSE;
22292731
2230      bit_mask = 1 << toggle_index;
2732      /* handle selections */
2733      else if (event->iptkey == IPT_UI_SELECT)
2734      {
2735         const game_driver *driver = (const game_driver *)event->itemref;
22312736
2232      /* draw the field for a single toggle on a DIP switch */
2233      dip_field_x1 = segment_start_x + (SINGLE_TOGGLE_SWITCH_FIELD_WIDTH * toggle_index);
2737         /* special case for configure inputs */
2738         if ((FPTR)driver == 1)
2739            ui_menu_stack_push(ui_menu_alloc(menu->machine, menu_input_groups, NULL));
22342740
2235      ui_draw_outlined_box(dip_field_x1,
2236                      dip_field_y,
2237                      dip_field_x1 + SINGLE_TOGGLE_SWITCH_FIELD_WIDTH,
2238                      dip_field_y + DIP_SWITCH_HEIGHT,
2239                      UI_FILLCOLOR);
2741         /* anything else is a driver */
2742         else
2743         {
2744            audit_record *audit;
2745            int audit_records;
2746            int audit_result;
22402747
2241      x1 = dip_field_x1 + (SINGLE_TOGGLE_SWITCH_FIELD_WIDTH - SINGLE_TOGGLE_SWITCH_WIDTH) / 2;
2242      x2 = x1 + SINGLE_TOGGLE_SWITCH_WIDTH;
2748            /* audit the game first to see if we're going to work */
2749            audit_records = audit_images(mame_options(), driver, AUDIT_VALIDATE_FAST, &audit);
2750            audit_result = audit_summary(driver, audit_records, audit, FALSE);
2751            if (audit_records > 0)
2752               free(audit);
22432753
2244      /* see if the switch is actually used */
2245      if (dip_switch_model[model_index].total_dip_mask & bit_mask)
2246      {
2247         /* yes, draw the switch position for a single toggle switch in a switch field */
2248         int feature_field_selected = ((bit_mask & dip_switch_model[model_index].selected_dip_feature_mask) != 0);
2249         dip_on = ((bit_mask & (dip_switch_model[model_index].total_dip_settings ^ dip_switch_model[model_index].dip_invert_mask)) != 0);
2754            /* if everything looks good, schedule the new driver */
2755            if (audit_result == CORRECT || audit_result == BEST_AVAILABLE)
2756            {
2757               mame_schedule_new_driver(machine, driver);
2758               ui_menu_stack_reset(machine);
2759            }
22502760
2251         render_ui_add_rect(x1, dip_on ? y1_on : y1_off,
2252                        x2, dip_on ? y2_on : y2_off,
2253                        feature_field_selected ? MENU_SELECTCOLOR : ARGB_WHITE,
2254                        PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
2761            /* otherwise, display an error */
2762            else
2763            {
2764               changed = TRUE;
2765               menustate->error = TRUE;
2766            }
2767         }
22552768      }
2256      else
2769
2770      /* escape pressed with non-empty text clears the text */
2771      else if (event->iptkey == IPT_UI_CANCEL && menustate->search[0] != 0)
22572772      {
2258         /* no, draw it grayed out */
2259         render_ui_add_rect(x1, y1_off,
2260                        x2, y2_on,
2261                        MENU_UNAVAILABLECOLOR,
2262                        PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
2773         /* since we have already been popped, we must recreate ourself from scratch */
2774         ui_menu_stack_push(ui_menu_alloc(menu->machine, menu_select_game, NULL));
22632775      }
2776
2777      /* typed characters append to the buffer */
2778      else if (event->iptkey == IPT_SPECIAL)
2779      {
2780         int buflen = strlen(menustate->search);
2781
2782         /* if it's a backspace and we can handle it, do so */
2783         if (event->unichar == 8 && buflen > 0)
2784         {
2785            *(char *)utf8_previous_char(&menustate->search[buflen]) = 0;
2786            menustate->rerandomize = TRUE;
2787            changed = TRUE;
2788         }
2789
2790         /* if it's any other key and we're not maxed out, update */
2791         else if (event->unichar >= ' ')
2792         {
2793            buflen += utf8_from_uchar(&menustate->search[buflen], ARRAY_LENGTH(menustate->search) - buflen, event->unichar);
2794            menustate->search[buflen] = 0;
2795            changed = TRUE;
2796         }
2797      }
22642798   }
22652799
2266   /* add the dip switch name */
2267   name_width = ui_get_string_width(dip_switch_model[model_index].dip_name) + ui_get_string_width(" ") / 2;
2800   /* if we're in an error state, overlay an error message */
2801   if (menustate->error)
2802      ui_draw_text_box("The selected game is missing one or more required ROM or CHD images. "
2803                       "Please select a different game.\n\nPress any key to continue.",
2804                       JUSTIFY_CENTER, 0.5f, 0.5f, UI_REDCOLOR);
22682805
2269   ui_draw_text_full(   dip_switch_model[model_index].dip_name,
2270                  segment_start_x - name_width,
2271                  dip_field_y + (DIP_SWITCH_HEIGHT - UI_TARGET_FONT_HEIGHT)/2,
2272                  name_width,
2273                  JUSTIFY_LEFT,
2274                  WRAP_NEVER,
2275                  DRAW_NORMAL,
2276                  ARGB_WHITE,
2277                  PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA),
2278                  NULL ,
2279                  NULL);
2806   /* if we changed, force a redraw on the next go */
2807   if (changed)
2808      ui_menu_reset(menu, UI_MENU_RESET_REMEMBER_REF);
22802809}
22812810
22822811
22832812/*-------------------------------------------------
2284    dip_switch_render - perform our special
2285    rendering
2813    menu_select_game_populate - populate the game
2814    select menu
22862815-------------------------------------------------*/
22872816
2288static void dip_switch_render(const menu_extra *extra, float x1, float y1, float x2, float y2)
2817static void menu_select_game_populate(running_machine *machine, ui_menu *menu, select_game_state *menustate)
22892818{
2290   int num_dips;
2291   int dip_model_index;
2292   float dip_menu_y1, dip_menu_y2;
2819   int matchcount;
2820   int curitem;
22932821
2294   /* how many dips does this game have? */
2295   num_dips = get_num_dips();
2822   /* update our driver list if necessary */
2823   if (menustate->driverlist[0] == NULL)
2824      menu_select_game_build_driver_list(menu, menustate);
2825   for (curitem = matchcount = 0; menustate->driverlist[curitem] != NULL && matchcount < VISIBLE_GAMES_IN_LIST; curitem++)
2826      if (!(menustate->driverlist[curitem]->flags & GAME_NO_STANDALONE))
2827         matchcount++;
22962828
2297   dip_menu_y1 = y2 + UI_BOX_TB_BORDER;
2298   dip_menu_y2 = dip_menu_y1 + extra->bottom;
2829   /* if nothing there, add a single multiline item and return */
2830   if (matchcount == 0)
2831   {
2832      ui_menu_item_append(menu, "No games found. Please check the rompath specified in the mame.ini file.\n\n"
2833                          "If this is your first time using MAME, please see the config.txt file in "
2834                          "the docs directory for information on configuring MAME.", NULL, MENU_FLAG_MULTILINE | MENU_FLAG_REDTEXT, NULL);
2835      return;
2836   }
22992837
2300   /* draw extra menu area */
2301   ui_draw_outlined_box(x1, dip_menu_y1, x2, dip_menu_y2, UI_FILLCOLOR);
2838   /* otherwise, rebuild the match list */
2839   if (menustate->search[0] != 0 || menustate->matchlist[0] == NULL || menustate->rerandomize)
2840      driver_list_get_approx_matches(menustate->driverlist, menustate->search, matchcount, menustate->matchlist);
2841   menustate->rerandomize = FALSE;
23022842
2303   /* draw all the dip switches */
2304   for (dip_model_index = 0; dip_model_index < num_dips; dip_model_index++)
2305      dip_switch_draw_one(x1, dip_menu_y1, x2, dip_menu_y2, dip_model_index);
2843   /* iterate over entries */
2844   for (curitem = 0; curitem < matchcount; curitem++)
2845   {
2846      const game_driver *driver = menustate->matchlist[curitem];
2847      if (driver != NULL)
2848      {
2849         const game_driver *cloneof = driver_get_clone(driver);
2850         ui_menu_item_append(menu, driver->name, driver->description, (cloneof == NULL || (cloneof->flags & GAME_IS_BIOS_ROOT)) ? 0 : MENU_FLAG_INVERT, (void *)driver);
2851      }
2852   }
2853
2854   /* if we're forced into this, allow general input configuration as well */
2855   if (ui_menu_is_force_game_select())
2856   {
2857      ui_menu_item_append(menu, MENU_SEPARATOR_ITEM, NULL, 0, NULL);
2858      ui_menu_item_append(menu, "Configure General Inputs", NULL, 0, (void *)1);
2859   }
2860
2861   /* configure the custom rendering */
2862   ui_menu_set_custom_render(menu, menu_select_game_custom_render, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER, 4.0f * ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER);
23062863}
23072864
23082865
23092866/*-------------------------------------------------
2310    select_game_driver_compare - compare the
2867    menu_select_game_driver_compare - compare the
23112868    names of two drivers
23122869-------------------------------------------------*/
23132870
2314static int CLIB_DECL select_game_driver_compare(const void *elem1, const void *elem2)
2871static int CLIB_DECL menu_select_game_driver_compare(const void *elem1, const void *elem2)
23152872{
23162873   const game_driver **driver1_ptr = (const game_driver **)elem1;
23172874   const game_driver **driver2_ptr = (const game_driver **)elem2;
r2956r2957
23252882
23262883
23272884/*-------------------------------------------------
2328    select_game_build_driver_list - build a list
2329    of available drivers
2885    menu_select_game_build_driver_list - build a
2886    list of available drivers
23302887-------------------------------------------------*/
23312888
2332static void select_game_build_driver_list(void)
2889static void menu_select_game_build_driver_list(ui_menu *menu, select_game_state *menustate)
23332890{
23342891   int driver_count = driver_list_get_count(drivers);
23352892   int drivnum, listnum;
23362893   mame_path *path;
23372894   UINT8 *found;
23382895
2339   /* first allocate a copy of the full driver list */
2340   if (select_game_driver_list == NULL)
2341      select_game_driver_list = malloc_or_die(driver_count * sizeof(*select_game_driver_list));
2342   memcpy((void *)select_game_driver_list, drivers, driver_count * sizeof(*select_game_driver_list));
2896   /* create a sorted copy of the main driver list */
2897   memcpy((void *)menustate->driverlist, drivers, driver_count * sizeof(menustate->driverlist[0]));
2898   qsort((void *)menustate->driverlist, driver_count, sizeof(menustate->driverlist[0]), menu_select_game_driver_compare);
23432899
2344   /* sort it */
2345   qsort((void *)select_game_driver_list, driver_count, sizeof(*select_game_driver_list), select_game_driver_compare);
2346
23472900   /* allocate a temporary array to track which ones we found */
2348   found = malloc_or_die((driver_count + 1) * sizeof(*found));
2349   memset(found, 0, (driver_count + 1) * sizeof(*found));
2901   found = ui_menu_pool_alloc(menu, (driver_count + 7) / 8);
2902   memset(found, 0, (driver_count + 7) / 8);
23502903
23512904   /* open a path to the ROMs and find them in the array */
23522905   path = mame_openpath(mame_options(), OPTION_ROMPATH);
r2956r2957
23722925         /* find it in the array */
23732926         tempdriver.name = drivername;
23742927         tempdriver_ptr = &tempdriver;
2375         found_driver = bsearch(&tempdriver_ptr, select_game_driver_list, driver_count, sizeof(*select_game_driver_list), select_game_driver_compare);
2928         found_driver = bsearch(&tempdriver_ptr, menustate->driverlist, driver_count, sizeof(*menustate->driverlist), menu_select_game_driver_compare);
23762929
23772930         /* if found, mark the corresponding entry in the array */
23782931         if (found_driver != NULL)
2379            found[found_driver - select_game_driver_list] = TRUE;
2932         {
2933            int index = found_driver - menustate->driverlist;
2934            found[index / 8] |= 1 << (index % 8);
2935         }
23802936      }
23812937      mame_closepath(path);
23822938   }
23832939
23842940   /* now build the final list */
23852941   for (drivnum = listnum = 0; drivnum < driver_count; drivnum++)
2386      if (found[drivnum])
2387         select_game_driver_list[listnum++] = select_game_driver_list[drivnum];
2942      if (found[drivnum / 8] & (1 << (drivnum % 8)))
2943         menustate->driverlist[listnum++] = menustate->driverlist[drivnum];
23882944
23892945   /* NULL-terminate */
2390   select_game_driver_list[listnum] = NULL;
2391   free(found);
2946   menustate->driverlist[listnum] = NULL;
23922947}
23932948
23942949
23952950/*-------------------------------------------------
2396    select_game_render - perform our special
2397    rendering
2951    menu_select_game_custom_render - perform our
2952    special rendering
23982953-------------------------------------------------*/
23992954
2400static void select_game_render(const menu_extra *extra, float origx1, float origy1, float origx2, float origy2)
2955static void menu_select_game_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
24012956{
2957   select_game_state *menustate = state;
24022958   const game_driver *driver;
24032959   float width, maxwidth;
24042960   float x1, y1, x2, y2;
r2956r2957
24072963   int line;
24082964
24092965   /* display the current typeahead */
2410   if (select_game_buffer[0] != 0)
2411      sprintf(&tempbuf[0][0], "Type name or select: %s_", select_game_buffer);
2966   if (menustate->search[0] != 0)
2967      sprintf(&tempbuf[0][0], "Type name or select: %s_", menustate->search);
24122968   else
24132969      sprintf(&tempbuf[0][0], "Type name or select: (random)");
24142970
r2956r2957
24212977   /* compute our bounds */
24222978   x1 = 0.5f - 0.5f * maxwidth;
24232979   x2 = x1 + maxwidth;
2424   y1 = origy1 - extra->top;
2980   y1 = origy1 - top;
24252981   y2 = origy1 - UI_BOX_TB_BORDER;
24262982
24272983   /* draw a box */
r2956r2957
24382994                 DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
24392995
24402996   /* determine the text to render below */
2441   driver = extra->param;
2442   if (driver != NULL)
2997   driver = ((FPTR)selectedref > 1) ? selectedref : NULL;
2998   if ((FPTR)driver > 1)
24432999   {
24443000      const char *gfxstat, *soundstat;
24453001
r2956r2957
24743030   }
24753031   else
24763032   {
3033      const char *s = COPYRIGHT;
24773034      int line = 0;
24783035      int col = 0;
2479      const char *s = COPYRIGHT;
24803036
24813037      /* first line is version string */
24823038      sprintf(&tempbuf[line++][0], "%s %s", APPLONGNAME, build_version);
24833039
24843040      /* output message */
2485      while(line < ARRAY_LENGTH(tempbuf))
3041      while (line < ARRAY_LENGTH(tempbuf))
24863042      {
2487         if ((*s == '\0') || (*s == '\n'))
3043         if (*s == 0 || *s == '\n')
24883044         {
2489            tempbuf[line++][col] = '\0';
3045            tempbuf[line++][col] = 0;
24903046            col = 0;
24913047         }
24923048         else
2493         {
24943049            tempbuf[line][col++] = *s;
2495         }
24963050
2497         if (*s != '\0')
3051         if (*s != 0)
24983052            s++;
24993053      }
25003054   }
r2956r2957
25133067   x1 = 0.5f - 0.5f * maxwidth;
25143068   x2 = x1 + maxwidth;
25153069   y1 = origy2 + UI_BOX_TB_BORDER;
2516   y2 = origy2 + extra->bottom;
3070   y2 = origy2 + bottom;
25173071
25183072   /* draw a box */
25193073   color = UI_FILLCOLOR;
r2956r2957
25373091}
25383092
25393093
3094
3095/***************************************************************************
3096    MENU HELPERS
3097***************************************************************************/
3098
25403099/*-------------------------------------------------
2541    select_game_handle_key - handle a keypress
3100    menu_render_triangle - render a triangle that
3101    is used for up/down arrows and left/right
3102    indicators
25423103-------------------------------------------------*/
25433104
2544static int select_game_handle_key(input_code keycode, char value)
3105static void menu_render_triangle(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param)
25453106{
2546   /* is this key pressed? */
2547   if (input_code_pressed_once(keycode))
3107   int halfwidth = dest->width / 2;
3108   int height = dest->height;
3109   int x, y;
3110
3111   /* start with all-transparent */
3112   bitmap_fill(dest, NULL, MAKE_ARGB(0x00,0x00,0x00,0x00));
3113
3114   /* render from the tip to the bottom */
3115   for (y = 0; y < height; y++)
25483116   {
2549      int buflen = strlen(select_game_buffer);
3117      int linewidth = (y * (halfwidth - 1) + (height / 2)) * 255 * 2 / height;
3118      UINT32 *target = BITMAP_ADDR32(dest, y, halfwidth);
25503119
2551      /* if it's a backspace and we can handle it, do so */
2552      if (value == 8)
3120      /* don't antialias if height < 12 */
3121      if (dest->height < 12)
25533122      {
2554         if (buflen > 0)
3123         int pixels = (linewidth + 254) / 255;
3124         if (pixels % 2 == 0) pixels++;
3125         linewidth = pixels * 255;
3126      }
3127
3128      /* loop while we still have data to generate */
3129      for (x = 0; linewidth > 0; x++)
3130      {
3131         int dalpha;
3132
3133         /* first colum we only consume one pixel */
3134         if (x == 0)
25553135         {
2556            select_game_buffer[buflen - 1] = 0;
2557            return TRUE;
3136            dalpha = MIN(0xff, linewidth);
3137            target[x] = MAKE_ARGB(dalpha,0xff,0xff,0xff);
25583138         }
2559      }
25603139
2561      /* if it's any other key and we're not maxed out, update */
2562      else if (buflen < ARRAY_LENGTH(select_game_buffer) - 1)
2563      {
2564         select_game_buffer[buflen] = value;
2565         select_game_buffer[buflen + 1] = 0;
2566         return TRUE;
3140         /* remaining columns consume two pixels, one on each side */
3141         else
3142         {
3143            dalpha = MIN(0x1fe, linewidth);
3144            target[x] = target[-x] = MAKE_ARGB(dalpha/2,0xff,0xff,0xff);
3145         }
3146
3147         /* account for the weight we consumed */
3148         linewidth -= dalpha;
25673149      }
25683150   }
2569   return FALSE;
25703151}
3152
3153
3154
3155/***************************************************************************
3156    ACCESSORS
3157***************************************************************************/
3158
src/emu/video.c
r2956r2957
11821182   const device_config *screen = device;
11831183   char unique_tag[40];
11841184   screen_state *state = get_safe_token(screen);
1185   render_container_user_settings settings;
11851186   render_container *container;
11861187   screen_config *config;
11871188
r2956r2957
12161217   state->scanline0_timer = timer_alloc(scanline0_callback, (void *)screen);
12171218
12181219   /* configure the default cliparea */
1220   render_container_get_user_settings(container, &settings);
12191221   if (config->xoffset != 0)
1220      render_container_set_xoffset(container, config->xoffset);
1222      settings.xoffset = config->xoffset;
12211223   if (config->yoffset != 0)
1222      render_container_set_yoffset(container, config->yoffset);
1224      settings.yoffset = config->yoffset;
12231225   if (config->xscale != 0)
1224      render_container_set_xscale(container, config->xscale);
1226      settings.xscale = config->xscale;
12251227   if (config->yscale != 0)
1226      render_container_set_yscale(container, config->yscale);
1228      settings.yscale = config->yscale;
1229   render_container_set_user_settings(container, &settings);
12271230
12281231   /* allocate a timer to generate per-scanline updates */
12291232   if (screen->machine->config->video_attributes & VIDEO_UPDATE_SCANLINE)
src/emu/uimenu.h
r2956r2957
2222***************************************************************************/
2323
2424/* flags for menu items */
25#define MENU_FLAG_LEFT_ARROW   (1 << 0)
26#define MENU_FLAG_RIGHT_ARROW   (1 << 1)
27#define MENU_FLAG_INVERT      (1 << 2)
25#define MENU_FLAG_LEFT_ARROW      (1 << 0)
26#define MENU_FLAG_RIGHT_ARROW      (1 << 1)
27#define MENU_FLAG_INVERT         (1 << 2)
28#define MENU_FLAG_MULTILINE         (1 << 3)
29#define MENU_FLAG_REDTEXT         (1 << 4)
2830
2931/* special menu item for separators */
30#define MENU_SEPARATOR_ITEM      "---"
32#define MENU_SEPARATOR_ITEM         "---"
3133
34/* flags to pass to ui_menu_process */
35#define UI_MENU_PROCESS_NOKEYS      1
36#define UI_MENU_PROCESS_LR_REPEAT   2
3237
38/* options for ui_menu_reset */
39enum _ui_menu_reset_options
40{
41   UI_MENU_RESET_SELECT_FIRST,
42   UI_MENU_RESET_REMEMBER_POSITION,
43   UI_MENU_RESET_REMEMBER_REF
44};
45typedef enum _ui_menu_reset_options ui_menu_reset_options;
3346
47
48
3449/***************************************************************************
3550    TYPE DEFINITIONS
3651***************************************************************************/
3752
38typedef UINT32 (*ui_menu_handler_func)(running_machine *machine, UINT32 state);
53/* forward declarations */
54typedef struct _ui_menu ui_menu;
3955
40typedef struct _ui_menu_item ui_menu_item;
41struct _ui_menu_item
42{
43   const char *text;
44   const char *subtext;
45   UINT32 flags;
46   void *ref;
47};
4856
57/* menu-related callback functions */
58typedef void (*ui_menu_handler_func)(running_machine *machine, ui_menu *menu, void *parameter, void *state);
59typedef void (*ui_menu_custom_func)(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
4960
50typedef struct _menu_extra menu_extra;
51struct _menu_extra
61
62/* menu-related events */
63typedef struct _ui_menu_event ui_menu_event;
64struct _ui_menu_event
5265{
53   float   top;         /* amount of extra height to add at the top */
54   float   bottom;         /* amount of extra height to add at the bottom*/
55   void    (*render)(const menu_extra *extra, float x, float y, float x2, float y2);
56   void *   param;         /* parameter to pass through */
66   void *         itemref;         /* reference for the selected item */
67   int            iptkey;            /* one of the IPT_* values from inptport.h */
68   unicode_char   unichar;         /* unicode character if iptkey == IPT_SPECIAL */
5769};
5870
5971
r2956r2957
6274    FUNCTION PROTOTYPES
6375***************************************************************************/
6476
77
78/* ----- core system management ----- */
79
6580/* initialization */
6681void ui_menu_init(running_machine *machine);
6782
68/* draw a menu, returning the number of visible items */
69int ui_menu_draw(const ui_menu_item *items, int numitems, int selected, const menu_extra *extra);
7083
84
85/* ----- core menu management ----- */
86
87/* allocate a new menu */
88ui_menu *ui_menu_alloc(running_machine *machine, ui_menu_handler_func handler, void *parameter);
89
90/* free a menu */
91void ui_menu_free(ui_menu *menu);
92
93/* free all items in the menu, and all memory allocated from the memory pool */
94void ui_menu_reset(ui_menu *menu, ui_menu_reset_options options);
95
96/* returns TRUE if the menu has any non-default items in it */
97int ui_menu_populated(ui_menu *menu);
98
99/* append a new item to the end of the menu */
100void ui_menu_item_append(ui_menu *menu, const char *text, const char *subtext, UINT32 flags, void *ref);
101
102/* process a menu, drawing it and returning any interesting events */
103const ui_menu_event *ui_menu_process(ui_menu *menu, UINT32 flags);
104
105/* configure the menu for custom rendering */
106void ui_menu_set_custom_render(ui_menu *menu, ui_menu_custom_func custom, float top, float bottom);
107
108/* allocate permanent memory to represent the menu's state */
109void *ui_menu_alloc_state(ui_menu *menu, size_t size);
110
111/* allocate temporary memory from the menu's memory pool */
112void *ui_menu_pool_alloc(ui_menu *menu, size_t size);
113
114/* make a temporary string copy in the menu's memory pool */
115const char *ui_menu_pool_strdup(ui_menu *menu, const char *string);
116
117/* retrieves the index of the currently selected menu item */
118void *ui_menu_get_selection(ui_menu *menu);
119
120/* changes the index of the currently selected menu item */
121void ui_menu_set_selection(ui_menu *menu, void *selected_itemref);
122
123
124
125/* ----- menu stack management ----- */
126
127/* reset the menus, clearing everything */
128void ui_menu_stack_reset(running_machine *machine);
129
130/* push a new menu onto the stack */
131void ui_menu_stack_push(ui_menu *menu);
132
133/* pop a menu from the stack */
134void ui_menu_stack_pop(running_machine *machine);
135
136
137
138/* ----- UI system interaction ----- */
139
71140/* master handler */
72141UINT32 ui_menu_ui_handler(running_machine *machine, UINT32 state);
73142
74/* menu keyboard handling */
75int ui_menu_generic_keys(running_machine *machine, UINT32 *selected, int num_items, int visible_items);
76
77/* menu stack management */
78void ui_menu_stack_reset(void);
79UINT32 ui_menu_stack_push(ui_menu_handler_func new_handler, UINT32 new_state);
80UINT32 ui_menu_stack_pop(void);
81
82143/* force game select menu */
83144void ui_menu_force_game_select(void);
84145int ui_menu_is_force_game_select(void);
src/emu/emu.mak
r2956r2957
3838EMUOBJS = \
3939   $(EMUOBJ)/attotime.o \
4040   $(EMUOBJ)/audit.o \
41   $(EMUOBJ)/cheat.o \
4241   $(EMUOBJ)/clifront.o \
4342   $(EMUOBJ)/config.o \
4443   $(EMUOBJ)/cpuexec.o \
r2956r2957
7675   $(EMUOBJ)/timer.o \
7776   $(EMUOBJ)/ui.o \
7877   $(EMUOBJ)/uigfx.o \
78   $(EMUOBJ)/uiinput.o \
7979   $(EMUOBJ)/uimenu.o \
8080   $(EMUOBJ)/validity.o \
8181   $(EMUOBJ)/video.o \
src/emu/mame.c
r2956r2957
8888#include "render.h"
8989#include "ui.h"
9090#include "uimenu.h"
91#include "uiinput.h"
9192#include "deprecat.h"
9293#include "debug/debugcon.h"
9394
r2956r2957
15581559   if (newbase != 0)
15591560      mame->base_time = newbase;
15601561
1562   /* intialize UI input */
1563   ui_input_init(machine);
1564
15611565   /* first load ROMs, then populate memory, and finally initialize CPUs */
15621566   /* these operations must proceed in this order */
15631567   rom_init(machine, machine->gamedrv->rom);
r2956r2957
16121616
16131617   /* initialize miscellaneous systems */
16141618   saveload_init(machine);
1615   if (options_get_bool(mame_options(), OPTION_CHEAT))
1616      cheat_init(machine);
1619//  if (options_get_bool(mame_options(), OPTION_CHEAT))
1620//      cheat_init(machine);
16171621}
16181622
16191623
src/emu/inptport.c
r2956r2957
248248
249249   /* specific special global input states */
250250   digital_joystick_state       joystick_info[MAX_PLAYERS][DIGITAL_JOYSTICKS_PER_PLAYER]; /* joystick states */
251   osd_ticks_t               ui_memory[__ipt_max];/* keypress timing for UI */
252251
253252   /* frame time tracking */
254253   attotime               last_frame_time;   /* time of the last frame callback */
r2956r2957
906905
907906
908907/*-------------------------------------------------
908    input_field_setting_name - return the expanded
909    setting name for a field
910-------------------------------------------------*/
911
912const char *input_field_setting_name(const input_field_config *field)
913{
914   const input_setting_config *setting;
915
916   /* only makes sense if we have settings */
917   assert(field->settinglist != NULL);
918
919   /* scan the list of settings looking for a match on the current value */
920   for (setting = field->settinglist; setting != NULL; setting = setting->next)
921      if (input_condition_true(field->port->machine, &setting->condition))
922         if (setting->value == field->state->value)
923            return setting->name;
924
925   return "INVALID";
926}
927
928
929/*-------------------------------------------------
930    input_field_has_previous_setting - return TRUE
931    if the given field has a "previous" setting
932-------------------------------------------------*/
933
934int input_field_has_previous_setting(const input_field_config *field)
935{
936   const input_setting_config *setting;
937
938   /* only makes sense if we have settings */
939   assert(field->settinglist != NULL);
940
941   /* scan the list of settings looking for a match on the current value */
942   for (setting = field->settinglist; setting != NULL; setting = setting->next)
943      if (input_condition_true(field->port->machine, &setting->condition))
944         return (setting->value != field->state->value);
945
946   return FALSE;
947}
948
949
950/*-------------------------------------------------
909951    input_field_select_previous_setting - select
910952    the previous item for a DIP switch or
911953    configuration field
r2956r2957
948990
949991
950992/*-------------------------------------------------
993    input_field_has_next_setting - return TRUE
994    if the given field has a "next" setting
995-------------------------------------------------*/
996
997int input_field_has_next_setting(const input_field_config *field)
998{
999   const input_setting_config *setting;
1000   int found = FALSE;
1001
1002   /* only makes sense if we have settings */
1003   assert(field->settinglist != NULL);
1004
1005   /* scan the list of settings looking for a match on the current value */
1006   for (setting = field->settinglist; setting != NULL; setting = setting->next)
1007      if (input_condition_true(field->port->machine, &setting->condition))
1008      {
1009         if (found)
1010            return TRUE;
1011         if (setting->value == field->state->value)
1012            found = TRUE;
1013      }
1014
1015   return FALSE;
1016}
1017
1018
1019/*-------------------------------------------------
9511020    input_field_select_next_setting - select the
9521021    next item for a DIP switch or
9531022    configuration field
r2956r2957
11321201
11331202
11341203/***************************************************************************
1135    USER INTERFACE SEQUENCE READING
1136***************************************************************************/
1137
1138/*-------------------------------------------------
1139    input_ui_pressed - return TRUE if a key down
1140    for the given user interface sequence is
1141    detected
1142-------------------------------------------------*/
1143
1144int input_ui_pressed(running_machine *machine, int code)
1145{
1146   return input_ui_pressed_repeat(machine, code, 0);
1147}
1148
1149
1150/*-------------------------------------------------
1151    input_ui_pressed_r - return TRUE if a key down
1152    for the given user interface sequence is
1153    detected, or if autorepeat at the given speed
1154    is triggered
1155-------------------------------------------------*/
1156
1157int input_ui_pressed_repeat(running_machine *machine, int code, int speed)
1158{
1159   input_port_private *portdata = machine->input_port_data;
1160   int pressed;
1161
1162profiler_mark(PROFILER_INPUT);
1163
1164   /* get the status of this key (assumed to be only in the defaults) */
1165   assert(code >= IPT_UI_CONFIGURE && code <= IPT_OSD_16);
1166   pressed = input_seq_pressed(input_type_seq(machine, code, 0, SEQ_TYPE_STANDARD));
1167
1168   /* if down, handle it specially */
1169   if (pressed)
1170   {
1171      osd_ticks_t tps = osd_ticks_per_second();
1172
1173      /* if this is the first press, set a 3x delay and leave pressed = 1 */
1174      if (portdata->ui_memory[code] == 0)
1175         portdata->ui_memory[code] = osd_ticks() + 3 * speed * tps / 60;
1176
1177      /* if this is an autorepeat case, set a 1x delay and leave pressed = 1 */
1178      else if (speed > 0 && (osd_ticks() + tps - portdata->ui_memory[code]) >= tps)
1179         portdata->ui_memory[code] += 1 * speed * tps / 60;
1180
1181      /* otherwise, reset pressed = 0 */
1182      else
1183         pressed = 0;
1184   }
1185
1186   /* if we're not pressed, reset the memory field */
1187   else
1188      portdata->ui_memory[code] = 0;
1189
1190profiler_mark(PROFILER_END);
1191
1192   return pressed;
1193}
1194
1195
1196
1197/***************************************************************************
11981204    PORT READING
11991205***************************************************************************/
12001206
src/emu/machine/eeprom.c
r2956r2957
365365   memcpy(eeprom_data, data, length);
366366}
367367
368UINT8 * eeprom_get_data_pointer(int * length)
368void *eeprom_get_data_pointer(UINT32 *length, UINT32 *size)
369369{
370   if(length)
371      *length = MEMORY_SIZE;
370   if (length != NULL && intf != NULL)
371      *length = 1 << intf->address_bits;
372   if (size != NULL && intf != NULL)
373      *size = intf->data_bits / 8;
372374
373375   return eeprom_data;
374376}
src/emu/machine/eeprom.h
r2956r2957
2929void eeprom_save(mame_file *file);
3030
3131void eeprom_set_data(const UINT8 *data, int length);
32UINT8 * eeprom_get_data_pointer(int * length);
32void *eeprom_get_data_pointer(UINT32 *length, UINT32 *size);
3333
3434/* 93C46 */
3535extern const eeprom_interface eeprom_interface_93C46;
src/emu/machine/pit8253.c
r2956r2957
373373        phase|output|length  |value|next|comment
374374        -----+------+--------+-----+----+----------------------------------
375375            0|high  |infinity|     |1   |waiting for count
376          1|high  |1       |     |2   |internal delay to load counter
376            1|high  |1       |     |2   |internal delay to load counter
377377            2|high  |n       |n..2 |3   |counting down
378          3|low   |1       |1    |2   |reload counter
378            3|low   |1       |1    |2   |reload counter
379379
380380        Counter rewrite has no effect until repeated
381381
r2956r2957
440440   case 3:
441441      /* Mode 3: (Square Wave Generator)
442442
443      ----------------+           +-----------+           +----
444                      |           |           |           |
445                      +-----------+           +-----------+
446          <- (n+1)/2 -X-   n/2   ->
447       ^
448       +- counter load or trigger
443        ----------------+           +-----------+           +----
444                        |           |           |           |
445                        +-----------+           +-----------+
446            <- (n+1)/2 -X-   n/2   ->
447         ^
448         +- counter load or trigger
449449
450450        phase|output|length  |value|next|comment
451      -----+------+--------+-----+----+----------------------------------
452          0|high  |infinity|     |1   |waiting for count
453          1|high  |1       |     |2   |internal delay to load counter
454          2|high  |n/2(+1) |n..0 |3   |counting down double speed, reload counter
455          3|low   |n/2     |n..0 |2   |counting down double speed, reload counter
451        -----+------+--------+-----+----+----------------------------------
452            0|high  |infinity|     |1   |waiting for count
453            1|high  |1       |     |2   |internal delay to load counter
454            2|high  |n/2(+1) |n..0 |3   |counting down double speed, reload counter
455            3|low   |n/2     |n..0 |2   |counting down double speed, reload counter
456456
457      Counter rewrite has no effect until repeated (output falling or rising)
457        Counter rewrite has no effect until repeated (output falling or rising)
458458
459      Gate rising-edge and level sensitive.
460      Gate low disables counting and sets output immediately high.
461      Rising-edge reloads count and initiates counting
462      Gate high enables counting. */
459        Gate rising-edge and level sensitive.
460        Gate low disables counting and sets output immediately high.
461        Rising-edge reloads count and initiates counting
462        Gate high enables counting. */
463463
464464      if (timer->gate   == 0 ||   timer->phase ==   0)
465465      {
r2956r2957
518518   case 4:
519519   case 5:
520520      /* Mode 4: (Software Trigger Strobe)
521         Mode 5: (Hardware Trigger Strobe)
521           Mode 5: (Hardware Trigger Strobe)
522522
523      --------------+ +--------------------
524                    | |
525                    +-+
526          <-  n+1  ->
527          ^         <1>
528          +- counter load (mode 4) or trigger (mode 5)
523        --------------+ +--------------------
524                      | |
525                      +-+
526            <-  n+1  ->
527            ^         <1>
528            +- counter load (mode 4) or trigger (mode 5)
529529
530      phase|output|length  |value|next|comment
531      -----+------+--------+-----+----+----------------------------------
532          0|high  |infinity|0..1 |0   |waiting for count/counting down
533          1|high  |1       |     |2   |internal delay when counter loaded
534          2|high  |n       |n..1 |3   |counting down
535          3|low   |1       |0    |0   |strobe
530        phase|output|length  |value|next|comment
531        -----+------+--------+-----+----+----------------------------------
532            0|high  |infinity|0..1 |0   |waiting for count/counting down
533            1|high  |1       |     |2   |internal delay when counter loaded
534            2|high  |n       |n..1 |3   |counting down
535            3|low   |1       |0    |0   |strobe
536536
537      Mode 4 only: counter rewrite loads new counter
538      Mode 5 only: count not reloaded immediately.
539      Mode control write doesn't stop count but sets output high
537        Mode 4 only: counter rewrite loads new counter
538        Mode 5 only: count not reloaded immediately.
539        Mode control write doesn't stop count but sets output high
540540
541      Mode 4 only: Gate level sensitive only. Low disables counting, high enables it.
542      Mode 5 only: Gate rising-edge sensitive only. Rising edge initiates counting */
541        Mode 4 only: Gate level sensitive only. Low disables counting, high enables it.
542        Mode 5 only: Gate rising-edge sensitive only. Rising edge initiates counting */
543543
544544      if (timer->gate   == 0 &&   mode ==   4)
545545      {
src/emu/mame.h
r2956r2957
185185typedef struct _streams_private streams_private;
186186typedef struct _devices_private devices_private;
187187typedef struct _input_port_private input_port_private;
188typedef struct _ui_input_private ui_input_private;
188189
189190
190191/* description of the currently-running machine */
r2956r2957
221222   streams_private *      streams_data;      /* internal data from streams.c */
222223   devices_private *      devices_data;      /* internal data from devices.c */
223224   input_port_private *   input_port_data;   /* internal data from inptport.c */
225   ui_input_private *      ui_input_data;      /* internal data from uiinput.c */
224226#ifdef MESS
225227   images_private *      images_data;      /* internal data from image.c */
226228#endif /* MESS */
src/emu/inptport.h
r2956r2957
988988/* modify the current settings for the given input field */
989989void input_field_set_user_settings(const input_field_config *field, const input_field_user_settings *settings);
990990
991/* return the expanded setting name for a field */
992const char *input_field_setting_name(const input_field_config *field);
993
994/* return TRUE if the given field has a "previous" setting */
995int input_field_has_previous_setting(const input_field_config *field);
996
991997/* select the previous item for a DIP switch or configuration field */
992998void input_field_select_previous_setting(const input_field_config *field);
993999
1000/* return TRUE if the given field has a "next" setting */
1001int input_field_has_next_setting(const input_field_config *field);
1002
9941003/* select the next item for a DIP switch or configuration field */
9951004void input_field_select_next_setting(const input_field_config *field);
9961005
9971006
998/* ----- user interface sequence reading ----- */
9991007
1000/* return TRUE if a key down for the given user interface sequence is detected */
1001int input_ui_pressed(running_machine *machine, int code);
1002
1003/* return TRUE if a key down for the given user interface sequence is detected, or if
1004   autorepeat at the given speed is triggered */
1005int input_ui_pressed_repeat(running_machine *machine, int code, int speed);
1006
1007
1008
10091008/* ----- port reading ----- */
10101009
10111010/* return the value of an input port */
src/emu/ui.c
r2956r2957
1717#include "render.h"
1818#include "rendfont.h"
1919#include "ui.h"
20#include "uiinput.h"
2021#include "uimenu.h"
2122#include "uigfx.h"
2223
r2956r2957
103104static osd_ticks_t popup_text_end;
104105
105106/* messagebox buffer */
106static char messagebox_text[4096];
107static astring *messagebox_text;
107108static rgb_t messagebox_backcolor;
108109
109110/* slider info */
r2956r2957
124125static int rescale_notifier(running_machine *machine, int width, int height);
125126
126127/* text generators */
127static int sprintf_disclaimer(running_machine *machine, char *buffer);
128static int sprintf_warnings(running_machine *machine, char *buffer);
128static astring *disclaimer_string(running_machine *machine, astring *buffer);
129static astring *warnings_string(running_machine *machine, astring *buffer);
129130
130131/* UI handlers */
131132static UINT32 handler_messagebox(running_machine *machine, UINT32 state);
r2956r2957
247248   /* make sure we clean up after ourselves */
248249   add_exit_callback(machine, ui_exit);
249250
250   /* allocate the font */
251   /* allocate the font and messagebox string */
251252   ui_font = render_font_alloc("ui.bdf");
253   messagebox_text = astring_alloc();
252254
253255   /* initialize the other UI bits */
254256   ui_menu_init(machine);
r2956r2957
276278   if (ui_font != NULL)
277279      render_font_free(ui_font);
278280   ui_font = NULL;
281
282   /* free the messagebox string */
283   if (messagebox_text != NULL)
284      astring_free(messagebox_text);
285   messagebox_text = NULL;
279286}
280287
281288
r2956r2957
341348      switch (state)
342349      {
343350         case 0:
344            if (show_disclaimer && sprintf_disclaimer(machine, messagebox_text))
351            if (show_disclaimer && astring_len(disclaimer_string(machine, messagebox_text)) > 0)
345352               ui_set_handler(handler_messagebox_ok, 0);
346353            break;
347354
348355         case 1:
349            if (show_warnings && sprintf_warnings(machine, messagebox_text))
356            if (show_warnings && astring_len(warnings_string(machine, messagebox_text)) > 0)
350357            {
351358               ui_set_handler(handler_messagebox_ok, 0);
352359               if (machine->gamedrv->flags & (GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION))
r2956r2957
355362            break;
356363
357364         case 2:
358            if (show_gameinfo && sprintf_game_info(machine, messagebox_text))
365            if (show_gameinfo && astring_len(game_info_astring(machine, messagebox_text)) > 0)
359366               ui_set_handler(handler_messagebox_anykey, 0);
360367            break;
361368#ifdef MESS
r2956r2957
396403   osd_ticks_t curtime = osd_ticks();
397404
398405   /* copy in the new text */
399   strncpy(messagebox_text, text, sizeof(messagebox_text));
406   astring_cpyc(messagebox_text, text);
400407   messagebox_backcolor = UI_FILLCOLOR;
401408
402409   /* don't update more than 4 times/second */
r2956r2957
571578    and full size computation
572579-------------------------------------------------*/
573580
574void ui_draw_text_full(const char *origs, float x, float y, float wrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight)
581void ui_draw_text_full(const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight)
575582{
576583   float lineheight = ui_get_line_height();
577584   const char *ends = origs + strlen(origs);
585   float wrapwidth = origwrapwidth;
578586   const char *s = origs;
579587   const char *linestart;
580588   float cury = y;
r2956r2957
697705
698706      /* align according to the justfication */
699707      if (line_justify == JUSTIFY_CENTER)
700         curx += (wrapwidth - curwidth) * 0.5f;
708         curx += (origwrapwidth - curwidth) * 0.5f;
701709      else if (line_justify == JUSTIFY_RIGHT)
702         curx += wrapwidth - curwidth;
710         curx += origwrapwidth - curwidth;
703711
704712      /* track the maximum width of any given line */
705713      if (curwidth > maxwidth)
r2956r2957
820828
821829   /* extract the text */
822830   va_start(arg,text);
823   vsprintf(messagebox_text, text, arg);
831   astring_vprintf(messagebox_text, text, arg);
824832   messagebox_backcolor = UI_FILLCOLOR;
825833   va_end(arg);
826834
r2956r2957
935943***************************************************************************/
936944
937945/*-------------------------------------------------
938    sprintf_disclaimer - print the disclaimer
946    disclaimer_string - print the disclaimer
939947    text to the given buffer
940948-------------------------------------------------*/
941949
942static int sprintf_disclaimer(running_machine *machine, char *buffer)
950static astring *disclaimer_string(running_machine *machine, astring *string)
943951{
944   char *bufptr = buffer;
945   bufptr += sprintf(bufptr, "Usage of emulators in conjunction with ROMs you don't own is forbidden by copyright law.\n\n");
946   bufptr += sprintf(bufptr, "IF YOU ARE NOT LEGALLY ENTITLED TO PLAY \"%s\" ON THIS EMULATOR, PRESS ESC.\n\n", machine->gamedrv->description);
947   bufptr += sprintf(bufptr, "Otherwise, type OK or move the joystick left then right to continue");
948   return bufptr - buffer;
952   astring_cpyc(string, "Usage of emulators in conjunction with ROMs you don't own is forbidden by copyright law.\n\n");
953   astring_catprintf(string, "IF YOU ARE NOT LEGALLY ENTITLED TO PLAY \"%s\" ON THIS EMULATOR, PRESS ESC.\n\n", machine->gamedrv->description);
954   astring_catc(string, "Otherwise, type OK or move the joystick left then right to continue");
955   return string;
949956}
950957
951958
952959/*-------------------------------------------------
953    sprintf_warnings - print the warning flags
960    warnings_string - print the warning flags
954961    text to the given buffer
955962-------------------------------------------------*/
956963
957static int sprintf_warnings(running_machine *machine, char *buffer)
964static astring *warnings_string(running_machine *machine, astring *string)
958965{
959966#define WARNING_FLAGS (   GAME_NOT_WORKING | \
960967                  GAME_UNEMULATED_PROTECTION | \
r2956r2957
964971                  GAME_IMPERFECT_SOUND |  \
965972                  GAME_IMPERFECT_GRAPHICS | \
966973                  GAME_NO_COCKTAIL)
967   char *bufptr = buffer;
968974   int i;
969975
976   astring_reset(string);
977
970978   /* if no warnings, nothing to return */
971979   if (rom_load_warnings() == 0 && !(machine->gamedrv->flags & WARNING_FLAGS))
972      return 0;
980      return string;
973981
974982   /* add a warning if any ROMs were loaded with warnings */
975983   if (rom_load_warnings() > 0)
976984   {
977      bufptr += sprintf(bufptr, "One or more ROMs/CHDs for this game are incorrect. The " GAMENOUN " may not run correctly.\n");
985      astring_catc(string, "One or more ROMs/CHDs for this game are incorrect. The " GAMENOUN " may not run correctly.\n");
978986      if (machine->gamedrv->flags & WARNING_FLAGS)
979         *bufptr++ = '\n';
987         astring_catc(string, "\n");
980988   }
981989
982990   /* if we have at least one warning flag, print the general header */
983991   if (machine->gamedrv->flags & WARNING_FLAGS)
984992   {
985      bufptr += sprintf(bufptr, "There are known problems with this " GAMENOUN "\n\n");
993      astring_catc(string, "There are known problems with this " GAMENOUN "\n\n");
986994
987995      /* add one line per warning flag */
988996#ifdef MESS
989997      if (machine->gamedrv->flags & GAME_COMPUTER)
990         bufptr += sprintf(bufptr, "%s\n\n%s\n", "The emulated system is a computer: ", "The keyboard emulation may not be 100% accurate.");
998         astring_catc(string, "The emulated system is a computer:\n\nThe keyboard emulation may not be 100% accurate.\n");
991999#endif
9921000      if (machine->gamedrv->flags & GAME_IMPERFECT_COLORS)
993         bufptr += sprintf(bufptr, "The colors aren't 100%% accurate.\n");
1001         astring_catc(string, "The colors aren't 100% accurate.\n");
9941002      if (machine->gamedrv->flags & GAME_WRONG_COLORS)
995         bufptr += sprintf(bufptr, "The colors are completely wrong.\n");
1003         astring_catc(string, "The colors are completely wrong.\n");
9961004      if (machine->gamedrv->flags & GAME_IMPERFECT_GRAPHICS)
997         bufptr += sprintf(bufptr, "The video emulation isn't 100%% accurate.\n");
1005         astring_catc(string, "The video emulation isn't 100% accurate.\n");
9981006      if (machine->gamedrv->flags & GAME_IMPERFECT_SOUND)
999         bufptr += sprintf(bufptr, "The sound emulation isn't 100%% accurate.\n");
1007         astring_catc(string, "The sound emulation isn't 100% accurate.\n");
10001008      if (machine->gamedrv->flags & GAME_NO_SOUND)
1001         bufptr += sprintf(bufptr, "The game lacks sound.\n");
1009         astring_catc(string, "The game lacks sound.\n");
10021010      if (machine->gamedrv->flags & GAME_NO_COCKTAIL)
1003         bufptr += sprintf(bufptr, "Screen flipping in cocktail mode is not supported.\n");
1011         astring_catc(string, "Screen flipping in cocktail mode is not supported.\n");
10041012
10051013      /* if there's a NOT WORKING or UNEMULATED PROTECTION warning, make it stronger */
10061014      if (machine->gamedrv->flags & (GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION))
r2956r2957
10111019
10121020         /* add the strings for these warnings */
10131021         if (machine->gamedrv->flags & GAME_NOT_WORKING)
1014            bufptr += sprintf(bufptr, "THIS " CAPGAMENOUN " DOESN'T WORK. You won't be able to make it work correctly.  Don't bother.\n");
1022            astring_catc(string, "THIS " CAPGAMENOUN " DOESN'T WORK. You won't be able to make it work correctly.  Don't bother.\n");
10151023         if (machine->gamedrv->flags & GAME_UNEMULATED_PROTECTION)
1016            bufptr += sprintf(bufptr, "The game has protection which isn't fully emulated.\n");
1024            astring_catc(string, "The game has protection which isn't fully emulated.\n");
10171025
10181026         /* find the parent of this driver */
10191027         clone_of = driver_get_clone(machine->gamedrv);
r2956r2957
10301038               {
10311039                  /* this one works, add a header and display the name of the clone */
10321040                  if (foundworking == 0)
1033                     bufptr += sprintf(bufptr, "\n\nThere are working clones of this game. They are:\n\n");
1034                  bufptr += sprintf(bufptr, "%s\n", drivers[i]->name);
1041                     astring_catc(string, "\n\nThere are working clones of this game. They are:\n\n");
1042                  astring_catc(string, drivers[i]->name);
1043                  astring_catc(string, "\n");
10351044                  foundworking = 1;
10361045               }
10371046      }
10381047   }
10391048
10401049   /* add the 'press OK' string */
1041   bufptr += sprintf(bufptr, "\n\nType OK or move the joystick left then right to continue");
1042   return bufptr - buffer;
1050   astring_catc(string, "\n\nType OK or move the joystick left then right to continue");
1051   return string;
10431052}
10441053
10451054
10461055/*-------------------------------------------------
1047    sprintf_game_info - print the game info text
1048    to the given buffer
1056    game_info_astring - populate an allocated
1057    string with the game info text
10491058-------------------------------------------------*/
10501059
1051int sprintf_game_info(running_machine *machine, char *buffer)
1060astring *game_info_astring(running_machine *machine, astring *string)
10521061{
10531062   int scrcount = video_screen_count(machine->config);
1054   char *bufptr = buffer;
10551063   int cpunum, sndnum;
10561064   int count;
10571065
10581066   /* print description, manufacturer, and CPU: */
1059   bufptr += sprintf(bufptr, "%s\n%s %s\n\nCPU:\n", machine->gamedrv->description, machine->gamedrv->year, machine->gamedrv->manufacturer);
1067   astring_printf(string, "%s\n%s %s\n\nCPU:\n", machine->gamedrv->description, machine->gamedrv->year, machine->gamedrv->manufacturer);
10601068
10611069   /* loop over all CPUs */
10621070   for (cpunum = 0; cpunum < MAX_CPU && machine->config->cpu[cpunum].type != CPU_DUMMY; cpunum += count)
r2956r2957
10721080
10731081      /* if more than one, prepend a #x in front of the CPU name */
10741082      if (count > 1)
1075         bufptr += sprintf(bufptr, "%d" UTF8_MULTIPLY, count);
1076      bufptr += sprintf(bufptr, "%s", cputype_name(type));
1083         astring_catprintf(string, "%d" UTF8_MULTIPLY, count);
1084      astring_catc(string, cputype_name(type));
10771085
10781086      /* display clock in kHz or MHz */
10791087      if (clock >= 1000000)
1080         bufptr += sprintf(bufptr, " %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000);
1088         astring_catprintf(string, " %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000);
10811089      else
1082         bufptr += sprintf(bufptr, " %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000);
1090         astring_catprintf(string, " %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000);
10831091   }
10841092
10851093   /* loop over all sound chips */
r2956r2957
10901098
10911099      /* append the Sound: string */
10921100      if (sndnum == 0)
1093         bufptr += sprintf(bufptr, "\nSound:\n");
1101         astring_catc(string, "\nSound:\n");
10941102
10951103      /* count how many identical sound chips we have */
10961104      for (count = 1; sndnum + count < MAX_SOUND; count++)
r2956r2957
11001108
11011109      /* if more than one, prepend a #x in front of the CPU name */
11021110      if (count > 1)
1103         bufptr += sprintf(bufptr, "%d" UTF8_MULTIPLY, count);
1104      bufptr += sprintf(bufptr, "%s", sndnum_name(sndnum));
1111         astring_catprintf(string, "%d" UTF8_MULTIPLY, count);
1112      astring_catc(string, sndnum_name(sndnum));
11051113
11061114      /* display clock in kHz or MHz */
11071115      if (clock >= 1000000)
1108         bufptr += sprintf(bufptr, " %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000);
1116         astring_catprintf(string, " %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000);
11091117      else if (clock != 0)
1110         bufptr += sprintf(bufptr, " %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000);
1118         astring_catprintf(string, " %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000);
11111119      else
1112         *bufptr++ = '\n';
1120         astring_catc(string, "\n");
11131121   }
11141122
11151123   /* display screen information */
1116   bufptr += sprintf(bufptr, "\nVideo:\n");
1124   astring_catc(string, "\nVideo:\n");
11171125   if (scrcount == 0)
1118      buffer += sprintf(bufptr, "None\n");
1126      astring_catc(string, "None\n");
11191127   else
11201128   {
11211129      const device_config *screen;
r2956r2957
11251133         const screen_config *scrconfig = screen->inline_config;
11261134
11271135         if (scrcount > 1)
1128            bufptr += sprintf(bufptr, "%s: ", slider_get_screen_desc(screen));
1136            astring_catc(string, slider_get_screen_desc(screen));
11291137
11301138         if (scrconfig->type == SCREEN_TYPE_VECTOR)
1131            bufptr += sprintf(bufptr, "Vector\n");
1139            astring_catc(string, "Vector\n");
11321140         else
11331141         {
11341142            const rectangle *visarea = video_screen_get_visible_area(screen);
11351143
1136            bufptr += sprintf(bufptr, "%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n",
1144            astring_catprintf(string, "%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n",
11371145                  visarea->max_x - visarea->min_x + 1,
11381146                  visarea->max_y - visarea->min_y + 1,
11391147                  (machine->gamedrv->flags & ORIENTATION_SWAP_XY) ? "V" : "H",
r2956r2957
11421150      }
11431151   }
11441152
1145   return bufptr - buffer;
1153   return string;
11461154}
11471155
11481156
r2956r2957
11581166
11591167static UINT32 handler_messagebox(running_machine *machine, UINT32 state)
11601168{
1161   ui_draw_text_box(messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
1169   ui_draw_text_box(astring_c(messagebox_text), JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
11621170   return 0;
11631171}
11641172
r2956r2957
11711179static UINT32 handler_messagebox_ok(running_machine *machine, UINT32 state)
11721180{
11731181   /* draw a standard message window */
1174   ui_draw_text_box(messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
1182   ui_draw_text_box(astring_c(messagebox_text), JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
11751183
11761184   /* an 'O' or left joystick kicks us to the next state */
1177   if (state == 0 && (input_code_pressed_once(KEYCODE_O) || input_ui_pressed(machine, IPT_UI_LEFT)))
1185   if (state == 0 && (input_code_pressed_once(KEYCODE_O) || ui_input_pressed(machine, IPT_UI_LEFT)))
11781186      state++;
11791187
11801188   /* a 'K' or right joystick exits the state */
1181   else if (state == 1 && (input_code_pressed_once(KEYCODE_K) || input_ui_pressed(machine, IPT_UI_RIGHT)))
1189   else if (state == 1 && (input_code_pressed_once(KEYCODE_K) || ui_input_pressed(machine, IPT_UI_RIGHT)))
11821190      state = UI_HANDLER_CANCEL;
11831191
11841192   /* if the user cancels, exit out completely */
1185   else if (input_ui_pressed(machine, IPT_UI_CANCEL))
1193   else if (ui_input_pressed(machine, IPT_UI_CANCEL))
11861194   {
11871195      mame_schedule_exit(machine);
11881196      state = UI_HANDLER_CANCEL;
r2956r2957
12011209static UINT32 handler_messagebox_anykey(running_machine *machine, UINT32 state)
12021210{
12031211   /* draw a standard message window */
1204   ui_draw_text_box(messagebox_text, JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
1212   ui_draw_text_box(astring_c(messagebox_text), JUSTIFY_LEFT, 0.5f, 0.5f, messagebox_backcolor);
12051213
12061214   /* if the user cancels, exit out completely */
1207   if (input_ui_pressed(machine, IPT_UI_CANCEL))
1215   if (ui_input_pressed(machine, IPT_UI_CANCEL))
12081216   {
12091217      mame_schedule_exit(machine);
12101218      state = UI_HANDLER_CANCEL;
r2956r2957
12411249      ui_draw_text_full(profiler_get_text(), 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, DRAW_OPAQUE, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
12421250
12431251   /* let the cheat engine display its stuff */
1244   if (options_get_bool(mame_options(), OPTION_CHEAT))
1245      cheat_display_watches(machine);
1252//  if (options_get_bool(mame_options(), OPTION_CHEAT))
1253//      cheat_display_watches(machine);
12461254
12471255   /* display any popup messages */
12481256   if (osd_ticks() < popup_text_end)
1249      ui_draw_text_box(messagebox_text, JUSTIFY_CENTER, 0.5f, 0.9f, messagebox_backcolor);
1257      ui_draw_text_box(astring_c(messagebox_text), JUSTIFY_CENTER, 0.5f, 0.9f, messagebox_backcolor);
12501258   else
12511259      popup_text_end = 0;
12521260
r2956r2957
12631271#endif /* MESS */
12641272
12651273   /* if the user pressed ESC, stop the emulation */
1266   if (input_ui_pressed(machine, IPT_UI_CANCEL))
1274   if (ui_input_pressed(machine, IPT_UI_CANCEL))
12671275      mame_schedule_exit(machine);
12681276
12691277   /* turn on menus if requested */
1270   if (input_ui_pressed(machine, IPT_UI_CONFIGURE))
1278   if (ui_input_pressed(machine, IPT_UI_CONFIGURE))
12711279      return ui_set_handler(ui_menu_ui_handler, 0);
12721280
12731281   /* if the on-screen display isn't up and the user has toggled it, turn it on */
1274   if ((machine->debug_flags & DEBUG_FLAG_ENABLED)  == 0 && input_ui_pressed(machine, IPT_UI_ON_SCREEN_DISPLAY))
1282   if ((machine->debug_flags & DEBUG_FLAG_ENABLED)  == 0 && ui_input_pressed(machine, IPT_UI_ON_SCREEN_DISPLAY))
12751283      return ui_set_handler(handler_slider, 0);
12761284
12771285   /* handle a reset request */
1278   if (input_ui_pressed(machine, IPT_UI_RESET_MACHINE))
1286   if (ui_input_pressed(machine, IPT_UI_RESET_MACHINE))
12791287      mame_schedule_hard_reset(machine);
1280   if (input_ui_pressed(machine, IPT_UI_SOFT_RESET))
1288   if (ui_input_pressed(machine, IPT_UI_SOFT_RESET))
12811289      mame_schedule_soft_reset(machine);
12821290
12831291   /* handle a request to display graphics/palette */
1284   if (input_ui_pressed(machine, IPT_UI_SHOW_GFX))
1292   if (ui_input_pressed(machine, IPT_UI_SHOW_GFX))
12851293   {
12861294      if (!is_paused)
12871295         mame_pause(machine, TRUE);
r2956r2957
12891297   }
12901298
12911299   /* handle a save state request */
1292   if (input_ui_pressed(machine, IPT_UI_SAVE_STATE))
1300   if (ui_input_pressed(machine, IPT_UI_SAVE_STATE))
12931301   {
12941302      mame_pause(machine, TRUE);
12951303      return ui_set_handler(handler_load_save, LOADSAVE_SAVE);
12961304   }
12971305
12981306   /* handle a load state request */
1299   if (input_ui_pressed(machine, IPT_UI_LOAD_STATE))
1307   if (ui_input_pressed(machine, IPT_UI_LOAD_STATE))
13001308   {
13011309      mame_pause(machine, TRUE);
13021310      return ui_set_handler(handler_load_save, LOADSAVE_LOAD);
13031311   }
13041312
13051313   /* handle a save snapshot request */
1306   if (input_ui_pressed(machine, IPT_UI_SNAPSHOT))
1314   if (ui_input_pressed(machine, IPT_UI_SNAPSHOT))
13071315      video_save_active_screen_snapshots(machine);
13081316
13091317   /* toggle pause */
1310   if (input_ui_pressed(machine, IPT_UI_PAUSE))
1318   if (ui_input_pressed(machine, IPT_UI_PAUSE))
13111319   {
13121320      /* with a shift key, it is single step */
13131321      if (is_paused && (input_code_pressed(KEYCODE_LSHIFT) || input_code_pressed(KEYCODE_RSHIFT)))
r2956r2957
13201328   }
13211329
13221330   /* toggle movie recording */
1323   if (input_ui_pressed(machine, IPT_UI_RECORD_MOVIE))
1331   if (ui_input_pressed(machine, IPT_UI_RECORD_MOVIE))
13241332   {
13251333      if (!video_mng_is_movie_active(machine))
13261334      {
r2956r2957
13351343   }
13361344
13371345   /* toggle profiler display */
1338   if (input_ui_pressed(machine, IPT_UI_SHOW_PROFILER))
1346   if (ui_input_pressed(machine, IPT_UI_SHOW_PROFILER))
13391347      ui_set_show_profiler(!ui_get_show_profiler());
13401348
13411349   /* toggle FPS display */
1342   if (input_ui_pressed(machine, IPT_UI_SHOW_FPS))
1350   if (ui_input_pressed(machine, IPT_UI_SHOW_FPS))
13431351      ui_set_show_fps(!ui_get_show_fps());
13441352
13451353   /* toggle crosshair display */
1346   if (input_ui_pressed(machine, IPT_UI_TOGGLE_CROSSHAIR))
1354   if (ui_input_pressed(machine, IPT_UI_TOGGLE_CROSSHAIR))
13471355      crosshair_toggle(machine);
13481356
13491357   /* increment frameskip? */
1350   if (input_ui_pressed(machine, IPT_UI_FRAMESKIP_INC))
1358   if (ui_input_pressed(machine, IPT_UI_FRAMESKIP_INC))
13511359   {
13521360      /* get the current value and increment it */
13531361      int newframeskip = video_get_frameskip() + 1;
r2956r2957
13601368   }
13611369
13621370   /* decrement frameskip? */
1363   if (input_ui_pressed(machine, IPT_UI_FRAMESKIP_DEC))
1371   if (ui_input_pressed(machine, IPT_UI_FRAMESKIP_DEC))
13641372   {
13651373      /* get the current value and decrement it */
13661374      int newframeskip = video_get_frameskip() - 1;
r2956r2957
13731381   }
13741382
13751383   /* toggle throttle? */
1376   if (input_ui_pressed(machine, IPT_UI_THROTTLE))
1384   if (ui_input_pressed(machine, IPT_UI_THROTTLE))
13771385      video_set_throttle(!video_get_throttle());
13781386
13791387   /* check for fast forward */
r2956r2957
13871395
13881396#ifdef MESS
13891397   /* paste? */
1390   if (input_ui_pressed(machine, IPT_UI_PASTE))
1398   if (ui_input_pressed(machine, IPT_UI_PASTE))
13911399      ui_paste(machine);
13921400#endif /* MESS */
13931401
r2956r2957
14071415   char textbuf[256];
14081416
14091417   /* left/right control the increment */
1410   if (input_ui_pressed_repeat(machine, IPT_UI_LEFT,6))
1418   if (ui_input_pressed_repeat(machine, IPT_UI_LEFT,6))
14111419      increment = -cur->incval;
1412   if (input_ui_pressed_repeat(machine, IPT_UI_RIGHT,6))
1420   if (ui_input_pressed_repeat(machine, IPT_UI_RIGHT,6))
14131421      increment = cur->incval;
14141422
14151423   /* alt goes to 1, shift goes 10x smaller, control goes 10x larger */
r2956r2957
14271435   newval = (*cur->update)(machine, 0, NULL, cur->arg) + increment;
14281436
14291437   /* select resets to the default value */
1430   if (input_ui_pressed(machine, IPT_UI_SELECT))
1438   if (ui_input_pressed(machine, IPT_UI_SELECT))
14311439      newval = cur->defval;
14321440
14331441   /* clamp within bounds */
r2956r2957
14431451   slider_display(textbuf, cur->minval, cur->maxval, cur->defval, newval);
14441452
14451453   /* up/down select which slider to control */
1446   if (input_ui_pressed_repeat(machine, IPT_UI_DOWN,6))
1454   if (ui_input_pressed_repeat(machine, IPT_UI_DOWN,6))
14471455      slider_current = (slider_current + 1) % slider_count;
1448   if (input_ui_pressed_repeat(machine, IPT_UI_UP,6))
1456   if (ui_input_pressed_repeat(machine, IPT_UI_UP,6))
14491457      slider_current = (slider_current + slider_count - 1) % slider_count;
14501458
14511459   /* the slider toggle or ESC will cancel out of our display */
1452   if (input_ui_pressed(machine, IPT_UI_ON_SCREEN_DISPLAY) || input_ui_pressed(machine, IPT_UI_CANCEL))
1460   if (ui_input_pressed(machine, IPT_UI_ON_SCREEN_DISPLAY) || ui_input_pressed(machine, IPT_UI_CANCEL))
14531461      return UI_HANDLER_CANCEL;
14541462
14551463   /* the menu key will take us directly to the menu */
1456   if (input_ui_pressed(machine, IPT_UI_CONFIGURE))
1464   if (ui_input_pressed(machine, IPT_UI_CONFIGURE))
14571465      return ui_set_handler(ui_menu_ui_handler, 0);
14581466
14591467   return 0;
r2956r2957
14821490      ui_draw_message_window("Select position to load from");
14831491
14841492   /* check for cancel key */
1485   if (input_ui_pressed(machine, IPT_UI_CANCEL))
1493   if (ui_input_pressed(machine, IPT_UI_CANCEL))
14861494   {
14871495      /* display a popup indicating things were cancelled */
14881496      if (state == LOADSAVE_SAVE)
r2956r2957
18041812{
18051813   const device_config *screen = arg;
18061814   render_container *container = render_container_get_screen(screen);
1815   render_container_user_settings settings;
1816
1817   render_container_get_user_settings(container, &settings);
18071818   if (buffer != NULL)
18081819   {
1809      render_container_set_brightness(container, (float)newval * 0.001f);
1810      sprintf(buffer, "%s Brightness %.3f", slider_get_screen_desc(screen), render_container_get_brightness(container));
1820      settings.brightness = (float)newval * 0.001f;
1821      render_container_set_user_settings(container, &settings);
1822      sprintf(buffer, "%s Brightness %.3f", slider_get_screen_desc(screen), settings.brightness);
18111823   }
1812   return floor(render_container_get_brightness(container) * 1000.0f + 0.5f);
1824   return floor(settings.brightness * 1000.0f + 0.5f);
18131825}
18141826
18151827
r2956r2957
18221834{
18231835   const device_config *screen = arg;
18241836   render_container *container = render_container_get_screen(screen);
1837   render_container_user_settings settings;
1838
1839   render_container_get_user_settings(container, &settings);
18251840   if (buffer != NULL)
18261841   {
1827      render_container_set_contrast(container, (float)newval * 0.001f);
1828      sprintf(buffer, "%s Contrast %.3f", slider_get_screen_desc(screen), render_container_get_contrast(container));
1842      settings.contrast = (float)newval * 0.001f;
1843      render_container_set_user_settings(container, &settings);
1844      sprintf(buffer, "%s Contrast %.3f", slider_get_screen_desc(screen), settings.contrast);
18291845   }
1830   return floor(render_container_get_contrast(container) * 1000.0f + 0.5f);
1846   return floor(settings.contrast * 1000.0f + 0.5f);
18311847}
18321848
18331849
r2956r2957
18391855{
18401856   const device_config *screen = arg;
18411857   render_container *container = render_container_get_screen(screen);
1858   render_container_user_settings settings;
1859
1860   render_container_get_user_settings(container, &settings);
18421861   if (buffer != NULL)
18431862   {
1844      render_container_set_gamma(container, (float)newval * 0.001f);
1845      sprintf(buffer, "%s Gamma %.3f", slider_get_screen_desc(screen), render_container_get_gamma(container));
1863      settings.gamma = (float)newval * 0.001f;
1864      render_container_set_user_settings(container, &settings);
1865      sprintf(buffer, "%s Gamma %.3f", slider_get_screen_desc(screen), settings.gamma);
18461866   }
1847   return floor(render_container_get_gamma(container) * 1000.0f + 0.5f);
1867   return floor(settings.gamma * 1000.0f + 0.5f);
18481868}
18491869
18501870
r2956r2957
18571877{
18581878   const device_config *screen = arg;
18591879   render_container *container = render_container_get_screen(screen);
1880   render_container_user_settings settings;
1881
1882   render_container_get_user_settings(container, &settings);
18601883   if (buffer != NULL)
18611884   {
1862      render_container_set_xscale(container, (float)newval * 0.001f);
1863      sprintf(buffer, "%s %s %.3f", slider_get_screen_desc(screen), "Horiz Stretch", render_container_get_xscale(container));
1885      settings.xscale = (float)newval * 0.001f;
1886      render_container_set_user_settings(container, &settings);
1887      sprintf(buffer, "%s %s %.3f", slider_get_screen_desc(screen), "Horiz Stretch", settings.xscale);
18641888   }
1865   return floor(render_container_get_xscale(container) * 1000.0f + 0.5f);
1889   return floor(settings.xscale * 1000.0f + 0.5f);
18661890}
18671891
18681892
r2956r2957
18751899{
18761900   const device_config *screen = arg;
18771901   render_container *container = render_container_get_screen(screen);
1902   render_container_user_settings settings;
1903
1904   render_container_get_user_settings(container, &settings);
18781905   if (buffer != NULL)
18791906   {
1880      render_container_set_yscale(container, (float)newval * 0.001f);
1881      sprintf(buffer, "%s %s %.3f", slider_get_screen_desc(screen), "Vert Stretch", render_container_get_yscale(container));
1907      settings.yscale = (float)newval * 0.001f;
1908      render_container_set_user_settings(container, &settings);
1909      sprintf(buffer, "%s %s %.3f", slider_get_screen_desc(screen), "Vert Stretch", settings.yscale);
18821910   }
1883   return floor(render_container_get_yscale(container) * 1000.0f + 0.5f);
1911   return floor(settings.yscale * 1000.0f + 0.5f);
18841912}
18851913
18861914
r2956r2957
18931921{
18941922   const device_config *screen = arg;
18951923   render_container *container = render_container_get_screen(screen);
1924   render_container_user_settings settings;
1925
1926   render_container_get_user_settings(container, &settings);
18961927   if (buffer != NULL)
18971928   {
1898      render_container_set_xoffset(container, (float)newval * 0.001f);
1899      sprintf(buffer, "%s %s %.3f", slider_get_screen_desc(screen), "Horiz Position", render_container_get_xoffset(container));
1929      settings.xoffset = (float)newval * 0.001f;
1930      render_container_set_user_settings(container, &settings);
1931      sprintf(buffer, "%s %s %.3f", slider_get_screen_desc(screen), "Horiz Position", settings.xoffset);
19001932   }
1901   return floor(render_container_get_xoffset(container) * 1000.0f + 0.5f);
1933   return floor(settings.xoffset * 1000.0f + 0.5f);
19021934}
19031935
19041936
r2956r2957
19111943{
19121944   const device_config *screen = arg;
19131945   render_container *container = render_container_get_screen(screen);
1946   render_container_user_settings settings;
1947
1948   render_container_get_user_settings(container, &settings);
19141949   if (buffer != NULL)
19151950   {
1916      render_container_set_yoffset(container, (float)newval * 0.001f);
1917      sprintf(buffer, "%s %s %.3f", slider_get_screen_desc(screen), "Vert Position", render_container_get_yoffset(container));
1951      settings.yoffset = (float)newval * 0.001f;
1952      render_container_set_user_settings(container, &settings);
1953      sprintf(buffer, "%s %s %.3f", slider_get_screen_desc(screen), "Vert Position", settings.yoffset);
19181954   }
1919   return floor(render_container_get_yoffset(container) * 1000.0f + 0.5f);
1955   return floor(settings.yoffset * 1000.0f + 0.5f);
19201956}
19211957
19221958
src/emu/ui.h
r2956r2957
136136int ui_is_slider_active(void);
137137
138138/* print the game info string into a buffer */
139int sprintf_game_info(running_machine *machine, char *buffer);
139astring *game_info_astring(running_machine *machine, astring *string);
140140
141141#endif   /* __USRINTRF_H__ */
src/emu/input.c
r2956r2957
937937
938938
939939/*-------------------------------------------------
940    input_code_from_input_item_id - translates
941    an input_item_id to an input_code
942-------------------------------------------------*/
943
944input_code input_code_from_input_item_id(input_item_id itemid)
945{
946   input_device_class devclass;
947
948   /* iterate over device classes and devices */
949   for (devclass = DEVICE_CLASS_INVALID + 1; devclass < DEVICE_CLASS_MAXIMUM; devclass++)
950   {
951      input_device_list *devlist = &device_list[devclass];
952      int devnum;
953
954      /* iterate over devices within each class */
955      for (devnum = 0; devnum < devlist->count; devnum++)
956      {
957         input_device *device = &devlist->list[devnum];
958         if (device->item[itemid] != NULL)
959            return device_item_to_code(device, itemid);
960      }
961   }
962   return 0;
963}
964
965
966/*-------------------------------------------------
940967    input_code_poll_switches - poll for any input
941968-------------------------------------------------*/
942969
src/emu/input.h
r2956r2957
609609/* same as above, but returns TRUE only on the first call after an off->on transition */
610610INT32 input_code_pressed_once(input_code code);
611611
612/* translates an input_item_id to an input_code */
613input_code input_code_from_input_item_id(input_item_id itemid);
614
612615/* poll for any switch input, optionally resetting internal memory */
613616input_code input_code_poll_switches(int reset);
614617
src/emu/render.c
r2956r2957
244244   { { 1,1 }, { 1,0 }, { 0,1 }, { 0,0 } }      /* ORIENTATION_SWAP_XY | ORIENTATION_FLIP_X | ORIENTATION_FLIP_Y */
245245};
246246
247/* layer orders */
248static const int layer_order_standard[] = { ITEM_LAYER_SCREEN, ITEM_LAYER_OVERLAY, ITEM_LAYER_BACKDROP, ITEM_LAYER_BEZEL };
249static const int layer_order_alternate[] = { ITEM_LAYER_BACKDROP, ITEM_LAYER_SCREEN, ITEM_LAYER_OVERLAY, ITEM_LAYER_BEZEL };
247250
248251
252
249253/***************************************************************************
250254    FUNCTION PROTOTYPES
251255***************************************************************************/
r2956r2957
461465
462466
463467/*-------------------------------------------------
468    get_layer_and_blendmode - return the
469    appropriate layer index and blendmode
470-------------------------------------------------*/
471
472INLINE int get_layer_and_blendmode(const layout_view *view, int index, int *blendmode)
473{
474    const int *layer_order = layer_order_standard;
475    int layer;
476
477   /*
478        if we have multiple backdrop pieces and no overlays, render:
479            backdrop (add) + screens (add) + bezels (alpha)
480        else render:
481            screens (add) + overlays (RGB multiply) + backdrop (add) + bezels (alpha)
482    */
483   if (view->itemlist[ITEM_LAYER_BACKDROP] != NULL && view->itemlist[ITEM_LAYER_BACKDROP]->next != NULL && view->itemlist[ITEM_LAYER_OVERLAY] == NULL)
484      layer_order = layer_order_alternate;
485
486   /* select the layer */
487   layer = layer_order[index];
488
489   /* if we want the blendmode as well, compute it */
490   if (blendmode != NULL)
491   {
492      /* pick a blendmode */
493      if (layer == ITEM_LAYER_SCREEN && layer_order == layer_order_standard)
494         *blendmode = -1;
495      else if (layer == ITEM_LAYER_SCREEN || (layer == ITEM_LAYER_BACKDROP && layer_order == layer_order_standard))
496         *blendmode = BLENDMODE_ADD;
497      else if (layer == ITEM_LAYER_OVERLAY)
498         *blendmode = BLENDMODE_RGB_MULTIPLY;
499      else
500         *blendmode = BLENDMODE_ALPHA;
501   }
502   return layer;
503}
504
505
506/*-------------------------------------------------
464507    get_screen_container_by_index - get the
465508    screen container for this screen index
466509-------------------------------------------------*/
r2956r2957
521564   {
522565      render_container *screen_container = render_container_alloc();
523566      render_container **temp = &screen_container->next;
567      render_container_user_settings settings;
524568
525      render_container_set_orientation(screen_container, machine->gamedrv->flags & ORIENTATION_MASK);
526      render_container_set_brightness(screen_container, options_get_float(mame_options(), OPTION_BRIGHTNESS));
527      render_container_set_contrast(screen_container, options_get_float(mame_options(), OPTION_CONTRAST));
528      render_container_set_gamma(screen_container, options_get_float(mame_options(), OPTION_GAMMA));
569      /* set the initial orientation and brightness/contrast/gamma */
570      render_container_get_user_settings(screen_container, &settings);
571      settings.orientation = machine->gamedrv->flags & ORIENTATION_MASK;
572      settings.brightness = options_get_float(mame_options(), OPTION_BRIGHTNESS);
573      settings.contrast = options_get_float(mame_options(), OPTION_CONTRAST);
574      settings.gamma = options_get_float(mame_options(), OPTION_GAMMA);
575      render_container_set_user_settings(screen_container, &settings);
576
529577      screen_container->screen = screen;
530578
531579      /* link it up */
r2956r2957
703751
704752            /* apply the opposite orientation to the UI */
705753            if (target == render_get_ui_target())
706               render_container_set_orientation(ui_container, orientation_add(orientation_reverse(tmpint), ui_container->orientation));
754            {
755               render_container_user_settings settings;
756
757               render_container_get_user_settings(ui_container, &settings);
758               settings.orientation = orientation_add(orientation_reverse(tmpint), settings.orientation);
759               render_container_set_user_settings(ui_container, &settings);
760            }
707761         }
708762      }
709763   }
r2956r2957
713767   {
714768      int index = xml_get_attribute_int(screennode, "index", -1);
715769      render_container *container = get_screen_container_by_index(index);
770      render_container_user_settings settings;
716771
772      /* fetch current settings */
773      render_container_get_user_settings(container, &settings);
774
717775      /* fetch color controls */
718      render_container_set_brightness(container, xml_get_attribute_float(screennode, "brightness", container->brightness));
719      render_container_set_contrast(container, xml_get_attribute_float(screennode, "contrast", container->contrast));
720      render_container_set_gamma(container, xml_get_attribute_float(screennode, "gamma", container->gamma));
776      settings.brightness = xml_get_attribute_float(screennode, "brightness", settings.brightness);
777      settings.contrast = xml_get_attribute_float(screennode, "contrast", settings.contrast);
778      settings.gamma = xml_get_attribute_float(screennode, "gamma", settings.gamma);
721779
722780      /* fetch positioning controls */
723      render_container_set_xoffset(container, xml_get_attribute_float(screennode, "hoffset", container->xoffset));
724      render_container_set_xscale(container, xml_get_attribute_float(screennode, "hstretch", container->xscale));
725      render_container_set_yoffset(container, xml_get_attribute_float(screennode, "voffset", container->yoffset));
726      render_container_set_yscale(container, xml_get_attribute_float(screennode, "vstretch", container->yscale));
781      settings.xoffset = xml_get_attribute_float(screennode, "hoffset", settings.xoffset);
782      settings.xscale = xml_get_attribute_float(screennode, "hstretch", settings.xscale);
783      settings.yoffset = xml_get_attribute_float(screennode, "voffset", settings.yoffset);
784      settings.yscale = xml_get_attribute_float(screennode, "vstretch", settings.yscale);
785
786      /* set the new values */
787      render_container_set_user_settings(container, &settings);
727788   }
728789}
729790
r2956r2957
14791540
14801541const render_primitive_list *render_target_get_primitives(render_target *target)
14811542{
1482   static const int standard_order[] = { ITEM_LAYER_SCREEN, ITEM_LAYER_OVERLAY, ITEM_LAYER_BACKDROP, ITEM_LAYER_BEZEL };
1483   static const int alternate_order[] = { ITEM_LAYER_BACKDROP, ITEM_LAYER_SCREEN, ITEM_LAYER_OVERLAY, ITEM_LAYER_BEZEL };
14841543   object_transform root_xform, ui_xform;
14851544   int itemcount[ITEM_LAYER_MAX];
1486   const int *layer_order;
14871545   INT32 viswidth, visheight;
14881546   int layernum, listnum;
14891547
r2956r2957
15101568   root_xform.color.r = root_xform.color.g = root_xform.color.b = root_xform.color.a = 1.0f;
15111569   root_xform.orientation = target->orientation;
15121570
1513   /*
1514        if we have multiple backdrop pieces and no overlays, render:
1515            backdrop (add) + screens (add) + bezels (alpha)
1516        else render:
1517            screens (add) + overlays (RGB multiply) + backdrop (add) + bezels (alpha)
1518    */
1519   layer_order = standard_order;
1520   if (target->curview->itemlist[ITEM_LAYER_BACKDROP] != NULL &&
1521      target->curview->itemlist[ITEM_LAYER_BACKDROP]->next != NULL &&
1522      target->curview->itemlist[ITEM_LAYER_OVERLAY] == NULL)
1523      layer_order = alternate_order;
1524
15251571   /* iterate over layers back-to-front, but only if we're running */
15261572   if (mame_get_phase(Machine) >= MAME_PHASE_RESET)
15271573      for (layernum = 0; layernum < ITEM_LAYER_MAX; layernum++)
15281574      {
1529         int layer = layer_order[layernum];
1575         int blendmode;
1576         int layer = get_layer_and_blendmode(target->curview, layernum, &blendmode);
1577
15301578         if (target->curview->layenabled[layer])
15311579         {
1532            int blendmode = BLENDMODE_ALPHA;
15331580            view_item *item;
15341581
1535            /* pick a blendmode */
1536            if (layer == ITEM_LAYER_SCREEN && layer_order == standard_order)
1537               blendmode = -1;
1538            else if (layer == ITEM_LAYER_SCREEN || (layer == ITEM_LAYER_BACKDROP && layer_order == standard_order))
1539               blendmode = BLENDMODE_ADD;
1540            else if (layer == ITEM_LAYER_OVERLAY)
1541               blendmode = BLENDMODE_RGB_MULTIPLY;
1542
15431582            /* iterate over items in the layer */
15441583            itemcount[layer] = 0;
15451584            for (item = target->curview->itemlist[layer]; item != NULL; item = item->next)
r2956r2957
15661605               /* if there is no associated element, it must be a screen element */
15671606               if (item->element != NULL)
15681607               {
1569                  int state = (item->name[0] == 0) ? 0 : output_get_value(item->name);
1608                  int state = 0;
1609                  if (item->name[0] != '\0')
1610                     state = output_get_value(item->name);
1611
15701612                  add_element_primitives(target, &target->primlist[listnum], &item_xform, item->element, state, blendmode);
15711613               }
15721614               else
r2956r2957
16271669
16281670
16291671/*-------------------------------------------------
1672    render_target_map_point_internal - internal
1673    logic for mapping points
1674-------------------------------------------------*/
1675
1676static int render_target_map_point_internal(render_target *target, INT32 target_x, INT32 target_y,
1677   render_container *container, const char *input_tag, UINT32 input_mask, float *mapped_x, float *mapped_y)
1678{
1679   int layernum;
1680   view_item *item;
1681   float target_fx, target_fy;
1682   float dummy;
1683   int hit;
1684
1685   /* sanity check */
1686   if (mapped_x == NULL)
1687      mapped_x = &dummy;
1688   if (mapped_y == NULL)
1689      mapped_y = &dummy;
1690
1691   /* convert target coordinates to float */
1692   target_fx = (float)target_x / target->width;
1693   target_fy = (float)target_y / target->height;
1694
1695   if (container != NULL && container == ui_container)
1696   {
1697      /* this hit test went against the UI container */
1698      if (target_fx >= 0.0 && target_fx < 1.0 && target_fy >= 0.0 && target_fy < 1.0)
1699      {
1700         /* this point was successfully mapped */
1701         *mapped_x = target_fx;
1702         *mapped_y = target_fy;
1703         return TRUE;
1704      }
1705   }
1706   else
1707   {
1708      /* loop through each layer */
1709      for (layernum = 0; layernum < ITEM_LAYER_MAX; layernum++)
1710      {
1711         int layer = get_layer_and_blendmode(target->curview, layernum, NULL);
1712         if (target->curview->layenabled[layer])
1713         {
1714            /* iterate over items in the layer */
1715            for (item = target->curview->itemlist[layer]; item != NULL; item = item->next)
1716            {
1717               /* perform the hit test */
1718               if (item->element == NULL && container != NULL)
1719                  hit = (container == get_screen_container_by_index(item->index));
1720               else
1721                  hit = FALSE;
1722
1723               /* is this item the container in which we are interested? */
1724               if (hit)
1725               {
1726                  /* this target contains the specified container; now check the point */
1727                  if (target_fx >= item->bounds.x0 && target_fx < item->bounds.x1 && target_fy >= item->bounds.y0 && target_fy < item->bounds.y1)
1728                  {
1729                     /* point successfully mapped */
1730                     *mapped_x = (target_fx - item->bounds.x0) / (item->bounds.x1 - item->bounds.x0);
1731                     *mapped_y = (target_fy - item->bounds.y0) / (item->bounds.y1 - item->bounds.y0);
1732                     return TRUE;
1733                  }
1734               }
1735            }
1736         }
1737      }
1738   }
1739
1740   /* point not mapped */
1741   *mapped_x = -1.0;
1742   *mapped_y = -1.0;
1743   return FALSE;
1744}
1745
1746
1747/*-------------------------------------------------
1748    render_target_map_point_container - attempts to
1749    map a point on the specified render_target to
1750    the specified container, if possible
1751-------------------------------------------------*/
1752
1753int render_target_map_point_container(render_target *target, INT32 target_x, INT32 target_y, render_container *container, float *container_x, float *container_y)
1754{
1755   return render_target_map_point_internal(target, target_x, target_y, container, NULL, 0, container_x, container_y);
1756}
1757
1758
1759/*-------------------------------------------------
16301760    load_layout_files - load layout files for a
16311761    given render target
16321762-------------------------------------------------*/
r2956r2957
25792709
25802710
25812711/*-------------------------------------------------
2582    render_container_get_orientation - return the
2583    orientation of a container
2712    render_container_get_user_settings - get the
2713    current user settings for a container
25842714-------------------------------------------------*/
25852715
2586int render_container_get_orientation(render_container *container)
2716void render_container_get_user_settings(render_container *container, render_container_user_settings *settings)
25872717{
2588   return container->orientation;
2718   settings->orientation = container->orientation;
2719   settings->brightness = container->brightness;
2720   settings->contrast = container->contrast;
2721   settings->gamma = container->gamma;
2722   settings->xscale = container->xscale;
2723   settings->yscale = container->yscale;
2724   settings->xoffset = container->xoffset;
2725   settings->yoffset = container->yoffset;
25892726}
25902727
25912728
25922729/*-------------------------------------------------
2593    render_container_set_orientation - set the
2594    orientation of a container
2730    render_container_set_user_settings - set the
2731    current user settings for a container
25952732-------------------------------------------------*/
25962733
2597void render_container_set_orientation(render_container *container, int orientation)
2734void render_container_set_user_settings(render_container *container, const render_container_user_settings *settings)
25982735{
2599   container->orientation = orientation;
2600}
2601
2602
2603/*-------------------------------------------------
2604    render_container_get_brightness - return the
2605    brightness of a container
2606-------------------------------------------------*/
2607
2608float render_container_get_brightness(render_container *container)
2609{
2610   return container->brightness;
2611}
2612
2613
2614/*-------------------------------------------------
2615    render_container_set_brightness - set the
2616    brightness of a container
2617-------------------------------------------------*/
2618
2619void render_container_set_brightness(render_container *container, float brightness)
2620{
2621   container->brightness = brightness;
2736   container->orientation = settings->orientation;
2737   container->brightness = settings->brightness;
2738   container->contrast = settings->contrast;
2739   container->gamma = settings->gamma;
2740   container->xscale = settings->xscale;
2741   container->yscale = settings->yscale;
2742   container->xoffset = settings->xoffset;
2743   container->yoffset = settings->yoffset;
26222744   render_container_recompute_lookups(container);
26232745}
26242746
26252747
26262748/*-------------------------------------------------
2627    render_container_get_contrast - return the
2628    contrast of a container
2629-------------------------------------------------*/
2630
2631float render_container_get_contrast(render_container *container)
2632{
2633   return container->contrast;
2634}
2635
2636
2637/*-------------------------------------------------
2638    render_container_set_contrast - set the
2639    contrast of a container
2640-------------------------------------------------*/
2641
2642void render_container_set_contrast(render_container *container, float contrast)
2643{
2644   container->contrast = contrast;
2645   render_container_recompute_lookups(container);
2646}
2647
2648
2649/*-------------------------------------------------
2650    render_container_get_gamma - return the
2651    gamma of a container
2652-------------------------------------------------*/
2653
2654float render_container_get_gamma(render_container *container)
2655{
2656   return container->gamma;
2657}
2658
2659
2660/*-------------------------------------------------
2661    render_container_set_gamma - set the
2662    gamma of a container
2663-------------------------------------------------*/
2664
2665void render_container_set_gamma(render_container *container, float gamma)
2666{
2667   container->gamma = gamma;
2668   render_container_recompute_lookups(container);
2669}
2670
2671
2672/*-------------------------------------------------
2673    render_container_get_xscale - return the
2674    X scale of a container
2675-------------------------------------------------*/
2676
2677float render_container_get_xscale(render_container *container)
2678{
2679   return container->xscale;
2680}
2681
2682
2683/*-------------------------------------------------
2684    render_container_set_xscale - set the
2685    X scale of a container
2686-------------------------------------------------*/
2687
2688void render_container_set_xscale(render_container *container, float xscale)
2689{
2690   container->xscale = xscale;
2691}
2692
2693
2694/*-------------------------------------------------
2695    render_container_get_yscale - return the
2696    X scale of a container
2697-------------------------------------------------*/
2698
2699float render_container_get_yscale(render_container *container)
2700{
2701   return container->yscale;
2702}
2703
2704
2705/*-------------------------------------------------
2706    render_container_set_yscale - set the
2707    X scale of a container
2708-------------------------------------------------*/
2709
2710void render_container_set_yscale(render_container *container, float yscale)
2711{
2712   container->yscale = yscale;
2713}
2714
2715
2716/*-------------------------------------------------
2717    render_container_get_xoffset - return the
2718    X offset of a container
2719-------------------------------------------------*/
2720
2721float render_container_get_xoffset(render_container *container)
2722{
2723   return container->xoffset;
2724}
2725
2726
2727/*-------------------------------------------------
2728    render_container_set_xoffset - set the
2729    X offset of a container
2730-------------------------------------------------*/
2731
2732void render_container_set_xoffset(render_container *container, float xoffset)
2733{
2734   container->xoffset = xoffset;
2735}
2736
2737
2738/*-------------------------------------------------
2739    render_container_get_yoffset - return the
2740    X offset of a container
2741-------------------------------------------------*/
2742
2743float render_container_get_yoffset(render_container *container)
2744{
2745   return container->yoffset;
2746}
2747
2748
2749/*-------------------------------------------------
2750    render_container_set_yoffset - set the
2751    X offset of a container
2752-------------------------------------------------*/
2753
2754void render_container_set_yoffset(render_container *container, float yoffset)
2755{
2756   container->yoffset = yoffset;
2757}
2758
2759
2760/*-------------------------------------------------
27612749    render_container_set_overlay - set the
27622750    overlay bitmap for the container
27632751-------------------------------------------------*/
src/emu/cheat.c
r2956r2957
1111
1212#include "driver.h"
1313#include "ui.h"
14#include "uiinput.h"
1415#include "uimenu.h"
1516#include "machine/eeprom.h"
1617#include "cheat.h"
r2956r2957
16631664         last_code = -1;
16641665   }
16651666
1666   return input_ui_pressed_repeat(machine, code, last_speed);
1667   return ui_input_pressed_repeat(machine, code, last_speed);
16671668}
16681669
16691670/*-----------------------------------
r2956r2957
17841785      data >>= 4;
17851786      return data;
17861787   }
1787   else if(input_ui_pressed(machine, IPT_UI_CLEAR))
1788   else if(ui_input_pressed(machine, IPT_UI_CLEAR))
17881789   {
17891790      /* data clear */
17901791      data = 0;
r2956r2957
26602661            display_value = decimal_to_bcd(bcd_to_decimal(display_value));
26612662      }
26622663   }
2663   else if(input_ui_pressed(machine, IPT_UI_SELECT))
2664   else if(ui_input_pressed(machine, IPT_UI_SELECT))
26642665   {
26652666      int i;
26662667
r2956r2957
27162717
27172718      menu->sel = -1;
27182719   }
2719   else if(input_ui_pressed(machine, IPT_UI_EDIT_CHEAT))
2720   else if(ui_input_pressed(machine, IPT_UI_EDIT_CHEAT))
27202721   {
27212722      edit_active ^= 1;
27222723      edit_cursor = 0;
27232724   }
2724   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
2725   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
27252726   {
27262727      if(edit_active)      edit_active = 0;
27272728      else            menu->sel = -1;
r2956r2957
28252826   {
28262827      CURSOR_PAGE_DOWN(menu->sel, total);
28272828   }
2828   else if(input_ui_pressed(machine, IPT_UI_SELECT))
2829   else if(ui_input_pressed(machine, IPT_UI_SELECT))
28292830   {
28302831      if(menu->sel != total - 1)
28312832      {
r2956r2957
28442845      else
28452846         menu->sel = -1;
28462847   }
2847   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
2848   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
28482849      menu->sel = -1;
28492850
28502851   return menu->sel + 1;
r2956r2957
28722873   ui_draw_message_window(buf);
28732874
28742875   /********** KEY HANDLING **********/
2875   if(input_ui_pressed(machine, IPT_UI_SELECT) || input_ui_pressed(machine, IPT_UI_CANCEL))
2876   if(ui_input_pressed(machine, IPT_UI_SELECT) || ui_input_pressed(machine, IPT_UI_CANCEL))
28762877      menu->sel = -1;
28772878
28782879   return menu->sel + 1;
r2956r2957
29422943   {
29432944      CURSOR_PAGE_DOWN(menu->sel, total);
29442945   }
2945   else if(input_ui_pressed(machine, IPT_UI_SELECT) || input_ui_pressed(machine, IPT_UI_CANCEL))
2946   else if(ui_input_pressed(machine, IPT_UI_SELECT) || ui_input_pressed(machine, IPT_UI_CANCEL))
29462947      menu->sel = -1;
29472948
29482949   return menu->sel + 1;
r2956r2957
30333034   {
30343035      CURSOR_PAGE_DOWN(menu->sel, total);
30353036   }
3036   else if(input_ui_pressed(machine, IPT_UI_SELECT))
3037   else if(ui_input_pressed(machine, IPT_UI_SELECT))
30373038   {
30383039      switch(menu->sel)
30393040      {
r2956r2957
30743075            menu->sel = -1;
30753076      }
30763077   }
3077   else if(input_ui_pressed(machine, IPT_UI_RELOAD_CHEAT))
3078   else if(ui_input_pressed(machine, IPT_UI_RELOAD_CHEAT))
30783079   {
30793080      if(shift_key_pressed())
30803081         reset_cheat_options();
r2956r2957
30833084      else
30843085         reload_cheat_database(machine);
30853086   }
3086   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
3087   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
30873088   {
30883089      menu->sel = -1;
30893090   }
r2956r2957
33583359   {
33593360      do_select = 1;
33603361   }
3361   if(input_ui_pressed(machine, IPT_UI_SELECT))
3362   if(ui_input_pressed(machine, IPT_UI_SELECT))
33623363   {
33633364      if(entry == NULL)
33643365      {
r2956r2957
33823383            do_select = 1;
33833384      }
33843385   }
3385   else if(input_ui_pressed(machine, IPT_UI_SAVE_CHEAT))
3386   else if(ui_input_pressed(machine, IPT_UI_SAVE_CHEAT))
33863387   {
33873388      if(shift_key_pressed())
33883389      {
r2956r2957
34033404         save_pre_enable(machine, entry, info->sub_cheat);
34043405      }
34053406   }
3406   else if(input_ui_pressed(machine, IPT_UI_ADD_CHEAT))
3407   else if(ui_input_pressed(machine, IPT_UI_ADD_CHEAT))
34073408   {
34083409      add_cheat_before(info->sub_cheat);
34093410   }
3410   else if(input_ui_pressed(machine, IPT_UI_DELETE_CHEAT))
3411   else if(ui_input_pressed(machine, IPT_UI_DELETE_CHEAT))
34113412   {
34123413      if(entry)   delete_cheat_at(info->sub_cheat);
34133414      else      SET_MESSAGE(CHEAT_MESSAGE_FAILED_TO_DELETE);
34143415   }
3415   else if(input_ui_pressed(machine, IPT_UI_EDIT_CHEAT))
3416   else if(ui_input_pressed(machine, IPT_UI_EDIT_CHEAT))
34163417   {
34173418      if(entry) cheat_menu_stack_push(command_add_edit_menu, menu->handler, info->sub_cheat);
34183419   }
3419   else if(input_ui_pressed(machine, IPT_UI_WATCH_VALUE))
3420   else if(ui_input_pressed(machine, IPT_UI_WATCH_VALUE))
34203421   {
34213422      watch_cheat_entry(entry, 0);
34223423   }
3423   else if(input_ui_pressed(machine, IPT_UI_RELOAD_CHEAT))
3424   else if(ui_input_pressed(machine, IPT_UI_RELOAD_CHEAT))
34243425   {
34253426      reload_cheat_database(machine);
34263427   }
3427   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
3428   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
34283429   {
34293430      /* NOTE : cancel button return cheat main menu directly */
34303431      menu->sel = -1;
r2956r2957
35403541   {
35413542      CURSOR_PAGE_DOWN(menu->sel, total);
35423543   }
3543   else if(input_ui_pressed(machine, IPT_UI_SELECT))
3544   else if(ui_input_pressed(machine, IPT_UI_SELECT))
35443545   {
35453546      if(entry)
35463547      {
r2956r2957
35543555      else
35553556         menu->sel = -1;
35563557   }
3557   else if(input_ui_pressed(machine, IPT_UI_RELOAD_CHEAT))
3558   else if(ui_input_pressed(machine, IPT_UI_RELOAD_CHEAT))
35583559   {
35593560      reload_cheat_database(machine);
35603561   }
3561   else if(input_ui_pressed(machine, IPT_UI_EDIT_CHEAT))
3562   else if(ui_input_pressed(machine, IPT_UI_EDIT_CHEAT))
35623563   {
35633564      if(entry)
35643565      {
r2956r2957
35703571            cheat_menu_stack_push(command_add_edit_menu, menu->handler, menu->sel);
35713572      }
35723573   }
3573   else if(input_ui_pressed(machine, IPT_UI_ADD_CHEAT))
3574   else if(ui_input_pressed(machine, IPT_UI_ADD_CHEAT))
35743575   {
35753576      add_cheat_before(menu->sel);
35763577   }
3577   else if(input_ui_pressed(machine, IPT_UI_DELETE_CHEAT))
3578   else if(ui_input_pressed(machine, IPT_UI_DELETE_CHEAT))
35783579   {
35793580      delete_cheat_at(menu->sel);
35803581   }
3581   else if(input_ui_pressed(machine, IPT_UI_SAVE_CHEAT))
3582   else if(ui_input_pressed(machine, IPT_UI_SAVE_CHEAT))
35823583   {
35833584      if(shift_key_pressed())
35843585      {
r2956r2957
36043605         save_cheat_code(machine, entry);
36053606      }
36063607   }
3607   else if(input_ui_pressed(machine, IPT_UI_WATCH_VALUE))
3608   else if(ui_input_pressed(machine, IPT_UI_WATCH_VALUE))
36083609   {
36093610      watch_cheat_entry(entry, 0);
36103611   }
3611   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
3612   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
36123613   {
36133614      menu->sel = -1;
36143615   }
r2956r2957
36963697   {
36973698      CURSOR_PAGE_DOWN(menu->sel, total);
36983699   }
3699   else if(input_ui_pressed(machine, IPT_UI_SELECT))
3700   else if(ui_input_pressed(machine, IPT_UI_SELECT))
37003701   {
37013702      switch(menu->sel)
37023703      {
r2956r2957
37783779            break;
37793780      }
37803781   }
3781   else if(input_ui_pressed(machine, IPT_UI_RELOAD_CHEAT))
3782   else if(ui_input_pressed(machine, IPT_UI_RELOAD_CHEAT))
37823783   {
37833784      reload_cheat_database(machine);
37843785   }
3785   else if(input_ui_pressed(machine, IPT_UI_CANCEL) || input_ui_pressed(machine, IPT_UI_LEFT) || input_ui_pressed(machine, IPT_UI_RIGHT))
3786   else if(ui_input_pressed(machine, IPT_UI_CANCEL) || ui_input_pressed(machine, IPT_UI_LEFT) || ui_input_pressed(machine, IPT_UI_RIGHT))
37863787   {
37873788      menu->sel = -1;
37883789   }
r2956r2957
41604161   {
41614162      do_select = -1;
41624163   }
4163   else if(input_ui_pressed(machine, IPT_UI_SELECT))
4164   else if(ui_input_pressed(machine, IPT_UI_SELECT))
41644165   {
41654166      if(edit_active)
41664167         edit_active = 0;
r2956r2957
41794180         }
41804181      }
41814182   }
4182   else if(input_ui_pressed(machine, IPT_UI_ADD_CHEAT))
4183   else if(ui_input_pressed(machine, IPT_UI_ADD_CHEAT))
41834184   {
41844185      add_action_before(entry, info->sub_cheat);
41854186
r2956r2957
41944195         else      SET_MASK_FIELD(action->type, LinkEnable);
41954196      }
41964197   }
4197   else if(input_ui_pressed(machine, IPT_UI_DELETE_CHEAT))
4198   else if(ui_input_pressed(machine, IPT_UI_DELETE_CHEAT))
41984199   {
41994200      delete_action_at(entry, info->sub_cheat);
42004201   }
4201   else if(input_ui_pressed(machine, IPT_UI_WATCH_VALUE))
4202   else if(ui_input_pressed(machine, IPT_UI_WATCH_VALUE))
42024203   {
42034204      watch_cheat_entry(entry, 0);
42044205   }
4205   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
4206   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
42064207   {
42074208      if(edit_active)      edit_active = 0;
42084209      else            menu->sel = -1;
r2956r2957
47344735      if(edit_active == 0)
47354736         CURSOR_PAGE_DOWN(menu->sel, total);
47364737   }
4737   else if(input_ui_pressed(machine, IPT_UI_SELECT))
4738   else if(ui_input_pressed(machine, IPT_UI_SELECT))
47384739   {
47394740      if(edit_active)
47404741         edit_active = 0;
r2956r2957
47544755         }
47554756      }
47564757   }
4757   else if(input_ui_pressed(machine, IPT_UI_SAVE_CHEAT))
4758   else if(ui_input_pressed(machine, IPT_UI_SAVE_CHEAT))
47584759   {
47594760      save_cheat_code(machine, entry);
47604761   }
4761   else if(input_ui_pressed(machine, IPT_UI_WATCH_VALUE))
4762   else if(ui_input_pressed(machine, IPT_UI_WATCH_VALUE))
47624763   {
47634764      watch_cheat_entry(entry, 0);
47644765   }
4765   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
4766   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
47664767   {
47674768      if(edit_active)         edit_active = 0;
47684769      else               menu->sel = -1;
r2956r2957
49404941   {
49414942      CURSOR_PAGE_DOWN(menu->sel, total);
49424943   }
4943   else if(input_ui_pressed(machine, IPT_UI_EDIT_CHEAT))
4944   else if(ui_input_pressed(machine, IPT_UI_EDIT_CHEAT))
49444945   {
49454946      is_edit = 1;
49464947   }
4947   else if(input_ui_pressed(machine, IPT_UI_SELECT))
4948   else if(ui_input_pressed(machine, IPT_UI_SELECT))
49484949   {
49494950      if(menu->sel == total - 2)
49504951         is_edit = 1;
49514952      else
49524953         menu->sel = -1;
49534954   }
4954   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
4955   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
49554956   {
49564957      menu->sel = -1;
49574958   }
r2956r2957
53785379      else
53795380         do_increment = 1;
53805381   }
5381   else if(input_ui_pressed(machine, IPT_UI_SELECT))
5382   else if(ui_input_pressed(machine, IPT_UI_SELECT))
53825383   {
53835384      if(edit_active)
53845385      {
r2956r2957
54405441         }
54415442      }
54425443   }
5443   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
5444   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
54445445   {
54455446      if(edit_active)   edit_active = 0;
54465447      else         menu->sel = -1;
r2956r2957
57255726         do_reallocate = 1;
57265727      }
57275728   }
5728   else if(input_ui_pressed(machine, IPT_UI_DELETE_CHEAT))
5729   else if(ui_input_pressed(machine, IPT_UI_DELETE_CHEAT))
57295730   {
57305731      if(shift_key_pressed() && region && search)
57315732      {
r2956r2957
57335734         invalidate_entire_region(search, region);
57345735      }
57355736   }
5736   else if(input_ui_pressed(machine, IPT_UI_RELOAD_CHEAT))
5737   else if(ui_input_pressed(machine, IPT_UI_RELOAD_CHEAT))
57375738   {
57385739      if(search->search_speed == SEARCH_SPEED_USER_DEFINED)
57395740      /* reload user region */
57405741         do_rebuild = 1;
57415742         do_reallocate = 1;
57425743   }
5743   else if(input_ui_pressed(machine, IPT_UI_SELECT))
5744   else if(ui_input_pressed(machine, IPT_UI_SELECT))
57445745   {
57455746      if(region)
57465747      {
r2956r2957
57555756      else if(menu->sel == total - 1)
57565757         menu->sel = -1;
57575758   }
5758   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
5759   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
57595760      menu->sel = -1;
57605761
57615762   /********** REBUILD SEARCH REGION **********/
r2956r2957
60496050
60506051      menu->sel = kMenu_FirstResult;
60516052   }
6052   else if(input_ui_pressed(machine, IPT_UI_ADD_CHEAT))
6053   else if(ui_input_pressed(machine, IPT_UI_ADD_CHEAT))
60536054   {
60546055      if(selectedAddressGood)
60556056         add_cheat_from_result(machine, search, region, selectedAddress);
60566057   }
6057   else if(input_ui_pressed(machine, IPT_UI_DELETE_CHEAT))
6058   else if(ui_input_pressed(machine, IPT_UI_DELETE_CHEAT))
60586059   {
60596060      if(shift_key_pressed())
60606061      {
r2956r2957
60726073         SET_MESSAGE(CHEAT_MESSAGE_SUCCEEDED_TO_DELETE);
60736074      }
60746075   }
6075   else if(input_ui_pressed(machine, IPT_UI_WATCH_VALUE))
6076   else if(ui_input_pressed(machine, IPT_UI_WATCH_VALUE))
60766077   {
60776078      if(selectedAddressGood)
60786079         add_watch_from_result(search, region, selectedAddress);
60796080   }
6080   else if(input_ui_pressed(machine, IPT_UI_SELECT) || input_ui_pressed(machine, IPT_UI_CANCEL))
6081   else if(ui_input_pressed(machine, IPT_UI_SELECT) || ui_input_pressed(machine, IPT_UI_CANCEL))
60816082      menu->sel = -1;
60826083
60836084   switch(pageSwitch)
r2956r2957
63216322            edit_cursor = info->address_chars_needed + 1;
63226323      }
63236324   }
6324   else if(input_ui_pressed(machine, IPT_UI_SELECT))
6325   else if(ui_input_pressed(machine, IPT_UI_SELECT))
63256326   {
63266327      if(edit_active)
63276328         edit_active = 0;
r2956r2957
63336334            menu->sel = -1;
63346335      }
63356336   }
6336   else if(input_ui_pressed(machine, IPT_UI_ADD_CHEAT))
6337   else if(ui_input_pressed(machine, IPT_UI_ADD_CHEAT))
63376338   {
63386339      if(!edit_active && watch)
63396340      {
r2956r2957
63566357            add_watch_before(menu->sel);
63576358      }
63586359   }
6359   else if(input_ui_pressed(machine, IPT_UI_DELETE_CHEAT))
6360   else if(ui_input_pressed(machine, IPT_UI_DELETE_CHEAT))
63606361   {
63616362      if(!edit_active && watch)
63626363      {
r2956r2957
63926393         }
63936394      }
63946395   }
6395   else if(input_ui_pressed(machine, IPT_UI_SAVE_CHEAT))
6396   else if(ui_input_pressed(machine, IPT_UI_SAVE_CHEAT))
63966397   {
63976398      if(!edit_active && watch)
63986399      {
r2956r2957
64056406         dispose_cheat(&entry);
64066407      }
64076408   }
6408   else if(input_ui_pressed(machine, IPT_UI_EDIT_CHEAT))
6409   else if(ui_input_pressed(machine, IPT_UI_EDIT_CHEAT))
64096410   {
64106411      if(watch)
64116412      {
r2956r2957
64136414         edit_active ^= 1;
64146415      }
64156416   }
6416   else if(input_ui_pressed(machine, IPT_UI_CLEAR))
6417   else if(ui_input_pressed(machine, IPT_UI_CLEAR))
64176418   {
64186419      if(!edit_active)
64196420      {
r2956r2957
64346435         watch->element_bytes = 0;
64356436      }
64366437   }
6437   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
6438   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
64386439   {
64396440      if(edit_active)
64406441         edit_active = 0;
r2956r2957
65156516   {
65166517      CURSOR_PAGE_DOWN(menu->sel, total);
65176518   }
6518   else if(input_ui_pressed(machine, IPT_UI_SELECT))
6519   else if(ui_input_pressed(machine, IPT_UI_SELECT))
65196520   {
65206521      switch(menu->sel)
65216522      {
r2956r2957
65806581            menu->sel = -1;
65816582      }
65826583   }
6583   else if(input_ui_pressed(machine, IPT_UI_RELOAD_CHEAT))
6584   else if(ui_input_pressed(machine, IPT_UI_RELOAD_CHEAT))
65846585   {
65856586      reload_cheat_database(machine);
65866587   }
6587   else if(input_ui_pressed(machine, IPT_UI_CANCEL) || input_ui_pressed(machine, IPT_UI_LEFT) || input_ui_pressed(machine, IPT_UI_RIGHT))
6588   else if(ui_input_pressed(machine, IPT_UI_CANCEL) || ui_input_pressed(machine, IPT_UI_LEFT) || ui_input_pressed(machine, IPT_UI_RIGHT))
65886589   {
65896590      menu->sel = -1;
65906591   }
r2956r2957
69646965         }
69656966      }
69666967   }
6967   else if(input_ui_pressed(machine, IPT_UI_SELECT))
6968   else if(ui_input_pressed(machine, IPT_UI_SELECT))
69686969   {
69696970      if(edit_active)
69706971         edit_active = 0;
r2956r2957
69916992         }
69926993      }
69936994   }
6994   else if(input_ui_pressed(machine, IPT_UI_CLEAR))
6995   else if(ui_input_pressed(machine, IPT_UI_CLEAR))
69956996   {
69966997      reset_watch(entry);
69976998   }
6998   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
6999   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
69997000   {
70007001      if(edit_active)
70017002         edit_active = 0;
r2956r2957
70557056   }
70567057   else
70577058   {
7058      if(input_ui_pressed(machine, IPT_UI_ADD_CHEAT))
7059      if(ui_input_pressed(machine, IPT_UI_ADD_CHEAT))
70597060         add_cheat_from_watch(machine, entry);
70607061
7061      if(input_ui_pressed(machine, IPT_UI_DELETE_CHEAT))
7062      if(ui_input_pressed(machine, IPT_UI_DELETE_CHEAT))
70627063         entry->num_elements = 0;
70637064
7064      if(input_ui_pressed(machine, IPT_UI_SAVE_CHEAT))
7065      if(ui_input_pressed(machine, IPT_UI_SAVE_CHEAT))
70657066      {
70667067         cheat_entry temp_entry;
70677068
r2956r2957
72307231   {
72317232      do_select = 1;
72327233   }
7233   else if(input_ui_pressed(machine, IPT_UI_SELECT))
7234   else if(ui_input_pressed(machine, IPT_UI_SELECT))
72347235   {
72357236      switch(menu->sel)
72367237      {
r2956r2957
72587259            break;
72597260      }
72607261   }
7261   else if(input_ui_pressed(machine, IPT_UI_SAVE_CHEAT))
7262   else if(ui_input_pressed(machine, IPT_UI_SAVE_CHEAT))
72627263   {
72637264      save_cheat_options();
72647265   }
7265   else if(input_ui_pressed(machine, IPT_UI_RELOAD_CHEAT))
7266   else if(ui_input_pressed(machine, IPT_UI_RELOAD_CHEAT))
72667267   {
72677268      if(shift_key_pressed())
72687269         reset_cheat_options();
72697270      else
72707271         load_cheat_database(machine, LOAD_CHEAT_OPTIONS);
72717272   }
7272   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
7273   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
72737274   {
72747275      menu->sel = -1;
72757276   }
r2956r2957
73877388   {
73887389      CURSOR_PAGE_DOWN(menu->sel, total);
73897390   }
7390   else if(input_ui_pressed(machine, IPT_UI_ADD_CHEAT))
7391   else if(ui_input_pressed(machine, IPT_UI_ADD_CHEAT))
73917392   {
73927393      add_search_before(menu->sel);
73937394      build_search_regions(machine, &search_list[menu->sel]);
73947395      allocate_search_regions(&search_list[menu->sel]);
73957396   }
7396   else if(input_ui_pressed(machine, IPT_UI_DELETE_CHEAT))
7397   else if(ui_input_pressed(machine, IPT_UI_DELETE_CHEAT))
73977398   {
73987399      delete_search_at(menu->sel);
73997400   }
7400   if(input_ui_pressed(machine, IPT_UI_SELECT))
7401   if(ui_input_pressed(machine, IPT_UI_SELECT))
74017402   {
74027403      if(menu->sel < total - 1)   current_search_idx = menu->sel;
74037404      else                  menu->sel = -1;
74047405   }
7405   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
7406   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
74067407   {
74077408      menu->sel = -1;
74087409   }
r2956r2957
74897490   {
74907491      toggle = 1;
74917492   }
7492   else if(input_ui_pressed(machine, IPT_UI_SELECT))
7493   else if(ui_input_pressed(machine, IPT_UI_SELECT))
74937494   {
74947495      switch(menu->sel)
74957496      {
r2956r2957
75157516            break;
75167517      }
75177518   }
7518   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
7519   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
75197520   {
75207521      menu->sel = -1;
75217522   }
r2956r2957
75687569   ui_draw_message_window(stringsBuf);
75697570
75707571   /* NOTE : shift + cancel is only key to return because normal cancel prevents from diplaying this key */
7571   if(shift_key_pressed() && input_ui_pressed(machine, IPT_UI_CANCEL))
7572   if(shift_key_pressed() && ui_input_pressed(machine, IPT_UI_CANCEL))
75727573   {
75737574      index = INPUT_CODE_INVALID;
75747575      menu->sel = -1;
r2956r2957
77427743            i--;
77437744      }
77447745   }
7745   else if(input_ui_pressed(machine, IPT_UI_SELECT))
7746   else if(ui_input_pressed(machine, IPT_UI_SELECT))
77467747   {
77477748      if(menu->sel == kMenu_Return)
77487749         menu->sel = -1;
77497750   }
7750   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
7751   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
77517752   {
77527753      menu->sel = -1;
77537754   }
r2956r2957
78757876   {
78767877      CURSOR_PAGE_DOWN(menu->sel, total);
78777878   }
7878   else if(input_ui_pressed(machine, IPT_UI_SELECT))
7879   else if(ui_input_pressed(machine, IPT_UI_SELECT))
78797880   {
78807881      switch(menu->sel)
78817882      {
r2956r2957
78927893            break;
78937894      }
78947895   }
7895   else if(input_ui_pressed(machine, IPT_UI_CANCEL))
7896   else if(ui_input_pressed(machine, IPT_UI_CANCEL))
78967897   {
78977898      menu->sel = -1;
78987899   }
r2956r2957
79107911{
79117912   int i;
79127913
7913   if(input_ui_pressed(machine, IPT_UI_TOGGLE_CHEAT))
7914   if(ui_input_pressed(machine, IPT_UI_TOGGLE_CHEAT))
79147915   {
79157916      if(shift_key_pressed())
79167917      {
src/emu/render.h
r2956r2957
293293};
294294
295295
296/*-------------------------------------------------
297    render_container_user_settings - an object
298    containing user-controllable settings for
299    a container
300-------------------------------------------------*/
296301
302typedef struct _render_container_user_settings render_container_user_settings;
303struct _render_container_user_settings
304{
305   int               orientation;      /* orientation */
306   float            brightness;         /* brightness */
307   float            contrast;         /* contrast */
308   float            gamma;            /* gamma */
309   float            xscale;            /* horizontal scale factor */
310   float            yscale;            /* vertical scale factor */
311   float            xoffset;         /* horizontal offset */
312   float            yoffset;         /* vertical offset */
313};
314
315
316
297317/***************************************************************************
298318    FUNCTION PROTOTYPES
299319***************************************************************************/
r2956r2957
322342/* return the aspect ratio for UI fonts */
323343float render_get_ui_aspect(void);
324344
345/* performs an input hit test */
346int render_input_hit_test(render_target *target, INT32 target_x, INT32 target_y, const char *input_tag, UINT32 input_mask);
325347
326348
349
327350/* ----- render target management ----- */
328351
329352/* allocate a new render target */
r2956r2957
384407/* return a list of primitives for a given render target */
385408const render_primitive_list *render_target_get_primitives(render_target *target);
386409
410/* attempts to map a point on the specified render_target to the specified container, if possible */
411int render_target_map_point_container(render_target *target, INT32 target_x, INT32 target_y, render_container *container, float *container_x, float *container_y);
387412
388413
414
389415/* ----- render texture management ----- */
390416
391417/* allocate a new texture */
r2956r2957
410436/* return true if a container has nothing in it */
411437int render_container_is_empty(render_container *container);
412438
413/* return the orientation of a container */
414int render_container_get_orientation(render_container *container);
439/* get the current user settings for a container */
440void render_container_get_user_settings(render_container *container, render_container_user_settings *settings);
415441
416/* set the orientation of a container */
417void render_container_set_orientation(render_container *container, int orientation);
442/* set the current user settings for a container */
443void render_container_set_user_settings(render_container *container, const render_container_user_settings *settings);
418444
419/* return the brightness of a container */
420float render_container_get_brightness(render_container *container);
421
422/* set the brightness of a container */
423void render_container_set_brightness(render_container *container, float brightness);
424
425/* return the contrast of a container */
426float render_container_get_contrast(render_container *container);
427
428/* set the contrast of a container */
429void render_container_set_contrast(render_container *container, float contrast);
430
431/* return the gamma of a container */
432float render_container_get_gamma(render_container *container);
433
434/* set the gamma of a container */
435void render_container_set_gamma(render_container *container, float gamma);
436
437/* return the X scale of a container */
438float render_container_get_xscale(render_container *container);
439
440/* set the X scale of a container */
441void render_container_set_xscale(render_container *container, float xscale);
442
443/* return the Y scale of a container */
444float render_container_get_yscale(render_container *container);
445
446/* set the Y scale of a container */
447void render_container_set_yscale(render_container *container, float yscale);
448
449/* return the X offset of a container */
450float render_container_get_xoffset(render_container *container);
451
452/* set the X offset of a container */
453void render_container_set_xoffset(render_container *container, float xoffset);
454
455/* return the Y offset of a container */
456float render_container_get_yoffset(render_container *container);
457
458/* set the Y offset of a container */
459void render_container_set_yoffset(render_container *container, float yoffset);
460
461445/* set the overlay bitmap for the container */
462446void render_container_set_overlay(render_container *container, bitmap_t *bitmap);
463447
r2956r2957
480464void render_container_add_char(render_container *container, float x0, float y0, float height, float aspect, rgb_t argb, render_font *font, UINT16 ch);
481465
482466
467
483468#endif   /* __RENDER_H__ */
src/emu/romload.c
r2956r2957
447447    byte swapping and inverting data as necessary
448448-------------------------------------------------*/
449449
450static void region_post_process(rom_load_data *romdata, const rom_entry *regiondata)
450static void region_post_process(running_machine *machine, rom_load_data *romdata, int regnum)
451451{
452   int type = ROMREGION_GETTYPE(regiondata);
453   int datawidth = ROMREGION_GETWIDTH(regiondata) / 8;
454   int littleendian = ROMREGION_ISLITTLEENDIAN(regiondata);
452   UINT32 regionlength = memory_region_length(machine, regnum);
453   UINT32 regionflags = memory_region_flags(machine, regnum);
454   UINT8 *regionbase = memory_region(machine, regnum);
455   int littleendian = ((regionflags & ROMREGION_ENDIANMASK) == ROMREGION_LE);
456   int datawidth = 1 << (regionflags & ROMREGION_WIDTHMASK);
455457   UINT8 *base;
456458   int i, j;
457459
458460   debugload("+ datawidth=%d little=%d\n", datawidth, littleendian);
459461
460   /* if this is a CPU region, override with the CPU width and endianness */
461   if (type >= REGION_CPU1 && type < REGION_CPU1 + MAX_CPU)
462   {
463      cpu_type cputype = Machine->config->cpu[type - REGION_CPU1].type;
464      if (cputype != CPU_DUMMY)
465      {
466         datawidth = cputype_databus_width(cputype, ADDRESS_SPACE_PROGRAM) / 8;
467         littleendian = (cputype_endianness(cputype) == CPU_IS_LE);
468         debugload("+ CPU region #%d: datawidth=%d little=%d\n", type - REGION_CPU1, datawidth, littleendian);
469      }
470   }
471
472462   /* if the region is inverted, do that now */
473   if (ROMREGION_ISINVERTED(regiondata))
463   if (regionflags & ROMREGION_INVERTMASK)
474464   {
475465      debugload("+ Inverting region\n");
476      for (i = 0, base = romdata->regionbase; i < romdata->regionlength; i++)
466      for (i = 0, base = regionbase; i < regionlength; i++)
477467         *base++ ^= 0xff;
478468   }
479469
r2956r2957
485475#endif
486476   {
487477      debugload("+ Byte swapping region\n");
488      for (i = 0, base = romdata->regionbase; i < romdata->regionlength; i += datawidth)
478      for (i = 0, base = regionbase; i < regionlength; i += datawidth)
489479      {
490480         UINT8 temp[8];
491481         memcpy(temp, base, datawidth);
r2956r2957
10531043
10541044
10551045/*-------------------------------------------------
1046    normalize_flags_for_cpu - modify the region
1047    flags for the given CPU index
1048-------------------------------------------------*/
1049
1050static UINT32 normalize_flags_for_cpu(running_machine *machine, UINT32 startflags, int cpunum)
1051{
1052   int cputype = machine->config->cpu[cpunum].type;
1053   int buswidth;
1054
1055   /* set the endianness */
1056   startflags &= ~ROMREGION_ENDIANMASK;
1057   if (cputype_endianness(cputype) == CPU_IS_LE)
1058      startflags |= ROMREGION_LE;
1059   else
1060      startflags |= ROMREGION_BE;
1061
1062   /* set the width */
1063   startflags &= ~ROMREGION_WIDTHMASK;
1064   buswidth = cputype_databus_width(cputype, ADDRESS_SPACE_PROGRAM);
1065   if (buswidth <= 8)
1066      startflags |= ROMREGION_8BIT;
1067   else if (buswidth <= 16)
1068      startflags |= ROMREGION_16BIT;
1069   else if (buswidth <= 32)
1070      startflags |= ROMREGION_32BIT;
1071   else
1072      startflags |= ROMREGION_64BIT;
1073
1074   return startflags;
1075}
1076
1077
1078/*-------------------------------------------------
10561079    rom_init - new, more flexible ROM
10571080    loading system
10581081-------------------------------------------------*/
r2956r2957
10891112   /* loop until we hit the end */
10901113   for (region = romp, regnum = 0; region; region = rom_next_region(region), regnum++)
10911114   {
1115      UINT32 regionlength = ROMREGION_GETLENGTH(region);
1116      UINT32 regionflags = ROMREGION_GETFLAGS(region);
10921117      int regiontype = ROMREGION_GETTYPE(region);
10931118
1094      debugload("Processing region %02X (length=%X)\n", regiontype, ROMREGION_GETLENGTH(region));
1119      debugload("Processing region %02X (length=%X)\n", regiontype, regionlength);
10951120
10961121      /* the first entry must be a region */
10971122      assert(ROMENTRY_ISREGION(region));
10981123
1124      /* if this is a CPU region, override with the CPU width and endianness */
1125      if (regiontype >= REGION_CPU1 && regiontype < REGION_CPU1 + MAX_CPU)
1126         regionflags = normalize_flags_for_cpu(machine, regionflags, regiontype - REGION_CPU1);
1127
10991128      /* remember the base and length */
1100      romdata.regionbase = new_memory_region(machine, regiontype, ROMREGION_GETLENGTH(region), ROMREGION_GETFLAGS(region));
1101      romdata.regionlength = ROMREGION_GETLENGTH(region);
1129      romdata.regionbase = new_memory_region(machine, regiontype, regionlength, regionflags);
1130      romdata.regionlength = regionlength;
11021131      debugload("Allocated %X bytes @ %p\n", romdata.regionlength, romdata.regionbase);
11031132
11041133      /* clear the region if it's requested */
r2956r2957
11311160      if (regionlist[regnum])
11321161      {
11331162         debugload("Post-processing region %02X\n", regnum);
1134         romdata.regionlength = memory_region_length(machine, regnum);
1135         romdata.regionbase = memory_region(machine, regnum);
1136         region_post_process(&romdata, regionlist[regnum]);
1163         region_post_process(machine, &romdata, regnum);
11371164      }
11381165
11391166   /* display the results and exit */
src/lib/lib.mak
r2956r2957
4444   $(LIBOBJ)/util/sha1.o \
4545   $(LIBOBJ)/util/unicode.o \
4646   $(LIBOBJ)/util/unzip.o \
47   $(LIBOBJ)/util/vbiparse.o \
4748   $(LIBOBJ)/util/xmlfile.o \
4849
4950$(OBJ)/libutil.a: $(UTILOBJS)
src/lib/util/aviio.c
r2956r2957
25792579   /* compressed video */
25802580   for (y = 0; y < stream->height; y++)
25812581   {
2582      UINT16 *dest = (UINT16 *)bitmap->base + y * bitmap->rowpixels;
2582      UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
25832583
25842584      /* handle the first four bytes independently */
25852585      x = 0;
r2956r2957
26642664   }
26652665
26662666   /* apply deltas */
2667   lasty = lastcb = lastcr = 0;
26682667   lastprevy = lastprevcb = lastprevcr = 0;
26692668   for (y = 0; y < stream->height; y++)
26702669   {
2671      UINT16 *dest = (UINT16 *)bitmap->base + y * bitmap->rowpixels;
2672      UINT16 *prevrow = dest - prevlines * bitmap->rowpixels;
2670      UINT16 *prevrow = BITMAP_ADDR16(bitmap, y - prevlines, 0);
2671      UINT16 *dest = BITMAP_ADDR16(bitmap, y, 0);
26732672
2673      /* handle the first four bytes independently */
2674      x = 0;
2675      if (y == 0)
2676      {
2677         /* lasty, lastcr, lastcb are set up previously */
2678         x = 2;
2679      }
2680
26742681      /* left predict or gradient predict */
26752682      if ((huffyuv->predictor & ~HUFFYUV_PREDICT_DECORR) == HUFFYUV_PREDICT_LEFT ||
26762683         ((huffyuv->predictor & ~HUFFYUV_PREDICT_DECORR) == HUFFYUV_PREDICT_GRADIENT))
26772684      {
26782685         /* first do left deltas */
2679         for (x = 0; x < stream->width; x += 2)
2686         for ( ; x < stream->width; x += 2)
26802687         {
26812688            UINT16 pixel0 = dest[x + 0];
26822689            UINT16 pixel1 = dest[x + 1];
r2956r2957
27052712      /* median predict on rows > 0 */
27062713      else if ((huffyuv->predictor & ~HUFFYUV_PREDICT_DECORR) == HUFFYUV_PREDICT_MEDIAN && y >= prevlines)
27072714      {
2708         for (x = 0; x < stream->width; x += 2)
2715         for ( ; x < stream->width; x += 2)
27092716         {
27102717            UINT16 prevpixel0 = prevrow[x + 0];
27112718            UINT16 prevpixel1 = prevrow[x + 1];
src/lib/util/vbiparse.c
r0r2957
1/***************************************************************************
2
3    vbiparse.c
4
5    Parse Philips codes and other data from VBI lines.
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#include "osdcore.h"
13
14
15
16/***************************************************************************
17    CONSTANTS
18***************************************************************************/
19
20#define MAX_SOURCE_WIDTH   1024
21
22
23
24/***************************************************************************
25    IMPLEMENTATION
26***************************************************************************/
27
28/*-------------------------------------------------
29    vbi_parse_manchester_code - parse a Manchester
30    code from a line of video data
31-------------------------------------------------*/
32
33int vbi_parse_manchester_code(const UINT16 *source, int sourcewidth, int sourceshift, int expectedbits, UINT8 *result)
34{
35   UINT8 srcabs[MAX_SOURCE_WIDTH];
36   UINT8 min, max, mid, srcabsval;
37   double clock, bestclock;
38   int x, firstedge;
39   int besterr;
40
41   /* fail if the width is too large */
42   if (sourcewidth > MAX_SOURCE_WIDTH)
43      return 0;
44
45   /* find highs and lows in the line */
46   min = 0xff;
47   max = 0x00;
48   for (x = 0; x < sourcewidth; x++)
49   {
50      UINT8 rawsrc = source[x] >> sourceshift;
51      min = MIN(min, rawsrc);
52      max = MAX(max, rawsrc);
53   }
54
55   /* bail if the line is all black or all white */
56   if (max < 0x80 || min > 0x80)
57      return 0;
58
59   /* determine the midpoint and then set the thresholds to be halfway */
60   mid = (min + max) / 2;
61   min = mid - (mid - min) / 2;
62   max = mid + (max - mid) / 2;
63
64   /* convert the source into absolute high/low  */
65   srcabsval = (source[0] > mid);
66   for (x = 0; x < sourcewidth; x++)
67   {
68      UINT8 rawsrc = source[x] >> sourceshift;
69      if (rawsrc >= max)
70         srcabsval = 1;
71      else if (rawsrc <= min)
72         srcabsval = 0;
73      srcabs[x] = srcabsval;
74   }
75
76   /* find the first transition; this is assumed to be the middle of the first bit */
77   for (x = 0; x < sourcewidth - 1; x++)
78      if (srcabs[x] != srcabs[x + 1])
79         break;
80   if (x == sourcewidth - 1)
81      return 0;
82   firstedge = x;
83
84   /* now scan to find a clock that has a nearby transition on each beat */
85   bestclock = 0;
86   besterr = 1000;
87   for (clock = (double)sourcewidth / (double)expectedbits; clock >= 2.0; clock -= 1.0 / (double)expectedbits)
88   {
89      int error = 0;
90
91      /* scan for all the expected bits */
92      for (x = 1; x < expectedbits; x++)
93      {
94         int curbit = firstedge + (double)x * clock;
95
96         /* exact match? */
97         if (srcabs[curbit + 0] != srcabs[curbit + 1])
98            continue;
99
100         /* off-by-one? */
101         if (srcabs[curbit + 1 + 0] != srcabs[curbit + 1 + 1] || srcabs[curbit - 1 + 0] != srcabs[curbit - 1 + 1])
102         {
103            /* only continue if we're still in the running */
104            if (++error < besterr)
105               continue;
106         }
107
108         /* anything else fails immediately */
109         break;
110      }
111
112      /* if we got to the end, this is the best candidate so far */
113      if (x == expectedbits)
114      {
115         besterr = error;
116         bestclock = clock;
117      }
118   }
119
120   /* if nobody matched, fail */
121   if (bestclock == 0)
122      return 0;
123
124   /* now extract the bits */
125   for (x = 0; x < expectedbits; x++)
126   {
127      int leftbit = firstedge + ((double)x - 0.25) * bestclock;
128      int rightbit = firstedge + ((double)x + 0.25) * bestclock;
129      int left = srcabs[leftbit];
130      int right = srcabs[rightbit];
131
132      /* all bits should be marked by transitions; fail if we don't get one */
133      if (left == right)
134         return 0;
135      result[x] = (left < right);
136   }
137   return expectedbits;
138}
139
140
141/*-------------------------------------------------
142    vbi_parse_white_flag - compute the "white
143    flag" from a line of video data
144-------------------------------------------------*/
145
146int vbi_parse_white_flag(const UINT16 *source, int sourcewidth, int sourceshift)
147{
148   int minval = 0xff;
149   int maxval = 0x00;
150   int avgval = 0x00;
151   int diff;
152   int x;
153
154   /* compute minimum, maximum, and average values across the line */
155   for (x = 0; x < sourcewidth; x++)
156   {
157      UINT8 yval = source[x] >> sourceshift;
158      minval = MIN(yval, minval);
159      maxval = MAX(yval, maxval);
160      avgval += yval;
161   }
162   avgval /= sourcewidth;
163   diff = maxval - minval;
164
165   /* if there's a spread of at least 0x20, and the average is above 3/4 of the center, call it good */
166   return (diff >= 0x20) && (avgval >= minval + 3 * diff / 4);
167}
src/lib/util/vbiparse.h
r0r2957
1/***************************************************************************
2
3    vbiparse.h
4
5    Parse Philips codes and other data from VBI lines.
6
7    Copyright Nicola Salmoria and the MAME Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10***************************************************************************/
11
12#pragma once
13
14#ifndef __VBIPARSE_H__
15#define __VBIPARSE_H__
16
17
18/***************************************************************************
19    FUNCTION PROTOTYPES
20***************************************************************************/
21
22/* parse a Manchester code from a line of video data */
23int vbi_parse_manchester_code(const UINT16 *source, int sourcewidth, int sourceshift, int expectedbits, UINT8 *result);
24
25/* compute the "white flag" from a line of video data */
26int vbi_parse_white_flag(const UINT16 *source, int sourcewidth, int sourceshift);
27
28
29#endif /* __VBIPARSE_H__ */
src/lib/util/unicode.h
r2956r2957
3838/* these are UTF-8 encoded strings for common characters */
3939#define UTF8_NBSP         "\xc2\xa0"         /* non-breaking space */
4040#define UTF8_MULTIPLY      "\xc3\x97"         /* multiplication symbol */
41#define UTF8_DEGREES      "\xc2\xb0"         /* degrees symbol */
4142
4243
4344
src/lib/util/astring.c
r2956r2957
335335}
336336
337337
338/*-------------------------------------------------
339    astring_vprintf - vprintf text into an astring
340-------------------------------------------------*/
338341
342int astring_vprintf(astring *dst, const char *format, va_list args)
343{
344   char tempbuf[4096];
345   int result;
346
347   /* sprintf into the temporary buffer */
348   result = vsprintf(tempbuf, format, args);
349
350   /* set the result */
351   astring_cpyc(dst, tempbuf);
352   return result;
353}
354
355
356/*-------------------------------------------------
357    astring_catprintf - formatted printf to
358    the end of an astring
359-------------------------------------------------*/
360
361int astring_catprintf(astring *dst, const char *format, ...)
362{
363   char tempbuf[4096];
364   va_list args;
365   int result;
366
367   /* sprintf into the temporary buffer */
368   va_start(args, format);
369   result = vsprintf(tempbuf, format, args);
370   va_end(args);
371
372   /* append the result */
373   astring_catc(dst, tempbuf);
374   return result;
375}
376
377
378/*-------------------------------------------------
379    astring_catprintf - formatted vprintf to
380    the end of an astring
381-------------------------------------------------*/
382
383int astring_catvprintf(astring *dst, const char *format, va_list args)
384{
385   char tempbuf[4096];
386   int result;
387
388   /* sprintf into the temporary buffer */
389   result = vsprintf(tempbuf, format, args);
390
391   /* append the result */
392   astring_catc(dst, tempbuf);
393   return result;
394}
395
396
397
339398/***************************************************************************
340399    ASTRING QUERIES
341400***************************************************************************/
src/lib/util/astring.h
r2956r2957
1515#define __ASTRING_H__
1616
1717#include "pool.h"
18#include <stdarg.h>
1819
1920
2021/***************************************************************************
r2956r2957
7576/* formatted printf to an astring */
7677int astring_printf(astring *dst, const char *format, ...) ATTR_PRINTF(2,3);
7778
79/* formatted vprintf to an astring */
80int astring_vprintf(astring *dst, const char *format, va_list args);
7881
82/* formatted printf to the end of an astring */
83int astring_catprintf(astring *dst, const char *format, ...) ATTR_PRINTF(2,3);
7984
85/* formatted vprintf to the end of an astring */
86int astring_catvprintf(astring *dst, const char *format, va_list args);
87
88
89
8090/* ----- astring queries ----- */
8191
8292/* return a pointer to a C string from an astring */
src/mess/uimess.c
r2956r2957
1010#include "mslegacy.h"
1111#include "uimenu.h"
1212#include "uimess.h"
13#include "uiinput.h"
1314#include "input.h"
1415
1516
r2956r2957
4041   /* traditional MESS interface */
4142   if (machine->gamedrv->flags & GAME_COMPUTER)
4243   {
43      if( input_ui_pressed(machine, IPT_UI_TOGGLE_UI) )
44      if (ui_input_pressed(machine, IPT_UI_TOGGLE_UI) )
4445      {
4546         if( !ui_toggle_key )
4647         {
r2956r2957
102103
103104
104105
105/*************************************
106 *
107 *  Image info
108 *
109 *************************************/
106/*-------------------------------------------------
107    image_info_astring - populate an allocated
108    string with the image info text
109-------------------------------------------------*/
110110
111int ui_sprintf_image_info(running_machine *machine, char *buf)
111static astring *image_info_astring(running_machine *machine, astring *string)
112112{
113   char *dst = buf;
114113   const device_config *img;
115114
116   dst += sprintf(dst, "%s\n\n", machine->gamedrv->description);
115   astring_printf(string, "%s\n\n", machine->gamedrv->description);
117116
118117   if (mess_ram_size > 0)
119118   {
120119      char buf2[RAM_STRING_BUFLEN];
121      dst += sprintf(dst, "RAM: %s\n\n", ram_string(buf2, mess_ram_size));
120      astring_catprintf(string, "RAM: %s\n\n", ram_string(buf2, mess_ram_size));
122121   }
123122
124123   for (img = image_device_first(machine->config); img != NULL; img = image_device_next(img))
125124   {
126125      const char *name = image_filename(img);
127      if( name )
126      if (name != NULL)
128127      {
129128         const char *base_filename;
130129         const char *info;
r2956r2957
134133         base_filename_noextension = strip_extension(base_filename);
135134
136135         /* display device type and filename */
137         dst += sprintf(dst,"%s: %s\n", image_typename_id(img), base_filename);
136         astring_catprintf(string, "%s: %s\n", image_typename_id(img), base_filename);
138137
139138         /* display long filename, if present and doesn't correspond to name */
140139         info = image_longname(img);
141140         if (info && (!base_filename_noextension || mame_stricmp(info, base_filename_noextension)))
142            dst += sprintf(dst,"%s\n", info);
141            astring_catprintf(string, "%s\n", info);
143142
144143         /* display manufacturer, if available */
145144         info = image_manufacturer(img);
146         if (info)
145         if (info != NULL)
147146         {
148            dst += sprintf(dst,"%s", info);
147            astring_catprintf(string, "%s", info);
149148            info = stripspace(image_year(img));
150149            if (info && *info)
151               dst += sprintf(dst,", %s", info);
152            dst += sprintf(dst,"\n");
150               astring_catprintf(string, ", %s", info);
151            astring_catprintf(string,"\n");
153152         }
154153
155154         /* display playable information, if available */
156155         info = image_playable(img);
157         if (info)
158            dst += sprintf(dst,"%s\n", info);
156         if (info != NULL)
157            astring_catprintf(string, "%s\n", info);
159158
160         if (base_filename_noextension)
159         if (base_filename_noextension != NULL)
161160            free(base_filename_noextension);
162161      }
163162      else
164163      {
165         dst += sprintf(dst,"%s: ---\n", image_typename_id(img));
164         astring_catprintf(string, "%s: ---\n", image_typename_id(img));
166165      }
167166   }
168   return dst - buf;
167   return string;
169168}
170169
171170
r2956r2957
175174   all loaded images
176175-------------------------------------------------*/
177176
178UINT32 ui_menu_image_info(running_machine *machine, UINT32 state)
177void ui_menu_image_info(running_machine *machine, ui_menu *menu, void *parameter, void *state)
179178{
180   char buf[2048];
181   char *bufptr = buf;
182   UINT32 selected = 0;
179   /* if the menu isn't built, populate now */
180   if (!ui_menu_populated(menu))
181   {
182      astring *tempstring = image_info_astring(machine, astring_alloc());
183      ui_menu_item_append(menu, astring_c(tempstring), NULL, MENU_FLAG_MULTILINE, NULL);
184      astring_free(tempstring);
185   }
183186
184   /* add the game info */
185   bufptr += ui_sprintf_image_info(machine, bufptr);
186
187   /* make it look like a menu */
188   bufptr += sprintf(bufptr, "\n\t%s %s %s", ui_getstring(UI_lefthilight), ui_getstring(UI_returntomain), ui_getstring(UI_righthilight));
189
190   /* draw the text */
191   ui_draw_message_window(buf);
192
193   /* handle the keys */
194   ui_menu_generic_keys(machine, &selected, 1, 0);
195   return selected;
187   /* process the menu */
188   ui_menu_process(menu, 0);
196189}
197190
198191
r2956r2957
202195   is in use
203196-------------------------------------------------*/
204197
198/*-------------------------------------------------
199    mess_use_new_ui - determines if the "new ui"
200   is in use
201-------------------------------------------------*/
202
205203int mess_use_new_ui(void)
206204{
207205#if (defined(WIN32) || defined(_MSC_VER)) && !defined(SDLMAME_WIN32)
src/mess/uimess.h
r2956r2957
1818int mess_disable_builtin_ui(running_machine *machine);
1919
2020/* image info screen */
21int ui_sprintf_image_info(running_machine *machine, char *buf);
22UINT32 ui_menu_image_info(running_machine *machine, UINT32 state);
21void ui_menu_image_info(running_machine *machine, ui_menu *menu, void *parameter, void *state);
2322
2423/* file manager */
25UINT32 menu_file_manager(running_machine *machine, UINT32 state);
24void menu_file_manager(running_machine *machine, ui_menu *menu, void *parameter, void *state);
2625
2726/* tape control */
28UINT32 menu_tape_control(running_machine *machine, UINT32 state);
27void menu_tape_control(running_machine *machine, ui_menu *menu, void *parameter, void *state);
2928astring *tapecontrol_gettime(astring *dest, const device_config *device, int *curpos, int *endpos);
3029
3130/* paste */
src/mess/tapectrl.c
r2956r2957
1616
1717
1818/***************************************************************************
19    TYPE DEFINITIONS
20***************************************************************************/
21
22enum _tape_control_command
23{
24   TAPECMD_NULL = 0,
25   TAPECMD_STOP,
26   TAPECMD_PLAY,
27   TAPECMD_RECORD,
28   TAPECMD_REWIND,
29   TAPECMD_FAST_FORWARD
30};
31typedef enum _tape_control_command tape_control_command;
32
33
34
35typedef struct _tape_control_menu_state tape_control_menu_state;
36struct _tape_control_menu_state
37{
38   int index;
39   const device_config *device;
40};
41
42
43
44/***************************************************************************
1945    IMPLEMENTATION
2046***************************************************************************/
2147
r2956r2957
4672
4773
4874
49static int tapecontrol(running_machine *machine, int selected)
75/*-------------------------------------------------
76    menu_tape_control_populate - populates the
77   main tape control menu
78-------------------------------------------------*/
79
80static void menu_tape_control_populate(running_machine *machine, ui_menu *menu, tape_control_menu_state *menustate)
5081{
51   static int id = 0;
5282   astring *timepos = astring_alloc();
53   ui_menu_item menu_item[40];
54   char name[64];
55   const device_config *img;
56
57   int sel;
58   int total;
59   int arrowize;
6083   cassette_state state;
6184
62   total = 0;
63   sel = selected - 1;
64
65   img = image_from_devtype_and_index(IO_CASSETTE, id);
66   if ( !image_filename(img) )
85   if (image_exists(menustate->device))
6786   {
68      sprintf(name, "\t%s\n\n\t", ui_getstring(UI_notapeimageloaded) );
69      strcat(name, ui_getstring(UI_lefthilight));
70      strcat(name, " ");
71      strcat(name, ui_getstring(UI_returntomain));
72      strcat(name, " ");
73      strcat(name, ui_getstring(UI_righthilight));
74      ui_draw_message_window(name);
87      /* name of tape */
88      ui_menu_item_append(menu, image_typename_id(menustate->device), image_filename(menustate->device), 0, NULL);
7589
76      if (input_ui_pressed(machine, IPT_UI_SELECT) || input_ui_pressed(machine, IPT_UI_CANCEL))
77         sel = -1;
78      if (input_ui_pressed(machine, IPT_UI_CONFIGURE))
79         sel = -2;
80
81      return sel + 1;
82   }
83
84   strcpy( name, image_typename_id(img) );
85   menu_item[total].text = name;
86   menu_item[total].subtext = image_filename(img);
87   menu_item[total].flags = 0;
88   total++;
89
90   tapecontrol_gettime(timepos, img, NULL, NULL);
91
92   state = cassette_get_state(img);
93   menu_item[total].text =
94      ui_getstring(
95         (state & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED
90      /* state */
91      tapecontrol_gettime(timepos, menustate->device, NULL, NULL);
92      state = cassette_get_state(menustate->device);
93      ui_menu_item_append(
94         menu,
95         ui_getstring((state & CASSETTE_MASK_UISTATE) == CASSETTE_STOPPED
9696            ?   UI_stopped
9797            :   ((state & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY
9898               ? ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? UI_playing : UI_playing_inhibited)
9999               : ((state & CASSETTE_MASK_MOTOR) == CASSETTE_MOTOR_ENABLED ? UI_recording : UI_recording_inhibited)
100               ));
100               )),
101         astring_c(timepos),
102         0,
103         NULL);
101104
102   menu_item[total].subtext = astring_c(timepos);
103   menu_item[total].flags = 0;
104   total++;
105      /* pause or stop */
106      ui_menu_item_append(menu, ui_getstring(UI_pauseorstop), NULL, 0, (void *) TAPECMD_STOP);
105107
106   menu_item[total].text = ui_getstring(UI_pauseorstop);
107   menu_item[total].subtext = 0;
108   menu_item[total].flags = 0;
109   total++;
108      /* play */
109      ui_menu_item_append(menu, ui_getstring(UI_play), NULL, 0, (void *) TAPECMD_PLAY);
110110
111   menu_item[total].text = ui_getstring(UI_play);
112   menu_item[total].subtext = 0;
113   menu_item[total].flags = 0;
114   total++;
111      /* record */
112      ui_menu_item_append(menu, ui_getstring(UI_record), NULL, 0, (void *) TAPECMD_RECORD);
115113
116   menu_item[total].text = ui_getstring(UI_record);
117   menu_item[total].subtext = 0;
118   menu_item[total].flags = 0;
119   total++;
114      /* rewind */
115      ui_menu_item_append(menu, ui_getstring(UI_rewind), NULL, 0, (void *) TAPECMD_REWIND);
120116
121   menu_item[total].text = ui_getstring(UI_rewind);
122   menu_item[total].subtext = 0;
123   menu_item[total].flags = 0;
124   total++;
125
126   menu_item[total].text = ui_getstring(UI_fastforward);
127   menu_item[total].subtext = 0;
128   menu_item[total].flags = 0;
129   total++;
130
131   menu_item[total].text = ui_getstring(UI_returntomain);
132   menu_item[total].subtext = 0;
133   menu_item[total].flags = 0;
134   total++;
135
136   arrowize = 0;
137   if (sel < total - 1)
138      arrowize = 2;
139
140   if (sel > 255)  /* are we waiting for a new key? */
117      /* fast forward */
118      ui_menu_item_append(menu, ui_getstring(UI_fastforward), NULL, 0, (void *) TAPECMD_FAST_FORWARD);
119   }
120   else
141121   {
142      /* display the menu */
143      ui_menu_draw(menu_item, total, sel & 0xff, NULL);
144      return sel + 1;
122      /* no tape loaded */
123      ui_menu_item_append(menu, ui_getstring(UI_notapeimageloaded), NULL, 0, NULL);
145124   }
146125
147   ui_menu_draw(menu_item, total, sel, NULL);
126   if (timepos != NULL)
127      astring_free(timepos);
128}
148129
149   if (input_ui_pressed_repeat(machine, IPT_UI_DOWN,8))
150   {
151      if (sel < total - 1) sel++;
152      else sel = 0;
153   }
154130
155   if (input_ui_pressed_repeat(machine, IPT_UI_UP,8))
156   {
157      if (sel > 0) sel--;
158      else sel = total - 1;
159   }
131/*-------------------------------------------------
132    menu_tape_control - main tape control menu
133-------------------------------------------------*/
160134
135void menu_tape_control(running_machine *machine, ui_menu *menu, void *parameter, void *state)
136{
137   tape_control_menu_state *menustate;
138   const ui_menu_event *event;
161139
162   if (input_ui_pressed(machine, IPT_UI_LEFT))
163   {
164      switch (sel)
165      {
166      case 0:
167         id--;
168         if (id < 0) id = device_count(machine, IO_CASSETTE)-1;
169         break;
170      }
171   }
140   /* if no state, allocate some */
141   if (state == NULL)
142      state = ui_menu_alloc_state(menu, sizeof(*menustate));
143   menustate = (tape_control_menu_state *) state;
172144
173   if (input_ui_pressed(machine, IPT_UI_RIGHT))
145   /* do we have to load the device? */
146   if (menustate->device == NULL)
174147   {
175      switch (sel)
176      {
177      case 0:
178         id++;
179         if (id > device_count(machine, IO_CASSETTE)-1) id = 0;
180         break;
181      }
148      menustate->device = image_from_devtype_and_index(IO_CASSETTE, menustate->index);
149      ui_menu_reset(menu, 0);
182150   }
183151
184   if (input_ui_pressed(machine, IPT_UI_SELECT))
152   /* if the menu isn't built, populate now */
153   if (!ui_menu_populated(menu))
154      menu_tape_control_populate(machine, menu, state);
155
156   /* process the menu */
157   event = ui_menu_process(menu, 0);
158   if (event != NULL)
185159   {
186      if (sel == total - 1)
187         sel = -1;
188      else
160      switch(event->iptkey)
189161      {
190         img = image_from_devtype_and_index(IO_CASSETTE, id);
191         switch (sel)
192         {
193         case 0:
194            id = (id + 1) % device_count(machine, IO_CASSETTE);
162         case IPT_UI_LEFT:
163            /* left arrow - rotate left through cassette devices */
164            if (menustate->index > 0)
165               menustate->index--;
166            else
167               menustate->index = device_count(machine, IO_CASSETTE) - 1;
168            menustate->device = NULL;
195169            break;
196         case 2:
197            /* Pause/stop */
198            cassette_change_state(img, CASSETTE_STOPPED, CASSETTE_MASK_UISTATE);
170
171         case IPT_UI_RIGHT:
172            /* right arrow - rotate right through cassette devices */
173            if (menustate->index < device_count(machine, IO_CASSETTE) - 1)
174               menustate->index++;
175            else
176               menustate->index = 0;
177            menustate->device = NULL;
199178            break;
200         case 3:
201            /* Play */
202            cassette_change_state(img, CASSETTE_PLAY, CASSETTE_MASK_UISTATE);
203            break;
204         case 4:
205            /* Record */
206            cassette_change_state(img, CASSETTE_RECORD, CASSETTE_MASK_UISTATE);
207            break;
208         case 5:
209            /* Rewind */
210            cassette_seek(img, -1, SEEK_CUR);
211            break;
212         case 6:
213            /* Fast forward */
214            cassette_seek(img, +1, SEEK_CUR);
215            break;
216         }
217      }
218   }
219179
220   if (input_ui_pressed(machine, IPT_UI_CANCEL))
221      sel = -1;
180         case IPT_UI_SELECT:
181            switch((tape_control_command) event->itemref)
182            {
183               case TAPECMD_NULL:
184                  break;
222185
223   if (input_ui_pressed(machine, IPT_UI_CONFIGURE))
224      sel = -2;
186               case TAPECMD_STOP:
187                  cassette_change_state(menustate->device, CASSETTE_STOPPED, CASSETTE_MASK_UISTATE);
188                  break;
225189
226   astring_free(timepos);
227   return sel + 1;
228}
190               case TAPECMD_PLAY:
191                  cassette_change_state(menustate->device, CASSETTE_PLAY, CASSETTE_MASK_UISTATE);
192                  break;
229193
194               case TAPECMD_RECORD:
195                  cassette_change_state(menustate->device, CASSETTE_RECORD, CASSETTE_MASK_UISTATE);
196                  break;
230197
231/*-------------------------------------------------
232    menu_tape_control - main tape control menu
233-------------------------------------------------*/
198               case TAPECMD_REWIND:
199                  cassette_seek(menustate->device, -1, SEEK_CUR);
200                  break;
234201
235UINT32 menu_tape_control(running_machine *machine, UINT32 state)
236{
237   int result = tapecontrol(machine, state);
238   if (result == 0)
239      return ui_menu_stack_pop();
240   return result;
202               case TAPECMD_FAST_FORWARD:
203                  cassette_seek(menustate->device, +1, SEEK_CUR);
204                  break;
205            }
206            break;
207      }
208   }
241209}
src/mess/filemngr.c
r2956r2957
2525    CONSTANTS
2626***************************************************************************/
2727
28#define SLOT_EMPTY      "[empty slot]"
29#define SLOT_CREATE      "[create]"
28#define SLOT_EMPTY            "[empty slot]"
29#define SLOT_CREATE            "[create]"
3030
31#define ITEMREF_NEW_IMAGE_NAME   ((void *) 0x0001)
3132
3233
34
3335/***************************************************************************
3436    TYPE DEFINITIONS
3537***************************************************************************/
3638
37/* state of the file creator menu */
38typedef union _filecreator_state filecreator_state;
39union _filecreator_state
39/* state of the file manager */
40typedef struct _file_manager_menu_state file_manager_menu_state;
41struct _file_manager_menu_state
4042{
41   UINT32 i;
42   struct
43   {
44      int selected : 16;
45      unsigned int is_built : 1;
46   } s;
43   object_pool *pool;
44   const device_config *selected_device;
45   astring *current_directory;
46   astring *current_file;
4747};
4848
4949
5050
5151/* state of the file selector menu */
52typedef union _fileselector_state fileselector_state;
53union _fileselector_state
52typedef struct _file_selector_menu_state file_selector_menu_state;
53struct _file_selector_menu_state
5454{
55   UINT32 i;
56   struct
57   {
58      int selected : 16;
59      unsigned int menu_is_built : 1;
60   } s;
55   file_manager_menu_state *manager_menustate;
6156};
6257
6358
6459
65/***************************************************************************
66    LOCAL VARIABLES
67***************************************************************************/
60/* state of the file creator menu */
61typedef struct _file_create_menu_state file_create_menu_state;
62struct _file_create_menu_state
63{
64   file_manager_menu_state *manager_menustate;
65   char filename_buffer[1024];
66};
6867
6968
7069
71static const device_config *selected_device;
72static astring *current_directory;
73static astring *current_file;
74
75
76
7770/***************************************************************************
7871    MENU HELPERS
7972***************************************************************************/
8073
8174/*-------------------------------------------------
75    memory_error - report a memory error
76-------------------------------------------------*/
77
78static void memory_error(const char *message)
79{
80   fatalerror("%s", message);
81}
82
83
84
85/*-------------------------------------------------
8286    code_to_ascii - converts an input_code to its
8387   ASCII equivalent
8488-------------------------------------------------*/
r2956r2957
263267   and footer text
264268-------------------------------------------------*/
265269
266static void extra_text_render(const menu_extra *extra, float origx1, float origy1, float origx2, float origy2,
270static void extra_text_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom,
271   float origx1, float origy1, float origx2, float origy2,
267272   const char *header, const char *footer)
268273{
269274   header = ((header != NULL) && (header[0] != '\0')) ? header : NULL;
270275   footer = ((footer != NULL) && (footer[0] != '\0')) ? footer : NULL;
271276
272277   if (header != NULL)
273      extra_text_draw_box(origx1, origx2, origy1, extra->top, header, -1);
278      extra_text_draw_box(origx1, origx2, origy1, top, header, -1);
274279   if (footer != NULL)
275      extra_text_draw_box(origx1, origx2, origy2, extra->bottom, footer, +1);
280      extra_text_draw_box(origx1, origx2, origy2, bottom, footer, +1);
276281}
277282
278283
r2956r2957
310315    special rendering
311316-------------------------------------------------*/
312317
313static void file_creator_render_extra(const menu_extra *extra, float origx1, float origy1, float origx2, float origy2)
318static void file_creator_render_extra(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
314319{
315   extra_text_render(extra, origx1, origy1, origx2, origy2, astring_c(current_directory), NULL);
320   file_create_menu_state *menustate = (file_create_menu_state *) state;
321
322   extra_text_render(machine, menu, state, selectedref, top, bottom, origx1, origy1, origx2, origy2,
323      astring_c(menustate->manager_menustate->current_directory),
324      NULL);
316325}
317326
318327
r2956r2957
321330    menu_file_create - file creator menu
322331-------------------------------------------------*/
323332
324static UINT32 menu_file_create(running_machine *machine, UINT32 state)
333static void menu_file_create(running_machine *machine, ui_menu *menu, void *parameter, void *state)
325334{
326   static char filename_buffer[1024];
327
328335   astring *new_path;
329   ui_menu_item item_list[200];
330   int menu_items = 0;
331   filecreator_state fc_state;
332   UINT32 selected;
333   int visible_items;
336   const ui_menu_event *event;
334337   int underscore_pos = -1;
335   menu_extra extra;
338   file_create_menu_state *menustate = (file_create_menu_state *) state;
336339
337   /* disassemble state */
338   fc_state.i = state;
339   selected = fc_state.s.selected;
340
341   /* is this the first time that we've been called? */
342   if (!fc_state.s.is_built)
343   {
344      filename_buffer[0] = '\0';
345      fc_state.s.is_built = TRUE;
346   }
340   /* clear the menu */
341   ui_menu_reset(menu, 0);
347342   
348343   /* add the "[empty slot]" entry */
349   memset(&item_list[menu_items], 0, sizeof(item_list[menu_items]));
350   item_list[menu_items].text = "New Image Name:";
351   item_list[menu_items].subtext = filename_buffer;
352   menu_items++;
344   ui_menu_item_append(menu, "New Image Name:", menustate->filename_buffer, 0, ITEMREF_NEW_IMAGE_NAME);
353345
354   /* add an item for the return */
355   memset(&item_list[menu_items], 0, sizeof(item_list[menu_items]));
356   item_list[menu_items].text = "Return to Prior Menu";
357   menu_items++;
346   /* set up custom render proc */
347   ui_menu_set_custom_render(menu, file_creator_render_extra, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER, 0);
358348
359   /* compute extras */
360   memset(&extra, 0, sizeof(extra));
361   extra.top = ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER;
362   extra.render = file_creator_render_extra;
363
364349   /* features that are only enabled when selecting the file name */
365   if (selected == 0)
350   if (ui_menu_get_selection(menu) == 0)
366351   {
367352      /* poll the keyboard */
368      poll_keyboard(filename_buffer, ARRAY_LENGTH(filename_buffer), is_valid_filename_char);
353      poll_keyboard(menustate->filename_buffer, ARRAY_LENGTH(menustate->filename_buffer), is_valid_filename_char);
369354
370355      /* put the underscore in the menu */
371      underscore_pos = strlen(filename_buffer);
372      snprintf(filename_buffer + underscore_pos, ARRAY_LENGTH(filename_buffer) - underscore_pos, "_");
356      underscore_pos = strlen(menustate->filename_buffer);
357      snprintf(menustate->filename_buffer + underscore_pos, ARRAY_LENGTH(menustate->filename_buffer) - underscore_pos, "_");
373358   }
374359
375   /* draw the menu */
376   visible_items = ui_menu_draw(item_list, menu_items, selected, &extra);
360   /* process the menu */
361   event = ui_menu_process(menu, 0);
377362
378363   /* remove the underscore, if present */
379364   if (underscore_pos >= 0)
380      filename_buffer[underscore_pos] = '\0';
365      menustate->filename_buffer[underscore_pos] = '\0';
381366
382   /* handle the keys */
383   if (ui_menu_generic_keys(machine, &selected, menu_items, visible_items))
384      goto done;
385
386   if (input_ui_pressed(machine, IPT_UI_SELECT))
367   /* process the event */
368   if (event != NULL && event->itemref != NULL)
387369   {
388      switch(selected)
370      /* handle selections */
371      if (event->iptkey == IPT_UI_SELECT)
389372      {
390         case 0:
373         if (event->itemref == ITEMREF_NEW_IMAGE_NAME)
374         {
391375            /* create the image */
392            new_path = zippath_combine(astring_alloc(), astring_c(current_directory), filename_buffer);
393            image_create(selected_device, astring_c(new_path), 0, NULL);
376            new_path = zippath_combine(
377               astring_alloc(),
378               astring_c(menustate->manager_menustate->current_directory),
379               menustate->filename_buffer);
380            image_create(
381               menustate->manager_menustate->selected_device,
382               astring_c(new_path),
383               0,
384               NULL);
394385            astring_free(new_path);
395
396            /* pop ourselves out */
397            ui_menu_stack_pop();
398            fc_state.i = ui_menu_stack_pop();
399            goto done;
386         }
400387      }
401388   }
402
403   fc_state.s.selected = selected;
404
405done:
406   return fc_state.i;
407389}
408390
409391
r2956r2957
417399   of type osd_directory_entry
418400-------------------------------------------------*/
419401
420static osd_directory_entry *alloc_directory_entry(const char *name, osd_dir_entry_type type, UINT64 size)
402static osd_directory_entry *alloc_directory_entry(object_pool *pool, const char *name, osd_dir_entry_type type, UINT64 size)
421403{
422404   char *name_dupe = NULL;
423405   osd_directory_entry *new_entry;
r2956r2957
425407   
426408   /* allocate the new entry */
427409   name_length = (name != NULL) ? strlen(name) + 1 : 0;
428   new_entry = malloc_or_die(sizeof(*new_entry) + name_length);
410   new_entry = pool_malloc(pool, sizeof(*new_entry) + name_length);
429411
430412   /* copy the name, if specified */
431413   if (name != NULL)
r2956r2957
447429    special rendering
448430-------------------------------------------------*/
449431
450static void file_selector_render_extra(const menu_extra *extra, float origx1, float origy1, float origx2, float origy2)
432static void file_selector_render_extra(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
451433{
452   extra_text_render(extra, origx1, origy1, origx2, origy2, astring_c(current_directory), NULL);
434   file_selector_menu_state *menustate = (file_selector_menu_state *) state;
435
436   extra_text_render(machine, menu, state, selectedref, top, bottom,
437      origx1, origy1, origx2, origy2,
438      astring_c(menustate->manager_menustate->current_directory),
439      NULL);
453440}
454441
455442
r2956r2957
458445    append_menu_item - appends a single menu item
459446-------------------------------------------------*/
460447
461static void append_menu_item(ui_menu_item **item_list, int *menu_items,
448static void append_menu_item(ui_menu *menu, file_selector_menu_state *menustate,
462449   const char *text, const char *subtext,
463   const char *dirent_name, osd_dir_entry_type dirent_type, UINT64 dirent_size)
450   const char *dirent_name, osd_dir_entry_type dirent_type, UINT64 dirent_size, int is_selected)
464451{
465   int realloc_increment = 64;
466   int new_item_count;
467   ui_menu_item *new_item_list;
468452   osd_directory_entry *new_dirent = NULL;
469453
470   new_item_count = *menu_items - (*menu_items % realloc_increment) + realloc_increment;
471   new_item_list = realloc(*item_list, sizeof(**item_list) * new_item_count);
472   assert_always(new_item_list != NULL, "Out of memory");
473
474   *item_list = new_item_list;
475
476454   if (dirent_size != ~0)
477455   {
478      new_dirent = alloc_directory_entry(dirent_name, dirent_type, dirent_size);
456      new_dirent = alloc_directory_entry(menustate->manager_menustate->pool, dirent_name, dirent_type, dirent_size);
479457
480458      /* silly hack */
481459      if (text == dirent_name)
482460         text = new_dirent->name;
483461   }
484462
485   memset(&new_item_list[*menu_items], 0, sizeof(item_list[*menu_items]));
486   new_item_list[*menu_items].text = text;
487   new_item_list[*menu_items].subtext = subtext;
488   new_item_list[*menu_items].ref = new_dirent;
489   (*menu_items)++;
463   ui_menu_item_append(menu, text, subtext, 0, new_dirent);
464
465   if (is_selected)
466      ui_menu_set_selection(menu, new_dirent);
490467}
491468
492469
493470
494471/*-------------------------------------------------
495    build_file_selector_menu_items - creates and
472    menu_file_selector_populate - creates and
496473   allocates all menu items for a directory
497474-------------------------------------------------*/
498475
499static file_error build_file_selector_menu_items(const device_config *device, const char *path,
500   ui_menu_item **item_list, int *menu_items, int *selected)
476static file_error menu_file_selector_populate(running_machine *machine, ui_menu *menu, file_selector_menu_state *menustate)
501477{
502478   zippath_directory *directory = NULL;
503479   file_error err = FILERR_NONE;
r2956r2957
505481   const char *subtext;
506482   int count, i;
507483   image_device_info info;
484   const device_config *device = menustate->manager_menustate->selected_device;
485   const char *path = astring_c(menustate->manager_menustate->current_directory);
486   int is_selected;
508487
509   /* reset count */
510   *menu_items = 0;
511   *selected = 0;
512
513488   /* open the directory */
514489   err = zippath_opendir(path, &directory);
515490   if (err != FILERR_NONE)
516491      goto done;
517492
518493   /* add the "[empty slot]" entry */
519   append_menu_item(item_list, menu_items, SLOT_EMPTY, NULL, NULL, ENTTYPE_FILE, 0);
494   append_menu_item(menu, menustate, SLOT_EMPTY, NULL, NULL, ENTTYPE_FILE, 0, FALSE);
520495
521496   info = image_device_getinfo(device->machine->config, device);
522497   if (info.creatable && !zippath_is_zip(directory))
523498   {
524499      /* add the "[create]" entry */
525      append_menu_item(item_list, menu_items, SLOT_CREATE, NULL, NULL, ENTTYPE_FILE, 0);
500      append_menu_item(menu, menustate, SLOT_CREATE, NULL, NULL, ENTTYPE_FILE, 0, FALSE);
526501   }
527502
528503   /* add the drives */
529504   count = osd_num_devices();
530505   for (i = 0; i < count; i++)
531506   {
532      append_menu_item(item_list, menu_items,
507      append_menu_item(menu,
508         menustate,
533509         osd_get_device_name(i),
534510         "[DRIVE]",
535511         osd_get_device_name(i),
536512         ENTTYPE_DIR,
537         0);
513         0,
514         FALSE);
538515   }
539516
540517   /* build the menu for each item */
541518   while((dirent = zippath_readdir(directory)) != NULL)
542519   {
543520      /* set the selected item to be the first non-parent directory or file */
544      if ((*selected == 0) && strcmp(dirent->name, ".."))
545         *selected = *menu_items;
521      is_selected = (ui_menu_get_selection(menu) == NULL) && strcmp(dirent->name, "..");
546522
547523      /* choose text for the entry type */
548524      switch(dirent->type)
r2956r2957
559535      }
560536
561537      /* do we have to select this file? */
562      if (!mame_stricmp(astring_c(current_file), dirent->name))
563         *selected = *menu_items;
538      if (!mame_stricmp(astring_c(menustate->manager_menustate->current_file), dirent->name))
539         is_selected = TRUE;
564540
565541      /* record the menu item */
566      append_menu_item(item_list, menu_items, dirent->name, subtext, dirent->name, dirent->type, dirent->size);
542      append_menu_item(menu, menustate, dirent->name, subtext, dirent->name, dirent->type, dirent->size, is_selected);
567543   }
568544
569   /* add an item for the return */
570   append_menu_item(item_list, menu_items, "Return to Prior Menu", NULL, NULL, 0, ~0);
545   /* set up custom render proc */
546   ui_menu_set_custom_render(menu, file_selector_render_extra, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER, 0);
571547
572548done:
573549   if (directory != NULL)
r2956r2957
593569    menu_file_selector - file selector menu
594570-------------------------------------------------*/
595571
596static UINT32 menu_file_selector(running_machine *machine, UINT32 state)
572static void menu_file_selector(running_machine *machine, ui_menu *menu, void *parameter, void *state)
597573{
598   static ui_menu_item *item_list;
599   static int menu_items;
600
601574   file_error err;
602575   const osd_directory_entry *dirent;
603   int visible_items, selected, i;
576   int selected;
604577   astring *new_path;
605   fileselector_state fs_state;
606   int menu_is_built;
607   menu_extra extra;
578   const ui_menu_event *event;
579   ui_menu *child_menu;
580   file_selector_menu_state *menustate;
581   file_create_menu_state *child_menustate;
608582
609   /* interpret the state */
610   fs_state.i = state;
611   selected = fs_state.s.selected;
612   menu_is_built = fs_state.s.menu_is_built;
583   /* get menu state */
584   menustate = (file_selector_menu_state *) state;
613585
614   /* do we have to build the menu? */
615   if (!menu_is_built)
586   /* if the menu isn't built, populate now */
587   if (!ui_menu_populated(menu))
616588   {
617      err = build_file_selector_menu_items(selected_device, astring_c(current_directory),
618         &item_list, &menu_items, &selected);
589      err = menu_file_selector_populate(machine, menu, menustate);
590
591      /* pop out if there was an error */
619592      if (err != FILERR_NONE)
620593      {
621         /* if we error here, we must pop out */
622         fs_state.i = ui_menu_stack_pop();
623         goto done;
594         ui_menu_stack_pop(machine);
595         return;
624596      }
625
626      menu_is_built = TRUE;
627597   }
628598
629   /* compute extras */
630   memset(&extra, 0, sizeof(extra));
631   extra.top = ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER;
632   extra.render = file_selector_render_extra;
633
634   /* draw the menu */
635   visible_items = ui_menu_draw(item_list, menu_items, selected, &extra);
636
637   /* handle the keys */
638   if (ui_menu_generic_keys(machine, (UINT32 *) &selected, menu_items, visible_items))
599   /* process the menu */
600   event = ui_menu_process(menu, 0);
601   if (event != NULL && event->itemref != NULL)
639602   {
640      menu_is_built = FALSE;
641      goto done;
642   }
603      /* handle selections */
604      if (event->iptkey == IPT_UI_SELECT)
605      {
606         dirent = (const osd_directory_entry *) event->itemref;
607         ui_menu_reset(menu, 0);
643608
644   if (input_ui_pressed(machine, IPT_UI_SELECT))
645   {
646      dirent = (const osd_directory_entry *) item_list[selected].ref;
647      menu_is_built = FALSE;
609         switch(dirent->type)
610         {
611            case ENTTYPE_DIR:
612               /* prepare the selection in the new directory */
613               selected = 1;
614               if (!strcmp(dirent->name, ".."))
615                  zippath_parent_basename(menustate->manager_menustate->current_file, astring_c(menustate->manager_menustate->current_directory));
648616
649      switch(dirent->type)
650      {
651         case ENTTYPE_DIR:
652            /* prepare the selection in the new directory */
653            selected = 1;
654            if (!strcmp(dirent->name, ".."))
655               zippath_parent_basename(current_file, astring_c(current_directory));
617               /* change the directory */
618               new_path = zippath_combine(astring_alloc(), astring_c(menustate->manager_menustate->current_directory), dirent->name);
619               err = check_path(astring_c(new_path));
620               if (err != FILERR_NONE)
621               {
622                  /* this path is problematic; present the user with an error and bail */
623                  ui_popup_time(1, "Error accessing %s", astring_c(new_path));
624                  astring_free(new_path);
625                  break;
626               }
627               astring_free(menustate->manager_menustate->current_directory);
628               menustate->manager_menustate->current_directory = new_path;
629               break;
656630
657            /* change the directory */
658            new_path = zippath_combine(astring_alloc(), astring_c(current_directory), dirent->name);
659            err = check_path(astring_c(new_path));
660            if (err != FILERR_NONE)
661            {
662               /* this path is problematic; present the user with an error and bail */
663               ui_popup_time(1, "Error accessing %s", astring_c(new_path));
664               astring_free(new_path);
631            case ENTTYPE_FILE:
632               if (dirent->name != NULL)
633               {
634                  /* specified a file */
635                  new_path = zippath_combine(astring_alloc(), astring_c(menustate->manager_menustate->current_directory), dirent->name);
636                  image_load(menustate->manager_menustate->selected_device, astring_c(new_path));
637                  astring_free(new_path);
638               }
639               else if (!strcmp(dirent->name, SLOT_EMPTY))
640               {
641                  /* empty slot - unload */
642                  image_unload(menustate->manager_menustate->selected_device);
643               }
644               else if (!strcmp(dirent->name, SLOT_CREATE))
645               {
646                  /* create */
647                  child_menu = ui_menu_alloc(machine, menu_file_create, NULL);
648                  child_menustate = ui_menu_alloc_state(child_menu, sizeof(*child_menustate));
649                  child_menustate->manager_menustate = menustate->manager_menustate;
650                  ui_menu_stack_push(child_menu);
651               }
652               else
653               {
654                  fatalerror("Should not reach here");
655               }
656               ui_menu_stack_pop(machine);
665657               break;
666            }
667            astring_free(current_directory);
668            current_directory = new_path;
669            break;
670658
671         case ENTTYPE_FILE:
672            if (dirent->name != NULL)
673            {
674               /* specified a file */
675               new_path = zippath_combine(astring_alloc(), astring_c(current_directory), dirent->name);
676               image_load(selected_device, astring_c(new_path));
677               astring_free(new_path);
678            }
679            else if (!strcmp(item_list[selected].text, SLOT_EMPTY))
680            {
681               /* empty slot - unload */
682               image_unload(selected_device);
683            }
684            else if (!strcmp(item_list[selected].text, SLOT_CREATE))
685            {
686               /* create */
687               fs_state.i = ui_menu_stack_push(menu_file_create, 0);
688               goto done;
689            }
690            else
691            {
692               fatalerror("Should not reach here");
693            }
694            fs_state.i = ui_menu_stack_pop();
695            goto done;
696
697         default:
698            /* do nothing */
699            break;
700      }
701   }
702
703   /* reassemble state */
704   fs_state.s.selected = selected;
705   fs_state.s.menu_is_built = menu_is_built;
706
707done:
708   if (!menu_is_built && (item_list != NULL))
709   {
710      /* time to tear down the menus */
711      for (i = 0; i < menu_items; i++)
712      {
713         if (item_list[i].ref != NULL)
714         {
715            free(item_list[i].ref);
716            item_list[i].ref = NULL;
659            default:
660               /* do nothing */
661               break;
717662         }
718663      }
719      free(item_list);
720      item_list = NULL;
721664   }
722
723   return fs_state.i;
724665}
725666
726667
r2956r2957
741682   if (image_exists(device))
742683   {
743684      astring *astr = astring_alloc();
744      zippath_parent(astr, image_filename(selected_device));
685      zippath_parent(astr, image_filename(device));
745686      image_set_working_directory(device, astring_c(astr));
746687      astring_free(astr);
747688   }
r2956r2957
758699    special rendering
759700-------------------------------------------------*/
760701
761static void file_manager_render_extra(const menu_extra *extra, float origx1, float origy1, float origx2, float origy2)
702static void file_manager_render_extra(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float origx1, float origy1, float origx2, float origy2)
762703{
763   const char *path = (selected_device != NULL) ? image_filename(selected_device) : NULL;
764   extra_text_render(extra, origx1, origy1, origx2, origy2, NULL, path);
704//   const char *path = (selected_device != NULL) ? image_filename(selected_device) : NULL;
705//   extra_text_render(machine, menu, state, selectedref, top, bottom,
706//      origx1, origy1, origx2, origy2, NULL, path);
765707}
766708
767709
768710
769711/*-------------------------------------------------
770    menu_file_manager - main file manager menu
712    menu_file_manager_populate - populates the main
713   file manager menu
771714-------------------------------------------------*/
772715
773UINT32 menu_file_manager(running_machine *machine, UINT32 state)
716static void menu_file_manager_populate(running_machine *machine, ui_menu *menu, void *state)
774717{
775   const device_config *device;
776   ui_menu_item item_list[40];
777   int menu_items = 0;
778718   char buffer[2048];
779   int buffer_pos = 0;
780   const char *entry_typename;
719   const device_config *device;
781720   const char *entry_basename;
782   int visible_items;
783   int selected_absolute_index = -1;
784   fileselector_state fs_state;
785   menu_extra extra;
786721
787   /* possible cleanups from the file selector - ugly global variable usage */
788   selected_device = NULL;
789   if (current_directory != NULL)
790   {
791      astring_free(current_directory);
792      current_directory = NULL;
793   }
794   if (current_file != NULL)
795   {
796      astring_free(current_file);
797      current_file = NULL;
798   }
799
800722   /* cycle through all devices for this system */
801723   for (device = image_device_first(machine->config); device != NULL; device = image_device_next(device))
802724   {
803      /* sanity check */
804      if ((buffer_pos >= ARRAY_LENGTH(buffer) || (menu_items >= ARRAY_LENGTH(item_list))))
805         break;
806
807      /* is this selected? */
808      if (state == menu_items)
809      {
810         selected_device = device;
811         selected_absolute_index = image_absolute_index(device);
812      }
813
814725      /* get the image type/id */
815      entry_typename = &buffer[buffer_pos];
816      buffer_pos += snprintf(&buffer[buffer_pos],
817         ARRAY_LENGTH(buffer) - buffer_pos,
726      snprintf(buffer, ARRAY_LENGTH(buffer),
818727         "%s",
819         image_typename_id(device)) + 1;
728         image_typename_id(device));
820729
821730      /* get the base name */
822731      entry_basename = image_basename(device);
823732
824733      /* record the menu item */
825      memset(&item_list[menu_items], 0, sizeof(item_list[menu_items]));
826      item_list[menu_items].text = entry_typename;
827      item_list[menu_items].subtext = (entry_basename != NULL) ? entry_basename : "---";
828      menu_items++;
734      ui_menu_item_append(menu, buffer, (entry_basename != NULL) ? entry_basename : "---", 0, (void *) device);
829735   }
830736
831   /* add an item for the return */
832   memset(&item_list[menu_items], 0, sizeof(item_list[menu_items]));
833   item_list[menu_items++].text = "Return to Prior Menu";
737   /* set up custom render proc */
738   ui_menu_set_custom_render(menu, file_manager_render_extra, 0, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER);
739}
834740
835   /* compute extras */
836   memset(&extra, 0, sizeof(extra));
837   extra.bottom = ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER;
838   extra.render = file_manager_render_extra;
839741
840   /* draw the menu */
841   visible_items = ui_menu_draw(item_list, menu_items, state, &extra);
842742
843   /* handle the keys */
844   if (ui_menu_generic_keys(machine, &state, menu_items, visible_items))
845      return state;
743/*-------------------------------------------------
744    menu_file_manager - main file manager menu
745-------------------------------------------------*/
846746
847   /* was selected pressed? */
848   if (input_ui_pressed(machine, IPT_UI_SELECT))
747void menu_file_manager(running_machine *machine, ui_menu *menu, void *parameter, void *state)
748{
749   const ui_menu_event *event;
750   file_manager_menu_state *menustate;
751   ui_menu *child_menu;
752   file_selector_menu_state *child_menustate;
753
754   /* if no state, allocate now */
755   if (state == NULL)
756      state = ui_menu_alloc_state(menu, sizeof(*menustate));
757   menustate = (file_manager_menu_state *) state;
758
759   /* possible cleanups from the file selector - ugly global variable usage */
760   menustate->selected_device = NULL;
761   if (menustate->current_directory != NULL)
849762   {
850      if (selected_absolute_index >= 0)
763      astring_free(menustate->current_directory);
764      menustate->current_directory = NULL;
765   }
766   if (menustate->current_file != NULL)
767   {
768      astring_free(menustate->current_file);
769      menustate->current_file = NULL;
770   }
771   if (menustate->pool != NULL)
772   {
773      pool_free(menustate->pool);
774      menustate->pool = NULL;
775   }
776
777   /* if the menu isn't built, populate now */
778   if (!ui_menu_populated(menu))
779      menu_file_manager_populate(machine, menu, state);
780
781   /* process the menu */
782   event = ui_menu_process(menu, 0);
783   if (event != NULL && event->iptkey == IPT_UI_SELECT)
784   {
785      menustate->selected_device = (const device_config *) event->itemref;
786      if (menustate->selected_device != NULL)
851787      {
852788         /* ensure that the working directory for this device exists */
853         fix_working_directory(selected_device);
789         fix_working_directory(menustate->selected_device);
854790
855791         /* set up current_directory and current_file - depends on whether we have an image */
856         current_directory = astring_cpyc(astring_alloc(), image_working_directory(selected_device));
857         current_file = astring_cpyc(astring_alloc(),
858            image_exists(selected_device) ? image_basename(selected_device) : "");
792         menustate->current_directory = astring_cpyc(astring_alloc(), image_working_directory(menustate->selected_device));
793         menustate->current_file = astring_cpyc(astring_alloc(),
794            image_exists(menustate->selected_device) ? image_basename(menustate->selected_device) : "");
859795
860         memset(&fs_state, 0, sizeof(fs_state));
861         return ui_menu_stack_push(menu_file_selector, fs_state.i);
796         /* create a memory pool */
797         menustate->pool = pool_alloc(memory_error);
798
799         /* push the menu */
800         child_menu = ui_menu_alloc(machine, menu_file_selector, NULL);
801         child_menustate = ui_menu_alloc_state(child_menu, sizeof(*child_menustate));
802         child_menustate->manager_menustate = menustate;
803         ui_menu_stack_push(child_menu);
862804      }
863      else
864      {
865         return ui_menu_stack_pop();
866      }
867805   }
868
869   return state;
870806}
src/mess/osd/windows/menu.c
r2956r2957
16531653{
16541654   render_target_set_orientation(window->target, orientation);
16551655   if (window->target == render_get_ui_target())
1656      render_container_set_orientation(render_container_get_ui(), orientation);
1656   {
1657      render_container_user_settings settings;
1658      render_container_get_user_settings(render_container_get_ui(), &settings);
1659      settings.orientation = orientation;
1660      render_container_set_user_settings(render_container_get_ui(), &settings);
1661   }
16571662   winwindow_video_window_update(window);
16581663}
16591664
src/mess/drivers/x68k.c
r2956r2957
920920*/
921921static WRITE16_HANDLER( x68k_sysport_w )
922922{
923   render_container* container;
923   //render_container* container;
924924   switch(offset)
925925   {
926926   case 0x00:
927927      sys.sysport.contrast = data & 0x0f;  // often used for screen fades / blanking
928      container = render_container_get_screen(machine->primary_screen);
929      render_container_set_brightness(container,(float)(sys.sysport.contrast) / 14.0);
928      //container = render_container_get_screen(machine->primary_screen);
929      //render_container_set_brightness(container,(float)(sys.sysport.contrast) / 14.0);
930930      break;
931931   case 0x01:
932932      sys.sysport.monitor = data & 0x08;
src/mess/drivers/ip20.c
r2956r2957
7878      }
7979      else
8080      {
81         int length;
82         UINT8 *dat;
81         UINT32 length;
82         void *dat;
8383
84         dat = eeprom_get_data_pointer(&length);
84         dat = eeprom_get_data_pointer(&length, NULL);
8585         memset(dat, 0, length);
8686      }
8787   }
docs/messnew.txt
r2956r2957
2828
2929Source Changes:
3030----------------
31(none)
31- The core is based on MAME 0.126u1.  This incorporates all features of the
32  update to this core.  [MAME team]
3233
3334
3435

Previous 15994 Revisions Next


© 1998-2018 The MESS Team