~ubuntu-branches/debian/sid/mame/sid

« back to all changes in this revision

Viewing changes to mess/src/mame/machine/nb1413m3.c

  • Committer: Package Import Robot
  • Author(s): Jordi Mallach, Jordi Mallach, Emmanuel Kasper
  • Date: 2011-12-19 22:56:27 UTC
  • mfrom: (0.1.2)
  • Revision ID: package-import@ubuntu.com-20111219225627-ub5oga1oys4ogqzm
Tags: 0.144-1
[ Jordi Mallach ]
* Fix syntax errors in DEP5 copyright file (lintian).
* Use a versioned copyright Format specification field.
* Update Vcs-* URLs.
* Move transitional packages to the new metapackages section, and make
  them priority extra.
* Remove references to GNU/Linux and MESS sources from copyright.
* Add build variables for s390x.
* Use .xz tarballs as it cuts 4MB for the upstream sources.
* Add nplayers.ini as a patch. Update copyright file to add CC-BY-SA-3.0.

[ Emmanuel Kasper ]
* New upstream release. Closes: #651538.
* Add Free Desktop compliant png icons of various sizes taken from
  the hydroxygen iconset
* Mess is now built from a new source package, to avoid possible source
  incompatibilities between mame and the mess overlay.
* Mame-tools are not built from the mame source package anymore, but
  from the mess source package

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/******************************************************************************
2
 
 
3
 
    Machine Hardware for Nichibutsu Mahjong series.
4
 
 
5
 
    Driver by Takahiro Nogi <nogi@kt.rim.or.jp> 1999/11/05 -
6
 
 
7
 
******************************************************************************/
8
 
/******************************************************************************
9
 
Memo:
10
 
 
11
 
******************************************************************************/
12
 
 
13
 
#include "emu.h"
14
 
#include "cpu/z80/z80.h"
15
 
#include "includes/nb1413m3.h"
16
 
 
17
 
 
18
 
#define NB1413M3_DEBUG  0
19
 
#define NB1413M3_CHEAT  0
20
 
 
21
 
 
22
 
int nb1413m3_type;
23
 
//int nb1413m3_sndromregion;
24
 
const char * nb1413m3_sndromrgntag;
25
 
int nb1413m3_sndrombank1;
26
 
int nb1413m3_sndrombank2;
27
 
int nb1413m3_busyctr;
28
 
int nb1413m3_busyflag;
29
 
int nb1413m3_inputport;
30
 
 
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;
41
 
 
42
 
 
43
 
#define NB1413M3_TIMER_BASE 20000000
44
 
static TIMER_CALLBACK( nb1413m3_timer_callback )
45
 
{
46
 
        machine.scheduler().timer_set(attotime::from_hz(NB1413M3_TIMER_BASE) * 256, FUNC(nb1413m3_timer_callback));
47
 
 
48
 
        nb1413m3_74ls193_counter++;
49
 
        nb1413m3_74ls193_counter &= 0x0f;
50
 
 
51
 
        if (nb1413m3_74ls193_counter == 0x0f)
52
 
        {
53
 
 
54
 
                if (nb1413m3_nmi_enable)
55
 
                {
56
 
                        cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
57
 
                        nb1413m3_nmi_count++;
58
 
                }
59
 
 
60
 
#if 1
61
 
                switch (nb1413m3_type)
62
 
                {
63
 
                        case NB1413M3_TAIWANMB:
64
 
                                nb1413m3_74ls193_counter = 0x05;        // 130 ???
65
 
                                break;
66
 
                        case NB1413M3_OMOTESND:
67
 
                                nb1413m3_74ls193_counter = 0x05;        // 130 ???
68
 
                                break;
69
 
                        case NB1413M3_PASTELG:
70
 
                                nb1413m3_74ls193_counter = 0x02;        // 96 ???
71
 
                                break;
72
 
                        case NB1413M3_HYHOO:
73
 
                        case NB1413M3_HYHOO2:
74
 
                                nb1413m3_74ls193_counter = 0x05;        // 128 ???
75
 
                                break;
76
 
                }
77
 
#endif
78
 
        }
79
 
 
80
 
#if 0
81
 
        // nbmj1413m3_nmi_clock_w ?w??
82
 
        // ----------------------------------------------------------------------------------------------------------------
83
 
        //                      nbmj8688    Z80:5.00MHz (20000000/4)
84
 
        // 7    144-145         mjsikaku, mjsikakb, otonano, mjcamera
85
 
 
86
 
        // ----------------------------------------------------------------------------------------------------------------
87
 
        //                      nbmj8891    Z80:5.00MHz (20000000/4)
88
 
        // 7    144-145         msjiken, telmahjn, mjcamerb, mmcamera
89
 
 
90
 
        // ----------------------------------------------------------------------------------------------------------------
91
 
        //                      nbmj8688    Z80:5.00MHz (20000000/4)
92
 
        // 6    130-131         kaguya, kaguya2, idhimitu
93
 
 
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
99
 
 
100
 
        // ----------------------------------------------------------------------------------------------------------------
101
 
        //                      nbmj8991    Z80:5MHz (25000000/5)
102
 
        // 6    130-131         galkoku, hyouban, galkaika, tokyogal, tokimbsj, mcontest, uchuuai
103
 
 
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????)
108
 
 
109
 
        // ----------------------------------------------------------------------------------------------------------------
110
 
        //                      nbmj8688    Z80:5.00MHz (20000000/4)
111
 
        // 4    108-109         bijokkoy(?A?j????), bijokkog(?A?j????)
112
 
 
113
 
        // ----------------------------------------------------------------------------------------------------------------
114
 
 
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) ???
120
 
#endif
121
 
}
122
 
 
123
 
MACHINE_RESET( nb1413m3 )
124
 
{
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;
140
 
 
141
 
        nb1413m3_74ls193_counter = 0;
142
 
 
143
 
        machine.scheduler().synchronize(FUNC(nb1413m3_timer_callback));
144
 
}
145
 
 
146
 
WRITE8_HANDLER( nb1413m3_nmi_clock_w )
147
 
{
148
 
        nb1413m3_nmi_clock = data;
149
 
 
150
 
        switch (nb1413m3_type)
151
 
        {
152
 
                case NB1413M3_APPAREL:
153
 
                case NB1413M3_CITYLOVE:
154
 
                case NB1413M3_MCITYLOV:
155
 
                case NB1413M3_SECOLOVE:
156
 
                case NB1413M3_SEIHA:
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;
177
 
                        break;
178
 
#if 1
179
 
                case NB1413M3_NIGHTLOV:
180
 
                        nb1413m3_nmi_enable = ((data & 0x08) >> 3);
181
 
                        nb1413m3_nmi_enable |= ((data & 0x01) ^ 0x01);
182
 
                        nb1413m3_nmi_clock -= 1;
183
 
 
184
 
                        nb1413m3_sndrombank1 = 1;
185
 
                        break;
186
 
#endif
187
 
        }
188
 
 
189
 
        nb1413m3_74ls193_counter = ((nb1413m3_nmi_clock & 0xf0) >> 4);
190
 
 
191
 
}
192
 
 
193
 
INTERRUPT_GEN( nb1413m3_interrupt )
194
 
{
195
 
#if 0
196
 
        if (!cpu_getiloops(device))
197
 
        {
198
 
//      nb1413m3_busyflag = 1;
199
 
//      nb1413m3_busyctr = 0;
200
 
                device_set_input_line(device, 0, HOLD_LINE);
201
 
        }
202
 
        if (nb1413m3_nmi_enable)
203
 
        {
204
 
                device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
205
 
        }
206
 
 
207
 
        #if NB1413M3_CHEAT
208
 
        #include "nbmjchet.inc"
209
 
        #endif
210
 
#else
211
 
//  nb1413m3_busyflag = 1;
212
 
//  nb1413m3_busyctr = 0;
213
 
        device_set_input_line(device, 0, HOLD_LINE);
214
 
 
215
 
#if NB1413M3_DEBUG
216
 
        popmessage("NMI SW:%01X CLOCK:%02X COUNT:%02X", nb1413m3_nmi_enable, nb1413m3_nmi_clock, nb1413m3_nmi_count);
217
 
        nb1413m3_nmi_count = 0;
218
 
#endif
219
 
 
220
 
        #if NB1413M3_CHEAT
221
 
        #include "nbmjchet.inc"
222
 
        #endif
223
 
#endif
224
 
}
225
 
 
226
 
READ8_HANDLER( nb1413m3_sndrom_r )
227
 
{
228
 
        int rombank;
229
 
 
230
 
        /* get top 8 bits of the I/O port address */
231
 
        offset = (offset << 8) | (cpu_get_reg(&space->device(), Z80_BC) >> 8);
232
 
 
233
 
        switch (nb1413m3_type)
234
 
        {
235
 
                case NB1413M3_IEMOTO:
236
 
                case NB1413M3_IEMOTOM:
237
 
                case NB1413M3_SEIHA:
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);
247
 
                        break;
248
 
                case NB1413M3_HYHOO:
249
 
                case NB1413M3_HYHOO2:
250
 
                        rombank = (nb1413m3_sndrombank1 & 0x01);
251
 
                        break;
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;
270
 
                        break;
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);
279
 
                        break;
280
 
                case NB1413M3_MMCAMERA:
281
 
                case NB1413M3_MSJIKEN:
282
 
                case NB1413M3_HANAMOMO:
283
 
                case NB1413M3_TELMAHJN:
284
 
                case NB1413M3_GIONBANA:
285
 
                case NB1413M3_MGION:
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:
302
 
                case NB1413M3_MAIKO:
303
 
                case NB1413M3_MMAIKO:
304
 
                case NB1413M3_HANAOJI:
305
 
                case NB1413M3_PAIRSNB:
306
 
                case NB1413M3_PAIRSTEN:
307
 
                default:
308
 
                        rombank = (nb1413m3_sndrombank1 >> 1);
309
 
                        break;
310
 
        }
311
 
 
312
 
        offset += 0x08000 * rombank;
313
 
 
314
 
#if NB1413M3_DEBUG
315
 
        popmessage("Sound ROM %02X:%05X [B1:%02X B2:%02X]", rombank, offset, nb1413m3_sndrombank1, nb1413m3_sndrombank2);
316
 
#endif
317
 
 
318
 
        if (offset < space->machine().region(nb1413m3_sndromrgntag)->bytes())
319
 
                return space->machine().region(nb1413m3_sndromrgntag)->base()[offset];
320
 
        else
321
 
        {
322
 
                popmessage("read past sound ROM length (%05x[%02X])",offset, rombank);
323
 
                return 0;
324
 
        }
325
 
}
326
 
 
327
 
WRITE8_HANDLER( nb1413m3_sndrombank1_w )
328
 
{
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));
333
 
}
334
 
 
335
 
WRITE8_HANDLER( nb1413m3_sndrombank2_w )
336
 
{
337
 
        nb1413m3_sndrombank2 = (data & 0x03);
338
 
}
339
 
 
340
 
READ8_HANDLER( nb1413m3_gfxrom_r )
341
 
{
342
 
        UINT8 *GFXROM = space->machine().region("gfx1")->base();
343
 
 
344
 
        return GFXROM[(0x20000 * (nb1413m3_gfxrombank | ((nb1413m3_sndrombank1 & 0x02) << 3))) + ((0x0200 * nb1413m3_gfxradr_h) + (0x0002 * nb1413m3_gfxradr_l)) + (offset & 0x01)];
345
 
}
346
 
 
347
 
WRITE8_HANDLER( nb1413m3_gfxrombank_w )
348
 
{
349
 
        nb1413m3_gfxrombank = (((data & 0xc0) >> 4) + (data & 0x03));
350
 
}
351
 
 
352
 
WRITE8_HANDLER( nb1413m3_gfxradr_l_w )
353
 
{
354
 
        nb1413m3_gfxradr_l = data;
355
 
}
356
 
 
357
 
WRITE8_HANDLER( nb1413m3_gfxradr_h_w )
358
 
{
359
 
        nb1413m3_gfxradr_h = data;
360
 
}
361
 
 
362
 
WRITE8_HANDLER( nb1413m3_inputportsel_w )
363
 
{
364
 
        nb1413m3_inputport = data;
365
 
}
366
 
 
367
 
CUSTOM_INPUT( nb1413m3_busyflag_r )
368
 
{
369
 
        return nb1413m3_busyflag & 0x01;
370
 
}
371
 
 
372
 
 
373
 
/* 2008-08 FP:
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 )
379
 
{
380
 
        return nb1413m3_outcoin_flag & 0x01;
381
 
}
382
 
 
383
 
READ8_HANDLER( nb1413m3_inputport0_r )
384
 
{
385
 
        return ((input_port_read(space->machine(), "SYSTEM") & 0xfd) | ((nb1413m3_outcoin_flag & 0x01) << 1));
386
 
}
387
 
 
388
 
READ8_HANDLER( nb1413m3_inputport1_r )
389
 
{
390
 
        switch (nb1413m3_type)
391
 
        {
392
 
                case NB1413M3_HYHOO:
393
 
                case NB1413M3_HYHOO2:
394
 
                        switch ((nb1413m3_inputport ^ 0xff) & 0x07)
395
 
                        {
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;
400
 
                        }
401
 
                        break;
402
 
                case NB1413M3_MSJIKEN:
403
 
                case NB1413M3_TELMAHJN:
404
 
                        if (input_port_read(space->machine(), "DSWA") & 0x80)
405
 
                        {
406
 
                                switch ((nb1413m3_inputport ^ 0xff) & 0x1f)
407
 
                                {
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"));
415
 
                                }
416
 
                        }
417
 
                        else return input_port_read(space->machine(), "JAMMA2");
418
 
                        break;
419
 
                case NB1413M3_PAIRSNB:
420
 
                case NB1413M3_PAIRSTEN:
421
 
                case NB1413M3_OHPAIPEE:
422
 
                case NB1413M3_TOGENKYO:
423
 
                        return input_port_read(space->machine(), "P1");
424
 
                default:
425
 
                        switch ((nb1413m3_inputport ^ 0xff) & 0x1f)
426
 
                        {
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"));
434
 
                        }
435
 
                        break;
436
 
        }
437
 
}
438
 
 
439
 
READ8_HANDLER( nb1413m3_inputport2_r )
440
 
{
441
 
        switch (nb1413m3_type)
442
 
        {
443
 
                case NB1413M3_HYHOO:
444
 
                case NB1413M3_HYHOO2:
445
 
                        switch ((nb1413m3_inputport ^ 0xff) & 0x07)
446
 
                        {
447
 
                                case 0x01:      return 0xff;
448
 
                                case 0x02:      return 0xff;
449
 
                                case 0x04:      return input_port_read(space->machine(), "IN2");
450
 
                                default:        return 0xff;
451
 
                        }
452
 
                        break;
453
 
                case NB1413M3_MSJIKEN:
454
 
                case NB1413M3_TELMAHJN:
455
 
                        if (input_port_read(space->machine(), "DSWA") & 0x80)
456
 
                        {
457
 
                                switch ((nb1413m3_inputport ^ 0xff) & 0x1f)
458
 
                                {
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"));
466
 
                                }
467
 
                        }
468
 
                        else return input_port_read(space->machine(), "JAMMA1");
469
 
                        break;
470
 
                case NB1413M3_PAIRSNB:
471
 
                case NB1413M3_PAIRSTEN:
472
 
                case NB1413M3_OHPAIPEE:
473
 
                case NB1413M3_TOGENKYO:
474
 
                        return input_port_read(space->machine(), "P2");
475
 
                default:
476
 
                        switch ((nb1413m3_inputport ^ 0xff) & 0x1f)
477
 
                        {
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"));
485
 
                        }
486
 
                        break;
487
 
        }
488
 
}
489
 
 
490
 
READ8_HANDLER( nb1413m3_inputport3_r )
491
 
{
492
 
        switch (nb1413m3_type)
493
 
        {
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);
508
 
                default:
509
 
                        return 0xff;
510
 
        }
511
 
}
512
 
 
513
 
READ8_HANDLER( nb1413m3_dipsw1_r )
514
 
{
515
 
        switch (nb1413m3_type)
516
 
        {
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));
551
 
                default:
552
 
                        return input_port_read(space->machine(), "DSWA");
553
 
        }
554
 
}
555
 
 
556
 
READ8_HANDLER( nb1413m3_dipsw2_r )
557
 
{
558
 
        switch (nb1413m3_type)
559
 
        {
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));
594
 
                default:
595
 
                        return input_port_read(space->machine(), "DSWB");
596
 
        }
597
 
}
598
 
 
599
 
READ8_HANDLER( nb1413m3_dipsw3_l_r )
600
 
{
601
 
        return ((input_port_read(space->machine(), "DSWC") & 0xf0) >> 4);
602
 
}
603
 
 
604
 
READ8_HANDLER( nb1413m3_dipsw3_h_r )
605
 
{
606
 
        return ((input_port_read(space->machine(), "DSWC") & 0x0f) >> 0);
607
 
}
608
 
 
609
 
WRITE8_HANDLER( nb1413m3_outcoin_w )
610
 
{
611
 
        static int counter = 0;
612
 
 
613
 
        nb1413m3_outcoin_enable = (data & 0x04) >> 2;
614
 
 
615
 
        switch (nb1413m3_type)
616
 
        {
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:
629
 
                case NB1413M3_MGION:
630
 
                case NB1413M3_HANAOJI:
631
 
                case NB1413M3_FINALBNY:
632
 
                case NB1413M3_LOVEHOUS:
633
 
                case NB1413M3_MMAIKO:
634
 
                        if (nb1413m3_outcoin_enable)
635
 
                        {
636
 
                                if (counter++ == 2)
637
 
                                {
638
 
                                        nb1413m3_outcoin_flag ^= 1;
639
 
                                        counter = 0;
640
 
                                }
641
 
                        }
642
 
                        break;
643
 
                default:
644
 
                        break;
645
 
        }
646
 
 
647
 
        set_led_status(space->machine(), 2, nb1413m3_outcoin_flag);             // out coin
648
 
}
649
 
 
650
 
WRITE8_HANDLER( nb1413m3_vcrctrl_w )
651
 
{
652
 
        if (data & 0x08)
653
 
        {
654
 
                popmessage(" ** VCR CONTROL ** ");
655
 
                set_led_status(space->machine(), 2, 1);
656
 
        }
657
 
        else
658
 
        {
659
 
                set_led_status(space->machine(), 2, 0);
660
 
        }
661
 
}
662
 
 
663
 
/* Nichibutsu Mahjong games share a common control panel */
664
 
INPUT_PORTS_START( nbmjcontrols )
665
 
        PORT_START("KEY0")
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 )
674
 
 
675
 
        PORT_START("KEY1")
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 )
684
 
 
685
 
        PORT_START("KEY2")
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 )
694
 
 
695
 
        PORT_START("KEY3")
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 )
704
 
 
705
 
        PORT_START("KEY4")
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 )
714
 
 
715
 
        PORT_START("KEY5")
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 )
724
 
 
725
 
        PORT_START("KEY6")
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 )
734
 
 
735
 
        PORT_START("KEY7")
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 )
744
 
 
745
 
        PORT_START("KEY8")
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 )
754
 
 
755
 
        PORT_START("KEY9")
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 )
764
 
INPUT_PORTS_END
765
 
 
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
770
 
        PORT_START("KEY0")
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 )
779
 
 
780
 
        PORT_START("KEY1")
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 )
789
 
 
790
 
        PORT_START("KEY2")
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 )
799
 
 
800
 
        PORT_START("KEY3")
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 )
809
 
 
810
 
        PORT_START("KEY4")
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 )
819
 
 
820
 
        PORT_START("KEY5")
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 )
829
 
 
830
 
        PORT_START("KEY6")
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 )
839
 
 
840
 
        PORT_START("KEY7")
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 )
849
 
 
850
 
        PORT_START("KEY8")
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 )
859
 
 
860
 
        PORT_START("KEY9")
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 )
869
 
INPUT_PORTS_END
870
 
 
871
 
INPUT_PORTS_START( nbhf2_ctrl ) // used by maiko, hanaoji, hnxmasev and hnageman
872
 
        PORT_INCLUDE( nbhf1_ctrl )
873
 
 
874
 
        PORT_MODIFY("KEY0")
875
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_HANAFUDA_YES )
876
 
 
877
 
        PORT_MODIFY("KEY1")
878
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
879
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_HANAFUDA_NO )
880
 
 
881
 
        PORT_MODIFY("KEY2")
882
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
883
 
 
884
 
        PORT_MODIFY("KEY5")
885
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_HANAFUDA_YES ) PORT_PLAYER(2)
886
 
 
887
 
        PORT_MODIFY("KEY6")
888
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
889
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_HANAFUDA_NO ) PORT_PLAYER(2)
890
 
 
891
 
        PORT_MODIFY("KEY7")
892
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
893
 
INPUT_PORTS_END