Previous 15994 Revisions Next

r1595 Friday 25th January, 2008 at 16:57:14 UTC by Dirk Best
Removed some files deleted in the 0.122u7 update
[src/mame/drivers]mnight.c ninjakid.c omegaf.c
[src/mame/includes]berzerk.h
[src/mame/video]mnight.c ninjakid.c omegaf.c

src/mame/includes/berzerk.h
r1594r1595
1/***************************************************************************
2
3    Berzerk hardware
4
5***************************************************************************/
6
7
8#define BERZERK_MASTER_CLOCK   (XTAL_10MHz)
src/mame/video/omegaf.c
r1594r1595
1/***************************************************************************
2
3Functions to emulate the video hardware of the machine.
4
5This hardware of the machine is similar with that of Mutant Night.
6The difference between the two machines is that there are three BG
7layers as against just one BG layer in Mutant Night.
8
9
10Foreground RAM format ( Foreground RAM format is same as Mutant Night )
11--------------------------------------------------------------
12 +0         +1
13 xxxx xxxx  ---- ----       = bottom 8 bits of tile number
14 ---- ----  xx-- ----       = top 2 bits of tile number
15 ---- ----  --x- ----       = flip X
16 ---- ----  ---x ----       = flip Y
17 ---- ----  ---- xxxx       = color ( 00h - 0fh )
18
19
20Background RAM format
21--------------------------------------------------------------
22 +0         +1
23 xxxx xxxx  ---- ----       = bottom 8 bits of tile number
24 ---- ----  x--- ----       = bit 9 of tile number
25 ---- ----  -x-- ----       = bit 8 of tile number
26 ---- ----  --x- ----       = bit 10 of tile number
27 ---- ----  ---x ----       = bit 11 of tile number (the most top bit)
28 ---- ----  ---- xxxx       = color ( 00h - 1fh )
29
30
31Sprite RAM format   ( Sprite format is same as Mutant Night )
32--------------------------------------------------------------
33 +0         +1         +2         +3         +4
34 xxxx xxxx  ---- ----  ---- ----  ---- ----  ---- ----  = sprite Y position
35 ---- ----  xxxx xxxx  ---- ----  ---- ----  ---- ----  = bottom 8 bits of sprite X position
36 ---- ----  ---- ----  xx-- ----  ---- ----  ---- ----  = middle 2 bits of sprite number
37 ---- ----  ---- ----  --x- ----  ---- ----  ---- ----  = flip X
38 ---- ----  ---- ----  ---x ----  ---- ----  ---- ----  = flip Y
39 ---- ----  ---- ----  ---- x---  ---- ----  ---- ----  = top bit of sprite number
40 ---- ----  ---- ----  ---- -x--  ---- ----  ---- ----  = 0:normal size (16x16)  1:big size (32x32)
41 ---- ----  ---- ----  ---- --x-  ---- ----  ---- ----  = sprite on / off
42 ---- ----  ---- ----  ---- ---x  ---- ----  ---- ----  = top bit of sprite X position
43 ---- ----  ---- ----  ---- ----  xxxx xxxx  ---- ----  = bottom 8 bits of sprite number
44 ---- ----  ---- ----  ---- ----  ---- ----  xxxx xxxx  = color
45
46
47Scroll RAM format (Omega Fighter)
48--------------------------------------------------------------
49    +0         +1
50 X  ???? -xxx  xxxx xxxx        = scroll X (0 - 0x3ff)
51 Y  ???? ---x  xxxx xxxx        = scroll Y (0 - 0x1ff)
52
53Scroll RAM format (Atomic Robokid)
54--------------------------------------------------------------
55    +0         +1
56 X  ???? ---x  xxxx xxxx        = scroll X (0 - 0x1ff)
57 Y  ???? ---x  xxxx xxxx        = scroll Y (0 - 0x1ff)
58
59
60Real screen resolution and virtual one
61--------------------------------------------------------------
62                Real        Virtual
63Omega Fighter   256x192(H)  2048x512
64Atomic Robokid  256x192(H)  512x512
65
66
67***************************************************************************/
68
69#include "driver.h"
70
71
72
73/**************************************************************************
74  Variables
75**************************************************************************/
76
77UINT8 *omegaf_fg_videoram;
78static UINT8 *omegaf_bg0_videoram;
79static UINT8 *omegaf_bg1_videoram;
80static UINT8 *omegaf_bg2_videoram;
81//size_t omegaf_fgvideoram_size;
82
83static int omegaf_bg0_bank = 0;
84static int omegaf_bg1_bank = 0;
85static int omegaf_bg2_bank = 0;
86
87UINT8 *omegaf_bg0_scroll_x;
88UINT8 *omegaf_bg1_scroll_x;
89UINT8 *omegaf_bg2_scroll_x;
90UINT8 *omegaf_bg0_scroll_y;
91UINT8 *omegaf_bg1_scroll_y;
92UINT8 *omegaf_bg2_scroll_y;
93
94static tilemap *fg_tilemap;
95static tilemap *bg0_tilemap;
96static tilemap *bg1_tilemap;
97static tilemap *bg2_tilemap;
98
99static int bg0_enabled = 1;
100static int bg1_enabled = 1;
101static int bg2_enabled = 1;
102
103static mame_bitmap *bitmap_sp;   /* for sprite overdraw */
104static int sprite_overdraw_enabled = 0;
105
106static int scrollx_mask = 0x07ff;
107static int bank_mask = 1;
108
109
110/***************************************************************************
111  Callbacks for the tilemap code
112***************************************************************************/
113
114static TILE_GET_INFO( get_bg0_tile_info )
115{
116   int color, tile, hi, lo;
117
118   int attrib = ( (tile_index & 0x00f) | ( (tile_index & 0x070) << 5 ) |
119                                         ( (tile_index & 0xf80) >> 3 ) ) << 1;
120   lo  = omegaf_bg0_videoram[ attrib ];
121   hi  = omegaf_bg0_videoram[ attrib | 1 ];
122   color = hi & 0x0f;
123   tile = ( ((hi & 0x80) << 2) | ((hi & 0x40) << 2) |
124            ((hi & 0x20) << 5) | ((hi & 0x10) << 7) ) | lo;
125   SET_TILE_INFO(
126         0,
127         tile,
128         color,
129         0);
130   tileinfo->category = 0;
131}
132
133static TILE_GET_INFO( get_bg1_tile_info )
134{
135   int color, tile, hi, lo;
136
137   int attrib = ( (tile_index & 0x00f) | ( (tile_index & 0x070) << 5 ) |
138                                         ( (tile_index & 0xf80) >> 3 ) ) << 1;
139   lo  = omegaf_bg1_videoram[ attrib ];
140   hi  = omegaf_bg1_videoram[ attrib | 1 ];
141   color = hi & 0x0f;
142   tile = ( ((hi & 0x80) << 2) | ((hi & 0x40) << 2) |
143            ((hi & 0x20) << 5) | ((hi & 0x10) << 7) ) | lo;
144   SET_TILE_INFO(
145         1,
146         tile,
147         color,
148         0);
149   tileinfo->category = 0;
150}
151
152static TILE_GET_INFO( get_bg2_tile_info )
153{
154   int color, tile, hi, lo;
155
156   int attrib = ( (tile_index & 0x00f) | ( (tile_index & 0x070) << 5 ) |
157                                         ( (tile_index & 0xf80) >> 3 ) ) << 1;
158   lo  = omegaf_bg2_videoram[ attrib ];
159   hi  = omegaf_bg2_videoram[ attrib | 1 ];
160   color = hi & 0x0f;
161   tile = ( ((hi & 0x80) << 2) | ((hi & 0x40) << 2) |
162            ((hi & 0x20) << 5) | ((hi & 0x10) << 7) ) | lo;
163   SET_TILE_INFO(
164         2,
165         tile,
166         color,
167         0);
168   tileinfo->category = 0;
169}
170
171static TILE_GET_INFO( robokid_get_bg0_tile_info )
172{
173   int color, tile, hi, lo;
174
175   int attrib = ( (tile_index & 0x00f) | ( (tile_index & 0x010) << 5 ) |
176                                         ( (tile_index & 0x3e0) >> 1 ) ) << 1;
177   lo  = omegaf_bg0_videoram[ attrib ];
178   hi  = omegaf_bg0_videoram[ attrib | 1 ];
179   color = hi & 0x0f;
180   tile = ( ((hi & 0x80) << 2) | ((hi & 0x40) << 2) |
181            ((hi & 0x20) << 5) | ((hi & 0x10) << 7) ) | lo;
182   SET_TILE_INFO(
183         0,
184         tile,
185         color,
186         0);
187   tileinfo->category = 0;
188}
189
190static TILE_GET_INFO( robokid_get_bg1_tile_info )
191{
192   int color, tile, hi, lo;
193
194   int attrib = ( (tile_index & 0x00f) | ( (tile_index & 0x010) << 5 ) |
195                                         ( (tile_index & 0x3e0) >> 1 ) ) << 1;
196   lo  = omegaf_bg1_videoram[ attrib ];
197   hi  = omegaf_bg1_videoram[ attrib | 1 ];
198   color = hi & 0x0f;
199   tile = ( ((hi & 0x80) << 2) | ((hi & 0x40) << 2) |
200            ((hi & 0x20) << 5) | ((hi & 0x10) << 7) ) | lo;
201   SET_TILE_INFO(
202         1,
203         tile,
204         color,
205         0);
206   tileinfo->category = 0;
207}
208
209static TILE_GET_INFO( robokid_get_bg2_tile_info )
210{
211   int color, tile, hi, lo;
212
213   int attrib = ( (tile_index & 0x00f) | ( (tile_index & 0x010) << 5 ) |
214                                         ( (tile_index & 0x3e0) >> 1 ) ) << 1;
215   lo  = omegaf_bg2_videoram[ attrib ];
216   hi  = omegaf_bg2_videoram[ attrib | 1 ];
217   color = hi & 0x0f;
218   tile = ( ((hi & 0x80) << 2) | ((hi & 0x40) << 2) |
219            ((hi & 0x20) << 5) | ((hi & 0x10) << 7) ) | lo;
220   SET_TILE_INFO(
221         2,
222         tile,
223         color,
224         0);
225   tileinfo->category = 0;
226}
227
228static TILE_GET_INFO( get_fg_tile_info )
229{
230   int color, tile, hi, lo;
231
232   lo  = omegaf_fg_videoram[ tile_index << 1 ];
233   hi = omegaf_fg_videoram[ (tile_index << 1) + 1 ];
234   color  = hi & 0x0f;
235   tile = ( ((hi & 0x80) << 2) | ((hi & 0x40) << 2) |
236            ((hi & 0x20) << 5) | ((hi & 0x10) << 7) ) | lo;
237   SET_TILE_INFO(
238         5,
239         tile,
240         color,
241         0);
242   tileinfo->category = 0;
243}
244
245
246/***************************************************************************
247  Initialize and destroy video hardware emulation
248***************************************************************************/
249
250static void videoram_alloc(running_machine *machine, int size)
251{
252   /* create video ram */
253   omegaf_bg0_videoram = auto_malloc(size);
254   memset( omegaf_bg0_videoram, 0x00, size );
255
256   omegaf_bg1_videoram = auto_malloc(size);
257   memset( omegaf_bg1_videoram, 0x00, size );
258
259   omegaf_bg2_videoram = auto_malloc(size);
260   memset( omegaf_bg2_videoram, 0x00, size );
261
262   bitmap_sp = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format);
263}
264
265VIDEO_START( omegaf )
266{
267   scrollx_mask = 0x07ff;
268   bank_mask = 7;
269
270   videoram_alloc(machine, 0x2000);
271
272   /*                           Info               Offset             Type                 w   h  col  row */
273   fg_tilemap  = tilemap_create(get_fg_tile_info,  tilemap_scan_rows, TILEMAP_TYPE_PEN, 8,  8,  32, 32);
274   bg0_tilemap = tilemap_create(get_bg0_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 16, 16, 128, 32);
275   bg1_tilemap = tilemap_create(get_bg1_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 16, 16, 128, 32);
276   bg2_tilemap = tilemap_create(get_bg2_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 16, 16, 128, 32);
277
278   tilemap_set_transparent_pen( fg_tilemap,  15 );
279   tilemap_set_transparent_pen( bg0_tilemap, 15 );
280   tilemap_set_transparent_pen( bg1_tilemap, 15 );
281   tilemap_set_transparent_pen( bg2_tilemap, 15 );
282}
283
284VIDEO_START( robokid )
285{
286   scrollx_mask = 0x01ff;
287   bank_mask = 1;
288
289   videoram_alloc(machine, 0x0800);
290
291   /*                           Info               Offset             Type                         w   h  col  row */
292   fg_tilemap  = tilemap_create(        get_fg_tile_info,  tilemap_scan_rows, TILEMAP_TYPE_PEN, 8,  8,  32, 32);
293   bg0_tilemap = tilemap_create(robokid_get_bg0_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN,      16, 16, 32, 32);
294   bg1_tilemap = tilemap_create(robokid_get_bg1_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 16, 16, 32, 32);
295   bg2_tilemap = tilemap_create(robokid_get_bg2_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 16, 16, 32, 32);
296
297   tilemap_set_transparent_pen( fg_tilemap,  15 );
298   tilemap_set_transparent_pen( bg1_tilemap, 15 );
299   tilemap_set_transparent_pen( bg2_tilemap, 15 );
300}
301
302
303/***************************************************************************
304  Memory handler
305***************************************************************************/
306
307WRITE8_HANDLER( omegaf_bg0_bank_w )
308{
309   omegaf_bg0_bank = data & bank_mask;
310}
311
312WRITE8_HANDLER( omegaf_bg1_bank_w )
313{
314   omegaf_bg1_bank = data & bank_mask;
315}
316
317WRITE8_HANDLER( omegaf_bg2_bank_w )
318{
319   omegaf_bg2_bank = data & bank_mask;
320}
321
322READ8_HANDLER( omegaf_bg0_videoram_r )
323{
324   return omegaf_bg0_videoram[ (omegaf_bg0_bank << 10) | offset ];
325}
326
327READ8_HANDLER( omegaf_bg1_videoram_r )
328{
329   return omegaf_bg1_videoram[ (omegaf_bg1_bank << 10) | offset ];
330}
331
332READ8_HANDLER( omegaf_bg2_videoram_r )
333{
334   return omegaf_bg2_videoram[ (omegaf_bg2_bank << 10) | offset ];
335}
336
337WRITE8_HANDLER( omegaf_bg0_videoram_w )
338{
339   int address;
340   int tile_index;
341
342   address = (omegaf_bg0_bank << 10 ) | offset;
343   omegaf_bg0_videoram[ address ] = data;
344   tile_index = ( (address & 0x001e) >> 1 ) | ( (address & 0x1c00) >> 6 ) |
345                ( (address & 0x03e0) << 2 );
346   tilemap_mark_tile_dirty( bg0_tilemap, tile_index );
347}
348
349WRITE8_HANDLER( omegaf_bg1_videoram_w )
350{
351   int address;
352   int tile_index;
353
354   address = (omegaf_bg1_bank << 10 ) | offset;
355   omegaf_bg1_videoram[ address ] = data;
356   tile_index = ( (address & 0x001e) >> 1 ) | ( (address & 0x1c00) >> 6 ) |
357                ( (address & 0x03e0) << 2 );
358   tilemap_mark_tile_dirty( bg1_tilemap, tile_index );
359}
360
361WRITE8_HANDLER( omegaf_bg2_videoram_w )
362{
363   int address;
364   int tile_index;
365
366   address = (omegaf_bg2_bank << 10 ) | offset;
367   omegaf_bg2_videoram[ address ] = data;
368   tile_index = ( (address & 0x001e) >> 1 ) | ( (address & 0x1c00) >> 6 ) |
369                ( (address & 0x03e0) << 2 );
370   tilemap_mark_tile_dirty( bg2_tilemap, tile_index );
371}
372
373WRITE8_HANDLER( robokid_bg0_videoram_w )
374{
375   int address;
376   int tile_index;
377
378   address = (omegaf_bg0_bank << 10 ) | offset;
379   omegaf_bg0_videoram[ address ] = data;
380   tile_index = ( (address & 0x001e) >> 1 ) | ( (address & 0x0400) >> 6 ) |
381                  (address & 0x03e0);
382   tilemap_mark_tile_dirty( bg0_tilemap, tile_index );
383}
384
385WRITE8_HANDLER( robokid_bg1_videoram_w )
386{
387   int address;
388   int tile_index;
389
390   address = (omegaf_bg1_bank << 10 ) | offset;
391   omegaf_bg1_videoram[ address ] = data;
392   tile_index = ( (address & 0x001e) >> 1 ) | ( (address & 0x0400) >> 6 ) |
393                  (address & 0x03e0);
394   tilemap_mark_tile_dirty( bg1_tilemap, tile_index );
395}
396
397WRITE8_HANDLER( robokid_bg2_videoram_w )
398{
399   int address;
400   int tile_index;
401
402   address = (omegaf_bg2_bank << 10 ) | offset;
403   omegaf_bg2_videoram[ address ] = data;
404   tile_index = ( (address & 0x001e) >> 1 ) | ( (address & 0x0400) >> 6 ) |
405                  (address & 0x03e0);
406   tilemap_mark_tile_dirty( bg2_tilemap, tile_index );
407}
408
409WRITE8_HANDLER( omegaf_bg0_scrollx_w )
410{
411   int scrollx;
412
413   omegaf_bg0_scroll_x[offset] = data;
414
415   scrollx = (omegaf_bg0_scroll_x[1] << 8) | omegaf_bg0_scroll_x[0];
416   scrollx &= scrollx_mask;
417   tilemap_set_scrollx( bg0_tilemap, 0, scrollx );
418}
419
420WRITE8_HANDLER( omegaf_bg0_scrolly_w )
421{
422   int scrolly;
423
424   omegaf_bg0_scroll_y[offset] = data;
425
426   scrolly = (omegaf_bg0_scroll_y[1] << 8) | omegaf_bg0_scroll_y[0];
427   scrolly &= 0x01ff;
428   tilemap_set_scrolly( bg0_tilemap, 0, scrolly );
429}
430
431WRITE8_HANDLER( omegaf_bg1_scrollx_w )
432{
433   int scrollx;
434
435   omegaf_bg1_scroll_x[offset] = data;
436
437   scrollx = (omegaf_bg1_scroll_x[1] << 8) | omegaf_bg1_scroll_x[0];
438   scrollx &= scrollx_mask;
439   tilemap_set_scrollx( bg1_tilemap, 0, scrollx );
440}
441
442WRITE8_HANDLER( omegaf_bg1_scrolly_w )
443{
444   int scrolly;
445
446   omegaf_bg1_scroll_y[offset] = data;
447
448   scrolly = (omegaf_bg1_scroll_y[1] << 8) | omegaf_bg1_scroll_y[0];
449   scrolly &= 0x01ff;
450   tilemap_set_scrolly( bg1_tilemap, 0, scrolly );
451}
452
453WRITE8_HANDLER( omegaf_bg2_scrollx_w )
454{
455   int scrollx;
456
457   omegaf_bg2_scroll_x[offset] = data;
458
459   scrollx = (omegaf_bg2_scroll_x[1] << 8) | omegaf_bg2_scroll_x[0];
460   scrollx &= scrollx_mask;
461   tilemap_set_scrollx( bg2_tilemap, 0, scrollx );
462}
463
464WRITE8_HANDLER( omegaf_bg2_scrolly_w )
465{
466   int scrolly;
467
468   omegaf_bg2_scroll_y[offset] = data;
469
470   scrolly = (omegaf_bg2_scroll_y[1] << 8) | omegaf_bg2_scroll_y[0];
471   scrolly &= 0x01ff;
472   tilemap_set_scrolly( bg2_tilemap, 0, scrolly );
473}
474
475WRITE8_HANDLER( omegaf_fgvideoram_w )
476{
477   omegaf_fg_videoram[offset] = data;
478   tilemap_mark_tile_dirty(fg_tilemap, offset >> 1);
479}
480
481WRITE8_HANDLER( omegaf_bg0_enabled_w )
482{
483   if (bg0_enabled != data)
484      bg0_enabled = data;
485}
486
487WRITE8_HANDLER( omegaf_bg1_enabled_w )
488{
489   if (bg1_enabled != data)
490      bg1_enabled = data;
491}
492
493WRITE8_HANDLER( omegaf_bg2_enabled_w )
494{
495   if (bg2_enabled != data)
496      bg2_enabled = data;
497}
498
499WRITE8_HANDLER( omegaf_sprite_overdraw_w )
500{
501   logerror( "sprite overdraw flag : %02x\n", data );
502   if (sprite_overdraw_enabled != (data & 1))
503   {
504      sprite_overdraw_enabled = data & 1;
505      fillbitmap(bitmap_sp, 15, &Machine->screen[0].visarea);
506   }
507}
508
509WRITE8_HANDLER( omegaf_flipscreen_w )
510{
511   flip_screen_set(data & 0x80);
512}
513
514/***************************************************************************
515  Screen refresh
516***************************************************************************/
517
518static void draw_sprites(running_machine *machine, mame_bitmap *bitmap,const rectangle *cliprect)
519{
520   int offs;
521
522   /* Draw the sprites */
523   for (offs = 11 ;offs < spriteram_size; offs += 16)
524   {
525      int sx, sy, tile, color, flipx, flipy, big;
526
527      if (spriteram[offs + 2] & 2)
528      {
529         sx = spriteram[offs + 1];
530         sy = spriteram[offs];
531         if (spriteram[offs + 2] & 1)
532            sx -= 256;
533         tile = spriteram[offs + 3] |
534               ((spriteram[offs + 2] & 0xc0) << 2) |
535               ((spriteram[offs + 2] & 0x08) << 7);
536
537         big  = spriteram[offs + 2] & 4;
538         if (big)
539            tile >>= 2;
540         flipx = spriteram[offs + 2] & 0x10;
541         flipy = spriteram[offs + 2] & 0x20;
542         color = spriteram[offs + 4] & 0x0f;
543
544         if(sprite_overdraw_enabled && (color & 8))
545         {
546            /* "static" sprites */
547            drawgfx(bitmap_sp,machine->gfx[(big) ? 4 : 3],
548                  tile,
549                  color,
550                  flipx,flipy,
551                  sx,sy,
552                  0,
553                  TRANSPARENCY_PEN, 15);
554         }
555         else
556         {
557            drawgfx(bitmap,machine->gfx[(big) ? 4 : 3],
558                  tile,
559                  color,
560                  flipx,flipy,
561                  sx,sy,
562                  cliprect,
563                  TRANSPARENCY_PEN, 15);
564
565            /* all the "normal" sprites clear the "static" ones */
566            if(sprite_overdraw_enabled)
567            {
568               int x,y,offset = 0;
569               const gfx_element *gfx = machine->gfx[(big) ? 4 : 3];
570               UINT8 *srcgfx = gfx->gfxdata + tile * gfx->char_modulo;
571
572               for(y = 0; y < gfx->height; y++)
573               {
574                  for(x = 0; x < gfx->width; x++)
575                  {
576                     if(srcgfx[offset] != 15)
577                     {
578                        *BITMAP_ADDR16(bitmap_sp, sy + y, sx + x) = 15;
579                     }
580
581                     offset++;
582                  }
583               }
584            }
585         }
586      }
587   }
588
589   if(sprite_overdraw_enabled)
590      copybitmap(bitmap, bitmap_sp, 0, 0, 0, 0, cliprect, TRANSPARENCY_PEN, 15);
591}
592
593VIDEO_UPDATE( omegaf )
594{
595   fillbitmap(bitmap,machine->pens[0],cliprect);
596
597   if (bg0_enabled)   tilemap_draw(bitmap,cliprect, bg0_tilemap, 0, 0);
598   if (bg1_enabled)   tilemap_draw(bitmap,cliprect, bg1_tilemap, 0, 0);
599   if (bg2_enabled)   tilemap_draw(bitmap,cliprect, bg2_tilemap, 0, 0);
600   draw_sprites(machine,bitmap,cliprect);
601   tilemap_draw(bitmap,cliprect, fg_tilemap, 0, 0);
602   return 0;
603}
604
605VIDEO_UPDATE( robokid )
606{
607   fillbitmap(bitmap,machine->pens[0],cliprect);
608
609   if (bg0_enabled)   tilemap_draw(bitmap,cliprect, bg0_tilemap, 0, 0);
610   if (bg1_enabled)   tilemap_draw(bitmap,cliprect, bg1_tilemap, 0, 0);
611   draw_sprites(machine,bitmap,cliprect);
612   if (bg2_enabled)   tilemap_draw(bitmap,cliprect, bg2_tilemap, 0, 0);
613   tilemap_draw(bitmap,cliprect, fg_tilemap, 0, 0);
614   return 0;
615}
src/mame/video/ninjakid.c
r1594r1595
1#include "driver.h"
2#include "sound/ay8910.h"
3
4static tilemap *bg_tilemap, *fg_tilemap;
5static UINT8 flipscreen;
6static UINT8 ninjakun_xscroll,ninjakun_yscroll;
7
8static UINT8 ninjakun_io_8000_ctrl[4];
9// static UINT8 old_scroll;
10
11/*******************************************************************************
12 Tilemap Callbacks
13*******************************************************************************/
14
15static TILE_GET_INFO( get_fg_tile_info ){
16   UINT32 tile_number = videoram[tile_index] & 0xFF;
17   UINT8 attr  = videoram[tile_index+0x400];
18   tile_number += (attr & 0x20) << 3; /* bank */
19   SET_TILE_INFO(
20         0,
21         tile_number,
22         (attr&0xf),
23         0);
24}
25
26static TILE_GET_INFO( get_bg_tile_info ){
27   UINT32 tile_number = videoram[tile_index+0x800] & 0xFF;
28   UINT8 attr  = videoram[tile_index+0xc00];
29   tile_number += (attr & 0xC0) << 2; /* bank */
30   SET_TILE_INFO(
31         1,
32         tile_number,
33         (attr&0xf),
34         0);
35}
36
37WRITE8_HANDLER( ninjakid_fg_videoram_w ){
38   videoram[offset] = data;
39   tilemap_mark_tile_dirty(fg_tilemap,offset&0x3ff);
40}
41
42WRITE8_HANDLER( ninjakid_bg_videoram_w ){
43
44   int y = (offset + ((ninjakun_yscroll & 0xf8) << 2) ) & 0x3e0;
45   int x = (offset + (ninjakun_xscroll >> 3) ) & 0x1f;
46   int offs = x+y+(offset & 0x400);
47
48   videoram[0x800+offs] = data;
49   tilemap_mark_tile_dirty(bg_tilemap,x+y);
50}
51
52READ8_HANDLER( ninjakid_bg_videoram_r )
53{
54   int y = (offset + ((ninjakun_yscroll & 0xf8) << 2) ) & 0x3e0;
55   int x = (offset + (ninjakun_xscroll >> 3) ) & 0x1f;
56   int offs = x+y+(offset & 0x400);
57
58   return videoram[0x800+offs];
59}
60
61/******************************************************************************/
62
63WRITE8_HANDLER( ninjakun_flipscreen_w ){
64   flipscreen = data?(TILEMAP_FLIPX|TILEMAP_FLIPY):0;
65   tilemap_set_flip( ALL_TILEMAPS,flipscreen );
66}
67
68READ8_HANDLER( ninjakun_io_8000_r ){
69   switch( offset ){
70   case 0: /* control */
71      return AY8910_read_port_0_r( 0 );
72
73   case 1: /* input read */
74      switch( ninjakun_io_8000_ctrl[0] ){
75      case 0xf:
76         return readinputport(4);
77      case 0xe:
78         return readinputport(3);
79      default:
80         return ninjakun_io_8000_ctrl[1];
81      }
82      break;
83
84   case 2: /* control */
85      return AY8910_read_port_1_r( 0 );
86
87   case 3: /* data */
88      return ninjakun_io_8000_ctrl[3];
89   }
90
91//  logerror("PC=%04x; RAM[0x800%d]\n",activecpu_get_pc(),offset);
92   return 0xFF;
93}
94
95/* static void handle_scrolly( UINT8 new_scroll ){ */
96
97/*  HACK!!!
98**
99**  New rows are always written at fixed locations above and below the background
100**  tilemaps, rather than at the logical screen boundaries with respect to scrolling.
101**
102**  I don't know how this is handled by the actual NinjaKun hardware, but the
103**  following is a crude approximation, yielding a playable game.
104*/
105
106/*
107    int old_row = old_scroll/8;
108    int new_row = new_scroll/8;
109    int i;
110    if( new_scroll!=old_scroll ){
111        tilemap_set_scrolly( bg_tilemap, 0, new_scroll&7 );
112
113        if ((new_row == ((old_row - 1) & 0xff)) || ((!old_row) && (new_row == 0x1f)))
114        {
115            for( i=0x400-0x21; i>=0; i-- ){
116                ninjakid_bg_videoram_w( i+0x20, videoram[0x800+i] );
117            }
118        }
119        else if ((new_row == ((old_row + 1) & 0xff)) || ((old_row == 0x1f) && (!new_row)))
120        {
121            for( i=0x20; i<0x400; i++ ){
122                ninjakid_bg_videoram_w( i-0x20, videoram[0x800+i] );
123            }
124        }
125
126        old_scroll = new_scroll;
127    }
128}
129*/
130
131
132WRITE8_HANDLER( ninjakun_io_8000_w ){
133   switch( offset ){
134   case 0x0: /* control#1 */
135      ninjakun_io_8000_ctrl[0] = data;
136      AY8910_control_port_0_w( 0, data );
137      break;
138
139   case 0x1: /* data#1 */
140      ninjakun_io_8000_ctrl[1] = data;
141      switch( ninjakun_io_8000_ctrl[0] ){
142      default:
143         AY8910_write_port_0_w( 0,data );
144         break;
145      }
146      break;
147
148   case 0x2: /* control#2 */
149      ninjakun_io_8000_ctrl[2] = data;
150      AY8910_control_port_1_w( 0, data );
151      break;
152
153   case 0x3: /* data#2 */
154      ninjakun_io_8000_ctrl[3] = data;
155      switch( ninjakun_io_8000_ctrl[2] ){
156      case 0xf:
157            tilemap_set_scrolly( bg_tilemap, 0, data );
158            ninjakun_yscroll = data;
159         break;
160      case 0xe:
161         if (flipscreen == 0)
162            tilemap_set_scrollx( bg_tilemap, 0, data-7 );
163         else
164            tilemap_set_scrollx( bg_tilemap, 0, data );
165            ninjakun_xscroll = data;
166         break;
167      default:
168         AY8910_write_port_1_w( 0,data );
169      }
170      break;
171   }
172}
173
174WRITE8_HANDLER( ninjakun_paletteram_w )
175{
176   int i;
177
178   paletteram_BBGGRRII_w(offset,data);
179
180   if (offset > 15)
181      return;
182
183   if (offset != 1)
184   {
185      for (i=0; i<16; i++)
186      {
187         paletteram_BBGGRRII_w(0x200+offset+i*16,data);
188      }
189   }
190   paletteram_BBGGRRII_w(0x200+offset*16+1,data);
191}
192
193/*******************************************************************************
194 Video Hardware Functions
195********************************************************************************
196 vh_start / vh_refresh
197*******************************************************************************/
198
199VIDEO_START( ninjakid ){
200    fg_tilemap = tilemap_create( get_fg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32 );
201   bg_tilemap = tilemap_create( get_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32 );
202   tilemap_set_transparent_pen( fg_tilemap,0 );
203
204   /* Save State Support */
205
206   state_save_register_global_array(ninjakun_io_8000_ctrl);
207   state_save_register_global(flipscreen);
208//  state_save_register_global(old_scroll);
209}
210
211static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect ){
212   const UINT8 *source = spriteram;
213   const UINT8 *finish = source+0x800;
214
215   const gfx_element *gfx = machine->gfx[2];
216
217   while( source<finish ){
218      int tile_number = source[0];
219      int sx = source[1];
220      int sy = source[2];
221      int attr = source[3];
222      int flipx = attr&0x10;
223      int flipy = attr&0x20;
224      int color = attr&0x0f;
225
226      if( flipscreen ){
227         sx = 240-sx;
228         sy = 240-sy;
229         flipx = !flipx;
230         flipy = !flipy;
231      }
232
233      drawgfx(
234         bitmap,
235         gfx,
236         tile_number,
237         color,
238         flipx,flipy,
239         sx,sy,
240         cliprect,
241         TRANSPARENCY_PEN,0
242      );
243      if (sx>240)
244         drawgfx(
245            bitmap,
246            gfx,
247            tile_number,
248            color,
249            flipx,flipy,
250            sx-256,sy,
251            cliprect,
252            TRANSPARENCY_PEN,0
253         );
254
255      source+=0x20;
256   }
257}
258
259VIDEO_UPDATE( ninjakid )
260{
261   int offs,chr,col,px,py,x,y;
262
263   tilemap_draw( bitmap,cliprect,bg_tilemap,0,0 );
264   tilemap_draw( bitmap,cliprect,fg_tilemap,0,0 );
265   draw_sprites( machine, bitmap,cliprect );
266
267   for (y=4; y<28; y++)
268   {
269      for (x=0; x<32; x++)
270      {
271         offs = y*32+x;
272         chr = videoram[offs];
273         col = videoram[offs + 0x400];
274         chr +=  (col & 0x20) << 3;
275
276         if ((col & 0x10) == 0)
277         {
278
279            if (flipscreen==0)
280            {
281               px = 8*x;
282               py = 8*y;
283            }
284            else
285            {
286               px = 248-8*x;
287               py = 248-8*y;
288            }
289
290            drawgfx(bitmap,machine->gfx[0],
291               chr,
292               col & 0x0f,
293               flipscreen,flipscreen,
294               px,py,
295               cliprect,TRANSPARENCY_PEN,0);
296         }
297      }
298   }
299
300
301   return 0;
302}
src/mame/video/mnight.c
r1594r1595
1#include "driver.h"
2
3UINT8   *mnight_scrolly_ram;
4UINT8   *mnight_scrollx_ram;
5UINT8   *mnight_bgenable_ram;
6UINT8   *mnight_spoverdraw_ram;
7UINT8   *mnight_background_videoram;
8size_t mnight_backgroundram_size;
9UINT8   *mnight_foreground_videoram;
10size_t mnight_foregroundram_size;
11
12static mame_bitmap *bitmap_bg;
13static mame_bitmap *bitmap_sp;
14
15static UINT8     *bg_dirtybuffer;
16static int       bg_enable = 1;
17static int       sp_overdraw = 0;
18
19static void mnight_mark_background_dirty(void)
20{
21   /* set 1024 bytes allocated in VIDEO_START( mnight ) to 'true' */
22   memset(bg_dirtybuffer,1,1024);
23}
24
25VIDEO_START( mnight )
26{
27   bg_dirtybuffer = auto_malloc(1024);
28
29   bitmap_bg = auto_bitmap_alloc (machine->screen[0].width*2,machine->screen[0].height*2,machine->screen[0].format);
30   bitmap_sp = auto_bitmap_alloc (machine->screen[0].width,machine->screen[0].height,machine->screen[0].format);
31
32   mnight_mark_background_dirty() ;
33
34   state_save_register_func_postload(mnight_mark_background_dirty) ;
35}
36
37
38WRITE8_HANDLER( mnight_bgvideoram_w )
39{
40   if (mnight_background_videoram[offset] != data)
41   {
42      bg_dirtybuffer[offset >> 1] = 1;
43      mnight_background_videoram[offset] = data;
44   }
45}
46
47WRITE8_HANDLER( mnight_fgvideoram_w )
48{
49   if (mnight_foreground_videoram[offset] != data)
50      mnight_foreground_videoram[offset] = data;
51}
52
53WRITE8_HANDLER( mnight_background_enable_w )
54{
55   if (bg_enable!=data)
56   {
57      mnight_bgenable_ram[offset] = data;
58      bg_enable = data;
59      if (bg_enable)
60         memset(bg_dirtybuffer, 1, mnight_backgroundram_size / 2);
61      else
62         fillbitmap(bitmap_bg, Machine->pens[0],0);
63   }
64}
65
66WRITE8_HANDLER( mnight_sprite_overdraw_w )
67{
68   if (sp_overdraw != (data&1))
69   {
70      mnight_spoverdraw_ram[offset] = data;
71      fillbitmap(bitmap_sp,15,&Machine->screen[0].visarea);
72      sp_overdraw = data & 1;
73   }
74}
75
76static void draw_foreground(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
77{
78   int offs;
79
80   /* Draw the foreground text */
81
82   for (offs = 0 ;offs < mnight_foregroundram_size / 2; offs++)
83   {
84      int sx,sy,tile,palette,flipx,flipy,lo,hi;
85
86      if (mnight_foreground_videoram[offs*2] | mnight_foreground_videoram[offs*2+1])
87      {
88         sx = (offs % 32) << 3;
89         sy = (offs >> 5) << 3;
90
91         lo = mnight_foreground_videoram[offs*2];
92         hi = mnight_foreground_videoram[offs*2+1];
93         tile = ((hi & 0xc0) << 2) | lo;
94         flipx = hi & 0x10;
95         flipy = hi & 0x20;
96         palette = hi & 0x0f;
97
98         drawgfx(bitmap,machine->gfx[3],
99               tile,
100               palette,
101               flipx,flipy,
102               sx,sy,
103               cliprect,TRANSPARENCY_PEN, 15);
104      }
105
106   }
107}
108
109
110static void draw_background(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
111{
112   int offs;
113
114   /* for every character in the Video RAM, check if it has been modified */
115   /* since last time and update it accordingly. */
116
117   for (offs = 0 ;offs < mnight_backgroundram_size / 2; offs++)
118   {
119      int sx,sy,tile,palette,flipy,lo,hi;
120
121      if (bg_dirtybuffer[offs])
122      {
123         sx = (offs % 32) << 4;
124         sy = (offs >> 5) << 4;
125
126         bg_dirtybuffer[offs] = 0;
127
128         lo = mnight_background_videoram[offs*2];
129         hi = mnight_background_videoram[offs*2+1];
130         tile = ((hi & 0x10) << 6) | ((hi & 0xc0) << 2) | lo;
131         flipy = hi & 0x20;
132         palette = hi & 0x0f;
133         drawgfx(bitmap,machine->gfx[0],
134               tile,
135               palette,
136               0,flipy,
137               sx,sy,
138               cliprect,TRANSPARENCY_NONE,0);
139      }
140
141   }
142}
143
144
145static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect)
146{
147   int offs;
148
149   for (offs = 11 ;offs < spriteram_size; offs+=16)
150   {
151      int sx,sy,tile,palette,flipx,flipy,big;
152
153      if (spriteram[offs+2] & 2)
154      {
155         sx = spriteram[offs+1];
156         sy = spriteram[offs];
157         if (spriteram[offs+2] & 1) sx-=256;
158         tile = spriteram[offs+3]+((spriteram[offs+2] & 0xc0)<<2) + ((spriteram[offs+2] & 0x08)<<7);
159         big  = spriteram[offs+2] & 4;
160         if (big) tile /= 4;
161         flipx = spriteram[offs+2] & 0x10;
162         flipy = spriteram[offs+2] & 0x20;
163         palette = spriteram[offs+4] & 0x0f;
164         drawgfx(bitmap,machine->gfx[(big)?2:1],
165               tile,
166               palette,
167               flipx,flipy,
168               sx,sy,
169               cliprect,
170               TRANSPARENCY_PEN, 15);
171
172         /* kludge to clear shots */
173         if (((spriteram[offs+2]==2) || (spriteram[offs+2]==0x12)) && (((tile>=0xd0) && (tile<=0xd5)) || ((tile>=0x20) && (tile<=0x25))))
174            spriteram[offs+2]=0;
175      }
176   }
177}
178
179
180VIDEO_UPDATE( mnight )
181{
182   int scrollx,scrolly;
183
184
185   if (bg_enable)
186      draw_background(machine, bitmap_bg, 0);
187
188   scrollx = -((mnight_scrollx_ram[0]+mnight_scrollx_ram[1]*256) & 0x1FF);
189   scrolly = -((mnight_scrolly_ram[0]+mnight_scrolly_ram[1]*256) & 0x1FF);
190
191   if (sp_overdraw)   /* overdraw sprite mode */
192   {
193      copyscrollbitmap(bitmap,bitmap_bg,1,&scrollx,1,&scrolly,cliprect,TRANSPARENCY_NONE,0);
194      draw_sprites(machine, bitmap_sp, 0);
195      draw_foreground(machine, bitmap_sp, 0);
196      copybitmap(bitmap,bitmap_sp,0,0,0,0,cliprect,TRANSPARENCY_PEN, 15);
197   }
198   else         /* normal sprite mode */
199   {
200      copyscrollbitmap(bitmap,bitmap_bg,1,&scrollx,1,&scrolly,cliprect,TRANSPARENCY_NONE,0);
201      draw_sprites(machine, bitmap, cliprect);
202      draw_foreground(machine, bitmap, cliprect);
203   }
204
205   return 0;
206}
src/mame/drivers/omegaf.c
r1594r1595
1/***************************************************************************
2
3Omega Fighter
4----------------------
5driver by Yochizo
6
7This driver is heavily dependent on the Raine source.
8Very thanks to Richard Bush and the Raine team.
9
10
11Supported games :
12==================
13 Omega Fighter     (C) 1989 UPL
14 Atomic Robokid    (C) 1988 UPL
15
16Known issues :
17================
18 - Cocktail mode has not been supported yet.
19 - Omega Fighter has a input protection. Currently it is hacked instead
20   of emulated.
21 - I don't know if Omega Fighter uses sprite overdraw flag or not.
22 - Sometimes sprites stays behind the screen in Atomic Robokid due to
23   incomplete sprite overdraw emulation.
24 - Currently it has not been implemented palette marking in sprite
25   overdraw mode.
26 - When RAM and ROM check and color test mode, the palette is overflows.
27   16 bit color is needed ?
28
29NOTE :
30========
31 - To skip dip setting display, press 1P + 2P start in Atomic Robokid.
32 - To enter the level code in Atomic Robokid, in the title screen insert 1 coin
33   and then press 1P or 2P start while keeping pressed 1P or 2P button1
34
35***************************************************************************/
36
37/*
38
39    TODO:
40
41    - "XXX Intturupt Hold ???" msg at post screen
42    - coin counters/lockouts
43    - sprites are invisible in flipscreen mode
44
45*/
46
47#include "driver.h"
48#include "sound/2203intf.h"
49
50
51/**************************************************************************
52  Variables
53**************************************************************************/
54
55extern UINT8 *omegaf_fg_videoram;
56extern size_t omegaf_fgvideoram_size;
57
58extern UINT8 *omegaf_bg0_scroll_x;
59extern UINT8 *omegaf_bg1_scroll_x;
60extern UINT8 *omegaf_bg2_scroll_x;
61extern UINT8 *omegaf_bg0_scroll_y;
62extern UINT8 *omegaf_bg1_scroll_y;
63extern UINT8 *omegaf_bg2_scroll_y;
64
65extern WRITE8_HANDLER( omegaf_bg0_bank_w );
66extern WRITE8_HANDLER( omegaf_bg1_bank_w );
67extern WRITE8_HANDLER( omegaf_bg2_bank_w );
68extern READ8_HANDLER( omegaf_bg0_videoram_r );
69extern READ8_HANDLER( omegaf_bg1_videoram_r );
70extern READ8_HANDLER( omegaf_bg2_videoram_r );
71extern WRITE8_HANDLER( omegaf_bg0_videoram_w );
72extern WRITE8_HANDLER( omegaf_bg1_videoram_w );
73extern WRITE8_HANDLER( omegaf_bg2_videoram_w );
74extern WRITE8_HANDLER( robokid_bg0_videoram_w );
75extern WRITE8_HANDLER( robokid_bg1_videoram_w );
76extern WRITE8_HANDLER( robokid_bg2_videoram_w );
77extern WRITE8_HANDLER( omegaf_bg0_scrollx_w );
78extern WRITE8_HANDLER( omegaf_bg1_scrollx_w );
79extern WRITE8_HANDLER( omegaf_bg2_scrollx_w );
80extern WRITE8_HANDLER( omegaf_bg0_scrolly_w );
81extern WRITE8_HANDLER( omegaf_bg1_scrolly_w );
82extern WRITE8_HANDLER( omegaf_bg2_scrolly_w );
83extern WRITE8_HANDLER( omegaf_fgvideoram_w );
84extern WRITE8_HANDLER( omegaf_bg0_enabled_w );
85extern WRITE8_HANDLER( omegaf_bg1_enabled_w );
86extern WRITE8_HANDLER( omegaf_bg2_enabled_w );
87extern WRITE8_HANDLER( omegaf_sprite_overdraw_w );
88extern WRITE8_HANDLER( omegaf_flipscreen_w );
89
90extern VIDEO_START( omegaf );
91extern VIDEO_START( robokid );
92extern VIDEO_UPDATE( omegaf );
93extern VIDEO_UPDATE( robokid );
94
95static int omegaf_bank_latch = 2;
96
97
98/**************************************************************************
99  Initializers
100**************************************************************************/
101
102static DRIVER_INIT( omegaf )
103{
104   UINT8 *RAM = memory_region(REGION_CPU1);
105
106   /* Hack the input protection. $00 and $01 code is written to $C005 */
107   /* and $C006.                                                      */
108
109   RAM[0x029a] = 0x00;
110   RAM[0x029b] = 0x00;
111   RAM[0x02a6] = 0x00;
112   RAM[0x02a7] = 0x00;
113
114   RAM[0x02b2] = 0xC9;
115   RAM[0x02b5] = 0xC9;
116   RAM[0x02c9] = 0xC9;
117   RAM[0x02f6] = 0xC9;
118
119   RAM[0x05f0] = 0x00;
120   RAM[0x054c] = 0x04;
121   RAM[0x0557] = 0x03;
122
123
124   /* Fix ROM check */
125
126   RAM[0x0b8d] = 0x00;
127   RAM[0x0b8e] = 0x00;
128   RAM[0x0b8f] = 0x00;
129}
130
131
132/**************************************************************************
133  Interrupts
134**************************************************************************/
135
136static INTERRUPT_GEN( omegaf_interrupt )
137{
138   cpunum_set_input_line_and_vector(0, 0, HOLD_LINE, 0xd7);   /* RST 10h */
139}
140
141
142/**************************************************************************
143  Inputs
144**************************************************************************/
145
146static INPUT_PORTS_START( omegaf )
147   PORT_START         /* Player 1 inputs */
148   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
149   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
150   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
151   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
152   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
153   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
154   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
155
156   PORT_START         /* Player 2 inputs */
157   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
158   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
159   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
160   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
161   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
162   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
163   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
164
165   PORT_START         /* System inputs */
166   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
167   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
168   PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
169   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE )
170   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 )
171   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
172   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
173
174   PORT_START         /* DSW 0 */
175   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
176   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
177   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
178   PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) )
179   PORT_DIPSETTING(    0x00, DEF_STR( Easy ) )
180   PORT_DIPSETTING(    0x06, DEF_STR( Normal ) )
181   PORT_DIPSETTING(    0x02, DEF_STR( Hard ) )
182   PORT_DIPSETTING(    0x04, DEF_STR( Hardest ) )
183   PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
184   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet) )
185   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
186   PORT_DIPSETTING(    0x10, DEF_STR( Cocktail ) )
187   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) )
188   PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
189   PORT_DIPSETTING(    0x20, DEF_STR( On ) )
190   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
191   PORT_DIPSETTING(    0x00, "2" )
192   PORT_DIPSETTING(    0xc0, "3" )
193   PORT_DIPSETTING(    0x40, "4" )
194   PORT_DIPSETTING(    0x80, "5" )
195
196   PORT_START          /* DSW 1 */
197   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Bonus_Life ) )
198   PORT_DIPSETTING(    0x00, "20000" )
199   PORT_DIPSETTING(    0x03, "30000" )
200   PORT_DIPSETTING(    0x01, "50000" )
201   PORT_DIPSETTING(    0x02, "100000" )
202   PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_B ) )
203   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
204   PORT_DIPSETTING(    0x10, DEF_STR( 4C_1C ) )
205   PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) )
206   PORT_DIPSETTING(    0x18, DEF_STR( 2C_1C ) )
207   PORT_DIPSETTING(    0x1c, DEF_STR( 1C_1C ) )
208   PORT_DIPSETTING(    0x0c, DEF_STR( 1C_2C ) )
209   PORT_DIPSETTING(    0x14, DEF_STR( 1C_3C ) )
210   PORT_DIPSETTING(    0x04, DEF_STR( 1C_4C ) )
211   PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) )
212   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
213   PORT_DIPSETTING(    0x80, DEF_STR( 4C_1C ) )
214   PORT_DIPSETTING(    0x40, DEF_STR( 3C_1C ) )
215   PORT_DIPSETTING(    0xc0, DEF_STR( 2C_1C ) )
216   PORT_DIPSETTING(    0xe0, DEF_STR( 1C_1C ) )
217   PORT_DIPSETTING(    0x60, DEF_STR( 1C_2C ) )
218   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_3C ) )
219   PORT_DIPSETTING(    0x20, DEF_STR( 1C_4C ) )
220INPUT_PORTS_END
221
222static INPUT_PORTS_START( robokid )
223   PORT_START         /* Player 1 inputs */
224   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
225   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
226   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
227   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
228   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )   // fire
229   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )   // jump
230   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
231
232   PORT_START         /* Player 2 inputs */
233   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
234   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
235   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
236   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
237   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
238   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
239   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
240
241   PORT_START         /* System inputs */
242   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
243
244   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
245   PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
246   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE )
247   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
248   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
249   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
250
251   PORT_START         /* DSW 0 */
252   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
253   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
254   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
255   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Bonus_Life ) )
256   PORT_DIPSETTING(    0x02, "50K 100K+" )
257   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
258   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Difficulty ) )
259   PORT_DIPSETTING(    0x04, DEF_STR( Normal ) )
260   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
261   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Free_Play ) )
262   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
263   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
264   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) )
265   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
266   PORT_DIPSETTING(    0x10, DEF_STR( Cocktail ) )
267   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) )
268   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
269   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
270   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
271   PORT_DIPSETTING(    0x80, "2" )
272   PORT_DIPSETTING(    0xc0, "3" )
273   PORT_DIPSETTING(    0x40, "4" )
274   PORT_DIPSETTING(    0x00, "5" )
275
276   PORT_START          /* DSW 1 */
277   PORT_SERVICE( 0x01, IP_ACTIVE_LOW )
278   PORT_BIT( 0x1e, IP_ACTIVE_LOW, IPT_UNUSED )
279   PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coinage ) )
280   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
281   PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
282   PORT_DIPSETTING(    0x40, DEF_STR( 3C_1C ) )
283   PORT_DIPSETTING(    0x60, DEF_STR( 2C_1C ) )
284   PORT_DIPSETTING(    0xe0, DEF_STR( 1C_1C ) )
285   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )
286   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_3C ) )
287   PORT_DIPSETTING(    0x80, DEF_STR( 1C_4C ) )
288INPUT_PORTS_END
289
290
291static INPUT_PORTS_START( robokidj )
292   PORT_START         /* Player 1 inputs */
293   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
294   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
295   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
296   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
297   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )   // fire
298   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )   // jump
299   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
300
301   PORT_START         /* Player 2 inputs */
302   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
303   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
304   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
305   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
306   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
307   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
308   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
309
310   PORT_START         /* System inputs */
311   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
312   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
313   PORT_BIT( 0x0c, IP_ACTIVE_LOW, IPT_UNUSED )
314   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE )   /* keep pressed during boot to enter service mode */
315   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED )
316   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
317   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
318
319   PORT_START         /* DSW 0 */
320   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
321   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
322   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
323   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Bonus_Life ) )
324   PORT_DIPSETTING(    0x02, "30K 50K+" )
325   PORT_DIPSETTING(   0x00, "50K 80K+" )
326   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Difficulty ) )
327   PORT_DIPSETTING(    0x04, DEF_STR( Normal ) )
328   PORT_DIPSETTING(    0x00, DEF_STR( Hard ) )
329   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Free_Play ) )
330   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
331   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
332   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) )
333   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
334   PORT_DIPSETTING(    0x10, DEF_STR( Cocktail ) )
335   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) )
336   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
337   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
338   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
339   PORT_DIPSETTING(    0x80, "2" )
340   PORT_DIPSETTING(    0xc0, "3" )
341   PORT_DIPSETTING(    0x40, "4" )
342   PORT_DIPSETTING(    0x00, "5" )
343
344   PORT_START          /* DSW 1 */
345   PORT_SERVICE( 0x01, IP_ACTIVE_LOW )
346   PORT_BIT( 0x1e, IP_ACTIVE_LOW, IPT_UNUSED )
347   PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coinage ) )
348   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
349   PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
350   PORT_DIPSETTING(    0x40, DEF_STR( 3C_1C ) )
351   PORT_DIPSETTING(    0x60, DEF_STR( 2C_1C ) )
352   PORT_DIPSETTING(    0xe0, DEF_STR( 1C_1C ) )
353   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )
354   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_3C ) )
355   PORT_DIPSETTING(    0x80, DEF_STR( 1C_4C ) )
356INPUT_PORTS_END
357
358
359/**************************************************************************
360  Memory handlers
361**************************************************************************/
362
363static WRITE8_HANDLER( omegaf_bankselect_w )
364{
365   UINT8 *RAM = memory_region(REGION_CPU1);
366   int bankaddress;
367
368   if ( (data & 0x0f) != omegaf_bank_latch )
369   {
370      omegaf_bank_latch = data & 0x0f;
371
372      if (omegaf_bank_latch < 2)
373         bankaddress = omegaf_bank_latch * 0x4000;
374      else
375         bankaddress = 0x10000 + ( (omegaf_bank_latch - 2) * 0x4000);
376      memory_set_bankptr( 1, &RAM[bankaddress] );    /* Select 16 banks of 16k */
377   }
378}
379
380
381/**************************************************************************
382  Memory maps
383**************************************************************************/
384
385static ADDRESS_MAP_START( omegaf_readmem, ADDRESS_SPACE_PROGRAM, 8 )
386   AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM)
387   AM_RANGE(0x8000, 0xbfff) AM_READ(MRA8_BANK1)
388   AM_RANGE(0xc000, 0xc000) AM_READ(input_port_2_r)         /* system input */
389   AM_RANGE(0xc001, 0xc001) AM_READ(input_port_0_r)         /* player 1 input */
390   AM_RANGE(0xc002, 0xc002) AM_READ(input_port_1_r)         /* player 2 input */
391   AM_RANGE(0xc003, 0xc003) AM_READ(input_port_3_r)         /* DSW 1 input */
392   AM_RANGE(0xc004, 0xc004) AM_READ(input_port_4_r)         /* DSW 2 input */
393   AM_RANGE(0xc005, 0xc005) AM_READ(MRA8_NOP)
394   AM_RANGE(0xc006, 0xc006) AM_READ(MRA8_NOP)
395   AM_RANGE(0xc100, 0xc105) AM_READ(MRA8_RAM)
396   AM_RANGE(0xc200, 0xc205) AM_READ(MRA8_RAM)
397   AM_RANGE(0xc300, 0xc305) AM_READ(MRA8_RAM)
398   AM_RANGE(0xc400, 0xc7ff) AM_READ(omegaf_bg0_videoram_r)   /* BG0 video RAM */
399   AM_RANGE(0xc800, 0xcbff) AM_READ(omegaf_bg1_videoram_r)   /* BG1 video RAM */
400   AM_RANGE(0xcc00, 0xcfff) AM_READ(omegaf_bg2_videoram_r)   /* BG2 video RAM */
401   AM_RANGE(0xd000, 0xd7ff) AM_READ(MRA8_RAM)            /* FG RAM */
402   AM_RANGE(0xd800, 0xdfff) AM_READ(paletteram_r)         /* palette RAM */
403   AM_RANGE(0xe000, 0xf9ff) AM_READ(MRA8_RAM)            /* RAM */
404   AM_RANGE(0xfa00, 0xffff) AM_READ(MRA8_RAM)            /* sprite RAM */
405ADDRESS_MAP_END
406
407static ADDRESS_MAP_START( omegaf_writemem, ADDRESS_SPACE_PROGRAM, 8 )
408   AM_RANGE(0x0000, 0xbfff) AM_WRITE(MWA8_ROM)
409   AM_RANGE(0xc000, 0xc000) AM_WRITE(soundlatch_w)
410   AM_RANGE(0xc001, 0xc001) AM_WRITE(omegaf_flipscreen_w)
411   AM_RANGE(0xc002, 0xc002) AM_WRITE(omegaf_bankselect_w)
412   AM_RANGE(0xc003, 0xc003) AM_WRITE(omegaf_sprite_overdraw_w)
413   AM_RANGE(0xc004, 0xc004) AM_WRITE(MWA8_NOP)                     /* input protection */
414   AM_RANGE(0xc005, 0xc005) AM_WRITE(MWA8_NOP)                     /* input protection */
415   AM_RANGE(0xc006, 0xc006) AM_WRITE(MWA8_NOP)                     /* input protection */
416   AM_RANGE(0xc100, 0xc101) AM_WRITE(omegaf_bg0_scrollx_w) AM_BASE(&omegaf_bg0_scroll_x)
417   AM_RANGE(0xc102, 0xc103) AM_WRITE(omegaf_bg0_scrolly_w) AM_BASE(&omegaf_bg0_scroll_y)
418   AM_RANGE(0xc104, 0xc104) AM_WRITE(omegaf_bg0_enabled_w)            /* BG0 enabled */
419   AM_RANGE(0xc105, 0xc105) AM_WRITE(omegaf_bg0_bank_w)               /* BG0 bank select */
420   AM_RANGE(0xc200, 0xc201) AM_WRITE(omegaf_bg1_scrollx_w) AM_BASE(&omegaf_bg1_scroll_x)
421   AM_RANGE(0xc202, 0xc203) AM_WRITE(omegaf_bg1_scrolly_w) AM_BASE(&omegaf_bg1_scroll_y)
422   AM_RANGE(0xc204, 0xc204) AM_WRITE(omegaf_bg1_enabled_w)            /* BG1 enabled */
423   AM_RANGE(0xc205, 0xc205) AM_WRITE(omegaf_bg1_bank_w)               /* BG1 bank select */
424   AM_RANGE(0xc300, 0xc301) AM_WRITE(omegaf_bg2_scrollx_w) AM_BASE(&omegaf_bg2_scroll_x)
425   AM_RANGE(0xc302, 0xc303) AM_WRITE(omegaf_bg2_scrolly_w) AM_BASE(&omegaf_bg2_scroll_y)
426   AM_RANGE(0xc304, 0xc304) AM_WRITE(omegaf_bg2_enabled_w)            /* BG2 enabled */
427   AM_RANGE(0xc305, 0xc305) AM_WRITE(omegaf_bg2_bank_w)               /* BG2 bank select */
428   AM_RANGE(0xc400, 0xc7ff) AM_WRITE(omegaf_bg0_videoram_w)            /* BG0 video RAM */
429   AM_RANGE(0xc800, 0xcbff) AM_WRITE(omegaf_bg1_videoram_w)            /* BG1 video RAM */
430   AM_RANGE(0xcc00, 0xcfff) AM_WRITE(omegaf_bg2_videoram_w)            /* BG2 video RAM */
431   AM_RANGE(0xd000, 0xd7ff) AM_WRITE(omegaf_fgvideoram_w) AM_BASE(&omegaf_fg_videoram)
432   AM_RANGE(0xd800, 0xdfff) AM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_BASE(&paletteram)
433   AM_RANGE(0xe000, 0xf9ff) AM_WRITE(MWA8_RAM)                     /* RAM */
434   AM_RANGE(0xfa00, 0xffff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
435ADDRESS_MAP_END
436
437static ADDRESS_MAP_START( robokid_readmem, ADDRESS_SPACE_PROGRAM, 8 )
438   AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM)
439   AM_RANGE(0x8000, 0xbfff) AM_READ(MRA8_BANK1)
440   AM_RANGE(0xc000, 0xc7ff) AM_READ(paletteram_r)         /* paletrte RAM */
441   AM_RANGE(0xc800, 0xcfff) AM_READ(MRA8_RAM)            /* FG RAM */
442   AM_RANGE(0xd000, 0xd3ff) AM_READ(omegaf_bg2_videoram_r)
443   AM_RANGE(0xd400, 0xd7ff) AM_READ(omegaf_bg1_videoram_r)
444   AM_RANGE(0xd800, 0xdbff) AM_READ(omegaf_bg0_videoram_r)
445   AM_RANGE(0xdc00, 0xdc00) AM_READ(input_port_2_r)         /* system input */
446   AM_RANGE(0xdc01, 0xdc01) AM_READ(input_port_0_r)         /* player 1 input */
447   AM_RANGE(0xdc02, 0xdc02) AM_READ(input_port_1_r)         /* player 2 input */
448   AM_RANGE(0xdc03, 0xdc03) AM_READ(input_port_3_r)         /* DSW 1 input */
449   AM_RANGE(0xdc04, 0xdc04) AM_READ(input_port_4_r)         /* DSW 2 input */
450   AM_RANGE(0xdd00, 0xdd05) AM_READ(MRA8_RAM)
451   AM_RANGE(0xde00, 0xde05) AM_READ(MRA8_RAM)
452   AM_RANGE(0xdf00, 0xdf05) AM_READ(MRA8_RAM)
453   AM_RANGE(0xe000, 0xf9ff) AM_READ(MRA8_RAM)            /* RAM */
454   AM_RANGE(0xfa00, 0xffff) AM_READ(MRA8_RAM)            /* sprite RAM */
455ADDRESS_MAP_END
456
457static ADDRESS_MAP_START( robokid_writemem, ADDRESS_SPACE_PROGRAM, 8 )
458   AM_RANGE(0x0000, 0xbfff) AM_WRITE(MWA8_ROM)
459   AM_RANGE(0xc000, 0xc7ff) AM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_BASE(&paletteram)
460   AM_RANGE(0xc800, 0xcfff) AM_WRITE(omegaf_fgvideoram_w) AM_BASE(&omegaf_fg_videoram)
461   AM_RANGE(0xd000, 0xd3ff) AM_WRITE(robokid_bg2_videoram_w)            /* BG2 video RAM */
462   AM_RANGE(0xd400, 0xd7ff) AM_WRITE(robokid_bg1_videoram_w)            /* BG1 video RAM */
463   AM_RANGE(0xd800, 0xdbff) AM_WRITE(robokid_bg0_videoram_w)            /* BG0 video RAM */
464   AM_RANGE(0xdc00, 0xdc00) AM_WRITE(soundlatch_w)
465   AM_RANGE(0xdc01, 0xdc01) AM_WRITE(omegaf_flipscreen_w)
466   AM_RANGE(0xdc02, 0xdc02) AM_WRITE(omegaf_bankselect_w)
467   AM_RANGE(0xdc03, 0xdc03) AM_WRITE(omegaf_sprite_overdraw_w)
468   AM_RANGE(0xdd00, 0xdd01) AM_WRITE(omegaf_bg0_scrollx_w) AM_BASE(&omegaf_bg0_scroll_x)
469   AM_RANGE(0xdd02, 0xdd03) AM_WRITE(omegaf_bg0_scrolly_w) AM_BASE(&omegaf_bg0_scroll_y)
470   AM_RANGE(0xdd04, 0xdd04) AM_WRITE(omegaf_bg0_enabled_w)            /* BG0 enabled */
471   AM_RANGE(0xdd05, 0xdd05) AM_WRITE(omegaf_bg0_bank_w)               /* BG0 bank select */
472   AM_RANGE(0xde00, 0xde01) AM_WRITE(omegaf_bg1_scrollx_w) AM_BASE(&omegaf_bg1_scroll_x)
473   AM_RANGE(0xde02, 0xde03) AM_WRITE(omegaf_bg1_scrolly_w) AM_BASE(&omegaf_bg1_scroll_y)
474   AM_RANGE(0xde04, 0xde04) AM_WRITE(omegaf_bg1_enabled_w)            /* BG1 enabled */
475   AM_RANGE(0xde05, 0xde05) AM_WRITE(omegaf_bg1_bank_w)               /* BG1 bank select */
476   AM_RANGE(0xdf00, 0xdf01) AM_WRITE(omegaf_bg2_scrollx_w) AM_BASE(&omegaf_bg2_scroll_x)
477   AM_RANGE(0xdf02, 0xdf03) AM_WRITE(omegaf_bg2_scrolly_w) AM_BASE(&omegaf_bg2_scroll_y)
478   AM_RANGE(0xdf04, 0xdf04) AM_WRITE(omegaf_bg2_enabled_w)            /* BG2 enabled */
479   AM_RANGE(0xdf05, 0xdf05) AM_WRITE(omegaf_bg2_bank_w)               /* BG2 bank select */
480   AM_RANGE(0xe000, 0xf9ff) AM_WRITE(MWA8_RAM)                     /* RAM */
481   AM_RANGE(0xfa00, 0xffff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
482ADDRESS_MAP_END
483
484static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 )
485   AM_RANGE(0x0000, 0xbfff) AM_READ(MRA8_ROM)
486   AM_RANGE(0xc000, 0xc7ff) AM_READ(MRA8_RAM)
487   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
488   AM_RANGE(0xefee, 0xefee) AM_READ(MRA8_NOP)
489ADDRESS_MAP_END
490
491static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 )
492   AM_RANGE(0x0000, 0xbfff) AM_WRITE(MWA8_ROM)
493   AM_RANGE(0xc000, 0xc7ff) AM_WRITE(MWA8_RAM)
494   AM_RANGE(0xe000, 0xe000) AM_WRITE(MWA8_NOP)
495   AM_RANGE(0xeff5, 0xeff6) AM_WRITE(MWA8_NOP)   /* sample frequency ??? */
496   AM_RANGE(0xefee, 0xefee) AM_WRITE(MWA8_NOP)   /* chip command ?? */
497   AM_RANGE(0xf000, 0xf000) AM_WRITE(MWA8_NOP)   // ???
498ADDRESS_MAP_END
499
500static ADDRESS_MAP_START( sound_readport, ADDRESS_SPACE_IO, 8 )
501   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
502   AM_RANGE(0x00, 0x00) AM_READ(YM2203_status_port_0_r)
503   AM_RANGE(0x01, 0x01) AM_READ(YM2203_read_port_0_r)
504   AM_RANGE(0x80, 0x80) AM_READ(YM2203_status_port_1_r)
505   AM_RANGE(0x81, 0x81) AM_READ(YM2203_read_port_1_r)
506ADDRESS_MAP_END
507
508static ADDRESS_MAP_START( sound_writeport, ADDRESS_SPACE_IO, 8 )
509   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
510   AM_RANGE(0x00, 0x00) AM_WRITE(YM2203_control_port_0_w)
511   AM_RANGE(0x01, 0x01) AM_WRITE(YM2203_write_port_0_w)
512   AM_RANGE(0x80, 0x80) AM_WRITE(YM2203_control_port_1_w)
513   AM_RANGE(0x81, 0x81) AM_WRITE(YM2203_write_port_1_w)
514ADDRESS_MAP_END
515
516
517/**************************************************************************
518  GFX decoding
519**************************************************************************/
520
521static const gfx_layout omegaf_charlayout =
522{
523   8, 8,   /* 8x8 characters */
524   1024,   /* 1024 characters */
525   4,      /* 4 bits per pixel */
526   { 0, 1, 2, 3 },
527   { 0, 4, 8, 12, 16, 20, 24, 28 },
528   { 32*0, 32*1, 32*2, 32*3, 32*4, 32*5, 32*6, 32*7 },
529   8*32
530};
531
532static const gfx_layout omegaf_spritelayout =
533{
534   16, 16,   /* 16x16 characters */
535   1024,
536   4,
537   { 0, 1, 2, 3 },
538   { 0, 4, 8, 12, 16, 20, 24, 28,
539      64*8+0, 64*8+4, 64*8+8, 64*8+12, 64*8+16, 64*8+20, 64*8+24, 64*8+28 },
540   { 32*0, 32*1, 32*2, 32*3, 32*4, 32*5, 32*6, 32*7,
541      32*8, 32*9, 32*10, 32*11, 32*12, 32*13, 32*14, 32*15 },
542   16*64
543};
544
545static const gfx_layout omegaf_bigspritelayout =
546{
547   32, 32,   /* 32x32 characters */
548   256,
549   4,
550   { 0, 1, 2, 3 },
551   {   0, 4, 8, 12, 16, 20, 24, 28,
552      64*8+0, 64*8+4, 64*8+8, 64*8+12, 64*8+16, 64*8+20, 64*8+24, 64*8+28,
553      128*16+0, 128*16+4, 128*16+8, 128*16+12, 128*16+16, 128*16+20, 128*16+24, 128*16+28,
554      128*16+64*8+0, 128*16+64*8+4, 128*16+64*8+8, 128*16+64*8+12, 128*16+64*8+16, 128*16+64*8+20, 128*16+64*8+24, 128*16+64*8+28 },
555   { 32*0, 32*1, 32*2, 32*3, 32*4, 32*5, 32*6, 32*7,
556      32*8, 32*9, 32*10, 32*11, 32*12, 32*13, 32*14, 32*15,
557      64*16+32*0, 64*16+32*1, 64*16+32*2, 64*16+32*3, 64*16+32*4, 64*16+32*5, 64*16+32*6, 64*16+32*7,
558      64*16+32*8, 64*16+32*9, 64*16+32*10, 64*16+32*11, 64*16+32*12, 64*16+32*13, 64*16+32*14, 64*16+32*15 },
559   16*64*4
560};
561
562static const gfx_layout omegaf_bglayout =
563{
564   16, 16,   /* 16x16 characters */
565   4096,
566   4,
567   { 0, 1, 2, 3 },
568   { 0, 4, 8, 12, 16, 20, 24, 28,
569      64*8+0, 64*8+4, 64*8+8, 64*8+12, 64*8+16, 64*8+20, 64*8+24, 64*8+28 },
570   { 32*0, 32*1, 32*2, 32*3, 32*4, 32*5, 32*6, 32*7,
571      32*8, 32*9, 32*10, 32*11, 32*12, 32*13, 32*14, 32*15 },
572   16*64
573};
574
575static const gfx_layout robokid_spritelayout =
576{
577   16, 16,   /* 16x16 characters */
578   2048,
579   4,
580   { 0, 1, 2, 3 },
581   { 0, 4, 8, 12, 16, 20, 24, 28,
582      64*8+0, 64*8+4, 64*8+8, 64*8+12, 64*8+16, 64*8+20, 64*8+24, 64*8+28 },
583   { 32*0, 32*1, 32*2, 32*3, 32*4, 32*5, 32*6, 32*7,
584      32*8, 32*9, 32*10, 32*11, 32*12, 32*13, 32*14, 32*15 },
585   16*64
586};
587
588static const gfx_layout robokid_bigspritelayout =
589{
590   32, 32,   /* 32x32 characters */
591   512,
592   4,
593   { 0, 1, 2, 3 },
594   {   0, 4, 8, 12, 16, 20, 24, 28,
595      64*8+0, 64*8+4, 64*8+8, 64*8+12, 64*8+16, 64*8+20, 64*8+24, 64*8+28,
596      128*16+0, 128*16+4, 128*16+8, 128*16+12, 128*16+16, 128*16+20, 128*16+24, 128*16+28,
597      128*16+64*8+0, 128*16+64*8+4, 128*16+64*8+8, 128*16+64*8+12, 128*16+64*8+16, 128*16+64*8+20, 128*16+64*8+24, 128*16+64*8+28 },
598   { 32*0, 32*1, 32*2, 32*3, 32*4, 32*5, 32*6, 32*7,
599      32*8, 32*9, 32*10, 32*11, 32*12, 32*13, 32*14, 32*15,
600      64*16+32*0, 64*16+32*1, 64*16+32*2, 64*16+32*3, 64*16+32*4, 64*16+32*5, 64*16+32*6, 64*16+32*7,
601      64*16+32*8, 64*16+32*9, 64*16+32*10, 64*16+32*11, 64*16+32*12, 64*16+32*13, 64*16+32*14, 64*16+32*15 },
602   16*64*4
603};
604
605static GFXDECODE_START( omegaf )
606   GFXDECODE_ENTRY( REGION_GFX1, 0, omegaf_bglayout,         0*16, 16)
607   GFXDECODE_ENTRY( REGION_GFX2, 0, omegaf_bglayout,         0*16, 16)
608   GFXDECODE_ENTRY( REGION_GFX3, 0, omegaf_bglayout,         0*16, 16)
609   GFXDECODE_ENTRY( REGION_GFX4, 0, omegaf_spritelayout,    32*16, 16)
610   GFXDECODE_ENTRY( REGION_GFX4, 0, omegaf_bigspritelayout, 32*16, 16)
611   GFXDECODE_ENTRY( REGION_GFX5, 0, omegaf_charlayout,      48*16, 16)
612GFXDECODE_END
613
614static GFXDECODE_START( robokid )
615   GFXDECODE_ENTRY( REGION_GFX1, 0, omegaf_bglayout,          0*16, 16)
616   GFXDECODE_ENTRY( REGION_GFX2, 0, omegaf_bglayout,          0*16, 16)
617   GFXDECODE_ENTRY( REGION_GFX3, 0, omegaf_bglayout,          0*16, 16)
618   GFXDECODE_ENTRY( REGION_GFX4, 0, robokid_spritelayout,    32*16, 16)
619   GFXDECODE_ENTRY( REGION_GFX4, 0, robokid_bigspritelayout, 32*16, 16)
620   GFXDECODE_ENTRY( REGION_GFX5, 0, omegaf_charlayout,       48*16, 16)
621GFXDECODE_END
622
623
624/**************************************************************************
625  Machine drivers
626**************************************************************************/
627
628static MACHINE_DRIVER_START( omegaf )
629
630   /* basic machine hardware */
631   MDRV_CPU_ADD_TAG("main", Z80, 12000000/2)      /* 12000000/2 (verified on pcb) */
632   MDRV_CPU_PROGRAM_MAP(omegaf_readmem,omegaf_writemem)   /* very sensitive to these settings */
633   MDRV_CPU_VBLANK_INT(omegaf_interrupt,1)
634
635   MDRV_CPU_ADD(Z80, 5000000)
636   /* audio CPU */      /* 5 mhz crystal (verified on pcb) */
637   MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem)
638   MDRV_CPU_IO_MAP(sound_readport,sound_writeport)
639   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
640
641   MDRV_SCREEN_REFRESH_RATE(60)
642   MDRV_SCREEN_VBLANK_TIME(DEFAULT_60HZ_VBLANK_DURATION)
643   MDRV_INTERLEAVE(10)               /* number of slices per frame */
644
645   /* video hardware */
646   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
647   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
648   MDRV_SCREEN_SIZE(128*16, 32*16)
649   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 28*8-1)
650   MDRV_GFXDECODE(omegaf)
651   MDRV_PALETTE_LENGTH(1024)
652
653   MDRV_VIDEO_START(omegaf)
654   MDRV_VIDEO_UPDATE(omegaf)
655
656   /* sound hardware */
657   MDRV_SPEAKER_STANDARD_MONO("mono")
658
659   MDRV_SOUND_ADD(YM2203, 12000000/8) /* (verified on pcb) */
660   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35)
661
662   MDRV_SOUND_ADD(YM2203, 12000000/8) /* (verified on pcb) */
663   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.35)
664MACHINE_DRIVER_END
665
666
667static MACHINE_DRIVER_START( robokid )
668   MDRV_IMPORT_FROM(omegaf)
669
670   MDRV_CPU_MODIFY("main")
671   MDRV_CPU_PROGRAM_MAP(robokid_readmem,robokid_writemem)
672
673   MDRV_GFXDECODE(robokid)
674   MDRV_VIDEO_START(robokid)
675   MDRV_VIDEO_UPDATE(robokid)
676MACHINE_DRIVER_END
677
678
679/**************************************************************************
680  ROM loaders
681**************************************************************************/
682
683ROM_START( omegaf )
684   ROM_REGION( 0x48000, REGION_CPU1, 0 )                  /* main CPU */
685   ROM_LOAD( "1.5",          0x00000, 0x08000, CRC(57a7fd96) SHA1(65ca290b48f8579fcce00db5b3b3f8694667a136) )
686   ROM_CONTINUE(             0x10000, 0x18000 )
687   ROM_LOAD( "6.4l",         0x28000, 0x20000, CRC(6277735c) SHA1(b0f91f0cc51d424a1a7834c126736f24c2e23c17) )
688
689   ROM_REGION( 0x10000, REGION_CPU2, 0 )                  /* sound CPU */
690   ROM_LOAD( "7.7m",         0x00000, 0x10000, CRC(d40fc8d5) SHA1(4f615a0fb786cafc20f82f0b5fa112a9c356378f) )
691
692   ROM_REGION( 0x80000, REGION_GFX1, ROMREGION_DISPOSE )      /* BG0 */
693   ROM_LOAD( "2back1.27b",   0x00000, 0x80000, CRC(21f8a32e) SHA1(26582e06e7381e09443fa99f24ca9edd0b4a2937) )
694
695   ROM_REGION( 0x80000, REGION_GFX2, ROMREGION_DISPOSE )      /* BG1 */
696   ROM_LOAD( "1back2.15b",   0x00000, 0x80000, CRC(6210ddcc) SHA1(89c091eeafcc92750d0ea303fcde8a8dc3eeba89) )
697
698   ROM_REGION( 0x80000, REGION_GFX3, ROMREGION_DISPOSE )      /* BG2 */
699   ROM_LOAD( "3back3.5f",    0x00000, 0x80000, CRC(c31cae56) SHA1(4cc2d0d70990ca04b0e3abd15e5afe183e98e4ab) )
700
701   ROM_REGION( 0x20000, REGION_GFX4, ROMREGION_DISPOSE )      /* sprite */
702   ROM_LOAD( "8.23m",        0x00000, 0x20000, CRC(0bd2a5d1) SHA1(ef84f1a5554e891fc38d17314e3952ea5c9d2731) )
703
704   ROM_REGION( 0x08000, REGION_GFX5, ROMREGION_DISPOSE )      /* FG */
705   ROM_LOAD( "4.18h",        0x00000, 0x08000, CRC(9e2d8152) SHA1(4b50557d171d1b03a870db5891ae67d70858ad37) )
706ROM_END
707
708ROM_START( omegafs )
709   ROM_REGION( 0x48000, REGION_CPU1, 0 )                  /* main CPU */
710   ROM_LOAD( "5.3l",         0x00000, 0x08000, CRC(503a3e63) SHA1(73420aecb653cd4fd3b6afe67d6f5726f01411dd) )
711   ROM_CONTINUE(             0x10000, 0x18000 )
712   ROM_LOAD( "6.4l",         0x28000, 0x20000, CRC(6277735c) SHA1(b0f91f0cc51d424a1a7834c126736f24c2e23c17) )
713
714   ROM_REGION( 0x10000, REGION_CPU2, 0 )                  /* sound CPU */
715   ROM_LOAD( "7.7m",         0x00000, 0x10000, CRC(d40fc8d5) SHA1(4f615a0fb786cafc20f82f0b5fa112a9c356378f) )
716
717   ROM_REGION( 0x80000, REGION_GFX1, ROMREGION_DISPOSE )      /* BG0 */
718   ROM_LOAD( "2back1.27b",   0x00000, 0x80000, CRC(21f8a32e) SHA1(26582e06e7381e09443fa99f24ca9edd0b4a2937) )
719
720   ROM_REGION( 0x80000, REGION_GFX2, ROMREGION_DISPOSE )      /* BG1 */
721   ROM_LOAD( "1back2.15b",   0x00000, 0x80000, CRC(6210ddcc) SHA1(89c091eeafcc92750d0ea303fcde8a8dc3eeba89) )
722
723   ROM_REGION( 0x80000, REGION_GFX3, ROMREGION_DISPOSE )      /* BG2 */
724   ROM_LOAD( "3back3.5f",    0x00000, 0x80000, CRC(c31cae56) SHA1(4cc2d0d70990ca04b0e3abd15e5afe183e98e4ab) )
725
726   ROM_REGION( 0x20000, REGION_GFX4, ROMREGION_DISPOSE )      /* sprite */
727   ROM_LOAD( "8.23m",        0x00000, 0x20000, CRC(0bd2a5d1) SHA1(ef84f1a5554e891fc38d17314e3952ea5c9d2731) )
728
729   ROM_REGION( 0x08000, REGION_GFX5, ROMREGION_DISPOSE )      /* FG */
730   ROM_LOAD( "4.18h",        0x00000, 0x08000, CRC(9e2d8152) SHA1(4b50557d171d1b03a870db5891ae67d70858ad37) )
731ROM_END
732
733ROM_START( robokid )
734   ROM_REGION( 0x48000, REGION_CPU1, 0 )                  /* main CPU */
735   ROM_LOAD( "robokid1.18j", 0x00000, 0x08000, CRC(378c21fc) SHA1(58163bd6fbfa8385b1bd648cfde3d75bf81ac07d) )
736   ROM_CONTINUE(             0x10000, 0x08000 )
737   ROM_LOAD( "robokid2.18k", 0x18000, 0x10000, CRC(ddef8c5a) SHA1(a1dd2f51205863c3d5d3527991d538ca8adf7587) )
738   ROM_LOAD( "robokid3.15k", 0x28000, 0x10000, CRC(05295ec3) SHA1(33dd0853a2064cb4301cfbdc7856def81f6e1223) )
739   ROM_LOAD( "robokid4.12k", 0x38000, 0x10000, CRC(3bc3977f) SHA1(da394e12d197b0e109b03c854da06b1267bd9d59) )
740   ROM_COPY( REGION_CPU1 ,   0x10000, 0x8000, 0x4000 ) /* to avoid crash */
741
742   ROM_REGION( 0x10000, REGION_CPU2, 0 )                  /* sound CPU */
743   ROM_LOAD( "robokid.k7",   0x00000, 0x10000, CRC(f490a2e9) SHA1(861d1256c090ce3d1f45f95cc894affbbc3f1466) )
744
745   ROM_REGION( 0x80000, REGION_GFX1, ROMREGION_DISPOSE )      /* BG0 */
746   ROM_LOAD( "robokid.19c",  0x00000, 0x10000, CRC(02220421) SHA1(f533e9c6cea1dccbb60e0528c470f3cb5e8fc44e) )
747   ROM_LOAD( "robokid.20c",  0x10000, 0x10000, CRC(02d59bc2) SHA1(031acbb14145f9f4623de8868c6207fb9f8e8207) )
748   ROM_LOAD( "robokid.17d",  0x20000, 0x10000, CRC(2fa29b99) SHA1(13dce7932e2e9c03a139a4293584838aa3d9f1c3) )
749   ROM_LOAD( "robokid.18d",  0x30000, 0x10000, CRC(ae15ce02) SHA1(175e4eebdf12f1f373e01a4b1c933053ddd09abf) )
750   ROM_LOAD( "robokid.19d",  0x40000, 0x10000, CRC(784b089e) SHA1(1ae3346b4afa3da9484ebc59c8a530cb95f7d277) )
751   ROM_LOAD( "robokid.20d",  0x50000, 0x10000, CRC(b0b395ed) SHA1(31ec07634053793a701bbfd601b029f7da66e9d7) )
752   ROM_LOAD( "robokid.19f",  0x60000, 0x10000, CRC(0f9071c6) SHA1(8bf0c35189eda98a9bc150788890e136870cb5b2) )
753
754   ROM_REGION( 0x80000, REGION_GFX2, ROMREGION_DISPOSE )      /* BG1 */
755   ROM_LOAD( "robokid.12c",  0x00000, 0x10000, CRC(0ab45f94) SHA1(d8274263068d998c89a1b247dde7f814037cc15b) )
756   ROM_LOAD( "robokid.14c",  0x10000, 0x10000, CRC(029bbd4a) SHA1(8e078cdafe608fc6cde827be85c5267ade4ecca6) )
757   ROM_LOAD( "robokid.15c",  0x20000, 0x10000, CRC(7de67ebb) SHA1(2fe92e50e2894dd363e69b053db96bdb66a273eb) )
758   ROM_LOAD( "robokid.16c",  0x30000, 0x10000, CRC(53c0e582) SHA1(763e6127532d022a707bf9ddf1a832413745f248) )
759   ROM_LOAD( "robokid.17c",  0x40000, 0x10000, CRC(0cae5a1e) SHA1(a183a33516c81ea2c029b72ee6261c4519e095ab) )
760   ROM_LOAD( "robokid.18c",  0x50000, 0x10000, CRC(56ac7c8a) SHA1(66ed5646a2e8563caeb4ff96fa7d34fde27e9899) )
761   ROM_LOAD( "robokid.15d",  0x60000, 0x10000, CRC(cd632a4d) SHA1(a537d9ced45fdac490097e9162ac4d09a470be79) )
762   ROM_LOAD( "robokid.16d",  0x70000, 0x10000, CRC(18d92b2b) SHA1(e6d20ea8f0fac8bd4824a3b279a0fd8a1d6c26f5) )
763
764   ROM_REGION( 0x80000, REGION_GFX3, ROMREGION_DISPOSE )      /* BG2 */
765   ROM_LOAD( "robokid.12a",  0x00000, 0x10000, CRC(e64d1c10) SHA1(d1073c80c9788aba65410f88691747a37b2a9d4a) )
766   ROM_LOAD( "robokid.14a",  0x10000, 0x10000, CRC(8f9371e4) SHA1(0ea06d62bf4673ebda49a849cead832a24e5b886) )
767   ROM_LOAD( "robokid.15a",  0x20000, 0x10000, CRC(469204e7) SHA1(8c2e94635b2b304e7dfa2e6ad58ba526dcf02453) )
768   ROM_LOAD( "robokid.16a",  0x30000, 0x10000, CRC(4e340815) SHA1(d204b830c5809f25f7dfa451bbcbeda8b81ced54) )
769   ROM_LOAD( "robokid.17a",  0x40000, 0x10000, CRC(f0863106) SHA1(ff7e44d0aa5a07ec9a7eddef1a55181bd2e867b1) )
770   ROM_LOAD( "robokid.18a",  0x50000, 0x10000, CRC(fdff7441) SHA1(843b2c92bbc6f7319568677d50cbd9b03475b34a) )
771
772   ROM_REGION( 0x40000, REGION_GFX4, ROMREGION_DISPOSE )      /* sprite */
773   ROM_LOAD( "robokid.15f",  0x00000, 0x10000, CRC(ba61f5ab) SHA1(8433ddd55f0184cd5e8bb4a94a1c2336b2f8ff05) )
774   ROM_LOAD( "robokid.16f",  0x10000, 0x10000, CRC(d9b399ce) SHA1(70755c9cae27187f183ae6d61bedb95c420756f4) )
775   ROM_LOAD( "robokid.17f",  0x20000, 0x10000, CRC(afe432b9) SHA1(1ec7954ccf112eddf0ffcb8b5aec6cbc5cba7a7a) )
776   ROM_LOAD( "robokid.18f",  0x30000, 0x10000, CRC(a0aa2a84) SHA1(4d46c169429cd285644336c7d47e393b33bd8770) )
777
778   ROM_REGION( 0x08000, REGION_GFX5, ROMREGION_DISPOSE )      /* FG */
779   ROM_LOAD( "robokid.b9",   0x00000, 0x08000, CRC(fac59c3f) SHA1(1b202ad5c12982512129d9e097267dd31b984ae8) )
780ROM_END
781
782ROM_START( robokidj )
783   ROM_REGION( 0x48000, REGION_CPU1, 0 )                  /* main CPU */
784   ROM_LOAD( "1.29",         0x00000, 0x08000, CRC(59a1e2ec) SHA1(71f9d28dd8d2cf77a27fab163ce9562e3e75a540) )
785   ROM_CONTINUE(             0x10000, 0x08000 )
786   ROM_LOAD( "2.30",         0x18000, 0x10000, CRC(e3f73476) SHA1(bd1c8946d637df21432bd52ae9324255251570b9) )
787   ROM_LOAD( "robokid3.15k", 0x28000, 0x10000, CRC(05295ec3) SHA1(33dd0853a2064cb4301cfbdc7856def81f6e1223) )
788   ROM_LOAD( "robokid4.12k", 0x38000, 0x10000, CRC(3bc3977f) SHA1(da394e12d197b0e109b03c854da06b1267bd9d59) )
789
790   ROM_REGION( 0x10000, REGION_CPU2, 0 )                  /* sound CPU */
791   ROM_LOAD( "robokid.k7",   0x00000, 0x10000, CRC(f490a2e9) SHA1(861d1256c090ce3d1f45f95cc894affbbc3f1466) )
792
793   ROM_REGION( 0x80000, REGION_GFX1, ROMREGION_DISPOSE )      /* BG0 */
794   ROM_LOAD( "robokid.19c",  0x00000, 0x10000, CRC(02220421) SHA1(f533e9c6cea1dccbb60e0528c470f3cb5e8fc44e) )
795   ROM_LOAD( "robokid.20c",  0x10000, 0x10000, CRC(02d59bc2) SHA1(031acbb14145f9f4623de8868c6207fb9f8e8207) )
796   ROM_LOAD( "robokid.17d",  0x20000, 0x10000, CRC(2fa29b99) SHA1(13dce7932e2e9c03a139a4293584838aa3d9f1c3) )
797   ROM_LOAD( "robokid.18d",  0x30000, 0x10000, CRC(ae15ce02) SHA1(175e4eebdf12f1f373e01a4b1c933053ddd09abf) )
798   ROM_LOAD( "robokid.19d",  0x40000, 0x10000, CRC(784b089e) SHA1(1ae3346b4afa3da9484ebc59c8a530cb95f7d277) )
799   ROM_LOAD( "robokid.20d",  0x50000, 0x10000, CRC(b0b395ed) SHA1(31ec07634053793a701bbfd601b029f7da66e9d7) )
800   ROM_LOAD( "robokid.19f",  0x60000, 0x10000, CRC(0f9071c6) SHA1(8bf0c35189eda98a9bc150788890e136870cb5b2) )
801
802   ROM_REGION( 0x80000, REGION_GFX2, ROMREGION_DISPOSE )      /* BG1 */
803   ROM_LOAD( "robokid.12c",  0x00000, 0x10000, CRC(0ab45f94) SHA1(d8274263068d998c89a1b247dde7f814037cc15b) )
804   ROM_LOAD( "robokid.14c",  0x10000, 0x10000, CRC(029bbd4a) SHA1(8e078cdafe608fc6cde827be85c5267ade4ecca6) )
805   ROM_LOAD( "robokid.15c",  0x20000, 0x10000, CRC(7de67ebb) SHA1(2fe92e50e2894dd363e69b053db96bdb66a273eb) )
806   ROM_LOAD( "robokid.16c",  0x30000, 0x10000, CRC(53c0e582) SHA1(763e6127532d022a707bf9ddf1a832413745f248) )
807   ROM_LOAD( "robokid.17c",  0x40000, 0x10000, CRC(0cae5a1e) SHA1(a183a33516c81ea2c029b72ee6261c4519e095ab) )
808   ROM_LOAD( "robokid.18c",  0x50000, 0x10000, CRC(56ac7c8a) SHA1(66ed5646a2e8563caeb4ff96fa7d34fde27e9899) )
809   ROM_LOAD( "robokid.15d",  0x60000, 0x10000, CRC(cd632a4d) SHA1(a537d9ced45fdac490097e9162ac4d09a470be79) )
810   ROM_LOAD( "robokid.16d",  0x70000, 0x10000, CRC(18d92b2b) SHA1(e6d20ea8f0fac8bd4824a3b279a0fd8a1d6c26f5) )
811
812   ROM_REGION( 0x80000, REGION_GFX3, ROMREGION_DISPOSE )      /* BG2 */
813   ROM_LOAD( "robokid.12a",  0x00000, 0x10000, CRC(e64d1c10) SHA1(d1073c80c9788aba65410f88691747a37b2a9d4a) )
814   ROM_LOAD( "robokid.14a",  0x10000, 0x10000, CRC(8f9371e4) SHA1(0ea06d62bf4673ebda49a849cead832a24e5b886) )
815   ROM_LOAD( "robokid.15a",  0x20000, 0x10000, CRC(469204e7) SHA1(8c2e94635b2b304e7dfa2e6ad58ba526dcf02453) )
816   ROM_LOAD( "robokid.16a",  0x30000, 0x10000, CRC(4e340815) SHA1(d204b830c5809f25f7dfa451bbcbeda8b81ced54) )
817   ROM_LOAD( "robokid.17a",  0x40000, 0x10000, CRC(f0863106) SHA1(ff7e44d0aa5a07ec9a7eddef1a55181bd2e867b1) )
818   ROM_LOAD( "robokid.18a",  0x50000, 0x10000, CRC(fdff7441) SHA1(843b2c92bbc6f7319568677d50cbd9b03475b34a) )
819
820   ROM_REGION( 0x40000, REGION_GFX4, ROMREGION_DISPOSE )      /* sprite */
821   ROM_LOAD( "robokid.15f",  0x00000, 0x10000, CRC(ba61f5ab) SHA1(8433ddd55f0184cd5e8bb4a94a1c2336b2f8ff05) )
822   ROM_LOAD( "robokid.16f",  0x10000, 0x10000, CRC(d9b399ce) SHA1(70755c9cae27187f183ae6d61bedb95c420756f4) )
823   ROM_LOAD( "robokid.17f",  0x20000, 0x10000, CRC(afe432b9) SHA1(1ec7954ccf112eddf0ffcb8b5aec6cbc5cba7a7a) )
824   ROM_LOAD( "robokid.18f",  0x30000, 0x10000, CRC(a0aa2a84) SHA1(4d46c169429cd285644336c7d47e393b33bd8770) )
825
826   ROM_REGION( 0x08000, REGION_GFX5, ROMREGION_DISPOSE )      /* FG */
827   ROM_LOAD( "robokid.b9",   0x00000, 0x08000, CRC(fac59c3f) SHA1(1b202ad5c12982512129d9e097267dd31b984ae8) )
828ROM_END
829
830ROM_START( robokdj2 )
831   ROM_REGION( 0x48000, REGION_CPU1, 0 )                  /* main CPU */
832   ROM_LOAD( "1_rom29.18j",  0x00000, 0x08000, CRC(969fb951) SHA1(aa32f0cb33ba2ccbb933dab5444a7e0dbbb84b3d) )
833   ROM_CONTINUE(             0x10000, 0x08000 )
834   ROM_LOAD( "2_rom30.18k",  0x18000, 0x10000, CRC(c0228b63) SHA1(8f7e3a29a35723abc8b10bf511fc8611e31a2961) )
835   ROM_LOAD( "robokid3.15k", 0x28000, 0x10000, CRC(05295ec3) SHA1(33dd0853a2064cb4301cfbdc7856def81f6e1223) )
836   ROM_LOAD( "robokid4.12k", 0x38000, 0x10000, CRC(3bc3977f) SHA1(da394e12d197b0e109b03c854da06b1267bd9d59) )
837   ROM_COPY( REGION_CPU1 ,   0x10000, 0x8000, 0x4000 ) /* to avoid crash */
838
839   ROM_REGION( 0x10000, REGION_CPU2, 0 )                  /* sound CPU */
840   ROM_LOAD( "robokid.k7",   0x00000, 0x10000, CRC(f490a2e9) SHA1(861d1256c090ce3d1f45f95cc894affbbc3f1466) )
841
842   ROM_REGION( 0x80000, REGION_GFX1, ROMREGION_DISPOSE )      /* BG0 */
843   ROM_LOAD( "robokid.19c",  0x00000, 0x10000, CRC(02220421) SHA1(f533e9c6cea1dccbb60e0528c470f3cb5e8fc44e) )
844   ROM_LOAD( "robokid.20c",  0x10000, 0x10000, CRC(02d59bc2) SHA1(031acbb14145f9f4623de8868c6207fb9f8e8207) )
845   ROM_LOAD( "robokid.17d",  0x20000, 0x10000, CRC(2fa29b99) SHA1(13dce7932e2e9c03a139a4293584838aa3d9f1c3) )
846   ROM_LOAD( "robokid.18d",  0x30000, 0x10000, CRC(ae15ce02) SHA1(175e4eebdf12f1f373e01a4b1c933053ddd09abf) )
847   ROM_LOAD( "robokid.19d",  0x40000, 0x10000, CRC(784b089e) SHA1(1ae3346b4afa3da9484ebc59c8a530cb95f7d277) )
848   ROM_LOAD( "robokid.20d",  0x50000, 0x10000, CRC(b0b395ed) SHA1(31ec07634053793a701bbfd601b029f7da66e9d7) )
849   ROM_LOAD( "robokid.19f",  0x60000, 0x10000, CRC(0f9071c6) SHA1(8bf0c35189eda98a9bc150788890e136870cb5b2) )
850
851   ROM_REGION( 0x80000, REGION_GFX2, ROMREGION_DISPOSE )      /* BG1 */
852   ROM_LOAD( "robokid.12c",  0x00000, 0x10000, CRC(0ab45f94) SHA1(d8274263068d998c89a1b247dde7f814037cc15b) )
853   ROM_LOAD( "robokid.14c",  0x10000, 0x10000, CRC(029bbd4a) SHA1(8e078cdafe608fc6cde827be85c5267ade4ecca6) )
854   ROM_LOAD( "robokid.15c",  0x20000, 0x10000, CRC(7de67ebb) SHA1(2fe92e50e2894dd363e69b053db96bdb66a273eb) )
855   ROM_LOAD( "robokid.16c",  0x30000, 0x10000, CRC(53c0e582) SHA1(763e6127532d022a707bf9ddf1a832413745f248) )
856   ROM_LOAD( "robokid.17c",  0x40000, 0x10000, CRC(0cae5a1e) SHA1(a183a33516c81ea2c029b72ee6261c4519e095ab) )
857   ROM_LOAD( "robokid.18c",  0x50000, 0x10000, CRC(56ac7c8a) SHA1(66ed5646a2e8563caeb4ff96fa7d34fde27e9899) )
858   ROM_LOAD( "robokid.15d",  0x60000, 0x10000, CRC(cd632a4d) SHA1(a537d9ced45fdac490097e9162ac4d09a470be79) )
859   ROM_LOAD( "robokid.16d",  0x70000, 0x10000, CRC(18d92b2b) SHA1(e6d20ea8f0fac8bd4824a3b279a0fd8a1d6c26f5) )
860
861   ROM_REGION( 0x80000, REGION_GFX3, ROMREGION_DISPOSE )      /* BG2 */
862   ROM_LOAD( "robokid.12a",  0x00000, 0x10000, CRC(e64d1c10) SHA1(d1073c80c9788aba65410f88691747a37b2a9d4a) )
863   ROM_LOAD( "robokid.14a",  0x10000, 0x10000, CRC(8f9371e4) SHA1(0ea06d62bf4673ebda49a849cead832a24e5b886) )
864   ROM_LOAD( "robokid.15a",  0x20000, 0x10000, CRC(469204e7) SHA1(8c2e94635b2b304e7dfa2e6ad58ba526dcf02453) )
865   ROM_LOAD( "robokid.16a",  0x30000, 0x10000, CRC(4e340815) SHA1(d204b830c5809f25f7dfa451bbcbeda8b81ced54) )
866   ROM_LOAD( "robokid.17a",  0x40000, 0x10000, CRC(f0863106) SHA1(ff7e44d0aa5a07ec9a7eddef1a55181bd2e867b1) )
867   ROM_LOAD( "robokid.18a",  0x50000, 0x10000, CRC(fdff7441) SHA1(843b2c92bbc6f7319568677d50cbd9b03475b34a) )
868
869   ROM_REGION( 0x40000, REGION_GFX4, ROMREGION_DISPOSE )      /* sprite */
870   ROM_LOAD( "robokid.15f",  0x00000, 0x10000, CRC(ba61f5ab) SHA1(8433ddd55f0184cd5e8bb4a94a1c2336b2f8ff05) )
871   ROM_LOAD( "robokid.16f",  0x10000, 0x10000, CRC(d9b399ce) SHA1(70755c9cae27187f183ae6d61bedb95c420756f4) )
872   ROM_LOAD( "robokid.17f",  0x20000, 0x10000, CRC(afe432b9) SHA1(1ec7954ccf112eddf0ffcb8b5aec6cbc5cba7a7a) )
873   ROM_LOAD( "robokid.18f",  0x30000, 0x10000, CRC(a0aa2a84) SHA1(4d46c169429cd285644336c7d47e393b33bd8770) )
874
875   ROM_REGION( 0x08000, REGION_GFX5, ROMREGION_DISPOSE )      /* FG */
876   ROM_LOAD( "robokid.b9",   0x00000, 0x08000, CRC(fac59c3f) SHA1(1b202ad5c12982512129d9e097267dd31b984ae8) )
877ROM_END
878
879
880/*   ( YEAR  NAME      PARENT   MACHINE  INPUT    INIT      MONITOR COMPANY  FULLNAME                 FLAGS ) */
881GAME( 1988, robokid,  0,       robokid, robokid, 0,        ROT0,   "UPL",  "Atomic Robo-kid",                GAME_NO_COCKTAIL )
882GAME( 1988, robokidj, robokid, robokid, robokidj,0,        ROT0,   "UPL",  "Atomic Robo-kid (Japan, Set 1)", GAME_NO_COCKTAIL )
883GAME( 1988, robokdj2, robokid, robokid, robokidj,0,        ROT0,   "UPL",  "Atomic Robo-kid (Japan, Set 2)", GAME_NO_COCKTAIL )
884GAME( 1989, omegaf,   0,       omegaf,  omegaf,  omegaf,   ROT270, "UPL",  "Omega Fighter",          GAME_NO_COCKTAIL )
885GAME( 1989, omegafs,  omegaf,  omegaf,  omegaf,  omegaf,   ROT270, "UPL",  "Omega Fighter Special",  GAME_NO_COCKTAIL )
src/mame/drivers/ninjakid.c
r1594r1595
1/*******************************************************************************
2 Ninja Kid / Ninjakun Majou no Bouken | (c) 1984 UPL / Taito
3********************************************************************************
4 Driver by David Haywood
5 with help from Steph and Phil Stroffolino
6
7 Last Changes: 5 Mar 2001
8
9 This driver was started after interest was shown in the game by a poster at
10 various messageboards going under the name of 'ninjakid'  I decided to attempt
11 a driver for this game to gain some experience with Z80 & Multi-processor
12 games.
13
14Hold P1 Start after a reset to skip the startup memory tests.
15
16Change Log:
175 Mar - Added Saved State Support (DJH)
188 Jun - Added palette animation, Fixed FG priority. (Uki)
199 Jun - Fixed BG scroll handling, Fixed CPU clock.
20*******************************************************************************/
21
22#include "driver.h"
23#include "cpu/z80/z80.h"
24#include "sound/ay8910.h"
25
26extern WRITE8_HANDLER( ninjakid_bg_videoram_w );
27extern WRITE8_HANDLER( ninjakid_fg_videoram_w );
28extern READ8_HANDLER( ninjakid_bg_videoram_r );
29
30extern READ8_HANDLER( ninjakun_io_8000_r );
31extern WRITE8_HANDLER( ninjakun_io_8000_w );
32
33extern VIDEO_START( ninjakid );
34extern VIDEO_UPDATE( ninjakid );
35extern WRITE8_HANDLER( ninjakun_flipscreen_w );
36
37extern WRITE8_HANDLER( ninjakun_paletteram_w );
38
39/******************************************************************************/
40
41static UINT8 *ninjakid_gfx_rom;
42
43static READ8_HANDLER( ninjakid_shared_rom_r ){
44   return ninjakid_gfx_rom[offset];
45}
46
47/* working RAM is shared, but an address line is inverted */
48static UINT8 *shareram;
49
50static WRITE8_HANDLER( shareram_w ){
51   shareram[offset^0x400] = data;
52}
53static READ8_HANDLER( shareram_r ){
54   return shareram[offset^0x400];
55}
56
57/*******************************************************************************
58 0xA000 Read / Write Handlers
59*******************************************************************************/
60
61static UINT8 ninjakun_io_a002_ctrl;
62
63static READ8_HANDLER( ninjakun_io_A002_r ){
64   return ninjakun_io_a002_ctrl | readinputport(2); /* vblank */
65}
66
67static WRITE8_HANDLER( cpu1_A002_w ){
68   if( data == 0x80 ) ninjakun_io_a002_ctrl |= 0x04;
69   if( data == 0x40 ) ninjakun_io_a002_ctrl &= ~0x08;
70}
71
72static WRITE8_HANDLER( cpu2_A002_w ){
73   if( data == 0x40 ) ninjakun_io_a002_ctrl |= 0x08;
74   if( data == 0x80 ) ninjakun_io_a002_ctrl &= ~0x04;
75}
76
77/*******************************************************************************
78 Init
79*******************************************************************************/
80
81static MACHINE_START( ninjakid )
82{
83   /* Save State Stuff */
84   state_save_register_global(ninjakun_io_a002_ctrl);
85}
86
87/*******************************************************************************
88 Memory Maps
89*******************************************************************************/
90
91static ADDRESS_MAP_START( ninjakid_primary_readmem, ADDRESS_SPACE_PROGRAM, 8 )
92    AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM)
93   AM_RANGE(0x8000, 0x8003) AM_READ(ninjakun_io_8000_r)
94   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r)
95   AM_RANGE(0xa001, 0xa001) AM_READ(input_port_1_r)
96   AM_RANGE(0xa002, 0xa002) AM_READ(ninjakun_io_A002_r)
97   AM_RANGE(0xc000, 0xc7ff) AM_READ(MRA8_RAM)   /* tilemaps */
98   AM_RANGE(0xc800, 0xcfff) AM_READ(ninjakid_bg_videoram_r)
99    AM_RANGE(0xd800, 0xd9ff) AM_READ(paletteram_r)
100    AM_RANGE(0xe000, 0xe7ff) AM_READ(MRA8_RAM)
101ADDRESS_MAP_END
102
103static ADDRESS_MAP_START( ninjakid_primary_writemem, ADDRESS_SPACE_PROGRAM, 8 )
104   AM_RANGE(0x0000, 0x1fff) AM_WRITE(MWA8_ROM)
105   AM_RANGE(0x2000, 0x7fff) AM_WRITE(MWA8_ROM) AM_BASE(&ninjakid_gfx_rom)
106   AM_RANGE(0x8000, 0x8003) AM_WRITE(ninjakun_io_8000_w)
107   AM_RANGE(0xa002, 0xa002) AM_WRITE(cpu1_A002_w)
108   AM_RANGE(0xa003, 0xa003) AM_WRITE(ninjakun_flipscreen_w)
109   AM_RANGE(0xc000, 0xc7ff) AM_WRITE(ninjakid_fg_videoram_w) AM_BASE(&videoram)
110   AM_RANGE(0xc800, 0xcfff) AM_WRITE(ninjakid_bg_videoram_w)
111   AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_BASE(&spriteram) AM_SHARE(1)
112   AM_RANGE(0xd800, 0xd9ff) AM_WRITE(ninjakun_paletteram_w) AM_BASE(&paletteram)
113   AM_RANGE(0xe000, 0xe7ff) AM_WRITE(MWA8_RAM) AM_BASE(&shareram)
114ADDRESS_MAP_END
115
116static ADDRESS_MAP_START( ninjakid_secondary_readmem, ADDRESS_SPACE_PROGRAM, 8 )
117    AM_RANGE(0x0000, 0x1fff) AM_READ(MRA8_ROM)
118    AM_RANGE(0x2000, 0x7fff) AM_READ(ninjakid_shared_rom_r)
119   AM_RANGE(0x8000, 0x8003) AM_READ(ninjakun_io_8000_r)
120   AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r)
121   AM_RANGE(0xa001, 0xa001) AM_READ(input_port_1_r)
122   AM_RANGE(0xa002, 0xa002) AM_READ(ninjakun_io_A002_r)
123   AM_RANGE(0xc000, 0xc7ff) AM_READ(MRA8_RAM)      /* tilemaps */
124   AM_RANGE(0xc800, 0xcfff) AM_READ(ninjakid_bg_videoram_r)
125    AM_RANGE(0xd800, 0xd9ff) AM_READ(paletteram_r)
126    AM_RANGE(0xe000, 0xe7ff) AM_READ(shareram_r)
127ADDRESS_MAP_END
128
129static ADDRESS_MAP_START( ninjakid_secondary_writemem, ADDRESS_SPACE_PROGRAM, 8 )
130   AM_RANGE(0x0000, 0x1fff) AM_WRITE(MWA8_ROM)
131   AM_RANGE(0x8000, 0x8003) AM_WRITE(ninjakun_io_8000_w)
132   AM_RANGE(0xa002, 0xa002) AM_WRITE(cpu2_A002_w)
133   AM_RANGE(0xa003, 0xa003) AM_WRITE(ninjakun_flipscreen_w)
134   AM_RANGE(0xc000, 0xc7ff) AM_WRITE(ninjakid_fg_videoram_w)
135   AM_RANGE(0xc800, 0xcfff) AM_WRITE(ninjakid_bg_videoram_w)
136   AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_SHARE(1)
137   AM_RANGE(0xd800, 0xd9ff) AM_WRITE(ninjakun_paletteram_w)
138    AM_RANGE(0xe000, 0xe7ff) AM_WRITE(shareram_w)
139ADDRESS_MAP_END
140
141/*******************************************************************************
142 GFX Decoding Information
143*******************************************************************************/
144
145static const gfx_layout tile_layout =
146{
147   8,8,   /* tile size */
148   0x400,   /* number of tiles */
149   4,      /* bits per pixel */
150   { 0, 1, 2, 3 }, /* plane offsets */
151   { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 }, /* x offsets */
152   { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, /* y offsets */
153   256
154};
155
156static const gfx_layout sprite_layout =
157{
158   16,16,   /* tile size */
159   0x100,   /* number of tiles */
160   4,      /* bits per pixel */
161   { 0, 1, 2, 3 }, /* plane offsets */
162   {
163      0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4,
164      256+0*4, 256+1*4, 256+2*4, 256+3*4, 256+4*4, 256+5*4, 256+6*4, 256+7*4,
165   }, /* x offsets */
166   {
167      0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
168      512+0*32, 512+1*32, 512+2*32, 512+3*32, 512+4*32, 512+5*32, 512+6*32, 512+7*32
169   }, /* y offsets */
170   1024
171};
172
173static GFXDECODE_START( ninjakid )
174   GFXDECODE_ENTRY( REGION_GFX1, 0, tile_layout,      0x000, 0x10 )
175   GFXDECODE_ENTRY( REGION_GFX2, 0, tile_layout,      0x100, 0x10 )
176   GFXDECODE_ENTRY( REGION_GFX1, 0, sprite_layout,   0x200, 0x10 )
177GFXDECODE_END
178
179/*******************************************************************************
180 Machine Driver Structure(s)
181*******************************************************************************/
182
183static MACHINE_DRIVER_START( ninjakid )
184
185   /* basic machine hardware */
186   MDRV_CPU_ADD(Z80, 3000000) /* 3.00MHz */
187   MDRV_CPU_PROGRAM_MAP(ninjakid_primary_readmem,ninjakid_primary_writemem)
188   MDRV_CPU_VBLANK_INT(irq0_line_hold,1)
189
190   MDRV_CPU_ADD(Z80, 3000000) /* 3.00MHz */
191   MDRV_CPU_PROGRAM_MAP(ninjakid_secondary_readmem,ninjakid_secondary_writemem)
192   MDRV_CPU_VBLANK_INT(irq0_line_hold,4) /* ? */
193
194   MDRV_SCREEN_REFRESH_RATE(60)
195
196   MDRV_MACHINE_START(ninjakid)
197   MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION)
198   MDRV_INTERLEAVE(100)   /* 100 CPU slices per frame */
199
200    /* video hardware */
201   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
202   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
203   MDRV_SCREEN_SIZE(32*8, 32*8)
204   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, (32-4)*8-1 )
205   MDRV_GFXDECODE(ninjakid)
206   MDRV_PALETTE_LENGTH(768)
207
208   MDRV_VIDEO_START(ninjakid)
209   MDRV_VIDEO_UPDATE(ninjakid)
210
211   /* sound hardware */
212   MDRV_SPEAKER_STANDARD_MONO("mono")
213
214   MDRV_SOUND_ADD(AY8910, 6000000/2)
215   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
216
217   MDRV_SOUND_ADD(AY8910, 6000000/2)
218   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
219MACHINE_DRIVER_END
220
221/*******************************************************************************
222 Rom Definitions
223*******************************************************************************/
224
225ROM_START( ninjakun ) /* Original Board? */
226   ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* Main CPU */
227   ROM_LOAD( "ninja-1.7a",  0x0000, 0x02000, CRC(1c1dc141) SHA1(423d3ed35e73a8d5bfce075a889b0322b207bd0d) )
228   ROM_LOAD( "ninja-2.7b",  0x2000, 0x02000, CRC(39cc7d37) SHA1(7f0d0e1e92cb6a57f15eb7fc51a67112f1c5fc8e) )
229   ROM_LOAD( "ninja-3.7d",  0x4000, 0x02000, CRC(d542bfe3) SHA1(3814d8f5b1acda21438fff4f71670fa653dc7b30) )
230   ROM_LOAD( "ninja-4.7e",  0x6000, 0x02000, CRC(a57385c6) SHA1(77925a281e64889bfe967c3d42a388529aaf7eb6) )
231
232   ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* Secondary CPU */
233   ROM_LOAD( "ninja-5.7h",  0x0000, 0x02000, CRC(164a42c4) SHA1(16b434b33b76b878514f67c23315d4c6da7bfc9e) )
234
235   ROM_REGION( 0x08000, REGION_GFX1, ROMREGION_DISPOSE ) /* Graphics */
236   ROM_LOAD16_BYTE( "ninja-6.7n",  0x0000, 0x02000, CRC(a74c4297) SHA1(87184d14c67331f2c8a2412e28f31427eddae799) )
237   ROM_LOAD16_BYTE( "ninja-7.7p",  0x0001, 0x02000, CRC(53a72039) SHA1(d77d608ce9388a8956831369badd88a8eda8e102) )
238   ROM_LOAD16_BYTE( "ninja-8.7s",  0x4000, 0x02000, CRC(4a99d857) SHA1(6aadb6a5c721a161a5c1bef5569c1e323e380cff) )
239   ROM_LOAD16_BYTE( "ninja-9.7t",  0x4001, 0x02000, CRC(dede49e4) SHA1(8ce4bc02ec583b3885ca63fb5e2d5dad185fe192) )
240
241   ROM_REGION( 0x08000, REGION_GFX2, ROMREGION_DISPOSE ) /* Graphics */
242   ROM_LOAD16_BYTE( "ninja-10.2c", 0x0000, 0x02000, CRC(0d55664a) SHA1(955a607b4401ce9f3f807d53833a766152b0ef9b) )
243   ROM_LOAD16_BYTE( "ninja-11.2d", 0x0001, 0x02000, CRC(12ff9597) SHA1(10b572844ab32e3ae54abe3600fecc1a811ac713) )
244   ROM_LOAD16_BYTE( "ninja-12.4c", 0x4000, 0x02000, CRC(e9b75807) SHA1(cf4c8ac962f785e9de5502df58eab9b3725aaa28) )
245   ROM_LOAD16_BYTE( "ninja-13.4d", 0x4001, 0x02000, CRC(1760ed2c) SHA1(ee4c8efcce483c8051873714856824a1a1e14b61) )
246ROM_END
247
248/*******************************************************************************
249 Input Ports
250********************************************************************************
251 2 Sets of Controls
252 2 Sets of Dipsiwtches
253*******************************************************************************/
254
255static INPUT_PORTS_START( ninjakid )
256   PORT_START_TAG("IN0")   /* 0xa000 */
257   PORT_BIT( 0x01, IP_ACTIVE_LOW,   IPT_JOYSTICK_LEFT ) PORT_2WAY /* "XPOS1" */
258   PORT_BIT( 0x02, IP_ACTIVE_LOW,   IPT_JOYSTICK_RIGHT ) PORT_2WAY
259   PORT_BIT( 0x04, IP_ACTIVE_LOW,   IPT_BUTTON2 )
260   PORT_BIT( 0x08, IP_ACTIVE_LOW,   IPT_BUTTON1 )
261   PORT_BIT( 0x10, IP_ACTIVE_LOW,   IPT_UNKNOWN )
262   PORT_BIT( 0x20, IP_ACTIVE_LOW,   IPT_START1  )
263   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
264   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
265
266   PORT_START_TAG("IN1")   /* 0xa001 */
267   PORT_BIT( 0x01, IP_ACTIVE_LOW,   IPT_JOYSTICK_LEFT) PORT_2WAY PORT_COCKTAIL /* "YPOS1" */
268   PORT_BIT( 0x02, IP_ACTIVE_LOW,   IPT_JOYSTICK_RIGHT) PORT_2WAY PORT_COCKTAIL
269   PORT_BIT( 0x04, IP_ACTIVE_LOW,   IPT_BUTTON2 ) PORT_COCKTAIL
270   PORT_BIT( 0x08, IP_ACTIVE_LOW,   IPT_BUTTON1 ) PORT_COCKTAIL
271   PORT_BIT( 0x10, IP_ACTIVE_LOW,   IPT_UNKNOWN )
272   PORT_BIT( 0x20, IP_ACTIVE_LOW,   IPT_START2  )
273   PORT_SERVICE( 0x40, IP_ACTIVE_HIGH )
274   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 )
275
276   PORT_START_TAG("IN2")   /* 0xa002 */
277   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK )
278
279   PORT_START_TAG("DSW1")
280   PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) )
281   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
282   PORT_DIPSETTING(    0x01, DEF_STR( Cocktail ) )
283   PORT_DIPNAME( 0x06, 0x04, DEF_STR( Lives ) )
284   PORT_DIPSETTING(    0x02, "2" )
285   PORT_DIPSETTING(    0x04, "3" )
286   PORT_DIPSETTING(    0x06, "4" )
287   PORT_DIPSETTING(    0x00, "5" )
288   PORT_DIPNAME( 0x08, 0x08, "First Bonus" )
289   PORT_DIPSETTING(    0x08, "30000" )
290   PORT_DIPSETTING(    0x00, "40000" )
291   PORT_DIPNAME( 0x30, 0x30, "Second Bonus" )
292   PORT_DIPSETTING(    0x00, "No Bonus" )
293   PORT_DIPSETTING(    0x10, "Every 30000" )
294   PORT_DIPSETTING(    0x30, "Every 50000" )
295   PORT_DIPSETTING(    0x20, "Every 70000" )
296   PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) )
297   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
298   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
299   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Difficulty ) )
300   PORT_DIPSETTING(    0x80, DEF_STR( Normal ) )
301   PORT_DIPSETTING(    0x00, DEF_STR( Hard )   )
302
303   PORT_START_TAG("DSW2")
304   PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) )
305   PORT_DIPSETTING(    0x04, DEF_STR( 4C_1C ) )
306   PORT_DIPSETTING(    0x05, DEF_STR( 3C_1C ) )
307   PORT_DIPSETTING(    0x00, DEF_STR( 4C_2C ) )
308   PORT_DIPSETTING(    0x06, DEF_STR( 2C_1C ) )
309   PORT_DIPSETTING(    0x01, DEF_STR( 3C_2C ) )
310   PORT_DIPSETTING(    0x02, DEF_STR( 2C_2C ) )
311   PORT_DIPSETTING(    0x07, DEF_STR( 1C_1C ) )
312   PORT_DIPSETTING(    0x03, DEF_STR( 1C_2C ) )
313   PORT_DIPNAME( 0x08, 0x08, "High Score Names" )
314   PORT_DIPSETTING(    0x00, "3 Letters" )
315   PORT_DIPSETTING(    0x08, "8 Letters" )
316   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) )
317   PORT_DIPSETTING(    0x10, DEF_STR( No ) )
318   PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
319   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )/* Probably Unused */
320   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
321   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
322   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
323   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
324   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
325   PORT_DIPNAME( 0x80, 0x80, "Endless Game (If Free Play)" )
326   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
327   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
328INPUT_PORTS_END
329
330/*******************************************************************************
331 Game Drivers
332*******************************************************************************/
333
334GAME( 1984, ninjakun, 0, ninjakid, ninjakid, 0, ROT0, "[UPL] (Taito license)", "Ninjakun Majou no Bouken", 0 )
src/mame/drivers/mnight.c
r1594r1595
1/***************************************************************************
2
3Mutant Night
4
5driver by Leandro Dardini
6
7TODO:
8- must do palette marking, it is overflowing at the moment
9
10***************************************************************************/
11#include "driver.h"
12#include "sound/2203intf.h"
13
14WRITE8_HANDLER( mnight_bgvideoram_w );
15WRITE8_HANDLER( mnight_fgvideoram_w );
16WRITE8_HANDLER( mnight_sprite_overdraw_w );
17WRITE8_HANDLER( mnight_background_enable_w );
18VIDEO_START( mnight );
19VIDEO_UPDATE( mnight );
20
21extern UINT8    *mnight_scrolly_ram;
22extern UINT8    *mnight_scrollx_ram;
23extern UINT8    *mnight_bgenable_ram;
24extern UINT8    *mnight_spoverdraw_ram;
25extern UINT8    *mnight_background_videoram;
26extern UINT8    *mnight_foreground_videoram;
27extern size_t mnight_backgroundram_size;
28extern size_t mnight_foregroundram_size;
29
30static int mnight_bank_latch = 255, main_cpu_num;
31
32static MACHINE_RESET( mnight )
33{
34   main_cpu_num = 0;
35}
36
37static INTERRUPT_GEN( mnight_interrupt )
38{
39   cpunum_set_input_line_and_vector(0,0,HOLD_LINE,0xd7);   /* RST 10h */
40}
41
42static READ8_HANDLER( mnight_bankselect_r )
43{
44   return mnight_bank_latch;
45}
46
47static WRITE8_HANDLER( mnight_bankselect_w )
48{
49   UINT8 *RAM = memory_region(REGION_CPU1+main_cpu_num);
50   int bankaddress;
51
52   if ( data != mnight_bank_latch )
53   {
54      mnight_bank_latch = data;
55
56      bankaddress = 0x10000 + ((data & 0x7) * 0x4000);
57      memory_set_bankptr(1,&RAM[bankaddress]);    /* Select 8 banks of 16k */
58   }
59}
60
61
62static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 )
63   AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM)
64   AM_RANGE(0x8000, 0xbfff) AM_READ(MRA8_BANK1)
65   AM_RANGE(0xc000, 0xf7ff) AM_READ(MRA8_RAM)
66   AM_RANGE(0xf800, 0xf800) AM_READ(input_port_2_r)
67   AM_RANGE(0xf801, 0xf801) AM_READ(input_port_0_r)
68   AM_RANGE(0xf802, 0xf802) AM_READ(input_port_1_r)
69   AM_RANGE(0xf803, 0xf803) AM_READ(input_port_3_r)
70   AM_RANGE(0xf804, 0xf804) AM_READ(input_port_4_r)
71   AM_RANGE(0xfa00, 0xfa00) AM_READ(MRA8_RAM)
72   AM_RANGE(0xfa01, 0xfa01) AM_READ(MRA8_RAM)
73   AM_RANGE(0xfa02, 0xfa02) AM_READ(mnight_bankselect_r)
74   AM_RANGE(0xfa03, 0xfa03) AM_READ(MRA8_RAM)
75   AM_RANGE(0xfa08, 0xfa09) AM_READ(MRA8_RAM)
76   AM_RANGE(0xfa0a, 0xfa0b) AM_READ(MRA8_RAM)
77   AM_RANGE(0xfa0c, 0xfa0c) AM_READ(MRA8_RAM)
78ADDRESS_MAP_END
79
80
81static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 )
82   AM_RANGE(0x0000, 0xbfff) AM_WRITE(MWA8_ROM)
83   AM_RANGE(0xc000, 0xd9ff) AM_WRITE(MWA8_RAM)
84   AM_RANGE(0xda00, 0xdfff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
85   AM_RANGE(0xe000, 0xe7ff) AM_WRITE(mnight_bgvideoram_w) AM_BASE(&mnight_background_videoram) AM_SIZE(&mnight_backgroundram_size) // VFY
86   AM_RANGE(0xe800, 0xefff) AM_WRITE(mnight_fgvideoram_w) AM_BASE(&mnight_foreground_videoram) AM_SIZE(&mnight_foregroundram_size) //VFY
87   AM_RANGE(0xf000, 0xf5ff) AM_WRITE(paletteram_RRRRGGGGBBBBxxxx_be_w) AM_BASE(&paletteram)
88   AM_RANGE(0xf600, 0xf7ff) AM_WRITE(MWA8_RAM)
89   AM_RANGE(0xfa00, 0xfa00) AM_WRITE(soundlatch_w)
90   AM_RANGE(0xfa01, 0xfa01) AM_WRITE(MWA8_RAM)         // unknown but used
91   AM_RANGE(0xfa02, 0xfa02) AM_WRITE(mnight_bankselect_w)
92   AM_RANGE(0xfa03, 0xfa03) AM_WRITE(mnight_sprite_overdraw_w) AM_BASE(&mnight_spoverdraw_ram)
93   AM_RANGE(0xfa08, 0xfa09) AM_WRITE(MWA8_RAM) AM_BASE(&mnight_scrollx_ram)
94   AM_RANGE(0xfa0a, 0xfa0b) AM_WRITE(MWA8_RAM) AM_BASE(&mnight_scrolly_ram)
95   AM_RANGE(0xfa0c, 0xfa0c) AM_WRITE(mnight_background_enable_w) AM_BASE(&mnight_bgenable_ram)
96ADDRESS_MAP_END
97
98
99static ADDRESS_MAP_START( snd_readmem, ADDRESS_SPACE_PROGRAM, 8 )
100   AM_RANGE(0x0000, 0xbfff) AM_READ(MRA8_ROM)
101   AM_RANGE(0xc000, 0xc7ff) AM_READ(MRA8_RAM)
102   AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r)
103   AM_RANGE(0xefee, 0xefee) AM_READ(MRA8_NOP)
104ADDRESS_MAP_END
105
106
107static ADDRESS_MAP_START( snd_writemem, ADDRESS_SPACE_PROGRAM, 8 )
108   AM_RANGE(0x0000, 0xbfff) AM_WRITE(MWA8_ROM)
109   AM_RANGE(0xc000, 0xc7ff) AM_WRITE(MWA8_RAM)
110   AM_RANGE(0xeff5, 0xeff6) AM_WRITE(MWA8_NOP)            /* SAMPLE FREQUENCY ??? */
111   AM_RANGE(0xefee, 0xefee) AM_WRITE(MWA8_NOP)            /* CHIP COMMAND ?? */
112ADDRESS_MAP_END
113
114static ADDRESS_MAP_START( snd_writeport, ADDRESS_SPACE_IO, 8 )
115   ADDRESS_MAP_FLAGS( AMEF_ABITS(8) )
116   AM_RANGE(0x00, 0x00) AM_WRITE(YM2203_control_port_0_w)
117   AM_RANGE(0x01, 0x01) AM_WRITE(YM2203_write_port_0_w)
118   AM_RANGE(0x80, 0x80) AM_WRITE(YM2203_control_port_1_w)
119   AM_RANGE(0x81, 0x81) AM_WRITE(YM2203_write_port_1_w)
120ADDRESS_MAP_END
121
122
123static INPUT_PORTS_START( mnight )
124   PORT_START /* Player 1 controls */
125   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
126   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
127   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
128   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
129   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
130   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
131   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
132   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
133
134   PORT_START /* Player 2 controls */
135   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
136   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
137   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
138   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
139   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
140   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
141   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
142   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
143
144   PORT_START
145   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
146   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
147   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
148   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
149   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE )   /* keep pressed during boot to enter service mode */
150   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
151   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
152   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
153
154   PORT_START /* DSW0 */
155   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) )
156   PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
157   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
158   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Bonus_Life ) )
159   PORT_DIPSETTING(    0x02, "30k and every 50k" )
160   PORT_DIPSETTING(    0x00, "50k and every 80k" )
161   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Difficulty ) )
162   PORT_DIPSETTING(    0x04, DEF_STR( Normal ) )
163   PORT_DIPSETTING(    0x00, "Difficult" )
164   PORT_DIPNAME( 0x08, 0x08, "Free Game" )
165   PORT_DIPSETTING(    0x08, DEF_STR( Off )  )
166   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
167   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet) )
168   PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
169   PORT_DIPSETTING(    0x10, DEF_STR( Cocktail ) )
170   PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) )
171   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
172   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
173   PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
174   PORT_DIPSETTING(    0x80, "2" )
175   PORT_DIPSETTING(    0xc0, "3" )
176   PORT_DIPSETTING(    0x40, "4" )
177   PORT_DIPSETTING(    0x00, "5" )
178
179   PORT_START /* DSW1 */
180   PORT_SERVICE( 0x01, IP_ACTIVE_LOW )
181   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
182   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
183   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
184   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
185   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
186   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
187   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
188   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
189   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
190   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
191   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
192   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
193   PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) )
194   PORT_DIPSETTING(    0x00, DEF_STR( 5C_1C ) )
195   PORT_DIPSETTING(    0x20, DEF_STR( 4C_1C ) )
196   PORT_DIPSETTING(    0x40, DEF_STR( 3C_1C ) )
197   PORT_DIPSETTING(    0x60, DEF_STR( 2C_1C ) )
198   PORT_DIPSETTING(    0xe0, DEF_STR( 1C_1C ) )
199   PORT_DIPSETTING(    0xc0, DEF_STR( 1C_2C ) )
200   PORT_DIPSETTING(    0xa0, DEF_STR( 1C_3C ) )
201   PORT_DIPSETTING(    0x80, DEF_STR( 1C_4C ) )
202INPUT_PORTS_END
203
204static INPUT_PORTS_START( arkarea )
205   PORT_START /* Player 1 controls */
206   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
207   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
208   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
209   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
210   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
211   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
212   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
213   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
214
215   PORT_START /* Player 2 controls */
216   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
217   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
218   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
219   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
220   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
221   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
222   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
223   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
224
225   PORT_START
226   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
227   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
228   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
229   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
230   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_SERVICE )   /* keep pressed during boot to enter service mode */
231   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
232   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
233   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
234
235   PORT_START /* DSW0 */
236   PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coin_A ) )
237   PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
238   PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
239   PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
240   PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
241   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
242   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
243   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
244   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
245   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
246   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
247   PORT_DIPNAME( 0x10, 0x00, DEF_STR( Demo_Sounds ) )
248   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
249   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
250   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
251   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
252   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
253   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Bonus_Life ) )
254   PORT_DIPSETTING(    0x40, "50000 and every 50000" )
255   PORT_DIPSETTING(    0x00, "100000 and every 100000" )
256   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Lives ) )
257   PORT_DIPSETTING(    0x80, "3" )
258   PORT_DIPSETTING(    0x00, "4" )
259
260   PORT_START /* DSW1 */
261   PORT_SERVICE( 0x01, IP_ACTIVE_LOW )
262   PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) )
263   PORT_DIPSETTING(    0x02, DEF_STR( Off ) )
264   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
265   PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) )
266   PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
267   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
268   PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) )
269   PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
270   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
271   PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) )
272   PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
273   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
274   PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )
275   PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
276   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
277   PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) )
278   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
279   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
280   PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
281   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
282   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
283INPUT_PORTS_END
284
285
286
287static const gfx_layout charlayout =
288{
289   8,8,    /* 8*8 characters */
290   1024,    /* 1024 characters */
291   4,       /* 4 bits per pixel */
292   {0,1,2,3}, /* the bitplanes are packed in one nibble */
293   {0, 4, 16384*8+0, 16384*8+4, 8, 12, 16384*8+8, 16384*8+12},
294   {16*0, 16*1, 16*2, 16*3, 16*4, 16*5, 16*6, 16*7},
295   8*16
296};
297
298static const gfx_layout spritelayout =
299{
300   16,16,    /* 16*16 characters */
301   1536,    /* 1536 sprites */
302   4,       /* 4 bits per pixel */
303   {0,1,2,3}, /* the bitplanes are packed in one nibble */
304   {0,  4,  0x18000*8+0,  0x18000*8+4,  8, 12,  0x18000*8+8, 0x18000*8+12,
305      16*8+0, 16*8+4, 16*8+0x18000*8+0, 16*8+0x18000*8+4, 16*8+8, 16*8+12, 16*8+0x18000*8+8, 16*8+0x18000*8+12},
306   {16*0, 16*1, 16*2, 16*3, 16*4, 16*5, 16*6, 16*7,
307      32*8+16*0, 32*8+16*1, 32*8+16*2, 32*8+16*3, 32*8+16*4, 32*8+16*5, 32*8+16*6, 32*8+16*7},
308   8*64
309};
310
311static const gfx_layout bigspritelayout =
312{
313   32,32,    /* 32*32 characters */
314   384,    /* 384 sprites */
315   4,       /* 4 bits per pixel */
316   {0,1,2,3}, /* the bitplanes are packed in one nibble */
317   {0,  4,  0x18000*8+0,  0x18000*8+4,  8, 12,  0x18000*8+8, 0x18000*8+12,
318      16*8+0, 16*8+4, 16*8+0x18000*8+0, 16*8+0x18000*8+4, 16*8+8, 16*8+12, 16*8+0x18000*8+8, 16*8+0x18000*8+12,
319       64*8+0, 64*8+4, 64*8+0x18000*8+0, 64*8+0x18000*8+4, 64*8+8, 64*8+12, 64*8+0x18000*8+8, 64*8+0x18000*8+12,
320      64*8+16*8+0, 64*8+16*8+4, 64*8+16*8+0x18000*8+0, 64*8+16*8+0x18000*8+4,
321      64*8+16*8+8, 64*8+16*8+12, 64*8+16*8+0x18000*8+8, 64*8+16*8+0x18000*8+12 },
322   {16*0, 16*1, 16*2, 16*3, 16*4, 16*5, 16*6, 16*7,
323      32*8+16*0, 32*8+16*1, 32*8+16*2, 32*8+16*3, 32*8+16*4, 32*8+16*5, 32*8+16*6, 32*8+16*7,
324      128*8+16*0, 128*8+16*1, 128*8+16*2, 128*8+16*3,
325      128*8+16*4, 128*8+16*5, 128*8+16*6, 128*8+16*7,
326      128*8+32*8+16*0, 128*8+32*8+16*1, 128*8+32*8+16*2, 128*8+32*8+16*3,
327      128*8+32*8+16*4, 128*8+32*8+16*5, 128*8+32*8+16*6, 128*8+32*8+16*7 },
328   8*64*4
329};
330
331
332static GFXDECODE_START( mnight )
333   GFXDECODE_ENTRY( REGION_GFX1, 0, spritelayout,     0*16, 16)
334   GFXDECODE_ENTRY( REGION_GFX2, 0, spritelayout,    16*16, 16)
335   GFXDECODE_ENTRY( REGION_GFX2, 0, bigspritelayout, 16*16, 16)
336   GFXDECODE_ENTRY( REGION_GFX3, 0, charlayout,      32*16, 16)
337GFXDECODE_END
338
339
340static MACHINE_DRIVER_START( mnight )
341
342   /* basic machine hardware */
343   MDRV_CPU_ADD(Z80, 12000000/2)      /* 12000000/2 ??? */
344   MDRV_CPU_PROGRAM_MAP(readmem,writemem)   /* very sensitive to these settings */
345   MDRV_CPU_VBLANK_INT(mnight_interrupt,1)
346
347   MDRV_CPU_ADD(Z80, 5000000)
348   /* audio CPU */      /* 5mhz crystal ??? */
349   MDRV_CPU_PROGRAM_MAP(snd_readmem,snd_writemem)
350   MDRV_CPU_IO_MAP(0,snd_writeport)
351   MDRV_CPU_VBLANK_INT(irq0_line_hold,2)
352
353   MDRV_SCREEN_REFRESH_RATE(60)
354   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(10000))
355   MDRV_INTERLEAVE(10)
356
357   MDRV_MACHINE_RESET(mnight)
358
359   /* video hardware */
360   MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER)
361   MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
362   MDRV_SCREEN_SIZE(32*8, 32*8)
363   MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 28*8-1)
364   MDRV_GFXDECODE(mnight)
365   MDRV_PALETTE_LENGTH(768)
366
367   MDRV_VIDEO_START(mnight)
368   MDRV_VIDEO_UPDATE(mnight)
369
370   /* sound hardware */
371   MDRV_SPEAKER_STANDARD_MONO("mono")
372
373   MDRV_SOUND_ADD(YM2203, 12000000/8)
374   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
375
376   MDRV_SOUND_ADD(YM2203, 12000000/8)
377   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
378MACHINE_DRIVER_END
379
380
381ROM_START( mnight )
382   ROM_REGION( 0x30000, REGION_CPU1, 0 )
383   ROM_LOAD( "mn6-j19.bin",  0x00000, 0x8000, CRC(56678d14) SHA1(acf3a97ca29db8ab9cad69599c5567464af3ae44) )
384   ROM_LOAD( "mn5-j17.bin",  0x10000, 0x8000, CRC(2a73f88e) SHA1(0a7b769174f2b976650453d808cb23668dff0260) )
385   ROM_LOAD( "mn4-j16.bin",  0x18000, 0x8000, CRC(c5e42bb4) SHA1(1956e737ae393e987cb7e8eae520518f1e0f597f) )
386   ROM_LOAD( "mn3-j14.bin",  0x20000, 0x8000, CRC(df6a4f7a) SHA1(ce3cb84b514220d686b12c03567289fd23da0fe1) )
387   ROM_LOAD( "mn2-j12.bin",  0x28000, 0x8000, CRC(9c391d1b) SHA1(06e8c202337e3eba38c479e8b7e29a3f8ffc4ed1) )
388
389   ROM_REGION( 0x10000, REGION_CPU2, 0 )
390   ROM_LOAD( "mn1-j7.bin",   0x00000, 0x10000, CRC(a0782a31) SHA1(8abd2f0b0c2c2eb876f324f7a095a5cdc773c187) )
391
392   ROM_REGION( 0x30000, REGION_GFX1, ROMREGION_DISPOSE )
393   ROM_LOAD( "mn11-b20.bin", 0x00000, 0x4000, CRC(4d37e0f4) SHA1(a6d9aaccd97769197622cda45474e223c2ee1d98) )   // background tiles
394   ROM_CONTINUE(             0x18000, 0x4000 )
395   ROM_CONTINUE(             0x04000, 0x4000 )
396   ROM_CONTINUE(             0x1c000, 0x4000 )
397   ROM_LOAD( "mn12-b22.bin", 0x08000, 0x4000, CRC(b22cbbd3) SHA1(70984f1051fd236730d97011bc87dacb3ca38594) )
398   ROM_CONTINUE(             0x20000, 0x4000 )
399   ROM_CONTINUE(             0x0c000, 0x4000 )
400   ROM_CONTINUE(             0x24000, 0x4000 )
401   ROM_LOAD( "mn13-b23.bin", 0x10000, 0x4000, CRC(65714070) SHA1(48f3c130c97d00e8f0535904dc2237277067c475) )
402   ROM_CONTINUE(             0x28000, 0x4000 )
403   ROM_CONTINUE(             0x14000, 0x4000 )
404   ROM_CONTINUE(             0x2c000, 0x4000 )
405
406   ROM_REGION( 0x30000, REGION_GFX2, ROMREGION_DISPOSE )
407   ROM_LOAD( "mn7-e11.bin",  0x00000, 0x4000, CRC(4883059c) SHA1(53d4b9b0f0725c25e302ee1549a306778ec74d85) )     // sprites tiles
408   ROM_CONTINUE(             0x18000, 0x4000 )
409   ROM_CONTINUE(             0x04000, 0x4000 )
410   ROM_CONTINUE(             0x1c000, 0x4000 )
411   ROM_LOAD( "mn8-e12.bin",  0x08000, 0x4000, CRC(02b91445) SHA1(f0cf85f9e17c40248de16bca8df6d745e359b92d) )
412   ROM_CONTINUE(             0x20000, 0x4000 )
413   ROM_CONTINUE(             0x0c000, 0x4000 )
414   ROM_CONTINUE(             0x24000, 0x4000 )
415   ROM_LOAD( "mn9-e14.bin",  0x10000, 0x4000, CRC(9f08d160) SHA1(1a0041ad138e7e6598d4d03d7cbd52a7244557ac) )
416   ROM_CONTINUE(             0x28000, 0x4000 )
417   ROM_CONTINUE(             0x14000, 0x4000 )
418   ROM_CONTINUE(             0x2c000, 0x4000 )
419
420   ROM_REGION( 0x08000, REGION_GFX3, ROMREGION_DISPOSE )
421   ROM_LOAD( "mn10-b10.bin", 0x00000, 0x2000, CRC(37b8221f) SHA1(ac86e0ae8039fd30a028a893d08ce099f7765615) )   // foreground tiles OK
422   ROM_CONTINUE(             0x04000, 0x2000 )
423   ROM_CONTINUE(             0x02000, 0x2000 )
424   ROM_CONTINUE(             0x06000, 0x2000 )
425ROM_END
426
427ROM_START( arkarea )
428   ROM_REGION( 0x30000, REGION_CPU1, 0 )
429   ROM_LOAD( "arkarea.008",  0x00000, 0x8000, CRC(1ce1b5b9) SHA1(ab7755523d58736b124deb59779dedee870fd7d2) )
430   ROM_LOAD( "arkarea.009",  0x10000, 0x8000, CRC(db1c81d1) SHA1(64a2f51c218d84c4eaeb8c5a5a3f0f4cdf5d174c) )
431   ROM_LOAD( "arkarea.010",  0x18000, 0x8000, CRC(5a460dae) SHA1(e64d3662bb074a528cd71061621c0dd3765928b6) )
432   ROM_LOAD( "arkarea.011",  0x20000, 0x8000, CRC(63f022c9) SHA1(414f52d2b9584f08285b261d1dafcc9e6e5e0c74) )
433   ROM_LOAD( "arkarea.012",  0x28000, 0x8000, CRC(3c4c65d5) SHA1(e11f840f8b1da0933a0a4342f5fa1a17f0d6d3e2) )
434
435   ROM_REGION( 0x10000, REGION_CPU2, 0 )
436   ROM_LOAD( "arkarea.013",  0x00000, 0x8000, CRC(2d409d58) SHA1(6344b43db5459691728c3f843b643c84ea71dd8e) )
437
438   ROM_REGION( 0x30000, REGION_GFX1, ROMREGION_DISPOSE )
439   ROM_LOAD( "arkarea.003",  0x00000, 0x4000, CRC(6f45a308) SHA1(b6994fe1f50d5e9cf38d3efbd69a2c5f76f33c56) )   // background tiles
440   ROM_CONTINUE(             0x18000, 0x4000 )
441   ROM_CONTINUE(             0x04000, 0x4000 )
442   ROM_CONTINUE(             0x1c000, 0x4000 )
443   ROM_LOAD( "arkarea.002",  0x08000, 0x4000, CRC(051d3482) SHA1(3ebef1a7280f52df6d5ee34e3d4e7567aac0c165) )
444   ROM_CONTINUE(             0x20000, 0x4000 )
445   ROM_CONTINUE(             0x0c000, 0x4000 )
446   ROM_CONTINUE(             0x24000, 0x4000 )
447   ROM_LOAD( "arkarea.001",  0x10000, 0x4000, CRC(09d11ab7) SHA1(14f68e93e7173069f790493eafe9e1adc1a074cc) )
448   ROM_CONTINUE(             0x28000, 0x4000 )
449   ROM_CONTINUE(             0x14000, 0x4000 )
450   ROM_CONTINUE(             0x2c000, 0x4000 )
451
452   ROM_REGION( 0x30000, REGION_GFX2, ROMREGION_DISPOSE )
453   ROM_LOAD( "arkarea.007",  0x00000, 0x4000, CRC(d5684a27) SHA1(4961e8a5df2510afb1ef3e937d0a5d52e91893a3) )   // sprites tiles
454   ROM_CONTINUE(             0x18000, 0x4000 )
455   ROM_CONTINUE(             0x04000, 0x4000 )
456   ROM_CONTINUE(             0x1c000, 0x4000 )
457   ROM_LOAD( "arkarea.006",  0x08000, 0x4000, CRC(2c0567d6) SHA1(f36a2a3ff487660f89470516617482331f008da0) )
458   ROM_CONTINUE(             0x20000, 0x4000 )
459   ROM_CONTINUE(             0x0c000, 0x4000 )
460   ROM_CONTINUE(             0x24000, 0x4000 )
461   ROM_LOAD( "arkarea.005",  0x10000, 0x4000, CRC(9886004d) SHA1(4050756af5c00ab1a368780fe091460fd9e2cb05) )
462   ROM_CONTINUE(             0x28000, 0x4000 )
463   ROM_CONTINUE(             0x14000, 0x4000 )
464   ROM_CONTINUE(             0x2c000, 0x4000 )
465
466   ROM_REGION( 0x08000, REGION_GFX3, ROMREGION_DISPOSE )
467   ROM_LOAD( "arkarea.004",  0x00000, 0x2000, CRC(69e36af2) SHA1(2bccef8f396dcb5261af0140af04c95ee8ecae11) ) // foreground tiles OK
468   ROM_CONTINUE(             0x04000, 0x2000 )
469   ROM_CONTINUE(             0x02000, 0x2000 )
470   ROM_CONTINUE(             0x06000, 0x2000 )
471ROM_END
472
473
474
475GAME( 1987, mnight,  0, mnight, mnight,  0, ROT0, "UPL (Kawakus license)", "Mutant Night", 0 )
476GAME( 1988?,arkarea, 0, mnight, arkarea, 0, ROT0, "UPL", "Ark Area", 0 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team