diff --git a/hash/c64_cart.xml b/hash/c64_cart.xml index bd149d2bb55..2bc71509304 100644 --- a/hash/c64_cart.xml +++ b/hash/c64_cart.xml @@ -84,10 +84,11 @@ - + Triton QD TDOS 1.2 198? Radofin + diff --git a/src/mess/machine/c64/tdos.c b/src/mess/machine/c64/tdos.c index 852b8b5bb25..5797e313694 100644 --- a/src/mess/machine/c64/tdos.c +++ b/src/mess/machine/c64/tdos.c @@ -43,13 +43,27 @@ |==========================================| ROM - Hitachi HN482764G 8Kx8 EPROM "TDOS 1.2" - ULA - Ferranti ULA5RB073E1 XZ-2085-1 custom (?) + ULA - Ferranti ULA5RB073E1 XZ-2085-1 40-pin custom ULA SSDA - Motorola MC68A52P SSDA CN1 - C64 expansion connector (pass-thru) CN2,3 - 19x1 flat ribbon cable to other PCB CN4 - 9 wires to 3" drive SW1 - cartridge on/off switch + + Drive cable pinout + ------------------ + 1 WP + 2 WD + 3 WG + 4 MO + 5 RD + 6 RY + 7 MS + 8 RS + 9 +5V + 10 GND + */ #include "tdos.h" @@ -82,8 +96,8 @@ static MC6852_INTERFACE( ssda_intf ) DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, + DEVCB_LINE_GND, + DEVCB_LINE_GND, DEVCB_NULL, DEVCB_NULL }; @@ -111,6 +125,28 @@ machine_config_constructor c64_tdos_cartridge_device::device_mconfig_additions() } +//------------------------------------------------- +// INPUT_PORTS( c64_tdos ) +//------------------------------------------------- + +static INPUT_PORTS_START( c64_tdos ) + PORT_START("SW1") + PORT_DIPNAME( 0x01, 0x01, "Enabled" ) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x01, DEF_STR( On ) ) +INPUT_PORTS_END + + +//------------------------------------------------- +// input_ports - device-specific input ports +//------------------------------------------------- + +ioport_constructor c64_tdos_cartridge_device::device_input_ports() const +{ + return INPUT_PORTS_NAME( c64_tdos ); +} + + //************************************************************************** // LIVE DEVICE @@ -124,7 +160,8 @@ c64_tdos_cartridge_device::c64_tdos_cartridge_device(const machine_config &mconf device_t(mconfig, C64_TDOS, "C64 TDOS cartridge", tag, owner, clock, "c64_tdos", __FILE__), device_c64_expansion_card_interface(mconfig, *this), m_ssda(*this, MC68A52P_TAG), - m_exp(*this, C64_EXPANSION_SLOT_TAG) + m_exp(*this, C64_EXPANSION_SLOT_TAG), + m_sw1(*this, "SW1") { } @@ -144,6 +181,11 @@ void c64_tdos_cartridge_device::device_start() void c64_tdos_cartridge_device::device_reset() { + m_ssda->reset(); + //m_ula->reset(); + //flip-flop reset + + m_enabled = m_sw1->read(); } @@ -155,7 +197,40 @@ UINT8 c64_tdos_cartridge_device::c64_cd_r(address_space &space, offs_t offset, U { data = m_exp->cd_r(space, offset, data, sphi2, ba, roml, romh, io1, io2); - // TODO + if (m_enabled && !roml) + { + data = m_roml[offset & 0x1fff]; + } + + if (m_enabled && !io2) + { + switch (offset >> 1) + { + case 0: + data = m_ssda->read(space, offset & 0x01); + break; + + case 1: + break; + + case 2: + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 drive MS + 6 drive WP + 7 drive RY + + */ + break; + } + } return data; } @@ -167,8 +242,37 @@ UINT8 c64_tdos_cartridge_device::c64_cd_r(address_space &space, offs_t offset, U void c64_tdos_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UINT8 data, int sphi2, int ba, int roml, int romh, int io1, int io2) { - // TODO m_exp->cd_w(space, offset, data, sphi2, ba, roml, romh, io1, io2); + + if (m_enabled && !io2) + { + switch (offset >> 1) + { + case 0: + m_ssda->write(space, offset & 0x01, data); + break; + + case 1: + /* + + bit description + + 0 + 1 + 2 + 3 + 4 + 5 ULA pin 8, inverted + 6 drive MO + 7 ULA pin 15 + + */ + break; + + case 2: + break; + } + } } @@ -178,7 +282,7 @@ void c64_tdos_cartridge_device::c64_cd_w(address_space &space, offs_t offset, UI int c64_tdos_cartridge_device::c64_game_r(offs_t offset, int sphi2, int ba, int rw) { - return m_exp->game_r(offset, sphi2, ba, rw, m_slot->hiram()); + return m_enabled ? 1 : m_exp->game_r(offset, sphi2, ba, rw, m_slot->hiram()); } @@ -188,5 +292,5 @@ int c64_tdos_cartridge_device::c64_game_r(offs_t offset, int sphi2, int ba, int int c64_tdos_cartridge_device::c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) { - return m_exp->exrom_r(offset, sphi2, ba, rw, m_slot->hiram()); + return m_enabled ? 0 : m_exp->exrom_r(offset, sphi2, ba, rw, m_slot->hiram()); } diff --git a/src/mess/machine/c64/tdos.h b/src/mess/machine/c64/tdos.h index 711df0fcdc5..ddc7dfaba8b 100644 --- a/src/mess/machine/c64/tdos.h +++ b/src/mess/machine/c64/tdos.h @@ -33,6 +33,7 @@ public: // optional information overrides virtual machine_config_constructor device_mconfig_additions() const; + virtual ioport_constructor device_input_ports() const; protected: // device-level overrides @@ -48,6 +49,9 @@ protected: private: required_device m_ssda; required_device m_exp; + required_ioport m_sw1; + + bool m_enabled; };