1 #include "../vidhrdw/karnov.c"
2
3 /***************************************************************************
4
5 Karnov (USA version) (c) 1987 Data East USA
6 Karnov (Japanese version) (c) 1987 Data East Corporation
7 Wonder Planet (Japanese version) (c) 1987 Data East Corporation
8 Chelnov (USA version) (c) 1988 Data East USA
9 Chelnov (Japanese version) (c) 1987 Data East Corporation
10
11
12 Emulation by Bryan McPhail, mish@tendril.co.uk
13
14
15 NOTE! Karnov USA & Karnov Japan sets have different gameplay!
16 and Chelnov USA & Chelnov Japan sets have different gameplay!
17
18 These games use a 68000 main processor with a 6502, YM2203C and YM3526 for
19 sound. Karnov was a major pain to get going because of the
20 'protection' on the main player sprite, probably connected to the Intel
21 microcontroller on the board. The game is very sensitive to the wrong values
22 at the input ports...
23
24 There is another Karnov rom set - a bootleg version of the Japanese roms with
25 the Data East copyright removed - not supported because the original Japanese
26 roms work fine.
27
28 One of the two color PROMs for chelnov and chelnoj is different; one is most
29 likely a bad read, but I don't know which one.
30
31 Thanks to Oliver Stabel <stabel@rhein-neckar.netsurf.de> for confirming some
32 of the sprite & control information :)
33
34 Cheats:
35
36 Karnov - put 0x30 at 0x60201 to skip a level
37 Chelnov - level number at 0x60189 - enter a value at cartoon intro
38
39 *******************************************************************************/
40
41 #include "driver.h"
42 #include "vidhrdw/generic.h"
43 #include "cpu/m6502/m6502.h"
44
45 void karnov_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
46 void karnov_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
47 void wndrplnt_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
48 WRITE_HANDLER( karnov_foreground_w );
49
50 int karnov_vh_start (void);
51 void karnov_vh_stop (void);
52
53 static int i8751_return;
54 static int KARNOV, CHELNOV, WNDRPLNT; /* :) */
55 static unsigned char *karnov_ram;
56 extern int karnov_scroll[4];
57
58 /******************************************************************************/
59
60 /* Emulation of the protected microcontroller - for coins & general protection */
karnov_i8751_w(int data)61 static void karnov_i8751_w(int data)
62 {
63 i8751_return=0;
64 if (data==0x100 && KARNOV==2) i8751_return=0x56a; /* Japan version */
65 if (data==0x100 && KARNOV==1) i8751_return=0x56b; /* USA version */
66 if ((data&0xf00)==0x300) i8751_return=(data&0xff)*0x12; /* Player sprite mapping */
67
68 /* I'm not sure the ones marked ^ appear in the right order */
69 if (data==0x400) i8751_return=0x4000; /* Get The Map... */
70 if (data==0x402) i8751_return=0x40a6; /* Ancient Ruins */
71 if (data==0x403) i8751_return=0x4054; /* Forest... */
72 if (data==0x404) i8751_return=0x40de; /* ^Rocky hills */
73 if (data==0x405) i8751_return=0x4182; /* Sea */
74 if (data==0x406) i8751_return=0x41ca; /* Town */
75 if (data==0x407) i8751_return=0x421e; /* Desert */
76 if (data==0x401) i8751_return=0x4138; /* ^Whistling wind */
77 if (data==0x408) i8751_return=0x4276; /* ^Heavy Gates */
78
79 // if (!i8751_return && data!=0x300) logerror("CPU %04x - Unknown Write %02x intel\n",cpu_get_pc(),data);
80
81 cpu_cause_interrupt(0,6); /* Signal main cpu task is complete */
82 }
83
wndrplnt_i8751_w(int data)84 static void wndrplnt_i8751_w(int data)
85 {
86 // static int level;
87
88 i8751_return=0;
89 if (data==0x100) i8751_return=0x67a;
90 // if (data==0x200) i8751_return=0x214;
91
92 /* USA version will have different values for these commands */
93
94 if (data==0x300) i8751_return=0x17; /* Copyright text on title screen */
95 // if (data==0x300) i8751_return=0x1; /* (USA) Copyright text on title screen */
96
97 //if (data!=0x600) logerror("CPU %04x - Unknown Write %02x intel\n",cpu_get_pc(),data);
98
99 cpu_cause_interrupt(0,6); /* Signal main cpu task is complete */
100 }
101
chelnov_i8751_w(int data)102 static void chelnov_i8751_w(int data)
103 {
104 static int level;
105
106 i8751_return=0;
107 if (data==0x200 && CHELNOV==2) i8751_return=0x7734; /* Japan version */
108 if (data==0x200 && CHELNOV==1) i8751_return=0x783e; /* USA version */
109 if (data==0x100 && CHELNOV==2) i8751_return=0x71a; /* Japan version */
110 if (data==0x100 && CHELNOV==1) i8751_return=0x71b; /* USA version */
111 if (data>=0x6000 && data<0x8000) i8751_return=1; /* patched */
112 if ((data&0xf000)==0x1000) level=1; /* Level 1 */
113 if ((data&0xf000)==0x2000) level++; /* Level Increment */
114 if ((data&0xf000)==0x3000) { /* Sprite table mapping */
115 int b=data&0xff;
116 switch (level) {
117 case 1: /* Level 1, Sprite mapping tables */
118 if (CHELNOV==1) { /* USA */
119 if (b<2) i8751_return=0;
120 else if (b<6) i8751_return=1;
121 else if (b<0xb) i8751_return=2;
122 else if (b<0xf) i8751_return=3;
123 else if (b<0x13) i8751_return=4;
124 else i8751_return=5;
125 } else { /* Japan */
126 if (b<3) i8751_return=0;
127 else if (b<8) i8751_return=1;
128 else if (b<0xc) i8751_return=2;
129 else if (b<0x10) i8751_return=3;
130 else if (b<0x19) i8751_return=4;
131 else if (b<0x1b) i8751_return=5;
132 else if (b<0x22) i8751_return=6;
133 else if (b<0x28) i8751_return=7;
134 else i8751_return=8;
135 }
136 break;
137 case 2: /* Level 2, Sprite mapping tables, USA & Japan are the same */
138 if (b<3) i8751_return=0;
139 else if (b<9) i8751_return=1;
140 else if (b<0x11) i8751_return=2;
141 else if (b<0x1b) i8751_return=3;
142 else if (b<0x21) i8751_return=4;
143 else if (b<0x28) i8751_return=5;
144 else i8751_return=6;
145 break;
146 case 3: /* Level 3, Sprite mapping tables, USA & Japan are the same */
147 if (b<5) i8751_return=0;
148 else if (b<9) i8751_return=1;
149 else if (b<0xd) i8751_return=2;
150 else if (b<0x11) i8751_return=3;
151 else if (b<0x1b) i8751_return=4;
152 else if (b<0x1c) i8751_return=5;
153 else if (b<0x22) i8751_return=6;
154 else if (b<0x27) i8751_return=7;
155 else i8751_return=8;
156 break;
157 case 4: /* Level 4, Sprite mapping tables, USA & Japan are the same */
158 if (b<4) i8751_return=0;
159 else if (b<0xc) i8751_return=1;
160 else if (b<0xf) i8751_return=2;
161 else if (b<0x19) i8751_return=3;
162 else if (b<0x1c) i8751_return=4;
163 else if (b<0x22) i8751_return=5;
164 else if (b<0x29) i8751_return=6;
165 else i8751_return=7;
166 break;
167 case 5: /* Level 5, Sprite mapping tables */
168 if (b<7) i8751_return=0;
169 else if (b<0xe) i8751_return=1;
170 else if (b<0x14) i8751_return=2;
171 else if (b<0x1a) i8751_return=3;
172 else if (b<0x23) i8751_return=4;
173 else if (b<0x27) i8751_return=5;
174 else i8751_return=6;
175 break;
176 case 6: /* Level 6, Sprite mapping tables */
177 if (b<3) i8751_return=0;
178 else if (b<0xb) i8751_return=1;
179 else if (b<0x11) i8751_return=2;
180 else if (b<0x17) i8751_return=3;
181 else if (b<0x1d) i8751_return=4;
182 else if (b<0x24) i8751_return=5;
183 else i8751_return=6;
184 break;
185 case 7: /* Level 7, Sprite mapping tables */
186 if (b<5) i8751_return=0;
187 else if (b<0xb) i8751_return=1;
188 else if (b<0x11) i8751_return=2;
189 else if (b<0x1a) i8751_return=3;
190 else if (b<0x21) i8751_return=4;
191 else if (b<0x27) i8751_return=5;
192 else i8751_return=6;
193 break;
194 }
195 }
196
197 // if (!i8751_return) logerror("CPU %04x - Unknown Write %02x intel\n",cpu_get_pc(),data);
198
199 cpu_cause_interrupt(0,6); /* Signal main cpu task is complete */
200 }
201
202 /******************************************************************************/
203
WRITE_HANDLER(karnov_control_w)204 static WRITE_HANDLER( karnov_control_w )
205 {
206 /* Mnemonics filled in from the schematics, brackets are my comments */
207 switch (offset) {
208 case 0: /* SECLR (Interrupt ack for Level 6 i8751 interrupt) */
209 return;
210
211 case 2: /* SONREQ (Sound CPU byte) */
212 soundlatch_w(0,data&0xff);
213 cpu_cause_interrupt (1, M6502_INT_NMI);
214 break;
215
216 case 4: /* DM (DMA to buffer spriteram) */
217 buffer_spriteram_w(0,0);
218 break;
219
220 case 6: /* SECREQ (Interrupt & Data to i8751) */
221 if (KARNOV) karnov_i8751_w(data);
222 if (CHELNOV) chelnov_i8751_w(data);
223 if (WNDRPLNT) wndrplnt_i8751_w(data);
224 break;
225
226 case 8: /* HSHIFT (9 bits) - Top bit indicates video flip */
227 WRITE_WORD (&karnov_scroll[0], data);
228 break;
229
230 case 0xa: /* VSHIFT */
231 WRITE_WORD (&karnov_scroll[2], data);
232 break;
233
234 case 0xc: /* SECR (Reset i8751) */
235 //logerror("Reset i8751\n");
236 i8751_return=0;
237 break;
238
239 case 0xe: /* INTCLR (Interrupt ack for Level 7 vbl interrupt) */
240 break;
241 }
242 }
243
244 /******************************************************************************/
245
READ_HANDLER(karnov_control_r)246 static READ_HANDLER( karnov_control_r )
247 {
248 switch (offset) {
249 case 0: /* Player controls */
250 return ( readinputport(0) + (readinputport(1)<<8));
251 case 2: /* Start buttons & VBL */
252 return readinputport(2);
253 case 4: /* Dipswitch A & B */
254 return ( readinputport(4) + (readinputport(5)<<8));
255 case 6: /* i8751 return values */
256 return i8751_return;
257 }
258
259 return 0xffff;
260 }
261
262 /******************************************************************************/
263
WRITE_HANDLER(videoram_mirror_w)264 static WRITE_HANDLER( videoram_mirror_w ) { COMBINE_WORD_MEM(&videoram[offset],data);}
265
266 static struct MemoryReadAddress karnov_readmem[] =
267 {
268 { 0x000000, 0x05ffff, MRA_ROM },
269 { 0x060000, 0x063fff, MRA_BANK1 },
270 { 0x080000, 0x080fff, MRA_BANK2 },
271 { 0x0a0000, 0x0a07ff, MRA_BANK3 },
272 { 0x0c0000, 0x0c0007, karnov_control_r },
273 { -1 } /* end of table */
274 };
275
276 static struct MemoryWriteAddress karnov_writemem[] =
277 {
278 { 0x000000, 0x05ffff, MWA_ROM },
279 { 0x060000, 0x063fff, MWA_BANK1 , &karnov_ram },
280 { 0x080000, 0x080fff, MWA_BANK2 , &spriteram, &spriteram_size },
281 { 0x0a0000, 0x0a07ff, MWA_BANK3 , &videoram, &videoram_size },
282 { 0x0a0800, 0x0a0fff, videoram_mirror_w }, /* Wndrplnt only */
283 { 0x0a1000, 0x0a1fff, karnov_foreground_w },
284 { 0x0c0000, 0x0c000f, karnov_control_w },
285 { -1 } /* end of table */
286 };
287
288 /******************************************************************************/
289
290 static struct MemoryReadAddress karnov_s_readmem[] =
291 {
292 { 0x0000, 0x05ff, MRA_RAM},
293 { 0x0800, 0x0800, soundlatch_r },
294 { 0x8000, 0xffff, MRA_ROM },
295 { -1 } /* end of table */
296 };
297
298 static struct MemoryWriteAddress karnov_s_writemem[] =
299 {
300 { 0x0000, 0x05ff, MWA_RAM},
301 { 0x1000, 0x1000, YM2203_control_port_0_w }, /* OPN */
302 { 0x1001, 0x1001, YM2203_write_port_0_w },
303 { 0x1800, 0x1800, YM3526_control_port_0_w }, /* OPL */
304 { 0x1801, 0x1801, YM3526_write_port_0_w },
305 { 0x8000, 0xffff, MWA_ROM },
306 { -1 } /* end of table */
307 };
308
309 /******************************************************************************/
310
311 INPUT_PORTS_START( karnov )
312 PORT_START /* Player 1 controls */
313 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
314 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
315 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
316 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
317 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
318 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
319 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
320 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) /* Button 4 on schematics */
321
322 PORT_START /* Player 2 controls */
323 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
324 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
325 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
326 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
327 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
328 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
329 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL )
330 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) /* Button 4 on schematics */
331
332 PORT_START /* start buttons */
333 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) /* PL1 Button 5 on schematics */
334 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) /* PL2 Button 5 on schematics */
335 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
336 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
337 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
338 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
339 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
340 PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
341
342 PORT_START /* Dummy input for i8751 */
343 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN3 )
344 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
345 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_COIN1 )
346 PORT_BIT( 0xf8, IP_ACTIVE_LOW, IPT_UNUSED )
347
348 PORT_START /* Dip switch bank 1 */
349 PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_B ) )
350 PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) )
351 PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) )
352 PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
353 PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) )
354 PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_A ) )
355 PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) )
356 PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) )
357 PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) )
358 PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) )
359 PORT_DIPNAME( 0x10, 0x00, DEF_STR( Unused ) )
360 PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
361 PORT_DIPSETTING( 0x10, DEF_STR( On ) )
362 PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) )
363 PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
364 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
365 PORT_DIPNAME( 0x40, 0x00, DEF_STR( Cabinet ) )
366 PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
367 PORT_DIPSETTING( 0x40, DEF_STR( Cocktail ) )
368 PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
369 PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
370 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
371 /* 0x80 called No Die Mode according to the manual, but it doesn't seem
372 to have any effect */
373
374 PORT_START /* Dip switch bank 2 */
375 PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
376 PORT_DIPSETTING( 0x01, "1" )
377 PORT_DIPSETTING( 0x03, "3" )
378 PORT_DIPSETTING( 0x02, "5" )
379 PORT_BITX(0, 0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "Infinite", IP_KEY_NONE, IP_JOY_NONE )
380 PORT_DIPNAME( 0x0c, 0x0c, "K needed for Bonus Life" )
381 PORT_DIPSETTING( 0x0c, "50" )
382 PORT_DIPSETTING( 0x08, "70" )
383 PORT_DIPSETTING( 0x04, "90" )
384 PORT_DIPSETTING( 0x00, "100" )
385 PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) )
386 PORT_DIPSETTING( 0x30, "Easy" )
387 PORT_DIPSETTING( 0x10, "Normal" )
388 PORT_DIPSETTING( 0x20, "Hard" )
389 PORT_DIPSETTING( 0x00, "Very Hard" )
390 PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) )
391 PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
392 PORT_DIPSETTING( 0x40, DEF_STR( On ) )
393 PORT_DIPNAME( 0x80, 0x80, "Timer Speed" )
394 PORT_DIPSETTING( 0x80, "Normal" )
395 PORT_DIPSETTING( 0x00, "Fast" )
396 INPUT_PORTS_END
397
398 INPUT_PORTS_START( chelnov )
399 PORT_START /* Player controls */
400 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
401 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
402 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
403 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
404 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
405 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
406 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
407 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
408
409 PORT_START /* Player 2 controls */
410 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
411 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
412 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
413 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
414 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
415 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
416 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 | IPF_COCKTAIL )
417 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
418
419 PORT_START /* start buttons */
420 PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED )
421 PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED )
422 PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
423 PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START2 )
424 PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNUSED )
425 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
426 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
427 PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK ) /* Active_low is strange! */
428
429 PORT_START /* Dummy input for i8751 */
430 PORT_BIT( 0x1f, IP_ACTIVE_LOW, IPT_UNUSED )
431 PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 )
432 PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
433 PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN3 )
434
435 PORT_START /* Dip switch bank 1 */
436 PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_B ) )
437 PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) )
438 PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) )
439 PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) )
440 PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) )
441 PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Coin_A ) )
442 PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) )
443 PORT_DIPSETTING( 0x04, DEF_STR( 2C_1C ) )
444 PORT_DIPSETTING( 0x0c, DEF_STR( 1C_1C ) )
445 PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) )
446 PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
447 PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
448 PORT_DIPSETTING( 0x10, DEF_STR( On ) )
449 PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) )
450 PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
451 PORT_DIPSETTING( 0x20, DEF_STR( On ) )
452 PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) )
453 PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
454 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
455 PORT_DIPNAME( 0x80, 0x00, DEF_STR( Cabinet ) )
456 PORT_DIPSETTING( 0x00, DEF_STR( Upright ) )
457 PORT_DIPSETTING( 0x80, DEF_STR( Cocktail ) )
458
459 PORT_START /* Dip switch bank 2 */
460 PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
461 PORT_DIPSETTING( 0x01, "1" )
462 PORT_DIPSETTING( 0x03, "3" )
463 PORT_DIPSETTING( 0x02, "5" )
464 PORT_BITX(0, 0x00, IPT_DIPSWITCH_SETTING | IPF_CHEAT, "Infinite", IP_KEY_NONE, IP_JOY_NONE )
465 PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) )
466 PORT_DIPSETTING( 0x04, "Easy" )
467 PORT_DIPSETTING( 0x0c, "Normal" )
468 PORT_DIPSETTING( 0x08, "Hard" )
469 PORT_DIPSETTING( 0x00, "Hardest" )
470 PORT_DIPNAME( 0x10, 0x10, "Allow Continue" )
471 PORT_DIPSETTING( 0x00, DEF_STR( No ) )
472 PORT_DIPSETTING( 0x10, DEF_STR( Yes ) )
473 PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
474 PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
475 PORT_DIPSETTING( 0x20, DEF_STR( On ) )
476 PORT_DIPNAME( 0x40, 0x40, "Freeze" )
477 PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
478 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
479 PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) )
480 PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
481 PORT_DIPSETTING( 0x00, DEF_STR( On ) )
482 INPUT_PORTS_END
483
484 /******************************************************************************/
485
486 static struct GfxLayout chars =
487 {
488 8,8,
489 1024,
490 3,
491 { 0x6000*8,0x4000*8,0x2000*8 },
492 { 0, 1, 2, 3, 4, 5, 6, 7 },
493 { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
494 8*8 /* every sprite takes 8 consecutive bytes */
495 };
496
497 static struct GfxLayout sprites =
498 {
499 16,16,
500 4096,
501 4,
502 { 0x60000*8,0x00000*8,0x20000*8,0x40000*8 },
503 { 16*8, 1+(16*8), 2+(16*8), 3+(16*8), 4+(16*8), 5+(16*8), 6+(16*8), 7+(16*8),
504 0,1,2,3,4,5,6,7 },
505 { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 ,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8},
506 16*16
507 };
508
509
510 /* 16x16 tiles, 4 Planes, each plane is 0x10000 bytes */
511 static struct GfxLayout tiles =
512 {
513 16,16,
514 2048,
515 4,
516 { 0x30000*8,0x00000*8,0x10000*8,0x20000*8 },
517 { 16*8, 1+(16*8), 2+(16*8), 3+(16*8), 4+(16*8), 5+(16*8), 6+(16*8), 7+(16*8),
518 0,1,2,3,4,5,6,7 },
519 { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 ,8*8,9*8,10*8,11*8,12*8,13*8,14*8,15*8},
520 16*16
521 };
522
523 static struct GfxDecodeInfo karnov_gfxdecodeinfo[] =
524 {
525 { REGION_GFX1, 0, &chars, 0, 4 }, /* colors 0-31 */
526 { REGION_GFX2, 0, &tiles, 512, 16 }, /* colors 512-767 */
527 { REGION_GFX3, 0, &sprites, 256, 16 }, /* colors 256-511 */
528 { -1 } /* end of array */
529 };
530
531 /******************************************************************************/
532
karnov_interrupt(void)533 static int karnov_interrupt(void)
534 {
535 static int latch;
536
537 /* Coin input to the i8751 generates an interrupt to the main cpu */
538 if (readinputport(3) == 0xff) latch=1;
539 if (readinputport(3) != 0xff && latch) {
540 i8751_return=readinputport(3) | 0x8000;
541 cpu_cause_interrupt(0,6);
542 latch=0;
543 }
544
545 return 7; /* VBL */
546 }
547
sound_irq(int linestate)548 static void sound_irq(int linestate)
549 {
550 cpu_set_irq_line(1,0,linestate); /* IRQ */
551 }
552
553 static struct YM2203interface ym2203_interface =
554 {
555 1,
556 1500000, /* Accurate */
557 { YM2203_VOL(20,20) },
558 { 0 },
559 { 0 },
560 { 0 },
561 { 0 }
562 };
563
564 static struct YM3526interface ym3526_interface =
565 {
566 1, /* 1 chip */
567 3000000, /* Accurate */
568 { 60 }, /* */
569 { sound_irq },
570 };
571
572 /******************************************************************************/
573
karnov_reset_init(void)574 static void karnov_reset_init(void)
575 {
576 memset(karnov_ram,0,0x4000); /* Chelnov likes ram clear on reset.. */
577 }
578
579 static struct MachineDriver machine_driver_karnov =
580 {
581 /* basic machine hardware */
582 {
583 {
584 CPU_M68000,
585 10000000, /* 10 Mhz */
586 karnov_readmem,karnov_writemem,0,0,
587 karnov_interrupt,1
588 },
589 {
590 CPU_M6502 | CPU_AUDIO_CPU,
591 1500000, /* Accurate */
592 karnov_s_readmem,karnov_s_writemem,0,0,
593 ignore_interrupt,0 /* Interrupts from OPL chip */
594 }
595 },
596 60, DEFAULT_REAL_60HZ_VBLANK_DURATION*2,
597 1, /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
598 karnov_reset_init,
599
600 /* video hardware */
601 32*8, 32*8, { 0*8, 32*8-1, 1*8, 31*8-1 },
602
603 karnov_gfxdecodeinfo,
604 1024, 1024,
605 karnov_vh_convert_color_prom,
606
607 VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM,
608 0,
609 karnov_vh_start,
610 karnov_vh_stop,
611 karnov_vh_screenrefresh,
612
613 /* sound hardware */
614 0,0,0,0,
615 {
616 {
617 SOUND_YM2203,
618 &ym2203_interface
619 },
620 {
621 SOUND_YM3526,
622 &ym3526_interface
623 }
624 }
625 };
626
627 static struct MachineDriver machine_driver_wndrplnt =
628 {
629 /* basic machine hardware */
630 {
631 {
632 CPU_M68000,
633 10000000, /* 10 Mhz */
634 karnov_readmem,karnov_writemem,0,0,
635 karnov_interrupt,1
636 },
637 {
638 CPU_M6502 | CPU_AUDIO_CPU,
639 1500000, /* Accurate */
640 karnov_s_readmem,karnov_s_writemem,0,0,
641 ignore_interrupt,0 /* Interrupts from OPL chip */
642 }
643 },
644 60, DEFAULT_REAL_60HZ_VBLANK_DURATION*2,
645 1, /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
646 karnov_reset_init,
647
648 /* video hardware */
649 32*8, 32*8, { 0*8, 32*8-1, 1*8, 31*8-1 },
650
651 karnov_gfxdecodeinfo,
652 1024, 1024,
653 karnov_vh_convert_color_prom,
654
655 VIDEO_TYPE_RASTER | VIDEO_BUFFERS_SPRITERAM,
656 0,
657 karnov_vh_start,
658 karnov_vh_stop,
659 wndrplnt_vh_screenrefresh,
660
661 /* sound hardware */
662 0,0,0,0,
663 {
664 {
665 SOUND_YM2203,
666 &ym2203_interface
667 },
668 {
669 SOUND_YM3526,
670 &ym3526_interface
671 }
672 }
673 };
674
675 /******************************************************************************/
676
677 ROM_START( karnov )
678 ROM_REGION( 0x60000, REGION_CPU1 ) /* 6*64k for 68000 code */
679 ROM_LOAD_EVEN( "dn08-5", 0x00000, 0x10000, 0xdb92c264 )
680 ROM_LOAD_ODD ( "dn11-5", 0x00000, 0x10000, 0x05669b4b )
681 ROM_LOAD_EVEN( "dn07-", 0x20000, 0x10000, 0xfc14291b )
682 ROM_LOAD_ODD ( "dn10-", 0x20000, 0x10000, 0xa4a34e37 )
683 ROM_LOAD_EVEN( "dn06-5", 0x40000, 0x10000, 0x29d64e42 )
684 ROM_LOAD_ODD ( "dn09-5", 0x40000, 0x10000, 0x072d7c49 )
685
686 ROM_REGION( 0x10000, REGION_CPU2 ) /* 6502 Sound CPU */
687 ROM_LOAD( "dn05-5", 0x8000, 0x8000, 0xfa1a31a8 )
688
689 ROM_REGION( 0x08000, REGION_GFX1 | REGIONFLAG_DISPOSE )
690 ROM_LOAD( "dn00-", 0x00000, 0x08000, 0x0ed77c6d ) /* Characters */
691
692 ROM_REGION( 0x40000, REGION_GFX2 | REGIONFLAG_DISPOSE )
693 ROM_LOAD( "dn04-", 0x00000, 0x10000, 0xa9121653 ) /* Backgrounds */
694 ROM_LOAD( "dn01-", 0x10000, 0x10000, 0x18697c9e )
695 ROM_LOAD( "dn03-", 0x20000, 0x10000, 0x90d9dd9c )
696 ROM_LOAD( "dn02-", 0x30000, 0x10000, 0x1e04d7b9 )
697
698 ROM_REGION( 0x80000, REGION_GFX3 | REGIONFLAG_DISPOSE )
699 ROM_LOAD( "dn12-", 0x00000, 0x10000, 0x9806772c ) /* Sprites - 2 sets of 4, interleaved here */
700 ROM_LOAD( "dn14-5", 0x10000, 0x08000, 0xac9e6732 )
701 ROM_LOAD( "dn13-", 0x20000, 0x10000, 0xa03308f9 )
702 ROM_LOAD( "dn15-5", 0x30000, 0x08000, 0x8933fcb8 )
703 ROM_LOAD( "dn16-", 0x40000, 0x10000, 0x55e63a11 )
704 ROM_LOAD( "dn17-5", 0x50000, 0x08000, 0xb70ae950 )
705 ROM_LOAD( "dn18-", 0x60000, 0x10000, 0x2ad53213 )
706 ROM_LOAD( "dn19-5", 0x70000, 0x08000, 0x8fd4fa40 )
707
708 ROM_REGION( 0x0800, REGION_PROMS )
709 ROM_LOAD( "karnprom.21", 0x0000, 0x0400, 0xaab0bb93 )
710 ROM_LOAD( "karnprom.20", 0x0400, 0x0400, 0x02f78ffb )
711 ROM_END
712
ROM_START(karnovj)713 ROM_START( karnovj )
714 ROM_REGION( 0x60000, REGION_CPU1 ) /* 6*64k for 68000 code */
715 ROM_LOAD_EVEN( "kar8", 0x00000, 0x10000, 0x3e17e268 )
716 ROM_LOAD_ODD ( "kar11", 0x00000, 0x10000, 0x417c936d )
717 ROM_LOAD_EVEN( "dn07-", 0x20000, 0x10000, 0xfc14291b )
718 ROM_LOAD_ODD ( "dn10-", 0x20000, 0x10000, 0xa4a34e37 )
719 ROM_LOAD_EVEN( "kar6", 0x40000, 0x10000, 0xc641e195 )
720 ROM_LOAD_ODD ( "kar9", 0x40000, 0x10000, 0xd420658d )
721
722 ROM_REGION( 0x10000, REGION_CPU2 ) /* 6502 Sound CPU */
723 ROM_LOAD( "kar5", 0x8000, 0x8000, 0x7c9158f1 )
724
725 ROM_REGION( 0x08000, REGION_GFX1 | REGIONFLAG_DISPOSE )
726 ROM_LOAD( "dn00-", 0x00000, 0x08000, 0x0ed77c6d ) /* Characters */
727
728 ROM_REGION( 0x40000, REGION_GFX2 | REGIONFLAG_DISPOSE )
729 ROM_LOAD( "dn04-", 0x00000, 0x10000, 0xa9121653 ) /* Backgrounds */
730 ROM_LOAD( "dn01-", 0x10000, 0x10000, 0x18697c9e )
731 ROM_LOAD( "dn03-", 0x20000, 0x10000, 0x90d9dd9c )
732 ROM_LOAD( "dn02-", 0x30000, 0x10000, 0x1e04d7b9 )
733
734 ROM_REGION( 0x80000, REGION_GFX3 | REGIONFLAG_DISPOSE )
735 ROM_LOAD( "dn12-", 0x00000, 0x10000, 0x9806772c ) /* Sprites - 2 sets of 4, interleaved here */
736 ROM_LOAD( "kar14", 0x10000, 0x08000, 0xc6b39595 )
737 ROM_LOAD( "dn13-", 0x20000, 0x10000, 0xa03308f9 )
738 ROM_LOAD( "kar15", 0x30000, 0x08000, 0x2f72cac0 )
739 ROM_LOAD( "dn16-", 0x40000, 0x10000, 0x55e63a11 )
740 ROM_LOAD( "kar17", 0x50000, 0x08000, 0x7851c70f )
741 ROM_LOAD( "dn18-", 0x60000, 0x10000, 0x2ad53213 )
742 ROM_LOAD( "kar19", 0x70000, 0x08000, 0x7bc174bb )
743
744 ROM_REGION( 0x0800, REGION_PROMS )
745 ROM_LOAD( "karnprom.21", 0x0000, 0x0400, 0xaab0bb93 )
746 ROM_LOAD( "karnprom.20", 0x0400, 0x0400, 0x02f78ffb )
747 ROM_END
748
749 ROM_START( wndrplnt )
750 ROM_REGION( 0x60000, REGION_CPU1 ) /* 6*64k for 68000 code */
751 ROM_LOAD_EVEN( "ea08.bin", 0x00000, 0x10000, 0xb0578a14 )
752 ROM_LOAD_ODD ( "ea11.bin", 0x00000, 0x10000, 0x271edc6c )
753 ROM_LOAD_EVEN( "ea07.bin", 0x20000, 0x10000, 0x7095a7d5 )
754 ROM_LOAD_ODD ( "ea10.bin", 0x20000, 0x10000, 0x81a96475 )
755 ROM_LOAD_EVEN( "ea06.bin", 0x40000, 0x10000, 0x5951add3 )
756 ROM_LOAD_ODD ( "ea09.bin", 0x40000, 0x10000, 0xc4b3cb1e )
757
758 ROM_REGION( 0x10000, REGION_CPU2 ) /* 6502 Sound CPU */
759 ROM_LOAD( "ea05.bin", 0x8000, 0x8000, 0x8dbb6231 )
760
761 ROM_REGION( 0x08000, REGION_GFX1 | REGIONFLAG_DISPOSE )
762 ROM_LOAD( "ea00.bin", 0x00000, 0x08000, 0x9f3cac4c ) /* Characters */
763
764 ROM_REGION( 0x40000, REGION_GFX2 | REGIONFLAG_DISPOSE )
765 ROM_LOAD( "ea04.bin", 0x00000, 0x10000, 0x7d701344 ) /* Backgrounds */
766 ROM_LOAD( "ea01.bin", 0x10000, 0x10000, 0x18df55fb )
767 ROM_LOAD( "ea03.bin", 0x20000, 0x10000, 0x922ef050 )
768 ROM_LOAD( "ea02.bin", 0x30000, 0x10000, 0x700fde70 )
769
770 ROM_REGION( 0x80000, REGION_GFX3 | REGIONFLAG_DISPOSE )
771 ROM_LOAD( "ea12.bin", 0x00000, 0x10000, 0xa6d4e99d ) /* Sprites - 2 sets of 4, interleaved here */
772 ROM_LOAD( "ea14.bin", 0x10000, 0x10000, 0x915ffdc9 )
773 ROM_LOAD( "ea13.bin", 0x20000, 0x10000, 0xcd839f3a )
774 ROM_LOAD( "ea15.bin", 0x30000, 0x10000, 0xa1f14f16 )
775 ROM_LOAD( "ea16.bin", 0x40000, 0x10000, 0x7a1d8a9c )
776 ROM_LOAD( "ea17.bin", 0x50000, 0x10000, 0x21a3223d )
777 ROM_LOAD( "ea18.bin", 0x60000, 0x10000, 0x3fb2cec7 )
778 ROM_LOAD( "ea19.bin", 0x70000, 0x10000, 0x87cf03b5 )
779
780 ROM_REGION( 0x0800, REGION_PROMS )
781 ROM_LOAD( "ea21.prm", 0x0000, 0x0400, 0xc8beab49 )
782 ROM_LOAD( "ea20.prm", 0x0400, 0x0400, 0x619f9d1e )
783 ROM_END
784
785 ROM_START( chelnov )
786 ROM_REGION( 0x60000, REGION_CPU1 ) /* 6*64k for 68000 code */
787 ROM_LOAD_EVEN( "ee08-a.j15", 0x00000, 0x10000, 0x2f2fb37b )
788 ROM_LOAD_ODD ( "ee11-a.j20", 0x00000, 0x10000, 0xf306d05f )
789 ROM_LOAD_EVEN( "ee07-a.j14", 0x20000, 0x10000, 0x9c69ed56 )
790 ROM_LOAD_ODD ( "ee10-a.j18", 0x20000, 0x10000, 0xd5c5fe4b )
791 ROM_LOAD_EVEN( "ee06-e.j13", 0x40000, 0x10000, 0x55acafdb )
792 ROM_LOAD_ODD ( "ee09-e.j17", 0x40000, 0x10000, 0x303e252c )
793
794 ROM_REGION( 0x10000, REGION_CPU2 ) /* 6502 Sound CPU */
795 ROM_LOAD( "ee05-.f3", 0x8000, 0x8000, 0x6a8936b4 )
796
797 ROM_REGION( 0x08000, REGION_GFX1 | REGIONFLAG_DISPOSE )
798 ROM_LOAD( "ee00-e.c5", 0x00000, 0x08000, 0xe06e5c6b ) /* Characters */
799
800 ROM_REGION( 0x40000, REGION_GFX2 | REGIONFLAG_DISPOSE )
801 ROM_LOAD( "ee04-.d18", 0x00000, 0x10000, 0x96884f95 ) /* Backgrounds */
802 ROM_LOAD( "ee01-.c15", 0x10000, 0x10000, 0xf4b54057 )
803 ROM_LOAD( "ee03-.d15", 0x20000, 0x10000, 0x7178e182 )
804 ROM_LOAD( "ee02-.c18", 0x30000, 0x10000, 0x9d7c45ae )
805
806 ROM_REGION( 0x80000, REGION_GFX3 | REGIONFLAG_DISPOSE )
807 ROM_LOAD( "ee12-.f8", 0x00000, 0x10000, 0x9b1c53a5 ) /* Sprites */
808 ROM_LOAD( "ee13-.f9", 0x20000, 0x10000, 0x72b8ae3e )
809 ROM_LOAD( "ee14-.f13", 0x40000, 0x10000, 0xd8f4bbde )
810 ROM_LOAD( "ee15-.f15", 0x60000, 0x10000, 0x81e3e68b )
811
812 ROM_REGION( 0x0800, REGION_PROMS )
813 ROM_LOAD( "ee21.k8", 0x0000, 0x0400, 0xb1db6586 ) /* different from the other set; */
814 /* might be bad */
815 ROM_LOAD( "ee20.l6", 0x0400, 0x0400, 0x41816132 )
816 ROM_END
817
818 ROM_START( chelnovj )
819 ROM_REGION( 0x60000, REGION_CPU1 ) /* 6*64k for 68000 code */
820 ROM_LOAD_EVEN( "a-j15.bin", 0x00000, 0x10000, 0x1978cb52 )
821 ROM_LOAD_ODD ( "a-j20.bin", 0x00000, 0x10000, 0xe0ed3d99 )
822 ROM_LOAD_EVEN( "a-j14.bin", 0x20000, 0x10000, 0x51465486 )
823 ROM_LOAD_ODD ( "a-j18.bin", 0x20000, 0x10000, 0xd09dda33 )
824 ROM_LOAD_EVEN( "a-j13.bin", 0x40000, 0x10000, 0xcd991507 )
825 ROM_LOAD_ODD ( "a-j17.bin", 0x40000, 0x10000, 0x977f601c )
826
827 ROM_REGION( 0x10000, REGION_CPU2 ) /* 6502 Sound CPU */
828 ROM_LOAD( "ee05-.f3", 0x8000, 0x8000, 0x6a8936b4 )
829
830 ROM_REGION( 0x08000, REGION_GFX1 | REGIONFLAG_DISPOSE )
831 ROM_LOAD( "a-c5.bin", 0x00000, 0x08000, 0x1abf2c6d ) /* Characters */
832
833 ROM_REGION( 0x40000, REGION_GFX2 | REGIONFLAG_DISPOSE )
834 ROM_LOAD( "ee04-.d18", 0x00000, 0x10000, 0x96884f95 ) /* Backgrounds */
835 ROM_LOAD( "ee01-.c15", 0x10000, 0x10000, 0xf4b54057 )
836 ROM_LOAD( "ee03-.d15", 0x20000, 0x10000, 0x7178e182 )
837 ROM_LOAD( "ee02-.c18", 0x30000, 0x10000, 0x9d7c45ae )
838
839 ROM_REGION( 0x80000, REGION_GFX3 | REGIONFLAG_DISPOSE )
840 ROM_LOAD( "ee12-.f8", 0x00000, 0x10000, 0x9b1c53a5 ) /* Sprites */
841 ROM_LOAD( "ee13-.f9", 0x20000, 0x10000, 0x72b8ae3e )
842 ROM_LOAD( "ee14-.f13", 0x40000, 0x10000, 0xd8f4bbde )
843 ROM_LOAD( "ee15-.f15", 0x60000, 0x10000, 0x81e3e68b )
844
845 ROM_REGION( 0x0800, REGION_PROMS )
846 ROM_LOAD( "a-k7.bin", 0x0000, 0x0400, 0x309c49d8 ) /* different from the other set; */
847 /* might be bad */
848 ROM_LOAD( "ee20.l6", 0x0400, 0x0400, 0x41816132 )
849 ROM_END
850
851 /******************************************************************************/
852
853 static READ_HANDLER( karnov_cycle_r )
854 {
855 if (cpu_get_pc()==0x8f2 && (READ_WORD(&karnov_ram[0])&0xff00)!=0) {cpu_spinuntil_int(); return 0;} return READ_WORD(&karnov_ram[0]);
856 }
857
READ_HANDLER(karnovj_cycle_r)858 static READ_HANDLER( karnovj_cycle_r )
859 {
860 if (cpu_get_pc()==0x8ec && (READ_WORD(&karnov_ram[0])&0xff00)!=0) {cpu_spinuntil_int(); return 0;} return READ_WORD(&karnov_ram[0]);
861 }
862
READ_HANDLER(chelnov_cycle_r)863 static READ_HANDLER( chelnov_cycle_r )
864 {
865 if (cpu_get_pc()==0xdfe && (READ_WORD(&karnov_ram[0])&0xff00)!=0) {cpu_spinuntil_int(); return 0;} return READ_WORD(&karnov_ram[0]);
866 }
867
READ_HANDLER(chelnovj_cycle_r)868 static READ_HANDLER( chelnovj_cycle_r )
869 {
870 if (cpu_get_pc()==0xe06 && (READ_WORD(&karnov_ram[0])&0xff00)!=0) {cpu_spinuntil_int(); return 0;} return READ_WORD(&karnov_ram[0]);
871 }
872
init_karnov(void)873 static void init_karnov(void)
874 {
875 if (!strcmp(Machine->gamedrv->name,"karnov")) {
876 install_mem_read_handler(0, 0x60000, 0x60001, karnov_cycle_r);
877 KARNOV=1;
878 CHELNOV=WNDRPLNT=0;
879 }
880
881 if (!strcmp(Machine->gamedrv->name,"karnovj")) {
882 install_mem_read_handler(0, 0x60000, 0x60001, karnovj_cycle_r);
883 KARNOV=2;
884 CHELNOV=WNDRPLNT=0;
885 }
886
887 if (!strcmp(Machine->gamedrv->name,"wndrplnt")) {
888 // install_mem_read_handler(0, 0x60000, 0x60001, karnovj_cycle_r);
889 KARNOV=CHELNOV=0;
890 WNDRPLNT=1;
891 }
892
893 if (!strcmp(Machine->gamedrv->name,"chelnov")) {
894 install_mem_read_handler(0, 0x60000, 0x60001, chelnov_cycle_r);
895 KARNOV=WNDRPLNT=0;
896 CHELNOV=1;
897 }
898
899 if (!strcmp(Machine->gamedrv->name,"chelnovj")) {
900 install_mem_read_handler(0, 0x60000, 0x60001, chelnovj_cycle_r);
901 KARNOV=WNDRPLNT=0;
902 CHELNOV=2;
903 }
904 }
905
init_wndrplnt(void)906 static void init_wndrplnt(void)
907 {
908 // unsigned char *RAM = memory_region(REGION_CPU1);
909
910 init_karnov();
911
912 // WRITE_WORD (&RAM[0x1106],0x4E71);
913 // WRITE_WORD (&RAM[0x110e],0x4E71);
914 // WRITE_WORD (&RAM[0xc0c],0x4E71);
915 // WRITE_WORD (&RAM[0xc0e],0x4E71);
916 // WRITE_WORD (&RAM[0xc4c],0x4E71);
917 // WRITE_WORD (&RAM[0xc0e],0x4E71);
918 //WRITE_WORD (&RAM[0x5b0a],0x4E71);
919 //WRITE_WORD (&RAM[0x5b0c],0x4E71);
920 //WRITE_WORD (&RAM[0x5b0e],0x4E71);
921 //WRITE_WORD (&RAM[0x5b1e],0x4E71);
922 //WRITE_WORD (&RAM[0xd58],0x4E71);
923 }
924
init_chelnov(void)925 static void init_chelnov(void)
926 {
927 unsigned char *RAM = memory_region(REGION_CPU1);
928
929 init_karnov();
930
931 WRITE_WORD (&RAM[0x0A26],0x4E71); /* removes a protection lookup table */
932 WRITE_WORD (&RAM[0x062a],0x4E71); /* hangs waiting on i8751 int */
933 }
934
init_chelnovj(void)935 static void init_chelnovj(void)
936 {
937 unsigned char *RAM = memory_region(REGION_CPU1);
938
939 init_karnov();
940
941 WRITE_WORD (&RAM[0x0A2E],0x4E71); /* removes a protection lookup table */
942 WRITE_WORD (&RAM[0x062a],0x4E71); /* hangs waiting on i8751 int */
943 }
944
945 /******************************************************************************/
946
947 GAMEX( 1987, karnov, 0, karnov, karnov, karnov, ROT0, "Data East USA", "Karnov (US)", GAME_NO_COCKTAIL )
948 GAMEX( 1987, karnovj, karnov, karnov, karnov, karnov, ROT0, "Data East Corporation", "Karnov (Japan)", GAME_NO_COCKTAIL )
949 GAMEX( 1987, wndrplnt, 0, wndrplnt, karnov, wndrplnt, ROT270, "Data East Corporation", "Wonder Planet (Japan)", GAME_NOT_WORKING | GAME_NO_COCKTAIL )
950 GAMEX( 1988, chelnov, 0, karnov, chelnov, chelnov, ROT0, "Data East USA", "Chelnov - Atomic Runner (US)", GAME_NO_COCKTAIL )
951 GAMEX( 1988, chelnovj, chelnov, karnov, chelnov, chelnovj, ROT0, "Data East Corporation", "Chelnov - Atomic Runner (Japan)", GAME_NO_COCKTAIL )
952