1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood
3 /*
4 
5 what is this HW cloned from? I doubt it's an original design
6 
7 Promat / Oriental Soft SPR800E driver
8 
9 1945K-III (Newer)    2000   Oriental Soft
10 1945K-III (Older)    1999   Oriental Soft
11 Solite Spirits       1999   Promat
12 '96 Flag Rally       1996   Promat???
13 
14 NOTES
15 -----
16 1945K-III is clearly a retooled Solite Spirtis. There are spots in 1945K-III where it shows "SOLITE SPIRITS"
17   such as the ship selection screen's background and after the continue countdown expires, but before the high score table.
18   It's unknown if the changes were specifically meant for an Export version or if Promat was trying to capitalized
19   on Psikyo's Striker 1945 series and it's name.
20   Older version of 1945K-III there's no dipswitches for Demo Sound or Allow Continue - Demo sounds always OFF
21 
22 Solite Spirit:
23   Demo loop is extremely short and only shows one area
24   The test screen is basically just for sound test (in 1945K-III you get inputs, then press P1 & P2 start to test sounds)
25   In 2 player games when selecting ships, "player 2" uses the same "P1" graphic (fixed in 1945K-III)
26   No "Lives", Demo Sound or Allow Continue dipswitches - Demo sounds always ON
27 
28 ---------------
29 
30 1945K-III
31 Oriental, 2000
32 
33 This game is a straight rip-off of Psikyo's Strikers 1945 III.
34 
35 OPCX2 PCB Layout
36 ----------
37 
38 ORIENTAL SOFT INC., -OPCX2-
39 |--------------------------------------------|
40 |    AD-65   SND-1.SU7            M16M-1.U62 |
41 |                     PAL                    |
42 |    AD-65   SND-2.SU4                       |
43 |                                 M16M-2.U63 |
44 |                                            |
45 |                    KM681000                |
46 |J                   KM681000     6116       |
47 |A                                           |
48 |M          62256    |-------|    6116       |
49 |M          62256    |SPR800E|               |
50 |A                   |OP-CX1 |    6116  6116 |
51 |    6116   PRG-1.U51|QFP208 |               |
52 |                    |-------|    6116  6116 |
53 |    6116   PRG-2.U52                        |
54 |                 |-----| |------|           |
55 |           PAL   |     | |QL2003| M16M-3.U61|
56 |           PAL   |68000| |PLCC84|           |
57 |DSW1 DSW2        |-----| |------| PAL       |
58 |             16MHz        27MHz             |
59 |--------------------------------------------|
60 Notes:
61      68000 clock : 16.000MHz
62     M6295 clocks : 1.000MHz (both), sample rate = 1000000 / 132
63            VSync : 60Hz
64 
65 
66 
67 Promat / ORIENTAL SOFT INC., -OPCX1-
68 |--------------------------------------------|
69 |    AD-65   SU5                     U5  U58 |
70 |VR1         SU10*    PAL            U6  U59 |
71 |    AD-65   SU11*                   U7  U60 |
72 |            SU4                     U8  U61 |
73 |                                            |
74 |J                                      6116 |
75 |A                                      6116 |
76 |M 4.000MHz  PAL  KM681000 |-------|    6116 |
77 |M                         |SPR800E|    6116 |
78 |A           PAL  KM681000 |OP-CX1 |    6116 |
79 |                          |QFP208 |    6116 |
80 |      6116 62256  U34     |-------|         |
81 |      6116 62256  U35    |------|           |
82 |                         |QL2003|      U102 |
83 |             MC68000P16  |PLCC84| PAL  U103 |
84 |DSW1 DSW2                |------|      U104 |
85 |RESET1       16.000MHz    27.000MHz    U105 |
86 |--------------------------------------------|
87 
88   CPU: MC86000P16
89 Sound: OKIM6295 x 2
90   OSC: 27.000MHz, 16.000MHz & 4.000MHz
91 Other: QuickLogic QL2003-XPL84C, SPR800E
92        RESET1 Reset button, VR1 volume pot
93   DSW: 8 poistion x 2
94 
95 * denotes unpopulated socket
96 
97 SPR800E on the 1945K-III OPCX1 PCB silkscreened  ORIENTAL  OP-CX1  SPR800E  9937E
98 SPR800E on the Solite Spirits PCB silkscreened  PROMAT  SPR800E  ES928
99 */
100 
101 #include "emu.h"
102 #include "cpu/m68000/m68000.h"
103 #include "sound/okim6295.h"
104 #include "emupal.h"
105 #include "screen.h"
106 #include "speaker.h"
107 #include "tilemap.h"
108 
109 #define MASTER_CLOCK    XTAL(16'000'000)
110 
111 
112 class k3_state : public driver_device
113 {
114 public:
k3_state(const machine_config & mconfig,device_type type,const char * tag)115 	k3_state(const machine_config &mconfig, device_type type, const char *tag) :
116 		driver_device(mconfig, type, tag),
117 		m_oki(*this, "oki%u", 1U) ,
118 		m_spriteram(*this, "spritera%u", 1U),
119 		m_bgram(*this, "bgram"),
120 		m_maincpu(*this, "maincpu"),
121 		m_gfxdecode(*this, "gfxdecode"),
122 		m_palette(*this, "palette"),
123 		m_screen(*this, "screen")
124 	{ }
125 
126 	void flagrall(machine_config &config);
127 	void k3(machine_config &config);
128 
129 private:
130 	void vram_buffer(bool newval);
131 	void scrollx_w(u16 data);
132 	void scrolly_w(u16 data);
133 	void k3_soundbanks_w(u16 data);
134 	void flagrall_soundbanks_w(offs_t offset, u16 data, u16 mem_mask = ~0);
135 	TILE_GET_INFO_MEMBER(get_tile_info);
136 
137 	virtual void video_start() override;
138 
139 	void k3_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,
140 							u32 code,u32 color,bool flipx,bool flipy,int offsx,int offsy,
141 							u8 transparent_color, bool flicker);
142 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
143 	u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
144 
145 	void k3_map(address_map &map);
146 	void flagrall_map(address_map &map);
147 	void k3_base_map(address_map &map);
148 
149 	/* devices */
150 	optional_device_array<okim6295_device, 2> m_oki;
151 	/* memory pointers */
152 	required_shared_ptr_array<u16, 2> m_spriteram;
153 	required_shared_ptr<u16> m_bgram;
154 
155 	/* video-related */
156 	std::unique_ptr<u16[]> m_spriteram_buffer[2];
157 	std::unique_ptr<u16[]> m_bgram_buffer;
158 	bool m_refresh = false;
159 	tilemap_t  *m_bg_tilemap;
160 	required_device<cpu_device> m_maincpu;
161 	required_device<gfxdecode_device> m_gfxdecode;
162 	required_device<palette_device> m_palette;
163 	required_device<screen_device> m_screen;
164 };
165 
166 
TILE_GET_INFO_MEMBER(k3_state::get_tile_info)167 TILE_GET_INFO_MEMBER(k3_state::get_tile_info)
168 {
169 	int tileno = m_bgram_buffer[tile_index];
170 	tileinfo.set(1, tileno, 0, 0);
171 }
172 
video_start()173 void k3_state::video_start()
174 {
175 	m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(k3_state::get_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
176 	for (int i = 0; i < 2; i++)
177 	{
178 		const u32 size = m_spriteram[i].bytes() / 2;
179 		m_spriteram_buffer[i] = make_unique_clear<u16[]>(size);
180 		save_pointer(NAME(m_spriteram_buffer[i]), size, i);
181 	}
182 	const u32 size = m_bgram.bytes() / 2;
183 	m_bgram_buffer = make_unique_clear<u16[]>(size);
184 	save_pointer(NAME(m_bgram_buffer), size);
185 
186 	save_item(NAME(m_refresh));
187 }
188 
k3_drawgfx(bitmap_ind16 & dest_bmp,const rectangle & clip,gfx_element * gfx,u32 code,u32 color,bool flipx,bool flipy,int offsx,int offsy,u8 transparent_color,bool flicker)189 void k3_state::k3_drawgfx(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,
190 							u32 code,u32 color,bool flipx,bool flipy,int offsx,int offsy,
191 							u8 transparent_color, bool flicker)
192 {
193 	/* Start drawing */
194 	const u16 pal = gfx->colorbase() + gfx->granularity() * (color % gfx->colors());
195 	const u8 *source_base = gfx->get_data(code % gfx->elements());
196 
197 	int xinc = flipx ? -1 : 1;
198 	int yinc = flipy ? -1 : 1;
199 
200 	int x_index_base = flipx ? gfx->width() - 1 : 0;
201 	int y_index = flipy ? gfx->height() - 1 : 0;
202 
203 	// start coordinates
204 	int sx = offsx;
205 	int sy = offsy;
206 
207 	// end coordinates
208 	int ex = sx + gfx->width();
209 	int ey = sy + gfx->height();
210 
211 	if (sx < clip.min_x)
212 	{ // clip left
213 		int pixels = clip.min_x - sx;
214 		sx += pixels;
215 		x_index_base += xinc * pixels;
216 	}
217 	if (sy < clip.min_y)
218 	{ // clip top
219 		int pixels = clip.min_y - sy;
220 		sy += pixels;
221 		y_index += yinc * pixels;
222 	}
223 	// NS 980211 - fixed incorrect clipping
224 	if (ex > clip.max_x + 1)
225 	{ // clip right
226 		ex = clip.max_x + 1;
227 	}
228 	if (ey > clip.max_y + 1)
229 	{ // clip bottom
230 		ey = clip.max_y + 1;
231 	}
232 
233 	if (ex > sx)
234 	{ // skip if inner loop doesn't draw anything
235 		for (int y = sy; y < ey; y++)
236 		{
237 			u8 const *const source = source_base + y_index * gfx->rowbytes();
238 			u16 *const dest = &dest_bmp.pix(y);
239 			int x_index = x_index_base;
240 			for (int x = sx; x < ex; x++)
241 			{
242 				u8 c = source[x_index];
243 				if (c != transparent_color)
244 				{
245 					if (flicker) // verified from PCB (reference : https://www.youtube.com/watch?v=ooXyyvpW1O0)
246 					{
247 						dest[x] = pal | 0xff;
248 					}
249 					else
250 					{
251 						dest[x] = pal | c;
252 					}
253 				}
254 				x_index += xinc;
255 			}
256 			y_index += yinc;
257 		}
258 	}
259 }
260 
261 // sprite limitation reference : https://www.youtube.com/watch?v=_7V_SrEQwSY
262 // TODO : measure values from real hardware
draw_sprites(bitmap_ind16 & bitmap,const rectangle & cliprect)263 void k3_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
264 {
265 	const u32 max_cycle = m_screen->width() * m_screen->height(); // max usable cycle for sprites, TODO : related to whole screen?
266 	u32 cycle = 0;
267 	gfx_element *gfx = m_gfxdecode->gfx(0);
268 	u16 *source = m_spriteram_buffer[0].get();
269 	u16 *source2 = m_spriteram_buffer[1].get();
270 	u16 *finish = source + (m_spriteram[0].bytes() / 2);
271 
272 	while (source < finish)
273 	{
274 		cycle += 4 + 128; // 4 cycle per reading RAM, 128? cycle per each tiles
275 		if (cycle > max_cycle)
276 			break;
277 
278 		int xpos = (source[0] & 0xff00) >> 8 | (source2[0] & 0x0001) << 8;
279 		int ypos = (source[0] & 0x00ff) >> 0;
280 		u32 tileno = (source2[0] & 0x7ffe) >> 1;
281 		bool flicker = BIT(source2[0], 15);
282 
283 		k3_drawgfx(bitmap, cliprect, gfx, tileno, 1, false, false, xpos, ypos, 0, flicker);
284 		k3_drawgfx(bitmap, cliprect, gfx, tileno, 1, false, false, xpos, ypos - 0x100, 0, flicker); // wrap
285 		k3_drawgfx(bitmap, cliprect, gfx, tileno, 1, false, false, xpos - 0x200, ypos, 0, flicker); // wrap
286 		k3_drawgfx(bitmap, cliprect, gfx, tileno, 1, false, false, xpos - 0x200, ypos - 0x100, 0, flicker); // wrap
287 
288 		source++;
289 		source2++;
290 	}
291 }
292 
screen_update(screen_device & screen,bitmap_ind16 & bitmap,const rectangle & cliprect)293 u32 k3_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
294 {
295 	m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
296 	draw_sprites(bitmap, cliprect);
297 	return 0;
298 }
299 
vram_buffer(bool newval)300 void k3_state::vram_buffer(bool newval)
301 {
302 	const bool oldval = m_refresh;
303 	if (!oldval && newval)
304 	{
305 		for (int j = 0; j < 2; j++)
306 		{
307 			const u32 size = m_spriteram[j].bytes() / 2;
308 			for (int i = 0; i < size; i++)
309 				m_spriteram_buffer[j][i] = m_spriteram[j][i];
310 		}
311 		const u32 size = m_bgram.bytes() / 2;
312 		for (int i = 0; i < size; i++)
313 			m_bgram_buffer[i] = m_bgram[i];
314 
315 		m_bg_tilemap->mark_all_dirty();
316 	}
317 	m_refresh = newval;
318 }
319 
scrollx_w(u16 data)320 void k3_state::scrollx_w(u16 data)
321 {
322 	m_bg_tilemap->set_scrollx(0, data);
323 }
324 
scrolly_w(u16 data)325 void k3_state::scrolly_w(u16 data)
326 {
327 	m_bg_tilemap->set_scrolly(0, data);
328 }
329 
k3_soundbanks_w(u16 data)330 void k3_state::k3_soundbanks_w(u16 data)
331 {
332 	/*
333 	    ---- ---- ---x ---- Unknown
334 	    ---- ---- ---- -x-- OKI1 Bank
335 	    ---- ---- ---- --x- OKI0 Bank
336 	    ---- ---- ---- ---x VRAM access flip-flop
337 	*/
338 	vram_buffer(BIT(data, 0)); // rising edge
339 	m_oki[1]->set_rom_bank(BIT(data, 2));
340 	m_oki[0]->set_rom_bank(BIT(data, 1));
341 }
342 
flagrall_soundbanks_w(offs_t offset,u16 data,u16 mem_mask)343 void k3_state::flagrall_soundbanks_w(offs_t offset, u16 data, u16 mem_mask)
344 {
345 	data &= mem_mask;
346 
347 	// 0x0200 on startup
348 	// 0x0100 on startup
349 
350 	// 0x80 - ?
351 	// 0x40 - ?
352 	// 0x20 - VRAM access flip-flop
353 	// 0x10 - unknown, always on?
354 	// 0x08 - ?
355 	// 0x06 - oki bank
356 	// 0x01 - ?
357 
358 	vram_buffer(BIT(~data, 5)); // falling edge
359 	if (data & 0xfcc9)
360 		popmessage("unk control %04x", data & 0xfcc9);
361 
362 	m_oki[0]->set_rom_bank((data & 0x6) >> 1);
363 }
364 
365 
k3_base_map(address_map & map)366 void k3_state::k3_base_map(address_map &map)
367 {
368 	map(0x0009ce, 0x0009cf).nopw();    // k3 - bug in code? (clean up log)
369 	map(0x0009d0, 0x0009d1).nopw();
370 	map(0x0009d2, 0x0009d3).nopw();    // l3 - bug in code? (clean up log)
371 
372 	map(0x000000, 0x0fffff).rom(); // ROM
373 	map(0x100000, 0x10ffff).ram(); // Main Ram
374 	map(0x200000, 0x2003ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
375 	map(0x240000, 0x240fff).ram().share(m_spriteram[0]);
376 	map(0x280000, 0x280fff).ram().share(m_spriteram[1]);
377 	map(0x2c0000, 0x2c07ff).ram().share(m_bgram);
378 	map(0x2c0800, 0x2c0fff).ram(); // or does k3 have a bigger tilemap? (flagrall is definitely 32x32 tiles)
379 	map(0x340000, 0x340001).w(FUNC(k3_state::scrollx_w));
380 	map(0x380000, 0x380001).w(FUNC(k3_state::scrolly_w));
381 	map(0x400000, 0x400001).portr("INPUTS");
382 	map(0x440000, 0x440001).portr("SYSTEM");
383 	map(0x480000, 0x480001).portr("DSW");
384 }
385 
k3_map(address_map & map)386 void k3_state::k3_map(address_map &map)
387 {
388 	k3_base_map(map);
389 
390 	map(0x3c0000, 0x3c0001).w(FUNC(k3_state::k3_soundbanks_w));
391 
392 	map(0x4c0001, 0x4c0001).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write)).cswidth(16);
393 	map(0x500001, 0x500001).rw(m_oki[1], FUNC(okim6295_device::read), FUNC(okim6295_device::write)).cswidth(16);
394 	map(0x8c0000, 0x8cffff).ram(); // not used? (bug in code?)
395 }
396 
397 
flagrall_map(address_map & map)398 void k3_state::flagrall_map(address_map &map)
399 {
400 	k3_base_map(map);
401 
402 	map(0x3c0000, 0x3c0001).w(FUNC(k3_state::flagrall_soundbanks_w));
403 	map(0x4c0001, 0x4c0001).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
404 }
405 
406 
407 static INPUT_PORTS_START( k3 )
408 	PORT_START("INPUTS")
409 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
410 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
411 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
412 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
413 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
414 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
415 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
416 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
417 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
418 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
419 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
420 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
421 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
422 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
423 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
424 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
425 
426 	PORT_START("SYSTEM")
427 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
428 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
429 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
430 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START2 )
431 	PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* Are these used at all? */
432 
433 	PORT_START("DSW")
434 	PORT_DIPNAME( 0x007,  0x0007, DEF_STR( Coin_A ) )           PORT_DIPLOCATION("SW1:1,2,3")
435 	PORT_DIPSETTING(      0x0002, DEF_STR( 5C_1C ) )
436 	PORT_DIPSETTING(      0x0001, DEF_STR( 4C_1C ) )
437 	PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
438 	PORT_DIPSETTING(      0x0006, DEF_STR( 2C_1C ) )
439 	PORT_DIPSETTING(      0x0007, DEF_STR( 1C_1C ) )
440 	PORT_DIPSETTING(      0x0004, DEF_STR( 1C_2C ) )
441 	PORT_DIPSETTING(      0x0000, DEF_STR( 1C_3C ) )
442 	PORT_DIPSETTING(      0x0003, DEF_STR( Free_Play ) )
443 	PORT_DIPNAME( 0x0018, 0x0008, DEF_STR( Difficulty ) )       PORT_DIPLOCATION("SW1:4,5")
444 	PORT_DIPSETTING(      0x0000, DEF_STR( Easy ) )
445 	PORT_DIPSETTING(      0x0008, DEF_STR( Normal ) )
446 	PORT_DIPSETTING(      0x0010, DEF_STR( Hard ) )
447 	PORT_DIPSETTING(      0x0018, DEF_STR( Hardest ) )
448 	PORT_DIPNAME( 0x0060, 0x0060, DEF_STR( Lives ) )            PORT_DIPLOCATION("SW1:6,7")
449 	PORT_DIPSETTING(      0x0040, "2" )
450 	PORT_DIPSETTING(      0x0060, "3" )
451 	PORT_DIPSETTING(      0x0020, "4" )
452 	PORT_DIPSETTING(      0x0000, "5" )
453 	PORT_SERVICE_DIPLOC(  0x0080, IP_ACTIVE_LOW, "SW1:8" )
454 	PORT_DIPNAME( 0x0100, 0x0000, DEF_STR( Demo_Sounds ) )      PORT_DIPLOCATION("SW2:1")
455 	PORT_DIPSETTING(      0x0100, DEF_STR( Off ) )
456 	PORT_DIPSETTING(      0x0000, DEF_STR( On ) )
457 	PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Allow_Continue ) )   PORT_DIPLOCATION("SW2:2")
458 	PORT_DIPSETTING(      0x0000, DEF_STR( No ) )
459 	PORT_DIPSETTING(      0x0200, DEF_STR( Yes ) )
460 	PORT_DIPUNKNOWN_DIPLOC( 0x0400, 0x0400, "SW2:3" )
461 	PORT_DIPUNKNOWN_DIPLOC( 0x0800, 0x0800, "SW2:4" )
462 	PORT_DIPUNKNOWN_DIPLOC( 0x1000, 0x1000, "SW2:5" )
463 	PORT_DIPUNKNOWN_DIPLOC( 0x2000, 0x2000, "SW2:6" )
464 	PORT_DIPUNKNOWN_DIPLOC( 0x4000, 0x4000, "SW2:7" )
465 	PORT_DIPUNKNOWN_DIPLOC( 0x8000, 0x8000, "SW2:8" )
466 INPUT_PORTS_END
467 
468 
469 static INPUT_PORTS_START( k3old )
470 	PORT_START("INPUTS")
471 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
472 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
473 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
474 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
475 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
476 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
477 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
478 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
479 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
480 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
481 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
482 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
483 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
484 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
485 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
486 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
487 
488 	PORT_START("SYSTEM")
489 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
490 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
491 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
492 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START2 )
493 	PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* Are these used at all? */
494 
495 	PORT_START("DSW")
496 	PORT_DIPNAME( 0x007,  0x0007, DEF_STR( Coin_A ) )           PORT_DIPLOCATION("SW1:1,2,3")
497 	PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
498 	PORT_DIPSETTING(      0x0006, DEF_STR( 2C_1C ) )
499 	PORT_DIPSETTING(      0x0007, DEF_STR( 1C_1C ) )
500 	PORT_DIPSETTING(      0x0002, DEF_STR( 1C_1C ) )    // 5C_1C in newer versions
501 	PORT_DIPSETTING(      0x0001, DEF_STR( 1C_1C ) )    // 4C_1C in newer versions
502 	PORT_DIPSETTING(      0x0000, DEF_STR( 1C_1C ) )    // 1C_3C in newer versions
503 	PORT_DIPSETTING(      0x0004, DEF_STR( 1C_2C ) )
504 	PORT_DIPSETTING(      0x0003, DEF_STR( Free_Play ) )
505 	PORT_DIPNAME( 0x0018, 0x0008, DEF_STR( Difficulty ) )       PORT_DIPLOCATION("SW1:4,5")
506 	PORT_DIPSETTING(      0x0000, DEF_STR( Easy ) )
507 	PORT_DIPSETTING(      0x0008, DEF_STR( Normal ) )
508 	PORT_DIPSETTING(      0x0010, DEF_STR( Hard ) )
509 	PORT_DIPSETTING(      0x0018, DEF_STR( Hardest ) )
510 	PORT_DIPNAME( 0x0060, 0x0060, DEF_STR( Lives ) )            PORT_DIPLOCATION("SW1:6,7")
511 	PORT_DIPSETTING(      0x0040, "2" )
512 	PORT_DIPSETTING(      0x0060, "3" )
513 	PORT_DIPSETTING(      0x0020, "4" )
514 	PORT_DIPSETTING(      0x0000, "5" )
515 	PORT_SERVICE_DIPLOC(  0x0080, IP_ACTIVE_LOW, "SW1:8" )
516 	PORT_DIPUNKNOWN_DIPLOC( 0x0100, 0x0100, "SW2:1" )   // In newer 1945K-III sets this is Demo_Sounds - Demo Sounds always OFF here!
517 	PORT_DIPUNKNOWN_DIPLOC( 0x0200, 0x0200, "SW2:2" )   // In newer 1945K-III sets this is Allow_Continue - Always Continue
518 	PORT_DIPUNKNOWN_DIPLOC( 0x0400, 0x0400, "SW2:3" )
519 	PORT_DIPUNKNOWN_DIPLOC( 0x0800, 0x0800, "SW2:4" )
520 	PORT_DIPUNKNOWN_DIPLOC( 0x1000, 0x1000, "SW2:5" )
521 	PORT_DIPUNKNOWN_DIPLOC( 0x2000, 0x2000, "SW2:6" )
522 	PORT_DIPUNKNOWN_DIPLOC( 0x4000, 0x4000, "SW2:7" )
523 	PORT_DIPUNKNOWN_DIPLOC( 0x8000, 0x8000, "SW2:8" )
524 INPUT_PORTS_END
525 
526 
527 static INPUT_PORTS_START( solite )
528 	PORT_START("INPUTS")
529 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
530 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
531 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
532 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
533 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
534 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
535 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
536 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1)
537 	PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
538 	PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
539 	PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
540 	PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
541 	PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
542 	PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
543 	PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
544 	PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2)
545 
546 	PORT_START("SYSTEM")
547 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
548 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
549 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 )
550 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START2 )
551 	PORT_BIT( 0xfff0, IP_ACTIVE_LOW, IPT_UNKNOWN )  /* Are these used at all? */
552 
553 	PORT_START("DSW")
554 	PORT_DIPNAME( 0x007,  0x0007, DEF_STR( Coin_A ) )           PORT_DIPLOCATION("SW1:1,2,3")
555 	PORT_DIPSETTING(      0x0005, DEF_STR( 3C_1C ) )
556 	PORT_DIPSETTING(      0x0006, DEF_STR( 2C_1C ) )
557 	PORT_DIPSETTING(      0x0007, DEF_STR( 1C_1C ) )
558 	PORT_DIPSETTING(      0x0002, DEF_STR( 1C_1C ) )
559 	PORT_DIPSETTING(      0x0001, DEF_STR( 1C_1C ) )
560 	PORT_DIPSETTING(      0x0000, DEF_STR( 1C_1C ) )
561 	PORT_DIPSETTING(      0x0004, DEF_STR( 1C_2C ) )
562 	PORT_DIPSETTING(      0x0003, DEF_STR( Free_Play ) )
563 	PORT_DIPNAME( 0x0018, 0x0008, DEF_STR( Difficulty ) )       PORT_DIPLOCATION("SW1:4,5")
564 	PORT_DIPSETTING(      0x0000, DEF_STR( Easy ) )
565 	PORT_DIPSETTING(      0x0008, DEF_STR( Normal ) )
566 	PORT_DIPSETTING(      0x0010, DEF_STR( Hard ) )
567 	PORT_DIPSETTING(      0x0018, DEF_STR( Hardest ) )
568 	PORT_DIPUNKNOWN_DIPLOC( 0x0020, 0x0020, "SW1:6" )   // In 1945K-III sets 6&7 are Lives
569 	PORT_DIPUNKNOWN_DIPLOC( 0x0040, 0x0040, "SW1:7" )   // In 1945K-III sets 6&7 are Lives
570 	PORT_SERVICE_DIPLOC(  0x0080, IP_ACTIVE_LOW, "SW1:8" )
571 	PORT_DIPUNKNOWN_DIPLOC( 0x0100, 0x0100, "SW2:1" )   // In newer 1945K-III sets this is Demo_Sounds - Demo Sounds always ON here!
572 	PORT_DIPUNKNOWN_DIPLOC( 0x0200, 0x0200, "SW2:2" )   // In newer 1945K-III sets this is Allow_Continue - Always Continue
573 	PORT_DIPUNKNOWN_DIPLOC( 0x0400, 0x0400, "SW2:3" )
574 	PORT_DIPUNKNOWN_DIPLOC( 0x0800, 0x0800, "SW2:4" )
575 	PORT_DIPUNKNOWN_DIPLOC( 0x1000, 0x1000, "SW2:5" )
576 	PORT_DIPUNKNOWN_DIPLOC( 0x2000, 0x2000, "SW2:6" )
577 	PORT_DIPUNKNOWN_DIPLOC( 0x4000, 0x4000, "SW2:7" )
578 	PORT_DIPUNKNOWN_DIPLOC( 0x8000, 0x8000, "SW2:8" )
579 INPUT_PORTS_END
580 
581 
582 static INPUT_PORTS_START( flagrall )
583 	PORT_START("INPUTS")
584 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
585 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
586 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
587 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
588 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
589 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
590 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
591 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
592 	PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
593 
594 	PORT_START("SYSTEM")
595 	PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
596 	PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
597 	PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_START1 ) // needed to use the continue feature even if it's not used to start the game
598 	PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
599 	PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN )
600 	PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
601 	PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
602 	PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
603 	PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
604 
605 	PORT_START("DSW")
606 	PORT_DIPNAME(  0x0003, 0x0003, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:1,2")
607 	PORT_DIPSETTING(       0x0000, DEF_STR( 3C_1C ) )
608 	PORT_DIPSETTING(       0x0001, DEF_STR( 2C_1C ) )
609 	PORT_DIPSETTING(       0x0003, DEF_STR( 1C_1C ) )
610 	PORT_DIPSETTING(       0x0002, DEF_STR( 1C_2C ) )
611 	PORT_DIPUNUSED_DIPLOC( 0x0004, IP_ACTIVE_LOW, "SW1:3" )
612 	PORT_DIPUNUSED_DIPLOC( 0x0008, IP_ACTIVE_LOW, "SW1:4" )
613 	PORT_DIPNAME(  0x0010, 0x0000, DEF_STR( Demo_Sounds ) )  PORT_DIPLOCATION("SW1:5")
614 	PORT_DIPSETTING(       0x0010, DEF_STR( Off ) )
615 	PORT_DIPSETTING(       0x0000, DEF_STR( On ) )
616 	PORT_DIPNAME(  0x0020, 0x0020, "Dip Control" )  PORT_DIPLOCATION("SW1:6")
617 	PORT_DIPSETTING(       0x0020, DEF_STR( Off ) )
618 	PORT_DIPSETTING(       0x0000, DEF_STR( On ) )
619 	PORT_DIPUNUSED_DIPLOC( 0x0040, IP_ACTIVE_LOW, "SW1:7" )
620 	PORT_DIPNAME(  0x0080, 0x0080, "Picture Test" )  PORT_DIPLOCATION("SW1:8")
621 	PORT_DIPSETTING(       0x0080, DEF_STR( Off ) )
622 	PORT_DIPSETTING(       0x0000, DEF_STR( On ) )
623 
624 	PORT_DIPNAME(  0x0300, 0x0300, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2")
625 	PORT_DIPSETTING(       0x0200, "1" )
626 	PORT_DIPSETTING(       0x0100, "2" )
627 	PORT_DIPSETTING(       0x0300, "3" )
628 	PORT_DIPSETTING(       0x0000, "5" )
629 	PORT_DIPNAME(  0x0400, 0x0400, "Bonus Type" )  PORT_DIPLOCATION("SW2:3")
630 	PORT_DIPSETTING (      0x0400, "0" )
631 	PORT_DIPSETTING(       0x0000, "1" )
632 	PORT_DIPUNUSED_DIPLOC( 0x0800, IP_ACTIVE_LOW, "SW2:4" )
633 	PORT_DIPNAME(  0x3000, 0x3000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,6")
634 	PORT_DIPSETTING(       0x0000, DEF_STR( Very_Hard ) )
635 	PORT_DIPSETTING(       0x1000, DEF_STR( Hard ) )
636 	PORT_DIPSETTING(       0x2000, DEF_STR( Easy ) )
637 	PORT_DIPSETTING(       0x3000, DEF_STR( Normal ) )
638 	PORT_DIPUNUSED_DIPLOC( 0x4000, IP_ACTIVE_LOW, "SW2:7" )
639 	PORT_DIPNAME(  0x8000, 0x8000, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW2:8")
640 	PORT_DIPSETTING(       0x8000, DEF_STR( Off ) )
641 	PORT_DIPSETTING(       0x0000, DEF_STR( On ) )
642 INPUT_PORTS_END
643 
644 
645 static const gfx_layout k3_layout =
646 {
647 	16,16,
648 	RGN_FRAC(1,1),
649 	8,
650 	{ STEP8(0,1) },
651 	{ STEP16(0,8) },
652 	{ STEP16(0,8*16) },
653 	16*128,
654 };
655 
656 
657 static GFXDECODE_START( gfx_1945kiii )
658 	GFXDECODE_ENTRY( "gfx1", 0, k3_layout,   0x000, 2  ) /* sprites */
659 	GFXDECODE_ENTRY( "gfx2", 0, k3_layout,   0x000, 2  ) /* bg tiles */
660 GFXDECODE_END
661 
662 
flagrall(machine_config & config)663 void k3_state::flagrall(machine_config &config)
664 {
665 	M68000(config, m_maincpu, MASTER_CLOCK); // ?
666 	m_maincpu->set_addrmap(AS_PROGRAM, &k3_state::flagrall_map);
667 	m_maincpu->set_vblank_int("screen", FUNC(k3_state::irq4_line_hold));
668 
669 	GFXDECODE(config, m_gfxdecode, m_palette, gfx_1945kiii);
670 
671 	SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
672 	m_screen->set_raw(XTAL(27'000'000)/4, 432, 0, 320, 315, 0, 240); // ~49.61Hz, reference : https://www.youtube.com/watch?v=CuGrTiQs4ww
673 	m_screen->set_screen_update(FUNC(k3_state::screen_update));
674 	m_screen->set_palette(m_palette);
675 
676 	PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x200);
677 
678 	SPEAKER(config, "mono").front_center();
679 
680 	OKIM6295(config, m_oki[0], MASTER_CLOCK/16, okim6295_device::PIN7_HIGH);  /* dividers? */
681 	m_oki[0]->add_route(ALL_OUTPUTS, "mono", 1.0);
682 }
683 
684 
k3(machine_config & config)685 void k3_state::k3(machine_config &config)
686 {
687 	flagrall(config);
688 
689 	m_maincpu->set_addrmap(AS_PROGRAM, &k3_state::k3_map);
690 
691 	OKIM6295(config, m_oki[1], MASTER_CLOCK/16, okim6295_device::PIN7_HIGH);  /* dividers? */
692 	m_oki[1]->add_route(ALL_OUTPUTS, "mono", 1.0);
693 
694 	m_screen->set_raw(XTAL(27'000'000)/4, 432, 0, 320, 262, 0, 224); // ~60Hz
695 }
696 
697 
698 
699 ROM_START( 1945kiii )
700 	ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
701 //  ROM_LOAD16_BYTE( "prg-1.u51", 0x00001, 0x40000, CRC(c4bbae5d) SHA1(a326fad902150c6b64c39618dda2c58baf12ae98) )
702 //  ROM_LOAD16_BYTE( "prg-2.u52", 0x00000, 0x40000, CRC(092abf2e) SHA1(be42c54c3051d4efe76858e4bc85dfadc2d0cc1a) )
703 	ROM_LOAD16_BYTE( "prg-1.u51", 0x00001, 0x80000, CRC(6b345f27) SHA1(60867fa0e2ea7ebdd4b8046315ee0c83e5cf0d74) ) /* identical halves */
704 	ROM_LOAD16_BYTE( "prg-2.u52", 0x00000, 0x80000, CRC(ce09b98c) SHA1(a06bb712b9cf2249cc535de4055b14a21c68e0c5) ) /* identical halves */
705 
706 	ROM_REGION( 0x080000, "oki2", 0 ) /* Samples */
707 	ROM_LOAD( "snd-2.su4", 0x00000, 0x80000, CRC(47e3952e) SHA1(d56524621a3f11981e4434e02f5fdb7e89fff0b4) )
708 
709 	ROM_REGION( 0x080000, "oki1", 0 ) /* Samples */
710 	ROM_LOAD( "snd-1.su7", 0x00000, 0x80000, CRC(bbb7f0ff) SHA1(458cf3a0c2d42110bc2427db675226c6b8d30999) )
711 
712 	ROM_REGION( 0x400000, "gfx1", 0 ) // sprites
713 	ROM_LOAD32_WORD( "m16m-1.u62", 0x000000, 0x200000, CRC(0b9a6474) SHA1(6110ecb17d0fef25935986af9a251fc6e88e3993) )
714 	ROM_LOAD32_WORD( "m16m-2.u63", 0x000002, 0x200000, CRC(368a8c2e) SHA1(4b1f360c4a3a86d922035774b2c712be810ec548) )
715 
716 	ROM_REGION( 0x200000, "gfx2", 0 ) // bg tiles
717 	ROM_LOAD( "m16m-3.u61", 0x00000, 0x200000, CRC(32fc80dd) SHA1(bee32493a250e9f21997114bba26b9535b1b636c) )
718 ROM_END
719 
720 ROM_START( 1945kiiin )
721 	ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
722 //  ROM_LOAD16_BYTE( "u34", 0x00001, 0x40000, CRC(234a55a5) SHA1(df0464793531251ac64cee54e474314e5e5f05ab) )
723 //  ROM_LOAD16_BYTE( "u35", 0x00000, 0x40000, CRC(1e6e23a5) SHA1(c0e3f8b34be77ff34f6dfbe1f966ca05db285e76) )
724 	ROM_LOAD16_BYTE( "u34", 0x00001, 0x80000, CRC(d0cf4f03) SHA1(3455927221afae5103c02b12c1b855f416c47e91) ) /* 27C040 ROM had no label - identical halves */
725 	ROM_LOAD16_BYTE( "u35", 0x00000, 0x80000, CRC(056c64ed) SHA1(b0eddad9c950676b94316d3aeb32f3ed4b9ade0f) ) /* 27C040 ROM had no label - identical halves */
726 
727 	ROM_REGION( 0x080000, "oki2", 0 ) /* Samples */
728 	ROM_LOAD( "snd-2.su4", 0x00000, 0x80000, CRC(47e3952e) SHA1(d56524621a3f11981e4434e02f5fdb7e89fff0b4) ) /* ROM had no label, but same data as SND-2.SU4 */
729 
730 	ROM_REGION( 0x080000, "oki1", 0 ) /* Samples */
731 	ROM_LOAD( "snd-1.su7", 0x00000, 0x80000, CRC(bbb7f0ff) SHA1(458cf3a0c2d42110bc2427db675226c6b8d30999) ) /* ROM had no label, but same data as SND-1.SU7 */
732 
733 	ROM_REGION( 0x400000, "gfx1", 0 ) // sprites
734 	ROM_LOAD32_BYTE( "u5",  0x000000, 0x080000, CRC(f328f85e) SHA1(fe1e1b86a77a9b6da0f69b20da64e69b874d8ef9) ) /* These 4 27C040 ROMs had no label */
735 	ROM_LOAD32_BYTE( "u6",  0x000001, 0x080000, CRC(cfdabf1b) SHA1(9822def10e5213d1b5c86034637481b5349bfb70) )
736 	ROM_LOAD32_BYTE( "u7",  0x000002, 0x080000, CRC(59a6a944) SHA1(20a109edddd8ab9530b94b3b2d2f8a85af2c08f8) )
737 	ROM_LOAD32_BYTE( "u8",  0x000003, 0x080000, CRC(59995aaf) SHA1(29c2c638b0dd2bf1e79707ea6f5b38b37f45b822) )
738 
739 	ROM_LOAD32_BYTE( "u58", 0x200000, 0x080000, CRC(6acf2ce4) SHA1(4b18678a9e03beb24494270d19c57bca32a72592) ) /* These 4 27C040  ROMs had no label */
740 	ROM_LOAD32_BYTE( "u59", 0x200001, 0x080000, CRC(ca6ff210) SHA1(d7e476bb41c193654495f5ed6ba39980cb3660bc) )
741 	ROM_LOAD32_BYTE( "u60", 0x200002, 0x080000, CRC(91eb038a) SHA1(b24082ba1675e87881a321ba87e079a1a027dfa4) )
742 	ROM_LOAD32_BYTE( "u61", 0x200003, 0x080000, CRC(1b358c6d) SHA1(1abe6422b420fd064a32ed9ca9a28c85996d4e57) )
743 
744 	ROM_REGION( 0x200000, "gfx2", 0 )
745 	ROM_LOAD32_BYTE( "5.u102", 0x000000, 0x80000, CRC(91b70a6b) SHA1(e53f62212d6e3ab5f892944b1933385a85e0ba8a) ) /* These 4 ROMs had no label */
746 	ROM_LOAD32_BYTE( "6.u103", 0x000001, 0x80000, CRC(7b5bfb85) SHA1(ef59d64513c7f7e6ee3dcc9bb7bb0e14a71ca957) ) /* Same data as M16M-3.U61, just split up */
747 	ROM_LOAD32_BYTE( "7.u104", 0x000002, 0x80000, CRC(cdafcedf) SHA1(82becd002a16185220131085db6576eb763429c8) )
748 	ROM_LOAD32_BYTE( "8.u105", 0x000003, 0x80000, CRC(2c3895d5) SHA1(ab5837d996c1bb70071db02f07412c182d7547f8) )
749 ROM_END
750 
751 ROM_START( 1945kiiio )
752 	ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
753 //  ROM_LOAD16_BYTE( "3.u34", 0x00001, 0x40000, CRC(bcfb8b84) SHA1(7126463231cfaf4d6baf4d2efba88079c6c4c399) )
754 //  ROM_LOAD16_BYTE( "4.u35", 0x00000, 0x40000, CRC(ec1234a5) SHA1(36cf7a48236acd75365eefbba81024c343bb0124) )
755 	ROM_LOAD16_BYTE( "3.u34", 0x00001, 0x80000, CRC(5515baa0) SHA1(6fd4c9b7cc27035d6baaafa73f5f5930bfde62a4) ) /* 0x40000 to 0x7FFFF 0x00 padded */
756 	ROM_LOAD16_BYTE( "4.u35", 0x00000, 0x80000, CRC(fd177664) SHA1(0ea1854be8d88577129546a56d13bcdc4739ae52) ) /* 0x40000 to 0x7FFFF 0x00 padded */
757 
758 	ROM_REGION( 0x080000, "oki2", 0 ) /* Samples */
759 	ROM_LOAD( "s21.su5", 0x00000, 0x80000, CRC(9d96fd55) SHA1(80025cc2c44e8cd938620818e0b0974026377f5c) )
760 
761 	ROM_REGION( 0x080000, "oki1", 0 ) /* Samples */
762 	ROM_LOAD( "s13.su4", 0x00000, 0x80000, CRC(d45aec3b) SHA1(fc182a10e19687eb2f2f4a1d2ad976814185f0fc) )
763 
764 	ROM_REGION( 0x400000, "gfx1", 0 ) // sprites
765 	ROM_LOAD32_BYTE( "9.u5",   0x000000, 0x080000, CRC(be0f432e) SHA1(7d63f97a8cb38c5351f2cd2f720de16a0c4ab1d7) )
766 	ROM_LOAD32_BYTE( "10.u6",  0x000001, 0x080000, CRC(cf9127b2) SHA1(e02f436662f47d8bb5a9d726889c6e86cf64bdcf) )
767 	ROM_LOAD32_BYTE( "11.u7",  0x000002, 0x080000, CRC(644ee8cc) SHA1(1742e31ba48a93c005cce0dc575d9b5d739d1dce) )
768 	ROM_LOAD32_BYTE( "12.u8",  0x000003, 0x080000, CRC(0900c208) SHA1(9446382d274dc7b6ccdf18738aa4db636fd9e3c9) )
769 
770 	ROM_LOAD32_BYTE( "13.u58", 0x200000, 0x080000, CRC(8ea9c6be) SHA1(baf3af389417e1f14d0c38d8c872839a54008909) )
771 	ROM_LOAD32_BYTE( "14.u59", 0x200001, 0x080000, CRC(10c18fb4) SHA1(68934e73cfb6a49a4c1639dcb4c49246f16179b2) )
772 	ROM_LOAD32_BYTE( "15.u60", 0x200002, 0x080000, CRC(86ab6c7c) SHA1(59acaee6ba78a22f1423832a116ad41e19522aa1) )
773 	ROM_LOAD32_BYTE( "16.u61", 0x200003, 0x080000, CRC(ff419080) SHA1(542819bdd60976bddfa96570321ba3f7fb6fbf23) )
774 
775 	ROM_REGION( 0x200000, "gfx2", 0 ) // bg tiles
776 	ROM_LOAD32_BYTE( "5.u102", 0x000000, 0x80000, CRC(91b70a6b) SHA1(e53f62212d6e3ab5f892944b1933385a85e0ba8a) ) /* Same data as M16M-3.U61, just split up */
777 	ROM_LOAD32_BYTE( "6.u103", 0x000001, 0x80000, CRC(7b5bfb85) SHA1(ef59d64513c7f7e6ee3dcc9bb7bb0e14a71ca957) )
778 	ROM_LOAD32_BYTE( "7.u104", 0x000002, 0x80000, CRC(cdafcedf) SHA1(82becd002a16185220131085db6576eb763429c8) )
779 	ROM_LOAD32_BYTE( "8.u105", 0x000003, 0x80000, CRC(2c3895d5) SHA1(ab5837d996c1bb70071db02f07412c182d7547f8) )
780 ROM_END
781 
782 ROM_START( slspirit )
783 	ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
784 	ROM_LOAD16_BYTE( "3.u34", 0x00001, 0x40000, CRC(b5ac3272) SHA1(da223ef3b006be03a11559e00ae9d7bbd2d06ee5) )
785 	ROM_LOAD16_BYTE( "4.u35", 0x00000, 0x40000, CRC(86397bcb) SHA1(562dbb82c363039152aa574df72f73e9f71805d9) )
786 
787 	ROM_REGION( 0x080000, "oki2", 0 ) /* Samples */
788 	ROM_LOAD( "s21.su5", 0x00000, 0x80000, CRC(d4cbc27c) SHA1(feffa530baa4d70788a3598a12761827694a6275) )
789 
790 	ROM_REGION( 0x080000, "oki1", 0 ) /* Samples */
791 	ROM_LOAD( "s13.su4", 0x00000, 0x80000, CRC(d9c63d55) SHA1(7fd2fc08c859947dd4b1490132597ae23fcbed36) )
792 
793 	ROM_REGION( 0x400000, "gfx1", 0 ) // sprites
794 	ROM_LOAD32_BYTE( "9.u5",   0x000000, 0x080000, CRC(4742aa38) SHA1(6e8d53afe7a6a5d60c135dd6a283d5bb47821f48) )
795 	ROM_LOAD32_BYTE( "10.u6",  0x000001, 0x080000, CRC(c137fb33) SHA1(6798bc4569bdcab02c2b16315c8827268e5674eb) )
796 	ROM_LOAD32_BYTE( "11.u7",  0x000002, 0x080000, CRC(d0593a03) SHA1(544e345e0849239b8156df8c50568bb2e2685bd3) )
797 	ROM_LOAD32_BYTE( "12.u8",  0x000003, 0x080000, CRC(baa9eeb1) SHA1(12d905143c707bc0ff6997b89816b7bce40bd9aa) )
798 
799 	ROM_LOAD32_BYTE( "13.u58", 0x200000, 0x080000, CRC(eb586bd6) SHA1(1050021a663421be455c215cb9e724463e1fc425) )
800 	ROM_LOAD32_BYTE( "14.u59", 0x200001, 0x080000, CRC(abc8b869) SHA1(aea3e2bb447b6b9ac0dd19cac7922cc9bee6afb8) )
801 	ROM_LOAD32_BYTE( "15.u60", 0x200002, 0x080000, CRC(31f9b034) SHA1(d3224d9f11236fcaa65d477b87c46bea8a69db01) )
802 	ROM_LOAD32_BYTE( "16.u61", 0x200003, 0x080000, CRC(c1fc95e5) SHA1(2597e8553deb751d1a199c4eb3f321f0564b9c76) )
803 
804 	ROM_REGION( 0x200000, "gfx2", 0 ) // bg tiles
805 	ROM_LOAD32_BYTE( "5.u102", 0x000000, 0x80000, CRC(9f0855a6) SHA1(13aa54641eb188f604cf32bb462331fab4c1bf68) )
806 	ROM_LOAD32_BYTE( "6.u103", 0x000001, 0x80000, CRC(0dda4489) SHA1(cfad31e58adf5aea51c528fb5d7a2f076e6cf0bf) )
807 	ROM_LOAD32_BYTE( "7.u104", 0x000002, 0x80000, CRC(6208cdc7) SHA1(242a93db057b6c01f0031cc8fd33da76baf6c879) )
808 	ROM_LOAD32_BYTE( "8.u105", 0x000003, 0x80000, CRC(eb5f67a2) SHA1(4f6bf3fde6df4bc878b882f4f52805963352ef35) )
809 ROM_END
810 
811 
812 ROM_START( flagrall )
813 	ROM_REGION( 0x100000, "maincpu", 0 ) /* 68000 Code */
814 	ROM_LOAD16_BYTE( "11_u34.bin", 0x00001, 0x40000, CRC(24dd439d) SHA1(88857ad5ed69f29de86702dcc746d35b69b3b93d) )
815 	ROM_LOAD16_BYTE( "12_u35.bin", 0x00000, 0x40000, CRC(373b71a5) SHA1(be9ab93129e2ffd9bfe296c341dbdf47f1949ac7) )
816 
817 	ROM_REGION( 0x100000, "oki1", 0 ) /* Samples */
818 	// 3x banks
819 	ROM_LOAD( "13_su4.bin", 0x00000, 0x80000, CRC(7b0630b3) SHA1(c615e6630ffd12c122762751c25c249393bf7abd) )
820 	ROM_LOAD( "14_su6.bin", 0x80000, 0x40000, CRC(593b038f) SHA1(b00dcf321fe541ee52c34b79e69c44f3d7a9cd7c) )
821 
822 	ROM_REGION( 0x300000, "gfx1", 0 ) // sprites
823 	ROM_LOAD32_BYTE( "1_u5.bin",  0x000000, 0x080000, CRC(9377704b) SHA1(ac516a8ba6d1a70086469504c2a46d47a1f4560b) )
824 	ROM_LOAD32_BYTE( "5_u6.bin",  0x000001, 0x080000, CRC(1ac0bd0c) SHA1(ab71bb84e61f5c7168601695f332a8d4a30d9948) )
825 	ROM_LOAD32_BYTE( "2_u7.bin",  0x000002, 0x080000, CRC(5f6db2b3) SHA1(84caa019d3b75be30a14d19ccc2f28e5e94028bd) )
826 	ROM_LOAD32_BYTE( "6_u8.bin",  0x000003, 0x080000, CRC(79e4643c) SHA1(274f2741f39c63e32f49c6a1a72ded1263bdcdaa) )
827 
828 	ROM_LOAD32_BYTE( "3_u58.bin", 0x200000, 0x040000, CRC(c913df7d) SHA1(96e89ecb9e5f4d596d71d7ba35af7b2af4670342) )
829 	ROM_LOAD32_BYTE( "4_u59.bin", 0x200001, 0x040000, CRC(cb192384) SHA1(329b4c1a4dc388d9f4ce063f9a54cbf3b967682a) )
830 	ROM_LOAD32_BYTE( "7_u60.bin", 0x200002, 0x040000, CRC(f187a7bf) SHA1(f4ce9ac9fe376250fe426de6ee404fc7841ef08a) )
831 	ROM_LOAD32_BYTE( "8_u61.bin", 0x200003, 0x040000, CRC(b73fa441) SHA1(a5a3533563070c870276ead5e2f9cb9aaba303cc))
832 
833 	ROM_REGION( 0x100000, "gfx2", 0 ) // bg tiles
834 	ROM_LOAD( "10_u102.bin", 0x00000, 0x80000, CRC(b1fd3279) SHA1(4a75581e13d43bef441ce81eae518c2f6bc1d5f8) )
835 	ROM_LOAD( "9_u103.bin",  0x80000, 0x80000, CRC(01e6d654) SHA1(821d61a5b16f5cb76e2a805c8504db1ef38c3a48) )
836 ROM_END
837 
838 
839 GAME( 2000, 1945kiii,  0,        k3,       k3,       k3_state, empty_init, ROT270, "Oriental Soft", "1945k III (newer, OPCX2 PCB)", MACHINE_SUPPORTS_SAVE )
840 GAME( 2000, 1945kiiin, 1945kiii, k3,       k3,       k3_state, empty_init, ROT270, "Oriental Soft", "1945k III (newer, OPCX1 PCB)", MACHINE_SUPPORTS_SAVE )
841 GAME( 1999, 1945kiiio, 1945kiii, k3,       k3old,    k3_state, empty_init, ROT270, "Oriental Soft", "1945k III (older, OPCX1 PCB)", MACHINE_SUPPORTS_SAVE )
842 GAME( 1999, slspirit,  0,        k3,       solite,   k3_state, empty_init, ROT270, "Promat",        "Solite Spirits",               MACHINE_SUPPORTS_SAVE )
843 
844 GAME( 1996, flagrall,  0,        flagrall, flagrall, k3_state, empty_init, ROT0,   "Promat?",       "'96 Flag Rally",               MACHINE_SUPPORTS_SAVE )
845