From 9b49217ed4799a2cec39ff7103e9b653a7aa7829 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Tue, 21 Aug 2018 23:54:50 +0200 Subject: [PATCH] new working clone --------------------------------- Dog Fight (Orca, prototype) [ShouTime, Dane Biegert, Smitdogg, The Dumping Union] --- scripts/target/mame/arcade.lua | 3 +- src/mame/drivers/vastar.cpp | 146 +++++++++++------ src/mame/drivers/zodiack.cpp | 177 ++++++-------------- src/mame/includes/vastar.h | 67 +++++--- src/mame/includes/zodiack.h | 47 +----- src/mame/mame.lst | 1 + src/mame/video/orca40c.cpp | 286 +++++++++++++++++++++++++++++++++ src/mame/video/orca40c.h | 79 +++++++++ src/mame/video/vastar.cpp | 2 +- src/mame/video/zodiack.cpp | 175 -------------------- 10 files changed, 573 insertions(+), 410 deletions(-) create mode 100644 src/mame/video/orca40c.cpp create mode 100644 src/mame/video/orca40c.h delete mode 100644 src/mame/video/zodiack.cpp diff --git a/scripts/target/mame/arcade.lua b/scripts/target/mame/arcade.lua index 98fc97bcbfa..4c10920c01c 100644 --- a/scripts/target/mame/arcade.lua +++ b/scripts/target/mame/arcade.lua @@ -3060,12 +3060,13 @@ files { MAME_DIR .. "src/mame/drivers/marineb.cpp", MAME_DIR .. "src/mame/includes/marineb.h", MAME_DIR .. "src/mame/video/marineb.cpp", + MAME_DIR .. "src/mame/video/orca40c.cpp", + MAME_DIR .. "src/mame/video/orca40c.h", MAME_DIR .. "src/mame/drivers/vastar.cpp", MAME_DIR .. "src/mame/includes/vastar.h", MAME_DIR .. "src/mame/video/vastar.cpp", MAME_DIR .. "src/mame/drivers/zodiack.cpp", MAME_DIR .. "src/mame/includes/zodiack.h", - MAME_DIR .. "src/mame/video/zodiack.cpp", } createMAMEProjects(_target, _subtarget, "pacific") diff --git a/src/mame/drivers/vastar.cpp b/src/mame/drivers/vastar.cpp index e1c30f5a8a0..b13171a41da 100644 --- a/src/mame/drivers/vastar.cpp +++ b/src/mame/drivers/vastar.cpp @@ -109,11 +109,12 @@ Vsync : 60.58hz #include "machine/74259.h" #include "machine/watchdog.h" #include "sound/ay8910.h" +#include "video/orca40c.h" #include "screen.h" #include "speaker.h" -void vastar_state::machine_start() +void vastar_common_state::machine_start() { save_item(NAME(m_nmi_mask)); } @@ -134,7 +135,7 @@ WRITE_LINE_MEMBER(vastar_state::flip_screen_w) flip_screen_set(state); } -WRITE_LINE_MEMBER(vastar_state::nmi_mask_w) +WRITE_LINE_MEMBER(vastar_common_state::nmi_mask_w) { m_nmi_mask = state; } @@ -151,14 +152,14 @@ void vastar_state::main_map(address_map &map) map(0xf000, 0xf7ff).ram().share("sharedram"); } -void vastar_state::main_port_map(address_map &map) +void vastar_common_state::main_port_map(address_map &map) { map.global_mask(0x0f); map(0x00, 0x07).w("mainlatch", FUNC(ls259_device::write_d0)); } -void vastar_state::cpu2_map(address_map &map) +void vastar_common_state::cpu2_map(address_map &map) { map(0x0000, 0x1fff).rom(); map(0x4000, 0x47ff).ram().share("sharedram"); @@ -167,13 +168,25 @@ void vastar_state::cpu2_map(address_map &map) map(0x8080, 0x8080).portr("SYSTEM"); } -void vastar_state::cpu2_port_map(address_map &map) +void vastar_common_state::cpu2_port_map(address_map &map) { map.global_mask(0x0f); map(0x00, 0x01).w("aysnd", FUNC(ay8910_device::address_data_w)); map(0x02, 0x02).r("aysnd", FUNC(ay8910_device::data_r)); } +void dogfightp_state::dogfightp_main_map(address_map &map) +{ + map(0x0000, 0x7fff).rom(); + map(0x9000, 0x903f).ram().w("videopcb", FUNC(orca_ovg_40c_device::attributes_w)).share("videopcb:attributeram"); + map(0x9040, 0x905f).ram().share("videopcb:spriteram"); + map(0x9060, 0x907f).ram().share("videopcb:bulletsram"); + map(0x9080, 0x93ff).ram(); + map(0xa000, 0xa3ff).ram().w("videopcb", FUNC(orca_ovg_40c_device::videoram_w)).share("videopcb:videoram"); + map(0xb000, 0xb3ff).ram().w("videopcb", FUNC(orca_ovg_40c_device::videoram2_w)).share("videopcb:videoram_2"); + map(0xe000, 0xe000).rw("watchdog", FUNC(watchdog_timer_device::reset_r), FUNC(watchdog_timer_device::reset_w)); + map(0xf000, 0xf7ff).ram().share("sharedram"); +} static INPUT_PORTS_START( vastar ) PORT_START("P1") @@ -361,8 +374,6 @@ static INPUT_PORTS_START( pprobe ) PORT_DIPSETTING( 0x90, DEF_STR( 1C_7C ) ) INPUT_PORTS_END - - static const gfx_layout charlayout = { 8,8, @@ -411,56 +422,79 @@ static GFXDECODE_START( gfx_vastar ) GFXDECODE_END -INTERRUPT_GEN_MEMBER(vastar_state::vblank_irq) +INTERRUPT_GEN_MEMBER(vastar_common_state::vblank_irq) { if(m_nmi_mask) device.execute().pulse_input_line(INPUT_LINE_NMI, attotime::zero); } -MACHINE_CONFIG_START(vastar_state::vastar) - +void vastar_common_state::common(machine_config &config) +{ /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", Z80, XTAL(18'432'000)/6) - MCFG_DEVICE_PROGRAM_MAP(main_map) - MCFG_DEVICE_IO_MAP(main_port_map) - MCFG_DEVICE_VBLANK_INT_DRIVER("screen", vastar_state, vblank_irq) + Z80(config, m_maincpu, XTAL(18'432'000)/6); + m_maincpu->set_addrmap(AS_IO, &vastar_common_state::main_port_map); - MCFG_DEVICE_ADD("sub", Z80, XTAL(18'432'000)/6) - MCFG_DEVICE_PROGRAM_MAP(cpu2_map) - MCFG_DEVICE_IO_MAP(cpu2_port_map) - MCFG_DEVICE_PERIODIC_INT_DRIVER(vastar_state, irq0_line_hold, 242) /* 4 * vsync_freq(60.58) measured, it is not known yet how long it is asserted so we'll use HOLD_LINE for now */ + Z80(config, m_subcpu, XTAL(18'432'000)/6); + m_subcpu->set_addrmap(AS_PROGRAM, &vastar_common_state::cpu2_map); + m_subcpu->set_addrmap(AS_IO, &vastar_common_state::cpu2_port_map); + m_subcpu->set_periodic_int(FUNC(vastar_common_state::irq0_line_hold), attotime::from_hz(242)); /* 4 * vsync_freq(60.58) measured, it is not known yet how long it is asserted so we'll use HOLD_LINE for now */ - MCFG_QUANTUM_TIME(attotime::from_hz(600)) /* 10 CPU slices per frame - seems enough to ensure proper synchronization of the CPUs */ + config.m_minimum_quantum = attotime::from_hz(600); /* 10 CPU slices per frame - seems enough to ensure proper synchronization of the CPUs */ ls259_device &mainlatch(LS259(config, "mainlatch")); - mainlatch.q_out_cb<0>().set(FUNC(vastar_state::nmi_mask_w)); - mainlatch.q_out_cb<1>().set(FUNC(vastar_state::flip_screen_w)); + mainlatch.q_out_cb<0>().set(FUNC(vastar_common_state::nmi_mask_w)); mainlatch.q_out_cb<2>().set_inputline(m_subcpu, INPUT_LINE_RESET).invert(); - MCFG_WATCHDOG_ADD("watchdog") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60.58) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(vastar_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_vastar) - MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256) + WATCHDOG_TIMER(config, "watchdog"); /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("aysnd", AY8910, XTAL(18'432'000)/12) - MCFG_AY8910_PORT_A_READ_CB(IOPORT("DSW1")) - MCFG_AY8910_PORT_B_READ_CB(IOPORT("DSW2")) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) -MACHINE_CONFIG_END + ay8910_device &aysnd(AY8910(config, "aysnd", XTAL(18'432'000)/12)); + aysnd.port_a_read_callback().set_ioport("DSW1"); + aysnd.port_b_read_callback().set_ioport("DSW2"); + aysnd.add_route(ALL_OUTPUTS, "mono", 0.50); +} +void vastar_state::vastar(machine_config &config) +{ + common(config); + m_maincpu->set_addrmap(AS_PROGRAM, &vastar_state::main_map); + m_maincpu->set_vblank_int("screen", FUNC(vastar_common_state::vblank_irq)); + + ls259_device &mainlatch(*subdevice("mainlatch")); + mainlatch.q_out_cb<1>().set(FUNC(vastar_state::flip_screen_w)); + + /* video hardware */ + screen_device& screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_refresh_hz(60.58); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + 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(vastar_state::screen_update)); + screen.set_palette("palette"); + + GFXDECODE(config, m_gfxdecode, m_palette, gfx_vastar); + PALETTE(config, m_palette, 256); + m_palette->set_prom_region("proms"); + m_palette->set_init("palette", FUNC(palette_device::palette_init_RRRRGGGGBBBB_proms)); +} + +void dogfightp_state::dogfightp(machine_config &config) +{ + common(config); + + m_maincpu->set_addrmap(AS_PROGRAM, &dogfightp_state::dogfightp_main_map); + m_maincpu->set_vblank_int("videopcb:screen", FUNC(vastar_common_state::vblank_irq)); + + ls259_device &mainlatch(*subdevice("mainlatch")); + mainlatch.q_out_cb<1>().set("videopcb", FUNC(orca_ovg_40c_device::flipscreen_w)); + + orca_ovg_40c_device& videopcb(ORCA_OVG_40C(config, "videopcb", 0)); + videopcb.set_palette("videopcb:palette"); + videopcb.set_percuss_hardware(true); +} /*************************************************************************** @@ -622,6 +656,28 @@ ROM_START( vastar4 ) /* minimal changes (2 bytes) from parent set */ ROM_LOAD( "tbp24s10.8n", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) /* ???? */ ROM_END +ROM_START( dogfightp ) // all 2732 + ROM_REGION( 0x10000, "maincpu", 0 ) // on ORCA OVG-34c board + ROM_LOAD( "1.4f", 0x0000, 0x1000, CRC(03f21fc8) SHA1(0210f4a05e32ff962a85d1a35e60453bb16585cd) ) + ROM_LOAD( "4.4k", 0x1000, 0x1000, CRC(5f93c5fc) SHA1(bd0eb02fe3bcec526879c3a43f925a617f9b1696) ) + ROM_LOAD( "2.4h", 0x2000, 0x1000, CRC(1739b24e) SHA1(71ef31b71b6f35e57c34c46f66556b75b2bf9197) ) + ROM_LOAD( "5.4l", 0x3000, 0x1000, CRC(8f3fda8d) SHA1(b88bcabeb7bfb6b8420c0f70fc8eb7e624540f04) ) + ROM_LOAD( "3.4j", 0x4000, 0x1000, CRC(5bdf8ddc) SHA1(1636389adcd87c5c725be9847ef3304a20d59def) ) + ROM_LOAD( "6.4n", 0x5000, 0x1000, CRC(7c445c30) SHA1(220b8cc52dbce5aa126be114acb84e1376391522) ) + + ROM_REGION( 0x10000, "sub", 0 ) // on ORCA OVG-34c board + ROM_LOAD( "7.2f", 0x0000, 0x1000, CRC(61c14b5d) SHA1(570e6bb67988807f8539740ba3c7ca2aa2767067) ) + + ROM_REGION( 0x3000, "videopcb", 0 ) // on ORCA OVG-40c sub board + ROM_LOAD( "8.4r", 0x0000, 0x0800, CRC(c62f2ea1) SHA1(8742008225518fb6131083514484900012476681) ) + ROM_IGNORE(0x0800) // is this used? Where? + ROM_LOAD( "9.7m", 0x0800, 0x1000, CRC(ffe05fee) SHA1(70b9d0808defd936e2c3567f8e6996a19753de81) ) + ROM_LOAD( "10.7p", 0x1800, 0x1000, CRC(2cb51793) SHA1(d90177ef28730774202a04a0846281537a1883df) ) + + ROM_REGION( 0x0040, "videopcb:proms", 0 ) // not dumped for this set, on ORCA OVG-40c sub board + ROM_LOAD( "mmi6331.2a", 0x0000, 0x0020, CRC(69a35aa5) SHA1(fe494ed1ff642f95834dfca92e9c4494e04f7b81) ) + ROM_LOAD( "mmi6331.2b", 0x0020, 0x0020, CRC(596ae457) SHA1(1c1a3130d88c5fd5c66ce9f91d97a09c0a0b535f) ) +ROM_END ROM_START( pprobe ) ROM_REGION( 0x10000, "maincpu", 0 ) @@ -655,9 +711,9 @@ ROM_START( pprobe ) ROM_LOAD( "mmi6301-1.bin", 0x0000, 0x0100, CRC(b5297a3b) SHA1(a5a512f86097b7d892f6d11e8492e8a379c07f60) ) /* ???? == vastar - tbp24s10.8n */ ROM_END - -GAME( 1983, vastar, 0, vastar, vastar, vastar_state, empty_init, ROT90, "Orca (Sesame Japan license)", "Vastar (set 1)", MACHINE_SUPPORTS_SAVE ) // Sesame Japan was a brand of Fujikousan -GAME( 1983, vastar2, vastar, vastar, vastar, vastar_state, empty_init, ROT90, "Orca (Sesame Japan license)", "Vastar (set 2)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, vastar3, vastar, vastar, vastar, vastar_state, empty_init, ROT90, "Orca (Sesame Japan license)", "Vastar (set 3)", MACHINE_SUPPORTS_SAVE ) -GAME( 1983, vastar4, vastar, vastar, vastar4, vastar_state, empty_init, ROT90, "Orca (Sesame Japan license)", "Vastar (set 4)", MACHINE_SUPPORTS_SAVE ) -GAME( 1985, pprobe, 0, vastar, pprobe, vastar_state, empty_init, ROT90, "Crux / Kyugo?", "Planet Probe (prototype?)", MACHINE_SUPPORTS_SAVE ) // has no Copyright, probably because Crux didn't have a trading name at this point? +GAME( 1983, vastar, 0, vastar, vastar, vastar_state, empty_init, ROT90, "Orca (Sesame Japan license)", "Vastar (set 1)", MACHINE_SUPPORTS_SAVE ) // Sesame Japan was a brand of Fujikousan +GAME( 1983, vastar2, vastar, vastar, vastar, vastar_state, empty_init, ROT90, "Orca (Sesame Japan license)", "Vastar (set 2)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, vastar3, vastar, vastar, vastar, vastar_state, empty_init, ROT90, "Orca (Sesame Japan license)", "Vastar (set 3)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, vastar4, vastar, vastar, vastar4, vastar_state, empty_init, ROT90, "Orca (Sesame Japan license)", "Vastar (set 4)", MACHINE_SUPPORTS_SAVE ) +GAME( 1983, dogfightp, dogfight, dogfightp, vastar, dogfightp_state, empty_init, ROT270, "Orca", "Dog Fight (Orca, prototype)", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) /* bullet color needs to be verified */ +GAME( 1985, pprobe, 0, vastar, pprobe, vastar_state, empty_init, ROT90, "Crux / Kyugo?", "Planet Probe (prototype?)", MACHINE_SUPPORTS_SAVE ) // has no Copyright, probably because Crux didn't have a trading name at this point? diff --git a/src/mame/drivers/zodiack.cpp b/src/mame/drivers/zodiack.cpp index e967caf61e5..03c67485ee5 100644 --- a/src/mame/drivers/zodiack.cpp +++ b/src/mame/drivers/zodiack.cpp @@ -91,24 +91,12 @@ Notes: #include "emu.h" #include "includes/zodiack.h" -#include "cpu/z80/z80.h" #include "machine/watchdog.h" #include "sound/ay8910.h" -#include "screen.h" +#include "video/orca40c.h" #include "speaker.h" -#define PIXEL_CLOCK (XTAL(18'432'000)/3) - -#define HTOTAL (396) -#define HBEND (0) -#define HBSTART (256) - -#define VTOTAL (256) -#define VBEND (16) -#define VBSTART (240) - - WRITE8_MEMBER( zodiack_state::nmi_mask_w ) { m_main_nmi_enabled = (data & 1) ^ 1; @@ -158,13 +146,13 @@ void zodiack_state::main_map(address_map &map) map(0x6090, 0x6090).r(m_soundlatch, FUNC(generic_latch_8_device::read)).w(FUNC(zodiack_state::master_soundlatch_w)); map(0x7000, 0x7000).nopr().w("watchdog", FUNC(watchdog_timer_device::reset_w)); /* NOP??? */ map(0x7100, 0x7100).w(FUNC(zodiack_state::nmi_mask_w)); - map(0x7200, 0x7200).w(FUNC(zodiack_state::flipscreen_w)); - map(0x9000, 0x903f).ram().w(FUNC(zodiack_state::attributes_w)).share("attributeram"); - map(0x9040, 0x905f).ram().share("spriteram"); - map(0x9060, 0x907f).ram().share("bulletsram"); + map(0x7200, 0x7200).w("videopcb", FUNC(orca_ovg_40c_device::flipscreen_w)); + map(0x9000, 0x903f).ram().w("videopcb", FUNC(orca_ovg_40c_device::attributes_w)).share("videopcb:attributeram"); + map(0x9040, 0x905f).ram().share("videopcb:spriteram"); + map(0x9060, 0x907f).ram().share("videopcb:bulletsram"); map(0x9080, 0x93ff).ram(); - map(0xa000, 0xa3ff).ram().w(FUNC(zodiack_state::videoram_w)).share("videoram"); - map(0xb000, 0xb3ff).ram().w(FUNC(zodiack_state::videoram2_w)).share("videoram_2"); + map(0xa000, 0xa3ff).ram().w("videopcb", FUNC(orca_ovg_40c_device::videoram_w)).share("videopcb:videoram"); + map(0xb000, 0xb3ff).ram().w("videopcb", FUNC(orca_ovg_40c_device::videoram2_w)).share("videopcb:videoram_2"); map(0xc000, 0xcfff).rom(); } @@ -496,63 +484,6 @@ static INPUT_PORTS_START( bounty ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY INPUT_PORTS_END - - -static const gfx_layout charlayout = -{ - 8,8, /* 8*8 chars */ - 256, /* 256 characters */ - 1, /* 1 bit per pixel */ - { 0 } , /* single bitplane */ - { 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 */ -}; - -static const gfx_layout charlayout_2 = -{ - 8,8, /* 8*8 chars */ - 256, /* 256 characters */ - 2, /* 2 bits per pixel */ - { 0, 512*8*8 }, /* The bitplanes are separate */ - { 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 */ -}; - -static const gfx_layout spritelayout = -{ - 16,16, /* 16*16 sprites */ - 64, /* 64 sprites */ - 2, /* 2 bits per pixel */ - { 0, 128*32*8 }, /* the two bitplanes are separated */ - { 0, 1, 2, 3, 4, 5, 6, 7, - 8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, - 16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 }, - 32*8 /* every sprite takes 32 consecutive bytes */ -}; - -static const gfx_layout bulletlayout = -{ - /* there is no gfx ROM for this one, it is generated by the hardware */ - 7,1, /* it's just 1 pixel, but we use 7*1 to position it correctly */ - 1, /* just one */ - 1, /* 1 bit per pixel */ - { 10*8*8 }, /* point to letter "A" */ - { 3, 7, 7, 7, 7, 7, 7 }, /* I "know" that this bit of the */ - { 1*8 }, /* graphics ROMs is 1 */ - 0 /* no use */ -}; - -static GFXDECODE_START( gfx_zodiack ) - GFXDECODE_ENTRY( "gfx1", 0x0000, charlayout, 8*4 , 8 ) - GFXDECODE_ENTRY( "gfx1", 0x0800, spritelayout, 0 , 8 ) - GFXDECODE_ENTRY( "gfx1", 0x0000, bulletlayout, 8*4+8*2, 1 ) - GFXDECODE_ENTRY( "gfx1", 0x1000, charlayout_2, 0 , 8 ) -GFXDECODE_END - - void zodiack_state::machine_start() { save_item(NAME(m_sound_nmi_enabled)); @@ -566,41 +497,40 @@ void zodiack_state::machine_reset() } -MACHINE_CONFIG_START(zodiack_state::zodiack) +void zodiack_state::zodiack(machine_config &config) +{ /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", Z80, XTAL(18'432'000)/6) - MCFG_DEVICE_PROGRAM_MAP(main_map) - MCFG_DEVICE_VBLANK_INT_DRIVER("screen", zodiack_state, zodiack_main_nmi_gen) - MCFG_DEVICE_PERIODIC_INT_DRIVER(zodiack_state, irq0_line_hold, 1*60) // sound related - unknown source, timing is guessed + Z80(config, m_maincpu, XTAL(18'432'000)/6); + m_maincpu->set_addrmap(AS_PROGRAM, &zodiack_state::main_map); + m_maincpu->set_vblank_int("videopcb:screen", FUNC(zodiack_state::zodiack_main_nmi_gen)); + m_maincpu->set_periodic_int(FUNC(zodiack_state::irq0_line_hold), attotime::from_hz(1*60)); // sound related - unknown source, timing is guessed - MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(18'432'000)/6) - MCFG_DEVICE_PROGRAM_MAP(sound_map) - MCFG_DEVICE_IO_MAP(io_map) - MCFG_DEVICE_PERIODIC_INT_DRIVER(zodiack_state, zodiack_sound_nmi_gen, 8*60) // sound tempo - unknown source, timing is guessed + Z80(config, m_audiocpu, XTAL(18'432'000)/6); + m_audiocpu->set_addrmap(AS_PROGRAM, &zodiack_state::sound_map); + m_audiocpu->set_addrmap(AS_IO, &zodiack_state::io_map); + m_audiocpu->set_periodic_int(FUNC(zodiack_state::zodiack_sound_nmi_gen), attotime::from_hz(8*60)); // sound tempo - unknown source, timing is guessed - MCFG_WATCHDOG_ADD("watchdog") - - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART) - MCFG_SCREEN_UPDATE_DRIVER(zodiack_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_zodiack) - MCFG_PALETTE_ADD("palette", 4*8+2*8+2*1) - MCFG_PALETTE_INDIRECT_ENTRIES(48+1) - MCFG_PALETTE_INIT_OWNER(zodiack_state,zodiack) + WATCHDOG_TIMER(config, "watchdog"); + orca_ovg_40c_device &videopcb(ORCA_OVG_40C(config, "videopcb", 0)); + videopcb.set_palette("videopcb:palette"); + /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_GENERIC_LATCH_8_ADD("soundlatch") + GENERIC_LATCH_8(config, m_soundlatch); - MCFG_DEVICE_ADD("aysnd", AY8910, XTAL(18'432'000)/12) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) -MACHINE_CONFIG_END + AY8910(config, "aysnd", XTAL(18'432'000)/12).add_route(ALL_OUTPUTS, "mono", 0.50); +} +void zodiack_state::percuss(machine_config &config) +{ + zodiack(config); + + orca_ovg_40c_device &videopcb(*subdevice("videopcb")); + videopcb.set_percuss_hardware(true); +} /*************************************************************************** @@ -616,12 +546,12 @@ ROM_START( zodiack ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "ovg20c.1", 0x0000, 0x1000, CRC(2d3c3baf) SHA1(e32937b947e591cba45da2dd456e4f655e62ddfd) ) - ROM_REGION( 0x2800, "gfx1", 0 ) + ROM_REGION( 0x2800, "videopcb", 0 ) ROM_LOAD( "ovg40c.7", 0x0000, 0x0800, CRC(ed9d3be7) SHA1(80d5906afef8b6d68fb13d41992aea208d9e3690) ) ROM_LOAD( "orca40c.8", 0x0800, 0x1000, CRC(88269c94) SHA1(acc27be0d27b33c2242ecf0563fe986e8dffb264) ) ROM_LOAD( "orca40c.9", 0x1800, 0x1000, CRC(a3bd40c9) SHA1(dcf8cbb73c081a3af85da135e8278c54e9e0de7c) ) - ROM_REGION( 0x0040, "proms", 0 ) + ROM_REGION( 0x0040, "videopcb:proms", 0 ) ROM_LOAD( "ovg40c.2a", 0x0000, 0x0020, CRC(703821b8) SHA1(33dcc9b0bea5e110eb4ffd3b8b8763e32e927b22) ) ROM_LOAD( "ovg40c.2b", 0x0020, 0x0020, CRC(21f77ec7) SHA1(b1019afc4361aca98b7120b21743bfeb5ea2ff63) ) ROM_END @@ -636,12 +566,12 @@ ROM_START( dogfight ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "df-1.4n", 0x0000, 0x1000, CRC(dcbb1c5b) SHA1(51fa51ff64982455b00484d55f6a8cf89fc786f1) ) - ROM_REGION( 0x2800, "gfx1", 0 ) + ROM_REGION( 0x2800, "videopcb", 0 ) ROM_LOAD( "df-6.3s", 0x0000, 0x0800, CRC(3059b515) SHA1(849e99a04ddcdfcf097cc3ac17e9edf12b51cd69) ) ROM_LOAD( "df-7.7n", 0x0800, 0x1000, CRC(ffe05fee) SHA1(70b9d0808defd936e2c3567f8e6996a19753de81) ) ROM_LOAD( "df-8.7r", 0x1800, 0x1000, CRC(2cb51793) SHA1(d90177ef28730774202a04a0846281537a1883df) ) - ROM_REGION( 0x0040, "proms", 0 ) + ROM_REGION( 0x0040, "videopcb:proms", 0 ) ROM_LOAD( "mmi6331.2a", 0x0000, 0x0020, CRC(69a35aa5) SHA1(fe494ed1ff642f95834dfca92e9c4494e04f7b81) ) ROM_LOAD( "mmi6331.2b", 0x0020, 0x0020, CRC(596ae457) SHA1(1c1a3130d88c5fd5c66ce9f91d97a09c0a0b535f) ) ROM_END @@ -655,12 +585,12 @@ ROM_START( moguchan ) ROM_REGION( 0x10000, "audiocpu", 0 ) ROM_LOAD( "1.7hj", 0x0000, 0x1000, CRC(1a88d35f) SHA1(d9347723c0eb6508739a6c0de4984b8244b197cf) ) - ROM_REGION( 0x2800, "gfx1", 0 ) + ROM_REGION( 0x2800, "videopcb", 0 ) ROM_LOAD( "5.4r", 0x0000, 0x0800, CRC(1b7febd8) SHA1(4f9ce99f05e6e207bb91f831b6bee7cf72b3d05b) ) ROM_LOAD( "6.7p", 0x0800, 0x1000, CRC(c8060ffe) SHA1(f1f975c2638e6cdf00af4a96591529c7b6684742) ) ROM_LOAD( "7.7m", 0x1800, 0x1000, CRC(bfca00f4) SHA1(797b07bab2467fe00cd85cd4477db2367a3e5a40) ) - ROM_REGION( 0x0040, "proms", 0 ) + ROM_REGION( 0x0040, "videopcb:proms", 0 ) ROM_LOAD( "moguchan.2a", 0x0000, 0x0020, CRC(e83daab3) SHA1(58b38091dfbc3f3b4ddf6c6febd98c909be89063) ) ROM_LOAD( "moguchan.2b", 0x0020, 0x0020, CRC(9abfdf40) SHA1(44c4dcdd3d79af2c4a897cc003b5287dece0313e) ) ROM_END @@ -677,12 +607,12 @@ ROM_START( percuss ) ROM_LOAD( "percuss.8", 0x0000, 0x0800, CRC(d63f56f3) SHA1(2cf9cca55fb612c9efae06e62bd6d33fdd38de57) ) ROM_LOAD( "percuss.9", 0x0800, 0x0800, CRC(e08fef2f) SHA1(af41763f200c4c660ca7230eace4f443e57e809a) ) - ROM_REGION( 0x2800, "gfx1", 0 ) + ROM_REGION( 0x2800, "videopcb", 0 ) ROM_LOAD( "percuss.10", 0x0000, 0x0800, CRC(797598aa) SHA1(6d26ed5e964b7f1b2ce651c7bf0168a730bee02f) ) ROM_LOAD( "percuss.6", 0x0800, 0x1000, CRC(5285a580) SHA1(cd7ba64706458c67166934d0fa08894fb577810b) ) ROM_LOAD( "percuss.7", 0x1800, 0x1000, CRC(8fc4175d) SHA1(0249f6324ae44142d7da2306674ed86afcccf5f2) ) - ROM_REGION( 0x0040, "proms", 0 ) + ROM_REGION( 0x0040, "videopcb:proms", 0 ) ROM_LOAD( "percus2a.prm", 0x0000, 0x0020, CRC(e2ee9637) SHA1(e4ca064793ae1dc36b2d852448162d062a2f26f8) ) ROM_LOAD( "percus2b.prm", 0x0020, 0x0020, CRC(e561b029) SHA1(7d21a3492a179f5ce541911d19e4816960547089) ) ROM_END @@ -698,12 +628,12 @@ ROM_START( bounty ) ROM_LOAD( "7.4n", 0x0000, 0x1000, CRC(45e369b8) SHA1(9799b2ece5e3b92da435255e1b49f5097d3f7972) ) ROM_LOAD( "8.4r", 0x1000, 0x1000, CRC(4f52c87d) SHA1(1738d798c341a54d293c70da7b6e4a3dfb00de38) ) - ROM_REGION( 0x2800, "gfx1", 0 ) + ROM_REGION( 0x2800, "videopcb", 0 ) ROM_LOAD( "9.4r", 0x0000, 0x0800, CRC(4b4acde5) SHA1(5ed60fe50a9ab0b8d433ee9ae5787b936ddbfbdd) ) ROM_LOAD( "5.7m", 0x0800, 0x1000, CRC(a5ce2a24) SHA1(b5469d31bda52a61cdc46349c139a7eb339ac8a7) ) ROM_LOAD( "6.7p", 0x1800, 0x1000, CRC(43183301) SHA1(9df89479396d7847ee3325649d7264e75d413add) ) - ROM_REGION( 0x0040, "proms", 0 ) + ROM_REGION( 0x0040, "videopcb:proms", 0 ) ROM_LOAD( "mb7051.2a", 0x0000, 0x0020, CRC(0de11a46) SHA1(3bc81571832dd78b29654e86479815ee5f97a4d3) ) ROM_LOAD( "mb7051.2b", 0x0020, 0x0020, CRC(465e31d4) SHA1(d47a4aa0e8931dcd8f85017ef04c2f6ad79f5725) ) ROM_END @@ -719,29 +649,20 @@ ROM_START( bounty2 ) // The PCB uses a large CPU epoxy module marked "CPU PACKII ROM_LOAD( "7.4n", 0x0000, 0x1000, CRC(45e369b8) SHA1(9799b2ece5e3b92da435255e1b49f5097d3f7972) ) ROM_LOAD( "8.4r", 0x1000, 0x1000, CRC(4f52c87d) SHA1(1738d798c341a54d293c70da7b6e4a3dfb00de38) ) - ROM_REGION( 0x2800, "gfx1", 0 ) + ROM_REGION( 0x2800, "videopcb", 0 ) ROM_LOAD( "9.4r", 0x0000, 0x0800, CRC(4b4acde5) SHA1(5ed60fe50a9ab0b8d433ee9ae5787b936ddbfbdd) ) ROM_LOAD( "5.7m", 0x0800, 0x1000, CRC(a5ce2a24) SHA1(b5469d31bda52a61cdc46349c139a7eb339ac8a7) ) ROM_LOAD( "6.7p", 0x1800, 0x1000, CRC(43183301) SHA1(9df89479396d7847ee3325649d7264e75d413add) ) - ROM_REGION( 0x0040, "proms", 0 ) + ROM_REGION( 0x0040, "videopcb:proms", 0 ) ROM_LOAD( "mb7051.2a", 0x0000, 0x0020, CRC(0de11a46) SHA1(3bc81571832dd78b29654e86479815ee5f97a4d3) ) ROM_LOAD( "mb7051.2b", 0x0020, 0x0020, CRC(465e31d4) SHA1(d47a4aa0e8931dcd8f85017ef04c2f6ad79f5725) ) ROM_END -void zodiack_state::init_zodiack() -{ - m_percuss_hardware = false; -} -void zodiack_state::init_percuss() -{ - m_percuss_hardware = true; -} - -GAME( 1983, zodiack, 0, zodiack, zodiack, zodiack_state, init_zodiack, ROT270, "Orca (Esco Trading Co., Inc. license)", "Zodiack", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) /* bullet color needs to be verified */ -GAME( 1983, dogfight, 0, zodiack, dogfight, zodiack_state, init_zodiack, ROT270, "Orca / Thunderbolt", "Dog Fight (Thunderbolt)", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) /* bullet color needs to be verified */ -GAME( 1982, moguchan, 0, zodiack, moguchan, zodiack_state, init_percuss, ROT270, "Orca (Eastern Commerce Inc. license)", "Mogu Chan (bootleg?)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) /* license copyright taken from ROM string at $0b5c */ -GAME( 1981, percuss, 0, zodiack, percuss, zodiack_state, init_percuss, ROT270, "Orca", "The Percussor", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, bounty, 0, zodiack, bounty, zodiack_state, init_percuss, ROT180, "Orca", "The Bounty (set 1)", MACHINE_SUPPORTS_SAVE ) -GAME( 1982, bounty2, bounty, zodiack, bounty, zodiack_state, init_percuss, ROT180, "Orca", "The Bounty (set 2)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // seems to use a different memory map +GAME( 1983, zodiack, 0, zodiack, zodiack, zodiack_state, empty_init, ROT270, "Orca (Esco Trading Co., Inc. license)", "Zodiack", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) /* bullet color needs to be verified */ +GAME( 1983, dogfight, 0, zodiack, dogfight, zodiack_state, empty_init, ROT270, "Orca / Thunderbolt", "Dog Fight (Thunderbolt)", MACHINE_IMPERFECT_COLORS | MACHINE_SUPPORTS_SAVE ) /* bullet color needs to be verified */ +GAME( 1982, moguchan, 0, percuss, moguchan, zodiack_state, empty_init, ROT270, "Orca (Eastern Commerce Inc. license)", "Mogu Chan (bootleg?)", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE ) /* license copyright taken from ROM string at $0b5c */ +GAME( 1981, percuss, 0, percuss, percuss, zodiack_state, empty_init, ROT270, "Orca", "The Percussor", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, bounty, 0, percuss, bounty, zodiack_state, empty_init, ROT180, "Orca", "The Bounty (set 1)", MACHINE_SUPPORTS_SAVE ) +GAME( 1982, bounty2, bounty, percuss, bounty, zodiack_state, empty_init, ROT180, "Orca", "The Bounty (set 2)", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE ) // seems to use a different memory map diff --git a/src/mame/includes/vastar.h b/src/mame/includes/vastar.h index c79c0cd2277..05a0eeaf24d 100644 --- a/src/mame/includes/vastar.h +++ b/src/mame/includes/vastar.h @@ -7,27 +7,57 @@ #include "emupal.h" -class vastar_state : public driver_device +class vastar_common_state : public driver_device { public: - vastar_state(const machine_config &mconfig, device_type type, const char *tag) : + vastar_common_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_subcpu(*this, "sub"), + m_sharedram(*this, "sharedram") + { } + + void common(machine_config &config); + + INTERRUPT_GEN_MEMBER(vblank_irq); + +protected: + virtual void machine_start() override; + + required_device m_maincpu; + required_device m_subcpu; + + required_shared_ptr m_sharedram; + + uint8_t m_nmi_mask; + + DECLARE_WRITE_LINE_MEMBER(nmi_mask_w); + + void cpu2_map(address_map &map); + void cpu2_port_map(address_map &map); + void main_port_map(address_map &map); +}; + +class vastar_state : public vastar_common_state +{ +public: + vastar_state(const machine_config &mconfig, device_type type, const char *tag) : + vastar_common_state(mconfig, type, tag), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_bg1videoram(*this, "bg1videoram"), m_bg2videoram(*this, "bg2videoram"), m_fgvideoram(*this, "fgvideoram"), - m_sprite_priority(*this, "sprite_priority"), - m_sharedram(*this, "sharedram") + m_sprite_priority(*this, "sprite_priority") { } void vastar(machine_config &config); +protected: + virtual void machine_reset() override; + virtual void video_start() override; + private: - required_device m_maincpu; - required_device m_subcpu; required_device m_gfxdecode; required_device m_palette; @@ -35,7 +65,6 @@ private: required_shared_ptr m_bg2videoram; required_shared_ptr m_fgvideoram; required_shared_ptr m_sprite_priority; - required_shared_ptr m_sharedram; // these are pointers into m_fgvideoram uint8_t* m_bg1_scroll; @@ -47,10 +76,8 @@ private: tilemap_t *m_fg_tilemap; tilemap_t *m_bg1_tilemap; tilemap_t *m_bg2_tilemap; - uint8_t m_nmi_mask; DECLARE_WRITE_LINE_MEMBER(flip_screen_w); - DECLARE_WRITE_LINE_MEMBER(nmi_mask_w); DECLARE_WRITE8_MEMBER(fgvideoram_w); DECLARE_WRITE8_MEMBER(bg1videoram_w); DECLARE_WRITE8_MEMBER(bg2videoram_w); @@ -59,19 +86,23 @@ private: TILE_GET_INFO_MEMBER(get_bg1_tile_info); TILE_GET_INFO_MEMBER(get_bg2_tile_info); - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(vblank_irq); - - void cpu2_map(address_map &map); - void cpu2_port_map(address_map &map); void main_map(address_map &map); - void main_port_map(address_map &map); +}; + +class dogfightp_state : public vastar_common_state +{ +public: + dogfightp_state(const machine_config &mconfig, device_type type, const char *tag) : + vastar_common_state(mconfig, type, tag) + { } + + void dogfightp(machine_config &config); + +private: + void dogfightp_main_map(address_map &map); }; #endif // MAME_INCLUDES_VASTAR_H diff --git a/src/mame/includes/zodiack.h b/src/mame/includes/zodiack.h index 1914c571531..e55cb393411 100644 --- a/src/mame/includes/zodiack.h +++ b/src/mame/includes/zodiack.h @@ -3,7 +3,6 @@ #include "cpu/z80/z80.h" #include "machine/gen_latch.h" -#include "emupal.h" class zodiack_state : public driver_device { @@ -12,67 +11,31 @@ public: : 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_videoram_2(*this, "videoram_2"), - m_attributeram(*this, "attributeram"), - m_spriteram(*this, "spriteram"), - m_bulletsram(*this, "bulletsram") + m_soundlatch(*this, "soundlatch") { } void zodiack(machine_config &config); + void percuss(machine_config &config); - void init_zodiack(); - void init_percuss(); +protected: + virtual void machine_start() override; + virtual void machine_reset() override; private: - // in drivers/zodiack.c DECLARE_WRITE8_MEMBER(nmi_mask_w); DECLARE_WRITE8_MEMBER(sound_nmi_enable_w); DECLARE_WRITE8_MEMBER(master_soundlatch_w); DECLARE_WRITE8_MEMBER(control_w); - // in video/zodiack.c - DECLARE_WRITE8_MEMBER(videoram_w); - DECLARE_WRITE8_MEMBER(videoram2_w); - DECLARE_WRITE8_MEMBER(attributes_w); - DECLARE_WRITE8_MEMBER(flipscreen_w); - - void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect); - void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); - // devices required_device m_maincpu; required_device m_audiocpu; - required_device m_gfxdecode; - required_device m_palette; required_device m_soundlatch; - // shared pointers - required_shared_ptr m_videoram; - required_shared_ptr m_videoram_2; - required_shared_ptr m_attributeram; - required_shared_ptr m_spriteram; - required_shared_ptr m_bulletsram; - // state - tilemap_t *m_bg_tilemap; - tilemap_t *m_fg_tilemap; uint8_t m_main_nmi_enabled; uint8_t m_sound_nmi_enabled; - bool m_percuss_hardware; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - virtual void machine_start() override; - virtual void machine_reset() override; - virtual void video_start() override; - - TILE_GET_INFO_MEMBER(get_bg_tile_info); - TILE_GET_INFO_MEMBER(get_fg_tile_info); - DECLARE_PALETTE_INIT(zodiack); INTERRUPT_GEN_MEMBER(zodiack_sound_nmi_gen); INTERRUPT_GEN_MEMBER(zodiack_main_nmi_gen); diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 385d479bcf5..ee9c0ea91cf 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -37994,6 +37994,7 @@ vaportra3 // MAA (c) 1989 Data East Corporation (World) vaportrau // MAA (c) 1989 Data East Corporation (US) @source:vastar.cpp +dogfightp // (c) 1983 Orca pprobe // Kyugo? vastar // (c) 1983 Sesame Japan vastar2 // (c) 1983 Sesame Japan diff --git a/src/mame/video/orca40c.cpp b/src/mame/video/orca40c.cpp new file mode 100644 index 00000000000..9c7d7c4d80c --- /dev/null +++ b/src/mame/video/orca40c.cpp @@ -0,0 +1,286 @@ +// license:BSD-3-Clause +// copyright-holders:Luca Elia +/*************************************************************************** + + orca40c.cpp + + ORCA OVG-40c GFX board used by at least: + * all games in zodiack.cpp + * dogfightp in vastar.cpp + +***************************************************************************/ + +#include "emu.h" +#include "screen.h" +#include "video/orca40c.h" + +#define PIXEL_CLOCK (XTAL(18'432'000)/3) + +#define HTOTAL (396) +#define HBEND (0) +#define HBSTART (256) + +#define VTOTAL (256) +#define VBEND (16) +#define VBSTART (240) + +DEFINE_DEVICE_TYPE(ORCA_OVG_40C, orca_ovg_40c_device, "orca_ovg_40c", "Orca OVG 40c video PCB") + +orca_ovg_40c_device::orca_ovg_40c_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, ORCA_OVG_40C, tag, owner, clock), + device_gfx_interface(mconfig, *this), + m_videoram(*this, "videoram"), + m_videoram_2(*this,"videoram_2"), + m_attributeram(*this, "attributeram"), + m_spriteram(*this, "spriteram"), + m_bulletsram(*this, "bulletsram"), + m_palette(*this, "palette"), + m_percuss_hardware(false), + m_flip_screen(false) +{ +} + + +/************************************* + * + * Graphics definitions + * + *************************************/ + +static const gfx_layout charlayout = +{ + 8,8, /* 8*8 chars */ + 256, /* 256 characters */ + 1, /* 1 bit per pixel */ + { 0 } , /* single bitplane */ + { 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 */ +}; + +static const gfx_layout charlayout_2 = +{ + 8,8, /* 8*8 chars */ + 256, /* 256 characters */ + 2, /* 2 bits per pixel */ + { 0, 512*8*8 }, /* The bitplanes are separate */ + { 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 */ +}; + +static const gfx_layout spritelayout = +{ + 16,16, /* 16*16 sprites */ + 64, /* 64 sprites */ + 2, /* 2 bits per pixel */ + { 0, 128*32*8 }, /* the two bitplanes are separated */ + { 0, 1, 2, 3, 4, 5, 6, 7, + 8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 }, + { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, + 16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 }, + 32*8 /* every sprite takes 32 consecutive bytes */ +}; + +static const gfx_layout bulletlayout = +{ + /* there is no gfx ROM for this one, it is generated by the hardware */ + 7,1, /* it's just 1 pixel, but we use 7*1 to position it correctly */ + 1, /* just one */ + 1, /* 1 bit per pixel */ + { 10*8*8 }, /* point to letter "A" */ + { 3, 7, 7, 7, 7, 7, 7 }, /* I "know" that this bit of the */ + { 1*8 }, /* graphics ROMs is 1 */ + 0 /* no use */ +}; + +GFXDECODE_MEMBER(orca_ovg_40c_device::gfxinfo) + GFXDECODE_DEVICE( DEVICE_SELF, 0x0000, charlayout, 8*4 , 8 ) + GFXDECODE_DEVICE( DEVICE_SELF, 0x0800, spritelayout, 0 , 8 ) + GFXDECODE_DEVICE( DEVICE_SELF, 0x0000, bulletlayout, 8*4+8*2, 1 ) + GFXDECODE_DEVICE( DEVICE_SELF, 0x1000, charlayout_2, 0 , 8 ) +GFXDECODE_END + + +//------------------------------------------------- +// device_start: Start up the device +//------------------------------------------------- + +void orca_ovg_40c_device::device_start() +{ + decode_gfx(gfxinfo); + + m_bg_tilemap = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(orca_ovg_40c_device::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + m_fg_tilemap = &machine().tilemap().create(*this, tilemap_get_info_delegate(FUNC(orca_ovg_40c_device::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); + + m_fg_tilemap->set_transparent_pen(0); + m_fg_tilemap->set_scroll_cols(32); + + save_item(NAME(m_flip_screen)); +} + +WRITE8_MEMBER(orca_ovg_40c_device::videoram_w) +{ + m_videoram[offset] = data; + m_fg_tilemap->mark_tile_dirty(offset); +} + +WRITE8_MEMBER(orca_ovg_40c_device::videoram2_w) +{ + m_videoram_2[offset] = data; + m_bg_tilemap->mark_tile_dirty(offset); +} + +WRITE8_MEMBER(orca_ovg_40c_device::attributes_w) +{ + if ((offset & 1) && m_attributeram[offset] != data) + { + int i; + + for (i = offset / 2; i < m_videoram.bytes(); i += 32) + { + m_bg_tilemap->mark_tile_dirty(i); + m_fg_tilemap->mark_tile_dirty(i); + } + } + + m_attributeram[offset] = data; +} + +WRITE8_MEMBER(orca_ovg_40c_device::flipscreen_w) +{ + m_flip_screen = ~data & 1; + + m_bg_tilemap->set_flip(m_flip_screen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); + m_fg_tilemap->set_flip(m_flip_screen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0); +} + +void orca_ovg_40c_device::palette_init(palette_device &palette) +{ + const uint8_t *color_prom = memregion("proms")->base(); + + /* create a lookup table for the palette */ + for (int i = 0; i < 0x30; i++) + { + /* red component */ + int bit0 = (color_prom[i] >> 0) & 0x01; + int bit1 = (color_prom[i] >> 1) & 0x01; + int bit2 = (color_prom[i] >> 2) & 0x01; + int r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + /* green component */ + bit0 = (color_prom[i] >> 3) & 0x01; + bit1 = (color_prom[i] >> 4) & 0x01; + bit2 = (color_prom[i] >> 5) & 0x01; + int g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + /* blue component */ + bit0 = 0; + bit1 = (color_prom[i] >> 6) & 0x01; + bit2 = (color_prom[i] >> 7) & 0x01; + int b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; + + palette.set_indirect_color(i, rgb_t(r, g, b)); + } + + /* white for bullets */ + palette.set_indirect_color(0x30, rgb_t::white()); + + for (int i = 0; i < 0x20; i++) + palette.set_pen_indirect(i, (i & 3) ? i : 0); + + for (int i = 0; i < 0x10; i += 2) + { + palette.set_pen_indirect(0x20 + i, 32 + (i / 2)); + palette.set_pen_indirect(0x21 + i, 40 + (i / 2)); + } + + /* bullet */ + palette.set_pen_indirect(0x30, 0); + palette.set_pen_indirect(0x31, 0x30); +} + +TILE_GET_INFO_MEMBER(orca_ovg_40c_device::get_bg_tile_info) +{ + int code = m_videoram_2[tile_index]; + int color = (m_attributeram[(tile_index & 0x1f) << 1 | 1] >> 4) & 0x07; + + SET_TILE_INFO_MEMBER(0, code, color, 0); +} + +TILE_GET_INFO_MEMBER(orca_ovg_40c_device::get_fg_tile_info) +{ + int code = m_videoram[tile_index]; + int color = (m_attributeram[(tile_index & 0x1f) << 1 | 1] >> 0) & 0x07; + + SET_TILE_INFO_MEMBER(3, code, color, 0); +} + +void orca_ovg_40c_device::draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect ) +{ + for (int offs = 0; offs < m_bulletsram.bytes(); offs += 4) + { + int sx = m_bulletsram[offs + 3] + 7; + int sy = m_bulletsram[offs + 1]; + + if (!(m_flip_screen && m_percuss_hardware)) + sy = 255 - sy; + + gfx(2)->transpen( + bitmap, + cliprect, + 0, /* this is just a dot, generated by the hardware */ + 0, + 0, 0, + sx, sy, 0); + } +} + +void orca_ovg_40c_device::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) +{ + for (int offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) + { + int sx = 240 - m_spriteram[offs + 3]; + int sy = 240 - m_spriteram[offs]; + int flipx = !(m_spriteram[offs + 1] & 0x40); + int flipy = m_spriteram[offs + 1] & 0x80; + int spritecode = m_spriteram[offs + 1] & 0x3f; + + if (m_flip_screen && m_percuss_hardware) + { + sy = 240 - sy; + flipy = !flipy; + } + + gfx(1)->transpen(bitmap,cliprect, + spritecode, + m_spriteram[offs + 2] & 0x07, + flipx, flipy, + sx, sy, 0); + } +} + +uint32_t orca_ovg_40c_device::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) +{ + for (int i = 0; i < 32; i++) + m_fg_tilemap->set_scrolly(i, m_attributeram[i * 2]); + + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + draw_bullets(bitmap, cliprect); + draw_sprites(bitmap, cliprect); + return 0; +} + +void orca_ovg_40c_device::device_add_mconfig(machine_config &config) +{ + /* video hardware */ + screen_device& screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_raw(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART); + screen.set_screen_update(DEVICE_SELF, FUNC(orca_ovg_40c_device::screen_update)); + screen.set_palette("palette"); + + PALETTE(config, m_palette, 4*8+2*8+2*1); + m_palette->set_indirect_entries(48+1); + m_palette->set_init(DEVICE_SELF, FUNC(orca_ovg_40c_device::palette_init)); +} diff --git a/src/mame/video/orca40c.h b/src/mame/video/orca40c.h new file mode 100644 index 00000000000..a493edf8e15 --- /dev/null +++ b/src/mame/video/orca40c.h @@ -0,0 +1,79 @@ +// license:BSD-3-Clause +// copyright-holders:Zsolt Vasvari + +/*************************************************************************** + + orca40c.h + +***************************************************************************/ + +#ifndef MAME_VIDEO_ORCA40C_H +#define MAME_VIDEO_ORCA40C_H + +#pragma once + +#include "emupal.h" + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> orca_ovg_40c_device + +class orca_ovg_40c_device : public device_t, public device_gfx_interface +{ +public: + // construction/destruction + orca_ovg_40c_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // configuration + void set_percuss_hardware(bool percuss_hardware) { m_percuss_hardware = percuss_hardware; } + + // memory handlers + DECLARE_WRITE8_MEMBER(videoram_w); + DECLARE_WRITE8_MEMBER(videoram2_w); + DECLARE_WRITE8_MEMBER(attributes_w); + DECLARE_WRITE8_MEMBER(flipscreen_w); + +protected: + // device-level overrides + virtual void device_start() override; + virtual void device_add_mconfig(machine_config &config) override; + +private: + // shared memory finders + required_shared_ptr m_videoram; + required_shared_ptr m_videoram_2; + required_shared_ptr m_attributeram; + required_shared_ptr m_spriteram; + required_shared_ptr m_bulletsram; + + // devices + required_device m_palette; + + // configuration + bool m_percuss_hardware; + + // decoding info + DECLARE_GFXDECODE_MEMBER(gfxinfo); + + // internal state + tilemap_t *m_bg_tilemap; + tilemap_t *m_fg_tilemap; + bool m_flip_screen; + + // helpers + TILE_GET_INFO_MEMBER(get_bg_tile_info); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + void palette_init(palette_device &palette); + + // drawing control + void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); +}; + +// device type definition +DECLARE_DEVICE_TYPE(ORCA_OVG_40C, orca_ovg_40c_device) + +#endif // MAME_VIDEO_ORCA40C_H diff --git a/src/mame/video/vastar.cpp b/src/mame/video/vastar.cpp index 66ccf5b06a9..cf6bc3620f2 100644 --- a/src/mame/video/vastar.cpp +++ b/src/mame/video/vastar.cpp @@ -2,7 +2,7 @@ // copyright-holders:Allard van der Bas /*************************************************************************** - vastar.c + vastar.cpp Functions to emulate the video hardware of the machine. diff --git a/src/mame/video/zodiack.cpp b/src/mame/video/zodiack.cpp deleted file mode 100644 index 79f210ac9a4..00000000000 --- a/src/mame/video/zodiack.cpp +++ /dev/null @@ -1,175 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Zsolt Vasvari -/*************************************************************************** - - video.c - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "emu.h" -#include "includes/zodiack.h" - -WRITE8_MEMBER( zodiack_state::videoram_w ) -{ - m_videoram[offset] = data; - m_fg_tilemap->mark_tile_dirty(offset); -} - -WRITE8_MEMBER( zodiack_state::videoram2_w ) -{ - m_videoram_2[offset] = data; - m_bg_tilemap->mark_tile_dirty(offset); -} - -WRITE8_MEMBER( zodiack_state::attributes_w ) -{ - if ((offset & 1) && m_attributeram[offset] != data) - { - int i; - - for (i = offset / 2; i < m_videoram.bytes(); i += 32) - { - m_bg_tilemap->mark_tile_dirty(i); - m_fg_tilemap->mark_tile_dirty(i); - } - } - - m_attributeram[offset] = data; -} - -WRITE8_MEMBER( zodiack_state::flipscreen_w ) -{ - flip_screen_set(~data & 1); -} - -PALETTE_INIT_MEMBER(zodiack_state,zodiack) -{ - const uint8_t *color_prom = memregion("proms")->base(); - int i; - - /* create a lookup table for the palette */ - for (i = 0; i < 0x30; i++) - { - int bit0, bit1, bit2; - int r, g, b; - - /* red component */ - bit0 = (color_prom[i] >> 0) & 0x01; - bit1 = (color_prom[i] >> 1) & 0x01; - bit2 = (color_prom[i] >> 2) & 0x01; - r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - /* green component */ - bit0 = (color_prom[i] >> 3) & 0x01; - bit1 = (color_prom[i] >> 4) & 0x01; - bit2 = (color_prom[i] >> 5) & 0x01; - g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - /* blue component */ - bit0 = 0; - bit1 = (color_prom[i] >> 6) & 0x01; - bit2 = (color_prom[i] >> 7) & 0x01; - b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; - - palette.set_indirect_color(i, rgb_t(r, g, b)); - } - - /* white for bullets */ - palette.set_indirect_color(0x30, rgb_t::white()); - - for (i = 0; i < 0x20; i++) - palette.set_pen_indirect(i, (i & 3) ? i : 0); - - for (i = 0; i < 0x10; i += 2) - { - palette.set_pen_indirect(0x20 + i, 32 + (i / 2)); - palette.set_pen_indirect(0x21 + i, 40 + (i / 2)); - } - - /* bullet */ - palette.set_pen_indirect(0x30, 0); - palette.set_pen_indirect(0x31, 0x30); -} - -TILE_GET_INFO_MEMBER(zodiack_state::get_bg_tile_info) -{ - int code = m_videoram_2[tile_index]; - int color = (m_attributeram[(tile_index & 0x1f) << 1 | 1] >> 4) & 0x07; - - SET_TILE_INFO_MEMBER(0, code, color, 0); -} - -TILE_GET_INFO_MEMBER(zodiack_state::get_fg_tile_info) -{ - int code = m_videoram[tile_index]; - int color = (m_attributeram[(tile_index & 0x1f) << 1 | 1] >> 0) & 0x07; - - SET_TILE_INFO_MEMBER(3, code, color, 0); -} - -void zodiack_state::video_start() -{ - m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(zodiack_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(zodiack_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); - - m_fg_tilemap->set_transparent_pen(0); - m_fg_tilemap->set_scroll_cols(32); -} - -void zodiack_state::draw_bullets( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - for (int offs = 0; offs < m_bulletsram.bytes(); offs += 4) - { - int sx = m_bulletsram[offs + 3] + 7; - int sy = m_bulletsram[offs + 1]; - - if (!(flip_screen() && m_percuss_hardware)) - sy = 255 - sy; - - m_gfxdecode->gfx(2)->transpen( - bitmap, - cliprect, - 0, /* this is just a dot, generated by the hardware */ - 0, - 0, 0, - sx, sy, 0); - } -} - -void zodiack_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - for (int offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4) - { - int sx = 240 - m_spriteram[offs + 3]; - int sy = 240 - m_spriteram[offs]; - int flipx = !(m_spriteram[offs + 1] & 0x40); - int flipy = m_spriteram[offs + 1] & 0x80; - int spritecode = m_spriteram[offs + 1] & 0x3f; - - if (flip_screen() && m_percuss_hardware) - { - sy = 240 - sy; - flipy = !flipy; - } - - m_gfxdecode->gfx(1)->transpen(bitmap,cliprect, - spritecode, - m_spriteram[offs + 2] & 0x07, - flipx, flipy, - sx, sy, 0); - } -} - -uint32_t zodiack_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect ) -{ - for (int i = 0; i < 32; i++) - m_fg_tilemap->set_scrolly(i, m_attributeram[i * 2]); - - m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - draw_bullets(bitmap, cliprect); - draw_sprites(bitmap, cliprect); - return 0; -}