mirror of
https://github.com/holub/mame
synced 2025-06-05 20:33:45 +03:00
tryout.c: added save state support (nw)
This commit is contained in:
parent
2e209c805e
commit
894e6b3aac
@ -25,12 +25,12 @@ $208 strikes count
|
||||
#include "sound/2203intf.h"
|
||||
#include "includes/tryout.h"
|
||||
|
||||
WRITE8_MEMBER(tryout_state::tryout_nmi_ack_w)
|
||||
WRITE8_MEMBER(tryout_state::nmi_ack_w)
|
||||
{
|
||||
m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE );
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tryout_state::tryout_sound_w)
|
||||
WRITE8_MEMBER(tryout_state::sound_w)
|
||||
{
|
||||
soundlatch_byte_w(space, 0, data);
|
||||
m_audiocpu->set_input_line(0, HOLD_LINE);
|
||||
@ -38,7 +38,7 @@ WRITE8_MEMBER(tryout_state::tryout_sound_w)
|
||||
|
||||
/*this is actually irq/nmi mask, polls only four values at start up (81->01->81->01) and then
|
||||
stays on this state.*/
|
||||
WRITE8_MEMBER(tryout_state::tryout_sound_irq_ack_w)
|
||||
WRITE8_MEMBER(tryout_state::sound_irq_ack_w)
|
||||
{
|
||||
// m_audiocpu->set_input_line(0, CLEAR_LINE);
|
||||
}
|
||||
@ -48,29 +48,29 @@ void tryout_state::machine_start()
|
||||
membank("bank1")->configure_entries(0, 2, memregion("maincpu")->base() + 0x10000, 0x2000);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tryout_state::tryout_bankswitch_w)
|
||||
WRITE8_MEMBER(tryout_state::bankswitch_w)
|
||||
{
|
||||
membank("bank1")->set_entry(data & 0x01);
|
||||
}
|
||||
|
||||
static ADDRESS_MAP_START( main_cpu, AS_PROGRAM, 8, tryout_state )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM
|
||||
AM_RANGE(0x1000, 0x17ff) AM_RAM_WRITE(tryout_videoram_w) AM_SHARE("videoram")
|
||||
AM_RANGE(0x1000, 0x17ff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram")
|
||||
AM_RANGE(0x2000, 0x3fff) AM_ROMBANK("bank1")
|
||||
AM_RANGE(0x4000, 0xbfff) AM_ROM
|
||||
AM_RANGE(0xc800, 0xc87f) AM_RAM AM_SHARE("spriteram")
|
||||
AM_RANGE(0xcc00, 0xcc7f) AM_RAM AM_SHARE("spriteram2")
|
||||
AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(tryout_vram_r, tryout_vram_w)
|
||||
AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(vram_w) AM_SHARE("vram")
|
||||
AM_RANGE(0xe000, 0xe000) AM_READ_PORT("DSW")
|
||||
AM_RANGE(0xe001, 0xe001) AM_READ_PORT("P1")
|
||||
AM_RANGE(0xe002, 0xe002) AM_READ_PORT("P2")
|
||||
AM_RANGE(0xe003, 0xe003) AM_READ_PORT("SYSTEM")
|
||||
AM_RANGE(0xe301, 0xe301) AM_WRITE(tryout_flipscreen_w)
|
||||
AM_RANGE(0xe302, 0xe302) AM_WRITE(tryout_bankswitch_w)
|
||||
AM_RANGE(0xe401, 0xe401) AM_WRITE(tryout_vram_bankswitch_w)
|
||||
AM_RANGE(0xe301, 0xe301) AM_WRITE(flipscreen_w)
|
||||
AM_RANGE(0xe302, 0xe302) AM_WRITE(bankswitch_w)
|
||||
AM_RANGE(0xe401, 0xe401) AM_WRITE(vram_bankswitch_w)
|
||||
AM_RANGE(0xe402, 0xe404) AM_WRITEONLY AM_SHARE("gfx_control")
|
||||
AM_RANGE(0xe414, 0xe414) AM_WRITE(tryout_sound_w)
|
||||
AM_RANGE(0xe417, 0xe417) AM_WRITE(tryout_nmi_ack_w)
|
||||
AM_RANGE(0xe414, 0xe414) AM_WRITE(sound_w)
|
||||
AM_RANGE(0xe417, 0xe417) AM_WRITE(nmi_ack_w)
|
||||
AM_RANGE(0xfff0, 0xffff) AM_ROM AM_REGION("maincpu", 0xbff0) /* reset vectors */
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -78,7 +78,7 @@ static ADDRESS_MAP_START( sound_cpu, AS_PROGRAM, 8, tryout_state )
|
||||
AM_RANGE(0x0000, 0x07ff) AM_RAM
|
||||
AM_RANGE(0x4000, 0x4001) AM_DEVREADWRITE("ymsnd", ym2203_device, read, write)
|
||||
AM_RANGE(0xa000, 0xa000) AM_READ(soundlatch_byte_r)
|
||||
AM_RANGE(0xd000, 0xd000) AM_WRITE(tryout_sound_irq_ack_w)
|
||||
AM_RANGE(0xd000, 0xd000) AM_WRITE(sound_irq_ack_w)
|
||||
AM_RANGE(0xc000, 0xffff) AM_ROM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
@ -137,8 +137,8 @@ static INPUT_PORTS_START( tryout )
|
||||
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
|
||||
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
|
||||
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_IMPULSE(2)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, tryout_state,coin_inserted, 0)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, tryout_state,coin_inserted, 0)
|
||||
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, tryout_state, coin_inserted, 0)
|
||||
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED_MEMBER(DEVICE_SELF, tryout_state, coin_inserted, 0)
|
||||
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
|
||||
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("screen")
|
||||
@ -201,7 +201,7 @@ static MACHINE_CONFIG_START( tryout, tryout_state )
|
||||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
|
||||
MCFG_SCREEN_SIZE(256, 256)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(tryout_state, screen_update_tryout)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(tryout_state, screen_update)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", tryout)
|
||||
@ -242,4 +242,4 @@ ROM_START( tryout )
|
||||
ROM_LOAD( "ch14.bpr", 0x00000, 0x0020, CRC(8ce19925) SHA1(12f8f6022f1148b6ba1d019a34247452637063a7) )
|
||||
ROM_END
|
||||
|
||||
GAME( 1985, tryout, 0, tryout, tryout, driver_device, 0, ROT90, "Data East Corporation", "Pro Baseball Skill Tryout (Japan)", GAME_NO_COCKTAIL )
|
||||
GAME( 1985, tryout, 0, tryout, tryout, driver_device, 0, ROT90, "Data East Corporation", "Pro Baseball Skill Tryout (Japan)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
|
@ -3,46 +3,52 @@ class tryout_state : public driver_device
|
||||
public:
|
||||
tryout_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_videoram(*this, "videoram"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_spriteram2(*this, "spriteram2"),
|
||||
m_gfx_control(*this, "gfx_control"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_audiocpu(*this, "audiocpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette") { }
|
||||
m_vram(*this, "vram") { }
|
||||
|
||||
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_shared_ptr<UINT8> m_videoram;
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
required_shared_ptr<UINT8> m_spriteram2;
|
||||
required_shared_ptr<UINT8> m_gfx_control;
|
||||
required_shared_ptr<UINT8> m_vram;
|
||||
|
||||
tilemap_t *m_fg_tilemap;
|
||||
tilemap_t *m_bg_tilemap;
|
||||
UINT8 m_vram_bank;
|
||||
UINT8 *m_vram;
|
||||
UINT8 *m_vram_gfx;
|
||||
DECLARE_WRITE8_MEMBER(tryout_nmi_ack_w);
|
||||
DECLARE_WRITE8_MEMBER(tryout_sound_w);
|
||||
DECLARE_WRITE8_MEMBER(tryout_sound_irq_ack_w);
|
||||
DECLARE_WRITE8_MEMBER(tryout_bankswitch_w);
|
||||
DECLARE_READ8_MEMBER(tryout_vram_r);
|
||||
DECLARE_WRITE8_MEMBER(tryout_videoram_w);
|
||||
DECLARE_WRITE8_MEMBER(tryout_vram_w);
|
||||
DECLARE_WRITE8_MEMBER(tryout_vram_bankswitch_w);
|
||||
DECLARE_WRITE8_MEMBER(tryout_flipscreen_w);
|
||||
|
||||
DECLARE_WRITE8_MEMBER(nmi_ack_w);
|
||||
DECLARE_WRITE8_MEMBER(sound_w);
|
||||
DECLARE_WRITE8_MEMBER(sound_irq_ack_w);
|
||||
DECLARE_WRITE8_MEMBER(bankswitch_w);
|
||||
DECLARE_WRITE8_MEMBER(videoram_w);
|
||||
DECLARE_WRITE8_MEMBER(vram_w);
|
||||
DECLARE_WRITE8_MEMBER(vram_bankswitch_w);
|
||||
DECLARE_WRITE8_MEMBER(flipscreen_w);
|
||||
|
||||
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
|
||||
|
||||
TILE_GET_INFO_MEMBER(get_fg_tile_info);
|
||||
TILE_GET_INFO_MEMBER(get_bg_tile_info);
|
||||
TILEMAP_MAPPER_MEMBER(get_fg_memory_offset);
|
||||
TILEMAP_MAPPER_MEMBER(get_bg_memory_offset);
|
||||
|
||||
virtual void machine_start();
|
||||
virtual void video_start();
|
||||
DECLARE_PALETTE_INIT(tryout);
|
||||
UINT32 screen_update_tryout(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_audiocpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
};
|
||||
|
@ -12,9 +12,8 @@
|
||||
PALETTE_INIT_MEMBER(tryout_state, tryout)
|
||||
{
|
||||
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,r,g,b;
|
||||
|
||||
@ -40,13 +39,10 @@ PALETTE_INIT_MEMBER(tryout_state, tryout)
|
||||
|
||||
TILE_GET_INFO_MEMBER(tryout_state::get_fg_tile_info)
|
||||
{
|
||||
UINT8 *videoram = m_videoram;
|
||||
int code, attr, color;
|
||||
|
||||
code = videoram[tile_index];
|
||||
attr = videoram[tile_index + 0x400];
|
||||
int code = m_videoram[tile_index];
|
||||
int attr = m_videoram[tile_index + 0x400];
|
||||
code |= ((attr & 0x03) << 8);
|
||||
color = ((attr & 0x4)>>2)+6;
|
||||
int color = ((attr & 0x4)>>2)+6;
|
||||
|
||||
SET_TILE_INFO_MEMBER(0, code, color, 0);
|
||||
}
|
||||
@ -56,19 +52,13 @@ TILE_GET_INFO_MEMBER(tryout_state::get_bg_tile_info)
|
||||
SET_TILE_INFO_MEMBER(2, m_vram[tile_index] & 0x7f, 2, 0);
|
||||
}
|
||||
|
||||
READ8_MEMBER(tryout_state::tryout_vram_r)
|
||||
WRITE8_MEMBER(tryout_state::videoram_w)
|
||||
{
|
||||
return m_vram[offset]; // debug only
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tryout_state::tryout_videoram_w)
|
||||
{
|
||||
UINT8 *videoram = m_videoram;
|
||||
videoram[offset] = data;
|
||||
m_videoram[offset] = data;
|
||||
m_fg_tilemap->mark_tile_dirty(offset & 0x3ff);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tryout_state::tryout_vram_w)
|
||||
WRITE8_MEMBER(tryout_state::vram_w)
|
||||
{
|
||||
/* There are eight banks of vram - in bank 0 the first 0x400 bytes
|
||||
is reserved for the tilemap. In banks 2, 4 and 6 the game never
|
||||
@ -136,12 +126,12 @@ WRITE8_MEMBER(tryout_state::tryout_vram_w)
|
||||
m_gfxdecode->gfx(2)->mark_dirty((offset-0x400/64)&0x7f);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tryout_state::tryout_vram_bankswitch_w)
|
||||
WRITE8_MEMBER(tryout_state::vram_bankswitch_w)
|
||||
{
|
||||
m_vram_bank = data;
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(tryout_state::tryout_flipscreen_w)
|
||||
WRITE8_MEMBER(tryout_state::flipscreen_w)
|
||||
{
|
||||
flip_screen_set(data & 1);
|
||||
}
|
||||
@ -168,30 +158,30 @@ void tryout_state::video_start()
|
||||
m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tryout_state::get_fg_tile_info),this),tilemap_mapper_delegate(FUNC(tryout_state::get_fg_memory_offset),this),8,8,32,32);
|
||||
m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(tryout_state::get_bg_tile_info),this),tilemap_mapper_delegate(FUNC(tryout_state::get_bg_memory_offset),this),16,16,64,16);
|
||||
|
||||
m_vram=auto_alloc_array(machine(), UINT8, 8 * 0x800);
|
||||
m_vram_gfx=auto_alloc_array(machine(), UINT8, 0x6000);
|
||||
|
||||
m_gfxdecode->gfx(2)->set_source(m_vram_gfx);
|
||||
|
||||
m_fg_tilemap->set_transparent_pen(0);
|
||||
|
||||
save_item(NAME(m_vram_bank));
|
||||
save_pointer(NAME(m_vram_gfx), 0x6000);
|
||||
}
|
||||
|
||||
void tryout_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
|
||||
{
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
UINT8 *spriteram_2 = m_spriteram2;
|
||||
int offs,fx,fy,x,y,color,sprite,inc;
|
||||
|
||||
for (offs = 0;offs < 0x7f;offs += 4)
|
||||
{
|
||||
if (!(spriteram[offs]&1))
|
||||
if (!(m_spriteram[offs]&1))
|
||||
continue;
|
||||
|
||||
sprite = spriteram[offs+1] + ((spriteram_2[offs]&7)<<8);
|
||||
x = spriteram[offs+3]-3;
|
||||
y = spriteram[offs+2];
|
||||
color = 0;//(spriteram[offs] & 8)>>3;
|
||||
fx = (spriteram[offs] & 8)>>3;
|
||||
sprite = m_spriteram[offs+1] + ((m_spriteram2[offs]&7)<<8);
|
||||
x = m_spriteram[offs+3]-3;
|
||||
y = m_spriteram[offs+2];
|
||||
color = 0;//(m_spriteram[offs] & 8)>>3;
|
||||
fx = (m_spriteram[offs] & 8)>>3;
|
||||
fy = 0;
|
||||
inc = 16;
|
||||
|
||||
@ -207,7 +197,7 @@ void tryout_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
|
||||
}
|
||||
|
||||
/* Double Height */
|
||||
if(spriteram[offs] & 0x10)
|
||||
if(m_spriteram[offs] & 0x10)
|
||||
{
|
||||
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
|
||||
sprite,
|
||||
@ -226,7 +216,7 @@ void tryout_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
|
||||
}
|
||||
}
|
||||
|
||||
UINT32 tryout_state::screen_update_tryout(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
UINT32 tryout_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int scrollx = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user