diff --git a/src/mame/midway/williams.cpp b/src/mame/midway/williams.cpp index aef8ed98ea2..33cb34d7fc0 100644 --- a/src/mame/midway/williams.cpp +++ b/src/mame/midway/williams.cpp @@ -1654,8 +1654,10 @@ void williams_state::joust(machine_config &config) void williams_state::splat(machine_config &config) { williams_base(config); - WILLIAMS_BLITTER_SC2(config, m_blitter, 0xc000, m_maincpu, m_videoram); williams_muxed(config); + + WILLIAMS_BLITTER_SC2(config, m_blitter, 0xc000, m_maincpu, m_videoram); + m_maincpu->set_addrmap(AS_PROGRAM, &williams_state::main_map_blitter); } void williams_state::alienar(machine_config &config) diff --git a/src/mame/midway/williams_m.cpp b/src/mame/midway/williams_m.cpp index d7f60a1df0d..87e1774a553 100644 --- a/src/mame/midway/williams_m.cpp +++ b/src/mame/midway/williams_m.cpp @@ -24,7 +24,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(williams_state::va11_callback) if (scanline == 256) return; - /* the IRQ signal comes into CB1, and is set to VA11 */ + // the IRQ signal comes into CB1, and is set to VA11 m_pia[1]->cb1_w(BIT(scanline, 5)); } @@ -88,7 +88,7 @@ void williams2_state::machine_start() { williams_state::machine_start(); - /* configure memory banks */ + // configure memory banks m_mainbank->configure_entries(0, 4, memregion("maincpu")->base() + 0x10000, 0x8000); } @@ -97,7 +97,7 @@ void williams2_state::machine_reset() { williams_state::machine_reset(); - /* make sure our banking is reset */ + // make sure our banking is reset bank_select_w(0); } @@ -111,29 +111,29 @@ void williams2_state::machine_reset() void williams_state::vram_select_w(u8 data) { - /* VRAM/ROM banking from bit 0 */ + // VRAM/ROM banking from bit 0 if (BIT(data, 0)) m_rom_view.select(0); else m_rom_view.disable(); - /* cocktail flip from bit 1 */ + // cocktail flip from bit 1 m_cocktail = BIT(data, 1); } void williams2_state::bank_select_w(u8 data) { - /* the low two bits control the paging */ + // the low two bits control the paging switch (data & 0x03) { - /* page 0 is video ram */ + // page 0 is video ram case 0: m_rom_view.disable(); m_palette_view.disable(); break; - /* pages 1 and 2 are ROM */ + // pages 1 and 2 are ROM case 1: case 2: m_mainbank->set_entry((data & 6) >> 1); @@ -141,7 +141,7 @@ void williams2_state::bank_select_w(u8 data) m_palette_view.disable(); break; - /* page 3 accesses palette RAM; the remaining areas are as if page 1 ROM was selected */ + // page 3 accesses palette RAM; the remaining areas are as if page 1 ROM was selected case 3: m_mainbank->set_entry((data & 4) >> 1); m_rom_view.select(0); @@ -246,7 +246,7 @@ void williams_state::cmos_4bit_w(offs_t offset, u8 data) void williams_state::watchdog_reset_w(u8 data) { - /* yes, the data bits are checked for this specific value */ + // yes, the data bits are checked for this specific value if (data == 0x39) m_watchdog->watchdog_reset(); } @@ -254,7 +254,7 @@ void williams_state::watchdog_reset_w(u8 data) void williams2_state::watchdog_reset_w(u8 data) { - /* yes, the data bits are checked for this specific value */ + // yes, the data bits are checked for this specific value if ((data & 0x3f) == 0x14) m_watchdog->watchdog_reset(); } @@ -353,11 +353,11 @@ void defender_state::bank_select_w(u8 data) u8 mayday_state::protection_r(offs_t offset) { - /* Mayday does some kind of protection check that is not currently understood */ - /* However, the results of that protection check are stored at $a190 and $a191 */ - /* These are compared against $a193 and $a194, respectively. Thus, to prevent */ - /* the protection from resetting the machine, we just return $a193 for $a190, */ - /* and $a194 for $a191. */ + // Mayday does some kind of protection check that is not currently understood + // However, the results of that protection check are stored at $a190 and $a191 + // These are compared against $a193 and $a194, respectively. Thus, to prevent + // the protection from resetting the machine, we just return $a193 for $a190, + // and $a194 for $a191. return m_videoram[0xa193 + offset]; } @@ -409,6 +409,12 @@ void blaster_state::machine_reset() } +void blaster_state::video_control_w(u8 data) +{ + m_video_control = data; +} + + void blaster_state::blaster_vram_select_w(u8 data) { // VRAM/ROM banking from bit 0 @@ -495,20 +501,16 @@ void tshoot_state::machine_start() void tshoot_state::maxvol_w(int state) { - /* something to do with the sound volume */ + // something to do with the sound volume logerror("tshoot maxvol = %d (%s)\n", state, machine().describe_context()); } void tshoot_state::lamp_w(u8 data) { - /* set the grenade lamp */ m_grenade_lamp = BIT(~data, 2); - /* set the gun lamp */ m_gun_lamp = BIT(~data, 3); - /* gun coil */ m_p1_gun_recoil = BIT(data, 4); - /* feather coil */ m_feather_blower = BIT(data, 5); } diff --git a/src/mame/midway/williams_v.cpp b/src/mame/midway/williams_v.cpp index 75eb1c7fa76..e49503d426b 100644 --- a/src/mame/midway/williams_v.cpp +++ b/src/mame/midway/williams_v.cpp @@ -169,6 +169,7 @@ void williams_state::video_start() void blaster_state::video_start() { williams_state::video_start(); + save_item(NAME(m_color0)); save_item(NAME(m_video_control)); } @@ -178,7 +179,7 @@ void williams2_state::video_start() { williams_state::video_start(); - /* create the tilemap */ + // create the tilemap m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(williams2_state::get_tile_info)), TILEMAP_SCAN_COLS, 24,16, 128,16); m_bg_tilemap->set_scrolldx(2, 0); @@ -227,35 +228,35 @@ uint32_t blaster_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma uint8_t const *const scanline_control = &m_videoram[0xbc00]; rgb_t pens[16]; - /* precompute the palette */ + // precompute the palette for (int x = 0; x < 16; x++) pens[x] = m_palette->pen_color(m_paletteram[x]); - /* if we're blitting from the top, start with a 0 for color 0 */ + // if we're blitting from the top, start with a 0 for color 0 if (cliprect.min_y == screen.visible_area().min_y || !(m_video_control & 1)) m_color0 = m_palette->pen_color(palette_0[0] ^ 0xff); - /* loop over rows */ + // loop over rows for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { int const erase_behind = m_video_control & scanline_control[y] & 2; uint8_t *const source = &m_videoram[y]; uint32_t *const dest = &bitmap.pix(y); - /* latch a new color0 pen? */ + // latch a new color0 pen? if (m_video_control & scanline_control[y] & 1) m_color0 = m_palette->pen_color(palette_0[y] ^ 0xff); - /* loop over columns */ + // loop over columns for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { uint8_t const pix = source[(x/2) * 256]; - /* clear behind us if requested */ + // clear behind us if requested if (erase_behind) source[(x/2) * 256] = 0; - /* now draw */ + // now draw dest[x+0] = (pix & 0xf0) ? pens[pix >> 4] : rgb_t(m_color0 | pens[0]); dest[x+1] = (pix & 0x0f) ? pens[pix & 0x0f] : rgb_t(m_color0 | pens[0]); } @@ -268,20 +269,20 @@ uint32_t williams2_state::screen_update(screen_device &screen, bitmap_rgb32 &bit { rgb_t pens[16]; - /* draw the background */ + // draw the background m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - /* fetch the relevant pens */ + // fetch the relevant pens for (int x = 1; x < 16; x++) pens[x] = m_palette->pen_color(m_fg_color * 16 + x); - /* loop over rows */ + // loop over rows for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { uint8_t const *const source = &m_videoram[y]; uint32_t *const dest = &bitmap.pix(y); - /* loop over columns */ + // loop over columns for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { uint8_t const pix = source[(x/2) * 256]; @@ -300,21 +301,21 @@ uint32_t mysticm_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma { rgb_t pens[16]; - /* draw the background */ + // draw the background m_bg_tilemap->mark_all_dirty(); m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0); - /* loop over rows */ + // loop over rows for (int y = cliprect.min_y; y <= cliprect.max_y; y++) { - /* fetch the relevant pens */ + // fetch the relevant pens for (int x = 1; x < 16; x++) pens[x] = m_palette->pen_color(color_decode(m_fg_color, 1, y) * 16 + x); uint8_t const *const source = &m_videoram[y]; uint32_t *const dest = &bitmap.pix(y); - /* loop over columns */ + // loop over columns for (int x = cliprect.min_x & ~1; x <= cliprect.max_x; x += 2) { uint8_t const pix = source[(x/2) * 256]; @@ -422,7 +423,6 @@ rgb_t williams2_state::calc_col(uint16_t lo, uint16_t hi) }; // update the palette entry - const uint16_t i = (hi >> 4) & 15; const uint16_t ub = (hi >> 0) & 15; const uint16_t ug = (lo >> 4) & 15; @@ -449,10 +449,10 @@ rgb_t williams2_state::calc_col(uint16_t lo, uint16_t hi) void williams2_state::paletteram_w(offs_t offset, u8 data) { - /* set the new value */ + // set the new value m_paletteram[offset] = data; - /* pull the associated low/high bytes */ + // pull the associated low/high bytes uint16_t entry_lo = m_paletteram[offset & ~1]; uint16_t entry_hi = m_paletteram[offset | 1]; @@ -510,7 +510,7 @@ TILE_GET_INFO_MEMBER(williams2_state::get_tile_info) int const data = m_tileram[tile_index]; int const y = (tile_index >> 1) & 7; - /* On tshoot and inferno, IC79 is a 74LS157 selector jumpered to be enabled */ + // On tshoot and inferno, IC79 is a 74LS157 selector jumpered to be enabled int const color = y; tileinfo.set(0, data & mask, color, (data & ~mask) ? TILE_FLIPX : 0); @@ -539,7 +539,7 @@ int mysticm_state::color_decode(uint8_t base_col, int sig_J1, int y) // FIXME: Investigate further. - /* IC79 is a 74LS85 comparator that controls the low bit */ + // IC79 is a 74LS85 comparator that controls the low bit int const a = 1 | ((base_col & 1) << 2) | ((base_col & 1) << 3); int const b = (sig_W12 << 0) | (sig_W13 << 1) | (0 << 2) | (sig_J1 << 3); int const color = (a > b) || ((a == b) && !sig_W11); @@ -575,31 +575,31 @@ TILE_GET_INFO_MEMBER(joust2_state::get_tile_info) int const mask = m_gfxdecode->gfx(0)->elements() - 1; int const data = m_tileram[tile_index]; - /* IC79 is a 74LS157 selector jumpered to be disabled */ + // IC79 is a 74LS157 selector jumpered to be disabled int const color = 0; tileinfo.set(0, data & mask, color, (data & ~mask) ? TILE_FLIPX : 0); } -/* based on the board type, only certain bits are used */ -/* the rest are determined by other factors */ +// based on the board type, only certain bits are used +// the rest are determined by other factors void williams2_state::bg_select_w(u8 data) { - /* IC79 is a 74LS157 selector jumpered to be enabled */ + // IC79 is a 74LS157 selector jumpered to be enabled m_bg_tilemap->set_palette_offset((data & 0x38) << 4); } void mysticm_state::bg_select_w(u8 data) { - /* IC79 is a 74LS85 comparator that controls the low bit */ + // IC79 is a 74LS85 comparator that controls the low bit m_bg_color = data; m_bg_tilemap->mark_all_dirty(); } void joust2_state::bg_select_w(u8 data) { - /* IC79 is a 74LS157 selector jumpered to be disabled */ + // IC79 is a 74LS157 selector jumpered to be disabled m_bg_tilemap->set_palette_offset((data & 0x3f) << 4); } @@ -622,16 +622,3 @@ void williams2_state::xscroll_high_w(u8 data) m_tilemap_xscroll = (m_tilemap_xscroll & 0x00f) | (data << 4); m_bg_tilemap->set_scrollx(0, (m_tilemap_xscroll & 7) + ((m_tilemap_xscroll >> 3) * 6)); } - - - -/************************************* - * - * Blaster-specific enhancements - * - *************************************/ - -void blaster_state::video_control_w(u8 data) -{ - m_video_control = data; -} diff --git a/src/mame/midway/wmg.cpp b/src/mame/midway/wmg.cpp index 0a7cf9e787d..5e221e2288b 100644 --- a/src/mame/midway/wmg.cpp +++ b/src/mame/midway/wmg.cpp @@ -65,7 +65,6 @@ The game works perfectly. However the code is a bit of a bodge-job, originally f then updated for HBMAME 0.148u1. It could do with a cleanup, and removal of the various hacks. Support of save-state is also needed. - ***********************************************************************************************************/ #include "emu.h" @@ -135,6 +134,7 @@ private: * Address Map * *************************************/ + void wmg_state::wmg_cpu1(address_map &map) { map(0x0000, 0xbfff).ram().share(m_videoram); @@ -168,6 +168,7 @@ void wmg_state::wmg_cpu2(address_map &map) map(0xf000, 0xffff).bankr(m_soundbank); } + /*************************************************************** * * Inputs, banked. One set for each game. @@ -176,6 +177,7 @@ void wmg_state::wmg_cpu2(address_map &map) * JOYSTICK PLAYER(2) is really JOYSTICKRIGHT on WMG hardware * ***************************************************************/ + static INPUT_PORTS_START( wmg ) PORT_START("IN0") PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_CUSTOM_MEMBER(FUNC(wmg_state::wmg_mux_r<0>)) @@ -193,7 +195,7 @@ static INPUT_PORTS_START( wmg ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_TILT ) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) -/* menu */ + /* menu */ PORT_START("X0") // IN000 (game,port,player) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_NAME("Menu/Left/Up") PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_NAME("Menu/Left/Down") @@ -214,7 +216,7 @@ static INPUT_PORTS_START( wmg ) PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Menu/Reverse") PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Menu/Inviso or Flap") -/* robotron */ + /* robotron */ PORT_START("X2") // IN100 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_NAME("Robotron/Left/Move Up") PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_NAME("Robotron/Left/Move Down") @@ -230,7 +232,7 @@ static INPUT_PORTS_START( wmg ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICKRIGHT_RIGHT ) PORT_8WAY PORT_NAME("Robotron/Right/Fire Right") PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNKNOWN ) -/* joust */ + /* joust */ PORT_START("X4") // IN201 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_2WAY PORT_PLAYER(1) PORT_NAME("Joust/P1/Left") PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_2WAY PORT_PLAYER(1) PORT_NAME("Joust/P1/Right") @@ -250,7 +252,7 @@ static INPUT_PORTS_START( wmg ) PORT_START("X6") // IN210 PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNUSED ) -/* stargate */ + /* stargate */ PORT_START("X7") // IN300 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Stargate/Fire") PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Stargate/Thrust") @@ -266,7 +268,7 @@ static INPUT_PORTS_START( wmg ) PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Stargate/Inviso") PORT_BIT( 0xfc, IP_ACTIVE_HIGH, IPT_UNKNOWN ) -/* bubbles */ + /* bubbles */ PORT_START("X9") // IN400 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_NAME("Bubbles/Up") PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_NAME("Bubbles/Down") @@ -279,7 +281,7 @@ static INPUT_PORTS_START( wmg ) PORT_START("X10") // IN410 PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNKNOWN ) -/* defender */ + /* defender */ PORT_START("X11") // IN500 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Defender/Fire") PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Defender/Thrust") @@ -294,7 +296,7 @@ static INPUT_PORTS_START( wmg ) PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_2WAY PORT_NAME("Defender/Up") PORT_BIT( 0xfe, IP_ACTIVE_HIGH, IPT_UNKNOWN ) -/* splat - there are no P2 controls, so it can only be played by a single player */ + /* splat - there are no P2 controls, so it can only be played by a single player */ PORT_START("X13") // IN601 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("Splat/P1/Left/Move Up") PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("Splat/P1/Left/Move Down") @@ -319,6 +321,7 @@ static INPUT_PORTS_START( wmg ) PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_UNKNOWN ) INPUT_PORTS_END + /************************************* * * Bankswitching @@ -430,6 +433,7 @@ void wmg_state::machine_reset() m_maincpu->reset(); } + /************************************* * * Input selector code @@ -458,7 +462,7 @@ ioport_value wmg_state::wmg_mux_r() u8 wmg_state::wmg_pia_0_r(offs_t offset) { -/* if player presses P1 and P2 in a game, return to the menu. + /* if player presses P1 and P2 in a game, return to the menu. Since there is no code in rom to handle this, it must be a hardware feature which probably just resets the cpu. */ @@ -476,6 +480,7 @@ u8 wmg_state::wmg_pia_0_r(offs_t offset) return data; } + /************************************* * * Machine Driver @@ -542,11 +547,13 @@ void wmg_state::wmg(machine_config &config) WILLIAMS_BLITTER_SC1(config, m_blitter, 0xc000, m_maincpu, m_videoram); } + /************************************* * * Roms * *************************************/ + ROM_START( wmg ) ROM_REGION( 0x80000, "maincpu", 0 ) ROM_LOAD( "wmg.cpu", 0x00000, 0x80000, CRC(975516ec) SHA1(571aaf9bff8ebfc36448cd9394b47bcfae7d1b83) )