portrait.c, spool99.c, stactics.c, tunhunt.c: added / enabled save state support (nw)

This commit is contained in:
Ivan Vangelista 2015-03-28 07:41:22 +01:00
parent aea6bc4bb8
commit 1da97e9c96
11 changed files with 190 additions and 153 deletions

View File

@ -405,6 +405,12 @@ void tms5220_device::register_for_save_states()
save_item(NAME(m_digital_select));
save_item(NAME(m_io_ready));
save_item(NAME(m_true_timing));
save_item(NAME(m_rs_ws));
save_item(NAME(m_read_latch));
save_item(NAME(m_write_latch));
}

View File

@ -86,11 +86,10 @@ DM81LS95 = TriState buffer
#include "emu.h"
#include "cpu/z80/z80.h"
#include "cpu/mcs48/mcs48.h"
#include "sound/tms5220.h"
#include "machine/nvram.h"
#include "includes/portrait.h"
WRITE8_MEMBER(portrait_state::portrait_ctrl_w)
WRITE8_MEMBER(portrait_state::ctrl_w)
{
/* bits 4 and 5 are unknown */
@ -106,30 +105,30 @@ WRITE8_MEMBER(portrait_state::portrait_ctrl_w)
output_set_value("photo", (data >> 7) & 1);
}
WRITE8_MEMBER(portrait_state::portrait_positive_scroll_w)
WRITE8_MEMBER(portrait_state::positive_scroll_w)
{
m_scroll = data;
}
WRITE8_MEMBER(portrait_state::portrait_negative_scroll_w)
WRITE8_MEMBER(portrait_state::negative_scroll_w)
{
m_scroll = - (data ^ 0xff);
}
static ADDRESS_MAP_START( portrait_map, AS_PROGRAM, 8, portrait_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(portrait_bgvideo_write) AM_SHARE("bgvideoram")
AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(portrait_fgvideo_write) AM_SHARE("fgvideoram")
AM_RANGE(0x8000, 0x87ff) AM_RAM_WRITE(bgvideo_write) AM_SHARE("bgvideoram")
AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(fgvideo_write) AM_SHARE("fgvideoram")
AM_RANGE(0x9000, 0x91ff) AM_RAM AM_SHARE("spriteram")
AM_RANGE(0x9200, 0x97ff) AM_RAM
AM_RANGE(0xa000, 0xa000) AM_WRITE(soundlatch_byte_w)
AM_RANGE(0xa010, 0xa010) AM_WRITENOP // ?
AM_RANGE(0xa000, 0xa000) AM_READ_PORT("DSW1")
AM_RANGE(0xa004, 0xa004) AM_READ_PORT("DSW2")
AM_RANGE(0xa008, 0xa008) AM_READ_PORT("SYSTEM") AM_WRITE(portrait_ctrl_w)
AM_RANGE(0xa008, 0xa008) AM_READ_PORT("SYSTEM") AM_WRITE(ctrl_w)
AM_RANGE(0xa010, 0xa010) AM_READ_PORT("INPUTS")
AM_RANGE(0xa018, 0xa018) AM_READNOP AM_WRITE(portrait_positive_scroll_w)
AM_RANGE(0xa019, 0xa019) AM_WRITE(portrait_negative_scroll_w)
AM_RANGE(0xa018, 0xa018) AM_READNOP AM_WRITE(positive_scroll_w)
AM_RANGE(0xa019, 0xa019) AM_WRITE(negative_scroll_w)
AM_RANGE(0xa800, 0xa83f) AM_RAM AM_SHARE("nvram")
AM_RANGE(0xffff, 0xffff) AM_READNOP
ADDRESS_MAP_END
@ -257,7 +256,7 @@ static MACHINE_CONFIG_START( portrait, portrait_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 54*8-1, 0*8, 40*8-1)
MCFG_SCREEN_UPDATE_DRIVER(portrait_state, screen_update_portrait)
MCFG_SCREEN_UPDATE_DRIVER(portrait_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", portrait)
@ -381,5 +380,5 @@ ROM_END
GAME( 1983, portrait, 0, portrait, portrait, driver_device, 0, ROT270, "Olympia", "Portraits (set 1)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS )
GAME( 1983, portraita,portrait, portrait, portrait, driver_device, 0, ROT270, "Olympia", "Portraits (set 2)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS )
GAME( 1983, portrait, 0, portrait, portrait, driver_device, 0, ROT270, "Olympia", "Portraits (set 1)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE )
GAME( 1983, portraita,portrait, portrait, portrait, driver_device, 0, ROT270, "Olympia", "Portraits (set 2)", GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS | GAME_WRONG_COLORS | GAME_SUPPORTS_SAVE )

View File

@ -101,36 +101,41 @@ class spool99_state : public driver_device
public:
spool99_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_main(*this, "mainram"),
m_vram(*this, "vram"),
m_cram(*this, "cram"),
m_maincpu(*this, "maincpu"),
m_eeprom(*this, "eeprom"),
m_oki(*this, "oki"),
m_gfxdecode(*this, "gfxdecode") { }
m_gfxdecode(*this, "gfxdecode"),
m_main(*this, "mainram"),
m_vram(*this, "vram"),
m_cram(*this, "cram") { }
required_device<cpu_device> m_maincpu;
required_device<eeprom_serial_93cxx_device> m_eeprom;
required_device<okim6295_device> m_oki;
required_device<gfxdecode_device> m_gfxdecode;
required_shared_ptr<UINT8> m_main;
required_shared_ptr<UINT8> m_vram;
required_shared_ptr<UINT8> m_cram;
tilemap_t *m_sc0_tilemap;
DECLARE_WRITE8_MEMBER(spool99_vram_w);
DECLARE_WRITE8_MEMBER(spool99_cram_w);
DECLARE_WRITE8_MEMBER(vram_w);
DECLARE_WRITE8_MEMBER(cram_w);
DECLARE_READ8_MEMBER(spool99_io_r);
DECLARE_READ8_MEMBER(vcarn_io_r);
DECLARE_WRITE8_MEMBER(eeprom_resetline_w);
DECLARE_WRITE8_MEMBER(eeprom_clockline_w);
DECLARE_WRITE8_MEMBER(eeprom_dataline_w);
DECLARE_DRIVER_INIT(spool99);
TILE_GET_INFO_MEMBER(get_spool99_tile_info);
virtual void video_start();
UINT32 screen_update_spool99(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<eeprom_serial_93cxx_device> m_eeprom;
required_device<okim6295_device> m_oki;
required_device<gfxdecode_device> m_gfxdecode;
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TILE_GET_INFO_MEMBER(get_tile_info);
};
TILE_GET_INFO_MEMBER(spool99_state::get_spool99_tile_info)
TILE_GET_INFO_MEMBER(spool99_state::get_tile_info)
{
int code = ((m_vram[tile_index*2+1]<<8) | (m_vram[tile_index*2+0]));
int color = m_cram[tile_index*2+0];
@ -143,22 +148,22 @@ TILE_GET_INFO_MEMBER(spool99_state::get_spool99_tile_info)
void spool99_state::video_start()
{
m_sc0_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(spool99_state::get_spool99_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
m_sc0_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(spool99_state::get_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
}
UINT32 spool99_state::screen_update_spool99(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
UINT32 spool99_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_sc0_tilemap->draw(screen, bitmap, cliprect, 0,0);
return 0;
}
WRITE8_MEMBER(spool99_state::spool99_vram_w)
WRITE8_MEMBER(spool99_state::vram_w)
{
m_vram[offset] = data;
m_sc0_tilemap->mark_tile_dirty(offset/2);
}
WRITE8_MEMBER(spool99_state::spool99_cram_w)
WRITE8_MEMBER(spool99_state::cram_w)
{
m_cram[offset] = data;
m_sc0_tilemap->mark_tile_dirty(offset/2);
@ -229,8 +234,8 @@ static ADDRESS_MAP_START( spool99_map, AS_PROGRAM, 8, spool99_state )
AM_RANGE(0xb000, 0xb3ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
AM_RANGE(0xb800, 0xdfff) AM_RAM
AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(spool99_vram_w) AM_SHARE("vram")
AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(spool99_cram_w) AM_SHARE("cram")
AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(vram_w) AM_SHARE("vram")
AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(cram_w) AM_SHARE("cram")
ADDRESS_MAP_END
READ8_MEMBER(spool99_state::vcarn_io_r)
@ -276,8 +281,8 @@ static ADDRESS_MAP_START( vcarn_map, AS_PROGRAM, 8, spool99_state )
AM_RANGE(0xb000, 0xdfff) AM_RAM
// AM_RANGE(0xdf00, 0xdfff) AM_READWRITE(vcarn_io_r,vcarn_io_w) AM_SHARE("vcarn_io")
AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(spool99_vram_w) AM_SHARE("vram")
AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(spool99_cram_w) AM_SHARE("cram")
AM_RANGE(0xe000, 0xefff) AM_RAM_WRITE(vram_w) AM_SHARE("vram")
AM_RANGE(0xf000, 0xffff) AM_RAM_WRITE(cram_w) AM_SHARE("cram")
ADDRESS_MAP_END
@ -360,7 +365,7 @@ static MACHINE_CONFIG_START( spool99, spool99_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(7*8, 55*8-1, 1*8, 31*8-1) //384x240,raw guess
MCFG_SCREEN_UPDATE_DRIVER(spool99_state, screen_update_spool99)
MCFG_SCREEN_UPDATE_DRIVER(spool99_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 0x200)
@ -455,8 +460,8 @@ DRIVER_INIT_MEMBER(spool99_state,spool99)
GAME( 1998, spool99, 0, spool99, spool99, spool99_state, spool99, ROT0, "Electronic Projects", "Super Pool 99 (Version 0.36)", 0 )
GAME( 1998, spool99a, spool99, spool99, spool99, spool99_state, spool99, ROT0, "Electronic Projects", "Super Pool 99 (Version 0.33)", 0 )
GAME( 1998, spool99b, spool99, spool99, spool99, spool99_state, spool99, ROT0, "Electronic Projects", "Super Pool 99 (Version 0.31)", 0 )
GAME( 1998, spool99c, spool99, spool99, spool99, spool99_state, spool99, ROT0, "Electronic Projects", "Super Pool 99 (Version 0.26)", 0 )
GAME( 1998, vcarn, 0, vcarn, spool99, spool99_state, spool99, ROT0, "Electronic Projects", "Video Carnival 1999 / Super Royal Card (Version 0.11)", 0 ) //MAME screen says '98, PCB screen says '99?
GAME( 1998, spool99, 0, spool99, spool99, spool99_state, spool99, ROT0, "Electronic Projects", "Super Pool 99 (Version 0.36)", GAME_SUPPORTS_SAVE )
GAME( 1998, spool99a, spool99, spool99, spool99, spool99_state, spool99, ROT0, "Electronic Projects", "Super Pool 99 (Version 0.33)", GAME_SUPPORTS_SAVE )
GAME( 1998, spool99b, spool99, spool99, spool99, spool99_state, spool99, ROT0, "Electronic Projects", "Super Pool 99 (Version 0.31)", GAME_SUPPORTS_SAVE )
GAME( 1998, spool99c, spool99, spool99, spool99, spool99_state, spool99, ROT0, "Electronic Projects", "Super Pool 99 (Version 0.26)", GAME_SUPPORTS_SAVE )
GAME( 1998, vcarn, 0, vcarn, spool99, spool99_state, spool99, ROT0, "Electronic Projects", "Video Carnival 1999 / Super Royal Card (Version 0.11)", GAME_SUPPORTS_SAVE ) //MAME screen says '98, PCB screen says '99?

View File

@ -135,7 +135,7 @@ CUSTOM_INPUT_MEMBER(stactics_state::get_rng)
*
*************************************/
WRITE8_MEMBER(stactics_state::stactics_coin_lockout_w)
WRITE8_MEMBER(stactics_state::coinlockout_w)
{
coin_lockout_w(machine(), offset, ~data & 0x01);
}
@ -148,7 +148,7 @@ WRITE8_MEMBER(stactics_state::stactics_coin_lockout_w)
*
*************************************/
INTERRUPT_GEN_MEMBER(stactics_state::stactics_interrupt)
INTERRUPT_GEN_MEMBER(stactics_state::interrupt)
{
move_motor();
@ -168,22 +168,22 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, stactics_state )
AM_RANGE(0x4000, 0x40ff) AM_MIRROR(0x0700) AM_RAM
AM_RANGE(0x5000, 0x5000) AM_MIRROR(0x0fff) AM_READ_PORT("IN0")
AM_RANGE(0x6000, 0x6000) AM_MIRROR(0x0fff) AM_READ_PORT("IN1")
AM_RANGE(0x6000, 0x6001) AM_MIRROR(0x0f08) AM_WRITE(stactics_coin_lockout_w)
AM_RANGE(0x6000, 0x6001) AM_MIRROR(0x0f08) AM_WRITE(coinlockout_w)
AM_RANGE(0x6002, 0x6005) AM_MIRROR(0x0f08) AM_WRITENOP
AM_RANGE(0x6006, 0x6007) AM_MIRROR(0x0f08) AM_WRITEONLY AM_SHARE("paletteram")
/* AM_RANGE(0x6010, 0x6017) AM_MIRROR(0x0f08) AM_WRITE(stactics_sound_w) */
/* AM_RANGE(0x6010, 0x6017) AM_MIRROR(0x0f08) AM_WRITE(sound_w) */
AM_RANGE(0x6016, 0x6016) AM_MIRROR(0x0f08) AM_WRITEONLY AM_SHARE("motor_on") /* Note: This overlaps rocket sound */
AM_RANGE(0x6020, 0x6027) AM_MIRROR(0x0f08) AM_WRITEONLY AM_SHARE("lamps")
AM_RANGE(0x6030, 0x6030) AM_MIRROR(0x0f0f) AM_WRITE(stactics_speed_latch_w)
AM_RANGE(0x6040, 0x6040) AM_MIRROR(0x0f0f) AM_WRITE(stactics_shot_trigger_w)
AM_RANGE(0x6050, 0x6050) AM_MIRROR(0x0f0f) AM_WRITE(stactics_shot_flag_clear_w)
AM_RANGE(0x6030, 0x6030) AM_MIRROR(0x0f0f) AM_WRITE(speed_latch_w)
AM_RANGE(0x6040, 0x6040) AM_MIRROR(0x0f0f) AM_WRITE(shot_trigger_w)
AM_RANGE(0x6050, 0x6050) AM_MIRROR(0x0f0f) AM_WRITE(shot_flag_clear_w)
AM_RANGE(0x6060, 0x606f) AM_MIRROR(0x0f00) AM_WRITEONLY AM_SHARE("display_buffer")
AM_RANGE(0x6070, 0x609f) AM_MIRROR(0x0f00) AM_WRITENOP
/* AM_RANGE(0x60a0, 0x60ef) AM_MIRROR(0x0f00) AM_WRITE(stactics_sound2_w) */
/* AM_RANGE(0x60a0, 0x60ef) AM_MIRROR(0x0f00) AM_WRITE(sound2_w) */
AM_RANGE(0x60f0, 0x60ff) AM_MIRROR(0x0f00) AM_WRITENOP
AM_RANGE(0x7000, 0x7000) AM_MIRROR(0x0fff) AM_READ_PORT("IN2")
AM_RANGE(0x8000, 0x8000) AM_MIRROR(0x0fff) AM_READ_PORT("IN3")
AM_RANGE(0x8000, 0x87ff) AM_MIRROR(0x0800) AM_WRITE(stactics_scroll_ram_w)
AM_RANGE(0x8000, 0x87ff) AM_MIRROR(0x0800) AM_WRITE(scroll_ram_w)
AM_RANGE(0x9000, 0x9000) AM_MIRROR(0x0fff) AM_READ(vert_pos_r)
AM_RANGE(0xa000, 0xa000) AM_MIRROR(0x0fff) AM_READ(horiz_pos_r)
AM_RANGE(0xb000, 0xbfff) AM_RAM AM_SHARE("videoram_b")
@ -210,7 +210,7 @@ static INPUT_PORTS_START( stactics )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON3 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, stactics_state,get_motor_not_ready, NULL)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, stactics_state, get_motor_not_ready, NULL)
PORT_START("IN1") /* IN1 */
PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_B ) )
@ -239,8 +239,8 @@ static INPUT_PORTS_START( stactics )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("IN2") /* IN2 */
PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, stactics_state,get_rng, NULL)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, stactics_state,stactics_get_frame_count_d3, NULL)
PORT_BIT( 0x07, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, stactics_state, get_rng, NULL)
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, stactics_state, get_frame_count_d3, NULL)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
@ -250,7 +250,7 @@ static INPUT_PORTS_START( stactics )
PORT_START("IN3") /* IN3 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, stactics_state,stactics_get_shot_standby, NULL)
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, stactics_state, get_shot_standby, NULL)
PORT_DIPNAME( 0x04, 0x04, "Number of Barriers" )
PORT_DIPSETTING( 0x04, "4" )
PORT_DIPSETTING( 0x00, "6" )
@ -262,7 +262,7 @@ static INPUT_PORTS_START( stactics )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, stactics_state,stactics_get_not_shot_arrive, NULL)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, stactics_state, get_not_shot_arrive, NULL)
PORT_START("FAKE") /* FAKE */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
@ -282,6 +282,9 @@ void stactics_state::machine_start()
m_vert_pos = 0;
m_horiz_pos = 0;
*m_motor_on = 0;
save_item(NAME(m_vert_pos));
save_item(NAME(m_horiz_pos));
}
@ -297,7 +300,7 @@ static MACHINE_CONFIG_START( stactics, stactics_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", I8080, 1933560)
MCFG_CPU_PROGRAM_MAP(main_map)
MCFG_CPU_VBLANK_INT_DRIVER("screen", stactics_state, stactics_interrupt)
MCFG_CPU_VBLANK_INT_DRIVER("screen", stactics_state, interrupt)
/* video hardware */
@ -342,4 +345,4 @@ ROM_END
*
*************************************/
GAMEL( 1981, stactics, 0, stactics, stactics, driver_device, 0, ORIENTATION_FLIP_X, "Sega", "Space Tactics", GAME_NO_SOUND, layout_stactics )
GAMEL( 1981, stactics, 0, stactics, stactics, driver_device, 0, ORIENTATION_FLIP_X, "Sega", "Space Tactics", GAME_NO_SOUND | GAME_SUPPORTS_SAVE, layout_stactics )

View File

@ -55,7 +55,7 @@
*
*************************************/
WRITE8_MEMBER(tunhunt_state::tunhunt_control_w)
WRITE8_MEMBER(tunhunt_state::control_w)
{
/*
0x01 coin counter#2 "right counter"
@ -81,7 +81,7 @@ WRITE8_MEMBER(tunhunt_state::tunhunt_control_w)
*
*************************************/
READ8_MEMBER(tunhunt_state::tunhunt_button_r)
READ8_MEMBER(tunhunt_state::button_r)
{
int data = ioport("IN0")->read();
return ((data>>offset)&1)?0x00:0x80;
@ -135,11 +135,11 @@ static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, tunhunt_state )
AM_RANGE(0x1800, 0x1800) AM_WRITEONLY /* SHEL0H */
AM_RANGE(0x1a00, 0x1a00) AM_WRITEONLY /* SHEL1H */
AM_RANGE(0x1c00, 0x1c00) AM_WRITEONLY /* MOBJV */
AM_RANGE(0x1e00, 0x1eff) AM_WRITE(tunhunt_videoram_w) AM_SHARE("videoram") /* ALPHA */
AM_RANGE(0x1e00, 0x1eff) AM_WRITE(videoram_w) AM_SHARE("videoram") /* ALPHA */
AM_RANGE(0x2000, 0x2000) AM_WRITENOP /* watchdog */
AM_RANGE(0x2000, 0x2007) AM_READ(tunhunt_button_r)
AM_RANGE(0x2000, 0x2007) AM_READ(button_r)
AM_RANGE(0x2400, 0x2400) AM_WRITENOP /* INT ACK */
AM_RANGE(0x2800, 0x2800) AM_WRITE(tunhunt_control_w)
AM_RANGE(0x2800, 0x2800) AM_WRITE(control_w)
AM_RANGE(0x2c00, 0x2fff) AM_WRITEONLY AM_SHARE("spriteram")
AM_RANGE(0x3000, 0x300f) AM_DEVREADWRITE("pokey1", pokey_device, read, write)
AM_RANGE(0x4000, 0x400f) AM_DEVREADWRITE("pokey2", pokey_device, read, write)
@ -277,7 +277,7 @@ static MACHINE_CONFIG_START( tunhunt, tunhunt_state )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(256, 256-16)
MCFG_SCREEN_VISIBLE_AREA(0, 255, 0, 255-16)
MCFG_SCREEN_UPDATE_DRIVER(tunhunt_state, screen_update_tunhunt)
MCFG_SCREEN_UPDATE_DRIVER(tunhunt_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_GFXDECODE_ADD("gfxdecode", "palette", tunhunt)
@ -390,5 +390,5 @@ ROM_END
*************************************/
/* rom parent machine inp init */
GAME( 1979,tunhunt, 0, tunhunt, tunhunt, driver_device, 0, ORIENTATION_SWAP_XY, "Atari", "Tunnel Hunt", 0 )
GAME( 1981,tunhuntc, tunhunt, tunhunt, tunhunt, driver_device, 0, ORIENTATION_SWAP_XY, "Atari (Centuri license)", "Tunnel Hunt (Centuri)", 0 )
GAME( 1979,tunhunt, 0, tunhunt, tunhunt, driver_device, 0, ORIENTATION_SWAP_XY, "Atari", "Tunnel Hunt", GAME_SUPPORTS_SAVE )
GAME( 1981,tunhuntc, tunhunt, tunhunt, tunhunt, driver_device, 0, ORIENTATION_SWAP_XY, "Atari (Centuri license)", "Tunnel Hunt (Centuri)", GAME_SUPPORTS_SAVE )

View File

@ -5,34 +5,40 @@ class portrait_state : public driver_device
public:
portrait_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_tms(*this, "tms"),
m_bgvideoram(*this, "bgvideoram"),
m_fgvideoram(*this, "fgvideoram"),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette") { }
m_spriteram(*this, "spriteram") { }
required_device<tms5200_device> m_tms;
required_shared_ptr<UINT8> m_bgvideoram;
required_shared_ptr<UINT8> m_fgvideoram;
int m_scroll;
tilemap_t *m_foreground;
tilemap_t *m_background;
required_shared_ptr<UINT8> m_spriteram;
DECLARE_WRITE8_MEMBER(portrait_ctrl_w);
DECLARE_WRITE8_MEMBER(portrait_positive_scroll_w);
DECLARE_WRITE8_MEMBER(portrait_negative_scroll_w);
DECLARE_WRITE8_MEMBER(portrait_bgvideo_write);
DECLARE_WRITE8_MEMBER(portrait_fgvideo_write);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
virtual void video_start();
DECLARE_PALETTE_INIT(portrait);
UINT32 screen_update_portrait(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
inline void get_tile_info( tile_data &tileinfo, int tile_index, const UINT8 *source );
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<tms5200_device> m_tms;
required_shared_ptr<UINT8> m_bgvideoram;
required_shared_ptr<UINT8> m_fgvideoram;
required_shared_ptr<UINT8> m_spriteram;
int m_scroll;
tilemap_t *m_foreground;
tilemap_t *m_background;
DECLARE_WRITE8_MEMBER(ctrl_w);
DECLARE_WRITE8_MEMBER(positive_scroll_w);
DECLARE_WRITE8_MEMBER(negative_scroll_w);
DECLARE_WRITE8_MEMBER(bgvideo_write);
DECLARE_WRITE8_MEMBER(fgvideo_write);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
virtual void video_start();
DECLARE_PALETTE_INIT(portrait);
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
inline void get_tile_info( tile_data &tileinfo, int tile_index, const UINT8 *source );
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
};

View File

@ -12,6 +12,7 @@ class stactics_state : public driver_device
public:
stactics_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_palette_val(*this, "paletteram"),
m_motor_on(*this, "motor_on"),
m_lamps(*this, "lamps"),
@ -19,13 +20,9 @@ public:
m_videoram_b(*this, "videoram_b"),
m_videoram_d(*this, "videoram_d"),
m_videoram_e(*this, "videoram_e"),
m_videoram_f(*this, "videoram_f"),
m_maincpu(*this, "maincpu") { }
m_videoram_f(*this, "videoram_f") { }
/* machine state */
int m_vert_pos;
int m_horiz_pos;
/* video state */
required_device<cpu_device> m_maincpu;
required_shared_ptr<UINT8> m_palette_val;
required_shared_ptr<UINT8> m_motor_on;
@ -35,7 +32,12 @@ public:
required_shared_ptr<UINT8> m_videoram_d;
required_shared_ptr<UINT8> m_videoram_e;
required_shared_ptr<UINT8> m_videoram_f;
/* machine state */
int m_vert_pos;
int m_horiz_pos;
/* video state */
UINT8 m_y_scroll_d;
UINT8 m_y_scroll_e;
UINT8 m_y_scroll_f;
@ -45,30 +47,33 @@ public:
UINT16 m_beam_state;
UINT16 m_old_beam_state;
UINT16 m_beam_states_per_frame;
DECLARE_READ8_MEMBER(vert_pos_r);
DECLARE_READ8_MEMBER(horiz_pos_r);
DECLARE_WRITE8_MEMBER(stactics_coin_lockout_w);
DECLARE_WRITE8_MEMBER(stactics_scroll_ram_w);
DECLARE_WRITE8_MEMBER(stactics_speed_latch_w);
DECLARE_WRITE8_MEMBER(stactics_shot_trigger_w);
DECLARE_WRITE8_MEMBER(stactics_shot_flag_clear_w);
DECLARE_CUSTOM_INPUT_MEMBER(stactics_get_frame_count_d3);
DECLARE_CUSTOM_INPUT_MEMBER(stactics_get_shot_standby);
DECLARE_CUSTOM_INPUT_MEMBER(stactics_get_not_shot_arrive);
DECLARE_WRITE8_MEMBER(coinlockout_w);
DECLARE_WRITE8_MEMBER(scroll_ram_w);
DECLARE_WRITE8_MEMBER(speed_latch_w);
DECLARE_WRITE8_MEMBER(shot_trigger_w);
DECLARE_WRITE8_MEMBER(shot_flag_clear_w);
DECLARE_CUSTOM_INPUT_MEMBER(get_frame_count_d3);
DECLARE_CUSTOM_INPUT_MEMBER(get_shot_standby);
DECLARE_CUSTOM_INPUT_MEMBER(get_not_shot_arrive);
DECLARE_CUSTOM_INPUT_MEMBER(get_motor_not_ready);
DECLARE_CUSTOM_INPUT_MEMBER(get_rng);
INTERRUPT_GEN_MEMBER(interrupt);
virtual void machine_start();
DECLARE_VIDEO_START(stactics);
virtual void video_start();
DECLARE_PALETTE_INIT(stactics);
UINT32 screen_update_stactics(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(stactics_interrupt);
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void update_beam();
inline int get_pixel_on_plane(UINT8 *videoram, UINT8 y, UINT8 x, UINT8 y_scroll);
void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
void set_indicator_leds(int data, const char *output_name, int base_index);
void update_artwork();
void move_motor();
required_device<cpu_device> m_maincpu;
};
/*----------- defined in video/stactics.c -----------*/
MACHINE_CONFIG_EXTERN( stactics_video );

View File

@ -3,41 +3,47 @@ class tunhunt_state : public driver_device
public:
tunhunt_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_workram(*this, "workram"),
m_videoram(*this, "videoram"),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_workram(*this, "workram"),
m_videoram(*this, "videoram"),
m_spriteram(*this, "spriteram"),
m_generic_paletteram_8(*this, "paletteram") { }
UINT8 m_control;
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_shared_ptr<UINT8> m_workram;
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_spriteram;
required_shared_ptr<UINT8> m_generic_paletteram_8;
UINT8 m_control;
tilemap_t *m_fg_tilemap;
bitmap_ind16 m_tmpbitmap;
DECLARE_WRITE8_MEMBER(tunhunt_control_w);
DECLARE_READ8_MEMBER(tunhunt_button_r);
DECLARE_WRITE8_MEMBER(tunhunt_videoram_w);
DECLARE_WRITE8_MEMBER(control_w);
DECLARE_READ8_MEMBER(button_r);
DECLARE_WRITE8_MEMBER(videoram_w);
DECLARE_READ8_MEMBER(dsw2_0r);
DECLARE_READ8_MEMBER(dsw2_1r);
DECLARE_READ8_MEMBER(dsw2_2r);
DECLARE_READ8_MEMBER(dsw2_3r);
DECLARE_READ8_MEMBER(dsw2_4r);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
virtual void video_start();
DECLARE_PALETTE_INIT(tunhunt);
UINT32 screen_update_tunhunt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void set_pens();
void draw_motion_object(bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_shell(bitmap_ind16 &bitmap, const rectangle &cliprect, int picture_code,
int hposition,int vstart,int vstop,int vstretch,int hstretch);
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_shared_ptr<UINT8> m_generic_paletteram_8;
};

View File

@ -9,13 +9,13 @@
#include "includes/portrait.h"
WRITE8_MEMBER(portrait_state::portrait_bgvideo_write)
WRITE8_MEMBER(portrait_state::bgvideo_write)
{
m_background->mark_tile_dirty(offset/2);
m_bgvideoram[offset] = data;
}
WRITE8_MEMBER(portrait_state::portrait_fgvideo_write)
WRITE8_MEMBER(portrait_state::fgvideo_write)
{
m_foreground->mark_tile_dirty(offset/2);
m_fgvideoram[offset] = data;
@ -67,7 +67,9 @@ void portrait_state::video_start()
m_background = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(portrait_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32 );
m_foreground = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(portrait_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32 );
m_foreground->set_transparent_pen(7 );
m_foreground->set_transparent_pen(7);
save_item(NAME(m_scroll));
}
@ -180,7 +182,7 @@ void portrait_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
}
}
UINT32 portrait_state::screen_update_portrait(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
UINT32 portrait_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
rectangle cliprect_scroll, cliprect_no_scroll;

View File

@ -90,7 +90,7 @@ PALETTE_INIT_MEMBER(stactics_state,stactics)
*
*************************************/
WRITE8_MEMBER(stactics_state::stactics_scroll_ram_w)
WRITE8_MEMBER(stactics_state::scroll_ram_w)
{
if (data & 0x01)
{
@ -111,7 +111,7 @@ WRITE8_MEMBER(stactics_state::stactics_scroll_ram_w)
*
*************************************/
CUSTOM_INPUT_MEMBER(stactics_state::stactics_get_frame_count_d3)
CUSTOM_INPUT_MEMBER(stactics_state::get_frame_count_d3)
{
return (m_frame_count >> 3) & 0x01;
}
@ -124,7 +124,7 @@ CUSTOM_INPUT_MEMBER(stactics_state::stactics_get_frame_count_d3)
*
*************************************/
WRITE8_MEMBER(stactics_state::stactics_speed_latch_w)
WRITE8_MEMBER(stactics_state::speed_latch_w)
{
/* This writes to a shift register which is clocked by */
/* a 555 oscillator. This value determines the speed of */
@ -149,25 +149,25 @@ WRITE8_MEMBER(stactics_state::stactics_speed_latch_w)
}
WRITE8_MEMBER(stactics_state::stactics_shot_trigger_w)
WRITE8_MEMBER(stactics_state::shot_trigger_w)
{
m_shot_standby = 0;
}
WRITE8_MEMBER(stactics_state::stactics_shot_flag_clear_w)
WRITE8_MEMBER(stactics_state::shot_flag_clear_w)
{
m_shot_arrive = 0;
}
CUSTOM_INPUT_MEMBER(stactics_state::stactics_get_shot_standby)
CUSTOM_INPUT_MEMBER(stactics_state::get_shot_standby)
{
return m_shot_standby;
}
CUSTOM_INPUT_MEMBER(stactics_state::stactics_get_not_shot_arrive)
CUSTOM_INPUT_MEMBER(stactics_state::get_not_shot_arrive)
{
return !m_shot_arrive;
}
@ -352,7 +352,7 @@ void stactics_state::update_artwork()
*
*************************************/
VIDEO_START_MEMBER(stactics_state,stactics)
void stactics_state::video_start()
{
m_y_scroll_d = 0;
m_y_scroll_e = 0;
@ -363,6 +363,16 @@ VIDEO_START_MEMBER(stactics_state,stactics)
m_shot_arrive = 0;
m_beam_state = 0;
m_old_beam_state = 0;
save_item(NAME(m_y_scroll_d));
save_item(NAME(m_y_scroll_e));
save_item(NAME(m_y_scroll_f));
save_item(NAME(m_frame_count));
save_item(NAME(m_shot_standby));
save_item(NAME(m_shot_arrive));
save_item(NAME(m_beam_state));
save_item(NAME(m_old_beam_state));
save_item(NAME(m_beam_states_per_frame));
}
@ -373,7 +383,7 @@ VIDEO_START_MEMBER(stactics_state,stactics)
*
*************************************/
UINT32 stactics_state::screen_update_stactics(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
UINT32 stactics_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
update_beam();
draw_background(bitmap, cliprect);
@ -399,11 +409,10 @@ MACHINE_CONFIG_FRAGMENT( stactics_video )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(stactics_state, screen_update_stactics)
MCFG_SCREEN_UPDATE_DRIVER(stactics_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
MCFG_PALETTE_ADD("palette", 0x400)
MCFG_PALETTE_INIT_OWNER(stactics_state,stactics)
MCFG_VIDEO_START_OVERRIDE(stactics_state,stactics)
MACHINE_CONFIG_END

View File

@ -48,7 +48,7 @@
/****************************************************************************************/
WRITE8_MEMBER(tunhunt_state::tunhunt_videoram_w)
WRITE8_MEMBER(tunhunt_state::videoram_w)
{
m_videoram[offset] = data;
m_fg_tilemap->mark_tile_dirty(offset);
@ -78,19 +78,19 @@ void tunhunt_state::video_start()
m_fg_tilemap->set_transparent_pen(0);
m_fg_tilemap->set_scrollx(0, 64);
save_item(NAME(m_control));
}
PALETTE_INIT_MEMBER(tunhunt_state, tunhunt)
{
int i;
/* Tunnel Hunt uses a combination of color proms and palette RAM to specify a 16 color
* palette. Here, we manage only the mappings for alphanumeric characters and SHELL
* graphics, which are unpacked ahead of time and drawn using MAME's drawgfx primitives.
*/
/* motion objects/box */
for (i = 0; i < 0x10; i++)
for (int i = 0; i < 0x10; i++)
palette.set_pen_indirect(i, i);
/* AlphaNumerics (1bpp)
@ -152,10 +152,9 @@ void tunhunt_state::set_pens()
//const UINT8 *color_prom = memregion( "proms" )->base();
int color;
int shade;
int i;
int red,green,blue;
for( i=0; i<16; i++ )
for( int i=0; i<16; i++ )
{
color = m_generic_paletteram_8[i];
shade = 0xf^(color>>4);
@ -207,11 +206,9 @@ void tunhunt_state::draw_motion_object(bitmap_ind16 &bitmap, const rectangle &cl
*/
bitmap_ind16 &tmpbitmap = m_tmpbitmap;
UINT8 *spriteram = m_spriteram;
UINT8 *tunhunt_ram = m_workram;
//int skip = tunhunt_ram[MOBST];
int x0 = 255-tunhunt_ram[MOBJV];
int y0 = 255-tunhunt_ram[MOBJH];
//int skip = m_workram[MOBST];
int x0 = 255-m_workram[MOBJV];
int y0 = 255-m_workram[MOBJH];
int scalex,scaley;
int line,span;
int x,span_data;
@ -222,7 +219,7 @@ void tunhunt_state::draw_motion_object(bitmap_ind16 &bitmap, const rectangle &cl
for( line=0; line<64; line++ )
{
x = 0;
source = &spriteram[line*0x10];
source = &m_spriteram[line*0x10];
for( span=0; span<0x10; span++ )
{
span_data = source[span];
@ -236,7 +233,7 @@ void tunhunt_state::draw_motion_object(bitmap_ind16 &bitmap, const rectangle &cl
tmpbitmap.pix16(line, x++) = 0;
} /* next line */
switch( tunhunt_ram[VSTRLO] )
switch( m_workram[VSTRLO] )
{
case 0x01:
scaley = (1<<16)*0.33; /* seems correct */
@ -247,7 +244,7 @@ void tunhunt_state::draw_motion_object(bitmap_ind16 &bitmap, const rectangle &cl
break;
default:
scaley = (1<<16)*tunhunt_ram[VSTRLO]/4; /* ??? */
scaley = (1<<16)*m_workram[VSTRLO]/4; /* ??? */
break;
}
scalex = (1<<16);
@ -284,7 +281,6 @@ void tunhunt_state::draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect)
1280: 07 03 00 01 07 06 04 05 02 07 03 00 09 0a 0b 0c palette select
->hue 06 02 ff 60 06 05 03 04 01 06 02 ff d2 00 c2 ff
*/
UINT8 *tunhunt_ram = m_workram;
int span,x,y;
int color;
// rectangle bbox;
@ -300,13 +296,13 @@ void tunhunt_state::draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect)
z = 0;
for( span=3; span<16; span++ )
{
x0 = tunhunt_ram[span+0x1080];
y0 = tunhunt_ram[span+0x1480];
y1 = tunhunt_ram[span+0x1400];
x0 = m_workram[span+0x1080];
y0 = m_workram[span+0x1480];
y1 = m_workram[span+0x1400];
if( y>=y0 && y<=y1 && x>=x0 && x0>=z )
{
color = tunhunt_ram[span+0x1280]&0xf;
color = m_workram[span+0x1280]&0xf;
z = x0; /* give priority to rightmost spans */
}
}
@ -365,7 +361,7 @@ void tunhunt_state::draw_shell(bitmap_ind16 &bitmap,
255-hposition-16,vstart-32,0 );
}
UINT32 tunhunt_state::screen_update_tunhunt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
UINT32 tunhunt_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
set_pens();