From 43de61ccf726cf5fe5668b07bdad750260171403 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Sun, 27 Jan 2013 19:18:13 +0000 Subject: (MESS) Tagmap lookup cleanup. (nw) --- src/mess/drivers/c128.c | 41 ++++++++++++++--------------------------- src/mess/drivers/c64.c | 18 ++++++++---------- src/mess/drivers/pcw16.c | 2 +- src/mess/drivers/portfoli.c | 2 +- src/mess/drivers/sage2.c | 6 +++--- src/mess/includes/c128.h | 22 ++++++++-------------- 6 files changed, 35 insertions(+), 56 deletions(-) diff --git a/src/mess/drivers/c128.c b/src/mess/drivers/c128.c index 9c2bf5181eb..2caef85cff5 100644 --- a/src/mess/drivers/c128.c +++ b/src/mess/drivers/c128.c @@ -3,7 +3,6 @@ TODO: - connect CAPS LOCK to charom A12 on international variants - - remove frame interrupt handler - expansion DMA */ @@ -161,24 +160,24 @@ UINT8 c128_state::read_memory(address_space &space, offs_t offset, offs_t vma, i if (!rom1) { // CR: data = m_rom1[(ms3 << 14) | ((BIT(ta, 14) && BIT(offset, 13)) << 13) | (ta & 0x1000) | (offset & 0xfff)]; - data = m_rom1[((BIT(ta, 14) && BIT(offset, 13)) << 13) | (ta & 0x1000) | (offset & 0xfff)]; + data = m_rom->base()[((BIT(ta, 14) && BIT(offset, 13)) << 13) | (ta & 0x1000) | (offset & 0xfff)]; } if (!rom2) { - data = m_rom2[offset & 0x3fff]; + data = m_rom->base()[0x4000 | (offset & 0x3fff)]; } if (!rom3) { // CR: data = m_rom3[(BIT(offset, 15) << 14) | (offset & 0x3fff)]; - data = m_rom3[offset & 0x3fff]; + data = m_rom->base()[0x8000 | (offset & 0x3fff)]; } if (!rom4) { - data = m_rom4[(ta & 0x1000) | (offset & 0x2fff)]; + data = m_rom->base()[0xc000 | (ta & 0x1000) | (offset & 0x2fff)]; } if (!charom) { - data = m_charom[(ms3 << 12) | (ta & 0xf00) | sa]; + data = m_charom->base()[(ms3 << 12) | (ta & 0xf00) | sa]; } if (!colorram && aec) { @@ -190,7 +189,7 @@ UINT8 c128_state::read_memory(address_space &space, offs_t offset, offs_t vma, i } if (!from1) { - data = m_from[offset & 0x7fff]; + data = m_from->base()[offset & 0x7fff]; } if (!iocs && BIT(offset, 10)) { @@ -1066,17 +1065,15 @@ READ8_MEMBER( c128_state::cia1_pb_r ) // keyboard UINT8 cia1_pa = m_cia1->pa_r(); - UINT8 row[8] = { m_row0->read(), m_row1->read() & m_lock->read(), m_row2->read(), m_row3->read(), - m_row4->read(), m_row5->read(), m_row6->read(), m_row7->read() }; - if (!BIT(cia1_pa, 7)) data &= row[7]; - if (!BIT(cia1_pa, 6)) data &= row[6]; - if (!BIT(cia1_pa, 5)) data &= row[5]; - if (!BIT(cia1_pa, 4)) data &= row[4]; - if (!BIT(cia1_pa, 3)) data &= row[3]; - if (!BIT(cia1_pa, 2)) data &= row[2]; - if (!BIT(cia1_pa, 1)) data &= row[1]; - if (!BIT(cia1_pa, 0)) data &= row[0]; + if (!BIT(cia1_pa, 7)) data &= m_row7->read(); + if (!BIT(cia1_pa, 6)) data &= m_row6->read(); + if (!BIT(cia1_pa, 5)) data &= m_row5->read(); + if (!BIT(cia1_pa, 4)) data &= m_row4->read(); + if (!BIT(cia1_pa, 3)) data &= m_row3->read(); + if (!BIT(cia1_pa, 2)) data &= m_row2->read(); + if (!BIT(cia1_pa, 1)) data &= m_row1->read() & m_lock->read(); + if (!BIT(cia1_pa, 0)) data &= m_row0->read(); if (!BIT(m_vic_k, 0)) data &= m_k0->read(); if (!BIT(m_vic_k, 1)) data &= m_k1->read(); @@ -1433,16 +1430,6 @@ static C64_USER_PORT_INTERFACE( user_intf ) void c128_state::machine_start() { - cbm_common_init(); - - // find memory regions - m_rom1 = memregion(M8502_TAG)->base(); - m_rom2 = m_rom1 + 0x4000; - m_rom3 = m_rom1 + 0x8000; - m_rom4 = m_rom1 + 0xc000; - m_from = memregion("from")->base(); - m_charom = memregion("charom")->base(); - // allocate memory m_color_ram.allocate(0x800); diff --git a/src/mess/drivers/c64.c b/src/mess/drivers/c64.c index f056732c959..1c5d65bd0f7 100644 --- a/src/mess/drivers/c64.c +++ b/src/mess/drivers/c64.c @@ -644,17 +644,15 @@ READ8_MEMBER( c64_state::cia1_pb_r ) // keyboard UINT8 cia1_pa = m_cia1->pa_r(); - UINT8 row[8] = { m_row0->read(), m_row1->read() & m_lock->read(), m_row2->read(), m_row3->read(), - m_row4->read(), m_row5->read(), m_row6->read(), m_row7->read() }; - if (!BIT(cia1_pa, 7)) data &= row[7]; - if (!BIT(cia1_pa, 6)) data &= row[6]; - if (!BIT(cia1_pa, 5)) data &= row[5]; - if (!BIT(cia1_pa, 4)) data &= row[4]; - if (!BIT(cia1_pa, 3)) data &= row[3]; - if (!BIT(cia1_pa, 2)) data &= row[2]; - if (!BIT(cia1_pa, 1)) data &= row[1]; - if (!BIT(cia1_pa, 0)) data &= row[0]; + if (!BIT(cia1_pa, 7)) data &= m_row7->read(); + if (!BIT(cia1_pa, 6)) data &= m_row6->read(); + if (!BIT(cia1_pa, 5)) data &= m_row5->read(); + if (!BIT(cia1_pa, 4)) data &= m_row4->read(); + if (!BIT(cia1_pa, 3)) data &= m_row3->read(); + if (!BIT(cia1_pa, 2)) data &= m_row2->read(); + if (!BIT(cia1_pa, 1)) data &= m_row1->read() & m_lock->read(); + if (!BIT(cia1_pa, 0)) data &= m_row0->read(); return data; } diff --git a/src/mess/drivers/pcw16.c b/src/mess/drivers/pcw16.c index 60a044490f0..60441620df0 100644 --- a/src/mess/drivers/pcw16.c +++ b/src/mess/drivers/pcw16.c @@ -766,7 +766,7 @@ READ8_MEMBER(pcw16_state::pcw16_system_status_r) { // logerror("system status r: \n"); - return m_system_status | (ioport("EXTRA")->read() & 0x04); + return m_system_status | (m_io_extra->read() & 0x04); } READ8_MEMBER(pcw16_state::pcw16_timer_interrupt_counter_r) diff --git a/src/mess/drivers/portfoli.c b/src/mess/drivers/portfoli.c index 93a49109b66..9bd5785c70d 100644 --- a/src/mess/drivers/portfoli.c +++ b/src/mess/drivers/portfoli.c @@ -62,8 +62,8 @@ TODO: + - expansion port slot interface - clock is running too fast - - access violation after OFF command - create chargen ROM from tech manual - memory error interrupt vector - i/o port 8051 diff --git a/src/mess/drivers/sage2.c b/src/mess/drivers/sage2.c index e72204603e5..272288831b7 100644 --- a/src/mess/drivers/sage2.c +++ b/src/mess/drivers/sage2.c @@ -45,7 +45,7 @@ READ8_MEMBER( sage2_state::read ) { UINT8 data = 0xff; - if (m_reset || (offset >= 0xfe0000)) + if (m_reset || (offset >= 0xfe0000 && offset < 0xff4000)) { data = m_rom[offset & 0x1fff]; } @@ -248,8 +248,8 @@ WRITE8_MEMBER( sage2_state::ppi0_pc_w ) // drive select m_floppy = NULL; - if (BIT(data, 3)) m_floppy = m_floppy0->get_device(); - if (BIT(data, 4)) m_floppy = m_floppy1->get_device(); + if (!BIT(data, 3)) m_floppy = m_floppy0->get_device(); + if (!BIT(data, 4)) m_floppy = m_floppy1->get_device(); m_fdc->set_floppy(m_floppy); diff --git a/src/mess/includes/c128.h b/src/mess/includes/c128.h index 7da45e2675f..1220dc438eb 100644 --- a/src/mess/includes/c128.h +++ b/src/mess/includes/c128.h @@ -57,6 +57,10 @@ public: m_user(*this, C64_USER_PORT_TAG), m_ram(*this, RAM_TAG), m_cassette(*this, PET_DATASSETTE_PORT_TAG), + m_rom(*this, M8502_TAG), + m_from(*this, "from"), + m_charom(*this, "charom"), + m_color_ram(*this, "color_ram"), m_row0(*this, "ROW0"), m_row1(*this, "ROW1"), m_row2(*this, "ROW2"), @@ -78,13 +82,6 @@ public: m_charen(1), m_game(1), m_exrom(1), - m_rom1(NULL), - m_rom2(NULL), - m_rom3(NULL), - m_rom4(NULL), - m_from(NULL), - m_charom(NULL), - m_color_ram(*this, "color_ram"), m_va14(1), m_va15(1), m_clrbank(0), @@ -118,6 +115,10 @@ public: required_device m_user; required_device m_ram; required_device m_cassette; + required_memory_region m_rom; + required_memory_region m_from; + required_memory_region m_charom; + optional_shared_ptr m_color_ram; required_ioport m_row0; required_ioport m_row1; required_ioport m_row2; @@ -203,15 +204,8 @@ public: int m_game; int m_exrom; int m_reset; - const UINT8 *m_rom1; - const UINT8 *m_rom2; - const UINT8 *m_rom3; - const UINT8 *m_rom4; - const UINT8 *m_from; - const UINT8 *m_charom; // video state - optional_shared_ptr m_color_ram; int m_va14; int m_va15; int m_clrbank; -- cgit v1.2.3