ti99: Further cleanups, removed casts.

This commit is contained in:
Michael Zapf 2024-03-30 01:34:22 +01:00
parent a3231810da
commit c5b1b043f3
30 changed files with 283 additions and 384 deletions

View File

@ -86,9 +86,10 @@
#define LOG_MOTOR (1U << 9) // Motor activity
#define LOG_STATUS (1U << 10) // Main status register
#define LOG_FIFO (1U << 11) // Data register
#define LOG_CONFIG (1U << 12) // Configuration
// Minimum log should be config and warnings
#define VERBOSE (LOG_GENERAL | LOG_WARN)
#define VERBOSE (LOG_GENERAL | LOG_WARN | LOG_CONFIG)
#include "logmacro.h"
@ -104,6 +105,9 @@
#define ROM1_TAG "u25_rom"
#define ROM2_TAG "u29_rom"
#define FLOP0 "d0"
#define FLOP1 "d1"
#define MOTOR_TIMER 1
#define UNDEF -1
@ -138,6 +142,8 @@ hx5102_device::hx5102_device(const machine_config &mconfig, const char *tag, dev
m_dack(false),
m_dacken(false),
m_wait(false),
m_flopcon0(*this, FLOP0),
m_flopcon1(*this, FLOP1),
m_current_floppy(nullptr),
m_floppy_select(0),
m_floppy_select_last(UNDEF),
@ -581,13 +587,21 @@ void hx5102_device::update_drive_select()
*/
void hx5102_device::device_start()
{
m_floppy[0] = m_floppy[1] = nullptr;
if (subdevice("d0")!=nullptr) m_floppy[0] = static_cast<floppy_image_device*>(subdevice("d0")->subdevices().first());
if (subdevice("d1")!=nullptr) m_floppy[1] = static_cast<floppy_image_device*>(subdevice("d1")->subdevices().first());
m_rom1 = (uint8_t*)memregion(DSR_TAG)->base();
m_rom2 = (uint8_t*)memregion(DSR_TAG)->base() + 0x2000;
m_floppy[0] = m_flopcon0->get_device();
m_floppy[1] = m_flopcon1->get_device();
if (m_floppy[0] != nullptr)
LOGMASKED(LOG_CONFIG, "Internal floppy drive connected\n");
else
LOGMASKED(LOG_WARN, "Internal floppy drive not found\n");
if (m_floppy[1] != nullptr)
LOGMASKED(LOG_CONFIG, "External floppy drive connected\n");
else
LOGMASKED(LOG_CONFIG, "External floppy drive not connected\n");
}
/*
@ -686,8 +700,8 @@ void hx5102_device::device_add_mconfig(machine_config& config)
m_floppy_ctrl->intrq_wr_callback().set(FUNC(hx5102_device::fdc_irq_w));
m_floppy_ctrl->drq_wr_callback().set(FUNC(hx5102_device::fdc_drq_w));
FLOPPY_CONNECTOR(config, "d0", hx5102_drive, "525dd", hx5102_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "d1", hx5102_drive, nullptr, hx5102_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_flopcon0, hx5102_drive, "525dd", hx5102_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_flopcon1, hx5102_drive, nullptr, hx5102_device::floppy_formats).enable_sound(true);
// Addressable latches
LS259(config, m_crulatch[0]); // U18

View File

@ -101,6 +101,8 @@ private:
void update_readyff_input();
// Link to the attached floppy drives
required_device<floppy_connector> m_flopcon0;
required_device<floppy_connector> m_flopcon1;
floppy_image_device* m_floppy[2];
floppy_image_device* m_current_floppy;
int m_floppy_select, m_floppy_select_last;

View File

@ -30,7 +30,7 @@
#define LOG_RPK (1U << 8) // RPK handler
#define LOG_WARNW (1U << 9) // Warn when writing to cartridge space
#define VERBOSE (LOG_GENERAL | LOG_WARN | LOG_CONFIG)
#define VERBOSE (LOG_GENERAL | LOG_WARN | LOG_CONFIG | LOG_CHANGE)
#include "logmacro.h"
DEFINE_DEVICE_TYPE(TI99_CART, bus::ti99::gromport::ti99_cartridge_device, "ti99cart", "TI-99 cartridge")
@ -94,7 +94,6 @@ ti99_cartridge_device::ti99_cartridge_device(const machine_config &mconfig, cons
: device_t(mconfig, TI99_CART, tag, owner, clock),
device_cartrom_image_interface(mconfig, *this),
m_pcbtype(0),
m_slot(0),
m_pcb(nullptr),
m_connector(nullptr)
{
@ -274,7 +273,8 @@ int ti99_cartridge_device::get_index_from_tagname()
std::pair<std::error_condition, std::string> ti99_cartridge_device::call_load()
{
// File name is in m_basename
LOGMASKED(LOG_CHANGE, "Loading %s in slot %s\n", basename());
int slot = get_index_from_tagname() + 1;
LOGMASKED(LOG_CHANGE, "Loading %s in slot %d\n", basename(), slot);
if (loaded_through_softlist())
{
@ -363,8 +363,7 @@ std::pair<std::error_condition, std::string> ti99_cartridge_device::call_load()
prepare_cartridge();
m_pcb->set_cartridge(this);
m_pcb->set_tag(tag());
m_slot = get_index_from_tagname();
m_connector->insert(m_slot, this);
m_connector->insert();
return std::make_pair(std::error_condition(), std::string());
}
@ -388,12 +387,7 @@ void ti99_cartridge_device::call_unload()
}
m_pcb = nullptr;
m_connector->remove(m_slot);
}
void ti99_cartridge_device::set_slot(int i)
{
m_slot = i;
m_connector->remove();
}
void ti99_cartridge_device::readz(offs_t offset, uint8_t *value)
@ -450,12 +444,6 @@ bool ti99_cartridge_device::is_grom_idle()
return (m_pcb != nullptr)? m_pcb->is_grom_idle() : false;
}
void ti99_cartridge_device::device_config_complete()
{
m_connector = dynamic_cast<cartridge_connector_device*>(owner());
// owner is the empty_state during -listxml, so this will be nullptr
}
/*
5 GROMs that may be contained in a cartridge
*/

View File

@ -27,6 +27,10 @@ class ti99_cartridge_pcb;
class ti99_cartridge_device : public device_t, public device_cartrom_image_interface
{
friend class ti99_single_cart_conn_device;
friend class ti99_multi_cart_conn_device;
friend class ti99_gkracker_device;
public:
ti99_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@ -43,12 +47,10 @@ public:
void gclock_in(int state);
bool is_available() { return m_pcb != nullptr; }
void set_slot(int i);
bool is_grom_idle();
protected:
virtual void device_start() override { }
virtual void device_config_complete() override;
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry* device_rom_region() const override;
@ -63,6 +65,8 @@ protected:
const char *image_interface() const noexcept override { return "ti99_cart"; }
const char *file_extensions() const noexcept override { return "rpk"; }
void set_connector(cartridge_connector_device* conn) { m_connector = conn; }
private:
class ti99_rpk_socket;
@ -116,7 +120,6 @@ private:
bool m_readrom;
int m_pcbtype;
int m_slot;
int get_index_from_tagname();
std::unique_ptr<ti99_cartridge_pcb> m_pcb; // inbound

View File

@ -101,7 +101,7 @@
#define LOG_CHANGE (1U << 2) // Cartridge change
#define LOG_GKRACKER (1U << 3) // Gram Kracker operation
#define VERBOSE (LOG_WARN)
#define VERBOSE (LOG_GENERAL | LOG_WARN)
#include "logmacro.h"
DEFINE_DEVICE_TYPE(TI99_GROMPORT_GK, bus::ti99::gromport::ti99_gkracker_device, "ti99_gkracker", "Miller's Graphics GRAM Kracker")
@ -141,16 +141,15 @@ ti99_gkracker_device::ti99_gkracker_device(const machine_config &mconfig, const
m_ram_ptr(nullptr),
m_grom_ptr(nullptr),
m_waddr_LSB(false),
m_cartridge(nullptr)
m_cartridge(*this, "cartridge")
{
}
void ti99_gkracker_device::romgq_line(int state)
{
m_romspace_selected = (state==ASSERT_LINE);
// Propagate to the guest
if (m_cartridge != nullptr)
m_cartridge->romgq_line(state);
// Propagate to the guest (if available)
m_cartridge->romgq_line(state);
}
/*
@ -159,14 +158,12 @@ void ti99_gkracker_device::romgq_line(int state)
void ti99_gkracker_device::set_gromlines(line_state mline, line_state moline, line_state gsq)
{
m_grom_selected = (gsq==ASSERT_LINE);
if (m_cartridge != nullptr)
m_cartridge->set_gromlines(mline, moline, gsq);
m_cartridge->set_gromlines(mline, moline, gsq);
}
void ti99_gkracker_device::gclock_in(int state)
{
if (m_cartridge != nullptr)
m_cartridge->gclock_in(state);
m_cartridge->gclock_in(state);
}
/*
@ -174,7 +171,7 @@ void ti99_gkracker_device::gclock_in(int state)
*/
bool ti99_gkracker_device::is_grom_idle()
{
return (m_cartridge != nullptr) ? m_cartridge->is_grom_idle() : false;
return m_cartridge->is_grom_idle();
}
void ti99_gkracker_device::readz(offs_t offset, uint8_t *value)
@ -224,25 +221,19 @@ void ti99_gkracker_device::readz(offs_t offset, uint8_t *value)
}
// If the guest has GROMs or ROMs they will override the GK contents
if (m_cartridge != nullptr)
{
// For debugging
uint8_t val1 = *value;
// For debugging
uint8_t val1 = *value;
// Read from the guest cartridge.
m_cartridge->readz(offset, value);
if (val1 != *value)
LOGMASKED(LOG_GKRACKER, "Read (from guest) %04x -> %02x\n", offset, *value);
}
// Read from the guest cartridge.
m_cartridge->readz(offset, value);
if (val1 != *value)
LOGMASKED(LOG_GKRACKER, "Read (from guest) %04x -> %02x\n", offset, *value);
}
void ti99_gkracker_device::write(offs_t offset, uint8_t data)
{
// write to the guest cartridge if present
if (m_cartridge != nullptr)
{
m_cartridge->write(offset, data);
}
m_cartridge->write(offset, data);
if (m_grom_selected)
{
@ -310,14 +301,12 @@ void ti99_gkracker_device::write(offs_t offset, uint8_t data)
void ti99_gkracker_device::crureadz(offs_t offset, uint8_t *value)
{
if (m_cartridge != nullptr)
m_cartridge->crureadz(offset, value);
m_cartridge->crureadz(offset, value);
}
void ti99_gkracker_device::cruwrite(offs_t offset, uint8_t data)
{
if (m_cartridge != nullptr)
m_cartridge->cruwrite(offset, data);
m_cartridge->cruwrite(offset, data);
}
INPUT_CHANGED_MEMBER( ti99_gkracker_device::gk_changed )
@ -326,21 +315,6 @@ INPUT_CHANGED_MEMBER( ti99_gkracker_device::gk_changed )
m_gk_switch[param & 0x07] = newval;
}
void ti99_gkracker_device::insert(int index, ti99_cartridge_device* cart)
{
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.
m_gromport->cartridge_inserted();
}
void ti99_gkracker_device::remove(int index)
{
LOGMASKED(LOG_CHANGE, "Remove cartridge\n");
m_cartridge = nullptr;
}
void ti99_gkracker_device::gk_install_menu(const char* menutext, int len, int ptr, int next, int start)
{
const int base = 0x0000;
@ -406,7 +380,8 @@ void ti99_gkracker_device::device_start()
{
m_ram_ptr = memregion(GKRACKER_NVRAM_TAG)->base();
m_grom_ptr = memregion(GKRACKER_ROM_TAG)->base();
m_cartridge = nullptr;
m_cartridge->set_connector(this);
for (int i=1; i < 6; i++) m_gk_switch[i] = 0;
save_pointer(NAME(m_gk_switch),6);
save_item(NAME(m_romspace_selected));
@ -444,7 +419,7 @@ const tiny_rom_entry *ti99_gkracker_device::device_rom_region() const
void ti99_gkracker_device::device_add_mconfig(machine_config &config)
{
TI99_CART(config, "cartridge", 0);
TI99_CART(config, m_cartridge, 0);
}
INPUT_PORTS_START(gkracker)

View File

@ -26,25 +26,23 @@ public:
void set_gromlines(line_state mline, line_state moline, line_state gsq) override;
void gclock_in(int state) override;
void insert(int index, ti99_cartridge_device* cart) override;
void remove(int index) override;
DECLARE_INPUT_CHANGED_MEMBER( gk_changed );
// We may have a cartridge plugged into the GK
bool is_grom_idle() override;
protected:
virtual void device_start() override;
virtual void device_reset() override;
void device_start() override;
void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
virtual const tiny_rom_entry* device_rom_region() const override;
virtual ioport_constructor device_input_ports() const override;
void device_add_mconfig(machine_config &config) override;
const tiny_rom_entry* device_rom_region() const override;
ioport_constructor device_input_ports() const override;
// device_nvram_interface
virtual void nvram_default() override;
virtual bool nvram_read(util::read_stream &file) override;
virtual bool nvram_write(util::write_stream &file) override;
void nvram_default() override;
bool nvram_read(util::read_stream &file) override;
bool nvram_write(util::write_stream &file) override;
private:
int m_gk_switch[6]; // Used to cache the switch settings.
@ -57,7 +55,7 @@ private:
bool m_waddr_LSB;
ti99_cartridge_device *m_cartridge; // guest cartridge
required_device<ti99_cartridge_device> m_cartridge;
// Just for proper initialization
void gk_install_menu(const char* menutext, int len, int ptr, int next, int start);

View File

@ -205,8 +205,9 @@ void gromport_device::set_gromlines(line_state mline, line_state moline, line_st
void gromport_device::device_start()
{
save_item(NAME(m_romgq));
if (m_connector != nullptr)
m_connector->set_port(this);
}
void gromport_device::device_reset()
@ -281,12 +282,6 @@ void cartridge_connector_device::ready_line(int state)
m_gromport->ready_line(state);
}
void cartridge_connector_device::device_config_complete()
{
m_gromport = dynamic_cast<gromport_device*>(owner());
// owner is the empty_state during -listxml, so this will be nullptr
}
} // end namespace bus::ti99::gromport
void ti99_gromport_options(device_slot_interface &device)

View File

@ -75,6 +75,8 @@ private:
class cartridge_connector_device : public device_t
{
friend class gromport_device;
public:
virtual void readz(offs_t offset, uint8_t *value) = 0;
virtual void write(offs_t offset, uint8_t data) = 0;
@ -90,16 +92,17 @@ public:
void ready_line(int state);
virtual void insert(int index, bus::ti99::gromport::ti99_cartridge_device* cart) { m_gromport->cartridge_inserted(); }
virtual void remove(int index) { }
virtual void insert() { m_gromport->cartridge_inserted(); }
virtual void remove() { }
virtual bool is_grom_idle() = 0;
protected:
cartridge_connector_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
virtual void device_config_complete() override;
gromport_device* m_gromport;
bool m_grom_selected;
void set_port(gromport_device* gromport) { m_gromport = gromport; }
};
} // end namespace bus::ti99::gromport

View File

@ -59,7 +59,11 @@ ti99_multi_cart_conn_device::ti99_multi_cart_conn_device(const machine_config &m
: cartridge_connector_device(mconfig, TI99_GROMPORT_MULTI, tag, owner, clock),
m_active_slot(0),
m_fixed_slot(0),
m_next_free_slot(0)
m_next_free_slot(0),
m_cart1(*this, "1"),
m_cart2(*this, "2"),
m_cart3(*this, "3"),
m_cart4(*this, "4")
{
}
@ -124,31 +128,13 @@ int ti99_multi_cart_conn_device::get_active_slot(bool changebase, offs_t offset)
return slot;
}
void ti99_multi_cart_conn_device::insert(int index, ti99_cartridge_device* cart)
{
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)
{
LOGMASKED(LOG_CHANGE, "Remove slot %d\n", index);
m_cartridge[index] = nullptr;
}
void ti99_multi_cart_conn_device::romgq_line(int state)
{
m_readrom = state;
// Propagate to all slots
for (int i=0; i < NUMBER_OF_CARTRIDGE_SLOTS; i++)
{
if (m_cartridge[i] != nullptr)
{
m_cartridge[i]->romgq_line(state);
}
}
m_cartridge[i]->romgq_line(state);
}
/*
@ -159,26 +145,14 @@ void ti99_multi_cart_conn_device::set_gromlines(line_state mline, line_state mol
// GROM selected?
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(mline, moline, gsq);
}
}
m_cartridge[i]->set_gromlines(mline, moline, gsq);
}
void ti99_multi_cart_conn_device::gclock_in(int state)
{
// Propagate to all slots
for (int i=0; i < NUMBER_OF_CARTRIDGE_SLOTS; i++)
{
if (m_cartridge[i] != nullptr)
{
m_cartridge[i]->gclock_in(state);
}
}
m_cartridge[i]->gclock_in(state);
}
void ti99_multi_cart_conn_device::readz(offs_t offset, uint8_t *value)
@ -192,23 +166,16 @@ void ti99_multi_cart_conn_device::readz(offs_t offset, uint8_t *value)
{
for (int i=0; i < NUMBER_OF_CARTRIDGE_SLOTS; i++)
{
if (m_cartridge[i] != nullptr)
{
uint8_t newval = *value;
m_cartridge[i]->readz(offset, &newval);
if (i==slot)
{
*value = newval;
}
}
uint8_t newval = *value;
m_cartridge[i]->readz(offset, &newval);
if (i==slot)
*value = newval;
}
}
else
{
if (slot < NUMBER_OF_CARTRIDGE_SLOTS && m_cartridge[slot] != nullptr)
{
if (slot < NUMBER_OF_CARTRIDGE_SLOTS)
m_cartridge[slot]->readz(offset, value);
}
}
}
@ -218,50 +185,32 @@ void ti99_multi_cart_conn_device::write(offs_t offset, uint8_t data)
// We don't have GRAM cartridges, anyway, so it's just used for setting the address.
if (m_grom_selected)
{
for (auto & elem : m_cartridge)
{
if (elem != nullptr)
{
elem->write(offset, data);
}
}
for (int i=0; i < NUMBER_OF_CARTRIDGE_SLOTS; i++)
m_cartridge[i]->write(offset, data);
}
else
{
int slot = get_active_slot(true, offset);
if (slot < NUMBER_OF_CARTRIDGE_SLOTS && m_cartridge[slot] != nullptr)
{
if (slot < NUMBER_OF_CARTRIDGE_SLOTS)
// logerror("writing %04x (slot %d) <- %02x\n", offset, slot, data);
m_cartridge[slot]->write(offset, data);
}
}
}
void ti99_multi_cart_conn_device::crureadz(offs_t offset, uint8_t *value)
{
int slot = get_active_slot(false, offset);
/* Sanity check. Higher slots are always empty. */
if (slot >= NUMBER_OF_CARTRIDGE_SLOTS)
return;
if (m_cartridge[slot] != nullptr)
{
// Sanity check. Higher slots are always empty.
if (slot < NUMBER_OF_CARTRIDGE_SLOTS)
m_cartridge[slot]->crureadz(offset, value);
}
}
void ti99_multi_cart_conn_device::cruwrite(offs_t offset, uint8_t data)
{
int slot = get_active_slot(false, offset);
/* Sanity check. Higher slots are always empty. */
if (slot >= NUMBER_OF_CARTRIDGE_SLOTS)
return;
if (m_cartridge[slot] != nullptr)
{
if (slot < NUMBER_OF_CARTRIDGE_SLOTS)
m_cartridge[slot]->cruwrite(offset, data);
}
}
/*
@ -270,11 +219,8 @@ void ti99_multi_cart_conn_device::cruwrite(offs_t offset, uint8_t data)
*/
bool ti99_multi_cart_conn_device::is_grom_idle()
{
/* Sanity check. Higher slots are always empty. */
if (m_active_slot >= NUMBER_OF_CARTRIDGE_SLOTS)
return false;
if (m_cartridge[m_active_slot] != nullptr)
// Sanity check. Higher slots are always empty.
if (m_active_slot < NUMBER_OF_CARTRIDGE_SLOTS)
return m_cartridge[m_active_slot]->is_grom_idle();
return false;
@ -284,14 +230,19 @@ void ti99_multi_cart_conn_device::device_start()
{
m_next_free_slot = 0;
m_active_slot = 0;
for (auto & elem : m_cartridge)
{
elem = nullptr;
}
save_item(NAME(m_readrom));
save_item(NAME(m_active_slot));
save_item(NAME(m_fixed_slot));
save_item(NAME(m_next_free_slot));
m_cartridge[0] = m_cart1;
m_cartridge[1] = m_cart2;
m_cartridge[2] = m_cart3;
m_cartridge[3] = m_cart4;
for (int i=0; i < NUMBER_OF_CARTRIDGE_SLOTS; i++)
m_cartridge[i]->set_connector(this);
}
void ti99_multi_cart_conn_device::device_reset(void)
@ -303,10 +254,10 @@ void ti99_multi_cart_conn_device::device_reset(void)
void ti99_multi_cart_conn_device::device_add_mconfig(machine_config &config)
{
TI99_CART(config, "cartridge1", 0);
TI99_CART(config, "cartridge2", 0);
TI99_CART(config, "cartridge3", 0);
TI99_CART(config, "cartridge4", 0);
TI99_CART(config, m_cart1, 0);
TI99_CART(config, m_cart2, 0);
TI99_CART(config, m_cart3, 0);
TI99_CART(config, m_cart4, 0);
}
INPUT_CHANGED_MEMBER( ti99_multi_cart_conn_device::switch_changed )

View File

@ -30,8 +30,6 @@ public:
void set_gromlines(line_state mline, line_state moline, line_state gsq) override;
void gclock_in(int state) override;
void insert(int index, ti99_cartridge_device* cart) override;
void remove(int index) override;
DECLARE_INPUT_CHANGED_MEMBER( switch_changed );
bool is_grom_idle() override;
@ -49,6 +47,12 @@ private:
int m_active_slot;
int m_fixed_slot;
int m_next_free_slot;
required_device<ti99_cartridge_device> m_cart1;
required_device<ti99_cartridge_device> m_cart2;
required_device<ti99_cartridge_device> m_cart3;
required_device<ti99_cartridge_device> m_cart4;
ti99_cartridge_device* m_cartridge[NUMBER_OF_CARTRIDGE_SLOTS];
void set_slot(int slotnumber);

View File

@ -15,7 +15,7 @@ namespace bus::ti99::gromport {
ti99_single_cart_conn_device::ti99_single_cart_conn_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: cartridge_connector_device(mconfig, TI99_GROMPORT_SINGLE, tag, owner, clock),
m_cartridge(nullptr)
m_cartridge(*this, "cartridge")
{
}
@ -73,19 +73,10 @@ bool ti99_single_cart_conn_device::is_grom_idle()
return m_cartridge->is_grom_idle();
}
void ti99_single_cart_conn_device::device_start()
{
m_cartridge = static_cast<ti99_cartridge_device*>(subdevices().first());
}
void ti99_single_cart_conn_device::device_reset()
{
m_cartridge->set_slot(0);
}
void ti99_single_cart_conn_device::device_add_mconfig(machine_config &config)
{
TI99_CART(config, "cartridge", 0);
TI99_CART(config, m_cartridge, 0);
m_cartridge->set_connector(this);
}
} // end namespace bus::ti99::gromport

View File

@ -29,12 +29,11 @@ public:
bool is_grom_idle() override;
protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
void device_start() override { };
void device_add_mconfig(machine_config &config) override;
private:
ti99_cartridge_device *m_cartridge;
required_device<ti99_cartridge_device> m_cartridge;
};
} // end namespace bus::ti99::gromport

View File

@ -591,7 +591,7 @@ ioport_constructor io992_device::device_input_ports() const
ti992_expport_device::ti992_expport_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, TI992_EXPPORT, tag, owner, clock),
device_slot_interface(mconfig, *this),
device_single_card_slot_interface<ti992_expport_attached_device>(mconfig, *this),
m_connected(nullptr)
{
}
@ -610,7 +610,7 @@ void ti992_expport_device::write(offs_t offset, uint8_t data)
void ti992_expport_device::device_config_complete()
{
m_connected = static_cast<ti992_expport_attached_device*>(subdevices().first());
m_connected = get_card_device();
}
/*

View File

@ -174,10 +174,8 @@ public:
virtual void write(offs_t offset, uint8_t data) { }
};
class ti992_expport_device : public device_t, public device_slot_interface
class ti992_expport_device : public device_t, public device_single_card_slot_interface<ti992_expport_attached_device>
{
friend class expport_attached_device;
public:
template <typename U>
ti992_expport_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, U &&opts, const char *dflt)

View File

@ -94,6 +94,10 @@ snug_bwg_device::snug_bwg_device(const machine_config &mconfig, const char *tag,
m_address(0),
m_dsrrom(nullptr),
m_buffer_ram(*this, BUFFER),
m_flopcon0(*this, "0"),
m_flopcon1(*this, "1"),
m_flopcon2(*this, "2"),
m_flopcon3(*this, "3"),
m_sel_floppy(0),
m_wd1773(*this, FDC_TAG),
m_clock(*this, CLOCK_TAG),
@ -541,6 +545,11 @@ void snug_bwg_device::device_reset()
m_address = 0;
m_WDsel = false;
m_WDsel0 = false;
m_floppy[0] = m_flopcon0->get_device();
m_floppy[1] = m_flopcon1->get_device();
m_floppy[2] = m_flopcon2->get_device();
m_floppy[3] = m_flopcon3->get_device();
for (int i=0; i < 4; i++)
{
@ -557,18 +566,6 @@ void snug_bwg_device::device_reset()
m_dip34 = ioport("BWGDIP34")->read();
}
void snug_bwg_device::device_config_complete()
{
for (auto & elem : m_floppy)
elem = nullptr;
// Seems to be null when doing a "-listslots"
if (subdevice("0")!=nullptr) m_floppy[0] = static_cast<floppy_image_device*>(subdevice("0")->subdevices().first());
if (subdevice("1")!=nullptr) m_floppy[1] = static_cast<floppy_image_device*>(subdevice("1")->subdevices().first());
if (subdevice("2")!=nullptr) m_floppy[2] = static_cast<floppy_image_device*>(subdevice("2")->subdevices().first());
if (subdevice("3")!=nullptr) m_floppy[3] = static_cast<floppy_image_device*>(subdevice("3")->subdevices().first());
}
INPUT_PORTS_START( bwg_fdc )
PORT_START( "BWGDIP1" )
PORT_DIPNAME( 0x01, 0x00, "BwG step rate" )
@ -615,10 +612,10 @@ void snug_bwg_device::device_add_mconfig(machine_config& config)
MM58274C(config, CLOCK_TAG, 32.768_kHz_XTAL).set_mode_and_day(1, 0); // 24h, sunday
FLOPPY_CONNECTOR(config, "0", bwg_floppies, "525dd", snug_bwg_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "1", bwg_floppies, "525dd", snug_bwg_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "2", bwg_floppies, nullptr, snug_bwg_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "3", bwg_floppies, nullptr, snug_bwg_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_flopcon0, bwg_floppies, "525dd", snug_bwg_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_flopcon1, bwg_floppies, "525dd", snug_bwg_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_flopcon2, bwg_floppies, nullptr, snug_bwg_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_flopcon3, bwg_floppies, nullptr, snug_bwg_device::floppy_formats).enable_sound(true);
RAM(config, BUFFER).set_default_size("2K").set_default_value(0);

View File

@ -41,7 +41,6 @@ public:
protected:
void device_start() override;
void device_reset() override;
void device_config_complete() override;
const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
@ -113,6 +112,10 @@ private:
required_device<ram_device> m_buffer_ram;
// Link to the attached floppy drives
required_device<floppy_connector> m_flopcon0;
required_device<floppy_connector> m_flopcon1;
required_device<floppy_connector> m_flopcon2;
required_device<floppy_connector> m_flopcon3;
floppy_image_device* m_floppy[4];
// Currently selected floppy drive (1-4, 0=none)

View File

@ -72,12 +72,16 @@ namespace bus::ti99::peb {
// ----------------------------------
corcomp_fdc_device::corcomp_fdc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock):
corcomp_fdc_device::corcomp_fdc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, const char *dpname, const char *cpname):
device_t(mconfig, type, tag, owner, clock),
device_ti99_peribox_card_interface(mconfig, *this),
m_wdc(*this, WDC_TAG),
m_decpal(nullptr),
m_ctrlpal(nullptr),
m_decpal(*this, dpname),
m_ctrlpal(*this, cpname),
m_flopcon0(*this, "0"),
m_flopcon1(*this, "1"),
m_flopcon2(*this, "2"),
m_flopcon3(*this, "3"),
m_motormf(*this, MOTORMF_TAG),
m_tms9901(*this, TMS9901_TAG),
m_buffer_ram(*this, BUFFER),
@ -426,6 +430,11 @@ void corcomp_fdc_device::device_start()
void corcomp_fdc_device::device_reset()
{
m_floppy[0] = m_flopcon0->get_device();
m_floppy[1] = m_flopcon1->get_device();
m_floppy[2] = m_flopcon2->get_device();
m_floppy[3] = m_flopcon3->get_device();
for (int i=0; i < 4; i++)
{
if (m_floppy[i] != nullptr)
@ -433,17 +442,10 @@ void corcomp_fdc_device::device_reset()
else
LOGMASKED(LOG_CONFIG, "Connector %d has no floppy attached\n", i);
}
}
void corcomp_fdc_device::connect_drives()
{
for (auto & elem : m_floppy)
elem = nullptr;
if (subdevice("0")!=nullptr) m_floppy[0] = static_cast<floppy_image_device*>(subdevice("0")->subdevices().first());
if (subdevice("1")!=nullptr) m_floppy[1] = static_cast<floppy_image_device*>(subdevice("1")->subdevices().first());
if (subdevice("2")!=nullptr) m_floppy[2] = static_cast<floppy_image_device*>(subdevice("2")->subdevices().first());
if (subdevice("3")!=nullptr) m_floppy[3] = static_cast<floppy_image_device*>(subdevice("3")->subdevices().first());
m_decpal->set_board(this);
m_ctrlpal->set_board(this);
m_ctrlpal->set_decoder(m_decpal);
}
INPUT_PORTS_START( cc_fdc )
@ -542,7 +544,7 @@ void corcomp_fdc_device::common_config(machine_config& config)
// ============================================================================
corcomp_dcc_device::corcomp_dcc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock):
corcomp_fdc_device(mconfig, TI99_CCDCC, tag, owner, clock)
corcomp_fdc_device(mconfig, TI99_CCDCC, tag, owner, clock, CCDCC_PALU2_TAG, CCDCC_PALU1_TAG)
{
}
@ -565,14 +567,6 @@ ROM_START( cc_dcc )
ROM_LOAD("ccdcc_v89.u4", 0x2000, 0x2000, CRC(9c4e5c08) SHA1(26f8096ae60f3839902b4e8764c5fde283ad4ba2)) /* 8K single ROM bank 2*/
ROM_END
void corcomp_dcc_device::device_config_complete()
{
m_decpal = dynamic_cast<ccfdc_dec_pal_device*>(subdevice(CCDCC_PALU2_TAG));
m_ctrlpal = dynamic_cast<ccfdc_sel_pal_device*>(subdevice(CCDCC_PALU1_TAG));
if (m_decpal != nullptr)
connect_drives();
}
ioport_constructor corcomp_fdc_device::device_input_ports() const
{
return INPUT_PORTS_NAME( cc_fdc );
@ -604,12 +598,6 @@ ccfdc_sel_pal_device::ccfdc_sel_pal_device(const machine_config &mconfig, device
{
}
void ccfdc_dec_pal_device::device_config_complete()
{
m_board = dynamic_cast<corcomp_fdc_device*>(owner());
// owner is the empty_state during -listxml, so this will be nullptr
}
/*
Indicates 9901 addressing.
*/
@ -707,19 +695,12 @@ int ccdcc_palu1_device::ready_out()
return ready;
}
void ccdcc_palu1_device::device_config_complete()
{
m_board = dynamic_cast<corcomp_fdc_device*>(owner());
m_decpal = dynamic_cast<ccfdc_dec_pal_device*>(owner()->subdevice(CCDCC_PALU2_TAG));
// owner is the empty_state during -listxml, so this will be nullptr
}
// ============================================================================
// Revised CorComp floppy disk controller card REV A
// ============================================================================
corcomp_fdca_device::corcomp_fdca_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock):
corcomp_fdc_device(mconfig, TI99_CCFDC, tag, owner, clock)
corcomp_fdc_device(mconfig, TI99_CCFDC, tag, owner, clock, CCFDC_PALU12_TAG, CCFDC_PALU6_TAG)
{
}
@ -749,13 +730,6 @@ ROM_START( cc_fdcmg )
ROM_LOAD("ccfdc_v89mg.u2", 0x2000, 0x2000, CRC(0cad8f5b) SHA1(7744f777b51eedf614f766576bbc3f8c2c2e0042)) /* 16K single ROM */
ROM_END
void corcomp_fdca_device::device_config_complete()
{
m_decpal = static_cast<ccfdc_dec_pal_device*>(subdevice(CCFDC_PALU12_TAG));
m_ctrlpal = static_cast<ccfdc_sel_pal_device*>(subdevice(CCFDC_PALU6_TAG));
connect_drives();
}
const tiny_rom_entry *corcomp_fdca_device::device_rom_region() const
{
return ROM_NAME( cc_fdcmg );
@ -816,7 +790,12 @@ int ccfdc_palu6_device::ready_out()
{
bool wdc = m_decpal->addresswdc(); // Addressing the WDC
bool even = (m_board->get_address()&1)==0; // A15 = 0
bool trap = static_cast<corcomp_fdca_device*>(m_board)->ready_trap_active(); // READY trap active
bool trap = false;
// The PAL u6 is only used on the Rev A board
corcomp_fdca_device* boarda = static_cast<corcomp_fdca_device*>(m_board);
trap = boarda->ready_trap_active(); // READY trap active
bool waitbyte = m_wdc->drq_r()==CLEAR_LINE; // We are waiting for a byte
bool noterm = m_wdc->intrq_r()==CLEAR_LINE; // There is no interrupt yet
@ -826,10 +805,4 @@ int ccfdc_palu6_device::ready_out()
return ready;
}
void ccfdc_palu6_device::device_config_complete()
{
m_board = dynamic_cast<corcomp_fdca_device*>(owner());
m_decpal = dynamic_cast<ccfdc_dec_pal_device*>(owner()->subdevice(CCFDC_PALU12_TAG));
}
} // end namespace bus::ti99::peb

View File

@ -57,11 +57,10 @@ public:
void select_bank(int state);
protected:
corcomp_fdc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
corcomp_fdc_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, const char *dpname, const char *cpname);
void device_start() override;
void device_reset() override;
void connect_drives();
virtual void device_add_mconfig(machine_config &config) override =0;
ioport_constructor device_input_ports() const override;
@ -74,8 +73,8 @@ protected:
required_device<wd_fdc_device_base> m_wdc;
// PALs
ccfdc_dec_pal_device* m_decpal;
ccfdc_sel_pal_device* m_ctrlpal;
required_device<ccfdc_dec_pal_device> m_decpal;
required_device<ccfdc_sel_pal_device> m_ctrlpal;
// Lines that are polled by the PAL chips
bool card_selected();
@ -90,6 +89,10 @@ protected:
void operate_ready_line();
// Link to the attached floppy drives
required_device<floppy_connector> m_flopcon0;
required_device<floppy_connector> m_flopcon1;
required_device<floppy_connector> m_flopcon2;
required_device<floppy_connector> m_flopcon3;
floppy_image_device* m_floppy[4];
// Motor monoflop
@ -133,13 +136,13 @@ public:
corcomp_dcc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
private:
void device_add_mconfig(machine_config &config) override;
void device_config_complete() override;
const tiny_rom_entry *device_rom_region() const override;
};
// =========== Decoder PAL circuit ================
class ccfdc_dec_pal_device : public device_t
{
friend class corcomp_fdc_device;
public:
int addresswdc();
int address4();
@ -150,16 +153,18 @@ protected:
ccfdc_dec_pal_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
void device_start() override { }
void device_config_complete() override;
corcomp_fdc_device* m_board;
required_device<tms9901_device> m_tms9901;
void set_board(corcomp_fdc_device* board) { m_board = board; }
};
// =========== Selector PAL circuit ================
class ccfdc_sel_pal_device : public device_t
{
friend class corcomp_fdc_device;
public:
int selectram();
virtual int selectwdc();
@ -170,13 +175,15 @@ protected:
ccfdc_sel_pal_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
void device_start() override { }
virtual void device_config_complete() override =0;
corcomp_fdc_device* m_board;
ccfdc_dec_pal_device* m_decpal;
required_device<ttl74123_device> m_motormf;
required_device<tms9901_device> m_tms9901;
required_device<wd_fdc_device_base> m_wdc;
void set_board(corcomp_fdc_device* board) { m_board = board; }
void set_decoder(ccfdc_dec_pal_device* decpal) { m_decpal = decpal; }
};
// =========== Specific decoder PAL circuit of the CCDCC ================
@ -194,9 +201,6 @@ class ccdcc_palu1_device : public ccfdc_sel_pal_device
public:
ccdcc_palu1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
int ready_out() override;
private:
void device_config_complete() override;
};
// ============================================================================
@ -211,7 +215,6 @@ public:
corcomp_fdca_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
private:
void device_add_mconfig(machine_config &config) override;
void device_config_complete() override;
const tiny_rom_entry *device_rom_region() const override;
bool ready_trap_active();
};
@ -235,9 +238,6 @@ public:
int selectdsr() override;
int ready_out() override;
private:
void device_config_complete() override;
};
} // end namespace bus::ti99::peb

View File

@ -102,6 +102,13 @@ myarc_hfdc_device::myarc_hfdc_device(const machine_config &mconfig, const char *
m_motor_on_timer(nullptr),
m_hdc9234(*this, FDC_TAG),
m_clock(*this, CLOCK_TAG),
m_flopcon0(*this, "f1"),
m_flopcon1(*this, "f2"),
m_flopcon2(*this, "f3"),
m_flopcon3(*this, "f4"),
m_hardcon0(*this, "h1"),
m_hardcon1(*this, "h2"),
m_hardcon2(*this, "h3"),
m_current_floppy(nullptr),
m_current_harddisk(nullptr),
m_current_floppy_index(NONE),
@ -942,6 +949,15 @@ void myarc_hfdc_device::device_reset()
m_selected = false;
m_lastval = 0;
m_readyflags = 0;
m_floppy_unit[0] = m_flopcon0->get_device();
m_floppy_unit[1] = m_flopcon1->get_device();
m_floppy_unit[2] = m_flopcon2->get_device();
m_floppy_unit[3] = m_flopcon3->get_device();
m_harddisk_unit[0] = m_hardcon0->get_device();
m_harddisk_unit[1] = m_hardcon1->get_device();
m_harddisk_unit[2] = m_hardcon2->get_device();
for (int i=0; i < 4; i++)
{
@ -964,29 +980,6 @@ void myarc_hfdc_device::device_reset()
disconnect_hard_drives();
}
void myarc_hfdc_device::device_config_complete()
{
for (int i=0; i < 3; i++)
{
m_floppy_unit[i] = nullptr;
m_harddisk_unit[i] = nullptr;
}
m_floppy_unit[3] = nullptr;
// Seems to be null when doing a "-listslots"
if (subdevice("f1")!=nullptr)
{
m_floppy_unit[0] = static_cast<floppy_connector*>(subdevice("f1"))->get_device();
m_floppy_unit[1] = static_cast<floppy_connector*>(subdevice("f2"))->get_device();
m_floppy_unit[2] = static_cast<floppy_connector*>(subdevice("f3"))->get_device();
m_floppy_unit[3] = static_cast<floppy_connector*>(subdevice("f4"))->get_device();
m_harddisk_unit[0] = static_cast<mfm_harddisk_connector*>(subdevice("h1"))->get_device();
m_harddisk_unit[1] = static_cast<mfm_harddisk_connector*>(subdevice("h2"))->get_device();
m_harddisk_unit[2] = static_cast<mfm_harddisk_connector*>(subdevice("h3"))->get_device();
}
}
/*
The HFDC controller can be configured for different CRU base addresses,
but DSK1-DSK4 are only available for CRU 1100. For all other addresses,
@ -1080,15 +1073,15 @@ void myarc_hfdc_device::device_add_mconfig(machine_config& config)
m_hdc9234->dmaout_cb().set(FUNC(myarc_hfdc_device::write_buffer));
// First two floppy drives shall be connected by default
FLOPPY_CONNECTOR(config, "f1", hfdc_floppies, "525dd", myarc_hfdc_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "f2", hfdc_floppies, "525dd", myarc_hfdc_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "f3", hfdc_floppies, nullptr, myarc_hfdc_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "f4", hfdc_floppies, nullptr, myarc_hfdc_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_flopcon0, hfdc_floppies, "525dd", myarc_hfdc_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_flopcon1, hfdc_floppies, "525dd", myarc_hfdc_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_flopcon2, hfdc_floppies, nullptr, myarc_hfdc_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_flopcon3, hfdc_floppies, nullptr, myarc_hfdc_device::floppy_formats).enable_sound(true);
// Hard disks don't go without image (other than floppy drives)
MFM_HD_CONNECTOR(config, "h1", hfdc_harddisks, nullptr, MFM_BYTE, 3000, 20, MFMHD_GEN_FORMAT);
MFM_HD_CONNECTOR(config, "h2", hfdc_harddisks, nullptr, MFM_BYTE, 3000, 20, MFMHD_GEN_FORMAT);
MFM_HD_CONNECTOR(config, "h3", hfdc_harddisks, nullptr, MFM_BYTE, 3000, 20, MFMHD_GEN_FORMAT);
MFM_HD_CONNECTOR(config, m_hardcon0, hfdc_harddisks, nullptr, MFM_BYTE, 3000, 20, MFMHD_GEN_FORMAT);
MFM_HD_CONNECTOR(config, m_hardcon1, hfdc_harddisks, nullptr, MFM_BYTE, 3000, 20, MFMHD_GEN_FORMAT);
MFM_HD_CONNECTOR(config, m_hardcon2, hfdc_harddisks, nullptr, MFM_BYTE, 3000, 20, MFMHD_GEN_FORMAT);
MM58274C(config, CLOCK_TAG, 0).set_mode_and_day(1, 0); // 24h, sunday

View File

@ -44,8 +44,6 @@ public:
virtual void cruwrite(offs_t offset, uint8_t data) override;
protected:
virtual void device_config_complete() override;
virtual void device_start() override;
virtual void device_reset() override;
@ -101,9 +99,16 @@ private:
required_device<mm58274c_device> m_clock;
// Link to the attached floppy drives
required_device<floppy_connector> m_flopcon0;
required_device<floppy_connector> m_flopcon1;
required_device<floppy_connector> m_flopcon2;
required_device<floppy_connector> m_flopcon3;
floppy_image_device* m_floppy_unit[4];
// Link to the attached hard disks
required_device<mfm_harddisk_connector> m_hardcon0;
required_device<mfm_harddisk_connector> m_hardcon1;
required_device<mfm_harddisk_connector> m_hardcon2;
mfm_harddisk_device* m_harddisk_unit[3];
// Currently selected floppy drive

View File

@ -64,6 +64,10 @@ myarc_fdc_device::myarc_fdc_device(const machine_config &mconfig, const char *ta
m_buffer_ram(*this, BUFFER_TAG),
m_pal(*this, PAL_TAG),
m_dsrrom(nullptr),
m_flopcon0(*this, "0"),
m_flopcon1(*this, "1"),
m_flopcon2(*this, "2"),
m_flopcon3(*this, "3"),
m_banksel(false),
m_cardsel(false),
m_selected_drive(0),
@ -356,23 +360,27 @@ void myarc_fdc_device::device_start()
void myarc_fdc_device::device_reset()
{
m_floppy[0] = m_flopcon0->get_device();
m_floppy[1] = m_flopcon1->get_device();
m_floppy[2] = m_flopcon2->get_device();
m_floppy[3] = m_flopcon3->get_device();
for (int i=0; i < 4; i++)
{
if (m_floppy[i] != nullptr)
LOGMASKED(LOG_CONFIG, "Connector %d with %s\n", i, m_floppy[i]->name());
else
LOGMASKED(LOG_CONFIG, "Connector %d has no floppy attached\n", i);
}
if (ioport("CONTROLLER")->read()==0)
m_wdc = m_wd1770;
else
m_wdc = m_wd1772;
m_dec_high = (ioport("AMADECODE")->read()!=0);
}
void myarc_fdc_device::device_config_complete()
{
for (auto & elem : m_floppy)
elem = nullptr;
if (subdevice("0")!=nullptr) m_floppy[0] = static_cast<floppy_image_device*>(subdevice("0")->subdevices().first());
if (subdevice("1")!=nullptr) m_floppy[1] = static_cast<floppy_image_device*>(subdevice("1")->subdevices().first());
if (subdevice("2")!=nullptr) m_floppy[2] = static_cast<floppy_image_device*>(subdevice("2")->subdevices().first());
if (subdevice("3")!=nullptr) m_floppy[3] = static_cast<floppy_image_device*>(subdevice("3")->subdevices().first());
m_pal->set_board(this);
}
void myarc_fdc_device::floppy_formats(format_registration &fr)
@ -512,10 +520,4 @@ bool ddcc1_pal_device::cs259()
return ((m_board->get_address() & 0xff00)==0x1100);
}
void ddcc1_pal_device::device_config_complete()
{
m_board = dynamic_cast<myarc_fdc_device*>(owner());
// owner is the empty_state during -listxml, so this will be nullptr
}
} // end namespace bus::ti99::peb

View File

@ -41,7 +41,6 @@ public:
private:
void device_start() override;
void device_reset() override;
void device_config_complete() override;
const tiny_rom_entry *device_rom_region() const override;
void device_add_mconfig(machine_config &config) override;
@ -86,6 +85,10 @@ private:
uint8_t* m_dsrrom;
// Link to the attached floppy drives
required_device<floppy_connector> m_flopcon0;
required_device<floppy_connector> m_flopcon1;
required_device<floppy_connector> m_flopcon2;
required_device<floppy_connector> m_flopcon3;
floppy_image_device* m_floppy[4];
// Debugger accessors
@ -111,6 +114,8 @@ private:
// =========== Decoder PAL circuit ================
class ddcc1_pal_device : public device_t
{
friend class myarc_fdc_device;
public:
ddcc1_pal_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@ -122,10 +127,9 @@ public:
bool cs259();
private:
void device_start() override { }
void device_config_complete() override;
void device_start() override { }
myarc_fdc_device* m_board;
void set_board(myarc_fdc_device* board) { m_board = board; }
};
} // end namespace bus::ti99::peb

View File

@ -683,6 +683,7 @@ peribox_slot_device::peribox_slot_device(const machine_config &mconfig, const ch
device_t(mconfig, TI99_PERIBOX_SLOT, tag, owner, clock),
device_single_card_slot_interface<device_ti99_peribox_card_interface>(mconfig, *this),
m_card(nullptr),
m_peb(nullptr),
m_slotnumber(0)
{
}
@ -739,9 +740,9 @@ void peribox_slot_device::device_start()
void peribox_slot_device::device_config_complete()
{
m_card = get_card_device();
peribox_device *peb = dynamic_cast<peribox_device*>(owner());
if (peb)
peb->set_slot_loaded(m_slotnumber, m_card ? this : nullptr);
m_peb = dynamic_cast<peribox_device*>(owner());
if (m_peb)
m_peb->set_slot_loaded(m_slotnumber, m_card ? this : nullptr);
}
/*
@ -750,26 +751,26 @@ void peribox_slot_device::device_config_complete()
*/
void peribox_slot_device::set_inta(int state)
{
peribox_device *peb = static_cast<peribox_device*>(owner());
peb->inta_join(m_slotnumber, state);
if (m_peb)
m_peb->inta_join(m_slotnumber, state);
}
void peribox_slot_device::set_intb(int state)
{
peribox_device *peb = static_cast<peribox_device*>(owner());
peb->intb_join(m_slotnumber, state);
if (m_peb)
m_peb->intb_join(m_slotnumber, state);
}
void peribox_slot_device::lcp_line(int state)
{
peribox_device *peb = static_cast<peribox_device*>(owner());
peb->lcp_join(m_slotnumber, state);
if (m_peb)
m_peb->lcp_join(m_slotnumber, state);
}
void peribox_slot_device::set_ready(int state)
{
peribox_device *peb = static_cast<peribox_device*>(owner());
peb->ready_join(m_slotnumber, state);
if (m_peb)
m_peb->ready_join(m_slotnumber, state);
}
/***************************************************************************/

View File

@ -257,6 +257,7 @@ protected:
private:
int get_index_from_tagname();
device_ti99_peribox_card_interface *m_card;
peribox_device *m_peb;
int m_slotnumber;
const char* card_name() { return m_card->device().tag(); }
};

View File

@ -375,7 +375,8 @@ void whtech_scsi_card_device::device_add_mconfig(machine_config &config)
RAM(config, BUFFER).set_default_size("32K").set_default_value(0);
// PLD circuit
WHTSCSI_PLD(config, PLD_TAG, 0);
WHTSCSI_PLD(config, m_pld, 0);
m_pld->set_board(this);
// SCSI bus
NSCSI_BUS(config, m_scsibus);
@ -695,10 +696,4 @@ void whtscsi_pld_device::update_line_states(int address, bool drq, bool irq)
m_readyout = (irq || !m_dma_lock)? true : drq;
}
void whtscsi_pld_device::device_config_complete()
{
m_board = dynamic_cast<whtech_scsi_card_device*>(owner());
// owner is the empty_state during -listxml, so this will be nullptr
}
} // end namespace bus::ti99::peb

View File

@ -93,6 +93,8 @@ private:
class whtscsi_pld_device : public device_t
{
friend class whtech_scsi_card_device;
public:
whtscsi_pld_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@ -116,10 +118,10 @@ public:
private:
void device_start() override;
void device_reset() override;
void device_config_complete() override;
whtech_scsi_card_device* m_board;
void set_board(whtech_scsi_card_device* board) { m_board = board; }
bool busen();
// Flags

View File

@ -29,7 +29,7 @@
#define LOG_MOTOR (1U << 10)
#define LOG_ADDRESS (1U << 11)
#define VERBOSE (LOG_CONFIG | LOG_WARN)
#define VERBOSE (LOG_GENERAL | LOG_CONFIG | LOG_WARN)
#include "logmacro.h"
DEFINE_DEVICE_TYPE(TI99_FDC, bus::ti99::peb::ti_fdc_device, "ti99_fdc", "TI-99 Standard DSSD Floppy Controller")
@ -56,6 +56,9 @@ ti_fdc_device::ti_fdc_device(const machine_config &mconfig, const char *tag, dev
m_crulatch(*this, "crulatch"),
m_motormf(*this, "motormf"),
m_dsrrom(nullptr),
m_flopcon0(*this, "0"),
m_flopcon1(*this, "1"),
m_flopcon2(*this, "2"),
m_sel_floppy(0)
{
}
@ -281,7 +284,8 @@ void ti_fdc_device::sidsel_w(int state)
{
// Select side of disk (bit 7)
LOGMASKED(LOG_CRU, "Set side (bit 7) = %d\n", state);
if (m_sel_floppy != 0) m_floppy[m_sel_floppy-1]->ss_w(state);
if (m_sel_floppy > 0)
m_floppy[m_sel_floppy-1]->ss_w(state);
}
/*
@ -323,7 +327,7 @@ void ti_fdc_device::select_drive(int n, int state)
{
LOGMASKED(LOG_WARN, "Warning: DSK%d selected while DSK%d not yet unselected\n", n, m_sel_floppy);
}
if (m_floppy[n-1] != nullptr)
{
m_sel_floppy = n;
@ -357,7 +361,11 @@ void ti_fdc_device::device_reset()
m_selected = false;
m_inDsrArea = false;
m_WDsel = false;
m_floppy[0] = m_flopcon0->get_device();
m_floppy[1] = m_flopcon1->get_device();
m_floppy[2] = m_flopcon2->get_device();
for (int i=0; i < 3; i++)
{
if (m_floppy[i] != nullptr)
@ -365,20 +373,10 @@ void ti_fdc_device::device_reset()
else
LOGMASKED(LOG_CONFIG, "No floppy attached to connector %d\n", i);
}
m_sel_floppy = 0;
}
void ti_fdc_device::device_config_complete()
{
// Seems to be null when doing a "-listslots"
for (auto &elem : m_floppy)
elem = nullptr;
if (subdevice("0")!=nullptr) m_floppy[0] = static_cast<floppy_image_device*>(subdevice("0")->subdevices().first());
if (subdevice("1")!=nullptr) m_floppy[1] = static_cast<floppy_image_device*>(subdevice("1")->subdevices().first());
if (subdevice("2")!=nullptr) m_floppy[2] = static_cast<floppy_image_device*>(subdevice("2")->subdevices().first());
}
void ti_fdc_device::floppy_formats(format_registration &fr)
{
fr.add_mfm_containers();
@ -404,9 +402,9 @@ void ti_fdc_device::device_add_mconfig(machine_config& config)
m_fd1771->drq_wr_callback().set(FUNC(ti_fdc_device::fdc_drq_w));
m_fd1771->hld_wr_callback().set(FUNC(ti_fdc_device::fdc_hld_w));
FLOPPY_CONNECTOR(config, "0", tifdc_floppies, "525dd", ti_fdc_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "1", tifdc_floppies, "525dd", ti_fdc_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "2", tifdc_floppies, nullptr, ti_fdc_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_flopcon0, tifdc_floppies, "525dd", ti_fdc_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_flopcon1, tifdc_floppies, "525dd", ti_fdc_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, m_flopcon2, tifdc_floppies, nullptr, ti_fdc_device::floppy_formats).enable_sound(true);
LS259(config, m_crulatch); // U23
m_crulatch->q_out_cb<0>().set(FUNC(ti_fdc_device::dskpgena_w));

View File

@ -40,7 +40,6 @@ public:
protected:
void device_start() override;
void device_reset() override;
void device_config_complete() override;
const tiny_rom_entry *device_rom_region() const override;
virtual void device_add_mconfig(machine_config &config) override;
@ -105,8 +104,11 @@ private:
uint8_t* m_dsrrom;
// Link to the attached floppy drives
required_device<floppy_connector> m_flopcon0;
required_device<floppy_connector> m_flopcon1;
required_device<floppy_connector> m_flopcon2;
floppy_image_device* m_floppy[3];
// Currently selected floppy drive
int m_sel_floppy;
};

View File

@ -206,17 +206,15 @@ void ti_rs232_attached_device::call_unload()
*/
std::pair<std::error_condition, std::string> ti_pio_attached_device::call_load()
{
ti_rs232_pio_device* card = static_cast<ti_rs232_pio_device*>(owner());
// tell whether the image is readable
card->m_pio_readable = true;
m_card->m_pio_readable = true;
// tell whether the image is writable
card->m_pio_writable = !is_readonly();
m_card->m_pio_writable = !is_readonly();
if (card->m_pio_write && card->m_pio_writable)
card->m_pio_handshakein = false; // receiver ready
if (m_card->m_pio_write && m_card->m_pio_writable)
m_card->m_pio_handshakein = false; // receiver ready
else
card->m_pio_handshakein = true;
m_card->m_pio_handshakein = true;
return std::make_pair(std::error_condition(), std::string()); // OK
}
@ -226,11 +224,9 @@ std::pair<std::error_condition, std::string> ti_pio_attached_device::call_load()
*/
void ti_pio_attached_device::call_unload()
{
ti_rs232_pio_device* card = static_cast<ti_rs232_pio_device*>(owner());
card->m_pio_writable = false;
card->m_pio_handshakein = true; /* receiver not ready */
card->m_pio_sparein = false;
m_card->m_pio_writable = false;
m_card->m_pio_handshakein = true; /* receiver not ready */
m_card->m_pio_sparein = false;
}
/****************************************************************************/
@ -1108,6 +1104,7 @@ void ti_rs232_pio_device::device_add_mconfig(machine_config &config)
m_serdev1->connect(m_uart1);
TI99_PIO_DEV(config, m_piodev, 0);
m_piodev->set_card(this);
LS259(config, m_crulatch); // U12
m_crulatch->q_out_cb<0>().set(FUNC(ti_rs232_pio_device::selected_w));

View File

@ -159,6 +159,7 @@ private:
*/
class ti_pio_attached_device : public device_t, public device_image_interface
{
friend class ti_rs232_pio_device;
public:
ti_pio_attached_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
@ -176,6 +177,10 @@ protected:
void device_start() override { }
std::pair<std::error_condition, std::string> call_load() override;
void call_unload() override;
private:
ti_rs232_pio_device* m_card;
void set_card(ti_rs232_pio_device* card) { m_card = card; }
};
} // end namespace bus::ti99::peb