From 1a97eae623551afc48ca474c192b817c900ad18b Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Fri, 29 Jul 2022 14:13:15 +0200 Subject: darkseal.cpp, sidepckt.cpp: consolidated drivers in single files, other small cleanups --- src/mame/dataeast/darkseal.cpp | 318 +++++++++++++++++++--------- src/mame/dataeast/darkseal.h | 63 ------ src/mame/dataeast/darkseal_v.cpp | 78 ------- src/mame/dataeast/sidepckt.cpp | 446 ++++++++++++++++++++++++++++++--------- src/mame/dataeast/sidepckt.h | 87 -------- src/mame/dataeast/sidepckt_v.cpp | 164 -------------- src/mame/samsung/dvd-n5xx.cpp | 2 +- 7 files changed, 571 insertions(+), 587 deletions(-) delete mode 100644 src/mame/dataeast/darkseal.h delete mode 100644 src/mame/dataeast/darkseal_v.cpp delete mode 100644 src/mame/dataeast/sidepckt.h delete mode 100644 src/mame/dataeast/sidepckt_v.cpp diff --git a/src/mame/dataeast/darkseal.cpp b/src/mame/dataeast/darkseal.cpp index 45e0d17313e..2e12c914cac 100644 --- a/src/mame/dataeast/darkseal.cpp +++ b/src/mame/dataeast/darkseal.cpp @@ -18,17 +18,143 @@ ***************************************************************************/ #include "emu.h" -#include "darkseal.h" -#include "cpu/m68000/m68000.h" +#include "deco16ic.h" +#include "decospr.h" + #include "cpu/h6280/h6280.h" +#include "cpu/m68000/m68000.h" +#include "machine/gen_latch.h" #include "sound/okim6295.h" #include "sound/ymopm.h" #include "sound/ymopn.h" +#include "video/bufsprite.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +namespace { + +class darkseal_state : public driver_device +{ +public: + darkseal_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_audiocpu(*this, "audiocpu") + , m_palette(*this, "colors") + , m_deco_tilegen(*this, "tilegen%u", 1U) + , m_sprgen(*this, "spritegen") + , m_spriteram(*this, "spriteram") + , m_soundlatch(*this, "soundlatch") + , m_pf1_rowscroll(*this, "pf1_rowscroll") + , m_pf3_rowscroll(*this, "pf3_rowscroll") + , m_paletteram(*this, "palette") + , m_paletteram_ext(*this, "palette_ext") + { } + + void darkseal(machine_config &config); + + virtual void driver_init() override; + +private: + void irq_ack_w(uint16_t data); + void palette_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + void palette_ext_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void update_palette(int offset); + void main_map(address_map &map); + void sound_map(address_map &map); + + required_device m_maincpu; + required_device m_audiocpu; + required_device m_palette; + required_device_array m_deco_tilegen; + required_device m_sprgen; + required_device m_spriteram; + required_device m_soundlatch; + + required_shared_ptr m_pf1_rowscroll; + required_shared_ptr m_pf3_rowscroll; + required_shared_ptr m_paletteram; + required_shared_ptr m_paletteram_ext; +}; + + +// video + + +/************************************************************************** + + uses 2x DECO55 tilemaps + + Sprite/Tilemap Priority Note (is this implemented?) + + Word 4: + Mask 0x8000 - ? + Mask 0x4000 - Sprite is drawn beneath top 8 pens of playfield 4 + Mask 0x3e00 - Colour (32 palettes, most games only use 16) + Mask 0x01ff - X coordinate + +***************************************************************************/ + + +/******************************************************************************/ + +void darkseal_state::update_palette(int offset) +{ + // TODO : Values aren't written in game when higher than 0xf0, + // It's related to hardware colour resistors? + int const r = (m_paletteram[offset] >> 0) & 0xff; + int const g = (m_paletteram[offset] >> 8) & 0xff; + int const b = (m_paletteram_ext[offset] >> 0) & 0xff; + + m_palette->set_pen_color(offset,rgb_t(r, g, b)); +} + +void darkseal_state::palette_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_paletteram[offset]); + update_palette(offset); +} + +void darkseal_state::palette_ext_w(offs_t offset, uint16_t data, uint16_t mem_mask) +{ + COMBINE_DATA(&m_paletteram_ext[offset]); + update_palette(offset); +} + +/******************************************************************************/ + +uint32_t darkseal_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + uint16_t flip = m_deco_tilegen[1]->pf_control_r(0); + flip_screen_set(!BIT(flip, 7)); + m_sprgen->set_flip_screen(!BIT(flip, 7)); + + bitmap.fill(m_palette->black_pen(), cliprect); + + m_deco_tilegen[0]->pf_update(m_pf1_rowscroll, m_pf1_rowscroll); + m_deco_tilegen[1]->pf_update(m_pf3_rowscroll, m_pf3_rowscroll); + + m_deco_tilegen[1]->tilemap_1_draw(screen, bitmap, cliprect, 0, 0); + m_deco_tilegen[1]->tilemap_2_draw(screen, bitmap, cliprect, 0, 0); + + m_deco_tilegen[0]->tilemap_1_draw(screen, bitmap, cliprect, 0, 0); + m_sprgen->draw_sprites(bitmap, cliprect, m_spriteram->buffer(), 0x400); + m_deco_tilegen[0]->tilemap_2_draw(screen, bitmap, cliprect, 0, 0); + + return 0; +} + +/******************************************************************************/ + + +// machine + /******************************************************************************/ void darkseal_state::irq_ack_w(uint16_t data) @@ -38,13 +164,13 @@ void darkseal_state::irq_ack_w(uint16_t data) /******************************************************************************/ -void darkseal_state::darkseal_map(address_map &map) +void darkseal_state::main_map(address_map &map) { map(0x000000, 0x07ffff).rom(); map(0x100000, 0x103fff).ram(); map(0x120000, 0x1207ff).ram().share("spriteram"); - map(0x140000, 0x140fff).ram().w(FUNC(darkseal_state::palette_w)).share("palette"); - map(0x141000, 0x141fff).ram().w(FUNC(darkseal_state::palette_ext_w)).share("palette_ext"); + map(0x140000, 0x140fff).ram().w(FUNC(darkseal_state::palette_w)).share(m_paletteram); + map(0x141000, 0x141fff).ram().w(FUNC(darkseal_state::palette_ext_w)).share(m_paletteram_ext); map(0x180000, 0x180001).portr("DSW"); map(0x180002, 0x180003).portr("P1_P2"); map(0x180004, 0x180005).portr("SYSTEM"); @@ -88,7 +214,7 @@ static INPUT_PORTS_START( darkseal ) PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) - PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) /* button 3 - unused */ + PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNUSED ) // button 3 - unused PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) @@ -97,7 +223,7 @@ static INPUT_PORTS_START( darkseal ) PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) - PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) /* button 3 - unused */ + PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED ) // button 3 - unused PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_START2 ) PORT_START("SYSTEM") @@ -132,7 +258,7 @@ static INPUT_PORTS_START( darkseal ) PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:7") PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "SW1:8" ) /* Manual says 'Always OFF' */ + PORT_DIPUNUSED_DIPLOC( 0x0080, 0x0080, "SW1:8" ) // Manual says 'Always OFF' PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2") PORT_DIPSETTING( 0x0000, "1" ) @@ -161,13 +287,13 @@ INPUT_PORTS_END static const gfx_layout charlayout = { - 8,8, /* 8*8 chars */ + 8,8, // 8*8 chars RGN_FRAC(1,2), - 4, /* 4 bits per pixel */ + 4, // 4 bits per pixel { 8, 0, RGN_FRAC(1,2)+8, RGN_FRAC(1,2) }, { STEP8(0,1) }, { STEP8(0,8*2) }, - 8*8*2 /* every char takes 8 consecutive bytes */ + 8*8*2 // every char takes 8 consecutive bytes }; static const gfx_layout seallayout = @@ -182,27 +308,27 @@ static const gfx_layout seallayout = }; static GFXDECODE_START( gfx_darkseal ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 16 ) /* Characters 8x8 */ - GFXDECODE_ENTRY( "gfx2", 0, seallayout, 768, 16 ) /* Tiles 16x16 */ - GFXDECODE_ENTRY( "gfx3", 0, seallayout, 1024, 16 ) /* Tiles 16x16 */ - GFXDECODE_ENTRY( "gfx4", 0, seallayout, 256, 32 ) /* Sprites 16x16 */ + GFXDECODE_ENTRY( "chars", 0, charlayout, 0, 16 ) // 8x8 + GFXDECODE_ENTRY( "tiles1", 0, seallayout, 768, 16 ) // 16x16 + GFXDECODE_ENTRY( "tiles2", 0, seallayout, 1024, 16 ) // 16x16 + GFXDECODE_ENTRY( "sprites", 0, seallayout, 256, 32 ) // 16x16 GFXDECODE_END /******************************************************************************/ void darkseal_state::darkseal(machine_config &config) { - /* basic machine hardware */ - M68000(config, m_maincpu, XTAL(24'000'000)/2); /* Custom chip 59 */ - m_maincpu->set_addrmap(AS_PROGRAM, &darkseal_state::darkseal_map); - m_maincpu->set_vblank_int("screen", FUNC(darkseal_state::irq6_line_assert)); /* VBL */ + // basic machine hardware + M68000(config, m_maincpu, XTAL(24'000'000) / 2); // Custom chip 59 + m_maincpu->set_addrmap(AS_PROGRAM, &darkseal_state::main_map); + m_maincpu->set_vblank_int("screen", FUNC(darkseal_state::irq6_line_assert)); // VBL - H6280(config, m_audiocpu, XTAL(32'220'000)/4); /* Custom chip 45, Audio section crystal is 32.220 MHz */ + H6280(config, m_audiocpu, XTAL(32'220'000) / 4); // Custom chip 45, Audio section crystal is 32.220 MHz m_audiocpu->set_addrmap(AS_PROGRAM, &darkseal_state::sound_map); m_audiocpu->add_route(ALL_OUTPUTS, "mono", 0); // internal sound unused m_audiocpu->set_timer_scale(2); - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); screen.set_refresh_hz(58); screen.set_vblank_time(ATTOSECONDS_IN_USEC(529)); @@ -242,195 +368,197 @@ void darkseal_state::darkseal(machine_config &config) m_sprgen->set_gfx_region(3); m_sprgen->set_gfxdecode_tag("gfxdecode"); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch); m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, 0); - YM2203(config, "ym1", XTAL(32'220'000)/8).add_route(ALL_OUTPUTS, "mono", 0.45); + YM2203(config, "ym1", XTAL(32'220'000) / 8).add_route(ALL_OUTPUTS, "mono", 0.45); - ym2151_device &ym2(YM2151(config, "ym2", XTAL(32'220'000)/9)); + ym2151_device &ym2(YM2151(config, "ym2", XTAL(32'220'000) / 9)); ym2.irq_handler().set_inputline(m_audiocpu, 1); // IRQ2 ym2.add_route(0, "mono", 0.55); ym2.add_route(1, "mono", 0.55); - OKIM6295(config, "oki1", XTAL(32'220'000)/32, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 1.0); + OKIM6295(config, "oki1", XTAL(32'220'000) / 32, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 1.0); - OKIM6295(config, "oki2", XTAL(32'220'000)/16, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 0.60); + OKIM6295(config, "oki2", XTAL(32'220'000) / 16, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 0.60); } /******************************************************************************/ ROM_START( darkseal ) - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 code */ + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "ga_04-3.j12", 0x00000, 0x20000, CRC(bafad556) SHA1(5bd8a787d41a33919701ced29212bc11301e31d9) ) ROM_LOAD16_BYTE( "ga_01-3.h14", 0x00001, 0x20000, CRC(f409050e) SHA1(4653094aeb5dd7ba1e490c04897a23ba8990df3c) ) ROM_LOAD16_BYTE( "ga_00.h12", 0x40000, 0x20000, CRC(fbf3ac63) SHA1(51af581ee951eedeb4aa413ecbebe8bf4d30613b) ) ROM_LOAD16_BYTE( "ga_05.j14", 0x40001, 0x20000, CRC(d5e3ae3f) SHA1(12f6e92af115422c6ab6ef1d33675d1e1cd58e10) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "fz_06-1.j15", 0x00000, 0x10000, CRC(c4828a6d) SHA1(fbfd0c85730bbe18401879cd68c19aaec9d482d8) ) - ROM_REGION( 0x020000, "gfx1", 0 ) - ROM_LOAD16_BYTE( "fz_02.j1", 0x000001, 0x10000, CRC(3c9c3012) SHA1(086c2123725d4aa32838c0b6c82317d9c789c465) ) /* chars */ + ROM_REGION( 0x020000, "chars", 0 ) + ROM_LOAD16_BYTE( "fz_02.j1", 0x000001, 0x10000, CRC(3c9c3012) SHA1(086c2123725d4aa32838c0b6c82317d9c789c465) ) ROM_LOAD16_BYTE( "fz_03.j2", 0x000000, 0x10000, CRC(264b90ed) SHA1(0bb1557673107c2d732a9374d5601a6eaf229473) ) - ROM_REGION( 0x080000, "gfx2", 0 ) - ROM_LOAD( "mac-03.h3", 0x000000, 0x80000, CRC(9996f3dc) SHA1(fffd9ecfe142a0c7c3c9c521778ff9c55ea8b225) ) /* tiles 1 */ + ROM_REGION( 0x080000, "tiles1", 0 ) + ROM_LOAD( "mac-03.h3", 0x000000, 0x80000, CRC(9996f3dc) SHA1(fffd9ecfe142a0c7c3c9c521778ff9c55ea8b225) ) - ROM_REGION( 0x080000, "gfx3", 0 ) - ROM_LOAD( "mac-02.e20", 0x000000, 0x80000, CRC(49504e89) SHA1(6da4733a650b9040abb2a81a49476368b514b5ab) ) /* tiles 2 */ + ROM_REGION( 0x080000, "tiles2", 0 ) + ROM_LOAD( "mac-02.e20", 0x000000, 0x80000, CRC(49504e89) SHA1(6da4733a650b9040abb2a81a49476368b514b5ab) ) - ROM_REGION( 0x100000, "gfx4", 0 ) - ROM_LOAD( "mac-00.b1", 0x000000, 0x80000, CRC(52acf1d6) SHA1(a7b68782417baafc86371b106fd31c5317f5b3d8) ) /* sprites */ + ROM_REGION( 0x100000, "sprites", 0 ) + ROM_LOAD( "mac-00.b1", 0x000000, 0x80000, CRC(52acf1d6) SHA1(a7b68782417baafc86371b106fd31c5317f5b3d8) ) ROM_LOAD( "mac-01.b3", 0x080000, 0x80000, CRC(b28f7584) SHA1(e02ddd45130a7b50f80b6dd049059dba8071d768) ) - ROM_REGION( 0x40000, "oki1", 0 ) /* ADPCM samples */ + ROM_REGION( 0x40000, "oki1", 0 ) ROM_LOAD( "fz_08.l17", 0x00000, 0x20000, CRC(c9bf68e1) SHA1(c81e2534a814fe44c8787946a9fbe18f1743c3b4) ) - ROM_REGION( 0x40000, "oki2", 0 ) /* ADPCM samples */ + ROM_REGION( 0x40000, "oki2", 0 ) ROM_LOAD( "fz_07.k14", 0x00000, 0x20000, CRC(588dd3cb) SHA1(16c4e7670a4967768ddbfd52939d4e6e42268441) ) ROM_END ROM_START( darkseal1 ) - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 code */ + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "fz_04-4.j12", 0x00000, 0x20000, CRC(a1a985a9) SHA1(eac3f43ff4016dcc21fe34b6bfed36e0d4b86959) ) // sldh w/darksealj ROM_LOAD16_BYTE( "fz_01-1.h14", 0x00001, 0x20000, CRC(98bd2940) SHA1(88ac727c3797e646834266320a71aa159e2b2541) ) ROM_LOAD16_BYTE( "fz_00-2.h12", 0x40000, 0x20000, CRC(fbf3ac63) SHA1(51af581ee951eedeb4aa413ecbebe8bf4d30613b) ) // sldh w/darksealj ROM_LOAD16_BYTE( "fz_05-2.j14", 0x40001, 0x20000, CRC(d5e3ae3f) SHA1(12f6e92af115422c6ab6ef1d33675d1e1cd58e10) ) // sldh w/darksealj - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "fz_06-1.j15", 0x00000, 0x10000, CRC(c4828a6d) SHA1(fbfd0c85730bbe18401879cd68c19aaec9d482d8) ) - ROM_REGION( 0x020000, "gfx1", 0 ) - ROM_LOAD16_BYTE( "fz_02-1.j1", 0x000001, 0x10000, CRC(3c9c3012) SHA1(086c2123725d4aa32838c0b6c82317d9c789c465) ) /* chars */ + ROM_REGION( 0x020000, "chars", 0 ) + ROM_LOAD16_BYTE( "fz_02-1.j1", 0x000001, 0x10000, CRC(3c9c3012) SHA1(086c2123725d4aa32838c0b6c82317d9c789c465) ) ROM_LOAD16_BYTE( "fz_03-1.j2", 0x000000, 0x10000, CRC(264b90ed) SHA1(0bb1557673107c2d732a9374d5601a6eaf229473) ) - ROM_REGION( 0x080000, "gfx2", 0 ) - ROM_LOAD( "mac-03.h3", 0x000000, 0x80000, CRC(9996f3dc) SHA1(fffd9ecfe142a0c7c3c9c521778ff9c55ea8b225) ) /* tiles 1 */ + ROM_REGION( 0x080000, "tiles1", 0 ) + ROM_LOAD( "mac-03.h3", 0x000000, 0x80000, CRC(9996f3dc) SHA1(fffd9ecfe142a0c7c3c9c521778ff9c55ea8b225) ) - ROM_REGION( 0x080000, "gfx3", 0 ) - ROM_LOAD( "mac-02.e20", 0x000000, 0x80000, CRC(49504e89) SHA1(6da4733a650b9040abb2a81a49476368b514b5ab) ) /* tiles 2 */ + ROM_REGION( 0x080000, "tiles2", 0 ) + ROM_LOAD( "mac-02.e20", 0x000000, 0x80000, CRC(49504e89) SHA1(6da4733a650b9040abb2a81a49476368b514b5ab) ) - ROM_REGION( 0x100000, "gfx4", 0 ) - ROM_LOAD( "mac-00.b1", 0x000000, 0x80000, CRC(52acf1d6) SHA1(a7b68782417baafc86371b106fd31c5317f5b3d8) ) /* sprites */ + ROM_REGION( 0x100000, "sprites", 0 ) + ROM_LOAD( "mac-00.b1", 0x000000, 0x80000, CRC(52acf1d6) SHA1(a7b68782417baafc86371b106fd31c5317f5b3d8) ) ROM_LOAD( "mac-01.b3", 0x080000, 0x80000, CRC(b28f7584) SHA1(e02ddd45130a7b50f80b6dd049059dba8071d768) ) - ROM_REGION( 0x40000, "oki1", 0 ) /* ADPCM samples */ + ROM_REGION( 0x40000, "oki1", 0 ) ROM_LOAD( "fz_08-1.k17", 0x00000, 0x20000, CRC(c9bf68e1) SHA1(c81e2534a814fe44c8787946a9fbe18f1743c3b4) ) - ROM_REGION( 0x40000, "oki2", 0 ) /* ADPCM samples */ + ROM_REGION( 0x40000, "oki2", 0 ) ROM_LOAD( "fz_07-.k14", 0x00000, 0x20000, CRC(588dd3cb) SHA1(16c4e7670a4967768ddbfd52939d4e6e42268441) ) ROM_END ROM_START( darksealj ) - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 code */ + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "fz_04-4.j12", 0x00000, 0x20000, CRC(817faa2c) SHA1(8a79703f0e3aeb2ceeb098466561ab604baef301) ) // sldh w/darkseal1 ROM_LOAD16_BYTE( "fz_01-4.h14", 0x00001, 0x20000, CRC(373caeee) SHA1(5cfa0c7672c439e9d011d9ec93da32c2377dce19) ) ROM_LOAD16_BYTE( "fz_00-2.h12", 0x40000, 0x20000, CRC(1ab99aa7) SHA1(1da51f3ee0d15094911d4090264b945090d51242) ) // sldh w/darkseal1 ROM_LOAD16_BYTE( "fz_05-2.j14", 0x40001, 0x20000, CRC(3374ef8c) SHA1(4144e71e452e281078bcd9b9a996db9f5dccc346) ) // sldh w/darkseal1 - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "fz_06-1.j15", 0x00000, 0x10000, CRC(c4828a6d) SHA1(fbfd0c85730bbe18401879cd68c19aaec9d482d8) ) - ROM_REGION( 0x020000, "gfx1", 0 ) - ROM_LOAD16_BYTE( "fz_02.j1", 0x000001, 0x10000, CRC(3c9c3012) SHA1(086c2123725d4aa32838c0b6c82317d9c789c465) ) /* chars */ + ROM_REGION( 0x020000, "chars", 0 ) + ROM_LOAD16_BYTE( "fz_02.j1", 0x000001, 0x10000, CRC(3c9c3012) SHA1(086c2123725d4aa32838c0b6c82317d9c789c465) ) ROM_LOAD16_BYTE( "fz_03.j2", 0x000000, 0x10000, CRC(264b90ed) SHA1(0bb1557673107c2d732a9374d5601a6eaf229473) ) - ROM_REGION( 0x080000, "gfx2", 0 ) - ROM_LOAD( "mac-03.h3", 0x000000, 0x80000, CRC(9996f3dc) SHA1(fffd9ecfe142a0c7c3c9c521778ff9c55ea8b225) ) /* tiles 1 */ + ROM_REGION( 0x080000, "tiles1", 0 ) + ROM_LOAD( "mac-03.h3", 0x000000, 0x80000, CRC(9996f3dc) SHA1(fffd9ecfe142a0c7c3c9c521778ff9c55ea8b225) ) - ROM_REGION( 0x080000, "gfx3", 0 ) - ROM_LOAD( "mac-02.e20", 0x000000, 0x80000, CRC(49504e89) SHA1(6da4733a650b9040abb2a81a49476368b514b5ab) ) /* tiles 2 */ + ROM_REGION( 0x080000, "tiles2", 0 ) + ROM_LOAD( "mac-02.e20", 0x000000, 0x80000, CRC(49504e89) SHA1(6da4733a650b9040abb2a81a49476368b514b5ab) ) - ROM_REGION( 0x100000, "gfx4", 0 ) - ROM_LOAD( "mac-00.b1", 0x000000, 0x80000, CRC(52acf1d6) SHA1(a7b68782417baafc86371b106fd31c5317f5b3d8) ) /* sprites */ + ROM_REGION( 0x100000, "sprites", 0 ) + ROM_LOAD( "mac-00.b1", 0x000000, 0x80000, CRC(52acf1d6) SHA1(a7b68782417baafc86371b106fd31c5317f5b3d8) ) ROM_LOAD( "mac-01.b3", 0x080000, 0x80000, CRC(b28f7584) SHA1(e02ddd45130a7b50f80b6dd049059dba8071d768) ) - ROM_REGION( 0x40000, "oki1", 0 ) /* ADPCM samples */ + ROM_REGION( 0x40000, "oki1", 0 ) ROM_LOAD( "fz_08.l17", 0x00000, 0x20000, CRC(c9bf68e1) SHA1(c81e2534a814fe44c8787946a9fbe18f1743c3b4) ) - ROM_REGION( 0x40000, "oki2", 0 ) /* ADPCM samples */ + ROM_REGION( 0x40000, "oki2", 0 ) ROM_LOAD( "fz_07.k14", 0x00000, 0x20000, CRC(588dd3cb) SHA1(16c4e7670a4967768ddbfd52939d4e6e42268441) ) ROM_END ROM_START( gatedoom ) - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 code */ + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "gb_04-4.j12", 0x00000, 0x20000, CRC(8e3a0bfd) SHA1(1d20bd678a630e2006c7f50f4d13656136db3721) ) ROM_LOAD16_BYTE( "gb_01-4.h14", 0x00001, 0x20000, CRC(8d0fd383) SHA1(797e3cf43c9315b4195232eb1787a2292af4901b) ) ROM_LOAD16_BYTE( "gb_00.h12", 0x40000, 0x20000, CRC(a88c16a1) SHA1(e02d5470692f23afa658b9bda933bb20be64602f) ) ROM_LOAD16_BYTE( "gb_05.j14", 0x40001, 0x20000, CRC(252d7e14) SHA1(b2f27cd9686dfc697f3faca74d20b298a59efab2) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "fz_06-1.j15", 0x00000, 0x10000, CRC(c4828a6d) SHA1(fbfd0c85730bbe18401879cd68c19aaec9d482d8) ) - ROM_REGION( 0x020000, "gfx1", 0 ) - ROM_LOAD16_BYTE( "fz_02.j1", 0x000001, 0x10000, CRC(3c9c3012) SHA1(086c2123725d4aa32838c0b6c82317d9c789c465) ) /* chars */ + ROM_REGION( 0x020000, "chars", 0 ) + ROM_LOAD16_BYTE( "fz_02.j1", 0x000001, 0x10000, CRC(3c9c3012) SHA1(086c2123725d4aa32838c0b6c82317d9c789c465) ) ROM_LOAD16_BYTE( "fz_03.j2", 0x000000, 0x10000, CRC(264b90ed) SHA1(0bb1557673107c2d732a9374d5601a6eaf229473) ) - ROM_REGION( 0x080000, "gfx2", 0 ) - ROM_LOAD( "mac-03.h3", 0x000000, 0x80000, CRC(9996f3dc) SHA1(fffd9ecfe142a0c7c3c9c521778ff9c55ea8b225) ) /* tiles 1 */ + ROM_REGION( 0x080000, "tiles1", 0 ) + ROM_LOAD( "mac-03.h3", 0x000000, 0x80000, CRC(9996f3dc) SHA1(fffd9ecfe142a0c7c3c9c521778ff9c55ea8b225) ) - ROM_REGION( 0x080000, "gfx3", 0 ) - ROM_LOAD( "mac-02.e20", 0x000000, 0x80000, CRC(49504e89) SHA1(6da4733a650b9040abb2a81a49476368b514b5ab) ) /* tiles 2 */ + ROM_REGION( 0x080000, "tiles2", 0 ) + ROM_LOAD( "mac-02.e20", 0x000000, 0x80000, CRC(49504e89) SHA1(6da4733a650b9040abb2a81a49476368b514b5ab) ) - ROM_REGION( 0x100000, "gfx4", 0 ) - ROM_LOAD( "mac-00.b1", 0x000000, 0x80000, CRC(52acf1d6) SHA1(a7b68782417baafc86371b106fd31c5317f5b3d8) ) /* sprites */ + ROM_REGION( 0x100000, "sprites", 0 ) + ROM_LOAD( "mac-00.b1", 0x000000, 0x80000, CRC(52acf1d6) SHA1(a7b68782417baafc86371b106fd31c5317f5b3d8) ) ROM_LOAD( "mac-01.b3", 0x080000, 0x80000, CRC(b28f7584) SHA1(e02ddd45130a7b50f80b6dd049059dba8071d768) ) - ROM_REGION( 0x40000, "oki1", 0 ) /* ADPCM samples */ + ROM_REGION( 0x40000, "oki1", 0 ) ROM_LOAD( "fz_08.l17", 0x00000, 0x20000, CRC(c9bf68e1) SHA1(c81e2534a814fe44c8787946a9fbe18f1743c3b4) ) - ROM_REGION( 0x40000, "oki2", 0 ) /* ADPCM samples */ + ROM_REGION( 0x40000, "oki2", 0 ) ROM_LOAD( "fz_07.k14", 0x00000, 0x20000, CRC(588dd3cb) SHA1(16c4e7670a4967768ddbfd52939d4e6e42268441) ) ROM_END ROM_START( gatedoom1 ) - ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 code */ + ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code ROM_LOAD16_BYTE( "gb_04.j12", 0x00000, 0x20000, CRC(4c3bbd2b) SHA1(e74a532edd01a559d0c388b37a2ead98c19fe5de) ) ROM_LOAD16_BYTE( "gb_01.h14", 0x00001, 0x20000, CRC(59e367f4) SHA1(f88fa23b8e91f312103eb8a1d9a91d8171ec3ad4) ) ROM_LOAD16_BYTE( "gb_00.h12", 0x40000, 0x20000, CRC(a88c16a1) SHA1(e02d5470692f23afa658b9bda933bb20be64602f) ) ROM_LOAD16_BYTE( "gb_05.j14", 0x40001, 0x20000, CRC(252d7e14) SHA1(b2f27cd9686dfc697f3faca74d20b298a59efab2) ) - ROM_REGION( 0x10000, "audiocpu", 0 ) /* Sound CPU */ + ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "fz_06-1.j15", 0x00000, 0x10000, CRC(c4828a6d) SHA1(fbfd0c85730bbe18401879cd68c19aaec9d482d8) ) - ROM_REGION( 0x020000, "gfx1", 0 ) - ROM_LOAD16_BYTE( "fz_02.j1", 0x000001, 0x10000, CRC(3c9c3012) SHA1(086c2123725d4aa32838c0b6c82317d9c789c465) ) /* chars */ + ROM_REGION( 0x020000, "chars", 0 ) + ROM_LOAD16_BYTE( "fz_02.j1", 0x000001, 0x10000, CRC(3c9c3012) SHA1(086c2123725d4aa32838c0b6c82317d9c789c465) ) ROM_LOAD16_BYTE( "fz_03.j2", 0x000000, 0x10000, CRC(264b90ed) SHA1(0bb1557673107c2d732a9374d5601a6eaf229473) ) - ROM_REGION( 0x080000, "gfx2", 0 ) - ROM_LOAD( "mac-03.h3", 0x000000, 0x80000, CRC(9996f3dc) SHA1(fffd9ecfe142a0c7c3c9c521778ff9c55ea8b225) ) /* tiles 1 */ + ROM_REGION( 0x080000, "tiles1", 0 ) + ROM_LOAD( "mac-03.h3", 0x000000, 0x80000, CRC(9996f3dc) SHA1(fffd9ecfe142a0c7c3c9c521778ff9c55ea8b225) ) - ROM_REGION( 0x080000, "gfx3", 0 ) - ROM_LOAD( "mac-02.e20", 0x000000, 0x80000, CRC(49504e89) SHA1(6da4733a650b9040abb2a81a49476368b514b5ab) ) /* tiles 2 */ + ROM_REGION( 0x080000, "tiles2", 0 ) + ROM_LOAD( "mac-02.e20", 0x000000, 0x80000, CRC(49504e89) SHA1(6da4733a650b9040abb2a81a49476368b514b5ab) ) - ROM_REGION( 0x100000, "gfx4", 0 ) - ROM_LOAD( "mac-00.b1", 0x000000, 0x80000, CRC(52acf1d6) SHA1(a7b68782417baafc86371b106fd31c5317f5b3d8) ) /* sprites */ + ROM_REGION( 0x100000, "sprites", 0 ) + ROM_LOAD( "mac-00.b1", 0x000000, 0x80000, CRC(52acf1d6) SHA1(a7b68782417baafc86371b106fd31c5317f5b3d8) ) ROM_LOAD( "mac-01.b3", 0x080000, 0x80000, CRC(b28f7584) SHA1(e02ddd45130a7b50f80b6dd049059dba8071d768) ) - ROM_REGION( 0x40000, "oki1", 0 ) /* ADPCM samples */ + ROM_REGION( 0x40000, "oki1", 0 ) ROM_LOAD( "fz_08.l17", 0x00000, 0x20000, CRC(c9bf68e1) SHA1(c81e2534a814fe44c8787946a9fbe18f1743c3b4) ) - ROM_REGION( 0x40000, "oki2", 0 ) /* ADPCM samples */ + ROM_REGION( 0x40000, "oki2", 0 ) ROM_LOAD( "fz_07.k14", 0x00000, 0x20000, CRC(588dd3cb) SHA1(16c4e7670a4967768ddbfd52939d4e6e42268441) ) ROM_END /******************************************************************************/ -void darkseal_state::init_darkseal() +void darkseal_state::driver_init() { - uint8_t *RAM = memregion("maincpu")->base(); + uint8_t *rom = memregion("maincpu")->base(); for (int i = 0x00000; i < 0x80000; i++) - RAM[i]=(RAM[i] & 0xbd) | ((RAM[i] & 0x02) << 5) | ((RAM[i] & 0x40) >> 5); - + rom[i]=(rom[i] & 0xbd) | ((rom[i] & 0x02) << 5) | ((rom[i] & 0x40) >> 5); } /******************************************************************************/ -GAME( 1990, darkseal, 0, darkseal, darkseal, darkseal_state, init_darkseal, ROT0, "Data East Corporation", "Dark Seal (World revision 3)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, darkseal1, darkseal, darkseal, darkseal, darkseal_state, init_darkseal, ROT0, "Data East Corporation", "Dark Seal (World revision 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, darksealj, darkseal, darkseal, darkseal, darkseal_state, init_darkseal, ROT0, "Data East Corporation", "Dark Seal (Japan revision 4)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, gatedoom, darkseal, darkseal, darkseal, darkseal_state, init_darkseal, ROT0, "Data East Corporation", "Gate of Doom (US revision 4)", MACHINE_SUPPORTS_SAVE ) -GAME( 1990, gatedoom1, darkseal, darkseal, darkseal, darkseal_state, init_darkseal, ROT0, "Data East Corporation", "Gate of Doom (US revision 1)", MACHINE_SUPPORTS_SAVE ) +} // anonymous namespace + + +GAME( 1990, darkseal, 0, darkseal, darkseal, darkseal_state, driver_init, ROT0, "Data East Corporation", "Dark Seal (World revision 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, darkseal1, darkseal, darkseal, darkseal, darkseal_state, driver_init, ROT0, "Data East Corporation", "Dark Seal (World revision 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, darksealj, darkseal, darkseal, darkseal, darkseal_state, driver_init, ROT0, "Data East Corporation", "Dark Seal (Japan revision 4)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, gatedoom, darkseal, darkseal, darkseal, darkseal_state, driver_init, ROT0, "Data East Corporation", "Gate of Doom (US revision 4)", MACHINE_SUPPORTS_SAVE ) +GAME( 1990, gatedoom1, darkseal, darkseal, darkseal, darkseal_state, driver_init, ROT0, "Data East Corporation", "Gate of Doom (US revision 1)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/dataeast/darkseal.h b/src/mame/dataeast/darkseal.h deleted file mode 100644 index e14bc07aa7e..00000000000 --- a/src/mame/dataeast/darkseal.h +++ /dev/null @@ -1,63 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Bryan McPhail -#ifndef MAME_INCLUDES_DARKSEAL_H -#define MAME_INCLUDES_DARKSEAL_H - -#pragma once - -#include "machine/gen_latch.h" -#include "cpu/h6280/h6280.h" -#include "deco16ic.h" -#include "video/bufsprite.h" -#include "decospr.h" -#include "emupal.h" - -class darkseal_state : public driver_device -{ -public: - darkseal_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) - , m_maincpu(*this, "maincpu") - , m_audiocpu(*this, "audiocpu") - , m_palette(*this, "colors") - , m_deco_tilegen(*this, "tilegen%u", 1U) - , m_sprgen(*this, "spritegen") - , m_spriteram(*this, "spriteram") - , m_soundlatch(*this, "soundlatch") - , m_pf1_rowscroll(*this, "pf1_rowscroll") - , m_pf3_rowscroll(*this, "pf3_rowscroll") - , m_paletteram(*this, "palette") - , m_paletteram_ext(*this, "palette_ext") - { } - - void darkseal(machine_config &config); - - void init_darkseal(); - -private: - void irq_ack_w(uint16_t data); - void palette_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - void palette_ext_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); - - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void update_palette(int offset); - void darkseal_map(address_map &map); - void sound_map(address_map &map); - - required_device m_maincpu; - required_device m_audiocpu; - required_device m_palette; - required_device_array m_deco_tilegen; - required_device m_sprgen; - required_device m_spriteram; - required_device m_soundlatch; - - required_shared_ptr m_pf1_rowscroll; - //uint16_t *m_pf2_rowscroll; - required_shared_ptr m_pf3_rowscroll; - //uint16_t *m_pf4_rowscroll; - required_shared_ptr m_paletteram; - required_shared_ptr m_paletteram_ext; -}; - -#endif // MAME_INCLUDES_DARKSEAL_H diff --git a/src/mame/dataeast/darkseal_v.cpp b/src/mame/dataeast/darkseal_v.cpp deleted file mode 100644 index 7e7b4597e08..00000000000 --- a/src/mame/dataeast/darkseal_v.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Bryan McPhail -/*************************************************************************** - - Dark Seal Video emulation - Bryan McPhail, mish@tendril.co.uk - -**************************************************************************** - - uses 2x DECO55 tilemaps - -************************************************************************** - - Sprite/Tilemap Priority Note (is this implemented?) - - Word 4: - Mask 0x8000 - ? - Mask 0x4000 - Sprite is drawn beneath top 8 pens of playfield 4 - Mask 0x3e00 - Colour (32 palettes, most games only use 16) - Mask 0x01ff - X coordinate - -***************************************************************************/ - -#include "emu.h" -#include "darkseal.h" - -/***************************************************************************/ - -/******************************************************************************/ - -void darkseal_state::update_palette(int offset) -{ - int r,g,b; - - // TODO : Values aren't write in game when higher than 0xf0, - // It's related from hardware colour resistors? - r = (m_paletteram[offset] >> 0) & 0xff; - g = (m_paletteram[offset] >> 8) & 0xff; - b = (m_paletteram_ext[offset] >> 0) & 0xff; - - m_palette->set_pen_color(offset,rgb_t(r,g,b)); -} - -void darkseal_state::palette_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_paletteram[offset]); - update_palette(offset); -} - -void darkseal_state::palette_ext_w(offs_t offset, uint16_t data, uint16_t mem_mask) -{ - COMBINE_DATA(&m_paletteram_ext[offset]); - update_palette(offset); -} - -/******************************************************************************/ - -uint32_t darkseal_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - uint16_t flip = m_deco_tilegen[1]->pf_control_r(0); - flip_screen_set(!BIT(flip, 7)); - m_sprgen->set_flip_screen(!BIT(flip, 7)); - - bitmap.fill(m_palette->black_pen(), cliprect); - - m_deco_tilegen[0]->pf_update(m_pf1_rowscroll, m_pf1_rowscroll); - m_deco_tilegen[1]->pf_update(m_pf3_rowscroll, m_pf3_rowscroll); - - m_deco_tilegen[1]->tilemap_1_draw(screen, bitmap, cliprect, 0, 0); - m_deco_tilegen[1]->tilemap_2_draw(screen, bitmap, cliprect, 0, 0); - - m_deco_tilegen[0]->tilemap_1_draw(screen, bitmap, cliprect, 0, 0); - m_sprgen->draw_sprites(bitmap, cliprect, m_spriteram->buffer(), 0x400); - m_deco_tilegen[0]->tilemap_2_draw(screen, bitmap, cliprect, 0, 0); - - return 0; -} - -/******************************************************************************/ diff --git a/src/mame/dataeast/sidepckt.cpp b/src/mame/dataeast/sidepckt.cpp index 7f13cf481c1..0e082361090 100644 --- a/src/mame/dataeast/sidepckt.cpp +++ b/src/mame/dataeast/sidepckt.cpp @@ -4,7 +4,7 @@ Side Pocket - (c) 1986 Data East -The original board has an 8751 protection mcu +The original board has an 8751 protection MCU Ernesto Corvi ernesto@imagina.com @@ -68,7 +68,7 @@ Stephh's notes (based on the games M6809 code and some tests) : 75DF: D6 0A LDB $0A 75E1: F7 30 0C STB $300C - Surprinsingly, the screen might flip for player 2 after GAME OVER due to original code at 0x4de8 : + Surprisingly, the screen might flip for player 2 after GAME OVER due to original code at 0x4de8 : 4DE8: D6 1A LDB $1A A = 00 for player 1 and 01 for player 2 4DEA: 27 03 BEQ $4DEF @@ -132,46 +132,293 @@ Additional notes: ***************************************************************************/ #include "emu.h" -#include "sidepckt.h" -#include "cpu/m6809/m6809.h" #include "cpu/m6502/m6502.h" -#include "sound/ymopn.h" +#include "cpu/m6809/m6809.h" +#include "cpu/mcs51/mcs51.h" +#include "machine/gen_latch.h" #include "sound/ymopl.h" +#include "sound/ymopn.h" + +#include "emupal.h" #include "screen.h" #include "speaker.h" +#include "tilemap.h" + + +namespace { + +class sidepckt_state : public driver_device +{ +public: + sidepckt_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_audiocpu(*this, "audiocpu"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), + m_soundlatch(*this, "soundlatch"), + m_videoram(*this, "videoram"), + m_colorram(*this, "colorram"), + m_spriteram(*this, "spriteram") + { } + + void sidepcktb(machine_config &config); + +protected: + virtual void machine_reset() override; + virtual void video_start() override; + + void bootleg_main_map(address_map &map); + + required_device m_maincpu; + +private: + required_device m_audiocpu; + required_device m_gfxdecode; + required_device m_palette; + required_device m_soundlatch; + + required_shared_ptr m_videoram; + required_shared_ptr m_colorram; + required_shared_ptr m_spriteram; + + tilemap_t *m_bg_tilemap = nullptr; + + uint8_t m_scroll_y = 0; + + void videoram_w(offs_t offset, uint8_t data); + void colorram_w(offs_t offset, uint8_t data); + uint8_t scroll_y_r(); + void scroll_y_w(uint8_t data); + + TILE_GET_INFO_MEMBER(get_tile_info); + + void palette(palette_device &palette) const; + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); + + void sound_map(address_map &map); +}; + +class sidepckt_mcu_state : public sidepckt_state +{ +public: + sidepckt_mcu_state(const machine_config &mconfig, device_type type, const char *tag) : + sidepckt_state(mconfig, type, tag), + m_mcu(*this, "mcu") + { } + + void sidepckt(machine_config &config); + +protected: + virtual void machine_start() override; + +private: + required_device m_mcu; + + uint8_t m_mcu_p1 = 0; + uint8_t m_mcu_p2 = 0; + uint8_t m_mcu_p3 = 0; + + uint8_t mcu_r(); + void mcu_w(uint8_t data); + + void mcu_p1_w(uint8_t data); + uint8_t mcu_p2_r(); + void mcu_p3_w(uint8_t data); + + void original_main_map(address_map &map); +}; + + +// video + +void sidepckt_state::palette(palette_device &palette) const +{ + uint8_t const *const color_prom = memregion("proms")->base(); + + for (int i = 0; i < palette.entries(); i++) + { + int bit0, bit1, bit2, bit3; + + // red component + bit0 = BIT(color_prom[i], 4); + bit1 = BIT(color_prom[i], 5); + bit2 = BIT(color_prom[i], 6); + bit3 = BIT(color_prom[i], 7); + int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + // green component + bit0 = BIT(color_prom[i], 0); + bit1 = BIT(color_prom[i], 1); + bit2 = BIT(color_prom[i], 2); + bit3 = BIT(color_prom[i], 3); + int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + // blue component + bit0 = BIT(color_prom[i + palette.entries()], 0); + bit1 = BIT(color_prom[i + palette.entries()], 1); + bit2 = BIT(color_prom[i + palette.entries()], 2); + bit3 = BIT(color_prom[i + palette.entries()], 3); + int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; + + palette.set_pen_color(i, rgb_t(r, g, b)); + } +} + + + +/*************************************************************************** + + Callbacks for the TileMap code + +***************************************************************************/ + +TILE_GET_INFO_MEMBER(sidepckt_state::get_tile_info) +{ + uint8_t attr = m_colorram[tile_index]; + tileinfo.set(0, + m_videoram[tile_index] + ((attr & 0x07) << 8), + ((attr & 0x10) >> 3) | ((attr & 0x20) >> 5), + TILE_FLIPX); + tileinfo.group = (attr & 0x80) >> 7; +} + + + +/*************************************************************************** + + Start the video hardware emulation. + +***************************************************************************/ + +void sidepckt_state::video_start() +{ + m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(sidepckt_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 32,32); + + m_bg_tilemap->set_transmask(0, 0xff, 0x00); // split type 0 is totally transparent in front half + m_bg_tilemap->set_transmask(1, 0x01, 0xfe); // split type 1 has pen 0 transparent in front half + + machine().tilemap().set_flip_all(TILEMAP_FLIPX); + + save_item(NAME(m_scroll_y)); +} + +/*************************************************************************** + + Memory handlers + +***************************************************************************/ + +void sidepckt_state::videoram_w(offs_t offset, uint8_t data) +{ + m_videoram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +void sidepckt_state::colorram_w(offs_t offset, uint8_t data) +{ + m_colorram[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +uint8_t sidepckt_state::scroll_y_r() +{ + return m_scroll_y; +} + +void sidepckt_state::scroll_y_w(uint8_t data) +{ + // Bits 0-5: Scroll y + m_scroll_y = data & 0x3f; + + // Other bits: Unknown, but they seem never written + if (data > 0x3f) + logerror ("scroll_y_w: Unknown write -> data = 0x%02X\n", data); +} + + +/*************************************************************************** + + Display refresh + +***************************************************************************/ + +void sidepckt_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) +{ + for (int offs = 0; offs < m_spriteram.bytes(); offs += 4) + { + int const attr = m_spriteram[offs | 1]; + int const code = ((attr & 0x03) << 8) | m_spriteram[offs | 3]; + int const color = (attr & 0xf0) >> 4; + + int const sx = m_spriteram[offs | 2] - 2; + int const sy = m_spriteram[offs]; + + int const flipx = attr & 0x08; + int const flipy = attr & 0x04; + + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code, + color, + flipx, flipy, + sx, sy, 0); + + // wraparound + m_gfxdecode->gfx(1)->transpen(bitmap, cliprect, + code, + color, + flipx, flipy, + sx - 256, sy, 0); + } +} + + +uint32_t sidepckt_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +{ + m_bg_tilemap->set_scrolly(0, m_scroll_y); + + m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); + draw_sprites(bitmap, cliprect); + m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); + return 0; +} + + +// machine + //************************************************************************** // PROTECTION MCU //************************************************************************** -uint8_t sidepckt_state::mcu_r() +uint8_t sidepckt_mcu_state::mcu_r() { return m_mcu_p1; } -void sidepckt_state::mcu_w(uint8_t data) +void sidepckt_mcu_state::mcu_w(uint8_t data) { m_mcu_p2 = data; m_mcu->set_input_line(MCS51_INT0_LINE, ASSERT_LINE); } -void sidepckt_state::mcu_p1_w(uint8_t data) +void sidepckt_mcu_state::mcu_p1_w(uint8_t data) { m_mcu_p1 = data; } -uint8_t sidepckt_state::mcu_p2_r() +uint8_t sidepckt_mcu_state::mcu_p2_r() { return m_mcu_p2; } -void sidepckt_state::mcu_p3_w(uint8_t data) +void sidepckt_mcu_state::mcu_p3_w(uint8_t data) { // 765432-- unused - // ------1- mcu int ack - // -------0 cpu firq + // ------1- MCU int ack + // -------0 CPU firq if (BIT(data, 0) == 0 && BIT(m_mcu_p3, 0) == 1) m_maincpu->set_input_line(M6809_FIRQ_LINE, ASSERT_LINE); @@ -186,14 +433,23 @@ void sidepckt_state::mcu_p3_w(uint8_t data) } +void sidepckt_mcu_state::machine_start() +{ + sidepckt_state::machine_start(); + + save_item(NAME(m_mcu_p1)); + save_item(NAME(m_mcu_p2)); + save_item(NAME(m_mcu_p3)); +} + /******************************************************************************/ -void sidepckt_state::sidepckt_map(address_map &map) +void sidepckt_state::bootleg_main_map(address_map &map) { map(0x0000, 0x0fff).ram(); - map(0x1000, 0x13ff).mirror(0x400).ram().w(FUNC(sidepckt_state::videoram_w)).share("videoram"); - map(0x1800, 0x1bff).mirror(0x400).ram().w(FUNC(sidepckt_state::colorram_w)).share("colorram"); - map(0x2000, 0x20ff).ram().share("spriteram"); + map(0x1000, 0x13ff).mirror(0x400).ram().w(FUNC(sidepckt_state::videoram_w)).share(m_videoram); + map(0x1800, 0x1bff).mirror(0x400).ram().w(FUNC(sidepckt_state::colorram_w)).share(m_colorram); + map(0x2000, 0x20ff).ram().share(m_spriteram); map(0x2100, 0x24ff).nopw(); // ??? (Unused spriteram? The game writes some values at boot, but never read) map(0x3000, 0x3000).portr("P1"); map(0x3001, 0x3001).portr("P2"); @@ -201,16 +457,15 @@ void sidepckt_state::sidepckt_map(address_map &map) map(0x3003, 0x3003).portr("DSW2"); map(0x3004, 0x3004).w(m_soundlatch, FUNC(generic_latch_8_device::write)); map(0x300c, 0x300c).rw(FUNC(sidepckt_state::scroll_y_r), FUNC(sidepckt_state::scroll_y_w)); - map(0x3014, 0x3014).r(FUNC(sidepckt_state::mcu_r)); - map(0x3018, 0x3018).w(FUNC(sidepckt_state::mcu_w)); map(0x4000, 0xffff).rom(); } -void sidepckt_state::sidepcktb_map(address_map &map) +void sidepckt_mcu_state::original_main_map(address_map &map) { - sidepckt_map(map); - map(0x3014, 0x3014).nopr(); - map(0x3018, 0x3018).nopw(); + bootleg_main_map(map); + + map(0x3014, 0x3014).r(FUNC(sidepckt_mcu_state::mcu_r)); + map(0x3018, 0x3018).w(FUNC(sidepckt_mcu_state::mcu_w)); } @@ -226,7 +481,7 @@ void sidepckt_state::sound_map(address_map &map) /******************************************************************************/ -/* verified from M6809 code */ +// verified from M6809 code static INPUT_PORTS_START( sidepckt ) PORT_START("P1") PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY @@ -238,7 +493,7 @@ static INPUT_PORTS_START( sidepckt ) PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 ) - PORT_START("P2") /* see notes */ + PORT_START("P2") // see notes 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_UP ) PORT_8WAY PORT_COCKTAIL @@ -267,26 +522,26 @@ static INPUT_PORTS_START( sidepckt ) PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) PORT_START("DSW2") - PORT_DIPNAME( 0x03, 0x03, "Timer Speed" ) /* table at 0x9d99 */ + PORT_DIPNAME( 0x03, 0x03, "Timer Speed" ) // table at 0x9d99 PORT_DIPSETTING( 0x00, "Stopped (Cheat)") - PORT_DIPSETTING( 0x03, "Slow" ) /* 0x40 - "Normal" in the Dip Switches page */ - PORT_DIPSETTING( 0x02, DEF_STR( Medium ) ) /* 0x30 - "Bit fast" in the Dip Switches page */ - PORT_DIPSETTING( 0x01, "Fast" ) /* 0x20 - "Fast" in the Dip Switches page */ + PORT_DIPSETTING( 0x03, "Slow" ) // 0x40 - "Normal" in the Dip Switches page + PORT_DIPSETTING( 0x02, DEF_STR( Medium ) ) // 0x30 - "Bit fast" in the Dip Switches page + PORT_DIPSETTING( 0x01, "Fast" ) // 0x20 - "Fast" in the Dip Switches page PORT_DIPNAME( 0x0c, 0x08, DEF_STR( Lives ) ) PORT_DIPSETTING( 0x08, "3" ) PORT_DIPSETTING( 0x0c, "6" ) PORT_DIPSETTING( 0x04, "9" ) - PORT_DIPSETTING( 0x00, "Infinite (Cheat)") /* always gives 6 balls */ - PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) ) /* table at 0x40af (4 * 2 words) - see notes */ - PORT_DIPSETTING( 0x30, "10k 60k 50k+" ) /* "10000, after each 50000" in the Dip Switches page */ - PORT_DIPSETTING( 0x20, "20k 70k 50k+" ) /* "20000, after each 70000" in the Dip Switches page */ - PORT_DIPSETTING( 0x10, "30k 80k 50k+" ) /* "30000, after each 100000" in the Dip Switches page */ -// PORT_DIPSETTING( 0x00, "20k 70k 50k+" ) /* "20000" in the Dip Switches page */ + PORT_DIPSETTING( 0x00, "Infinite (Cheat)") // always gives 6 balls + PORT_DIPNAME( 0x30, 0x30, DEF_STR( Bonus_Life ) ) // table at 0x40af (4 * 2 words) - see notes + PORT_DIPSETTING( 0x30, "10k 60k 50k+" ) // "10000, after each 50000" in the Dip Switches page + PORT_DIPSETTING( 0x20, "20k 70k 50k+" ) // "20000, after each 70000" in the Dip Switches page + PORT_DIPSETTING( 0x00, "20k 70k 50k+" ) // "20000" in the Dip Switches page + PORT_DIPSETTING( 0x10, "30k 80k 50k+" ) // "30000, after each 100000" in the Dip Switches page PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_DIPUNUSED( 0x80, IP_ACTIVE_LOW ) INPUT_PORTS_END -/* verified from M6809 code */ +// verified from M6809 code static INPUT_PORTS_START( sidepcktj ) PORT_INCLUDE(sidepckt) @@ -303,50 +558,50 @@ static INPUT_PORTS_START( sidepcktj ) PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) ) INPUT_PORTS_END -/* verified from M6809 code */ +// verified from M6809 code static INPUT_PORTS_START( sidepcktb ) PORT_INCLUDE(sidepckt) PORT_MODIFY("DSW2") PORT_DIPNAME( 0x03, 0x03, "Timer Speed" ) PORT_DIPSETTING( 0x00, "Stopped (Cheat)") - PORT_DIPSETTING( 0x03, DEF_STR( Medium ) ) /* 0x30 */ - PORT_DIPSETTING( 0x02, "Fast" ) /* 0x20 */ - PORT_DIPSETTING( 0x01, "Fastest" ) /* 0x18 */ + PORT_DIPSETTING( 0x03, DEF_STR( Medium ) ) // 0x30 + PORT_DIPSETTING( 0x02, "Fast" ) // 0x20 + PORT_DIPSETTING( 0x01, "Fastest" ) // 0x18 PORT_DIPNAME( 0x0c, 0x08, DEF_STR( Lives ) ) PORT_DIPSETTING( 0x04, "2" ) PORT_DIPSETTING( 0x08, "3" ) PORT_DIPSETTING( 0x0c, "6" ) - PORT_DIPSETTING( 0x00, "Infinite (Cheat)") /* always gives 6 balls */ + PORT_DIPSETTING( 0x00, "Infinite (Cheat)") // always gives 6 balls INPUT_PORTS_END static const gfx_layout charlayout = { - 8,8, /* 8*8 characters */ - 2048, /* 2048 characters */ - 3, /* 3 bits per pixel */ - { 0, 0x8000*8, 0x10000*8 }, /* the bitplanes are separated */ + 8,8, // 8*8 characters + 2048, // 2048 characters + 3, // 3 bits per pixel + { 0, 0x8000*8, 0x10000*8 }, // the bitplanes are separated { 0, 1, 2, 3, 4, 5, 6, 7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 consecutive bytes */ + 8*8 // every char takes 8 consecutive bytes }; static const gfx_layout spritelayout = { - 16,16, /* 16*16 sprites */ - 1024, /* 1024 sprites */ - 3, /* 3 bits per pixel */ - { 0, 0x8000*8, 0x10000*8 }, /* the bitplanes are separated */ + 16,16, // 16*16 sprites + 1024, // 1024 sprites + 3, // 3 bits per pixel + { 0, 0x8000*8, 0x10000*8 }, // the bitplanes are separated { 128+0, 128+1, 128+2, 128+3, 128+4, 128+5, 128+6, 128+7, 0, 1, 2, 3, 4, 5, 6, 7 }, { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 }, - 32*8 /* every char takes 8 consecutive bytes */ + 32*8 // every char takes 8 consecutive bytes }; static GFXDECODE_START( gfx_sidepckt ) - GFXDECODE_ENTRY( "gfx1", 0, charlayout, 128, 4 ) /* colors 128-159 */ - GFXDECODE_ENTRY( "gfx2", 0, spritelayout, 0, 16 ) /* colors 0-127 */ + GFXDECODE_ENTRY( "chars", 0, charlayout, 128, 4 ) // colors 128-159 + GFXDECODE_ENTRY( "sprites", 0, spritelayout, 0, 16 ) // colors 0-127 GFXDECODE_END @@ -355,27 +610,19 @@ void sidepckt_state::machine_reset() m_scroll_y = 0; } -void sidepckt_state::sidepckt(machine_config &config) +void sidepckt_state::sidepcktb(machine_config &config) { - /* basic machine hardware */ - MC6809E(config, m_maincpu, 12_MHz_XTAL/6); /* MC68B09EP, 2 MHz */ - m_maincpu->set_addrmap(AS_PROGRAM, &sidepckt_state::sidepckt_map); + // basic machine hardware + MC6809E(config, m_maincpu, 12_MHz_XTAL / 6); // MC68B09EP, 2 MHz + m_maincpu->set_addrmap(AS_PROGRAM, &sidepckt_state::bootleg_main_map); - M6502(config, m_audiocpu, 12_MHz_XTAL/8); /* 1.5 MHz */ + M6502(config, m_audiocpu, 12_MHz_XTAL / 8); // 1.5 MHz m_audiocpu->set_addrmap(AS_PROGRAM, &sidepckt_state::sound_map); - I8751(config, m_mcu, 8_MHz_XTAL); // 8.0MHz OSC on PCB - m_mcu->port_out_cb<1>().set(FUNC(sidepckt_state::mcu_p1_w)); - m_mcu->port_in_cb<2>().set(FUNC(sidepckt_state::mcu_p2_r)); - m_mcu->port_out_cb<3>().set(FUNC(sidepckt_state::mcu_p3_w)); - - // needs a tight sync with the mcu - config.set_perfect_quantum(m_maincpu); - - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_refresh_hz(58); /* VERIFY: May be 55 or 56 */ - screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */ + screen.set_refresh_hz(58); // VERIFY: May be 55 or 56 + screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate screen.set_size(32*8, 32*8); screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); screen.set_screen_update(FUNC(sidepckt_state::screen_update)); @@ -383,29 +630,36 @@ void sidepckt_state::sidepckt(machine_config &config) screen.screen_vblank().set_inputline(m_maincpu, INPUT_LINE_NMI); GFXDECODE(config, m_gfxdecode, m_palette, gfx_sidepckt); - PALETTE(config, m_palette, FUNC(sidepckt_state::sidepckt_palette), 256); + PALETTE(config, m_palette, FUNC(sidepckt_state::palette), 256); - /* sound hardware */ + // sound hardware SPEAKER(config, "mono").front_center(); GENERIC_LATCH_8(config, m_soundlatch); m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); - ym2203_device &ym1(YM2203(config, "ym1", 12_MHz_XTAL/8)); /* 1.5 MHz */ + ym2203_device &ym1(YM2203(config, "ym1", 12_MHz_XTAL / 8)); // 1.5 MHz ym1.add_route(ALL_OUTPUTS, "mono", 0.25); - ym3526_device &ym2(YM3526(config, "ym2", 12_MHz_XTAL/4)); /* 3 MHz */ + ym3526_device &ym2(YM3526(config, "ym2", 12_MHz_XTAL / 4)); // 3 MHz ym2.irq_handler().set_inputline(m_audiocpu, M6502_IRQ_LINE); ym2.add_route(ALL_OUTPUTS, "mono", 1.0); } -void sidepckt_state::sidepcktb(machine_config &config) +void sidepckt_mcu_state::sidepckt(machine_config &config) { - sidepckt(config); + sidepcktb(config); - /* basic machine hardware */ - m_maincpu->set_addrmap(AS_PROGRAM, &sidepckt_state::sidepcktb_map); - config.device_remove("mcu"); + // basic machine hardware + m_maincpu->set_addrmap(AS_PROGRAM, &sidepckt_mcu_state::original_main_map); + + I8751(config, m_mcu, 8_MHz_XTAL); // 8.0MHz OSC on PCB + m_mcu->port_out_cb<1>().set(FUNC(sidepckt_mcu_state::mcu_p1_w)); + m_mcu->port_in_cb<2>().set(FUNC(sidepckt_mcu_state::mcu_p2_r)); + m_mcu->port_out_cb<3>().set(FUNC(sidepckt_mcu_state::mcu_p3_w)); + + // needs a tight sync with the mcu + config.set_perfect_quantum(m_maincpu); } @@ -425,13 +679,13 @@ ROM_START( sidepckt ) // DE-0245-2 ROM_REGION( 0x1000, "mcu", 0 ) // i8751 MCU (BAD_DUMP because it was created from the Japanese version) ROM_LOAD( "dh-e.6d", 0x0000, 0x1000, BAD_DUMP CRC(00654574) SHA1(7d775e7b7cbb548c50b9b838a525a12bf7a32f8e) ) - ROM_REGION( 0x18000, "gfx1", 0 ) - ROM_LOAD( "dh07-e.13k", 0x00000, 0x8000, CRC(9d6f7969) SHA1(583852be0861a89c63ce09eb39146ec379b9e12d) ) // characters + ROM_REGION( 0x18000, "chars", 0 ) + ROM_LOAD( "dh07-e.13k", 0x00000, 0x8000, CRC(9d6f7969) SHA1(583852be0861a89c63ce09eb39146ec379b9e12d) ) ROM_LOAD( "dh06-e.13j", 0x08000, 0x8000, CRC(580e4e43) SHA1(de152a5d4fbc52d80e3eb9af17835ecb6258d45e) ) ROM_LOAD( "dh05-e.13h", 0x10000, 0x8000, CRC(05ab71d2) SHA1(6f06d1d1440a5fb05c01f712457d0bb167e93099) ) - ROM_REGION( 0x18000, "gfx2", 0 ) - ROM_LOAD( "dh01.14a", 0x00000, 0x8000, CRC(a2cdfbea) SHA1(0721e538e3306d616f11008f784cf21e679f330d) ) // sprites + ROM_REGION( 0x18000, "sprites", 0 ) + ROM_LOAD( "dh01.14a", 0x00000, 0x8000, CRC(a2cdfbea) SHA1(0721e538e3306d616f11008f784cf21e679f330d) ) ROM_LOAD( "dh02.15a", 0x08000, 0x8000, CRC(eeb5c3e7) SHA1(57eda1cc29124e04fe5025a904634d8ca52c0f12) ) ROM_LOAD( "dh03.17a", 0x10000, 0x8000, CRC(8e18d21d) SHA1(74f0ddf1fcbed386332eba882b4136295b4f096d) ) @@ -450,13 +704,13 @@ ROM_START( sidepcktj ) // DE-0245-1 ROM_REGION( 0x1000, "mcu", 0 ) // i8751 MCU ROM_LOAD( "dh.6d", 0x0000, 0x1000, CRC(f7e099b6) SHA1(8e718384489a589acebc19ca361e0aa8a4c6b63b) ) - ROM_REGION( 0x18000, "gfx1", 0 ) - ROM_LOAD( "dh07.13k", 0x00000, 0x8000, CRC(7d0ce858) SHA1(3a158f218a762e6841d2611f41ace67a1afefb35) ) // characters + ROM_REGION( 0x18000, "chars", 0 ) + ROM_LOAD( "dh07.13k", 0x00000, 0x8000, CRC(7d0ce858) SHA1(3a158f218a762e6841d2611f41ace67a1afefb35) ) ROM_LOAD( "dh06.13j", 0x08000, 0x8000, CRC(b86ddf72) SHA1(7596dd1b646971d8df1bc4fd157ccf161a712d59) ) ROM_LOAD( "dh05.13h", 0x10000, 0x8000, CRC(df6f94f2) SHA1(605796191f37cb76d496aa459243655070bb90c0) ) - ROM_REGION( 0x18000, "gfx2", 0 ) - ROM_LOAD( "dh01.14a", 0x00000, 0x8000, CRC(a2cdfbea) SHA1(0721e538e3306d616f11008f784cf21e679f330d) ) // sprites + ROM_REGION( 0x18000, "sprites", 0 ) + ROM_LOAD( "dh01.14a", 0x00000, 0x8000, CRC(a2cdfbea) SHA1(0721e538e3306d616f11008f784cf21e679f330d) ) ROM_LOAD( "dh02.15a", 0x08000, 0x8000, CRC(eeb5c3e7) SHA1(57eda1cc29124e04fe5025a904634d8ca52c0f12) ) ROM_LOAD( "dh03.17a", 0x10000, 0x8000, CRC(8e18d21d) SHA1(74f0ddf1fcbed386332eba882b4136295b4f096d) ) @@ -473,13 +727,13 @@ ROM_START( sidepcktb ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "dh04.3h", 0x08000, 0x8000, CRC(d076e62e) SHA1(720ff1a6a58697b4a9c7c4f31c24a2cf8a04900a) ) - ROM_REGION( 0x18000, "gfx1", 0 ) - ROM_LOAD( "dh07-e.13k", 0x00000, 0x8000, CRC(9d6f7969) SHA1(583852be0861a89c63ce09eb39146ec379b9e12d) ) // characters + ROM_REGION( 0x18000, "chars", 0 ) + ROM_LOAD( "dh07-e.13k", 0x00000, 0x8000, CRC(9d6f7969) SHA1(583852be0861a89c63ce09eb39146ec379b9e12d) ) ROM_LOAD( "dh06-e.13j", 0x08000, 0x8000, CRC(580e4e43) SHA1(de152a5d4fbc52d80e3eb9af17835ecb6258d45e) ) ROM_LOAD( "dh05-e.13h", 0x10000, 0x8000, CRC(05ab71d2) SHA1(6f06d1d1440a5fb05c01f712457d0bb167e93099) ) - ROM_REGION( 0x18000, "gfx2", 0 ) - ROM_LOAD( "dh01.14a", 0x00000, 0x8000, CRC(a2cdfbea) SHA1(0721e538e3306d616f11008f784cf21e679f330d) ) // sprites + ROM_REGION( 0x18000, "sprites", 0 ) + ROM_LOAD( "dh01.14a", 0x00000, 0x8000, CRC(a2cdfbea) SHA1(0721e538e3306d616f11008f784cf21e679f330d) ) ROM_LOAD( "dh02.15a", 0x08000, 0x8000, CRC(eeb5c3e7) SHA1(57eda1cc29124e04fe5025a904634d8ca52c0f12) ) ROM_LOAD( "dh03.17a", 0x10000, 0x8000, CRC(8e18d21d) SHA1(74f0ddf1fcbed386332eba882b4136295b4f096d) ) @@ -488,15 +742,9 @@ ROM_START( sidepcktb ) ROM_LOAD( "dh-08.15l", 0x0100, 0x0100, CRC(cdf2180f) SHA1(123215d096f88b66396d40d7a579380d0b5b2b89) ) ROM_END - -void sidepckt_state::init_sidepckt() -{ - save_item(NAME(m_mcu_p1)); - save_item(NAME(m_mcu_p2)); - save_item(NAME(m_mcu_p3)); -} +} // anonymous namespace -GAME( 1986, sidepckt, 0, sidepckt, sidepckt, sidepckt_state, init_sidepckt, ROT0, "Data East Corporation", "Side Pocket (World)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, sidepcktj, sidepckt, sidepckt, sidepcktj, sidepckt_state, init_sidepckt, ROT0, "Data East Corporation", "Side Pocket (Japan, Cocktail)", MACHINE_SUPPORTS_SAVE ) -GAME( 1986, sidepcktb, sidepckt, sidepcktb, sidepcktb, sidepckt_state, empty_init, ROT0, "bootleg", "Side Pocket (bootleg)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, sidepckt, 0, sidepckt, sidepckt, sidepckt_mcu_state, empty_init, ROT0, "Data East Corporation", "Side Pocket (World)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, sidepcktj, sidepckt, sidepckt, sidepcktj, sidepckt_mcu_state, empty_init, ROT0, "Data East Corporation", "Side Pocket (Japan, Cocktail)", MACHINE_SUPPORTS_SAVE ) +GAME( 1986, sidepcktb, sidepckt, sidepcktb, sidepcktb, sidepckt_state, empty_init, ROT0, "bootleg", "Side Pocket (bootleg)", MACHINE_SUPPORTS_SAVE ) diff --git a/src/mame/dataeast/sidepckt.h b/src/mame/dataeast/sidepckt.h deleted file mode 100644 index 81f505f9d3b..00000000000 --- a/src/mame/dataeast/sidepckt.h +++ /dev/null @@ -1,87 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ernesto Corvi -/****************************************************************************** - - Data East Side Pocket hardware - -******************************************************************************/ -#ifndef MAME_INCLUDES_SIDEPKT_H -#define MAME_INCLUDES_SIDEPKT_H - -#pragma once - -#include "cpu/mcs51/mcs51.h" -#include "machine/gen_latch.h" -#include "emupal.h" -#include "tilemap.h" - -class sidepckt_state : public driver_device -{ -public: - sidepckt_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu"), - m_mcu(*this, "mcu"), - m_audiocpu(*this, "audiocpu"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_soundlatch(*this, "soundlatch"), - m_videoram(*this, "videoram"), - m_colorram(*this, "colorram"), - m_spriteram(*this, "spriteram") - { } - - void sidepcktb(machine_config &config); - void sidepckt(machine_config &config); - - void init_sidepckt(); - -protected: - virtual void machine_reset() override; - virtual void video_start() override; - -private: - required_device m_maincpu; - optional_device m_mcu; - required_device m_audiocpu; - required_device m_gfxdecode; - required_device m_palette; - required_device m_soundlatch; - - required_shared_ptr m_videoram; - required_shared_ptr m_colorram; - required_shared_ptr m_spriteram; - - tilemap_t *m_bg_tilemap = nullptr; - - uint8_t m_mcu_p1 = 0; - uint8_t m_mcu_p2 = 0; - uint8_t m_mcu_p3 = 0; - - uint8_t m_scroll_y = 0; - - uint8_t mcu_r(); - void mcu_w(uint8_t data); - - void mcu_p1_w(uint8_t data); - uint8_t mcu_p2_r(); - void mcu_p3_w(uint8_t data); - - void videoram_w(offs_t offset, uint8_t data); - void colorram_w(offs_t offset, uint8_t data); - uint8_t scroll_y_r(); - void scroll_y_w(uint8_t data); - - TILE_GET_INFO_MEMBER(get_tile_info); - - void sidepckt_palette(palette_device &palette) const; - - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); - - void sidepckt_map(address_map &map); - void sidepcktb_map(address_map &map); - void sound_map(address_map &map); -}; - -#endif // MAME_INCLUDES_SIDEPKT_H diff --git a/src/mame/dataeast/sidepckt_v.cpp b/src/mame/dataeast/sidepckt_v.cpp deleted file mode 100644 index 083610f44a4..00000000000 --- a/src/mame/dataeast/sidepckt_v.cpp +++ /dev/null @@ -1,164 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Ernesto Corvi -/****************************************************************************** - - Data East Side Pocket hardware - - Functions to emulate the video hardware - -******************************************************************************/ - -#include "emu.h" -#include "sidepckt.h" - - -void sidepckt_state::sidepckt_palette(palette_device &palette) const -{ - uint8_t const *const color_prom = memregion("proms")->base(); - - for (int i = 0; i < palette.entries(); i++) - { - int bit0, bit1, bit2, bit3; - - // red component - bit0 = BIT(color_prom[i], 4); - bit1 = BIT(color_prom[i], 5); - bit2 = BIT(color_prom[i], 6); - bit3 = BIT(color_prom[i], 7); - int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - // green component - bit0 = BIT(color_prom[i], 0); - bit1 = BIT(color_prom[i], 1); - bit2 = BIT(color_prom[i], 2); - bit3 = BIT(color_prom[i], 3); - int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - // blue component - bit0 = BIT(color_prom[i + palette.entries()], 0); - bit1 = BIT(color_prom[i + palette.entries()], 1); - bit2 = BIT(color_prom[i + palette.entries()], 2); - bit3 = BIT(color_prom[i + palette.entries()], 3); - int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3; - - palette.set_pen_color(i, rgb_t(r, g, b)); - } -} - - - -/*************************************************************************** - - Callbacks for the TileMap code - -***************************************************************************/ - -TILE_GET_INFO_MEMBER(sidepckt_state::get_tile_info) -{ - uint8_t attr = m_colorram[tile_index]; - tileinfo.set(0, - m_videoram[tile_index] + ((attr & 0x07) << 8), - ((attr & 0x10) >> 3) | ((attr & 0x20) >> 5), - TILE_FLIPX); - tileinfo.group = (attr & 0x80) >> 7; -} - - - -/*************************************************************************** - - Start the video hardware emulation. - -***************************************************************************/ - -void sidepckt_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(sidepckt_state::get_tile_info)), TILEMAP_SCAN_ROWS, 8,8, 32,32); - - m_bg_tilemap->set_transmask(0,0xff,0x00); /* split type 0 is totally transparent in front half */ - m_bg_tilemap->set_transmask(1,0x01,0xfe); /* split type 1 has pen 0 transparent in front half */ - - machine().tilemap().set_flip_all(TILEMAP_FLIPX); - - save_item(NAME(m_scroll_y)); -} - - - -/*************************************************************************** - - Memory handlers - -***************************************************************************/ - -void sidepckt_state::videoram_w(offs_t offset, uint8_t data) -{ - m_videoram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -void sidepckt_state::colorram_w(offs_t offset, uint8_t data) -{ - m_colorram[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -uint8_t sidepckt_state::scroll_y_r() -{ - return (m_scroll_y); -} - -void sidepckt_state::scroll_y_w(uint8_t data) -{ - // Bits 0-5: Scroll y - m_scroll_y = data & 0x3F; - - // Other bits: Unknown, but they seem never written - if (data > 0x3F) - logerror ("scroll_y_w: Unknown write -> data = 0x%02X\n", data); -} - - -/*************************************************************************** - - Display refresh - -***************************************************************************/ - -void sidepckt_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) -{ - for (int offs = 0;offs < m_spriteram.bytes(); offs += 4) - { - int attr = m_spriteram[offs | 1]; - int code = ((attr & 0x03) << 8) | m_spriteram[offs | 3]; - int color = (attr & 0xf0) >> 4; - - int sx = m_spriteram[offs | 2] - 2; - int sy = m_spriteram[offs]; - - int flipx = attr & 0x08; - int flipy = attr & 0x04; - - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code, - color, - flipx,flipy, - sx,sy,0); - - /* wraparound */ - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - code, - color, - flipx,flipy, - sx-256,sy,0); - } -} - - -uint32_t sidepckt_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) -{ - m_bg_tilemap->set_scrolly (0, m_scroll_y); - - m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER1,0); - draw_sprites(bitmap,cliprect); - m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_LAYER0,0); - return 0; -} diff --git a/src/mame/samsung/dvd-n5xx.cpp b/src/mame/samsung/dvd-n5xx.cpp index 531c5626ea1..326bd92225d 100644 --- a/src/mame/samsung/dvd-n5xx.cpp +++ b/src/mame/samsung/dvd-n5xx.cpp @@ -272,7 +272,7 @@ INPUT_PORTS_END void n5xx_state::n501(machine_config &config) { // basic machine hardware - TMP95C061(config, m_maincpu, 20_MHz_XTAL); // actually + TMP95C061(config, m_maincpu, 20_MHz_XTAL); // actually TMP91C219F m_maincpu->set_addrmap(AS_PROGRAM, &n5xx_state::main_map); // video hardware -- cgit v1.2.3