diff --git a/.gitattributes b/.gitattributes index fd42817456d..c1dd8c7fdeb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1858,6 +1858,7 @@ src/mame/drivers/naomi.c svneol=native#text/plain src/mame/drivers/naughtyb.c svneol=native#text/plain src/mame/drivers/nbmj8688.c svneol=native#text/plain src/mame/drivers/nbmj8891.c svneol=native#text/plain +src/mame/drivers/nbmj8900.c svneol=native#text/plain src/mame/drivers/nbmj8991.c svneol=native#text/plain src/mame/drivers/nbmj9195.c svneol=native#text/plain src/mame/drivers/nemesis.c svneol=native#text/plain @@ -3356,6 +3357,7 @@ src/mame/video/namcos86.c svneol=native#text/plain src/mame/video/naughtyb.c svneol=native#text/plain src/mame/video/nbmj8688.c svneol=native#text/plain src/mame/video/nbmj8891.c svneol=native#text/plain +src/mame/video/nbmj8900.c svneol=native#text/plain src/mame/video/nbmj8991.c svneol=native#text/plain src/mame/video/nbmj9195.c svneol=native#text/plain src/mame/video/nemesis.c svneol=native#text/plain diff --git a/src/mame/drivers/nbmj8900.c b/src/mame/drivers/nbmj8900.c new file mode 100644 index 00000000000..70c138f58b1 --- /dev/null +++ b/src/mame/drivers/nbmj8900.c @@ -0,0 +1,423 @@ +/****************************************************************************** + + nbmj8900 - Nichibutsu Mahjong games for years 1989 + + Driver by Takahiro Nogi 2007/05/13 - + +******************************************************************************/ +/****************************************************************************** + +Notes: + +TODO: + +- Real machine has ROMs for protection, but I don't know how to access the ROM, + so I'm doing something that works but is probably wrong. + The interesting thing about that ROM is that it comes from other, older games, + so it isn't needed, it's just verified for protection. + +- Some games display "GFXROM BANK OVER!!" or "GFXROM ADDRESS OVER!!" + in Debug build. + +- Screen flipping is not perfect. + +******************************************************************************/ + +#include "driver.h" +#include "nb1413m3.h" +#include "cpu/z80/z80.h" +#include "sound/dac.h" +#include "sound/ay8910.h" +#include "sound/3812intf.h" + + +#define SIGNED_DAC 0 // 0:unsigned DAC, 1:signed DAC +#if SIGNED_DAC +#define DAC_WRITE dac_signed_w +#else +#define DAC_WRITE dac_w +#endif + + + +extern VIDEO_UPDATE( nbmj8900 ); +extern VIDEO_START( nbmj8900_2layer ); + +extern READ8_HANDLER( nbmj8900_palette_type1_r ); +extern WRITE8_HANDLER( nbmj8900_palette_type1_w ); +extern WRITE8_HANDLER( nbmj8900_blitter_w ); +extern WRITE8_HANDLER( nbmj8900_scrolly_w ); +extern WRITE8_HANDLER( nbmj8900_vramsel_w ); +extern WRITE8_HANDLER( nbmj8900_romsel_w ); +extern WRITE8_HANDLER( nbmj8900_clutsel_w ); +extern READ8_HANDLER( nbmj8900_clut_r ); +extern WRITE8_HANDLER( nbmj8900_clut_w ); + + +static DRIVER_INIT( ohpaipee ) +{ +#if 0 + UINT8 *prot = memory_region(machine, "protdata"); + int i; + + /* this is one possible way to rearrange the protection ROM data to get the + expected 0x8374 checksum. It's probably completely wrong! But since the + game doesn't do anything else with that ROM, this is more than enough. I + could just fill this are with fake data, the only thing that matters is + the checksum. */ + + for (i = 0;i < 0x20000;i++) + { + prot[i] = BITSWAP8(prot[i],2,7,3,5,0,6,4,1); + } +#else + unsigned char *ROM = memory_region(machine, "maincpu"); + + // Protection ROM check skip + ROM[0x00e4] = 0x00; + ROM[0x00e5] = 0x00; + ROM[0x00e6] = 0x00; + // Program ROM SUM check skip + ROM[0x025c] = 0x00; + ROM[0x025d] = 0x00; +#endif + + nb1413m3_type = NB1413M3_OHPAIPEE; + +// init_nb1413m3(machine); +} + +static DRIVER_INIT( togenkyo ) +{ +#if 0 + UINT8 *prot = memory_region(machine, "protdata"); + int i; + + /* this is one possible way to rearrange the protection ROM data to get the + expected 0x5ece checksum. It's probably completely wrong! But since the + game doesn't do anything else with that ROM, this is more than enough. I + could just fill this are with fake data, the only thing that matters is + the checksum. */ + for (i = 0;i < 0x20000;i++) + { + prot[i] = BITSWAP8(prot[i],2,7,3,5,0,6,4,1); + } +#else + unsigned char *ROM = memory_region(machine, "maincpu"); + + // Protection ROM check skip + ROM[0x010b] = 0x00; + ROM[0x010c] = 0x00; + ROM[0x010d] = 0x00; + // Program ROM SUM check skip +// ROM[0x025c] = 0x00; +// ROM[0x025d] = 0x00; +#endif + + nb1413m3_type = NB1413M3_TOGENKYO; + +//S init_nb1413m3(machine); +} + + +static ADDRESS_MAP_START( ohpaipee_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0xefff) AM_ROM + AM_RANGE(0xf000, 0xf00f) AM_READWRITE(nbmj8900_clut_r, nbmj8900_clut_w) + AM_RANGE(0xf400, 0xf5ff) AM_READWRITE(nbmj8900_palette_type1_r, nbmj8900_palette_type1_w) + AM_RANGE(0xf800, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( togenkyo_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0xefff) AM_ROM + AM_RANGE(0xf000, 0xf00f) AM_READWRITE(nbmj8900_clut_r, nbmj8900_clut_w) + AM_RANGE(0xf400, 0xf5ff) AM_READWRITE(nbmj8900_palette_type1_r, nbmj8900_palette_type1_w) + AM_RANGE(0xf800, 0xffff) AM_RAM +ADDRESS_MAP_END + +static ADDRESS_MAP_START( ohpaipee_io_map, ADDRESS_SPACE_IO, 8 ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x7f) AM_READ(nb1413m3_sndrom_r) + AM_RANGE(0x00, 0x00) AM_WRITE(nb1413m3_nmi_clock_w) + AM_RANGE(0x20, 0x27) AM_WRITE(nbmj8900_blitter_w) + + AM_RANGE(0x40, 0x40) AM_WRITE(nbmj8900_clutsel_w) + AM_RANGE(0x60, 0x60) AM_WRITE(nbmj8900_romsel_w) + AM_RANGE(0x70, 0x70) AM_WRITE(nbmj8900_scrolly_w) + + AM_RANGE(0x80, 0x81) AM_DEVREADWRITE("ym", ym3812_r,ym3812_w) + + AM_RANGE(0x90, 0x90) AM_READ(nb1413m3_inputport0_r) + + AM_RANGE(0xa0, 0xa0) AM_READWRITE(nb1413m3_inputport1_r,nb1413m3_inputportsel_w) + AM_RANGE(0xb0, 0xb0) AM_READWRITE(nb1413m3_inputport2_r,nb1413m3_sndrombank1_w) + AM_RANGE(0xc0, 0xc0) AM_READ(nb1413m3_inputport3_r) + AM_RANGE(0xd0, 0xd0) AM_DEVWRITE("dac", DAC_WRITE) + AM_RANGE(0xe0, 0xe0) AM_WRITE(nbmj8900_vramsel_w) + AM_RANGE(0xf0, 0xf0) AM_READ(nb1413m3_dipsw1_r) + AM_RANGE(0xf1, 0xf1) AM_READWRITE(nb1413m3_dipsw2_r, nb1413m3_outcoin_w) +ADDRESS_MAP_END + + +INPUT_PORTS_START( ohpaipee ) + PORT_START("DSWA") + PORT_DIPNAME( 0x01, 0x01, "DIPSW 1-1" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, "DIPSW 1-2" ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) ) + PORT_DIPSETTING( 0x04, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, "Game Sounds" ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, "DIPSW 1-7" ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "Character Display Test" ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("DSWB") + PORT_DIPNAME( 0x01, 0x01, "DIPSW 2-1" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, "DIPSW 2-2" ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, "DIPSW 2-3" ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, "DIPSW 2-4" ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, "DIPSW 2-5" ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, "DIPSW 2-6" ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, "DIPSW 2-7" ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "DIPSW 2-8" ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("SYSTEM") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) // DRAW BUSY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_SERVICE( 0x10, IP_ACTIVE_LOW ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) + + PORT_START("P1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_4WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_4WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_4WAY + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_4WAY + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("P2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_4WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_4WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_4WAY + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_4WAY + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + +INPUT_PORTS_START( togenkyo ) + PORT_START("DSWA") + PORT_DIPNAME( 0x01, 0x01, "DIPSW 1-1" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, "DIPSW 1-2" ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Coinage ) ) + PORT_DIPSETTING( 0x04, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x00, DEF_STR( 1C_2C ) ) + PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x00, "Game Sounds" ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, "DIPSW 1-7" ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "Character Display Test" ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("DSWB") + PORT_DIPNAME( 0x01, 0x01, "DIPSW 2-1" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, "DIPSW 2-2" ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, "DIPSW 2-3" ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, "DIPSW 2-4" ) + PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x10, 0x10, "DIPSW 2-5" ) + PORT_DIPSETTING( 0x10, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x20, 0x20, "DIPSW 2-6" ) + PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x40, 0x40, "DIPSW 2-7" ) + PORT_DIPSETTING( 0x40, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x80, 0x80, "DIPSW 2-8" ) + PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + + PORT_START("SYSTEM") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNUSED ) // DRAW BUSY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_SERVICE( 0x10, IP_ACTIVE_LOW ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) + + PORT_START("P1") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_4WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_4WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_4WAY + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_4WAY + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) + + PORT_START("P2") + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_4WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_4WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_4WAY + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_4WAY + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) +INPUT_PORTS_END + + + +static MACHINE_DRIVER_START( ohpaipee ) + + /* basic machine hardware */ + MDRV_CPU_ADD("maincpu", Z80, 20000000/4) /* 5.00 MHz ? */ + MDRV_CPU_PROGRAM_MAP(ohpaipee_map) + MDRV_CPU_IO_MAP(ohpaipee_io_map) + MDRV_CPU_VBLANK_INT("screen", nb1413m3_interrupt) + + MDRV_MACHINE_RESET(nb1413m3) + + /* video hardware */ + MDRV_SCREEN_ADD("screen", RASTER) + MDRV_SCREEN_REFRESH_RATE(60) + MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) + MDRV_SCREEN_SIZE(512, 256) + MDRV_SCREEN_VISIBLE_AREA(0, 512-1, 8, 248-1) + MDRV_PALETTE_LENGTH(256) + + MDRV_VIDEO_START(nbmj8900_2layer) + MDRV_VIDEO_UPDATE(nbmj8900) + + /* sound hardware */ + MDRV_SPEAKER_STANDARD_MONO("mono") + + MDRV_SOUND_ADD("ym", YM3812, 2500000) + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + + MDRV_SOUND_ADD("dac", DAC, 0) + MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) +MACHINE_DRIVER_END + + +static MACHINE_DRIVER_START( togenkyo ) + + /* basic machine hardware */ + MDRV_IMPORT_FROM(ohpaipee) + MDRV_CPU_MODIFY("maincpu") + MDRV_CPU_PROGRAM_MAP(togenkyo_map) +MACHINE_DRIVER_END + + + +ROM_START( ohpaipee ) + ROM_REGION( 0x10000, "maincpu", 0 ) /* program */ + ROM_LOAD( "02.3h", 0x00000, 0x10000, CRC(2b6c9afc) SHA1(591a7016ebd99d4a2bfdef5e99da3a1ac9d30d75) ) + + ROM_REGION( 0x20000, "voice", 0 ) /* voice */ + ROM_LOAD( "01.2k", 0x00000, 0x10000, CRC(6ea76e01) SHA1(194a80e4a3a9d660aea0a9790ce1f4e295bae7ab) ) + + ROM_REGION( 0x200000, "gfx", 0 ) /* gfx */ + ROM_LOAD( "03.8c", 0x000000, 0x10000, CRC(33b12763) SHA1(62b9753b65bebad9255a60375d2cf257496a085d) ) + ROM_LOAD( "04.8d", 0x010000, 0x10000, CRC(303fcf10) SHA1(6275a38f319665c4352ca6814f8bf2b3d1739b41) ) + ROM_LOAD( "05.8f", 0x020000, 0x10000, CRC(ce394575) SHA1(bdfcafed983b705474f3be3ce8f9a5aea8b33bc1) ) + ROM_LOAD( "06.8f", 0x030000, 0x10000, CRC(9d943b6e) SHA1(d605f6e95cbc09124a73987941d17c53bd4fabf2) ) + ROM_LOAD( "07.8h", 0x040000, 0x10000, CRC(40c25d2f) SHA1(11fe84be8f15a37a505dd8d5c82dbaf0366f266a) ) + ROM_LOAD( "08.8j", 0x050000, 0x10000, CRC(65520a0e) SHA1(b62cfc3d1ee00e309196a16645ff58a31cb45081) ) + ROM_LOAD( "09.8k", 0x060000, 0x10000, CRC(3f4940f9) SHA1(410ab6e429b65d577eccef3ffcfdec912442a4b0) ) + ROM_LOAD( "10.8l", 0x070000, 0x10000, CRC(325c80ff) SHA1(c9612db209b74a56fd40ddd534d24a44e4df3874) ) + ROM_LOAD( "11.8m", 0x080000, 0x10000, CRC(d779661b) SHA1(914f29a1dde2861542ced28735441b05a520409a) ) + + ROM_REGION( 0x40000, "protdata", 0 ) /* protection data */ + ROM_LOAD( "4i.bin", 0x000000, 0x40000, CRC(88f33049) SHA1(8b2d019b09ed854f40a8b0c7782645f50b1f2900) ) // same as housemnq/4i.bin gfx data +ROM_END + +ROM_START( togenkyo ) + ROM_REGION( 0x10000, "maincpu", 0 ) /* program */ + ROM_LOAD( "02.3h", 0x00000, 0x10000, CRC(a0cc6700) SHA1(49132e00d15aa00f065bbac5e850d08032845ac7) ) + + ROM_REGION( 0x20000, "voice", 0 ) /* voice */ + ROM_LOAD( "01.2k", 0x00000, 0x10000, CRC(5346786b) SHA1(7141b38339ec4f2b1c6d0a604b5e70cb9beccdf1) ) + + ROM_REGION( 0x200000, "gfx", 0 ) /* gfx */ + ROM_LOAD( "03.8c", 0x000000, 0x10000, CRC(ce64cb8b) SHA1(b1f99991e19be49d1aac774c79acc527c9379245) ) + ROM_LOAD( "04.8d", 0x010000, 0x10000, CRC(50dd908f) SHA1(28bd5824c55e16c1d62c24577831723c9aded057) ) + ROM_LOAD( "05.8f", 0x020000, 0x10000, CRC(903004e0) SHA1(c017af37cb90b5335bd53b5b62e883be590353fb) ) + ROM_LOAD( "06.8f", 0x030000, 0x10000, CRC(fa47c1e6) SHA1(ebd365fec250056366422361d3c722ae7b30a0a4) ) + ROM_LOAD( "07.8h", 0x040000, 0x10000, CRC(741bde2a) SHA1(9bf1680dc93def5ea6de929eebf05697f6ea43d1) ) + ROM_LOAD( "08.8j", 0x050000, 0x10000, CRC(c3dd2339) SHA1(6cae7b26ff09dae3758c0c8060731f6c777c5b40) ) + ROM_LOAD( "09.8k", 0x060000, 0x10000, CRC(afb1c766) SHA1(58d4c6d00276ebebaca7a42fc47350d5ea310b8e) ) + ROM_LOAD( "10.8l", 0x070000, 0x10000, CRC(18e2a1d4) SHA1(82750e34ba28e10ae3ab935eafd49643d3d057cc) ) + ROM_LOAD( "11.8m", 0x080000, 0x10000, CRC(811682c2) SHA1(5dfc78ce409d8932cf078ced2616e950a52d5d0e) ) + ROM_LOAD( "12.8n", 0x090000, 0x10000, CRC(97808a68) SHA1(3738b2d0ec0dcd1aea19103ffccafde0e84d6c71) ) + ROM_LOAD( "13.10c", 0x0a0000, 0x10000, CRC(ac61612d) SHA1(29854c5e758a2962daa6e281f7c6af87624c53d8) ) + ROM_LOAD( "14.10d", 0x0b0000, 0x10000, CRC(cb472acc) SHA1(82b4089412ecded903745e5382a301c53a483698) ) + + ROM_REGION( 0x40000, "protdata", 0 ) /* protection data */ + ROM_LOAD( "4i.bin", 0x000000, 0x40000, CRC(88f33049) SHA1(8b2d019b09ed854f40a8b0c7782645f50b1f2900) ) // same as housemnq/4i.bin gfx data +ROM_END + +// YEAR, NAME, PARENT, MACHINE, INPUT, INIT, MONITOR,COMPANY,FULLNAME,FLAGS) +GAME( 1989, ohpaipee, 0, ohpaipee, ohpaipee, ohpaipee, ROT270, "Nichibutsu", "Oh! Paipee (Japan 890227)", 0 ) +GAME( 1989, togenkyo, 0, togenkyo, togenkyo, togenkyo, ROT0, "Nichibutsu", "Tougenkyou (Japan 890418)", 0 ) diff --git a/src/mame/includes/nb1413m3.h b/src/mame/includes/nb1413m3.h index a7b230d5f22..1efad9d5343 100644 --- a/src/mame/includes/nb1413m3.h +++ b/src/mame/includes/nb1413m3.h @@ -66,8 +66,8 @@ enum { NB1413M3_SCANDAL, NB1413M3_SCANDALM, NB1413M3_MGMEN89, - NB1413M3_OHPYEPEE, - NB1413M3_TOUGENK, + NB1413M3_OHPAIPEE, + NB1413M3_TOGENKYO, NB1413M3_MJFOCUS, NB1413M3_MJFOCUSM, NB1413M3_GALKOKU, diff --git a/src/mame/machine/nb1413m3.c b/src/mame/machine/nb1413m3.c index 4221102ca62..440f8483847 100644 --- a/src/mame/machine/nb1413m3.c +++ b/src/mame/machine/nb1413m3.c @@ -305,6 +305,8 @@ READ8_HANDLER( nb1413m3_sndrom_r ) case NB1413M3_MJNANPAS: case NB1413M3_MLADYHTR: case NB1413M3_CLUB90S: + case NB1413M3_OHPAIPEE: + case NB1413M3_TOGENKYO: case NB1413M3_LOVEHOUS: case NB1413M3_CHINMOKU: case NB1413M3_GALKAIKA: @@ -431,6 +433,8 @@ READ8_HANDLER( nb1413m3_inputport1_r ) break; case NB1413M3_PAIRSNB: case NB1413M3_PAIRSTEN: + case NB1413M3_OHPAIPEE: + case NB1413M3_TOGENKYO: return input_port_read(space->machine, "P1"); default: switch ((nb1413m3_inputport ^ 0xff) & 0x1f) @@ -480,6 +484,8 @@ READ8_HANDLER( nb1413m3_inputport2_r ) break; case NB1413M3_PAIRSNB: case NB1413M3_PAIRSTEN: + case NB1413M3_OHPAIPEE: + case NB1413M3_TOGENKYO: return input_port_read(space->machine, "P2"); default: switch ((nb1413m3_inputport ^ 0xff) & 0x1f) diff --git a/src/mame/mame.mak b/src/mame/mame.mak index b368aa392c0..86062e4500e 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -981,6 +981,7 @@ $(MAMEOBJ)/nichibut.a: \ $(DRIVERS)/magmax.o $(VIDEO)/magmax.o \ $(DRIVERS)/nbmj8688.o $(VIDEO)/nbmj8688.o \ $(DRIVERS)/nbmj8891.o $(VIDEO)/nbmj8891.o \ + $(DRIVERS)/nbmj8900.o $(VIDEO)/nbmj8900.o \ $(DRIVERS)/nbmj8991.o $(VIDEO)/nbmj8991.o \ $(DRIVERS)/nbmj9195.o $(VIDEO)/nbmj9195.o \ $(DRIVERS)/nightgal.o \ diff --git a/src/mame/mamedriv.c b/src/mame/mamedriv.c index 9a7a59b5836..75ed620ec73 100644 --- a/src/mame/mamedriv.c +++ b/src/mame/mamedriv.c @@ -534,6 +534,9 @@ const game_driver * const drivers[] = DRIVER( av2mj1bb ) /* (c) 1991 MIKI SYOUJI/AV JAPAN */ DRIVER( av2mj2rg ) /* (c) 1991 MIKI SYOUJI/AV JAPAN */ + DRIVER( ohpaipee ) /* (c) 1990 Nichibutsu */ + DRIVER( togenkyo ) /* (c) 1990 Nichibutsu */ + DRIVER( mjuraden ) /* (c) 1992 Nichibutsu/Yubis */ DRIVER( koinomp ) /* (c) 1992 */ DRIVER( patimono ) /* (c) 1992 */ diff --git a/src/mame/video/nbmj8900.c b/src/mame/video/nbmj8900.c new file mode 100644 index 00000000000..3ae1eae1037 --- /dev/null +++ b/src/mame/video/nbmj8900.c @@ -0,0 +1,451 @@ +/****************************************************************************** + + Video Hardware for Nichibutsu Mahjong series. + + Driver by Takahiro Nogi 1999/11/05 - + +******************************************************************************/ + +#include "driver.h" +#include "nb1413m3.h" + + +static int nbmj8900_scrolly; +static int blitter_destx, blitter_desty; +static int blitter_sizex, blitter_sizey; +static int blitter_src_addr; +static int blitter_direction_x, blitter_direction_y; +static int nbmj8900_vram; +static int nbmj8900_gfxrom; +static int nbmj8900_dispflag; +static int nbmj8900_flipscreen; +static int nbmj8900_clutsel; +static int nbmj8900_screen_refresh; +static int gfxdraw_mode; + +static int screen_height; +static int screen_width; + +static bitmap_t *nbmj8900_tmpbitmap0, *nbmj8900_tmpbitmap1; +static UINT8 *nbmj8900_videoram0, *nbmj8900_videoram1; +static UINT8 *nbmj8900_palette; +static UINT8 *nbmj8900_clut; + + +static void nbmj8900_vramflip(running_machine *machine, int vram); +static void nbmj8900_gfxdraw(running_machine *machine); + + +/****************************************************************************** + + +******************************************************************************/ +READ8_HANDLER( nbmj8900_palette_type1_r ) +{ + return nbmj8900_palette[offset]; +} + +WRITE8_HANDLER( nbmj8900_palette_type1_w ) +{ + int r, g, b; + + nbmj8900_palette[offset] = data; + + if (!(offset & 1)) return; + + offset &= 0x1fe; + + r = ((nbmj8900_palette[offset + 0] & 0x0f) >> 0); + g = ((nbmj8900_palette[offset + 1] & 0xf0) >> 4); + b = ((nbmj8900_palette[offset + 1] & 0x0f) >> 0); + + palette_set_color_rgb(space->machine, (offset >> 1), pal4bit(r), pal4bit(g), pal4bit(b)); +} + +READ8_HANDLER( nbmj8900_palette_type2_r ) +{ + return nbmj8900_palette[offset]; +} + +WRITE8_HANDLER( nbmj8900_palette_type2_w ) +{ + int r, g, b; + + nbmj8900_palette[offset] = data; + + if (!(offset & 0x100)) return; + + offset &= 0x0ff; + + r = ((nbmj8900_palette[offset + 0x000] & 0x0f) >> 0); + g = ((nbmj8900_palette[offset + 0x000] & 0xf0) >> 4); + b = ((nbmj8900_palette[offset + 0x100] & 0x0f) >> 0); + + palette_set_color_rgb(space->machine, (offset & 0x0ff), pal4bit(r), pal4bit(g), pal4bit(b)); +} + +READ8_HANDLER( nbmj8900_palette_type3_r ) +{ + return nbmj8900_palette[offset]; +} + +WRITE8_HANDLER( nbmj8900_palette_type3_w ) +{ + int r, g, b; + + nbmj8900_palette[offset] = data; + + if (!(offset & 1)) return; + + offset &= 0x1fe; + + r = ((nbmj8900_palette[offset + 1] & 0x0f) >> 0); + g = ((nbmj8900_palette[offset + 0] & 0xf0) >> 4); + b = ((nbmj8900_palette[offset + 0] & 0x0f) >> 0); + + palette_set_color_rgb(space->machine, (offset >> 1), pal4bit(r), pal4bit(g), pal4bit(b)); +} + +WRITE8_HANDLER( nbmj8900_clutsel_w ) +{ + nbmj8900_clutsel = data; +} + +READ8_HANDLER( nbmj8900_clut_r ) +{ + return nbmj8900_clut[offset]; +} + +WRITE8_HANDLER( nbmj8900_clut_w ) +{ + nbmj8900_clut[((nbmj8900_clutsel & 0x7f) * 0x10) + (offset & 0x0f)] = data; +} + +/****************************************************************************** + + +******************************************************************************/ +WRITE8_HANDLER( nbmj8900_blitter_w ) +{ + switch (offset) + { + case 0x00: blitter_src_addr = (blitter_src_addr & 0xff00) | data; break; + case 0x01: blitter_src_addr = (blitter_src_addr & 0x00ff) | (data << 8); break; + case 0x02: blitter_destx = data; break; + case 0x03: blitter_desty = data; break; + case 0x04: blitter_sizex = data; break; + case 0x05: blitter_sizey = data; + /* writing here also starts the blit */ + nbmj8900_gfxdraw(space->machine); + break; + case 0x06: blitter_direction_x = (data & 0x01) ? 1 : 0; + blitter_direction_y = (data & 0x02) ? 1 : 0; + nbmj8900_flipscreen = (data & 0x04) ? 1 : 0; + nbmj8900_dispflag = (data & 0x08) ? 0 : 1; + if (gfxdraw_mode) nbmj8900_vramflip(space->machine, 1); + nbmj8900_vramflip(space->machine, 0); + break; + case 0x07: break; + } +} + +WRITE8_HANDLER( nbmj8900_scrolly_w ) +{ + nbmj8900_scrolly = data; +} + +WRITE8_HANDLER( nbmj8900_vramsel_w ) +{ + /* protection - not sure about this */ + nb1413m3_sndromrgntag = (data & 0x20) ? "protdata" : "voice"; + + nbmj8900_vram = data; +} + +WRITE8_HANDLER( nbmj8900_romsel_w ) +{ + nbmj8900_gfxrom = (data & 0x0f); + + if ((0x20000 * nbmj8900_gfxrom) > (memory_region_length(space->machine, "gfx") - 1)) + { +#ifdef MAME_DEBUG + popmessage("GFXROM BANK OVER!!"); +#endif + nbmj8900_gfxrom &= (memory_region_length(space->machine, "gfx") / 0x20000 - 1); + } +} + +/****************************************************************************** + + +******************************************************************************/ +void nbmj8900_vramflip(running_machine *machine, int vram) +{ + static int nbmj8900_flipscreen_old = 0; + int x, y; + unsigned char color1, color2; + unsigned char *vidram; + int width = video_screen_get_width(machine->primary_screen); + int height = video_screen_get_height(machine->primary_screen); + + if (nbmj8900_flipscreen == nbmj8900_flipscreen_old) return; + + vidram = vram ? nbmj8900_videoram1 : nbmj8900_videoram0; + + for (y = 0; y < (height / 2); y++) + { + for (x = 0; x < width; x++) + { + color1 = vidram[(y * width) + x]; + color2 = vidram[((y ^ 0xff) * width) + (x ^ 0x1ff)]; + vidram[(y * width) + x] = color2; + vidram[((y ^ 0xff) * width) + (x ^ 0x1ff)] = color1; + } + } + + nbmj8900_flipscreen_old = nbmj8900_flipscreen; + nbmj8900_screen_refresh = 1; +} + + +static void update_pixel0(running_machine *machine, int x, int y) +{ + UINT8 color = nbmj8900_videoram0[(y * screen_width) + x]; + *BITMAP_ADDR16(nbmj8900_tmpbitmap0, y, x) = machine->pens[color]; +} + +static void update_pixel1(running_machine *machine, int x, int y) +{ + UINT8 color = nbmj8900_videoram1[(y * screen_width) + x]; + *BITMAP_ADDR16(nbmj8900_tmpbitmap1, y, x) = machine->pens[color]; +} + +static TIMER_CALLBACK( blitter_timer_callback ) +{ + nb1413m3_busyflag = 1; +} + +static void nbmj8900_gfxdraw(running_machine *machine) +{ + unsigned char *GFX = memory_region(machine, "gfx"); + + int x, y; + int dx1, dx2, dy1, dy2; + int startx, starty; + int sizex, sizey; + int skipx, skipy; + int ctrx, ctry; + unsigned char color, color1, color2; + int gfxaddr; + + nb1413m3_busyctr = 0; + + startx = blitter_destx + blitter_sizex; + starty = blitter_desty + blitter_sizey; + + if (blitter_direction_x) + { + sizex = blitter_sizex ^ 0xff; + skipx = 1; + } + else + { + sizex = blitter_sizex; + skipx = -1; + } + + if (blitter_direction_y) + { + sizey = blitter_sizey ^ 0xff; + skipy = 1; + } + else + { + sizey = blitter_sizey; + skipy = -1; + } + + gfxaddr = (nbmj8900_gfxrom << 17) + (blitter_src_addr << 1); + + for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--) + { + for (x = startx, ctrx = sizex; ctrx >= 0; x += skipx, ctrx--) + { + if ((gfxaddr > (memory_region_length(machine, "gfx") - 1))) + { +#ifdef MAME_DEBUG + popmessage("GFXROM ADDRESS OVER!!"); +#endif + gfxaddr &= (memory_region_length(machine, "gfx") - 1); + } + + color = GFX[gfxaddr++]; + + // for hanamomo + if ((nb1413m3_type == NB1413M3_HANAMOMO) && ((gfxaddr >= 0x20000) && (gfxaddr < 0x28000))) + { + color |= ((color & 0x0f) << 4); + } + + dx1 = (2 * x + 0) & 0x1ff; + dx2 = (2 * x + 1) & 0x1ff; + + if (gfxdraw_mode) + { + // 2 layer type + dy1 = y & 0xff; + dy2 = (y + nbmj8900_scrolly) & 0xff; + } + else + { + // 1 layer type + dy1 = (y + nbmj8900_scrolly) & 0xff; + dy2 = 0; + } + + if (!nbmj8900_flipscreen) + { + dx1 ^= 0x1ff; + dx2 ^= 0x1ff; + dy1 ^= 0xff; + dy2 ^= 0xff; + } + + if (blitter_direction_x) + { + // flip + color1 = (color & 0x0f) >> 0; + color2 = (color & 0xf0) >> 4; + } + else + { + // normal + color1 = (color & 0xf0) >> 4; + color2 = (color & 0x0f) >> 0; + } + + color1 = nbmj8900_clut[((nbmj8900_clutsel & 0x7f) << 4) + color1]; + color2 = nbmj8900_clut[((nbmj8900_clutsel & 0x7f) << 4) + color2]; + + if ((!gfxdraw_mode) || (nbmj8900_vram & 0x01)) + { + // layer 1 + if (color1 != 0xff) + { + nbmj8900_videoram0[(dy1 * screen_width) + dx1] = color1; + update_pixel0(machine, dx1, dy1); + } + if (color2 != 0xff) + { + nbmj8900_videoram0[(dy1 * screen_width) + dx2] = color2; + update_pixel0(machine, dx2, dy1); + } + } + if (gfxdraw_mode && (nbmj8900_vram & 0x02)) + { + // layer 2 + if (nbmj8900_vram & 0x08) + { + // transparent enable + if (color1 != 0xff) + { + nbmj8900_videoram1[(dy2 * screen_width) + dx1] = color1; + update_pixel1(machine, dx1, dy2); + } + if (color2 != 0xff) + { + nbmj8900_videoram1[(dy2 * screen_width) + dx2] = color2; + update_pixel1(machine, dx2, dy2); + } + } + else + { + // transparent disable + nbmj8900_videoram1[(dy2 * screen_width) + dx1] = color1; + update_pixel1(machine, dx1, dy2); + nbmj8900_videoram1[(dy2 * screen_width) + dx2] = color2; + update_pixel1(machine, dx2, dy2); + } + } + + nb1413m3_busyctr++; + } + } + + nb1413m3_busyflag = 0; + timer_set(machine, attotime_mul(ATTOTIME_IN_NSEC(2500), nb1413m3_busyctr), NULL, 0, blitter_timer_callback); +} + +/****************************************************************************** + + +******************************************************************************/ +VIDEO_START( nbmj8900_2layer ) +{ + screen_width = video_screen_get_width(machine->primary_screen); + screen_height = video_screen_get_height(machine->primary_screen); + + nbmj8900_tmpbitmap0 = video_screen_auto_bitmap_alloc(machine->primary_screen); + nbmj8900_tmpbitmap1 = video_screen_auto_bitmap_alloc(machine->primary_screen); + nbmj8900_videoram0 = auto_alloc_array(machine, UINT8, screen_width * screen_height); + nbmj8900_videoram1 = auto_alloc_array(machine, UINT8, screen_width * screen_height); + nbmj8900_palette = auto_alloc_array(machine, UINT8, 0x200); + nbmj8900_clut = auto_alloc_array(machine, UINT8, 0x800); + memset(nbmj8900_videoram0, 0xff, (screen_width * screen_height * sizeof(UINT8))); + memset(nbmj8900_videoram1, 0xff, (screen_width * screen_height * sizeof(UINT8))); +// machine->pens[0x07f] = 0xff; /* palette_transparent_pen */ + gfxdraw_mode = 1; +} + +/****************************************************************************** + + +******************************************************************************/ +VIDEO_UPDATE( nbmj8900 ) +{ + int x, y; + + if (nbmj8900_screen_refresh) + { + nbmj8900_screen_refresh = 0; + for (y = 0; y < screen_height; y++) + { + for (x = 0; x < screen_width; x++) + { + update_pixel0(screen->machine, x, y); + } + } + if (gfxdraw_mode) + { + for (y = 0; y < screen_height; y++) + { + for (x = 0; x < screen_width; x++) + { + update_pixel1(screen->machine, x, y); + } + } + } + } + + if (nbmj8900_dispflag) + { + static int scrolly; + if (!nbmj8900_flipscreen) scrolly = nbmj8900_scrolly; + else scrolly = (-nbmj8900_scrolly) & 0xff; + + if (gfxdraw_mode) + { + copyscrollbitmap(bitmap, nbmj8900_tmpbitmap0, 0, 0, 0, 0, cliprect); + copyscrollbitmap_trans(bitmap, nbmj8900_tmpbitmap1, 0, 0, 1, &scrolly, cliprect, 0xff); + } + else + { + copyscrollbitmap(bitmap, nbmj8900_tmpbitmap0, 0, 0, 1, &scrolly, cliprect); + } + } + else + { + bitmap_fill(bitmap, 0, 0); + } + return 0; +}