modernized access for legacy floppy, quite straight forward thing (nw)

This commit is contained in:
Miodrag Milanovic 2014-04-02 11:59:10 +00:00
parent 06238c1cdb
commit b1c2c8daee
59 changed files with 813 additions and 942 deletions

View File

@ -110,10 +110,10 @@ WRITE8_MEMBER( bml3bus_mp1802_device::bml3_mp1802_w)
floppy_name = FLOPPY_3;
break;
}
device_t *floppy = subdevice(floppy_name);
legacy_floppy_image_device *floppy = subdevice<legacy_floppy_image_device>(floppy_name);
m_wd17xx->set_drive(drive);
floppy_mon_w(floppy, !motor);
floppy_drive_set_ready_state(floppy, ASSERT_LINE, 0);
floppy->floppy_mon_w(!motor);
floppy->floppy_drive_set_ready_state(ASSERT_LINE, 0);
m_wd17xx->set_side(side);
}

View File

@ -128,10 +128,10 @@ WRITE8_MEMBER( bml3bus_mp1805_device::bml3_mp1805_w)
floppy_name = FLOPPY_3;
break;
}
device_t *floppy = subdevice(floppy_name);
legacy_floppy_image_device *floppy = subdevice<legacy_floppy_image_device>(floppy_name);
m_mc6843->set_drive(drive);
floppy_mon_w(floppy, motor);
floppy_drive_set_ready_state(floppy, ASSERT_LINE, 0);
floppy->floppy_mon_w(motor);
floppy->floppy_drive_set_ready_state(ASSERT_LINE, 0);
m_mc6843->set_side(side);
}

View File

@ -299,16 +299,16 @@ void coco_fdc_device::dskreg_w(UINT8 data)
else if (data & 0x40)
drive = 3;
device_t *floppy[4];
legacy_floppy_image_device *floppy[4];
floppy[0] = subdevice(FLOPPY_0);
floppy[1] = subdevice(FLOPPY_1);
floppy[2] = subdevice(FLOPPY_2);
floppy[3] = subdevice(FLOPPY_3);
floppy[0] = subdevice<legacy_floppy_image_device>(FLOPPY_0);
floppy[1] = subdevice<legacy_floppy_image_device>(FLOPPY_1);
floppy[2] = subdevice<legacy_floppy_image_device>(FLOPPY_2);
floppy[3] = subdevice<legacy_floppy_image_device>(FLOPPY_3);
for (int i = 0; i < 4; i++)
{
floppy_mon_w(floppy[i], i == drive ? CLEAR_LINE : ASSERT_LINE);
floppy[i]->floppy_mon_w(i == drive ? CLEAR_LINE : ASSERT_LINE);
}
head = ((data & 0x40) && (drive != 3)) ? 1 : 0;

View File

@ -618,7 +618,7 @@ READ8_MEMBER( c8050_device::miot_pb_r )
UINT8 data = 0;
// write protect sense
data |= floppy_wpt_r(m_unit[m_drive].m_image) << 3;
data |= m_unit[m_drive].m_image->floppy_wpt_r() << 3;
// drive type
data |= 0x10;
@ -1017,10 +1017,10 @@ inline void c8050_device::read_current_track(int unit)
m_bit_count = 0;
// read track data
floppy_drive_read_track_data_info_buffer(m_unit[unit].m_image, m_side, m_unit[unit].m_track_buffer, &m_unit[unit].m_track_len);
m_unit[unit].m_image->floppy_drive_read_track_data_info_buffer(m_side, m_unit[unit].m_track_buffer, &m_unit[unit].m_track_len);
// extract track length
m_unit[unit].m_track_len = floppy_drive_get_current_track_size(m_unit[unit].m_image, m_side);
m_unit[unit].m_track_len = m_unit[unit].m_image->floppy_drive_get_current_track_size(m_side);
}
@ -1038,7 +1038,7 @@ inline void c8050_device::spindle_motor(int unit, int mtr)
read_current_track(unit);
}
floppy_mon_w(m_unit[unit].m_image, mtr);
m_unit[unit].m_image->floppy_mon_w(mtr);
m_unit[unit].m_mtr = mtr;
}
@ -1066,7 +1066,7 @@ inline void c8050_device::mpi_step_motor(int unit, int stp)
if (tracks != 0)
{
// step read/write head
floppy_drive_seek(m_unit[unit].m_image, tracks);
m_unit[unit].m_image->floppy_drive_seek(tracks);
// read new track data
read_current_track(unit);
@ -1199,13 +1199,13 @@ void c8050_device::device_start()
// install image callbacks
m_unit[0].m_image = m_image0;
floppy_install_load_proc(m_image0, c8050_device::on_disk0_change);
m_image0->floppy_install_load_proc(c8050_device::on_disk0_change);
if (m_image1)
{
m_unit[1].m_image = m_image1;
floppy_install_load_proc(m_image1, c8050_device::on_disk1_change);
m_image1->floppy_install_load_proc(c8050_device::on_disk1_change);
}
// register for state saving

View File

@ -125,7 +125,7 @@ protected:
int m_bit_pos; // bit position within track buffer byte
// devices
device_t *m_image;
legacy_floppy_image_device *m_image;
} m_unit[2];
int m_drive; // selected drive

View File

@ -839,20 +839,20 @@ READ8Z_MEMBER(snug_bwg_legacy_device::readz)
the default implementation sets the drive geometry to the geometry
of the medium.
*/
void snug_bwg_legacy_device::set_geometry(device_t *drive, floppy_type_t type)
void snug_bwg_legacy_device::set_geometry(legacy_floppy_image_device *drive, floppy_type_t type)
{
// This assertion may fail when the names of the floppy devices change.
// Unfortunately, the wd17xx device assumes the floppy drives at root
// level, so we use an explicitly qualified tag. See peribox.h.
assert(drive != NULL);
floppy_drive_set_geometry(drive, type);
drive->floppy_drive_set_geometry(type);
}
void snug_bwg_legacy_device::set_all_geometries(floppy_type_t type)
{
set_geometry(machine().device(PFLOPPY_0), type);
set_geometry(machine().device(PFLOPPY_1), type);
set_geometry(machine().device(PFLOPPY_2), type);
set_geometry(machine().device<legacy_floppy_image_device>(PFLOPPY_0), type);
set_geometry(machine().device<legacy_floppy_image_device>(PFLOPPY_1), type);
set_geometry(machine().device<legacy_floppy_image_device>(PFLOPPY_2), type);
}
/*

View File

@ -173,7 +173,7 @@ protected:
private:
void set_ready_line();
void set_all_geometries(floppy_type_t type);
void set_geometry(device_t *drive, floppy_type_t type);
void set_geometry(legacy_floppy_image_device *drive, floppy_type_t type);
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
// Holds the status of the DRQ and IRQ lines.

View File

@ -304,11 +304,11 @@ READ8_MEMBER( myarc_hfdc_device::auxbus_in )
if (index==-1) return 0;
/* Get floppy status. */
if (floppy_drive_get_flag_state(m_floppy_unit[index], FLOPPY_DRIVE_INDEX) == FLOPPY_DRIVE_INDEX)
if (m_floppy_unit[index]->floppy_drive_get_flag_state(FLOPPY_DRIVE_INDEX) == FLOPPY_DRIVE_INDEX)
reply |= DS_INDEX;
if (floppy_tk00_r(m_floppy_unit[index]) == CLEAR_LINE)
if (m_floppy_unit[index]->floppy_tk00_r() == CLEAR_LINE)
reply |= DS_TRK00;
if (floppy_wpt_r(m_floppy_unit[index]) == CLEAR_LINE)
if (m_floppy_unit[index]->floppy_wpt_r() == CLEAR_LINE)
reply |= DS_WRPROT;
/* if (image_exists(disk_img)) */
@ -321,7 +321,7 @@ READ8_MEMBER( myarc_hfdc_device::auxbus_in )
{
UINT8 state;
index = slog2((m_output1_latch>>4) & 0x0f)-1;
mfm_harddisk_device *hd = static_cast<mfm_harddisk_device *>(m_harddisk_unit[index]);
mfm_harddisk_device *hd = m_harddisk_unit[index];
state = hd->get_status();
if (state & MFMHD_TRACK00) reply |= DS_TRK00;
@ -338,8 +338,6 @@ READ8_MEMBER( myarc_hfdc_device::auxbus_in )
WRITE8_MEMBER( myarc_hfdc_device::auxbus_out )
{
int index;
device_t* selected_drive = NULL;
switch (offset)
{
case INPUT_STATUS:
@ -363,16 +361,15 @@ WRITE8_MEMBER( myarc_hfdc_device::auxbus_out )
{
// Floppy selected
index = slog2(data & 0x0f);
if (index>=0) selected_drive = m_floppy_unit[index];
if (index>=0) m_hdc9234->connect_floppy_drive(m_floppy_unit[index]);
}
else
{
// HD selected
index = slog2((data>>4) & 0x0f);
if (index>=0) selected_drive = m_harddisk_unit[index-1];
if (index>=0) m_hdc9234->connect_hard_drive(m_harddisk_unit[index-1]);
}
m_hdc9234->connect_drive(selected_drive);
m_output1_latch = data;
break;
@ -536,14 +533,14 @@ void myarc_hfdc_device::device_reset()
m_selected = false;
// Find the floppies and hard disks
m_floppy_unit[0] = m_slot->get_drive(FLOPPY_0);
m_floppy_unit[1] = m_slot->get_drive(FLOPPY_1);
m_floppy_unit[2] = m_slot->get_drive(FLOPPY_2);
m_floppy_unit[3] = m_slot->get_drive(FLOPPY_3);
m_floppy_unit[0] = static_cast<legacy_floppy_image_device *>(m_slot->get_drive(FLOPPY_0));
m_floppy_unit[1] = static_cast<legacy_floppy_image_device *>(m_slot->get_drive(FLOPPY_1));
m_floppy_unit[2] = static_cast<legacy_floppy_image_device *>(m_slot->get_drive(FLOPPY_2));
m_floppy_unit[3] = static_cast<legacy_floppy_image_device *>(m_slot->get_drive(FLOPPY_3));
m_harddisk_unit[0] = m_slot->get_drive(MFMHD_0);
m_harddisk_unit[1] = m_slot->get_drive(MFMHD_1);
m_harddisk_unit[2] = m_slot->get_drive(MFMHD_2);
m_harddisk_unit[0] = static_cast<mfm_harddisk_device *>(m_slot->get_drive(MFMHD_0));
m_harddisk_unit[1] = static_cast<mfm_harddisk_device *>(m_slot->get_drive(MFMHD_1));
m_harddisk_unit[2] = static_cast<mfm_harddisk_device *>(m_slot->get_drive(MFMHD_2));
if (ioport("HFDCDIP")->read()&0x55)
ti99_set_80_track_drives(TRUE);
@ -560,7 +557,7 @@ void myarc_hfdc_device::device_reset()
{
// floppy_drive_set_controller(card->floppy_unit[i], device);
// floppy_drive_set_index_pulse_callback(floppy_unit[i], smc92x4_index_pulse_callback);
floppy_drive_set_geometry(m_floppy_unit[i], floptype);
m_floppy_unit[i]->floppy_drive_set_geometry(floptype);
}
}

View File

@ -93,10 +93,10 @@ private:
UINT8 m_output2_latch;
/* Connected floppy drives. */
device_t* m_floppy_unit[HFDC_MAX_FLOPPY];
legacy_floppy_image_device* m_floppy_unit[HFDC_MAX_FLOPPY];
/* Connected harddisk drives. */
device_t* m_harddisk_unit[HFDC_MAX_HARD];
mfm_harddisk_device* m_harddisk_unit[HFDC_MAX_HARD];
/* DMA address latch */
UINT32 m_dma_address;

View File

@ -394,10 +394,10 @@ void peribox_device::device_start(void)
{
if (TRACE_EMU) logerror("Peribox started\n");
floppy_drive_set_rpm(subdevice(FLOPPY_0), 300.);
floppy_drive_set_rpm(subdevice(FLOPPY_1), 300.);
floppy_drive_set_rpm(subdevice(FLOPPY_2), 300.);
floppy_drive_set_rpm(subdevice(FLOPPY_3), 300.);
subdevice<legacy_floppy_image_device>(FLOPPY_0)->floppy_drive_set_rpm(300.);
subdevice<legacy_floppy_image_device>(FLOPPY_1)->floppy_drive_set_rpm(300.);
subdevice<legacy_floppy_image_device>(FLOPPY_2)->floppy_drive_set_rpm(300.);
subdevice<legacy_floppy_image_device>(FLOPPY_3)->floppy_drive_set_rpm(300.);
// Resolve the callback lines to the console
m_console_inta.resolve();

View File

@ -648,20 +648,20 @@ WRITE8_MEMBER(ti_fdc_legacy_device::cruwrite)
the default implementation sets the drive geometry to the geometry
of the medium.
*/
void ti_fdc_legacy_device::set_geometry(device_t *drive, floppy_type_t type)
void ti_fdc_legacy_device::set_geometry(legacy_floppy_image_device *drive, floppy_type_t type)
{
// This assertion may fail when the names of the floppy devices change.
// Unfortunately, the wd17xx device assumes the floppy drives at root
// level, so we use an explicitly qualified tag. See peribox.h.
assert (drive!=NULL);
floppy_drive_set_geometry(drive, type);
drive->floppy_drive_set_geometry(type);
}
void ti_fdc_legacy_device::set_all_geometries(floppy_type_t type)
{
set_geometry(machine().device(PFLOPPY_0), type);
set_geometry(machine().device(PFLOPPY_1), type);
set_geometry(machine().device(PFLOPPY_2), type);
set_geometry(machine().device<legacy_floppy_image_device>(PFLOPPY_0), type);
set_geometry(machine().device<legacy_floppy_image_device>(PFLOPPY_1), type);
set_geometry(machine().device<legacy_floppy_image_device>(PFLOPPY_2), type);
}
/*

View File

@ -146,7 +146,7 @@ protected:
private:
void set_ready_line();
void set_all_geometries(floppy_type_t type);
void set_geometry(device_t *drive, floppy_type_t type);
void set_geometry(legacy_floppy_image_device *drive, floppy_type_t type);
// Recent address
int m_address;

File diff suppressed because it is too large Load Diff

View File

@ -90,92 +90,6 @@ struct chrn_id
/* set if index has just occurred */
#define FLOPPY_DRIVE_INDEX 0x0020
/* a callback which will be executed if the ready state of the drive changes e.g. not ready->ready, ready->not ready */
void floppy_drive_set_ready_state_change_callback(device_t *img, void (*callback)(device_t *controller,device_t *img, int state));
void floppy_drive_set_index_pulse_callback(device_t *img, void (*callback)(device_t *controller,device_t *image, int state));
/* set flag state */
int floppy_drive_get_flag_state(device_t *img, int flag);
/* get flag state */
void floppy_drive_set_flag_state(device_t *img, int flag, int state);
/* get current physical track drive is on */
int floppy_drive_get_current_track(device_t *img);
/* get current physical track size */
UINT64 floppy_drive_get_current_track_size(device_t *img, int head);
/* get next id from track, 1 if got a id, 0 if no id was got */
int floppy_drive_get_next_id(device_t *img, int side, chrn_id *);
/* set ready state of drive. If flag == 1, set ready state only if drive present,
disk is in drive, and motor is on. Otherwise set ready state to the state passed */
void floppy_drive_set_ready_state(device_t *img, int state, int flag);
/* seek up or down */
void floppy_drive_seek(device_t *img, signed int signed_tracks);
void floppy_drive_read_track_data_info_buffer(device_t *img, int side, void *ptr, int *length );
void floppy_drive_write_track_data_info_buffer(device_t *img, int side, const void *ptr, int *length );
void floppy_drive_format_sector(device_t *img, int side, int sector_index, int c, int h, int r, int n, int filler);
void floppy_drive_read_sector_data(device_t *img, int side, int index1, void *pBuffer, int length);
void floppy_drive_write_sector_data(device_t *img, int side, int index1, const void *pBuffer, int length, int ddam);
/* set motor speed to get correct index pulses
standard RPM are 300 RPM (common) and 360 RPM
Note: this actually only works for soft sectored disks: one index pulse per
track.
*/
void floppy_drive_set_rpm(device_t *image, float rpm);
void floppy_drive_set_controller(device_t *img, device_t *controller);
floppy_image_legacy *flopimg_get_image(device_t *image);
/* hack for apple II; replace this when we think of something better */
void floppy_install_unload_proc(device_t *image, void (*proc)(device_image_interface &image));
void floppy_install_load_proc(device_t *image, void (*proc)(device_image_interface &image));
device_t *floppy_get_device(running_machine &machine,int drive);
device_t *floppy_get_device_by_type(running_machine &machine,int ftype,int drive);
int floppy_get_drive_type(device_t *image);
void floppy_set_type(device_t *image,int ftype);
int floppy_get_count(running_machine &machine);
int floppy_get_drive(device_t *image);
int floppy_get_drive_by_type(device_t *image,int ftype);
void floppy_drive_set_geometry(device_t *img, floppy_type_t type);
/* drive select lines */
WRITE_LINE_DEVICE_HANDLER( floppy_ds0_w );
WRITE_LINE_DEVICE_HANDLER( floppy_ds1_w );
WRITE_LINE_DEVICE_HANDLER( floppy_ds2_w );
WRITE_LINE_DEVICE_HANDLER( floppy_ds3_w );
DECLARE_WRITE8_DEVICE_HANDLER( floppy_ds_w );
WRITE_LINE_DEVICE_HANDLER( floppy_mon_w );
WRITE_LINE_DEVICE_HANDLER( floppy_drtn_w );
WRITE_LINE_DEVICE_HANDLER( floppy_stp_w );
WRITE_LINE_DEVICE_HANDLER( floppy_wtd_w );
WRITE_LINE_DEVICE_HANDLER( floppy_wtg_w );
/* write-protect */
READ_LINE_DEVICE_HANDLER( floppy_wpt_r );
/* track 0 detect */
READ_LINE_DEVICE_HANDLER( floppy_tk00_r );
/* disk changed */
READ_LINE_DEVICE_HANDLER( floppy_dskchg_r );
/* 2-sided disk */
READ_LINE_DEVICE_HANDLER( floppy_twosid_r );
// index pulse
READ_LINE_DEVICE_HANDLER( floppy_index_r );
// drive ready
READ_LINE_DEVICE_HANDLER( floppy_ready_r );
class legacy_floppy_image_device : public device_t,
public device_image_interface
@ -203,20 +117,134 @@ public:
virtual const char *file_extensions() const { return m_extension_list; }
virtual const option_guide *create_option_guide() const { return floppy_option_guide; }
// access to legacy token
struct floppy_drive *token() const { assert(m_token != NULL); return m_token; }
floppy_image_legacy *flopimg_get_image();
void floppy_drive_set_geometry(floppy_type_t type);
void floppy_drive_set_flag_state(int flag, int state);
void floppy_drive_set_ready_state(int state, int flag);
int floppy_drive_get_flag_state(int flag);
void floppy_drive_seek(signed int signed_tracks);
int floppy_drive_get_next_id(int side, chrn_id *id);
void floppy_drive_read_track_data_info_buffer(int side, void *ptr, int *length );
void floppy_drive_write_track_data_info_buffer(int side, const void *ptr, int *length );
void floppy_drive_format_sector(int side, int sector_index,int c,int h, int r, int n, int filler);
void floppy_drive_read_sector_data(int side, int index1, void *ptr, int length);
void floppy_drive_write_sector_data(int side, int index1, const void *ptr,int length, int ddam);
void floppy_install_load_proc(void (*proc)(device_image_interface &image));
void floppy_install_unload_proc(void (*proc)(device_image_interface &image));
void floppy_drive_set_index_pulse_callback(void (*callback)(device_t *controller,device_t *image, int state));
void floppy_drive_set_ready_state_change_callback(void (*callback)(device_t *controller,device_t *img, int state));
int floppy_drive_get_current_track();
UINT64 floppy_drive_get_current_track_size(int head);
void floppy_drive_set_rpm(float rpm);
void floppy_drive_set_controller(device_t *controller);
int floppy_get_drive_type();
void floppy_set_type(int ftype);
WRITE_LINE_MEMBER( floppy_ds0_w );
WRITE_LINE_MEMBER( floppy_ds1_w );
WRITE_LINE_MEMBER( floppy_ds2_w );
WRITE_LINE_MEMBER( floppy_ds3_w );
WRITE8_MEMBER( floppy_ds_w );
WRITE_LINE_MEMBER( floppy_mon_w );
WRITE_LINE_MEMBER( floppy_drtn_w );
WRITE_LINE_MEMBER( floppy_wtd_w );
WRITE_LINE_MEMBER( floppy_stp_w );
WRITE_LINE_MEMBER( floppy_wtg_w );
READ_LINE_MEMBER( floppy_wpt_r );
READ_LINE_MEMBER( floppy_tk00_r );
READ_LINE_MEMBER( floppy_dskchg_r );
READ_LINE_MEMBER( floppy_twosid_r );
READ_LINE_MEMBER( floppy_index_r );
READ_LINE_MEMBER( floppy_ready_r );
private:
int flopimg_get_sectors_per_track(int side);
void flopimg_get_id_callback(chrn_id *id, int id_index, int side);
void log_readwrite(const char *name, int head, int track, int sector, const char *buf, int length);
void floppy_drive_set_geometry_absolute(int tracks, int sides);
TIMER_CALLBACK_MEMBER(floppy_drive_index_callback);
void floppy_drive_init();
void floppy_drive_index_func();
TIMER_CALLBACK(floppy_drive_index_callback);
int internal_floppy_device_load(int create_format, option_resolution *create_args);
TIMER_CALLBACK_MEMBER( set_wpt );
protected:
// device overrides
virtual void device_config_complete();
virtual void device_start();
struct floppy_drive *m_token;
/* callbacks */
devcb_resolved_write_line m_out_idx_func;
devcb_resolved_read_line m_in_mon_func;
devcb_resolved_write_line m_out_tk00_func;
devcb_resolved_write_line m_out_wpt_func;
devcb_resolved_write_line m_out_rdy_func;
devcb_resolved_write_line m_out_dskchg_func;
/* state of input lines */
int m_drtn; /* direction */
int m_stp; /* step */
int m_wtg; /* write gate */
int m_mon; /* motor on */
/* state of output lines */
int m_idx; /* index pulse */
int m_tk00; /* track 00 */
int m_wpt; /* write protect */
int m_rdy; /* ready */
int m_dskchg; /* disk changed */
/* drive select logic */
int m_drive_id;
int m_active;
const floppy_interface *m_config;
/* flags */
int m_flags;
/* maximum track allowed */
int m_max_track;
/* num sides */
int m_num_sides;
/* current track - this may or may not relate to the present cylinder number
stored by the fdc */
int m_current_track;
/* index pulse timer */
emu_timer *m_index_timer;
/* index pulse callback */
void (*m_index_pulse_callback)(device_t *controller,device_t *image, int state);
/* rotation per minute => gives index pulse frequency */
float m_rpm;
void (*m_ready_state_change_callback)(device_t *controller,device_t *img, int state);
int m_id_index;
device_t *m_controller;
floppy_image_legacy *m_floppy;
int m_track;
void (*m_load_proc)(device_image_interface &image);
void (*m_unload_proc)(device_image_interface &image);
int m_floppy_drive_type;
char m_extension_list[256];
};
// device type definition
extern const device_type LEGACY_FLOPPY;
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(device_t *image);
int floppy_get_drive_by_type(legacy_floppy_image_device *image,int ftype);
int floppy_get_count(running_machine &machine);
/***************************************************************************
DEVICE CONFIGURATION MACROS
***************************************************************************/

View File

@ -14,7 +14,6 @@
#include "emu.h"
#include "i8271.h"
#include "imagedev/flopdrv.h"
/* data request */
#define I8271_FLAGS_DATA_REQUEST 0x01
@ -238,10 +237,10 @@ void i8271_device::device_reset()
set_dma_drq();
}
device_t *i8271_device::current_image()
legacy_floppy_image_device *i8271_device::current_image()
{
if (m_floppy_drive_tags[m_drive]!=NULL) {
return machine().device(m_floppy_drive_tags[m_drive]);
return machine().device<legacy_floppy_image_device>(m_floppy_drive_tags[m_drive]);
} else {
return NULL;
}
@ -250,7 +249,7 @@ device_t *i8271_device::current_image()
void i8271_device::seek_to_track(int track)
{
device_t *img = current_image();
legacy_floppy_image_device *img = current_image();
if (track==0)
{
/* seek to track 0 */
@ -259,11 +258,11 @@ void i8271_device::seek_to_track(int track)
/*logerror("step\n"); */
/* track 0 not set, not seeked more than 255 tracks */
while (floppy_tk00_r(img) && (StepCount != 0))
while (img->floppy_tk00_r() && (StepCount != 0))
{
/* logerror("step\n"); */
StepCount--;
floppy_drive_seek(img, -1);
img->floppy_drive_seek(-1);
}
m_CurrentTrack[m_drive] = 0;
@ -297,7 +296,7 @@ void i8271_device::seek_to_track(int track)
/* seek to track 0 */
floppy_drive_seek(img, SignedTracks);
img->floppy_drive_seek(SignedTracks);
m_CurrentTrack[m_drive] = track;
}
@ -610,7 +609,7 @@ void i8271_device::command_continue()
case I8271_COMMAND_WRITE_DATA_SINGLE_RECORD:
{
/* put the buffer to the sector */
floppy_drive_write_sector_data(current_image(), m_side, m_data_id, m_pExecutionPhaseData, 1<<(m_ID_N+7),0);
current_image()->floppy_drive_write_sector_data(m_side, m_data_id, m_pExecutionPhaseData, 1<<(m_ID_N+7),0);
/* completed all sectors? */
m_Counter--;
@ -653,7 +652,7 @@ void i8271_device::do_read()
if (find_sector())
{
/* get the sector into the buffer */
floppy_drive_read_sector_data(current_image(), m_side, m_data_id, m_pExecutionPhaseData, 1<<(m_ID_N+7));
current_image()->floppy_drive_read_sector_data(m_side, m_data_id, m_pExecutionPhaseData, 1<<(m_ID_N+7));
/* initialise for reading */
initialise_execution_phase_read(1<<(m_ID_N+7));
@ -672,7 +671,7 @@ void i8271_device::do_read_id()
chrn_id id;
/* get next id from disc */
floppy_drive_get_next_id(current_image(), m_side,&id);
current_image()->floppy_drive_get_next_id(m_side,&id);
m_pExecutionPhaseData[0] = id.C;
m_pExecutionPhaseData[1] = id.H;
@ -704,7 +703,7 @@ void i8271_device::do_write()
int i8271_device::find_sector()
{
device_t *img = current_image();
legacy_floppy_image_device *img = current_image();
// int track_count_attempt;
// track_count_attempt
@ -719,7 +718,7 @@ int i8271_device::find_sector()
chrn_id id;
/* get next id from disc */
if (floppy_drive_get_next_id(img, m_side,&id))
if (img->floppy_drive_get_next_id(m_side,&id))
{
/* tested on Amstrad CPC - All bytes must match, otherwise
a NO DATA error is reported */
@ -742,7 +741,7 @@ int i8271_device::find_sector()
}
/* index set? */
if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_INDEX))
if (img->floppy_drive_get_flag_state(FLOPPY_DRIVE_INDEX))
{
index_count++;
}
@ -759,7 +758,7 @@ int i8271_device::find_sector()
void i8271_device::command_execute()
{
device_t *img = current_image();
legacy_floppy_image_device *img = current_image();
/* clear it = good completion status */
/* this will be changed if anything bad happens! */
@ -885,10 +884,10 @@ void i8271_device::command_execute()
m_drive_control_input = (1<<6) | (1<<2);
/* bit 3 = 0 if write protected */
m_drive_control_input |= floppy_wpt_r(img) << 3;
m_drive_control_input |= img->floppy_wpt_r() << 3;
/* bit 1 = 0 if head at track 0 */
m_drive_control_input |= floppy_tk00_r(img) << 1;
m_drive_control_input |= img->floppy_tk00_r() << 1;
/* need to setup this register based on drive selected */
data = m_drive_control_input;
@ -1021,8 +1020,8 @@ void i8271_device::command_execute()
/* load head - on mini-sized drives this turns on the disc motor,
on standard-sized drives this loads the head and turns the motor on */
floppy_mon_w(img, !BIT(m_CommandParameters[1], 3));
floppy_drive_set_ready_state(img, 1, 1);
img->floppy_mon_w(!BIT(m_CommandParameters[1], 3));
img->floppy_drive_set_ready_state(1, 1);
/* step pin changed? if so perform a step in the direction indicated */
if (((m_drive_control_output^m_CommandParameters[1]) & (1<<1))!=0)
@ -1042,7 +1041,7 @@ void i8271_device::command_execute()
signed_tracks = -1;
}
floppy_drive_seek(img, signed_tracks);
img->floppy_drive_seek(signed_tracks);
}
}
@ -1081,24 +1080,24 @@ void i8271_device::command_execute()
/* these two do not appear to be set at all! ?? */
if (m_floppy_drive_tags[0]!=NULL) {
if (floppy_drive_get_flag_state(machine().device(m_floppy_drive_tags[0]), FLOPPY_DRIVE_READY))
if (machine().device<legacy_floppy_image_device>(m_floppy_drive_tags[0])->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY))
{
status |= (1<<2);
}
}
if (m_floppy_drive_tags[1]!=NULL) {
if (floppy_drive_get_flag_state(machine().device(m_floppy_drive_tags[1]), FLOPPY_DRIVE_READY))
if (machine().device<legacy_floppy_image_device>(m_floppy_drive_tags[1])->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY))
{
status |= (1<<6);
}
}
/* bit 3 = 1 if write protected */
status |= !floppy_wpt_r(img) << 3;
status |= !img->floppy_wpt_r() << 3;
/* bit 1 = 1 if head at track 0 */
status |= !floppy_tk00_r(img) << 1;
status |= !img->floppy_tk00_r() << 1;
m_ResultRegister = status;
command_complete(1,0);
@ -1140,7 +1139,7 @@ void i8271_device::command_execute()
get_drive();
if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
if (!img->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY))
{
/* Completion type: operation intervention probably required for recovery */
/* Completion code: Drive not ready */
@ -1173,7 +1172,7 @@ void i8271_device::command_execute()
get_drive();
if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
if (!img->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY))
{
/* Completion type: operation intervention probably required for recovery */
/* Completion code: Drive not ready */
@ -1212,7 +1211,7 @@ void i8271_device::command_execute()
m_drive_control_output &=~1;
if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
if (!img->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY))
{
/* Completion type: operation intervention probably required for recovery */
/* Completion code: Drive not ready */
@ -1221,7 +1220,7 @@ void i8271_device::command_execute()
}
else
{
if (floppy_wpt_r(img) == CLEAR_LINE)
if (img->floppy_wpt_r() == CLEAR_LINE)
{
/* Completion type: operation intervention probably required for recovery */
/* Completion code: Drive write protected */
@ -1257,7 +1256,7 @@ void i8271_device::command_execute()
m_drive_control_output &=~1;
if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
if (!img->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY))
{
/* Completion type: operation intervention probably required for recovery */
/* Completion code: Drive not ready */
@ -1266,7 +1265,7 @@ void i8271_device::command_execute()
}
else
{
if (floppy_wpt_r(img) == CLEAR_LINE)
if (img->floppy_wpt_r() == CLEAR_LINE)
{
/* Completion type: operation intervention probably required for recovery */
/* Completion code: Drive write protected */
@ -1296,7 +1295,7 @@ void i8271_device::command_execute()
get_drive();
if (!floppy_drive_get_flag_state(img, FLOPPY_DRIVE_READY))
if (!img->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY))
{
/* Completion type: operation intervention probably required for recovery */
/* Completion code: Drive not ready */

View File

@ -7,6 +7,8 @@
#ifndef I8271_H_
#define I8271_H_
#include "imagedev/flopdrv.h"
#define MCFG_I8271_IRQ_CALLBACK(_write) \
devcb = &i8271_device::set_irq_wr_callback(*device, DEVCB2_##_write);
@ -126,7 +128,7 @@ private:
emu_timer *m_data_timer;
emu_timer *m_command_complete_timer;
device_t *current_image();
legacy_floppy_image_device *current_image();
void seek_to_track(int track);
void load_bad_tracks(int surface);
void write_bad_track(int surface, int track, int data);

View File

@ -139,10 +139,10 @@ void mc6843_device::device_reset()
/* setup/reset floppy drive */
for ( i = 0; i < 4; i++ )
{
device_t * img = floppy_image( i );
floppy_mon_w(img, CLEAR_LINE);
floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
floppy_drive_set_rpm( img, 300. );
legacy_floppy_image_device * img = floppy_image( i );
img->floppy_mon_w(CLEAR_LINE);
img->floppy_drive_set_ready_state(FLOPPY_DRIVE_READY, 0 );
img->floppy_drive_set_rpm( 300. );
}
/* reset registers */
@ -162,9 +162,9 @@ void mc6843_device::device_reset()
device_t* mc6843_device::floppy_image( UINT8 drive )
legacy_floppy_image_device* mc6843_device::floppy_image( UINT8 drive )
{
device_t *img = floppy_get_device( machine(), drive );
legacy_floppy_image_device *img = floppy_get_device( machine(), drive );
if (!img && owner()) {
// For slot devices, drives are typically attached to the slot rather than the machine
const char *floppy_name = NULL;
@ -182,13 +182,13 @@ device_t* mc6843_device::floppy_image( UINT8 drive )
floppy_name = FLOPPY_3;
break;
}
img = owner()->subdevice(floppy_name);
img = owner()->subdevice<legacy_floppy_image_device>(floppy_name);
}
return img;
}
device_t* mc6843_device::floppy_image( )
legacy_floppy_image_device* mc6843_device::floppy_image( )
{
return floppy_image( m_drive );
}
@ -262,24 +262,24 @@ void mc6843_device::cmd_end( )
/* Seek Track Zero bottom half */
void mc6843_device::finish_STZ( )
{
device_t* img = floppy_image( );
legacy_floppy_image_device* img = floppy_image( );
int i;
/* seek to track zero */
for ( i=0; i<83; i++ )
{
if (floppy_tk00_r(img) == CLEAR_LINE)
if (img->floppy_tk00_r() == CLEAR_LINE)
break;
floppy_drive_seek( img, -1 );
img->floppy_drive_seek( -1 );
}
LOG(( "%f mc6843_finish_STZ: actual=%i\n", machine().time().as_double(), floppy_drive_get_current_track( img ) ));
LOG(( "%f mc6843_finish_STZ: actual=%i\n", machine().time().as_double(), img->floppy_drive_get_current_track() ));
/* update state */
m_CTAR = 0;
m_GCR = 0;
m_SAR = 0;
m_STRB |= floppy_tk00_r(img) << 4;
m_STRB |= img->floppy_tk00_r() << 4;
cmd_end( );
}
@ -289,13 +289,13 @@ void mc6843_device::finish_STZ( )
/* Seek bottom half */
void mc6843_device::finish_SEK( )
{
device_t* img = floppy_image( );
legacy_floppy_image_device* img = floppy_image( );
/* seek to track */
// TODO: not sure how CTAR bit 7 is handled here, but this is the safest approach for now
floppy_drive_seek( img, m_GCR - (m_CTAR & 0x7F) );
img->floppy_drive_seek( m_GCR - (m_CTAR & 0x7F) );
LOG(( "%f mc6843_finish_SEK: from %i to %i (actual=%i)\n", machine().time().as_double(), (m_CTAR & 0x7F), m_GCR, floppy_drive_get_current_track( img ) ));
LOG(( "%f mc6843_finish_SEK: from %i to %i (actual=%i)\n", machine().time().as_double(), (m_CTAR & 0x7F), m_GCR, img->floppy_drive_get_current_track() ));
/* update state */
m_CTAR = m_GCR;
@ -308,12 +308,12 @@ void mc6843_device::finish_SEK( )
/* preamble to all sector read / write commands, returns 1 if found */
int mc6843_device::address_search( chrn_id* id )
{
device_t* img = floppy_image( );
legacy_floppy_image_device* img = floppy_image( );
int r = 0;
while ( 1 )
{
if ( ( ! floppy_drive_get_next_id( img, m_side, id ) ) || ( id->flags & ID_FLAG_CRC_ERROR_IN_ID_FIELD ) || ( id->N != 0 ) )
if ( ( ! img->floppy_drive_get_next_id( m_side, id ) ) || ( id->flags & ID_FLAG_CRC_ERROR_IN_ID_FIELD ) || ( id->N != 0 ) )
{
/* read address error */
LOG(( "%f mc6843_address_search: get_next_id failed\n", machine().time().as_double() ));
@ -343,7 +343,7 @@ int mc6843_device::address_search( chrn_id* id )
return 1;
}
if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) )
if ( img->floppy_drive_get_flag_state( FLOPPY_DRIVE_INDEX ) )
{
r++;
if ( r >= 4 )
@ -403,14 +403,14 @@ void mc6843_device::finish_RCR( )
void mc6843_device::cont_SR( )
{
chrn_id id;
device_t* img = floppy_image( );
legacy_floppy_image_device* img = floppy_image( );
/* sector seek */
if ( ! address_search_read( &id ) )
return;
/* sector read */
floppy_drive_read_sector_data( img, m_side, id.data_id, m_data, 128 );
img->floppy_drive_read_sector_data( m_side, id.data_id, m_data, 128 );
m_data_idx = 0;
m_data_size = 128;
m_STRA |= 0x01; /* set Data Transfer Request */
@ -551,7 +551,7 @@ READ8_MEMBER( mc6843_device::read )
data = m_CTAR;
LOG(( "%f %s mc6843_r: read CTAR %i (actual=%i)\n",
machine().time().as_double(), machine().describe_context(), data,
floppy_drive_get_current_track( floppy_image( ) ) ));
floppy_image()->floppy_drive_get_current_track()));
break;
case 2: /* Interrupt Status Register (ISR) */
@ -569,14 +569,14 @@ READ8_MEMBER( mc6843_device::read )
case 3: /* Status Register A (STRA) */
{
/* update */
device_t* img = floppy_image( );
int flag = floppy_drive_get_flag_state( img, FLOPPY_DRIVE_READY);
legacy_floppy_image_device* img = floppy_image( );
int flag = img->floppy_drive_get_flag_state( FLOPPY_DRIVE_READY);
m_STRA &= 0xa3;
if ( flag & FLOPPY_DRIVE_READY )
m_STRA |= 0x04;
m_STRA |= !floppy_tk00_r(img) << 3;
m_STRA |= !floppy_wpt_r(img) << 4;
m_STRA |= !img->floppy_tk00_r() << 3;
m_STRA |= !img->floppy_wpt_r() << 4;
if ( m_index_pulse )
m_STRA |= 0x40;
@ -605,7 +605,7 @@ READ8_MEMBER( mc6843_device::read )
data = m_LTAR;
LOG(( "%f %s mc6843_r: read LTAR %i (actual=%i)\n",
machine().time().as_double(), machine().describe_context(), data,
floppy_drive_get_current_track( floppy_image( ) ) ));
floppy_image()->floppy_drive_get_current_track()));
break;
default:
@ -639,12 +639,12 @@ WRITE8_MEMBER( mc6843_device::write )
if ( m_data_idx >= m_data_size )
{
/* end of sector write */
device_t* img = floppy_image( );
legacy_floppy_image_device* img = floppy_image( );
LOG(( "%f %s mc6843_w: write sector %i\n", machine().time().as_double(), machine().describe_context(), m_data_id ));
floppy_drive_write_sector_data(
img, m_side, m_data_id,
img->floppy_drive_write_sector_data(
m_side, m_data_id,
m_data, m_data_size,
(cmd == CMD_SWD) ? ID_FLAG_DELETED_DATA : 0 );
@ -701,12 +701,12 @@ WRITE8_MEMBER( mc6843_device::write )
if ( (m_data[2] == 0) && (m_data[4] == 0) )
{
/* valid address id field */
device_t* img = floppy_image( );
legacy_floppy_image_device* img = floppy_image( );
UINT8 track = m_data[1];
UINT8 sector = m_data[3];
UINT8 filler = 0xe5; /* standard Thomson filler */
LOG(( "%f %s mc6843_w: address id detected track=%i sector=%i\n", machine().time().as_double(), machine().describe_context(), track, sector));
floppy_drive_format_sector( img, m_side, sector, track, 0, sector, 0, filler );
img->floppy_drive_format_sector( m_side, sector, track, 0, sector, 0, filler );
}
else
{
@ -736,7 +736,7 @@ WRITE8_MEMBER( mc6843_device::write )
m_CTAR = data;
LOG(( "%f %s mc6843_w: set CTAR to %i %02X (actual=%i) \n",
machine().time().as_double(), machine().describe_context(), m_CTAR, data,
floppy_drive_get_current_track( floppy_image( ) ) ));
floppy_image()->floppy_drive_get_current_track()));
break;
case 2: /* Command Register (CMR) */
@ -816,7 +816,7 @@ WRITE8_MEMBER( mc6843_device::write )
m_LTAR = data & 0x7f;
LOG(( "%f %s mc6843_w: set LTAR to %i %02X (actual=%i)\n",
machine().time().as_double(), machine().describe_context(), m_LTAR, data,
floppy_drive_get_current_track( floppy_image( ) ) ));
floppy_image()->floppy_drive_get_current_track()));
break;
default:

View File

@ -67,8 +67,8 @@ private:
/* trigger delayed actions (bottom halves) */
emu_timer* m_timer_cont;
device_t* floppy_image(UINT8 drive);
device_t* floppy_image();
legacy_floppy_image_device* floppy_image(UINT8 drive);
legacy_floppy_image_device* floppy_image();
void status_update();
void cmd_end();
void finish_STZ();

View File

@ -200,7 +200,7 @@ smc92x4_device::smc92x4_device(const machine_config &mconfig, const char *tag, d
int smc92x4_device::image_is_single_density()
{
floppy_image_legacy *image = flopimg_get_image(m_drive);
floppy_image_legacy *image = m_drive->flopimg_get_image();
return (floppy_get_track_size(image, 0, 0)<4000);
}
@ -436,7 +436,6 @@ void smc92x4_device::device_timer(emu_timer &timer, device_timer_id id, int para
int redcur;
int precomp;
int write_long;
mfm_harddisk_device *harddisk;
switch (id)
{
@ -481,14 +480,13 @@ void smc92x4_device::device_timer(emu_timer &timer, device_timer_id id, int para
else
{
if (VERBOSE>5) LOG("smc92x4 step %s direction %d\n", m_drive->tag(), m_step_direction);
floppy_drive_seek(m_drive, m_step_direction);
m_drive->floppy_drive_seek(m_step_direction);
}
}
else
{
if (VERBOSE>6) LOG("smc92x4 step harddisk direction %d\n", m_step_direction);
harddisk = static_cast<mfm_harddisk_device *>(m_drive);
harddisk->seek(m_step_direction);
m_harddisk->seek(m_step_direction);
}
sync_status_in();
break;
@ -566,7 +564,6 @@ void smc92x4_device::read_id_field(int *steps, int *direction, chrn_id_hd *id)
{
int des_cylinder, cur_cylinder;
bool found = false;
mfm_harddisk_device *harddisk;
sync_latches_out();
sync_status_in();
@ -579,7 +576,7 @@ void smc92x4_device::read_id_field(int *steps, int *direction, chrn_id_hd *id)
if (m_selected_drive_type & TYPE_FLOPPY)
{
chrn_id idflop;
if (flopimg_get_image(m_drive) == NULL)
if (m_drive->flopimg_get_image() == NULL)
{
if (VERBOSE>2) LOG("smc92x4 warn: No disk in drive\n");
m_register_r[CHIP_STATUS] |= CS_SYNCERR;
@ -590,7 +587,7 @@ void smc92x4_device::read_id_field(int *steps, int *direction, chrn_id_hd *id)
if ((image_is_single_density() && in_single_density_mode())
|| (!image_is_single_density() && !in_single_density_mode()))
{
found = floppy_drive_get_next_id(m_drive, m_register_w[DESIRED_HEAD]&0x0f, &idflop);
found = m_drive->floppy_drive_get_next_id(m_register_w[DESIRED_HEAD]&0x0f, &idflop);
copyid(idflop, id); /* Need to use bigger values for HD, but we don't use separate variables here */
}
else
@ -608,9 +605,7 @@ void smc92x4_device::read_id_field(int *steps, int *direction, chrn_id_hd *id)
}
else
{
harddisk = static_cast<mfm_harddisk_device *>(m_drive);
harddisk->get_next_id(m_register_w[DESIRED_HEAD]&0x0f, id);
m_harddisk->get_next_id(m_register_w[DESIRED_HEAD]&0x0f, id);
sync_status_in();
if (!(m_register_r[DRIVE_STATUS]& DS_READY))
{
@ -670,7 +665,6 @@ int smc92x4_device::verify(chrn_id_hd *id, bool check_sector)
int found = false;
int foundsect = false;
int des_cylinder = 0;
mfm_harddisk_device *harddisk;
// Set command termination code. The error code is set first, and
// on success, it is cleared.
@ -683,7 +677,7 @@ int smc92x4_device::verify(chrn_id_hd *id, bool check_sector)
if (m_selected_drive_type & TYPE_FLOPPY)
{
chrn_id idflop;
found = floppy_drive_get_next_id(m_drive, m_register_w[DESIRED_HEAD]&0x0f, &idflop);
found = m_drive->floppy_drive_get_next_id(m_register_w[DESIRED_HEAD]&0x0f, &idflop);
copyid(idflop, id);
if (/* pass==1 && */!found)
{
@ -694,8 +688,7 @@ int smc92x4_device::verify(chrn_id_hd *id, bool check_sector)
}
else
{
harddisk = static_cast<mfm_harddisk_device *>(m_drive);
harddisk->get_next_id(m_register_w[DESIRED_HEAD]&0x0f, id);
m_harddisk->get_next_id(m_register_w[DESIRED_HEAD]&0x0f, id);
sync_status_in();
if (!(m_register_r[DRIVE_STATUS]& DS_READY))
{
@ -742,7 +735,6 @@ int smc92x4_device::verify(chrn_id_hd *id, bool check_sector)
void smc92x4_device::data_transfer_read(chrn_id_hd id, int transfer_enable)
{
int i, retry, sector_len;
mfm_harddisk_device *harddisk;
int sector_data_id;
dynamic_buffer buf;
@ -780,13 +772,12 @@ void smc92x4_device::data_transfer_read(chrn_id_hd id, int transfer_enable)
if (m_selected_drive_type & TYPE_FLOPPY)
{
floppy_drive_read_sector_data(m_drive, id.H, sector_data_id, buf, sector_len);
m_drive->floppy_drive_read_sector_data(id.H, sector_data_id, buf, sector_len);
}
else
{
// TODO: Should we get the sector length from the harddisk?
harddisk = static_cast<mfm_harddisk_device *>(m_drive);
harddisk->read_sector(id.C, id.H, id.R, buf);
m_harddisk->read_sector(id.C, id.H, id.R, buf);
}
sync_status_in();
@ -837,7 +828,6 @@ void smc92x4_device::data_transfer_write(chrn_id_hd id, int deldata, int redcur,
int retry, i, sector_len;
dynamic_buffer buf;
int sector_data_id;
mfm_harddisk_device *harddisk;
sync_latches_out();
sync_status_in();
@ -876,12 +866,11 @@ void smc92x4_device::data_transfer_write(chrn_id_hd id, int deldata, int redcur,
if (m_selected_drive_type & TYPE_FLOPPY)
{
if (VERBOSE>4) LOG("smc92x4 info: write sector CHS=(%d,%d,%d)\n", id.C, id.H, id.R);
floppy_drive_write_sector_data(m_drive, id.H, sector_data_id, buf, sector_len, false);
m_drive->floppy_drive_write_sector_data(id.H, sector_data_id, buf, sector_len, false);
}
else
{
harddisk = static_cast<mfm_harddisk_device *>(m_drive);
harddisk->write_sector(id.C, id.H, id.R, buf);
m_harddisk->write_sector(id.C, id.H, id.R, buf);
}
sync_status_in();
@ -1344,7 +1333,7 @@ void smc92x4_device::format_floppy_track(int flags)
sync_status_in();
floppy = flopimg_get_image(m_drive);
floppy = m_drive->flopimg_get_image();
if (floppy != NULL)
data_count = floppy_get_track_size(floppy, 0, 0);
@ -1486,7 +1475,7 @@ void smc92x4_device::format_floppy_track(int flags)
memset(&buffer[index], gap_byte, gap4);
index += gap4;
floppy_drive_write_track_data_info_buffer(m_drive, m_register_w[DESIRED_HEAD]&0x0f, buffer, &data_count);
m_drive->floppy_drive_write_track_data_info_buffer(m_register_w[DESIRED_HEAD]&0x0f, buffer, &data_count);
sync_status_in();
}
@ -1506,8 +1495,6 @@ void smc92x4_device::format_harddisk_track(int flags)
int normal_data_mark = flags & 0x10;
int data_count=0;
mfm_harddisk_device *harddisk = static_cast<mfm_harddisk_device *>(m_drive);
dynamic_buffer buffer;
sync_status_in();
@ -1585,7 +1572,7 @@ void smc92x4_device::format_harddisk_track(int flags)
for (i=0; i < gap4; i++) buffer[index++] = gap_byte;
// Now write the whole track
harddisk->write_track(m_register_w[DESIRED_HEAD]&0x0f, buffer, data_count);
m_harddisk->write_track(m_register_w[DESIRED_HEAD]&0x0f, buffer, data_count);
sync_status_in();
}
@ -1618,7 +1605,7 @@ void smc92x4_device::read_floppy_track(bool transfer_only_ids)
sync_latches_out();
floppy = flopimg_get_image(m_drive);
floppy = m_drive->flopimg_get_image();
/* Determine the track size. We cannot allow different sizes in this design. */
if (floppy != NULL)
@ -1634,7 +1621,7 @@ void smc92x4_device::read_floppy_track(bool transfer_only_ids)
buffer = global_alloc_array(UINT8, data_count);
floppy_drive_read_track_data_info_buffer(m_drive, m_register_w[DESIRED_HEAD]&0x0f, (char *)buffer, &data_count);
m_drive->floppy_drive_read_track_data_info_buffer(m_register_w[DESIRED_HEAD]&0x0f, (char *)buffer, &data_count);
sync_status_in();
// Transfer the buffer to the external memory. We assume the memory
@ -1662,15 +1649,13 @@ void smc92x4_device::read_harddisk_track(bool transfer_only_ids)
int i;
UINT8 *buffer;
int data_count=0;
mfm_harddisk_device *harddisk = static_cast<mfm_harddisk_device *>(m_drive);
sync_latches_out();
data_count = harddisk->get_track_length();
data_count = m_harddisk->get_track_length();
buffer = global_alloc_array(UINT8, data_count);
/* buffer and data_count are allocated and set by the function. */
harddisk->read_track(m_register_w[DESIRED_HEAD]&0x0f, buffer);
m_harddisk->read_track(m_register_w[DESIRED_HEAD]&0x0f, buffer);
sync_status_in();
if (!(m_register_r[DRIVE_STATUS] & DS_READY))
@ -2004,7 +1989,7 @@ void smc92x4_device::set_timing(bool realistic)
if (VERBOSE>0) LOG("smc92x4: use realistic timing: %02x\n", realistic);
}
void smc92x4_device::connect_drive(device_t *drive)
void smc92x4_device::connect_floppy_drive(legacy_floppy_image_device *drive)
{
m_drive = drive;
if (VERBOSE>3)
@ -2013,6 +1998,15 @@ void smc92x4_device::connect_drive(device_t *drive)
else LOG("smc92x4: Connect drive %s\n", drive->tag());
}
}
void smc92x4_device::connect_hard_drive(mfm_harddisk_device *drive)
{
m_harddisk = drive;
if (VERBOSE>3)
{
if (drive==NULL) LOG("smc92x4: Unselect all drives\n");
else LOG("smc92x4: Connect drive %s\n", drive->tag());
}
}
void smc92x4_device::reset()
{

View File

@ -98,7 +98,8 @@ public:
// Used to reconfigure the drive connections. Drive selection is done
// using the select lines and maybe also the user-programmable outputs.
void connect_drive(device_t *drive);
void connect_floppy_drive(legacy_floppy_image_device *drive);
void connect_hard_drive(mfm_harddisk_device *drive);
void reset();
@ -221,7 +222,8 @@ private:
// Hard disks must be instances of mfmhd_device; floppy disks are the common drives.
// We expect the embedding board to replace the drive according to the
// select lines.
device_t *m_drive;
legacy_floppy_image_device *m_drive;
mfm_harddisk_device *m_harddisk;
};
#define MCFG_SMC92X4_ADD(_tag, _intrf) \

View File

@ -154,7 +154,6 @@
#include "emu.h"
#include "formats/imageutl.h"
#include "machine/wd17xx.h"
#include "imagedev/flopdrv.h"
/***************************************************************************
CONSTANTS
@ -494,11 +493,11 @@ void wd1770_device::wd17xx_command_restore()
if (1) // image_slotexists(m_drive) : FIXME
{
/* keep stepping until track 0 is received or 255 steps have been done */
while (floppy_tk00_r(m_drive) && (step_counter != 0))
while (m_drive->floppy_tk00_r() && (step_counter != 0))
{
/* update time to simulate seek time busy signal */
m_busy_count++;
floppy_drive_seek(m_drive, m_direction);
m_drive->floppy_drive_seek(m_direction);
step_counter--;
}
}
@ -539,7 +538,7 @@ void wd1770_device::write_track()
//int len = m_buffer[i+4];
int filler = 0xe5; /* IBM and Thomson */
int density = m_density;
floppy_drive_format_sector(m_drive,side,sector,track,
m_drive->floppy_drive_format_sector(side,sector,track,
m_hd,sector,density?1:0,filler);
i += 128; /* at least... */
}
@ -556,7 +555,7 @@ void wd1770_device::write_track()
selected format.
*/
m_data_count = 0;
floppy = flopimg_get_image(m_drive);
floppy = m_drive->flopimg_get_image();
if (floppy != NULL)
m_data_count = floppy_get_track_size(floppy, m_hd, m_track);
@ -568,7 +567,7 @@ void wd1770_device::write_track()
m_data_count = wd17xx_dden() ? TRKSIZE_SD : TRKSIZE_DD;
}
floppy_drive_write_track_data_info_buffer( m_drive, m_hd, (char *)m_buffer, &(m_data_count) );
m_drive->floppy_drive_write_track_data_info_buffer( m_hd, (char *)m_buffer, &(m_data_count) );
m_data_offset = 0;
@ -707,7 +706,7 @@ void wd1770_device::read_track()
/* Determine the track size. We cannot allow different sizes in this
design (see above, write_track). */
m_data_count = 0;
floppy = flopimg_get_image(m_drive);
floppy = m_drive->flopimg_get_image();
if (floppy != NULL)
m_data_count = floppy_get_track_size(floppy, m_hd, m_track);
@ -719,7 +718,7 @@ void wd1770_device::read_track()
m_data_count = wd17xx_dden() ? TRKSIZE_SD : TRKSIZE_DD;
}
floppy_drive_read_track_data_info_buffer( m_drive, m_hd, (char *)m_buffer, &(m_data_count) );
m_drive->floppy_drive_read_track_data_info_buffer( m_hd, (char *)m_buffer, &(m_data_count) );
m_data_offset = 0;
@ -736,7 +735,7 @@ void wd1770_device::wd17xx_read_id()
m_status &= ~(STA_2_CRC_ERR | STA_2_REC_N_FND);
/* get next id from disc */
if (floppy_drive_get_next_id(m_drive, m_hd, &id))
if (m_drive->floppy_drive_get_next_id(m_hd, &id))
{
UINT16 crc = 0xffff;
@ -809,7 +808,7 @@ int wd1770_device::wd17xx_locate_sector()
while (revolution_count!=4)
{
if (floppy_drive_get_next_id(m_drive, m_hd, &id))
if (m_drive->floppy_drive_get_next_id(m_hd, &id))
{
/* compare track */
if (id.C == m_track)
@ -834,7 +833,7 @@ int wd1770_device::wd17xx_locate_sector()
}
/* index set? */
if (floppy_drive_get_flag_state(m_drive, FLOPPY_DRIVE_INDEX))
if (m_drive->floppy_drive_get_flag_state(FLOPPY_DRIVE_INDEX))
{
/* update revolution count */
revolution_count++;
@ -886,7 +885,7 @@ void wd1770_device::wd17xx_read_sector()
m_data_count = m_sector_length;
/* read data */
floppy_drive_read_sector_data(m_drive, m_hd, m_sector_data_id, (char *)m_buffer, m_sector_length);
m_drive->floppy_drive_read_sector_data(m_hd, m_sector_data_id, (char *)m_buffer, m_sector_length);
wd17xx_timed_data_request();
@ -936,7 +935,7 @@ void wd1770_device::wd17xx_write_sector()
m_data_count = m_sector_length;
/* write data */
floppy_drive_write_sector_data(m_drive, m_hd, m_sector_data_id, (char *)m_buffer, m_sector_length, m_write_cmd & 0x01);
m_drive->floppy_drive_write_sector_data(m_hd, m_sector_data_id, (char *)m_buffer, m_sector_length, m_write_cmd & 0x01);
}
}
@ -957,7 +956,7 @@ void wd1770_device::wd17xx_verify_seek()
/* must be found within 5 revolutions otherwise error */
while (revolution_count!=5)
{
if (floppy_drive_get_next_id(m_drive, m_hd, &id))
if (m_drive->floppy_drive_get_next_id( m_hd, &id))
{
/* compare track */
if (id.C == m_track)
@ -969,7 +968,7 @@ void wd1770_device::wd17xx_verify_seek()
}
/* index set? */
if (floppy_drive_get_flag_state(m_drive, FLOPPY_DRIVE_INDEX))
if (m_drive->floppy_drive_get_flag_state(FLOPPY_DRIVE_INDEX))
{
/* update revolution count */
revolution_count++;
@ -992,7 +991,7 @@ TIMER_CALLBACK_MEMBER( wd1770_device::wd17xx_read_sector_callback )
if (VERBOSE)
logerror("wd179x: Read Sector callback.\n");
if (!floppy_drive_get_flag_state(m_drive, FLOPPY_DRIVE_READY))
if (!m_drive->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY))
wd17xx_complete_command(DELAY_NOTREADY);
else
wd17xx_read_sector();
@ -1008,12 +1007,12 @@ TIMER_CALLBACK_MEMBER( wd1770_device::wd17xx_write_sector_callback )
if (VERBOSE)
logerror("wd179x: Write Sector callback.\n");
if (!floppy_drive_get_flag_state(m_drive, FLOPPY_DRIVE_READY))
if (!m_drive->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY))
wd17xx_complete_command(DELAY_NOTREADY);
else
{
/* drive write protected? */
if (floppy_wpt_r(m_drive) == CLEAR_LINE)
if (m_drive->floppy_wpt_r() == CLEAR_LINE)
{
m_status |= STA_2_WRITE_PRO;
@ -1080,7 +1079,7 @@ void wd1770_device::set_drive(UINT8 drive)
if (m_intf->floppy_drive_tags[drive] != NULL)
{
m_drive = siblingdevice(m_intf->floppy_drive_tags[drive]);
m_drive = siblingdevice<legacy_floppy_image_device>(m_intf->floppy_drive_tags[drive]);
}
}
@ -1201,7 +1200,7 @@ READ8_MEMBER( wd1770_device::status_r )
else
{
m_status &= ~STA_1_NOT_READY;
if (!floppy_drive_get_flag_state(m_drive, FLOPPY_DRIVE_READY))
if (!m_drive->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY))
m_status |= STA_1_NOT_READY;
}
@ -1216,7 +1215,7 @@ READ8_MEMBER( wd1770_device::status_r )
result |= m_idx << 1;
/* bit 2, track 0 state, inverted */
result |= !floppy_tk00_r(m_drive) << 2;
result |= !m_drive->floppy_tk00_r() << 2;
if (m_command_type==TYPE_I)
{
@ -1227,7 +1226,7 @@ READ8_MEMBER( wd1770_device::status_r )
}
/* bit 6, write protect, inverted */
result |= !floppy_wpt_r(m_drive) << 6;
result |= !m_drive->floppy_wpt_r() << 6;
}
/* eventually set data request bit */
@ -1283,10 +1282,10 @@ WRITE8_MEMBER( wd1770_device::command_w )
if (type() == WD1770 || type() == WD1772)
{
m_mo = ASSERT_LINE;
floppy_mon_w(m_drive, CLEAR_LINE);
m_drive->floppy_mon_w(CLEAR_LINE);
}
floppy_drive_set_ready_state(m_drive, 1,0);
m_drive->floppy_drive_set_ready_state(1,0);
if (!BIT(m_interrupt, 3))
{
@ -1409,14 +1408,14 @@ WRITE8_MEMBER( wd1770_device::command_w )
m_status &= ~STA_2_LOST_DAT;
wd17xx_clear_drq();
if (!floppy_drive_get_flag_state(m_drive, FLOPPY_DRIVE_READY))
if (!m_drive->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY))
{
wd17xx_complete_command(DELAY_NOTREADY);
}
else
{
/* drive write protected? */
if (floppy_wpt_r(m_drive) == CLEAR_LINE)
if (m_drive->floppy_wpt_r() == CLEAR_LINE)
{
/* yes */
m_status |= STA_2_WRITE_PRO;
@ -1452,7 +1451,7 @@ WRITE8_MEMBER( wd1770_device::command_w )
wd17xx_clear_drq();
if (floppy_drive_get_flag_state(m_drive, FLOPPY_DRIVE_READY))
if (m_drive->floppy_drive_get_flag_state(FLOPPY_DRIVE_READY))
wd17xx_read_id();
else
wd17xx_complete_command(DELAY_NOTREADY);
@ -1519,7 +1518,7 @@ WRITE8_MEMBER( wd1770_device::command_w )
/* update track reg */
m_track += m_direction;
floppy_drive_seek(m_drive, m_direction);
m_drive->floppy_drive_seek(m_direction);
}
/* simulate seek time busy signal */
@ -1541,7 +1540,7 @@ WRITE8_MEMBER( wd1770_device::command_w )
/* simulate seek time busy signal */
m_busy_count = 0; //((data & FDC_STEP_RATE) + 1);
floppy_drive_seek(m_drive, m_direction);
m_drive->floppy_drive_seek(m_direction);
if (data & FDC_STEP_UPDATE)
m_track += m_direction;
@ -1564,7 +1563,7 @@ WRITE8_MEMBER( wd1770_device::command_w )
/* simulate seek time busy signal */
m_busy_count = 0; //((data & FDC_STEP_RATE) + 1);
floppy_drive_seek(m_drive, m_direction);
m_drive->floppy_drive_seek(m_direction);
if (data & FDC_STEP_UPDATE)
m_track += m_direction;
@ -1586,7 +1585,7 @@ WRITE8_MEMBER( wd1770_device::command_w )
m_busy_count = 0; //((data & FDC_STEP_RATE) + 1);
/* for now only allows a single drive to be selected */
floppy_drive_seek(m_drive, m_direction);
m_drive->floppy_drive_seek(m_direction);
if (data & FDC_STEP_UPDATE)
m_track += m_direction;
@ -2045,14 +2044,14 @@ void wd1770_device::device_reset()
for (i = 0; i < 4; i++)
{
if(m_intf->floppy_drive_tags[i]!=NULL) {
device_t *img = NULL;
legacy_floppy_image_device *img = NULL;
img = siblingdevice(m_intf->floppy_drive_tags[i]);
img = siblingdevice<legacy_floppy_image_device>(m_intf->floppy_drive_tags[i]);
if (img!=NULL) {
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.);
}
}
}

View File

@ -10,6 +10,8 @@
#ifndef __WD17XX_H__
#define __WD17XX_H__
#include "imagedev/flopdrv.h"
/***************************************************************************
TYPE DEFINITIONS
@ -165,7 +167,7 @@ protected:
emu_timer *m_timer_cmd, *m_timer_data, *m_timer_rs, *m_timer_ws;
/* this is the drive currently selected */
device_t *m_drive;
legacy_floppy_image_device *m_drive;
/* this is the head currently selected */
UINT8 m_hd;

View File

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

View File

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

View File

@ -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 )

View File

@ -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 */

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 =

View File

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

View File

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

View File

@ -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:

View File

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

View File

@ -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();

View File

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

View File

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

View File

@ -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
{

View File

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

View File

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

View File

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

View File

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

View File

@ -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();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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:

View File

@ -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 )
{

View File

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

View File

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

View File

@ -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);
}
/*************************************