Previous 15994 Revisions Next

r6654 Wednesday 16th December, 2009 at 08:27:08 UTC by Firewave
Removed obsolete files
[src/mame/audio]fghtbskt.c irem.h timeplt.h
[src/mame/drivers]findout.c getrivia.c igs_blit.c igs_m68.c segae.h tarzan.c
[src/mame/includes]m52.h m57.h m58.h m62.h pooyan.h rocnrope.h tutankhm.h
[src/mame/machine]jackal.c konamigx.h
[src/mame/video]boxer.c destroyr.c diverboy.c dotrikun.c flyball.c

src/mame/audio/fghtbskt.c
r6653r6654
1/*
2
3Fighting Basketball PCM unsigned 8 bit mono samples
4
5*/
6
7#include "driver.h"
8#include "sound/samples.h"
9
10static INT16 *samplebuf;
11
12WRITE8_HANDLER( fghtbskt_samples_w )
13{
14   if( data & 1 )
15   {
16      const device_config *samples = devtag_get_device(space->machine, "samples");
17      sample_start_raw(samples, 0, samplebuf + ((data & 0xf0) << 8), 0x2000, 8000, 0);
18   }
19}
20
21SAMPLES_START( fghtbskt_sh_start )
22{
23   running_machine *machine = device->machine;
24   int i, len = memory_region_length(machine, "samples");
25   UINT8 *ROM = memory_region(machine, "samples");
26
27   samplebuf = auto_alloc_array(machine, INT16, len);
28
29   for(i=0;i<len;i++)
30      samplebuf[i] = ((INT8)(ROM[i] ^ 0x80)) * 256;
31}
src/mame/audio/timeplt.h
r6653r6654
1WRITE8_HANDLER( timeplt_sh_irqtrigger_w );
2
3MACHINE_DRIVER_EXTERN( timeplt_sound );
4MACHINE_DRIVER_EXTERN( locomotn_sound );
src/mame/audio/irem.h
r6653r6654
1/***************************************************************************
2
3    Irem audio interface
4
5****************************************************************************/
6
7MACHINE_DRIVER_EXTERN( m52_sound_c_audio );
8MACHINE_DRIVER_EXTERN( m52_large_audio );
9MACHINE_DRIVER_EXTERN( m62_audio );
10
11WRITE8_HANDLER( irem_sound_cmd_w );
src/mame/machine/konamigx.h
r6653r6654
1#ifndef __MACH_KONAMIGX_H
2#define __MACH_KONAMIGX_H
3
4// 2nd-Tier GX/MW Hardware Functions
5void K053247GP_set_SpriteOffset(int offsx, int offsy);
6
7void K053936GP_set_offset(int chip, int xoffs, int yoffs);
8void K053936GP_clip_enable(int chip, int status);
9void K053936GP_set_cliprect(int chip, int minx, int maxx, int miny, int maxy);
10void K053936GP_0_zoom_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, tilemap *tmap, int tilebpp, int blend, int alpha);
11void K053936GP_1_zoom_draw(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, tilemap *tmap, int tilebpp, int blend, int alpha);
12
13
14
15// 1st-Tier GX/MW Variables and Functions
16extern UINT8  konamigx_wrport1_0, konamigx_wrport1_1;
17extern UINT16 konamigx_wrport2;
18
19
20// Tile and Sprite Mixcode Decoders
21int K055555GX_decode_vmixcolor(int layer, int *color);
22int K055555GX_decode_osmixcolor(int layer, int *color);
23
24
25// Sprite Callbacks
26
27/* callbacks should return color codes in this format:
28    fedcba9876543210fedcba9876543210
29    ----------------xxxxxxxxxxxxxxxx (bit 00-15: color)
30    --------------xx---------------- (bit 16-17: blend code)
31    ------------xx------------------ (bit 18-19: brightness code)
32    -x------------------------------ (bit 30   : skip shadow)
33    x------------------------------- (bit 31   : full shadow)
34*/
35#define K055555_COLORMASK   0x0000ffff
36#define K055555_MIXSHIFT    16
37#define K055555_BRTSHIFT    18
38#define K055555_SKIPSHADOW   0x40000000
39#define K055555_FULLSHADOW   0x80000000
40
41void konamigx_type2_sprite_callback(int *code, int *color, int *priority);
42
43void konamigx_dragoonj_sprite_callback(int *code, int *color, int *priority);
44void konamigx_salmndr2_sprite_callback(int *code, int *color, int *priority);
45void konamigx_le2_sprite_callback(int *code, int *color, int *priority);
46
47
48// Centralized Sprites and Layer Blitter
49
50/* Mixer Flags
51    fedcba9876543210fedcba9876543210
52    --------------------FFEEDDCCBBAA (layer A-F blend modes)
53    ----------------DCBA------------ (layer A-D line/row scroll disables)
54    ----FFEEDDCCBBAA---------------- (layer A-F mix codes in forced blending)
55    ---x---------------------------- (disable shadows)
56    --x----------------------------- (disable z-buffering)
57*/
58#define GXMIX_BLEND_AUTO   0         // emulate all blend effects
59#define GXMIX_BLEND_NONE   1         // disable all blend effects
60#define GXMIX_BLEND_FAST   2         // simulate translucency
61#define GXMIX_BLEND_FORCE   3         // force mix code on selected layer(s)
62#define GXMIX_NOLINESCROLL   0x1000      // disable linescroll on selected layer(s)
63#define GXMIX_NOSHADOW      0x10000000   // disable all shadows (shadow pens will be skipped)
64#define GXMIX_NOZBUF      0x20000000   // disable z-buffering (shadow pens will be drawn as solid)
65
66// Sub Layer Flags
67#define GXSUB_K053250   0x10   // chip type: 0=K053936 ROZ+, 1=K053250 LVC
68#define GXSUB_4BPP       0x04   //  16 colors
69#define GXSUB_5BPP       0x05   //  32 colors
70#define GXSUB_8BPP       0x08   // 256 colors
71
72void konamigx_mixer(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect,
73               tilemap *sub1, int sub1flags,
74               tilemap *sub2, int sub2flags,
75               int mixerflags);
76
77void konamigx_mixer_init(running_machine *machine, int objdma);
78void konamigx_mixer_primode(int mode);
79
80
81void konamigx_objdma(void);
82
83
84// K055550/K053990/ESC protection devices handlers
85READ16_HANDLER ( K055550_word_r );
86WRITE16_HANDLER( K055550_word_w );
87WRITE16_HANDLER( K053990_martchmp_word_w );
88void konamigx_esc_alert(UINT32 *srcbase, int srcoffs, int count, int mode);
89
90void fantjour_dma_install(running_machine *machine);
91WRITE32_HANDLER(fantjour_dma_w);
92
93#endif
src/mame/machine/jackal.c
r6653r6654
1/***************************************************************************
2
3  machine.c
4
5  Written by Kenneth Lin (kenneth_lin@ai.vancouver.bc.ca)
6
7  Functions to emulate general aspects of the machine (RAM, ROM, interrupts,
8  I/O ports)
9
10***************************************************************************/
11
12#include "driver.h"
13#include "cpu/m6809/m6809.h"
14#include "includes/jackal.h"
15
16static UINT8 *jackal_rambank = 0;
17static UINT8 *jackal_spritebank = 0;
18
19
20MACHINE_RESET( jackal )
21{
22   UINT8 *rgn = memory_region(machine, "master");
23
24   // HACK: running at the nominal clock rate, music stops working
25   // at the beginning of the game. This fixes it.
26   cpu_set_clockscale(cputag_get_cpu(machine, "slave"), 1.2f);
27
28   memory_set_bankptr(machine, 1,&rgn[0x4000]);
29    jackal_rambank = rgn;
30   jackal_spritebank = rgn;
31}
32
33
34
35READ8_HANDLER( jackal_zram_r )
36{
37   return jackal_rambank[0x0020+offset];
38}
39
40
41READ8_HANDLER( jackal_voram_r )
42{
43   return jackal_rambank[0x2000+offset];
44}
45
46
47READ8_HANDLER( jackal_spriteram_r )
48{
49   return jackal_spritebank[0x3000+offset];
50}
51
52
53WRITE8_HANDLER( jackal_rambank_w )
54{
55   UINT8 *rgn = memory_region(space->machine, "master");
56
57   if (data & 0x04) popmessage("jackal_rambank_w %02x",data);
58   coin_counter_w(space->machine, 0,data & 0x01);
59   coin_counter_w(space->machine, 1,data & 0x02);
60   jackal_spritebank = &rgn[((data & 0x08) << 13)];
61   jackal_rambank = &rgn[((data & 0x10) << 12)];
62   memory_set_bankptr(space->machine, 1,&rgn[((data & 0x20) << 11) + 0x4000]);
63}
64
65
66WRITE8_HANDLER( jackal_zram_w )
67{
68   jackal_rambank[0x0020+offset] = data;
69}
70
71
72WRITE8_HANDLER( jackal_voram_w )
73{
74   if ((offset & 0xF800) == 0)
75   {
76      jackal_mark_tile_dirty(offset & 0x3ff);
77   }
78   jackal_rambank[0x2000+offset] = data;
79}
80
81
82WRITE8_HANDLER( jackal_spriteram_w )
83{
84   jackal_spritebank[0x3000+offset] = data;
85}
src/mame/includes/tutankhm.h
r6653r6654
1/***************************************************************************
2
3    Tutankham
4
5***************************************************************************/
6
7/*----------- defined in video/tutankhm.c -----------*/
8
9extern UINT8 *tutankhm_scroll;
10
11WRITE8_HANDLER( tutankhm_flip_screen_x_w );
12WRITE8_HANDLER( tutankhm_flip_screen_y_w );
13
14VIDEO_START( tutankhm );
15VIDEO_UPDATE( tutankhm );
16
17WRITE8_HANDLER( junofrst_blitter_w );
src/mame/includes/m52.h
r6653r6654
1/*************************************************************************
2
3    Irem M52 hardware
4
5*************************************************************************/
6
7/*----------- defined in video/m52.c -----------*/
8
9READ8_HANDLER( m52_protection_r );
10WRITE8_HANDLER( m52_scroll_w );
11WRITE8_HANDLER( m52_bg1xpos_w );
12WRITE8_HANDLER( m52_bg1ypos_w );
13WRITE8_HANDLER( m52_bg2xpos_w );
14WRITE8_HANDLER( m52_bg2ypos_w );
15WRITE8_HANDLER( m52_bgcontrol_w );
16WRITE8_HANDLER( m52_flipscreen_w );
17WRITE8_HANDLER( alpha1v_flipscreen_w );
18WRITE8_HANDLER( m52_videoram_w );
19WRITE8_HANDLER( m52_colorram_w );
20
21PALETTE_INIT( m52 );
22VIDEO_START( m52 );
23VIDEO_UPDATE( m52 );
24
25
src/mame/includes/rocnrope.h
r6653r6654
1
2
3typedef struct _rocnrope_state rocnrope_state;
4struct _rocnrope_state
5{
6   /* memory pointers */
7   UINT8 *    videoram;
8   UINT8 *    colorram;
9   UINT8 *    spriteram;
10   UINT8 *    spriteram2;
11   size_t     spriteram_size;
12
13   /* video-related */
14   tilemap    *bg_tilemap;
15};
16
17
18/*----------- defined in video/rocnrope.c -----------*/
19
20WRITE8_HANDLER( rocnrope_videoram_w );
21WRITE8_HANDLER( rocnrope_colorram_w );
22WRITE8_HANDLER( rocnrope_flipscreen_w );
23
24PALETTE_INIT( rocnrope );
25VIDEO_START( rocnrope );
26VIDEO_UPDATE( rocnrope );
src/mame/includes/m62.h
r6653r6654
1/*************************************************************************
2
3    Irem M62 hardware
4
5*************************************************************************/
6
7/*----------- defined in video/m62.c -----------*/
8
9PALETTE_INIT( m62 );
10PALETTE_INIT( lotlot );
11PALETTE_INIT( battroad );
12PALETTE_INIT( spelunk2 );
13
14WRITE8_HANDLER( m62_tileram_w );
15WRITE8_HANDLER( m62_textram_w );
16WRITE8_HANDLER( m62_flipscreen_w );
17WRITE8_HANDLER( m62_hscroll_low_w );
18WRITE8_HANDLER( m62_hscroll_high_w );
19WRITE8_HANDLER( m62_vscroll_low_w );
20WRITE8_HANDLER( m62_vscroll_high_w );
21WRITE8_HANDLER( ldrun3_topbottom_mask_w );
22extern UINT8 *m62_tileram;
23extern UINT8 *m62_textram;
24
25VIDEO_START( kungfum );
26VIDEO_UPDATE( kungfum );
27WRITE8_HANDLER( kungfum_tileram_w );
28
29VIDEO_START( ldrun );
30VIDEO_UPDATE( ldrun );
31
32VIDEO_START( ldrun2 );
33
34VIDEO_UPDATE( ldrun3 );
35
36VIDEO_START( battroad );
37VIDEO_UPDATE( battroad );
38
39VIDEO_START( ldrun4 );
40VIDEO_UPDATE( ldrun4 );
41
42VIDEO_START( lotlot );
43VIDEO_UPDATE( lotlot );
44
45WRITE8_HANDLER( kidniki_text_vscroll_low_w );
46WRITE8_HANDLER( kidniki_text_vscroll_high_w );
47WRITE8_HANDLER( kidniki_background_bank_w );
48VIDEO_START( kidniki );
49VIDEO_UPDATE( kidniki );
50
51WRITE8_HANDLER( spelunkr_palbank_w );
52VIDEO_START( spelunkr );
53VIDEO_UPDATE( spelunkr );
54
55WRITE8_HANDLER( spelunk2_gfxport_w );
56VIDEO_START( spelunk2 );
57VIDEO_UPDATE( spelunk2 );
58
59VIDEO_START( youjyudn );
60VIDEO_UPDATE( youjyudn );
61
62VIDEO_START( horizon );
63VIDEO_UPDATE( horizon );
64WRITE8_HANDLER( horizon_scrollram_w );
65extern UINT8 *horizon_scrollram;
src/mame/includes/m57.h
r6653r6654
1/*************************************************************************
2
3    Irem M57 hardware
4
5*************************************************************************/
6
7/*----------- defined in video/m57.c -----------*/
8
9extern UINT8 *m57_scroll;
10
11WRITE8_HANDLER( m57_videoram_w );
12WRITE8_HANDLER( m57_flipscreen_w );
13
14PALETTE_INIT( m57 );
15VIDEO_START( m57 );
16VIDEO_UPDATE( m57 );
17
src/mame/includes/m58.h
r6653r6654
1/*************************************************************************
2
3    Irem M58 hardware
4
5*************************************************************************/
6
7/*----------- defined in video/m58.c -----------*/
8
9extern UINT8 *yard_scroll_x_low;
10extern UINT8 *yard_scroll_x_high;
11extern UINT8 *yard_scroll_y_low;
12extern UINT8 *yard_score_panel_disabled;
13
14WRITE8_HANDLER( yard_videoram_w );
15WRITE8_HANDLER( yard_scroll_panel_w );
16WRITE8_HANDLER( yard_flipscreen_w );
17
18PALETTE_INIT( yard );
19VIDEO_START( yard );
20VIDEO_UPDATE( yard );
src/mame/includes/pooyan.h
r6653r6654
1/***************************************************************************
2
3    Pooyan
4
5***************************************************************************/
6
7/*----------- defined in video/pooyan.c -----------*/
8
9WRITE8_HANDLER( pooyan_videoram_w );
10WRITE8_HANDLER( pooyan_colorram_w );
11WRITE8_HANDLER( pooyan_flipscreen_w );
12
13PALETTE_INIT( pooyan );
14VIDEO_START( pooyan );
15VIDEO_UPDATE( pooyan );
src/mame/video/boxer.c
r6653r6654
1/***************************************************************************
2
3Atari Boxer (prototype) video emulation
4
5***************************************************************************/
6
7#include "driver.h"
8
9UINT8* boxer_tile_ram;
10UINT8* boxer_sprite_ram;
11
12
13static void draw_boxer(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect)
14{
15   int n;
16
17   for (n = 0; n < 2; n++)
18   {
19      const UINT8* p = memory_region(machine, n == 0 ? "user1" : "user2");
20
21      int i;
22      int j;
23
24      int x = 196 - boxer_sprite_ram[0 + 2 * n];
25      int y = 192 - boxer_sprite_ram[1 + 2 * n];
26
27      int l = boxer_sprite_ram[4 + 2 * n] & 15;
28      int r = boxer_sprite_ram[5 + 2 * n] & 15;
29
30      for (i = 0; i < 8; i++)
31      {
32         for (j = 0; j < 4; j++)
33         {
34            UINT8 code;
35
36            code = p[32 * l + 4 * i + j];
37
38            drawgfx_transpen(bitmap, cliprect,
39               machine->gfx[n],
40               code,
41               0,
42               code & 0x80, 0,
43               x + 8 * j,
44               y + 8 * i, 1);
45
46            code = p[32 * r + 4 * i - j + 3];
47
48            drawgfx_transpen(bitmap, cliprect,
49               machine->gfx[n],
50               code,
51               0,
52               !(code & 0x80), 0,
53               x + 8 * j + 32,
54               y + 8 * i, 1);
55         }
56      }
57   }
58}
59
60
61VIDEO_UPDATE( boxer )
62{
63   int i;
64   int j;
65
66   bitmap_fill(bitmap, cliprect, 1);
67
68   for (i = 0; i < 16; i++)
69   {
70      for (j = 0; j < 32; j++)
71      {
72         UINT8 code = boxer_tile_ram[32 * i + j];
73
74         drawgfx_transpen(bitmap, cliprect,
75            screen->machine->gfx[2],
76            code,
77            0,
78            code & 0x40, code & 0x40,
79            8 * j + 4,
80            8 * (i % 2) + 32 * (i / 2), 0);
81      }
82   }
83
84   draw_boxer(screen->machine, bitmap, cliprect);
85   return 0;
86}
src/mame/video/flyball.c
r6653r6654
1/***************************************************************************
2
3Atari Flyball video emulation
4
5***************************************************************************/
6
7#include "driver.h"
8
9static tilemap* flyball_tilemap;
10
11UINT8 flyball_pitcher_vert;
12UINT8 flyball_pitcher_horz;
13UINT8 flyball_pitcher_pic;
14UINT8 flyball_ball_vert;
15UINT8 flyball_ball_horz;
16
17UINT8* flyball_playfield_ram;
18
19
20static TILEMAP_MAPPER( flyball_get_memory_offset )
21{
22   if (col == 0)
23   {
24      col = num_cols;
25   }
26
27   return num_cols * (num_rows - row) - col;
28}
29
30
31static TILE_GET_INFO( flyball_get_tile_info )
32{
33   UINT8 data = flyball_playfield_ram[tile_index];
34
35   int flags =
36      ((data & 0x40) ? TILE_FLIPX : 0) |
37      ((data & 0x80) ? TILE_FLIPY : 0);
38
39   int code = data & 63;
40
41   if ((flags & TILE_FLIPX) && (flags & TILE_FLIPY))
42   {
43      code += 64;
44   }
45
46   SET_TILE_INFO(0, code, 0, flags);
47}
48
49
50VIDEO_START( flyball )
51{
52   flyball_tilemap = tilemap_create(machine, flyball_get_tile_info,
53      flyball_get_memory_offset,  8, 16, 32, 16);
54}
55
56
57VIDEO_UPDATE( flyball )
58{
59   int pitcherx = flyball_pitcher_horz;
60   int pitchery = flyball_pitcher_vert - 31;
61
62   int ballx = flyball_ball_horz - 1;
63   int bally = flyball_ball_vert - 17;
64
65   int x;
66   int y;
67
68   tilemap_mark_all_tiles_dirty(flyball_tilemap);
69
70   /* draw playfield */
71
72   tilemap_draw(bitmap, cliprect, flyball_tilemap, 0, 0);
73
74   /* draw pitcher */
75
76   drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[1], flyball_pitcher_pic ^ 0xf,
77      0, 1, 0, pitcherx, pitchery, 1);
78
79   /* draw ball */
80
81   for (y = bally; y < bally + 2; y++)
82      for (x = ballx; x < ballx + 2; x++)
83         if (x >= cliprect->min_x &&
84             x <= cliprect->max_x &&
85             y >= cliprect->min_y &&
86             y <= cliprect->max_y)
87            *BITMAP_ADDR16(bitmap, y, x) = 1;
88   return 0;
89}
src/mame/video/diverboy.c
r6653r6654
1/* Diver Boy - Video Hardware */
2
3#include "driver.h"
4
5UINT16 *diverboy_spriteram;
6size_t diverboy_spriteram_size;
7
8
9VIDEO_START(diverboy)
10{
11}
12
13static void draw_sprites(running_machine* machine, bitmap_t *bitmap, const rectangle *cliprect )
14{
15   UINT16 *source = diverboy_spriteram;
16   UINT16 *finish = source + (diverboy_spriteram_size/2);
17
18   while (source < finish)
19   {
20      INT16 xpos,ypos,number,colr,bank,flash;
21
22      ypos = source[4];
23      xpos = source[0];
24      colr = (source[1]& 0x00f0) >> 4;
25      number = source[3];
26      flash = source[1] & 0x1000;
27
28      colr |= ((source[1] & 0x000c) << 2);
29
30      ypos = 0x100 - ypos;
31
32      bank = (source[1]&0x0002) >> 1;
33
34      if (!flash || (video_screen_get_frame_number(machine->primary_screen) & 1))
35      {
36         drawgfx_transpen(bitmap,cliprect,machine->gfx[bank],
37               number,
38               colr,
39               0,0,
40               xpos,ypos,
41               (source[1] & 0x0008) ? -1 : 0);
42      }
43
44      source+=8;
45   }
46}
47
48VIDEO_UPDATE(diverboy)
49{
50//  bitmap_fill(bitmap,cliprect,get_black_pen(screen->machine));
51   draw_sprites(screen->machine,bitmap,cliprect);
52   return 0;
53}
src/mame/video/dotrikun.c
r6653r6654
1/***************************************************************************
2
3Dottori Kun (Head On's mini game)
4(c)1990 SEGA
5
6Driver by Takahiro Nogi (nogi@kt.rim.or.jp) 1999/12/15 -
7
8***************************************************************************/
9
10#include "driver.h"
11
12
13
14static UINT8 color;
15
16
17WRITE8_HANDLER( dotrikun_color_w )
18{
19   video_screen_update_partial(space->machine->primary_screen, video_screen_get_vpos(space->machine->primary_screen));
20   color = data;
21}
22
23
24VIDEO_START( dotrikun )
25{
26   state_save_register_global(machine, color);
27}
28
29VIDEO_UPDATE( dotrikun )
30{
31   int offs;
32
33   pen_t back_pen = MAKE_RGB(pal1bit(color >> 3), pal1bit(color >> 4), pal1bit(color >> 5));
34   pen_t fore_pen = MAKE_RGB(pal1bit(color >> 0), pal1bit(color >> 1), pal1bit(color >> 2));
35
36   for (offs = 0; offs < videoram_size; offs++)
37   {
38      int i;
39      UINT8 data = videoram[offs];
40
41      UINT8 x = offs << 4;
42      UINT8 y = offs >> 4 << 1;
43
44      for (i = 0; i < 8; i++)
45      {
46         pen_t pen = (data & 0x80) ? fore_pen : back_pen;
47
48         /* I think the video hardware doubles pixels, screen would be too small otherwise */
49         *BITMAP_ADDR32(bitmap, y + 0, x + 0) = pen;
50         *BITMAP_ADDR32(bitmap, y + 0, x + 1) = pen;
51         *BITMAP_ADDR32(bitmap, y + 1, x + 0) = pen;
52         *BITMAP_ADDR32(bitmap, y + 1, x + 1) = pen;
53
54         x = x + 2;
55         data = data << 1;
56      }
57   }
58
59   return 0;
60}
src/mame/video/destroyr.c
r6653r6654
1/***************************************************************************
2
3Atari Destroyer video emulation
4
5***************************************************************************/
6
7#include "driver.h"
8
9int destroyr_wavemod;
10int destroyr_cursor;
11
12UINT8* destroyr_major_obj_ram;
13UINT8* destroyr_minor_obj_ram;
14UINT8* destroyr_alpha_num_ram;
15
16
17VIDEO_UPDATE( destroyr )
18{
19   int i;
20   int j;
21
22   bitmap_fill(bitmap, cliprect, 0);
23
24   /* draw major objects */
25
26   for (i = 0; i < 16; i++)
27   {
28      int attr = destroyr_major_obj_ram[2 * i + 0] ^ 0xff;
29      int horz = destroyr_major_obj_ram[2 * i + 1];
30
31      int num = attr & 3;
32      int scan = attr & 4;
33      int flipx = attr & 8;
34
35      if (scan == 0)
36      {
37         if (horz >= 192)
38            horz -= 256;
39      }
40      else
41      {
42         if (horz < 192)
43            continue;
44      }
45
46      drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[2], num, 0, flipx, 0,
47         horz, 16 * i, 0);
48   }
49
50   /* draw alpha numerics */
51
52   for (i = 0; i < 8; i++)
53   {
54      for (j = 0; j < 32; j++)
55      {
56         int num = destroyr_alpha_num_ram[32 * i + j];
57
58         drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[0], num, 0, 0, 0,
59            8 * j, 8 * i, 0);
60      }
61   }
62
63   /* draw minor objects */
64
65   for (i = 0; i < 2; i++)
66   {
67      int horz = 256 - destroyr_minor_obj_ram[i + 2];
68      int vert = 256 - destroyr_minor_obj_ram[i + 4];
69
70      drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[1], destroyr_minor_obj_ram[i + 0], 0, 0, 0,
71         horz, vert, 0);
72   }
73
74   /* draw waves */
75
76   for (i = 0; i < 4; i++)
77   {
78      drawgfx_transpen(bitmap, cliprect, screen->machine->gfx[3], destroyr_wavemod ? 1 : 0, 0, 0, 0,
79         64 * i, 0x4e, 0);
80   }
81
82   /* draw cursor */
83
84   for (i = 0; i < 256; i++)
85   {
86      if (i & 4)
87         *BITMAP_ADDR16(bitmap, destroyr_cursor ^ 0xff, i) = 7;
88   }
89   return 0;
90}
src/mame/drivers/getrivia.c
r6653r6654
1/*
2
3Trivia By Greyhound Electronics
4
5  driver by Pierpaolo Prazzoli and graphic fixes by Tomasz Slanina
6  based on Find Out driver
7
8ROM BOARD (2764 ROMs)
9
10FILE            CS
11TRIVB1.BIN      D900
12TRIVB2.BIN      4600
13
14ROM BOARD (27128 ROMs)
15
16FILE            CS
17SPRT1_9.BIN     8600
18GENERAL5.BIN    A900
19ENTR2_9.BIN     B300
20COMC2_9.BIN     2800
21HCKY5_9.BIN     3700
22
23ROM board has a part # UVM10B  1984
24Main board has a part # UV-1B Rev 5 1982-83-84
25
26Processor: Z80
27Support Chips:(2) 8255s
28RAM: 6117on ROM board and (24) MCM4517s on main board
29
30Trivia games "No Coins" mode: if DSW "No Coins" is on, coin inputs are
31replaced by a 6th button to start games. This is a feature of the PCB for private use.
32
33Selection/Poker payout button: if pressed, all coins/credits are gone and added to the
34payout bookkeeping, shown in the service mode under the coin in total. Last Winner shows
35the last payout. Payout hardware is unknown.
36
37Video Trivia sets (as stated from Greyhound Electronics, Inc. manual):
38
39Series 1: (128K)           Series 2: (128K)           Series 3: (128K)
40----------------           ----------------           ----------------
41Science                    T.V. Mash                  Beatlemania
42General I                  General II                 General III
43Sports I                   Sports II                  Sports III
44Music                      Comics                     Country-Western
45Movies-T.V.                Entertainment              T.V. Soaps
46
47
48Series 4: (128K)           Series 5: (128K)           Series 6: (128K)
49----------------           ----------------           ----------------
50History-Geography          The States                 Science II
51Star Trek                  James Bond                 General IV
52Baseball                   Hockey                     Commercials-Ads
53Hollywood                  Elvismania                 Honeymooners
54Television I               The Wild West              Television II
55
56
57Series 7: (128K)           Series 8: (256K)           * Starting with Series 8
58----------------           ----------------           "Announcement":
59T.V. Dallas                Science                    3 Times as many
60General V                  General                    questions in this
61Kids Korner                Sports                     series!
62Good Guys                  T.V./Entertainment
63Biblical                   Adult Sex
64                            or alt: Potpourri
65
66
67Series 9: (256K)           Series 10: (256K)          Series 11: (256K)
68----------------           -----------------          -----------------
69Facts                      New Science                Rich and Famous
70Rock-N-Roll                New General                Fast Women and Cars
71Television                 New T.V. Mash              Aerospace
72Artists-Athletes           New Entertainment          TV/Music Alternative
73U.S.A. Trivia              New Sports                 General Facts
74 or alt: Adult Sex 2        or alt: Adult Sex 3        or alt: Gay Times
75
76
77NOTE: Series 8 and above are version 1.03a (currently in findout.c)
78
79*/
80
81#include "driver.h"
82#include "cpu/z80/z80.h"
83#include "machine/8255ppi.h"
84#include "machine/ticket.h"
85#include "sound/dac.h"
86
87static UINT8 *drawctrl;
88
89static WRITE8_HANDLER( getrivia_bitmap_w )
90{
91   int sx,sy;
92   int fg,bg,mask,bits;
93   static int prevoffset, yadd;
94
95   videoram[offset] = data;
96
97   yadd = (offset==prevoffset) ? (yadd+1):0;
98   prevoffset = offset;
99
100   fg = drawctrl[0] & 7;
101   bg = 2;
102   mask = 0xff;//drawctrl[2];
103   bits = drawctrl[1];
104
105   sx = 8 * (offset % 64);
106   sy = offset / 64;
107   sy = (sy + yadd) & 0xff;
108
109
110//if (mask != bits)
111//  popmessage("color %02x bits %02x mask %02x\n",fg,bits,mask);
112
113   if (mask & 0x80) *BITMAP_ADDR16(tmpbitmap, sy, sx+0) = (bits & 0x80) ? fg : bg;
114   if (mask & 0x40) *BITMAP_ADDR16(tmpbitmap, sy, sx+1) = (bits & 0x40) ? fg : bg;
115   if (mask & 0x20) *BITMAP_ADDR16(tmpbitmap, sy, sx+2) = (bits & 0x20) ? fg : bg;
116   if (mask & 0x10) *BITMAP_ADDR16(tmpbitmap, sy, sx+3) = (bits & 0x10) ? fg : bg;
117   if (mask & 0x08) *BITMAP_ADDR16(tmpbitmap, sy, sx+4) = (bits & 0x08) ? fg : bg;
118   if (mask & 0x04) *BITMAP_ADDR16(tmpbitmap, sy, sx+5) = (bits & 0x04) ? fg : bg;
119   if (mask & 0x02) *BITMAP_ADDR16(tmpbitmap, sy, sx+6) = (bits & 0x02) ? fg : bg;
120   if (mask & 0x01) *BITMAP_ADDR16(tmpbitmap, sy, sx+7) = (bits & 0x01) ? fg : bg;
121}
122
123static WRITE8_DEVICE_HANDLER( lamps_w )
124{
125   /* 5 button lamps */
126   set_led_status(0,data & 0x01);
127   set_led_status(1,data & 0x02);
128   set_led_status(2,data & 0x04);
129   set_led_status(3,data & 0x08);
130   set_led_status(4,data & 0x10);
131
132   /* 3 button lamps for deal, cancel, stand in poker games;
133    lamp order verified in poker and selection self tests */
134   set_led_status(7,data & 0x20);
135   set_led_status(5,data & 0x40);
136   set_led_status(6,data & 0x80);
137}
138
139static WRITE8_DEVICE_HANDLER( sound_w )
140{
141   const address_space *space = cputag_get_address_space(device->machine, "cpu", ADDRESS_SPACE_PROGRAM);
142
143   /* bit 3 - coin lockout, lamp10 in poker / lamp6 in trivia test modes */
144   coin_lockout_global_w(~data & 0x08);
145   set_led_status(9,data & 0x08);
146
147   /* bit 5 - ticket out in trivia games */
148   ticket_dispenser_w(space, 0, (data & 0x20)<< 2);
149
150   /* bit 6 enables NMI */
151   interrupt_enable_w(space, 0, data & 0x40);
152
153   /* bit 7 goes directly to the sound amplifier */
154   dac_data_w(devtag_get_device(device->machine, "dac"), ((data & 0x80) >> 7) * 255);
155}
156
157static WRITE8_DEVICE_HANDLER( sound2_w )
158{
159   /* bit 3,6 - coin lockout, lamp10+11 in selection test mode */
160   coin_lockout_w(0, ~data & 0x08);
161   coin_lockout_w(1, ~data & 0x40);
162   set_led_status(9,data & 0x08);
163   set_led_status(10,data & 0x40);
164
165   /* bit 4,5 - lamps 12, 13 in selection test mode;
166    12 lights up if dsw maximum bet = 30 an bet > 15 or if dsw maximum bet = 10 an bet = 10 */
167   set_led_status(11,data & 0x10);
168   set_led_status(12,data & 0x20);
169
170   /* bit 7 goes directly to the sound amplifier */
171   dac_data_w(devtag_get_device(device->machine, "dac"), ((data & 0x80) >> 7) * 255);
172}
173
174static WRITE8_DEVICE_HANDLER( lamps2_w )
175{
176   /* bit 4 - play/raise button lamp, lamp 9 in poker test mode  */
177   set_led_status(8,data & 0x10);
178}
179
180static WRITE8_DEVICE_HANDLER( nmi_w )
181{
182   const address_space *space = cputag_get_address_space(device->machine, "cpu", ADDRESS_SPACE_PROGRAM);
183
184   /* bit 4 - play/raise button lamp, lamp 9 in selection test mode  */
185   set_led_status(8,data & 0x10);
186
187   /* bit 6 enables NMI */
188   interrupt_enable_w(space, 0, data & 0x40);
189}
190
191static WRITE8_HANDLER( banksel_1_1_w )
192{
193   memory_set_bankptr(space->machine, 1,memory_region(space->machine, "cpu") + 0x10000);
194}
195static WRITE8_HANDLER( banksel_2_1_w )
196{
197   memory_set_bankptr(space->machine, 1,memory_region(space->machine, "cpu") + 0x14000);
198}
199static WRITE8_HANDLER( banksel_3_1_w )
200{
201   memory_set_bankptr(space->machine, 1,memory_region(space->machine, "cpu") + 0x18000);
202}
203static WRITE8_HANDLER( banksel_4_1_w )
204{
205   memory_set_bankptr(space->machine, 1,memory_region(space->machine, "cpu") + 0x1c000);
206}
207static WRITE8_HANDLER( banksel_5_1_w )
208{
209   memory_set_bankptr(space->machine, 1,memory_region(space->machine, "cpu") + 0x20000);
210}
211static WRITE8_HANDLER( banksel_1_2_w )
212{
213   memory_set_bankptr(space->machine, 1,memory_region(space->machine, "cpu") + 0x12000);
214}
215static WRITE8_HANDLER( banksel_2_2_w )
216{
217   memory_set_bankptr(space->machine, 1,memory_region(space->machine, "cpu") + 0x16000);
218}
219static WRITE8_HANDLER( banksel_3_2_w )
220{
221   memory_set_bankptr(space->machine, 1,memory_region(space->machine, "cpu") + 0x1a000);
222}
223static WRITE8_HANDLER( banksel_4_2_w )
224{
225   memory_set_bankptr(space->machine, 1,memory_region(space->machine, "cpu") + 0x1e000);
226}
227static WRITE8_HANDLER( banksel_5_2_w )
228{
229   memory_set_bankptr(space->machine, 1,memory_region(space->machine, "cpu") + 0x22000);
230}
231
232static ADDRESS_MAP_START( getrivia_map, ADDRESS_SPACE_PROGRAM, 8 )
233   AM_RANGE(0x0000, 0x1fff) AM_ROM
234   AM_RANGE(0x2000, 0x3fff) AM_ROMBANK(1)
235   AM_RANGE(0x4000, 0x47ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
236   AM_RANGE(0x4800, 0x4803) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w)
237   AM_RANGE(0x5000, 0x5003) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)
238   AM_RANGE(0x600f, 0x600f) AM_WRITE(banksel_5_1_w)
239   AM_RANGE(0x6017, 0x6017) AM_WRITE(banksel_4_1_w)
240   AM_RANGE(0x601b, 0x601b) AM_WRITE(banksel_3_1_w)
241   AM_RANGE(0x601d, 0x601d) AM_WRITE(banksel_2_1_w)
242   AM_RANGE(0x601e, 0x601e) AM_WRITE(banksel_1_1_w)
243   AM_RANGE(0x608f, 0x608f) AM_WRITE(banksel_5_2_w)
244   AM_RANGE(0x6097, 0x6097) AM_WRITE(banksel_4_2_w)
245   AM_RANGE(0x609b, 0x609b) AM_WRITE(banksel_3_2_w)
246   AM_RANGE(0x609d, 0x609d) AM_WRITE(banksel_2_2_w)
247   AM_RANGE(0x609e, 0x609e) AM_WRITE(banksel_1_2_w)
248   AM_RANGE(0x8000, 0x8002) AM_WRITE(SMH_RAM) AM_BASE(&drawctrl)
249   AM_RANGE(0x8000, 0x9fff) AM_ROM /* space for diagnostic ROM? */
250   AM_RANGE(0xa000, 0xbfff) AM_ROM
251   AM_RANGE(0xc000, 0xffff) AM_RAM_WRITE(getrivia_bitmap_w) AM_BASE(&videoram)
252ADDRESS_MAP_END
253
254static ADDRESS_MAP_START( gselect_map, ADDRESS_SPACE_PROGRAM, 8 )
255   AM_RANGE(0x0000, 0x1fff) AM_ROM
256   AM_RANGE(0x2000, 0x3fff) AM_ROMBANK(1)
257   AM_RANGE(0x4000, 0x40ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
258   AM_RANGE(0x4400, 0x4400) AM_WRITE(banksel_1_1_w)
259   AM_RANGE(0x4401, 0x4401) AM_WRITE(banksel_1_2_w)
260   AM_RANGE(0x4402, 0x4402) AM_WRITE(banksel_2_1_w)
261   AM_RANGE(0x4403, 0x4403) AM_WRITE(banksel_2_2_w)
262   AM_RANGE(0x4800, 0x4803) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w)
263   AM_RANGE(0x5000, 0x5003) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)
264   AM_RANGE(0x8000, 0x8002) AM_WRITE(SMH_RAM) AM_BASE(&drawctrl)
265   AM_RANGE(0xc000, 0xffff) AM_RAM_WRITE(getrivia_bitmap_w) AM_BASE(&videoram)
266ADDRESS_MAP_END
267
268// TODO: where are mapped the lower 0x2000 bytes of the banks?
269static ADDRESS_MAP_START( amuse_map, ADDRESS_SPACE_PROGRAM, 8 )
270   AM_RANGE(0x0000, 0x1fff) AM_ROM
271   AM_RANGE(0x2000, 0x3fff) AM_ROMBANK(1)
272   AM_RANGE(0x4000, 0x47ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
273   AM_RANGE(0x4800, 0x4803) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w)
274   AM_RANGE(0x5000, 0x5003) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)
275   AM_RANGE(0x606f, 0x606f) AM_WRITE(banksel_5_1_w)
276   AM_RANGE(0x6077, 0x6077) AM_WRITE(banksel_4_1_w)
277   AM_RANGE(0x607b, 0x607b) AM_WRITE(banksel_3_1_w)
278   AM_RANGE(0x607d, 0x607d) AM_WRITE(banksel_2_1_w)
279   AM_RANGE(0x607e, 0x607e) AM_WRITE(banksel_1_1_w)
280   AM_RANGE(0x8000, 0x8002) AM_WRITE(SMH_RAM) AM_BASE(&drawctrl)
281   AM_RANGE(0x8000, 0xbfff) AM_ROM
282   AM_RANGE(0xc000, 0xffff) AM_RAM_WRITE(getrivia_bitmap_w) AM_BASE(&videoram)
283ADDRESS_MAP_END
284
285static ADDRESS_MAP_START( gepoker_map, ADDRESS_SPACE_PROGRAM, 8 )
286   AM_RANGE(0x0000, 0x1fff) AM_ROM
287   AM_RANGE(0x2000, 0x3fff) AM_ROMBANK(1)
288   AM_RANGE(0x4000, 0x47ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
289   AM_RANGE(0x4800, 0x4803) AM_DEVREADWRITE("ppi8255_0", ppi8255_r, ppi8255_w)
290   AM_RANGE(0x5000, 0x5003) AM_DEVREADWRITE("ppi8255_1", ppi8255_r, ppi8255_w)
291   AM_RANGE(0x60ef, 0x60ef) AM_WRITE(banksel_3_1_w)
292   AM_RANGE(0x60f7, 0x60f7) AM_WRITE(banksel_2_2_w)
293   AM_RANGE(0x60fb, 0x60fb) AM_WRITE(banksel_2_1_w)
294   AM_RANGE(0x60fd, 0x60fd) AM_WRITE(banksel_1_2_w)
295   AM_RANGE(0x60fe, 0x60fe) AM_WRITE(banksel_1_1_w)
296   AM_RANGE(0x8000, 0x8002) AM_WRITE(SMH_RAM) AM_BASE(&drawctrl)
297   AM_RANGE(0x8000, 0xbfff) AM_ROM /* space for diagnostic ROM? */
298   AM_RANGE(0xe000, 0xffff) AM_ROM
299   AM_RANGE(0xc000, 0xffff) AM_RAM_WRITE(getrivia_bitmap_w) AM_BASE(&videoram)
300ADDRESS_MAP_END
301
302
303static INPUT_PORTS_START( gselect )
304   PORT_START("DSWA")
305   PORT_DIPNAME( 0x01, 0x01, "Poker: Discard Cards" )
306   PORT_DIPSETTING(    0x01, "5" )
307   PORT_DIPSETTING(    0x00, "3" )
308   PORT_DIPNAME( 0x06, 0x06, "Poker: Pay on" )
309   PORT_DIPSETTING(    0x06, "any Pair" )
310   PORT_DIPSETTING(    0x04, "Pair of Eights or better" )
311   PORT_DIPSETTING(    0x02, "Pair of Jacks or better" )
312   PORT_DIPSETTING(    0x00, "Pair of Aces only" )
313   PORT_DIPNAME( 0x08, 0x00, "Maximum Bet" )
314   PORT_DIPSETTING(    0x08, "30" )
315   PORT_DIPSETTING(    0x00, "10" )
316   PORT_DIPNAME( 0x10, 0x10, "Poker: Credits needed for 2 Jokers" )
317   PORT_DIPSETTING(    0x10, "8" )
318   PORT_DIPSETTING(    0x00, "4" )
319   PORT_DIPNAME( 0xe0, 0x80, "Payout Percentage" )
320   PORT_DIPSETTING(    0xe0, "35" )
321   PORT_DIPSETTING(    0xc0, "40" )
322   PORT_DIPSETTING(    0xa0, "45" )
323   PORT_DIPSETTING(    0x80, "50" )
324   PORT_DIPSETTING(    0x60, "55" )
325   PORT_DIPSETTING(    0x40, "60" )
326   PORT_DIPSETTING(    0x20, "65" )
327   PORT_DIPSETTING(    0x00, "70" )
328
329   PORT_START("IN0")
330   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2)
331   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2)
332   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE2 ) PORT_IMPULSE(2) PORT_NAME("Button 12 ?")
333   PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
334   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(2) PORT_NAME ("Payout")
335   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
336   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
337   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_IMPULSE(2) PORT_NAME ("Play / Raise")
338
339   PORT_START("IN1")
340   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_IMPULSE(2)
341   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_IMPULSE(2)
342   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_IMPULSE(2)
343   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_IMPULSE(2)
344   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_IMPULSE(2)
345   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_IMPULSE(2) PORT_NAME ("Deal")
346   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_IMPULSE(2) PORT_NAME ("Cancel")
347   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_IMPULSE(2) PORT_NAME ("Stand")
348/*  Button 8, 6, 7 order verified in test mode switch test */
349
350   PORT_START("IN2")
351   PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
352INPUT_PORTS_END
353
354static INPUT_PORTS_START( gepoker )
355   PORT_INCLUDE( gselect )
356
357   PORT_MODIFY("IN0")
358   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* no coin 2 */
359   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* no button 12 */
360INPUT_PORTS_END
361
362static INPUT_PORTS_START( getrivia )
363   PORT_START("DSWA")
364   PORT_DIPNAME( 0x03, 0x01, "Questions" )
365   PORT_DIPSETTING(    0x00, "4" )
366   PORT_DIPSETTING(    0x01, "5" )
367/*  PORT_DIPSETTING(    0x02, "5" )*/
368   PORT_DIPSETTING(    0x03, "6" )
369   PORT_DIPNAME( 0x04, 0x00, "Show Answer" )
370   PORT_DIPSETTING(    0x04, DEF_STR( No ) )
371   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
372   PORT_DIPNAME( 0x08, 0x00, "Max Coins" )
373   PORT_DIPSETTING(    0x00, "10" )
374   PORT_DIPSETTING(    0x08, "30" )
375   PORT_DIPNAME( 0x10, 0x00, "Timeout" )
376   PORT_DIPSETTING(    0x10, DEF_STR( No ) )
377   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
378   PORT_DIPNAME( 0x20, 0x00, "Tickets" )
379   PORT_DIPSETTING(    0x20, DEF_STR( No ) )
380   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
381   PORT_DIPNAME( 0x40, 0x40, "No Coins" )
382   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
383   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
384   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
385   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
386   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
387
388   PORT_START("IN0")
389   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) PORT_CONDITION("DSWA", 0x40, PORTCOND_EQUALS, 0x40)
390   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_IMPULSE(2) PORT_CONDITION("DSWA", 0x40, PORTCOND_EQUALS, 0x00) PORT_NAME ("Start in no coins mode")
391   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) PORT_CONDITION("DSWA", 0x40, PORTCOND_EQUALS, 0x40)
392   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSWA", 0x40, PORTCOND_EQUALS, 0x00)
393   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(ticket_dispenser_0_port_r, 0)      /* ticket status */
394   PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
395   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
396   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
397   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
398   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
399
400   PORT_START("IN1")
401   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
402   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
403   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
404   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 )
405   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 )
406   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
407   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
408   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
409
410INPUT_PORTS_END
411
412static INPUT_PORTS_START( sextriv1 )
413   PORT_INCLUDE( getrivia )
414
415   PORT_MODIFY("IN0")
416   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* no coin 2 */
417INPUT_PORTS_END
418
419
420static const ppi8255_interface getrivia_ppi8255_intf[2] =
421{
422   {
423      DEVCB_INPUT_PORT("DSWA"),   /* Port A read */
424      DEVCB_INPUT_PORT("IN0"),   /* Port B read */
425      DEVCB_NULL,               /* Port C read */
426      DEVCB_NULL,               /* Port A write */
427      DEVCB_NULL,               /* Port B write */
428      DEVCB_HANDLER(sound_w)      /* Port C write */
429   },
430   {
431      DEVCB_INPUT_PORT("IN1"),   /* Port A read */
432      DEVCB_NULL,               /* Port B read */
433      DEVCB_NULL,               /* Port C read */
434      DEVCB_NULL,               /* Port A write */
435      DEVCB_HANDLER(lamps_w),      /* Port B write */
436      DEVCB_HANDLER(lamps2_w)      /* Port C write */
437   }
438};
439
440static const ppi8255_interface gselect_ppi8255_intf[2] =
441{
442   {
443      DEVCB_INPUT_PORT("DSWA"),   /* Port A read */
444      DEVCB_INPUT_PORT("IN0"),   /* Port B read */
445      DEVCB_NULL,               /* Port C read */
446      DEVCB_NULL,               /* Port A write */
447      DEVCB_NULL,               /* Port B write */
448      DEVCB_HANDLER(sound2_w)            /* Port C write */
449   },
450   {
451      DEVCB_INPUT_PORT("IN1"),   /* Port A read */
452      DEVCB_NULL,               /* Port B read */
453      DEVCB_INPUT_PORT("IN2"),   /* Port C read */
454      DEVCB_NULL,               /* Port A write */
455      DEVCB_HANDLER(lamps_w),      /* Port B write */
456      DEVCB_HANDLER(nmi_w)      /* Port C write */
457   }
458};
459
460static MACHINE_RESET( getrivia )
461{
462   ticket_dispenser_init(machine, 100, 1, 1);
463}
464
465static MACHINE_RESET( gselect )
466{
467}
468
469static MACHINE_DRIVER_START( getrivia )
470   MDRV_CPU_ADD("cpu",Z80,4000000) /* 4 MHz */
471   MDRV_CPU_PROGRAM_MAP(getrivia_map)
472   MDRV_CPU_VBLANK_INT("screen", nmi_line_pulse)
473
474   /* video hardware */
475   MDRV_SCREEN_ADD("screen", RASTER)
476   MDRV_SCREEN_REFRESH_RATE(60)
477   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
478   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
479   MDRV_SCREEN_SIZE(512, 256)
480   MDRV_SCREEN_VISIBLE_AREA(48, 511-48, 16, 255-16)
481
482   MDRV_PALETTE_LENGTH(256)
483
484   MDRV_MACHINE_RESET(getrivia)
485   MDRV_NVRAM_HANDLER(generic_0fill)
486
487   MDRV_VIDEO_START(generic_bitmapped)
488   MDRV_VIDEO_UPDATE(generic_bitmapped)
489
490   MDRV_PPI8255_ADD( "ppi8255_0", getrivia_ppi8255_intf[0] )
491   MDRV_PPI8255_ADD( "ppi8255_1", getrivia_ppi8255_intf[1] )
492
493   /* sound hardware */
494   MDRV_SPEAKER_STANDARD_MONO("mono")
495
496   MDRV_SOUND_ADD("dac", DAC, 0)
497   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
498MACHINE_DRIVER_END
499
500static MACHINE_DRIVER_START( gselect )
501
502   /* basic machine hardware */
503   MDRV_IMPORT_FROM(getrivia)
504
505   MDRV_CPU_MODIFY("cpu")
506   MDRV_CPU_PROGRAM_MAP(gselect_map)
507
508   MDRV_MACHINE_RESET(gselect)
509
510   MDRV_PPI8255_RECONFIG( "ppi8255_0", gselect_ppi8255_intf[0] )
511   MDRV_PPI8255_RECONFIG( "ppi8255_1", gselect_ppi8255_intf[1] )
512MACHINE_DRIVER_END
513
514static MACHINE_DRIVER_START( amuse )
515
516   /* basic machine hardware */
517   MDRV_IMPORT_FROM(getrivia)
518
519   MDRV_CPU_MODIFY("cpu")
520   MDRV_CPU_PROGRAM_MAP(amuse_map)
521MACHINE_DRIVER_END
522
523static MACHINE_DRIVER_START( gepoker )
524
525   /* basic machine hardware */
526   MDRV_IMPORT_FROM(getrivia)
527
528   MDRV_CPU_MODIFY("cpu")
529   MDRV_CPU_PROGRAM_MAP(gepoker_map)
530MACHINE_DRIVER_END
531
532/***************************************************
533Rom board is UVM-1A
534
535Contains:
536 3 2732  eproms (Program Code, 1 empty socket)
537 2 X2212P (Ram chips, no battery backup)
538 DM7408N
539
540PCB labeled M075
541
542****************************************************/
543
544ROM_START( jokpoker )
545   ROM_REGION( 0x24000, "cpu", 0 )
546   ROM_LOAD( "m075.1", 0x00000, 0x1000, CRC(ad42465b) SHA1(3f06847a9aecb0592f99419dba9be5f18005d57b) ) /* rom board UMV-1A */
547   ROM_LOAD( "m075.2", 0x01000, 0x1000, CRC(bd129fc2) SHA1(2e05ba34922c16d127be32941447013efea05bcd) )
548   ROM_LOAD( "m075.3", 0x02000, 0x1000, CRC(45725bc9) SHA1(9e6dcbec955ef8190f2307ddb367b24b7f34338d) )
549ROM_END
550
551ROM_START( jokpokera )
552   ROM_REGION( 0x24000, "cpu", 0 )
553   ROM_LOAD( "jpbiwr930-1.bin", 0x00000, 0x2000, CRC(d0f4fec5) SHA1(5fcc72522df66464759d5ba3d5209bc7a3a80002) )  /* rom board UMV-7C */
554   ROM_LOAD( "jpbiwr930-2.bin", 0x02000, 0x2000, CRC(824d1aee) SHA1(6eebde351c3b5bbed3796846d8d651b41ed6f84a) )
555ROM_END
556
557
558
559/***************************************************
560Rom board is UVM-1B
561
562Contains:
563 4 2732  eproms (Program Code)
564 Battery (3.5V litium battery) backed up NEC 8444XF301
565 DM7408N
566
567****************************************************/
568
569ROM_START( superbwl )
570   ROM_REGION( 0x24000, "cpu", 0 )
571   ROM_LOAD( "super_bowl.1", 0x00000, 0x1000, CRC(82edf064) SHA1(8a26377590282f51fb39d013452ba11252e7dd05) ) /* rom board UMV-1B */
572   ROM_LOAD( "super_bowl.2", 0x01000, 0x1000, CRC(2438dd1f) SHA1(26bbd1cb3d0d5b93f61b92ff95948ac9de060715) )
573   ROM_LOAD( "super_bowl.3", 0x02000, 0x1000, CRC(9b111430) SHA1(9aaa755f3e4b369477c1a0525c994a19fe0f6107) )
574   ROM_LOAD( "super_bowl.4", 0x03000, 0x1000, CRC(037cad42) SHA1(d4037a28bb49b31358b5d560e5e028d958ae2bc9) )
575ROM_END
576
577/***************************************************
578Rom board is UVM 10 B
579
580Contains:
581 2 2764  eproms (Program Code)
582 5 27128 eproms (Question roms)
583 Battery (3V litium battery) backed up HM6117P-4
584 SN74LS374
585 MMI PAL10L8
586
587
588Sets will be listed by "series" - the program code version
589 is not as important as maintaining the correct questions
590 sets as per known series
591Missing sets will be filled as dumped, as question roms
592 are interchangable, operators did thier own swaps
593
594Note: Question roms that contain "#1" (or 2 ect)
595      are corrected roms (spelling and / or answers)
596
597****************************************************/
598
599ROM_START( gtsers1 ) /* Series 1 (Complete) */
600   ROM_REGION( 0x24000, "cpu", 0 )
601   ROM_LOAD( "prog101c_right", 0x00000, 0x2000, CRC(767f0e46) SHA1(5de7b54876fcbfb2328174ffe6b656ffea886fcb) ) /* rom board UMV 10 B */
602   ROM_LOAD( "prog101c_left",  0x0a000, 0x2000, CRC(24c0a097) SHA1(b8de58baecb92775e0882cd6eca3b9e07cf7c5a5) )
603   /* Question roms */
604   ROM_LOAD( "science_#1",    0x10000, 0x4000, CRC(68259e09) SHA1(29e848b4744b767c51ff81a756fba7bf96daefec) )
605   ROM_LOAD( "general_#1",    0x14000, 0x4000, CRC(25a0ef9d) SHA1(793abd779cc237e14933933747bbf27bbcbfcd32) )
606   ROM_LOAD( "sports_#1",     0x18000, 0x4000, CRC(cb1744f5) SHA1(ea3f7bfcecf5c58c26aa0f34908ba5d54f7279ec) )
607   ROM_LOAD( "music_#1",      0x1c000, 0x4000, CRC(1b546857) SHA1(31e04bb5016e8ef6dc48f9b3ddaeab5fe04f91c2) )
608   ROM_LOAD( "movies-tv_#1",  0x20000, 0x4000, CRC(e9a55dad) SHA1(c87682e72bad3507b24eb6a52b4e430e0bfcdab6) )
609ROM_END
610
611ROM_START( gtsers2 ) /* Series 2 (Complete - question roms dated 2/9) */
612   ROM_REGION( 0x24000, "cpu", 0 )
613   ROM_LOAD( "prog101c_right", 0x00000, 0x2000, CRC(767f0e46) SHA1(5de7b54876fcbfb2328174ffe6b656ffea886fcb) ) /* rom board UMV 10 B */
614   ROM_LOAD( "prog101c_left",  0x0a000, 0x2000, CRC(24c0a097) SHA1(b8de58baecb92775e0882cd6eca3b9e07cf7c5a5) )
615   /* Question roms */
616   ROM_LOAD( "tv_mash",          0x10000, 0x4000, CRC(a86990fc) SHA1(6a11b038d48bb97feb4857546349ed93ea1f9273) )
617   ROM_LOAD( "general_2",        0x14000, 0x4000, CRC(5798f2b3) SHA1(0636017969d9b1eac5d33cfb18cb36f7cf4cba88) )
618   ROM_LOAD( "sports_2_#2",      0x18000, 0x4000, CRC(fb632622) SHA1(c14d8178f5cfc5994e2ab4f829e353fa75b57304) )
619   ROM_LOAD( "comics_#1",        0x1c000, 0x4000, CRC(8c5cd561) SHA1(1ca566acf72ce636b1b34ee6b7cafb9584340bcc) )
620   ROM_LOAD( "entertainment_#1", 0x20000, 0x4000, CRC(cd3ce4c7) SHA1(4bd121fa5899a96b015605f84179ed82be0a25f3) ) /* Correct spelling of "Acapella" */
621ROM_END
622
623ROM_START( gtsers3 ) /* Series 3 (Complete - question roms dated 3/9) */
624   ROM_REGION( 0x24000, "cpu", 0 )
625   ROM_LOAD( "prog102b_right",   0x00000, 0x2000, CRC(e8391f71) SHA1(a955eff87d622d4fcfd25f6d888c48ff82556879) )
626   ROM_LOAD( "prog102b_left",    0x0a000, 0x2000, CRC(cc7b45a7) SHA1(c708f56feb36c1241358a42bb7dce25b799f1f0b) )
627   /* Question roms */
628   ROM_LOAD( "beatlemania_#1", 0x10000, 0x4000, CRC(c35ab539) SHA1(aa7c9b532aeb289b71c179e6ff1cc5b63dbe240c) )
629   ROM_LOAD( "general_3",      0x14000, 0x4000, CRC(a60f17a4) SHA1(0d79be9e2e49b9817e94d410e25bb6dcda10aa9e) )
630   ROM_LOAD( "sports_3_#3",    0x18000, 0x4000, CRC(b22cec38) SHA1(a416c3de9749fda3ab5ae5841304da0cef900cbf) )
631   ROM_LOAD( "country-west",   0x1c000, 0x4000, CRC(3227c475) SHA1(d07ad4876122223fe7ab3f21781e0d847332ea5c) )
632   ROM_LOAD( "tv_soaps",       0x20000, 0x4000, CRC(26914f3a) SHA1(aec380cea14d6acb71986f3d65c7620b16c174ae) )
633ROM_END
634
635ROM_START( gtsers4 ) /* Series 4 (Incomplete - question roms dated 4/9) */
636   ROM_REGION( 0x24000, "cpu", 0 )
637   ROM_LOAD( "prog102c_right", 0x00000, 0x2000, CRC(76fdc3a3) SHA1(212e09644b9cab334aad22ec5860e8638c6ba3fa) )
638   ROM_LOAD( "prog102c_left",  0x0a000, 0x2000, CRC(901fb2f9) SHA1(98e49c74d89c4911a1f4d5ccf3e6cf3226c6a178) )
639   /* Question roms */
640   ROM_LOAD( "history-geog",   0x10000, 0x4000, CRC(76d6b026) SHA1(613809b247cb27773631a1bb34af485c2b1bd486) )
641   ROM_LOAD( "star_trek",      0x14000, 0x4000, CRC(19764e00) SHA1(d7ed577dba02776ac58e8f34b833ed07679c0af1) )
642   ROM_LOAD( "television_#1",  0x18000, 0x4000, CRC(0f646389) SHA1(23fefe2e6cc26767d52604e7ab15bb4db99a6e94) )
643   /* Missing "baseball" */
644   /* Missing "hollywood" */
645ROM_END
646
647ROM_START( gtsers5 ) /* Series 5 (Incomplete - question roms dated 5/9) */
648   ROM_REGION( 0x24000, "cpu", 0 )
649   ROM_LOAD( "prog102c_right", 0x00000, 0x2000, CRC(76fdc3a3) SHA1(212e09644b9cab334aad22ec5860e8638c6ba3fa) )
650   ROM_LOAD( "prog102c_left",  0x0a000, 0x2000, CRC(901fb2f9) SHA1(98e49c74d89c4911a1f4d5ccf3e6cf3226c6a178) )
651   /* Question roms */
652   ROM_LOAD( "james_bond",    0x10000, 0x4000, CRC(fe9fadfd) SHA1(44b3fee1f14148f47b0b40600aabd5bff9b65e85) )
653   ROM_LOAD( "hockey",        0x14000, 0x4000, CRC(4874a431) SHA1(f3c11dfbf71d101aa1a6cd3622b282a4ebe4664b) )
654   /* Missing "the_states" */
655   /* Missing "wild_west" */
656   /* Missing "elvismania" */
657ROM_END
658
659ROM_START( gtsers7 ) /* Series 7 (Incomplete - question roms dated 7/9?) */
660   ROM_REGION( 0x24000, "cpu", 0 )
661   ROM_LOAD( "prog102c_right", 0x00000, 0x2000, CRC(76fdc3a3) SHA1(212e09644b9cab334aad22ec5860e8638c6ba3fa) )
662   ROM_LOAD( "prog102c_left",  0x0a000, 0x2000, CRC(901fb2f9) SHA1(98e49c74d89c4911a1f4d5ccf3e6cf3226c6a178) )
663   /* Question roms */
664   ROM_LOAD( "general_5",     0x10000, 0x4000, CRC(81bf07c7) SHA1(a53f050b4ef8ffc0499b50224d4bbed4af0ca09c) )
665   /* Missing "tv_dallas" */
666   /* Missing "kids_korner" */
667   /* Missing "good_guys" */
668   /* Missing "biblical" */
669ROM_END
670
671ROM_START( gtsersa ) /* alt or older version questions */
672   ROM_REGION( 0x24000, "cpu", 0 )
673   ROM_LOAD( "prog102c_right", 0x00000, 0x2000, CRC(76fdc3a3) SHA1(212e09644b9cab334aad22ec5860e8638c6ba3fa) )
674   ROM_LOAD( "prog102c_left",  0x0a000, 0x2000, CRC(901fb2f9) SHA1(98e49c74d89c4911a1f4d5ccf3e6cf3226c6a178) )
675   /* Question roms */
676   ROM_LOAD( "sports",               0x10000, 0x4000, CRC(9b4a17b6) SHA1(1b5358b5bc83c2817ecfa4e277fa351a679d5023) ) /* Series 1 question */
677   ROM_LOAD( "entertainment_#1_old", 0x14000, 0x4000, CRC(2bffb3b4) SHA1(5947ebd708df35cefa86608392909c16b25d0710) ) /* Dated 2/9 - Spells "Acapella" as "Cappella" */
678   ROM_LOAD( "sports_2",             0x18000, 0x4000, CRC(e8f8e168) SHA1(d2bc57dc0799dd8817b15857f17c4d7ee4d9f932) ) /* Dated 2/9 */
679   ROM_LOAD( "comics",               0x1c000, 0x4000, CRC(7efdfe8f) SHA1(ec255777c61677ca32c49b9da5e85e07c0647e5f) ) /* Dated 2/9 */
680   ROM_LOAD( "entertainment",        0x20000, 0x4000, CRC(b670b9e8) SHA1(0d2246fcc6c753694bc9bd1fc05ac439f24059ef) ) /* Dated 2/9 */
681ROM_END
682
683ROM_START( gtsersb ) /* alt or older version questions */
684   ROM_REGION( 0x24000, "cpu", 0 )
685   ROM_LOAD( "prog102c_right", 0x00000, 0x2000, CRC(76fdc3a3) SHA1(212e09644b9cab334aad22ec5860e8638c6ba3fa) )
686   ROM_LOAD( "prog102c_left",  0x0a000, 0x2000, CRC(901fb2f9) SHA1(98e49c74d89c4911a1f4d5ccf3e6cf3226c6a178) )
687   /* Question roms */
688   ROM_LOAD( "beatlemania",    0x10000, 0x4000, CRC(cb241960) SHA1(e560b776b2cb5fd29d1663fffdf68f4427d674a9) ) /* Dated 3/9 */
689   ROM_LOAD( "sports_3",       0x14000, 0x4000, CRC(5986996c) SHA1(56432c15a3b0204ed527c18e24716f17bb52dc4e) ) /* Dated 3/9 */
690   ROM_LOAD( "television",     0x18000, 0x4000, CRC(413f34c8) SHA1(318f6b464449bf3f0c43c4210a667190c774eb67) ) /* Dated 4/9 */
691   ROM_LOAD( "sex_triv",       0x1c000, 0x4000, CRC(cd0ce4e2) SHA1(2046ee3da94f00bf4a8b3fc62b1190d58e83cc89) ) /* Dated 7/9 - likely an alt series 7 question set */
692   ROM_LOAD( "facts_of_life",  0x20000, 0x4000, CRC(1668c7bf) SHA1(6bf43de26f8a626560579ab75fd0890fe00f99dd) ) /* Uknown series question set */
693ROM_END
694
695ROM_START( sextriv1 )
696   ROM_REGION( 0x24000, "cpu", 0 )
697   ROM_LOAD( "prog1_right",   0x00000, 0x2000, CRC(73abcd12) SHA1(3b985f25a11507878cef6d11420e215065fb0906) )
698   ROM_LOAD( "prog1_left",    0x0a000, 0x2000, CRC(04ee6ecd) SHA1(28342fcdcf36b34fa93f1a985163ca5aab03defe) )
699   /* Question roms */
700   ROM_LOAD( "adult_sex",    0x10000, 0x4000, CRC(509a8183) SHA1(635c784860e423b22aaea94abc53c1d9477cb1df) )
701   ROM_LOAD( "arousing_sex", 0x14000, 0x4000, CRC(1dbf4578) SHA1(51a548d5fe59739e62b5f0e9e6ebc7deb8656210) )
702   ROM_LOAD( "intimate_sex", 0x18000, 0x4000, CRC(1f46b626) SHA1(04aa5306c69d130e0f84fa390a773e73c06e5e9b) )
703   ROM_LOAD( "sizzling_sex", 0x1c000, 0x4000, CRC(c718833d) SHA1(02ea341e56554dd9302fe95f45dcf446a2978917) )
704ROM_END
705
706ROM_START( sextriv2 )
707   ROM_REGION( 0x24000, "cpu", 0 )
708   ROM_LOAD( "prog1_right",     0x00000, 0x2000, CRC(73abcd12) SHA1(3b985f25a11507878cef6d11420e215065fb0906) )
709   ROM_LOAD( "prog1_left",      0x0a000, 0x2000, CRC(04ee6ecd) SHA1(28342fcdcf36b34fa93f1a985163ca5aab03defe) )
710   /* Question roms */
711   ROM_LOAD( "general_sex",     0x10000, 0x4000, CRC(36fed946) SHA1(25d445ab6cb4b6f41a1dd7104ee1141e597b2e9e) )
712   ROM_LOAD( "educational_sex", 0x14000, 0x4000, CRC(281cbe03) SHA1(9c3900cd2535f942a5cbae7edd46ac0170e04c52) )
713   ROM_LOAD( "novelty_sex",     0x18000, 0x4000, CRC(26603979) SHA1(78061741e5224b3162be51e637a2fbb9a48962a3) )
714ROM_END
715
716/***************************************************
717Rom board is UVM-4B
718
719Contains 5 2764 eproms, MMI PAL16R4CN
720
721Battery (3V litium battery) backed up HM6117P-4
722
723Roms labeled as:
724
7254/1  at spot 1
726BLJK at spot 2
727POKR at spot 3
728SPRD at spot 4
729SLOT at spot 3
730
731Alt set included BONE in place of SPRD & a newer SLOT
732
733These board sets may also be known as the V116 (or V16)
734sets as the alt set also included that name on the labels
735
736****************************************************/
737
738ROM_START( gs4002 )
739   ROM_REGION( 0x18000, "cpu", 0 )
740   ROM_LOAD( "4-1.1",          0x00000, 0x2000, CRC(a456e456) SHA1(f36b96ac31ce0f128ecb94f94d1dbdd88ee03c77) ) /* V16M 5-4-84 */
741   /* Banked roms */
742   ROM_LOAD( "bljk_3-16-84.2", 0x10000, 0x2000, CRC(c3785523) SHA1(090f324fc7adb0a36b189cf04086f0e050895ee4) )
743   ROM_LOAD( "pokr_5-16-84.3", 0x12000, 0x2000, CRC(f0e99cc5) SHA1(02fdc95974e503b6627930918fcc3c029a7a4612) )
744   ROM_LOAD( "sprd_1-24-84.4", 0x14000, 0x2000, CRC(5fe90ed4) SHA1(38db69567d9c38f78127e581fdf924aca4926378) )
745   ROM_LOAD( "slot_1-24-84.5", 0x16000, 0x2000, CRC(cd7cfa4c) SHA1(aa3de086e5a1018b9e5a18403a6144a6b0ed1036) )
746ROM_END
747
748ROM_START( gs4002a )
749   ROM_REGION( 0x18000, "cpu", 0 )
750   ROM_LOAD( "4-1.1",          0x00000, 0x2000, CRC(a456e456) SHA1(f36b96ac31ce0f128ecb94f94d1dbdd88ee03c77) ) /* V16M 5-4-84 */
751   /* Banked roms */
752   ROM_LOAD( "bljk_3-16-84.2", 0x10000, 0x2000, CRC(c3785523) SHA1(090f324fc7adb0a36b189cf04086f0e050895ee4) )
753   ROM_LOAD( "pokr_5-16-84.3", 0x12000, 0x2000, CRC(f0e99cc5) SHA1(02fdc95974e503b6627930918fcc3c029a7a4612) )
754   ROM_LOAD( "bone_5-16-84.4", 0x14000, 0x2000, CRC(eccd2fb0) SHA1(2683e432ffcca4280c31f57b2596e4389bc59b7b) )
755   ROM_LOAD( "slot_9-24-84.5", 0x16000, 0x2000, CRC(25d8c504) SHA1(2d52b66e8a1f06f486015440668bd924a123dad0) )
756ROM_END
757
758/*
759Greyhound Poker board...
760
761Standard Greyhound Electronics Inc UV-1B mainboard.
762
763Rom board UVM 10 B or UMV 10 C
764
765Battery backed up NEC D449C ram
766PAL16R4
76774L374
768
769Roms in this order on the UMV 10 C board:
770
771Label        Normaly in the slot
772--------------------------------
773High
774Control
775rom1         Joker Poker
776rom2         Black jack
777rom3         Rolling Bones
778rom4         Casino Slots
779rom5         Horse Race
780
781For UMV 10 B: 1C, 2C, 1, 2, 3, 4, & 5
782
783There looks to be several types and combos for these, some are "ICB" or "IAM"
784It also looks like operators mixed & matched to upgrade (some times incorrectly)
785their boards.  Sets will be filled in as found and dumped.
786
787There are some versions, like, the ICB sets that use 2764 roms for all roms. While the IAM set uses
78827128 roms for all roms.  These roms are the correct size, but it's currently not known if the rom
789board (UVM 10 B/C) "sees" them as 27128 or the standard size of 2764.
790
791Dumped, but not known to be supported by any High/Control combo:
792ROM_LOAD( "rollingbones_am_3-16-84",  0x16000, 0x4000, CRC(41879e9b) SHA1(5106d5772bf43b28817e27efd16c785359cd929e) ) // Might work with IAM control, once it gets figured out
793
794The ICB set is known as the M105 set as some label sets included that name.
795
796*/
797
798ROM_START( gepoker ) /* v50.02 with most roms for ICB dated 8-16-84 */
799   ROM_REGION( 0x1b000, "cpu", ROMREGION_ERASEFF )
800   ROM_LOAD( "control_icb_8-16",    0x00000, 0x2000, CRC(0103963d) SHA1(9bc646e721048b84111e0686eaca23bc24eee3e2) )
801   ROM_LOAD( "high_icb_6-25-85-5",  0x0e000, 0x2000, CRC(dfb6592e) SHA1(d68de9f537d3c14279dc576424d195bb266e3897) )
802   /* Banked roms */
803   ROM_LOAD( "jokerpoker_icb_8-16-84",    0x10000, 0x2000, CRC(0834a1e6) SHA1(663e6f4e0586eb9b84d3098aef8c596585c27304) )
804   ROM_LOAD( "blackjack_icb_8-16-84",     0x12000, 0x2000, CRC(cff27ffd) SHA1(fd85b54400b2f22ae92042b01a2c162e64d2d066) )
805   ROM_LOAD( "rollingbones_icb_8-16-84",  0x14000, 0x2000, CRC(52d66cb6) SHA1(57db34906fcafd37f3a361df209dafe080aeac16) )
806   ROM_LOAD( "casinoslots_icb_8-16-84",   0x16000, 0x2000, CRC(3db002a3) SHA1(7dff4efceee37b25328303cf0606bf4baa4df5f3) )
807   ROM_LOAD( "horserace_icb_3-19-85",     0x18000, 0x2000, CRC(f1e6e61e) SHA1(944b1ab4af911e5ed136f1fca3c44219726eeebb) )
808ROM_END
809
810ROM_START( gepoker1 ) /* v50.02 with roms for ICB dated 9-30-86 */
811   ROM_REGION( 0x1b000, "cpu", ROMREGION_ERASEFF )
812   ROM_LOAD( "control_icb_9-30",    0x00000, 0x2000, CRC(08b996f2) SHA1(5f5efb5015ec9571cc94734c18debfadaa28f585) )
813   ROM_LOAD( "high_icb_6-25-85-5a", 0x0e000, 0x2000, CRC(6ddc1750) SHA1(ee19206b7f4a98e3e7647414127f4e09b3e9134f) )
814   /* Banked roms */
815   ROM_LOAD( "jokerpoker_icb_9-30-86",    0x10000, 0x2000, CRC(a1473367) SHA1(9b37ccafc02704e8f1d61150326494e86148d84e) )
816   ROM_LOAD( "blackjack_icb_9-30-86",     0x12000, 0x2000, CRC(82804184) SHA1(2e2e6a80c99c8eb226dc54c1d32d0bf24de300a4) )
817   ROM_LOAD( "casinoslots_icb_9-30-86",   0x14000, 0x2000, CRC(713c3963) SHA1(a9297c04fc44522ca6891516a2c744712132896a) )
818   ROM_LOAD( "beatthespread_icb_9-30-86", 0x16000, 0x2000, CRC(93654d2a) SHA1(3aa5a54b91867c03182e93a7f1607545503a33f7) )
819   ROM_LOAD( "instantbingo_t24_10-07-86", 0x18000, 0x2000, CRC(de87ed0a) SHA1(4a26d93368c1a39dd38aabe450c34203101f0ef7) ) /* Found with this set, is it compatible or an operater swap? */
820ROM_END
821
822ROM_START( gepoker2 ) /* v50.02 with control dated 9-30-84 */
823   ROM_REGION( 0x1b000, "cpu", ROMREGION_ERASEFF )
824   ROM_LOAD( "control_icb_9-30",  0x00000, 0x2000, CRC(08b996f2) SHA1(5f5efb5015ec9571cc94734c18debfadaa28f585) )
825   ROM_LOAD( "high_icb_6-25a",    0x0e000, 0x2000, CRC(6ddc1750) SHA1(ee19206b7f4a98e3e7647414127f4e09b3e9134f) )
826   /* Banked roms */
827   ROM_LOAD( "jokerpoker_cb_10-19-88",    0x10000, 0x2000, CRC(a590af75) SHA1(63bc64fbc9ac0c489b1f4894d77a4be13d7251e7) )
828   ROM_LOAD( "horserace_icb_1-1-87",      0x12000, 0x2000, CRC(6d5092e3) SHA1(ef99d1b858aef3c438c61c2b17e371dc6aca6623) )
829ROM_END
830
831ROM_START( amuse ) /* v50.08 with most roms for IAM dated 8-16-84 */
832   ROM_REGION( 0x24000, "cpu", ROMREGION_ERASEFF )
833   ROM_LOAD( "control_iam_8-16",  0x00000, 0x4000, CRC(345434b9) SHA1(ec880f6f5e90aa971937e0270701e323f6a83671) ) /* all roms were 27128, twice the size of other sets */
834   ROM_LOAD( "high_iam_8-16",     0x08000, 0x4000, CRC(57000fb7) SHA1(144723eb528c4816b9aa4b0ba77d2723c6442546) ) /* Is only the 1st half used by the board / program? */
835   /* Banked roms */
836   ROM_LOAD( "jokerpoker_iam_8-16-84",    0x10000, 0x4000, CRC(33794a87) SHA1(2b46809623713582746d9f817db33077f15a3684) ) /* This set is verified correct by 3 different sets checked */
837   ROM_LOAD( "blackjack_iam_8-16-84",     0x14000, 0x4000, CRC(6e10b5b8) SHA1(5dc294b4a562193a99b0d307323fcc084a053426) )
838   ROM_LOAD( "rollingbones_iam_8-16-84",  0x18000, 0x4000, CRC(26949774) SHA1(20571b955521ec3929430249aa651cee8a97043d) )
839   ROM_LOAD( "casinoslots_iam_8-16-84",   0x1c000, 0x4000, CRC(c5a1eec6) SHA1(43d31bfe4cbbb6b86f52f675f513050866443176) )
840   ROM_LOAD( "horserace_iam_3-19-84",     0x20000, 0x4000, CRC(7b9e75cb) SHA1(0db8da6f5f59f57886766bec96102d43796567ef) )
841ROM_END
842
843static DRIVER_INIT( setbank )
844{
845   memory_set_bankptr(machine, 1,memory_region(machine, "cpu") + 0x2000);
846}
847
848GAME( 1982, jokpoker, 0,        gselect,  gselect,  setbank, ROT0, "Greyhound Electronics", "Joker Poker (Version 16.03B)",            GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
849GAME( 1983, jokpokera,jokpoker, gselect,  gselect,  setbank, ROT0, "Greyhound Electronics", "Joker Poker (Version 16.03BI)",            GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_NOT_WORKING )
850GAME( 1982, superbwl, 0,        gselect,  gselect,  setbank, ROT0, "Greyhound Electronics", "Super Bowl (Version 16.03B)",             GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
851
852GAME( 1982, gs4002,   0,        gselect,  gselect,  0,       ROT0, "Greyhound Electronics", "Selection (Version 40.02TMB, set 1)",     GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
853GAME( 1982, gs4002a,  gs4002,   gselect,  gselect,  0,       ROT0, "Greyhound Electronics", "Selection (Version 40.02TMB, set 2)",     GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
854
855GAME( 1982, amuse,    0,        amuse,    gepoker,  0,       ROT0, "Greyhound Electronics", "Amuse (Version 50.08 IBA)",               GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND | GAME_IMPERFECT_GRAPHICS )
856
857GAME( 1984, gepoker,  0,        gepoker,  gepoker,  0,       ROT0, "Greyhound Electronics", "Poker (Version 50.02 ICB, set 1)",        GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
858GAME( 1984, gepoker1, gepoker,  gepoker,  gepoker,  0,       ROT0, "Greyhound Electronics", "Poker (Version 50.02 ICB, set 2)",        GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
859GAME( 1984, gepoker2, gepoker,  gepoker,  gepoker,  0,       ROT0, "Greyhound Electronics", "Poker (Version 50.02 ICB, set 3)",        GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
860
861GAME( 1984, gtsers1,  0,        getrivia, getrivia, 0,       ROT0, "Greyhound Electronics", "Trivia (Questions Series 1)",             GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
862GAME( 1984, gtsers2,  gtsers1,  getrivia, getrivia, 0,       ROT0, "Greyhound Electronics", "Trivia (Questions Series 2)",             GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
863GAME( 1984, gtsers3,  gtsers1,  getrivia, getrivia, 0,       ROT0, "Greyhound Electronics", "Trivia (Questions Series 3)",             GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
864GAME( 1984, gtsers4,  gtsers1,  getrivia, getrivia, 0,       ROT0, "Greyhound Electronics", "Trivia (Questions Series 4)",             GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
865GAME( 1984, gtsers5,  gtsers1,  getrivia, getrivia, 0,       ROT0, "Greyhound Electronics", "Trivia (Questions Series 5)",             GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
866GAME( 1984, gtsers7,  gtsers1,  getrivia, getrivia, 0,       ROT0, "Greyhound Electronics", "Trivia (Questions Series 7)",             GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
867GAME( 1984, gtsersa,  gtsers1,  getrivia, getrivia, 0,       ROT0, "Greyhound Electronics", "Trivia (Alt revision questions set 1)",   GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
868GAME( 1984, gtsersb,  gtsers1,  getrivia, getrivia, 0,       ROT0, "Greyhound Electronics", "Trivia (Alt revision questions set 2)",   GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
869
870GAME( 1985, sextriv1, 0,        getrivia, sextriv1, 0,       ROT0, "Kinky Kit and Game Co.", "Sexual Trivia (Version 1.02SB, set 1)",  GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
871GAME( 1985, sextriv2, sextriv1, getrivia, sextriv1, 0,       ROT0, "Kinky Kit and Game Co.", "Sexual Trivia (Version 1.02SB, set 2)",  GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
src/mame/drivers/segae.h
r6653r6654
1/* System E stuff */
2
3extern VIDEO_UPDATE(megatech_bios);
4extern VIDEO_UPDATE(megatech_md_sms);
5extern DRIVER_INIT( megatech_bios );
6extern MACHINE_RESET(megatech_bios);
7extern MACHINE_RESET(megatech_md_sms);
8extern VIDEO_EOF(megatech_bios);
9extern VIDEO_EOF(megatech_md_sms);
10
11extern READ8_HANDLER( sms_vcounter_r );
12extern READ8_HANDLER( sms_vdp_data_r );
13extern WRITE8_HANDLER( sms_vdp_data_w );
14extern READ8_HANDLER( sms_vdp_ctrl_r );
15extern WRITE8_HANDLER( sms_vdp_ctrl_w );
16
17extern void init_for_megadrive(running_machine *machine);
18extern void segae_md_sms_stop_scanline_timer(void);
19
20
21extern READ8_HANDLER( md_sms_vdp_vcounter_r );
22extern READ8_HANDLER( md_sms_vdp_data_r );
23extern WRITE8_HANDLER( md_sms_vdp_data_w );
24extern READ8_HANDLER( md_sms_vdp_ctrl_r );
25extern WRITE8_HANDLER( md_sms_vdp_ctrl_w );
26
src/mame/drivers/tarzan.c
r6653r6654
1
2/* Old IGS game called Tarzan, don't know much about it, could be gambling */
3/* CPU might not be z80 (maybe z180)
4
5  decryption is incomplete?, first part of code doesn't seem right?
6
7  graphics area also encrypted
8
9*/
10
11#include "driver.h"
12#include "cpu/z80/z80.h"
13
14
15static VIDEO_START(tarzan)
16{
17}
18
19static VIDEO_UPDATE(tarzan)
20{
21
22   return 0;
23}
24
25static ADDRESS_MAP_START( tarzan_map, ADDRESS_SPACE_PROGRAM, 8 )
26   AM_RANGE(0x0000, 0x7fff) AM_ROM
27ADDRESS_MAP_END
28
29
30static INPUT_PORTS_START( tarzan )
31INPUT_PORTS_END
32
33
34static const gfx_layout tarzan_layout =
35{
36   8,8,
37   RGN_FRAC(1,1),
38   4,
39   { 0*8,1*8,2*8,3*8 },
40   { 0,1,2,3,4,5,6,7 },
41   { 0*8, 4*8, 8*8,12*8,16*8,20*8,24*8,28*8},
42   32*8
43};
44
45
46static GFXDECODE_START( tarzan )
47   GFXDECODE_ENTRY( "gfx1", 0, tarzan_layout,   0x0, 2  )
48   GFXDECODE_ENTRY( "gfx2", 0, tarzan_layout,  0x0, 2  )
49GFXDECODE_END
50
51
52
53
54static MACHINE_DRIVER_START( tarzan )
55   /* basic machine hardware */
56   MDRV_CPU_ADD("maincpu", Z80,8000000)       /* ? */
57   MDRV_CPU_PROGRAM_MAP(tarzan_map)
58
59   /* video hardware */
60   MDRV_SCREEN_ADD("screen", RASTER)
61   MDRV_SCREEN_REFRESH_RATE(60)
62   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
63   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
64   MDRV_SCREEN_SIZE(256, 256)
65   MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1)
66
67   MDRV_PALETTE_LENGTH(0x100)
68   MDRV_GFXDECODE(tarzan)
69
70   MDRV_VIDEO_START(tarzan)
71   MDRV_VIDEO_UPDATE(tarzan)
72MACHINE_DRIVER_END
73
74static DRIVER_INIT( tarzan )
75{
76   UINT16* ROM = (UINT16*)memory_region(machine,"maincpu");
77   int i;
78   int size = 0x040000;
79
80   for(i=0; i<size/2; i++)
81   {
82      UINT16 x = ROM[i];
83
84      if((i & 0x10c0) == 0x0000)
85         x ^= 0x0001;
86
87      if((i & 0x0010) == 0x0010 || (i & 0x0130) == 0x0020)
88         x ^= 0x0404;
89
90      if((i & 0x00d0) != 0x0010)
91         x ^= 0x1010;
92
93      if(((i & 0x0008) == 0x0008)^((i & 0x10c0) == 0x0000))
94         x ^= 0x0100;
95
96      ROM[i] = x;
97   }
98
99   #if 0
100   {
101      FILE *fp;
102      char filename[256];
103      sprintf(filename,"decrypted_%s", machine->gamedrv->name);
104      fp=fopen(filename, "w+b");
105      if (fp)
106      {
107         fwrite(ROM, 0x40000, 1, fp);
108         fclose(fp);
109      }
110   }
111   #endif
112}
113
114ROM_START( tarzan )
115   ROM_REGION( 0x040000, "maincpu", 0 )
116   ROM_LOAD( "0228-u16.bin", 0x00000, 0x040000, CRC(e6c552a5) SHA1(f156de9459833474c85a1f5b35917881b390d34c)  )
117
118   ROM_REGION( 0x080000, "gfx1", 0 )
119   ROM_LOAD( "0228-u21.bin", 0x00000, 0x080000, CRC(80aaece4) SHA1(07cad92492c5de36c3915867ed4c6544b1a30c07)  )
120
121   ROM_REGION( 0x080000, "gfx2", 0 )
122   ROM_LOAD( "0228-u6.bin", 0x00000, 0x080000, CRC(55e94832) SHA1(b15409f4f1264b6d1218d5dc51c5bd1de2e40284)  )
123
124ROM_END
125
126
127GAME( 199?, tarzan, 0, tarzan, tarzan, tarzan, ROT0, "IGS", "Tarzan",GAME_NOT_WORKING|GAME_NO_SOUND )
src/mame/drivers/findout.c
r6653r6654
1/***************************************************************************
2
3Reel Fun    (c) 1986
4Find Out    (c) 1987
5Trivia      (c) 1984 / 1986
6Quiz        (c) 1991
7
8driver by Nicola Salmoria
9
10Trivia games "No Coins" mode: if DSW "No Coins" is on, coin inputs are
11replaced by a 6th button to start games. This is a feature of the PCB for private use.
12
13***************************************************************************/
14
15#include "driver.h"
16#include "cpu/z80/z80.h"
17#include "machine/8255ppi.h"
18#include "machine/ticket.h"
19#include "sound/dac.h"
20
21
22static UINT8 drawctrl[3];
23
24static WRITE8_HANDLER( findout_drawctrl_w )
25{
26   drawctrl[offset] = data;
27}
28
29static WRITE8_HANDLER( findout_bitmap_w )
30{
31   int sx,sy;
32   int fg,bg,mask,bits;
33   static int prevoffset, yadd;
34
35   videoram[offset] = data;
36
37   yadd = (offset==prevoffset) ? (yadd+1):0;
38   prevoffset = offset;
39
40   fg = drawctrl[0] & 7;
41   bg = 2;
42   mask = 0xff;//drawctrl[2];
43   bits = drawctrl[1];
44
45   sx = 8 * (offset % 64);
46   sy = offset / 64;
47   sy = (sy + yadd) & 0xff;
48
49//if (mask != bits)
50//  popmessage("color %02x bits %02x mask %02x\n",fg,bits,mask);
51
52   if (mask & 0x80) *BITMAP_ADDR16(tmpbitmap, sy, sx+0) = (bits & 0x80) ? fg : bg;
53   if (mask & 0x40) *BITMAP_ADDR16(tmpbitmap, sy, sx+1) = (bits & 0x40) ? fg : bg;
54   if (mask & 0x20) *BITMAP_ADDR16(tmpbitmap, sy, sx+2) = (bits & 0x20) ? fg : bg;
55   if (mask & 0x10) *BITMAP_ADDR16(tmpbitmap, sy, sx+3) = (bits & 0x10) ? fg : bg;
56   if (mask & 0x08) *BITMAP_ADDR16(tmpbitmap, sy, sx+4) = (bits & 0x08) ? fg : bg;
57   if (mask & 0x04) *BITMAP_ADDR16(tmpbitmap, sy, sx+5) = (bits & 0x04) ? fg : bg;
58   if (mask & 0x02) *BITMAP_ADDR16(tmpbitmap, sy, sx+6) = (bits & 0x02) ? fg : bg;
59   if (mask & 0x01) *BITMAP_ADDR16(tmpbitmap, sy, sx+7) = (bits & 0x01) ? fg : bg;
60}
61
62
63static READ8_DEVICE_HANDLER( portC_r )
64{
65   return 4;
66}
67
68static READ8_DEVICE_HANDLER( port1_r )
69{
70   const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
71
72   return input_port_read(device->machine, "IN0") | (ticket_dispenser_0_r(space, 0) >> 5);
73}
74
75static WRITE8_DEVICE_HANDLER( lamps_w )
76{
77   /* 5 button lamps */
78   set_led_status(0,data & 0x01);
79   set_led_status(1,data & 0x02);
80   set_led_status(2,data & 0x04);
81   set_led_status(3,data & 0x08);
82   set_led_status(4,data & 0x10);
83   /* lamps 6, 7, 8 in gt507, may be hopper slide 1, 2, 3 ? */
84   set_led_status(5,data & 0x20);
85   set_led_status(6,data & 0x40);
86   set_led_status(7,data & 0x80);
87}
88
89static WRITE8_DEVICE_HANDLER( sound_w )
90{
91   const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
92
93   /* bit 3 - coin lockout (lamp6 in test modes, set to lamp 10 as in getrivia.c) */
94   coin_lockout_global_w(~data & 0x08);
95   set_led_status(9,data & 0x08);
96
97   /* bit 5 - ticket out in trivia games */
98   ticket_dispenser_w(space, 0, (data & 0x20)<< 2);
99
100   /* bit 6 enables NMI */
101   interrupt_enable_w(space, 0,data & 0x40);
102
103   /* bit 7 goes directly to the sound amplifier */
104   dac_data_w(devtag_get_device(device->machine, "dac"), ((data & 0x80) >> 7) * 255);
105
106//  logerror("%s: sound_w %02x\n",cpuexec_describe_context(device->machine),data);
107//  popmessage("%02x",data);
108}
109
110static const ppi8255_interface ppi8255_intf[2] =
111{
112   {
113      DEVCB_INPUT_PORT("DSWA"),      /* Port A read */
114      DEVCB_HANDLER(port1_r),         /* Port B read */
115      DEVCB_NULL,                  /* Port C read */
116      DEVCB_NULL,                  /* Port A write */
117      DEVCB_NULL,                  /* Port B write */
118      DEVCB_HANDLER(sound_w),         /* Port C write */
119   },
120   {
121      DEVCB_INPUT_PORT("IN1"),      /* Port A read */
122      DEVCB_NULL,                  /* Port B read */
123      DEVCB_HANDLER(portC_r),         /* Port C read */
124      DEVCB_NULL,                  /* Port A write */
125      DEVCB_HANDLER(lamps_w),         /* Port B write */
126      DEVCB_NULL                  /* Port C write */
127   }
128};
129
130static MACHINE_RESET( findout )
131{
132   ticket_dispenser_init(machine, 100, 1, 1);
133}
134
135
136static READ8_HANDLER( catchall )
137{
138   int pc = cpu_get_pc(space->cpu);
139
140   if (pc != 0x3c74 && pc != 0x0364 && pc != 0x036d)   /* weed out spurious blit reads */
141      logerror("%04x: unmapped memory read from %04x\n",pc,offset);
142
143   return 0xff;
144}
145
146static WRITE8_HANDLER( banksel_main_w )
147{
148   memory_set_bankptr(space->machine, 1,memory_region(space->machine, "maincpu") + 0x8000);
149}
150static WRITE8_HANDLER( banksel_1_w )
151{
152   memory_set_bankptr(space->machine, 1,memory_region(space->machine, "maincpu") + 0x10000);
153}
154static WRITE8_HANDLER( banksel_2_w )
155{
156   memory_set_bankptr(space->machine, 1,memory_region(space->machine, "maincpu") + 0x18000);
157}
158static WRITE8_HANDLER( banksel_3_w )
159{
160   memory_set_bankptr(space->machine, 1,memory_region(space->machine, "maincpu") + 0x20000);
161}
162static WRITE8_HANDLER( banksel_4_w )
163{
164   memory_set_bankptr(space->machine, 1,memory_region(space->machine, "maincpu") + 0x28000);
165}
166static WRITE8_HANDLER( banksel_5_w )
167{
168   memory_set_bankptr(space->machine, 1,memory_region(space->machine, "maincpu") + 0x30000);
169}
170
171
172/* This signature is used to validate the question ROMs. Simple protection check? */
173static int signature_answer,signature_pos;
174
175static READ8_HANDLER( signature_r )
176{
177   return signature_answer;
178}
179
180static WRITE8_HANDLER( signature_w )
181{
182   if (data == 0) signature_pos = 0;
183   else
184   {
185      static const UINT8 signature[8] = { 0xff, 0x01, 0xfd, 0x05, 0xf5, 0x15, 0xd5, 0x55 };
186
187      signature_answer = signature[signature_pos++];
188
189      signature_pos &= 7;   /* safety; shouldn't happen */
190   }
191}
192
193
194
195static ADDRESS_MAP_START( findout_map, ADDRESS_SPACE_PROGRAM, 8 )
196   AM_RANGE(0x0000, 0x3fff) AM_ROM
197   AM_RANGE(0x4000, 0x47ff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
198   AM_RANGE(0x4800, 0x4803) AM_DEVREADWRITE("ppi8255_0", ppi8255_r,ppi8255_w)
199   AM_RANGE(0x5000, 0x5003) AM_DEVREADWRITE("ppi8255_1", ppi8255_r,ppi8255_w)
200   /* banked ROMs are enabled by low 6 bits of the address */
201   AM_RANGE(0x601f, 0x601f) AM_WRITE(banksel_main_w)
202   AM_RANGE(0x602f, 0x602f) AM_WRITE(banksel_5_w)
203   AM_RANGE(0x6037, 0x6037) AM_WRITE(banksel_4_w)
204   AM_RANGE(0x603b, 0x603b) AM_WRITE(banksel_3_w)
205   AM_RANGE(0x603d, 0x603d) AM_WRITE(banksel_2_w)
206   AM_RANGE(0x603e, 0x603e) AM_WRITE(banksel_1_w)
207   AM_RANGE(0x6200, 0x6200) AM_WRITE(signature_w)
208   AM_RANGE(0x6400, 0x6400) AM_READ(signature_r)
209   AM_RANGE(0x7800, 0x7fff) AM_ROM /*space for diagnostic ROM?*/
210   AM_RANGE(0x8000, 0xffff) AM_ROMBANK(1)
211   AM_RANGE(0x8000, 0x8002) AM_WRITE(findout_drawctrl_w)
212   AM_RANGE(0xc000, 0xffff) AM_WRITE(findout_bitmap_w)  AM_BASE(&videoram)
213   AM_RANGE(0x0000, 0xffff) AM_READ(catchall)
214ADDRESS_MAP_END
215
216#define REELFUN_STANDARD_INPUT \
217   PORT_START("IN0") \
218   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) \
219   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) \
220   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
221   PORT_SERVICE( 0x08, IP_ACTIVE_LOW ) \
222   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
223   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
224   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
225   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
226\
227   PORT_START("IN1")   /* IN1 */\
228   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("1 Left A-Z") \
229   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("2 Right A-Z") \
230   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("3 Select Letter") \
231   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("4 Start")\
232   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("5 Solve Puzzle") \
233   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
234   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
235   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
236
237#define TRIVIA_STANDARD_INPUT \
238   PORT_START("IN0") \
239   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) \
240   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) \
241   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL )      /* ticket status */ \
242   PORT_SERVICE( 0x08, IP_ACTIVE_LOW ) \
243   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
244   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
245   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
246   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
247\
248   PORT_START("IN1")   /* IN1 */\
249   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) \
250   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) \
251   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) \
252   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) \
253   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 ) \
254   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
255   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) \
256   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
257
258static INPUT_PORTS_START( reelfun )
259   PORT_START("DSWA")
260   PORT_DIPNAME( 0x07, 0x01, "Coinage Multiplier" )
261   PORT_DIPSETTING(    0x07, "7" )
262   PORT_DIPSETTING(    0x06, "6" )
263   PORT_DIPSETTING(    0x05, "5" )
264   PORT_DIPSETTING(    0x04, "4" )
265   PORT_DIPSETTING(    0x03, "3" )
266   PORT_DIPSETTING(    0x02, "2" )
267   PORT_DIPSETTING(    0x01, "1" )
268   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
269   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Coinage ) )
270   PORT_DIPSETTING( 0x08, "Credits per Coin" )
271   PORT_DIPSETTING( 0x00, "Coins per Credit" )
272   PORT_DIPNAME( 0x10, 0x10, "Screen" )
273   PORT_DIPSETTING( 0x10, "Horizontal" )
274   PORT_DIPSETTING( 0x00, "Vertical" )
275   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Cabinet ) )
276   PORT_DIPSETTING( 0x20, DEF_STR( Upright ) )
277   PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) )
278   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
279   PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
280   PORT_DIPSETTING( 0x00, DEF_STR( On ) )
281   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
282   PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
283   PORT_DIPSETTING( 0x00, DEF_STR( On ) )
284
285   REELFUN_STANDARD_INPUT
286INPUT_PORTS_END
287
288static INPUT_PORTS_START( findout )
289   PORT_START("DSWA")      /* DSW A */
290   PORT_DIPNAME( 0x07, 0x01, DEF_STR( Coinage ) )
291   PORT_DIPSETTING(    0x07, DEF_STR( 7C_1C ) )
292   PORT_DIPSETTING(    0x06, DEF_STR( 6C_1C ) )
293   PORT_DIPSETTING(    0x05, DEF_STR( 5C_1C ) )
294   PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
295   PORT_DIPSETTING(    0x03, DEF_STR( 3C_1C ) )
296   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
297   PORT_DIPSETTING(    0x01, DEF_STR( 1C_1C ) )
298   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
299   PORT_DIPNAME( 0x08, 0x00, "Game Repetition" )
300   PORT_DIPSETTING( 0x08, DEF_STR( No ) )
301   PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
302   PORT_DIPNAME( 0x10, 0x10, "Orientation" )
303   PORT_DIPSETTING( 0x10, "Horizontal" )
304   PORT_DIPSETTING( 0x00, "Vertical" )
305   PORT_DIPNAME( 0x20, 0x20, "Buy Letter" )
306   PORT_DIPSETTING( 0x20, DEF_STR( No ) )
307   PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
308   PORT_DIPNAME( 0x40, 0x40, "Starting Letter" )
309   PORT_DIPSETTING( 0x40, DEF_STR( No ) )
310   PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
311   PORT_DIPNAME( 0x80, 0x80, "Bonus Letter" )
312   PORT_DIPSETTING( 0x80, DEF_STR( No ) )
313   PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
314
315   REELFUN_STANDARD_INPUT
316INPUT_PORTS_END
317
318static INPUT_PORTS_START( gt103 )
319   PORT_START("DSWA")      /* DSW A */
320   PORT_DIPNAME( 0x07, 0x01, "Coinage Multiplier" )
321   PORT_DIPSETTING(    0x07, "7" )
322   PORT_DIPSETTING(    0x06, "6" )
323   PORT_DIPSETTING(    0x05, "5" )
324   PORT_DIPSETTING(    0x04, "4" )
325   PORT_DIPSETTING(    0x03, "3" )
326   PORT_DIPSETTING(    0x02, "2" )
327   PORT_DIPSETTING(    0x01, "1" )
328   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
329   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Coinage ) )
330   PORT_DIPSETTING( 0x08, "Credits per Coin" )
331   PORT_DIPSETTING( 0x00, "Coins per Credit" )
332   PORT_DIPNAME( 0x10, 0x10, "Screen" )
333   PORT_DIPSETTING( 0x10, "Horizontal" )
334   PORT_DIPSETTING( 0x00, "Vertical" )
335   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Cabinet ) )
336   PORT_DIPSETTING( 0x20, DEF_STR( Upright ) )
337   PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) )
338   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
339   PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
340   PORT_DIPSETTING( 0x00, DEF_STR( On ) )
341   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
342   PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
343   PORT_DIPSETTING( 0x00, DEF_STR( On ) )
344
345   TRIVIA_STANDARD_INPUT
346INPUT_PORTS_END
347
348static INPUT_PORTS_START( gt103a )
349   PORT_START("DSWA")
350   PORT_DIPNAME( 0x03, 0x01, "Questions" )
351   PORT_DIPSETTING(    0x00, "4" )
352   PORT_DIPSETTING(    0x01, "5" )
353//  PORT_DIPSETTING(    0x02, "5" )
354   PORT_DIPSETTING(    0x03, "6" )
355   PORT_DIPNAME( 0x04, 0x00, "Show Answer" )
356   PORT_DIPSETTING(    0x04, DEF_STR( No ) )
357   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
358   PORT_DIPNAME( 0x08, 0x00, "Max Coins" )
359   PORT_DIPSETTING(    0x08, "30" )
360   PORT_DIPSETTING(    0x00, "10" )
361   PORT_DIPNAME( 0x10, 0x00, "Timeout" )
362   PORT_DIPSETTING(    0x10, DEF_STR( No ) )
363   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
364   PORT_DIPNAME( 0x20, 0x00, "Tickets" )
365   PORT_DIPSETTING(    0x20, DEF_STR( No ) )
366   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
367   PORT_DIPNAME( 0x40, 0x40, "No Coins" )
368   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
369   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
370   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
371   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
372   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
373
374   PORT_START("IN0")
375   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(2) PORT_CONDITION("DSWA", 0x40, PORTCOND_EQUALS, 0x40)
376   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_IMPULSE(2) PORT_CONDITION("DSWA", 0x40, PORTCOND_EQUALS, 0x00) PORT_NAME ("Start in no coins mode")
377   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2) PORT_CONDITION("DSWA", 0x40, PORTCOND_EQUALS, 0x40)
378   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_CONDITION("DSWA", 0x40, PORTCOND_EQUALS, 0x00)
379   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL )      /* ticket status */
380   PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
381   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
382   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
383   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
384   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
385
386   PORT_START("IN1")   /* IN1 */
387   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
388   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 )
389   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 )
390   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 )
391   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON5 )
392   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
393   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
394   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
395INPUT_PORTS_END
396
397static INPUT_PORTS_START( quiz )
398   PORT_INCLUDE( gt103a )
399
400   PORT_MODIFY("DSWA")
401   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )   /* no tickets */
402   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
403   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
404
405   PORT_MODIFY("IN0")
406   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* no coin 2 */
407   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )   /* no tickets */
408INPUT_PORTS_END
409
410static INPUT_PORTS_START( gt507uk )
411   PORT_START("DSWA")      /* DSW A */
412   PORT_DIPNAME( 0x01, 0x00, "If Ram Error" )
413   PORT_DIPSETTING( 0x01, "Freeze" )
414   PORT_DIPSETTING( 0x00, "Play" )
415   PORT_DIPNAME( 0x0a, 0x08, "Payout" )
416   PORT_DIPSETTING( 0x0a, "Bank" )
417   PORT_DIPSETTING( 0x08, "N/A" )
418   PORT_DIPSETTING( 0x02, "Credit" )
419   PORT_DIPSETTING( 0x00, "Direct" )
420   PORT_DIPNAME( 0x04, 0x04, "Payout Hardware" )
421   PORT_DIPSETTING( 0x04, "Hopper" )
422   PORT_DIPSETTING( 0x00, "Solenoid" )
423   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
424   PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
425   PORT_DIPSETTING( 0x00, DEF_STR( On ) )
426   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
427   PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
428   PORT_DIPSETTING( 0x00, DEF_STR( On ) )
429   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
430   PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
431   PORT_DIPSETTING( 0x00, DEF_STR( On ) )
432   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
433   PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
434   PORT_DIPSETTING( 0x00, DEF_STR( On ) )
435
436   TRIVIA_STANDARD_INPUT
437   PORT_MODIFY("IN0")
438   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_IMPULSE(2)
439   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_IMPULSE(2)   /* coin 3, 2, 4 order verified in test mode */
440   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN4 ) PORT_IMPULSE(2)
441INPUT_PORTS_END
442
443
444
445static MACHINE_DRIVER_START( findout )
446
447   /* basic machine hardware */
448   MDRV_CPU_ADD("maincpu", Z80,4000000)   /* 4 MHz */
449   MDRV_CPU_PROGRAM_MAP(findout_map)
450   MDRV_CPU_VBLANK_INT("screen", nmi_line_pulse)
451
452   MDRV_MACHINE_RESET(findout)
453   MDRV_NVRAM_HANDLER(generic_0fill)
454
455   /* video hardware */
456   MDRV_SCREEN_ADD("screen", RASTER)
457   MDRV_SCREEN_REFRESH_RATE(60)
458   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
459   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
460   MDRV_SCREEN_SIZE(512, 256)
461   MDRV_SCREEN_VISIBLE_AREA(48, 511-48, 16, 255-16)
462
463   MDRV_PALETTE_LENGTH(256)
464
465   MDRV_VIDEO_START(generic_bitmapped)
466   MDRV_VIDEO_UPDATE(generic_bitmapped)
467
468   MDRV_PPI8255_ADD( "ppi8255_0", ppi8255_intf[0] )
469   MDRV_PPI8255_ADD( "ppi8255_1", ppi8255_intf[1] )
470
471   /* sound hardware */
472   MDRV_SPEAKER_STANDARD_MONO("mono")
473
474   MDRV_SOUND_ADD("dac", DAC, 0)
475   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
476MACHINE_DRIVER_END
477
478
479
480/***************************************************************************
481
482  Game driver(s)
483
484***************************************************************************/
485
486ROM_START( reelfun ) /* v7.01 */
487   ROM_REGION( 0x38000, "maincpu", 0 )
488   ROM_LOAD( "reelfun.cnt",          0x00000, 0x4000, CRC(d9d1e92b) SHA1(337f66a37b3734d565b3ff3d912e0f690fd7c445) )
489   ROM_LOAD( "reelfun.prg",          0x08000, 0x2000, CRC(615d846a) SHA1(ffa1c47393f4f364aa34d14cf3ac2f56d9eaecb0) )   /* banked */
490   ROM_LOAD( "reelfun-1-title",      0x10000, 0x8000, CRC(0e165fbc) SHA1(a3a5b7db72ab86efe973f649f5dfe5133830e3fc) )   /* banked ROMs for solution data */
491   ROM_LOAD( "reelfun-2-place",      0x18000, 0x8000, CRC(a0066bfd) SHA1(b6f031ab50eb396be79e79e06f2101400683ec3e) )
492   ROM_LOAD( "reelfun-3-phrase",     0x20000, 0x8000, CRC(199e36b0) SHA1(d9dfe39c9a4fca1169150f8941f8ebc499dfbaf5) )
493   ROM_LOAD( "reelfun-4-person",     0x28000, 0x8000, CRC(49b0710b) SHA1(a38b3251bcb8683d43bdb903036970140a9735e6) )
494   ROM_LOAD( "reelfun-5-song_title", 0x30000, 0x8000, CRC(cce01c45) SHA1(c484f5828928edf39335cedf21acab0b9e2a6881) )
495ROM_END
496
497ROM_START( findout )
498   ROM_REGION( 0x38000, "maincpu", 0 )
499   ROM_LOAD( "12.bin",       0x00000, 0x4000, CRC(21132d4c) SHA1(e3562ee2f46b3f022a852a0e0b1c8fb8164f64a3) )
500   ROM_LOAD( "11.bin",       0x08000, 0x2000, CRC(0014282c) SHA1(c6792f2ff712ba3759ff009950d78750df844d01) )   /* banked */
501   ROM_LOAD( "13.bin",       0x10000, 0x8000, CRC(cea91a13) SHA1(ad3b395ab0362f3decf178824b1feb10b6335bb3) )   /* banked ROMs for solution data */
502   ROM_LOAD( "14.bin",       0x18000, 0x8000, CRC(2a433a40) SHA1(4132d81256db940789a40aa1162bf1b3997cb23f) )
503   ROM_LOAD( "15.bin",       0x20000, 0x8000, CRC(d817b31e) SHA1(11e6e1042ee548ce2080127611ce3516a0528ae0) )
504   ROM_LOAD( "16.bin",       0x28000, 0x8000, CRC(143f9ac8) SHA1(4411e8ba853d7d5c032115ce23453362ab82e9bb) )
505   ROM_LOAD( "17.bin",       0x30000, 0x8000, CRC(dd743bc7) SHA1(63f7e01ac5cda76a1d3390b6b83f4429b7d3b781) )
506
507   ROM_REGION( 0x0200, "gfx2", 0 )
508   ROM_LOAD( "82s147.bin",   0x0000, 0x0200, CRC(f3b663bb) SHA1(5a683951c8d3a2baac4b49e379d6e10e35465c8a) )   /* unknown */
509ROM_END
510
511ROM_START( gt507uk )
512   ROM_REGION( 0x38000, "maincpu", 0 )
513   ROM_LOAD( "triv_3_2.bin",    0x00000, 0x4000, CRC(2d72a081) SHA1(8aa32acf335d027466799b097e0de66bcf13247f) )
514   ROM_LOAD( "rom_ad.bin",      0x08000, 0x2000, CRC(c81cc847) SHA1(057b7b75a2fe1abf88b23e7b2de230d9f96139f5) )
515   ROM_LOAD( "aerospace",       0x10000, 0x8000, CRC(cb555d46) SHA1(559ae05160d7893ff96311a2177eba039a4cf186) )
516   ROM_LOAD( "english_sport_4", 0x18000, 0x8000, CRC(6ae8a63d) SHA1(c6018141d8bbe0ed7619980bf7da89dd91d7fcc2) )
517   ROM_LOAD( "general_facts",   0x20000, 0x8000, CRC(f921f108) SHA1(fd72282df5cee0e6ab55268b40785b3dc8e3d65b) )
518   ROM_LOAD( "horrors",         0x28000, 0x8000, CRC(5f7b262a) SHA1(047480d6bf5c6d0603d538b84c996bd226f07f77) )
519   ROM_LOAD( "pop_music",       0x30000, 0x8000, CRC(884fec7c) SHA1(b389216c17f516df4e15eee46246719dd4acb587) )
520ROM_END
521
522ROM_START( gt5 ) /* v5.06, From a TRIV3D romboard */
523   ROM_REGION( 0x38000, "maincpu", 0 )
524   ROM_LOAD( "program",         0x00000, 0x4000, CRC(e9d6226c) SHA1(42e62c5cafa3f051bf48c18c8c549ffcd4c766c5) )
525   ROM_LOAD( "entertainment_2", 0x10000, 0x8000, CRC(c75c2331) SHA1(9c5947616a4cba2623c599def6cf3b2b1981b681) ) /* rom / question set #15 */
526   ROM_LOAD( "facts_2",         0x18000, 0x8000, CRC(7836ef31) SHA1(6a84cfa39de392eed46a4b37752e00b6d094bbd6) )
527   ROM_LOAD( "new_science_3",   0x20000, 0x8000, CRC(fcbc3bc3) SHA1(2dbdd39dce9dbf53c0954dec44a4f5109243dc60) )
528   ROM_LOAD( "nfl_football",    0x28000, 0x8000, CRC(42eb2849) SHA1(c24e681a508ef8350f7e5d50aea2c31cf70ce5c9) )
529   ROM_LOAD( "adult_sex_6",     0x30000, 0x8000, CRC(d66f35f7) SHA1(81b56756230b27b0903d0c5df30439726526afe2) )
530ROM_END
531
532ROM_START( gtsers8 )
533   ROM_REGION( 0x38000, "maincpu", 0 )
534   ROM_LOAD( "prog1_versionc",  0x00000, 0x4000, CRC(340246a4) SHA1(d655e1cf2b1e87a05e87ff6af4b794e6d54a2a52) )
535   ROM_LOAD( "science",         0x10000, 0x8000, CRC(2f940ebd) SHA1(bead4988ac0a97d70f2a3c0b40a05968436de2ed) )
536   ROM_LOAD( "general",         0x18000, 0x8000, CRC(1efa01c3) SHA1(801ef5ab55184e488b08ef99ebd641ea4f7edb24) )
537   ROM_LOAD( "sports",          0x20000, 0x8000, CRC(6bd1ba9a) SHA1(7caac1bd438a9b1d11fb33e11814b5d76951211a) )
538   ROM_LOAD( "soccer",          0x28000, 0x8000, CRC(f821f860) SHA1(b0437ef5d31c507c6499c1fb732d2ba3b9beb151) )
539   ROM_LOAD( "potpourri",       0x30000, 0x8000, CRC(f2968a28) SHA1(87c08c59dfee71e7bf071f09c3017c750a1c5694) )
540   /* Missing Alternate question set: "Adult Sex" */
541ROM_END
542
543ROM_START( gtsers9 )
544   ROM_REGION( 0x38000, "maincpu", 0 )
545   ROM_LOAD( "prog1_versionc",  0x00000, 0x4000, CRC(340246a4) SHA1(d655e1cf2b1e87a05e87ff6af4b794e6d54a2a52) )
546   ROM_LOAD( "facts",           0x10000, 0x8000, CRC(21bd6181) SHA1(609ae1097a4011e90d03d4c4f03140fbe84c084a) )
547   ROM_LOAD( "rock-n-roll",     0x18000, 0x8000, CRC(1be036b1) SHA1(0b262906044950319dd911b956ac2e0b433f6c7f) )
548   ROM_LOAD( "television",      0x20000, 0x8000, CRC(731d4cc0) SHA1(184b6e48edda24f50e377a473a1a4709a218181b) )
549   ROM_LOAD( "usa_trivia",      0x28000, 0x8000, CRC(829543b4) SHA1(deb0a4132852643ad884cf194b0a2e6671aa2b4e) )
550   ROM_LOAD( "adult_sex_2",     0x30000, 0x8000, CRC(0d683f21) SHA1(f47ce3c31c4c5ed02247fa280303e6ae760315df) ) /* Listed as an alternate question set */
551   /* Missing "Artists-Athletes" */
552ROM_END
553
554ROM_START( gtsers10 )
555   ROM_REGION( 0x38000, "maincpu", 0 )
556   ROM_LOAD( "prog1_versionc", 0x00000, 0x4000, CRC(340246a4) SHA1(d655e1cf2b1e87a05e87ff6af4b794e6d54a2a52) )
557   ROM_LOAD( "new_general",    0x10000, 0x8000, CRC(ba1f5b92) SHA1(7e94be0ef6904331d3a6b266e5887e9a15c5e7f9) )
558   ROM_LOAD( "new_tv_mash",    0x18000, 0x8000, CRC(f73240c6) SHA1(78020644074da719414133a86a91c1328e5d8929) )
559   ROM_LOAD( "new_entrtnmnt",  0x20000, 0x8000, CRC(0f54340c) SHA1(1ca4c23b542339791a2d8f4a9a857f755feca8a1) )
560   ROM_LOAD( "new_sports",     0x28000, 0x8000, CRC(19eff1a3) SHA1(8e024ae6cc572176c90d819a438ace7b2512dbf2) )
561   ROM_LOAD( "adult_sex_3",    0x30000, 0x8000, CRC(2c46e355) SHA1(387ab389abaaea8e870b00039dd884237f7dd9c6) ) /* Listed as an alternate question set */
562   /* Missing "New Science" */
563ROM_END
564
565ROM_START( gtsers11 )
566   ROM_REGION( 0x38000, "maincpu", 0 )
567   ROM_LOAD( "prog1_versionc", 0x00000, 0x4000, CRC(340246a4) SHA1(d655e1cf2b1e87a05e87ff6af4b794e6d54a2a52) )
568   ROM_LOAD( "rich-famous",    0x10000, 0x8000, CRC(39e07e4a) SHA1(6e5a0bcefaa1169f313e8818cf50919108b3e121) )
569   ROM_LOAD( "cars-women",     0x18000, 0x8000, CRC(4c5dd1df) SHA1(f3e2146eeab07ec71617c7614c6e8f6bc844e6e3) )
570   ROM_LOAD( "aerospace",      0x20000, 0x8000, CRC(cb555d46) SHA1(559ae05160d7893ff96311a2177eba039a4cf186) )
571   ROM_LOAD( "tv_music",       0x28000, 0x8000, CRC(5138e0fb) SHA1(102146d63752258c2fda95df49289c42b392c838) )
572   ROM_LOAD( "gay_times",      0x30000, 0x8000, CRC(c4f9a8cf) SHA1(9247ecc5708aba263e0365fc43a1a7d0c2b7c391) ) /* Listed as an alternate question set */
573   /* Missing "General Facts" */
574ROM_END
575
576ROM_START( gt103a1 )
577   ROM_REGION( 0x38000, "maincpu", 0 )
578   ROM_LOAD( "prog1_versiona",  0x00000, 0x4000, CRC(537d6566) SHA1(282a33e4a9fc54d34094393c00026bf31ccd6ab5) )
579   ROM_LOAD( "new_science_2",   0x10000, 0x8000, CRC(3bd80fb8) SHA1(9a196595bc5dc6ed5ee5853786839ed4847fa436) ) /* Questions from an unknown set, will be corrected when verified */
580   ROM_LOAD( "nfl_football",    0x18000, 0x8000, CRC(d676b7cd) SHA1(d652d2441adb500f7af526d110d0335ea453d75b) ) /* These questions are likely mix-n-match do to opperator swaps   */
581   ROM_LOAD( "rock_music",      0x20000, 0x8000, CRC(7f11733a) SHA1(d4d0dee75518edf986cb1241ade45ccb4840f088) ) /* Currently unverified are Series 12, 13 & 14 */
582   ROM_LOAD( "war_and_peace",   0x28000, 0x8000, CRC(bc709383) SHA1(2fba4c80773abea7bbd826c39378b821cddaa255) )
583   ROM_LOAD( "entertainment",   0x30000, 0x8000, CRC(07068c9f) SHA1(1aedc78d071281ec8b08488cd82655d41a77cf6b) )
584ROM_END
585
586ROM_START( gt103a2 )
587   ROM_REGION( 0x38000, "maincpu", 0 )
588   ROM_LOAD( "prog1_versionc",  0x00000, 0x4000, CRC(340246a4) SHA1(d655e1cf2b1e87a05e87ff6af4b794e6d54a2a52) )
589   ROM_LOAD( "vices",           0x10000, 0x8000, CRC(e6069955) SHA1(68f7453f21a4ce1be912141bbe947fbd81d918a3) ) /* Questions from an unknown set, will be corrected when verified */
590   ROM_LOAD( "cops_&_robbers",  0x18000, 0x8000, CRC(8b367c33) SHA1(013468157bf469c9cf138809fdc45b3ba60a423b) ) /* These questions are likely mix-n-match do to opperator swaps   */
591   ROM_LOAD( "famous_couples",  0x20000, 0x8000, CRC(e0618218) SHA1(ff64fcd6dec83a2271b63c3ae64dc932a3954ec5) ) /* Currently unverified are Series 12, 13 & 14 */
592   ROM_LOAD( "famous_quotes",   0x28000, 0x8000, CRC(0a27d8ae) SHA1(427e6ae25e47da7f7f7c3e92a37e330d711da90c) )
593ROM_END
594
595ROM_START( gt103a3 )
596   ROM_REGION( 0x38000, "maincpu", 0 )
597   ROM_LOAD( "t_3a-8_1.bin",    0x00000, 0x4000, CRC(02aef306) SHA1(1ffc10c79a55d41ea36bcaab13cb3f02cb3f9712) )
598   ROM_LOAD( "rock-n-roll_alt", 0x10000, 0x8000, CRC(8eb83052) SHA1(93e3c1ae6c2048fb44ecafe1013b6a96da38fa84) ) /* Questions from an unknown set, will be corrected when verified */
599   ROM_LOAD( "history-geog.",   0x18000, 0x8000, CRC(c9a70fc3) SHA1(4021e5d702844416e8c798ed0a57c9ecd20b1d4b) ) /* These questions are likely mix-n-match do to opperator swaps   */
600   ROM_LOAD( "the_sixties",     0x20000, 0x8000, CRC(8cfa854e) SHA1(81428c12f99841db1c61b471ac8d00f0c411883b) ) /* Currently unverified are Series 12, 13 & 14 */
601   ROM_LOAD( "tv_comedies",     0x28000, 0x8000, CRC(992ae38e) SHA1(312780d651a85a1c433f587ff2ede579456d3fd9) )
602ROM_END
603
604ROM_START( gt103aa )
605   ROM_REGION( 0x38000, "maincpu", 0 )
606   ROM_LOAD( "t_3a-8_1.bin",      0x00000, 0x4000, CRC(02aef306) SHA1(1ffc10c79a55d41ea36bcaab13cb3f02cb3f9712) )
607   ROM_LOAD( "entertainment_alt", 0x10000, 0x8000, CRC(9a6628b9) SHA1(c0cb7e974329d4d5b91f107296d21a674e35a51b) ) /* Questions from an unknown set, will be corrected when verified */
608   ROM_LOAD( "general_alt",       0x18000, 0x8000, CRC(df34f7f9) SHA1(329d123eea711d5135dc02dd7b89b220ce8ddd28) ) /* These questions are likely mix-n-match do to opperator swaps   */
609   ROM_LOAD( "science_alt",       0x20000, 0x8000, CRC(9eaebd18) SHA1(3a4d787cb006dbb23ce346577cb1bb5e543ba52c) ) /* Currently unverified are Series 12, 13 & 14 */
610   ROM_LOAD( "science_alt2",      0x28000, 0x8000, CRC(ac93d348) SHA1(55550ba6b5daffdf9653854075ad4f8398a5e621) )
611   ROM_LOAD( "sports_alt2",       0x30000, 0x8000, CRC(40207845) SHA1(2dddb9685dcefabfde07057a639aa9d08da2329e) )
612ROM_END
613
614ROM_START( gt103asx )
615   ROM_REGION( 0x38000, "maincpu", 0 )
616   ROM_LOAD( "t_3a-8_1.bin",    0x00000, 0x4000, CRC(02aef306) SHA1(1ffc10c79a55d41ea36bcaab13cb3f02cb3f9712) )
617   ROM_LOAD( "adult_sex_2",     0x10000, 0x8000, CRC(0d683f21) SHA1(f47ce3c31c4c5ed02247fa280303e6ae760315df) )
618   ROM_LOAD( "adult_sex_2_alt", 0x18000, 0x8000, CRC(8c0eacc8) SHA1(ddaa25548d161394b41c65a2db57a9fcf793062b) )
619   ROM_LOAD( "adult_sex_3_alt", 0x20000, 0x8000, CRC(63cbd1d6) SHA1(8dcd5546dc8688d6b8404d5cf63d8a59acc9bf4c) )
620   ROM_LOAD( "adult_sex_4",     0x28000, 0x8000, CRC(36a75071) SHA1(f08d31f241e1dc9b94b940cd2872a692f6f8475b) )
621   ROM_LOAD( "adult_sex_5",     0x30000, 0x8000, CRC(fdbc3729) SHA1(7cb7cec4439ddc39de2f7f62c25623cfb869f493) )
622ROM_END
623
624ROM_START( quiz )
625   ROM_REGION( 0x38000, "maincpu", 0 )
626   ROM_LOAD( "1.bin",        0x00000, 0x4000, CRC(4e3204da) SHA1(291f1c9b8c4c07881621c3ecbba7af80f86b9520) )
627   ROM_LOAD( "2.bin",        0x10000, 0x8000, CRC(b79f3ae1) SHA1(4b4aa50ec95138bc8ee4bc2a61bcbfa2515ac854) )
628   ROM_LOAD( "3.bin",        0x18000, 0x8000, CRC(9c7e9608) SHA1(35ee9aa36d16bca64875640224c7fe9d327a95c3) )
629   ROM_LOAD( "4.bin",        0x20000, 0x8000, CRC(30f6b4d0) SHA1(ab2624eb1a3fd9cd8d44433962d09496cd67d569) )
630   ROM_LOAD( "5.bin",        0x28000, 0x8000, CRC(e9cdae21) SHA1(4de4a4edf9eccd8f9f7b935f47bee42c10ad606f) )
631   ROM_LOAD( "6.bin",        0x30000, 0x8000, CRC(89e2b7e8) SHA1(e85c66f0cf37418f522c2d6384997d52f2f15117) )
632
633   ROM_REGION( 0x0200, "proms", 0 ) /* unknown */
634   ROM_LOAD( "prom_am27s29pc.bin", 0x0000, 0x0200, CRC(19e3f161) SHA1(52da3c1e50c2329454de14cb9c46149e573e562b) )
635ROM_END
636
637ROM_START( quiz211 )
638   ROM_REGION( 0x38000, "maincpu", 0 )
639   ROM_LOAD( "1a.bin",         0x000000, 0x4000, CRC(116de0ea) SHA1(9af97b100aa2c79a58de055abe726d6e2e00aab4) )
640   ROM_CONTINUE(            0x000000, 0x4000 ) // halves identical
641   ROM_LOAD( "hobby.bin",      0x10000, 0x8000, CRC(c86d0c2b) SHA1(987ef17c7b9cc119511a16cbd98ec44d24665af5) )
642   ROM_LOAD( "musica.bin",     0x18000, 0x8000, CRC(6b08990f) SHA1(bbc633dc4e0c395269d3d3fbf1f7617ea7adabf1) )
643   ROM_LOAD( "natura.bin",     0x20000, 0x8000, CRC(f17b0d59) SHA1(ebe3d5a0247f3065f0c5d4ee0b846a737700f379) )
644   ROM_LOAD( "spettacolo.bin", 0x28000, 0x8000, CRC(38b8e37a) SHA1(e6df575f61ac61e825d98eaef99c128647806a75) )
645   ROM_LOAD( "mondiali90.bin", 0x30000, 0x4000, CRC(35622870) SHA1(f2dab64106ca4ef07175a0ad9491470964d8a0d2) )
646
647   ROM_REGION( 0x0e00, "proms", 0 ) /* unknown */
648   ROM_LOAD( "prom_27s13-1.bin", 0x0000, 0x0200, NO_DUMP )
649   ROM_LOAD( "prom_27s13-2.bin", 0x0200, 0x0200, NO_DUMP )
650   ROM_LOAD( "prom_27s13-3.bin", 0x0400, 0x0200, NO_DUMP )
651   ROM_LOAD( "prom_27s13-4.bin", 0x0600, 0x0200, NO_DUMP )
652   ROM_LOAD( "prom_27s13-5.bin", 0x0800, 0x0200, NO_DUMP )
653   ROM_LOAD( "prom_27s13-6.bin", 0x0a00, 0x0200, NO_DUMP )
654   ROM_LOAD( "prom_6349-1n.bin", 0x0c00, 0x0200, CRC(19e3f161) SHA1(52da3c1e50c2329454de14cb9c46149e573e562b) )
655
656   ROM_REGION( 0x0100, "plds", 0 )
657   ROM_LOAD( "pal10l8cn.bin",   0x0000, 0x002c, CRC(86095226) SHA1(e7496efbd5ca240f0df2dfa5627402342c7f5384) )
658ROM_END
659
660/*
661When games are first run a RAM error will occur because the nvram needs initialising.
662When ERROR appears, press F2, then F3 to reset, then F2 again and the game will start
663*/
664
665GAME( 1986, gt507uk,  0,       findout, gt507uk, 0, ROT0, "Grayhound Electronics", "Trivia (UK Version 5.07)",               GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
666GAME( 1986, gt5,      0,       findout, gt103,   0, ROT0, "Grayhound Electronics", "Trivia (Version 5.06)",                  GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
667
668GAME( 1984, gtsers8,  0,       findout, gt103a,  0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 8)",            GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
669GAME( 1984, gtsers9,  gtsers8, findout, gt103a,  0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 9)",            GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
670GAME( 1984, gtsers10, gtsers8, findout, gt103a,  0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 10)",           GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
671GAME( 1984, gtsers11, gtsers8, findout, gt103a,  0, ROT0, "Greyhound Electronics", "Trivia (Questions Series 11)",           GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
672GAME( 1984, gt103a1,  gtsers8, findout, gt103a,  0, ROT0, "Greyhound Electronics", "Trivia (Version 1.03a) (alt 1)",         GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
673GAME( 1984, gt103a2,  gtsers8, findout, gt103a,  0, ROT0, "Greyhound Electronics", "Trivia (Version 1.03a) (alt 2)",         GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
674GAME( 1984, gt103a3,  gtsers8, findout, gt103a,  0, ROT0, "Greyhound Electronics", "Trivia (Version 1.03a) (alt 3)",         GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
675GAME( 1984, gt103aa,  gtsers8, findout, gt103a,  0, ROT0, "Greyhound Electronics", "Trivia (Version 1.03a Alt questions)",   GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
676GAME( 1984, gt103asx, gtsers8, findout, gt103a,  0, ROT0, "Greyhound Electronics", "Trivia (Version 1.03a Sex questions)",   GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
677
678GAME( 1986, quiz,     0,       findout, quiz,    0, ROT0, "Italian bootleg",       "Quiz (Revision 2)",                      GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
679
680GAME( 1986, reelfun,  0,       findout, reelfun, 0, ROT0, "Grayhound Electronics", "Reel Fun (Version 7.01)",                GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
681GAME( 1987, findout,  0,       findout, findout, 0, ROT0, "Elettronolo",           "Find Out (Version 4.04)",                GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
682
683GAME( 1991, quiz211,  0,       findout, quiz,    0, ROT0, "Elettronolo",           "Quiz (Revision 2.11)",                   GAME_WRONG_COLORS | GAME_IMPERFECT_SOUND )
src/mame/drivers/igs_blit.c
r6653r6654
1/***************************************************************************
2
3                      -= IGS Blitter Based Hardware =-
4
5                    driver by   Luca Elia (l.elia@tin.it)
6            code decrypted by   Olivier Galibert
7
8
9CPU     :   68000
10Sound   :   M6295 or ICS2115 + Optional FM
11Video   :   IGS011
12NVRAM   :   Battery for main RAM
13
14---------------------------------------------------------------------------
15Year + Game               FM Sound    Chips
16---------------------------------------------------------------------------
171995  Da Ban Cheng        -           IGS011
181995  Long Hu Bang        -           IGS011
191995  Zhong Guo Long      YM3812      IGS003, IGS011, IGS012, IGSD0301
201996  Long Hu Bang II     YM2413      IGS011
211996  Wan Li Chang Cheng  -           ?
221996  Xing Yen Man Guan   -           ?
231996  Virtua Bowling      -           IGS011, IGS012
24---------------------------------------------------------------------------
25
26To do:
27
28- Protection emulation instead of patching the roms
29- A few graphical bugs
30- vbowl, vbowlj: trackball support, sound is slow and low volume
31
32- lhb: in the copyright screen the '5' in '1995' is drawn by the cpu on layer 5,
33  but with wrong colors (since the top nibble of the affected pixels is left to 0xf)
34  (drgnwrld is like this too, maybe hacked, or a cheap year replacement by IGS)
35
36- dbc: in the title screen the '5' in '1995' is drawn by the cpu with wrong colors.
37  (see above comment)
38  Also the background palette is wrong since the fade routine is called with wrong
39  parameters, but in this case the PCB does the same.
40
41Notes:
42
43- In most games, keep test button pressed during boot for another test mode
44
45***************************************************************************/
46
47#include "driver.h"
48#include "cpu/m68000/m68000.h"
49#include "deprecat.h"
50#include "sound/okim6295.h"
51#include "sound/2413intf.h"
52#include "sound/3812intf.h"
53#include "sound/ics2115.h"
54
55/***************************************************************************
56
57    Video
58
59    There are 8 non scrolling layers as big as the screen (512 x 256).
60    Each layer has 256 colors and its own palette.
61
62    There are 8 priority codes with RAM associated to each (8 x 256 values).
63    For each screen position, to determine which pixel to display, the video
64    chip associates a bit to the opacity of that pixel for each layer
65    (1 = trasparent) to form an address into the selected priority RAM.
66    The value at that address (0-7) is the topmost layer.
67
68***************************************************************************/
69
70static UINT8 *layer[8];
71
72static UINT16 igs_priority, *igs_priority_ram;
73
74static UINT8 chmplst2_pen_hi;   // high 3 bits of pens (chmplst2 only)
75
76
77static WRITE16_HANDLER( igs_priority_w )
78{
79   COMBINE_DATA(&igs_priority);
80
81//  logerror("%06x: igs_priority = %02x\n", cpu_get_pc(space->cpu), igs_priority);
82
83   if (data & ~0x7)
84      logerror("%06x: warning, unknown bits written to igs_priority = %02x\n", cpu_get_pc(space->cpu), igs_priority);
85}
86
87
88static VIDEO_START(igs)
89{
90   int i;
91
92   for (i = 0; i < 8; i++)
93   {
94      layer[i] = auto_alloc_array(machine, UINT8, 512 * 256);
95   }
96
97   chmplst2_pen_hi = 0;
98}
99
100static VIDEO_UPDATE(igs)
101{
102#ifdef MAME_DEBUG
103   int layer_enable = -1;
104#endif
105
106   int x,y,l,scr_addr,pri_addr;
107   UINT16 *pri_ram;
108
109#ifdef MAME_DEBUG
110   if (input_code_pressed(screen->machine, KEYCODE_Z))
111   {
112      int mask = 0;
113      if (input_code_pressed(screen->machine, KEYCODE_Q))   mask |= 0x01;
114      if (input_code_pressed(screen->machine, KEYCODE_W))   mask |= 0x02;
115      if (input_code_pressed(screen->machine, KEYCODE_E))   mask |= 0x04;
116      if (input_code_pressed(screen->machine, KEYCODE_R))   mask |= 0x08;
117      if (input_code_pressed(screen->machine, KEYCODE_A))   mask |= 0x10;
118      if (input_code_pressed(screen->machine, KEYCODE_S))   mask |= 0x20;
119      if (input_code_pressed(screen->machine, KEYCODE_D))   mask |= 0x40;
120      if (input_code_pressed(screen->machine, KEYCODE_F))   mask |= 0x80;
121      if (mask)   layer_enable &= mask;
122   }
123#endif
124
125   pri_ram = &igs_priority_ram[(igs_priority & 7) * 512/2];
126
127   for (y = cliprect->min_y; y <= cliprect->max_y; y++)
128   {
129      for (x = cliprect->min_x; x <= cliprect->max_x; x++)
130      {
131         scr_addr = x + y * 512;
132         pri_addr = 0xff;
133
134         for (l = 0; l < 8; l++)
135         {
136            if (   (layer[l][scr_addr] != 0xff)
137#ifdef MAME_DEBUG
138                  && (layer_enable & (1 << l))
139#endif
140               )
141               pri_addr &= ~(1 << l);
142         }
143
144
145         l   =   pri_ram[pri_addr] & 7;
146
147#ifdef MAME_DEBUG
148         if ((layer_enable != -1) && (pri_addr == 0xff))
149            *BITMAP_ADDR16(bitmap, y, x) = get_black_pen(screen->machine);
150         else
151#endif
152            *BITMAP_ADDR16(bitmap, y, x) = layer[l][scr_addr] | (l << 8);
153      }
154   }
155   return 0;
156}
157
158/***************************************************************************
159
160    In addition to the blitter, the CPU can also read from and write to
161    the framebuffers for the 8 layers, seen as 0x100000 bytes in memory.
162    The first half contains layers 0-3. Layers 4-7 are in the other half.
163
164    The layers are interleaved:
165
166    - bytes 0x00000-0x00003 contain the 1st pixel of layer 0,1,2,3
167    - bytes 0x00004-0x00007 contain the 2nd pixel of layer 0,1,2,3
168    ...
169    - bytes 0x80000-0x80003 contain the 1st pixel of layer 4,5,6,7
170    - bytes 0x80004-0x80007 contain the 2nd pixel of layer 4,5,6,7
171
172    and so on.
173
174***************************************************************************/
175
176static READ16_HANDLER( igs_layers_r )
177{
178   int layer0 = ((offset & (0x80000/2)) ? 4 : 0) + ((offset & 1) ? 0 : 2);
179
180   UINT8 *l0 = layer[layer0];
181   UINT8 *l1 = layer[layer0+1];
182
183   offset >>= 1;
184   offset &= 0x1ffff;
185
186   return (l0[offset] << 8) | l1[offset];
187}
188
189static WRITE16_HANDLER( igs_layers_w )
190{
191   UINT16 word;
192
193   int layer0 = ((offset & (0x80000/2)) ? 4 : 0) + ((offset & 1) ? 0 : 2);
194
195   UINT8 *l0 = layer[layer0];
196   UINT8 *l1 = layer[layer0+1];
197
198   offset >>= 1;
199   offset &= 0x1ffff;
200
201   word = (l0[offset] << 8) | l1[offset];
202   COMBINE_DATA(&word);
203   l0[offset] = word >> 8;
204   l1[offset] = word;
205}
206
207/***************************************************************************
208
209    Blitter
210
211***************************************************************************/
212
213static struct
214{
215
216   UINT16   x, y, w, h,
217         gfx_lo, gfx_hi,
218         depth,
219         pen,
220         flags;
221
222}   blitter;
223
224
225static WRITE16_HANDLER( igs_blit_x_w )      {   COMBINE_DATA(&blitter.x);      }
226static WRITE16_HANDLER( igs_blit_y_w )      {   COMBINE_DATA(&blitter.y);      }
227static WRITE16_HANDLER( igs_blit_gfx_lo_w )   {   COMBINE_DATA(&blitter.gfx_lo);   }
228static WRITE16_HANDLER( igs_blit_gfx_hi_w )   {   COMBINE_DATA(&blitter.gfx_hi);   }
229static WRITE16_HANDLER( igs_blit_w_w )      {   COMBINE_DATA(&blitter.w);      }
230static WRITE16_HANDLER( igs_blit_h_w )      {   COMBINE_DATA(&blitter.h);      }
231static WRITE16_HANDLER( igs_blit_depth_w )   {   COMBINE_DATA(&blitter.depth);   }
232static WRITE16_HANDLER( igs_blit_pen_w )   {   COMBINE_DATA(&blitter.pen);      }
233
234
235static WRITE16_HANDLER( igs_blit_flags_w )
236{
237   int x, xstart, xend, xinc, flipx;
238   int y, ystart, yend, yinc, flipy;
239   int depth4, clear, opaque, z;
240   UINT8 trans_pen, clear_pen, pen_hi, *dest;
241   UINT8 pen = 0;
242
243   UINT8 *gfx      =   memory_region(space->machine, "gfx1");
244   UINT8 *gfx2      =   memory_region(space->machine, "gfx2");
245   int gfx_size   =   memory_region_length(space->machine, "gfx1");
246   int gfx2_size   =   memory_region_length(space->machine, "gfx2");
247
248   const rectangle *clip = video_screen_get_visible_area(space->machine->primary_screen);
249
250   COMBINE_DATA(&blitter.flags);
251
252   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->cpu),
253               blitter.x,blitter.y,blitter.w,blitter.h,blitter.gfx_hi,blitter.gfx_lo,blitter.depth,blitter.pen,blitter.flags);
254
255   dest   =   layer[      blitter.flags & 0x0007   ];
256   opaque   =          !(blitter.flags & 0x0008);
257   clear   =            blitter.flags & 0x0010;
258   flipx   =            blitter.flags & 0x0020;
259   flipy   =            blitter.flags & 0x0040;
260   if               (!(blitter.flags & 0x0400)) return;
261
262   pen_hi   =   (chmplst2_pen_hi & 0x07) << 5;
263
264   // pixel address
265   z      =   blitter.gfx_lo  + (blitter.gfx_hi << 16);
266
267   // what were they smoking???
268   depth4   =   !((blitter.flags & 0x7) < (4 - (blitter.depth & 0x7))) ||
269            (z & 0x800000);      // see chmplst2
270
271   z &= 0x7fffff;
272
273   if (depth4)
274   {
275      z   *=   2;
276      if (gfx2 && (blitter.gfx_hi & 0x80))   trans_pen = 0x1f;   // chmplst2
277      else                           trans_pen = 0x0f;
278
279      clear_pen = blitter.pen | 0xf0;
280   }
281   else
282   {
283      if (gfx2)   trans_pen = 0x1f;   // vbowl
284      else      trans_pen = 0xff;
285
286      clear_pen = blitter.pen;
287   }
288
289   xstart = (blitter.x & 0x1ff) - (blitter.x & 0x200);
290   ystart = (blitter.y & 0x0ff) - (blitter.y & 0x100);
291
292   if (flipx)   { xend = xstart - (blitter.w & 0x1ff) - 1;   xinc = -1; }
293   else      { xend = xstart + (blitter.w & 0x1ff) + 1;   xinc =  1; }
294
295   if (flipy)   { yend = ystart - (blitter.h & 0x0ff) - 1;   yinc = -1; }
296   else      { yend = ystart + (blitter.h & 0x0ff) + 1;   yinc =  1; }
297
298   for (y = ystart; y != yend; y += yinc)
299   {
300      for (x = xstart; x != xend; x += xinc)
301      {
302         // fetch the pixel
303         if (!clear)
304         {
305            if (depth4)      pen = (gfx[(z/2)%gfx_size] >> ((z&1)?4:0)) & 0x0f;
306            else         pen = gfx[z%gfx_size];
307
308            if ( gfx2 )
309            {
310               pen &= 0x0f;
311               if ( gfx2[(z/8)%gfx2_size] & (1 << (z & 7)) )
312                  pen |= 0x10;
313            }
314         }
315
316         // plot it
317         if (x >= clip->min_x && x <= clip->max_x && y >= clip->min_y && y <= clip->max_y)
318         {
319            if      (clear)            dest[x + y * 512] = clear_pen;
320            else if (pen != trans_pen)   dest[x + y * 512] = pen | pen_hi;
321            else if (opaque)         dest[x + y * 512] = 0xff;
322         }
323
324         z++;
325      }
326   }
327
328   #ifdef MAME_DEBUG
329#if 1
330   if (input_code_pressed(space->machine, KEYCODE_Z))
331   {   char buf[20];
332      sprintf(buf, "%02X%02X",blitter.depth,blitter.flags&0xff);
333//      ui_draw_text(buf, blitter.x, blitter.y);    // crashes mame!
334   }
335#endif
336   #endif
337}
338
339/***************************************************************************
340
341    Common functions
342
343***************************************************************************/
344
345// Inputs
346
347static UINT16 igs_dips_sel, igs_input_sel;
348
349static WRITE16_HANDLER( igs_dips_w )
350{
351   COMBINE_DATA(&igs_dips_sel);
352}
353
354#define IGS_DIPS_R( NUM )                                                \
355static READ16_HANDLER( igs_##NUM##_dips_r )                                    \
356{                                                                  \
357   int i;                                                            \
358   UINT16 ret=0;                                                      \
359   static const char *const dipnames[] = { "DSW1", "DSW2", "DSW3", "DSW4", "DSW5" };   \
360                                                                  \
361   for (i = 0; i < NUM; i++)                                             \
362      if ((~igs_dips_sel) & (1 << i) )                                    \
363         ret = input_port_read(space->machine, dipnames[i]);                        \
364                                                                  \
365   /* 0x0100 is blitter busy */                                          \
366   return    (ret & 0xff) | 0x0000;                                          \
367}
368
369// Games have 3 to 5 dips
370IGS_DIPS_R( 3 )
371IGS_DIPS_R( 4 )
372IGS_DIPS_R( 5 )
373
374
375
376// Palette r5g5b5
377// offset+0x000: xRRRRRGG
378// offset+0x800: GGGBBBBB
379
380static WRITE16_HANDLER( igs_palette_w )
381{
382   int rgb;
383
384   COMBINE_DATA(&paletteram16[offset]);
385
386   rgb = (paletteram16[offset & 0x7ff] & 0xff) | ((paletteram16[offset | 0x800] & 0xff) << 8);
387   palette_set_color_rgb(space->machine,offset & 0x7ff,pal5bit(rgb >> 0),pal5bit(rgb >> 5),pal5bit(rgb >> 10));
388}
389
390
391
392/***************************************************************************
393
394    Code Decryption
395
396***************************************************************************/
397
398static void grtwall_decrypt(running_machine *machine)
399{
400   int i;
401   UINT16 *src = (UINT16 *) (memory_region(machine, "maincpu"));
402
403   int rom_size = 0x80000;
404
405   for (i=0; i<rom_size/2; i++)
406   {
407      UINT16 x = src[i];
408
409       if ((i & 0x2000) == 0x0000 || (i & 0x0004) == 0x0000 || (i & 0x0090) == 0x0000)
410         x ^= 0x0004;
411       if ((i & 0x0100) == 0x0100 || (i & 0x0040) == 0x0040 || (i & 0x0012) == 0x0012)
412         x ^= 0x0020;
413       if ((i & 0x2400) == 0x0000 || (i & 0x4100) == 0x4100 || ((i & 0x2000) == 0x2000 && (i & 0x0c00) != 0x0000))
414         x ^= 0x0200;
415       if ((x & 0x0024) == 0x0004 || (x & 0x0024) == 0x0020)
416         x ^= 0x0024;
417      src[i] = x;
418   }
419}
420
421
422static void lhb_decrypt(running_machine *machine)
423{
424   int i;
425   UINT16 *src = (UINT16 *) (memory_region(machine, "maincpu"));
426
427   int rom_size = 0x80000;
428
429   for (i=0; i<rom_size/2; i++)
430   {
431      UINT16 x = src[i];
432
433      if ((i & 0x1100) != 0x0100)
434         x ^= 0x0200;
435
436      if ((i & 0x0150) != 0x0000 && (i & 0x0152) != 0x0010)
437         x ^= 0x0004;
438
439      if ((i & 0x2084) != 0x2084 && (i & 0x2094) != 0x2014)
440         x ^= 0x0020;
441
442      src[i] = x;
443   }
444}
445
446
447static void drgnwrld_type3_decrypt(running_machine *machine)
448{
449   int i;
450   UINT16 *src = (UINT16 *) (memory_region(machine, "maincpu"));
451
452   int rom_size = 0x80000;
453
454   for (i=0; i<rom_size/2; i++)
455   {
456      UINT16 x = src[i];
457
458      if ((i & 0x2000) == 0x0000 || (i & 0x0004) == 0x0000 || (i & 0x0090) == 0x0000)
459         x ^= 0x0004;
460
461      if ((i & 0x0100) == 0x0100 || (i & 0x0040) == 0x0040 || (i & 0x0012) == 0x0012)
462         x ^= 0x0020;
463
464      if ((((i & 0x1000) == 0x1000) ^ ((i & 0x0100) == 0x0100))
465         || (i & 0x0880) == 0x0800 || (i & 0x0240) == 0x0240)
466            x ^= 0x0200;
467
468      if ((x & 0x0024) == 0x0004 || (x & 0x0024) == 0x0020)
469         x ^= 0x0024;
470
471      src[i] = x;
472   }
473}
474
475static void drgnwrld_type2_decrypt(running_machine *machine)
476{
477   int i;
478   UINT16 *src = (UINT16 *) (memory_region(machine, "maincpu"));
479
480   int rom_size = 0x80000;
481
482   for (i=0; i<rom_size/2; i++)
483   {
484      UINT16 x = src[i];
485
486      if(((i & 0x000090) == 0x000000) || ((i & 0x002004) != 0x002004))
487        x ^= 0x0004;
488
489      if((((i & 0x000050) == 0x000000) || ((i & 0x000142) != 0x000000)) && ((i & 0x000150) != 0x000000))
490        x ^= 0x0020;
491
492      if(((i & 0x004280) == 0x004000) || ((i & 0x004080) == 0x000000))
493        x ^= 0x0200;
494
495      if((i & 0x0011a0) != 0x001000)
496        x ^= 0x0200;
497
498      if((i & 0x000180) == 0x000100)
499        x ^= 0x0200;
500
501      if((x & 0x0024) == 0x0020 || (x & 0x0024) == 0x0004)
502        x ^= 0x0024;
503
504      src[i] = x;
505   }
506}
507
508static void drgnwrld_type1_decrypt(running_machine *machine)
509{
510   int i;
511   UINT16 *src = (UINT16 *) (memory_region(machine, "maincpu"));
512
513   int rom_size = 0x80000;
514
515   for (i=0; i<rom_size/2; i++)
516   {
517      UINT16 x = src[i];
518
519      if ((i & 0x2000) == 0x0000 || (i & 0x0004) == 0x0000 || (i & 0x0090) == 0x0000)
520         x ^= 0x0004;
521
522      if ((i & 0x0100) == 0x0100 || (i & 0x0040) == 0x0040 || (i & 0x0012) == 0x0012)
523         x ^= 0x0020;
524/*
525        if ((((i & 0x1000) == 0x1000) ^ ((i & 0x0100) == 0x0100))
526            || (i & 0x0880) == 0x0800 || (i & 0x0240) == 0x0240)
527                x ^= 0x0200;
528*/
529      if ((x & 0x0024) == 0x0004 || (x & 0x0024) == 0x0020)
530         x ^= 0x0024;
531
532      src[i] = x;
533   }
534}
535
536
537static void chmplst2_decrypt(running_machine *machine)
538{
539   int i,j;
540   int rom_size = 0x80000;
541   UINT16 *src = (UINT16 *) (memory_region(machine, "maincpu"));
542   UINT16 *result_data = alloc_array_or_die(UINT16, rom_size/2);
543
544    for (i=0; i<rom_size/2; i++)
545   {
546      UINT16 x = src[i];
547
548      if ((i & 0x0054) != 0x0000 && (i & 0x0056) != 0x0010)
549         x ^= 0x0004;
550
551      if ((i & 0x0204) == 0x0000)
552          x ^= 0x0008;
553
554      if ((i & 0x3080) != 0x3080 && (i & 0x3090) != 0x3010)
555         x ^= 0x0020;
556
557      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);
558
559      result_data[j] = x;
560   }
561
562   memcpy(src,result_data,rom_size);
563
564   free(result_data);
565}
566
567
568static void vbowlj_decrypt(running_machine *machine)
569{
570   int i;
571   UINT16 *src = (UINT16 *) (memory_region(machine, "maincpu"));
572
573   int rom_size = 0x80000;
574
575   for(i=0; i<rom_size/2; i++)
576   {
577      UINT16 x = src[i];
578
579      if((i & 0x4100) == 0x0100)
580         x ^= 0x0200;
581
582      if((i & 0x4000) == 0x4000 && (i & 0x0300) != 0x0100)
583         x ^= 0x0200;
584
585      if((i & 0x5700) == 0x5100)
586         x ^= 0x0200;
587
588      if((i & 0x5500) == 0x1000)
589         x ^= 0x0200;
590
591      if((i & 0x0140) != 0x0000 || (i & 0x0012) == 0x0012)
592         x ^= 0x0004;
593
594      if((i & 0x2004) != 0x2004 || (i & 0x0090) == 0x0000)
595         x ^= 0x0020;
596
597       src[i] = x;
598     }
599}
600
601
602static void dbc_decrypt(running_machine *machine)
603{
604   int i;
605   UINT16 *src = (UINT16 *) (memory_region(machine, "maincpu"));
606
607   int rom_size = 0x80000;
608
609   for (i=0; i<rom_size/2; i++)
610   {
611      UINT16 x = src[i];
612
613      if( i & 0x1000/2 )
614      {
615         if( ~i & 0x400/2 )
616            x ^= 0x0200;
617      }
618
619      if( i & 0x4000/2 )
620      {
621         if( i & 0x100/2 )
622         {
623            if( ~i & 0x08/2 )
624               x ^= 0x0020;
625         }
626         else
627         {
628            if( ~i & 0x28/2 )
629               x ^= 0x0020;
630         }
631      }
632      else
633      {
634         x ^= 0x0020;
635      }
636
637      if( i & 0x200/2 )
638      {
639         x ^= 0x0004;
640      }
641      else
642      {
643         if( (i & 0x80/2) == 0x80/2 || (i & 0x24/2) == 0x24/2 )
644            x ^= 0x0004;
645      }
646
647      src[i] = x;
648   }
649}
650
651
652/***************************************************************************
653
654    Gfx Decryption
655
656***************************************************************************/
657
658
659static void chmplst2_decrypt_gfx(running_machine *machine)
660{
661   int i;
662   unsigned rom_size = 0x200000;
663   UINT8 *src = (UINT8 *) (memory_region(machine, "gfx1"));
664   UINT8 *result_data = alloc_array_or_die(UINT8, rom_size);
665
666   for (i=0; i<rom_size; i++)
667       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)];
668
669   memcpy(src,result_data,rom_size);
670
671   free(result_data);
672}
673
674static void drgnwrld_gfx_decrypt(running_machine *machine)
675{
676   int i;
677   unsigned rom_size = 0x400000;
678   UINT8 *src = (UINT8 *) (memory_region(machine, "gfx1"));
679   UINT8 *result_data = alloc_array_or_die(UINT8, rom_size);
680
681    for (i=0; i<rom_size; i++)
682       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)];
683
684   memcpy(src,result_data,rom_size);
685
686   free(result_data);
687}
688
689
690
691/***************************************************************************
692
693    Protection & I/O
694
695***************************************************************************/
696
697static UINT16 igs_magic[2];
698
699static WRITE16_HANDLER( chmplst2_magic_w )
700{
701   COMBINE_DATA(&igs_magic[offset]);
702
703   if (offset == 0)
704      return;
705
706   switch(igs_magic[0])
707   {
708      case 0x00:
709         COMBINE_DATA(&igs_input_sel);
710
711         if (ACCESSING_BITS_0_7)
712         {
713            coin_counter_w(0,   data & 0x20);
714            //  coin out        data & 0x40
715         }
716
717         if ( igs_input_sel & ~0x7f )
718            logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", cpu_get_pc(space->cpu), igs_input_sel);
719
720//          popmessage("sel2 %02x",igs_input_sel&~0x1f);
721         break;
722
723      case 0x02:
724         if (ACCESSING_BITS_0_7)
725         {
726            chmplst2_pen_hi = data & 0x07;
727
728            okim6295_set_bank_base(devtag_get_device(space->machine, "oki"), (data & 0x08) ? 0x40000 : 0);
729         }
730
731         if ( chmplst2_pen_hi & ~0xf )
732            logerror("%06x: warning, unknown bits written in chmplst2_pen_hi = %02x\n", cpu_get_pc(space->cpu), chmplst2_pen_hi);
733
734//          popmessage("oki %02x",chmplst2_pen_hi & 0x08);
735         break;
736
737      default:
738         logerror("%06x: warning, writing to igs_magic %02x = %02x\n", cpu_get_pc(space->cpu), igs_magic[0], data);
739   }
740}
741
742static READ16_HANDLER( chmplst2_magic_r )
743{
744   switch(igs_magic[0])
745   {
746      case 0x01:
747         if (~igs_input_sel & 0x01)   return input_port_read(space->machine, "KEY0");
748         if (~igs_input_sel & 0x02)   return input_port_read(space->machine, "KEY1");
749         if (~igs_input_sel & 0x04)   return input_port_read(space->machine, "KEY2");
750         if (~igs_input_sel & 0x08)   return input_port_read(space->machine, "KEY3");
751         if (~igs_input_sel & 0x10)   return input_port_read(space->machine, "KEY4");
752         /* fall through */
753      default:
754         logerror("%06x: warning, reading with igs_magic = %02x\n", cpu_get_pc(space->cpu), igs_magic[0]);
755         break;
756
757      case 0x03:   return 0xff;   // ?
758
759      // Protection:
760      // 0544FE: 20 21 22 24 25 26 27 28 2A 2B 2C 2D 2E 30 31 32 33 34
761      // 0544EC: 49 47 53 41 41 7F 41 41 3E 41 49 F9 0A 26 49 49 49 32
762
763      case 0x20:   return 0x49;
764      case 0x21:   return 0x47;
765      case 0x22:   return 0x53;
766
767      case 0x24:   return 0x41;
768      case 0x25:   return 0x41;
769      case 0x26:   return 0x7f;
770      case 0x27:   return 0x41;
771      case 0x28:   return 0x41;
772
773      case 0x2a:   return 0x3e;
774      case 0x2b:   return 0x41;
775      case 0x2c:   return 0x49;
776      case 0x2d:   return 0xf9;
777      case 0x2e:   return 0x0a;
778
779      case 0x30:   return 0x26;
780      case 0x31:   return 0x49;
781      case 0x32:   return 0x49;
782      case 0x33:   return 0x49;
783      case 0x34:   return 0x32;
784   }
785
786   return 0;
787}
788
789
790
791static WRITE16_HANDLER( drgnwrld_magic_w )
792{
793   COMBINE_DATA(&igs_magic[offset]);
794
795   if (offset == 0)
796      return;
797
798   switch(igs_magic[0])
799   {
800
801      case 0x00:
802         if (ACCESSING_BITS_0_7)
803            coin_counter_w(0,data & 2);
804
805         if (data & ~0x2)
806            logerror("%06x: warning, unknown bits written in coin counter = %02x\n", cpu_get_pc(space->cpu), data);
807
808         break;
809
810      default:
811//          popmessage("magic %x <- %04x",igs_magic[0],data);
812         logerror("%06x: warning, writing to igs_magic %02x = %02x\n", cpu_get_pc(space->cpu), igs_magic[0], data);
813   }
814}
815
816static READ16_HANDLER( drgnwrld_magic_r )
817{
818   switch(igs_magic[0])
819   {
820      case 0x00:   return input_port_read(space->machine, "IN0");
821      case 0x01:   return input_port_read(space->machine, "IN1");
822      case 0x02:   return input_port_read(space->machine, "IN2");
823
824      case 0x20:   return 0x49;
825      case 0x21:   return 0x47;
826      case 0x22:   return 0x53;
827
828      case 0x24:   return 0x41;
829      case 0x25:   return 0x41;
830      case 0x26:   return 0x7f;
831      case 0x27:   return 0x41;
832      case 0x28:   return 0x41;
833
834      case 0x2a:   return 0x3e;
835      case 0x2b:   return 0x41;
836      case 0x2c:   return 0x49;
837      case 0x2d:   return 0xf9;
838      case 0x2e:   return 0x0a;
839
840      case 0x30:   return 0x26;
841      case 0x31:   return 0x49;
842      case 0x32:   return 0x49;
843      case 0x33:   return 0x49;
844      case 0x34:   return 0x32;
845
846      default:
847         logerror("%06x: warning, reading with igs_magic = %02x\n", cpu_get_pc(space->cpu), igs_magic[0]);
848   }
849
850   return 0;
851}
852
853
854
855static WRITE16_HANDLER( grtwall_magic_w )
856{
857   COMBINE_DATA(&igs_magic[offset]);
858
859   if (offset == 0)
860      return;
861
862   switch(igs_magic[0])
863   {
864      case 0x02:
865         if (ACCESSING_BITS_0_7)
866         {
867            coin_counter_w(0,data & 0x01);
868
869            okim6295_set_bank_base(devtag_get_device(space->machine, "oki"), (data & 0x10) ? 0x40000 : 0);
870         }
871
872         if (data & ~0x11)
873            logerror("%06x: warning, unknown bits written in coin counter = %02x\n", cpu_get_pc(space->cpu), data);
874
875//          popmessage("coin %02x",data);
876         break;
877
878      default:
879         logerror("%06x: warning, writing to igs_magic %02x = %02x\n", cpu_get_pc(space->cpu), igs_magic[0], data);
880   }
881}
882
883static READ16_HANDLER( grtwall_magic_r )
884{
885   switch(igs_magic[0])
886   {
887      case 0x00:   return input_port_read(space->machine, "IN0");
888
889      case 0x20:   return 0x49;
890      case 0x21:   return 0x47;
891      case 0x22:   return 0x53;
892
893      case 0x24:   return 0x41;
894      case 0x25:   return 0x41;
895      case 0x26:   return 0x7f;
896      case 0x27:   return 0x41;
897      case 0x28:   return 0x41;
898
899      case 0x2a:   return 0x3e;
900      case 0x2b:   return 0x41;
901      case 0x2c:   return 0x49;
902      case 0x2d:   return 0xf9;
903      case 0x2e:   return 0x0a;
904
905      case 0x30:   return 0x26;
906      case 0x31:   return 0x49;
907      case 0x32:   return 0x49;
908      case 0x33:   return 0x49;
909      case 0x34:   return 0x32;
910
911      default:
912         logerror("%06x: warning, reading with igs_magic = %02x\n", cpu_get_pc(space->cpu), igs_magic[0]);
913   }
914
915   return 0;
916}
917
918
919
920static WRITE16_DEVICE_HANDLER( lhb_okibank_w )
921{
922   if (ACCESSING_BITS_8_15)
923   {
924      okim6295_set_bank_base(device, (data & 0x200) ? 0x40000 : 0);
925   }
926
927   if ( data & (~0x200) )
928      logerror("%s: warning, unknown bits written in oki bank = %02x\n", cpuexec_describe_context(device->machine), data);
929
930//  popmessage("oki %04x",data);
931}
932
933static WRITE16_HANDLER( lhb_inputs_w )
934{
935   COMBINE_DATA(&igs_input_sel);
936
937   if (ACCESSING_BITS_0_7)
938   {
939      coin_counter_w(0,          data & 0x20   );
940      //  coin out                 data & 0x40
941      //  pay out?                 data & 0x80
942   }
943
944   if ( igs_input_sel & (~0x7f) )
945      logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", cpu_get_pc(space->cpu), igs_input_sel);
946
947//  popmessage("sel2 %02x",igs_input_sel&~0x1f);
948}
949
950static READ16_HANDLER( lhb_inputs_r )
951{
952   switch(offset)
953   {
954      case 0:      return igs_input_sel;
955
956      case 1:
957         if (~igs_input_sel & 0x01)   return input_port_read(space->machine, "KEY0");
958         if (~igs_input_sel & 0x02)   return input_port_read(space->machine, "KEY1");
959         if (~igs_input_sel & 0x04)   return input_port_read(space->machine, "KEY2");
960         if (~igs_input_sel & 0x08)   return input_port_read(space->machine, "KEY3");
961         if (~igs_input_sel & 0x10)   return input_port_read(space->machine, "KEY4");
962
963         logerror("%06x: warning, reading with igs_input_sel = %02x\n", cpu_get_pc(space->cpu), igs_input_sel);
964         break;
965   }
966   return 0;
967}
968
969
970
971static WRITE16_HANDLER( vbowl_magic_w )
972{
973   COMBINE_DATA(&igs_magic[offset]);
974
975   if (offset == 0)
976      return;
977
978   switch(igs_magic[0])
979   {
980      case 0x02:
981         if (ACCESSING_BITS_0_7)
982         {
983            coin_counter_w(0,data & 1);
984            coin_counter_w(1,data & 2);
985         }
986
987         if (data & ~0x3)
988            logerror("%06x: warning, unknown bits written in coin counter = %02x\n", cpu_get_pc(space->cpu), data);
989
990         break;
991
992      default:
993//          popmessage("magic %x <- %04x",igs_magic[0],data);
994         logerror("%06x: warning, writing to igs_magic %02x = %02x\n", cpu_get_pc(space->cpu), igs_magic[0], data);
995   }
996}
997
998static READ16_HANDLER( vbowl_magic_r )
999{
1000   switch(igs_magic[0])
1001   {
1002      case 0x00:   return input_port_read(space->machine, "IN0");
1003      case 0x01:   return input_port_read(space->machine, "IN1");
1004
1005      case 0x20:   return 0x49;
1006      case 0x21:   return 0x47;
1007      case 0x22:   return 0x53;
1008
1009      case 0x24:   return 0x41;
1010      case 0x25:   return 0x41;
1011      case 0x26:   return 0x7f;
1012      case 0x27:   return 0x41;
1013      case 0x28:   return 0x41;
1014
1015      case 0x2a:   return 0x3e;
1016      case 0x2b:   return 0x41;
1017      case 0x2c:   return 0x49;
1018      case 0x2d:   return 0xf9;
1019      case 0x2e:   return 0x0a;
1020
1021      case 0x30:   return 0x26;
1022      case 0x31:   return 0x49;
1023      case 0x32:   return 0x49;
1024      case 0x33:   return 0x49;
1025      case 0x34:   return 0x32;
1026
1027      default:
1028         logerror("%06x: warning, reading with igs_magic = %02x\n", cpu_get_pc(space->cpu), igs_magic[0]);
1029   }
1030
1031   return 0;
1032}
1033
1034
1035
1036static WRITE16_HANDLER( xymg_magic_w )
1037{
1038   COMBINE_DATA(&igs_magic[offset]);
1039
1040   if (offset == 0)
1041      return;
1042
1043   switch(igs_magic[0])
1044   {
1045      case 0x01:
1046         COMBINE_DATA(&igs_input_sel);
1047
1048         if (ACCESSING_BITS_0_7)
1049         {
1050            coin_counter_w(0,   data & 0x20);
1051            //  coin out        data & 0x40
1052         }
1053
1054         if ( igs_input_sel & ~0x3f )
1055            logerror("%06x: warning, unknown bits written in igs_input_sel = %02x\n", cpu_get_pc(space->cpu), igs_input_sel);
1056
1057//          popmessage("sel2 %02x",igs_input_sel&~0x1f);
1058         break;
1059
1060      default:
1061         logerror("%06x: warning, writing to igs_magic %02x = %02x\n", cpu_get_pc(space->cpu), igs_magic[0], data);
1062   }
1063}
1064
1065static READ16_HANDLER( xymg_magic_r )
1066{
1067   switch(igs_magic[0])
1068   {
1069      case 0x00:   return input_port_read(space->machine, "COIN");
1070
1071      case 0x02:
1072         if (~igs_input_sel & 0x01)   return input_port_read(space->machine, "KEY0");
1073         if (~igs_input_sel & 0x02)   return input_port_read(space->machine, "KEY1");
1074         if (~igs_input_sel & 0x04)   return input_port_read(space->machine, "KEY2");
1075         if (~igs_input_sel & 0x08)   return input_port_read(space->machine, "KEY3");
1076         if (~igs_input_sel & 0x10)   return input_port_read(space->machine, "KEY4");
1077         /* fall through */
1078
1079      case 0x20:   return 0x49;
1080      case 0x21:   return 0x47;
1081      case 0x22:   return 0x53;
1082
1083      case 0x24:   return 0x41;
1084      case 0x25:   return 0x41;
1085      case 0x26:   return 0x7f;
1086      case 0x27:   return 0x41;
1087      case 0x28:   return 0x41;
1088
1089      case 0x2a:   return 0x3e;
1090      case 0x2b:   return 0x41;
1091      case 0x2c:   return 0x49;
1092      case 0x2d:   return 0xf9;
1093      case 0x2e:   return 0x0a;
1094
1095      case 0x30:   return 0x26;
1096      case 0x31:   return 0x49;
1097      case 0x32:   return 0x49;
1098      case 0x33:   return 0x49;
1099      case 0x34:   return 0x32;
1100
1101      default:
1102         logerror("%06x: warning, reading with igs_magic = %02x\n", cpu_get_pc(space->cpu), igs_magic[0]);
1103         break;
1104   }
1105
1106   return 0;
1107}
1108
1109
1110
1111/***************************************************************************
1112
1113    Memory Maps
1114
1115***************************************************************************/
1116
1117static ADDRESS_MAP_START( drgnwrld, ADDRESS_SPACE_PROGRAM, 16 )
1118   AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
1119   AM_RANGE( 0x100000, 0x103fff ) AM_RAM AM_BASE( &generic_nvram16 ) AM_SIZE( &generic_nvram_size )
1120   AM_RANGE( 0x200000, 0x200fff ) AM_RAM AM_BASE( &igs_priority_ram )
1121   AM_RANGE( 0x400000, 0x401fff ) AM_RAM_WRITE( igs_palette_w ) AM_BASE( &paletteram16 )
1122   AM_RANGE( 0x500000, 0x500001 ) AM_READ_PORT( "COIN" )
1123   AM_RANGE( 0x600000, 0x600001 ) AM_DEVREADWRITE8( "oki", okim6295_r, okim6295_w, 0x00ff )
1124   AM_RANGE( 0x700000, 0x700003 ) AM_DEVWRITE8( "ym", ym3812_w, 0x00ff )
1125   AM_RANGE( 0x800000, 0x800003 ) AM_WRITE( drgnwrld_magic_w )
1126   AM_RANGE( 0x800002, 0x800003 ) AM_READ ( drgnwrld_magic_r )
1127   AM_RANGE( 0xa20000, 0xa20001 ) AM_WRITE( igs_priority_w )
1128   AM_RANGE( 0xa40000, 0xa40001 ) AM_WRITE( igs_dips_w )
1129   AM_RANGE( 0xa58000, 0xa58001 ) AM_WRITE( igs_blit_x_w )
1130   AM_RANGE( 0xa58800, 0xa58801 ) AM_WRITE( igs_blit_y_w )
1131   AM_RANGE( 0xa59000, 0xa59001 ) AM_WRITE( igs_blit_w_w )
1132   AM_RANGE( 0xa59800, 0xa59801 ) AM_WRITE( igs_blit_h_w )
1133   AM_RANGE( 0xa5a000, 0xa5a001 ) AM_WRITE( igs_blit_gfx_lo_w )
1134   AM_RANGE( 0xa5a800, 0xa5a801 ) AM_WRITE( igs_blit_gfx_hi_w )
1135   AM_RANGE( 0xa5b000, 0xa5b001 ) AM_WRITE( igs_blit_flags_w )
1136   AM_RANGE( 0xa5b800, 0xa5b801 ) AM_WRITE( igs_blit_pen_w )
1137   AM_RANGE( 0xa5c000, 0xa5c001 ) AM_WRITE( igs_blit_depth_w )
1138   AM_RANGE( 0xa88000, 0xa88001 ) AM_READ( igs_3_dips_r )
1139ADDRESS_MAP_END
1140
1141
1142static ADDRESS_MAP_START( chmplst2, ADDRESS_SPACE_PROGRAM, 16 )
1143   AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
1144   AM_RANGE( 0x100000, 0x103fff ) AM_RAM AM_BASE( &generic_nvram16 ) AM_SIZE( &generic_nvram_size )
1145   AM_RANGE( 0x200000, 0x200001 ) AM_DEVREADWRITE8( "oki", okim6295_r, okim6295_w, 0x00ff )
1146   AM_RANGE( 0x204000, 0x204003 ) AM_DEVWRITE8( "ym", ym2413_w, 0x00ff )
1147   AM_RANGE( 0x208000, 0x208003 ) AM_WRITE( chmplst2_magic_w )
1148   AM_RANGE( 0x208002, 0x208003 ) AM_READ ( chmplst2_magic_r )
1149   AM_RANGE( 0x20c000, 0x20cfff ) AM_RAM AM_BASE(&igs_priority_ram)
1150   AM_RANGE( 0x210000, 0x211fff ) AM_RAM_WRITE( igs_palette_w ) AM_BASE( &paletteram16 )
1151   AM_RANGE( 0x214000, 0x214001 ) AM_READ_PORT( "COIN" )
1152   AM_RANGE( 0x300000, 0x3fffff ) AM_READWRITE( igs_layers_r, igs_layers_w )
1153   AM_RANGE( 0xa20000, 0xa20001 ) AM_WRITE( igs_priority_w )
1154   AM_RANGE( 0xa40000, 0xa40001 ) AM_WRITE( igs_dips_w )
1155   AM_RANGE( 0xa58000, 0xa58001 ) AM_WRITE( igs_blit_x_w )
1156   AM_RANGE( 0xa58800, 0xa58801 ) AM_WRITE( igs_blit_y_w )
1157   AM_RANGE( 0xa59000, 0xa59001 ) AM_WRITE( igs_blit_w_w )
1158   AM_RANGE( 0xa59800, 0xa59801 ) AM_WRITE( igs_blit_h_w )
1159   AM_RANGE( 0xa5a000, 0xa5a001 ) AM_WRITE( igs_blit_gfx_lo_w )
1160   AM_RANGE( 0xa5a800, 0xa5a801 ) AM_WRITE( igs_blit_gfx_hi_w )
1161   AM_RANGE( 0xa5b000, 0xa5b001 ) AM_WRITE( igs_blit_flags_w )
1162   AM_RANGE( 0xa5b800, 0xa5b801 ) AM_WRITE( igs_blit_pen_w )
1163   AM_RANGE( 0xa5c000, 0xa5c001 ) AM_WRITE( igs_blit_depth_w )
1164   AM_RANGE( 0xa88000, 0xa88001 ) AM_READ( igs_3_dips_r )
1165ADDRESS_MAP_END
1166
1167
1168static ADDRESS_MAP_START( grtwall, ADDRESS_SPACE_PROGRAM, 16 )
1169   AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
1170   AM_RANGE( 0x100000, 0x103fff ) AM_RAM AM_BASE( &generic_nvram16 ) AM_SIZE( &generic_nvram_size )
1171   AM_RANGE( 0x200000, 0x200fff ) AM_RAM AM_BASE( &igs_priority_ram )
1172   AM_RANGE( 0x300000, 0x3fffff ) AM_READWRITE( igs_layers_r, igs_layers_w )
1173   AM_RANGE( 0x400000, 0x401fff ) AM_RAM_WRITE( igs_palette_w ) AM_BASE( &paletteram16 )
1174   AM_RANGE( 0x520000, 0x520001 ) AM_READ_PORT( "COIN" )
1175   AM_RANGE( 0x600000, 0x600001 ) AM_DEVREADWRITE8( "oki", okim6295_r, okim6295_w, 0x00ff )
1176   AM_RANGE( 0x800000, 0x800003 ) AM_WRITE( grtwall_magic_w )
1177   AM_RANGE( 0x800002, 0x800003 ) AM_READ ( grtwall_magic_r )
1178   AM_RANGE( 0xa20000, 0xa20001 ) AM_WRITE( igs_priority_w )
1179   AM_RANGE( 0xa40000, 0xa40001 ) AM_WRITE( igs_dips_w )
1180   AM_RANGE( 0xa58000, 0xa58001 ) AM_WRITE( igs_blit_x_w )
1181   AM_RANGE( 0xa58800, 0xa58801 ) AM_WRITE( igs_blit_y_w )
1182   AM_RANGE( 0xa59000, 0xa59001 ) AM_WRITE( igs_blit_w_w )
1183   AM_RANGE( 0xa59800, 0xa59801 ) AM_WRITE( igs_blit_h_w )
1184   AM_RANGE( 0xa5a000, 0xa5a001 ) AM_WRITE( igs_blit_gfx_lo_w )
1185   AM_RANGE( 0xa5a800, 0xa5a801 ) AM_WRITE( igs_blit_gfx_hi_w )
1186   AM_RANGE( 0xa5b000, 0xa5b001 ) AM_WRITE( igs_blit_flags_w )
1187   AM_RANGE( 0xa5b800, 0xa5b801 ) AM_WRITE( igs_blit_pen_w )
1188   AM_RANGE( 0xa5c000, 0xa5c001 ) AM_WRITE( igs_blit_depth_w )
1189   AM_RANGE( 0xa88000, 0xa88001 ) AM_READ( igs_4_dips_r )
1190ADDRESS_MAP_END
1191
1192
1193// Only values 0 and 7 are written (1 bit per irq source?)
1194static UINT16 lhb_irq_enable;
1195static WRITE16_HANDLER( lhb_irq_enable_w )
1196{
1197   COMBINE_DATA( &lhb_irq_enable );
1198}
1199
1200static ADDRESS_MAP_START( lhb, ADDRESS_SPACE_PROGRAM, 16 )
1201   AM_RANGE( 0x010000, 0x010001 ) AM_DEVWRITE( "oki", lhb_okibank_w )
1202   AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
1203   AM_RANGE( 0x100000, 0x103fff ) AM_RAM AM_BASE( &generic_nvram16 ) AM_SIZE( &generic_nvram_size )
1204   AM_RANGE( 0x200000, 0x200fff ) AM_RAM AM_BASE( &igs_priority_ram )
1205   AM_RANGE( 0x300000, 0x3fffff ) AM_READWRITE( igs_layers_r, igs_layers_w )
1206   AM_RANGE( 0x400000, 0x401fff ) AM_RAM_WRITE( igs_palette_w ) AM_BASE( &paletteram16 )
1207   AM_RANGE( 0x600000, 0x600001 ) AM_DEVREADWRITE8( "oki", okim6295_r, okim6295_w, 0x00ff )
1208   AM_RANGE( 0x700000, 0x700001 ) AM_READ_PORT( "COIN" )
1209   AM_RANGE( 0x700002, 0x700005 ) AM_READ ( lhb_inputs_r )
1210   AM_RANGE( 0x700002, 0x700003 ) AM_WRITE( lhb_inputs_w )
1211   AM_RANGE( 0x820000, 0x820001 ) AM_WRITE( igs_priority_w )
1212   AM_RANGE( 0x838000, 0x838001 ) AM_WRITE( lhb_irq_enable_w )
1213   AM_RANGE( 0x840000, 0x840001 ) AM_WRITE( igs_dips_w )
1214   AM_RANGE( 0x858000, 0x858001 ) AM_WRITE( igs_blit_x_w )
1215   AM_RANGE( 0x858800, 0x858801 ) AM_WRITE( igs_blit_y_w )
1216   AM_RANGE( 0x859000, 0x859001 ) AM_WRITE( igs_blit_w_w )
1217   AM_RANGE( 0x859800, 0x859801 ) AM_WRITE( igs_blit_h_w )
1218   AM_RANGE( 0x85a000, 0x85a001 ) AM_WRITE( igs_blit_gfx_lo_w )
1219   AM_RANGE( 0x85a800, 0x85a801 ) AM_WRITE( igs_blit_gfx_hi_w )
1220   AM_RANGE( 0x85b000, 0x85b001 ) AM_WRITE( igs_blit_flags_w )
1221   AM_RANGE( 0x85b800, 0x85b801 ) AM_WRITE( igs_blit_pen_w )
1222   AM_RANGE( 0x85c000, 0x85c001 ) AM_WRITE( igs_blit_depth_w )
1223   AM_RANGE( 0x888000, 0x888001 ) AM_READ( igs_5_dips_r )
1224ADDRESS_MAP_END
1225
1226
1227
1228
1229static READ16_DEVICE_HANDLER( ics2115_word_r )
1230{
1231   switch(offset)
1232   {
1233      case 0:   return ics2115_r(device,0);
1234      case 1:   return ics2115_r(device,1);
1235      case 2:   return (ics2115_r(device,3) << 8) | ics2115_r(device,2);
1236   }
1237   return 0xff;
1238}
1239
1240static WRITE16_DEVICE_HANDLER( ics2115_word_w )
1241{
1242   switch(offset)
1243   {
1244      case 1:
1245         if (ACCESSING_BITS_0_7)      ics2115_w(device,1,data);
1246         break;
1247      case 2:
1248         if (ACCESSING_BITS_0_7)      ics2115_w(device,2,data);
1249         if (ACCESSING_BITS_8_15)   ics2115_w(device,3,data>>8);
1250         break;
1251   }
1252}
1253
1254static READ16_HANDLER( vbowl_unk_r )
1255{
1256   return 0xffff;
1257}
1258
1259static UINT16 *vbowl_trackball;
1260static VIDEO_EOF( vbowl )
1261{
1262   vbowl_trackball[0] = vbowl_trackball[1];
1263   vbowl_trackball[1] = (input_port_read(machine, "AN1") << 8) | input_port_read(machine, "AN0");
1264}
1265
1266static WRITE16_HANDLER( vbowl_pen_hi_w )
1267{
1268   if (ACCESSING_BITS_0_7)
1269   {
1270      chmplst2_pen_hi = data & 0x07;
1271   }
1272
1273   if (data & ~0x7)
1274      logerror("%06x: warning, unknown bits written to pen_hi = %04x\n", cpu_get_pc(space->cpu), igs_priority);
1275}
1276
1277static WRITE16_HANDLER( vbowl_link_0_w )   { }
1278static WRITE16_HANDLER( vbowl_link_1_w )   { }
1279static WRITE16_HANDLER( vbowl_link_2_w )   { }
1280static WRITE16_HANDLER( vbowl_link_3_w )   { }
1281
1282static ADDRESS_MAP_START( vbowl, ADDRESS_SPACE_PROGRAM, 16 )
1283   AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
1284   AM_RANGE( 0x100000, 0x103fff ) AM_RAM AM_BASE( &generic_nvram16 ) AM_SIZE( &generic_nvram_size )
1285   AM_RANGE( 0x200000, 0x200fff ) AM_RAM AM_BASE( &igs_priority_ram )
1286   AM_RANGE( 0x300000, 0x3fffff ) AM_READWRITE( igs_layers_r, igs_layers_w )
1287   AM_RANGE( 0x400000, 0x401fff ) AM_RAM_WRITE( igs_palette_w ) AM_BASE( &paletteram16 )
1288   AM_RANGE( 0x520000, 0x520001 ) AM_READ_PORT( "COIN" )
1289   AM_RANGE( 0x600000, 0x600007 ) AM_DEVREADWRITE( "ics", ics2115_word_r, ics2115_word_w )
1290   AM_RANGE( 0x700000, 0x700003 ) AM_RAM AM_BASE( &vbowl_trackball )
1291   AM_RANGE( 0x700004, 0x700005 ) AM_WRITE( vbowl_pen_hi_w )
1292   AM_RANGE( 0x800000, 0x800003 ) AM_WRITE( vbowl_magic_w )
1293   AM_RANGE( 0x800002, 0x800003 ) AM_READ( vbowl_magic_r )
1294
1295   AM_RANGE( 0xa00000, 0xa00001 ) AM_WRITE( vbowl_link_0_w )
1296   AM_RANGE( 0xa08000, 0xa08001 ) AM_WRITE( vbowl_link_1_w )
1297   AM_RANGE( 0xa10000, 0xa10001 ) AM_WRITE( vbowl_link_2_w )
1298   AM_RANGE( 0xa18000, 0xa18001 ) AM_WRITE( vbowl_link_3_w )
1299
1300   AM_RANGE( 0xa20000, 0xa20001 ) AM_WRITE( igs_priority_w )
1301   AM_RANGE( 0xa40000, 0xa40001 ) AM_WRITE( igs_dips_w )
1302   AM_RANGE( 0xa58000, 0xa58001 ) AM_WRITE( igs_blit_x_w )
1303   AM_RANGE( 0xa58800, 0xa58801 ) AM_WRITE( igs_blit_y_w )
1304   AM_RANGE( 0xa59000, 0xa59001 ) AM_WRITE( igs_blit_w_w )
1305   AM_RANGE( 0xa59800, 0xa59801 ) AM_WRITE( igs_blit_h_w )
1306   AM_RANGE( 0xa5a000, 0xa5a001 ) AM_WRITE( igs_blit_gfx_lo_w )
1307   AM_RANGE( 0xa5a800, 0xa5a801 ) AM_WRITE( igs_blit_gfx_hi_w )
1308   AM_RANGE( 0xa5b000, 0xa5b001 ) AM_WRITE( igs_blit_flags_w )
1309   AM_RANGE( 0xa5b800, 0xa5b801 ) AM_WRITE( igs_blit_pen_w )
1310   AM_RANGE( 0xa5c000, 0xa5c001 ) AM_WRITE( igs_blit_depth_w )
1311
1312   AM_RANGE( 0xa80000, 0xa80001 ) AM_READ( vbowl_unk_r )
1313   AM_RANGE( 0xa88000, 0xa88001 ) AM_READ( igs_4_dips_r )
1314   AM_RANGE( 0xa90000, 0xa90001 ) AM_READ( vbowl_unk_r )
1315   AM_RANGE( 0xa98000, 0xa98001 ) AM_READ( vbowl_unk_r )
1316ADDRESS_MAP_END
1317
1318
1319
1320static ADDRESS_MAP_START( xymg, ADDRESS_SPACE_PROGRAM, 16 )
1321   AM_RANGE( 0x010000, 0x010001 ) AM_DEVWRITE( "oki", lhb_okibank_w )
1322   AM_RANGE( 0x000000, 0x07ffff ) AM_ROM
1323   AM_RANGE( 0x100000, 0x103fff ) AM_RAM
1324   AM_RANGE( 0x200000, 0x200fff ) AM_RAM AM_BASE( &igs_priority_ram )
1325   AM_RANGE( 0x300000, 0x3fffff ) AM_READWRITE( igs_layers_r, igs_layers_w )
1326   AM_RANGE( 0x400000, 0x401fff ) AM_RAM_WRITE( igs_palette_w ) AM_BASE( &paletteram16 )
1327   AM_RANGE( 0x600000, 0x600001 ) AM_DEVREADWRITE8( "oki", okim6295_r, okim6295_w, 0x00ff )
1328   AM_RANGE( 0x700000, 0x700003 ) AM_WRITE( xymg_magic_w )
1329   AM_RANGE( 0x700002, 0x700003 ) AM_READ ( xymg_magic_r )
1330   AM_RANGE( 0x820000, 0x820001 ) AM_WRITE( igs_priority_w )
1331   AM_RANGE( 0x840000, 0x840001 ) AM_WRITE( igs_dips_w )
1332   AM_RANGE( 0x858000, 0x858001 ) AM_WRITE( igs_blit_x_w )
1333   AM_RANGE( 0x858800, 0x858801 ) AM_WRITE( igs_blit_y_w )
1334   AM_RANGE( 0x859000, 0x859001 ) AM_WRITE( igs_blit_w_w )
1335   AM_RANGE( 0x859800, 0x859801 ) AM_WRITE( igs_blit_h_w )
1336   AM_RANGE( 0x85a000, 0x85a001 ) AM_WRITE( igs_blit_gfx_lo_w )
1337   AM_RANGE( 0x85a800, 0x85a801 ) AM_WRITE( igs_blit_gfx_hi_w )
1338   AM_RANGE( 0x85b000, 0x85b001 ) AM_WRITE( igs_blit_flags_w )
1339   AM_RANGE( 0x85b800, 0x85b801 ) AM_WRITE( igs_blit_pen_w )
1340   AM_RANGE( 0x85c000, 0x85c001 ) AM_WRITE( igs_blit_depth_w )
1341   AM_RANGE( 0x888000, 0x888001 ) AM_READ( igs_3_dips_r )
1342   AM_RANGE( 0x1f0000, 0x1f3fff ) AM_RAM AM_BASE( &generic_nvram16 ) AM_SIZE( &generic_nvram_size ) // extra ram
1343ADDRESS_MAP_END
1344
1345
1346
1347/***************************************************************************
1348
1349    Input Ports
1350
1351***************************************************************************/
1352
1353static INPUT_PORTS_START( drgnwrldc )
1354   PORT_START("DSW1")
1355   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
1356   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
1357   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
1358   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
1359   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
1360   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
1361   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
1362   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
1363   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
1364   PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) )
1365   PORT_DIPSETTING(    0x18, DEF_STR( Normal  ) )   // 513
1366   PORT_DIPSETTING(    0x10, DEF_STR( Hard    ) )   // 627
1367   PORT_DIPSETTING(    0x08, DEF_STR( Harder  ) )   // 741
1368   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )   // 855
1369   PORT_DIPUNKNOWN( 0x20, 0x20 )
1370   PORT_DIPUNKNOWN( 0x40, 0x40 )
1371   PORT_DIPUNKNOWN( 0x80, 0x80 )
1372
1373   PORT_START("DSW2")
1374   PORT_DIPNAME( 0x01, 0x01, "Open Girl?" )
1375   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1376   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1377   PORT_DIPNAME( 0x02, 0x02, "Sex Question?" )   // "background" in test mode
1378   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1379   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1380   PORT_DIPNAME( 0x04, 0x04, "Background" )   // "sex question" in test mode
1381   PORT_DIPSETTING(    0x04, "Girl" )
1382   PORT_DIPSETTING(    0x00, "Landscape" )
1383   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
1384   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1385   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
1386   PORT_DIPNAME( 0x10, 0x10, "Tiles" )
1387   PORT_DIPSETTING(    0x10, "Mahjong" )
1388   PORT_DIPSETTING(    0x00, "Symbols" )
1389   PORT_DIPUNKNOWN( 0x20, 0x20 )
1390   PORT_DIPNAME( 0x40, 0x40, "Bang Turtle?" )
1391   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1392   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1393   PORT_DIPNAME( 0x80, 0x80, "Test?" )
1394   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1395   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1396
1397     PORT_START("DSW3")
1398   PORT_DIPUNKNOWN( 0x01, 0x01 )
1399   PORT_DIPUNKNOWN( 0x02, 0x02 )
1400   PORT_DIPUNKNOWN( 0x04, 0x04 )
1401   PORT_DIPUNKNOWN( 0x08, 0x08 )
1402   PORT_DIPUNKNOWN( 0x10, 0x10 )
1403   PORT_DIPUNKNOWN( 0x20, 0x20 )
1404   PORT_DIPUNKNOWN( 0x40, 0x40 )
1405   PORT_DIPUNKNOWN( 0x80, 0x80 )
1406
1407   PORT_START("COIN")
1408   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1409   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
1410   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )   // keep pressed while booting
1411   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
1412   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE2 )   // used?
1413   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE3 )   // used?
1414   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1415   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1416
1417   PORT_START("IN0")
1418   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1419   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
1420   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
1421   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1422   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
1423   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1424   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )   // press in girl test to pause, button 3 advances
1425   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1426
1427   PORT_START("IN1")
1428   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
1429   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
1430   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1431   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
1432   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1433   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1434   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1435   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
1436
1437   PORT_START("IN2")
1438   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
1439   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
1440   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
1441   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 )
1442   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
1443   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
1444   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
1445   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1446INPUT_PORTS_END
1447
1448
1449static INPUT_PORTS_START( drgnwrld )
1450   PORT_START("DSW1")
1451   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
1452   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
1453   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
1454   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
1455   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
1456   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
1457   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
1458   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
1459   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
1460   PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) )
1461   PORT_DIPSETTING(    0x18, DEF_STR( Normal  ) )   // 513
1462   PORT_DIPSETTING(    0x10, DEF_STR( Hard    ) )   // 627
1463   PORT_DIPSETTING(    0x08, DEF_STR( Harder  ) )   // 741
1464   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )   // 855
1465   PORT_DIPUNKNOWN( 0x20, 0x20 )
1466   PORT_DIPUNKNOWN( 0x40, 0x40 )
1467   PORT_DIPUNKNOWN( 0x80, 0x80 )
1468
1469   PORT_START("DSW2")
1470   PORT_DIPNAME( 0x01, 0x01, "Background" )
1471   PORT_DIPSETTING(    0x01, "Girl" )
1472   PORT_DIPSETTING(    0x00, "Landscape" )
1473   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) )
1474   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1475   PORT_DIPSETTING(    0x02, DEF_STR( On ) )
1476   PORT_DIPNAME( 0x04, 0x04, "Tiles" )
1477   PORT_DIPSETTING(    0x04, "Mahjong" )
1478   PORT_DIPSETTING(    0x00, "Symbols" )
1479   PORT_DIPNAME( 0x08, 0x08, "Send Boom?" )
1480   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1481   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1482   PORT_DIPUNKNOWN( 0x10, 0x10 )
1483   PORT_DIPUNKNOWN( 0x20, 0x20 )
1484   PORT_DIPUNKNOWN( 0x40, 0x40 )
1485   PORT_DIPNAME( 0x80, 0x80, "Test?" )
1486   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1487   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1488
1489     PORT_START("DSW3")
1490   PORT_DIPUNKNOWN( 0x01, 0x01 )
1491   PORT_DIPUNKNOWN( 0x02, 0x02 )
1492   PORT_DIPUNKNOWN( 0x04, 0x04 )
1493   PORT_DIPUNKNOWN( 0x08, 0x08 )
1494   PORT_DIPUNKNOWN( 0x10, 0x10 )
1495   PORT_DIPUNKNOWN( 0x20, 0x20 )
1496   PORT_DIPUNKNOWN( 0x40, 0x40 )
1497   PORT_DIPUNKNOWN( 0x80, 0x80 )
1498
1499   PORT_START("COIN")
1500   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1501   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
1502   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )   // keep pressed while booting
1503   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
1504   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE2 )   // used?
1505   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE3 )   // used?
1506   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1507   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1508
1509   PORT_START("IN0")
1510   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1511   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
1512   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
1513   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1514   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
1515   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1516   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )   // press in girl test to pause, button 3 advances
1517   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1518
1519   PORT_START("IN1")
1520   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
1521   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
1522   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1523   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
1524   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1525   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1526   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1527   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
1528
1529   PORT_START("IN2")
1530   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
1531   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
1532   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
1533   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 )
1534   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
1535   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
1536   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
1537   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1538INPUT_PORTS_END
1539
1540
1541static INPUT_PORTS_START( chmplst2 )
1542   PORT_START("DSW1")
1543   PORT_DIPNAME( 0x07, 0x02, "Pay Out (%)" )
1544   PORT_DIPSETTING(    0x07, "50" )
1545   PORT_DIPSETTING(    0x06, "54" )
1546   PORT_DIPSETTING(    0x05, "58" )
1547   PORT_DIPSETTING(    0x04, "62" )
1548   PORT_DIPSETTING(    0x03, "66" )
1549   PORT_DIPSETTING(    0x02, "70" )
1550   PORT_DIPSETTING(    0x01, "74" )
1551   PORT_DIPSETTING(    0x00, "78" )
1552   PORT_DIPNAME( 0x08, 0x08, "Odds Rate" )
1553   PORT_DIPSETTING(    0x08, "1,2,3,5,8,15,30,50" )
1554   PORT_DIPSETTING(    0x00, "1,2,3,4,5,6,7,8" )
1555   PORT_DIPNAME( 0x10, 0x10, "Max Bet" )
1556   PORT_DIPSETTING(    0x00, "5" )
1557   PORT_DIPSETTING(    0x10, "10" )
1558   PORT_DIPNAME( 0x60, 0x60, "Min Credits To Start" )
1559   PORT_DIPSETTING(    0x60, "1" )
1560   PORT_DIPSETTING(    0x40, "2" )
1561   PORT_DIPSETTING(    0x20, "3" )
1562   PORT_DIPSETTING(    0x00, "5" )
1563   PORT_DIPUNKNOWN( 0x80, 0x80 )
1564
1565   PORT_START("DSW2")
1566   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )   // Only when bit 4 = 1
1567   PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
1568   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
1569   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
1570   PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
1571   PORT_DIPNAME( 0x04, 0x04, "Credits Per Note" )   // Only when bit 4 = 0
1572   PORT_DIPSETTING(    0x04, "10" )
1573   PORT_DIPSETTING(    0x00, "100" )
1574   PORT_DIPNAME( 0x08, 0x08, "Max Note Credits" )
1575   PORT_DIPSETTING(    0x08, "100" )
1576   PORT_DIPSETTING(    0x00, "500" )
1577   PORT_DIPNAME( 0x10, 0x10, "Money Type" )   // Decides whether to use bits 0&1 or bit 2
1578   PORT_DIPSETTING(    0x10, "Coins" )
1579   PORT_DIPSETTING(    0x00, "Notes" )
1580   PORT_DIPUNKNOWN( 0x20, 0x20 )
1581   PORT_DIPUNKNOWN( 0x40, 0x40 )
1582   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
1583   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1584   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
1585
1586     PORT_START("DSW3")
1587   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Unknown ) )
1588   PORT_DIPSETTING(    0x03, "500" )
1589   PORT_DIPSETTING(    0x02, "1000" )
1590   PORT_DIPSETTING(    0x01, "2000" )
1591   PORT_DIPSETTING(    0x00, "30000" )
1592   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Unknown ) )
1593   PORT_DIPSETTING(    0x0c, "0" )
1594   PORT_DIPSETTING(    0x08, "1" )
1595   PORT_DIPSETTING(    0x04, "2" )
1596//  PORT_DIPSETTING(    0x00, "2" )
1597   PORT_DIPNAME( 0x70, 0x70, DEF_STR( Unknown ) )
1598   PORT_DIPSETTING(    0x70, "1 : 1" )
1599   PORT_DIPSETTING(    0x60, "1 : 2" )
1600   PORT_DIPSETTING(    0x50, "1 : 5" )
1601   PORT_DIPSETTING(    0x40, "1 : 6" )
1602   PORT_DIPSETTING(    0x30, "1 : 7" )
1603   PORT_DIPSETTING(    0x20, "1 : 8" )
1604   PORT_DIPSETTING(    0x10, "1 : 9" )
1605   PORT_DIPSETTING(    0x00, "1 : 10" )
1606   PORT_DIPUNKNOWN( 0x80, 0x80 )
1607
1608   PORT_START("COIN")
1609   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1610   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE1 )   // data clear
1611   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )   // keep pressed while booting
1612   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE4 )   // haba?
1613   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE2 )   // stats
1614   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE3 )   // clear coin
1615   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1616   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1617
1618   PORT_START("KEY0")
1619   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
1620   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
1621   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
1622   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
1623   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
1624   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
1625   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )   // ? set to 0 both
1626   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )   // ? and you can't start a game
1627
1628   PORT_START("KEY1")
1629   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
1630   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
1631   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
1632   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
1633   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
1634   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
1635   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1636   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1637
1638   PORT_START("KEY2")
1639   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
1640   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
1641   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
1642   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
1643   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
1644   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1645   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1646   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1647
1648   PORT_START("KEY3")
1649   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
1650   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
1651   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
1652   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
1653   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1654   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1655   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1656   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1657
1658   PORT_START("KEY4")
1659   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
1660   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
1661   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1662   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1663   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1664   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1665   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1666   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1667INPUT_PORTS_END
1668
1669
1670static INPUT_PORTS_START( drgnwrldj )
1671   PORT_START("DSW1")
1672   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
1673   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
1674   PORT_DIPSETTING(    0x01, DEF_STR( 4C_1C ) )
1675   PORT_DIPSETTING(    0x02, DEF_STR( 3C_1C ) )
1676   PORT_DIPSETTING(    0x03, DEF_STR( 2C_1C ) )
1677   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
1678   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
1679   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
1680   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
1681   PORT_DIPNAME( 0x18, 0x18, DEF_STR( Difficulty ) )
1682   PORT_DIPSETTING(    0x18, DEF_STR( Normal  ) )   // 513
1683   PORT_DIPSETTING(    0x10, DEF_STR( Hard    ) )   // 627
1684   PORT_DIPSETTING(    0x08, DEF_STR( Harder  ) )   // 741
1685   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )   // 855
1686   PORT_DIPUNKNOWN( 0x20, 0x20 )
1687   PORT_DIPUNKNOWN( 0x40, 0x40 )
1688   PORT_DIPUNKNOWN( 0x80, 0x80 )
1689
1690   PORT_START("DSW2")
1691   PORT_DIPNAME( 0x01, 0x01, "Open Girl?" )
1692   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1693   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1694   PORT_DIPNAME( 0x02, 0x02, "Background" )
1695   PORT_DIPSETTING(    0x02, "Girl" )
1696   PORT_DIPSETTING(    0x00, "Landscape" )
1697   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Demo_Sounds ) )
1698   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1699   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
1700   PORT_DIPNAME( 0x08, 0x08, "Bang Turtle?" )
1701   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
1702   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1703   PORT_DIPNAME( 0x10, 0x10, "Send Boom?" )
1704   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
1705   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1706   PORT_DIPUNKNOWN( 0x20, 0x20 )
1707   PORT_DIPUNKNOWN( 0x40, 0x40 )
1708   PORT_DIPNAME( 0x80, 0x80, "Test?" )
1709   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1710   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1711
1712     PORT_START("DSW3")
1713   PORT_DIPUNKNOWN( 0x01, 0x01 )
1714   PORT_DIPUNKNOWN( 0x02, 0x02 )
1715   PORT_DIPUNKNOWN( 0x04, 0x04 )
1716   PORT_DIPUNKNOWN( 0x08, 0x08 )
1717   PORT_DIPUNKNOWN( 0x10, 0x10 )
1718   PORT_DIPUNKNOWN( 0x20, 0x20 )
1719   PORT_DIPUNKNOWN( 0x40, 0x40 )
1720   PORT_DIPUNKNOWN( 0x80, 0x80 )
1721
1722   PORT_START("COIN")
1723   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
1724   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
1725   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )   // keep pressed while booting
1726   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
1727   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE2 )   // used?
1728   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE3 )   // used?
1729   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1730   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1731
1732   PORT_START("IN0")
1733   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1734   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
1735   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
1736   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
1737   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
1738   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1739   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )   // press in girl test to pause, button 3 advances
1740   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1741
1742   PORT_START("IN1")
1743   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
1744   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
1745   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
1746   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
1747   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
1748   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
1749   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1750   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
1751
1752   PORT_START("IN2")
1753   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
1754   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
1755   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
1756   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON3 )
1757   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
1758   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
1759   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
1760   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
1761INPUT_PORTS_END
1762
1763
1764static INPUT_PORTS_START( grtwall )
1765   PORT_START("DSW1")
1766   PORT_DIPUNKNOWN( 0x01, 0x01 )
1767   PORT_DIPUNKNOWN( 0x02, 0x02 )
1768   PORT_DIPUNKNOWN( 0x04, 0x04 )
1769   PORT_DIPUNKNOWN( 0x08, 0x08 )
1770   PORT_DIPUNKNOWN( 0x10, 0x10 )
1771   PORT_DIPUNKNOWN( 0x20, 0x20 )
1772   PORT_DIPUNKNOWN( 0x40, 0x40 )
1773   PORT_DIPUNKNOWN( 0x80, 0x80 )
1774
1775   PORT_START("DSW2")
1776   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Unknown ) )
1777   PORT_DIPSETTING(    0x03, "1000" )
1778   PORT_DIPSETTING(    0x02, "1500" )
1779   PORT_DIPSETTING(    0x01, "2000" )
1780   PORT_DIPSETTING(    0x00, "3000" )
1781   PORT_DIPNAME( 0x0c, 0x0c, "Min Credits To Start" )
1782   PORT_DIPSETTING(    0x0c, "1" )
1783   PORT_DIPSETTING(    0x08, "2" )
1784   PORT_DIPSETTING(    0x04, "3" )
1785   PORT_DIPSETTING(    0x00, "5" )
1786   PORT_DIPUNKNOWN( 0x10, 0x10 )      // shown in test mode
1787   PORT_DIPUNKNOWN( 0x20, 0x20 )
1788   PORT_DIPNAME( 0x40, 0x40, "Hide Title" )
1789   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
1790   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1791   PORT_DIPUNKNOWN( 0x80, 0x80 )
1792
1793     PORT_START("DSW3")
1794   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
1795   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
1796   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
1797   PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
1798   PORT_DIPSETTING(    0x00, DEF_STR( 1C_4C ) )
1799   PORT_DIPNAME( 0x0c, 0x0c, "Credits Per Note" )
1800   PORT_DIPSETTING(    0x0c, "10" )
1801   PORT_DIPSETTING(    0x08, "20" )
1802   PORT_DIPSETTING(    0x04, "50" )
1803   PORT_DIPSETTING(    0x00, "100" )
1804   PORT_DIPNAME( 0x10, 0x10, "Max Note Credits" )
1805   PORT_DIPSETTING(    0x10, "500" )
1806   PORT_DIPSETTING(    0x00, "9999" )
1807   PORT_DIPNAME( 0x20, 0x20, "Money Type" )
1808   PORT_DIPSETTING(    0x20, "Coins" )   // use bits 0-1
1809   PORT_DIPSETTING(    0x00, "Notes" )   // use bits 2-3
1810   PORT_DIPUNKNOWN( 0x40, 0x40 )
1811   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
1812   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
1813   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
1814
1815   PORT_START("DSW4")
1816   PORT_DIPUNKNOWN( 0x01, 0x01 )
1817   PORT_DIPUNKNOWN( 0x02, 0x02 )
1818   PORT_DIPUNKNOWN( 0x04, 0x04 )
1819   PORT_DIPUNKNOWN( 0x08, 0x08 )
1820   PORT_DIPUNKNOWN( 0x10, 0x10 )
1821   PORT_DIPUNKNOWN( 0x20, 0x20 )
1822   PORT_DIPUNKNOWN( 0x40, 0x40 )
1823   PORT_DIPUNKNOWN( 0x80, 0x80 )
1824
1825   PORT_START("COIN")
1826   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1    )
1827   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2    )
1828   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )   // keep pressed while booting
1829   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
1830   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_OTHER    ) PORT_NAME("1") PORT_CODE(KEYCODE_1_PAD)   // shown in test mode
1831   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN  )
1832   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER    ) PORT_NAME("2") PORT_CODE(KEYCODE_2_PAD)   // shown in test mode
1833   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN  )
1834
1835   PORT_START("IN0")
1836   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
1837   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
1838   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
1839   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
1840   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
1841   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
1842   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
1843   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 )
1844INPUT_PORTS_END
1845
1846
1847static INPUT_PORTS_START( lhb )
1848   PORT_START("DSW1")
1849   PORT_DIPNAME( 0x0f, 0x07, "Pay Out (%)" )
1850   PORT_DIPSETTING(    0x0f, "96" )
1851   PORT_DIPSETTING(    0x0e, "93" )
1852   PORT_DIPSETTING(    0x0d, "90" )
1853   PORT_DIPSETTING(    0x0c, "87" )
1854   PORT_DIPSETTING(    0x0b, "84" )
1855   PORT_DIPSETTING(    0x0a, "81" )
1856   PORT_DIPSETTING(    0x09, "78" )
1857   PORT_DIPSETTING(    0x08, "75" )
1858   PORT_DIPSETTING(    0x07, "71" )
1859   PORT_DIPSETTING(    0x06, "68" )
1860   PORT_DIPSETTING(    0x05, "65" )
1861   PORT_DIPSETTING(    0x04, "62" )
1862   PORT_DIPSETTING(    0x03, "59" )
1863   PORT_DIPSETTING(    0x02, "56" )
1864   PORT_DIPSETTING(    0x01, "53" )
1865   PORT_DIPSETTING(    0x00, "50" )
1866   PORT_DIPNAME( 0x30, 0x30, "YAKUMAN Point" )
1867   PORT_DIPSETTING(    0x30, "1" )
1868   PORT_DIPSETTING(    0x20, "2" )
1869   PORT_DIPSETTING(    0x10, "3" )
1870   PORT_DIPSETTING(    0x00, "4" )
1871   PORT_DIPNAME( 0xc0, 0xc0, "Max Bet" )
1872   PORT_DIPSETTING(    0xc0, "1" )
1873   PORT_DIPSETTING(    0x80, "5" )
1874   PORT_DIPSETTING(    0x40, "10" )
1875   PORT_DIPSETTING(    0x00, "20" )
1876
1877   PORT_START("DSW2")
1878   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
1879   PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
1880   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
1881   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
1882   PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
1883   PORT_DIPNAME( 0x0c, 0x0c, "Min Credits To Start" )
1884   PORT_DIPSETTING(    0x0c, "1" )
1885   PORT_DIPSETTING(    0x08, "2" )
1886   PORT_DIPSETTING(    0x04, "3" )
1887   PORT_DIPSETTING(    0x00, "5" )
1888   PORT_DIPNAME( 0x70, 0x70, "DAI MANGUAN Cycle" )
1889   PORT_DIPSETTING(    0x70, "300" )
1890//  PORT_DIPSETTING(    0x60, "300" )
1891//  PORT_DIPSETTING(    0x50, "300" )
1892//  PORT_DIPSETTING(    0x40, "300" )
1893//  PORT_DIPSETTING(    0x30, "300" )
1894//  PORT_DIPSETTING(    0x20, "300" )
1895//  PORT_DIPSETTING(    0x10, "300" )
1896//  PORT_DIPSETTING(    0x00, "300" )
1897   PORT_DIPNAME( 0x80, 0x80, "DAI MANGUAN Times" )
1898   PORT_DIPSETTING(    0x80, "2" )
1899//  PORT_DIPSETTING(    0x00, "2" )
1900
1901     PORT_START("DSW3")
1902   PORT_DIPNAME( 0x03, 0x03, "Max Credit" )
1903   PORT_DIPSETTING(    0x03, "1000" )
1904   PORT_DIPSETTING(    0x02, "2000" )
1905   PORT_DIPSETTING(    0x01, "5000" )
1906   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1907   PORT_DIPNAME( 0x0c, 0x0c, "Max Note" )
1908   PORT_DIPSETTING(    0x0c, "1000" )
1909   PORT_DIPSETTING(    0x08, "2000" )
1910   PORT_DIPSETTING(    0x04, "5000" )
1911   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1912   PORT_DIPNAME( 0x10, 0x10, "CPU Strength" )
1913   PORT_DIPSETTING(    0x10, "Strong" )
1914   PORT_DIPSETTING(    0x00, "Weak" )
1915   PORT_DIPNAME( 0x20, 0x20, "Money Type" )
1916   PORT_DIPSETTING(    0x20, "Coins" )
1917   PORT_DIPSETTING(    0x00, "Notes" )
1918   PORT_DIPNAME( 0xc0, 0xc0, "DONDEN Times" )
1919   PORT_DIPSETTING(    0xc0, "0" )
1920   PORT_DIPSETTING(    0x80, "3" )
1921   PORT_DIPSETTING(    0x40, "5" )
1922   PORT_DIPSETTING(    0x00, "8" )
1923
1924   PORT_START("DSW4")
1925   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
1926   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
1927   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1928   PORT_DIPNAME( 0x02, 0x00, "In Game Music" )
1929   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
1930   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1931   PORT_DIPNAME( 0x0c, 0x00, "Girls" )
1932   PORT_DIPSETTING(    0x0c, DEF_STR( No ) )
1933   PORT_DIPSETTING(    0x08, "Dressed" )
1934   PORT_DIPSETTING(    0x04, "Underwear" )
1935   PORT_DIPSETTING(    0x00, "Nude" )
1936   PORT_DIPNAME( 0x10, 0x10, "Note Rate" )
1937   PORT_DIPSETTING(    0x10, "5" )
1938   PORT_DIPSETTING(    0x00, "10" )
1939   PORT_DIPNAME( 0x20, 0x20, "Pay Out" )
1940   PORT_DIPSETTING(    0x20, "Score" )
1941   PORT_DIPSETTING(    0x00, "Coin" )
1942   PORT_DIPNAME( 0x40, 0x40, "Coin In" )
1943   PORT_DIPSETTING(    0x40, "Credit" )
1944   PORT_DIPSETTING(    0x00, "Score" )
1945   PORT_DIPNAME( 0x80, 0x80, "Last Chance" )
1946   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
1947   PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
1948
1949   PORT_START("DSW5")
1950   PORT_DIPNAME( 0x01, 0x01, "In-Game Bet" )
1951   PORT_DIPSETTING(    0x01, DEF_STR( No ) )
1952   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
1953   PORT_DIPUNKNOWN( 0x02, 0x02 )
1954   PORT_DIPUNKNOWN( 0x04, 0x04 )
1955   PORT_DIPUNKNOWN( 0x08, 0x08 )
1956   PORT_DIPUNKNOWN( 0x10, 0x10 )
1957   PORT_DIPUNKNOWN( 0x20, 0x20 )
1958   PORT_DIPUNKNOWN( 0x40, 0x40 )
1959   PORT_DIPUNKNOWN( 0x80, 0x80 )
1960
1961   PORT_START("COIN")
1962   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN  )
1963   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE2 )   // system reset
1964   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )   // keep pressed while booting
1965   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )   // stats
1966   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1    ) PORT_IMPULSE(5)
1967   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE3 )   // clear coins
1968   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_OTHER    ) PORT_NAME("0") PORT_CODE(KEYCODE_0_PAD)   // shown in test mode
1969   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN  )
1970
1971   PORT_START("KEY0")
1972   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
1973   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
1974   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
1975   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
1976   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
1977   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
1978   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1979   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1980
1981   PORT_START("KEY1")
1982   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
1983   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
1984   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
1985   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
1986   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
1987   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
1988   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1989   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
1990
1991   PORT_START("KEY2")
1992   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
1993   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
1994   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
1995   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
1996   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
1997   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
1998   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
1999   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2000
2001   PORT_START("KEY3")
2002   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
2003   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
2004   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
2005   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
2006   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
2007   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
2008   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2009   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2010
2011   PORT_START("KEY4")
2012   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
2013   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
2014   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
2015   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )   // shown in test mode
2016   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG )
2017   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL )
2018   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2019   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2020INPUT_PORTS_END
2021
2022
2023static INPUT_PORTS_START( vbowl )
2024   PORT_START("DSW1")
2025   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
2026   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
2027   PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) )
2028   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
2029   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
2030   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
2031   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
2032   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
2033   PORT_DIPSETTING(    0x03, DEF_STR( 1C_5C ) )
2034   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
2035   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2036   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2037   PORT_DIPNAME( 0x10, 0x10, "Special Picture" ) /* Sexy Interlude pics */
2038   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
2039   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
2040   PORT_DIPNAME( 0x20, 0x20, "Open Picture" )
2041   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
2042   PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
2043   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Controls ) )
2044   PORT_DIPSETTING(    0x40, DEF_STR( Joystick ) )
2045   PORT_DIPSETTING(    0x00, DEF_STR( Trackball ) )
2046   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) )
2047   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
2048   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2049
2050   PORT_START("DSW2")
2051   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) )
2052   PORT_DIPSETTING(    0x03, DEF_STR( Easy   ) )   // 5
2053   PORT_DIPSETTING(    0x02, DEF_STR( Normal ) )   // 7
2054   PORT_DIPSETTING(    0x01, DEF_STR( Medium ) )   // 9
2055   PORT_DIPSETTING(    0x00, DEF_STR( Hard   ) )   // 11
2056   PORT_DIPNAME( 0x04, 0x04, "Spares To Win (Frames 1-5)" )
2057   PORT_DIPSETTING(    0x04, "3" )
2058   PORT_DIPSETTING(    0x00, "4" )
2059   PORT_DIPNAME( 0x18, 0x18, "Points To Win (Frames 6-10)" )
2060   PORT_DIPSETTING(    0x18, "160" )
2061   PORT_DIPSETTING(    0x10, "170" )
2062   PORT_DIPSETTING(    0x08, "180" )
2063   PORT_DIPSETTING(    0x00, "190" )
2064   PORT_DIPUNKNOWN( 0x20, 0x20 )
2065   PORT_DIPUNKNOWN( 0x40, 0x40 )
2066   PORT_DIPUNKNOWN( 0x80, 0x80 )
2067
2068     PORT_START("DSW3")
2069   PORT_DIPNAME( 0x03, 0x03, "Cabinet ID" )
2070   PORT_DIPSETTING(    0x03, "1" )
2071   PORT_DIPSETTING(    0x02, "2" )
2072   PORT_DIPSETTING(    0x01, "3" )
2073   PORT_DIPSETTING(    0x00, "4" )
2074   PORT_DIPNAME( 0x04, 0x04, "Linked Cabinets" )
2075   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
2076   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2077   PORT_DIPUNKNOWN( 0x08, 0x08 )
2078   PORT_DIPUNKNOWN( 0x10, 0x10 )
2079   PORT_DIPUNKNOWN( 0x20, 0x20 )
2080   PORT_DIPUNKNOWN( 0x40, 0x40 )
2081   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
2082
2083   PORT_START("DSW4")
2084   PORT_DIPUNKNOWN( 0x01, 0x01 )
2085   PORT_DIPUNKNOWN( 0x02, 0x02 )
2086   PORT_DIPUNKNOWN( 0x04, 0x04 )
2087   PORT_DIPUNKNOWN( 0x08, 0x08 )
2088   PORT_DIPUNKNOWN( 0x10, 0x10 )
2089   PORT_DIPUNKNOWN( 0x20, 0x20 )
2090   PORT_DIPUNKNOWN( 0x40, 0x40 )
2091   PORT_DIPUNKNOWN( 0x80, 0x80 )
2092
2093   PORT_START("COIN")
2094   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
2095   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
2096   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
2097   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
2098   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
2099   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
2100   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2101   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2102
2103   PORT_START("IN0")
2104   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
2105   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
2106   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
2107   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
2108   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
2109   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
2110   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
2111   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 )
2112
2113   PORT_START("IN1")
2114   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )
2115   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
2116   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
2117   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
2118   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
2119   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
2120   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
2121   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2122
2123   PORT_START("AN0")
2124    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1)
2125
2126   PORT_START("AN1")
2127    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1)
2128INPUT_PORTS_END
2129
2130
2131static INPUT_PORTS_START( vbowlj )
2132   PORT_START("DSW1")
2133   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
2134   PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
2135   PORT_DIPSETTING(    0x01, DEF_STR( 3C_1C ) )
2136   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
2137   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
2138   PORT_DIPSETTING(    0x06, DEF_STR( 1C_2C ) )
2139   PORT_DIPSETTING(    0x05, DEF_STR( 1C_3C ) )
2140   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
2141   PORT_DIPSETTING(    0x03, DEF_STR( 1C_5C ) )
2142   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
2143   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2144   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
2145   PORT_DIPNAME( 0x10, 0x10, "Special Picture" ) /* Sexy Interlude pics */
2146   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
2147   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
2148   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Controls ) )
2149   PORT_DIPSETTING(    0x20, DEF_STR( Joystick ) )
2150   PORT_DIPSETTING(    0x00, DEF_STR( Trackball ) )
2151   PORT_DIPUNKNOWN( 0x40, 0x40 )
2152   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) )
2153   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
2154   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2155
2156   PORT_START("DSW2")
2157   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Difficulty ) )
2158   PORT_DIPSETTING(    0x03, DEF_STR( Easy   ) )   // 5
2159   PORT_DIPSETTING(    0x02, DEF_STR( Normal ) )   // 7
2160   PORT_DIPSETTING(    0x01, DEF_STR( Medium ) )   // 9
2161   PORT_DIPSETTING(    0x00, DEF_STR( Hard   ) )   // 11
2162   PORT_DIPNAME( 0x04, 0x04, "Spares To Win (Frames 1-5)" )
2163   PORT_DIPSETTING(    0x04, "3" )
2164   PORT_DIPSETTING(    0x00, "4" )
2165   PORT_DIPNAME( 0x18, 0x18, "Points To Win (Frames 6-10)" )
2166   PORT_DIPSETTING(    0x18, "160" )
2167   PORT_DIPSETTING(    0x10, "170" )
2168   PORT_DIPSETTING(    0x08, "180" )
2169   PORT_DIPSETTING(    0x00, "190" )
2170   PORT_DIPUNKNOWN( 0x20, 0x20 )
2171   PORT_DIPUNKNOWN( 0x40, 0x40 )
2172   PORT_DIPUNKNOWN( 0x80, 0x80 )
2173
2174     PORT_START("DSW3")
2175   PORT_DIPNAME( 0x03, 0x03, "Cabinet ID" )
2176   PORT_DIPSETTING(    0x03, "1" )
2177   PORT_DIPSETTING(    0x02, "2" )
2178   PORT_DIPSETTING(    0x01, "3" )
2179   PORT_DIPSETTING(    0x00, "4" )
2180   PORT_DIPNAME( 0x04, 0x04, "Linked Cabinets" )
2181   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
2182   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2183   PORT_DIPUNKNOWN( 0x08, 0x08 )
2184   PORT_DIPUNKNOWN( 0x10, 0x10 )
2185   PORT_DIPUNKNOWN( 0x20, 0x20 )
2186   PORT_DIPUNKNOWN( 0x40, 0x40 )
2187   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
2188
2189   PORT_START("DSW4")
2190   PORT_DIPUNKNOWN( 0x01, 0x01 )
2191   PORT_DIPUNKNOWN( 0x02, 0x02 )
2192   PORT_DIPUNKNOWN( 0x04, 0x04 )
2193   PORT_DIPUNKNOWN( 0x08, 0x08 )
2194   PORT_DIPUNKNOWN( 0x10, 0x10 )
2195   PORT_DIPUNKNOWN( 0x20, 0x20 )
2196   PORT_DIPUNKNOWN( 0x40, 0x40 )
2197   PORT_DIPUNKNOWN( 0x80, 0x80 )
2198
2199   PORT_START("COIN")
2200   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
2201   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
2202   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
2203   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
2204   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
2205   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
2206   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2207   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2208
2209   PORT_START("IN0")
2210   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
2211   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
2212   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
2213   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
2214   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
2215   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
2216   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
2217   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 )
2218
2219   PORT_START("IN1")
2220   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START2 )
2221   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
2222   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
2223   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
2224   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
2225   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
2226   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
2227   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
2228
2229   PORT_START("AN0")
2230    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1)
2231
2232   PORT_START("AN1")
2233    PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1)
2234INPUT_PORTS_END
2235
2236
2237static INPUT_PORTS_START( xymg )
2238   PORT_START("DSW1")
2239   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
2240   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
2241   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
2242   PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
2243   PORT_DIPSETTING(    0x00, DEF_STR( 1C_4C ) )
2244   PORT_DIPNAME( 0x0c, 0x0c, "Credits Per Note" )
2245   PORT_DIPSETTING(    0x0c, "10" )
2246   PORT_DIPSETTING(    0x08, "20" )
2247   PORT_DIPSETTING(    0x04, "50" )
2248   PORT_DIPSETTING(    0x00, "100" )
2249   PORT_DIPNAME( 0x10, 0x10, "Max Note Credits" )
2250   PORT_DIPSETTING(    0x10, "500" )
2251   PORT_DIPSETTING(    0x00, "9999" )
2252   PORT_DIPNAME( 0x20, 0x20, "Money Type" )
2253   PORT_DIPSETTING(    0x20, "Coins" )   // use bits 0-1
2254   PORT_DIPSETTING(    0x00, "Notes" )   // use bits 2-3
2255   PORT_DIPUNKNOWN( 0x40, 0x40 )
2256   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
2257   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
2258   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
2259
2260   PORT_START("DSW2")
2261   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Unknown ) )
2262   PORT_DIPSETTING(    0x03, "1000" )
2263   PORT_DIPSETTING(    0x02, "1500" )
2264   PORT_DIPSETTING(    0x01, "2000" )
2265   PORT_DIPSETTING(    0x00, "3000" )
2266   PORT_DIPNAME( 0x0c, 0x0c, "Min Credits To Start" )
2267   PORT_DIPSETTING(    0x0c, "1" )
2268   PORT_DIPSETTING(    0x08, "2" )
2269   PORT_DIPSETTING(    0x04, "3" )
2270   PORT_DIPSETTING(    0x00, "5" )
2271   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )   // shown in test mode
2272   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
2273   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
2274   PORT_DIPUNKNOWN( 0x20, 0x20 )
2275   PORT_DIPUNKNOWN( 0x40, 0x40 )
2276   PORT_DIPUNKNOWN( 0x80, 0x80 )
2277
2278     PORT_START("DSW3")
2279   PORT_DIPUNKNOWN( 0x01, 0x01 )
2280   PORT_DIPUNKNOWN( 0x02, 0x02 )
2281   PORT_DIPUNKNOWN( 0x04, 0x04 )
2282   PORT_DIPUNKNOWN( 0x08, 0x08 )
2283   PORT_DIPUNKNOWN( 0x10, 0x10 )
2284   PORT_DIPUNKNOWN( 0x20, 0x20 )
2285   PORT_DIPUNKNOWN( 0x40, 0x40 )
2286   PORT_DIPUNKNOWN( 0x80, 0x80 )
2287
2288   PORT_START("COIN")
2289   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN )
2290   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNKNOWN )
2291   PORT_SERVICE_NO_TOGGLE( 0x04, IP_ACTIVE_LOW )   // keep pressed while booting
2292   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )   // stats
2293   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
2294   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE3 )   // clear coin
2295   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2296   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2297
2298   PORT_START("KEY0")
2299   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
2300   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_E )
2301   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_I )
2302   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_M )
2303   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
2304   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
2305   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2306   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2307
2308   PORT_START("KEY1")
2309   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_B )
2310   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_F )
2311   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
2312   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_N )
2313   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
2314   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_BET )
2315   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2316   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2317
2318   PORT_START("KEY2")
2319   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_C )
2320   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_G )
2321   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_K )
2322   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
2323   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
2324   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
2325   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2326   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2327
2328   PORT_START("KEY3")
2329   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_D )
2330   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_H )
2331   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_L )
2332   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
2333   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
2334   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
2335   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2336   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2337
2338   PORT_START("KEY4")
2339   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_LAST_CHANCE )
2340   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_SCORE )
2341   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_DOUBLE_UP )
2342   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
2343   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_BIG )
2344   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_SMALL )
2345   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
2346   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
2347INPUT_PORTS_END
2348
2349
2350
2351/***************************************************************************
2352
2353    Machine Drivers
2354
2355***************************************************************************/
2356
2357/*
2358// for debugging
2359
2360static const gfx_layout gfxlayout_8x8x4 =
2361{
2362    8,8,
2363    RGN_FRAC(1,1),
2364    4,
2365    { STEP4(0,1) },
2366    { 4, 0, 12,  8, 20,16, 28,24 },
2367    { STEP8(0,8*4) },
2368    8*8*4
2369};
2370static const gfx_layout gfxlayout_16x16x4 =
2371{
2372    16,16,
2373    RGN_FRAC(1,1),
2374    4,
2375    { STEP4(0,1) },
2376    {  4, 0, 12, 8, 20,16, 28,24,
2377      36,32, 44,40, 52,48, 60,56    },
2378    { STEP16(0,16*4) },
2379    16*16*4
2380};
2381static const gfx_layout gfxlayout_8x8x8 =
2382{
2383    8,8,
2384    RGN_FRAC(1,1),
2385    8,
2386    { STEP8(0,1) },
2387    { STEP8(0,8) },
2388    { STEP8(0,8*8) },
2389    8*8*8
2390};
2391static const gfx_layout gfxlayout_16x16x8 =
2392{
2393    16,16,
2394    RGN_FRAC(1,1),
2395    8,
2396    { STEP8(0,1) },
2397    { STEP16(0,8) },
2398    { STEP16(0,16*8) },
2399    16*16*8
2400};
2401static const gfx_layout gfxlayout_16x16x1 =
2402{
2403    16,16,
2404    RGN_FRAC(1,1),
2405    1,
2406    { 0 },
2407    { STEP16(15,-1) },
2408    { STEP16(0,16*1) },
2409    16*16*1
2410};
2411
2412static GFXDECODE_START( igs_blit )
2413    GFXDECODE_ENTRY( "gfx1", 0, gfxlayout_8x8x4,   0, 0x80  )
2414    GFXDECODE_ENTRY( "gfx1", 0, gfxlayout_16x16x4, 0, 0x80  )
2415    GFXDECODE_ENTRY( "gfx1", 0, gfxlayout_8x8x8,   0, 0x08  )
2416    GFXDECODE_ENTRY( "gfx1", 0, gfxlayout_16x16x8, 0, 0x08  )
2417GFXDECODE_END
2418static GFXDECODE_START( chmplst2 )
2419    GFXDECODE_ENTRY( "gfx1", 0, gfxlayout_8x8x4,   0, 0x80  )
2420    GFXDECODE_ENTRY( "gfx1", 0, gfxlayout_16x16x4, 0, 0x80  )
2421    GFXDECODE_ENTRY( "gfx1", 0, gfxlayout_8x8x8,   0, 0x08  )
2422    GFXDECODE_ENTRY( "gfx1", 0, gfxlayout_16x16x8, 0, 0x08  )
2423    GFXDECODE_ENTRY( "gfx2", 0, gfxlayout_16x16x1, 0, 0x80  )
2424GFXDECODE_END
2425*/
2426
2427static MACHINE_DRIVER_START( igs_base )
2428   MDRV_CPU_ADD("maincpu",M68000, 22000000/3)
2429
2430   MDRV_NVRAM_HANDLER(generic_0fill)
2431
2432//  MDRV_GFXDECODE(igs_blit)
2433
2434
2435   MDRV_SCREEN_ADD("screen", RASTER)
2436   MDRV_SCREEN_REFRESH_RATE(60)
2437   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
2438   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
2439   MDRV_SCREEN_SIZE(512, 256)
2440   MDRV_SCREEN_VISIBLE_AREA(0, 512-1, 0, 240-1)
2441
2442   MDRV_PALETTE_LENGTH(0x800)
2443
2444   MDRV_VIDEO_START( igs )
2445   MDRV_VIDEO_UPDATE( igs )
2446
2447   /* sound hardware */
2448   MDRV_SPEAKER_STANDARD_MONO("mono")
2449
2450   MDRV_SOUND_ADD("oki", OKIM6295, 1047600)
2451   MDRV_SOUND_CONFIG(okim6295_interface_pin7high)
2452   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
2453MACHINE_DRIVER_END
2454
2455
2456static INTERRUPT_GEN( chmplst2_interrupt )
2457{
2458   switch (cpu_getiloops(device))
2459   {
2460      case 0:   cpu_set_input_line(device, 6, HOLD_LINE);   break;
2461      default:
2462      case 1:   cpu_set_input_line(device, 5, HOLD_LINE);   break;
2463   }
2464}
2465
2466static MACHINE_DRIVER_START( chmplst2 )
2467   MDRV_IMPORT_FROM(igs_base)
2468   MDRV_CPU_MODIFY("maincpu")
2469   MDRV_CPU_PROGRAM_MAP(chmplst2)
2470   MDRV_CPU_VBLANK_INT_HACK(chmplst2_interrupt,1+4)   // lev5 frequency drives the music tempo
2471
2472//  MDRV_GFXDECODE(chmplst2)
2473
2474   MDRV_SOUND_ADD("ym", YM2413, 3579545)
2475   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0)
2476MACHINE_DRIVER_END
2477
2478
2479static MACHINE_DRIVER_START( drgnwrld )
2480   MDRV_IMPORT_FROM(igs_base)
2481   MDRV_CPU_MODIFY("maincpu")
2482   MDRV_CPU_PROGRAM_MAP(drgnwrld)
2483   MDRV_CPU_VBLANK_INT_HACK(chmplst2_interrupt,1+4)   // lev5 frequency drives the music tempo
2484
2485   MDRV_SOUND_ADD("ym", YM3812, 3579545)
2486   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 2.0)
2487MACHINE_DRIVER_END
2488
2489
2490static INTERRUPT_GEN( grtwall_interrupt )
2491{
2492   switch (cpu_getiloops(device))
2493   {
2494      case 0:   cpu_set_input_line(device, 3, HOLD_LINE);   break;
2495      case 1:   cpu_set_input_line(device, 6, HOLD_LINE);   break;
2496   }
2497}
2498
2499static MACHINE_DRIVER_START( grtwall )
2500   MDRV_IMPORT_FROM(igs_base)
2501   MDRV_CPU_MODIFY("maincpu")
2502   MDRV_CPU_PROGRAM_MAP(grtwall)
2503   MDRV_CPU_VBLANK_INT_HACK(grtwall_interrupt,2)
2504MACHINE_DRIVER_END
2505
2506
2507
2508static INTERRUPT_GEN( lhb_interrupt )
2509{
2510   if (!lhb_irq_enable)
2511      return;
2512
2513   switch (cpu_getiloops(device))
2514   {
2515      case 0:   cpu_set_input_line(device, 3, HOLD_LINE);   break;
2516      case 2:   cpu_set_input_line(device, 6, HOLD_LINE);   break;
2517      default:
2518            // It reads the inputs. Must be called more than once for test mode on boot to work
2519            cpu_set_input_line(device, 5, HOLD_LINE);   break;
2520   }
2521}
2522
2523static MACHINE_DRIVER_START( lhb )
2524   MDRV_IMPORT_FROM(igs_base)
2525   MDRV_CPU_MODIFY("maincpu")
2526   MDRV_CPU_PROGRAM_MAP(lhb)
2527   MDRV_CPU_VBLANK_INT_HACK(lhb_interrupt,3+1)
2528MACHINE_DRIVER_END
2529
2530
2531
2532static void sound_irq(const device_config *device, int state)
2533{
2534//   cputag_set_input_line(machine, "maincpu", 3, state);
2535}
2536
2537static const ics2115_interface vbowl_ics2115_interface = {
2538   sound_irq
2539};
2540
2541static INTERRUPT_GEN( vbowl_interrupt )
2542{
2543   switch (cpu_getiloops(device))
2544   {
2545      case 0:   cpu_set_input_line(device, 4, HOLD_LINE);   break;
2546      case 1:   cpu_set_input_line(device, 5, HOLD_LINE);   break;
2547      case 2:   cpu_set_input_line(device, 6, HOLD_LINE);   break;
2548      default:
2549      case 3:   cpu_set_input_line(device, 3, HOLD_LINE);   break;   // sound
2550   }
2551}
2552
2553static MACHINE_DRIVER_START( vbowl )
2554   MDRV_IMPORT_FROM(igs_base)
2555   MDRV_CPU_MODIFY("maincpu")
2556   MDRV_CPU_PROGRAM_MAP(vbowl)
2557   MDRV_CPU_VBLANK_INT_HACK(vbowl_interrupt,3+4)
2558
2559   MDRV_VIDEO_EOF(vbowl)   // trackball
2560//  MDRV_GFXDECODE(chmplst2)
2561
2562   MDRV_DEVICE_REMOVE("oki")
2563   MDRV_SOUND_ADD("ics", ICS2115, 0)
2564   MDRV_SOUND_CONFIG(vbowl_ics2115_interface)
2565   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 5.0)
2566MACHINE_DRIVER_END
2567
2568
2569
2570static MACHINE_DRIVER_START( xymg )
2571   MDRV_IMPORT_FROM(igs_base)
2572   MDRV_CPU_MODIFY("maincpu")
2573   MDRV_CPU_PROGRAM_MAP(xymg)
2574   MDRV_CPU_VBLANK_INT_HACK(grtwall_interrupt,2)
2575MACHINE_DRIVER_END
2576
2577
2578
2579static DRIVER_INIT( chmplst2 )
2580{
2581   UINT16 *rom = (UINT16 *) memory_region(machine, "maincpu");
2582
2583   chmplst2_decrypt(machine);
2584   chmplst2_decrypt_gfx(machine);
2585
2586   // PROTECTION CHECKS
2587   rom[0x034f4/2]   =   0x4e71;      // 0034F4: 660E    bne 3504   (rom test, fills palette with white otherwise)
2588   rom[0x03502/2]   =   0x6032;      // 003502: 6732    beq 3536   (rom test, fills palette with white otherwise)
2589   rom[0x1afea/2]   =   0x6034;      // 01AFEA: 6734    beq 1b020  (fills palette with black otherwise)
2590   rom[0x24b8a/2]   =   0x6036;      // 024B8A: 6736    beq 24bc2  (fills palette with green otherwise)
2591   rom[0x29ef8/2]   =   0x6036;      // 029EF8: 6736    beq 29f30  (fills palette with red otherwise)
2592   rom[0x2e69c/2]   =   0x6036;      // 02E69C: 6736    beq 2e6d4  (fills palette with green otherwise)
2593   rom[0x2fe96/2]   =   0x6036;      // 02FE96: 6736    beq 2fece  (fills palette with red otherwise)
2594   rom[0x325da/2]   =   0x6036;      // 0325DA: 6736    beq 32612  (fills palette with green otherwise)
2595   rom[0x3d80a/2]   =   0x6034;      // 03D80A: 6734    beq 3d840  (fills palette with black otherwise)
2596   rom[0x3ed80/2]   =   0x6036;      // 03ED80: 6736    beq 3edb8  (fills palette with red otherwise)
2597   rom[0x41d72/2]   =   0x6034;      // 041D72: 6734    beq 41da8  (fills palette with black otherwise)
2598   rom[0x44834/2]   =   0x6034;      // 044834: 6734    beq 4486a  (fills palette with black otherwise)
2599}
2600
2601static DRIVER_INIT( drgnwrld )
2602{
2603   UINT16 *rom = (UINT16 *) memory_region(machine, "maincpu");
2604
2605   drgnwrld_type1_decrypt(machine);
2606   drgnwrld_gfx_decrypt(machine);
2607
2608   // PROTECTION CHECKS
2609   rom[0x032ee/2]   =   0x606c;      // 0032EE: 676C        beq 335c     (ASIC11 CHECK PORT ERROR 3)
2610   rom[0x23d5e/2]   =   0x606c;      // 023D5E: 676C        beq 23dcc    (CHECK PORT ERROR 1)
2611   rom[0x23fd0/2]   =   0x606c;      // 023FD0: 676C        beq 2403e    (CHECK PORT ERROR 2)
2612   rom[0x24170/2]   =   0x606c;      // 024170: 676C        beq 241de    (CHECK PORT ERROR 3)
2613   rom[0x24348/2]   =   0x606c;      // 024348: 676C        beq 243b6    (ASIC11 CHECK PORT ERROR 4)
2614   rom[0x2454e/2]   =   0x606c;      // 02454E: 676C        beq 245bc    (ASIC11 CHECK PORT ERROR 3)
2615   rom[0x246cc/2]   =   0x606c;      // 0246CC: 676C        beq 2473a    (ASIC11 CHECK PORT ERROR 2)
2616   rom[0x24922/2]   =   0x606c;      // 024922: 676C        beq 24990    (ASIC11 CHECK PORT ERROR 1)
2617   rom[0x24b66/2]   =   0x606c;      // 024B66: 676C        beq 24bd4    (ASIC12 CHECK PORT ERROR 4)
2618   rom[0x24de2/2]   =   0x606c;      // 024DE2: 676C        beq 24e50    (ASIC12 CHECK PORT ERROR 3)
2619   rom[0x2502a/2]   =   0x606c;      // 02502A: 676C        beq 25098    (ASIC12 CHECK PORT ERROR 2)
2620   rom[0x25556/2]   =   0x6000;      // 025556: 6700 E584   beq 23adc    (ASIC12 CHECK PORT ERROR 1)
2621   rom[0x2a16c/2]   =   0x606c;      // 02A16C: 676C        beq 2a1da    (ASIC11 CHECK PORT ERROR 2)
2622}
2623
2624static DRIVER_INIT( drgnwrldv30 )
2625{
2626   UINT16 *rom = (UINT16 *) memory_region(machine, "maincpu");
2627
2628   drgnwrld_type1_decrypt(machine);
2629   drgnwrld_gfx_decrypt(machine);
2630
2631   // PROTECTION CHECKS
2632   rom[0x032ee/2]   =   0x606c;      // 0032EE: 676C        beq 335c     (ASIC11 CHECK PORT ERROR 3)
2633   rom[0x23d5e/2]   =   0x606c;      // 023D5E: 676C        beq 23dcc    (CHECK PORT ERROR 1)
2634   rom[0x23fd0/2]   =   0x606c;      // 023FD0: 676C        beq 2403e    (CHECK PORT ERROR 2)
2635   rom[0x24170/2]   =   0x606c;      // 024170: 676C        beq 241de    (CHECK PORT ERROR 3)
2636   rom[0x24348/2]   =   0x606c;      // 024348: 676C        beq 243b6    (ASIC11 CHECK PORT ERROR 4)
2637   rom[0x2454e/2]   =   0x606c;      // 02454E: 676C        beq 245bc    (ASIC11 CHECK PORT ERROR 3)
2638   rom[0x246cc/2]   =   0x606c;      // 0246CC: 676C        beq 2473a    (ASIC11 CHECK PORT ERROR 2)
2639   rom[0x24922/2]   =   0x606c;      // 024922: 676C        beq 24990    (ASIC11 CHECK PORT ERROR 1)
2640   rom[0x24b66/2]   =   0x606c;      // 024B66: 676C        beq 24bd4    (ASIC12 CHECK PORT ERROR 4)
2641   rom[0x24de2/2]   =   0x606c;      // 024DE2: 676C        beq 24e50    (ASIC12 CHECK PORT ERROR 3)
2642   rom[0x2502a/2]   =   0x606c;      // 02502A: 676C        beq 25098    (ASIC12 CHECK PORT ERROR 2)
2643   rom[0x25556/2]   =   0x6000;      // 025556: 6700 E584   beq 23adc    (ASIC12 CHECK PORT ERROR 1)
2644   // different from drgnwrld:
2645   rom[0x2a162/2]   =   0x606c;      // 02A162: 676C        beq 2a1d0    (ASIC11 CHECK PORT ERROR 2)
2646}
2647
2648static DRIVER_INIT( drgnwrldv21 )
2649{
2650   UINT16 *rom = (UINT16 *) memory_region(machine, "maincpu");
2651
2652   drgnwrld_type2_decrypt(machine);
2653   drgnwrld_gfx_decrypt(machine);
2654
2655   // PROTECTION CHECKS
2656   rom[0x032ee/2]   =   0x606c;      // 0032EE: 676C        beq 335c     (ASIC11 CHECK PORT ERROR 3)
2657   rom[0x11ca8/2]   =   0x606c;      // ??
2658   rom[0x23d5e/2]   =   0x606c;      // 023D5E: 676C        beq 23dcc    (CHECK PORT ERROR 1)
2659   rom[0x23fd0/2]   =   0x606c;      // 023FD0: 676C        beq 2403e    (CHECK PORT ERROR 2)
2660   rom[0x24170/2]   =   0x606c;      // 024170: 676C        beq 241de    (CHECK PORT ERROR 3)
2661   rom[0x24348/2]   =   0x606c;      // 024348: 676C        beq 243b6    (ASIC11 CHECK PORT ERROR 4)
2662   rom[0x2454e/2]   =   0x606c;      // 02454E: 676C        beq 245bc    (ASIC11 CHECK PORT ERROR 3)
2663   rom[0x246cc/2]   =   0x606c;      // 0246CC: 676C        beq 2473a    (ASIC11 CHECK PORT ERROR 2)
2664   rom[0x24922/2]   =   0x606c;      // 024922: 676C        beq 24990    (ASIC11 CHECK PORT ERROR 1)
2665   rom[0x24b66/2]   =   0x606c;      // 024B66: 676C        beq 24bd4    (ASIC12 CHECK PORT ERROR 4)
2666   rom[0x24de2/2]   =   0x606c;      // 024DE2: 676C        beq 24e50    (ASIC12 CHECK PORT ERROR 3)
2667   rom[0x2502a/2]   =   0x606c;      // 02502A: 676C        beq 25098    (ASIC12 CHECK PORT ERROR 2)
2668   rom[0x25556/2]   =   0x6000;      // 025556: 6700 E584   beq 23adc    (ASIC12 CHECK PORT ERROR 1)
2669   rom[0x269de/2]   =   0x606c;      // ??
2670   rom[0x2766a/2]   =   0x606c;      // ??
2671   rom[0x2a830/2]   =   0x606c;      // ??
2672}
2673
2674
2675static DRIVER_INIT( drgnwrldv10c )
2676{
2677   UINT16 *rom = (UINT16 *) memory_region(machine, "maincpu");
2678
2679   drgnwrld_type1_decrypt(machine);
2680   drgnwrld_gfx_decrypt(machine);
2681
2682   // PROTECTION CHECKS
2683   rom[0x033d2/2]   =   0x606c;      // 0033D2: 676C        beq 3440     (ASIC11 CHECK PORT ERROR 3)
2684   rom[0x23d0e/2]   =   0x606c;      // 023D0E: 676C        beq 23d7c    (CHECK PORT ERROR 1)
2685   rom[0x23f58/2]   =   0x606c;      // 023F58: 676C        beq 23fc6    (CHECK PORT ERROR 2)
2686   rom[0x240d0/2]   =   0x606c;      // 0240D0: 676C        beq 2413e    (CHECK PORT ERROR 3)
2687   rom[0x242a8/2]   =   0x606c;      // 0242A8: 676C        beq 24316    (ASIC11 CHECK PORT ERROR 4)
2688   rom[0x244ae/2]   =   0x606c;      // 0244AE: 676C        beq 2451c    (ASIC11 CHECK PORT ERROR 3)
2689   rom[0x2462c/2]   =   0x606c;      // 02462C: 676C        beq 2469a    (ASIC11 CHECK PORT ERROR 2)
2690   rom[0x24882/2]   =   0x606c;      // 024882: 676C        beq 248f0    (ASIC11 CHECK PORT ERROR 1)
2691   rom[0x24ac6/2]   =   0x606c;      // 024AC6: 676C        beq 24b34    (ASIC12 CHECK PORT ERROR 4)
2692   rom[0x24d42/2]   =   0x606c;      // 024D42: 676C        beq 24db0    (ASIC12 CHECK PORT ERROR 3)
2693   rom[0x24f8a/2]   =   0x606c;      // 024F8A: 676C        beq 24ff8    (ASIC12 CHECK PORT ERROR 2)
2694   rom[0x254b6/2]   =   0x6000;      // 0254B6: 6700 E5FC   beq 23ab4    (ASIC12 CHECK PORT ERROR 1)
2695   rom[0x2a23a/2]   =   0x606c;      // 02A23A: 676C        beq 2a2a8    (ASIC11 CHECK PORT ERROR 2)
2696
2697}
2698
2699static DRIVER_INIT( drgnwrldv11h )
2700{
2701   drgnwrld_type1_decrypt(machine);
2702   drgnwrld_gfx_decrypt(machine);
2703
2704   // PROTECTION CHECKS
2705   // the protection checks are already pathed out like we do!
2706}
2707
2708static DRIVER_INIT( drgnwrldv21j )
2709{
2710   UINT16 *rom = (UINT16 *) memory_region(machine, "maincpu");
2711
2712   drgnwrld_type3_decrypt(machine);
2713   drgnwrld_gfx_decrypt(machine);
2714
2715   // PROTECTION CHECKS
2716   rom[0x033d2/2]   =   0x606c;      // 0033D2: 676C        beq 3440     (ASIC11 CHECK PORT ERROR 3)
2717   rom[0x11c74/2]   =   0x606c;      // 011C74: 676C        beq 11ce2    (CHECK PORT ERROR 1)
2718   rom[0x23d2a/2]   =   0x606c;      // 023D2A: 676C        beq 23d98
2719   rom[0x23f68/2]   =   0x606c;      // 023F68: 676C        beq 23fd6
2720   rom[0x240d4/2]   =   0x606c;      // 0240D4: 676C        beq 24142    (CHECK PORT ERROR 3)
2721   rom[0x242ac/2]   =   0x606c;      // 0242AC: 676C        beq 2431a
2722   rom[0x244b2/2]   =   0x606c;      // 0244B2: 676C        beq 24520
2723   rom[0x24630/2]   =   0x606c;      // 024630: 676C        beq 2469e
2724   rom[0x24886/2]   =   0x606c;      // 024886: 676C        beq 248f4
2725   rom[0x24aca/2]   =   0x606c;      // 024ACA: 676C        beq 24b38
2726   rom[0x24d46/2]   =   0x606c;      // 024D46: 676C        beq 24db4
2727   rom[0x24f8e/2]   =   0x606c;      // 024F8E: 676C        beq 24ffc
2728   rom[0x254ba/2]   =   0x6000;      // 0254BA: 6700 E620   beq 23adc    (ASIC12 CHECK PORT ERROR 1)
2729   rom[0x26a52/2]   =   0x606c;      // 026A52: 676C        beq 26ac0    (ASIC12 CHECK PORT ERROR 1)
2730   rom[0x276aa/2]   =   0x606c;      // 0276AA: 676C        beq 27718    (CHECK PORT ERROR 3)
2731   rom[0x2a870/2]   =   0x606c;      // 02A870: 676C        beq 2a8de    (ASIC11 CHECK PORT ERROR 2)
2732}
2733
2734static DRIVER_INIT( drgnwrldv20j )
2735{
2736   UINT16 *rom = (UINT16 *) memory_region(machine, "maincpu");
2737
2738   drgnwrld_type3_decrypt(machine);
2739   drgnwrld_gfx_decrypt(machine);
2740
2741   // PROTECTION CHECKS
2742   rom[0x033d2/2]   =   0x606c;      // 0033D2: 676C        beq 3440     (ASIC11 CHECK PORT ERROR 3)
2743   rom[0x11c74/2]   =   0x606c;      // 011C74: 676C        beq 11ce2    (CHECK PORT ERROR 1)
2744   rom[0x23d2a/2]   =   0x606c;      // 023D2A: 676C        beq 23d98
2745   rom[0x23f68/2]   =   0x606c;      // 023F68: 676C        beq 23fd6
2746   rom[0x240d4/2]   =   0x606c;      // 0240D4: 676C        beq 24142    (CHECK PORT ERROR 3)
2747   rom[0x242ac/2]   =   0x606c;      // 0242AC: 676C        beq 2431a
2748   rom[0x244b2/2]   =   0x606c;      // 0244B2: 676C        beq 24520
2749   rom[0x24630/2]   =   0x606c;      // 024630: 676C        beq 2469e
2750   rom[0x24886/2]   =   0x606c;      // 024886: 676C        beq 248f4
2751   rom[0x24aca/2]   =   0x606c;      // 024ACA: 676C        beq 24b38
2752   rom[0x24d46/2]   =   0x606c;      // 024D46: 676C        beq 24db4
2753   rom[0x24f8e/2]   =   0x606c;      // 024F8E: 676C        beq 24ffc
2754   rom[0x254ba/2]   =   0x6000;      // 0254BA: 6700 E620   beq 23adc    (ASIC12 CHECK PORT ERROR 1)
2755   rom[0x26a52/2]   =   0x606c;      // 026A52: 676C        beq 26ac0    (ASIC12 CHECK PORT ERROR 1)
2756   // different from drgnwrldv21j:
2757   rom[0x276a0/2]   =   0x606c;      // 0276A0: 676C        beq 2770e    (CHECK PORT ERROR 3)
2758   rom[0x2a86e/2]   =   0x606c;      // 02A86E: 676C        beq 2a8dc    (ASIC11 CHECK PORT ERROR 2)
2759}
2760
2761
2762static DRIVER_INIT( grtwall )
2763{
2764   UINT16 *rom = (UINT16 *) memory_region(machine, "maincpu");
2765
2766   grtwall_decrypt(machine);
2767
2768   // PROTECTION CHECKS
2769   rom[0x16b96/2]   =   0x6000;      // 016B96: 6700 02FE    beq 16e96  (fills palette with red otherwise)
2770   rom[0x16e5e/2]   =   0x6036;      // 016E5E: 6736         beq 16e96  (fills palette with green otherwise)
2771   rom[0x17852/2]   =   0x6000;      // 017852: 6700 01F2    beq 17a46  (fills palette with green otherwise)
2772   rom[0x17a0e/2]   =   0x6036;      // 017A0E: 6736         beq 17a46  (fills palette with red otherwise)
2773   rom[0x23636/2]   =   0x6036;      // 023636: 6736         beq 2366e  (fills palette with red otherwise)
2774   rom[0x2b1e6/2]   =   0x6000;      // 02B1E6: 6700 0218    beq 2b400  (fills palette with green otherwise)
2775   rom[0x2f9f2/2]   =   0x6000;      // 02F9F2: 6700 04CA    beq 2febe  (fills palette with green otherwise)
2776   rom[0x2fb2e/2]   =   0x6000;      // 02FB2E: 6700 038E    beq 2febe  (fills palette with red otherwise)
2777   rom[0x2fcf2/2]   =   0x6000;      // 02FCF2: 6700 01CA    beq 2febe  (fills palette with red otherwise)
2778   rom[0x2fe86/2]   =   0x6036;      // 02FE86: 6736         beq 2febe  (fills palette with red otherwise)
2779   rom[0x3016e/2]   =   0x6000;      // 03016E: 6700 03F6    beq 30566  (fills palette with green otherwise)
2780   rom[0x303c8/2]   =   0x6000;      // 0303C8: 6700 019C    beq 30566  (fills palette with green otherwise)
2781   rom[0x3052e/2]   =   0x6036;      // 03052E: 6736         beq 30566  (fills palette with green otherwise)
2782}
2783
2784static DRIVER_INIT( lhb )
2785{
2786   UINT16 *rom = (UINT16 *) memory_region(machine, "maincpu");
2787
2788   lhb_decrypt(machine);
2789
2790   // PROTECTION CHECKS
2791   rom[0x2eef6/2]   =   0x4e75;      // 02EEF6: 4E56 FE00    link A6, #-$200  (fills palette with pink otherwise)
2792}
2793
2794static DRIVER_INIT( lhba )
2795{
2796   UINT16 *rom = (UINT16 *) memory_region(machine, "maincpu");
2797
2798   lhb_decrypt(machine);
2799
2800   // PROTECTION CHECKS
2801   rom[0x2e988/2]   =   0x4e75;      // 02E988: 4E56 FE00    link A6, #-$200  (fills palette with pink otherwise)
2802}
2803
2804static DRIVER_INIT( vbowl )
2805{
2806   UINT16 *rom = (UINT16 *) memory_region(machine, "maincpu");
2807   UINT8  *gfx = (UINT8 *)  memory_region(machine, "gfx1");
2808   int i;
2809
2810   vbowlj_decrypt(machine);
2811
2812   for (i = 0x400000-1; i >= 0; i--)
2813   {
2814      gfx[i * 2 + 1] = (gfx[i] & 0xf0) >> 4;
2815      gfx[i * 2 + 0] = (gfx[i] & 0x0f) >> 0;
2816   }
2817
2818   // Patch the bad dump so that it doesn't reboot at the end of a game (the patched value is from vbowlj)
2819   rom[0x080e0/2] = 0xe549;   // 0080E0: 0449 dc.w $0449; ILLEGAL
2820
2821   // PROTECTION CHECKS
2822   rom[0x3764/2] = 0x4e75;   // 003764: 4E56 0000 link    A6, #$0
2823}
2824
2825static DRIVER_INIT( vbowlj )
2826{
2827   UINT16 *rom = (UINT16 *) memory_region(machine, "maincpu");
2828   UINT8  *gfx = (UINT8 *)  memory_region(machine, "gfx1");
2829   int i;
2830
2831   vbowlj_decrypt(machine);
2832
2833   for (i = 0x400000-1; i >= 0; i--)
2834   {
2835      gfx[i * 2 + 1] = (gfx[i] & 0xf0) >> 4;
2836      gfx[i * 2 + 0] = (gfx[i] & 0x0f) >> 0;
2837   }
2838
2839   // PROTECTION CHECKS
2840   rom[0x37b4/2] = 0x4e75;   // 0037B4: 4E56 0000 link    A6, #$0
2841}
2842
2843
2844
2845static DRIVER_INIT( xymg )
2846{
2847   UINT16 *rom = (UINT16 *) memory_region(machine, "maincpu");
2848
2849   lhb_decrypt(machine);
2850
2851   // PROTECTION CHECKS
2852   rom[0x00502/2]   =   0x6006;      // 000502: 6050         bra 554
2853   rom[0x0fc1c/2]   =   0x6036;      // 00FC1C: 6736         beq fc54  (fills palette with red otherwise)
2854   rom[0x1232a/2]   =   0x6036;      // 01232A: 6736         beq 12362 (fills palette with red otherwise)
2855   rom[0x18244/2]   =   0x6036;      // 018244: 6736         beq 1827c (fills palette with red otherwise)
2856   rom[0x1e15e/2]   =   0x6036;      // 01E15E: 6736         beq 1e196 (fills palette with red otherwise)
2857   rom[0x22286/2]   =   0x6000;      // 022286: 6700 02D2    beq 2255a (fills palette with green otherwise)
2858   rom[0x298ce/2]   =   0x6036;      // 0298CE: 6736         beq 29906 (fills palette with red otherwise)
2859   rom[0x2e07c/2]   =   0x6036;      // 02E07C: 6736         beq 2e0b4 (fills palette with red otherwise)
2860   rom[0x38f1c/2]   =   0x6000;      // 038F1C: 6700 071C    beq 3963a (ASIC11 ERROR 1)
2861   rom[0x390e8/2]   =   0x6000;      // 0390E8: 6700 0550    beq 3963a (ASIC11 ERROR 2)
2862   rom[0x3933a/2]   =   0x6000;      // 03933A: 6700 02FE    beq 3963a (ASIC11 ERROR 3)
2863   rom[0x3955c/2]   =   0x6000;      // 03955C: 6700 00DC    beq 3963a (ASIC11 ERROR 4)
2864   rom[0x397f4/2]   =   0x6000;      // 0397F4: 6700 02C0    beq 39ab6 (fills palette with green otherwise)
2865   rom[0x39976/2]   =   0x6000;      // 039976: 6700 013E    beq 39ab6 (fills palette with green otherwise)
2866   rom[0x39a7e/2]   =   0x6036;      // 039A7E: 6736         beq 39ab6 (fills palette with green otherwise)
2867   rom[0x4342c/2]   =   0x4e75;      // 04342C: 4E56 0000    link A6, #$0
2868   rom[0x49966/2]   =   0x6036;      // 049966: 6736         beq 4999e (fills palette with blue otherwise)
2869   rom[0x58140/2]   =   0x6036;      // 058140: 6736         beq 58178 (fills palette with red otherwise)
2870   rom[0x5e05a/2]   =   0x6036;      // 05E05A: 6736         beq 5e092 (fills palette with red otherwise)
2871   rom[0x5ebf0/2]   =   0x6000;      // 05EBF0: 6700 0208    beq 5edfa (fills palette with red otherwise)
2872   rom[0x5edc2/2]   =   0x6036;      // 05EDC2: 6736         beq 5edfa (fills palette with green otherwise)
2873   rom[0x5f71c/2]   =   0x6000;      // 05F71C: 6700 01F2    beq 5f910 (fills palette with green otherwise)
2874   rom[0x5f8d8/2]   =   0x6036;      // 05F8D8: 6736         beq 5f910 (fills palette with red otherwise)
2875   rom[0x64836/2]   =   0x6036;      // 064836: 6736         beq 6486e (fills palette with red otherwise)
2876}
2877
2878static DRIVER_INIT( dbc )
2879{
2880   UINT16 *rom = (UINT16 *) memory_region(machine, "maincpu");
2881
2882   dbc_decrypt(machine);
2883
2884   // PROTECTION CHECKS
2885   rom[0x04c42/2]   =   0x602e;      // 004C42: 6604         bne 4c48  (rom test error otherwise)
2886   rom[0x08694/2]   =   0x6008;      // 008694: 6408         bcc 869e  (fills screen with characters otherwise)
2887   rom[0x0a05e/2]   =   0x4e71;      // 00A05E: 6408         bcc a068  (fills screen with characters otherwise)
2888   rom[0x0bec2/2]   =   0x6008;      // 00BEC2: 6408         bcc becc  (fills screen with characters otherwise)
2889   rom[0x0c0d4/2]   =   0x600a;      // 00C0D4: 640A         bcc c0e0  (wrong game state otherwise)
2890   rom[0x0c0f0/2]   =   0x4e71;      // 00C0F0: 6408         bcc c0fa  (wrong palette otherwise)
2891   rom[0x0e292/2]   =   0x6008;      // 00E292: 6408         bcc e29c  (fills screen with characters otherwise)
2892   rom[0x11b42/2]   =   0x6008;      // 011B42: 6408         bcc 11b4c (wrong game state otherwise)
2893   rom[0x11b5c/2]   =   0x4e71;      // 011B5C: 6408         bcc 11b66 (wrong palette otherwise)
2894   rom[0x170ae/2]   =   0x4e71;      // 0170AE: 6408         bcc 170b8 (fills screen with characters otherwise)
2895   rom[0x1842a/2]   =   0x6024;      // 01842A: 6724         beq 18450 (ASIC11 ERROR otherwise)
2896   rom[0x18538/2]   =   0x6008;      // 018538: 6408         bcc 18542 (wrong game state otherwise)
2897   rom[0x18552/2]   =   0x4e71;      // 018552: 6408         bcc 1855c (wrong palette otherwise)
2898   rom[0x18c0e/2]   =   0x6006;      // 018C0E: 6406         bcc 18c16 (fills screen with characters otherwise)
2899   rom[0x1923e/2]   =   0x4e71;      // 01923E: 6408         bcc 19248 (fills screen with characters otherwise)
2900
2901   // Fix for the palette fade on title screen
2902//  rom[0x19E90/2]  =   0x00ff;
2903}
2904
2905/***************************************************************************
2906
2907    ROMs Loading
2908
2909***************************************************************************/
2910
2911/***************************************************************************
2912
2913Champion List II
2914IGS, 1996
2915
2916PCB Layout
2917----------
2918
2919IGS PCB NO-0115
2920|---------------------------------------------|
2921|                  M6295  IGSS0503.U38        |
2922|  UM3567  3.57945MHz                         |
2923|                          DSW3               |
2924|                          DSW2     PAL       |
2925| IGSM0502.U5              DSW1    6264       |
2926| IGSM0501.U7     PAL              6264       |
2927|                 PAL                         |
2928|                 PAL            IGS011       |
2929|                 PAL                         |
2930|                 PAL                         |
2931|                                             |
2932|   MC68HC000P10          22MHz  TC524258AZ-10|
2933|           6264         8255    TC524258AZ-10|
2934|    BATT   6264   MAJ2V185H.U29 TC524258AZ-10|
2935|                                TC524258AZ-10|
2936|---------------------------------------------|
2937
2938Notes:
2939        68k clock: 7.3333MHz (i.e. 22/3)
2940      M6295 clock: 1.0476MHz (i.e. 22/21) \
2941         M6295 SS: HIGH                   / Therefore sampling freq = 7.936363636kHz (i.e. 1047600 / 132)
2942           UM3567: Compatible with YM2413, clock = 3.57945MHz
2943            HSync: 15.78kHz
2944            VSync: 60Hz
2945
2946***************************************************************************/
2947
2948ROM_START( chmplst2 )
2949   ROM_REGION( 0x80000, "maincpu", 0 )
2950   ROM_LOAD16_WORD_SWAP( "maj2v185h.u29", 0x00000, 0x80000, CRC(2572d59a) SHA1(1d5362e209dadf8b21c10d1351d4bb038bfcaaef) )
2951
2952   ROM_REGION( 0x200000, "gfx1", 0 )
2953   ROM_LOAD( "igsm0501.u7", 0x00000, 0x200000, CRC(1c952bd6) SHA1(a6b6f1cdfb29647e81c032ffe59c94f1a10ceaf8) )
2954
2955   ROM_REGION( 0x80000, "gfx2", 0 ) // high order bit of graphics (5th bit)
2956   /* these are identical ..seems ok as igs number is same, only ic changed */
2957   ROM_LOAD( "igsm0502.u4", 0x00000, 0x80000, CRC(5d73ae99) SHA1(7283aa3d6b15ceb95db80756892be46eb997ef15) )
2958   ROM_LOAD( "igsm0502.u5", 0x00000, 0x80000, CRC(5d73ae99) SHA1(7283aa3d6b15ceb95db80756892be46eb997ef15) )
2959
2960   ROM_REGION( 0x80000, "oki", 0 )
2961   ROM_LOAD( "igss0503.u38", 0x00000, 0x80000, CRC(c9609c9c) SHA1(f036e682b792033409966e84292a69275eaa05e5) )   // 2 banks
2962ROM_END
2963
2964/***************************************************************************
2965
2966Dragon World (World, V0400)
2967(C) 1997 IGS / ALTA
2968
2969Chips:
2970  1x 68000 (main)
2971  1x AC0A26 (equivalent to OKI M6295)(sound)
2972  1x 6564L (equivalent to YM3812)(sound)
2973  1x custom IGS003c (marked on PCB as 8255)
2974  1x oscillator 22.0000MHz (main)
2975  1x oscillator 3.579545MHz (sound)
2976  1x custom IGS011 (FPGA?)
2977
2978ROMs:
2979  1x MX27C4096 (u3)(main) (dumped)
2980  1x custom IGSD0301 (mask rom) (not dumped yet)
2981  1x NEC D27C2001D (IGSS0302)(sound) (not dumped yet)
2982
2983Notes:
2984  1x JAMMA edge connector
2985  1x trimmer (volume)
2986  3x 8 switches dips
2987  PCB serial number is: 0105-5
2988
2989***************************************************************************/
2990
2991ROM_START( drgnwrld )
2992   ROM_REGION( 0x80000, "maincpu", 0 )
2993   ROM_LOAD16_WORD_SWAP( "chinadr-v0400.u3", 0x00000, 0x80000, CRC(a6daa2b8) SHA1(0cbfd001c1fd82a6385453d1c2a808add67746af) )
2994
2995   ROM_REGION( 0x400000, "gfx1", 0 )
2996   ROM_LOAD( "igs-d0301.u39", 0x000000, 0x400000, CRC(78ab45d9) SHA1(c326ee9f150d766edd6886075c94dea3691b606d) )
2997
2998   ROM_REGION( 0x40000, "oki", 0 )
2999   ROM_LOAD( "igs-s0302.u43", 0x00000, 0x40000, CRC(fde63ce1) SHA1(cc32d2cace319fe4d5d0aa96d7addb2d1def62f2) )
3000ROM_END
3001
3002/***************************************************************************
3003
3004Dragon World (World, V0300)
3005(C) 1995 IGS
3006
3007Chips:
3008  1x MC68HC000P10 (main)
3009  1x CUSTOM IGS011
3010
3011ROMs:
3012  1x MX27C4096 (main)
3013
3014***************************************************************************/
3015
3016ROM_START( drgnwrldv30 )
3017   ROM_REGION( 0x80000, "maincpu", 0 )
3018   ROM_LOAD16_WORD_SWAP( "chinadr-v0300.u3", 0x00000, 0x80000, CRC(5ac243e5) SHA1(50cccff0307239187ac2b65331ad2bcc666f8033) )
3019
3020   ROM_REGION( 0x400000, "gfx1", 0 )
3021   ROM_LOAD( "igs-d0301.u39", 0x000000, 0x400000, CRC(78ab45d9) SHA1(c326ee9f150d766edd6886075c94dea3691b606d) )
3022
3023   ROM_REGION( 0x40000, "oki", 0 )
3024   ROM_LOAD( "igs-s0302.u43", 0x00000, 0x40000, CRC(fde63ce1) SHA1(cc32d2cace319fe4d5d0aa96d7addb2d1def62f2) )
3025ROM_END
3026
3027ROM_START( drgnwrldv21 )
3028   ROM_REGION( 0x80000, "maincpu", 0 )
3029   ROM_LOAD16_WORD_SWAP( "china-dr-v-0210.u3", 0x00000, 0x80000, CRC(60c2b018) SHA1(58563e3ccb51bd9d8362aa17c23743bb5a593c3b) )
3030
3031   ROM_REGION( 0x400000, "gfx1", 0 )
3032   ROM_LOAD( "igs-d0301.u39", 0x000000, 0x400000, CRC(78ab45d9) SHA1(c326ee9f150d766edd6886075c94dea3691b606d) )
3033
3034   ROM_REGION( 0x40000, "oki", 0 )
3035   ROM_LOAD( "china-dr-sp.u43", 0x00000, 0x40000, CRC(fde63ce1) SHA1(cc32d2cace319fe4d5d0aa96d7addb2d1def62f2) )
3036ROM_END
3037
3038
3039/***************************************************************************
3040
3041Zhong Guo Long (China, V0303)
3042(C) 1995 IGS
3043
3044Chips:
3045  CPU 1x MC68HC000P10 (main)
3046  1x AR17961-AP0642 (equivalent to OKI M6295)(sound)
3047  1x 6564L (equivalent to YM3812)(sound)
3048  1x LS138S (sound)
3049  1x LM7805CV (sound)
3050  1x UPC1242H (sound)
3051  1x custom IGS003 (marked on PCB as 8255)
3052  1x oscillator 22.0000MHz (main)
3053  1x oscillator 3.579545MHz (sound)
3054  1x custom IGS011 (FPGA?)
3055
3056ROMs:
3057  1x maskrom 256x16 IGSD0303 (u3)(main)
3058  1x maskrom 2Mx16 UM23V32000 (IGSD0301)(u39)(gfx)
3059  1x empty socket for 27C040 (u44)
3060  1x maskrom NEC D27C2001D (IGSS0302)(u43)(sound)
3061  2x PAL16L8ACN (u17,u18)(read protected)
3062  2x PALATF22V10B (u15,u45)
3063  1x empty space for additional PALATV750 (u16)
3064
3065Notes:
3066  1x JAMMA edge connector
3067  1x trimmer (volume)
3068  3x 8x2 switches DIP
3069
3070The PCB is perfectly working, empty spaces and empty sockets are clearly intended to be empty.
307125/07/2007 f205v Corrado Tomaselli Gnoppi
3072
3073***************************************************************************/
3074
3075ROM_START( drgnwrldv10c )
3076   ROM_REGION( 0x80000, "maincpu", 0 )
3077   ROM_LOAD16_WORD_SWAP( "igs-d0303.u3", 0x00000, 0x80000, CRC(3b3c29bb) SHA1(77b7e58104314303985c283cce3aec40bd7b9334) )
3078
3079   ROM_REGION( 0x400000, "gfx1", 0 )
3080   //ROM_LOAD( "igs-0301.u39", 0x000000, 0x400000, CRC(655ab941) SHA1(4bbefb27e8971446998508969661042c5111bc72) ) // bad dump
3081   ROM_LOAD( "igs-d0301.u39", 0x000000, 0x400000, CRC(78ab45d9) SHA1(c326ee9f150d766edd6886075c94dea3691b606d) )
3082
3083   ROM_REGION( 0x40000, "oki", 0 )
3084   ROM_LOAD( "igs-s0302.u43", 0x00000, 0x40000, CRC(fde63ce1) SHA1(cc32d2cace319fe4d5d0aa96d7addb2d1def62f2) )
3085
3086   ROM_REGION( 0x40000, "user1", 0 )
3087   ROM_LOAD( "ccdu15.u15", 0x000, 0x2e5, CRC(a15fce69) SHA1(3e38d75c7263bfb36aebdbbd55ebbdd7ca601633) )
3088   //ROM_LOAD( "ccdu17.u17.bad.dump", 0x000, 0x104, CRC(e9cd78fb) SHA1(557d3e7ef3b25c1338b24722cac91bca788c02b8) )
3089   //ROM_LOAD( "ccdu18.u18.bad.dump", 0x000, 0x104, CRC(e9cd78fb) SHA1(557d3e7ef3b25c1338b24722cac91bca788c02b8) )
3090   ROM_LOAD( "ccdu45.u45", 0x000, 0x2e5, CRC(a15fce69) SHA1(3e38d75c7263bfb36aebdbbd55ebbdd7ca601633) )
3091ROM_END
3092
3093/***************************************************************************
3094
3095Chuugokuryuu (china dragon jpn ver.)
3096(c)IGS
3097Distributed by ALTA
3098
3099MAIN CPU   : 68000
3100I/O        : IGS003 (=8255)
3101SOUND ?    : 6564L  (=OPL?)  , AR17961 (=M6295?)
3102CRTC ?     : IGS011
3103SOUND CPU? : IGSD0301 (DIP 42P)
3104OSC        : 22Mhz , 3.579545Mhz
3105DIPSW      : 8bitx 3 (SW3 is not used)
3106OTHER      : IGS012
3107
3108MAIN PRG   : "CHINA DRAGON U020J" (japan)
3109SOUND PRG? : "CHINA DRAGON SP"
3110SOUND DATA?: "CHINA DRAGON U44"
3111
3112***************************************************************************/
3113
3114ROM_START( drgnwrldv20j )
3115   ROM_REGION( 0x80000, "maincpu", 0 )
3116   ROM_LOAD16_WORD_SWAP( "china_jp.v20", 0x00000, 0x80000, CRC(9e018d1a) SHA1(fe14e6344434cabf43685e50fd49c90f05f565be) )
3117
3118   ROM_REGION( 0x420000, "gfx1", 0 )
3119   // igs-d0301.u39 wasn't in this set
3120   ROM_LOAD( "igs-d0301.u39", 0x000000, 0x400000, CRC(78ab45d9) SHA1(c326ee9f150d766edd6886075c94dea3691b606d) )
3121   ROM_LOAD( "china.u44",     0x400000, 0x020000, CRC(10549746) SHA1(aebd83796679c85b43ad514b2771897f94e61294) ) // 1xxxxxxxxxxxxxxxx = 0x00
3122
3123   ROM_REGION( 0x40000, "oki", 0 )
3124   ROM_LOAD( "igs-s0302.u43", 0x00000, 0x40000, CRC(fde63ce1) SHA1(cc32d2cace319fe4d5d0aa96d7addb2d1def62f2) ) // original label: "sp"
3125ROM_END
3126
3127ROM_START( drgnwrldv21j )
3128   ROM_REGION( 0x80000, "maincpu", 0 )
3129   ROM_LOAD16_WORD_SWAP( "v-021j", 0x00000, 0x80000, CRC(2f87f6e4) SHA1(d43065b078fdd9605c121988ad3092dce6cf0bf1) )
3130
3131   ROM_REGION( 0x420000, "gfx1", 0 )
3132   ROM_LOAD( "igs-d0301.u39", 0x000000, 0x400000, CRC(78ab45d9) SHA1(c326ee9f150d766edd6886075c94dea3691b606d) )
3133   ROM_LOAD( "cg",            0x400000, 0x020000, CRC(2dda0be3) SHA1(587b7cab747d4336515c98eb3365341bb6c7e5e4) )
3134
3135   ROM_REGION( 0x40000, "oki", 0 )
3136   ROM_LOAD( "igs-s0302.u43", 0x00000, 0x40000, CRC(fde63ce1) SHA1(cc32d2cace319fe4d5d0aa96d7addb2d1def62f2) ) // original label: "sp"
3137ROM_END
3138
3139/***************************************************************************
3140
3141    Dong Fang Zhi Zhu (Hong Kong version of Zhong Guo Long, V011H)
3142
3143***************************************************************************/
3144
3145ROM_START( drgnwrldv11h )
3146   ROM_REGION( 0x80000, "maincpu", 0 )
3147   ROM_LOAD16_WORD_SWAP( "c_drgn_hk.u3", 0x00000, 0x80000, CRC(182037ce) SHA1(141b698777533e57493e588d2526523d4bd3e17d) )
3148
3149   ROM_REGION( 0x400000, "gfx1", 0 )
3150   ROM_LOAD( "igs-d0301.u39", 0x000000, 0x400000, CRC(78ab45d9) SHA1(c326ee9f150d766edd6886075c94dea3691b606d) )
3151
3152   ROM_REGION( 0x40000, "oki", 0 )
3153   ROM_LOAD( "igs-s0302.u43", 0x00000, 0x40000, CRC(fde63ce1) SHA1(cc32d2cace319fe4d5d0aa96d7addb2d1def62f2) )
3154ROM_END
3155
3156
3157
3158/***************************************************************************
3159
3160    The Great Wall?
3161
3162    Other files in the zip:
3163
3164     5.942    16-6126.G16
3165    14.488    U3-9911.G22
3166    14.488    U4-82E6.G22
3167    14.488    U5-6C5E.G22
3168
3169***************************************************************************/
3170
3171ROM_START( grtwall )
3172   ROM_REGION( 0x80000, "maincpu", 0 )
3173   ROM_LOAD16_WORD_SWAP( "wlcc4096.rom", 0x00000, 0x80000, CRC(3b16729f) SHA1(4ef4e5cbd6ccc65775e36c2c8b459bc1767d6574) )
3174   ROM_CONTINUE        (                 0x00000, 0x80000 ) // 1ST+2ND IDENTICAL
3175
3176   ROM_REGION( 0x280000, "gfx1", ROMREGION_ERASE00 )
3177   ROM_LOAD( "m0201-ig.160", 0x000000, 0x200000, CRC(ec54452c) SHA1(0ee7ffa3d4845af083944e64faf5a1c78247aaa2) )
3178   ROM_LOAD( "grtwall.gfx",  0x200000, 0x080000, CRC(1f7ad299) SHA1(ab0a8fb31906519b9352ba172def48456e8d565c) )
3179
3180   ROM_REGION( 0x80000, "oki", 0 )
3181   ROM_LOAD( "040-c3c2.snd", 0x00000, 0x80000, CRC(220949aa) SHA1(1e0dba168a0687d32aaaed42714ae24358f4a3e7) ) // 2 banks
3182   ROM_CONTINUE(             0x00000, 0x80000 ) // 1ST+2ND IDENTICAL
3183ROM_END
3184
3185/***************************************************************************
3186
3187    Long Hu Bang (V035C)
3188
3189    Other files in the zip:
3190
3191     5.938    16V8.jed
3192    14.464    LHB-U33.jed
3193    14.488    LHB-U34.jed
3194    14.488    LHB-U35.jed
3195
3196***************************************************************************/
3197
3198ROM_START( lhb )
3199   ROM_REGION( 0x80000, "maincpu", 0 )
3200   // identical to LHB-4096
3201   ROM_LOAD16_WORD_SWAP( "v305j-409", 0x00000, 0x80000, CRC(701de8ef) SHA1(4a77160f642f4de02fa6fbacf595b75c0d4a505d) )
3202
3203   ROM_REGION( 0x200000, "gfx1", 0 )
3204   ROM_LOAD( "m0201-ig.160", 0x000000, 0x200000, CRC(ec54452c) SHA1(0ee7ffa3d4845af083944e64faf5a1c78247aaa2) )
3205
3206   ROM_REGION( 0x80000, "oki", 0 )
3207   // identical to 040-c3c2.snd
3208   ROM_LOAD( "m0202.snd", 0x00000, 0x80000, CRC(220949aa) SHA1(1e0dba168a0687d32aaaed42714ae24358f4a3e7) ) // 2 banks
3209   ROM_CONTINUE(          0x00000, 0x80000 ) // 1ST+2ND IDENTICAL
3210ROM_END
3211
3212/***************************************************************************
3213
3214Long Hu Bang (V033C)
3215
3216PCB Layout
3217----------
3218
3219IGS PCB NO-T0093
3220|---------------------------------------|
3221|uPD1242H     VOL       DSW5            |
3222|  IGS_M0202                            |
3223|             AR17961   DSW4            |
3224|                             CY7C185   |
3225|                       DSW3            |
3226|      8255             DSW2  CY7C185   |
3227|                       DSW1            |
3228|1                                      |
3229|8                           DIP32      |
3230|W             |-------|                |
3231|A             |       |     IGS_M0201  |
3232|Y  BATTERY    |IGS011 |                |
3233|              |       |          PAL   |
3234|              |-------|                |
3235|                         TC524256      |
3236|    MAJ_V-033C                         |
3237|                         TC524256      |
3238|1      6264                            |
3239|0                        TC524256      |
3240|W      6264    22.285MHz               |
3241|A         PAL            TC524256      |
3242|Y         PAL                          |
3243| SPDT_SW  PAL      68000               |
3244|---------------------------------------|
3245Notes:
3246      Uses common 10-way/18-way Mahjong pinout
3247      TC524256 - Toshiba TC524256BZ-80 256k x4 Dual Port VRAM (ZIP28)
3248      CY7C185  - Cypress CY7C185-20PC 8k x8 SRAM (DIP28)
3249      6264     - UT6264PC-70LL 8k x8 SRAM (DIP28)
3250      IGS011   - Custom IGS IC (QFP160)
3251      AR17961  - == OkiM6295 (QFP44)
3252      DIP32    - Empty socket, maybe a ROM missing, maybe not used?
3253
3254      ROMs -
3255            MAJ_V-033C - Main Program (27C4096)
3256            IGS_M0201  - Graphics (16M maskROM)
3257            IGS_M0202  - OKI samples (4M maskROM)
3258
3259***************************************************************************/
3260
3261ROM_START( lhba )
3262   ROM_REGION( 0x80000, "maincpu", 0 )
3263   ROM_LOAD16_WORD_SWAP( "maj_v-033c.u30", 0x00000, 0x80000, CRC(02a0b716) SHA1(cd0ee32ea69f66768196b0e9b4df0fae3af84ed3) )
3264
3265   ROM_REGION( 0x200000, "gfx1", 0 )
3266   ROM_LOAD( "igs_m0201.u15", 0x000000, 0x200000, CRC(ec54452c) SHA1(0ee7ffa3d4845af083944e64faf5a1c78247aaa2) )
3267
3268   ROM_REGION( 0x80000, "oki", 0 )
3269   // identical to 040-c3c2.snd
3270   ROM_LOAD( "igs_m0202.u39", 0x00000, 0x80000, CRC(106ac5f7) SHA1(5796a880c3424e3d2251b2223a0e594957afecaf) ) // 2 banks
3271
3272ROM_END
3273
3274/***************************************************************************
3275
3276Da Ban Cheng
3277
3278PCB Layout
3279----------
3280
3281IGS PCB NO-T0084-1
3282|---------------------------------------|
3283|uPD1242H     VOL       DSW5            |
3284|  IGS_M0202                            |
3285|             AR17961   DSW4            |
3286|                             CY7C185   |
3287|                       DSW3            |
3288|      8255             DSW2  CY7C185   |
3289|                       DSW1            |
3290|1                                      |
3291|8                           MAJ-H_CG   |
3292|W    PAL      |-------|                |
3293|A             |       |     IGS_M0201  |
3294|Y    PAL      |IGS011 |                |
3295|              |       |          PAL   |
3296|     PAL      |-------|                |
3297|                         TC524256      |
3298|     6264                              |
3299|                         TC524256      |
3300|1    6264                              |
3301|0           22.0994MHz   TC524256      |
3302|W    MAJ-H_V027H                       |
3303|A                        TC524256      |
3304|Y         BATTERY                      |
3305| SPDT_SW           68000               |
3306|---------------------------------------|
3307Notes:
3308      Uses common 10-way/18-way Mahjong pinout
3309      TC524256 - Toshiba TC524256BZ-80 256k x4 Dual Port VRAM (ZIP28)
3310      CY7C185  - Cypress CY7C185-20PC 8k x8 SRAM (DIP28)
3311      6264     - UT6264PC-70LL 8k x8 SRAM (DIP28)
3312      IGS011   - Custom IGS IC (QFP160)
3313      AR17961  - == OkiM6295 (QFP44)
3314
3315      ROMs -
3316            MAJ-H_V027H- Main Program (27C4096)
3317            IGS_M0201  - Graphics (16M maskROM)
3318            IGS_M0202  - OKI samples (4M maskROM)
3319            MAJ-H_CG   - Graphics (27c4001 EPROM)
3320
3321***************************************************************************/
3322
3323ROM_START( dbc )
3324   ROM_REGION( 0x80000, "maincpu", 0 )
3325   ROM_LOAD16_WORD_SWAP( "maj-h_v027h.u30", 0x00000, 0x80000, CRC(5d5ccd5b) SHA1(7a1223923f9a5825fd919ae9a36912284e705382) )
3326
3327   ROM_REGION( 0x280000, "gfx1", 0 )
3328   ROM_LOAD( "igs_m0201.u15", 0x000000, 0x200000, CRC(ec54452c) SHA1(0ee7ffa3d4845af083944e64faf5a1c78247aaa2) )
3329   ROM_LOAD( "maj-h_cg.u8",   0x200000, 0x080000, CRC(ee45cc46) SHA1(ed011f758a02026222994aaea0677a4e9580fbda) )   // 1xxxxxxxxxxxxxxxxxx = 0x00
3330
3331   ROM_REGION( 0x80000, "oki", 0 )
3332   ROM_LOAD( "igs_m0202.u39", 0x00000, 0x80000, CRC(106ac5f7) SHA1(5796a880c3424e3d2251b2223a0e594957afecaf) ) // 2 banks
3333ROM_END
3334
3335/***************************************************************************
3336
3337Virtua Bowling by IGS
3338
3339PCB # 0101
3340
3341U45  (27c240) is probably program
3342next to 68000 processor
3343U68,U69 probably images   (27c800 - mask)
3344U67, U66 sound and ????  (27c040)
3345
3346ASIC chip used
3347
3348SMD - custom chip IGS 011      F5XD  174
3349SMD - custom --near sound section - unknown -- i.d. rubbed off
3350SMD - custom  -- near inputs and 68000  IGS 012    9441EK001
3351
3352XTL near sound 33.868mhz
3353XTL near 68000  22.0000mhz
3354
3355there are 4 banks of 8 dip switches
3356
3357***************************************************************************/
3358
3359ROM_START( vbowl )
3360   ROM_REGION( 0x80000, "maincpu", 0 )
3361   ROM_LOAD16_WORD_SWAP( "bowlingv101xcm.u45", 0x00000, 0x80000, BAD_DUMP CRC(ab8e3f1f) SHA1(69159e22559d6a26fe2afafd770aa640c192ba4b) )
3362
3363   ROM_REGION( 0x400000 * 2, "gfx1", 0)
3364   ROM_LOAD( "vrbowlng.u69", 0x000000, 0x400000, CRC(b0d339e8) SHA1(a26a5e0202a78e8cdc562b10d64e14eadfa4e115) )
3365   // extra space to expand every 4 bits to 8
3366
3367   ROM_REGION( 0x100000, "gfx2", ROMREGION_INVERT )
3368   ROM_LOAD( "vrbowlng.u68", 0x000000, 0x100000, CRC(b0ce27e7) SHA1(6d3ef97edd606f384b1e05b152fbea12714887b7) )
3369
3370   ROM_REGION( 0x400000, "ics", 0 )
3371   ROM_LOAD( "vrbowlng.u67", 0x00000, 0x80000, CRC(53000936) SHA1(e50c6216f559a9248c095bdfae05c3be4be79ff3) )   // 8 bit signed mono & u-law
3372   ROM_LOAD( "vrbowlng.u66", 0x80000, 0x80000, CRC(f62cf8ed) SHA1(c53e47e2c619ed974ad40ee4aaa4a35147ea8311) )   // 8 bit signed mono
3373   ROM_COPY( "ics", 0, 0x100000,0x100000)
3374   ROM_COPY( "ics", 0, 0x200000,0x100000)
3375   ROM_COPY( "ics", 0, 0x300000,0x100000)
3376ROM_END
3377
3378ROM_START( vbowlj )
3379   ROM_REGION( 0x80000, "maincpu", 0 )
3380   ROM_LOAD16_WORD_SWAP( "vrbowlng.u45", 0x00000, 0x80000, CRC(091c19c1) SHA1(5a7bfbee357122e9061b38dfe988c3853b0984b0) ) // second half all 00
3381
3382   ROM_REGION( 0x400000 * 2, "gfx1", 0)
3383   ROM_LOAD( "vrbowlng.u69", 0x000000, 0x400000, CRC(b0d339e8) SHA1(a26a5e0202a78e8cdc562b10d64e14eadfa4e115) )
3384   // extra space to expand every 4 bits to 8
3385
3386   ROM_REGION( 0x100000, "gfx2", ROMREGION_INVERT )
3387   ROM_LOAD( "vrbowlng.u68", 0x000000, 0x100000, CRC(b0ce27e7) SHA1(6d3ef97edd606f384b1e05b152fbea12714887b7) )
3388
3389   ROM_REGION( 0x400000, "ics", 0 )
3390   ROM_LOAD( "vrbowlng.u67", 0x00000, 0x80000, CRC(53000936) SHA1(e50c6216f559a9248c095bdfae05c3be4be79ff3) )   // 8 bit signed mono & u-law
3391   ROM_LOAD( "vrbowlng.u66", 0x80000, 0x80000, CRC(f62cf8ed) SHA1(c53e47e2c619ed974ad40ee4aaa4a35147ea8311) )   // 8 bit signed mono
3392   ROM_COPY( "ics", 0, 0x100000,0x100000)
3393   ROM_COPY( "ics", 0, 0x200000,0x100000)
3394   ROM_COPY( "ics", 0, 0x300000,0x100000)
3395ROM_END
3396
3397
3398/***************************************************************************
3399
3400    Xing Yen Man Guan
3401
3402    Other files in the zip:
3403
3404    14.484 U33-82E6.jed
3405    14.484 U34-1.jed
3406    14.484 U35-7068.jed
3407
3408***************************************************************************/
3409
3410ROM_START( xymg )
3411   ROM_REGION( 0x80000, "maincpu", 0 )
3412   ROM_LOAD16_WORD_SWAP( "u30-ebac.rom", 0x00000, 0x80000, CRC(7d272b6f) SHA1(15fd1be23cabdc77b747541f5cd9fed6b08be4ad) )
3413
3414   ROM_REGION( 0x280000, "gfx1", 0 )
3415   ROM_LOAD( "m0201-ig.160", 0x000000, 0x200000, CRC(ec54452c) SHA1(0ee7ffa3d4845af083944e64faf5a1c78247aaa2) )
3416   ROM_LOAD( "ygxy-u8.rom",  0x200000, 0x080000, CRC(56a2706f) SHA1(98bf4b3153eef53dd449e2538b4b7ff2cc2fe6fa) )
3417
3418   ROM_REGION( 0x80000, "oki", 0 )
3419   // identical to 040-c3c2.snd
3420   ROM_LOAD( "m0202.snd", 0x00000, 0x80000, CRC(220949aa) SHA1(1e0dba168a0687d32aaaed42714ae24358f4a3e7) ) // 2 banks
3421   ROM_CONTINUE(          0x00000, 0x80000 ) // 1ST+2ND IDENTICAL
3422ROM_END
3423
3424
3425/***************************************************************************
3426
3427    Game Drivers
3428
3429***************************************************************************/
3430
3431GAME( 1995, lhb,      0,        lhb,      lhb,      lhb,      ROT0, "IGS",        "Long Hu Bang (V035C)",                 0 )
3432GAME( 1995, lhba,     lhb,      lhb,      lhb,      lhba,     ROT0, "IGS",        "Long Hu Bang (V033C)",                 0 )
3433GAME( 1995, dbc,      0,        lhb,      lhb,      dbc,      ROT0, "IGS",        "Da Ban Cheng (V027H)",                 0 )
3434GAME( 1996, chmplst2, 0,        chmplst2, chmplst2, chmplst2, ROT0, "IGS",        "Long Hu Bang II (V185H)",              0 )
3435GAME( 1996, xymg,     0,        xymg,     xymg,     xymg,     ROT0, "IGS",        "Xing Yun Man Guan (V651C)",            0 )
3436GAME( 1996, grtwall,  xymg,     grtwall,  grtwall,  grtwall,  ROT0, "IGS",        "Wan Li Chang Cheng (V638C)",           0 )
3437GAME( 1996, vbowl,    0,        vbowl,    vbowl,    vbowl,    ROT0, "IGS",        "Virtua Bowling (World, V101XCM)",      GAME_IMPERFECT_SOUND )
3438GAME( 1996, vbowlj,   vbowl,    vbowl,    vbowlj,   vbowlj,   ROT0, "IGS / Alta", "Virtua Bowling (Japan, V100JCM)",      GAME_IMPERFECT_SOUND )
3439
3440GAME( 1997, drgnwrld,     0,        drgnwrld, drgnwrld,  drgnwrld,     ROT0, "IGS",        "Dragon World (World, V040O)",          0 )
3441GAME( 1995, drgnwrldv30,  drgnwrld, drgnwrld, drgnwrld,  drgnwrldv30,  ROT0, "IGS",        "Dragon World (World, V030O)",          0 )
3442GAME( 1995, drgnwrldv21,  drgnwrld, drgnwrld, drgnwrld,  drgnwrldv21,  ROT0, "IGS",        "Dragon World (World, V021O)",          0 )
3443GAME( 1995, drgnwrldv21j, drgnwrld, drgnwrld, drgnwrldj, drgnwrldv21j, ROT0, "IGS / Alta", "Zhong Guo Long (Japan, V021J)",        0 )
3444GAME( 1995, drgnwrldv20j, drgnwrld, drgnwrld, drgnwrldj, drgnwrldv20j, ROT0, "IGS / Alta", "Zhong Guo Long (Japan, V020J)",        0 )
3445GAME( 1995, drgnwrldv10c, drgnwrld, drgnwrld, drgnwrldc, drgnwrldv10c, ROT0, "IGS",        "Zhong Guo Long (China, V010C)",        0 )
3446GAME( 1995, drgnwrldv11h, drgnwrld, drgnwrld, drgnwrldc, drgnwrldv11h, ROT0, "IGS",        "Dong Fang Zhi Zhu (Hong Kong, V011H)", 0 )
src/mame/drivers/igs_m68.c
r6653r6654
1/* Some IGS Mahjong games with a 68k
2
3IGS based games, some of which use
4
5Video: IGS031
6I/O: IGS022
7Protection: IGS025
8
9Others use
10
11IGS017
12IGS029
13
14*/
15
16#include "driver.h"
17#include "cpu/m68000/m68000.h"
18#include "sound/okim6295.h"
19
20static VIDEO_START(igs_m68)
21{
22}
23
24static VIDEO_UPDATE(igs_m68)
25{
26   return 0;
27}
28
29
30static ADDRESS_MAP_START( igs_m68_map, ADDRESS_SPACE_PROGRAM, 16 )
31   AM_RANGE(0x000000, 0x07ffff) AM_ROM
32   AM_RANGE(0x100000, 0x103fff) AM_RAM //to test the decryption
33   AM_RANGE(0x300000, 0x303fff) AM_RAM //to test the decryption
34   AM_RANGE(0x500000, 0x503fff) AM_RAM //to test the decryption
35ADDRESS_MAP_END
36
37static INPUT_PORTS_START( igs_m68 )
38INPUT_PORTS_END
39
40
41
42
43static MACHINE_DRIVER_START( igs_m68 )
44   MDRV_CPU_ADD("maincpu", M68000, 22000000 /2)    // 11mhz
45   MDRV_CPU_PROGRAM_MAP(igs_m68_map)
46   //MDRV_CPU_VBLANK_INT("screen", irq1_line_hold)
47
48   //MDRV_GFXDECODE(igs_m68)
49
50
51   MDRV_SCREEN_ADD("screen", RASTER)
52   MDRV_SCREEN_REFRESH_RATE(60)
53   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
54   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
55   MDRV_SCREEN_SIZE(64*8, 32*8)
56   MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1)
57
58   MDRV_PALETTE_LENGTH(0x200)
59
60   MDRV_VIDEO_START(igs_m68)
61   MDRV_VIDEO_UPDATE(igs_m68)
62
63   MDRV_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
64
65   MDRV_SOUND_ADD("oki", OKIM6295, 8000000/8)
66   MDRV_SOUND_CONFIG(okim6295_interface_pin7high)
67   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.47)
68   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.47)
69MACHINE_DRIVER_END
70
71/*
72
73Mahjong Long Hu Zheng Ba 2
74IGS, 1998
75
76
77PCB Layout
78----------
79
80IGS PCB NO-0206
81|---------------------------------------|
82|    6264             |-------|         |
83|    6264      |----| |       |         |
84|              |IGS | |IGS025 |         |
85|              |022 | |       |  PAL    |
86|              |----| |-------|         |
87|                       PAL             |
88|    M1104.U11          PAL    68000    |
89|1                                      |
90|8                                      |
91|W                                      |
92|A   M1101.U6  8MHz          P1100.U30  |
93|Y                                      |
94|                                  6264 |
95|                                       |
96|              |-------|                |
97|              |       |                |
98|              |IGS031 |           61256|
99|1             |       |                |
100|0   M1103.U8  |-------|                |
101|W      22MHz                           |
102|A             DSW1   DSW2              |
103|Y            K668     BATTERY          |
104|TDA1020 VOL          S1102.U23  SPDT_SW|
105|---------------------------------------|
106Notes:
107      Uses common 10-way/18-way Mahjong pinout
108      68000 clock 11.000MHz [22/2]
109      K668  == Oki M6295 (QFP44). Clock 1MHz [8/8]. pin7 = High
110      VSync - 60Hz
111      HSync - 15.3kHz
112
113*/
114
115ROM_START( lhzb2 )
116   ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */
117   ROM_LOAD16_WORD_SWAP( "p1100.u30", 0x00000, 0x80000, CRC(68102b25) SHA1(6c1e8d204be0efda0e9b6c2f49b5c6760712475f) )
118
119   ROM_REGION( 0x80000, "oki", 0 ) /* Samples */
120   ROM_LOAD( "s1102.u23", 0x00000, 0x80000, CRC(51ffe245) SHA1(849011b186096add657ab20d49d260ec23363ef3) )
121
122   ROM_REGION( 0x200000, "gfx1", 0 )
123   ROM_LOAD( "m1101.u6", 0x000000, 0x200000, CRC(fed09cd6) SHA1(0658a97983f8ba408126e79889cc58323f2d99ba) )
124   ROM_LOAD( "m1103.u8", 0x000000, 0x040000, CRC(89d0b81c) SHA1(b8d294a143e5cc9466b544cb70e43a7ce3450ace) )
125   ROM_LOAD( "m1104.u11",0x000000, 0x010000, CRC(794d0276) SHA1(ac903d2faa3fb315438dc8da22c5337611a8790d) )
126ROM_END
127
128/* alt hardware, no IGS025 (protection) chip */
129
130ROM_START( lhzb2a )
131   ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */
132   ROM_LOAD16_WORD_SWAP( "p-4096", 0x00000, 0x80000, CRC(41293f32) SHA1(df4e993f4a458729ade13981e58f32d8116c0082) )
133
134   ROM_REGION( 0x80000, "oki", 0 ) /* Samples */
135   ROM_LOAD( "s1102.u23", 0x00000, 0x80000, CRC(51ffe245) SHA1(849011b186096add657ab20d49d260ec23363ef3) )
136
137   ROM_REGION( 0x200000, "gfx1", 0 )
138   ROM_LOAD( "m1101.u6", 0x000000, 0x200000, CRC(fed09cd6) SHA1(0658a97983f8ba408126e79889cc58323f2d99ba) )
139   ROM_LOAD( "m1103",    0x000000, 0x080000, CRC(4d3776b4) SHA1(fa9b311b1a6ad56e136b66d090bc62ed5003b2f2) )
140ROM_END
141
142
143/*
144
145Mahjong Shuang Long Qiang Zhu 2
146IGS, 1998
147
148
149PCB Layout
150----------
151
152IGS PCB NO-0207
153|---------------------------------------|
154|                   K668  S1102.U20     |
155|     PAL                               |
156| 8MHz                     6264         |
157|                                       |
158|    |----|                6264         |
159|    |IGS |                             |
160|    |022 |  M1103.U12       PAL        |
161|J   |----|                    PAL      |
162|A                                      |
163|M                                      |
164|M      |-------|                       |
165|A      |       |                       |
166|       |IGS025 |   68000               |
167|       |       |                       |
168|       |-------|                       |
169|                            P1100.U28  |
170|                 PAL                   |
171|  M1101.U4       |-------|             |
172|                 |       |             |
173|                 |IGS031 |      6264   |
174|  TEXT.U6        |       |             |
175|                 |-------|      62256  |
176|SPDT_SW   22MHz   DSW1  DSW2  BATTERY  |
177|---------------------------------------|
178Notes:
179      68000 clock 11.000MHz [22/2]
180      K668  == Oki M6295 (QFP44). Clock 1.000MHz [8/8]. pin7 = High
181      VSync - 60Hz
182      HSync - 15.3kHz
183
184*/
185
186ROM_START( slqz2 )
187   ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */
188   ROM_LOAD16_WORD_SWAP( "p1100.u28", 0x00000, 0x80000, CRC(0b8e5c9e) SHA1(16572bd1163bba4da8a76b10649d2f71e50ad369) )
189
190   ROM_REGION( 0x80000, "oki", 0 ) /* Samples */
191   ROM_LOAD( "s1102.u20", 0x00000, 0x80000, CRC(51ffe245) SHA1(849011b186096add657ab20d49d260ec23363ef3) ) // = s1102.u23 Mahjong Long Hu Zheng Ba 2
192
193   ROM_REGION( 0x200000, "gfx1", 0 )
194   ROM_LOAD( "m1101.u4",  0x000000, 0x200000, CRC(fed09cd6) SHA1(0658a97983f8ba408126e79889cc58323f2d99ba) ) // = m1101.u6 Mahjong Long Hu Zheng Ba 2
195   ROM_LOAD( "text.u6",   0x000000, 0x080000, CRC(40d21adf) SHA1(18b202d6330ac89026bec2c9c8224b52540dd48d) )
196   ROM_LOAD( "m1103.u12", 0x000000, 0x010000, CRC(9f3b8d65) SHA1(5ee1ad025474399c2826f21d970e76f25d0fa1fd) )
197ROM_END
198
199/*
200
201Mahjong Super Da Man Guan 2
202IGS, 1997
203
204
205PCB Layout
206----------
207
208IGS PCB NO-0147-6
209|---------------------------------------|
210| UPC1242H          S0903.U15   BATTERY |
211|          VOL               SPDT_SW    |
212|                                       |
213|        K668                    6264   |
214|                                       |
215|                                6264   |
216|                   PAL                 |
217|1   8255                               |
218|8                            P0900.U25 |
219|W                                      |
220|A                                      |
221|Y                                      |
222|                                68000  |
223|                                       |
224|    M0902.U4       PAL                 |
225|                                       |
226|                                 PAL   |
227|1   M0901.U5       |-------|           |
228|0                  |       |     PAL   |
229|W                  |IGS031 |           |
230|A   TEXT.U6        |       |           |
231|Y                  |-------|     62256 |
232|T         22MHz  DSW1 DSW2             |
233|---------------------------------------|
234Notes:
235      Uses common 10-way/18-way Mahjong pinout
236      68000 clock 11.000MHz [22/2]
237      K668 = M6295. clock 1.000MHz [22/22]. pin7 = High
238      VSync - 60Hz
239      HSync - 15.3kHz
240
241*/
242
243
244ROM_START( sdmg2 )
245   ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */
246   ROM_LOAD16_WORD_SWAP( "p0900.u25", 0x00000, 0x80000,CRC(43366f51) SHA1(48dd965dceff7de15b43c2140226a8b17a792dbc) )
247
248   ROM_REGION( 0x80000, "oki", 0 ) /* Samples */
249   ROM_LOAD( "s0903.u15", 0x00000, 0x80000, CRC(ae5a441c) SHA1(923774ef73ab0f70e0db1738a4292dcbd70d2384) )
250
251   ROM_REGION( 0x200000, "gfx1", 0 )
252   ROM_LOAD( "m0901.u5",  0x000000, 0x200000, CRC(9699db24) SHA1(50fc2f173c20b48d10595f01f1e9545f1b13a61b) )
253   ROM_LOAD( "text.u6",   0x000000, 0x020000, CRC(cb34cbc0) SHA1(ceedbdda085fd1acc9a575502bdf7cf998f54f05) )
254   ROM_LOAD( "m0902.u4",  0x000000, 0x080000, CRC(3298b13b) SHA1(13b21ddeed368b7f4fea1408c8fc511244342faf) )
255ROM_END
256
257
258static DRIVER_INIT( lhzb2 )
259{
260   int i;
261   UINT16 *src = (UINT16 *) (memory_region(machine, "maincpu"));
262
263   int rom_size = 0x80000;
264
265   for (i=0; i<rom_size/2; i++)
266   {
267      UINT16 x = src[i];
268
269      /* bit 0 xor layer */
270
271      if( i & 0x20/2 )
272      {
273         if( i & 0x02/2 )
274         {
275            x ^= 0x0001;
276         }
277      }
278
279      if( !(i & 0x4000/2) )
280      {
281         if( !(i & 0x300/2) )
282         {
283            x ^= 0x0001;
284         }
285      }
286
287      /* bit 13 xor layer */
288
289      if( !(i & 0x1000/2) )
290      {
291         if( i & 0x2000/2 )
292         {
293            if( i & 0x8000/2 )
294            {
295               if( !(i & 0x100/2) )
296               {
297                  if( i & 0x200/2 )
298                  {
299                     if( !(i & 0x40/2) )
300                     {
301                        x ^= 0x2000;
302                     }
303                  }
304                  else
305                  {
306                     x ^= 0x2000;
307                  }
308               }
309            }
310            else
311            {
312               if( !(i & 0x100/2) )
313               {
314                  x ^= 0x2000;
315               }
316            }
317         }
318         else
319         {
320            if( i & 0x8000/2 )
321            {
322               if( i & 0x200/2 )
323               {
324                  if( !(i & 0x40/2) )
325                  {
326                     x ^= 0x2000;
327                  }
328               }
329               else
330               {
331                  x ^= 0x2000;
332               }
333            }
334            else
335            {
336               x ^= 0x2000;
337            }
338         }
339      }
340
341      src[i] = x;
342   }
343
344
345}
346
347static DRIVER_INIT( lhzb2a )
348{
349   int i;
350   UINT16 *src = (UINT16 *) (memory_region(machine, "maincpu"));
351
352   int rom_size = 0x80000;
353
354   for (i=0; i<rom_size/2; i++)
355   {
356      UINT16 x = src[i];
357
358      /* bit 0 xor layer */
359
360      if( i & 0x20/2 )
361      {
362         if( i & 0x02/2 )
363         {
364            x ^= 0x0001;
365         }
366      }
367
368      if( !(i & 0x4000/2) )
369      {
370         if( !(i & 0x300/2) )
371         {
372            x ^= 0x0001;
373         }
374      }
375
376      /* bit 5 xor layer */
377
378      if( i & 0x4000/2 )
379      {
380         if( i & 0x8000/2 )
381         {
382            if( i & 0x2000/2 )
383            {
384               if( i & 0x200/2 )
385               {
386                  if( !(i & 0x40/2) || (i & 0x800/2) )
387                  {
388                     x ^= 0x0020;
389                  }
390               }
391            }
392         }
393         else
394         {
395            if( !(i & 0x40/2) || (i & 0x800/2) )
396            {
397               x ^= 0x0020;
398            }
399         }
400      }
401
402      src[i] = x;
403   }
404
405}
406
407static DRIVER_INIT( slqz2 )
408{
409   int i;
410   UINT16 *src = (UINT16 *) (memory_region(machine, "maincpu"));
411
412   int rom_size = 0x80000;
413
414   for (i=0; i<rom_size/2; i++)
415   {
416      UINT16 x = src[i];
417
418      /* bit 0 xor layer */
419
420      if( i & 0x20/2 )
421      {
422         if( i & 0x02/2 )
423         {
424            x ^= 0x0001;
425         }
426      }
427
428      if( !(i & 0x4000/2) )
429      {
430         if( !(i & 0x300/2) )
431         {
432            x ^= 0x0001;
433         }
434      }
435
436      /* bit 14 xor layer */
437
438      if( i & 0x1000/2 )
439      {
440         if( i & 0x800/2 )
441         {
442            x ^= 0x4000;
443         }
444         else
445         {
446            if( i & 0x200/2 )
447            {
448               if( !(i & 0x100/2) )
449               {
450                  if( i & 0x40/2 )
451                  {
452                     x ^= 0x4000;
453                  }
454               }
455            }
456            else
457            {
458               x ^= 0x4000;
459            }
460         }
461      }
462      else
463      {
464         if( i & 0x800/2 )
465         {
466            x ^= 0x4000;
467         }
468         else
469         {
470            if( !(i & 0x100/2) )
471            {
472               if( i & 0x40/2 )
473               {
474                  x ^= 0x4000;
475               }
476            }
477         }
478      }
479
480      src[i] = x;
481   }
482}
483
484static DRIVER_INIT( sdmg2 )
485{
486   int i;
487   UINT16 *src = (UINT16 *) (memory_region(machine, "maincpu"));
488
489   int rom_size = 0x80000;
490
491   for (i=0; i<rom_size/2; i++)
492   {
493      UINT16 x = src[i];
494
495      /* bit 0 xor layer */
496
497      if( i & 0x20/2 )
498      {
499         if( i & 0x02/2 )
500         {
501            x ^= 0x0001;
502         }
503      }
504
505      if( !(i & 0x4000/2) )
506      {
507         if( !(i & 0x300/2) )
508         {
509            x ^= 0x0001;
510         }
511      }
512
513      /* bit 9 xor layer */
514
515      if( i & 0x20000/2 )
516      {
517         x ^= 0x0200;
518      }
519      else
520      {
521         if( !(i & 0x400/2) )
522         {
523            x ^= 0x0200;
524         }
525      }
526
527      /* bit 12 xor layer */
528
529      if( i & 0x20000/2 )
530      {
531         x ^= 0x1000;
532      }
533
534      src[i] = x;
535   }
536}
537
538GAME( 1998, lhzb2,    0,        igs_m68,    igs_m68,    lhzb2,  ROT0,  "IGS", "Mahjong Long Hu Zheng Ba 2 (set 1)", GAME_NOT_WORKING )
539GAME( 1998, lhzb2a,   lhzb2,    igs_m68,    igs_m68,    lhzb2a, ROT0,  "IGS", "Mahjong Long Hu Zheng Ba 2 (set 2)", GAME_NOT_WORKING )
540GAME( 1998, slqz2,    0,        igs_m68,    igs_m68,    slqz2,  ROT0,  "IGS", "Mahjong Shuang Long Qiang Zhu 2", GAME_NOT_WORKING )
541GAME( 1997, sdmg2,    0,        igs_m68,    igs_m68,    sdmg2,  ROT0,  "IGS", "Mahjong Super Da Man Guan 2", GAME_NOT_WORKING )
542

Previous 15994 Revisions Next


© 1998-2018 The MESS Team