mirror of
https://github.com/mamedev/mame.git
synced 2024-11-18 10:06:19 +01:00
sub.c, subs.c: added save state support (nw)
This commit is contained in:
parent
69419ee50e
commit
d42d2c5e04
6 changed files with 136 additions and 119 deletions
|
@ -12,27 +12,27 @@
|
|||
sub sound functions
|
||||
***************************************************************************/
|
||||
|
||||
WRITE8_MEMBER(subs_state::subs_sonar1_w)
|
||||
WRITE8_MEMBER(subs_state::sonar1_w)
|
||||
{
|
||||
m_discrete->write(space, SUBS_SONAR1_EN, offset & 0x01);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(subs_state::subs_sonar2_w)
|
||||
WRITE8_MEMBER(subs_state::sonar2_w)
|
||||
{
|
||||
m_discrete->write(space, SUBS_SONAR2_EN, offset & 0x01);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(subs_state::subs_crash_w)
|
||||
WRITE8_MEMBER(subs_state::crash_w)
|
||||
{
|
||||
m_discrete->write(space, SUBS_CRASH_EN, offset & 0x01);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(subs_state::subs_explode_w)
|
||||
WRITE8_MEMBER(subs_state::explode_w)
|
||||
{
|
||||
m_discrete->write(space, SUBS_EXPLODE_EN, offset & 0x01);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(subs_state::subs_noise_reset_w)
|
||||
WRITE8_MEMBER(subs_state::noise_reset_w)
|
||||
{
|
||||
/* Pulse noise reset */
|
||||
m_discrete->write(space, SUBS_NOISE_RESET, 0);
|
||||
|
|
|
@ -119,39 +119,45 @@ class sub_state : public driver_device
|
|||
public:
|
||||
sub_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_soundcpu(*this, "soundcpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette"),
|
||||
m_attr(*this, "attr"),
|
||||
m_vid(*this, "vid"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_spriteram2(*this, "spriteram2"),
|
||||
m_scrolly(*this, "scrolly"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_soundcpu(*this, "soundcpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette") { }
|
||||
m_scrolly(*this, "scrolly") { }
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_soundcpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
required_shared_ptr<UINT8> m_attr;
|
||||
required_shared_ptr<UINT8> m_vid;
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
required_shared_ptr<UINT8> m_spriteram2;
|
||||
required_shared_ptr<UINT8> m_scrolly;
|
||||
|
||||
UINT8 m_nmi_en;
|
||||
DECLARE_WRITE8_MEMBER(subm_to_sound_w);
|
||||
|
||||
DECLARE_WRITE8_MEMBER(to_sound_w);
|
||||
DECLARE_WRITE8_MEMBER(nmi_mask_w);
|
||||
virtual void video_start();
|
||||
|
||||
virtual void machine_start();
|
||||
DECLARE_PALETTE_INIT(sub);
|
||||
UINT32 screen_update_sub(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(subm_sound_irq);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cpu_device> m_soundcpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(sound_irq);
|
||||
};
|
||||
|
||||
void sub_state::video_start()
|
||||
void sub_state::machine_start()
|
||||
{
|
||||
save_item(NAME(m_nmi_en));
|
||||
}
|
||||
|
||||
UINT32 sub_state::screen_update_sub(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
UINT32 sub_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
gfx_element *gfx = m_gfxdecode->gfx(0);
|
||||
gfx_element *gfx_1 = m_gfxdecode->gfx(1);
|
||||
|
@ -255,7 +261,7 @@ static ADDRESS_MAP_START( subm_map, AS_PROGRAM, 8, sub_state )
|
|||
AM_RANGE(0xf060, 0xf060) AM_READ_PORT("IN0")
|
||||
ADDRESS_MAP_END
|
||||
|
||||
WRITE8_MEMBER(sub_state::subm_to_sound_w)
|
||||
WRITE8_MEMBER(sub_state::to_sound_w)
|
||||
{
|
||||
soundlatch_byte_w(space, 0, data & 0xff);
|
||||
m_soundcpu->set_input_line(0, HOLD_LINE);
|
||||
|
@ -268,7 +274,7 @@ WRITE8_MEMBER(sub_state::nmi_mask_w)
|
|||
|
||||
static ADDRESS_MAP_START( subm_io, AS_IO, 8, sub_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||
AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_byte_r) AM_WRITE(subm_to_sound_w) // to/from sound CPU
|
||||
AM_RANGE(0x00, 0x00) AM_READ(soundlatch2_byte_r) AM_WRITE(to_sound_w) // to/from sound CPU
|
||||
ADDRESS_MAP_END
|
||||
|
||||
static ADDRESS_MAP_START( subm_sound_map, AS_PROGRAM, 8, sub_state )
|
||||
|
@ -425,7 +431,7 @@ PALETTE_INIT_MEMBER(sub_state, sub)
|
|||
}
|
||||
|
||||
|
||||
INTERRUPT_GEN_MEMBER(sub_state::subm_sound_irq)
|
||||
INTERRUPT_GEN_MEMBER(sub_state::sound_irq)
|
||||
{
|
||||
if(m_nmi_en)
|
||||
m_soundcpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
|
||||
|
@ -442,7 +448,7 @@ static MACHINE_CONFIG_START( sub, sub_state )
|
|||
MCFG_CPU_ADD("soundcpu", Z80,MASTER_CLOCK/6) /* ? MHz */
|
||||
MCFG_CPU_PROGRAM_MAP(subm_sound_map)
|
||||
MCFG_CPU_IO_MAP(subm_sound_io)
|
||||
MCFG_CPU_PERIODIC_INT_DRIVER(sub_state, subm_sound_irq, 120) //???
|
||||
MCFG_CPU_PERIODIC_INT_DRIVER(sub_state, sound_irq, 120) //???
|
||||
|
||||
|
||||
/* video hardware */
|
||||
|
@ -451,7 +457,7 @@ static MACHINE_CONFIG_START( sub, sub_state )
|
|||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
|
||||
MCFG_SCREEN_SIZE(256, 256)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 16, 256-16-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(sub_state, screen_update_sub)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(sub_state, screen_update)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", sub)
|
||||
|
@ -502,4 +508,4 @@ ROM_START( sub )
|
|||
ROM_LOAD( "prom pos c8 n82s129", 0x0600, 0x100, CRC(351e1ef8) SHA1(530c9012ff5abda1c4ba9787ca999ca1ae1a893d) )
|
||||
ROM_END
|
||||
|
||||
GAME( 1985, sub, 0, sub, sub, driver_device, 0, ROT270, "Sigma Enterprises Inc.", "Submarine (Sigma)", GAME_NO_COCKTAIL )
|
||||
GAME( 1985, sub, 0, sub, sub, driver_device, 0, ROT270, "Sigma Enterprises Inc.", "Submarine (Sigma)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
|
||||
|
|
|
@ -47,21 +47,21 @@ PALETTE_INIT_MEMBER(subs_state, subs)
|
|||
|
||||
static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, subs_state )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0x3fff)
|
||||
AM_RANGE(0x0000, 0x0000) AM_WRITE(subs_noise_reset_w)
|
||||
AM_RANGE(0x0000, 0x0007) AM_READ(subs_control_r)
|
||||
AM_RANGE(0x0020, 0x0020) AM_WRITE(subs_steer_reset_w)
|
||||
AM_RANGE(0x0020, 0x0027) AM_READ(subs_coin_r)
|
||||
// AM_RANGE(0x0040, 0x0040) AM_WRITE(subs_timer_reset_w)
|
||||
AM_RANGE(0x0060, 0x0063) AM_READ(subs_options_r)
|
||||
AM_RANGE(0x0060, 0x0061) AM_WRITE(subs_lamp1_w)
|
||||
AM_RANGE(0x0062, 0x0063) AM_WRITE(subs_lamp2_w)
|
||||
AM_RANGE(0x0064, 0x0065) AM_WRITE(subs_sonar2_w)
|
||||
AM_RANGE(0x0066, 0x0067) AM_WRITE(subs_sonar1_w)
|
||||
AM_RANGE(0x0000, 0x0000) AM_WRITE(noise_reset_w)
|
||||
AM_RANGE(0x0000, 0x0007) AM_READ(control_r)
|
||||
AM_RANGE(0x0020, 0x0020) AM_WRITE(steer_reset_w)
|
||||
AM_RANGE(0x0020, 0x0027) AM_READ(coin_r)
|
||||
// AM_RANGE(0x0040, 0x0040) AM_WRITE(timer_reset_w)
|
||||
AM_RANGE(0x0060, 0x0063) AM_READ(options_r)
|
||||
AM_RANGE(0x0060, 0x0061) AM_WRITE(lamp1_w)
|
||||
AM_RANGE(0x0062, 0x0063) AM_WRITE(lamp2_w)
|
||||
AM_RANGE(0x0064, 0x0065) AM_WRITE(sonar2_w)
|
||||
AM_RANGE(0x0066, 0x0067) AM_WRITE(sonar1_w)
|
||||
// Schematics show crash and explode reversed. But this is proper.
|
||||
AM_RANGE(0x0068, 0x0069) AM_WRITE(subs_explode_w)
|
||||
AM_RANGE(0x006a, 0x006b) AM_WRITE(subs_crash_w)
|
||||
AM_RANGE(0x006c, 0x006d) AM_WRITE(subs_invert1_w)
|
||||
AM_RANGE(0x006e, 0x006f) AM_WRITE(subs_invert2_w)
|
||||
AM_RANGE(0x0068, 0x0069) AM_WRITE(explode_w)
|
||||
AM_RANGE(0x006a, 0x006b) AM_WRITE(crash_w)
|
||||
AM_RANGE(0x006c, 0x006d) AM_WRITE(invert1_w)
|
||||
AM_RANGE(0x006e, 0x006f) AM_WRITE(invert2_w)
|
||||
AM_RANGE(0x0090, 0x009f) AM_SHARE("spriteram")
|
||||
AM_RANGE(0x0000, 0x01ff) AM_RAM
|
||||
AM_RANGE(0x0800, 0x0bff) AM_RAM AM_SHARE("videoram")
|
||||
|
@ -179,7 +179,7 @@ static MACHINE_CONFIG_START( subs, subs_state )
|
|||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M6502,12096000/16) /* clock input is the "4H" signal */
|
||||
MCFG_CPU_PROGRAM_MAP(main_map)
|
||||
MCFG_CPU_PERIODIC_INT_DRIVER(subs_state, subs_interrupt, 4*57)
|
||||
MCFG_CPU_PERIODIC_INT_DRIVER(subs_state, interrupt, 4*57)
|
||||
|
||||
|
||||
/* video hardware */
|
||||
|
@ -195,7 +195,7 @@ static MACHINE_CONFIG_START( subs, subs_state )
|
|||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
|
||||
MCFG_SCREEN_SIZE(32*8, 32*8)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(subs_state, screen_update_subs_left)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(subs_state, screen_update_left)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_SCREEN_ADD("rscreen", RASTER)
|
||||
|
@ -203,7 +203,7 @@ static MACHINE_CONFIG_START( subs, subs_state )
|
|||
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
|
||||
MCFG_SCREEN_SIZE(32*8, 32*8)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(subs_state, screen_update_subs_right)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(subs_state, screen_update_right)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
|
||||
|
@ -250,4 +250,4 @@ ROM_END
|
|||
*
|
||||
*************************************/
|
||||
|
||||
GAME( 1977, subs, 0, subs, subs, driver_device, 0, ROT0, "Atari", "Subs", GAME_IMPERFECT_SOUND )
|
||||
GAME( 1977, subs, 0, subs, subs, driver_device, 0, ROT0, "Atari", "Subs", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
|
|
|
@ -21,45 +21,53 @@ class subs_state : public driver_device
|
|||
public:
|
||||
subs_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_discrete(*this, "discrete"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
m_palette(*this, "palette") { }
|
||||
m_palette(*this, "palette"),
|
||||
m_discrete(*this, "discrete"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_videoram(*this, "videoram") { }
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
required_device<discrete_device> m_discrete;
|
||||
|
||||
required_shared_ptr<UINT8> m_spriteram;
|
||||
required_shared_ptr<UINT8> m_videoram;
|
||||
required_device<discrete_device> m_discrete;
|
||||
|
||||
int m_steering_buf1;
|
||||
int m_steering_buf2;
|
||||
int m_steering_val1;
|
||||
int m_steering_val2;
|
||||
int m_last_val_1;
|
||||
int m_last_val_2;
|
||||
DECLARE_WRITE8_MEMBER(subs_steer_reset_w);
|
||||
DECLARE_READ8_MEMBER(subs_control_r);
|
||||
DECLARE_READ8_MEMBER(subs_coin_r);
|
||||
DECLARE_READ8_MEMBER(subs_options_r);
|
||||
DECLARE_WRITE8_MEMBER(subs_lamp1_w);
|
||||
DECLARE_WRITE8_MEMBER(subs_lamp2_w);
|
||||
DECLARE_WRITE8_MEMBER(subs_invert1_w);
|
||||
DECLARE_WRITE8_MEMBER(subs_invert2_w);
|
||||
|
||||
DECLARE_WRITE8_MEMBER(steer_reset_w);
|
||||
DECLARE_READ8_MEMBER(control_r);
|
||||
DECLARE_READ8_MEMBER(coin_r);
|
||||
DECLARE_READ8_MEMBER(options_r);
|
||||
DECLARE_WRITE8_MEMBER(lamp1_w);
|
||||
DECLARE_WRITE8_MEMBER(lamp2_w);
|
||||
DECLARE_WRITE8_MEMBER(invert1_w);
|
||||
DECLARE_WRITE8_MEMBER(invert2_w);
|
||||
DECLARE_WRITE8_MEMBER(sonar1_w);
|
||||
DECLARE_WRITE8_MEMBER(sonar2_w);
|
||||
DECLARE_WRITE8_MEMBER(crash_w);
|
||||
DECLARE_WRITE8_MEMBER(explode_w);
|
||||
DECLARE_WRITE8_MEMBER(noise_reset_w);
|
||||
|
||||
virtual void machine_start();
|
||||
virtual void machine_reset();
|
||||
DECLARE_PALETTE_INIT(subs);
|
||||
UINT32 screen_update_subs_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_subs_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
INTERRUPT_GEN_MEMBER(subs_interrupt);
|
||||
DECLARE_WRITE8_MEMBER(subs_sonar1_w);
|
||||
DECLARE_WRITE8_MEMBER(subs_sonar2_w);
|
||||
DECLARE_WRITE8_MEMBER(subs_crash_w);
|
||||
DECLARE_WRITE8_MEMBER(subs_explode_w);
|
||||
DECLARE_WRITE8_MEMBER(subs_noise_reset_w);
|
||||
int subs_steering_1();
|
||||
int subs_steering_2();
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
UINT32 screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
INTERRUPT_GEN_MEMBER(interrupt);
|
||||
|
||||
int steering_1();
|
||||
int steering_2();
|
||||
};
|
||||
|
||||
/*----------- defined in audio/subs.c -----------*/
|
||||
|
|
|
@ -9,8 +9,19 @@
|
|||
|
||||
|
||||
/***************************************************************************
|
||||
subs_init_machine
|
||||
machine initialization
|
||||
***************************************************************************/
|
||||
|
||||
void subs_state::machine_start()
|
||||
{
|
||||
save_item(NAME(m_steering_buf1));
|
||||
save_item(NAME(m_steering_buf2));
|
||||
save_item(NAME(m_steering_val1));
|
||||
save_item(NAME(m_steering_val2));
|
||||
save_item(NAME(m_last_val_1));
|
||||
save_item(NAME(m_last_val_2));
|
||||
}
|
||||
|
||||
void subs_state::machine_reset()
|
||||
{
|
||||
m_steering_buf1 = 0;
|
||||
|
@ -20,9 +31,9 @@ void subs_state::machine_reset()
|
|||
}
|
||||
|
||||
/***************************************************************************
|
||||
subs_interrupt
|
||||
interrupt
|
||||
***************************************************************************/
|
||||
INTERRUPT_GEN_MEMBER(subs_state::subs_interrupt)
|
||||
INTERRUPT_GEN_MEMBER(subs_state::interrupt)
|
||||
{
|
||||
/* only do NMI interrupt if not in TEST mode */
|
||||
if ((ioport("IN1")->read() & 0x40)==0x40)
|
||||
|
@ -36,7 +47,7 @@ When D7 is high, the steering wheel has moved.
|
|||
If D6 is high, it moved left. If D6 is low, it moved right.
|
||||
Be sure to keep returning a direction until steer_reset is called.
|
||||
***************************************************************************/
|
||||
int subs_state::subs_steering_1()
|
||||
int subs_state::steering_1()
|
||||
{
|
||||
int this_val;
|
||||
int delta;
|
||||
|
@ -64,7 +75,7 @@ int subs_state::subs_steering_1()
|
|||
return m_steering_val1;
|
||||
}
|
||||
|
||||
int subs_state::subs_steering_2()
|
||||
int subs_state::steering_2()
|
||||
{
|
||||
int this_val;
|
||||
int delta;
|
||||
|
@ -93,18 +104,18 @@ int subs_state::subs_steering_2()
|
|||
}
|
||||
|
||||
/***************************************************************************
|
||||
subs_steer_reset
|
||||
steer_reset
|
||||
***************************************************************************/
|
||||
WRITE8_MEMBER(subs_state::subs_steer_reset_w)
|
||||
WRITE8_MEMBER(subs_state::steer_reset_w)
|
||||
{
|
||||
m_steering_val1 = 0x00;
|
||||
m_steering_val2 = 0x00;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
subs_control_r
|
||||
control_r
|
||||
***************************************************************************/
|
||||
READ8_MEMBER(subs_state::subs_control_r)
|
||||
READ8_MEMBER(subs_state::control_r)
|
||||
{
|
||||
int inport = ioport("IN0")->read();
|
||||
|
||||
|
@ -114,19 +125,19 @@ READ8_MEMBER(subs_state::subs_control_r)
|
|||
case 0x01: return ((inport & 0x02) << 6); /* diag hold */
|
||||
case 0x02: return ((inport & 0x04) << 5); /* slam */
|
||||
case 0x03: return ((inport & 0x08) << 4); /* spare */
|
||||
case 0x04: return ((subs_steering_1() & 0x40) << 1); /* steer dir 1 */
|
||||
case 0x05: return ((subs_steering_1() & 0x80) << 0); /* steer flag 1 */
|
||||
case 0x06: return ((subs_steering_2() & 0x40) << 1); /* steer dir 2 */
|
||||
case 0x07: return ((subs_steering_2() & 0x80) << 0); /* steer flag 2 */
|
||||
case 0x04: return ((steering_1() & 0x40) << 1); /* steer dir 1 */
|
||||
case 0x05: return ((steering_1() & 0x80) << 0); /* steer flag 1 */
|
||||
case 0x06: return ((steering_2() & 0x40) << 1); /* steer dir 2 */
|
||||
case 0x07: return ((steering_2() & 0x80) << 0); /* steer flag 2 */
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
subs_coin_r
|
||||
coin_r
|
||||
***************************************************************************/
|
||||
READ8_MEMBER(subs_state::subs_coin_r)
|
||||
READ8_MEMBER(subs_state::coin_r)
|
||||
{
|
||||
int inport = ioport("IN1")->read();
|
||||
|
||||
|
@ -146,9 +157,9 @@ READ8_MEMBER(subs_state::subs_coin_r)
|
|||
}
|
||||
|
||||
/***************************************************************************
|
||||
subs_options_r
|
||||
options_r
|
||||
***************************************************************************/
|
||||
READ8_MEMBER(subs_state::subs_options_r)
|
||||
READ8_MEMBER(subs_state::options_r)
|
||||
{
|
||||
int opts = ioport("DSW")->read();
|
||||
|
||||
|
@ -164,17 +175,17 @@ READ8_MEMBER(subs_state::subs_options_r)
|
|||
}
|
||||
|
||||
/***************************************************************************
|
||||
subs_lamp1_w
|
||||
lamp1_w
|
||||
***************************************************************************/
|
||||
WRITE8_MEMBER(subs_state::subs_lamp1_w)
|
||||
WRITE8_MEMBER(subs_state::lamp1_w)
|
||||
{
|
||||
set_led_status(machine(), 0,~offset & 1);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
subs_lamp2_w
|
||||
lamp2_w
|
||||
***************************************************************************/
|
||||
WRITE8_MEMBER(subs_state::subs_lamp2_w)
|
||||
WRITE8_MEMBER(subs_state::lamp2_w)
|
||||
{
|
||||
set_led_status(machine(), 1,~offset & 1);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "includes/subs.h"
|
||||
#include "sound/discrete.h"
|
||||
|
||||
WRITE8_MEMBER(subs_state::subs_invert1_w)
|
||||
WRITE8_MEMBER(subs_state::invert1_w)
|
||||
{
|
||||
if ((offset & 0x01) == 1)
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ WRITE8_MEMBER(subs_state::subs_invert1_w)
|
|||
}
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(subs_state::subs_invert2_w)
|
||||
WRITE8_MEMBER(subs_state::invert2_w)
|
||||
{
|
||||
if ((offset & 0x01) == 1)
|
||||
{
|
||||
|
@ -37,15 +37,11 @@ WRITE8_MEMBER(subs_state::subs_invert2_w)
|
|||
}
|
||||
|
||||
|
||||
UINT32 subs_state::screen_update_subs_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
UINT32 subs_state::screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
UINT8 *videoram = m_videoram;
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
int offs;
|
||||
|
||||
/* for every character in the Video RAM, check if it has been modified */
|
||||
/* since last time and update it accordingly. */
|
||||
for (offs = 0x400 - 1; offs >= 0; offs--)
|
||||
for (int offs = 0x400 - 1; offs >= 0; offs--)
|
||||
{
|
||||
int charcode;
|
||||
int sx,sy;
|
||||
|
@ -55,7 +51,7 @@ UINT32 subs_state::screen_update_subs_left(screen_device &screen, bitmap_ind16 &
|
|||
left_sonar_window = 0;
|
||||
right_sonar_window = 0;
|
||||
|
||||
charcode = videoram[offs];
|
||||
charcode = m_videoram[offs];
|
||||
|
||||
/* Which monitor is this for? */
|
||||
// right_enable = charcode & 0x40;
|
||||
|
@ -84,18 +80,18 @@ UINT32 subs_state::screen_update_subs_left(screen_device &screen, bitmap_ind16 &
|
|||
}
|
||||
|
||||
/* draw the motion objects */
|
||||
for (offs = 0; offs < 4; offs++)
|
||||
for (int offs = 0; offs < 4; offs++)
|
||||
{
|
||||
int sx,sy;
|
||||
int charcode;
|
||||
int prom_set;
|
||||
int sub_enable;
|
||||
|
||||
sx = spriteram[0x00 + (offs * 2)] - 16;
|
||||
sy = spriteram[0x08 + (offs * 2)] - 16;
|
||||
charcode = spriteram[0x09 + (offs * 2)];
|
||||
sx = m_spriteram[0x00 + (offs * 2)] - 16;
|
||||
sy = m_spriteram[0x08 + (offs * 2)] - 16;
|
||||
charcode = m_spriteram[0x09 + (offs * 2)];
|
||||
if (offs < 2)
|
||||
sub_enable = spriteram[0x01 + (offs * 2)] & 0x80;
|
||||
sub_enable = m_spriteram[0x01 + (offs * 2)] & 0x80;
|
||||
else
|
||||
sub_enable = 1;
|
||||
|
||||
|
@ -112,20 +108,16 @@ UINT32 subs_state::screen_update_subs_left(screen_device &screen, bitmap_ind16 &
|
|||
|
||||
/* Update sound */
|
||||
address_space &space = machine().driver_data()->generic_space();
|
||||
m_discrete->write(space, SUBS_LAUNCH_DATA, spriteram[5] & 0x0f); // Launch data
|
||||
m_discrete->write(space, SUBS_CRASH_DATA, spriteram[5] >> 4); // Crash/explode data
|
||||
m_discrete->write(space, SUBS_LAUNCH_DATA, m_spriteram[5] & 0x0f); // Launch data
|
||||
m_discrete->write(space, SUBS_CRASH_DATA, m_spriteram[5] >> 4); // Crash/explode data
|
||||
return 0;
|
||||
}
|
||||
|
||||
UINT32 subs_state::screen_update_subs_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
UINT32 subs_state::screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
UINT8 *videoram = m_videoram;
|
||||
UINT8 *spriteram = m_spriteram;
|
||||
int offs;
|
||||
|
||||
/* for every character in the Video RAM, check if it has been modified */
|
||||
/* since last time and update it accordingly. */
|
||||
for (offs = 0x400 - 1; offs >= 0; offs--)
|
||||
for (int offs = 0x400 - 1; offs >= 0; offs--)
|
||||
{
|
||||
int charcode;
|
||||
int sx,sy;
|
||||
|
@ -135,7 +127,7 @@ UINT32 subs_state::screen_update_subs_right(screen_device &screen, bitmap_ind16
|
|||
left_sonar_window = 0;
|
||||
right_sonar_window = 0;
|
||||
|
||||
charcode = videoram[offs];
|
||||
charcode = m_videoram[offs];
|
||||
|
||||
/* Which monitor is this for? */
|
||||
right_enable = charcode & 0x40;
|
||||
|
@ -164,18 +156,18 @@ UINT32 subs_state::screen_update_subs_right(screen_device &screen, bitmap_ind16
|
|||
}
|
||||
|
||||
/* draw the motion objects */
|
||||
for (offs = 0; offs < 4; offs++)
|
||||
for (int offs = 0; offs < 4; offs++)
|
||||
{
|
||||
int sx,sy;
|
||||
int charcode;
|
||||
int prom_set;
|
||||
int sub_enable;
|
||||
|
||||
sx = spriteram[0x00 + (offs * 2)] - 16;
|
||||
sy = spriteram[0x08 + (offs * 2)] - 16;
|
||||
charcode = spriteram[0x09 + (offs * 2)];
|
||||
sx = m_spriteram[0x00 + (offs * 2)] - 16;
|
||||
sy = m_spriteram[0x08 + (offs * 2)] - 16;
|
||||
charcode = m_spriteram[0x09 + (offs * 2)];
|
||||
if (offs < 2)
|
||||
sub_enable = spriteram[0x01 + (offs * 2)] & 0x80;
|
||||
sub_enable = m_spriteram[0x01 + (offs * 2)] & 0x80;
|
||||
else
|
||||
sub_enable = 1;
|
||||
|
||||
|
|
Loading…
Reference in a new issue