(MESS) ql: Expansion WIP. (nw)

This commit is contained in:
Curt Coder 2014-06-03 11:42:56 +00:00
parent 82f7387896
commit 48b70caf5b
6 changed files with 229 additions and 9 deletions

View file

@ -83,7 +83,10 @@ void ql_expansion_slot_t::device_start()
#include "trumpcard.h" #include "trumpcard.h"
SLOT_INTERFACE_START( ql_expansion_cards ) SLOT_INTERFACE_START( ql_expansion_cards )
SLOT_INTERFACE("superdisk", SANDY_SUPER_DISK) SLOT_INTERFACE("sdisk", SANDY_SUPER_DISK)
SLOT_INTERFACE("superqboard", SANDY_SUPERQBOARD) SLOT_INTERFACE("sqboard", SANDY_SUPERQBOARD)
SLOT_INTERFACE("trumpcard", QL_TRUMP_CARD) SLOT_INTERFACE("trump", QL_TRUMP_CARD)
SLOT_INTERFACE("trump256k", QL_TRUMP_CARD_256K)
SLOT_INTERFACE("trump512k", QL_TRUMP_CARD_512K)
SLOT_INTERFACE("trump768k", QL_TRUMP_CARD_768K)
SLOT_INTERFACE_END SLOT_INTERFACE_END

View file

@ -127,3 +127,22 @@ void sandy_super_disk_t::device_start()
void sandy_super_disk_t::device_reset() void sandy_super_disk_t::device_reset()
{ {
} }
//-------------------------------------------------
// read -
//-------------------------------------------------
UINT8 sandy_super_disk_t::read(address_space &space, offs_t offset, UINT8 data)
{
return data;
}
//-------------------------------------------------
// write -
//-------------------------------------------------
void sandy_super_disk_t::write(address_space &space, offs_t offset, UINT8 data)
{
}

View file

@ -46,6 +46,8 @@ protected:
virtual void device_reset(); virtual void device_reset();
// device_ql_expansion_card_interface overrides // device_ql_expansion_card_interface overrides
virtual UINT8 read(address_space &space, offs_t offset, UINT8 data);
virtual void write(address_space &space, offs_t offset, UINT8 data);
private: private:
required_memory_region m_rom; required_memory_region m_rom;

View file

@ -48,8 +48,8 @@ protected:
virtual void device_reset(); virtual void device_reset();
// device_ql_expansion_card_interface overrides // device_ql_expansion_card_interface overrides
virtual UINT8 read(address_space &space, offs_t offset, UINT8 data); virtual UINT8 read(address_space &space, offs_t offset, UINT8 data);
virtual void write(address_space &space, offs_t offset, UINT8 data); virtual void write(address_space &space, offs_t offset, UINT8 data);
private: private:
void check_interrupt(); void check_interrupt();

View file

@ -26,6 +26,9 @@
//************************************************************************** //**************************************************************************
const device_type QL_TRUMP_CARD = &device_creator<ql_trump_card_t>; const device_type QL_TRUMP_CARD = &device_creator<ql_trump_card_t>;
const device_type QL_TRUMP_CARD_256K = &device_creator<ql_trump_card_256k_t>;
const device_type QL_TRUMP_CARD_512K = &device_creator<ql_trump_card_512k_t>;
const device_type QL_TRUMP_CARD_768K = &device_creator<ql_trump_card_768k_t>;
//------------------------------------------------- //-------------------------------------------------
@ -76,8 +79,6 @@ FLOPPY_FORMATS_END
static MACHINE_CONFIG_FRAGMENT( ql_trump_card ) static MACHINE_CONFIG_FRAGMENT( ql_trump_card )
MCFG_DEVICE_ADD(WD1772_TAG, WD1772x, 8000000) MCFG_DEVICE_ADD(WD1772_TAG, WD1772x, 8000000)
//MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(ql_trump_card_t, fdc_intrq_w))
//MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(ql_trump_card_t, fdc_drq_w))
MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":0", ql_trump_card_floppies, "35dd", ql_trump_card_t::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":0", ql_trump_card_floppies, "35dd", ql_trump_card_t::floppy_formats)
MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":1", ql_trump_card_floppies, NULL, ql_trump_card_t::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG":1", ql_trump_card_floppies, NULL, ql_trump_card_t::floppy_formats)
MACHINE_CONFIG_END MACHINE_CONFIG_END
@ -104,13 +105,38 @@ machine_config_constructor ql_trump_card_t::device_mconfig_additions() const
//------------------------------------------------- //-------------------------------------------------
ql_trump_card_t::ql_trump_card_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : ql_trump_card_t::ql_trump_card_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
device_t(mconfig, QL_TRUMP_CARD, "QL Trump Card", tag, owner, clock, "ql_trump_card", __FILE__), device_t(mconfig, QL_TRUMP_CARD, "QL Trump Card", tag, owner, clock, "trump", __FILE__),
device_ql_expansion_card_interface(mconfig, *this), device_ql_expansion_card_interface(mconfig, *this),
m_fdc(*this, WD1772_TAG),
m_floppy0(*this, WD1772_TAG":0"),
m_floppy1(*this, WD1772_TAG":1"),
m_rom(*this, "rom"), m_rom(*this, "rom"),
m_ram(*this, "ram") m_ram(*this, "ram"),
m_ram_size(0)
{ {
} }
ql_trump_card_t::ql_trump_card_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, int ram_size) :
device_t(mconfig, QL_TRUMP_CARD, "QL Trump Card", tag, owner, clock, "trump", __FILE__),
device_ql_expansion_card_interface(mconfig, *this),
m_fdc(*this, WD1772_TAG),
m_floppy0(*this, WD1772_TAG":0"),
m_floppy1(*this, WD1772_TAG":1"),
m_rom(*this, "rom"),
m_ram(*this, "ram"),
m_ram_size(ram_size)
{
}
ql_trump_card_256k_t::ql_trump_card_256k_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: ql_trump_card_t(mconfig, QL_TRUMP_CARD_256K, "QL Trump Card 256K", tag, owner, clock, "trump256k", __FILE__, 256*1024) { }
ql_trump_card_512k_t::ql_trump_card_512k_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: ql_trump_card_t(mconfig, QL_TRUMP_CARD_512K, "QL Trump Card 512K", tag, owner, clock, "trump512k", __FILE__, 512*1024) { }
ql_trump_card_768k_t::ql_trump_card_768k_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: ql_trump_card_t(mconfig, QL_TRUMP_CARD_768K, "QL Trump Card 768K", tag, owner, clock, "trump768k", __FILE__, 768*1024) { }
//------------------------------------------------- //-------------------------------------------------
// device_start - device-specific startup // device_start - device-specific startup
@ -118,6 +144,7 @@ ql_trump_card_t::ql_trump_card_t(const machine_config &mconfig, const char *tag,
void ql_trump_card_t::device_start() void ql_trump_card_t::device_start()
{ {
m_ram.allocate(m_ram_size);
} }
@ -127,4 +154,128 @@ void ql_trump_card_t::device_start()
void ql_trump_card_t::device_reset() void ql_trump_card_t::device_reset()
{ {
m_fdc->set_floppy(NULL);
m_fdc->dden_w(0);
m_rom_en = false;
m_ram_en = false;
}
//-------------------------------------------------
// read -
//-------------------------------------------------
UINT8 ql_trump_card_t::read(address_space &space, offs_t offset, UINT8 data)
{
if (!m_rom_en && offset >= 0xc000 && offset < 0x10000)
{
m_rom_en = true;
data = m_rom->base()[offset & 0x3fff];
}
if (offset >= 0x10000 && offset < 0x18000)
{
if (m_ram_size == 768*1024)
{
m_ram_en = true;
}
data = m_rom->base()[offset & 0x7fff];
}
if (offset >= 0x1c000 && offset <= 0x1c003)
{
data = m_fdc->read(space, offset & 0x03);
}
if (offset >= 0x60000 && offset < 0xc0000)
{
if ((offset - 0x60000) < m_ram_size)
{
data = m_ram[offset - 0x60000];
}
}
if (offset >= 0xc0000)
{
if (m_rom_en && offset < 0xc8000)
{
data = m_rom->base()[offset & 0x7fff];
}
if (m_ram_en)
{
data = m_ram[offset - 0x60000];
}
}
return data;
}
//-------------------------------------------------
// write -
//-------------------------------------------------
void ql_trump_card_t::write(address_space &space, offs_t offset, UINT8 data)
{
if (offset >= 0x1c000 && offset <= 0x1c003)
{
m_fdc->write(space, offset & 0x03, data);
}
if (offset == 0x1e000)
{
/*
bit description
0 DRIVE1
1 DRIVE0
2 MOTOR
3 SIDE
4
5
6
7
*/
floppy_image_device *floppy = NULL;
if (BIT(data, 1))
{
floppy = m_floppy0->get_device();
}
else if (BIT(data, 0))
{
floppy = m_floppy1->get_device();
}
m_fdc->set_floppy(floppy);
if (floppy)
{
floppy->ss_w(BIT(data, 3));
floppy->mon_w(BIT(data, 2));
}
}
if (offset >= 0x60000 && offset < 0xc0000)
{
if ((offset - 0x60000) < m_ram_size)
{
m_ram[offset - 0x60000] = data;
}
}
if (offset >= 0xc0000)
{
if (m_ram_en)
{
m_ram[offset - 0x60000] = data;
}
}
} }

View file

@ -32,6 +32,7 @@ class ql_trump_card_t : public device_t,
public: public:
// construction/destruction // construction/destruction
ql_trump_card_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); ql_trump_card_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
ql_trump_card_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, int ram_size);
// optional information overrides // optional information overrides
virtual const rom_entry *device_rom_region() const; virtual const rom_entry *device_rom_region() const;
@ -45,15 +46,59 @@ protected:
virtual void device_reset(); virtual void device_reset();
// device_ql_expansion_card_interface overrides // device_ql_expansion_card_interface overrides
virtual UINT8 read(address_space &space, offs_t offset, UINT8 data);
virtual void write(address_space &space, offs_t offset, UINT8 data);
private: private:
required_device<wd1772_t> m_fdc;
required_device<floppy_connector> m_floppy0;
required_device<floppy_connector> m_floppy1;
required_memory_region m_rom; required_memory_region m_rom;
optional_shared_ptr<UINT8> m_ram; optional_shared_ptr<UINT8> m_ram;
int m_ram_size;
bool m_rom_en;
bool m_ram_en;
}; };
// ======================> ql_trump_card_256k_t
class ql_trump_card_256k_t : public ql_trump_card_t
{
public:
// construction/destruction
ql_trump_card_256k_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
// ======================> ql_trump_card_512k_t
class ql_trump_card_512k_t : public ql_trump_card_t
{
public:
// construction/destruction
ql_trump_card_512k_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
// ======================> ql_trump_card_768k_t
class ql_trump_card_768k_t : public ql_trump_card_t
{
public:
// construction/destruction
ql_trump_card_768k_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
};
// device type definition // device type definition
extern const device_type QL_TRUMP_CARD; extern const device_type QL_TRUMP_CARD;
extern const device_type QL_TRUMP_CARD_256K;
extern const device_type QL_TRUMP_CARD_512K;
extern const device_type QL_TRUMP_CARD_768K;
#endif #endif