From f44b654efd11608e80bb007e7123754963b8b169 Mon Sep 17 00:00:00 2001 From: Michael Zapf Date: Sun, 12 Jun 2022 01:18:34 +0200 Subject: [PATCH] ti99/genmod: Add option to decode high address lines for DDCC-1 so that it can be used with Genmod. --- src/devices/bus/ti99/peb/myarcfdc.cpp | 59 ++++++++++++++++++--------- src/devices/bus/ti99/peb/myarcfdc.h | 3 ++ src/devices/bus/ti99/peb/peribox.cpp | 18 ++++---- src/devices/bus/ti99/peb/peribox.h | 6 +-- 4 files changed, 55 insertions(+), 31 deletions(-) diff --git a/src/devices/bus/ti99/peb/myarcfdc.cpp b/src/devices/bus/ti99/peb/myarcfdc.cpp index b4e535038df..7df7cf0d261 100644 --- a/src/devices/bus/ti99/peb/myarcfdc.cpp +++ b/src/devices/bus/ti99/peb/myarcfdc.cpp @@ -95,19 +95,23 @@ offs_t myarc_fdc_device::get_address() void myarc_fdc_device::debug_read(offs_t offset, uint8_t* value) { offs_t addrcopy = m_address; - m_address = offset; - if (m_pal->ramsel()) - { - *value = m_buffer_ram->pointer()[m_address & 0x07ff]; - } - if (m_pal->romen()) + if (!m_dec_high || amabc_is_set(offset)) { - // EPROM selected - offs_t base = m_banksel? 0x1000 : 0; - *value = m_dsrrom[base | (m_address & 0x0fff)]; + m_address = offset; + if (m_pal->ramsel()) + { + *value = m_buffer_ram->pointer()[m_address & 0x07ff]; + } + + if (m_pal->romen()) + { + // EPROM selected + offs_t base = m_banksel? 0x1000 : 0; + *value = m_dsrrom[base | (m_address & 0x0fff)]; + } + m_address = addrcopy; } - m_address = addrcopy; } /* @@ -116,12 +120,16 @@ void myarc_fdc_device::debug_read(offs_t offset, uint8_t* value) void myarc_fdc_device::debug_write(offs_t offset, uint8_t data) { offs_t addrcopy = m_address; - m_address = offset; - if (m_pal->ramsel()) + + if (!m_dec_high || amabc_is_set(offset)) { - m_buffer_ram->pointer()[m_address & 0x07ff] = data; + m_address = offset; + if (m_pal->ramsel()) + { + m_buffer_ram->pointer()[m_address & 0x07ff] = data; + } + m_address = addrcopy; } - m_address = addrcopy; } /* @@ -135,6 +143,9 @@ void myarc_fdc_device::readz(offs_t offset, uint8_t *value) return; } + // If we have an AMA/B/C decoder and it delivers false, exit here + if (m_dec_high && !amabc_is_set(offset)) return; + if (m_pal->ramsel()) { // SRAM selected @@ -175,6 +186,9 @@ void myarc_fdc_device::write(offs_t offset, uint8_t data) return; } + // If we have an AMA/B/C decoder and it delivers false, exit here + if (m_dec_high && !amabc_is_set(offset)) return; + if (m_pal->ramsel()) { // SRAM selected @@ -346,6 +360,8 @@ void myarc_fdc_device::device_reset() m_wdc = m_wd1770; else m_wdc = m_wd1772; + + m_dec_high = (ioport("AMADECODE")->read()!=0); } void myarc_fdc_device::device_config_complete() @@ -366,7 +382,7 @@ void myarc_fdc_device::floppy_formats(format_registration &fr) fr.add(FLOPPY_TI99_TDF_FORMAT); } -static void ccfdc_floppies(device_slot_interface &device) +static void myarc_ddcc_floppies(device_slot_interface &device) { device.option_add("525dd", FLOPPY_525_DD); // 40 tracks device.option_add("525qd", FLOPPY_525_QD); // 80 tracks @@ -397,6 +413,11 @@ INPUT_PORTS_START(myarc_ddcc ) PORT_DIPNAME( 0x08, 0x00, "DSK4 head step time" ) PORT_DIPSETTING( 0x00, "6ms") PORT_DIPSETTING( 0x08, "20ms/2ms") + + PORT_START( "AMADECODE" ) + PORT_CONFNAME( 0x01, 0x01, "Decode AMA/AMB/AMC lines" ) + PORT_CONFSETTING( 0x00, DEF_STR( Off )) + PORT_CONFSETTING( 0x01, DEF_STR( On )) INPUT_PORTS_END @@ -438,10 +459,10 @@ void myarc_fdc_device::device_add_mconfig(machine_config& config) DDCC1_PAL(config, PAL_TAG, 0); // Floppy drives - FLOPPY_CONNECTOR(config, "0", ccfdc_floppies, "525dd", myarc_fdc_device::floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, "1", ccfdc_floppies, "525dd", myarc_fdc_device::floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, "2", ccfdc_floppies, nullptr, myarc_fdc_device::floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, "3", ccfdc_floppies, nullptr, myarc_fdc_device::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, "0", myarc_ddcc_floppies, "525dd", myarc_fdc_device::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, "1", myarc_ddcc_floppies, "525dd", myarc_fdc_device::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, "2", myarc_ddcc_floppies, nullptr, myarc_fdc_device::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, "3", myarc_ddcc_floppies, nullptr, myarc_fdc_device::floppy_formats).enable_sound(true); } ioport_constructor myarc_fdc_device::device_input_ports() const diff --git a/src/devices/bus/ti99/peb/myarcfdc.h b/src/devices/bus/ti99/peb/myarcfdc.h index 7eacdd79f26..89106b73e5a 100644 --- a/src/devices/bus/ti99/peb/myarcfdc.h +++ b/src/devices/bus/ti99/peb/myarcfdc.h @@ -103,6 +103,9 @@ private: // Recent address int m_address; + + // AMA/B/C decoding active + bool m_dec_high; }; // =========== Decoder PAL circuit ================ diff --git a/src/devices/bus/ti99/peb/peribox.cpp b/src/devices/bus/ti99/peb/peribox.cpp index 152ede1b310..cc8b07500f0 100644 --- a/src/devices/bus/ti99/peb/peribox.cpp +++ b/src/devices/bus/ti99/peb/peribox.cpp @@ -796,18 +796,18 @@ void device_ti99_peribox_card_interface::interface_config_complete() bool device_ti99_peribox_card_interface::in_dsr_space(offs_t offset, bool amadec) { - if (amadec) - return (offset & 0x7e000)==0x74000; - else - return (offset & 0x0e000)==0x04000; + if (amadec && !amabc_is_set(offset)) return false; + return (offset & 0x0e000)==0x04000; } -bool device_ti99_peribox_card_interface::in_cart_space(offs_t offset, bool amadec) +/* + Some cards do not decode the additional address lines AMA, AMB, AMC. + This leads to errors when using the card with Genmod. The typical procedure + to decode the lines is the same for each card. +*/ +bool device_ti99_peribox_card_interface::amabc_is_set(offs_t offset) { - if (amadec) - return (offset & 0x7e000)==0x76000; - else - return (offset & 0x0e000)==0x06000; + return (((offset >> 16)&0x07)==0x07); } } // end namespace bus::ti99::peb diff --git a/src/devices/bus/ti99/peb/peribox.h b/src/devices/bus/ti99/peb/peribox.h index 157c2099106..b54467f1055 100644 --- a/src/devices/bus/ti99/peb/peribox.h +++ b/src/devices/bus/ti99/peb/peribox.h @@ -202,9 +202,9 @@ protected: int m_cru_base; // Methods to decide whether we are acccessing the 4000-5fff region (DSR) - // or the cartridge region - static bool in_dsr_space(offs_t offset, bool amadec); - static bool in_cart_space(offs_t offset, bool amadec); + bool in_dsr_space(offs_t offset, bool amadec); + + bool amabc_is_set(offs_t offset); }; /*****************************************************************************