mirror of
https://github.com/holub/mame
synced 2025-05-28 16:43:04 +03:00
modernized access for legacy floppy, quite straight forward thing (nw)
This commit is contained in:
parent
06238c1cdb
commit
b1c2c8daee
@ -110,10 +110,10 @@ WRITE8_MEMBER( bml3bus_mp1802_device::bml3_mp1802_w)
|
|||||||
floppy_name = FLOPPY_3;
|
floppy_name = FLOPPY_3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
device_t *floppy = subdevice(floppy_name);
|
legacy_floppy_image_device *floppy = subdevice<legacy_floppy_image_device>(floppy_name);
|
||||||
m_wd17xx->set_drive(drive);
|
m_wd17xx->set_drive(drive);
|
||||||
floppy_mon_w(floppy, !motor);
|
floppy->floppy_mon_w(!motor);
|
||||||
floppy_drive_set_ready_state(floppy, ASSERT_LINE, 0);
|
floppy->floppy_drive_set_ready_state(ASSERT_LINE, 0);
|
||||||
m_wd17xx->set_side(side);
|
m_wd17xx->set_side(side);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,10 +128,10 @@ WRITE8_MEMBER( bml3bus_mp1805_device::bml3_mp1805_w)
|
|||||||
floppy_name = FLOPPY_3;
|
floppy_name = FLOPPY_3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
device_t *floppy = subdevice(floppy_name);
|
legacy_floppy_image_device *floppy = subdevice<legacy_floppy_image_device>(floppy_name);
|
||||||
m_mc6843->set_drive(drive);
|
m_mc6843->set_drive(drive);
|
||||||
floppy_mon_w(floppy, motor);
|
floppy->floppy_mon_w(motor);
|
||||||
floppy_drive_set_ready_state(floppy, ASSERT_LINE, 0);
|
floppy->floppy_drive_set_ready_state(ASSERT_LINE, 0);
|
||||||
m_mc6843->set_side(side);
|
m_mc6843->set_side(side);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,16 +299,16 @@ void coco_fdc_device::dskreg_w(UINT8 data)
|
|||||||
else if (data & 0x40)
|
else if (data & 0x40)
|
||||||
drive = 3;
|
drive = 3;
|
||||||
|
|
||||||
device_t *floppy[4];
|
legacy_floppy_image_device *floppy[4];
|
||||||
|
|
||||||
floppy[0] = subdevice(FLOPPY_0);
|
floppy[0] = subdevice<legacy_floppy_image_device>(FLOPPY_0);
|
||||||
floppy[1] = subdevice(FLOPPY_1);
|
floppy[1] = subdevice<legacy_floppy_image_device>(FLOPPY_1);
|
||||||
floppy[2] = subdevice(FLOPPY_2);
|
floppy[2] = subdevice<legacy_floppy_image_device>(FLOPPY_2);
|
||||||
floppy[3] = subdevice(FLOPPY_3);
|
floppy[3] = subdevice<legacy_floppy_image_device>(FLOPPY_3);
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
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;
|
head = ((data & 0x40) && (drive != 3)) ? 1 : 0;
|
||||||
|
@ -618,7 +618,7 @@ READ8_MEMBER( c8050_device::miot_pb_r )
|
|||||||
UINT8 data = 0;
|
UINT8 data = 0;
|
||||||
|
|
||||||
// write protect sense
|
// 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
|
// drive type
|
||||||
data |= 0x10;
|
data |= 0x10;
|
||||||
@ -1017,10 +1017,10 @@ inline void c8050_device::read_current_track(int unit)
|
|||||||
m_bit_count = 0;
|
m_bit_count = 0;
|
||||||
|
|
||||||
// read track data
|
// 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
|
// 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);
|
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;
|
m_unit[unit].m_mtr = mtr;
|
||||||
}
|
}
|
||||||
@ -1066,7 +1066,7 @@ inline void c8050_device::mpi_step_motor(int unit, int stp)
|
|||||||
if (tracks != 0)
|
if (tracks != 0)
|
||||||
{
|
{
|
||||||
// step read/write head
|
// 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 new track data
|
||||||
read_current_track(unit);
|
read_current_track(unit);
|
||||||
@ -1199,13 +1199,13 @@ void c8050_device::device_start()
|
|||||||
// install image callbacks
|
// install image callbacks
|
||||||
m_unit[0].m_image = m_image0;
|
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)
|
if (m_image1)
|
||||||
{
|
{
|
||||||
m_unit[1].m_image = 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
|
// register for state saving
|
||||||
|
@ -125,7 +125,7 @@ protected:
|
|||||||
int m_bit_pos; // bit position within track buffer byte
|
int m_bit_pos; // bit position within track buffer byte
|
||||||
|
|
||||||
// devices
|
// devices
|
||||||
device_t *m_image;
|
legacy_floppy_image_device *m_image;
|
||||||
} m_unit[2];
|
} m_unit[2];
|
||||||
|
|
||||||
int m_drive; // selected drive
|
int m_drive; // selected drive
|
||||||
|
@ -839,20 +839,20 @@ READ8Z_MEMBER(snug_bwg_legacy_device::readz)
|
|||||||
the default implementation sets the drive geometry to the geometry
|
the default implementation sets the drive geometry to the geometry
|
||||||
of the medium.
|
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.
|
// This assertion may fail when the names of the floppy devices change.
|
||||||
// Unfortunately, the wd17xx device assumes the floppy drives at root
|
// Unfortunately, the wd17xx device assumes the floppy drives at root
|
||||||
// level, so we use an explicitly qualified tag. See peribox.h.
|
// level, so we use an explicitly qualified tag. See peribox.h.
|
||||||
assert(drive != NULL);
|
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)
|
void snug_bwg_legacy_device::set_all_geometries(floppy_type_t type)
|
||||||
{
|
{
|
||||||
set_geometry(machine().device(PFLOPPY_0), type);
|
set_geometry(machine().device<legacy_floppy_image_device>(PFLOPPY_0), type);
|
||||||
set_geometry(machine().device(PFLOPPY_1), type);
|
set_geometry(machine().device<legacy_floppy_image_device>(PFLOPPY_1), type);
|
||||||
set_geometry(machine().device(PFLOPPY_2), type);
|
set_geometry(machine().device<legacy_floppy_image_device>(PFLOPPY_2), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -173,7 +173,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void set_ready_line();
|
void set_ready_line();
|
||||||
void set_all_geometries(floppy_type_t type);
|
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);
|
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||||
|
|
||||||
// Holds the status of the DRQ and IRQ lines.
|
// Holds the status of the DRQ and IRQ lines.
|
||||||
|
@ -304,11 +304,11 @@ READ8_MEMBER( myarc_hfdc_device::auxbus_in )
|
|||||||
if (index==-1) return 0;
|
if (index==-1) return 0;
|
||||||
|
|
||||||
/* Get floppy status. */
|
/* 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;
|
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;
|
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;
|
reply |= DS_WRPROT;
|
||||||
|
|
||||||
/* if (image_exists(disk_img)) */
|
/* if (image_exists(disk_img)) */
|
||||||
@ -321,7 +321,7 @@ READ8_MEMBER( myarc_hfdc_device::auxbus_in )
|
|||||||
{
|
{
|
||||||
UINT8 state;
|
UINT8 state;
|
||||||
index = slog2((m_output1_latch>>4) & 0x0f)-1;
|
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();
|
state = hd->get_status();
|
||||||
|
|
||||||
if (state & MFMHD_TRACK00) reply |= DS_TRK00;
|
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 )
|
WRITE8_MEMBER( myarc_hfdc_device::auxbus_out )
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
device_t* selected_drive = NULL;
|
|
||||||
|
|
||||||
switch (offset)
|
switch (offset)
|
||||||
{
|
{
|
||||||
case INPUT_STATUS:
|
case INPUT_STATUS:
|
||||||
@ -363,16 +361,15 @@ WRITE8_MEMBER( myarc_hfdc_device::auxbus_out )
|
|||||||
{
|
{
|
||||||
// Floppy selected
|
// Floppy selected
|
||||||
index = slog2(data & 0x0f);
|
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
|
else
|
||||||
{
|
{
|
||||||
// HD selected
|
// HD selected
|
||||||
index = slog2((data>>4) & 0x0f);
|
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;
|
m_output1_latch = data;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -536,14 +533,14 @@ void myarc_hfdc_device::device_reset()
|
|||||||
m_selected = false;
|
m_selected = false;
|
||||||
|
|
||||||
// Find the floppies and hard disks
|
// Find the floppies and hard disks
|
||||||
m_floppy_unit[0] = m_slot->get_drive(FLOPPY_0);
|
m_floppy_unit[0] = static_cast<legacy_floppy_image_device *>(m_slot->get_drive(FLOPPY_0));
|
||||||
m_floppy_unit[1] = m_slot->get_drive(FLOPPY_1);
|
m_floppy_unit[1] = static_cast<legacy_floppy_image_device *>(m_slot->get_drive(FLOPPY_1));
|
||||||
m_floppy_unit[2] = m_slot->get_drive(FLOPPY_2);
|
m_floppy_unit[2] = static_cast<legacy_floppy_image_device *>(m_slot->get_drive(FLOPPY_2));
|
||||||
m_floppy_unit[3] = m_slot->get_drive(FLOPPY_3);
|
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[0] = static_cast<mfm_harddisk_device *>(m_slot->get_drive(MFMHD_0));
|
||||||
m_harddisk_unit[1] = m_slot->get_drive(MFMHD_1);
|
m_harddisk_unit[1] = static_cast<mfm_harddisk_device *>(m_slot->get_drive(MFMHD_1));
|
||||||
m_harddisk_unit[2] = m_slot->get_drive(MFMHD_2);
|
m_harddisk_unit[2] = static_cast<mfm_harddisk_device *>(m_slot->get_drive(MFMHD_2));
|
||||||
|
|
||||||
if (ioport("HFDCDIP")->read()&0x55)
|
if (ioport("HFDCDIP")->read()&0x55)
|
||||||
ti99_set_80_track_drives(TRUE);
|
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_controller(card->floppy_unit[i], device);
|
||||||
// floppy_drive_set_index_pulse_callback(floppy_unit[i], smc92x4_index_pulse_callback);
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,10 +93,10 @@ private:
|
|||||||
UINT8 m_output2_latch;
|
UINT8 m_output2_latch;
|
||||||
|
|
||||||
/* Connected floppy drives. */
|
/* Connected floppy drives. */
|
||||||
device_t* m_floppy_unit[HFDC_MAX_FLOPPY];
|
legacy_floppy_image_device* m_floppy_unit[HFDC_MAX_FLOPPY];
|
||||||
|
|
||||||
/* Connected harddisk drives. */
|
/* Connected harddisk drives. */
|
||||||
device_t* m_harddisk_unit[HFDC_MAX_HARD];
|
mfm_harddisk_device* m_harddisk_unit[HFDC_MAX_HARD];
|
||||||
|
|
||||||
/* DMA address latch */
|
/* DMA address latch */
|
||||||
UINT32 m_dma_address;
|
UINT32 m_dma_address;
|
||||||
|
@ -394,10 +394,10 @@ void peribox_device::device_start(void)
|
|||||||
{
|
{
|
||||||
if (TRACE_EMU) logerror("Peribox started\n");
|
if (TRACE_EMU) logerror("Peribox started\n");
|
||||||
|
|
||||||
floppy_drive_set_rpm(subdevice(FLOPPY_0), 300.);
|
subdevice<legacy_floppy_image_device>(FLOPPY_0)->floppy_drive_set_rpm(300.);
|
||||||
floppy_drive_set_rpm(subdevice(FLOPPY_1), 300.);
|
subdevice<legacy_floppy_image_device>(FLOPPY_1)->floppy_drive_set_rpm(300.);
|
||||||
floppy_drive_set_rpm(subdevice(FLOPPY_2), 300.);
|
subdevice<legacy_floppy_image_device>(FLOPPY_2)->floppy_drive_set_rpm(300.);
|
||||||
floppy_drive_set_rpm(subdevice(FLOPPY_3), 300.);
|
subdevice<legacy_floppy_image_device>(FLOPPY_3)->floppy_drive_set_rpm(300.);
|
||||||
|
|
||||||
// Resolve the callback lines to the console
|
// Resolve the callback lines to the console
|
||||||
m_console_inta.resolve();
|
m_console_inta.resolve();
|
||||||
|
@ -648,20 +648,20 @@ WRITE8_MEMBER(ti_fdc_legacy_device::cruwrite)
|
|||||||
the default implementation sets the drive geometry to the geometry
|
the default implementation sets the drive geometry to the geometry
|
||||||
of the medium.
|
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.
|
// This assertion may fail when the names of the floppy devices change.
|
||||||
// Unfortunately, the wd17xx device assumes the floppy drives at root
|
// Unfortunately, the wd17xx device assumes the floppy drives at root
|
||||||
// level, so we use an explicitly qualified tag. See peribox.h.
|
// level, so we use an explicitly qualified tag. See peribox.h.
|
||||||
assert (drive!=NULL);
|
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)
|
void ti_fdc_legacy_device::set_all_geometries(floppy_type_t type)
|
||||||
{
|
{
|
||||||
set_geometry(machine().device(PFLOPPY_0), type);
|
set_geometry(machine().device<legacy_floppy_image_device>(PFLOPPY_0), type);
|
||||||
set_geometry(machine().device(PFLOPPY_1), type);
|
set_geometry(machine().device<legacy_floppy_image_device>(PFLOPPY_1), type);
|
||||||
set_geometry(machine().device(PFLOPPY_2), type);
|
set_geometry(machine().device<legacy_floppy_image_device>(PFLOPPY_2), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -146,7 +146,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
void set_ready_line();
|
void set_ready_line();
|
||||||
void set_all_geometries(floppy_type_t type);
|
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
|
// Recent address
|
||||||
int m_address;
|
int m_address;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -90,92 +90,6 @@ struct chrn_id
|
|||||||
/* set if index has just occurred */
|
/* set if index has just occurred */
|
||||||
#define FLOPPY_DRIVE_INDEX 0x0020
|
#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,
|
class legacy_floppy_image_device : public device_t,
|
||||||
public device_image_interface
|
public device_image_interface
|
||||||
@ -203,20 +117,134 @@ public:
|
|||||||
virtual const char *file_extensions() const { return m_extension_list; }
|
virtual const char *file_extensions() const { return m_extension_list; }
|
||||||
virtual const option_guide *create_option_guide() const { return floppy_option_guide; }
|
virtual const option_guide *create_option_guide() const { return floppy_option_guide; }
|
||||||
|
|
||||||
// access to legacy token
|
floppy_image_legacy *flopimg_get_image();
|
||||||
struct floppy_drive *token() const { assert(m_token != NULL); return m_token; }
|
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:
|
protected:
|
||||||
// device overrides
|
// device overrides
|
||||||
virtual void device_config_complete();
|
virtual void device_config_complete();
|
||||||
virtual void device_start();
|
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];
|
char m_extension_list[256];
|
||||||
};
|
};
|
||||||
|
|
||||||
// device type definition
|
// device type definition
|
||||||
extern const device_type LEGACY_FLOPPY;
|
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
|
DEVICE CONFIGURATION MACROS
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "i8271.h"
|
#include "i8271.h"
|
||||||
#include "imagedev/flopdrv.h"
|
|
||||||
|
|
||||||
/* data request */
|
/* data request */
|
||||||
#define I8271_FLAGS_DATA_REQUEST 0x01
|
#define I8271_FLAGS_DATA_REQUEST 0x01
|
||||||
@ -238,10 +237,10 @@ void i8271_device::device_reset()
|
|||||||
set_dma_drq();
|
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) {
|
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 {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -250,7 +249,7 @@ device_t *i8271_device::current_image()
|
|||||||
|
|
||||||
void i8271_device::seek_to_track(int track)
|
void i8271_device::seek_to_track(int track)
|
||||||
{
|
{
|
||||||
device_t *img = current_image();
|
legacy_floppy_image_device *img = current_image();
|
||||||
if (track==0)
|
if (track==0)
|
||||||
{
|
{
|
||||||
/* seek to track 0 */
|
/* seek to track 0 */
|
||||||
@ -259,11 +258,11 @@ void i8271_device::seek_to_track(int track)
|
|||||||
/*logerror("step\n"); */
|
/*logerror("step\n"); */
|
||||||
|
|
||||||
/* track 0 not set, not seeked more than 255 tracks */
|
/* 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"); */
|
/* logerror("step\n"); */
|
||||||
StepCount--;
|
StepCount--;
|
||||||
floppy_drive_seek(img, -1);
|
img->floppy_drive_seek(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_CurrentTrack[m_drive] = 0;
|
m_CurrentTrack[m_drive] = 0;
|
||||||
@ -297,7 +296,7 @@ void i8271_device::seek_to_track(int track)
|
|||||||
|
|
||||||
|
|
||||||
/* seek to track 0 */
|
/* seek to track 0 */
|
||||||
floppy_drive_seek(img, SignedTracks);
|
img->floppy_drive_seek(SignedTracks);
|
||||||
|
|
||||||
m_CurrentTrack[m_drive] = track;
|
m_CurrentTrack[m_drive] = track;
|
||||||
}
|
}
|
||||||
@ -610,7 +609,7 @@ void i8271_device::command_continue()
|
|||||||
case I8271_COMMAND_WRITE_DATA_SINGLE_RECORD:
|
case I8271_COMMAND_WRITE_DATA_SINGLE_RECORD:
|
||||||
{
|
{
|
||||||
/* put the buffer to the sector */
|
/* 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? */
|
/* completed all sectors? */
|
||||||
m_Counter--;
|
m_Counter--;
|
||||||
@ -653,7 +652,7 @@ void i8271_device::do_read()
|
|||||||
if (find_sector())
|
if (find_sector())
|
||||||
{
|
{
|
||||||
/* get the sector into the buffer */
|
/* 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 for reading */
|
||||||
initialise_execution_phase_read(1<<(m_ID_N+7));
|
initialise_execution_phase_read(1<<(m_ID_N+7));
|
||||||
@ -672,7 +671,7 @@ void i8271_device::do_read_id()
|
|||||||
chrn_id id;
|
chrn_id id;
|
||||||
|
|
||||||
/* get next id from disc */
|
/* 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[0] = id.C;
|
||||||
m_pExecutionPhaseData[1] = id.H;
|
m_pExecutionPhaseData[1] = id.H;
|
||||||
@ -704,7 +703,7 @@ void i8271_device::do_write()
|
|||||||
|
|
||||||
int i8271_device::find_sector()
|
int i8271_device::find_sector()
|
||||||
{
|
{
|
||||||
device_t *img = current_image();
|
legacy_floppy_image_device *img = current_image();
|
||||||
// int track_count_attempt;
|
// int track_count_attempt;
|
||||||
|
|
||||||
// track_count_attempt
|
// track_count_attempt
|
||||||
@ -719,7 +718,7 @@ int i8271_device::find_sector()
|
|||||||
chrn_id id;
|
chrn_id id;
|
||||||
|
|
||||||
/* get next id from disc */
|
/* 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
|
/* tested on Amstrad CPC - All bytes must match, otherwise
|
||||||
a NO DATA error is reported */
|
a NO DATA error is reported */
|
||||||
@ -742,7 +741,7 @@ int i8271_device::find_sector()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* index set? */
|
/* index set? */
|
||||||
if (floppy_drive_get_flag_state(img, FLOPPY_DRIVE_INDEX))
|
if (img->floppy_drive_get_flag_state(FLOPPY_DRIVE_INDEX))
|
||||||
{
|
{
|
||||||
index_count++;
|
index_count++;
|
||||||
}
|
}
|
||||||
@ -759,7 +758,7 @@ int i8271_device::find_sector()
|
|||||||
|
|
||||||
void i8271_device::command_execute()
|
void i8271_device::command_execute()
|
||||||
{
|
{
|
||||||
device_t *img = current_image();
|
legacy_floppy_image_device *img = current_image();
|
||||||
|
|
||||||
/* clear it = good completion status */
|
/* clear it = good completion status */
|
||||||
/* this will be changed if anything bad happens! */
|
/* 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);
|
m_drive_control_input = (1<<6) | (1<<2);
|
||||||
|
|
||||||
/* bit 3 = 0 if write protected */
|
/* 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 */
|
/* 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 */
|
/* need to setup this register based on drive selected */
|
||||||
data = m_drive_control_input;
|
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,
|
/* 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 */
|
on standard-sized drives this loads the head and turns the motor on */
|
||||||
floppy_mon_w(img, !BIT(m_CommandParameters[1], 3));
|
img->floppy_mon_w(!BIT(m_CommandParameters[1], 3));
|
||||||
floppy_drive_set_ready_state(img, 1, 1);
|
img->floppy_drive_set_ready_state(1, 1);
|
||||||
|
|
||||||
/* step pin changed? if so perform a step in the direction indicated */
|
/* step pin changed? if so perform a step in the direction indicated */
|
||||||
if (((m_drive_control_output^m_CommandParameters[1]) & (1<<1))!=0)
|
if (((m_drive_control_output^m_CommandParameters[1]) & (1<<1))!=0)
|
||||||
@ -1042,7 +1041,7 @@ void i8271_device::command_execute()
|
|||||||
signed_tracks = -1;
|
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! ?? */
|
/* these two do not appear to be set at all! ?? */
|
||||||
|
|
||||||
if (m_floppy_drive_tags[0]!=NULL) {
|
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);
|
status |= (1<<2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_floppy_drive_tags[1]!=NULL) {
|
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);
|
status |= (1<<6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* bit 3 = 1 if write protected */
|
/* 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 */
|
/* bit 1 = 1 if head at track 0 */
|
||||||
status |= !floppy_tk00_r(img) << 1;
|
status |= !img->floppy_tk00_r() << 1;
|
||||||
|
|
||||||
m_ResultRegister = status;
|
m_ResultRegister = status;
|
||||||
command_complete(1,0);
|
command_complete(1,0);
|
||||||
@ -1140,7 +1139,7 @@ void i8271_device::command_execute()
|
|||||||
|
|
||||||
get_drive();
|
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 type: operation intervention probably required for recovery */
|
||||||
/* Completion code: Drive not ready */
|
/* Completion code: Drive not ready */
|
||||||
@ -1173,7 +1172,7 @@ void i8271_device::command_execute()
|
|||||||
|
|
||||||
get_drive();
|
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 type: operation intervention probably required for recovery */
|
||||||
/* Completion code: Drive not ready */
|
/* Completion code: Drive not ready */
|
||||||
@ -1212,7 +1211,7 @@ void i8271_device::command_execute()
|
|||||||
|
|
||||||
m_drive_control_output &=~1;
|
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 type: operation intervention probably required for recovery */
|
||||||
/* Completion code: Drive not ready */
|
/* Completion code: Drive not ready */
|
||||||
@ -1221,7 +1220,7 @@ void i8271_device::command_execute()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (floppy_wpt_r(img) == CLEAR_LINE)
|
if (img->floppy_wpt_r() == CLEAR_LINE)
|
||||||
{
|
{
|
||||||
/* Completion type: operation intervention probably required for recovery */
|
/* Completion type: operation intervention probably required for recovery */
|
||||||
/* Completion code: Drive write protected */
|
/* Completion code: Drive write protected */
|
||||||
@ -1257,7 +1256,7 @@ void i8271_device::command_execute()
|
|||||||
|
|
||||||
m_drive_control_output &=~1;
|
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 type: operation intervention probably required for recovery */
|
||||||
/* Completion code: Drive not ready */
|
/* Completion code: Drive not ready */
|
||||||
@ -1266,7 +1265,7 @@ void i8271_device::command_execute()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (floppy_wpt_r(img) == CLEAR_LINE)
|
if (img->floppy_wpt_r() == CLEAR_LINE)
|
||||||
{
|
{
|
||||||
/* Completion type: operation intervention probably required for recovery */
|
/* Completion type: operation intervention probably required for recovery */
|
||||||
/* Completion code: Drive write protected */
|
/* Completion code: Drive write protected */
|
||||||
@ -1296,7 +1295,7 @@ void i8271_device::command_execute()
|
|||||||
|
|
||||||
get_drive();
|
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 type: operation intervention probably required for recovery */
|
||||||
/* Completion code: Drive not ready */
|
/* Completion code: Drive not ready */
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#ifndef I8271_H_
|
#ifndef I8271_H_
|
||||||
#define I8271_H_
|
#define I8271_H_
|
||||||
|
|
||||||
|
#include "imagedev/flopdrv.h"
|
||||||
|
|
||||||
#define MCFG_I8271_IRQ_CALLBACK(_write) \
|
#define MCFG_I8271_IRQ_CALLBACK(_write) \
|
||||||
devcb = &i8271_device::set_irq_wr_callback(*device, DEVCB2_##_write);
|
devcb = &i8271_device::set_irq_wr_callback(*device, DEVCB2_##_write);
|
||||||
|
|
||||||
@ -126,7 +128,7 @@ private:
|
|||||||
emu_timer *m_data_timer;
|
emu_timer *m_data_timer;
|
||||||
emu_timer *m_command_complete_timer;
|
emu_timer *m_command_complete_timer;
|
||||||
|
|
||||||
device_t *current_image();
|
legacy_floppy_image_device *current_image();
|
||||||
void seek_to_track(int track);
|
void seek_to_track(int track);
|
||||||
void load_bad_tracks(int surface);
|
void load_bad_tracks(int surface);
|
||||||
void write_bad_track(int surface, int track, int data);
|
void write_bad_track(int surface, int track, int data);
|
||||||
|
@ -139,10 +139,10 @@ void mc6843_device::device_reset()
|
|||||||
/* setup/reset floppy drive */
|
/* setup/reset floppy drive */
|
||||||
for ( i = 0; i < 4; i++ )
|
for ( i = 0; i < 4; i++ )
|
||||||
{
|
{
|
||||||
device_t * img = floppy_image( i );
|
legacy_floppy_image_device * img = floppy_image( i );
|
||||||
floppy_mon_w(img, CLEAR_LINE);
|
img->floppy_mon_w(CLEAR_LINE);
|
||||||
floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
|
img->floppy_drive_set_ready_state(FLOPPY_DRIVE_READY, 0 );
|
||||||
floppy_drive_set_rpm( img, 300. );
|
img->floppy_drive_set_rpm( 300. );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reset registers */
|
/* 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()) {
|
if (!img && owner()) {
|
||||||
// For slot devices, drives are typically attached to the slot rather than the machine
|
// For slot devices, drives are typically attached to the slot rather than the machine
|
||||||
const char *floppy_name = NULL;
|
const char *floppy_name = NULL;
|
||||||
@ -182,13 +182,13 @@ device_t* mc6843_device::floppy_image( UINT8 drive )
|
|||||||
floppy_name = FLOPPY_3;
|
floppy_name = FLOPPY_3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
img = owner()->subdevice(floppy_name);
|
img = owner()->subdevice<legacy_floppy_image_device>(floppy_name);
|
||||||
}
|
}
|
||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
device_t* mc6843_device::floppy_image( )
|
legacy_floppy_image_device* mc6843_device::floppy_image( )
|
||||||
{
|
{
|
||||||
return floppy_image( m_drive );
|
return floppy_image( m_drive );
|
||||||
}
|
}
|
||||||
@ -262,24 +262,24 @@ void mc6843_device::cmd_end( )
|
|||||||
/* Seek Track Zero bottom half */
|
/* Seek Track Zero bottom half */
|
||||||
void mc6843_device::finish_STZ( )
|
void mc6843_device::finish_STZ( )
|
||||||
{
|
{
|
||||||
device_t* img = floppy_image( );
|
legacy_floppy_image_device* img = floppy_image( );
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* seek to track zero */
|
/* seek to track zero */
|
||||||
for ( i=0; i<83; i++ )
|
for ( i=0; i<83; i++ )
|
||||||
{
|
{
|
||||||
if (floppy_tk00_r(img) == CLEAR_LINE)
|
if (img->floppy_tk00_r() == CLEAR_LINE)
|
||||||
break;
|
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 */
|
/* update state */
|
||||||
m_CTAR = 0;
|
m_CTAR = 0;
|
||||||
m_GCR = 0;
|
m_GCR = 0;
|
||||||
m_SAR = 0;
|
m_SAR = 0;
|
||||||
m_STRB |= floppy_tk00_r(img) << 4;
|
m_STRB |= img->floppy_tk00_r() << 4;
|
||||||
|
|
||||||
cmd_end( );
|
cmd_end( );
|
||||||
}
|
}
|
||||||
@ -289,13 +289,13 @@ void mc6843_device::finish_STZ( )
|
|||||||
/* Seek bottom half */
|
/* Seek bottom half */
|
||||||
void mc6843_device::finish_SEK( )
|
void mc6843_device::finish_SEK( )
|
||||||
{
|
{
|
||||||
device_t* img = floppy_image( );
|
legacy_floppy_image_device* img = floppy_image( );
|
||||||
|
|
||||||
/* seek to track */
|
/* seek to track */
|
||||||
// TODO: not sure how CTAR bit 7 is handled here, but this is the safest approach for now
|
// 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 */
|
/* update state */
|
||||||
m_CTAR = m_GCR;
|
m_CTAR = m_GCR;
|
||||||
@ -308,12 +308,12 @@ void mc6843_device::finish_SEK( )
|
|||||||
/* preamble to all sector read / write commands, returns 1 if found */
|
/* preamble to all sector read / write commands, returns 1 if found */
|
||||||
int mc6843_device::address_search( chrn_id* id )
|
int mc6843_device::address_search( chrn_id* id )
|
||||||
{
|
{
|
||||||
device_t* img = floppy_image( );
|
legacy_floppy_image_device* img = floppy_image( );
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
while ( 1 )
|
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 */
|
/* read address error */
|
||||||
LOG(( "%f mc6843_address_search: get_next_id failed\n", machine().time().as_double() ));
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( floppy_drive_get_flag_state( img, FLOPPY_DRIVE_INDEX ) )
|
if ( img->floppy_drive_get_flag_state( FLOPPY_DRIVE_INDEX ) )
|
||||||
{
|
{
|
||||||
r++;
|
r++;
|
||||||
if ( r >= 4 )
|
if ( r >= 4 )
|
||||||
@ -403,14 +403,14 @@ void mc6843_device::finish_RCR( )
|
|||||||
void mc6843_device::cont_SR( )
|
void mc6843_device::cont_SR( )
|
||||||
{
|
{
|
||||||
chrn_id id;
|
chrn_id id;
|
||||||
device_t* img = floppy_image( );
|
legacy_floppy_image_device* img = floppy_image( );
|
||||||
|
|
||||||
/* sector seek */
|
/* sector seek */
|
||||||
if ( ! address_search_read( &id ) )
|
if ( ! address_search_read( &id ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* sector read */
|
/* 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_idx = 0;
|
||||||
m_data_size = 128;
|
m_data_size = 128;
|
||||||
m_STRA |= 0x01; /* set Data Transfer Request */
|
m_STRA |= 0x01; /* set Data Transfer Request */
|
||||||
@ -551,7 +551,7 @@ READ8_MEMBER( mc6843_device::read )
|
|||||||
data = m_CTAR;
|
data = m_CTAR;
|
||||||
LOG(( "%f %s mc6843_r: read CTAR %i (actual=%i)\n",
|
LOG(( "%f %s mc6843_r: read CTAR %i (actual=%i)\n",
|
||||||
machine().time().as_double(), machine().describe_context(), data,
|
machine().time().as_double(), machine().describe_context(), data,
|
||||||
floppy_drive_get_current_track( floppy_image( ) ) ));
|
floppy_image()->floppy_drive_get_current_track()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /* Interrupt Status Register (ISR) */
|
case 2: /* Interrupt Status Register (ISR) */
|
||||||
@ -569,14 +569,14 @@ READ8_MEMBER( mc6843_device::read )
|
|||||||
case 3: /* Status Register A (STRA) */
|
case 3: /* Status Register A (STRA) */
|
||||||
{
|
{
|
||||||
/* update */
|
/* update */
|
||||||
device_t* img = floppy_image( );
|
legacy_floppy_image_device* img = floppy_image( );
|
||||||
int flag = floppy_drive_get_flag_state( img, FLOPPY_DRIVE_READY);
|
int flag = img->floppy_drive_get_flag_state( FLOPPY_DRIVE_READY);
|
||||||
m_STRA &= 0xa3;
|
m_STRA &= 0xa3;
|
||||||
if ( flag & FLOPPY_DRIVE_READY )
|
if ( flag & FLOPPY_DRIVE_READY )
|
||||||
m_STRA |= 0x04;
|
m_STRA |= 0x04;
|
||||||
|
|
||||||
m_STRA |= !floppy_tk00_r(img) << 3;
|
m_STRA |= !img->floppy_tk00_r() << 3;
|
||||||
m_STRA |= !floppy_wpt_r(img) << 4;
|
m_STRA |= !img->floppy_wpt_r() << 4;
|
||||||
|
|
||||||
if ( m_index_pulse )
|
if ( m_index_pulse )
|
||||||
m_STRA |= 0x40;
|
m_STRA |= 0x40;
|
||||||
@ -605,7 +605,7 @@ READ8_MEMBER( mc6843_device::read )
|
|||||||
data = m_LTAR;
|
data = m_LTAR;
|
||||||
LOG(( "%f %s mc6843_r: read LTAR %i (actual=%i)\n",
|
LOG(( "%f %s mc6843_r: read LTAR %i (actual=%i)\n",
|
||||||
machine().time().as_double(), machine().describe_context(), data,
|
machine().time().as_double(), machine().describe_context(), data,
|
||||||
floppy_drive_get_current_track( floppy_image( ) ) ));
|
floppy_image()->floppy_drive_get_current_track()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -639,12 +639,12 @@ WRITE8_MEMBER( mc6843_device::write )
|
|||||||
if ( m_data_idx >= m_data_size )
|
if ( m_data_idx >= m_data_size )
|
||||||
{
|
{
|
||||||
/* end of sector write */
|
/* 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 ));
|
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->floppy_drive_write_sector_data(
|
||||||
img, m_side, m_data_id,
|
m_side, m_data_id,
|
||||||
m_data, m_data_size,
|
m_data, m_data_size,
|
||||||
(cmd == CMD_SWD) ? ID_FLAG_DELETED_DATA : 0 );
|
(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) )
|
if ( (m_data[2] == 0) && (m_data[4] == 0) )
|
||||||
{
|
{
|
||||||
/* valid address id field */
|
/* valid address id field */
|
||||||
device_t* img = floppy_image( );
|
legacy_floppy_image_device* img = floppy_image( );
|
||||||
UINT8 track = m_data[1];
|
UINT8 track = m_data[1];
|
||||||
UINT8 sector = m_data[3];
|
UINT8 sector = m_data[3];
|
||||||
UINT8 filler = 0xe5; /* standard Thomson filler */
|
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));
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -736,7 +736,7 @@ WRITE8_MEMBER( mc6843_device::write )
|
|||||||
m_CTAR = data;
|
m_CTAR = data;
|
||||||
LOG(( "%f %s mc6843_w: set CTAR to %i %02X (actual=%i) \n",
|
LOG(( "%f %s mc6843_w: set CTAR to %i %02X (actual=%i) \n",
|
||||||
machine().time().as_double(), machine().describe_context(), m_CTAR, data,
|
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;
|
break;
|
||||||
|
|
||||||
case 2: /* Command Register (CMR) */
|
case 2: /* Command Register (CMR) */
|
||||||
@ -816,7 +816,7 @@ WRITE8_MEMBER( mc6843_device::write )
|
|||||||
m_LTAR = data & 0x7f;
|
m_LTAR = data & 0x7f;
|
||||||
LOG(( "%f %s mc6843_w: set LTAR to %i %02X (actual=%i)\n",
|
LOG(( "%f %s mc6843_w: set LTAR to %i %02X (actual=%i)\n",
|
||||||
machine().time().as_double(), machine().describe_context(), m_LTAR, data,
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -67,8 +67,8 @@ private:
|
|||||||
/* trigger delayed actions (bottom halves) */
|
/* trigger delayed actions (bottom halves) */
|
||||||
emu_timer* m_timer_cont;
|
emu_timer* m_timer_cont;
|
||||||
|
|
||||||
device_t* floppy_image(UINT8 drive);
|
legacy_floppy_image_device* floppy_image(UINT8 drive);
|
||||||
device_t* floppy_image();
|
legacy_floppy_image_device* floppy_image();
|
||||||
void status_update();
|
void status_update();
|
||||||
void cmd_end();
|
void cmd_end();
|
||||||
void finish_STZ();
|
void finish_STZ();
|
||||||
|
@ -200,7 +200,7 @@ smc92x4_device::smc92x4_device(const machine_config &mconfig, const char *tag, d
|
|||||||
|
|
||||||
int smc92x4_device::image_is_single_density()
|
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);
|
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 redcur;
|
||||||
int precomp;
|
int precomp;
|
||||||
int write_long;
|
int write_long;
|
||||||
mfm_harddisk_device *harddisk;
|
|
||||||
|
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
@ -481,14 +480,13 @@ void smc92x4_device::device_timer(emu_timer &timer, device_timer_id id, int para
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (VERBOSE>5) LOG("smc92x4 step %s direction %d\n", m_drive->tag(), m_step_direction);
|
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
|
else
|
||||||
{
|
{
|
||||||
if (VERBOSE>6) LOG("smc92x4 step harddisk direction %d\n", m_step_direction);
|
if (VERBOSE>6) LOG("smc92x4 step harddisk direction %d\n", m_step_direction);
|
||||||
harddisk = static_cast<mfm_harddisk_device *>(m_drive);
|
m_harddisk->seek(m_step_direction);
|
||||||
harddisk->seek(m_step_direction);
|
|
||||||
}
|
}
|
||||||
sync_status_in();
|
sync_status_in();
|
||||||
break;
|
break;
|
||||||
@ -566,7 +564,6 @@ void smc92x4_device::read_id_field(int *steps, int *direction, chrn_id_hd *id)
|
|||||||
{
|
{
|
||||||
int des_cylinder, cur_cylinder;
|
int des_cylinder, cur_cylinder;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
mfm_harddisk_device *harddisk;
|
|
||||||
|
|
||||||
sync_latches_out();
|
sync_latches_out();
|
||||||
sync_status_in();
|
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)
|
if (m_selected_drive_type & TYPE_FLOPPY)
|
||||||
{
|
{
|
||||||
chrn_id idflop;
|
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");
|
if (VERBOSE>2) LOG("smc92x4 warn: No disk in drive\n");
|
||||||
m_register_r[CHIP_STATUS] |= CS_SYNCERR;
|
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())
|
if ((image_is_single_density() && in_single_density_mode())
|
||||||
|| (!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 */
|
copyid(idflop, id); /* Need to use bigger values for HD, but we don't use separate variables here */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -608,9 +605,7 @@ void smc92x4_device::read_id_field(int *steps, int *direction, chrn_id_hd *id)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
harddisk = static_cast<mfm_harddisk_device *>(m_drive);
|
m_harddisk->get_next_id(m_register_w[DESIRED_HEAD]&0x0f, id);
|
||||||
|
|
||||||
harddisk->get_next_id(m_register_w[DESIRED_HEAD]&0x0f, id);
|
|
||||||
sync_status_in();
|
sync_status_in();
|
||||||
if (!(m_register_r[DRIVE_STATUS]& DS_READY))
|
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 found = false;
|
||||||
int foundsect = false;
|
int foundsect = false;
|
||||||
int des_cylinder = 0;
|
int des_cylinder = 0;
|
||||||
mfm_harddisk_device *harddisk;
|
|
||||||
|
|
||||||
// Set command termination code. The error code is set first, and
|
// Set command termination code. The error code is set first, and
|
||||||
// on success, it is cleared.
|
// 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)
|
if (m_selected_drive_type & TYPE_FLOPPY)
|
||||||
{
|
{
|
||||||
chrn_id idflop;
|
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);
|
copyid(idflop, id);
|
||||||
if (/* pass==1 && */!found)
|
if (/* pass==1 && */!found)
|
||||||
{
|
{
|
||||||
@ -694,8 +688,7 @@ int smc92x4_device::verify(chrn_id_hd *id, bool check_sector)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
harddisk = static_cast<mfm_harddisk_device *>(m_drive);
|
m_harddisk->get_next_id(m_register_w[DESIRED_HEAD]&0x0f, id);
|
||||||
harddisk->get_next_id(m_register_w[DESIRED_HEAD]&0x0f, id);
|
|
||||||
sync_status_in();
|
sync_status_in();
|
||||||
if (!(m_register_r[DRIVE_STATUS]& DS_READY))
|
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)
|
void smc92x4_device::data_transfer_read(chrn_id_hd id, int transfer_enable)
|
||||||
{
|
{
|
||||||
int i, retry, sector_len;
|
int i, retry, sector_len;
|
||||||
mfm_harddisk_device *harddisk;
|
|
||||||
|
|
||||||
int sector_data_id;
|
int sector_data_id;
|
||||||
dynamic_buffer buf;
|
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)
|
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
|
else
|
||||||
{
|
{
|
||||||
// TODO: Should we get the sector length from the harddisk?
|
// TODO: Should we get the sector length from the harddisk?
|
||||||
harddisk = static_cast<mfm_harddisk_device *>(m_drive);
|
m_harddisk->read_sector(id.C, id.H, id.R, buf);
|
||||||
harddisk->read_sector(id.C, id.H, id.R, buf);
|
|
||||||
}
|
}
|
||||||
sync_status_in();
|
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;
|
int retry, i, sector_len;
|
||||||
dynamic_buffer buf;
|
dynamic_buffer buf;
|
||||||
int sector_data_id;
|
int sector_data_id;
|
||||||
mfm_harddisk_device *harddisk;
|
|
||||||
sync_latches_out();
|
sync_latches_out();
|
||||||
sync_status_in();
|
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 (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);
|
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
|
else
|
||||||
{
|
{
|
||||||
harddisk = static_cast<mfm_harddisk_device *>(m_drive);
|
m_harddisk->write_sector(id.C, id.H, id.R, buf);
|
||||||
harddisk->write_sector(id.C, id.H, id.R, buf);
|
|
||||||
}
|
}
|
||||||
sync_status_in();
|
sync_status_in();
|
||||||
|
|
||||||
@ -1344,7 +1333,7 @@ void smc92x4_device::format_floppy_track(int flags)
|
|||||||
|
|
||||||
sync_status_in();
|
sync_status_in();
|
||||||
|
|
||||||
floppy = flopimg_get_image(m_drive);
|
floppy = m_drive->flopimg_get_image();
|
||||||
|
|
||||||
if (floppy != NULL)
|
if (floppy != NULL)
|
||||||
data_count = floppy_get_track_size(floppy, 0, 0);
|
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);
|
memset(&buffer[index], gap_byte, gap4);
|
||||||
index += 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();
|
sync_status_in();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1506,8 +1495,6 @@ void smc92x4_device::format_harddisk_track(int flags)
|
|||||||
int normal_data_mark = flags & 0x10;
|
int normal_data_mark = flags & 0x10;
|
||||||
int data_count=0;
|
int data_count=0;
|
||||||
|
|
||||||
mfm_harddisk_device *harddisk = static_cast<mfm_harddisk_device *>(m_drive);
|
|
||||||
|
|
||||||
dynamic_buffer buffer;
|
dynamic_buffer buffer;
|
||||||
|
|
||||||
sync_status_in();
|
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;
|
for (i=0; i < gap4; i++) buffer[index++] = gap_byte;
|
||||||
|
|
||||||
// Now write the whole track
|
// 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();
|
sync_status_in();
|
||||||
}
|
}
|
||||||
@ -1618,7 +1605,7 @@ void smc92x4_device::read_floppy_track(bool transfer_only_ids)
|
|||||||
|
|
||||||
sync_latches_out();
|
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. */
|
/* Determine the track size. We cannot allow different sizes in this design. */
|
||||||
if (floppy != NULL)
|
if (floppy != NULL)
|
||||||
@ -1634,7 +1621,7 @@ void smc92x4_device::read_floppy_track(bool transfer_only_ids)
|
|||||||
|
|
||||||
buffer = global_alloc_array(UINT8, data_count);
|
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();
|
sync_status_in();
|
||||||
|
|
||||||
// Transfer the buffer to the external memory. We assume the memory
|
// 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;
|
int i;
|
||||||
UINT8 *buffer;
|
UINT8 *buffer;
|
||||||
int data_count=0;
|
int data_count=0;
|
||||||
mfm_harddisk_device *harddisk = static_cast<mfm_harddisk_device *>(m_drive);
|
|
||||||
|
|
||||||
sync_latches_out();
|
sync_latches_out();
|
||||||
|
|
||||||
data_count = harddisk->get_track_length();
|
data_count = m_harddisk->get_track_length();
|
||||||
buffer = global_alloc_array(UINT8, data_count);
|
buffer = global_alloc_array(UINT8, data_count);
|
||||||
|
|
||||||
/* buffer and data_count are allocated and set by the function. */
|
/* 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();
|
sync_status_in();
|
||||||
|
|
||||||
if (!(m_register_r[DRIVE_STATUS] & DS_READY))
|
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);
|
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;
|
m_drive = drive;
|
||||||
if (VERBOSE>3)
|
if (VERBOSE>3)
|
||||||
@ -2013,6 +1998,15 @@ void smc92x4_device::connect_drive(device_t *drive)
|
|||||||
else LOG("smc92x4: Connect drive %s\n", drive->tag());
|
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()
|
void smc92x4_device::reset()
|
||||||
{
|
{
|
||||||
|
@ -98,7 +98,8 @@ public:
|
|||||||
|
|
||||||
// Used to reconfigure the drive connections. Drive selection is done
|
// Used to reconfigure the drive connections. Drive selection is done
|
||||||
// using the select lines and maybe also the user-programmable outputs.
|
// 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();
|
void reset();
|
||||||
|
|
||||||
@ -221,7 +222,8 @@ private:
|
|||||||
// Hard disks must be instances of mfmhd_device; floppy disks are the common drives.
|
// 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
|
// We expect the embedding board to replace the drive according to the
|
||||||
// select lines.
|
// select lines.
|
||||||
device_t *m_drive;
|
legacy_floppy_image_device *m_drive;
|
||||||
|
mfm_harddisk_device *m_harddisk;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MCFG_SMC92X4_ADD(_tag, _intrf) \
|
#define MCFG_SMC92X4_ADD(_tag, _intrf) \
|
||||||
|
@ -154,7 +154,6 @@
|
|||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "formats/imageutl.h"
|
#include "formats/imageutl.h"
|
||||||
#include "machine/wd17xx.h"
|
#include "machine/wd17xx.h"
|
||||||
#include "imagedev/flopdrv.h"
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
CONSTANTS
|
CONSTANTS
|
||||||
@ -494,11 +493,11 @@ void wd1770_device::wd17xx_command_restore()
|
|||||||
if (1) // image_slotexists(m_drive) : FIXME
|
if (1) // image_slotexists(m_drive) : FIXME
|
||||||
{
|
{
|
||||||
/* keep stepping until track 0 is received or 255 steps have been done */
|
/* 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 */
|
/* update time to simulate seek time busy signal */
|
||||||
m_busy_count++;
|
m_busy_count++;
|
||||||
floppy_drive_seek(m_drive, m_direction);
|
m_drive->floppy_drive_seek(m_direction);
|
||||||
step_counter--;
|
step_counter--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -539,7 +538,7 @@ void wd1770_device::write_track()
|
|||||||
//int len = m_buffer[i+4];
|
//int len = m_buffer[i+4];
|
||||||
int filler = 0xe5; /* IBM and Thomson */
|
int filler = 0xe5; /* IBM and Thomson */
|
||||||
int density = m_density;
|
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);
|
m_hd,sector,density?1:0,filler);
|
||||||
i += 128; /* at least... */
|
i += 128; /* at least... */
|
||||||
}
|
}
|
||||||
@ -556,7 +555,7 @@ void wd1770_device::write_track()
|
|||||||
selected format.
|
selected format.
|
||||||
*/
|
*/
|
||||||
m_data_count = 0;
|
m_data_count = 0;
|
||||||
floppy = flopimg_get_image(m_drive);
|
floppy = m_drive->flopimg_get_image();
|
||||||
if (floppy != NULL)
|
if (floppy != NULL)
|
||||||
m_data_count = floppy_get_track_size(floppy, m_hd, m_track);
|
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;
|
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;
|
m_data_offset = 0;
|
||||||
|
|
||||||
@ -707,7 +706,7 @@ void wd1770_device::read_track()
|
|||||||
/* Determine the track size. We cannot allow different sizes in this
|
/* Determine the track size. We cannot allow different sizes in this
|
||||||
design (see above, write_track). */
|
design (see above, write_track). */
|
||||||
m_data_count = 0;
|
m_data_count = 0;
|
||||||
floppy = flopimg_get_image(m_drive);
|
floppy = m_drive->flopimg_get_image();
|
||||||
if (floppy != NULL)
|
if (floppy != NULL)
|
||||||
m_data_count = floppy_get_track_size(floppy, m_hd, m_track);
|
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;
|
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;
|
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);
|
m_status &= ~(STA_2_CRC_ERR | STA_2_REC_N_FND);
|
||||||
|
|
||||||
/* get next id from disc */
|
/* 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;
|
UINT16 crc = 0xffff;
|
||||||
|
|
||||||
@ -809,7 +808,7 @@ int wd1770_device::wd17xx_locate_sector()
|
|||||||
|
|
||||||
while (revolution_count!=4)
|
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 */
|
/* compare track */
|
||||||
if (id.C == m_track)
|
if (id.C == m_track)
|
||||||
@ -834,7 +833,7 @@ int wd1770_device::wd17xx_locate_sector()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* index set? */
|
/* 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 */
|
/* update revolution count */
|
||||||
revolution_count++;
|
revolution_count++;
|
||||||
@ -886,7 +885,7 @@ void wd1770_device::wd17xx_read_sector()
|
|||||||
m_data_count = m_sector_length;
|
m_data_count = m_sector_length;
|
||||||
|
|
||||||
/* read data */
|
/* 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();
|
wd17xx_timed_data_request();
|
||||||
|
|
||||||
@ -936,7 +935,7 @@ void wd1770_device::wd17xx_write_sector()
|
|||||||
m_data_count = m_sector_length;
|
m_data_count = m_sector_length;
|
||||||
|
|
||||||
/* write data */
|
/* 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 */
|
/* must be found within 5 revolutions otherwise error */
|
||||||
while (revolution_count!=5)
|
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 */
|
/* compare track */
|
||||||
if (id.C == m_track)
|
if (id.C == m_track)
|
||||||
@ -969,7 +968,7 @@ void wd1770_device::wd17xx_verify_seek()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* index set? */
|
/* 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 */
|
/* update revolution count */
|
||||||
revolution_count++;
|
revolution_count++;
|
||||||
@ -992,7 +991,7 @@ TIMER_CALLBACK_MEMBER( wd1770_device::wd17xx_read_sector_callback )
|
|||||||
if (VERBOSE)
|
if (VERBOSE)
|
||||||
logerror("wd179x: Read Sector callback.\n");
|
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);
|
wd17xx_complete_command(DELAY_NOTREADY);
|
||||||
else
|
else
|
||||||
wd17xx_read_sector();
|
wd17xx_read_sector();
|
||||||
@ -1008,12 +1007,12 @@ TIMER_CALLBACK_MEMBER( wd1770_device::wd17xx_write_sector_callback )
|
|||||||
if (VERBOSE)
|
if (VERBOSE)
|
||||||
logerror("wd179x: Write Sector callback.\n");
|
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);
|
wd17xx_complete_command(DELAY_NOTREADY);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* drive write protected? */
|
/* 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;
|
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)
|
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
|
else
|
||||||
{
|
{
|
||||||
m_status &= ~STA_1_NOT_READY;
|
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;
|
m_status |= STA_1_NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1216,7 +1215,7 @@ READ8_MEMBER( wd1770_device::status_r )
|
|||||||
result |= m_idx << 1;
|
result |= m_idx << 1;
|
||||||
|
|
||||||
/* bit 2, track 0 state, inverted */
|
/* 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)
|
if (m_command_type==TYPE_I)
|
||||||
{
|
{
|
||||||
@ -1227,7 +1226,7 @@ READ8_MEMBER( wd1770_device::status_r )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* bit 6, write protect, inverted */
|
/* bit 6, write protect, inverted */
|
||||||
result |= !floppy_wpt_r(m_drive) << 6;
|
result |= !m_drive->floppy_wpt_r() << 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* eventually set data request bit */
|
/* eventually set data request bit */
|
||||||
@ -1283,10 +1282,10 @@ WRITE8_MEMBER( wd1770_device::command_w )
|
|||||||
if (type() == WD1770 || type() == WD1772)
|
if (type() == WD1770 || type() == WD1772)
|
||||||
{
|
{
|
||||||
m_mo = ASSERT_LINE;
|
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))
|
if (!BIT(m_interrupt, 3))
|
||||||
{
|
{
|
||||||
@ -1409,14 +1408,14 @@ WRITE8_MEMBER( wd1770_device::command_w )
|
|||||||
m_status &= ~STA_2_LOST_DAT;
|
m_status &= ~STA_2_LOST_DAT;
|
||||||
wd17xx_clear_drq();
|
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);
|
wd17xx_complete_command(DELAY_NOTREADY);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* drive write protected? */
|
/* drive write protected? */
|
||||||
if (floppy_wpt_r(m_drive) == CLEAR_LINE)
|
if (m_drive->floppy_wpt_r() == CLEAR_LINE)
|
||||||
{
|
{
|
||||||
/* yes */
|
/* yes */
|
||||||
m_status |= STA_2_WRITE_PRO;
|
m_status |= STA_2_WRITE_PRO;
|
||||||
@ -1452,7 +1451,7 @@ WRITE8_MEMBER( wd1770_device::command_w )
|
|||||||
|
|
||||||
wd17xx_clear_drq();
|
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();
|
wd17xx_read_id();
|
||||||
else
|
else
|
||||||
wd17xx_complete_command(DELAY_NOTREADY);
|
wd17xx_complete_command(DELAY_NOTREADY);
|
||||||
@ -1519,7 +1518,7 @@ WRITE8_MEMBER( wd1770_device::command_w )
|
|||||||
/* update track reg */
|
/* update track reg */
|
||||||
m_track += m_direction;
|
m_track += m_direction;
|
||||||
|
|
||||||
floppy_drive_seek(m_drive, m_direction);
|
m_drive->floppy_drive_seek(m_direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* simulate seek time busy signal */
|
/* simulate seek time busy signal */
|
||||||
@ -1541,7 +1540,7 @@ WRITE8_MEMBER( wd1770_device::command_w )
|
|||||||
/* simulate seek time busy signal */
|
/* simulate seek time busy signal */
|
||||||
m_busy_count = 0; //((data & FDC_STEP_RATE) + 1);
|
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)
|
if (data & FDC_STEP_UPDATE)
|
||||||
m_track += m_direction;
|
m_track += m_direction;
|
||||||
@ -1564,7 +1563,7 @@ WRITE8_MEMBER( wd1770_device::command_w )
|
|||||||
/* simulate seek time busy signal */
|
/* simulate seek time busy signal */
|
||||||
m_busy_count = 0; //((data & FDC_STEP_RATE) + 1);
|
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)
|
if (data & FDC_STEP_UPDATE)
|
||||||
m_track += m_direction;
|
m_track += m_direction;
|
||||||
@ -1586,7 +1585,7 @@ WRITE8_MEMBER( wd1770_device::command_w )
|
|||||||
m_busy_count = 0; //((data & FDC_STEP_RATE) + 1);
|
m_busy_count = 0; //((data & FDC_STEP_RATE) + 1);
|
||||||
|
|
||||||
/* for now only allows a single drive to be selected */
|
/* 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)
|
if (data & FDC_STEP_UPDATE)
|
||||||
m_track += m_direction;
|
m_track += m_direction;
|
||||||
@ -2045,14 +2044,14 @@ void wd1770_device::device_reset()
|
|||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
if(m_intf->floppy_drive_tags[i]!=NULL) {
|
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) {
|
if (img!=NULL) {
|
||||||
floppy_drive_set_controller(img,this);
|
img->floppy_drive_set_controller(this);
|
||||||
floppy_drive_set_index_pulse_callback(img, wd17xx_index_pulse_callback);
|
img->floppy_drive_set_index_pulse_callback(wd17xx_index_pulse_callback);
|
||||||
floppy_drive_set_rpm( img, 300.);
|
img->floppy_drive_set_rpm( 300.);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
#ifndef __WD17XX_H__
|
#ifndef __WD17XX_H__
|
||||||
#define __WD17XX_H__
|
#define __WD17XX_H__
|
||||||
|
|
||||||
|
#include "imagedev/flopdrv.h"
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
TYPE DEFINITIONS
|
TYPE DEFINITIONS
|
||||||
@ -165,7 +167,7 @@ protected:
|
|||||||
emu_timer *m_timer_cmd, *m_timer_data, *m_timer_rs, *m_timer_ws;
|
emu_timer *m_timer_cmd, *m_timer_data, *m_timer_rs, *m_timer_ws;
|
||||||
|
|
||||||
/* this is the drive currently selected */
|
/* this is the drive currently selected */
|
||||||
device_t *m_drive;
|
legacy_floppy_image_device *m_drive;
|
||||||
|
|
||||||
/* this is the head currently selected */
|
/* this is the head currently selected */
|
||||||
UINT8 m_hd;
|
UINT8 m_hd;
|
||||||
|
@ -260,9 +260,9 @@ WRITE8_MEMBER( apf_state::apf_dischw_w)
|
|||||||
|
|
||||||
m_fdc->set_drive(drive);
|
m_fdc->set_drive(drive);
|
||||||
floppy_image_legacy *floppy;
|
floppy_image_legacy *floppy;
|
||||||
floppy = flopimg_get_image(floppy_get_device(machine(), drive));
|
floppy = floppy_get_device(machine(), drive)->flopimg_get_image();
|
||||||
floppy_mon_w(floppy_get_device(machine(), drive), (floppy != NULL) ? 0 : 1);
|
floppy_get_device(machine(), drive)->floppy_mon_w((floppy != NULL) ? 0 : 1);
|
||||||
floppy_drive_set_ready_state(floppy_get_device(machine(), drive), (floppy != NULL) ? 1 : 0,0);
|
floppy_get_device(machine(), drive)->floppy_drive_set_ready_state((floppy != NULL) ? 1 : 0,0);
|
||||||
|
|
||||||
|
|
||||||
logerror("disc w %04x %04x\n",offset,data);
|
logerror("disc w %04x %04x\n",offset,data);
|
||||||
|
@ -492,8 +492,8 @@ WRITE8_MEMBER(fm7_state::fm7_fdc_w)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_fdc->set_drive(data & 0x03);
|
m_fdc->set_drive(data & 0x03);
|
||||||
floppy_mon_w(floppy_get_device(machine(), data & 0x03), !BIT(data, 7));
|
floppy_get_device(machine(), data & 0x03)->floppy_mon_w(!BIT(data, 7));
|
||||||
floppy_drive_set_ready_state(floppy_get_device(machine(), data & 0x03), data & 0x80,0);
|
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);
|
logerror("FDC: wrote %02x to 0x%04x (drive)\n",data,offset+0xfd18);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -127,10 +127,10 @@ INPUT_PORTS_END
|
|||||||
|
|
||||||
void mbc200_state::machine_start()
|
void mbc200_state::machine_start()
|
||||||
{
|
{
|
||||||
floppy_mon_w(m_floppy0, CLEAR_LINE);
|
m_floppy0->floppy_mon_w(CLEAR_LINE);
|
||||||
floppy_mon_w(m_floppy1, CLEAR_LINE);
|
m_floppy1->floppy_mon_w(CLEAR_LINE);
|
||||||
floppy_drive_set_ready_state(m_floppy0, 1, 1);
|
m_floppy0->floppy_drive_set_ready_state(1, 1);
|
||||||
floppy_drive_set_ready_state(m_floppy1, 1, 1);
|
m_floppy1->floppy_drive_set_ready_state(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
MC6845_UPDATE_ROW( mbc200_update_row )
|
MC6845_UPDATE_ROW( mbc200_update_row )
|
||||||
|
@ -126,7 +126,7 @@ void ms0515_state::machine_reset()
|
|||||||
m_video_ram = ram + 0000000 + 0340000;
|
m_video_ram = ram + 0000000 + 0340000;
|
||||||
m_blink = 0;
|
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 */
|
/* Input ports */
|
||||||
|
@ -127,8 +127,8 @@ WRITE8_MEMBER( myb3k_state::myb3k_fdc_output_w )
|
|||||||
{
|
{
|
||||||
/* TODO: complete guesswork! (it just does a 0x24 -> 0x20 in there) */
|
/* TODO: complete guesswork! (it just does a 0x24 -> 0x20 in there) */
|
||||||
m_fdc->set_drive(data & 3);
|
m_fdc->set_drive(data & 3);
|
||||||
floppy_mon_w(floppy_get_device(machine(), data & 3), !(data & 4) ? 1: 0);
|
floppy_get_device(machine(), data & 3)->floppy_mon_w(!(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_drive_set_ready_state(data & 0x4,0);
|
||||||
//m_fdc->set_side((data & 0x10)>>4);
|
//m_fdc->set_side((data & 0x10)>>4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,8 +360,8 @@ WRITE8_MEMBER(mz2000_state::mz2000_fdc_w)
|
|||||||
{
|
{
|
||||||
case 0xdc:
|
case 0xdc:
|
||||||
m_mb8877a->set_drive(data & 3);
|
m_mb8877a->set_drive(data & 3);
|
||||||
floppy_mon_w(floppy_get_device(machine(), data & 3), (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
|
floppy_get_device(machine(), data & 3)->floppy_mon_w((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_drive_set_ready_state(1,0);
|
||||||
break;
|
break;
|
||||||
case 0xdd:
|
case 0xdd:
|
||||||
m_mb8877a->set_side((data & 1));
|
m_mb8877a->set_side((data & 1));
|
||||||
|
@ -1190,8 +1190,8 @@ WRITE8_MEMBER(mz2500_state::mz2500_fdc_w)
|
|||||||
{
|
{
|
||||||
case 0xdc:
|
case 0xdc:
|
||||||
fdc->set_drive(data & 3);
|
fdc->set_drive(data & 3);
|
||||||
floppy_mon_w(floppy_get_device(machine(), data & 3), (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
|
floppy_get_device(machine(), data & 3)->floppy_mon_w((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_drive_set_ready_state(1,0);
|
||||||
break;
|
break;
|
||||||
case 0xdd:
|
case 0xdd:
|
||||||
fdc->set_side((data & 1));
|
fdc->set_side((data & 1));
|
||||||
|
@ -326,7 +326,7 @@ private:
|
|||||||
virtual void machine_reset();
|
virtual void machine_reset();
|
||||||
|
|
||||||
int m_unit;
|
int m_unit;
|
||||||
device_t *m_image[4];
|
legacy_floppy_image_device *m_image[4];
|
||||||
|
|
||||||
int m_irq_high;
|
int m_irq_high;
|
||||||
UINT32 m_irq_mask;
|
UINT32 m_irq_mask;
|
||||||
@ -335,10 +335,10 @@ private:
|
|||||||
|
|
||||||
void rainbow_state::machine_start()
|
void rainbow_state::machine_start()
|
||||||
{
|
{
|
||||||
m_image[0] = subdevice(FLOPPY_0);
|
m_image[0] = subdevice<legacy_floppy_image_device>(FLOPPY_0);
|
||||||
m_image[1] = subdevice(FLOPPY_1);
|
m_image[1] = subdevice<legacy_floppy_image_device>(FLOPPY_1);
|
||||||
m_image[2] = subdevice(FLOPPY_2);
|
m_image[2] = subdevice<legacy_floppy_image_device>(FLOPPY_2);
|
||||||
m_image[3] = subdevice(FLOPPY_3);
|
m_image[3] = subdevice<legacy_floppy_image_device>(FLOPPY_3);
|
||||||
|
|
||||||
COLD_BOOT = 1;
|
COLD_BOOT = 1;
|
||||||
|
|
||||||
@ -863,9 +863,9 @@ D0 : ZFLIP L: (read from the diagnostic control register of Z80A)
|
|||||||
NOTES: ALL LOW ACTIVE - EXCEPT TR00
|
NOTES: ALL LOW ACTIVE - EXCEPT TR00
|
||||||
*/
|
*/
|
||||||
// * TRACK 00 * signal for current drive
|
// * 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)
|
int data=( 0x80 | // (STEP L)
|
||||||
// ( (fdc_write_gate) ) |
|
// ( (fdc_write_gate) ) |
|
||||||
@ -958,7 +958,7 @@ WRITE8_MEMBER(rainbow_state::z80_diskcontrol_w)
|
|||||||
|
|
||||||
int selected_drive = 255;
|
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;
|
{ selected_drive = drive;
|
||||||
m_fdc->set_drive(selected_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:
|
// Although 1773 does not feature 'motor on' this statement is required:
|
||||||
// CLEAR_LINE = turn motor on -
|
// 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
|
// 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) ? 1 : 0,
|
||||||
(f_num == selected_drive) ? force_ready : 0
|
(f_num == selected_drive) ? force_ready : 0
|
||||||
);
|
);
|
||||||
|
@ -389,9 +389,9 @@ void smc777_state::check_floppy_inserted()
|
|||||||
/* FIXME: floppy drive 1 doesn't work? */
|
/* FIXME: floppy drive 1 doesn't work? */
|
||||||
for(f_num=0;f_num<2;f_num++)
|
for(f_num=0;f_num<2;f_num++)
|
||||||
{
|
{
|
||||||
floppy = flopimg_get_image(floppy_get_device(machine(), f_num));
|
floppy = floppy_get_device(machine(), f_num)->flopimg_get_image();
|
||||||
floppy_mon_w(floppy_get_device(machine(), f_num), (floppy != NULL) ? 0 : 1);
|
floppy_get_device(machine(), f_num)->floppy_mon_w((floppy != NULL) ? 0 : 1);
|
||||||
floppy_drive_set_ready_state(floppy_get_device(machine(), f_num), (floppy != NULL) ? 1 : 0,0);
|
floppy_get_device(machine(), f_num)->floppy_drive_set_ready_state((floppy != NULL) ? 1 : 0,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -566,22 +566,22 @@ INPUT_PORTS_END
|
|||||||
|
|
||||||
WRITE_LINE_MEMBER( thomson_state::fdc_index_0_w )
|
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 )
|
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 )
|
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 )
|
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 =
|
static const floppy_interface thomson_floppy_interface_0 =
|
||||||
|
@ -117,7 +117,7 @@ WRITE16_MEMBER( unixpc_state::disk_control_w )
|
|||||||
{
|
{
|
||||||
logerror("disk_control_w: %04x\n", data);
|
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
|
// bit 6 = floppy selected / not selected
|
||||||
m_wd2797->set_drive(0);
|
m_wd2797->set_drive(0);
|
||||||
|
@ -669,7 +669,7 @@ DRIVER_INIT_MEMBER(vtech1_state,vtech1)
|
|||||||
|
|
||||||
for(id=0;id<2;id++)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1037,8 +1037,8 @@ WRITE8_MEMBER( x1_state::x1_fdc_w )
|
|||||||
break;
|
break;
|
||||||
case 0x0ffc:
|
case 0x0ffc:
|
||||||
m_fdc->set_drive(data & 3);
|
m_fdc->set_drive(data & 3);
|
||||||
floppy_mon_w(floppy_get_device(machine(), data & 3), !BIT(data, 7));
|
floppy_get_device(machine(), data & 3)->floppy_mon_w(!BIT(data, 7));
|
||||||
floppy_drive_set_ready_state(floppy_get_device(machine(), data & 3), data & 0x80,0);
|
floppy_get_device(machine(), data & 3)->floppy_drive_set_ready_state(data & 0x80,0);
|
||||||
m_fdc->set_side(BIT(data, 4));
|
m_fdc->set_side(BIT(data, 4));
|
||||||
break;
|
break;
|
||||||
case 0x0ffd:
|
case 0x0ffd:
|
||||||
|
@ -380,8 +380,8 @@ WRITE8_MEMBER( z100_state::z207_fdc_w )
|
|||||||
m_z207_cur_drive = data & 3;
|
m_z207_cur_drive = data & 3;
|
||||||
break;
|
break;
|
||||||
case 5: // aux control
|
case 5: // aux control
|
||||||
floppy_mon_w(floppy_get_device(machine(), m_z207_cur_drive), !BIT(data, 1));
|
floppy_get_device(machine(), m_z207_cur_drive)->floppy_mon_w(!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_drive_set_ready_state(data & 2,0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,7 @@ public:
|
|||||||
WRITE_LINE_MEMBER( fdc_index_1_w );
|
WRITE_LINE_MEMBER( fdc_index_1_w );
|
||||||
WRITE_LINE_MEMBER( fdc_index_2_w );
|
WRITE_LINE_MEMBER( fdc_index_2_w );
|
||||||
WRITE_LINE_MEMBER( fdc_index_3_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);
|
DECLARE_PALETTE_INIT(thom);
|
||||||
|
|
||||||
optional_device<mc6854_device> m_mc6854;
|
optional_device<mc6854_device> m_mc6854;
|
||||||
@ -519,26 +519,26 @@ protected:
|
|||||||
unsigned to7_lightpen_gpl( int decx, int decy );
|
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_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_sector( legacy_floppy_image_device* 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_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_addr( int sector, UINT8* dst );
|
||||||
int thom_qdd_make_sector( device_t* img, int sector, UINT8* dst );
|
int thom_qdd_make_sector( legacy_floppy_image_device* img, int sector, UINT8* dst );
|
||||||
int thom_qdd_make_disk ( device_t* img, UINT8* dst );
|
int thom_qdd_make_disk ( legacy_floppy_image_device* img, UINT8* dst );
|
||||||
void to7_5p14_reset();
|
void to7_5p14_reset();
|
||||||
void to7_5p14_init();
|
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_reset();
|
||||||
void to7_5p14sd_init();
|
void to7_5p14sd_init();
|
||||||
void to7_qdd_index_pulse_cb( device_t *controller,device_t *image, int state );
|
void to7_qdd_index_pulse_cb( device_t *controller,legacy_floppy_image_device *image, int state );
|
||||||
device_t * to7_qdd_image();
|
legacy_floppy_image_device * to7_qdd_image();
|
||||||
void to7_qdd_stat_update();
|
void to7_qdd_stat_update();
|
||||||
UINT8 to7_qdd_read_byte();
|
UINT8 to7_qdd_read_byte();
|
||||||
void to7_qdd_write_byte( UINT8 data );
|
void to7_qdd_write_byte( UINT8 data );
|
||||||
void to7_qdd_reset();
|
void to7_qdd_reset();
|
||||||
void to7_qdd_init();
|
void to7_qdd_init();
|
||||||
device_t * thmfc_floppy_image();
|
legacy_floppy_image_device * thmfc_floppy_image();
|
||||||
int thmfc_floppy_is_qdd( device_image_interface *image );
|
int thmfc_floppy_is_qdd( legacy_floppy_image_device *image );
|
||||||
void thmfc_floppy_index_pulse_cb( device_t *controller,device_t *image, int state );
|
void thmfc_floppy_index_pulse_cb( device_t *controller,legacy_floppy_image_device *image, int state );
|
||||||
int thmfc_floppy_find_sector( chrn_id* dst );
|
int thmfc_floppy_find_sector( chrn_id* dst );
|
||||||
void thmfc_floppy_cmd_complete();
|
void thmfc_floppy_cmd_complete();
|
||||||
UINT8 thmfc_floppy_read_byte();
|
UINT8 thmfc_floppy_read_byte();
|
||||||
|
@ -27,13 +27,13 @@ INLINE apple525_floppy_image_device *get_device(device_t *device)
|
|||||||
|
|
||||||
static int apple525_enable_mask = 1;
|
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) {
|
switch(drive) {
|
||||||
case 0 : return device->subdevice(PARENT_FLOPPY_0);
|
case 0 : return device->subdevice<legacy_floppy_image_device>(PARENT_FLOPPY_0);
|
||||||
case 1 : return device->subdevice(PARENT_FLOPPY_1);
|
case 1 : return device->subdevice<legacy_floppy_image_device>(PARENT_FLOPPY_1);
|
||||||
case 2 : return device->subdevice(PARENT_FLOPPY_2);
|
case 2 : return device->subdevice<legacy_floppy_image_device>(PARENT_FLOPPY_2);
|
||||||
case 3 : return device->subdevice(PARENT_FLOPPY_3);
|
case 3 : return device->subdevice<legacy_floppy_image_device>(PARENT_FLOPPY_3);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -43,8 +43,8 @@ device_t *apple525_get_device_by_type(device_t *device, int ftype, int drive)
|
|||||||
int i;
|
int i;
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
for (i=0;i<4;i++) {
|
for (i=0;i<4;i++) {
|
||||||
device_t *disk = apple525_get_subdevice(device, i);
|
legacy_floppy_image_device *disk = apple525_get_subdevice(device, i);
|
||||||
if (floppy_get_drive_type(disk)==ftype) {
|
if (disk->floppy_get_drive_type()==ftype) {
|
||||||
if (cnt==drive) {
|
if (cnt==drive) {
|
||||||
return disk;
|
return disk;
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ static void apple525_load_current_track(device_t *image)
|
|||||||
disk = get_device(image);
|
disk = get_device(image);
|
||||||
len = sizeof(disk->track_data);
|
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_loaded = 1;
|
||||||
disk->track_dirty = 0;
|
disk->track_dirty = 0;
|
||||||
}
|
}
|
||||||
@ -84,14 +84,14 @@ static void apple525_save_current_track(device_t *image, int unload)
|
|||||||
if (disk->track_dirty)
|
if (disk->track_dirty)
|
||||||
{
|
{
|
||||||
len = sizeof(disk->track_data);
|
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;
|
disk->track_dirty = 0;
|
||||||
}
|
}
|
||||||
if (unload)
|
if (unload)
|
||||||
disk->track_loaded = 0;
|
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 track;
|
||||||
int pseudo_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);
|
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 = (track * 2) + disk->tween_tracks;
|
||||||
|
|
||||||
pseudo_track += step;
|
pseudo_track += step;
|
||||||
@ -112,7 +112,7 @@ static void apple525_seek_disk(device_t *img, signed int step)
|
|||||||
|
|
||||||
if (pseudo_track/2 != track)
|
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;
|
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;
|
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)
|
if (cur_disk->tween_tracks)
|
||||||
phase--;
|
phase--;
|
||||||
phase %= 4;
|
phase %= 4;
|
||||||
@ -152,10 +152,10 @@ static void apple525_disk_set_lines(device_t *device,device_t *image, UINT8 new_
|
|||||||
switch(phase)
|
switch(phase)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
apple525_seek_disk(image, +1);
|
apple525_seek_disk(cur_disk, +1);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
apple525_seek_disk(image, -1);
|
apple525_seek_disk(cur_disk, -1);
|
||||||
break;
|
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 apple525_get_count(device_t *device)
|
||||||
{
|
{
|
||||||
int cnt = 0;
|
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_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) && (floppy_get_drive_type(device->subdevice("^"FLOPPY_1)) == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_1))!=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) && (floppy_get_drive_type(device->subdevice("^"FLOPPY_2)) == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_2))!=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) && (floppy_get_drive_type(device->subdevice("^"FLOPPY_3)) == FLOPPY_TYPE_APPLE) && (get_device(device->subdevice(PARENT_FLOPPY_3))!=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;
|
return cnt;
|
||||||
}
|
}
|
||||||
@ -307,7 +307,7 @@ apple525_floppy_image_device::apple525_floppy_image_device(const machine_config
|
|||||||
void apple525_floppy_image_device::device_start()
|
void apple525_floppy_image_device::device_start()
|
||||||
{
|
{
|
||||||
legacy_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;
|
state = 0;
|
||||||
tween_tracks = 0;
|
tween_tracks = 0;
|
||||||
@ -321,8 +321,8 @@ void apple525_floppy_image_device::device_start()
|
|||||||
bool apple525_floppy_image_device::call_load()
|
bool apple525_floppy_image_device::call_load()
|
||||||
{
|
{
|
||||||
int result = legacy_floppy_image_device::call_load();
|
int result = legacy_floppy_image_device::call_load();
|
||||||
floppy_drive_seek(*this, -999);
|
floppy_drive_seek(-999);
|
||||||
floppy_drive_seek(*this, +35/2);
|
floppy_drive_seek(+35/2);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "atarifdc.h"
|
#include "atarifdc.h"
|
||||||
#include "sound/pokey.h"
|
#include "sound/pokey.h"
|
||||||
#include "machine/6821pia.h"
|
#include "machine/6821pia.h"
|
||||||
#include "imagedev/flopdrv.h"
|
|
||||||
#include "formats/atari_dsk.h"
|
#include "formats/atari_dsk.h"
|
||||||
|
|
||||||
#define VERBOSE_SERIAL 0
|
#define VERBOSE_SERIAL 0
|
||||||
@ -746,13 +745,13 @@ static MACHINE_CONFIG_FRAGMENT( atari_fdc )
|
|||||||
MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(atari_floppy_interface)
|
MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(atari_floppy_interface)
|
||||||
MACHINE_CONFIG_END
|
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) {
|
switch(drive) {
|
||||||
case 0 : return subdevice(FLOPPY_0);
|
case 0 : return subdevice<legacy_floppy_image_device>(FLOPPY_0);
|
||||||
case 1 : return subdevice(FLOPPY_1);
|
case 1 : return subdevice<legacy_floppy_image_device>(FLOPPY_1);
|
||||||
case 2 : return subdevice(FLOPPY_2);
|
case 2 : return subdevice<legacy_floppy_image_device>(FLOPPY_2);
|
||||||
case 3 : return subdevice(FLOPPY_3);
|
case 3 : return subdevice<legacy_floppy_image_device>(FLOPPY_3);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -786,7 +785,7 @@ void atari_fdc_device::device_start()
|
|||||||
|
|
||||||
for(id=0;id<4;id++)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#ifndef _ATARIFDC_H
|
#ifndef _ATARIFDC_H
|
||||||
#define _ATARIFDC_H
|
#define _ATARIFDC_H
|
||||||
|
|
||||||
|
#include "imagedev/flopdrv.h"
|
||||||
|
|
||||||
class atari_fdc_device : public device_t
|
class atari_fdc_device : public device_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -28,7 +30,7 @@ private:
|
|||||||
void add_serin(UINT8 data, int with_checksum);
|
void add_serin(UINT8 data, int with_checksum);
|
||||||
void a800_serial_command();
|
void a800_serial_command();
|
||||||
void a800_serial_write();
|
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
|
struct atari_drive
|
||||||
{
|
{
|
||||||
|
@ -158,9 +158,9 @@ WRITE8_MEMBER(beta_disk_device::param_w)
|
|||||||
}
|
}
|
||||||
// bit 3 connected to pin 23 "HRDY" of FDC
|
// bit 3 connected to pin 23 "HRDY" of FDC
|
||||||
// TEMP HACK, FDD motor and RDY FDC pin controlled by HLD pin 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]);
|
legacy_floppy_image_device *flop = subdevice<legacy_floppy_image_device>(beta_wd17xx_interface.floppy_drive_tags[data & 3]);
|
||||||
floppy_mon_w(flop, CLEAR_LINE);
|
flop->floppy_mon_w(CLEAR_LINE);
|
||||||
floppy_drive_set_ready_state(flop, 1, 0);
|
flop->floppy_drive_set_ready_state(1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
// 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;*/
|
/*flp_8in = (data & LC_FLP8IN_mask) != 0;*/
|
||||||
m_wd179x->dden_w(BIT(data, 7));
|
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;
|
break;
|
||||||
|
|
||||||
case 8: // FDC COMMAMD REG
|
case 8: // FDC COMMAMD REG
|
||||||
|
@ -107,11 +107,11 @@ void hec2hrp_state::hector_minidisc_init()
|
|||||||
fdc->dden_w(1);// density select => always 1 (0 ?a plante !)
|
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 */
|
/* 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_get_device(machine(), 0)->floppy_mon_w( 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(), 1)->floppy_mon_w(BIT(data, 7)); // Moteur floppy B:, not implanted on the real machine
|
||||||
|
|
||||||
//Set the drive ready !
|
//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 !
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ BE02 and BE03 - read data, write data
|
|||||||
|
|
||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "imagedev/flopdrv.h"
|
|
||||||
#include "machine/micropolis.h"
|
#include "machine/micropolis.h"
|
||||||
|
|
||||||
|
|
||||||
@ -162,15 +161,15 @@ void micropolis_device::device_reset()
|
|||||||
{
|
{
|
||||||
if(m_floppy_drive_tags[i])
|
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)
|
if (img)
|
||||||
{
|
{
|
||||||
floppy_drive_set_controller(img, this);
|
img->floppy_drive_set_controller(this);
|
||||||
//floppy_drive_set_index_pulse_callback(img, wd17xx_index_pulse_callback);
|
//img->floppy_drive_set_index_pulse_callback( wd17xx_index_pulse_callback);
|
||||||
floppy_drive_set_rpm( img, 300.);
|
img->floppy_drive_set_rpm( 300.);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,7 +196,7 @@ void micropolis_device::read_sector()
|
|||||||
m_data_count = m_sector_length;
|
m_data_count = m_sector_length;
|
||||||
|
|
||||||
/* read data */
|
/* 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;
|
m_data_count = m_sector_length;
|
||||||
|
|
||||||
/* write data */
|
/* 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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,7 +230,7 @@ void micropolis_device::set_drive(UINT8 drive)
|
|||||||
logerror("micropolis_set_drive: $%02x\n", drive);
|
logerror("micropolis_set_drive: $%02x\n", drive);
|
||||||
|
|
||||||
if (m_floppy_drive_tags[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:
|
case 1:
|
||||||
m_drive_num = data & 3;
|
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
|
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;
|
break;
|
||||||
case 2: // not emulated, not used in sorcerer
|
case 2: // not emulated, not used in sorcerer
|
||||||
break;
|
break;
|
||||||
@ -323,13 +322,13 @@ Command (bits 5,6,7) Options (bits 0,1,2,3,4)
|
|||||||
if (BIT(data, 5))
|
if (BIT(data, 5))
|
||||||
m_status |= STAT_READY;
|
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)
|
if (!m_track)
|
||||||
m_status |= STAT_TRACK0;
|
m_status |= STAT_TRACK0;
|
||||||
|
|
||||||
floppy_drive_seek(m_drive, direction);
|
m_drive->floppy_drive_seek(direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#define __MICROPOLIS_H__
|
#define __MICROPOLIS_H__
|
||||||
|
|
||||||
#include "devcb.h"
|
#include "devcb.h"
|
||||||
|
#include "imagedev/flopdrv.h"
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -88,7 +89,7 @@ private:
|
|||||||
UINT32 m_sector_length; /* sector length (byte) */
|
UINT32 m_sector_length; /* sector length (byte) */
|
||||||
|
|
||||||
/* this is the drive currently selected */
|
/* this is the drive currently selected */
|
||||||
device_t *m_drive;
|
legacy_floppy_image_device *m_drive;
|
||||||
|
|
||||||
void read_sector();
|
void read_sector();
|
||||||
void write_sector();
|
void write_sector();
|
||||||
|
@ -962,8 +962,8 @@ DRIVER_INIT_MEMBER(nes_state,famicom)
|
|||||||
m_fds_ram = auto_alloc_array_clear(machine(), UINT8, 0x8000);
|
m_fds_ram = auto_alloc_array_clear(machine(), UINT8, 0x8000);
|
||||||
save_pointer(NAME(m_fds_ram), 0x8000);
|
save_pointer(NAME(m_fds_ram), 0x8000);
|
||||||
|
|
||||||
floppy_install_load_proc(floppy_get_device(machine(), 0), nes_load_proc);
|
floppy_get_device(machine(), 0)->floppy_install_load_proc(nes_load_proc);
|
||||||
floppy_install_unload_proc(floppy_get_device(machine(), 0), nes_unload_proc);
|
floppy_get_device(machine(), 0)->floppy_install_unload_proc(nes_unload_proc);
|
||||||
|
|
||||||
// setup alt input handlers for additional FC input devices
|
// setup alt input handlers for additional FC input devices
|
||||||
address_space &space = machine().device<cpu_device>("maincpu")->space(AS_PROGRAM);
|
address_space &space = machine().device<cpu_device>("maincpu")->space(AS_PROGRAM);
|
||||||
|
@ -429,7 +429,7 @@ void osborne1_state::machine_reset()
|
|||||||
memset( m_ram->pointer() + 0x10000, 0xFF, 0x1000 );
|
memset( m_ram->pointer() + 0x10000, 0xFF, 0x1000 );
|
||||||
|
|
||||||
for(drive=0;drive<2;drive++)
|
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));
|
space.set_direct_update_handler(direct_update_delegate(FUNC(osborne1_state::osborne1_opbase), this));
|
||||||
}
|
}
|
||||||
|
@ -100,17 +100,17 @@ WRITE8_MEMBER(partner_state::partner_floppy_w){
|
|||||||
default : m_fdc->data_w(space, 0,data);break;
|
default : m_fdc->data_w(space, 0,data);break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
floppy_mon_w(floppy_get_device(machine(), 0), 1);
|
floppy_get_device(machine(), 0)->floppy_mon_w(1);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 1), 1);
|
floppy_get_device(machine(), 1)->floppy_mon_w(1);
|
||||||
if (((data >> 6) & 1)==1) {
|
if (((data >> 6) & 1)==1) {
|
||||||
m_fdc->set_drive(0);
|
m_fdc->set_drive(0);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 0), 0);
|
floppy_get_device(machine(), 0)->floppy_mon_w(0);
|
||||||
floppy_drive_set_ready_state(floppy_get_device(machine(), 0), 1, 1);
|
floppy_get_device(machine(), 0)->floppy_drive_set_ready_state(1, 1);
|
||||||
}
|
}
|
||||||
if (((data >> 3) & 1)==1) {
|
if (((data >> 3) & 1)==1) {
|
||||||
m_fdc->set_drive(1);
|
m_fdc->set_drive(1);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 1), 0);
|
floppy_get_device(machine(), 1)->floppy_mon_w(0);
|
||||||
floppy_drive_set_ready_state(floppy_get_device(machine(), 1), 1, 1);
|
floppy_get_device(machine(), 1)->floppy_drive_set_ready_state(1, 1);
|
||||||
}
|
}
|
||||||
m_fdc->set_side(data >> 7);
|
m_fdc->set_side(data >> 7);
|
||||||
}
|
}
|
||||||
|
@ -840,27 +840,27 @@ WRITE8_MEMBER(pk8020_state::pk8020_portc_w)
|
|||||||
WRITE8_MEMBER(pk8020_state::pk8020_portb_w)
|
WRITE8_MEMBER(pk8020_state::pk8020_portb_w)
|
||||||
{
|
{
|
||||||
// Turn all motors off
|
// Turn all motors off
|
||||||
floppy_mon_w(floppy_get_device(machine(), 0), 1);
|
floppy_get_device(machine(), 0)->floppy_mon_w(1);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 1), 1);
|
floppy_get_device(machine(), 1)->floppy_mon_w(1);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 2), 1);
|
floppy_get_device(machine(), 2)->floppy_mon_w(1);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 3), 1);
|
floppy_get_device(machine(), 3)->floppy_mon_w(1);
|
||||||
m_wd1793->set_side(BIT(data,4));
|
m_wd1793->set_side(BIT(data,4));
|
||||||
if (BIT(data,0)) {
|
if (BIT(data,0)) {
|
||||||
m_wd1793->set_drive(0);
|
m_wd1793->set_drive(0);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 0), 0);
|
floppy_get_device(machine(), 0)->floppy_mon_w(0);
|
||||||
floppy_drive_set_ready_state(floppy_get_device(machine(), 0), 1, 1);
|
floppy_get_device(machine(), 0)->floppy_drive_set_ready_state(1, 1);
|
||||||
} else if (BIT(data,1)) {
|
} else if (BIT(data,1)) {
|
||||||
m_wd1793->set_drive(1);
|
m_wd1793->set_drive(1);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 1), 0);
|
floppy_get_device(machine(), 1)->floppy_mon_w(0);
|
||||||
floppy_drive_set_ready_state(floppy_get_device(machine(), 1), 1, 1);
|
floppy_get_device(machine(), 1)->floppy_drive_set_ready_state(1, 1);
|
||||||
} else if (BIT(data,2)) {
|
} else if (BIT(data,2)) {
|
||||||
m_wd1793->set_drive(2);
|
m_wd1793->set_drive(2);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 2), 0);
|
floppy_get_device(machine(), 2)->floppy_mon_w(0);
|
||||||
floppy_drive_set_ready_state(floppy_get_device(machine(), 2), 1, 1);
|
floppy_get_device(machine(), 2)->floppy_drive_set_ready_state(1, 1);
|
||||||
} else if (BIT(data,3)) {
|
} else if (BIT(data,3)) {
|
||||||
m_wd1793->set_drive(3);
|
m_wd1793->set_drive(3);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 3), 0);
|
floppy_get_device(machine(), 3)->floppy_mon_w(0);
|
||||||
floppy_drive_set_ready_state(floppy_get_device(machine(), 3), 1, 1);
|
floppy_get_device(machine(), 3)->floppy_drive_set_ready_state(1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2274,7 +2274,7 @@ READ8_MEMBER(rmnimbus_state::nimbus_disk_r)
|
|||||||
wd2793_device *fdc = machine().device<wd2793_device>(FDC_TAG);
|
wd2793_device *fdc = machine().device<wd2793_device>(FDC_TAG);
|
||||||
|
|
||||||
int pc=space.device().safe_pc();
|
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)
|
switch(offset*2)
|
||||||
{
|
{
|
||||||
@ -2294,8 +2294,8 @@ READ8_MEMBER(rmnimbus_state::nimbus_disk_r)
|
|||||||
case 0x10 :
|
case 0x10 :
|
||||||
m_nimbus_drives.reg410_in &= ~FDC_BITS_410;
|
m_nimbus_drives.reg410_in &= ~FDC_BITS_410;
|
||||||
m_nimbus_drives.reg410_in |= (FDC_MOTOR() ? FDC_MOTOR_MASKI : 0x00);
|
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 |= (drive->floppy_drive_get_flag_state(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_READY) ? FDC_READY_MASK : 0x00);
|
||||||
|
|
||||||
// Flip inverted bits
|
// Flip inverted bits
|
||||||
result=m_nimbus_drives.reg410_in ^ INV_BITS_410;
|
result=m_nimbus_drives.reg410_in ^ INV_BITS_410;
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "machine/rx01.h"
|
#include "machine/rx01.h"
|
||||||
#include "imagedev/flopdrv.h"
|
|
||||||
#include "formats/basicdsk.h"
|
#include "formats/basicdsk.h"
|
||||||
|
|
||||||
static LEGACY_FLOPPY_OPTIONS_START( rx01 )
|
static LEGACY_FLOPPY_OPTIONS_START( rx01 )
|
||||||
@ -74,8 +73,8 @@ machine_config_constructor rx01_device::device_mconfig_additions() const
|
|||||||
|
|
||||||
void rx01_device::device_start()
|
void rx01_device::device_start()
|
||||||
{
|
{
|
||||||
m_image[0] = subdevice(FLOPPY_0);
|
m_image[0] = subdevice<legacy_floppy_image_device>(FLOPPY_0);
|
||||||
m_image[1] = subdevice(FLOPPY_1);
|
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++)
|
for(int i=0;i<2;i++)
|
||||||
{
|
{
|
||||||
floppy_mon_w(m_image[i], 0); // turn it on
|
m_image[i]->floppy_mon_w(0); // turn it on
|
||||||
floppy_drive_set_controller(m_image[i], this);
|
m_image[i]->floppy_drive_set_controller(this);
|
||||||
floppy_drive_set_rpm(m_image[i], 360.);
|
m_image[i]->floppy_drive_set_rpm(360.);
|
||||||
}
|
}
|
||||||
m_rxes = 0;
|
m_rxes = 0;
|
||||||
m_rxcs = 0;
|
m_rxcs = 0;
|
||||||
@ -128,7 +127,7 @@ void rx01_device::command_write(UINT16 data)
|
|||||||
m_unit = BIT(data,4);
|
m_unit = BIT(data,4);
|
||||||
m_interrupt = BIT(data,6);
|
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
|
if (BIT(data,14)) // Initialize
|
||||||
@ -164,7 +163,7 @@ void rx01_device::command_write(UINT16 data)
|
|||||||
case 7: // Read Error Register
|
case 7: // Read Error Register
|
||||||
m_state = RX01_COMPLETE;
|
m_state = RX01_COMPLETE;
|
||||||
// set ready signal according to current drive status
|
// 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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -195,7 +194,7 @@ UINT16 rx01_device::data_read()
|
|||||||
void rx01_device::service_command()
|
void rx01_device::service_command()
|
||||||
{
|
{
|
||||||
printf("service_command %d\n",m_state);
|
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) {
|
switch(m_state) {
|
||||||
case RX01_FILL :
|
case RX01_FILL :
|
||||||
m_buffer[m_buf_pos] = m_rxdb & 0xff;
|
m_buffer[m_buf_pos] = m_rxdb & 0xff;
|
||||||
@ -241,25 +240,25 @@ void rx01_device::service_command()
|
|||||||
|
|
||||||
void rx01_device::position_head()
|
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;
|
int dir = (cur_track < m_rxta) ? +1 : -1;
|
||||||
|
|
||||||
while (m_rxta != cur_track)
|
while (m_rxta != cur_track)
|
||||||
{
|
{
|
||||||
cur_track += dir;
|
cur_track += dir;
|
||||||
|
|
||||||
floppy_drive_seek(m_image[m_unit], dir);
|
m_image[m_unit]->floppy_drive_seek(dir);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rx01_device::read_sector()
|
void rx01_device::read_sector()
|
||||||
{
|
{
|
||||||
/* read data */
|
/* 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)
|
void rx01_device::write_sector(int ddam)
|
||||||
{
|
{
|
||||||
/* write data */
|
/* 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);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
#ifndef __RX01__
|
#ifndef __RX01__
|
||||||
#define __RX01__
|
#define __RX01__
|
||||||
|
|
||||||
|
#include "imagedev/flopdrv.h"
|
||||||
|
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
// INTERFACE CONFIGURATION MACROS
|
// INTERFACE CONFIGURATION MACROS
|
||||||
//**************************************************************************
|
//**************************************************************************
|
||||||
@ -61,7 +63,7 @@ private:
|
|||||||
RX01_INIT
|
RX01_INIT
|
||||||
};
|
};
|
||||||
|
|
||||||
device_t *m_image[2];
|
legacy_floppy_image_device *m_image[2];
|
||||||
UINT8 m_buffer[128];
|
UINT8 m_buffer[128];
|
||||||
int m_buf_pos;
|
int m_buf_pos;
|
||||||
|
|
||||||
|
@ -103,21 +103,21 @@ static int sony_enable2(void)
|
|||||||
static void load_track_data(device_t *device,int floppy_select)
|
static void load_track_data(device_t *device,int floppy_select)
|
||||||
{
|
{
|
||||||
int track_size;
|
int track_size;
|
||||||
device_image_interface *cur_image;
|
legacy_floppy_image_device *cur_image;
|
||||||
UINT8 *new_data;
|
UINT8 *new_data;
|
||||||
floppy_t *f;
|
floppy_t *f;
|
||||||
|
|
||||||
f = &sony.floppy[floppy_select];
|
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)
|
if (!fimg)
|
||||||
{
|
{
|
||||||
return;
|
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);
|
if (f->loadedtrack_data) auto_free(device->machine(),f->loadedtrack_data);
|
||||||
new_data = auto_alloc_array(device->machine(),UINT8,track_size);
|
new_data = auto_alloc_array(device->machine(),UINT8,track_size);
|
||||||
if (!new_data)
|
if (!new_data)
|
||||||
@ -125,7 +125,7 @@ static void load_track_data(device_t *device,int floppy_select)
|
|||||||
return;
|
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_valid = 1;
|
||||||
f->loadedtrack_dirty = 0;
|
f->loadedtrack_dirty = 0;
|
||||||
f->loadedtrack_size = track_size;
|
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)
|
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;
|
floppy_t *f;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
f = &sony.floppy[floppy_select];
|
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)
|
if (f->loadedtrack_dirty)
|
||||||
{
|
{
|
||||||
len = f->loadedtrack_size;
|
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;
|
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 sony_read_data(device_t *device)
|
||||||
{
|
{
|
||||||
UINT8 result = 0;
|
UINT8 result = 0;
|
||||||
device_image_interface *cur_image;
|
legacy_floppy_image_device *cur_image;
|
||||||
floppy_t *f;
|
floppy_t *f;
|
||||||
|
|
||||||
if (sony_enable2() || (! sony.floppy_enable))
|
if (sony_enable2() || (! sony.floppy_enable))
|
||||||
return 0xFF; /* right ??? */
|
return 0xFF; /* right ??? */
|
||||||
|
|
||||||
f = &sony.floppy[sony.floppy_select];
|
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())
|
if (!cur_image->exists())
|
||||||
return 0xFF;
|
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;
|
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
|
* 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
|
* 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} */
|
439 /* 64-79: timing value ???? (acceptable range {021E-0222} */
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
if (cur_image && image->exists())
|
if (cur_image && cur_image->exists())
|
||||||
result = speeds[floppy_drive_get_current_track(cur_image) / 16];
|
result = speeds[cur_image->floppy_drive_get_current_track() / 16];
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -264,7 +263,7 @@ int sony_read_status(device_t *device)
|
|||||||
int result = 1;
|
int result = 1;
|
||||||
int action;
|
int action;
|
||||||
floppy_t *f;
|
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);
|
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)
|
if ((! sony_enable2()) && sony.floppy_enable)
|
||||||
{
|
{
|
||||||
f = &sony.floppy[sony.floppy_select];
|
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())
|
if (!cur_image->exists())
|
||||||
cur_image = NULL;
|
cur_image = NULL;
|
||||||
|
|
||||||
@ -314,7 +313,7 @@ int sony_read_status(device_t *device)
|
|||||||
break;
|
break;
|
||||||
case 0x06: /* Disk is locked 0=locked 1=unlocked */
|
case 0x06: /* Disk is locked 0=locked 1=unlocked */
|
||||||
if (cur_image)
|
if (cur_image)
|
||||||
result = floppy_wpt_r(&cur_image->device());
|
result = cur_image->floppy_wpt_r();
|
||||||
else
|
else
|
||||||
result = 0;
|
result = 0;
|
||||||
break;
|
break;
|
||||||
@ -324,7 +323,7 @@ int sony_read_status(device_t *device)
|
|||||||
case 0x09: /* Number of sides: 0=single sided, 1=double sided */
|
case 0x09: /* Number of sides: 0=single sided, 1=double sided */
|
||||||
if (cur_image)
|
if (cur_image)
|
||||||
{
|
{
|
||||||
floppy_image_legacy *fimg = flopimg_get_image(&cur_image->device());
|
floppy_image_legacy *fimg = cur_image->flopimg_get_image();
|
||||||
if (fimg)
|
if (fimg)
|
||||||
{
|
{
|
||||||
result = floppy_get_heads_per_disk(fimg) - 1;
|
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 */
|
case 0x0a: /* At track 0: 0=track zero 1=not track zero */
|
||||||
logerror("%s sony.status(): reading Track 0\n", device->machine().describe_context());
|
logerror("%s sony.status(): reading Track 0\n", device->machine().describe_context());
|
||||||
if (cur_image)
|
if (cur_image)
|
||||||
result = floppy_tk00_r(&cur_image->device());
|
result = cur_image->floppy_tk00_r();
|
||||||
else
|
else
|
||||||
result = 0;
|
result = 0;
|
||||||
break;
|
break;
|
||||||
@ -346,7 +345,7 @@ int sony_read_status(device_t *device)
|
|||||||
{
|
{
|
||||||
if (cur_image)
|
if (cur_image)
|
||||||
{
|
{
|
||||||
if (!floppy_dskchg_r(&cur_image->device()))
|
if (!cur_image->floppy_dskchg_r())
|
||||||
{
|
{
|
||||||
f->disk_switched = 1;
|
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) */
|
/* (time in seconds) / (60 sec/minute) * (rounds/minute) * (60 pulses) * (2 pulse phases) */
|
||||||
if (cur_image)
|
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;
|
break;
|
||||||
case 0x0f: /* 400k/800k: Drive installed: 0=drive connected, 1=drive not connected */
|
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;
|
int action;
|
||||||
floppy_t *f;
|
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);
|
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)
|
if (sony.floppy_enable)
|
||||||
{
|
{
|
||||||
f = &sony.floppy[sony.floppy_select];
|
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())
|
if (!cur_image->exists())
|
||||||
cur_image = NULL;
|
cur_image = NULL;
|
||||||
|
|
||||||
@ -433,21 +432,21 @@ static void sony_doaction(device_t *device)
|
|||||||
{
|
{
|
||||||
save_track_data(device,sony.floppy_select);
|
save_track_data(device,sony.floppy_select);
|
||||||
if (f->step)
|
if (f->step)
|
||||||
floppy_drive_seek(&cur_image->device(), -1);
|
cur_image->floppy_drive_seek(-1);
|
||||||
else
|
else
|
||||||
floppy_drive_seek(&cur_image->device(), +1);
|
cur_image->floppy_drive_seek(+1);
|
||||||
f->loadedtrack_valid = 0;
|
f->loadedtrack_valid = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 0x08: /* Turn motor on */
|
case 0x08: /* Turn motor on */
|
||||||
f->motor_on = CLEAR_LINE;
|
f->motor_on = CLEAR_LINE;
|
||||||
if (cur_image)
|
if (cur_image)
|
||||||
floppy_mon_w(&cur_image->device(), f->motor_on);
|
cur_image->floppy_mon_w(f->motor_on);
|
||||||
break;
|
break;
|
||||||
case 0x09: /* Turn motor off */
|
case 0x09: /* Turn motor off */
|
||||||
f->motor_on = ASSERT_LINE;
|
f->motor_on = ASSERT_LINE;
|
||||||
if (cur_image)
|
if (cur_image)
|
||||||
floppy_mon_w(&cur_image->device(), f->motor_on);
|
cur_image->floppy_mon_w(f->motor_on);
|
||||||
break;
|
break;
|
||||||
case 0x0d: /* Eject disk */
|
case 0x0d: /* Eject disk */
|
||||||
if (cur_image)
|
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()
|
void sonydriv_floppy_image_device::device_start()
|
||||||
{
|
{
|
||||||
legacy_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[0].is_fdhd = 0;
|
||||||
sony.floppy[1].is_fdhd = 0;
|
sony.floppy[1].is_fdhd = 0;
|
||||||
|
@ -564,7 +564,7 @@ MACHINE_RESET_MEMBER(svi318_state,svi318)
|
|||||||
|
|
||||||
for(drive=0;drive<2;drive++)
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,21 +154,21 @@ WRITE8_MEMBER ( swtpc09_state::dmf2_control_reg_w )
|
|||||||
case 0x0e:
|
case 0x0e:
|
||||||
m_fdc->set_drive(0);
|
m_fdc->set_drive(0);
|
||||||
// need to set drive ready as sw checks before doing anything
|
// 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;
|
break;
|
||||||
case 0x0d:
|
case 0x0d:
|
||||||
m_fdc->set_drive(1);
|
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;
|
break;
|
||||||
|
|
||||||
case 0x0b:
|
case 0x0b:
|
||||||
m_fdc->set_drive(2);
|
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;
|
break;
|
||||||
|
|
||||||
case 0x07:
|
case 0x07:
|
||||||
m_fdc->set_drive(3);
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -422,21 +422,21 @@ WRITE8_MEMBER ( swtpc09_state::dmf3_control_reg_w )
|
|||||||
case 0x01:
|
case 0x01:
|
||||||
m_fdc->set_drive(0);
|
m_fdc->set_drive(0);
|
||||||
// need to set drive ready as sw checks before doing anything
|
// 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;
|
break;
|
||||||
case 0x02:
|
case 0x02:
|
||||||
m_fdc->set_drive(1);
|
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;
|
break;
|
||||||
|
|
||||||
case 0x04:
|
case 0x04:
|
||||||
m_fdc->set_drive(2);
|
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;
|
break;
|
||||||
|
|
||||||
case 0x08:
|
case 0x08:
|
||||||
m_fdc->set_drive(3);
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -476,21 +476,21 @@ WRITE8_MEMBER ( swtpc09_state::dc4_control_reg_w )
|
|||||||
case 0x00:
|
case 0x00:
|
||||||
m_fdc->set_drive(0);
|
m_fdc->set_drive(0);
|
||||||
// need to set drive ready as sw checks before doing anything
|
// 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;
|
break;
|
||||||
case 0x01:
|
case 0x01:
|
||||||
m_fdc->set_drive(1);
|
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;
|
break;
|
||||||
|
|
||||||
case 0x02:
|
case 0x02:
|
||||||
m_fdc->set_drive(2);
|
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;
|
break;
|
||||||
|
|
||||||
case 0x03:
|
case 0x03:
|
||||||
m_fdc->set_drive(3);
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -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 */
|
/* 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 )
|
if ( sector_size == 128 )
|
||||||
{
|
{
|
||||||
/* single density */
|
/* single density */
|
||||||
memset( dst, 0x00, 6 ); /* synchro bytes */
|
memset( dst, 0x00, 6 ); /* synchro bytes */
|
||||||
dst[ 6 ] = 0xfb; /* data field mark */
|
dst[ 6 ] = 0xfb; /* data field mark */
|
||||||
floppy_drive_read_sector_data
|
img->floppy_drive_read_sector_data
|
||||||
( img, id.H, id.data_id, dst + 7, sector_size );
|
( id.H, id.data_id, dst + 7, sector_size );
|
||||||
dst[ sector_size + 7 ] = 0; /* TODO: CRC */
|
dst[ sector_size + 7 ] = 0; /* TODO: CRC */
|
||||||
dst[ sector_size + 8 ] = 0; /* TODO: CRC */
|
dst[ sector_size + 8 ] = 0; /* TODO: CRC */
|
||||||
memset( dst + sector_size + 9, 0xff, 22 ); /* end mark */
|
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 */
|
/* double density */
|
||||||
memset( dst, 0xa1, 3 ); /* synchro bytes */
|
memset( dst, 0xa1, 3 ); /* synchro bytes */
|
||||||
dst[ 3 ] = 0xfb; /* data field mark */
|
dst[ 3 ] = 0xfb; /* data field mark */
|
||||||
floppy_drive_read_sector_data
|
img->floppy_drive_read_sector_data
|
||||||
( img, id.H, id.data_id, dst + 4, sector_size );
|
( id.H, id.data_id, dst + 4, sector_size );
|
||||||
dst[ sector_size + 4 ] = 0; /* TODO: CRC */
|
dst[ sector_size + 4 ] = 0; /* TODO: CRC */
|
||||||
dst[ sector_size + 5 ] = 0; /* TODO: CRC */
|
dst[ sector_size + 5 ] = 0; /* TODO: CRC */
|
||||||
memset( dst + sector_size + 6, 0xF7, 74 ); /* end mark */
|
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 */
|
/* 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 space = ( sector_size == 128 ) ? 0xff : 0;
|
||||||
UINT8* org = dst;
|
UINT8* org = dst;
|
||||||
@ -154,16 +154,16 @@ int thomson_state::thom_floppy_make_track( device_t* img, UINT8* dst, int sector
|
|||||||
int nb;
|
int nb;
|
||||||
|
|
||||||
/* go to start of track */
|
/* 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for each sector... */
|
/* for each sector... */
|
||||||
for ( nb = 0; nb < 16; nb++ )
|
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;
|
break;
|
||||||
|
|
||||||
memset( dst, space, THOM_SIZE_SYNCHRO ); dst += THOM_SIZE_SYNCHRO;
|
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;
|
memset( dst, space, THOM_SIZE_SYNCHRO ); dst += THOM_SIZE_SYNCHRO;
|
||||||
dst += thom_floppy_make_sector( img, id, dst, sector_size );
|
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;
|
break;
|
||||||
}
|
}
|
||||||
return dst - org;
|
return dst - org;
|
||||||
@ -222,11 +222,11 @@ int thomson_state::thom_qdd_make_addr( int sector, UINT8* dst )
|
|||||||
|
|
||||||
|
|
||||||
/* build a sector, with header */
|
/* 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;
|
int i;
|
||||||
dst[ 0 ] = 0x5a;
|
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;
|
dst[ 129 ] = 0;
|
||||||
for ( i = 0; i < 129; i++ )
|
for ( i = 0; i < 129; i++ )
|
||||||
dst[ 129 ] += dst[ 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 */
|
/* 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;
|
UINT8* org = dst;
|
||||||
int i;
|
int i;
|
||||||
@ -418,7 +418,7 @@ WRITE8_MEMBER( thomson_state::to7_5p14sd_w )
|
|||||||
machine().time().as_double(), m_maincpu->pc(), offset, data );
|
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 );
|
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" ));
|
LOG(( "to7_5p14sd_reset: CD 90-015 controller\n" ));
|
||||||
for ( i = 0; i < floppy_get_count( machine() ); i++ )
|
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) {
|
if (img) {
|
||||||
floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
|
img->floppy_drive_set_ready_state( FLOPPY_DRIVE_READY, 0 );
|
||||||
floppy_drive_set_rpm( img, 300. );
|
img->floppy_drive_set_rpm( 300. );
|
||||||
floppy_drive_seek( img, - floppy_drive_get_current_track( img ) );
|
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;
|
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 );
|
return floppy_get_device( machine(), 0 );
|
||||||
}
|
}
|
||||||
@ -548,7 +548,7 @@ void thomson_state::to7_qdd_stat_update()
|
|||||||
to7qdd->status |= QDD_S_PE;
|
to7qdd->status |= QDD_S_PE;
|
||||||
|
|
||||||
/* write-protect */
|
/* 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;
|
to7qdd->status |= QDD_S_NCTS;
|
||||||
|
|
||||||
/* sticky reset conditions */
|
/* 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",
|
LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n",
|
||||||
machine().time().as_double(), m_maincpu->pc(), sector ));
|
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 );
|
0, sector, 0, 0, sector, 128, filler );
|
||||||
thom_floppy_active( 1 );
|
thom_floppy_active( 1 );
|
||||||
to7qdd->start_idx = to7qdd->data_idx;
|
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",
|
LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n",
|
||||||
machine().time().as_double(), m_maincpu->pc(), sector ));
|
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 );
|
thom_floppy_active( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -825,16 +825,16 @@ void thomson_state::to7_qdd_reset()
|
|||||||
|
|
||||||
for ( i = 0; i < floppy_get_count( machine() ); i++ )
|
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) {
|
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;
|
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 */
|
/* pulse each time the whole-disk spiraling track ends */
|
||||||
/* at 90us per byte read, the disk can be read in 6s */
|
/* 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 );
|
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==NULL) return 0;
|
||||||
if (!image->exists()) 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())
|
if ( image != thmfc_floppy_image())
|
||||||
return;
|
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 */
|
/* 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;
|
thmfc1->ipl = state;
|
||||||
if ( state )
|
if ( state )
|
||||||
{
|
{
|
||||||
@ -962,7 +962,7 @@ void thomson_state::thmfc_floppy_index_pulse_cb ( device_t *controller,device_t
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
floppy_drive_set_rpm( image, 300. );
|
image->floppy_drive_set_rpm( 300. );
|
||||||
thmfc1->ipl = state;
|
thmfc1->ipl = state;
|
||||||
if ( state )
|
if ( state )
|
||||||
thmfc1->data_raw_idx = 0;
|
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 )
|
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;
|
chrn_id id;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
/* scan track, try 4 revolutions */
|
/* scan track, try 4 revolutions */
|
||||||
while ( r < 4 )
|
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 &&
|
if ( id.C == thmfc1->track &&
|
||||||
id.R == thmfc1->sector &&
|
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++;
|
r++;
|
||||||
}
|
}
|
||||||
|
|
||||||
thmfc1->stat0 = THMFC1_STAT0_CRC_ERROR | THMFC1_STAT0_FINISHED;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1017,8 +1017,8 @@ void thomson_state::thmfc_floppy_cmd_complete()
|
|||||||
|
|
||||||
if ( thmfc1->op == THMFC1_OP_WRITE_SECT )
|
if ( thmfc1->op == THMFC1_OP_WRITE_SECT )
|
||||||
{
|
{
|
||||||
device_t * img = thmfc_floppy_image();
|
legacy_floppy_image_device * img = thmfc_floppy_image();
|
||||||
floppy_drive_write_sector_data( img, thmfc1->side, thmfc1->sector_id, thmfc1->data + 3, thmfc1->data_size - 3, 0 );
|
img->floppy_drive_write_sector_data( thmfc1->side, thmfc1->sector_id, thmfc1->data + 3, thmfc1->data_size - 3, 0 );
|
||||||
thom_floppy_active( 1 );
|
thom_floppy_active( 1 );
|
||||||
}
|
}
|
||||||
thmfc1->op = THMFC1_OP_RESET;
|
thmfc1->op = THMFC1_OP_RESET;
|
||||||
@ -1068,7 +1068,7 @@ UINT8 thomson_state::thmfc_floppy_raw_read_byte()
|
|||||||
/* rebuild track if needed */
|
/* rebuild track if needed */
|
||||||
if ( ! thmfc1->data_raw_size )
|
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 */
|
/* QDD: track = whole disk */
|
||||||
thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(), thmfc1->data );
|
thmfc1->data_raw_size = thom_qdd_make_disk ( thmfc_floppy_image(), thmfc1->data );
|
||||||
else
|
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 ));
|
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 );
|
thom_floppy_active( 1 );
|
||||||
thmfc1->data_idx = 0;
|
thmfc1->data_idx = 0;
|
||||||
}
|
}
|
||||||
@ -1158,14 +1158,14 @@ void thomson_state::thmfc_floppy_qdd_write_byte( UINT8 data )
|
|||||||
if ( i >= 0 )
|
if ( i >= 0 )
|
||||||
{
|
{
|
||||||
/* got an id & a data field => write */
|
/* 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 sector = (int) thmfc1->data[ i + 1 ] * 256 +
|
||||||
(int) thmfc1->data[ i + 2 ];
|
(int) thmfc1->data[ i + 2 ];
|
||||||
|
|
||||||
LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: data field, sector=%i\n",
|
LOG(( "%f $%04x thmfc_floppy_qdd_write_byte: data field, sector=%i\n",
|
||||||
machine().time().as_double(), m_maincpu->pc(), sector ));
|
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 );
|
thom_floppy_active( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1218,7 +1218,7 @@ void thomson_state::thmfc_floppy_format_byte( UINT8 data )
|
|||||||
if ( !memcmp ( thmfc1->data, header, sizeof( header ) ) )
|
if ( !memcmp ( thmfc1->data, header, sizeof( header ) ) )
|
||||||
{
|
{
|
||||||
/* got id field => format */
|
/* got id field => format */
|
||||||
device_t * img = thmfc_floppy_image();
|
legacy_floppy_image_device * img = thmfc_floppy_image();
|
||||||
UINT8 track = thmfc1->data[4];
|
UINT8 track = thmfc1->data[4];
|
||||||
UINT8 side = thmfc1->data[5];
|
UINT8 side = thmfc1->data[5];
|
||||||
UINT8 sector = thmfc1->data[6];
|
UINT8 sector = thmfc1->data[6];
|
||||||
@ -1227,7 +1227,7 @@ void thomson_state::thmfc_floppy_format_byte( UINT8 data )
|
|||||||
chrn_id id;
|
chrn_id id;
|
||||||
if ( thmfc_floppy_find_sector( &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 );
|
thom_floppy_active( 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1252,8 +1252,8 @@ READ8_MEMBER( thomson_state::thmfc_floppy_r )
|
|||||||
case 1: /* STAT1 */
|
case 1: /* STAT1 */
|
||||||
{
|
{
|
||||||
UINT8 data = 0;
|
UINT8 data = 0;
|
||||||
device_image_interface * img = dynamic_cast<device_image_interface *>(thmfc_floppy_image());
|
legacy_floppy_image_device * img = thmfc_floppy_image();
|
||||||
int flags = floppy_drive_get_flag_state( &img->device(), -1 );
|
int flags = img->floppy_drive_get_flag_state(-1 );
|
||||||
if ( thmfc_floppy_is_qdd(img) )
|
if ( thmfc_floppy_is_qdd(img) )
|
||||||
{
|
{
|
||||||
if ( ! img->exists() )
|
if ( ! img->exists() )
|
||||||
@ -1269,14 +1269,14 @@ READ8_MEMBER( thomson_state::thmfc_floppy_r )
|
|||||||
if ( img->exists() )
|
if ( img->exists() )
|
||||||
data |= 0x20; /* disk change (?) */
|
data |= 0x20; /* disk change (?) */
|
||||||
|
|
||||||
data |= !floppy_tk00_r(&img->device()) << 3;
|
data |= !img->floppy_tk00_r() << 3;
|
||||||
|
|
||||||
if ( flags & FLOPPY_DRIVE_READY )
|
if ( flags & FLOPPY_DRIVE_READY )
|
||||||
data |= 0x02;
|
data |= 0x02;
|
||||||
}
|
}
|
||||||
if (!motor_on)
|
if (!motor_on)
|
||||||
data |= 0x10;
|
data |= 0x10;
|
||||||
if (!floppy_wpt_r(&img->device()))
|
if (!img->floppy_wpt_r())
|
||||||
data |= 0x04;
|
data |= 0x04;
|
||||||
VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", machine().time().as_double(), m_maincpu->pc(), data ));
|
VLOG(( "%f $%04x thmfc_floppy_r: STAT1=$%02X\n", machine().time().as_double(), m_maincpu->pc(), data ));
|
||||||
return data;
|
return data;
|
||||||
@ -1314,7 +1314,7 @@ WRITE8_MEMBER( thomson_state::thmfc_floppy_w )
|
|||||||
case 0: /* CMD0 */
|
case 0: /* CMD0 */
|
||||||
{
|
{
|
||||||
int wsync = (data >> 4) & 1;
|
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;
|
chrn_id id;
|
||||||
thmfc1->formatting = (data >> 2) & 1;
|
thmfc1->formatting = (data >> 2) & 1;
|
||||||
LOG (( "%f $%04x thmfc_floppy_w: CMD0=$%02X dens=%s wsync=%i dsync=%i fmt=%i op=%i\n",
|
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 */
|
case 2: /* CMD2 */
|
||||||
{
|
{
|
||||||
device_t * img;
|
legacy_floppy_image_device * img;
|
||||||
int seek = 0, motor;
|
int seek = 0, motor;
|
||||||
thmfc1->drive = data & 2;
|
thmfc1->drive = data & 2;
|
||||||
|
|
||||||
img = thmfc_floppy_image();
|
img = thmfc_floppy_image();
|
||||||
if ( thmfc_floppy_is_qdd(dynamic_cast<device_image_interface *>(img)))
|
if ( thmfc_floppy_is_qdd(img))
|
||||||
{
|
{
|
||||||
motor = !(data & 0x40);
|
motor = !(data & 0x40);
|
||||||
/* no side select & no seek for QDD */
|
/* no side select & no seek for QDD */
|
||||||
@ -1443,7 +1443,7 @@ WRITE8_MEMBER( thomson_state::thmfc_floppy_w )
|
|||||||
if ( seek )
|
if ( seek )
|
||||||
{
|
{
|
||||||
thmfc1->data_raw_size = 0;
|
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
|
/* 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...
|
instead of counting, we assume the motor is always running...
|
||||||
*/
|
*/
|
||||||
motor_on = CLEAR_LINE /* motor */;
|
motor_on = CLEAR_LINE /* motor */;
|
||||||
floppy_mon_w(img, motor_on);
|
img->floppy_mon_w(motor_on);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
case 3: /* WDATA */
|
case 3: /* WDATA */
|
||||||
thmfc1->wsync = data;
|
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 );
|
thmfc_floppy_qdd_write_byte( data );
|
||||||
else if ( thmfc1->op==THMFC1_OP_WRITE_SECT )
|
else if ( thmfc1->op==THMFC1_OP_WRITE_SECT )
|
||||||
thmfc_floppy_write_byte( data );
|
thmfc_floppy_write_byte( data );
|
||||||
@ -1490,7 +1490,7 @@ WRITE8_MEMBER( thomson_state::thmfc_floppy_w )
|
|||||||
thmfc1->track = data;
|
thmfc1->track = data;
|
||||||
LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n",
|
LOG (( "%f $%04x thmfc_floppy_w: WTRCK=%i (real=%i)\n",
|
||||||
machine().time().as_double(), m_maincpu->pc(), data,
|
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;
|
break;
|
||||||
|
|
||||||
case 7: /* WCELL */
|
case 7: /* WCELL */
|
||||||
@ -1514,10 +1514,10 @@ void thomson_state::thmfc_floppy_reset()
|
|||||||
|
|
||||||
for ( i = 0; i < floppy_get_count( machine() ); i++ )
|
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) {
|
if (img) {
|
||||||
floppy_drive_set_ready_state( img, FLOPPY_DRIVE_READY, 0 );
|
img->floppy_drive_set_ready_state( FLOPPY_DRIVE_READY, 0 );
|
||||||
floppy_drive_seek( img, - floppy_drive_get_current_track( img ) );
|
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 );
|
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 )
|
switch ( to7_controller_type )
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
|
|
||||||
#include "formats/basicdsk.h"
|
#include "formats/basicdsk.h"
|
||||||
#include "imagedev/flopdrv.h"
|
|
||||||
#include "990_dk.h"
|
#include "990_dk.h"
|
||||||
|
|
||||||
/* status bits */
|
/* 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)*/
|
/*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)
|
if (cylinder_id)
|
||||||
*cylinder_id = id.C;
|
*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)
|
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 */
|
/* compare id */
|
||||||
if ((id.R == sector) && (id.N == 0))
|
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++)
|
for (retries=0; retries<10; retries++)
|
||||||
{ /* seek to requested track */
|
{ /* 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 */
|
/* update physical track position */
|
||||||
if (m_drv[unit].phys_cylinder != -1)
|
if (m_drv[unit].phys_cylinder != -1)
|
||||||
m_drv[unit].phys_cylinder += cylinder-m_drv[unit].log_cylinder[head];
|
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 */
|
/* 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++;
|
seek_count++;
|
||||||
}
|
}
|
||||||
if (! seek_complete)
|
if (! seek_complete)
|
||||||
@ -279,7 +278,7 @@ void fd800_legacy_device::do_read(void)
|
|||||||
return;
|
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_pos = 0;
|
||||||
m_buf_mode = bm_read;
|
m_buf_mode = bm_read;
|
||||||
m_recv_buf = (m_buf[m_buf_pos<<1] << 8) | m_buf[(m_buf_pos<<1)+1];
|
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;
|
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_pos = 0;
|
||||||
m_buf_mode = bm_write;
|
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)))
|
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;
|
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++)
|
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].phys_cylinder = -1;
|
||||||
m_drv[i].log_cylinder[0] = m_drv[i].log_cylinder[1] = -1;
|
m_drv[i].log_cylinder[0] = m_drv[i].log_cylinder[1] = -1;
|
||||||
m_drv[i].seclen = 64;
|
m_drv[i].seclen = 64;
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
#ifndef __990_DK__
|
#ifndef __990_DK__
|
||||||
#define __990_DK__
|
#define __990_DK__
|
||||||
|
|
||||||
|
#include "imagedev/flopdrv.h"
|
||||||
|
|
||||||
extern const device_type FD800;
|
extern const device_type FD800;
|
||||||
|
|
||||||
#define MAX_FLOPPIES 4
|
#define MAX_FLOPPIES 4
|
||||||
@ -57,7 +59,7 @@ private:
|
|||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
device_image_interface *img;
|
legacy_floppy_image_device *img;
|
||||||
int phys_cylinder;
|
int phys_cylinder;
|
||||||
int log_cylinder[2];
|
int log_cylinder[2];
|
||||||
int seclen;
|
int seclen;
|
||||||
|
@ -527,10 +527,10 @@ WRITE8_MEMBER( trs80_state::trs80m4_f4_w )
|
|||||||
m_fdc->dden_w(!BIT(data, 7));
|
m_fdc->dden_w(!BIT(data, 7));
|
||||||
|
|
||||||
/* CLEAR_LINE means to turn motors on */
|
/* CLEAR_LINE means to turn motors on */
|
||||||
floppy_mon_w(floppy_get_device(machine(), 0), (data & 0x0f) ? CLEAR_LINE : ASSERT_LINE);
|
floppy_get_device(machine(), 0)->floppy_mon_w((data & 0x0f) ? CLEAR_LINE : ASSERT_LINE);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 1), (data & 0x0f) ? CLEAR_LINE : ASSERT_LINE);
|
floppy_get_device(machine(), 1)->floppy_mon_w((data & 0x0f) ? CLEAR_LINE : ASSERT_LINE);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 2), (data & 0x0f) ? CLEAR_LINE : ASSERT_LINE);
|
floppy_get_device(machine(), 2)->floppy_mon_w((data & 0x0f) ? CLEAR_LINE : ASSERT_LINE);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 3), (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 )
|
WRITE8_MEMBER( trs80_state::sys80_f8_w )
|
||||||
@ -781,10 +781,10 @@ WRITE8_MEMBER( trs80_state::trs80_motor_w )
|
|||||||
|
|
||||||
if (drive > 3)
|
if (drive > 3)
|
||||||
{ /* Turn motors off */
|
{ /* Turn motors off */
|
||||||
floppy_mon_w(floppy_get_device(machine(), 0), ASSERT_LINE);
|
floppy_get_device(machine(), 0)->floppy_mon_w(ASSERT_LINE);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 1), ASSERT_LINE);
|
floppy_get_device(machine(), 1)->floppy_mon_w(ASSERT_LINE);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 2), ASSERT_LINE);
|
floppy_get_device(machine(), 2)->floppy_mon_w(ASSERT_LINE);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 3), ASSERT_LINE);
|
floppy_get_device(machine(), 3)->floppy_mon_w(ASSERT_LINE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -792,10 +792,10 @@ WRITE8_MEMBER( trs80_state::trs80_motor_w )
|
|||||||
m_fdc->set_side(m_head);
|
m_fdc->set_side(m_head);
|
||||||
|
|
||||||
/* Turn motors on */
|
/* Turn motors on */
|
||||||
floppy_mon_w(floppy_get_device(machine(), 0), CLEAR_LINE);
|
floppy_get_device(machine(), 0)->floppy_mon_w(CLEAR_LINE);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 1), CLEAR_LINE);
|
floppy_get_device(machine(), 1)->floppy_mon_w(CLEAR_LINE);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 2), CLEAR_LINE);
|
floppy_get_device(machine(), 2)->floppy_mon_w(CLEAR_LINE);
|
||||||
floppy_mon_w(floppy_get_device(machine(), 3), CLEAR_LINE);
|
floppy_get_device(machine(), 3)->floppy_mon_w(CLEAR_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user