1 // license:BSD-3-Clause
2 // copyright-holders:Tomasz Slanina
3 /*
4  'Swinging Singles' US distribution by Ent. Ent. Ltd
5  Original Japan release is 'Utamaro' by 'Yachiyo' (undumped!)
6  driver by Tomasz Slanina
7 
8 
9  Crap XXX game.
10  Three roms contains text "BY YACHIYO"
11 
12  Upper half of 7.bin = upper half of 8.bin = intentional or bad dump ?
13 
14  TODO:
15  - atamanot: needs a trojan, in order to understand how the protection really works.
16  - colors (missing prom(s) ?)
17  - samples (at least two of unused roms contains samples (unkn. format , adpcm ?)
18  - dips (one is tested in game (difficulty related?), another 2 are tested at start)
19 
20  Unknown reads/writes:
21  - AY i/o ports (writes)
22  - mem $c000, $c001 = protection device ? if tests fails, game crashes (problems with stack - skipped code with "pop af")
23  - i/o port $8 = data read used for  $e command arg for one of AY chips (volume? - could be a sample player (based on volume changes?)
24  - i/o port $1a = 1 or 0, rarely accessed, related to crt  writes
25 
26 ==================================================================
27 
28 Computer Quiz Atama no Taisou
29 (c)1983 Yachiyo Denki / Uni Enterprize
30 
31 -----------------------------------------
32 TZU-093
33 CPU: Z80(IC9) surface scrached Z80?(IC28)
34 Sound: AY-3-8910 x2
35 OSC: 14.000MHz
36 RAMs:
37 IC5 (probably 6116)
38 IC4 (probably 6116)
39 IC45 (probably 6116)
40 IC44 (probably 6116)
41 
42 M5L5101LP-1(IC19,20,21,22)
43 -----------------------------------------
44 ROMs:
45 TT1.2        [da9e270d] (2764)
46 TT2.3        [7595ade8] /
47 
48 CA.49        [28d20b52] (2764)
49 CC.48        [209cab0d]  |
50 CB.47        [8bc85c0c]  |
51 CD.46        [22e8d103] /
52 
53 IC36.BIN     [643e3077] (surface scrached, 27C256)
54 IC35.BIN     [fe0302a0]  |
55 IC34.BIN     [06e7c7da]  |
56 IC33.BIN     [323a70e7] /
57 
58 color PROMs:
59 1.52         [13f5762b] (82S129)
60 2.53         [4142f525]  |
61 3.54         [88acb21e] /
62 
63 
64 -----------------------------------------
65 Sub board
66 CQM-082-M
67 RAM:
68 HM6116LP-3
69 Other:
70 Battery
71 8-position DIPSW
72 -----------------------------------------
73 ROMs:
74 TA.BIN       [5c61edaf] (2764)
75 TB.BIN       [07bd2e6f]  |
76 TC.BIN       [1e09ac09]  |
77 TD.BIN       [bd514d51]  |
78 TE.BIN       [825ed49f]  |
79 TF.BIN       [d92b5eb9]  |
80 TG.BIN       [eb25aa72]  |
81 TH.BIN       [13396cfb] /
82 
83 TI.BIN       [60193df3] (2764)
84 J.BIN        [cd16ddbf]  |
85 K.BIN        [c75c7a1e]  |
86 L.BIN        [dbb4ed60] /
87 
88 
89 /////////////////////////////////////////
90 DIPSW
91 1: off
92 2: off
93 3: coinage
94     on: 1coin 2credits
95    off: 1coin 1credit
96 4: Note
97     on: show notes
98    off: game
99 5: Test mode
100     on: test
101    off: game
102 6: Attract sound
103     on: no
104    off: yes
105 7-8: Timer setting
106    off-off: quickest
107     on-off: quick
108    off- on: slow
109     on- on: slowest
110 (default settings: all off)
111 
112 
113 wiring
114 GND(sw)   A01|B01 GND(speaker)
115 GND(power)A02|B02 GND(power)
116 +5V       A03|B03 +5V
117 --------  A04|B04 +5V(coin counter)
118 +12V      A05|B05 +12V
119 --------  A06|B06 speaker
120 
121     (A7-A15, B7-B15: NC)
122 
123 2P genre1 A16|B16 1P genre1
124 2P genre2 A17|B17 1P genre2
125 2P genre3 A18|B18 1P genre3
126 2P genre4 A19|B19 1P genre4
127 2P push A A20|B20 1P push A
128 2P push B A21|B21 1P push B
129 2P push C A22|B22 1P push C
130 Flip/flop A23|B23 Flip/flop
131 --------  A24|B24 --------
132 GREEN     A25|B25 BLUE
133 RED       A26|B26 SYNC
134 GND       A27|B27 GND
135 GND(video)A28|B28 coin sw
136 
137 
138 /////////////////////////////////////////
139 
140 
141 
142 --- Team Japump!!! ---
143 Dumped by Chack'n
144 04/Nov/2009
145 
146 
147 */
148 
149 #include "emu.h"
150 #include "cpu/z80/z80.h"
151 #include "sound/ay8910.h"
152 #include "video/mc6845.h"
153 #include "emupal.h"
154 #include "screen.h"
155 #include "speaker.h"
156 
157 #define NUM_PENS (4*8)
158 #define VMEM_SIZE 0x100
159 
160 class ssingles_state : public driver_device
161 {
162 public:
ssingles_state(const machine_config & mconfig,device_type type,const char * tag)163 	ssingles_state(const machine_config &mconfig, device_type type, const char *tag)
164 		: driver_device(mconfig, type, tag)
165 		, m_maincpu(*this, "maincpu")
166 	{ }
167 
168 	void ssingles(machine_config &config);
169 	void atamanot(machine_config &config);
170 
171 	void init_ssingles();
172 
173 	DECLARE_CUSTOM_INPUT_MEMBER(controls_r);
174 
175 protected:
176 	virtual void video_start() override;
177 
178 private:
179 	uint8_t m_videoram[VMEM_SIZE];
180 	uint8_t m_colorram[VMEM_SIZE];
181 	uint8_t m_prot_data;
182 	pen_t m_pens[NUM_PENS];
183 
184 	uint8_t m_atamanot_prot_state;
185 
186 	required_device<cpu_device> m_maincpu;
187 
188 	void ssingles_videoram_w(offs_t offset, uint8_t data);
189 	void ssingles_colorram_w(offs_t offset, uint8_t data);
190 	uint8_t c000_r();
191 	uint8_t c001_r();
192 	void c001_w(uint8_t data);
193 	uint8_t atamanot_prot_r(offs_t offset);
194 	void atamanot_prot_w(uint8_t data);
195 
196 	DECLARE_WRITE_LINE_MEMBER(atamanot_irq);
197 	MC6845_UPDATE_ROW(ssingles_update_row);
198 	MC6845_UPDATE_ROW(atamanot_update_row);
199 
200 	void atamanot_io_map(address_map &map);
201 	void atamanot_map(address_map &map);
202 	void ssingles_io_map(address_map &map);
203 	void ssingles_map(address_map &map);
204 };
205 
206 //fake palette
207 static constexpr rgb_t ssingles_colors[NUM_PENS] =
208 {
209 	{ 0x00,0x00,0x00 }, { 0xff,0xff,0xff }, { 0xff,0x00,0x00 }, { 0x80,0x00,0x00 },
210 	{ 0x00,0x00,0x00 }, { 0xf0,0xf0,0xf0 }, { 0xff,0xff,0x00 }, { 0x40,0x40,0x40 },
211 	{ 0x00,0x00,0x00 }, { 0xff,0xff,0xff }, { 0xff,0x00,0x00 }, { 0xff,0xff,0x00 },
212 	{ 0x00,0x00,0x00 }, { 0xff,0xff,0x00 }, { 0xd0,0x00,0x00 }, { 0x80,0x00,0x00 },
213 	{ 0x00,0x00,0x00 }, { 0xff,0x00,0x00 }, { 0xff,0xff,0x00 }, { 0x80,0x80,0x00 },
214 	{ 0x00,0x00,0x00 }, { 0xff,0x00,0x00 }, { 0x40,0x40,0x40 }, { 0xd0,0xd0,0xd0 },
215 	{ 0x00,0x00,0x00 }, { 0x00,0x00,0xff }, { 0x60,0x40,0x30 }, { 0xff,0xff,0x00 },
216 	{ 0x00,0x00,0x00 }, { 0xff,0x00,0xff }, { 0x80,0x00,0x80 }, { 0x40,0x00,0x40 }
217 };
218 
MC6845_UPDATE_ROW(ssingles_state::ssingles_update_row)219 MC6845_UPDATE_ROW( ssingles_state::ssingles_update_row )
220 {
221 	uint8_t const *const gfx = memregion("gfx1")->base();
222 
223 	for (int cx = 0; cx < x_count; ++cx)
224 	{
225 		int address = ((ma >> 1) + (cx >> 1)) & 0xff;
226 
227 		uint16_t cell = m_videoram[address] + (m_colorram[address] << 8);
228 
229 		uint32_t tile_address = ((cell & 0x3ff) << 4) + ra;
230 		uint16_t palette = (cell >> 10) & 0x1c;
231 
232 		uint8_t b0, b1;
233 		if (cx & 1)
234 		{
235 			b0 = gfx[tile_address + 0x0000]; /*  9.bin */
236 			b1 = gfx[tile_address + 0x8000]; /* 11.bin */
237 		}
238 		else
239 		{
240 			b0 = gfx[tile_address + 0x4000]; /* 10.bin */
241 			b1 = gfx[tile_address + 0xc000]; /* 12.bin */
242 		}
243 
244 		for (int x = 7; x >= 0; --x)
245 		{
246 			bitmap.pix(y, (cx << 3) | x) = m_pens[palette + ((b1 & 1) | ((b0 & 1) << 1))];
247 			b0 >>= 1;
248 			b1 >>= 1;
249 		}
250 	}
251 }
252 
MC6845_UPDATE_ROW(ssingles_state::atamanot_update_row)253 MC6845_UPDATE_ROW( ssingles_state::atamanot_update_row )
254 {
255 	const uint8_t *gfx = memregion("gfx1")->base();
256 
257 	for (int cx = 0; cx < x_count; ++cx)
258 	{
259 		int address = ((ma >> 1) + (cx >> 1)) & 0xff;
260 
261 		uint16_t cell = m_videoram[address] + (m_colorram[address] << 8);
262 
263 		uint32_t tile_address = ((cell & 0x1ff) << 4) + ra;
264 		uint16_t palette = (cell >> 10) & 0x1c;
265 
266 		uint8_t b0, b1;
267 		if (cx & 1)
268 		{
269 			b0 = gfx[tile_address + 0x0000]; /*  9.bin */
270 			b1 = gfx[tile_address + 0x4000]; /* 11.bin */
271 		}
272 		else
273 		{
274 			b0 = gfx[tile_address + 0x2000]; /* 10.bin */
275 			b1 = gfx[tile_address + 0x6000]; /* 12.bin */
276 		}
277 
278 		for (int x = 7; x >= 0; --x)
279 		{
280 			bitmap.pix(y, (cx << 3) | x) = m_pens[palette + ((b1 & 1) | ((b0 & 1) << 1))];
281 			b0 >>= 1;
282 			b1 >>= 1;
283 		}
284 	}
285 }
286 
287 
ssingles_videoram_w(offs_t offset,uint8_t data)288 void ssingles_state::ssingles_videoram_w(offs_t offset, uint8_t data)
289 {
290 	uint8_t *vram = memregion("vram")->base();
291 	vram[offset] = data;
292 	m_videoram[offset]=data;
293 }
294 
ssingles_colorram_w(offs_t offset,uint8_t data)295 void ssingles_state::ssingles_colorram_w(offs_t offset, uint8_t data)
296 {
297 	uint8_t *cram = memregion("cram")->base();
298 	cram[offset] = data;
299 	m_colorram[offset]=data;
300 }
301 
302 
video_start()303 void ssingles_state::video_start()
304 {
305 	for (int i=0; i<NUM_PENS; ++i)
306 		m_pens[i] = ssingles_colors[i];
307 }
308 
309 
c000_r()310 uint8_t ssingles_state::c000_r()
311 {
312 	return m_prot_data;
313 }
314 
c001_r()315 uint8_t ssingles_state::c001_r()
316 {
317 	m_prot_data=0xc4;
318 	return 0;
319 }
320 
c001_w(uint8_t data)321 void ssingles_state::c001_w(uint8_t data)
322 {
323 	m_prot_data^=data^0x11;
324 }
325 
CUSTOM_INPUT_MEMBER(ssingles_state::controls_r)326 CUSTOM_INPUT_MEMBER(ssingles_state::controls_r)
327 {
328 	int data = 7;
329 	switch(ioport("EXTRA")->read())     //multiplexed
330 	{
331 		case 0x01: data = 1; break;
332 		case 0x02: data = 2; break;
333 		case 0x04: data = 3; break;
334 		case 0x08: data = 4; break;
335 		case 0x10: data = 5; break;
336 		case 0x20: data = 6; break;
337 		case 0x40: data = 0; break;
338 	}
339 
340 	return data;
341 }
342 
ssingles_map(address_map & map)343 void ssingles_state::ssingles_map(address_map &map)
344 {
345 	map(0x0000, 0x00ff).w(FUNC(ssingles_state::ssingles_videoram_w));
346 	map(0x0800, 0x08ff).w(FUNC(ssingles_state::ssingles_colorram_w));
347 	map(0x0000, 0x1fff).rom();
348 	map(0xc000, 0xc000).r(FUNC(ssingles_state::c000_r));
349 	map(0xc001, 0xc001).rw(FUNC(ssingles_state::c001_r), FUNC(ssingles_state::c001_w));
350 	map(0x6000, 0xbfff).rom();
351 	map(0xf800, 0xffff).ram();
352 }
353 
354 
atamanot_prot_r(offs_t offset)355 uint8_t ssingles_state::atamanot_prot_r(offs_t offset)
356 {
357 	static const char prot_id[] = { "PROGRAM BY KOYAMA" };
358 
359 	logerror("%04x %02x\n",offset,m_atamanot_prot_state);
360 
361 	switch(m_atamanot_prot_state)
362 	{
363 		case 0x20:
364 		case 0x21:
365 		case 0x22:
366 		case 0x23:
367 			return prot_id[offset % 0x11];
368 
369 		case 0xc0:
370 			return 2; // 1 goes to service mode?
371 	}
372 
373 	return 0;
374 }
375 
atamanot_prot_w(uint8_t data)376 void ssingles_state::atamanot_prot_w(uint8_t data)
377 {
378 	m_atamanot_prot_state = data;
379 }
380 
381 
atamanot_map(address_map & map)382 void ssingles_state::atamanot_map(address_map &map)
383 {
384 	map(0x0000, 0x00ff).w(FUNC(ssingles_state::ssingles_videoram_w));
385 	map(0x0800, 0x08ff).w(FUNC(ssingles_state::ssingles_colorram_w));
386 	map(0x0000, 0x3fff).rom();
387 	map(0x4000, 0x47ff).ram();
388 	map(0x6000, 0x60ff).ram(); //kanji tilemap?
389 //  map(0x6000, 0x7fff).rom();
390 	map(0x8000, 0x83ff).r(FUNC(ssingles_state::atamanot_prot_r));
391 //  map(0x8000, 0x9fff).rom().region("question", 0x10000);
392 //  map(0xc000, 0xc000).r(FUNC(ssingles_state::c000_r));
393 //  map(0xc001, 0xc001).rw(FUNC(ssingles_state::c001_r), FUNC(ssingles_state::c001_w));
394 }
395 
ssingles_io_map(address_map & map)396 void ssingles_state::ssingles_io_map(address_map &map)
397 {
398 	map.global_mask(0xff);
399 	map(0x00, 0x00).w("ay1", FUNC(ay8910_device::address_w));
400 	map(0x04, 0x04).w("ay1", FUNC(ay8910_device::data_w));
401 	map(0x06, 0x06).w("ay2", FUNC(ay8910_device::address_w));
402 	map(0x08, 0x08).nopr();
403 	map(0x0a, 0x0a).w("ay2", FUNC(ay8910_device::data_w));
404 	map(0x16, 0x16).portr("DSW0");
405 	map(0x18, 0x18).portr("DSW1");
406 	map(0x1c, 0x1c).portr("INPUTS");
407 //  map(0x1a, 0x1a).nopw(); //video/crt related
408 	map(0xfe, 0xfe).w("crtc", FUNC(mc6845_device::address_w));
409 	map(0xff, 0xff).w("crtc", FUNC(mc6845_device::register_w));
410 }
411 
atamanot_io_map(address_map & map)412 void ssingles_state::atamanot_io_map(address_map &map)
413 {
414 	map.global_mask(0xff);
415 	map(0x00, 0x00).w("ay1", FUNC(ay8910_device::address_w));
416 	map(0x04, 0x04).w("ay1", FUNC(ay8910_device::data_w));
417 	map(0x06, 0x06).w("ay2", FUNC(ay8910_device::address_w));
418 	map(0x08, 0x08).nopr();
419 	map(0x0a, 0x0a).w("ay2", FUNC(ay8910_device::data_w));
420 	map(0x16, 0x16).portr("DSW0");
421 	map(0x18, 0x18).portr("DSW1").w(FUNC(ssingles_state::atamanot_prot_w));
422 	map(0x1c, 0x1c).portr("INPUTS");
423 //  map(0x1a, 0x1a).nopw(); //video/crt related
424 	map(0xfe, 0xfe).w("crtc", FUNC(mc6845_device::address_w));
425 	map(0xff, 0xff).w("crtc", FUNC(mc6845_device::register_w));
426 }
427 
428 static INPUT_PORTS_START( ssingles )
429 	PORT_START("INPUTS")
430 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
431 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) //must be LOW
432 	PORT_BIT( 0x1c, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(ssingles_state, controls_r)
433 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON4 )
434 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON2 )
435 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON3 )
436 
437 	PORT_START("EXTRA")
438 	PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT )
439 	PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN )
440 	PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT )
441 	PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP )
442 	PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_START1 )
443 	PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START2 )
444 	PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 )
445 
446 	PORT_START("DSW0")
447 	PORT_DIPNAME( 0x03, 0x00, DEF_STR( Coin_A ) )
448 	PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
449 	PORT_DIPSETTING(    0x01, DEF_STR( 1C_2C ) )
450 	PORT_DIPSETTING(    0x02, DEF_STR( 1C_3C ) )
451 	PORT_DIPSETTING(    0x03, DEF_STR( Free_Play ) )
452 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Difficulty ) )
453 	PORT_DIPSETTING(    0x20, DEF_STR( Easy ) )
454 	PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
455 	PORT_DIPNAME( 0x04, 0x04, "Unk1" )
456 	PORT_DIPSETTING(    0x00, DEF_STR( No ) )
457 	PORT_DIPSETTING(    0x04, DEF_STR( Yes ) )
458 	PORT_DIPNAME( 0x08, 0x08, "Unk2" )
459 	PORT_DIPSETTING(    0x00, DEF_STR( No ) )
460 	PORT_DIPSETTING(    0x08, DEF_STR( Yes ) )
461 	PORT_DIPNAME( 0x10, 0x10, "Unk3" )
462 	PORT_DIPSETTING(    0x00, DEF_STR( No ) )
463 	PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
464 	PORT_DIPNAME( 0x40, 0x40, "Unk4" ) //tested in game, every frame, could be difficulty related
465 	PORT_DIPSETTING(    0x00, DEF_STR( No ) )
466 	PORT_DIPSETTING(    0x40, DEF_STR( Yes ) )
467 	PORT_DIPNAME( 0x80, 0x80, "Unk5" )
468 	PORT_DIPSETTING(    0x00, DEF_STR( No ) )
469 	PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
470 
471 	PORT_START("DSW1")
472 	PORT_DIPNAME( 0x03, 0x03, "Unk 6" )
473 	PORT_DIPSETTING(    0x01, "Pos 1" )
474 	PORT_DIPSETTING(    0x03, "Pos 2" )
475 	PORT_DIPSETTING(    0x00, "Pos 3" )
476 	PORT_DIPSETTING(    0x02, "Pos 4" )
477 	PORT_DIPNAME( 0x04, 0x04, "Unk7" )
478 	PORT_DIPSETTING(    0x00, DEF_STR( No ) )
479 	PORT_DIPSETTING(    0x04, DEF_STR( Yes ) )
480 	PORT_DIPNAME( 0x08, 0x08, "Unk8" )
481 	PORT_DIPSETTING(    0x00, DEF_STR( No ) )
482 	PORT_DIPSETTING(    0x08, DEF_STR( Yes ) )
483 	PORT_DIPNAME( 0x10, 0x10, "Unk9" )
484 	PORT_DIPSETTING(    0x00, DEF_STR( No ) )
485 	PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
486 	PORT_DIPNAME( 0x20, 0x20, "UnkA" )
487 	PORT_DIPSETTING(    0x00, DEF_STR( No ) )
488 	PORT_DIPSETTING(    0x20, DEF_STR( Yes ) )
489 	PORT_DIPNAME( 0x40, 0x40, "UnkB" )
490 	PORT_DIPSETTING(    0x00, DEF_STR( No ) )
491 	PORT_DIPSETTING(    0x40, DEF_STR( Yes ) )
492 	PORT_DIPNAME( 0x80, 0x80, "UnkC" )
493 	PORT_DIPSETTING(    0x00, DEF_STR( No ) )
494 	PORT_DIPSETTING(    0x80, DEF_STR( Yes ) )
495 INPUT_PORTS_END
496 
497 /*
498 atamanot kanji gfx decoding:
499 
500 It looks "stolen" from an unknown Japanese computer?
501 */
502 
503 static const gfx_layout layout_8x8 =
504 {
505 	8,8,
506 	RGN_FRAC(1,2),
507 	2,
508 	{ RGN_FRAC(0,2), RGN_FRAC(1,2) },
509 	{ STEP8(0,1) },
510 	{ STEP8(0,8) },
511 	8*8
512 };
513 
514 
515 static const gfx_layout layout_16x16 =
516 {
517 	16,16,
518 	RGN_FRAC(1,4),
519 	1,
520 	{ 0 },
521 	{ 0, 1, 2, 3, 4, 5, 6, 7,
522 		RGN_FRAC(1,4)+0, RGN_FRAC(1,4)+1, RGN_FRAC(1,4)+2, RGN_FRAC(1,4)+3, RGN_FRAC(1,4)+4, RGN_FRAC(1,4)+5, RGN_FRAC(1,4)+6, RGN_FRAC(1,4)+7 },
523 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
524 		RGN_FRAC(2,4)+0*8, RGN_FRAC(2,4)+1*8, RGN_FRAC(2,4)+2*8, RGN_FRAC(2,4)+3*8, RGN_FRAC(2,4)+4*8, RGN_FRAC(2,4)+5*8, RGN_FRAC(2,4)+6*8, RGN_FRAC(2,4)+7*8 },
525 	8*8
526 };
527 
528 
529 static const gfx_layout layout_8x16 =
530 {
531 	8,16,
532 	RGN_FRAC(1,2),
533 	1,
534 	{ 0 },
535 	{ 0, 1, 2, 3, 4, 5, 6, 7 },
536 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
537 		RGN_FRAC(2,4)+0*8, RGN_FRAC(2,4)+1*8, RGN_FRAC(2,4)+2*8, RGN_FRAC(2,4)+3*8, RGN_FRAC(2,4)+4*8, RGN_FRAC(2,4)+5*8, RGN_FRAC(2,4)+6*8, RGN_FRAC(2,4)+7*8 },
538 	8*8
539 };
540 
541 static GFXDECODE_START( gfx_ssingles )
542 	GFXDECODE_ENTRY( "gfx1", 0, layout_8x8, 0, 8 )
543 GFXDECODE_END
544 
GFXDECODE_START(gfx_atamanot)545 static GFXDECODE_START( gfx_atamanot )
546 	GFXDECODE_ENTRY( "gfx1", 0, layout_8x8, 0, 8 )
547 	GFXDECODE_ENTRY( "kanji", 0, layout_16x16,     0, 8 )
548 	GFXDECODE_ENTRY( "kanji_uc", 0, layout_8x16,     0, 8 )
549 	GFXDECODE_ENTRY( "kanji_lc", 0, layout_8x16,     0, 8 )
550 GFXDECODE_END
551 
552 void ssingles_state::ssingles(machine_config &config)
553 {
554 	Z80(config, m_maincpu, 4000000);         /* ? MHz */
555 	m_maincpu->set_addrmap(AS_PROGRAM, &ssingles_state::ssingles_map);
556 	m_maincpu->set_addrmap(AS_IO, &ssingles_state::ssingles_io_map);
557 
558 	screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
559 	screen.set_raw(4000000, 256, 0, 256, 256, 0, 256);   /* temporary, CRTC will configure screen */
560 	screen.set_screen_update("crtc", FUNC(mc6845_device::screen_update));
561 
562 	PALETTE(config, "palette").set_entries(4); //guess
563 
564 	GFXDECODE(config, "gfxdecode", "palette", gfx_ssingles);
565 
566 	mc6845_device &crtc(MC6845(config, "crtc", 1000000 /* ? MHz */));
567 	crtc.set_screen("screen");
568 	crtc.set_show_border_area(false);
569 	crtc.set_char_width(8);
570 	crtc.set_update_row_callback(FUNC(ssingles_state::ssingles_update_row));
571 	crtc.out_vsync_callback().set_inputline(m_maincpu, INPUT_LINE_NMI);
572 
573 	/* sound hardware */
574 	SPEAKER(config, "mono").front_center();
575 
576 	AY8910(config, "ay1", 1500000).add_route(ALL_OUTPUTS, "mono", 0.5); /* ? MHz */
577 
578 	AY8910(config, "ay2", 1500000).add_route(ALL_OUTPUTS, "mono", 0.5); /* ? MHz */
579 }
580 
WRITE_LINE_MEMBER(ssingles_state::atamanot_irq)581 WRITE_LINE_MEMBER(ssingles_state::atamanot_irq)
582 {
583 	// ...
584 }
585 
atamanot(machine_config & config)586 void ssingles_state::atamanot(machine_config &config)
587 {
588 	ssingles(config);
589 
590 	m_maincpu->set_addrmap(AS_PROGRAM, &ssingles_state::atamanot_map);
591 	m_maincpu->set_addrmap(AS_IO, &ssingles_state::atamanot_io_map);
592 
593 	mc6845_device &crtc(*subdevice<mc6845_device>("crtc"));
594 	crtc.set_update_row_callback(FUNC(ssingles_state::atamanot_update_row));
595 	crtc.out_vsync_callback().set(FUNC(ssingles_state::atamanot_irq));
596 
597 	subdevice<gfxdecode_device>("gfxdecode")->set_info(gfx_atamanot);
598 }
599 
600 ROM_START( ssingles )
601 	ROM_REGION( 0x10000, "maincpu", 0 ) /* Z80 main CPU  */
602 	ROM_LOAD( "1.bin", 0x00000, 0x2000, CRC(43f02215) SHA1(9f04a7d4671ff39fd2bd8ec7afced4981ee7be05) )
603 	ROM_LOAD( "2.bin", 0x06000, 0x2000, CRC(281f27e4) SHA1(cef28717ab2ed991a5709464c01490f0ab1dc17c) )
604 	ROM_LOAD( "3.bin", 0x08000, 0x2000, CRC(14fdcb65) SHA1(70f7fcb46e74937de0e4037c9fe79349a30d0d07) )
CRC(acb44685)605 	ROM_LOAD( "4.bin", 0x0a000, 0x2000, CRC(acb44685) SHA1(d68aab8b7e68d842a350d3fb76985ac857b1d972) )
606 
607 	ROM_REGION( 0x100, "vram", ROMREGION_ERASE00 )
608 	ROM_REGION( 0x100, "cram", ROMREGION_ERASE00 )
609 
610 	ROM_REGION( 0x10000, "gfx1", 0 )
611 	ROM_LOAD( "9.bin",  0x0000, 0x4000, CRC(57fac6f9) SHA1(12f6695c9831399e599a95008ebf9db943725437) )
612 	ROM_LOAD( "10.bin", 0x4000, 0x4000, CRC(cd3ba260) SHA1(2499ad9982cc6356e2eb3a0f10d77886872a0c9f) )
613 	ROM_LOAD( "11.bin", 0x8000, 0x4000, CRC(f7107b29) SHA1(a405926fd3cb4b3d2a1c705dcde25d961dba5884) )
614 	ROM_LOAD( "12.bin", 0xc000, 0x4000, CRC(e5585a93) SHA1(04d55699b56d869066f2be2c6ac48042aa6c3108) )
615 
616 	ROM_REGION( 0x08000, "user1", 0) /* samples ? data ?*/
617 	ROM_LOAD( "5.bin", 0x00000, 0x2000, CRC(242a8dda) SHA1(e140893cc05fb8cee75904d98b02626f2565ed1b) )
618 	ROM_LOAD( "6.bin", 0x02000, 0x2000, CRC(85ab8aab) SHA1(566f034e1ba23382442f27457447133a0e0f1cfc) )
619 	ROM_LOAD( "7.bin", 0x04000, 0x2000, CRC(57cc112d) SHA1(fc861c58ae39503497f04d302a9f16fca19b37fb) )
620 	ROM_LOAD( "8.bin", 0x06000, 0x2000, CRC(52de717a) SHA1(e60399355165fb46fac862fb7fcdff16ff351631) )
621 
622 ROM_END
623 
624 
625 ROM_START( atamanot )
626 	ROM_REGION( 0x10000, "maincpu", 0 )
627 	ROM_LOAD( "tt1.2",   0x0000, 0x2000, CRC(da9e270d) SHA1(b7408be913dad8abf022c6153f2493204dd74952) )
628 	ROM_LOAD( "tt2.3",   0x2000, 0x2000, CRC(7595ade8) SHA1(71f9d6d987407f88cdd3b28bd1e35e00ac17e1f5) )
629 
630 	ROM_REGION( 0x100, "vram", ROMREGION_ERASE00 )
631 	ROM_REGION( 0x100, "cram", ROMREGION_ERASE00 )
632 
633 	ROM_REGION( 0x18000, "question", 0 ) //question roms?
634 	ROM_LOAD( "ta.bin",  0x00000, 0x2000, CRC(5c61edaf) SHA1(ea56df6b320aa7e52828aaccbb5838cd0c756f24) )
635 	ROM_LOAD( "tb.bin",  0x02000, 0x2000, CRC(07bd2e6f) SHA1(bf245d8208db447572e484057b9daa6276f03683) )
636 	ROM_LOAD( "tc.bin",  0x04000, 0x2000, CRC(1e09ac09) SHA1(91ec1b2c5767b5bad8915f7c9984f423fcb399c9) )
637 	ROM_LOAD( "td.bin",  0x06000, 0x2000, CRC(bd514d51) SHA1(1a1e95558b2608f0103ca1b42fe9e59ccb90487f) )
638 	ROM_LOAD( "te.bin",  0x08000, 0x2000, CRC(825ed49f) SHA1(775044f6d53ecbfa0ab604947a21e368bad85ce0) )
639 	ROM_LOAD( "tf.bin",  0x0a000, 0x2000, CRC(d92b5eb9) SHA1(311fdefdc1f1026cb7f7cc1e1adaffbdbe7a70d9) )
640 	ROM_LOAD( "tg.bin",  0x0c000, 0x2000, CRC(eb25aa72) SHA1(de3a3d87a2eb540b96947f776c321dc9a7c21e78) )
641 	ROM_LOAD( "th.bin",  0x0e000, 0x2000, CRC(13396cfb) SHA1(d98ea4ff2e2175aa7003e37001664b3fa898c071) )
642 	ROM_LOAD( "ti.bin",  0x10000, 0x2000, CRC(60193df3) SHA1(58840bde303a760a0458224983af0c0bbe939a2f) )
643 	ROM_LOAD( "j.bin",   0x12000, 0x2000, CRC(cd16ddbf) SHA1(b418b5d73d3699697ebd42a6f4df598dcdcaf264) )
644 	ROM_LOAD( "k.bin",   0x14000, 0x2000, CRC(c75c7a1e) SHA1(59b136626267fa3ba5a2e1709acb632142e1560e) )
645 	ROM_LOAD( "l.bin",   0x16000, 0x2000, CRC(dbb4ed60) SHA1(b5054ba3ccd268594d22e1e67f70bb227095ca4c) )
646 
647 	ROM_REGION( 0x8000, "gfx1", 0 )
648 	ROM_LOAD( "ca.49",   0x0000, 0x2000, CRC(28d20b52) SHA1(a104ef1cd103f31803b88bd2d4804eab5a26e7fa) )
649 	ROM_LOAD( "cc.48",   0x2000, 0x2000, CRC(209cab0d) SHA1(9a89af1f7186e4845e43f9cdafd273e69d280bfb) )
650 	ROM_LOAD( "cb.47",   0x4000, 0x2000, CRC(8bc85c0c) SHA1(64701bc910c28666d15ee22f59f32888cc2302ae) )
651 	ROM_LOAD( "cd.46",   0x6000, 0x2000, CRC(22e8d103) SHA1(f0146f7e192eef8d03404a9c5b8a9f9c9577d936) )
652 
653 	ROM_REGION( 0x20000, "kanji", 0 )
654 	ROM_LOAD( "ic36.bin",   0x18000, 0x8000, CRC(643e3077) SHA1(fa81a3a3eebd59c6dc9c9b7eeb4a480bb1440c17) )
655 	ROM_LOAD( "ic35.bin",   0x10000, 0x8000, CRC(fe0302a0) SHA1(f8d3a58da4e8dd09db240039f5216e7ebe9cc384) )
656 	ROM_LOAD( "ic34.bin",   0x08000, 0x8000, CRC(06e7c7da) SHA1(a222c0b0eccfda613f916320e6afbb33385921ba) )
657 	ROM_LOAD( "ic33.bin",   0x00000, 0x8000, CRC(323a70e7) SHA1(55e570f039c97d15b06bfcb1ebf03562cbcf8324) )
658 
659 	ROM_REGION( 0x10000, "kanji_uc", 0 ) //upper case
660 	ROM_COPY( "kanji", 0x10000, 0x08000, 0x08000 )
661 	ROM_COPY( "kanji", 0x00000, 0x00000, 0x08000 )
662 
663 	ROM_REGION( 0x10000, "kanji_lc", 0 ) //lower case
664 	ROM_COPY( "kanji", 0x18000, 0x08000, 0x08000 )
665 	ROM_COPY( "kanji", 0x08000, 0x00000, 0x08000 )
666 
667 	ROM_REGION( 0x0300,  "proms", 0 ) //NOT color proms
668 	ROM_LOAD( "1.52",   0x00000, 0x0100, CRC(13f5762b) SHA1(da9cc51eda0681b0d3c17b212d23ab89af2813ff) )
669 	ROM_LOAD( "2.53",   0x00100, 0x0100, CRC(4142f525) SHA1(2e2e896ba7b49df9cf3fddff6becc07a3d50d926) )
670 	ROM_LOAD( "3.54",   0x00200, 0x0100, CRC(88acb21e) SHA1(18fe5280dad6687daf6bf42d37dde45157fab5e3) )
671 ROM_END
672 
673 void ssingles_state::init_ssingles()
674 {
675 	save_item(NAME(m_videoram));
676 	save_item(NAME(m_colorram));
677 }
678 
679 GAME( 1983, ssingles, 0, ssingles, ssingles, ssingles_state, init_ssingles, ROT90, "Yachiyo Denki (Entertainment Enterprises, Ltd. license)", "Swinging Singles (US)", MACHINE_SUPPORTS_SAVE | MACHINE_WRONG_COLORS | MACHINE_IMPERFECT_SOUND )
680 GAME( 1983, atamanot, 0, atamanot, ssingles, ssingles_state, init_ssingles, ROT90, "Yachiyo Denki / Uni Enterprize", "Computer Quiz Atama no Taisou (Japan)", MACHINE_NOT_WORKING | MACHINE_UNEMULATED_PROTECTION )
681