From 3110a474b110501bdbca2cd00ecaf74671ba81ac Mon Sep 17 00:00:00 2001 From: angelosa Date: Wed, 2 Oct 2024 11:30:47 +0200 Subject: jaleco/acommand.cpp: cleanups --- src/mame/jaleco/acommand.cpp | 207 ++++++++++++++++++------------------------- src/mame/jaleco/jalmah.cpp | 4 +- 2 files changed, 90 insertions(+), 121 deletions(-) diff --git a/src/mame/jaleco/acommand.cpp b/src/mame/jaleco/acommand.cpp index fb512842ffc..7cc8dd9ed37 100644 --- a/src/mame/jaleco/acommand.cpp +++ b/src/mame/jaleco/acommand.cpp @@ -1,23 +1,23 @@ // license:BSD-3-Clause // copyright-holders:Angelo Salese -/******************************************************************************************* +/************************************************************************************************** Alien Command (c) 1993 Jaleco -driver by Angelo Salese - Actually same HW as the Cisco Heat ones. TODO: --Understand what "devices" area needs to make this working.It's likely that the upper switches - controls the UFO's and the lower switches the astronauts. --Back tilemap paging is likely to be incorrect. --3D Artworks for the UFO's,Astronauts etc. --Merge to the Cisco Heat driver. +- Understand what "devices" area needs to make this working. +\- Possibly the upper switches controls the UFO's and the lower switches the astronauts. +- 3D Artworks for the UFO's,Astronauts etc. +- Merge sprite chip with jaleco/cischeat.cpp +\- Uses zooming during attract, and needs pdrawgfx. Notes: --The real HW is a redemption machine with two guns, similar to the "Cosmo Gang the Video" -(Namco) redemption version. +- The real HW is a redemption machine with two guns, similar to namco/cgang.cpp. + +bp 237c4,1,{curpc+=0x10;g} ; to skip initial error checks + ; $f009a & $f009c SW state m68k irq table vectors lev 1 : 0x64 : 0000 04f0 - rte @@ -28,7 +28,7 @@ lev 5 : 0x74 : 0000 04f0 - rte lev 6 : 0x78 : 0000 04f0 - rte lev 7 : 0x7c : 0000 04f0 - rte -=========================================================================================== +=================================================================================================== Jaleco Alien Command Redemption Video Game with Guns @@ -55,16 +55,16 @@ JALMR14 BIN 524,288 02-07-99 1:17a JALMR14.BIN JALCF1 BIN 1,048,576 02-07-99 1:11a JALCF1.BIN -*******************************************************************************************/ +**************************************************************************************************/ #include "emu.h" -#include "ms1_tmap.h" - #include "cpu/m68000/m68000.h" #include "machine/timer.h" #include "sound/okim6295.h" +#include "ms1_tmap.h" + #include "emupal.h" #include "screen.h" #include "speaker.h" @@ -76,17 +76,16 @@ namespace { class acommand_state : public driver_device { public: - acommand_state(const machine_config &mconfig, device_type type, const char *tag) : - driver_device(mconfig, type, tag), - m_spriteram(*this, "spriteram"), - m_maincpu(*this, "maincpu"), - m_oki1(*this, "oki1"), - m_oki2(*this, "oki2"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette"), - m_bgtmap(*this, "bgtmap"), - m_txtmap(*this, "txtmap"), - m_digits(*this, "digit%u", 0U) + acommand_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_gfxdecode(*this, "gfxdecode") + , m_palette(*this, "palette") + , m_bgtmap(*this, "bgtmap") + , m_txtmap(*this, "txtmap") + , m_spriteram(*this, "spriteram") + , m_oki(*this, "oki%u", 1U) + , m_digits(*this, "digit%u", 0U) { } void acommand(machine_config &config); @@ -103,23 +102,20 @@ private: void ext_devices_1_w(uint16_t data); void ext_devices_2_w(uint16_t data); - void ac_unk2_w(uint16_t data); - TILEMAP_MAPPER_MEMBER(bg_scan); - uint32_t screen_update_acommand(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(acommand_scanline); + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(scanline_cb); - void acommand_map(address_map &map) ATTR_COLD; + void main_map(address_map &map) ATTR_COLD; virtual void machine_start() override ATTR_COLD; - required_shared_ptr m_spriteram; required_device m_maincpu; - required_device m_oki1; - required_device m_oki2; required_device m_gfxdecode; required_device m_palette; required_device m_bgtmap; required_device m_txtmap; + required_shared_ptr m_spriteram; + required_device_array m_oki; output_finder<8> m_digits; uint16_t m_7seg0 = 0; @@ -197,7 +193,7 @@ void acommand_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec } -uint32_t acommand_state::screen_update_acommand(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +uint32_t acommand_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // reference has black pen background, as weird it might sound bitmap.fill(m_palette->black_pen(), cliprect); @@ -210,15 +206,6 @@ uint32_t acommand_state::screen_update_acommand(screen_device &screen, bitmap_in } -/******************************************************************************************/ - -/*This is always zero ATM*/ -void acommand_state::ac_unk2_w(uint16_t data) -{ - if(data) - popmessage("UNK-2 enabled %04x",data); -} - /************************************* * * I/O @@ -227,13 +214,13 @@ void acommand_state::ac_unk2_w(uint16_t data) void acommand_state::oki_bank_w(uint8_t data) { - m_oki1->set_rom_bank(data & 0x3); - m_oki2->set_rom_bank((data & 0x30) >> 4); + m_oki[0]->set_rom_bank(data & 0x3); + m_oki[1]->set_rom_bank((data & 0x30) >> 4); } /* 0 1 2 3 4 5 6 7 8 9 a b c d e f*/ -static const uint8_t led_fill[0x10] = { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00,0x00,0x00,0x00,0x00,0x00}; +static const uint8_t led_fill[0x10] = { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x00,0x00,0x00,0x00,0x00,0x00 }; void acommand_state::output_7seg0_w(offs_t offset, uint16_t data, uint16_t mem_mask) { @@ -293,7 +280,7 @@ uint16_t acommand_state::ext_devices_0_r() void acommand_state::ext_devices_0_w(uint16_t data) { - printf("%04x EXT 0\n",data); + logerror("%04x EXT 0\n",data); m_boss_door = data & 3; m_ufo_lane[0] = (data >> 8) & 0x1f; } @@ -311,32 +298,32 @@ uint16_t acommand_state::ext_devices_1_r() void acommand_state::ext_devices_1_w(uint16_t data) { - //printf("%04x EXT 1\n",data); + //logerror("%04x EXT 1\n",data); m_ufo_lane[1] = (data >> 0) & 0x1f; m_ufo_lane[2] = (data >> 8) & 0x1f; } void acommand_state::ext_devices_2_w(uint16_t data) { - //printf("%04x EXT 2\n",data); + //logerror("%04x EXT 2\n",data); m_ufo_lane[3] = (data >> 0) & 0x1f; m_ufo_lane[4] = (data >> 8) & 0x1f; } void acommand_state::output_lamps_w(uint16_t data) { - machine().bookkeeping().coin_counter_w(0, data & 0x40); - machine().bookkeeping().coin_counter_w(1, data & 0x80); + machine().bookkeeping().coin_counter_w(0, BIT(data, 6)); + machine().bookkeeping().coin_counter_w(1, BIT(data, 7)); // --xx --xx lamps } -void acommand_state::acommand_map(address_map &map) +void acommand_state::main_map(address_map &map) { map(0x000000, 0x03ffff).rom(); map(0x082000, 0x082005).w(m_bgtmap, FUNC(megasys1_tilemap_device::scroll_w)); map(0x082100, 0x082105).w(m_txtmap, FUNC(megasys1_tilemap_device::scroll_w)); - map(0x082208, 0x082209).w(FUNC(acommand_state::ac_unk2_w)); + map(0x082208, 0x082209).noprw(); // watchdog map(0x0a0000, 0x0a3fff).ram().w(m_bgtmap, FUNC(megasys1_tilemap_device::write)).share("bgtmap"); map(0x0b0000, 0x0b3fff).ram().w(m_txtmap, FUNC(megasys1_tilemap_device::write)).share("txtmap"); map(0x0b8000, 0x0bffff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); @@ -346,8 +333,8 @@ void acommand_state::acommand_map(address_map &map) map(0x100001, 0x100001).w(FUNC(acommand_state::oki_bank_w)); map(0x100008, 0x100009).portr("IN0").w(FUNC(acommand_state::output_lamps_w)); - map(0x100014, 0x100017).rw(m_oki1, FUNC(okim6295_device::read), FUNC(okim6295_device::write)).umask16(0x00ff); - map(0x100018, 0x10001b).rw(m_oki2, FUNC(okim6295_device::read), FUNC(okim6295_device::write)).umask16(0x00ff); + map(0x100014, 0x100017).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write)).umask16(0x00ff); + map(0x100018, 0x10001b).rw(m_oki[1], FUNC(okim6295_device::read), FUNC(okim6295_device::write)).umask16(0x00ff); map(0x100040, 0x100041).rw(FUNC(acommand_state::ext_devices_0_r), FUNC(acommand_state::ext_devices_0_w)); map(0x100044, 0x100045).rw(FUNC(acommand_state::ext_devices_1_r), FUNC(acommand_state::ext_devices_1_w)); @@ -394,61 +381,47 @@ static INPUT_PORTS_START( acommand ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) PORT_START("DSW") - PORT_DIPNAME( 0x0001, 0x0001, "IN2" ) - PORT_DIPSETTING( 0x0001, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0002, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0004, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0008, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0010, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0020, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0040, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) ) + PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW3:1,2,3") + PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x0001, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x0002, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x0006, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x0005, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) ) + PORT_DIPSETTING( 0x0003, DEF_STR( 1C_5C ) ) + PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW3:4,5,6") + PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) ) + PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) ) + PORT_DIPSETTING( 0x0010, DEF_STR( 2C_1C ) ) + PORT_DIPSETTING( 0x0038, DEF_STR( 1C_1C ) ) + PORT_DIPSETTING( 0x0030, DEF_STR( 1C_2C ) ) + PORT_DIPSETTING( 0x0028, DEF_STR( 1C_3C ) ) + PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) ) + PORT_DIPSETTING( 0x0018, DEF_STR( 1C_5C ) ) + PORT_DIPUNKNOWN_DIPLOC( 0x0040, 0x0040, "SW3:7" ) + // Overrides Coinage + PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW3:8") PORT_DIPSETTING( 0x0080, DEF_STR( Off ) ) PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0100, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0200, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0400, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x0800, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x1000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x2000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x4000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) - PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) - PORT_DIPSETTING( 0x8000, DEF_STR( Off ) ) - PORT_DIPSETTING( 0x0000, DEF_STR( On ) ) + + PORT_DIPUNKNOWN_DIPLOC( 0x0100, 0x0100, "SW4:1" ) + PORT_DIPUNKNOWN_DIPLOC( 0x0200, 0x0200, "SW4:2" ) + PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW4:3") + PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x0400, DEF_STR( On ) ) + PORT_DIPUNKNOWN_DIPLOC( 0x0800, 0x0800, "SW4:4" ) + PORT_DIPUNKNOWN_DIPLOC( 0x1000, 0x1000, "SW4:5" ) + PORT_DIPUNKNOWN_DIPLOC( 0x2000, 0x2000, "SW4:6" ) + PORT_DIPUNKNOWN_DIPLOC( 0x4000, 0x4000, "SW4:7" ) + PORT_DIPUNKNOWN_DIPLOC( 0x8000, 0x8000, "SW4:8" ) INPUT_PORTS_END static GFXDECODE_START( gfx_acommand ) GFXDECODE_ENTRY( "gfx3", 0, gfx_8x8x4_col_2x2_group_packed_msb, 0x1800, 256 ) GFXDECODE_END -TIMER_DEVICE_CALLBACK_MEMBER(acommand_state::acommand_scanline) +TIMER_DEVICE_CALLBACK_MEMBER(acommand_state::scanline_cb) { int scanline = param; @@ -461,18 +434,14 @@ TIMER_DEVICE_CALLBACK_MEMBER(acommand_state::acommand_scanline) void acommand_state::acommand(machine_config &config) { - /* basic machine hardware */ M68000(config, m_maincpu, 12000000); - m_maincpu->set_addrmap(AS_PROGRAM, &acommand_state::acommand_map); - TIMER(config, "scantimer").configure_scanline(FUNC(acommand_state::acommand_scanline), "screen", 0, 1); + m_maincpu->set_addrmap(AS_PROGRAM, &acommand_state::main_map); + TIMER(config, "scantimer").configure_scanline(FUNC(acommand_state::scanline_cb), "screen", 0, 1); - /* video hardware */ screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); - screen.set_refresh_hz(60); - 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(acommand_state::screen_update_acommand)); + // assume same as armchmp2 + screen.set_raw(XTAL(12'000'000)/2,396,0,256,256,16,240); + screen.set_screen_update(FUNC(acommand_state::screen_update)); screen.set_palette(m_palette); GFXDECODE(config, m_gfxdecode, m_palette, gfx_acommand); @@ -481,17 +450,17 @@ void acommand_state::acommand(machine_config &config) MEGASYS1_TILEMAP(config, m_bgtmap, m_palette, 0x0f00); MEGASYS1_TILEMAP(config, m_txtmap, m_palette, 0x2700); - /* sound hardware */ + // assume amplified stereo SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - OKIM6295(config, m_oki1, 2112000, okim6295_device::PIN7_HIGH); // clock frequency & pin 7 not verified - m_oki1->add_route(ALL_OUTPUTS, "lspeaker", 1.0); - m_oki1->add_route(ALL_OUTPUTS, "rspeaker", 1.0); + OKIM6295(config, m_oki[0], 2112000, okim6295_device::PIN7_HIGH); // clock frequency & pin 7 not verified + m_oki[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.0); + m_oki[0]->add_route(ALL_OUTPUTS, "rspeaker", 1.0); - OKIM6295(config, m_oki2, 2112000, okim6295_device::PIN7_HIGH); // clock frequency & pin 7 not verified - m_oki2->add_route(ALL_OUTPUTS, "lspeaker", 1.0); - m_oki2->add_route(ALL_OUTPUTS, "rspeaker", 1.0); + OKIM6295(config, m_oki[1], 2112000, okim6295_device::PIN7_HIGH); // clock frequency & pin 7 not verified + m_oki[1]->add_route(ALL_OUTPUTS, "lspeaker", 1.0); + m_oki[1]->add_route(ALL_OUTPUTS, "rspeaker", 1.0); } /*************************************************************************** @@ -534,4 +503,4 @@ ROM_END } // anonymous namespace -GAMEL( 1994, acommand, 0, acommand, acommand, acommand_state, empty_init, ROT0, "Jaleco", "Alien Command" , MACHINE_NOT_WORKING | MACHINE_MECHANICAL, layout_acommand ) +GAMEL( 1994, acommand, 0, acommand, acommand, acommand_state, empty_init, ROT0, "Jaleco", "Alien Command (v2.1)", MACHINE_NOT_WORKING | MACHINE_MECHANICAL, layout_acommand ) diff --git a/src/mame/jaleco/jalmah.cpp b/src/mame/jaleco/jalmah.cpp index 0235d4c022b..b6617e1c820 100644 --- a/src/mame/jaleco/jalmah.cpp +++ b/src/mame/jaleco/jalmah.cpp @@ -110,12 +110,12 @@ OSC: 12.000MHz #include "emu.h" -#include "ms1_tmap.h" - #include "cpu/m68000/m68000.h" #include "machine/timer.h" #include "sound/okim6295.h" +#include "ms1_tmap.h" + #include "emupal.h" #include "screen.h" #include "speaker.h" -- cgit v1.2.3