1 /***************************************************************************
2
3 Leprechaun/Pot of Gold
4
5 driver by Zsolt Vasvari
6
7 Hold down F2 while pressing F3 to enter test mode. Hit Advance (F1) to
8 cycle through test and hit F2 to execute.
9
10
11 TODO:
12 -----
13
14 - Is the 0800-081e range on the sound board mapped to a VIA?
15 I don't think so, but needs to be checked.
16
17 - The following VIA lines appear to be used but aren't mapped:
18
19 VIA #0 CA2
20 VIA #0 IRQ
21 VIA #2 CB2 - This is probably a sound CPU halt or reset. See potogold $8a5a
22
23 ***************************************************************************/
24
25 #include "driver.h"
26 #include "cpu/m6502/m6502.h"
27 #include "machine/6522via.h"
28 #include "vidhrdw/generic.h"
29 #include "leprechn.h"
30
31
32
MEMORY_READ_START(readmem)33 static MEMORY_READ_START( readmem )
34 { 0x0000, 0x03ff, MRA_RAM },
35 { 0x2000, 0x200f, via_0_r },
36 { 0x2800, 0x280f, via_1_r },
37 { 0x3000, 0x300f, via_2_r },
38 { 0x8000, 0xffff, MRA_ROM },
39 MEMORY_END
40
41 static MEMORY_WRITE_START( writemem )
42 { 0x0000, 0x03ff, MWA_RAM },
43 { 0x2000, 0x200f, via_0_w },
44 { 0x2800, 0x280f, via_1_w },
45 { 0x3000, 0x300f, via_2_w },
46 { 0x8000, 0xffff, MWA_ROM },
47 MEMORY_END
48
49
50 static MEMORY_READ_START( sound_readmem )
51 { 0x0000, 0x01ff, MRA_RAM },
52 { 0x0800, 0x0800, soundlatch_r },
53 { 0x0804, 0x0804, MRA_RAM }, /* ???*/
54 { 0x0805, 0x0805, leprechn_sh_0805_r }, /* ???*/
55 { 0x080c, 0x080c, MRA_RAM }, /* ???*/
56 { 0xa001, 0xa001, AY8910_read_port_0_r }, /* ???*/
57 { 0xf000, 0xffff, MRA_ROM},
58 MEMORY_END
59
60 static MEMORY_WRITE_START( sound_writemem )
61 { 0x0000, 0x01ff, MWA_RAM },
62 { 0x0801, 0x0803, MWA_RAM }, /* ???*/
63 { 0x0806, 0x0806, MWA_RAM }, /* ???*/
64 { 0x081e, 0x081e, MWA_RAM }, /* ???*/
65 { 0xa000, 0xa000, AY8910_control_port_0_w },
66 { 0xa002, 0xa002, AY8910_write_port_0_w },
67 { 0xf000, 0xffff, MWA_ROM},
68 MEMORY_END
69
70
71 INPUT_PORTS_START( leprechn )
72 /* All of these ports are read indirectly through a VIA mapped at 0x2800*/
73 PORT_START /* Input Port 0 */
74 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT ) /* This is called "Slam" in the game*/
75 PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
76 PORT_BITX(0x10, IP_ACTIVE_LOW, 0, "Advance", KEYCODE_F1, IP_JOY_NONE )
77 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
78 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
79 PORT_BIT( 0x23, IP_ACTIVE_LOW, IPT_UNUSED )
80
81 PORT_START /* Input Port 1 */
82 PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
83 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
84 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
85 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
86 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
87
88 PORT_START /* Input Port 2 */
89 PORT_BIT( 0x5f, IP_ACTIVE_LOW, IPT_UNUSED )
90 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
91 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
92
93 PORT_START /* Input Port 3 */
94 PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
95 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
96 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
97 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
98 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
99
100 PORT_START /* DSW #1 */
101 PORT_DIPNAME( 0x09, 0x09, DEF_STR( Coin_B ) )
102 PORT_DIPSETTING( 0x09, DEF_STR( 1C_1C ) )
103 PORT_DIPSETTING( 0x01, DEF_STR( 1C_5C ) )
104 PORT_DIPSETTING( 0x08, DEF_STR( 1C_6C ) )
105 PORT_DIPSETTING( 0x00, DEF_STR( 1C_7C ) )
106 PORT_DIPNAME( 0x22, 0x22, "Max Credits" )
107 PORT_DIPSETTING( 0x22, "10" )
108 PORT_DIPSETTING( 0x20, "20" )
109 PORT_DIPSETTING( 0x02, "30" )
110 PORT_DIPSETTING( 0x00, "40" )
111 PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet ) )
112 PORT_DIPSETTING( 0x04, DEF_STR( Upright ) )
113 PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) )
114 PORT_DIPNAME( 0x10, 0x10, DEF_STR( Free_Play ) )
115 PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
116 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
117 PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_A ) )
118 PORT_DIPSETTING( 0xc0, DEF_STR( 1C_1C ) )
119 PORT_DIPSETTING( 0x40, DEF_STR( 1C_2C ) )
120 PORT_DIPSETTING( 0x80, DEF_STR( 1C_3C ) )
121 PORT_DIPSETTING( 0x00, DEF_STR( 1C_4C ) )
122
123 PORT_START /* DSW #2 */
124 PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
125 PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
126 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
127 PORT_DIPNAME( 0x08, 0x08, DEF_STR( Lives ) )
128 PORT_DIPSETTING( 0x08, "3" )
129 PORT_DIPSETTING( 0x00, "4" )
130 PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Bonus_Life ) )
131 PORT_DIPSETTING( 0x40, "30000" )
132 PORT_DIPSETTING( 0x80, "60000" )
133 PORT_DIPSETTING( 0x00, "90000" )
134 PORT_DIPSETTING( 0xc0, "None" )
135 PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
136 PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
137 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
138 PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
139 PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
140 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
141 PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
142 PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
143 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
144 PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
145 PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
146 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
147 INPUT_PORTS_END
148
149 INPUT_PORTS_START( piratetr )
150 // All of these ports are read indirectly through a VIA mapped at 0x2800
151 PORT_START /* Input Port 0 */
152 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_TILT ) // This is called "Slam" in the game
153 PORT_BITX(0x08, IP_ACTIVE_LOW, IPT_SERVICE, DEF_STR( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
154 PORT_BITX(0x10, IP_ACTIVE_LOW, 0, "Advance", KEYCODE_F1, IP_JOY_NONE )
155 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
156 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
157 PORT_BIT( 0x23, IP_ACTIVE_LOW, IPT_UNUSED )
158
159 PORT_START /* Input Port 1 */
160 PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
161 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
162 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
163 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
164 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
165
166 PORT_START /* Input Port 2 */
167 PORT_BIT( 0x5f, IP_ACTIVE_LOW, IPT_UNUSED )
168 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 )
169 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START1 )
170
171 PORT_START /* Input Port 3 */
172 PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
173 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
174 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
175 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
176 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
177
178 PORT_START /* DSW #1 */
179 PORT_DIPNAME( 0x09, 0x09, DEF_STR( Coin_B ) )
180 PORT_DIPSETTING( 0x09, DEF_STR( 1C_1C ) )
181 PORT_DIPSETTING( 0x01, DEF_STR( 1C_5C ) )
182 PORT_DIPSETTING( 0x08, DEF_STR( 1C_6C ) )
183 PORT_DIPSETTING( 0x00, DEF_STR( 1C_7C ) )
184 PORT_DIPNAME( 0x22, 0x22, "Max Credits" )
185 PORT_DIPSETTING( 0x22, "10" )
186 PORT_DIPSETTING( 0x20, "20" )
187 PORT_DIPSETTING( 0x02, "30" )
188 PORT_DIPSETTING( 0x00, "40" )
189 PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet ) )
190 PORT_DIPSETTING( 0x04, DEF_STR( Upright ) )
191 PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) )
192 PORT_DIPNAME( 0x10, 0x10, DEF_STR( Free_Play ) )
193 PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
194 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
195 PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_A ) )
196 PORT_DIPSETTING( 0xc0, DEF_STR( 1C_1C ) )
197 PORT_DIPSETTING( 0x40, DEF_STR( 1C_2C ) )
198 PORT_DIPSETTING( 0x80, DEF_STR( 1C_3C ) )
199 PORT_DIPSETTING( 0x00, DEF_STR( 1C_4C ) )
200
201 PORT_START /* DSW #2 */
202 PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
203 PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
204 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
205 PORT_DIPNAME( 0x02, 0x02, "Stringing Check" )
206 PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
207 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
208 PORT_DIPNAME( 0x08, 0x08, DEF_STR( Lives ) )
209 PORT_DIPSETTING( 0x08, "3" )
210 PORT_DIPSETTING( 0x00, "4" )
211 PORT_DIPNAME( 0xc0, 0x40, DEF_STR( Bonus_Life ) )
212 PORT_DIPSETTING( 0x40, "30000" )
213 PORT_DIPSETTING( 0x80, "60000" )
214 PORT_DIPSETTING( 0x00, "90000" )
215 PORT_DIPSETTING( 0xc0, "None" )
216 PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
217 PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
218 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
219 PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
220 PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
221 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
222 PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
223 PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
224 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
225 INPUT_PORTS_END
226
227
228
229 static struct AY8910interface ay8910_interface =
230 {
231 1, /* 1 chip */
232 14318000/8, /* ? */
233 { 50 },
234 { 0 },
235 { 0 },
236 { 0 },
237 { 0 }
238 };
239
240
241 static MACHINE_DRIVER_START( leprechn )
242
243 /* basic machine hardware */
244 /* A good test to verify that the relative CPU speeds of the main*/
245 /* and sound are correct, is when you finish a level, the sound*/
246 /* should stop before the display switches to the name of the*/
247 /* next level*/
248 MDRV_CPU_ADD(M6502, 1250000) /* 1.25 MHz ??? */
249 MDRV_CPU_MEMORY(readmem,writemem)
250 MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
251
252 MDRV_CPU_ADD(M6502, 1500000)
253 MDRV_CPU_FLAGS(CPU_AUDIO_CPU) /* 1.5 MHz ??? */
254 MDRV_CPU_MEMORY(sound_readmem,sound_writemem)
255
256 MDRV_FRAMES_PER_SECOND(57)
257 MDRV_VBLANK_DURATION(DEFAULT_60HZ_VBLANK_DURATION)
258
259 /* video hardware */
260 MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
261 MDRV_SCREEN_SIZE(256, 256)
262 MDRV_VISIBLE_AREA(0, 256-1, 0, 256-1)
263 MDRV_PALETTE_LENGTH(16)
264
265 MDRV_PALETTE_INIT(leprechn)
266 MDRV_VIDEO_START(leprechn)
267 MDRV_VIDEO_UPDATE(generic_bitmapped)
268
269 /* sound hardware */
270 MDRV_SOUND_ADD(AY8910, ay8910_interface)
271 MACHINE_DRIVER_END
272
273
274 /***************************************************************************
275
276 Game driver(s)
277
278 ***************************************************************************/
279
280 ROM_START( leprechn )
281 ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for the main CPU */
282 ROM_LOAD( "lep1", 0x8000, 0x1000, CRC(2c4a46ca) SHA1(28a157c1514bc9f27cc27baddb83cf1a1887f3d1) )
283 ROM_LOAD( "lep2", 0x9000, 0x1000, CRC(6ed26b3e) SHA1(4ee5d09200d9e8f94ae29751c8ee838faa268f15) )
284 ROM_LOAD( "lep3", 0xa000, 0x1000, CRC(a2eaa016) SHA1(be992ee787766137fd800ec59529c98ef2e6991e) )
285 ROM_LOAD( "lep4", 0xb000, 0x1000, CRC(6c12a065) SHA1(2acae6a5b94cbdcc550cee88a7be9254fdae908c) )
286 ROM_LOAD( "lep5", 0xc000, 0x1000, CRC(21ddb539) SHA1(b4dd0a1916adc076fa6084c315459fcb2522161e) )
287 ROM_LOAD( "lep6", 0xd000, 0x1000, CRC(03c34dce) SHA1(6dff202e1a3d0643050f3287f6b5906613d56511) )
288 ROM_LOAD( "lep7", 0xe000, 0x1000, CRC(7e06d56d) SHA1(5f68f2047969d803b752a4cd02e0e0af916c8358) )
289 ROM_LOAD( "lep8", 0xf000, 0x1000, CRC(097ede60) SHA1(5509c41167c066fa4e7f4f4bd1ce9cd00773a82c) )
290
291 ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for the audio CPU */
292 ROM_LOAD( "lepsound", 0xf000, 0x1000, CRC(6651e294) SHA1(ce2875fc4df61a30d51d3bf2153864b562601151) )
293 ROM_END
294
295 ROM_START( potogold )
296 ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for the main CPU */
297 ROM_LOAD( "pog.pg1", 0x8000, 0x1000, CRC(9f1dbda6) SHA1(baf20e9a0793c0f1529396f95a820bd1f9431465) )
298 ROM_LOAD( "pog.pg2", 0x9000, 0x1000, CRC(a70e3811) SHA1(7ee306dc7d75a7d3fd497870ec92bef9d86535e9) )
299 ROM_LOAD( "pog.pg3", 0xa000, 0x1000, CRC(81cfb516) SHA1(12732707e2a51ec39563f2d1e898cc567ab688f0) )
300 ROM_LOAD( "pog.pg4", 0xb000, 0x1000, CRC(d61b1f33) SHA1(da024c0776214b8b5a3e49401c4110e86a1bead1) )
301 ROM_LOAD( "pog.pg5", 0xc000, 0x1000, CRC(eee7597e) SHA1(9b5cd293580c5d212f8bf39286070280d55e4cb3) )
302 ROM_LOAD( "pog.pg6", 0xd000, 0x1000, CRC(25e682bc) SHA1(085d2d553ec10f2f830918df3a7fb8e8c1e5d18c) )
303 ROM_LOAD( "pog.pg7", 0xe000, 0x1000, CRC(84399f54) SHA1(c90ba3e3120adda2785ab5abd309e0a703d39f8b) )
304 ROM_LOAD( "pog.pg8", 0xf000, 0x1000, CRC(9e995a1a) SHA1(5c525e6c161d9d7d646857b27cecfbf8e0943480) )
305
306 ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for the audio CPU */
307 ROM_LOAD( "pog.snd", 0xf000, 0x1000, CRC(ec61f0a4) SHA1(26944ecc3e7413259928c8b0a74b2260e67d2c4e) )
308 ROM_END
309
310 ROM_START( piratetr )
311 ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* 64k for the main CPU */
312 ROM_LOAD( "1u13.bin", 0x8000, 0x1000, CRC(4433bb61) SHA1(eee0d7f356118f8595dd7533541db744a63a8176) )
313 ROM_LOAD( "2u14.bin", 0x9000, 0x1000, CRC(9bdc4b77) SHA1(ebaab8b3024efd3d0b76647085d441ca204ad5d5) )
314 ROM_LOAD( "3u15.bin", 0xa000, 0x1000, CRC(ebced718) SHA1(3a2f4385347f14093360cfa595922254c9badf1a) )
315 ROM_LOAD( "4u16.bin", 0xb000, 0x1000, CRC(f494e657) SHA1(83a31849de8f4f70d7547199f229079f491ddc61) )
316 ROM_LOAD( "5u17.bin", 0xc000, 0x1000, CRC(2789d68e) SHA1(af8f334ce4938cd75143b729c97cfbefd68c9e13) )
317 ROM_LOAD( "6u18.bin", 0xd000, 0x1000, CRC(d91abb3a) SHA1(11170e69686c2a1f2dc31d41516f44b612f99bad) )
318 ROM_LOAD( "7u19.bin", 0xe000, 0x1000, CRC(6e8808c4) SHA1(d1f76fd37d8f78552a9d53467073cc9a571d96ce) )
319 ROM_LOAD( "8u20.bin", 0xf000, 0x1000, CRC(2802d626) SHA1(b0db688500076ee73e0001c00089a8d552c6f607) )
320
321 ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* 64k for the audio CPU */
322 ROM_LOAD( "su31.bin", 0xf000, 0x1000, CRC(2fe86a11) SHA1(aaafe411b9cb3d0221cc2af73d34ad8bb74f8327) )
323 ROM_END
324
325
326
327 GAME( 1982, leprechn, 0, leprechn, leprechn, leprechn, ROT0, "Tong Electronic", "Leprechaun" )
328 GAME( 1982, potogold, leprechn, leprechn, leprechn, leprechn, ROT0, "GamePlan", "Pot of Gold" )
329 GAME( 1982, piratetr, 0, leprechn, piratetr, leprechn, ROT0, "Tong Electronic", "Pirate Treasure" )
330