From 06dece135f326ba6accc12a3315f9b2f6207d7ca Mon Sep 17 00:00:00 2001 From: Nicola Salmoria Date: Sun, 3 Feb 2008 16:06:28 +0000 Subject: [PATCH] merged nova2001, ninjakun, pkunwar, raiders5; misc cleanup --- .gitattributes | 7 +- src/mame/drivers/ninjakun.c | 306 ---------- src/mame/drivers/nova2001.c | 1080 +++++++++++++++++++++++++++++----- src/mame/drivers/pkunwar.c | 252 -------- src/mame/drivers/raiders5.c | 296 ---------- src/mame/includes/nova2001.h | 21 + src/mame/mame.mak | 3 - src/mame/video/ninjakd2.c | 25 + src/mame/video/ninjakun.c | 305 ---------- src/mame/video/nova2001.c | 436 ++++++++++---- src/mame/video/pkunwar.c | 100 ---- src/mame/video/raiders5.c | 233 -------- 12 files changed, 1290 insertions(+), 1774 deletions(-) delete mode 100644 src/mame/drivers/ninjakun.c delete mode 100644 src/mame/drivers/pkunwar.c delete mode 100644 src/mame/drivers/raiders5.c create mode 100644 src/mame/includes/nova2001.h delete mode 100644 src/mame/video/ninjakun.c delete mode 100644 src/mame/video/pkunwar.c delete mode 100644 src/mame/video/raiders5.c diff --git a/.gitattributes b/.gitattributes index c0536d290ce..ff86f47d203 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1696,7 +1696,6 @@ src/mame/drivers/neodrvr.c svneol=native#text/plain src/mame/drivers/neogeo.c svneol=native#text/plain src/mame/drivers/news.c svneol=native#text/plain src/mame/drivers/ninjakd2.c svneol=native#text/plain -src/mame/drivers/ninjakun.c svneol=native#text/plain src/mame/drivers/ninjaw.c svneol=native#text/plain src/mame/drivers/nitedrvr.c svneol=native#text/plain src/mame/drivers/niyanpai.c svneol=native#text/plain @@ -1743,7 +1742,6 @@ src/mame/drivers/pirates.c svneol=native#text/plain src/mame/drivers/pitnrun.c svneol=native#text/plain src/mame/drivers/pkscram.c svneol=native#text/plain src/mame/drivers/pktgaldx.c svneol=native#text/plain -src/mame/drivers/pkunwar.c svneol=native#text/plain src/mame/drivers/playch10.c svneol=native#text/plain src/mame/drivers/playmark.c svneol=native#text/plain src/mame/drivers/plygonet.c svneol=native#text/plain @@ -1782,7 +1780,6 @@ src/mame/drivers/r2dtank.c svneol=native#text/plain src/mame/drivers/rabbit.c svneol=native#text/plain src/mame/drivers/raiden.c svneol=native#text/plain src/mame/drivers/raiden2.c svneol=native#text/plain -src/mame/drivers/raiders5.c svneol=native#text/plain src/mame/drivers/rainbow.c svneol=native#text/plain src/mame/drivers/rallyx.c svneol=native#text/plain src/mame/drivers/rampart.c svneol=native#text/plain @@ -2238,6 +2235,7 @@ src/mame/includes/neogeo.h svneol=native#text/plain src/mame/includes/news.h svneol=native#text/plain src/mame/includes/ninjakd2.h svneol=native#text/plain src/mame/includes/nitedrvr.h svneol=native#text/plain +src/mame/includes/nova2001.h svneol=native#text/plain src/mame/includes/offtwall.h svneol=native#text/plain src/mame/includes/orbit.h svneol=native#text/plain src/mame/includes/pacman.h svneol=native#text/plain @@ -2962,7 +2960,6 @@ src/mame/video/nemesis.c svneol=native#text/plain src/mame/video/neogeo.c svneol=native#text/plain src/mame/video/news.c svneol=native#text/plain src/mame/video/ninjakd2.c svneol=native#text/plain -src/mame/video/ninjakun.c svneol=native#text/plain src/mame/video/ninjaw.c svneol=native#text/plain src/mame/video/nitedrvr.c svneol=native#text/plain src/mame/video/niyanpai.c svneol=native#text/plain @@ -2992,7 +2989,6 @@ src/mame/video/pingpong.c svneol=native#text/plain src/mame/video/pirates.c svneol=native#text/plain src/mame/video/pitnrun.c svneol=native#text/plain src/mame/video/pktgaldx.c svneol=native#text/plain -src/mame/video/pkunwar.c svneol=native#text/plain src/mame/video/playch10.c svneol=native#text/plain src/mame/video/playmark.c svneol=native#text/plain src/mame/video/plygonet.c svneol=native#text/plain @@ -3022,7 +3018,6 @@ src/mame/video/quasar.c svneol=native#text/plain src/mame/video/quizdna.c svneol=native#text/plain src/mame/video/quizpani.c svneol=native#text/plain src/mame/video/raiden.c svneol=native#text/plain -src/mame/video/raiders5.c svneol=native#text/plain src/mame/video/rallyx.c svneol=native#text/plain src/mame/video/rampart.c svneol=native#text/plain src/mame/video/rastan.c svneol=native#text/plain diff --git a/src/mame/drivers/ninjakun.c b/src/mame/drivers/ninjakun.c deleted file mode 100644 index b390d3e2fe1..00000000000 --- a/src/mame/drivers/ninjakun.c +++ /dev/null @@ -1,306 +0,0 @@ -/******************************************************************************* - Ninja Kid / Ninjakun Majou no Bouken | (c) 1984 UPL / Taito -******************************************************************************** - Driver by David Haywood - with help from Steph and Phil Stroffolino - - Last Changes: 21 Jan 2008 - - This driver was started after interest was shown in the game by a poster at - various messageboards going under the name of 'ninjakun' I decided to attempt - a driver for this game to gain some experience with Z80 & Multi-processor - games. - -Hold P1 Start after a reset to skip the startup memory tests. - -Change Log: -5 Mar - Added Saved State Support (DJH) -8 Jun - Added palette animation, Fixed FG priority. (Uki) -9 Jun - Fixed BG scroll handling, Fixed CPU clock. -*******************************************************************************/ - -#include "driver.h" -#include "cpu/z80/z80.h" -#include "sound/ay8910.h" - - -extern UINT8 *ninjakun_fg_videoram; -extern UINT8 *ninjakun_bg_videoram; - -WRITE8_HANDLER( ninjakun_bg_videoram_w ); -WRITE8_HANDLER( ninjakun_fg_videoram_w ); -READ8_HANDLER( ninjakun_bg_videoram_r ); - -READ8_HANDLER( ninjakun_io_8000_r ); -WRITE8_HANDLER( ninjakun_io_8000_w ); - -VIDEO_START( ninjakun ); -VIDEO_UPDATE( ninjakun ); -WRITE8_HANDLER( ninjakun_flipscreen_w ); - -WRITE8_HANDLER( ninjakun_paletteram_w ); - - -/******************************************************************************* - 0xA000 Read / Write Handlers -*******************************************************************************/ - -static UINT8 ninjakun_io_a002_ctrl; - -static READ8_HANDLER( ninjakun_io_A002_r ) -{ - return ninjakun_io_a002_ctrl | readinputport(2); /* vblank */ -} - -static WRITE8_HANDLER( ninjakun_cpu1_io_A002_w ) -{ - if( data == 0x80 ) ninjakun_io_a002_ctrl |= 0x04; - if( data == 0x40 ) ninjakun_io_a002_ctrl &= ~0x08; -} - -static WRITE8_HANDLER( ninjakun_cpu2_io_A002_w ) -{ - if( data == 0x40 ) ninjakun_io_a002_ctrl |= 0x08; - if( data == 0x80 ) ninjakun_io_a002_ctrl &= ~0x04; -} - -/******************************************************************************* - Init -*******************************************************************************/ - -static MACHINE_START( ninjakun ) -{ - /* Save State Stuff */ - state_save_register_global(ninjakun_io_a002_ctrl); -} - -/******************************************************************************* - Memory Maps -*******************************************************************************/ - -static ADDRESS_MAP_START( ninjakun_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x2000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0x8003) AM_READWRITE(ninjakun_io_8000_r, ninjakun_io_8000_w) - AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r) - AM_RANGE(0xa001, 0xa001) AM_READ(input_port_1_r) - AM_RANGE(0xa002, 0xa002) AM_READWRITE(ninjakun_io_A002_r, ninjakun_cpu1_io_A002_w) - AM_RANGE(0xa003, 0xa003) AM_WRITE(ninjakun_flipscreen_w) - AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(MRA8_RAM, ninjakun_fg_videoram_w) AM_BASE(&ninjakun_fg_videoram) AM_SHARE(1) - AM_RANGE(0xc800, 0xcfff) AM_READWRITE(ninjakun_bg_videoram_r, ninjakun_bg_videoram_w) AM_BASE(&ninjakun_bg_videoram) AM_SHARE(2) - AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_BASE(&spriteram) AM_SHARE(3) - AM_RANGE(0xd800, 0xd9ff) AM_READWRITE(MRA8_RAM, ninjakun_paletteram_w) AM_BASE(&paletteram) AM_SHARE(4) - AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_SHARE(5) - AM_RANGE(0xe400, 0xe7ff) AM_RAM AM_SHARE(6) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( ninjakun_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x1fff) AM_ROM - AM_RANGE(0x2000, 0x7fff) AM_ROM AM_REGION(REGION_CPU1, 0x2000) - AM_RANGE(0x8000, 0x8003) AM_READWRITE(ninjakun_io_8000_r, ninjakun_io_8000_w) - AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r) - AM_RANGE(0xa001, 0xa001) AM_READ(input_port_1_r) - AM_RANGE(0xa002, 0xa002) AM_READWRITE(ninjakun_io_A002_r, ninjakun_cpu2_io_A002_w) - AM_RANGE(0xa003, 0xa003) AM_WRITE(ninjakun_flipscreen_w) - AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(MRA8_RAM, ninjakun_fg_videoram_w) AM_SHARE(1) - AM_RANGE(0xc800, 0xcfff) AM_READWRITE(ninjakun_bg_videoram_r, ninjakun_bg_videoram_w) AM_SHARE(2) - AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_SHARE(3) - AM_RANGE(0xd800, 0xd9ff) AM_READWRITE(MRA8_RAM, ninjakun_paletteram_w) AM_SHARE(4) - AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_SHARE(6) /* swapped wrt CPU1 */ - AM_RANGE(0xe400, 0xe7ff) AM_RAM AM_SHARE(5) /* swapped wrt CPU1 */ -ADDRESS_MAP_END - -/******************************************************************************* - GFX Decoding Information -*******************************************************************************/ - -static const gfx_layout tile_layout = -{ - 8,8, /* tile size */ - 0x400, /* number of tiles */ - 4, /* bits per pixel */ - { 0, 1, 2, 3 }, /* plane offsets */ - { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 }, /* x offsets */ - { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 }, /* y offsets */ - 256 -}; - -static const gfx_layout sprite_layout = -{ - 16,16, /* tile size */ - 0x100, /* number of tiles */ - 4, /* bits per pixel */ - { 0, 1, 2, 3 }, /* plane offsets */ - { - 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4, - 256+0*4, 256+1*4, 256+2*4, 256+3*4, 256+4*4, 256+5*4, 256+6*4, 256+7*4, - }, /* x offsets */ - { - 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, - 512+0*32, 512+1*32, 512+2*32, 512+3*32, 512+4*32, 512+5*32, 512+6*32, 512+7*32 - }, /* y offsets */ - 1024 -}; - -static GFXDECODE_START( ninjakun ) - GFXDECODE_ENTRY( REGION_GFX1, 0, tile_layout, 0x000, 0x10 ) - GFXDECODE_ENTRY( REGION_GFX2, 0, tile_layout, 0x100, 0x10 ) - GFXDECODE_ENTRY( REGION_GFX1, 0, sprite_layout, 0x200, 0x10 ) -GFXDECODE_END - -/******************************************************************************* - Machine Driver Structure(s) -*******************************************************************************/ - -static MACHINE_DRIVER_START( ninjakun ) - - /* basic machine hardware */ - MDRV_CPU_ADD(Z80, 3000000) /* 3.00MHz */ - MDRV_CPU_PROGRAM_MAP(ninjakun_cpu1_map,0) - MDRV_CPU_VBLANK_INT(irq0_line_hold,1) - - MDRV_CPU_ADD(Z80, 3000000) /* 3.00MHz */ - MDRV_CPU_PROGRAM_MAP(ninjakun_cpu2_map,0) - MDRV_CPU_VBLANK_INT(irq0_line_hold,4) /* ? */ - - MDRV_SCREEN_REFRESH_RATE(60) - - MDRV_MACHINE_START(ninjakun) - MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION) - MDRV_INTERLEAVE(100) /* 100 CPU slices per frame */ - - /* video hardware */ - MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) - MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MDRV_SCREEN_SIZE(32*8, 32*8) - MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, (32-4)*8-1 ) - MDRV_GFXDECODE(ninjakun) - MDRV_PALETTE_LENGTH(768) - - MDRV_VIDEO_START(ninjakun) - MDRV_VIDEO_UPDATE(ninjakun) - - /* sound hardware */ - MDRV_SPEAKER_STANDARD_MONO("mono") - - MDRV_SOUND_ADD(AY8910, 6000000/2) - MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MDRV_SOUND_ADD(AY8910, 6000000/2) - MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) -MACHINE_DRIVER_END - -/******************************************************************************* - Rom Definitions -*******************************************************************************/ - -ROM_START( ninjakun ) /* Original Board? */ - ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* Main CPU */ - ROM_LOAD( "ninja-1.7a", 0x0000, 0x02000, CRC(1c1dc141) SHA1(423d3ed35e73a8d5bfce075a889b0322b207bd0d) ) - ROM_LOAD( "ninja-2.7b", 0x2000, 0x02000, CRC(39cc7d37) SHA1(7f0d0e1e92cb6a57f15eb7fc51a67112f1c5fc8e) ) - ROM_LOAD( "ninja-3.7d", 0x4000, 0x02000, CRC(d542bfe3) SHA1(3814d8f5b1acda21438fff4f71670fa653dc7b30) ) - ROM_LOAD( "ninja-4.7e", 0x6000, 0x02000, CRC(a57385c6) SHA1(77925a281e64889bfe967c3d42a388529aaf7eb6) ) - - ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* Secondary CPU */ - ROM_LOAD( "ninja-5.7h", 0x0000, 0x02000, CRC(164a42c4) SHA1(16b434b33b76b878514f67c23315d4c6da7bfc9e) ) - - ROM_REGION( 0x08000, REGION_GFX1, ROMREGION_DISPOSE ) /* Graphics */ - ROM_LOAD16_BYTE( "ninja-6.7n", 0x0000, 0x02000, CRC(a74c4297) SHA1(87184d14c67331f2c8a2412e28f31427eddae799) ) - ROM_LOAD16_BYTE( "ninja-7.7p", 0x0001, 0x02000, CRC(53a72039) SHA1(d77d608ce9388a8956831369badd88a8eda8e102) ) - ROM_LOAD16_BYTE( "ninja-8.7s", 0x4000, 0x02000, CRC(4a99d857) SHA1(6aadb6a5c721a161a5c1bef5569c1e323e380cff) ) - ROM_LOAD16_BYTE( "ninja-9.7t", 0x4001, 0x02000, CRC(dede49e4) SHA1(8ce4bc02ec583b3885ca63fb5e2d5dad185fe192) ) - - ROM_REGION( 0x08000, REGION_GFX2, ROMREGION_DISPOSE ) /* Graphics */ - ROM_LOAD16_BYTE( "ninja-10.2c", 0x0000, 0x02000, CRC(0d55664a) SHA1(955a607b4401ce9f3f807d53833a766152b0ef9b) ) - ROM_LOAD16_BYTE( "ninja-11.2d", 0x0001, 0x02000, CRC(12ff9597) SHA1(10b572844ab32e3ae54abe3600fecc1a811ac713) ) - ROM_LOAD16_BYTE( "ninja-12.4c", 0x4000, 0x02000, CRC(e9b75807) SHA1(cf4c8ac962f785e9de5502df58eab9b3725aaa28) ) - ROM_LOAD16_BYTE( "ninja-13.4d", 0x4001, 0x02000, CRC(1760ed2c) SHA1(ee4c8efcce483c8051873714856824a1a1e14b61) ) -ROM_END - -/******************************************************************************* - Input Ports -******************************************************************************** - 2 Sets of Controls - 2 Sets of Dipsiwtches -*******************************************************************************/ - -static INPUT_PORTS_START( ninjakun ) - PORT_START_TAG("IN0") /* 0xa000 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY /* "XPOS1" */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) - - PORT_START_TAG("IN1") /* 0xa001 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_2WAY PORT_COCKTAIL /* "YPOS1" */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_2WAY PORT_COCKTAIL - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) - PORT_SERVICE( 0x40, IP_ACTIVE_HIGH ) - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 ) - - PORT_START_TAG("IN2") /* 0xa002 */ - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK ) - - PORT_START_TAG("DSW1") - PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) - PORT_DIPNAME( 0x06, 0x04, DEF_STR( Lives ) ) - PORT_DIPSETTING( 0x02, "2" ) - PORT_DIPSETTING( 0x04, "3" ) - PORT_DIPSETTING( 0x06, "4" ) - PORT_DIPSETTING( 0x00, "5" ) - PORT_DIPNAME( 0x08, 0x08, "First Bonus" ) - PORT_DIPSETTING( 0x08, "30000" ) - PORT_DIPSETTING( 0x00, "40000" ) - PORT_DIPNAME( 0x30, 0x30, "Second Bonus" ) - PORT_DIPSETTING( 0x00, "No Bonus" ) - PORT_DIPSETTING( 0x10, "Every 30000" ) - PORT_DIPSETTING( 0x30, "Every 50000" ) - PORT_DIPSETTING( 0x20, "Every 70000" ) - PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Difficulty ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Normal ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) - - PORT_START_TAG("DSW2") - PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) - PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) ) - PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) ) - PORT_DIPSETTING( 0x00, DEF_STR( 4C_2C ) ) - PORT_DIPSETTING( 0x06, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x01, DEF_STR( 3C_2C ) ) - PORT_DIPSETTING( 0x02, DEF_STR( 2C_2C ) ) - PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x03, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x08, 0x08, "High Score Names" ) - PORT_DIPSETTING( 0x00, "3 Letters" ) - PORT_DIPSETTING( 0x08, "8 Letters" ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) ) - PORT_DIPSETTING( 0x10, DEF_STR( No ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )/* Probably Unused */ - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "Endless Game (If Free Play)" ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -INPUT_PORTS_END - -/******************************************************************************* - Game Drivers -*******************************************************************************/ - -GAME( 1984, ninjakun, 0, ninjakun, ninjakun, 0, ROT0, "[UPL] (Taito license)", "Ninjakun Majou no Bouken", 0 ) diff --git a/src/mame/drivers/nova2001.c b/src/mame/drivers/nova2001.c index 3a21a9296c2..6af9a9f8d7d 100644 --- a/src/mame/drivers/nova2001.c +++ b/src/mame/drivers/nova2001.c @@ -1,64 +1,182 @@ -/******************************************************************************* +/****************************************************************************** - Nova 2001 - by UPL - 1983 +UPL "orthogonal palette" hardware - driver by Howie Cohen, Frank Palazzolo, Alex Pasadyn +driver by Howie Cohen, Frank Palazzolo, Alex Pasadyn, David Haywood, Steph, Phil Stroffolino, Uki - Memory Map: +The peculiar feature of this hardware is the palette layout. 16 colors are +arranged in a 16x16 matrix, with all columns containing a single color, except +for column 1, which is a copy of row 1. Essentially, the 4bpp graphics are +drawn using a fixed palette except for one color that changes. +Nova 2001 and Penguin Kun Wars have palette PROMs and the effect applies to both +tilemaps and sprites. Ninjakun and Raiders5 have palette RAM and the effect +applies only to sprites while tilemaps use a normal palette. - Address Range: R/W: Function: - -------------------------------------------------------------------------- - 0000 - 7fff R Program ROM (7000-7fff mirror of 6000-6fff) - a000 - a3ff R/W Foreground Playfield character RAM - a400 - a7ff R/W Foreground Playfield color modifier RAM - a800 - abff R/W Scrolling Playfield character RAM - ac00 - a7ff R/W Scrolling Playfield color modifier RAM - b000 - b7ff R/W Sprite RAM - bfff W flip screen - c000 R/W AY8910 #1 Data R/W - c001 R/W AY8910 #2 Data R/W - c002 W AY8910 #1 Control W - c003 W AY8910 #2 Control W - c004 R Interrupt acknowledge / Watchdog reset - c006 R Player 1 Controls - c007 R Player 2 Controls - c00e R Coin Inputs, etc. - e000 - e7ff R/W Work RAM - the parent set is VERY sensitive to coin inputs, if the coin isn't held down - long enough, or is held down too long the game will reset, likewise if coins - are inserted too quickly +Another peculiar characteristic is that in the later scrolling games (that is +Ninjakun and Raiders5, but not Nova 2001) the bg scroll registers are added to +the videoram address not only when the video circuitry is accessing it, as +usually happens, but also when the CPU is accessing it. -*******************************************************************************/ + +Game Board +------------------------ --------- +Nova 2001 UPL-83005 +Ninjakun Majou no Bouken UPL-84003 +Penguin Kun Wars UPL-????? +Raiders5 UPL-85004 + +Hardware Overview: +------------------ +1xZ80 @ 3MHz (2x in Ninjakun and Raiders5) +2xAY8910 @ various frequencies + +Resolution: 256x192 +64 sprites +Tilemaps: fg 256x256 (8x8) + bg 256x256 (8x8) (Penguin Kun Wars has only one) + + +Designers: +---------- +Nova 2001: +* Staff : Ryuichi Nishizawa (Bucha), HAL, Fukushi, Hiromi + +Penguin Kun Wars: +* Tsutomu Fuzisawa, Ogata, Nobuyuki Narita, Kosikawa + +Ninjakun Majou no Bouken: +* Staff : Ryuichi Nishizawa (Bucha), Todo, Fukushi, Tsutomu Fuzisawa, Tateno + +Raiders5: +* Staff : Tsutomu Fuzisawa, Suzuko, Naotsugu +* Game, software and character design by : Ryuichi Nishizawa +* Hardware and effect design by : Nobuyuki Narita + + +Notes: +------ +- nova2001 is VERY sensitive to coin inputs, if the coin isn't held down long + enough, or is held down too long the game will reset, likewise if coins are + inserted too quickly. This only happens in nova2001 and not in nova2001u. + +- Nova 2001 draws black bars on the sides of the screen so the visible area becomes + 240x192, however the physical resolution is still 256x192, the game probably does + that to avoid wraparound glitches in the background without having to care about + the sprite X MSB. + +- In Ninjakun, hold P1 Start after a reset to skip the startup memory tests. + +- The production year of Penguin Kun Wars is uncertain since it's not shown on + screen. The console/home computer ports were made by ASCII in 1985, and the + Ninjakun character appears in the audience (just on the left of the timer) so + this game must have been produced after Ninjakun. This restricts the possibilities + to 1985 or 1984. + +- Penguin Kun Wars has some tile/sprite priority issues that have been verified + to happen on the real board (e.g. the blob thing that moves in the middle of + the table is not obscured by the text box at the end of a set). + +TODO: +----- +- The Nova 2001 schematics show a FG priority bit, which should control priority + over sprites. However that bit is set by the game only during the screen fade + effect at the end of a level, so it would make the score area appear below + the sprites, which definitely doesn't look right. For this reason, the priority + bit is implemented in the video driver but it is ignored and the FG is always + drawn above sprites. + +- In Ninjakun, some garbage is drawn behind the GAME OVER text at the end of a + game. Correct behaviour? + +- The IRQ source of Ninjakun and Raiders5 CPU 2 is unknown. + +- Several unknown memory read accesses in Raiders5. + +******************************************************************************* + +Nova 2001 Memory Map: + +Address Range: R/W: Function: +-------------------------------------------------------------------------- +0000 - 7fff R Program ROM (7000-7fff mirror of 6000-6fff) +a000 - a3ff R/W Foreground Playfield character RAM +a400 - a7ff R/W Foreground Playfield color modifier RAM +a800 - abff R/W Scrolling Playfield character RAM +ac00 - a7ff R/W Scrolling Playfield color modifier RAM +b000 - b7ff R/W Sprite RAM +bfff W flip screen +c000 R/W AY8910 #1 Data R/W +c001 R/W AY8910 #2 Data R/W +c002 W AY8910 #1 Control W +c003 W AY8910 #2 Control W +c004 R Interrupt acknowledge / Watchdog reset +c006 R Player 1 Controls +c007 R Player 2 Controls +c00e R Coin Inputs, etc. +e000 - e7ff R/W Work RAM + +******************************************************************************/ #include "driver.h" #include "sound/ay8910.h" +#include "nova2001.h" -/* From video/nova2001.c */ -extern UINT8 *nova2001_videoram2, *nova2001_colorram2; - -extern WRITE8_HANDLER( nova2001_videoram_w ); -extern WRITE8_HANDLER( nova2001_colorram_w ); -extern WRITE8_HANDLER( nova2001_videoram2_w ); -extern WRITE8_HANDLER( nova2001_colorram2_w ); -extern WRITE8_HANDLER( nova2001_scroll_x_w ); -extern WRITE8_HANDLER( nova2001_scroll_y_w ); -extern WRITE8_HANDLER( nova2001_flipscreen_w ); - -extern PALETTE_INIT( nova2001 ); -extern VIDEO_START( nova2001 ); -extern VIDEO_UPDATE( nova2001 ); +#define MAIN_CLOCK XTAL_12MHz +/************************************* + * + * Ninjakun 0xA000 Read / Write Handlers + * + *************************************/ + +static UINT8 ninjakun_io_a002_ctrl; + +static READ8_HANDLER( ninjakun_io_A002_r ) +{ + return ninjakun_io_a002_ctrl | readinputport(2); /* vblank */ +} + +static WRITE8_HANDLER( ninjakun_cpu1_io_A002_w ) +{ + if( data == 0x80 ) ninjakun_io_a002_ctrl |= 0x04; + if( data == 0x40 ) ninjakun_io_a002_ctrl &= ~0x08; +} + +static WRITE8_HANDLER( ninjakun_cpu2_io_A002_w ) +{ + if( data == 0x40 ) ninjakun_io_a002_ctrl |= 0x08; + if( data == 0x80 ) ninjakun_io_a002_ctrl &= ~0x04; +} + + + +/************************************* + * + * Init + * + *************************************/ + +static MACHINE_START( ninjakun ) +{ + /* Save State Stuff */ + state_save_register_global(ninjakun_io_a002_ctrl); +} + + + +/************************************* + * + * Memory maps + * + *************************************/ static ADDRESS_MAP_START( nova2001_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0xa000, 0xa3ff) AM_RAM AM_WRITE(nova2001_videoram2_w) AM_BASE(&nova2001_videoram2) - AM_RANGE(0xa400, 0xa7ff) AM_RAM AM_WRITE(nova2001_colorram2_w) AM_BASE(&nova2001_colorram2) - AM_RANGE(0xa800, 0xabff) AM_RAM AM_WRITE(nova2001_videoram_w) AM_BASE(&videoram) - AM_RANGE(0xac00, 0xafff) AM_RAM AM_WRITE(nova2001_colorram_w) AM_BASE(&colorram) - AM_RANGE(0xb000, 0xb7ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) - AM_RANGE(0xbfff, 0xbfff) AM_WRITE(nova2001_flipscreen_w) + AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_WRITE(nova2001_fg_videoram_w) AM_BASE(&nova2001_fg_videoram) + AM_RANGE(0xa800, 0xafff) AM_RAM AM_WRITE(nova2001_bg_videoram_w) AM_BASE(&nova2001_bg_videoram) + AM_RANGE(0xb000, 0xb7ff) AM_RAM AM_BASE(&spriteram) + AM_RANGE(0xb800, 0xbfff) AM_WRITE(nova2001_flipscreen_w) AM_RANGE(0xc000, 0xc000) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w) AM_RANGE(0xc001, 0xc001) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w) AM_RANGE(0xc002, 0xc002) AM_WRITE(AY8910_control_port_0_w) @@ -71,140 +189,516 @@ static ADDRESS_MAP_START( nova2001_map, ADDRESS_SPACE_PROGRAM, 8 ) ADDRESS_MAP_END +static ADDRESS_MAP_START( ninjakun_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x2000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0x8000) AM_WRITE(AY8910_control_port_0_w) + AM_RANGE(0x8001, 0x8001) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w) + AM_RANGE(0x8002, 0x8002) AM_WRITE(AY8910_control_port_1_w) + AM_RANGE(0x8003, 0x8003) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w) + AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r) + AM_RANGE(0xa001, 0xa001) AM_READ(input_port_1_r) + AM_RANGE(0xa002, 0xa002) AM_READWRITE(ninjakun_io_A002_r, ninjakun_cpu1_io_A002_w) + AM_RANGE(0xa003, 0xa003) AM_WRITE(pkunwar_flipscreen_w) + AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(MRA8_RAM, nova2001_fg_videoram_w) AM_BASE(&nova2001_fg_videoram) AM_SHARE(1) + AM_RANGE(0xc800, 0xcfff) AM_READWRITE(ninjakun_bg_videoram_r, ninjakun_bg_videoram_w) AM_BASE(&nova2001_bg_videoram) AM_SHARE(2) + AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_BASE(&spriteram) AM_SHARE(3) + AM_RANGE(0xd800, 0xd9ff) AM_READWRITE(MRA8_RAM, ninjakun_paletteram_w) AM_BASE(&paletteram) AM_SHARE(4) + AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_SHARE(5) + AM_RANGE(0xe400, 0xe7ff) AM_RAM AM_SHARE(6) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ninjakun_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x2000, 0x7fff) AM_ROM AM_REGION(REGION_CPU1, 0x2000) + AM_RANGE(0x8000, 0x8000) AM_WRITE(AY8910_control_port_0_w) + AM_RANGE(0x8001, 0x8001) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w) + AM_RANGE(0x8002, 0x8002) AM_WRITE(AY8910_control_port_1_w) + AM_RANGE(0x8003, 0x8003) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w) + AM_RANGE(0xa000, 0xa000) AM_READ(input_port_0_r) + AM_RANGE(0xa001, 0xa001) AM_READ(input_port_1_r) + AM_RANGE(0xa002, 0xa002) AM_READWRITE(ninjakun_io_A002_r, ninjakun_cpu2_io_A002_w) + AM_RANGE(0xa003, 0xa003) AM_WRITE(nova2001_flipscreen_w) + AM_RANGE(0xc000, 0xc7ff) AM_READWRITE(MRA8_RAM, nova2001_fg_videoram_w) AM_SHARE(1) + AM_RANGE(0xc800, 0xcfff) AM_READWRITE(ninjakun_bg_videoram_r, ninjakun_bg_videoram_w) AM_SHARE(2) + AM_RANGE(0xd000, 0xd7ff) AM_RAM AM_SHARE(3) + AM_RANGE(0xd800, 0xd9ff) AM_READWRITE(MRA8_RAM, ninjakun_paletteram_w) AM_SHARE(4) + AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_SHARE(6) /* swapped wrt CPU1 */ + AM_RANGE(0xe400, 0xe7ff) AM_RAM AM_SHARE(5) /* swapped wrt CPU1 */ +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( pkunwar_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE(&spriteram) + AM_RANGE(0x8800, 0x8fff) AM_RAM AM_WRITE(nova2001_bg_videoram_w) AM_BASE(&nova2001_bg_videoram) + AM_RANGE(0xa000, 0xa000) AM_WRITE(&AY8910_control_port_0_w) + AM_RANGE(0xa001, 0xa001) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w) + AM_RANGE(0xa002, 0xa002) AM_WRITE(AY8910_control_port_1_w) + AM_RANGE(0xa003, 0xa003) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w) + AM_RANGE(0xc000, 0xc7ff) AM_RAM + AM_RANGE(0xe000, 0xffff) AM_ROM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( pkunwar_io, ADDRESS_SPACE_IO, 8 ) + ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) + AM_RANGE(0x00, 0x00) AM_WRITE(pkunwar_flipscreen_w) +ADDRESS_MAP_END + + +static ADDRESS_MAP_START( raiders5_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE(&spriteram) + AM_RANGE(0x8800, 0x8fff) AM_RAM AM_WRITE(nova2001_fg_videoram_w) AM_BASE(&nova2001_fg_videoram) + AM_RANGE(0x9000, 0x97ff) AM_READWRITE(ninjakun_bg_videoram_r, ninjakun_bg_videoram_w) AM_BASE(&nova2001_bg_videoram) + AM_RANGE(0xa000, 0xa000) AM_WRITE(nova2001_scroll_x_w) + AM_RANGE(0xa001, 0xa001) AM_WRITE(nova2001_scroll_y_w) + AM_RANGE(0xa002, 0xa002) AM_WRITE(pkunwar_flipscreen_w) + AM_RANGE(0xc000, 0xc000) AM_WRITE(AY8910_control_port_0_w) + AM_RANGE(0xc001, 0xc001) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w) + AM_RANGE(0xc002, 0xc002) AM_WRITE(AY8910_control_port_1_w) + AM_RANGE(0xc003, 0xc003) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w) + AM_RANGE(0xd000, 0xd1ff) AM_READWRITE(MRA8_RAM, ninjakun_paletteram_w) AM_BASE(&paletteram) + AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE(1) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( raiders5_cpu2_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x3fff) AM_ROM + AM_RANGE(0x8000, 0x8000) AM_WRITE(AY8910_control_port_0_w) + AM_RANGE(0x8001, 0x8001) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w) + AM_RANGE(0x8002, 0x8002) AM_WRITE(AY8910_control_port_1_w) + AM_RANGE(0x8003, 0x8003) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w) + AM_RANGE(0x9000, 0x9000) AM_READ(MRA8_NOP) /* unknown */ + AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_SHARE(1) + AM_RANGE(0xc000, 0xc000) AM_READ(MRA8_NOP) /* unknown */ + AM_RANGE(0xc800, 0xc800) AM_READ(MRA8_NOP) /* unknown */ + AM_RANGE(0xd000, 0xd000) AM_READ(MRA8_NOP) /* unknown */ + AM_RANGE(0xe000, 0xe000) AM_WRITE(nova2001_scroll_x_w) + AM_RANGE(0xe001, 0xe001) AM_WRITE(nova2001_scroll_y_w) + AM_RANGE(0xe002, 0xe002) AM_WRITE(pkunwar_flipscreen_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( raiders5_io, ADDRESS_SPACE_IO, 8 ) + AM_RANGE(0x00, 0x00) AM_READ(MRA8_NOP) /* unknown */ +ADDRESS_MAP_END + + + +/************************************* + * + * Port definitions + * + *************************************/ static INPUT_PORTS_START( nova2001 ) - PORT_START - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) // pause - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) // fire + PORT_START + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY + PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) // pause + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) // fire - PORT_START - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_START + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x30, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL - PORT_START + PORT_START PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(4) PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0x78, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START2 ) + PORT_BIT( 0x78, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK ) - PORT_START /* dsw0 */ - PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Lives ) ) - PORT_DIPSETTING( 0x02, "3" ) - PORT_DIPSETTING( 0x00, "4" ) - PORT_DIPNAME( 0x04, 0x04, "1st Bonus Life" ) - PORT_DIPSETTING( 0x04, "20K" ) - PORT_DIPSETTING( 0x00, "30K" ) - PORT_DIPNAME( 0x18, 0x18, "Extra Bonus Life" ) - PORT_DIPSETTING( 0x18, "60K" ) - PORT_DIPSETTING( 0x10, "70K" ) - PORT_DIPSETTING( 0x08, "90K" ) - PORT_DIPSETTING( 0x00, DEF_STR( None ) ) - PORT_DIPNAME( 0x60, 0x60, DEF_STR( Coinage ) ) - PORT_DIPSETTING( 0x40, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x00, DEF_STR( 2C_2C ) ) - PORT_DIPSETTING( 0x60, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x20, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_START /* dsw0 */ + PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:1") + PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2") + PORT_DIPSETTING( 0x02, "3" ) + PORT_DIPSETTING( 0x00, "4" ) + PORT_DIPNAME( 0x04, 0x04, "1st Bonus Life" ) PORT_DIPLOCATION("SW1:3") + PORT_DIPSETTING( 0x04, "20K" ) + PORT_DIPSETTING( 0x00, "30K" ) + PORT_DIPNAME( 0x18, 0x18, "Extra Bonus Life" ) PORT_DIPLOCATION("SW1:4,5") + PORT_DIPSETTING( 0x18, "60K" ) + PORT_DIPSETTING( 0x10, "70K" ) + PORT_DIPSETTING( 0x08, "90K" ) + PORT_DIPSETTING( 0x00, DEF_STR( None ) ) + PORT_DIPNAME( 0x60, 0x60, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:6,7") + PORT_DIPSETTING( 0x40, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x00, DEF_STR( 2C_2C ) ) + PORT_DIPSETTING( 0x60, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x20, DEF_STR( 1C_2C ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW1:8") + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_START /* dsw1 */ - PORT_DIPNAME( 0x03, 0x00, DEF_STR( Difficulty ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Easy ) ) - PORT_DIPSETTING( 0x03, DEF_STR( Medium ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Hard ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Hardest ) ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_START /* dsw1 */ + PORT_DIPNAME( 0x03, 0x00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:1,2") + PORT_DIPSETTING( 0x00, DEF_STR( Easy ) ) + PORT_DIPSETTING( 0x03, DEF_STR( Medium ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Hard ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Hardest ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:3") + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, "High Score Names" ) PORT_DIPLOCATION("SW2:4") + PORT_DIPSETTING( 0x00, "3 Letters" ) + PORT_DIPSETTING( 0x08, "8 Letters" ) + PORT_DIPUNUSED_DIPLOC( 0x10, IP_ACTIVE_LOW, "SW2:5" ) + PORT_DIPUNUSED_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW2:6" ) + PORT_DIPUNUSED_DIPLOC( 0x40, IP_ACTIVE_LOW, "SW2:7" ) + PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW2:8" ) +INPUT_PORTS_END + +static INPUT_PORTS_START( ninjakun ) + PORT_START_TAG("IN0") /* 0xa000 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY /* "XPOS1" */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) + + PORT_START_TAG("IN1") /* 0xa001 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT) PORT_2WAY PORT_COCKTAIL /* "YPOS1" */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT) PORT_2WAY PORT_COCKTAIL + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) + PORT_SERVICE( 0x40, IP_ACTIVE_HIGH ) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_COIN1 ) + + PORT_START_TAG("IN2") /* 0xa002 */ + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_VBLANK ) + + PORT_START_TAG("DSW1") + PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) + PORT_DIPNAME( 0x06, 0x04, DEF_STR( Lives ) ) + PORT_DIPSETTING( 0x02, "2" ) + PORT_DIPSETTING( 0x04, "3" ) + PORT_DIPSETTING( 0x06, "4" ) + PORT_DIPSETTING( 0x00, "5" ) + PORT_DIPNAME( 0x08, 0x08, "First Bonus" ) + PORT_DIPSETTING( 0x08, "30000" ) + PORT_DIPSETTING( 0x00, "40000" ) + PORT_DIPNAME( 0x30, 0x30, "Second Bonus" ) + PORT_DIPSETTING( 0x00, "No Bonus" ) + PORT_DIPSETTING( 0x10, "Every 30000" ) + PORT_DIPSETTING( 0x30, "Every 50000" ) + PORT_DIPSETTING( 0x20, "Every 70000" ) + PORT_DIPNAME( 0x40, 0x00, DEF_STR( Demo_Sounds ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Difficulty ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) + + PORT_START_TAG("DSW2") + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) + PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x00, DEF_STR( 4C_2C ) ) + PORT_DIPSETTING( 0x06, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x01, DEF_STR( 3C_2C ) ) + PORT_DIPSETTING( 0x02, DEF_STR( 2C_2C ) ) + PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x03, DEF_STR( 1C_2C ) ) PORT_DIPNAME( 0x08, 0x08, "High Score Names" ) PORT_DIPSETTING( 0x00, "3 Letters" ) PORT_DIPSETTING( 0x08, "8 Letters" ) - PORT_BIT( 0x70, IP_ACTIVE_LOW, IPT_UNUSED ) - PORT_SERVICE( 0x80, IP_ACTIVE_LOW ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Allow_Continue ) ) + PORT_DIPSETTING( 0x10, DEF_STR( No ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) )/* Probably Unused */ + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "Infinite Lives (If Free Play)" ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + +static INPUT_PORTS_START( pkunwar ) + PORT_START /* IN0 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK ) + + PORT_START /* IN1 */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) + PORT_SERVICE( 0x40, IP_ACTIVE_LOW ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) + + PORT_START /* DSW0 */ + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START /* DSW1 */ + PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) + PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) ) + PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Cocktail ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x08, DEF_STR( On ) ) + PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Easy ) ) + PORT_DIPSETTING( 0x30, DEF_STR( Medium ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Hard ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) +INPUT_PORTS_END + +static INPUT_PORTS_START( raiders5 ) + PORT_START + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY + + PORT_START + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5) + PORT_SERVICE( 0x40, IP_ACTIVE_LOW ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL + + PORT_START /* DSW1 */ + PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) + PORT_DIPNAME( 0x06, 0x06, DEF_STR( Lives ) ) + PORT_DIPSETTING( 0x00, "2" ) + PORT_DIPSETTING( 0x06, "3" ) + PORT_DIPSETTING( 0x04, "4" ) + PORT_DIPSETTING( 0x02, "5" ) + PORT_DIPNAME( 0x08, 0x08, "1st Bonus" ) + PORT_DIPSETTING( 0x08, "30000" ) + PORT_DIPSETTING( 0x00, "40000" ) + PORT_DIPNAME( 0x30, 0x30, "2nd Bonus" ) + PORT_DIPSETTING( 0x30, "Every(?) 50000" ) + PORT_DIPSETTING( 0x20, "Every(?) 70000" ) + PORT_DIPSETTING( 0x10, "Every(?) 90000" ) + PORT_DIPSETTING( 0x00, DEF_STR( None ) ) + PORT_DIPNAME( 0x40, 0x40, "Exercise" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x40, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, DEF_STR( Difficulty ) ) + PORT_DIPSETTING( 0x80, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) + + PORT_START /* DSW2*/ + PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) + PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x00, DEF_STR( 4C_2C ) ) + PORT_DIPSETTING( 0x06, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x01, DEF_STR( 3C_2C ) ) + PORT_DIPSETTING( 0x02, DEF_STR( 2C_2C ) ) + PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x03, DEF_STR( 1C_2C ) ) + PORT_DIPNAME( 0x08, 0x08, "High Score Names" ) + PORT_DIPSETTING( 0x00, "3 Letters" ) + PORT_DIPSETTING( 0x08, "8 Letters" ) + PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) ) + PORT_DIPSETTING( 0x00, DEF_STR( No ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "Unlimited Lives (If Free Play)" ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + INPUT_PORTS_END -static const gfx_layout charlayout = +/************************************* + * + * Graphics layouts + * + *************************************/ + +static const gfx_layout layout8x8 = { - 8,8, /* 8*8 characters */ - 256, /* 256 characters */ - 4, /* 4 bits per pixel */ - {0,1,2,3 }, /* the bitplanes are packed in one nibble */ - {0, 4, 8192*8+0, 8192*8+4, 8, 12, 8192*8+8, 8192*8+12}, - {16*0, 16*1, 16*2, 16*3, 16*4, 16*5, 16*6, 16*7}, - 8*16 + 8,8, + RGN_FRAC(1,1), + 4, + { STEP4(0,1) }, + { STEP8(0,4) }, + { STEP8(0,32) }, + 32*8 }; -static const gfx_layout spritelayout = +static const gfx_layout layout8x8_part = { - 16,16, /* 16*16 characters */ - 128, /* 128 sprites */ - 4, /* 4 bits per pixel */ - {0,1,2,3}, /* the bitplanes are packed in one nibble */ - {0, 4, 8192*8+0, 8192*8+4, 8, 12, 8192*8+8, 8192*8+12, - 16*8+0, 16*8+4, 16*8+8192*8+0, 16*8+8192*8+4, 16*8+8, 16*8+12, 16*8+8192*8+8, 16*8+8192*8+12}, - {16*0, 16*1, 16*2, 16*3, 16*4, 16*5, 16*6, 16*7, - 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}, - 8*64 + 8,8, + RGN_FRAC(1,4), + 4, + { STEP4(0,1) }, + { STEP8(0,4) }, + { STEP8(0,32) }, + 32*8 +}; + +static const gfx_layout layout16x16 = +{ + 16,16, + RGN_FRAC(1,1), + 4, + { STEP4(0,1) }, + { STEP8(0,4), STEP8(32*8,4) }, + { STEP8(0,32), STEP8(64*8,32) }, + 128*8 }; static GFXDECODE_START( nova2001 ) - GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout, 0, 16 ) - GFXDECODE_ENTRY( REGION_GFX2, 0x0000, charlayout, 16*16, 16 ) - GFXDECODE_ENTRY( REGION_GFX1, 0x0000, spritelayout, 0, 16 ) - GFXDECODE_ENTRY( REGION_GFX2, 0x0000, spritelayout, 0, 16 ) + GFXDECODE_ENTRY( REGION_GFX1, 0x0000, layout16x16, 0x000, 16 ) // sprites + GFXDECODE_ENTRY( REGION_GFX1, 0x0000, layout8x8_part, 0x000, 16 ) // fg tiles (using only 1/4th of the ROM space) + GFXDECODE_ENTRY( REGION_GFX1, 0x4000, layout8x8_part, 0x100, 16 ) // bg tiles (using only 1/4th of the ROM space) +GFXDECODE_END + +static GFXDECODE_START( ninjakun ) + GFXDECODE_ENTRY( REGION_GFX1, 0, layout16x16, 0x200, 16 ) // sprites + GFXDECODE_ENTRY( REGION_GFX1, 0, layout8x8, 0x000, 16 ) // fg tiles + GFXDECODE_ENTRY( REGION_GFX2, 0, layout8x8, 0x100, 16 ) // bg tiles +GFXDECODE_END + +static GFXDECODE_START( pkunwar ) + GFXDECODE_ENTRY( REGION_GFX1, 0, layout16x16, 0x000, 16 ) // sprites + GFXDECODE_ENTRY( REGION_GFX1, 0, layout8x8, 0x100, 16 ) // bg tiles +GFXDECODE_END + +static GFXDECODE_START( raiders5 ) + GFXDECODE_ENTRY( REGION_GFX1, 0, layout16x16, 0x200, 16 ) // sprites + GFXDECODE_ENTRY( REGION_GFX1, 0, layout8x8_part, 0x000, 16 ) // fg tiles (using only 1/4th of the ROM space) + GFXDECODE_ENTRY( REGION_GFX2, 0, layout8x8, 0x100, 16 ) // bg tiles GFXDECODE_END -static const struct AY8910interface ay8910_interface_1 = +/************************************* + * + * Sound definitions + * + *************************************/ + +static const struct AY8910interface nova2001_ay8910_interface_1 = { 0, 0, - nova2001_scroll_x_w, /* writes are connected to pf scroll */ + nova2001_scroll_x_w, nova2001_scroll_y_w }; -static const struct AY8910interface ay8910_interface_2 = +static const struct AY8910interface nova2001_ay8910_interface_2 = { input_port_3_r, input_port_4_r }; +static const struct AY8910interface pkunwar_ay8910_interface_1 = +{ + input_port_0_r, + input_port_1_r +}; + +static const struct AY8910interface pkunwar_ay8910_interface_2 = +{ + input_port_2_r, + input_port_3_r +}; + + + +/************************************* + * + * Machine drivers + * + *************************************/ + static MACHINE_DRIVER_START( nova2001 ) /* basic machine hardware */ - MDRV_CPU_ADD(Z80, 12000000/4) // 3 MHz + MDRV_CPU_ADD(Z80, MAIN_CLOCK/4) // 3 MHz verified on schematics MDRV_CPU_PROGRAM_MAP(nova2001_map,0) MDRV_CPU_VBLANK_INT(irq0_line_hold,1) - MDRV_SCREEN_REFRESH_RATE(60) - MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION) - /* video hardware */ + MDRV_SCREEN_REFRESH_RATE(60) MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MDRV_SCREEN_SIZE(32*8, 32*8) - MDRV_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 4*8, 28*8-1) + MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 28*8-1) MDRV_GFXDECODE(nova2001) - MDRV_PALETTE_LENGTH(32) - MDRV_COLORTABLE_LENGTH(32*16) + MDRV_PALETTE_LENGTH(0x200) MDRV_PALETTE_INIT(nova2001) MDRV_VIDEO_START(nova2001) @@ -213,32 +707,146 @@ static MACHINE_DRIVER_START( nova2001 ) /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") - MDRV_SOUND_ADD(AY8910, 6000000/3) - MDRV_SOUND_CONFIG(ay8910_interface_1) + MDRV_SOUND_ADD(AY8910, MAIN_CLOCK/6) // 2 MHz verified on schematics + MDRV_SOUND_CONFIG(nova2001_ay8910_interface_1) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MDRV_SOUND_ADD(AY8910, 6000000/3) - MDRV_SOUND_CONFIG(ay8910_interface_2) + MDRV_SOUND_ADD(AY8910, MAIN_CLOCK/6) + MDRV_SOUND_CONFIG(nova2001_ay8910_interface_2) + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_DRIVER_END + +static MACHINE_DRIVER_START( ninjakun ) + + /* basic machine hardware */ + MDRV_CPU_ADD(Z80, MAIN_CLOCK/4) // 3 MHz + MDRV_CPU_PROGRAM_MAP(ninjakun_cpu1_map,0) + MDRV_CPU_VBLANK_INT(irq0_line_hold,1) + + MDRV_CPU_ADD(Z80, MAIN_CLOCK/4) // 3 MHz + MDRV_CPU_PROGRAM_MAP(ninjakun_cpu2_map,0) + MDRV_CPU_VBLANK_INT(irq0_line_hold,4) /* ? */ + + MDRV_INTERLEAVE(100) /* 100 CPU slices per frame */ + + MDRV_MACHINE_START(ninjakun) + + /* video hardware */ + MDRV_SCREEN_REFRESH_RATE(60) + MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) + MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) + MDRV_SCREEN_SIZE(32*8, 32*8) + MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 28*8-1 ) + MDRV_GFXDECODE(ninjakun) + MDRV_PALETTE_LENGTH(0x300) + + MDRV_VIDEO_START(ninjakun) + MDRV_VIDEO_UPDATE(ninjakun) + + /* sound hardware */ + MDRV_SPEAKER_STANDARD_MONO("mono") + + MDRV_SOUND_ADD(AY8910, MAIN_CLOCK/4) // 3 MHz + MDRV_SOUND_CONFIG(nova2001_ay8910_interface_2) // note swapped order wrt nova2001 + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) + + MDRV_SOUND_ADD(AY8910, MAIN_CLOCK/4) // 3 MHz + MDRV_SOUND_CONFIG(nova2001_ay8910_interface_1) + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) +MACHINE_DRIVER_END + +static MACHINE_DRIVER_START( pkunwar ) + + /* basic machine hardware */ + MDRV_CPU_ADD(Z80, MAIN_CLOCK/4) // 3 MHz + MDRV_CPU_PROGRAM_MAP(pkunwar_map,0) + MDRV_CPU_IO_MAP(pkunwar_io,0) + MDRV_CPU_VBLANK_INT(irq0_line_hold,1) + + /* video hardware */ + MDRV_SCREEN_REFRESH_RATE(60) + MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) + MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) + MDRV_SCREEN_SIZE(32*8, 32*8) + MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 28*8-1) + MDRV_GFXDECODE(pkunwar) + MDRV_PALETTE_LENGTH(0x200) + + MDRV_PALETTE_INIT(nova2001) + MDRV_VIDEO_START(pkunwar) + MDRV_VIDEO_UPDATE(pkunwar) + + /* sound hardware */ + MDRV_SPEAKER_STANDARD_MONO("mono") + + MDRV_SOUND_ADD(AY8910, MAIN_CLOCK/8) // 1.5MHz (correct?) + MDRV_SOUND_CONFIG(pkunwar_ay8910_interface_1) + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MDRV_SOUND_ADD(AY8910, MAIN_CLOCK/8) + MDRV_SOUND_CONFIG(pkunwar_ay8910_interface_2) + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_DRIVER_END + +static MACHINE_DRIVER_START( raiders5 ) + + /* basic machine hardware */ + MDRV_CPU_ADD(Z80, MAIN_CLOCK/4) // 3 MHz + MDRV_CPU_PROGRAM_MAP(raiders5_cpu1_map,0) + MDRV_CPU_IO_MAP(raiders5_io,0) + MDRV_CPU_VBLANK_INT(irq0_line_hold,1) + + MDRV_CPU_ADD(Z80, MAIN_CLOCK/4) // 3 MHz + MDRV_CPU_PROGRAM_MAP(raiders5_cpu2_map,0) + MDRV_CPU_VBLANK_INT(irq0_line_hold,4) /* ? */ + + MDRV_INTERLEAVE(400) + + /* video hardware */ + MDRV_SCREEN_REFRESH_RATE(60) + MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) + MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) + MDRV_SCREEN_SIZE(32*8, 32*8) + MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 28*8-1) + MDRV_GFXDECODE(raiders5) + MDRV_PALETTE_LENGTH(0x300) + + MDRV_VIDEO_START(raiders5) + MDRV_VIDEO_UPDATE(raiders5) + + /* sound hardware */ + MDRV_SPEAKER_STANDARD_MONO("mono") + + MDRV_SOUND_ADD(AY8910, MAIN_CLOCK/8) // 1.5MHz + MDRV_SOUND_CONFIG(pkunwar_ay8910_interface_1) + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + + MDRV_SOUND_ADD(AY8910, MAIN_CLOCK/8) + MDRV_SOUND_CONFIG(pkunwar_ay8910_interface_2) MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_DRIVER_END +/************************************* + * + * ROM definitions + * + *************************************/ + ROM_START( nova2001 ) ROM_REGION( 0x10000, REGION_CPU1, 0 ) ROM_LOAD( "1.6c", 0x0000, 0x2000, CRC(368cffc0) SHA1(b756c0542d5b86640af62639bdd0d32f6e364dd3) ) ROM_LOAD( "2.6d", 0x2000, 0x2000, CRC(bc4e442b) SHA1(6e1dca5dde442db95403377bf49aaad2a337813e) ) ROM_LOAD( "3.6f", 0x4000, 0x2000, CRC(b2849038) SHA1(b56c7c03ef7c677cc6df0280a485f9cda3435b23) ) ROM_LOAD( "4.6g", 0x6000, 0x1000, CRC(6b5bb12d) SHA1(74aee3d08a7ee1f98eaec4a4b3062aa9d17948ec) ) - ROM_RELOAD( 0x7000, 0x1000 ) + ROM_RELOAD( 0x7000, 0x1000 ) // half size ROM, mirrored - ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE ) - ROM_LOAD( "5.12s", 0x0000, 0x2000, CRC(54198941) SHA1(fe762a0bbcf10b13ece87ded2ea730257cfbe7d3) ) - ROM_LOAD( "6.12p", 0x2000, 0x2000, CRC(cbd90dca) SHA1(7eacde832f5783f4389fb98d6bf6b26dd494665d) ) - - ROM_REGION( 0x4000, REGION_GFX2, ROMREGION_DISPOSE ) - ROM_LOAD( "7.12n", 0x0000, 0x2000, CRC(9ebd8806) SHA1(26b6caa0d0a7ae52a182070ecc7bc696c12038b3) ) - ROM_LOAD( "8.12l", 0x2000, 0x2000, CRC(d1b18389) SHA1(2d808fee774f1bb4cec42e23cfef36b54eee0efa) ) + ROM_REGION( 0x8000, REGION_GFX1, ROMREGION_DISPOSE ) + ROM_LOAD16_BYTE( "5.12s", 0x0000, 0x2000, CRC(54198941) SHA1(fe762a0bbcf10b13ece87ded2ea730257cfbe7d3) ) + ROM_LOAD16_BYTE( "6.12p", 0x0001, 0x2000, CRC(cbd90dca) SHA1(7eacde832f5783f4389fb98d6bf6b26dd494665d) ) + ROM_LOAD16_BYTE( "7.12n", 0x4000, 0x2000, CRC(9ebd8806) SHA1(26b6caa0d0a7ae52a182070ecc7bc696c12038b3) ) + ROM_LOAD16_BYTE( "8.12l", 0x4001, 0x2000, CRC(d1b18389) SHA1(2d808fee774f1bb4cec42e23cfef36b54eee0efa) ) ROM_REGION( 0x0020, REGION_PROMS, 0 ) ROM_LOAD( "nova2001.clr", 0x0000, 0x0020, CRC(a2fac5cd) SHA1(ad14aa2be57722d1f48b47171fe72f96091423b6) ) @@ -250,21 +858,185 @@ ROM_START( nov2001u ) ROM_LOAD( "nova2001.2", 0x2000, 0x2000, CRC(fab87144) SHA1(506703f9d96443839f864ef5bde1a71120f54384) ) ROM_LOAD( "3.6f", 0x4000, 0x2000, CRC(b2849038) SHA1(b56c7c03ef7c677cc6df0280a485f9cda3435b23) ) ROM_LOAD( "4.6g", 0x6000, 0x1000, CRC(6b5bb12d) SHA1(74aee3d08a7ee1f98eaec4a4b3062aa9d17948ec) ) - ROM_RELOAD( 0x7000, 0x1000 ) + ROM_RELOAD( 0x7000, 0x1000 ) // half size ROM, mirrored - ROM_REGION( 0x4000, REGION_GFX1, ROMREGION_DISPOSE ) - ROM_LOAD( "nova2001.5", 0x0000, 0x2000, CRC(8ea576e8) SHA1(d8dbcfd43aafe25afad7f947a80737cdc55b23d7) ) - ROM_LOAD( "nova2001.6", 0x2000, 0x2000, CRC(0c61656c) SHA1(41c480799798c95543b5a805694e68282b9f563a) ) - - ROM_REGION( 0x4000, REGION_GFX2, ROMREGION_DISPOSE ) - ROM_LOAD( "7.12n", 0x0000, 0x2000, CRC(9ebd8806) SHA1(26b6caa0d0a7ae52a182070ecc7bc696c12038b3) ) - ROM_LOAD( "8.12l", 0x2000, 0x2000, CRC(d1b18389) SHA1(2d808fee774f1bb4cec42e23cfef36b54eee0efa) ) + ROM_REGION( 0x8000, REGION_GFX1, ROMREGION_DISPOSE ) + ROM_LOAD16_BYTE( "nova2001.5", 0x0000, 0x2000, CRC(8ea576e8) SHA1(d8dbcfd43aafe25afad7f947a80737cdc55b23d7) ) + ROM_LOAD16_BYTE( "nova2001.6", 0x0001, 0x2000, CRC(0c61656c) SHA1(41c480799798c95543b5a805694e68282b9f563a) ) + ROM_LOAD16_BYTE( "7.12n", 0x4000, 0x2000, CRC(9ebd8806) SHA1(26b6caa0d0a7ae52a182070ecc7bc696c12038b3) ) + ROM_LOAD16_BYTE( "8.12l", 0x4001, 0x2000, CRC(d1b18389) SHA1(2d808fee774f1bb4cec42e23cfef36b54eee0efa) ) ROM_REGION( 0x0020, REGION_PROMS, 0 ) ROM_LOAD( "nova2001.clr", 0x0000, 0x0020, CRC(a2fac5cd) SHA1(ad14aa2be57722d1f48b47171fe72f96091423b6) ) ROM_END +ROM_START( ninjakun ) /* Original Board? */ + ROM_REGION( 0x10000, REGION_CPU1, 0 ) + ROM_LOAD( "ninja-1.7a", 0x0000, 0x02000, CRC(1c1dc141) SHA1(423d3ed35e73a8d5bfce075a889b0322b207bd0d) ) + ROM_LOAD( "ninja-2.7b", 0x2000, 0x02000, CRC(39cc7d37) SHA1(7f0d0e1e92cb6a57f15eb7fc51a67112f1c5fc8e) ) + ROM_LOAD( "ninja-3.7d", 0x4000, 0x02000, CRC(d542bfe3) SHA1(3814d8f5b1acda21438fff4f71670fa653dc7b30) ) + ROM_LOAD( "ninja-4.7e", 0x6000, 0x02000, CRC(a57385c6) SHA1(77925a281e64889bfe967c3d42a388529aaf7eb6) ) + + ROM_REGION( 0x10000, REGION_CPU2, 0 ) + ROM_LOAD( "ninja-5.7h", 0x0000, 0x02000, CRC(164a42c4) SHA1(16b434b33b76b878514f67c23315d4c6da7bfc9e) ) + + ROM_REGION( 0x08000, REGION_GFX1, ROMREGION_DISPOSE ) + ROM_LOAD16_BYTE( "ninja-6.7n", 0x0000, 0x02000, CRC(a74c4297) SHA1(87184d14c67331f2c8a2412e28f31427eddae799) ) + ROM_LOAD16_BYTE( "ninja-7.7p", 0x0001, 0x02000, CRC(53a72039) SHA1(d77d608ce9388a8956831369badd88a8eda8e102) ) + ROM_LOAD16_BYTE( "ninja-8.7s", 0x4000, 0x02000, CRC(4a99d857) SHA1(6aadb6a5c721a161a5c1bef5569c1e323e380cff) ) + ROM_LOAD16_BYTE( "ninja-9.7t", 0x4001, 0x02000, CRC(dede49e4) SHA1(8ce4bc02ec583b3885ca63fb5e2d5dad185fe192) ) + + ROM_REGION( 0x08000, REGION_GFX2, ROMREGION_DISPOSE ) + ROM_LOAD16_BYTE( "ninja-10.2c", 0x0000, 0x02000, CRC(0d55664a) SHA1(955a607b4401ce9f3f807d53833a766152b0ef9b) ) + ROM_LOAD16_BYTE( "ninja-11.2d", 0x0001, 0x02000, CRC(12ff9597) SHA1(10b572844ab32e3ae54abe3600fecc1a811ac713) ) + ROM_LOAD16_BYTE( "ninja-12.4c", 0x4000, 0x02000, CRC(e9b75807) SHA1(cf4c8ac962f785e9de5502df58eab9b3725aaa28) ) + ROM_LOAD16_BYTE( "ninja-13.4d", 0x4001, 0x02000, CRC(1760ed2c) SHA1(ee4c8efcce483c8051873714856824a1a1e14b61) ) +ROM_END + +ROM_START( pkunwar ) + ROM_REGION( 0x10000, REGION_CPU1, 0 ) + ROM_LOAD( "pkwar.01r", 0x0000, 0x4000, CRC(ce2d2c7b) SHA1(2ffe2eb339fd668ec4fe90eff66124a334db0693) ) + ROM_LOAD( "pkwar.02r", 0x4000, 0x4000, CRC(abc1f661) SHA1(c4bf4a345efd4271617de9f334303d81c6885aa5) ) + ROM_LOAD( "pkwar.03r", 0xe000, 0x2000, CRC(56faebea) SHA1(dd0406c723a08f5d1120655857a115ab8c2d2a11) ) + + ROM_REGION( 0x10000, REGION_GFX1, ROMREGION_DISPOSE ) // (need lineswapping) + ROM_LOAD( "pkwar.01y", 0x0000, 0x4000, CRC(428d3b92) SHA1(7fe11e8d785fe829d34e512f233bb9ccc70cd431) ) + ROM_LOAD( "pkwar.02y", 0x4000, 0x4000, CRC(ce1da7bc) SHA1(a2357b61703a689ce63aec7dd44702b119894f8e) ) + ROM_LOAD( "pkwar.03y", 0x8000, 0x4000, CRC(63204400) SHA1(1ba87ad3425c51150cb65408f04ee0147ef332d3) ) + ROM_LOAD( "pkwar.04y", 0xc000, 0x4000, CRC(061dfca8) SHA1(0a2dd8fc790d607195ca18dfc55575c2b9ddc58a) ) + + ROM_REGION( 0x0020, REGION_PROMS, 0 ) + ROM_LOAD( "pkwar.col", 0x0000, 0x0020, CRC(af0fc5e2) SHA1(480908bf893211b580ae19cfb40dc35ad1bbc343) ) +ROM_END + +ROM_START( pkunwarj ) + ROM_REGION( 0x10000, REGION_CPU1, 0 ) + ROM_LOAD( "pgunwar.6", 0x0000, 0x4000, CRC(357f3ef3) SHA1(bc651fb7701b395ae8cda1888814af5c5aa325a6) ) + ROM_LOAD( "pgunwar.5", 0x4000, 0x4000, CRC(0092e49e) SHA1(7945361036f7679e4f4bb6b94f60f3ca09c077dc) ) + ROM_LOAD( "pkwar.03r", 0xe000, 0x2000, CRC(56faebea) SHA1(dd0406c723a08f5d1120655857a115ab8c2d2a11) ) + + ROM_REGION( 0x10000, REGION_GFX1, ROMREGION_DISPOSE ) // (need lineswapping) + ROM_LOAD( "pkwar.01y", 0x0000, 0x4000, CRC(428d3b92) SHA1(7fe11e8d785fe829d34e512f233bb9ccc70cd431) ) + ROM_LOAD( "pkwar.02y", 0x4000, 0x4000, CRC(ce1da7bc) SHA1(a2357b61703a689ce63aec7dd44702b119894f8e) ) + ROM_LOAD( "pgunwar.2", 0x8000, 0x4000, CRC(a2a43443) SHA1(4e10569886d364eb2539928ea81dc1565b60b590) ) + ROM_LOAD( "pkwar.04y", 0xc000, 0x4000, CRC(061dfca8) SHA1(0a2dd8fc790d607195ca18dfc55575c2b9ddc58a) ) + + ROM_REGION( 0x0020, REGION_PROMS, 0 ) + ROM_LOAD( "pkwar.col", 0x0000, 0x0020, CRC(af0fc5e2) SHA1(480908bf893211b580ae19cfb40dc35ad1bbc343) ) +ROM_END + +ROM_START( raiders5 ) + ROM_REGION( 0x10000, REGION_CPU1, 0 ) + ROM_LOAD( "raiders5.1", 0x0000, 0x4000, CRC(47cea11f) SHA1(0499e6627ad9c16775fdc59f2ff56dfdfc23490a) ) + ROM_LOAD( "raiders5.2", 0x4000, 0x4000, CRC(eb2ff410) SHA1(5c995b66b6301cd3cd58efd173481deaa036f842) ) + + ROM_REGION( 0x10000, REGION_CPU2, 0 ) + ROM_LOAD( "raiders5.2", 0x0000, 0x4000, CRC(eb2ff410) SHA1(5c995b66b6301cd3cd58efd173481deaa036f842) ) + + ROM_REGION( 0x8000, REGION_GFX1, ROMREGION_DISPOSE ) // (need lineswapping) + ROM_LOAD( "raiders3.11f", 0x0000, 0x4000, CRC(30041d58) SHA1(a33087de7afb276925879898a96f418128a5a38c) ) + ROM_LOAD( "raiders4.11g", 0x4000, 0x4000, CRC(e441931c) SHA1(f39b4c25de779c671a6e2b02df64e7fed726f4da) ) + + ROM_REGION( 0x4000, REGION_GFX2, ROMREGION_DISPOSE ) // (need lineswapping) + ROM_LOAD( "raiders5.11n", 0x0000, 0x4000, CRC(c0895090) SHA1(a3a1ae57ed66bc095ea9bfb26470290f67aab1fe) ) +ROM_END + +ROM_START( raidrs5t ) + ROM_REGION( 0x10000, REGION_CPU1, 0 ) + ROM_LOAD( "raiders1.4c", 0x0000, 0x4000, CRC(4e2d5679) SHA1(a1c1603ba98814a83b92ad024ca4422aea872111) ) + ROM_LOAD( "raiders2.4d", 0x4000, 0x4000, CRC(c8604be1) SHA1(6d23f26174bb9b2f7db3a5fa6b39674fe237135b) ) + + ROM_REGION( 0x10000, REGION_CPU2, 0 ) + ROM_LOAD( "raiders2.4d", 0x0000, 0x4000, CRC(c8604be1) SHA1(6d23f26174bb9b2f7db3a5fa6b39674fe237135b) ) + + ROM_REGION( 0x8000, REGION_GFX1, ROMREGION_DISPOSE ) // (need lineswapping) + ROM_LOAD( "raiders3.11f", 0x0000, 0x4000, CRC(30041d58) SHA1(a33087de7afb276925879898a96f418128a5a38c) ) + ROM_LOAD( "raiders4.11g", 0x4000, 0x4000, CRC(e441931c) SHA1(f39b4c25de779c671a6e2b02df64e7fed726f4da) ) + + ROM_REGION( 0x4000, REGION_GFX2, ROMREGION_DISPOSE ) // (need lineswapping) + ROM_LOAD( "raiders5.11n", 0x0000, 0x4000, CRC(c0895090) SHA1(a3a1ae57ed66bc095ea9bfb26470290f67aab1fe) ) +ROM_END -GAME( 1983, nova2001, 0, nova2001, nova2001, 0, ROT0, "UPL", "Nova 2001 (Japan)", 0 ) -GAME( 1983, nov2001u, nova2001, nova2001, nova2001, 0, ROT0, "UPL (Universal license)", "Nova 2001 (US)", 0 ) + +/************************************* + * + * Gfx ROM swizzling + * + *************************************/ + +/****************************************************************************** + +Gfx ROMs in pkunwar have an unusual layout, where a high address bit +(which is no the top bit) separates parts of the same tile. + +This all originates from Nova2001 apparently, which uses 0x2000 bytes ROMs for +the graphics. When the number of tiles was increased, the same 0x2000 blocks +were maintained even if the ROMs got larger. + +To make it possible to decode graphics without resorting to ROM_CONTINUE +trickery, this function makes an address line rotation, bringing bit "bit" to +bit 0 and shifting left by one place all the intervening bits. + +This code is overly generic because it is used for several games in ninjakd2.c + +******************************************************************************/ + +static void lineswap_gfx_roms(const int region, const int bit) +{ + const int length = memory_region_length(region); + + UINT8* const src = memory_region(region); + + UINT8* const temp = malloc_or_die(length); + + const int mask = (1 << (bit + 1)) - 1; + + int sa; + + for (sa = 0; sa < length; sa++) + { + const int da = (sa & ~mask) | ((sa << 1) & mask) | ((sa >> bit) & 1); + + temp[da] = src[sa]; + } + + memcpy(src, temp, length); + + free(temp); +} + + + +/************************************* + * + * Driver initialization + * + *************************************/ + +static DRIVER_INIT( pkunwar ) +{ + lineswap_gfx_roms(REGION_GFX1, 13); +} + +static DRIVER_INIT( raiders5 ) +{ + lineswap_gfx_roms(REGION_GFX1, 13); + lineswap_gfx_roms(REGION_GFX2, 13); +} + + + +/************************************* + * + * Game drivers + * + *************************************/ + +GAME( 1983, nova2001, 0, nova2001, nova2001, 0, ROT0, "UPL", "Nova 2001 (Japan)", 0 ) +GAME( 1983, nov2001u, nova2001, nova2001, nova2001, 0, ROT0, "UPL (Universal license)", "Nova 2001 (US)", 0 ) +GAME( 1984, ninjakun, 0, ninjakun, ninjakun, 0, ROT0, "[UPL] (Taito license)", "Ninjakun Majou no Bouken", 0 ) +GAME( 1985?,pkunwar, 0, pkunwar, pkunwar, pkunwar, ROT0, "UPL", "Penguin-Kun Wars (US)", 0 ) +GAME( 1985?,pkunwarj, pkunwar, pkunwar, pkunwar, pkunwar, ROT0, "UPL", "Penguin-Kun Wars (Japan)", 0 ) +GAME( 1985, raiders5, 0, raiders5, raiders5, raiders5, ROT0, "UPL", "Raiders5", 0 ) +GAME( 1985, raidrs5t, raiders5, raiders5, raiders5, raiders5, ROT0, "UPL (Taito license)", "Raiders5 (Japan)", 0 ) diff --git a/src/mame/drivers/pkunwar.c b/src/mame/drivers/pkunwar.c deleted file mode 100644 index 0582088bf36..00000000000 --- a/src/mame/drivers/pkunwar.c +++ /dev/null @@ -1,252 +0,0 @@ -/*************************************************************************** - -Notes: -- Currently the Flip Screen dip switch only flips the screen horizontally. - This might not be the correct behaviour. Verification of the real board - would be necessary to emulate this accurately. - -***************************************************************************/ - -#include "driver.h" -#include "sound/ay8910.h" - - -PALETTE_INIT( nova2001 ); -WRITE8_HANDLER( pkunwar_flipscreen_w ); -VIDEO_UPDATE( pkunwar ); - - - -static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_READ(MRA8_ROM) - AM_RANGE(0x8000, 0x8fff) AM_READ(MRA8_RAM) - AM_RANGE(0xa001, 0xa001) AM_READ(AY8910_read_port_0_r) - AM_RANGE(0xa003, 0xa003) AM_READ(AY8910_read_port_1_r) - AM_RANGE(0xc000, 0xc7ff) AM_READ(MRA8_RAM) - AM_RANGE(0xe000, 0xffff) AM_READ(MRA8_ROM) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_WRITE(MWA8_ROM) - AM_RANGE(0x8000, 0x87ff) AM_WRITE(MWA8_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) - AM_RANGE(0x8800, 0x8bff) AM_WRITE(MWA8_RAM) AM_BASE(&videoram) AM_SIZE(&videoram_size) - AM_RANGE(0x8c00, 0x8fff) AM_WRITE(MWA8_RAM) AM_BASE(&colorram) - AM_RANGE(0xa000, 0xa000) AM_WRITE(&AY8910_control_port_0_w) - AM_RANGE(0xa001, 0xa001) AM_WRITE(&AY8910_write_port_0_w) - AM_RANGE(0xa002, 0xa002) AM_WRITE(&AY8910_control_port_1_w) - AM_RANGE(0xa003, 0xa003) AM_WRITE(&AY8910_write_port_1_w) - AM_RANGE(0xc000, 0xc7ff) AM_WRITE(MWA8_RAM) - AM_RANGE(0xe000, 0xffff) AM_WRITE(MWA8_ROM) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( writeport, ADDRESS_SPACE_IO, 8 ) - ADDRESS_MAP_FLAGS( AMEF_ABITS(8) ) - AM_RANGE(0x00, 0x00) AM_WRITE(pkunwar_flipscreen_w) -ADDRESS_MAP_END - - - -static INPUT_PORTS_START( pkunwar ) - PORT_START /* IN0 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK ) - - PORT_START /* IN1 */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_COCKTAIL - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_COCKTAIL - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) - PORT_SERVICE( 0x40, IP_ACTIVE_LOW ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) - - PORT_START /* DSW0 */ - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - - PORT_START /* DSW1 */ - PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) ) - PORT_DIPSETTING( 0x00, DEF_STR( 3C_1C ) ) - PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x03, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x01, DEF_STR( 1C_2C ) ) - PORT_DIPNAME( 0x04, 0x00, DEF_STR( Cabinet ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) - PORT_DIPSETTING( 0x04, DEF_STR( Cocktail ) ) - PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x08, DEF_STR( On ) ) - PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Easy ) ) - PORT_DIPSETTING( 0x30, DEF_STR( Medium ) ) - PORT_DIPSETTING( 0x20, DEF_STR( Hard ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Free_Play ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) -INPUT_PORTS_END - - - -static const gfx_layout charlayout = -{ - 8,8, /* 8*8 characters */ - 2048, /* 2048 characters */ - 4, /* 4 bits per pixel */ - { 0, 1, 2, 3 }, - { 0*4, 1*4, 2048*16*8, 2048*16*8 + 4, 2*4, 3*4, 2048*16*8 + 8, 2048*16*8 + 12 }, - { 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8 }, - 16*8 -}; - -static const gfx_layout spritelayout = -{ - 16,16, /* 16*16 sprites */ - 512, /* 512 sprites */ - 4, /* 4 bits per pixel */ - { 0, 1, 2, 3 }, - { 0*4, 1*4, 512*64*8, 512*64*8 + 4, 2*4, 3*4, 512*64*8 + 8, 512*64*8 + 12, - 0*4+16*8, 1*4+16*8, 512*64*8+16*8, 512*64*8 + 4+16*8, 2*4+16*8, 3*4+16*8, 512*64*8 + 8 + 16*8, 512*64*8 + 12 + 16*8 }, - { 0*8, 2*8, 4*8, 6*8, 8*8, 10*8, 12*8, 14*8, - 0*8+32*8, 2*8+32*8, 4*8+32*8, 6*8+32*8, 8*8+32*8, 10*8+32*8, 12*8+32*8, 14*8 + 32*8 }, - 64*8 -}; - -static GFXDECODE_START( pkunwar ) - GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout, 16*16, 16 ) - GFXDECODE_ENTRY( REGION_GFX1, 0x0000, spritelayout, 0, 16 ) -GFXDECODE_END - - - -static const struct AY8910interface ay8910_interface_1 = { - input_port_0_r, - input_port_1_r -}; - -static const struct AY8910interface ay8910_interface_2 = { - input_port_2_r, - input_port_3_r -}; - - - -static MACHINE_DRIVER_START( pkunwar ) - - /* basic machine hardware */ - MDRV_CPU_ADD(Z80, 12000000/4) /* 3 MHz */ - MDRV_CPU_PROGRAM_MAP(readmem,writemem) - MDRV_CPU_IO_MAP(0,writeport) - MDRV_CPU_VBLANK_INT(irq0_line_hold,1) - - MDRV_SCREEN_REFRESH_RATE(60) - MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION) - - /* video hardware */ - MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) - MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MDRV_SCREEN_SIZE(32*8, 32*8) - MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 28*8-1) - MDRV_GFXDECODE(pkunwar) - MDRV_PALETTE_LENGTH(32) - MDRV_COLORTABLE_LENGTH(32*16) - - MDRV_PALETTE_INIT(nova2001) - MDRV_VIDEO_UPDATE(pkunwar) - - /* sound hardware */ - MDRV_SPEAKER_STANDARD_MONO("mono") - - MDRV_SOUND_ADD(AY8910, 12000000/8) - MDRV_SOUND_CONFIG(ay8910_interface_1) - MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MDRV_SOUND_ADD(AY8910, 12000000/8) - MDRV_SOUND_CONFIG(ay8910_interface_2) - MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_DRIVER_END - - - -/*************************************************************************** - - Game driver(s) - -***************************************************************************/ - -ROM_START( pkunwar ) - ROM_REGION( 0x10000, REGION_CPU1, 0 ) - ROM_LOAD( "pkwar.01r", 0x0000, 0x4000, CRC(ce2d2c7b) SHA1(2ffe2eb339fd668ec4fe90eff66124a334db0693) ) - ROM_LOAD( "pkwar.02r", 0x4000, 0x4000, CRC(abc1f661) SHA1(c4bf4a345efd4271617de9f334303d81c6885aa5) ) - ROM_LOAD( "pkwar.03r", 0xe000, 0x2000, CRC(56faebea) SHA1(dd0406c723a08f5d1120655857a115ab8c2d2a11) ) - - ROM_REGION( 0x10000, REGION_GFX1, ROMREGION_DISPOSE ) - ROM_LOAD( "pkwar.01y", 0x0000, 0x2000, CRC(428d3b92) SHA1(7fe11e8d785fe829d34e512f233bb9ccc70cd431) ) - ROM_CONTINUE( 0x8000, 0x2000 ) - ROM_LOAD( "pkwar.02y", 0x2000, 0x2000, CRC(ce1da7bc) SHA1(a2357b61703a689ce63aec7dd44702b119894f8e) ) - ROM_CONTINUE( 0xa000, 0x2000 ) - ROM_LOAD( "pkwar.03y", 0x4000, 0x2000, CRC(63204400) SHA1(1ba87ad3425c51150cb65408f04ee0147ef332d3) ) - ROM_CONTINUE( 0xc000, 0x2000 ) - ROM_LOAD( "pkwar.04y", 0x6000, 0x2000, CRC(061dfca8) SHA1(0a2dd8fc790d607195ca18dfc55575c2b9ddc58a) ) - ROM_CONTINUE( 0xe000, 0x2000 ) - - ROM_REGION( 0x0020, REGION_PROMS, 0 ) - ROM_LOAD( "pkwar.col", 0x0000, 0x0020, CRC(af0fc5e2) SHA1(480908bf893211b580ae19cfb40dc35ad1bbc343) ) -ROM_END - -ROM_START( pkunwarj ) - ROM_REGION( 0x10000, REGION_CPU1, 0 ) - ROM_LOAD( "pgunwar.6", 0x0000, 0x4000, CRC(357f3ef3) SHA1(bc651fb7701b395ae8cda1888814af5c5aa325a6) ) - ROM_LOAD( "pgunwar.5", 0x4000, 0x4000, CRC(0092e49e) SHA1(7945361036f7679e4f4bb6b94f60f3ca09c077dc) ) - ROM_LOAD( "pkwar.03r", 0xe000, 0x2000, CRC(56faebea) SHA1(dd0406c723a08f5d1120655857a115ab8c2d2a11) ) - - ROM_REGION( 0x10000, REGION_GFX1, ROMREGION_DISPOSE ) - ROM_LOAD( "pkwar.01y", 0x0000, 0x2000, CRC(428d3b92) SHA1(7fe11e8d785fe829d34e512f233bb9ccc70cd431) ) - ROM_CONTINUE( 0x8000, 0x2000 ) - ROM_LOAD( "pkwar.02y", 0x2000, 0x2000, CRC(ce1da7bc) SHA1(a2357b61703a689ce63aec7dd44702b119894f8e) ) - ROM_CONTINUE( 0xa000, 0x2000 ) - ROM_LOAD( "pgunwar.2", 0x4000, 0x2000, CRC(a2a43443) SHA1(4e10569886d364eb2539928ea81dc1565b60b590) ) - ROM_CONTINUE( 0xc000, 0x2000 ) - ROM_LOAD( "pkwar.04y", 0x6000, 0x2000, CRC(061dfca8) SHA1(0a2dd8fc790d607195ca18dfc55575c2b9ddc58a) ) - ROM_CONTINUE( 0xe000, 0x2000 ) - - ROM_REGION( 0x0020, REGION_PROMS, 0 ) - ROM_LOAD( "pkwar.col", 0x0000, 0x0020, CRC(af0fc5e2) SHA1(480908bf893211b580ae19cfb40dc35ad1bbc343) ) -ROM_END - - - -GAME( 1985?, pkunwar, 0, pkunwar, pkunwar, 0, ROT0, "UPL", "Penguin-Kun Wars (US)", 0 ) -GAME( 1985?, pkunwarj, pkunwar, pkunwar, pkunwar, 0, ROT0, "UPL", "Penguin-Kun Wars (Japan)", 0 ) diff --git a/src/mame/drivers/raiders5.c b/src/mame/drivers/raiders5.c deleted file mode 100644 index 973bbf0a603..00000000000 --- a/src/mame/drivers/raiders5.c +++ /dev/null @@ -1,296 +0,0 @@ -/***************************************************************************** - -Raiders5 (c) 1985 Taito / UPL - - Driver by Uki - - 02/Jun/2001 - - -****************************************************************************** - -Thanks to: - -David Haywood for ninjakid driver. - -Howie Cohen -Frank Palazzolo -Alex Pasadyn - for nova2001 driver. - -Notes: - -"Free Play" does not work properly...? - -*****************************************************************************/ - -#include "driver.h" -#include "sound/ay8910.h" - - -extern UINT8 *raiders5_foreground_videoram; -extern UINT8 *raiders5_foreground_colorram; -extern UINT8 *raiders5_background_videoram; -extern UINT8 *raiders5_background_colorram; -extern UINT8 *raiders5_spriteram; -extern size_t raiders5_spriteram_size; -extern UINT8 *raiders5_paletteram; - -VIDEO_START( raiders5 ); -VIDEO_UPDATE( raiders5 ); - -WRITE8_HANDLER( raiders5_scroll_x_w ); -WRITE8_HANDLER( raiders5_scroll_y_w ); -WRITE8_HANDLER( raiders5_flip_screen_w ); - -WRITE8_HANDLER( raiders5_background_videoram_w ); -READ8_HANDLER( raiders5_background_videoram_r ); -WRITE8_HANDLER( raiders5_background_colorram_w ); -READ8_HANDLER( raiders5_background_colorram_r ); -WRITE8_HANDLER( raiders5_foreground_videoram_w ); -WRITE8_HANDLER( raiders5_foreground_colorram_w ); - -WRITE8_HANDLER( raiders5_paletteram_w ); - - - -static ADDRESS_MAP_START( raiders5_map_1, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0x87ff) AM_RAM AM_BASE(&raiders5_spriteram) AM_SIZE(&raiders5_spriteram_size) - AM_RANGE(0x8800, 0x8bff) AM_READWRITE(MRA8_RAM, raiders5_foreground_videoram_w) AM_BASE(&raiders5_foreground_videoram) - AM_RANGE(0x8c00, 0x8fff) AM_READWRITE(MRA8_RAM, raiders5_foreground_colorram_w) AM_BASE(&raiders5_foreground_colorram) - AM_RANGE(0x9000, 0x93ff) AM_READWRITE(raiders5_background_videoram_r, raiders5_background_videoram_w) AM_BASE(&raiders5_background_videoram) - AM_RANGE(0x9400, 0x97ff) AM_READWRITE(raiders5_background_colorram_r, raiders5_background_colorram_w) AM_BASE(&raiders5_background_colorram) - AM_RANGE(0xa000, 0xa000) AM_WRITE(raiders5_scroll_x_w) - AM_RANGE(0xa001, 0xa001) AM_WRITE(raiders5_scroll_y_w) - AM_RANGE(0xa002, 0xa002) AM_WRITE(raiders5_flip_screen_w) - AM_RANGE(0xc000, 0xc000) AM_WRITE(AY8910_control_port_0_w) - AM_RANGE(0xc001, 0xc001) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w) - AM_RANGE(0xc002, 0xc002) AM_WRITE(AY8910_control_port_1_w) - AM_RANGE(0xc003, 0xc003) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w) - AM_RANGE(0xd000, 0xd1ff) AM_READWRITE(MRA8_RAM, raiders5_paletteram_w) AM_BASE(&paletteram) - AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_SHARE(1) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( raiders5_map_2, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x3fff) AM_ROM - AM_RANGE(0x8000, 0x8000) AM_WRITE(AY8910_control_port_0_w) - AM_RANGE(0x8001, 0x8001) AM_READWRITE(AY8910_read_port_0_r, AY8910_write_port_0_w) - AM_RANGE(0x8002, 0x8002) AM_WRITE(AY8910_control_port_1_w) - AM_RANGE(0x8003, 0x8003) AM_READWRITE(AY8910_read_port_1_r, AY8910_write_port_1_w) - AM_RANGE(0x9000, 0x9000) AM_READ(MRA8_NOP) /* unknown */ - AM_RANGE(0xa000, 0xa7ff) AM_RAM AM_SHARE(1) - AM_RANGE(0xc000, 0xc000) AM_READ(MRA8_NOP) /* unknown */ - AM_RANGE(0xc800, 0xc800) AM_READ(MRA8_NOP) /* unknown */ - AM_RANGE(0xd000, 0xd000) AM_READ(MRA8_NOP) /* unknown */ - AM_RANGE(0xe000, 0xe000) AM_WRITE(raiders5_scroll_x_w) - AM_RANGE(0xe001, 0xe001) AM_WRITE(raiders5_scroll_y_w) - AM_RANGE(0xe002, 0xe002) AM_WRITE(raiders5_flip_screen_w) -ADDRESS_MAP_END - - -static ADDRESS_MAP_START( raiders5_io_map_1, ADDRESS_SPACE_IO, 8 ) - AM_RANGE(0x00, 0x00) AM_READ(MRA8_NOP) /* watchdog? */ -ADDRESS_MAP_END - - - -static INPUT_PORTS_START( raiders5 ) - PORT_START - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_VBLANK ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY - - PORT_START - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_IMPULSE(5) - PORT_SERVICE( 0x40, IP_ACTIVE_LOW ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_4WAY PORT_COCKTAIL - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_4WAY PORT_COCKTAIL - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_4WAY PORT_COCKTAIL - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_4WAY PORT_COCKTAIL - - PORT_START /* DSW1 */ - PORT_DIPNAME( 0x01, 0x00, DEF_STR( Cabinet ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) - PORT_DIPSETTING( 0x01, DEF_STR( Cocktail ) ) - PORT_DIPNAME( 0x06, 0x06, DEF_STR( Lives ) ) - PORT_DIPSETTING( 0x00, "2" ) - PORT_DIPSETTING( 0x06, "3" ) - PORT_DIPSETTING( 0x04, "4" ) - PORT_DIPSETTING( 0x02, "5" ) - PORT_DIPNAME( 0x08, 0x08, "1st Bonus" ) - PORT_DIPSETTING( 0x08, "30000" ) - PORT_DIPSETTING( 0x00, "40000" ) - PORT_DIPNAME( 0x30, 0x30, "2nd Bonus" ) - PORT_DIPSETTING( 0x30, "Every(?) 50000" ) - PORT_DIPSETTING( 0x20, "Every(?) 70000" ) - PORT_DIPSETTING( 0x10, "Every(?) 90000" ) - PORT_DIPSETTING( 0x00, DEF_STR( None ) ) - PORT_DIPNAME( 0x40, 0x40, "Exercise" ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x40, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, DEF_STR( Difficulty ) ) - PORT_DIPSETTING( 0x80, DEF_STR( Normal ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) - - PORT_START /* DSW2*/ - PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) - PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) ) - PORT_DIPSETTING( 0x05, DEF_STR( 3C_1C ) ) - PORT_DIPSETTING( 0x00, DEF_STR( 4C_2C ) ) - PORT_DIPSETTING( 0x06, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x01, DEF_STR( 3C_2C ) ) - PORT_DIPSETTING( 0x02, DEF_STR( 2C_2C ) ) - PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x03, DEF_STR( 1C_2C ) ) - - PORT_DIPNAME( 0x08, 0x08, "High Score Names" ) - PORT_DIPSETTING( 0x00, "3 Letters" ) - PORT_DIPSETTING( 0x08, "8 Letters" ) - PORT_DIPNAME( 0x10, 0x10, DEF_STR( Allow_Continue ) ) - PORT_DIPSETTING( 0x00, DEF_STR( No ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Yes ) ) - PORT_DIPNAME( 0x20, 0x20, "Unknown 2-6" ) - PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) ) - PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x80, 0x80, "Endless Game (If Free Play)" ) - PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - -INPUT_PORTS_END - - - -static const gfx_layout charlayout = -{ - 8,8, - 512, - 4, - {0,1,2,3}, - {0,4,8192*8+0,8192*8+4,8,12,8192*8+8,8192*8+12}, - {16*0, 16*1, 16*2, 16*3, 16*4, 16*5, 16*6, 16*7}, - 16*8 -}; - -static const gfx_layout spritelayout = -{ - 16, 16, - 128, - 4, - {0,1,2,3}, - {0,4,8192*8+0,8192*8+4,8,12,8192*8+8,8192*8+12, - 16*8+0,16*8+4,16*8+8192*8+0,16*8+8192*8+4,16*8+8,16*8+12,16*8+8192*8+8,16*8+8192*8+12}, - {16*0, 16*1, 16*2, 16*3, 16*4, 16*5, 16*6, 16*7, - 16*16, 16*17, 16*18, 16*19, 16*20, 16*21, 16*22, 16*23}, - 16*8*4 -}; - - -static GFXDECODE_START( raiders5 ) - GFXDECODE_ENTRY( REGION_GFX1, 0x0000, spritelayout, 512, 16 ) /* sprite */ - GFXDECODE_ENTRY( REGION_GFX1, 0x4000, spritelayout, 512, 16 ) /* sprite */ - GFXDECODE_ENTRY( REGION_GFX1, 0x0000, charlayout, 0, 16 ) /* FG */ - GFXDECODE_ENTRY( REGION_GFX1, 0x8000, charlayout, 256, 16 ) /* BG */ - GFXDECODE_ENTRY( REGION_GFX1, 0x4000, charlayout, 256, 16 ) /* BG (?)*/ -GFXDECODE_END - - - -static const struct AY8910interface ay8910_interface_1 = -{ - input_port_0_r, - input_port_1_r -}; - -static const struct AY8910interface ay8910_interface_2 = -{ - input_port_2_r, - input_port_3_r -}; - - - -static MACHINE_DRIVER_START( raiders5 ) - - /* basic machine hardware */ - MDRV_CPU_ADD(Z80,12000000/4) /* 3.0MHz? */ - MDRV_CPU_PROGRAM_MAP(raiders5_map_1,0) - MDRV_CPU_IO_MAP(raiders5_io_map_1,0) - MDRV_CPU_VBLANK_INT(irq0_line_hold,1) - - MDRV_CPU_ADD(Z80,12000000/4) /* 3.0MHz? */ - MDRV_CPU_PROGRAM_MAP(raiders5_map_2,0) - MDRV_CPU_VBLANK_INT(irq0_line_hold,4) - - MDRV_INTERLEAVE(400) - - /* video hardware */ - MDRV_VIDEO_ATTRIBUTES(VIDEO_TYPE_RASTER) - MDRV_PALETTE_LENGTH(768) - MDRV_GFXDECODE(raiders5) - MDRV_VIDEO_START(raiders5) - MDRV_VIDEO_UPDATE(raiders5) - - MDRV_SCREEN_ADD("main", 0) - MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MDRV_SCREEN_SIZE(32*8, 32*8) - MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 28*8-1) - MDRV_SCREEN_REFRESH_RATE(60) - MDRV_SCREEN_VBLANK_TIME(DEFAULT_REAL_60HZ_VBLANK_DURATION) - - /* sound hardware */ - MDRV_SPEAKER_STANDARD_MONO("mono") - - MDRV_SOUND_ADD(AY8910, 12000000/8) - MDRV_SOUND_CONFIG(ay8910_interface_1) - MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - - MDRV_SOUND_ADD(AY8910, 12000000/8) - MDRV_SOUND_CONFIG(ay8910_interface_2) - MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) -MACHINE_DRIVER_END - - - -ROM_START( raiders5 ) - ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* CPU1 */ - ROM_LOAD( "raiders5.1", 0x0000, 0x4000, CRC(47cea11f) SHA1(0499e6627ad9c16775fdc59f2ff56dfdfc23490a) ) - ROM_LOAD( "raiders5.2", 0x4000, 0x4000, CRC(eb2ff410) SHA1(5c995b66b6301cd3cd58efd173481deaa036f842) ) - - ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* CPU2 */ - ROM_LOAD( "raiders5.2", 0x0000, 0x4000, CRC(eb2ff410) SHA1(5c995b66b6301cd3cd58efd173481deaa036f842) ) - - ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_DISPOSE ) - ROM_LOAD( "raiders3.11f", 0x0000, 0x4000, CRC(30041d58) SHA1(a33087de7afb276925879898a96f418128a5a38c) ) - ROM_LOAD( "raiders4.11g", 0x4000, 0x4000, CRC(e441931c) SHA1(f39b4c25de779c671a6e2b02df64e7fed726f4da) ) - ROM_LOAD( "raiders5.11n", 0x8000, 0x4000, CRC(c0895090) SHA1(a3a1ae57ed66bc095ea9bfb26470290f67aab1fe) ) -ROM_END - -ROM_START( raidrs5t ) - ROM_REGION( 0x10000, REGION_CPU1, 0 ) /* CPU1 */ - ROM_LOAD( "raiders1.4c", 0x0000, 0x4000, CRC(4e2d5679) SHA1(a1c1603ba98814a83b92ad024ca4422aea872111) ) - ROM_LOAD( "raiders2.4d", 0x4000, 0x4000, CRC(c8604be1) SHA1(6d23f26174bb9b2f7db3a5fa6b39674fe237135b) ) - - ROM_REGION( 0x10000, REGION_CPU2, 0 ) /* CPU2 */ - ROM_LOAD( "raiders2.4d", 0x0000, 0x4000, CRC(c8604be1) SHA1(6d23f26174bb9b2f7db3a5fa6b39674fe237135b) ) - - ROM_REGION( 0x20000, REGION_GFX1, ROMREGION_DISPOSE ) - ROM_LOAD( "raiders3.11f", 0x0000, 0x4000, CRC(30041d58) SHA1(a33087de7afb276925879898a96f418128a5a38c) ) - ROM_LOAD( "raiders4.11g", 0x4000, 0x4000, CRC(e441931c) SHA1(f39b4c25de779c671a6e2b02df64e7fed726f4da) ) - ROM_LOAD( "raiders5.11n", 0x8000, 0x4000, CRC(c0895090) SHA1(a3a1ae57ed66bc095ea9bfb26470290f67aab1fe) ) -ROM_END - - - -GAME( 1985, raiders5, 0, raiders5, raiders5, 0, ROT0, "UPL", "Raiders5", 0 ) -GAME( 1985, raidrs5t, raiders5, raiders5, raiders5, 0, ROT0, "UPL (Taito license)", "Raiders5 (Japan)", 0 ) diff --git a/src/mame/includes/nova2001.h b/src/mame/includes/nova2001.h new file mode 100644 index 00000000000..9727389cb13 --- /dev/null +++ b/src/mame/includes/nova2001.h @@ -0,0 +1,21 @@ +extern UINT8 *nova2001_fg_videoram, *nova2001_bg_videoram; + +extern WRITE8_HANDLER( nova2001_fg_videoram_w ); +extern WRITE8_HANDLER( nova2001_bg_videoram_w ); +extern WRITE8_HANDLER( ninjakun_bg_videoram_w ); +extern READ8_HANDLER( ninjakun_bg_videoram_r ); +extern WRITE8_HANDLER( nova2001_scroll_x_w ); +extern WRITE8_HANDLER( nova2001_scroll_y_w ); +extern WRITE8_HANDLER( nova2001_flipscreen_w ); +extern WRITE8_HANDLER( pkunwar_flipscreen_w ); +extern WRITE8_HANDLER( ninjakun_paletteram_w ); + +extern PALETTE_INIT( nova2001 ); +extern VIDEO_START( nova2001 ); +extern VIDEO_UPDATE( nova2001 ); +extern VIDEO_START( ninjakun ); +extern VIDEO_UPDATE( ninjakun ); +extern VIDEO_START( pkunwar ); +extern VIDEO_UPDATE( pkunwar ); +extern VIDEO_START( raiders5 ); +extern VIDEO_UPDATE( raiders5 ); diff --git a/src/mame/mame.mak b/src/mame/mame.mak index d8e70c2d3de..d612ad56baf 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -1441,11 +1441,8 @@ $(MAMEOBJ)/univers.a: \ $(MAMEOBJ)/upl.a: \ $(DRIVERS)/mouser.o $(VIDEO)/mouser.o \ - $(DRIVERS)/ninjakun.o $(VIDEO)/ninjakun.o \ $(DRIVERS)/ninjakd2.o $(VIDEO)/ninjakd2.o \ $(DRIVERS)/nova2001.o $(VIDEO)/nova2001.o \ - $(DRIVERS)/pkunwar.o $(VIDEO)/pkunwar.o \ - $(DRIVERS)/raiders5.o $(VIDEO)/raiders5.o \ $(DRIVERS)/xxmissio.o $(VIDEO)/xxmissio.o \ $(MAMEOBJ)/valadon.a: \ diff --git a/src/mame/video/ninjakd2.c b/src/mame/video/ninjakd2.c index af32ce5237f..38fa47fb717 100644 --- a/src/mame/video/ninjakd2.c +++ b/src/mame/video/ninjakd2.c @@ -25,6 +25,12 @@ static UINT8* robokid_bg1_videoram; static UINT8* robokid_bg2_videoram; +/************************************* + * + * Callbacks for the TileMap code + * + *************************************/ + static TILE_GET_INFO( get_fg_tile_info ) { int const lo = ninjakd2_fg_videoram[(tile_index << 1)]; @@ -113,6 +119,12 @@ static TILE_GET_INFO( robokid_get_bg2_tile_info ) +/************************************* + * + * Video system start + * + *************************************/ + static void videoram_alloc(const running_machine* const machine, int const size) { if (size) @@ -194,6 +206,12 @@ VIDEO_START( omegaf ) +/************************************* + * + * Memory handlers + * + *************************************/ + WRITE8_HANDLER( ninjakd2_bgvideoram_w ) { ninjakd2_bg_videoram[offset] = data; @@ -310,6 +328,13 @@ WRITE8_HANDLER( ninjakd2_sprite_overdraw_w ) } + +/************************************* + * + * Video update + * + *************************************/ + static void draw_sprites(running_machine* const machine, mame_bitmap* const bitmap, const rectangle* const cliprect) { const gfx_element* const gfx = machine->gfx[1]; diff --git a/src/mame/video/ninjakun.c b/src/mame/video/ninjakun.c deleted file mode 100644 index f062ef5ef59..00000000000 --- a/src/mame/video/ninjakun.c +++ /dev/null @@ -1,305 +0,0 @@ -#include "driver.h" -#include "sound/ay8910.h" - - -UINT8 *ninjakun_fg_videoram; -UINT8 *ninjakun_bg_videoram; -static tilemap *bg_tilemap, *fg_tilemap; -static UINT8 flipscreen; -static UINT8 ninjakun_xscroll,ninjakun_yscroll; - -static UINT8 ninjakun_io_8000_ctrl[4]; -// static UINT8 old_scroll; - -/******************************************************************************* - Tilemap Callbacks -*******************************************************************************/ - -static TILE_GET_INFO( get_fg_tile_info ){ - UINT32 tile_number = ninjakun_fg_videoram[tile_index] & 0xFF; - UINT8 attr = ninjakun_fg_videoram[tile_index+0x400]; - tile_number += (attr & 0x20) << 3; /* bank */ - SET_TILE_INFO( - 0, - tile_number, - (attr&0xf), - 0); -} - -static TILE_GET_INFO( get_bg_tile_info ){ - UINT32 tile_number = ninjakun_bg_videoram[tile_index] & 0xFF; - UINT8 attr = ninjakun_bg_videoram[tile_index+0x400]; - tile_number += (attr & 0xC0) << 2; /* bank */ - SET_TILE_INFO( - 1, - tile_number, - (attr&0xf), - 0); -} - -WRITE8_HANDLER( ninjakun_fg_videoram_w ){ - ninjakun_fg_videoram[offset] = data; - tilemap_mark_tile_dirty(fg_tilemap,offset&0x3ff); -} - -WRITE8_HANDLER( ninjakun_bg_videoram_w ){ - - int y = (offset + ((ninjakun_yscroll & 0xf8) << 2) ) & 0x3e0; - int x = (offset + (ninjakun_xscroll >> 3) ) & 0x1f; - int offs = x+y+(offset & 0x400); - - ninjakun_bg_videoram[offs] = data; - tilemap_mark_tile_dirty(bg_tilemap,x+y); -} - -READ8_HANDLER( ninjakun_bg_videoram_r ) -{ - int y = (offset + ((ninjakun_yscroll & 0xf8) << 2) ) & 0x3e0; - int x = (offset + (ninjakun_xscroll >> 3) ) & 0x1f; - int offs = x+y+(offset & 0x400); - - return ninjakun_bg_videoram[offs]; -} - -/******************************************************************************/ - -WRITE8_HANDLER( ninjakun_flipscreen_w ){ - flipscreen = data?(TILEMAP_FLIPX|TILEMAP_FLIPY):0; - tilemap_set_flip( ALL_TILEMAPS,flipscreen ); -} - -READ8_HANDLER( ninjakun_io_8000_r ){ - switch( offset ){ - case 0: /* control */ - return AY8910_read_port_0_r( 0 ); - - case 1: /* input read */ - switch( ninjakun_io_8000_ctrl[0] ){ - case 0xf: - return readinputport(4); - case 0xe: - return readinputport(3); - default: - return ninjakun_io_8000_ctrl[1]; - } - break; - - case 2: /* control */ - return AY8910_read_port_1_r( 0 ); - - case 3: /* data */ - return ninjakun_io_8000_ctrl[3]; - } - -// logerror("PC=%04x; RAM[0x800%d]\n",activecpu_get_pc(),offset); - return 0xFF; -} - -/* static void handle_scrolly( UINT8 new_scroll ){ */ - -/* HACK!!! -** -** New rows are always written at fixed locations above and below the background -** tilemaps, rather than at the logical screen boundaries with respect to scrolling. -** -** I don't know how this is handled by the actual NinjaKun hardware, but the -** following is a crude approximation, yielding a playable game. -*/ - -/* - int old_row = old_scroll/8; - int new_row = new_scroll/8; - int i; - if( new_scroll!=old_scroll ){ - tilemap_set_scrolly( bg_tilemap, 0, new_scroll&7 ); - - if ((new_row == ((old_row - 1) & 0xff)) || ((!old_row) && (new_row == 0x1f))) - { - for( i=0x400-0x21; i>=0; i-- ){ - ninjakun_bg_videoram_w( i+0x20, ninjakun_bg_videoram[i] ); - } - } - else if ((new_row == ((old_row + 1) & 0xff)) || ((old_row == 0x1f) && (!new_row))) - { - for( i=0x20; i<0x400; i++ ){ - ninjakun_bg_videoram_w( i-0x20, ninjakun_bg_videoram[i] ); - } - } - - old_scroll = new_scroll; - } -} -*/ - - -WRITE8_HANDLER( ninjakun_io_8000_w ){ - switch( offset ){ - case 0x0: /* control#1 */ - ninjakun_io_8000_ctrl[0] = data; - AY8910_control_port_0_w( 0, data ); - break; - - case 0x1: /* data#1 */ - ninjakun_io_8000_ctrl[1] = data; - switch( ninjakun_io_8000_ctrl[0] ){ - default: - AY8910_write_port_0_w( 0,data ); - break; - } - break; - - case 0x2: /* control#2 */ - ninjakun_io_8000_ctrl[2] = data; - AY8910_control_port_1_w( 0, data ); - break; - - case 0x3: /* data#2 */ - ninjakun_io_8000_ctrl[3] = data; - switch( ninjakun_io_8000_ctrl[2] ){ - case 0xf: - tilemap_set_scrolly( bg_tilemap, 0, data ); - ninjakun_yscroll = data; - break; - case 0xe: - if (flipscreen == 0) - tilemap_set_scrollx( bg_tilemap, 0, data-7 ); - else - tilemap_set_scrollx( bg_tilemap, 0, data ); - ninjakun_xscroll = data; - break; - default: - AY8910_write_port_1_w( 0,data ); - } - break; - } -} - -WRITE8_HANDLER( ninjakun_paletteram_w ) -{ - int i; - - paletteram_BBGGRRII_w(offset,data); - - if (offset > 15) - return; - - if (offset != 1) - { - for (i=0; i<16; i++) - { - paletteram_BBGGRRII_w(0x200+offset+i*16,data); - } - } - paletteram_BBGGRRII_w(0x200+offset*16+1,data); -} - -/******************************************************************************* - Video Hardware Functions -******************************************************************************** - vh_start / vh_refresh -*******************************************************************************/ - -VIDEO_START( ninjakun ){ - fg_tilemap = tilemap_create( get_fg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32 ); - bg_tilemap = tilemap_create( get_bg_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32 ); - tilemap_set_transparent_pen( fg_tilemap,0 ); - - /* Save State Support */ - - state_save_register_global_array(ninjakun_io_8000_ctrl); - state_save_register_global(flipscreen); -// state_save_register_global(old_scroll); -} - -static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect ){ - const UINT8 *source = spriteram; - const UINT8 *finish = source+0x800; - - const gfx_element *gfx = machine->gfx[2]; - - while( source240) - drawgfx( - bitmap, - gfx, - tile_number, - color, - flipx,flipy, - sx-256,sy, - cliprect, - TRANSPARENCY_PEN,0 - ); - - source+=0x20; - } -} - -VIDEO_UPDATE( ninjakun ) -{ - int offs,chr,col,px,py,x,y; - - tilemap_draw( bitmap,cliprect,bg_tilemap,0,0 ); - tilemap_draw( bitmap,cliprect,fg_tilemap,0,0 ); - draw_sprites( machine, bitmap,cliprect ); - - for (y=4; y<28; y++) - { - for (x=0; x<32; x++) - { - offs = y*32+x; - chr = ninjakun_fg_videoram[offs]; - col = ninjakun_fg_videoram[offs + 0x400]; - chr += (col & 0x20) << 3; - - if ((col & 0x10) == 0) - { - - if (flipscreen==0) - { - px = 8*x; - py = 8*y; - } - else - { - px = 248-8*x; - py = 248-8*y; - } - - drawgfx(bitmap,machine->gfx[0], - chr, - col & 0x0f, - flipscreen,flipscreen, - px,py, - cliprect,TRANSPARENCY_PEN,0); - } - } - } - - - return 0; -} diff --git a/src/mame/video/nova2001.c b/src/mame/video/nova2001.c index 35a40e6dc4c..4c0545d3475 100644 --- a/src/mame/video/nova2001.c +++ b/src/mame/video/nova2001.c @@ -1,64 +1,20 @@ -/******************************************************************************* - - Nova 2001 - Video Description: - -------------------------------------------------------------------------- - - Foreground Playfield Chars (static) - character code index from first set of chars - Foreground Playfield color modifier RAM - Char colors are normally taken from the first set of 16, - This is the pen for "color 1" for this tile (from the first 16 pens) - - Background Playfield Chars (scrolling) - character code index from second set of chars - Foreground Playfield color modifier RAM - Char colors are normally taken from the second set of 16, - This is the pen for "color 1" for this tile (from the second 16 pens) - (Scrolling in controlled via the 8910 A and B port outputs) - - Sprite memory is made of 32 byte records: - - Sprite+0, 0x80 = Sprite Bank - Sprite+0, 0x7f = Sprite Character Code - Sprite+1, 0xff = X location - Sprite+2, 0xff = Y location - Sprite+3, 0x20 = Y Flip - Sprite+3, 0x10 = X Flip - Sprite+3, 0x0f = pen for "color 1" taken from the first 16 colors - Sprite+3, 0x80 - Sprite+3, 0x40 - - All the rest are unknown and/or uneccessary. - -*******************************************************************************/ - #include "driver.h" +#include "nova2001.h" -UINT8 *nova2001_videoram2, *nova2001_colorram2; +UINT8 *nova2001_fg_videoram, *nova2001_bg_videoram; static tilemap *bg_tilemap, *fg_tilemap; + +/************************************* + * + * Palette handling + * + *************************************/ + PALETTE_INIT( nova2001 ) { - int i,j; - - - for (i = 0;i < machine->drv->total_colors;i++) - { - int intensity,r,g,b; - - - intensity = (*color_prom >> 0) & 0x03; - /* red component */ - r = (((*color_prom >> 0) & 0x0c) | intensity) * 0x11; - /* green component */ - g = (((*color_prom >> 2) & 0x0c) | intensity) * 0x11; - /* blue component */ - b = (((*color_prom >> 4) & 0x0c) | intensity) * 0x11; - - palette_set_color(machine,i,MAKE_RGB(r,g,b)); - color_prom++; - } + int i; /* Color #1 is used for palette animation. */ @@ -66,54 +22,215 @@ PALETTE_INIT( nova2001 ) /* the primary 16 colors, while color entries 16-31 */ /* are based on the secondary set. */ - /* The only difference among 0-15 and 16-31 is that */ + /* The only difference between 0-15 and 16-31 is that */ /* color #1 changes each time */ - for (i = 0;i < 16;i++) + for (i = 0; i < 0x200; ++i) { - for (j = 0;j < 16;j++) + int entry; + int intensity,r,g,b; + + if ((i & 0xf) == 1) { - if (j == 1) + entry = ((i & 0xf0) >> 4) | ((i & 0x100) >> 4); + } + else + { + entry = ((i & 0x0f) >> 0) | ((i & 0x100) >> 4); + } + + intensity = (color_prom[entry] >> 0) & 0x03; + /* red component */ + r = (((color_prom[entry] >> 0) & 0x0c) | intensity) * 0x11; + /* green component */ + g = (((color_prom[entry] >> 2) & 0x0c) | intensity) * 0x11; + /* blue component */ + b = (((color_prom[entry] >> 4) & 0x0c) | intensity) * 0x11; + + palette_set_color(machine,i,MAKE_RGB(r,g,b)); + } +} + +WRITE8_HANDLER( ninjakun_paletteram_w ) +{ + int i; + + paletteram_BBGGRRII_w(offset,data); + + // expand the sprite palette to full length + if (offset < 16) + { + paletteram_BBGGRRII_w(0x200 + offset * 16 + 1, data); + + if (offset != 1) + { + for (i = 0; i < 16; i++) { - colortable[16*i+1] = i; - colortable[16*i+16*16+1] = i+16; - } - else - { - colortable[16*i+j] = j; - colortable[16*i+16*16+j] = j+16; + paletteram_BBGGRRII_w(0x200 + offset + i * 16, data); } } } } -WRITE8_HANDLER( nova2001_videoram_w ) + + +/************************************* + * + * Callbacks for the TileMap code + * + *************************************/ + +static TILE_GET_INFO( nova2001_get_bg_tile_info ) { - videoram[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset); + int code = nova2001_bg_videoram[tile_index]; + int color = nova2001_bg_videoram[tile_index + 0x400] & 0x0f; + + SET_TILE_INFO(2, code, color, 0); } -WRITE8_HANDLER( nova2001_colorram_w ) +static TILE_GET_INFO( nova2001_get_fg_tile_info ) { - colorram[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset); + int attr = nova2001_fg_videoram[tile_index + 0x400]; + int code = nova2001_fg_videoram[tile_index]; + int color = attr & 0x0f; + + SET_TILE_INFO(1, code, color, 0); + + tileinfo->category = (attr & 0x10) >> 4; } -WRITE8_HANDLER( nova2001_videoram2_w ) +static TILE_GET_INFO( ninjakun_get_bg_tile_info ) { - nova2001_videoram2[offset] = data; - tilemap_mark_tile_dirty(fg_tilemap, offset); + int attr = nova2001_bg_videoram[tile_index+0x400]; + int code = nova2001_bg_videoram[tile_index] + ((attr & 0xc0) << 2); + int color = attr & 0x0f; + + SET_TILE_INFO(2, code, color, 0); } -WRITE8_HANDLER( nova2001_colorram2_w ) +static TILE_GET_INFO( ninjakun_get_fg_tile_info ) { - nova2001_colorram2[offset] = data; - tilemap_mark_tile_dirty(fg_tilemap, offset); + int attr = nova2001_fg_videoram[tile_index+0x400]; + int code = nova2001_fg_videoram[tile_index] + ((attr & 0x20) << 3); + int color = attr & 0x0f; + + SET_TILE_INFO(1, code, color, 0); + + tileinfo->category = (attr & 0x10) >> 4; +} + +static TILE_GET_INFO( pkunwar_get_bg_tile_info ) +{ + int attr = nova2001_bg_videoram[tile_index + 0x400]; + int code = nova2001_bg_videoram[tile_index] + ((attr & 0x07) << 8); + int color = (attr & 0xf0) >> 4; + + SET_TILE_INFO(1, code, color, 0); + + tileinfo->category = (attr & 0x08) >> 3; +} + +static TILE_GET_INFO( raiders5_get_bg_tile_info ) +{ + int attr = nova2001_bg_videoram[tile_index+0x400]; + int code = nova2001_bg_videoram[tile_index] + ((attr & 0x01) << 8); + int color = (attr & 0xf0) >> 4; + + SET_TILE_INFO(2, code, color, 0); +} + +static TILE_GET_INFO( raiders5_get_fg_tile_info ) +{ + int code = nova2001_fg_videoram[tile_index]; + int color = (nova2001_fg_videoram[tile_index + 0x400] & 0xf0) >> 4; + + SET_TILE_INFO(1, code, color, 0); +} + + + +/************************************* + * + * Video system start + * + *************************************/ + +VIDEO_START( nova2001 ) +{ + bg_tilemap = tilemap_create(nova2001_get_bg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32); + fg_tilemap = tilemap_create(nova2001_get_fg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32); + tilemap_set_transparent_pen(fg_tilemap, 0); + tilemap_set_scrolldx(bg_tilemap, 0, -7); +} + +VIDEO_START( pkunwar ) +{ + bg_tilemap = tilemap_create(pkunwar_get_bg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32); + tilemap_set_transparent_pen(bg_tilemap, 0); +} + +VIDEO_START( ninjakun ) +{ + bg_tilemap = tilemap_create(ninjakun_get_bg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32); + fg_tilemap = tilemap_create(ninjakun_get_fg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32); + tilemap_set_transparent_pen(fg_tilemap, 0); + tilemap_set_scrolldx(bg_tilemap, 7, 0); +} + +VIDEO_START( raiders5 ) +{ + bg_tilemap = tilemap_create(raiders5_get_bg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32); + fg_tilemap = tilemap_create(raiders5_get_fg_tile_info, tilemap_scan_rows, TILEMAP_TYPE_PEN, 8, 8, 32, 32); + tilemap_set_transparent_pen(fg_tilemap, 0); + tilemap_set_scrolldx(bg_tilemap, 7, 0); +} + + + +/************************************* + * + * Memory handlers + * + *************************************/ + +WRITE8_HANDLER( nova2001_fg_videoram_w ) +{ + nova2001_fg_videoram[offset] = data; + tilemap_mark_tile_dirty(fg_tilemap, offset & 0x3ff); +} + +WRITE8_HANDLER( nova2001_bg_videoram_w ) +{ + nova2001_bg_videoram[offset] = data; + tilemap_mark_tile_dirty(bg_tilemap,offset & 0x3ff); +} + +WRITE8_HANDLER( ninjakun_bg_videoram_w ) +{ + int x = tilemap_get_scrollx(bg_tilemap, 0) >> 3; + int y = tilemap_get_scrolly(bg_tilemap, 0) >> 3; + + // add scroll registers to address + offset = ((offset + x + (y << 5)) & 0x3ff) + (offset & 0x400); + + nova2001_bg_videoram[offset] = data; + tilemap_mark_tile_dirty(bg_tilemap,offset & 0x3ff); +} + +READ8_HANDLER( ninjakun_bg_videoram_r ) +{ + int x = tilemap_get_scrollx(bg_tilemap, 0) >> 3; + int y = tilemap_get_scrolly(bg_tilemap, 0) >> 3; + + // add scroll registers to address + offset = ((offset + x + (y << 5)) & 0x3ff) + (offset & 0x400); + + return nova2001_bg_videoram[offset]; } WRITE8_HANDLER( nova2001_scroll_x_w ) { - tilemap_set_scrollx(bg_tilemap, 0, data - (flip_screen ? 0 : 7)); + tilemap_set_scrollx(bg_tilemap, 0, data); } WRITE8_HANDLER( nova2001_scroll_y_w ) @@ -123,50 +240,42 @@ WRITE8_HANDLER( nova2001_scroll_y_w ) WRITE8_HANDLER( nova2001_flipscreen_w ) { - if (flip_screen != (~data & 0x01)) - { - flip_screen_set(~data & 0x01); - tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); - } + // inverted + flip_screen_set(~data & 1); } -static TILE_GET_INFO( get_bg_tile_info ) +WRITE8_HANDLER( pkunwar_flipscreen_w ) { - int code = videoram[tile_index]; - int color = colorram[tile_index] & 0x0f; - - SET_TILE_INFO(1, code, color, 0); + flip_screen_set(data & 1); } -static TILE_GET_INFO( get_fg_tile_info ) -{ - int code = nova2001_videoram2[tile_index]; - int color = nova2001_colorram2[tile_index] & 0x0f; - - SET_TILE_INFO(0, code, color, 0); -} - -VIDEO_START( nova2001 ) -{ - bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, - TILEMAP_TYPE_PEN, 8, 8, 32, 32); - - fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows, - TILEMAP_TYPE_PEN, 8, 8, 32, 32); - - tilemap_set_transparent_pen(fg_tilemap, 0); -} - -static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect ) + + +/************************************* + * + * Video update + * + *************************************/ + +static void nova2001_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect ) { + const gfx_element *gfx = machine->gfx[0]; int offs; - for (offs = 0;offs < spriteram_size;offs += 32) + for (offs = 0; offs < 0x800; offs += 32) { - int flipx = spriteram[offs+3] & 0x10; - int flipy = spriteram[offs+3] & 0x20; - int sx = spriteram[offs+1]; + int attr = spriteram[offs+3]; + int flipx = attr & 0x10; + int flipy = attr & 0x20; + int sx = spriteram[offs+1] - ((attr & 0x40) << 2); // high bit shown in schematics, not used by game int sy = spriteram[offs+2]; + int tile = spriteram[offs+0]; + int color = attr & 0x0f; + + if (attr & 0x80) // disable bit shown in schematics, not used by game + { + continue; + } if (flip_screen) { @@ -176,19 +285,108 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re flipy = !flipy; } - drawgfx(bitmap,machine->gfx[2 + ((spriteram[offs+0] & 0x80) >> 7)], - spriteram[offs+0] & 0x7f, - spriteram[offs+3] & 0x0f, - flipx,flipy, - sx,sy, - cliprect,TRANSPARENCY_PEN,0); + drawgfx(bitmap, gfx, + tile, + color, + flipx, flipy, + sx, sy, + cliprect, TRANSPARENCY_PEN, 0); } } +static void pkunwar_draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect ) +{ + const gfx_element *gfx = machine->gfx[0]; + int offs; + + for (offs = 0; offs < 0x800; offs += 32) + { + int attr = spriteram[offs+3]; + int flipx = spriteram[offs+0] & 0x01; + int flipy = spriteram[offs+0] & 0x02; + int sx = spriteram[offs+1]; + int sy = spriteram[offs+2]; + int tile = ((spriteram[offs+0] & 0xfc) >> 2) + ((attr & 0x07) << 6); + int color = (attr & 0xf0) >> 4; + + if (attr & 0x08) // deducted by comparison, not used by game + { + continue; + } + + if (flip_screen) + { + sx = 240 - sx; + sy = 240 - sy; + flipx = !flipx; + flipy = !flipy; + } + + drawgfx(bitmap, gfx, + tile, + color, + flipx, flipy, + sx, sy, + cliprect, TRANSPARENCY_PEN, 0); + + // there's no X MSB, so draw with wraparound (fixes title screen) + drawgfx(bitmap, gfx, + tile, + color, + flipx, flipy, + sx - 256, sy, + cliprect, TRANSPARENCY_PEN, 0); + } +} + + + VIDEO_UPDATE( nova2001 ) { tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); - draw_sprites(machine, bitmap, cliprect); + + nova2001_draw_sprites(machine, bitmap, cliprect); + + // according to the schematics, fg category 0 should be drawn behind sprites, + // but it doesn't look right that way tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0); + tilemap_draw(bitmap, cliprect, fg_tilemap, 1, 0); + + return 0; +} + +VIDEO_UPDATE( pkunwar ) +{ + tilemap_draw(bitmap, cliprect, bg_tilemap, TILEMAP_DRAW_OPAQUE | 0, 0); + tilemap_draw(bitmap, cliprect, bg_tilemap, TILEMAP_DRAW_OPAQUE | 1, 0); + + pkunwar_draw_sprites(machine, bitmap, cliprect); + + tilemap_draw(bitmap, cliprect, bg_tilemap, 1, 0); + + return 0; +} + +VIDEO_UPDATE( ninjakun ) +{ + tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); + + tilemap_draw(bitmap, cliprect, fg_tilemap, 1, 0); + + nova2001_draw_sprites(machine, bitmap, cliprect); + + tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0); + + return 0; +} + +VIDEO_UPDATE( raiders5 ) +{ + tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); + + pkunwar_draw_sprites(machine, bitmap, cliprect); + + tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0); + return 0; } diff --git a/src/mame/video/pkunwar.c b/src/mame/video/pkunwar.c deleted file mode 100644 index fae2a3ac3d6..00000000000 --- a/src/mame/video/pkunwar.c +++ /dev/null @@ -1,100 +0,0 @@ -/*************************************************************************** - - video.c - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "driver.h" - - -static int flipscreen[2]; - - -WRITE8_HANDLER( pkunwar_flipscreen_w ) -{ - flipscreen[0] = data & 1; - flipscreen[1] = data & 2; -} - - - -VIDEO_UPDATE( pkunwar ) -{ - int offs; - - - /* for every character in the Video RAM */ - for (offs = videoram_size - 1;offs >= 0;offs--) - { - int sx,sy; - - - sx = offs % 32; - sy = offs / 32; - if (flipscreen[0]) sx = 31 - sx; - if (flipscreen[1]) sy = 31 - sy; - - drawgfx(bitmap,machine->gfx[0], - videoram[offs] + ((colorram[offs] & 0x07) << 8), - (colorram[offs] & 0xf0) >> 4, - flipscreen[0],flipscreen[1], - 8*sx,8*sy, - cliprect,TRANSPARENCY_NONE,0); - } - - - /* Draw the sprites. */ - for (offs = 0;offs < spriteram_size;offs += 32) - { - int sx,sy,flipx,flipy; - - - sx = ((spriteram[offs + 1] + 8) & 0xff) - 8; - sy = spriteram[offs + 2]; - flipx = spriteram[offs] & 0x01; - flipy = spriteram[offs] & 0x02; - if (flipscreen[0]) - { - sx = 240 - sx; - flipx = !flipx; - } - if (flipscreen[1]) - { - sy = 240 - sy; - flipy = !flipy; - } - - drawgfx(bitmap,machine->gfx[1], - ((spriteram[offs] & 0xfc) >> 2) + ((spriteram[offs + 3] & 0x07) << 6), - (spriteram[offs + 3] & 0xf0) >> 4, - flipx,flipy, - sx,sy, - &machine->screen[0].visarea,TRANSPARENCY_PEN,0); - } - - - /* redraw characters which have priority over sprites */ - for (offs = videoram_size - 1;offs >= 0;offs--) - { - if (colorram[offs] & 0x08) - { - int sx,sy; - - - sx = offs % 32; - sy = offs / 32; - if (flipscreen[0]) sx = 31 - sx; - if (flipscreen[1]) sy = 31 - sy; - - drawgfx(bitmap,machine->gfx[0], - videoram[offs] + ((colorram[offs] & 0x07) << 8), - (colorram[offs] & 0xf0) >> 4, - flipscreen[0],flipscreen[1], - 8*sx,8*sy, - &machine->screen[0].visarea,TRANSPARENCY_PEN,0); - } - } - return 0; -} diff --git a/src/mame/video/raiders5.c b/src/mame/video/raiders5.c deleted file mode 100644 index 2a660b61388..00000000000 --- a/src/mame/video/raiders5.c +++ /dev/null @@ -1,233 +0,0 @@ -/******************************************************************************* - -Raiders5 (c) 1985 Taito / UPL - -Video hardware driver by Uki - - 02/Jun/2001 - - -*******************************************************************************/ - -#include "driver.h" - - -UINT8 *raiders5_foreground_videoram; -UINT8 *raiders5_foreground_colorram; -UINT8 *raiders5_background_videoram; -UINT8 *raiders5_background_colorram; -UINT8 *raiders5_spriteram; -size_t raiders5_spriteram_size; - - -static UINT8 raiders5_scroll_x; -static UINT8 raiders5_scroll_y; -static UINT8 raiders5_flip_screen; - -static tilemap *background_tilemap; -static tilemap *foreground_tilemap; - - - -/************************************* - * - * Callbacks for the TileMap code - * - *************************************/ - -static TILE_GET_INFO( get_background_tile_info ) -{ - UINT8 bank = ((raiders5_background_colorram[tile_index] >> 1) & 0x01) + 3; /* ? */ - - UINT16 code = raiders5_background_videoram[tile_index] | - ((raiders5_background_colorram[tile_index] & 0x01) << 8); - - UINT8 color = raiders5_background_colorram[tile_index] >> 4; - - SET_TILE_INFO(bank, code, color, 0); -} - - -static TILE_GET_INFO( get_foreground_tile_info ) -{ - UINT16 code = raiders5_foreground_videoram[tile_index]; - - UINT8 color = raiders5_foreground_colorram[tile_index] >> 4; - - SET_TILE_INFO(2, code, color, 0); -} - - - -/************************************* - * - * Video system start - * - *************************************/ - -VIDEO_START( raiders5 ) -{ - background_tilemap = tilemap_create(get_background_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32); - foreground_tilemap = tilemap_create(get_foreground_tile_info,tilemap_scan_rows,TILEMAP_TYPE_PEN,8,8,32,32); - - tilemap_set_scrolldx(background_tilemap, 7, 0); - - tilemap_set_transparent_pen(foreground_tilemap, 0); -} - - - -/************************************* - * - * Memory handlers - * - *************************************/ - -WRITE8_HANDLER( raiders5_scroll_x_w ) -{ - raiders5_scroll_x = data; -} - - -WRITE8_HANDLER( raiders5_scroll_y_w ) -{ - raiders5_scroll_y = data; -} - - -WRITE8_HANDLER( raiders5_flip_screen_w ) -{ - raiders5_flip_screen = data & 0x01; - - tilemap_set_flip(ALL_TILEMAPS, (raiders5_flip_screen ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0)); -} - - -WRITE8_HANDLER( raiders5_foreground_videoram_w ) -{ - raiders5_foreground_videoram[offset] = data; - tilemap_mark_tile_dirty(foreground_tilemap, offset); -} - - -WRITE8_HANDLER( raiders5_foreground_colorram_w ) -{ - raiders5_foreground_colorram[offset] = data; - tilemap_mark_tile_dirty(foreground_tilemap, offset); -} - - -WRITE8_HANDLER( raiders5_background_videoram_w ) -{ - offs_t y = (offset + ((raiders5_scroll_y & 0xf8) << 2)) & 0x3e0; - offs_t x = (offset + (raiders5_scroll_x >> 3)) & 0x1f; - - raiders5_background_videoram[y | x] = data; - tilemap_mark_tile_dirty(background_tilemap, y | x); -} - - -READ8_HANDLER( raiders5_background_videoram_r ) -{ - offs_t y = (offset + ((raiders5_scroll_y & 0xf8) << 2)) & 0x3e0; - offs_t x = (offset + (raiders5_scroll_x >> 3)) & 0x1f; - - return raiders5_background_videoram[y | x]; -} - - -WRITE8_HANDLER( raiders5_background_colorram_w ) -{ - offs_t y = (offset + ((raiders5_scroll_y & 0xf8) << 2)) & 0x3e0; - offs_t x = (offset + (raiders5_scroll_x >> 3)) & 0x1f; - - raiders5_background_colorram[y | x] = data; - tilemap_mark_tile_dirty(background_tilemap, y | x); -} - - -READ8_HANDLER( raiders5_background_colorram_r ) -{ - offs_t y = (offset + ((raiders5_scroll_y & 0xf8) << 2)) & 0x3e0; - offs_t x = (offset + (raiders5_scroll_x >> 3)) & 0x1f; - - return raiders5_background_colorram[y | x]; -} - - -WRITE8_HANDLER( raiders5_paletteram_w ) -{ - paletteram_BBGGRRII_w(offset, data); - - if (offset < 0x10) - { - if (offset != 1) - { - int i; - - for (i = 0; i < 0x10; i++) - { - paletteram_BBGGRRII_w(offset + (i * 0x10) + 0x0200, data); - } - } - - paletteram_BBGGRRII_w((offset * 0x10) + 0x0201, data); - } -} - - - -/************************************* - * - * Video update - * - *************************************/ - -static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const rectangle *cliprect) -{ - offs_t offs; - - for (offs = 0; offs < raiders5_spriteram_size; offs += 32) - { - UINT8 bank = (raiders5_spriteram[offs + 3] >> 1) & 0x01; - - UINT8 code = ((raiders5_spriteram[offs + 3] << 6) & 0x40) | (raiders5_spriteram[offs + 0] >> 2); - - UINT8 color = raiders5_spriteram[offs + 3] >> 4; - - int flip_y = ((raiders5_spriteram[offs + 0] >> 1) & 0x01) ^ raiders5_flip_screen; - int flip_x = ((raiders5_spriteram[offs + 0] >> 0) & 0x01) ^ raiders5_flip_screen; - - UINT8 y = raiders5_spriteram[offs + 2]; - UINT8 x = raiders5_spriteram[offs + 1]; - - if (raiders5_flip_screen) - { - y = 240 - y; - x = 240 - x; - } - - drawgfx(bitmap,machine->gfx[bank], - code, color, flip_x, flip_y, - x, y, cliprect, TRANSPARENCY_PEN, 0); - - /* draw it wrapped around */ - drawgfx(bitmap,machine->gfx[bank], - code, color, flip_x, flip_y, - x - 0x100, y, cliprect, TRANSPARENCY_PEN, 0); - } -} - - -VIDEO_UPDATE( raiders5 ) -{ - tilemap_set_scrolly(background_tilemap, 0, raiders5_scroll_y); - tilemap_set_scrollx(background_tilemap, 0, raiders5_scroll_x); - - tilemap_draw(bitmap, cliprect, background_tilemap, 0, 0); - - draw_sprites(machine, bitmap, cliprect); - - tilemap_draw(bitmap, cliprect, foreground_tilemap, 0, 0); - - return 0; -}