mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
(MESS) ql: Expansion WIP. (nw)
This commit is contained in:
parent
82f7387896
commit
48b70caf5b
6 changed files with 229 additions and 9 deletions
|
@ -83,7 +83,10 @@ void ql_expansion_slot_t::device_start()
|
|||
#include "trumpcard.h"
|
||||
|
||||
SLOT_INTERFACE_START( ql_expansion_cards )
|
||||
SLOT_INTERFACE("superdisk", SANDY_SUPER_DISK)
|
||||
SLOT_INTERFACE("superqboard", SANDY_SUPERQBOARD)
|
||||
SLOT_INTERFACE("trumpcard", QL_TRUMP_CARD)
|
||||
SLOT_INTERFACE("sdisk", SANDY_SUPER_DISK)
|
||||
SLOT_INTERFACE("sqboard", SANDY_SUPERQBOARD)
|
||||
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
|
||||
|
|
|
@ -127,3 +127,22 @@ void sandy_super_disk_t::device_start()
|
|||
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)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ protected:
|
|||
virtual void device_reset();
|
||||
|
||||
// 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:
|
||||
required_memory_region m_rom;
|
||||
|
|
|
@ -48,8 +48,8 @@ protected:
|
|||
virtual void device_reset();
|
||||
|
||||
// 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);
|
||||
virtual UINT8 read(address_space &space, offs_t offset, UINT8 data);
|
||||
virtual void write(address_space &space, offs_t offset, UINT8 data);
|
||||
|
||||
private:
|
||||
void check_interrupt();
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
//**************************************************************************
|
||||
|
||||
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 )
|
||||
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":1", ql_trump_card_floppies, NULL, ql_trump_card_t::floppy_formats)
|
||||
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) :
|
||||
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),
|
||||
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(*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
|
||||
|
@ -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()
|
||||
{
|
||||
m_ram.allocate(m_ram_size);
|
||||
}
|
||||
|
||||
|
||||
|
@ -127,4 +154,128 @@ void ql_trump_card_t::device_start()
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ class ql_trump_card_t : public device_t,
|
|||
public:
|
||||
// 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, 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
|
||||
virtual const rom_entry *device_rom_region() const;
|
||||
|
@ -45,15 +46,59 @@ protected:
|
|||
virtual void device_reset();
|
||||
|
||||
// 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:
|
||||
required_device<wd1772_t> m_fdc;
|
||||
required_device<floppy_connector> m_floppy0;
|
||||
required_device<floppy_connector> m_floppy1;
|
||||
required_memory_region m_rom;
|
||||
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
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue