1 // license:BSD-3-Clause
2 // copyright-holders:Angelo Salese
3 /****************************************
4 
5     "Universal System 16" Hardware (c) 1983/1986 Namco
6 
7     driver by Angelo Salese,
8     original "wiped off due of not anymore licenseable" driver by Edgardo E. Contini Salvan.
9 
10     TODO:
11     - PAL is presumably inverted with address bit 11 (0x800) for 0x6000-0x7fff area
12       between Libble Rabble and Toy Pop.
13     - Proper sprite DMA.
14     - Flip Screen;
15     - Remaining outputs;
16 
17     Notes:
18     ------
19     - Libble Rabble Easter egg:
20      - enter service mode
21      - turn off the service mode switch, and turn it on again quickly to remain
22        on the monitor test grid
23      - Enter the following sequence using the right joystick:
24        9xU 2xR 9xD 2xL
25     (c) 1983 NAMCO LTD. will appear on the screen.
26 
27 ****************************************/
28 
29 #include "emu.h"
30 #include "machine/namcoio.h"
31 
32 #include "cpu/m6809/m6809.h"
33 #include "cpu/m68000/m68000.h"
34 #include "machine/timer.h"
35 #include "sound/namco.h"
36 #include "emupal.h"
37 #include "screen.h"
38 #include "speaker.h"
39 
40 
41 #define MASTER_CLOCK XTAL(6'144'000)
42 
43 class namcos16_state : public driver_device
44 {
45 public:
namcos16_state(const machine_config & mconfig,device_type type,const char * tag)46 	namcos16_state(const machine_config &mconfig, device_type type, const char *tag) :
47 		driver_device(mconfig, type, tag),
48 		m_master_cpu(*this,"maincpu"),
49 		m_slave_cpu(*this, "slave"),
50 		m_sound_cpu(*this, "audiocpu"),
51 		m_namco15xx(*this, "namco"),
52 		m_namco58xx(*this, "58xx"),
53 		m_namco56xx_1(*this, "56xx_1"),
54 		m_namco56xx_2(*this, "56xx_2"),
55 		m_palette(*this, "palette"),
56 		m_gfxdecode(*this, "gfxdecode"),
57 		m_master_workram(*this, "master_workram"),
58 		m_slave_sharedram(*this, "slave_sharedram"),
59 		m_bgvram(*this, "bgvram"),
60 		m_fgvram(*this, "fgvram"),
61 		m_fgattr(*this, "fgattr")
62 	{
63 	}
64 
65 	void toypop(machine_config &config);
66 	void liblrabl(machine_config &config);
67 
68 private:
69 	required_device<cpu_device> m_master_cpu;
70 	required_device<cpu_device> m_slave_cpu;
71 	required_device<cpu_device> m_sound_cpu;
72 
73 	required_device<namco_15xx_device> m_namco15xx;
74 	required_device<namco58xx_device> m_namco58xx;
75 	required_device<namco56xx_device> m_namco56xx_1;
76 	required_device<namco56xx_device> m_namco56xx_2;
77 	required_device<palette_device> m_palette;
78 	required_device<gfxdecode_device> m_gfxdecode;
79 
80 	required_shared_ptr<uint8_t> m_master_workram;
81 	required_shared_ptr<uint8_t> m_slave_sharedram;
82 	required_shared_ptr<uint16_t> m_bgvram;
83 	required_shared_ptr<uint8_t> m_fgvram;
84 	required_shared_ptr<uint8_t> m_fgattr;
85 
86 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
87 
88 	TIMER_DEVICE_CALLBACK_MEMBER(master_scanline);
89 	DECLARE_WRITE_LINE_MEMBER(slave_vblank_irq);
90 
91 	uint8_t irq_enable_r();
92 	void irq_disable_w(uint8_t data);
93 	void irq_ctrl_w(offs_t offset, uint8_t data);
94 	void toypop_palette(palette_device &palette) const;
95 	uint8_t dipA_l();
96 	uint8_t dipA_h();
97 	uint8_t dipB_l();
98 	uint8_t dipB_h();
99 	//void out_coin0(uint8_t data);
100 	//void out_coin1(uint8_t data);
101 	void pal_bank_w(offs_t offset, uint8_t data);
102 	void flip(uint8_t data);
103 	void slave_halt_ctrl_w(offs_t offset, uint8_t data);
104 	uint8_t slave_shared_r(offs_t offset);
105 	void slave_shared_w(offs_t offset, uint8_t data);
106 	void slave_irq_enable_w(offs_t offset, uint16_t data);
107 	void sound_halt_ctrl_w(offs_t offset, uint8_t data);
108 	uint8_t bg_rmw_r(offs_t offset);
109 	void bg_rmw_w(offs_t offset, uint8_t data);
110 
111 	void master_liblrabl_map(address_map &map);
112 	void master_toypop_map(address_map &map);
113 	void namcos16_master_base_map(address_map &map);
114 	void slave_map(address_map &map);
115 	void sound_map(address_map &map);
116 
117 	// driver_device overrides
118 //  virtual void machine_start() override;
119 	virtual void machine_reset() override;
120 
121 //  virtual void video_start() override;
122 
123 	bool m_master_irq_enable;
124 	bool m_slave_irq_enable;
125 	uint8_t m_pal_bank;
126 
127 	void legacy_bg_draw(bitmap_ind16 &bitmap,const rectangle &cliprect,bool flip);
128 	void legacy_fg_draw(bitmap_ind16 &bitmap,const rectangle &cliprect,bool flip);
129 	void legacy_obj_draw(bitmap_ind16 &bitmap,const rectangle &cliprect,bool flip);
130 };
131 
toypop_palette(palette_device & palette) const132 void namcos16_state::toypop_palette(palette_device &palette) const
133 {
134 	uint8_t const *const color_prom = memregion("proms")->base();
135 
136 	for (int i = 0; i < 256; i++)
137 	{
138 		int bit0, bit1, bit2, bit3;
139 
140 		// red component
141 		bit0 = BIT(color_prom[i], 0);
142 		bit1 = BIT(color_prom[i], 1);
143 		bit2 = BIT(color_prom[i], 2);
144 		bit3 = BIT(color_prom[i], 3);
145 		int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
146 		// green component
147 		bit0 = BIT(color_prom[i + 0x100], 0);
148 		bit1 = BIT(color_prom[i + 0x100], 1);
149 		bit2 = BIT(color_prom[i + 0x100], 2);
150 		bit3 = BIT(color_prom[i + 0x100], 3);
151 		int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
152 		// blue component
153 		bit0 = BIT(color_prom[i + 0x200], 0);
154 		bit1 = BIT(color_prom[i + 0x200], 1);
155 		bit2 = BIT(color_prom[i + 0x200], 2);
156 		bit3 = BIT(color_prom[i + 0x200], 3);
157 		int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
158 
159 		palette.set_indirect_color(i, rgb_t(r, g, b));
160 	}
161 
162 	for (int i = 0; i < 256; i++)
163 	{
164 		// characters
165 		palette.set_pen_indirect(i + 0*256, (color_prom[i + 0x300] & 0x0f) | 0x70);
166 		palette.set_pen_indirect(i + 1*256, (color_prom[i + 0x300] & 0x0f) | 0xf0);
167 
168 		// sprites
169 		uint8_t const entry = color_prom[i + 0x500];
170 		palette.set_pen_indirect(i + 2*256, entry);
171 	}
172 
173 	for (int i = 0; i < 16; i++)
174 	{
175 		// background
176 		palette.set_pen_indirect(i + 3*256 + 0*16, 0x60 + i);
177 		palette.set_pen_indirect(i + 3*256 + 1*16, 0xe0 + i);
178 	}
179 }
180 
legacy_bg_draw(bitmap_ind16 & bitmap,const rectangle & cliprect,bool flip)181 void namcos16_state::legacy_bg_draw(bitmap_ind16 &bitmap,const rectangle &cliprect,bool flip)
182 {
183 	uint16_t const pal_base = 0x300 + (m_pal_bank << 4);
184 	uint32_t const src_base = 0x200/2;
185 	uint16_t const src_pitch = 288 / 2;
186 
187 	for (int y = cliprect.min_y; y <= cliprect.max_y; ++y)
188 	{
189 		uint16_t const *src = &m_bgvram[y * src_pitch + cliprect.min_x + src_base];
190 		uint16_t *dst = &bitmap.pix(flip ? (cliprect.max_y - y) : y, flip ? cliprect.max_x : cliprect.min_x);
191 
192 		for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2)
193 		{
194 			uint32_t const srcpix = *src++;
195 			int const idx1 = ((srcpix >> 8) & 0xf) + pal_base;
196 			int const idx2 = (srcpix & 0xf) + pal_base;
197 			if (!flip)
198 			{
199 				*dst++ = m_palette->pen(idx1);
200 				*dst++ = m_palette->pen(idx2);
201 			}
202 			else
203 			{
204 				*dst-- = m_palette->pen(idx1);
205 				*dst-- = m_palette->pen(idx2);
206 			}
207 		}
208 	}
209 }
210 
legacy_fg_draw(bitmap_ind16 & bitmap,const rectangle & cliprect,bool flip)211 void namcos16_state::legacy_fg_draw(bitmap_ind16 &bitmap,const rectangle &cliprect,bool flip)
212 {
213 	gfx_element *const gfx_0 = m_gfxdecode->gfx(0);
214 
215 	for (int count = 0; count < 32*32; count++)
216 	{
217 		int const xoffs(count >> 5);
218 		int const yoffs(count & 0x1f);
219 		int x;// = (count % 32);
220 		int y; //= count / 32;
221 
222 		if (count < 64)
223 		{
224 			x = 34 + xoffs;
225 			y = yoffs - 2;
226 		}
227 		else if (count >= 32*30)
228 		{
229 			x = xoffs - 30;
230 			y = yoffs - 2;
231 		}
232 		else
233 		{
234 			x = 2 + yoffs;
235 			y = xoffs - 2;
236 		}
237 
238 		uint16_t tile = m_fgvram[count];
239 		uint8_t color = (m_fgattr[count] & 0x3f) + (m_pal_bank << 6);
240 
241 		gfx_0->transpen(bitmap, cliprect, tile, color, flip, flip, (flip ? 35-x : x)*8, (flip ? 27-y : y)*8, 0);
242 	}
243 }
244 
245 // TODO: this is likely to be a lot more complex, and maybe is per scanline too
legacy_obj_draw(bitmap_ind16 & bitmap,const rectangle & cliprect,bool flip)246 void namcos16_state::legacy_obj_draw(bitmap_ind16 &bitmap,const rectangle &cliprect,bool flip)
247 {
248 	gfx_element *gfx_1 = m_gfxdecode->gfx(1);
249 	int count;
250 	uint8_t *base_spriteram = m_master_workram;
251 	const uint16_t bank1 = 0x0800;
252 	const uint16_t bank2 = 0x1000;
253 
254 
255 	for (count=0x780;count<0x800;count+=2)
256 	{
257 		bool enabled = (base_spriteram[count+bank2+1] & 2) == 0;
258 
259 		if(enabled == false)
260 			continue;
261 
262 		static const int gfx_offs[2][2] =
263 		{
264 			{ 0, 1 },
265 			{ 2, 3 }
266 		};
267 		uint8_t tile = base_spriteram[count];
268 		uint8_t color = base_spriteram[count+1];
269 		int x = base_spriteram[count+bank1+1] + (base_spriteram[count+bank2+1] << 8);
270 		x -= 71;
271 
272 		int y = base_spriteram[count+bank1+0];
273 		y += 7;
274 		// TODO: actually m_screen.height()
275 		y = 224 - y;
276 
277 		bool fx = (base_spriteram[count+bank2] & 1) == 1;
278 		bool fy = (base_spriteram[count+bank2] & 2) == 2;
279 		uint8_t width = ((base_spriteram[count+bank2] & 4) >> 2) + 1;
280 		uint8_t height = ((base_spriteram[count+bank2] & 8) >> 3) + 1;
281 
282 		tile &= ~(width - 1);
283 		tile &= ~((height - 1) << 1);
284 
285 		if (flip)
286 		{
287 			fx ^= 1;
288 			fy ^= 1;
289 		}
290 
291 		if (height == 2)
292 			y -=16;
293 
294 		for (int yi=0; yi<height; yi++)
295 		{
296 			for(int xi=0; xi<width; xi++)
297 			{
298 				uint16_t sprite_offs = tile + gfx_offs[yi ^ ((height - 1) * fy)][xi ^ ((width - 1) * fx)];
299 				gfx_1->transmask(bitmap,cliprect,sprite_offs,color,fx,fy,x + xi*16,y + yi *16,m_palette->transpen_mask(*gfx_1, color, 0xff));
300 			}
301 		}
302 	}
303 }
304 
screen_update(screen_device & screen,bitmap_ind16 & bitmap,const rectangle & cliprect)305 uint32_t namcos16_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect )
306 {
307 	bool const flip = flip_screen();
308 	legacy_bg_draw(bitmap,cliprect,flip);
309 	legacy_fg_draw(bitmap,cliprect,flip);
310 	legacy_obj_draw(bitmap,cliprect,flip);
311 	return 0;
312 }
313 
irq_enable_r()314 uint8_t namcos16_state::irq_enable_r()
315 {
316 	m_master_irq_enable = true;
317 	return 0;
318 }
319 
irq_disable_w(uint8_t data)320 void namcos16_state::irq_disable_w(uint8_t data)
321 {
322 	m_master_irq_enable = false;
323 }
324 
325 
irq_ctrl_w(offs_t offset,uint8_t data)326 void namcos16_state::irq_ctrl_w(offs_t offset, uint8_t data)
327 {
328 	m_master_irq_enable = (offset & 0x0800) ? false : true;
329 }
330 
slave_halt_ctrl_w(offs_t offset,uint8_t data)331 void namcos16_state::slave_halt_ctrl_w(offs_t offset, uint8_t data)
332 {
333 	m_slave_cpu->set_input_line(INPUT_LINE_RESET,offset & 0x800 ? ASSERT_LINE : CLEAR_LINE);
334 }
335 
sound_halt_ctrl_w(offs_t offset,uint8_t data)336 void namcos16_state::sound_halt_ctrl_w(offs_t offset, uint8_t data)
337 {
338 	m_sound_cpu->set_input_line(INPUT_LINE_RESET,offset & 0x800 ? ASSERT_LINE : CLEAR_LINE);
339 }
340 
slave_shared_r(offs_t offset)341 uint8_t namcos16_state::slave_shared_r(offs_t offset)
342 {
343 	return m_slave_sharedram[offset];
344 }
345 
slave_shared_w(offs_t offset,uint8_t data)346 void namcos16_state::slave_shared_w(offs_t offset, uint8_t data)
347 {
348 	m_slave_sharedram[offset] = data;
349 }
350 
slave_irq_enable_w(offs_t offset,uint16_t data)351 void namcos16_state::slave_irq_enable_w(offs_t offset, uint16_t data)
352 {
353 	m_slave_irq_enable = (offset & 0x40000) ? false : true;
354 }
355 
bg_rmw_r(offs_t offset)356 uint8_t namcos16_state::bg_rmw_r(offs_t offset)
357 {
358 	uint8_t res;
359 
360 	res = 0;
361 	// note: following offset is written as offset * 2
362 	res |= (m_bgvram[offset] & 0x0f00) >> 4;
363 	res |= (m_bgvram[offset] & 0x000f);
364 	return res;
365 }
366 
bg_rmw_w(offs_t offset,uint8_t data)367 void namcos16_state::bg_rmw_w(offs_t offset, uint8_t data)
368 {
369 	// note: following offset is written as offset * 2
370 	m_bgvram[offset] = (data & 0xf) | ((data & 0xf0) << 4);
371 }
372 
dipA_l()373 uint8_t namcos16_state::dipA_l() { return ioport("DSW1")->read(); }                // dips A
dipA_h()374 uint8_t namcos16_state::dipA_h() { return ioport("DSW1")->read() >> 4; }           // dips A
dipB_l()375 uint8_t namcos16_state::dipB_l() { return ioport("DSW2")->read(); }                // dips B
dipB_h()376 uint8_t namcos16_state::dipB_h() { return ioport("DSW2")->read() >> 4; }           // dips B
377 
flip(uint8_t data)378 void namcos16_state::flip(uint8_t data)
379 {
380 	flip_screen_set(data & 1);
381 }
382 
pal_bank_w(offs_t offset,uint8_t data)383 void namcos16_state::pal_bank_w(offs_t offset, uint8_t data)
384 {
385 	m_pal_bank = offset & 1;
386 }
387 
namcos16_master_base_map(address_map & map)388 void namcos16_state::namcos16_master_base_map(address_map &map)
389 {
390 	map(0x0000, 0x03ff).ram().share("fgvram");
391 	map(0x0400, 0x07ff).ram().share("fgattr");
392 	map(0x0800, 0x1fff).ram().share("master_workram");
393 	map(0x2800, 0x2fff).ram().share("slave_sharedram");
394 
395 	// 0x6000 - 0x7fff i/o specific, guessing PAL controlled.
396 
397 	map(0x8000, 0x8fff).w(FUNC(namcos16_state::slave_halt_ctrl_w));
398 	map(0x9000, 0x9fff).w(FUNC(namcos16_state::sound_halt_ctrl_w));
399 	map(0xa000, 0xa001).w(FUNC(namcos16_state::pal_bank_w));
400 	map(0x8000, 0xffff).rom().region("master_rom", 0);
401 }
402 
master_liblrabl_map(address_map & map)403 void namcos16_state::master_liblrabl_map(address_map &map)
404 {
405 	namcos16_master_base_map(map);
406 	map(0x6000, 0x63ff).rw(m_namco15xx, FUNC(namco_15xx_device::sharedram_r), FUNC(namco_15xx_device::sharedram_w));
407 	map(0x6800, 0x680f).rw(m_namco58xx, FUNC(namco58xx_device::read), FUNC(namco58xx_device::write));
408 	map(0x6810, 0x681f).rw(m_namco56xx_1, FUNC(namco56xx_device::read), FUNC(namco56xx_device::write));
409 	map(0x6820, 0x682f).rw(m_namco56xx_2, FUNC(namco56xx_device::read), FUNC(namco56xx_device::write));
410 	map(0x7000, 0x7fff).nopr().w(FUNC(namcos16_state::irq_ctrl_w));
411 }
412 
master_toypop_map(address_map & map)413 void namcos16_state::master_toypop_map(address_map &map)
414 {
415 	namcos16_master_base_map(map);
416 	map(0x6000, 0x600f).rw(m_namco58xx, FUNC(namco58xx_device::read), FUNC(namco58xx_device::write));
417 	map(0x6010, 0x601f).rw(m_namco56xx_1, FUNC(namco56xx_device::read), FUNC(namco56xx_device::write));
418 	map(0x6020, 0x602f).rw(m_namco56xx_2, FUNC(namco56xx_device::read), FUNC(namco56xx_device::write));
419 	map(0x6800, 0x6bff).rw(m_namco15xx, FUNC(namco_15xx_device::sharedram_r), FUNC(namco_15xx_device::sharedram_w));
420 	map(0x7000, 0x7000).rw(FUNC(namcos16_state::irq_enable_r), FUNC(namcos16_state::irq_disable_w));
421 }
422 
slave_map(address_map & map)423 void namcos16_state::slave_map(address_map &map)
424 {
425 	map(0x000000, 0x007fff).rom().region("slave_rom", 0);
426 	map(0x080000, 0x0bffff).ram();
427 	map(0x100000, 0x100fff).rw(FUNC(namcos16_state::slave_shared_r), FUNC(namcos16_state::slave_shared_w)).umask16(0x00ff);
428 	map(0x180000, 0x187fff).rw(FUNC(namcos16_state::bg_rmw_r), FUNC(namcos16_state::bg_rmw_w));
429 	map(0x190000, 0x1dffff).ram().share("bgvram");
430 	map(0x300000, 0x3fffff).w(FUNC(namcos16_state::slave_irq_enable_w));
431 }
432 
sound_map(address_map & map)433 void namcos16_state::sound_map(address_map &map)
434 {
435 	map(0x0000, 0x03ff).rw(m_namco15xx, FUNC(namco_15xx_device::sharedram_r), FUNC(namco_15xx_device::sharedram_w));
436 	map(0xe000, 0xffff).rom().region("sound_rom", 0);
437 }
438 
439 
440 
441 static INPUT_PORTS_START( liblrabl )
442 	/* The inputs are not memory mapped, they are handled by three I/O chips. */
443 	PORT_START("P1_RIGHT")  /* 58XX #0 pins 22-29 */
444 	PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_8WAY
445 	PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_8WAY
446 	PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_8WAY
447 	PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_8WAY
448 
449 	PORT_START("P2_RIGHT")  /* 58XX #0 pins 22-29 */
450 	PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_UP ) PORT_8WAY PORT_COCKTAIL
451 	PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_RIGHT ) PORT_8WAY PORT_COCKTAIL
452 	PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_DOWN ) PORT_8WAY PORT_COCKTAIL
453 	PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICKRIGHT_LEFT ) PORT_8WAY PORT_COCKTAIL
454 
455 	PORT_START("P1_LEFT")   /* 56XX #2 pins 22-29 */
456 	PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_8WAY
457 	PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_8WAY
458 	PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_8WAY
459 	PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_8WAY
460 
461 	PORT_START("P2_LEFT")   /* 56XX #2 pins 22-29 */
462 	PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_UP ) PORT_8WAY PORT_COCKTAIL
463 	PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_RIGHT ) PORT_8WAY PORT_COCKTAIL
464 	PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_DOWN ) PORT_8WAY PORT_COCKTAIL
465 	PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICKLEFT_LEFT ) PORT_8WAY PORT_COCKTAIL
466 
467 	PORT_START("BUTTONS")   /* 58XX #0 pins 30-33 and 38-41 */
468 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
469 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
470 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
471 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
472 
473 	PORT_START("COINS") /* 58XX #0 pins 30-33 and 38-41 */
474 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
475 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
476 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
477 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
478 
479 	PORT_START("DSW1")  /* 56XX #1 pins 22-29 */
480 	/* default setting: all OFF */
481 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SWA:8,7")
482 	PORT_DIPSETTING(    0x02, "1" )
483 	PORT_DIPSETTING(    0x00, "2" )
484 	PORT_DIPSETTING(    0x03, "3" )
485 	PORT_DIPSETTING(    0x01, "5" )
486 	PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SWA:6,5,4")
487 	// bonus scores for common
488 	PORT_DIPSETTING(    0x1c, "40k 120k 200k 400k 600k 1m" )
489 	PORT_DIPSETTING(    0x0c, "40k 140k 250k 400k 700k 1m" )
490 	// bonus scores for 1, 2 or 3 lives
491 	PORT_DIPSETTING(    0x14, "50k 150k 300k 500k 700k 1m" ) PORT_CONDITION("DSW1", 0x03, NOTEQUALS, 0x01)
492 	PORT_DIPSETTING(    0x04, "40k 120k and every 120k" )    PORT_CONDITION("DSW1", 0x03, NOTEQUALS, 0x01)
493 	PORT_DIPSETTING(    0x18, "40k 150k and every 150k" )    PORT_CONDITION("DSW1", 0x03, NOTEQUALS, 0x01)
494 	PORT_DIPSETTING(    0x08, "50k 150k 300k" )              PORT_CONDITION("DSW1", 0x03, NOTEQUALS, 0x01)
495 	PORT_DIPSETTING(    0x10, "40k 120k 200k" )              PORT_CONDITION("DSW1", 0x03, NOTEQUALS, 0x01)
496 	// bonus scores for 5 lives
497 	PORT_DIPSETTING(    0x14, "40k 120k" )                   PORT_CONDITION("DSW1", 0x03, EQUALS, 0x01)
498 	PORT_DIPSETTING(    0x04, "50k 150k" )                   PORT_CONDITION("DSW1", 0x03, EQUALS, 0x01)
499 	PORT_DIPSETTING(    0x18, "50k 150k and every 150k" )    PORT_CONDITION("DSW1", 0x03, EQUALS, 0x01)
500 	PORT_DIPSETTING(    0x08, "60k 200k and every 200k" )    PORT_CONDITION("DSW1", 0x03, EQUALS, 0x01)
501 	PORT_DIPSETTING(    0x10, "50k" )                        PORT_CONDITION("DSW1", 0x03, EQUALS, 0x01)
502 	// bonus scores for common
503 	PORT_DIPSETTING(    0x00, DEF_STR( None ) )
504 	PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SWA:3,2,1")
505 	PORT_DIPSETTING(    0x80, DEF_STR( 3C_1C ) )
506 	PORT_DIPSETTING(    0xc0, DEF_STR( 2C_1C ) )
507 	PORT_DIPSETTING(    0x00, DEF_STR( 3C_2C ) )
508 	PORT_DIPSETTING(    0xe0, DEF_STR( 1C_1C ) )
509 	PORT_DIPSETTING(    0x40, DEF_STR( 2C_3C ) )
510 	PORT_DIPSETTING(    0x60, DEF_STR( 1C_2C ) )
511 	PORT_DIPSETTING(    0xa0, DEF_STR( 1C_3C ) )
512 	PORT_DIPSETTING(    0x20, DEF_STR( 1C_6C ) )
513 
514 	PORT_START("DSW2")  /* 56XX #1 pins 30-33 and 38-41 */
515 	PORT_DIPNAME( 0x01, 0x01, "Freeze" ) PORT_DIPLOCATION("SWB:8")
516 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
517 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
518 	PORT_DIPNAME( 0x02, 0x02, "Rack Test" ) PORT_DIPLOCATION("SWB:7")
519 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
520 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
521 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:6")
522 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
523 	PORT_DIPSETTING(    0x04, DEF_STR( On ) )
524 	PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SWB:5,4")
525 	PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
526 	PORT_DIPSETTING(    0x18, DEF_STR( 1C_1C ) )
527 	PORT_DIPSETTING(    0x08, DEF_STR( 1C_5C ) )
528 	PORT_DIPSETTING(    0x10, DEF_STR( 1C_7C ) )
529 	PORT_DIPNAME( 0x20, 0x20, "Practice" ) PORT_DIPLOCATION("SWB:3")
530 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
531 	PORT_DIPSETTING(    0x20, DEF_STR( On ) )
532 	PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:2,1")
533 	PORT_DIPSETTING(    0xc0, "A" )
534 	PORT_DIPSETTING(    0x40, "B" )
535 	PORT_DIPSETTING(    0x80, "C" )
536 	PORT_DIPSETTING(    0x00, "D" )
537 
538 	PORT_START("SERVICE")   /* 56XX #2 pins 30-33 */
539 	PORT_BIT( 0x03, IP_ACTIVE_LOW, IPT_UNUSED )
540 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Cabinet ) )
541 	PORT_DIPSETTING(    0x04, DEF_STR( Upright ) )
542 	PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
543 	PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
544 INPUT_PORTS_END
545 
546 static INPUT_PORTS_START( toypop )
547 	/* The inputs are not memory mapped, they are handled by three I/O chips. */
548 	PORT_START("P1_RIGHT")  /* 58XX #0 pins 22-29 */
549 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY
550 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY
551 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY
552 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY
553 
554 	PORT_START("P2_RIGHT")  /* 58XX #0 pins 22-29 */
555 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_PLAYER(2)
556 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_PLAYER(2)
557 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_PLAYER(2)
558 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_PLAYER(2)
559 
560 	PORT_START("BUTTONS")   /* 58XX #0 pins 30-33 and 38-41 */
561 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
562 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
563 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
564 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
565 
566 	PORT_START("COINS") /* 58XX #0 pins 30-33 and 38-41 */
567 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
568 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
569 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
570 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE1 )
571 
572 	PORT_START("DSW1")  /* 56XX #1 pins 22-29 */
573 	/* default setting: all OFF */
574 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SWA:8,7")
575 	PORT_DIPSETTING(    0x02, "1" )
576 	PORT_DIPSETTING(    0x01, "2" )
577 	PORT_DIPSETTING(    0x03, "3" )
578 	PORT_DIPSETTING(    0x00, "5" )
579 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SWA:6,5")
580 	PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
581 	PORT_DIPSETTING(    0x04, DEF_STR( 2C_1C ) )
582 	PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
583 	PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
584 	PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SWA:4,3")
585 	PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
586 	PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
587 	PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
588 	PORT_DIPSETTING(    0x20, DEF_STR( 1C_2C ) )
589 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SWA:2")
590 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
591 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
592 	PORT_SERVICE_DIPLOC( 0x80, 0x80, "SWA:1" )
593 
594 	PORT_START("DSW2")  /* 56XX #1 pins 30-33 and 38-41 */
595 	PORT_DIPNAME( 0x01, 0x01, "Freeze" ) PORT_DIPLOCATION("SWB:8")
596 	PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
597 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
598 	PORT_DIPNAME( 0x02, 0x02, DEF_STR( Level_Select ) ) PORT_DIPLOCATION("SWB:7")
599 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
600 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
601 	PORT_DIPNAME( 0x04, 0x04, "2 Players Game" ) PORT_DIPLOCATION("SWB:6")
602 	PORT_DIPSETTING(    0x00, "1 Credit" )
603 	PORT_DIPSETTING(    0x04, "2 Credits" )
604 	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SWB:5")
605 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
606 	PORT_DIPSETTING(    0x08, DEF_STR( On ) )
607 	PORT_DIPNAME( 0x10, 0x10, "Entering" ) PORT_DIPLOCATION("SWB:4")    // buy in
608 	PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
609 	PORT_DIPSETTING(    0x10, DEF_STR( On ) )
610 	PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SWB:3,2")
611 	PORT_DIPSETTING(    0x40, DEF_STR( Easy ) )
612 	PORT_DIPSETTING(    0x60, DEF_STR( Normal ) )
613 	PORT_DIPSETTING(    0x20, DEF_STR( Hard ) )
614 	PORT_DIPSETTING(    0x00, DEF_STR( Very_Hard ) )
615 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SWB:1")
616 	PORT_DIPSETTING(    0x80, "Every 15000 points" )
617 	PORT_DIPSETTING(    0x00, "Every 20000 points" )
618 
619 	PORT_START("P1_LEFT")   /* 56XX #2 pins 22-29 */
620 	PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
621 
622 	PORT_START("P2_LEFT")   /* 56XX #2 pins 22-29 */
623 	PORT_BIT(0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
624 
625 	PORT_START("SERVICE")   /* 56XX #2 pins 30-33 */
626 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
627 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
628 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) // would be Cabinet, but this game has no cocktail mode
629 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SERVICE )    // service mode again
630 INPUT_PORTS_END
631 
632 
633 static const gfx_layout charlayout =
634 {
635 	8,8,
636 	RGN_FRAC(1,1),
637 	2,
638 	{ 0, 4 },
639 	{ 8*8+0, 8*8+1, 8*8+2, 8*8+3, 0, 1, 2, 3 },
640 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
641 	16*8
642 };
643 
644 static const gfx_layout spritelayout =
645 {
646 	16,16,
647 	RGN_FRAC(1,1),
648 	2,
649 	{ 0, 4 },
650 	{ 0, 1, 2, 3, 8*8, 8*8+1, 8*8+2, 8*8+3, 16*8+0, 16*8+1, 16*8+2, 16*8+3,
651 	24*8+0, 24*8+1, 24*8+2, 24*8+3 },
652 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
653 	32 * 8, 33 * 8, 34 * 8, 35 * 8, 36 * 8, 37 * 8, 38 * 8, 39 * 8 },
654 	64*8
655 };
656 
657 static GFXDECODE_START( gfx_toypop )
658 	GFXDECODE_ENTRY( "gfx1", 0, charlayout,       0, 128 )
659 	GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 128*4,  64 )
660 GFXDECODE_END
661 
machine_reset()662 void namcos16_state::machine_reset()
663 {
664 	m_master_irq_enable = false;
665 	m_slave_irq_enable = false;
666 	m_slave_cpu->set_input_line(INPUT_LINE_RESET,ASSERT_LINE);
667 	m_sound_cpu->set_input_line(INPUT_LINE_RESET,ASSERT_LINE);
668 }
669 
TIMER_DEVICE_CALLBACK_MEMBER(namcos16_state::master_scanline)670 TIMER_DEVICE_CALLBACK_MEMBER(namcos16_state::master_scanline)
671 {
672 	int scanline = param;
673 
674 	if(scanline == 224 && m_master_irq_enable == true)
675 		m_master_cpu->set_input_line(M6809_IRQ_LINE,HOLD_LINE);
676 
677 	// TODO: definitely can't fire from this, presume that a command send has a timing response ...
678 	if(scanline == 0)
679 	{
680 		if (!m_namco58xx->read_reset_line())
681 			m_namco58xx->customio_run();
682 
683 		if (!m_namco56xx_1->read_reset_line())
684 			m_namco56xx_1->customio_run();
685 
686 		if (!m_namco56xx_2->read_reset_line())
687 			m_namco56xx_2->customio_run();
688 	}
689 }
690 
WRITE_LINE_MEMBER(namcos16_state::slave_vblank_irq)691 WRITE_LINE_MEMBER(namcos16_state::slave_vblank_irq)
692 {
693 	if (state && m_slave_irq_enable == true)
694 		m_slave_cpu->set_input_line(6, HOLD_LINE);
695 }
696 
liblrabl(machine_config & config)697 void namcos16_state::liblrabl(machine_config &config)
698 {
699 	MC6809E(config, m_master_cpu, MASTER_CLOCK/4);
700 	m_master_cpu->set_addrmap(AS_PROGRAM, &namcos16_state::master_liblrabl_map);
701 	TIMER(config, "scantimer").configure_scanline(FUNC(namcos16_state::master_scanline), "screen", 0, 1);
702 
703 	M68000(config, m_slave_cpu, MASTER_CLOCK);
704 	m_slave_cpu->set_addrmap(AS_PROGRAM, &namcos16_state::slave_map);
705 
706 	MC6809E(config, m_sound_cpu, MASTER_CLOCK/4);
707 	m_sound_cpu->set_addrmap(AS_PROGRAM, &namcos16_state::sound_map);
708 	m_sound_cpu->set_periodic_int(FUNC(namcos16_state::irq0_line_hold), attotime::from_hz(60));
709 
710 	NAMCO_58XX(config, m_namco58xx, 0);
711 	m_namco58xx->in_callback<0>().set_ioport("COINS");
712 	m_namco58xx->in_callback<1>().set_ioport("P1_RIGHT");
713 	m_namco58xx->in_callback<2>().set_ioport("P2_RIGHT");
714 	m_namco58xx->in_callback<3>().set_ioport("BUTTONS");
715 
716 	NAMCO_56XX(config, m_namco56xx_1, 0);
717 	m_namco56xx_1->in_callback<0>().set(FUNC(namcos16_state::dipA_h));
718 	m_namco56xx_1->in_callback<1>().set(FUNC(namcos16_state::dipB_l));
719 	m_namco56xx_1->in_callback<2>().set(FUNC(namcos16_state::dipB_h));
720 	m_namco56xx_1->in_callback<3>().set(FUNC(namcos16_state::dipA_l));
721 	m_namco56xx_1->out_callback<0>().set(FUNC(namcos16_state::flip));
722 
723 	NAMCO_56XX(config, m_namco56xx_2, 0);
724 	m_namco56xx_2->in_callback<1>().set_ioport("P1_LEFT");
725 	m_namco56xx_2->in_callback<2>().set_ioport("P2_LEFT");
726 	m_namco56xx_2->in_callback<3>().set_ioport("SERVICE");
727 
728 	screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
729 	screen.set_raw(MASTER_CLOCK,384,0,288,264,0,224); // derived from Galaxian HW, 60.606060
730 	screen.set_screen_update(FUNC(namcos16_state::screen_update));
731 	screen.set_palette(m_palette);
732 	screen.screen_vblank().set(FUNC(namcos16_state::slave_vblank_irq));
733 
734 	GFXDECODE(config, m_gfxdecode, m_palette, gfx_toypop);
735 	PALETTE(config, m_palette, FUNC(namcos16_state::toypop_palette), 128*4 + 64*4 + 16*2, 256);
736 
737 	/* sound hardware */
738 	SPEAKER(config, "mono").front_center();
739 	NAMCO_15XX(config, m_namco15xx, 24000);
740 	m_namco15xx->set_voices(8);
741 	m_namco15xx->add_route(ALL_OUTPUTS, "mono", 1.0);
742 }
743 
toypop(machine_config & config)744 void namcos16_state::toypop(machine_config &config)
745 {
746 	liblrabl(config);
747 	m_master_cpu->set_addrmap(AS_PROGRAM, &namcos16_state::master_toypop_map);
748 }
749 
750 
751 ROM_START( liblrabl )
752 	ROM_REGION( 0x8000, "master_rom", 0 )
753 	ROM_LOAD( "5b.rom",   0x0000, 0x4000, CRC(da7a93c2) SHA1(fe4a02cdab66722eb7b8cf58825f899b1949a6a2) )
754 	ROM_LOAD( "5c.rom",   0x4000, 0x4000, CRC(6cae25dc) SHA1(de74317a7d5de1865d096c377923a764be5e6879) )
755 
756 	ROM_REGION( 0x2000, "sound_rom", 0 )
757 	ROM_LOAD( "2c.rom",   0x0000, 0x2000, CRC(7c09e50a) SHA1(5f004d60bbb7355e008a9cda137b28bc2192b8ef) )
758 
759 	ROM_REGION16_BE( 0x8000, "slave_rom", 0 )
760 	ROM_LOAD16_BYTE("8c.rom",    0x0000, 0x4000, CRC(a00cd959) SHA1(cc5621103c31cfbc65941615cab391db0f74e6ce) )
761 	ROM_LOAD16_BYTE("10c.rom",   0x0001, 0x4000, CRC(09ce209b) SHA1(2ed46d6592f8227bac8ab54963d9a300706ade47) )
762 
763 	ROM_REGION( 0x2000, "gfx1", 0 )
764 	ROM_LOAD( "5p.rom",   0x0000, 0x2000, CRC(3b4937f0) SHA1(06d9de576f1c2262c34aeb91054e68c9298af688) )
765 
766 	ROM_REGION( 0x4000, "gfx2", 0 )
767 	ROM_LOAD( "9t.rom",   0x0000, 0x4000, CRC(a88e24ca) SHA1(eada133579f19de09255084dcdc386311606a335) )
768 
769 	ROM_REGION( 0x0600, "proms", 0 )
770 	ROM_LOAD( "lr1-3.1r", 0x0000, 0x0100, CRC(f3ec0d07) SHA1(b0aad1fb6df79f202889600f486853995352f9c2) )
771 	ROM_LOAD( "lr1-2.1s", 0x0100, 0x0100, CRC(2ae4f702) SHA1(838fdca9e91fea4f64a59880ac47c48973bb8fbf) )
772 	ROM_LOAD( "lr1-1.1t", 0x0200, 0x0100, CRC(7601f208) SHA1(572d070ca387b780030ed5de38a8970b7cc14349) )
773 	ROM_LOAD( "lr1-5.5l", 0x0300, 0x0100, CRC(940f5397) SHA1(825a7bd78a8a08d30bad2e4890ae6e9ad88b36b8) )
774 	ROM_LOAD( "lr1-6.2p", 0x0400, 0x0200, CRC(a6b7f850) SHA1(7cfde16dfd5c4d5b876b4fbe4f924f1385932a93) )
775 
776 	ROM_REGION( 0x0100, "namco", 0 )
777 	ROM_LOAD( "lr1-4.3d", 0x0000, 0x0100, CRC(16a9166a) SHA1(847cbaf7c88616576c410177e066ae1d792ac0ba) )
778 ROM_END
779 
780 ROM_START( toypop )
781 	ROM_REGION( 0x8000, "master_rom", 0 )
782 	ROM_LOAD( "tp1-2.5b", 0x0000, 0x4000, CRC(87469620) SHA1(2ee257486c9c044386ac7d0cd4a90583eaeb3e97) )
783 	ROM_LOAD( "tp1-1.5c", 0x4000, 0x4000, CRC(dee2fd6e) SHA1(b2c12008d6d3e7544ba3c12a52a6abf9181842c8) )
784 
785 	ROM_REGION( 0x2000, "sound_rom", 0 )
786 	ROM_LOAD( "tp1-3.2c", 0x0000, 0x2000, CRC(5f3bf6e2) SHA1(d1b3335661b9b23cb10001416c515b77b5e783e9) )
787 
788 	ROM_REGION16_BE( 0x8000, "slave_rom", 0 )
789 	ROM_LOAD16_BYTE("tp1-4.8c",  0x0000, 0x4000, CRC(76997db3) SHA1(5023a2f20a5f2c9baff130f6832583493c71f883) )
790 	ROM_LOAD16_BYTE("tp1-5.10c", 0x0001, 0x4000, CRC(37de8786) SHA1(710365e34c05d01815844c414518f93234b6160b) )
791 
792 	ROM_REGION( 0x2000, "gfx1", 0 )
793 	ROM_LOAD( "tp1-7.5p", 0x0000, 0x2000, CRC(95076f9e) SHA1(1e3d32b21f6d46591ec3921aba51f672d64a9023) )
794 
795 	ROM_REGION( 0x4000, "gfx2", 0 )
796 	ROM_LOAD( "tp1-6.9t", 0x0000, 0x4000, CRC(481ffeaf) SHA1(c51735ad3a1dbb46ad414408b54554e9223b2219) )
797 
798 	ROM_REGION( 0x0600, "proms", 0 )
799 	ROM_LOAD( "tp1-3.1r", 0x0000, 0x0100, CRC(cfce2fa5) SHA1(b42aa0f34d885389d2650bf7a0531b95703b8a28) )
800 	ROM_LOAD( "tp1-2.1s", 0x0100, 0x0100, CRC(aeaf039d) SHA1(574560526100d38635aecd71eb73499c4f57d586) )
801 	ROM_LOAD( "tp1-1.1t", 0x0200, 0x0100, CRC(08e7cde3) SHA1(5261aca6834d635d17f8afaa8e35848930030ba4) )
802 	ROM_LOAD( "tp1-4.5l", 0x0300, 0x0100, CRC(74138973) SHA1(2e21dbb1b19dd089da52e70fcb0ca91336e004e6) )
803 	ROM_LOAD( "tp1-5.2p", 0x0400, 0x0200, CRC(4d77fa5a) SHA1(2438910314b23ecafb553230244f3931861ad2da) )
804 
805 	ROM_REGION( 0x0100, "namco", 0 )
806 	ROM_LOAD( "tp1-6.3d", 0x0000, 0x0100, CRC(16a9166a) SHA1(847cbaf7c88616576c410177e066ae1d792ac0ba) )
807 ROM_END
808 
809 GAME( 1983, liblrabl, 0,     liblrabl, liblrabl, namcos16_state, empty_init, ROT0,   "Namco", "Libble Rabble", 0 )
810 GAME( 1986, toypop,   0,     toypop,   toypop,   namcos16_state, empty_init, ROT180, "Namco", "Toypop",        0 )
811