summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2014-04-02 11:59:10 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2014-04-02 11:59:10 +0000
commitb1c2c8daeeca433652f2a5055c9aeef27406c520 (patch)
treecd6a0c46bd8a428628061e5c7c2483735b5c6e71 /src/mess
parent06238c1cdb21b8c0d1ea7a8fbcf967f6e297d8bc (diff)
modernized access for legacy floppy, quite straight forward thing (nw)
Diffstat (limited to 'src/mess')
-rw-r--r--src/mess/drivers/apf.c6
-rw-r--r--src/mess/drivers/fm7.c4
-rw-r--r--src/mess/drivers/mbc200.c8
-rw-r--r--src/mess/drivers/ms0515.c2
-rw-r--r--src/mess/drivers/myb3k.c4
-rw-r--r--src/mess/drivers/mz2000.c4
-rw-r--r--src/mess/drivers/mz2500.c4
-rw-r--r--src/mess/drivers/rainbow.c20
-rw-r--r--src/mess/drivers/smc777.c6
-rw-r--r--src/mess/drivers/thomson.c8
-rw-r--r--src/mess/drivers/unixpc.c2
-rw-r--r--src/mess/drivers/vtech1.c2
-rw-r--r--src/mess/drivers/x1.c4
-rw-r--r--src/mess/drivers/z100.c4
-rw-r--r--src/mess/includes/thomson.h22
-rw-r--r--src/mess/machine/appldriv.c44
-rw-r--r--src/mess/machine/atarifdc.c13
-rw-r--r--src/mess/machine/atarifdc.h4
-rw-r--r--src/mess/machine/beta.c6
-rw-r--r--src/mess/machine/concept_exp.c2
-rw-r--r--src/mess/machine/hec2hrp.c6
-rw-r--r--src/mess/machine/micropolis.c25
-rw-r--r--src/mess/machine/micropolis.h3
-rw-r--r--src/mess/machine/nes.c4
-rw-r--r--src/mess/machine/osborne1.c2
-rw-r--r--src/mess/machine/partner.c12
-rw-r--r--src/mess/machine/pk8020.c24
-rw-r--r--src/mess/machine/rmnimbus.c6
-rw-r--r--src/mess/machine/rx01.c25
-rw-r--r--src/mess/machine/rx01.h4
-rw-r--r--src/mess/machine/sonydriv.c55
-rw-r--r--src/mess/machine/svi318.c2
-rw-r--r--src/mess/machine/swtpc09.c24
-rw-r--r--src/mess/machine/thomflop.c122
-rw-r--r--src/mess/machine/ti99/990_dk.c19
-rw-r--r--src/mess/machine/ti99/990_dk.h4
-rw-r--r--src/mess/machine/trs80.c24
37 files changed, 266 insertions, 264 deletions
diff --git a/src/mess/drivers/apf.c b/src/mess/drivers/apf.c
index 60d92fdceeb..eecaa789820 100644
--- a/src/mess/drivers/apf.c
+++ b/src/mess/drivers/apf.c
@@ -260,9 +260,9 @@ WRITE8_MEMBER( apf_state::apf_dischw_w)
m_fdc->set_drive(drive);
floppy_image_legacy *floppy;
- floppy = flopimg_get_image(floppy_get_device(machine(), drive));
- floppy_mon_w(floppy_get_device(machine(), drive), (floppy != NULL) ? 0 : 1);
- floppy_drive_set_ready_state(floppy_get_device(machine(), drive), (floppy != NULL) ? 1 : 0,0);
+ floppy = floppy_get_device(machine(), drive)->flopimg_get_image();
+ floppy_get_device(machine(), drive)->floppy_mon_w((floppy != NULL) ? 0 : 1);
+ floppy_get_device(machine(), drive)->floppy_drive_set_ready_state((floppy != NULL) ? 1 : 0,0);
logerror("disc w %04x %04x\n",offset,data);
diff --git a/src/mess/drivers/fm7.c b/src/mess/drivers/fm7.c
index 96ea5e47b79..fd694d2b626 100644
--- a/src/mess/drivers/fm7.c
+++ b/src/mess/drivers/fm7.c
@@ -492,8 +492,8 @@ WRITE8_MEMBER(fm7_state::fm7_fdc_w)
else
{
m_fdc->set_drive(data & 0x03);
- floppy_mon_w(floppy_get_device(machine(), data & 0x03), !BIT(data, 7));
- floppy_drive_set_ready_state(floppy_get_device(machine(), data & 0x03), data & 0x80,0);
+ floppy_get_device(machine(), data & 0x03)->floppy_mon_w(!BIT(data, 7));
+ floppy_get_device(machine(), data & 0x03)->floppy_drive_set_ready_state(data & 0x80,0);
logerror("FDC: wrote %02x to 0x%04x (drive)\n",data,offset+0xfd18);
}
break;
diff --git a/src/mess/drivers/mbc200.c b/src/mess/drivers/mbc200.c
index b541abbd996..707dab8f473 100644
--- a/src/mess/drivers/mbc200.c
+++ b/src/mess/drivers/mbc200.c
@@ -127,10 +127,10 @@ INPUT_PORTS_END
void mbc200_state::machine_start()
{
- floppy_mon_w(m_floppy0, CLEAR_LINE);
- floppy_mon_w(m_floppy1, CLEAR_LINE);
- floppy_drive_set_ready_state(m_floppy0, 1, 1);
- floppy_drive_set_ready_state(m_floppy1, 1, 1);
+ m_floppy0->floppy_mon_w(CLEAR_LINE);
+ m_floppy1->floppy_mon_w(CLEAR_LINE);
+ m_floppy0->floppy_drive_set_ready_state(1, 1);
+ m_floppy1->floppy_drive_set_ready_state(1, 1);
}
MC6845_UPDATE_ROW( mbc200_update_row )
diff --git a/src/mess/drivers/ms0515.c b/src/mess/drivers/ms0515.c
index 7de11d248f9..0317a9e7797 100644
--- a/src/mess/drivers/ms0515.c
+++ b/src/mess/drivers/ms0515.c
@@ -126,7 +126,7 @@ void ms0515_state::machine_reset()
m_video_ram = ram + 0000000 + 0340000;
m_blink = 0;
- floppy_mon_w(machine().device(FLOPPY_0), 0); // turn it on
+ machine().device<legacy_floppy_image_device>(FLOPPY_0)->floppy_mon_w(0); // turn it on
}
/* Input ports */
diff --git a/src/mess/drivers/myb3k.c b/src/mess/drivers/myb3k.c
index ba169605f98..b787756d52b 100644
--- a/src/mess/drivers/myb3k.c
+++ b/src/mess/drivers/myb3k.c
@@ -127,8 +127,8 @@ WRITE8_MEMBER( myb3k_state::myb3k_fdc_output_w )
{
/* TODO: complete guesswork! (it just does a 0x24 -> 0x20 in there) */
m_fdc->set_drive(data & 3);
- floppy_mon_w(floppy_get_device(machine(), data & 3), !(data & 4) ? 1: 0);
- floppy_drive_set_ready_state(floppy_get_device(machine(), data & 3), data & 0x4,0);
+ floppy_get_device(machine(), data & 3)->floppy_mon_w(!(data & 4) ? 1: 0);
+ floppy_get_device(machine(), data & 3)->floppy_drive_set_ready_state(data & 0x4,0);
//m_fdc->set_side((data & 0x10)>>4);
}
diff --git a/src/mess/drivers/mz2000.c b/src/mess/drivers/mz2000.c
index b9305d6013d..dbb7265127c 100644
--- a/src/mess/drivers/mz2000.c
+++ b/src/mess/drivers/mz2000.c
@@ -360,8 +360,8 @@ WRITE8_MEMBER(mz2000_state::mz2000_fdc_w)
{
case 0xdc:
m_mb8877a->set_drive(data & 3);
- floppy_mon_w(floppy_get_device(machine(), data & 3), (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
- floppy_drive_set_ready_state(floppy_get_device(machine(), data & 3), 1,0);
+ floppy_get_device(machine(), data & 3)->floppy_mon_w((data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
+ floppy_get_device(machine(), data & 3)->floppy_drive_set_ready_state(1,0);
break;
case 0xdd:
m_mb8877a->set_side((data & 1));
diff --git a/src/mess/drivers/mz2500.c b/src/mess/drivers/mz2500.c
index 0fcff111998..96168b24fa5 100644
--- a/src/mess/drivers/mz2500.c
+++ b/src/mess/drivers/mz2500.c
@@ -1190,8 +1190,8 @@ WRITE8_MEMBER(mz2500_state::mz2500_fdc_w)
{
case 0xdc:
fdc->set_drive(data & 3);
- floppy_mon_w(floppy_get_device(machine(), data & 3), (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
- floppy_drive_set_ready_state(floppy_get_device(machine(), data & 3), 1,0);
+ floppy_get_device(machine(), data & 3)->floppy_mon_w((data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
+ floppy_get_device(machine(), data & 3)->floppy_drive_set_ready_state(1,0);
break;
case 0xdd:
fdc->set_side((data & 1));
diff --git a/src/mess/drivers/rainbow.c b/src/mess/drivers/rainbow.c
index f2f0d4fc492..a618ec3b545 100644
--- a/src/mess/drivers/rainbow.c
+++ b/src/mess/drivers/rainbow.c
@@ -326,7 +326,7 @@ private:
virtual void machine_reset();
int m_unit;
- device_t *m_image[4];
+ legacy_floppy_image_device *m_image[4];
int m_irq_high;
UINT32 m_irq_mask;
@@ -335,10 +335,10 @@ private:
void rainbow_state::machine_start()
{
- m_image[0] = subdevice(FLOPPY_0);
- m_image[1] = subdevice(FLOPPY_1);
- m_image[2] = subdevice(FLOPPY_2);
- m_image[3] = subdevice(FLOPPY_3);
+ m_image[0] = subdevice<legacy_floppy_image_device>(FLOPPY_0);
+ m_image[1] = subdevice<legacy_floppy_image_device>(FLOPPY_1);
+ m_image[2] = subdevice<legacy_floppy_image_device>(FLOPPY_2);
+ m_image[3] = subdevice<legacy_floppy_image_device>(FLOPPY_3);
COLD_BOOT = 1;
@@ -863,9 +863,9 @@ D0 : ZFLIP L: (read from the diagnostic control register of Z80A)
NOTES: ALL LOW ACTIVE - EXCEPT TR00
*/
// * TRACK 00 * signal for current drive
- int tk00 = ( floppy_tk00_r( m_image[m_unit] ) == CLEAR_LINE ) ? 0x20 : 0x00;
+ int tk00 = ( m_image[m_unit]->floppy_tk00_r() == CLEAR_LINE ) ? 0x20 : 0x00;
- int fdc_ready = floppy_drive_get_flag_state( m_image[m_unit] , FLOPPY_DRIVE_READY);
+ int fdc_ready = m_image[m_unit]->floppy_drive_get_flag_state( FLOPPY_DRIVE_READY);
int data=( 0x80 | // (STEP L)
// ( (fdc_write_gate) ) |
@@ -958,7 +958,7 @@ WRITE8_MEMBER(rainbow_state::z80_diskcontrol_w)
int selected_drive = 255;
- if (flopimg_get_image( floppy_get_device( machine(), drive ) ) != NULL)
+ if (floppy_get_device( machine(), drive )->flopimg_get_image() != NULL)
{ selected_drive = drive;
m_fdc->set_drive(selected_drive);
}
@@ -987,10 +987,10 @@ WRITE8_MEMBER(rainbow_state::z80_diskcontrol_w)
{
// Although 1773 does not feature 'motor on' this statement is required:
// CLEAR_LINE = turn motor on -
- floppy_mon_w(m_image[f_num], (f_num == selected_drive) ? CLEAR_LINE : ASSERT_LINE);
+ m_image[f_num]->floppy_mon_w((f_num == selected_drive) ? CLEAR_LINE : ASSERT_LINE);
// Parameters: DRIVE, STATE, FLAG
- floppy_drive_set_ready_state( m_image[f_num],
+ m_image[f_num]->floppy_drive_set_ready_state(
(f_num == selected_drive) ? 1 : 0,
(f_num == selected_drive) ? force_ready : 0
);
diff --git a/src/mess/drivers/smc777.c b/src/mess/drivers/smc777.c
index 624219c8e08..a2d9cb76558 100644
--- a/src/mess/drivers/smc777.c
+++ b/src/mess/drivers/smc777.c
@@ -389,9 +389,9 @@ void smc777_state::check_floppy_inserted()
/* FIXME: floppy drive 1 doesn't work? */
for(f_num=0;f_num<2;f_num++)
{
- floppy = flopimg_get_image(floppy_get_device(machine(), f_num));
- floppy_mon_w(floppy_get_device(machine(), f_num), (floppy != NULL) ? 0 : 1);
- floppy_drive_set_ready_state(floppy_get_device(machine(), f_num), (floppy != NULL) ? 1 : 0,0);
+ floppy = floppy_get_device(machine(), f_num)->flopimg_get_image();
+ floppy_get_device(machine(), f_num)->floppy_mon_w((floppy != NULL) ? 0 : 1);
+ floppy_get_device(machine(), f_num)->floppy_drive_set_ready_state((floppy != NULL) ? 1 : 0,0);
}
}
diff --git a/src/mess/drivers/thomson.c b/src/mess/drivers/thomson.c
index edaef42e427..2ddad236297 100644
--- a/src/mess/drivers/thomson.c
+++ b/src/mess/drivers/thomson.c
@@ -566,22 +566,22 @@ INPUT_PORTS_END
WRITE_LINE_MEMBER( thomson_state::fdc_index_0_w )
{
- thomson_index_callback(machine().device(FLOPPY_0), state);
+ thomson_index_callback(machine().device<legacy_floppy_image_device>(FLOPPY_0), state);
}
WRITE_LINE_MEMBER( thomson_state::fdc_index_1_w )
{
- thomson_index_callback(machine().device(FLOPPY_1), state);
+ thomson_index_callback(machine().device<legacy_floppy_image_device>(FLOPPY_1), state);
}
WRITE_LINE_MEMBER( thomson_state::fdc_index_2_w )
{
- thomson_index_callback(machine().device(FLOPPY_2), state);
+ thomson_index_callback(machine().device<legacy_floppy_image_device>(FLOPPY_2), state);
}
WRITE_LINE_MEMBER( thomson_state::fdc_index_3_w )
{
- thomson_index_callback(machine().device(FLOPPY_3), state);
+ thomson_index_callback(machine().device<legacy_floppy_image_device>(FLOPPY_3), state);
}
static const floppy_interface thomson_floppy_interface_0 =
diff --git a/src/mess/drivers/unixpc.c b/src/mess/drivers/unixpc.c
index 50467ed9a0e..9e5e8dfb6a5 100644
--- a/src/mess/drivers/unixpc.c
+++ b/src/mess/drivers/unixpc.c
@@ -117,7 +117,7 @@ WRITE16_MEMBER( unixpc_state::disk_control_w )
{
logerror("disk_control_w: %04x\n", data);
- floppy_mon_w(m_floppy, !BIT(data, 5));
+ m_floppy->floppy_mon_w(!BIT(data, 5));
// bit 6 = floppy selected / not selected
m_wd2797->set_drive(0);
diff --git a/src/mess/drivers/vtech1.c b/src/mess/drivers/vtech1.c
index 5bb0f676869..7c0d10b3691 100644
--- a/src/mess/drivers/vtech1.c
+++ b/src/mess/drivers/vtech1.c
@@ -669,7 +669,7 @@ DRIVER_INIT_MEMBER(vtech1_state,vtech1)
for(id=0;id<2;id++)
{
- floppy_install_load_proc(floppy_get_device(machine(), id), vtech1_load_proc);
+ floppy_get_device(machine(), id)->floppy_install_load_proc(vtech1_load_proc);
}
}
diff --git a/src/mess/drivers/x1.c b/src/mess/drivers/x1.c
index d01194ed654..810820f8d3f 100644
--- a/src/mess/drivers/x1.c
+++ b/src/mess/drivers/x1.c
@@ -1037,8 +1037,8 @@ WRITE8_MEMBER( x1_state::x1_fdc_w )
break;
case 0x0ffc:
m_fdc->set_drive(data & 3);
- floppy_mon_w(floppy_get_device(machine(), data & 3), !BIT(data, 7));
- floppy_drive_set_ready_state(floppy_get_device(machine(), data & 3), data & 0x80,0);
+ floppy_get_device(machine(), data & 3)->floppy_mon_w(!BIT(data, 7));
+ floppy_get_device(machine(), data & 3)->floppy_drive_set_ready_state(data & 0x80,0);
m_fdc->set_side(BIT(data, 4));
break;
case 0x0ffd:
diff --git a/src/mess/drivers/z100.c b/src/mess/drivers/z100.c
index ed97b353bbd..706e38c813f 100644
--- a/src/mess/drivers/z100.c
+++ b/src/mess/drivers/z100.c
@@ -380,8 +380,8 @@ WRITE8_MEMBER( z100_state::z207_fdc_w )
m_z207_cur_drive = data & 3;
break;
case 5: // aux control
- floppy_mon_w(floppy_get_device(machine(), m_z207_cur_drive), !BIT(data, 1));
- floppy_drive_set_ready_state(floppy_get_device(machine(), m_z207_cur_drive), data & 2,0);
+ floppy_get_device(machine(), m_z207_cur_drive)->floppy_mon_w(!BIT(data, 1));
+ floppy_get_device(machine(), m_z207_cur_drive)->floppy_drive_set_ready_state(data & 2,0);
break;
}
diff --git a/src/mess/includes/thomson.h b/src/mess/includes/thomson.h
index 17cff65c7ec..92966ae125a 100644
--- a/src/mess/includes/thomson.h
+++ b/src/mess/includes/thomson.h
@@ -304,7 +304,7 @@ public:
WRITE_LINE_MEMBER( fdc_index_1_w );
WRITE_LINE_MEMBER( fdc_index_2_w );
WRITE_LINE_MEMBER( fdc_index_3_w );
- void thomson_index_callback(device_t *device, int state);
+ void thomson_index_callback(legacy_floppy_image_device *device, int state);
DECLARE_PALETTE_INIT(thom);
optional_device<mc6854_device> m_mc6854;
@@ -519,26 +519,26 @@ protected:
unsigned to7_lightpen_gpl( int decx, int decy );
int thom_floppy_make_addr( chrn_id id, UINT8* dst, int sector_size );
- int thom_floppy_make_sector( device_t* img, chrn_id id, UINT8* dst, int sector_size );
- int thom_floppy_make_track( device_t* img, UINT8* dst, int sector_size, int side );
+ int thom_floppy_make_sector( legacy_floppy_image_device* img, chrn_id id, UINT8* dst, int sector_size );
+ int thom_floppy_make_track( legacy_floppy_image_device* img, UINT8* dst, int sector_size, int side );
int thom_qdd_make_addr( int sector, UINT8* dst );
- int thom_qdd_make_sector( device_t* img, int sector, UINT8* dst );
- int thom_qdd_make_disk ( device_t* img, UINT8* dst );
+ int thom_qdd_make_sector( legacy_floppy_image_device* img, int sector, UINT8* dst );
+ int thom_qdd_make_disk ( legacy_floppy_image_device* img, UINT8* dst );
void to7_5p14_reset();
void to7_5p14_init();
- void to7_5p14_index_pulse_callback( device_t *controller,device_t *image, int state );
+ void to7_5p14_index_pulse_callback( device_t *controller,legacy_floppy_image_device *image, int state );
void to7_5p14sd_reset();
void to7_5p14sd_init();
- void to7_qdd_index_pulse_cb( device_t *controller,device_t *image, int state );
- device_t * to7_qdd_image();
+ void to7_qdd_index_pulse_cb( device_t *controller,legacy_floppy_image_device *image, int state );
+ legacy_floppy_image_device * to7_qdd_image();
void to7_qdd_stat_update();
UINT8 to7_qdd_read_byte();
void to7_qdd_write_byte( UINT8 data );
void to7_qdd_reset();
void to7_qdd_init();
- device_t * thmfc_floppy_image();
- int thmfc_floppy_is_qdd( device_image_interface *image );
- void thmfc_floppy_index_pulse_cb( device_t *controller,device_t *image, int state );
+ legacy_floppy_image_device * thmfc_floppy_image();
+ int thmfc_floppy_is_qdd( legacy_floppy_image_device *image );
+ void thmfc_floppy_index_pulse_cb( device_t *controller,legacy_floppy_image_device *image, int state );
int thmfc_floppy_find_sector( chrn_id* dst );
void thmfc_floppy_cmd_complete();
UINT8 thmfc_floppy_read_byte();
diff --git a/src/mess/machine/appldriv.c b/src/mess/machine/appldriv.c
index c326741ade5..16038e61422 100644
--- a/src/mess/machine/appldriv.c
+++ b/src/mess/machine/appldriv.c
@@ -27,13 +27,13 @@ INLINE apple525_floppy_image_device *get_device(device_t *device)
static int apple525_enable_mask = 1;
-device_t *apple525_get_subdevice(device_t *device, int drive)
+legacy_floppy_image_device *apple525_get_subdevice(device_t *device, int drive)
{
switch(drive) {
- case 0 : return device->subdevice(PARENT_FLOPPY_0);
- case 1 : return device->subdevice(PARENT_FLOPPY_1);
- case 2 : return device->subdevice(PARENT_FLOPPY_2);
- case 3 : return device->subdevice(PARENT_FLOPPY_3);
+ case 0 : return device->subdevice<legacy_floppy_image_device>(PARENT_FLOPPY_0);
+ case 1 : return device->subdevice<legacy_floppy_image_device>(PARENT_FLOPPY_1);
+ case 2 : return device->subdevice<legacy_floppy_image_device>(PARENT_FLOPPY_2);
+ case 3 : return device->subdevice<legacy_floppy_image_device>(PARENT_FLOPPY_3);
}
return NULL;
}
@@ -43,8 +43,8 @@ device_t *apple525_get_device_by_type(device_t *device, int ftype, int drive)
int i;
int cnt = 0;
for (i=0;i<4;i++) {
- device_t *disk = apple525_get_subdevice(device, i);
- if (floppy_get_drive_type(disk)==ftype) {
+ legacy_floppy_image_device *disk = apple525_get_subdevice(device, i);
+ if (disk->floppy_get_drive_type()==ftype) {
if (cnt==drive) {
return disk;
}
@@ -69,7 +69,7 @@ static void apple525_load_current_track(device_t *image)
disk = get_device(image);
len = sizeof(disk->track_data);
- floppy_drive_read_track_data_info_buffer(image, 0, disk->track_data, &len);
+ disk->floppy_drive_read_track_data_info_buffer(0, disk->track_data, &len);
disk->track_loaded = 1;
disk->track_dirty = 0;
}
@@ -84,14 +84,14 @@ static void apple525_save_current_track(device_t *image, int unload)
if (disk->track_dirty)
{
len = sizeof(disk->track_data);
- floppy_drive_write_track_data_info_buffer(image, 0, disk->track_data, &len);
+ disk->floppy_drive_write_track_data_info_buffer(0, disk->track_data, &len);
disk->track_dirty = 0;
}
if (unload)
disk->track_loaded = 0;
}
-static void apple525_seek_disk(device_t *img, signed int step)
+static void apple525_seek_disk(apple525_floppy_image_device *img, signed int step)
{
int track;
int pseudo_track;
@@ -101,7 +101,7 @@ static void apple525_seek_disk(device_t *img, signed int step)
apple525_save_current_track(img, FALSE);
- track = floppy_drive_get_current_track(img);
+ track = img->floppy_drive_get_current_track();
pseudo_track = (track * 2) + disk->tween_tracks;
pseudo_track += step;
@@ -112,7 +112,7 @@ static void apple525_seek_disk(device_t *img, signed int step)
if (pseudo_track/2 != track)
{
- floppy_drive_seek(img, pseudo_track/2 - floppy_drive_get_current_track(img));
+ img->floppy_drive_seek(pseudo_track/2 - img->floppy_drive_get_current_track());
disk->track_loaded = 0;
}
@@ -144,7 +144,7 @@ static void apple525_disk_set_lines(device_t *device,device_t *image, UINT8 new_
case 8: phase = 3; break;
}
- phase -= floppy_drive_get_current_track(image) * 2;
+ phase -= cur_disk->floppy_drive_get_current_track() * 2;
if (cur_disk->tween_tracks)
phase--;
phase %= 4;
@@ -152,10 +152,10 @@ static void apple525_disk_set_lines(device_t *device,device_t *image, UINT8 new_
switch(phase)
{
case 1:
- apple525_seek_disk(image, +1);
+ apple525_seek_disk(cur_disk, +1);
break;
case 3:
- apple525_seek_disk(image, -1);
+ apple525_seek_disk(cur_disk, -1);
break;
}
}
@@ -164,10 +164,10 @@ static void apple525_disk_set_lines(device_t *device,device_t *image, UINT8 new_
int apple525_get_count(device_t *device)
{
int cnt = 0;
- if ((device->subdevice("^"FLOPPY_0)!=NULL) && (floppy_get_drive_type(device->subdevice("^"FLOPPY_0)) == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_0))!=NULL)) cnt++;
- if ((device->subdevice("^"FLOPPY_1)!=NULL) && (floppy_get_drive_type(device->subdevice("^"FLOPPY_1)) == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_1))!=NULL)) cnt++;
- if ((device->subdevice("^"FLOPPY_2)!=NULL) && (floppy_get_drive_type(device->subdevice("^"FLOPPY_2)) == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_2))!=NULL)) cnt++;
- if ((device->subdevice("^"FLOPPY_3)!=NULL) && (floppy_get_drive_type(device->subdevice("^"FLOPPY_3)) == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_3))!=NULL)) cnt++;
+ if ((device->subdevice("^"FLOPPY_0)!=NULL) && (device->subdevice<legacy_floppy_image_device>("^"FLOPPY_0)->floppy_get_drive_type() == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_0))!=NULL)) cnt++;
+ if ((device->subdevice("^"FLOPPY_1)!=NULL) && (device->subdevice<legacy_floppy_image_device>("^"FLOPPY_1)->floppy_get_drive_type() == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_1))!=NULL)) cnt++;
+ if ((device->subdevice("^"FLOPPY_2)!=NULL) && (device->subdevice<legacy_floppy_image_device>("^"FLOPPY_2)->floppy_get_drive_type() == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_2))!=NULL)) cnt++;
+ if ((device->subdevice("^"FLOPPY_3)!=NULL) && (device->subdevice<legacy_floppy_image_device>("^"FLOPPY_3)->floppy_get_drive_type() == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_3))!=NULL)) cnt++;
return cnt;
}
@@ -307,7 +307,7 @@ apple525_floppy_image_device::apple525_floppy_image_device(const machine_config
void apple525_floppy_image_device::device_start()
{
legacy_floppy_image_device::device_start();
- floppy_set_type(this,FLOPPY_TYPE_APPLE);
+ floppy_set_type(FLOPPY_TYPE_APPLE);
state = 0;
tween_tracks = 0;
@@ -321,8 +321,8 @@ void apple525_floppy_image_device::device_start()
bool apple525_floppy_image_device::call_load()
{
int result = legacy_floppy_image_device::call_load();
- floppy_drive_seek(*this, -999);
- floppy_drive_seek(*this, +35/2);
+ floppy_drive_seek(-999);
+ floppy_drive_seek(+35/2);
return result;
}
diff --git a/src/mess/machine/atarifdc.c b/src/mess/machine/atarifdc.c
index 1cdc98e08c4..4e2cee018fb 100644
--- a/src/mess/machine/atarifdc.c
+++ b/src/mess/machine/atarifdc.c
@@ -16,7 +16,6 @@
#include "atarifdc.h"
#include "sound/pokey.h"
#include "machine/6821pia.h"
-#include "imagedev/flopdrv.h"
#include "formats/atari_dsk.h"
#define VERBOSE_SERIAL 0
@@ -746,13 +745,13 @@ static MACHINE_CONFIG_FRAGMENT( atari_fdc )
MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(atari_floppy_interface)
MACHINE_CONFIG_END
-device_t *atari_fdc_device::atari_floppy_get_device_child(int drive)
+legacy_floppy_image_device *atari_fdc_device::atari_floppy_get_device_child(int drive)
{
switch(drive) {
- case 0 : return subdevice(FLOPPY_0);
- case 1 : return subdevice(FLOPPY_1);
- case 2 : return subdevice(FLOPPY_2);
- case 3 : return subdevice(FLOPPY_3);
+ case 0 : return subdevice<legacy_floppy_image_device>(FLOPPY_0);
+ case 1 : return subdevice<legacy_floppy_image_device>(FLOPPY_1);
+ case 2 : return subdevice<legacy_floppy_image_device>(FLOPPY_2);
+ case 3 : return subdevice<legacy_floppy_image_device>(FLOPPY_3);
}
return NULL;
}
@@ -786,7 +785,7 @@ void atari_fdc_device::device_start()
for(id=0;id<4;id++)
{
- floppy_install_load_proc(atari_floppy_get_device_child(id), _atari_load_proc);
+ atari_floppy_get_device_child(id)->floppy_install_load_proc(_atari_load_proc);
}
}
diff --git a/src/mess/machine/atarifdc.h b/src/mess/machine/atarifdc.h
index 6eb132dabbc..a6bb687de25 100644
--- a/src/mess/machine/atarifdc.h
+++ b/src/mess/machine/atarifdc.h
@@ -6,6 +6,8 @@
#ifndef _ATARIFDC_H
#define _ATARIFDC_H
+#include "imagedev/flopdrv.h"
+
class atari_fdc_device : public device_t
{
public:
@@ -28,7 +30,7 @@ private:
void add_serin(UINT8 data, int with_checksum);
void a800_serial_command();
void a800_serial_write();
- device_t *atari_floppy_get_device_child(int drive);
+ legacy_floppy_image_device *atari_floppy_get_device_child(int drive);
struct atari_drive
{
diff --git a/src/mess/machine/beta.c b/src/mess/machine/beta.c
index aa7dd8cf726..7f2beec1194 100644
--- a/src/mess/machine/beta.c
+++ b/src/mess/machine/beta.c
@@ -158,9 +158,9 @@ WRITE8_MEMBER(beta_disk_device::param_w)
}
// bit 3 connected to pin 23 "HRDY" of FDC
// TEMP HACK, FDD motor and RDY FDC pin controlled by HLD pin of FDC
- device_t *flop = subdevice(beta_wd17xx_interface.floppy_drive_tags[data & 3]);
- floppy_mon_w(flop, CLEAR_LINE);
- floppy_drive_set_ready_state(flop, 1, 0);
+ legacy_floppy_image_device *flop = subdevice<legacy_floppy_image_device>(beta_wd17xx_interface.floppy_drive_tags[data & 3]);
+ flop->floppy_mon_w(CLEAR_LINE);
+ flop->floppy_drive_set_ready_state(1, 0);
}
}
diff --git a/src/mess/machine/concept_exp.c b/src/mess/machine/concept_exp.c
index 5c9f506d380..b861bc3ccd0 100644
--- a/src/mess/machine/concept_exp.c
+++ b/src/mess/machine/concept_exp.c
@@ -243,7 +243,7 @@ WRITE8_MEMBER(concept_fdc_device::reg_w)
// floppy_drive_set_motor_state(floppy_get_device(machine(), current_drive), (data & LC_MOTOROF_mask) == 0 ? 1 : 0);
/*flp_8in = (data & LC_FLP8IN_mask) != 0;*/
m_wd179x->dden_w(BIT(data, 7));
- floppy_drive_set_ready_state(floppy_get_device(machine(), current_drive), 1, 0);
+ floppy_get_device(machine(), current_drive)->floppy_drive_set_ready_state(1, 0);
break;
case 8: // FDC COMMAMD REG
diff --git a/src/mess/machine/hec2hrp.c b/src/mess/machine/hec2hrp.c
index 542d43b20a8..cdc22af2ba1 100644
--- a/src/mess/machine/hec2hrp.c
+++ b/src/mess/machine/hec2hrp.c
@@ -107,11 +107,11 @@ void hec2hrp_state::hector_minidisc_init()
fdc->dden_w(1);// density select => always 1 (0 ?a plante !)
/* FDC Motor Control - Bit 0/1 defines the state of the FDD 0/1 motor */
- floppy_mon_w(floppy_get_device(machine(), 0), 0); // Moteur floppy A:
- //floppy_mon_w(floppy_get_device(space.machine(), 1), BIT(data, 7)); // Moteur floppy B:, not implanted on the real machine
+ floppy_get_device(machine(), 0)->floppy_mon_w( 0); // Moteur floppy A:
+ //floppy_get_device(machine(), 1)->floppy_mon_w(BIT(data, 7)); // Moteur floppy B:, not implanted on the real machine
//Set the drive ready !
- floppy_drive_set_ready_state(floppy_get_device(machine(), 0), FLOPPY_DRIVE_READY, 0);// Disc 0 ready !
+ floppy_get_device(machine(), 0)->floppy_drive_set_ready_state(FLOPPY_DRIVE_READY, 0);// Disc 0 ready !
}
diff --git a/src/mess/machine/micropolis.c b/src/mess/machine/micropolis.c
index c3538bdcab6..93172ad6485 100644
--- a/src/mess/machine/micropolis.c
+++ b/src/mess/machine/micropolis.c
@@ -28,7 +28,6 @@ BE02 and BE03 - read data, write data
#include "emu.h"
-#include "imagedev/flopdrv.h"
#include "machine/micropolis.h"
@@ -162,15 +161,15 @@ void micropolis_device::device_reset()
{
if(m_floppy_drive_tags[i])
{
- device_t *img = NULL;
+ legacy_floppy_image_device *img = NULL;
- img = siblingdevice(m_floppy_drive_tags[i]);
+ img = siblingdevice<legacy_floppy_image_device>(m_floppy_drive_tags[i]);
if (img)
{
- floppy_drive_set_controller(img, this);
- //floppy_drive_set_index_pulse_callback(img, wd17xx_index_pulse_callback);
- floppy_drive_set_rpm( img, 300.);
+ img->floppy_drive_set_controller(this);
+ //img->floppy_drive_set_index_pulse_callback( wd17xx_index_pulse_callback);
+ img->floppy_drive_set_rpm( 300.);
}
}
}
@@ -197,7 +196,7 @@ void micropolis_device::read_sector()
m_data_count = m_sector_length;
/* read data */
- floppy_drive_read_sector_data(m_drive, 0, m_sector, (char *)m_buffer, m_sector_length);
+ m_drive->floppy_drive_read_sector_data(0, m_sector, (char *)m_buffer, m_sector_length);
}
@@ -213,7 +212,7 @@ void micropolis_device::write_sector()
m_data_count = m_sector_length;
/* write data */
- floppy_drive_write_sector_data(m_drive, 0, m_sector, (char *)m_buffer, m_sector_length, m_write_cmd & 0x01);
+ m_drive->floppy_drive_write_sector_data(0, m_sector, (char *)m_buffer, m_sector_length, m_write_cmd & 0x01);
#endif
}
@@ -231,7 +230,7 @@ void micropolis_device::set_drive(UINT8 drive)
logerror("micropolis_set_drive: $%02x\n", drive);
if (m_floppy_drive_tags[drive])
- m_drive = siblingdevice(m_floppy_drive_tags[drive]);
+ m_drive = siblingdevice<legacy_floppy_image_device>(m_floppy_drive_tags[drive]);
}
@@ -287,9 +286,9 @@ Command (bits 5,6,7) Options (bits 0,1,2,3,4)
{
case 1:
m_drive_num = data & 3;
- floppy_mon_w(m_drive, 1); // turn off the old drive
+ m_drive->floppy_mon_w(1); // turn off the old drive
set_drive(m_drive_num); // select new drive
- floppy_mon_w(m_drive, 0); // turn it on
+ m_drive->floppy_mon_w(0); // turn it on
break;
case 2: // not emulated, not used in sorcerer
break;
@@ -323,13 +322,13 @@ Command (bits 5,6,7) Options (bits 0,1,2,3,4)
if (BIT(data, 5))
m_status |= STAT_READY;
- floppy_drive_set_ready_state(m_drive, 1,0);
+ m_drive->floppy_drive_set_ready_state(1,0);
if (!m_track)
m_status |= STAT_TRACK0;
- floppy_drive_seek(m_drive, direction);
+ m_drive->floppy_drive_seek(direction);
}
diff --git a/src/mess/machine/micropolis.h b/src/mess/machine/micropolis.h
index 60b7ede301d..8ac0325280f 100644
--- a/src/mess/machine/micropolis.h
+++ b/src/mess/machine/micropolis.h
@@ -11,6 +11,7 @@
#define __MICROPOLIS_H__
#include "devcb.h"
+#include "imagedev/flopdrv.h"
/***************************************************************************
@@ -88,7 +89,7 @@ private:
UINT32 m_sector_length; /* sector length (byte) */
/* this is the drive currently selected */
- device_t *m_drive;
+ legacy_floppy_image_device *m_drive;
void read_sector();
void write_sector();
diff --git a/src/mess/machine/nes.c b/src/mess/machine/nes.c
index a74c2db4872..eb66a84fc6f 100644
--- a/src/mess/machine/nes.c
+++ b/src/mess/machine/nes.c
@@ -962,8 +962,8 @@ DRIVER_INIT_MEMBER(nes_state,famicom)
m_fds_ram = auto_alloc_array_clear(machine(), UINT8, 0x8000);
save_pointer(NAME(m_fds_ram), 0x8000);
- floppy_install_load_proc(floppy_get_device(machine(), 0), nes_load_proc);
- floppy_install_unload_proc(floppy_get_device(machine(), 0), nes_unload_proc);
+ floppy_get_device(machine(), 0)->floppy_install_load_proc(nes_load_proc);
+ floppy_get_device(machine(), 0)->floppy_install_unload_proc(nes_unload_proc);
// setup alt input handlers for additional FC input devices
address_space &space = machine().device<cpu_device>("maincpu")->space(AS_PROGRAM);
diff --git a/src/mess/machine/osborne1.c b/src/mess/machine/osborne1.c
index 27237a81bbb..999fc900bd2 100644
--- a/src/mess/machine/osborne1.c
+++ b/src/mess/machine/osborne1.c
@@ -429,7 +429,7 @@ void osborne1_state::machine_reset()
memset( m_ram->pointer() + 0x10000, 0xFF, 0x1000 );
for(drive=0;drive<2;drive++)
- floppy_install_load_proc(floppy_get_device(machine(), drive), osborne1_load_proc);
+ floppy_get_device(machine(), drive)->floppy_install_load_proc(osborne1_load_proc);
space.set_direct_update_handler(direct_update_delegate(FUNC(osborne1_state::osborne1_opbase), this));
}
diff --git a/src/mess/machine/partner.c b/src/mess/machine/partner.c
index bd520ae5e23..d61bc9b3bef 100644
--- a/src/mess/machine/partner.c
+++ b/src/mess/machine/partner.c
@@ -100,17 +100,17 @@ WRITE8_MEMBER(partner_state::partner_floppy_w){
default : m_fdc->data_w(space, 0,data);break;
}
} else {
- floppy_mon_w(floppy_get_device(machine(), 0), 1);
- floppy_mon_w(floppy_get_device(machine(), 1), 1);
+ floppy_get_device(machine(), 0)->floppy_mon_w(1);
+ floppy_get_device(machine(), 1)->floppy_mon_w(1);
if (((data >> 6) & 1)==1) {
m_fdc->set_drive(0);
- floppy_mon_w(floppy_get_device(machine(), 0), 0);
- floppy_drive_set_ready_state(floppy_get_device(machine(), 0), 1, 1);
+ floppy_get_device(machine(), 0)->floppy_mon_w(0);
+ floppy_get_device(machine(), 0)->floppy_drive_set_ready_state(1, 1);
}
if (((data >> 3) & 1)==1) {
m_fdc->set_drive(1);
- floppy_mon_w(floppy_get_device(machine(), 1), 0);
- floppy_drive_set_ready_state(floppy_get_device(machine(), 1), 1, 1);
+ floppy_get_device(machine(), 1)->floppy_mon_w(0);
+ floppy_get_device(machine(), 1)->floppy_drive_set_ready_state(1, 1);
}
m_fdc->set_side(data >> 7);
}
diff --git a/src/mess/machine/pk8020.c b/src/mess/machine/pk8020.c
index 227c18acc69..7629fadabef 100644
--- a/src/mess/machine/pk8020.c
+++ b/src/mess/machine/pk8020.c
@@ -840,27 +840,27 @@ WRITE8_MEMBER(pk8020_state::pk8020_portc_w)
WRITE8_MEMBER(pk8020_state::pk8020_portb_w)
{
// Turn all motors off
- floppy_mon_w(floppy_get_device(machine(), 0), 1);
- floppy_mon_w(floppy_get_device(machine(), 1), 1);
- floppy_mon_w(floppy_get_device(machine(), 2), 1);
- floppy_mon_w(floppy_get_device(machine(), 3), 1);
+ floppy_get_device(machine(), 0)->floppy_mon_w(1);
+ floppy_get_device(machine(), 1)->floppy_mon_w(1);
+ floppy_get_device(machine(), 2)->floppy_mon_w(1);
+ floppy_get_device(machine(), 3)->floppy_mon_w(1);
m_wd1793->set_side(BIT(data,4));
if (BIT(data,0)) {
m_wd1793->set_drive(0);
- floppy_mon_w(floppy_get_device(machine(), 0), 0);
- floppy_drive_set_ready_state(floppy_get_device(machine(), 0), 1, 1);
+ floppy_get_device(machine(), 0)->floppy_mon_w(0);
+ floppy_get_device(machine(), 0)->floppy_drive_set_ready_state(1, 1);
} else if (BIT(data,1)) {
m_wd1793->set_drive(1);
- floppy_mon_w(floppy_get_device(machine(), 1), 0);
- floppy_drive_set_ready_state(floppy_get_device(machine(), 1), 1, 1);
+ floppy_get_device(machine(), 1)->floppy_mon_w(0);
+ floppy_get_device(machine(), 1)->floppy_drive_set_ready_state(1, 1);
} else if (BIT(data,2)) {
m_wd1793->set_drive(2);
- floppy_mon_w(floppy_get_device(machine(), 2), 0);
- floppy_drive_set_ready_state(floppy_get_device(machine(), 2), 1, 1);
+ floppy_get_device(machine(), 2)->floppy_mon_w(0);
+ floppy_get_device(machine(), 2)->floppy_drive_set_ready_state(1, 1);
} else if (BIT(data,3)) {
m_wd1793->set_drive(3);
- floppy_mon_w(floppy_get_device(machine(), 3), 0);
- floppy_drive_set_ready_state(floppy_get_device(machine(), 3), 1, 1);
+ floppy_get_device(machine(), 3)->floppy_mon_w(0);
+ floppy_get_device(machine(), 3)->floppy_drive_set_ready_state(1, 1);
}
}
diff --git a/src/mess/machine/rmnimbus.c b/src/mess/machine/rmnimbus.c
index 7a58dbcb506..d9982e8cb4f 100644
--- a/src/mess/machine/rmnimbus.c
+++ b/src/mess/machine/rmnimbus.c
@@ -2274,7 +2274,7 @@ READ8_MEMBER(rmnimbus_state::nimbus_disk_r)
wd2793_device *fdc = machine().device<wd2793_device>(FDC_TAG);
int pc=space.device().safe_pc();
- device_t *drive = machine().device(nimbus_wd17xx_interface.floppy_drive_tags[FDC_DRIVE()]);
+ legacy_floppy_image_device *drive = machine().device<legacy_floppy_image_device>(nimbus_wd17xx_interface.floppy_drive_tags[FDC_DRIVE()]);
switch(offset*2)
{
@@ -2294,8 +2294,8 @@ READ8_MEMBER(rmnimbus_state::nimbus_disk_r)
case 0x10 :
m_nimbus_drives.reg410_in &= ~FDC_BITS_410;
m_nimbus_drives.reg410_in |= (FDC_MOTOR() ? FDC_MOTOR_MASKI : 0x00);
- m_nimbus_drives.reg410_in |= (floppy_drive_get_flag_state(drive, FLOPPY_DRIVE_INDEX) ? 0x00 : FDC_INDEX_MASK);
- m_nimbus_drives.reg410_in |= (floppy_drive_get_flag_state(drive, FLOPPY_DRIVE_READY) ? FDC_READY_MASK : 0x00);
+ m_nimbus_drives.reg410_in |= (drive->floppy_drive_get_flag_state(FLOPPY_DRIVE_INDEX) ? 0x00 : FDC_INDEX_MASK);
+ m_nimbus_drives.reg410_in |= (drive->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY) ? FDC_READY_MASK : 0x00);
// Flip inverted bits
result=m_nimbus_drives.reg410_in ^ INV_BITS_410;
diff --git a/src/mess/machine/rx01.c b/src/mess/machine/rx01.c
index b9b7d66b88b..da72c8f09cb 100644
--- a/src/mess/machine/rx01.c
+++ b/src/mess/machine/rx01.c
@@ -12,7 +12,6 @@
#include "emu.h"
#include "machine/rx01.h"
-#include "imagedev/flopdrv.h"
#include "formats/basicdsk.h"
static LEGACY_FLOPPY_OPTIONS_START( rx01 )
@@ -74,8 +73,8 @@ machine_config_constructor rx01_device::device_mconfig_additions() const
void rx01_device::device_start()
{
- m_image[0] = subdevice(FLOPPY_0);
- m_image[1] = subdevice(FLOPPY_1);
+ m_image[0] = subdevice<legacy_floppy_image_device>(FLOPPY_0);
+ m_image[1] = subdevice<legacy_floppy_image_device>(FLOPPY_1);
}
@@ -87,9 +86,9 @@ void rx01_device::device_reset()
{
for(int i=0;i<2;i++)
{
- floppy_mon_w(m_image[i], 0); // turn it on
- floppy_drive_set_controller(m_image[i], this);
- floppy_drive_set_rpm(m_image[i], 360.);
+ m_image[i]->floppy_mon_w(0); // turn it on
+ m_image[i]->floppy_drive_set_controller(this);
+ m_image[i]->floppy_drive_set_rpm(360.);
}
m_rxes = 0;
m_rxcs = 0;
@@ -128,7 +127,7 @@ void rx01_device::command_write(UINT16 data)
m_unit = BIT(data,4);
m_interrupt = BIT(data,6);
- floppy_drive_set_ready_state(m_image[m_unit], 1,0);
+ m_image[m_unit]->floppy_drive_set_ready_state(1,0);
if (BIT(data,14)) // Initialize
@@ -164,7 +163,7 @@ void rx01_device::command_write(UINT16 data)
case 7: // Read Error Register
m_state = RX01_COMPLETE;
// set ready signal according to current drive status
- m_rxes |= floppy_drive_get_flag_state(m_image[m_unit], FLOPPY_DRIVE_READY) << 7;
+ m_rxes |= m_image[m_unit]->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY) << 7;
break;
}
}
@@ -195,7 +194,7 @@ UINT16 rx01_device::data_read()
void rx01_device::service_command()
{
printf("service_command %d\n",m_state);
- m_rxes |= floppy_drive_get_flag_state(m_image[m_unit], FLOPPY_DRIVE_READY) << 7;
+ m_rxes |= m_image[m_unit]->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY) << 7;
switch(m_state) {
case RX01_FILL :
m_buffer[m_buf_pos] = m_rxdb & 0xff;
@@ -241,25 +240,25 @@ void rx01_device::service_command()
void rx01_device::position_head()
{
- int cur_track = floppy_drive_get_current_track(m_image[m_unit]);
+ int cur_track = m_image[m_unit]->floppy_drive_get_current_track();
int dir = (cur_track < m_rxta) ? +1 : -1;
while (m_rxta != cur_track)
{
cur_track += dir;
- floppy_drive_seek(m_image[m_unit], dir);
+ m_image[m_unit]->floppy_drive_seek(dir);
}
}
void rx01_device::read_sector()
{
/* read data */
- floppy_drive_read_sector_data(m_image[m_unit], 0, m_rxsa, (char *)m_buffer, 128);
+ m_image[m_unit]->floppy_drive_read_sector_data(0, m_rxsa, (char *)m_buffer, 128);
}
void rx01_device::write_sector(int ddam)
{
/* write data */
- floppy_drive_write_sector_data(m_image[m_unit], 0, m_rxsa, (char *)m_buffer, 128, ddam);
+ m_image[m_unit]->floppy_drive_write_sector_data(0, m_rxsa, (char *)m_buffer, 128, ddam);
}
diff --git a/src/mess/machine/rx01.h b/src/mess/machine/rx01.h
index df938876417..9e556f6d732 100644
--- a/src/mess/machine/rx01.h
+++ b/src/mess/machine/rx01.h
@@ -9,6 +9,8 @@
#ifndef __RX01__
#define __RX01__
+#include "imagedev/flopdrv.h"
+
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
@@ -61,7 +63,7 @@ private:
RX01_INIT
};
- device_t *m_image[2];
+ legacy_floppy_image_device *m_image[2];
UINT8 m_buffer[128];
int m_buf_pos;
diff --git a/src/mess/machine/sonydriv.c b/src/mess/machine/sonydriv.c
index 6c31bd6a378..05739d4ad0f 100644
--- a/src/mess/machine/sonydriv.c
+++ b/src/mess/machine/sonydriv.c
@@ -103,21 +103,21 @@ static int sony_enable2(void)
static void load_track_data(device_t *device,int floppy_select)
{
int track_size;
- device_image_interface *cur_image;
+ legacy_floppy_image_device *cur_image;
UINT8 *new_data;
floppy_t *f;
f = &sony.floppy[floppy_select];
- cur_image = dynamic_cast<device_image_interface *>(floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, floppy_select));
+ cur_image = floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, floppy_select);
- floppy_image_legacy *fimg = flopimg_get_image(&cur_image->device());
+ floppy_image_legacy *fimg = cur_image->flopimg_get_image();
if (!fimg)
{
return;
}
- track_size = floppy_get_track_size(fimg, f->head, floppy_drive_get_current_track(&cur_image->device()));
+ track_size = floppy_get_track_size(fimg, f->head, cur_image->floppy_drive_get_current_track());
if (f->loadedtrack_data) auto_free(device->machine(),f->loadedtrack_data);
new_data = auto_alloc_array(device->machine(),UINT8,track_size);
if (!new_data)
@@ -125,7 +125,7 @@ static void load_track_data(device_t *device,int floppy_select)
return;
}
- floppy_drive_read_track_data_info_buffer(&cur_image->device(), f->head, new_data, &track_size);
+ cur_image->floppy_drive_read_track_data_info_buffer(f->head, new_data, &track_size);
f->loadedtrack_valid = 1;
f->loadedtrack_dirty = 0;
f->loadedtrack_size = track_size;
@@ -137,17 +137,17 @@ static void load_track_data(device_t *device,int floppy_select)
static void save_track_data(device_t *device, int floppy_select)
{
- device_image_interface *cur_image;
+ legacy_floppy_image_device *cur_image;
floppy_t *f;
int len;
f = &sony.floppy[floppy_select];
- cur_image = dynamic_cast<device_image_interface *>(floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, floppy_select));
+ cur_image = floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, floppy_select);
if (f->loadedtrack_dirty)
{
len = f->loadedtrack_size;
- floppy_drive_write_track_data_info_buffer(&cur_image->device(), f->head, f->loadedtrack_data, &len);
+ cur_image->floppy_drive_write_track_data_info_buffer(f->head, f->loadedtrack_data, &len);
f->loadedtrack_dirty = 0;
}
}
@@ -157,14 +157,14 @@ static void save_track_data(device_t *device, int floppy_select)
UINT8 sony_read_data(device_t *device)
{
UINT8 result = 0;
- device_image_interface *cur_image;
+ legacy_floppy_image_device *cur_image;
floppy_t *f;
if (sony_enable2() || (! sony.floppy_enable))
return 0xFF; /* right ??? */
f = &sony.floppy[sony.floppy_select];
- cur_image = dynamic_cast<device_image_interface *>(floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, sony.floppy_select));
+ cur_image = floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, sony.floppy_select);
if (!cur_image->exists())
return 0xFF;
@@ -206,10 +206,9 @@ void sony_write_data(device_t *device,UINT8 data)
-static int sony_rpm(floppy_t *f, device_t *cur_image)
+static int sony_rpm(floppy_t *f, legacy_floppy_image_device *cur_image)
{
int result = 0;
- device_image_interface *image =dynamic_cast<device_image_interface *>(cur_image);
/*
* The Mac floppy controller was interesting in that its speed was adjusted
* while the thing was running. On the tracks closer to the rim, it was
@@ -253,8 +252,8 @@ static int sony_rpm(floppy_t *f, device_t *cur_image)
439 /* 64-79: timing value ???? (acceptable range {021E-0222} */
};
#endif
- if (cur_image && image->exists())
- result = speeds[floppy_drive_get_current_track(cur_image) / 16];
+ if (cur_image && cur_image->exists())
+ result = speeds[cur_image->floppy_drive_get_current_track() / 16];
}
return result;
}
@@ -264,7 +263,7 @@ int sony_read_status(device_t *device)
int result = 1;
int action;
floppy_t *f;
- device_image_interface *cur_image;
+ legacy_floppy_image_device *cur_image;
action = ((sony.lines & (SONY_CA1 | SONY_CA0)) << 2) | (sony.sel_line << 1) | ((sony.lines & SONY_CA2) >> 2);
@@ -277,7 +276,7 @@ int sony_read_status(device_t *device)
if ((! sony_enable2()) && sony.floppy_enable)
{
f = &sony.floppy[sony.floppy_select];
- cur_image = dynamic_cast<device_image_interface *>(floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, sony.floppy_select));
+ cur_image = floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, sony.floppy_select);
if (!cur_image->exists())
cur_image = NULL;
@@ -314,7 +313,7 @@ int sony_read_status(device_t *device)
break;
case 0x06: /* Disk is locked 0=locked 1=unlocked */
if (cur_image)
- result = floppy_wpt_r(&cur_image->device());
+ result = cur_image->floppy_wpt_r();
else
result = 0;
break;
@@ -324,7 +323,7 @@ int sony_read_status(device_t *device)
case 0x09: /* Number of sides: 0=single sided, 1=double sided */
if (cur_image)
{
- floppy_image_legacy *fimg = flopimg_get_image(&cur_image->device());
+ floppy_image_legacy *fimg = cur_image->flopimg_get_image();
if (fimg)
{
result = floppy_get_heads_per_disk(fimg) - 1;
@@ -335,7 +334,7 @@ int sony_read_status(device_t *device)
case 0x0a: /* At track 0: 0=track zero 1=not track zero */
logerror("%s sony.status(): reading Track 0\n", device->machine().describe_context());
if (cur_image)
- result = floppy_tk00_r(&cur_image->device());
+ result = cur_image->floppy_tk00_r();
else
result = 0;
break;
@@ -346,7 +345,7 @@ int sony_read_status(device_t *device)
{
if (cur_image)
{
- if (!floppy_dskchg_r(&cur_image->device()))
+ if (!cur_image->floppy_dskchg_r())
{
f->disk_switched = 1;
}
@@ -372,7 +371,7 @@ int sony_read_status(device_t *device)
/* (time in seconds) / (60 sec/minute) * (rounds/minute) * (60 pulses) * (2 pulse phases) */
if (cur_image)
{
- result = ((int) (device->machine().time().as_double() / 60.0 * sony_rpm(f, &cur_image->device()) * 60.0 * 2.0)) & 1;
+ result = ((int) (device->machine().time().as_double() / 60.0 * sony_rpm(f, cur_image) * 60.0 * 2.0)) & 1;
}
break;
case 0x0f: /* 400k/800k: Drive installed: 0=drive connected, 1=drive not connected */
@@ -400,7 +399,7 @@ static void sony_doaction(device_t *device)
{
int action;
floppy_t *f;
- device_image_interface *cur_image;
+ legacy_floppy_image_device *cur_image;
action = ((sony.lines & (SONY_CA1 | SONY_CA0)) << 2) | ((sony.lines & SONY_CA2) >> 2) | (sony.sel_line << 1);
@@ -413,7 +412,7 @@ static void sony_doaction(device_t *device)
if (sony.floppy_enable)
{
f = &sony.floppy[sony.floppy_select];
- cur_image = dynamic_cast<device_image_interface *>(floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, sony.floppy_select));
+ cur_image = floppy_get_device_by_type(device->machine(), FLOPPY_TYPE_SONY, sony.floppy_select);
if (!cur_image->exists())
cur_image = NULL;
@@ -433,21 +432,21 @@ static void sony_doaction(device_t *device)
{
save_track_data(device,sony.floppy_select);
if (f->step)
- floppy_drive_seek(&cur_image->device(), -1);
+ cur_image->floppy_drive_seek(-1);
else
- floppy_drive_seek(&cur_image->device(), +1);
+ cur_image->floppy_drive_seek(+1);
f->loadedtrack_valid = 0;
}
break;
case 0x08: /* Turn motor on */
f->motor_on = CLEAR_LINE;
if (cur_image)
- floppy_mon_w(&cur_image->device(), f->motor_on);
+ cur_image->floppy_mon_w(f->motor_on);
break;
case 0x09: /* Turn motor off */
f->motor_on = ASSERT_LINE;
if (cur_image)
- floppy_mon_w(&cur_image->device(), f->motor_on);
+ cur_image->floppy_mon_w(f->motor_on);
break;
case 0x0d: /* Eject disk */
if (cur_image)
@@ -542,7 +541,7 @@ sonydriv_floppy_image_device::sonydriv_floppy_image_device(const machine_config
void sonydriv_floppy_image_device::device_start()
{
legacy_floppy_image_device::device_start();
- floppy_set_type(this, FLOPPY_TYPE_SONY);
+ floppy_set_type(FLOPPY_TYPE_SONY);
sony.floppy[0].is_fdhd = 0;
sony.floppy[1].is_fdhd = 0;
diff --git a/src/mess/machine/svi318.c b/src/mess/machine/svi318.c
index a4adfbab7c4..d9006355ab7 100644
--- a/src/mess/machine/svi318.c
+++ b/src/mess/machine/svi318.c
@@ -564,7 +564,7 @@ MACHINE_RESET_MEMBER(svi318_state,svi318)
for(drive=0;drive<2;drive++)
{
- floppy_install_load_proc(floppy_get_device(machine(), drive), svi318_load_proc);
+ floppy_get_device(machine(), drive)->floppy_install_load_proc(svi318_load_proc);
}
}
diff --git a/src/mess/machine/swtpc09.c b/src/mess/machine/swtpc09.c
index 05e1cba7895..918c3fa22ce 100644
--- a/src/mess/machine/swtpc09.c
+++ b/src/mess/machine/swtpc09.c
@@ -154,21 +154,21 @@ WRITE8_MEMBER ( swtpc09_state::dmf2_control_reg_w )
case 0x0e:
m_fdc->set_drive(0);
// need to set drive ready as sw checks before doing anything
- floppy_drive_set_ready_state(machine().device("floppy0"), 1,0);
+ machine().device<legacy_floppy_image_device>("floppy0")->floppy_drive_set_ready_state(1,0);
break;
case 0x0d:
m_fdc->set_drive(1);
- floppy_drive_set_ready_state(machine().device("floppy1"), 1,0);
+ machine().device<legacy_floppy_image_device>("floppy1")->floppy_drive_set_ready_state(1,0);
break;
case 0x0b:
m_fdc->set_drive(2);
- floppy_drive_set_ready_state(machine().device("floppy2"), 1,0);
+ machine().device<legacy_floppy_image_device>("floppy2")->floppy_drive_set_ready_state(1,0);
break;
case 0x07:
m_fdc->set_drive(3);
- floppy_drive_set_ready_state(machine().device("floppy3"), 1,0);
+ machine().device<legacy_floppy_image_device>("floppy3")->floppy_drive_set_ready_state(1,0);
break;
default:
@@ -422,21 +422,21 @@ WRITE8_MEMBER ( swtpc09_state::dmf3_control_reg_w )
case 0x01:
m_fdc->set_drive(0);
// need to set drive ready as sw checks before doing anything
- floppy_drive_set_ready_state(machine().device("floppy0"), 1,0);
+ machine().device<legacy_floppy_image_device>("floppy0")->floppy_drive_set_ready_state(1,0);
break;
case 0x02:
m_fdc->set_drive(1);
- floppy_drive_set_ready_state(machine().device("floppy1"), 1,0);
+ machine().device<legacy_floppy_image_device>("floppy1")->floppy_drive_set_ready_state(1,0);
break;
case 0x04:
m_fdc->set_drive(2);
- floppy_drive_set_ready_state(machine().device("floppy2"), 1,0);
+ machine().device<legacy_floppy_image_device>("floppy2")->floppy_drive_set_ready_state(1,0);
break;
case 0x08:
m_fdc->set_drive(3);
- floppy_drive_set_ready_state(machine().device("floppy3"), 1,0);
+ machine().device<legacy_floppy_image_device>("floppy3")->floppy_drive_set_ready_state(1,0);
break;
default:
@@ -476,21 +476,21 @@ WRITE8_MEMBER ( swtpc09_state::dc4_control_reg_w )
case 0x00:
m_fdc->set_drive(0);
// need to set drive ready as sw checks before doing anything
- floppy_drive_set_ready_state(machine().device("floppy0"), 1,0);
+ machine().device<legacy_floppy_image_device>("floppy0")->floppy_drive_set_ready_state(1,0);
break;
case 0x01:
m_fdc->set_drive(1);
- floppy_drive_set_ready_state(machine().device("floppy1"), 1,0);
+ machine().device<legacy_floppy_image_device>("floppy1")->floppy_drive_set_ready_state(1,0);
break;
case 0x02:
m_fdc->set_drive(2);
- floppy_drive_set_ready_state(machine().device("floppy2"), 1,0);
+ machine().device<legacy_floppy_image_device>("floppy2")->floppy_drive_set_ready_state(1,0);
break;
case 0x03:
m_fdc->set_drive(3);
- floppy_drive_set_ready_state(machine().device("floppy3"), 1,0);
+ machine().device<legacy_floppy_image_device>("floppy3")->floppy_drive_set_ready_state(1,0);
break;
default:
diff --git a/src/mess/machine/thomflop.c b/src/mess/machine/thomflop.c
index aa365a488ea..c8a98d2d97b 100644
--- a/src/mess/machine/thomflop.c
+++ b/src/mess/machine/thomflop.c
@@ -115,15 +115,15 @@ int thomson_state::thom_floppy_make_addr( chrn_id id, UINT8* dst, int sector_siz
/* build a sector, with header & space */
-int thomson_state::thom_floppy_make_sector( device_t* img, chrn_id id, UINT8* dst, int sector_size )
+int thomson_state::thom_floppy_make_sector( legacy_floppy_image_device* img, chrn_id id, UINT8* dst, int sector_size )
{
if ( sector_size == 128 )
{
/* single density */
memset( dst, 0x00, 6 ); /* synchro bytes */
dst[ 6 ] = 0xfb; /* data field mark */
- floppy_drive_read_sector_data
- ( img, id.H, id.data_id, dst + 7, sector_size );
+ img->floppy_drive_read_sector_data
+ ( id.H, id.data_id, dst + 7, sector_size );
dst[ sector_size + 7 ] = 0; /* TODO: CRC */
dst[ sector_size + 8 ] = 0; /* TODO: CRC */
memset( dst + sector_size + 9, 0xff, 22 ); /* end mark */
@@ -134,8 +134,8 @@ int thomson_state::thom_floppy_make_sector( device_t* img, chrn_id id, UINT8* ds
/* double density */
memset( dst, 0xa1, 3 ); /* synchro bytes */
dst[ 3 ] = 0xfb; /* data field mark */
- floppy_drive_read_sector_data
- ( img, id.H, id.data_id, dst + 4, sector_size );
+ img->floppy_drive_read_sector_data
+ ( id.H, id.data_id, dst + 4, sector_size );
dst[ sector_size + 4 ] = 0; /* TODO: CRC */
dst[ sector_size + 5 ] = 0; /* TODO: CRC */
memset( dst + sector_size + 6, 0xF7, 74 ); /* end mark */
@@ -146,7 +146,7 @@ int thomson_state::thom_floppy_make_sector( device_t* img, chrn_id id, UINT8* ds
/* build a whole track */
-int thomson_state::thom_floppy_make_track( device_t* img, UINT8* dst, int sector_size, int side )
+int thomson_state::thom_floppy_make_track( legacy_floppy_image_device* img, UINT8* dst, int sector_size, int side )
{
UINT8 space = ( sector_size == 128 ) ? 0xff : 0;
UINT8* org = dst;
@@ -154,16 +154,16 @@ int thomson_state::thom_floppy_make_track( device_t* img, UINT8* dst, int sector
int nb;
/* go to start of track */
- while ( ! floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) )
+ while ( ! img->floppy_drive_get_flag_state( FLOPPY_DRIVE_INDEX ) )
{
- if ( ! floppy_drive_get_next_id( img, side, &id ) )
+ if ( ! img->floppy_drive_get_next_id( side, &id ) )
return 0;
}
/* for each sector... */
for ( nb = 0; nb < 16; nb++ )
{
- if ( ! floppy_drive_get_next_id( img, side, &id ) )
+ if ( ! img->floppy_drive_get_next_id( side, &id ) )
break;
memset( dst, space, THOM_SIZE_SYNCHRO ); dst += THOM_SIZE_SYNCHRO;
@@ -171,7 +171,7 @@ int thomson_state::thom_floppy_make_track( device_t* img, UINT8* dst, int sector
memset( dst, space, THOM_SIZE_SYNCHRO ); dst += THOM_SIZE_SYNCHRO;
dst += thom_floppy_make_sector( img, id, dst, sector_size );
- if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) )
+ if ( img->floppy_drive_get_flag_state( FLOPPY_DRIVE_INDEX ) )
break;
}
return dst - org;
@@ -222,11 +222,11 @@ int thomson_state::thom_qdd_make_addr( int sector, UINT8* dst )
/* build a sector, with header */
-int thomson_state::thom_qdd_make_sector( device_t* img, int sector, UINT8* dst )
+int thomson_state::thom_qdd_make_sector( legacy_floppy_image_device* img, int sector, UINT8* dst )
{
int i;
dst[ 0 ] = 0x5a;
- floppy_drive_read_sector_data ( img, 0, sector, dst + 1, 128 );
+ img->floppy_drive_read_sector_data ( 0, sector, dst + 1, 128 );
dst[ 129 ] = 0;
for ( i = 0; i < 129; i++ )
dst[ 129 ] += dst[ i ];
@@ -236,7 +236,7 @@ int thomson_state::thom_qdd_make_sector( device_t* img, int sector, UINT8* dst )
/* build a whole disk */
-int thomson_state::thom_qdd_make_disk ( device_t* img, UINT8* dst )
+int thomson_state::thom_qdd_make_disk ( legacy_floppy_image_device* img, UINT8* dst )
{
UINT8* org = dst;
int i;
@@ -418,7 +418,7 @@ WRITE8_MEMBER( thomson_state::to7_5p14sd_w )
machine().time().as_double(), m_maincpu->pc(), offset, data );
}
-void thomson_state::to7_5p14_index_pulse_callback( device_t *controller,device_t *image, int state )
+void thomson_state::to7_5p14_index_pulse_callback( device_t *controller,legacy_floppy_image_device *image, int state )
{
m_mc6843->set_index_pulse( state );
}
@@ -429,11 +429,11 @@ void thomson_state::to7_5p14sd_reset()
LOG(( "to7_5p14sd_reset: CD 90-015 controller\n" ));
for ( i = 0; i < floppy_get_count( machine() ); i++ )
{
- device_t * img = floppy_get_device( machine(), i );
+ legacy_floppy_image_device * img = floppy_get_device( machine(), i );
if (img) {
- floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
- floppy_drive_set_rpm( img, 300. );
- floppy_drive_seek( img, - floppy_drive_get_current_track( img ) );
+ 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() );
}
}
}
@@ -515,7 +515,7 @@ static to7qdd_t * to7qdd;
-void thomson_state::to7_qdd_index_pulse_cb( device_t *controller,device_t *image, int state )
+void thomson_state::to7_qdd_index_pulse_cb( device_t *controller,legacy_floppy_image_device *image, int state )
{
to7qdd->index_pulse = state;
@@ -532,7 +532,7 @@ void thomson_state::to7_qdd_index_pulse_cb( device_t *controller,device_t *image
-device_t * thomson_state::to7_qdd_image()
+legacy_floppy_image_device * thomson_state::to7_qdd_image()
{
return floppy_get_device( machine(), 0 );
}
@@ -548,7 +548,7 @@ void thomson_state::to7_qdd_stat_update()
to7qdd->status |= QDD_S_PE;
/* write-protect */
- if (floppy_wpt_r(to7_qdd_image()) == CLEAR_LINE)
+ if (to7_qdd_image()->floppy_wpt_r() == CLEAR_LINE)
to7qdd->status |= QDD_S_NCTS;
/* sticky reset conditions */
@@ -644,7 +644,7 @@ void thomson_state::to7_qdd_write_byte( UINT8 data )
LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n",
machine().time().as_double(), m_maincpu->pc(), sector ));
- floppy_drive_format_sector( to7_qdd_image(),
+ to7_qdd_image()->floppy_drive_format_sector(
0, sector, 0, 0, sector, 128, filler );
thom_floppy_active( 1 );
to7qdd->start_idx = to7qdd->data_idx;
@@ -673,7 +673,7 @@ void thomson_state::to7_qdd_write_byte( UINT8 data )
LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n",
machine().time().as_double(), m_maincpu->pc(), sector ));
- floppy_drive_write_sector_data( to7_qdd_image(), 0, sector, to7qdd->data + to7qdd->start_idx + 1, 128, 0 );
+ to7_qdd_image()->floppy_drive_write_sector_data( 0, sector, to7qdd->data + to7qdd->start_idx + 1, 128, 0 );
thom_floppy_active( 1 );
}
@@ -825,16 +825,16 @@ void thomson_state::to7_qdd_reset()
for ( i = 0; i < floppy_get_count( machine() ); i++ )
{
- device_t * img = floppy_get_device( machine(), i );
+ legacy_floppy_image_device * img = floppy_get_device( machine(), i );
if (img) {
- floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
+ img->floppy_drive_set_ready_state( FLOPPY_DRIVE_READY, 0 );
motor_on = CLEAR_LINE;
- floppy_mon_w(img, motor_on);
+ img->floppy_mon_w( motor_on);
/* pulse each time the whole-disk spiraling track ends */
/* at 90us per byte read, the disk can be read in 6s */
- floppy_drive_set_rpm( img, 60. / 6. );
+ img->floppy_drive_set_rpm( 60. / 6. );
}
}
@@ -927,14 +927,14 @@ static emu_timer* thmfc_floppy_cmd;
-device_t * thomson_state::thmfc_floppy_image()
+legacy_floppy_image_device * thomson_state::thmfc_floppy_image()
{
return floppy_get_device( machine(), thmfc1->drive );
}
-int thomson_state::thmfc_floppy_is_qdd ( device_image_interface *image )
+int thomson_state::thmfc_floppy_is_qdd ( legacy_floppy_image_device *image )
{
if (image==NULL) return 0;
if (!image->exists()) return 0;
@@ -943,15 +943,15 @@ int thomson_state::thmfc_floppy_is_qdd ( device_image_interface *image )
-void thomson_state::thmfc_floppy_index_pulse_cb ( device_t *controller,device_t *image, int state )
+void thomson_state::thmfc_floppy_index_pulse_cb ( device_t *controller,legacy_floppy_image_device *image, int state )
{
if ( image != thmfc_floppy_image())
return;
- if ( thmfc_floppy_is_qdd(dynamic_cast<device_image_interface *>(image)))
+ if ( thmfc_floppy_is_qdd(image))
{
/* pulse each time the whole-disk spiraling track ends */
- floppy_drive_set_rpm( image, 16.92f /* 423/25 */ );
+ image->floppy_drive_set_rpm( 16.92f /* 423/25 */ );
thmfc1->ipl = state;
if ( state )
{
@@ -962,7 +962,7 @@ void thomson_state::thmfc_floppy_index_pulse_cb ( device_t *controller,device_t
}
else
{
- floppy_drive_set_rpm( image, 300. );
+ image->floppy_drive_set_rpm( 300. );
thmfc1->ipl = state;
if ( state )
thmfc1->data_raw_idx = 0;
@@ -975,14 +975,14 @@ void thomson_state::thmfc_floppy_index_pulse_cb ( device_t *controller,device_t
int thomson_state::thmfc_floppy_find_sector( chrn_id* dst )
{
- device_t* img = thmfc_floppy_image();
+ legacy_floppy_image_device* img = thmfc_floppy_image();
chrn_id id;
int r = 0;
/* scan track, try 4 revolutions */
while ( r < 4 )
{
- if ( floppy_drive_get_next_id( img, thmfc1->side, &id ) )
+ if ( img->floppy_drive_get_next_id( thmfc1->side, &id ) )
{
if ( id.C == thmfc1->track &&
id.R == thmfc1->sector &&
@@ -997,12 +997,12 @@ int thomson_state::thmfc_floppy_find_sector( chrn_id* dst )
}
}
- if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) )
+ if ( img->floppy_drive_get_flag_state( FLOPPY_DRIVE_INDEX ) )
r++;
}
thmfc1->stat0 = THMFC1_STAT0_CRC_ERROR | THMFC1_STAT0_FINISHED;
- LOG (( "thmfc_floppy_find_sector: sector not found drive=%i track=%i sector=%i\n", floppy_get_drive( img ), thmfc1->track, thmfc1->sector ));
+ LOG (( "thmfc_floppy_find_sector: sector not found drive=%i track=%i sector=%i\n", floppy_get_drive(img), thmfc1->track, thmfc1->sector ));
return 0;
}
@@ -1017,8 +1017,8 @@ void thomson_state::thmfc_floppy_cmd_complete()
if ( thmfc1->op == THMFC1_OP_WRITE_SECT )
{
- device_t * img = thmfc_floppy_image();
- floppy_drive_write_sector_data( img, thmfc1->side, thmfc1->sector_id, thmfc1->data + 3, thmfc1->data_size - 3, 0 );
+ legacy_floppy_image_device * img = thmfc_floppy_image();
+ img->floppy_drive_write_sector_data( thmfc1->side, thmfc1->sector_id, thmfc1->data + 3, thmfc1->data_size - 3, 0 );
thom_floppy_active( 1 );
}
thmfc1->op = THMFC1_OP_RESET;
@@ -1068,7 +1068,7 @@ UINT8 thomson_state::thmfc_floppy_raw_read_byte()
/* rebuild track if needed */
if ( ! thmfc1->data_raw_size )
{
- if ( thmfc_floppy_is_qdd(dynamic_cast<device_image_interface *>(thmfc_floppy_image())))
+ if ( thmfc_floppy_is_qdd(thmfc_floppy_image()))
/* QDD: track = whole disk */
thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(), thmfc1->data );
else
@@ -1136,7 +1136,7 @@ void thomson_state::thmfc_floppy_qdd_write_byte( UINT8 data )
LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: id field, sector=%i\n", machine().time().as_double(), m_maincpu->pc(), sector ));
- floppy_drive_format_sector( thmfc_floppy_image(), 0, sector, 0, 0, sector, 128, filler );
+ thmfc_floppy_image()->floppy_drive_format_sector( 0, sector, 0, 0, sector, 128, filler );
thom_floppy_active( 1 );
thmfc1->data_idx = 0;
}
@@ -1158,14 +1158,14 @@ void thomson_state::thmfc_floppy_qdd_write_byte( UINT8 data )
if ( i >= 0 )
{
/* got an id & a data field => write */
- device_t * img = thmfc_floppy_image();
+ legacy_floppy_image_device * img = thmfc_floppy_image();
int sector = (int) thmfc1->data[ i + 1 ] * 256 +
(int) thmfc1->data[ i + 2 ];
LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: data field, sector=%i\n",
machine().time().as_double(), m_maincpu->pc(), sector ));
- floppy_drive_write_sector_data( img, 0, sector, thmfc1->data + thmfc1->data_idx, 128, 0 );
+ img->floppy_drive_write_sector_data( 0, sector, thmfc1->data + thmfc1->data_idx, 128, 0 );
thom_floppy_active( 1 );
}
@@ -1218,7 +1218,7 @@ void thomson_state::thmfc_floppy_format_byte( UINT8 data )
if ( !memcmp ( thmfc1->data, header, sizeof( header ) ) )
{
/* got id field => format */
- device_t * img = thmfc_floppy_image();
+ legacy_floppy_image_device * img = thmfc_floppy_image();
UINT8 track = thmfc1->data[4];
UINT8 side = thmfc1->data[5];
UINT8 sector = thmfc1->data[6];
@@ -1227,7 +1227,7 @@ void thomson_state::thmfc_floppy_format_byte( UINT8 data )
chrn_id id;
if ( thmfc_floppy_find_sector( &id ) )
{
- floppy_drive_format_sector( img, side, thmfc1->sector_id, track, thmfc1->side, sector, length, filler );
+ img->floppy_drive_format_sector( side, thmfc1->sector_id, track, thmfc1->side, sector, length, filler );
thom_floppy_active( 1 );
}
}
@@ -1252,8 +1252,8 @@ READ8_MEMBER( thomson_state::thmfc_floppy_r )
case 1: /* STAT1 */
{
UINT8 data = 0;
- device_image_interface * img = dynamic_cast<device_image_interface *>(thmfc_floppy_image());
- int flags = floppy_drive_get_flag_state( &img->device(), -1 );
+ legacy_floppy_image_device * img = thmfc_floppy_image();
+ int flags = img->floppy_drive_get_flag_state(-1 );
if ( thmfc_floppy_is_qdd(img) )
{
if ( ! img->exists() )
@@ -1269,14 +1269,14 @@ READ8_MEMBER( thomson_state::thmfc_floppy_r )
if ( img->exists() )
data |= 0x20; /* disk change (?) */
- data |= !floppy_tk00_r(&img->device()) << 3;
+ data |= !img->floppy_tk00_r() << 3;
if ( flags & FLOPPY_DRIVE_READY )
data |= 0x02;
}
if (!motor_on)
data |= 0x10;
- if (!floppy_wpt_r(&img->device()))
+ if (!img->floppy_wpt_r())
data |= 0x04;
VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", machine().time().as_double(), m_maincpu->pc(), data ));
return data;
@@ -1314,7 +1314,7 @@ WRITE8_MEMBER( thomson_state::thmfc_floppy_w )
case 0: /* CMD0 */
{
int wsync = (data >> 4) & 1;
- int qdd = thmfc_floppy_is_qdd(dynamic_cast<device_image_interface *>(thmfc_floppy_image()));
+ int qdd = thmfc_floppy_is_qdd(thmfc_floppy_image());
chrn_id id;
thmfc1->formatting = (data >> 2) & 1;
LOG (( "%f $%04x thmfc_floppy_w: CMD0=$%02X dens=%s wsync=%i dsync=%i fmt=%i op=%i\n",
@@ -1415,12 +1415,12 @@ WRITE8_MEMBER( thomson_state::thmfc_floppy_w )
case 2: /* CMD2 */
{
- device_t * img;
+ legacy_floppy_image_device * img;
int seek = 0, motor;
thmfc1->drive = data & 2;
- img = thmfc_floppy_image();
- if ( thmfc_floppy_is_qdd(dynamic_cast<device_image_interface *>(img)))
+ img = thmfc_floppy_image();
+ if ( thmfc_floppy_is_qdd(img))
{
motor = !(data & 0x40);
/* no side select & no seek for QDD */
@@ -1443,7 +1443,7 @@ WRITE8_MEMBER( thomson_state::thmfc_floppy_w )
if ( seek )
{
thmfc1->data_raw_size = 0;
- floppy_drive_seek( img, seek );
+ img->floppy_drive_seek( seek );
}
/* in real life, to keep the motor running, it is sufficient to
@@ -1451,14 +1451,14 @@ WRITE8_MEMBER( thomson_state::thmfc_floppy_w )
instead of counting, we assume the motor is always running...
*/
motor_on = CLEAR_LINE /* motor */;
- floppy_mon_w(img, motor_on);
+ img->floppy_mon_w(motor_on);
}
break;
case 3: /* WDATA */
thmfc1->wsync = data;
- if ( thmfc_floppy_is_qdd(dynamic_cast<device_image_interface *>(thmfc_floppy_image())))
+ if ( thmfc_floppy_is_qdd(thmfc_floppy_image()))
thmfc_floppy_qdd_write_byte( data );
else if ( thmfc1->op==THMFC1_OP_WRITE_SECT )
thmfc_floppy_write_byte( data );
@@ -1490,7 +1490,7 @@ WRITE8_MEMBER( thomson_state::thmfc_floppy_w )
thmfc1->track = data;
LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n",
machine().time().as_double(), m_maincpu->pc(), data,
- floppy_drive_get_current_track( thmfc_floppy_image() ) ));
+ thmfc_floppy_image()->floppy_drive_get_current_track()));
break;
case 7: /* WCELL */
@@ -1514,10 +1514,10 @@ void thomson_state::thmfc_floppy_reset()
for ( i = 0; i < floppy_get_count( machine() ); i++ )
{
- device_t * img = floppy_get_device( machine(), i );
+ legacy_floppy_image_device * img = floppy_get_device( machine(), i );
if (img) {
- floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
- floppy_drive_seek( img, - floppy_drive_get_current_track( img ) );
+ img->floppy_drive_set_ready_state( FLOPPY_DRIVE_READY, 0 );
+ img->floppy_drive_seek( - img->floppy_drive_get_current_track() );
}
}
@@ -1912,7 +1912,7 @@ WRITE8_MEMBER( thomson_state::to9_floppy_w )
to7_5p14_w( space, offset, data, mem_mask );
}
-void thomson_state::thomson_index_callback(device_t *device, int state)
+void thomson_state::thomson_index_callback(legacy_floppy_image_device *device, int state)
{
switch ( to7_controller_type )
{
diff --git a/src/mess/machine/ti99/990_dk.c b/src/mess/machine/ti99/990_dk.c
index 05876546eca..85991f392a9 100644
--- a/src/mess/machine/ti99/990_dk.c
+++ b/src/mess/machine/ti99/990_dk.c
@@ -16,7 +16,6 @@
#include "emu.h"
#include "formats/basicdsk.h"
-#include "imagedev/flopdrv.h"
#include "990_dk.h"
/* status bits */
@@ -110,7 +109,7 @@ int fd800_legacy_device::read_id(int unit, int head, int *cylinder_id, int *sect
/*while (revolution_count < 2)*/
/*{*/
- if (floppy_drive_get_next_id(&m_drv[unit].img->device(), head, &id))
+ if (m_drv[unit].img->floppy_drive_get_next_id(head, &id))
{
if (cylinder_id)
*cylinder_id = id.C;
@@ -142,7 +141,7 @@ int fd800_legacy_device::find_sector(int unit, int head, int sector, int *data_i
while (revolution_count < 2)
{
- if (floppy_drive_get_next_id(&m_drv[unit].img->device(), head, &id))
+ if (m_drv[unit].img->floppy_drive_get_next_id(head, &id))
{
/* compare id */
if ((id.R == sector) && (id.N == 0))
@@ -199,7 +198,7 @@ int fd800_legacy_device::do_seek(int unit, int cylinder, int head)
}
for (retries=0; retries<10; retries++)
{ /* seek to requested track */
- floppy_drive_seek(&m_drv[unit].img->device(), cylinder-m_drv[unit].log_cylinder[head]);
+ m_drv[unit].img->floppy_drive_seek(cylinder-m_drv[unit].log_cylinder[head]);
/* update physical track position */
if (m_drv[unit].phys_cylinder != -1)
m_drv[unit].phys_cylinder += cylinder-m_drv[unit].log_cylinder[head];
@@ -241,9 +240,9 @@ int fd800_legacy_device::do_restore(int unit)
}
/* limit iterations to 76 to prevent an endless loop if the disc is locked */
- while (!(seek_complete = !floppy_tk00_r(&m_drv[unit].img->device())) && (seek_count < 76))
+ while (!(seek_complete = !m_drv[unit].img->floppy_tk00_r()) && (seek_count < 76))
{
- floppy_drive_seek(&m_drv[unit].img->device(), -1);
+ m_drv[unit].img->floppy_drive_seek(-1);
seek_count++;
}
if (! seek_complete)
@@ -279,7 +278,7 @@ void fd800_legacy_device::do_read(void)
return;
}
- floppy_drive_read_sector_data(&m_drv[m_unit].img->device(), m_head, data_id, m_buf, 128);
+ m_drv[m_unit].img->floppy_drive_read_sector_data(m_head, data_id, m_buf, 128);
m_buf_pos = 0;
m_buf_mode = bm_read;
m_recv_buf = (m_buf[m_buf_pos<<1] << 8) | m_buf[(m_buf_pos<<1)+1];
@@ -305,7 +304,7 @@ void fd800_legacy_device::do_write(void)
return;
}
- floppy_drive_write_sector_data(&m_drv[m_unit].img->device(), m_head, data_id, m_buf, 128, m_ddam);
+ m_drv[m_unit].img->floppy_drive_write_sector_data(m_head, data_id, m_buf, 128, m_ddam);
m_buf_pos = 0;
m_buf_mode = bm_write;
@@ -587,7 +586,7 @@ void fd800_legacy_device::do_cmd(void)
}
else if ((m_drv[unit].phys_cylinder != -1) || (!do_restore(unit)))
{
- floppy_drive_seek(&m_drv[unit].img->device(), cylinder-m_drv[unit].phys_cylinder);
+ m_drv[unit].img->floppy_drive_seek(cylinder-m_drv[unit].phys_cylinder);
m_stat_reg |= status_OP_complete;
}
@@ -871,7 +870,7 @@ void fd800_legacy_device::device_start(void)
for (int i=0; i<MAX_FLOPPIES; i++)
{
- m_drv[i].img = dynamic_cast<device_image_interface *>(floppy_get_device(machine(), i));
+ m_drv[i].img = floppy_get_device(machine(), i);
m_drv[i].phys_cylinder = -1;
m_drv[i].log_cylinder[0] = m_drv[i].log_cylinder[1] = -1;
m_drv[i].seclen = 64;
diff --git a/src/mess/machine/ti99/990_dk.h b/src/mess/machine/ti99/990_dk.h
index 12421295025..0d0fa4e74e2 100644
--- a/src/mess/machine/ti99/990_dk.h
+++ b/src/mess/machine/ti99/990_dk.h
@@ -5,6 +5,8 @@
#ifndef __990_DK__
#define __990_DK__
+#include "imagedev/flopdrv.h"
+
extern const device_type FD800;
#define MAX_FLOPPIES 4
@@ -57,7 +59,7 @@ private:
struct
{
- device_image_interface *img;
+ legacy_floppy_image_device *img;
int phys_cylinder;
int log_cylinder[2];
int seclen;
diff --git a/src/mess/machine/trs80.c b/src/mess/machine/trs80.c
index 91e7f423193..3b8d1f605bd 100644
--- a/src/mess/machine/trs80.c
+++ b/src/mess/machine/trs80.c
@@ -527,10 +527,10 @@ WRITE8_MEMBER( trs80_state::trs80m4_f4_w )
m_fdc->dden_w(!BIT(data, 7));
/* CLEAR_LINE means to turn motors on */
- floppy_mon_w(floppy_get_device(machine(), 0), (data & 0x0f) ? CLEAR_LINE : ASSERT_LINE);
- floppy_mon_w(floppy_get_device(machine(), 1), (data & 0x0f) ? CLEAR_LINE : ASSERT_LINE);
- floppy_mon_w(floppy_get_device(machine(), 2), (data & 0x0f) ? CLEAR_LINE : ASSERT_LINE);
- floppy_mon_w(floppy_get_device(machine(), 3), (data & 0x0f) ? CLEAR_LINE : ASSERT_LINE);
+ floppy_get_device(machine(), 0)->floppy_mon_w((data & 0x0f) ? CLEAR_LINE : ASSERT_LINE);
+ floppy_get_device(machine(), 1)->floppy_mon_w((data & 0x0f) ? CLEAR_LINE : ASSERT_LINE);
+ floppy_get_device(machine(), 2)->floppy_mon_w((data & 0x0f) ? CLEAR_LINE : ASSERT_LINE);
+ floppy_get_device(machine(), 3)->floppy_mon_w((data & 0x0f) ? CLEAR_LINE : ASSERT_LINE);
}
WRITE8_MEMBER( trs80_state::sys80_f8_w )
@@ -781,10 +781,10 @@ WRITE8_MEMBER( trs80_state::trs80_motor_w )
if (drive > 3)
{ /* Turn motors off */
- floppy_mon_w(floppy_get_device(machine(), 0), ASSERT_LINE);
- floppy_mon_w(floppy_get_device(machine(), 1), ASSERT_LINE);
- floppy_mon_w(floppy_get_device(machine(), 2), ASSERT_LINE);
- floppy_mon_w(floppy_get_device(machine(), 3), ASSERT_LINE);
+ floppy_get_device(machine(), 0)->floppy_mon_w(ASSERT_LINE);
+ floppy_get_device(machine(), 1)->floppy_mon_w(ASSERT_LINE);
+ floppy_get_device(machine(), 2)->floppy_mon_w(ASSERT_LINE);
+ floppy_get_device(machine(), 3)->floppy_mon_w(ASSERT_LINE);
return;
}
@@ -792,10 +792,10 @@ WRITE8_MEMBER( trs80_state::trs80_motor_w )
m_fdc->set_side(m_head);
/* Turn motors on */
- floppy_mon_w(floppy_get_device(machine(), 0), CLEAR_LINE);
- floppy_mon_w(floppy_get_device(machine(), 1), CLEAR_LINE);
- floppy_mon_w(floppy_get_device(machine(), 2), CLEAR_LINE);
- floppy_mon_w(floppy_get_device(machine(), 3), CLEAR_LINE);
+ floppy_get_device(machine(), 0)->floppy_mon_w(CLEAR_LINE);
+ floppy_get_device(machine(), 1)->floppy_mon_w(CLEAR_LINE);
+ floppy_get_device(machine(), 2)->floppy_mon_w(CLEAR_LINE);
+ floppy_get_device(machine(), 3)->floppy_mon_w(CLEAR_LINE);
}
/*************************************