From 4ee7a57a71bb79186b35a47c6ddfaf2a1f9d5399 Mon Sep 17 00:00:00 2001 From: davidhay Date: Mon, 15 Sep 2008 09:27:37 +0000 Subject: Jaleco 'Bomb's Away' Improvements [aDG4W+qp0] --- .gitattributes | 1 + src/mame/drivers/argus.c | 424 +++---------- src/mame/drivers/naomi.c | 2 +- src/mame/drivers/psychic5.c | 635 ++++++++++++++------ src/mame/mame.mak | 1 + src/mame/video/argus.c | 1376 +++++++++++++++---------------------------- src/mame/video/jalblend.c | 256 ++++---- src/mame/video/jalblend.h | 5 + src/mame/video/psychic5.c | 599 ++++++++++--------- 9 files changed, 1462 insertions(+), 1837 deletions(-) create mode 100644 src/mame/video/jalblend.h diff --git a/.gitattributes b/.gitattributes index 181e9cba013..b02503811ca 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2985,6 +2985,7 @@ src/mame/video/jagobj.c svneol=native#text/plain src/mame/video/jaguar.c svneol=native#text/plain src/mame/video/jailbrek.c svneol=native#text/plain src/mame/video/jalblend.c svneol=native#text/plain +src/mame/video/jalblend.h svneol=native#text/plain src/mame/video/jedi.c svneol=native#text/plain src/mame/video/jpmimpct.c svneol=native#text/plain src/mame/video/kan_panb.c svneol=native#text/plain diff --git a/src/mame/drivers/argus.c b/src/mame/drivers/argus.c index dd9241017d5..a1b707387ba 100644 --- a/src/mame/drivers/argus.c +++ b/src/mame/drivers/argus.c @@ -17,7 +17,6 @@ Supported games : Argus (C) 1986 NMK / Jaleco Valtric (C) 1986 NMK / Jaleco Butasan (C) 1987 NMK / Jaleco - Bombs Away (C) 1988 Jaleco System specs : @@ -111,54 +110,46 @@ extern UINT8 *butasan_bg1ram; VIDEO_START( argus ); VIDEO_START( valtric ); VIDEO_START( butasan ); -VIDEO_START( bombsa ); VIDEO_RESET( argus ); VIDEO_RESET( valtric ); VIDEO_RESET( butasan ); -VIDEO_RESET( bombsa ); VIDEO_UPDATE( argus ); VIDEO_UPDATE( valtric ); VIDEO_UPDATE( butasan ); -VIDEO_UPDATE( bombsa ); - -static UINT8 argus_bank_latch = 0x00; -static UINT8 butasan_page_latch = 0x00; READ8_HANDLER( argus_txram_r ); -READ8_HANDLER( butasan_txram_r ); -READ8_HANDLER( bombsa_txram_r ); READ8_HANDLER( argus_bg1ram_r ); -READ8_HANDLER( butasan_bg0ram_r ); -READ8_HANDLER( butasan_bg1ram_r ); READ8_HANDLER( argus_paletteram_r ); -READ8_HANDLER( bombsa_paletteram_r ); -READ8_HANDLER( butasan_txbackram_r ); -READ8_HANDLER( butasan_bg0backram_r ); WRITE8_HANDLER( argus_txram_w ); -WRITE8_HANDLER( butasan_txram_w ); -WRITE8_HANDLER( bombsa_txram_w ); WRITE8_HANDLER( argus_bg1ram_w ); -WRITE8_HANDLER( butasan_bg0ram_w ); -WRITE8_HANDLER( butasan_bg1ram_w ); WRITE8_HANDLER( argus_bg0_scrollx_w ); WRITE8_HANDLER( argus_bg0_scrolly_w ); -WRITE8_HANDLER( butasan_bg0_scrollx_w ); WRITE8_HANDLER( argus_bg1_scrollx_w ); WRITE8_HANDLER( argus_bg1_scrolly_w ); WRITE8_HANDLER( argus_bg_status_w ); -WRITE8_HANDLER( valtric_bg_status_w ); -WRITE8_HANDLER( butasan_bg0_status_w ); WRITE8_HANDLER( argus_flipscreen_w ); WRITE8_HANDLER( argus_paletteram_w ); + +WRITE8_HANDLER( valtric_bg_status_w ); WRITE8_HANDLER( valtric_paletteram_w ); +WRITE8_HANDLER( valtric_mosaic_w ); +WRITE8_HANDLER( valtric_unknown_w ); + +READ8_HANDLER( butasan_pagedram_r ); +READ8_HANDLER( butasan_bg1ram_r ); +READ8_HANDLER( butasan_txbackram_r ); +READ8_HANDLER( butasan_bg0backram_r ); +WRITE8_HANDLER( butasan_pageselect_w ); +WRITE8_HANDLER( butasan_pagedram_w ); +WRITE8_HANDLER( butasan_bg1ram_w ); +WRITE8_HANDLER( butasan_bg0_status_w ); WRITE8_HANDLER( butasan_paletteram_w ); -WRITE8_HANDLER( bombsa_paletteram_w ); WRITE8_HANDLER( butasan_txbackram_w ); WRITE8_HANDLER( butasan_bg0backram_w ); WRITE8_HANDLER( butasan_bg1_status_w ); -WRITE8_HANDLER( bombsa_pageselect_w ); -WRITE8_HANDLER( valtric_mosaic_w); +WRITE8_HANDLER( butasan_unknown_w ); + /*************************************************************************** @@ -169,9 +160,9 @@ WRITE8_HANDLER( valtric_mosaic_w); static INTERRUPT_GEN( argus_interrupt ) { if (cpu_getiloops() == 0) - cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0xd7); /* RST 10h */ + cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0xd7); /* RST 10h */ else - cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0xcf); /* RST 08h */ + cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0xcf); /* RST 08h */ } /* Handler called by the YM2203 emulator when the internal timers cause an IRQ */ @@ -197,83 +188,15 @@ static const ym2203_interface ym2203_config = ***************************************************************************/ -#if 0 -static READ8_HANDLER( argus_bankselect_r ) -{ - return argus_bank_latch; -} -#endif - static WRITE8_HANDLER( argus_bankselect_w ) { UINT8 *RAM = memory_region(machine, "main"); int bankaddress; - argus_bank_latch = data; bankaddress = 0x10000 + ((data & 7) * 0x4000); memory_set_bankptr(1, &RAM[bankaddress]); /* Select 8 banks of 16k */ } -static WRITE8_HANDLER( butasan_pageselect_w ) -{ - butasan_page_latch = data; -} - -static READ8_HANDLER( butasan_pagedram_r ) -{ - if (!(butasan_page_latch & 0x01)) - { - if (offset < 0x0800) /* BG0 RAM */ - { - return butasan_bg0ram_r( machine, offset ); - } - else if (offset < 0x1000) /* Back BG0 RAM */ - { - return butasan_bg0backram_r( machine, offset - 0x0800 ); - } - } - else - { - if (offset < 0x0800) /* Text RAM */ - { - return butasan_txram_r( machine, offset ); - } - else if (offset < 0x1000) /* Back text RAM */ - { - return butasan_txbackram_r( machine, offset - 0x0800 ); - } - } - - return 0; -} - -static WRITE8_HANDLER( butasan_pagedram_w ) -{ - if (!(butasan_page_latch & 0x01)) - { - if (offset < 0x0800) /* BG0 RAM */ - { - butasan_bg0ram_w( machine, offset, data ); - } - else if (offset < 0x1000) /* Back BG0 RAM */ - { - butasan_bg0backram_w( machine, offset - 0x0800, data ); - } - } - - else - { - if (offset < 0x0800) /* Text RAM */ - { - butasan_txram_w( machine, offset, data ); - } - else if (offset < 0x1000) /* Back text RAM */ - { - butasan_txbackram_w( machine, offset - 0x0800, data ); - } - } -} - /*************************************************************************** @@ -316,6 +239,7 @@ static ADDRESS_MAP_START( valtric_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0xc200, 0xc200) AM_WRITE(soundlatch_w) AM_RANGE(0xc201, 0xc201) AM_WRITE(argus_flipscreen_w) AM_RANGE(0xc202, 0xc202) AM_WRITE(argus_bankselect_w) + AM_RANGE(0xc300, 0xc300) AM_WRITE(valtric_unknown_w) AM_RANGE(0xc308, 0xc309) AM_WRITE(argus_bg1_scrollx_w) AM_BASE(&argus_bg1_scrollx) AM_RANGE(0xc30a, 0xc30b) AM_WRITE(argus_bg1_scrolly_w) AM_BASE(&argus_bg1_scrolly) AM_RANGE(0xc30c, 0xc30c) AM_WRITE(valtric_bg_status_w) @@ -336,11 +260,12 @@ static ADDRESS_MAP_START( butasan_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P2") AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW1") AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW2") + AM_RANGE(0xc100, 0xc100) AM_WRITE(butasan_unknown_w) AM_RANGE(0xc200, 0xc200) AM_WRITE(soundlatch_w) AM_RANGE(0xc201, 0xc201) AM_WRITE(argus_flipscreen_w) AM_RANGE(0xc202, 0xc202) AM_WRITE(argus_bankselect_w) AM_RANGE(0xc203, 0xc203) AM_WRITE(butasan_pageselect_w) - AM_RANGE(0xc300, 0xc301) AM_WRITE(butasan_bg0_scrollx_w) AM_BASE(&argus_bg0_scrollx) + AM_RANGE(0xc300, 0xc301) AM_WRITE(argus_bg0_scrollx_w) AM_BASE(&argus_bg0_scrollx) AM_RANGE(0xc302, 0xc303) AM_WRITE(argus_bg0_scrolly_w) AM_BASE(&argus_bg0_scrolly) AM_RANGE(0xc304, 0xc304) AM_WRITE(butasan_bg0_status_w) AM_RANGE(0xc308, 0xc309) AM_WRITE(argus_bg1_scrollx_w) AM_BASE(&argus_bg1_scrollx) @@ -354,35 +279,6 @@ static ADDRESS_MAP_START( butasan_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0xf680, 0xffff) AM_RAM ADDRESS_MAP_END -WRITE8_HANDLER( bombsa_txram_w ); -READ8_HANDLER( bombsa_txram_r ); - -static ADDRESS_MAP_START( bombsa_map, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_ROM - AM_RANGE(0x8000, 0xbfff) AM_RAMBANK(1) - AM_RANGE(0xc000, 0xcfff) AM_RAM - - /* ports look like the other games */ - AM_RANGE(0xd000, 0xd000) AM_WRITE(soundlatch_w) // confirmed -// AM_RANGE(0xd001, 0xd001) AM_WRITE(argus_flipscreen_w) - AM_RANGE(0xd002, 0xd002) AM_WRITE(argus_bankselect_w) - AM_RANGE(0xd003, 0xd003) AM_WRITE(bombsa_pageselect_w) // 0,1,0,1,0,1 etc. - - AM_RANGE(0xd000, 0xd1ff) AM_RAM - AM_RANGE(0xd200, 0xd7ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) - AM_RANGE(0xd800, 0xdfff) AM_RAM - - /* Input ports */ - AM_RANGE(0xe000, 0xe000) AM_READ_PORT("SYSTEM") - AM_RANGE(0xe001, 0xe001) AM_READ_PORT("P1") - AM_RANGE(0xe002, 0xe002) AM_READ_PORT("P2") - AM_RANGE(0xe003, 0xe003) AM_READ_PORT("DSW1") - AM_RANGE(0xe004, 0xe004) AM_READ_PORT("DSW2") - AM_RANGE(0xe000, 0xe7ff) AM_WRITE(SMH_RAM) // ?? - AM_RANGE(0xe800, 0xefff) AM_READWRITE(bombsa_txram_r, bombsa_txram_w) AM_BASE(&argus_txram) // banked? it gets corrupted at game start, maybe its banked and one layer can be 16x16 or 8x8? - AM_RANGE(0xf000, 0xffff) AM_READWRITE(bombsa_paletteram_r, bombsa_paletteram_w) AM_BASE(&argus_paletteram) // banked? -ADDRESS_MAP_END - static ADDRESS_MAP_START( sound_map_a, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM @@ -395,18 +291,13 @@ static ADDRESS_MAP_START( sound_map_b, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r) ADDRESS_MAP_END -static ADDRESS_MAP_START( sound_map_c, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0xbfff) AM_ROM - AM_RANGE(0xc000, 0xc7ff) AM_RAM - AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r) - AM_RANGE(0xf000, 0xf000) AM_WRITEONLY // Is this a confirm of some sort? -ADDRESS_MAP_END - +#if 0 static ADDRESS_MAP_START( sound_portmap_1, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w) AM_RANGE(0x01, 0x01) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w) ADDRESS_MAP_END +#endif static ADDRESS_MAP_START( sound_portmap_2, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff) @@ -461,13 +352,13 @@ static INPUT_PORTS_START( argus ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,7") PORT_DIPSETTING( 0x04, DEF_STR( Easy ) ) - PORT_DIPSETTING( 0x06, DEF_STR( Medium ) ) + PORT_DIPSETTING( 0x06, DEF_STR( Normal ) ) PORT_DIPSETTING( 0x02, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) PORT_DIPNAME( 0x08, 0x08, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW1:5") PORT_DIPSETTING( 0x08, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet) ) PORT_DIPLOCATION("SW1:4") + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:4") PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x10, DEF_STR( Cocktail ) ) PORT_DIPNAME( 0x20, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:3") @@ -491,7 +382,7 @@ static INPUT_PORTS_START( argus ) PORT_DIPSETTING( 0x18, DEF_STR( 1C_2C ) ) PORT_DIPSETTING( 0x14, DEF_STR( 1C_3C ) ) PORT_DIPSETTING( 0x10, DEF_STR( 1C_4C ) ) - PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A) ) PORT_DIPLOCATION("SW2:1,2,3") + PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3") PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) ) PORT_DIPSETTING( 0x20, DEF_STR( 4C_1C ) ) PORT_DIPSETTING( 0x40, DEF_STR( 3C_1C ) ) @@ -505,8 +396,20 @@ INPUT_PORTS_END static INPUT_PORTS_START( valtric ) PORT_INCLUDE( argus ) + PORT_MODIFY("DSW1") + PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,7") + PORT_DIPSETTING( 0x06, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Hard ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Harder ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) + PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2") + PORT_DIPSETTING( 0x00, "2" ) + PORT_DIPSETTING( 0xc0, "3" ) + PORT_DIPSETTING( 0x80, "4" ) + PORT_DIPSETTING( 0x40, "5" ) + PORT_MODIFY("DSW2") - PORT_DIPNAME( 0x01, 0x01, "Invulnerability (Cheat") PORT_DIPLOCATION("SW2:8") + PORT_DIPNAME( 0x01, 0x01, "Invulnerability (Cheat)" ) PORT_DIPLOCATION("SW2:8") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:4,5,6") @@ -533,13 +436,13 @@ static INPUT_PORTS_START( butasan ) PORT_INCLUDE( valtric ) PORT_MODIFY("SYSTEM") - PORT_SERVICE( 0x20, IP_ACTIVE_LOW ) + PORT_SERVICE( 0x20, IP_ACTIVE_LOW ) PORT_MODIFY("DSW1") PORT_DIPNAME( 0x01, 0x01, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW1:8") PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) - PORT_DIPNAME( 0x02, 0x02, "Invulnerability (Cheat)") PORT_DIPLOCATION("SW1:7") + PORT_DIPNAME( 0x02, 0x02, "Invulnerability (Cheat)" ) PORT_DIPLOCATION("SW1:7") PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:5,6") @@ -561,35 +464,6 @@ static INPUT_PORTS_START( butasan ) PORT_DIPSETTING( 0x00, DEF_STR( On ) ) INPUT_PORTS_END -static INPUT_PORTS_START( bombsa ) - PORT_INCLUDE( argus ) - - PORT_MODIFY("SYSTEM") - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) - - PORT_MODIFY("DSW1") - PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW1:8" ) // Coin_B - PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW1:7" ) - PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW1:6" ) // Coin_B - PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW1:5" ) // Coin_B - PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW1:4" ) - PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW1:3" ) - PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2") - PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x40, "2 Coins 1 Credit/4 Coins 3 Credits" ) - PORT_DIPSETTING( 0x80, DEF_STR( 3C_1C ) ) - PORT_DIPSETTING( 0xc0, DEF_STR( 1C_4C ) ) - - PORT_MODIFY("DSW2") - PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW2:8" ) - PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW2:7" ) - PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW2:6" ) - PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW2:5" ) - PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW2:4" ) - PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW2:3" ) - PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "SW2:2" ) - PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "SW2:1" ) -INPUT_PORTS_END /*************************************************************************** @@ -600,7 +474,7 @@ INPUT_PORTS_END static const gfx_layout charlayout = { 8,8, /* 8x8 characters */ - 1024, /* 1024 characters */ + 1024, /* 1024 characters */ 4, /* 4 bits per pixel */ { 0, 1, 2, 3 }, { 0, 4, 8, 12, 16, 20, 24, 28 }, @@ -611,7 +485,7 @@ static const gfx_layout charlayout = static const gfx_layout tilelayout_256 = { 16,16, /* 16x16 characters */ - 256, /* 256 characters */ + 256, /* 256 characters */ 4, /* 4 bits per pixel */ { 0, 1, 2, 3 }, { 0, 4, 8, 12, 16, 20, 24, 28, @@ -624,7 +498,7 @@ static const gfx_layout tilelayout_256 = static const gfx_layout tilelayout_512 = { 16,16, /* 16x16 characters */ - 512, /* 512 characters */ + 512, /* 512 characters */ 4, /* 4 bits per pixel */ { 0, 1, 2, 3 }, { 0, 4, 8, 12, 16, 20, 24, 28, @@ -637,7 +511,7 @@ static const gfx_layout tilelayout_512 = static const gfx_layout tilelayout_1024 = { 16,16, /* 16x16 characters */ - 1024, /* 1024 characters */ + 1024, /* 1024 characters */ 4, /* 4 bits per pixel */ { 0, 1, 2, 3 }, { 0, 4, 8, 12, 16, 20, 24, 28, @@ -650,7 +524,7 @@ static const gfx_layout tilelayout_1024 = static const gfx_layout tilelayout_2048 = { 16,16, /* 16x16 characters */ - 2048, /* 2048 characters */ + 2048, /* 2048 characters */ 4, /* 4 bits per pixel */ { 0, 1, 2, 3 }, { 0, 4, 8, 12, 16, 20, 24, 28, @@ -663,7 +537,7 @@ static const gfx_layout tilelayout_2048 = static const gfx_layout tilelayout_4096 = { 16,16, /* 16x16 characters */ - 4096, /* 4096 characters */ + 4096, /* 4096 characters */ 4, /* 4 bits per pixel */ { 0, 1, 2, 3 }, { 0, 4, 8, 12, 16, 20, 24, 28, @@ -681,7 +555,7 @@ static GFXDECODE_START( argus ) GFXDECODE_END static GFXDECODE_START( valtric ) - GFXDECODE_ENTRY( "gfx1", 0, tilelayout_1024, 0*16, 16 ) + GFXDECODE_ENTRY( "gfx1", 0, tilelayout_1024, 0*16, 16 ) GFXDECODE_ENTRY( "gfx2", 0, tilelayout_2048, 16*16, 16 ) GFXDECODE_ENTRY( "gfx3", 0, charlayout, 32*16, 16 ) GFXDECODE_END @@ -693,11 +567,6 @@ static GFXDECODE_START( butasan ) GFXDECODE_ENTRY( "gfx4", 0, charlayout, 32*16, 16 ) GFXDECODE_END -static GFXDECODE_START( bombsa ) - GFXDECODE_ENTRY( "gfx1", 0, tilelayout_1024, 32*16, 16 ) - GFXDECODE_ENTRY( "gfx2", 0, tilelayout_1024, 0*16, 16 ) - GFXDECODE_ENTRY( "gfx3", 0, charlayout, 16*16, 16 ) -GFXDECODE_END static MACHINE_DRIVER_START( argus ) @@ -708,7 +577,11 @@ static MACHINE_DRIVER_START( argus ) MDRV_CPU_ADD("audio", Z80, 5000000) MDRV_CPU_PROGRAM_MAP(sound_map_a,0) +#if 0 MDRV_CPU_IO_MAP(sound_portmap_1,0) +#else + MDRV_CPU_IO_MAP(sound_portmap_2,0) +#endif MDRV_INTERLEAVE(10) @@ -719,6 +592,7 @@ static MACHINE_DRIVER_START( argus ) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) MDRV_SCREEN_SIZE(32*16, 32*16) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) + MDRV_GFXDECODE(argus) MDRV_PALETTE_LENGTH(896) @@ -729,12 +603,27 @@ static MACHINE_DRIVER_START( argus ) /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") +#if 0 MDRV_SOUND_ADD("ym", YM2203, 6000000 / 4) MDRV_SOUND_CONFIG(ym2203_config) MDRV_SOUND_ROUTE(0, "mono", 0.15) MDRV_SOUND_ROUTE(1, "mono", 0.15) MDRV_SOUND_ROUTE(2, "mono", 0.15) MDRV_SOUND_ROUTE(3, "mono", 0.50) +#else + MDRV_SOUND_ADD("ym1", YM2203, 6000000 / 4) + MDRV_SOUND_CONFIG(ym2203_config) + MDRV_SOUND_ROUTE(0, "mono", 0.15) + MDRV_SOUND_ROUTE(1, "mono", 0.15) + MDRV_SOUND_ROUTE(2, "mono", 0.15) + MDRV_SOUND_ROUTE(3, "mono", 0.50) + + MDRV_SOUND_ADD("ym2", YM2203, 6000000 / 4) + MDRV_SOUND_ROUTE(0, "mono", 0.15) + MDRV_SOUND_ROUTE(1, "mono", 0.15) + MDRV_SOUND_ROUTE(2, "mono", 0.15) + MDRV_SOUND_ROUTE(3, "mono", 0.50) +#endif MACHINE_DRIVER_END static MACHINE_DRIVER_START( valtric ) @@ -757,6 +646,7 @@ static MACHINE_DRIVER_START( valtric ) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) MDRV_SCREEN_SIZE(32*16, 32*16) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) + MDRV_GFXDECODE(valtric) MDRV_PALETTE_LENGTH(768) @@ -801,6 +691,7 @@ static MACHINE_DRIVER_START( butasan ) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) MDRV_SCREEN_SIZE(32*16, 32*16) MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) + MDRV_GFXDECODE(butasan) MDRV_PALETTE_LENGTH(768) @@ -825,50 +716,6 @@ static MACHINE_DRIVER_START( butasan ) MDRV_SOUND_ROUTE(3, "mono", 1.0) MACHINE_DRIVER_END -static MACHINE_DRIVER_START( bombsa ) - - /* basic machine hardware */ - MDRV_CPU_ADD("main", Z80, 5000000) /* 5 MHz */ - MDRV_CPU_PROGRAM_MAP(bombsa_map,0) - MDRV_CPU_VBLANK_INT_HACK(argus_interrupt,2) - - MDRV_CPU_ADD("audio", Z80, 12000000 / 2) /* maybe CPU speeds are reversed? Probably not (ajg) */ - MDRV_CPU_PROGRAM_MAP(sound_map_c,0) - MDRV_CPU_IO_MAP(sound_portmap_2,0) - - MDRV_INTERLEAVE(10) - - /* video hardware */ - MDRV_SCREEN_ADD("main", RASTER) - MDRV_SCREEN_REFRESH_RATE(54) /* Guru says : VSync - 54Hz . HSync - 15.25kHz */ - MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MDRV_SCREEN_SIZE(32*16, 32*16) - MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MDRV_GFXDECODE(bombsa) - MDRV_PALETTE_LENGTH(0x1000/2) - - MDRV_VIDEO_START(bombsa) - MDRV_VIDEO_RESET(bombsa) - MDRV_VIDEO_UPDATE(bombsa) - - /* sound hardware */ - MDRV_SPEAKER_STANDARD_MONO("mono") - - MDRV_SOUND_ADD("ym1", YM2203, 12000000 / 8) - MDRV_SOUND_CONFIG(ym2203_config) - MDRV_SOUND_ROUTE(0, "mono", 0.30) - MDRV_SOUND_ROUTE(1, "mono", 0.30) - MDRV_SOUND_ROUTE(2, "mono", 0.30) - MDRV_SOUND_ROUTE(3, "mono", 1.0) - - MDRV_SOUND_ADD("ym2", YM2203, 12000000 / 8) - MDRV_SOUND_ROUTE(0, "mono", 0.30) - MDRV_SOUND_ROUTE(1, "mono", 0.30) - MDRV_SOUND_ROUTE(2, "mono", 0.30) - MDRV_SOUND_ROUTE(3, "mono", 1.0) -MACHINE_DRIVER_END - /*************************************************************************** @@ -878,37 +725,37 @@ MACHINE_DRIVER_END ROM_START( argus ) ROM_REGION( 0x28000, "main", 0 ) /* Main CPU */ - ROM_LOAD( "ag_02.bin", 0x00000, 0x08000, CRC(278a3f3d) SHA1(c5ac5a004ebf0194c33f71dab4020fa636cefbc2) ) - ROM_LOAD( "ag_03.bin", 0x10000, 0x08000, CRC(3a7f3bfa) SHA1(b11e134c084fc3c982dfe31836c1cf3fc0d481fd) ) - ROM_LOAD( "ag_04.bin", 0x18000, 0x08000, CRC(76adc9f6) SHA1(e223a8b2371c51f121958ee3687c777f597334c9) ) - ROM_LOAD( "ag_05.bin", 0x20000, 0x08000, CRC(f76692d6) SHA1(1dc353a042cdda909eb9f1b1ca749a3b3eaa01e4) ) + ROM_LOAD( "ag_02.bin", 0x00000, 0x08000, CRC(278a3f3d) SHA1(c5ac5a004ebf0194c33f71dab4020fa636cefbc2) ) + ROM_LOAD( "ag_03.bin", 0x10000, 0x08000, CRC(3a7f3bfa) SHA1(b11e134c084fc3c982dfe31836c1cf3fc0d481fd) ) + ROM_LOAD( "ag_04.bin", 0x18000, 0x08000, CRC(76adc9f6) SHA1(e223a8b2371c51f121958ee3687c777f597334c9) ) + ROM_LOAD( "ag_05.bin", 0x20000, 0x08000, CRC(f76692d6) SHA1(1dc353a042cdda909eb9f1b1ca749a3b3eaa01e4) ) ROM_REGION( 0x10000, "audio", 0 ) /* Sound CPU */ - ROM_LOAD( "ag_01.bin", 0x00000, 0x04000, CRC(769e3f57) SHA1(209160a96486ab0b90967c015143ec28fba2e2a4) ) + ROM_LOAD( "ag_01.bin", 0x00000, 0x04000, CRC(769e3f57) SHA1(209160a96486ab0b90967c015143ec28fba2e2a4) ) ROM_REGION( 0x20000, "gfx1", ROMREGION_DISPOSE ) /* Sprite */ - ROM_LOAD( "ag_09.bin", 0x00000, 0x08000, CRC(6dbc1c58) SHA1(ef7b6901b702dd347b3a3f162162138175efe578) ) - ROM_LOAD( "ag_08.bin", 0x08000, 0x08000, CRC(ce6e987e) SHA1(9de257d8061ec917f4d443ff509fd457f995d73b) ) - ROM_LOAD( "ag_07.bin", 0x10000, 0x08000, CRC(bbb9638d) SHA1(61dec71d4d976bef3af26d0dc9c0355fd1098ffb) ) - ROM_LOAD( "ag_06.bin", 0x18000, 0x08000, CRC(655b48f8) SHA1(4fce1dffe091b97e7055955743434e49e97b4b79) ) + ROM_LOAD( "ag_09.bin", 0x00000, 0x08000, CRC(6dbc1c58) SHA1(ef7b6901b702dd347b3a3f162162138175efe578) ) + ROM_LOAD( "ag_08.bin", 0x08000, 0x08000, CRC(ce6e987e) SHA1(9de257d8061ec917f4d443ff509fd457f995d73b) ) + ROM_LOAD( "ag_07.bin", 0x10000, 0x08000, CRC(bbb9638d) SHA1(61dec71d4d976bef3af26d0dc9c0355fd1098ffb) ) + ROM_LOAD( "ag_06.bin", 0x18000, 0x08000, CRC(655b48f8) SHA1(4fce1dffe091b97e7055955743434e49e97b4b79) ) ROM_REGION( 0x20000, "gfx2", ROMREGION_DISPOSE ) /* BG0 */ - ROM_LOAD( "ag_13.bin", 0x00000, 0x08000, CRC(20274268) SHA1(9b7767d14bd169dabe6add0623d353bf4b59779b) ) - ROM_LOAD( "ag_14.bin", 0x08000, 0x08000, CRC(ceb8860b) SHA1(90e094686d9d18e49e4848d18d1e31ac95f13937) ) - ROM_LOAD( "ag_11.bin", 0x10000, 0x08000, CRC(99ce8556) SHA1(39caababd6e20ecb0375b85fb6490ee0b04f0949) ) - ROM_LOAD( "ag_12.bin", 0x18000, 0x08000, CRC(e0e5377c) SHA1(b5981d832127d0b28b6a7bb0437716593e0ed71a) ) + ROM_LOAD( "ag_13.bin", 0x00000, 0x08000, CRC(20274268) SHA1(9b7767d14bd169dabe6add0623d353bf4b59779b) ) + ROM_LOAD( "ag_14.bin", 0x08000, 0x08000, CRC(ceb8860b) SHA1(90e094686d9d18e49e4848d18d1e31ac95f13937) ) + ROM_LOAD( "ag_11.bin", 0x10000, 0x08000, CRC(99ce8556) SHA1(39caababd6e20ecb0375b85fb6490ee0b04f0949) ) + ROM_LOAD( "ag_12.bin", 0x18000, 0x08000, CRC(e0e5377c) SHA1(b5981d832127d0b28b6a7bb0437716593e0ed71a) ) ROM_REGION( 0x08000, "gfx3", ROMREGION_DISPOSE ) /* BG1 */ - ROM_LOAD( "ag_17.bin", 0x00000, 0x08000, CRC(0f12d09b) SHA1(718db4ff016526dddacdf6f0088f247ee97c6543) ) + ROM_LOAD( "ag_17.bin", 0x00000, 0x08000, CRC(0f12d09b) SHA1(718db4ff016526dddacdf6f0088f247ee97c6543) ) ROM_REGION( 0x08000, "gfx4", ROMREGION_DISPOSE ) /* Text */ - ROM_LOAD( "ag_10.bin", 0x00000, 0x04000, CRC(2de696c4) SHA1(1ad0f1cde127a1618c2ea74a53e522963a79e5ce) ) + ROM_LOAD( "ag_10.bin", 0x00000, 0x04000, CRC(2de696c4) SHA1(1ad0f1cde127a1618c2ea74a53e522963a79e5ce) ) ROM_REGION( 0x08000, "user1", 0 ) /* Map */ - ROM_LOAD( "ag_15.bin", 0x00000, 0x08000, CRC(99834c1b) SHA1(330f271771b158493b28bb178c8cda98efd1d90c) ) + ROM_LOAD( "ag_15.bin", 0x00000, 0x08000, CRC(99834c1b) SHA1(330f271771b158493b28bb178c8cda98efd1d90c) ) ROM_REGION( 0x08000, "user2", 0 ) /* Pattern */ - ROM_LOAD( "ag_16.bin", 0x00000, 0x08000, CRC(39a51714) SHA1(ad89a630f1352eb4d8beeeebf909d5e2b5d7cc12) ) + ROM_LOAD( "ag_16.bin", 0x00000, 0x08000, CRC(39a51714) SHA1(ad89a630f1352eb4d8beeeebf909d5e2b5d7cc12) ) ROM_END ROM_START( valtric ) @@ -969,104 +816,7 @@ ROM_START( butasan ) ROM_END -/* -Bombs Away -Jaleco, 1988 - -PCB Layout ----------- - -BB-8744 -|------------------------------------------| -| 1 Z80(1) 4 | -| 6116 5MHz |-| -|VOL YM2203 5 | | -|4558 YM2203 Z80(2) | | -|4558 YM3014 6 | | -| YM3014 | | -|J 6116 6264 | | -|A |-| -|M | -|M | -|A |-| -| | | -| | | -| 2 62256 | | -| DSW1 | | -| 3 62256 | | -| DSW2 82S137 |-| -| | -|------------------------------------------| -Notes: - Z80(1) clock - 5.000MHz - Z80(2) clock - 6.000MHz [12/2] - YM2203 clock - 1.500MHz [12/8, both] - VSync - 54Hz - HSync - 15.25kHz - - -BB-8745 -|--------------------------------| -| | -| |-----| |-| -| |N8633| | | -| |-S | | | -| |-----| | | -| 82S123 | | -| |-----| | | -| |N8633| |-| -| |-V | | -|2018 | | | -|2018 7 |6116 | 12MHz |-| -| |-----| | | -| |-----| | | -| |N8633| | | -| |-V64 | | | -| | | | | -| 9 8 |6264 | |-| -| |-----| | -|--------------------------------| -Notes: - 3 soldered-in 'modules' are located on this PCB. - N-8633-V 6-7 TOYOCOM - N-8633-V64 6-7 TOYOCOM - N-8633-S 6-7 TOYOCOM - The 2 larger ones have 62 pins, 31 pins on each side of a small PCB. The PCB contains some - surface mounted logic chips and some surface mounted RAM. - The smaller module has 40 pins, 20 pins on each side of a small PCB. The PCB contains only - logic on both sides. -*/ - -ROM_START( bombsa ) - ROM_REGION( 0x30000, "main", 0 ) /* Main CPU */ - ROM_LOAD( "4.7a", 0x00000, 0x08000, CRC(0191f6a7) SHA1(10a0434abbf4be068751e65c81b1a211729e3742) ) - /* these fail their self-test... should be checked on real hw (hold start1+start2 on boot) */ - ROM_LOAD( "5.7c", 0x10000, 0x08000, BAD_DUMP CRC(095c451a) SHA1(892ca84376f89640ad4d28f1e548c26bc8f72c0e) ) // contains palettes etc. but fails rom check?? - ROM_LOAD( "6.7d", 0x20000, 0x10000, BAD_DUMP CRC(89f9dc0f) SHA1(5cf6a7aade3d56bc229d3771bc4141ad0c0e8da2) ) - - ROM_REGION( 0x10000, "audio", 0 ) /* Sound CPU */ - ROM_LOAD( "1.3a", 0x00000, 0x08000, CRC(92801404) SHA1(c4ff47989d355b18a909eaa88f138e2f68178ecc) ) - - ROM_REGION( 0x20000, "gfx1", ROMREGION_DISPOSE ) /* Sprite */ - ROM_LOAD( "2.4p", 0x00000, 0x10000, CRC(bd972ff4) SHA1(63bfb455bc0ae1d31e6f1066864ec0c8d2d0cf99) ) - ROM_LOAD( "3.4s", 0x10000, 0x10000, CRC(9a8a8a97) SHA1(13328631202c196c9d8791cc6063048eb6be0472) ) - - ROM_REGION( 0x20000, "gfx2", ROMREGION_DISPOSE ) /* BG0 */ - /* some corrupt 'blank' characters, should also be checked with a redump */ - ROM_LOAD( "8.2l", 0x00000, 0x10000, BAD_DUMP CRC(3391c769) SHA1(7ae7575ac81d6e0d915c279c1f57a9bc6d096bd6) ) - ROM_LOAD( "9.2m", 0x10000, 0x10000, BAD_DUMP CRC(5b315976) SHA1(d17cc1926f926bdd88b66ea6af88dac30880e7d4) ) - - ROM_REGION( 0x08000, "gfx3", ROMREGION_DISPOSE ) /* Text */ - ROM_LOAD( "7.4f", 0x00000, 0x08000, CRC(400114b9) SHA1(db2f3ba05a2005ae0e0e7d19c8739353032cbeab) ) - - ROM_REGION( 0x08000, "user1", ROMREGION_DISPOSE ) /* Proms */ - ROM_LOAD( "82s131.7l", 0x000, 0x200, CRC(6a7d13c0) SHA1(2a835a4ac1acb7663d0b915d0339af9800284da6) ) - ROM_LOAD( "82s137.3t", 0x000, 0x400, CRC(59e44236) SHA1(f53d99694fa5acd7cc51dd78e09f0d2ef730e7a4) ) -ROM_END - - -/* ( YEAR NAME PARENT MACHINE INPUT INIT MONITOR COMPANY FULLNAME ) */ +/* ( YEAR NAME PARENT MACHINE INPUT INIT MONITOR COMPANY FULLNAME ) */ GAME( 1986, argus, 0, argus, argus, 0, ROT270, "[NMK] (Jaleco license)", "Argus" , GAME_IMPERFECT_GRAPHICS ) GAME( 1986, valtric, 0, valtric, valtric, 0, ROT270, "[NMK] (Jaleco license)", "Valtric" , GAME_IMPERFECT_GRAPHICS ) GAME( 1987, butasan, 0, butasan, butasan, 0, ROT0, "[NMK] (Jaleco license)", "Butasan (Japan)", GAME_IMPERFECT_GRAPHICS ) -GAME( 1988, bombsa, 0, bombsa, bombsa, 0, ROT270, "Jaleco", "Bombs Away" , GAME_NOT_WORKING ) diff --git a/src/mame/drivers/naomi.c b/src/mame/drivers/naomi.c index c55e5ff7270..2fbca0079e6 100644 --- a/src/mame/drivers/naomi.c +++ b/src/mame/drivers/naomi.c @@ -3258,7 +3258,7 @@ ROM_END // this is actually Beach Spikers... //PIC16C622A (317-0317-COM) //(sticker 253-5508-0317) - //ROM_LOAD("317-0317-com.data", 0x00, 0x50, BAD_DUMP CRC(66efe433) SHA1(7f7b52202ed9b1e20516aaa7553cc3cc677a70b5) ) + //ROM_LOAD("317-0317-com.data", 0x00, 0x50, CRC(66efe433) SHA1(7f7b52202ed9b1e20516aaa7553cc3cc677a70b5) ) ROM_START( initd ) diff --git a/src/mame/drivers/psychic5.c b/src/mame/drivers/psychic5.c index 9ffb7265547..a0092d9de55 100644 --- a/src/mame/drivers/psychic5.c +++ b/src/mame/drivers/psychic5.c @@ -86,25 +86,25 @@ Video RAM is also banked at locations from c000 to dfff. 3) MAIN CPU MEMORY MAP. -0000-7fff ROM -8000-bfff paged ROM -c000-dfff paged RAM (RAM/VRAM/IO) +0000-7fff ROM +8000-bfff paged ROM +c000-dfff paged RAM (RAM/VRAM/IO) f000-f1ff I/O f200-f7ff Sprites registers (misc RAM) -f800-ffff Work RAM +f800-ffff Work RAM -paged RAM memory map Bank 0 c000-cfff Background tile buffer -e000-dfff RAM (dummy background image for software collisions) +d000-dfff RAM (dummy background image for software collisions) Bank 1 c000-c3ff I/O -c400-cbff Palette RAM -d000-d800 Foreground tile buffer +c400-cfff Palette RAM +d000-dfff Foreground tile buffer 4) I/O @@ -153,55 +153,55 @@ c308 BACKGROUND SCROLL Y least significant 8 bits c309 BACKGROUND SCROLL Y most significant 2 bits - 76543210 - || - |^-- Y scroll bit 8 - ^--- Y scroll bit 9 + 76543210 + || + |^-- Y scroll bit 8 + ^--- Y scroll bit 9 c30A BACKGROUND SCROLL X least significant 8 bits c30B BACKGROUND SCROLL X MSB - 76543210 - |||||||| - |||||||^-- X scroll bit 8 - ||||||^--- Unknown (title screen) - ^^^^^^---- Unknown (title screen: 0xff) + 76543210 + |||||||| + |||||||^-- X scroll bit 8 + ||||||^--- Unknown (title screen) + ^^^^^^---- Unknown (title screen: 0xff) c30C SCREEN MODE - 76543210 - || - |^-- background enable bit (0 means black BG) - ^--- grey background enable bit + 76543210 + || + |^-- background enable bit (0 means black BG) + ^--- grey background enable bit c5fe BACKGROUND PALETTE INTENSITY (red and green) - 76543210 - |||||||| - ||||^^^^-- green intensity - ^^^^------ red intensity + 76543210 + |||||||| + ||||^^^^-- green intensity + ^^^^------ red intensity c5ff BACKGROUND PALETTE INTENSITY (blue) - 76543210 - |||||||| + 76543210 + |||||||| ||||^^^^-- unknown (?) - ^^^^------ blue intensity + ^^^^------ blue intensity -RAM f000-f1ff f000 SOUND COMMAND (?) f001 UNKNOWN - maybe some external HW like a flashing light - when a coin falls in slot (?) + maybe some external HW like a flashing light + when a coin falls in slot (?) f002 ROM PAGE SELECTOR - select four (0-3) ROM pages at 8000-bfff. + select four (0-3) ROM pages at 8000-bfff. f003 VRAM PAGE SELECTOR - selects two (0-1) VRAM pages at c000-dfff. + selects two (0-1) VRAM pages at c000-dfff. f004 UNKNOWN @@ -234,7 +234,7 @@ color output is 736 colors. Some additional palette effects are provided for background. Sprite palette 15's transparent color (c5fe-c5ff) is the global background intensity. -Background Intensity is encoded in the same way of colors,and +Background intensity is encoded in the same way of colors,and affects the intensity of each color component (BGR). The least significant nibble of c5ff is unknown,it assumes value 0xf occasionaly when the other nibbles are changed.The only @@ -314,20 +314,55 @@ The first sprite data is located at f20b,then f21b and so on. #include "sound/2203intf.h" -extern WRITE8_HANDLER( psychic5_paged_ram_w ); -extern WRITE8_HANDLER( psychic5_vram_page_select_w ); -extern WRITE8_HANDLER( psychic5_title_screen_w ); +WRITE8_HANDLER( psychic5_paged_ram_w ); +WRITE8_HANDLER( psychic5_vram_page_select_w ); +WRITE8_HANDLER( psychic5_title_screen_w ); + +READ8_HANDLER( psychic5_paged_ram_r ); +READ8_HANDLER( psychic5_vram_page_select_r ); + +VIDEO_START( psychic5 ); +VIDEO_RESET( psychic5 ); +VIDEO_UPDATE( psychic5 ); -extern READ8_HANDLER( psychic5_paged_ram_r ); -extern READ8_HANDLER( psychic5_vram_page_select_r ); -extern MACHINE_RESET( psychic5 ); +extern UINT8 *bombsa_paletteram; +WRITE8_HANDLER( bombsa_paged_ram_w ); +WRITE8_HANDLER( bombsa_unknown_w ); -extern VIDEO_START( psychic5 ); -extern VIDEO_UPDATE( psychic5 ); +VIDEO_START( bombsa ); +VIDEO_RESET( bombsa ); +VIDEO_UPDATE( bombsa ); -static int psychic5_bank_latch = 0x0; +static UINT8 psychic5_bank_latch; + +static MACHINE_RESET( psychic5 ) +{ + psychic5_bank_latch = 0xff; + flip_screen_set(0); +} + +/*************************************************************************** + + Interrupt(s) + +***************************************************************************/ + +static INTERRUPT_GEN( psychic5_interrupt ) +{ + if (cpu_getiloops() == 0) + cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0xd7); /* RST 10h */ + else + cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0xcf); /* RST 08h */ +} + + +/*************************************************************************** + + Memory Handler(s) + +***************************************************************************/ static READ8_HANDLER( psychic5_bankselect_r ) { @@ -339,7 +374,7 @@ static WRITE8_HANDLER( psychic5_bankselect_w ) UINT8 *RAM = memory_region(machine, "main"); int bankaddress; - if (data != psychic5_bank_latch) + if (psychic5_bank_latch != data) { psychic5_bank_latch = data; bankaddress = 0x10000 + ((data & 3) * 0x4000); @@ -347,6 +382,19 @@ static WRITE8_HANDLER( psychic5_bankselect_w ) } } +static WRITE8_HANDLER( bombsa_bankselect_w ) +{ + UINT8 *RAM = memory_region(machine, "main"); + int bankaddress; + + if (psychic5_bank_latch != data) + { + psychic5_bank_latch = data; + bankaddress = 0x10000 + ((data & 7) * 0x4000); + memory_set_bankptr(1, &RAM[bankaddress]); /* Select 8 banks of 16k */ + } +} + static WRITE8_HANDLER( psychic5_coin_counter_w ) { coin_counter_w(0, data & 0x01); @@ -359,59 +407,45 @@ static WRITE8_HANDLER( psychic5_coin_counter_w ) } } -static INTERRUPT_GEN( psychic5_interrupt ) +static WRITE8_HANDLER( bombsa_flipscreen_w ) { - if (cpu_getiloops() == 0) - cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0xd7); /* RST 10h */ - else - cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0xcf); /* RST 08h */ + // bit 7 toggles flip screen + if (data & 0x80) + { + flip_screen_set(!flip_screen_get()); + } } -static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_READ(SMH_BANK1) - AM_RANGE(0xc000, 0xdfff) AM_READ(psychic5_paged_ram_r) - AM_RANGE(0xe000, 0xefff) AM_READ(SMH_RAM) - AM_RANGE(0xf000, 0xf000) AM_READ(SMH_RAM) - AM_RANGE(0xf001, 0xf001) AM_READ(SMH_NOP) // ??? - AM_RANGE(0xf002, 0xf002) AM_READ(psychic5_bankselect_r) - AM_RANGE(0xf003, 0xf003) AM_READ(psychic5_vram_page_select_r) - AM_RANGE(0xf004, 0xf004) AM_READ(SMH_NOP) // ??? - AM_RANGE(0xf005, 0xf005) AM_READ(SMH_NOP) // ??? - AM_RANGE(0xf006, 0xf1ff) AM_READ(SMH_NOP) - AM_RANGE(0xf200, 0xf7ff) AM_READ(SMH_RAM) - AM_RANGE(0xf800, 0xffff) AM_READ(SMH_RAM) -ADDRESS_MAP_END +/*************************************************************************** -static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) - AM_RANGE(0x8000, 0xbfff) AM_WRITE(SMH_BANK1) - AM_RANGE(0xc000, 0xdfff) AM_WRITE(psychic5_paged_ram_w) - AM_RANGE(0xe000, 0xefff) AM_WRITE(SMH_RAM) - AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch_w) - AM_RANGE(0xf001, 0xf001) AM_WRITE(psychic5_coin_counter_w) - AM_RANGE(0xf002, 0xf002) AM_WRITE(psychic5_bankselect_w) - AM_RANGE(0xf003, 0xf003) AM_WRITE(psychic5_vram_page_select_w) - AM_RANGE(0xf004, 0xf004) AM_WRITE(SMH_NOP) // ??? - AM_RANGE(0xf005, 0xf005) AM_WRITE(psychic5_title_screen_w) - AM_RANGE(0xf006, 0xf1ff) AM_WRITE(SMH_NOP) - AM_RANGE(0xf200, 0xf7ff) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size) - AM_RANGE(0xf800, 0xffff) AM_WRITE(SMH_RAM) -ADDRESS_MAP_END + Memory Map(s) -static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_READ(SMH_ROM) - AM_RANGE(0xc000, 0xc7ff) AM_READ(SMH_RAM) - AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r) +***************************************************************************/ + +static ADDRESS_MAP_START( psychic5_main_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK(1) + AM_RANGE(0xc000, 0xdfff) AM_READWRITE(psychic5_paged_ram_r, psychic5_paged_ram_w) + AM_RANGE(0xe000, 0xefff) AM_RAM + AM_RANGE(0xf000, 0xf000) AM_RAM_WRITE(soundlatch_w) + AM_RANGE(0xf001, 0xf001) AM_READWRITE(SMH_NOP, psychic5_coin_counter_w) + AM_RANGE(0xf002, 0xf002) AM_READWRITE(psychic5_bankselect_r, psychic5_bankselect_w) + AM_RANGE(0xf003, 0xf003) AM_READWRITE(psychic5_vram_page_select_r, psychic5_vram_page_select_w) + AM_RANGE(0xf004, 0xf004) AM_NOP // ??? + AM_RANGE(0xf005, 0xf005) AM_READWRITE(SMH_NOP, psychic5_title_screen_w) + AM_RANGE(0xf006, 0xf1ff) AM_NOP + AM_RANGE(0xf200, 0xf7ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) + AM_RANGE(0xf800, 0xffff) AM_RAM ADDRESS_MAP_END -static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_WRITE(SMH_ROM) - AM_RANGE(0xc000, 0xc7ff) AM_WRITE(SMH_RAM) +static ADDRESS_MAP_START( psychic5_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0xc000, 0xc7ff) AM_RAM + AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r) ADDRESS_MAP_END -static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 ) +static ADDRESS_MAP_START( psychic5_soundport_map, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x00) AM_WRITE(ym2203_control_port_0_w) AM_RANGE(0x01, 0x01) AM_WRITE(ym2203_write_port_0_w) @@ -420,87 +454,177 @@ static ADDRESS_MAP_START( sound_io_map, ADDRESS_SPACE_IO, 8 ) ADDRESS_MAP_END +static ADDRESS_MAP_START( bombsa_main_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x7fff) AM_ROM + AM_RANGE(0x8000, 0xbfff) AM_RAMBANK(1) + AM_RANGE(0xc000, 0xcfff) AM_RAM + + /* ports look like the other games */ + AM_RANGE(0xd000, 0xd000) AM_WRITE(soundlatch_w) // confirmed + AM_RANGE(0xd001, 0xd001) AM_WRITE(bombsa_flipscreen_w) + AM_RANGE(0xd002, 0xd002) AM_READWRITE(psychic5_bankselect_r, bombsa_bankselect_w) + AM_RANGE(0xd003, 0xd003) AM_READWRITE(psychic5_vram_page_select_r, psychic5_vram_page_select_w) + AM_RANGE(0xd005, 0xd005) AM_WRITE(bombsa_unknown_w) // ? + + AM_RANGE(0xd000, 0xd1ff) AM_RAM + AM_RANGE(0xd200, 0xd7ff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size) + AM_RANGE(0xd800, 0xdfff) AM_RAM + + AM_RANGE(0xe000, 0xffff) AM_READWRITE(psychic5_paged_ram_r, bombsa_paged_ram_w) +ADDRESS_MAP_END + +static ADDRESS_MAP_START( bombsa_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0xbfff) AM_ROM + AM_RANGE(0xc000, 0xc7ff) AM_RAM + AM_RANGE(0xe000, 0xe000) AM_READ(soundlatch_r) + AM_RANGE(0xf000, 0xf000) AM_WRITEONLY // Is this a confirm of some sort? +ADDRESS_MAP_END + +static ADDRESS_MAP_START( bombsa_soundport_map, ADDRESS_SPACE_IO, 8 ) + ADDRESS_MAP_GLOBAL_MASK(0xff) + AM_RANGE(0x00, 0x00) AM_READWRITE(ym2203_status_port_0_r, ym2203_control_port_0_w) + AM_RANGE(0x01, 0x01) AM_READWRITE(ym2203_read_port_0_r, ym2203_write_port_0_w) + AM_RANGE(0x80, 0x80) AM_READWRITE(ym2203_status_port_1_r, ym2203_control_port_1_w) + AM_RANGE(0x81, 0x81) AM_READWRITE(ym2203_read_port_1_r, ym2203_write_port_1_w) +ADDRESS_MAP_END + + static INPUT_PORTS_START( psychic5 ) - PORT_START("IN0") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) - - PORT_START("P1") /* player 1 controls */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("P2") /* player 2 controls */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) - - PORT_START("DSW0") - PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) - 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( Difficulty ) ) - PORT_DIPSETTING( 0x08, DEF_STR( Normal ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) - PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) - PORT_DIPSETTING( 0x10, DEF_STR( Cocktail ) ) - PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) - PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x20, DEF_STR( On ) ) - PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) ) - PORT_DIPSETTING( 0x80, "2" ) - PORT_DIPSETTING( 0xc0, "3" ) - PORT_DIPSETTING( 0x40, "4" ) - PORT_DIPSETTING( 0x00, "5" ) - - PORT_START("DSW1") - PORT_DIPNAME( 0x01, 0x01, "Invulnerability (Cheat)") - 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( 0xe0, 0xe0, DEF_STR( Coin_A ) ) - PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) ) - PORT_DIPSETTING( 0x20, DEF_STR( 4C_1C ) ) - PORT_DIPSETTING( 0x40, DEF_STR( 3C_1C ) ) - PORT_DIPSETTING( 0x60, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0xe0, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0xc0, DEF_STR( 1C_2C ) ) - PORT_DIPSETTING( 0xa0, DEF_STR( 1C_3C ) ) - PORT_DIPSETTING( 0x80, DEF_STR( 1C_4C ) ) - PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_B ) ) - PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) ) - PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) ) - PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) - PORT_DIPSETTING( 0x0c, DEF_STR( 2C_1C ) ) - PORT_DIPSETTING( 0x1c, DEF_STR( 1C_1C ) ) - PORT_DIPSETTING( 0x18, DEF_STR( 1C_2C ) ) - PORT_DIPSETTING( 0x14, DEF_STR( 1C_3C ) ) - PORT_DIPSETTING( 0x10, DEF_STR( 1C_4C ) ) + PORT_START("SYSTEM") /* system control */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) + + PORT_START("P1") /* player 1 controls */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("P2") /* player 2 controls */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("DSW1") + PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) + PORT_DIPSETTING( 0x04, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x08, 0x08, DEF_STR( Difficulty ) ) + PORT_DIPSETTING( 0x08, DEF_STR( Normal ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Hard ) ) + PORT_DIPNAME( 0x10, 0x00, DEF_STR( Cabinet ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Upright ) ) + PORT_DIPSETTING( 0x10, DEF_STR( Cocktail ) ) + PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x20, DEF_STR( On ) ) + PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) ) + PORT_DIPSETTING( 0x80, "2" ) + PORT_DIPSETTING( 0xc0, "3" ) + PORT_DIPSETTING( 0x40, "4" ) + PORT_DIPSETTING( 0x00, "5" ) + + PORT_START("DSW2") + PORT_DIPNAME( 0x01, 0x01, "Invulnerability (Cheat)" ) + PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) + PORT_DIPSETTING( 0x02, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x00, DEF_STR( On ) ) + PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) ) + PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) ) + PORT_DIPSETTING( 0x20, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x40, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x60, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0xe0, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0xc0, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0xa0, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x80, DEF_STR( 1C_4C ) ) + PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_B ) ) + PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) ) + PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x0c, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x1c, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x18, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x14, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x10, DEF_STR( 1C_4C ) ) +INPUT_PORTS_END + +static INPUT_PORTS_START( bombsa ) + PORT_START("SYSTEM") /* system control */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 ) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 ) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_SERVICE1 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 ) + + PORT_START("P1") /* player 1 control */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("P2") /* player 2 control */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) + + PORT_START("DSW1") + PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW1:8" ) // Coin_B + PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW1:7" ) + PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW1:6" ) // Coin_B + PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW1:5" ) // Coin_B + PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW1:4" ) + PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW1:3" ) + PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2") + PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x40, "2 Coins 1 Credit/4 Coins 3 Credits" ) + PORT_DIPSETTING( 0x80, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0xc0, DEF_STR( 1C_4C ) ) + + PORT_START("DSW2") + PORT_DIPUNKNOWN_DIPLOC( 0x01, 0x01, "SW2:8" ) + PORT_DIPUNKNOWN_DIPLOC( 0x02, 0x02, "SW2:7" ) + PORT_DIPUNKNOWN_DIPLOC( 0x04, 0x04, "SW2:6" ) + PORT_DIPUNKNOWN_DIPLOC( 0x08, 0x08, "SW2:5" ) + PORT_DIPUNKNOWN_DIPLOC( 0x10, 0x10, "SW2:4" ) + PORT_DIPUNKNOWN_DIPLOC( 0x20, 0x20, "SW2:3" ) + PORT_DIPUNKNOWN_DIPLOC( 0x40, 0x40, "SW2:2" ) + PORT_DIPUNKNOWN_DIPLOC( 0x80, 0x80, "SW2:1" ) // flip screen ? INPUT_PORTS_END @@ -533,6 +657,12 @@ static GFXDECODE_START( psychic5 ) GFXDECODE_ENTRY( "gfx3", 0, charlayout, 32*16, 16 ) GFXDECODE_END +static GFXDECODE_START( bombsa ) + GFXDECODE_ENTRY( "gfx1", 0, spritelayout, 32*16, 16 ) + GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 0*16, 16 ) + GFXDECODE_ENTRY( "gfx3", 0, charlayout, 16*16, 16 ) +GFXDECODE_END + static void irqhandler(running_machine *machine, int irq) @@ -553,15 +683,15 @@ static const ym2203_interface ym2203_config = static MACHINE_DRIVER_START( psychic5 ) /* basic machine hardware */ - MDRV_CPU_ADD("main", Z80, 6000000) - MDRV_CPU_PROGRAM_MAP(readmem,writemem) + MDRV_CPU_ADD("main", Z80, XTAL_12MHz/2) + MDRV_CPU_PROGRAM_MAP(psychic5_main_map,0) MDRV_CPU_VBLANK_INT_HACK(psychic5_interrupt,2) - MDRV_CPU_ADD("audio", Z80, 6000000) - MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) - MDRV_CPU_IO_MAP(sound_io_map,0) + MDRV_CPU_ADD("audio", Z80, XTAL_12MHz/2) + MDRV_CPU_PROGRAM_MAP(psychic5_sound_map,0) + MDRV_CPU_IO_MAP(psychic5_soundport_map,0) - MDRV_INTERLEAVE(10) /* Allow time for 2nd cpu to interleave*/ + MDRV_INTERLEAVE(10) /* Allow time for 2nd cpu to interleave */ MDRV_MACHINE_RESET(psychic5) /* video hardware */ @@ -577,25 +707,72 @@ static MACHINE_DRIVER_START( psychic5 ) MDRV_PALETTE_LENGTH(768) MDRV_VIDEO_START(psychic5) + MDRV_VIDEO_RESET(psychic5) MDRV_VIDEO_UPDATE(psychic5) /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") - MDRV_SOUND_ADD("ym1", YM2203, 6000000/4) + MDRV_SOUND_ADD("ym1", YM2203, XTAL_12MHz/8) MDRV_SOUND_CONFIG(ym2203_config) MDRV_SOUND_ROUTE(0, "mono", 0.15) MDRV_SOUND_ROUTE(1, "mono", 0.15) MDRV_SOUND_ROUTE(2, "mono", 0.15) MDRV_SOUND_ROUTE(3, "mono", 0.50) - MDRV_SOUND_ADD("ym2", YM2203, 6000000/4) + MDRV_SOUND_ADD("ym2", YM2203, XTAL_12MHz/8) MDRV_SOUND_ROUTE(0, "mono", 0.15) MDRV_SOUND_ROUTE(1, "mono", 0.15) MDRV_SOUND_ROUTE(2, "mono", 0.15) MDRV_SOUND_ROUTE(3, "mono", 0.50) MACHINE_DRIVER_END +static MACHINE_DRIVER_START( bombsa ) + + /* basic machine hardware */ + MDRV_CPU_ADD("main", Z80, XTAL_12MHz/2 ) /* 6 MHz */ + MDRV_CPU_PROGRAM_MAP(bombsa_main_map,0) + MDRV_CPU_VBLANK_INT_HACK(psychic5_interrupt,2) + + MDRV_CPU_ADD("audio", Z80, XTAL_5MHz ) + MDRV_CPU_PROGRAM_MAP(bombsa_sound_map,0) + MDRV_CPU_IO_MAP(bombsa_soundport_map,0) + + MDRV_INTERLEAVE(10) + MDRV_MACHINE_RESET(psychic5) + + /* video hardware */ + MDRV_SCREEN_ADD("main", RASTER) + MDRV_SCREEN_REFRESH_RATE(54) /* Guru says : VSync - 54Hz . HSync - 15.25kHz */ + MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) + MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) + MDRV_SCREEN_SIZE(64*8, 32*8) + MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) + + MDRV_GFXDECODE(bombsa) + MDRV_PALETTE_LENGTH(768) + + MDRV_VIDEO_START(bombsa) + MDRV_VIDEO_RESET(bombsa) + MDRV_VIDEO_UPDATE(bombsa) + + /* sound hardware */ + MDRV_SPEAKER_STANDARD_MONO("mono") + + MDRV_SOUND_ADD("ym1", YM2203, XTAL_12MHz/8) + MDRV_SOUND_CONFIG(ym2203_config) + MDRV_SOUND_ROUTE(0, "mono", 0.30) + MDRV_SOUND_ROUTE(1, "mono", 0.30) + MDRV_SOUND_ROUTE(2, "mono", 0.30) + MDRV_SOUND_ROUTE(3, "mono", 1.0) + + MDRV_SOUND_ADD("ym2", YM2203, XTAL_12MHz/8) + MDRV_SOUND_ROUTE(0, "mono", 0.30) + MDRV_SOUND_ROUTE(1, "mono", 0.30) + MDRV_SOUND_ROUTE(2, "mono", 0.30) + MDRV_SOUND_ROUTE(3, "mono", 1.0) +MACHINE_DRIVER_END + /*************************************************************************** @@ -604,25 +781,121 @@ MACHINE_DRIVER_END ***************************************************************************/ ROM_START( psychic5 ) - ROM_REGION( 0x20000, "main", 0 ) /* 2*64K for main CPU, Z80 */ + ROM_REGION( 0x20000, "main", 0 ) /* Main CPU */ ROM_LOAD( "p5d", 0x00000, 0x08000, CRC(90259249) SHA1(ac2d8dd95f6c04b6ad726136931e37dcd537e977) ) ROM_LOAD( "p5e", 0x10000, 0x10000, CRC(72298f34) SHA1(725be2fbf5f3622f646c0fb8e6677cbddf0b1fc2) ) - ROM_REGION( 0x10000, "audio", 0 ) /*64K for 2nd z80 CPU*/ + ROM_REGION( 0x10000, "audio", 0 ) /* Sound CPU */ ROM_LOAD( "p5a", 0x00000, 0x08000, CRC(50060ecd) SHA1(e6051fb4a1fa9429cfb6084e8a5dfe994a08280b) ) - ROM_REGION( 0x20000, "gfx1", ROMREGION_DISPOSE ) - ROM_LOAD( "p5b", 0x00000, 0x10000, CRC(7e3f87d4) SHA1(b8e7fa3f96d2e3937e4cb530f105bb84d5743b43) ) /* sprite tiles */ + ROM_REGION( 0x20000, "gfx1", ROMREGION_DISPOSE ) /* sprite tiles */ + ROM_LOAD( "p5b", 0x00000, 0x10000, CRC(7e3f87d4) SHA1(b8e7fa3f96d2e3937e4cb530f105bb84d5743b43) ) ROM_LOAD( "p5c", 0x10000, 0x10000, CRC(8710fedb) SHA1(c7e8dc6b733e4ecce37d56fc429c00ade8736ff3) ) - ROM_REGION( 0x20000, "gfx2", ROMREGION_DISPOSE ) - ROM_LOAD( "p5g", 0x00000, 0x10000, CRC(f9262f32) SHA1(bae2dc77be7024bd85f213e4da746c5903db6ea5) ) /* background tiles */ + ROM_REGION( 0x20000, "gfx2", ROMREGION_DISPOSE ) /* background tiles */ + ROM_LOAD( "p5g", 0x00000, 0x10000, CRC(f9262f32) SHA1(bae2dc77be7024bd85f213e4da746c5903db6ea5) ) ROM_LOAD( "p5h", 0x10000, 0x10000, CRC(c411171a) SHA1(d5893563715ba231e42b084b88f5176bb94a4da9) ) - ROM_REGION( 0x08000, "gfx3", ROMREGION_DISPOSE ) - ROM_LOAD( "p5f", 0x00000, 0x08000, CRC(04d7e21c) SHA1(6046c506bdedc233e3730f90c7897e847bec8758) ) /* foreground tiles */ + ROM_REGION( 0x08000, "gfx3", ROMREGION_DISPOSE ) /* foreground tiles */ + ROM_LOAD( "p5f", 0x00000, 0x08000, CRC(04d7e21c) SHA1(6046c506bdedc233e3730f90c7897e847bec8758) ) ROM_END +/* +Bombs Away +Jaleco, 1988 + +PCB Layout +---------- + +BB-8744 +|------------------------------------------| +| 1 Z80(1) 4 | +| 6116 5MHz |-| +|VOL YM2203 5 | | +|4558 YM2203 Z80(2) | | +|4558 YM3014 6 | | +| YM3014 | | +|J 6116 6264 | | +|A |-| +|M | +|M | +|A |-| +| | | +| | | +| 2 62256 | | +| DSW1 | | +| 3 62256 | | +| DSW2 82S137 |-| +| | +|------------------------------------------| +Notes: + Z80(1) clock - 5.000MHz + Z80(2) clock - 6.000MHz [12/2] + YM2203 clock - 1.500MHz [12/8, both] + VSync - 54Hz + HSync - 15.25kHz + + +BB-8745 +|--------------------------------| +| | +| |-----| |-| +| |N8633| | | +| |-S | | | +| |-----| | | +| 82S123 | | +| |-----| | | +| |N8633| |-| +| |-V | | +|2018 | | | +|2018 7 |6116 | 12MHz |-| +| |-----| | | +| |-----| | | +| |N8633| | | +| |-V64 | | | +| | | | | +| 9 8 |6264 | |-| +| |-----| | +|--------------------------------| +Notes: + 3 soldered-in 'modules' are located on this PCB. + N-8633-V 6-7 TOYOCOM + N-8633-V64 6-7 TOYOCOM + N-8633-S 6-7 TOYOCOM + The 2 larger ones have 62 pins, 31 pins on each side of a small PCB. The PCB contains some + surface mounted logic chips and some surface mounted RAM. + The smaller module has 40 pins, 20 pins on each side of a small PCB. The PCB contains only + logic on both sides. +*/ + +ROM_START( bombsa ) + ROM_REGION( 0x30000, "main", 0 ) /* Main CPU */ + ROM_LOAD( "4.7a", 0x00000, 0x08000, CRC(0191f6a7) SHA1(10a0434abbf4be068751e65c81b1a211729e3742) ) + /* these fail their self-test... should be checked on real hw (hold start1+start2 on boot) */ + ROM_LOAD( "5.7c", 0x10000, 0x08000, BAD_DUMP CRC(095c451a) SHA1(892ca84376f89640ad4d28f1e548c26bc8f72c0e) ) // contains palettes etc. but fails rom check?? + ROM_LOAD( "6.7d", 0x20000, 0x10000, BAD_DUMP CRC(89f9dc0f) SHA1(5cf6a7aade3d56bc229d3771bc4141ad0c0e8da2) ) + + ROM_REGION( 0x10000, "audio", 0 ) /* Sound CPU */ + ROM_LOAD( "1.3a", 0x00000, 0x08000, CRC(92801404) SHA1(c4ff47989d355b18a909eaa88f138e2f68178ecc) ) + + ROM_REGION( 0x20000, "gfx1", ROMREGION_DISPOSE ) /* sprite tiles */ + ROM_LOAD( "2.4p", 0x00000, 0x10000, CRC(bd972ff4) SHA1(63bfb455bc0ae1d31e6f1066864ec0c8d2d0cf99) ) + ROM_LOAD( "3.4s", 0x10000, 0x10000, CRC(9a8a8a97) SHA1(13328631202c196c9d8791cc6063048eb6be0472) ) + + ROM_REGION( 0x20000, "gfx2", ROMREGION_DISPOSE ) /* background tiles */ + /* some corrupt 'blank' characters, should also be checked with a redump */ + ROM_LOAD( "8.2l", 0x00000, 0x10000, BAD_DUMP CRC(3391c769) SHA1(7ae7575ac81d6e0d915c279c1f57a9bc6d096bd6) ) + ROM_LOAD( "9.2m", 0x10000, 0x10000, BAD_DUMP CRC(5b315976) SHA1(d17cc1926f926bdd88b66ea6af88dac30880e7d4) ) + + ROM_REGION( 0x08000, "gfx3", ROMREGION_DISPOSE ) /* foreground tiles */ + ROM_LOAD( "7.4f", 0x00000, 0x08000, CRC(400114b9) SHA1(db2f3ba05a2005ae0e0e7d19c8739353032cbeab) ) + + ROM_REGION( 0x08000, "proms", ROMREGION_DISPOSE ) /* Proms */ + ROM_LOAD( "82s131.7l", 0x000, 0x200, CRC(6a7d13c0) SHA1(2a835a4ac1acb7663d0b915d0339af9800284da6) ) + ROM_LOAD( "82s137.3t", 0x200, 0x400, CRC(59e44236) SHA1(f53d99694fa5acd7cc51dd78e09f0d2ef730e7a4) ) +ROM_END + GAME( 1987, psychic5, 0, psychic5, psychic5, 0, ROT270, "Jaleco", "Psychic 5", 0 ) +GAME( 1988, bombsa, 0, bombsa, bombsa, 0, ROT270, "Jaleco", "Bombs Away", GAME_NOT_WORKING ) diff --git a/src/mame/mame.mak b/src/mame/mame.mak index e9fd8ce61c1..6f7364bb71a 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -803,6 +803,7 @@ $(MAMEOBJ)/itech.a: \ $(MAMEOBJ)/jaleco.a: \ $(DRIVERS)/aeroboto.o $(VIDEO)/aeroboto.o \ $(DRIVERS)/argus.o $(VIDEO)/argus.o \ + $(VIDEO)/jalblend.o \ $(DRIVERS)/bestleag.o \ $(DRIVERS)/bigstrkb.o $(VIDEO)/bigstrkb.o \ $(DRIVERS)/blueprnt.o $(VIDEO)/blueprnt.o \ diff --git a/src/mame/video/argus.c b/src/mame/video/argus.c index 005d9302fc2..4dff4a7d901 100644 --- a/src/mame/video/argus.c +++ b/src/mame/video/argus.c @@ -114,13 +114,7 @@ BG0 palette intensity ( $C47F, $C4FF ) ***************************************************************************/ #include "driver.h" - -#include "jalblend.c" - -#define BUTASAN_TEXT_RAMSIZE 0x0800 -#define BUTASAN_BG0_RAMSIZE 0x0800 -#define BUTASAN_TXBACK_RAMSIZE 0x0800 -#define BUTASAN_BG0BACK_RAMSIZE 0x0800 +#include "jalblend.h" UINT8 *argus_paletteram; @@ -132,34 +126,37 @@ UINT8 *argus_bg1_scrollx; UINT8 *argus_bg1_scrolly; UINT8 *butasan_bg1ram; +static int bg0_scrollx, bg0_scrolly; +static int bg1_scrollx, bg1_scrolly; + static UINT8 *argus_dummy_bg0ram; static UINT8 *butasan_txram; static UINT8 *butasan_bg0ram; static UINT8 *butasan_bg0backram; static UINT8 *butasan_txbackram; +static UINT8 *butasan_pagedram[2]; +static UINT8 butasan_page_latch; static tilemap *tx_tilemap = NULL; static tilemap *bg0_tilemap = NULL; static tilemap *bg1_tilemap = NULL; -static tilemap *bombsa_bg_tilemap = NULL; static UINT8 argus_bg_status; static UINT8 butasan_bg1_status; -static UINT8 argus_bg_purple = 0; -static UINT8 argus_flipscreen = 0; +static UINT8 argus_flipscreen; -static int argus_palette_intensity = 0; +static UINT16 argus_palette_intensity; /* VROM scroll related for Argus */ -static int lowbitscroll = 0; -static int prvscrollx = 0; - -static UINT8 bombsa_ram_page; -static UINT8* bomba_otherram; +static int lowbitscroll; +static int prvscrollx; -static int valtric_mosaic=0; +static UINT8 valtric_mosaic; static bitmap_t *mosaicbitmap; +static UINT8 valtric_unknown; +static UINT8 butasan_unknown; + /*************************************************************************** Callbacks for the tilemap code @@ -167,10 +164,12 @@ static bitmap_t *mosaicbitmap; static TILE_GET_INFO( argus_get_tx_tile_info ) { - int hi, lo; + UINT8 hi, lo; + + tile_index <<= 1; - lo = argus_txram[ tile_index << 1 ]; - hi = argus_txram[ (tile_index << 1) + 1 ]; + lo = argus_txram[tile_index]; + hi = argus_txram[tile_index + 1]; SET_TILE_INFO( 3, @@ -181,10 +180,12 @@ static TILE_GET_INFO( argus_get_tx_tile_info ) static TILE_GET_INFO( argus_get_bg0_tile_info ) { - int hi, lo; + UINT8 hi, lo; - lo = argus_dummy_bg0ram[ tile_index << 1 ]; - hi = argus_dummy_bg0ram[ (tile_index << 1) + 1 ]; + tile_index <<= 1; + + lo = argus_dummy_bg0ram[tile_index]; + hi = argus_dummy_bg0ram[tile_index + 1]; SET_TILE_INFO( 1, @@ -195,10 +196,12 @@ static TILE_GET_INFO( argus_get_bg0_tile_info ) static TILE_GET_INFO( argus_get_bg1_tile_info ) { - int hi, lo; + UINT8 hi, lo; + + tile_index <<= 1; - lo = argus_bg1ram[ tile_index << 1 ]; - hi = argus_bg1ram[ (tile_index << 1) + 1 ]; + lo = argus_bg1ram[tile_index]; + hi = argus_bg1ram[tile_index + 1]; SET_TILE_INFO( 2, @@ -209,10 +212,12 @@ static TILE_GET_INFO( argus_get_bg1_tile_info ) static TILE_GET_INFO( valtric_get_tx_tile_info ) { - int hi, lo; + UINT8 hi, lo; - lo = argus_txram[ tile_index << 1 ]; - hi = argus_txram[ (tile_index << 1) + 1 ]; + tile_index <<= 1; + + lo = argus_txram[tile_index]; + hi = argus_txram[tile_index + 1]; SET_TILE_INFO( 2, @@ -223,29 +228,29 @@ static TILE_GET_INFO( valtric_get_tx_tile_info ) static TILE_GET_INFO( valtric_get_bg_tile_info ) { - int hi, lo, color, tile; + UINT8 hi, lo; - lo = argus_bg1ram[ tile_index << 1 ]; - hi = argus_bg1ram[ (tile_index << 1) + 1 ]; + tile_index <<= 1; - tile = ((hi & 0xc0) << 2) | ((hi & 0x20) << 5) | lo; - color = hi & 0x0f; + lo = argus_bg1ram[tile_index]; + hi = argus_bg1ram[tile_index + 1]; SET_TILE_INFO( 1, - tile, - color, + ((hi & 0xc0) << 2) | ((hi & 0x20) << 5) | lo, + hi & 0x0f, 0); } static TILE_GET_INFO( butasan_get_tx_tile_info ) { - int hi, lo; + UINT8 hi, lo; tile_index ^= 0x3e0; + tile_index <<= 1; - lo = butasan_txram[ tile_index << 1 ]; - hi = butasan_txram[ (tile_index << 1) + 1 ]; + lo = butasan_txram[tile_index]; + hi = butasan_txram[tile_index + 1]; SET_TILE_INFO( 3, @@ -256,15 +261,15 @@ static TILE_GET_INFO( butasan_get_tx_tile_info ) static TILE_GET_INFO( butasan_get_bg0_tile_info ) { - int hi, lo; + UINT8 hi, lo; int attrib; - attrib = (tile_index & 0x00f) | ((tile_index & 0x1e0) >> 1); - attrib |= ((tile_index & 0x200) >> 1) | ((tile_index & 0x010) << 5); + attrib = (tile_index & 0x00f) | ((tile_index & 0x3e0) >> 1) | ((tile_index & 0x010) << 5); attrib ^= 0x0f0; + attrib <<= 1; - lo = butasan_bg0ram[ attrib << 1 ]; - hi = butasan_bg0ram[ (attrib << 1) + 1 ]; + lo = butasan_bg0ram[attrib]; + hi = butasan_bg0ram[attrib + 1]; SET_TILE_INFO( 1, @@ -273,27 +278,19 @@ static TILE_GET_INFO( butasan_get_bg0_tile_info ) TILE_FLIPYX((hi & 0x30) >> 4)); } - - - - - static TILE_GET_INFO( butasan_get_bg1_tile_info ) { - int bank, tile, attrib, color; + int attrib, tile; - attrib = (tile_index & 0x00f) | ((tile_index & 0x3e0) >> 1) - | ((tile_index & 0x010) << 5); + attrib = (tile_index & 0x00f) | ((tile_index & 0x3e0) >> 1) | ((tile_index & 0x010) << 5); attrib ^= 0x0f0; - bank = (butasan_bg1_status & 0x02) << 7; - tile = butasan_bg1ram[ attrib ] | bank; - color = (tile & 0x80) >> 7; + tile = butasan_bg1ram[attrib] | ((butasan_bg1_status & 2) << 7); SET_TILE_INFO( 2, tile, - color, + (tile & 0x80) >> 7, 0); } @@ -302,27 +299,28 @@ static TILE_GET_INFO( butasan_get_bg1_tile_info ) Initialize and destroy video hardware emulation ***************************************************************************/ -static void reset_common(void) +static void reset_common(running_machine *machine) { argus_bg_status = 0x01; - argus_bg_purple = 0; argus_flipscreen = 0; argus_palette_intensity = 0; + + if (jal_blend_table != NULL) + memset(jal_blend_table, 0, 0xc00); } VIDEO_START( argus ) { - /* info offset type w h col row */ - bg0_tilemap = tilemap_create(argus_get_bg0_tile_info, tilemap_scan_cols, 16, 16, 32, 32); - bg1_tilemap = tilemap_create(argus_get_bg1_tile_info, tilemap_scan_cols, 16, 16, 32, 32); - tx_tilemap = tilemap_create(argus_get_tx_tile_info, tilemap_scan_cols, 8, 8, 32, 32); + /* info offset w h col row */ + bg0_tilemap = tilemap_create(argus_get_bg0_tile_info, tilemap_scan_cols, 16, 16, 32, 32); + bg1_tilemap = tilemap_create(argus_get_bg1_tile_info, tilemap_scan_cols, 16, 16, 32, 32); + tx_tilemap = tilemap_create(argus_get_tx_tile_info, tilemap_scan_cols, 8, 8, 32, 32); - /* dummy RAM for back ground */ - argus_dummy_bg0ram = auto_malloc( 0x800 ); + tilemap_set_transparent_pen(bg1_tilemap, 15); + tilemap_set_transparent_pen(tx_tilemap, 15); - tilemap_set_transparent_pen( bg0_tilemap, 15 ); - tilemap_set_transparent_pen( bg1_tilemap, 15 ); - tilemap_set_transparent_pen( tx_tilemap, 15 ); + /* dummy RAM for back ground */ + argus_dummy_bg0ram = auto_malloc(0x800); jal_blend_table = auto_malloc(0xc00); } @@ -331,200 +329,135 @@ VIDEO_RESET( argus ) { lowbitscroll = 0; prvscrollx = 0; - - memset( argus_dummy_bg0ram, 0, 0x800 ); - memset( argus_bg0_scrollx, 0x00, 2 ); - - memset(jal_blend_table,0,0xc00); - reset_common(); + argus_bg0_scrollx[0] = 0; + argus_bg0_scrollx[1] = 0; + memset(argus_dummy_bg0ram, 0, 0x800); + reset_common(machine); } VIDEO_START( valtric ) { - /* info offset w h col row */ - bg1_tilemap = tilemap_create(valtric_get_bg_tile_info, tilemap_scan_cols, 16, 16, 32, 32); - tx_tilemap = tilemap_create(valtric_get_tx_tile_info, tilemap_scan_cols, 8, 8, 32, 32); + /* info offset w h col row */ + bg1_tilemap = tilemap_create(valtric_get_bg_tile_info, tilemap_scan_cols, 16, 16, 32, 32); + tx_tilemap = tilemap_create(valtric_get_tx_tile_info, tilemap_scan_cols, 8, 8, 32, 32); + + tilemap_set_transparent_pen(tx_tilemap, 15); - tilemap_set_transparent_pen( bg1_tilemap, 15 ); - tilemap_set_transparent_pen( tx_tilemap, 15 ); mosaicbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen); + jal_blend_table = auto_malloc(0xc00); } VIDEO_RESET( valtric ) { - valtric_mosaic = 0; - memset(jal_blend_table,0,0xc00); - reset_common(); + valtric_mosaic = 0x0f; + reset_common(machine); } VIDEO_START( butasan ) { - /* info offset type w h col row */ - bg0_tilemap = tilemap_create(butasan_get_bg0_tile_info, tilemap_scan_rows, 16, 16, 32, 32); - bg1_tilemap = tilemap_create(butasan_get_bg1_tile_info, tilemap_scan_rows, 16, 16, 32, 32); - tx_tilemap = tilemap_create(butasan_get_tx_tile_info, tilemap_scan_rows, 8, 8, 32, 32); + /* info offset w h col row */ + bg0_tilemap = tilemap_create(butasan_get_bg0_tile_info, tilemap_scan_rows, 16, 16, 32, 32); + bg1_tilemap = tilemap_create(butasan_get_bg1_tile_info, tilemap_scan_rows, 16, 16, 32, 32); + tx_tilemap = tilemap_create(butasan_get_tx_tile_info, tilemap_scan_rows, 8, 8, 32, 32); - butasan_txram = auto_malloc( BUTASAN_TEXT_RAMSIZE ); - butasan_bg0ram = auto_malloc( BUTASAN_BG0_RAMSIZE ); - butasan_txbackram = auto_malloc( BUTASAN_TXBACK_RAMSIZE ); - butasan_bg0backram = auto_malloc( BUTASAN_BG0BACK_RAMSIZE ); + tilemap_set_transparent_pen(bg1_tilemap, 15); + tilemap_set_transparent_pen(tx_tilemap, 15); - tilemap_set_transparent_pen( tx_tilemap, 15 ); + butasan_pagedram[0] = auto_malloc(0x1000); + butasan_pagedram[1] = auto_malloc(0x1000); + + butasan_bg0ram = &butasan_pagedram[0][0x000]; + butasan_bg0backram = &butasan_pagedram[0][0x800]; + butasan_txram = &butasan_pagedram[1][0x000]; + butasan_txbackram = &butasan_pagedram[1][0x800]; jal_blend_table = auto_malloc(0xc00); + //jal_blend_table = NULL; } VIDEO_RESET( butasan ) { + butasan_page_latch = 0; butasan_bg1_status = 0x01; - - memset( butasan_txram, 0x00, BUTASAN_TEXT_RAMSIZE ); - memset( butasan_bg0ram, 0x00, BUTASAN_BG0_RAMSIZE ); - memset( butasan_txbackram, 0x00, BUTASAN_TXBACK_RAMSIZE ); - memset( butasan_bg0backram, 0x00, BUTASAN_BG0BACK_RAMSIZE ); - - memset(jal_blend_table,0,0xc00); - reset_common(); -} - -#if 0 -static TILE_GET_INFO( bombsa_get_tx_alt_tile_info ) -{ - int hi, lo; - - lo = bombsa_tx_alt_ram[ tile_index << 1 ]; - hi = bombsa_tx_alt_ram[ (tile_index << 1) + 1 ]; - - SET_TILE_INFO( - 2, - ((hi & 0xc0) << 2) | lo, - hi & 0x0f, - TILE_FLIPYX((hi & 0x30) >> 4)); -} -#endif - -static TILE_GET_INFO( bombsa_get_bg_tile_info ) -{ - int tileno; - int col; - - tileno = bomba_otherram[tile_index*2] | ( bomba_otherram[tile_index*2+1]<<8); - col = 0; - - SET_TILE_INFO( - 1, - tileno, - col, - 0); + memset(butasan_pagedram[0], 0, 0x1000); + memset(butasan_pagedram[1], 0, 0x1000); + reset_common(machine); } -VIDEO_START( bombsa ) -{ - /* info offset type w h col row */ -// bg1_tilemap = tilemap_create(valtric_get_bg_tile_info, tilemap_scan_cols, 16, 16, 32, 32); - tx_tilemap = tilemap_create(valtric_get_tx_tile_info, tilemap_scan_cols, 8, 8, 32, 32); - -#if 0 - /* this might be wrong.. but it looks like there may be a tilemap here that can change between 8x8 and 16x16 mode.. */ - /* when you start the game it gets 'corrupted' with data for another layer.. */ - tx_alt_tilemap = tilemap_create(bombsa_get_tx_alt_tile_info, tilemap_scan_cols, 8, 8, 32, 32); -#endif - - bombsa_bg_tilemap = tilemap_create(bombsa_get_bg_tile_info, tilemap_scan_cols, 16, 16, 64, 32); - -#if 0 - bombsa_tx_alt_ram = auto_malloc(0x800); -#endif - -// tilemap_set_transparent_pen( bg1_tilemap, 15 ); - tilemap_set_transparent_pen( tx_tilemap, 15 ); -#if 0 - tilemap_set_transparent_pen( tx_alt_tilemap, 15 ); -#endif -// jal_blend_table = auto_malloc(0xc00); -// memset(jal_blend_table,0,0xc00) ; - - bomba_otherram = auto_malloc(0x1000); -} - -VIDEO_RESET( bombsa ) -{ - bombsa_ram_page = 0; - memset(bomba_otherram, 0, 0x1000); - reset_common(); -} - /*************************************************************************** Functions for handler of MAP roms in Argus and palette color ***************************************************************************/ /* Write bg0 pattern data to dummy bg0 ram */ -static void argus_write_dummy_rams( running_machine *machine, int dramoffs, int vromoffs ) +static void argus_write_dummy_rams(running_machine *machine, int dramoffs, int vromoffs) { int i; int voffs; int offs; - UINT8 *VROM1 = memory_region( machine, "user1" ); /* "ag_15.bin" */ - UINT8 *VROM2 = memory_region( machine, "user2" ); /* "ag_16.bin" */ + UINT8 *VROM1 = memory_region(machine, "user1"); /* "ag_15.bin" */ + UINT8 *VROM2 = memory_region(machine, "user2"); /* "ag_16.bin" */ /* offset in pattern data */ - offs = VROM1[ vromoffs ] | ( VROM1[ vromoffs + 1 ] << 8 ); + offs = VROM1[vromoffs] | (VROM1[vromoffs + 1] << 8); offs &= 0x7ff; voffs = offs * 16; - for (i = 0 ; i < 8 ; i ++) + for (i = 0; i < 8; i++) { - argus_dummy_bg0ram[ dramoffs ] = VROM2[ voffs ]; - argus_dummy_bg0ram[ dramoffs + 1 ] = VROM2[ voffs + 1 ]; - tilemap_mark_tile_dirty( bg0_tilemap, dramoffs >> 1 ); + argus_dummy_bg0ram[dramoffs] = VROM2[voffs]; + argus_dummy_bg0ram[dramoffs + 1] = VROM2[voffs + 1]; + tilemap_mark_tile_dirty(bg0_tilemap, dramoffs >> 1); dramoffs += 2; voffs += 2; } } - -static void bombsa_change_palette(running_machine *machine, int color, int data) +static void argus_change_palette(running_machine *machine, int color, int lo_offs, int hi_offs) { - palette_set_color_rgb(machine, color, pal4bit(data >> 12), pal4bit(data >> 8), pal4bit(data >> 4)); + UINT8 lo = argus_paletteram[lo_offs]; + UINT8 hi = argus_paletteram[hi_offs]; + if (jal_blend_table != NULL) jal_blend_table[color] = hi & 0x0f; + palette_set_color_rgb(machine, color, pal4bit(lo >> 4), pal4bit(lo), pal4bit(hi >> 4)); } - -static void argus_change_palette(running_machine *machine, int color, int data) +static void argus_change_bg_palette(running_machine *machine, int color, int lo_offs, int hi_offs) { - jal_blend_table[color] = data & 0x0f ; + UINT8 r,g,b,lo,hi,ir,ig,ib,ix; + rgb_t rgb,irgb; - palette_set_color_rgb(machine, color, pal4bit(data >> 12), pal4bit(data >> 8), pal4bit(data >> 4)); -} - -static void argus_change_bg_palette(running_machine *machine, int color, int data) -{ - int r, g, b; - int ir, ig, ib; + /* red,green,blue intensities */ + ir = pal4bit(argus_palette_intensity >> 12); + ig = pal4bit(argus_palette_intensity >> 8); + ib = pal4bit(argus_palette_intensity >> 4); + ix = argus_palette_intensity & 0x0f; - r = (data >> 12) & 0x0f; - g = (data >> 8) & 0x0f; - b = (data >> 4) & 0x0f; + irgb = MAKE_RGB(ir,ig,ib); - ir = (argus_palette_intensity >> 12) & 0x0f; - ig = (argus_palette_intensity >> 8) & 0x0f; - ib = (argus_palette_intensity >> 4) & 0x0f; + lo = argus_paletteram[lo_offs]; + hi = argus_paletteram[hi_offs]; - r = (r - ir > 0) ? r - ir : 0; - g = (g - ig > 0) ? g - ig : 0; - b = (b - ib > 0) ? b - ib : 0; + /* red,green,blue component */ + r = pal4bit(lo >> 4); + g = pal4bit(lo); + b = pal4bit(hi >> 4); - if (argus_bg_status & 2) /* Gray / purple scale */ + /* Grey background enable */ + if (argus_bg_status & 2) + { + UINT8 val = (r + g + b) / 3; + rgb = MAKE_RGB(val,val,val); + } + else { - r = (r + g + b) / 3; - g = b = r; - if (argus_bg_purple == 2) /* Purple */ - g = 0; + rgb = MAKE_RGB(r,g,b); } - palette_set_color_rgb(machine, color, pal4bit(r), pal4bit(g), pal4bit(b)); + rgb = jal_blend_func(rgb,irgb,ix); + + palette_set_color(machine,color,rgb); } @@ -532,196 +465,55 @@ static void argus_change_bg_palette(running_machine *machine, int color, int dat Memory handler ***************************************************************************/ -WRITE8_HANDLER(valtric_mosaic_w) -{ - if(data!=0x80) - { - valtric_mosaic=0x0f-(data&0x0f); - - if(valtric_mosaic!=0) - { - valtric_mosaic++; - } - - if(data&0x80) - { - valtric_mosaic*=-1; - } - } -} - - -WRITE8_HANDLER( bombsa_pageselect_w ) +WRITE8_HANDLER( valtric_mosaic_w ) { - bombsa_ram_page = data; + valtric_mosaic = data; } READ8_HANDLER( argus_txram_r ) { - return argus_txram[ offset ]; + return argus_txram[offset]; } WRITE8_HANDLER( argus_txram_w ) { - argus_txram[ offset ] = data; - tilemap_mark_tile_dirty(tx_tilemap, offset >> 1); -} - -READ8_HANDLER( bombsa_txram_r ) -{ -#if 0 - if (bombsa_ram_page == 1) - { - return argus_txram[ offset ]; - } - else - { - return bombsa_tx_alt_ram[ offset ]; - } -#endif - - return argus_txram[ offset ]; - -} - -WRITE8_HANDLER( bombsa_txram_w ) -{ -#if 0 - if (bombsa_ram_page == 1) - { - argus_txram[ offset ] = data; - tilemap_mark_tile_dirty(tx_tilemap, offset >> 1); - } - else - { - /* 8x8 .. */ - bombsa_tx_alt_ram[ offset ] = data; - tilemap_mark_tile_dirty(tx_alt_tilemap, offset >> 1); - /* also 16x16 ..? */ - } -#endif - argus_txram[ offset ] = data; + argus_txram[offset] = data; tilemap_mark_tile_dirty(tx_tilemap, offset >> 1); } -READ8_HANDLER( butasan_txram_r ) -{ - return butasan_txram[ offset ]; -} - -WRITE8_HANDLER( butasan_txram_w ) -{ - butasan_txram[ offset ] = data; - tilemap_mark_tile_dirty(tx_tilemap, (offset ^ 0x7c0) >> 1); -} - READ8_HANDLER( argus_bg1ram_r ) { - return argus_bg1ram[ offset ]; + return argus_bg1ram[offset]; } WRITE8_HANDLER( argus_bg1ram_w ) { - argus_bg1ram[ offset ] = data; + argus_bg1ram[offset] = data; tilemap_mark_tile_dirty(bg1_tilemap, offset >> 1); } -READ8_HANDLER( butasan_bg0ram_r ) -{ - return butasan_bg0ram[ offset ]; -} - -WRITE8_HANDLER( butasan_bg0ram_w ) -{ - int idx; - - butasan_bg0ram[ offset ] = data; - - idx = ((offset & 0x01f) >> 1) | ((offset & 0x400) >> 6); - idx |= (offset & 0x3e0) ^ 0x1e0; - - tilemap_mark_tile_dirty(bg0_tilemap, idx); -} - -READ8_HANDLER( butasan_bg1ram_r ) -{ - return butasan_bg1ram[ offset ]; -} - -WRITE8_HANDLER( butasan_bg1ram_w ) +WRITE8_HANDLER( argus_bg0_scrollx_w ) { - int idx; - - butasan_bg1ram[ offset ] = data; - - idx = (offset & 0x00f) | ((offset & 0x200) >> 5) | ((offset & 0x1f0) << 1); - idx ^= 0x0f0; - - tilemap_mark_tile_dirty(bg1_tilemap, idx); -} - -WRITE8_HANDLER ( argus_bg0_scrollx_w ) -{ - if (argus_bg0_scrollx[ offset ] != data) - { - argus_bg0_scrollx[ offset ] = data; - } + argus_bg0_scrollx[offset] = data; + bg0_scrollx = argus_bg0_scrollx[0] | (argus_bg0_scrollx[1] << 8); } WRITE8_HANDLER( argus_bg0_scrolly_w ) { - if (argus_bg0_scrolly[ offset ] != data) - { - int scrolly; - argus_bg0_scrolly[ offset ] = data; - scrolly = argus_bg0_scrolly[0] | ( (argus_bg0_scrolly[1] & 0x01) << 8); - if (!argus_flipscreen) - tilemap_set_scrolly( bg0_tilemap, 0, scrolly ); - else - tilemap_set_scrolly( bg0_tilemap, 0, (scrolly + 256) & 0x1ff ); - } -} - -WRITE8_HANDLER( butasan_bg0_scrollx_w ) -{ - if (argus_bg0_scrollx[ offset ] != data) - { - int scrollx; - argus_bg0_scrollx[ offset ] = data; - scrollx = argus_bg0_scrollx[0] | ( (argus_bg0_scrollx[1] & 0x01) << 8); - if (!argus_flipscreen) - tilemap_set_scrollx( bg0_tilemap, 0, scrollx ); - else - tilemap_set_scrollx( bg0_tilemap, 0, (scrollx + 256) & 0x1ff ); - } + argus_bg0_scrolly[offset] = data; + bg0_scrolly = argus_bg0_scrolly[0] | (argus_bg0_scrolly[1] << 8); } WRITE8_HANDLER( argus_bg1_scrollx_w ) { - if (argus_bg1_scrollx[ offset ] != data) - { - int scrollx; - argus_bg1_scrollx[ offset ] = data; - scrollx = argus_bg1_scrollx[0] | ( (argus_bg1_scrollx[1] & 0x01) << 8); - if (!argus_flipscreen) - tilemap_set_scrollx( bg1_tilemap, 0, scrollx ); - else - tilemap_set_scrollx( bg1_tilemap, 0, (scrollx + 256) & 0x1ff ); - } + argus_bg1_scrollx[offset] = data; + bg1_scrollx = argus_bg1_scrollx[0] | (argus_bg1_scrollx[1] << 8); } WRITE8_HANDLER( argus_bg1_scrolly_w ) { - if (argus_bg1_scrolly[ offset ] != data) - { - int scrolly; - argus_bg1_scrolly[ offset ] = data; - scrolly = argus_bg1_scrolly[0] | ( (argus_bg1_scrolly[1] & 0x01) << 8); - if (!argus_flipscreen) - tilemap_set_scrolly( bg1_tilemap, 0, scrolly ); - else - tilemap_set_scrolly( bg1_tilemap, 0, (scrolly + 256) & 0x1ff ); - } + argus_bg1_scrolly[offset] = data; + bg1_scrolly = argus_bg1_scrolly[0] | (argus_bg1_scrolly[1] << 8); } WRITE8_HANDLER( argus_bg_status_w ) @@ -730,18 +522,14 @@ WRITE8_HANDLER( argus_bg_status_w ) { argus_bg_status = data; - /* Backgound enable */ - tilemap_set_enable(bg1_tilemap, argus_bg_status & 1); - /* Gray / purple scale */ if (argus_bg_status & 2) { int offs; - for (offs = 0x400 ; offs < 0x500 ; offs ++) + for (offs = 0x400; offs < 0x500; offs++) { - argus_change_bg_palette( machine, (offs - 0x0400) + 128, - (argus_paletteram[offs] << 8) | argus_paletteram[offs + 0x0400] ); + argus_change_bg_palette(machine, (offs - 0x400) + 0x080, offs, offs + 0x400); } } } @@ -753,18 +541,14 @@ WRITE8_HANDLER( valtric_bg_status_w ) { argus_bg_status = data; - /* Backgound enable */ - tilemap_set_enable(bg1_tilemap, argus_bg_status & 1); - /* Gray / purple scale */ if (argus_bg_status & 2) { int offs; - for (offs = 0x400 ; offs < 0x600 ; offs += 2) + for (offs = 0x400; offs < 0x600; offs += 2) { - argus_change_bg_palette( machine, ((offs - 0x0400) >> 1) + 256, - argus_paletteram[offs | 1] | (argus_paletteram[offs & ~1] << 8)); + argus_change_bg_palette(machine, ((offs - 0x400) >> 1) + 0x100, offs & ~1, offs | 1); } } } @@ -772,269 +556,193 @@ WRITE8_HANDLER( valtric_bg_status_w ) WRITE8_HANDLER( butasan_bg0_status_w ) { - if (argus_bg_status != data) + argus_bg_status = data; +} + +WRITE8_HANDLER( butasan_bg1_status_w ) +{ + if (butasan_bg1_status != data) { - argus_bg_status = data; + butasan_bg1_status = data; - /* Backgound enable */ - tilemap_set_enable(bg0_tilemap, argus_bg_status & 1); + /* Bank changed */ + tilemap_mark_all_tiles_dirty(bg1_tilemap); } } WRITE8_HANDLER( argus_flipscreen_w ) { - if (argus_flipscreen != (data >> 7)) - { - argus_flipscreen = data >> 7; - tilemap_set_flip( ALL_TILEMAPS, (argus_flipscreen) ? TILEMAP_FLIPY | TILEMAP_FLIPX : 0); - if (!argus_flipscreen) - { - int scrollx, scrolly; - - if (bg0_tilemap != NULL) - { - scrollx = argus_bg0_scrollx[0] | ( (argus_bg0_scrollx[1] & 0x01) << 8); - tilemap_set_scrollx(bg0_tilemap, 0, scrollx & 0x1ff); - - scrolly = argus_bg0_scrolly[0] | ( (argus_bg0_scrolly[1] & 0x01) << 8); - tilemap_set_scrolly(bg0_tilemap, 0, scrolly); - } - scrollx = argus_bg1_scrollx[0] | ( (argus_bg1_scrollx[1] & 0x01) << 8); - tilemap_set_scrollx(bg1_tilemap, 0, scrollx); - - scrolly = argus_bg1_scrolly[0] | ( (argus_bg1_scrolly[1] & 0x01) << 8); - tilemap_set_scrolly(bg1_tilemap, 0, scrolly); - } - else - { - int scrollx, scrolly; - - if (bg0_tilemap != NULL) - { - scrollx = argus_bg0_scrollx[0] | ( (argus_bg0_scrollx[1] & 0x01) << 8); - tilemap_set_scrollx(bg0_tilemap, 0, (scrollx + 256) & 0x1ff); - - scrolly = argus_bg0_scrolly[0] | ( (argus_bg0_scrolly[1] & 0x01) << 8); - tilemap_set_scrolly(bg0_tilemap, 0, (scrolly + 256) & 0x1ff); - } - scrollx = argus_bg1_scrollx[0] | ( (argus_bg1_scrollx[1] & 0x01) << 8); - tilemap_set_scrollx(bg1_tilemap, 0, (scrollx + 256) & 0x1ff); - - scrolly = argus_bg1_scrolly[0] | ( (argus_bg1_scrolly[1] & 0x01) << 8); - tilemap_set_scrolly(bg1_tilemap, 0, (scrolly + 256) & 0x1ff); - } - } + argus_flipscreen = data & 0x80; } READ8_HANDLER( argus_paletteram_r ) { - return argus_paletteram[ offset ]; + return argus_paletteram[offset]; } WRITE8_HANDLER( argus_paletteram_w ) { int offs; - argus_paletteram[ offset ] = data; + argus_paletteram[offset] = data; - if (offset != 0x007f && offset != 0x00ff) + if (offset <= 0x0ff) /* sprite color */ { - if (offset >= 0x0000 && offset <= 0x00ff) /* sprite color */ - { - if (offset & 0x80) - offset -= 0x80; + offset &= 0x07f; - argus_change_palette( machine, offset, - (argus_paletteram[offset] << 8) | argus_paletteram[offset + 0x80] ); - } + argus_change_palette(machine, offset, offset, offset + 0x080); - else if ( (offset >= 0x0400 && offset <= 0x04ff) || - (offset >= 0x0800 && offset <= 0x08ff) ) /* BG0 color */ + if (offset == 0x07f || offset == 0x0ff) { - if (offset >= 0x0800) - offset -= 0x0400; + argus_palette_intensity = argus_paletteram[0x0ff] | (argus_paletteram[0x07f] << 8); - argus_change_bg_palette( machine, (offset - 0x0400) + 128, - (argus_paletteram[offset] << 8) | argus_paletteram[offset + 0x0400] ); + for (offs = 0x400; offs < 0x500; offs++) + argus_change_bg_palette(machine, (offs & 0xff) + 0x080, offs, offs + 0x400); } + } + else if ((offset >= 0x400 && offset <= 0x4ff) || + (offset >= 0x800 && offset <= 0x8ff)) /* BG0 color */ + { + offs = offset & 0xff; + offset = offs | 0x400; - else if ( (offset >= 0x0500 && offset <= 0x05ff) || - (offset >= 0x0900 && offset <= 0x09ff) ) /* BG1 color */ - { - if (offset >= 0x0900) - offset -= 0x0400; - - argus_change_palette( machine, (offset - 0x0500) + 384, - (argus_paletteram[offset] << 8) | argus_paletteram[offset + 0x0400] ); - } - - else if ( (offset >= 0x0700 && offset <= 0x07ff) || - (offset >= 0x0b00 && offset <= 0x0bff) ) /* text color */ - { - if (offset >= 0x0b00) - offset -= 0x0400; - - argus_change_palette( machine, (offset - 0x0700) + 640, - (argus_paletteram[offset] << 8) | argus_paletteram[offset + 0x0400] ); - } + argus_change_bg_palette(machine, offs + 0x080, offset, offset + 0x400); } - else + else if ((offset >= 0x500 && offset <= 0x5ff) || + (offset >= 0x900 && offset <= 0x9ff)) /* BG1 color */ { - argus_palette_intensity = (argus_paletteram[0x007f] << 8) | argus_paletteram[0x00ff]; + offs = offset & 0xff; + offset = offs | 0x500; - for (offs = 0x400 ; offs < 0x500 ; offs ++) - { - argus_change_bg_palette( machine, (offs - 0x0400) + 128, - (argus_paletteram[offs] << 8) | argus_paletteram[offs + 0x0400] ); - } + argus_change_palette(machine, offs + 0x180, offset, offset + 0x400); + } + else if ((offset >= 0x700 && offset <= 0x7ff) || + (offset >= 0xb00 && offset <= 0xbff)) /* text color */ + { + offs = offset & 0xff; + offset = offs | 0x700; - argus_bg_purple = argus_paletteram[0x0ff] & 0x0f; + argus_change_palette(machine, offs + 0x280, offset, offset + 0x400); } } WRITE8_HANDLER( valtric_paletteram_w ) { - int offs; - - argus_paletteram[ offset ] = data; + argus_paletteram[offset] = data; - if (offset != 0x01fe && offset != 0x01ff) + if (offset <= 0x1ff) /* Sprite color */ { - if (offset >= 0x0000 && offset <= 0x01ff) - { - argus_change_palette( machine, offset >> 1, - argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); - } - else if (offset >= 0x0400 && offset <= 0x05ff ) - { - argus_change_bg_palette( machine, ((offset - 0x0400) >> 1) + 256, - argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); - } - else if (offset >= 0x0600 && offset <= 0x07ff ) + argus_change_palette(machine, offset >> 1, offset & ~1, offset | 1); + + if (offset == 0x1fe || offset == 0x1ff) { - argus_change_palette( machine, ((offset - 0x0600) >> 1) + 512, - argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); + int offs; + + argus_palette_intensity = argus_paletteram[0x1ff] | (argus_paletteram[0x1fe] << 8); + + for (offs = 0x400; offs < 0x600; offs += 2) + argus_change_bg_palette(machine, ((offs & 0x1ff) >> 1) + 0x100, offs & ~1, offs | 1); } } - else + else if (offset >= 0x400 && offset <= 0x5ff) /* BG color */ { - argus_palette_intensity = (argus_paletteram[0x01fe] << 8) | argus_paletteram[0x01ff]; - - for (offs = 0x400 ; offs < 0x600 ; offs += 2) - { - argus_change_bg_palette( machine, ((offs - 0x0400) >> 1) + 256, - argus_paletteram[offs | 1] | (argus_paletteram[offs & ~1] << 8)); - } - - argus_bg_purple = argus_paletteram[0x01ff] & 0x0f; + argus_change_bg_palette(machine, ((offset & 0x1ff) >> 1) + 0x100, offset & ~1, offset | 1); + } + else if (offset >= 0x600 && offset <= 0x7ff) /* Text color */ + { + argus_change_palette(machine, ((offset & 0x1ff) >> 1) + 0x200, offset & ~1, offset | 1); } } WRITE8_HANDLER( butasan_paletteram_w ) { - argus_paletteram[ offset ] = data; + argus_paletteram[offset] = data; - if (offset < 0x0200 ) /* BG1 color */ + if (offset <= 0x1ff) /* BG0 color */ { - argus_change_palette( machine, ((offset - 0x0000) >> 1) + 256, - argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); + argus_change_palette(machine, (offset >> 1) + 0x100, offset & ~1, offset | 1); } - else if (offset < 0x0240 ) /* BG0 color */ + else if (offset <= 0x23f) /* BG1 color */ { - argus_change_palette( machine, ((offset - 0x0200) >> 1) + 192, - argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); + argus_change_palette(machine, ((offset & 0x3f) >> 1) + 0x0c0, offset & ~1, offset | 1); } - else if (offset >= 0x0400 && offset <= 0x04ff ) /* Sprite color */ - { - if (offset < 0x0480) /* 16 colors */ - argus_change_palette( machine, ((offset - 0x0400) >> 1) + 0, - argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); - else /* 8 colors */ - { - argus_change_palette( machine, (offset & 0x70) + ((offset & 0x00f) >> 1) + 64, - argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); - argus_change_palette( machine, (offset & 0x70) + ((offset & 0x00f) >> 1) + 72, - argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); - } + else if (offset >= 0x400 && offset <= 0x47f) /* Sprite color */ + { /* 16 colors */ + argus_change_palette(machine, (offset & 0x7f) >> 1, offset & ~1, offset | 1); } - else if (offset >= 0x0600 && offset <= 0x07ff ) /* Text color */ - { - argus_change_palette( machine, ((offset - 0x0600) >> 1) + 512, - argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); - } -} + else if (offset >= 0x480 && offset <= 0x4ff) /* Sprite color */ + { /* 8 colors */ + int offs = (offset & 0x070) | ((offset & 0x00f) >> 1); -READ8_HANDLER( bombsa_paletteram_r ) -{ - if (bombsa_ram_page==1) - { - return argus_paletteram[ offset ]; - } - else if (bombsa_ram_page==0) - { - return bomba_otherram[ offset ]; + argus_change_palette(machine, offs + 0x040, offset & ~1, offset | 1); + argus_change_palette(machine, offs + 0x048, offset & ~1, offset | 1); } - else + else if (offset >= 0x600 && offset <= 0x7ff) /* Text color */ { - mame_printf_debug("unknown bombsa_paletteram_r %02x %04x\n",bombsa_ram_page,offset); - return 0x00; + argus_change_palette(machine, ((offset & 0x1ff) >> 1) + 0x200, offset & ~1, offset | 1); } + else if (offset >= 0x240 && offset <= 0x25f) // dummy + argus_change_palette(machine, ((offset & 0x1f) >> 1) + 0xe0, offset & ~1, offset | 1); + else if (offset >= 0x500 && offset <= 0x51f) // dummy + argus_change_palette(machine, ((offset & 0x1f) >> 1) + 0xf0, offset & ~1, offset | 1); } -WRITE8_HANDLER( bombsa_paletteram_w ) +READ8_HANDLER( butasan_bg1ram_r ) { - if (bombsa_ram_page==1) - { - argus_paletteram[ offset ] = data; - bombsa_change_palette( machine, offset>>1, argus_paletteram[offset | 1] | (argus_paletteram[offset & ~1] << 8)); - } - else if (bombsa_ram_page==0) - { - bomba_otherram[offset] = data; - - tilemap_mark_tile_dirty(bombsa_bg_tilemap, offset/2); - } - else - { - mame_printf_debug("unknown bombsa_paletteram_w %02x %04x %02x\n",bombsa_ram_page,offset, data); - } + return butasan_bg1ram[offset]; } -READ8_HANDLER( butasan_txbackram_r ) +WRITE8_HANDLER( butasan_bg1ram_w ) { - return butasan_txbackram[ offset ]; + int idx; + + butasan_bg1ram[offset] = data; + + idx = (offset & 0x00f) | ((offset & 0x200) >> 5) | ((offset & 0x1f0) << 1); + idx ^= 0x0f0; + + tilemap_mark_tile_dirty(bg1_tilemap, idx); } -WRITE8_HANDLER( butasan_txbackram_w ) +WRITE8_HANDLER( butasan_pageselect_w ) { - if (butasan_txbackram[ offset ] != data) - { - butasan_txbackram[ offset ] = data; - } + butasan_page_latch = data & 1; } -READ8_HANDLER( butasan_bg0backram_r ) +READ8_HANDLER( butasan_pagedram_r ) { - return butasan_bg0backram[ offset ]; + return butasan_pagedram[butasan_page_latch][offset]; } -WRITE8_HANDLER( butasan_bg0backram_w ) +WRITE8_HANDLER( butasan_pagedram_w ) { - if (butasan_bg0backram[ offset ] != data) + butasan_pagedram[butasan_page_latch][offset] = data; + + if (!butasan_page_latch) { - butasan_bg0backram[ offset ] = data; + if (offset <= 0x07ff) + { + int idx; + idx = ((offset & 0x01e) >> 1) | ((offset & 0x400) >> 6) | (offset & 0x3e0); + idx ^= 0x1e0; + tilemap_mark_tile_dirty(bg0_tilemap, idx); + } + } + else + { + if (offset <= 0x07ff) + tilemap_mark_tile_dirty(tx_tilemap, (offset ^ 0x7c0) >> 1); } } -WRITE8_HANDLER( butasan_bg1_status_w ) +WRITE8_HANDLER( valtric_unknown_w ) { - if (butasan_bg1_status != data) - { - butasan_bg1_status = data; + valtric_unknown = data; +} - tilemap_set_enable(bg1_tilemap, butasan_bg1_status & 0x01); /* Set enable flag */ - tilemap_mark_all_tiles_dirty( bg1_tilemap ); /* Bank changed */ - } +WRITE8_HANDLER( butasan_unknown_w ) +{ + butasan_unknown = data; } @@ -1042,18 +750,42 @@ WRITE8_HANDLER( butasan_bg1_status_w ) Screen refresh ***************************************************************************/ -static void argus_bg0_scroll_handle( running_machine *machine ) +static void bg_setting(void) +{ + tilemap_set_flip(ALL_TILEMAPS, argus_flipscreen ? TILEMAP_FLIPY|TILEMAP_FLIPX : 0); + + if (!argus_flipscreen) + { + if (bg0_tilemap != NULL) + { + tilemap_set_scrollx(bg0_tilemap, 0, bg0_scrollx & 0x1ff); + tilemap_set_scrolly(bg0_tilemap, 0, bg0_scrolly & 0x1ff); + } + tilemap_set_scrollx(bg1_tilemap, 0, bg1_scrollx & 0x1ff); + tilemap_set_scrolly(bg1_tilemap, 0, bg1_scrolly & 0x1ff); + } + else + { + if (bg0_tilemap != NULL) + { + tilemap_set_scrollx(bg0_tilemap, 0, (bg0_scrollx + 256) & 0x1ff); + tilemap_set_scrolly(bg0_tilemap, 0, (bg0_scrolly + 256) & 0x1ff); + } + tilemap_set_scrollx(bg1_tilemap, 0, (bg1_scrollx + 256) & 0x1ff); + tilemap_set_scrolly(bg1_tilemap, 0, (bg1_scrolly + 256) & 0x1ff); + } +} + +static void argus_bg0_scroll_handle(running_machine *machine) { int delta; - int scrollx; int dcolumn; /* Deficit between previous and current scroll value */ - scrollx = argus_bg0_scrollx[0] | (argus_bg0_scrollx[1] << 8); - delta = scrollx - prvscrollx; - prvscrollx = scrollx; + delta = bg0_scrollx - prvscrollx; + prvscrollx = bg0_scrollx; - if ( delta == 0 ) + if (delta == 0) return; if (delta > 0) @@ -1063,7 +795,7 @@ static void argus_bg0_scroll_handle( running_machine *machine ) if (lowbitscroll >= 16) { - dcolumn ++; + dcolumn++; lowbitscroll -= 16; } @@ -1072,18 +804,18 @@ static void argus_bg0_scroll_handle( running_machine *machine ) int i, j; int col, woffs, roffs; - col = ( (scrollx / 16) + 16 ) % 32; + col = ((bg0_scrollx / 16) + 16) % 32; woffs = 32 * 2 * col; - roffs = ( ( (scrollx / 16) + 16 ) * 8 ) % 0x8000; + roffs = (((bg0_scrollx / 16) + 16) * 8) % 0x8000; - if ( dcolumn >= 18 ) + if (dcolumn >= 18) dcolumn = 18; - for ( i = 0 ; i < dcolumn ; i ++ ) + for (i = 0; i < dcolumn; i++) { - for ( j = 0 ; j < 4 ; j ++ ) + for (j = 0; j < 4; j++) { - argus_write_dummy_rams( machine, woffs, roffs ); + argus_write_dummy_rams(machine, woffs, roffs); woffs += 16; roffs += 2; } @@ -1103,7 +835,7 @@ static void argus_bg0_scroll_handle( running_machine *machine ) if (lowbitscroll <= 0) { - dcolumn ++; + dcolumn++; lowbitscroll += 16; } @@ -1112,20 +844,20 @@ static void argus_bg0_scroll_handle( running_machine *machine ) int i, j; int col, woffs, roffs; - col = ( (scrollx / 16) + 31 ) % 32; + col = ((bg0_scrollx / 16) + 31) % 32; woffs = 32 * 2 * col; - roffs = ( (scrollx / 16) - 1 ) * 8; + roffs = ((bg0_scrollx / 16) - 1) * 8; if (roffs < 0) roffs += 0x08000; if (dcolumn >= 18) dcolumn = 18; - for ( i = 0 ; i < dcolumn ; i ++ ) + for (i = 0; i < dcolumn; i++) { - for ( j = 0 ; j < 4 ; j ++ ) + for (j = 0; j < 4; j++) { - argus_write_dummy_rams( machine, woffs, roffs ); + argus_write_dummy_rams(machine, woffs, roffs); woffs += 16; roffs += 2; } @@ -1136,12 +868,6 @@ static void argus_bg0_scroll_handle( running_machine *machine ) } } } - - if (!argus_flipscreen) - tilemap_set_scrollx(bg0_tilemap, 0, scrollx & 0x1ff); - else - tilemap_set_scrollx(bg0_tilemap, 0, (scrollx + 256) & 0x1ff); - } static void argus_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int priority) @@ -1149,42 +875,27 @@ static void argus_draw_sprites(running_machine *machine, bitmap_t *bitmap, const int offs; /* Draw the sprites */ - for (offs = 11 ; offs < spriteram_size ; offs += 16) + for (offs = 0; offs < spriteram_size; offs += 16) { - if ( !(spriteram[offs+4] == 0 && spriteram[offs] == 0xf0) ) + if (!(spriteram[offs+15] == 0 && spriteram[offs+11] == 0xf0)) { int sx, sy, tile, flipx, flipy, color, pri; - sx = spriteram[offs + 1]; - sy = spriteram[offs]; + sx = spriteram[offs+12]; if (spriteram[offs+13] & 0x01) sx -= 256; + sy = spriteram[offs+11]; if (!(spriteram[offs+13] & 0x02)) sy -= 256; + + tile = spriteram[offs+14] | ((spriteram[offs+13] & 0xc0) << 2); + flipx = spriteram[offs+13] & 0x10; + flipy = spriteram[offs+13] & 0x20; + color = spriteram[offs+15] & 0x07; + pri = (spriteram[offs+15] & 0x08) >> 3; if (argus_flipscreen) { sx = 240 - sx; sy = 240 - sy; - } - - if (!argus_flipscreen) - { - if ( spriteram[offs+2] & 0x01) sx -= 256; - if (!(spriteram[offs+2] & 0x02)) sy -= 256; - } - else - { - if ( spriteram[offs+2] & 0x01) sx += 256; - if (!(spriteram[offs+2] & 0x02)) sy += 256; - } - - tile = spriteram[offs+3] + ((spriteram[offs+2] & 0xc0) << 2); - flipx = spriteram[offs+2] & 0x10; - flipy = spriteram[offs+2] & 0x20; - color = spriteram[offs+4] & 0x07; - pri = (spriteram[offs+4] & 0x08) >> 3; - - if (argus_flipscreen) - { - flipx ^= 0x10; - flipy ^= 0x20; + flipx = !flipx; + flipy = !flipy; } if (priority != pri) @@ -1195,52 +906,130 @@ static void argus_draw_sprites(running_machine *machine, bitmap_t *bitmap, const flipx, flipy, sx, sy, cliprect, - TRANSPARENCY_PEN, 15 - ); + TRANSPARENCY_PEN, 15); + } + } +} + +#if 1 +static void valtric_draw_mosaic(const device_config *screen, bitmap_t *bitmap, const rectangle *cliprect) +{ + static int mosaic=0; + + if (valtric_mosaic!=0x80) + { + mosaic=0x0f-(valtric_mosaic&0x0f); + if (mosaic!=0) mosaic++; + if (valtric_mosaic&0x80) mosaic*=-1; + } + + if (mosaic==0) + tilemap_draw(bitmap, cliprect, bg1_tilemap, 0, 0); + else + { + tilemap_draw(mosaicbitmap, cliprect, bg1_tilemap, 0, 0); + { + int step=mosaic; + UINT32 *dest; + int x,y,xx,yy; + int width = video_screen_get_width(screen); + int height = video_screen_get_height(screen); + + if (mosaic<0)step*=-1; + + for (y=0;y= 0x100 && offs < 0x300) || (offs >= 0x400 && offs < 0x580) ) - { - jal_blend_drawgfx(machine, - bitmap,machine->gfx[0], - tile, - color, - flipx, flipy, - sx, sy, - cliprect, - TRANSPARENCY_PEN, 7); - } - else if ( (offs >= 0x000 && offs < 0x100) || (offs >= 0x300 && offs < 0x400) ) - { - int i; + if (spriteram[offs+11] & 0x01) sx-=256; + if (spriteram[offs+13] & 0x01) sy-=256; - for ( i = 0 ; i <= 1 ; i ++ ) - { - int td; + sy = 240 - sy; - td = (flipx) ? (1 - i) : i; + fx = flipx; + fy = flipy; - jal_blend_drawgfx(machine, - bitmap,machine->gfx[0], - tile + td, - color, - flipx, flipy, - sx + i * 16, sy, - cliprect, - TRANSPARENCY_PEN, 7); - } - } - else if ( offs >= 0x580 && offs < 0x620 ) - { - int i, j; - - for ( i = 0 ; i <= 1 ; i ++ ) - { - for ( j = 0 ; j <= 1 ; j ++ ) - { - int td; - - if ( !flipy ) - td = (flipx) ? (i * 2) + 1 - j : i * 2 + j; - else - td = (flipx) ? ( (1 - i) * 2 ) + 1 - j : (1 - i) * 2 + j; - - jal_blend_drawgfx(machine, - bitmap,machine->gfx[0], - tile + td, - color, - flipx, flipy, - sx + j * 16, sy - i * 16, - cliprect, - TRANSPARENCY_PEN, 7); - } - } - } - else if ( offs >= 0x620 && offs < 0x680 ) - { - int i, j; - - for ( i = 0 ; i <= 3 ; i ++ ) - { - for ( j = 0 ; j <= 3 ; j ++ ) - { - int td; - - if ( !flipy ) - td = (flipx) ? (i * 4) + 3 - j : i * 4 + j; - else - td = (flipx) ? ( (3 - i) * 4 ) + 3 - j : (3 - i) * 4 + j; - - jal_blend_drawgfx(machine, - bitmap,machine->gfx[0], - tile + td, - color, - flipx, flipy, - sx + j * 16, sy - i * 16, - cliprect, - TRANSPARENCY_PEN, 7); - } - } - } - } - else + if (argus_flipscreen) { sx = 240 - sx; sy = 240 - sy; - flipx ^= 0x01; - flipy ^= 0x04; + flipx = !flipx; + flipy = !flipy; + } + + { + int i, j, td; - if ( (offs >= 0x100 && offs < 0x300) || (offs >= 0x400 && offs < 0x580) ) + if ((offs >= 0x100 && offs <= 0x2ff) || (offs >= 0x400 && offs <= 0x57f)) { jal_blend_drawgfx(machine, bitmap,machine->gfx[0], @@ -1379,73 +1092,61 @@ static void butasan_draw_sprites(running_machine *machine, bitmap_t *bitmap, con cliprect, TRANSPARENCY_PEN, 7); } - else if ( (offs >= 0x000 && offs < 0x100) || (offs >= 0x300 && offs < 0x400) ) + else if ((offs >= 0x000 && offs <= 0x0ff) || (offs >= 0x300 && offs <= 0x3ff)) { - int i; - - for ( i = 0 ; i <= 1 ; i ++ ) + for (i = 0; i <= 1; i++) { - int td; - - td = (flipx) ? i : (1 - i); + td = (fx) ? (1 - i) : i; jal_blend_drawgfx(machine, bitmap,machine->gfx[0], tile + td, color, flipx, flipy, - sx - i * 16, sy, + sx + i * 16, sy, cliprect, TRANSPARENCY_PEN, 7); } } - else if ( offs >= 0x580 && offs < 0x620 ) + else if (offs >= 0x580 && offs <= 0x61f) { - int i, j; - - for ( i = 0 ; i <= 1 ; i ++ ) + for (i = 0; i <= 1; i++) { - for ( j = 0 ; j <= 1 ; j ++ ) + for (j = 0; j <= 1; j++) { - int td; - - if ( !flipy ) - td = (flipx) ? (1 - i) * 2 + j : ( (1 - i) * 2 ) + 1 - j; + if (fy) + td = (fx) ? ((1 - i) * 2) + 1 - j : (1 - i) * 2 + j; else - td = (flipx) ? i * 2 + j : (i * 2) + 1 - j; + td = (fx) ? (i * 2) + 1 - j : i * 2 + j; jal_blend_drawgfx(machine, bitmap,machine->gfx[0], tile + td, color, flipx, flipy, - sx - j * 16, sy + i * 16, + sx + j * 16, sy - i * 16, cliprect, TRANSPARENCY_PEN, 7); } } } - else if ( offs >= 0x620 && offs < 0x680 ) + else if (offs >= 0x620 && offs <= 0x67f) { - int i, j; - - for ( i = 0 ; i <= 3 ; i ++ ) + for (i = 0; i <= 3; i++) { - for ( j = 0 ; j <= 3 ; j ++ ) + for (j = 0; j <= 3; j++) { - int td; - - if ( !flipy ) - td = (flipx) ? (3 - i) * 4 + j : ( (3 - i) * 4 ) + 3 - j; + if (fy) + td = (fx) ? ((3 - i) * 4) + 3 - j : (3 - i) * 4 + j; else - td = (flipx) ? i * 4 + j : (i * 4) + 3 - j; + td = (fx) ? (i * 4) + 3 - j : i * 4 + j; jal_blend_drawgfx(machine, bitmap,machine->gfx[0], tile + td, color, flipx, flipy, - sx - j * 16, sy + i * 16, + sx + j * 16, sy - i * 16, cliprect, TRANSPARENCY_PEN, 7); } @@ -1461,15 +1162,15 @@ static void butasan_log_vram(void) { int offs; - if ( input_code_pressed(KEYCODE_M) ) + if (input_code_pressed(KEYCODE_M)) { int i; logerror("\nSprite RAM\n"); logerror("---------------------------------------\n"); logerror(" +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +a +b +c +d +e +f\n"); - for (offs = 0 ; offs < spriteram_size ; offs += 16) + for (offs = 0; offs < spriteram_size; offs += 16) { - for (i = 0 ; i < 16 ; i ++) + for (i = 0; i < 16; i++) { if (i == 0) { @@ -1487,9 +1188,9 @@ static void butasan_log_vram(void) logerror("\nColor RAM\n"); logerror("---------------------------------------\n"); logerror(" +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +a +b +c +d +e +f\n"); - for (offs = 0 ; offs < 0xbf0 ; offs += 16) + for (offs = 0; offs < 0xbf0; offs += 16) { - for (i = 0 ; i < 16 ; i ++) + for (i = 0; i < 16; i++) { if (i == 0) { @@ -1508,79 +1209,17 @@ static void butasan_log_vram(void) } #endif -static void bombsa_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) -{ - int offs; - - /* Draw the sprites */ - for (offs = 11 ; offs < spriteram_size ; offs += 16) - { - if ( !(spriteram[offs+4] == 0 && spriteram[offs] == 0xf0) ) - { - int sx, sy, tile, flipx, flipy, color, size; - - sx = spriteram[offs + 1]; - sy = spriteram[offs]; - - if (spriteram[offs+2] & 0x01) sx += 256; - if (spriteram[offs+2] & 0x02) sy += 256; - - - tile = spriteram[offs+3] + ((spriteram[offs+2] & 0xc0) << 2); - flipx = spriteram[offs+2] & 0x10; - flipy = spriteram[offs+2] & 0x20; - color = spriteram[offs+4] & 0x0f; - size = spriteram[offs+2] & 0x08; - - if(!size) - { - drawgfx(bitmap,machine->gfx[0],tile,color,flipx,flipy,sx,sy,cliprect,TRANSPARENCY_PEN,15); - } - else - { - if (!flipy && !flipx) - { - drawgfx(bitmap,machine->gfx[0],tile+0,color,flipx,flipy,sx,sy,cliprect,TRANSPARENCY_PEN,15); - drawgfx(bitmap,machine->gfx[0],tile+1,color,flipx,flipy,sx,sy+16,cliprect,TRANSPARENCY_PEN,15); - drawgfx(bitmap,machine->gfx[0],tile+2,color,flipx,flipy,sx+16,sy,cliprect,TRANSPARENCY_PEN,15); - drawgfx(bitmap,machine->gfx[0],tile+3,color,flipx,flipy,sx+16,sy+16,cliprect,TRANSPARENCY_PEN,15); - } - else if (!flipy && flipx) - { - drawgfx(bitmap,machine->gfx[0],tile+0,color,flipx,flipy,sx+16,sy,cliprect,TRANSPARENCY_PEN,15); - drawgfx(bitmap,machine->gfx[0],tile+1,color,flipx,flipy,sx+16,sy+16,cliprect,TRANSPARENCY_PEN,15); - drawgfx(bitmap,machine->gfx[0],tile+2,color,flipx,flipy,sx,sy,cliprect,TRANSPARENCY_PEN,15); - drawgfx(bitmap,machine->gfx[0],tile+3,color,flipx,flipy,sx,sy+16,cliprect,TRANSPARENCY_PEN,15); - } - else if (flipy && !flipx) - { - drawgfx(bitmap,machine->gfx[0],tile+0,color,flipx,flipy,sx,sy+16,cliprect,TRANSPARENCY_PEN,15); - drawgfx(bitmap,machine->gfx[0],tile+1,color,flipx,flipy,sx,sy,cliprect,TRANSPARENCY_PEN,15); - drawgfx(bitmap,machine->gfx[0],tile+2,color,flipx,flipy,sx+16,sy+16,cliprect,TRANSPARENCY_PEN,15); - drawgfx(bitmap,machine->gfx[0],tile+3,color,flipx,flipy,sx+16,sy,cliprect,TRANSPARENCY_PEN,15); - } - else if (flipy && flipx) - { - drawgfx(bitmap,machine->gfx[0],tile+0,color,flipx,flipy,sx+16,sy+16,cliprect,TRANSPARENCY_PEN,15); - drawgfx(bitmap,machine->gfx[0],tile+1,color,flipx,flipy,sx+16,sy,cliprect,TRANSPARENCY_PEN,15); - drawgfx(bitmap,machine->gfx[0],tile+2,color,flipx,flipy,sx,sy+16,cliprect,TRANSPARENCY_PEN,15); - drawgfx(bitmap,machine->gfx[0],tile+3,color,flipx,flipy,sx,sy,cliprect,TRANSPARENCY_PEN,15); - } - } - } - } -} - VIDEO_UPDATE( argus ) { + bg_setting(); + /* scroll BG0 and render tile at proper position */ argus_bg0_scroll_handle(screen->machine); - fillbitmap(bitmap, screen->machine->pens[0], cliprect); - tilemap_draw(bitmap, cliprect, bg0_tilemap, 0, 0); argus_draw_sprites(screen->machine, bitmap, cliprect, 0); - tilemap_draw(bitmap, cliprect, bg1_tilemap, 0, 0); + if (argus_bg_status & 1) /* Backgound enable */ + tilemap_draw(bitmap, cliprect, bg1_tilemap, 0, 0); argus_draw_sprites(screen->machine, bitmap, cliprect, 1); tilemap_draw(bitmap, cliprect, tx_tilemap, 0, 0); return 0; @@ -1588,47 +1227,12 @@ VIDEO_UPDATE( argus ) VIDEO_UPDATE( valtric ) { - fillbitmap(bitmap, screen->machine->pens[0], cliprect); + bg_setting(); - if(valtric_mosaic==0) - tilemap_draw(bitmap, cliprect, bg1_tilemap, 0, 0); + if (argus_bg_status & 1) /* Backgound enable */ + valtric_draw_mosaic(screen, bitmap, cliprect); else - { - tilemap_draw(mosaicbitmap, cliprect, bg1_tilemap, 0, 0); - { - int step=valtric_mosaic; - UINT32 *dest; - int x,y,xx,yy; - int width = video_screen_get_width(screen); - int height = video_screen_get_height(screen); - - if(valtric_mosaic<0)step*=-1; - - for(y=0;ymachine), cliprect); valtric_draw_sprites(screen->machine, bitmap, cliprect); tilemap_draw(bitmap, cliprect, tx_tilemap, 0, 0); return 0; @@ -1636,10 +1240,13 @@ VIDEO_UPDATE( valtric ) VIDEO_UPDATE( butasan ) { - fillbitmap(bitmap, screen->machine->pens[0], cliprect); + bg_setting(); - tilemap_draw(bitmap, cliprect, bg1_tilemap, 0, 0); - tilemap_draw(bitmap, cliprect, bg0_tilemap, 0, 0); + if (argus_bg_status & 1) /* Backgound enable */ + tilemap_draw(bitmap, cliprect, bg0_tilemap, 0, 0); + else + fillbitmap(bitmap, get_black_pen(screen->machine), cliprect); + if (butasan_bg1_status & 1) tilemap_draw(bitmap, cliprect, bg1_tilemap, 0, 0); butasan_draw_sprites(screen->machine, bitmap, cliprect); tilemap_draw(bitmap, cliprect, tx_tilemap, 0, 0); @@ -1648,20 +1255,3 @@ VIDEO_UPDATE( butasan ) #endif return 0; } - - -VIDEO_UPDATE( bombsa ) -{ - fillbitmap(bitmap, screen->machine->pens[0], cliprect); - -// tilemap_draw(bitmap, cliprect, bg1_tilemap, 0, 0); -// valtric_draw_sprites(screen->bitmap, cliprect); - tilemap_draw(bitmap, cliprect, bombsa_bg_tilemap, 0, 0); - -#if 0 - tilemap_draw(bitmap, cliprect, tx_alt_tilemap, 0, 0); -#endif - tilemap_draw(bitmap, cliprect, tx_tilemap, 0, 0); - bombsa_draw_sprites(screen->machine, bitmap,cliprect); - return 0; -} diff --git a/src/mame/video/jalblend.c b/src/mame/video/jalblend.c index cb5cd7fcd34..818be8bdbaf 100644 --- a/src/mame/video/jalblend.c +++ b/src/mame/video/jalblend.c @@ -11,9 +11,12 @@ ****************************************************************************/ +#include "driver.h" +#include "jalblend.h" + /* each palette entry contains a fourth 'alpha' value */ -static UINT8 *jal_blend_table; +UINT8 *jal_blend_table; /* * 'Alpha' Format @@ -21,158 +24,163 @@ static UINT8 *jal_blend_table; * * Bytes | Use * -76543210-+---------------- - * xxxx---- | unknown - maybe special background? - * ----x--- | unknown - same as above + * ----x--- | blend enable flag (?) * -----x-- | red add/subtract * ------x- | green add/subtract * -------x | blue add/subtract */ /* basically an add/subtract function with clamping */ -static rgb_t jal_blend_func(rgb_t dest, rgb_t addMe, UINT8 alpha) +rgb_t jal_blend_func(rgb_t dest, rgb_t addMe, UINT8 alpha) { - int r = (float)RGB_RED (addMe) ; - int g = (float)RGB_GREEN(addMe) ; - int b = (float)RGB_BLUE (addMe) ; - - int rd = (float)RGB_RED (dest) ; - int gd = (float)RGB_GREEN(dest) ; - int bd = (float)RGB_BLUE (dest) ; - - int finalR, finalG, finalB ; - - int subR = (alpha & 0x04) >> 2 ; - int subG = (alpha & 0x02) >> 1 ; - int subB = (alpha & 0x01) ; - - if (subR) finalR = rd - r ; - else finalR = rd + r ; - if (finalR < 0) finalR = 0 ; - else if (finalR > 255) finalR = 255 ; - - - if (subG) finalG = gd - g ; - else finalG = gd + g ; - if (finalG < 0) finalG = 0 ; - else if (finalG > 255) finalG = 255 ; - - - if (subB) finalB = bd - b ; - else finalB = bd + b ; - if (finalB < 0) finalB = 0 ; - else if (finalB > 255) finalB = 255 ; - - return MAKE_RGB((UINT8)finalR,(UINT8)finalG,(UINT8)finalB) ; + int r, g, b; + int ir, ig, ib; + + r = (int)RGB_RED (dest); + g = (int)RGB_GREEN(dest); + b = (int)RGB_BLUE (dest); + + ir = (int)RGB_RED (addMe); + ig = (int)RGB_GREEN(addMe); + ib = (int)RGB_BLUE (addMe); + + if (alpha & 4) + { r -= ir; if (r < 0) r = 0; } + else + { r += ir; if (r > 255) r = 255; } + if (alpha & 2) + { g -= ig; if (g < 0) g = 0; } + else + { g += ig; if (g > 255) g = 255; } + if (alpha & 1) + { b -= ib; if (b < 0) b = 0; } + else + { b += ib; if (b > 255) b = 255; } + + return MAKE_RGB(r,g,b); } -static void jal_blend_drawgfx( running_machine *machine, bitmap_t *dest_bmp,const gfx_element *gfx, - UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy, - const rectangle *clip,int transparency,int transparent_color) +void jal_blend_drawgfx(running_machine *machine,bitmap_t *dest_bmp,const gfx_element *gfx, + UINT32 code,UINT32 color,int flipx,int flipy,int offsx,int offsy, + const rectangle *clip,int transparency,int transparent_color) { - /* drawgfx(dest_bmp, gfx, code, color, flipx, flipy, offsx, offsy, clip, TRANSPARENCY_PEN, 15); */ - - int xstart, ystart, xend, yend, xinc, yinc; - int xtile, ytile ; - int code_offset = 0; - - int wide = 1 ; - int high = 1 ; - - if (flipx) { xstart = wide-1; xend = -1; xinc = -1; } - else { xstart = 0; xend = wide; xinc = +1; } - - if (flipy) { ystart = high-1; yend = -1; yinc = -1; } - else { ystart = 0; yend = high; yinc = +1; } + if (jal_blend_table == NULL) + { + drawgfx(dest_bmp,gfx,code,color,flipx,flipy,offsx,offsy,clip,transparency,transparent_color); + return; + } /* Start drawing */ - if( gfx ) + if (gfx) { - for (ytile = ystart; ytile != yend; ytile += yinc ) - { - for (xtile = xstart; xtile != xend; xtile += xinc ) - { - const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; - const UINT8 *alpha = &jal_blend_table[gfx->color_granularity * (color % gfx->total_colors)]; - int source_base = ((code + code_offset++) % gfx->total_elements) * gfx->height; + const pen_t *pal = &machine->pens[gfx->color_base + gfx->color_granularity * (color % gfx->total_colors)]; + const UINT8 *alpha = &jal_blend_table[gfx->color_granularity * (color % gfx->total_colors)]; + UINT8 *source_base = gfx->gfxdata + (code % gfx->total_elements) * gfx->char_modulo; + int x_index_base, y_index, sx, sy, ex, ey; + int xinc, yinc; - int x_index_base, y_index, sx, sy, ex, ey; + xinc = flipx ? -1 : 1; + yinc = flipy ? -1 : 1; - if (flipx) { x_index_base = gfx->width-1; } - else { x_index_base = 0; } + x_index_base = flipx ? gfx->width-1 : 0; + y_index = flipy ? gfx->height-1 : 0; - if (flipy) { y_index = gfx->height-1; } - else { y_index = 0; } + /* start coordinates */ + sx = offsx; + sy = offsy; - /* start coordinates */ - sx = offsx + xtile*gfx->width; - sy = offsy + ytile*gfx->height; + /* end coordinates */ + ex = sx + gfx->width; + ey = sy + gfx->height; - /* end coordinates */ - ex = sx + gfx->width; - ey = sy + gfx->height; + if (clip) + { + if (sx < clip->min_x) + { /* clip left */ + int pixels = clip->min_x-sx; + sx += pixels; + x_index_base += xinc*pixels; + } + if (sy < clip->min_y) + { /* clip top */ + int pixels = clip->min_y-sy; + sy += pixels; + y_index += yinc*pixels; + } + /* NS 980211 - fixed incorrect clipping */ + if (ex > clip->max_x+1) + { /* clip right */ + ex = clip->max_x+1; + } + if (ey > clip->max_y+1) + { /* clip bottom */ + ey = clip->max_y+1; + } + } + + if (ex > sx) + { /* skip if inner loop doesn't draw anything */ + int x, y; - if( clip ) + /* 32-bit destination bitmap */ + if (dest_bmp->bpp == 32) + { + /* taken from case 7: TRANSPARENCY_ALPHARANGE */ + for (y = sy; y < ey; y++) { - if( sx < clip->min_x) - { /* clip left */ - int pixels = clip->min_x-sx; - sx += pixels; - x_index_base += xinc*pixels; - } - if( sy < clip->min_y ) - { /* clip top */ - int pixels = clip->min_y-sy; - sy += pixels; - y_index += yinc*pixels; - } - /* NS 980211 - fixed incorrect clipping */ - if( ex > clip->max_x+1 ) - { /* clip right */ - int pixels = ex-clip->max_x-1; - ex -= pixels; - } - if( ey > clip->max_y+1 ) - { /* clip bottom */ - int pixels = ey-clip->max_y-1; - ey -= pixels; + UINT8 *source = source_base + y_index*gfx->line_modulo; + UINT32 *dest = BITMAP_ADDR32(dest_bmp, y, 0); + int x_index = x_index_base; + for (x = sx; x < ex; x++) + { + int c = source[x_index]; + if (c != transparent_color) + { + if (alpha[c] & 8) + { + /* Comp with clamp */ + dest[x] = jal_blend_func(dest[x], pal[c], alpha[c]); + } + else + { + /* Skip the costly alpha step altogether */ + dest[x] = pal[c]; + } + } + x_index += xinc; } + y_index += yinc; } + } - if( ex>sx ) - { /* skip if inner loop doesn't draw anything */ - int y; - - /* taken from case 7: TRANSPARENCY_ALPHARANGE */ - UINT8 *source = gfx->gfxdata + (source_base + y_index)*gfx->line_modulo + x_index_base; - UINT32 *dest = (UINT32 *)dest_bmp->base + sy*dest_bmp->rowpixels + sx; - int src_modulo = yinc*gfx->line_modulo - xinc*(ex-sx); - int dst_modulo = dest_bmp->rowpixels - (ex-sx); - - for( y=sy; yline_modulo; + UINT16 *dest = BITMAP_ADDR16(dest_bmp, y, 0); + int x_index = x_index_base; + for (x = sx; x < ex; x++) { - int x; - for( x=sx; x> 4), pal4bit(lo), pal4bit(hi >> 4)); } -static void psychic5_paletteram_w(running_machine *machine, int color_offs, int offset, int data) +static void psychic5_change_bg_palette(running_machine *machine, int color, int lo_offs, int hi_offs) { - int r,g,b,a,val; - - ps5_palette_ram[offset] = data; - - /* red component */ - r = (ps5_palette_ram[offset & ~1] >> 4) & 0x0f ; + UINT8 r,g,b,lo,hi,ir,ig,ib,ix; + rgb_t irgb; - /* green component */ - g = (ps5_palette_ram[offset & ~1]) & 0x0f ; + /* red,green,blue intensities */ + ir = pal4bit(palette_intensity >> 12); + ig = pal4bit(palette_intensity >> 8); + ib = pal4bit(palette_intensity >> 4); + ix = palette_intensity & 0x0f; - /* blue component */ - b = (ps5_palette_ram[offset | 1] >> 4) & 0x0f ; + irgb = MAKE_RGB(ir,ig,ib); - /* "alpha" component */ - val = (ps5_palette_ram[offset | 1] & 0x0f) & 0x0f ; - a = (val << 4) | val ; + lo = ps5_palette_ram[lo_offs]; + hi = ps5_palette_ram[hi_offs]; - jal_blend_table[(offset / 2)-color_offs] = a ; + /* red,green,blue component */ + r = pal4bit(lo >> 4); + g = pal4bit(lo); + b = pal4bit(hi >> 4); - palette_set_color_rgb(machine,(offset / 2)-color_offs,pal4bit(r),pal4bit(g),pal4bit(b)); + /* Grey background enable */ + if (psychic5_bg_status & 2) + { + UINT8 val = (r + g + b) / 3; /* Grey */ + /* Just leave plain grey */ + palette_set_color(machine,color,jal_blend_func(MAKE_RGB(val,val,val),irgb,ix)); + } + else + { + /* Seems fishy, but the title screen would be black otherwise... */ + if (!(title_screen & 1)) + { + /* Leave the world as-is */ + palette_set_color(machine,color,jal_blend_func(MAKE_RGB(r,g,b),irgb,ix)); + } + } } static void set_background_palette_intensity(running_machine *machine) { - int i,r,g,b,val,lo,hi,ir,ig,ib,ix; - - /* red,green,blue intensites */ - ir = ps5_palette_ram[BG_PAL_INTENSITY_RG] >> 4 ; ir = (ir << 4) | ir ; - ig = ps5_palette_ram[BG_PAL_INTENSITY_RG] & 15 ; ig = (ig << 4) | ig ; - ib = ps5_palette_ram[BG_PAL_INTENSITY_BU] >> 4 ; ib = (ib << 4) | ib ; - ix = ps5_palette_ram[0x1ff] & 0x0f ; + int i; + palette_intensity = ps5_palette_ram[BG_PAL_INTENSITY_BU] | + (ps5_palette_ram[BG_PAL_INTENSITY_RG]<<8); /* for all of the background palette */ for (i = 0; i < 0x100; i++) - { - lo = ps5_palette_ram[0x400+i*2]; - hi = ps5_palette_ram[0x400+i*2+1]; - - /* red component */ - val = (lo >> 4) & 0x0f; - r = (val << 4) | val ; + psychic5_change_bg_palette(machine,bg_palette_base+i,bg_palette_ram_base+i*2,bg_palette_ram_base+i*2+1); +} - /* green component */ - val = (lo & 15) & 0x0f; - g = (val << 4) | val ; - /* blue component */ - val = (hi >> 4) & 0x0f; - b = (val << 4) | val ; +/*************************************************************************** + Memory handler +***************************************************************************/ - /* Grey background enable */ - if (ps5_io_ram[BG_SCREEN_MODE] & 0x02) - { - val = (UINT8)((r + g + b) / 3); /* Grey */ - - if (ix != 0x0) /* Tint the grey */ - { - UINT32 result = jal_blend_func(MAKE_RGB(val,val,val), MAKE_RGB(ir, ig, ib), jal_blend_table[0xff]) ; - palette_set_color(machine, 0x100+i, result) ; - } - else /* Just leave plain grey */ - { - palette_set_color(machine,0x100+i,MAKE_RGB(val,val,val)); - } - } - else - { - /* Seems fishy, but the title screen would be black otherwise... */ - if (!title_screen) - { - if (ix != 0x0) /* Tint the world */ - { - UINT32 result = jal_blend_func(MAKE_RGB(r, g, b), MAKE_RGB(ir, ig, ib), jal_blend_table[0xff]) ; - palette_set_color(machine, 0x100+i, result) ; - } - else /* Leave the world as-is */ - { - palette_set_color(machine,0x100+i,MAKE_RGB(r,g,b)) ; - } - } - } - } +READ8_HANDLER( psychic5_vram_page_select_r ) +{ + return ps5_vram_page; } - -static WRITE8_HANDLER( psychic5_bg_videoram_w ) +WRITE8_HANDLER( psychic5_vram_page_select_w ) { - psychic5_bg_videoram[offset] = data; - tilemap_mark_tile_dirty(bg_tilemap, offset / 2); + ps5_vram_page = data & 1; } -static WRITE8_HANDLER( psychic5_fg_videoram_w ) +WRITE8_HANDLER( psychic5_title_screen_w ) { - psychic5_fg_videoram[offset] = data; - tilemap_mark_tile_dirty(fg_tilemap, offset / 2); + title_screen = data; } READ8_HANDLER( psychic5_paged_ram_r ) { - int val; + if (ps5_vram_page == 1) + { + switch (offset) + { + case 0x00: return input_port_read(machine, "SYSTEM"); + case 0x01: return input_port_read(machine, "P1"); + case 0x02: return input_port_read(machine, "P2"); + case 0x03: return input_port_read(machine, "DSW1"); + case 0x04: return input_port_read(machine, "DSW2"); + } + } + + return ps5_pagedram[ps5_vram_page][offset]; +} + +WRITE8_HANDLER( psychic5_paged_ram_w ) +{ + ps5_pagedram[ps5_vram_page][offset] = data; - if (!ps5_vram_page) + if (ps5_vram_page == 0) { - if (offset < 0x1000) - return psychic5_bg_videoram[offset]; - else - return ps5_dummy_bg_ram[offset & 0xfff]; + if (offset <= 0xfff) + tilemap_mark_tile_dirty(bg_tilemap, offset >> 1); } else { - if (offset < 0x400) + if (offset == BG_SCROLLX_LSB || offset == BG_SCROLLX_MSB) { - val = 0; - switch(offset) - { - case 0x00: - val = input_port_read(machine, "IN0"); - break; - case 0x01: - val = input_port_read(machine, "P1"); - break; - case 0x02: - val = input_port_read(machine, "P2"); - break; - case 0x03: - val = input_port_read(machine, "DSW0"); - break; - case 0x04: - val = input_port_read(machine, "DSW1"); - break; - default: - val = ps5_io_ram[offset]; - } - return (val); + UINT16 bg_scrollx = ps5_io_ram[BG_SCROLLX_LSB] | (ps5_io_ram[BG_SCROLLX_MSB] << 8); + tilemap_set_scrollx(bg_tilemap, 0, bg_scrollx); } - else if (offset < 0x1000) + else if (offset == BG_SCROLLY_LSB || offset == BG_SCROLLY_MSB) { - return ps5_palette_ram[offset-0x400]; + UINT16 bg_scrolly = ps5_io_ram[BG_SCROLLY_LSB] | (ps5_io_ram[BG_SCROLLY_MSB] << 8); + tilemap_set_scrolly(bg_tilemap, 0, bg_scrolly); } - else + else if (offset == BG_SCREEN_MODE) { - return psychic5_fg_videoram[offset & 0xfff]; + psychic5_bg_status = ps5_io_ram[BG_SCREEN_MODE]; } + else if (offset >= 0x400 && offset <= 0x5ff) /* Sprite color */ + psychic5_change_palette(machine,((offset >> 1) & 0xff)+0x000,offset-0x400); + else if (offset >= 0x800 && offset <= 0x9ff) /* BG color */ + psychic5_change_palette(machine,((offset >> 1) & 0xff)+0x100,offset-0x400); + else if (offset >= 0xa00 && offset <= 0xbff) /* Text color */ + psychic5_change_palette(machine,((offset >> 1) & 0xff)+0x200,offset-0x400); + else if (offset >= 0x1000) + tilemap_mark_tile_dirty(fg_tilemap, (offset-0x1000) >> 1); } } -WRITE8_HANDLER( psychic5_paged_ram_w ) +WRITE8_HANDLER( bombsa_paged_ram_w ) { - if (!ps5_vram_page) + ps5_pagedram[ps5_vram_page][offset] = data; + + if (ps5_vram_page == 0) { - if (offset < 0x1000) - psychic5_bg_videoram_w(machine,offset,data); - else - ps5_dummy_bg_ram[offset & 0xfff] = data; + tilemap_mark_tile_dirty(bg_tilemap, offset >> 1); } else { - if (offset < 0x400) - { - ps5_io_ram[offset] = data; - } - else if (offset < 0x600) - { - psychic5_paletteram_w(machine, 000, offset-0x400, data); - } - else if (offset > 0x5ff && offset< 0x800) - { - ps5_palette_ram[offset-0x400] = data; - } - else if (offset > 0x7ff && offset < 0xa00) - { - psychic5_paletteram_w(machine, 256, offset-0x400, data); - } - else if (offset > 0x9ff && offset < 0xc00) + if (offset == BG_SCROLLX_LSB || offset == BG_SCROLLX_MSB) { - psychic5_paletteram_w(machine, 256, offset-0x400, data); + UINT16 bg_scrollx = ps5_io_ram[BG_SCROLLX_LSB] | (ps5_io_ram[BG_SCROLLX_MSB] << 8); + tilemap_set_scrollx(bg_tilemap, 0, bg_scrollx); } - else if (offset < 0x1000) + else if (offset == BG_SCROLLY_LSB || offset == BG_SCROLLY_MSB) { - ps5_palette_ram[offset-0x400] = data; + UINT16 bg_scrolly = ps5_io_ram[BG_SCROLLY_LSB] | (ps5_io_ram[BG_SCROLLY_MSB] << 8); + tilemap_set_scrolly(bg_tilemap, 0, bg_scrolly); } - else + else if (offset == BG_SCREEN_MODE) { - psychic5_fg_videoram_w(machine, offset & 0xfff, data); + psychic5_bg_status = ps5_io_ram[BG_SCREEN_MODE]; } + else if (offset >= 0x0800 && offset <= 0x0fff) + tilemap_mark_tile_dirty(fg_tilemap, (offset & 0x7ff) >> 1); + else if (offset >= 0x1000 && offset <= 0x15ff) + psychic5_change_palette(machine, (offset >> 1) & 0x3ff, offset-0x1000); } } +WRITE8_HANDLER( bombsa_unknown_w ) +{ + bombsa_unknown = data; +} + + +/*************************************************************************** + Callbacks for the tilemap code +***************************************************************************/ + static TILE_GET_INFO( get_bg_tile_info ) { - int offs = tile_index * 2; + int offs = tile_index << 1; int attr = psychic5_bg_videoram[offs + 1]; - int code = psychic5_bg_videoram[offs] + ((attr & 0xc0) << 2); + int code = psychic5_bg_videoram[offs] | ((attr & 0xc0) << 2); int color = attr & 0x0f; - int flags = ((attr & 0x10) ? TILE_FLIPX : 0) + ((attr & 0x20) ? TILE_FLIPY : 0); + int flags = TILE_FLIPYX((attr & 0x30) >> 4); SET_TILE_INFO(1, code, color, flags); } static TILE_GET_INFO( get_fg_tile_info ) { - int offs = tile_index * 2; + int offs = tile_index << 1; int attr = psychic5_fg_videoram[offs + 1]; - int code = psychic5_fg_videoram[offs] + ((attr & 0xc0) << 2); + int code = psychic5_fg_videoram[offs] | ((attr & 0xc0) << 2); int color = attr & 0x0f; - int flags = ((attr & 0x10) ? TILE_FLIPX : 0) + ((attr & 0x20) ? TILE_FLIPY : 0); + int flags = TILE_FLIPYX((attr & 0x30) >> 4); SET_TILE_INFO(2, code, color, flags); } + +/*************************************************************************** + Initialize and destroy video hardware emulation +***************************************************************************/ + VIDEO_START( psychic5 ) { - psychic5_bg_videoram = auto_malloc(0x1000); - psychic5_fg_videoram = auto_malloc(0x1000); - ps5_dummy_bg_ram = auto_malloc(0x1000); - ps5_io_ram = auto_malloc(0x400); - ps5_palette_ram = auto_malloc(0xc00); - jal_blend_table = auto_malloc(0xc00); + /* info offset w h col row */ + bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_cols, 16, 16, 64, 32); + fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_cols, 8, 8, 32, 32); + + tilemap_set_transparent_pen(fg_tilemap, 15); + + ps5_pagedram[0] = auto_malloc(0x2000); + ps5_pagedram[1] = auto_malloc(0x2000); - memset(psychic5_bg_videoram, 0,0x1000); - memset(psychic5_fg_videoram,0,0x1000); - memset(ps5_dummy_bg_ram,0,0x1000); - memset(ps5_io_ram,0,0x400); - memset(ps5_palette_ram,0,0xc00); - memset(jal_blend_table,0,0xc00) ; + psychic5_bg_videoram = &ps5_pagedram[0][0x0000]; + ps5_dummy_bg_ram = &ps5_pagedram[0][0x1000]; + ps5_io_ram = &ps5_pagedram[1][0x0000]; + ps5_palette_ram = &ps5_pagedram[1][0x0400]; + psychic5_fg_videoram = &ps5_pagedram[1][0x1000]; - bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_cols, - 16, 16, 64, 32); + jal_blend_table = auto_malloc(0xc00); - fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_cols, - 8, 8, 32, 32); + bg_palette_ram_base = 0x400; + bg_palette_base = 0x100; +} + +VIDEO_START( bombsa ) +{ + /* info offset w h col row */ + bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_cols, 16, 16, 128, 32); + fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_cols, 8, 8, 32, 32); tilemap_set_transparent_pen(fg_tilemap, 15); + + ps5_pagedram[0] = auto_malloc(0x2000); + ps5_pagedram[1] = auto_malloc(0x2000); + + psychic5_bg_videoram = &ps5_pagedram[0][0x0000]; + ps5_dummy_bg_ram = &ps5_pagedram[0][0x1000]; + ps5_io_ram = &ps5_pagedram[1][0x0000]; + psychic5_fg_videoram = &ps5_pagedram[1][0x0800]; + ps5_palette_ram = &ps5_pagedram[1][0x1000]; + + //jal_blend_table = auto_malloc(0xc00); + jal_blend_table = NULL; + + bg_palette_ram_base = 0x000; + bg_palette_base = 0x000; +} + +VIDEO_RESET( psychic5 ) +{ + bg_clip_mode = 0; + ps5_vram_page = 0; + psychic5_bg_status = 0; + memset(ps5_pagedram[0],0,0x2000); + memset(ps5_pagedram[1],0,0x2000); + palette_intensity = 0; + if (jal_blend_table != NULL) memset(jal_blend_table,0,0xc00); +} + +VIDEO_RESET( bombsa ) +{ + ps5_vram_page = 0; + psychic5_bg_status = 0; + title_screen = 0; + memset(ps5_pagedram[0],0,0x2000); + memset(ps5_pagedram[1],0,0x2000); + palette_intensity = 0; + if (jal_blend_table != NULL) memset(jal_blend_table,0,0xc00); } + +/*************************************************************************** + Screen refresh +***************************************************************************/ + #define DRAW_SPRITE(code, sx, sy) jal_blend_drawgfx(machine, bitmap, machine->gfx[0], code, color, flipx, flipy, sx, sy, cliprect, TRANSPARENCY_PEN, 15); -/* #define DRAW_SPRITE(code, sx, sy) drawgfx(bitmap, machine->gfx[0], code, color, flipx, flipy, sx, sy, cliprect, TRANSPARENCY_PEN, 15); */ -static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) +static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { int offs; - if (title_screen) - return; - else - bg_clip_mode = -10; - - for (offs = 11; offs < spriteram_size; offs += 16) + /* Draw the sprites */ + for (offs = 0; offs < spriteram_size; offs += 16) { - int tileofs0, tileofs1, tileofs2, tileofs3, temp1, temp2; - int attr = spriteram[offs + 2]; - int code = spriteram[offs + 3] + ((attr & 0xc0) << 2); - int color = spriteram[offs + 4] & 0x0f; + int attr = spriteram[offs + 13]; + int code = spriteram[offs + 14] | ((attr & 0xc0) << 2); + int color = spriteram[offs + 15] & 0x0f; int flipx = attr & 0x10; int flipy = attr & 0x20; - int sx = spriteram[offs + 1]; - int sy = spriteram[offs]; - int size32 = attr & 0x08; + int sx = spriteram[offs + 12]; + int sy = spriteram[offs + 11]; + int size = (attr & 0x08) ? 32:16; if (attr & 0x01) sx -= 256; if (attr & 0x04) sy -= 256; @@ -324,31 +349,20 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta flipy = !flipy; } - if (flipy) - { - tileofs0 = 1; tileofs1 = 0; tileofs2 = 3; tileofs3 = 2; - } - else + if (size == 32) { - tileofs0 = 0; tileofs1 = 1; tileofs2 = 2; tileofs3 = 3; - } + int x0,x1,y0,y1; - if (flipx) - { - temp1 = tileofs0; - temp2 = tileofs1; - tileofs0 = tileofs2; - tileofs1 = tileofs3; - tileofs2 = temp1; - tileofs3 = temp2; - } + if (flipx) { x0 = 2; x1 = 0; } + else { x0 = 0; x1 = 2; } - if (size32) - { - DRAW_SPRITE(code + tileofs0, sx, sy) - DRAW_SPRITE(code + tileofs1, sx, sy + 16) - DRAW_SPRITE(code + tileofs2, sx + 16, sy) - DRAW_SPRITE(code + tileofs3, sx + 16, sy + 16) + if (flipy) { y0 = 1; y1 = 0; } + else { y0 = 0; y1 = 1; } + + DRAW_SPRITE(code + x0 + y0, sx, sy) + DRAW_SPRITE(code + x0 + y1, sx, sy + 16) + DRAW_SPRITE(code + x1 + y0, sx + 16, sy) + DRAW_SPRITE(code + x1 + y1, sx + 16, sy + 16) } else { @@ -360,106 +374,89 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta } } -static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) +static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) { - int bg_scrollx = (ps5_io_ram[BG_SCROLLX_LSB] + ((ps5_io_ram[BG_SCROLLX_MSB] & 0x03) << 8)) & 0x3ff; - int bg_scrolly = (ps5_io_ram[BG_SCROLLY_LSB] + ((ps5_io_ram[BG_SCROLLY_MSB] & 0x01) << 8)) & 0x1ff; + static int sx1 = 0, sy1 = 0, sy2 = 0; - tilemap_set_scrollx(bg_tilemap, 0, bg_scrollx); - tilemap_set_scrolly(bg_tilemap, 0, bg_scrolly); + rectangle clip = *cliprect; set_background_palette_intensity(machine); - if (ps5_io_ram[BG_SCREEN_MODE] & 0x01) /* background enable */ + if (!(title_screen & 1)) + { + bg_clip_mode = 0; + sx1 = sy1 = sy2 = 0; + } + else { - if (title_screen) + int sy1_old = sy1; + int sx1_old = sx1; + int sy2_old = sy2; + + sy1 = spriteram[11]; /* sprite 0 */ + sx1 = spriteram[12]; + sy2 = spriteram[11+128]; /* sprite 8 */ + + switch (bg_clip_mode) { - rectangle clip = *cliprect; - - int sx1 = spriteram[12]; /* sprite 0 */ - int sy1 = spriteram[11]; - int tile = spriteram[14]; - int sy2 = spriteram[11+128]; /* sprite 8 */ - - if (bg_clip_mode >=0 && bg_clip_mode < 3 && sy1==240) bg_clip_mode = 0; - if (bg_clip_mode > 2 && bg_clip_mode < 5 && sy2==240) bg_clip_mode = -10; - if (bg_clip_mode > 4 && bg_clip_mode < 7 && sx1==240) bg_clip_mode = 0; - if (bg_clip_mode > 6 && bg_clip_mode < 9 && (sx1==240 || sx1==0)) bg_clip_mode = -10; - - if (sy1!=240 && sy1!=0 && bg_clip_mode<=0) - { - if (sy1 > 128) - bg_clip_mode = 1; - else - bg_clip_mode = 2; - } - - if (sy2!=240 && sy2!=0 && bg_clip_mode<=0) - { - if (sy2 > 128) - bg_clip_mode = 3; - else - bg_clip_mode = 4; - } - - if (sx1!=240 && sx1!=0 && bg_clip_mode<=0 && tile==0x3c) - { - if (sx1 > 128) - bg_clip_mode = 5; - else - bg_clip_mode = 6; - } - - if (sx1!=240 && sx1!=0 && bg_clip_mode<=0 && tile==0x1c) - { - if (sx1 > 128) - bg_clip_mode = 7; - else - bg_clip_mode = 8; - } - - if (bg_clip_mode) - { - if (bg_clip_mode == 1) - clip.min_y = sy1; - else if (bg_clip_mode == 2) - clip.max_y = sy1; - else if (bg_clip_mode == 3) - clip.max_y = sy2; - else if (bg_clip_mode == 4) - clip.min_y = sy2; - else if (bg_clip_mode == 5) - clip.min_x = sx1; - else if (bg_clip_mode == 6) - clip.max_x = sx1; - else if (bg_clip_mode == 7) - clip.max_x = sx1; - else if (bg_clip_mode == 8) - clip.min_x = sx1; - else if (bg_clip_mode == -10) - { - clip.min_x = 0; - clip.min_y = 0; - clip.max_x = 0; - clip.max_y = 0; - } - - fillbitmap(bitmap, get_black_pen(machine), cliprect); - tilemap_draw(bitmap, &clip, bg_tilemap, 0, 0); - } - else - tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); + case 0: case 4: if (sy1_old != sy1) bg_clip_mode++; break; + case 2: case 6: if (sy2_old != sy2) bg_clip_mode++; break; + case 8: case 10: + case 12: case 14: if (sx1_old != sx1) bg_clip_mode++; break; + case 1: case 5: if (sy1 == 0xf0) bg_clip_mode++; break; + case 3: case 7: if (sy2 == 0xf0) bg_clip_mode++; break; + case 9: case 11: if (sx1 == 0xf0) bg_clip_mode++; break; + case 13: case 15: if (sx1_old == 0xf0) bg_clip_mode++; + case 16: if (sy1 != 0x00) bg_clip_mode = 0; break; + } + + switch (bg_clip_mode) + { + case 0: case 4: case 8: case 12: case 16: + clip.min_x = clip.max_x = clip.min_y = clip.max_y = 0; + break; + case 1: clip.min_y = sy1; break; + case 3: clip.max_y = sy2; break; + case 5: clip.max_y = sy1; break; + case 7: clip.min_y = sy2; break; + case 9: case 15: clip.min_x = sx1; break; + case 11: case 13: clip.max_x = sx1; break; + } + + if (flip_screen_get()) + { + int min_x,max_x,min_y,max_y; + min_x = 255 - clip.max_x; + max_x = 255 - clip.min_x; + min_y = 255 - clip.max_y; + max_y = 255 - clip.min_y; + clip.min_x = min_x; + clip.max_x = max_x; + clip.min_y = min_y; + clip.max_y = max_y; } - else - tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); } - else - fillbitmap(bitmap, get_black_pen(machine), cliprect); + + tilemap_draw(bitmap, &clip, bg_tilemap, 0, 0); } VIDEO_UPDATE( psychic5 ) { - draw_background(screen->machine, bitmap, cliprect); + fillbitmap(bitmap, get_black_pen(screen->machine), cliprect); + if (psychic5_bg_status & 1) /* Backgound enable */ + draw_background(screen->machine, bitmap, cliprect); + if (!(title_screen & 1)) + draw_sprites(screen->machine, bitmap, cliprect); + tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0); + return 0; +} + +VIDEO_UPDATE( bombsa ) +{ + if (psychic5_bg_status & 1) /* Backgound enable */ + tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0); + else + fillbitmap(bitmap, screen->machine->pens[0x0ff], cliprect); draw_sprites(screen->machine, bitmap, cliprect); tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0); return 0; -- cgit v1.2.3