(MESS) ut88.c: Tagmap cleanups (nw)

This commit is contained in:
Wilbert Pol 2013-01-27 12:11:19 +00:00
parent 80ef9e0e86
commit 882f0ee8e4
2 changed files with 62 additions and 27 deletions

View File

@ -19,11 +19,23 @@ class ut88_state : public driver_device
{
public:
ut88_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_cass(*this, CASSETTE_TAG),
m_ppi(*this, "ppi8255"),
m_dac(*this, "dac"),
m_p_videoram(*this, "p_videoram")
: driver_device(mconfig, type, tag)
, m_cass(*this, CASSETTE_TAG)
, m_ppi(*this, "ppi8255")
, m_dac(*this, "dac")
, m_p_videoram(*this, "p_videoram")
, m_region_maincpu(*this, "maincpu")
, m_region_proms(*this, "proms")
, m_bank1(*this, "bank1")
, m_io_line0(*this, "LINE0")
, m_io_line1(*this, "LINE1")
, m_io_line2(*this, "LINE2")
, m_io_line3(*this, "LINE3")
, m_io_line4(*this, "LINE4")
, m_io_line5(*this, "LINE5")
, m_io_line6(*this, "LINE6")
, m_io_line7(*this, "LINE7")
, m_io_line8(*this, "LINE8")
{ }
required_device<cassette_image_device> m_cass;
@ -50,6 +62,20 @@ public:
UINT32 screen_update_ut88(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(ut88_reset);
TIMER_CALLBACK_MEMBER(update_display);
protected:
required_memory_region m_region_maincpu;
optional_memory_region m_region_proms;
optional_memory_bank m_bank1;
required_ioport m_io_line0;
required_ioport m_io_line1;
required_ioport m_io_line2;
optional_ioport m_io_line3;
optional_ioport m_io_line4;
optional_ioport m_io_line5;
optional_ioport m_io_line6;
optional_ioport m_io_line7;
optional_ioport m_io_line8;
};

View File

@ -19,30 +19,39 @@
DRIVER_INIT_MEMBER(ut88_state,ut88)
{
/* set initially ROM to be visible on first bank */
UINT8 *RAM = memregion("maincpu")->base();
UINT8 *RAM = m_region_maincpu->base();
memset(RAM,0x0000,0x0800); // make first page empty by default
membank("bank1")->configure_entries(1, 2, RAM, 0x0000);
membank("bank1")->configure_entries(0, 2, RAM, 0xf800);
m_bank1->configure_entries(1, 2, RAM, 0x0000);
m_bank1->configure_entries(0, 2, RAM, 0xf800);
}
READ8_MEMBER( ut88_state::ut88_8255_portb_r )
{
UINT8 i, data = 0xff;
char kbdrow[12];
for (i = 0; i < 8; i++)
{
if (BIT(m_keyboard_mask, i))
{
sprintf(kbdrow,"LINE%d", i);
data &= ioport(kbdrow)->read();
}
}
UINT8 data = 0xff;
if ( m_keyboard_mask & 0x01 )
data &= m_io_line0->read();
if ( m_keyboard_mask & 0x02 )
data &= m_io_line1->read();
if ( m_keyboard_mask & 0x04 )
data &= m_io_line2->read();
if ( m_keyboard_mask & 0x08 )
data &= m_io_line3->read();
if ( m_keyboard_mask & 0x10 )
data &= m_io_line4->read();
if ( m_keyboard_mask & 0x20 )
data &= m_io_line5->read();
if ( m_keyboard_mask & 0x40 )
data &= m_io_line6->read();
if ( m_keyboard_mask & 0x80 )
data &= m_io_line7->read();
return data;
}
READ8_MEMBER( ut88_state::ut88_8255_portc_r )
{
return ioport("LINE8")->read();
return m_io_line8->read();
}
WRITE8_MEMBER( ut88_state::ut88_8255_porta_w )
@ -62,13 +71,13 @@ I8255A_INTERFACE( ut88_ppi8255_interface )
TIMER_CALLBACK_MEMBER(ut88_state::ut88_reset)
{
membank("bank1")->set_entry(0);
m_bank1->set_entry(0);
}
MACHINE_RESET_MEMBER(ut88_state,ut88)
{
machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(ut88_state::ut88_reset),this));
membank("bank1")->set_entry(1);
m_bank1->set_entry(1);
m_keyboard_mask = 0;
}
@ -100,25 +109,25 @@ READ8_MEMBER( ut88_state::ut88_tape_r )
READ8_MEMBER( ut88_state::ut88mini_keyboard_r )
{
// This is real keyboard implementation
UINT8 *keyrom1 = memregion("proms")->base();
UINT8 *keyrom2 = memregion("proms")->base()+100;
UINT8 *keyrom1 = m_region_proms->base();
UINT8 *keyrom2 = m_region_proms->base()+100;
UINT8 key = keyrom2[ioport("LINE1")->read()];
UINT8 key = keyrom2[m_io_line1->read()];
// if keyboard 2nd part returned 0 on 4th bit, output from
// first part is used
if (!BIT(key, 3))
key = keyrom1[ioport("LINE0")->read()];
key = keyrom1[m_io_line0->read()];
// for delete key there is special key producing code 0x80
key = (BIT(ioport("LINE2")->read(), 7)) ? key : 0x80;
key = (BIT(m_io_line2->read(), 7)) ? key : 0x80;
// If key 0 is pressed its value is 0x10 this is done by additional
// discrete logic
key = (BIT(ioport("LINE0")->read(), 0)) ? key : 0x10;
key = (BIT(m_io_line0->read(), 0)) ? key : 0x10;
return key;
}