summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2018-06-17 01:05:47 -0400
committer AJR <ajrhacker@users.noreply.github.com>2018-06-17 01:06:20 -0400
commitdf98fc2024e53ed5f7a14d2aacedc2e4d6f67f4a (patch)
treec2ad987ca0c205b98612ce598a11607349517ed1
parenta42bb036c9872d08431591237864b3b32514751e (diff)
b2m: Replace machine().device with finder array (nw)
-rw-r--r--src/mame/includes/b2m.h3
-rw-r--r--src/mame/machine/b2m.cpp13
2 files changed, 9 insertions, 7 deletions
diff --git a/src/mame/includes/b2m.h b/src/mame/includes/b2m.h
index 008f3ed6b4e..5856ed7c3a5 100644
--- a/src/mame/includes/b2m.h
+++ b/src/mame/includes/b2m.h
@@ -11,6 +11,7 @@
#pragma once
+#include "imagedev/floppy.h"
#include "machine/i8255.h"
#include "machine/pic8259.h"
#include "machine/pit8253.h"
@@ -31,6 +32,7 @@ public:
, m_ram(*this, RAM_TAG)
, m_palette(*this, "palette")
, m_fdc(*this, "fd1793")
+ , m_fd(*this, "fd%u", 0U)
, m_pic(*this, "pic8259")
{ }
@@ -91,6 +93,7 @@ protected:
/* devices */
optional_device<fd1793_device> m_fdc;
+ optional_device_array<floppy_connector, 2> m_fd;
optional_device<pic8259_device> m_pic;
};
diff --git a/src/mame/machine/b2m.cpp b/src/mame/machine/b2m.cpp
index 86d0b5dd5a1..ba39ecc3f06 100644
--- a/src/mame/machine/b2m.cpp
+++ b/src/mame/machine/b2m.cpp
@@ -17,7 +17,6 @@
#include "machine/i8251.h"
#include "includes/b2m.h"
#include "machine/ram.h"
-#include "imagedev/flopdrv.h"
READ8_MEMBER(b2m_state::b2m_keyboard_r)
{
@@ -182,13 +181,12 @@ WRITE8_MEMBER(b2m_state::b2m_ext_8255_portc_w)
uint8_t drive = ((data >> 1) & 1) ^ 1;
uint8_t side = (data & 1) ^ 1;
- static const char *names[] = { "fd0", "fd1"};
floppy_image_device *floppy = nullptr;
- floppy_connector *con = machine().device<floppy_connector>(names[drive]);
- if(con)
- floppy = con->get_device();
+ if (m_fd[drive].found())
+ floppy = m_fd[drive]->get_device();
- floppy->mon_w(0);
+ if (floppy != nullptr)
+ floppy->mon_w(0);
m_fdc->set_floppy(floppy);
if (m_b2m_drive!=drive) {
m_b2m_drive = drive;
@@ -196,7 +194,8 @@ WRITE8_MEMBER(b2m_state::b2m_ext_8255_portc_w)
if (m_b2m_side!=side) {
m_b2m_side = side;
- floppy->ss_w(side);
+ if (floppy != nullptr)
+ floppy->ss_w(side);
}
/*
When bit 5 is set CPU is in HALT state and stay there until