- midway/balsente.cpp: fixed ROM names and documents label format for various sets [Brian Troha]

- edevices/mugsmash.cpp,  edevices/stlforce.cpp, kiwako/mrjong.cpp: consolidated drivers in single files, minor cleanups
This commit is contained in:
Ivan Vangelista 2022-10-27 18:06:20 +02:00
parent 8c959fb811
commit 96d879e9f6
9 changed files with 1300 additions and 1055 deletions

View File

@ -1,14 +1,15 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
// copyright-holders: David Haywood
/* Mug Smashers (c)199? Electronic Devices (Italy) / 3D Games (England)
driver by David Haywood - Dip Switches and Inputs by stephh
a side scrolling beat-em-up, borrows ideas from Combatribes, including
the music (apparently) and sound hardware!
there is also a Spanish company logo in the graphic roms
there is also a Spanish company logo in the graphic ROMs
a 1990 copyright can be found in the sound program so its 1990 at the
a 1990 copyright can be found in the sound program so it's 1990 at the
earliest
*/
@ -35,27 +36,207 @@ dsw note:
the DSW ports are a bit odd, from reading the test mode it appears the
board has 2 physical dipswitches, however these are mapped over multiple
real addresses, obviously this gives us two ways of dealing with them,
USE_FAKE_INPUT_PORTS is used at compile time to give an option of which
behavior we use .
real addresses.
*/
#include "emu.h"
#include "mugsmash.h"
#include "cpu/z80/z80.h"
#include "cpu/m68000/m68000.h"
#include "cpu/z80/z80.h"
#include "machine/gen_latch.h"
#include "sound/okim6295.h"
#include "sound/ymopm.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"
void mugsmash_state::mugsmash_reg2_w(offs_t offset, uint16_t data)
// configurable logging
#define LOG_REGS1 (1U << 1)
#define LOG_REGS2 (1U << 2)
//#define VERBOSE (LOG_GENERAL | LOG_REGS1 | LOG_REGS2)
#include "logmacro.h"
#define LOGREGS1(...) LOGMASKED(LOG_REGS1, __VA_ARGS__)
#define LOGREGS2(...) LOGMASKED(LOG_REGS2, __VA_ARGS__)
namespace {
class mugsmash_state : public driver_device
{
m_regs2[offset] = data;
//popmessage ("Regs2 %04x, %04x, %04x, %04x", m_regs2[0], m_regs2[1], m_regs2[2], m_regs2[3]);
public:
mugsmash_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_videoram(*this, "videoram%u", 1U),
m_regs(*this, "regs%u", 1U),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch") { }
void mugsmash(machine_config &config);
protected:
virtual void video_start() override;
private:
required_shared_ptr_array<uint16_t, 2> m_videoram;
required_shared_ptr_array<uint16_t, 2> m_regs;
required_shared_ptr<uint16_t> m_spriteram;
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
tilemap_t *m_tilemap[2]{};
void reg_w(offs_t offset, uint16_t data);
void reg2_w(offs_t offset, uint16_t data);
template <uint8_t Which> void videoram_w(offs_t offset, uint16_t data);
template <uint8_t Which> TILE_GET_INFO_MEMBER(get_tile_info);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void main_map(address_map &map);
void sound_map(address_map &map);
};
// video
void mugsmash_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
// Each Sprite takes 16 bytes, 5 used?
// ---- ---- xxxx xxxx ---- ---- aaaa aaaa ---- ---- NNNN NNNN ---- ---- nnnn nnnn ---- ---- yyyy yyyy (rest unused?)
/* x = xpos LSB
y = ypos LSB
N = tile number MSB
n = tile number LSB
a = attribute / extra
f?XY cccc
f = x-flip
? = unknown, probably y-flip
X = xpos MSB
y = ypos MSB
c = colour
*/
const uint16_t *source = m_spriteram;
const uint16_t *finish = source + 0x2000;
gfx_element *gfx = m_gfxdecode->gfx(0);
while (source < finish)
{
int xpos = source[0] & 0x00ff;
int ypos = source[4] & 0x00ff;
int const num = (source[3] & 0x00ff) | ((source[2] & 0x00ff) << 8);
int const attr = source[1];
int const flipx = (attr & 0x0080) >> 7;
int const colour = (attr & 0x000f);
xpos += ((attr & 0x0020) >> 5) * 0x100;
ypos += ((attr & 0x0010) >> 4) * 0x100;
xpos -= 28;
ypos -= 16;
gfx->transpen(
bitmap,
cliprect,
num,
colour,
flipx, 0,
xpos, ypos, 0
);
source += 0x8;
}
}
template <uint8_t Which>
TILE_GET_INFO_MEMBER(mugsmash_state::get_tile_info)
{
// fF-- cccc nnnn nnnn
/* c = colour?
n = number?
F = flip-X
f = flip-Y
*/
int const tileno = m_videoram[Which][tile_index * 2 + 1];
int const colour = m_videoram[Which][tile_index * 2] & 0x000f;
int const fx = (m_videoram[Which][tile_index * 2] & 0xc0) >> 6;
tileinfo.set(1, tileno, 16 * Which + colour, TILE_FLIPYX(fx));
}
template <uint8_t Which>
void mugsmash_state::videoram_w(offs_t offset, uint16_t data)
{
m_videoram[Which][offset] = data;
m_tilemap[Which]->mark_tile_dirty(offset / 2);
}
void mugsmash_state::reg_w(offs_t offset, uint16_t data)
{
m_regs[0][offset] = data;
LOGREGS1("Regs %04x, %04x, %04x, %04x", m_regs[0][0], m_regs[0][1], m_regs[0][2], m_regs[0][3]);
switch (offset)
{
case 0:
m_tilemap[1]->set_scrollx(0, m_regs[0][2] + 7);
break;
case 1:
m_tilemap[1]->set_scrolly(0, m_regs[0][3] + 4);
break;
case 2:
m_tilemap[0]->set_scrollx(0, m_regs[0][0] + 3);
break;
case 3:
m_tilemap[0]->set_scrolly(0, m_regs[0][1] + 4);
break;
}
}
void mugsmash_state::video_start()
{
m_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mugsmash_state::get_tile_info<0>)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_tilemap[0]->set_transparent_pen(0);
m_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mugsmash_state::get_tile_info<1>)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
}
uint32_t mugsmash_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0);
m_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect);
return 0;
}
// machine
void mugsmash_state::reg2_w(offs_t offset, uint16_t data)
{
m_regs[1][offset] = data;
LOGREGS2("Regs2 %04x, %04x, %04x, %04x", m_regs[1][0], m_regs[1][1], m_regs[1][2], m_regs[1][3]);
switch (offset)
{
@ -148,55 +329,24 @@ void mugsmash_state::mugsmash_reg2_w(offs_t offset, uint16_t data)
*/
#define USE_FAKE_INPUT_PORTS 0
#if USE_FAKE_INPUT_PORTS
uint16_t mugsmash_state::mugsmash_input_ports_r(offs_t offset)
{
uint16_t data = 0xffff;
switch (offset)
{
case 0 :
data = (ioport("P1")->read() & 0xff) | ((ioport("DSW1")->read() & 0xc0) << 6) | ((ioport("IN0")->read() & 0x03) << 8);
break;
case 1 :
data = (ioport("P2")->read() & 0xff) | ((ioport("DSW1")->read() & 0x3f) << 8);
break;
case 2 :
data = ((ioport("DSW2")->read() & 0x3f) << 8);
break;
case 3 :
data = ((ioport("DSW2")->read() & 0xc0) << 2);
break;
}
return (data);
}
#endif
void mugsmash_state::mugsmash_map(address_map &map)
void mugsmash_state::main_map(address_map &map)
{
map(0x000000, 0x07ffff).rom();
map(0x080000, 0x080fff).ram().w(FUNC(mugsmash_state::mugsmash_videoram1_w)).share("videoram1");
map(0x082000, 0x082fff).ram().w(FUNC(mugsmash_state::mugsmash_videoram2_w)).share("videoram2");
map(0x0c0000, 0x0c0007).w(FUNC(mugsmash_state::mugsmash_reg_w)).share("regs1"); /* video registers*/
map(0x080000, 0x080fff).ram().w(FUNC(mugsmash_state::videoram_w<0>)).share(m_videoram[0]);
map(0x082000, 0x082fff).ram().w(FUNC(mugsmash_state::videoram_w<1>)).share(m_videoram[1]);
map(0x0c0000, 0x0c0007).w(FUNC(mugsmash_state::reg_w)).share(m_regs[0]); // video registers
map(0x100000, 0x1005ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x140000, 0x140007).w(FUNC(mugsmash_state::mugsmash_reg2_w)).share("regs2"); /* sound + ? */
map(0x1c0000, 0x1c3fff).ram(); /* main ram? */
map(0x140000, 0x140007).w(FUNC(mugsmash_state::reg2_w)).share(m_regs[1]); // sound + ?
map(0x1c0000, 0x1c3fff).ram(); // main RAM?
map(0x1c4000, 0x1cffff).ram();
map(0x200000, 0x203fff).ram().share("spriteram"); /* sprite ram */
#if USE_FAKE_INPUT_PORTS
map(0x180000, 0x180007).r(FUNC(mugsmash_state::mugsmash_input_ports_r));
#else
map(0x200000, 0x203fff).ram().share(m_spriteram);
map(0x180000, 0x180001).portr("IN0");
map(0x180002, 0x180003).portr("IN1");
map(0x180004, 0x180005).portr("IN2");
map(0x180006, 0x180007).portr("IN3");
#endif
}
void mugsmash_state::mugsmash_sound_map(address_map &map)
void mugsmash_state::sound_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
map(0x8000, 0x87ff).ram();
@ -206,80 +356,16 @@ void mugsmash_state::mugsmash_sound_map(address_map &map)
}
#define MUGSMASH_PLAYER_INPUT( player, start ) \
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(player) PORT_8WAY \
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(player) PORT_8WAY \
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(player) PORT_8WAY \
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(player) PORT_8WAY \
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(player) \
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(player) \
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(player) \
PORT_BIT( 0x0080, IP_ACTIVE_LOW, start )
#if USE_FAKE_INPUT_PORTS
static INPUT_PORTS_START( mugsmash )
PORT_START("P1") /* Fake IN0 (player 1 inputs) */
MUGSMASH_PLAYER_INPUT( 1, IPT_START1 )
PORT_START("P2") /* Fake IN1 (player 2 inputs) */
MUGSMASH_PLAYER_INPUT( 2, IPT_START2 )
PORT_START("IN0") /* Fake IN2 (system inputs) */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0xfc, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("DSW1") /* Fake IN3 (SW1) */
PORT_SERVICE( 0x01, IP_ACTIVE_LOW ) PORT_DIPLOCATION("DSW1:1") // SW1-1
PORT_DIPNAME( 0x0e, 0x00, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DSW1:2,3,4") // SW1-2 to SW1-4
PORT_DIPSETTING( 0x0c, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0a, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x06, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0e, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0x10, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("DSW1:5") // SW1-5
PORT_DIPSETTING( 0x10, DEF_STR( No ) )
PORT_DIPSETTING( 0x00, DEF_STR( Yes ) )
PORT_DIPNAME( 0x20, 0x20, "Sound Test" ) PORT_DIPLOCATION("DSW1:6") // SW1-6 (in "test mode" only)
PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x40, 0x40, "Color Test" ) PORT_DIPLOCATION("DSW1:7") // SW1-7 (in "test mode" only)
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x80, 0x80, "Draw SF." ) PORT_DIPLOCATION("DSW1:8") // SW1-8 (in "test mode" only)
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("DSW2") /* Fake IN4 (SW2) */
PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("DSW2:1") // SW2-1
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x06, 0x02, DEF_STR( Lives ) ) PORT_DIPLOCATION("DSW2:2,3") // SW2-2 and SW2-3
PORT_DIPSETTING( 0x00, "1" )
PORT_DIPSETTING( 0x02, "2" )
PORT_DIPSETTING( 0x04, "3" )
PORT_DIPSETTING( 0x06, "4" )
PORT_DIPUNUSED_DIPLOC( 0x08, 0x08, "DSW2:4" )
PORT_DIPNAME( 0x30, 0x10, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("DSW2:5,6") // SW2-5 and SW2-6
PORT_DIPSETTING( 0x00, DEF_STR( Very_Easy) )
PORT_DIPSETTING( 0x10, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x20, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x30, DEF_STR( Very_Hard ) )
PORT_DIPNAME( 0x40, 0x40, "Draw Objects" ) PORT_DIPLOCATION("DSW2:7") // SW2-7 (in "test mode" only)
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x80, 0x80, "Freeze" ) PORT_DIPLOCATION("DSW2:8") // SW2-8 (= "Screen Pause" in "test mode")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
INPUT_PORTS_END
#else
static INPUT_PORTS_START( mugsmash )
PORT_START("IN0") /* IN0 - $180000.w */
MUGSMASH_PLAYER_INPUT( 1, IPT_START1 )
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1) PORT_8WAY
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1) PORT_8WAY
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1) PORT_8WAY
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNUSED )
@ -294,7 +380,14 @@ static INPUT_PORTS_START( mugsmash )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("IN1") /* IN1 - $180002.w */
MUGSMASH_PLAYER_INPUT( 2, IPT_START2 )
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2) PORT_8WAY
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2) PORT_8WAY
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2) PORT_8WAY
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2) PORT_8WAY
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2 )
PORT_SERVICE( 0x0100, IP_ACTIVE_LOW ) // SW1-1
PORT_DIPNAME( 0x0e00, 0x0000, DEF_STR( Coinage ) ) // SW1-2 to SW1-4
PORT_DIPSETTING( 0x0c00, DEF_STR( 4C_1C ) )
@ -364,7 +457,6 @@ static INPUT_PORTS_START( mugsmash )
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
#endif
static const gfx_layout mugsmash_layout =
{
@ -390,22 +482,18 @@ static const gfx_layout mugsmash2_layout =
};
static GFXDECODE_START( gfx_mugsmash )
GFXDECODE_ENTRY( "gfx1", 0, mugsmash_layout, 0x00, 16 ) /* sprites */
GFXDECODE_ENTRY( "gfx2", 0, mugsmash2_layout, 0x100, 256 ) /* bg tiles */
GFXDECODE_ENTRY( "sprites", 0, mugsmash_layout, 0x00, 16 )
GFXDECODE_ENTRY( "bgtiles", 0, mugsmash2_layout, 0x100, 256 )
GFXDECODE_END
void mugsmash_state::machine_start()
{
}
void mugsmash_state::mugsmash(machine_config &config)
{
M68000(config, m_maincpu, 12000000);
m_maincpu->set_addrmap(AS_PROGRAM, &mugsmash_state::mugsmash_map);
M68000(config, m_maincpu, 12'000'000);
m_maincpu->set_addrmap(AS_PROGRAM, &mugsmash_state::main_map);
m_maincpu->set_vblank_int("screen", FUNC(mugsmash_state::irq6_line_hold));
Z80(config, m_audiocpu, 4000000); /* Guess */
m_audiocpu->set_addrmap(AS_PROGRAM, &mugsmash_state::mugsmash_sound_map);
Z80(config, m_audiocpu, 4'000'000); // guess
m_audiocpu->set_addrmap(AS_PROGRAM, &mugsmash_state::sound_map);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
@ -413,7 +501,7 @@ void mugsmash_state::mugsmash(machine_config &config)
screen.set_vblank_time(ATTOSECONDS_IN_USEC(0));
screen.set_size(40*8, 32*8);
screen.set_visarea(0*8, 40*8-1, 1*8, 31*8-1);
screen.set_screen_update(FUNC(mugsmash_state::screen_update_mugsmash));
screen.set_screen_update(FUNC(mugsmash_state::screen_update));
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_mugsmash);
@ -426,29 +514,29 @@ void mugsmash_state::mugsmash(machine_config &config)
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
ym2151_device &ymsnd(YM2151(config, "ymsnd", 3579545));
ym2151_device &ymsnd(YM2151(config, "ymsnd", 3'579'545));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
ymsnd.add_route(0, "lspeaker", 1.00); /* music */
ymsnd.add_route(0, "lspeaker", 1.00); // music
ymsnd.add_route(1, "rspeaker", 1.00);
okim6295_device &oki(OKIM6295(config, "oki", 1122000, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified
oki.add_route(ALL_OUTPUTS, "lspeaker", 0.50); /* sound fx */
okim6295_device &oki(OKIM6295(config, "oki", 1'122'000, okim6295_device::PIN7_HIGH)); // clock frequency & pin 7 not verified
oki.add_route(ALL_OUTPUTS, "lspeaker", 0.50); // sound fx
oki.add_route(ALL_OUTPUTS, "rspeaker", 0.50);
}
ROM_START( mugsmash )
ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 Code */
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "mugs_04.bin", 0x00000, 0x40000, CRC(2498fd27) SHA1(7b746efe8aaf346e4489118ac2a3fc9929a55b83) )
ROM_LOAD16_BYTE( "mugs_05.bin", 0x00001, 0x40000, CRC(95efb40b) SHA1(878c0a3754aa728f58044c6a7f243724b718fe1b) )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 Code */
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "mugs_03.bin", 0x00000, 0x10000 , CRC(0101df2d) SHA1(35e1efa4a11c0f9d9db5ee057926e5de29c3a4c1) )
ROM_REGION( 0x040000, "oki", 0 ) /* Samples */
ROM_REGION( 0x040000, "oki", 0 ) // samples
ROM_LOAD( "mugs_02.bin", 0x00000, 0x20000, CRC(f92a7f4a) SHA1(3717ef64876be9ada378b449749918ce9072073a) )
ROM_LOAD( "mugs_01.bin", 0x20000, 0x20000, CRC(1a3a0b39) SHA1(8847530027cf4be03ffbc6d78dee97b459d03a04) )
ROM_REGION( 0x300000, "gfx1", 0 ) /* Sprites */
ROM_REGION( 0x300000, "sprites", 0 )
ROM_LOAD16_BYTE( "mugs_11.bin", 0x000000, 0x080000, CRC(1c9f5acf) SHA1(dd8329ed05a3467844c26d3f89ffb6213aba2034) )
ROM_LOAD16_BYTE( "mugs_10.bin", 0x000001, 0x080000, CRC(6b3c22d9) SHA1(7ba6d754c08ed5b2be282ffd6a674c3a4aa0e9b2) )
ROM_LOAD16_BYTE( "mugs_09.bin", 0x100000, 0x080000, CRC(4e9490f3) SHA1(e5f195c9bee3b92c559d1100c1019473a30ba28e) )
@ -456,11 +544,14 @@ ROM_START( mugsmash )
ROM_LOAD16_BYTE( "mugs_07.bin", 0x200000, 0x080000, CRC(9e3167fd) SHA1(8c73c26e8e50e8f2ee3307f5aef23caba90c22eb) )
ROM_LOAD16_BYTE( "mugs_06.bin", 0x200001, 0x080000, CRC(8df75d29) SHA1(d0add24ac974da4636d2631f5590516de0f8df4a) )
ROM_REGION( 0x200000, "gfx2", 0 ) /* BG Tiles */
ROM_REGION( 0x200000, "bgtiles", 0 )
ROM_LOAD( "mugs_12.bin", 0x000000, 0x080000, CRC(c0a6ed98) SHA1(13850c6bcca65bdc782040c470c4966aee19551d) )
ROM_LOAD( "mugs_13.bin", 0x080000, 0x080000, CRC(e2be8595) SHA1(077b1a262c54acf74e6ec37702bcfed41bc31000) )
ROM_LOAD( "mugs_14.bin", 0x100000, 0x080000, CRC(24e81068) SHA1(1e33aa7d2b873dd13d5823880c46d3d3e867d6b6) )
ROM_LOAD( "mugs_15.bin", 0x180000, 0x080000, CRC(82e8187c) SHA1(c7a0e1b3d90dbbe2588886a27a07a9c336447ae3) )
ROM_END
} // anonymous namespace
GAME( 1990?, mugsmash, 0, mugsmash, mugsmash, mugsmash_state, empty_init, ROT0, "Electronic Devices Italy / 3D Games England", "Mug Smashers", MACHINE_SUPPORTS_SAVE )

View File

@ -1,54 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
#include "machine/gen_latch.h"
#include "emupal.h"
#include "tilemap.h"
class mugsmash_state : public driver_device
{
public:
mugsmash_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_videoram1(*this, "videoram1"),
m_videoram2(*this, "videoram2"),
m_regs1(*this, "regs1"),
m_regs2(*this, "regs2"),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch") { }
void mugsmash(machine_config &config);
private:
required_shared_ptr<uint16_t> m_videoram1;
required_shared_ptr<uint16_t> m_videoram2;
required_shared_ptr<uint16_t> m_regs1;
required_shared_ptr<uint16_t> m_regs2;
required_shared_ptr<uint16_t> m_spriteram;
tilemap_t *m_tilemap1 = nullptr;
tilemap_t *m_tilemap2 = nullptr;
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
void mugsmash_reg2_w(offs_t offset, uint16_t data);
void mugsmash_videoram1_w(offs_t offset, uint16_t data);
void mugsmash_videoram2_w(offs_t offset, uint16_t data);
void mugsmash_reg_w(offs_t offset, uint16_t data);
TILE_GET_INFO_MEMBER(get_mugsmash_tile_info1);
TILE_GET_INFO_MEMBER(get_mugsmash_tile_info2);
virtual void machine_start() override;
virtual void video_start() override;
uint32_t screen_update_mugsmash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
void mugsmash_map(address_map &map);
void mugsmash_sound_map(address_map &map);
};

View File

@ -1,148 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
/* video/mugsmash.c - see drivers/mugsmash.c for more info */
#include "emu.h"
#include "mugsmash.h"
void mugsmash_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
{
/* Each Sprite takes 16 bytes, 5 used? */
/* ---- ---- xxxx xxxx ---- ---- aaaa aaaa ---- ---- NNNN NNNN ---- ---- nnnn nnnn ---- ---- yyyy yyyy (rest unused?) */
/* x = xpos LSB
y = ypos LSB
N = tile number MSB
n = tile number LSB
a = attribute / extra
f?XY cccc
f = x-flip
? = unknown, probably y-flip
X = xpos MSB
y = ypos MSB
c = colour
*/
const uint16_t *source = m_spriteram;
const uint16_t *finish = source + 0x2000;
gfx_element *gfx = m_gfxdecode->gfx(0);
while (source < finish)
{
int xpos = source[0] & 0x00ff;
int ypos = source[4] & 0x00ff;
int num = (source[3] & 0x00ff) | ((source[2] & 0x00ff) << 8);
int attr = source[1];
int flipx = (attr & 0x0080) >> 7;
int colour = (attr & 0x000f);
xpos += ((attr & 0x0020) >> 5) * 0x100;
ypos += ((attr & 0x0010) >> 4) * 0x100;
xpos -= 28;
ypos -= 16;
gfx->transpen(
bitmap,
cliprect,
num,
colour,
flipx,0,
xpos,ypos,0
);
source += 0x8;
}
}
TILE_GET_INFO_MEMBER(mugsmash_state::get_mugsmash_tile_info1)
{
/* fF-- cccc nnnn nnnn */
/* c = colour?
n = number?
F = flip-X
f = flip-Y
*/
int tileno, colour, fx;
tileno = m_videoram1[tile_index * 2 + 1];
colour = m_videoram1[tile_index * 2] & 0x000f;
fx = (m_videoram1[tile_index * 2] & 0xc0) >> 6;
tileinfo.set(1, tileno, colour, TILE_FLIPYX(fx));
}
void mugsmash_state::mugsmash_videoram1_w(offs_t offset, uint16_t data)
{
m_videoram1[offset] = data;
m_tilemap1->mark_tile_dirty(offset / 2);
}
TILE_GET_INFO_MEMBER(mugsmash_state::get_mugsmash_tile_info2)
{
/* fF-- cccc nnnn nnnn */
/* c = colour?
n = number?
F = flip-X
f = flip-Y
*/
int tileno, colour, fx;
tileno = m_videoram2[tile_index * 2 + 1];
colour = m_videoram2[tile_index * 2] & 0x000f;
fx = (m_videoram2[tile_index * 2] & 0xc0) >> 6;
tileinfo.set(1, tileno, 16 + colour, TILE_FLIPYX(fx));
}
void mugsmash_state::mugsmash_videoram2_w(offs_t offset, uint16_t data)
{
m_videoram2[offset] = data;
m_tilemap2->mark_tile_dirty(offset / 2);
}
void mugsmash_state::mugsmash_reg_w(offs_t offset, uint16_t data)
{
m_regs1[offset] = data;
// popmessage ("Regs %04x, %04x, %04x, %04x", mugsmash_regs1[0], mugsmash_regs1[1],mugsmash_regs1[2], mugsmash_regs1[3]);
switch (offset)
{
case 0:
m_tilemap2->set_scrollx(0, m_regs1[2] + 7);
break;
case 1:
m_tilemap2->set_scrolly(0, m_regs1[3] + 4);
break;
case 2:
m_tilemap1->set_scrollx(0, m_regs1[0] + 3);
break;
case 3:
m_tilemap1->set_scrolly(0, m_regs1[1] + 4);
break;
}
}
void mugsmash_state::video_start()
{
m_tilemap1 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mugsmash_state::get_mugsmash_tile_info1)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
m_tilemap1->set_transparent_pen(0);
m_tilemap2 = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mugsmash_state::get_mugsmash_tile_info2)), TILEMAP_SCAN_ROWS, 16, 16, 32, 32);
}
uint32_t mugsmash_state::screen_update_mugsmash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_tilemap2->draw(screen, bitmap, cliprect, 0, 0);
m_tilemap1->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect);
return 0;
}

View File

@ -49,8 +49,7 @@ lev 7 : 0x7c : 0000 0100 - just rte
2002.02.03 : There doesn't seem to be Dip Switches
(you make the changes in the "test mode")
Bits 8 to 15 of IN1 seem to be unused
The 2nd part of the "test mode" ("sound and video") is in Spanish/Italian
(I can't tell for the moment)
The 2nd part of the "test mode" ("sound and video") is in Spanish
Release date and manufacturers according to the title screen
2004.xx.10 - Pierpaolo Prazzoli
@ -70,8 +69,75 @@ TO DO :
*/
#include "emu.h"
#include "stlforce.h"
#include "edevices.h"
#include "cpu/m68000/m68000.h"
#include "machine/eepromser.h"
#include "sound/okim6295.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
namespace {
class stlforce_state : public driver_device
{
public:
stlforce_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_eeprom(*this, "eeprom"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette")
{ }
void stlforce(machine_config &config);
void program_map(address_map &map);
required_device<cpu_device> m_maincpu;
private:
required_device<eeprom_serial_93cxx_device> m_eeprom;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
void eeprom_w(uint8_t data);
};
class twinbrat_state : public stlforce_state
{
public:
twinbrat_state(const machine_config &mconfig, device_type type, const char *tag) :
stlforce_state(mconfig, type, tag),
m_okibank(*this, "okibank")
{ }
void twinbrat(machine_config &config);
protected:
virtual void machine_start() override;
private:
required_memory_bank m_okibank;
void oki_bank_w(uint8_t data);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void program_map(address_map &map);
void oki_map(address_map &map);
};
void twinbrat_state::machine_start()
{
m_okibank->configure_entries(0, 4, memregion("oki")->base(), 0x20000);
m_okibank->set_entry(0);
}
void stlforce_state::eeprom_w(uint8_t data)
{
@ -80,43 +146,46 @@ void stlforce_state::eeprom_w(uint8_t data)
m_eeprom->clk_write((data & 0x04) ? ASSERT_LINE : CLEAR_LINE );
}
void stlforce_state::oki_bank_w(uint8_t data)
void twinbrat_state::oki_bank_w(uint8_t data)
{
if (m_okibank.found())
{
m_okibank->set_entry(data & 3);
}
m_okibank->set_entry(data & 3);
}
void stlforce_state::stlforce_map(address_map &map)
void stlforce_state::program_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x100000, 0x1007ff).ram().w(m_video, FUNC(edevices_device::bg_videoram_w)).share("bg_videoram");
map(0x100800, 0x100fff).ram().w(m_video, FUNC(edevices_device::mlow_videoram_w)).share("mlow_videoram");
map(0x101000, 0x1017ff).ram().w(m_video, FUNC(edevices_device::mhigh_videoram_w)).share("mhigh_videoram");
map(0x101800, 0x1027ff).ram().w(m_video, FUNC(edevices_device::tx_videoram_w)).share("tx_videoram");
map(0x102800, 0x102fff).ram(); /* unknown / ram */
map(0x100000, 0x1007ff).ram().w("video", FUNC(edevices_device::bg_videoram_w)).share("bg_videoram");
map(0x100800, 0x100fff).ram().w("video", FUNC(edevices_device::mlow_videoram_w)).share("mlow_videoram");
map(0x101000, 0x1017ff).ram().w("video", FUNC(edevices_device::mhigh_videoram_w)).share("mhigh_videoram");
map(0x101800, 0x1027ff).ram().w("video", FUNC(edevices_device::tx_videoram_w)).share("tx_videoram");
map(0x102800, 0x102fff).ram(); // unknown / RAM
map(0x103000, 0x1033ff).ram().share("bg_scrollram");
map(0x103400, 0x1037ff).ram().share("mlow_scrollram");
map(0x103800, 0x103bff).ram().share("mhigh_scrollram");
map(0x103c00, 0x103fff).ram().share("vidattrram");
map(0x104000, 0x104fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x105000, 0x107fff).ram(); /* unknown / ram */
map(0x105000, 0x107fff).ram(); // unknown / RAM
map(0x108000, 0x1087ff).ram().share("spriteram");
map(0x108800, 0x108fff).ram();
map(0x109000, 0x11ffff).ram();
map(0x400000, 0x400001).portr("INPUT");
map(0x400002, 0x400003).portr("SYSTEM");
map(0x400011, 0x400011).w(FUNC(stlforce_state::eeprom_w));
map(0x400012, 0x400012).w(FUNC(stlforce_state::oki_bank_w));
map(0x40001e, 0x40001f).w(m_video, FUNC(edevices_device::sprites_commands_w));
map(0x40001e, 0x40001f).w("video", FUNC(edevices_device::sprites_commands_w));
map(0x410001, 0x410001).rw("oki", FUNC(okim6295_device::read), FUNC(okim6295_device::write));
}
void stlforce_state::twinbrat_oki_map(address_map &map)
void twinbrat_state::program_map(address_map &map)
{
stlforce_state::program_map(map);
map(0x400012, 0x400012).w(FUNC(twinbrat_state::oki_bank_w));
}
void twinbrat_state::oki_map(address_map &map)
{
map(0x00000, 0x1ffff).rom();
map(0x20000, 0x3ffff).bankr("okibank");
map(0x20000, 0x3ffff).bankr(m_okibank);
}
static INPUT_PORTS_START( stlforce )
@ -145,7 +214,7 @@ static INPUT_PORTS_START( stlforce )
PORT_SERVICE_NO_TOGGLE( 0x0008, IP_ACTIVE_LOW )
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read) /* eeprom */
PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_serial_93cxx_device, do_read)
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
@ -184,93 +253,89 @@ static const gfx_layout stlforce_splayout =
};
static GFXDECODE_START( gfx_stlforce )
GFXDECODE_ENTRY( "gfx2", 0, stlforce_splayout, 1024, 16 )
GFXDECODE_ENTRY( "gfx1", 0x180000, stlforce_txlayout, 384, 8 )
GFXDECODE_ENTRY( "gfx1", 0x100000, stlforce_bglayout, 256, 8 )
GFXDECODE_ENTRY( "gfx1", 0x080000, stlforce_bglayout, 128, 8 )
GFXDECODE_ENTRY( "gfx1", 0x000000, stlforce_bglayout, 0, 8 )
GFXDECODE_ENTRY( "sprites", 0, stlforce_splayout, 1024, 16 )
GFXDECODE_ENTRY( "tiles", 0x180000, stlforce_txlayout, 384, 8 )
GFXDECODE_ENTRY( "tiles", 0x100000, stlforce_bglayout, 256, 8 )
GFXDECODE_ENTRY( "tiles", 0x080000, stlforce_bglayout, 128, 8 )
GFXDECODE_ENTRY( "tiles", 0x000000, stlforce_bglayout, 0, 8 )
GFXDECODE_END
uint32_t stlforce_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
return m_video->draw(screen, bitmap, cliprect);
}
void stlforce_state::stlforce(machine_config &config)
{
/* basic machine hardware */
M68000(config, m_maincpu, 15000000);
m_maincpu->set_addrmap(AS_PROGRAM, &stlforce_state::stlforce_map);
// basic machine hardware
M68000(config, m_maincpu, XTAL(15'000'000));
m_maincpu->set_addrmap(AS_PROGRAM, &stlforce_state::program_map);
m_maincpu->set_vblank_int("screen", FUNC(stlforce_state::irq4_line_hold));
EEPROM_93C46_16BIT(config, "eeprom");
/* video hardware */
// video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(58);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate
screen.set_size(64*8, 32*8);
screen.set_visarea(8, 48*8-1-8-2, 0, 30*8-1);
screen.set_screen_update(FUNC(stlforce_state::screen_update));
screen.set_screen_update("video", FUNC(edevices_sforce_device::draw));
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_stlforce);
PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x800);
EDEVICES_SFORCE_VID(config, m_video, 0);
m_video->set_bg_videoram_tag("bg_videoram");
m_video->set_mlow_videoram_tag("mlow_videoram");
m_video->set_mhigh_videoram_tag("mhigh_videoram");
m_video->set_tx_videoram_tag("tx_videoram");
m_video->set_bg_scrollram_tag("bg_scrollram");
m_video->set_mlow_scrollram_tag("mlow_scrollram");
m_video->set_mhigh_scrollram_tag("mhigh_scrollram");
m_video->set_vidattrram_tag("vidattrram");
m_video->set_spriteram_tag("spriteram");
m_video->set_gfxdecode_tag("gfxdecode");
m_video->set_palette_tag("palette");
edevices_sforce_device &video(EDEVICES_SFORCE_VID(config, "video", 0));
video.set_bg_videoram_tag("bg_videoram");
video.set_mlow_videoram_tag("mlow_videoram");
video.set_mhigh_videoram_tag("mhigh_videoram");
video.set_tx_videoram_tag("tx_videoram");
video.set_bg_scrollram_tag("bg_scrollram");
video.set_mlow_scrollram_tag("mlow_scrollram");
video.set_mhigh_scrollram_tag("mhigh_scrollram");
video.set_vidattrram_tag("vidattrram");
video.set_spriteram_tag("spriteram");
video.set_gfxdecode_tag("gfxdecode");
video.set_palette_tag("palette");
/* sound hardware */
// sound hardware
SPEAKER(config, "mono").front_center();
OKIM6295(config, "oki", XTAL(32'000'000)/32, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 1.0);
OKIM6295(config, "oki", XTAL(32'000'000) / 32, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 1.0);
}
void stlforce_state::twinbrat(machine_config &config)
void twinbrat_state::twinbrat(machine_config &config)
{
stlforce(config);
/* basic machine hardware */
// basic machine hardware
m_maincpu->set_addrmap(AS_PROGRAM, &twinbrat_state::program_map);
m_maincpu->set_clock(XTAL(14'745'600));
subdevice<screen_device>("screen")->set_visarea(3*8, 44*8-1, 0*8, 30*8-1);
/* modify m_video */
m_video->set_spritexoffset(10);
subdevice<edevices_sforce_device>("video")->set_spritexoffset(10);
subdevice<okim6295_device>("oki")->set_clock(XTAL(30'000'000) / 32); // verified on 2 PCBs
subdevice<okim6295_device>("oki")->set_addrmap(0, &stlforce_state::twinbrat_oki_map);
subdevice<okim6295_device>("oki")->set_addrmap(0, &twinbrat_state::oki_map);
}
ROM_START( stlforce )
ROM_REGION( 0x80000, "maincpu", 0 ) /* 68000 code */
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "stlforce.105", 0x00000, 0x20000, CRC(3ec804ca) SHA1(4efcf3321b7111644ac3ee0a83ad95d0571a4021) )
ROM_LOAD16_BYTE( "stlforce.104", 0x00001, 0x20000, CRC(69b5f429) SHA1(5bd20fad91a22f4d62f85a5190d72dd824ee26a5) )
ROM_REGION( 0x200000, "gfx1", 0 ) /* 16x16 bg tiles & 8x8 tx tiles merged */
ROM_REGION( 0x200000, "tiles", 0 ) // 16x16 bg tiles & 8x8 tx tiles merged
ROM_LOAD16_BYTE( "stlforce.u27", 0x000001, 0x080000, CRC(c42ef365) SHA1(40e9ee29ea14b3bc2fbfa4e6acb7d680cf72f01a) )
ROM_LOAD16_BYTE( "stlforce.u28", 0x000000, 0x080000, CRC(6a4b7c98) SHA1(004d7f3c703c6abc79286fa58a4c6793d66fca39) )
ROM_LOAD16_BYTE( "stlforce.u29", 0x100001, 0x080000, CRC(30488f44) SHA1(af0d92d8952ce3cd893ab9569afdda12e17795e7) )
ROM_LOAD16_BYTE( "stlforce.u30", 0x100000, 0x080000, CRC(cf19d43a) SHA1(dc04930548ac5b7e2b74c6041325eac06e773ed5) )
ROM_REGION( 0x100000, "gfx2", 0 ) /* 16x16 sprites */
ROM_REGION( 0x100000, "sprites", 0 ) // 16x16
ROM_LOAD( "stlforce.u36", 0x00000, 0x40000, CRC(037dfa9f) SHA1(224f5cd1a95d55b065aef5c0bd03b50cabcb619b) )
ROM_LOAD( "stlforce.u31", 0x40000, 0x40000, CRC(305a8eb5) SHA1(3a8d26f8bc4ec2e8246d1c59115e21cad876630d) )
ROM_LOAD( "stlforce.u32", 0x80000, 0x40000, CRC(760e8601) SHA1(a61f1d8566e09ce811382c6e23f3881e6c438f15) )
ROM_LOAD( "stlforce.u33", 0xc0000, 0x40000, CRC(19415cf3) SHA1(31490a1f3321558f82667b63f3963b2ec3fa0c59) )
/* only one bank */
ROM_REGION( 0x80000, "oki", 0 ) /* samples, second half 0xff filled */
// only one bank
ROM_REGION( 0x80000, "oki", 0 ) // samples, second half 0xff filled
ROM_LOAD( "stlforce.u1", 0x00000, 0x80000, CRC(0a55edf1) SHA1(091f12e8110c62df22b370a2e710c930ba06e8ca) )
ROM_REGION16_BE( 0x80, "eeprom", 0 )
@ -318,23 +383,23 @@ Notes:
ROM_START( twinbrat )
ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 Code */
ROM_LOAD16_BYTE( "12.u105", 0x00000, 0x20000, CRC(552529b1) SHA1(bf23680335e1c5b05b80ab139609bee9f239b910) ) /* higher numbers are newer?? */
ROM_LOAD16_BYTE( "13.u104", 0x00001, 0x20000, CRC(9805ba90) SHA1(cdc188fa38220d18c60c9f438520ee574e6ce0f7) ) /* higher numbers are newer?? */
ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "12.u105", 0x00000, 0x20000, CRC(552529b1) SHA1(bf23680335e1c5b05b80ab139609bee9f239b910) ) // higher numbers are newer??
ROM_LOAD16_BYTE( "13.u104", 0x00001, 0x20000, CRC(9805ba90) SHA1(cdc188fa38220d18c60c9f438520ee574e6ce0f7) ) // higher numbers are newer??
ROM_REGION( 0x200000, "gfx1", 0 )
ROM_REGION( 0x200000, "tiles", 0 )
ROM_LOAD16_BYTE( "6.bin", 0x000000, 0x80000, CRC(af10ddfd) SHA1(e5e83044f20d6cbbc1b4ef1812ac57b6dc958a8a) )
ROM_LOAD16_BYTE( "7.bin", 0x000001, 0x80000, CRC(3696345a) SHA1(ea38be3586757527b2a1aad2e22b83937f8602da) )
ROM_LOAD16_BYTE( "4.bin", 0x100000, 0x80000, CRC(1ae8a751) SHA1(5f30306580c6ab4af0ddbdc4519eb4e0ab9bd23a) )
ROM_LOAD16_BYTE( "5.bin", 0x100001, 0x80000, CRC(cf235eeb) SHA1(d067e2dd4f28a8986dd76ec0eba90e1adbf5787c) )
ROM_REGION( 0x100000, "gfx2", 0 )
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD( "11.bin", 0x000000, 0x40000, CRC(00eecb03) SHA1(5913da4d2ad97c1ce5e8e601a22b499cd93af744) )
ROM_LOAD( "10.bin", 0x040000, 0x40000, CRC(7556bee9) SHA1(3fe99c7e9378791b79c43b04f5d0a36404448beb) )
ROM_LOAD( "9.bin", 0x080000, 0x40000, CRC(13194d89) SHA1(95c35b6012f98a64630abb40fd55b24ff8a5e031) )
ROM_LOAD( "8.bin", 0x0c0000, 0x40000, CRC(79f14528) SHA1(9c07d9a9e59f69a525bbaec05d74eb8d21bb9563) )
ROM_REGION( 0x080000, "oki", 0 ) /* Samples, 0x00000 - 0x20000 fixed, 0x20000 - 0x40000 banked */
ROM_REGION( 0x080000, "oki", 0 ) // Samples, 0x00000 - 0x20000 fixed, 0x20000 - 0x40000 banked
ROM_LOAD( "1.bin", 0x00000, 0x80000, CRC(76296578) SHA1(04eca78abe60b283269464c0d12815579126ac08) )
ROM_REGION16_BE( 0x80, "eeprom", 0 )
@ -342,23 +407,23 @@ ROM_START( twinbrat )
ROM_END
ROM_START( twinbrata )
ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 Code */
ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "2.u105", 0x00000, 0x20000, CRC(33a9bb82) SHA1(0f54239397c93e264b9b211f67bf626acf1246a9) )
ROM_LOAD16_BYTE( "3.u104", 0x00001, 0x20000, CRC(b1186a67) SHA1(502074063101885874db76ae707db1082313efcf) )
ROM_REGION( 0x200000, "gfx1", 0 )
ROM_REGION( 0x200000, "tiles", 0 )
ROM_LOAD16_BYTE( "6.bin", 0x000000, 0x80000, CRC(af10ddfd) SHA1(e5e83044f20d6cbbc1b4ef1812ac57b6dc958a8a) )
ROM_LOAD16_BYTE( "7.bin", 0x000001, 0x80000, CRC(3696345a) SHA1(ea38be3586757527b2a1aad2e22b83937f8602da) )
ROM_LOAD16_BYTE( "4.bin", 0x100000, 0x80000, CRC(1ae8a751) SHA1(5f30306580c6ab4af0ddbdc4519eb4e0ab9bd23a) )
ROM_LOAD16_BYTE( "5.bin", 0x100001, 0x80000, CRC(cf235eeb) SHA1(d067e2dd4f28a8986dd76ec0eba90e1adbf5787c) )
ROM_REGION( 0x100000, "gfx2", 0 )
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD( "11.bin", 0x000000, 0x40000, CRC(00eecb03) SHA1(5913da4d2ad97c1ce5e8e601a22b499cd93af744) )
ROM_LOAD( "10.bin", 0x040000, 0x40000, CRC(7556bee9) SHA1(3fe99c7e9378791b79c43b04f5d0a36404448beb) )
ROM_LOAD( "9.bin", 0x080000, 0x40000, CRC(13194d89) SHA1(95c35b6012f98a64630abb40fd55b24ff8a5e031) )
ROM_LOAD( "8.bin", 0x0c0000, 0x40000, CRC(79f14528) SHA1(9c07d9a9e59f69a525bbaec05d74eb8d21bb9563) )
ROM_REGION( 0x080000, "oki", 0 ) /* Samples, 0x00000 - 0x20000 fixed, 0x20000 - 0x40000 banked */
ROM_REGION( 0x080000, "oki", 0 ) // Samples, 0x00000 - 0x20000 fixed, 0x20000 - 0x40000 banked
ROM_LOAD( "1.bin", 0x00000, 0x80000, CRC(76296578) SHA1(04eca78abe60b283269464c0d12815579126ac08) )
ROM_REGION16_BE( 0x80, "eeprom", 0 )
@ -366,38 +431,34 @@ ROM_START( twinbrata )
ROM_END
ROM_START( twinbratb )
ROM_REGION( 0x40000, "maincpu", 0 ) /* 68000 Code */
ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "2.bin", 0x00000, 0x20000, CRC(5e75f568) SHA1(f42d2a73d737e6b01dd049eea2a10fc8c8096d8f) )
ROM_LOAD16_BYTE( "3.bin", 0x00001, 0x20000, CRC(0e3fa9b0) SHA1(0148cc616eac84dc16415e1557ec6040d14392d4) )
ROM_REGION( 0x200000, "gfx1", 0 )
ROM_REGION( 0x200000, "tiles", 0 )
ROM_LOAD16_BYTE( "6.bin", 0x000000, 0x80000, CRC(af10ddfd) SHA1(e5e83044f20d6cbbc1b4ef1812ac57b6dc958a8a) )
ROM_LOAD16_BYTE( "7.bin", 0x000001, 0x80000, CRC(3696345a) SHA1(ea38be3586757527b2a1aad2e22b83937f8602da) )
ROM_LOAD16_BYTE( "4.bin", 0x100000, 0x80000, CRC(1ae8a751) SHA1(5f30306580c6ab4af0ddbdc4519eb4e0ab9bd23a) )
ROM_LOAD16_BYTE( "5.bin", 0x100001, 0x80000, CRC(cf235eeb) SHA1(d067e2dd4f28a8986dd76ec0eba90e1adbf5787c) )
ROM_REGION( 0x100000, "gfx2", 0 )
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD( "11.bin", 0x000000, 0x40000, CRC(00eecb03) SHA1(5913da4d2ad97c1ce5e8e601a22b499cd93af744) )
ROM_LOAD( "10.bin", 0x040000, 0x40000, CRC(7556bee9) SHA1(3fe99c7e9378791b79c43b04f5d0a36404448beb) )
ROM_LOAD( "9.bin", 0x080000, 0x40000, CRC(13194d89) SHA1(95c35b6012f98a64630abb40fd55b24ff8a5e031) )
ROM_LOAD( "8.bin", 0x0c0000, 0x40000, CRC(79f14528) SHA1(9c07d9a9e59f69a525bbaec05d74eb8d21bb9563) )
ROM_REGION( 0x080000, "oki", 0 ) /* Samples, 0x00000 - 0x20000 fixed, 0x20000 - 0x40000 banked */
ROM_REGION( 0x080000, "oki", 0 ) // Samples, 0x00000 - 0x20000 fixed, 0x20000 - 0x40000 banked
ROM_LOAD( "1.bin", 0x00000, 0x80000, CRC(76296578) SHA1(04eca78abe60b283269464c0d12815579126ac08) )
ROM_REGION16_BE( 0x80, "eeprom", 0 )
ROM_LOAD( "eeprom-twinbrat.bin", 0x0000, 0x0080, CRC(9366263d) SHA1(ff5155498ed0b349ecc1ce98a39566b642201cf2) )
ROM_END
void stlforce_state::init_twinbrat()
{
m_okibank->configure_entries(0, 4, memregion("oki")->base(), 0x20000);
m_okibank->set_entry(0);
}
} // anonymous namespace
GAME( 1994, stlforce, 0, stlforce, stlforce, stlforce_state, empty_init, ROT0, "Electronic Devices Italy / Ecogames S.L. Spain", "Steel Force", MACHINE_SUPPORTS_SAVE )
GAME( 1994, stlforce, 0, stlforce, stlforce, stlforce_state, empty_init, ROT0, "Electronic Devices Italy / Ecogames S.L. Spain", "Steel Force", MACHINE_SUPPORTS_SAVE )
GAME( 1995, twinbrat, 0, twinbrat, stlforce, stlforce_state, init_twinbrat, ROT0, "Elettronica Video-Games S.R.L.", "Twin Brats (set 1)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, twinbrata, twinbrat, twinbrat, stlforce, stlforce_state, init_twinbrat, ROT0, "Elettronica Video-Games S.R.L.", "Twin Brats (set 2)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, twinbratb, twinbrat, twinbrat, stlforce, stlforce_state, init_twinbrat, ROT0, "Elettronica Video-Games S.R.L.", "Twin Brats (set 3)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, twinbrat, 0, twinbrat, stlforce, twinbrat_state, empty_init, ROT0, "Elettronica Video-Games S.R.L.", "Twin Brats (set 1)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, twinbrata, twinbrat, twinbrat, stlforce, twinbrat_state, empty_init, ROT0, "Elettronica Video-Games S.R.L.", "Twin Brats (set 2)", MACHINE_SUPPORTS_SAVE )
GAME( 1995, twinbratb, twinbrat, twinbrat, stlforce, twinbrat_state, empty_init, ROT0, "Elettronica Video-Games S.R.L.", "Twin Brats (set 3)", MACHINE_SUPPORTS_SAVE )

View File

@ -1,46 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
#include "edevices.h"
#include "machine/eepromser.h"
#include "emupal.h"
#include "cpu/m68000/m68000.h"
#include "sound/okim6295.h"
#include "screen.h"
#include "speaker.h"
class stlforce_state : public driver_device
{
public:
stlforce_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_eeprom(*this, "eeprom"),
m_video(*this, "edevices_vid"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_okibank(*this, "okibank")
{ }
void stlforce(machine_config &config);
void twinbrat(machine_config &config);
void init_twinbrat();
private:
required_device<cpu_device> m_maincpu;
required_device<eeprom_serial_93cxx_device> m_eeprom;
required_device<edevices_device> m_video;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
optional_memory_bank m_okibank;
void eeprom_w(uint8_t data);
void oki_bank_w(uint8_t data);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void stlforce_map(address_map &map);
void twinbrat_oki_map(address_map &map);
};

View File

@ -1,5 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Takahiro Nogi
// copyright-holders: Takahiro Nogi
/***************************************************************************
Mr. Jong
@ -46,14 +46,190 @@ ROMs 6A, 7A, 8A, 9A: 2764
***************************************************************************/
#include "emu.h"
#include "mrjong.h"
#include "cpu/z80/z80.h"
#include "sound/sn76496.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"
namespace {
class mrjong_state : public driver_device
{
public:
mrjong_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette")
{ }
void mrjong(machine_config &config);
protected:
virtual void video_start() override;
private:
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_colorram;
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
tilemap_t *m_bg_tilemap = nullptr;
uint8_t io_0x03_r();
void videoram_w(offs_t offset, uint8_t data);
void colorram_w(offs_t offset, uint8_t data);
void flipscreen_w(uint8_t data);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
void palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void io_map(address_map &map);
void program_map(address_map &map);
};
// video
/***************************************************************************
Convert the color PROMs.
***************************************************************************/
void mrjong_state::palette(palette_device &palette) const
{
uint8_t const *color_prom = memregion("color_proms")->base();
// create a lookup table for the palette
for (int i = 0; i < 0x10; i++)
{
int bit0, bit1, bit2;
// red component
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
// green component
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
// blue component
bit0 = 0;
bit1 = BIT(color_prom[i], 6);
bit2 = BIT(color_prom[i], 7);
int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
// color_prom now points to the beginning of the lookup table
color_prom += 0x20;
// characters/sprites
for (int i = 0; i < 0x80; i++)
{
uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
/***************************************************************************
Display control parameter.
***************************************************************************/
void mrjong_state::videoram_w(offs_t offset, uint8_t data)
{
m_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
void mrjong_state::colorram_w(offs_t offset, uint8_t data)
{
m_colorram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
void mrjong_state::flipscreen_w(uint8_t data)
{
if (flip_screen() != BIT(data, 2))
{
flip_screen_set(BIT(data, 2));
machine().tilemap().mark_all_dirty();
}
}
TILE_GET_INFO_MEMBER(mrjong_state::get_bg_tile_info)
{
int const code = m_videoram[tile_index] | ((m_colorram[tile_index] & 0x20) << 3);
int const color = m_colorram[tile_index] & 0x1f;
int const flags = ((m_colorram[tile_index] & 0x40) ? TILE_FLIPX : 0) | ((m_colorram[tile_index] & 0x80) ? TILE_FLIPY : 0);
tileinfo.set(0, code, color, flags);
}
void mrjong_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mrjong_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS_FLIP_XY, 8, 8, 32, 32);
}
/*
Note: First 0x40 entries in the videoram are actually spriteram
*/
void mrjong_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
for (int offs = (0x40 - 4); offs >= 0; offs -= 4)
{
int const sprt = (((m_videoram[offs + 1] >> 2) & 0x3f) | ((m_videoram[offs + 3] & 0x20) << 1));
int flipx = (m_videoram[offs + 1] & 0x01) >> 0;
int flipy = (m_videoram[offs + 1] & 0x02) >> 1;
int const color = (m_videoram[offs + 3] & 0x1f);
int sx = 224 - m_videoram[offs + 2];
int sy = m_videoram[offs + 0];
if (flip_screen())
{
sx = 208 - sx;
sy = 240 - sy;
flipx = !flipx;
flipy = !flipy;
}
m_gfxdecode->gfx(1)->transpen(bitmap, cliprect,
sprt,
color,
flipx, flipy,
sx, sy, 0);
}
}
uint32_t mrjong_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect);
return 0;
}
// machine
/*************************************
*
* Memory handlers
@ -72,19 +248,19 @@ uint8_t mrjong_state::io_0x03_r()
*
*************************************/
void mrjong_state::mrjong_map(address_map &map)
void mrjong_state::program_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
map(0x8000, 0x87ff).ram();
map(0xa000, 0xa7ff).ram();
map(0xe000, 0xe3ff).ram().w(FUNC(mrjong_state::mrjong_videoram_w)).share("videoram");
map(0xe400, 0xe7ff).ram().w(FUNC(mrjong_state::mrjong_colorram_w)).share("colorram");
map(0xe000, 0xe3ff).ram().w(FUNC(mrjong_state::videoram_w)).share(m_videoram);
map(0xe400, 0xe7ff).ram().w(FUNC(mrjong_state::colorram_w)).share(m_colorram);
}
void mrjong_state::mrjong_io_map(address_map &map)
void mrjong_state::io_map(address_map &map)
{
map.global_mask(0xff);
map(0x00, 0x00).portr("P2").w(FUNC(mrjong_state::mrjong_flipscreen_w));
map(0x00, 0x00).portr("P2").w(FUNC(mrjong_state::flipscreen_w));
map(0x01, 0x01).portr("P1").w("sn1", FUNC(sn76489_device::write));
map(0x02, 0x02).portr("DSW").w("sn2", FUNC(sn76489_device::write));
map(0x03, 0x03).r(FUNC(mrjong_state::io_0x03_r)); // Unknown
@ -151,31 +327,31 @@ INPUT_PORTS_END
static const gfx_layout tilelayout =
{
8, 8, /* 8*8 characters */
512, /* 512 characters */
2, /* 2 bits per pixel */
{ 0, 512*8*8 }, /* the two bitplanes are separated */
{ 0, 1, 2, 3, 4, 5, 6, 7 }, /* pretty straightforward layout */
8, 8, // 8*8 characters
512, // 512 characters
2, // 2 bits per pixel
{ 0, 512*8*8 }, // the two bitplanes are separated
{ 0, 1, 2, 3, 4, 5, 6, 7 }, // pretty straightforward layout
{ 7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },
8*8 /* every char takes 8 consecutive bytes */
8*8 // every char takes 8 consecutive bytes
};
static const gfx_layout spritelayout =
{
16, 16, /* 16*16 sprites */
128, /* 128 sprites */
2, /* 2 bits per pixel */
{ 0, 128*16*16 }, /* the bitplanes are separated */
{ 8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7, /* pretty straightforward layout */
16, 16, // 16*16 sprites
128, // 128 sprites
2, // 2 bits per pixel
{ 0, 128*16*16 }, // the bitplanes are separated
{ 8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7, // pretty straightforward layout
0, 1, 2, 3, 4, 5, 6, 7 },
{ 23*8, 22*8, 21*8, 20*8, 19*8, 18*8, 17*8, 16*8,
7*8, 6*8, 5*8, 4*8, 3*8, 2*8, 1*8, 0*8 },
32*8 /* every sprite takes 32 consecutive bytes */
32*8 // every sprite takes 32 consecutive bytes
};
static GFXDECODE_START( gfx_mrjong )
GFXDECODE_ENTRY( "gfx1", 0x0000, tilelayout, 0, 32 )
GFXDECODE_ENTRY( "gfx1", 0x0000, spritelayout, 0, 32 )
GFXDECODE_ENTRY( "gfx", 0x0000, tilelayout, 0, 32 )
GFXDECODE_ENTRY( "gfx", 0x0000, spritelayout, 0, 32 )
GFXDECODE_END
@ -187,28 +363,28 @@ GFXDECODE_END
void mrjong_state::mrjong(machine_config &config)
{
/* basic machine hardware */
Z80(config, m_maincpu,15468000/6); /* 2.578 MHz?? */
m_maincpu->set_addrmap(AS_PROGRAM, &mrjong_state::mrjong_map);
m_maincpu->set_addrmap(AS_IO, &mrjong_state::mrjong_io_map);
// basic machine hardware
Z80(config, m_maincpu, 15'468'000 / 6); // 2.578 MHz
m_maincpu->set_addrmap(AS_PROGRAM, &mrjong_state::program_map);
m_maincpu->set_addrmap(AS_IO, &mrjong_state::io_map);
/* video hardware */
// 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, 30*8-1, 2*8, 30*8-1);
screen.set_screen_update(FUNC(mrjong_state::screen_update_mrjong));
screen.set_screen_update(FUNC(mrjong_state::screen_update));
screen.set_palette(m_palette);
screen.screen_vblank().set_inputline(m_maincpu, INPUT_LINE_NMI);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_mrjong);
PALETTE(config, m_palette, FUNC(mrjong_state::mrjong_palette), 4 * 32, 16);
PALETTE(config, m_palette, FUNC(mrjong_state::palette), 4 * 32, 16);
/* sound hardware */
// sound hardware
SPEAKER(config, "mono").front_center();
SN76489(config, "sn1", 15468000 / 6).add_route(ALL_OUTPUTS, "mono", 1.0);
SN76489(config, "sn2", 15468000 / 6).add_route(ALL_OUTPUTS, "mono", 1.0);
SN76489(config, "sn1", 15'468'000 / 6).add_route(ALL_OUTPUTS, "mono", 1.0);
SN76489(config, "sn2", 15'468'000 / 6).add_route(ALL_OUTPUTS, "mono", 1.0);
}
@ -219,53 +395,56 @@ void mrjong_state::mrjong(machine_config &config)
*************************************/
ROM_START( mrjong )
ROM_REGION( 0x10000, "maincpu", 0 ) /* code */
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "mj00", 0x0000, 0x2000, CRC(d211aed3) SHA1(01f252ca1d2399146fa3ed44cb2daa1d5925cae5) )
ROM_LOAD( "mj01", 0x2000, 0x2000, CRC(49a9ca7e) SHA1(fc5279ba782da2c8288042bd17282366fcd788cc) )
ROM_LOAD( "mj02", 0x4000, 0x2000, CRC(4b50ae6a) SHA1(6fa6bae926c5e4cc154f5f1a6dc7bb7ef5bb484a) )
ROM_LOAD( "mj03", 0x6000, 0x2000, CRC(2c375a17) SHA1(9719485cdca535771b498a37d57734463858f2cd) )
ROM_REGION( 0x2000, "gfx1", 0 ) /* gfx */
ROM_REGION( 0x2000, "gfx", 0 )
ROM_LOAD( "mj21", 0x0000, 0x1000, CRC(1ea99dab) SHA1(21a296d394e5cac0c7cb2ea8efaeeeee976ac4b5) )
ROM_LOAD( "mj20", 0x1000, 0x1000, CRC(7eb1d381) SHA1(fa13700f132c03d2d2cee65abf24024db656aff7) )
ROM_REGION( 0x0120, "proms", 0 ) /* color */
ROM_REGION( 0x0120, "color_proms", 0 )
ROM_LOAD( "mj61", 0x0000, 0x0020, CRC(a85e9b27) SHA1(55df208b771a98fcf6c2c19ffdf973891ebcabd1) )
ROM_LOAD( "mj60", 0x0020, 0x0100, CRC(dd2b304f) SHA1(d7320521e83ddf269a9fc0c91f0e0e61428b187c) )
ROM_END
ROM_START( crazyblk )
ROM_REGION( 0x10000, "maincpu", 0 ) /* code */
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "c1.a6", 0x0000, 0x2000, CRC(e2a211a2) SHA1(5bcf5a0cb25ce5adfb6519c8a3a4ee6e55e1e7de) )
ROM_LOAD( "c2.a7", 0x2000, 0x2000, CRC(75070978) SHA1(7f59460c094e596a521014f956d76e5c714022a2) )
ROM_LOAD( "c3.a7", 0x4000, 0x2000, CRC(696ca502) SHA1(8ce7e31e9a7161633fee7f28b215e4358d906c4b) )
ROM_LOAD( "c4.a8", 0x6000, 0x2000, CRC(c7f5a247) SHA1(de79341f9c6c7032f76cead46d614e13d4af50f9) )
ROM_REGION( 0x2000, "gfx1", 0 ) /* gfx */
ROM_REGION( 0x2000, "gfx", 0 )
ROM_LOAD( "c6.h5", 0x0000, 0x1000, CRC(2b2af794) SHA1(d13bc8e8ea6c9bc2066ed692108151523d1f936b) )
ROM_LOAD( "c5.h4", 0x1000, 0x1000, CRC(98d13915) SHA1(b51104f9f80128ff7a52ac2efa9519bf9d7b78bc) )
ROM_REGION( 0x0120, "proms", 0 ) /* color */
ROM_REGION( 0x0120, "color_proms", 0 )
ROM_LOAD( "clr.j7", 0x0000, 0x0020, CRC(ee1cf1d5) SHA1(4f4cfde1a896da92d8265889584dd0c5678de033) )
ROM_LOAD( "clr.g5", 0x0020, 0x0100, CRC(bcb1e2e3) SHA1(c09731836a9d4e50316a84b86f61b599a1ef944d) )
ROM_END
ROM_START( blkbustr )
ROM_REGION( 0x10000, "maincpu", 0 ) /* code */
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "6a.bin", 0x0000, 0x2000, CRC(9e4b426c) SHA1(831360c473ab2452f4d0da12609c96c601e21c17) )
ROM_LOAD( "c2.a7", 0x2000, 0x2000, CRC(75070978) SHA1(7f59460c094e596a521014f956d76e5c714022a2) )
ROM_LOAD( "8a.bin", 0x4000, 0x2000, CRC(0e803777) SHA1(bccc182ccbd7312fc6545ffcef4d54637416dae7) )
ROM_LOAD( "c4.a8", 0x6000, 0x2000, CRC(c7f5a247) SHA1(de79341f9c6c7032f76cead46d614e13d4af50f9) )
ROM_REGION( 0x2000, "gfx1", 0 ) /* gfx */
ROM_REGION( 0x2000, "gfx", 0 )
ROM_LOAD( "4h.bin", 0x0000, 0x1000, CRC(67dd6c19) SHA1(d3dc0cb9b108c2584c4844fc0eb4c9ee170986fe) )
ROM_LOAD( "5h.bin", 0x1000, 0x1000, CRC(50fba1d4) SHA1(40ba480713284ae484c6687490f91bf62a7167e1) )
ROM_REGION( 0x0120, "proms", 0 ) /* color */
ROM_REGION( 0x0120, "color_proms", 0 )
ROM_LOAD( "clr.j7", 0x0000, 0x0020, CRC(ee1cf1d5) SHA1(4f4cfde1a896da92d8265889584dd0c5678de033) )
ROM_LOAD( "clr.g5", 0x0020, 0x0100, CRC(bcb1e2e3) SHA1(c09731836a9d4e50316a84b86f61b599a1ef944d) )
ROM_END
} // anonymous namespace
/*************************************
*
* Game driver(s)

View File

@ -1,56 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Takahiro Nogi
/*************************************************************************
Mr. Jong
*************************************************************************/
#ifndef MAME_INCLUDES_MRJONG_H
#define MAME_INCLUDES_MRJONG_H
#pragma once
#include "emupal.h"
#include "tilemap.h"
class mrjong_state : public driver_device
{
public:
mrjong_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette")
{ }
void mrjong(machine_config &config);
private:
uint8_t io_0x03_r();
void mrjong_videoram_w(offs_t offset, uint8_t data);
void mrjong_colorram_w(offs_t offset, uint8_t data);
void mrjong_flipscreen_w(uint8_t data);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
virtual void video_start() override;
void mrjong_palette(palette_device &palette) const;
uint32_t screen_update_mrjong(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void mrjong_io_map(address_map &map);
void mrjong_map(address_map &map);
/* memory pointers */
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_colorram;
/* video-related */
tilemap_t *m_bg_tilemap = nullptr;
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
};
#endif // MAME_INCLUDES_MRJONG_H

View File

@ -1,146 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Takahiro Nogi
/***************************************************************************
video.c
Functions to emulate the video hardware of the machine.
***************************************************************************/
#include "emu.h"
#include "mrjong.h"
/***************************************************************************
Convert the color PROMs. (from video/pengo.c)
***************************************************************************/
void mrjong_state::mrjong_palette(palette_device &palette) const
{
uint8_t const *color_prom = memregion("proms")->base();
// create a lookup table for the palette
for (int i = 0; i < 0x10; i++)
{
int bit0, bit1, bit2;
// red component
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
// green component
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
// blue component
bit0 = 0;
bit1 = BIT(color_prom[i], 6);
bit2 = BIT(color_prom[i], 7);
int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
// color_prom now points to the beginning of the lookup table
color_prom += 0x20;
// characters/sprites
for (int i = 0; i < 0x80; i++)
{
uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
/***************************************************************************
Display control parameter.
***************************************************************************/
void mrjong_state::mrjong_videoram_w(offs_t offset, uint8_t data)
{
m_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
void mrjong_state::mrjong_colorram_w(offs_t offset, uint8_t data)
{
m_colorram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
void mrjong_state::mrjong_flipscreen_w(uint8_t data)
{
if (flip_screen() != BIT(data, 2))
{
flip_screen_set(BIT(data, 2));
machine().tilemap().mark_all_dirty();
}
}
TILE_GET_INFO_MEMBER(mrjong_state::get_bg_tile_info)
{
int code = m_videoram[tile_index] | ((m_colorram[tile_index] & 0x20) << 3);
int color = m_colorram[tile_index] & 0x1f;
int flags = ((m_colorram[tile_index] & 0x40) ? TILE_FLIPX : 0) | ((m_colorram[tile_index] & 0x80) ? TILE_FLIPY : 0);
tileinfo.set(0, code, color, flags);
}
void mrjong_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mrjong_state::get_bg_tile_info)), TILEMAP_SCAN_ROWS_FLIP_XY, 8, 8, 32, 32);
}
/*
Note: First 0x40 entries in the videoram are actually spriteram
*/
void mrjong_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
int offs;
for (offs = (0x40 - 4); offs >= 0; offs -= 4)
{
int sprt;
int color;
int sx, sy;
int flipx, flipy;
sprt = (((m_videoram[offs + 1] >> 2) & 0x3f) | ((m_videoram[offs + 3] & 0x20) << 1));
flipx = (m_videoram[offs + 1] & 0x01) >> 0;
flipy = (m_videoram[offs + 1] & 0x02) >> 1;
color = (m_videoram[offs + 3] & 0x1f);
sx = 224 - m_videoram[offs + 2];
sy = m_videoram[offs + 0];
if (flip_screen())
{
sx = 208 - sx;
sy = 240 - sy;
flipx = !flipx;
flipy = !flipy;
}
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
sprt,
color,
flipx, flipy,
sx, sy, 0);
}
}
uint32_t mrjong_state::screen_update_mrjong(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect);
return 0;
}

File diff suppressed because it is too large Load Diff