mirror of
https://github.com/holub/mame
synced 2025-04-20 23:42:22 +03:00
naughtyb.c: added save state support (nw)
This commit is contained in:
parent
f59adb3766
commit
df112f986a
@ -375,6 +375,21 @@ void tms36xx_device::device_start()
|
||||
m_decay[0], m_decay[1], m_decay[2],
|
||||
m_decay[3], m_decay[4], m_decay[5]));
|
||||
LOG(("TMS36xx speed %d\n", m_speed));
|
||||
|
||||
save_item(NAME(m_octave));
|
||||
save_item(NAME(m_tune_counter));
|
||||
save_item(NAME(m_note_counter));
|
||||
save_item(NAME(m_voices));
|
||||
save_item(NAME(m_shift));
|
||||
save_item(NAME(m_vol));
|
||||
save_item(NAME(m_vol_counter));
|
||||
save_item(NAME(m_counter));
|
||||
save_item(NAME(m_frequency));
|
||||
save_item(NAME(m_output));
|
||||
save_item(NAME(m_enable));
|
||||
save_item(NAME(m_tune_num));
|
||||
save_item(NAME(m_tune_ofs));
|
||||
save_item(NAME(m_tune_max));
|
||||
}
|
||||
|
||||
|
||||
|
@ -416,7 +416,7 @@ static MACHINE_CONFIG_START( naughtyb, naughtyb_state )
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
|
||||
MCFG_SCREEN_SIZE(36*8, 28*8)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 0*8, 28*8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(naughtyb_state, screen_update_naughtyb)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(naughtyb_state, screen_update)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", naughtyb)
|
||||
@ -453,7 +453,7 @@ static MACHINE_CONFIG_START( popflame, naughtyb_state )
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
|
||||
MCFG_SCREEN_SIZE(36*8, 28*8)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 0*8, 28*8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(naughtyb_state, screen_update_naughtyb)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(naughtyb_state, screen_update)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", naughtyb)
|
||||
@ -832,6 +832,10 @@ DRIVER_INIT_MEMBER(naughtyb_state,popflame)
|
||||
m_maincpu->space(AS_PROGRAM).install_read_handler(0x9090, 0x9090, read8_delegate(FUNC(naughtyb_state::popflame_protection_r),this));
|
||||
|
||||
m_maincpu->space(AS_PROGRAM).install_write_handler(0xb000, 0xb0ff, write8_delegate(FUNC(naughtyb_state::popflame_protection_w),this));
|
||||
|
||||
save_item(NAME(m_popflame_prot_seed));
|
||||
save_item(NAME(m_r_index));
|
||||
save_item(NAME(m_prot_count));
|
||||
}
|
||||
|
||||
|
||||
@ -860,18 +864,20 @@ DRIVER_INIT_MEMBER(naughtyb_state,trvmstr)
|
||||
{
|
||||
/* install questions' handlers */
|
||||
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc000, 0xc002, read8_delegate(FUNC(naughtyb_state::trvmstr_questions_r),this), write8_delegate(FUNC(naughtyb_state::trvmstr_questions_w),this));
|
||||
|
||||
save_item(NAME(m_question_offset));
|
||||
}
|
||||
|
||||
|
||||
GAME( 1982, naughtyb, 0, naughtyb, naughtyb, driver_device, 0, ROT90, "Jaleco", "Naughty Boy", 0 )
|
||||
GAME( 1982, naughtyba,naughtyb, naughtyb, naughtyb, driver_device, 0, ROT90, "bootleg", "Naughty Boy (bootleg)", 0 )
|
||||
GAME( 1982, naughtybc,naughtyb, naughtyb, naughtyb, driver_device, 0, ROT90, "Jaleco (Cinematronics license)", "Naughty Boy (Cinematronics)", 0 )
|
||||
GAME( 1982, popflame, 0, popflame, naughtyb, naughtyb_state, popflame, ROT90, "Jaleco", "Pop Flamer (protected)", 0 )
|
||||
GAME( 1982, popflamea,popflame, popflame, naughtyb, driver_device, 0, ROT90, "Jaleco", "Pop Flamer (not protected)", 0 )
|
||||
GAME( 1982, popflameb,popflame, popflame, naughtyb, driver_device, 0, ROT90, "Jaleco", "Pop Flamer (hack?)", 0 )
|
||||
GAME( 1982, popflamen,popflame, naughtyb, naughtyb, driver_device, 0, ROT90, "Jaleco", "Pop Flamer (bootleg on Naughty Boy PCB)", 0 )
|
||||
GAME( 1985, trvmstr, 0, naughtyb, trvmstr, naughtyb_state, trvmstr, ROT90, "Enerdyne Technologies Inc.", "Trivia Master (set 1)", 0 )
|
||||
GAME( 1985, trvmstra, trvmstr, naughtyb, trvmstr, naughtyb_state, trvmstr, ROT90, "Enerdyne Technologies Inc.", "Trivia Master (set 2)", 0 )
|
||||
GAME( 1985, trvmstrb, trvmstr, naughtyb, trvmstr, naughtyb_state, trvmstr, ROT90, "Enerdyne Technologies Inc.", "Trivia Master (set 3)", 0 )
|
||||
GAME( 1985, trvmstrc, trvmstr, naughtyb, trvmstr, naughtyb_state, trvmstr, ROT90, "Enerdyne Technologies Inc.", "Trivia Master (set 4)", 0 )
|
||||
GAME( 1985, trvgns, trvmstr, naughtyb, trvmstr, naughtyb_state, trvmstr, ROT90, "bootleg", "Trivia Genius", 0 )
|
||||
GAME( 1982, naughtyb, 0, naughtyb, naughtyb, driver_device, 0, ROT90, "Jaleco", "Naughty Boy", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, naughtyba,naughtyb, naughtyb, naughtyb, driver_device, 0, ROT90, "bootleg", "Naughty Boy (bootleg)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, naughtybc,naughtyb, naughtyb, naughtyb, driver_device, 0, ROT90, "Jaleco (Cinematronics license)", "Naughty Boy (Cinematronics)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, popflame, 0, popflame, naughtyb, naughtyb_state, popflame, ROT90, "Jaleco", "Pop Flamer (protected)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, popflamea,popflame, popflame, naughtyb, driver_device, 0, ROT90, "Jaleco", "Pop Flamer (not protected)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, popflameb,popflame, popflame, naughtyb, driver_device, 0, ROT90, "Jaleco", "Pop Flamer (hack?)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1982, popflamen,popflame, naughtyb, naughtyb, driver_device, 0, ROT90, "Jaleco", "Pop Flamer (bootleg on Naughty Boy PCB)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, trvmstr, 0, naughtyb, trvmstr, naughtyb_state, trvmstr, ROT90, "Enerdyne Technologies Inc.", "Trivia Master (set 1)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, trvmstra, trvmstr, naughtyb, trvmstr, naughtyb_state, trvmstr, ROT90, "Enerdyne Technologies Inc.", "Trivia Master (set 2)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, trvmstrb, trvmstr, naughtyb, trvmstr, naughtyb_state, trvmstr, ROT90, "Enerdyne Technologies Inc.", "Trivia Master (set 3)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, trvmstrc, trvmstr, naughtyb, trvmstr, naughtyb_state, trvmstr, ROT90, "Enerdyne Technologies Inc.", "Trivia Master (set 4)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1985, trvgns, trvmstr, naughtyb, trvmstr, naughtyb_state, trvmstr, ROT90, "bootleg", "Trivia Genius", GAME_SUPPORTS_SAVE )
|
||||
|
@ -7,19 +7,16 @@ class naughtyb_state : public driver_device
|
||||
public:
|
||||
naughtyb_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_videoram2(*this, "videoram2"),
|
||||
m_scrollreg(*this, "scrollreg"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_naughtyb_custom(*this, "naughtyb_custom"),
|
||||
m_popflame_custom(*this, "popflame_custom"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette") { }
|
||||
m_palette(*this, "palette"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_videoram2(*this, "videoram2"),
|
||||
m_scrollreg(*this, "scrollreg") { }
|
||||
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_shared_ptr<UINT8> m_videoram2;
|
||||
required_shared_ptr<UINT8> m_scrollreg;
|
||||
required_device<cpu_device> m_maincpu;
|
||||
optional_device<naughtyb_sound_device> m_naughtyb_custom;
|
||||
optional_device<popflame_sound_device> m_popflame_custom;
|
||||
@ -27,6 +24,9 @@ public:
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_shared_ptr<UINT8> m_videoram2;
|
||||
required_shared_ptr<UINT8> m_scrollreg;
|
||||
|
||||
UINT8 m_popflame_prot_seed;
|
||||
int m_r_index;
|
||||
@ -36,6 +36,7 @@ public:
|
||||
UINT8 m_palreg;
|
||||
int m_bankreg;
|
||||
bitmap_ind16 m_tmpbitmap;
|
||||
|
||||
DECLARE_READ8_MEMBER(in0_port_r);
|
||||
DECLARE_READ8_MEMBER(dsw0_port_r);
|
||||
DECLARE_READ8_MEMBER(popflame_protection_r);
|
||||
@ -44,11 +45,13 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(trvmstr_questions_w);
|
||||
DECLARE_WRITE8_MEMBER(naughtyb_videoreg_w);
|
||||
DECLARE_WRITE8_MEMBER(popflame_videoreg_w);
|
||||
|
||||
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
|
||||
|
||||
DECLARE_DRIVER_INIT(trvmstr);
|
||||
DECLARE_DRIVER_INIT(popflame);
|
||||
virtual void video_start();
|
||||
DECLARE_PALETTE_INIT(naughtyb);
|
||||
UINT32 screen_update_naughtyb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
};
|
||||
|
@ -64,7 +64,6 @@ PALETTE_INIT_MEMBER(naughtyb_state, naughtyb)
|
||||
const UINT8 *color_prom = memregion("proms")->base();
|
||||
static const int resistances[2] = { 270, 130 };
|
||||
double weights[2];
|
||||
int i;
|
||||
|
||||
/* compute the color output resistor weights */
|
||||
compute_resistor_weights(0, 255, -1.0,
|
||||
@ -72,7 +71,7 @@ PALETTE_INIT_MEMBER(naughtyb_state, naughtyb)
|
||||
2, resistances, weights, 0, 0,
|
||||
0, 0, 0, 0, 0);
|
||||
|
||||
for (i = 0;i < palette.entries(); i++)
|
||||
for (int i = 0;i < palette.entries(); i++)
|
||||
{
|
||||
int bit0, bit1;
|
||||
int r, g, b;
|
||||
@ -108,6 +107,10 @@ void naughtyb_state::video_start()
|
||||
|
||||
/* Naughty Boy has a virtual screen twice as large as the visible screen */
|
||||
m_tmpbitmap.allocate(68*8,28*8,m_screen->format());
|
||||
|
||||
save_item(NAME(m_cocktail));
|
||||
save_item(NAME(m_palreg));
|
||||
save_item(NAME(m_bankreg));
|
||||
}
|
||||
|
||||
|
||||
@ -183,19 +186,15 @@ WRITE8_MEMBER(naughtyb_state::popflame_videoreg_w)
|
||||
|
||||
|
||||
***************************************************************************/
|
||||
UINT32 naughtyb_state::screen_update_naughtyb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
UINT32 naughtyb_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
const rectangle scrollvisiblearea(2*8, 34*8-1, 0*8, 28*8-1);
|
||||
const rectangle leftvisiblearea(0*8, 2*8-1, 0*8, 28*8-1);
|
||||
const rectangle rightvisiblearea(34*8, 36*8-1, 0*8, 28*8-1);
|
||||
|
||||
UINT8 *videoram = m_videoram;
|
||||
bitmap_ind16 &tmpbitmap = m_tmpbitmap;
|
||||
int offs;
|
||||
|
||||
// for every character in the Video RAM
|
||||
|
||||
for (offs = 0x800 - 1; offs >= 0; offs--)
|
||||
for (int offs = 0x800 - 1; offs >= 0; offs--)
|
||||
{
|
||||
int sx,sy;
|
||||
|
||||
@ -226,15 +225,15 @@ UINT32 naughtyb_state::screen_update_naughtyb(screen_device &screen, bitmap_ind1
|
||||
}
|
||||
}
|
||||
|
||||
m_gfxdecode->gfx(0)->opaque(tmpbitmap,tmpbitmap.cliprect(),
|
||||
m_gfxdecode->gfx(0)->opaque(m_tmpbitmap,m_tmpbitmap.cliprect(),
|
||||
m_videoram2[offs] + 256 * m_bankreg,
|
||||
(m_videoram2[offs] >> 5) + 8 * m_palreg,
|
||||
m_cocktail,m_cocktail,
|
||||
8*sx,8*sy);
|
||||
|
||||
m_gfxdecode->gfx(1)->transpen(tmpbitmap,tmpbitmap.cliprect(),
|
||||
videoram[offs] + 256*m_bankreg,
|
||||
(videoram[offs] >> 5) + 8 * m_palreg,
|
||||
m_gfxdecode->gfx(1)->transpen(m_tmpbitmap,m_tmpbitmap.cliprect(),
|
||||
m_videoram[offs] + 256*m_bankreg,
|
||||
(m_videoram[offs] >> 5) + 8 * m_palreg,
|
||||
m_cocktail,m_cocktail,
|
||||
8*sx,8*sy,0);
|
||||
}
|
||||
@ -243,11 +242,11 @@ UINT32 naughtyb_state::screen_update_naughtyb(screen_device &screen, bitmap_ind1
|
||||
{
|
||||
int scrollx;
|
||||
|
||||
copybitmap(bitmap,tmpbitmap,0,0,-66*8,0,leftvisiblearea);
|
||||
copybitmap(bitmap,tmpbitmap,0,0,-30*8,0,rightvisiblearea);
|
||||
copybitmap(bitmap,m_tmpbitmap,0,0,-66*8,0,leftvisiblearea);
|
||||
copybitmap(bitmap,m_tmpbitmap,0,0,-30*8,0,rightvisiblearea);
|
||||
|
||||
scrollx = ( m_cocktail ) ? *m_scrollreg - 239 : -*m_scrollreg + 16;
|
||||
copyscrollbitmap(bitmap,tmpbitmap,1,&scrollx,0,0,scrollvisiblearea);
|
||||
copyscrollbitmap(bitmap,m_tmpbitmap,1,&scrollx,0,0,scrollvisiblearea);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user