1 #include "../vidhrdw/mystston.c"
2
3 /***************************************************************************
4
5 Mysterious Stones memory map (preliminary)
6
7 driver by Nicola Salmoria
8
9 MAIN BOARD:
10
11 0000-0fff RAM
12 1000-13ff Video RAM
13 1400-17ff Attribute RAM
14 1800-19ff Background video RAM #1
15 1a00-1bff Background attribute RAM #1
16 1c00-1fff probably scratchpad RAM, contains a copy of the background without objects
17 4000-ffff ROM
18
19 read
20 2000 IN0
21 bit 7 = coin 2 (must also cause a NMI)
22 bit 6 = coin 1 (must also cause a NMI)
23 bit 0-5 = player 1 controls
24 2010 IN1
25 bit 7 = start 2
26 bit 6 = start 1
27 bit 0-5 = player 2 controls (cocktail only)
28 2020 DSW1
29 bit 3-7 = probably unused
30 bit 2 = ?
31 bit 1 = ?
32 bit 0 = lives
33 2030 DSW2
34 bit 7 = vblank
35 bit 6 = coctail/upright (0 = upright)
36 bit 4-5 = probably unused
37 bit 0-3 = coins per play
38
39 write
40 0780-07df sprites
41 2000 Tile RAM bank select?
42 2010 Commands for the sound CPU?
43 2020 background scroll
44 2030 ?
45 2040 ?
46 2060-2077 palette
47
48 Known problems:
49
50 * Some dipswitches may not be mapped correctly.
51
52 ***************************************************************************/
53
54 #include "driver.h"
55 #include "vidhrdw/generic.h"
56 #include "cpu/m6502/m6502.h"
57
58
59
60 extern unsigned char *mystston_videoram2,*mystston_colorram2;
61 extern size_t mystston_videoram2_size;
62 extern unsigned char *mystston_scroll;
63
64 void mystston_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
65 int mystston_vh_start(void);
66 void mystston_vh_stop(void);
67 WRITE_HANDLER( mystston_2000_w );
68 void mystston_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
69
70
71
mystston_interrupt(void)72 int mystston_interrupt(void)
73 {
74 static int coin;
75
76
77 if ((readinputport(0) & 0xc0) != 0xc0)
78 {
79 if (coin == 0)
80 {
81 coin = 1;
82 return nmi_interrupt();
83 }
84 }
85 else coin = 0;
86
87 return interrupt();
88 }
89
90
91 static int psg_latch;
92
WRITE_HANDLER(mystston_8910_latch_w)93 WRITE_HANDLER( mystston_8910_latch_w )
94 {
95 psg_latch = data;
96 }
97
WRITE_HANDLER(mystston_8910_control_w)98 WRITE_HANDLER( mystston_8910_control_w )
99 {
100 static int last;
101
102
103 /* bit 5 goes to 8910 #0 BDIR pin */
104 if ((last & 0x20) == 0x20 && (data & 0x20) == 0x00)
105 {
106 /* bit 4 goes to the 8910 #0 BC1 pin */
107 if (last & 0x10)
108 AY8910_control_port_0_w(0,psg_latch);
109 else
110 AY8910_write_port_0_w(0,psg_latch);
111 }
112 /* bit 7 goes to 8910 #1 BDIR pin */
113 if ((last & 0x80) == 0x80 && (data & 0x80) == 0x00)
114 {
115 /* bit 6 goes to the 8910 #1 BC1 pin */
116 if (last & 0x40)
117 AY8910_control_port_1_w(0,psg_latch);
118 else
119 AY8910_write_port_1_w(0,psg_latch);
120 }
121
122 last = data;
123 }
124
125
126
127 static struct MemoryReadAddress readmem[] =
128 {
129 { 0x0000, 0x077f, MRA_RAM },
130 { 0x0800, 0x0fff, MRA_RAM }, /* work RAM? */
131 { 0x1000, 0x1fff, MRA_RAM },
132 { 0x2000, 0x2000, input_port_0_r },
133 { 0x2010, 0x2010, input_port_1_r },
134 { 0x2020, 0x2020, input_port_2_r },
135 { 0x2030, 0x2030, input_port_3_r },
136 { 0x4000, 0xffff, MRA_ROM },
137 { -1 } /* end of table */
138 };
139
140 static struct MemoryWriteAddress writemem[] =
141 {
142 { 0x0000, 0x077f, MWA_RAM },
143 { 0x0780, 0x07df, MWA_RAM, &spriteram, &spriteram_size },
144 { 0x0800, 0x0fff, MWA_RAM }, /* work RAM? */
145 { 0x1000, 0x13ff, MWA_RAM, &mystston_videoram2, &mystston_videoram2_size },
146 { 0x1400, 0x17ff, MWA_RAM, &mystston_colorram2 },
147 { 0x1800, 0x19ff, videoram_w, &videoram, &videoram_size },
148 { 0x1a00, 0x1bff, colorram_w, &colorram },
149 { 0x1c00, 0x1fff, MWA_RAM }, /* work RAM? This gets copied to videoram */
150 { 0x2000, 0x2000, mystston_2000_w }, /* flip screen & coin counters */
151 { 0x2010, 0x2010, watchdog_reset_w }, /* or IRQ acknowledge maybe? */
152 { 0x2020, 0x2020, MWA_RAM, &mystston_scroll },
153 { 0x2030, 0x2030, mystston_8910_latch_w },
154 { 0x2040, 0x2040, mystston_8910_control_w },
155 { 0x2060, 0x2077, paletteram_BBGGGRRR_w, &paletteram },
156 { 0x4000, 0xffff, MWA_ROM },
157 { -1 } /* end of table */
158 };
159
160
161
162
163 INPUT_PORTS_START( mystston )
164 PORT_START /* IN0 */
165 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
166 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
167 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
168 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
169 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 )
170 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
171 PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_LOW, IPT_COIN2, 1 )
172 PORT_BIT_IMPULSE( 0x80, IP_ACTIVE_LOW, IPT_COIN1, 1 )
173
174 PORT_START /* IN1 */
175 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
176 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_COCKTAIL )
177 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_COCKTAIL )
178 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_COCKTAIL )
179 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
180 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
181 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
182 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
183
184 PORT_START /* DSW1 */
185 PORT_DIPNAME(0x01, 0x01, DEF_STR( Lives ) )
186 PORT_DIPSETTING( 0x01, "3" )
187 PORT_DIPSETTING( 0x00, "5" )
188 PORT_DIPNAME(0x02, 0x02, DEF_STR( Unknown ) )
189 PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
190 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
191 PORT_DIPNAME(0x04, 0x04, DEF_STR( Demo_Sounds ) )
192 PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
193 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
194 PORT_DIPNAME(0x08, 0x08, DEF_STR( Unknown ) )
195 PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
196 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
197 PORT_DIPNAME(0x10, 0x10, DEF_STR( Unknown ) )
198 PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
199 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
200 PORT_DIPNAME(0x20, 0x20, DEF_STR( Unknown ) )
201 PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
202 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
203 PORT_DIPNAME(0x40, 0x40, DEF_STR( Unknown ) )
204 PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
205 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
206 PORT_DIPNAME(0x80, 0x80, DEF_STR( Unknown ) )
207 PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
208 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
209
210 PORT_START /* DSW2 */
211 PORT_DIPNAME(0x03, 0x03, DEF_STR( Coin_B ) )
212 PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
213 PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
214 PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) )
215 PORT_DIPSETTING( 0x01, DEF_STR( 1C_3C ) )
216 PORT_DIPNAME(0x0c, 0x0c, DEF_STR( Coin_A ) )
217 PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C ) )
218 PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) )
219 PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) )
220 PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) )
221 PORT_DIPNAME(0x10, 0x10, DEF_STR( Unknown ) )
222 PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
223 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
224 PORT_DIPNAME(0x20, 0x20, DEF_STR( Unknown ) )
225 PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
226 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
227 PORT_DIPNAME(0x40, 0x00, DEF_STR( Cabinet ) )
228 PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
229 PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) )
230 PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
231 INPUT_PORTS_END
232
233
234
235 static struct GfxLayout charlayout =
236 {
237 8,8, /* 8*8 characters */
238 2048, /* 2048 characters */
239 3, /* 3 bits per pixel */
240 { 2*2048*8*8, 2048*8*8, 0 }, /* the bitplanes are separated */
241 { 0, 1, 2, 3, 4, 5, 6, 7 },
242 { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
243 8*8 /* every char takes 8 consecutive bytes */
244 };
245
246 static struct GfxLayout spritelayout =
247 {
248 16,16, /* 16*16 sprites */
249 512, /* 512 sprites */
250 3, /* 3 bits per pixel */
251 { 2*512*16*16, 512*16*16, 0 }, /* the bitplanes are separated */
252 { 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7,
253 0, 1, 2, 3, 4, 5, 6, 7 },
254 { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
255 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
256 32*8 /* every sprite takes 16 consecutive bytes */
257 };
258
259 static struct GfxLayout tilelayout =
260 {
261 16,16, /* 16*16 tiles */
262 512, /* 512 tiles */
263 3, /* 3 bits per pixel */
264 { 2*512*16*16, 512*16*16, 0 }, /* the bitplanes are separated */
265 { 16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7,
266 0, 1, 2, 3, 4, 5, 6, 7 },
267 { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
268 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
269 32*8 /* every tile takes 16 consecutive bytes */
270 };
271
272 static struct GfxDecodeInfo gfxdecodeinfo[] =
273 {
274 { REGION_GFX1, 0, &charlayout, 3*8, 4 },
275 { REGION_GFX2, 0, &tilelayout, 2*8, 1 },
276 { REGION_GFX1, 0, &spritelayout, 0, 2 },
277 { -1 } /* end of array */
278 };
279
280
281
282 static struct AY8910interface ay8910_interface =
283 {
284 2, /* 2 chips */
285 1500000, /* 1.5 MHz ? */
286 { 30, 30 },
287 { 0 },
288 { 0 },
289 { 0 },
290 { 0 }
291 };
292
293
294
295 static struct MachineDriver machine_driver_mystston =
296 {
297 /* basic machine hardware */
298 {
299 {
300 CPU_M6502,
301 1500000, /* 1.5 MHz ???? */
302 readmem,writemem,0,0,
303 mystston_interrupt,16 /* ? controls music tempo */
304 },
305 },
306 60, DEFAULT_REAL_60HZ_VBLANK_DURATION, /* frames per second, vblank duration */
307 1, /* single CPU, no need for interleaving */
308 0,
309
310 /* video hardware */
311 32*8, 32*8, { 0*8, 32*8-1, 1*8, 31*8-1 },
312 gfxdecodeinfo,
313 24+32, 24+32,
314 mystston_vh_convert_color_prom,
315
316 VIDEO_TYPE_RASTER|VIDEO_MODIFIES_PALETTE,
317 0,
318 mystston_vh_start,
319 mystston_vh_stop,
320 mystston_vh_screenrefresh,
321
322 /* sound hardware */
323 0,0,0,0,
324 {
325 {
326 SOUND_AY8910,
327 &ay8910_interface
328 }
329 }
330 };
331
332
333
334
335
336 /***************************************************************************
337
338 Mysterious Stones driver
339
340 ***************************************************************************/
341
342 ROM_START( mystston )
343 ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
344 ROM_LOAD( "ms0", 0x4000, 0x2000, 0x6dacc05f )
345 ROM_LOAD( "ms1", 0x6000, 0x2000, 0xa3546df7 )
346 ROM_LOAD( "ms2", 0x8000, 0x2000, 0x43bc6182 )
347 ROM_LOAD( "ms3", 0xa000, 0x2000, 0x9322222b )
348 ROM_LOAD( "ms4", 0xc000, 0x2000, 0x47cefe9b )
349 ROM_LOAD( "ms5", 0xe000, 0x2000, 0xb37ae12b )
350
351 ROM_REGION( 0x0c000, REGION_GFX1 | REGIONFLAG_DISPOSE )
352 ROM_LOAD( "ms6", 0x00000, 0x2000, 0x85c83806 )
353 ROM_LOAD( "ms9", 0x02000, 0x2000, 0xb146c6ab )
354 ROM_LOAD( "ms7", 0x04000, 0x2000, 0xd025f84d )
355 ROM_LOAD( "ms10", 0x06000, 0x2000, 0xd85015b5 )
356 ROM_LOAD( "ms8", 0x08000, 0x2000, 0x53765d89 )
357 ROM_LOAD( "ms11", 0x0a000, 0x2000, 0x919ee527 )
358
359 ROM_REGION( 0x0c000, REGION_GFX2 | REGIONFLAG_DISPOSE )
360 ROM_LOAD( "ms12", 0x00000, 0x2000, 0x72d8331d )
361 ROM_LOAD( "ms13", 0x02000, 0x2000, 0x845a1f9b )
362 ROM_LOAD( "ms14", 0x04000, 0x2000, 0x822874b0 )
363 ROM_LOAD( "ms15", 0x06000, 0x2000, 0x4594e53c )
364 ROM_LOAD( "ms16", 0x08000, 0x2000, 0x2f470b0f )
365 ROM_LOAD( "ms17", 0x0a000, 0x2000, 0x38966d1b )
366
367 ROM_REGION( 0x0020, REGION_PROMS )
368 ROM_LOAD( "ic61", 0x0000, 0x0020, 0xe802d6cf )
369 ROM_END
370
371
372
373 GAME( 1984, mystston, 0, mystston, mystston, 0, ROT270, "Technos", "Mysterious Stones" )
374