Previous 15994 Revisions Next

r1769 Wednesday 27th February, 2008 at 17:18:49 UTC by Dirk Best
Cleanup of files removed from the MAME tree
[src/mame/drivers]ampoker.c bking2.c galgames.c mpatrol.c ninjakun.c pkunwar.c raiders5.c skychut.c troangel.c yard.c
[src/mame/includes]skychut.h
[src/mame/layout]ampoker.lay
[src/mame/video]ampoker.c bking2.c mpatrol.c ninjakun.c pkunwar.c raiders5.c skychut.c troangel.c yard.c
[src/osd/windows]verinfo.c

src/mame/includes/skychut.h
r1768r1769
1/***************************************************************************
2
3    IREM M-10,M-11 and M-15 based hardware
4
5****************************************************************************/
6
7
8#define IREMM10_MASTER_CLOCK      (25000000)
9
10#define IREMM10_CPU_CLOCK      (IREMM10_MASTER_CLOCK/20)
11#define IREMM10_PIXEL_CLOCK      (IREMM10_MASTER_CLOCK/5)
12#define IREMM10_HTOTAL         (318)
13#define IREMM10_HBSTART         (248)
14#define IREMM10_HBEND         (8)
15#define IREMM10_VTOTAL         (262)
16#define IREMM10_VBSTART         (240)
17#define IREMM10_VBEND         (16)
18
19#define IREMM15_MASTER_CLOCK   (11730000)
20
21#define IREMM15_CPU_CLOCK      (IREMM15_MASTER_CLOCK/10)
22#define IREMM15_PIXEL_CLOCK      (IREMM15_MASTER_CLOCK/2)
23#define IREMM15_HTOTAL         (372)
24#define IREMM15_HBSTART         (256)
25#define IREMM15_HBEND         (0)
26#define IREMM15_VTOTAL         (262)
27#define IREMM15_VBSTART         (240)
28#define IREMM15_VBEND         (16)
29
30typedef struct _irem_state irem_state;
31struct _irem_state
32{
33   /* memory pointers */
34   UINT8 *         chargen;
35   UINT8 *         memory;
36   UINT8 *         rom;
37
38   /* machine states */
39
40   /* sound state */
41
42   /* video state */
43   UINT8         bottomline;
44   UINT8          flip;
45
46   /* Specific states */
47};
48
49
50/*----------- defined in video/skychut.c -----------*/
51
52
53WRITE8_HANDLER( skychut_colorram_w );
54WRITE8_HANDLER( iremm15_chargen_w );
55
56VIDEO_UPDATE( iremm10 );
57VIDEO_UPDATE( iremm15 );
58
59VIDEO_START( iremm10 );
60VIDEO_START( iremm15 );
61
src/mame/video/troangel.c
r1768r1769
1#include "driver.h"
2
3
4UINT8 *troangel_scroll;
5
6static int flipscreen;
7
8
9/***************************************************************************
10
11  Convert the color PROMs into a more useable format.
12
13  Tropical Angel has two 256x4 character palette PROMs, one 32x8 sprite
14  palette PROM, and one 256x4 sprite color lookup table PROM.
15
16  I don't know for sure how the palette PROMs are connected to the RGB
17  output, but it's probably something like this; note that RED and BLUE
18  are swapped wrt the usual configuration.
19
20  bit 7 -- 220 ohm resistor  -- RED
21        -- 470 ohm resistor  -- RED
22        -- 220 ohm resistor  -- GREEN
23        -- 470 ohm resistor  -- GREEN
24        -- 1  kohm resistor  -- GREEN
25        -- 220 ohm resistor  -- BLUE
26        -- 470 ohm resistor  -- BLUE
27  bit 0 -- 1  kohm resistor  -- BLUE
28
29***************************************************************************/
30PALETTE_INIT( troangel )
31{
32   int i;
33   #define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
34   #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
35
36
37   /* character palette */
38   for (i = 0;i < 256;i++)
39   {
40      int bit0,bit1,bit2,r,g,b;
41
42
43      /* red component */
44      bit0 = 0;
45      bit1 = (color_prom[256] >> 2) & 0x01;
46      bit2 = (color_prom[256] >> 3) & 0x01;
47      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
48      /* green component */
49      bit0 = (color_prom[0] >> 3) & 0x01;
50      bit1 = (color_prom[256] >> 0) & 0x01;
51      bit2 = (color_prom[256] >> 1) & 0x01;
52      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
53      /* blue component */
54      bit0 = (color_prom[0] >> 0) & 0x01;
55      bit1 = (color_prom[0] >> 1) & 0x01;
56      bit2 = (color_prom[0] >> 2) & 0x01;
57      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
58
59      palette_set_color(machine,i,MAKE_RGB(r,g,b));
60      COLOR(0,i) = i;
61      color_prom++;
62   }
63
64   color_prom += 256;
65   /* color_prom now points to the beginning of the sprite palette */
66
67
68   /* sprite palette */
69   for (i = 0;i < 16;i++)
70   {
71      int bit0,bit1,bit2,r,g,b;
72
73
74      /* red component */
75      bit0 = 0;
76      bit1 = (*color_prom >> 6) & 0x01;
77      bit2 = (*color_prom >> 7) & 0x01;
78      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
79      /* green component */
80      bit0 = (*color_prom >> 3) & 0x01;
81      bit1 = (*color_prom >> 4) & 0x01;
82      bit2 = (*color_prom >> 5) & 0x01;
83      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
84      /* blue component */
85      bit0 = (*color_prom >> 0) & 0x01;
86      bit1 = (*color_prom >> 1) & 0x01;
87      bit2 = (*color_prom >> 2) & 0x01;
88      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
89
90      palette_set_color(machine,i+256,MAKE_RGB(r,g,b));
91      color_prom++;
92   }
93
94   color_prom += 16;
95   /* color_prom now points to the beginning of the sprite lookup table */
96
97
98   /* sprite lookup table */
99   for (i = 0;i < TOTAL_COLORS(1);i++)
100   {
101      COLOR(1,i) = 256 + (~*color_prom & 0x0f);
102      color_prom++;
103   }
104}
105
106
107
108WRITE8_HANDLER( troangel_flipscreen_w )
109{
110   /* screen flip is handled both by software and hardware */
111   data ^= ~readinputport(4) & 1;
112
113   flipscreen = data & 1;
114
115   coin_counter_w(0,data & 0x02);
116   coin_counter_w(1,data & 0x20);
117}
118
119
120
121
122static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
123{
124   int offs;
125   const gfx_element *gfx = machine->gfx[0];
126
127   for (offs = videoram_size - 2;offs >= 0;offs -= 2)
128   {
129      int sx,sy,code,attr,flipx,flipy;
130
131
132      sx = (offs/2) % 32;
133      sy = (offs/2) / 32;
134
135      attr = videoram[offs+0];
136      code = videoram[offs+1] | ((attr & 0xc0) << 2);
137      flipx = attr & 0x20;
138      flipy = (attr & 0x10) >> 4;
139
140      if (flipscreen)
141      {
142         sx = 31 - sx;
143         sy = 31 - sy;
144         flipx = !flipx;
145      }
146
147      drawgfx(tmpbitmap,gfx,
148         code,
149         attr & 0x0f,
150         flipx,flipy ^ flipscreen,
151         8*sx,8*sy,
152         0,TRANSPARENCY_NONE,0);
153   }
154
155   {
156      int xscroll[256];
157
158      if (flipscreen)
159      {
160         /* fixed */
161         for (offs = 0;offs < 64;offs++) xscroll[255-offs] = 0;
162
163         /* scroll (wraps around) */
164         for (offs = 64;offs < 128;offs++) xscroll[255-offs] = troangel_scroll[64];
165
166         /* linescroll (no wrap) */
167         for (offs = 128;offs < 256;offs++) xscroll[255-offs] = troangel_scroll[offs];
168      }
169      else
170      {
171         /* fixed */
172         for (offs = 0;offs < 64;offs++) xscroll[offs] = 0;
173
174         /* scroll (wraps around) */
175         for (offs = 64;offs < 128;offs++) xscroll[offs] = -troangel_scroll[64];
176
177         /* linescroll (no wrap) */
178         for (offs = 128;offs < 256;offs++) xscroll[offs] = -troangel_scroll[offs];
179      }
180
181      copyscrollbitmap(bitmap,tmpbitmap,256,xscroll,0,0,cliprect,TRANSPARENCY_NONE,0);
182   }
183}
184
185static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
186{
187   int offs;
188
189
190   for (offs = spriteram_size-4;offs >= 0;offs -= 4)
191   {
192      UINT8 attributes = spriteram[offs+1];
193      int sx = spriteram[offs+3];
194      int sy = ((224-spriteram[offs+0]-32)&0xff)+32;
195      int code = spriteram[offs+2];
196      int color = attributes&0x1f;
197      int flipy = attributes&0x80;
198      int flipx = attributes&0x40;
199
200      int tile_number = code & 0x3f;
201
202      int bank = 0;
203      if( code&0x80 ) bank += 1;
204      if( attributes&0x20 ) bank += 2;
205
206      if (flipscreen)
207      {
208         sx = 240 - sx;
209         sy = 224 - sy;
210         flipx = !flipx;
211         flipy = !flipy;
212      }
213
214      drawgfx(bitmap,machine->gfx[1+bank],
215         tile_number,
216         color,
217         flipx,flipy,
218         sx,sy,
219         cliprect,TRANSPARENCY_PEN,0);
220   }
221}
222
223
224
225VIDEO_UPDATE( troangel )
226{
227   draw_background(machine, bitmap, cliprect);
228   draw_sprites(machine, bitmap, cliprect);
229   return 0;
230}
src/mame/video/raiders5.c
r1768r1769
1/*******************************************************************************
2
3Raiders5 (c) 1985 Taito / UPL
4
5Video hardware driver by Uki
6
7    02/Jun/2001 -
8
9*******************************************************************************/
10
11#include "driver.h"
12
13
14UINT8 *raiders5_foreground_videoram;
15UINT8 *raiders5_foreground_colorram;
16UINT8 *raiders5_background_videoram;
17UINT8 *raiders5_background_colorram;
18UINT8 *raiders5_spriteram;
19size_t raiders5_spriteram_size;
20
21
22static UINT8 raiders5_scroll_x;
23static UINT8 raiders5_scroll_y;
24static UINT8 raiders5_flip_screen;
25
26static tilemap *background_tilemap;
27static tilemap *foreground_tilemap;
28
29
30
31/*************************************
32 *
33 *  Callbacks for the TileMap code
34 *
35 *************************************/
36
37static TILE_GET_INFO( get_background_tile_info )
38{
39   UINT8 bank = ((raiders5_background_colorram[tile_index] >> 1) & 0x01) + 3;  /* ? */
40
41   UINT16 code = raiders5_background_videoram[tile_index] |
42            ((raiders5_background_colorram[tile_index] & 0x01) << 8);
43
44   UINT8 color = raiders5_background_colorram[tile_index] >> 4;
45
46   SET_TILE_INFO(bank, code, color, 0);
47}
48
49
50static TILE_GET_INFO( get_foreground_tile_info )
51{
52   UINT16 code = raiders5_foreground_videoram[tile_index];
53
54   UINT8 color = raiders5_foreground_colorram[tile_index] >> 4;
55
56   SET_TILE_INFO(2, code, color, 0);
57}
58
59
60
61/*************************************
62 *
63 *  Video system start
64 *
65 *************************************/
66
67VIDEO_START( raiders5 )
68{
69   background_tilemap = tilemap_create(get_background_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
70   foreground_tilemap = tilemap_create(get_foreground_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32);
71
72   tilemap_set_scrolldx(background_tilemap, 7, 0);
73
74   tilemap_set_transparent_pen(foreground_tilemap, 0);
75}
76
77
78
79/*************************************
80 *
81 *  Memory handlers
82 *
83 *************************************/
84
85WRITE8_HANDLER( raiders5_scroll_x_w )
86{
87   raiders5_scroll_x = data;
88}
89
90
91WRITE8_HANDLER( raiders5_scroll_y_w )
92{
93   raiders5_scroll_y = data;
94}
95
96
97WRITE8_HANDLER( raiders5_flip_screen_w )
98{
99   raiders5_flip_screen = data & 0x01;
100
101   tilemap_set_flip(ALL_TILEMAPS, (raiders5_flip_screen ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0));
102}
103
104
105WRITE8_HANDLER( raiders5_foreground_videoram_w )
106{
107   raiders5_foreground_videoram[offset] = data;
108   tilemap_mark_tile_dirty(foreground_tilemap, offset);
109}
110
111
112WRITE8_HANDLER( raiders5_foreground_colorram_w )
113{
114   raiders5_foreground_colorram[offset] = data;
115   tilemap_mark_tile_dirty(foreground_tilemap, offset);
116}
117
118
119WRITE8_HANDLER( raiders5_background_videoram_w )
120{
121   offs_t y = (offset + ((raiders5_scroll_y & 0xf8) << 2)) & 0x3e0;
122   offs_t x = (offset + (raiders5_scroll_x >> 3)) & 0x1f;
123
124   raiders5_background_videoram[y | x] = data;
125   tilemap_mark_tile_dirty(background_tilemap, y | x);
126}
127
128
129READ8_HANDLER( raiders5_background_videoram_r )
130{
131   offs_t y = (offset + ((raiders5_scroll_y & 0xf8) << 2)) & 0x3e0;
132   offs_t x = (offset + (raiders5_scroll_x >> 3)) & 0x1f;
133
134   return raiders5_background_videoram[y | x];
135}
136
137
138WRITE8_HANDLER( raiders5_background_colorram_w )
139{
140   offs_t y = (offset + ((raiders5_scroll_y & 0xf8) << 2)) & 0x3e0;
141   offs_t x = (offset + (raiders5_scroll_x >> 3)) & 0x1f;
142
143   raiders5_background_colorram[y | x] = data;
144   tilemap_mark_tile_dirty(background_tilemap, y | x);
145}
146
147
148READ8_HANDLER( raiders5_background_colorram_r )
149{
150   offs_t y = (offset + ((raiders5_scroll_y & 0xf8) << 2)) & 0x3e0;
151   offs_t x = (offset + (raiders5_scroll_x >> 3)) & 0x1f;
152
153   return raiders5_background_colorram[y | x];
154}
155
156
157WRITE8_HANDLER( raiders5_paletteram_w )
158{
159   paletteram_BBGGRRII_w(offset, data);
160
161   if (offset < 0x10)
162   {
163      if (offset != 1)
164      {
165         int i;
166
167         for (i = 0; i < 0x10; i++)
168         {
169            paletteram_BBGGRRII_w(offset + (i * 0x10) + 0x0200, data);
170         }
171      }
172
173      paletteram_BBGGRRII_w((offset * 0x10) + 0x0201, data);
174   }
175}
176
177
178
179/*************************************
180 *
181 *  Video update
182 *
183 *************************************/
184
185static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
186{
187   offs_t offs;
188
189   for (offs = 0; offs < raiders5_spriteram_size; offs += 32)
190   {
191      UINT8 bank = (raiders5_spriteram[offs + 3] >> 1) & 0x01;
192
193      UINT8 code = ((raiders5_spriteram[offs + 3] << 6) & 0x40) | (raiders5_spriteram[offs + 0] >> 2);
194
195      UINT8 color = raiders5_spriteram[offs + 3] >> 4;
196
197      int flip_y = ((raiders5_spriteram[offs + 0] >> 1) & 0x01) ^ raiders5_flip_screen;
198      int flip_x = ((raiders5_spriteram[offs + 0] >> 0) & 0x01) ^ raiders5_flip_screen;
199
200      UINT8 y = raiders5_spriteram[offs + 2];
201      UINT8 x = raiders5_spriteram[offs + 1];
202
203      if (raiders5_flip_screen)
204      {
205         y = 240 - y;
206         x = 240 - x;
207      }
208
209      drawgfx(bitmap,machine->gfx[bank],
210            code, color, flip_x, flip_y,
211            x, y, cliprect, TRANSPARENCY_PEN, 0);
212
213      /* draw it wrapped around */
214      drawgfx(bitmap,machine->gfx[bank],
215            code, color, flip_x, flip_y,
216            x - 0x100, y, cliprect, TRANSPARENCY_PEN, 0);
217   }
218}
219
220
221VIDEO_UPDATE( raiders5 )
222{
223   tilemap_set_scrolly(background_tilemap, 0, raiders5_scroll_y);
224   tilemap_set_scrollx(background_tilemap, 0, raiders5_scroll_x);
225
226   tilemap_draw(bitmap, cliprect, background_tilemap, 0, 0);
227
228   draw_sprites(machine, bitmap, cliprect);
229
230   tilemap_draw(bitmap, cliprect, foreground_tilemap, 0, 0);
231
232   return 0;
233}
src/mame/video/bking2.c
r1768r1769
1/***************************************************************************
2
3  bking2.c
4
5  Functions to emulate the video hardware of the machine.
6
7***************************************************************************/
8
9#include "driver.h"
10
11extern UINT8* bking2_playfield_ram;
12
13
14static int pc3259_output[4];
15static int pc3259_mask;
16
17static UINT8 xld1;
18static UINT8 xld2;
19static UINT8 xld3;
20static UINT8 yld1;
21static UINT8 yld2;
22static UINT8 yld3;
23
24static int ball1_pic;
25static int ball2_pic;
26static int crow_pic;
27static int crow_flip;
28static int palette_bank;
29static int controller;
30static int hit;
31
32static mame_bitmap* helper0;
33static mame_bitmap* helper1;
34
35static tilemap* bg_tilemap;
36
37
38/***************************************************************************
39
40  Convert the color PROMs into a more useable format.
41
42  The palette PROM is connected to the RGB output this way:
43
44  bit 7 -- 390 ohm resistor  -- BLUE
45        -- 220 ohm resistor  -- BLUE
46        -- 820 ohm resistor  -- GREEN
47        -- 390 ohm resistor  -- GREEN
48        -- 220 ohm resistor  -- GREEN
49        -- 820 ohm resistor  -- RED
50        -- 390 ohm resistor  -- RED
51  bit 0 -- 220 ohm resistor  -- RED
52
53***************************************************************************/
54PALETTE_INIT( bking2 )
55{
56   int i;
57   #define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
58   #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
59
60
61   for (i = 0;i < machine->drv->total_colors;i++)
62   {
63      int bit0,bit1,bit2,r,g,b;
64
65
66      /* red component */
67      bit0 = (*color_prom >> 0) & 0x01;
68      bit1 = (*color_prom >> 1) & 0x01;
69      bit2 = (*color_prom >> 2) & 0x01;
70      r = 0x92 * bit0 + 0x46 * bit1 + 0x27 * bit2;
71      /* green component */
72      bit0 = (*color_prom >> 3) & 0x01;
73      bit1 = (*color_prom >> 4) & 0x01;
74      bit2 = (*color_prom >> 5) & 0x01;
75      g = 0x92 * bit0 + 0x46 * bit1 + 0x27 * bit2;
76      /* blue component */
77      bit0 = (*color_prom >> 6) & 0x01;
78      bit1 = (*color_prom >> 7) & 0x01;
79      bit2 = 0;
80      b = 0x92 * bit0 + 0x46 * bit1 + 0x27 * bit2;
81
82      palette_set_color(machine,i,MAKE_RGB(r,g,b));
83      color_prom++;
84   }
85
86   /* color PROM A7-A8 is the palette select */
87
88   /* character colors. Image bits go to A0-A2 of the color PROM */
89   for (i = 0; i < TOTAL_COLORS(0); i++)
90   {
91      COLOR(0,i) = ((i << 4) & 0x180) | (i & 0x07);
92   }
93
94   /* crow colors. Image bits go to A5-A6. */
95   for (i = 0; i < TOTAL_COLORS(1); i++)
96   {
97      COLOR(1,i) = ((i << 5) & 0x180) | ((i & 0x03) << 5);
98   }
99
100   /* ball colors. Ball 1 image bit goes to A3. Ball 2 to A4. */
101   for (i = 0; i < TOTAL_COLORS(2); i++)
102   {
103      COLOR(2,i) = ((i << 6) & 0x180) | ((i & 0x01) << 3);
104      COLOR(3,i) = ((i << 6) & 0x180) | ((i & 0x01) << 4);
105   }
106}
107
108
109WRITE8_HANDLER( bking2_xld1_w )
110{
111   xld1 = -data;
112}
113
114WRITE8_HANDLER( bking2_yld1_w )
115{
116   yld1 = -data;
117}
118
119WRITE8_HANDLER( bking2_xld2_w )
120{
121   xld2 = -data;
122}
123
124WRITE8_HANDLER( bking2_yld2_w )
125{
126   yld2 = -data;
127}
128
129WRITE8_HANDLER( bking2_xld3_w )
130{
131   xld3 = -data;
132}
133
134WRITE8_HANDLER( bking2_yld3_w )
135{
136   yld3 = -data;
137}
138
139
140WRITE8_HANDLER( bking2_cont1_w )
141{
142   /* D0 = COIN LOCK */
143   /* D1 = BALL 5 (Controller selection) */
144   /* D2 = VINV (flip screen) */
145   /* D3 = Not Connected */
146   /* D4-D7 = CROW0-CROW3 (selects crow picture) */
147
148   coin_lockout_global_w(~data & 0x01);
149
150   flip_screen = data & 0x04;
151
152   tilemap_set_flip(ALL_TILEMAPS, flip_screen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
153
154   controller = data & 0x02;
155
156   crow_pic = (data >> 4) & 0x0f;
157}
158
159WRITE8_HANDLER( bking2_cont2_w )
160{
161   /* D0-D2 = BALL10 - BALL12 (Selects player 1 ball picture) */
162   /* D3-D5 = BALL20 - BALL22 (Selects player 2 ball picture) */
163   /* D6 = HIT1 */
164   /* D7 = HIT2 */
165
166   ball1_pic = (data >> 0) & 0x07;
167   ball2_pic = (data >> 3) & 0x07;
168
169   hit = data >> 6;
170}
171
172WRITE8_HANDLER( bking2_cont3_w )
173{
174   /* D0 = CROW INV (inverts Crow picture and coordinates) */
175   /* D1-D2 = COLOR 0 - COLOR 1 (switches 4 color palettes, global across all graphics) */
176   /* D3 = SOUND STOP */
177
178   crow_flip = ~data & 0x01;
179
180   if (palette_bank != ((data >> 1) & 0x03))
181   {
182      tilemap_mark_all_tiles_dirty(bg_tilemap);
183   }
184
185   palette_bank = (data >> 1) & 0x03;
186
187   sound_global_enable(~data & 0x08);
188}
189
190
191WRITE8_HANDLER( bking2_msk_w )
192{
193   pc3259_mask++;
194}
195
196
197WRITE8_HANDLER( bking2_hitclr_w )
198{
199   pc3259_mask = 0;
200
201   pc3259_output[0] = 0;
202   pc3259_output[1] = 0;
203   pc3259_output[2] = 0;
204   pc3259_output[3] = 0;
205}
206
207
208WRITE8_HANDLER( bking2_playfield_w )
209{
210   bking2_playfield_ram[offset] = data;
211   tilemap_mark_tile_dirty(bg_tilemap, offset / 2);
212}
213
214
215READ8_HANDLER( bking2_input_port_5_r )
216{
217   return readinputport(controller ? 7 : 5);
218}
219
220READ8_HANDLER( bking2_input_port_6_r )
221{
222   return readinputport(controller ? 8 : 6);
223}
224
225READ8_HANDLER( bking2_pos_r )
226{
227   return pc3259_output[offset / 8] << 4;
228}
229
230
231static TILE_GET_INFO( get_tile_info )
232{
233   UINT8 code0 = bking2_playfield_ram[2 * tile_index + 0];
234   UINT8 code1 = bking2_playfield_ram[2 * tile_index + 1];
235
236   int flags = 0;
237
238   if (code1 & 4) flags |= TILE_FLIPX;
239   if (code1 & 8) flags |= TILE_FLIPY;
240
241   SET_TILE_INFO(0, code0 + 256 * code1, palette_bank, flags);
242}
243
244
245VIDEO_START( bking2 )
246{
247   bg_tilemap = tilemap_create(get_tile_info, tilemap_scan_rows, 0, 8, 8, 32, 32);
248   helper0 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
249   helper1 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
250}
251
252
253VIDEO_UPDATE( bking2 )
254{
255   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
256
257   /* draw the balls */
258
259   drawgfx(bitmap, machine->gfx[2],
260      ball1_pic,
261      palette_bank,
262      0, 0,
263      xld1, yld1,
264      cliprect, TRANSPARENCY_PEN, 0);
265
266   drawgfx(bitmap, machine->gfx[3],
267      ball2_pic,
268      palette_bank,
269      0, 0,
270      xld2, yld2,
271      cliprect, TRANSPARENCY_PEN, 0);
272
273   /* draw the crow */
274
275   drawgfx(bitmap, machine->gfx[1],
276      crow_pic,
277      palette_bank,
278      crow_flip, crow_flip,
279      crow_flip ? xld3 - 16 : 256 - xld3, crow_flip ? yld3 - 16 : 256 - yld3,
280      cliprect, TRANSPARENCY_PEN, 0);
281   return 0;
282}
283
284
285VIDEO_EOF( bking2 )
286{
287   static const rectangle rect = { 0, 7, 0, 15 };
288
289   int xld = 0;
290   int yld = 0;
291
292   UINT32 latch = 0;
293
294   if (pc3259_mask == 6)   /* player 1 */
295   {
296      xld = xld1;
297      yld = yld1;
298
299      drawgfx(helper1, machine->gfx[2],
300         ball1_pic,
301         0,
302         0, 0,
303         0, 0,
304         &rect, TRANSPARENCY_NONE, 0);
305
306      latch = 0x0C00;
307   }
308
309   if (pc3259_mask == 3)   /* player 2 */
310   {
311      xld = xld2;
312      yld = yld2;
313
314      drawgfx(helper1, machine->gfx[3],
315         ball2_pic,
316         0,
317         0, 0,
318         0, 0,
319         &rect, TRANSPARENCY_NONE, 0);
320
321      latch = 0x0400;
322   }
323
324   tilemap_set_scrollx(bg_tilemap, 0, flip_screen ? -xld : xld);
325   tilemap_set_scrolly(bg_tilemap, 0, flip_screen ? -yld : yld);
326
327   tilemap_draw(helper0, &rect, bg_tilemap, 0, 0);
328
329   tilemap_set_scrollx(bg_tilemap, 0, 0);
330   tilemap_set_scrolly(bg_tilemap, 0, 0);
331
332   if (latch != 0)
333   {
334      const UINT8* MASK = memory_region(REGION_USER1) + 8 * hit;
335
336      int x;
337      int y;
338
339      for (y = rect.min_y; y <= rect.max_y; y++)
340      {
341         const UINT16* p0 = BITMAP_ADDR16(helper0, y, 0);
342         const UINT16* p1 = BITMAP_ADDR16(helper1, y, 0);
343
344         for (x = rect.min_x; x <= rect.max_x; x++)
345         {
346            if (MASK[p0[x] & 7] && p1[x])
347            {
348               int col = (xld + x) / 8 + 1;
349               int row = (yld + y) / 8 + 0;
350
351               latch |= (flip_screen ? 31 - col : col) << 0;
352               latch |= (flip_screen ? 31 - row : row) << 5;
353
354               pc3259_output[0] = (latch >> 0x0) & 0xf;
355               pc3259_output[1] = (latch >> 0x4) & 0xf;
356               pc3259_output[2] = (latch >> 0x8) & 0xf;
357               pc3259_output[3] = (latch >> 0xc) & 0xf;
358
359               return;
360            }
361         }
362      }
363   }
364}
src/mame/video/ampoker.c
r1768r1769
1/********************************************************************************
2
3
4    AMERICAN POKER 2 - VIDEO HARDWARE
5    ---------------------------------
6
7    Company:    Novomatic.
8    Year:       1990.
9
10    Original preliminary driver:   Curt Coder.
11    Rewrite and additional work:   Roberto Fresca, with a lot of help of Grull Osgo.
12
13
14    --- Supported Sets ---
15
16    Old name | New name | Relation | Description
17    --------------------------------------------
18    ampokr2b   ampoker2   parent     American Poker II.
19      ----     ampkr2b1   clone      American Poker II (bootleg, set 1).
20    ampokr2a   ampkr2b2   clone      American Poker II (bootleg, set 2).
21    ampoker2   ampkr2b3   clone      American Poker II (bootleg, set 3).
22    ampokr2c   pkrdewin   clone      Poker De Win.
23      ----     ampkr95    clone      American Poker 95.
24      ----     sigmapkr   parent     Sigma Poker.
25      ----     sigma2k    parent     Sigma Poker 2000.
26
27
28********************************************************************************/
29
30
31#include "driver.h"
32
33static tilemap *bg_tilemap;
34
35
36PALETTE_INIT( ampoker2 )
37{
38   #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
39
40   int i;
41
42/*    - bits -
43      76543210
44      RRRGGGBB
45*/
46   for (i = 0; i < machine->drv->total_colors; i++)
47   {
48      int bit0, bit1, bit2, r, g, b;
49
50      /* blue component */
51      bit0 = 0;
52      bit1 = (*color_prom >> 0) & 0x01;
53      bit2 = (*color_prom >> 1) & 0x01;
54      b =  ( 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
55
56      /* green component */
57      bit0 = (*color_prom >> 2) & 0x01;
58      bit1 = (*color_prom >> 3) & 0x01;
59      bit2 = (*color_prom >> 4) & 0x01;
60      g =  ( 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
61
62      /* red component */
63      bit0 = (*color_prom >> 5) & 0x01;
64      bit1 = (*color_prom >> 6) & 0x01;
65      bit2 = (*color_prom >> 7) & 0x01;
66      r = ( 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
67
68      palette_set_color(machine, i, MAKE_RGB(r, g, b));
69
70      color_prom++;
71   }
72}
73
74WRITE8_HANDLER( ampoker2_videoram_w )
75{
76   videoram[offset] = data;
77   tilemap_mark_tile_dirty(bg_tilemap, offset / 2);
78}
79
80static TILE_GET_INFO( get_bg_tile_info )
81{
82   int offs = tile_index * 2;
83   int attr = videoram[offs + 1];
84   int code = videoram[offs];
85   int color = attr;
86   code=code+(256*(color & 0x03));   /* code = color.bit1 + color.bit0 + code */
87   color= color >> 1;            /* color = color - bit0 (bit1..bit7) */
88
89   SET_TILE_INFO(0, code, color, 0);
90}
91
92static TILE_GET_INFO( s2k_get_bg_tile_info )
93{
94   int offs = tile_index * 2;
95   int attr = videoram[offs + 1];
96   int code = videoram[offs];
97   int color = attr;
98   code=code+(256*(color & 0x0f));   /* the game use 2 extra bits */
99   color= color >> 1;
100
101   SET_TILE_INFO(0, code, color, 0);
102}
103
104VIDEO_START(ampoker2)
105{
106   bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows,
107      TILEMAP_TYPE_PEN, 8, 8, 64, 32);
108}
109
110VIDEO_START(sigma2k)
111{
112   bg_tilemap = tilemap_create(s2k_get_bg_tile_info, tilemap_scan_rows,
113      TILEMAP_TYPE_PEN, 8, 8, 64, 32);
114}
115
116VIDEO_UPDATE(ampoker2)
117{
118   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
119   return 0;
120}
src/mame/video/mpatrol.c
r1768r1769
1/***************************************************************************
2
3  video.c
4
5  Functions to emulate the video hardware of the machine.
6
7***************************************************************************/
8
9#include "driver.h"
10
11#define BGHEIGHT 64
12
13static UINT8 bg1xpos;
14static UINT8 bg1ypos;
15static UINT8 bg2xpos;
16static UINT8 bg2ypos;
17static UINT8 bgcontrol;
18
19static tilemap* bg_tilemap;
20
21
22/***************************************************************************
23
24  Convert the color PROMs into a more useable format.
25
26  Moon Patrol has one 256x8 character palette PROM, one 32x8 background
27  palette PROM, one 32x8 sprite palette PROM and one 256x4 sprite lookup
28  table PROM.
29
30  The character and background palette PROMs are connected to the RGB output
31  this way:
32
33  bit 7 -- 220 ohm resistor  -- BLUE
34        -- 470 ohm resistor  -- BLUE
35        -- 220 ohm resistor  -- GREEN
36        -- 470 ohm resistor  -- GREEN
37        -- 1  kohm resistor  -- GREEN
38        -- 220 ohm resistor  -- RED
39        -- 470 ohm resistor  -- RED
40  bit 0 -- 1  kohm resistor  -- RED
41
42  The sprite palette PROM is connected to the RGB output this way. Note that
43  RED and BLUE are swapped wrt the usual configuration.
44
45  bit 7 -- 220 ohm resistor  -- RED
46        -- 470 ohm resistor  -- RED
47        -- 220 ohm resistor  -- GREEN
48        -- 470 ohm resistor  -- GREEN
49        -- 1  kohm resistor  -- GREEN
50        -- 220 ohm resistor  -- BLUE
51        -- 470 ohm resistor  -- BLUE
52  bit 0 -- 1  kohm resistor  -- BLUE
53
54***************************************************************************/
55PALETTE_INIT( mpatrol )
56{
57   int i;
58   #define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
59   #define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
60
61
62   /* character palette */
63   for (i = 0;i < 512;i++)
64   {
65      int bit0,bit1,bit2,r,g,b;
66
67      COLOR(0, i) = i;
68
69      /* red component */
70      bit0 = (*color_prom >> 0) & 0x01;
71      bit1 = (*color_prom >> 1) & 0x01;
72      bit2 = (*color_prom >> 2) & 0x01;
73      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
74      /* green component */
75      bit0 = (*color_prom >> 3) & 0x01;
76      bit1 = (*color_prom >> 4) & 0x01;
77      bit2 = (*color_prom >> 5) & 0x01;
78      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
79      /* blue component */
80      bit0 = 0;
81      bit1 = (*color_prom >> 6) & 0x01;
82      bit2 = (*color_prom >> 7) & 0x01;
83      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
84
85      palette_set_color(machine,i,MAKE_RGB(r,g,b));
86      color_prom++;
87   }
88
89   /* background palette */
90   for (i = 0;i < 32;i++)
91   {
92      int bit0,bit1,bit2,r,g,b;
93
94
95      /* red component */
96      bit0 = (*color_prom >> 0) & 0x01;
97      bit1 = (*color_prom >> 1) & 0x01;
98      bit2 = (*color_prom >> 2) & 0x01;
99      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
100      /* green component */
101      bit0 = (*color_prom >> 3) & 0x01;
102      bit1 = (*color_prom >> 4) & 0x01;
103      bit2 = (*color_prom >> 5) & 0x01;
104      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
105      /* blue component */
106      bit0 = 0;
107      bit1 = (*color_prom >> 6) & 0x01;
108      bit2 = (*color_prom >> 7) & 0x01;
109      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
110
111      palette_set_color(machine,i+512,MAKE_RGB(r,g,b));
112      color_prom++;
113   }
114
115   /* color_prom now points to the beginning of the sprite palette */
116
117   /* sprite palette */
118   for (i = 0;i < 32;i++)
119   {
120      int bit0,bit1,bit2,r,g,b;
121
122
123      /* red component */
124      bit0 = 0;
125      bit1 = (*color_prom >> 6) & 0x01;
126      bit2 = (*color_prom >> 7) & 0x01;
127      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
128      /* green component */
129      bit0 = (*color_prom >> 3) & 0x01;
130      bit1 = (*color_prom >> 4) & 0x01;
131      bit2 = (*color_prom >> 5) & 0x01;
132      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
133      /* blue component */
134      bit0 = (*color_prom >> 0) & 0x01;
135      bit1 = (*color_prom >> 1) & 0x01;
136      bit2 = (*color_prom >> 2) & 0x01;
137      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
138
139      palette_set_color(machine,i+512+32,MAKE_RGB(r,g,b));
140      color_prom++;
141   }
142
143   /* color_prom now points to the beginning of the sprite lookup table */
144
145   /* sprite lookup table */
146   for (i = 0;i < TOTAL_COLORS(1);i++)
147   {
148      COLOR(1,i) = 512+32 + (*color_prom++);
149      if (i % 4 == 3) color_prom += 4;   /* half of the PROM is unused */
150   }
151
152   /* background */
153   /* the palette is a 32x8 PROM with many colors repeated. The address of */
154   /* the colors to pick is as follows: */
155   /* xbb00: mountains */
156   /* 0xxbb: hills */
157   /* 1xxbb: city */
158   COLOR(2,0) = 512;
159   COLOR(2,1) = 512+4;
160   COLOR(2,2) = 512+8;
161   COLOR(2,3) = 512+12;
162   COLOR(3,0) = 512;
163   COLOR(3,1) = 512+1;
164   COLOR(3,2) = 512+2;
165   COLOR(3,3) = 512+3;
166   COLOR(4,0) = 512;
167   COLOR(4,1) = 512+16+1;
168   COLOR(4,2) = 512+16+2;
169   COLOR(4,3) = 512+16+3;
170}
171
172
173
174static TILE_GET_INFO( get_tile_info )
175{
176   UINT8 video = videoram[tile_index];
177   UINT8 color = colorram[tile_index];
178
179   int flag = 0;
180   int code = 0;
181
182   code = video;
183
184   if (color & 0x80)
185   {
186      code |= 0x100;
187   }
188
189   if (tile_index / 32 <= 6)
190   {
191      flag |= TILE_FORCE_LAYER0; /* lines 0 to 6 are opaqe? */
192   }
193
194   SET_TILE_INFO(0, code, color & 0x3f, flag);
195}
196
197
198
199VIDEO_START( mpatrol )
200{
201   bg_tilemap = tilemap_create(get_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32);
202
203   tilemap_set_transparent_pen(bg_tilemap, 0);
204   tilemap_set_scrolldx(bg_tilemap, 128 - 1, -1);
205   tilemap_set_scrolldy(bg_tilemap, 16, 16);
206   tilemap_set_scroll_rows(bg_tilemap, 4); /* only lines 192-256 scroll */
207
208   state_save_register_global(bg1xpos);
209   state_save_register_global(bg1ypos);
210   state_save_register_global(bg2xpos);
211   state_save_register_global(bg2ypos);
212   state_save_register_global(bgcontrol);
213}
214
215
216
217WRITE8_HANDLER( mpatrol_scroll_w )
218{
219
220/*
221    According to the schematics there is only one video register that holds the X scroll value
222    with a NAND gate on the V64 and V128 lines to control when it's read, and when
223    255 (via 8 pull up resistors) is used.
224
225    So we set the first 3 quarters to 255 and the last to the scroll value
226*/
227   tilemap_set_scrollx(bg_tilemap, 0, 255);
228   tilemap_set_scrollx(bg_tilemap, 1, 255);
229   tilemap_set_scrollx(bg_tilemap, 2, 255);
230   tilemap_set_scrollx(bg_tilemap, 3, -data);
231}
232
233
234
235WRITE8_HANDLER( mpatrol_videoram_w )
236{
237   videoram[offset] = data;
238   tilemap_mark_tile_dirty(bg_tilemap, offset);
239}
240
241
242
243WRITE8_HANDLER( mpatrol_colorram_w )
244{
245   colorram[offset] = data;
246   tilemap_mark_tile_dirty(bg_tilemap, offset);
247}
248
249
250/* This looks like some kind of protection implemented by a custom chip on the
251   scroll board. It mangles the value written to the port mpatrol_bg1xpos_w, as
252   follows: result = popcount(value & 0x7f) ^ (value >> 7) */
253READ8_HANDLER( mpatrol_protection_r )
254{
255   int popcount = 0;
256   int temp;
257
258   for (temp = bg1xpos & 0x7f; temp != 0; temp >>= 1)
259      popcount += temp & 1;
260   return popcount ^ (bg1xpos >> 7);
261}
262
263
264WRITE8_HANDLER( mpatrol_bg1ypos_w )
265{
266   bg1ypos = data;
267}
268WRITE8_HANDLER( mpatrol_bg1xpos_w )
269{
270   bg1xpos = data;
271}
272WRITE8_HANDLER( mpatrol_bg2xpos_w )
273{
274   bg2xpos = data;
275}
276WRITE8_HANDLER( mpatrol_bg2ypos_w )
277{
278   bg2ypos = data;
279}
280WRITE8_HANDLER( mpatrol_bgcontrol_w )
281{
282   bgcontrol = data;
283}
284
285
286
287WRITE8_HANDLER( mpatrol_flipscreen_w )
288{
289   coin_counter_w(0, data & 0x02);
290   coin_counter_w(1, data & 0x20);
291
292   /* screen flip is handled both by software and hardware */
293
294   flip_screen_set((data ^ ~readinputport(4)) & 1);
295}
296
297
298
299static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect, int xpos, int ypos, int image)
300{
301   rectangle rect;
302
303   if (flip_screen)
304   {
305      xpos = 255 - xpos;
306      ypos = 255 - ypos - BGHEIGHT;
307   }
308
309   xpos += 128;
310
311   drawgfx(bitmap, machine->gfx[image],
312      0, 0,
313      flip_screen,
314      flip_screen,
315      xpos,
316      ypos,
317      cliprect,
318      TRANSPARENCY_PEN, 0);
319
320   drawgfx(bitmap, machine->gfx[image],
321      0, 0,
322      flip_screen,
323      flip_screen,
324      xpos - 256,
325      ypos,
326      cliprect,
327      TRANSPARENCY_PEN, 0);
328
329   rect.min_x = machine->screen[0].visarea.min_x;
330   rect.max_x = machine->screen[0].visarea.max_x;
331
332   if (flip_screen)
333   {
334      rect.min_y = ypos - BGHEIGHT;
335      rect.max_y = ypos - 1;
336   }
337   else
338   {
339      rect.min_y = ypos + BGHEIGHT;
340      rect.max_y = ypos + 2 * BGHEIGHT - 1;
341   }
342
343   fillbitmap(bitmap, machine->remapped_colortable[machine->gfx[image]->color_base + 3], &rect);
344}
345
346
347
348VIDEO_UPDATE( mpatrol )
349{
350   int offs;
351
352   fillbitmap(bitmap, 0, cliprect);
353
354   if (!(bgcontrol & 0x20))
355   {
356      if (!(bgcontrol & 0x10))
357         draw_background(machine, bitmap, cliprect, bg2xpos, bg2ypos, 2); /* distant mountains */
358
359      if (!(bgcontrol & 0x02))
360         draw_background(machine, bitmap, cliprect, bg1xpos, bg1ypos, 3); /* hills */
361
362      if (!(bgcontrol & 0x04))
363         draw_background(machine, bitmap, cliprect, bg1xpos, bg1ypos, 4); /* cityscape */
364   }
365
366   tilemap_set_flip(bg_tilemap, flip_screen ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
367
368   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
369
370   /* draw the sprites */
371   for (offs = 0xfc; offs >= 0; offs -= 4)
372   {
373      int sy = 257 - spriteram[offs];
374      int color = spriteram[offs + 1] & 0x3f;
375      int flipx = spriteram[offs + 1] & 0x40;
376      int flipy = spriteram[offs + 1] & 0x80;
377      int code = spriteram[offs + 2];
378      int sx = spriteram[offs + 3];
379      rectangle clip;
380
381      /* sprites from offsets $00-$7F are processed in the upper half of the frame */
382      /* sprites from offsets $80-$FF are processed in the lower half of the frame */
383      clip = *cliprect;
384      if (!(offs & 0x80))
385         clip.min_y = 0, clip.max_y = 127;
386      else
387         clip.min_y = 128, clip.max_y = 255;
388
389      /* adjust for flipping */
390      if (flip_screen)
391      {
392         int temp = clip.min_y;
393         clip.min_y = 255 - clip.max_y;
394         clip.max_y = 255 - temp;
395         flipx = !flipx;
396         flipy = !flipy;
397         sx = 240 - sx;
398         sy = 257 + 11 - sy;
399      }
400
401      sx += 128;
402
403      /* in theory anyways; in practice, some of the molecule-looking guys get clipped */
404#ifdef SPLIT_SPRITES
405      sect_rect(&clip, cliprect);
406#else
407      clip = *cliprect;
408#endif
409
410      drawgfx(bitmap, machine->gfx[1],
411         code, color, flipx, flipy, sx, sy,
412         &clip, TRANSPARENCY_COLOR, 512+32);
413   }
414   return 0;
415}
src/mame/video/skychut.c
r1768r1769
1/***************************************************************************
2
3  video.c
4
5  Functions to emulate the video hardware of the machine.
6
7  (c) 12/2/1998 Lee Taylor
8
9  2006 - major rewrite by couriersud
10
11***************************************************************************/
12
13#include "driver.h"
14#include "deprecat.h"
15#include "skychut.h"
16
17static tilemap *      tx_tilemap;
18static gfx_element *   back_gfx;
19static UINT32         extyoffs[32*8];
20static UINT32         extxoffs[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
21
22static const gfx_layout backlayout =
23{
24   8,8*32,   /* 8*8 characters */
25   4,   /* 256 characters */
26   1,   /* 1 bits per pixel */
27   { 0 },
28   { 0, 1, 2, 3, 4, 5, 6, 7 },
29   { 0*8*32, 1*8*32, 2*8*32, 3*8*32, 4*8*32, 5*8*32, 6*8*32, 7*8*32 },
30   32*8*8,   /* every char takes 8 consecutive bytes */
31   extxoffs, extyoffs
32};
33
34static const gfx_layout charlayout =
35{
36   8,8,   /* 8*8 characters */
37   256,   /* 256 characters */
38   1,   /* 1 bits per pixel */
39   { 0 },
40   { 0, 1, 2, 3, 4, 5, 6, 7 },
41   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
42   8*8   /* every char takes 8 consecutive bytes */
43};
44
45static UINT32 tilemap_scan(UINT32 col,UINT32 row,UINT32 num_cols,UINT32 num_rows)
46{
47   //irem_state *state = Machine->driver_data;
48
49   return (31-col)*32 + row;
50}
51
52
53static void get_tile_info(running_machine *machine, tile_data *tileinfo, tilemap_memory_index tile_index, void *param)
54{
55   SET_TILE_INFO(0, videoram[tile_index], colorram[tile_index] & 0x07, 0);
56}
57
58
59WRITE8_HANDLER( skychut_colorram_w )
60{
61   if (colorram[offset] != data)
62   {
63      tilemap_mark_tile_dirty(tx_tilemap, offset);
64      colorram[offset] = data;
65   }
66}
67
68
69WRITE8_HANDLER( iremm15_chargen_w )
70{
71   irem_state *state = Machine->driver_data;
72
73   if (state->chargen[offset] != data)
74   {
75      state->chargen[offset] = data;
76      /* not very effective ... dirty would be better */
77      decodechar(Machine->gfx[0],offset >> 3,state->chargen);
78   }
79}
80
81
82INLINE void plot_pixel_iremm10(mame_bitmap *bm, int x, int y, int col)
83{
84   irem_state *state = Machine->driver_data;
85
86   if (!state->flip)
87      *BITMAP_ADDR16(bm, y, x) = col;
88   else
89      *BITMAP_ADDR16(bm, (IREMM10_VBSTART - 1)- (y - IREMM10_VBEND) + 6
90            , (IREMM10_HBSTART - 1)- (x- IREMM10_HBEND)) = col; // only when flip_screen(?)
91}
92
93VIDEO_START( iremm10 )
94{
95   //irem_state *state = machine->driver_data;
96   int i;
97
98   for (i=0;i<32*8;i++)
99      extyoffs[i] = i*8;
100
101   tx_tilemap = tilemap_create(get_tile_info,tilemap_scan,TILEMAP_TYPE_COLORTABLE,8,8,32,32);
102   tilemap_set_transparent_pen(tx_tilemap, 0x07);
103   tilemap_set_scrolldx(tx_tilemap, 0, 62);
104   tilemap_set_scrolldy(tx_tilemap, 0, 0);
105
106   back_gfx = allocgfx(&backlayout);
107   back_gfx->total_colors = 8;
108
109   machine->gfx[1] = back_gfx;
110   return ;
111}
112
113VIDEO_START( iremm15 )
114{
115   irem_state *state = machine->driver_data;
116
117   machine->gfx[0] = allocgfx(&charlayout);
118   machine->gfx[0]->total_colors = 8;
119
120   decodegfx(machine->gfx[0], state->chargen,0,256);
121
122   tx_tilemap = tilemap_create(get_tile_info,tilemap_scan,TILEMAP_TYPE_PEN,8,8,32,32);
123   tilemap_set_scrolldx(tx_tilemap, 0, 116);
124   tilemap_set_scrolldy(tx_tilemap, 0, 0);
125
126   return ;
127}
128
129/***************************************************************************
130
131  Draw the game screen in the given mame_bitmap.
132
133***************************************************************************/
134VIDEO_UPDATE( iremm10 )
135{
136   irem_state *state = machine->driver_data;
137   int offs;
138   static const int color[4]= { 3, 3, 5, 5 };
139   static const int xpos[4] = { 4*8, 26*8, 7*8, 6*8};
140   int i;
141
142   fillbitmap(bitmap,machine->pens[7],cliprect);
143
144   decodegfx(back_gfx, state->chargen,0,4);
145   for (i=0;i<4;i++)
146      if (state->flip)
147         drawgfx(bitmap, back_gfx, i, color[i], 1, 1, 31*8 - xpos[i], 6, cliprect, 0, 0);
148      else
149         drawgfx(bitmap, back_gfx, i, color[i], 0, 0, xpos[i], 0, cliprect, 0, 0);
150
151   if (state->bottomline)
152   {
153      int y;
154
155      for (y = IREMM10_VBEND;y < IREMM10_VBSTART;y++)
156      {
157         plot_pixel_iremm10(bitmap,16,y,0);
158      }
159   }
160
161   for (offs = videoram_size - 1;offs >= 0;offs--)
162      tilemap_mark_tile_dirty(tx_tilemap, offs);
163
164   tilemap_set_flip(tx_tilemap, state->flip ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
165   tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
166
167   return 0;
168}
169
170
171/***************************************************************************
172
173  Draw the game screen in the given mame_bitmap.
174
175***************************************************************************/
176VIDEO_UPDATE( iremm15 )
177{
178   irem_state *state = machine->driver_data;
179   int offs;
180
181   for (offs = videoram_size - 1;offs >= 0;offs--)
182      tilemap_mark_tile_dirty(tx_tilemap, offs);
183
184   //tilemap_mark_all_tiles_dirty(tx_tilemap);
185   tilemap_set_flip(tx_tilemap, state->flip ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
186   tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
187
188   return 0;
189}
190
src/mame/video/ninjakun.c
r1768r1769
1#include "driver.h"
2#include "sound/ay8910.h"
3
4
5UINT8 *ninjakun_fg_videoram;
6UINT8 *ninjakun_bg_videoram;
7static tilemap *bg_tilemap, *fg_tilemap;
8static UINT8 flipscreen;
9static UINT8 ninjakun_xscroll,ninjakun_yscroll;
10
11static UINT8 ninjakun_io_8000_ctrl[4];
12// static UINT8 old_scroll;
13
14/*******************************************************************************
15 Tilemap Callbacks
16*******************************************************************************/
17
18static TILE_GET_INFO( get_fg_tile_info ){
19   UINT32 tile_number = ninjakun_fg_videoram[tile_index] & 0xFF;
20   UINT8 attr  = ninjakun_fg_videoram[tile_index+0x400];
21   tile_number += (attr & 0x20) << 3; /* bank */
22   SET_TILE_INFO(
23         0,
24         tile_number,
25         (attr&0xf),
26         0);
27}
28
29static TILE_GET_INFO( get_bg_tile_info ){
30   UINT32 tile_number = ninjakun_bg_videoram[tile_index] & 0xFF;
31   UINT8 attr  = ninjakun_bg_videoram[tile_index+0x400];
32   tile_number += (attr & 0xC0) << 2; /* bank */
33   SET_TILE_INFO(
34         1,
35         tile_number,
36         (attr&0xf),
37         0);
38}
39
40WRITE8_HANDLER( ninjakun_fg_videoram_w ){
41   ninjakun_fg_videoram[offset] = data;
42   tilemap_mark_tile_dirty(fg_tilemap,offset&0x3ff);
43}
44
45WRITE8_HANDLER( ninjakun_bg_videoram_w ){
46
47   int y = (offset + ((ninjakun_yscroll & 0xf8) << 2) ) & 0x3e0;
48   int x = (offset + (ninjakun_xscroll >> 3) ) & 0x1f;
49   int offs = x+y+(offset & 0x400);
50
51   ninjakun_bg_videoram[offs] = data;
52   tilemap_mark_tile_dirty(bg_tilemap,x+y);
53}
54
55READ8_HANDLER( ninjakun_bg_videoram_r )
56{
57   int y = (offset + ((ninjakun_yscroll & 0xf8) << 2) ) & 0x3e0;
58   int x = (offset + (ninjakun_xscroll >> 3) ) & 0x1f;
59   int offs = x+y+(offset & 0x400);
60
61   return ninjakun_bg_videoram[offs];
62}
63
64/******************************************************************************/
65
66WRITE8_HANDLER( ninjakun_flipscreen_w ){
67   flipscreen = data?(TILEMAP_FLIPX|TILEMAP_FLIPY):0;
68   tilemap_set_flip( ALL_TILEMAPS,flipscreen );
69}
70
71READ8_HANDLER( ninjakun_io_8000_r ){
72   switch( offset ){
73   case 0: /* control */
74      return AY8910_read_port_0_r( 0 );
75
76   case 1: /* input read */
77      switch( ninjakun_io_8000_ctrl[0] ){
78      case 0xf:
79         return readinputport(4);
80      case 0xe:
81         return readinputport(3);
82      default:
83         return ninjakun_io_8000_ctrl[1];
84      }
85      break;
86
87   case 2: /* control */
88      return AY8910_read_port_1_r( 0 );
89
90   case 3: /* data */
91      return ninjakun_io_8000_ctrl[3];
92   }
93
94//  logerror("PC=%04x; RAM[0x800%d]\n",activecpu_get_pc(),offset);
95   return 0xFF;
96}
97
98/* static void handle_scrolly( UINT8 new_scroll ){ */
99
100/*  HACK!!!
101**
102**  New rows are always written at fixed locations above and below the background
103**  tilemaps, rather than at the logical screen boundaries with respect to scrolling.
104**
105**  I don't know how this is handled by the actual NinjaKun hardware, but the
106**  following is a crude approximation, yielding a playable game.
107*/
108
109/*
110    int old_row = old_scroll/8;
111    int new_row = new_scroll/8;
112    int i;
113    if( new_scroll!=old_scroll ){
114        tilemap_set_scrolly( bg_tilemap, 0, new_scroll&7 );
115
116        if ((new_row == ((old_row - 1) & 0xff)) || ((!old_row) && (new_row == 0x1f)))
117        {
118            for( i=0x400-0x21; i>=0; i-- ){
119                ninjakun_bg_videoram_w( i+0x20, ninjakun_bg_videoram[i] );
120            }
121        }
122        else if ((new_row == ((old_row + 1) & 0xff)) || ((old_row == 0x1f) && (!new_row)))
123        {
124            for( i=0x20; i<0x400; i++ ){
125                ninjakun_bg_videoram_w( i-0x20, ninjakun_bg_videoram[i] );
126            }
127        }
128
129        old_scroll = new_scroll;
130    }
131}
132*/
133
134
135WRITE8_HANDLER( ninjakun_io_8000_w ){
136   switch( offset ){
137   case 0x0: /* control#1 */
138      ninjakun_io_8000_ctrl[0] = data;
139      AY8910_control_port_0_w( 0, data );
140      break;
141
142   case 0x1: /* data#1 */
143      ninjakun_io_8000_ctrl[1] = data;
144      switch( ninjakun_io_8000_ctrl[0] ){
145      default:
146         AY8910_write_port_0_w( 0,data );
147         break;
148      }
149      break;
150
151   case 0x2: /* control#2 */
152      ninjakun_io_8000_ctrl[2] = data;
153      AY8910_control_port_1_w( 0, data );
154      break;
155
156   case 0x3: /* data#2 */
157      ninjakun_io_8000_ctrl[3] = data;
158      switch( ninjakun_io_8000_ctrl[2] ){
159      case 0xf:
160            tilemap_set_scrolly( bg_tilemap, 0, data );
161            ninjakun_yscroll = data;
162         break;
163      case 0xe:
164         if (flipscreen == 0)
165            tilemap_set_scrollx( bg_tilemap, 0, data-7 );
166         else
167            tilemap_set_scrollx( bg_tilemap, 0, data );
168            ninjakun_xscroll = data;
169         break;
170      default:
171         AY8910_write_port_1_w( 0,data );
172      }
173      break;
174   }
175}
176
177WRITE8_HANDLER( ninjakun_paletteram_w )
178{
179   int i;
180
181   paletteram_BBGGRRII_w(offset,data);
182
183   if (offset > 15)
184      return;
185
186   if (offset != 1)
187   {
188      for (i=0; i<16; i++)
189      {
190         paletteram_BBGGRRII_w(0x200+offset+i*16,data);
191      }
192   }
193   paletteram_BBGGRRII_w(0x200+offset*16+1,data);
194}
195
196/*******************************************************************************
197 Video Hardware Functions
198********************************************************************************
199 vh_start / vh_refresh
200*******************************************************************************/
201
202VIDEO_START( ninjakun ){
203    fg_tilemap = tilemap_create( get_fg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32 );
204   bg_tilemap = tilemap_create( get_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32 );
205   tilemap_set_transparent_pen( fg_tilemap,0 );
206
207   /* Save State Support */
208
209   state_save_register_global_array(ninjakun_io_8000_ctrl);
210   state_save_register_global(flipscreen);
211//  state_save_register_global(old_scroll);
212}
213
214static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect ){
215   const UINT8 *source = spriteram;
216   const UINT8 *finish = source+0x800;
217
218   const gfx_element *gfx = machine->gfx[2];
219
220   while( source<finish ){
221      int tile_number = source[0];
222      int sx = source[1];
223      int sy = source[2];
224      int attr = source[3];
225      int flipx = attr&0x10;
226      int flipy = attr&0x20;
227      int color = attr&0x0f;
228
229      if( flipscreen ){
230         sx = 240-sx;
231         sy = 240-sy;
232         flipx = !flipx;
233         flipy = !flipy;
234      }
235
236      drawgfx(
237         bitmap,
238         gfx,
239         tile_number,
240         color,
241         flipx,flipy,
242         sx,sy,
243         cliprect,
244         TRANSPARENCY_PEN,0
245      );
246      if (sx>240)
247         drawgfx(
248            bitmap,
249            gfx,
250            tile_number,
251            color,
252            flipx,flipy,
253            sx-256,sy,
254            cliprect,
255            TRANSPARENCY_PEN,0
256         );
257
258      source+=0x20;
259   }
260}
261
262VIDEO_UPDATE( ninjakun )
263{
264   int offs,chr,col,px,py,x,y;
265
266   tilemap_draw( bitmap,cliprect,bg_tilemap,0,0 );
267   tilemap_draw( bitmap,cliprect,fg_tilemap,0,0 );
268   draw_sprites( machine, bitmap,cliprect );
269
270   for (y=4; y<28; y++)
271   {
272      for (x=0; x<32; x++)
273      {
274         offs = y*32+x;
275         chr = ninjakun_fg_videoram[offs];
276         col = ninjakun_fg_videoram[offs + 0x400];
277         chr +=  (col & 0x20) << 3;
278
279         if ((col & 0x10) == 0)
280         {
281
282            if (flipscreen==0)
283            {
284               px = 8*x;
285               py = 8*y;
286            }
287            else
288            {
289               px = 248-8*x;
290               py = 248-8*y;
291            }
292
293            drawgfx(bitmap,machine->gfx[0],
294               chr,
295               col & 0x0f,
296               flipscreen,flipscreen,
297               px,py,
298               cliprect,TRANSPARENCY_PEN,0);
299         }
300      }
301   }
302
303
304   return 0;
305}
src/mame/video/pkunwar.c
r1768r1769
1/***************************************************************************
2
3  video.c
4
5  Functions to emulate the video hardware of the machine.
6
7***************************************************************************/
8
9#include "driver.h"
10
11
12static int flipscreen[2];
13
14
15WRITE8_HANDLER( pkunwar_flipscreen_w )
16{
17   flipscreen[0] = data & 1;
18   flipscreen[1] = data & 2;
19}
20
21
22
23VIDEO_UPDATE( pkunwar )
24{
25   int offs;
26
27
28   /* for every character in the Video RAM */
29   for (offs = videoram_size - 1;offs >= 0;offs--)
30   {
31      int sx,sy;
32
33
34      sx = offs % 32;
35      sy = offs / 32;
36      if (flipscreen[0]) sx = 31 - sx;
37      if (flipscreen[1]) sy = 31 - sy;
38
39      drawgfx(bitmap,machine->gfx[0],
40            videoram[offs] + ((colorram[offs] & 0x07) << 8),
41            (colorram[offs] & 0xf0) >> 4,
42            flipscreen[0],flipscreen[1],
43            8*sx,8*sy,
44            cliprect,TRANSPARENCY_NONE,0);
45   }
46
47
48   /* Draw the sprites. */
49   for (offs = 0;offs < spriteram_size;offs += 32)
50   {
51      int sx,sy,flipx,flipy;
52
53
54      sx = ((spriteram[offs + 1] + 8) & 0xff) - 8;
55      sy = spriteram[offs + 2];
56      flipx = spriteram[offs] & 0x01;
57      flipy = spriteram[offs] & 0x02;
58      if (flipscreen[0])
59      {
60         sx = 240 - sx;
61         flipx = !flipx;
62      }
63      if (flipscreen[1])
64      {
65         sy = 240 - sy;
66         flipy = !flipy;
67      }
68
69      drawgfx(bitmap,machine->gfx[1],
70            ((spriteram[offs] & 0xfc) >> 2) + ((spriteram[offs + 3] & 0x07) << 6),
71            (spriteram[offs + 3] & 0xf0) >> 4,
72            flipx,flipy,
73            sx,sy,
74            &machine->screen[0].visarea,TRANSPARENCY_PEN,0);
75   }
76
77
78   /* redraw characters which have priority over sprites */
79   for (offs = videoram_size - 1;offs >= 0;offs--)
80   {
81      if (colorram[offs] & 0x08)
82      {
83         int sx,sy;
84
85
86         sx = offs % 32;
87         sy = offs / 32;
88         if (flipscreen[0]) sx = 31 - sx;
89         if (flipscreen[1]) sy = 31 - sy;
90
91         drawgfx(bitmap,machine->gfx[0],
92               videoram[offs] + ((colorram[offs] & 0x07) << 8),
93               (colorram[offs] & 0xf0) >> 4,
94               flipscreen[0],flipscreen[1],
95               8*sx,8*sy,
96               &machine->screen[0].visarea,TRANSPARENCY_PEN,0);
97      }
98   }
99   return 0;
100}
src/mame/video/yard.c
r1768r1769
1/***************************************************************************
2
3  video.c
4
5  10 Yard Fight
6
7L Taylor
8J Clegg
9
10  Functions to emulate the video hardware of the machine.
11
12***************************************************************************/
13
14#include "driver.h"
15
16UINT8 *yard_scroll_x_low;
17UINT8 *yard_scroll_x_high;
18UINT8 *yard_scroll_y_low;
19UINT8 *yard_score_panel_disabled;
20static mame_bitmap *scroll_panel_bitmap;
21
22static tilemap *bg_tilemap;
23
24#define SCROLL_PANEL_WIDTH  (14*4)
25#define RADAR_PALETTE_BASE (256+16)
26#define TOTAL_COLORS(gfxn) (machine->gfx[gfxn]->total_colors * machine->gfx[gfxn]->color_granularity)
27#define COLOR(gfxn,offs) (colortable[machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs])
28
29static const rectangle clippanel =
30{
31   26*8, 32*8-1,
32   1*8, 31*8-1
33};
34
35static const rectangle clippanelflip =
36{
37   0*8, 6*8-1,
38   1*8, 31*8-1
39};
40
41/***************************************************************************
42
43  Convert the color PROMs into a more useable format.
44
45  10 Yard Fight has two 256x4 character palette PROMs, one 32x8 sprite
46  palette PROM, one 256x4 sprite color lookup table PROM, and two 256x4
47  radar palette PROMs.
48
49  I don't know for sure how the palette PROMs are connected to the RGB
50  output, but it's probably something like this; note that RED and BLUE
51  are swapped wrt the usual configuration.
52
53  bit 7 -- 220 ohm resistor  -- RED
54        -- 470 ohm resistor  -- RED
55        -- 220 ohm resistor  -- GREEN
56        -- 470 ohm resistor  -- GREEN
57        -- 1  kohm resistor  -- GREEN
58        -- 220 ohm resistor  -- BLUE
59        -- 470 ohm resistor  -- BLUE
60  bit 0 -- 1  kohm resistor  -- BLUE
61
62***************************************************************************/
63PALETTE_INIT( yard )
64{
65   int i;
66
67   /* character palette */
68   for (i = 0;i < 256;i++)
69   {
70      int bit0,bit1,bit2,r,g,b;
71
72      /* red component */
73      bit0 = 0;
74      bit1 = (color_prom[256] >> 2) & 0x01;
75      bit2 = (color_prom[256] >> 3) & 0x01;
76      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
77      /* green component */
78      bit0 = (color_prom[0] >> 3) & 0x01;
79      bit1 = (color_prom[256] >> 0) & 0x01;
80      bit2 = (color_prom[256] >> 1) & 0x01;
81      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
82      /* blue component */
83      bit0 = (color_prom[0] >> 0) & 0x01;
84      bit1 = (color_prom[0] >> 1) & 0x01;
85      bit2 = (color_prom[0] >> 2) & 0x01;
86      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
87
88      palette_set_color(machine,i,MAKE_RGB(r,g,b));
89
90      color_prom++;
91   }
92
93   color_prom += 256;
94   /* color_prom now points to the beginning of the sprite palette */
95
96   /* sprite palette */
97   for (i = 0;i < 16;i++)
98   {
99      int bit0,bit1,bit2,r,g,b;
100
101      /* red component */
102      bit0 = 0;
103      bit1 = (*color_prom >> 6) & 0x01;
104      bit2 = (*color_prom >> 7) & 0x01;
105      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
106      /* green component */
107      bit0 = (*color_prom >> 3) & 0x01;
108      bit1 = (*color_prom >> 4) & 0x01;
109      bit2 = (*color_prom >> 5) & 0x01;
110      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
111      /* blue component */
112      bit0 = (*color_prom >> 0) & 0x01;
113      bit1 = (*color_prom >> 1) & 0x01;
114      bit2 = (*color_prom >> 2) & 0x01;
115      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
116
117      palette_set_color(machine,i+256,MAKE_RGB(r,g,b));
118
119      color_prom++;
120   }
121
122   color_prom += 16;
123   /* color_prom now points to the beginning of the sprite lookup table */
124
125   /* sprite lookup table */
126   for (i = 0;i < TOTAL_COLORS(1);i++)
127      COLOR(1,i) = 256 + (*(color_prom++) & 0x0f);
128
129   /* color_prom now points to the beginning of the radar palette */
130
131   /* radar palette */
132   for (i = 0;i < 256;i++)
133   {
134      int bit0,bit1,bit2,r,g,b;
135
136      /* red component */
137      bit0 = 0;
138      bit1 = (color_prom[256] >> 2) & 0x01;
139      bit2 = (color_prom[256] >> 3) & 0x01;
140      r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
141      /* green component */
142      bit0 = (color_prom[0] >> 3) & 0x01;
143      bit1 = (color_prom[256] >> 0) & 0x01;
144      bit2 = (color_prom[256] >> 1) & 0x01;
145      g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
146      /* blue component */
147      bit0 = (color_prom[0] >> 0) & 0x01;
148      bit1 = (color_prom[0] >> 1) & 0x01;
149      bit2 = (color_prom[0] >> 2) & 0x01;
150      b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
151
152      palette_set_color(machine,i+256+16,MAKE_RGB(r,g,b));
153
154      color_prom++;
155   }
156}
157
158WRITE8_HANDLER( yard_videoram_w )
159{
160   videoram[offset] = data;
161   tilemap_mark_tile_dirty(bg_tilemap, offset / 2);
162}
163
164WRITE8_HANDLER( yard_scroll_panel_w )
165{
166   int sx,sy,i;
167
168   sx = ( offset % 16 );
169   sy = ( offset / 16 );
170
171   if (sx < 1 || sx > 14)  return;
172
173   sx = 4 * (sx - 1);
174
175   for (i = 0;i < 4;i++)
176   {
177      int col;
178
179      col = (data >> i) & 0x11;
180      col = ((col >> 3) | col) & 3;
181
182      *BITMAP_ADDR16(scroll_panel_bitmap, sy, sx + i) = Machine->pens[RADAR_PALETTE_BASE + (sy & 0xfc) + col];
183   }
184}
185
186static TILE_GET_INFO( yard_get_bg_tile_info )
187{
188   int offs = tile_index * 2;
189   int attr = videoram[offs + 1];
190   int code = videoram[offs] + ((attr & 0xc0) << 2);
191   int color = attr & 0x1f;
192   int flags = (attr & 0x20) ? TILE_FLIPX : 0;
193
194   SET_TILE_INFO(0, code, color, flags);
195}
196
197static UINT32 yard_tilemap_scan_rows( UINT32 col, UINT32 row, UINT32 num_cols, UINT32 num_rows )
198{
199   /* logical (col,row) -> memory offset */
200   if (col >= 32)
201      return (row+32)*32 + col-32;
202   else
203      return row*32 + col;
204}
205
206VIDEO_START( yard )
207{
208   bg_tilemap = tilemap_create(yard_get_bg_tile_info, yard_tilemap_scan_rows,
209      TILEMAP_TYPE_PEN, 8, 8, 64, 32);
210
211   scroll_panel_bitmap = auto_bitmap_alloc(SCROLL_PANEL_WIDTH, machine->screen[0].height, machine->screen[0].format);
212}
213
214#define DRAW_SPRITE(code, sy) drawgfx(bitmap, machine->gfx[1], code, color, flipx, flipy, sx, sy, cliprect, TRANSPARENCY_COLOR, 256);
215
216static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect )
217{
218   int offs;
219
220   for (offs = spriteram_size - 4; offs >= 0; offs -= 4)
221   {
222      int attr = spriteram[offs + 1];
223      int bank = (attr & 0x20) >> 5;
224      int code1 = spriteram[offs + 2] & 0xbf;
225      int code2 = 0;
226      int color = attr & 0x1f;
227      int flipx = attr & 0x40;
228      int flipy = attr & 0x80;
229      int sx = spriteram[offs + 3];
230      int sy1 = 241 - spriteram[offs];
231      int sy2 = 0;
232
233      if (flipy)
234      {
235         code2 = code1;
236         code1 += 0x40;
237      }
238      else
239      {
240         code2 = code1 + 0x40;
241      }
242
243      if (flip_screen)
244      {
245         sx = 240 - sx;
246         sy2 = 224 - sy1;
247         sy1 = sy2 + 0x10;
248         flipx = !flipx;
249         flipy = !flipy;
250      }
251      else
252      {
253         sy2 = sy1 + 0x10;
254      }
255
256      DRAW_SPRITE(code1 + 256 * bank, sy1)
257      DRAW_SPRITE(code2 + 256 * bank, sy2)
258   }
259}
260
261static void draw_panel( mame_bitmap *bitmap, const rectangle *cliprect )
262{
263   if (! *yard_score_panel_disabled)
264   {
265      int sx = flip_screen ? cliprect->min_x - 8 : cliprect->max_x + 1 - SCROLL_PANEL_WIDTH;
266
267      copybitmap(bitmap, scroll_panel_bitmap, flip_screen, flip_screen, sx, 0,
268         flip_screen ? &clippanelflip : &clippanel, TRANSPARENCY_NONE, 0);
269   }
270}
271
272VIDEO_UPDATE( yard )
273{
274   tilemap_set_scrollx(bg_tilemap, 0, (*yard_scroll_x_high * 0x100) + *yard_scroll_x_low);
275   tilemap_set_scrolly(bg_tilemap, 0, *yard_scroll_y_low);
276
277   tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
278   draw_sprites(machine, bitmap, cliprect);
279   draw_panel(bitmap, cliprect);
280   return 0;
281}
src/mame/layout/ampoker.lay
r1768r1769
1<?xml version="1.0"?>
2<mamelayout version="2">
3   <element name="L0" defstate="1">
4      <rect>
5         <color red="1.0" green="1.0" blue="1.0" />
6      </rect>
7      <text string="DEAL/TAKE" state="1">
8         <color red="0.0" green="0.0" blue="0.0" />
9         <bounds x="0" y="0.1" width="1" height="0.8" />
10      </text>
11   </element>
12
13   <element name="L1" defstate="1">
14      <rect>
15         <color red="1.0" green="1.0" blue="1.0" />
16      </rect>
17      <text string="BET/RED" state="1">
18         <color red="0.0" green="0.0" blue="0.0" />
19         <bounds x="0" y="0.1" width="1" height="0.8" />
20      </text>
21   </element>
22
23   <element name="L2" defstate="1">
24      <rect>
25         <color red="1.0" green="1.0" blue="1.0" />
26      </rect>
27      <text string="BLACK" state="1">
28         <color red="0.0" green="0.0" blue="0.0" />
29         <bounds x="0" y="0.1" width="1" height="0.8" />
30      </text>
31   </element>
32
33   <element name="L3" defstate="1">
34      <rect>
35         <color red="1.0" green="0.0" blue="0.0" />
36      </rect>
37      <text string="HOLD1" state="1">
38         <color red="0.0" green="0.0" blue="0.0" />
39         <bounds x="0" y="0.1" width="1" height="0.8" />
40      </text>
41   </element>
42
43   <element name="L4" defstate="1">
44      <rect>
45         <color red="1.0" green="0.0" blue="0.0" />
46      </rect>
47      <text string="HOLD2" state="1">
48         <color red="0.0" green="0.0" blue="0.0" />
49         <bounds x="0" y="0.1" width="1" height="0.8" />
50      </text>
51   </element>
52
53   <element name="L5" defstate="1">
54      <rect>
55         <color red="1.0" green="0.0" blue="0.0" />
56      </rect>
57      <text string="HOLD3" state="1">
58         <color red="0.0" green="0.0" blue="0.0" />
59         <bounds x="0" y="0.1" width="1" height="0.8" />
60      </text>
61   </element>
62
63   <element name="L6" defstate="1">
64      <rect>
65         <color red="1.0" green="0.0" blue="0.0" />
66      </rect>
67      <text string="HOLD4" state="1">
68         <color red="0.0" green="0.0" blue="0.0" />
69         <bounds x="0" y="0.1" width="1" height="0.8" />
70      </text>
71   </element>
72
73   <element name="L7" defstate="1">
74      <rect>
75         <color red="1.0" green="0.0" blue="0.0" />
76      </rect>
77      <text string="HOLD5" state="1">
78         <color red="0.0" green="0.0" blue="0.0" />
79         <bounds x="0" y="0.1" width="1" height="0.8" />
80      </text>
81   </element>
82
83   <view name="Button Lamps">
84      <screen index="0">
85         <bounds left="0" top="0" right="4" bottom="3" />
86      </screen>
87      <bezel name="lamp0" element="L0">
88         <bounds x="0" y="3.13" width="0.40" height="0.24" />
89      </bezel>
90      <bezel name="lamp1" element="L1">
91         <bounds x="0.5" y="3.13" width="0.40" height="0.24" />
92      </bezel>
93      <bezel name="lamp2" element="L2">
94         <bounds x="1.0" y="3.13" width="0.40" height="0.24" />
95      </bezel>
96      <bezel name="lamp3" element="L3">
97         <bounds x="1.6" y="3.13" width="0.40" height="0.24" />
98      </bezel>
99      <bezel name="lamp4" element="L4">
100         <bounds x="2.1" y="3.13" width="0.40" height="0.24" />
101      </bezel>
102      <bezel name="lamp5" element="L5">
103         <bounds x="2.6" y="3.13" width="0.40" height="0.24" />
104      </bezel>
105      <bezel name="lamp6" element="L6">
106         <bounds x="3.1" y="3.13" width="0.40" height="0.24" />
107      </bezel>
108      <bezel name="lamp7" element="L7">
109         <bounds x="3.6" y="3.13" width="0.40" height="0.24" />
110      </bezel>
111   </view>
112</mamelayout>
src/mame/drivers/troangel.c
r1768r1769
1/****************************************************************************
2
3Tropical Angel
4
5driver by Phil Stroffolino
6
7IREM M57 board stack with a M52-SOUND-E sound PCB.
8
9M57-A-A:
10 TA-A-xx roms and proms
11 NEC D780C (Z80) CPU
12 NANAO KNA6032601 custom chip
13 NANAO KNA6032701 custom chip
14 8-way dipswitch (x2)
15 M58725P RAM (x3)
16 CN1 - Ribbon cable connector
17 CN2 - Ribbon cable connector
18 Ribbon cable connector to sound PCB
19
20M57-B-A:
21 TA-B-xx roms and proms
22 18.432 MHz OSC
23 CN1 - Ribbon cable connector
24 CN2 - Ribbon cable connector
25
26M52:
27 HD6803 CPU
28 AY-3-9810 (x2) sound chips
29 MSM5205 OKI sound chip (and an unpopulated socket for a second MSM5202)
30 3.579545 MHz OSC
31 2764 Program rom labeled "TA S-1A-"
32 Ribbon cable connector to M57-A-A PCB
33
34New Tropical Angel:
35 Roms where found on an official IREM board with genuine IREM Tropical Angel
36 license seal and genuine IREM serial number sticker.
37 The "new" roms have hand written labels, while those that match the current
38 Tropical Angel set look to be factory labeled chips.
39
40****************************************************************************/
41#include "driver.h"
42#include "audio/irem.h"
43
44extern UINT8 *troangel_scroll;
45WRITE8_HANDLER( troangel_flipscreen_w );
46PALETTE_INIT( troangel );
47VIDEO_UPDATE( troangel );
48
49
50
51static ADDRESS_MAP_START( troangel_readmem, ADDRESS_SPACE_PROGRAM, 8 )
52   AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM)
53   AM_RANGE(0x8000, 0x8fff) AM_READ(MRA8_RAM)
54   AM_RANGE(0x9000, 0x90ff) AM_READ(MRA8_RAM)
55   AM_RANGE(0xd000, 0xd000) AM_READ(input_port_0_r)
56   AM_RANGE(0xd001, 0xd001) AM_READ(input_port_1_r)
57   AM_RANGE(0xd002, 0xd002) AM_READ(input_port_2_r)
58   AM_RANGE(0xd003, 0xd003) AM_READ(input_port_3_r)
59   AM_RANGE(0xd004, 0xd004) AM_READ(input_port_4_r)
60   AM_RANGE(0xe000, 0xe7ff) AM_READ(MRA8_RAM)
61ADDRESS_MAP_END
62
63static ADDRESS_MAP_START( troangel_writemem, ADDRESS_SPACE_PROGRAM, 8 )
64   AM_RANGE(0x0000, 0x7fff) AM_WRITE(MWA8_ROM)
65   AM_RANGE(0x8000, 0x87ff) AM_WRITE(MWA8_RAM) AM_BASE(&videoram) AM_SIZE(&videoram_size)
66//  AM_RANGE(0x8800, 0x8fff) AM_WRITE(MWA8_RAM)
67   AM_RANGE(0x9000, 0x91ff) AM_WRITE(MWA8_RAM) AM_BASE(&troangel_scroll)
68   AM_RANGE(0xc820, 0xc8ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
69   AM_RANGE(0xd000, 0xd000) AM_WRITE(irem_sound_cmd_w)
70   AM_RANGE(0xd001, 0xd001) AM_WRITE(troangel_flipscreen_w)   /* + coin counters */
71   AM_RANGE(0xe000, 0xe7ff) AM_WRITE(MWA8_RAM)
72ADDRESS_MAP_END
73
74
75
76static INPUT_PORTS_START( troangel )
77   PORT_START_TAG("IN0")
78   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
79   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
80   /* coin input must be active for 19 frames to be consistently recognized */
81   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN3 ) PORT_IMPULSE(19)
82   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
83   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED )
84
85   PORT_START_TAG("IN1")
86   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY
87   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY
88   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
89   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
90   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
91   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
92   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
93   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
94
95   PORT_START_TAG("IN2")
96   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL
97   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL
98   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
99   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
100   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 )
101   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
102   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
103   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
104
105   PORT_START_TAG("DSW1")
106   PORT_DIPNAME( 0x03, 0x03, "Time" )
107   PORT_DIPSETTING(    0x03, "180 160 140" )
108   PORT_DIPSETTING(    0x02, "160 140 120" )
109   PORT_DIPSETTING(    0x01, "140 120 100" )
110   PORT_DIPSETTING(    0x00, "120 100 100" )
111   PORT_DIPNAME( 0x04, 0x04, "Crash Loss Time" )
112   PORT_DIPSETTING(    0x04, "5" )
113   PORT_DIPSETTING(    0x00, "10" )
114   PORT_DIPNAME( 0x08, 0x08, "Background Sound" )
115   PORT_DIPSETTING(    0x08, "Boat Motor" )
116   PORT_DIPSETTING(    0x00, "Music" )
117   /* TODO: support the different settings which happen in Coin Mode 2 */
118   PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) ) /* mapped on coin mode 1 */
119   PORT_DIPSETTING(    0xa0, DEF_STR( 6C_1C ) )
120   PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )
121   PORT_DIPSETTING(    0xc0, DEF_STR( 4C_1C ) )
122   PORT_DIPSETTING(    0xd0, DEF_STR( 3C_1C ) )
123   PORT_DIPSETTING(    0xe0, DEF_STR( 2C_1C ) )
124   PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
125   PORT_DIPSETTING(    0x70, DEF_STR( 1C_2C ) )
126   PORT_DIPSETTING(    0x60, DEF_STR( 1C_3C ) )
127   PORT_DIPSETTING(    0x50, DEF_STR( 1C_4C ) )
128   PORT_DIPSETTING(    0x40, DEF_STR( 1C_5C ) )
129   PORT_DIPSETTING(    0x30, DEF_STR( 1C_6C ) )
130   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
131   /* settings 0x10, 0x20, 0x80, 0x90 all give 1 Coin/1 Credit */
132
133   PORT_START_TAG("DSW2")
134   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
135   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
136   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
137   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
138   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
139   PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
140/* This activates a different coin mode. Look at the dip switch setting schematic */
141   PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
142   PORT_DIPSETTING(    0x04, "Mode 1" )
143   PORT_DIPSETTING(    0x00, "Mode 2" )
144/* TODO: the following enables an analog accelerator input read from 0xd003 */
145/* however that is the DSW1 input so it must be multiplexed some way */
146   PORT_DIPNAME( 0x08, 0x08, "Analog Accelarator" )
147   PORT_DIPSETTING(    0x08, DEF_STR( No ) )
148   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
149   /* In stop mode, press 2 to stop and 1 to restart */
150   PORT_DIPNAME( 0x10, 0x10, "Stop Mode (Cheat)")
151   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
152   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
153   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
154   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
155   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
156   PORT_DIPNAME( 0x40, 0x40, "Invulnerability (Cheat)")
157   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
158   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
159   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
160INPUT_PORTS_END
161
162
163
164static const gfx_layout charlayout =
165{
166   8,8, /* character size */
167   1024, /* number of characters */
168   3, /* bits per pixel */
169   { 0, 1024*8*8, 2*1024*8*8 },
170   { 0, 1, 2, 3, 4, 5, 6, 7 },
171   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
172   8*8   /* character offset */
173};
174
175static const gfx_layout spritelayout =
176{
177   16,32, /* sprite size */
178   64, /* number of sprites */
179   3, /* bits per pixel */
180   { 0, 0x4000*8, 2*0x4000*8 },
181   { 0, 1, 2, 3, 4, 5, 6, 7,
182         16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7 },
183   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
184         8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8,
185         256*64+0*8, 256*64+1*8, 256*64+2*8, 256*64+3*8, 256*64+4*8, 256*64+5*8, 256*64+6*8, 256*64+7*8,
186         256*64+8*8, 256*64+9*8, 256*64+10*8, 256*64+11*8, 256*64+12*8, 256*64+13*8, 256*64+14*8, 256*64+15*8 },
187   32*8   /* character offset */
188};
189
190static GFXDECODE_START( troangel )
191   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout,      0, 32 )
192   GFXDECODE_ENTRY( REGION_GFX2, 0x0000, spritelayout, 32*8, 32 )
193   GFXDECODE_ENTRY( REGION_GFX2, 0x1000, spritelayout, 32*8, 32 )
194   GFXDECODE_ENTRY( REGION_GFX2, 0x2000, spritelayout, 32*8, 32 )
195   GFXDECODE_ENTRY( REGION_GFX2, 0x3000, spritelayout, 32*8, 32 )
196GFXDECODE_END
197
198
199
200static MACHINE_DRIVER_START( troangel )
201
202   /* basic machine hardware */
203   MDRV_CPU_ADD(Z80, XTAL_18_432MHz/6)   /* verified on pcb */
204   MDRV_CPU_PROGRAM_MAP(troangel_readmem,troangel_writemem)
205   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
206
207   MDRV_SCREEN_REFRESH_RATE(57)
208   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1790)   /* accurate frequency, measured on a Moon Patrol board, is 56.75Hz. */)
209            /* the Lode Runner manual (similar but different hardware) */
210            /* talks about 55Hz and 1790ms vblank duration. */
211
212   /* video hardware */
213   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
214   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
215   MDRV_SCREEN_SIZE(32*8, 32*8)
216   MDRV_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 1*8, 31*8-1)
217   MDRV_GFXDECODE(troangel)
218   MDRV_PALETTE_LENGTH(32*8+16)
219   MDRV_COLORTABLE_LENGTH(32*8+32*8)
220
221   MDRV_PALETTE_INIT(troangel)
222   MDRV_VIDEO_START(generic)
223   MDRV_VIDEO_UPDATE(troangel)
224
225   /* sound hardware */
226   MDRV_IMPORT_FROM(irem_audio)
227MACHINE_DRIVER_END
228
229
230
231
232ROM_START( troangel )
233   ROM_REGION( 0x10000, REGION_CPU1, 0 )   /* main CPU */
234   ROM_LOAD( "ta-a-3k", 0x0000, 0x2000, CRC(f21f8196) SHA1(7cbf74b77a559ee70312b799e707394d9b849f5b) )
235   ROM_LOAD( "ta-a-3m", 0x2000, 0x2000, CRC(58801e55) SHA1(91bdda778f2c4486001bc4ad26d6f21ba275ae08) )
236   ROM_LOAD( "ta-a-3n", 0x4000, 0x2000, CRC(de3dea44) SHA1(1290755ffc04dc3b3667e063118669a0eab6fb79) )
237   ROM_LOAD( "ta-a-3q", 0x6000, 0x2000, CRC(fff0fc2a) SHA1(82f3f5a8817e956192323eb555daa85b7766676d) )
238
239   ROM_REGION(  0x10000 , REGION_CPU2, 0 )   /* sound CPU */
240   ROM_LOAD( "ta-s-1a", 0xe000, 0x2000, CRC(15a83210) SHA1(8ada510db689ffa372b2f4dc4bd1b1c69a0c5307) )
241
242   ROM_REGION( 0x06000, REGION_GFX1, ROMREGION_DISPOSE )
243   ROM_LOAD( "ta-a-3c", 0x00000, 0x2000, CRC(7ff5482f) SHA1(fe8c181fed113007d69d11e8aa467e86a6357ffb) )   /* characters */
244   ROM_LOAD( "ta-a-3d", 0x02000, 0x2000, CRC(06eef241) SHA1(4f327a54169046d8d84b5f5cf5d9f45e1df4dae6) )
245   ROM_LOAD( "ta-a-3e", 0x04000, 0x2000, CRC(e49f7ad8) SHA1(915de1084fd3c5fc81dd8c80107c28cc57b33226) )
246
247   ROM_REGION( 0x0c000, REGION_GFX2, ROMREGION_DISPOSE )
248   ROM_LOAD( "ta-b-5j", 0x00000, 0x2000, CRC(86895c0c) SHA1(b42b041e3e20dadd8411805d492133d371426ebf) )   /* sprites */
249   ROM_LOAD( "ta-b-5h", 0x02000, 0x2000, CRC(f8cff29d) SHA1(dabf3bbf50f73a381056131c2239c84dd966b63e) )
250   ROM_LOAD( "ta-b-5e", 0x04000, 0x2000, CRC(8b21ee9a) SHA1(1272722211d22d5b153e9415cc189a5aa9028543) )
251   ROM_LOAD( "ta-b-5d", 0x06000, 0x2000, CRC(cd473d47) SHA1(854cb532bd62851a206da2affd66a1257b7085b6) )
252   ROM_LOAD( "ta-b-5c", 0x08000, 0x2000, CRC(c19134c9) SHA1(028660e66fd033473c468b694e870c633ca05ec6) )
253   ROM_LOAD( "ta-b-5a", 0x0a000, 0x2000, CRC(0012792a) SHA1(b4380f5fbe5e9ce9b44f87ce48a8b402bab58b52) )
254
255   ROM_REGION( 0x0320, REGION_PROMS, 0 )
256   ROM_LOAD( "ta-a-5a", 0x0000, 0x0100, CRC(01de1167) SHA1(b9070f8c70eb362fc4d6a0a92235ce0a5b2ab858) ) /* chars palette low 4 bits */
257   ROM_LOAD( "ta-a-5b", 0x0100, 0x0100, CRC(efd11d4b) SHA1(7c7c356063ab35e4ffb8d65cd20c27c2a4b36537) ) /* chars palette high 4 bits */
258   ROM_LOAD( "ta-b-1b", 0x0200, 0x0020, CRC(f94911ea) SHA1(ad61a323476a97156a255a72048a28477b421284) ) /* sprites palette */
259   ROM_LOAD( "ta-b-3d", 0x0220, 0x0100, CRC(ed3e2aa4) SHA1(cfdfc151803080d1ecdd04af1bfea3dbdce8dca0) ) /* sprites lookup table */
260ROM_END
261
262ROM_START( newtangl ) /* Offical "upgrade" or hack? */
263   ROM_REGION( 0x10000, REGION_CPU1, 0 )   /* main CPU */
264   ROM_LOAD( "3k",   0x0000, 0x2000, CRC(3c6299a8) SHA1(a21a8452b75ce6174076878128d4f20b39b6d69d) )
265   ROM_LOAD( "3m",   0x2000, 0x2000, CRC(8d09056c) SHA1(4d2585103cc6e6c04015501d3c9e1578a8f9c0f5) )
266   ROM_LOAD( "3n",   0x4000, 0x2000, CRC(17b5a775) SHA1(d85c3371080bea82f19ac96fa0f1b332e1c86e27) )
267   ROM_LOAD( "3q",   0x6000, 0x2000, CRC(2e5fa773) SHA1(9a34fa43bde021fc7b00d8c3762c248e7b96dbf1) )
268
269   ROM_REGION(  0x10000 , REGION_CPU2, 0 )   /* sound CPU */
270   ROM_LOAD( "ta-s-1a-", 0xe000, 0x2000, CRC(ea8a05cb) SHA1(5683e4dca93066ee788287ab73a766fa303ebe84) )
271
272   ROM_REGION( 0x06000, REGION_GFX1, ROMREGION_DISPOSE )
273   ROM_LOAD( "ta-a-3c", 0x00000, 0x2000, CRC(7ff5482f) SHA1(fe8c181fed113007d69d11e8aa467e86a6357ffb) )   /* characters */
274   ROM_LOAD( "ta-a-3d", 0x02000, 0x2000, CRC(06eef241) SHA1(4f327a54169046d8d84b5f5cf5d9f45e1df4dae6) )
275   ROM_LOAD( "ta-a-3e", 0x04000, 0x2000, CRC(e49f7ad8) SHA1(915de1084fd3c5fc81dd8c80107c28cc57b33226) )
276
277   ROM_REGION( 0x0c000, REGION_GFX2, ROMREGION_DISPOSE )
278   ROM_LOAD( "5j",        0x00000, 0x2000, CRC(89409130) SHA1(3f37f820b1b86166cde7c039d657ebd036d490dd) )   /* sprites */
279   ROM_LOAD( "ta-b-5h", 0x02000, 0x2000, CRC(f8cff29d) SHA1(dabf3bbf50f73a381056131c2239c84dd966b63e) )
280   ROM_LOAD( "5e",        0x04000, 0x2000, CRC(5460a467) SHA1(505c1d9e69c39a74369da17f354b90486ee6afcd) )
281   ROM_LOAD( "ta-b-5d", 0x06000, 0x2000, CRC(cd473d47) SHA1(854cb532bd62851a206da2affd66a1257b7085b6) )
282   ROM_LOAD( "5c",        0x08000, 0x2000, CRC(4a20637a) SHA1(74099cb7f1727c2de2f066497097f1a9eeec0cea) )
283   ROM_LOAD( "ta-b-5a", 0x0a000, 0x2000, CRC(0012792a) SHA1(b4380f5fbe5e9ce9b44f87ce48a8b402bab58b52) )
284
285   ROM_REGION( 0x0320, REGION_PROMS, 0 )
286   ROM_LOAD( "ta-a-5a", 0x0000, 0x0100, CRC(01de1167) SHA1(b9070f8c70eb362fc4d6a0a92235ce0a5b2ab858) ) /* chars palette low 4 bits */
287   ROM_LOAD( "ta-a-5b", 0x0100, 0x0100, CRC(efd11d4b) SHA1(7c7c356063ab35e4ffb8d65cd20c27c2a4b36537) ) /* chars palette high 4 bits */
288   ROM_LOAD( "ta-b-1b", 0x0200, 0x0020, CRC(f94911ea) SHA1(ad61a323476a97156a255a72048a28477b421284) ) /* sprites palette */
289   ROM_LOAD( "ta-b-3d", 0x0220, 0x0100, CRC(ed3e2aa4) SHA1(cfdfc151803080d1ecdd04af1bfea3dbdce8dca0) ) /* sprites lookup table */
290ROM_END
291
292
293
294GAME( 1983, troangel,        0, troangel, troangel, 0, ROT0, "Irem", "Tropical Angel", 0 )
295GAME( 1983, newtangl, troangel, troangel, troangel, 0, ROT0, "Irem", "New Tropical Angel", 0 )
src/mame/drivers/raiders5.c
r1768r1769
1/*****************************************************************************
2
3Raiders5 (c) 1985 Taito / UPL
4
5    Driver by Uki
6
7    02/Jun/2001 -
8
9******************************************************************************
10
11Thanks to:
12
13David Haywood for ninjakid driver.
14
15Howie Cohen
16Frank Palazzolo
17Alex Pasadyn
18    for nova2001 driver.
19
20Notes:
21
22"Free Play" does not work properly...?
23
24*****************************************************************************/
25
26#include "driver.h"
27#include "sound/ay8910.h"
28
29
30extern UINT8 *raiders5_foreground_videoram;
31extern UINT8 *raiders5_foreground_colorram;
32extern UINT8 *raiders5_background_videoram;
33extern UINT8 *raiders5_background_colorram;
34extern UINT8 *raiders5_spriteram;
35extern size_t raiders5_spriteram_size;
36extern UINT8 *raiders5_paletteram;
37
38VIDEO_START( raiders5 );
39VIDEO_UPDATE( raiders5 );
40
41WRITE8_HANDLER( raiders5_scroll_x_w );
42WRITE8_HANDLER( raiders5_scroll_y_w );
43WRITE8_HANDLER( raiders5_flip_screen_w );
44
45WRITE8_HANDLER( raiders5_background_videoram_w );
46READ8_HANDLER( raiders5_background_videoram_r );
47WRITE8_HANDLER( raiders5_background_colorram_w );
48READ8_HANDLER( raiders5_background_colorram_r );
49WRITE8_HANDLER( raiders5_foreground_videoram_w );
50WRITE8_HANDLER( raiders5_foreground_colorram_w );
51
52WRITE8_HANDLER( raiders5_paletteram_w );
53
54
55
56static ADDRESS_MAP_START( raiders5_map_1, ADDRESS_SPACE_PROGRAM, 8 )
57   AM_RANGE(0x0000, 0x7fff) AM_ROM
58   AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE(&raiders5_spriteram) AM_SIZE(&raiders5_spriteram_size)
59   AM_RANGE(0x8800, 0x8bff) AM_READWRITE(MRA8_RAM, raiders5_foreground_videoram_w) AM_BASE(&raiders5_foreground_videoram)
60   AM_RANGE(0x8c00, 0x8fff) AM_READWRITE(MRA8_RAM, raiders5_foreground_colorram_w) AM_BASE(&raiders5_foreground_colorram)
61   AM_RANGE(0x9000, 0x93ff) AM_READWRITE(raiders5_background_videoram_r, raiders5_background_videoram_w) AM_BASE(&raiders5_background_videoram)
62   AM_RANGE(0x9400, 0x97ff) AM_READWRITE(raiders5_background_colorram_r, raiders5_background_colorram_w) AM_BASE(&raiders5_background_colorram)
63   AM_RANGE(0xa000, 0xa000) AM_WRITE(raiders5_scroll_x_w)
64   AM_RANGE(0xa001, 0xa001) AM_WRITE(raiders5_scroll_y_w)
65   AM_RANGE(0xa002, 0xa002) AM_WRITE(raiders5_flip_screen_w)
66   AM_RANGE(0xc000, 0xc000) AM_WRITE(AY8910_control_port_0_w)
67   AM_RANGE(0xc001, 0xc001) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w)
68   AM_RANGE(0xc002, 0xc002) AM_WRITE(AY8910_control_port_1_w)
69   AM_RANGE(0xc003, 0xc003) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w)
70   AM_RANGE(0xd000, 0xd1ff) AM_READWRITE(MRA8_RAM, raiders5_paletteram_w) AM_BASE(&paletteram)
71   AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE(1)
72ADDRESS_MAP_END
73
74
75static ADDRESS_MAP_START( raiders5_map_2, ADDRESS_SPACE_PROGRAM, 8 )
76   AM_RANGE(0x0000, 0x3fff) AM_ROM
77   AM_RANGE(0x8000, 0x8000) AM_WRITE(AY8910_control_port_0_w)
78   AM_RANGE(0x8001, 0x8001) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w)
79   AM_RANGE(0x8002, 0x8002) AM_WRITE(AY8910_control_port_1_w)
80   AM_RANGE(0x8003, 0x8003) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w)
81   AM_RANGE(0x9000, 0x9000) AM_READ(MRA8_NOP) /* unknown */
82   AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_SHARE(1)
83   AM_RANGE(0xc000, 0xc000) AM_READ(MRA8_NOP) /* unknown */
84   AM_RANGE(0xc800, 0xc800) AM_READ(MRA8_NOP) /* unknown */
85   AM_RANGE(0xd000, 0xd000) AM_READ(MRA8_NOP) /* unknown */
86   AM_RANGE(0xe000, 0xe000) AM_WRITE(raiders5_scroll_x_w)
87   AM_RANGE(0xe001, 0xe001) AM_WRITE(raiders5_scroll_y_w)
88   AM_RANGE(0xe002, 0xe002) AM_WRITE(raiders5_flip_screen_w)
89ADDRESS_MAP_END
90
91
92static ADDRESS_MAP_START( raiders5_io_map_1, ADDRESS_SPACE_IO, 8 )
93   AM_RANGE(0x00, 0x00) AM_READ(MRA8_NOP) /* watchdog? */
94ADDRESS_MAP_END
95
96
97
98static INPUT_PORTS_START( raiders5 )
99   PORT_START
100   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )
101   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
102   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
103   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
104   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
105   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
106   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
107   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
108
109   PORT_START
110   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5)
111   PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
112   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
113   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
114   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL
115   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL
116   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL
117   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL
118
119   PORT_START   /* DSW1 */
120   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
121   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
122   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
123   PORT_DIPNAME( 0x06, 0x06, DEF_STR( Lives ) )
124   PORT_DIPSETTING(    0x00, "2" )
125   PORT_DIPSETTING(    0x06, "3" )
126   PORT_DIPSETTING(    0x04, "4" )
127   PORT_DIPSETTING(    0x02, "5" )
128   PORT_DIPNAME( 0x08, 0x08, "1st Bonus" )
129   PORT_DIPSETTING(    0x08, "30000" )
130   PORT_DIPSETTING(    0x00, "40000" )
131   PORT_DIPNAME( 0x30, 0x30, "2nd Bonus" )
132   PORT_DIPSETTING(    0x30, "Every(?) 50000" )
133   PORT_DIPSETTING(    0x20, "Every(?) 70000" )
134   PORT_DIPSETTING(    0x10, "Every(?) 90000" )
135   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
136   PORT_DIPNAME( 0x40, 0x40, "Exercise" )
137   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
138   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
139   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Difficulty ) )
140   PORT_DIPSETTING(    0x80, DEF_STR( Normal ) )
141   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
142
143   PORT_START   /* DSW2*/
144   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
145   PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
146   PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
147   PORT_DIPSETTING(    0x00, DEF_STR( 4C_2C ) )
148   PORT_DIPSETTING(    0x06, DEF_STR( 2C_1C ) )
149   PORT_DIPSETTING(    0x01, DEF_STR( 3C_2C ) )
150   PORT_DIPSETTING(    0x02, DEF_STR( 2C_2C ) )
151   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
152   PORT_DIPSETTING(    0x03, DEF_STR( 1C_2C ) )
153
154   PORT_DIPNAME( 0x08, 0x08, "High Score Names" )
155   PORT_DIPSETTING(    0x00, "3 Letters" )
156   PORT_DIPSETTING(    0x08, "8 Letters" )
157   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) )
158   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
159   PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
160   PORT_DIPNAME( 0x20, 0x20, "Unknown 2-6" )
161   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
162   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
163   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
164   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
165   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
166   PORT_DIPNAME( 0x80, 0x80, "Endless Game (If Free Play)" )
167   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
168   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
169
170INPUT_PORTS_END
171
172
173
174static const gfx_layout charlayout =
175{
176   8,8,
177   512,
178   4,
179   {0,1,2,3},
180   {0,4,8192*8+0,8192*8+4,8,12,8192*8+8,8192*8+12},
181   {16*0, 16*1, 16*2, 16*3, 16*4, 16*5, 16*6, 16*7},
182   16*8
183};
184
185static const gfx_layout spritelayout =
186{
187   16, 16,
188   128,
189   4,
190   {0,1,2,3},
191   {0,4,8192*8+0,8192*8+4,8,12,8192*8+8,8192*8+12,
192   16*8+0,16*8+4,16*8+8192*8+0,16*8+8192*8+4,16*8+8,16*8+12,16*8+8192*8+8,16*8+8192*8+12},
193   {16*0, 16*1, 16*2, 16*3, 16*4, 16*5, 16*6, 16*7,
194    16*16, 16*17, 16*18, 16*19, 16*20, 16*21, 16*22, 16*23},
195   16*8*4
196};
197
198
199static GFXDECODE_START( raiders5 )
200   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, spritelayout, 512, 16 ) /* sprite */
201   GFXDECODE_ENTRY( REGION_GFX1, 0x4000, spritelayout, 512, 16 ) /* sprite */
202   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout,     0, 16 ) /* FG */
203   GFXDECODE_ENTRY( REGION_GFX1, 0x8000, charlayout,   256, 16 ) /* BG */
204   GFXDECODE_ENTRY( REGION_GFX1, 0x4000, charlayout,   256, 16 ) /* BG (?)*/
205GFXDECODE_END
206
207
208
209static const struct AY8910interface ay8910_interface_1 =
210{
211   input_port_0_r,
212   input_port_1_r
213};
214
215static const struct AY8910interface ay8910_interface_2 =
216{
217   input_port_2_r,
218   input_port_3_r
219};
220
221
222
223static MACHINE_DRIVER_START( raiders5 )
224
225   /* basic machine hardware */
226   MDRV_CPU_ADD(Z80,12000000/4)   /* 3.0MHz? */
227   MDRV_CPU_PROGRAM_MAP(raiders5_map_1,0)
228   MDRV_CPU_IO_MAP(raiders5_io_map_1,0)
229   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
230
231   MDRV_CPU_ADD(Z80,12000000/4)   /* 3.0MHz? */
232   MDRV_CPU_PROGRAM_MAP(raiders5_map_2,0)
233   MDRV_CPU_VBLANK_INT(irq0_line_hold,4)
234
235   MDRV_INTERLEAVE(400)
236
237   /* video hardware */
238   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
239   MDRV_PALETTE_LENGTH(768)
240   MDRV_GFXDECODE(raiders5)
241   MDRV_VIDEO_START(raiders5)
242   MDRV_VIDEO_UPDATE(raiders5)
243
244   MDRV_SCREEN_ADD("main", 0)
245   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
246   MDRV_SCREEN_SIZE(32*8, 32*8)
247   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 28*8-1)
248   MDRV_SCREEN_REFRESH_RATE(60)
249   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
250
251   /* sound hardware */
252   MDRV_SPEAKER_STANDARD_MONO("mono")
253
254   MDRV_SOUND_ADD(AY8910, 12000000/8)
255   MDRV_SOUND_CONFIG(ay8910_interface_1)
256   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
257
258   MDRV_SOUND_ADD(AY8910, 12000000/8)
259   MDRV_SOUND_CONFIG(ay8910_interface_2)
260   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
261MACHINE_DRIVER_END
262
263
264
265ROM_START( raiders5 )
266   ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* CPU1 */
267   ROM_LOAD( "raiders5.1", 0x0000,  0x4000, CRC(47cea11f) SHA1(0499e6627ad9c16775fdc59f2ff56dfdfc23490a) )
268   ROM_LOAD( "raiders5.2", 0x4000,  0x4000, CRC(eb2ff410) SHA1(5c995b66b6301cd3cd58efd173481deaa036f842) )
269
270   ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* CPU2 */
271   ROM_LOAD( "raiders5.2", 0x0000,  0x4000, CRC(eb2ff410) SHA1(5c995b66b6301cd3cd58efd173481deaa036f842) )
272
273   ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_DISPOSE )
274   ROM_LOAD( "raiders3.11f", 0x0000,  0x4000, CRC(30041d58) SHA1(a33087de7afb276925879898a96f418128a5a38c) )
275   ROM_LOAD( "raiders4.11g", 0x4000,  0x4000, CRC(e441931c) SHA1(f39b4c25de779c671a6e2b02df64e7fed726f4da) )
276   ROM_LOAD( "raiders5.11n", 0x8000,  0x4000, CRC(c0895090) SHA1(a3a1ae57ed66bc095ea9bfb26470290f67aab1fe) )
277ROM_END
278
279ROM_START( raidrs5t )
280   ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* CPU1 */
281   ROM_LOAD( "raiders1.4c", 0x0000,  0x4000, CRC(4e2d5679) SHA1(a1c1603ba98814a83b92ad024ca4422aea872111) )
282   ROM_LOAD( "raiders2.4d", 0x4000,  0x4000, CRC(c8604be1) SHA1(6d23f26174bb9b2f7db3a5fa6b39674fe237135b) )
283
284   ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* CPU2 */
285   ROM_LOAD( "raiders2.4d", 0x0000,  0x4000, CRC(c8604be1) SHA1(6d23f26174bb9b2f7db3a5fa6b39674fe237135b) )
286
287   ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_DISPOSE )
288   ROM_LOAD( "raiders3.11f", 0x0000,  0x4000, CRC(30041d58) SHA1(a33087de7afb276925879898a96f418128a5a38c) )
289   ROM_LOAD( "raiders4.11g", 0x4000,  0x4000, CRC(e441931c) SHA1(f39b4c25de779c671a6e2b02df64e7fed726f4da) )
290   ROM_LOAD( "raiders5.11n", 0x8000,  0x4000, CRC(c0895090) SHA1(a3a1ae57ed66bc095ea9bfb26470290f67aab1fe) )
291ROM_END
292
293
294
295GAME( 1985, raiders5, 0,        raiders5, raiders5, 0, ROT0, "UPL", "Raiders5", 0 )
296GAME( 1985, raidrs5t, raiders5, raiders5, raiders5, 0, ROT0, "UPL (Taito license)", "Raiders5 (Japan)", 0 )
src/mame/drivers/bking2.c
r1768r1769
1/***************************************************************************
2
3
4Birdie King / Birdie King II / Birdie King III Memory Map
5---------------------------------------------------------
6
70000-7fff ROM
88000-83ff Scratch RAM
98400-8fff (Scratch RAM again, address lines AB10, AB11 ignored)
109000-97ff Playfield RAM
11a000-bfff Unused?
12
13***************************************************************************/
14
15#include "driver.h"
16#include "cpu/m6805/m6805.h"
17#include "sound/ay8910.h"
18#include "sound/dac.h"
19
20
21/* bking3 mcu communication */
22extern MACHINE_RESET( buggychl );
23extern READ8_HANDLER( buggychl_68705_portA_r );
24extern WRITE8_HANDLER( buggychl_68705_portA_w );
25extern WRITE8_HANDLER( buggychl_68705_ddrA_w );
26extern READ8_HANDLER( buggychl_68705_portB_r );
27extern WRITE8_HANDLER( buggychl_68705_portB_w );
28extern WRITE8_HANDLER( buggychl_68705_ddrB_w );
29extern READ8_HANDLER( buggychl_68705_portC_r );
30extern WRITE8_HANDLER( buggychl_68705_portC_w );
31extern WRITE8_HANDLER( buggychl_68705_ddrC_w );
32extern WRITE8_HANDLER( buggychl_mcu_w );
33extern READ8_HANDLER( buggychl_mcu_r );
34extern READ8_HANDLER( buggychl_mcu_status_r );
35
36extern PALETTE_INIT( bking2 );
37
38extern VIDEO_START( bking2 );
39extern VIDEO_UPDATE( bking2 );
40extern VIDEO_EOF( bking2 );
41
42extern WRITE8_HANDLER( bking2_xld1_w );
43extern WRITE8_HANDLER( bking2_yld1_w );
44extern WRITE8_HANDLER( bking2_xld2_w );
45extern WRITE8_HANDLER( bking2_yld2_w );
46extern WRITE8_HANDLER( bking2_xld3_w );
47extern WRITE8_HANDLER( bking2_yld3_w );
48extern WRITE8_HANDLER( bking2_msk_w );
49extern WRITE8_HANDLER( bking2_cont1_w );
50extern WRITE8_HANDLER( bking2_cont2_w );
51extern WRITE8_HANDLER( bking2_cont3_w );
52extern WRITE8_HANDLER( bking2_hitclr_w );
53extern WRITE8_HANDLER( bking2_playfield_w );
54
55extern READ8_HANDLER( bking2_input_port_5_r );
56extern READ8_HANDLER( bking2_input_port_6_r );
57extern READ8_HANDLER( bking2_pos_r );
58
59UINT8 *bking2_playfield_ram;
60
61static int bking3_addr_h, bking3_addr_l;
62static int sndnmi_enable = 1;
63
64static READ8_HANDLER( bking2_sndnmi_disable_r )
65{
66   sndnmi_enable = 0;
67   return 0;
68}
69
70static WRITE8_HANDLER( bking2_sndnmi_enable_w )
71{
72   sndnmi_enable = 1;
73}
74
75static WRITE8_HANDLER( bking2_soundlatch_w )
76{
77   int i,code;
78
79   code = 0;
80   for (i = 0;i < 8;i++)
81      if (data & (1 << i)) code |= 0x80 >> i;
82
83   soundlatch_w(offset,code);
84   if (sndnmi_enable) cpunum_set_input_line(Machine, 1, INPUT_LINE_NMI, PULSE_LINE);
85}
86
87static WRITE8_HANDLER( bking3_addr_l_w )
88{
89   bking3_addr_l = data;
90}
91
92static WRITE8_HANDLER( bking3_addr_h_w )
93{
94   bking3_addr_h = data;
95}
96
97static READ8_HANDLER( bking3_extrarom_r )
98{
99   UINT8 *rom = memory_region(REGION_USER2);
100   return rom[bking3_addr_h * 256 + bking3_addr_l];
101}
102
103static WRITE8_HANDLER( unk_w )
104{
105/*
106    0 = finished reading extra rom
107    1 = started reading extra rom
108*/
109}
110
111static READ8_HANDLER( bking3_ext_check_r )
112{
113   return 0x31; //no "bad rom.", no "bad ext."
114}
115
116static ADDRESS_MAP_START( bking2_map, ADDRESS_SPACE_PROGRAM, 8 )
117   AM_RANGE(0x0000, 0x7fff) AM_ROM
118   AM_RANGE(0x8000, 0x83ff) AM_RAM
119   AM_RANGE(0x9000, 0x97ff) AM_RAM AM_WRITE(bking2_playfield_w) AM_BASE(&bking2_playfield_ram)
120ADDRESS_MAP_END
121
122static ADDRESS_MAP_START( bking2_io_map, ADDRESS_SPACE_IO, 8 )
123   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
124   AM_RANGE(0x00, 0x00) AM_READWRITE(input_port_0_r, bking2_xld1_w)
125   AM_RANGE(0x01, 0x01) AM_READWRITE(input_port_1_r, bking2_yld1_w)
126   AM_RANGE(0x02, 0x02) AM_READWRITE(input_port_2_r, bking2_xld2_w)
127   AM_RANGE(0x03, 0x03) AM_READWRITE(input_port_3_r, bking2_yld2_w)
128   AM_RANGE(0x04, 0x04) AM_READWRITE(input_port_4_r, bking2_xld3_w)
129   AM_RANGE(0x05, 0x05) AM_READWRITE(bking2_input_port_5_r, bking2_yld3_w)
130   AM_RANGE(0x06, 0x06) AM_READWRITE(bking2_input_port_6_r, bking2_msk_w)
131   AM_RANGE(0x07, 0x07) AM_WRITE(watchdog_reset_w)
132   AM_RANGE(0x08, 0x08) AM_WRITE(bking2_cont1_w)
133   AM_RANGE(0x09, 0x09) AM_WRITE(bking2_cont2_w)
134   AM_RANGE(0x0a, 0x0a) AM_WRITE(bking2_cont3_w)
135   AM_RANGE(0x0b, 0x0b) AM_WRITE(bking2_soundlatch_w)
136//  AM_RANGE(0x0c, 0x0c) AM_WRITE(bking2_eport2_w)   this is not shown to be connected anywhere
137   AM_RANGE(0x0d, 0x0d) AM_WRITE(bking2_hitclr_w)
138   AM_RANGE(0x07, 0x1f) AM_READ(bking2_pos_r)
139ADDRESS_MAP_END
140
141static ADDRESS_MAP_START( bking3_io_map, ADDRESS_SPACE_IO, 8 )
142   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
143   AM_RANGE(0x00, 0x00) AM_READWRITE(input_port_0_r, bking2_xld1_w)
144   AM_RANGE(0x01, 0x01) AM_READWRITE(input_port_1_r, bking2_yld1_w)
145   AM_RANGE(0x02, 0x02) AM_READWRITE(input_port_2_r, bking2_xld2_w)
146   AM_RANGE(0x03, 0x03) AM_READWRITE(input_port_3_r, bking2_yld2_w)
147   AM_RANGE(0x04, 0x04) AM_READWRITE(input_port_4_r, bking2_xld3_w)
148   AM_RANGE(0x05, 0x05) AM_READWRITE(bking2_input_port_5_r, bking2_yld3_w)
149   AM_RANGE(0x06, 0x06) AM_READWRITE(bking2_input_port_6_r, bking2_msk_w)
150   AM_RANGE(0x07, 0x07) AM_WRITE(watchdog_reset_w)
151   AM_RANGE(0x08, 0x08) AM_WRITE(bking2_cont1_w)
152   AM_RANGE(0x09, 0x09) AM_WRITE(bking2_cont2_w)
153   AM_RANGE(0x0a, 0x0a) AM_WRITE(bking2_cont3_w)
154   AM_RANGE(0x0b, 0x0b) AM_WRITE(bking2_soundlatch_w)
155//  AM_RANGE(0x0c, 0x0c) AM_WRITE(bking2_eport2_w)   this is not shown to be connected anywhere
156   AM_RANGE(0x0d, 0x0d) AM_WRITE(bking2_hitclr_w)
157   AM_RANGE(0x07, 0x1f) AM_READ(bking2_pos_r)
158   AM_RANGE(0x2f, 0x2f) AM_READWRITE(buggychl_mcu_r, buggychl_mcu_w)
159   AM_RANGE(0x4f, 0x4f) AM_READWRITE(buggychl_mcu_status_r, unk_w)
160   AM_RANGE(0x60, 0x60) AM_READ(bking3_extrarom_r)
161   AM_RANGE(0x6f, 0x6f) AM_READWRITE(bking3_ext_check_r, bking3_addr_h_w)
162   AM_RANGE(0x8f, 0x8f) AM_WRITE(bking3_addr_l_w)
163ADDRESS_MAP_END
164
165static ADDRESS_MAP_START( sound_map, ADDRESS_SPACE_PROGRAM, 8 )
166   AM_RANGE(0x0000, 0x1fff) AM_ROM
167   AM_RANGE(0x2000, 0x2fff) AM_ROM //only bking3
168   AM_RANGE(0x4000, 0x43ff) AM_RAM
169   AM_RANGE(0x4400, 0x4400) AM_WRITE(AY8910_control_port_0_w)
170   AM_RANGE(0x4401, 0x4401) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w)
171   AM_RANGE(0x4402, 0x4402) AM_WRITE(AY8910_control_port_1_w)
172   AM_RANGE(0x4403, 0x4403) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w)
173   AM_RANGE(0x4800, 0x4800) AM_READ(soundlatch_r)
174   AM_RANGE(0x4802, 0x4802) AM_READWRITE(bking2_sndnmi_disable_r, bking2_sndnmi_enable_w)
175   AM_RANGE(0xe000, 0xefff) AM_ROM   /* Space for diagnostic ROM */
176ADDRESS_MAP_END
177
178#if 0
179static UINT8 portA_in,portA_out,ddrA;
180
181static READ8_HANDLER( bking3_68705_portA_r )
182{
183   //printf("portA_r = %02X\n",(portA_out & ddrA) | (portA_in & ~ddrA));
184   return (portA_out & ddrA) | (portA_in & ~ddrA);
185}
186
187static WRITE8_HANDLER( bking3_68705_portA_w )
188{
189   portA_out = data;
190//  printf("portA_out = %02X\n",data);
191}
192
193static WRITE8_HANDLER( bking3_68705_ddrA_w )
194{
195   ddrA = data;
196}
197
198static UINT8 portB_in,portB_out,ddrB;
199
200static READ8_HANDLER( bking3_68705_portB_r )
201{
202   return (portB_out & ddrB) | (portB_in & ~ddrB);
203}
204
205static WRITE8_HANDLER( bking3_68705_portB_w )
206{
207//  if(data != 0xff)
208//      printf("portB_out = %02X\n",data);
209
210   if (~data & 0x02)
211   {
212      portA_in = from_main;
213      if (main_sent) cpunum_set_input_line(Machine, 2,0,CLEAR_LINE);
214      main_sent = 0;
215   }
216
217   if (~data & 0x04)
218   {
219      /* 68705 is writing data for the Z80 */
220      from_mcu = portA_out;
221      mcu_sent = 1;
222   }
223
224   if(data != 0xff && data != 0xfb && data != 0xfd)
225      printf("portB_w = %X\n",data);
226
227   portB_out = data;
228}
229
230static WRITE8_HANDLER( bking3_68705_ddrB_w )
231{
232   ddrB = data;
233}
234
235static READ8_HANDLER( bking3_68705_portC_r )
236{
237   int portC_in = 0;
238   if (main_sent) portC_in |= 0x01;
239   if (!mcu_sent) portC_in |= 0x02;
240//logerror("%04x: 68705 port C read %02x\n",activecpu_get_pc(),portC_in);
241   return portC_in;
242}
243#endif
244static ADDRESS_MAP_START( m68705_map, ADDRESS_SPACE_PROGRAM, 8 )
245   ADDRESS_MAP_FLAGS( AMEF_ABITS(11) )
246   AM_RANGE(0x0000, 0x0000) AM_READWRITE(buggychl_68705_portA_r, buggychl_68705_portA_w)
247   AM_RANGE(0x0001, 0x0001) AM_READWRITE(buggychl_68705_portB_r, buggychl_68705_portB_w)
248   AM_RANGE(0x0002, 0x0002) AM_READWRITE(buggychl_68705_portC_r, buggychl_68705_portC_w)
249   AM_RANGE(0x0004, 0x0004) AM_WRITE(buggychl_68705_ddrA_w)
250   AM_RANGE(0x0005, 0x0005) AM_WRITE(buggychl_68705_ddrB_w)
251   AM_RANGE(0x0006, 0x0006) AM_WRITE(buggychl_68705_ddrC_w)
252   AM_RANGE(0x0010, 0x007f) AM_RAM
253   AM_RANGE(0x0080, 0x07ff) AM_ROM
254ADDRESS_MAP_END
255
256static INPUT_PORTS_START( bking )
257   PORT_START  /* IN0 */
258   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
259   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
260   PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED )
261
262   PORT_START  /* IN1 */
263   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
264   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
265   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) /* Continue 1 */
266   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) /* Continue 2 */
267   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
268   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_TILT )
269   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) /* Not Connected */
270
271   PORT_START  /* IN2 - DIP Switch A */
272   PORT_DIPNAME( 0x01, 0x00, "Bonus Holes Awarded" )
273   PORT_DIPSETTING(    0x00, "Fewer" )
274   PORT_DIPSETTING(    0x01, "More" )
275   PORT_DIPNAME( 0x02, 0x02, "Holes Awarded for Hole-in-One" )
276   PORT_DIPSETTING(    0x00, "3" )
277   PORT_DIPSETTING(    0x02, "9" )
278   PORT_DIPNAME( 0x04, 0x04, DEF_STR(Free_Play) )
279   PORT_DIPSETTING(    0x04, DEF_STR(Off))
280   PORT_DIPSETTING(    0x00, DEF_STR(On))
281   PORT_DIPNAME( 0x18, 0x18, "Holes (Lives)" )
282   PORT_DIPSETTING(    0x18, "3" )
283   PORT_DIPSETTING(    0x08, "4" )
284   PORT_DIPSETTING(    0x10, "5" )
285   PORT_DIPSETTING(    0x00, "9" )
286   PORT_DIPNAME( 0x20, 0x20, "Self Test" )
287   PORT_DIPSETTING(    0x20, DEF_STR(Off))
288   PORT_DIPSETTING(    0x00, DEF_STR(On))
289   PORT_DIPNAME( 0x40, 0x40, DEF_STR(Flip_Screen) )
290   PORT_DIPSETTING(    0x40, DEF_STR(Off))
291   PORT_DIPSETTING(    0x00, DEF_STR(On))
292   PORT_DIPNAME( 0x80, 0x00, DEF_STR(Cabinet) )
293   PORT_DIPSETTING(    0x00, DEF_STR(Upright) )
294   PORT_DIPSETTING(    0x80, DEF_STR(Cocktail) )
295
296   PORT_START  /* IN3 - DIP Switch B */
297   PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) )
298   PORT_DIPSETTING(    0x0f, DEF_STR( 9C_1C ) )
299   PORT_DIPSETTING(    0x0e, DEF_STR( 8C_1C ) )
300   PORT_DIPSETTING(    0x0d, DEF_STR( 7C_1C ) )
301   PORT_DIPSETTING(    0x0c, DEF_STR( 6C_1C ) )
302   PORT_DIPSETTING(    0x0b, DEF_STR( 5C_1C ) )
303   PORT_DIPSETTING(    0x0a, DEF_STR( 4C_1C ) )
304   PORT_DIPSETTING(    0x09, DEF_STR( 3C_1C ) )
305   PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
306   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
307   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
308   PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
309   PORT_DIPSETTING(    0x03, DEF_STR( 1C_4C ) )
310   PORT_DIPSETTING(    0x04, DEF_STR( 1C_5C ) )
311   PORT_DIPSETTING(    0x05, DEF_STR( 1C_6C ) )
312   PORT_DIPSETTING(    0x06, DEF_STR( 1C_7C ) )
313   PORT_DIPSETTING(    0x07, DEF_STR( 1C_8C ) )
314   PORT_DIPNAME( 0xf0, 0x00, DEF_STR( Coin_B ) )
315   PORT_DIPSETTING(    0xf0, DEF_STR( 9C_1C ) )
316   PORT_DIPSETTING(    0xe0, DEF_STR( 8C_1C ) )
317   PORT_DIPSETTING(    0xd0, DEF_STR( 7C_1C ) )
318   PORT_DIPSETTING(    0xc0, DEF_STR( 6C_1C ) )
319   PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )
320   PORT_DIPSETTING(    0xa0, DEF_STR( 4C_1C ) )
321   PORT_DIPSETTING(    0x90, DEF_STR( 3C_1C ) )
322   PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
323   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
324   PORT_DIPSETTING(    0x10, DEF_STR( 1C_2C ) )
325   PORT_DIPSETTING(    0x20, DEF_STR( 1C_3C ) )
326   PORT_DIPSETTING(    0x30, DEF_STR( 1C_4C ) )
327   PORT_DIPSETTING(    0x40, DEF_STR( 1C_5C ) )
328   PORT_DIPSETTING(    0x50, DEF_STR( 1C_6C ) )
329   PORT_DIPSETTING(    0x60, DEF_STR( 1C_7C ) )
330   PORT_DIPSETTING(    0x70, DEF_STR( 1C_8C ) )
331
332   PORT_START  /* IN4 - DIP Switch C */
333   PORT_DIPNAME( 0x01, 0x01, "Crow" )
334   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
335   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
336   PORT_DIPNAME( 0x06, 0x04, "Crow Flight Pattern" )
337   PORT_DIPSETTING(    0x00, "1" )
338   PORT_DIPSETTING(    0x02, "2" )
339   PORT_DIPSETTING(    0x04, "3" )
340   PORT_DIPSETTING(    0x06, "4" )
341   PORT_DIPNAME( 0x08, 0x08, DEF_STR(Unused) )
342   PORT_DIPSETTING(    0x00, DEF_STR(Off))
343   PORT_DIPSETTING(    0x08, DEF_STR(On))
344   PORT_DIPNAME( 0x10, 0x10, "Coinage Display" )
345   PORT_DIPSETTING(    0x00, DEF_STR(Off))
346   PORT_DIPSETTING(    0x10, DEF_STR(On))
347   PORT_DIPNAME( 0x20, 0x20, "Year Display" )
348   PORT_DIPSETTING(    0x00, DEF_STR(Off))
349   PORT_DIPSETTING(    0x20, DEF_STR(On))
350   PORT_DIPNAME( 0x40, 0x40, "Check" )
351   PORT_DIPSETTING(    0x00, "Check" )
352   PORT_DIPSETTING(    0x40, DEF_STR( Normal ) )
353   PORT_DIPNAME( 0x80, 0x80, "Coin Chutes" )
354   PORT_DIPSETTING(    0x00, "1" )
355   PORT_DIPSETTING(    0x80, "2" )
356
357   PORT_START  /* IN5 */
358   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) /* Sensitivity, clip, min, max */
359
360   PORT_START  /* IN6 */
361   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_REVERSE /* Sensitivity, clip, min, max */
362
363   PORT_START  /* IN7 */
364   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_COCKTAIL /* Sensitivity, clip, min, max */
365
366   PORT_START  /* IN8 */
367   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_REVERSE PORT_COCKTAIL /* Sensitivity, clip, min, max */
368INPUT_PORTS_END
369
370static INPUT_PORTS_START( bking2 )
371   PORT_START  /* IN0 */
372   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
373   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
374   PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED )
375
376   PORT_START  /* IN1 */
377   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
378   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
379   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 ) /* Continue 1 */
380   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 ) /* Continue 2 */
381   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE1 )
382   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_TILT )
383   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED ) /* Not Connected */
384
385   PORT_START  /* IN2 - DIP Switch A */
386   PORT_DIPNAME( 0x01, 0x00, "Bonus Holes Awarded" )
387   PORT_DIPSETTING(    0x00, "Fewer" )
388   PORT_DIPSETTING(    0x01, "More" )
389   PORT_DIPNAME( 0x02, 0x02, "Holes Awarded for Hole-in-One" )
390   PORT_DIPSETTING(    0x00, "3" )
391   PORT_DIPSETTING(    0x02, "9" )
392   PORT_DIPNAME( 0x04, 0x04, DEF_STR(Free_Play) )
393   PORT_DIPSETTING(    0x04, DEF_STR(Off))
394   PORT_DIPSETTING(    0x00, DEF_STR(On))
395   PORT_DIPNAME( 0x18, 0x18, "Holes (Lives)" )
396   PORT_DIPSETTING(    0x18, "3" )
397   PORT_DIPSETTING(    0x08, "4" )
398   PORT_DIPSETTING(    0x10, "5" )
399   PORT_DIPSETTING(    0x00, "9" )
400   PORT_DIPNAME( 0x20, 0x20, DEF_STR(Unused) )
401   PORT_DIPSETTING(    0x20, DEF_STR(Off))
402   PORT_DIPSETTING(    0x00, DEF_STR(On))
403   PORT_DIPNAME( 0x40, 0x40, DEF_STR(Flip_Screen) )
404   PORT_DIPSETTING(    0x40, DEF_STR(Off))
405   PORT_DIPSETTING(    0x00, DEF_STR(On))
406   PORT_DIPNAME( 0x80, 0x00, DEF_STR(Cabinet) )
407   PORT_DIPSETTING(    0x00, DEF_STR(Upright) )
408   PORT_DIPSETTING(    0x80, DEF_STR(Cocktail) )
409
410   PORT_START  /* IN3 - DIP Switch B */
411   PORT_DIPNAME( 0x0f, 0x00, DEF_STR( Coin_A ) )
412   PORT_DIPSETTING(    0x0f, DEF_STR( 9C_1C ) )
413   PORT_DIPSETTING(    0x0e, DEF_STR( 8C_1C ) )
414   PORT_DIPSETTING(    0x0d, DEF_STR( 7C_1C ) )
415   PORT_DIPSETTING(    0x0c, DEF_STR( 6C_1C ) )
416   PORT_DIPSETTING(    0x0b, DEF_STR( 5C_1C ) )
417   PORT_DIPSETTING(    0x0a, DEF_STR( 4C_1C ) )
418   PORT_DIPSETTING(    0x09, DEF_STR( 3C_1C ) )
419   PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
420   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
421   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
422   PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
423   PORT_DIPSETTING(    0x03, DEF_STR( 1C_4C ) )
424   PORT_DIPSETTING(    0x04, DEF_STR( 1C_5C ) )
425   PORT_DIPSETTING(    0x05, DEF_STR( 1C_6C ) )
426   PORT_DIPSETTING(    0x06, DEF_STR( 1C_7C ) )
427   PORT_DIPSETTING(    0x07, DEF_STR( 1C_8C ) )
428   PORT_DIPNAME( 0xf0, 0x00, DEF_STR( Coin_B ) )
429   PORT_DIPSETTING(    0xf0, DEF_STR( 9C_1C ) )
430   PORT_DIPSETTING(    0xe0, DEF_STR( 8C_1C ) )
431   PORT_DIPSETTING(    0xd0, DEF_STR( 7C_1C ) )
432   PORT_DIPSETTING(    0xc0, DEF_STR( 6C_1C ) )
433   PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )
434   PORT_DIPSETTING(    0xa0, DEF_STR( 4C_1C ) )
435   PORT_DIPSETTING(    0x90, DEF_STR( 3C_1C ) )
436   PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
437   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
438   PORT_DIPSETTING(    0x10, DEF_STR( 1C_2C ) )
439   PORT_DIPSETTING(    0x20, DEF_STR( 1C_3C ) )
440   PORT_DIPSETTING(    0x30, DEF_STR( 1C_4C ) )
441   PORT_DIPSETTING(    0x40, DEF_STR( 1C_5C ) )
442   PORT_DIPSETTING(    0x50, DEF_STR( 1C_6C ) )
443   PORT_DIPSETTING(    0x60, DEF_STR( 1C_7C ) )
444   PORT_DIPSETTING(    0x70, DEF_STR( 1C_8C ) )
445
446   PORT_START  /* IN4 - DIP Switch C */
447   PORT_DIPNAME( 0x01, 0x01, "Crow" )
448   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
449   PORT_DIPSETTING(    0x01, DEF_STR( On ) )
450   PORT_DIPNAME( 0x06, 0x04, "Crow Flight Pattern" )
451   PORT_DIPSETTING(    0x00, "1" )
452   PORT_DIPSETTING(    0x02, "2" )
453   PORT_DIPSETTING(    0x04, "3" )
454   PORT_DIPSETTING(    0x06, "4" )
455   PORT_DIPNAME( 0x08, 0x08, DEF_STR(Unused) )
456   PORT_DIPSETTING(    0x00, DEF_STR(Off))
457   PORT_DIPSETTING(    0x08, DEF_STR(On))
458   PORT_DIPNAME( 0x10, 0x10, "Coinage Display" )
459   PORT_DIPSETTING(    0x00, DEF_STR(Off))
460   PORT_DIPSETTING(    0x10, DEF_STR(On))
461   PORT_DIPNAME( 0x20, 0x20, "Year Display" )
462   PORT_DIPSETTING(    0x00, DEF_STR(Off))
463   PORT_DIPSETTING(    0x20, DEF_STR(On))
464   PORT_DIPNAME( 0x40, 0x40, "Check" )
465   PORT_DIPSETTING(    0x00, "Check" )
466   PORT_DIPSETTING(    0x40, DEF_STR( Normal ) )
467   PORT_DIPNAME( 0x80, 0x80, "Coin Chutes" )
468   PORT_DIPSETTING(    0x00, "1" )
469   PORT_DIPSETTING(    0x80, "2" )
470
471   PORT_START  /* IN5 */
472   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) /* Sensitivity, clip, min, max */
473
474   PORT_START  /* IN6 */
475   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_REVERSE /* Sensitivity, clip, min, max */
476
477   PORT_START  /* IN7 */
478   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_COCKTAIL /* Sensitivity, clip, min, max */
479
480   PORT_START  /* IN8 */
481   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_REVERSE PORT_COCKTAIL /* Sensitivity, clip, min, max */
482INPUT_PORTS_END
483
484
485static const gfx_layout charlayout =
486{
487   8,8,    /* 8*8 characters */
488   1024,   /* 1024 characters */
489   3,      /* 3 bits per pixel */
490   { 0*1024*8*8, 1*1024*8*8, 2*1024*8*8 }, /* the bitplanes are separated */
491   { 7, 6, 5, 4, 3, 2, 1, 0 }, /* reverse layout */
492   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
493   8*8     /* every char takes 8 consecutive bytes */
494};
495
496static const gfx_layout crowlayout =
497{
498   16,32,   /* 16*32 characters */
499   16,      /* 16 characters */
500   2,      /* 2 bits per pixel */
501   { 0, 4 },
502   { 3*32*8+3, 3*32*8+2, 3*32*8+1, 3*32*8+0,
503     2*32*8+3, 2*32*8+2, 2*32*8+1, 2*32*8+0,
504       32*8+3,   32*8+2,   32*8+1,   32*8+0,
505           3,        2,        1,        0 }, /* reverse layout */
506   { 31*8, 30*8, 29*8, 28*8, 27*8, 26*8, 25*8, 24*8,
507     23*8, 22*8, 21*8, 20*8, 19*8, 18*8, 17*8, 16*8,
508     15*8, 14*8, 13*8, 12*8, 11*8, 10*8,  9*8,  8*8,
509      7*8,  6*8,  5*8,  4*8,  3*8,  2*8,  1*8,  0*8 },
510   128*8    /* every sprite takes 128 consecutive bytes */
511};
512
513static const gfx_layout balllayout =
514{
515   8,16,  /* 8*16 sprites */
516   8,     /* 8 sprites */
517   1,  /* 1 bit per pixel */
518   { 0 },
519   { 7, 6, 5, 4, 3, 2, 1, 0 },   /* pretty straightforward layout */
520   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
521     8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
522   16*8    /* every sprite takes 16 consecutive bytes */
523};
524
525static GFXDECODE_START( bking2 )
526   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout, 0,           4  ) /* playfield */
527   GFXDECODE_ENTRY( REGION_GFX2, 0, crowlayout, 4*8,         4  ) /* crow */
528   GFXDECODE_ENTRY( REGION_GFX3, 0, balllayout, 4*8+4*4,     4  ) /* ball 1 */
529   GFXDECODE_ENTRY( REGION_GFX4, 0, balllayout, 4*8+4*4+4*2, 4  ) /* ball 2 */
530GFXDECODE_END
531
532
533static WRITE8_HANDLER( portb_w )
534{
535   /* don't know what this is... could be a filter */
536   if (data != 0x00) logerror("portB = %02x\n",data);
537}
538
539static const struct AY8910interface ay8910_interface =
540{
541   0,
542   0,
543   DAC_0_signed_data_w,
544   portb_w
545};
546
547static MACHINE_DRIVER_START( bking2 )
548
549   /* basic machine hardware */
550   MDRV_CPU_ADD_TAG("main_cpu", Z80, XTAL_12MHz/4)   /* 3 MHz */
551   MDRV_CPU_PROGRAM_MAP(bking2_map,0)
552   MDRV_CPU_IO_MAP(bking2_io_map,0)
553   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
554
555   MDRV_CPU_ADD(Z80, XTAL_6MHz/2)   /* 3 MHz */
556   /* audio CPU */
557   MDRV_CPU_PROGRAM_MAP(sound_map,0)
558         /* interrupts (from Jungle King hardware, might be wrong): */
559         /* - no interrupts synced with vblank */
560         /* - NMI triggered by the main CPU */
561         /* - periodic IRQ, with frequency 6000000/(4*16*16*10*16) = 36.621 Hz, */
562   MDRV_CPU_PERIODIC_INT(irq0_line_hold, (double)6000000/(4*16*16*10*16))
563
564   MDRV_SCREEN_REFRESH_RATE(60)
565   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
566
567   /* video hardware */
568   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
569   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
570   MDRV_SCREEN_SIZE(32*8, 32*8)
571   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
572   MDRV_GFXDECODE(bking2)
573   MDRV_PALETTE_LENGTH(512)
574   MDRV_COLORTABLE_LENGTH(4*8+4*4+4*2+4*2)
575
576   MDRV_PALETTE_INIT(bking2)
577   MDRV_VIDEO_START(bking2)
578   MDRV_VIDEO_UPDATE(bking2)
579   MDRV_VIDEO_EOF(bking2)
580
581   /* sound hardware */
582   MDRV_SPEAKER_STANDARD_MONO("mono")
583
584   MDRV_SOUND_ADD(AY8910, XTAL_6MHz/4)
585   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
586
587   MDRV_SOUND_ADD(AY8910, XTAL_6MHz/4)
588   MDRV_SOUND_CONFIG(ay8910_interface)
589   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
590
591   MDRV_SOUND_ADD(DAC, 0)
592   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
593MACHINE_DRIVER_END
594
595static MACHINE_DRIVER_START( bking3 )
596   MDRV_IMPORT_FROM(bking2)
597
598   MDRV_CPU_MODIFY("main_cpu")
599   MDRV_CPU_IO_MAP(bking3_io_map,0)
600
601   MDRV_CPU_ADD(M68705, XTAL_3MHz)      /* xtal is 3MHz, divided by 4 internally */
602   MDRV_CPU_PROGRAM_MAP(m68705_map,0)
603
604   MDRV_MACHINE_RESET(buggychl)
605
606   MDRV_INTERLEAVE(100)
607MACHINE_DRIVER_END
608
609/***************************************************************************
610
611  Game driver(s)
612
613***************************************************************************/
614
615ROM_START( bking )
616   ROM_REGION( 0x10000, REGION_CPU1, 0 )
617   ROM_LOAD( "dm_11.f13", 0x0000, 0x1000, CRC(d84fe4f7) SHA1(3ad1641d05e4faca2be28052ccae8f81bc2255bb) )
618   ROM_LOAD( "dm_12.f11", 0x1000, 0x1000, CRC(e065bbe6) SHA1(8d6d3334977c1eea1bf238817d59c25acd9d99f0) )
619   ROM_LOAD( "dm_13.f10", 0x2000, 0x1000, CRC(aac7cddd) SHA1(12a8887bd8d3334e0d740a7f54374b0e48021140) )
620   ROM_LOAD( "dm_14.f8",  0x3000, 0x1000, CRC(1179d074) SHA1(23df9a7e3e1bf42d6ea3a2d85629d27bd68e9af4) )
621   ROM_LOAD( "dm_15.f7",  0x4000, 0x1000, CRC(fda31475) SHA1(784ffa089b7bd4ab4cbd454f4c1c26553a11fc48) )
622   ROM_LOAD( "dm_16.f5",  0x5000, 0x1000, CRC(b6c3c3ed) SHA1(6c7f67d5eba35e32b556b531e848ef375123de78) )
623
624   ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* Sound ROMs */
625   ROM_LOAD( "dm_17.f4",  0x0000, 0x1000, CRC(54840bc3) SHA1(225daf7ff8a4095b0e69ce6ccce6d8eab26ec1c8) )
626   ROM_LOAD( "dm_18.d4",  0x1000, 0x1000, CRC(2abadd42) SHA1(d921d333ec9b9140a7d3ce7aaddab35f45fae018) )
627
628   ROM_REGION( 0x6000, REGION_GFX1, ROMREGION_DISPOSE )
629   ROM_LOAD( "dm_10.a5",  0x0000, 0x1000, CRC(fe96dd67) SHA1(11014602f926cf6edbf06e7b2acef92036b2f30a) )
630   ROM_LOAD( "dm_09.a7",  0x1000, 0x1000, CRC(80c675d7) SHA1(e590a71a15ea485abf099eceaa16d5a1dbe0c3dc) )
631   ROM_LOAD( "dm_08.a8",  0x2000, 0x1000, CRC(d9bd6b60) SHA1(3c790b6a69472e0a37f45baa00ce5c7d09e7b588) )
632   ROM_LOAD( "dm_07.a10", 0x3000, 0x1000, CRC(65f7a0e4) SHA1(034dbf2fe384cb69963936e9f3029aa54e032e4a) )
633   ROM_LOAD( "dm_06.a11", 0x4000, 0x1000, CRC(00fdbafc) SHA1(b2a8d9c96415fecee52f1c4691a5f10c96f484b1) )
634   ROM_LOAD( "dm_05.a13", 0x5000, 0x1000, CRC(3e4fe925) SHA1(9ed73601c8b34ea8889717cbb3ee4a00ab7ab458) )
635
636   ROM_REGION( 0x0800, REGION_GFX2, ROMREGION_DISPOSE )
637   ROM_LOAD( "dm_01.e10", 0x0000, 0x0800, CRC(e5663f0b) SHA1(b0fed8c4cdff7b12bb220e51d5b7188933934a34) ) /* crow graphics */
638
639   ROM_REGION( 0x0800, REGION_GFX3, ROMREGION_DISPOSE )
640   ROM_LOAD( "dm_02.e7",  0x0000, 0x0800, CRC(fc9cec31) SHA1(5ab1c9b3b15334c6ec06826005ecb66b34d8879a) ) /* ball 1 graphics. Only the first 128 bytes used */
641
642   ROM_REGION( 0x0800, REGION_GFX4, ROMREGION_DISPOSE )
643   ROM_LOAD( "dm_02.e9",  0x0000, 0x0800, CRC(fc9cec31) SHA1(5ab1c9b3b15334c6ec06826005ecb66b34d8879a) ) /* ball 2 graphics. Only the first 128 bytes used */
644
645   ROM_REGION( 0x0020, REGION_USER1, 0 )
646   ROM_LOAD( "dm04.c2",   0x0000, 0x0020, CRC(4cb5bd32) SHA1(8851bae033ba67516d5ff6888e5daef10c2116ee) )  /* collision detection */
647
648   ROM_REGION( 0x0200, REGION_PROMS, 0 )
649   ROM_LOAD( "dm_03.d1",  0x0000, 0x0200, CRC(61b7a9ff) SHA1(4302de0c0dad2b871ad4719ad934beaee05a0c40) ) /* palette */
650ROM_END
651
652ROM_START( bking2 )
653   ROM_REGION( 0x10000, REGION_CPU1, 0 )
654   ROM_LOAD( "01.13f",       0x0000, 0x1000, CRC(078ada3f) SHA1(5e82a6d27c65fe29d664dbfc2ede547c0f4869f0) )
655   ROM_LOAD( "02.11f",       0x1000, 0x1000, CRC(c37d110a) SHA1(7aec6c949d1cf136c3037140bd86597feaf29108) )
656   ROM_LOAD( "03.10f",       0x2000, 0x1000, CRC(2ba5c681) SHA1(d0df24f5e52e6162b40308d8aa38b0348a100f37) )
657   ROM_LOAD( "04.8f",        0x3000, 0x1000, CRC(8fad54e8) SHA1(55edc185914686d42efd848a402f78884d42292b) )
658   ROM_LOAD( "05.7f",        0x4000, 0x1000, CRC(b4de6b58) SHA1(f62bdc3128b226454b1f00a4cbe382e1219a11b0) )
659   ROM_LOAD( "06.5f",        0x5000, 0x1000, CRC(9ac43b87) SHA1(dd562fee01c81317978d1bd8a0178e3d9be6145a) )
660   ROM_LOAD( "07.4f",        0x6000, 0x1000, CRC(b3ed40b7) SHA1(d481094c0381234314f797928e3cdb22f36f4e32) )
661   ROM_LOAD( "08.2f",        0x7000, 0x1000, CRC(8fddb2e8) SHA1(6ee5f09d154440851f370a97b35450e3726e14e7) )
662
663   ROM_REGION( 0x10000, REGION_CPU2, 0 )         /* Sound ROMs */
664   ROM_LOAD( "15",           0x0000, 0x1000, CRC(f045d0fe) SHA1(3b34081fa6cd0423236d09b6f23e8cf8cfd627c5) )
665   ROM_LOAD( "16",           0x1000, 0x1000, CRC(92d50410) SHA1(e6f4c27031744bbc832a1eb121a7dba4da5286c4) )
666
667   ROM_REGION( 0x6000, REGION_GFX1, ROMREGION_DISPOSE )
668   ROM_LOAD( "14.5a",        0x0000, 0x1000, CRC(52636a94) SHA1(185c4455bd9bb23d14aa2f6f7baa74959da08fc2) )
669   ROM_LOAD( "13.7a",        0x1000, 0x1000, CRC(6b9e0564) SHA1(6cdd3820caa3825e98b61fe260960cc05c04d032) )
670   ROM_LOAD( "12.8a",        0x2000, 0x1000, CRC(c6d685d9) SHA1(2dd2fda365e6bdf9aa26de90650f4a2588ea0515) )
671   ROM_LOAD( "11.10a",       0x3000, 0x1000, CRC(2b949987) SHA1(a94666c4f2fdc25399f7976ed2c25fd454387be6) )
672   ROM_LOAD( "10.11a",       0x4000, 0x1000, CRC(eb96f948) SHA1(295ba5a620a8a85a121d3e823804adceeeef64d9) )
673   ROM_LOAD( "09.13a",       0x5000, 0x1000, CRC(595e3dd4) SHA1(9dd3388ce704dd5473af034716cd8d48df3dc495) )
674
675   ROM_REGION( 0x0800, REGION_GFX2, ROMREGION_DISPOSE )
676   ROM_LOAD( "17",           0x0000, 0x0800, CRC(e5663f0b) SHA1(b0fed8c4cdff7b12bb220e51d5b7188933934a34) )   /* crow graphics */
677
678   ROM_REGION( 0x0800, REGION_GFX3, ROMREGION_DISPOSE )
679   ROM_LOAD( "18",           0x0000, 0x0800, CRC(fc9cec31) SHA1(5ab1c9b3b15334c6ec06826005ecb66b34d8879a) )   /* ball 1 graphics. Only the first 128 bytes used */
680
681   ROM_REGION( 0x0800, REGION_GFX4, ROMREGION_DISPOSE )
682   ROM_LOAD( "19",           0x0000, 0x0800, CRC(fc9cec31) SHA1(5ab1c9b3b15334c6ec06826005ecb66b34d8879a) )  /* ball 2 graphics. Only the first 128 bytes used */
683
684   ROM_REGION( 0x0020, REGION_USER1, 0 )
685   ROM_LOAD( "mb7051.2c",    0x0000, 0x0020, CRC(4cb5bd32) SHA1(8851bae033ba67516d5ff6888e5daef10c2116ee) )  /* collision detection */
686
687   ROM_REGION( 0x0200, REGION_PROMS, 0 )
688   ROM_LOAD( "82s141.2d",    0x0000, 0x0200, CRC(61b7a9ff) SHA1(4302de0c0dad2b871ad4719ad934beaee05a0c40) )   /* palette */
689
690   ROM_REGION( 0x0600, REGION_PLDS, ROMREGION_DISPOSE )
691   ROM_LOAD( "pal16l8.1",  0x0000, 0x0104, CRC(e75d19f5) SHA1(d51cbb247760312b8884bbd0478a321eee05034f) )
692   ROM_LOAD( "pal16l8.2",  0x0200, 0x0104, CRC(0302b683) SHA1(91bfba22c883adb15309d9ec0c42b5b744887c77) )
693   ROM_LOAD( "pal16l8.3",  0x0400, 0x0104, CRC(a609d0cf) SHA1(7a18040720646c2dff4c1dc6f272c6a69e538c47) )
694ROM_END
695
696/*
697Birdie King 3
698Taito, 1984
699
700A golf game using a trackball. Uses same harness/pinout as
701Elevator Action, Victorious Nine, Jolly Jogger (etc)
702
703PCB Layouts
704(Note! There are no PALs on ANY of the PCBs)
705
706Top PCB
707-------
708DMO70003A
709K1000173B (sticker)
710 |------------------------|
711 |                        |
712|-|                       |
713| |  Z80        2114      |
714| |             2114      |
715| |N                      |
716| |  A24_18.4F            |
717| |      A24_19.4D        |
718|-|           A24_20.4B   |
719 |                        |
720 |  AY3-8910              |
721 |                        |
722 |      AY3-8910          |
723 |                        |
724 |                        |
725 |                   6MHz |
726 |                        |
727 |                        |
728 |                        |
729 | LM3900  LM3900  LM3900 |
730 |------------------------|
731Notes:
732      Z80      - Clock 3.000MHz [6/2]
733      AY3-8910 - Clock 1.500MHz [6/4]
734      2114     - 1kx4 SRAM (DIP18)
735      N        - Flat cable connector, joins to main board
736      LM3900   - National LM3900 Quad, dual-input amplifier IC (DIP14)
737      plus many resistors/capacitors below the AY3-8910's
738
739
740Sub PCB (below Top PCB)
741-----------------------
742SUB PCB J910 0010 A
743        K910 0018 A
744|------------------------|
745|           *            |
746|                        |
747|                        |
748|                        |
749|                        |
750|                        |
751|                        |
752|                        |
753|                        |
754|                        |
755|                        |
756|                        |
757|                        |
758|A24_21.IC25             |
759|                        |
760|                   S2   |
761|                        |
762|         3MHz         S1|
763|T    A24_22.IC17        |
764|------------------------|
765Notes:
766      A24_22.IC17 - Motorola 68705P5 Microcontroller, clock 3.000MHz
767      A24_21.IC25 - 2732 EPROM
768      *           - DIP24 socket with flat cable below PCB, joins to main board
769      T           - 4-pin power connector (5 volts) coming from main board
770      S1          - Flat cable connector, joins to main PCB to connector S
771      S2          - Flat cable connector, joins to bottom PCB to connector S
772
773
774
775Main PCB
776--------
777J1100001A
778K1100001A
779M4300001D (sticker)
780K1100032A (sticker)
781|--------------------------------------------------------------|
782|      M3712    VOL             A24_03.2D             M53354   |
783|H                                        DM-04.2C            |-|
784|                     N                                  *    | |
785|           MC14584                                          R| |
786|                                                             | |
787|                                                             | |
788|                                                             | |
789|                                                             |-|
790|                                                              |
791|G          LM3900                                             |
792|    MC14093                                                   |
793|                   A24_01.7E                                 |-|
794|                                                             | |
795|                   A24_01.9E                                 | |
796|    MC14584                                                 S| |
797|                   A24_02.10E                                | |
798|    MC14584                    MC1455                        | |
799|                                                             |-|
800|    DSWC   DSWB   DSWA                                        |
801|--------------------------------------------------------------|
802Notes:
803      M53354    - ?, maybe 74LS154? (DIP24)
804      MC1455    - Motorola MC1455 Monolithic Timing Circuit (NE555 compatible)
805      A24_01/02 - 2716 EPROMs
806      A24_03    - Signetics 82S141 PROM (DIP24)
807      DM-04     - Signetics 82S123 PROM (DIP8)
808      *         - DIP24 socket with flat cable, joins to SUB PCB DIP24 socket
809      R/S       - Flat cable connector, R joins to main board, S joins to SUB PCB
810      G         - 22-way Edge Connector
811      N         - Flat cable connector, joins to TOP PCB
812      H         - 12-pin power connector
813      VSync     - 60Hz
814      HSync     - 15.67kHz
815
816
817Bottom PCB
818----------
819DMO70002A
820DMN00002A
821K1000172B (sticker)
822|--------------------------------------------------------------|
823|   A24_17.13A         2114    Z80             A24_04.13F      |
824|                                                             |-|
825|   A24_16.11A         2114                    A24_05.11F     | |
826|                                                            S| |
827|   A24_15.10A                                 A24_06.10F     | |
828|                                                             | |
829|   A24_14.8A                                  A24_07.8F      | |
830|                                                             |-|
831|T  A24_13.7A                                  A24_08.7F       |
832|                                                              |
833|   A24_12.5A                                  A24_09.5F       |
834|                                                             |-|
835|                                              A24_10.4F      | |
836|            2114                                             | |
837|                                              A24_11.2F     R| |
838|            2114                                             | |
839|                                                             | |
840|            2114                                             |-|
841|                                                    12MHz     |
842|--------------------------------------------------------------|
843Notes:
844      R/S   - Flat cable connector, R joins to main board, S joins to SUB PCB
845      T     - 18-Way Edge Connector (for +5V/GND only)
846      A24_* - 2732 EPROMs
847      Z80   - Clock 3.000MHz [12/4]
848      2114  - 1kx4 SRAM (DIP18)
849*/
850
851ROM_START( bking3 )
852   ROM_REGION( 0x10000, REGION_CPU1, 0 )
853   ROM_LOAD( "a24-04.13f",   0x0000, 0x1000, CRC(a0c319a6) SHA1(6b79667288113fde43975fcfd05e93d8e45bf92d) )
854   ROM_LOAD( "a24-05.11f",   0x1000, 0x1000, CRC(fedc9b4a) SHA1(3ac22c3ca09df9983f3c8c05e807ecf5999c9fc5) )
855   ROM_LOAD( "a24-06.10f",   0x2000, 0x1000, CRC(6a116ebf) SHA1(e58b1f75eb75027749a900b27107930e9072ca5a) )
856   ROM_LOAD( "a24-07.8f",    0x3000, 0x1000, CRC(75a74d2d) SHA1(d433e8fcf3819b845936e7e107fef414f72bfc16) )
857   ROM_LOAD( "a24-08.7f",    0x4000, 0x1000, CRC(9fe07cf9) SHA1(23fdae48e519a171bf4adeeadf2fdfedfd56f4ea) )
858   ROM_LOAD( "a24-09.5f",    0x5000, 0x1000, CRC(51545ced) SHA1(4addad527c6fd675506bf584ec8670a23767787c) )
859   ROM_LOAD( "a24-01.4f",    0x6000, 0x1000, CRC(a86b3e62) SHA1(f97a13e31e622b5ac55c23458c65a49c2998196a) ) //another one: a24-10.4f
860   ROM_LOAD( "a24-11.2f",    0x7000, 0x1000, CRC(b39db430) SHA1(4f48a34f3aaa1e998a4a5656bc3f399d9e6633c4) )
861
862   ROM_REGION( 0x10000, REGION_CPU2, 0 )      /* Sound ROMs */
863   ROM_LOAD( "a24-18.4f",    0x0000, 0x1000, CRC(fa3bfa98) SHA1(733924e154e301a9d692d80b485afc4ab0e200c1) )
864   ROM_LOAD( "a24-19.4d",    0x1000, 0x1000, CRC(817f9c2a) SHA1(7365ecf2700e1fd13016408f5493f8d51aab5bbd) )
865   ROM_LOAD( "a24-20.4b",    0x2000, 0x1000, CRC(0e9e16d6) SHA1(43c69602a8d9c34c527ce54472db84168acc4ef4) )
866
867   ROM_REGION( 0x0800, REGION_CPU3, 0 )   /* 2k for the microcontroller */
868   ROM_LOAD( "a24_22.ic17",  0x000000, 0x000800, CRC(27c497d5) SHA1(c6c72bbf0537da53148fa0a56d412ab46129d29c) )  //M68705P5S uC 3MHz xtal
869
870   ROM_REGION( 0x6000, REGION_GFX1, ROMREGION_DISPOSE ) /* Tiles */
871   ROM_LOAD( "a24-12.5a",    0x0000, 0x1000, CRC(c5fe4817) SHA1(fbf82d9d85e18b76c7e939932df074a545e73f42) )
872   ROM_LOAD( "a24-13.7a",    0x1000, 0x1000, CRC(728bac57) SHA1(3daa246f95b31c971e5418f55b821616d0bce25d) )
873   ROM_LOAD( "a24-14.8a",    0x2000, 0x1000, CRC(63cd0009) SHA1(10fcfeec70b23e2206c4f4bf686dc6a48ecba1ce) )
874   ROM_LOAD( "a24-15.10a",   0x3000, 0x1000, CRC(590275d0) SHA1(563bebb344c606ca3a2124fc7a8804935a011e90) )
875   ROM_LOAD( "a24-16.11a",   0x4000, 0x1000, CRC(728d069e) SHA1(b4adb14281e4874bab7cec7f38ade70b5b7c6b8f) )
876   ROM_LOAD( "a24-17.13a",   0x5000, 0x1000, CRC(4c04c4f2) SHA1(8e9eee6d89e91910b398d42ac86597ef91baad96) )
877
878   ROM_REGION( 0x0800, REGION_GFX2, ROMREGION_DISPOSE )
879   ROM_LOAD( "a24-02.10e",   0x0000, 0x0800, CRC(8560da46) SHA1(56f249f0b56336daac1a3624ef9b71354bb8ca40) ) /* crow graphics */
880
881   ROM_REGION( 0x0800, REGION_GFX3, ROMREGION_DISPOSE )
882   ROM_LOAD( "a24-01.7e",    0x0000, 0x0800, CRC(369c01e1) SHA1(196e12d0bcaf74cefe4cad3fccb69d104aab061e) ) /* ball 1 graphics. Only the first 128 bytes used */
883
884   ROM_REGION( 0x0800, REGION_GFX4, ROMREGION_DISPOSE )
885   ROM_LOAD( "a24-01.9e",    0x0000, 0x0800, CRC(369c01e1) SHA1(196e12d0bcaf74cefe4cad3fccb69d104aab061e) ) /* ball 2 graphics. Only the first 128 bytes used */
886
887   ROM_REGION( 0x0020, REGION_USER1, 0 )
888   ROM_LOAD( "82s123.2c",    0x0000, 0x0020, CRC(4cb5bd32) SHA1(8851bae033ba67516d5ff6888e5daef10c2116ee) ) /* collision detection */
889
890   ROM_REGION( 0x0200, REGION_PROMS, 0 )
891   ROM_LOAD( "a24_03.2d",    0x0000, 0x0200, CRC(61b7a9ff) SHA1(4302de0c0dad2b871ad4719ad934beaee05a0c40) )   /* palette */
892
893   ROM_REGION( 0x1000, REGION_USER2, 0 )
894   ROM_LOAD( "a24-21.25",    0x0000, 0x1000, CRC(3106fcac) SHA1(08454adfb58e5df84140d86ed52fa4ef684df9f1) ) /* extra rom on the same SUB PCB where is the mcu */
895ROM_END
896
897GAME( 1982, bking,  0, bking2, bking,  0, ROT270, "Taito Corporation", "Birdie King", 0 )
898GAME( 1983, bking2, 0, bking2, bking2, 0, ROT90,  "Taito Corporation", "Birdie King 2", 0 )
899GAME( 1984, bking3, 0, bking3, bking2, 0, ROT90,  "Taito Corporation", "Birdie King 3", GAME_WRONG_COLORS )
src/mame/drivers/ampoker.c
r1768r1769
1/********************************************************************************
2
3
4    AMERICAN POKER 2
5    ----------------
6
7    Company:    Novomatic.
8    Year:       1990.
9
10    Original preliminary driver:   Curt Coder.
11    Rewrite and additional work:   Roberto Fresca, with a lot of help of Grull Osgo.
12
13
14    --- Supported Sets ---
15
16    Old name | New name | Relation | Description
17    --------------------------------------------
18    ampokr2b   ampoker2   parent     American Poker II.
19      ----     ampkr2b1   clone      American Poker II (bootleg, set 1).
20    ampokr2a   ampkr2b2   clone      American Poker II (bootleg, set 2).
21    ampoker2   ampkr2b3   clone      American Poker II (bootleg, set 3).
22    ampokr2c   pkrdewin   clone      Poker De Win.
23      ----     ampkr95    clone      American Poker 95.
24      ----     sigmapkr   parent     Sigma Poker.
25      ----     sigma2k    parent     Sigma Poker 2000.
26
27
28*********************************************************************************
29
30
31    Game Notes...
32    -------------
33
34    American Poker II uses a standard deck of 52 cards plus 1 Joker card.
35    The Joker card substitutes for any card. The player places a bet for
36    the 1st hand deal and can then choose to buy a 2nd draw.
37
38    The win combination Jacks or Better is only paid if a 2nd draw is bought.
39
40
41    Operation...
42
43    To 'init' (boot) the machine:
44    1) Turn ON the Operator Key (9).
45    2) Keep pressed the DOOR key (W). You are entering the Operator Mode.
46    3) Turn OFF the Operator Key (9).
47    4) Reset the machine. (you must reset manually the machine due to watchdog issues).
48
49    The set ampkr2b3 has a special init code/key:
50
51    1) Turn ON the Supervisor Key (0).
52    2) Enter the following sequence: HOLD1, HOLD5, HOLD4, HOLD3, HOLD2 and HOLD3.
53    3) Wait till the Supervisor Mode appear, and turn OFF the Supervisor Key (0).
54    4) Reset the machine. (you must reset manually the machine due to watchdog issues).
55
56    ...The key is produced taking 6 bytes at offset 0x5d40 XORed with their respective pairs
57    at offset 0x5d50, resulting the sequence of HOLD keys to init the machine.
58
59
60    Operator Mode:
61    Press '9' once to turn ON the Operator Key. You can find the interim meters (Page 1).
62    Press HOLD3 to clear the meters. Press '9' again to turn OFF the Operator Key.
63    Reset the machine to enter the Game Mode.
64
65    Supervisor Mode:
66    Press '0' once to turn ON the Supervisor Key. You can find the permanent meters (Page 1 to 5).
67    HOLD1, HOLD3 and HOLD5 are the valid keys to navigate through the mode. Press '0' again to turn
68    OFF the Operator Key.
69    Reset the machine to enter the Game Mode.
70
71    To access both modes, no credits should be placed in the machine.
72
73
74    From Novomatic web site:
75
76    "1990 - American Poker II kommt auf den Markt und wird als
77    'The Legend' in die Geschichte des Gl?cksspiels eingehen."
78
79    "1990 - American Poker II comes on the market and is known as
80    'The Legend' in the history of gaming."
81
82
83    ----
84
85
86    Sigma Poker:
87
88    This poker game was also sold as "upgrade kit" for American Poker II taiwanese boards.
89    The game has a lot of improvements. New graphics, sounds, bonus, and a totally new
90    'double-up' feature. Very addictive, in fact.
91
92    Sigma only released 2 games for this hardware: Sigma Poker and Sigma Poker 2000.
93    Both games need some modifications to the original board to be installed.
94    The rest of Sigma poker games (2001 onwards) were developed for B-52 mainboards.
95    (2x 6809; HD63484 video controller).
96
97    Sigma 2000 has better graphics and use 4 times more tiles than other games running
98    on this hardware. To manage this, the game use 2 extra bits from the color RAM.
99
100
101
102*********************************************************************************
103
104
105    --- Technical Notes (in progress) ---
106
107
108
109    DIP Switches
110    ------------
111
112    DIP1       Remote Credits
113    OFF        x100
114    ON         x50
115
116    DIP2       Auto Hold
117    OFF        Off
118    ON         On
119
120    DIP3 DIP4  Rate Tables (*)
121    OFF  OFF   RATE: 1 2 3 4 5 10 20 30 40 50
122    OFF  ON    RATE: 5 10 15 20 25 30 35 40 50 100
123    ON   OFF   RATE: 5 10 15 20 25 30 35 40 45 50
124    ON   ON    RATE: 10 20 30 40 50 60 70 80 90 100
125
126    DIP6       Take Winnings (On Double Up)
127    OFF        Take Part (10 Credits steps)
128    ON         Take All
129
130    DIP8       Jackpot
131    OFF        Off
132    ON         On
133
134
135    (*) Working only in ampkr95.
136
137
138
139    Hardware Notes:
140    --------------
141
142
143    - CPU:            1x Z80@4MHZ or compatible.
144    - Video:          TTL Logic Raster - 6 Mhz Dot Clock
145    - Osc:            6.000 Mhz Xtal.
146    - RAM:            1x 6116 (4Kx8) Static RAM.
147    - VRAM            2x 2016 (4Kx8) Static RAM.
148    - I/O:            8x 74251 ; 8x 74259 (Multiplex 8 Ports > 1 Bit).
149    - PRG ROMs:       1x 27c512 (64Kx8) EPROM or similar.
150    - GFX ROMs:       1x 27c128 (16Kx8) EPROM or similar.
151    - Color PROM:     1x 82S147AN.
152    - Sound:          1x AY-3-8910.
153    - Backup Battery: 1x 3.6 Volt Ni-CD.
154    - DIP Switches:   1x 8 Positions.
155    - Watchdog:       1x TL7705 (Texas Instruments) Refresh: 200 Ms.
156
157
158    Taiwanese PCB Layout:
159     ________________________________________________________________________________
160    |                                                                                |
161    |  ______   _________    _________    ______________    _________   __________   |
162    | | XTAL | | 74LS04  |  | 74LS138 |  |              |  | 74LS163 | |PALCE16V8H|  |
163    | | 6MHz | |_________|  |_________|  |  UM6116-2    |  |_________| |__________|  |
164    | |______|  _________    _________   |______________|   _________   ________  __ |
165    |          | 74LS74A |  | DM7407N |  _______________   | 74LS163 | | 74LS00 ||74||
166    |          |_________|  |_________| |               |  |_________| |________||LS||
167    |  ___________________   _________  |    27C512     |   _________   ________ |08||
168    | |                   | | MC14020 | |_______________|  | 74LS163 | | 74LS157||__||
169    | |BATTERY NI-CD 3.6V | |_________|                    |_________| |________|    |
170    | |___________________|  ___________   _____________    _________   ________     |
171    |____                   | 74LS244   | |   74LS245   |  | 74LS163 | | 74LS157|    |
172         |                  |___________| |_____________|  |_________| |________|    |
173     ____|                                                                           |
174    |_28_                         ______________________    _________   ________     |
175    |____                        |       - Z80A -       |  | 74LS74  | | 74LS157|    |
176    |____                        |     TMPZ84C00AP-6    |  |_________| |________|    |
177    |____                        |______________________|   __________  __________   |
178    |____                     ___________    ____________  |PALCE16V8H||D4016CX-20|  |
179    |____                    | 74LS244N  |  |  74LS259N  | |__________||__________|  |
180    |____                    |___________|  |____________|  ________    __________   |
181    |____                     ___________     __________   | 74LS02 |  |D4016CX-20|  |
182    |____                    | TD62003AP |   | 74LS251P |  |________|  |__________|  |
183    |____                    |___________|   |__________|   __________________       |
184    |____                     ___________     __________   | AY-3-8910        |      |
185    |____                    | 74LS259N  |   | 74LS251P |  | KC89C72 / YM2149F|      |
186    |____                    |___________|   |__________|  |__________________|      |
187    |____                     ___________     __________    _________   __________   |
188    |____                    | 74LS259N  |   | 74LS251P |  | 82S147AN| | 74LS245  |  |
189    |____                    |___________|   |__________|  |_________| |__________|  |
190    |____                     ___________     __________    _________                |
191    |____                    | 74LS259N  |   | 74LS251P |  | 74LS377 |               |
192    |____                    |___________|   |__________|  |_________|               |
193    |____                     ___________     __________    _________                |
194    |____        ________    | TD62003AP |   | 74LS251P |  | 74LS377 |               |
195    |____       |12345678|   |___________|   |__________|  |_________|               |
196    |____       |________|                    __________    _________   _________    |
197    |____          DSW1                      | 74LS194  |  | 74LS194 | | 74LS245 |   |
198    |____                                    |__________|  |_________| |_________|   |
199    |____                                                                            |
200    |____         ______        ________________         _____________   _________   |
201    |_01_        |TL7705|      |01 oooooooooo 10|       |   27C128    | | 74LS377 |  |
202         |       |______|      |________________|       |   D27128D   | |_________|  |
203     ____|                         CONNECTOR1           |_____________|              |
204    |                                                                                |
205    |________________________________________________________________________________|
206
207
208
209
210*********************************************************************************
211
212
213    Dumper Notes (old)
214    ------------------
215
216    American Poker
217    WB 5300 IS SAME AS Winbond WF19054 and YM2149F (AY891X?)
218    CPU TMPZ84C00AP OR LH0080A
219    XTAL 6.000
220    1 DIP x 8
221    RAM 6116
222    LH 5116D X2
223
224    ---------------------------------------------
225
226    Crystal 6.000 MHz
227    CPU         Sharp LH0080B Z80B-CPU 9241 1 B
228    Sound       OKI M5255 9203
229    RAM         2x TMM2015AP-15 (2048x8)
230    PAL         PAL?????16VE??? 022J????  P.M.REG
231    PROM        Philips N82S147AN PTH6708 9518nl
232    EPROM       Intel D27128-4 T8180760S
233                AMD AM27C512-205DC 916LADL
234    Chip?       Sanyo ?????
235
236    7 unmarked chips
237
238*********************************************************************************
239
240
241    --- DRIVER UPDATES ---
242
243
244    [2007-11-15]
245
246    ******** REWRITE ********
247
248    - Crystal documented via #define.
249    - CPU and sound clocks derived from #defined crystal value.
250    - Reworked TILE_GET_INFO to handle the proper tiles/color codes.
251    - Added the correct GFX dump to sigma2k.
252    - Added proper TILE_GET_INFO, VIDEO_START, GFX_LAYOUT, GFXDECODE and MACHINE to sigma2k.
253    - Fixed interrupts (NMI).
254    - Corrected AY8910 frequency to 1.5 MHz to match the real thing.
255    - Arranged the AY8910 volume in all games avoiding clips.
256    - Corrected the screen visible area.
257    - Added NVRAM support.
258    - Reworked the memory map, mapping all the hardware I/O ports.
259    - Reworked the Inputs for all sets.
260    - Added implementation of Operator and Supervisor Keys.
261    - Fixed some timing troubles.
262    - Mapped the input buttons in the same way I mapped them in other poker games.
263    - Added partial DIP switch support with diplocations to all sets.
264
265    - Removed the hack in DRIVER_INIT.
266    - Hooked write handlers for output ports.
267    - Added watchdog routines.
268    - Dumped, hooked, wired and decoded the color PROM in all sets. Colors are perfect.
269    - Modified the refresh rate to 60 fps according to hardware measurements.
270    - Cleaned up and renamed all sets, defining parent-clone relationship.
271    - Wired the lamps for all sets. Created their respective layouts.
272    - Updated flags in game drivers.
273    - Splitted the driver to driver/video.
274    - Other minor fixes.
275
276    - New set dumped/added: American Poker 95.
277    - New set dumped/added: American Poker 2 (bootleg, set 1).
278    - New set dumped/added: Sigma Poker.
279    - New set dumped/added: Sigma Poker 2000.
280
281    - Rewritten the technical notes from the scratch (still in progress).
282    - Added a PCB layout to the technical notes.
283
284
285
286    *** TO DO ***
287
288    - Find why the watchdog sometimes stop to work.
289    - Analyze the write to port 0x21 after reset.
290
291
292
293*********************************************************************************/
294
295
296#define MASTER_CLOCK   6000000    /* 6 Mhz */
297
298#include "driver.h"
299#include "sound/ay8910.h"
300#include "ampoker.lh"
301#include "sigmapkr.lh"
302
303/* from video */
304extern WRITE8_HANDLER( ampoker2_videoram_w );
305extern PALETTE_INIT( ampoker2 );
306extern VIDEO_START( ampoker2 );
307extern VIDEO_START( sigma2k );
308extern VIDEO_UPDATE( ampoker2 );
309
310
311/**********************
312* Read/Write Handlers *
313*  - Output Ports -   *
314***********************
315
316
317  There are only five bits wired for each Port
318
319  PORT   ADDRESS    BIT0      BIT1      BIT2      BIT3      BIT4
320  -------------------------------------------------------------------
321
322  0x30 - 0xc000     ----      ----      ----      ----      ----
323  0x31 - 0xc001     ----    L.Bet/Red  L.Hold4   L.Hold2   Twr.Yell
324  0x32 - 0xc002     ----      ----      ----     L.Hold3    ----
325  0x33 - 0xc003     ----      ----      ----      ----      ----
326  0x34 - 0xc004     ----      ----      ----      ----     L.Black
327  0x35 - 0xc005     ----      ----      ----      ----      ----
328  0x36 - 0xc006   Twr.Grn.   L.Hold5   L.Deal    L.Hold1    ----
329  0x37 - 0xc007     ----      ----      ----     WatchDog   ----
330
331
332  --- Lamps wiring (done) ---
333
334    L0 = DEAL / TAKE
335    L1 = RED / BET
336    L2 = BLACK
337    L3 = HOLD 1
338    L4 = HOLD 2
339    L5 = HOLD 3
340    L6 = HOLD 4
341    L7 = HOLD 5
342    L8 = TOWER YELLOW (not in lay)
343    L9 = TOWER GREEN  (not in lay)
344
345
346  --- Counters wiring ---
347
348    C0 = METER 1 - REMOTE IN
349    C1 = METER 2 - TOTAL OUT
350    C2 = METER 3 - TOTAL IN
351    C3 = METER 4 - BILLS
352    C4 = METER 5 - JACKPOT
353    C5 = METER 6 - CASH BOX
354    C6 = METER 7 - GAMES
355    C7 = METER 8 - ?
356
357
358  --- Devices wiring ---
359
360    D0 = Enable Coin to Hopper / Diverter
361    D1 = Enable Coin 1 / Acceptor
362    D2 = Enable Coin 2
363    D3 = Enable Coin 3
364    D4 = Enable Coin 4 / Bill Reader
365    D5 = Hopper 1 Enable
366    D6 = Hopper 2 Enable (Optional)
367    D7 = Hopper 1 2 Enable
368
369
370  --- Unused wiring ---
371
372    U0 = Pin 15A (ULN2064)
373    U1 = Pin 17C (ULN2064)
374    U2 = Pin 19A (ULN2064)
375    U3 = Pin  6C (ULN2064)
376    U4 = Pin 13C
377    U5 = Pin 14A
378
379*/
380
381static WRITE8_HANDLER( ampoker2_port30_w )
382/*-------------------------------------------------
383    PORT_30 C000H         ;OUTPUT PORT 30H
384---------------------------------------------------
385    BIT 0 =
386    BIT 1 =
387    BIT 2 =
388    BIT 3 =
389    BIT 4 =
390--------------------------------------------------*/
391{
392}
393
394
395static WRITE8_HANDLER( ampoker2_port31_w )
396/*-------------------------------------------------
397    PORT_31 C001H         ;OUTPUT PORT 31H
398---------------------------------------------------
399    BIT 0 =
400    BIT 1 = LAMP_1        ;Lamp 1  (RED)
401    BIT 2 = LAMP_6        ;Lamp 6  (HOLD4)
402    BIT 3 = LAMP_4        ;Lamp 4  (HOLD2)
403    BIT 4 = TWL_YELL      ;Tower Light YELLOW
404--------------------------------------------------*/
405{
406   output_set_lamp_value(1, ((data >> 1) & 1));   /* Lamp 1 - BET/RED */
407   output_set_lamp_value(6, ((data >> 2) & 1));   /* Lamp 6 - HOLD 4 */
408   output_set_lamp_value(4, ((data >> 3) & 1));   /* Lamp 4 - HOLD 2 */
409   output_set_lamp_value(8, ((data >> 4) & 1));   /* Lamp 8 - TWR.YELLOW */
410}
411
412
413static WRITE8_HANDLER( ampoker2_port32_w )
414/*-------------------------------------------------
415    PORT_32 C002H         ;OUTPUT PORT 32H
416---------------------------------------------------
417    BIT 0 =
418    BIT 1 =
419    BIT 2 =
420    BIT 3 = LAMP_5        ;Lamp 5  (HOLD3)
421    BIT 4 =
422--------------------------------------------------*/
423{
424   output_set_lamp_value(5, ((data >> 3) & 1));   /* Lamp 5 - HOLD 3 */
425}
426
427
428static WRITE8_HANDLER( ampoker2_port33_w )
429/*-------------------------------------------------
430    PORT_33 C003H         ;OUTPUT PORT 33H
431---------------------------------------------------
432    BIT 0 =
433    BIT 1 =
434    BIT 2 =
435    BIT 3 =
436    BIT 4 =
437--------------------------------------------------*/
438{
439}
440
441
442static WRITE8_HANDLER( ampoker2_port34_w )
443/*-------------------------------------------------
444    PORT_34 C004H         ;OUTPUT PORT 34H
445---------------------------------------------------
446    BIT 0 =
447    BIT 1 =
448    BIT 2 =
449    BIT 3 =
450    BIT 4 = LAMP_2        ;Lamp 3  (BLACK)
451--------------------------------------------------*/
452{
453   output_set_lamp_value(2, ((data >> 4) & 1));   /* Lamp 2 - BLACK */
454}
455
456
457static WRITE8_HANDLER( ampoker2_port35_w )
458/*-------------------------------------------------
459    PORT_35 C005H         ;OUTPUT PORT 35H
460---------------------------------------------------
461    BIT 0 =
462    BIT 1 =
463    BIT 2 =
464    BIT 3 =
465    BIT 4 =
466--------------------------------------------------*/
467{
468}
469
470
471static WRITE8_HANDLER( ampoker2_port36_w )
472/*-------------------------------------------------
473    PORT_36 C006H         ;OUTPUT PORT 36H
474---------------------------------------------------
475    BIT 0 = TWL_GREEN     ;Tower Light GREEN
476    BIT 1 =
477    BIT 2 = LAMP_9        ;Lamp 9  (HOLD5)
478    BIT 3 = LAMP_0        ;Lamp 0  (DEAL)
479    BIT 4 = LAMP_3        ;Lamp 3  (HOLD1)
480--------------------------------------------------*/
481{
482   output_set_lamp_value(9, (data & 1));         /* Lamp 9 - TWR.GREEN */
483   output_set_lamp_value(7, ((data >> 2) & 1));   /* Lamp 7 - HOLD 5 */
484   output_set_lamp_value(0, ((data >> 3) & 1));   /* Lamp 0 - DEAL */
485   output_set_lamp_value(3, ((data >> 4) & 1));   /* Lamp 3 - HOLD 1 */
486}
487
488
489static WRITE8_HANDLER( ampoker2_watchdog_reset_w )
490/*-------------------------------------------------
491    PORT_37 C007H         ;OUTPUT PORT 37H
492---------------------------------------------------
493    BIT 3 = W_DOG         ;WATCHDOG.
494--------------------------------------------------*/
495{
496   /* watchdog sometimes stop to work */
497   if (( (data >> 3) & 0x01) == 0)      /* check for refresh value (0x08h) */
498   {
499      watchdog_reset_w(0,0);
500//      fprintf(stdout,"Watchdog\n");
501   }
502}
503
504
505/*************************
506* Memory map information *
507*************************/
508
509static ADDRESS_MAP_START( ampoker2_map, ADDRESS_SPACE_PROGRAM, 8 )
510   AM_RANGE(0x0000, 0xbfff) AM_ROM
511   AM_RANGE(0xc000, 0xcfff) AM_RAM AM_BASE(&generic_nvram) AM_SIZE(&generic_nvram_size)
512   AM_RANGE(0xe000, 0xefff) AM_RAM AM_WRITE(ampoker2_videoram_w) AM_BASE(&videoram)
513ADDRESS_MAP_END
514
515static ADDRESS_MAP_START( ampoker2_io_map, ADDRESS_SPACE_IO, 8 )
516   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
517   AM_RANGE(0x08, 0x0f) AM_WRITENOP            /* inexistent in the real hardware */
518   AM_RANGE(0x10, 0x10) AM_READ(input_port_0_r)
519   AM_RANGE(0x11, 0x11) AM_READ(input_port_1_r)
520   AM_RANGE(0x12, 0x12) AM_READ(input_port_2_r)
521   AM_RANGE(0x13, 0x13) AM_READ(input_port_3_r)
522   AM_RANGE(0x14, 0x14) AM_READ(input_port_4_r)
523   AM_RANGE(0x15, 0x15) AM_READ(input_port_5_r)
524   AM_RANGE(0x16, 0x16) AM_READ(input_port_6_r)
525   AM_RANGE(0x17, 0x17) AM_READ(input_port_7_r)
526//  AM_RANGE(0x21, 0x21) AM_WRITENOP                    /* undocumented, write 0x1a after each reset */
527   AM_RANGE(0x30, 0x30) AM_WRITE (ampoker2_port30_w)   /* see write handlers */
528   AM_RANGE(0x31, 0x31) AM_WRITE (ampoker2_port31_w)   /* see write handlers */
529   AM_RANGE(0x32, 0x32) AM_WRITE (ampoker2_port32_w)   /* see write handlers */
530   AM_RANGE(0x33, 0x33) AM_WRITE (ampoker2_port33_w)   /* see write handlers */
531   AM_RANGE(0x34, 0x34) AM_WRITE (ampoker2_port34_w)   /* see write handlers */
532   AM_RANGE(0x35, 0x35) AM_WRITE (ampoker2_port35_w)   /* see write handlers */
533   AM_RANGE(0x36, 0x36) AM_WRITE (ampoker2_port36_w)   /* see write handlers */
534   AM_RANGE(0x37, 0x37) AM_WRITE(ampoker2_watchdog_reset_w)
535   AM_RANGE(0x38, 0x38) AM_WRITE(AY8910_control_port_0_w)
536   AM_RANGE(0x39, 0x39) AM_WRITE(AY8910_write_port_0_w)
537   AM_RANGE(0x3A, 0x3A) AM_READ(AY8910_read_port_0_r)
538ADDRESS_MAP_END
539
540
541
542/*************************
543*      Input ports       *
544*************************/
545
546static INPUT_PORTS_START( ampoker2 )
547   PORT_START_TAG("IN0")
548   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
549   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
550   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
551   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper 1") PORT_CODE(KEYCODE_Y)
552   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )   PORT_IMPULSE(2)
553   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
554   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
555   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
556   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN3 )   PORT_IMPULSE(2)
557
558   PORT_START_TAG("IN1")
559   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
560   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
561   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
562   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z)
563   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Operator Key") PORT_TOGGLE PORT_CODE(KEYCODE_9)
564   PORT_DIPNAME( 0x08, 0x08, "Remote Mode" )
565   PORT_DIPSETTING(    0x08, "Mode 1" )
566   PORT_DIPSETTING(    0x00, "Mode 2" )
567   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V)
568
569   PORT_START_TAG("IN2")
570   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
571   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
572   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
573   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("RTS") PORT_CODE(KEYCODE_U)
574   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Door Switch") PORT_CODE(KEYCODE_W)
575   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
576   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
577   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
578   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("Payout") PORT_CODE(KEYCODE_Q)
579
580   PORT_START_TAG("IN3")
581   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper Out") PORT_CODE(KEYCODE_I)
582   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Supervisor Key") PORT_TOGGLE PORT_CODE(KEYCODE_0)
583   PORT_DIPNAME( 0x08, 0x08, "Remote Credits" ) PORT_DIPLOCATION("SW1:1") /* DSW1 */
584   PORT_DIPSETTING(    0x08, "Cred x 100" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x08)
585   PORT_DIPSETTING(    0x00, "Cred x  50" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x08)
586   PORT_DIPSETTING(    0x08, "Cred x  20" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x00) /* x100 in ampkr95 */
587   PORT_DIPSETTING(    0x00, "Remote Off" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x00)
588   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Black Card") PORT_CODE(KEYCODE_S)
589
590   PORT_START_TAG("IN4")
591   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) /* not used */
592   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper Low") PORT_CODE(KEYCODE_H)
593   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X)
594   PORT_DIPNAME( 0x08, 0x08, "Auto Hold" )      PORT_DIPLOCATION("SW1:2") /* DSW2 */
595   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
596   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
597   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Deal / Take") PORT_CODE(KEYCODE_1)
598
599   PORT_START_TAG("IN5")
600   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
601   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
602   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
603   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Return Line") PORT_CODE(KEYCODE_J)
604   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("TILT") PORT_CODE(KEYCODE_K)
605   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
606   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
607   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
608   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C)
609
610   PORT_START_TAG("IN6")
611   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
612   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
613   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
614   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Bet / Red Card") PORT_CODE(KEYCODE_A)
615   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B)
616   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
617   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
618   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
619   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )   PORT_IMPULSE(2)
620
621   PORT_START_TAG("IN7")
622   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE ) /* not used */
623   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Remote Credits") PORT_IMPULSE(12) PORT_CODE(KEYCODE_3)
624   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN4 )   PORT_IMPULSE(2)
625   PORT_DIPNAME( 0x08, 0x08, "Jackpot" )        PORT_DIPLOCATION("SW1:8") /* DSW8 */
626   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
627   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
628   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Clear Credits") PORT_CODE(KEYCODE_4)
629INPUT_PORTS_END
630
631static INPUT_PORTS_START( ampkr95 )
632   PORT_START_TAG("IN0")
633   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
634   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
635   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
636   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper 1") PORT_CODE(KEYCODE_Y)
637   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )   PORT_IMPULSE(2)
638   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
639   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
640   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
641   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN3 )   PORT_IMPULSE(2)
642
643   PORT_START_TAG("IN1")
644   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
645   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
646   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
647   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z)
648   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Operator Key") PORT_TOGGLE PORT_CODE(KEYCODE_9)
649   PORT_DIPNAME( 0x08, 0x08, "Remote Mode" )
650   PORT_DIPSETTING(    0x08, "Mode 1" )
651   PORT_DIPSETTING(    0x00, "Mode 2" )
652   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V)
653
654   PORT_START_TAG("IN2")
655   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
656   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
657   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
658   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("RTS") PORT_CODE(KEYCODE_U)
659   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Door Switch") PORT_CODE(KEYCODE_W)
660   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
661   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
662   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
663   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("Payout") PORT_CODE(KEYCODE_Q)
664
665   PORT_START_TAG("IN3")
666   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper Out") PORT_CODE(KEYCODE_I)
667   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Supervisor Key") PORT_TOGGLE PORT_CODE(KEYCODE_0)
668   PORT_DIPNAME( 0x08, 0x08, "Remote Credits" ) PORT_DIPLOCATION("SW1:1") /* DSW1 */
669   PORT_DIPSETTING(    0x08, "Cred x 100" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x08)
670   PORT_DIPSETTING(    0x00, "Cred x  50" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x08)
671   PORT_DIPSETTING(    0x08, "Cred x 100" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x00) /* x100 in ampkr95 */
672   PORT_DIPSETTING(    0x00, "Remote Off" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x00)
673   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Black Card") PORT_CODE(KEYCODE_S)
674
675   PORT_START_TAG("IN4")
676   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) /* not used */
677   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper Low") PORT_CODE(KEYCODE_H)
678   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X)
679   PORT_DIPNAME( 0x08, 0x08, "Auto Hold" )      PORT_DIPLOCATION("SW1:2") /* DSW2 */
680   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
681   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
682   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Deal / Take") PORT_CODE(KEYCODE_1)
683
684   PORT_START_TAG("IN5")
685   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
686   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
687   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
688   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Return Line") PORT_CODE(KEYCODE_J)
689   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("TILT") PORT_CODE(KEYCODE_K)
690   PORT_DIPNAME( 0x08, 0x08, "Rate Table SW1" ) PORT_DIPLOCATION("SW1:3") /* DSW3 (should be arranged with DSW4) */
691   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
692   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
693   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C)
694
695   PORT_START_TAG("IN6")
696   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
697   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
698   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
699   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Bet / Red") PORT_CODE(KEYCODE_A)
700   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B)
701   PORT_DIPNAME( 0x08, 0x08, "Rate Table SW2" ) PORT_DIPLOCATION("SW1:4") /* DSW4 (should be arranged with DSW3) */
702   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
703   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
704   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )   PORT_IMPULSE(2)
705
706   PORT_START_TAG("IN7")
707   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE ) /* not used */
708   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Remote Credits") PORT_IMPULSE(12) PORT_CODE(KEYCODE_3)
709   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN4 )   PORT_IMPULSE(2)
710   PORT_DIPNAME( 0x08, 0x08, "Jackpot" )        PORT_DIPLOCATION("SW1:8") /* DSW8 */
711   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
712   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
713   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Clear Credits") PORT_CODE(KEYCODE_4)
714INPUT_PORTS_END
715
716static INPUT_PORTS_START( sigmapkr )
717   PORT_START_TAG("IN0")
718   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
719   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
720   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
721   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper 1") PORT_CODE(KEYCODE_Y)
722   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN2 )   PORT_IMPULSE(2)
723   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
724   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
725   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
726   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN3 )   PORT_IMPULSE(2)
727
728   PORT_START_TAG("IN1")
729   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
730   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
731   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
732   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_NAME("Hold 1") PORT_CODE(KEYCODE_Z)
733   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Operator Key") PORT_TOGGLE PORT_CODE(KEYCODE_9)
734   PORT_DIPNAME( 0x08, 0x08, "Remote Mode" )
735   PORT_DIPSETTING(    0x08, "Mode 1" )
736   PORT_DIPSETTING(    0x00, "Mode 2" )
737   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7 ) PORT_NAME("Hold 4") PORT_CODE(KEYCODE_V)
738
739   PORT_START_TAG("IN2")
740   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
741   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
742   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
743   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("RTS") PORT_CODE(KEYCODE_U)
744   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Door Switch") PORT_CODE(KEYCODE_W)
745   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
746   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
747   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
748   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON9 ) PORT_NAME("Payout") PORT_CODE(KEYCODE_Q)
749
750   PORT_START_TAG("IN3")
751   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper Out") PORT_CODE(KEYCODE_I)
752   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Supervisor Key") PORT_TOGGLE PORT_CODE(KEYCODE_0)
753   PORT_DIPNAME( 0x08, 0x08, "Remote Credits" ) PORT_DIPLOCATION("SW1:1") /* DSW1 */
754   PORT_DIPSETTING(    0x08, "Cred x 100" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x08)
755   PORT_DIPSETTING(    0x00, "Cred x  50" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x08)
756   PORT_DIPSETTING(    0x08, "Cred x 100" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x00) /* x100 in ampkr95 */
757   PORT_DIPSETTING(    0x00, "Remote Off" ) PORT_CONDITION("IN1",0x08,PORTCOND_EQUALS,0x00)
758   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_NAME("Double") PORT_CODE(KEYCODE_S)
759
760   PORT_START_TAG("IN4")
761   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SERVICE ) /* not used */
762   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Hopper Low") PORT_CODE(KEYCODE_H)
763   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON5 ) PORT_NAME("Hold 2") PORT_CODE(KEYCODE_X)
764   PORT_DIPNAME( 0x08, 0x08, "Auto Hold" )      PORT_DIPLOCATION("SW1:2") /* DSW2 */
765   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
766   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
767   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_NAME("Deal / Take") PORT_CODE(KEYCODE_1)
768
769   PORT_START_TAG("IN5")
770   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
771   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
772   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
773   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Return Line") PORT_CODE(KEYCODE_J)
774   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("TILT") PORT_CODE(KEYCODE_K)
775   PORT_DIPNAME( 0x08, 0x08, "Rate Table SW1" ) PORT_DIPLOCATION("SW1:3") /* DSW3 (should be arranged with DSW4) */
776   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
777   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
778   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON6 ) PORT_NAME("Hold 3") PORT_CODE(KEYCODE_C)
779
780   PORT_START_TAG("IN6")
781   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
782   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
783   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
784   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_NAME("Bet") PORT_CODE(KEYCODE_A)
785   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON8 ) PORT_NAME("Hold 5") PORT_CODE(KEYCODE_B)
786   PORT_DIPNAME( 0x08, 0x08, "Rate Table SW2" ) PORT_DIPLOCATION("SW1:4") /* DSW4 (should be arranged with DSW3) */
787   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
788   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
789   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )   PORT_IMPULSE(2)
790
791   PORT_START_TAG("IN7")
792   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SERVICE ) /* not used */
793   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Remote Credits") PORT_IMPULSE(12) PORT_CODE(KEYCODE_3)
794   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN4 )   PORT_IMPULSE(2)
795   PORT_DIPNAME( 0x08, 0x08, "Jackpot" )        PORT_DIPLOCATION("SW1:8") /* DSW8 */
796   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
797   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
798   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE ) PORT_NAME("Clear Credits") PORT_CODE(KEYCODE_4)
799INPUT_PORTS_END
800
801
802/*************************
803*    Graphics Layouts    *
804*************************/
805
806static const gfx_layout charlayout =
807{
808   8, 8,
809   1024,
810   2,
811   { 0, 4 },
812   { 0, 1, 2, 3, 8, 9, 10, 11 },
813   { 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8 },
814   16*8
815};
816
817static const gfx_layout s2k_charlayout =
818{
819   8, 8,
820   4096,
821   2,
822   { 0, 4 },
823   { 0, 1, 2, 3, 8, 9, 10, 11 },
824   { 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8 },
825   16*8
826};
827
828
829/******************************
830* Graphics Decode Information *
831******************************/
832
833static GFXDECODE_START( ampoker2 )
834   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout, 0, 16 )
835GFXDECODE_END
836
837static GFXDECODE_START( sigma2k )
838   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, s2k_charlayout, 0, 16 )
839GFXDECODE_END
840
841
842/*******************
843* AY8910 Interfase *
844*******************/
845
846static const struct AY8910interface ay8910_interface =
847{
8480, 0, 0, 0   /* no ports used */
849};
850
851
852/*************************
853*     Machine Driver     *
854*************************/
855
856static MACHINE_DRIVER_START( ampoker2 )
857
858   /* basic machine hardware */
859   MDRV_CPU_ADD(Z80, MASTER_CLOCK/2)      /* 3 MHz */
860   MDRV_CPU_PROGRAM_MAP(ampoker2_map, 0)
861   MDRV_CPU_IO_MAP(ampoker2_io_map, 0)
862   MDRV_CPU_PERIODIC_INT(nmi_line_pulse, 1536)
863   MDRV_WATCHDOG_TIME_INIT(ATTOTIME_IN_HZ( 5 ))   /* 200 ms, measured */
864   //MDRV_WATCHDOG_VBLANK_INIT(8)
865   MDRV_SCREEN_REFRESH_RATE(60)
866   /*  if VBLANK is used, the watchdog timer stop to work.
867    MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
868    */
869   MDRV_NVRAM_HANDLER(generic_0fill)
870
871   /* video hardware */
872   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
873   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
874   MDRV_SCREEN_SIZE(64*8, 32*8)
875   MDRV_SCREEN_VISIBLE_AREA(20*8, 56*8-1, 2*8, 32*8-1)
876
877   MDRV_GFXDECODE(ampoker2)
878   MDRV_PALETTE_LENGTH(512)
879   MDRV_COLORTABLE_LENGTH(512)
880
881   MDRV_PALETTE_INIT(ampoker2)
882   MDRV_VIDEO_START(ampoker2)
883   MDRV_VIDEO_UPDATE(ampoker2)
884
885   /* sound hardware */
886   MDRV_SPEAKER_STANDARD_MONO("mono")
887   MDRV_SOUND_ADD(AY8910,MASTER_CLOCK/4)   /* 1.5 MHz, verified against the real thing */
888   MDRV_SOUND_CONFIG(ay8910_interface)
889   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.30)
890MACHINE_DRIVER_END
891
892static MACHINE_DRIVER_START( sigma2k )
893   /* basic machine hardware */
894   MDRV_IMPORT_FROM(ampoker2)
895
896   /* video hardware */
897   MDRV_GFXDECODE(sigma2k)
898   MDRV_VIDEO_START(sigma2k)
899MACHINE_DRIVER_END
900
901
902/*************************
903*        Rom Load        *
904*************************/
905
906ROM_START( ampoker2 )
907   ROM_REGION( 0x10000, REGION_CPU1, 0 )
908   ROM_LOAD( "poker9.003", 0x4000, 0x8000, CRC(a31221fc) SHA1(4a8bdd8ce8d5bff7e7cfc4ae91e27c1d366dc54d) )
909   ROM_COPY( REGION_CPU1, 0x8000, 0x0000, 0x4000 ) /* poker9.003 contains the 16K halves swapped around */
910   ROM_LOAD( "poker9.002", 0x8000, 0x4000, CRC(bfde5bce) SHA1(c7c7ca2268694015e8ec673e8fa5c48043086d3f) )
911
912   ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
913   ROM_LOAD( "poker9.028", 0x0000, 0x4000, CRC(65bccb40) SHA1(75f154a2aaf9f9be62e0e1dd8cbe630b9ea0145c) )
914
915   ROM_REGION( 0x200, REGION_PROMS, 0 )
916   ROM_LOAD( "82s147an.u48", 0x0000, 0x0200, CRC(9bc8e543) )
917ROM_END
918
919ROM_START( ampkr2b1 )
920   ROM_REGION( 0x10000, REGION_CPU1, 0 )
921   ROM_LOAD( "airl-v00.512", 0x0000, 0x10000, CRC(e5953bf4) SHA1(291367431e3b21b57704228c63e4da853e6d25b7) )
922
923   ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
924   ROM_LOAD( "ampoker.u47", 0x0000, 0x4000, CRC(cefed6c7) SHA1(79591339eab2712b432dfe89929dbc97000a13d2) )
925
926   ROM_REGION( 0x200, REGION_PROMS, 0 )
927   ROM_LOAD( "82s147an.u48", 0x0000, 0x0200, CRC(9bc8e543) )
928ROM_END
929
930ROM_START( ampkr2b2 )
931   ROM_REGION( 0x10000, REGION_CPU1, 0 )
932   ROM_LOAD( "rom9.u6", 0x0000, 0x10000, CRC(820a491d) SHA1(36654aacac010e7c086dd18d4e0ca5d959b9044f) )
933
934   ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
935   ROM_LOAD( "rom0.u47", 0x0000, 0x4000, CRC(cefed6c7) SHA1(79591339eab2712b432dfe89929dbc97000a13d2) )
936
937   ROM_REGION( 0x200, REGION_PROMS, 0 )
938   ROM_LOAD( "82s147an.u48", 0x0000, 0x0200, CRC(9bc8e543) )
939ROM_END
940
941ROM_START( ampkr2b3 )
942   ROM_REGION( 0x10000, REGION_CPU1, 0 )
943   ROM_LOAD( "ampoker.u6", 0x0000, 0x10000, CRC(d7b055bd) SHA1(f5231d2ec80f740eabedaba07547ccbb977accc1) )
944
945   ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
946   ROM_LOAD( "ampoker.u47", 0x0000, 0x4000, CRC(cefed6c7) SHA1(79591339eab2712b432dfe89929dbc97000a13d2) )
947
948   ROM_REGION( 0x200, REGION_PROMS, 0 )
949   ROM_LOAD( "82s147an.u48", 0x0000, 0x0200, CRC(9bc8e543) )
950ROM_END
951
952ROM_START( ampkr95 )
953   ROM_REGION( 0x10000, REGION_CPU1, 0 )
954   ROM_LOAD( "amp95rus.u6", 0x0000, 0x10000, CRC(6ec74b2b) SHA1(2dca05bc111071f1407dd524b67b5a3dc5848c70) )
955
956   ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
957   ROM_LOAD( "ampoker.u47", 0x0000, 0x4000, CRC(cefed6c7) SHA1(79591339eab2712b432dfe89929dbc97000a13d2) )
958
959   ROM_REGION( 0x200, REGION_PROMS, 0 )
960   ROM_LOAD( "82s147an.u48", 0x0000, 0x0200, CRC(9bc8e543) )
961ROM_END
962
963ROM_START( pkrdewin )
964   ROM_REGION( 0x14000, REGION_CPU1, 0 )
965   ROM_LOAD( "poker7.001", 0x4000, 0x10000, CRC(eca16b9e) SHA1(5063d733721457ab3b08caafbe8d33b2cbe4f88b) )
966   ROM_COPY( REGION_CPU1,   0x8000, 0x0000, 0x4000 ) /* poker7.001 contains the 1st and 2nd 16K quarters swapped */
967   ROM_COPY( REGION_CPU1, 0x10000, 0x8000, 0x4000 ) /* poker7.001 contains the 1st and 2nd 16K quarters swapped */
968
969   ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
970   ROM_LOAD( "poker7.002", 0x0000, 0x4000, CRC(65bccb40) SHA1(75f154a2aaf9f9be62e0e1dd8cbe630b9ea0145c) )
971
972   ROM_REGION( 0x200, REGION_PROMS, 0 )
973   ROM_LOAD( "82s147an.u48", 0x0000, 0x0200, CRC(9bc8e543) )
974ROM_END
975
976ROM_START( sigmapkr )
977   ROM_REGION( 0x10000, REGION_CPU1, 0 )
978   ROM_LOAD( "sigmapkr.u6", 0x0000, 0x10000, CRC(aa3f429a) SHA1(8c82e86de7280590ba157860cbf9783f893f8554) )
979
980   ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE )
981   ROM_LOAD( "sigmapkr.u47", 0x0000, 0x4000, CRC(49eb69a8) SHA1(22be5870d501d229aa56fb18146ec0d8f8eea72e) )
982
983   ROM_REGION( 0x200, REGION_PROMS, 0 )
984   ROM_LOAD( "82s147an_spkr.u48", 0x0000, 0x0200, CRC(3d8683d0) )
985ROM_END
986
987ROM_START( sigma2k )
988   ROM_REGION( 0x10000, REGION_CPU1, 0 )
989   ROM_LOAD( "sigma2k.u6", 0x0000, 0x10000, CRC(608d1771) SHA1(0ec94d780565472c7e68da7e3ce19aea3f1ab4a5) )
990
991   ROM_REGION( 0x10000, REGION_GFX1, ROMREGION_DISPOSE )
992   ROM_LOAD( "sigma2k.u47", 0x0000, 0x10000, CRC(3ed7b9df) SHA1(788a90ffa6cb0bfebf607815a695a5afe930945c) )
993
994   ROM_REGION( 0x200, REGION_PROMS, 0 )
995   ROM_LOAD( "82s147an_s2k.u48", 0x0000, 0x0200, CRC(715361cc) )
996ROM_END
997
998
999/*************************
1000*      Game Drivers      *
1001*************************/
1002
1003/*     YEAR  NAME      PARENT    MACHINE   INPUT     INIT  ROT    COMPANY       FULLNAME                             FLAGS             LAYOUT      */
1004GAMEL( 1990, ampoker2, 0,        ampoker2, ampoker2, 0,    ROT0, "Novomatic",  "American Poker II",                  0,                layout_ampoker )
1005GAMEL( 1990, ampkr2b1, ampoker2, ampoker2, ampoker2, 0,    ROT0, "Bootleg",    "American Poker II (bootleg, set 1)", 0,                layout_ampoker )
1006GAMEL( 1990, ampkr2b2, ampoker2, ampoker2, ampoker2, 0,    ROT0, "Bootleg",    "American Poker II (bootleg, set 2)", 0,                layout_ampoker )
1007GAMEL( 1994, ampkr2b3, ampoker2, ampoker2, ampoker2, 0,    ROT0, "Bootleg",    "American Poker II (bootleg, set 3)", 0,                layout_ampoker )
1008GAMEL( 1995, ampkr95,  ampoker2, ampoker2, ampkr95,  0,    ROT0, "Bootleg",    "American Poker 95",                  0,                layout_ampoker )
1009GAMEL( 1990, pkrdewin, ampoker2, ampoker2, ampoker2, 0,    ROT0, "Bootleg",    "Poker De Win",                       0,                layout_ampoker )
1010GAMEL( 1995, sigmapkr, 0,        ampoker2, sigmapkr, 0,    ROT0, "Sigma Inc.", "Sigma Poker",                        0,                layout_sigmapkr )
1011GAMEL( 1998, sigma2k,  0,        sigma2k,  sigmapkr, 0,    ROT0, "Sigma Inc.", "Sigma Poker 2000",                   GAME_NOT_WORKING, layout_sigmapkr )
src/mame/drivers/mpatrol.c
r1768r1769
1/***************************************************************************
2
3Moon Patrol memory map
4
5driver by Nicola Salmoria
6
70000-3fff ROM
88000-83ff Video RAM
98400-87ff Color RAM
10e000-e7ff RAM
11
12
13read:
148800      protection
15d000      IN0
16d001      IN1
17d002      IN2
18d003      DSW1
19d004      DSW2
20
21write:
22c800-c8ff sprites
23d000      sound command
24d001      flip screen
25
26I/O ports
27write:
2810-1f     scroll registers
2940        background #1 x position
3060        background #1 y position
3180        background #2 x position
32a0        background #2 y position
33c0        background control
34
35NOTE: It may be possible to remove the fake port now that conditional DIPS
36are supported. What should really be filled in for each mode?
37***************************************************************************/
38
39#include "driver.h"
40#include "audio/irem.h"
41#include "cpu/z80/z80.h"
42
43
44#define MASTER_CLOCK      XTAL_18_432MHz
45#define SOUND_CLOCK         XTAL_3_579545MHz
46
47
48
49READ8_HANDLER( mpatrol_protection_r );
50WRITE8_HANDLER( mpatrol_scroll_w );
51WRITE8_HANDLER( mpatrol_bg1xpos_w );
52WRITE8_HANDLER( mpatrol_bg1ypos_w );
53WRITE8_HANDLER( mpatrol_bg2xpos_w );
54WRITE8_HANDLER( mpatrol_bg2ypos_w );
55WRITE8_HANDLER( mpatrol_bgcontrol_w );
56WRITE8_HANDLER( mpatrol_flipscreen_w );
57WRITE8_HANDLER( mpatrol_videoram_w );
58WRITE8_HANDLER( mpatrol_colorram_w );
59
60PALETTE_INIT( mpatrol );
61VIDEO_START( mpatrol );
62VIDEO_UPDATE( mpatrol );
63
64
65
66static CUSTOM_INPUT( coin_mode )
67{
68   /* Based on the coin mode fill in the upper bits */
69   UINT8 port5 = readinputport(5);
70   return (readinputport(4) & 0x04) ? (port5 & 0x0f) : (port5 >> 4);
71}
72
73
74
75/*************************************
76 *
77 *  Memory maps
78 *
79 *************************************/
80
81static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
82   AM_RANGE(0x0000, 0x3fff) AM_ROM
83   AM_RANGE(0x8000, 0x83ff) AM_READWRITE(MRA8_RAM, mpatrol_videoram_w) AM_BASE(&videoram)
84   AM_RANGE(0x8400, 0x87ff) AM_READWRITE(MRA8_RAM, mpatrol_colorram_w) AM_BASE(&colorram)
85   AM_RANGE(0x8800, 0x8800) AM_MIRROR(0x07ff) AM_READ(mpatrol_protection_r)
86   AM_RANGE(0xc800, 0xcbff) AM_MIRROR(0x0400) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
87   AM_RANGE(0xd000, 0xd000) AM_MIRROR(0x07fc) AM_WRITE(irem_sound_cmd_w)
88   AM_RANGE(0xd001, 0xd001) AM_MIRROR(0x07fc) AM_WRITE(mpatrol_flipscreen_w)   /* + coin counters */
89   AM_RANGE(0xd000, 0xd000) AM_MIRROR(0x07f8) AM_READ_PORT("IN0")
90   AM_RANGE(0xd001, 0xd001) AM_MIRROR(0x07f8) AM_READ_PORT("IN1")
91   AM_RANGE(0xd002, 0xd002) AM_MIRROR(0x07f8) AM_READ_PORT("IN2")
92   AM_RANGE(0xd003, 0xd003) AM_MIRROR(0x07f8) AM_READ_PORT("DSW0")
93   AM_RANGE(0xd004, 0xd004) AM_MIRROR(0x07f8) AM_READ_PORT("DSW1")
94   AM_RANGE(0xe000, 0xe7ff) AM_RAM
95ADDRESS_MAP_END
96
97
98static ADDRESS_MAP_START( alpha1v_map, ADDRESS_SPACE_PROGRAM, 8 )
99   AM_RANGE(0x0000, 0x6fff) AM_ROM
100   AM_RANGE(0x8000, 0x83ff) AM_READWRITE(MRA8_RAM, mpatrol_videoram_w) AM_BASE(&videoram)
101   AM_RANGE(0x8400, 0x87ff) AM_READWRITE(MRA8_RAM, mpatrol_colorram_w) AM_BASE(&colorram)
102   AM_RANGE(0xc800, 0xc9ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) AM_SHARE(1) // bigger or mirrored?
103   AM_RANGE(0xd000, 0xd000) AM_READ_PORT("IN0") AM_WRITE(irem_sound_cmd_w)
104   AM_RANGE(0xd001, 0xd001) AM_READ_PORT("IN1") AM_WRITE(mpatrol_flipscreen_w)   /* + coin counters */
105   AM_RANGE(0xd002, 0xd002) AM_READ_PORT("IN2")
106   AM_RANGE(0xd003, 0xd003) AM_READ_PORT("DSW0")
107   AM_RANGE(0xd004, 0xd004) AM_READ_PORT("DSW1")
108   AM_RANGE(0xe000, 0xefff) AM_RAM // bigger or mirrored?
109ADDRESS_MAP_END
110
111
112static ADDRESS_MAP_START( main_portmap, ADDRESS_SPACE_IO, 8 )
113   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
114   AM_RANGE(0x00, 0x00) AM_MIRROR(0x1f) AM_WRITE(mpatrol_scroll_w)
115   AM_RANGE(0x40, 0x40) AM_MIRROR(0x1f) AM_WRITE(mpatrol_bg1xpos_w)
116   AM_RANGE(0x60, 0x60) AM_MIRROR(0x1f) AM_WRITE(mpatrol_bg1ypos_w)
117   AM_RANGE(0x80, 0x80) AM_MIRROR(0x1f) AM_WRITE(mpatrol_bg2xpos_w)
118   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1f) AM_WRITE(mpatrol_bg2ypos_w)
119   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_WRITE(mpatrol_bgcontrol_w)
120ADDRESS_MAP_END
121
122
123
124/*************************************
125 *
126 *  Port definitions
127 *
128 *************************************/
129
130static INPUT_PORTS_START( mpatrol )
131   PORT_START_TAG("IN0")
132   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
133   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
134   /* coin input must be active for ? frames to be consistently recognized */
135   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(17)
136   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
137   PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN )
138
139   PORT_START_TAG("IN1")
140   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY
141   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY
142   PORT_BIT( 0x1c, IP_ACTIVE_LOW, IPT_UNKNOWN )
143   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
144   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
145   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
146
147   PORT_START_TAG("IN2")
148   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL
149   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL
150   PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNKNOWN )
151   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 )
152   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
153   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
154   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
155
156   PORT_START_TAG("DSW0")
157   PORT_DIPNAME( 0x03, 0x02, DEF_STR( Lives ) )
158   PORT_DIPSETTING(    0x00, "1" )
159   PORT_DIPSETTING(    0x01, "2" )
160   PORT_DIPSETTING(    0x02, "3" )
161   PORT_DIPSETTING(    0x03, "5" )
162   PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Bonus_Life ) )
163   PORT_DIPSETTING(    0x0c, "10000 30000 50000" )
164   PORT_DIPSETTING(    0x08, "20000 40000 60000" )
165   PORT_DIPSETTING(    0x04, "10000" )
166   PORT_DIPSETTING(    0x00, DEF_STR( None ) )
167   PORT_BIT( 0xf0, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(coin_mode, NULL)
168       /* Gets filled in based on the coin mode */
169
170   PORT_START_TAG("DSW1")
171   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
172   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
173   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
174   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
175   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
176   PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
177   PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
178   PORT_DIPSETTING(    0x04, "Mode 1" )
179   PORT_DIPSETTING(    0x00, "Mode 2" )
180   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
181   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
182   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
183   /* In stop mode, press 2 to stop and 1 to restart */
184   PORT_DIPNAME( 0x10, 0x10, "Stop Mode (Cheat)")
185   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
186   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
187   PORT_DIPNAME( 0x20, 0x20, "Sector Selection (Cheat)")
188   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
189   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
190   PORT_DIPNAME( 0x40, 0x40, "Invulnerability (Cheat)")
191   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
192   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
193   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
194
195   /* Fake port to support the two different coin modes */
196   PORT_START_TAG("FAKE")
197   PORT_DIPNAME( 0x0f, 0x0f, "Coinage Mode 1" )   /* mapped on coin mode 1 */
198   PORT_DIPSETTING(    0x09, DEF_STR( 7C_1C ) )
199   PORT_DIPSETTING(    0x0a, DEF_STR( 6C_1C ) )
200   PORT_DIPSETTING(    0x0b, DEF_STR( 5C_1C ) )
201   PORT_DIPSETTING(    0x0c, DEF_STR( 4C_1C ) )
202   PORT_DIPSETTING(    0x0d, DEF_STR( 3C_1C ) )
203   PORT_DIPSETTING(    0x0e, DEF_STR( 2C_1C ) )
204   PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
205   PORT_DIPSETTING(    0x07, DEF_STR( 1C_2C ) )
206   PORT_DIPSETTING(    0x06, DEF_STR( 1C_3C ) )
207   PORT_DIPSETTING(    0x05, DEF_STR( 1C_4C ) )
208   PORT_DIPSETTING(    0x04, DEF_STR( 1C_5C ) )
209   PORT_DIPSETTING(    0x03, DEF_STR( 1C_6C ) )
210   PORT_DIPSETTING(    0x02, DEF_STR( 1C_7C ) )
211   PORT_DIPSETTING(    0x01, DEF_STR( 1C_8C ) )
212   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
213    PORT_DIPNAME( 0x30, 0x30, "Coin A  Mode 2" )   /* mapped on coin mode 2 */
214   PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )
215   PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
216   PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
217   PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
218   PORT_DIPNAME( 0xc0, 0xc0, "Coin B  Mode 2" )
219   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )
220   PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
221   PORT_DIPSETTING(    0x40, DEF_STR( 1C_5C ) )
222   PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )
223INPUT_PORTS_END
224
225
226static INPUT_PORTS_START( mpatrolw )
227   PORT_INCLUDE(mpatrol)
228
229   PORT_MODIFY("DSW0")
230   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) )
231   PORT_DIPSETTING(    0x00, "2" )
232   PORT_DIPSETTING(    0x01, "3" )
233   PORT_DIPSETTING(    0x02, "4" )
234   PORT_DIPSETTING(    0x03, "5" )
235INPUT_PORTS_END
236
237
238static INPUT_PORTS_START( alpha1v )
239   PORT_INCLUDE(mpatrol)
240
241   PORT_MODIFY("IN1")
242   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
243   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
244   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
245   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
246   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
247
248   PORT_MODIFY("IN2")
249   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
250   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL
251   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_COCKTAIL
252   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_COCKTAIL
253
254   PORT_MODIFY("DSW0")
255   PORT_DIPNAME( 0x03, 0x01, DEF_STR( Lives ) )
256   PORT_DIPSETTING(    0x00, "2" )
257   PORT_DIPSETTING(    0x01, "3" )
258   PORT_DIPSETTING(    0x02, "4" )
259   PORT_DIPSETTING(    0x03, "5" )
260INPUT_PORTS_END
261
262
263
264/*************************************
265 *
266 *  Graphics layouts
267 *
268 *************************************/
269
270static const gfx_layout charlayout =
271{
272   8,8,
273   RGN_FRAC(1,2),
274   2,
275   { RGN_FRAC(0,2), RGN_FRAC(1,2) },
276   { STEP8(0,1) },
277   { STEP8(0,8) },
278   8*8
279};
280
281static const gfx_layout spritelayout =
282{
283   16,16,
284   RGN_FRAC(1,2),
285   2,
286   { RGN_FRAC(0,2), RGN_FRAC(1,2) },
287   { STEP8(0,1), STEP8(16*8,1) },
288   { STEP16(0,8) },
289   32*8
290};
291
292static const UINT32 bgcharlayout_xoffset[256] =
293{
294   STEP4(0x000,1), STEP4(0x008,1), STEP4(0x010,1), STEP4(0x018,1),
295   STEP4(0x020,1), STEP4(0x028,1), STEP4(0x030,1), STEP4(0x038,1),
296   STEP4(0x040,1), STEP4(0x048,1), STEP4(0x050,1), STEP4(0x058,1),
297   STEP4(0x060,1), STEP4(0x068,1), STEP4(0x070,1), STEP4(0x078,1),
298   STEP4(0x080,1), STEP4(0x088,1), STEP4(0x090,1), STEP4(0x098,1),
299   STEP4(0x0a0,1), STEP4(0x0a8,1), STEP4(0x0b0,1), STEP4(0x0b8,1),
300   STEP4(0x0c0,1), STEP4(0x0c8,1), STEP4(0x0d0,1), STEP4(0x0d8,1),
301   STEP4(0x0e0,1), STEP4(0x0e8,1), STEP4(0x0f0,1), STEP4(0x0f8,1),
302   STEP4(0x100,1), STEP4(0x108,1), STEP4(0x110,1), STEP4(0x118,1),
303   STEP4(0x120,1), STEP4(0x128,1), STEP4(0x130,1), STEP4(0x138,1),
304   STEP4(0x140,1), STEP4(0x148,1), STEP4(0x150,1), STEP4(0x158,1),
305   STEP4(0x160,1), STEP4(0x168,1), STEP4(0x170,1), STEP4(0x178,1),
306   STEP4(0x180,1), STEP4(0x188,1), STEP4(0x190,1), STEP4(0x198,1),
307   STEP4(0x1a0,1), STEP4(0x1a8,1), STEP4(0x1b0,1), STEP4(0x1b8,1),
308   STEP4(0x1c0,1), STEP4(0x1c8,1), STEP4(0x1d0,1), STEP4(0x1d8,1),
309   STEP4(0x1e0,1), STEP4(0x1e8,1), STEP4(0x1f0,1), STEP4(0x1f8,1)
310};
311
312static const UINT32 bgcharlayout_yoffset[64] =
313{
314   STEP32(0x0000,0x200), STEP32(0x4000,0x200)
315};
316
317static const gfx_layout bgcharlayout =
318{
319   256, 64, /* 256x64 image format */
320   1,       /* 1 image */
321   2,       /* 2 bits per pixel */
322   { 4, 0 },       /* the two bitplanes for 4 pixels are packed into one byte */
323   EXTENDED_XOFFS,
324   EXTENDED_YOFFS,
325   0x8000,
326   bgcharlayout_xoffset,
327   bgcharlayout_yoffset
328};
329
330
331static GFXDECODE_START( mpatrol )
332   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout,                0, 128 )
333   GFXDECODE_ENTRY( REGION_GFX2, 0x0000, spritelayout,          128*4,  16 )
334   GFXDECODE_ENTRY( REGION_GFX3, 0x0000, bgcharlayout, 128*4+16*4+0*4,   1 )
335   GFXDECODE_ENTRY( REGION_GFX4, 0x0000, bgcharlayout, 128*4+16*4+1*4,   1 )
336   GFXDECODE_ENTRY( REGION_GFX5, 0x0000, bgcharlayout, 128*4+16*4+2*4,   1 )
337GFXDECODE_END
338
339
340
341/*************************************
342 *
343 *  Machine drivers
344 *
345 *************************************/
346
347static MACHINE_DRIVER_START( mpatrol )
348
349   /* basic machine hardware */
350   MDRV_CPU_ADD_TAG("main", Z80, MASTER_CLOCK/6)
351   MDRV_CPU_PROGRAM_MAP(main_map,0)
352   MDRV_CPU_IO_MAP(main_portmap,0)
353   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
354
355   /* video hardware */
356   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
357   MDRV_GFXDECODE(mpatrol)
358   MDRV_PALETTE_LENGTH(512+32+32)
359   MDRV_COLORTABLE_LENGTH(128*4+16*4+3*4)
360
361   MDRV_SCREEN_ADD("main", 0)
362   MDRV_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 136, 376, 282, 22, 274)
363   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
364
365   MDRV_PALETTE_INIT(mpatrol)
366   MDRV_VIDEO_START(mpatrol)
367   MDRV_VIDEO_UPDATE(mpatrol)
368
369   /* sound hardware */
370   MDRV_IMPORT_FROM(irem_audio)
371MACHINE_DRIVER_END
372
373
374static MACHINE_DRIVER_START( alpha1v )
375   MDRV_IMPORT_FROM(mpatrol)
376
377   /* basic machine hardware */
378   MDRV_CPU_MODIFY("main")
379   MDRV_CPU_PROGRAM_MAP(alpha1v_map,0)
380MACHINE_DRIVER_END
381
382
383
384/*************************************
385 *
386 *  ROM definitions
387 *
388 *************************************/
389
390ROM_START( mpatrol )
391   ROM_REGION( 0x10000, REGION_CPU1, 0 )
392   ROM_LOAD( "mpa-1.3m",      0x0000, 0x1000, CRC(5873a860) SHA1(8c03726d6e049c3edbc277440184e31679f78258) )
393   ROM_LOAD( "mpa-2.3l",      0x1000, 0x1000, CRC(f4b85974) SHA1(dfb2efb57378a20af6f20569f4360cde95596f93) )
394   ROM_LOAD( "mpa-3.3k",      0x2000, 0x1000, CRC(2e1a598c) SHA1(112c3c9678db8a8540a8df3708020c87fd10c91b) )
395   ROM_LOAD( "mpa-4.3j",      0x3000, 0x1000, CRC(dd05b587) SHA1(727961b0dafa4a96b580d51013336db2a18aff1e) )
396
397   ROM_REGION( 0x10000, REGION_CPU2, 0 )
398   ROM_LOAD( "mp-s1.1a",     0xf000, 0x1000, CRC(561d3108) SHA1(4998c68a9e9a8002251fa8f07aa1082444a9dc80) )
399
400   ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE )
401   ROM_LOAD( "mpe-5.3e",     0x0000, 0x1000, CRC(e3ee7f75) SHA1(b03d0d56150d3e9da4a4c871338097b4f450b649) )       /* chars */
402   ROM_LOAD( "mpe-4.3f",     0x1000, 0x1000, CRC(cca6d023) SHA1(fecb3059fb09897a096add9452b50aec55c07545) )
403
404   ROM_REGION( 0x2000, REGION_GFX2, ROMREGION_DISPOSE )
405   ROM_LOAD( "mpb-2.3m",     0x0000, 0x1000, CRC(707ace5e) SHA1(93c682e13e74bce29ced3a87bffb29569c114c3b) )       /* sprites */
406   ROM_LOAD( "mpb-1.3n",     0x1000, 0x1000, CRC(9b72133a) SHA1(1393ef92ae1ad58a4b62ca1660c0793d30a8b5e2) )
407
408   ROM_REGION( 0x1000, REGION_GFX3, ROMREGION_DISPOSE )
409   ROM_LOAD( "mpe-1.3l",     0x0000, 0x1000, CRC(c46a7f72) SHA1(8bb7c9acaf6833fb6c0575b015991b873a305a84) )       /* background graphics */
410
411   ROM_REGION( 0x1000, REGION_GFX4, ROMREGION_DISPOSE )
412   ROM_LOAD( "mpe-2.3k",     0x0000, 0x1000, CRC(c7aa1fb0) SHA1(14c6c76e1d0db2c0745e5d6d33ea6945fac8e9ee) )
413
414   ROM_REGION( 0x1000, REGION_GFX5, ROMREGION_DISPOSE )
415   ROM_LOAD( "mpe-3.3h",     0x0000, 0x1000, CRC(a0919392) SHA1(8a090cb8d483a3d67c7360058e3fdd70e151cd62) )
416
417   ROM_REGION( 0x0340, REGION_PROMS, 0 )
418   ROM_LOAD( "mpc-4.2a",     0x0000, 0x0200, CRC(07f99284) SHA1(dfc52958f2520e1ce4446dd4c84c91413bbacf76) )
419   ROM_LOAD( "mpc-3.1m",     0x0200, 0x0020, CRC(6a57eff2) SHA1(2d1c12dab5915da2ccd466e39436c88be434d634) ) /* background palette */
420   ROM_LOAD( "mpc-1.1f",     0x0220, 0x0020, CRC(26979b13) SHA1(8c41a8cce4f3384c392a9f7a223a50d7be0e14a5) ) /* sprite palette */
421   ROM_LOAD( "mpc-2.2h",     0x0240, 0x0100, CRC(7ae4cd97) SHA1(bc0662fac82ffe65f02092d912b2c2b0c7a8ac2b) ) /* sprite lookup table */
422ROM_END
423
424ROM_START( mpatrolw )
425   ROM_REGION( 0x10000, REGION_CPU1, 0 )
426   ROM_LOAD( "mpa-1w.3m",    0x0000, 0x1000, CRC(baa1a1d4) SHA1(7968a7f221e7f4c9c81ddc8de17f6568e17b9ea8) )
427   ROM_LOAD( "mpa-2w.3l",    0x1000, 0x1000, CRC(52459e51) SHA1(ae685b7848baa1b87a3f2bce97356286171e16d4) )
428   ROM_LOAD( "mpa-3w.3k",    0x2000, 0x1000, CRC(9b249fe5) SHA1(c01e0d572c4c163f3cf4b2aa9f4246427811b78d) )
429   ROM_LOAD( "mpa-4w.3j",    0x3000, 0x1000, CRC(fee76972) SHA1(c3166b027f89f61964ead804d3c2da387454c4c2) )
430
431   ROM_REGION( 0x10000, REGION_CPU2, 0 )
432   ROM_LOAD( "mp-s1.1a",     0xf000, 0x1000, CRC(561d3108) SHA1(4998c68a9e9a8002251fa8f07aa1082444a9dc80) )
433
434   ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE )
435   ROM_LOAD( "mpe-5w.3e",    0x0000, 0x1000, CRC(f56e01fe) SHA1(93f582d63b9cd5c6dca207aa57b213c939cdda1d) )       /* chars */
436   ROM_LOAD( "mpe-4w.3f",    0x1000, 0x1000, CRC(caaba2d9) SHA1(7016a26c2d01e3209749598e993cd8ce91f12c88) )
437
438   ROM_REGION( 0x2000, REGION_GFX2, ROMREGION_DISPOSE )
439   ROM_LOAD( "mpb-2.3m",     0x0000, 0x1000, CRC(707ace5e) SHA1(93c682e13e74bce29ced3a87bffb29569c114c3b) )       /* sprites */
440   ROM_LOAD( "mpb-1.3n",     0x1000, 0x1000, CRC(9b72133a) SHA1(1393ef92ae1ad58a4b62ca1660c0793d30a8b5e2) )
441
442   ROM_REGION( 0x1000, REGION_GFX3, ROMREGION_DISPOSE )
443   ROM_LOAD( "mpe-1.3l",     0x0000, 0x1000, CRC(c46a7f72) SHA1(8bb7c9acaf6833fb6c0575b015991b873a305a84) )       /* background graphics */
444
445   ROM_REGION( 0x1000, REGION_GFX4, ROMREGION_DISPOSE )
446   ROM_LOAD( "mpe-2.3k",     0x0000, 0x1000, CRC(c7aa1fb0) SHA1(14c6c76e1d0db2c0745e5d6d33ea6945fac8e9ee) )
447
448   ROM_REGION( 0x1000, REGION_GFX5, ROMREGION_DISPOSE )
449   ROM_LOAD( "mpe-3.3h",     0x0000, 0x1000, CRC(a0919392) SHA1(8a090cb8d483a3d67c7360058e3fdd70e151cd62) )
450
451   ROM_REGION( 0x0340, REGION_PROMS, 0 )
452   ROM_LOAD( "mpc-4a.2a",    0x0000, 0x0200, CRC(cb0a5ff3) SHA1(d3f88b4e0c4858abac8b52105656ecece0cf4df9) )
453   ROM_LOAD( "mpc-3.1m",     0x0200, 0x0020, CRC(6a57eff2) SHA1(2d1c12dab5915da2ccd466e39436c88be434d634) ) /* background palette */
454   ROM_LOAD( "mpc-1.1f",     0x0220, 0x0020, CRC(26979b13) SHA1(8c41a8cce4f3384c392a9f7a223a50d7be0e14a5) ) /* sprite palette */
455   ROM_LOAD( "mpc-2.2h",     0x0240, 0x0100, CRC(7ae4cd97) SHA1(bc0662fac82ffe65f02092d912b2c2b0c7a8ac2b) ) /* sprite lookup table */
456ROM_END
457
458
459ROM_START( alpha1v )
460   ROM_REGION( 0x10000, REGION_CPU1, 0 )
461   ROM_LOAD( "2-m3",      0x0000, 0x1000, CRC(3a679d34) SHA1(1a54a43070c56dc91d4d258f29e29613bb309f1c) )
462   ROM_LOAD( "3-l3",      0x1000, 0x1000, CRC(2f09df64) SHA1(e91602e9e41ad24dd1d7f384ed81b9bdaadd03e1) )
463   ROM_LOAD( "4-k3",      0x2000, 0x1000, CRC(64fb9c8a) SHA1(735fd00cc42193a417e6cde75f12b4cf2e804942) )
464   ROM_LOAD( "5-j3",      0x3000, 0x1000, CRC(d1643d18) SHA1(7c794b82e17e2ba0a6237e3fc20d8314f6c2481c) )
465   ROM_LOAD( "6-h3",      0x4000, 0x1000, CRC(cf34ab51) SHA1(3696da71e2bc7edd1ee7aeaac87be5386608c09e) )
466   ROM_LOAD( "7-f3",      0x5000, 0x1000, CRC(99db9781) SHA1(a56a675cc4cbc9681bfe8052f51f19336eb2a0a6) )
467   ROM_LOAD( "7a e3",     0x6000, 0x1000, CRC(3b0b4b0d) SHA1(0d8eea1e2db269943611289b3490a578ee347f85) )
468
469   ROM_REGION( 0x10000, REGION_CPU2, 0 )
470   ROM_LOAD( "1-a1",      0xf000, 0x1000, CRC(9e07fdd5) SHA1(ed4f462fcfe91fa8e88bfeaaba0a0c11fa0b4601) )
471
472   ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE )
473   ROM_LOAD( "14-e3",     0x0000, 0x1000, CRC(cf00c737) SHA1(415e90289039cac4d04cb1d559f1378ca6a32132) )       /* chars */
474   ROM_LOAD( "13-f3",     0x1000, 0x1000, CRC(4b799229) SHA1(42cbdcf787b08b041d30504d699a12c378224933) )
475
476   ROM_REGION( 0x3000, REGION_GFX2, ROMREGION_DISPOSE ) // 3bpp? (mpatrol is 2bpp..)
477   ROM_LOAD( "15-n3",     0x0000, 0x1000, CRC(dc26df76) SHA1(dd1cff7935f5559f9d1b440e02d5e5aa521b0054) )
478   ROM_LOAD( "16-l3",     0x1000, 0x1000, CRC(39b9863b) SHA1(da9da9a1066188f050c422dfed1bbbd3ba612ccc) )
479   ROM_LOAD( "17-k3",     0x2000, 0x1000, CRC(cfd90773) SHA1(052e126888b6de636db9c521a090699c282b620b) )
480
481   /* all the background roms just contain stars.. */
482   ROM_REGION( 0x1000, REGION_GFX3, ROMREGION_DISPOSE )
483   ROM_LOAD( "11-k3",     0x0000, 0x1000, CRC(7659440a) SHA1(2efd27c82913513dd03e799f1ed3c10b0863677d) ) // these two match..
484   ROM_LOAD( "12-jh3",    0x0000, 0x1000, CRC(7659440a) SHA1(2efd27c82913513dd03e799f1ed3c10b0863677d) )
485
486   ROM_REGION( 0x1000, REGION_GFX4, ROMREGION_DISPOSE )
487   ROM_LOAD( "9-n3",     0x0000, 0x1000, CRC(0fdb7d13) SHA1(e828254a4f94df633d338b5772719276d41c6b7f) )
488
489   ROM_REGION( 0x1000, REGION_GFX5, ROMREGION_DISPOSE )
490   ROM_LOAD( "10-lm3",     0x0000, 0x1000, CRC(9dde3a75) SHA1(293d093485be19bfb20685d76a08ac78e24062bf) )
491
492   ROM_REGION( 0x0340, REGION_PROMS, 0 )
493   ROM_LOAD( "63s481-a2",     0x0000, 0x0200, CRC(58678ea8) SHA1(b13a78a5bca8ad5bdec1293512b53654768a7a7a) )
494   ROM_LOAD( "18s030-m1",     0x0200, 0x0020, CRC(6a57eff2) SHA1(2d1c12dab5915da2ccd466e39436c88be434d634) ) /* background palette */
495   ROM_LOAD( "mb7051-f1",     0x0220, 0x0020, CRC(d8bdd0df) SHA1(ca522428927911808214d319af314f601497ded4) ) /* sprite palette */
496   ROM_LOAD( "mb7052-h2",     0x0240, 0x0100, CRC(ce9f0ef9) SHA1(3afb94ed033f272983bbed22a59856df7824ef8a) ) /* sprite lookup table */
497ROM_END
498
499
500
501/*************************************
502 *
503 *  Game drivers
504 *
505 *************************************/
506
507GAME( 1982, mpatrol,  0,       mpatrol, mpatrol,  0, ROT0, "Irem", "Moon Patrol", GAME_SUPPORTS_SAVE )
508GAME( 1982, mpatrolw, mpatrol, mpatrol, mpatrolw, 0, ROT0, "Irem (Williams license)", "Moon Patrol (Williams)", GAME_SUPPORTS_SAVE )
509GAME( 1988, alpha1v,  0,       alpha1v, alpha1v,  0, ROT0, "Vision Electronics", "Alpha One (Vision Electronics / Kyle Hodgetts)", GAME_NOT_WORKING|GAME_NO_SOUND )
src/mame/drivers/skychut.c
r1768r1769
1/***************************************************************************
2
3  IPM Invader (M10 m10 hardware)
4  Sky Chuter By IREM
5  Space Beam (M15 m15 hardware)
6  Green Beret (?M15 ?m15 hardware)
7
8  (c) 12/2/1998 Lee Taylor
9
10Notes:
11- Colors are close to screen shots for IPM Invader. The other games have not
12  been verified.
13- The bitmap strips in IPM Invader might be slightly misplaced
14
15TODO:
16- Dip switches
17
18Head On
19-------
20Irem, 1979? / 1980?
21
22PCB Layout
23----------
24
25    M-15L
26   |---------------------------------------------------------------------------------|
27   |                                                                                 |
28   | DSW(8)  74175   74175   7400  74LS08   74121   M53214     |-------|      E1.9A  |
29   |                                                           | 6502  |             |
30   |          7432   74175   7404    7427    7442  74LS241     |-------|             |
31   |                                                                          E2.9B  |
32   |                                                                                 |
33   |        74LS74    7432  74161   74161    7442  74LS241  74LS367  74LS367         |
34 |-|                                                                          E3.9C  |
35 |          M53214 74LS367   7442    7486    8216     2114  74LS157  74LS367         |
36 |                                                                                   |
37 |4         M53214 74LS367  74161    7486    8216     2114  74LS157     2111  E4.9D  |
38 |4                                                                                  |
39 |W         M53214 74LS367  74161    7486    8216     2114  74LS157     2111         |
40 |A                                                                           E5.9F  |
41 |Y         M53214 74LS367  74161    7486    8216    74166     2114  74LS157         |
42 |                         11.73MHz                                                  |
43 |            7400    7432  7404    74161    8216    74166     2114  74LS157  E6.9G  |
44 |-|                                                                                 |
45   |   VR3 VR2 VR1    7432  7404     7400  *74173     7400  74LS139  74LS157         |
46   |                                       *74S04                                    |
47   |                                                                                 |
48   |---------------------------------------------------------------------------------|
49Notes:
50      All IC's are listed
51      All ROMs type 2708 (1K x8)
52
53      6502 clock: 1.173MHz
54               *: These 2 IC's piggybacked. 74S04 on top
55         VR1/2/3: 5K potentiometers
56            2114: 1K x4 SRAM
57            2111: 256bytes x4 SRAM
58            8216: 256bytes x1 SRAM
59
60Sound PCB
61---------
62
63M-15S
64|---------------------------|
65|                           |
66|  NE555  NE555             |
67|                           |
68|  NE555  NE555             |
69|               LM3900   VR1|
70|                           |
71|  c1815x9               VR2|
72|                           |
73|               LM3900   VR3|
74|                           |
75|                        VR4|
76|                           |
77|                        VR5|
78|    TA7222                 |
79|---------------------------|
80Notes:
81      PCB contains lots of resistors, capacitors, transistors etc.
82
83      VR1/2/3/4/5: Potentiometers for volume of each sound
84            C1815: Transistor (x9)
85           TA7222: Power Amp
86
87***************************************************************************/
88
89/***************************************************************************
90Notes (couriersud)
91
92    From http://www.crazykong.com/tech/IremBoardList.txt
93
94    skychut:        M-11
95    andromed:       N/A
96    ipminvad:       N/A
97    spacbeam:       not listed
98    headon:         not listed
99    greenber:       N/A
100
101    M10-Board: Has SN76477
102
103***************************************************************************/
104#include "driver.h"
105#include "deprecat.h"
106#include "sound/samples.h"
107
108#include "skychut.h"
109
110/*************************************
111 *
112 *  Defines
113 *
114 *************************************/
115
116#define DEBUG      (0)
117
118/*************************************
119 *
120 *  Initialization
121 *
122 *************************************/
123
124static PALETTE_INIT( skychut )
125{
126   int i;
127
128   palette_set_color(machine,0,MAKE_RGB(0xff,0xff,0xff));
129   palette_set_color(machine,1,MAKE_RGB(0xff,0xff,0x00));
130   palette_set_color(machine,2,MAKE_RGB(0xff,0x00,0xff));
131   palette_set_color(machine,3,MAKE_RGB(0xff,0x00,0x00));
132   palette_set_color(machine,4,MAKE_RGB(0x00,0xff,0xff));
133   palette_set_color(machine,5,MAKE_RGB(0x00,0xff,0x00));
134   palette_set_color(machine,6,MAKE_RGB(0x00,0x00,0xff));
135   palette_set_color(machine,7,MAKE_RGB(0x00,0x00,0x00));
136
137   for (i = 0;i < 8;i++)
138   {
139      colortable[2*i+0] = 7;
140      colortable[2*i+1] = i;
141   }
142}
143
144static MACHINE_RESET( irem )
145{
146   irem_state *state = Machine->driver_data;
147
148   state_save_register_global(state->bottomline);
149   state_save_register_global(state->flip);
150}
151
152/*************************************
153 *
154 *  I/O handling
155 *
156 *************************************/
157
158/*
159 * M10 Ctrl Port
160 *
161 * 76543210
162 * ========
163 * e-------     ACTIVE LOW  Demo mode
164 * -?------     ????
165 * --b-----     ACTIVE LOW  Bottom line
166 * ---f----     ACTIVE LOW  Flip screen
167 * ----u---     ACTIVE LOW  Ufo sound enable (SN76477)
168 * -----sss     Sound #sss start
169 *              0x01: MISSILE
170 *              0x02: EXPLOSION
171 *              0x03: INVADER HIT
172 *              0x04: BONUS BASE
173 *              0x05: FLEET MOVE
174 *              0x06: SAUCER HIT
175 */
176
177static WRITE8_HANDLER( iremm10_ctrl_w )
178{
179   irem_state *state = Machine->driver_data;
180
181#if DEBUG
182   if (data & 0x40)
183      popmessage("ctrl: %02x",data);
184#endif
185
186   /* I have NO IDEA if this is correct or not */
187   state->bottomline = ~data & 0x20;
188
189   if (readinputportbytag("CAB") & 0x01)
190      state->flip = ~data & 0x10;
191
192   if (!(readinputportbytag("CAB") & 0x02))
193      sound_global_enable(~data & 0x80);
194
195   /* sound command in lower 4 bytes */
196   switch (data & 0x07)
197   {
198      case 0x00:
199         /* no sound mapped */
200         break;
201      case 0x01:
202         /* MISSILE sound */
203         sample_start_n(0, 0, 0, 0);
204         break;
205      case 0x02:
206         /* EXPLOSION sound */
207         sample_start_n(0, 1, 1, 0);
208         break;
209      case 0x03:
210         /* INVADER HIT sound */
211         sample_start_n(0, 2, 2, 0);
212         break;
213      case 0x04:
214         /* BONUS BASE sound */
215         sample_start_n(0, 3, 8, 0);
216         break;
217      case 0x05:
218         /* FLEET MOVE sound */
219         sample_start_n(0, 3, 3, 0);
220         break;
221      case 0x06:
222         /* SAUCER HIT SOUND */
223         sample_start_n(0, 2, 7, 0);
224         break;
225      default:
226         popmessage("Unknown sound M10: %02x\n", data & 0x07);
227         break;
228   }
229   /* UFO SOUND */
230   if (data & 0x08)
231      sample_stop_n(0, 4);
232   else
233      sample_start_n(0, 4, 9, 1);
234
235}
236
237/*
238 * M11 Ctrl Port
239 *
240 * 76543210
241 * ========
242 * e-------     ACTIVE LOW  Demo mode
243 * -?------     ????
244 * --b-----     ACTIVE LOW  Bottom line
245 * ---f----     ACTIVE LOW  Flip screen
246 * ----??--     ????
247 * ------cc     Credits indicator ?
248 *              0x03: 0 Credits
249 *              0x02: 1 Credit
250 *              0x00: 2 or more credits
251 *              Will be updated only in attract mode
252 */
253
254static WRITE8_HANDLER( iremm11_ctrl_w )
255{
256   irem_state *state = Machine->driver_data;
257
258#if DEBUG
259   if (data & 0x4C)
260      popmessage("M11 ctrl: %02x",data);
261#endif
262
263   state->bottomline = ~data & 0x20;
264
265   if (readinputportbytag("CAB") & 0x01)
266      state->flip = ~data & 0x10;
267
268   if (!(readinputportbytag("CAB") & 0x02))
269      sound_global_enable(~data & 0x80);
270}
271
272/*
273 * M15 Ctrl Port
274 *
275 * 76543210
276 * ========
277 * ????----     ????
278 * ----e---     ACTIVE LOW  Demo mode
279 * -----f--     ACTIVE LOW  Flip screen
280 * ------cc     Credits indicator ?
281 *              0x03: 0 Credits
282 *              0x02: 1 Credit
283 *              0x00: 2 or more credits
284 *              Will be updated only in attract mode
285 */
286
287static WRITE8_HANDLER( iremm15_ctrl_w )
288{
289   irem_state *state = Machine->driver_data;
290
291#if DEBUG
292   if (data & 0xF0)
293      popmessage("M15 ctrl: %02x",data);
294#endif
295   if (readinputportbytag("CAB") & 0x01)
296      state->flip = ~data & 0x04;
297   if (!(readinputportbytag("CAB") & 0x02))
298      sound_global_enable(~data & 0x08);
299}
300
301
302/*
303 * M10 A500
304 *
305 * 76543210
306 * ========
307 * ??????--     Always 111111
308 * ------cc     Credits indicator ?
309 *              0x03: 0 Credits
310 *              0x02: 1 Credit
311 *              0x00: 2 or more credits
312 *              Will be updated only in attract mode
313 */
314
315static WRITE8_HANDLER( iremm10_a500_w )
316{
317#if DEBUG
318   if (data & 0xFC)
319      popmessage("a500: %02x",data);
320#endif
321}
322
323static WRITE8_HANDLER( iremm11_a100_w )
324{
325   static int last = 0x00;
326   int raising_bits = data & ~last;
327   //int falling_bits = ~data & last;
328
329   // should a falling bit stop a sample?
330   // This port is written to about 20x per vblank
331#if DEBUG
332   if ((last & 0xE8) != (data & 0xE8))
333      popmessage("A100: %02x\n", data);
334#endif
335   last = data;
336   // audio control!
337   /* MISSILE sound */
338   if (raising_bits & 0x01)
339      sample_start_n(0, 0, 0, 0);
340
341   /* EXPLOSION sound */
342   if (raising_bits & 0x02)
343      sample_start_n(0, 1, 1, 0);
344
345   /* Rapidly falling parachute */
346   if (raising_bits & 0x04)
347      sample_start_n(0, 3, 8, 0);
348
349   /* Background sound ? */
350   if (data & 0x10)
351      sample_start_n(0, 4, 9, 1);
352   else
353      sample_stop_n(0, 4);
354
355}
356
357static WRITE8_HANDLER( iremm15_a100_w )
358{
359   static int last = 0x00;
360   //int raising_bits = data & ~last;
361   int falling_bits = ~data & last;
362
363   // should a falling bit stop a sample?
364   // Bit 4 is used
365   // Bit 5 is used 0xef
366   // Bit 7 is used
367
368   // headoni
369   // 0x01: Acceleration
370   // 0x04: background (motor) ?
371   // 0x08: explosion
372   // 0x10: player changes lane
373   // 0x20: computer car changes lane
374   // 0x40: dot
375
376#if DEBUG
377   if ((last & 0x82) != (data & 0x82))
378      popmessage("A100: %02x\n", data);
379#endif
380   /* DOT sound */
381   if (falling_bits & 0x40)
382      sample_start_n(0, 0, 0, 0);
383#if 0
384   if (raising_bits & 0x40)
385      sample_stop_n(0, 0);
386#endif
387
388   /* EXPLOSION sound */
389   if (falling_bits & 0x08)
390      sample_start_n(0, 1, 1, 0);
391#if 0
392   if (raising_bits & 0x08)
393      sample_stop_n(0, 1);
394#endif
395
396   /* player changes lane */
397   if (falling_bits & 0x10)
398      sample_start_n(0, 3, 3, 0);
399#if 0
400   if (raising_bits & 0x10)
401      sample_stop_n(0, 3);
402#endif
403
404   /* computer car changes lane */
405   if (falling_bits & 0x20)
406      sample_start_n(0, 4, 4, 0);
407#if 0
408   if (raising_bits & 0x20)
409      sample_stop_n(0, 4);
410#endif
411
412   last = data;
413}
414
415static READ8_HANDLER( iremm10_a700_r )
416{
417      //printf("rd:%d\n",video_screen_get_vpos(0));
418   cpunum_set_input_line(Machine, 0, 0, CLEAR_LINE);
419   return 0x00;
420}
421
422static READ8_HANDLER( iremm11_a700_r )
423{
424      //printf("rd:%d\n",video_screen_get_vpos(0));
425   return 0x00;
426}
427
428/*************************************
429 *
430 *  Interrupt handling
431 *
432 *************************************/
433
434static TIMER_CALLBACK( skychut_callback )
435{
436    if (param==0)
437    {
438       cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
439       timer_set(video_screen_get_time_until_pos(0, IREMM10_VBSTART+16, 0), NULL, 1,skychut_callback);
440    }
441    if (param==1)
442    {
443       cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
444       timer_set(video_screen_get_time_until_pos(0, IREMM10_VBSTART+24, 0), NULL, 2,skychut_callback);
445    }
446    if (param==-1)
447       cpunum_set_input_line(machine, 0, 0, CLEAR_LINE);
448
449}
450
451static INTERRUPT_GEN( iremm11_interrupt )
452{
453   if (readinputport(2) & 1)   /* Left Coin */
454        cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
455    else
456    {
457       cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
458       timer_set(video_screen_get_time_until_pos(0, IREMM10_VBEND, 0), NULL, -1,skychut_callback);
459    }
460}
461
462static INTERRUPT_GEN( iremm10_interrupt )
463{
464   if (readinputport(2) & 1)   /* Left Coin */
465        cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
466    else
467      cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
468}
469
470static INTERRUPT_GEN( iremm15_interrupt )
471{
472   if (readinputport(2) & 1)   /* Left Coin */
473        cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE);
474    else
475    {
476      cpunum_set_input_line(machine, 0, 0, ASSERT_LINE);
477       timer_set(video_screen_get_time_until_pos(0, IREMM10_VBSTART+1, 80), NULL, -1,skychut_callback);
478    }
479}
480
481/*************************************
482 *
483 *  Main CPU memory handlers
484 *
485 *************************************/
486
487static ADDRESS_MAP_START( iremm10_main, ADDRESS_SPACE_PROGRAM, 8 )
488   AM_RANGE(0x0000, 0x02ff) AM_RAM AM_BASE_MEMBER(irem_state, memory) /* scratch ram */
489   AM_RANGE(0x1000, 0x2fff) AM_READ(MRA8_ROM) AM_BASE_MEMBER(irem_state, rom)
490   AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size)
491   AM_RANGE(0x4800, 0x4bff) AM_READWRITE(MRA8_RAM, skychut_colorram_w) AM_BASE(&colorram) /* foreground colour  */
492   AM_RANGE(0x5000, 0x53ff) AM_RAM AM_BASE_MEMBER(irem_state, chargen) /* background ????? */
493   AM_RANGE(0xa200, 0xa200) AM_READ(input_port_1_r)
494   AM_RANGE(0xa300, 0xa300) AM_READ(input_port_0_r)
495   AM_RANGE(0xa400, 0xa400) AM_WRITE(iremm10_ctrl_w)   /* line at bottom of screen?, sound, flip screen */
496   AM_RANGE(0xa500, 0xa500) AM_WRITE(iremm10_a500_w)   /* ??? */
497   AM_RANGE(0xa700, 0xa700) AM_READ(iremm10_a700_r)
498   AM_RANGE(0xfc00, 0xffff) AM_READ(MRA8_ROM)   /* for the reset / interrupt vectors */
499ADDRESS_MAP_END
500
501static ADDRESS_MAP_START( iremm11_main, ADDRESS_SPACE_PROGRAM, 8 )
502   AM_RANGE(0x0000, 0x02ff) AM_RAM AM_BASE_MEMBER(irem_state, memory) /* scratch ram */
503   AM_RANGE(0x1000, 0x2fff) AM_READ(MRA8_ROM) AM_BASE_MEMBER(irem_state, rom)
504   AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size)
505   AM_RANGE(0x4800, 0x4bff) AM_READWRITE(MRA8_RAM, skychut_colorram_w) AM_BASE(&colorram) /* foreground colour  */
506   AM_RANGE(0x5000, 0x53ff) AM_RAM AM_BASE_MEMBER(irem_state, chargen) /* background ????? */
507   AM_RANGE(0xa100, 0xa100) AM_WRITE(iremm11_a100_w) /* sound writes ???? */
508   AM_RANGE(0xa200, 0xa200) AM_READ(input_port_1_r)
509   AM_RANGE(0xa300, 0xa300) AM_READ(input_port_0_r)
510   AM_RANGE(0xa400, 0xa400) AM_WRITE(iremm11_ctrl_w)   /* line at bottom of screen?, sound, flip screen */
511   AM_RANGE(0xa700, 0xa700) AM_READ(iremm11_a700_r)
512   AM_RANGE(0xfc00, 0xffff) AM_READ(MRA8_ROM)   /* for the reset / interrupt vectors */
513ADDRESS_MAP_END
514
515static ADDRESS_MAP_START( iremm15_main, ADDRESS_SPACE_PROGRAM, 8 )
516   AM_RANGE(0x0000, 0x02ff) AM_RAM AM_BASE_MEMBER(irem_state, memory) /* scratch ram */
517   AM_RANGE(0x1000, 0x33ff) AM_READ(MRA8_ROM) AM_BASE_MEMBER(irem_state, rom)
518   AM_RANGE(0x4000, 0x43ff) AM_RAM AM_BASE(&videoram) AM_SIZE(&videoram_size)
519   AM_RANGE(0x4800, 0x4bff) AM_READWRITE(MRA8_RAM, skychut_colorram_w) AM_BASE(&colorram) /* foreground colour  */
520   AM_RANGE(0x5000, 0x57ff) AM_READWRITE(MRA8_RAM, iremm15_chargen_w) AM_BASE_MEMBER(irem_state, chargen) /* background ????? */
521   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_3_r)
522   AM_RANGE(0xa100, 0xa100) AM_WRITE(iremm15_a100_w) /* sound writes ???? */
523   AM_RANGE(0xa200, 0xa200) AM_READ(input_port_1_r)
524   AM_RANGE(0xa300, 0xa300) AM_READ(input_port_0_r)
525   AM_RANGE(0xa400, 0xa400) AM_WRITE(iremm15_ctrl_w)   /* sound, flip screen */
526   AM_RANGE(0xfc00, 0xffff) AM_READ(MRA8_ROM)   /* for the reset / interrupt vectors */
527ADDRESS_MAP_END
528
529/*************************************
530 *
531 *  Port definitions
532 *
533 *************************************/
534
535#define CAB_PORTENV \
536   /* fake port for cabinet type */               \
537   PORT_START_TAG("CAB")                        \
538   PORT_CONFNAME( 0x01, 0x00, DEF_STR( Cabinet ) )      \
539   PORT_CONFSETTING(    0x00, DEF_STR( Upright ) )      \
540   PORT_CONFSETTING(    0x01, DEF_STR( Cocktail ) )   \
541   PORT_CONFNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )      \
542   PORT_CONFSETTING(    0x00, DEF_STR( Off ) )      \
543   PORT_CONFSETTING(    0x02, DEF_STR( On ) )   \
544   PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNUSED )
545
546
547static INPUT_PORTS_START( skychut )
548   PORT_START
549   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
550   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
551   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 )
552   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_COCKTAIL
553   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
554   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
555   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
556   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL
557
558   PORT_START   /* IN1 */
559   PORT_DIPNAME(0x03, 0x00, DEF_STR( Lives ) )
560   PORT_DIPSETTING (  0x00, "3" )
561   PORT_DIPSETTING (  0x01, "4" )
562   PORT_DIPSETTING (  0x02, "5" )
563   PORT_DIPNAME( 0x04, 0x00, "Unknown 1" )
564   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
565   PORT_DIPSETTING(    0x04, DEF_STR( On ) )
566   PORT_DIPNAME( 0x08, 0x00, "Unknown 2" )
567   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
568   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
569   PORT_DIPNAME( 0x10, 0x00, "Unknown 3" )
570   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
571   PORT_DIPSETTING(    0x10, DEF_STR( On ) )
572   PORT_DIPNAME( 0x20, 0x00, "Unknown 4" )
573   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
574   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
575   PORT_DIPNAME( 0x40, 0x00, "Unknown 5" )
576   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
577   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
578   PORT_DIPNAME( 0x80, 0x00, "Unknown 6" )
579   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
580   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
581
582   PORT_START   /* FAKE */
583   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
584
585   CAB_PORTENV
586INPUT_PORTS_END
587
588static INPUT_PORTS_START( ipminvad )
589   PORT_START
590   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
591   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
592   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 )
593   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_COCKTAIL
594   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
595   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
596   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
597   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL
598
599   PORT_START   /* IN1 */
600   PORT_DIPNAME(0x03, 0x00, DEF_STR( Lives ) )
601   PORT_DIPSETTING (  0x00, "3" )
602   PORT_DIPSETTING (  0x01, "4" )
603   PORT_DIPSETTING (  0x02, "5" )
604   PORT_DIPNAME( 0x04, 0x00, "Capsules" )
605   PORT_DIPSETTING(    0x00, DEF_STR( No ) )
606   PORT_DIPSETTING(    0x04, DEF_STR( Yes ) )
607   PORT_DIPNAME( 0x08, 0x00, DEF_STR( Bonus_Life ) )
608   PORT_DIPSETTING(    0x00, "1500" )
609   PORT_DIPSETTING(    0x08, "1000" )
610   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Coin_A ) )
611   PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
612   PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
613   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unused ) )  // Verified with debugger
614   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
615   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
616   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unused ) )
617   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
618   PORT_DIPSETTING(    0x40, DEF_STR( On ) )
619   PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unused ) )
620   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
621   PORT_DIPSETTING(    0x80, DEF_STR( On ) )
622
623   PORT_START   /* FAKE */
624   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
625
626   CAB_PORTENV
627INPUT_PORTS_END
628
629static INPUT_PORTS_START( spacebeam )
630   PORT_START
631   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
632   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
633   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 )
634   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
635   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
636
637   PORT_START   /* IN1 */
638   PORT_DIPNAME(0x03, 0x01, DEF_STR( Lives ) )
639   PORT_DIPSETTING (  0x00, "2" )
640   PORT_DIPSETTING (  0x01, "3" )
641   PORT_DIPSETTING (  0x02, "4" )
642   PORT_DIPSETTING (  0x03, "5" )
643   PORT_DIPNAME(0x08, 0x00, "Replay" )
644   PORT_DIPSETTING (  0x00, "30000" )
645   PORT_DIPSETTING (  0x08, DEF_STR( None ) )
646   PORT_DIPNAME(0x30, 0x10, DEF_STR( Coinage ) )
647   PORT_DIPSETTING (  0x00, "Testmode" )
648   PORT_DIPSETTING (  0x10, "1 Coin 1 Play" )
649   PORT_DIPSETTING (  0x20, "1 Coin 2 Plays" )
650
651   PORT_START   /* FAKE */
652   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
653
654   PORT_START   /* IN3 */
655   PORT_BIT( 0x03, 0, IPT_UNUSED )
656   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
657   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL
658   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
659
660   CAB_PORTENV
661INPUT_PORTS_END
662
663static INPUT_PORTS_START( headoni )
664   PORT_START
665   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
666   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
667   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 )
668   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
669   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
670   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
671   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
672   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
673
674   PORT_START   /* IN1 */
675   PORT_DIPNAME(0x03, 0x01, DEF_STR( Lives ) )
676   PORT_DIPSETTING (  0x00, "2" )
677   PORT_DIPSETTING (  0x01, "3" )
678   PORT_DIPSETTING (  0x02, "4" )
679   PORT_DIPSETTING (  0x03, "5" )
680   PORT_DIPNAME(0x08, 0x00, "Replay" )
681   PORT_DIPSETTING (  0x00, "30000" )
682   PORT_DIPSETTING (  0x08, DEF_STR( None ) )
683   PORT_DIPNAME(0x30, 0x10, DEF_STR( Coinage ) )
684   PORT_DIPSETTING (  0x00, "Testmode" )
685   PORT_DIPSETTING (  0x10, "1 Coin 1 Play" )
686   PORT_DIPSETTING (  0x20, "1 Coin 2 Plays" )
687
688   PORT_START   /* FAKE */
689   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 ) PORT_IMPULSE(1)
690
691   PORT_START   /* IN3 */
692   PORT_BIT( 0x03, 0, IPT_UNUSED )
693   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_COCKTAIL
694   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_COCKTAIL
695   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_COCKTAIL
696   CAB_PORTENV
697INPUT_PORTS_END
698
699
700
701/*************************************
702 *
703 *  Graphics definitions
704 *
705 *************************************/
706
707
708static const gfx_layout charlayout =
709{
710   8,8,   /* 8*8 characters */
711   256,   /* 256 characters */
712   1,   /* 1 bits per pixel */
713   { 0 },
714   { 0, 1, 2, 3, 4, 5, 6, 7 },
715   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
716   8*8   /* every char takes 8 consecutive bytes */
717};
718
719
720static GFXDECODE_START( skychut )
721   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout, 0, 8 )
722GFXDECODE_END
723
724/*************************************
725 *
726 *  Sound definitions
727 *
728 *************************************/
729
730static const char *iremm10_sample_names[] =
731{
732   "*ipminvad",
733   "1.wav",      /* shot/missle */
734   "2.wav",      /* base hit/explosion */
735   "3.wav",      /* invader hit */
736   "4.wav",      /* fleet move 1 */
737   "5.wav",      /* fleet move 2 */
738   "6.wav",      /* fleet move 3 */
739   "7.wav",      /* fleet move 4 */
740   "8.wav",      /* UFO/saucer hit */
741   "9.wav",      /* bonus base */
742   "0.wav",      /* UFO sound */
743   0
744};
745
746
747static struct Samplesinterface iremm10_samples_interface =
748{
749   6,   /* 6 channels */
750   iremm10_sample_names
751};
752
753/*************************************
754 *
755 *  Machine driver
756 *
757 *************************************/
758
759static MACHINE_DRIVER_START( iremm10 )
760
761   MDRV_DRIVER_DATA(irem_state)
762
763   /* basic machine hardware */
764   MDRV_CPU_ADD_TAG("Main", M6502,IREMM10_CPU_CLOCK)
765   MDRV_CPU_PROGRAM_MAP(iremm10_main,0)
766
767   MDRV_MACHINE_RESET(irem)
768
769   MDRV_CPU_VBLANK_INT(iremm10_interrupt,1)
770
771   MDRV_SCREEN_RAW_PARAMS(IREMM10_PIXEL_CLOCK, IREMM10_HTOTAL, IREMM10_HBEND, IREMM10_HBSTART, IREMM10_VTOTAL, IREMM10_VBEND, IREMM10_VBSTART)
772
773   /* video hardware */
774   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
775   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
776   MDRV_GFXDECODE(skychut)
777   MDRV_PALETTE_LENGTH(8)
778   MDRV_COLORTABLE_LENGTH(2*8)
779
780   MDRV_PALETTE_INIT(skychut)
781   MDRV_VIDEO_START(iremm10)
782   MDRV_VIDEO_UPDATE(iremm10)
783
784   /* sound hardware */
785   MDRV_SPEAKER_STANDARD_MONO("mono")
786
787   MDRV_SOUND_ADD(SAMPLES, 0)
788   MDRV_SOUND_CONFIG(iremm10_samples_interface)
789   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
790
791MACHINE_DRIVER_END
792
793static MACHINE_DRIVER_START( iremm11 )
794
795   MDRV_DRIVER_DATA(irem_state)
796
797   /* basic machine hardware */
798   MDRV_IMPORT_FROM(iremm10)
799   MDRV_CPU_REPLACE("Main", M6502,IREMM10_CPU_CLOCK / 2)
800   //MDRV_CPU_MODIFY("Main")
801   MDRV_CPU_PROGRAM_MAP(iremm11_main,0)
802   MDRV_CPU_VBLANK_INT(iremm11_interrupt,1)
803
804   /* sound hardware */
805MACHINE_DRIVER_END
806
807static MACHINE_DRIVER_START( greenberet )
808
809   MDRV_DRIVER_DATA(irem_state)
810
811   /* basic machine hardware */
812   MDRV_CPU_ADD_TAG("main", M6502,IREMM15_CPU_CLOCK)
813   MDRV_CPU_PROGRAM_MAP(iremm15_main,0)
814
815   MDRV_MACHINE_RESET(irem)
816
817   MDRV_CPU_VBLANK_INT(iremm15_interrupt,1)
818
819   MDRV_SCREEN_RAW_PARAMS(IREMM15_PIXEL_CLOCK, IREMM15_HTOTAL, IREMM15_HBEND, IREMM15_HBSTART, IREMM15_VTOTAL, IREMM15_VBEND, IREMM15_VBSTART)
820
821   /* video hardware */
822   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
823   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
824   MDRV_PALETTE_LENGTH(8)
825   MDRV_COLORTABLE_LENGTH(2*8)
826
827   MDRV_PALETTE_INIT(skychut)
828   MDRV_VIDEO_START( iremm15 )
829   MDRV_VIDEO_UPDATE(iremm15)
830
831   /* sound hardware */
832   MDRV_SPEAKER_STANDARD_MONO("mono")
833
834   MDRV_SOUND_ADD(SAMPLES, 0)
835   MDRV_SOUND_CONFIG(iremm10_samples_interface)
836   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
837
838MACHINE_DRIVER_END
839
840
841static MACHINE_DRIVER_START( headoni )
842   MDRV_IMPORT_FROM(greenberet)
843   MDRV_CPU_REPLACE("main", M6502,11730000/16)
844MACHINE_DRIVER_END
845
846static DRIVER_INIT( andromed )
847{
848   int i;
849   irem_state *state = machine->driver_data;
850
851   for (i=0x1c00;i<0x2000;i++)
852      state->rom[i]=0x60;
853}
854
855static DRIVER_INIT( iremm15 )
856{
857}
858
859
860/***************************************************************************
861
862  Game driver(s)
863
864***************************************************************************/
865
866ROM_START( andromed )//Jumps to an unmapped sub-routine at $2fc9
867   ROM_REGION( 0x10000, REGION_CPU1, 0 )
868   ROM_LOAD( "am1",  0x1000, 0x0400, CRC(53df0152) SHA1(d27113740094d219b0e05a930d8daa4c22129183) )
869   ROM_LOAD( "am2",  0x1400, 0x0400, CRC(dab64957) SHA1(77ced520f8e78bb08ddab4213646cf55d834e63e) )
870   ROM_LOAD( "am3",  0x1800, 0x0400, CRC(f983f35c) SHA1(1bfee6cf7d18b56594831f2efa7dcc53b47d7e30) )
871   ROM_LOAD( "am4",  0x1c00, 0x0400, CRC(09f20717) SHA1(c54c9b7d16b40a7ab49eac255906b43b03939d2b) )
872   ROM_RELOAD(       0xfc00, 0x0400 )   /* for the reset and interrupt vectors */
873   ROM_LOAD( "am5",  0x2000, 0x0400, CRC(518a3b88) SHA1(5e20c905c2190b381a105327e112fcc0a127bb2f) )
874   ROM_LOAD( "am6",  0x2400, 0x0400, CRC(ce3d5fff) SHA1(c34178aca9ffb8b2dd468d9e3369a985f52daf9a) )
875   ROM_LOAD( "am7",  0x2800, 0x0400, CRC(30d3366f) SHA1(aa73bba194fa6d1f3909f8df517a0bff07583ea9) )
876   ROM_LOAD( "am8",  0x2c00, 0x0400, NO_DUMP ) // $60 entries
877
878   ROM_REGION( 0x0800, REGION_GFX1, ROMREGION_DISPOSE )
879   ROM_LOAD( "am9",  0x0000, 0x0400, CRC(a1c8f4db) SHA1(bedf5d7126c7e9b91ad595188c69aa2c043c71e8) )
880   ROM_LOAD( "am10", 0x0400, 0x0400, CRC(be2de8f3) SHA1(7eb3d1eb88b4481b0dcb7d001207f516a5db32b3) )
881ROM_END
882
883ROM_START( ipminvad )
884   ROM_REGION( 0x10000, REGION_CPU1, 0 )
885   ROM_LOAD( "b1r",  0x1000, 0x0400, CRC(f9a7eb9b) SHA1(93ac65d3ac725d3e4c2fb769816ee808ab609911) )
886   ROM_LOAD( "b2r",  0x1400, 0x0400, CRC(af11c1aa) SHA1(6a74fcc7cb1627b1c427a77da89b69ccf3175800) )
887   ROM_LOAD( "b3r",  0x1800, 0x0400, CRC(ed49e481) SHA1(8771a34f432e6d88acc5f7529f16c980a77485db) )
888   ROM_LOAD( "b4r",  0x1c00, 0x0400, CRC(6d5db95b) SHA1(135500fc17524e8608c3bcfe26321144aa0afb91) )
889   ROM_RELOAD(       0xfc00, 0x0400 )   /* for the reset and interrupt vectors */
890   ROM_LOAD( "b5r",  0x2000, 0x0400, CRC(eabba7aa) SHA1(75e47eacd429f48f0a3a4539e5ecb4b1ea7281b1) )
891   ROM_LOAD( "b6r",  0x2400, 0x0400, CRC(3d0e7fa6) SHA1(14903bfc9506cb8e37807fb397be79f5eab99e3b) )
892   ROM_LOAD( "b7r",  0x2800, 0x0400, CRC(cf04864f) SHA1(6fe3ce208334321b63ada779fed69ec7cf4051ad) )
893
894   ROM_REGION( 0x0800, REGION_GFX1, ROMREGION_DISPOSE )
895   ROM_LOAD( "b9r",  0x0000, 0x0400, CRC(56942cab) SHA1(ba13a856477fc6cf7fd36996e47a3724f862f888) )
896   ROM_LOAD( "b10r", 0x0400, 0x0400, CRC(be4b8585) SHA1(0154eae62585e154cf20edcf4599bda8bd333aa9) )
897ROM_END
898
899ROM_START( skychut )
900   ROM_REGION( 0x10000, REGION_CPU1, 0 )
901   ROM_LOAD( "sc1d",  0x1000, 0x0400, CRC(30b5ded1) SHA1(3a8b4fa344522404661b062808a2ea1d5858fdd0) )
902   ROM_LOAD( "sc2d",  0x1400, 0x0400, CRC(fd1f4b9e) SHA1(e5606979abe1fa4cc9eae0c4f61516769db35c39) )
903   ROM_LOAD( "sc3d",  0x1800, 0x0400, CRC(67ed201e) SHA1(589b1efdc1bbccff296f6420e2b320cd54b4ac8e) )
904   ROM_LOAD( "sc4d",  0x1c00, 0x0400, CRC(9b23a679) SHA1(a101f9b0fdde927a43e53e9b7d0dffb9dcca9e16) )
905   ROM_RELOAD(        0xfc00, 0x0400 )   /* for the reset and interrupt vectors */
906   ROM_LOAD( "sc5a",  0x2000, 0x0400, CRC(51d975e6) SHA1(7d345025ef28c8a81f599cde445eeb336c368fce) )
907   ROM_LOAD( "sc6e",  0x2400, 0x0400, CRC(617f302f) SHA1(4277ef97279eb63fc68b6c40f8545b31abaab474) )
908   ROM_LOAD( "sc7",   0x2800, 0x0400, CRC(dd4c8e1a) SHA1(b5a141d8ac256ba6522308e5f194bfaf5c75fa5b) )
909   ROM_LOAD( "sc8d",  0x2c00, 0x0400, CRC(aca8b798) SHA1(d9048d060314d8f20ab1967fee846d35c22ac693) )
910
911   ROM_REGION( 0x0800, REGION_GFX1, ROMREGION_DISPOSE )
912   ROM_LOAD( "sc9d",  0x0000, 0x0400, CRC(2101029e) SHA1(34cddf076d3d860aa03043db14837f42449aefe7) )
913   ROM_LOAD( "sc10d", 0x0400, 0x0400, CRC(2f81c70c) SHA1(504935c89a4158a067cbf1dcdb27f7421678915d) )
914ROM_END
915
916ROM_START( spacbeam )
917   ROM_REGION( 0x10000, REGION_CPU1, 0 )
918   ROM_LOAD( "m1b", 0x1000, 0x0400, CRC(5a1c3e0b) SHA1(1c9c58359d74b14ce96934fcc6acefbdfaf1e1be) )
919   ROM_LOAD( "m2b", 0x1400, 0x0400, CRC(a02bd9d7) SHA1(d25dfa66b422bdbb29b1922007c84f1947fe9be1) )
920   ROM_LOAD( "m3b", 0x1800, 0x0400, CRC(78040843) SHA1(0b8a3ab09dff951aa527649f82b8877cf01126c1) )
921   ROM_LOAD( "m4b", 0x1c00, 0x0400, CRC(74705a44) SHA1(8fa9d22a58f08086bf2d89e3d92eca097cdd2cbf) )
922   ROM_RELOAD(      0xfc00, 0x0400 )   /* for the reset and interrupt vectors */
923   ROM_LOAD( "m5b", 0x2000, 0x0400, CRC(afdf1242) SHA1(e26a8e91edb3d8ba96b3d225813760f42238b003) )
924   ROM_LOAD( "m6b", 0x2400, 0x0400, CRC(12afb0c2) SHA1(bf6ed90cf4815f0fb41d435954d4c346a55098f5) )
925ROM_END
926
927ROM_START( headoni )
928   ROM_REGION( 0x10000, REGION_CPU1, 0 )
929   ROM_LOAD( "e1.9a", 0x1000, 0x0400, CRC(05da5265) SHA1(17e0c9261978770325a0befdcdd8a1b07ed39df0) )
930   ROM_LOAD( "e2.9b", 0x1400, 0x0400, CRC(dada26a8) SHA1(1368ade1c0c57d33d15594370cf1edf95fc44fd1) )
931   ROM_LOAD( "e3.9c", 0x1800, 0x0400, CRC(61ff24f5) SHA1(0e68aedd01b765fb2af76f914b3d287ecf30f716) )
932   ROM_LOAD( "e4.9d", 0x1c00, 0x0400, CRC(ce4c5a67) SHA1(8db493d43f311a29127405aad7693bc08b570b14) )
933   ROM_RELOAD(      0xfc00, 0x0400 )   /* for the reset and interrupt vectors */
934   ROM_LOAD( "e5.9f", 0x2000, 0x0400, CRC(b5232439) SHA1(39b8fb4bbd00a73b9a2b68bc3e88fb45d3f62d7c) )
935   ROM_LOAD( "e6.9g", 0x2400, 0x0400, CRC(99acd1a6) SHA1(799382c1b079aad3034a1cc738dc06954978a0ac) )
936ROM_END
937
938ROM_START( greenber )
939   ROM_REGION( 0x10000, REGION_CPU1, 0 )
940   ROM_LOAD( "gb1", 0x1000, 0x0400, CRC(018ff672) SHA1(54d082a332831afc28b47704a5656da0a8a902fa) ) // ok
941   ROM_LOAD( "gb2", 0x1400, 0x0400, CRC(ea8f2267) SHA1(ad5bb38a80fbc7c70c8fa6f41086a7ade81655bc) ) // ok
942   ROM_LOAD( "gb3", 0x1800, 0x0400, CRC(8f337920) SHA1(ac3d76eb368645ba23f5823b39c04fae49d481e1) ) // ok
943   ROM_LOAD( "gb4", 0x1c00, 0x0400, CRC(7eeac4eb) SHA1(c668ad45ebc4aca558371539031efc4ec3990e44) ) // ok
944   ROM_RELOAD(      0xfc00, 0x0400 )   /* for the reset and interrupt vectors */
945   ROM_LOAD( "gb5", 0x2000, 0x0400, CRC(b2f8e69a) SHA1(44295e58da890a8c4aba6fe90defe9c578c95592) )
946   ROM_LOAD( "gb6", 0x2400, 0x0400, CRC(50ea8bd3) SHA1(a816c5fcc603b28c2ae59f217871a7e85fb794e1) )
947   ROM_LOAD( "gb7", 0x2800, 0x0400, NO_DUMP ) // 2be8 entry
948   ROM_LOAD( "gb8", 0x2c00, 0x0400, CRC(34700b31) SHA1(c148e2475eaaa0e9d1e2412eea359a7ba744e563) )
949   ROM_LOAD( "gb9", 0x3000, 0x0400, CRC(c27b9ba3) SHA1(a2f4f0c4b61eb03bba13ae5d25dc01009a4f86ee) ) // ok ?
950ROM_END
951
952GAME( 1979, andromed, 0, iremm11,   skychut,  andromed, ROT270, "Irem", "Andromeda (Japan?)", GAME_NO_COCKTAIL | GAME_NO_SOUND | GAME_IMPERFECT_COLORS | GAME_NOT_WORKING )
953GAME( 1979?,ipminvad, 0, iremm10,   ipminvad,   0, ROT270, "Irem", "IPM Invader", GAME_NO_COCKTAIL | GAME_IMPERFECT_COLORS )
954GAME( 1980, skychut,  0, iremm11,    skychut,   0, ROT270, "Irem", "Sky Chuter", GAME_NO_COCKTAIL | GAME_NO_SOUND | GAME_IMPERFECT_COLORS )
955GAME( 1979, spacbeam, 0, greenberet, spacebeam, iremm15, ROT270, "Irem", "Space Beam", GAME_NO_COCKTAIL | GAME_NO_SOUND | GAME_IMPERFECT_COLORS )
956GAME( 1979?,headoni,  0, headoni,    headoni,   iremm15, ROT270, "Irem", "Head On (Irem, M-15 Hardware)", GAME_NO_COCKTAIL | GAME_NO_SOUND | GAME_IMPERFECT_COLORS )
957GAME( 1980, greenber, 0, greenberet, spacebeam, iremm15, ROT270, "Irem", "Green Beret (Irem)", GAME_NO_COCKTAIL | GAME_NO_SOUND | GAME_IMPERFECT_COLORS | GAME_NOT_WORKING )
src/mame/drivers/ninjakun.c
r1768r1769
1/*******************************************************************************
2 Ninja Kid / Ninjakun Majou no Bouken | (c) 1984 UPL / Taito
3********************************************************************************
4 Driver by David Haywood
5 with help from Steph and Phil Stroffolino
6
7 Last Changes: 21 Jan 2008
8
9 This driver was started after interest was shown in the game by a poster at
10 various messageboards going under the name of 'ninjakun'  I decided to attempt
11 a driver for this game to gain some experience with Z80 & Multi-processor
12 games.
13
14Hold P1 Start after a reset to skip the startup memory tests.
15
16Change Log:
175 Mar - Added Saved State Support (DJH)
188 Jun - Added palette animation, Fixed FG priority. (Uki)
199 Jun - Fixed BG scroll handling, Fixed CPU clock.
20*******************************************************************************/
21
22#include "driver.h"
23#include "cpu/z80/z80.h"
24#include "sound/ay8910.h"
25
26
27extern UINT8 *ninjakun_fg_videoram;
28extern UINT8 *ninjakun_bg_videoram;
29
30WRITE8_HANDLER( ninjakun_bg_videoram_w );
31WRITE8_HANDLER( ninjakun_fg_videoram_w );
32READ8_HANDLER( ninjakun_bg_videoram_r );
33
34READ8_HANDLER( ninjakun_io_8000_r );
35WRITE8_HANDLER( ninjakun_io_8000_w );
36
37VIDEO_START( ninjakun );
38VIDEO_UPDATE( ninjakun );
39WRITE8_HANDLER( ninjakun_flipscreen_w );
40
41WRITE8_HANDLER( ninjakun_paletteram_w );
42
43
44/*******************************************************************************
45 0xA000 Read / Write Handlers
46*******************************************************************************/
47
48static UINT8 ninjakun_io_a002_ctrl;
49
50static READ8_HANDLER( ninjakun_io_A002_r )
51{
52   return ninjakun_io_a002_ctrl | readinputport(2); /* vblank */
53}
54
55static WRITE8_HANDLER( ninjakun_cpu1_io_A002_w )
56{
57   if( data == 0x80 ) ninjakun_io_a002_ctrl |= 0x04;
58   if( data == 0x40 ) ninjakun_io_a002_ctrl &= ~0x08;
59}
60
61static WRITE8_HANDLER( ninjakun_cpu2_io_A002_w )
62{
63   if( data == 0x40 ) ninjakun_io_a002_ctrl |= 0x08;
64   if( data == 0x80 ) ninjakun_io_a002_ctrl &= ~0x04;
65}
66
67/*******************************************************************************
68 Init
69*******************************************************************************/
70
71static MACHINE_START( ninjakun )
72{
73   /* Save State Stuff */
74   state_save_register_global(ninjakun_io_a002_ctrl);
75}
76
77/*******************************************************************************
78 Memory Maps
79*******************************************************************************/
80
81static ADDRESS_MAP_START( ninjakun_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
82    AM_RANGE(0x0000, 0x1fff) AM_ROM
83   AM_RANGE(0x2000, 0x7fff) AM_ROM
84   AM_RANGE(0x8000, 0x8003) AM_READWRITE(ninjakun_io_8000_r, ninjakun_io_8000_w)
85   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r)
86   AM_RANGE(0xa001, 0xa001) AM_READ(input_port_1_r)
87   AM_RANGE(0xa002, 0xa002) AM_READWRITE(ninjakun_io_A002_r, ninjakun_cpu1_io_A002_w)
88   AM_RANGE(0xa003, 0xa003) AM_WRITE(ninjakun_flipscreen_w)
89   AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(MRA8_RAM, ninjakun_fg_videoram_w) AM_BASE(&ninjakun_fg_videoram) AM_SHARE(1)
90   AM_RANGE(0xc800, 0xcfff) AM_READWRITE(ninjakun_bg_videoram_r, ninjakun_bg_videoram_w) AM_BASE(&ninjakun_bg_videoram) AM_SHARE(2)
91    AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_BASE(&spriteram) AM_SHARE(3)
92    AM_RANGE(0xd800, 0xd9ff) AM_READWRITE(MRA8_RAM, ninjakun_paletteram_w) AM_BASE(&paletteram) AM_SHARE(4)
93    AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_SHARE(5)
94    AM_RANGE(0xe400, 0xe7ff) AM_RAM AM_SHARE(6)
95ADDRESS_MAP_END
96
97static ADDRESS_MAP_START( ninjakun_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 )
98    AM_RANGE(0x0000, 0x1fff) AM_ROM
99   AM_RANGE(0x2000, 0x7fff) AM_ROM AM_REGION(REGION_CPU1, 0x2000)
100   AM_RANGE(0x8000, 0x8003) AM_READWRITE(ninjakun_io_8000_r, ninjakun_io_8000_w)
101   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r)
102   AM_RANGE(0xa001, 0xa001) AM_READ(input_port_1_r)
103   AM_RANGE(0xa002, 0xa002) AM_READWRITE(ninjakun_io_A002_r, ninjakun_cpu2_io_A002_w)
104   AM_RANGE(0xa003, 0xa003) AM_WRITE(ninjakun_flipscreen_w)
105   AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(MRA8_RAM, ninjakun_fg_videoram_w) AM_SHARE(1)
106   AM_RANGE(0xc800, 0xcfff) AM_READWRITE(ninjakun_bg_videoram_r, ninjakun_bg_videoram_w) AM_SHARE(2)
107    AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_SHARE(3)
108    AM_RANGE(0xd800, 0xd9ff) AM_READWRITE(MRA8_RAM, ninjakun_paletteram_w) AM_SHARE(4)
109    AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_SHARE(6) /* swapped wrt CPU1 */
110    AM_RANGE(0xe400, 0xe7ff) AM_RAM AM_SHARE(5) /* swapped wrt CPU1 */
111ADDRESS_MAP_END
112
113/*******************************************************************************
114 GFX Decoding Information
115*******************************************************************************/
116
117static const gfx_layout tile_layout =
118{
119   8,8,   /* tile size */
120   0x400,   /* number of tiles */
121   4,      /* bits per pixel */
122   { 0, 1, 2, 3 }, /* plane offsets */
123   { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 }, /* x offsets */
124   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, /* y offsets */
125   256
126};
127
128static const gfx_layout sprite_layout =
129{
130   16,16,   /* tile size */
131   0x100,   /* number of tiles */
132   4,      /* bits per pixel */
133   { 0, 1, 2, 3 }, /* plane offsets */
134   {
135      0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
136      256+0*4, 256+1*4, 256+2*4, 256+3*4, 256+4*4, 256+5*4, 256+6*4, 256+7*4,
137   }, /* x offsets */
138   {
139      0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
140      512+0*32, 512+1*32, 512+2*32, 512+3*32, 512+4*32, 512+5*32, 512+6*32, 512+7*32
141   }, /* y offsets */
142   1024
143};
144
145static GFXDECODE_START( ninjakun )
146   GFXDECODE_ENTRY( REGION_GFX1, 0, tile_layout,      0x000, 0x10 )
147   GFXDECODE_ENTRY( REGION_GFX2, 0, tile_layout,      0x100, 0x10 )
148   GFXDECODE_ENTRY( REGION_GFX1, 0, sprite_layout,   0x200, 0x10 )
149GFXDECODE_END
150
151/*******************************************************************************
152 Machine Driver Structure(s)
153*******************************************************************************/
154
155static MACHINE_DRIVER_START( ninjakun )
156
157   /* basic machine hardware */
158   MDRV_CPU_ADD(Z80, 3000000) /* 3.00MHz */
159   MDRV_CPU_PROGRAM_MAP(ninjakun_cpu1_map,0)
160   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
161
162   MDRV_CPU_ADD(Z80, 3000000) /* 3.00MHz */
163   MDRV_CPU_PROGRAM_MAP(ninjakun_cpu2_map,0)
164   MDRV_CPU_VBLANK_INT(irq0_line_hold,4) /* ? */
165
166   MDRV_SCREEN_REFRESH_RATE(60)
167
168   MDRV_MACHINE_START(ninjakun)
169   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
170   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame */
171
172    /* video hardware */
173   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
174   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
175   MDRV_SCREEN_SIZE(32*8, 32*8)
176   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, (32-4)*8-1 )
177   MDRV_GFXDECODE(ninjakun)
178   MDRV_PALETTE_LENGTH(768)
179
180   MDRV_VIDEO_START(ninjakun)
181   MDRV_VIDEO_UPDATE(ninjakun)
182
183   /* sound hardware */
184   MDRV_SPEAKER_STANDARD_MONO("mono")
185
186   MDRV_SOUND_ADD(AY8910, 6000000/2)
187   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
188
189   MDRV_SOUND_ADD(AY8910, 6000000/2)
190   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
191MACHINE_DRIVER_END
192
193/*******************************************************************************
194 Rom Definitions
195*******************************************************************************/
196
197ROM_START( ninjakun ) /* Original Board? */
198   ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* Main CPU */
199   ROM_LOAD( "ninja-1.7a",  0x0000, 0x02000, CRC(1c1dc141) SHA1(423d3ed35e73a8d5bfce075a889b0322b207bd0d) )
200   ROM_LOAD( "ninja-2.7b",  0x2000, 0x02000, CRC(39cc7d37) SHA1(7f0d0e1e92cb6a57f15eb7fc51a67112f1c5fc8e) )
201   ROM_LOAD( "ninja-3.7d",  0x4000, 0x02000, CRC(d542bfe3) SHA1(3814d8f5b1acda21438fff4f71670fa653dc7b30) )
202   ROM_LOAD( "ninja-4.7e",  0x6000, 0x02000, CRC(a57385c6) SHA1(77925a281e64889bfe967c3d42a388529aaf7eb6) )
203
204   ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* Secondary CPU */
205   ROM_LOAD( "ninja-5.7h",  0x0000, 0x02000, CRC(164a42c4) SHA1(16b434b33b76b878514f67c23315d4c6da7bfc9e) )
206
207   ROM_REGION( 0x08000, REGION_GFX1, ROMREGION_DISPOSE ) /* Graphics */
208   ROM_LOAD16_BYTE( "ninja-6.7n",  0x0000, 0x02000, CRC(a74c4297) SHA1(87184d14c67331f2c8a2412e28f31427eddae799) )
209   ROM_LOAD16_BYTE( "ninja-7.7p",  0x0001, 0x02000, CRC(53a72039) SHA1(d77d608ce9388a8956831369badd88a8eda8e102) )
210   ROM_LOAD16_BYTE( "ninja-8.7s",  0x4000, 0x02000, CRC(4a99d857) SHA1(6aadb6a5c721a161a5c1bef5569c1e323e380cff) )
211   ROM_LOAD16_BYTE( "ninja-9.7t",  0x4001, 0x02000, CRC(dede49e4) SHA1(8ce4bc02ec583b3885ca63fb5e2d5dad185fe192) )
212
213   ROM_REGION( 0x08000, REGION_GFX2, ROMREGION_DISPOSE ) /* Graphics */
214   ROM_LOAD16_BYTE( "ninja-10.2c", 0x0000, 0x02000, CRC(0d55664a) SHA1(955a607b4401ce9f3f807d53833a766152b0ef9b) )
215   ROM_LOAD16_BYTE( "ninja-11.2d", 0x0001, 0x02000, CRC(12ff9597) SHA1(10b572844ab32e3ae54abe3600fecc1a811ac713) )
216   ROM_LOAD16_BYTE( "ninja-12.4c", 0x4000, 0x02000, CRC(e9b75807) SHA1(cf4c8ac962f785e9de5502df58eab9b3725aaa28) )
217   ROM_LOAD16_BYTE( "ninja-13.4d", 0x4001, 0x02000, CRC(1760ed2c) SHA1(ee4c8efcce483c8051873714856824a1a1e14b61) )
218ROM_END
219
220/*******************************************************************************
221 Input Ports
222********************************************************************************
223 2 Sets of Controls
224 2 Sets of Dipsiwtches
225*******************************************************************************/
226
227static INPUT_PORTS_START( ninjakun )
228   PORT_START_TAG("IN0")   /* 0xa000 */
229   PORT_BIT( 0x01, IP_ACTIVE_LOW,   IPT_JOYSTICK_LEFT ) PORT_2WAY /* "XPOS1" */
230   PORT_BIT( 0x02, IP_ACTIVE_LOW,   IPT_JOYSTICK_RIGHT ) PORT_2WAY
231   PORT_BIT( 0x04, IP_ACTIVE_LOW,   IPT_BUTTON2 )
232   PORT_BIT( 0x08, IP_ACTIVE_LOW,   IPT_BUTTON1 )
233   PORT_BIT( 0x10, IP_ACTIVE_LOW,   IPT_UNKNOWN )
234   PORT_BIT( 0x20, IP_ACTIVE_LOW,   IPT_START1  )
235   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
236   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
237
238   PORT_START_TAG("IN1")   /* 0xa001 */
239   PORT_BIT( 0x01, IP_ACTIVE_LOW,   IPT_JOYSTICK_LEFT) PORT_2WAY PORT_COCKTAIL /* "YPOS1" */
240   PORT_BIT( 0x02, IP_ACTIVE_LOW,   IPT_JOYSTICK_RIGHT) PORT_2WAY PORT_COCKTAIL
241   PORT_BIT( 0x04, IP_ACTIVE_LOW,   IPT_BUTTON2 ) PORT_COCKTAIL
242   PORT_BIT( 0x08, IP_ACTIVE_LOW,   IPT_BUTTON1 ) PORT_COCKTAIL
243   PORT_BIT( 0x10, IP_ACTIVE_LOW,   IPT_UNKNOWN )
244   PORT_BIT( 0x20, IP_ACTIVE_LOW,   IPT_START2  )
245   PORT_SERVICE( 0x40, IP_ACTIVE_HIGH )
246   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
247
248   PORT_START_TAG("IN2")   /* 0xa002 */
249   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
250
251   PORT_START_TAG("DSW1")
252   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
253   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
254   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
255   PORT_DIPNAME( 0x06, 0x04, DEF_STR( Lives ) )
256   PORT_DIPSETTING(    0x02, "2" )
257   PORT_DIPSETTING(    0x04, "3" )
258   PORT_DIPSETTING(    0x06, "4" )
259   PORT_DIPSETTING(    0x00, "5" )
260   PORT_DIPNAME( 0x08, 0x08, "First Bonus" )
261   PORT_DIPSETTING(    0x08, "30000" )
262   PORT_DIPSETTING(    0x00, "40000" )
263   PORT_DIPNAME( 0x30, 0x30, "Second Bonus" )
264   PORT_DIPSETTING(    0x00, "No Bonus" )
265   PORT_DIPSETTING(    0x10, "Every 30000" )
266   PORT_DIPSETTING(    0x30, "Every 50000" )
267   PORT_DIPSETTING(    0x20, "Every 70000" )
268   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
269   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
270   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
271   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Difficulty ) )
272   PORT_DIPSETTING(    0x80, DEF_STR( Normal ) )
273   PORT_DIPSETTING(    0x00, DEF_STR( Hard )   )
274
275   PORT_START_TAG("DSW2")
276   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
277   PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
278   PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
279   PORT_DIPSETTING(    0x00, DEF_STR( 4C_2C ) )
280   PORT_DIPSETTING(    0x06, DEF_STR( 2C_1C ) )
281   PORT_DIPSETTING(    0x01, DEF_STR( 3C_2C ) )
282   PORT_DIPSETTING(    0x02, DEF_STR( 2C_2C ) )
283   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
284   PORT_DIPSETTING(    0x03, DEF_STR( 1C_2C ) )
285   PORT_DIPNAME( 0x08, 0x08, "High Score Names" )
286   PORT_DIPSETTING(    0x00, "3 Letters" )
287   PORT_DIPSETTING(    0x08, "8 Letters" )
288   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) )
289   PORT_DIPSETTING(    0x10, DEF_STR( No ) )
290   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
291   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )/* Probably Unused */
292   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
293   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
294   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
295   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
296   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
297   PORT_DIPNAME( 0x80, 0x80, "Endless Game (If Free Play)" )
298   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
299   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
300INPUT_PORTS_END
301
302/*******************************************************************************
303 Game Drivers
304*******************************************************************************/
305
306GAME( 1984, ninjakun, 0, ninjakun, ninjakun, 0, ROT0, "[UPL] (Taito license)", "Ninjakun Majou no Bouken", 0 )
src/mame/drivers/pkunwar.c
r1768r1769
1/***************************************************************************
2
3Notes:
4- Currently the Flip Screen dip switch only flips the screen horizontally.
5  This might not be the correct behaviour. Verification of the real board
6  would be necessary to emulate this accurately.
7
8***************************************************************************/
9
10#include "driver.h"
11#include "sound/ay8910.h"
12
13
14PALETTE_INIT( nova2001 );
15WRITE8_HANDLER( pkunwar_flipscreen_w );
16VIDEO_UPDATE( pkunwar );
17
18
19
20static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
21   AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM)
22   AM_RANGE(0x8000, 0x8fff) AM_READ(MRA8_RAM)
23   AM_RANGE(0xa001, 0xa001) AM_READ(AY8910_read_port_0_r)
24   AM_RANGE(0xa003, 0xa003) AM_READ(AY8910_read_port_1_r)
25   AM_RANGE(0xc000, 0xc7ff) AM_READ(MRA8_RAM)
26   AM_RANGE(0xe000, 0xffff) AM_READ(MRA8_ROM)
27ADDRESS_MAP_END
28
29static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
30   AM_RANGE(0x0000, 0x7fff) AM_WRITE(MWA8_ROM)
31   AM_RANGE(0x8000, 0x87ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
32   AM_RANGE(0x8800, 0x8bff) AM_WRITE(MWA8_RAM) AM_BASE(&videoram) AM_SIZE(&videoram_size)
33   AM_RANGE(0x8c00, 0x8fff) AM_WRITE(MWA8_RAM) AM_BASE(&colorram)
34   AM_RANGE(0xa000, 0xa000) AM_WRITE(&AY8910_control_port_0_w)
35   AM_RANGE(0xa001, 0xa001) AM_WRITE(&AY8910_write_port_0_w)
36   AM_RANGE(0xa002, 0xa002) AM_WRITE(&AY8910_control_port_1_w)
37   AM_RANGE(0xa003, 0xa003) AM_WRITE(&AY8910_write_port_1_w)
38   AM_RANGE(0xc000, 0xc7ff) AM_WRITE(MWA8_RAM)
39   AM_RANGE(0xe000, 0xffff) AM_WRITE(MWA8_ROM)
40ADDRESS_MAP_END
41
42static ADDRESS_MAP_START( writeport, ADDRESS_SPACE_IO, 8 )
43   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
44   AM_RANGE(0x00, 0x00) AM_WRITE(pkunwar_flipscreen_w)
45ADDRESS_MAP_END
46
47
48
49static INPUT_PORTS_START( pkunwar )
50   PORT_START   /* IN0 */
51    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY
52    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY
53    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 )
54    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
55    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
56    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
57    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
58    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )
59
60   PORT_START   /* IN1 */
61    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL
62    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL
63    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
64    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
65    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
66    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
67   PORT_SERVICE( 0x40, IP_ACTIVE_LOW )
68    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
69
70   PORT_START   /* DSW0 */
71   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
72   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
73   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
74   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
75   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
76   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
77   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
78   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
79   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
80   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
81   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
82   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
83   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
84   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
85   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
86   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
87   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
88   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
89   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
90   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
91   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
92   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
93   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
94   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
95
96   PORT_START   /* DSW1 */
97   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
98   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
99   PORT_DIPSETTING(    0x02, DEF_STR( 2C_1C ) )
100   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
101   PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
102   PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) )
103   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
104   PORT_DIPSETTING(    0x04, DEF_STR( Cocktail ) )
105   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
106   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
107   PORT_DIPSETTING(    0x08, DEF_STR( On ) )
108   PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
109   PORT_DIPSETTING(    0x10, DEF_STR( Easy ) )
110   PORT_DIPSETTING(    0x30, DEF_STR( Medium ) )
111   PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
112   PORT_DIPSETTING(    0x00, DEF_STR( Hardest ) )
113   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) )
114   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
115   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
116   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) )
117   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
118   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
119INPUT_PORTS_END
120
121
122
123static const gfx_layout charlayout =
124{
125   8,8,   /* 8*8 characters */
126   2048,   /* 2048 characters */
127   4,   /* 4 bits per pixel */
128   { 0, 1, 2, 3 },
129   { 0*4, 1*4, 2048*16*8, 2048*16*8 + 4, 2*4,  3*4, 2048*16*8 + 8, 2048*16*8 + 12 },
130   { 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8 },
131   16*8
132};
133
134static const gfx_layout spritelayout =
135{
136   16,16,   /* 16*16 sprites */
137   512,   /* 512 sprites */
138   4,   /* 4 bits per pixel */
139   { 0, 1, 2, 3 },
140   { 0*4, 1*4, 512*64*8, 512*64*8 + 4, 2*4,  3*4, 512*64*8 + 8, 512*64*8 + 12,
141         0*4+16*8, 1*4+16*8, 512*64*8+16*8, 512*64*8 + 4+16*8, 2*4+16*8,  3*4+16*8, 512*64*8 + 8 + 16*8, 512*64*8 + 12 + 16*8 },
142   { 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8,
143         0*8+32*8, 2*8+32*8, 4*8+32*8, 6*8+32*8, 8*8+32*8, 10*8+32*8, 12*8+32*8, 14*8 + 32*8  },
144   64*8
145};
146
147static GFXDECODE_START( pkunwar )
148   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout,   16*16, 16 )
149   GFXDECODE_ENTRY( REGION_GFX1, 0x0000, spritelayout,     0, 16 )
150GFXDECODE_END
151
152
153
154static const struct AY8910interface ay8910_interface_1 = {
155   input_port_0_r,
156   input_port_1_r
157};
158
159static const struct AY8910interface ay8910_interface_2 = {
160   input_port_2_r,
161   input_port_3_r
162};
163
164
165
166static MACHINE_DRIVER_START( pkunwar )
167
168   /* basic machine hardware */
169   MDRV_CPU_ADD(Z80, 12000000/4)   /* 3 MHz */
170   MDRV_CPU_PROGRAM_MAP(readmem,writemem)
171   MDRV_CPU_IO_MAP(0,writeport)
172   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
173
174   MDRV_SCREEN_REFRESH_RATE(60)
175   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
176
177   /* video hardware */
178   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
179   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
180   MDRV_SCREEN_SIZE(32*8, 32*8)
181   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 28*8-1)
182   MDRV_GFXDECODE(pkunwar)
183   MDRV_PALETTE_LENGTH(32)
184   MDRV_COLORTABLE_LENGTH(32*16)
185
186   MDRV_PALETTE_INIT(nova2001)
187   MDRV_VIDEO_UPDATE(pkunwar)
188
189   /* sound hardware */
190   MDRV_SPEAKER_STANDARD_MONO("mono")
191
192   MDRV_SOUND_ADD(AY8910, 12000000/8)
193   MDRV_SOUND_CONFIG(ay8910_interface_1)
194   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
195
196   MDRV_SOUND_ADD(AY8910, 12000000/8)
197   MDRV_SOUND_CONFIG(ay8910_interface_2)
198   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
199MACHINE_DRIVER_END
200
201
202
203/***************************************************************************
204
205  Game driver(s)
206
207***************************************************************************/
208
209ROM_START( pkunwar )
210   ROM_REGION( 0x10000, REGION_CPU1, 0 )
211   ROM_LOAD( "pkwar.01r",    0x0000, 0x4000, CRC(ce2d2c7b) SHA1(2ffe2eb339fd668ec4fe90eff66124a334db0693) )
212   ROM_LOAD( "pkwar.02r",    0x4000, 0x4000, CRC(abc1f661) SHA1(c4bf4a345efd4271617de9f334303d81c6885aa5) )
213   ROM_LOAD( "pkwar.03r",    0xe000, 0x2000, CRC(56faebea) SHA1(dd0406c723a08f5d1120655857a115ab8c2d2a11) )
214
215   ROM_REGION( 0x10000, REGION_GFX1, ROMREGION_DISPOSE )
216   ROM_LOAD( "pkwar.01y",    0x0000, 0x2000, CRC(428d3b92) SHA1(7fe11e8d785fe829d34e512f233bb9ccc70cd431) )
217   ROM_CONTINUE(             0x8000, 0x2000 )
218   ROM_LOAD( "pkwar.02y",    0x2000, 0x2000, CRC(ce1da7bc) SHA1(a2357b61703a689ce63aec7dd44702b119894f8e) )
219   ROM_CONTINUE(             0xa000, 0x2000 )
220   ROM_LOAD( "pkwar.03y",    0x4000, 0x2000, CRC(63204400) SHA1(1ba87ad3425c51150cb65408f04ee0147ef332d3) )
221   ROM_CONTINUE(             0xc000, 0x2000 )
222   ROM_LOAD( "pkwar.04y",    0x6000, 0x2000, CRC(061dfca8) SHA1(0a2dd8fc790d607195ca18dfc55575c2b9ddc58a) )
223   ROM_CONTINUE(             0xe000, 0x2000 )
224
225   ROM_REGION( 0x0020, REGION_PROMS, 0 )
226   ROM_LOAD( "pkwar.col",    0x0000, 0x0020, CRC(af0fc5e2) SHA1(480908bf893211b580ae19cfb40dc35ad1bbc343) )
227ROM_END
228
229ROM_START( pkunwarj )
230   ROM_REGION( 0x10000, REGION_CPU1, 0 )
231   ROM_LOAD( "pgunwar.6",    0x0000, 0x4000, CRC(357f3ef3) SHA1(bc651fb7701b395ae8cda1888814af5c5aa325a6) )
232   ROM_LOAD( "pgunwar.5",    0x4000, 0x4000, CRC(0092e49e) SHA1(7945361036f7679e4f4bb6b94f60f3ca09c077dc) )
233   ROM_LOAD( "pkwar.03r",    0xe000, 0x2000, CRC(56faebea) SHA1(dd0406c723a08f5d1120655857a115ab8c2d2a11) )
234
235   ROM_REGION( 0x10000, REGION_GFX1, ROMREGION_DISPOSE )
236   ROM_LOAD( "pkwar.01y",    0x0000, 0x2000, CRC(428d3b92) SHA1(7fe11e8d785fe829d34e512f233bb9ccc70cd431) )
237   ROM_CONTINUE(             0x8000, 0x2000 )
238   ROM_LOAD( "pkwar.02y",    0x2000, 0x2000, CRC(ce1da7bc) SHA1(a2357b61703a689ce63aec7dd44702b119894f8e) )
239   ROM_CONTINUE(             0xa000, 0x2000 )
240   ROM_LOAD( "pgunwar.2",    0x4000, 0x2000, CRC(a2a43443) SHA1(4e10569886d364eb2539928ea81dc1565b60b590) )
241   ROM_CONTINUE(             0xc000, 0x2000 )
242   ROM_LOAD( "pkwar.04y",    0x6000, 0x2000, CRC(061dfca8) SHA1(0a2dd8fc790d607195ca18dfc55575c2b9ddc58a) )
243   ROM_CONTINUE(             0xe000, 0x2000 )
244
245   ROM_REGION( 0x0020, REGION_PROMS, 0 )
246   ROM_LOAD( "pkwar.col",    0x0000, 0x0020, CRC(af0fc5e2) SHA1(480908bf893211b580ae19cfb40dc35ad1bbc343) )
247ROM_END
248
249
250
251GAME( 1985?, pkunwar,  0,       pkunwar, pkunwar, 0, ROT0, "UPL", "Penguin-Kun Wars (US)", 0 )
252GAME( 1985?, pkunwarj, pkunwar, pkunwar, pkunwar, 0, ROT0, "UPL", "Penguin-Kun Wars (Japan)", 0 )
src/mame/drivers/yard.c
r1768r1769
1/****************************************************************************
210 Yard Fight Driver.
3
4L Taylor
5J Clegg
6
7Loosely based on the Kung Fu Master driver.
8
9****************************************************************************/
10
11#include "driver.h"
12#include "audio/irem.h"
13
14extern UINT8 *yard_scroll_x_low;
15extern UINT8 *yard_scroll_x_high;
16extern UINT8 *yard_scroll_y_low;
17extern UINT8 *yard_score_panel_disabled;
18
19extern WRITE8_HANDLER( yard_videoram_w );
20extern WRITE8_HANDLER( yard_scroll_panel_w );
21
22extern PALETTE_INIT( yard );
23extern VIDEO_START( yard );
24extern VIDEO_UPDATE( yard );
25
26/* Read/Write Handlers */
27
28static WRITE8_HANDLER( yard_flipscreen_w )
29{
30   flip_screen_set((data & 0x01) ^ (~readinputport(4) & 0x01));
31
32   coin_counter_w(0, data & 0x02);
33   coin_counter_w(1, data & 0x20);
34}
35
36/* Memory Map */
37
38static ADDRESS_MAP_START( yard_map, ADDRESS_SPACE_PROGRAM, 8 )
39   AM_RANGE(0x0000, 0x5fff) AM_ROM
40   AM_RANGE(0x8000, 0x8fff) AM_RAM AM_WRITE(yard_videoram_w) AM_BASE(&videoram)
41   AM_RANGE(0x9000, 0x9fff) AM_WRITE(yard_scroll_panel_w)
42   AM_RANGE(0xc820, 0xc87f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
43   AM_RANGE(0xa000, 0xa000) AM_RAM AM_BASE(&yard_scroll_x_low)
44   AM_RANGE(0xa200, 0xa200) AM_RAM AM_BASE(&yard_scroll_x_high)
45   AM_RANGE(0xa400, 0xa400) AM_RAM AM_BASE(&yard_scroll_y_low)
46   AM_RANGE(0xa800, 0xa800) AM_RAM AM_BASE(&yard_score_panel_disabled)
47   AM_RANGE(0xd000, 0xd000) AM_READWRITE(input_port_0_r, irem_sound_cmd_w)
48   AM_RANGE(0xd001, 0xd001) AM_READWRITE(input_port_1_r, yard_flipscreen_w)
49   AM_RANGE(0xd002, 0xd002) AM_READ(input_port_2_r)
50   AM_RANGE(0xd003, 0xd003) AM_READ(input_port_3_r)
51   AM_RANGE(0xd004, 0xd004) AM_READ(input_port_4_r)
52   AM_RANGE(0xe000, 0xefff) AM_RAM
53ADDRESS_MAP_END
54
55/* Input Ports */
56
57static INPUT_PORTS_START( yard )
58   PORT_START_TAG("IN0")
59   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
60   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
61   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(19) // coin input must be active for 19 frames to be consistently recognized
62   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 )
63   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
64   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
65   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
66   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
67
68   PORT_START_TAG("IN1")
69   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
70   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  ) PORT_8WAY
71   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_8WAY
72   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY
73   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
74   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
75   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
76   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 )
77
78   PORT_START_TAG("IN2")
79   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
80   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  ) PORT_8WAY PORT_COCKTAIL
81   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  ) PORT_8WAY PORT_COCKTAIL
82   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    ) PORT_8WAY PORT_COCKTAIL
83   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 )
84   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
85   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
86   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
87
88   PORT_START_TAG("DSW1")
89   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Allow_Continue ) )
90   PORT_DIPSETTING(   0x01, DEF_STR( Off ) )
91   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
92   PORT_DIPNAME( 0x02, 0x02, "Defensive Man Pause" )
93   PORT_DIPSETTING(   0x02, DEF_STR( Off ) )
94   PORT_DIPSETTING(   0x00, DEF_STR( On ) )
95   PORT_DIPNAME( 0x0c, 0x0c, "Time Reduced by Ball Dead" )
96   PORT_DIPSETTING(    0x0c, DEF_STR( Normal ) )
97   PORT_DIPSETTING(    0x08, "x1.3" )
98   PORT_DIPSETTING(    0x04, "x1.5" )
99   PORT_DIPSETTING(    0x00, "x1.8" )
100    // coin mode 1
101    PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) )      PORT_CONDITION("DSW2", 0x04, PORTCOND_NOTEQUALS, 0x00)
102    PORT_DIPSETTING(    0xa0, DEF_STR( 6C_1C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_NOTEQUALS, 0x00)
103    PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_NOTEQUALS, 0x00)
104    PORT_DIPSETTING(    0xc0, DEF_STR( 4C_1C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_NOTEQUALS, 0x00)
105    PORT_DIPSETTING(    0xd0, DEF_STR( 3C_1C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_NOTEQUALS, 0x00)
106    PORT_DIPSETTING(    0xe0, DEF_STR( 2C_1C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_NOTEQUALS, 0x00)
107    PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_NOTEQUALS, 0x00)
108    PORT_DIPSETTING(    0x70, DEF_STR( 1C_2C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_NOTEQUALS, 0x00)
109    PORT_DIPSETTING(    0x60, DEF_STR( 1C_3C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_NOTEQUALS, 0x00)
110    PORT_DIPSETTING(    0x50, DEF_STR( 1C_4C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_NOTEQUALS, 0x00)
111    PORT_DIPSETTING(    0x40, DEF_STR( 1C_5C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_NOTEQUALS, 0x00)
112    PORT_DIPSETTING(    0x30, DEF_STR( 1C_6C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_NOTEQUALS, 0x00)
113    PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )    PORT_CONDITION("DSW2", 0x04, PORTCOND_NOTEQUALS, 0x00)
114    // coin mode 2
115    PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )       PORT_CONDITION("DSW2", 0x04, PORTCOND_EQUALS, 0x00)
116    PORT_DIPSETTING(    0x10, DEF_STR( 3C_1C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_EQUALS, 0x00)
117    PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_EQUALS, 0x00)
118    PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_EQUALS, 0x00)
119    PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )    PORT_CONDITION("DSW2", 0x04, PORTCOND_EQUALS, 0x00)
120    PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )       PORT_CONDITION("DSW2", 0x04, PORTCOND_EQUALS, 0x00)
121    PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_EQUALS, 0x00)
122    PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_EQUALS, 0x00)
123    PORT_DIPSETTING(    0x40, DEF_STR( 1C_5C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_EQUALS, 0x00)
124    PORT_DIPSETTING(    0x00, DEF_STR( 1C_6C ) )        PORT_CONDITION("DSW2", 0x04, PORTCOND_EQUALS, 0x00)
125
126   PORT_START_TAG("DSW2")
127   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
128   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
129   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
130   PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
131   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
132   PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
133   PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
134   PORT_DIPSETTING(    0x04, "Mode 1" )
135   PORT_DIPSETTING(    0x00, "Mode 2" )
136   PORT_DIPNAME( 0x08, 0x08, "Slow Motion" )
137   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
138   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
139   PORT_DIPNAME( 0x10, 0x10, "Stop Mode" )
140   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
141   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
142   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Level_Select ) )
143   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
144   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
145   PORT_DIPNAME( 0x40, 0x40, "Invulnerability" )
146   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
147   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
148   PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
149INPUT_PORTS_END
150
151static INPUT_PORTS_START( vsyard )
152   PORT_INCLUDE(yard)
153
154   PORT_MODIFY("DSW1")
155   PORT_DIPNAME( 0x01, 0x00, "Allow Continue (Vs. Mode)" )
156   PORT_DIPSETTING( 0x01, DEF_STR( No ) )
157   PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
158INPUT_PORTS_END
159
160/* Graphics Layouts */
161
162static const gfx_layout charlayout =
163{
164   8, 8,
165   RGN_FRAC(1,3),
166   3,
167   { RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) },
168   { 0, 1, 2, 3, 4, 5, 6, 7 },
169   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
170   8*8
171};
172
173static const gfx_layout spritelayout =
174{
175   16, 16,
176   RGN_FRAC(1,3),
177   3,
178   { RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) },
179   { 0, 1, 2, 3, 4, 5, 6, 7,
180     16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7 },
181   { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
182     8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
183   32*8
184};
185
186/* Graphics Decode Information */
187
188static GFXDECODE_START( yard )
189   GFXDECODE_ENTRY( REGION_GFX1, 0, charlayout,      0, 32 )   // use colors 0-255
190   GFXDECODE_ENTRY( REGION_GFX2, 0, spritelayout, 32*8, 32 )   // use colors 256-271 with lookup table
191GFXDECODE_END// bitmapped radar uses colors 272-527
192
193
194/* Machine Driver */
195
196static MACHINE_DRIVER_START( yard )
197   // basic machine hardware
198   MDRV_CPU_ADD(Z80, 4000000)   // ???
199   MDRV_CPU_PROGRAM_MAP(yard_map, 0)
200   MDRV_CPU_VBLANK_INT(irq0_line_hold, 1)
201
202   MDRV_SCREEN_REFRESH_RATE(57)
203   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1790))
204   /* accurate frequency, measured on a Moon Patrol board, is 56.75Hz.
205       the Lode Runner manual (similar but different hardware)
206       talks about 55Hz and 1790ms vblank duration. */
207
208   // video hardware
209   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
210   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
211   MDRV_SCREEN_SIZE(32*8, 32*8)
212   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
213   MDRV_GFXDECODE(yard)
214   MDRV_PALETTE_LENGTH(256+16+256)
215   MDRV_COLORTABLE_LENGTH(32*8+32*8)
216
217   MDRV_PALETTE_INIT(yard)
218   MDRV_VIDEO_START(yard)
219   MDRV_VIDEO_UPDATE(yard)
220
221   // sound hardware
222   MDRV_IMPORT_FROM(irem_audio)
223MACHINE_DRIVER_END
224
225/* ROMs */
226ROM_START( 10yard )
227   ROM_REGION( 0x10000, REGION_CPU1, 0 )
228   ROM_LOAD( "yf-a-3p-b",    0x0000, 0x2000, CRC(2e205ec2) SHA1(fcfa08f45423b35f2c99d4e6b5474ab1b3a84fec) )
229   ROM_LOAD( "yf-a-3n-b",    0x2000, 0x2000, CRC(82fcd980) SHA1(7846705b29961cb95ee1571ee7e16baceea522d4) )
230   ROM_LOAD( "yf-a-3m-b",    0x4000, 0x2000, CRC(a8d5c311) SHA1(28edb5cfd943a2262d7e37ef9a7245f7017cbc51) )
231
232   ROM_REGION( 0x10000, REGION_CPU2, 0 )
233   ROM_LOAD( "yf-s.3b",      0x8000, 0x2000, CRC(0392a60c) SHA1(68030504eafc58db250099edd3c3323bdb9eff6b) )
234   ROM_LOAD( "yf-s.1b",      0xa000, 0x2000, CRC(6588f41a) SHA1(209305efc68171886427216b9a0b37333f40daa8) )
235   ROM_LOAD( "yf-s.3a",      0xc000, 0x2000, CRC(bd054e44) SHA1(f10c32c70d60680229fc0891d0e1308015fa69d6) )
236   ROM_LOAD( "yf-s.1a",      0xe000, 0x2000, CRC(2490d4c3) SHA1(e4da7b01e8ad075b7e3c8beb6668faff72db9aa2) )
237
238   ROM_REGION( 0x06000, REGION_GFX1, ROMREGION_DISPOSE )
239   ROM_LOAD( "yf-a.3e",      0x00000, 0x2000, CRC(77e9e9cc) SHA1(90b0226fc125713dbee2804aeceeb5aa2c8e275e) )   /* chars */
240   ROM_LOAD( "yf-a.3d",      0x02000, 0x2000, CRC(854d5ff4) SHA1(9ba09bfabf159facb57faecfe73a6258fa48d152) )
241   ROM_LOAD( "yf-a.3c",      0x04000, 0x2000, CRC(0cd8ffad) SHA1(bd1262de3823c34f7394b718477fb5bc58a6e293) )
242
243   ROM_REGION( 0x0c000, REGION_GFX2, ROMREGION_DISPOSE )
244   ROM_LOAD( "yf-b.5b",      0x00000, 0x2000, CRC(1299ae30) SHA1(07d47f827d8bc78a41011ec02ab64036fb8a7a18) )   /* sprites */
245   ROM_LOAD( "yf-b.5c",      0x02000, 0x2000, CRC(8708b888) SHA1(8c4f305a339f23ec8ed40dfd72fac0f62ee65378) )
246   ROM_LOAD( "yf-b.5f",      0x04000, 0x2000, CRC(d9bb8ab8) SHA1(1325308b4c85355298fec4aa3e5fec1b4b13ad86) )
247   ROM_LOAD( "yf-b.5e",      0x06000, 0x2000, CRC(47077e8d) SHA1(5f78b15fb360e9926ef11841d5d86f2bd9af04d1) )
248   ROM_LOAD( "yf-b.5j",      0x08000, 0x2000, CRC(713ef31f) SHA1(b48df9ed4f26fded3c7eaac3a52b580b2dd60477) )
249   ROM_LOAD( "yf-b.5k",      0x0a000, 0x2000, CRC(f49651cc) SHA1(5b87d7360bcd5883ec265b2a01a3e02e10a85345) )
250
251   ROM_REGION( 0x0520, REGION_PROMS, 0 )
252   ROM_LOAD( "yard.1c",      0x0000, 0x0100, CRC(08fa5103) SHA1(98af48dafbbaa42f58232bf74ccbf5da41723e71) ) /* chars palette low 4 bits */
253   ROM_LOAD( "yard.1d",      0x0100, 0x0100, CRC(7c04994c) SHA1(790bf1616335b9df4943cffcafa48d8e8aee009e) ) /* chars palette high 4 bits */
254   ROM_LOAD( "yard.1f",      0x0200, 0x0020, CRC(b8554da5) SHA1(963ca815b5f791b8a7b0937a5d392d5203049eb3) ) /* sprites palette */
255   ROM_LOAD( "yard.2h",      0x0220, 0x0100, CRC(e1cdfb06) SHA1(a8cc3456cfc272e3faac80370b2298d8e1f8c2fe) ) /* sprites lookup table */
256   ROM_LOAD( "yard.2n",      0x0320, 0x0100, CRC(cd85b646) SHA1(5268db705006058eec308afe474f4df3c15465bb) ) /* radar palette low 4 bits */
257   ROM_LOAD( "yard.2m",      0x0420, 0x0100, CRC(45384397) SHA1(e4c662ee81aef63efd8b4a45f85c4a78dc2d419e) ) /* radar palette high 4 bits */
258ROM_END
259
260ROM_START( 10yardj )
261   ROM_REGION( 0x10000, REGION_CPU1, 0 )
262   ROM_LOAD( "yf-a.3p",      0x0000, 0x2000, CRC(4586114f) SHA1(a31c68770e7a7eed805c5ba46af302c2895e3cee) )
263   ROM_LOAD( "yf-a.3n",      0x2000, 0x2000, CRC(947fa760) SHA1(bd6c2ee6e6800b063b81dbdd9fc929120019439d) )
264   ROM_LOAD( "yf-a.3m",      0x4000, 0x2000, CRC(d4975633) SHA1(84a506ae680a9dd26ef6f33880400e965ccf8260) )
265
266   ROM_REGION( 0x10000, REGION_CPU2, 0 )
267   ROM_LOAD( "yf-s.3b",      0x8000, 0x2000, CRC(0392a60c) SHA1(68030504eafc58db250099edd3c3323bdb9eff6b) )
268   ROM_LOAD( "yf-s.1b",      0xa000, 0x2000, CRC(6588f41a) SHA1(209305efc68171886427216b9a0b37333f40daa8) )
269   ROM_LOAD( "yf-s.3a",      0xc000, 0x2000, CRC(bd054e44) SHA1(f10c32c70d60680229fc0891d0e1308015fa69d6) )
270   ROM_LOAD( "yf-s.1a",      0xe000, 0x2000, CRC(2490d4c3) SHA1(e4da7b01e8ad075b7e3c8beb6668faff72db9aa2) )
271
272   ROM_REGION( 0x06000, REGION_GFX1, ROMREGION_DISPOSE )
273   ROM_LOAD( "yf-a.3e",      0x00000, 0x2000, CRC(77e9e9cc) SHA1(90b0226fc125713dbee2804aeceeb5aa2c8e275e) )   /* chars */
274   ROM_LOAD( "yf-a.3d",      0x02000, 0x2000, CRC(854d5ff4) SHA1(9ba09bfabf159facb57faecfe73a6258fa48d152) )
275   ROM_LOAD( "yf-a.3c",      0x04000, 0x2000, CRC(0cd8ffad) SHA1(bd1262de3823c34f7394b718477fb5bc58a6e293) )
276
277   ROM_REGION( 0x0c000, REGION_GFX2, ROMREGION_DISPOSE )
278   ROM_LOAD( "yf-b.5b",      0x00000, 0x2000, CRC(1299ae30) SHA1(07d47f827d8bc78a41011ec02ab64036fb8a7a18) )   /* sprites */
279   ROM_LOAD( "yf-b.5c",      0x02000, 0x2000, CRC(8708b888) SHA1(8c4f305a339f23ec8ed40dfd72fac0f62ee65378) )
280   ROM_LOAD( "yf-b.5f",      0x04000, 0x2000, CRC(d9bb8ab8) SHA1(1325308b4c85355298fec4aa3e5fec1b4b13ad86) )
281   ROM_LOAD( "yf-b.5e",      0x06000, 0x2000, CRC(47077e8d) SHA1(5f78b15fb360e9926ef11841d5d86f2bd9af04d1) )
282   ROM_LOAD( "yf-b.5j",      0x08000, 0x2000, CRC(713ef31f) SHA1(b48df9ed4f26fded3c7eaac3a52b580b2dd60477) )
283   ROM_LOAD( "yf-b.5k",      0x0a000, 0x2000, CRC(f49651cc) SHA1(5b87d7360bcd5883ec265b2a01a3e02e10a85345) )
284
285   ROM_REGION( 0x0520, REGION_PROMS, 0 )
286   ROM_LOAD( "yard.1c",      0x0000, 0x0100, CRC(08fa5103) SHA1(98af48dafbbaa42f58232bf74ccbf5da41723e71) ) /* chars palette low 4 bits */
287   ROM_LOAD( "yard.1d",      0x0100, 0x0100, CRC(7c04994c) SHA1(790bf1616335b9df4943cffcafa48d8e8aee009e) ) /* chars palette high 4 bits */
288   ROM_LOAD( "yard.1f",      0x0200, 0x0020, CRC(b8554da5) SHA1(963ca815b5f791b8a7b0937a5d392d5203049eb3) ) /* sprites palette */
289   ROM_LOAD( "yard.2h",      0x0220, 0x0100, CRC(e1cdfb06) SHA1(a8cc3456cfc272e3faac80370b2298d8e1f8c2fe) ) /* sprites lookup table */
290   ROM_LOAD( "yard.2n",      0x0320, 0x0100, CRC(cd85b646) SHA1(5268db705006058eec308afe474f4df3c15465bb) ) /* radar palette low 4 bits */
291   ROM_LOAD( "yard.2m",      0x0420, 0x0100, CRC(45384397) SHA1(e4c662ee81aef63efd8b4a45f85c4a78dc2d419e) ) /* radar palette high 4 bits */
292ROM_END
293
294ROM_START( vs10yard )
295   ROM_REGION( 0x10000, REGION_CPU1, 0 )
296   ROM_LOAD( "a.3p",         0x0000, 0x2000, CRC(1edac08f) SHA1(c6a3290e9dba663dccf0613853abfab8e912477d) )
297   ROM_LOAD( "vyf-a.3m",     0x2000, 0x2000, CRC(3b9330f8) SHA1(b35fe72cf724cfb887906060bbcf40b0c896ccf0) )
298   ROM_LOAD( "a.3m",         0x4000, 0x2000, CRC(cf783dad) SHA1(0b1b875ac65ba90c92ca06d0aa01c477b7427322) )
299
300   ROM_REGION( 0x10000, REGION_CPU2, 0 )
301   ROM_LOAD( "yf-s.3b",      0x8000, 0x2000, CRC(0392a60c) SHA1(68030504eafc58db250099edd3c3323bdb9eff6b) )
302   ROM_LOAD( "yf-s.1b",      0xa000, 0x2000, CRC(6588f41a) SHA1(209305efc68171886427216b9a0b37333f40daa8) )
303   ROM_LOAD( "yf-s.3a",      0xc000, 0x2000, CRC(bd054e44) SHA1(f10c32c70d60680229fc0891d0e1308015fa69d6) )
304   ROM_LOAD( "yf-s.1a",      0xe000, 0x2000, CRC(2490d4c3) SHA1(e4da7b01e8ad075b7e3c8beb6668faff72db9aa2) )
305
306   ROM_REGION( 0x06000, REGION_GFX1, ROMREGION_DISPOSE )
307   ROM_LOAD( "vyf-a.3a",     0x00000, 0x2000, CRC(354d7330) SHA1(0dac87e502d5e9089c4e5ca87c7626940a17e9b2) )   /* chars */
308   ROM_LOAD( "vyf-a.3c",     0x02000, 0x2000, CRC(f48eedca) SHA1(6aef3208de8b1dd4078de20c0b5ce96219c79d40) )
309   ROM_LOAD( "vyf-a.3d",     0x04000, 0x2000, CRC(7d1b4d93) SHA1(9389de1230b93f529c492af6fb911c00280cae8a) )
310
311   ROM_REGION( 0x0c000, REGION_GFX2, ROMREGION_DISPOSE )
312   ROM_LOAD( "yf-b.5b",      0x00000, 0x2000, CRC(1299ae30) SHA1(07d47f827d8bc78a41011ec02ab64036fb8a7a18) )   /* sprites */
313   ROM_LOAD( "yf-b.5c",      0x02000, 0x2000, CRC(8708b888) SHA1(8c4f305a339f23ec8ed40dfd72fac0f62ee65378) )
314   ROM_LOAD( "yf-b.5f",      0x04000, 0x2000, CRC(d9bb8ab8) SHA1(1325308b4c85355298fec4aa3e5fec1b4b13ad86) )
315   ROM_LOAD( "yf-b.5e",      0x06000, 0x2000, CRC(47077e8d) SHA1(5f78b15fb360e9926ef11841d5d86f2bd9af04d1) )
316   ROM_LOAD( "yf-b.5j",      0x08000, 0x2000, CRC(713ef31f) SHA1(b48df9ed4f26fded3c7eaac3a52b580b2dd60477) )
317   ROM_LOAD( "yf-b.5k",      0x0a000, 0x2000, CRC(f49651cc) SHA1(5b87d7360bcd5883ec265b2a01a3e02e10a85345) )
318
319   ROM_REGION( 0x0520, REGION_PROMS, 0 )
320   ROM_LOAD( "yard.1c",      0x0000, 0x0100, CRC(08fa5103) SHA1(98af48dafbbaa42f58232bf74ccbf5da41723e71) ) /* chars palette low 4 bits */
321   ROM_LOAD( "yard.1d",      0x0100, 0x0100, CRC(7c04994c) SHA1(790bf1616335b9df4943cffcafa48d8e8aee009e) ) /* chars palette high 4 bits */
322   ROM_LOAD( "yard.1f",      0x0200, 0x0020, CRC(b8554da5) SHA1(963ca815b5f791b8a7b0937a5d392d5203049eb3) ) /* sprites palette */
323   ROM_LOAD( "yard.2h",      0x0220, 0x0100, CRC(e1cdfb06) SHA1(a8cc3456cfc272e3faac80370b2298d8e1f8c2fe) ) /* sprites lookup table */
324   ROM_LOAD( "yard.2n",      0x0320, 0x0100, CRC(cd85b646) SHA1(5268db705006058eec308afe474f4df3c15465bb) ) /* radar palette low 4 bits */
325   ROM_LOAD( "yard.2m",      0x0420, 0x0100, CRC(45384397) SHA1(e4c662ee81aef63efd8b4a45f85c4a78dc2d419e) ) /* radar palette high 4 bits */
326ROM_END
327
328ROM_START( vs10yarj )
329   ROM_REGION( 0x10000, REGION_CPU1, 0 )
330   ROM_LOAD( "vyf-a.3n",     0x0000, 0x2000, CRC(418e01fc) SHA1(56a6515735cd88ec803e24574a28aef823a5d36b) )
331   ROM_LOAD( "vyf-a.3m",     0x2000, 0x2000, CRC(3b9330f8) SHA1(b35fe72cf724cfb887906060bbcf40b0c896ccf0) )
332   ROM_LOAD( "vyf-a.3k",     0x4000, 0x2000, CRC(a0ec15bb) SHA1(a5ce9341e9d05e33c025ac62a27faf738c88326e) )
333
334   ROM_REGION( 0x10000, REGION_CPU2, 0 )
335   ROM_LOAD( "yf-s.3b",      0x8000, 0x2000, CRC(0392a60c) SHA1(68030504eafc58db250099edd3c3323bdb9eff6b) )
336   ROM_LOAD( "yf-s.1b",      0xa000, 0x2000, CRC(6588f41a) SHA1(209305efc68171886427216b9a0b37333f40daa8) )
337   ROM_LOAD( "yf-s.3a",      0xc000, 0x2000, CRC(bd054e44) SHA1(f10c32c70d60680229fc0891d0e1308015fa69d6) )
338   ROM_LOAD( "yf-s.1a",      0xe000, 0x2000, CRC(2490d4c3) SHA1(e4da7b01e8ad075b7e3c8beb6668faff72db9aa2) )
339
340   ROM_REGION( 0x06000, REGION_GFX1, ROMREGION_DISPOSE )
341   ROM_LOAD( "vyf-a.3a",     0x00000, 0x2000, CRC(354d7330) SHA1(0dac87e502d5e9089c4e5ca87c7626940a17e9b2) )   /* chars */
342   ROM_LOAD( "vyf-a.3c",     0x02000, 0x2000, CRC(f48eedca) SHA1(6aef3208de8b1dd4078de20c0b5ce96219c79d40) )
343   ROM_LOAD( "vyf-a.3d",     0x04000, 0x2000, CRC(7d1b4d93) SHA1(9389de1230b93f529c492af6fb911c00280cae8a) )
344
345   ROM_REGION( 0x0c000, REGION_GFX2, ROMREGION_DISPOSE )
346   ROM_LOAD( "yf-b.5b",      0x00000, 0x2000, CRC(1299ae30) SHA1(07d47f827d8bc78a41011ec02ab64036fb8a7a18) )   /* sprites */
347   ROM_LOAD( "yf-b.5c",      0x02000, 0x2000, CRC(8708b888) SHA1(8c4f305a339f23ec8ed40dfd72fac0f62ee65378) )
348   ROM_LOAD( "yf-b.5f",      0x04000, 0x2000, CRC(d9bb8ab8) SHA1(1325308b4c85355298fec4aa3e5fec1b4b13ad86) )
349   ROM_LOAD( "yf-b.5e",      0x06000, 0x2000, CRC(47077e8d) SHA1(5f78b15fb360e9926ef11841d5d86f2bd9af04d1) )
350   ROM_LOAD( "yf-b.5j",      0x08000, 0x2000, CRC(713ef31f) SHA1(b48df9ed4f26fded3c7eaac3a52b580b2dd60477) )
351   ROM_LOAD( "yf-b.5k",      0x0a000, 0x2000, CRC(f49651cc) SHA1(5b87d7360bcd5883ec265b2a01a3e02e10a85345) )
352
353   ROM_REGION( 0x0520, REGION_PROMS, 0 )
354   ROM_LOAD( "yard.1c",      0x0000, 0x0100, CRC(08fa5103) SHA1(98af48dafbbaa42f58232bf74ccbf5da41723e71) ) /* chars palette low 4 bits */
355   ROM_LOAD( "yard.1d",      0x0100, 0x0100, CRC(7c04994c) SHA1(790bf1616335b9df4943cffcafa48d8e8aee009e) ) /* chars palette high 4 bits */
356   ROM_LOAD( "yard.1f",      0x0200, 0x0020, CRC(b8554da5) SHA1(963ca815b5f791b8a7b0937a5d392d5203049eb3) ) /* sprites palette */
357   ROM_LOAD( "yard.2h",      0x0220, 0x0100, CRC(e1cdfb06) SHA1(a8cc3456cfc272e3faac80370b2298d8e1f8c2fe) ) /* sprites lookup table */
358   ROM_LOAD( "yard.2n",      0x0320, 0x0100, CRC(cd85b646) SHA1(5268db705006058eec308afe474f4df3c15465bb) ) /* radar palette low 4 bits */
359   ROM_LOAD( "yard.2m",      0x0420, 0x0100, CRC(45384397) SHA1(e4c662ee81aef63efd8b4a45f85c4a78dc2d419e) ) /* radar palette high 4 bits */
360ROM_END
361
362/* Game Drivers */
363
364GAME( 1983, 10yard,        0, yard, yard,   0, ROT0, "Irem", "10-Yard Fight (World)", 0 )
365GAME( 1983, 10yardj,  10yard, yard, yard,   0, ROT0, "Irem", "10-Yard Fight (Japan)", 0 )
366GAME( 1984, vs10yard, 10yard, yard, vsyard, 0, ROT0, "Irem", "Vs 10-Yard Fight (World, 11/05/84)", 0 )
367GAME( 1984, vs10yarj, 10yard, yard, vsyard, 0, ROT0, "Irem", "Vs 10-Yard Fight (Japan)", 0 )
src/mame/drivers/galgames.c
r1768r1769
1/*
2Galaxy Games
3
4----
5
6This is a multi-game coctail cabinet released in 1998.  Namco seems to have
7made some cartridges for it (or at least licensed their IP).
8
9Trackball-based.  'BIOS' has 7 built-in games.  There are two LEDs on the PCB.
10
11More information here : http://www.cesgames.com/museum/galaxy/index.html
12
13----
14
15Board silkscreend  237-0211-00
16                   REV.-D
17
18Cartridge based mother board
19Holds up to 4 cartridges
20Chips labeled
21    GALAXY U1 V1.90 12/1/98
22    GALAXY U2 V1.90 12/1/98
23
24NAMCO 307 Cartridge has surface mount Flash chips in it (not dumped?).
25
26Looks like it requires a medium resolution monitor
27
28Motorola MC68HC000FN12
2924 MHz oscillator
30Xilinx XC5206
31Xilinx XC5202
32BT481AKPJ110
33NKK N341024SJ-15    x8  (128kb RAM)
34OKI M6295 8092352-2
35
36PAL16V8H-15 @ U24   Blue dot on it
37PAL16V8H-15 @ U25   Yellow dot on it
38PAL16V8H-15 @ U26   Red dot on it
39PAL16V8H-15 @ U27   Green dot on it
40PAL16V8H-15 @ U45   red dot on it
41
42----
43
44There are a few built-in games on the hardware, so the driver can grow mature without carts dumped.
45
46TODO : This is a skeleton driver.  Just about everything.
47
48*/
49
50#include <stdio.h>
51#include "driver.h"
52#include "video/generic.h"
53
54static READ16_HANDLER( dummy_read_01 )
55{
56   return 0x3;            // Pass the check at PC = 0x00000FAE & a later one
57}
58
59static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
60   AM_RANGE(0x000000, 0x1fffff) AM_ROM
61/*  AM_RANGE(0x01a900, 0x01a9ff) AM_RAM                         Need to install memory handlers
62    ...                                                         in the middle of the ROM space?
63    AM_RANGE(0x01f700, 0x01f7ff) AM_RAM */
64   AM_RANGE(0x200000, 0x23ffff) AM_RAM                     /* 2x N341024SJ-15 */
65   AM_RANGE(0x400000, 0x400001) AM_RAM
66   AM_RANGE(0x600000, 0x600001) AM_READ(dummy_read_01)
67   AM_RANGE(0x700000, 0x700001) AM_RAM                     /* Writes a 0x0002 here early, reads it later */
68   AM_RANGE(0x900000, 0x900001) AM_NOP                     /* Writes 0xffff here before each test memory access. */
69   AM_RANGE(0xb00000, 0xb7ffff) AM_RAM                     /* 4x N341024SJ-15 */
70   AM_RANGE(0xd00000, 0xd00001) AM_RAM
71ADDRESS_MAP_END
72
73
74static INPUT_PORTS_START( galgames )
75INPUT_PORTS_END
76
77
78static MACHINE_DRIVER_START( galgames )
79   MDRV_CPU_ADD_TAG("main", M68000, XTAL_24MHz)
80   MDRV_CPU_PROGRAM_MAP(main_map,0)
81   //MDRV_CPU_VBLANK_INT(main_int, 2)
82
83   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
84   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
85
86   MDRV_SCREEN_REFRESH_RATE(60)
87   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
88
89   MDRV_SCREEN_SIZE(640, 480)
90   MDRV_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
91   MDRV_PALETTE_LENGTH(0x100)
92
93   MDRV_VIDEO_START(generic_bitmapped)
94   MDRV_VIDEO_UPDATE(generic_bitmapped)
95MACHINE_DRIVER_END
96
97
98ROM_START( galgbios )
99   ROM_REGION( 0x200000, REGION_CPU1, 0 )
100   ROM_LOAD16_BYTE( "galaxy.u2", 0x000000, 0x100000, CRC(e51ff184) SHA1(aaa795f2c15ec29b3ceeb5c917b643db0dbb7083) )
101   ROM_LOAD16_BYTE( "galaxy.u1", 0x000001, 0x100000, CRC(c6d7bc6d) SHA1(93c032f9aa38cbbdda59a8a25ff9f38f7ad9c760) )
102ROM_END
103
104
105/* System board BIOS */
106/*    YEAR  NAME      PARENT  MACHINE   INPUT     INIT MONITOR COMPANY                FULLNAME             FLAGS */
107GAME( 1998, galgbios, 0,      galgames, galgames, 0,   ROT0,   "Creative Electonics", "Galaxy Games BIOS", GAME_NOT_WORKING | GAME_IS_BIOS_ROOT )
src/osd/windows/verinfo.c
r1768r1769
1//============================================================
2//
3//  verinfo.c - Version resource emitter code
4//
5//  Copyright Nicola Salmoria and the MAME Team.
6//  Visit http://mamedev.org for licensing and usage restrictions.
7//
8//============================================================
9
10#include <stdio.h>
11#include <ctype.h>
12
13#include "osdcore.h"
14
15
16//============================================================
17//  TYPE DEFINITIONS
18//============================================================
19
20typedef struct _version_info version_info;
21struct _version_info
22{
23   int version_major;
24   int version_minor;
25   int version_build;
26   int version_subbuild;
27   const char *version_string;
28   const char *author;
29   const char *comments;
30   const char *company_name;
31   const char *file_description;
32   const char *internal_name;
33   const char *legal_copyright;
34   const char *original_filename;
35   const char *product_name;
36};
37
38
39
40//============================================================
41//  emit_version_info
42//============================================================
43
44static void emit_version_info(const version_info *v)
45{
46   printf("VS_VERSION_INFO VERSIONINFO\n");
47   printf("\tFILEVERSION %d,%d,%d,%d\n", v->version_major, v->version_minor, v->version_build, v->version_subbuild);
48   printf("\tPRODUCTVERSION %d,%d,%d,%d\n", v->version_major, v->version_minor, v->version_build, v->version_subbuild);
49   printf("\tFILEFLAGSMASK 0x3fL\n");
50#ifdef MAME_DEBUG
51   if (v->version_build == 0)
52      printf("\tFILEFLAGS VS_FF_DEBUG\n");
53   else
54      printf("\tFILEFLAGS VS_FF_PRERELEASE | VS_FF_DEBUG\n");
55#else
56   if (v->version_build == 0)
57      printf("\tFILEFLAGS 0x0L\n");
58   else
59      printf("\tFILEFLAGS VS_FF_PRERELEASE\n");
60#endif
61   printf("\tFILEOS VOS_NT_WINDOWS32\n");
62   printf("\tFILETYPE VFT_APP\n");
63   printf("\tFILESUBTYPE VFT2_UNKNOWN\n");
64   printf("BEGIN\n");
65   printf("\tBLOCK \"StringFileInfo\"\n");
66   printf("\tBEGIN\n");
67   printf("#ifdef UNICODE\n");
68   printf("\t\tBLOCK \"040904b0\"\n");
69   printf("#else\n");
70   printf("\t\tBLOCK \"040904E4\"\n");
71   printf("#endif\n");
72   printf("\t\tBEGIN\n");
73   if (v->author != NULL)
74      printf("\t\t\tVALUE \"Author\", \"%s\\0\"\n", v->author);
75   if (v->comments != NULL)
76      printf("\t\t\tVALUE \"Comments\", \"%s\\0\"\n", v->comments);
77   if (v->company_name != NULL)
78      printf("\t\t\tVALUE \"CompanyName\", \"%s\\0\"\n", v->company_name);
79   if (v->file_description != NULL)
80      printf("\t\t\tVALUE \"FileDescription\", \"%s\\0\"\n", v->file_description);
81   printf("\t\t\tVALUE \"FileVersion\", \"%d, %d, %d, %d\\0\"\n", v->version_major, v->version_minor, v->version_build, v->version_subbuild);
82   if (v->internal_name != NULL)
83      printf("\t\t\tVALUE \"InternalName\", \"%s\\0\"\n", v->internal_name);
84   if (v->legal_copyright != NULL)
85      printf("\t\t\tVALUE \"LegalCopyright\", \"%s\\0\"\n", v->legal_copyright);
86   if (v->original_filename != NULL)
87      printf("\t\t\tVALUE \"OriginalFilename\", \"%s\\0\"\n", v->original_filename);
88   if (v->product_name != NULL)
89      printf("\t\t\tVALUE \"ProductName\", \"%s\\0\"\n", v->product_name);
90   printf("\t\t\tVALUE \"ProductVersion\", \"%s\\0\"\n", v->version_string);
91   printf("\t\tEND\n");
92   printf("\tEND\n");
93   printf("\tBLOCK \"VarFileInfo\"\n");
94   printf("\tBEGIN\n");
95   printf("#ifdef UNICODE\n");
96   printf("\t\tVALUE \"Translation\", 0x409, 1200\n");
97   printf("#else\n");
98   printf("\t\tVALUE \"Translation\", 0x409, 1252\n");
99   printf("#endif\n");
100   printf("\tEND\n");
101   printf("END\n");
102}
103
104
105
106//============================================================
107//  parse_version_digit
108//============================================================
109
110static int parse_version_digit(const char *str, int *position)
111{
112   int value = 0;
113
114   while (str[*position] != 0 && !isspace(str[*position]) && !isdigit(str[*position]))
115      (*position)++;
116
117   if (str[*position] != 0 && isdigit(str[*position]))
118   {
119      sscanf(&str[*position], "%d", &value);
120      while (isdigit(str[*position]))
121         (*position)++;
122   }
123   return value;
124}
125
126
127
128//============================================================
129//  parse_version
130//============================================================
131
132static int parse_version(char *str, int *version_major, int *version_minor, int *version_micro, const char **version_string)
133{
134   char *version;
135   int position = 0;
136
137   // find the version string
138   version = strstr(str, "build_version");
139   if (version != NULL)
140      version = strchr(version, '"');
141   if (version == NULL)
142   {
143      fprintf(stderr, "Unable to find build_version string\n");
144      return 1;
145   }
146   version++;
147   *strchr(version, ' ') = 0;
148
149   *version_string = version;
150   *version_major = parse_version_digit(version, &position);
151   *version_minor = parse_version_digit(version, &position);
152   *version_micro = parse_version_digit(version, &position);
153   return 0;
154}
155
156
157
158//============================================================
159//  main
160//============================================================
161
162int main(int argc, char *argv[])
163{
164   version_info v;
165   char legal_copyright[512];
166   char *buffer;
167   size_t size;
168   FILE *f;
169
170   memset(&v, 0, sizeof(v));
171
172   // validate parameters
173   if (argc < 2)
174   {
175      printf("Usage: %s <filename>\n", argv[0]);
176      return 0;
177   }
178
179   // open the file
180   f = fopen(argv[1], "rb");
181   if (f == NULL)
182   {
183      fprintf(stderr, "Error opening file %s\n", argv[1]);
184      return 1;
185   }
186
187   // get the file size
188   fseek(f, 0, SEEK_END);
189   size = ftell(f);
190   fseek(f, 0, SEEK_SET);
191
192   // allocate a buffer
193   buffer = malloc(size + 1);
194   if (buffer == NULL)
195   {
196      fclose(f);
197      fprintf(stderr, "Error allocating %d bytes\n", size + 1);
198      return 1;
199   }
200
201   // read the file contents and NULL-terminate
202   fread(buffer, 1, size, f);
203   fclose(f);
204   buffer[size] = 0;
205
206   // parse out version string
207   if (parse_version(buffer, &v.version_major, &v.version_minor, &v.version_build, &v.version_string))
208      return 1;
209
210#ifdef MESS
211   // MESS
212   v.author = "MESS Team";
213   v.comments = "Multi Emulation Super System";
214   v.company_name = "MESS Team";
215   v.file_description = "Multi Emulation Super System";
216   v.internal_name = "MESS";
217   v.original_filename = "MESS";
218   v.product_name = "MESS";
219#elif defined(WINUI)
220   // MAMEUI
221   v.author = "Christopher Kirmse and the MAMEUI team";
222   v.comments = "Multiple Arcade Machine Emulator with GUI";
223   v.company_name = "MAME Team";
224   v.file_description = "Multiple Arcade Machine Emulator with GUI";
225   v.internal_name = "MAMEUI";
226   v.original_filename = "MAMEUI";
227   v.product_name = "MAMEUI";
228#else
229   // MAME
230   v.author = "Nicola Salmoria and the MAME Team";
231   v.comments = "Multiple Arcade Machine Emulator";
232   v.company_name = "MAME Team";
233   v.file_description = "Multiple Arcade Machine Emulator";
234   v.internal_name = "MAME";
235   v.original_filename = "MAME";
236   v.product_name = "MAME";
237#endif
238
239   // build legal_copyright string
240   v.legal_copyright = legal_copyright;
241   snprintf(legal_copyright, ARRAY_LENGTH(legal_copyright), "Copyright Nicola Salmoria and the MAME team");
242
243   // emit the info
244   emit_version_info(&v);
245
246   free(buffer);
247   return 0;
248}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team