diff options
Diffstat (limited to 'src/devices/bus/coco/dragon_fdc.cpp')
-rw-r--r-- | src/devices/bus/coco/dragon_fdc.cpp | 113 |
1 files changed, 54 insertions, 59 deletions
diff --git a/src/devices/bus/coco/dragon_fdc.cpp b/src/devices/bus/coco/dragon_fdc.cpp index 48ab81501a5..7f6d9c41cd0 100644 --- a/src/devices/bus/coco/dragon_fdc.cpp +++ b/src/devices/bus/coco/dragon_fdc.cpp @@ -82,8 +82,9 @@ PARAMETERS ***************************************************************************/ -#define LOG_FDC 0 - +#define LOG_FDC (1U << 1) +#define VERBOSE (0) +#include "logmacro.h" /*************************************************************************** @@ -96,13 +97,13 @@ namespace { protected: // construction/destruction - dragon_fdc_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + dragon_fdc_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); // device-level overrides - virtual DECLARE_READ8_MEMBER(cts_read) override; - virtual DECLARE_READ8_MEMBER(scs_read) override; - virtual DECLARE_WRITE8_MEMBER(scs_write) override; - virtual void device_add_mconfig(machine_config &config) override; + virtual u8 cts_read(offs_t offset) override; + virtual u8 scs_read(offs_t offset) override; + virtual void scs_write(offs_t offset, u8 data) override; + virtual void device_add_mconfig(machine_config &config) override ATTR_COLD; virtual void update_lines() override; private: @@ -111,20 +112,20 @@ namespace required_device_array<floppy_connector, 4> m_floppies; // methods - void dskreg_w(uint8_t data); + void dskreg_w(u8 data); }; class premier_fdc_device_base : public coco_family_fdc_device_base { protected: // construction/destruction - premier_fdc_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + premier_fdc_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock); // device-level overrides - virtual DECLARE_READ8_MEMBER(cts_read) override; - virtual DECLARE_READ8_MEMBER(scs_read) override; - virtual DECLARE_WRITE8_MEMBER(scs_write) override; - virtual void device_add_mconfig(machine_config &config) override; + virtual u8 cts_read(offs_t offset) override; + virtual u8 scs_read(offs_t offset) override; + virtual void scs_write(offs_t offset, u8 data) override; + virtual void device_add_mconfig(machine_config &config) override ATTR_COLD; virtual void update_lines() override; private: @@ -133,7 +134,7 @@ namespace required_device_array<floppy_connector, 4> m_floppies; // methods - void dskreg_w(uint8_t data); + void dskreg_w(u8 data); }; } @@ -155,8 +156,8 @@ void dragon_fdc_device_base::device_add_mconfig(machine_config &config) FLOPPY_CONNECTOR(config, m_floppies[0], dragon_fdc_drives, "qd", dragon_fdc_device_base::floppy_formats).enable_sound(true); FLOPPY_CONNECTOR(config, m_floppies[1], dragon_fdc_drives, "qd", dragon_fdc_device_base::floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppies[2], dragon_fdc_drives, "", dragon_fdc_device_base::floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppies[3], dragon_fdc_drives, "", dragon_fdc_device_base::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppies[2], dragon_fdc_drives, nullptr, dragon_fdc_device_base::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppies[3], dragon_fdc_drives, nullptr, dragon_fdc_device_base::floppy_formats).enable_sound(true); } @@ -166,8 +167,8 @@ void premier_fdc_device_base::device_add_mconfig(machine_config &config) FLOPPY_CONNECTOR(config, m_floppies[0], dragon_fdc_drives, "qd", dragon_fdc_device_base::floppy_formats).enable_sound(true); FLOPPY_CONNECTOR(config, m_floppies[1], dragon_fdc_drives, "qd", dragon_fdc_device_base::floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppies[2], dragon_fdc_drives, "", dragon_fdc_device_base::floppy_formats).enable_sound(true); - FLOPPY_CONNECTOR(config, m_floppies[3], dragon_fdc_drives, "", dragon_fdc_device_base::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppies[2], dragon_fdc_drives, nullptr, dragon_fdc_device_base::floppy_formats).enable_sound(true); + FLOPPY_CONNECTOR(config, m_floppies[3], dragon_fdc_drives, nullptr, dragon_fdc_device_base::floppy_formats).enable_sound(true); } @@ -178,7 +179,7 @@ void premier_fdc_device_base::device_add_mconfig(machine_config &config) //------------------------------------------------- // dragon_fdc_device_base - constructor //------------------------------------------------- -dragon_fdc_device_base::dragon_fdc_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) +dragon_fdc_device_base::dragon_fdc_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) : coco_family_fdc_device_base(mconfig, type, tag, owner, clock) , m_wd2797(*this, "wd2797") , m_floppies(*this, "wd2797:%u", 0) @@ -186,7 +187,7 @@ dragon_fdc_device_base::dragon_fdc_device_base(const machine_config &mconfig, de } -premier_fdc_device_base::premier_fdc_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) +premier_fdc_device_base::premier_fdc_device_base(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock) : coco_family_fdc_device_base(mconfig, type, tag, owner, clock) , m_wd2791(*this, "wd2791") , m_floppies(*this, "wd2791:%u", 0) @@ -219,21 +220,18 @@ void premier_fdc_device_base::update_lines() // Dragon dskreg //------------------------------------------------- -void dragon_fdc_device_base::dskreg_w(uint8_t data) +void dragon_fdc_device_base::dskreg_w(u8 data) { - if (LOG_FDC) - { - logerror("fdc_dragon_dskreg_w(): %c%c%c%c%c%c%c%c ($%02x)\n", - BIT(data, 7) ? 'X' : 'x', - BIT(data, 6) ? 'X' : 'x', - BIT(data, 5) ? 'N' : 'n', - BIT(data, 4) ? 'P' : 'p', - BIT(data, 3) ? 'S' : 'D', - BIT(data, 2) ? 'M' : 'm', - BIT(data, 1) ? '1' : '0', - BIT(data, 0) ? '1' : '0', - data); - } + LOGMASKED(LOG_FDC, "fdc_dragon_dskreg_w(): %c%c%c%c%c%c%c%c ($%02x)\n", + BIT(data, 7) ? 'X' : 'x', + BIT(data, 6) ? 'X' : 'x', + BIT(data, 5) ? 'N' : 'n', + BIT(data, 4) ? 'P' : 'p', + BIT(data, 3) ? 'S' : 'D', + BIT(data, 2) ? 'M' : 'm', + BIT(data, 1) ? '1' : '0', + BIT(data, 0) ? '1' : '0', + data); // update the motor on each floppy for (int i = 0; i < 4; i++) @@ -251,21 +249,18 @@ void dragon_fdc_device_base::dskreg_w(uint8_t data) } -void premier_fdc_device_base::dskreg_w(uint8_t data) +void premier_fdc_device_base::dskreg_w(u8 data) { - if (LOG_FDC) - { - logerror("fdc_premier_dskreg_w(): %c%c%c%c%c%c%c%c ($%02x)\n", - BIT(data, 7) ? 'X' : 'x', - BIT(data, 6) ? 'X' : 'x', - BIT(data, 5) ? 'X' : 'x', - BIT(data, 4) ? 'D' : 'S', - BIT(data, 3) ? '8' : '5', - BIT(data, 2) ? '1' : '0', - BIT(data, 1) ? '1' : '0', - BIT(data, 0) ? '1' : '0', - data); - } + LOGMASKED(LOG_FDC, "fdc_premier_dskreg_w(): %c%c%c%c%c%c%c%c ($%02x)\n", + BIT(data, 7) ? 'X' : 'x', + BIT(data, 6) ? 'X' : 'x', + BIT(data, 5) ? 'X' : 'x', + BIT(data, 4) ? 'D' : 'S', + BIT(data, 3) ? '8' : '5', + BIT(data, 2) ? '1' : '0', + BIT(data, 1) ? '1' : '0', + BIT(data, 0) ? '1' : '0', + data); floppy_image_device *floppy = nullptr; // update the motor on each floppy @@ -293,13 +288,13 @@ void premier_fdc_device_base::dskreg_w(uint8_t data) // cts_read //------------------------------------------------- -READ8_MEMBER(dragon_fdc_device_base::cts_read) +u8 dragon_fdc_device_base::cts_read(offs_t offset) { return memregion("eprom")->base()[offset]; } -READ8_MEMBER(premier_fdc_device_base::cts_read) +u8 premier_fdc_device_base::cts_read(offs_t offset) { return memregion("eprom")->base()[offset]; } @@ -309,9 +304,9 @@ READ8_MEMBER(premier_fdc_device_base::cts_read) // scs_read //------------------------------------------------- -READ8_MEMBER(dragon_fdc_device_base::scs_read) +u8 dragon_fdc_device_base::scs_read(offs_t offset) { - uint8_t result = 0; + u8 result = 0; switch (offset & 0xef) { case 0: @@ -325,9 +320,9 @@ READ8_MEMBER(dragon_fdc_device_base::scs_read) } -READ8_MEMBER(premier_fdc_device_base::scs_read) +u8 premier_fdc_device_base::scs_read(offs_t offset) { - uint8_t result = 0; + u8 result = 0; switch (offset) { case 0: @@ -345,7 +340,7 @@ READ8_MEMBER(premier_fdc_device_base::scs_read) // scs_write //------------------------------------------------- -WRITE8_MEMBER(dragon_fdc_device_base::scs_write) +void dragon_fdc_device_base::scs_write(offs_t offset, u8 data) { switch (offset & 0xef) { @@ -363,7 +358,7 @@ WRITE8_MEMBER(dragon_fdc_device_base::scs_write) } -WRITE8_MEMBER(premier_fdc_device_base::scs_write) +void premier_fdc_device_base::scs_write(offs_t offset, u8 data) { switch (offset) { @@ -395,7 +390,7 @@ namespace { public: // construction/destruction - dragon_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + dragon_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : dragon_fdc_device_base(mconfig, DRAGON_FDC, tag, owner, clock) { } @@ -427,7 +422,7 @@ namespace { public: // construction/destruction - premier_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + premier_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : premier_fdc_device_base(mconfig, PREMIER_FDC, tag, owner, clock) { } @@ -459,7 +454,7 @@ namespace { public: // construction/destruction - sdtandy_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + sdtandy_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock) : dragon_fdc_device_base(mconfig, SDTANDY_FDC, tag, owner, clock) { } |