summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/jaleco/fcombat.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/jaleco/fcombat.cpp')
-rw-r--r--src/mame/jaleco/fcombat.cpp344
1 files changed, 173 insertions, 171 deletions
diff --git a/src/mame/jaleco/fcombat.cpp b/src/mame/jaleco/fcombat.cpp
index ae2b1f8c9af..f9d09d69517 100644
--- a/src/mame/jaleco/fcombat.cpp
+++ b/src/mame/jaleco/fcombat.cpp
@@ -1,34 +1,34 @@
// license:BSD-3-Clause
-// copyright-holders: Tomasz Slanina
+// copyright-holders: David Haywood, Tomasz Slanina
/* Field Combat (c)1985 Jaleco
- TS 2004.10.22.
- - fixed sprite issues
- - added backgrounds and terrain info (external ROMs)
+Hardware has similarities with Exerion
- (press buttons 1+2 at the same time, to release 'army' ;)
+TS 2004.10.22.
+- fixed sprite issues
+- added backgrounds and terrain info (external ROMs)
- todo:
- - fix colours (sprites , bg)
-*/
+(press buttons 1+2 at the same time, to release 'army' ;)
+
+TODO:
+- verify sprite colors, not many PCB references online, but comparing with
+ the small amount of photos that are there, they match
-/*
-Field Combat (c)1985 Jaleco
+PCB Notes:
From a working board.
+Label: FC8524
CPU: Z80 (running at 3.332 MHz measured at pin 6)
Sound: Z80 (running at 3.332 MHz measured at pin 6), YM2149 (x3)
-Other: Unmarked 24 pin near ROMs 2 & 3
+Other: Unmarked 24 pin near ROMs 2 & 3 (maybe same protection chip as dday?)
RAM: 6116 (x3)
X-TAL: 20 MHz
-inputs + notes by stephh
-
*/
#include "emu.h"
@@ -36,6 +36,7 @@ inputs + notes by stephh
#include "cpu/z80/z80.h"
#include "machine/gen_latch.h"
#include "sound/ay8910.h"
+#include "video/resnet.h"
#include "emupal.h"
#include "screen.h"
@@ -43,16 +44,6 @@ inputs + notes by stephh
#include "tilemap.h"
-// configurable logging
-#define LOG_PALETTEBANK (1U << 1)
-
-//#define VERBOSE (LOG_GENERAL | LOG_PALETTEBANK)
-
-#include "logmacro.h"
-
-#define LOGPALETTEBANK(...) LOGMASKED(LOG_PALETTEBANK, __VA_ARGS__)
-
-
namespace {
class fcombat_state : public driver_device
@@ -64,7 +55,7 @@ public:
m_spriteram(*this, "spriteram"),
m_bgdata_rom(*this, "bgdata"),
m_terrain_rom(*this, "terrain_info"),
- m_io_in(*this, "IN%u", 0U),
+ m_inputs(*this, "IN%u", 0U),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette")
@@ -78,24 +69,23 @@ public:
protected:
virtual void machine_start() override;
- virtual void machine_reset() override;
virtual void video_start() override;
private:
- /* memory pointers */
+ // memory pointers
required_shared_ptr<u8> m_videoram;
required_shared_ptr<u8> m_spriteram;
required_region_ptr<u8> m_bgdata_rom;
required_region_ptr<u8> m_terrain_rom;
-
- required_ioport_array<2> m_io_in;
+ required_ioport_array<3> m_inputs;
// video-related
tilemap_t *m_bgmap = nullptr;
- u8 m_cocktail_flip = 0U;
- u8 m_char_palette = 0U;
- u8 m_sprite_palette = 0U;
- u8 m_char_bank = 0U;
+ tilemap_t *m_fgmap = nullptr;
+ u8 m_cocktail_flip = 0;
+ u8 m_char_palette = 0;
+ u8 m_char_bank = 0;
+ u8 m_sprite_bank = 0;
// misc
u8 m_fcombat_sh = 0;
@@ -118,7 +108,9 @@ private:
u8 e300_r();
void ee00_w(u8 data);
void videoreg_w(u8 data);
+ void videoram_w(offs_t offset, u8 data);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
+ TILE_GET_INFO_MEMBER(get_fg_tile_info);
void fcombat_palette(palette_device &palette) const;
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void audio_map(address_map &map);
@@ -126,8 +118,6 @@ private:
};
-// video
-
// this is copied from Exerion, but it should be correct
static constexpr XTAL MASTER_CLOCK = 20_MHz_XTAL;
static constexpr XTAL CPU_CLOCK = MASTER_CLOCK / 6;
@@ -136,29 +126,11 @@ static constexpr XTAL PIXEL_CLOCK = MASTER_CLOCK / 3;
static constexpr int HCOUNT_START = 0x58;
static constexpr int HTOTAL = 512 - HCOUNT_START;
static constexpr int HBEND = 12 * 8; // ??
-static constexpr int HBSTART = 52 * 8; //
+static constexpr int HBSTART = 52 * 8; // ??
static constexpr int VTOTAL = 256;
static constexpr int VBEND = 16;
static constexpr int VBSTART = 240;
-static constexpr int BACKGROUND_X_START = 32;
-static constexpr int BACKGROUND_X_START_FLIP = 72;
-
-static constexpr int VISIBLE_X_MIN = 12 * 8;
-static constexpr int VISIBLE_X_MAX = 52 * 8;
-static constexpr int VISIBLE_Y_MIN = 2 * 8;
-static constexpr int VISIBLE_Y_MAX = 30 * 8;
-
-
-TILE_GET_INFO_MEMBER(fcombat_state::get_bg_tile_info)
-{
- //int palno = (tile_index - (tile_index / 32 * 16) * 32 * 16) / 32;
-
- const int tileno = m_bgdata_rom[tile_index];
- const int palno = 0x18; //m_terrain_rom[tile_index] >> 3;
- tileinfo.set(2, tileno, palno, 0);
-}
-
/***************************************************************************
@@ -180,6 +152,15 @@ TILE_GET_INFO_MEMBER(fcombat_state::get_bg_tile_info)
void fcombat_state::fcombat_palette(palette_device &palette) const
{
const u8 *color_prom = memregion("proms")->base();
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
+
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
+ compute_resistor_weights(0, 255, -1.0,
+ 3, &resistances_rg[0], rweights, 0, 0,
+ 3, &resistances_rg[0], gweights, 0, 0,
+ 2, &resistances_b[0], bweights, 0, 0);
// create a lookup table for the palette
for (int i = 0; i < 0x20; i++)
@@ -190,19 +171,18 @@ void fcombat_state::fcombat_palette(palette_device &palette) const
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
- const u8 r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = combine_weights(rweights, bit0, bit1, bit2);
// green component
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
- const u8 g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = combine_weights(gweights, bit0, bit1, bit2);
// blue component
- bit0 = 0;
- bit1 = BIT(color_prom[i], 6);
- bit2 = BIT(color_prom[i], 7);
- const u8 b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
@@ -213,14 +193,14 @@ void fcombat_state::fcombat_palette(palette_device &palette) const
// fg chars/sprites
for (int i = 0; i < 0x200; i++)
{
- const u8 ctabentry = (color_prom[(i & 0x1c0) | ((i & 3) << 4) | ((i >> 2) & 0x0f)] & 0x0f) | 0x10;
+ const u8 ctabentry = (color_prom[(i & 0x1c0) | bitswap<6>(i,1,0,5,4,3,2)] & 0x0f) | 0x10;
palette.set_pen_indirect(i, ctabentry);
}
- // bg chars (this is not the full story... there are four layers mixed using another PROM)
+ // bg chars
for (int i = 0x200; i < 0x300; i++)
{
- const u8 ctabentry = color_prom[i] & 0x0f;
+ const u8 ctabentry = color_prom[(i & 0x3c0) | bitswap<6>(i,1,0,5,4,3,2)] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
@@ -234,9 +214,34 @@ void fcombat_state::fcombat_palette(palette_device &palette) const
void fcombat_state::video_start()
{
+ m_fgmap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(fcombat_state::get_fg_tile_info)), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
+ m_fgmap->set_transparent_pen(0);
+
m_bgmap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(fcombat_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS, 16, 16, 32 * 8 * 2, 32);
}
+TILE_GET_INFO_MEMBER(fcombat_state::get_bg_tile_info)
+{
+ const int tileno = m_bgdata_rom[tile_index];
+ const int palno = (tileno >> 2 & 3) | (tileno >> 4 & 0xc);
+
+ tileinfo.set(2, tileno, palno, 0);
+}
+
+TILE_GET_INFO_MEMBER(fcombat_state::get_fg_tile_info)
+{
+ const int tileno = m_videoram[tile_index] | (m_char_bank << 8);
+ const int palno = (tileno >> 4 & 0xf) | (m_char_palette << 4);
+
+ tileinfo.set(0, tileno, palno, 0);
+}
+
+void fcombat_state::videoram_w(offs_t offset, u8 data)
+{
+ m_videoram[offset] = data;
+ m_fgmap->mark_tile_dirty(offset);
+}
+
/*************************************
*
@@ -246,20 +251,25 @@ void fcombat_state::video_start()
void fcombat_state::videoreg_w(u8 data)
{
- // bit 0 = flip screen and joystick input multiplexer
+ // bit 0: flip screen and joystick input multiplexer
m_cocktail_flip = data & 1;
+ flip_screen_set(m_cocktail_flip);
- // bits 1-2 char lookup table bank
- m_char_palette = (data & 0x06) >> 1;
-
- // bits 3 char bank
- m_char_bank = (data & 0x08) >> 3;
+ // bits 1-2: char lookup table bank
+ // bit 3: char bank
+ u8 char_pal = (data & 0x06) >> 1;
+ u8 char_bank = (data & 0x08) >> 3;
+ if (m_char_palette != char_pal || m_char_bank != char_bank)
+ {
+ m_char_palette = char_pal;
+ m_char_bank = char_bank;
+ m_fgmap->mark_all_dirty();
+ }
- // bits 4-5 unused
+ // bits 4-5: unused
- // bits 6-7 sprite lookup table bank
- m_sprite_palette = 0; //(data & 0xc0) >> 6;
- LOGPALETTEBANK("sprite palette bank: %02x", data);
+ // bits 6-7: heli sprite block bank
+ m_sprite_bank = data >> 6 & 3;
}
@@ -267,80 +277,84 @@ u32 fcombat_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, co
{
// draw background
m_bgmap->set_scrolly(0, m_fcombat_sh);
- m_bgmap->set_scrollx(0, m_fcombat_sv - 24);
+ if (m_cocktail_flip)
+ m_bgmap->set_scrollx(0, m_fcombat_sv + 8 - 2);
+ else
+ m_bgmap->set_scrollx(0, m_fcombat_sv - 8);
- m_bgmap->mark_all_dirty();
- m_bgmap->draw(screen, bitmap, cliprect, 0, 0);
- //draw_background(bitmap, cliprect);
+ m_bgmap->draw(screen, bitmap, cliprect);
// draw sprites
for (int i = 0; i < m_spriteram.bytes(); i += 4)
{
const int flags = m_spriteram[i + 0];
- int y = m_spriteram[i + 1] ^ 255;
+ int y = 256 - m_spriteram[i + 1];
int code = m_spriteram[i + 2] + ((flags & 0x20) << 3);
- int x = m_spriteram[i + 3] * 2 + 72;
+ int x = m_spriteram[i + 3] * 2 + (flags & 0x01) + 52;
int xflip = flags & 0x80;
int yflip = flags & 0x40;
- const bool doubled = false;// flags & 0x10;
- const bool wide = flags & 0x08;
- int code2 = code;
- const int color = ((flags >> 1) & 0x03) | ((code >> 5) & 0x04) | (code & 0x08) | (m_sprite_palette * 16);
+ const int color = ((flags >> 1) & 0x03) | ((code >> 5) & 0x04) | (code & 0x08) | (code >> 4 & 0x10);
gfx_element *gfx = m_gfxdecode->gfx(1);
- if (m_cocktail_flip)
+ if ((code & 0x108) == 0x108)
{
- x = 64 * 8 - gfx->width() - x;
- y = 32 * 8 - gfx->height() - y;
- if (wide) y -= gfx->height();
- xflip = !xflip;
- yflip = !yflip;
+ static constexpr int mask[4] = { 0x308, 0x300, 0x08, 0x00 };
+ code ^= mask[m_sprite_bank];
}
- if (wide)
+ if (m_cocktail_flip)
{
- if (yflip)
- code |= 0x10, code2 &= ~0x10;
- else
- code &= ~0x10, code2 |= 0x10;
-
- gfx->transpen(bitmap, cliprect, code2, color, xflip, yflip, x, y + gfx->height(), 0);
+ x = 64 * 8 - gfx->width() - x + 2;
+ y = 32 * 8 - gfx->height() - y + 2;
+ xflip = !xflip;
+ yflip = !yflip;
}
- if (flags & 0x10)
+ switch (flags >> 3 & 3)
{
- gfx->transpen(bitmap, cliprect, code2 + 16, color, xflip, yflip, x, y + gfx->height(), 0);
- gfx->transpen(bitmap, cliprect, code2 + 16 * 2, color, xflip, yflip, x, y + 2 * gfx->height(), 0);
- gfx->transpen(bitmap, cliprect, code2 + 16 * 3, color, xflip, yflip, x, y + 3 * gfx->height(), 0);
-
+ // 16x16
+ case 0:
+ gfx->transpen(bitmap, cliprect, code, color, xflip, yflip, x, y, 0);
+ break;
+
+ // 16x32
+ case 1:
+ if (m_cocktail_flip)
+ y -= 16;
+ code &= ~0x10;
+
+ gfx->transpen(bitmap, cliprect, code | (yflip ? 16 : 0), color, xflip, yflip, x, y, 0);
+ gfx->transpen(bitmap, cliprect, code | (yflip ? 0 : 16), color, xflip, yflip, x, y + 16, 0);
+ break;
+
+ // 16x64
+ case 2:
+ if (m_cocktail_flip)
+ y -= 48;
+ code &= ~0x30;
+
+ for (int j = 0; j < 4; j++)
+ {
+ int co = 16 * (j ^ (yflip ? 3 : 0));
+ gfx->transpen(bitmap, cliprect, code | co, color, xflip, yflip, x, y + j * 16, 0);
+ }
+ break;
+
+ // unused
+ case 3:
+ break;
}
-
- gfx->transpen(bitmap, cliprect, code, color, xflip, yflip, x, y, 0);
-
- if (doubled) i += 4;
}
- // draw the visible text layer
- for (int sy = VISIBLE_Y_MIN / 8; sy < VISIBLE_Y_MAX / 8; sy++)
- for (int sx = VISIBLE_X_MIN / 8; sx < VISIBLE_X_MAX / 8; sx++)
- {
- const int x = m_cocktail_flip ? (63 * 8 - 8 * sx) : 8 * sx;
- const int y = m_cocktail_flip ? (31 * 8 - 8 * sy) : 8 * sy;
-
- const int offs = sx + sy * 64;
- m_gfxdecode->gfx(0)->transpen(bitmap, cliprect,
- m_videoram[offs] + 256 * m_char_bank,
- ((m_videoram[offs] & 0xf0) >> 4) + m_char_palette * 16,
- m_cocktail_flip, m_cocktail_flip, x, y, 0);
- }
+ // draw text layer
+ m_fgmap->draw(screen, bitmap, cliprect);
+
return 0;
}
-// machine
-
INPUT_CHANGED_MEMBER(fcombat_state::coin_inserted)
{
// coin insertion causes an NMI
@@ -366,11 +380,12 @@ u8 fcombat_state::protection_r()
u8 fcombat_state::port01_r()
{
// the cocktail flip bit muxes between ports 0 and 1
- return m_io_in[m_cocktail_flip ? 1 : 0]->read();
+ u8 start = m_inputs[0]->read() & 0xc0;
+ return (m_inputs[(m_cocktail_flip & 1) + 1]->read() & 0x3f) | start;
}
-//bg scrolls
+// bg scrolls
void fcombat_state::e900_w(u8 data)
{
@@ -410,26 +425,27 @@ u8 fcombat_state::e300_r()
void fcombat_state::ee00_w(u8 data)
{
+ // related to protection ? - doesn't seem to have any effect
}
void fcombat_state::main_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
map(0xc000, 0xc7ff).ram();
- map(0xd000, 0xd7ff).ram().share(m_videoram);
+ map(0xd000, 0xd7ff).ram().share(m_videoram).w(FUNC(fcombat_state::videoram_w));
map(0xd800, 0xd8ff).ram().share(m_spriteram);
map(0xe000, 0xe000).r(FUNC(fcombat_state::port01_r));
map(0xe100, 0xe100).portr("DSW0");
map(0xe200, 0xe200).portr("DSW1");
map(0xe300, 0xe300).r(FUNC(fcombat_state::e300_r));
- map(0xe400, 0xe400).r(FUNC(fcombat_state::protection_r)); // protection?
- map(0xe800, 0xe800).w(FUNC(fcombat_state::videoreg_w)); // at least bit 0 for flip screen and joystick input multiplexer
+ map(0xe400, 0xe400).r(FUNC(fcombat_state::protection_r));
+ map(0xe800, 0xe800).w(FUNC(fcombat_state::videoreg_w));
map(0xe900, 0xe900).w(FUNC(fcombat_state::e900_w));
map(0xea00, 0xea00).w(FUNC(fcombat_state::ea00_w));
map(0xeb00, 0xeb00).w(FUNC(fcombat_state::eb00_w));
map(0xec00, 0xec00).w(FUNC(fcombat_state::ec00_w));
map(0xed00, 0xed00).w(FUNC(fcombat_state::ed00_w));
- map(0xee00, 0xee00).w(FUNC(fcombat_state::ee00_w)); // related to protection ? - doesn't seem to have any effect
+ map(0xee00, 0xee00).w(FUNC(fcombat_state::ee00_w));
map(0xef00, 0xef00).w("soundlatch", FUNC(generic_latch_8_device::write));
}
@@ -455,25 +471,25 @@ void fcombat_state::audio_map(address_map &map)
*************************************/
static INPUT_PORTS_START( fcombat )
- PORT_START("IN0") // player 1 inputs (muxed on 0xe000)
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
+ PORT_START("IN0")
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
- PORT_START("IN1") // player 2 inputs (muxed on 0xe000)
- PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
- PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
- PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
- PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
- PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
- PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
- PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START1 )
- PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START2 )
+ PORT_START("IN1") // player 1 inputs (muxed on 0xe000)
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 )
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
+
+ PORT_START("IN2") // player 2 inputs (muxed on 0xe000)
+ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
+ PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
+ PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
+ PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
+ PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_COCKTAIL
+ PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_COCKTAIL
PORT_START("DSW0") // dip switches (0xe100)
PORT_DIPNAME( 0x07, 0x02, DEF_STR( Lives ) )
@@ -488,7 +504,7 @@ static INPUT_PORTS_START( fcombat )
PORT_DIPSETTING( 0x08, "20000" )
PORT_DIPSETTING( 0x10, "30000" )
PORT_DIPSETTING( 0x18, "40000" )
- PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) )
+ PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unused ) )
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x20, DEF_STR( On ) )
PORT_DIPNAME( 0x40, 0x00, DEF_STR( Unused ) )
@@ -500,10 +516,11 @@ static INPUT_PORTS_START( fcombat )
PORT_START("DSW1") // dip switches/VBLANK (0xe200)
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen")
- PORT_DIPNAME( 0x02, 0x00, DEF_STR( Unknown ) ) // related to vblank
- PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
- PORT_DIPSETTING( 0x02, DEF_STR( On ) )
- PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Coinage ) )
+ PORT_DIPNAME( 0x0e, 0x00, DEF_STR( Coinage ) )
+ PORT_DIPSETTING( 0x0e, DEF_STR( 5C_1C ) )
+ PORT_DIPSETTING( 0x0a, DEF_STR( 4C_1C ) )
+ PORT_DIPSETTING( 0x06, DEF_STR( 3C_1C ) )
+ PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 1C_3C ) )
@@ -532,8 +549,7 @@ static const gfx_layout charlayout =
16*8
};
-
-/* 16 x 16 sprites -- requires reorganizing characters in init_fcombat() */
+// 16 x 16 sprites -- requires reorganizing characters in init_fcombat()
static const gfx_layout spritelayout =
{
16,16,
@@ -545,7 +561,6 @@ static const gfx_layout spritelayout =
64*8
};
-
static GFXDECODE_START( gfx_fcombat )
GFXDECODE_ENTRY( "fgtiles", 0, charlayout, 0, 64 )
GFXDECODE_ENTRY( "sprites", 0, spritelayout, 256, 64 )
@@ -564,26 +579,14 @@ void fcombat_state::machine_start()
{
save_item(NAME(m_cocktail_flip));
save_item(NAME(m_char_palette));
- save_item(NAME(m_sprite_palette));
save_item(NAME(m_char_bank));
+ save_item(NAME(m_sprite_bank));
save_item(NAME(m_fcombat_sh));
save_item(NAME(m_fcombat_sv));
save_item(NAME(m_tx));
save_item(NAME(m_ty));
}
-void fcombat_state::machine_reset()
-{
- m_cocktail_flip = 0;
- m_char_palette = 0;
- m_sprite_palette = 0;
- m_char_bank = 0;
- m_fcombat_sh = 0;
- m_fcombat_sv = 0;
- m_tx = 0;
- m_ty = 0;
-}
-
void fcombat_state::fcombat(machine_config &config)
{
// basic machine hardware
@@ -607,13 +610,12 @@ void fcombat_state::fcombat(machine_config &config)
GENERIC_LATCH_8(config, "soundlatch");
- YM2149(config, "ay1", 1'500'000).add_route(ALL_OUTPUTS, "mono", 0.12); // TODO: should this and the following be CPU_CLOCK / 2?
-
- YM2149(config, "ay2", 1'500'000).add_route(ALL_OUTPUTS, "mono", 0.12);
-
- YM2149(config, "ay3", 1'500'000).add_route(ALL_OUTPUTS, "mono", 0.12);
+ YM2149(config, "ay1", AY8910_CLOCK).add_route(ALL_OUTPUTS, "mono", 0.25);
+ YM2149(config, "ay2", AY8910_CLOCK).add_route(ALL_OUTPUTS, "mono", 0.25);
+ YM2149(config, "ay3", AY8910_CLOCK).add_route(ALL_OUTPUTS, "mono", 0.25);
}
+
/*************************************
*
* Driver initialization
@@ -634,6 +636,7 @@ void fcombat_state::init_fcombat()
/* decode the characters
the bits in the ROM are ordered: n8-n7 n6 n5 n4-v2 v1 v0 n3-n2 n1 n0 h2
we want them ordered like this: n8-n7 n6 n5 n4-n3 n2 n1 n0-v2 v1 v0 h2 */
+
for (u32 oldaddr = 0; oldaddr < length; oldaddr++)
{
u32 newaddr = ((oldaddr ) & 0x1f00) | // keep n8-n4
@@ -695,7 +698,6 @@ void fcombat_state::init_fcombat()
memcpy(&dst[oldaddr * 32 * 8 * 2 + 32 * 8], &src[oldaddr * 32 * 8 + 0x2000], 32 * 8);
}
-
src = &temp[0];
dst = memregion("terrain_info")->base();
length = memregion("terrain_info")->bytes();
@@ -736,11 +738,11 @@ ROM_START( fcombat )
ROM_REGION( 0x0420, "proms", 0 )
ROM_LOAD( "fcprom_a.c2", 0x0000, 0x0020, CRC(7ac480f0) SHA1(f491fe4da19d8c037e3733a5836de35cc438907e) ) // palette
ROM_LOAD( "fcprom_d.k12", 0x0020, 0x0100, CRC(9a348250) SHA1(faf8db4c42adee07795d06bea20704f8c51090ff) ) // fg char lookup table
- ROM_LOAD( "fcprom_b.c4", 0x0120, 0x0100, CRC(ac9049f6) SHA1(57aa5b5df3e181bad76149745a422c3dd1edad49) ) // sprite lookup table
- ROM_LOAD( "fcprom_c.a9", 0x0220, 0x0100, CRC(768ac120) SHA1(ceede1d6cbeae08da96ef52bdca2718a839d88ab) ) // bg char mixer
+ ROM_LOAD( "fcprom_c.a9", 0x0120, 0x0100, CRC(768ac120) SHA1(ceede1d6cbeae08da96ef52bdca2718a839d88ab) ) // sprite lookup table
+ ROM_LOAD( "fcprom_b.c4", 0x0220, 0x0100, CRC(ac9049f6) SHA1(57aa5b5df3e181bad76149745a422c3dd1edad49) ) // bg char lookup table
ROM_END
} // anonymous namespace
-GAME( 1985, fcombat, 0, fcombat, fcombat, fcombat_state, init_fcombat, ROT90, "Jaleco", "Field Combat", MACHINE_WRONG_COLORS | MACHINE_SUPPORTS_SAVE )
+GAME( 1985, fcombat, 0, fcombat, fcombat, fcombat_state, init_fcombat, ROT90, "Jaleco", "Field Combat", MACHINE_SUPPORTS_SAVE )