mirror of
https://github.com/holub/mame
synced 2025-04-25 09:50:04 +03:00
(MESS) advision.c: cleaned up the driver and added support for save states. [Fabio Priuli]
This commit is contained in:
parent
6fe528885e
commit
75d4c849ee
@ -114,4 +114,4 @@ ROM_END
|
||||
/* Game Driver */
|
||||
|
||||
/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */
|
||||
CONS( 1982, advision, 0, 0, advision, advision, driver_device, 0, "Entex Industries Inc", "Adventure Vision", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND )
|
||||
CONS( 1982, advision, 0, 0, advision, advision, driver_device, 0, "Entex Industries Inc", "Adventure Vision", GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
|
||||
|
@ -24,6 +24,8 @@ public:
|
||||
m_soundcpu(*this, COP411_TAG),
|
||||
m_dac(*this, "dac"),
|
||||
m_cart(*this, "cartslot"),
|
||||
m_bank1(*this, "bank1"),
|
||||
m_joy(*this, "joystick"),
|
||||
m_palette(*this, "palette")
|
||||
{ }
|
||||
|
||||
@ -31,6 +33,8 @@ public:
|
||||
required_device<cpu_device> m_soundcpu;
|
||||
required_device<dac_device> m_dac;
|
||||
required_device<generic_slot_device> m_cart;
|
||||
required_memory_bank m_bank1;
|
||||
required_ioport m_joy;
|
||||
required_device<palette_device> m_palette;
|
||||
|
||||
virtual void machine_start();
|
||||
@ -56,8 +60,10 @@ public:
|
||||
|
||||
memory_region *m_cart_rom;
|
||||
|
||||
int m_ea_bank;
|
||||
|
||||
/* external RAM state */
|
||||
UINT8 *m_ext_ram;
|
||||
dynamic_buffer m_ext_ram;
|
||||
int m_rambank;
|
||||
|
||||
/* video state */
|
||||
@ -67,7 +73,7 @@ public:
|
||||
int m_video_bank;
|
||||
int m_video_hpos;
|
||||
UINT8 m_led_latch[8];
|
||||
UINT8 *m_display;
|
||||
dynamic_buffer m_display;
|
||||
|
||||
/* sound state */
|
||||
int m_sound_cmd;
|
||||
|
@ -31,41 +31,52 @@ void advision_state::machine_start()
|
||||
m_cart_rom = memregion(region_tag.cpy(m_cart->tag()).cat(GENERIC_ROM_REGION_TAG));
|
||||
|
||||
/* configure EA banking */
|
||||
membank("bank1")->configure_entry(0, memregion(I8048_TAG)->base());
|
||||
membank("bank1")->configure_entry(1, m_cart_rom->base());
|
||||
m_bank1->configure_entry(0, memregion(I8048_TAG)->base());
|
||||
m_bank1->configure_entry(1, m_cart_rom->base());
|
||||
m_maincpu->space(AS_PROGRAM).install_readwrite_bank(0x0000, 0x03ff, "bank1");
|
||||
membank("bank1")->set_entry(0);
|
||||
m_bank1->set_entry(0);
|
||||
|
||||
/* allocate external RAM */
|
||||
m_ext_ram = auto_alloc_array(machine(), UINT8, 0x400);
|
||||
m_ext_ram.resize(0x400);
|
||||
save_item(NAME(m_ext_ram));
|
||||
|
||||
save_item(NAME(m_ea_bank));
|
||||
save_item(NAME(m_rambank));
|
||||
save_item(NAME(m_frame_count));
|
||||
save_item(NAME(m_frame_start));
|
||||
save_item(NAME(m_video_enable));
|
||||
save_item(NAME(m_video_bank));
|
||||
save_item(NAME(m_led_latch));
|
||||
save_item(NAME(m_sound_cmd));
|
||||
save_item(NAME(m_sound_d));
|
||||
save_item(NAME(m_sound_g));
|
||||
}
|
||||
|
||||
void advision_state::machine_reset()
|
||||
{
|
||||
/* enable internal ROM */
|
||||
m_maincpu->set_input_line(MCS48_INPUT_EA, CLEAR_LINE);
|
||||
membank("bank1")->set_entry(0);
|
||||
|
||||
/* reset sound CPU */
|
||||
m_soundcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
|
||||
|
||||
m_ea_bank = 0;
|
||||
m_rambank = 0x300;
|
||||
m_frame_start = 0;
|
||||
m_video_enable = 0;
|
||||
m_sound_cmd = 0;
|
||||
|
||||
/* enable internal ROM */
|
||||
m_maincpu->set_input_line(MCS48_INPUT_EA, CLEAR_LINE);
|
||||
m_bank1->set_entry(m_ea_bank);
|
||||
|
||||
/* reset sound CPU */
|
||||
m_soundcpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
|
||||
}
|
||||
|
||||
/* Bank Switching */
|
||||
|
||||
WRITE8_MEMBER( advision_state::bankswitch_w )
|
||||
{
|
||||
int ea = BIT(data, 2);
|
||||
|
||||
m_maincpu->set_input_line(MCS48_INPUT_EA, ea ? ASSERT_LINE : CLEAR_LINE);
|
||||
|
||||
membank("bank1")->set_entry(ea);
|
||||
|
||||
m_ea_bank = BIT(data, 2);
|
||||
m_rambank = (data & 0x03) << 8;
|
||||
|
||||
m_maincpu->set_input_line(MCS48_INPUT_EA, m_ea_bank ? ASSERT_LINE : CLEAR_LINE);
|
||||
m_bank1->set_entry(m_ea_bank);
|
||||
}
|
||||
|
||||
/* External RAM */
|
||||
@ -166,7 +177,7 @@ READ8_MEMBER( advision_state::vsync_r )
|
||||
READ8_MEMBER( advision_state::controller_r )
|
||||
{
|
||||
// Get joystick switches
|
||||
UINT8 in = ioport("joystick")->read();
|
||||
UINT8 in = m_joy->read();
|
||||
UINT8 data = in | 0x0f;
|
||||
|
||||
// Get buttons
|
||||
|
@ -21,8 +21,9 @@
|
||||
void advision_state::video_start()
|
||||
{
|
||||
m_video_hpos = 0;
|
||||
m_display = auto_alloc_array(machine(), UINT8, 8 * 8 * 256);
|
||||
memset(m_display, 0, 8 * 8 * 256);
|
||||
m_display.resize_and_clear(8 * 8 * 256);
|
||||
save_item(NAME(m_display));
|
||||
save_item(NAME(m_video_hpos));
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -33,9 +34,7 @@ void advision_state::video_start()
|
||||
|
||||
PALETTE_INIT_MEMBER(advision_state, advision)
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < 8; i++ )
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
/* 8 shades of RED */
|
||||
m_palette->set_pen_color(i, i * 0x22, 0x00, 0x00);
|
||||
@ -59,23 +58,18 @@ void advision_state::vh_write(int data)
|
||||
void advision_state::vh_update(int x)
|
||||
{
|
||||
UINT8 *dst = &m_display[x];
|
||||
int y;
|
||||
|
||||
for( y = 0; y < 8; y++ )
|
||||
for (int y = 0; y < 8; y++)
|
||||
{
|
||||
UINT8 data = m_led_latch[7-y];
|
||||
UINT8 data = m_led_latch[7 - y];
|
||||
|
||||
if( (data & 0x80) == 0 ) dst[0 * 256] = 8;
|
||||
if( (data & 0x40) == 0 ) dst[1 * 256] = 8;
|
||||
if( (data & 0x20) == 0 ) dst[2 * 256] = 8;
|
||||
if( (data & 0x10) == 0 ) dst[3 * 256] = 8;
|
||||
if( (data & 0x08) == 0 ) dst[4 * 256] = 8;
|
||||
if( (data & 0x04) == 0 ) dst[5 * 256] = 8;
|
||||
if( (data & 0x02) == 0 ) dst[6 * 256] = 8;
|
||||
if( (data & 0x01) == 0 ) dst[7 * 256] = 8;
|
||||
|
||||
m_led_latch[7-y] = 0xff;
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (!BIT(data, 7 - i))
|
||||
dst[i * 256] = 8;
|
||||
}
|
||||
|
||||
m_led_latch[7 - y] = 0xff;
|
||||
dst += 8 * 256;
|
||||
}
|
||||
}
|
||||
@ -89,21 +83,19 @@ void advision_state::vh_update(int x)
|
||||
|
||||
UINT32 advision_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
if( (m_frame_count++ % 4) == 0 )
|
||||
if ((m_frame_count++ % 4) == 0)
|
||||
{
|
||||
m_frame_start = 1;
|
||||
m_video_hpos = 0;
|
||||
}
|
||||
|
||||
for (x = 0; x < 150; x++)
|
||||
for (int x = 0; x < 150; x++)
|
||||
{
|
||||
UINT8 *led = &m_display[x];
|
||||
|
||||
for( y = 0; y < 128; y+=2 )
|
||||
for (int y = 0; y < 128; y+=2)
|
||||
{
|
||||
if( *led > 0 )
|
||||
if (*led > 0)
|
||||
bitmap.pix16(30 + y, 85 + x) = --(*led);
|
||||
else
|
||||
bitmap.pix16(30 + y, 85 + x) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user