mirror of
https://github.com/holub/mame
synced 2025-06-05 20:33:45 +03:00
pcktgal.c: added save state support, configured banking (nw)
This commit is contained in:
parent
0b7f2bedcb
commit
14f7f02159
@ -18,36 +18,33 @@
|
||||
#include "cpu/m6502/m6502.h"
|
||||
#include "sound/2203intf.h"
|
||||
#include "sound/3812intf.h"
|
||||
#include "sound/msm5205.h"
|
||||
#include "includes/pcktgal.h"
|
||||
#include "machine/deco222.h"
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
WRITE8_MEMBER(pcktgal_state::pcktgal_bank_w)
|
||||
WRITE8_MEMBER(pcktgal_state::bank_w)
|
||||
{
|
||||
UINT8 *RAM = memregion("maincpu")->base();
|
||||
if (data & 1) { membank("bank1")->set_entry(0); }
|
||||
else { membank("bank1")->set_entry(1); }
|
||||
|
||||
if (data & 1) { membank("bank1")->set_base(&RAM[0x4000]); }
|
||||
else { membank("bank1")->set_base(&RAM[0x10000]); }
|
||||
|
||||
if (data & 2) { membank("bank2")->set_base(&RAM[0x6000]); }
|
||||
else { membank("bank2")->set_base(&RAM[0x12000]); }
|
||||
if (data & 2) { membank("bank2")->set_entry(0); }
|
||||
else { membank("bank2")->set_entry(1); }
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pcktgal_state::pcktgal_sound_bank_w)
|
||||
WRITE8_MEMBER(pcktgal_state::sound_bank_w)
|
||||
{
|
||||
membank("bank3")->set_entry((data >> 2) & 1);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pcktgal_state::pcktgal_sound_w)
|
||||
WRITE8_MEMBER(pcktgal_state::sound_w)
|
||||
{
|
||||
soundlatch_byte_w(space, 0, data);
|
||||
m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
|
||||
}
|
||||
|
||||
|
||||
WRITE_LINE_MEMBER(pcktgal_state::pcktgal_adpcm_int)
|
||||
WRITE_LINE_MEMBER(pcktgal_state::adpcm_int)
|
||||
{
|
||||
m_msm->data_w(m_msm5205next >> 4);
|
||||
m_msm5205next <<= 4;
|
||||
@ -57,12 +54,12 @@ WRITE_LINE_MEMBER(pcktgal_state::pcktgal_adpcm_int)
|
||||
m_audiocpu->set_input_line(M6502_IRQ_LINE, HOLD_LINE);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(pcktgal_state::pcktgal_adpcm_data_w)
|
||||
WRITE8_MEMBER(pcktgal_state::adpcm_data_w)
|
||||
{
|
||||
m_msm5205next = data;
|
||||
}
|
||||
|
||||
READ8_MEMBER(pcktgal_state::pcktgal_adpcm_reset_r)
|
||||
READ8_MEMBER(pcktgal_state::adpcm_reset_r)
|
||||
{
|
||||
m_msm->reset_w(0);
|
||||
return 0;
|
||||
@ -78,8 +75,8 @@ static ADDRESS_MAP_START( pcktgal_map, AS_PROGRAM, 8, pcktgal_state )
|
||||
AM_RANGE(0x1800, 0x1807) AM_DEVWRITE("tilegen1", deco_bac06_device, pf_control0_8bit_w)
|
||||
AM_RANGE(0x1810, 0x181f) AM_DEVREADWRITE("tilegen1", deco_bac06_device, pf_control1_8bit_r, pf_control1_8bit_w)
|
||||
|
||||
AM_RANGE(0x1a00, 0x1a00) AM_READ_PORT("P2") AM_WRITE(pcktgal_sound_w)
|
||||
AM_RANGE(0x1c00, 0x1c00) AM_READ_PORT("DSW") AM_WRITE(pcktgal_bank_w)
|
||||
AM_RANGE(0x1a00, 0x1a00) AM_READ_PORT("P2") AM_WRITE(sound_w)
|
||||
AM_RANGE(0x1c00, 0x1c00) AM_READ_PORT("DSW") AM_WRITE(bank_w)
|
||||
AM_RANGE(0x4000, 0x5fff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0x6000, 0x7fff) AM_ROMBANK("bank2")
|
||||
AM_RANGE(0x8000, 0xffff) AM_ROM
|
||||
@ -92,10 +89,10 @@ static ADDRESS_MAP_START( pcktgal_sound_map, AS_PROGRAM, 8, pcktgal_state )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM
|
||||
AM_RANGE(0x0800, 0x0801) AM_DEVWRITE("ym1", ym2203_device, write)
|
||||
AM_RANGE(0x1000, 0x1001) AM_DEVWRITE("ym2", ym3812_device, write)
|
||||
AM_RANGE(0x1800, 0x1800) AM_WRITE(pcktgal_adpcm_data_w) /* ADPCM data for the MSM5205 chip */
|
||||
AM_RANGE(0x2000, 0x2000) AM_WRITE(pcktgal_sound_bank_w)
|
||||
AM_RANGE(0x1800, 0x1800) AM_WRITE(adpcm_data_w) /* ADPCM data for the MSM5205 chip */
|
||||
AM_RANGE(0x2000, 0x2000) AM_WRITE(sound_bank_w)
|
||||
AM_RANGE(0x3000, 0x3000) AM_READ(soundlatch_byte_r)
|
||||
AM_RANGE(0x3400, 0x3400) AM_READ(pcktgal_adpcm_reset_r) /* ? not sure */
|
||||
AM_RANGE(0x3400, 0x3400) AM_READ(adpcm_reset_r) /* ? not sure */
|
||||
AM_RANGE(0x4000, 0x7fff) AM_ROMBANK("bank3")
|
||||
AM_RANGE(0x8000, 0xffff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
@ -212,7 +209,12 @@ GFXDECODE_END
|
||||
|
||||
void pcktgal_state::machine_start()
|
||||
{
|
||||
membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x4000, 0xc000);
|
||||
membank("bank2")->configure_entries(0, 2, memregion("maincpu")->base() + 0x6000, 0xc000);
|
||||
membank("bank3")->configure_entries(0, 2, memregion("audiocpu")->base() + 0x10000, 0x4000);
|
||||
|
||||
save_item(NAME(m_msm5205next));
|
||||
save_item(NAME(m_toggle));
|
||||
}
|
||||
|
||||
static MACHINE_CONFIG_START( pcktgal, pcktgal_state )
|
||||
@ -255,7 +257,7 @@ static MACHINE_CONFIG_START( pcktgal, pcktgal_state )
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
|
||||
|
||||
MCFG_SOUND_ADD("msm", MSM5205, 384000)
|
||||
MCFG_MSM5205_VCLK_CB(WRITELINE(pcktgal_state, pcktgal_adpcm_int)) /* interrupt function */
|
||||
MCFG_MSM5205_VCLK_CB(WRITELINE(pcktgal_state, adpcm_int)) /* interrupt function */
|
||||
MCFG_MSM5205_PRESCALER_SELECTOR(MSM5205_S48_4B) /* 8KHz */
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
|
||||
MACHINE_CONFIG_END
|
||||
@ -440,9 +442,9 @@ DRIVER_INIT_MEMBER(pcktgal_state,pcktgal)
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
GAME( 1987, pcktgal, 0, pcktgal, pcktgal, pcktgal_state, pcktgal, ROT0, "Data East Corporation", "Pocket Gal (Japan)", 0 )
|
||||
GAME( 1987, pcktgalb, pcktgal, bootleg, pcktgal, driver_device, 0, ROT0, "bootleg", "Pocket Gal (bootleg)", 0 )
|
||||
GAME( 1989, pcktgal2, pcktgal, pcktgal2,pcktgal, pcktgal_state, pcktgal, ROT0, "Data East Corporation", "Pocket Gal 2 (English)", 0 )
|
||||
GAME( 1989, pcktgal2j,pcktgal, pcktgal2,pcktgal, pcktgal_state, pcktgal, ROT0, "Data East Corporation", "Pocket Gal 2 (Japanese)", 0 )
|
||||
GAME( 1989, spool3, pcktgal, pcktgal2,pcktgal, pcktgal_state, pcktgal, ROT0, "Data East Corporation", "Super Pool III (English)", 0 )
|
||||
GAME( 1990, spool3i, pcktgal, pcktgal2,pcktgal, pcktgal_state, pcktgal, ROT0, "Data East Corporation (I-Vics license)", "Super Pool III (I-Vics)", 0 )
|
||||
GAME( 1987, pcktgal, 0, pcktgal, pcktgal, pcktgal_state, pcktgal, ROT0, "Data East Corporation", "Pocket Gal (Japan)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1987, pcktgalb, pcktgal, bootleg, pcktgal, driver_device, 0, ROT0, "bootleg", "Pocket Gal (bootleg)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1989, pcktgal2, pcktgal, pcktgal2,pcktgal, pcktgal_state, pcktgal, ROT0, "Data East Corporation", "Pocket Gal 2 (English)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1989, pcktgal2j,pcktgal, pcktgal2,pcktgal, pcktgal_state, pcktgal, ROT0, "Data East Corporation", "Pocket Gal 2 (Japanese)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1989, spool3, pcktgal, pcktgal2,pcktgal, pcktgal_state, pcktgal, ROT0, "Data East Corporation", "Super Pool III (English)", GAME_SUPPORTS_SAVE )
|
||||
GAME( 1990, spool3i, pcktgal, pcktgal2,pcktgal, pcktgal_state, pcktgal, ROT0, "Data East Corporation (I-Vics license)", "Super Pool III (I-Vics)", GAME_SUPPORTS_SAVE )
|
||||
|
@ -12,30 +12,34 @@ public:
|
||||
m_audiocpu(*this, "audiocpu"),
|
||||
m_msm(*this, "msm"),
|
||||
m_tilegen1(*this, "tilegen1"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette") { }
|
||||
m_palette(*this, "palette"),
|
||||
m_spriteram(*this, "spriteram") { }
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
required_device<msm5205_device> m_msm;
|
||||
required_device<deco_bac06_device> m_tilegen1;
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
DECLARE_WRITE8_MEMBER(pcktgal_bank_w);
|
||||
DECLARE_WRITE8_MEMBER(pcktgal_sound_bank_w);
|
||||
DECLARE_WRITE8_MEMBER(pcktgal_sound_w);
|
||||
DECLARE_WRITE8_MEMBER(pcktgal_adpcm_data_w);
|
||||
DECLARE_READ8_MEMBER(pcktgal_adpcm_reset_r);
|
||||
DECLARE_DRIVER_INIT(pcktgal);
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
|
||||
int m_msm5205next;
|
||||
int m_toggle;
|
||||
|
||||
DECLARE_WRITE8_MEMBER(bank_w);
|
||||
DECLARE_WRITE8_MEMBER(sound_bank_w);
|
||||
DECLARE_WRITE8_MEMBER(sound_w);
|
||||
DECLARE_WRITE8_MEMBER(adpcm_data_w);
|
||||
DECLARE_READ8_MEMBER(adpcm_reset_r);
|
||||
DECLARE_WRITE_LINE_MEMBER(adpcm_int);
|
||||
|
||||
DECLARE_DRIVER_INIT(pcktgal);
|
||||
DECLARE_PALETTE_INIT(pcktgal);
|
||||
virtual void machine_start();
|
||||
|
||||
UINT32 screen_update_pcktgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_pcktgalb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
DECLARE_WRITE_LINE_MEMBER(pcktgal_adpcm_int);
|
||||
};
|
||||
|
@ -6,9 +6,8 @@
|
||||
PALETTE_INIT_MEMBER(pcktgal_state, pcktgal)
|
||||
{
|
||||
const UINT8 *color_prom = memregion("proms")->base();
|
||||
int i;
|
||||
|
||||
for (i = 0;i < palette.entries();i++)
|
||||
for (int i = 0;i < palette.entries();i++)
|
||||
{
|
||||
int bit0,bit1,bit2,bit3,r,g,b;
|
||||
|
||||
@ -34,21 +33,18 @@ PALETTE_INIT_MEMBER(pcktgal_state, pcktgal)
|
||||
|
||||
void pcktgal_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
int offs;
|
||||
|
||||
for (offs = 0;offs < m_spriteram.bytes();offs += 4)
|
||||
for (int offs = 0;offs < m_spriteram.bytes();offs += 4)
|
||||
{
|
||||
if (spriteram[offs] != 0xf8)
|
||||
if (m_spriteram[offs] != 0xf8)
|
||||
{
|
||||
int sx,sy,flipx,flipy;
|
||||
|
||||
|
||||
sx = 240 - spriteram[offs+2];
|
||||
sy = 240 - spriteram[offs];
|
||||
sx = 240 - m_spriteram[offs+2];
|
||||
sy = 240 - m_spriteram[offs];
|
||||
|
||||
flipx = spriteram[offs+1] & 0x04;
|
||||
flipy = spriteram[offs+1] & 0x02;
|
||||
flipx = m_spriteram[offs+1] & 0x04;
|
||||
flipy = m_spriteram[offs+1] & 0x02;
|
||||
if (flip_screen()) {
|
||||
sx=240-sx;
|
||||
sy=240-sy;
|
||||
@ -57,8 +53,8 @@ void pcktgal_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect
|
||||
}
|
||||
|
||||
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
|
||||
spriteram[offs+3] + ((spriteram[offs+1] & 1) << 8),
|
||||
(spriteram[offs+1] & 0x70) >> 4,
|
||||
m_spriteram[offs+3] + ((m_spriteram[offs+1] & 1) << 8),
|
||||
(m_spriteram[offs+1] & 0x70) >> 4,
|
||||
flipx,flipy,
|
||||
sx,sy,0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user