1 /*****************************************************************************
2 
3 Momoko 120% (c) 1986 Jaleco
4 
5 	Driver by Uki
6 
7 	02/Mar/2001 -
8 
9 ******************************************************************************
10 
11 Notes
12 
13 Real machine has some bugs.(escalator bug, sprite garbage)
14 It is not emulation bug.
15 Flipped screen looks wrong, but it is correct.
16 
17 *****************************************************************************/
18 
19 #include "driver.h"
20 #include "vidhrdw/generic.h"
21 
22 extern data8_t *momoko_bg_scrollx;
23 extern data8_t *momoko_bg_scrolly;
24 
25 VIDEO_UPDATE( momoko );
26 
27 WRITE_HANDLER( momoko_fg_scrollx_w );
28 WRITE_HANDLER( momoko_fg_scrolly_w );
29 WRITE_HANDLER( momoko_text_scrolly_w );
30 WRITE_HANDLER( momoko_text_mode_w );
31 WRITE_HANDLER( momoko_bg_scrollx_w );
32 WRITE_HANDLER( momoko_bg_scrolly_w );
33 WRITE_HANDLER( momoko_flipscreen_w );
34 WRITE_HANDLER( momoko_fg_select_w);
35 WRITE_HANDLER( momoko_bg_select_w);
36 WRITE_HANDLER( momoko_bg_priority_w);
37 
WRITE_HANDLER(momoko_bg_read_bank_w)38 WRITE_HANDLER( momoko_bg_read_bank_w )
39 {
40 	data8_t *BG_MAP = memory_region(REGION_USER1);
41 	int bank_address = (data & 0x1f) * 0x1000;
42 	cpu_setbank(1, &BG_MAP[bank_address]);
43 }
44 
45 /****************************************************************************/
46 
MEMORY_READ_START(readmem)47 static MEMORY_READ_START( readmem )
48 	{ 0x0000, 0xbfff, MRA_ROM },
49 	{ 0xc000, 0xcfff, MRA_RAM },
50 
51 	{ 0xd064, 0xd0ff, MRA_RAM }, /* sprite ram */
52 
53 	{ 0xd400, 0xd400, input_port_0_r },
54 	{ 0xd402, 0xd402, input_port_1_r },
55 	{ 0xd406, 0xd406, input_port_2_r },
56 	{ 0xd407, 0xd407, input_port_3_r },
57 
58 	{ 0xd800, 0xdbff, paletteram_r },
59 	{ 0xe000, 0xe3ff, MRA_RAM }, /* text */
60 
61 	{ 0xf000, 0xffff, MRA_BANK1 },
62 MEMORY_END
63 
64 static MEMORY_WRITE_START( writemem )
65 	{ 0x0000, 0xbfff, MWA_ROM },
66 	{ 0xc000, 0xcfff, MWA_RAM },
67 
68 	{ 0xd064, 0xd0ff, MWA_RAM, &spriteram, &spriteram_size },
69 
70 	{ 0xd400, 0xd400, MWA_NOP }, /* interrupt ack? */
71 	{ 0xd402, 0xd402, momoko_flipscreen_w },
72 	{ 0xd404, 0xd404, watchdog_reset_w },
73 	{ 0xd406, 0xd406, soundlatch_w },
74 
75 	{ 0xd800, 0xdbff, paletteram_xxxxRRRRGGGGBBBB_swap_w, &paletteram },
76 
77 	{ 0xdc00, 0xdc00, momoko_fg_scrolly_w },
78 	{ 0xdc01, 0xdc01, momoko_fg_scrollx_w },
79 	{ 0xdc02, 0xdc02, momoko_fg_select_w },
80 
81 	{ 0xe000, 0xe3ff, videoram_w, &videoram, &videoram_size },
82 
83 	{ 0xe800, 0xe800, momoko_text_scrolly_w },
84 	{ 0xe801, 0xe801, momoko_text_mode_w },
85 
86 	{ 0xf000, 0xf001, momoko_bg_scrolly_w, &momoko_bg_scrolly },
87 	{ 0xf002, 0xf003, momoko_bg_scrollx_w, &momoko_bg_scrollx },
88 	{ 0xf004, 0xf004, momoko_bg_read_bank_w },
89 	{ 0xf006, 0xf006, momoko_bg_select_w },
90 	{ 0xf007, 0xf007, momoko_bg_priority_w },
91 MEMORY_END
92 
93 static MEMORY_READ_START( readmem_sound )
94 	{ 0x0000, 0x7fff, MRA_ROM },
95 	{ 0x8000, 0x87ff, MRA_RAM },
96 	{ 0xa000, 0xa000, YM2203_status_port_0_r },
97 	{ 0xa001, 0xa001, YM2203_read_port_0_r },
98 	{ 0xc000, 0xc000, YM2203_status_port_1_r },
99 	{ 0xc001, 0xc001, YM2203_read_port_1_r },
100 MEMORY_END
101 
102 static MEMORY_WRITE_START( writemem_sound )
103 	{ 0x0000, 0x7fff, MWA_ROM },
104 	{ 0x8000, 0x87ff, MWA_RAM },
105 	{ 0x9000, 0x9000, MWA_NOP }, /* unknown */
106 	{ 0xa000, 0xa000, YM2203_control_port_0_w },
107 	{ 0xa001, 0xa001, YM2203_write_port_0_w },
108 	{ 0xb000, 0xb000, MWA_NOP }, /* unknown */
109 	{ 0xc000, 0xc000, YM2203_control_port_1_w },
110 	{ 0xc001, 0xc001, YM2203_write_port_1_w },
111 MEMORY_END
112 
113 /****************************************************************************/
114 
115 INPUT_PORTS_START( momoko )
116     PORT_START
117     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
118     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
119     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
120     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
121     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
122     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
123     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
124     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
125 
126     PORT_START
127     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
128     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
129     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
130     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
131     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
132     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
133     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
134     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
135 
136     PORT_START  /* dsw0 */
137     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
138     PORT_DIPSETTING(    0x03, "3" )
139     PORT_DIPSETTING(    0x02, "4" )
140     PORT_DIPSETTING(    0x01, "5" )
141     PORT_BITX( 0,       0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "256", IP_KEY_NONE, IP_JOY_NONE )
142     PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coinage ) )
143     PORT_DIPSETTING(    0x10, DEF_STR( 5C_1C ) )
144     PORT_DIPSETTING(    0x14, DEF_STR( 3C_1C ) )
145     PORT_DIPSETTING(    0x18, DEF_STR( 2C_1C ) )
146     PORT_DIPSETTING(    0x1c, DEF_STR( 1C_1C ) )
147     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_2C ) )
148     PORT_DIPSETTING(    0x04, DEF_STR( 2C_5C ) )
149     PORT_DIPSETTING(    0x08, DEF_STR( 1C_5C ) )
150     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
151     PORT_DIPNAME( 0x60, 0x60, DEF_STR( Difficulty ) )
152     PORT_DIPSETTING(    0x40, "Easy" )
153     PORT_DIPSETTING(    0x60, "Normal" )
154     PORT_DIPSETTING(    0x20, "Difficult" )
155     PORT_DIPSETTING(    0x00, "Very difficult" )
156     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
157 
158     PORT_START  /* dsw1 */
159     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life) )
160     PORT_DIPSETTING(    0x01, "20000" )
161     PORT_DIPSETTING(    0x03, "30000" )
162     PORT_DIPSETTING(    0x02, "50000" )
163     PORT_DIPSETTING(    0x00, "100000" )
164     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown) )
165     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
166     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
167     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown) )
168     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
169     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
170     PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) )
171     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
172     PORT_DIPSETTING(    0x10, DEF_STR( Cocktail ) )
173     PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) )
174     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
175     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
176     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
177     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
178     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
179     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
180     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
181     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
182 
183     PORT_START	/* fake */
184     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Flip_Screen ) )
185     PORT_DIPSETTING(	0x00, DEF_STR( Off ) )
186     PORT_DIPSETTING(	0x01, DEF_STR( On ) )
187 
188 INPUT_PORTS_END
189 
190 /****************************************************************************/
191 
192 static struct GfxLayout charlayout =
193 {
194 	8,8,    /* 8*8 characters */
195 	256,    /* 256 characters */
196 	2,      /* 2 bits per pixel */
197 	{4, 0},
198 	{0, 1, 2, 3, 256*8*8+0, 256*8*8+1, 256*8*8+2, 256*8*8+3},
199 	{8*0, 8*1, 8*2, 8*3, 8*4, 8*5, 8*6, 8*7},
200 	8*8
201 };
202 
203 static struct GfxLayout spritelayout =
204 {
205 	8,16,     /* 8*16 characters */
206 	2048-128, /* 1024 sprites ( ccc 0ccccccc ) */
207 	4,        /* 4 bits per pixel */
208 	{12,8,4,0},
209 	{0, 1, 2, 3, 4096*8+0, 4096*8+1, 4096*8+2, 4096*8+3},
210 	{0, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
211 	 8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16},
212 	8*32
213 };
214 
215 static struct GfxLayout tilelayout =
216 {
217 	8,8,      /* 8*8 characters */
218 	8192-256, /* 4096 tiles ( cccc0 cccccccc ) */
219 	4,        /* 4 bits per pixel */
220 	{4,0,12,8},
221 	{0, 1, 2, 3, 4096*8+0, 4096*8+1, 4096*8+2, 4096*8+3},
222 	{0, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16},
223 	8*16
224 };
225 
226 static struct GfxLayout charlayout1 =
227 {
228 	8,1,    /* 8*1 characters */
229 	256*8,  /* 2048 characters */
230 	2,      /* 2 bits per pixel */
231 	{4, 0},
232 	{0, 1, 2, 3, 256*8*8+0, 256*8*8+1, 256*8*8+2, 256*8*8+3},
233 	{8*0},
234 	8*1
235 };
236 
237 static struct GfxDecodeInfo gfxdecodeinfo[] =
238 {
239 	{ REGION_GFX1, 0x0000, &charlayout1,      0,  24 }, /* TEXT */
240 	{ REGION_GFX2, 0x0000, &tilelayout,     256,  16 }, /* BG */
241 	{ REGION_GFX3, 0x0000, &charlayout,       0,   1 }, /* FG */
242 	{ REGION_GFX4, 0x0000, &spritelayout,   128,   8 }, /* sprite */
243 	{ -1 } /* end of array */
244 };
245 
246 /****************************************************************************/
247 
248 static struct YM2203interface ym2203_interface =
249 {
250 	2,          /* 2 chips */
251 	1250000,    /* 1.25 MHz */
252 	{ YM2203_VOL(40,15), YM2203_VOL(40,15) },
253 	{ 0, soundlatch_r },
254 	{ 0 },
255 	{ 0 },
256 	{ 0 }
257 };
258 
259 static MACHINE_DRIVER_START( momoko )
260 
261 	/* basic machine hardware */
262 	MDRV_CPU_ADD(Z80, 5000000)	/* 5.0MHz */
263 	MDRV_CPU_MEMORY(readmem,writemem)
264 	MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
265 
266 	MDRV_CPU_ADD(Z80, 2500000)
267 	MDRV_CPU_FLAGS(CPU_AUDIO_CPU)	/* 2.5MHz */
268 	MDRV_CPU_MEMORY(readmem_sound,writemem_sound)
269 
270 	MDRV_FRAMES_PER_SECOND(60)
271 	MDRV_VBLANK_DURATION(DEFAULT_REAL_60HZ_VBLANK_DURATION)
272 
273 	/* video hardware */
274 	MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
275 	MDRV_SCREEN_SIZE(32*8, 32*8)
276 	MDRV_VISIBLE_AREA(1*8, 31*8-1, 2*8, 29*8-1)
277 	MDRV_GFXDECODE(gfxdecodeinfo)
278 	MDRV_PALETTE_LENGTH(512)
279 
280 	MDRV_VIDEO_START(generic)
281 	MDRV_VIDEO_UPDATE(momoko)
282 
283 	/* sound hardware */
284 	MDRV_SOUND_ADD(YM2203, ym2203_interface)
285 MACHINE_DRIVER_END
286 
287 /****************************************************************************/
288 
289 ROM_START( momoko )
290 	ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* main CPU */
291 	ROM_LOAD( "momoko03.bin", 0x0000,  0x8000, CRC(386e26ed) SHA1(ad746ed1b87bafc5b4df9a28aade58cf894f4e7b) )
292 	ROM_LOAD( "momoko02.bin", 0x8000,  0x4000, CRC(4255e351) SHA1(27a0e8d8aea223d2128139582e3b66106f3608ef) )
293 
294 	ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* sound CPU */
295 	ROM_LOAD( "momoko01.bin", 0x0000,  0x8000, CRC(e8a6673c) SHA1(f8984b063929305c9058801202405e6d45254b5b) )
296 
297 	ROM_REGION( 0x2000, REGION_GFX1, ROMREGION_DISPOSE ) /* text */
298 	ROM_LOAD( "momoko13.bin", 0x0000,  0x2000, CRC(2745cf5a) SHA1(3db7c6319cac63df1620ef25508c5c45eaa4b141) )
299 
300 	ROM_REGION( 0x2000, REGION_GFX3, ROMREGION_DISPOSE ) /* FG */
301 	ROM_LOAD( "momoko14.bin", 0x0000,  0x2000, CRC(cfccca05) SHA1(4ecff488a37ac76ecb9ecf8980bea30dcc9c9951) )
302 
303 	ROM_REGION( 0x10000, REGION_GFX4, ROMREGION_DISPOSE ) /* sprite */
304 	ROM_LOAD16_BYTE( "momoko16.bin", 0x0000,  0x8000, CRC(fc6876fc) SHA1(b2d06bc01ef9f4db9bf8902d67f31ccbb0fea61a) )
305 	ROM_LOAD16_BYTE( "momoko17.bin", 0x0001,  0x8000, CRC(45dc0247) SHA1(1b2bd4197ab7d237966e037c249b5bd623646c0b) )
306 
307 	ROM_REGION( 0x20000, REGION_GFX2, 0 ) /* BG */
308 	ROM_LOAD16_BYTE( "momoko09.bin", 0x00000, 0x8000, CRC(9f5847c7) SHA1(6bc9a00622d8a23446294a8d5d467375c5719125) )
309 	ROM_LOAD16_BYTE( "momoko11.bin", 0x00001, 0x8000, CRC(9c9fbd43) SHA1(7adfd7ea3dd6745c14e719883f1a86e0a3b3c0ff) )
310 	ROM_LOAD16_BYTE( "momoko10.bin", 0x10000, 0x8000, CRC(ae17e74b) SHA1(f52657ea6b6ac518b70fd7b811d9699da27f67d9) )
311 	ROM_LOAD16_BYTE( "momoko12.bin", 0x10001, 0x8000, CRC(1e29c9c4) SHA1(d78f102cefc9852b529dd317a76c7003ec2ad3d5) )
312 
313 	ROM_REGION( 0x20000, REGION_USER1, 0 ) /* BG map */
314 	ROM_LOAD( "momoko04.bin", 0x0000,  0x8000, CRC(3ab3c2c3) SHA1(d4a0d7f83bf64769e90a2c264c6114ac308cb8b5) )
315 	ROM_LOAD( "momoko05.bin", 0x8000,  0x8000, CRC(757cdd2b) SHA1(3471b42dc6458a18894dbd0638f4fe43c86dd70d) )
316 	ROM_LOAD( "momoko06.bin", 0x10000, 0x8000, CRC(20cacf8b) SHA1(e2b39abfc960e1c472e2bcf0cf06825c39941c03) )
317 	ROM_LOAD( "momoko07.bin", 0x18000, 0x8000, CRC(b94b38db) SHA1(9c9e45bbeca7b6b8b0051b144fb31fceaf5d6906) )
318 
319 	ROM_REGION( 0x2000, REGION_USER2, 0 ) /* BG color/priority table */
320 	ROM_LOAD( "momoko08.bin", 0x0000,  0x2000, CRC(69b41702) SHA1(21b33b243dd6eaec8d41d9fd4d9e7faf2bd7f4d2) )
321 
322 	ROM_REGION( 0x4000, REGION_USER3, 0 ) /* FG map */
323 	ROM_LOAD( "momoko15.bin", 0x0000,  0x4000, CRC(8028f806) SHA1(c7450d48803082f64af67fe752b6f49b71b6ff48) )
324 
325 	ROM_REGION( 0x0120, REGION_PROMS, 0 ) /* TEXT color */
326 	ROM_LOAD( "momoko-c.bin", 0x0000,  0x0100, CRC(f35ccae0) SHA1(60b99dd3c96637dacba7e96a143b1a2d6ffd28b9) )
327 	ROM_LOAD( "momoko-b.bin", 0x0100,  0x0020, CRC(427b0e5c) SHA1(aa2797b899571527cc96013fd3420b841954ee67) )
328 ROM_END
329 
330 GAME( 1986, momoko, 0, momoko, momoko, 0, ROT0, "Jaleco", "Momoko 120%" )
331