summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/imagedev/microdrv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/imagedev/microdrv.cpp')
-rw-r--r--src/devices/imagedev/microdrv.cpp32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/devices/imagedev/microdrv.cpp b/src/devices/imagedev/microdrv.cpp
index 854b8d55197..2f8ae27ba9a 100644
--- a/src/devices/imagedev/microdrv.cpp
+++ b/src/devices/imagedev/microdrv.cpp
@@ -46,8 +46,7 @@ DEFINE_DEVICE_TYPE(MICRODRIVE, microdrive_image_device, "microdrive_image", "Sin
//-------------------------------------------------
microdrive_image_device::microdrive_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
- device_t(mconfig, MICRODRIVE, tag, owner, clock),
- device_image_interface(mconfig, *this),
+ microtape_image_device(mconfig, MICRODRIVE, tag, owner, clock),
m_write_comms_out(*this)
{
}
@@ -63,15 +62,12 @@ microdrive_image_device::~microdrive_image_device()
void microdrive_image_device::device_start()
{
- // resolve callbacks
- m_write_comms_out.resolve_safe();
-
// allocate track buffers
m_left = std::make_unique<uint8_t[]>(MDV_IMAGE_LENGTH / 2);
m_right = std::make_unique<uint8_t[]>(MDV_IMAGE_LENGTH / 2);
// allocate timers
- m_bit_timer = timer_alloc();
+ m_bit_timer = timer_alloc(FUNC(microdrive_image_device::bit_timer), this);
m_bit_timer->adjust(attotime::zero, 0, attotime::from_hz(MDV_BITRATE));
m_bit_timer->enable(0);
@@ -80,10 +76,10 @@ void microdrive_image_device::device_start()
m_comms_out = 0;
}
-image_init_result microdrive_image_device::call_load()
+std::pair<std::error_condition, std::string> microdrive_image_device::call_load()
{
if (length() != MDV_IMAGE_LENGTH)
- return image_init_result::FAIL;
+ return std::make_pair(image_error::INVALIDLENGTH, std::string());
// huh
for (int i = 0; i < MDV_IMAGE_LENGTH / 2; i++)
@@ -95,7 +91,7 @@ image_init_result microdrive_image_device::call_load()
m_bit_offset = 0;
m_byte_offset = 0;
- return image_init_result::PASS;
+ return std::make_pair(std::error_condition(), std::string());
}
void microdrive_image_device::call_unload()
@@ -107,7 +103,7 @@ void microdrive_image_device::call_unload()
memset(m_right.get(), 0, MDV_IMAGE_LENGTH / 2);
}
-void microdrive_image_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+TIMER_CALLBACK_MEMBER(microdrive_image_device::bit_timer)
{
m_bit_offset++;
@@ -123,7 +119,7 @@ void microdrive_image_device::device_timer(emu_timer &timer, device_timer_id id,
}
}
-WRITE_LINE_MEMBER( microdrive_image_device::clk_w )
+void microdrive_image_device::clk_w(int state)
{
if (LOG) logerror("Microdrive '%s' CLK: %u\n", tag(), state);
if (!m_clk && state)
@@ -136,25 +132,25 @@ WRITE_LINE_MEMBER( microdrive_image_device::clk_w )
m_clk = state;
}
-WRITE_LINE_MEMBER( microdrive_image_device::comms_in_w )
+void microdrive_image_device::comms_in_w(int state)
{
if (LOG) logerror("Microdrive '%s' COMMS IN: %u\n", tag(), state);
m_comms_in = state;
}
-WRITE_LINE_MEMBER( microdrive_image_device::erase_w )
+void microdrive_image_device::erase_w(int state)
{
if (LOG) logerror("Microdrive '%s' ERASE: %u\n", tag(), state);
m_erase = state;
}
-WRITE_LINE_MEMBER( microdrive_image_device::read_write_w )
+void microdrive_image_device::read_write_w(int state)
{
if (LOG) logerror("Microdrive '%s' READ/WRITE: %u\n", tag(), state);
m_read_write = state;
}
-WRITE_LINE_MEMBER( microdrive_image_device::data1_w )
+void microdrive_image_device::data1_w(int state)
{
if (m_comms_out && !m_read_write)
{
@@ -162,7 +158,7 @@ WRITE_LINE_MEMBER( microdrive_image_device::data1_w )
}
}
-WRITE_LINE_MEMBER( microdrive_image_device::data2_w )
+void microdrive_image_device::data2_w(int state)
{
if (m_comms_out && !m_read_write)
{
@@ -170,7 +166,7 @@ WRITE_LINE_MEMBER( microdrive_image_device::data2_w )
}
}
-READ_LINE_MEMBER( microdrive_image_device::data1_r )
+int microdrive_image_device::data1_r()
{
int data = 0;
if (m_comms_out && m_read_write)
@@ -180,7 +176,7 @@ READ_LINE_MEMBER( microdrive_image_device::data1_r )
return data;
}
-READ_LINE_MEMBER( microdrive_image_device::data2_r )
+int microdrive_image_device::data2_r()
{
int data = 0;
if (m_comms_out && m_read_write)