1
/******************************************************************************
3
Machine Hardware for Nichibutsu Mahjong series.
5
Driver by Takahiro Nogi <nogi@kt.rim.or.jp> 1999/11/05 -
7
******************************************************************************/
8
/******************************************************************************
11
******************************************************************************/
14
#include "cpu/z80/z80.h"
15
#include "includes/nb1413m3.h"
18
#define NB1413M3_DEBUG 0
19
#define NB1413M3_CHEAT 0
23
//int nb1413m3_sndromregion;
24
const char * nb1413m3_sndromrgntag;
25
int nb1413m3_sndrombank1;
26
int nb1413m3_sndrombank2;
28
int nb1413m3_busyflag;
29
int nb1413m3_inputport;
31
static int nb1413m3_74ls193_counter;
32
static int nb1413m3_nmi_count; // for debug
33
static int nb1413m3_nmi_clock;
34
static int nb1413m3_nmi_enable;
35
static int nb1413m3_counter;
36
static int nb1413m3_gfxradr_l;
37
static int nb1413m3_gfxradr_h;
38
static int nb1413m3_gfxrombank;
39
static int nb1413m3_outcoin_enable;
40
static int nb1413m3_outcoin_flag;
43
#define NB1413M3_TIMER_BASE 20000000
44
static TIMER_CALLBACK( nb1413m3_timer_callback )
46
machine.scheduler().timer_set(attotime::from_hz(NB1413M3_TIMER_BASE) * 256, FUNC(nb1413m3_timer_callback));
48
nb1413m3_74ls193_counter++;
49
nb1413m3_74ls193_counter &= 0x0f;
51
if (nb1413m3_74ls193_counter == 0x0f)
54
if (nb1413m3_nmi_enable)
56
cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
61
switch (nb1413m3_type)
63
case NB1413M3_TAIWANMB:
64
nb1413m3_74ls193_counter = 0x05; // 130 ???
66
case NB1413M3_OMOTESND:
67
nb1413m3_74ls193_counter = 0x05; // 130 ???
69
case NB1413M3_PASTELG:
70
nb1413m3_74ls193_counter = 0x02; // 96 ???
74
nb1413m3_74ls193_counter = 0x05; // 128 ???
81
// nbmj1413m3_nmi_clock_w ?w??
82
// ----------------------------------------------------------------------------------------------------------------
83
// nbmj8688 Z80:5.00MHz (20000000/4)
84
// 7 144-145 mjsikaku, mjsikakb, otonano, mjcamera
86
// ----------------------------------------------------------------------------------------------------------------
87
// nbmj8891 Z80:5.00MHz (20000000/4)
88
// 7 144-145 msjiken, telmahjn, mjcamerb, mmcamera
90
// ----------------------------------------------------------------------------------------------------------------
91
// nbmj8688 Z80:5.00MHz (20000000/4)
92
// 6 130-131 kaguya, kaguya2, idhimitu
94
// ----------------------------------------------------------------------------------------------------------------
95
// nbmj8891 Z80:5.00MHz (20000000/4)
96
// 6 130-131 hanamomo, gionbana, mgion, abunai, mjfocus, mjfocusm, peepshow, scandal, scandalm, mgmen89,
97
// mjnanpas, mjnanpaa, mjnanpau, bananadr, mladyhtr, chinmoku, club90s, club90sa, lovehous,
98
// maiko, mmaiko, hanaoji, pairsten
100
// ----------------------------------------------------------------------------------------------------------------
101
// nbmj8991 Z80:5MHz (25000000/5)
102
// 6 130-131 galkoku, hyouban, galkaika, tokyogal, tokimbsj, mcontest, uchuuai
104
// ----------------------------------------------------------------------------------------------------------------
105
// nbmj8688 Z80:5.00MHz (20000000/4)
106
// 6 81- 82 crystalg(DAC?????x??), crystal2(DAC?????x??)
107
// 6 130-131 bijokkoy(?A?j????), bijokkog(?A?j????)
109
// ----------------------------------------------------------------------------------------------------------------
110
// nbmj8688 Z80:5.00MHz (20000000/4)
111
// 4 108-109 bijokkoy(?A?j????), bijokkog(?A?j????)
113
// ----------------------------------------------------------------------------------------------------------------
115
// nbmj1413m3_nmi_clock_w ???w??
116
//*5 130-131? hyhoo, hyhoo2 5.00MHz (????????DAC???????x???????????c)
117
//*5 130-131? taiwanmb 5.00MHz (???@??????????DAC???????x?s??)
118
//*5 128-129? omotesnd 5.00MHz
119
//*2 100-101? pastelg 2.496MHz (19968000/8) ???
123
MACHINE_RESET( nb1413m3 )
125
nb1413m3_nmi_clock = 0;
126
nb1413m3_nmi_enable = 0;
127
nb1413m3_nmi_count = 0;
128
nb1413m3_74ls193_counter = 0;
129
nb1413m3_counter = 0;
130
nb1413m3_sndromrgntag = "voice";
131
nb1413m3_sndrombank1 = 0;
132
nb1413m3_sndrombank2 = 0;
133
nb1413m3_busyctr = 0;
134
nb1413m3_busyflag = 1;
135
nb1413m3_gfxradr_l = 0;
136
nb1413m3_gfxradr_h = 0;
137
nb1413m3_gfxrombank = 0;
138
nb1413m3_inputport = 0xff;
139
nb1413m3_outcoin_flag = 1;
141
nb1413m3_74ls193_counter = 0;
143
machine.scheduler().synchronize(FUNC(nb1413m3_timer_callback));
146
WRITE8_HANDLER( nb1413m3_nmi_clock_w )
148
nb1413m3_nmi_clock = data;
150
switch (nb1413m3_type)
152
case NB1413M3_APPAREL:
153
case NB1413M3_CITYLOVE:
154
case NB1413M3_MCITYLOV:
155
case NB1413M3_SECOLOVE:
157
case NB1413M3_SEIHAM:
158
case NB1413M3_IEMOTO:
159
case NB1413M3_IEMOTOM:
160
case NB1413M3_BIJOKKOY:
161
case NB1413M3_BIJOKKOG:
162
case NB1413M3_RYUUHA:
163
case NB1413M3_OJOUSAN:
164
case NB1413M3_OJOUSANM:
165
case NB1413M3_KORINAI:
166
case NB1413M3_KORINAIM:
167
case NB1413M3_HOUSEMNQ:
168
case NB1413M3_HOUSEMN2:
169
case NB1413M3_LIVEGAL:
170
case NB1413M3_ORANGEC:
171
case NB1413M3_ORANGECI:
172
case NB1413M3_VIPCLUB:
173
case NB1413M3_MMSIKAKU:
174
case NB1413M3_KANATUEN:
175
case NB1413M3_KYUHITO:
176
nb1413m3_nmi_clock -= 1;
179
case NB1413M3_NIGHTLOV:
180
nb1413m3_nmi_enable = ((data & 0x08) >> 3);
181
nb1413m3_nmi_enable |= ((data & 0x01) ^ 0x01);
182
nb1413m3_nmi_clock -= 1;
184
nb1413m3_sndrombank1 = 1;
189
nb1413m3_74ls193_counter = ((nb1413m3_nmi_clock & 0xf0) >> 4);
193
INTERRUPT_GEN( nb1413m3_interrupt )
196
if (!cpu_getiloops(device))
198
// nb1413m3_busyflag = 1;
199
// nb1413m3_busyctr = 0;
200
device_set_input_line(device, 0, HOLD_LINE);
202
if (nb1413m3_nmi_enable)
204
device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
208
#include "nbmjchet.inc"
211
// nb1413m3_busyflag = 1;
212
// nb1413m3_busyctr = 0;
213
device_set_input_line(device, 0, HOLD_LINE);
216
popmessage("NMI SW:%01X CLOCK:%02X COUNT:%02X", nb1413m3_nmi_enable, nb1413m3_nmi_clock, nb1413m3_nmi_count);
217
nb1413m3_nmi_count = 0;
221
#include "nbmjchet.inc"
226
READ8_HANDLER( nb1413m3_sndrom_r )
230
/* get top 8 bits of the I/O port address */
231
offset = (offset << 8) | (cpu_get_reg(&space->device(), Z80_BC) >> 8);
233
switch (nb1413m3_type)
235
case NB1413M3_IEMOTO:
236
case NB1413M3_IEMOTOM:
238
case NB1413M3_SEIHAM:
239
case NB1413M3_RYUUHA:
240
case NB1413M3_OJOUSAN:
241
case NB1413M3_OJOUSANM:
242
case NB1413M3_MJSIKAKU:
243
case NB1413M3_MMSIKAKU:
244
case NB1413M3_KORINAI:
245
case NB1413M3_KORINAIM:
246
rombank = (nb1413m3_sndrombank2 << 1) + (nb1413m3_sndrombank1 & 0x01);
249
case NB1413M3_HYHOO2:
250
rombank = (nb1413m3_sndrombank1 & 0x01);
252
case NB1413M3_APPAREL: // no samples
253
case NB1413M3_NIGHTLOV: // 0-1
254
case NB1413M3_SECOLOVE: // 0-1
255
case NB1413M3_CITYLOVE: // 0-1
256
case NB1413M3_MCITYLOV: // 0-1
257
case NB1413M3_HOUSEMNQ: // 0-1
258
case NB1413M3_HOUSEMN2: // 0-1
259
case NB1413M3_LIVEGAL: // 0-1
260
case NB1413M3_ORANGEC: // 0-1
261
case NB1413M3_KAGUYA: // 0-3
262
case NB1413M3_KAGUYA2: // 0-3 + 4-5 for protection
263
case NB1413M3_BIJOKKOY: // 0-7
264
case NB1413M3_BIJOKKOG: // 0-7
265
case NB1413M3_OTONANO: // 0-7
266
case NB1413M3_MJCAMERA: // 0 + 4-5 for protection
267
case NB1413M3_IDHIMITU: // 0 + 4-5 for protection
268
case NB1413M3_KANATUEN: // 0 + 6 for protection
269
rombank = nb1413m3_sndrombank1;
271
case NB1413M3_TAIWANMB:
272
case NB1413M3_OMOTESND:
273
case NB1413M3_SCANDAL:
274
case NB1413M3_SCANDALM:
275
case NB1413M3_MJFOCUSM:
276
case NB1413M3_BANANADR:
277
offset = (((offset & 0x7f00) >> 8) | ((offset & 0x0080) >> 0) | ((offset & 0x007f) << 8));
278
rombank = (nb1413m3_sndrombank1 >> 1);
280
case NB1413M3_MMCAMERA:
281
case NB1413M3_MSJIKEN:
282
case NB1413M3_HANAMOMO:
283
case NB1413M3_TELMAHJN:
284
case NB1413M3_GIONBANA:
286
case NB1413M3_MGMEN89:
287
case NB1413M3_MJFOCUS:
288
case NB1413M3_GALKOKU:
289
case NB1413M3_HYOUBAN:
290
case NB1413M3_MJNANPAS:
291
case NB1413M3_MLADYHTR:
292
case NB1413M3_CLUB90S:
293
case NB1413M3_OHPAIPEE:
294
case NB1413M3_TOGENKYO:
295
case NB1413M3_LOVEHOUS:
296
case NB1413M3_CHINMOKU:
297
case NB1413M3_GALKAIKA:
298
case NB1413M3_MCONTEST:
299
case NB1413M3_UCHUUAI:
300
case NB1413M3_TOKIMBSJ:
301
case NB1413M3_TOKYOGAL:
303
case NB1413M3_MMAIKO:
304
case NB1413M3_HANAOJI:
305
case NB1413M3_PAIRSNB:
306
case NB1413M3_PAIRSTEN:
308
rombank = (nb1413m3_sndrombank1 >> 1);
312
offset += 0x08000 * rombank;
315
popmessage("Sound ROM %02X:%05X [B1:%02X B2:%02X]", rombank, offset, nb1413m3_sndrombank1, nb1413m3_sndrombank2);
318
if (offset < space->machine().region(nb1413m3_sndromrgntag)->bytes())
319
return space->machine().region(nb1413m3_sndromrgntag)->base()[offset];
322
popmessage("read past sound ROM length (%05x[%02X])",offset, rombank);
327
WRITE8_HANDLER( nb1413m3_sndrombank1_w )
329
// if (data & 0x02) coin counter ?
330
nb1413m3_outcoin_w(space, 0, data); // (data & 0x04) >> 2;
331
nb1413m3_nmi_enable = ((data & 0x20) >> 5);
332
nb1413m3_sndrombank1 = (((data & 0xc0) >> 5) | ((data & 0x10) >> 4));
335
WRITE8_HANDLER( nb1413m3_sndrombank2_w )
337
nb1413m3_sndrombank2 = (data & 0x03);
340
READ8_HANDLER( nb1413m3_gfxrom_r )
342
UINT8 *GFXROM = space->machine().region("gfx1")->base();
344
return GFXROM[(0x20000 * (nb1413m3_gfxrombank | ((nb1413m3_sndrombank1 & 0x02) << 3))) + ((0x0200 * nb1413m3_gfxradr_h) + (0x0002 * nb1413m3_gfxradr_l)) + (offset & 0x01)];
347
WRITE8_HANDLER( nb1413m3_gfxrombank_w )
349
nb1413m3_gfxrombank = (((data & 0xc0) >> 4) + (data & 0x03));
352
WRITE8_HANDLER( nb1413m3_gfxradr_l_w )
354
nb1413m3_gfxradr_l = data;
357
WRITE8_HANDLER( nb1413m3_gfxradr_h_w )
359
nb1413m3_gfxradr_h = data;
362
WRITE8_HANDLER( nb1413m3_inputportsel_w )
364
nb1413m3_inputport = data;
367
CUSTOM_INPUT( nb1413m3_busyflag_r )
369
return nb1413m3_busyflag & 0x01;
374
* In ALL games (but pastelg, hyhoo & hyhoo2) nb1413m3_outcoin_flag is read at inputport0.
375
* However, a few games (lovehous, maiko, mmaiko, hanaoji and the ones using inputport3_r below)
376
* read nb1413m3_outcoin_flag also at inputport3! Is this the correct behaviour for these games
377
* or should they only check the flag at inputport3? */
378
CUSTOM_INPUT( nb1413m3_outcoin_flag_r )
380
return nb1413m3_outcoin_flag & 0x01;
383
READ8_HANDLER( nb1413m3_inputport0_r )
385
return ((input_port_read(space->machine(), "SYSTEM") & 0xfd) | ((nb1413m3_outcoin_flag & 0x01) << 1));
388
READ8_HANDLER( nb1413m3_inputport1_r )
390
switch (nb1413m3_type)
393
case NB1413M3_HYHOO2:
394
switch ((nb1413m3_inputport ^ 0xff) & 0x07)
396
case 0x01: return input_port_read(space->machine(), "IN0");
397
case 0x02: return input_port_read(space->machine(), "IN1");
398
case 0x04: return 0xff;
399
default: return 0xff;
402
case NB1413M3_MSJIKEN:
403
case NB1413M3_TELMAHJN:
404
if (input_port_read(space->machine(), "DSWA") & 0x80)
406
switch ((nb1413m3_inputport ^ 0xff) & 0x1f)
408
case 0x01: return input_port_read(space->machine(), "KEY0");
409
case 0x02: return input_port_read(space->machine(), "KEY1");
410
case 0x04: return input_port_read(space->machine(), "KEY2");
411
case 0x08: return input_port_read(space->machine(), "KEY3");
412
case 0x10: return input_port_read(space->machine(), "KEY4");
413
default: return (input_port_read(space->machine(), "KEY0") & input_port_read(space->machine(), "KEY1") & input_port_read(space->machine(), "KEY2")
414
& input_port_read(space->machine(), "KEY3") & input_port_read(space->machine(), "KEY4"));
417
else return input_port_read(space->machine(), "JAMMA2");
419
case NB1413M3_PAIRSNB:
420
case NB1413M3_PAIRSTEN:
421
case NB1413M3_OHPAIPEE:
422
case NB1413M3_TOGENKYO:
423
return input_port_read(space->machine(), "P1");
425
switch ((nb1413m3_inputport ^ 0xff) & 0x1f)
427
case 0x01: return input_port_read(space->machine(), "KEY0");
428
case 0x02: return input_port_read(space->machine(), "KEY1");
429
case 0x04: return input_port_read(space->machine(), "KEY2");
430
case 0x08: return input_port_read(space->machine(), "KEY3");
431
case 0x10: return input_port_read(space->machine(), "KEY4");
432
default: return (input_port_read(space->machine(), "KEY0") & input_port_read(space->machine(), "KEY1") & input_port_read(space->machine(), "KEY2")
433
& input_port_read(space->machine(), "KEY3") & input_port_read(space->machine(), "KEY4"));
439
READ8_HANDLER( nb1413m3_inputport2_r )
441
switch (nb1413m3_type)
444
case NB1413M3_HYHOO2:
445
switch ((nb1413m3_inputport ^ 0xff) & 0x07)
447
case 0x01: return 0xff;
448
case 0x02: return 0xff;
449
case 0x04: return input_port_read(space->machine(), "IN2");
450
default: return 0xff;
453
case NB1413M3_MSJIKEN:
454
case NB1413M3_TELMAHJN:
455
if (input_port_read(space->machine(), "DSWA") & 0x80)
457
switch ((nb1413m3_inputport ^ 0xff) & 0x1f)
459
case 0x01: return input_port_read(space->machine(), "KEY5");
460
case 0x02: return input_port_read(space->machine(), "KEY6");
461
case 0x04: return input_port_read(space->machine(), "KEY7");
462
case 0x08: return input_port_read(space->machine(), "KEY8");
463
case 0x10: return input_port_read(space->machine(), "KEY9");
464
default: return (input_port_read(space->machine(), "KEY5") & input_port_read(space->machine(), "KEY6") & input_port_read(space->machine(), "KEY7")
465
& input_port_read(space->machine(), "KEY8") & input_port_read(space->machine(), "KEY9"));
468
else return input_port_read(space->machine(), "JAMMA1");
470
case NB1413M3_PAIRSNB:
471
case NB1413M3_PAIRSTEN:
472
case NB1413M3_OHPAIPEE:
473
case NB1413M3_TOGENKYO:
474
return input_port_read(space->machine(), "P2");
476
switch ((nb1413m3_inputport ^ 0xff) & 0x1f)
478
case 0x01: return input_port_read(space->machine(), "KEY5");
479
case 0x02: return input_port_read(space->machine(), "KEY6");
480
case 0x04: return input_port_read(space->machine(), "KEY7");
481
case 0x08: return input_port_read(space->machine(), "KEY8");
482
case 0x10: return input_port_read(space->machine(), "KEY9");
483
default: return (input_port_read(space->machine(), "KEY5") & input_port_read(space->machine(), "KEY6") & input_port_read(space->machine(), "KEY7")
484
& input_port_read(space->machine(), "KEY8") & input_port_read(space->machine(), "KEY9"));
490
READ8_HANDLER( nb1413m3_inputport3_r )
492
switch (nb1413m3_type)
494
case NB1413M3_TAIWANMB:
495
case NB1413M3_IEMOTOM:
496
case NB1413M3_OJOUSANM:
497
case NB1413M3_SEIHAM:
498
case NB1413M3_RYUUHA:
499
case NB1413M3_KORINAIM:
500
case NB1413M3_HYOUBAN:
501
case NB1413M3_TOKIMBSJ:
502
case NB1413M3_MJFOCUSM:
503
case NB1413M3_SCANDALM:
504
case NB1413M3_BANANADR:
505
case NB1413M3_FINALBNY:
506
case NB1413M3_MMSIKAKU:
507
return ((nb1413m3_outcoin_flag & 0x01) << 1);
513
READ8_HANDLER( nb1413m3_dipsw1_r )
515
switch (nb1413m3_type)
517
case NB1413M3_KANATUEN:
518
case NB1413M3_KYUHITO:
519
return input_port_read(space->machine(), "DSWB");
520
case NB1413M3_TAIWANMB:
521
return ((input_port_read(space->machine(), "DSWA") & 0xf0) | ((input_port_read(space->machine(), "DSWB") & 0xf0) >> 4));
522
case NB1413M3_OTONANO:
523
case NB1413M3_MJCAMERA:
524
case NB1413M3_IDHIMITU:
525
case NB1413M3_KAGUYA2:
526
return (((input_port_read(space->machine(), "DSWA") & 0x0f) << 4) | (input_port_read(space->machine(), "DSWB") & 0x0f));
527
case NB1413M3_SCANDAL:
528
case NB1413M3_SCANDALM:
529
case NB1413M3_MJFOCUSM:
530
case NB1413M3_GALKOKU:
531
case NB1413M3_HYOUBAN:
532
case NB1413M3_GALKAIKA:
533
case NB1413M3_MCONTEST:
534
case NB1413M3_UCHUUAI:
535
case NB1413M3_TOKIMBSJ:
536
case NB1413M3_TOKYOGAL:
537
return ((input_port_read(space->machine(), "DSWA") & 0x0f) | ((input_port_read(space->machine(), "DSWB") & 0x0f) << 4));
538
case NB1413M3_TRIPLEW1:
539
case NB1413M3_NTOPSTAR:
540
case NB1413M3_PSTADIUM:
541
case NB1413M3_TRIPLEW2:
542
case NB1413M3_VANILLA:
543
case NB1413M3_FINALBNY:
544
case NB1413M3_MJLSTORY:
545
case NB1413M3_QMHAYAKU:
546
case NB1413M3_MJGOTTUB:
547
return (((input_port_read(space->machine(), "DSWB") & 0x01) >> 0) | ((input_port_read(space->machine(), "DSWB") & 0x04) >> 1) |
548
((input_port_read(space->machine(), "DSWB") & 0x10) >> 2) | ((input_port_read(space->machine(), "DSWB") & 0x40) >> 3) |
549
((input_port_read(space->machine(), "DSWA") & 0x01) << 4) | ((input_port_read(space->machine(), "DSWA") & 0x04) << 3) |
550
((input_port_read(space->machine(), "DSWA") & 0x10) << 2) | ((input_port_read(space->machine(), "DSWA") & 0x40) << 1));
552
return input_port_read(space->machine(), "DSWA");
556
READ8_HANDLER( nb1413m3_dipsw2_r )
558
switch (nb1413m3_type)
560
case NB1413M3_KANATUEN:
561
case NB1413M3_KYUHITO:
562
return input_port_read(space->machine(), "DSWA");
563
case NB1413M3_TAIWANMB:
564
return (((input_port_read(space->machine(), "DSWA") & 0x0f) << 4) | (input_port_read(space->machine(), "DSWB") & 0x0f));
565
case NB1413M3_OTONANO:
566
case NB1413M3_MJCAMERA:
567
case NB1413M3_IDHIMITU:
568
case NB1413M3_KAGUYA2:
569
return ((input_port_read(space->machine(), "DSWA") & 0xf0) | ((input_port_read(space->machine(), "DSWB") & 0xf0) >> 4));
570
case NB1413M3_SCANDAL:
571
case NB1413M3_SCANDALM:
572
case NB1413M3_MJFOCUSM:
573
case NB1413M3_GALKOKU:
574
case NB1413M3_HYOUBAN:
575
case NB1413M3_GALKAIKA:
576
case NB1413M3_MCONTEST:
577
case NB1413M3_UCHUUAI:
578
case NB1413M3_TOKIMBSJ:
579
case NB1413M3_TOKYOGAL:
580
return (((input_port_read(space->machine(), "DSWA") & 0xf0) >> 4) | (input_port_read(space->machine(), "DSWB") & 0xf0));
581
case NB1413M3_TRIPLEW1:
582
case NB1413M3_NTOPSTAR:
583
case NB1413M3_PSTADIUM:
584
case NB1413M3_TRIPLEW2:
585
case NB1413M3_VANILLA:
586
case NB1413M3_FINALBNY:
587
case NB1413M3_MJLSTORY:
588
case NB1413M3_QMHAYAKU:
589
case NB1413M3_MJGOTTUB:
590
return (((input_port_read(space->machine(), "DSWB") & 0x02) >> 1) | ((input_port_read(space->machine(), "DSWB") & 0x08) >> 2) |
591
((input_port_read(space->machine(), "DSWB") & 0x20) >> 3) | ((input_port_read(space->machine(), "DSWB") & 0x80) >> 4) |
592
((input_port_read(space->machine(), "DSWA") & 0x02) << 3) | ((input_port_read(space->machine(), "DSWA") & 0x08) << 2) |
593
((input_port_read(space->machine(), "DSWA") & 0x20) << 1) | ((input_port_read(space->machine(), "DSWA") & 0x80) << 0));
595
return input_port_read(space->machine(), "DSWB");
599
READ8_HANDLER( nb1413m3_dipsw3_l_r )
601
return ((input_port_read(space->machine(), "DSWC") & 0xf0) >> 4);
604
READ8_HANDLER( nb1413m3_dipsw3_h_r )
606
return ((input_port_read(space->machine(), "DSWC") & 0x0f) >> 0);
609
WRITE8_HANDLER( nb1413m3_outcoin_w )
611
static int counter = 0;
613
nb1413m3_outcoin_enable = (data & 0x04) >> 2;
615
switch (nb1413m3_type)
617
case NB1413M3_TAIWANMB:
618
case NB1413M3_IEMOTOM:
619
case NB1413M3_OJOUSANM:
620
case NB1413M3_SEIHAM:
621
case NB1413M3_RYUUHA:
622
case NB1413M3_KORINAIM:
623
case NB1413M3_MMSIKAKU:
624
case NB1413M3_HYOUBAN:
625
case NB1413M3_TOKIMBSJ:
626
case NB1413M3_MJFOCUSM:
627
case NB1413M3_SCANDALM:
628
case NB1413M3_BANANADR:
630
case NB1413M3_HANAOJI:
631
case NB1413M3_FINALBNY:
632
case NB1413M3_LOVEHOUS:
633
case NB1413M3_MMAIKO:
634
if (nb1413m3_outcoin_enable)
638
nb1413m3_outcoin_flag ^= 1;
647
set_led_status(space->machine(), 2, nb1413m3_outcoin_flag); // out coin
650
WRITE8_HANDLER( nb1413m3_vcrctrl_w )
654
popmessage(" ** VCR CONTROL ** ");
655
set_led_status(space->machine(), 2, 1);
659
set_led_status(space->machine(), 2, 0);
663
/* Nichibutsu Mahjong games share a common control panel */
664
INPUT_PORTS_START( nbmjcontrols )
666
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
667
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
668
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_M )
669
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_I )
670
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_E )
671
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_A )
672
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
673
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
676
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
677
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
678
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_N )
679
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_J )
680
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_F )
681
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_B )
682
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
683
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
686
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
687
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
688
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
689
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_K )
690
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_G )
691
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_C )
692
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
693
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
696
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
697
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
698
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
699
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_L )
700
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_H )
701
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_D )
702
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
703
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
706
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL )
707
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_BIG )
708
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP )
709
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
710
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
711
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
712
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
713
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
716
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )
717
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_KAN ) PORT_PLAYER(2)
718
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_M ) PORT_PLAYER(2)
719
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_I ) PORT_PLAYER(2)
720
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_E ) PORT_PLAYER(2)
721
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_A ) PORT_PLAYER(2)
722
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
723
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
726
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) PORT_PLAYER(2)
727
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_REACH ) PORT_PLAYER(2)
728
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_N ) PORT_PLAYER(2)
729
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_J ) PORT_PLAYER(2)
730
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_F ) PORT_PLAYER(2)
731
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_B ) PORT_PLAYER(2)
732
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
733
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
736
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
737
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_RON ) PORT_PLAYER(2)
738
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_CHI ) PORT_PLAYER(2)
739
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_K ) PORT_PLAYER(2)
740
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_G ) PORT_PLAYER(2)
741
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_C ) PORT_PLAYER(2)
742
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
743
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
746
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
747
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
748
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_PON ) PORT_PLAYER(2)
749
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_L ) PORT_PLAYER(2)
750
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_H ) PORT_PLAYER(2)
751
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_D ) PORT_PLAYER(2)
752
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
753
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
756
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL ) PORT_PLAYER(2)
757
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_BIG ) PORT_PLAYER(2)
758
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_FLIP_FLOP ) PORT_PLAYER(2)
759
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP ) PORT_PLAYER(2)
760
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE ) PORT_PLAYER(2)
761
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE ) PORT_PLAYER(2)
762
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
763
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
766
/* Hanafuda controls share part of the mahjong panel. Notice that some of the remaining
767
inputs are detected in Service Mode, even if we label them as IPT_UNKNOWN because they
768
do not correspond to actual inputs */
769
INPUT_PORTS_START( nbhf1_ctrl ) // used by gionbana, mgion, abunai
771
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
772
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
773
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
774
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
775
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_HANAFUDA_E )
776
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_HANAFUDA_A )
777
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
778
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
781
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
782
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_HANAFUDA_YES )
783
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
784
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
785
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_HANAFUDA_F )
786
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_HANAFUDA_B )
787
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
788
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
791
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
792
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_HANAFUDA_NO )
793
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
794
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
795
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_HANAFUDA_G )
796
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_HANAFUDA_C )
797
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
798
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
801
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
802
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
803
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
804
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
805
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_HANAFUDA_H )
806
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_HANAFUDA_D )
807
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
808
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
811
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
812
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
813
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
814
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
815
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
816
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
817
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
818
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
821
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )
822
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
823
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
824
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
825
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_HANAFUDA_E ) PORT_PLAYER(2)
826
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_HANAFUDA_A ) PORT_PLAYER(2)
827
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
828
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
831
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_BET ) PORT_PLAYER(2)
832
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_HANAFUDA_YES ) PORT_PLAYER(2)
833
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
834
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
835
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_HANAFUDA_F ) PORT_PLAYER(2)
836
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_HANAFUDA_B ) PORT_PLAYER(2)
837
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
838
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
841
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
842
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_HANAFUDA_NO ) PORT_PLAYER(2)
843
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
844
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
845
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_HANAFUDA_G ) PORT_PLAYER(2)
846
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_HANAFUDA_C ) PORT_PLAYER(2)
847
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
848
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
851
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
852
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
853
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
854
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
855
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_HANAFUDA_H ) PORT_PLAYER(2)
856
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_HANAFUDA_D ) PORT_PLAYER(2)
857
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
858
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
861
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
862
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
863
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
864
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
865
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
866
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
867
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
868
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
871
INPUT_PORTS_START( nbhf2_ctrl ) // used by maiko, hanaoji, hnxmasev and hnageman
872
PORT_INCLUDE( nbhf1_ctrl )
875
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_HANAFUDA_YES )
878
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
879
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_HANAFUDA_NO )
882
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
885
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_HANAFUDA_YES ) PORT_PLAYER(2)
888
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
889
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_HANAFUDA_NO ) PORT_PLAYER(2)
892
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )