diff options
Diffstat (limited to 'src/devices/bus/a2bus/agat840k_hle.cpp')
-rw-r--r-- | src/devices/bus/a2bus/agat840k_hle.cpp | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/src/devices/bus/a2bus/agat840k_hle.cpp b/src/devices/bus/a2bus/agat840k_hle.cpp index 1d1923adfb1..2a2e74d98ef 100644 --- a/src/devices/bus/a2bus/agat840k_hle.cpp +++ b/src/devices/bus/a2bus/agat840k_hle.cpp @@ -53,9 +53,9 @@ static const floppy_interface agat840k_hle_floppy_interface = void a2bus_agat840k_hle_device::device_add_mconfig(machine_config &config) { - legacy_floppy_image_device &floppy0(LEGACY_FLOPPY(config, FLOPPY_0, 0, &agat840k_hle_floppy_interface)); + legacy_floppy_image_device &floppy0(LEGACY_FLOPPY(config, m_floppy_image[0], 0, &agat840k_hle_floppy_interface)); floppy0.out_idx_cb().set(FUNC(a2bus_agat840k_hle_device::index_0_w)); - legacy_floppy_image_device &floppy1(LEGACY_FLOPPY(config, FLOPPY_1, 0, &agat840k_hle_floppy_interface)); + legacy_floppy_image_device &floppy1(LEGACY_FLOPPY(config, m_floppy_image[1], 0, &agat840k_hle_floppy_interface)); floppy1.out_idx_cb().set(FUNC(a2bus_agat840k_hle_device::index_1_w)); I8255(config, m_d14); @@ -86,6 +86,7 @@ const tiny_rom_entry *a2bus_agat840k_hle_device::device_rom_region() const a2bus_agat840k_hle_device::a2bus_agat840k_hle_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, type, tag, owner, clock) , device_a2bus_card_interface(mconfig, *this) + , m_floppy_image(*this, "floppy%u", 0U) , m_d14(*this, "d14") , m_d15(*this, "d15") , m_rom(nullptr) @@ -147,17 +148,16 @@ void a2bus_agat840k_hle_device::device_reset() { u8 buf[256]; - for (int i = 0; i < 2; i++) + for (auto &img : m_floppy_image) { - legacy_floppy_image_device *img = floppy_image(i); - if (img) + if (img.found()) { img->floppy_drive_set_ready_state(FLOPPY_DRIVE_READY, 0); img->floppy_drive_set_rpm(300.); img->floppy_drive_seek(-img->floppy_drive_get_current_track()); } } - m_floppy = floppy_image(0); + m_floppy = m_floppy_image[0].target(); // generate track images in memory, using default volume ID and gap padding bytes int t = 0; @@ -324,15 +324,6 @@ uint8_t a2bus_agat840k_hle_device::read_cnxx(uint8_t offset) return m_rom[offset]; } -legacy_floppy_image_device *a2bus_agat840k_hle_device::floppy_image(int drive) -{ - switch(drive) { - case 0 : return subdevice<legacy_floppy_image_device>(FLOPPY_0); - case 1 : return subdevice<legacy_floppy_image_device>(FLOPPY_1); - } - return nullptr; -} - /* * all signals active low. write support not implemented; WPT is always active. * @@ -378,11 +369,11 @@ READ8_MEMBER(a2bus_agat840k_hle_device::d14_i_b) WRITE8_MEMBER(a2bus_agat840k_hle_device::d14_o_c) { m_unit = BIT(data, 3); - m_floppy = floppy_image(m_unit); + m_floppy = m_floppy_image[m_unit].target(); if (m_unit) - m_floppy->floppy_ds1_w(m_unit != 1); + m_floppy->floppy_ds_w(m_unit != 1); else - m_floppy->floppy_ds0_w(m_unit != 0); + m_floppy->floppy_ds_w(m_unit != 0); m_floppy->floppy_drtn_w(!BIT(data, 2)); m_side = BIT(data, 4); |