b2m: Replace machine().device with finder array (nw)

This commit is contained in:
AJR 2018-06-17 01:05:47 -04:00
parent a42bb036c9
commit df98fc2024
2 changed files with 9 additions and 7 deletions

View File

@ -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;
};

View File

@ -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,12 +181,11 @@ 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();
if (floppy != nullptr)
floppy->mon_w(0);
m_fdc->set_floppy(floppy);
if (m_b2m_drive!=drive) {
@ -196,6 +194,7 @@ WRITE8_MEMBER(b2m_state::b2m_ext_8255_portc_w)
if (m_b2m_side!=side) {
m_b2m_side = side;
if (floppy != nullptr)
floppy->ss_w(side);
}
/*