- mainsnk.cpp, munchmo.cpp: consolidated driver in one file, minor cleanups

- some drivers: minor spelling fixes (becuase -> because, Fujistu -> Fujitsu)

- lwings.cpp: more label updates / comments for the avengers set [Brian Troha]
This commit is contained in:
Ivan Vangelista 2022-07-22 18:14:06 +02:00
parent 690dba1c64
commit 7c2a98ff58
13 changed files with 577 additions and 613 deletions

View File

@ -1592,7 +1592,9 @@ Known to exist but currently undumped, a set with all ROMs stamped U for the US
revision D, with each having a red stripe across the label.
It was common for Capcom to use the same ROM label across regional sets but add a RED stripe for the US
region, BLUE stripe for Europe and no stripe for the Japanese region.
region, BLUE stripe for Europe and no stripe for the Japanese region. Capcom was not always consistent
including the region letter stamped on labels. Different US PCBs show the red stripe across the label both
with and without the "U" being stamped.
*/
ROM_START( avengers )
@ -1634,8 +1636,8 @@ ROM_START( avengers )
ROM_LOAD( "av_19.2n", 0x38000, 0x8000, CRC(a00485ec) SHA1(cc24e7243f55bdfaedeabb7dddf7e1ef32811c45) )
ROM_REGION( 0x10000, "gfx4", 0 ) /* bg tiles */
ROM_LOAD( "av_25.15n", 0x00000, 0x8000, CRC(230d9e30) SHA1(05a20bb32ce1299d7645312624de8a1d074bacee) ) /* planes 0,1 - Red stripe across label for US region */
ROM_LOAD( "av_24.13n", 0x08000, 0x8000, CRC(a6354024) SHA1(ce2aaec8349c08f58cc469514100bcd3a97d24d7) ) /* planes 2,3 - Red stripe across label for US region */
ROM_LOAD( "avu_25.15n", 0x00000, 0x8000, CRC(230d9e30) SHA1(05a20bb32ce1299d7645312624de8a1d074bacee) ) /* planes 0,1 - Red stripe across label for US region */
ROM_LOAD( "avu_24.13n", 0x08000, 0x8000, CRC(a6354024) SHA1(ce2aaec8349c08f58cc469514100bcd3a97d24d7) ) /* planes 2,3 - Red stripe across label for US region */
ROM_REGION( 0x08000, "gfx5", 0 )
ROM_LOAD( "av_23.9n", 0x0000, 0x8000, CRC(c0a93ef6) SHA1(2dc9cd4eb142d74aea8d151904cb60a0767c6393) ) /* Tile Map */
@ -1684,8 +1686,8 @@ ROM_START( avengersa )
ROM_LOAD( "av_19.2n", 0x38000, 0x8000, CRC(a00485ec) SHA1(cc24e7243f55bdfaedeabb7dddf7e1ef32811c45) )
ROM_REGION( 0x10000, "gfx4", 0 ) /* bg tiles */
ROM_LOAD( "av_25.15n", 0x00000, 0x8000, CRC(230d9e30) SHA1(05a20bb32ce1299d7645312624de8a1d074bacee) ) /* planes 0,1 - Red stripe across label for US region */
ROM_LOAD( "av_24.13n", 0x08000, 0x8000, CRC(a6354024) SHA1(ce2aaec8349c08f58cc469514100bcd3a97d24d7) ) /* planes 2,3 - Red stripe across label for US region */
ROM_LOAD( "avu_25.15n", 0x00000, 0x8000, CRC(230d9e30) SHA1(05a20bb32ce1299d7645312624de8a1d074bacee) ) /* planes 0,1 - Red stripe across label for US region */
ROM_LOAD( "avu_24.13n", 0x08000, 0x8000, CRC(a6354024) SHA1(ce2aaec8349c08f58cc469514100bcd3a97d24d7) ) /* planes 2,3 - Red stripe across label for US region */
ROM_REGION( 0x08000, "gfx5", 0 )
ROM_LOAD( "av_23.9n", 0x0000, 0x8000, CRC(c0a93ef6) SHA1(2dc9cd4eb142d74aea8d151904cb60a0767c6393) ) /* Tile Map */
@ -1734,8 +1736,8 @@ ROM_START( avengersb )
ROM_LOAD( "av_19.2n", 0x38000, 0x8000, CRC(a00485ec) SHA1(cc24e7243f55bdfaedeabb7dddf7e1ef32811c45) )
ROM_REGION( 0x10000, "gfx4", 0 ) /* bg tiles */
ROM_LOAD( "av_25.15n", 0x00000, 0x8000, CRC(230d9e30) SHA1(05a20bb32ce1299d7645312624de8a1d074bacee) ) /* planes 0,1 - Red stripe across label for US region */
ROM_LOAD( "av_24.13n", 0x08000, 0x8000, CRC(a6354024) SHA1(ce2aaec8349c08f58cc469514100bcd3a97d24d7) ) /* planes 2,3 - Red stripe across label for US region */
ROM_LOAD( "avu_25.15n", 0x00000, 0x8000, CRC(230d9e30) SHA1(05a20bb32ce1299d7645312624de8a1d074bacee) ) /* planes 0,1 - Red stripe across label for US region */
ROM_LOAD( "avu_24.13n", 0x08000, 0x8000, CRC(a6354024) SHA1(ce2aaec8349c08f58cc469514100bcd3a97d24d7) ) /* planes 2,3 - Red stripe across label for US region */
ROM_REGION( 0x08000, "gfx5", 0 )
ROM_LOAD( "av_23.9n", 0x0000, 0x8000, CRC(c0a93ef6) SHA1(2dc9cd4eb142d74aea8d151904cb60a0767c6393) ) /* Tile Map */
@ -1784,8 +1786,8 @@ ROM_START( avengersc )
ROM_LOAD( "av_19.2n", 0x38000, 0x8000, CRC(a00485ec) SHA1(cc24e7243f55bdfaedeabb7dddf7e1ef32811c45) )
ROM_REGION( 0x10000, "gfx4", 0 ) /* bg tiles */
ROM_LOAD( "av_25.15n", 0x00000, 0x8000, CRC(230d9e30) SHA1(05a20bb32ce1299d7645312624de8a1d074bacee) ) /* planes 0,1 - Red stripe across label for US region */
ROM_LOAD( "av_24.13n", 0x08000, 0x8000, CRC(a6354024) SHA1(ce2aaec8349c08f58cc469514100bcd3a97d24d7) ) /* planes 2,3 - Red stripe across label for US region */
ROM_LOAD( "avu_25.15n", 0x00000, 0x8000, CRC(230d9e30) SHA1(05a20bb32ce1299d7645312624de8a1d074bacee) ) /* planes 0,1 - Red stripe across label for US region */
ROM_LOAD( "avu_24.13n", 0x08000, 0x8000, CRC(a6354024) SHA1(ce2aaec8349c08f58cc469514100bcd3a97d24d7) ) /* planes 2,3 - Red stripe across label for US region */
ROM_REGION( 0x08000, "gfx5", 0 )
ROM_LOAD( "av_23.9n", 0x0000, 0x8000, CRC(c0a93ef6) SHA1(2dc9cd4eb142d74aea8d151904cb60a0767c6393) ) /* Tile Map */
@ -1834,8 +1836,8 @@ ROM_START( buraiken )
ROM_LOAD( "av_19.2n", 0x38000, 0x8000, CRC(a00485ec) SHA1(cc24e7243f55bdfaedeabb7dddf7e1ef32811c45) )
ROM_REGION( 0x10000, "gfx4", 0 )
ROM_LOAD( "av_25.15n", 0x00000, 0x8000, CRC(88a505a7) SHA1(ef4371e082b2370fcbfc96bfef5a94910acd9eff) ) /* planes 0,1 - sldh (no red stripe) */
ROM_LOAD( "av_24.13n", 0x08000, 0x8000, CRC(1f4463c8) SHA1(04cdb0187dcbdd4f5f53e60c856d4925ade8d7df) ) /* planes 2,3 - sldh (no red stripe) */
ROM_LOAD( "av_25.15n", 0x00000, 0x8000, CRC(88a505a7) SHA1(ef4371e082b2370fcbfc96bfef5a94910acd9eff) ) /* planes 0,1 - no stripe across the label */
ROM_LOAD( "av_24.13n", 0x08000, 0x8000, CRC(1f4463c8) SHA1(04cdb0187dcbdd4f5f53e60c856d4925ade8d7df) ) /* planes 2,3 - no stripe across the label */
ROM_REGION( 0x08000, "gfx5", 0 )
ROM_LOAD( "av_23.9n", 0x0000, 0x8000, CRC(c0a93ef6) SHA1(2dc9cd4eb142d74aea8d151904cb60a0767c6393) ) /* Tile Map */
@ -1881,8 +1883,8 @@ ROM_START( buraikenb )
ROM_LOAD( "av_19.2n", 0x38000, 0x8000, CRC(a00485ec) SHA1(cc24e7243f55bdfaedeabb7dddf7e1ef32811c45) )
ROM_REGION( 0x10000, "gfx4", 0 )
ROM_LOAD( "av_25.15n", 0x00000, 0x8000, CRC(88a505a7) SHA1(ef4371e082b2370fcbfc96bfef5a94910acd9eff) ) /* planes 0,1 - sldh (no red stripe) */
ROM_LOAD( "av_24.13n", 0x08000, 0x8000, CRC(1f4463c8) SHA1(04cdb0187dcbdd4f5f53e60c856d4925ade8d7df) ) /* planes 2,3 - sldh (no red stripe) */
ROM_LOAD( "av_25.15n", 0x00000, 0x8000, CRC(88a505a7) SHA1(ef4371e082b2370fcbfc96bfef5a94910acd9eff) ) /* planes 0,1 - no stripe across the label */
ROM_LOAD( "av_24.13n", 0x08000, 0x8000, CRC(1f4463c8) SHA1(04cdb0187dcbdd4f5f53e60c856d4925ade8d7df) ) /* planes 2,3 - no stripe across the label */
ROM_REGION( 0x08000, "gfx5", 0 )
ROM_LOAD( "av_23.9n", 0x0000, 0x8000, CRC(c0a93ef6) SHA1(2dc9cd4eb142d74aea8d151904cb60a0767c6393) ) /* Tile Map */

View File

@ -15120,7 +15120,7 @@ ROM_END
Moonwar
Although the game displays Moonwar as the title the "original" Moon War is/was a prototype on Stern Berzerk/Frenzy hardware,
see berzerk.cpp So this version is commonly refered to as Moon War II becuase the ROMs & PCB were labeled as MOON WAR II
see berzerk.cpp So this version is commonly refered to as Moon War II because the ROMs & PCB were labeled as MOON WAR II
NOTE: This version the title screen shows MOONWAR, on the prototype it specifically shows "MOON WAR"
@ -15153,7 +15153,7 @@ NOTE: A PCB with ROMs at 2F & 2H specifically labeled as "RXA22" was dumped and
notes in the input code:
Player 1 Dial: P1 dial works normally, P2 dial is reversed, both share same port
Player 2 Dial: doesn't actually work due to bug in game code
It would seem to indicate the code is different becuase for moonwar the issue was corrected.
It would seem to indicate the code is different because for moonwar the issue was corrected.
*/
ROM_START( moonwar )
ROM_REGION( 0x10000, "maincpu", 0 )

View File

@ -4258,7 +4258,7 @@ ROM_END
SS010003 DATA
VIDEO EPOCH
Fujistu MPF3102AT (10.2GB HDD)
Fujitsu MPF3102AT (10.2GB HDD)
*/
#define EP_PHARO_HDD \

View File

@ -2137,7 +2137,7 @@ void msx_state::fmx(machine_config &config)
msx1(TMS9928A, config);
// AY8910/YM2149?
// FDC: None, 0 drives
// 1 Cartridge slot, 2 "Fujistu expansion slots
// 1 Cartridge slot, 2 "Fujitsu expansion slots
add_internal_slot(config, MSX_SLOT_ROM, "bios", 0, 0, 0, 2, "maincpu", 0x0000);
add_internal_slot(config, MSX_SLOT_RAM, "ram", 0, 0, 3, 1); // 16KB RAM

View File

@ -775,17 +775,6 @@ INPUT_PORTS_END
* Graphics Layouts *
****************************/
static const gfx_layout tiles8x8_layout =
{
8, 8,
RGN_FRAC(1,5),
5,
{ RGN_FRAC(4,5), RGN_FRAC(3,5), RGN_FRAC(2,5), RGN_FRAC(1,5), RGN_FRAC(0,5) },
{ 0, 1, 2, 3, 4, 5, 6, 7 },
{ 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
8*8
};
static const gfx_layout tiles16x16_layout =
{
16, 16,
@ -807,7 +796,7 @@ static const gfx_layout tiles16x16_layout =
****************************/
static GFXDECODE_START( gfx_sderby )
GFXDECODE_ENTRY( "gfx", 0, tiles8x8_layout, 0x000, 256 )
GFXDECODE_ENTRY( "gfx", 0, gfx_8x8x5_planar, 0x000, 256 )
GFXDECODE_ENTRY( "gfx", 0, tiles16x16_layout, 0x000, 256 )
GFXDECODE_END
@ -1310,6 +1299,9 @@ ROM_START( croupierb ) // identical PCB as magictch, but with 'ROULETTE' sticker
ROM_LOAD( "6.u78", 0x100000, 0x80000, CRC(e1e181c2) SHA1(f60d3df5fd9c2841e4f6dc656f4ac3cab5c404c7) ) // MX27C4000DC
ROM_LOAD( "5.u79", 0x180000, 0x80000, CRC(2c59e118) SHA1(dffbd47f18276a11e964ec4a4bd3ff81d21e2a76) ) // MX27C4000DC
ROM_LOAD( "4.u80", 0x200000, 0x80000, CRC(f48c59f3) SHA1(5fd0ec940a50ec923790597723785cca10e81479) ) // MX27C4000DC
ROM_REGION( 0x300, "plds", 0)
ROM_LOAD( "gal22cv10-15lnc.u40", 0x000, 0x2e5, NO_DUMP ) // soldered
ROM_END
} // anonymous namespace

View File

@ -3834,7 +3834,7 @@ ROM_START( manxtt ) /* Manx TT Superbike DX/Twin Revision D, Model 2A - defaults
MODEL2A_VID_BOARD
ROM_END
ROM_START( manxttc ) /* Manx TT Superbike DX/Twin Revision C, Model 2A - Set to Twin mode becuase we need to preserve the Twin sound ROMs */
ROM_START( manxttc ) /* Manx TT Superbike DX/Twin Revision C, Model 2A - Set to Twin mode because we need to preserve the Twin sound ROMs */
ROM_REGION( 0x200000, "maincpu", 0 ) // i960 program
ROM_LOAD32_WORD( "epr-18822c.12", 0x000000, 0x020000, CRC(c7b3e45a) SHA1(d3a6910bf6efc138e0e40332219b90dea7d6ea56) )
ROM_LOAD32_WORD( "epr-18823c.13", 0x000002, 0x020000, CRC(6b0c1dfb) SHA1(6da5c071e3ce842a99f928f473d4ccf7165785ac) )
@ -3893,7 +3893,7 @@ ROM_START( manxttc ) /* Manx TT Superbike DX/Twin Revision C, Model 2A - Set to
ROM_END
/* This set was badly upgraded to a Revision C Manx TT Twin/DX, leaving the DX only sound CPU ROM */
ROM_START( manxtta ) // Manx TT Superbike DX/Twin Revision C, Model 2A - Set to DX becuase we need to preserve the original DX only sound ROMs
ROM_START( manxtta ) // Manx TT Superbike DX/Twin Revision C, Model 2A - Set to DX because we need to preserve the original DX only sound ROMs
ROM_REGION( 0x200000, "maincpu", 0 ) // i960 program
ROM_LOAD32_WORD( "epr-18822c.12", 0x000000, 0x020000, BAD_DUMP CRC(c7b3e45a) SHA1(d3a6910bf6efc138e0e40332219b90dea7d6ea56) ) // correct DX only ROM should be EPR-18744.12
ROM_LOAD32_WORD( "epr-18823c.13", 0x000002, 0x020000, BAD_DUMP CRC(6b0c1dfb) SHA1(6da5c071e3ce842a99f928f473d4ccf7165785ac) ) // correct DX only ROM should be EPR-18745.13

View File

@ -32,7 +32,7 @@ Notes:
- canvas doesn't use the tx layer, though the circuitry is presumably still
present on the pcb. One gfx ROM socket is left empty which causes the tx layer
present on the PCB. One gfx ROM socket is left empty which causes the tx layer
to be completely transparent.
- neither mainsnk nor canvas pass the ROM test in service mode. This looks like
@ -47,17 +47,17 @@ TODO:
- several unknown dip switches
- the hardware surely supports sprite shadows as most of the games in snk.c, but
- the hardware surely supports sprite shadows as most of the games in snk.cpp, but
the feature isn't used by these two games.
- mainsnk doesn't seem to write to the bg/sprite scroll registers? SO I hardcoded
- mainsnk doesn't seem to write to the bg/sprite scroll registers? So I hardcoded
scroll values for these two games, even if canvas does seem to write to them.
- canvas writes to several unknown addresses on startup. Most of them should be
the scroll registers while others are unknown.
- the bg tilemap is set to 256x256, however it could well be 512x256 as in the
other early SNK games in snk.c.
other early SNK games in snk.cpp.
-----
@ -73,9 +73,9 @@ Canvas Croquis, SNK 1984
Note:
The bproms(MB7054) was read as 74s572.
The BPROMs(MB7054) were read as 74s572.
I have not tested this PCB yet so I have no idea if it's working.
All Bproms and P1-P8 is on top pcb, P9-P14 on bottom board, see pictures.
All BPROMs and P1-P8 are on top PCB, P9-P14 on bottom board, see pictures.
Documentation:
@ -110,14 +110,240 @@ cc_p14.j2 8192 0xedc6a1eb M5L2764k
*/
#include "emu.h"
#include "mainsnk.h"
#include "cpu/z80/z80.h"
#include "machine/gen_latch.h"
#include "sound/ay8910.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
#include "tilemap.h"
namespace {
class mainsnk_state : public driver_device
{
public:
mainsnk_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch"),
m_bgram(*this, "bgram"),
m_spriteram(*this, "spriteram"),
m_fgram(*this, "fgram")
{ }
void mainsnk(machine_config &config);
protected:
virtual void video_start() override;
private:
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;
required_shared_ptr<uint8_t> m_bgram;
required_shared_ptr<uint8_t> m_spriteram;
required_shared_ptr<uint8_t> m_fgram;
tilemap_t *m_tx_tilemap = nullptr;
tilemap_t *m_bg_tilemap = nullptr;
uint32_t m_bg_tile_offset = 0;
uint8_t sound_ack_r();
void c600_w(uint8_t data);
void fgram_w(offs_t offset, uint8_t data);
void bgram_w(offs_t offset, uint8_t data);
TILEMAP_MAPPER_MEMBER(tx_scan_cols);
TILE_GET_INFO_MEMBER(get_tx_tile_info);
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, int scrollx, int scrolly);
void main_map(address_map &map);
void sound_map(address_map &map);
void sound_portmap(address_map &map);
};
// video
void mainsnk_state::palette(palette_device &palette) const
{
uint8_t const *const color_prom = memregion("proms")->base();
constexpr int num_colors = 0x400;
for (int i = 0; i < num_colors; i++)
{
int bit0 = BIT(color_prom[i + 2*num_colors], 3);
int bit1 = BIT(color_prom[i], 1);
int bit2 = BIT(color_prom[i], 2);
int bit3 = BIT(color_prom[i], 3);
int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = BIT(color_prom[i + 2*num_colors], 2);
bit1 = BIT(color_prom[i + num_colors], 2);
bit2 = BIT(color_prom[i + num_colors], 3);
bit3 = BIT(color_prom[i], 0);
int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = BIT(color_prom[i + 2*num_colors], 0);
bit1 = BIT(color_prom[i + 2*num_colors], 1);
bit2 = BIT(color_prom[i + num_colors], 0);
bit3 = BIT(color_prom[i + num_colors], 1);
int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
TILEMAP_MAPPER_MEMBER(mainsnk_state::tx_scan_cols)
{
// tilemap is 36x28, the central part is from the first RAM page and the
// extra 4 columns are from the second page
col -= 2;
if (col & 0x20)
return 0x400 + row + ((col & 0x1f) << 5);
else
return row + (col << 5);
}
TILE_GET_INFO_MEMBER(mainsnk_state::get_tx_tile_info)
{
int code = m_fgram[tile_index];
tileinfo.set(0,
code,
0,
tile_index & 0x400 ? TILE_FORCE_LAYER0 : 0);
}
TILE_GET_INFO_MEMBER(mainsnk_state::get_bg_tile_info)
{
int code = (m_bgram[tile_index]);
tileinfo.set(0,
m_bg_tile_offset + code,
0,
0);
}
void mainsnk_state::video_start()
{
m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mainsnk_state::get_tx_tile_info)), tilemap_mapper_delegate(*this, FUNC(mainsnk_state::tx_scan_cols)), 8, 8, 36, 28);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mainsnk_state::get_bg_tile_info)), TILEMAP_SCAN_COLS, 8, 8, 32, 32);
m_tx_tilemap->set_transparent_pen(15);
m_tx_tilemap->set_scrolldy(8, 8);
m_bg_tilemap->set_scrolldx(16, 16);
m_bg_tilemap->set_scrolldy(8, 8);
save_item(NAME(m_bg_tile_offset));
}
void mainsnk_state::c600_w(uint8_t data)
{
int total_elements = m_gfxdecode->gfx(0)->elements();
flip_screen_set(BIT(data, 7));
m_bg_tilemap->set_palette_offset((data & 0x07) << 4);
m_tx_tilemap->set_palette_offset((data & 0x07) << 4);
int bank = 0;
if (total_elements == 0x400) // mainsnk
bank = ((data & 0x30) >> 4);
else if (total_elements == 0x800) // canvas
bank = ((data & 0x40) >> 6) | ((data & 0x30) >> 3);
if (m_bg_tile_offset != (bank << 8))
{
m_bg_tile_offset = bank << 8;
m_bg_tilemap->mark_all_dirty();
}
}
void mainsnk_state::fgram_w(offs_t offset, uint8_t data)
{
m_fgram[offset] = data;
m_tx_tilemap->mark_tile_dirty(offset);
}
void mainsnk_state::bgram_w(offs_t offset, uint8_t data)
{
m_bgram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
void mainsnk_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int scrollx, int scrolly)
{
gfx_element *gfx = m_gfxdecode->gfx(1);
const uint8_t *source = m_spriteram;
const uint8_t *finish = source + 25 * 4;
while (source < finish)
{
int attributes = source[3];
int tile_number = source[1];
int sy = source[0];
int sx = source[2];
int color = attributes & 0xf;
int flipx = 0;
int flipy = 0;
if (sy > 240) sy -= 256;
tile_number |= attributes << 4 & 0x300;
sx = 288 - 16 - sx;
sy += 8;
if (flip_screen())
{
sx = 288 - 16 - sx;
sy = 224 + 8 - 16 - sy;
flipx = !flipx;
flipy = !flipy;
}
gfx->transpen(bitmap, cliprect,
tile_number,
color,
flipx, flipy,
sx, sy, 7);
source += 4;
}
}
uint32_t mainsnk_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, 0, 0);
m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;
}
// machine
uint8_t mainsnk_state::sound_ack_r()
{
m_audiocpu->set_input_line(0, CLEAR_LINE);
@ -137,10 +363,10 @@ void mainsnk_state::main_map(address_map &map)
map(0xc500, 0xc500).portr("DSW2");
map(0xc600, 0xc600).w(FUNC(mainsnk_state::c600_w));
map(0xc700, 0xc700).w(m_soundlatch, FUNC(generic_latch_8_device::write));
map(0xd800, 0xdbff).ram().w(FUNC(mainsnk_state::bgram_w)).share("bgram");
map(0xd800, 0xdbff).ram().w(FUNC(mainsnk_state::bgram_w)).share(m_bgram);
map(0xdc00, 0xe7ff).ram();
map(0xe800, 0xefff).ram().share("spriteram");
map(0xf000, 0xf7ff).ram().w(FUNC(mainsnk_state::fgram_w)).share("fgram"); // + work RAM
map(0xe800, 0xefff).ram().share(m_spriteram);
map(0xf000, 0xf7ff).ram().w(FUNC(mainsnk_state::fgram_w)).share(m_fgram); // + work RAM
}
void mainsnk_state::sound_map(address_map &map)
@ -169,7 +395,7 @@ static INPUT_PORTS_START( mainsnk )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("soundlatch", generic_latch_8_device, pending_r) /* sound CPU status */
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("soundlatch", generic_latch_8_device, pending_r) // sound CPU status
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE )
@ -232,8 +458,8 @@ static INPUT_PORTS_START( mainsnk )
PORT_START("DSW2")
PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DSW2:1,2,3")
// PORT_DIPSETTING( 0x04, DEF_STR( 3C_1C ) ) // duplicate
// PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) ) // duplicate
PORT_DIPSETTING( 0x04, DEF_STR( 3C_1C ) ) // duplicate
PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) ) // duplicate
PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x06, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) )
@ -243,7 +469,7 @@ static INPUT_PORTS_START( mainsnk )
PORT_DIPNAME( 0x08, 0x08, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("DSW2:4")
PORT_DIPSETTING( 0x08, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hard ) )
PORT_DIPNAME( 0x10, 0x10, "Round Time" ) PORT_DIPLOCATION("DSW2:5") /* $1ecf */
PORT_DIPNAME( 0x10, 0x10, "Round Time" ) PORT_DIPLOCATION("DSW2:5") // $1ecf
PORT_DIPSETTING( 0x10, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x00, "Short" )
PORT_DIPNAME( 0x60, 0x20, "Game mode" ) PORT_DIPLOCATION("DSW2:6,7")
@ -263,7 +489,7 @@ static INPUT_PORTS_START( canvas )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("soundlatch", generic_latch_8_device, pending_r) /* sound CPU status */
PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("soundlatch", generic_latch_8_device, pending_r) // sound CPU status
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE )
@ -301,7 +527,7 @@ static INPUT_PORTS_START( canvas )
PORT_DIPSETTING( 0x04, "3" )
PORT_DIPSETTING( 0x00, "5" )
PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DSW1:4,5,6")
// PORT_DIPSETTING( 0x08, DEF_STR( 5C_1C ) ) // duplicate
PORT_DIPSETTING( 0x08, DEF_STR( 5C_1C ) ) // duplicate
PORT_DIPSETTING( 0x10, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x18, DEF_STR( 2C_1C ) )
@ -357,8 +583,8 @@ static const gfx_layout sprite_layout =
static GFXDECODE_START( gfx_mainsnk )
GFXDECODE_ENTRY( "gfx1", 0, gfx_8x8x4_packed_lsb, 0x100, 0x080>>4 )
GFXDECODE_ENTRY( "gfx2", 0, sprite_layout, 0x000, 0x080>>3 )
GFXDECODE_ENTRY( "tiles", 0, gfx_8x8x4_packed_lsb, 0x100, 0x080 >> 4 )
GFXDECODE_ENTRY( "sprites", 0, sprite_layout, 0x000, 0x080 >> 3 )
GFXDECODE_END
@ -374,7 +600,7 @@ void mainsnk_state::mainsnk(machine_config &config)
m_audiocpu->set_addrmap(AS_IO, &mainsnk_state::sound_portmap);
m_audiocpu->set_periodic_int(FUNC(mainsnk_state::irq0_line_assert), attotime::from_hz(244));
/* video hardware */
// video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
screen.set_size(36*8, 28*8);
@ -383,7 +609,7 @@ void mainsnk_state::mainsnk(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_mainsnk);
PALETTE(config, m_palette, FUNC(mainsnk_state::mainsnk_palette), 0x400);
PALETTE(config, m_palette, FUNC(mainsnk_state::palette), 0x400);
m_palette->enable_shadows();
SPEAKER(config, "mono").front_center();
@ -409,13 +635,13 @@ ROM_START(mainsnk)
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "snk.p07", 0x0000, 0x4000, CRC(4208391e) SHA1(d110ca4ff9d21fe7813f04ec43c2c23471c6517f) )
ROM_REGION( 0x08000, "gfx1", 0 )
ROM_REGION( 0x08000, "tiles", 0 )
ROM_LOAD( "snk.p12", 0x0000, 0x2000, CRC(ecf87eb7) SHA1(83b8d19070d5930b306a0309ebba05b04c2abebf) )
ROM_LOAD( "snk.p11", 0x2000, 0x2000, CRC(3f6bc5ba) SHA1(02e49f58f5d94117113b59037fa49b8897d05b4b) )
ROM_LOAD( "snk.p10", 0x4000, 0x2000, CRC(b5147a96) SHA1(72641fadabd16f2de4f4cf6ff3ef07233de5ddfd) )
ROM_LOAD( "snk.p09", 0x6000, 0x2000, CRC(0ebcf837) SHA1(7b93cdffd3b8d768b98bb01956114e4ff012d029) )
ROM_REGION( 0x12000, "gfx2", 0 )
ROM_REGION( 0x12000, "sprites", 0 )
ROM_LOAD( "snk.p13", 0x00000, 0x2000, CRC(2eb624a4) SHA1(157d7beb6ff0baa9276e388774a85996dc03821d) )
ROM_LOAD( "snk.p16", 0x02000, 0x2000, CRC(dc502869) SHA1(024c868e8cd74c52f4787a19b9ad292b7a9dcc1c) )
ROM_LOAD( "snk.p19", 0x04000, 0x2000, CRC(58d566a1) SHA1(1451b223ddb7c975b770f28af6c41775daaf95c1) )
@ -445,13 +671,13 @@ ROM_START( canvas )
ROM_LOAD( "cc_p7.h2", 0x0000, 0x4000, CRC(029b5ea0) SHA1(88f84b4dd01656ded8d983396ded404c9d8186f1) )
ROM_LOAD( "cc_p8.f2", 0x4000, 0x2000, CRC(0f0368ce) SHA1(a02f066ea024285a931b85709822a50a4099e0b0) )
ROM_REGION( 0x10000, "gfx1", 0 )
ROM_REGION( 0x10000, "tiles", 0 )
ROM_FILL( 0x0000, 0x4000, 0xff ) // empty, causes tx layer to be fully transparent
ROM_LOAD( "cc_p11.c2", 0x4000, 0x4000, CRC(4c8c2156) SHA1(7f1d9a1e1c6cab91f24c7fc75d0c7ec2702137af) ) // banks = 18&58
ROM_LOAD( "cc_p10.b2", 0x8000, 0x4000, CRC(3c0a4eeb) SHA1(53742a5bef16e71bebefb0e43a175341f5bf0aa6) ) // banks = 28&68
ROM_LOAD( "cc_p9.a2", 0xc000, 0x4000, CRC(b58c5f24) SHA1(7026b3d4f8060fd6607eb6d356d6b61cc9cb75c3) ) // banks = 30&70
ROM_REGION( 0x6000, "gfx2", 0 )
ROM_REGION( 0x6000, "sprites", 0 )
ROM_LOAD( "cc_p12.j8", 0x0000, 0x2000, CRC(9003a979) SHA1(f63959a9dc9ee67622865e783d2e501c640a4bed) )
ROM_LOAD( "cc_p13.j5", 0x2000, 0x2000, CRC(a52cd549) SHA1(1902b8c107c5156113068ced74349ac576ac047c) )
ROM_LOAD( "cc_p14.j2", 0x4000, 0x2000, CRC(edc6a1e8) SHA1(8c948a5f057e13bb9ed9738b66c702f45586fe59) )
@ -462,6 +688,8 @@ ROM_START( canvas )
ROM_LOAD( "cc_bprom1.j10", 0x0800, 0x0400, CRC(fbbbf911) SHA1(86394a7f67bc4f89f72b9607ca3733ab3d690289) )
ROM_END
} // anonymous namespace
GAME( 1984, mainsnk, 0, mainsnk, mainsnk, mainsnk_state, empty_init, ROT180, "SNK", "Main Event (1984)", MACHINE_SUPPORTS_SAVE )
GAME( 1985, canvas, 0, mainsnk, canvas, mainsnk_state, empty_init, ROT0, "SNK", "Canvas Croquis", MACHINE_SUPPORTS_SAVE )
GAME( 1985, canvas, 0, mainsnk, canvas, mainsnk_state, empty_init, ROT0, "SNK", "Canvas Croquis", MACHINE_SUPPORTS_SAVE )

View File

@ -1,66 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood, Tomasz Slanina
#ifndef MAME_INCLUDES_MAINSNK_H
#define MAME_INCLUDES_MAINSNK_H
#pragma once
#include "machine/gen_latch.h"
#include "emupal.h"
#include "tilemap.h"
class mainsnk_state : public driver_device
{
public:
mainsnk_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch"),
m_bgram(*this, "bgram"),
m_spriteram(*this, "spriteram"),
m_fgram(*this, "fgram")
{ }
void mainsnk(machine_config &config);
protected:
virtual void video_start() override;
private:
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;
required_shared_ptr<uint8_t> m_bgram;
required_shared_ptr<uint8_t> m_spriteram;
required_shared_ptr<uint8_t> m_fgram;
tilemap_t *m_tx_tilemap = nullptr;
tilemap_t *m_bg_tilemap = nullptr;
int m_sound_cpu_busy = 0;
uint32_t m_bg_tile_offset = 0;
uint8_t sound_ack_r();
void c600_w(uint8_t data);
void fgram_w(offs_t offset, uint8_t data);
void bgram_w(offs_t offset, uint8_t data);
TILEMAP_MAPPER_MEMBER(marvins_tx_scan_cols);
TILE_GET_INFO_MEMBER(get_tx_tile_info);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
void mainsnk_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, int scrollx, int scrolly );
void main_map(address_map &map);
void sound_map(address_map &map);
void sound_portmap(address_map &map);
};
#endif // MAME_INCLUDES_MAINSNK_H

View File

@ -1,170 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood, Tomasz Slanina
#include "emu.h"
#include "mainsnk.h"
void mainsnk_state::mainsnk_palette(palette_device &palette) const
{
uint8_t const *const color_prom = memregion("proms")->base();
constexpr int num_colors = 0x400;
for (int i = 0; i < num_colors; i++)
{
int bit0, bit1, bit2, bit3;
bit0 = BIT(color_prom[i + 2*num_colors], 3);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
bit3 = BIT(color_prom[i], 3);
int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = BIT(color_prom[i + 2*num_colors], 2);
bit1 = BIT(color_prom[i + num_colors], 2);
bit2 = BIT(color_prom[i + num_colors], 3);
bit3 = BIT(color_prom[i], 0);
int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = BIT(color_prom[i + 2*num_colors], 0);
bit1 = BIT(color_prom[i + 2*num_colors], 1);
bit2 = BIT(color_prom[i + num_colors], 0);
bit3 = BIT(color_prom[i + num_colors], 1);
int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
TILEMAP_MAPPER_MEMBER(mainsnk_state::marvins_tx_scan_cols)
{
// tilemap is 36x28, the central part is from the first RAM page and the
// extra 4 columns are from the second page
col -= 2;
if (col & 0x20)
return 0x400 + row + ((col & 0x1f) << 5);
else
return row + (col << 5);
}
TILE_GET_INFO_MEMBER(mainsnk_state::get_tx_tile_info)
{
int code = m_fgram[tile_index];
tileinfo.set(0,
code,
0,
tile_index & 0x400 ? TILE_FORCE_LAYER0 : 0);
}
TILE_GET_INFO_MEMBER(mainsnk_state::get_bg_tile_info)
{
int code = (m_bgram[tile_index]);
tileinfo.set(0,
m_bg_tile_offset + code,
0,
0);
}
void mainsnk_state::video_start()
{
m_tx_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mainsnk_state::get_tx_tile_info)), tilemap_mapper_delegate(*this, FUNC(mainsnk_state::marvins_tx_scan_cols)), 8, 8, 36, 28);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(mainsnk_state::get_bg_tile_info)), TILEMAP_SCAN_COLS, 8, 8, 32, 32);
m_tx_tilemap->set_transparent_pen(15);
m_tx_tilemap->set_scrolldy(8, 8);
m_bg_tilemap->set_scrolldx(16, 16);
m_bg_tilemap->set_scrolldy(8, 8);
save_item(NAME(m_bg_tile_offset));
}
void mainsnk_state::c600_w(uint8_t data)
{
int total_elements = m_gfxdecode->gfx(0)->elements();
flip_screen_set(BIT(data, 7));
m_bg_tilemap->set_palette_offset((data & 0x07) << 4);
m_tx_tilemap->set_palette_offset((data & 0x07) << 4);
int bank = 0;
if (total_elements == 0x400) // mainsnk
bank = ((data & 0x30) >> 4);
else if (total_elements == 0x800) // canvas
bank = ((data & 0x40) >> 6) | ((data & 0x30) >> 3);
if (m_bg_tile_offset != (bank << 8))
{
m_bg_tile_offset = bank << 8;
m_bg_tilemap->mark_all_dirty();
}
}
void mainsnk_state::fgram_w(offs_t offset, uint8_t data)
{
m_fgram[offset] = data;
m_tx_tilemap->mark_tile_dirty(offset);
}
void mainsnk_state::bgram_w(offs_t offset, uint8_t data)
{
m_bgram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
void mainsnk_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int scrollx, int scrolly )
{
gfx_element *gfx = m_gfxdecode->gfx(1);
const uint8_t *source, *finish;
source = m_spriteram;
finish = source + 25*4;
while( source<finish )
{
int attributes = source[3];
int tile_number = source[1];
int sy = source[0];
int sx = source[2];
int color = attributes&0xf;
int flipx = 0;
int flipy = 0;
if( sy>240 ) sy -= 256;
tile_number |= attributes<<4 & 0x300;
sx = 288-16 - sx;
sy += 8;
if (flip_screen())
{
sx = 288-16 - sx;
sy = 224+8-16 - sy;
flipx = !flipx;
flipy = !flipy;
}
gfx->transpen(bitmap,cliprect,
tile_number,
color,
flipx,flipy,
sx,sy,7);
source+=4;
}
}
uint32_t mainsnk_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, 0, 0);
m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;
}

View File

@ -17,7 +17,7 @@ Stephh's notes (based on the game Z80 code and some tests) :
- The "Continue after Game Over" Dip Switch (DSW1:1) allows the player
to continue from where he lost his last life when he starts a new game.
IMO, this is a debug feature (as often with SNK games) as there is
NO continue routine nor text for it in the ROMS.
NO continue routine nor text for it in the ROMs.
See code at 0x013a ('joyfulr') or 0x013e ('mnchmobl') for more infos.
- There is extra code at 0x1de2 in 'mnchmobl' but it doesn't seem to be used.
@ -26,13 +26,251 @@ Stephh's notes (based on the game Z80 code and some tests) :
***************************************************************************/
#include "emu.h"
#include "munchmo.h"
#include "cpu/z80/z80.h"
#include "machine/gen_latch.h"
#include "machine/74259.h"
#include "sound/ay8910.h"
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
namespace {
class munchmo_state : public driver_device
{
public:
munchmo_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_sprite_xpos(*this, "sprite_xpos")
, m_sprite_tile(*this, "sprite_tile")
, m_sprite_attr(*this, "sprite_attr")
, m_videoram(*this, "videoram")
, m_status_vram(*this, "status_vram")
, m_vreg(*this, "vreg")
, m_tiles_rom(*this, "tiles")
, m_maincpu(*this, "maincpu")
, m_audiocpu(*this, "audiocpu")
, m_mainlatch(*this, "mainlatch")
, m_gfxdecode(*this, "gfxdecode")
, m_palette(*this, "palette")
, m_soundlatch(*this, "soundlatch")
, m_ay8910(*this, "ay%u", 1U)
{
}
void mnchmobl(machine_config &config);
protected:
virtual void machine_start() override;
virtual void video_start() override;
private:
DECLARE_WRITE_LINE_MEMBER(nmi_enable_w);
void nmi_ack_w(u8 data);
void sound_nmi_ack_w(u8 data);
template <u8 Which> u8 ayreset_r();
DECLARE_WRITE_LINE_MEMBER(palette_bank_0_w);
DECLARE_WRITE_LINE_MEMBER(palette_bank_1_w);
DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
void palette(palette_device &palette) const;
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
IRQ_CALLBACK_MEMBER(generic_irq_ack);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_status(bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_background(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);
// memory pointers
required_shared_ptr<u8> m_sprite_xpos;
required_shared_ptr<u8> m_sprite_tile;
required_shared_ptr<u8> m_sprite_attr;
required_shared_ptr<u8> m_videoram;
required_shared_ptr<u8> m_status_vram;
required_shared_ptr<u8> m_vreg;
required_region_ptr<u8> m_tiles_rom;
// video-related
std::unique_ptr<bitmap_ind16> m_tmpbitmap;
u8 m_palette_bank = 0U;
u8 m_flipscreen = 0U;
// misc
u8 m_nmi_enable = 0U;
// devices
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<ls259_device> m_mainlatch;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
required_device_array<ay8910_device, 2> m_ay8910;
};
// video
void munchmo_state::palette(palette_device &palette) const
{
u8 const *const color_prom = memregion("proms")->base();
for (int i = 0; i < palette.entries(); i++)
{
// red component
int bit0 = BIT(color_prom[i], 0);
int bit1 = BIT(color_prom[i], 1);
int 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 = BIT(color_prom[i], 6);
bit1 = BIT(color_prom[i], 7);
int const b = 0x4f * bit0 + 0xa8 * bit1;
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
WRITE_LINE_MEMBER(munchmo_state::palette_bank_0_w)
{
m_palette_bank = (state ? 1 : 0) | (m_palette_bank & 2);
}
WRITE_LINE_MEMBER(munchmo_state::palette_bank_1_w)
{
m_palette_bank = (state ? 2 : 0) | (m_palette_bank & 1);
}
WRITE_LINE_MEMBER(munchmo_state::flipscreen_w)
{
m_flipscreen = state;
}
void munchmo_state::video_start()
{
m_tmpbitmap = std::make_unique<bitmap_ind16>(512, 512);
}
void munchmo_state::draw_status(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
gfx_element *gfx = m_gfxdecode->gfx(0);
for (int row = 0; row < 4; row++)
{
int sx = (row & 1) * 8;
const u8 *source = m_status_vram + (~row & 1) * 32;
if (row <= 1)
{
source += 2 * 32;
sx += 256 + 32 + 16;
}
for (int sy = 0; sy < 256; sy += 8)
{
gfx->opaque(bitmap, cliprect,
*source++,
0, // color
0, 0, // no flip
sx, sy);
}
}
}
void munchmo_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
// ROM B1.2C contains 256 tilemaps defining 4x4 configurations of the tiles in ROM B2.2B
gfx_element *gfx = m_gfxdecode->gfx(1);
for (int offs = 0; offs < 0x100; offs++)
{
int sy = (offs % 16) * 32;
int sx = (offs / 16) * 32;
int tile_number = m_videoram[offs];
for (int row = 0; row < 4; row++)
{
for (int col = 0; col < 4; col++)
{
gfx->opaque(*m_tmpbitmap, m_tmpbitmap->cliprect(),
m_tiles_rom[col + tile_number * 4 + row * 0x400],
m_palette_bank,
0, 0, // flip
sx + col * 8, sy + row * 8);
}
}
}
{
int scrollx = -(m_vreg[2] *2 + (m_vreg[3] >> 7)) - 64 - 128 - 16;
int scrolly = 0;
copyscrollbitmap(bitmap, *m_tmpbitmap, 1, &scrollx, 1, &scrolly, cliprect);
}
}
void munchmo_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int scroll = m_vreg[2];
int flags = m_vreg[3]; // XB??????
int xadjust = - 128 - 16 - ((flags & 0x80) ? 1 : 0);
int bank = (flags & 0x40) ? 1 : 0;
gfx_element *gfx = m_gfxdecode->gfx(2 + bank);
int color_base = m_palette_bank * 4 + 3;
int firstsprite = m_vreg[0] & 0x3f;
for (int i = firstsprite; i < firstsprite + 0x40; i++)
{
for (int j = 0; j < 8; j++)
{
int offs = (j << 6) | (i & 0x3f);
int tile_number = m_sprite_tile[offs]; // ETTTTTTT
int attributes = m_sprite_attr[offs]; // XYYYYYCC
int sx = m_sprite_xpos[offs]; // XXXXXXX?
int sy = (offs >> 6) << 5; // Y YY------
sy += (attributes >> 2) & 0x1f;
if (attributes & 0x80)
{
sx = (sx >> 1) | (tile_number & 0x80);
sx = 2 * ((- 32 - scroll - sx) & 0xff) + xadjust;
gfx->transpen(bitmap, cliprect,
0x7f - (tile_number & 0x7f),
color_base - (attributes & 0x03),
0, 0, // no flip
sx, sy, 7);
}
}
}
}
u32 munchmo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
draw_background(bitmap, cliprect);
draw_sprites(bitmap, cliprect);
draw_status(bitmap, cliprect);
return 0;
}
// machine
/*************************************
*
* Memory handlers
@ -44,7 +282,7 @@ WRITE_LINE_MEMBER(munchmo_state::nmi_enable_w)
m_nmi_enable = state;
}
/* trusted thru schematics, NMI and IRQ triggers at vblank, at the same time (!) */
// trusted through schematics, NMI and IRQ triggers at vblank, at the same time (!)
WRITE_LINE_MEMBER(munchmo_state::vblank_irq)
{
if (state)
@ -63,25 +301,20 @@ IRQ_CALLBACK_MEMBER(munchmo_state::generic_irq_ack)
return 0xff;
}
void munchmo_state::nmi_ack_w(uint8_t data)
void munchmo_state::nmi_ack_w(u8 data)
{
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
void munchmo_state::sound_nmi_ack_w(uint8_t data)
void munchmo_state::sound_nmi_ack_w(u8 data)
{
m_audiocpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE);
}
uint8_t munchmo_state::ay1reset_r()
template <u8 Which>
u8 munchmo_state::ayreset_r()
{
m_ay8910[0]->reset_w();
return 0;
}
uint8_t munchmo_state::ay2reset_r()
{
m_ay8910[1]->reset_w();
m_ay8910[Which]->reset_w();
return 0;
}
@ -91,7 +324,7 @@ uint8_t munchmo_state::ay2reset_r()
*
*************************************/
void munchmo_state::mnchmobl_map(address_map &map)
void munchmo_state::main_map(address_map &map)
{
map(0x0000, 0x3fff).rom();
map(0x8000, 0x83ff).ram();
@ -99,7 +332,7 @@ void munchmo_state::mnchmobl_map(address_map &map)
map(0xa800, 0xabff).mirror(0x0400).ram().share(m_sprite_tile);
map(0xb000, 0xb3ff).mirror(0x0400).ram().share(m_sprite_attr);
map(0xb800, 0xb8ff).mirror(0x0100).ram().share(m_videoram);
map(0xbaba, 0xbaba).nopw(); /* ? */
map(0xbaba, 0xbaba).nopw(); // ?
map(0xbc00, 0xbc7f).ram().share(m_status_vram);
map(0xbe00, 0xbe00).w(m_soundlatch, FUNC(generic_latch_8_device::write));
map(0xbe01, 0xbe01).select(0x0070).lw8(NAME([this] (offs_t offset, u8 data){ m_mainlatch->write_d0(offset >> 4, data); }));
@ -112,7 +345,7 @@ void munchmo_state::mnchmobl_map(address_map &map)
map(0xbf04, 0xbf07).writeonly().share(m_vreg); // MY0 1-8C
}
/* memory map provided thru schematics */
// memory map provided through schematics
void munchmo_state::sound_map(address_map &map)
{
map(0x0000, 0x1fff).rom();
@ -121,8 +354,8 @@ void munchmo_state::sound_map(address_map &map)
map(0x5000, 0x5fff).w(m_ay8910[0], FUNC(ay8910_device::address_w));
map(0x6000, 0x6fff).w(m_ay8910[1], FUNC(ay8910_device::data_w));
map(0x7000, 0x7fff).w(m_ay8910[1], FUNC(ay8910_device::address_w));
map(0x8000, 0x9fff).r(FUNC(munchmo_state::ay1reset_r)).w(m_ay8910[0], FUNC(ay8910_device::reset_w));
map(0xa000, 0xbfff).r(FUNC(munchmo_state::ay2reset_r)).w(m_ay8910[1], FUNC(ay8910_device::reset_w));
map(0x8000, 0x9fff).r(FUNC(munchmo_state::ayreset_r<0>)).w(m_ay8910[0], FUNC(ay8910_device::reset_w));
map(0xa000, 0xbfff).r(FUNC(munchmo_state::ayreset_r<1>)).w(m_ay8910[1], FUNC(ay8910_device::reset_w));
map(0xc000, 0xdfff).w(FUNC(munchmo_state::sound_nmi_ack_w)); // NCL 1-8H
map(0xe000, 0xe7ff).mirror(0x1800).ram(); // is mirror ok?
}
@ -164,7 +397,7 @@ static INPUT_PORTS_START( mnchmobl )
PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("DSW1")
/* See notes about this DIP */
// See notes about this DIP
PORT_DIPNAME( 0x01, 0x00, "Continue after Game Over (Cheat)" ) PORT_DIPLOCATION("SW1:1")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x01, DEF_STR( On ) )
@ -174,6 +407,11 @@ static INPUT_PORTS_START( mnchmobl )
PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x16, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 1C_1C ) )
// Duplicate Settings
PORT_DIPSETTING( 0x1e, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x1c, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x1a, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x18, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x12, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x02, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 1C_3C ) )
@ -183,11 +421,6 @@ static INPUT_PORTS_START( mnchmobl )
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_7C ) )
PORT_DIPSETTING( 0x0e, DEF_STR( 1C_8C ) )
// Duplicate Settings
// PORT_DIPSETTING( 0x1e, DEF_STR( 1C_1C ) )
// PORT_DIPSETTING( 0x1c, DEF_STR( 1C_1C ) )
// PORT_DIPSETTING( 0x1a, DEF_STR( 1C_1C ) )
// PORT_DIPSETTING( 0x18, DEF_STR( 1C_1C ) )
PORT_DIPNAME( 0xe0, 0x00, "1st Bonus" ) PORT_DIPLOCATION("SW1:6,7,8")
PORT_DIPSETTING( 0x00, "10000" )
@ -293,10 +526,10 @@ static const gfx_layout sprite_layout2 =
};
static GFXDECODE_START( gfx_mnchmobl )
GFXDECODE_ENTRY( "gfx1", 0, char_layout, 0, 4 ) /* colors 0- 63 */
GFXDECODE_ENTRY( "gfx2", 0x1000, tile_layout, 64, 4 ) /* colors 64-127 */
GFXDECODE_ENTRY( "gfx3", 0, sprite_layout1, 128, 16 ) /* colors 128-255 */
GFXDECODE_ENTRY( "gfx4", 0, sprite_layout2, 128, 16 ) /* colors 128-255 */
GFXDECODE_ENTRY( "chars", 0, char_layout, 0, 4 ) // colors 0- 63
GFXDECODE_ENTRY( "tiles", 0x1000, tile_layout, 64, 4 ) // colors 64-127
GFXDECODE_ENTRY( "sprites", 0, sprite_layout1, 128, 16 ) // colors 128-255
GFXDECODE_ENTRY( "monochrome_sprites", 0, sprite_layout2, 128, 16 ) // colors 128-255
GFXDECODE_END
/*************************************
@ -314,12 +547,12 @@ void munchmo_state::machine_start()
void munchmo_state::mnchmobl(machine_config &config)
{
/* basic machine hardware */
Z80(config, m_maincpu, XTAL(15'000'000)/4); // from pin 13 of XTAL-driven 163
m_maincpu->set_addrmap(AS_PROGRAM, &munchmo_state::mnchmobl_map);
// basic machine hardware
Z80(config, m_maincpu, XTAL(15'000'000) / 4); // from pin 13 of XTAL-driven 163
m_maincpu->set_addrmap(AS_PROGRAM, &munchmo_state::main_map);
m_maincpu->set_irq_acknowledge_callback(FUNC(munchmo_state::generic_irq_ack)); // IORQ clears flip-flop at 1-2C
Z80(config, m_audiocpu, XTAL(15'000'000)/8); // from pin 12 of XTAL-driven 163
Z80(config, m_audiocpu, XTAL(15'000'000) / 8); // from pin 12 of XTAL-driven 163
m_audiocpu->set_addrmap(AS_PROGRAM, &munchmo_state::sound_map);
m_audiocpu->set_irq_acknowledge_callback(FUNC(munchmo_state::generic_irq_ack)); // IORQ clears flip-flop at 1-7H
@ -332,10 +565,10 @@ void munchmo_state::mnchmobl(machine_config &config)
m_mainlatch->q_out_cb<5>().set_nop(); // DISP
m_mainlatch->q_out_cb<6>().set(FUNC(munchmo_state::nmi_enable_w)); // ENI 1-10C
/* video hardware */
// video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(57);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate
screen.set_size(256+32+32, 256);
screen.set_visarea(0, 255+32+32,0, 255-16);
screen.set_screen_update(FUNC(munchmo_state::screen_update));
@ -343,19 +576,19 @@ void munchmo_state::mnchmobl(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_mnchmobl);
PALETTE(config, m_palette, FUNC(munchmo_state::munchmo_palette), 256);
PALETTE(config, m_palette, FUNC(munchmo_state::palette), 256);
/* sound hardware */
// sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch).data_pending_callback().set_inputline(m_audiocpu, 0, ASSERT_LINE);
/* AY clock speeds confirmed to match known recording */
AY8910(config, m_ay8910[0], XTAL(15'000'000)/8);
// AY clock speeds confirmed to match known recording
AY8910(config, m_ay8910[0], XTAL(15'000'000) / 8);
//m_ay8910[0]->set_flags(AY8910_SINGLE_OUTPUT);
m_ay8910[0]->add_route(ALL_OUTPUTS, "mono", 0.50);
AY8910(config, m_ay8910[1], XTAL(15'000'000)/8);
AY8910(config, m_ay8910[1], XTAL(15'000'000) / 8);
//m_ay8910[1]->set_flags(AY8910_SINGLE_OUTPUT);
m_ay8910[1]->add_route(ALL_OUTPUTS, "mono", 0.50);
}
@ -368,61 +601,63 @@ void munchmo_state::mnchmobl(machine_config &config)
*************************************/
ROM_START( joyfulr )
ROM_REGION( 0x10000, "maincpu", 0 ) /* 64k for CPUA */
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "m1j.10e", 0x0000, 0x2000, CRC(1fe86e25) SHA1(e13abc20741dfd8a260f354efda3b3a25c820343) )
ROM_LOAD( "m2j.10d", 0x2000, 0x2000, CRC(b144b9a6) SHA1(efed5fd6ba941b2baa7c8a17fe7323172c8fb17c) )
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "mu.2j", 0x0000, 0x2000, CRC(420adbd4) SHA1(3da18cda97ca604dc074b50c4f36287e0679224a) )
ROM_REGION( 0x2000, "gfx1", 0 )
ROM_LOAD( "s1.10a", 0x0000, 0x1000, CRC(c0bcc301) SHA1(b8961e7bbced4dfe9c72f839ea9b89d3f2e629b2) ) /* characters */
ROM_REGION( 0x2000, "chars", 0 )
ROM_LOAD( "s1.10a", 0x0000, 0x1000, CRC(c0bcc301) SHA1(b8961e7bbced4dfe9c72f839ea9b89d3f2e629b2) )
ROM_LOAD( "s2.10b", 0x1000, 0x1000, CRC(96aa11ca) SHA1(84438d6b27d520e95b8706c91c5c20de1785604c) )
ROM_REGION( 0x2000, "gfx2", 0 )
ROM_LOAD( "b1.2c", 0x0000, 0x1000, CRC(8ce3a403) SHA1(eec5813076c31bb8534f7d1f83f2a397e552ed69) ) /* tile layout */
ROM_LOAD( "b2.2b", 0x1000, 0x1000, CRC(0df28913) SHA1(485700d3b7f2bfcb970e8f9edb7d18ed9a708bd2) ) /* 4x8 tiles */
ROM_REGION( 0x2000, "tiles", 0 ) // 4x8
ROM_LOAD( "b1.2c", 0x0000, 0x1000, CRC(8ce3a403) SHA1(eec5813076c31bb8534f7d1f83f2a397e552ed69) )
ROM_LOAD( "b2.2b", 0x1000, 0x1000, CRC(0df28913) SHA1(485700d3b7f2bfcb970e8f9edb7d18ed9a708bd2) )
ROM_REGION( 0x6000, "gfx3", 0 )
ROM_LOAD( "f1j.1g", 0x0000, 0x2000, CRC(93c3c17e) SHA1(902f458c4efe74187a58a3c1ecd146e343657977) ) /* sprites */
ROM_REGION( 0x6000, "sprites", 0 )
ROM_LOAD( "f1j.1g", 0x0000, 0x2000, CRC(93c3c17e) SHA1(902f458c4efe74187a58a3c1ecd146e343657977) )
ROM_LOAD( "f2j.3g", 0x2000, 0x2000, CRC(b3fb5bd2) SHA1(51ff8b0bec092c9404944d6069c4493049604cb8) )
ROM_LOAD( "f3j.5g", 0x4000, 0x2000, CRC(772a7527) SHA1(fe561d5323472e79051614a374e92aab17636055) )
ROM_REGION( 0x2000, "gfx4", 0 )
ROM_LOAD( "h", 0x0000, 0x2000, CRC(332584de) SHA1(9ef75a77e6cc298a315d80b7f2d24414827c7063) ) /* monochrome sprites */
ROM_REGION( 0x2000, "monochrome_sprites", 0 )
ROM_LOAD( "h", 0x0000, 0x2000, CRC(332584de) SHA1(9ef75a77e6cc298a315d80b7f2d24414827c7063) )
ROM_REGION( 0x0100, "proms", 0 )
ROM_LOAD( "a2001.clr", 0x0000, 0x0100, CRC(1b16b907) SHA1(fc362174af128827b0b8119fdc1b5569598c087a) ) /* color prom */
ROM_REGION( 0x0100, "proms", 0 ) // color
ROM_LOAD( "a2001.clr", 0x0000, 0x0100, CRC(1b16b907) SHA1(fc362174af128827b0b8119fdc1b5569598c087a) )
ROM_END
ROM_START( mnchmobl )
ROM_REGION( 0x10000, "maincpu", 0 ) /* 64k for CPUA */
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "m1.10e", 0x0000, 0x2000, CRC(a4bebc6a) SHA1(7c13b2b87168dee3c1b8e931487a56d0a528386e) )
ROM_LOAD( "m2.10d", 0x2000, 0x2000, CRC(f502d466) SHA1(4da5a32b3903fb7fbef38fc385408b9390b5f57f) )
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "mu.2j", 0x0000, 0x2000, CRC(420adbd4) SHA1(3da18cda97ca604dc074b50c4f36287e0679224a) )
ROM_REGION( 0x2000, "gfx1", 0 )
ROM_LOAD( "s1.10a", 0x0000, 0x1000, CRC(c0bcc301) SHA1(b8961e7bbced4dfe9c72f839ea9b89d3f2e629b2) ) /* characters */
ROM_REGION( 0x2000, "chars", 0 )
ROM_LOAD( "s1.10a", 0x0000, 0x1000, CRC(c0bcc301) SHA1(b8961e7bbced4dfe9c72f839ea9b89d3f2e629b2) )
ROM_LOAD( "s2.10b", 0x1000, 0x1000, CRC(96aa11ca) SHA1(84438d6b27d520e95b8706c91c5c20de1785604c) )
ROM_REGION( 0x2000, "gfx2", 0 )
ROM_LOAD( "b1.2c", 0x0000, 0x1000, CRC(8ce3a403) SHA1(eec5813076c31bb8534f7d1f83f2a397e552ed69) ) /* tile layout */
ROM_LOAD( "b2.2b", 0x1000, 0x1000, CRC(0df28913) SHA1(485700d3b7f2bfcb970e8f9edb7d18ed9a708bd2) ) /* 4x8 tiles */
ROM_REGION( 0x2000, "tiles", 0 ) // 4x8
ROM_LOAD( "b1.2c", 0x0000, 0x1000, CRC(8ce3a403) SHA1(eec5813076c31bb8534f7d1f83f2a397e552ed69) )
ROM_LOAD( "b2.2b", 0x1000, 0x1000, CRC(0df28913) SHA1(485700d3b7f2bfcb970e8f9edb7d18ed9a708bd2) )
ROM_REGION( 0x6000, "gfx3", 0 )
ROM_LOAD( "f1.1g", 0x0000, 0x2000, CRC(b75411d4) SHA1(d058a6c219676f8ba4e498215f5716c630bb1d20) ) /* sprites */
ROM_REGION( 0x6000, "sprites", 0 )
ROM_LOAD( "f1.1g", 0x0000, 0x2000, CRC(b75411d4) SHA1(d058a6c219676f8ba4e498215f5716c630bb1d20) )
ROM_LOAD( "f2.3g", 0x2000, 0x2000, CRC(539a43ba) SHA1(a7b30c41d9fdb420ec8f0c6441432c1b2b69c4be) )
ROM_LOAD( "f3.5g", 0x4000, 0x2000, CRC(ec996706) SHA1(e71e99061ce83068b0ec60ae97759a9d78c7cdf9) )
ROM_REGION( 0x2000, "gfx4", 0 )
ROM_LOAD( "h", 0x0000, 0x2000, CRC(332584de) SHA1(9ef75a77e6cc298a315d80b7f2d24414827c7063) ) /* monochrome sprites */
ROM_REGION( 0x2000, "monochrome_sprites", 0 )
ROM_LOAD( "h", 0x0000, 0x2000, CRC(332584de) SHA1(9ef75a77e6cc298a315d80b7f2d24414827c7063) )
ROM_REGION( 0x0100, "proms", 0 )
ROM_LOAD( "a2001.clr", 0x0000, 0x0100, CRC(1b16b907) SHA1(fc362174af128827b0b8119fdc1b5569598c087a) ) /* color prom */
ROM_REGION( 0x0100, "proms", 0 ) // color
ROM_LOAD( "a2001.clr", 0x0000, 0x0100, CRC(1b16b907) SHA1(fc362174af128827b0b8119fdc1b5569598c087a) )
ROM_END
} // anonymous namespace
/*************************************
*

View File

@ -1,96 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Phil Stroffolino
/*************************************************************************
Munch Mobile
*************************************************************************/
#ifndef MAME_INCLUDES_MUNCHMO_H
#define MAME_INCLUDES_MUNCHMO_H
#pragma once
#include "machine/gen_latch.h"
#include "machine/74259.h"
#include "sound/ay8910.h"
#include "emupal.h"
class munchmo_state : public driver_device
{
public:
munchmo_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_sprite_xpos(*this, "sprite_xpos")
, m_sprite_tile(*this, "sprite_tile")
, m_sprite_attr(*this, "sprite_attr")
, m_videoram(*this, "videoram")
, m_status_vram(*this, "status_vram")
, m_vreg(*this, "vreg")
, m_maincpu(*this, "maincpu")
, m_audiocpu(*this, "audiocpu")
, m_mainlatch(*this, "mainlatch")
, m_gfxdecode(*this, "gfxdecode")
, m_palette(*this, "palette")
, m_soundlatch(*this, "soundlatch")
, m_ay8910(*this, "ay%u", 1U)
{
}
void mnchmobl(machine_config &config);
protected:
virtual void machine_start() override;
virtual void video_start() override;
private:
DECLARE_WRITE_LINE_MEMBER(nmi_enable_w);
void nmi_ack_w(uint8_t data);
void sound_nmi_ack_w(uint8_t data);
uint8_t ay1reset_r();
uint8_t ay2reset_r();
DECLARE_WRITE_LINE_MEMBER(palette_bank_0_w);
DECLARE_WRITE_LINE_MEMBER(palette_bank_1_w);
DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
void munchmo_palette(palette_device &palette) const;
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
IRQ_CALLBACK_MEMBER(generic_irq_ack);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_status( bitmap_ind16 &bitmap, const rectangle &cliprect );
void draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect );
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void mnchmobl_map(address_map &map);
void sound_map(address_map &map);
/* memory pointers */
required_shared_ptr<uint8_t> m_sprite_xpos;
required_shared_ptr<uint8_t> m_sprite_tile;
required_shared_ptr<uint8_t> m_sprite_attr;
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_status_vram;
required_shared_ptr<uint8_t> m_vreg;
/* video-related */
std::unique_ptr<bitmap_ind16> m_tmpbitmap;
int m_palette_bank = 0;
int m_flipscreen = 0;
/* misc */
int m_nmi_enable = 0;
/* devices */
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<ls259_device> m_mainlatch;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<generic_latch_8_device> m_soundlatch;
required_device_array<ay8910_device, 2> m_ay8910;
};
#endif // MAME_INCLUDES_MUNCHMO_H

View File

@ -1,161 +0,0 @@
// license:BSD-3-Clause
// copyright-holders:Phil Stroffolino
#include "emu.h"
#include "munchmo.h"
void munchmo_state::munchmo_palette(palette_device &palette) const
{
u8 const *const color_prom = memregion("proms")->base();
for (int i = 0; i < palette.entries(); 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 = BIT(color_prom[i], 6);
bit1 = BIT(color_prom[i], 7);
int const b = 0x4f * bit0 + 0xa8 * bit1;
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
WRITE_LINE_MEMBER(munchmo_state::palette_bank_0_w)
{
m_palette_bank = (state ? 1 : 0) | (m_palette_bank & 2);
}
WRITE_LINE_MEMBER(munchmo_state::palette_bank_1_w)
{
m_palette_bank = (state ? 2 : 0) | (m_palette_bank & 1);
}
WRITE_LINE_MEMBER(munchmo_state::flipscreen_w)
{
m_flipscreen = state;
}
void munchmo_state::video_start()
{
m_tmpbitmap = std::make_unique<bitmap_ind16>(512, 512);
}
void munchmo_state::draw_status( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
gfx_element *gfx = m_gfxdecode->gfx(0);
int row;
for (row = 0; row < 4; row++)
{
int sy, sx = (row & 1) * 8;
const u8 *source = m_status_vram + (~row & 1) * 32;
if (row <= 1)
{
source += 2 * 32;
sx += 256 + 32 + 16;
}
for (sy = 0; sy < 256; sy += 8)
{
gfx->opaque(bitmap,cliprect,
*source++,
0, /* color */
0,0, /* no flip */
sx,sy );
}
}
}
void munchmo_state::draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
/*
ROM B1.2C contains 256 tilemaps defining 4x4 configurations of
the tiles in ROM B2.2B
*/
u8 *rom = memregion("gfx2")->base();
gfx_element *gfx = m_gfxdecode->gfx(1);
int offs;
for (offs = 0; offs < 0x100; offs++)
{
int sy = (offs % 16) * 32;
int sx = (offs / 16) * 32;
int tile_number = m_videoram[offs];
int row, col;
for (row = 0; row < 4; row++)
{
for (col = 0; col < 4; col++)
{
gfx->opaque(*m_tmpbitmap,m_tmpbitmap->cliprect(),
rom[col + tile_number * 4 + row * 0x400],
m_palette_bank,
0,0, /* flip */
sx + col * 8, sy + row * 8 );
}
}
}
{
int scrollx = -(m_vreg[2] *2 + (m_vreg[3] >> 7)) - 64 - 128 - 16;
int scrolly = 0;
copyscrollbitmap(bitmap, *m_tmpbitmap, 1, &scrollx, 1, &scrolly, cliprect);
}
}
void munchmo_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
int scroll = m_vreg[2];
int flags = m_vreg[3]; /* XB?????? */
int xadjust = - 128 - 16 - ((flags & 0x80) ? 1 : 0);
int bank = (flags & 0x40) ? 1 : 0;
gfx_element *gfx = m_gfxdecode->gfx(2 + bank);
int color_base = m_palette_bank * 4 + 3;
int i, j;
int firstsprite = m_vreg[0] & 0x3f;
for (i = firstsprite; i < firstsprite + 0x40; i++)
{
for (j = 0; j < 8; j++)
{
int offs = (j << 6) | (i & 0x3f);
int tile_number = m_sprite_tile[offs]; /* ETTTTTTT */
int attributes = m_sprite_attr[offs]; /* XYYYYYCC */
int sx = m_sprite_xpos[offs]; /* XXXXXXX? */
int sy = (offs >> 6) << 5; /* Y YY------ */
sy += (attributes >> 2) & 0x1f;
if( attributes & 0x80 )
{
sx = (sx >> 1) | (tile_number & 0x80);
sx = 2 * ((- 32 - scroll - sx) & 0xff) + xadjust;
gfx->transpen(bitmap,cliprect,
0x7f - (tile_number & 0x7f),
color_base - (attributes & 0x03),
0,0, /* no flip */
sx,sy, 7 );
}
}
}
}
u32 munchmo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
draw_background(bitmap, cliprect);
draw_sprites(bitmap, cliprect);
draw_status(bitmap, cliprect);
return 0;
}

View File

@ -224,7 +224,7 @@ void pvmil_state::pvmil(machine_config &config)
}
ROM_START( pvmil )
ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) // Fujistu 29Z0002TN, read as ST M29W320FB
ROM_REGION( 0x800000, "maincpu", ROMREGION_ERASE00 ) // Fujitsu 29Z0002TN, read as ST M29W320FB
ROM_LOAD16_WORD_SWAP( "millionare4.bin", 0x000000, 0x400000, CRC(9c43d0f2) SHA1(fb4ba0115000b10b7c0e0d44b9fa3234c900e694) )
ROM_END