alibaba: add mystery item clock

This commit is contained in:
hap 2025-01-04 21:06:22 +01:00
parent d62f266647
commit f858997ccd
7 changed files with 745 additions and 601 deletions

View File

@ -115,7 +115,8 @@ class jrpacman_state : public pacman_state
{
public:
jrpacman_state(const machine_config &mconfig, device_type type, const char *tag)
: pacman_state(mconfig, type, tag) { }
: pacman_state(mconfig, type, tag)
{ }
void jrpacman(machine_config &config);
@ -285,14 +286,14 @@ void jrpacman_state::jrpacman(machine_config &config)
WATCHDOG_TIMER(config, m_watchdog);
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60.606060);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
screen.set_size(36*8, 28*8);
screen.set_visarea(0*8, 36*8-1, 0*8, 28*8-1);
screen.set_screen_update(FUNC(jrpacman_state::screen_update_pacman));
screen.set_palette(m_palette);
screen.screen_vblank().set(FUNC(jrpacman_state::vblank_irq));
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60.606060);
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
m_screen->set_size(36*8, 28*8);
m_screen->set_visarea(0*8, 36*8-1, 0*8, 28*8-1);
m_screen->set_screen_update(FUNC(jrpacman_state::screen_update_pacman));
m_screen->set_palette(m_palette);
m_screen->screen_vblank().set(FUNC(jrpacman_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_jrpacman);
PALETTE(config, m_palette, FUNC(jrpacman_state::pacman_palette), 128 * 4, 32);

View File

@ -23,7 +23,6 @@ uint8_t pacman_state::jumpshot_decrypt(int addr, uint8_t e)
uint32_t method = 0;
const uint8_t *tbl;
/* pick method from bits 0 2 5 7 9 of the address */
method = picktable[
(addr & 0x001) |
@ -43,14 +42,10 @@ uint8_t pacman_state::jumpshot_decrypt(int addr, uint8_t e)
void pacman_state::jumpshot_decode()
{
int i;
uint8_t *RAM;
/* CPU ROMs */
RAM = memregion("maincpu")->base();
for (i = 0; i < 0x4000; i++)
uint8_t *ROM = memregion("maincpu")->base();
for (int i = 0; i < 0x4000; i++)
{
RAM[i] = jumpshot_decrypt(i,RAM[i]);
ROM[i] = jumpshot_decrypt(i, ROM[i]);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -37,11 +37,11 @@ public:
, m_rocktrv2_prot_data(*this, "rocktrv2_prot")
, m_gfxdecode(*this, "gfxdecode")
, m_palette(*this, "palette")
, m_screen(*this, "screen")
{ }
protected:
void _8bpm_portmap(address_map &map) ATTR_COLD;
void alibaba_map(address_map &map) ATTR_COLD;
void bigbucks_map(address_map &map) ATTR_COLD;
void bigbucks_portmap(address_map &map) ATTR_COLD;
void birdiy_map(address_map &map) ATTR_COLD;
@ -82,9 +82,9 @@ protected:
optional_shared_ptr<uint8_t> m_rocktrv2_prot_data;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<screen_device> m_screen;
uint8_t m_cannonb_bit_to_read = 0;
int m_mystery = 0;
uint8_t m_counter = 0;
int m_bigbucks_bank = 0;
uint8_t m_rocktrv2_question_bank = 0;
@ -111,9 +111,6 @@ protected:
IRQ_CALLBACK_MEMBER(interrupt_vector_r);
void coin_counter_w(int state);
void coin_lockout_global_w(int state);
void alibaba_sound_w(offs_t offset, uint8_t data);
uint8_t alibaba_mystery_1_r();
uint8_t alibaba_mystery_2_r();
void maketrax_protection_w(uint8_t data);
uint8_t mbrush_prot_r(offs_t offset);
uint8_t maketrax_special_port2_r(offs_t offset);
@ -194,6 +191,7 @@ protected:
DECLARE_MACHINE_RESET(maketrax);
DECLARE_VIDEO_START(pengo);
DECLARE_VIDEO_START(jrpacman);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_pacman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_s2650games(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void vblank_irq(int state);
@ -230,7 +228,6 @@ public:
void _8bpm(machine_config &config);
void crush2(machine_config &config);
void korosuke(machine_config &config);
void alibaba(machine_config &config);
void drivfrcp(machine_config &config);
void pengojpm(machine_config &config);
void piranha(machine_config &config);
@ -246,10 +243,43 @@ private:
};
class alibaba_state : public pacman_state
{
public:
alibaba_state(const machine_config &mconfig, device_type type, const char *tag)
: pacman_state(mconfig, type, tag)
{ }
void alibaba(machine_config &config);
void init_alibaba();
protected:
virtual void machine_start() override ATTR_COLD;
private:
uint8_t m_mystery_control = 0;
uint8_t m_mystery_clock = 0;
uint8_t m_mystery_prescaler = 0;
void mystery_tick(int state);
uint8_t mystery_1_r();
uint8_t mystery_2_r();
void mystery_w(uint8_t data);
void sound_w(offs_t offset, uint8_t data);
void alibaba_map(address_map &map) ATTR_COLD;
void draw_clock(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
};
class epospm_state : public pacman_state
{
public:
using pacman_state::pacman_state;
epospm_state(const machine_config &mconfig, device_type type, const char *tag)
: pacman_state(mconfig, type, tag)
{ }
void acitya(machine_config &config);
void theglobp(machine_config &config);
@ -297,7 +327,6 @@ class mspactwin_state : public clubpacm_state
public:
mspactwin_state(const machine_config &mconfig, device_type type, const char *tag)
: clubpacm_state(mconfig, type, tag)
, m_screen(*this, "screen")
, m_decrypted_opcodes(*this, "decrypted_opcodes")
, m_decrypted_opcodes_high(*this, "decrypted_opcodes_high")
{ }
@ -308,9 +337,6 @@ public:
void flipscreen_w(int state);
private:
required_device<screen_device> m_screen;
protected:
void mspactwin_map(address_map &map) ATTR_COLD;
void mspactwin_decrypted_map(address_map &map) ATTR_COLD;

View File

@ -182,9 +182,10 @@ TILE_GET_INFO_MEMBER(pacman_state::pacman_get_tile_info)
int code = m_videoram[tile_index] | (m_charbank << 8);
int attr = (m_colorram[tile_index] & 0x1f) | (m_colortablebank << 5) | (m_palettebank << 6);
tileinfo.set(0,code,attr,0);
tileinfo.set(0, code, attr, 0);
}
/***************************************************************************
Start the video hardware emulation.
@ -260,10 +261,104 @@ void mspactwin_state::flipscreen_w(int state)
{
m_flipscreen = state;
m_bg_tilemap->set_flip(m_flipscreen * (TILEMAP_FLIPX + TILEMAP_FLIPY));
// logerror("Flip: %02x\n", state);
//logerror("Flip: %02x\n", state);
}
/*************************************************************************
Screen update
**************************************************************************/
void pacman_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
uint8_t *spriteram = m_spriteram;
uint8_t *spriteram_2 = m_spriteram2;
rectangle spriteclip(2*8, 34*8-1, 0*8, 28*8-1);
spriteclip &= cliprect;
/* Draw the sprites. Note that it is important to draw them exactly in this */
/* order, to have the correct priorities. */
for (int offs = m_spriteram.bytes() - 2; offs > 2*2; offs -= 2)
{
int color;
int sx,sy;
uint8_t fx,fy;
if (m_inv_spr)
{
sx = spriteram_2[offs + 1];
sy = 240 - (spriteram_2[offs]);
}
else
{
sx = 272 - spriteram_2[offs + 1];
sy = spriteram_2[offs] - 31;
}
fx = (spriteram[offs] & 1) ^ m_inv_spr;
fy = (spriteram[offs] & 2) ^ ((m_inv_spr) << 1);
color = (spriteram[offs + 1] & 0x1f) | (m_colortablebank << 5) | (m_palettebank << 6);
m_gfxdecode->gfx(1)->transmask(bitmap,spriteclip,
(spriteram[offs] >> 2) | (m_spritebank << 6),
color,
fx,fy,
sx,sy,
m_palette->transpen_mask(*m_gfxdecode->gfx(1), color & 0x3f, 0));
/* also plot the sprite with wraparound (tunnel in Crush Roller) */
m_gfxdecode->gfx(1)->transmask(bitmap,spriteclip,
(spriteram[offs] >> 2) | (m_spritebank << 6),
color,
fx,fy,
sx - 256,sy,
m_palette->transpen_mask(*m_gfxdecode->gfx(1), color & 0x3f, 0));
}
/* In the Pac Man based games (NOT Pengo) the first two sprites must be offset */
/* one pixel to the left to get a more correct placement */
for (int offs = 2*2; offs >= 0; offs -= 2)
{
int color;
int sx,sy;
uint8_t fx,fy;
if (m_inv_spr)
{
sx = spriteram_2[offs + 1];
sy = 240 - (spriteram_2[offs]);
}
else
{
sx = 272 - spriteram_2[offs + 1];
sy = spriteram_2[offs] - 31;
}
color = (spriteram[offs + 1] & 0x1f) | (m_colortablebank << 5) | (m_palettebank << 6);
fx = (spriteram[offs] & 1) ^ m_inv_spr;
fy = (spriteram[offs] & 2) ^ ((m_inv_spr) << 1);
m_gfxdecode->gfx(1)->transmask(bitmap,spriteclip,
(spriteram[offs] >> 2) | (m_spritebank << 6),
color,
fx,fy,
sx,sy + m_xoffsethack,
m_palette->transpen_mask(*m_gfxdecode->gfx(1), color & 0x3f, 0));
/* also plot the sprite with wraparound (tunnel in Crush Roller) */
m_gfxdecode->gfx(1)->transmask(bitmap,spriteclip,
(spriteram[offs] >> 2) | (m_spritebank << 6),
color,
fx,fy,
sx - 256,sy + m_xoffsethack,
m_palette->transpen_mask(*m_gfxdecode->gfx(1), color & 0x3f, 0));
}
}
uint32_t pacman_state::screen_update_pacman(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
if (m_bgpriority != 0)
@ -272,102 +367,79 @@ uint32_t pacman_state::screen_update_pacman(screen_device &screen, bitmap_ind16
m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
if (m_spriteram != nullptr)
{
uint8_t *spriteram = m_spriteram;
uint8_t *spriteram_2 = m_spriteram2;
int offs;
rectangle spriteclip(2*8, 34*8-1, 0*8, 28*8-1);
spriteclip &= cliprect;
/* Draw the sprites. Note that it is important to draw them exactly in this */
/* order, to have the correct priorities. */
for (offs = m_spriteram.bytes() - 2; offs > 2*2; offs -= 2)
{
int color;
int sx,sy;
uint8_t fx,fy;
if(m_inv_spr)
{
sx = spriteram_2[offs + 1];
sy = 240 - (spriteram_2[offs]);
}
else
{
sx = 272 - spriteram_2[offs + 1];
sy = spriteram_2[offs] - 31;
}
fx = (spriteram[offs] & 1) ^ m_inv_spr;
fy = (spriteram[offs] & 2) ^ ((m_inv_spr) << 1);
color = (spriteram[offs + 1] & 0x1f) | (m_colortablebank << 5) | (m_palettebank << 6);
m_gfxdecode->gfx(1)->transmask(bitmap,spriteclip,
(spriteram[offs] >> 2) | (m_spritebank << 6),
color,
fx,fy,
sx,sy,
m_palette->transpen_mask(*m_gfxdecode->gfx(1), color & 0x3f, 0));
/* also plot the sprite with wraparound (tunnel in Crush Roller) */
m_gfxdecode->gfx(1)->transmask(bitmap,spriteclip,
(spriteram[offs] >> 2) | (m_spritebank << 6),
color,
fx,fy,
sx - 256,sy,
m_palette->transpen_mask(*m_gfxdecode->gfx(1), color & 0x3f, 0));
}
/* In the Pac Man based games (NOT Pengo) the first two sprites must be offset */
/* one pixel to the left to get a more correct placement */
for (offs = 2*2; offs >= 0; offs -= 2)
{
int color;
int sx,sy;
uint8_t fx,fy;
if(m_inv_spr)
{
sx = spriteram_2[offs + 1];
sy = 240 - (spriteram_2[offs]);
}
else
{
sx = 272 - spriteram_2[offs + 1];
sy = spriteram_2[offs] - 31;
}
color = (spriteram[offs + 1] & 0x1f) | (m_colortablebank << 5) | (m_palettebank << 6);
fx = (spriteram[offs] & 1) ^ m_inv_spr;
fy = (spriteram[offs] & 2) ^ ((m_inv_spr) << 1);
m_gfxdecode->gfx(1)->transmask(bitmap,spriteclip,
(spriteram[offs] >> 2) | (m_spritebank << 6),
color,
fx,fy,
sx,sy + m_xoffsethack,
m_palette->transpen_mask(*m_gfxdecode->gfx(1), color & 0x3f, 0));
/* also plot the sprite with wraparound (tunnel in Crush Roller) */
m_gfxdecode->gfx(1)->transmask(bitmap,spriteclip,
(spriteram[offs] >> 2) | (m_spritebank << 6),
color,
fx,fy,
sx - 256,sy + m_xoffsethack,
m_palette->transpen_mask(*m_gfxdecode->gfx(1), color & 0x3f, 0));
}
}
draw_sprites(screen, bitmap, cliprect);
if (m_bgpriority != 0)
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
return 0;
}
/*************************************************************************
Sega Pengo
Sega Ali Baba
**************************************************************************/
void alibaba_state::draw_clock(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
// inactive half
if (m_mystery_clock <= 16)
{
int x = 120;
int y = 112;
if (m_flipscreen)
{
x = 264 - x;
y = 208 - y;
}
m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, 0x1f, 1, 0, 0, x, y, 0);
}
// active half
int x = 120;
int y = 96 + (m_mystery_clock & 0x10);
int fx = 0, fy = 0;
if (m_flipscreen)
{
x = 264 - x;
y = 208 - y;
fx = !fx;
fy = !fy;
}
m_gfxdecode->gfx(2)->transpen(bitmap, cliprect, m_mystery_clock ^ 0x1f, 1, fx, fy, x, y, 0);
}
uint32_t alibaba_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
// sprites clipped area is larger than with pacman
rectangle spriteclip = cliprect;
if (m_flipscreen)
spriteclip.min_x = 6*8;
else
spriteclip.max_x = 30*8-1;
spriteclip &= cliprect;
draw_sprites(screen, bitmap, spriteclip);
// draw the mystery item clock
if (m_mystery_control & 2)
draw_clock(screen, bitmap, cliprect);
return 0;
}
/*************************************************************************
Sega Pengo
**************************************************************************/
@ -409,20 +481,17 @@ void pacman_state::pengo_gfxbank_w(int state)
/*************************************************************************
S2650 Games
S2650 Games
**************************************************************************/
TILE_GET_INFO_MEMBER(pacman_state::s2650_get_tile_info)
{
int colbank, code, attr;
int colbank = m_s2650games_tileram[tile_index & 0x1f] & 0x3;
int code = m_videoram[tile_index] + (colbank << 8);
int attr = m_colorram[tile_index & 0x1f];
colbank = m_s2650games_tileram[tile_index & 0x1f] & 0x3;
code = m_videoram[tile_index] + (colbank << 8);
attr = m_colorram[tile_index & 0x1f];
tileinfo.set(0,code,attr & 0x1f,0);
tileinfo.set(0, code, attr & 0x1f, 0);
}
VIDEO_START_MEMBER(pacman_state,s2650games)
@ -447,16 +516,14 @@ uint32_t pacman_state::screen_update_s2650games(screen_device &screen, bitmap_in
{
uint8_t *spriteram = m_spriteram;
uint8_t *spriteram_2 = m_spriteram2;
int offs;
m_bg_tilemap->draw(screen, bitmap, cliprect, 0,0);
for (offs = m_spriteram.bytes() - 2; offs > 2*2; offs -= 2)
for (int offs = m_spriteram.bytes() - 2; offs > 2*2; offs -= 2)
{
int color;
int sx,sy;
sx = 255 - spriteram_2[offs + 1];
sy = spriteram_2[offs] - 15;
color = spriteram[offs + 1] & 0x1f;
@ -469,14 +536,14 @@ uint32_t pacman_state::screen_update_s2650games(screen_device &screen, bitmap_in
sx,sy,
m_palette->transpen_mask(*m_gfxdecode->gfx(1), color & 0x3f, 0));
}
/* In the Pac Man based games (NOT Pengo) the first two sprites must be offset */
/* one pixel to the left to get a more correct placement */
for (offs = 2*2;offs >= 0;offs -= 2)
for (int offs = 2*2;offs >= 0;offs -= 2)
{
int color;
int sx,sy;
sx = 255 - spriteram_2[offs + 1];
sy = spriteram_2[offs] - 15;
color = spriteram[offs + 1] & 0x1f;
@ -489,6 +556,7 @@ uint32_t pacman_state::screen_update_s2650games(screen_device &screen, bitmap_in
sx,sy + m_xoffsethack,
m_palette->transpen_mask(*m_gfxdecode->gfx(1), color & 0x3f, 0));
}
return 0;
}
@ -500,9 +568,8 @@ void pacman_state::s2650games_videoram_w(offs_t offset, uint8_t data)
void pacman_state::s2650games_colorram_w(offs_t offset, uint8_t data)
{
int i;
m_colorram[offset & 0x1f] = data;
for (i = offset; i < 0x0400; i += 32)
for (int i = offset; i < 0x0400; i += 32)
m_bg_tilemap->mark_tile_dirty(i);
}
@ -520,7 +587,7 @@ void pacman_state::s2650games_tilesbank_w(offs_t offset, uint8_t data)
/*************************************************************************
Jr. Pac-Man
Jr. Pac-Man
**************************************************************************/
@ -554,7 +621,7 @@ TILEMAP_MAPPER_MEMBER(pacman_state::jrpacman_scan_rows)
TILE_GET_INFO_MEMBER(pacman_state::jrpacman_get_tile_info)
{
int color_index, code, attr;
int color_index;
if (tile_index < 1792)
{
color_index = tile_index & 0x1f;
@ -564,10 +631,10 @@ TILE_GET_INFO_MEMBER(pacman_state::jrpacman_get_tile_info)
color_index = tile_index + 0x80;
}
code = m_videoram[tile_index] | (m_charbank << 8);
attr = (m_videoram[color_index] & 0x1f) | (m_colortablebank << 5) | (m_palettebank << 6);
int code = m_videoram[tile_index] | (m_charbank << 8);
int attr = (m_videoram[color_index] & 0x1f) | (m_colortablebank << 5) | (m_palettebank << 6);
tileinfo.set(0,code,attr,0);
tileinfo.set(0, code, attr, 0);
}
void pacman_state::jrpacman_mark_tile_dirty(int offset)

View File

@ -23,7 +23,6 @@ uint8_t pacman_state::pacplus_decrypt(int addr, uint8_t e)
uint32_t method = 0;
const uint8_t *tbl;
/* pick method from bits 0 2 5 7 9 of the address */
method = picktable[
(addr & 0x001) |
@ -43,14 +42,10 @@ uint8_t pacman_state::pacplus_decrypt(int addr, uint8_t e)
void pacman_state::pacplus_decode()
{
int i;
uint8_t *RAM;
/* CPU ROMs */
RAM = memregion("maincpu")->base();
for (i = 0; i < 0x4000; i++)
uint8_t *ROM = memregion("maincpu")->base();
for (int i = 0; i < 0x4000; i++)
{
RAM[i] = pacplus_decrypt(i,RAM[i]);
ROM[i] = pacplus_decrypt(i, ROM[i]);
}
}

View File

@ -395,11 +395,11 @@ void pengo_state::pengo(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pengo);
PALETTE(config, m_palette, FUNC(pengo_state::pacman_palette), 128 * 4, 32);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_raw(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART);
screen.set_screen_update(FUNC(pengo_state::screen_update_pacman));
screen.set_palette(m_palette);
screen.screen_vblank().set(FUNC(pengo_state::vblank_irq));
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART);
m_screen->set_screen_update(FUNC(pengo_state::screen_update_pacman));
m_screen->set_palette(m_palette);
m_screen->screen_vblank().set(FUNC(pengo_state::vblank_irq));
MCFG_VIDEO_START_OVERRIDE(pengo_state,pengo)
@ -734,7 +734,6 @@ ROM_END
*
*************************************/
void pengo_state::decode_pengo6(int end, int nodecend)
{
/*