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