mirror of
https://github.com/holub/mame
synced 2025-04-16 21:44:32 +03:00
(MESS) scv.c: simplified input reading and added save state support [Fabio Priuli]
I've also fixed Star Speeder rom loading, but the game is not working yet.
This commit is contained in:
parent
552d0d0fc2
commit
527c153e99
15
hash/scv.xml
15
hash/scv.xml
@ -254,7 +254,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html
|
||||
</software>
|
||||
|
||||
<software name="nebulaa" cloneof="nebula">
|
||||
<description>Nebula (alt)</description>
|
||||
<description>Nebula (Alt)</description>
|
||||
<year>1984</year>
|
||||
<publisher>Epoch</publisher>
|
||||
<part name="cart" interface="scv_cart">
|
||||
@ -334,14 +334,17 @@ Information found at http://www.rhod.fr/yeno_epoch.html
|
||||
</part>
|
||||
</software>
|
||||
|
||||
<software name="starspdr">
|
||||
<software name="starspdr" supported="partial">
|
||||
<description>Star Speeder</description>
|
||||
<year>1985</year>
|
||||
<publisher>Epoch</publisher>
|
||||
<part name="cart" interface="scv_cart">
|
||||
<dataarea name="rom" size="40960">
|
||||
<rom name="starspeeder.0" size="32768" crc="511576ee" sha1="1b61132af26dc8d5c1b5e0f72c2e96192bba7e20" offset="0" />
|
||||
<rom name="starspeeder.1" size="8192" crc="7978c4a6" sha1="6BB5FF3946867FA7ADB6561DC084EF5A7A92C507" offset="0x8000" />
|
||||
<dataarea name="rom" size="65536">
|
||||
<rom name="starspeeder.1" size="8192" crc="7978c4a6" sha1="6bb5ff3946867fa7adb6561dc084ef5a7a92c507" offset="0" />
|
||||
<rom size="8192" offset="0x2000" loadflag="reload" />
|
||||
<rom size="8192" offset="0x4000" loadflag="reload" />
|
||||
<rom size="8192" offset="0x6000" loadflag="reload" />
|
||||
<rom name="starspeeder.0" size="32768" crc="511576ee" sha1="1b61132af26dc8d5c1b5e0f72c2e96192bba7e20" offset="0x8000" />
|
||||
</dataarea>
|
||||
</part>
|
||||
</software>
|
||||
@ -384,7 +387,7 @@ Information found at http://www.rhod.fr/yeno_epoch.html
|
||||
|
||||
<!-- maybe pal, name taken from boxart -->
|
||||
<software name="soccera" cloneof="soccer">
|
||||
<description>Super Soccer (alt)</description>
|
||||
<description>Super Soccer (Alt)</description>
|
||||
<year>1985</year>
|
||||
<publisher>Epoch</publisher>
|
||||
<part name="cart" interface="scv_cart">
|
||||
|
@ -22,14 +22,6 @@ public:
|
||||
m_cart_ram_size(0),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_upd1771c(*this, "upd1771c"),
|
||||
m_pa0(*this, "PA0"),
|
||||
m_pa1(*this, "PA1"),
|
||||
m_pa2(*this, "PA2"),
|
||||
m_pa3(*this, "PA3"),
|
||||
m_pa4(*this, "PA4"),
|
||||
m_pa5(*this, "PA5"),
|
||||
m_pa6(*this, "PA6"),
|
||||
m_pa7(*this, "PA7"),
|
||||
m_pc0(*this, "PC0"),
|
||||
m_bank0(*this, "bank0"),
|
||||
m_bank1(*this, "bank1"),
|
||||
@ -57,21 +49,18 @@ public:
|
||||
virtual void machine_start();
|
||||
virtual void machine_reset();
|
||||
virtual void palette_init();
|
||||
void scv_postload();
|
||||
UINT32 screen_update_scv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
TIMER_CALLBACK_MEMBER(scv_vb_callback);
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( scv_cart );
|
||||
|
||||
protected:
|
||||
enum
|
||||
{
|
||||
TIMER_VB
|
||||
};
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<upd1771c_device> m_upd1771c;
|
||||
required_ioport m_pa0;
|
||||
required_ioport m_pa1;
|
||||
required_ioport m_pa2;
|
||||
required_ioport m_pa3;
|
||||
required_ioport m_pa4;
|
||||
required_ioport m_pa5;
|
||||
required_ioport m_pa6;
|
||||
required_ioport m_pa7;
|
||||
required_ioport m_pc0;
|
||||
required_memory_bank m_bank0;
|
||||
required_memory_bank m_bank1;
|
||||
@ -80,6 +69,9 @@ protected:
|
||||
required_memory_bank m_bank4;
|
||||
required_memory_region m_charrom;
|
||||
|
||||
ioport_port *m_key[8];
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
|
||||
void scv_set_banks();
|
||||
inline void plot_sprite_part( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 pat, UINT8 col, UINT8 screen_sprite_start_line );
|
||||
inline void draw_sprite( bitmap_ind16 &bitmap, UINT8 x, UINT8 y, UINT8 tile_idx, UINT8 col, UINT8 left, UINT8 right, UINT8 top, UINT8 bottom, UINT8 clip_y, UINT8 screen_sprite_start_line );
|
||||
@ -233,44 +225,10 @@ READ8_MEMBER( scv_state::scv_portb_r )
|
||||
{
|
||||
UINT8 data = 0xff;
|
||||
|
||||
if ( ! ( m_porta & 0x01 ) )
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
data &= m_pa0->read();
|
||||
}
|
||||
|
||||
if ( ! ( m_porta & 0x02 ) )
|
||||
{
|
||||
data &= m_pa1->read();
|
||||
}
|
||||
|
||||
if ( ! ( m_porta & 0x04 ) )
|
||||
{
|
||||
data &= m_pa2->read();
|
||||
}
|
||||
|
||||
if ( ! ( m_porta & 0x08 ) )
|
||||
{
|
||||
data &= m_pa3->read();
|
||||
}
|
||||
|
||||
if ( ! ( m_porta & 0x10 ) )
|
||||
{
|
||||
data &= m_pa4->read();
|
||||
}
|
||||
|
||||
if ( ! ( m_porta & 0x20 ) )
|
||||
{
|
||||
data &= m_pa5->read();
|
||||
}
|
||||
|
||||
if ( ! ( m_porta & 0x40 ) )
|
||||
{
|
||||
data &= m_pa6->read();
|
||||
}
|
||||
|
||||
if ( ! ( m_porta & 0x80 ) )
|
||||
{
|
||||
data &= m_pa7->read();
|
||||
if (!BIT(m_porta, i))
|
||||
data &= m_key[i]->read();
|
||||
}
|
||||
|
||||
return data;
|
||||
@ -281,7 +239,7 @@ READ8_MEMBER( scv_state::scv_portc_r )
|
||||
{
|
||||
UINT8 data = m_portc;
|
||||
|
||||
data = ( data & 0xfe ) | ( m_pc0->read() & 0x01 );
|
||||
data = (data & 0xfe) | (m_pc0->read() & 0x01);
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -396,6 +354,7 @@ DEVICE_IMAGE_LOAD_MEMBER( scv_state, scv_cart )
|
||||
if ( m_cart_ram_size > 0 )
|
||||
{
|
||||
m_cart_ram = auto_alloc_array_clear( machine(), UINT8, m_cart_ram_size );
|
||||
save_pointer(NAME(m_cart_ram), m_cart_ram_size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -455,21 +414,31 @@ void scv_state::palette_init()
|
||||
}
|
||||
|
||||
|
||||
TIMER_CALLBACK_MEMBER(scv_state::scv_vb_callback)
|
||||
void scv_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||
{
|
||||
int vpos = machine().primary_screen->vpos();
|
||||
|
||||
switch( vpos )
|
||||
switch (id)
|
||||
{
|
||||
case 240:
|
||||
m_maincpu->set_input_line(UPD7810_INTF2, ASSERT_LINE);
|
||||
break;
|
||||
case 0:
|
||||
m_maincpu->set_input_line(UPD7810_INTF2, CLEAR_LINE);
|
||||
break;
|
||||
}
|
||||
case TIMER_VB:
|
||||
{
|
||||
int vpos = machine().primary_screen->vpos();
|
||||
|
||||
switch( vpos )
|
||||
{
|
||||
case 240:
|
||||
m_maincpu->set_input_line(UPD7810_INTF2, ASSERT_LINE);
|
||||
break;
|
||||
case 0:
|
||||
m_maincpu->set_input_line(UPD7810_INTF2, CLEAR_LINE);
|
||||
break;
|
||||
}
|
||||
|
||||
m_vb_timer->adjust( machine().primary_screen->time_until_pos(( vpos + 1 ) % 262, 0 ) );
|
||||
m_vb_timer->adjust(machine().primary_screen->time_until_pos((vpos + 1) % 262, 0));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
assert_always(FALSE, "Unknown id in scv_state::device_timer");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -794,17 +763,35 @@ WRITE_LINE_MEMBER( scv_state::scv_upd1771_ack_w )
|
||||
m_maincpu->set_input_line(UPD7810_INTF1, (state) ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
void scv_state::scv_postload()
|
||||
{
|
||||
scv_set_banks();
|
||||
}
|
||||
|
||||
|
||||
void scv_state::machine_start()
|
||||
{
|
||||
m_cart_rom = memregion( "cart" )->base();
|
||||
m_vb_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(scv_state::scv_vb_callback),this));
|
||||
m_vb_timer = timer_alloc(TIMER_VB);
|
||||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
char str[3];
|
||||
sprintf(str, "PA%i", i);
|
||||
m_key[i] = ioport(str);
|
||||
}
|
||||
|
||||
save_item(NAME(m_porta));
|
||||
save_item(NAME(m_portc));
|
||||
save_item(NAME(m_cart_ram_enabled));
|
||||
|
||||
machine().save().register_postload(save_prepost_delegate(FUNC(scv_state::scv_postload), this));
|
||||
}
|
||||
|
||||
|
||||
void scv_state::machine_reset()
|
||||
{
|
||||
m_vb_timer->adjust( machine().primary_screen->time_until_pos(0, 0 ) );
|
||||
m_vb_timer->adjust(machine().primary_screen->time_until_pos(0, 0));
|
||||
scv_set_banks();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user