1 // license:BSD-3-Clause
2 // copyright-holders:Takahiro Nogi
3 /***************************************************************************
4 
5 Syusse Oozumou
6 (c) 1984 Technos Japan (Licensed by Data East)
7 
8 Driver by Takahiro Nogi (nogi@kt.rim.or.jp) 1999/10/04
9 
10 ***************************************************************************/
11 
12 #include "emu.h"
13 #include "includes/ssozumo.h"
14 
15 #include "cpu/m6502/m6502.h"
16 #include "cpu/m6809/m6809.h"
17 #include "machine/gen_latch.h"
18 #include "sound/ay8910.h"
19 #include "sound/dac.h"
20 #include "screen.h"
21 #include "speaker.h"
22 
23 
machine_start()24 void ssozumo_state::machine_start()
25 {
26 	save_item(NAME(m_sound_nmi_mask));
27 }
28 
29 
ssozumo_map(address_map & map)30 void ssozumo_state::ssozumo_map(address_map &map)
31 {
32 	map(0x0000, 0x077f).ram();
33 	map(0x0780, 0x07ff).ram().share("spriteram");
34 	map(0x2000, 0x23ff).ram().w(FUNC(ssozumo_state::videoram2_w)).share("videoram2");
35 	map(0x2400, 0x27ff).ram().w(FUNC(ssozumo_state::colorram2_w)).share("colorram2");
36 	map(0x3000, 0x31ff).ram().w(FUNC(ssozumo_state::videoram_w)).share("videoram");
37 	map(0x3200, 0x33ff).ram().w(FUNC(ssozumo_state::colorram_w)).share("colorram");
38 	map(0x3400, 0x35ff).ram();
39 	map(0x3600, 0x37ff).ram();
40 	map(0x4000, 0x4000).portr("P1").w(FUNC(ssozumo_state::flipscreen_w));
41 	map(0x4010, 0x4010).portr("P2").w("soundlatch", FUNC(generic_latch_8_device::write));
42 	map(0x4020, 0x4020).portr("DSW2").w(FUNC(ssozumo_state::scroll_w));
43 	map(0x4030, 0x4030).portr("DSW1");
44 //  map(0x4030, 0x4030).writeonly();
45 	map(0x4050, 0x407f).ram().w(FUNC(ssozumo_state::paletteram_w)).share("paletteram");
46 	map(0x6000, 0xffff).rom();
47 }
48 
49 
sound_nmi_mask_w(uint8_t data)50 void ssozumo_state::sound_nmi_mask_w(uint8_t data)
51 {
52 	m_sound_nmi_mask = data & 1;
53 }
54 
55 /* Same as Tag Team */
ssozumo_sound_map(address_map & map)56 void ssozumo_state::ssozumo_sound_map(address_map &map)
57 {
58 	map(0x0000, 0x01ff).ram();
59 	map(0x2000, 0x2001).w("ay1", FUNC(ay8910_device::data_address_w));
60 	map(0x2002, 0x2003).w("ay2", FUNC(ay8910_device::data_address_w));
61 	map(0x2004, 0x2004).w("dac", FUNC(dac_byte_interface::data_w));
62 	map(0x2005, 0x2005).w(FUNC(ssozumo_state::sound_nmi_mask_w));
63 	map(0x2007, 0x2007).r("soundlatch", FUNC(generic_latch_8_device::read));
64 	map(0x4000, 0xffff).rom();
65 }
66 
INPUT_CHANGED_MEMBER(ssozumo_state::coin_inserted)67 INPUT_CHANGED_MEMBER(ssozumo_state::coin_inserted)
68 {
69 	m_maincpu->set_input_line(INPUT_LINE_NMI, newval ? CLEAR_LINE : ASSERT_LINE);
70 }
71 
72 static INPUT_PORTS_START( ssozumo )
73 	PORT_START("P1")    /* IN0 */
74 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
75 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
76 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
77 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
78 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
79 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
80 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, ssozumo_state, coin_inserted, 0)
81 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, ssozumo_state, coin_inserted, 0)
82 
83 	PORT_START("P2")    /* IN1 */
84 	PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
85 	PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
86 	PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
87 	PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
88 	PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
89 	PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
90 	PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
91 	PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
92 
93 	PORT_START("DSW2")  /* DSW2 */
94 	PORT_DIPNAME( 0x01, 0x01, DEF_STR( Difficulty ) )
95 	PORT_DIPSETTING(    0x01, DEF_STR( Normal ) )
96 	PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
97 	PORT_DIPNAME( 0x02, 0x00, DEF_STR( Demo_Sounds ) )
98 	PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
99 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
100 	PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
101 	PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
102 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
103 	PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
104 	PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
105 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
106 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
107 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
108 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
109 	PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
110 	PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
111 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
112 	PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
113 	PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
114 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
115 	PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
116 	PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
117 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
118 
119 	PORT_START("DSW1")  /* DSW1 */
120 	PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_B ) )
121 	PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
122 	PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
123 	PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
124 	PORT_DIPSETTING(    0x01, DEF_STR( 1C_3C ) )
125 	PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_A ) )
126 	PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
127 	PORT_DIPSETTING(    0x0c, DEF_STR( 1C_1C ) )
128 	PORT_DIPSETTING(    0x08, DEF_STR( 1C_2C ) )
129 	PORT_DIPSETTING(    0x04, DEF_STR( 1C_3C ) )
130 	PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
131 	PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
132 	PORT_DIPSETTING(    0x00, DEF_STR( On ) )
133 	PORT_DIPNAME( 0x20, 0x00, DEF_STR( Cabinet ) )
134 	PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
135 	PORT_DIPSETTING(    0x20, DEF_STR( Cocktail ) )
136 	PORT_DIPNAME( 0x40, 0x00, DEF_STR( Controls ) )
137 	PORT_DIPSETTING(    0x00, DEF_STR( Single ) )
138 	PORT_DIPSETTING(    0x40, DEF_STR( Dual ) )
139 	PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
140 INPUT_PORTS_END
141 
142 
143 
144 static const gfx_layout charlayout =
145 {
146 	8,8,        /* 8*8 characters */
147 	RGN_FRAC(1,3),       /* 1024 characters */
148 	3,      /* 3 bits per pixel */
149 	{ RGN_FRAC(2,3), RGN_FRAC(1,3), RGN_FRAC(0,3) },    /* the bitplanes are separated */
150 	{ 0, 1, 2, 3, 4, 5, 6, 7 },
151 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
152 	8*8     /* every char takes 8 consecutive bytes */
153 };
154 
155 
156 static const gfx_layout tilelayout =
157 {
158 	16,16,  /* 16*16 tiles */
159 	256,    /* 256 tiles */
160 	3,      /* 3 bits per pixel */
161 	{ 2*256*16*16, 256*16*16, 0 },  /* the bitplanes are separated */
162 	{ 16*8 + 0, 16*8 + 1, 16*8 + 2, 16*8 + 3, 16*8 + 4, 16*8 + 5, 16*8 + 6, 16*8 + 7,
163 			0, 1, 2, 3, 4, 5, 6, 7 },
164 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
165 			8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
166 	32*8        /* every tile takes 16 consecutive bytes */
167 };
168 
169 
170 static const gfx_layout spritelayout =
171 {
172 	16,16,      /* 16*16 sprites */
173 	1280,       /* 1280 sprites */
174 	3,      /* 3 bits per pixel */
175 	{ 2*1280*16*16, 1280*16*16, 0 },    /* the bitplanes are separated */
176 	{ 16*8 + 0, 16*8 + 1, 16*8 + 2, 16*8 + 3, 16*8 + 4, 16*8 + 5, 16*8 + 6, 16*8 + 7,
177 			0, 1, 2, 3, 4, 5, 6, 7 },
178 	{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
179 			8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
180 	32*8        /* every sprite takes 16 consecutive bytes */
181 };
182 
183 
184 static GFXDECODE_START( gfx_ssozumo )
185 	GFXDECODE_ENTRY( "gfx1", 0, charlayout,     0, 4 )
186 	GFXDECODE_ENTRY( "gfx2", 0, tilelayout,   4*8, 4 )
187 	GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 8*8, 2 )
188 GFXDECODE_END
189 
INTERRUPT_GEN_MEMBER(ssozumo_state::sound_timer_irq)190 INTERRUPT_GEN_MEMBER(ssozumo_state::sound_timer_irq)
191 {
192 	if(m_sound_nmi_mask)
193 		device.execute().pulse_input_line(INPUT_LINE_NMI, attotime::zero);
194 }
195 
ssozumo(machine_config & config)196 void ssozumo_state::ssozumo(machine_config &config)
197 {
198 	/* basic machine hardware */
199 	M6502(config, m_maincpu, 1200000); /* 1.2 MHz ???? */
200 	m_maincpu->set_addrmap(AS_PROGRAM, &ssozumo_state::ssozumo_map);
201 	m_maincpu->set_vblank_int("screen", FUNC(ssozumo_state::irq0_line_hold));
202 
203 	M6502(config, m_audiocpu, 975000);         /* 975 kHz ?? */
204 	m_audiocpu->set_addrmap(AS_PROGRAM, &ssozumo_state::ssozumo_sound_map);
205 	m_audiocpu->set_periodic_int(FUNC(ssozumo_state::sound_timer_irq), attotime::from_hz(272/16*57)); // guess, assume to be the same as tagteam
206 
207 	/* video hardware */
208 	screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
209 //  screen.set_refresh_hz(60);
210 //  screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */);
211 //  screen.set_size(32*8, 32*8);
212 //  screen.set_visarea(0*8, 32*8 - 1, 1*8, 31*8 - 1);
213 	// DECO video CRTC, unverified
214 	screen.set_raw(XTAL(12'000'000)/2,384,0,256,272,8,248);
215 	screen.set_screen_update(FUNC(ssozumo_state::screen_update));
216 	screen.set_palette(m_palette);
217 
218 	GFXDECODE(config, m_gfxdecode, m_palette, gfx_ssozumo);
219 	PALETTE(config, m_palette, FUNC(ssozumo_state::ssozumo_palette), 64 + 16);
220 
221 	/* sound hardware */
222 	SPEAKER(config, "speaker").front_center();
223 
224 	GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_audiocpu, m6502_device::IRQ_LINE);
225 
226 	YM2149(config, "ay1", 1500000).add_route(ALL_OUTPUTS, "speaker", 0.3);
227 	YM2149(config, "ay2", 1500000).add_route(ALL_OUTPUTS, "speaker", 0.3);
228 
229 	DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.3); // unknown DAC
230 }
231 
232 
233 
234 ROM_START( ssozumo )
235 	ROM_REGION( 0x10000, "maincpu", 0 )
236 	/* Main Program ROMs */
237 	ROM_LOAD( "ic61.g01",   0x06000, 0x2000, CRC(86968f46) SHA1(6acd111b71fbb4ef00ae03be4fb93d305a6564e7) ) // m1
238 	ROM_LOAD( "ic60.g11",   0x08000, 0x2000, CRC(1a5143dd) SHA1(19e36afcd0827f14f4360b55d952cc1af38327fd) ) // m2
239 	ROM_LOAD( "ic59.g21",   0x0a000, 0x2000, CRC(d3df04d7) SHA1(a95cff7f67ad2a3dbf7147018889a0de3f9fcbac) ) // m3
240 	ROM_LOAD( "ic58.g31",   0x0c000, 0x2000, CRC(0ee43a78) SHA1(383a29a2dfdbd600dacf3885039759efab718a45) ) // m4
241 	ROM_LOAD( "ic57.g41",   0x0e000, 0x2000, CRC(ac77aa4c) SHA1(36ee826327e4433bcdcb8d770fc6176f53d3eed0) ) // m5
242 
243 	ROM_REGION( 0x10000, "audiocpu", 0 )
244 	/* Sound Program & Voice Sample ROMs*/
245 	ROM_LOAD( "ic47.g50",   0x04000, 0x2000, CRC(b64ec829) SHA1(684f1c37c05fc3812f11e040fb96789c8abb987f) ) // a1
246 	ROM_LOAD( "ic46.g60",   0x06000, 0x2000, CRC(630d7380) SHA1(aab3f034417a9712c8fa922946eda02751c9e319) ) // a2
247 	ROM_LOAD( "ic45.g70",   0x08000, 0x2000, CRC(1854b657) SHA1(c4f3c24a2b03bdf4d9fd80d6df944a157f98e617) ) // a3
248 	ROM_LOAD( "ic44.g80",   0x0a000, 0x2000, CRC(40b9a0da) SHA1(ef51977d23e14fb638b26afcb2617933446d8143) ) // a4
249 	ROM_LOAD( "ic43.g90",   0x0c000, 0x2000, CRC(20262064) SHA1(2845efa458f4fd873b8559489bcee4b9d8e437c1) ) // a5
250 	ROM_LOAD( "ic42.ga0",   0x0e000, 0x2000, CRC(98d7e998) SHA1(16bb3315db7d52531a3297e1255478aa1ebc32c2) ) // a6
251 
252 	ROM_REGION( 0x06000, "gfx1", 0 )
253 	/* Character ROMs */
254 	ROM_LOAD( "ic22.gq0",   0x00000, 0x2000, CRC(b4c7e612) SHA1(2d4f6f79b65aa27e00f173777959ec07e81ff15e) ) // c1
255 	ROM_LOAD( "ic23.gr0",   0x02000, 0x2000, CRC(90bb9fda) SHA1(9c065a54330133e5afadcb2ae29add5e1005d977) ) // c2
256 	ROM_LOAD( "ic21.gs0",   0x04000, 0x2000, CRC(d8cd5c78) SHA1(f1567850db649d2b7a029a5f71bbade25bb0393f) ) // c3
257 
258 	ROM_REGION( 0x06000, "gfx2", 0 )
259 	/* tile set ROMs */
260 	ROM_LOAD( "ic69.gt0",   0x00000, 0x2000, CRC(771116ca) SHA1(2d1c656315f57e1a142725e2d2034543cb3917ea) ) // t1
261 	ROM_LOAD( "ic59.gu0",   0x02000, 0x2000, CRC(68035bfd) SHA1(da535ff6860f71c1780d4d9dfd1944e355234c5b) ) // t2
262 	ROM_LOAD( "ic81.gv0",   0x04000, 0x2000, CRC(cdda1f9f) SHA1(d1f1b3e0578fd991c74d4a85313c5d37f08f1eee) ) // t3
263 
264 	ROM_REGION( 0x1e000, "gfx3", 0 )
265 	/* sprites ROMs */
266 	ROM_LOAD( "ic06.gg0",   0x00000, 0x2000, CRC(d2342c50) SHA1(f502b716d659d9fd3119dbb454296fe9e280fa5d) ) // s1a
267 	ROM_LOAD( "ic05.gh0",   0x02000, 0x2000, CRC(14a3cb10) SHA1(7b6d63f43ebbe3c3aea7f2e04789cdb78cdd8495) ) // s1b
268 	ROM_LOAD( "ic04.gi0",   0x04000, 0x2000, CRC(169276c1) SHA1(7f0b54425e0f82f7fcc892d7b8e7719087060d2a) ) // s1c
269 	ROM_LOAD( "ic03.gj0",   0x06000, 0x2000, CRC(e71b9f28) SHA1(1f4f1a4d44fecb212778bb191e14bbfdc41556a5) ) // s1d
270 	ROM_LOAD( "ic02.gk0",   0x08000, 0x2000, CRC(6e94773c) SHA1(c3a1b950c1abce7103e6a0c19b5bc47a46612b05) ) // s1e
271 	ROM_LOAD( "ic29.gl0",   0x0a000, 0x2000, CRC(40f67cc4) SHA1(fb6cfa9c9665c719926fc6ef050682f040852840) ) // s2a
272 	ROM_LOAD( "ic28.gm0",   0x0c000, 0x2000, CRC(8c97b1a2) SHA1(72ca28959b532f98e0836a9650bb3dd3fdfa755a) ) // s2b
273 	ROM_LOAD( "ic27.gn0",   0x0e000, 0x2000, CRC(be8bb3dd) SHA1(d032591e73b09e2f076a18298d606edf16998a64) ) // s2c
274 	ROM_LOAD( "ic26.go0",   0x10000, 0x2000, CRC(9c098a2c) SHA1(d2093f1a4f4b3bf3bbff0adea5bd910993ed4704) ) // s2d
275 	ROM_LOAD( "ic25.gp0",   0x12000, 0x2000, CRC(f73f8a76) SHA1(13652779d3d30de0b4136eb3f43ee5429861bf35) ) // s2e
276 	ROM_LOAD( "ic44.gb0",   0x14000, 0x2000, CRC(cdd7f2eb) SHA1(57cf788804f9d2a1283032c25b608ac45064eddb) ) // s3a
277 	ROM_LOAD( "ic43.gc0",   0x16000, 0x2000, CRC(7b4c632e) SHA1(2acb0f2213928b97fdf239fbabc6d24329cbdd7a) ) // s3b
278 	ROM_LOAD( "ic42.gd0",   0x18000, 0x2000, CRC(cd1c8fe6) SHA1(ac085a0e8e228ea6bfbe86f209be08221bb066ee) ) // s3c
279 	ROM_LOAD( "ic41.ge0",   0x1a000, 0x2000, CRC(935578d0) SHA1(e9a9f439e0781627df076c454b16f5796ac991bc) ) // s3d
280 	ROM_LOAD( "ic40.gf0",   0x1c000, 0x2000, CRC(5a3bf1ba) SHA1(6beebb7ac9c8baa3bbb5b0ebf6a6da768e52d1d3) ) // s3e
281 
282 	ROM_REGION( 0x0080, "proms", 0 )
283 	ROM_LOAD( "ic33.gz0",   0x00000, 0x0020, CRC(523d29ad) SHA1(48d0ae83a07e4409a1def56772c5156e8d505749) ) /* char palette red and green components */
284 	ROM_LOAD( "ic30.gz2",   0x00020, 0x0020, CRC(0de202e1) SHA1(ca1aa66c1d3d4724d322ec0346860c37729ddaed) ) /* tile palette red and green components */
285 	ROM_LOAD( "ic32.gz1",   0x00040, 0x0020, CRC(6fbff4d2) SHA1(b2cd38fa8e9a74539b96d6e8e0375fff2dd77a20) ) /* char palette blue component */
286 	ROM_LOAD( "ic31.gz3",   0x00060, 0x0020, CRC(18e7fe63) SHA1(b0834b94b22ead765ddac5591ab1dc66ec20f17f) ) /* tile palette blue component */
287 ROM_END
288 
289 
290 
291 GAME( 1984, ssozumo, 0, ssozumo, ssozumo, ssozumo_state, empty_init, ROT270, "Technos Japan", "Syusse Oozumou (Japan)", MACHINE_SUPPORTS_SAVE )
292