mirror of
https://github.com/holub/mame
synced 2025-05-17 03:10:43 +03:00
lviv: cleanup, nw
This commit is contained in:
parent
02e37f561f
commit
760908f66b
@ -288,7 +288,6 @@ Timings:
|
||||
#include "cpu/i8085/i8085.h"
|
||||
#include "sound/wave.h"
|
||||
|
||||
#include "screen.h"
|
||||
#include "softlist.h"
|
||||
#include "speaker.h"
|
||||
|
||||
@ -306,10 +305,10 @@ void lviv_state::io_map(address_map &map)
|
||||
|
||||
void lviv_state::lviv_mem(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x3fff).bankrw("bank1");
|
||||
map(0x4000, 0x7fff).bankrw("bank2");
|
||||
map(0x8000, 0xbfff).bankrw("bank3");
|
||||
map(0xc000, 0xffff).bankrw("bank4");
|
||||
map(0x0000, 0x3fff).bankrw(m_bank[0]);
|
||||
map(0x4000, 0x7fff).bankrw(m_bank[1]);
|
||||
map(0x8000, 0xbfff).bankrw(m_bank[2]);
|
||||
map(0xc000, 0xffff).bankrw(m_bank[3]);
|
||||
}
|
||||
|
||||
|
||||
@ -424,12 +423,12 @@ INPUT_PORTS_END
|
||||
/* machine definition */
|
||||
MACHINE_CONFIG_START(lviv_state::lviv)
|
||||
/* basic machine hardware */
|
||||
MCFG_DEVICE_ADD("maincpu", I8080, 2500000)
|
||||
MCFG_DEVICE_ADD(m_maincpu, I8080, 2500000)
|
||||
MCFG_DEVICE_PROGRAM_MAP(lviv_mem)
|
||||
MCFG_DEVICE_IO_MAP(io_map)
|
||||
MCFG_QUANTUM_TIME(attotime::from_hz(60))
|
||||
|
||||
MCFG_DEVICE_ADD("ppi8255_0", I8255, 0)
|
||||
MCFG_DEVICE_ADD(m_ppi[0], I8255, 0)
|
||||
MCFG_I8255_IN_PORTA_CB(READ8(*this, lviv_state, lviv_ppi_0_porta_r))
|
||||
MCFG_I8255_OUT_PORTA_CB(WRITE8(*this, lviv_state, lviv_ppi_0_porta_w))
|
||||
MCFG_I8255_IN_PORTB_CB(READ8(*this, lviv_state, lviv_ppi_0_portb_r))
|
||||
@ -437,7 +436,7 @@ MACHINE_CONFIG_START(lviv_state::lviv)
|
||||
MCFG_I8255_IN_PORTC_CB(READ8(*this, lviv_state, lviv_ppi_0_portc_r))
|
||||
MCFG_I8255_OUT_PORTC_CB(WRITE8(*this, lviv_state, lviv_ppi_0_portc_w))
|
||||
|
||||
MCFG_DEVICE_ADD("ppi8255_1", I8255, 0)
|
||||
MCFG_DEVICE_ADD(m_ppi[1], I8255, 0)
|
||||
MCFG_I8255_IN_PORTA_CB(READ8(*this, lviv_state, lviv_ppi_1_porta_r))
|
||||
MCFG_I8255_OUT_PORTA_CB(WRITE8(*this, lviv_state, lviv_ppi_1_porta_w))
|
||||
MCFG_I8255_IN_PORTB_CB(READ8(*this, lviv_state, lviv_ppi_1_portb_r))
|
||||
@ -445,7 +444,7 @@ MACHINE_CONFIG_START(lviv_state::lviv)
|
||||
MCFG_I8255_IN_PORTC_CB(READ8(*this, lviv_state, lviv_ppi_1_portc_r))
|
||||
MCFG_I8255_OUT_PORTC_CB(WRITE8(*this, lviv_state, lviv_ppi_1_portc_w))
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_ADD(m_screen, RASTER)
|
||||
MCFG_SCREEN_REFRESH_RATE(50)
|
||||
MCFG_SCREEN_VBLANK_TIME(0)
|
||||
|
||||
@ -453,9 +452,9 @@ MACHINE_CONFIG_START(lviv_state::lviv)
|
||||
MCFG_SCREEN_SIZE(256, 256)
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1)
|
||||
MCFG_SCREEN_UPDATE_DRIVER(lviv_state, screen_update_lviv)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
MCFG_SCREEN_PALETTE(m_palette)
|
||||
|
||||
MCFG_PALETTE_ADD("palette", sizeof (lviv_palette) / 3)
|
||||
MCFG_PALETTE_ADD(m_palette, sizeof (lviv_palette) / 3)
|
||||
MCFG_PALETTE_INIT_OWNER(lviv_state, lviv)
|
||||
|
||||
/* sound hardware */
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "machine/i8255.h"
|
||||
#include "machine/ram.h"
|
||||
#include "sound/spkrdev.h"
|
||||
#include "screen.h"
|
||||
|
||||
class lviv_state : public driver_device
|
||||
{
|
||||
@ -21,10 +22,17 @@ public:
|
||||
lviv_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_ram(*this, RAM_TAG),
|
||||
m_ppi(*this, "ppi8255_%u", 0U),
|
||||
m_speaker(*this, "speaker"),
|
||||
m_cassette(*this, "cassette"),
|
||||
m_ram(*this, RAM_TAG),
|
||||
m_palette(*this, "palette") { }
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette"),
|
||||
m_maincpu_region(*this, "maincpu"),
|
||||
m_bank(*this, "bank%u", 1U),
|
||||
m_key(*this, "KEY%u", 0U),
|
||||
m_joy_port(*this, "JOY")
|
||||
{ }
|
||||
|
||||
unsigned char * m_video_ram;
|
||||
unsigned short m_colortable[1][4];
|
||||
@ -49,10 +57,17 @@ public:
|
||||
DECLARE_WRITE8_MEMBER(lviv_ppi_1_portb_w);
|
||||
DECLARE_WRITE8_MEMBER(lviv_ppi_1_portc_w);
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<ram_device> m_ram;
|
||||
required_device_array<i8255_device, 2> m_ppi;
|
||||
required_device<speaker_sound_device> m_speaker;
|
||||
required_device<cassette_image_device> m_cassette;
|
||||
required_device<ram_device> m_ram;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
required_memory_region m_maincpu_region;
|
||||
required_memory_bank_array<4> m_bank;
|
||||
required_ioport_array<12> m_key;
|
||||
required_ioport m_joy_port;
|
||||
|
||||
void lviv_update_palette(uint8_t pal);
|
||||
void lviv_update_memory ();
|
||||
void lviv_setup_snapshot (uint8_t * data);
|
||||
|
@ -20,19 +20,19 @@
|
||||
#define LVIV_SNAPSHOT_SIZE 82219
|
||||
|
||||
|
||||
void lviv_state::lviv_update_memory ()
|
||||
void lviv_state::lviv_update_memory()
|
||||
{
|
||||
uint8_t *ram = m_ram->pointer();
|
||||
|
||||
if (m_ppi_port_outputs[0][2] & 0x02)
|
||||
{
|
||||
membank("bank1")->set_base(ram);
|
||||
membank("bank2")->set_base(ram + 0x4000);
|
||||
m_bank[0]->set_base(ram);
|
||||
m_bank[1]->set_base(ram + 0x4000);
|
||||
}
|
||||
else
|
||||
{
|
||||
membank("bank1")->set_base(ram + 0x8000);
|
||||
membank("bank2")->set_base(ram + 0xc000);
|
||||
m_bank[0]->set_base(ram + 0x8000);
|
||||
m_bank[1]->set_base(ram + 0xc000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ READ8_MEMBER(lviv_state::lviv_ppi_0_portc_r)
|
||||
uint8_t data = m_ppi_port_outputs[0][2] & 0x0f;
|
||||
if (m_cassette->input() > 0.038)
|
||||
data |= 0x10;
|
||||
if (m_ppi_port_outputs[0][0] & ioport("JOY")->read())
|
||||
if (m_ppi_port_outputs[0][0] & m_joy_port->read())
|
||||
data |= 0x80;
|
||||
return data;
|
||||
}
|
||||
@ -88,22 +88,22 @@ READ8_MEMBER(lviv_state::lviv_ppi_1_porta_r)
|
||||
|
||||
READ8_MEMBER(lviv_state::lviv_ppi_1_portb_r)/* keyboard reading */
|
||||
{
|
||||
return ((m_ppi_port_outputs[1][0] & 0x01) ? 0xff : ioport("KEY0")->read()) &
|
||||
((m_ppi_port_outputs[1][0] & 0x02) ? 0xff : ioport("KEY1")->read()) &
|
||||
((m_ppi_port_outputs[1][0] & 0x04) ? 0xff : ioport("KEY2")->read()) &
|
||||
((m_ppi_port_outputs[1][0] & 0x08) ? 0xff : ioport("KEY3")->read()) &
|
||||
((m_ppi_port_outputs[1][0] & 0x10) ? 0xff : ioport("KEY4")->read()) &
|
||||
((m_ppi_port_outputs[1][0] & 0x20) ? 0xff : ioport("KEY5")->read()) &
|
||||
((m_ppi_port_outputs[1][0] & 0x40) ? 0xff : ioport("KEY6")->read()) &
|
||||
((m_ppi_port_outputs[1][0] & 0x80) ? 0xff : ioport("KEY7")->read());
|
||||
return ((m_ppi_port_outputs[1][0] & 0x01) ? 0xff : m_key[0]->read()) &
|
||||
((m_ppi_port_outputs[1][0] & 0x02) ? 0xff : m_key[1]->read()) &
|
||||
((m_ppi_port_outputs[1][0] & 0x04) ? 0xff : m_key[2]->read()) &
|
||||
((m_ppi_port_outputs[1][0] & 0x08) ? 0xff : m_key[3]->read()) &
|
||||
((m_ppi_port_outputs[1][0] & 0x10) ? 0xff : m_key[4]->read()) &
|
||||
((m_ppi_port_outputs[1][0] & 0x20) ? 0xff : m_key[5]->read()) &
|
||||
((m_ppi_port_outputs[1][0] & 0x40) ? 0xff : m_key[6]->read()) &
|
||||
((m_ppi_port_outputs[1][0] & 0x80) ? 0xff : m_key[7]->read());
|
||||
}
|
||||
|
||||
READ8_MEMBER(lviv_state::lviv_ppi_1_portc_r)/* keyboard reading */
|
||||
{
|
||||
return ((m_ppi_port_outputs[1][2] & 0x01) ? 0xff : ioport("KEY8")->read()) &
|
||||
((m_ppi_port_outputs[1][2] & 0x02) ? 0xff : ioport("KEY9" )->read()) &
|
||||
((m_ppi_port_outputs[1][2] & 0x04) ? 0xff : ioport("KEY10")->read()) &
|
||||
((m_ppi_port_outputs[1][2] & 0x08) ? 0xff : ioport("KEY11")->read());
|
||||
return ((m_ppi_port_outputs[1][2] & 0x01) ? 0xff : m_key[ 8]->read()) &
|
||||
((m_ppi_port_outputs[1][2] & 0x02) ? 0xff : m_key[ 9]->read()) &
|
||||
((m_ppi_port_outputs[1][2] & 0x04) ? 0xff : m_key[10]->read()) &
|
||||
((m_ppi_port_outputs[1][2] & 0x08) ? 0xff : m_key[11]->read());
|
||||
}
|
||||
|
||||
WRITE8_MEMBER(lviv_state::lviv_ppi_1_porta_w)/* kayboard scaning */
|
||||
@ -131,13 +131,12 @@ READ8_MEMBER(lviv_state::lviv_io_r)
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ((offset >> 4) & 0x3)
|
||||
const uint8_t switch_val = (offset >> 4) & 0x3;
|
||||
switch (switch_val)
|
||||
{
|
||||
case 0:
|
||||
return machine().device<i8255_device>("ppi8255_0")->read(space, offset & 3);
|
||||
|
||||
case 1:
|
||||
return machine().device<i8255_device>("ppi8255_1")->read(space, offset & 3);
|
||||
return m_ppi[switch_val]->read(space, offset & 3);
|
||||
|
||||
case 2:
|
||||
case 3:
|
||||
@ -162,21 +161,19 @@ WRITE8_MEMBER(lviv_state::lviv_io_w)
|
||||
cpuspace.install_write_bank(0x8000, 0xbfff, "bank3");
|
||||
cpuspace.unmap_write(0xC000, 0xffff);
|
||||
|
||||
membank("bank1")->set_base(ram);
|
||||
membank("bank2")->set_base(ram + 0x4000);
|
||||
membank("bank3")->set_base(ram + 0x8000);
|
||||
membank("bank4")->set_base(memregion("maincpu")->base() + 0x010000);
|
||||
m_bank[0]->set_base(ram);
|
||||
m_bank[1]->set_base(ram + 0x4000);
|
||||
m_bank[2]->set_base(ram + 0x8000);
|
||||
m_bank[3]->set_base(m_maincpu_region->base() + 0x010000);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ((offset >> 4) & 0x3)
|
||||
const uint8_t switch_val = (offset >> 4) & 0x3;
|
||||
switch (switch_val)
|
||||
{
|
||||
case 0:
|
||||
machine().device<i8255_device>("ppi8255_0")->write(space, offset & 3, data);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
machine().device<i8255_device>("ppi8255_1")->write(space, offset & 3, data);
|
||||
m_ppi[switch_val]->write(space, offset & 3, data);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
@ -191,7 +188,6 @@ WRITE8_MEMBER(lviv_state::lviv_io_w)
|
||||
void lviv_state::machine_reset()
|
||||
{
|
||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||
uint8_t *mem;
|
||||
|
||||
m_video_ram = m_ram->pointer() + 0xc000;
|
||||
|
||||
@ -202,11 +198,11 @@ void lviv_state::machine_reset()
|
||||
space.unmap_write(0x8000, 0xbfff);
|
||||
space.unmap_write(0xC000, 0xffff);
|
||||
|
||||
mem = memregion("maincpu")->base();
|
||||
membank("bank1")->set_base(mem + 0x010000);
|
||||
membank("bank2")->set_base(mem + 0x010000);
|
||||
membank("bank3")->set_base(mem + 0x010000);
|
||||
membank("bank4")->set_base(mem + 0x010000);
|
||||
uint8_t *mem = m_maincpu_region->base();
|
||||
m_bank[0]->set_base(mem + 0x010000);
|
||||
m_bank[1]->set_base(mem + 0x010000);
|
||||
m_bank[2]->set_base(mem + 0x010000);
|
||||
m_bank[3]->set_base(mem + 0x010000);
|
||||
|
||||
/*memset(m_ram->pointer(), 0, sizeof(unsigned char)*0xffff);*/
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user