1 // license:BSD-3-Clause
2 // copyright-holders:Aaron Giles
3 /***************************************************************************
4 
5     Atari Klax hardware
6 
7     driver by Aaron Giles
8 
9     Games supported:
10         * Klax (1989) [6 original sets + 2 bootleg sets]
11 
12     Known bugs:
13         * Bootleg sets don't work
14 
15 ****************************************************************************
16 
17     Memory map (TBA)
18 
19 ***************************************************************************/
20 
21 
22 #include "emu.h"
23 #include "includes/klax.h"
24 
25 #include "cpu/m68000/m68000.h"
26 #include "cpu/z80/z80.h"
27 #include "machine/eeprompar.h"
28 #include "machine/watchdog.h"
29 #include "sound/okim6295.h"
30 #include "sound/msm5205.h"
31 #include "emupal.h"
32 #include "speaker.h"
33 
34 
35 /*************************************
36  *
37  *  Interrupt handling
38  *
39  *************************************/
40 
TIMER_DEVICE_CALLBACK_MEMBER(klax_state::scanline_update)41 TIMER_DEVICE_CALLBACK_MEMBER(klax_state::scanline_update)
42 {
43 	int scanline = param;
44 
45 	/* generate 32V signals */
46 	if ((scanline & 32) == 0 && !m_screen->vblank() && !(m_p1->read() & 0x800))
47 		m_maincpu->set_input_line(M68K_IRQ_4, ASSERT_LINE);
48 }
49 
50 
interrupt_ack_w(u16 data)51 void klax_state::interrupt_ack_w(u16 data)
52 {
53 	m_maincpu->set_input_line(M68K_IRQ_4, CLEAR_LINE);
54 }
55 
56 
57 /*************************************
58  *
59  *  Initialization
60  *
61  *************************************/
62 
machine_reset()63 void klax_state::machine_reset()
64 {
65 }
66 
67 
68 /*************************************
69  *
70  *  Main CPU memory handlers
71  *
72  *************************************/
73 
klax_map(address_map & map)74 void klax_state::klax_map(address_map &map)
75 {
76 	map(0x000000, 0x03ffff).rom();
77 	map(0x0e0000, 0x0e0fff).rw("eeprom", FUNC(eeprom_parallel_28xx_device::read), FUNC(eeprom_parallel_28xx_device::write)).umask16(0x00ff);
78 	map(0x1f0000, 0x1fffff).w("eeprom", FUNC(eeprom_parallel_28xx_device::unlock_write16));
79 	map(0x260000, 0x260001).portr("P1").w(FUNC(klax_state::latch_w));
80 	map(0x260002, 0x260003).portr("P2");
81 	map(0x270001, 0x270001).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write));
82 	map(0x2e0000, 0x2e0001).w("watchdog", FUNC(watchdog_timer_device::reset16_w));
83 	map(0x360000, 0x360001).w(FUNC(klax_state::interrupt_ack_w));
84 	map(0x3e0000, 0x3e07ff).rw("palette", FUNC(palette_device::read8), FUNC(palette_device::write8)).umask16(0xff00).share("palette");
85 	map(0x3f0000, 0x3f0f7f).ram().w(m_playfield_tilemap, FUNC(tilemap_device::write16)).share("playfield");
86 	map(0x3f0f80, 0x3f0fff).ram().share("mob:slip");
87 	map(0x3f1000, 0x3f1fff).ram().w(m_playfield_tilemap, FUNC(tilemap_device::write16_ext)).share("playfield_ext");
88 	map(0x3f2000, 0x3f27ff).ram().share("mob");
89 	map(0x3f2800, 0x3f3fff).ram();
90 }
91 
klax5bl_map(address_map & map)92 void klax_state::klax5bl_map(address_map &map)
93 {
94 	map(0x000000, 0x03ffff).rom();
95 	map(0x0e0000, 0x0e0fff).rw("eeprom", FUNC(eeprom_parallel_28xx_device::read), FUNC(eeprom_parallel_28xx_device::write)).umask16(0x00ff);
96 	map(0x1f0000, 0x1fffff).w("eeprom", FUNC(eeprom_parallel_28xx_device::unlock_write16));
97 	map(0x260000, 0x260001).portr("P1").w(FUNC(klax_state::latch_w));
98 	map(0x260002, 0x260003).portr("P2");
99 	map(0x260006, 0x260007).w(FUNC(klax_state::interrupt_ack_w));
100 //  map(0x270001, 0x270001).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // no OKI here
101 	map(0x2e0000, 0x2e0001).w("watchdog", FUNC(watchdog_timer_device::reset16_w));
102 	map(0x3e0000, 0x3e07ff).rw("palette", FUNC(palette_device::read8), FUNC(palette_device::write8)).umask16(0xff00).share("palette");
103 	map(0x3f0000, 0x3f0f7f).ram().w(m_playfield_tilemap, FUNC(tilemap_device::write16)).share("playfield");
104 	map(0x3f0f80, 0x3f0fff).ram().share("mob:slip");
105 	map(0x3f1000, 0x3f1fff).ram().w(m_playfield_tilemap, FUNC(tilemap_device::write16_ext)).share("playfield_ext");
106 	map(0x3f2000, 0x3f27ff).ram().share("mob");
107 	map(0x3f2800, 0x3f3fff).ram();
108 }
109 
110 /*************************************
111  *
112  *  Port definitions
113  *
114  *************************************/
115 
116 static INPUT_PORTS_START( klax )
117 	PORT_START("P1")
118 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
119 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
120 	PORT_BIT( 0x00fc, IP_ACTIVE_LOW, IPT_UNUSED )
121 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
122 	PORT_BIT( 0x0600, IP_ACTIVE_LOW, IPT_UNUSED )
123 	PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
124 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(1)
125 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(1)
126 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(1)
127 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(1)
128 
129 	PORT_START("P2")
130 	PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
131 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
132 	PORT_BIT( 0x0600, IP_ACTIVE_LOW, IPT_UNUSED )
133 	PORT_SERVICE( 0x0800, IP_ACTIVE_LOW )
134 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2)
135 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2)
136 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2)
137 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2)
138 INPUT_PORTS_END
139 
140 
141 /*************************************
142  *
143  *  Graphics definitions
144  *
145  *************************************/
146 
147 static const gfx_layout pfmolayout =
148 {
149 	8,8,
150 	RGN_FRAC(1,1),
151 	4,
152 	{ STEP4(0,1) },
153 	{ STEP8(0,4) },
154 	{ STEP8(0,4*8) },
155 	8*8*4
156 };
157 
158 
159 static GFXDECODE_START( gfx_klax )
160 	GFXDECODE_ENTRY( "gfx1", 0, pfmolayout, 256, 16 ) /* playfield */
161 	GFXDECODE_ENTRY( "gfx2", 0, pfmolayout,   0, 16 ) /* sprites */
162 GFXDECODE_END
163 
164 static const gfx_layout bootleg_layout =
165 {
166 	8,8,
167 	RGN_FRAC(1,1),
168 	4,
169 	{ STEP4(0,8) },
170 	{ STEP8(0,1) },
171 	{ STEP8(0,8*4) },
172 	8*8*4
173 };
174 
175 static GFXDECODE_START( gfx_klax5bl )
176 	GFXDECODE_ENTRY( "gfx1", 0, bootleg_layout, 256, 16 ) /* playfield */
177 	GFXDECODE_ENTRY( "gfx2", 0, pfmolayout,       0, 16 ) /* sprites */
178 GFXDECODE_END
179 
180 
181 /*************************************
182  *
183  *  Machine driver
184  *
185  *************************************/
186 
klax(machine_config & config)187 void klax_state::klax(machine_config &config)
188 {
189 	/* basic machine hardware */
190 	M68000(config, m_maincpu, 14.318181_MHz_XTAL/2);
191 	m_maincpu->set_addrmap(AS_PROGRAM, &klax_state::klax_map);
192 
193 	TIMER(config, "scantimer").configure_scanline(FUNC(klax_state::scanline_update), m_screen, 0, 32);
194 
195 	EEPROM_2816(config, "eeprom").lock_after_write(true);
196 
197 	WATCHDOG_TIMER(config, "watchdog");
198 
199 	/* video hardware */
200 	GFXDECODE(config, m_gfxdecode, "palette", gfx_klax);
201 	PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 512).set_membits(8);
202 
203 	TILEMAP(config, m_playfield_tilemap, m_gfxdecode, 2, 8, 8, TILEMAP_SCAN_COLS, 64, 32);
204 	m_playfield_tilemap->set_info_callback(FUNC(klax_state::get_playfield_tile_info));
205 
206 	ATARI_MOTION_OBJECTS(config, m_mob, 0, m_screen, klax_state::s_mob_config);
207 	m_mob->set_gfxdecode(m_gfxdecode);
208 
209 	SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
210 	m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK);
211 	/* note: these parameters are from published specs, not derived */
212 	/* the board uses an SOS-2 chip to generate video signals */
213 	m_screen->set_raw(14.318181_MHz_XTAL/2, 456, 0, 336, 262, 0, 240);
214 	m_screen->set_screen_update(FUNC(klax_state::screen_update));
215 	m_screen->set_palette("palette");
216 	m_screen->screen_vblank().set_inputline(m_maincpu, M68K_IRQ_4, ASSERT_LINE);
217 
218 	/* sound hardware */
219 	SPEAKER(config, "mono").front_center();
220 
221 	OKIM6295(config, "oki", 14.318181_MHz_XTAL/4/4, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 1.0);
222 }
223 
bootleg_sound_map(address_map & map)224 void klax_state::bootleg_sound_map(address_map &map)
225 {
226 	map(0x0000, 0x7fff).rom();
227 }
228 
klax5bl(machine_config & config)229 void klax_state::klax5bl(machine_config &config)
230 {
231 	klax(config);
232 
233 	m_maincpu->set_addrmap(AS_PROGRAM, &klax_state::klax5bl_map);
234 
235 	config.device_remove("oki"); // no 6295 here
236 
237 	z80_device &audiocpu(Z80(config, "audiocpu", 6000000)); /* ? */
238 	audiocpu.set_addrmap(AS_PROGRAM, &klax_state::bootleg_sound_map);
239 
240 	m_gfxdecode->set_info(gfx_klax5bl);
241 
242 	// guess, probably something like this
243 	// 2 x msm at least on bootleg set 2 (ic18 and ic19)
244 	MSM5205(config, "msm", 375000);     /* ? */
245 //  msm.vck_legacy_callback().set(FUNC(klax_state::m5205_int1));    /* interrupt function */
246 //  msm.set_prescaler_selector(msm5205_device::MSM5205_S96_4B);     /* 4KHz 4-bit */
247 //  msm.add_route(ALL_OUTPUTS, "mono", 0.25);
248 }
249 
250 /*************************************
251  *
252  *  ROM definition(s)
253  *
254  *************************************/
255 
256 ROM_START( klax )
257 	ROM_REGION( 0x40000, "maincpu", 0 ) /* 4*64k for 68000 code */
258 	ROM_LOAD16_BYTE( "136075-6006.3n", 0x00000, 0x10000, CRC(e8991709) SHA1(90d69b0712e68e842a8b946539f1f43ef165e8de) )
259 	ROM_LOAD16_BYTE( "136075-6005.1n", 0x00001, 0x10000, CRC(72b8c510) SHA1(f79d3a2de4deaabbcec632e8be9a1d5f6c0c3740) )
260 	ROM_LOAD16_BYTE( "136075-6008.3k", 0x20000, 0x10000, CRC(c7c91a9d) SHA1(9f79ca689ec635f8113a74162e81f253c88992f5) )
261 	ROM_LOAD16_BYTE( "136075-6007.1k", 0x20001, 0x10000, CRC(d2021a88) SHA1(0f8a0dcc3bb5ca433601b1abfc796c98791facf6) )
262 
263 	ROM_REGION( 0x40000, "gfx1", 0 )
264 	ROM_LOAD16_BYTE( "136075-2010.17x", 0x00000, 0x10000, CRC(15290a0d) SHA1(e1338f3fb298aae19735548f4b597d1c33944960) )
265 	ROM_LOAD16_BYTE( "136075-2009.17u", 0x00001, 0x10000, CRC(6368dbaf) SHA1(fa8b5cf6777108c0b1e38a3650ee4cdb2ec76810) )
266 	ROM_LOAD16_BYTE( "136075-2012.12x", 0x20000, 0x10000, CRC(c0d9eb0f) SHA1(aa68b9ad435eeaa8b43693e237cc7f9a53d94dfc) )
267 	ROM_LOAD16_BYTE( "136075-2011.12u", 0x20001, 0x10000, CRC(e83cca91) SHA1(45f1155d51ab3e2cc08aad1ec4e557d132085cc6) )
268 
269 	ROM_REGION( 0x20000, "gfx2", 0 )
270 	ROM_LOAD16_BYTE( "136075-2014.17y", 0x00000, 0x10000, CRC(5c551e92) SHA1(cbff8fc4f4d370b6db2b4953ecbedd249916b891) )
271 	ROM_LOAD16_BYTE( "136075-2013.17w", 0x00001, 0x10000, CRC(36764bbc) SHA1(5762996a327b5f7f93f42dad7eccb6297b3e4c0b) )
272 
273 	ROM_REGION( 0x40000, "oki", 0 ) /* ADPCM data */
274 	ROM_LOAD( "136075-1015.14b", 0x00000, 0x10000, CRC(4d24c768) SHA1(da102105a4d8c552e3594b8ffb1903ecbaa69415) )
275 	ROM_LOAD( "136075-1016.12b", 0x10000, 0x10000, CRC(12e9b4b7) SHA1(2447f116cd865e46e61022143a2668beca99d5d1) )
276 
277 	ROM_REGION( 0x00573, "pals", 0 ) /* Lattice GAL16V8A-25LP GAL's */
278 	ROM_LOAD( "136075-1000.11c.bin", 0x0000, 0x0117, CRC(fb86e94a) SHA1(b16f037c49766ab734e47c8e1b16b5178809b8a3) )
279 	ROM_LOAD( "136075-1001.18l.bin", 0x0000, 0x0117, CRC(cd21acfe) SHA1(14bd9e2f1b50a1da550933e3fdc16e3f09b65e92) )
280 	ROM_LOAD( "136075-1002.8w.bin",  0x0000, 0x0117, CRC(4a7b6c44) SHA1(9579e098af3e5cd19bd14c361d3b1c5cb9047171) )
281 	ROM_LOAD( "136075-1003.9w.bin",  0x0000, 0x0117, CRC(72f7f904) SHA1(f792b5bcc313c5f3338a569a6f376a3ebb1eabf7) )
282 	ROM_LOAD( "136075-1004.6w.bin",  0x0000, 0x0117, CRC(6cd3270d) SHA1(84854b5beee539a80fc94f6e4637aa1c2543a1cb) )
283 ROM_END
284 
285 
286 ROM_START( klax5 )
287 	ROM_REGION( 0x40000, "maincpu", 0 ) /* 4*64k for 68000 code */
288 	ROM_LOAD16_BYTE( "13607-5006.3n", 0x00000, 0x10000, CRC(05c98fc0) SHA1(84880d3d65c46c96c739063b3f61b1663989c56e) )
289 	ROM_LOAD16_BYTE( "13607-5005.1n", 0x00001, 0x10000, CRC(d461e1ee) SHA1(73e8615a742555f74c1086c0b745afc7e94a478f) )
290 	ROM_LOAD16_BYTE( "13607-5008.3k", 0x20000, 0x10000, CRC(f1b8e588) SHA1(080511f90aecb7526ab2107c196e73cb881a2bb5) )
291 	ROM_LOAD16_BYTE( "13607-5007.1k", 0x20001, 0x10000, CRC(adbe33a8) SHA1(c6c4f9ea5224169dbf4dda1062954563ebab18d4) )
292 
293 	ROM_REGION( 0x40000, "gfx1", 0 )
294 	ROM_LOAD16_BYTE( "136075-2010.17x", 0x00000, 0x10000, CRC(15290a0d) SHA1(e1338f3fb298aae19735548f4b597d1c33944960) )
295 	ROM_LOAD16_BYTE( "136075-2009.17u", 0x00001, 0x10000, CRC(6368dbaf) SHA1(fa8b5cf6777108c0b1e38a3650ee4cdb2ec76810) )
296 	ROM_LOAD16_BYTE( "136075-2012.12x", 0x20000, 0x10000, CRC(c0d9eb0f) SHA1(aa68b9ad435eeaa8b43693e237cc7f9a53d94dfc) )
297 	ROM_LOAD16_BYTE( "136075-2011.12u", 0x20001, 0x10000, CRC(e83cca91) SHA1(45f1155d51ab3e2cc08aad1ec4e557d132085cc6) )
298 
299 	ROM_REGION( 0x20000, "gfx2", 0 )
300 	ROM_LOAD16_BYTE( "136075-2014.17y", 0x00000, 0x10000, CRC(5c551e92) SHA1(cbff8fc4f4d370b6db2b4953ecbedd249916b891) )
301 	ROM_LOAD16_BYTE( "136075-2013.17w", 0x00001, 0x10000, CRC(36764bbc) SHA1(5762996a327b5f7f93f42dad7eccb6297b3e4c0b) )
302 
303 	ROM_REGION( 0x40000, "oki", 0 ) /* ADPCM data */
304 	ROM_LOAD( "136075-1015.14b", 0x00000, 0x10000, CRC(4d24c768) SHA1(da102105a4d8c552e3594b8ffb1903ecbaa69415) )
305 	ROM_LOAD( "136075-1016.12b", 0x10000, 0x10000, CRC(12e9b4b7) SHA1(2447f116cd865e46e61022143a2668beca99d5d1) )
306 
307 	ROM_REGION( 0x00573, "pals", 0 ) /* Lattice GAL16V8A-25LP GAL's */
308 	ROM_LOAD( "136075-1000.11c.bin", 0x0000, 0x0117, CRC(fb86e94a) SHA1(b16f037c49766ab734e47c8e1b16b5178809b8a3) )
309 	ROM_LOAD( "136075-1001.18l.bin", 0x0000, 0x0117, CRC(cd21acfe) SHA1(14bd9e2f1b50a1da550933e3fdc16e3f09b65e92) )
310 	ROM_LOAD( "136075-1002.8w.bin",  0x0000, 0x0117, CRC(4a7b6c44) SHA1(9579e098af3e5cd19bd14c361d3b1c5cb9047171) )
311 	ROM_LOAD( "136075-1003.9w.bin",  0x0000, 0x0117, CRC(72f7f904) SHA1(f792b5bcc313c5f3338a569a6f376a3ebb1eabf7) )
312 	ROM_LOAD( "136075-1004.6w.bin",  0x0000, 0x0117, CRC(6cd3270d) SHA1(84854b5beee539a80fc94f6e4637aa1c2543a1cb) )
313 ROM_END
314 
315 ROM_START( klax5bl ) // derived from 'klax5' set
316 	ROM_REGION( 0x40000, "maincpu", 0 ) /* 4*64k for 68000 code */
317 	ROM_LOAD16_BYTE( "6.bin", 0x00000, 0x10000, CRC(3cfd2748) SHA1(165c446bab9df6517746451d056330386cb5212c) )
318 	ROM_LOAD16_BYTE( "2.bin", 0x00001, 0x10000, CRC(910e5bf9) SHA1(2b5af427e7cbad8d4ed2a202900f227295e1dea9) )
319 	ROM_LOAD16_BYTE( "5.bin", 0x20000, 0x10000, CRC(4fcacf88) SHA1(4ad87b03ac4cdf763586f8bf5d54bee950b6779c) )
320 	ROM_LOAD16_BYTE( "1.bin", 0x20001, 0x10000, CRC(ed0e3585) SHA1(5dfdcca15fee6ec3ae8a47fff4d066860e902082) )
321 
322 	ROM_REGION( 0x40000, "audiocpu", 0 )
323 	ROM_LOAD( "3.bin", 0x00000, 0x10000, CRC(b0441f1c) SHA1(edced52b86641ce6db934ba05435f1221a12809a) )
324 	ROM_LOAD( "4.bin", 0x10000, 0x10000, CRC(a245e005) SHA1(8843edfa9deec405f491647d40007d0a38c25262) )
325 
326 	ROM_REGION( 0x40000, "gfx1", 0 )
327 	ROM_LOAD32_BYTE( "9.bin",  0x00000, 0x10000, CRC(ebe4bd96) SHA1(31f941e39aeaed6a64b35827df4d234cd641b47d) )
328 	ROM_LOAD32_BYTE( "10.bin", 0x00001, 0x10000, CRC(e7ad1cbd) SHA1(4b37cbe5d3168e532b00e8e34e7b8cf6d69e3487) )
329 	ROM_LOAD32_BYTE( "11.bin", 0x00002, 0x10000, CRC(ef7712fd) SHA1(9308b37a8b024837b32d10e358a5205fdc582214) )
330 	ROM_LOAD32_BYTE( "12.bin", 0x00003, 0x10000, CRC(1e0c1262) SHA1(960d61b9751276e4d0dbfd3f07cadc1329079abc) )
331 
332 	ROM_REGION( 0x20000, "gfx2", 0 )
333 	ROM_LOAD16_BYTE( "7.bin", 0x00000, 0x10000, CRC(5c551e92) SHA1(cbff8fc4f4d370b6db2b4953ecbedd249916b891) )
334 	ROM_LOAD16_BYTE( "8.bin", 0x00001, 0x10000, CRC(36764bbc) SHA1(5762996a327b5f7f93f42dad7eccb6297b3e4c0b) )
335 ROM_END
336 
337 ROM_START( klax5bl2 ) // derived from 'klax5' set, closer than klax5bl
338 	ROM_REGION( 0x40000, "maincpu", 0 ) /* 4*64k for 68000 code */
339 	ROM_LOAD16_BYTE( "3.ic31", 0x00000, 0x10000, CRC(e43699f3) SHA1(2a78959ad065e1c0f69cc2ba4146a50102ccfd7e) )
340 	ROM_LOAD16_BYTE( "1.ic13", 0x00001, 0x10000, CRC(dc67f13a) SHA1(6021f48b53f9000983bcd786b8366ba8638174de) )
341 	ROM_LOAD16_BYTE( "4.ic30", 0x20000, 0x10000, CRC(f1b8e588) SHA1(080511f90aecb7526ab2107c196e73cb881a2bb5) )
342 	ROM_LOAD16_BYTE( "2.ic12", 0x20001, 0x10000, CRC(adbe33a8) SHA1(c6c4f9ea5224169dbf4dda1062954563ebab18d4) )
343 
344 	ROM_REGION( 0x40000, "audiocpu", 0 )
345 	ROM_LOAD( "6.ic22", 0x00000, 0x10000, CRC(edd4c42c) SHA1(22f992615afa24a7a671ed2f5cf08f25965d5b3a) )
346 	ROM_LOAD( "5.ic23", 0x10000, 0x10000, CRC(a245e005) SHA1(8843edfa9deec405f491647d40007d0a38c25262) )
347 
348 	ROM_REGION( 0x40000, "gfx1", 0 )
349 	ROM_LOAD32_BYTE( "8.ic116",  0x00000, 0x10000, CRC(ebe4bd96) SHA1(31f941e39aeaed6a64b35827df4d234cd641b47d) )
350 	ROM_LOAD32_BYTE( "7.ic117",  0x00001, 0x10000, CRC(3b79c0d3) SHA1(f6910f2526e1d92eae260b5eb73b1672db891f4b) )
351 	ROM_LOAD32_BYTE( "12.ic134", 0x00002, 0x10000, CRC(ef7712fd) SHA1(9308b37a8b024837b32d10e358a5205fdc582214) )
352 	ROM_LOAD32_BYTE( "11.ic135", 0x00003, 0x10000, CRC(c2d8ce0c) SHA1(6b2f3c3f5f238dc00501646230dc8787dd862ed4) )
353 
354 	ROM_REGION( 0x20000, "gfx2", 0 )
355 	ROM_LOAD16_BYTE( "10.ic101", 0x00000, 0x10000, CRC(5c551e92) SHA1(cbff8fc4f4d370b6db2b4953ecbedd249916b891) )
356 	ROM_LOAD16_BYTE( "9.ic102",  0x00001, 0x10000, CRC(29708e34) SHA1(6bea1527ad941fbb1abfad59ef3d78900dcd7f27) )
357 
358 	ROM_REGION( 0x800, "plds", 0) // protected
359 	ROM_LOAD( "palce16v8.ic67", 0x000, 0x117, NO_DUMP )
360 	ROM_LOAD( "palce16v8.ic91", 0x200, 0x117, NO_DUMP )
361 	ROM_LOAD( "gal16v8.ic24",   0x400, 0x117, NO_DUMP )
362 	ROM_LOAD( "gal16v8.ic29",   0x600, 0x117, NO_DUMP )
363 ROM_END
364 
365 ROM_START( klax5bl3 ) // almost identical to klax5bl2, only the first audiocpu ROM differs
366 	ROM_REGION( 0x40000, "maincpu", 0 ) /* 4*64k for 68000 code */
367 	ROM_LOAD16_BYTE( "3.ic31", 0x00000, 0x10000, CRC(e43699f3) SHA1(2a78959ad065e1c0f69cc2ba4146a50102ccfd7e) )
368 	ROM_LOAD16_BYTE( "1.ic13", 0x00001, 0x10000, CRC(dc67f13a) SHA1(6021f48b53f9000983bcd786b8366ba8638174de) )
369 	ROM_LOAD16_BYTE( "4.ic30", 0x20000, 0x10000, CRC(f1b8e588) SHA1(080511f90aecb7526ab2107c196e73cb881a2bb5) )
370 	ROM_LOAD16_BYTE( "2.ic12", 0x20001, 0x10000, CRC(adbe33a8) SHA1(c6c4f9ea5224169dbf4dda1062954563ebab18d4) )
371 
372 	ROM_REGION( 0x40000, "audiocpu", 0 )
373 	ROM_LOAD( "6.ic22", 0x00000, 0x10000, CRC(d2c40941) SHA1(34d35d9333c315e116198aebc7db00fce6ccceb0) )
374 	ROM_LOAD( "5.ic23", 0x10000, 0x10000, CRC(a245e005) SHA1(8843edfa9deec405f491647d40007d0a38c25262) )
375 
376 	ROM_REGION( 0x40000, "gfx1", 0 )
377 	ROM_LOAD32_BYTE( "8.ic116",  0x00000, 0x10000, CRC(ebe4bd96) SHA1(31f941e39aeaed6a64b35827df4d234cd641b47d) )
378 	ROM_LOAD32_BYTE( "7.ic117",  0x00001, 0x10000, CRC(3b79c0d3) SHA1(f6910f2526e1d92eae260b5eb73b1672db891f4b) )
379 	ROM_LOAD32_BYTE( "12.ic134", 0x00002, 0x10000, CRC(ef7712fd) SHA1(9308b37a8b024837b32d10e358a5205fdc582214) )
380 	ROM_LOAD32_BYTE( "11.ic135", 0x00003, 0x10000, CRC(c2d8ce0c) SHA1(6b2f3c3f5f238dc00501646230dc8787dd862ed4) )
381 
382 	ROM_REGION( 0x20000, "gfx2", 0 )
383 	ROM_LOAD16_BYTE( "10.ic101", 0x00000, 0x10000, CRC(5c551e92) SHA1(cbff8fc4f4d370b6db2b4953ecbedd249916b891) )
384 	ROM_LOAD16_BYTE( "9.ic102",  0x00001, 0x10000, CRC(36764bbc) SHA1(5762996a327b5f7f93f42dad7eccb6297b3e4c0b) )
385 
386 	ROM_REGION( 0x800, "eeprom", 0 ) // dumped from PCB after factory reset
387 	ROM_LOAD( "28c16a.ic11", 0x000, 0x800, CRC(a853f611) SHA1(303d9032239a6b868bb010cee2e6292531686487) )
388 
389 	ROM_REGION( 0x800, "plds", 0) // protected
390 	ROM_LOAD( "palce16v8.ic67", 0x000, 0x117, NO_DUMP )
391 	ROM_LOAD( "palce16v8.ic91", 0x200, 0x117, NO_DUMP )
392 	ROM_LOAD( "gal16v8.ic24",   0x400, 0x117, NO_DUMP )
393 	ROM_LOAD( "gal16v8.ic29",   0x600, 0x117, NO_DUMP )
394 ROM_END
395 
396 ROM_START( klax4 )
397 	ROM_REGION( 0x40000, "maincpu", 0 ) /* 4*64k for 68000 code */
398 	ROM_LOAD16_BYTE( "136075-5006.3n", 0x00000, 0x10000, CRC(65eb9a31) SHA1(3f47d58fe9eb154ab14ac282919f92679b5c7922) )
399 	ROM_LOAD16_BYTE( "136075-5005.1n", 0x00001, 0x10000, CRC(7be27349) SHA1(79eef2b7f4a0fb6991d81f6543d5ae00de9f2452) )
400 	ROM_LOAD16_BYTE( "136075-4008.3k", 0x20000, 0x10000, CRC(f3c79106) SHA1(c315159020d5bc6f919c3fb975fb8b228584f88c) )
401 	ROM_LOAD16_BYTE( "136075-4007.1k", 0x20001, 0x10000, CRC(a23cde5d) SHA1(51afadc900524d73ff7906b003fdf801f5d1f1fd) )
402 
403 	ROM_REGION( 0x40000, "gfx1", 0 )
404 	ROM_LOAD16_BYTE( "136075-2010.17x", 0x00000, 0x10000, CRC(15290a0d) SHA1(e1338f3fb298aae19735548f4b597d1c33944960) )
405 	ROM_LOAD16_BYTE( "136075-2009.17u", 0x00001, 0x10000, CRC(6368dbaf) SHA1(fa8b5cf6777108c0b1e38a3650ee4cdb2ec76810) )
406 	ROM_LOAD16_BYTE( "136075-2012.12x", 0x20000, 0x10000, CRC(c0d9eb0f) SHA1(aa68b9ad435eeaa8b43693e237cc7f9a53d94dfc) )
407 	ROM_LOAD16_BYTE( "136075-2011.12u", 0x20001, 0x10000, CRC(e83cca91) SHA1(45f1155d51ab3e2cc08aad1ec4e557d132085cc6) )
408 
409 	ROM_REGION( 0x20000, "gfx2", 0 )
410 	ROM_LOAD16_BYTE( "136075-2014.17y", 0x00000, 0x10000, CRC(5c551e92) SHA1(cbff8fc4f4d370b6db2b4953ecbedd249916b891) )
411 	ROM_LOAD16_BYTE( "136075-2013.17w", 0x00001, 0x10000, CRC(36764bbc) SHA1(5762996a327b5f7f93f42dad7eccb6297b3e4c0b) )
412 
413 	ROM_REGION( 0x40000, "oki", 0 ) /* ADPCM data */
414 	ROM_LOAD( "136075-1015.14b", 0x00000, 0x10000, CRC(4d24c768) SHA1(da102105a4d8c552e3594b8ffb1903ecbaa69415) )
415 	ROM_LOAD( "136075-1016.12b", 0x10000, 0x10000, CRC(12e9b4b7) SHA1(2447f116cd865e46e61022143a2668beca99d5d1) )
416 
417 	ROM_REGION( 0x00573, "pals", 0 ) /* Lattice GAL16V8A-25LP GAL's */
418 	ROM_LOAD( "136075-1000.11c.bin", 0x0000, 0x0117, CRC(fb86e94a) SHA1(b16f037c49766ab734e47c8e1b16b5178809b8a3) )
419 	ROM_LOAD( "136075-1001.18l.bin", 0x0000, 0x0117, CRC(cd21acfe) SHA1(14bd9e2f1b50a1da550933e3fdc16e3f09b65e92) )
420 	ROM_LOAD( "136075-1002.8w.bin",  0x0000, 0x0117, CRC(4a7b6c44) SHA1(9579e098af3e5cd19bd14c361d3b1c5cb9047171) )
421 	ROM_LOAD( "136075-1003.9w.bin",  0x0000, 0x0117, CRC(72f7f904) SHA1(f792b5bcc313c5f3338a569a6f376a3ebb1eabf7) )
422 	ROM_LOAD( "136075-1004.6w.bin",  0x0000, 0x0117, CRC(6cd3270d) SHA1(84854b5beee539a80fc94f6e4637aa1c2543a1cb) )
423 ROM_END
424 
425 ROM_START( klaxj4 )
426 	ROM_REGION( 0x40000, "maincpu", 0 ) /* 4*64k for 68000 code */
427 	ROM_LOAD16_BYTE( "136075-4406.3n", 0x00000, 0x10000, CRC(fc4045ec) SHA1(58441ffeb58c1dc9ef18f3c6381eec52923ffe03) )
428 	ROM_LOAD16_BYTE( "136075-4405.1n", 0x00001, 0x10000, CRC(f017461a) SHA1(a0acd66a48c2a964c3e8f2bdacd94908bfc84843) )
429 	ROM_LOAD16_BYTE( "136075-4408.3k", 0x20000, 0x10000, CRC(23231159) SHA1(a0ac57d358078f7fbec95964a2608213f79e4b6f) )
430 	ROM_LOAD16_BYTE( "136075-4407.1k", 0x20001, 0x10000, CRC(8d8158b2) SHA1(299570f16a6019c34f210bffe39ff8489f3f11f1) )
431 
432 	ROM_REGION( 0x40000, "gfx1", 0 )
433 	ROM_LOAD16_BYTE( "136075-2010.17x", 0x00000, 0x10000, CRC(15290a0d) SHA1(e1338f3fb298aae19735548f4b597d1c33944960) )
434 	ROM_LOAD16_BYTE( "136075-2009.17u", 0x00001, 0x10000, CRC(6368dbaf) SHA1(fa8b5cf6777108c0b1e38a3650ee4cdb2ec76810) )
435 	ROM_LOAD16_BYTE( "136075-2012.12x", 0x20000, 0x10000, CRC(c0d9eb0f) SHA1(aa68b9ad435eeaa8b43693e237cc7f9a53d94dfc) )
436 	ROM_LOAD16_BYTE( "136075-2011.12u", 0x20001, 0x10000, CRC(e83cca91) SHA1(45f1155d51ab3e2cc08aad1ec4e557d132085cc6) )
437 
438 	ROM_REGION( 0x20000, "gfx2", 0 )
439 	ROM_LOAD16_BYTE( "136075-2014.17y", 0x00000, 0x10000, CRC(5c551e92) SHA1(cbff8fc4f4d370b6db2b4953ecbedd249916b891) )
440 	ROM_LOAD16_BYTE( "136075-2013.17w", 0x00001, 0x10000, CRC(36764bbc) SHA1(5762996a327b5f7f93f42dad7eccb6297b3e4c0b) )
441 
442 	ROM_REGION( 0x40000, "oki", 0 ) /* ADPCM data */
443 	ROM_LOAD( "136075-1015.14b", 0x00000, 0x10000, CRC(4d24c768) SHA1(da102105a4d8c552e3594b8ffb1903ecbaa69415) )
444 	ROM_LOAD( "136075-1016.12b", 0x10000, 0x10000, CRC(12e9b4b7) SHA1(2447f116cd865e46e61022143a2668beca99d5d1) )
445 
446 	ROM_REGION( 0x00573, "pals", 0 ) /* Lattice GAL16V8A-25LP GAL's */
447 	ROM_LOAD( "136075-1000.11c.bin", 0x0000, 0x0117, CRC(fb86e94a) SHA1(b16f037c49766ab734e47c8e1b16b5178809b8a3) )
448 	ROM_LOAD( "136075-1001.18l.bin", 0x0000, 0x0117, CRC(cd21acfe) SHA1(14bd9e2f1b50a1da550933e3fdc16e3f09b65e92) )
449 	ROM_LOAD( "136075-1002.8w.bin",  0x0000, 0x0117, CRC(4a7b6c44) SHA1(9579e098af3e5cd19bd14c361d3b1c5cb9047171) )
450 	ROM_LOAD( "136075-1003.9w.bin",  0x0000, 0x0117, CRC(72f7f904) SHA1(f792b5bcc313c5f3338a569a6f376a3ebb1eabf7) )
451 	ROM_LOAD( "136075-1004.6w.bin",  0x0000, 0x0117, CRC(6cd3270d) SHA1(84854b5beee539a80fc94f6e4637aa1c2543a1cb) )
452 ROM_END
453 
454 ROM_START( klaxj3 )
455 	ROM_REGION( 0x40000, "maincpu", 0 ) /* 4*64k for 68000 code */
456 	ROM_LOAD16_BYTE( "136075-3406.3n", 0x00000, 0x10000, CRC(ab2aa50b) SHA1(0ebffc8b4724eb8c4423e0b1f62b0fff7cc30aab) )
457 	ROM_LOAD16_BYTE( "136075-3405.1n", 0x00001, 0x10000, CRC(9dc9a590) SHA1(4c77b1ad9c083325f33520f2b6aa598dde247ad8) )
458 	ROM_LOAD16_BYTE( "136075-2408.3k", 0x20000, 0x10000, CRC(89d515ce) SHA1(4991b859a53f34776671f660dbdb18a746259549) )
459 	ROM_LOAD16_BYTE( "136075-2407.1k", 0x20001, 0x10000, CRC(48ce4edb) SHA1(014f879298408295a338c19c2d518524b41491cb) )
460 
461 	ROM_REGION( 0x40000, "gfx1", 0 )
462 	ROM_LOAD16_BYTE( "136075-2010.17x", 0x00000, 0x10000, CRC(15290a0d) SHA1(e1338f3fb298aae19735548f4b597d1c33944960) )
463 	ROM_LOAD16_BYTE( "136075-2009.17u", 0x00001, 0x10000, CRC(6368dbaf) SHA1(fa8b5cf6777108c0b1e38a3650ee4cdb2ec76810) )
464 	ROM_LOAD16_BYTE( "136075-2012.12x", 0x20000, 0x10000, CRC(c0d9eb0f) SHA1(aa68b9ad435eeaa8b43693e237cc7f9a53d94dfc) )
465 	ROM_LOAD16_BYTE( "136075-2011.12u", 0x20001, 0x10000, CRC(e83cca91) SHA1(45f1155d51ab3e2cc08aad1ec4e557d132085cc6) )
466 
467 	ROM_REGION( 0x20000, "gfx2", 0 )
468 	ROM_LOAD16_BYTE( "136075-2014.17y", 0x00000, 0x10000, CRC(5c551e92) SHA1(cbff8fc4f4d370b6db2b4953ecbedd249916b891) )
469 	ROM_LOAD16_BYTE( "136075-2013.17w", 0x00001, 0x10000, CRC(36764bbc) SHA1(5762996a327b5f7f93f42dad7eccb6297b3e4c0b) )
470 
471 	ROM_REGION( 0x40000, "oki", 0 ) /* ADPCM data */
472 	ROM_LOAD( "136075-1015.14b", 0x00000, 0x10000, CRC(4d24c768) SHA1(da102105a4d8c552e3594b8ffb1903ecbaa69415) )
473 	ROM_LOAD( "136075-1016.12b", 0x10000, 0x10000, CRC(12e9b4b7) SHA1(2447f116cd865e46e61022143a2668beca99d5d1) )
474 
475 	ROM_REGION( 0x00573, "pals", 0 ) /* Lattice GAL16V8A-25LP GAL's */
476 	ROM_LOAD( "136075-1000.11c.bin", 0x0000, 0x0117, CRC(fb86e94a) SHA1(b16f037c49766ab734e47c8e1b16b5178809b8a3) )
477 	ROM_LOAD( "136075-1001.18l.bin", 0x0000, 0x0117, CRC(cd21acfe) SHA1(14bd9e2f1b50a1da550933e3fdc16e3f09b65e92) )
478 	ROM_LOAD( "136075-1002.8w.bin",  0x0000, 0x0117, CRC(4a7b6c44) SHA1(9579e098af3e5cd19bd14c361d3b1c5cb9047171) )
479 	ROM_LOAD( "136075-1003.9w.bin",  0x0000, 0x0117, CRC(72f7f904) SHA1(f792b5bcc313c5f3338a569a6f376a3ebb1eabf7) )
480 	ROM_LOAD( "136075-1004.6w.bin",  0x0000, 0x0117, CRC(6cd3270d) SHA1(84854b5beee539a80fc94f6e4637aa1c2543a1cb) )
481 ROM_END
482 
483 
484 ROM_START( klaxd2 )
485 	ROM_REGION( 0x40000, "maincpu", 0 ) /* 4*64k for 68000 code */
486 	ROM_LOAD16_BYTE( "136075-2206.3n", 0x00000, 0x10000, CRC(9d1a713b) SHA1(6e60a43934bd8959c5c07dd12e087c63ea791bb9) )
487 	ROM_LOAD16_BYTE( "136075-1205.1n", 0x00001, 0x10000, CRC(45065a5a) SHA1(77339ca04e54a04489ce9d6e11816475e57d1311) )
488 	ROM_LOAD16_BYTE( "136075-1208.3k", 0x20000, 0x10000, CRC(b4019b32) SHA1(83fba82a9100af14cddd812be9f3dbd58d8511d2) )
489 	ROM_LOAD16_BYTE( "136075-1207.1k", 0x20001, 0x10000, CRC(14550a75) SHA1(35599a339e6978682a09db4fb78c76bb3d3b6bc7) )
490 
491 	ROM_REGION( 0x40000, "gfx1", 0 )
492 	ROM_LOAD16_BYTE( "136075-2010.17x", 0x00000, 0x10000, CRC(15290a0d) SHA1(e1338f3fb298aae19735548f4b597d1c33944960) )
493 	ROM_LOAD16_BYTE( "136075-2009.17u", 0x00001, 0x10000, CRC(6368dbaf) SHA1(fa8b5cf6777108c0b1e38a3650ee4cdb2ec76810) )
494 	ROM_LOAD16_BYTE( "136075-2012.12x", 0x20000, 0x10000, CRC(c0d9eb0f) SHA1(aa68b9ad435eeaa8b43693e237cc7f9a53d94dfc) )
495 	ROM_LOAD16_BYTE( "136075-2011.12u", 0x20001, 0x10000, CRC(e83cca91) SHA1(45f1155d51ab3e2cc08aad1ec4e557d132085cc6) )
496 
497 	ROM_REGION( 0x20000, "gfx2", 0 )
498 	ROM_LOAD16_BYTE( "136075-2014.17y", 0x00000, 0x10000, CRC(5c551e92) SHA1(cbff8fc4f4d370b6db2b4953ecbedd249916b891) )
499 	ROM_LOAD16_BYTE( "136075-2013.17w", 0x00001, 0x10000, CRC(36764bbc) SHA1(5762996a327b5f7f93f42dad7eccb6297b3e4c0b) )
500 
501 	ROM_REGION( 0x40000, "oki", 0 ) /* ADPCM data */
502 	ROM_LOAD( "136075-1015.14b", 0x00000, 0x10000, CRC(4d24c768) SHA1(da102105a4d8c552e3594b8ffb1903ecbaa69415) )
503 	ROM_LOAD( "136075-1016.12b", 0x10000, 0x10000, CRC(12e9b4b7) SHA1(2447f116cd865e46e61022143a2668beca99d5d1) )
504 
505 	ROM_REGION( 0x00573, "pals", 0 ) /* Lattice GAL16V8A-25LP GAL's */
506 	ROM_LOAD( "136075-1000.11c.bin", 0x0000, 0x0117, CRC(fb86e94a) SHA1(b16f037c49766ab734e47c8e1b16b5178809b8a3) )
507 	ROM_LOAD( "136075-1001.18l.bin", 0x0000, 0x0117, CRC(cd21acfe) SHA1(14bd9e2f1b50a1da550933e3fdc16e3f09b65e92) )
508 	ROM_LOAD( "136075-1002.8w.bin",  0x0000, 0x0117, CRC(4a7b6c44) SHA1(9579e098af3e5cd19bd14c361d3b1c5cb9047171) )
509 	ROM_LOAD( "136075-1003.9w.bin",  0x0000, 0x0117, CRC(72f7f904) SHA1(f792b5bcc313c5f3338a569a6f376a3ebb1eabf7) )
510 	ROM_LOAD( "136075-1004.6w.bin",  0x0000, 0x0117, CRC(6cd3270d) SHA1(84854b5beee539a80fc94f6e4637aa1c2543a1cb) )
511 ROM_END
512 
513 
514 /*************************************
515  *
516  *  Game driver(s)
517  *
518  *************************************/
519 
520 GAME( 1989, klax,     0,    klax,    klax, klax_state, empty_init, ROT0, "Atari Games",        "Klax (version 6)", 0 )
521 GAME( 1989, klax5,    klax, klax,    klax, klax_state, empty_init, ROT0, "Atari Games",        "Klax (version 5)", 0 )
522 GAME( 1989, klax4,    klax, klax,    klax, klax_state, empty_init, ROT0, "Atari Games",        "Klax (version 4)", 0 )
523 GAME( 1989, klaxj4,   klax, klax,    klax, klax_state, empty_init, ROT0, "Atari Games",        "Klax (Japan, version 4)", 0 )
524 GAME( 1989, klaxj3,   klax, klax,    klax, klax_state, empty_init, ROT0, "Atari Games",        "Klax (Japan, version 3)", 0 )
525 GAME( 1989, klaxd2,   klax, klax,    klax, klax_state, empty_init, ROT0, "Atari Games",        "Klax (Germany, version 2)", 0 )
526 
527 GAME( 1989, klax5bl,  klax, klax5bl, klax, klax_state, empty_init, ROT0, "bootleg",            "Klax (version 5, bootleg set 1)", MACHINE_NOT_WORKING )
528 GAME( 1989, klax5bl2, klax, klax5bl, klax, klax_state, empty_init, ROT0, "bootleg",            "Klax (version 5, bootleg set 2)", MACHINE_NOT_WORKING )
529 GAME( 1989, klax5bl3, klax, klax5bl, klax, klax_state, empty_init, ROT0, "bootleg (Playmark)", "Klax (version 5, bootleg set 3)", MACHINE_NOT_WORKING )
530