From aba1bf84863a272c81641dd323167547ce1786fc Mon Sep 17 00:00:00 2001 From: Michael Zapf Date: Sat, 30 Jun 2018 23:51:41 +0200 Subject: ti99: Removed deprecated function calls, simplified GROM access, added logmacro. (nw) --- src/devices/bus/ti99/gromport/cartridges.cpp | 173 ++++++++++---------- src/devices/bus/ti99/gromport/cartridges.h | 13 +- src/devices/bus/ti99/gromport/gkracker.cpp | 41 ++--- src/devices/bus/ti99/gromport/gkracker.h | 3 +- src/devices/bus/ti99/gromport/gromport.cpp | 15 +- src/devices/bus/ti99/gromport/gromport.h | 4 +- src/devices/bus/ti99/gromport/multiconn.cpp | 23 +-- src/devices/bus/ti99/gromport/multiconn.h | 2 +- src/devices/bus/ti99/gromport/singleconn.cpp | 4 +- src/devices/bus/ti99/gromport/singleconn.h | 2 +- src/devices/bus/ti99/internal/998board.cpp | 226 +++++++++++++++++---------- src/devices/bus/ti99/internal/998board.h | 31 +++- src/devices/bus/ti99/internal/datamux.cpp | 56 ++++--- src/devices/bus/ti99/internal/datamux.h | 3 + src/devices/bus/ti99/peb/evpc.cpp | 4 +- src/devices/bus/ti99/peb/evpc.h | 2 +- src/devices/bus/ti99/peb/pcode.cpp | 13 +- src/devices/bus/ti99/peb/peribox.cpp | 12 +- src/devices/machine/tmc0430.cpp | 20 +-- src/devices/machine/tmc0430.h | 13 +- 20 files changed, 380 insertions(+), 280 deletions(-) diff --git a/src/devices/bus/ti99/gromport/cartridges.cpp b/src/devices/bus/ti99/gromport/cartridges.cpp index 23303650f8f..3f7e0b88b10 100644 --- a/src/devices/bus/ti99/gromport/cartridges.cpp +++ b/src/devices/bus/ti99/gromport/cartridges.cpp @@ -15,20 +15,23 @@ #include "emu.h" #include "cartridges.h" +#define LOG_WARN (1U<<1) // Warnings +#define LOG_CONFIG (1U<<2) // Configuration +#define LOG_CHANGE (1U<<3) // Cart change +#define LOG_BANKSWITCH (1U<<4) // Bank switch operation +#define LOG_CRU (1U<<5) // CRU access +#define LOG_READ (1U<<6) // Read operation +#define LOG_WRITE (1U<<7) // Write operation +#define LOG_GROM (1U<<8) // GROM access +#define LOG_RPK (1U<<9) // RPK handler + +#define VERBOSE ( LOG_WARN ) +#include "logmacro.h" + DEFINE_DEVICE_TYPE_NS(TI99_CART, bus::ti99::gromport, ti99_cartridge_device, "ti99cart", "TI-99 cartridge") namespace bus { namespace ti99 { namespace gromport { -#define TRACE_CONFIG 0 -#define TRACE_CHANGE 0 -#define TRACE_ILLWRITE 1 -#define TRACE_BANKSWITCH 0 -#define TRACE_CRU 0 -#define TRACE_READ 0 -#define TRACE_WRITE 0 -#define TRACE_RPK 0 -#define TRACE_GROM 0 - #define CARTGROM_TAG "grom_contents" #define CARTROM_TAG "rom_contents" #define GROM3_TAG "grom3" @@ -114,7 +117,7 @@ void ti99_cartridge_device::prepare_cartridge() for (int i=0; i < 5; i++) m_pcb->m_grom[i] = nullptr; m_pcb->m_grom_size = loaded_through_softlist() ? get_software_region_length("grom") : m_rpk->get_resource_length("grom_socket"); - if (TRACE_CONFIG) logerror("grom_socket.size=0x%04x\n", m_pcb->m_grom_size); + LOGMASKED(LOG_CONFIG, "grom_socket.size=0x%04x\n", m_pcb->m_grom_size); if (m_pcb->m_grom_size > 0) { @@ -135,7 +138,7 @@ void ti99_cartridge_device::prepare_cartridge() m_pcb->m_rom_size = loaded_through_softlist() ? get_software_region_length("rom") : m_rpk->get_resource_length("rom_socket"); if (m_pcb->m_rom_size > 0) { - if (TRACE_CONFIG) logerror("rom size=0x%04x\n", m_pcb->m_rom_size); + LOGMASKED(LOG_CONFIG, "rom size=0x%04x\n", m_pcb->m_rom_size); regr = memregion(CARTROM_TAG); rom_ptr = loaded_through_softlist() ? get_software_region("rom") : m_rpk->get_contents_of_socket("rom_socket"); memcpy(regr->base(), rom_ptr, m_pcb->m_rom_size); @@ -210,11 +213,11 @@ image_init_result ti99_cartridge_device::call_load() { // File name is in m_basename // return true = error - if (TRACE_CHANGE) logerror("Loading %s in slot %s\n", basename()); + LOGMASKED(LOG_CHANGE, "Loading %s in slot %s\n", basename()); if (loaded_through_softlist()) { - if (TRACE_CONFIG) logerror("Using softlists\n"); + LOGMASKED(LOG_CONFIG, "Using softlists\n"); int i = 0; const char* pcb = get_feature("pcb"); do @@ -226,7 +229,7 @@ image_init_result ti99_cartridge_device::call_load() } i++; } while (sw_pcbdefs[i].id != 0); - if (TRACE_CONFIG) logerror("Cartridge type is %s (%d)\n", pcb, m_pcbtype); + LOGMASKED(LOG_CONFIG, "Cartridge type is %s (%d)\n", pcb, m_pcbtype); m_rpk = nullptr; } else @@ -249,51 +252,51 @@ image_init_result ti99_cartridge_device::call_load() switch (m_pcbtype) { case PCB_STANDARD: - if (TRACE_CONFIG) logerror("Standard PCB\n"); + LOGMASKED(LOG_CONFIG, "Standard PCB\n"); m_pcb = std::make_unique(); break; case PCB_PAGED12K: - if (TRACE_CONFIG) logerror("Paged PCB 12K\n"); + LOGMASKED(LOG_CONFIG, "Paged PCB 12K\n"); m_pcb = std::make_unique(); break; case PCB_PAGED16K: - if (TRACE_CONFIG) logerror("Paged PCB 16K\n"); + LOGMASKED(LOG_CONFIG, "Paged PCB 16K\n"); m_pcb = std::make_unique(); break; case PCB_PAGED7: - if (TRACE_CONFIG) logerror("Paged PCB 7000\n"); + LOGMASKED(LOG_CONFIG, "Paged PCB 7000\n"); m_pcb = std::make_unique(); break; case PCB_MINIMEM: - if (TRACE_CONFIG) logerror("Minimem PCB\n"); + LOGMASKED(LOG_CONFIG, "Minimem PCB\n"); m_pcb = std::make_unique(); break; case PCB_SUPER: - if (TRACE_CONFIG) logerror("Superspace PCB\n"); + LOGMASKED(LOG_CONFIG, "Superspace PCB\n"); m_pcb = std::make_unique(); break; case PCB_MBX: - if (TRACE_CONFIG) logerror("MBX PCB\n"); + LOGMASKED(LOG_CONFIG, "MBX PCB\n"); m_pcb = std::make_unique(); break; case PCB_PAGED379I: - if (TRACE_CONFIG) logerror("Paged379i PCB\n"); + LOGMASKED(LOG_CONFIG, "Paged379i PCB\n"); m_pcb = std::make_unique(); break; case PCB_PAGED378: - if (TRACE_CONFIG) logerror("Paged378 PCB\n"); + LOGMASKED(LOG_CONFIG, "Paged378 PCB\n"); m_pcb = std::make_unique(); break; case PCB_PAGED377: - if (TRACE_CONFIG) logerror("Paged377 PCB\n"); + LOGMASKED(LOG_CONFIG, "Paged377 PCB\n"); m_pcb = std::make_unique(); break; case PCB_PAGEDCRU: - if (TRACE_CONFIG) logerror("PagedCRU PCB\n"); + LOGMASKED(LOG_CONFIG, "PagedCRU PCB\n"); m_pcb = std::make_unique(); break; case PCB_GROMEMU: - if (TRACE_CONFIG) logerror("Grom Emulation PCB\n"); + LOGMASKED(LOG_CONFIG, "Grom Emulation PCB\n"); m_pcb = std::make_unique(); break; } @@ -308,7 +311,7 @@ image_init_result ti99_cartridge_device::call_load() void ti99_cartridge_device::call_unload() { - if (TRACE_CHANGE) logerror("Unload\n"); + LOGMASKED(LOG_CHANGE, "Unload\n"); if (m_rpk != nullptr) { m_rpk->close(); // will write NVRAM contents @@ -373,9 +376,9 @@ WRITE_LINE_MEMBER( ti99_cartridge_device::romgq_line ) /* Combined select lines */ -WRITE8_MEMBER(ti99_cartridge_device::set_gromlines) +void ti99_cartridge_device::set_gromlines(line_state mline, line_state moline, line_state gsq) { - if (m_pcb != nullptr) m_pcb->set_gromlines(space, offset, data); + if (m_pcb != nullptr) m_pcb->set_gromlines(mline, moline, gsq); } WRITE_LINE_MEMBER(ti99_cartridge_device::gclock_in) @@ -462,24 +465,24 @@ void ti99_cartridge_pcb::set_cartridge(ti99_cartridge_device *cart) m_cart = cart; } -READ8Z_MEMBER(ti99_cartridge_pcb::gromreadz) +void ti99_cartridge_pcb::gromreadz(uint8_t* value) { for (auto & elem : m_grom) { if (elem != nullptr) { - elem->readz(space, offset, value, mem_mask); + elem->readz(value); } } } -WRITE8_MEMBER(ti99_cartridge_pcb::gromwrite) +void ti99_cartridge_pcb::gromwrite(uint8_t data) { for (auto & elem : m_grom) { if (elem != nullptr) { - elem->write(space, offset, data, mem_mask); + elem->write(data); } } } @@ -501,7 +504,7 @@ READ8Z_MEMBER(ti99_cartridge_pcb::readz) else { // Will not return anything when not selected (preceding gsq=ASSERT) - gromreadz(space, offset, value, mem_mask); + gromreadz(value); } } @@ -509,12 +512,12 @@ WRITE8_MEMBER(ti99_cartridge_pcb::write) { if (m_romspace_selected) { - if (TRACE_ILLWRITE) m_cart->logerror("Cannot write to ROM space at %04x\n", offset); + LOGMASKED(LOG_WARN, "Cannot write to ROM space at %04x\n", offset); } else { // Will not change anything when not selected (preceding gsq=ASSERT) - gromwrite(space, offset, data, mem_mask); + gromwrite(data); } } @@ -542,14 +545,14 @@ WRITE_LINE_MEMBER( ti99_cartridge_pcb::romgq_line ) /* Combined select lines */ -WRITE8_MEMBER(ti99_cartridge_pcb::set_gromlines) +void ti99_cartridge_pcb::set_gromlines(line_state mline, line_state moline, line_state gsq) { for (auto& elem : m_grom) { if (elem != nullptr) { - elem->set_lines(space, offset, data); - if (data==ASSERT_LINE) m_grom_idle = false; + elem->set_lines(mline, moline, gsq); + if (gsq==ASSERT_LINE) m_grom_idle = false; } } } @@ -606,7 +609,7 @@ READ8Z_MEMBER(ti99_paged12k_cartridge::readz) else { // Will not return anything when not selected (preceding gsq=ASSERT) - gromreadz(space, offset, value, mem_mask); + gromreadz(value); } } @@ -615,12 +618,13 @@ WRITE8_MEMBER(ti99_paged12k_cartridge::write) if (m_romspace_selected) { m_rom_page = (offset >> 1) & 1; - if (TRACE_BANKSWITCH) if ((offset & 1)==0) m_cart->logerror("Set ROM page = %d (writing to %04x)\n", m_rom_page, (offset | 0x6000)); + if ((offset & 1)==0) + LOGMASKED(LOG_WARN, "Set ROM page = %d (writing to %04x)\n", m_rom_page, (offset | 0x6000)); } else { // Will not change anything when not selected (preceding gsq=ASSERT) - gromwrite(space, offset, data, mem_mask); + gromwrite(data); } } @@ -654,7 +658,7 @@ READ8Z_MEMBER(ti99_paged16k_cartridge::readz) else { // Will not return anything when not selected (preceding gsq=ASSERT) - gromreadz(space, offset, value, mem_mask); + gromreadz(value); } } @@ -663,12 +667,13 @@ WRITE8_MEMBER(ti99_paged16k_cartridge::write) if (m_romspace_selected) { m_rom_page = (offset >> 1) & 1; - if (TRACE_BANKSWITCH) if ((offset & 1)==0) m_cart->logerror("Set ROM page = %d (writing to %04x)\n", m_rom_page, (offset | 0x6000)); + if ((offset & 1)==0) + LOGMASKED(LOG_BANKSWITCH, "Set ROM page = %d (writing to %04x)\n", m_rom_page, (offset | 0x6000)); } else { // Will not change anything when not selected (preceding gsq=ASSERT) - gromwrite(space, offset, data, mem_mask); + gromwrite(data); } } @@ -709,7 +714,7 @@ READ8Z_MEMBER(ti99_minimem_cartridge::readz) } else { - gromreadz(space, offset, value, mem_mask); + gromreadz(value); } } @@ -720,7 +725,7 @@ WRITE8_MEMBER(ti99_minimem_cartridge::write) { if ((offset & 0x1000)==0x0000) { - if (TRACE_ILLWRITE) m_cart->logerror("Write access to cartridge ROM at address %04x ignored", offset); + LOGMASKED(LOG_WARN, "Write access to cartridge ROM at address %04x ignored", offset); } else { @@ -729,7 +734,7 @@ WRITE8_MEMBER(ti99_minimem_cartridge::write) } else { - gromwrite(space, offset, data, mem_mask); + gromwrite(data); } } @@ -777,7 +782,7 @@ READ8Z_MEMBER(ti99_super_cartridge::readz) } else { - gromreadz(space, offset, value, mem_mask); + gromreadz(value); } } @@ -790,7 +795,7 @@ WRITE8_MEMBER(ti99_super_cartridge::write) } else { - gromwrite(space, offset, data, mem_mask); + gromwrite(data); } } @@ -826,7 +831,7 @@ READ8Z_MEMBER(ti99_super_cartridge::crureadz) if ((offset & 0xfff0) == 0x0800) { - if (TRACE_CRU) m_cart->logerror("CRU accessed at %04x\n", offset); + LOGMASKED(LOG_CRU, "CRU accessed at %04x\n", offset); uint8_t val = 0x02 << (m_ram_page << 1); *value = (val >> ((offset - 0x0800)>>1)) & 0xff; } @@ -836,11 +841,12 @@ WRITE8_MEMBER(ti99_super_cartridge::cruwrite) { if ((offset & 0xfff0) == 0x0800) { - if (TRACE_CRU) m_cart->logerror("CRU accessed at %04x\n", offset); + LOGMASKED(LOG_CRU, "CRU accessed at %04x\n", offset); if (data != 0) { m_ram_page = (offset-0x0802)>>2; - if (TRACE_BANKSWITCH) if ((offset & 1)==0) m_cart->logerror("Set RAM page = %d (CRU address %04x)\n", m_ram_page, offset); + if ((offset & 1)==0) + LOGMASKED(LOG_BANKSWITCH, "Set RAM page = %d (CRU address %04x)\n", m_ram_page, offset); } } } @@ -894,7 +900,7 @@ READ8Z_MEMBER(ti99_mbx_cartridge::readz) { // Also reads the value of 6ffe *value = m_ram_ptr[offset & 0x03ff]; - if (TRACE_READ) m_cart->logerror("%04x (RAM) -> %02x\n", offset + 0x6000, *value); + LOGMASKED(LOG_READ, "%04x (RAM) -> %02x\n", offset + 0x6000, *value); } else { @@ -905,13 +911,13 @@ READ8Z_MEMBER(ti99_mbx_cartridge::readz) else // 7000 area *value = m_rom_ptr[(offset & 0x0fff) | (m_rom_page << 12)]; - if (TRACE_READ) m_cart->logerror("%04x(%04x) -> %02x\n", offset + 0x6000, offset | (m_rom_page<<13), *value); + LOGMASKED(LOG_READ, "%04x(%04x) -> %02x\n", offset + 0x6000, offset | (m_rom_page<<13), *value); } } } else { - gromreadz(space, offset, value, mem_mask); + gromreadz(value); } } @@ -926,18 +932,19 @@ WRITE8_MEMBER(ti99_mbx_cartridge::write) { // Valid values are 0, 1, 2, 3 m_rom_page = data & 3; - if (TRACE_BANKSWITCH) if ((offset & 1)==0) m_cart->logerror("Set ROM page = %d (writing to %04x)\n", m_rom_page, (offset | 0x6000)); + if ((offset & 1)==0) + LOGMASKED(LOG_BANKSWITCH, "Set ROM page = %d (writing to %04x)\n", m_rom_page, (offset | 0x6000)); } if (m_ram_ptr != nullptr) m_ram_ptr[offset & 0x03ff] = data; else - if (TRACE_ILLWRITE) m_cart->logerror("Write access to %04x but no RAM present\n", offset+0x6000); + LOGMASKED(LOG_WARN, "Write access to %04x but no RAM present\n", offset+0x6000); } } else { - gromwrite(space, offset, data, mem_mask); + gromwrite(data); } } @@ -981,12 +988,12 @@ READ8Z_MEMBER(ti99_paged7_cartridge::readz) else // 7000 area *value = m_rom_ptr[(offset & 0x0fff) | (m_rom_page << 12)]; - if (TRACE_READ) m_cart->logerror("%04x(%04x) -> %02x\n", offset + 0x6000, offset | (m_rom_page<<13), *value); + LOGMASKED(LOG_READ, "%04x(%04x) -> %02x\n", offset + 0x6000, offset | (m_rom_page<<13), *value); } } else { - gromreadz(space, offset, value, mem_mask); + gromreadz(value); } } @@ -1000,12 +1007,13 @@ WRITE8_MEMBER(ti99_paged7_cartridge::write) { // Valid values are 0, 1, 2, 3 m_rom_page = (offset>>1) & 3; - if (TRACE_BANKSWITCH) if ((offset & 1)==0) m_cart->logerror("Set ROM page = %d (writing to %04x)\n", m_rom_page, (offset | 0x6000)); + if ((offset & 1)==0) + LOGMASKED(LOG_BANKSWITCH, "Set ROM page = %d (writing to %04x)\n", m_rom_page, (offset | 0x6000)); } } else { - gromwrite(space, offset, data, mem_mask); + gromwrite(data); } } @@ -1078,7 +1086,8 @@ WRITE8_MEMBER(ti99_paged379i_cartridge::write) // The page is determined by the inverted outputs. m_rom_page = (~offset)>>1 & mask; - if (TRACE_BANKSWITCH) if ((offset & 1)==0) m_cart->logerror("Set ROM page = %d (writing to %04x)\n", m_rom_page, (offset | 0x6000)); + if ((offset & 1)==0) + LOGMASKED(LOG_BANKSWITCH, "Set ROM page = %d (writing to %04x)\n", m_rom_page, (offset | 0x6000)); } } @@ -1119,7 +1128,8 @@ WRITE8_MEMBER(ti99_paged378_cartridge::write) if (m_romspace_selected) { m_rom_page = ((offset >> 1)&0x003f); - if (TRACE_BANKSWITCH) if ((offset & 1)==0) m_cart->logerror("Set ROM page = %d (writing to %04x)\n", m_rom_page, (offset | 0x6000)); + if ((offset & 1)==0) + LOGMASKED(LOG_BANKSWITCH, "Set ROM page = %d (writing to %04x)\n", m_rom_page, (offset | 0x6000)); } } @@ -1158,7 +1168,8 @@ WRITE8_MEMBER(ti99_paged377_cartridge::write) if (m_romspace_selected) { m_rom_page = ((offset >> 1)&0x00ff); - if (TRACE_BANKSWITCH) if ((offset & 1)==0) m_cart->logerror("Set ROM page = %d (writing to %04x)\n", m_rom_page, (offset | 0x6000)); + if ((offset & 1)==0) + LOGMASKED(LOG_BANKSWITCH, "Set ROM page = %d (writing to %04x)\n", m_rom_page, (offset | 0x6000)); } } @@ -1231,7 +1242,7 @@ WRITE8_MEMBER(ti99_pagedcru_cartridge::cruwrite) if (data != 0 && bit > 0) { m_rom_page = (bit-1)/2; - if (TRACE_BANKSWITCH) m_cart->logerror("Set ROM page = %d (CRU address %d)\n", m_rom_page, offset); + LOGMASKED(LOG_BANKSWITCH, "Set ROM page = %d (CRU address %d)\n", m_rom_page, offset); } } } @@ -1281,13 +1292,13 @@ WRITE8_MEMBER(ti99_pagedcru_cartridge::cruwrite) ******************************************************************************/ -WRITE8_MEMBER(ti99_gromemu_cartridge::set_gromlines) +void ti99_gromemu_cartridge::set_gromlines(line_state mline, line_state moline, line_state gsq) { if (m_grom_ptr != nullptr) { - m_grom_selected = (data != CLEAR_LINE); - m_grom_read_mode = ((offset & GROM_M_LINE)!=0); - m_grom_address_mode = ((offset & GROM_MO_LINE)!=0); + m_grom_selected = (gsq == ASSERT_LINE); + m_grom_read_mode = (mline == ASSERT_LINE); + m_grom_address_mode = (moline == ASSERT_LINE); } } @@ -1328,7 +1339,8 @@ WRITE8_MEMBER(ti99_gromemu_cartridge::write) return; // no paging } m_rom_page = (offset >> 1) & 1; - if (TRACE_BANKSWITCH) if ((offset & 1)==0) m_cart->logerror("Set ROM page = %d (writing to %04x)\n", m_rom_page, (offset | 0x6000)); + if ((offset & 1)==0) + LOGMASKED(LOG_BANKSWITCH, "Set ROM page = %d (writing to %04x)\n", m_rom_page, (offset | 0x6000)); } else { @@ -1380,7 +1392,7 @@ WRITE8_MEMBER(ti99_gromemu_cartridge::gromemuwrite) } else { - if (TRACE_ILLWRITE) m_cart->logerror("Ignoring write to GROM area at address %04x\n", m_grom_address); + LOGMASKED(LOG_WARN, "Ignoring write to GROM area at address %04x\n", m_grom_address); } } @@ -1432,6 +1444,9 @@ DTD: ****************************************************************************/ +#undef LOG_OUTPUT_FUNC +#define LOG_OUTPUT_FUNC printf + /**************************************** RPK class ****************************************/ @@ -1447,7 +1462,7 @@ ti99_cartridge_device::rpk::rpk(emu_options& options, const char* sysname) ti99_cartridge_device::rpk::~rpk() { - if (TRACE_RPK) printf("gromport/RPK: Destroy RPK\n"); + LOGMASKED(LOG_RPK, "[RPK handler] Destroy RPK\n"); } /* @@ -1563,7 +1578,7 @@ std::unique_ptr ti99_cartridge_device::rpk_re file = rom_resource_node->get_attribute_string("file", nullptr); if (file == nullptr) throw rpk_exception(RPK_INVALID_LAYOUT, " must have a 'file' attribute"); - if (TRACE_RPK) printf("gromport/RPK: Loading ROM contents for socket '%s' from file %s\n", socketname, file); + LOGMASKED(LOG_RPK, "[RPK handler] Loading ROM contents for socket '%s' from file %s\n", socketname, file); // check for crc crcstr = rom_resource_node->get_attribute_string("crc", nullptr); @@ -1651,7 +1666,7 @@ std::unique_ptr ti99_cartridge_device::rpk_re contents = global_alloc_array_clear(length); if (contents==nullptr) throw rpk_exception(RPK_OUT_OF_MEMORY); - if (TRACE_RPK) printf("gromport/RPK: Allocating RAM buffer (%d bytes) for socket '%s'\n", length, socketname); + LOGMASKED(LOG_RPK, "[RPK handler] Allocating RAM buffer (%d bytes) for socket '%s'\n", length, socketname); // That's it for pure RAM. Now check whether the RAM is "persistent", i.e. NVRAM. // In that case we must load it from the NVRAM directory. @@ -1670,7 +1685,7 @@ std::unique_ptr ti99_cartridge_device::rpk_re } ram_pname = std::string(system_name).append(PATH_SEPARATOR).append(ram_filename); // load, and fill rest with 00 - if (TRACE_RPK) printf("gromport/RPK: Loading NVRAM contents from '%s'\n", ram_pname.c_str()); + LOGMASKED(LOG_RPK, "[RPK handler] Loading NVRAM contents from '%s'\n", ram_pname.c_str()); // Load the NVRAM contents int bytes_read = 0; @@ -1756,7 +1771,7 @@ ti99_cartridge_device::rpk* ti99_cartridge_device::rpk_reader::open(emu_options // We'll try to find the PCB type on the provided type list. char const *const pcb_type = pcb_node->get_attribute_string("type", nullptr); if (!pcb_type) throw rpk_exception(RPK_INVALID_LAYOUT, " must have a 'type' attribute"); - if (TRACE_RPK) printf("gromport/RPK: Cartridge says it has PCB type '%s'\n", pcb_type); + LOGMASKED(LOG_RPK, "[RPK handler] Cartridge says it has PCB type '%s'\n", pcb_type); i=0; do diff --git a/src/devices/bus/ti99/gromport/cartridges.h b/src/devices/bus/ti99/gromport/cartridges.h index f2e799591f2..b969e65eccf 100644 --- a/src/devices/bus/ti99/gromport/cartridges.h +++ b/src/devices/bus/ti99/gromport/cartridges.h @@ -72,7 +72,8 @@ public: DECLARE_WRITE_LINE_MEMBER(ready_line); DECLARE_WRITE_LINE_MEMBER(romgq_line); - DECLARE_WRITE8_MEMBER(set_gromlines); + + void set_gromlines(line_state mline, line_state moline, line_state gsq); DECLARE_WRITE_LINE_MEMBER(gclock_in); @@ -217,16 +218,18 @@ protected: virtual DECLARE_WRITE8_MEMBER(cruwrite); DECLARE_WRITE_LINE_MEMBER(romgq_line); - virtual DECLARE_WRITE8_MEMBER(set_gromlines); + virtual void set_gromlines(line_state mline, line_state moline, line_state gsq); DECLARE_WRITE_LINE_MEMBER(gclock_in); - DECLARE_READ8Z_MEMBER(gromreadz); - DECLARE_WRITE8_MEMBER(gromwrite); + void gromreadz(uint8_t* value); + void gromwrite(uint8_t data); + inline void set_grom_pointer(int number, device_t *dev); void set_cartridge(ti99_cartridge_device *cart); const char* tag() { return m_tag; } void set_tag(const char* tag) { m_tag = tag; } bool is_grom_idle() { return m_grom_idle; } + template void logerror(Format &&fmt, Params &&... args) const { m_cart->logerror(fmt, args...); } ti99_cartridge_device* m_cart; tmc0430_device* m_grom[5]; @@ -361,7 +364,7 @@ public: DECLARE_WRITE8_MEMBER(write) override; DECLARE_READ8Z_MEMBER(gromemureadz); DECLARE_WRITE8_MEMBER(gromemuwrite); - DECLARE_WRITE8_MEMBER(set_gromlines) override; + void set_gromlines(line_state mline, line_state moline, line_state gsq) override; private: bool m_waddr_LSB; diff --git a/src/devices/bus/ti99/gromport/gkracker.cpp b/src/devices/bus/ti99/gromport/gkracker.cpp index 6cacbb0e2c7..cd4a99d5000 100644 --- a/src/devices/bus/ti99/gromport/gkracker.cpp +++ b/src/devices/bus/ti99/gromport/gkracker.cpp @@ -97,6 +97,13 @@ #include "emu.h" #include "gkracker.h" +#define LOG_WARN (1U<<1) // Warnings +#define LOG_CHANGE (1U<<2) // Cartridge change +#define LOG_GKRACKER (1U<<3) // Gram Kracker operation + +#define VERBOSE ( LOG_WARN ) +#include "logmacro.h" + DEFINE_DEVICE_TYPE_NS(TI99_GROMPORT_GK, bus::ti99::gromport, ti99_gkracker_device, "ti99_gkracker", "Miller's Graphics GRAM Kracker") namespace bus { namespace ti99 { namespace gromport { @@ -122,8 +129,6 @@ enum #define GKSWITCH4_TAG "GKSWITCH4" #define GKSWITCH5_TAG "GKSWITCH5" -#define TRACE_GKRACKER 0 -#define TRACE_CHANGE 0 #define GKRACKER_NVRAM_TAG "gkracker_nvram" #define GKRACKER_ROM_TAG "gkracker_rom" @@ -150,10 +155,10 @@ WRITE_LINE_MEMBER(ti99_gkracker_device::romgq_line) /* Combined select lines */ -WRITE8_MEMBER(ti99_gkracker_device::set_gromlines) +void ti99_gkracker_device::set_gromlines(line_state mline, line_state moline, line_state gsq) { - m_grom_selected = (data != 0); - if (m_cartridge != nullptr) m_cartridge->set_gromlines(space, offset, data); + m_grom_selected = (gsq==ASSERT_LINE); + if (m_cartridge != nullptr) m_cartridge->set_gromlines(mline, moline, gsq); } WRITE_LINE_MEMBER(ti99_gkracker_device::gclock_in) @@ -196,7 +201,7 @@ READ8Z_MEMBER(ti99_gkracker_device::readz) // Reset the write address flipflop. m_waddr_LSB = false; - if (TRACE_GKRACKER) logerror("GROM read -> %02x\n", *value); + LOGMASKED(LOG_GKRACKER, "GROM read -> %02x\n", *value); } } @@ -211,7 +216,7 @@ READ8Z_MEMBER(ti99_gkracker_device::readz) { int base = ((m_gk_switch[4]==GK_BANK1) || ((m_gk_switch[4]==GK_WP) && (m_ram_page==0)))? 0x10000 : 0x12000; *value = m_ram_ptr[offset | base]; - if (TRACE_GKRACKER) logerror("Read %04x -> %02x\n", offset | 0x6000, *value); + LOGMASKED(LOG_GKRACKER, "Read %04x -> %02x\n", offset | 0x6000, *value); } } @@ -223,8 +228,8 @@ READ8Z_MEMBER(ti99_gkracker_device::readz) // Read from the guest cartridge. m_cartridge->readz(space, offset, value, mem_mask); - if (TRACE_GKRACKER) - if (val1 != *value) logerror("Read (from guest) %04x -> %02x\n", offset, *value); + if (val1 != *value) + LOGMASKED(LOG_GKRACKER, "Read (from guest) %04x -> %02x\n", offset, *value); } } @@ -247,7 +252,7 @@ WRITE8_MEMBER(ti99_gkracker_device::write) // Accept low address byte (second write) m_grom_address = (m_grom_address & 0xff00) | data; m_waddr_LSB = false; - if (TRACE_GKRACKER) logerror("Set GROM address %04x\n", m_grom_address); + LOGMASKED(LOG_GKRACKER, "Set GROM address %04x\n", m_grom_address); } else { @@ -259,7 +264,7 @@ WRITE8_MEMBER(ti99_gkracker_device::write) else { // Write data byte to GRAM area. - if (TRACE_GKRACKER) logerror("GROM write %04x(%04x) <- %02x\n", offset, m_grom_address, data); + LOGMASKED(LOG_GKRACKER, "GROM write %04x(%04x) <- %02x\n", offset, m_grom_address, data); // According to manual: // Writing to GRAM 0: switch 2 set to GRAM 0 + Write protect switch (4) in 1 or 2 position @@ -287,7 +292,7 @@ WRITE8_MEMBER(ti99_gkracker_device::write) if (m_romspace_selected) { // Write to the RAM space of the GRAM Kracker - if (TRACE_GKRACKER) logerror("Write %04x <- %02x\n", offset | 0x6000, data); + LOGMASKED(LOG_GKRACKER, "Write %04x <- %02x\n", offset | 0x6000, data); if (m_gk_switch[1] == GK_NORMAL) { @@ -312,13 +317,13 @@ WRITE8_MEMBER( ti99_gkracker_device::cruwrite ) INPUT_CHANGED_MEMBER( ti99_gkracker_device::gk_changed ) { - if (TRACE_GKRACKER) logerror("Input changed %d - %d\n", (int)((uint64_t)param & 0x07), newval); + LOGMASKED(LOG_GKRACKER, "Input changed %d - %d\n", (int)((uint64_t)param & 0x07), newval); m_gk_switch[(uint64_t)param & 0x07] = newval; } void ti99_gkracker_device::insert(int index, ti99_cartridge_device* cart) { - if (TRACE_CHANGE) logerror("Insert cartridge\n"); + LOGMASKED(LOG_CHANGE, "Insert cartridge\n"); m_cartridge = cart; // Switch 1 has a third location for resetting. We do the reset by default // here. It can be turned off in the configuration. @@ -327,7 +332,7 @@ void ti99_gkracker_device::insert(int index, ti99_cartridge_device* cart) void ti99_gkracker_device::remove(int index) { - if (TRACE_CHANGE) logerror("Remove cartridge\n"); + LOGMASKED(LOG_CHANGE, "Remove cartridge\n"); m_cartridge = nullptr; } @@ -350,7 +355,7 @@ void ti99_gkracker_device::gk_install_menu(const char* menutext, int len, int pt */ void ti99_gkracker_device::nvram_default() { - if (TRACE_GKRACKER) logerror("Creating default NVRAM\n"); + LOGMASKED(LOG_GKRACKER, "Creating default NVRAM\n"); memset(m_ram_ptr, 0, 81920); m_ram_ptr[0x6000] = 0xaa; @@ -374,7 +379,7 @@ void ti99_gkracker_device::nvram_default() void ti99_gkracker_device::nvram_read(emu_file &file) { int readsize = file.read(m_ram_ptr, 81920); - if (TRACE_GKRACKER) logerror("Reading NVRAM\n"); + LOGMASKED(LOG_GKRACKER, "Reading NVRAM\n"); // If we increased the size, fill the remaining parts with 0 if (readsize < 81920) { @@ -384,7 +389,7 @@ void ti99_gkracker_device::nvram_read(emu_file &file) void ti99_gkracker_device::nvram_write(emu_file &file) { - if (TRACE_GKRACKER) logerror("Writing NVRAM\n"); + LOGMASKED(LOG_GKRACKER, "Writing NVRAM\n"); file.write(m_ram_ptr, 81920); } diff --git a/src/devices/bus/ti99/gromport/gkracker.h b/src/devices/bus/ti99/gromport/gkracker.h index dbc3e9ea14d..bb3d278d57a 100644 --- a/src/devices/bus/ti99/gromport/gkracker.h +++ b/src/devices/bus/ti99/gromport/gkracker.h @@ -23,7 +23,8 @@ public: DECLARE_READ8Z_MEMBER(crureadz) override; DECLARE_WRITE8_MEMBER(cruwrite) override; DECLARE_WRITE_LINE_MEMBER(romgq_line) override; - DECLARE_WRITE8_MEMBER(set_gromlines) override; + + void set_gromlines(line_state mline, line_state moline, line_state gsq) override; DECLARE_WRITE_LINE_MEMBER(gclock_in) override; void insert(int index, ti99_cartridge_device* cart) override; diff --git a/src/devices/bus/ti99/gromport/gromport.cpp b/src/devices/bus/ti99/gromport/gromport.cpp index f1b4c27f788..68262bde4e9 100644 --- a/src/devices/bus/ti99/gromport/gromport.cpp +++ b/src/devices/bus/ti99/gromport/gromport.cpp @@ -114,6 +114,13 @@ #include "multiconn.h" #include "gkracker.h" +#define LOG_WARN (1U<<1) // Warnings +#define LOG_READ (1U<<2) // Reading +#define LOG_WRITE (1U<<3) // Writing + +#define VERBOSE ( LOG_WARN ) +#include "logmacro.h" + DEFINE_DEVICE_TYPE_NS(TI99_GROMPORT, bus::ti99::gromport, gromport_device, "gromport", "TI-99 Cartridge port") namespace bus { namespace ti99 { namespace gromport { @@ -139,7 +146,7 @@ READ8Z_MEMBER(gromport_device::readz) if (m_connector != nullptr) { m_connector->readz(space, offset & m_mask, value); - if (TRACE_READ) if (m_romgq) logerror("Read %04x -> %02x\n", offset | 0x6000, *value); + if (m_romgq) LOGMASKED(LOG_READ, "Read %04x -> %02x\n", offset | 0x6000, *value); } } @@ -151,7 +158,7 @@ WRITE8_MEMBER(gromport_device::write) { if (m_connector != nullptr) { - if (TRACE_WRITE) if (m_romgq) logerror("Write %04x <- %02x\n", offset | 0x6000, data); + if (m_romgq) LOGMASKED(LOG_WRITE, "Write %04x <- %02x\n", offset | 0x6000, data); m_connector->write(space, offset & m_mask, data); } } @@ -192,10 +199,10 @@ WRITE_LINE_MEMBER(gromport_device::gclock_in) /* Combined GROM control lines. */ -WRITE8_MEMBER( gromport_device::set_gromlines ) +void gromport_device::set_gromlines(line_state mline, line_state moline, line_state gsq) { if (m_connector != nullptr) - m_connector->set_gromlines(space, offset, data); + m_connector->set_gromlines(mline, moline, gsq); } void gromport_device::device_start() diff --git a/src/devices/bus/ti99/gromport/gromport.h b/src/devices/bus/ti99/gromport/gromport.h index 09b4a72bcde..3f7941e9641 100644 --- a/src/devices/bus/ti99/gromport/gromport.h +++ b/src/devices/bus/ti99/gromport/gromport.h @@ -35,7 +35,7 @@ public: DECLARE_WRITE8_MEMBER(cruwrite); DECLARE_WRITE_LINE_MEMBER(ready_line); DECLARE_WRITE_LINE_MEMBER(romgq_line); - DECLARE_WRITE8_MEMBER(set_gromlines); // Combined GROM select lines + void set_gromlines(line_state mline, line_state moline, line_state gsq); DECLARE_WRITE_LINE_MEMBER(gclock_in); void set_mask(int mask) { m_mask = mask; } @@ -72,7 +72,7 @@ public: virtual DECLARE_WRITE8_MEMBER(cruwrite) = 0; virtual DECLARE_WRITE_LINE_MEMBER(romgq_line) = 0; - virtual DECLARE_WRITE8_MEMBER(set_gromlines) = 0; + virtual void set_gromlines(line_state mline, line_state moline, line_state gsq) =0; virtual DECLARE_WRITE_LINE_MEMBER(gclock_in) = 0; diff --git a/src/devices/bus/ti99/gromport/multiconn.cpp b/src/devices/bus/ti99/gromport/multiconn.cpp index 8e350cd2f85..860d2e7fbd7 100644 --- a/src/devices/bus/ti99/gromport/multiconn.cpp +++ b/src/devices/bus/ti99/gromport/multiconn.cpp @@ -43,12 +43,17 @@ #include "emu.h" #include "multiconn.h" +#define LOG_WARN (1U<<1) +#define LOG_CHANGE (1U<<2) +#define VERBOSE ( LOG_WARN ) + +#include "logmacro.h" + DEFINE_DEVICE_TYPE_NS(TI99_GROMPORT_MULTI, bus::ti99::gromport, ti99_multi_cart_conn_device, "ti99_mcartconn", "TI-99 Multi-cartridge extender") namespace bus { namespace ti99 { namespace gromport { #define AUTO -1 -#define TRACE_CHANGE 0 ti99_multi_cart_conn_device::ti99_multi_cart_conn_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : cartridge_connector_device(mconfig, TI99_GROMPORT_MULTI, tag, owner, clock), @@ -98,8 +103,8 @@ ti99_multi_cart_conn_device::ti99_multi_cart_conn_device(const machine_config &m */ void ti99_multi_cart_conn_device::set_slot(int slotnumber) { - if (TRACE_CHANGE) - if (m_active_slot != slotnumber) logerror("Setting cartslot to %d\n", slotnumber); + if (m_active_slot != slotnumber) + LOGMASKED(LOG_CHANGE, "Setting cartslot to %d\n", slotnumber); if (m_fixed_slot==AUTO) m_active_slot = slotnumber; @@ -121,14 +126,14 @@ int ti99_multi_cart_conn_device::get_active_slot(bool changebase, offs_t offset) void ti99_multi_cart_conn_device::insert(int index, ti99_cartridge_device* cart) { - if (TRACE_CHANGE) logerror("Insert slot %d\n", index); + LOGMASKED(LOG_CHANGE, "Insert slot %d\n", index); m_cartridge[index] = cart; m_gromport->cartridge_inserted(); } void ti99_multi_cart_conn_device::remove(int index) { - if (TRACE_CHANGE) logerror("Remove slot %d\n", index); + LOGMASKED(LOG_CHANGE, "Remove slot %d\n", index); m_cartridge[index] = nullptr; } @@ -149,17 +154,17 @@ WRITE_LINE_MEMBER(ti99_multi_cart_conn_device::romgq_line) /* Combined select lines */ -WRITE8_MEMBER(ti99_multi_cart_conn_device::set_gromlines) +void ti99_multi_cart_conn_device::set_gromlines(line_state mline, line_state moline, line_state gsq) { // GROM selected? - m_grom_selected = (data != 0); + m_grom_selected = (gsq == ASSERT_LINE); // Propagate to all slots for (int i=0; i < NUMBER_OF_CARTRIDGE_SLOTS; i++) { if (m_cartridge[i] != nullptr) { - m_cartridge[i]->set_gromlines(space, offset, data); + m_cartridge[i]->set_gromlines(mline, moline, gsq); } } } @@ -305,7 +310,7 @@ MACHINE_CONFIG_END INPUT_CHANGED_MEMBER( ti99_multi_cart_conn_device::switch_changed ) { - if (TRACE_CHANGE) logerror("Slot changed %d - %d\n", (int)((uint64_t)param & 0x07), newval); + LOGMASKED(LOG_CHANGE, "Slot changed %d - %d\n", (int)((uint64_t)param & 0x07), newval); m_active_slot = m_fixed_slot = newval - 1; } diff --git a/src/devices/bus/ti99/gromport/multiconn.h b/src/devices/bus/ti99/gromport/multiconn.h index f79d0f868ab..97b9308eb36 100644 --- a/src/devices/bus/ti99/gromport/multiconn.h +++ b/src/devices/bus/ti99/gromport/multiconn.h @@ -28,7 +28,7 @@ public: DECLARE_READ8Z_MEMBER(crureadz) override; DECLARE_WRITE8_MEMBER(cruwrite) override; DECLARE_WRITE_LINE_MEMBER(romgq_line) override; - DECLARE_WRITE8_MEMBER(set_gromlines) override; + void set_gromlines(line_state mline, line_state moline, line_state gsq) override; DECLARE_WRITE_LINE_MEMBER(gclock_in) override; void insert(int index, ti99_cartridge_device* cart) override; diff --git a/src/devices/bus/ti99/gromport/singleconn.cpp b/src/devices/bus/ti99/gromport/singleconn.cpp index e46dc5becf1..93a7d088c0b 100644 --- a/src/devices/bus/ti99/gromport/singleconn.cpp +++ b/src/devices/bus/ti99/gromport/singleconn.cpp @@ -52,10 +52,10 @@ WRITE_LINE_MEMBER(ti99_single_cart_conn_device::romgq_line) /* Combined select lines */ -WRITE8_MEMBER(ti99_single_cart_conn_device::set_gromlines) +void ti99_single_cart_conn_device::set_gromlines(line_state mline, line_state moline, line_state gsq) { // Pass through - m_cartridge->set_gromlines(space, offset, data); + m_cartridge->set_gromlines(mline, moline, gsq); } diff --git a/src/devices/bus/ti99/gromport/singleconn.h b/src/devices/bus/ti99/gromport/singleconn.h index 8f02f208d72..10f1062f223 100644 --- a/src/devices/bus/ti99/gromport/singleconn.h +++ b/src/devices/bus/ti99/gromport/singleconn.h @@ -24,7 +24,7 @@ public: DECLARE_READ8Z_MEMBER(crureadz) override; DECLARE_WRITE8_MEMBER(cruwrite) override; DECLARE_WRITE_LINE_MEMBER(romgq_line) override; - DECLARE_WRITE8_MEMBER(set_gromlines) override; + void set_gromlines(line_state mline, line_state moline, line_state gsq) override; DECLARE_WRITE_LINE_MEMBER(gclock_in) override; bool is_grom_idle() override; diff --git a/src/devices/bus/ti99/internal/998board.cpp b/src/devices/bus/ti99/internal/998board.cpp index 443f5b9312b..ccfe31d9813 100644 --- a/src/devices/bus/ti99/internal/998board.cpp +++ b/src/devices/bus/ti99/internal/998board.cpp @@ -121,8 +121,9 @@ #define LOG_CPURY (1U<<13) // Combined ready line #define LOG_GROM (1U<<14) // GROM operation #define LOG_PUNMAP (1U<<15) // Unmapped physical addresss +#define LOG_WARN (1U<<31) // Warnings -#define VERBOSE ( LOG_GENERAL ) +#define VERBOSE ( LOG_WARN ) #include "logmacro.h" @@ -157,6 +158,7 @@ mainboard8_device::mainboard8_device(const machine_config &mconfig, const char * m_mofetta(*this, TI998_MOFETTA_TAG), m_amigo(*this, TI998_AMIGO_TAG), m_oso(*this, TI998_OSO_TAG), + m_maincpu(*owner, "maincpu"), m_video(*owner, TI_VDP_TAG), // subdevice of main class m_sound(*owner, TI_SOUNDCHIP_TAG), m_speech(*owner, TI998_SPEECHSYN_TAG), @@ -164,6 +166,28 @@ mainboard8_device::mainboard8_device(const machine_config &mconfig, const char * m_ioport(*owner, TI99_IOPORT_TAG), m_sram(*owner, TI998_SRAM_TAG), m_dram(*owner, TI998_DRAM_TAG), + m_sgrom0(*owner, TI998_SYSGROM0_TAG), + m_sgrom1(*owner, TI998_SYSGROM1_TAG), + m_sgrom2(*owner, TI998_SYSGROM2_TAG), + m_tsgrom0(*owner, TI998_GLIB10_TAG), + m_tsgrom1(*owner, TI998_GLIB11_TAG), + m_tsgrom2(*owner, TI998_GLIB12_TAG), + m_tsgrom3(*owner, TI998_GLIB13_TAG), + m_tsgrom4(*owner, TI998_GLIB14_TAG), + m_tsgrom5(*owner, TI998_GLIB15_TAG), + m_tsgrom6(*owner, TI998_GLIB16_TAG), + m_tsgrom7(*owner, TI998_GLIB17_TAG), + m_p8grom0(*owner, TI998_GLIB20_TAG), + m_p8grom1(*owner, TI998_GLIB21_TAG), + m_p8grom2(*owner, TI998_GLIB22_TAG), + m_p8grom3(*owner, TI998_GLIB23_TAG), + m_p8grom4(*owner, TI998_GLIB24_TAG), + m_p8grom5(*owner, TI998_GLIB25_TAG), + m_p8grom6(*owner, TI998_GLIB26_TAG), + m_p8grom7(*owner, TI998_GLIB27_TAG), + m_p3grom0(*owner, TI998_GLIB30_TAG), + m_p3grom1(*owner, TI998_GLIB31_TAG), + m_p3grom2(*owner, TI998_GLIB32_TAG), m_sgrom_idle(true), m_tsgrom_idle(true), m_p8grom_idle(true), @@ -446,26 +470,44 @@ WRITE_LINE_MEMBER( mainboard8_device::clock_in ) // Yields about 25% in bench (hoped for more, but well) if (!m_sgrom_idle) { - for (int i=0; i < 3; i++) m_sgrom[i]->gclock_in(gromclk); + m_sgrom0->gclock_in(gromclk); + m_sgrom1->gclock_in(gromclk); + m_sgrom2->gclock_in(gromclk); m_gromport->gclock_in(gromclk); - m_sgrom_idle = m_sgrom[0]->idle(); + m_sgrom_idle = m_sgrom0->idle(); } if (!m_tsgrom_idle) { - for (int i=0; i < 8; i++) m_tsgrom[i]->gclock_in(gromclk); - m_tsgrom_idle = m_tsgrom[0]->idle(); + m_tsgrom0->gclock_in(gromclk); + m_tsgrom1->gclock_in(gromclk); + m_tsgrom2->gclock_in(gromclk); + m_tsgrom3->gclock_in(gromclk); + m_tsgrom4->gclock_in(gromclk); + m_tsgrom5->gclock_in(gromclk); + m_tsgrom6->gclock_in(gromclk); + m_tsgrom7->gclock_in(gromclk); + m_tsgrom_idle = m_tsgrom0->idle(); } if (!m_p8grom_idle) { - for (int i=0; i < 8; i++) m_p8grom[i]->gclock_in(gromclk); - m_p8grom_idle = m_p8grom[0]->idle(); + m_p8grom0->gclock_in(gromclk); + m_p8grom1->gclock_in(gromclk); + m_p8grom2->gclock_in(gromclk); + m_p8grom3->gclock_in(gromclk); + m_p8grom4->gclock_in(gromclk); + m_p8grom5->gclock_in(gromclk); + m_p8grom6->gclock_in(gromclk); + m_p8grom7->gclock_in(gromclk); + m_p8grom_idle = m_p8grom0->idle(); } if (!m_p3grom_idle) { - for (int i=0; i < 3; i++) m_p3grom[i]->gclock_in(gromclk); - m_p3grom_idle = m_p3grom[0]->idle(); + m_p3grom0->gclock_in(gromclk); + m_p3grom1->gclock_in(gromclk); + m_p3grom2->gclock_in(gromclk); + m_p3grom_idle = m_p3grom0->idle(); } } @@ -539,29 +581,47 @@ void mainboard8_device::select_groms() if (select != m_prev_grom) { m_prev_grom = select; - int lines = (m_dbin_level==ASSERT_LINE)? GROM_M_LINE : 0; - if (m_A14_set) lines |= GROM_MO_LINE; + line_state a14 = m_A14_set? ASSERT_LINE : CLEAR_LINE; if (select & SGMSEL) m_sgrom_idle = false; if (select & TSGSEL) m_tsgrom_idle = false; if (select & P8GSEL) m_p8grom_idle = false; if (select & P3GSEL) m_p3grom_idle = false; - for (int i=0; i < 3; i++) - m_sgrom[i]->set_lines(*m_space, lines, select & SGMSEL); - - for (int i=0; i < 8; i++) - m_tsgrom[i]->set_lines(*m_space, lines, select & TSGSEL); - - for (int i=0; i < 8; i++) - m_p8grom[i]->set_lines(*m_space, lines, select & P8GSEL); - - for (int i=0; i < 3; i++) - m_p3grom[i]->set_lines(*m_space, lines, select & P3GSEL); + line_state ssel = (select & SGMSEL)? ASSERT_LINE : CLEAR_LINE; + line_state tsel = (select & TSGSEL)? ASSERT_LINE : CLEAR_LINE; + line_state p8sel = (select & P8GSEL)? ASSERT_LINE : CLEAR_LINE; + line_state p3sel = (select & P3GSEL)? ASSERT_LINE : CLEAR_LINE; + + m_sgrom0->set_lines((line_state)m_dbin_level, a14, ssel); + m_sgrom1->set_lines((line_state)m_dbin_level, a14, ssel); + m_sgrom2->set_lines((line_state)m_dbin_level, a14, ssel); + + m_tsgrom0->set_lines((line_state)m_dbin_level, a14, tsel); + m_tsgrom1->set_lines((line_state)m_dbin_level, a14, tsel); + m_tsgrom2->set_lines((line_state)m_dbin_level, a14, tsel); + m_tsgrom3->set_lines((line_state)m_dbin_level, a14, tsel); + m_tsgrom4->set_lines((line_state)m_dbin_level, a14, tsel); + m_tsgrom5->set_lines((line_state)m_dbin_level, a14, tsel); + m_tsgrom6->set_lines((line_state)m_dbin_level, a14, tsel); + m_tsgrom7->set_lines((line_state)m_dbin_level, a14, tsel); + + m_p8grom0->set_lines((line_state)m_dbin_level, a14, p8sel); + m_p8grom1->set_lines((line_state)m_dbin_level, a14, p8sel); + m_p8grom2->set_lines((line_state)m_dbin_level, a14, p8sel); + m_p8grom3->set_lines((line_state)m_dbin_level, a14, p8sel); + m_p8grom4->set_lines((line_state)m_dbin_level, a14, p8sel); + m_p8grom5->set_lines((line_state)m_dbin_level, a14, p8sel); + m_p8grom6->set_lines((line_state)m_dbin_level, a14, p8sel); + m_p8grom7->set_lines((line_state)m_dbin_level, a14, p8sel); + + m_p3grom0->set_lines((line_state)m_dbin_level, a14, p3sel); + m_p3grom1->set_lines((line_state)m_dbin_level, a14, p3sel); + m_p3grom2->set_lines((line_state)m_dbin_level, a14, p3sel); // Write to the cartridge port. The GROMs on cartridges are accessed as system GROMs if (select & SGMSEL) m_gromport->romgq_line(CLEAR_LINE); - m_gromport->set_gromlines(*m_space, lines, select & SGMSEL); + m_gromport->set_gromlines((line_state)m_dbin_level, a14, ssel); } // If we're planning to write to the GROMs, let's do it right now @@ -571,40 +631,46 @@ void mainboard8_device::select_groms() switch (select) { case SGMSEL: - for (int i=0; i < 3; i++) - { - m_sgrom[i]->write(*m_space, 0, m_latched_data); - } + m_sgrom0->write(m_latched_data); + m_sgrom1->write(m_latched_data); + m_sgrom2->write(m_latched_data); LOGMASKED(LOG_MEM, "Write GS <- %02x\n", m_latched_data); m_gromport->write(*m_space, 0, m_latched_data); break; case TSGSEL: - for (int i=0; i < 8; i++) - { - m_tsgrom[i]->write(*m_space, 0, m_latched_data); - } + m_tsgrom0->write(m_latched_data); + m_tsgrom1->write(m_latched_data); + m_tsgrom2->write(m_latched_data); + m_tsgrom3->write(m_latched_data); + m_tsgrom4->write(m_latched_data); + m_tsgrom5->write(m_latched_data); + m_tsgrom6->write(m_latched_data); + m_tsgrom7->write(m_latched_data); LOGMASKED(LOG_MEM, "Write GT <- %02x\n", m_latched_data); break; case P8GSEL: - for (int i=0; i < 8; i++) - { - m_p8grom[i]->write(*m_space, 0, m_latched_data); - } + m_p8grom0->write(m_latched_data); + m_p8grom1->write(m_latched_data); + m_p8grom2->write(m_latched_data); + m_p8grom3->write(m_latched_data); + m_p8grom4->write(m_latched_data); + m_p8grom5->write(m_latched_data); + m_p8grom6->write(m_latched_data); + m_p8grom7->write(m_latched_data); LOGMASKED(LOG_MEM, "Write G8 <- %02x\n", m_latched_data); break; case P3GSEL: - for (int i=0; i < 3; i++) - { - m_p3grom[i]->write(*m_space, 0, m_latched_data); - } + m_p3grom0->write(m_latched_data); + m_p3grom1->write(m_latched_data); + m_p3grom2->write(m_latched_data); LOGMASKED(LOG_MEM, "Write G3 <- %02x\n", m_latched_data); break; default: - logerror("Error: Multiple GROM libs selected: SGM=%d TSG=%d P8G=%d P3G=%d\n", (select & SGMSEL)!=0, (select & TSGSEL)!=0, (select & P8GSEL)!=0, (select & P3GSEL)!=0); + LOGMASKED(LOG_WARN, "Error: Multiple GROM libs selected: SGM=%d TSG=%d P8G=%d P3G=%d\n", (select & SGMSEL)!=0, (select & TSGSEL)!=0, (select & P8GSEL)!=0, (select & P3GSEL)!=0); break; } } @@ -693,42 +759,48 @@ READ8_MEMBER( mainboard8_device::read ) { case SGMSEL: m_sgrom_idle = false; - for (int i=0; i < 3; i++) - { - m_sgrom[i]->readz(space, 0, &value); - } + m_sgrom0->readz(&value); + m_sgrom1->readz(&value); + m_sgrom2->readz(&value); m_gromport->readz(space, 0, &value); - if (!m_A14_set) LOGMASKED(LOG_GROM, "GS>%04x\n", m_sgrom[0]->debug_get_address()-1); + if (!m_A14_set) LOGMASKED(LOG_GROM, "GS>%04x\n", m_sgrom0->debug_get_address()-1); what = "system GROM"; goto readdone; case TSGSEL: m_tsgrom_idle = false; - for (int i=0; i < 8; i++) - { - m_tsgrom[i]->readz(space, 0, &value); - } - if (!m_A14_set) LOGMASKED(LOG_GROM, "GT>%04x\n", m_tsgrom[0]->debug_get_address()-1); + m_tsgrom0->readz(&value); + m_tsgrom1->readz(&value); + m_tsgrom2->readz(&value); + m_tsgrom3->readz(&value); + m_tsgrom4->readz(&value); + m_tsgrom5->readz(&value); + m_tsgrom6->readz(&value); + m_tsgrom7->readz(&value); + if (!m_A14_set) LOGMASKED(LOG_GROM, "GT>%04x\n", m_tsgrom0->debug_get_address()-1); what = "TTS GROM"; goto readdone; case P8GSEL: m_p8grom_idle = false; - for (int i=0; i < 8; i++) - { - m_p8grom[i]->readz(space, 0, &value); - } - if (!m_A14_set) LOGMASKED(LOG_GROM, "G8>%04x\n", m_p8grom[0]->debug_get_address()-1); + m_p8grom0->readz(&value); + m_p8grom1->readz(&value); + m_p8grom2->readz(&value); + m_p8grom3->readz(&value); + m_p8grom4->readz(&value); + m_p8grom5->readz(&value); + m_p8grom6->readz(&value); + m_p8grom7->readz(&value); + if (!m_A14_set) LOGMASKED(LOG_GROM, "G8>%04x\n", m_p8grom0->debug_get_address()-1); what = "P8 GROM"; goto readdone; case P3GSEL: m_p3grom_idle = false; - for (int i=0; i < 3; i++) - { - m_p3grom[i]->readz(space, 0, &value); - } - if (!m_A14_set) LOGMASKED(LOG_GROM, "G3>%04x\n", m_p3grom[0]->debug_get_address()-1); + m_p3grom0->readz(&value); + m_p3grom1->readz(&value); + m_p3grom2->readz(&value); + if (!m_A14_set) LOGMASKED(LOG_GROM, "G3>%04x\n", m_p3grom0->debug_get_address()-1); what = "P3 GROM"; goto readdone; default: @@ -739,7 +811,7 @@ READ8_MEMBER( mainboard8_device::read ) // an immediate value to a write-only address (like 9400) because the // GPL interpreter always tries to load the value from the provided memory address first - logerror("Read %04x (unmapped) ignored\n", m_logical_address); + LOGMASKED(LOG_WARN, "Read %04x (unmapped) ignored\n", m_logical_address); // Memory cycle ends cycle_end(); @@ -951,31 +1023,13 @@ WRITE_LINE_MEMBER( mainboard8_device::ggrdy_in ) m_amigo->srdy_in((state==ASSERT_LINE && m_speech_ready && m_sound_ready && m_pbox_ready)? ASSERT_LINE : CLEAR_LINE); } -static const char *const glib0[] = { TI998_SYSGROM0_TAG, TI998_SYSGROM1_TAG, TI998_SYSGROM2_TAG }; -static const char *const glib1[] = { TI998_GLIB10_TAG, TI998_GLIB11_TAG, TI998_GLIB12_TAG, TI998_GLIB13_TAG, TI998_GLIB14_TAG, TI998_GLIB15_TAG, TI998_GLIB16_TAG, TI998_GLIB17_TAG }; -static const char *const glib2[] = { TI998_GLIB20_TAG, TI998_GLIB21_TAG, TI998_GLIB22_TAG, TI998_GLIB23_TAG, TI998_GLIB24_TAG, TI998_GLIB25_TAG, TI998_GLIB26_TAG, TI998_GLIB27_TAG }; -static const char *const glib3[] = { TI998_GLIB30_TAG, TI998_GLIB31_TAG, TI998_GLIB32_TAG }; - void mainboard8_device::device_start() { - logerror("Starting main board\n"); // Lines going to the main driver class, then to the CPU m_ready.resolve_safe(); // READY m_console_reset.resolve_safe(); // RESET m_hold_line.resolve_safe(); // HOLD - // Setting up the links to the GROMs - for (int i=0; i < 8; i++) - { - if (i < 3) - { - m_sgrom[i] = downcast(machine().device(glib0[i])); - m_p3grom[i] = downcast(machine().device(glib3[i])); - } - m_tsgrom[i] = downcast(machine().device(glib1[i])); - m_p8grom[i] = downcast(machine().device(glib2[i])); - } - m_rom0 = machine().root_device().memregion(TI998_ROM0_REG)->base(); m_rom1 = machine().root_device().memregion(TI998_ROM1_REG)->base(); m_pascalrom = machine().root_device().memregion(TI998_PASCAL_REG)->base(); @@ -1001,7 +1055,6 @@ void mainboard8_device::device_start() void mainboard8_device::device_reset() { - logerror("Resetting main board\n"); m_last_ready = CLEAR_LINE; m_speech_ready = true; m_sound_ready = true; @@ -1013,9 +1066,8 @@ void mainboard8_device::device_reset() m_amigo->connect_sram(m_sram->pointer()); // Get the pointer to the address space; we need it outside of the - // usual memory functions. - cpu_device* cpu = downcast(machine().device("maincpu")); - m_space = &cpu->space(AS_PROGRAM); + // usual memory functions. TODO: Possibly not anymore. + m_space = &m_maincpu->space(AS_PROGRAM); } MACHINE_CONFIG_START(mainboard8_device::device_add_mconfig) @@ -2024,7 +2076,7 @@ WRITE8_MEMBER( amigo_device::write ) m_mapvalue = 0; m_mainboard->hold_cpu(ASSERT_LINE); } - else logerror("Invalid value written to Amigo: %02x\n", data); + else LOGMASKED(LOG_WARN, "Invalid value written to Amigo: %02x\n", data); } WRITE_LINE_MEMBER( amigo_device::clock_in ) @@ -2061,7 +2113,7 @@ WRITE_LINE_MEMBER( amigo_device::clock_in ) break; default: - logerror("Invalid state in mapper: %d\n", m_amstate); + LOGMASKED(LOG_WARN, "Invalid state in mapper: %d\n", m_amstate); } } } @@ -2220,6 +2272,7 @@ void amigo_device::device_reset() oso_device::oso_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : bus::hexbus::hexbus_chained_device(mconfig, TI99_OSO, tag, owner, clock), m_int(*this), + m_hexbusout(*this, ":" TI_HEXBUS_TAG), m_data(0), m_status(0xff), m_control(0), @@ -2691,7 +2744,8 @@ void oso_device::device_start() m_status = m_xmit = m_control = m_data = 0; m_int.resolve_safe(); - m_hexbus_outbound = dynamic_cast(machine().device(TI_HEXBUS_TAG)); + // Establish the downstream link in the parent class hexbus_chained_device + set_outbound_hexbus(m_hexbusout); // Establish callback for inbound propagations m_hexbus_outbound->set_chain_element(this); diff --git a/src/devices/bus/ti99/internal/998board.h b/src/devices/bus/ti99/internal/998board.h index 0f64b551443..820199f536d 100644 --- a/src/devices/bus/ti99/internal/998board.h +++ b/src/devices/bus/ti99/internal/998board.h @@ -470,6 +470,8 @@ private: void set_status(int bit, bool set) { m_status = (set)? (m_status | bit) : (m_status & ~bit); } void update_hexbus(); + required_device m_hexbusout; + // Registers uint8_t m_data; uint8_t m_status; @@ -638,6 +640,9 @@ private: required_device m_amigo; required_device m_oso; + // Link to main cpu + required_device m_maincpu; + // More devices required_device m_video; required_device m_sound; @@ -653,16 +658,34 @@ private: line_state m_crus_debug; // System GROM library - tmc0430_device* m_sgrom[3]; + required_device m_sgrom0; + required_device m_sgrom1; + required_device m_sgrom2; // Text-to-speech GROM library - tmc0430_device* m_tsgrom[8]; + required_device m_tsgrom0; + required_device m_tsgrom1; + required_device m_tsgrom2; + required_device m_tsgrom3; + required_device m_tsgrom4; + required_device m_tsgrom5; + required_device m_tsgrom6; + required_device m_tsgrom7; // Pascal 8 GROM library - tmc0430_device* m_p8grom[8]; + required_device m_p8grom0; + required_device m_p8grom1; + required_device m_p8grom2; + required_device m_p8grom3; + required_device m_p8grom4; + required_device m_p8grom5; + required_device m_p8grom6; + required_device m_p8grom7; // Pascal 3 GROM library - tmc0430_device* m_p3grom[3]; + required_device m_p3grom0; + required_device m_p3grom1; + required_device m_p3grom2; // Idle flags for GROMs bool m_sgrom_idle; diff --git a/src/devices/bus/ti99/internal/datamux.cpp b/src/devices/bus/ti99/internal/datamux.cpp index da6e870516a..fa1b4de2dad 100644 --- a/src/devices/bus/ti99/internal/datamux.cpp +++ b/src/devices/bus/ti99/internal/datamux.cpp @@ -71,6 +71,16 @@ #include "emu.h" #include "datamux.h" +#define LOG_WARN (1U<<1) // Warnings +#define LOG_READY (1U<<2) // READY line +#define LOG_ACCESS (1U<<3) // Access to this GROM +#define LOG_ADDRESS (1U<<4) // Address register +#define LOG_WAITCOUNT (1U<<5) // Wait state counter + +#define VERBOSE ( LOG_GENERAL | LOG_WARN ) + +#include "logmacro.h" + DEFINE_DEVICE_TYPE_NS(TI99_DATAMUX, bus::ti99::internal, datamux_device, "ti99_datamux", "TI-99 Databus multiplexer") namespace bus { namespace ti99 { namespace internal { @@ -86,6 +96,7 @@ datamux_device::datamux_device(const machine_config &mconfig, const char *tag, d m_gromport(*owner, TI99_GROMPORT_TAG), m_ram16b(*owner, TI99_EXPRAM_TAG), m_padram(*owner, TI99_PADRAM_TAG), + m_cpu(*owner, "maincpu"), m_spacep(nullptr), m_ready(*this), m_addr_buf(0), @@ -103,12 +114,6 @@ datamux_device::datamux_device(const machine_config &mconfig, const char *tag, d { } -#define TRACE_READY 0 -#define TRACE_ACCESS 0 -#define TRACE_ADDRESS 0 -#define TRACE_WAITCOUNT 0 -#define TRACE_SETUP 0 - /*************************************************************************** DEVICE ACCESSOR FUNCTIONS ***************************************************************************/ @@ -127,7 +132,7 @@ void datamux_device::read_all(address_space& space, uint16_t addr, uint8_t *valu { for (int i=0; i < 3; i++) { - m_grom[i]->readz(space, addr, value); + m_grom[i]->readz(value); } } // GROMport (GROMs) @@ -160,7 +165,7 @@ void datamux_device::write_all(address_space& space, uint16_t addr, uint8_t valu if (m_console_groms_present) { for (int i=0; i < 3; i++) - m_grom[i]->write(space, addr, value); + m_grom[i]->write(value); } // GROMport m_gromport->write(space, addr, value); @@ -203,18 +208,15 @@ void datamux_device::setaddress_all(address_space& space, uint16_t addr) bool iscartrom = ((addr & 0xe000)==0x6000); // Always deliver to GROM so that the select line may be cleared - int lines = (m_dbin==ASSERT_LINE)? 1 : 0; - if (a14==ASSERT_LINE) lines |= 2; - line_state select = isgrom? ASSERT_LINE : CLEAR_LINE; - - if (select) m_grom_idle = false; + line_state gsq = isgrom? ASSERT_LINE : CLEAR_LINE; + if (isgrom) m_grom_idle = false; if (m_console_groms_present) for (int i=0; i < 3; i++) - m_grom[i]->set_lines(space, lines, select); + m_grom[i]->set_lines((line_state)m_dbin, a14, gsq); // GROMport (GROMs) - m_gromport->set_gromlines(space, lines, select); + m_gromport->set_gromlines((line_state)m_dbin, a14, gsq); // Sound chip and video chip do not require the address to be set before access @@ -370,7 +372,7 @@ READ16_MEMBER( datamux_device::read ) // Reading the even address now (addr) uint8_t hbyte = 0; read_all(space, m_addr_buf, &hbyte); - if (TRACE_ACCESS) logerror("Read even byte from address %04x -> %02x\n", m_addr_buf, hbyte); + LOGMASKED(LOG_ACCESS, "Read even byte from address %04x -> %02x\n", m_addr_buf, hbyte); value = (hbyte<<8) | m_latch; } @@ -417,7 +419,7 @@ WRITE16_MEMBER( datamux_device::write ) m_latch = (data >> 8) & 0xff; // write odd byte - if (TRACE_ACCESS) logerror("datamux: write odd byte to address %04x <- %02x\n", m_addr_buf+1, data & 0xff); + LOGMASKED(LOG_ACCESS, "Write odd byte to address %04x <- %02x\n", m_addr_buf+1, data & 0xff); write_all(space, m_addr_buf+1, data & 0xff); } } @@ -431,7 +433,7 @@ READ8_MEMBER( datamux_device::setoffset ) m_addr_buf = offset; m_waitcount = 0; - if (TRACE_ADDRESS) logerror("set address %04x\n", m_addr_buf); + LOGMASKED(LOG_ADDRESS, "Set address %04x\n", m_addr_buf); if ((m_addr_buf & 0xe000) == 0x0000) { @@ -480,10 +482,10 @@ WRITE_LINE_MEMBER( datamux_device::clock_in ) // return immediately if the datamux is currently inactive if (m_waitcount>0) { - if (TRACE_WAITCOUNT) logerror("datamux: wait count %d\n", m_waitcount); + LOGMASKED(LOG_WAITCOUNT, "Wait count %d\n", m_waitcount); if (m_sysready==CLEAR_LINE) { - if (TRACE_READY) logerror("datamux: stalled due to external READY=0\n"); + LOGMASKED(LOG_READY, "Stalled due to external READY=0\n"); return; } @@ -501,7 +503,7 @@ WRITE_LINE_MEMBER( datamux_device::clock_in ) { // read odd byte read_all(*m_spacep, m_addr_buf+1, &m_latch); - if (TRACE_ACCESS) logerror("datamux: read odd byte from address %04x -> %02x\n", m_addr_buf+1, m_latch); + LOGMASKED(LOG_ACCESS, "Read odd byte from address %04x -> %02x\n", m_addr_buf+1, m_latch); // do the setaddress for the even address setaddress_all(*m_spacep, m_addr_buf); } @@ -524,7 +526,7 @@ WRITE_LINE_MEMBER( datamux_device::clock_in ) // do the setaddress for the even address setaddress_all(*m_spacep, m_addr_buf); // write even byte - if (TRACE_ACCESS) logerror("datamux: write even byte to address %04x <- %02x\n", m_addr_buf, m_latch); + LOGMASKED(LOG_ACCESS, "Write even byte to address %04x <- %02x\n", m_addr_buf, m_latch); write_all(*m_spacep, m_addr_buf, m_latch); } } @@ -543,15 +545,12 @@ void datamux_device::ready_join() WRITE_LINE_MEMBER( datamux_device::dbin_in ) { m_dbin = (line_state)state; - if (TRACE_ADDRESS) logerror("data bus in = %d\n", (m_dbin==ASSERT_LINE)? 1:0 ); + LOGMASKED(LOG_ADDRESS, "Data bus in = %d\n", (m_dbin==ASSERT_LINE)? 1:0 ); } WRITE_LINE_MEMBER( datamux_device::ready_line ) { - if (TRACE_READY) - { - if (state != m_sysready) logerror("READY line from PBox = %d\n", state); - } + if (state != m_sysready) LOGMASKED(LOG_READY, "READY line from PBox = %d\n", state); m_sysready = (line_state)state; // Also propagate to CPU via driver ready_join(); @@ -619,8 +618,7 @@ void datamux_device::device_reset(void) // Get the pointer to the address space already here, because we cannot // save that pointer to a savestate, and we need it on restore - cpu_device* cpu = downcast(machine().device("maincpu")); - m_spacep = &cpu->space(AS_PROGRAM); + m_spacep = &m_cpu->space(AS_PROGRAM); } void datamux_device::device_config_complete() diff --git a/src/devices/bus/ti99/internal/datamux.h b/src/devices/bus/ti99/internal/datamux.h index b2ec1bff123..47d2d1f84c3 100644 --- a/src/devices/bus/ti99/internal/datamux.h +++ b/src/devices/bus/ti99/internal/datamux.h @@ -72,6 +72,9 @@ private: // Console RAM required_device m_padram; + // Link to the CPU + required_device m_cpu; + // Keeps the address space pointer address_space* m_spacep; diff --git a/src/devices/bus/ti99/peb/evpc.cpp b/src/devices/bus/ti99/peb/evpc.cpp index eb333a9a8a3..632961303b2 100644 --- a/src/devices/bus/ti99/peb/evpc.cpp +++ b/src/devices/bus/ti99/peb/evpc.cpp @@ -67,7 +67,8 @@ snug_enhanced_video_device::snug_enhanced_video_device(const machine_config &mco m_novram(nullptr), m_video(*this, TI_VDP_TAG), m_sound(*this, TI_SOUNDCHIP_TAG), - m_colorbus(*this, COLORBUS_TAG) + m_colorbus(*this, COLORBUS_TAG), + m_console_conn(*this, ":" TI99_EVPC_CONN_TAG) { } @@ -392,7 +393,6 @@ void snug_enhanced_video_device::device_start() { m_dsrrom = memregion(TI99_DSRROM)->base(); m_novram = std::make_unique(NOVRAM_SIZE); - m_console_conn = downcast(machine().device(TI99_EVPC_CONN_TAG)); save_item(NAME(m_address)); save_item(NAME(m_dsr_page)); save_item(NAME(m_inDsrArea)); diff --git a/src/devices/bus/ti99/peb/evpc.h b/src/devices/bus/ti99/peb/evpc.h index 7567044ee0e..a52e73b963c 100644 --- a/src/devices/bus/ti99/peb/evpc.h +++ b/src/devices/bus/ti99/peb/evpc.h @@ -86,7 +86,7 @@ private: required_device m_video; required_device m_sound; required_device m_colorbus; - bus::ti99::internal::evpc_clock_connector* m_console_conn; + optional_device m_console_conn; }; } } } // end namespace bus::ti99::peb diff --git a/src/devices/bus/ti99/peb/pcode.cpp b/src/devices/bus/ti99/peb/pcode.cpp index 0832bcfeba2..425ceae0fa3 100644 --- a/src/devices/bus/ti99/peb/pcode.cpp +++ b/src/devices/bus/ti99/peb/pcode.cpp @@ -134,13 +134,12 @@ SETADDRESS_DBIN_MEMBER( ti_pcode_card_device::setaddress_dbin ) if (validaccess) { - int lines = (state==ASSERT_LINE)? 1 : 0; - if (a14==ASSERT_LINE) lines |= 2; - line_state select = m_isgrom? ASSERT_LINE : CLEAR_LINE; - // always deliver to GROM so that the select line may be cleared + line_state mline = (state!=0)? ASSERT_LINE : CLEAR_LINE; + line_state gsq = m_isgrom? ASSERT_LINE : CLEAR_LINE; + for (int i=0; i < 8; i++) - m_grom[i]->set_lines(space, lines, select); + m_grom[i]->set_lines(mline, a14, gsq); } } @@ -176,7 +175,7 @@ READ8Z_MEMBER( ti_pcode_card_device::readz ) { if (m_isgrom) { - for (auto& elem : m_grom) elem->readz(space, m_address, value); + for (auto& elem : m_grom) elem->readz(value); if (TRACE_GROM) logerror("Read from grom %04x: %02x\n", m_address&0xffff, *value); } else @@ -206,7 +205,7 @@ WRITE8_MEMBER( ti_pcode_card_device::write ) if (machine().side_effects_disabled()) return; if (m_active && m_isgrom && m_selected) { - for (auto & elem : m_grom) elem->write(space, m_address, data); + for (auto & elem : m_grom) elem->write(data); } } diff --git a/src/devices/bus/ti99/peb/peribox.cpp b/src/devices/bus/ti99/peb/peribox.cpp index 6e81dc6886b..e6935c9e996 100644 --- a/src/devices/bus/ti99/peb/peribox.cpp +++ b/src/devices/bus/ti99/peb/peribox.cpp @@ -593,12 +593,12 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(peribox_genmod_device::device_add_mconfig) MCFG_PERIBOX_SLOT_ADD_DEF( PEBSLOT2, peribox_slotg, "memex" ) - MCFG_PERIBOX_SLOT_ADD( PEBSLOT3, peribox_slotv ) - MCFG_PERIBOX_SLOT_ADD( PEBSLOT4, peribox_slotv ) - MCFG_PERIBOX_SLOT_ADD( PEBSLOT5, peribox_slotv ) - MCFG_PERIBOX_SLOT_ADD( PEBSLOT6, peribox_slotv ) - MCFG_PERIBOX_SLOT_ADD( PEBSLOT7, peribox_slotv ) - MCFG_PERIBOX_SLOT_ADD( PEBSLOT8, peribox_slotv ) + MCFG_PERIBOX_SLOT_ADD( PEBSLOT3, peribox_slotg ) + MCFG_PERIBOX_SLOT_ADD( PEBSLOT4, peribox_slotg ) + MCFG_PERIBOX_SLOT_ADD( PEBSLOT5, peribox_slotg ) + MCFG_PERIBOX_SLOT_ADD( PEBSLOT6, peribox_slotg ) + MCFG_PERIBOX_SLOT_ADD( PEBSLOT7, peribox_slotg ) + MCFG_PERIBOX_SLOT_ADD( PEBSLOT8, peribox_slotg ) MACHINE_CONFIG_END /**************************************************************************** diff --git a/src/devices/machine/tmc0430.cpp b/src/devices/machine/tmc0430.cpp index d4aabfc8bfd..34400cdfe8b 100644 --- a/src/devices/machine/tmc0430.cpp +++ b/src/devices/machine/tmc0430.cpp @@ -166,25 +166,19 @@ WRITE_LINE_MEMBER( tmc0430_device::gsq_line ) /* Combined select lines. Avoids separate calls to the chip. - Address: - 0 -> MO=0, M=0 - 1 -> MO=0, M=1 - 2 -> MO=1, M=0 - 3 -> MO=1, M=1 - Data: gsq line (ASSERT, CLEAR) */ -WRITE8_MEMBER( tmc0430_device::set_lines ) +void tmc0430_device::set_lines(line_state mline, line_state moline, line_state gsq) { - m_read_mode = ((offset & GROM_M_LINE)!=0); - m_address_mode = ((offset & GROM_MO_LINE)!=0); + m_read_mode = (mline==ASSERT_LINE); + m_address_mode = (moline==ASSERT_LINE); - if (data!=CLEAR_LINE && !m_selected) // check for edge + if (gsq!=CLEAR_LINE && !m_selected) // check for edge { LOGMASKED(LOG_READY, "GROM %d selected, pulling down READY\n", m_ident>>13); m_gromready(CLEAR_LINE); m_phase = 4; // set for three full GROM clock ticks (and a fraction at the start) } - m_selected = (data!=CLEAR_LINE); + m_selected = (gsq!=CLEAR_LINE); } /* @@ -273,7 +267,7 @@ WRITE_LINE_MEMBER( tmc0430_device::gclock_in ) Read operation. For MO=Address, delivers the address register (and destroys its contents). For MO=Data, delivers the byte inside the buffer and prefetches the next one. */ -READ8Z_MEMBER( tmc0430_device::readz ) +void tmc0430_device::readz(uint8_t *value) { if (!m_selected) return; @@ -310,7 +304,7 @@ READ8Z_MEMBER( tmc0430_device::readz ) This operation occurs in parallel to phase 4. The real GROM will pick up the value from the data bus some phases later. */ -WRITE8_MEMBER( tmc0430_device::write ) +void tmc0430_device::write(uint8_t data) { if (!m_selected) return; diff --git a/src/devices/machine/tmc0430.h b/src/devices/machine/tmc0430.h index e7288c8f7bc..a0f49747b88 100644 --- a/src/devices/machine/tmc0430.h +++ b/src/devices/machine/tmc0430.h @@ -17,11 +17,6 @@ DECLARE_DEVICE_TYPE(TMC0430, tmc0430_device) -#ifndef READ8Z_MEMBER -#define DECLARE_READ8Z_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint8_t *value, ATTR_UNUSED uint8_t mem_mask = 0xff) -#define READ8Z_MEMBER(name) void name(ATTR_UNUSED address_space &space, ATTR_UNUSED offs_t offset, ATTR_UNUSED uint8_t *value, ATTR_UNUSED uint8_t mem_mask) -#endif - enum { GROM_M_LINE = 1, @@ -35,17 +30,15 @@ public: template devcb_base &set_ready_wr_callback(Object &&cb) { return m_gromready.set_callback(std::forward(cb)); } - DECLARE_READ8Z_MEMBER(readz); - DECLARE_WRITE8_MEMBER(write); + void readz(uint8_t *value); + void write(uint8_t data); + void set_lines(line_state mline, line_state moline, line_state gsq); DECLARE_WRITE_LINE_MEMBER(m_line); DECLARE_WRITE_LINE_MEMBER(mo_line); DECLARE_WRITE_LINE_MEMBER(gsq_line); - DECLARE_WRITE_LINE_MEMBER(gclock_in); - DECLARE_WRITE8_MEMBER( set_lines ); - void set_region_and_ident(const char *regionname, int offset, int ident) { m_regionname = regionname; -- cgit v1.2.3