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

« back to all changes in this revision

Viewing changes to mess/src/mame/drivers/igs011.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
 
                      -= IGS011 (Blitter) Based Hardware =-
4
 
 
5
 
                    driver by   Luca Elia (l.elia@tin.it)
6
 
            code decrypted by   Olivier Galibert
7
 
 
8
 
 
9
 
CPU     :   68000
10
 
Sound   :   M6295 + Optional FM or ICS2115
11
 
Custom  :   IGS011 (blitter, protection)
12
 
            IGS012 (protection, optional)
13
 
            IGS003 (8255, protection)
14
 
NVRAM   :   Battery for main RAM
15
 
 
16
 
---------------------------------------------------------------------------
17
 
Year + Game                PCB        Sound         Chips
18
 
---------------------------------------------------------------------------
19
 
95 Da Ban Cheng            NO-T0084-1 M6295         IGS011 8255
20
 
95 Long Hu Bang V033C      NO-T0093   M6295         IGS011 8255
21
 
95 Long Hu Bang V035C      ?
22
 
95 Mj Ryukobou             NO-T0094   M6295         IGS011 8255
23
 
95 Dragon World V010C      NO-0105-4  M6295 YM3812  IGS011 IGS003
24
 
95 Dragon World V011H      ?
25
 
95 Dragon World V020J      ?          M6295 YM3812  IGS011 IGS003  IGS012
26
 
95 Dragon World V021J      ?
27
 
95 Dragon World V021O      NO-0105-1  M6295 YM3812  IGS011 IGS003  IGS012
28
 
95 Dragon World V030O      NO-0105-1  M6295 YM3812  IGS011 IGS003
29
 
97 Dragon World V040O      NO-0105-5  M6295 YM3812  IGS011 IGS003c
30
 
96 Virtua Bowling V101XCM  NO-0101-1  ICS2115       IGS011 IGS003e IGS012
31
 
96 Virtua Bowling V100JCM  NO-0101-?  ICS2115       IGS011 IGS003e IGS012
32
 
96 Long Hu Bang II V185H   NO-0115    M6295 YM2413  IGS011 8255
33
 
96 Wan Li Chang Cheng      ?
34
 
96 Xing Yen Man Guan       ?
35
 
98 Mj Nenrikishu SP        NO-0115-5  M6295 YM2413  IGS011 8255
36
 
---------------------------------------------------------------------------
37
 
 
38
 
To do:
39
 
 
40
 
- Implement the I/O part of IGS003 as an 8255
41
 
- IGS003 parametric bitswap protection in lhb2, vbowl (instead of patching the roms)
42
 
- Interrupt controller at 838000 or a38000 (there's a preliminary implementation for lhb)
43
 
- A few graphical bugs
44
 
 
45
 
- vbowl, vbowlj: trackball support.
46
 
  Wrong colors in "Game Over" screen.
47
 
 
48
 
- lhb: in the copyright screen the '5' in '1995' is drawn by the cpu on layer 5,
49
 
  but with wrong colors (since the top nibble of the affected pixels is left to 0xf)
50
 
  (drgnwrld is like this too, maybe hacked, or a cheap year replacement by IGS)
51
 
 
52
 
- dbc: in the title screen the '5' in '1995' is drawn by the cpu with wrong colors.
53
 
  (see above comment)
54
 
  Also the background palette is wrong since the fade routine is called with wrong
55
 
  parameters, but in this case the PCB does the same.
56
 
 
57
 
Notes:
58
 
 
59
 
- In most games, keep test button pressed during boot for another test mode
60
 
 
61
 
***************************************************************************/
62
 
 
63
 
#include "emu.h"
64
 
#include "deprecat.h"
65
 
#include "cpu/m68000/m68000.h"
66
 
#include "sound/okim6295.h"
67
 
#include "sound/2413intf.h"
68
 
#include "sound/3812intf.h"
69
 
#include "sound/ics2115.h"
70
 
#include "machine/nvram.h"
71
 
 
72
 
 
73
 
struct blitter_t
74
 
{
75
 
 
76
 
        UINT16  x, y, w, h,
77
 
                        gfx_lo, gfx_hi,
78
 
                        depth,
79
 
                        pen,
80
 
                        flags;
81
 
 
82
 
};
83
 
 
84
 
class igs011_state : public driver_device
85
 
{
86
 
public:
87
 
        igs011_state(const machine_config &mconfig, device_type type, const char *tag)
88
 
                : driver_device(mconfig, type, tag) { }
89
 
 
90
 
        UINT8 *m_layer[8];
91
 
        UINT16 m_priority;
92
 
        UINT16 *m_priority_ram;
93
 
        UINT8 m_lhb2_pen_hi;
94
 
        UINT16 m_igs_dips_sel;
95
 
        UINT16 m_igs_input_sel;
96
 
        UINT16 m_igs_hopper;
97
 
        UINT8 m_prot1;
98
 
        UINT8 m_prot1_swap;
99
 
        UINT32 m_prot1_addr;
100
 
        UINT8 m_prot2;
101
 
        UINT8 m_igs012_prot;
102
 
        UINT8 m_igs012_prot_swap;
103
 
        UINT8 m_igs012_prot_mode;
104
 
        UINT16 m_igs003_reg[2];
105
 
        UINT16 m_lhb_irq_enable;
106
 
        UINT16 *m_vbowl_trackball;
107
 
        blitter_t m_blitter;
108
 
};
109
 
 
110
 
 
111
 
#define LOG_BLITTER 0
112
 
 
113
 
/***************************************************************************
114
 
 
115
 
    Video
116
 
 
117
 
    There are 8 non scrolling layers as big as the screen (512 x 256).
118
 
    Each layer has 256 colors and its own palette.
119
 
 
120
 
    There are 8 priority codes with RAM associated to each (8 x 256 values).
121
 
    For each screen position, to determine which pixel to display, the video
122
 
    chip associates a bit to the opacity of that pixel for each layer
123
 
    (1 = transparent) to form an address into the selected priority RAM.
124
 
    The value at that address (0-7) is the topmost layer.
125
 
 
126
 
***************************************************************************/
127
 
 
128
 
 
129
 
 
130
 
 
131
 
 
132
 
static WRITE16_HANDLER( igs011_priority_w )
133
 
{
134
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
135
 
        COMBINE_DATA(&state->m_priority);
136
 
 
137
 
//  logerror("%06x: priority = %02x\n", cpu_get_pc(&space->device()), state->m_priority);
138
 
 
139
 
        if (data & ~0x7)
140
 
                logerror("%06x: warning, unknown bits written to priority = %02x\n", cpu_get_pc(&space->device()), state->m_priority);
141
 
}
142
 
 
143
 
 
144
 
static VIDEO_START( igs011 )
145
 
{
146
 
        igs011_state *state = machine.driver_data<igs011_state>();
147
 
        int i;
148
 
 
149
 
        for (i = 0; i < 8; i++)
150
 
        {
151
 
                state->m_layer[i] = auto_alloc_array(machine, UINT8, 512 * 256);
152
 
        }
153
 
 
154
 
        state->m_lhb2_pen_hi = 0;
155
 
}
156
 
 
157
 
static SCREEN_UPDATE( igs011 )
158
 
{
159
 
        igs011_state *state = screen->machine().driver_data<igs011_state>();
160
 
#ifdef MAME_DEBUG
161
 
        int layer_enable = -1;
162
 
#endif
163
 
 
164
 
        int x,y,l,scr_addr,pri_addr;
165
 
        UINT16 *pri_ram;
166
 
 
167
 
#ifdef MAME_DEBUG
168
 
        if (screen->machine().input().code_pressed(KEYCODE_Z))
169
 
        {
170
 
                int mask = 0;
171
 
                if (screen->machine().input().code_pressed(KEYCODE_Q))  mask |= 0x01;
172
 
                if (screen->machine().input().code_pressed(KEYCODE_W))  mask |= 0x02;
173
 
                if (screen->machine().input().code_pressed(KEYCODE_E))  mask |= 0x04;
174
 
                if (screen->machine().input().code_pressed(KEYCODE_R))  mask |= 0x08;
175
 
                if (screen->machine().input().code_pressed(KEYCODE_A))  mask |= 0x10;
176
 
                if (screen->machine().input().code_pressed(KEYCODE_S))  mask |= 0x20;
177
 
                if (screen->machine().input().code_pressed(KEYCODE_D))  mask |= 0x40;
178
 
                if (screen->machine().input().code_pressed(KEYCODE_F))  mask |= 0x80;
179
 
                if (mask)       layer_enable &= mask;
180
 
        }
181
 
#endif
182
 
 
183
 
        pri_ram = &state->m_priority_ram[(state->m_priority & 7) * 512/2];
184
 
 
185
 
        for (y = cliprect->min_y; y <= cliprect->max_y; y++)
186
 
        {
187
 
                for (x = cliprect->min_x; x <= cliprect->max_x; x++)
188
 
                {
189
 
                        scr_addr = x + y * 512;
190
 
                        pri_addr = 0xff;
191
 
 
192
 
                        for (l = 0; l < 8; l++)
193
 
                        {
194
 
                                if (    (state->m_layer[l][scr_addr] != 0xff)
195
 
#ifdef MAME_DEBUG
196
 
                                                && (layer_enable & (1 << l))
197
 
#endif
198
 
                                        )
199
 
                                        pri_addr &= ~(1 << l);
200
 
                        }
201
 
 
202
 
 
203
 
                        l       =       pri_ram[pri_addr] & 7;
204
 
 
205
 
#ifdef MAME_DEBUG
206
 
                        if ((layer_enable != -1) && (pri_addr == 0xff))
207
 
                                *BITMAP_ADDR16(bitmap, y, x) = get_black_pen(screen->machine());
208
 
                        else
209
 
#endif
210
 
                                *BITMAP_ADDR16(bitmap, y, x) = state->m_layer[l][scr_addr] | (l << 8);
211
 
                }
212
 
        }
213
 
        return 0;
214
 
}
215
 
 
216
 
/***************************************************************************
217
 
 
218
 
    In addition to the blitter, the CPU can also read from and write to
219
 
    the framebuffers for the 8 layers, seen as 0x100000 bytes in memory.
220
 
    The first half contains layers 0-3. Layers 4-7 are in the other half.
221
 
 
222
 
    The layers are interleaved:
223
 
 
224
 
    - bytes 0x00000-0x00003 contain the 1st pixel of layer 0,1,2,3
225
 
    - bytes 0x00004-0x00007 contain the 2nd pixel of layer 0,1,2,3
226
 
    ...
227
 
    - bytes 0x80000-0x80003 contain the 1st pixel of layer 4,5,6,7
228
 
    - bytes 0x80004-0x80007 contain the 2nd pixel of layer 4,5,6,7
229
 
 
230
 
    and so on.
231
 
 
232
 
***************************************************************************/
233
 
 
234
 
static READ16_HANDLER( igs011_layers_r )
235
 
{
236
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
237
 
        int layer0 = ((offset & (0x80000/2)) ? 4 : 0) + ((offset & 1) ? 0 : 2);
238
 
 
239
 
        UINT8 *l0 = state->m_layer[layer0];
240
 
        UINT8 *l1 = state->m_layer[layer0+1];
241
 
 
242
 
        offset >>= 1;
243
 
        offset &= 0x1ffff;
244
 
 
245
 
        return (l0[offset] << 8) | l1[offset];
246
 
}
247
 
 
248
 
static WRITE16_HANDLER( igs011_layers_w )
249
 
{
250
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
251
 
        UINT16 word;
252
 
 
253
 
        int layer0 = ((offset & (0x80000/2)) ? 4 : 0) + ((offset & 1) ? 0 : 2);
254
 
 
255
 
        UINT8 *l0 = state->m_layer[layer0];
256
 
        UINT8 *l1 = state->m_layer[layer0+1];
257
 
 
258
 
        offset >>= 1;
259
 
        offset &= 0x1ffff;
260
 
 
261
 
        word = (l0[offset] << 8) | l1[offset];
262
 
        COMBINE_DATA(&word);
263
 
        l0[offset] = word >> 8;
264
 
        l1[offset] = word;
265
 
}
266
 
 
267
 
/***************************************************************************
268
 
 
269
 
    Palette (r5g5b5)
270
 
 
271
 
    offset + 0x000: xRRRRRGG
272
 
    offset + 0x800: GGGBBBBB
273
 
 
274
 
***************************************************************************/
275
 
 
276
 
static WRITE16_HANDLER( igs011_palette )
277
 
{
278
 
        int rgb;
279
 
 
280
 
        COMBINE_DATA(&space->machine().generic.paletteram.u16[offset]);
281
 
 
282
 
        rgb = (space->machine().generic.paletteram.u16[offset & 0x7ff] & 0xff) | ((space->machine().generic.paletteram.u16[offset | 0x800] & 0xff) << 8);
283
 
        palette_set_color_rgb(space->machine(),offset & 0x7ff,pal5bit(rgb >> 0),pal5bit(rgb >> 5),pal5bit(rgb >> 10));
284
 
}
285
 
 
286
 
/***************************************************************************
287
 
 
288
 
    Blitter
289
 
 
290
 
***************************************************************************/
291
 
 
292
 
 
293
 
static WRITE16_HANDLER( igs011_blit_x_w )
294
 
{
295
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
296
 
        struct blitter_t &blitter = state->m_blitter;
297
 
        COMBINE_DATA(&blitter.x);
298
 
}
299
 
 
300
 
static WRITE16_HANDLER( igs011_blit_y_w )
301
 
{
302
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
303
 
        struct blitter_t &blitter = state->m_blitter;
304
 
        COMBINE_DATA(&blitter.y);
305
 
}
306
 
 
307
 
static WRITE16_HANDLER( igs011_blit_gfx_lo_w )
308
 
{
309
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
310
 
        struct blitter_t &blitter = state->m_blitter;
311
 
        COMBINE_DATA(&blitter.gfx_lo);
312
 
}
313
 
 
314
 
static WRITE16_HANDLER( igs011_blit_gfx_hi_w )
315
 
{
316
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
317
 
        struct blitter_t &blitter = state->m_blitter;
318
 
        COMBINE_DATA(&blitter.gfx_hi);
319
 
}
320
 
 
321
 
static WRITE16_HANDLER( igs011_blit_w_w )
322
 
{
323
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
324
 
        struct blitter_t &blitter = state->m_blitter;
325
 
        COMBINE_DATA(&blitter.w);
326
 
}
327
 
 
328
 
static WRITE16_HANDLER( igs011_blit_h_w )
329
 
{
330
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
331
 
        struct blitter_t &blitter = state->m_blitter;
332
 
        COMBINE_DATA(&blitter.h);
333
 
}
334
 
 
335
 
static WRITE16_HANDLER( igs011_blit_depth_w )
336
 
{
337
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
338
 
        struct blitter_t &blitter = state->m_blitter;
339
 
        COMBINE_DATA(&blitter.depth);
340
 
}
341
 
 
342
 
static WRITE16_HANDLER( igs011_blit_pen_w )
343
 
{
344
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
345
 
        struct blitter_t &blitter = state->m_blitter;
346
 
        COMBINE_DATA(&blitter.pen);
347
 
}
348
 
 
349
 
 
350
 
static WRITE16_HANDLER( igs011_blit_flags_w )
351
 
{
352
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
353
 
        struct blitter_t &blitter = state->m_blitter;
354
 
        int x, xstart, xend, xinc, flipx;
355
 
        int y, ystart, yend, yinc, flipy;
356
 
        int depth4, clear, opaque, z;
357
 
        UINT8 trans_pen, clear_pen, pen_hi, *dest;
358
 
        UINT8 pen = 0;
359
 
 
360
 
        UINT8 *gfx              =       space->machine().region("blitter")->base();
361
 
        UINT8 *gfx2             =       space->machine().region("blitter_hi")->base();
362
 
        int gfx_size    =       space->machine().region("blitter")->bytes();
363
 
        int gfx2_size   =       space->machine().region("blitter_hi")->bytes();
364
 
 
365
 
        const rectangle &clip = space->machine().primary_screen->visible_area();
366
 
 
367
 
        COMBINE_DATA(&blitter.flags);
368
 
 
369
 
#if LOG_BLITTER
370
 
        logerror("%06x: blit x %03x, y %03x, w %03x, h %03x, gfx %03x%04x, depth %02x, pen %02x, flags %03x\n", cpu_get_pc(&space->device()),
371
 
                                        blitter.x,blitter.y,blitter.w,blitter.h,blitter.gfx_hi,blitter.gfx_lo,blitter.depth,blitter.pen,blitter.flags);
372
 
#endif
373
 
 
374
 
        dest    =       state->m_layer[    blitter.flags & 0x0007       ];
375
 
        opaque  =                        !(blitter.flags & 0x0008);
376
 
        clear   =                          blitter.flags & 0x0010;
377
 
        flipx   =                          blitter.flags & 0x0020;
378
 
        flipy   =                          blitter.flags & 0x0040;
379
 
        if                                      (!(blitter.flags & 0x0400)) return;
380
 
 
381
 
        pen_hi  =       (state->m_lhb2_pen_hi & 0x07) << 5;
382
 
 
383
 
        // pixel address
384
 
        z               =       blitter.gfx_lo  + (blitter.gfx_hi << 16);
385
 
 
386
 
        // what were they smoking???
387
 
        depth4  =       !((blitter.flags & 0x7) < (4 - (blitter.depth & 0x7))) ||
388
 
                                (z & 0x800000);         // see lhb2
389
 
 
390
 
        z &= 0x7fffff;
391
 
 
392
 
        if (depth4)
393
 
        {
394
 
                z       *=      2;
395
 
                if (gfx2 && (blitter.gfx_hi & 0x80))    trans_pen = 0x1f;       // lhb2
396
 
                else                                                                    trans_pen = 0x0f;
397
 
 
398
 
                clear_pen = blitter.pen | 0xf0;
399
 
        }
400
 
        else
401
 
        {
402
 
                if (gfx2)       trans_pen = 0x1f;       // vbowl
403
 
                else            trans_pen = 0xff;
404
 
 
405
 
                clear_pen = blitter.pen;
406
 
        }
407
 
 
408
 
        xstart = (blitter.x & 0x1ff) - (blitter.x & 0x200);
409
 
        ystart = (blitter.y & 0x0ff) - (blitter.y & 0x100);
410
 
 
411
 
        if (flipx)      { xend = xstart - (blitter.w & 0x1ff) - 1;      xinc = -1; }
412
 
        else            { xend = xstart + (blitter.w & 0x1ff) + 1;      xinc =  1; }
413
 
 
414
 
        if (flipy)      { yend = ystart - (blitter.h & 0x0ff) - 1;      yinc = -1; }
415
 
        else            { yend = ystart + (blitter.h & 0x0ff) + 1;      yinc =  1; }
416
 
 
417
 
        for (y = ystart; y != yend; y += yinc)
418
 
        {
419
 
                for (x = xstart; x != xend; x += xinc)
420
 
                {
421
 
                        // fetch the pixel
422
 
                        if (!clear)
423
 
                        {
424
 
                                if (depth4)             pen = (gfx[(z/2)%gfx_size] >> ((z&1)?4:0)) & 0x0f;
425
 
                                else                    pen = gfx[z%gfx_size];
426
 
 
427
 
                                if ( gfx2 )
428
 
                                {
429
 
                                        pen &= 0x0f;
430
 
                                        if ( gfx2[(z/8)%gfx2_size] & (1 << (z & 7)) )
431
 
                                                pen |= 0x10;
432
 
                                }
433
 
                        }
434
 
 
435
 
                        // plot it
436
 
                        if (x >= clip.min_x && x <= clip.max_x && y >= clip.min_y && y <= clip.max_y)
437
 
                        {
438
 
                                if      (clear)                         dest[x + y * 512] = clear_pen;
439
 
                                else if (pen != trans_pen)      dest[x + y * 512] = pen | pen_hi;
440
 
                                else if (opaque)                        dest[x + y * 512] = 0xff;
441
 
                        }
442
 
 
443
 
                        z++;
444
 
                }
445
 
        }
446
 
 
447
 
        #ifdef MAME_DEBUG
448
 
#if 1
449
 
        if (space->machine().input().code_pressed(KEYCODE_Z))
450
 
        {       char buf[20];
451
 
                sprintf(buf, "%02X%02X",blitter.depth,blitter.flags&0xff);
452
 
//      ui_draw_text(buf, blitter.x, blitter.y);    // crashes mame!
453
 
        }
454
 
#endif
455
 
        #endif
456
 
}
457
 
 
458
 
/***************************************************************************
459
 
 
460
 
    Common functions
461
 
 
462
 
***************************************************************************/
463
 
 
464
 
// Inputs
465
 
 
466
 
 
467
 
static CUSTOM_INPUT( igs_hopper_r )
468
 
{
469
 
        igs011_state *state = field.machine().driver_data<igs011_state>();
470
 
        return (state->m_igs_hopper && ((field.machine().primary_screen->frame_number()/5)&1)) ? 0x0000 : 0x0001;
471
 
}
472
 
 
473
 
static WRITE16_HANDLER( igs_dips_w )
474
 
{
475
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
476
 
        COMBINE_DATA(&state->m_igs_dips_sel);
477
 
}
478
 
 
479
 
INLINE UINT16 igs_dips_r(address_space *space, int NUM)
480
 
{
481
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
482
 
        int i;
483
 
        UINT16 ret=0;
484
 
        static const char *const dipnames[] = { "DSW1", "DSW2", "DSW3", "DSW4", "DSW5" };
485
 
 
486
 
        for (i = 0; i < NUM; i++)
487
 
                if ((~state->m_igs_dips_sel) & (1 << i) )
488
 
                        ret = input_port_read(space->machine(), dipnames[i]);
489
 
        /* 0x0100 is blitter busy */
490
 
        return  (ret & 0xff) | 0x0000;
491
 
}
492
 
 
493
 
// Games have 3 to 5 dips
494
 
static READ16_HANDLER( igs_3_dips_r ) { return igs_dips_r(space, 3); }
495
 
static READ16_HANDLER( igs_4_dips_r ) { return igs_dips_r(space, 4); }
496
 
static READ16_HANDLER( igs_5_dips_r ) { return igs_dips_r(space, 5); }
497
 
 
498
 
/***************************************************************************
499
 
 
500
 
    Code Decryption
501
 
 
502
 
***************************************************************************/
503
 
 
504
 
static void wlcc_decrypt(running_machine &machine)
505
 
{
506
 
        int i;
507
 
        UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
508
 
 
509
 
        int rom_size = 0x80000;
510
 
 
511
 
        for (i=0; i<rom_size/2; i++)
512
 
        {
513
 
                UINT16 x = src[i];
514
 
 
515
 
        if ((i & 0x2000) == 0x0000 || (i & 0x0004) == 0x0000 || (i & 0x0090) == 0x0000)
516
 
                        x ^= 0x0004;
517
 
        if ((i & 0x0100) == 0x0100 || (i & 0x0040) == 0x0040 || (i & 0x0012) == 0x0012)
518
 
                        x ^= 0x0020;
519
 
        if ((i & 0x2400) == 0x0000 || (i & 0x4100) == 0x4100 || ((i & 0x2000) == 0x2000 && (i & 0x0c00) != 0x0000))
520
 
                        x ^= 0x0200;
521
 
        if ((x & 0x0024) == 0x0004 || (x & 0x0024) == 0x0020)
522
 
                        x ^= 0x0024;
523
 
                src[i] = x;
524
 
        }
525
 
}
526
 
 
527
 
 
528
 
static void lhb_decrypt(running_machine &machine)
529
 
{
530
 
        int i;
531
 
        UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
532
 
 
533
 
        int rom_size = 0x80000;
534
 
 
535
 
        for (i=0; i<rom_size/2; i++)
536
 
        {
537
 
                UINT16 x = src[i];
538
 
 
539
 
                if ((i & 0x1100) != 0x0100)
540
 
                        x ^= 0x0200;
541
 
 
542
 
                if ((i & 0x0150) != 0x0000 && (i & 0x0152) != 0x0010)
543
 
                        x ^= 0x0004;
544
 
 
545
 
                if ((i & 0x2084) != 0x2084 && (i & 0x2094) != 0x2014)
546
 
                        x ^= 0x0020;
547
 
 
548
 
                src[i] = x;
549
 
        }
550
 
}
551
 
 
552
 
 
553
 
static void drgnwrld_type3_decrypt(running_machine &machine)
554
 
{
555
 
        int i;
556
 
        UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
557
 
 
558
 
        int rom_size = 0x80000;
559
 
 
560
 
        for (i=0; i<rom_size/2; i++)
561
 
        {
562
 
                UINT16 x = src[i];
563
 
 
564
 
                if ((i & 0x2000) == 0x0000 || (i & 0x0004) == 0x0000 || (i & 0x0090) == 0x0000)
565
 
                        x ^= 0x0004;
566
 
 
567
 
                if ((i & 0x0100) == 0x0100 || (i & 0x0040) == 0x0040 || (i & 0x0012) == 0x0012)
568
 
                        x ^= 0x0020;
569
 
 
570
 
                if ((((i & 0x1000) == 0x1000) ^ ((i & 0x0100) == 0x0100))
571
 
                        || (i & 0x0880) == 0x0800 || (i & 0x0240) == 0x0240)
572
 
                                x ^= 0x0200;
573
 
 
574
 
                if ((x & 0x0024) == 0x0004 || (x & 0x0024) == 0x0020)
575
 
                        x ^= 0x0024;
576
 
 
577
 
                src[i] = x;
578
 
        }
579
 
}
580
 
 
581
 
static void drgnwrld_type2_decrypt(running_machine &machine)
582
 
{
583
 
        int i;
584
 
        UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
585
 
 
586
 
        int rom_size = 0x80000;
587
 
 
588
 
        for (i=0; i<rom_size/2; i++)
589
 
        {
590
 
                UINT16 x = src[i];
591
 
 
592
 
                if(((i & 0x000090) == 0x000000) || ((i & 0x002004) != 0x002004))
593
 
                  x ^= 0x0004;
594
 
 
595
 
                if((((i & 0x000050) == 0x000000) || ((i & 0x000142) != 0x000000)) && ((i & 0x000150) != 0x000000))
596
 
                  x ^= 0x0020;
597
 
 
598
 
                if(((i & 0x004280) == 0x004000) || ((i & 0x004080) == 0x000000))
599
 
                  x ^= 0x0200;
600
 
 
601
 
                if((i & 0x0011a0) != 0x001000)
602
 
                  x ^= 0x0200;
603
 
 
604
 
                if((i & 0x000180) == 0x000100)
605
 
                  x ^= 0x0200;
606
 
 
607
 
                if((x & 0x0024) == 0x0020 || (x & 0x0024) == 0x0004)
608
 
                  x ^= 0x0024;
609
 
 
610
 
                src[i] = x;
611
 
        }
612
 
}
613
 
 
614
 
static void drgnwrld_type1_decrypt(running_machine &machine)
615
 
{
616
 
        int i;
617
 
        UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
618
 
 
619
 
        int rom_size = 0x80000;
620
 
 
621
 
        for (i=0; i<rom_size/2; i++)
622
 
        {
623
 
                UINT16 x = src[i];
624
 
 
625
 
                if ((i & 0x2000) == 0x0000 || (i & 0x0004) == 0x0000 || (i & 0x0090) == 0x0000)
626
 
                        x ^= 0x0004;
627
 
 
628
 
                if ((i & 0x0100) == 0x0100 || (i & 0x0040) == 0x0040 || (i & 0x0012) == 0x0012)
629
 
                        x ^= 0x0020;
630
 
/*
631
 
        if ((((i & 0x1000) == 0x1000) ^ ((i & 0x0100) == 0x0100))
632
 
            || (i & 0x0880) == 0x0800 || (i & 0x0240) == 0x0240)
633
 
                x ^= 0x0200;
634
 
*/
635
 
                if ((x & 0x0024) == 0x0004 || (x & 0x0024) == 0x0020)
636
 
                        x ^= 0x0024;
637
 
 
638
 
                src[i] = x;
639
 
        }
640
 
}
641
 
 
642
 
 
643
 
static void lhb2_decrypt(running_machine &machine)
644
 
{
645
 
        int i,j;
646
 
        int rom_size = 0x80000;
647
 
        UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
648
 
        UINT16 *result_data = auto_alloc_array(machine, UINT16, rom_size/2);
649
 
 
650
 
        for (i=0; i<rom_size/2; i++)
651
 
        {
652
 
                UINT16 x = src[i];
653
 
 
654
 
                if ((i & 0x0054) != 0x0000 && (i & 0x0056) != 0x0010)
655
 
                        x ^= 0x0004;
656
 
 
657
 
                if ((i & 0x0204) == 0x0000)
658
 
                        x ^= 0x0008;
659
 
 
660
 
                if ((i & 0x3080) != 0x3080 && (i & 0x3090) != 0x3010)
661
 
                        x ^= 0x0020;
662
 
 
663
 
                j = BITSWAP24(i, 23,22,21,20,19,18,17,16,15,14,13, 8, 11,10, 9, 2, 7,6,5,4,3, 12, 1,0);
664
 
 
665
 
                result_data[j] = x;
666
 
        }
667
 
 
668
 
        memcpy(src,result_data,rom_size);
669
 
 
670
 
        auto_free(machine, result_data);
671
 
}
672
 
 
673
 
 
674
 
// To be done (similar to lhb2?)
675
 
static void nkishusp_decrypt(running_machine &machine)
676
 
{
677
 
//  lhb_decrypt(machine);
678
 
//  dbc_decrypt(machine);
679
 
//  lhb2_decrypt(machine);
680
 
//  drgnwrld_type1_decrypt(machine);
681
 
//  drgnwrld_type2_decrypt(machine);
682
 
//  drgnwrld_type3_decrypt(machine);
683
 
//  wlcc_decrypt(machine);
684
 
//  vbowlj_decrypt(machine);
685
 
 
686
 
        int i,j;
687
 
        int rom_size = 0x80000;
688
 
        UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
689
 
        UINT16 *result_data = auto_alloc_array(machine, UINT16, rom_size/2);
690
 
 
691
 
        for (i=0; i<rom_size/2; i++)
692
 
        {
693
 
                UINT16 x = src[i];
694
 
 
695
 
                if ((i & 0x0054) != 0x0000 && (i & 0x0056) != 0x0010)
696
 
                        x ^= 0x0004;
697
 
 
698
 
//      if ((i & 0x0204) == 0x0000)
699
 
//          x ^= 0x0008;
700
 
 
701
 
                if ((i & 0x3080) != 0x3080 && (i & 0x3090) != 0x3010)
702
 
                        x ^= 0x0020;
703
 
 
704
 
                j = BITSWAP24(i, 23,22,21,20,19,18,17,16,15,14,13, 8, 11,10, 9, 2, 7,6,5,4,3, 12, 1,0);
705
 
 
706
 
                result_data[j] = x;
707
 
        }
708
 
 
709
 
        memcpy(src,result_data,rom_size);
710
 
 
711
 
        auto_free(machine, result_data);
712
 
}
713
 
 
714
 
 
715
 
static void vbowlj_decrypt(running_machine &machine)
716
 
{
717
 
        int i;
718
 
        UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
719
 
 
720
 
        int rom_size = 0x80000;
721
 
 
722
 
        for(i=0; i<rom_size/2; i++)
723
 
        {
724
 
                UINT16 x = src[i];
725
 
 
726
 
                if((i & 0x4100) == 0x0100)
727
 
                        x ^= 0x0200;
728
 
 
729
 
                if((i & 0x4000) == 0x4000 && (i & 0x0300) != 0x0100)
730
 
                        x ^= 0x0200;
731
 
 
732
 
                if((i & 0x5700) == 0x5100)
733
 
                        x ^= 0x0200;
734
 
 
735
 
                if((i & 0x5500) == 0x1000)
736
 
                        x ^= 0x0200;
737
 
 
738
 
                if((i & 0x0140) != 0x0000 || (i & 0x0012) == 0x0012)
739
 
                        x ^= 0x0004;
740
 
 
741
 
                if((i & 0x2004) != 0x2004 || (i & 0x0090) == 0x0000)
742
 
                        x ^= 0x0020;
743
 
 
744
 
                src[i] = x;
745
 
        }
746
 
}
747
 
 
748
 
 
749
 
static void dbc_decrypt(running_machine &machine)
750
 
{
751
 
        int i;
752
 
        UINT16 *src = (UINT16 *) (machine.region("maincpu")->base());
753
 
 
754
 
        int rom_size = 0x80000;
755
 
 
756
 
        for (i=0; i<rom_size/2; i++)
757
 
        {
758
 
                UINT16 x = src[i];
759
 
 
760
 
                if( i & 0x1000/2 )
761
 
                {
762
 
                        if( ~i & 0x400/2 )
763
 
                                x ^= 0x0200;
764
 
                }
765
 
 
766
 
                if( i & 0x4000/2 )
767
 
                {
768
 
                        if( i & 0x100/2 )
769
 
                        {
770
 
                                if( ~i & 0x08/2 )
771
 
                                        x ^= 0x0020;
772
 
                        }
773
 
                        else
774
 
                        {
775
 
                                if( ~i & 0x28/2 )
776
 
                                        x ^= 0x0020;
777
 
                        }
778
 
                }
779
 
                else
780
 
                {
781
 
                        x ^= 0x0020;
782
 
                }
783
 
 
784
 
                if( i & 0x200/2 )
785
 
                {
786
 
                        x ^= 0x0004;
787
 
                }
788
 
                else
789
 
                {
790
 
                        if( (i & 0x80/2) == 0x80/2 || (i & 0x24/2) == 0x24/2 )
791
 
                                x ^= 0x0004;
792
 
                }
793
 
 
794
 
                src[i] = x;
795
 
        }
796
 
}
797
 
 
798
 
 
799
 
static void ryukobou_decrypt(running_machine &machine)
800
 
{
801
 
        int i;
802
 
        UINT16 *src = (UINT16 *) machine.region("maincpu")->base();
803
 
        int rom_size = 0x80000;
804
 
 
805
 
        for (i=0; i<rom_size/2; i++)
806
 
        {
807
 
                UINT16 x = src[i];
808
 
 
809
 
                if ( (i & 0x00100) && (i & 0x00400) )
810
 
                        x ^= 0x0200;
811
 
 
812
 
                if ( !(i & 0x00004) || !(i & 0x02000) || (!(i & 0x00080) && !(i & 0x00010) ) )
813
 
                        x ^= 0x0020;
814
 
 
815
 
                if ( (i & 0x00100) || (i & 0x00040) || ( (i & 0x00010)&&(i & 0x00002) ) )
816
 
                        x ^= 0x00004;
817
 
 
818
 
                src[i] = x;
819
 
        }
820
 
}
821
 
 
822
 
 
823
 
/***************************************************************************
824
 
 
825
 
    Gfx Decryption
826
 
 
827
 
***************************************************************************/
828
 
 
829
 
 
830
 
static void lhb2_decrypt_gfx(running_machine &machine)
831
 
{
832
 
        int i;
833
 
        unsigned rom_size = 0x200000;
834
 
        UINT8 *src = (UINT8 *) (machine.region("blitter")->base());
835
 
        UINT8 *result_data = auto_alloc_array(machine, UINT8, rom_size);
836
 
 
837
 
        for (i=0; i<rom_size; i++)
838
 
        result_data[i] = src[BITSWAP24(i, 23,22,21,20, 19, 17,16,15, 13,12, 10,9,8,7,6,5,4, 2,1, 3, 11, 14, 18, 0)];
839
 
 
840
 
        memcpy(src,result_data,rom_size);
841
 
 
842
 
        auto_free(machine, result_data);
843
 
}
844
 
 
845
 
static void drgnwrld_gfx_decrypt(running_machine &machine)
846
 
{
847
 
        int i;
848
 
        unsigned rom_size = 0x400000;
849
 
        UINT8 *src = (UINT8 *) (machine.region("blitter")->base());
850
 
        UINT8 *result_data = auto_alloc_array(machine, UINT8, rom_size);
851
 
 
852
 
        for (i=0; i<rom_size; i++)
853
 
        result_data[i] = src[BITSWAP24(i, 23,22,21,20,19,18,17,16,15, 12, 13, 14, 11,10,9,8,7,6,5,4,3,2,1,0)];
854
 
 
855
 
        memcpy(src,result_data,rom_size);
856
 
 
857
 
        auto_free(machine, result_data);
858
 
}
859
 
 
860
 
 
861
 
 
862
 
/***************************************************************************
863
 
 
864
 
    IGS011 Protection
865
 
 
866
 
    Protection 1 ("ASIC11 CHECK PORT ERROR")
867
 
 
868
 
    The chip holds an internal value, a buffered value and an address base register.
869
 
    The address base register determines where the protection device is mapped in memory
870
 
    (0x00000-0xffff0), has itself a fixed address, and writes to it reset the state.
871
 
    The internal and buffered value are manipulated by issuing commands, where
872
 
    each command is assigned a specific offset, and is triggered by writing a specific
873
 
    byte value to that offset:
874
 
 
875
 
    Offs.   R/W     Result
876
 
    0         W     COPY: copy buffer to value
877
 
    2         W     INC:  increment value
878
 
    4         W     DEC:  decrement value
879
 
    6         W     SWAP: write bitswap1(value) to buffer
880
 
    8       R       READ: read bitswap2(value). Only 2 bits are checked (bitmask 0x24).
881
 
 
882
 
    Protection 2 ("CHECK PORT ERROR")
883
 
 
884
 
    This is probably not part of the IGS011 nor the IGS012, but a game specific protection
885
 
    similar to the above.
886
 
 
887
 
    The chip holds an internal value. It is manipulated by issuing commands,
888
 
    where each command is assigned a specific address range (fixed per game), and is
889
 
    triggered by writing a specific byte value to that range. Possible commands:
890
 
 
891
 
    - INC:   increment value
892
 
    - DEC:   decrement value
893
 
    - SWAP:  value = bitswap1(value). Bitswap1 is game specific.
894
 
    - RESET: value = 0
895
 
 
896
 
    The protection value is read from an additional address range:
897
 
    - READ:  read bitswap2(value). Only 1 bit is checked. Bitswap2 is game specific.
898
 
 
899
 
***************************************************************************/
900
 
 
901
 
 
902
 
 
903
 
static WRITE16_HANDLER( igs011_prot1_w )
904
 
{
905
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
906
 
        offset *= 2;
907
 
 
908
 
        switch (offset)
909
 
        {
910
 
                case 0: // COPY
911
 
                        if (ACCESSING_BITS_8_15 && (data & 0xff00) == 0x3300)
912
 
                        {
913
 
                                state->m_prot1 = state->m_prot1_swap;
914
 
                                return;
915
 
                        }
916
 
                        break;
917
 
 
918
 
                case 2: // INC
919
 
                        if (ACCESSING_BITS_8_15 && (data & 0xff00) == 0xff00)
920
 
                        {
921
 
                                state->m_prot1++;
922
 
                                return;
923
 
                        }
924
 
                        break;
925
 
 
926
 
                case 4: // DEC
927
 
                        if (ACCESSING_BITS_8_15 && (data & 0xff00) == 0xaa00)
928
 
                        {
929
 
                                state->m_prot1--;
930
 
                                return;
931
 
                        }
932
 
                        break;
933
 
 
934
 
                case 6: // SWAP
935
 
                        if (ACCESSING_BITS_8_15 && (data & 0xff00) == 0x5500)
936
 
                        {
937
 
                                // b1 . (b2|b3) . b2 . (b0&b3)
938
 
                                UINT8 x = state->m_prot1;
939
 
                                state->m_prot1_swap = (BIT(x,1)<<3) | ((BIT(x,2)|BIT(x,3))<<2) | (BIT(x,2)<<1) | (BIT(x,0)&BIT(x,3));
940
 
                                return;
941
 
                        }
942
 
                        break;
943
 
        }
944
 
 
945
 
        logerror("%s: warning, unknown igs011_prot1_w( %04x, %04x )\n", space->machine().describe_context(), offset, data);
946
 
}
947
 
static READ16_HANDLER( igs011_prot1_r )
948
 
{
949
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
950
 
        // !(b1&b2) . 0 . 0 . (b0^b3) . 0 . 0
951
 
        UINT8 x = state->m_prot1;
952
 
        return (((BIT(x,1)&BIT(x,2))^1)<<5) | ((BIT(x,0)^BIT(x,3))<<2);
953
 
}
954
 
 
955
 
 
956
 
static WRITE16_HANDLER( igs011_prot_addr_w )
957
 
{
958
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
959
 
        state->m_prot1 = 0x00;
960
 
        state->m_prot1_swap = 0x00;
961
 
 
962
 
//  state->m_prot2 = 0x00;
963
 
 
964
 
        address_space *sp = space->machine().device("maincpu")->memory().space(AS_PROGRAM);
965
 
        UINT8 *rom = space->machine().region("maincpu")->base();
966
 
 
967
 
        // Plug previous address range with ROM access
968
 
        sp->install_rom(state->m_prot1_addr + 0, state->m_prot1_addr + 9, rom + state->m_prot1_addr);
969
 
 
970
 
        state->m_prot1_addr = (data << 4) ^ 0x8340;
971
 
 
972
 
        // Add protection memory range
973
 
        sp->install_legacy_write_handler(state->m_prot1_addr + 0, state->m_prot1_addr + 7, FUNC(igs011_prot1_w));
974
 
        sp->install_legacy_read_handler (state->m_prot1_addr + 8, state->m_prot1_addr + 9, FUNC(igs011_prot1_r));
975
 
}
976
 
/*
977
 
static READ16_HANDLER( igs011_prot_fake_r )
978
 
{
979
 
    igs011_state *state = space->machine().driver_data<igs011_state>();
980
 
    switch (offset)
981
 
    {
982
 
        case 0: return state->m_prot1;
983
 
        case 1: return state->m_prot1_swap;
984
 
        case 2: return state->m_prot2;
985
 
    }
986
 
    return 0;
987
 
}
988
 
*/
989
 
 
990
 
 
991
 
 
992
 
 
993
 
 
994
 
 
995
 
// Prot2
996
 
 
997
 
// drgnwrld (33)
998
 
static WRITE16_HANDLER( igs011_prot2_reset_w )
999
 
{
1000
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1001
 
        state->m_prot2 = 0x00;
1002
 
}
1003
 
 
1004
 
// wlcc
1005
 
static READ16_HANDLER( igs011_prot2_reset_r )
1006
 
{
1007
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1008
 
        state->m_prot2 = 0x00;
1009
 
        return 0;
1010
 
}
1011
 
 
1012
 
 
1013
 
 
1014
 
// lhb2 (55), lhb/dbc/ryukobou (33)
1015
 
static WRITE16_HANDLER( igs011_prot2_inc_w )
1016
 
{
1017
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1018
 
//  if ( (ACCESSING_BITS_8_15 && (data & 0xff00) == 0x5500) || ((ACCESSING_BITS_0_7 && (data & 0x00ff) == 0x0055)) )
1019
 
        {
1020
 
                state->m_prot2++;
1021
 
        }
1022
 
//  else
1023
 
//      logerror("%s: warning, unknown igs011_prot2_inc_w( %04x, %04x )\n", space->machine().describe_context(), offset, data);
1024
 
}
1025
 
 
1026
 
// vbowl (33)
1027
 
static WRITE16_HANDLER( igs011_prot2_dec_w )
1028
 
{
1029
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1030
 
//  if ( (ACCESSING_BITS_8_15 && (data & 0xff00) == 0x3300) || ((ACCESSING_BITS_0_7 && (data & 0x00ff) == 0x0033)) )
1031
 
        {
1032
 
                state->m_prot2--;
1033
 
        }
1034
 
//  else
1035
 
//      logerror("%s: warning, unknown igs011_prot2_dec_w( %04x, %04x )\n", space->machine().describe_context(), offset, data);
1036
 
}
1037
 
 
1038
 
 
1039
 
 
1040
 
static WRITE16_HANDLER( drgnwrld_igs011_prot2_swap_w )
1041
 
{
1042
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1043
 
        offset *= 2;
1044
 
 
1045
 
//  if ( (ACCESSING_BITS_8_15 && (data & 0xff00) == 0x3300) || ((ACCESSING_BITS_0_7 && (data & 0x00ff) == 0x0033)) )
1046
 
        {
1047
 
                // (b3&b0) . b2 . (b0|b1) . (b2^!b4) . (!b1^b3)
1048
 
                UINT8 x = state->m_prot2;
1049
 
                state->m_prot2 = ((BIT(x,3)&BIT(x,0))<<4) | (BIT(x,2)<<3) | ((BIT(x,0)|BIT(x,1))<<2) | ((BIT(x,2)^BIT(x,4)^1)<<1) | (BIT(x,1)^1^BIT(x,3));
1050
 
        }
1051
 
//  else
1052
 
//      logerror("%s: warning, unknown igs011_prot2_swap_w( %04x, %04x )\n", space->machine().describe_context(), offset, data);
1053
 
}
1054
 
 
1055
 
// lhb, xymg, lhb2
1056
 
static WRITE16_HANDLER( lhb_igs011_prot2_swap_w )
1057
 
{
1058
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1059
 
        offset *= 2;
1060
 
 
1061
 
//  if ( (ACCESSING_BITS_8_15 && (data & 0xff00) == 0x3300) || ((ACCESSING_BITS_0_7 && (data & 0x00ff) == 0x0033)) )
1062
 
        {
1063
 
                // (!b0|b1) . b2 . (b0&b1)
1064
 
                UINT8 x = state->m_prot2;
1065
 
                state->m_prot2 = (((BIT(x,0)^1)|BIT(x,1))<<2) | (BIT(x,2)<<1) | (BIT(x,0)&BIT(x,1));
1066
 
        }
1067
 
//  else
1068
 
//      logerror("%s: warning, unknown igs011_prot2_swap_w( %04x, %04x )\n", space->machine().describe_context(), offset, data);
1069
 
}
1070
 
 
1071
 
// wlcc
1072
 
static WRITE16_HANDLER( wlcc_igs011_prot2_swap_w )
1073
 
{
1074
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1075
 
        offset *= 2;
1076
 
 
1077
 
//  if ( (ACCESSING_BITS_8_15 && (data & 0xff00) == 0x3300) || ((ACCESSING_BITS_0_7 && (data & 0x00ff) == 0x0033)) )
1078
 
        {
1079
 
                // (b3 ^ b2) . (b2 ^ b1) . (b1 ^ b0) . !(b4 ^ b0) . !(b4 ^ b3)
1080
 
                UINT8 x = state->m_prot2;
1081
 
                state->m_prot2 = ((BIT(x,3)^BIT(x,2))<<4) | ((BIT(x,2)^BIT(x,1))<<3) | ((BIT(x,1)^BIT(x,0))<<2) | ((BIT(x,4)^BIT(x,0)^1)<<1) | (BIT(x,4)^BIT(x,3)^1);
1082
 
        }
1083
 
//  else
1084
 
//      logerror("%s: warning, unknown igs011_prot2_swap_w( %04x, %04x )\n", space->machine().describe_context(), offset, data);
1085
 
}
1086
 
 
1087
 
// vbowl
1088
 
static WRITE16_HANDLER( vbowl_igs011_prot2_swap_w )
1089
 
{
1090
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1091
 
        offset *= 2;
1092
 
 
1093
 
//  if ( (ACCESSING_BITS_8_15 && (data & 0xff00) == 0x3300) || ((ACCESSING_BITS_0_7 && (data & 0x00ff) == 0x0033)) )
1094
 
        {
1095
 
                // (b3 ^ b2) . (b2 ^ b1) . (b1 ^ b0) . (b4 ^ b0) . (b4 ^ b3)
1096
 
                UINT8 x = state->m_prot2;
1097
 
                state->m_prot2 = ((BIT(x,3)^BIT(x,2))<<4) | ((BIT(x,2)^BIT(x,1))<<3) | ((BIT(x,1)^BIT(x,0))<<2) | ((BIT(x,4)^BIT(x,0))<<1) | (BIT(x,4)^BIT(x,3));
1098
 
        }
1099
 
//  else
1100
 
//      logerror("%s: warning, unknown igs011_prot2_swap_w( %04x, %04x )\n", space->machine().describe_context(), offset, data);
1101
 
}
1102
 
 
1103
 
 
1104
 
 
1105
 
// drgnwrld
1106
 
static READ16_HANDLER( drgnwrldv21_igs011_prot2_r )
1107
 
{
1108
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1109
 
        // b9 = (!b4) | (!b0 & b2) | (!(b3 ^ b1) & !(!(b4 & b0) | b2))
1110
 
        UINT8 x = state->m_prot2;
1111
 
        UINT8 b9 = (BIT(x,4)^1) | ((BIT(x,0)^1) & BIT(x,2)) | ( (BIT(x,3)^BIT(x,1)^1) & ((((BIT(x,4)^1) & BIT(x,0)) | BIT(x,2))^1) );
1112
 
        return (b9 << 9);
1113
 
}
1114
 
static READ16_HANDLER( drgnwrldv20j_igs011_prot2_r )
1115
 
{
1116
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1117
 
        // b9 = (!b4 | !b0) | !(b3 | b1) | !(b2 & b0)
1118
 
        UINT8 x = state->m_prot2;
1119
 
        UINT8 b9 = ((BIT(x,4)^1) | (BIT(x,0)^1)) | ((BIT(x,3) | BIT(x,1))^1) | ((BIT(x,2) & BIT(x,0))^1);
1120
 
        return (b9 << 9);
1121
 
}
1122
 
 
1123
 
// lhb, xymg
1124
 
static READ16_HANDLER( lhb_igs011_prot2_r )
1125
 
{
1126
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1127
 
        // b9 = !b2 | (b1 & b0)
1128
 
        UINT8 x = state->m_prot2;
1129
 
        UINT8 b9 = (BIT(x,2)^1) | (BIT(x,1) & BIT(x,0));
1130
 
        return (b9 << 9);
1131
 
}
1132
 
 
1133
 
// dbc
1134
 
static READ16_HANDLER( dbc_igs011_prot2_r )
1135
 
{
1136
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1137
 
        // b9 = !b1 | (!b0 & b2)
1138
 
        UINT8 x = state->m_prot2;
1139
 
        UINT8 b9 = (BIT(x,1)^1) | ((BIT(x,0)^1) & BIT(x,2));
1140
 
        return (b9 << 9);
1141
 
}
1142
 
 
1143
 
// ryukobou
1144
 
static READ16_HANDLER( ryukobou_igs011_prot2_r )
1145
 
{
1146
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1147
 
        // b9 = (!b1 | b2) & b0
1148
 
        UINT8 x = state->m_prot2;
1149
 
        UINT8 b9 = ((BIT(x,1)^1) | BIT(x,2)) & BIT(x,0);
1150
 
        return (b9 << 9);
1151
 
}
1152
 
 
1153
 
// lhb2
1154
 
static READ16_HANDLER( lhb2_igs011_prot2_r )
1155
 
{
1156
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1157
 
        // b3 = !b2 | !b1 | b0
1158
 
        UINT8 x = state->m_prot2;
1159
 
        UINT8 b3 = (BIT(x,2)^1) | (BIT(x,1)^1) | BIT(x,0);
1160
 
        return (b3 << 3);
1161
 
}
1162
 
 
1163
 
// vbowl
1164
 
static READ16_HANDLER( vbowl_igs011_prot2_r )
1165
 
{
1166
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1167
 
        UINT8 x = state->m_prot2;
1168
 
        UINT8 b9 = ((BIT(x,4)^1) & (BIT(x,3)^1)) | ((BIT(x,2) & BIT(x,1))^1) | ((BIT(x,4) | BIT(x,0))^1);
1169
 
        return (b9 << 9);
1170
 
}
1171
 
 
1172
 
/***************************************************************************
1173
 
 
1174
 
    IGS012 Protection ("ASIC12 CHECK PORT ERROR")
1175
 
 
1176
 
    The chip holds an internal value, a buffered value and a mode.
1177
 
    These are manipulated by issuing commands, where each command is assigned
1178
 
    a specific address range, and is triggered by writing a specific byte value
1179
 
    to that range. Possible commands:
1180
 
 
1181
 
    - INC:   increment value
1182
 
    - DEC:   decrement value
1183
 
    - SWAP:  write bitswap1(value) to buffer
1184
 
    - COPY:  copy buffer to value
1185
 
    - MODE:  toggle mode (toggles address ranges to write/read and byte values to write)
1186
 
    - RESET: value = 0, mode = 0
1187
 
 
1188
 
    The protection value is read from an additional address range:
1189
 
    - READ: read bitswap2(value). Only 2 bits are checked.
1190
 
 
1191
 
***************************************************************************/
1192
 
 
1193
 
 
1194
 
static WRITE16_HANDLER( igs012_prot_reset_w )
1195
 
{
1196
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1197
 
        state->m_igs012_prot = 0x00;
1198
 
        state->m_igs012_prot_swap = 0x00;
1199
 
 
1200
 
        state->m_igs012_prot_mode = 0;
1201
 
}
1202
 
/*
1203
 
static READ16_HANDLER( igs012_prot_fake_r )
1204
 
{
1205
 
    igs011_state *state = space->machine().driver_data<igs011_state>();
1206
 
    switch (offset)
1207
 
    {
1208
 
        case 0: return state->m_igs012_prot;
1209
 
        case 1: return state->m_igs012_prot_swap;
1210
 
        case 2: return state->m_igs012_prot_mode;
1211
 
    }
1212
 
    return 0;
1213
 
}
1214
 
*/
1215
 
 
1216
 
// Macro that checks whether the current mode and data byte written match the arguments
1217
 
#define MODE_AND_DATA(_MODE,_DATA)      (state->m_igs012_prot_mode == (_MODE) && ( (ACCESSING_BITS_8_15 && (data & 0xff00) == ((_DATA)<<8)) || (ACCESSING_BITS_0_7 && ((data & 0x00ff) == (_DATA))) ) )
1218
 
 
1219
 
static WRITE16_HANDLER( igs012_prot_mode_w )
1220
 
{
1221
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1222
 
        if ( MODE_AND_DATA(0, 0xcc) || MODE_AND_DATA(1, 0xdd) )
1223
 
        {
1224
 
                state->m_igs012_prot_mode = state->m_igs012_prot_mode ^ 1;
1225
 
        }
1226
 
        else
1227
 
                logerror("%s: warning, unknown igs012_prot_mode_w( %04x, %04x ), mode %x\n", space->machine().describe_context(), offset, data, state->m_igs012_prot_mode);
1228
 
}
1229
 
 
1230
 
static WRITE16_HANDLER( igs012_prot_inc_w )
1231
 
{
1232
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1233
 
        if ( MODE_AND_DATA(0, 0xff) )
1234
 
        {
1235
 
                state->m_igs012_prot = (state->m_igs012_prot + 1) & 0x1f;
1236
 
        }
1237
 
        else
1238
 
                logerror("%s: warning, unknown igs012_prot_inc_w( %04x, %04x ), mode %x\n", space->machine().describe_context(), offset, data, state->m_igs012_prot_mode);
1239
 
}
1240
 
 
1241
 
static WRITE16_HANDLER( igs012_prot_dec_inc_w )
1242
 
{
1243
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1244
 
        if ( MODE_AND_DATA(0, 0xaa) )
1245
 
        {
1246
 
                state->m_igs012_prot = (state->m_igs012_prot - 1) & 0x1f;
1247
 
        }
1248
 
        else if ( MODE_AND_DATA(1, 0xfa) )
1249
 
        {
1250
 
                state->m_igs012_prot = (state->m_igs012_prot + 1) & 0x1f;
1251
 
        }
1252
 
        else
1253
 
                logerror("%s: warning, unknown igs012_prot_dec_inc_w( %04x, %04x ), mode %x\n", space->machine().describe_context(), offset, data, state->m_igs012_prot_mode);
1254
 
}
1255
 
 
1256
 
static WRITE16_HANDLER( igs012_prot_dec_copy_w )
1257
 
{
1258
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1259
 
        if ( MODE_AND_DATA(0, 0x33) )
1260
 
        {
1261
 
                state->m_igs012_prot = state->m_igs012_prot_swap;
1262
 
        }
1263
 
        else if ( MODE_AND_DATA(1, 0x5a) )
1264
 
        {
1265
 
                state->m_igs012_prot = (state->m_igs012_prot - 1) & 0x1f;
1266
 
        }
1267
 
        else
1268
 
                logerror("%s: warning, unknown igs012_prot_dec_copy_w( %04x, %04x ), mode %x\n", space->machine().describe_context(), offset, data, state->m_igs012_prot_mode);
1269
 
}
1270
 
 
1271
 
static WRITE16_HANDLER( igs012_prot_copy_w )
1272
 
{
1273
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1274
 
        if ( MODE_AND_DATA(1, 0x22) )
1275
 
        {
1276
 
                state->m_igs012_prot = state->m_igs012_prot_swap;
1277
 
        }
1278
 
        else
1279
 
                logerror("%s: warning, unknown igs012_prot_copy_w( %04x, %04x ), mode %x\n", space->machine().describe_context(), offset, data, state->m_igs012_prot_mode);
1280
 
}
1281
 
 
1282
 
static WRITE16_HANDLER( igs012_prot_swap_w )
1283
 
{
1284
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1285
 
        if ( MODE_AND_DATA(0, 0x55) || MODE_AND_DATA(1, 0xa5) )
1286
 
        {
1287
 
                // !(3 | 1)..(2 & 1)..(3 ^ 0)..(!2)
1288
 
                UINT8 x = state->m_igs012_prot;
1289
 
                state->m_igs012_prot_swap = (((BIT(x,3)|BIT(x,1))^1)<<3) | ((BIT(x,2)&BIT(x,1))<<2) | ((BIT(x,3)^BIT(x,0))<<1) | (BIT(x,2)^1);
1290
 
        }
1291
 
        else
1292
 
                logerror("%s: warning, unknown igs012_prot_swap_w( %04x, %04x ), mode %x\n", space->machine().describe_context(), offset, data, state->m_igs012_prot_mode);
1293
 
}
1294
 
 
1295
 
static READ16_HANDLER( igs012_prot_r )
1296
 
{
1297
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1298
 
        // FIXME: mode 0 and mode 1 are mapped to different memory ranges
1299
 
        UINT8 x = state->m_igs012_prot;
1300
 
 
1301
 
        UINT8 b1 = (BIT(x,3) | BIT(x,1))^1;
1302
 
        UINT8 b0 = BIT(x,3) ^ BIT(x,0);
1303
 
 
1304
 
        return (b1 << 1) | (b0 << 0);
1305
 
}
1306
 
 
1307
 
/***************************************************************************
1308
 
 
1309
 
    IGS003 (8255 I/O + Protection)
1310
 
 
1311
 
***************************************************************************/
1312
 
 
1313
 
 
1314
 
static WRITE16_HANDLER( drgnwrld_igs003_w )
1315
 
{
1316
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1317
 
        COMBINE_DATA(&state->m_igs003_reg[offset]);
1318
 
 
1319
 
        if (offset == 0)
1320
 
                return;
1321
 
 
1322
 
        switch(state->m_igs003_reg[0])
1323
 
        {
1324
 
 
1325
 
                case 0x00:
1326
 
                        if (ACCESSING_BITS_0_7)
1327
 
                                coin_counter_w(space->machine(), 0,data & 2);
1328
 
 
1329
 
                        if (data & ~0x2)
1330
 
                                logerror("%06x: warning, unknown bits written in coin counter = %02x\n", cpu_get_pc(&space->device()), data);
1331
 
 
1332
 
                        break;
1333
 
 
1334
 
//      case 0x01:
1335
 
                // 0,1,4 written
1336
 
 
1337
 
//      case 0x03:
1338
 
//      case 0x04:
1339
 
//      case 0x05:
1340
 
 
1341
 
                default:
1342
 
//          popmessage("igs003 %x <- %04x",state->m_igs003_reg[0],data);
1343
 
                        logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", cpu_get_pc(&space->device()), state->m_igs003_reg[0], data);
1344
 
        }
1345
 
}
1346
 
static READ16_HANDLER( drgnwrld_igs003_r )
1347
 
{
1348
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1349
 
        switch(state->m_igs003_reg[0])
1350
 
        {
1351
 
                case 0x00:      return input_port_read(space->machine(), "IN0");
1352
 
                case 0x01:      return input_port_read(space->machine(), "IN1");
1353
 
                case 0x02:      return input_port_read(space->machine(), "IN2");
1354
 
 
1355
 
                case 0x20:      return 0x49;
1356
 
                case 0x21:      return 0x47;
1357
 
                case 0x22:      return 0x53;
1358
 
 
1359
 
                case 0x24:      return 0x41;
1360
 
                case 0x25:      return 0x41;
1361
 
                case 0x26:      return 0x7f;
1362
 
                case 0x27:      return 0x41;
1363
 
                case 0x28:      return 0x41;
1364
 
 
1365
 
                case 0x2a:      return 0x3e;
1366
 
                case 0x2b:      return 0x41;
1367
 
                case 0x2c:      return 0x49;
1368
 
                case 0x2d:      return 0xf9;
1369
 
                case 0x2e:      return 0x0a;
1370
 
 
1371
 
                case 0x30:      return 0x26;
1372
 
                case 0x31:      return 0x49;
1373
 
                case 0x32:      return 0x49;
1374
 
                case 0x33:      return 0x49;
1375
 
                case 0x34:      return 0x32;
1376
 
 
1377
 
                default:
1378
 
                        logerror("%06x: warning, reading with igs003_reg = %02x\n", cpu_get_pc(&space->device()), state->m_igs003_reg[0]);
1379
 
        }
1380
 
 
1381
 
        return 0;
1382
 
}
1383
 
 
1384
 
 
1385
 
 
1386
 
static WRITE16_HANDLER( lhb_inputs_w )
1387
 
{
1388
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1389
 
        COMBINE_DATA(&state->m_igs_input_sel);
1390
 
 
1391
 
        if (ACCESSING_BITS_0_7)
1392
 
        {
1393
 
                coin_counter_w(space->machine(), 0,     data & 0x20     );
1394
 
                //  coin out        data & 0x40
1395
 
                state->m_igs_hopper             =       data & 0x80;
1396
 
        }
1397
 
 
1398
 
        if ( state->m_igs_input_sel & (~0xff) )
1399
 
                logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", cpu_get_pc(&space->device()), state->m_igs_input_sel);
1400
 
 
1401
 
//  popmessage("sel2 %02x",state->m_igs_input_sel&~0x1f);
1402
 
}
1403
 
static READ16_HANDLER( lhb_inputs_r )
1404
 
{
1405
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1406
 
        switch(offset)
1407
 
        {
1408
 
                case 0:         return state->m_igs_input_sel;
1409
 
 
1410
 
                case 1:
1411
 
                        if (~state->m_igs_input_sel & 0x01)     return input_port_read(space->machine(), "KEY0");
1412
 
                        if (~state->m_igs_input_sel & 0x02)     return input_port_read(space->machine(), "KEY1");
1413
 
                        if (~state->m_igs_input_sel & 0x04)     return input_port_read(space->machine(), "KEY2");
1414
 
                        if (~state->m_igs_input_sel & 0x08)     return input_port_read(space->machine(), "KEY3");
1415
 
                        if (~state->m_igs_input_sel & 0x10)     return input_port_read(space->machine(), "KEY4");
1416
 
 
1417
 
                        logerror("%06x: warning, reading with igs_input_sel = %02x\n", cpu_get_pc(&space->device()), state->m_igs_input_sel);
1418
 
                        break;
1419
 
        }
1420
 
        return 0;
1421
 
}
1422
 
 
1423
 
 
1424
 
 
1425
 
static WRITE16_HANDLER( lhb2_igs003_w )
1426
 
{
1427
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1428
 
        COMBINE_DATA(&state->m_igs003_reg[offset]);
1429
 
 
1430
 
        if (offset == 0)
1431
 
                return;
1432
 
 
1433
 
        switch(state->m_igs003_reg[0])
1434
 
        {
1435
 
                case 0x00:
1436
 
                        COMBINE_DATA(&state->m_igs_input_sel);
1437
 
 
1438
 
                        if (ACCESSING_BITS_0_7)
1439
 
                        {
1440
 
                                coin_counter_w(space->machine(), 0,     data & 0x20);
1441
 
                                //  coin out        data & 0x40
1442
 
                                state->m_igs_hopper             =       data & 0x80;
1443
 
                        }
1444
 
 
1445
 
                        if ( state->m_igs_input_sel & ~0x7f )
1446
 
                                logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", cpu_get_pc(&space->device()), state->m_igs_input_sel);
1447
 
 
1448
 
//          popmessage("sel2 %02x",state->m_igs_input_sel&~0x1f);
1449
 
                        break;
1450
 
 
1451
 
                case 0x02:
1452
 
                        if (ACCESSING_BITS_0_7)
1453
 
                        {
1454
 
                                state->m_lhb2_pen_hi = data & 0x07;
1455
 
 
1456
 
                                okim6295_device *oki = space->machine().device<okim6295_device>("oki");
1457
 
                                oki->set_bank_base((data & 0x08) ? 0x40000 : 0);
1458
 
                        }
1459
 
 
1460
 
                        if ( state->m_lhb2_pen_hi & ~0xf )
1461
 
                                logerror("%06x: warning, unknown bits written in lhb2_pen_hi = %02x\n", cpu_get_pc(&space->device()), state->m_lhb2_pen_hi);
1462
 
 
1463
 
//          popmessage("oki %02x",state->m_lhb2_pen_hi & 0x08);
1464
 
                        break;
1465
 
 
1466
 
                default:
1467
 
                        logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", cpu_get_pc(&space->device()), state->m_igs003_reg[0], data);
1468
 
        }
1469
 
}
1470
 
static READ16_HANDLER( lhb2_igs003_r )
1471
 
{
1472
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1473
 
        switch(state->m_igs003_reg[0])
1474
 
        {
1475
 
                case 0x01:
1476
 
                        if (~state->m_igs_input_sel & 0x01)     return input_port_read(space->machine(), "KEY0");
1477
 
                        if (~state->m_igs_input_sel & 0x02)     return input_port_read(space->machine(), "KEY1");
1478
 
                        if (~state->m_igs_input_sel & 0x04)     return input_port_read(space->machine(), "KEY2");
1479
 
                        if (~state->m_igs_input_sel & 0x08)     return input_port_read(space->machine(), "KEY3");
1480
 
                        if (~state->m_igs_input_sel & 0x10)     return input_port_read(space->machine(), "KEY4");
1481
 
                        /* fall through */
1482
 
                default:
1483
 
                        logerror("%06x: warning, reading with igs003_reg = %02x\n", cpu_get_pc(&space->device()), state->m_igs003_reg[0]);
1484
 
                        break;
1485
 
 
1486
 
//      case 0x03:
1487
 
//          return 0xff;    // parametric bitswaps?
1488
 
 
1489
 
                // Protection:
1490
 
                // 0544FE: 20 21 22 24 25 26 27 28 2A 2B 2C 2D 2E 30 31 32 33 34
1491
 
                // 0544EC: 49 47 53 41 41 7F 41 41 3E 41 49 F9 0A 26 49 49 49 32
1492
 
 
1493
 
                case 0x20:      return 0x49;
1494
 
                case 0x21:      return 0x47;
1495
 
                case 0x22:      return 0x53;
1496
 
 
1497
 
                case 0x24:      return 0x41;
1498
 
                case 0x25:      return 0x41;
1499
 
                case 0x26:      return 0x7f;
1500
 
                case 0x27:      return 0x41;
1501
 
                case 0x28:      return 0x41;
1502
 
 
1503
 
                case 0x2a:      return 0x3e;
1504
 
                case 0x2b:      return 0x41;
1505
 
                case 0x2c:      return 0x49;
1506
 
                case 0x2d:      return 0xf9;
1507
 
                case 0x2e:      return 0x0a;
1508
 
 
1509
 
                case 0x30:      return 0x26;
1510
 
                case 0x31:      return 0x49;
1511
 
                case 0x32:      return 0x49;
1512
 
                case 0x33:      return 0x49;
1513
 
                case 0x34:      return 0x32;
1514
 
        }
1515
 
 
1516
 
        return 0;
1517
 
}
1518
 
 
1519
 
 
1520
 
 
1521
 
static WRITE16_HANDLER( wlcc_igs003_w )
1522
 
{
1523
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1524
 
        COMBINE_DATA(&state->m_igs003_reg[offset]);
1525
 
 
1526
 
        if (offset == 0)
1527
 
                return;
1528
 
 
1529
 
        switch(state->m_igs003_reg[0])
1530
 
        {
1531
 
                case 0x02:
1532
 
                        if (ACCESSING_BITS_0_7)
1533
 
                        {
1534
 
                                coin_counter_w(space->machine(), 0,     data & 0x01);
1535
 
                                //  coin out        data & 0x02
1536
 
 
1537
 
                                okim6295_device *oki = space->machine().device<okim6295_device>("oki");
1538
 
                                oki->set_bank_base((data & 0x10) ? 0x40000 : 0);
1539
 
                                state->m_igs_hopper             =       data & 0x20;
1540
 
                        }
1541
 
 
1542
 
                        if (data & ~0x33)
1543
 
                                logerror("%06x: warning, unknown bits written in coin counter = %02x\n", cpu_get_pc(&space->device()), data);
1544
 
 
1545
 
//          popmessage("coin %02x",data);
1546
 
                        break;
1547
 
 
1548
 
                default:
1549
 
                        logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", cpu_get_pc(&space->device()), state->m_igs003_reg[0], data);
1550
 
        }
1551
 
}
1552
 
static READ16_HANDLER( wlcc_igs003_r )
1553
 
{
1554
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1555
 
        switch(state->m_igs003_reg[0])
1556
 
        {
1557
 
                case 0x00:      return input_port_read(space->machine(), "IN0");
1558
 
 
1559
 
                case 0x20:      return 0x49;
1560
 
                case 0x21:      return 0x47;
1561
 
                case 0x22:      return 0x53;
1562
 
 
1563
 
                case 0x24:      return 0x41;
1564
 
                case 0x25:      return 0x41;
1565
 
                case 0x26:      return 0x7f;
1566
 
                case 0x27:      return 0x41;
1567
 
                case 0x28:      return 0x41;
1568
 
 
1569
 
                case 0x2a:      return 0x3e;
1570
 
                case 0x2b:      return 0x41;
1571
 
                case 0x2c:      return 0x49;
1572
 
                case 0x2d:      return 0xf9;
1573
 
                case 0x2e:      return 0x0a;
1574
 
 
1575
 
                case 0x30:      return 0x26;
1576
 
                case 0x31:      return 0x49;
1577
 
                case 0x32:      return 0x49;
1578
 
                case 0x33:      return 0x49;
1579
 
                case 0x34:      return 0x32;
1580
 
 
1581
 
                default:
1582
 
                        logerror("%06x: warning, reading with igs003_reg = %02x\n", cpu_get_pc(&space->device()), state->m_igs003_reg[0]);
1583
 
        }
1584
 
 
1585
 
        return 0;
1586
 
}
1587
 
 
1588
 
 
1589
 
 
1590
 
static WRITE16_HANDLER( xymg_igs003_w )
1591
 
{
1592
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1593
 
        COMBINE_DATA(&state->m_igs003_reg[offset]);
1594
 
 
1595
 
        if (offset == 0)
1596
 
                return;
1597
 
 
1598
 
        switch(state->m_igs003_reg[0])
1599
 
        {
1600
 
                case 0x01:
1601
 
                        COMBINE_DATA(&state->m_igs_input_sel);
1602
 
 
1603
 
                        if (ACCESSING_BITS_0_7)
1604
 
                        {
1605
 
                                coin_counter_w(space->machine(), 0,     data & 0x20);
1606
 
                                //  coin out        data & 0x40
1607
 
                                state->m_igs_hopper             =       data & 0x80;
1608
 
                        }
1609
 
 
1610
 
                        if ( state->m_igs_input_sel & 0x40 )
1611
 
                                logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", cpu_get_pc(&space->device()), state->m_igs_input_sel);
1612
 
 
1613
 
//          popmessage("sel2 %02x",state->m_igs_input_sel&~0x1f);
1614
 
                        break;
1615
 
 
1616
 
                default:
1617
 
                        logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", cpu_get_pc(&space->device()), state->m_igs003_reg[0], data);
1618
 
        }
1619
 
}
1620
 
static READ16_HANDLER( xymg_igs003_r )
1621
 
{
1622
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1623
 
        switch(state->m_igs003_reg[0])
1624
 
        {
1625
 
                case 0x00:      return input_port_read(space->machine(), "COIN");
1626
 
 
1627
 
                case 0x02:
1628
 
                        if (~state->m_igs_input_sel & 0x01)     return input_port_read(space->machine(), "KEY0");
1629
 
                        if (~state->m_igs_input_sel & 0x02)     return input_port_read(space->machine(), "KEY1");
1630
 
                        if (~state->m_igs_input_sel & 0x04)     return input_port_read(space->machine(), "KEY2");
1631
 
                        if (~state->m_igs_input_sel & 0x08)     return input_port_read(space->machine(), "KEY3");
1632
 
                        if (~state->m_igs_input_sel & 0x10)     return input_port_read(space->machine(), "KEY4");
1633
 
                        /* fall through */
1634
 
 
1635
 
                case 0x20:      return 0x49;
1636
 
                case 0x21:      return 0x47;
1637
 
                case 0x22:      return 0x53;
1638
 
 
1639
 
                case 0x24:      return 0x41;
1640
 
                case 0x25:      return 0x41;
1641
 
                case 0x26:      return 0x7f;
1642
 
                case 0x27:      return 0x41;
1643
 
                case 0x28:      return 0x41;
1644
 
 
1645
 
                case 0x2a:      return 0x3e;
1646
 
                case 0x2b:      return 0x41;
1647
 
                case 0x2c:      return 0x49;
1648
 
                case 0x2d:      return 0xf9;
1649
 
                case 0x2e:      return 0x0a;
1650
 
 
1651
 
                case 0x30:      return 0x26;
1652
 
                case 0x31:      return 0x49;
1653
 
                case 0x32:      return 0x49;
1654
 
                case 0x33:      return 0x49;
1655
 
                case 0x34:      return 0x32;
1656
 
 
1657
 
                default:
1658
 
                        logerror("%06x: warning, reading with igs003_reg = %02x\n", cpu_get_pc(&space->device()), state->m_igs003_reg[0]);
1659
 
                        break;
1660
 
        }
1661
 
 
1662
 
        return 0;
1663
 
}
1664
 
 
1665
 
 
1666
 
 
1667
 
static WRITE16_HANDLER( vbowl_igs003_w )
1668
 
{
1669
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1670
 
        COMBINE_DATA(&state->m_igs003_reg[offset]);
1671
 
 
1672
 
        if (offset == 0)
1673
 
                return;
1674
 
 
1675
 
        switch(state->m_igs003_reg[0])
1676
 
        {
1677
 
                case 0x02:
1678
 
                        if (ACCESSING_BITS_0_7)
1679
 
                        {
1680
 
                                coin_counter_w(space->machine(), 0, data & 1);
1681
 
                                coin_counter_w(space->machine(), 1, data & 2);
1682
 
                        }
1683
 
 
1684
 
                        if (data & ~0x3)
1685
 
                                logerror("%06x: warning, unknown bits written in coin counter = %02x\n", cpu_get_pc(&space->device()), data);
1686
 
 
1687
 
                        break;
1688
 
 
1689
 
                default:
1690
 
//          popmessage("igs003 %x <- %04x",state->m_igs003_reg[0],data);
1691
 
                        logerror("%06x: warning, writing to igs003_reg %02x = %02x\n", cpu_get_pc(&space->device()), state->m_igs003_reg[0], data);
1692
 
        }
1693
 
}
1694
 
static READ16_HANDLER( vbowl_igs003_r )
1695
 
{
1696
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
1697
 
        switch(state->m_igs003_reg[0])
1698
 
        {
1699
 
                case 0x00:      return input_port_read(space->machine(), "IN0");
1700
 
                case 0x01:      return input_port_read(space->machine(), "IN1");
1701
 
 
1702
 
//      case 0x03:
1703
 
//          return 0xff;    // parametric bitswaps?
1704
 
 
1705
 
                case 0x20:      return 0x49;
1706
 
                case 0x21:      return 0x47;
1707
 
                case 0x22:      return 0x53;
1708
 
 
1709
 
                case 0x24:      return 0x41;
1710
 
                case 0x25:      return 0x41;
1711
 
                case 0x26:      return 0x7f;
1712
 
                case 0x27:      return 0x41;
1713
 
                case 0x28:      return 0x41;
1714
 
 
1715
 
                case 0x2a:      return 0x3e;
1716
 
                case 0x2b:      return 0x41;
1717
 
                case 0x2c:      return 0x49;
1718
 
                case 0x2d:      return 0xf9;
1719
 
                case 0x2e:      return 0x0a;
1720
 
 
1721
 
                case 0x30:      return 0x26;
1722
 
                case 0x31:      return 0x49;
1723
 
                case 0x32:      return 0x49;
1724
 
                case 0x33:      return 0x49;
1725
 
                case 0x34:      return 0x32;
1726
 
 
1727
 
                default:
1728
 
                        logerror("%06x: warning, reading with igs003_reg = %02x\n", cpu_get_pc(&space->device()), state->m_igs003_reg[0]);
1729
 
        }
1730
 
 
1731
 
        return 0;
1732
 
}
1733
 
 
1734
 
 
1735
 
 
1736
 
/***************************************************************************
1737
 
 
1738
 
    Driver Inits (Decryption, Protection Patches)
1739
 
 
1740
 
***************************************************************************/
1741
 
 
1742
 
// V0400O
1743
 
static DRIVER_INIT( drgnwrld )
1744
 
{
1745
 
//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1746
 
 
1747
 
        drgnwrld_type1_decrypt(machine);
1748
 
        drgnwrld_gfx_decrypt(machine);
1749
 
/*
1750
 
    // PROTECTION CHECKS
1751
 
    rom[0x032ee/2]  =   0x606c;     // 0032EE: 676C        beq 335c     (ASIC11 CHECK PORT ERROR 3)
1752
 
    rom[0x23d5e/2]  =   0x606c;     // 023D5E: 676C        beq 23dcc    (CHECK PORT ERROR 1)
1753
 
    rom[0x23fd0/2]  =   0x606c;     // 023FD0: 676C        beq 2403e    (CHECK PORT ERROR 2)
1754
 
    rom[0x24170/2]  =   0x606c;     // 024170: 676C        beq 241de    (CHECK PORT ERROR 3)
1755
 
    rom[0x24348/2]  =   0x606c;     // 024348: 676C        beq 243b6    (ASIC11 CHECK PORT ERROR 4)
1756
 
    rom[0x2454e/2]  =   0x606c;     // 02454E: 676C        beq 245bc    (ASIC11 CHECK PORT ERROR 3)
1757
 
    rom[0x246cc/2]  =   0x606c;     // 0246CC: 676C        beq 2473a    (ASIC11 CHECK PORT ERROR 2)
1758
 
    rom[0x24922/2]  =   0x606c;     // 024922: 676C        beq 24990    (ASIC11 CHECK PORT ERROR 1)
1759
 
 
1760
 
    rom[0x24b66/2]  =   0x606c;     // 024B66: 676C        beq 24bd4    (ASIC12 CHECK PORT ERROR 4)
1761
 
    rom[0x24de2/2]  =   0x606c;     // 024DE2: 676C        beq 24e50    (ASIC12 CHECK PORT ERROR 3)
1762
 
    rom[0x2502a/2]  =   0x606c;     // 02502A: 676C        beq 25098    (ASIC12 CHECK PORT ERROR 2)
1763
 
    rom[0x25556/2]  =   0x6000;     // 025556: 6700 E584   beq 23adc    (ASIC12 CHECK PORT ERROR 1)
1764
 
 
1765
 
    rom[0x2a16c/2]  =   0x606c;     // 02A16C: 676C        beq 2a1da    (ASIC11 CHECK PORT ERROR 2)
1766
 
*/
1767
 
}
1768
 
 
1769
 
static DRIVER_INIT( drgnwrldv30 )
1770
 
{
1771
 
//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1772
 
 
1773
 
        drgnwrld_type1_decrypt(machine);
1774
 
        drgnwrld_gfx_decrypt(machine);
1775
 
/*
1776
 
    // PROTECTION CHECKS
1777
 
    rom[0x032ee/2]  =   0x606c;     // 0032EE: 676C        beq 335c     (ASIC11 CHECK PORT ERROR 3)
1778
 
    rom[0x23d5e/2]  =   0x606c;     // 023D5E: 676C        beq 23dcc    (CHECK PORT ERROR 1)
1779
 
    rom[0x23fd0/2]  =   0x606c;     // 023FD0: 676C        beq 2403e    (CHECK PORT ERROR 2)
1780
 
    rom[0x24170/2]  =   0x606c;     // 024170: 676C        beq 241de    (CHECK PORT ERROR 3)
1781
 
    rom[0x24348/2]  =   0x606c;     // 024348: 676C        beq 243b6    (ASIC11 CHECK PORT ERROR 4)
1782
 
    rom[0x2454e/2]  =   0x606c;     // 02454E: 676C        beq 245bc    (ASIC11 CHECK PORT ERROR 3)
1783
 
    rom[0x246cc/2]  =   0x606c;     // 0246CC: 676C        beq 2473a    (ASIC11 CHECK PORT ERROR 2)
1784
 
    rom[0x24922/2]  =   0x606c;     // 024922: 676C        beq 24990    (ASIC11 CHECK PORT ERROR 1)
1785
 
    rom[0x24b66/2]  =   0x606c;     // 024B66: 676C        beq 24bd4    (ASIC12 CHECK PORT ERROR 4)
1786
 
    rom[0x24de2/2]  =   0x606c;     // 024DE2: 676C        beq 24e50    (ASIC12 CHECK PORT ERROR 3)
1787
 
    rom[0x2502a/2]  =   0x606c;     // 02502A: 676C        beq 25098    (ASIC12 CHECK PORT ERROR 2)
1788
 
    rom[0x25556/2]  =   0x6000;     // 025556: 6700 E584   beq 23adc    (ASIC12 CHECK PORT ERROR 1)
1789
 
    // different from drgnwrld:
1790
 
    rom[0x2a162/2]  =   0x606c;     // 02A162: 676C        beq 2a1d0    (ASIC11 CHECK PORT ERROR 2)
1791
 
*/
1792
 
}
1793
 
 
1794
 
static DRIVER_INIT( drgnwrldv21 )
1795
 
{
1796
 
//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1797
 
 
1798
 
        drgnwrld_type2_decrypt(machine);
1799
 
        drgnwrld_gfx_decrypt(machine);
1800
 
 
1801
 
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xd4c0, 0xd4ff, FUNC(drgnwrldv21_igs011_prot2_r));
1802
 
/*
1803
 
    // PROTECTION CHECKS
1804
 
    // bp 32ee; bp 11ca8; bp 23d5e; bp 23fd0; bp 24170; bp 24348; bp 2454e; bp 246cc; bp 24922; bp 24b66; bp 24de2; bp 2502a; bp 25556; bp 269de; bp 2766a; bp 2a830
1805
 
    rom[0x032ee/2]  =   0x606c;     // 0032EE: 676C        beq 335c     (ASIC11 CHECK PORT ERROR 3)
1806
 
    rom[0x11ca8/2]  =   0x606c;     // 011CA8: 676C        beq 11d16    (CHECK PORT ERROR 1)
1807
 
    rom[0x23d5e/2]  =   0x606c;     // 023D5E: 676C        beq 23dcc    (CHECK PORT ERROR 1)
1808
 
    rom[0x23fd0/2]  =   0x606c;     // 023FD0: 676C        beq 2403e    (CHECK PORT ERROR 2)
1809
 
    rom[0x24170/2]  =   0x606c;     // 024170: 676C        beq 241de    (CHECK PORT ERROR 3)
1810
 
    rom[0x24348/2]  =   0x606c;     // 024348: 676C        beq 243b6    (ASIC11 CHECK PORT ERROR 4)
1811
 
    rom[0x2454e/2]  =   0x606c;     // 02454E: 676C        beq 245bc    (ASIC11 CHECK PORT ERROR 3)
1812
 
    rom[0x246cc/2]  =   0x606c;     // 0246CC: 676C        beq 2473a    (ASIC11 CHECK PORT ERROR 2)
1813
 
    rom[0x24922/2]  =   0x606c;     // 024922: 676C        beq 24990    (ASIC11 CHECK PORT ERROR 1)
1814
 
    rom[0x24b66/2]  =   0x606c;     // 024B66: 676C        beq 24bd4    (ASIC12 CHECK PORT ERROR 4)
1815
 
    rom[0x24de2/2]  =   0x606c;     // 024DE2: 676C        beq 24e50    (ASIC12 CHECK PORT ERROR 3)
1816
 
    rom[0x2502a/2]  =   0x606c;     // 02502A: 676C        beq 25098    (ASIC12 CHECK PORT ERROR 2)
1817
 
    rom[0x25556/2]  =   0x6000;     // 025556: 6700 E584   beq 23adc    (ASIC12 CHECK PORT ERROR 1)
1818
 
    rom[0x269de/2]  =   0x606c;     // 0269DE: 676C        beq 26a4c    (ASIC12 CHECK PORT ERROR 1)
1819
 
    rom[0x2766a/2]  =   0x606c;     // 02766A: 676C        beq 276d8    (CHECK PORT ERROR 3)
1820
 
    rom[0x2a830/2]  =   0x606c;     // 02A830: 676C        beq 2a89e    (ASIC11 CHECK PORT ERROR 2)
1821
 
*/
1822
 
}
1823
 
 
1824
 
static DRIVER_INIT( drgnwrldv21j )
1825
 
{
1826
 
//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1827
 
 
1828
 
        drgnwrld_type3_decrypt(machine);
1829
 
        drgnwrld_gfx_decrypt(machine);
1830
 
/*
1831
 
    // PROTECTION CHECKS
1832
 
    rom[0x033d2/2]  =   0x606c;     // 0033D2: 676C        beq 3440     (ASIC11 CHECK PORT ERROR 3)
1833
 
    rom[0x11c74/2]  =   0x606c;     // 011C74: 676C        beq 11ce2    (CHECK PORT ERROR 1)
1834
 
    rom[0x23d2a/2]  =   0x606c;     // 023D2A: 676C        beq 23d98
1835
 
    rom[0x23f68/2]  =   0x606c;     // 023F68: 676C        beq 23fd6
1836
 
    rom[0x240d4/2]  =   0x606c;     // 0240D4: 676C        beq 24142    (CHECK PORT ERROR 3)
1837
 
    rom[0x242ac/2]  =   0x606c;     // 0242AC: 676C        beq 2431a
1838
 
    rom[0x244b2/2]  =   0x606c;     // 0244B2: 676C        beq 24520
1839
 
    rom[0x24630/2]  =   0x606c;     // 024630: 676C        beq 2469e
1840
 
    rom[0x24886/2]  =   0x606c;     // 024886: 676C        beq 248f4
1841
 
    rom[0x24aca/2]  =   0x606c;     // 024ACA: 676C        beq 24b38
1842
 
    rom[0x24d46/2]  =   0x606c;     // 024D46: 676C        beq 24db4
1843
 
    rom[0x24f8e/2]  =   0x606c;     // 024F8E: 676C        beq 24ffc
1844
 
    rom[0x254ba/2]  =   0x6000;     // 0254BA: 6700 E620   beq 23adc    (ASIC12 CHECK PORT ERROR 1)
1845
 
    rom[0x26a52/2]  =   0x606c;     // 026A52: 676C        beq 26ac0    (ASIC12 CHECK PORT ERROR 1)
1846
 
    rom[0x276aa/2]  =   0x606c;     // 0276AA: 676C        beq 27718    (CHECK PORT ERROR 3)
1847
 
    rom[0x2a870/2]  =   0x606c;     // 02A870: 676C        beq 2a8de    (ASIC11 CHECK PORT ERROR 2)
1848
 
*/
1849
 
}
1850
 
 
1851
 
static DRIVER_INIT( drgnwrldv20j )
1852
 
{
1853
 
//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1854
 
 
1855
 
        drgnwrld_type3_decrypt(machine);
1856
 
        drgnwrld_gfx_decrypt(machine);
1857
 
/*
1858
 
    // PROTECTION CHECKS
1859
 
    // bp 33d2; bp 11c74; bp 23d2a; bp 23f68; bp 240d4; bp 242ac; bp 244b2; bp 24630; bp 24886; bp 24aca; bp 24d46; bp 24f8e; bp 254ba; bp 26a52; bp 276a0; bp 2a86e
1860
 
    rom[0x033d2/2]  =   0x606c;     // 0033D2: 676C        beq 3440     (ASIC11 CHECK PORT ERROR 3)
1861
 
    rom[0x11c74/2]  =   0x606c;     // 011C74: 676C        beq 11ce2    (CHECK PORT ERROR 1)
1862
 
    rom[0x23d2a/2]  =   0x606c;     // 023D2A: 676C        beq 23d98
1863
 
    rom[0x23f68/2]  =   0x606c;     // 023F68: 676C        beq 23fd6
1864
 
    rom[0x240d4/2]  =   0x606c;     // 0240D4: 676C        beq 24142    (CHECK PORT ERROR 3)
1865
 
    rom[0x242ac/2]  =   0x606c;     // 0242AC: 676C        beq 2431a
1866
 
    rom[0x244b2/2]  =   0x606c;     // 0244B2: 676C        beq 24520
1867
 
    rom[0x24630/2]  =   0x606c;     // 024630: 676C        beq 2469e
1868
 
    rom[0x24886/2]  =   0x606c;     // 024886: 676C        beq 248f4
1869
 
    rom[0x24aca/2]  =   0x606c;     // 024ACA: 676C        beq 24b38
1870
 
    rom[0x24d46/2]  =   0x606c;     // 024D46: 676C        beq 24db4
1871
 
    rom[0x24f8e/2]  =   0x606c;     // 024F8E: 676C        beq 24ffc
1872
 
    rom[0x254ba/2]  =   0x6000;     // 0254BA: 6700 E620   beq 23adc    (ASIC12 CHECK PORT ERROR 1)
1873
 
    rom[0x26a52/2]  =   0x606c;     // 026A52: 676C        beq 26ac0    (ASIC12 CHECK PORT ERROR 1)
1874
 
    // different from drgnwrldv21j:
1875
 
    rom[0x276a0/2]  =   0x606c;     // 0276A0: 676C        beq 2770e    (CHECK PORT ERROR 3)
1876
 
    rom[0x2a86e/2]  =   0x606c;     // 02A86E: 676C        beq 2a8dc    (ASIC11 CHECK PORT ERROR 2)
1877
 
*/
1878
 
}
1879
 
 
1880
 
static DRIVER_INIT( drgnwrldv11h )
1881
 
{
1882
 
        drgnwrld_type1_decrypt(machine);
1883
 
        drgnwrld_gfx_decrypt(machine);
1884
 
 
1885
 
        // PROTECTION CHECKS
1886
 
        // the protection checks are already patched out like we do!
1887
 
}
1888
 
 
1889
 
static DRIVER_INIT( drgnwrldv10c )
1890
 
{
1891
 
//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1892
 
 
1893
 
        drgnwrld_type1_decrypt(machine);
1894
 
        drgnwrld_gfx_decrypt(machine);
1895
 
/*
1896
 
    // PROTECTION CHECKS
1897
 
    // bp 33d2; bp 23d0e; bp 23f58; bp 240d0; bp 242a8; bp 244ae; bp 2462c; bp 24882; bp 24ac6; bp 24d42; bp 24f8a; bp 254b6; bp 2a23a
1898
 
    rom[0x033d2/2]  =   0x606c;     // 0033D2: 676C        beq 3440     (ASIC11 CHECK PORT ERROR 3)
1899
 
    rom[0x23d0e/2]  =   0x606c;     // 023D0E: 676C        beq 23d7c    (CHECK PORT ERROR 1)
1900
 
    rom[0x23f58/2]  =   0x606c;     // 023F58: 676C        beq 23fc6    (CHECK PORT ERROR 2)
1901
 
    rom[0x240d0/2]  =   0x606c;     // 0240D0: 676C        beq 2413e    (CHECK PORT ERROR 3)
1902
 
    rom[0x242a8/2]  =   0x606c;     // 0242A8: 676C        beq 24316    (ASIC11 CHECK PORT ERROR 4)
1903
 
    rom[0x244ae/2]  =   0x606c;     // 0244AE: 676C        beq 2451c    (ASIC11 CHECK PORT ERROR 3)
1904
 
    rom[0x2462c/2]  =   0x606c;     // 02462C: 676C        beq 2469a    (ASIC11 CHECK PORT ERROR 2)
1905
 
    rom[0x24882/2]  =   0x606c;     // 024882: 676C        beq 248f0    (ASIC11 CHECK PORT ERROR 1)
1906
 
    rom[0x24ac6/2]  =   0x606c;     // 024AC6: 676C        beq 24b34    (ASIC12 CHECK PORT ERROR 4)
1907
 
    rom[0x24d42/2]  =   0x606c;     // 024D42: 676C        beq 24db0    (ASIC12 CHECK PORT ERROR 3)
1908
 
    rom[0x24f8a/2]  =   0x606c;     // 024F8A: 676C        beq 24ff8    (ASIC12 CHECK PORT ERROR 2)
1909
 
    rom[0x254b6/2]  =   0x6000;     // 0254B6: 6700 E5FC   beq 23ab4    (ASIC12 CHECK PORT ERROR 1)
1910
 
    rom[0x2a23a/2]  =   0x606c;     // 02A23A: 676C        beq 2a2a8    (ASIC11 CHECK PORT ERROR 2)
1911
 
*/
1912
 
}
1913
 
 
1914
 
 
1915
 
static DRIVER_INIT( lhb )
1916
 
{
1917
 
//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1918
 
 
1919
 
        lhb_decrypt(machine);
1920
 
 
1921
 
        // PROTECTION CHECKS
1922
 
//  rom[0x2eef6/2]  =   0x4e75;     // 02EEF6: 4E56 FE00    link A6, #-$200  (fills palette with pink otherwise)
1923
 
}
1924
 
 
1925
 
static DRIVER_INIT( lhbv33c )
1926
 
{
1927
 
//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1928
 
 
1929
 
        lhb_decrypt(machine);
1930
 
 
1931
 
        // PROTECTION CHECKS
1932
 
//  rom[0x2e988/2]  =   0x4e75;     // 02E988: 4E56 FE00    link A6, #-$200  (fills palette with pink otherwise)
1933
 
}
1934
 
 
1935
 
static DRIVER_INIT( dbc )
1936
 
{
1937
 
//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1938
 
 
1939
 
        dbc_decrypt(machine);
1940
 
 
1941
 
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x10600, 0x107ff, FUNC(dbc_igs011_prot2_r));
1942
 
/*
1943
 
    // PROTECTION CHECKS
1944
 
    rom[0x04c42/2]  =   0x602e;     // 004C42: 6604         bne 4c48  (rom test error otherwise)
1945
 
    rom[0x08694/2]  =   0x6008;     // 008694: 6408         bcc 869e  (fills screen with characters otherwise)
1946
 
    rom[0x0a05e/2]  =   0x4e71;     // 00A05E: 6408         bcc a068  (fills screen with characters otherwise)
1947
 
    rom[0x0bec2/2]  =   0x6008;     // 00BEC2: 6408         bcc becc  (fills screen with characters otherwise)
1948
 
    rom[0x0c0d4/2]  =   0x600a;     // 00C0D4: 640A         bcc c0e0  (wrong game state otherwise)
1949
 
    rom[0x0c0f0/2]  =   0x4e71;     // 00C0F0: 6408         bcc c0fa  (wrong palette otherwise)
1950
 
    rom[0x0e292/2]  =   0x6008;     // 00E292: 6408         bcc e29c  (fills screen with characters otherwise)
1951
 
    rom[0x11b42/2]  =   0x6008;     // 011B42: 6408         bcc 11b4c (wrong game state otherwise)
1952
 
    rom[0x11b5c/2]  =   0x4e71;     // 011B5C: 6408         bcc 11b66 (wrong palette otherwise)
1953
 
    rom[0x170ae/2]  =   0x4e71;     // 0170AE: 6408         bcc 170b8 (fills screen with characters otherwise)
1954
 
    rom[0x1842a/2]  =   0x6024;     // 01842A: 6724         beq 18450 (ASIC11 ERROR otherwise)
1955
 
    rom[0x18538/2]  =   0x6008;     // 018538: 6408         bcc 18542 (wrong game state otherwise)
1956
 
    rom[0x18552/2]  =   0x4e71;     // 018552: 6408         bcc 1855c (wrong palette otherwise)
1957
 
    rom[0x18c0e/2]  =   0x6006;     // 018C0E: 6406         bcc 18c16 (fills screen with characters otherwise)
1958
 
    rom[0x1923e/2]  =   0x4e71;     // 01923E: 6408         bcc 19248 (fills screen with characters otherwise)
1959
 
*/
1960
 
        // Fix for the palette fade on title screen
1961
 
//  rom[0x19E90/2]  =   0x00ff;
1962
 
}
1963
 
 
1964
 
static DRIVER_INIT( ryukobou )
1965
 
{
1966
 
//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1967
 
 
1968
 
        ryukobou_decrypt(machine);
1969
 
 
1970
 
        machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x10600, 0x107ff, FUNC(ryukobou_igs011_prot2_r));
1971
 
 
1972
 
        // PROTECTION CHECKS
1973
 
//  rom[0x2df68/2]  =   0x4e75;     // 02DF68: 4E56 FE00    link A6, #-$200  (fills palette with pink otherwise)
1974
 
}
1975
 
 
1976
 
 
1977
 
static DRIVER_INIT( xymg )
1978
 
{
1979
 
//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
1980
 
 
1981
 
        lhb_decrypt(machine);
1982
 
/*
1983
 
    // PROTECTION CHECKS
1984
 
    rom[0x00502/2]  =   0x6006;     // 000502: 6050         bra 554
1985
 
    rom[0x0fc1c/2]  =   0x6036;     // 00FC1C: 6736         beq fc54  (fills palette with red otherwise)
1986
 
    rom[0x1232a/2]  =   0x6036;     // 01232A: 6736         beq 12362 (fills palette with red otherwise)
1987
 
    rom[0x18244/2]  =   0x6036;     // 018244: 6736         beq 1827c (fills palette with red otherwise)
1988
 
    rom[0x1e15e/2]  =   0x6036;     // 01E15E: 6736         beq 1e196 (fills palette with red otherwise)
1989
 
    rom[0x22286/2]  =   0x6000;     // 022286: 6700 02D2    beq 2255a (fills palette with green otherwise)
1990
 
    rom[0x298ce/2]  =   0x6036;     // 0298CE: 6736         beq 29906 (fills palette with red otherwise)
1991
 
    rom[0x2e07c/2]  =   0x6036;     // 02E07C: 6736         beq 2e0b4 (fills palette with red otherwise)
1992
 
    rom[0x38f1c/2]  =   0x6000;     // 038F1C: 6700 071C    beq 3963a (ASIC11 ERROR 1)
1993
 
    rom[0x390e8/2]  =   0x6000;     // 0390E8: 6700 0550    beq 3963a (ASIC11 ERROR 2)
1994
 
    rom[0x3933a/2]  =   0x6000;     // 03933A: 6700 02FE    beq 3963a (ASIC11 ERROR 3)
1995
 
    rom[0x3955c/2]  =   0x6000;     // 03955C: 6700 00DC    beq 3963a (ASIC11 ERROR 4)
1996
 
    rom[0x397f4/2]  =   0x6000;     // 0397F4: 6700 02C0    beq 39ab6 (fills palette with green otherwise)
1997
 
    rom[0x39976/2]  =   0x6000;     // 039976: 6700 013E    beq 39ab6 (fills palette with green otherwise)
1998
 
    rom[0x39a7e/2]  =   0x6036;     // 039A7E: 6736         beq 39ab6 (fills palette with green otherwise)
1999
 
    rom[0x4342c/2]  =   0x4e75;     // 04342C: 4E56 0000    link A6, #$0
2000
 
    rom[0x49966/2]  =   0x6036;     // 049966: 6736         beq 4999e (fills palette with blue otherwise)
2001
 
    rom[0x58140/2]  =   0x6036;     // 058140: 6736         beq 58178 (fills palette with red otherwise)
2002
 
    rom[0x5e05a/2]  =   0x6036;     // 05E05A: 6736         beq 5e092 (fills palette with red otherwise)
2003
 
    rom[0x5ebf0/2]  =   0x6000;     // 05EBF0: 6700 0208    beq 5edfa (fills palette with red otherwise)
2004
 
    rom[0x5edc2/2]  =   0x6036;     // 05EDC2: 6736         beq 5edfa (fills palette with green otherwise)
2005
 
    rom[0x5f71c/2]  =   0x6000;     // 05F71C: 6700 01F2    beq 5f910 (fills palette with green otherwise)
2006
 
    rom[0x5f8d8/2]  =   0x6036;     // 05F8D8: 6736         beq 5f910 (fills palette with red otherwise)
2007
 
    rom[0x64836/2]  =   0x6036;     // 064836: 6736         beq 6486e (fills palette with red otherwise)
2008
 
*/
2009
 
}
2010
 
 
2011
 
static DRIVER_INIT( wlcc )
2012
 
{
2013
 
//  UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
2014
 
 
2015
 
        wlcc_decrypt(machine);
2016
 
/*
2017
 
    // PROTECTION CHECKS
2018
 
    rom[0x16b96/2]  =   0x6000;     // 016B96: 6700 02FE    beq 16e96  (fills palette with red otherwise)
2019
 
    rom[0x16e5e/2]  =   0x6036;     // 016E5E: 6736         beq 16e96  (fills palette with green otherwise)
2020
 
    rom[0x17852/2]  =   0x6000;     // 017852: 6700 01F2    beq 17a46  (fills palette with green otherwise)
2021
 
    rom[0x17a0e/2]  =   0x6036;     // 017A0E: 6736         beq 17a46  (fills palette with red otherwise)
2022
 
    rom[0x23636/2]  =   0x6036;     // 023636: 6736         beq 2366e  (fills palette with red otherwise)
2023
 
    rom[0x2b1e6/2]  =   0x6000;     // 02B1E6: 6700 0218    beq 2b400  (fills palette with green otherwise)
2024
 
    rom[0x2f9f2/2]  =   0x6000;     // 02F9F2: 6700 04CA    beq 2febe  (fills palette with green otherwise)
2025
 
    rom[0x2fb2e/2]  =   0x6000;     // 02FB2E: 6700 038E    beq 2febe  (fills palette with red otherwise)
2026
 
    rom[0x2fcf2/2]  =   0x6000;     // 02FCF2: 6700 01CA    beq 2febe  (fills palette with red otherwise)
2027
 
    rom[0x2fe86/2]  =   0x6036;     // 02FE86: 6736         beq 2febe  (fills palette with red otherwise)
2028
 
    rom[0x3016e/2]  =   0x6000;     // 03016E: 6700 03F6    beq 30566  (fills palette with green otherwise)
2029
 
    rom[0x303c8/2]  =   0x6000;     // 0303C8: 6700 019C    beq 30566  (fills palette with green otherwise)
2030
 
    rom[0x3052e/2]  =   0x6036;     // 03052E: 6736         beq 30566  (fills palette with green otherwise)
2031
 
*/
2032
 
}
2033
 
 
2034
 
 
2035
 
static DRIVER_INIT( lhb2 )
2036
 
{
2037
 
        UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
2038
 
 
2039
 
        lhb2_decrypt(machine);
2040
 
        lhb2_decrypt_gfx(machine);
2041
 
 
2042
 
        // PROTECTION CHECKS
2043
 
        rom[0x034f4/2]  =       0x4e71;         // 0034F4: 660E    bne 3504   (rom test, fills palette with white otherwise)
2044
 
        rom[0x03502/2]  =       0x6032;         // 003502: 6732    beq 3536   (rom test, fills palette with white otherwise)
2045
 
        rom[0x1afea/2]  =       0x6034;         // 01AFEA: 6734    beq 1b020  (fills palette with black otherwise)
2046
 
//  rom[0x24b8a/2]  =   0x6036;     // 024B8A: 6736    beq 24bc2  (fills palette with green otherwise)
2047
 
//  rom[0x29ef8/2]  =   0x6036;     // 029EF8: 6736    beq 29f30  (fills palette with red otherwise)
2048
 
//  rom[0x2e69c/2]  =   0x6036;     // 02E69C: 6736    beq 2e6d4  (fills palette with green otherwise)
2049
 
//  rom[0x2fe96/2]  =   0x6036;     // 02FE96: 6736    beq 2fece  (fills palette with red otherwise)
2050
 
//  rom[0x325da/2]  =   0x6036;     // 0325DA: 6736    beq 32612  (fills palette with green otherwise)
2051
 
        rom[0x3d80a/2]  =       0x6034;         // 03D80A: 6734    beq 3d840  (fills palette with black otherwise)
2052
 
//  rom[0x3ed80/2]  =   0x6036;     // 03ED80: 6736    beq 3edb8  (fills palette with red otherwise)
2053
 
        rom[0x41d72/2]  =       0x6034;         // 041D72: 6734    beq 41da8  (fills palette with black otherwise)
2054
 
        rom[0x44834/2]  =       0x6034;         // 044834: 6734    beq 4486a  (fills palette with black otherwise)
2055
 
}
2056
 
 
2057
 
static DRIVER_INIT( vbowl )
2058
 
{
2059
 
        UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
2060
 
        UINT8  *gfx = (UINT8 *)  machine.region("blitter")->base();
2061
 
        int i;
2062
 
 
2063
 
        vbowlj_decrypt(machine);
2064
 
 
2065
 
        for (i = 0x400000-1; i >= 0; i--)
2066
 
        {
2067
 
                gfx[i * 2 + 1] = (gfx[i] & 0xf0) >> 4;
2068
 
                gfx[i * 2 + 0] = (gfx[i] & 0x0f) >> 0;
2069
 
        }
2070
 
 
2071
 
        // Patch the bad dump so that it doesn't reboot at the end of a game (the patched value is from vbowlj)
2072
 
        rom[0x080e0/2] = 0xe549;        // 0080E0: 0449 dc.w $0449; ILLEGAL
2073
 
 
2074
 
        // PROTECTION CHECKS
2075
 
//  rom[0x03764/2] = 0x4e75;    // 003764: 4E56 0000 link    A6, #$0
2076
 
        rom[0x173ee/2] = 0x600c;        // 0173EE: 670C      beq     $173fc
2077
 
        rom[0x1e6e6/2] = 0x600c;        // 01E6E6: 670C      beq     $1e6f4
2078
 
        rom[0x1f7ce/2] = 0x600c;        // 01F7CE: 670C      beq     $1f7dc
2079
 
}
2080
 
 
2081
 
 
2082
 
static DRIVER_INIT( vbowlj )
2083
 
{
2084
 
        UINT16 *rom = (UINT16 *) machine.region("maincpu")->base();
2085
 
        UINT8  *gfx = (UINT8 *)  machine.region("blitter")->base();
2086
 
        int i;
2087
 
 
2088
 
        vbowlj_decrypt(machine);
2089
 
 
2090
 
        for (i = 0x400000-1; i >= 0; i--)
2091
 
        {
2092
 
                gfx[i * 2 + 1] = (gfx[i] & 0xf0) >> 4;
2093
 
                gfx[i * 2 + 0] = (gfx[i] & 0x0f) >> 0;
2094
 
        }
2095
 
 
2096
 
        // PROTECTION CHECKS
2097
 
//  rom[0x37b4/2] = 0x4e75;     // 0037B4: 4E56 0000 link    A6, #$0
2098
 
        rom[0x17720/2] = 0x600c;        // 017720: 670C      beq     1772e
2099
 
        rom[0x1e6e6/2] = 0x600c;        // 01E6E6: 670C      beq     $1e6f4
2100
 
        rom[0x1f7c8/2] = 0x600c;        // 01F7C8: 670C      beq     1f7d6
2101
 
}
2102
 
 
2103
 
 
2104
 
static DRIVER_INIT( nkishusp )
2105
 
{
2106
 
        nkishusp_decrypt(machine);
2107
 
 
2108
 
        // PROTECTION CHECKS (similar to lhb2?)
2109
 
}
2110
 
 
2111
 
 
2112
 
/***************************************************************************
2113
 
 
2114
 
    Memory Maps
2115
 
 
2116
 
***************************************************************************/
2117
 
 
2118
 
static ADDRESS_MAP_START( drgnwrld, AS_PROGRAM, 16 )
2119
 
//  drgnwrld: IGS011 protection dynamically mapped at 1dd7x
2120
 
//  AM_RANGE( 0x01dd70, 0x01dd77 ) AM_WRITE( igs011_prot1_w )
2121
 
//  AM_RANGE( 0x01dd78, 0x01dd79 ) AM_READ ( igs011_prot1_r )
2122
 
 
2123
 
        AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
2124
 
        AM_RANGE( 0x100000, 0x103fff ) AM_RAM AM_SHARE("nvram")
2125
 
        AM_RANGE( 0x200000, 0x200fff ) AM_RAM AM_BASE_MEMBER(igs011_state, m_priority_ram )
2126
 
        AM_RANGE( 0x400000, 0x401fff ) AM_RAM_WRITE( igs011_palette ) AM_BASE_GENERIC( paletteram )
2127
 
        AM_RANGE( 0x500000, 0x500001 ) AM_READ_PORT( "COIN" )
2128
 
        AM_RANGE( 0x600000, 0x600001 ) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff )
2129
 
        AM_RANGE( 0x700000, 0x700003 ) AM_DEVWRITE8( "ymsnd", ym3812_w, 0x00ff )
2130
 
 
2131
 
        AM_RANGE( 0x800000, 0x800003 ) AM_WRITE( drgnwrld_igs003_w )
2132
 
        AM_RANGE( 0x800002, 0x800003 ) AM_READ ( drgnwrld_igs003_r )
2133
 
 
2134
 
        AM_RANGE( 0xa20000, 0xa20001 ) AM_WRITE( igs011_priority_w )
2135
 
        AM_RANGE( 0xa40000, 0xa40001 ) AM_WRITE( igs_dips_w )
2136
 
 
2137
 
        AM_RANGE( 0xa50000, 0xa50001 ) AM_WRITE( igs011_prot_addr_w )
2138
 
//  AM_RANGE( 0xa50000, 0xa50005 ) AM_READ( igs011_prot_fake_r )
2139
 
 
2140
 
        AM_RANGE( 0xa58000, 0xa58001 ) AM_WRITE( igs011_blit_x_w )
2141
 
        AM_RANGE( 0xa58800, 0xa58801 ) AM_WRITE( igs011_blit_y_w )
2142
 
        AM_RANGE( 0xa59000, 0xa59001 ) AM_WRITE( igs011_blit_w_w )
2143
 
        AM_RANGE( 0xa59800, 0xa59801 ) AM_WRITE( igs011_blit_h_w )
2144
 
        AM_RANGE( 0xa5a000, 0xa5a001 ) AM_WRITE( igs011_blit_gfx_lo_w )
2145
 
        AM_RANGE( 0xa5a800, 0xa5a801 ) AM_WRITE( igs011_blit_gfx_hi_w )
2146
 
        AM_RANGE( 0xa5b000, 0xa5b001 ) AM_WRITE( igs011_blit_flags_w )
2147
 
        AM_RANGE( 0xa5b800, 0xa5b801 ) AM_WRITE( igs011_blit_pen_w )
2148
 
        AM_RANGE( 0xa5c000, 0xa5c001 ) AM_WRITE( igs011_blit_depth_w )
2149
 
        AM_RANGE( 0xa88000, 0xa88001 ) AM_READ( igs_3_dips_r )
2150
 
ADDRESS_MAP_END
2151
 
 
2152
 
static ADDRESS_MAP_START( drgnwrld_igs012, AS_PROGRAM, 16 )
2153
 
        // IGS012
2154
 
        AM_RANGE( 0x001600, 0x00160f ) AM_WRITE( igs012_prot_swap_w             )       AM_MIRROR(0x01c000)     // swap (a5 / 55)
2155
 
        AM_RANGE( 0x001610, 0x00161f ) AM_READ ( igs012_prot_r                  )       AM_MIRROR(0x01c000)     // read (mode 0)
2156
 
        AM_RANGE( 0x001620, 0x00162f ) AM_WRITE( igs012_prot_dec_inc_w  )       AM_MIRROR(0x01c000)     // dec  (aa), inc  (fa)
2157
 
        AM_RANGE( 0x001630, 0x00163f ) AM_WRITE( igs012_prot_inc_w              )       AM_MIRROR(0x01c000)     // inc  (ff)
2158
 
        AM_RANGE( 0x001640, 0x00164f ) AM_WRITE( igs012_prot_copy_w             )       AM_MIRROR(0x01c000)     // copy (22)
2159
 
        AM_RANGE( 0x001650, 0x00165f ) AM_WRITE( igs012_prot_dec_copy_w )       AM_MIRROR(0x01c000)     // dec  (5a), copy (33)
2160
 
        AM_RANGE( 0x001660, 0x00166f ) AM_READ ( igs012_prot_r                  )       AM_MIRROR(0x01c000)     // read (mode 1)
2161
 
        AM_RANGE( 0x001670, 0x00167f ) AM_WRITE( igs012_prot_mode_w             )       AM_MIRROR(0x01c000)     // mode (cc / dd)
2162
 
 
2163
 
        AM_RANGE( 0x00d400, 0x00d43f ) AM_WRITE( igs011_prot2_dec_w                             )       // dec   (33)
2164
 
        AM_RANGE( 0x00d440, 0x00d47f ) AM_WRITE( drgnwrld_igs011_prot2_swap_w   )       // swap  (33)
2165
 
        AM_RANGE( 0x00d480, 0x00d4bf ) AM_WRITE( igs011_prot2_reset_w                   )       // reset (33)
2166
 
        AM_RANGE( 0x00d4c0, 0x00d4ff ) AM_READ ( drgnwrldv20j_igs011_prot2_r    )       // read
2167
 
 
2168
 
        AM_RANGE( 0x902000, 0x902fff ) AM_WRITE( igs012_prot_reset_w    )       // reset?
2169
 
//  AM_RANGE( 0x902000, 0x902005 ) AM_WRITE( igs012_prot_fake_r )
2170
 
 
2171
 
        AM_IMPORT_FROM(drgnwrld)
2172
 
ADDRESS_MAP_END
2173
 
 
2174
 
 
2175
 
 
2176
 
// Only values 0 and 7 are written (1 bit per irq source?)
2177
 
static WRITE16_HANDLER( lhb_irq_enable_w )
2178
 
{
2179
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
2180
 
        COMBINE_DATA( &state->m_lhb_irq_enable );
2181
 
}
2182
 
 
2183
 
static WRITE16_DEVICE_HANDLER( lhb_okibank_w )
2184
 
{
2185
 
        if (ACCESSING_BITS_8_15)
2186
 
        {
2187
 
                okim6295_device *oki = downcast<okim6295_device *>(device);
2188
 
                oki->set_bank_base((data & 0x200) ? 0x40000 : 0);
2189
 
        }
2190
 
 
2191
 
        if ( data & (~0x200) )
2192
 
                logerror("%s: warning, unknown bits written in oki bank = %02x\n", device->machine().describe_context(), data);
2193
 
 
2194
 
//  popmessage("oki %04x",data);
2195
 
}
2196
 
 
2197
 
static ADDRESS_MAP_START( lhb, AS_PROGRAM, 16 )
2198
 
//  lhb: IGS011 protection dynamically mapped at 834x
2199
 
//  AM_RANGE( 0x008340, 0x008347 ) AM_WRITE( igs011_prot1_w )
2200
 
//  AM_RANGE( 0x008348, 0x008349 ) AM_READ ( igs011_prot1_r )
2201
 
 
2202
 
        AM_RANGE( 0x010000, 0x010001 ) AM_DEVWRITE( "oki", lhb_okibank_w )
2203
 
 
2204
 
        AM_RANGE( 0x010200, 0x0103ff ) AM_WRITE( igs011_prot2_inc_w                     )
2205
 
        AM_RANGE( 0x010400, 0x0105ff ) AM_WRITE( lhb_igs011_prot2_swap_w        )
2206
 
        AM_RANGE( 0x010600, 0x0107ff ) AM_READ ( lhb_igs011_prot2_r                     )
2207
 
        // no reset
2208
 
 
2209
 
        AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
2210
 
        AM_RANGE( 0x100000, 0x103fff ) AM_RAM AM_SHARE("nvram")
2211
 
        AM_RANGE( 0x200000, 0x200fff ) AM_RAM AM_BASE_MEMBER(igs011_state, m_priority_ram )
2212
 
        AM_RANGE( 0x300000, 0x3fffff ) AM_READWRITE( igs011_layers_r, igs011_layers_w )
2213
 
        AM_RANGE( 0x400000, 0x401fff ) AM_RAM_WRITE( igs011_palette ) AM_BASE_GENERIC( paletteram )
2214
 
        AM_RANGE( 0x600000, 0x600001 ) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff )
2215
 
        AM_RANGE( 0x700000, 0x700001 ) AM_READ_PORT( "COIN" )
2216
 
        AM_RANGE( 0x700002, 0x700005 ) AM_READ ( lhb_inputs_r )
2217
 
        AM_RANGE( 0x700002, 0x700003 ) AM_WRITE( lhb_inputs_w )
2218
 
        AM_RANGE( 0x820000, 0x820001 ) AM_WRITE( igs011_priority_w )
2219
 
        AM_RANGE( 0x838000, 0x838001 ) AM_WRITE( lhb_irq_enable_w )
2220
 
        AM_RANGE( 0x840000, 0x840001 ) AM_WRITE( igs_dips_w )
2221
 
 
2222
 
        AM_RANGE( 0x850000, 0x850001 ) AM_WRITE( igs011_prot_addr_w )
2223
 
//  AM_RANGE( 0x850000, 0x850005 ) AM_WRITE( igs011_prot_fake_r )
2224
 
 
2225
 
        AM_RANGE( 0x858000, 0x858001 ) AM_WRITE( igs011_blit_x_w )
2226
 
        AM_RANGE( 0x858800, 0x858801 ) AM_WRITE( igs011_blit_y_w )
2227
 
        AM_RANGE( 0x859000, 0x859001 ) AM_WRITE( igs011_blit_w_w )
2228
 
        AM_RANGE( 0x859800, 0x859801 ) AM_WRITE( igs011_blit_h_w )
2229
 
        AM_RANGE( 0x85a000, 0x85a001 ) AM_WRITE( igs011_blit_gfx_lo_w )
2230
 
        AM_RANGE( 0x85a800, 0x85a801 ) AM_WRITE( igs011_blit_gfx_hi_w )
2231
 
        AM_RANGE( 0x85b000, 0x85b001 ) AM_WRITE( igs011_blit_flags_w )
2232
 
        AM_RANGE( 0x85b800, 0x85b801 ) AM_WRITE( igs011_blit_pen_w )
2233
 
        AM_RANGE( 0x85c000, 0x85c001 ) AM_WRITE( igs011_blit_depth_w )
2234
 
        AM_RANGE( 0x888000, 0x888001 ) AM_READ( igs_5_dips_r )
2235
 
ADDRESS_MAP_END
2236
 
 
2237
 
static ADDRESS_MAP_START( xymg, AS_PROGRAM, 16 )
2238
 
//  xymg: IGS011 protection dynamically mapped at 834x
2239
 
//  AM_RANGE( 0x008340, 0x008347 ) AM_WRITE( igs011_prot1_w )
2240
 
//  AM_RANGE( 0x008348, 0x008349 ) AM_READ ( igs011_prot1_r )
2241
 
 
2242
 
        AM_RANGE( 0x010000, 0x010001 ) AM_DEVWRITE( "oki", lhb_okibank_w )
2243
 
 
2244
 
        AM_RANGE( 0x010200, 0x0103ff ) AM_WRITE( igs011_prot2_inc_w                     )       // inc  (33)
2245
 
        AM_RANGE( 0x010400, 0x0105ff ) AM_WRITE( lhb_igs011_prot2_swap_w        )       // swap (33)
2246
 
        AM_RANGE( 0x010600, 0x0107ff ) AM_READ ( lhb_igs011_prot2_r                     )       // read
2247
 
        // no reset
2248
 
 
2249
 
        AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
2250
 
        AM_RANGE( 0x100000, 0x103fff ) AM_RAM
2251
 
        AM_RANGE( 0x1f0000, 0x1f3fff ) AM_RAM AM_SHARE("nvram") // extra ram
2252
 
        AM_RANGE( 0x200000, 0x200fff ) AM_RAM AM_BASE_MEMBER(igs011_state, m_priority_ram )
2253
 
        AM_RANGE( 0x300000, 0x3fffff ) AM_READWRITE( igs011_layers_r, igs011_layers_w )
2254
 
        AM_RANGE( 0x400000, 0x401fff ) AM_RAM_WRITE( igs011_palette ) AM_BASE_GENERIC( paletteram )
2255
 
        AM_RANGE( 0x600000, 0x600001 ) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff )
2256
 
        AM_RANGE( 0x700000, 0x700003 ) AM_WRITE( xymg_igs003_w )
2257
 
        AM_RANGE( 0x700002, 0x700003 ) AM_READ ( xymg_igs003_r )
2258
 
        AM_RANGE( 0x820000, 0x820001 ) AM_WRITE( igs011_priority_w )
2259
 
        AM_RANGE( 0x840000, 0x840001 ) AM_WRITE( igs_dips_w )
2260
 
 
2261
 
        AM_RANGE( 0x850000, 0x850001 ) AM_WRITE( igs011_prot_addr_w )
2262
 
//  AM_RANGE( 0x850000, 0x850005 ) AM_WRITE( igs011_prot_fake_r )
2263
 
 
2264
 
        AM_RANGE( 0x858000, 0x858001 ) AM_WRITE( igs011_blit_x_w )
2265
 
        AM_RANGE( 0x858800, 0x858801 ) AM_WRITE( igs011_blit_y_w )
2266
 
        AM_RANGE( 0x859000, 0x859001 ) AM_WRITE( igs011_blit_w_w )
2267
 
        AM_RANGE( 0x859800, 0x859801 ) AM_WRITE( igs011_blit_h_w )
2268
 
        AM_RANGE( 0x85a000, 0x85a001 ) AM_WRITE( igs011_blit_gfx_lo_w )
2269
 
        AM_RANGE( 0x85a800, 0x85a801 ) AM_WRITE( igs011_blit_gfx_hi_w )
2270
 
        AM_RANGE( 0x85b000, 0x85b001 ) AM_WRITE( igs011_blit_flags_w )
2271
 
        AM_RANGE( 0x85b800, 0x85b801 ) AM_WRITE( igs011_blit_pen_w )
2272
 
        AM_RANGE( 0x85c000, 0x85c001 ) AM_WRITE( igs011_blit_depth_w )
2273
 
        AM_RANGE( 0x888000, 0x888001 ) AM_READ( igs_3_dips_r )
2274
 
ADDRESS_MAP_END
2275
 
 
2276
 
static ADDRESS_MAP_START( wlcc, AS_PROGRAM, 16 )
2277
 
//  wlcc: IGS011 protection dynamically mapped at 834x
2278
 
//  AM_RANGE( 0x008340, 0x008347 ) AM_WRITE( igs011_prot1_w )
2279
 
//  AM_RANGE( 0x008348, 0x008349 ) AM_READ ( igs011_prot1_r )
2280
 
 
2281
 
        AM_RANGE( 0x518000, 0x5181ff ) AM_WRITE( igs011_prot2_inc_w                     )       // inc   (33)
2282
 
        AM_RANGE( 0x518200, 0x5183ff ) AM_WRITE( wlcc_igs011_prot2_swap_w       )       // swap  (33)
2283
 
        AM_RANGE( 0x518800, 0x5189ff ) AM_READ ( igs011_prot2_reset_r           )       // reset
2284
 
        AM_RANGE( 0x519000, 0x5195ff ) AM_READ ( lhb_igs011_prot2_r                     )       // read
2285
 
 
2286
 
        AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
2287
 
        AM_RANGE( 0x100000, 0x103fff ) AM_RAM AM_SHARE("nvram")
2288
 
        AM_RANGE( 0x200000, 0x200fff ) AM_RAM AM_BASE_MEMBER(igs011_state, m_priority_ram )
2289
 
        AM_RANGE( 0x300000, 0x3fffff ) AM_READWRITE( igs011_layers_r, igs011_layers_w )
2290
 
        AM_RANGE( 0x400000, 0x401fff ) AM_RAM_WRITE( igs011_palette ) AM_BASE_GENERIC( paletteram )
2291
 
        AM_RANGE( 0x520000, 0x520001 ) AM_READ_PORT( "COIN" )
2292
 
        AM_RANGE( 0x600000, 0x600001 ) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff )
2293
 
        AM_RANGE( 0x800000, 0x800003 ) AM_WRITE( wlcc_igs003_w )
2294
 
        AM_RANGE( 0x800002, 0x800003 ) AM_READ ( wlcc_igs003_r )
2295
 
        AM_RANGE( 0xa20000, 0xa20001 ) AM_WRITE( igs011_priority_w )
2296
 
        AM_RANGE( 0xa40000, 0xa40001 ) AM_WRITE( igs_dips_w )
2297
 
 
2298
 
        AM_RANGE( 0xa50000, 0xa50001 ) AM_WRITE( igs011_prot_addr_w )
2299
 
//  AM_RANGE( 0xa50000, 0xa50005 ) AM_READ( igs011_prot_fake_r )
2300
 
 
2301
 
        AM_RANGE( 0xa58000, 0xa58001 ) AM_WRITE( igs011_blit_x_w )
2302
 
        AM_RANGE( 0xa58800, 0xa58801 ) AM_WRITE( igs011_blit_y_w )
2303
 
        AM_RANGE( 0xa59000, 0xa59001 ) AM_WRITE( igs011_blit_w_w )
2304
 
        AM_RANGE( 0xa59800, 0xa59801 ) AM_WRITE( igs011_blit_h_w )
2305
 
        AM_RANGE( 0xa5a000, 0xa5a001 ) AM_WRITE( igs011_blit_gfx_lo_w )
2306
 
        AM_RANGE( 0xa5a800, 0xa5a801 ) AM_WRITE( igs011_blit_gfx_hi_w )
2307
 
        AM_RANGE( 0xa5b000, 0xa5b001 ) AM_WRITE( igs011_blit_flags_w )
2308
 
        AM_RANGE( 0xa5b800, 0xa5b801 ) AM_WRITE( igs011_blit_pen_w )
2309
 
        AM_RANGE( 0xa5c000, 0xa5c001 ) AM_WRITE( igs011_blit_depth_w )
2310
 
        AM_RANGE( 0xa88000, 0xa88001 ) AM_READ( igs_4_dips_r )
2311
 
ADDRESS_MAP_END
2312
 
 
2313
 
 
2314
 
 
2315
 
static ADDRESS_MAP_START( lhb2, AS_PROGRAM, 16 )
2316
 
//  lhb2: IGS011 protection dynamically mapped at 1ff8x
2317
 
//  AM_RANGE( 0x01ff80, 0x01ff87 ) AM_WRITE( igs011_prot1_w )
2318
 
//  AM_RANGE( 0x01ff88, 0x01ff89 ) AM_READ ( igs011_prot1_r )
2319
 
 
2320
 
        AM_RANGE( 0x020000, 0x0201ff ) AM_WRITE( igs011_prot2_inc_w                     )       // inc   (55)
2321
 
        AM_RANGE( 0x020200, 0x0203ff ) AM_WRITE( lhb_igs011_prot2_swap_w        )       // swap  (33)
2322
 
        AM_RANGE( 0x020400, 0x0205ff ) AM_READ ( lhb2_igs011_prot2_r            )       // read
2323
 
        AM_RANGE( 0x020600, 0x0207ff ) AM_WRITE( igs011_prot2_reset_w           )       // reset (55)
2324
 
 
2325
 
        AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
2326
 
        AM_RANGE( 0x100000, 0x103fff ) AM_RAM AM_SHARE("nvram")
2327
 
        AM_RANGE( 0x200000, 0x200001 ) AM_DEVREADWRITE8_MODERN("oki", okim6295_device, read, write, 0x00ff )
2328
 
        AM_RANGE( 0x204000, 0x204003 ) AM_DEVWRITE8( "ymsnd", ym2413_w, 0x00ff )
2329
 
        AM_RANGE( 0x208000, 0x208003 ) AM_WRITE( lhb2_igs003_w )
2330
 
        AM_RANGE( 0x208002, 0x208003 ) AM_READ ( lhb2_igs003_r )
2331
 
        AM_RANGE( 0x20c000, 0x20cfff ) AM_RAM AM_BASE_MEMBER(igs011_state, m_priority_ram)
2332
 
        AM_RANGE( 0x210000, 0x211fff ) AM_RAM_WRITE( igs011_palette ) AM_BASE_GENERIC( paletteram )
2333
 
        AM_RANGE( 0x214000, 0x214001 ) AM_READ_PORT( "COIN" )
2334
 
        AM_RANGE( 0x300000, 0x3fffff ) AM_READWRITE( igs011_layers_r, igs011_layers_w )
2335
 
        AM_RANGE( 0xa20000, 0xa20001 ) AM_WRITE( igs011_priority_w )
2336
 
        AM_RANGE( 0xa40000, 0xa40001 ) AM_WRITE( igs_dips_w )
2337
 
 
2338
 
        AM_RANGE( 0xa50000, 0xa50001 ) AM_WRITE( igs011_prot_addr_w )
2339
 
//  AM_RANGE( 0xa50000, 0xa50005 ) AM_READ( igs011_prot_fake_r )
2340
 
 
2341
 
        AM_RANGE( 0xa58000, 0xa58001 ) AM_WRITE( igs011_blit_x_w )
2342
 
        AM_RANGE( 0xa58800, 0xa58801 ) AM_WRITE( igs011_blit_y_w )
2343
 
        AM_RANGE( 0xa59000, 0xa59001 ) AM_WRITE( igs011_blit_w_w )
2344
 
        AM_RANGE( 0xa59800, 0xa59801 ) AM_WRITE( igs011_blit_h_w )
2345
 
        AM_RANGE( 0xa5a000, 0xa5a001 ) AM_WRITE( igs011_blit_gfx_lo_w )
2346
 
        AM_RANGE( 0xa5a800, 0xa5a801 ) AM_WRITE( igs011_blit_gfx_hi_w )
2347
 
        AM_RANGE( 0xa5b000, 0xa5b001 ) AM_WRITE( igs011_blit_flags_w )
2348
 
        AM_RANGE( 0xa5b800, 0xa5b801 ) AM_WRITE( igs011_blit_pen_w )
2349
 
        AM_RANGE( 0xa5c000, 0xa5c001 ) AM_WRITE( igs011_blit_depth_w )
2350
 
        AM_RANGE( 0xa88000, 0xa88001 ) AM_READ( igs_3_dips_r )
2351
 
ADDRESS_MAP_END
2352
 
 
2353
 
/* trap15's note:
2354
 
 * TODO: change this horrible device-> chain to be proper.
2355
 
 */
2356
 
static READ16_DEVICE_HANDLER( ics2115_word_r )
2357
 
{
2358
 
        ics2115_device* ics2115 = device->machine().device<ics2115_device>("ics");
2359
 
        switch(offset)
2360
 
        {
2361
 
                case 0: return ics2115_device::read(ics2115, (offs_t)0);
2362
 
                case 1: return ics2115_device::read(ics2115, (offs_t)1);
2363
 
                case 2: return (ics2115_device::read(ics2115, (offs_t)3) << 8) | ics2115_device::read(ics2115, (offs_t)2);
2364
 
        }
2365
 
        return 0xff;
2366
 
}
2367
 
 
2368
 
static WRITE16_DEVICE_HANDLER( ics2115_word_w )
2369
 
{
2370
 
        ics2115_device* ics2115 = device->machine().device<ics2115_device>("ics");
2371
 
        switch(offset)
2372
 
        {
2373
 
                case 1:
2374
 
                        if (ACCESSING_BITS_0_7)         ics2115_device::write(ics2115,1,data);
2375
 
                        break;
2376
 
                case 2:
2377
 
                        if (ACCESSING_BITS_0_7)         ics2115_device::write(ics2115,2,data);
2378
 
                        if (ACCESSING_BITS_8_15)        ics2115_device::write(ics2115,3,data>>8);
2379
 
                        break;
2380
 
        }
2381
 
}
2382
 
 
2383
 
static READ16_HANDLER( vbowl_unk_r )
2384
 
{
2385
 
        return 0xffff;
2386
 
}
2387
 
 
2388
 
static SCREEN_EOF( vbowl )
2389
 
{
2390
 
        igs011_state *state = machine.driver_data<igs011_state>();
2391
 
        state->m_vbowl_trackball[0] = state->m_vbowl_trackball[1];
2392
 
        state->m_vbowl_trackball[1] = (input_port_read(machine, "AN1") << 8) | input_port_read(machine, "AN0");
2393
 
}
2394
 
 
2395
 
static WRITE16_HANDLER( vbowl_pen_hi_w )
2396
 
{
2397
 
        igs011_state *state = space->machine().driver_data<igs011_state>();
2398
 
        if (ACCESSING_BITS_0_7)
2399
 
        {
2400
 
                state->m_lhb2_pen_hi = data & 0x07;
2401
 
        }
2402
 
 
2403
 
        if (data & ~0x7)
2404
 
                logerror("%06x: warning, unknown bits written to pen_hi = %04x\n", cpu_get_pc(&space->device()), state->m_priority);
2405
 
}
2406
 
 
2407
 
static WRITE16_HANDLER( vbowl_link_0_w )        { }
2408
 
static WRITE16_HANDLER( vbowl_link_1_w )        { }
2409
 
static WRITE16_HANDLER( vbowl_link_2_w )        { }
2410
 
static WRITE16_HANDLER( vbowl_link_3_w )        { }
2411
 
 
2412
 
static ADDRESS_MAP_START( vbowl, AS_PROGRAM, 16 )
2413
 
//  vbowl: IGS011 protection dynamically mapped at 834x
2414
 
//  AM_RANGE( 0x008340, 0x008347 ) AM_WRITE( igs011_prot1_w )
2415
 
//  AM_RANGE( 0x008348, 0x008349 ) AM_READ ( igs011_prot1_r )
2416
 
 
2417
 
        // IGS012
2418
 
        AM_RANGE( 0x001600, 0x00160f ) AM_WRITE( igs012_prot_swap_w             )       AM_MIRROR(0x01c000)     // swap (a5 / 55)
2419
 
        AM_RANGE( 0x001610, 0x00161f ) AM_READ ( igs012_prot_r                  )       AM_MIRROR(0x01c000)     // read (mode 0)
2420
 
        AM_RANGE( 0x001620, 0x00162f ) AM_WRITE( igs012_prot_dec_inc_w  )       AM_MIRROR(0x01c000)     // dec  (aa), inc  (fa)
2421
 
        AM_RANGE( 0x001630, 0x00163f ) AM_WRITE( igs012_prot_inc_w              )       AM_MIRROR(0x01c000)     // inc  (ff)
2422
 
        AM_RANGE( 0x001640, 0x00164f ) AM_WRITE( igs012_prot_copy_w             )       AM_MIRROR(0x01c000)     // copy (22)
2423
 
        AM_RANGE( 0x001650, 0x00165f ) AM_WRITE( igs012_prot_dec_copy_w )       AM_MIRROR(0x01c000)     // dec  (5a), copy (33)
2424
 
        AM_RANGE( 0x001660, 0x00166f ) AM_READ ( igs012_prot_r                  )       AM_MIRROR(0x01c000)     // read (mode 1)
2425
 
        AM_RANGE( 0x001670, 0x00167f ) AM_WRITE( igs012_prot_mode_w             )       AM_MIRROR(0x01c000)     // mode (cc / dd)
2426
 
 
2427
 
        AM_RANGE( 0x00d400, 0x00d43f ) AM_WRITE( igs011_prot2_dec_w                             )       // dec   (33)
2428
 
        AM_RANGE( 0x00d440, 0x00d47f ) AM_WRITE( drgnwrld_igs011_prot2_swap_w   )       // swap  (33)
2429
 
        AM_RANGE( 0x00d480, 0x00d4bf ) AM_WRITE( igs011_prot2_reset_w                   )       // reset (33)
2430
 
        AM_RANGE( 0x00d4c0, 0x00d4ff ) AM_READ ( drgnwrldv20j_igs011_prot2_r    )       // read
2431
 
 
2432
 
        AM_RANGE( 0x50f000, 0x50f1ff ) AM_WRITE( igs011_prot2_dec_w                     )       // dec   (33)
2433
 
        AM_RANGE( 0x50f200, 0x50f3ff ) AM_WRITE( vbowl_igs011_prot2_swap_w      )       // swap  (33)
2434
 
        AM_RANGE( 0x50f400, 0x50f5ff ) AM_WRITE( igs011_prot2_reset_w           )       // reset (33)
2435
 
        AM_RANGE( 0x50f600, 0x50f7ff ) AM_READ ( vbowl_igs011_prot2_r           )       // read
2436
 
 
2437
 
        AM_RANGE( 0x902000, 0x902fff ) AM_WRITE( igs012_prot_reset_w    )       // reset?
2438
 
//  AM_RANGE( 0x902000, 0x902005 ) AM_WRITE( igs012_prot_fake_r )
2439
 
 
2440
 
        AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
2441
 
        AM_RANGE( 0x100000, 0x103fff ) AM_RAM AM_SHARE("nvram")
2442
 
        AM_RANGE( 0x200000, 0x200fff ) AM_RAM AM_BASE_MEMBER(igs011_state, m_priority_ram )
2443
 
        AM_RANGE( 0x300000, 0x3fffff ) AM_READWRITE( igs011_layers_r, igs011_layers_w )
2444
 
        AM_RANGE( 0x400000, 0x401fff ) AM_RAM_WRITE( igs011_palette ) AM_BASE_GENERIC( paletteram )
2445
 
        AM_RANGE( 0x520000, 0x520001 ) AM_READ_PORT( "COIN" )
2446
 
        AM_RANGE( 0x600000, 0x600007 ) AM_DEVREADWRITE( "ics", ics2115_word_r, ics2115_word_w )
2447
 
        AM_RANGE( 0x700000, 0x700003 ) AM_RAM AM_BASE_MEMBER(igs011_state, m_vbowl_trackball )
2448
 
        AM_RANGE( 0x700004, 0x700005 ) AM_WRITE( vbowl_pen_hi_w )
2449
 
        AM_RANGE( 0x800000, 0x800003 ) AM_WRITE( vbowl_igs003_w )
2450
 
        AM_RANGE( 0x800002, 0x800003 ) AM_READ( vbowl_igs003_r )
2451
 
 
2452
 
        AM_RANGE( 0xa00000, 0xa00001 ) AM_WRITE( vbowl_link_0_w )
2453
 
        AM_RANGE( 0xa08000, 0xa08001 ) AM_WRITE( vbowl_link_1_w )
2454
 
        AM_RANGE( 0xa10000, 0xa10001 ) AM_WRITE( vbowl_link_2_w )
2455
 
        AM_RANGE( 0xa18000, 0xa18001 ) AM_WRITE( vbowl_link_3_w )
2456
 
 
2457
 
        AM_RANGE( 0xa20000, 0xa20001 ) AM_WRITE( igs011_priority_w )
2458
 
        AM_RANGE( 0xa40000, 0xa40001 ) AM_WRITE( igs_dips_w )
2459
 
 
2460
 
        AM_RANGE( 0xa48000, 0xa48001 ) AM_WRITE( igs011_prot_addr_w )
2461
 
//  AM_RANGE( 0xa48000, 0xa48005 ) AM_WRITE( igs011_prot_fake_r )
2462
 
 
2463
 
        AM_RANGE( 0xa58000, 0xa58001 ) AM_WRITE( igs011_blit_x_w )
2464
 
        AM_RANGE( 0xa58800, 0xa58801 ) AM_WRITE( igs011_blit_y_w )
2465
 
        AM_RANGE( 0xa59000, 0xa59001 ) AM_WRITE( igs011_blit_w_w )
2466
 
        AM_RANGE( 0xa59800, 0xa59801 ) AM_WRITE( igs011_blit_h_w )
2467
 
        AM_RANGE( 0xa5a000, 0xa5a001 ) AM_WRITE( igs011_blit_gfx_lo_w )
2468
 
        AM_RANGE( 0xa5a800, 0xa5a801 ) AM_WRITE( igs011_blit_gfx_hi_w )
2469
 
        AM_RANGE( 0xa5b000, 0xa5b001 ) AM_WRITE( igs011_blit_flags_w )
2470
 
        AM_RANGE( 0xa5b800, 0xa5b801 ) AM_WRITE( igs011_blit_pen_w )
2471
 
        AM_RANGE( 0xa5c000, 0xa5c001 ) AM_WRITE( igs011_blit_depth_w )
2472
 
 
2473
 
        AM_RANGE( 0xa80000, 0xa80001 ) AM_READ( vbowl_unk_r )
2474
 
        AM_RANGE( 0xa88000, 0xa88001 ) AM_READ( igs_4_dips_r )
2475
 
        AM_RANGE( 0xa90000, 0xa90001 ) AM_READ( vbowl_unk_r )
2476
 
        AM_RANGE( 0xa98000, 0xa98001 ) AM_READ( vbowl_unk_r )
2477
 
ADDRESS_MAP_END
2478
 
 
2479
 
 
2480
 
 
2481
 
/***************************************************************************
2482
 
 
2483
 
    Input Ports
2484
 
 
2485
 
***************************************************************************/
2486
 
 
2487
 
static INPUT_PORTS_START( drgnwrld )
2488
 
        PORT_START("DSW1")
2489
 
        PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
2490
 
        PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
2491
 
        PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
2492
 
        PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
2493
 
        PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
2494
 
        PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
2495
 
        PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
2496
 
        PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
2497
 
        PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
2498
 
        PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) )
2499
 
        PORT_DIPSETTING(    0x18, DEF_STR( Normal  ) )  // 513
2500
 
        PORT_DIPSETTING(    0x10, DEF_STR( Hard    ) )  // 627
2501
 
        PORT_DIPSETTING(    0x08, DEF_STR( Harder  ) )  // 741
2502
 
        PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )  // 855
2503
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
2504
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
2505
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
2506
 
 
2507
 
        PORT_START("DSW2")
2508
 
        PORT_DIPNAME( 0x01, 0x01, "Nudity" )            // "Open Girl" in test mode
2509
 
        PORT_DIPSETTING(    0x00, DEF_STR( No ) )
2510
 
        PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
2511
 
        PORT_DIPNAME( 0x02, 0x02, "Background" )
2512
 
        PORT_DIPSETTING(    0x02, "Girl" )
2513
 
        PORT_DIPSETTING(    0x00, "Landscape" )         // broken backgrounds with Nudity on (PCB does the same)
2514
 
        PORT_DIPNAME( 0x04, 0x04, DEF_STR( Demo_Sounds ) )
2515
 
        PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2516
 
        PORT_DIPSETTING(    0x04, DEF_STR( On ) )
2517
 
        PORT_DIPNAME( 0x08, 0x08, "Bang Turtle?" )
2518
 
        PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
2519
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2520
 
        PORT_DIPNAME( 0x10, 0x10, "Send Boom?" )
2521
 
        PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
2522
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2523
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
2524
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
2525
 
        PORT_DIPNAME( 0x80, 0x80, "Test?" )
2526
 
        PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
2527
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2528
 
 
2529
 
        PORT_START("DSW3")
2530
 
        PORT_DIPUNKNOWN( 0x01, 0x01 )
2531
 
        PORT_DIPUNKNOWN( 0x02, 0x02 )
2532
 
        PORT_DIPUNKNOWN( 0x04, 0x04 )
2533
 
        PORT_DIPUNKNOWN( 0x08, 0x08 )
2534
 
        PORT_DIPUNKNOWN( 0x10, 0x10 )
2535
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
2536
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
2537
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
2538
 
 
2539
 
        PORT_START("COIN")
2540
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
2541
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
2542
 
        PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )   // keep pressed while booting
2543
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
2544
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE2 )   // used?
2545
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE3 )   // used?
2546
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2547
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2548
 
 
2549
 
        PORT_START("IN0")
2550
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
2551
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
2552
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
2553
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
2554
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
2555
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
2556
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )    // press in girl test to pause, button 3 advances
2557
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2558
 
 
2559
 
        PORT_START("IN1")
2560
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
2561
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
2562
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
2563
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
2564
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
2565
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
2566
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2567
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2568
 
 
2569
 
        PORT_START("IN2")
2570
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
2571
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
2572
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
2573
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 )
2574
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
2575
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
2576
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
2577
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
2578
 
INPUT_PORTS_END
2579
 
 
2580
 
 
2581
 
static INPUT_PORTS_START( drgnwrldc )
2582
 
        PORT_START("DSW1")
2583
 
        PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
2584
 
        PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
2585
 
        PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
2586
 
        PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
2587
 
        PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
2588
 
        PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
2589
 
        PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
2590
 
        PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
2591
 
        PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
2592
 
        PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) )
2593
 
        PORT_DIPSETTING(    0x18, DEF_STR( Normal  ) )  // 513
2594
 
        PORT_DIPSETTING(    0x10, DEF_STR( Hard    ) )  // 627
2595
 
        PORT_DIPSETTING(    0x08, DEF_STR( Harder  ) )  // 741
2596
 
        PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )  // 855
2597
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
2598
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
2599
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
2600
 
 
2601
 
        PORT_START("DSW2")
2602
 
        PORT_DIPNAME( 0x01, 0x01, "Nudity" )            // "Open Girl" in test mode
2603
 
        PORT_DIPSETTING(    0x00, DEF_STR( No ) )
2604
 
        PORT_DIPSETTING(    0x01, DEF_STR( Yes ) )
2605
 
        PORT_DIPNAME( 0x02, 0x02, "Sex Question" )      // "background" in test mode
2606
 
        PORT_DIPSETTING(    0x00, DEF_STR( No ) )
2607
 
        PORT_DIPSETTING(    0x02, DEF_STR( Yes ) )
2608
 
        PORT_DIPNAME( 0x04, 0x04, "Background" )        // "sex question" in test mode
2609
 
        PORT_DIPSETTING(    0x04, "Girl" )
2610
 
        PORT_DIPSETTING(    0x00, "Landscape" )         // broken backgrounds with Nudity on (PCB does the same)
2611
 
        PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
2612
 
        PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2613
 
        PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2614
 
        PORT_DIPNAME( 0x10, 0x10, "Tiles" )
2615
 
        PORT_DIPSETTING(    0x10, "Mahjong" )
2616
 
        PORT_DIPSETTING(    0x00, "Symbols" )
2617
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
2618
 
        PORT_DIPNAME( 0x40, 0x40, "Bang Turtle?" )
2619
 
        PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
2620
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2621
 
        PORT_DIPNAME( 0x80, 0x80, "Test?" )
2622
 
        PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
2623
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2624
 
 
2625
 
        PORT_START("DSW3")
2626
 
        PORT_DIPUNKNOWN( 0x01, 0x01 )
2627
 
        PORT_DIPUNKNOWN( 0x02, 0x02 )
2628
 
        PORT_DIPUNKNOWN( 0x04, 0x04 )
2629
 
        PORT_DIPUNKNOWN( 0x08, 0x08 )
2630
 
        PORT_DIPUNKNOWN( 0x10, 0x10 )
2631
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
2632
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
2633
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
2634
 
 
2635
 
        PORT_START("COIN")
2636
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
2637
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
2638
 
        PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )   // keep pressed while booting
2639
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
2640
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE2 )   // used?
2641
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE3 )   // used?
2642
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2643
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2644
 
 
2645
 
        PORT_START("IN0")
2646
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
2647
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
2648
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
2649
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
2650
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
2651
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
2652
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )    // press in girl test to pause, button 3 advances
2653
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2654
 
 
2655
 
        PORT_START("IN1")
2656
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
2657
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
2658
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
2659
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
2660
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
2661
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
2662
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2663
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2664
 
 
2665
 
        PORT_START("IN2")
2666
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
2667
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
2668
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
2669
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 )
2670
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
2671
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
2672
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
2673
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
2674
 
INPUT_PORTS_END
2675
 
 
2676
 
 
2677
 
static INPUT_PORTS_START( drgnwrldj )
2678
 
        PORT_START("DSW1")
2679
 
        PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
2680
 
        PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
2681
 
        PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
2682
 
        PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
2683
 
        PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
2684
 
        PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
2685
 
        PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
2686
 
        PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
2687
 
        PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
2688
 
        PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) )
2689
 
        PORT_DIPSETTING(    0x18, DEF_STR( Normal  ) )  // 513
2690
 
        PORT_DIPSETTING(    0x10, DEF_STR( Hard    ) )  // 627
2691
 
        PORT_DIPSETTING(    0x08, DEF_STR( Harder  ) )  // 741
2692
 
        PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )  // 855
2693
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
2694
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
2695
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
2696
 
 
2697
 
        PORT_START("DSW2")
2698
 
        PORT_DIPNAME( 0x01, 0x01, "Background" )
2699
 
        PORT_DIPSETTING(    0x01, "Girl" )
2700
 
        PORT_DIPSETTING(    0x00, "Landscape" )
2701
 
        PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )
2702
 
        PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2703
 
        PORT_DIPSETTING(    0x02, DEF_STR( On ) )
2704
 
        PORT_DIPNAME( 0x04, 0x04, "Tiles" )
2705
 
        PORT_DIPSETTING(    0x04, "Mahjong" )
2706
 
        PORT_DIPSETTING(    0x00, "Symbols" )
2707
 
        PORT_DIPNAME( 0x08, 0x08, "Send Boom?" )
2708
 
        PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
2709
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2710
 
        PORT_DIPUNKNOWN( 0x10, 0x10 )
2711
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
2712
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
2713
 
        PORT_DIPNAME( 0x80, 0x80, "Test?" )
2714
 
        PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
2715
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2716
 
 
2717
 
        PORT_START("DSW3")
2718
 
        PORT_DIPUNKNOWN( 0x01, 0x01 )
2719
 
        PORT_DIPUNKNOWN( 0x02, 0x02 )
2720
 
        PORT_DIPUNKNOWN( 0x04, 0x04 )
2721
 
        PORT_DIPUNKNOWN( 0x08, 0x08 )
2722
 
        PORT_DIPUNKNOWN( 0x10, 0x10 )
2723
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
2724
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
2725
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
2726
 
 
2727
 
        PORT_START("COIN")
2728
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
2729
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
2730
 
        PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )   // keep pressed while booting
2731
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
2732
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE2 )   // used?
2733
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE3 )   // used?
2734
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2735
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2736
 
 
2737
 
        PORT_START("IN0")
2738
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
2739
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
2740
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
2741
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
2742
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
2743
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
2744
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )    // press in girl test to pause, button 3 advances
2745
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2746
 
 
2747
 
        PORT_START("IN1")
2748
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
2749
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
2750
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
2751
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
2752
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
2753
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
2754
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2755
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2756
 
 
2757
 
        PORT_START("IN2")
2758
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
2759
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
2760
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
2761
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 )
2762
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
2763
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
2764
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
2765
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
2766
 
INPUT_PORTS_END
2767
 
 
2768
 
 
2769
 
static INPUT_PORTS_START( lhb2 )
2770
 
        PORT_START("DSW1")
2771
 
        PORT_DIPNAME( 0x07, 0x02, "Pay Out (%)" )
2772
 
        PORT_DIPSETTING(    0x07, "50" )
2773
 
        PORT_DIPSETTING(    0x06, "54" )
2774
 
        PORT_DIPSETTING(    0x05, "58" )
2775
 
        PORT_DIPSETTING(    0x04, "62" )
2776
 
        PORT_DIPSETTING(    0x03, "66" )
2777
 
        PORT_DIPSETTING(    0x02, "70" )
2778
 
        PORT_DIPSETTING(    0x01, "74" )
2779
 
        PORT_DIPSETTING(    0x00, "78" )
2780
 
        PORT_DIPNAME( 0x08, 0x08, "Odds Rate" )
2781
 
        PORT_DIPSETTING(    0x08, "1,2,3,5,8,15,30,50" )
2782
 
        PORT_DIPSETTING(    0x00, "1,2,3,4,5,6,7,8" )
2783
 
        PORT_DIPNAME( 0x10, 0x10, "Max Bet" )
2784
 
        PORT_DIPSETTING(    0x00, "5" )
2785
 
        PORT_DIPSETTING(    0x10, "10" )
2786
 
        PORT_DIPNAME( 0x60, 0x60, "Min Credits To Start" )
2787
 
        PORT_DIPSETTING(    0x60, "1" )
2788
 
        PORT_DIPSETTING(    0x40, "2" )
2789
 
        PORT_DIPSETTING(    0x20, "3" )
2790
 
        PORT_DIPSETTING(    0x00, "5" )
2791
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
2792
 
 
2793
 
        PORT_START("DSW2")
2794
 
        PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )  // Only when bit 4 = 1
2795
 
        PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
2796
 
        PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
2797
 
        PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
2798
 
        PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
2799
 
        PORT_DIPNAME( 0x04, 0x04, "Credits Per Note" )  // Only when bit 4 = 0
2800
 
        PORT_DIPSETTING(    0x04, "10" )
2801
 
        PORT_DIPSETTING(    0x00, "100" )
2802
 
        PORT_DIPNAME( 0x08, 0x08, "Max Note Credits" )
2803
 
        PORT_DIPSETTING(    0x08, "100" )
2804
 
        PORT_DIPSETTING(    0x00, "500" )
2805
 
        PORT_DIPNAME( 0x10, 0x10, "Money Type" )        // Decides whether to use bits 0&1 or bit 2
2806
 
        PORT_DIPSETTING(    0x10, "Coins" )
2807
 
        PORT_DIPSETTING(    0x00, "Notes" )
2808
 
        PORT_DIPNAME( 0x20, 0x20, "Pay Out Type" )
2809
 
        PORT_DIPSETTING(    0x20, "Coins" )
2810
 
        PORT_DIPSETTING(    0x00, "Notes" )
2811
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
2812
 
        PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
2813
 
        PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2814
 
        PORT_DIPSETTING(    0x80, DEF_STR( On ) )
2815
 
 
2816
 
        PORT_START("DSW3")
2817
 
        PORT_DIPNAME( 0x03, 0x03, DEF_STR( Unknown ) )
2818
 
        PORT_DIPSETTING(    0x03, "500" )
2819
 
        PORT_DIPSETTING(    0x02, "1000" )
2820
 
        PORT_DIPSETTING(    0x01, "2000" )
2821
 
        PORT_DIPSETTING(    0x00, "30000" )
2822
 
        PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Unknown ) )
2823
 
        PORT_DIPSETTING(    0x0c, "0" )
2824
 
        PORT_DIPSETTING(    0x08, "1" )
2825
 
        PORT_DIPSETTING(    0x04, "2" )
2826
 
//  PORT_DIPSETTING(    0x00, "2" )
2827
 
        PORT_DIPNAME( 0x70, 0x70, DEF_STR( Unknown ) )
2828
 
        PORT_DIPSETTING(    0x70, "1 : 1" )
2829
 
        PORT_DIPSETTING(    0x60, "1 : 2" )
2830
 
        PORT_DIPSETTING(    0x50, "1 : 5" )
2831
 
        PORT_DIPSETTING(    0x40, "1 : 6" )
2832
 
        PORT_DIPSETTING(    0x30, "1 : 7" )
2833
 
        PORT_DIPSETTING(    0x20, "1 : 8" )
2834
 
        PORT_DIPSETTING(    0x10, "1 : 9" )
2835
 
        PORT_DIPSETTING(    0x00, "1 : 10" )
2836
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
2837
 
 
2838
 
        PORT_START("COIN")
2839
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1    )
2840
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 )   // data clear
2841
 
        PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )   // keep pressed while booting
2842
 
        PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(igs_hopper_r, (void *)0)      // hopper switch
2843
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE2 )   // stats
2844
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER    ) PORT_NAME("Pay Out") PORT_CODE(KEYCODE_O) // clear coin
2845
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN  )
2846
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN  )
2847
 
 
2848
 
        PORT_START("KEY0")
2849
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
2850
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
2851
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
2852
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
2853
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
2854
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
2855
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )    // ? set to 0 both
2856
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )    // ? and you can't start a game
2857
 
 
2858
 
        PORT_START("KEY1")
2859
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
2860
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
2861
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
2862
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
2863
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
2864
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
2865
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2866
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2867
 
 
2868
 
        PORT_START("KEY2")
2869
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
2870
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
2871
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
2872
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
2873
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
2874
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
2875
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2876
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2877
 
 
2878
 
        PORT_START("KEY3")
2879
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
2880
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
2881
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
2882
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
2883
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
2884
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
2885
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2886
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2887
 
 
2888
 
        PORT_START("KEY4")
2889
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
2890
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
2891
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
2892
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
2893
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
2894
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
2895
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2896
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2897
 
INPUT_PORTS_END
2898
 
 
2899
 
 
2900
 
static INPUT_PORTS_START( wlcc )
2901
 
        PORT_START("DSW1")
2902
 
        PORT_DIPUNKNOWN( 0x01, 0x01 )
2903
 
        PORT_DIPUNKNOWN( 0x02, 0x02 )
2904
 
        PORT_DIPUNKNOWN( 0x04, 0x04 )
2905
 
        PORT_DIPUNKNOWN( 0x08, 0x08 )
2906
 
        PORT_DIPUNKNOWN( 0x10, 0x10 )
2907
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
2908
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
2909
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
2910
 
 
2911
 
        PORT_START("DSW2")
2912
 
        PORT_DIPNAME( 0x03, 0x03, DEF_STR( Unknown ) )
2913
 
        PORT_DIPSETTING(    0x03, "1000" )
2914
 
        PORT_DIPSETTING(    0x02, "1500" )
2915
 
        PORT_DIPSETTING(    0x01, "2000" )
2916
 
        PORT_DIPSETTING(    0x00, "3000" )
2917
 
        PORT_DIPNAME( 0x0c, 0x0c, "Min Credits To Start" )
2918
 
        PORT_DIPSETTING(    0x0c, "1" )
2919
 
        PORT_DIPSETTING(    0x08, "2" )
2920
 
        PORT_DIPSETTING(    0x04, "3" )
2921
 
        PORT_DIPSETTING(    0x00, "5" )
2922
 
        PORT_DIPUNKNOWN( 0x10, 0x10 )           // shown in test mode
2923
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
2924
 
        PORT_DIPNAME( 0x40, 0x40, "Hide Title" )
2925
 
        PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
2926
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2927
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
2928
 
 
2929
 
        PORT_START("DSW3")
2930
 
        PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
2931
 
        PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
2932
 
        PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
2933
 
        PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
2934
 
        PORT_DIPSETTING(    0x00, DEF_STR( 1C_4C ) )
2935
 
        PORT_DIPNAME( 0x0c, 0x0c, "Credits Per Note" )
2936
 
        PORT_DIPSETTING(    0x0c, "10" )
2937
 
        PORT_DIPSETTING(    0x08, "20" )
2938
 
        PORT_DIPSETTING(    0x04, "50" )
2939
 
        PORT_DIPSETTING(    0x00, "100" )
2940
 
        PORT_DIPNAME( 0x10, 0x10, "Max Note Credits" )
2941
 
        PORT_DIPSETTING(    0x10, "500" )
2942
 
        PORT_DIPSETTING(    0x00, "9999" )
2943
 
        PORT_DIPNAME( 0x20, 0x20, "Money Type" )
2944
 
        PORT_DIPSETTING(    0x20, "Coins" )     // use bits 0-1
2945
 
        PORT_DIPSETTING(    0x00, "Notes" )     // use bits 2-3
2946
 
        PORT_DIPNAME( 0x40, 0x00, "Pay Out Type" )
2947
 
        PORT_DIPSETTING(    0x00, "Coins" )
2948
 
        PORT_DIPSETTING(    0x40, "Notes" )
2949
 
        PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
2950
 
        PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2951
 
        PORT_DIPSETTING(    0x80, DEF_STR( On ) )
2952
 
 
2953
 
        PORT_START("DSW4")
2954
 
        PORT_DIPUNKNOWN( 0x01, 0x01 )
2955
 
        PORT_DIPUNKNOWN( 0x02, 0x02 )
2956
 
        PORT_DIPUNKNOWN( 0x04, 0x04 )
2957
 
        PORT_DIPUNKNOWN( 0x08, 0x08 )
2958
 
        PORT_DIPUNKNOWN( 0x10, 0x10 )
2959
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
2960
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
2961
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
2962
 
 
2963
 
        PORT_START("COIN")
2964
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW,  IPT_COIN1     )
2965
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW,  IPT_COIN2     )
2966
 
        PORT_SERVICE_NO_TOGGLE( 0x04,   IP_ACTIVE_LOW ) // keep pressed while booting
2967
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_SERVICE1  )
2968
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW,  IPT_SERVICE2  ) // shown in test mode
2969
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW,  IPT_UNKNOWN   )
2970
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW,  IPT_OTHER     ) PORT_NAME("Pay Out") PORT_CODE(KEYCODE_O)       // clear coin
2971
 
        PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL   ) PORT_CUSTOM(igs_hopper_r, (void *)0)    // hopper switch
2972
 
 
2973
 
        PORT_START("IN0")
2974
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
2975
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
2976
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
2977
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
2978
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
2979
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
2980
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )    // bet
2981
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 )
2982
 
INPUT_PORTS_END
2983
 
 
2984
 
 
2985
 
static INPUT_PORTS_START( lhb )
2986
 
        PORT_START("DSW1")
2987
 
        PORT_DIPNAME( 0x0f, 0x07, "Pay Out (%)" )
2988
 
        PORT_DIPSETTING(    0x0f, "96" )
2989
 
        PORT_DIPSETTING(    0x0e, "93" )
2990
 
        PORT_DIPSETTING(    0x0d, "90" )
2991
 
        PORT_DIPSETTING(    0x0c, "87" )
2992
 
        PORT_DIPSETTING(    0x0b, "84" )
2993
 
        PORT_DIPSETTING(    0x0a, "81" )
2994
 
        PORT_DIPSETTING(    0x09, "78" )
2995
 
        PORT_DIPSETTING(    0x08, "75" )
2996
 
        PORT_DIPSETTING(    0x07, "71" )
2997
 
        PORT_DIPSETTING(    0x06, "68" )
2998
 
        PORT_DIPSETTING(    0x05, "65" )
2999
 
        PORT_DIPSETTING(    0x04, "62" )
3000
 
        PORT_DIPSETTING(    0x03, "59" )
3001
 
        PORT_DIPSETTING(    0x02, "56" )
3002
 
        PORT_DIPSETTING(    0x01, "53" )
3003
 
        PORT_DIPSETTING(    0x00, "50" )
3004
 
        PORT_DIPNAME( 0x30, 0x30, "YAKUMAN Point" )
3005
 
        PORT_DIPSETTING(    0x30, "1" )
3006
 
        PORT_DIPSETTING(    0x20, "2" )
3007
 
        PORT_DIPSETTING(    0x10, "3" )
3008
 
        PORT_DIPSETTING(    0x00, "4" )
3009
 
        PORT_DIPNAME( 0xc0, 0xc0, "Max Bet" )
3010
 
        PORT_DIPSETTING(    0xc0, "1" )
3011
 
        PORT_DIPSETTING(    0x80, "5" )
3012
 
        PORT_DIPSETTING(    0x40, "10" )
3013
 
        PORT_DIPSETTING(    0x00, "20" )
3014
 
 
3015
 
        PORT_START("DSW2")
3016
 
        PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
3017
 
        PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
3018
 
        PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
3019
 
        PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
3020
 
        PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
3021
 
        PORT_DIPNAME( 0x0c, 0x0c, "Min Credits To Start" )
3022
 
        PORT_DIPSETTING(    0x0c, "1" )
3023
 
        PORT_DIPSETTING(    0x08, "2" )
3024
 
        PORT_DIPSETTING(    0x04, "3" )
3025
 
        PORT_DIPSETTING(    0x00, "5" )
3026
 
        PORT_DIPNAME( 0x70, 0x70, "DAI MANGUAN Cycle" )
3027
 
        PORT_DIPSETTING(    0x70, "300" )
3028
 
//  PORT_DIPSETTING(    0x60, "300" )
3029
 
//  PORT_DIPSETTING(    0x50, "300" )
3030
 
//  PORT_DIPSETTING(    0x40, "300" )
3031
 
//  PORT_DIPSETTING(    0x30, "300" )
3032
 
//  PORT_DIPSETTING(    0x20, "300" )
3033
 
//  PORT_DIPSETTING(    0x10, "300" )
3034
 
//  PORT_DIPSETTING(    0x00, "300" )
3035
 
        PORT_DIPNAME( 0x80, 0x80, "DAI MANGUAN Times" )
3036
 
        PORT_DIPSETTING(    0x80, "2" )
3037
 
//  PORT_DIPSETTING(    0x00, "2" )
3038
 
 
3039
 
        PORT_START("DSW3")
3040
 
        PORT_DIPNAME( 0x03, 0x03, "Max Credit" )
3041
 
        PORT_DIPSETTING(    0x03, "1000" )
3042
 
        PORT_DIPSETTING(    0x02, "2000" )
3043
 
        PORT_DIPSETTING(    0x01, "5000" )
3044
 
        PORT_DIPSETTING(    0x00, DEF_STR( No ) )
3045
 
        PORT_DIPNAME( 0x0c, 0x0c, "Max Note" )
3046
 
        PORT_DIPSETTING(    0x0c, "1000" )
3047
 
        PORT_DIPSETTING(    0x08, "2000" )
3048
 
        PORT_DIPSETTING(    0x04, "5000" )
3049
 
        PORT_DIPSETTING(    0x00, DEF_STR( No ) )
3050
 
        PORT_DIPNAME( 0x10, 0x10, "CPU Strength" )
3051
 
        PORT_DIPSETTING(    0x10, "Strong" )
3052
 
        PORT_DIPSETTING(    0x00, "Weak" )
3053
 
        PORT_DIPNAME( 0x20, 0x20, "Money Type" )
3054
 
        PORT_DIPSETTING(    0x20, "Coins" )
3055
 
        PORT_DIPSETTING(    0x00, "Notes" )
3056
 
        PORT_DIPNAME( 0xc0, 0xc0, "DONDEN Times" )
3057
 
        PORT_DIPSETTING(    0xc0, "0" )
3058
 
        PORT_DIPSETTING(    0x80, "3" )
3059
 
        PORT_DIPSETTING(    0x40, "5" )
3060
 
        PORT_DIPSETTING(    0x00, "8" )
3061
 
 
3062
 
        PORT_START("DSW4")
3063
 
        PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
3064
 
        PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
3065
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3066
 
        PORT_DIPNAME( 0x02, 0x00, "In Game Music" )
3067
 
        PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
3068
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3069
 
        PORT_DIPNAME( 0x0c, 0x00, "Girls" )
3070
 
        PORT_DIPSETTING(    0x0c, DEF_STR( No ) )
3071
 
        PORT_DIPSETTING(    0x08, "Dressed" )
3072
 
        PORT_DIPSETTING(    0x04, "Underwear" )
3073
 
        PORT_DIPSETTING(    0x00, "Nude" )
3074
 
        PORT_DIPNAME( 0x10, 0x10, "Note Rate" )
3075
 
        PORT_DIPSETTING(    0x10, "5" )
3076
 
        PORT_DIPSETTING(    0x00, "10" )
3077
 
        PORT_DIPNAME( 0x20, 0x20, "Pay Out" )
3078
 
        PORT_DIPSETTING(    0x20, "Score" )
3079
 
        PORT_DIPSETTING(    0x00, "Coin" )
3080
 
        PORT_DIPNAME( 0x40, 0x40, "Coin In" )
3081
 
        PORT_DIPSETTING(    0x40, "Credit" )
3082
 
        PORT_DIPSETTING(    0x00, "Score" )
3083
 
        PORT_DIPNAME( 0x80, 0x80, "Last Chance" )
3084
 
        PORT_DIPSETTING(    0x00, DEF_STR( No ) )
3085
 
        PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
3086
 
 
3087
 
        PORT_START("DSW5")
3088
 
        PORT_DIPNAME( 0x01, 0x01, "In-Game Bet" )
3089
 
        PORT_DIPSETTING(    0x01, DEF_STR( No ) )
3090
 
        PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
3091
 
        PORT_DIPUNKNOWN( 0x02, 0x02 )
3092
 
        PORT_DIPUNKNOWN( 0x04, 0x04 )
3093
 
        PORT_DIPUNKNOWN( 0x08, 0x08 )
3094
 
        PORT_DIPUNKNOWN( 0x10, 0x10 )
3095
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
3096
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
3097
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
3098
 
 
3099
 
        PORT_START("COIN")
3100
 
        PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(igs_hopper_r, (void *)0)      // hopper switch
3101
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE2 )   // system reset
3102
 
        PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )   // keep pressed while booting
3103
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )   // stats
3104
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1    ) PORT_IMPULSE(5)
3105
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER    ) PORT_NAME("Pay Out") PORT_CODE(KEYCODE_O) // clear coins
3106
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER    ) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD)   // shown in test mode
3107
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN  )
3108
 
 
3109
 
        PORT_START("KEY0")
3110
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
3111
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
3112
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
3113
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
3114
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
3115
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
3116
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
3117
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
3118
 
 
3119
 
        PORT_START("KEY1")
3120
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
3121
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
3122
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
3123
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
3124
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
3125
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
3126
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
3127
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
3128
 
 
3129
 
        PORT_START("KEY2")
3130
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
3131
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
3132
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
3133
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
3134
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
3135
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
3136
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
3137
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
3138
 
 
3139
 
        PORT_START("KEY3")
3140
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
3141
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
3142
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
3143
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
3144
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
3145
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
3146
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
3147
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
3148
 
 
3149
 
        PORT_START("KEY4")
3150
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
3151
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
3152
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
3153
 
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN2)       // shown in test mode
3154
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG )
3155
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL )
3156
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
3157
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
3158
 
INPUT_PORTS_END
3159
 
 
3160
 
 
3161
 
static INPUT_PORTS_START( vbowl )
3162
 
        PORT_START("DSW1")
3163
 
        PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
3164
 
        PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
3165
 
        PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) )
3166
 
        PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
3167
 
        PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
3168
 
        PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
3169
 
        PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
3170
 
        PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
3171
 
        PORT_DIPSETTING(    0x03, DEF_STR( 1C_5C ) )
3172
 
        PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
3173
 
        PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
3174
 
        PORT_DIPSETTING(    0x08, DEF_STR( On ) )
3175
 
        PORT_DIPNAME( 0x10, 0x10, "Special Picture" ) /* Sexy Interlude pics */
3176
 
        PORT_DIPSETTING(    0x00, DEF_STR( No ) )
3177
 
        PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
3178
 
        PORT_DIPNAME( 0x20, 0x20, "Open Picture" )
3179
 
        PORT_DIPSETTING(    0x00, DEF_STR( No ) )
3180
 
        PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
3181
 
        PORT_DIPNAME( 0x40, 0x40, DEF_STR( Controls ) )
3182
 
        PORT_DIPSETTING(    0x40, DEF_STR( Joystick ) )
3183
 
        PORT_DIPSETTING(    0x00, DEF_STR( Trackball ) )
3184
 
        PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) )
3185
 
        PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
3186
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3187
 
 
3188
 
        PORT_START("DSW2")
3189
 
        PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) )
3190
 
        PORT_DIPSETTING(    0x03, DEF_STR( Easy   ) )   // 5
3191
 
        PORT_DIPSETTING(    0x02, DEF_STR( Normal ) )   // 7
3192
 
        PORT_DIPSETTING(    0x01, DEF_STR( Medium ) )   // 9
3193
 
        PORT_DIPSETTING(    0x00, DEF_STR( Hard   ) )   // 11
3194
 
        PORT_DIPNAME( 0x04, 0x04, "Spares To Win (Frames 1-5)" )
3195
 
        PORT_DIPSETTING(    0x04, "3" )
3196
 
        PORT_DIPSETTING(    0x00, "4" )
3197
 
        PORT_DIPNAME( 0x18, 0x18, "Points To Win (Frames 6-10)" )
3198
 
        PORT_DIPSETTING(    0x18, "160" )
3199
 
        PORT_DIPSETTING(    0x10, "170" )
3200
 
        PORT_DIPSETTING(    0x08, "180" )
3201
 
        PORT_DIPSETTING(    0x00, "190" )
3202
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
3203
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
3204
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
3205
 
 
3206
 
        PORT_START("DSW3")
3207
 
        PORT_DIPNAME( 0x03, 0x03, "Cabinet ID" )
3208
 
        PORT_DIPSETTING(    0x03, "1" )
3209
 
        PORT_DIPSETTING(    0x02, "2" )
3210
 
        PORT_DIPSETTING(    0x01, "3" )
3211
 
        PORT_DIPSETTING(    0x00, "4" )
3212
 
        PORT_DIPNAME( 0x04, 0x04, "Linked Cabinets" )
3213
 
        PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
3214
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3215
 
        PORT_DIPUNKNOWN( 0x08, 0x08 )
3216
 
        PORT_DIPUNKNOWN( 0x10, 0x10 )
3217
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
3218
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
3219
 
        PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
3220
 
 
3221
 
        PORT_START("DSW4")
3222
 
        PORT_DIPUNKNOWN( 0x01, 0x01 )
3223
 
        PORT_DIPUNKNOWN( 0x02, 0x02 )
3224
 
        PORT_DIPUNKNOWN( 0x04, 0x04 )
3225
 
        PORT_DIPUNKNOWN( 0x08, 0x08 )
3226
 
        PORT_DIPUNKNOWN( 0x10, 0x10 )
3227
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
3228
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
3229
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
3230
 
 
3231
 
        PORT_START("COIN")
3232
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
3233
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
3234
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
3235
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
3236
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
3237
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
3238
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
3239
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
3240
 
 
3241
 
        PORT_START("IN0")
3242
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
3243
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
3244
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
3245
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
3246
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
3247
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
3248
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
3249
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 )
3250
 
 
3251
 
        PORT_START("IN1")
3252
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )
3253
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
3254
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
3255
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
3256
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
3257
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
3258
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
3259
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
3260
 
 
3261
 
        PORT_START("AN0")
3262
 
    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1)
3263
 
 
3264
 
        PORT_START("AN1")
3265
 
    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1)
3266
 
INPUT_PORTS_END
3267
 
 
3268
 
 
3269
 
static INPUT_PORTS_START( vbowlj )
3270
 
        PORT_START("DSW1")
3271
 
        PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
3272
 
        PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
3273
 
        PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) )
3274
 
        PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
3275
 
        PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
3276
 
        PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
3277
 
        PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
3278
 
        PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
3279
 
        PORT_DIPSETTING(    0x03, DEF_STR( 1C_5C ) )
3280
 
        PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
3281
 
        PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
3282
 
        PORT_DIPSETTING(    0x08, DEF_STR( On ) )
3283
 
        PORT_DIPNAME( 0x10, 0x10, "Special Picture" ) /* Sexy Interlude pics */
3284
 
        PORT_DIPSETTING(    0x00, DEF_STR( No ) )
3285
 
        PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
3286
 
        PORT_DIPNAME( 0x20, 0x20, DEF_STR( Controls ) )
3287
 
        PORT_DIPSETTING(    0x20, DEF_STR( Joystick ) )
3288
 
        PORT_DIPSETTING(    0x00, DEF_STR( Trackball ) )
3289
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
3290
 
        PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) )
3291
 
        PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
3292
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3293
 
 
3294
 
        PORT_START("DSW2")
3295
 
        PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) )
3296
 
        PORT_DIPSETTING(    0x03, DEF_STR( Easy   ) )   // 5
3297
 
        PORT_DIPSETTING(    0x02, DEF_STR( Normal ) )   // 7
3298
 
        PORT_DIPSETTING(    0x01, DEF_STR( Medium ) )   // 9
3299
 
        PORT_DIPSETTING(    0x00, DEF_STR( Hard   ) )   // 11
3300
 
        PORT_DIPNAME( 0x04, 0x04, "Spares To Win (Frames 1-5)" )
3301
 
        PORT_DIPSETTING(    0x04, "3" )
3302
 
        PORT_DIPSETTING(    0x00, "4" )
3303
 
        PORT_DIPNAME( 0x18, 0x18, "Points To Win (Frames 6-10)" )
3304
 
        PORT_DIPSETTING(    0x18, "160" )
3305
 
        PORT_DIPSETTING(    0x10, "170" )
3306
 
        PORT_DIPSETTING(    0x08, "180" )
3307
 
        PORT_DIPSETTING(    0x00, "190" )
3308
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
3309
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
3310
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
3311
 
 
3312
 
        PORT_START("DSW3")
3313
 
        PORT_DIPNAME( 0x03, 0x03, "Cabinet ID" )
3314
 
        PORT_DIPSETTING(    0x03, "1" )
3315
 
        PORT_DIPSETTING(    0x02, "2" )
3316
 
        PORT_DIPSETTING(    0x01, "3" )
3317
 
        PORT_DIPSETTING(    0x00, "4" )
3318
 
        PORT_DIPNAME( 0x04, 0x04, "Linked Cabinets" )
3319
 
        PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
3320
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3321
 
        PORT_DIPUNKNOWN( 0x08, 0x08 )
3322
 
        PORT_DIPUNKNOWN( 0x10, 0x10 )
3323
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
3324
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
3325
 
        PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
3326
 
 
3327
 
        PORT_START("DSW4")
3328
 
        PORT_DIPUNKNOWN( 0x01, 0x01 )
3329
 
        PORT_DIPUNKNOWN( 0x02, 0x02 )
3330
 
        PORT_DIPUNKNOWN( 0x04, 0x04 )
3331
 
        PORT_DIPUNKNOWN( 0x08, 0x08 )
3332
 
        PORT_DIPUNKNOWN( 0x10, 0x10 )
3333
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
3334
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
3335
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
3336
 
 
3337
 
        PORT_START("COIN")
3338
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
3339
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
3340
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
3341
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
3342
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
3343
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
3344
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
3345
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
3346
 
 
3347
 
        PORT_START("IN0")
3348
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
3349
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
3350
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
3351
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
3352
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
3353
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
3354
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
3355
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 )
3356
 
 
3357
 
        PORT_START("IN1")
3358
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )
3359
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
3360
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
3361
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
3362
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
3363
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
3364
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
3365
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
3366
 
 
3367
 
        PORT_START("AN0")
3368
 
    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1)
3369
 
 
3370
 
        PORT_START("AN1")
3371
 
    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1)
3372
 
INPUT_PORTS_END
3373
 
 
3374
 
 
3375
 
static INPUT_PORTS_START( xymg )
3376
 
        PORT_START("DSW1")
3377
 
        PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
3378
 
        PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
3379
 
        PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
3380
 
        PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
3381
 
        PORT_DIPSETTING(    0x00, DEF_STR( 1C_4C ) )
3382
 
        PORT_DIPNAME( 0x0c, 0x0c, "Credits Per Note" )
3383
 
        PORT_DIPSETTING(    0x0c, "10" )
3384
 
        PORT_DIPSETTING(    0x08, "20" )
3385
 
        PORT_DIPSETTING(    0x04, "50" )
3386
 
        PORT_DIPSETTING(    0x00, "100" )
3387
 
        PORT_DIPNAME( 0x10, 0x10, "Max Note Credits" )
3388
 
        PORT_DIPSETTING(    0x10, "500" )
3389
 
        PORT_DIPSETTING(    0x00, "9999" )
3390
 
        PORT_DIPNAME( 0x20, 0x20, "Money Type" )
3391
 
        PORT_DIPSETTING(    0x20, "Coins" )     // use bits 0-1
3392
 
        PORT_DIPSETTING(    0x00, "Notes" )     // use bits 2-3
3393
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
3394
 
        PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
3395
 
        PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
3396
 
        PORT_DIPSETTING(    0x80, DEF_STR( On ) )
3397
 
 
3398
 
        PORT_START("DSW2")
3399
 
        PORT_DIPNAME( 0x03, 0x03, DEF_STR( Unknown ) )
3400
 
        PORT_DIPSETTING(    0x03, "1000" )
3401
 
        PORT_DIPSETTING(    0x02, "1500" )
3402
 
        PORT_DIPSETTING(    0x01, "2000" )
3403
 
        PORT_DIPSETTING(    0x00, "3000" )
3404
 
        PORT_DIPNAME( 0x0c, 0x0c, "Min Credits To Start" )
3405
 
        PORT_DIPSETTING(    0x0c, "1" )
3406
 
        PORT_DIPSETTING(    0x08, "2" )
3407
 
        PORT_DIPSETTING(    0x04, "3" )
3408
 
        PORT_DIPSETTING(    0x00, "5" )
3409
 
        PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )  // shown in test mode
3410
 
        PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
3411
 
        PORT_DIPSETTING(    0x00, DEF_STR( On ) )
3412
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
3413
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
3414
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
3415
 
 
3416
 
        PORT_START("DSW3")
3417
 
        PORT_DIPUNKNOWN( 0x01, 0x01 )
3418
 
        PORT_DIPUNKNOWN( 0x02, 0x02 )
3419
 
        PORT_DIPUNKNOWN( 0x04, 0x04 )
3420
 
        PORT_DIPUNKNOWN( 0x08, 0x08 )
3421
 
        PORT_DIPUNKNOWN( 0x10, 0x10 )
3422
 
        PORT_DIPUNKNOWN( 0x20, 0x20 )
3423
 
        PORT_DIPUNKNOWN( 0x40, 0x40 )
3424
 
        PORT_DIPUNKNOWN( 0x80, 0x80 )
3425
 
 
3426
 
        PORT_START("COIN")
3427
 
        PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(igs_hopper_r, (void *)0)      // hopper switch
3428
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
3429
 
        PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )   // keep pressed while booting
3430
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )   // stats
3431
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
3432
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_OTHER    ) PORT_NAME("Pay Out") PORT_CODE(KEYCODE_O) // clear coin
3433
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
3434
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
3435
 
 
3436
 
        PORT_START("KEY0")
3437
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
3438
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
3439
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
3440
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
3441
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
3442
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
3443
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
3444
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
3445
 
 
3446
 
        PORT_START("KEY1")
3447
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
3448
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
3449
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
3450
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
3451
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
3452
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
3453
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
3454
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
3455
 
 
3456
 
        PORT_START("KEY2")
3457
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
3458
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
3459
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
3460
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
3461
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
3462
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
3463
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
3464
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
3465
 
 
3466
 
        PORT_START("KEY3")
3467
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
3468
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
3469
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
3470
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
3471
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
3472
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
3473
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
3474
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
3475
 
 
3476
 
        PORT_START("KEY4")
3477
 
        PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
3478
 
        PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
3479
 
        PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
3480
 
        PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
3481
 
        PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG )
3482
 
        PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL )
3483
 
        PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
3484
 
        PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
3485
 
INPUT_PORTS_END
3486
 
 
3487
 
 
3488
 
 
3489
 
/***************************************************************************
3490
 
 
3491
 
    Machine Drivers
3492
 
 
3493
 
***************************************************************************/
3494
 
 
3495
 
// for debugging
3496
 
 
3497
 
#if 0
3498
 
static const gfx_layout layout_8x8x4 =
3499
 
{
3500
 
        8,8,
3501
 
        RGN_FRAC(1,1),
3502
 
        4,
3503
 
        { STEP4(0,1) },
3504
 
        { 4, 0, 12,  8, 20,16, 28,24 },
3505
 
        { STEP8(0,8*4) },
3506
 
        8*8*4
3507
 
};
3508
 
static const gfx_layout layout_16x16x4 =
3509
 
{
3510
 
        16,16,
3511
 
        RGN_FRAC(1,1),
3512
 
        4,
3513
 
        { STEP4(0,1) },
3514
 
        { 4, 0, 12, 8, 20,16, 28,24,
3515
 
          36,32, 44,40, 52,48, 60,56 },
3516
 
        { STEP16(0,16*4) },
3517
 
        16*16*4
3518
 
};
3519
 
static const gfx_layout layout_8x8x8 =
3520
 
{
3521
 
        8,8,
3522
 
        RGN_FRAC(1,1),
3523
 
        8,
3524
 
        { STEP8(0,1) },
3525
 
        { STEP8(0,8) },
3526
 
        { STEP8(0,8*8) },
3527
 
        8*8*8
3528
 
};
3529
 
static const gfx_layout layout_16x16x8 =
3530
 
{
3531
 
        16,16,
3532
 
        RGN_FRAC(1,1),
3533
 
        8,
3534
 
        { STEP8(0,1) },
3535
 
        { STEP16(0,8) },
3536
 
        { STEP16(0,16*8) },
3537
 
        16*16*8
3538
 
};
3539
 
static const gfx_layout layout_16x16x1 =
3540
 
{
3541
 
        16,16,
3542
 
        RGN_FRAC(1,1),
3543
 
        1,
3544
 
        { 0 },
3545
 
        { STEP16(15,-1) },
3546
 
        { STEP16(0,16*1) },
3547
 
        16*16*1
3548
 
};
3549
 
 
3550
 
static GFXDECODE_START( igs011 )
3551
 
        GFXDECODE_ENTRY( "blitter", 0, layout_8x8x4,   0, 0x80 )
3552
 
        GFXDECODE_ENTRY( "blitter", 0, layout_16x16x4, 0, 0x80 )
3553
 
        GFXDECODE_ENTRY( "blitter", 0, layout_8x8x8,   0, 0x08 )
3554
 
        GFXDECODE_ENTRY( "blitter", 0, layout_16x16x8, 0, 0x08 )
3555
 
GFXDECODE_END
3556
 
static GFXDECODE_START( igs011_hi )
3557
 
        GFXDECODE_ENTRY( "blitter", 0, layout_8x8x4,   0, 0x80 )
3558
 
        GFXDECODE_ENTRY( "blitter", 0, layout_16x16x4, 0, 0x80 )
3559
 
        GFXDECODE_ENTRY( "blitter", 0, layout_8x8x8,   0, 0x08 )
3560
 
        GFXDECODE_ENTRY( "blitter", 0, layout_16x16x8, 0, 0x08 )
3561
 
        GFXDECODE_ENTRY( "blitter_hi", 0, layout_16x16x1, 0, 0x80 )
3562
 
GFXDECODE_END
3563
 
#endif
3564
 
 
3565
 
static MACHINE_CONFIG_START( igs011_base, igs011_state )
3566
 
        MCFG_CPU_ADD("maincpu",M68000, XTAL_22MHz/3)
3567
 
 
3568
 
        MCFG_NVRAM_ADD_0FILL("nvram")
3569
 
 
3570
 
        /* video hardware */
3571
 
        MCFG_SCREEN_ADD("screen", RASTER)
3572
 
        MCFG_SCREEN_REFRESH_RATE(60)
3573
 
        MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
3574
 
        MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
3575
 
        MCFG_SCREEN_SIZE(512, 256)
3576
 
        MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 240-1)
3577
 
        MCFG_SCREEN_UPDATE( igs011 )
3578
 
 
3579
 
        MCFG_PALETTE_LENGTH(0x800)
3580
 
//  MCFG_GFXDECODE(igs011)
3581
 
 
3582
 
        MCFG_VIDEO_START( igs011 )
3583
 
 
3584
 
        /* sound hardware */
3585
 
        MCFG_SPEAKER_STANDARD_MONO("mono")
3586
 
        MCFG_OKIM6295_ADD("oki", XTAL_22MHz/21, OKIM6295_PIN7_HIGH)
3587
 
        MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
3588
 
MACHINE_CONFIG_END
3589
 
 
3590
 
static INTERRUPT_GEN( drgnwrld_interrupt )
3591
 
{
3592
 
        switch (cpu_getiloops(device))
3593
 
        {
3594
 
                case 0: device_set_input_line(device, 6, HOLD_LINE);    break;
3595
 
                default:
3596
 
                case 1: device_set_input_line(device, 5, HOLD_LINE);    break;
3597
 
        }
3598
 
}
3599
 
 
3600
 
static MACHINE_CONFIG_DERIVED( drgnwrld, igs011_base )
3601
 
        MCFG_CPU_MODIFY("maincpu")
3602
 
        MCFG_CPU_PROGRAM_MAP(drgnwrld)
3603
 
        MCFG_CPU_VBLANK_INT_HACK(drgnwrld_interrupt,1+4)        // lev5 frequency drives the music tempo
3604
 
 
3605
 
        MCFG_SOUND_ADD("ymsnd", YM3812, 3579545)
3606
 
        MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0)
3607
 
MACHINE_CONFIG_END
3608
 
 
3609
 
static MACHINE_CONFIG_DERIVED( drgnwrld_igs012, drgnwrld )
3610
 
        MCFG_CPU_MODIFY("maincpu")
3611
 
        MCFG_CPU_PROGRAM_MAP(drgnwrld_igs012)
3612
 
MACHINE_CONFIG_END
3613
 
 
3614
 
 
3615
 
 
3616
 
static INTERRUPT_GEN( lhb_interrupt )
3617
 
{
3618
 
        igs011_state *state = device->machine().driver_data<igs011_state>();
3619
 
        if (!state->m_lhb_irq_enable)
3620
 
                return;
3621
 
 
3622
 
        switch (cpu_getiloops(device))
3623
 
        {
3624
 
                case 0: device_set_input_line(device, 3, HOLD_LINE);    break;
3625
 
                case 2: device_set_input_line(device, 6, HOLD_LINE);    break;
3626
 
                default:
3627
 
                                // It reads the inputs. Must be called more than once for test mode on boot to work
3628
 
                                device_set_input_line(device, 5, HOLD_LINE);    break;
3629
 
        }
3630
 
}
3631
 
 
3632
 
static MACHINE_CONFIG_DERIVED( lhb, igs011_base )
3633
 
        MCFG_CPU_MODIFY("maincpu")
3634
 
        MCFG_CPU_PROGRAM_MAP(lhb)
3635
 
        MCFG_CPU_VBLANK_INT_HACK(lhb_interrupt,3+1)
3636
 
MACHINE_CONFIG_END
3637
 
 
3638
 
 
3639
 
 
3640
 
static INTERRUPT_GEN( wlcc_interrupt )
3641
 
{
3642
 
        switch (cpu_getiloops(device))
3643
 
        {
3644
 
                case 0: device_set_input_line(device, 3, HOLD_LINE);    break;
3645
 
                case 1: device_set_input_line(device, 6, HOLD_LINE);    break;
3646
 
        }
3647
 
}
3648
 
 
3649
 
static MACHINE_CONFIG_DERIVED( wlcc, igs011_base )
3650
 
        MCFG_CPU_MODIFY("maincpu")
3651
 
        MCFG_CPU_PROGRAM_MAP(wlcc)
3652
 
        MCFG_CPU_VBLANK_INT_HACK(wlcc_interrupt,2)
3653
 
MACHINE_CONFIG_END
3654
 
 
3655
 
 
3656
 
 
3657
 
static MACHINE_CONFIG_DERIVED( xymg, igs011_base )
3658
 
        MCFG_CPU_MODIFY("maincpu")
3659
 
        MCFG_CPU_PROGRAM_MAP(xymg)
3660
 
        MCFG_CPU_VBLANK_INT_HACK(wlcc_interrupt,2)
3661
 
MACHINE_CONFIG_END
3662
 
 
3663
 
 
3664
 
 
3665
 
static MACHINE_CONFIG_DERIVED( lhb2, igs011_base )
3666
 
        MCFG_CPU_MODIFY("maincpu")
3667
 
        MCFG_CPU_PROGRAM_MAP(lhb2)
3668
 
        MCFG_CPU_VBLANK_INT_HACK(drgnwrld_interrupt,1+4)        // lev5 frequency drives the music tempo
3669
 
 
3670
 
//  MCFG_GFXDECODE(igs011_hi)
3671
 
 
3672
 
        MCFG_SOUND_ADD("ymsnd", YM2413, 3579545)
3673
 
        MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0)
3674
 
MACHINE_CONFIG_END
3675
 
 
3676
 
 
3677
 
 
3678
 
static void sound_irq(device_t *device, int state)
3679
 
{
3680
 
//   cputag_set_input_line(machine, "maincpu", 3, state);
3681
 
}
3682
 
 
3683
 
static INTERRUPT_GEN( vbowl_interrupt )
3684
 
{
3685
 
        switch (cpu_getiloops(device))
3686
 
        {
3687
 
                case 0: device_set_input_line(device, 4, HOLD_LINE);    break;
3688
 
                case 1: device_set_input_line(device, 5, HOLD_LINE);    break;
3689
 
                case 2: device_set_input_line(device, 6, HOLD_LINE);    break;
3690
 
                default:
3691
 
                case 3: device_set_input_line(device, 3, HOLD_LINE);    break;  // sound
3692
 
        }
3693
 
}
3694
 
 
3695
 
static MACHINE_CONFIG_DERIVED( vbowl, igs011_base )
3696
 
        MCFG_CPU_MODIFY("maincpu")
3697
 
        MCFG_CPU_PROGRAM_MAP(vbowl)
3698
 
        MCFG_CPU_VBLANK_INT_HACK(vbowl_interrupt,3+4)
3699
 
 
3700
 
        MCFG_SCREEN_MODIFY("screen")
3701
 
        MCFG_SCREEN_EOF(vbowl)  // trackball
3702
 
//  MCFG_GFXDECODE(igs011_hi)
3703
 
 
3704
 
        MCFG_DEVICE_REMOVE("oki")
3705
 
        MCFG_ICS2115_ADD("ics", 0, sound_irq)
3706
 
//  MCFG_SOUND_ADD("ics", ICS2115, 0)
3707
 
//  MCFG_SOUND_CONFIG(vbowl_ics2115_interface)
3708
 
        MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 5.0)
3709
 
MACHINE_CONFIG_END
3710
 
 
3711
 
 
3712
 
 
3713
 
/***************************************************************************
3714
 
 
3715
 
    ROMs Loading
3716
 
 
3717
 
***************************************************************************/
3718
 
 
3719
 
/***************************************************************************
3720
 
 
3721
 
Dragon World (World, V040O)
3722
 
(C) 1997 IGS / ALTA
3723
 
 
3724
 
Chips:
3725
 
  1x 68000 (main)
3726
 
  1x AC0A26 (equivalent to OKI M6295)(sound)
3727
 
  1x 6564L (equivalent to YM3812)(sound)
3728
 
  1x custom IGS003c (marked on PCB as 8255)
3729
 
  1x oscillator 22.0000MHz (main)
3730
 
  1x oscillator 3.579545MHz (sound)
3731
 
  1x custom IGS011 (FPGA?)
3732
 
 
3733
 
ROMs:
3734
 
  1x MX27C4096 (u3)(main) (dumped)
3735
 
  1x custom IGSD0301 (mask rom) (not dumped yet)
3736
 
  1x NEC D27C2001D (IGSS0302)(sound) (not dumped yet)
3737
 
 
3738
 
Notes:
3739
 
  1x JAMMA edge connector
3740
 
  1x trimmer (volume)
3741
 
  3x 8 switches dips
3742
 
  PCB serial number is: 0105-5
3743
 
 
3744
 
***************************************************************************/
3745
 
 
3746
 
ROM_START( drgnwrld )
3747
 
        ROM_REGION( 0x80000, "maincpu", 0 )
3748
 
        ROM_LOAD16_WORD_SWAP( "chinadr-v0400.u3", 0x00000, 0x80000, CRC(a6daa2b8) SHA1(0cbfd001c1fd82a6385453d1c2a808add67746af) )
3749
 
 
3750
 
        ROM_REGION( 0x400000, "blitter", 0 )
3751
 
        ROM_LOAD( "igs-d0301.u39", 0x000000, 0x400000, CRC(78ab45d9) SHA1(c326ee9f150d766edd6886075c94dea3691b606d) )
3752
 
 
3753
 
        ROM_REGION( 0x40000, "oki", 0 )
3754
 
        ROM_LOAD( "igs-s0302.u43", 0x00000, 0x40000, CRC(fde63ce1) SHA1(cc32d2cace319fe4d5d0aa96d7addb2d1def62f2) )
3755
 
ROM_END
3756
 
 
3757
 
/***************************************************************************
3758
 
 
3759
 
Dragon World (World, V030O)
3760
 
(C) 1995 IGS
3761
 
 
3762
 
Chips:
3763
 
  1x MC68HC000P10           U2 (main)
3764
 
  1x CUSTOM IGS011          U24
3765
 
  1x oscillator 22.000MHz   U25
3766
 
  1x oscillator 3.579545MHz X1
3767
 
 
3768
 
ROMs:
3769
 
  1x MX27C4096              U3 (main)
3770
 
 
3771
 
Notes:
3772
 
  1x JAMMA edge connector
3773
 
  1x trimmer (volume)
3774
 
  3x 8 switches dips
3775
 
  PCB serial number is: 0105-1
3776
 
 
3777
 
***************************************************************************/
3778
 
 
3779
 
ROM_START( drgnwrldv30 )
3780
 
        ROM_REGION( 0x80000, "maincpu", 0 )
3781
 
        ROM_LOAD16_WORD_SWAP( "chinadr-v0300.u3", 0x00000, 0x80000, CRC(5ac243e5) SHA1(50cccff0307239187ac2b65331ad2bcc666f8033) )
3782
 
 
3783
 
        ROM_REGION( 0x400000, "blitter", 0 )
3784
 
        ROM_LOAD( "igs-d0301.u39", 0x000000, 0x400000, CRC(78ab45d9) SHA1(c326ee9f150d766edd6886075c94dea3691b606d) )
3785
 
 
3786
 
        ROM_REGION( 0x40000, "oki", 0 )
3787
 
        ROM_LOAD( "igs-s0302.u43", 0x00000, 0x40000, CRC(fde63ce1) SHA1(cc32d2cace319fe4d5d0aa96d7addb2d1def62f2) )
3788
 
ROM_END
3789
 
 
3790
 
/***************************************************************************
3791
 
 
3792
 
Dragon World (World, V021O)
3793
 
(C) 1995 IGS
3794
 
 
3795
 
Chips:
3796
 
    1x MC68HC000P10             u2      16/32-bit Microprocessor - main
3797
 
    1x AR17961-AP0642           u41     4-Channel Mixing ADCPM Voice Synthesis LSI - sound
3798
 
    1x 6564L                    u40     FM Operator Type-L II (OPL II) - sound
3799
 
    1x LS138S                   u42     sound
3800
 
    1x LM7805CV                 u38     sound
3801
 
    1x UPC1242H                 u46     sound
3802
 
    1x IGS003                   u10     Programmable Peripheral Interface
3803
 
    1x oscillator   22.0000MHz  u25
3804
 
    1x oscillator   3.579545MHz x1
3805
 
 
3806
 
ROMs:
3807
 
    1x  M27C4096                u3      (main) dumped
3808
 
    1x  custom IGSD0301         u39     not dumped yet
3809
 
    x   NEC D27C2001D           u43     (sound) dumped
3810
 
 
3811
 
RAMs:
3812
 
    2x  UM6264                  u4,u5
3813
 
    2x  CXK5863AP               u31,u32
3814
 
 
3815
 
PLDs:
3816
 
    1x  custom IGS011 (FPGA?)   u24     not dumped
3817
 
    1x  custom IGS012 (FPGA?)   u1      not dumped
3818
 
    2x  PAL16L8A                u17,u18 read protected
3819
 
    2x  ATF22V10B               u15,u45 read protected
3820
 
    1x  ATV750                  u16     read protected
3821
 
 
3822
 
***************************************************************************/
3823
 
 
3824
 
ROM_START( drgnwrldv21 )
3825
 
        ROM_REGION( 0x80000, "maincpu", 0 )
3826
 
        ROM_LOAD16_WORD_SWAP( "china-dr-v-0210.u3", 0x00000, 0x80000, CRC(60c2b018) SHA1(58563e3ccb51bd9d8362aa17c23743bb5a593c3b) )
3827
 
 
3828
 
        ROM_REGION( 0x400000, "blitter", 0 )
3829
 
        ROM_LOAD( "igs-d0301.u39", 0x000000, 0x400000, CRC(78ab45d9) SHA1(c326ee9f150d766edd6886075c94dea3691b606d) )
3830
 
 
3831
 
        ROM_REGION( 0x40000, "oki", 0 )
3832
 
        ROM_LOAD( "china-dr-sp.u43", 0x00000, 0x40000, CRC(fde63ce1) SHA1(cc32d2cace319fe4d5d0aa96d7addb2d1def62f2) )
3833
 
ROM_END
3834
 
 
3835
 
/***************************************************************************
3836
 
 
3837
 
Chuugokuryuu (china dragon jpn ver.)
3838
 
(c)IGS
3839
 
Distributed by ALTA
3840
 
 
3841
 
MAIN CPU   : 68000
3842
 
I/O        : IGS003 (=8255)
3843
 
SOUND ?    : 6564L  (=OPL?)  , AR17961 (=M6295?)
3844
 
CRTC ?     : IGS011
3845
 
SOUND CPU? : IGSD0301 (DIP 42P)
3846
 
OSC        : 22Mhz , 3.579545Mhz
3847
 
DIPSW      : 8bitx 3 (SW3 is not used)
3848
 
OTHER      : IGS012
3849
 
 
3850
 
MAIN PRG   : "CHINA DRAGON U020J" (japan)
3851
 
SOUND PRG? : "CHINA DRAGON SP"
3852
 
SOUND DATA?: "CHINA DRAGON U44"
3853
 
 
3854
 
***************************************************************************/
3855
 
 
3856
 
ROM_START( drgnwrldv20j )
3857
 
        ROM_REGION( 0x80000, "maincpu", 0 )
3858
 
        ROM_LOAD16_WORD_SWAP( "china_jp.v20", 0x00000, 0x80000, CRC(9e018d1a) SHA1(fe14e6344434cabf43685e50fd49c90f05f565be) )
3859
 
 
3860
 
        ROM_REGION( 0x420000, "blitter", 0 )
3861
 
        // igs-d0301.u39 wasn't in this set
3862
 
        ROM_LOAD( "igs-d0301.u39", 0x000000, 0x400000, CRC(78ab45d9) SHA1(c326ee9f150d766edd6886075c94dea3691b606d) )
3863
 
        ROM_LOAD( "china.u44",     0x400000, 0x020000, CRC(10549746) SHA1(aebd83796679c85b43ad514b2771897f94e61294) ) // 1xxxxxxxxxxxxxxxx = 0x00
3864
 
 
3865
 
        ROM_REGION( 0x40000, "oki", 0 )
3866
 
        ROM_LOAD( "igs-s0302.u43", 0x00000, 0x40000, CRC(fde63ce1) SHA1(cc32d2cace319fe4d5d0aa96d7addb2d1def62f2) ) // original label: "sp"
3867
 
ROM_END
3868
 
 
3869
 
ROM_START( drgnwrldv21j )
3870
 
        ROM_REGION( 0x80000, "maincpu", 0 )
3871
 
        ROM_LOAD16_WORD_SWAP( "v-021j", 0x00000, 0x80000, CRC(2f87f6e4) SHA1(d43065b078fdd9605c121988ad3092dce6cf0bf1) )
3872
 
 
3873
 
        ROM_REGION( 0x420000, "blitter", 0 )
3874
 
        ROM_LOAD( "igs-d0301.u39", 0x000000, 0x400000, CRC(78ab45d9) SHA1(c326ee9f150d766edd6886075c94dea3691b606d) )
3875
 
        ROM_LOAD( "cg",            0x400000, 0x020000, CRC(2dda0be3) SHA1(587b7cab747d4336515c98eb3365341bb6c7e5e4) )
3876
 
 
3877
 
        ROM_REGION( 0x40000, "oki", 0 )
3878
 
        ROM_LOAD( "igs-s0302.u43", 0x00000, 0x40000, CRC(fde63ce1) SHA1(cc32d2cace319fe4d5d0aa96d7addb2d1def62f2) ) // original label: "sp"
3879
 
ROM_END
3880
 
 
3881
 
/***************************************************************************
3882
 
 
3883
 
    Dong Fang Zhi Zhu (Hong Kong version of Zhong Guo Long, V011H)
3884
 
 
3885
 
***************************************************************************/
3886
 
 
3887
 
ROM_START( drgnwrldv11h )
3888
 
        ROM_REGION( 0x80000, "maincpu", 0 )
3889
 
        ROM_LOAD16_WORD_SWAP( "c_drgn_hk.u3", 0x00000, 0x80000, CRC(182037ce) SHA1(141b698777533e57493e588d2526523d4bd3e17d) )
3890
 
 
3891
 
        ROM_REGION( 0x400000, "blitter", 0 )
3892
 
        ROM_LOAD( "igs-d0301.u39", 0x000000, 0x400000, CRC(78ab45d9) SHA1(c326ee9f150d766edd6886075c94dea3691b606d) )
3893
 
 
3894
 
        ROM_REGION( 0x40000, "oki", 0 )
3895
 
        ROM_LOAD( "igs-s0302.u43", 0x00000, 0x40000, CRC(fde63ce1) SHA1(cc32d2cace319fe4d5d0aa96d7addb2d1def62f2) )
3896
 
ROM_END
3897
 
 
3898
 
/***************************************************************************
3899
 
 
3900
 
Zhong Guo Long (China, V010C)
3901
 
(C) 1995 IGS
3902
 
 
3903
 
Chips:
3904
 
  CPU 1x MC68HC000P10 (main)
3905
 
  1x AR17961-AP0642 (equivalent to OKI M6295)(sound)
3906
 
  1x 6564L (equivalent to YM3812)(sound)
3907
 
  1x LS138S (sound)
3908
 
  1x LM7805CV (sound)
3909
 
  1x UPC1242H (sound)
3910
 
  1x custom IGS003 (marked on PCB as 8255)
3911
 
  1x oscillator 22.0000MHz (main)
3912
 
  1x oscillator 3.579545MHz (sound)
3913
 
  1x custom IGS011 (FPGA?)
3914
 
 
3915
 
ROMs:
3916
 
  1x maskrom 256x16 IGSD0303 (u3)(main)
3917
 
  1x maskrom 2Mx16 UM23V32000 (IGSD0301)(u39)(gfx)
3918
 
  1x empty socket for 27C040 (u44)
3919
 
  1x maskrom NEC D27C2001D (IGSS0302)(u43)(sound)
3920
 
  2x PAL16L8ACN (u17,u18)(read protected)
3921
 
  2x PALATF22V10B (u15,u45)
3922
 
  1x empty space for additional PALATV750 (u16)
3923
 
 
3924
 
Notes:
3925
 
  1x JAMMA edge connector
3926
 
  1x trimmer (volume)
3927
 
  3x 8x2 switches DIP
3928
 
 
3929
 
The PCB is perfectly working, empty spaces and empty sockets are clearly intended to be empty.
3930
 
25/07/2007 f205v Corrado Tomaselli Gnoppi
3931
 
 
3932
 
***************************************************************************/
3933
 
 
3934
 
ROM_START( drgnwrldv10c )
3935
 
        ROM_REGION( 0x80000, "maincpu", 0 )
3936
 
        ROM_LOAD16_WORD_SWAP( "igs-d0303.u3", 0x00000, 0x80000, CRC(3b3c29bb) SHA1(77b7e58104314303985c283cce3aec40bd7b9334) )
3937
 
 
3938
 
        ROM_REGION( 0x400000, "blitter", 0 )
3939
 
        //ROM_LOAD( "igs-0301.u39", 0x000000, 0x400000, CRC(655ab941) SHA1(4bbefb27e8971446998508969661042c5111bc72) ) // bad dump
3940
 
        ROM_LOAD( "igs-d0301.u39", 0x000000, 0x400000, CRC(78ab45d9) SHA1(c326ee9f150d766edd6886075c94dea3691b606d) )
3941
 
 
3942
 
        ROM_REGION( 0x40000, "oki", 0 )
3943
 
        ROM_LOAD( "igs-s0302.u43", 0x00000, 0x40000, CRC(fde63ce1) SHA1(cc32d2cace319fe4d5d0aa96d7addb2d1def62f2) )
3944
 
 
3945
 
        ROM_REGION( 0x40000, "plds", 0 )
3946
 
        ROM_LOAD( "ccdu15.u15", 0x000, 0x2e5, CRC(a15fce69) SHA1(3e38d75c7263bfb36aebdbbd55ebbdd7ca601633) )
3947
 
        //ROM_LOAD( "ccdu17.u17.bad.dump", 0x000, 0x104, CRC(e9cd78fb) SHA1(557d3e7ef3b25c1338b24722cac91bca788c02b8) )
3948
 
        //ROM_LOAD( "ccdu18.u18.bad.dump", 0x000, 0x104, CRC(e9cd78fb) SHA1(557d3e7ef3b25c1338b24722cac91bca788c02b8) )
3949
 
        ROM_LOAD( "ccdu45.u45", 0x000, 0x2e5, CRC(a15fce69) SHA1(3e38d75c7263bfb36aebdbbd55ebbdd7ca601633) )
3950
 
ROM_END
3951
 
 
3952
 
/***************************************************************************
3953
 
 
3954
 
    Wan Li Chang Cheng (The Great Wall)
3955
 
 
3956
 
    Other files in the zip:
3957
 
 
3958
 
     5.942    16-6126.G16
3959
 
    14.488    U3-9911.G22
3960
 
    14.488    U4-82E6.G22
3961
 
    14.488    U5-6C5E.G22
3962
 
 
3963
 
***************************************************************************/
3964
 
 
3965
 
ROM_START( wlcc )
3966
 
        ROM_REGION( 0x80000, "maincpu", 0 )
3967
 
        ROM_LOAD16_WORD_SWAP( "wlcc4096.rom", 0x00000, 0x80000, CRC(3b16729f) SHA1(4ef4e5cbd6ccc65775e36c2c8b459bc1767d6574) )
3968
 
        ROM_CONTINUE        (                 0x00000, 0x80000 ) // 1ST+2ND IDENTICAL
3969
 
 
3970
 
        ROM_REGION( 0x280000, "blitter", ROMREGION_ERASE00 )
3971
 
        ROM_LOAD( "m0201-ig.160", 0x000000, 0x200000, CRC(ec54452c) SHA1(0ee7ffa3d4845af083944e64faf5a1c78247aaa2) )
3972
 
        ROM_LOAD( "wlcc.gfx",  0x200000, 0x080000, CRC(1f7ad299) SHA1(ab0a8fb31906519b9352ba172def48456e8d565c) )
3973
 
 
3974
 
        ROM_REGION( 0x80000, "oki", 0 )
3975
 
        ROM_LOAD( "040-c3c2.snd", 0x00000, 0x80000, CRC(220949aa) SHA1(1e0dba168a0687d32aaaed42714ae24358f4a3e7) ) // 2 banks
3976
 
        ROM_CONTINUE(             0x00000, 0x80000 ) // 1ST+2ND IDENTICAL
3977
 
ROM_END
3978
 
 
3979
 
/***************************************************************************
3980
 
 
3981
 
    Long Hu Bang (V035C)
3982
 
 
3983
 
    Other files in the zip:
3984
 
 
3985
 
     5.938    16V8.jed
3986
 
    14.464    LHB-U33.jed
3987
 
    14.488    LHB-U34.jed
3988
 
    14.488    LHB-U35.jed
3989
 
 
3990
 
***************************************************************************/
3991
 
 
3992
 
ROM_START( lhb )
3993
 
        ROM_REGION( 0x80000, "maincpu", 0 )
3994
 
        // identical to LHB-4096
3995
 
        ROM_LOAD16_WORD_SWAP( "v305j-409", 0x00000, 0x80000, CRC(701de8ef) SHA1(4a77160f642f4de02fa6fbacf595b75c0d4a505d) )
3996
 
 
3997
 
        ROM_REGION( 0x200000, "blitter", 0 )
3998
 
        ROM_LOAD( "m0201-ig.160", 0x000000, 0x200000, CRC(ec54452c) SHA1(0ee7ffa3d4845af083944e64faf5a1c78247aaa2) )
3999
 
 
4000
 
        ROM_REGION( 0x80000, "oki", 0 )
4001
 
        // identical to 040-c3c2.snd
4002
 
        ROM_LOAD( "m0202.snd", 0x00000, 0x80000, CRC(220949aa) SHA1(1e0dba168a0687d32aaaed42714ae24358f4a3e7) ) // 2 banks
4003
 
        ROM_CONTINUE(          0x00000, 0x80000 ) // 1ST+2ND IDENTICAL
4004
 
ROM_END
4005
 
 
4006
 
/***************************************************************************
4007
 
 
4008
 
Long Hu Bang (V033C)
4009
 
 
4010
 
PCB Layout
4011
 
----------
4012
 
 
4013
 
IGS PCB NO-T0093
4014
 
|---------------------------------------|
4015
 
|uPD1242H     VOL       DSW5            |
4016
 
|  IGS_M0202                            |
4017
 
|             AR17961   DSW4            |
4018
 
|                             CY7C185   |
4019
 
|                       DSW3            |
4020
 
|      8255             DSW2  CY7C185   |
4021
 
|                       DSW1            |
4022
 
|1                                      |
4023
 
|8                           DIP32      |
4024
 
|W             |-------|                |
4025
 
|A             |       |     IGS_M0201  |
4026
 
|Y  BATTERY    |IGS011 |                |
4027
 
|              |       |          PAL   |
4028
 
|              |-------|                |
4029
 
|                         TC524256      |
4030
 
|    MAJ_V-033C                         |
4031
 
|                         TC524256      |
4032
 
|1      6264                            |
4033
 
|0                        TC524256      |
4034
 
|W      6264    22.285MHz               |
4035
 
|A         PAL            TC524256      |
4036
 
|Y         PAL                          |
4037
 
| SPDT_SW  PAL      68000               |
4038
 
|---------------------------------------|
4039
 
Notes:
4040
 
      Uses common 10-way/18-way Mahjong pinout
4041
 
      TC524256 - Toshiba TC524256BZ-80 256k x4 Dual Port VRAM (ZIP28)
4042
 
      CY7C185  - Cypress CY7C185-20PC 8k x8 SRAM (DIP28)
4043
 
      6264     - UT6264PC-70LL 8k x8 SRAM (DIP28)
4044
 
      IGS011   - Custom IGS IC (QFP160)
4045
 
      AR17961  - == OkiM6295 (QFP44)
4046
 
      DIP32    - Empty socket, maybe a ROM missing, maybe not used?
4047
 
 
4048
 
      ROMs -
4049
 
            MAJ_V-033C - Main Program (27C4096)
4050
 
            IGS_M0201  - Graphics (16M maskROM)
4051
 
            IGS_M0202  - OKI samples (4M maskROM)
4052
 
 
4053
 
***************************************************************************/
4054
 
 
4055
 
ROM_START( lhbv33c )
4056
 
        ROM_REGION( 0x80000, "maincpu", 0 )
4057
 
        ROM_LOAD16_WORD_SWAP( "maj_v-033c.u30", 0x00000, 0x80000, CRC(02a0b716) SHA1(cd0ee32ea69f66768196b0e9b4df0fae3af84ed3) )
4058
 
 
4059
 
        ROM_REGION( 0x200000, "blitter", 0 )
4060
 
        ROM_LOAD( "igs_m0201.u15", 0x000000, 0x200000, CRC(ec54452c) SHA1(0ee7ffa3d4845af083944e64faf5a1c78247aaa2) )
4061
 
 
4062
 
        ROM_REGION( 0x80000, "oki", 0 )
4063
 
        // identical to 040-c3c2.snd
4064
 
        ROM_LOAD( "igs_m0202.u39", 0x00000, 0x80000, CRC(106ac5f7) SHA1(5796a880c3424e3d2251b2223a0e594957afecaf) ) // 2 banks
4065
 
 
4066
 
ROM_END
4067
 
 
4068
 
/***************************************************************************
4069
 
 
4070
 
Da Ban Cheng
4071
 
 
4072
 
PCB Layout
4073
 
----------
4074
 
 
4075
 
IGS PCB NO-T0084-1
4076
 
|---------------------------------------|
4077
 
|uPD1242H     VOL       DSW5            |
4078
 
|  IGS_M0202                            |
4079
 
|             AR17961   DSW4            |
4080
 
|                             CY7C185   |
4081
 
|                       DSW3            |
4082
 
|      8255             DSW2  CY7C185   |
4083
 
|                       DSW1            |
4084
 
|1                                      |
4085
 
|8                           MAJ-H_CG   |
4086
 
|W    PAL      |-------|                |
4087
 
|A             |       |     IGS_M0201  |
4088
 
|Y    PAL      |IGS011 |                |
4089
 
|              |       |          PAL   |
4090
 
|     PAL      |-------|                |
4091
 
|                         TC524256      |
4092
 
|     6264                              |
4093
 
|                         TC524256      |
4094
 
|1    6264                              |
4095
 
|0           22.0994MHz   TC524256      |
4096
 
|W    MAJ-H_V027H                       |
4097
 
|A                        TC524256      |
4098
 
|Y         BATTERY                      |
4099
 
| SPDT_SW           68000               |
4100
 
|---------------------------------------|
4101
 
Notes:
4102
 
      Uses common 10-way/18-way Mahjong pinout
4103
 
      TC524256 - Toshiba TC524256BZ-80 256k x4 Dual Port VRAM (ZIP28)
4104
 
      CY7C185  - Cypress CY7C185-20PC 8k x8 SRAM (DIP28)
4105
 
      6264     - UT6264PC-70LL 8k x8 SRAM (DIP28)
4106
 
      IGS011   - Custom IGS IC (QFP160)
4107
 
      AR17961  - == OkiM6295 (QFP44)
4108
 
 
4109
 
      ROMs -
4110
 
            MAJ-H_V027H- Main Program (27C4096)
4111
 
            IGS_M0201  - Graphics (16M maskROM)
4112
 
            IGS_M0202  - OKI samples (4M maskROM)
4113
 
            MAJ-H_CG   - Graphics (27c4001 EPROM)
4114
 
 
4115
 
***************************************************************************/
4116
 
 
4117
 
ROM_START( dbc )
4118
 
        ROM_REGION( 0x80000, "maincpu", 0 )
4119
 
        ROM_LOAD16_WORD_SWAP( "maj-h_v027h.u30", 0x00000, 0x80000, CRC(5d5ccd5b) SHA1(7a1223923f9a5825fd919ae9a36912284e705382) )
4120
 
 
4121
 
        ROM_REGION( 0x280000, "blitter", 0 )
4122
 
        ROM_LOAD( "igs_m0201.u15", 0x000000, 0x200000, CRC(ec54452c) SHA1(0ee7ffa3d4845af083944e64faf5a1c78247aaa2) )
4123
 
        ROM_LOAD( "maj-h_cg.u8",   0x200000, 0x080000, CRC(ee45cc46) SHA1(ed011f758a02026222994aaea0677a4e9580fbda) )   // 1xxxxxxxxxxxxxxxxxx = 0x00
4124
 
 
4125
 
        ROM_REGION( 0x80000, "oki", 0 )
4126
 
        ROM_LOAD( "igs_m0202.u39", 0x00000, 0x80000, CRC(106ac5f7) SHA1(5796a880c3424e3d2251b2223a0e594957afecaf) ) // 2 banks
4127
 
ROM_END
4128
 
 
4129
 
/***************************************************************************
4130
 
 
4131
 
Mahjong Ryukobou
4132
 
Alta, 1995
4133
 
 
4134
 
PCB Layout
4135
 
----------
4136
 
 
4137
 
IGS PCB NO-T0094
4138
 
|------------------------------------|
4139
 
|UPC1242  VOL  LM7805  DSW5          |
4140
 
|   MAJ-J_SP           DSW4          |
4141
 
|  TD62003     M6295   DSW3 CY7C185  |
4142
 
|        8255          DSW2 CY7C185  |
4143
 
|M                     DSW1 MAJ-J_CG |
4144
 
|A                                   |
4145
 
|H              IGS011      IGS_M0201|
4146
 
|J                               PAL |
4147
 
|O                                   |
4148
 
|N  MAJ_V030J     22MHz              |
4149
 
|G    6264              TC524256     |
4150
 
|     6264              TC524256     |
4151
 
|     PAL               TC524256     |
4152
 
|     PAL      68000P10 TC524256     |
4153
 
|     PAL                            |
4154
 
|------------------------------------|
4155
 
Notes:
4156
 
      68000 - clock 7.33333MHz [22/3]
4157
 
      M6295 - clock 1.04762MHz [22/21]
4158
 
      VSync - 60.0078Hz
4159
 
      HSync - 15.620kHz
4160
 
 
4161
 
***************************************************************************/
4162
 
 
4163
 
ROM_START( ryukobou )
4164
 
        ROM_REGION( 0x80000, "maincpu", 0 )
4165
 
        ROM_LOAD16_WORD_SWAP( "maj_v030j.u30", 0x000000, 0x80000, CRC(186f2b4e) SHA1(380a3d94722d9f5fa5ec206ed0af6dbb8dd81715) )
4166
 
 
4167
 
        ROM_REGION( 0x280000, "blitter", 0 )
4168
 
        ROM_LOAD( "igs_m0201.u15", 0x000000, 0x200000, CRC(ec54452c) SHA1(0ee7ffa3d4845af083944e64faf5a1c78247aaa2) )
4169
 
        ROM_LOAD( "maj-j_cg.u8",   0x200000, 0x080000, CRC(3c8de5d1) SHA1(51e43bfe7b5157112ded9a34b7032f73b7ffad11) )
4170
 
 
4171
 
        ROM_REGION( 0x80000, "oki", 0 )
4172
 
        ROM_LOAD( "maj-j_sp.u39", 0x000000, 0x80000, CRC(82f670f3) SHA1(d10dd67e40aee0e1c4f4b2c1217ce0935cb86406) )
4173
 
ROM_END
4174
 
 
4175
 
/***************************************************************************
4176
 
 
4177
 
Long Hu Bang II
4178
 
IGS, 1996
4179
 
 
4180
 
PCB Layout
4181
 
----------
4182
 
 
4183
 
IGS PCB NO-0115
4184
 
|---------------------------------------------|
4185
 
|                  M6295  IGSS0503.U38        |
4186
 
|  UM3567  3.57945MHz                         |
4187
 
|                          DSW3               |
4188
 
|                          DSW2     PAL       |
4189
 
| IGSM0502.U5              DSW1    6264       |
4190
 
| IGSM0501.U7     PAL              6264       |
4191
 
|                 PAL                         |
4192
 
|                 PAL            IGS011       |
4193
 
|                 PAL                         |
4194
 
|                 PAL                         |
4195
 
|                                             |
4196
 
|   MC68HC000P10          22MHz  TC524258AZ-10|
4197
 
|           6264         8255    TC524258AZ-10|
4198
 
|    BATT   6264   MAJ2V185H.U29 TC524258AZ-10|
4199
 
|                                TC524258AZ-10|
4200
 
|---------------------------------------------|
4201
 
 
4202
 
Notes:
4203
 
        68k clock: 7.3333MHz (i.e. 22/3)
4204
 
      M6295 clock: 1.0476MHz (i.e. 22/21) \
4205
 
         M6295 SS: HIGH                   / Therefore sampling freq = 7.936363636kHz (i.e. 1047600 / 132)
4206
 
           UM3567: Compatible with YM2413, clock = 3.57945MHz
4207
 
            HSync: 15.78kHz
4208
 
            VSync: 60Hz
4209
 
 
4210
 
***************************************************************************/
4211
 
 
4212
 
ROM_START( lhb2 )
4213
 
        ROM_REGION( 0x80000, "maincpu", 0 )
4214
 
        ROM_LOAD16_WORD_SWAP( "maj2v185h.u29", 0x00000, 0x80000, CRC(2572d59a) SHA1(1d5362e209dadf8b21c10d1351d4bb038bfcaaef) )
4215
 
 
4216
 
        ROM_REGION( 0x200000, "blitter", 0 )
4217
 
        ROM_LOAD( "igsm0501.u7", 0x00000, 0x200000, CRC(1c952bd6) SHA1(a6b6f1cdfb29647e81c032ffe59c94f1a10ceaf8) )
4218
 
 
4219
 
        ROM_REGION( 0x80000, "blitter_hi", 0 ) // high order bit of graphics (5th bit)
4220
 
        /* these are identical ..seems ok as igs number is same, only ic changed */
4221
 
        ROM_LOAD( "igsm0502.u4", 0x00000, 0x80000, CRC(5d73ae99) SHA1(7283aa3d6b15ceb95db80756892be46eb997ef15) )
4222
 
        ROM_LOAD( "igsm0502.u5", 0x00000, 0x80000, CRC(5d73ae99) SHA1(7283aa3d6b15ceb95db80756892be46eb997ef15) )
4223
 
 
4224
 
        ROM_REGION( 0x80000, "oki", 0 )
4225
 
        ROM_LOAD( "igss0503.u38", 0x00000, 0x80000, CRC(c9609c9c) SHA1(f036e682b792033409966e84292a69275eaa05e5) )      // 2 banks
4226
 
ROM_END
4227
 
 
4228
 
/***************************************************************************
4229
 
 
4230
 
Mahjong Nenrikishu SP
4231
 
IGS/Alta, 1998
4232
 
 
4233
 
PCB Layout
4234
 
----------
4235
 
 
4236
 
IGS PCB NO-0115-5
4237
 
|----------------------------------|
4238
 
|UPC1242H VOL M6295     SP         |
4239
 
|   U3567 LM7805                   |
4240
 
|   CG   3.579545MHz   DSW3        |
4241
 
|  M0502               DSW2   PAL  |
4242
 
|M                     DSW1  6264  |
4243
 
|A M0501                     6264  |
4244
 
|H              PAL        IGS011  |
4245
 
|J              PAL                |
4246
 
|O              PAL                |
4247
 
|N              PAL                |
4248
 
|G                                 |
4249
 
|                   22MHz M5M442256|
4250
 
|     68000P16            M5M442256|
4251
 
|RESET    6264     8255   M5M442256|
4252
 
| BATT    6264  V250J     M5M442256|
4253
 
|----------------------------------|
4254
 
Notes:
4255
 
      68000 - Clock 7.3333MHz [22/2]
4256
 
      U3567 - YM2413, clock 3.579545MHz
4257
 
      M6295 - Clock 1.0476 [22/21]. pin 7 high
4258
 
      VSync - 60.0052Hz
4259
 
      HSync - 15.620kHz
4260
 
 
4261
 
***************************************************************************/
4262
 
 
4263
 
ROM_START( nkishusp )
4264
 
        ROM_REGION( 0x80000, "maincpu", 0 )
4265
 
        ROM_LOAD16_WORD_SWAP( "v250j.u29", 0x00000, 0x80000, CRC(500cb919) SHA1(76eed80b59c43e8cc1e258056cfe08b33a651852) )
4266
 
 
4267
 
        ROM_REGION( 0x200000, "blitter", 0 )
4268
 
        ROM_LOAD( "m0501.u7", 0x00000, 0x200000, CRC(1c952bd6) SHA1(a6b6f1cdfb29647e81c032ffe59c94f1a10ceaf8) ) // Identical to igsm0501.u7
4269
 
 
4270
 
        ROM_REGION( 0x80000, "blitter_hi", 0 ) // high order bit of graphics (5th bit)
4271
 
        ROM_LOAD( "m0502.u6", 0x000000, 0x80000, CRC(5d73ae99) SHA1(7283aa3d6b15ceb95db80756892be46eb997ef15) ) // Identical to igsm0502.u4, igsm0502.u5
4272
 
        ROM_LOAD( "cg.u4",    0x000000, 0x80000, CRC(fe60f485) SHA1(d75e5f7a187161137a7f7b54d495d1cb3e1802a4) )
4273
 
 
4274
 
        ROM_REGION( 0x80000, "oki", 0 )
4275
 
        ROM_LOAD( "sp.u38", 0x00000, 0x80000, CRC(d80e28e2) SHA1(c03441686e770227db6a2a41922fbb4284710571) )
4276
 
ROM_END
4277
 
 
4278
 
/***************************************************************************
4279
 
 
4280
 
Virtua Bowling by IGS
4281
 
 
4282
 
PCB # 0101
4283
 
 
4284
 
U45  (27c240) is probably program
4285
 
next to 68000 processor
4286
 
U68,U69 probably images   (27c800 - mask)
4287
 
U67, U66 sound and ????  (27c040)
4288
 
 
4289
 
ASIC chip used
4290
 
 
4291
 
SMD - custom chip IGS 011      F5XD  174
4292
 
SMD - custom --near sound section - unknown -- i.d. rubbed off
4293
 
SMD - custom  -- near inputs and 68000  IGS012    9441EK001
4294
 
 
4295
 
XTL near sound 33.868mhz
4296
 
XTL near 68000  22.0000mhz
4297
 
 
4298
 
there are 4 banks of 8 dip switches
4299
 
 
4300
 
***************************************************************************/
4301
 
 
4302
 
ROM_START( vbowl )
4303
 
        ROM_REGION( 0x80000, "maincpu", 0 )
4304
 
        ROM_LOAD16_WORD_SWAP( "bowlingv101xcm.u45", 0x00000, 0x80000, BAD_DUMP CRC(ab8e3f1f) SHA1(69159e22559d6a26fe2afafd770aa640c192ba4b) )
4305
 
 
4306
 
        ROM_REGION( 0x400000 * 2, "blitter", 0)
4307
 
        ROM_LOAD( "vrbowlng.u69", 0x000000, 0x400000, CRC(b0d339e8) SHA1(a26a5e0202a78e8cdc562b10d64e14eadfa4e115) )
4308
 
        // extra space to expand every 4 bits to 8
4309
 
 
4310
 
        ROM_REGION( 0x100000, "blitter_hi", ROMREGION_INVERT )
4311
 
        ROM_LOAD( "vrbowlng.u68", 0x000000, 0x100000, CRC(b0ce27e7) SHA1(6d3ef97edd606f384b1e05b152fbea12714887b7) )
4312
 
 
4313
 
        ROM_REGION( 0x400000, "ics", 0 )
4314
 
        ROM_LOAD( "vrbowlng.u67", 0x00000, 0x80000, CRC(53000936) SHA1(e50c6216f559a9248c095bdfae05c3be4be79ff3) )      // 8 bit signed mono & u-law
4315
 
        ROM_LOAD( "vrbowlng.u66", 0x80000, 0x80000, CRC(f62cf8ed) SHA1(c53e47e2c619ed974ad40ee4aaa4a35147ea8311) )      // 8 bit signed mono
4316
 
        ROM_COPY( "ics", 0, 0x100000,0x100000)
4317
 
        ROM_COPY( "ics", 0, 0x200000,0x100000)
4318
 
        ROM_COPY( "ics", 0, 0x300000,0x100000)
4319
 
ROM_END
4320
 
 
4321
 
ROM_START( vbowlj )
4322
 
        ROM_REGION( 0x80000, "maincpu", 0 )
4323
 
        ROM_LOAD16_WORD_SWAP( "vrbowlng.u45", 0x00000, 0x80000, CRC(091c19c1) SHA1(5a7bfbee357122e9061b38dfe988c3853b0984b0) ) // second half all 00
4324
 
 
4325
 
        ROM_REGION( 0x400000 * 2, "blitter", 0)
4326
 
        ROM_LOAD( "vrbowlng.u69", 0x000000, 0x400000, CRC(b0d339e8) SHA1(a26a5e0202a78e8cdc562b10d64e14eadfa4e115) )
4327
 
        // extra space to expand every 4 bits to 8
4328
 
 
4329
 
        ROM_REGION( 0x100000, "blitter_hi", ROMREGION_INVERT )
4330
 
        ROM_LOAD( "vrbowlng.u68", 0x000000, 0x100000, CRC(b0ce27e7) SHA1(6d3ef97edd606f384b1e05b152fbea12714887b7) )
4331
 
 
4332
 
        ROM_REGION( 0x400000, "ics", 0 )
4333
 
        ROM_LOAD( "vrbowlng.u67", 0x00000, 0x80000, CRC(53000936) SHA1(e50c6216f559a9248c095bdfae05c3be4be79ff3) )      // 8 bit signed mono & u-law
4334
 
        ROM_LOAD( "vrbowlng.u66", 0x80000, 0x80000, CRC(f62cf8ed) SHA1(c53e47e2c619ed974ad40ee4aaa4a35147ea8311) )      // 8 bit signed mono
4335
 
        ROM_COPY( "ics", 0, 0x100000,0x100000)
4336
 
        ROM_COPY( "ics", 0, 0x200000,0x100000)
4337
 
        ROM_COPY( "ics", 0, 0x300000,0x100000)
4338
 
ROM_END
4339
 
 
4340
 
/***************************************************************************
4341
 
 
4342
 
    Xing Yen Man Guan
4343
 
 
4344
 
    Other files in the zip:
4345
 
 
4346
 
    14.484 U33-82E6.jed
4347
 
    14.484 U34-1.jed
4348
 
    14.484 U35-7068.jed
4349
 
 
4350
 
***************************************************************************/
4351
 
 
4352
 
ROM_START( xymg )
4353
 
        ROM_REGION( 0x80000, "maincpu", 0 )
4354
 
        ROM_LOAD16_WORD_SWAP( "u30-ebac.rom", 0x00000, 0x80000, CRC(7d272b6f) SHA1(15fd1be23cabdc77b747541f5cd9fed6b08be4ad) )
4355
 
 
4356
 
        ROM_REGION( 0x280000, "blitter", 0 )
4357
 
        ROM_LOAD( "m0201-ig.160", 0x000000, 0x200000, CRC(ec54452c) SHA1(0ee7ffa3d4845af083944e64faf5a1c78247aaa2) )
4358
 
        ROM_LOAD( "ygxy-u8.rom",  0x200000, 0x080000, CRC(56a2706f) SHA1(98bf4b3153eef53dd449e2538b4b7ff2cc2fe6fa) )
4359
 
 
4360
 
        ROM_REGION( 0x80000, "oki", 0 )
4361
 
        // identical to 040-c3c2.snd
4362
 
        ROM_LOAD( "m0202.snd", 0x00000, 0x80000, CRC(220949aa) SHA1(1e0dba168a0687d32aaaed42714ae24358f4a3e7) ) // 2 banks
4363
 
        ROM_CONTINUE(          0x00000, 0x80000 ) // 1ST+2ND IDENTICAL
4364
 
ROM_END
4365
 
 
4366
 
 
4367
 
/***************************************************************************
4368
 
 
4369
 
    Game Drivers
4370
 
 
4371
 
***************************************************************************/
4372
 
 
4373
 
GAME( 1997, drgnwrld,     0,        drgnwrld,        drgnwrld,  drgnwrld,     ROT0, "IGS",        "Dragon World (World, V040O)",          0 )
4374
 
GAME( 1995, drgnwrldv30,  drgnwrld, drgnwrld,        drgnwrld,  drgnwrldv30,  ROT0, "IGS",        "Dragon World (World, V030O)",          0 )
4375
 
GAME( 1995, drgnwrldv21,  drgnwrld, drgnwrld_igs012, drgnwrld,  drgnwrldv21,  ROT0, "IGS",        "Dragon World (World, V021O)",          0 )
4376
 
GAME( 1995, drgnwrldv21j, drgnwrld, drgnwrld_igs012, drgnwrldj, drgnwrldv21j, ROT0, "IGS / Alta", "Zhong Guo Long (Japan, V021J)",        0 )
4377
 
GAME( 1995, drgnwrldv20j, drgnwrld, drgnwrld_igs012, drgnwrldj, drgnwrldv20j, ROT0, "IGS / Alta", "Zhong Guo Long (Japan, V020J)",        0 )
4378
 
GAME( 1995, drgnwrldv10c, drgnwrld, drgnwrld,        drgnwrldc, drgnwrldv10c, ROT0, "IGS",        "Zhong Guo Long (China, V010C)",        0 )
4379
 
GAME( 1995, drgnwrldv11h, drgnwrld, drgnwrld,        drgnwrldc, drgnwrldv11h, ROT0, "IGS",        "Dong Fang Zhi Zhu (Hong Kong, V011H)", 0 )
4380
 
GAME( 1995, lhb,          0,        lhb,             lhb,       lhb,          ROT0, "IGS",        "Long Hu Bang (China, V035C)",          0 )
4381
 
GAME( 1995, lhbv33c,      lhb,      lhb,             lhb,       lhbv33c,      ROT0, "IGS",        "Long Hu Bang (China, V033C)",          0 )
4382
 
GAME( 1995, dbc,          lhb,      lhb,             lhb,       dbc,          ROT0, "IGS",        "Da Ban Cheng (Hong Kong, V027H)",      0 )
4383
 
GAME( 1995, ryukobou,     lhb,      lhb,             lhb,       ryukobou,     ROT0, "IGS / Alta", "Mahjong Ryukobou (Japan, V030J)",      0 )
4384
 
GAME( 1996, lhb2,         0,        lhb2,            lhb2,      lhb2,         ROT0, "IGS",        "Long Hu Bang II (Hong Kong, V185H)",   0 )
4385
 
GAME( 1996, xymg,         0,        xymg,            xymg,      xymg,         ROT0, "IGS",        "Xing Yun Man Guan (China, V651C)",     0 )
4386
 
GAME( 1996, wlcc,         xymg,     wlcc,            wlcc,      wlcc,         ROT0, "IGS",        "Wan Li Chang Cheng (China, V638C)",    0 )
4387
 
GAME( 1996, vbowl,        0,        vbowl,           vbowl,     vbowl,        ROT0, "IGS",        "Virtua Bowling (World, V101XCM)",      GAME_IMPERFECT_SOUND )
4388
 
GAME( 1996, vbowlj,       vbowl,    vbowl,           vbowlj,    vbowlj,       ROT0, "IGS / Alta", "Virtua Bowling (Japan, V100JCM)",      GAME_IMPERFECT_SOUND )
4389
 
GAME( 1998, nkishusp,     lhb2,     lhb2,            lhb2,      nkishusp,     ROT0, "IGS / Alta", "Mahjong Nenrikishu SP",                GAME_NOT_WORKING )