mirror of
https://github.com/holub/mame
synced 2025-07-01 16:19:38 +03:00
flopdrv: Eliminate floppy_get_count (nw)
This commit is contained in:
parent
d1ebecce72
commit
a81a5dac63
@ -533,16 +533,6 @@ int floppy_get_drive_by_type(legacy_floppy_image_device *image,int ftype)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int floppy_get_count(running_machine &machine)
|
||||
{
|
||||
int cnt = 0;
|
||||
if (machine.device<legacy_floppy_image_device>(FLOPPY_0)) cnt++;
|
||||
if (machine.device<legacy_floppy_image_device>(FLOPPY_1)) cnt++;
|
||||
if (machine.device<legacy_floppy_image_device>(FLOPPY_2)) cnt++;
|
||||
if (machine.device<legacy_floppy_image_device>(FLOPPY_3)) cnt++;
|
||||
return cnt;
|
||||
}
|
||||
|
||||
|
||||
/* drive select 0 */
|
||||
WRITE_LINE_MEMBER( legacy_floppy_image_device::floppy_ds0_w )
|
||||
|
@ -1,7 +1,6 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Nathan Woods, Miodrag Milanovic
|
||||
/* flopdrv provides simple emulation of a disc drive */
|
||||
/* the 8271, upd765 and wd179x use this */
|
||||
|
||||
#ifndef MAME_DEVICES_IMAGEDV_FLOPDRV_H
|
||||
#define MAME_DEVICES_IMAGEDV_FLOPDRV_H
|
||||
@ -251,6 +250,5 @@ protected:
|
||||
legacy_floppy_image_device *floppy_get_device(running_machine &machine,int drive);
|
||||
legacy_floppy_image_device *floppy_get_device_by_type(running_machine &machine,int ftype,int drive);
|
||||
int floppy_get_drive_by_type(legacy_floppy_image_device *image,int ftype);
|
||||
int floppy_get_count(running_machine &machine);
|
||||
|
||||
#endif // MAME_DEVICES_IMAGEDV_FLOPDRV_H
|
||||
|
@ -4042,7 +4042,7 @@ READ8_MEMBER(apple2gs_state::doc_adc_read)
|
||||
|
||||
int apple2gs_state::apple2_fdc_has_35()
|
||||
{
|
||||
return (floppy_get_count(machine())); // - apple525_get_count(machine)) > 0;
|
||||
return device_type_iterator<sonydriv_floppy_image_device>(*this).count(); // - apple525_get_count(machine)) > 0;
|
||||
}
|
||||
|
||||
int apple2gs_state::apple2_fdc_has_525()
|
||||
|
@ -412,12 +412,11 @@ void thomson_state::to7_5p14_index_pulse_callback( int state )
|
||||
|
||||
void thomson_state::to7_5p14sd_reset()
|
||||
{
|
||||
int i;
|
||||
LOG(( "to7_5p14sd_reset: CD 90-015 controller\n" ));
|
||||
for ( i = 0; i < floppy_get_count( machine() ); i++ )
|
||||
for (auto &img : m_floppy_image)
|
||||
{
|
||||
legacy_floppy_image_device * img = floppy_get_device( machine(), 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() );
|
||||
@ -521,7 +520,7 @@ void thomson_state::to7_qdd_index_pulse_cb( int state )
|
||||
|
||||
legacy_floppy_image_device * thomson_state::to7_qdd_image()
|
||||
{
|
||||
return floppy_get_device( machine(), 0 );
|
||||
return m_floppy_image[0].target();
|
||||
}
|
||||
|
||||
|
||||
@ -807,13 +806,12 @@ WRITE8_MEMBER( thomson_state::to7_qdd_w )
|
||||
|
||||
void thomson_state::to7_qdd_reset()
|
||||
{
|
||||
int i;
|
||||
LOG(( "to7_qdd_reset: CQ 90-028 controller\n" ));
|
||||
|
||||
for ( i = 0; i < floppy_get_count( machine() ); i++ )
|
||||
for (auto &img : m_floppy_image)
|
||||
{
|
||||
legacy_floppy_image_device * img = floppy_get_device( machine(), i );
|
||||
if (img) {
|
||||
if (img.found())
|
||||
{
|
||||
img->floppy_drive_set_ready_state( FLOPPY_DRIVE_READY, 0 );
|
||||
|
||||
motor_on = CLEAR_LINE;
|
||||
@ -916,7 +914,7 @@ static emu_timer* thmfc_floppy_cmd;
|
||||
|
||||
legacy_floppy_image_device * thomson_state::thmfc_floppy_image()
|
||||
{
|
||||
return floppy_get_device( machine(), thmfc1->drive );
|
||||
return m_floppy_image[thmfc1->drive].target();
|
||||
}
|
||||
|
||||
|
||||
@ -1498,13 +1496,12 @@ WRITE8_MEMBER( thomson_state::thmfc_floppy_w )
|
||||
|
||||
void thomson_state::thmfc_floppy_reset()
|
||||
{
|
||||
int i;
|
||||
LOG(( "thmfc_floppy_reset: THMFC1 controller\n" ));
|
||||
|
||||
for ( i = 0; i < floppy_get_count( machine() ); i++ )
|
||||
for (auto &img : m_floppy_image)
|
||||
{
|
||||
legacy_floppy_image_device * img = floppy_get_device( machine(), i );
|
||||
if (img) {
|
||||
if (img.found())
|
||||
{
|
||||
img->floppy_drive_set_ready_state( FLOPPY_DRIVE_READY, 0 );
|
||||
img->floppy_drive_seek( - img->floppy_drive_get_current_track() );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user