(MESS) Osi tag cleanup (nw)

This commit is contained in:
Robbbert 2013-01-26 14:57:12 +00:00
parent 1f7561cc10
commit f82a46404c
3 changed files with 59 additions and 36 deletions

View File

@ -261,18 +261,27 @@ DISCRETE_SOUND_END
READ8_MEMBER( sb2m600_state::keyboard_r )
{
if (ioport("Reset")->read())
machine().device(M6502_TAG)->reset();
static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7" };
if (m_io_reset->read())
m_maincpu->reset();
UINT8 data = 0xff;
int bit;
for (bit = 0; bit < 8; bit++)
{
if (!BIT(m_keylatch, bit)) data &= ioport(keynames[bit])->read();
}
if (!BIT(m_keylatch, 0))
data &= m_io_row0->read();
if (!BIT(m_keylatch, 1))
data &= m_io_row1->read();
if (!BIT(m_keylatch, 2))
data &= m_io_row2->read();
if (!BIT(m_keylatch, 3))
data &= m_io_row3->read();
if (!BIT(m_keylatch, 4))
data &= m_io_row4->read();
if (!BIT(m_keylatch, 5))
data &= m_io_row5->read();
if (!BIT(m_keylatch, 6))
data &= m_io_row6->read();
if (!BIT(m_keylatch, 7))
data &= m_io_row7->read();
return data;
}
@ -281,7 +290,7 @@ WRITE8_MEMBER( sb2m600_state::keyboard_w )
{
m_keylatch = data;
if (ioport("Sound")->read())
if (m_io_sound->read())
discrete_sound_w(m_discrete, space, NODE_01, (data >> 2) & 0x0f);
}

View File

@ -30,24 +30,27 @@ class sb2m600_state : public driver_device
public:
sb2m600_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, M6502_TAG),
m_cassette(*this, CASSETTE_TAG),
m_discrete(*this, DISCRETE_TAG),
m_ram(*this, RAM_TAG),
m_video_ram(*this, "video_ram"),
m_color_ram(*this, "color_ram")
m_maincpu(*this, M6502_TAG),
m_cassette(*this, CASSETTE_TAG),
m_discrete(*this, DISCRETE_TAG),
m_ram(*this, RAM_TAG),
m_video_ram(*this, "video_ram"),
m_color_ram(*this, "color_ram"),
m_io_row0(*this, "ROW0"),
m_io_row1(*this, "ROW1"),
m_io_row2(*this, "ROW2"),
m_io_row3(*this, "ROW3"),
m_io_row4(*this, "ROW4"),
m_io_row5(*this, "ROW5"),
m_io_row6(*this, "ROW6"),
m_io_row7(*this, "ROW7"),
m_io_sound(*this, "Sound"),
m_io_reset(*this, "Reset")
{ }
required_device<cpu_device> m_maincpu;
required_device<cassette_image_device> m_cassette;
optional_device<discrete_sound_device> m_discrete;
required_device<ram_device> m_ram;
virtual void machine_start();
virtual void video_start();
UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER( keyboard_r );
DECLARE_WRITE8_MEMBER( keyboard_w );
DECLARE_WRITE8_MEMBER( ctrl_w );
@ -60,13 +63,29 @@ public:
/* video state */
int m_32;
int m_coloren;
required_shared_ptr<UINT8> m_video_ram;
optional_shared_ptr<UINT8> m_color_ram;
UINT8 *m_p_chargen;
/* floppy state */
int m_fdc_index;
TIMER_CALLBACK_MEMBER(setup_beep);
DECLARE_WRITE_LINE_MEMBER(osi470_index_callback);
required_device<cpu_device> m_maincpu;
required_device<cassette_image_device> m_cassette;
optional_device<discrete_sound_device> m_discrete;
required_device<ram_device> m_ram;
required_shared_ptr<UINT8> m_video_ram;
optional_shared_ptr<UINT8> m_color_ram;
required_ioport m_io_row0;
required_ioport m_io_row1;
required_ioport m_io_row2;
required_ioport m_io_row3;
required_ioport m_io_row4;
required_ioport m_io_row5;
required_ioport m_io_row6;
required_ioport m_io_row7;
required_ioport m_io_sound;
required_ioport m_io_reset;
};
class c1p_state : public sb2m600_state

View File

@ -23,22 +23,17 @@ static PALETTE_INIT( osi630 )
void sb2m600_state::video_start()
{
m_p_chargen = memregion("chargen")->base();
UINT16 addr;
/* randomize video memory contents */
for (addr = 0; addr < OSI600_VIDEORAM_SIZE; addr++)
{
m_video_ram[addr] = machine().rand() & 0xff;
}
/* randomize color memory contents */
if (m_color_ram)
{
for (addr = 0; addr < OSI630_COLORRAM_SIZE; addr++)
{
m_color_ram[addr] = machine().rand() & 0x0f;
}
}
}
/* Video Update */
@ -59,11 +54,11 @@ UINT32 sb2m600_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
{
UINT8 videoram_data = m_video_ram[videoram_addr];
UINT16 charrom_addr = ((videoram_data << 3) | line) & 0x7ff;
UINT8 charrom_data = memregion("chargen")->base()[charrom_addr];
UINT8 charrom_data = m_p_chargen[charrom_addr];
for (bit = 0; bit < 8; bit++)
{
int color = BIT(charrom_data, 7);
bool color = BIT(charrom_data, 7);
if (m_coloren)
{
@ -92,11 +87,11 @@ UINT32 sb2m600_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
{
UINT8 videoram_data = m_video_ram[videoram_addr];
UINT16 charrom_addr = ((videoram_data << 3) | line) & 0x7ff;
UINT8 charrom_data = memregion("chargen")->base()[charrom_addr];
UINT8 charrom_data = m_p_chargen[charrom_addr];
for (bit = 0; bit < 8; bit++)
{
int color = BIT(charrom_data, 7);
bool color = BIT(charrom_data, 7);
if (m_coloren)
{
@ -132,7 +127,7 @@ UINT32 uk101_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c
{
UINT8 videoram_data = m_video_ram[videoram_addr++];
UINT16 charrom_addr = ((videoram_data << 3) | line) & 0x7ff;
UINT8 charrom_data = memregion("chargen")->base()[charrom_addr];
UINT8 charrom_data = m_p_chargen[charrom_addr];
for (bit = 0; bit < 8; bit++)
{