(MESS) c8050fdc: Gap adjustment and SFD-1001 is single drive only. (nw)

This commit is contained in:
Curt Coder 2015-04-13 09:07:03 +03:00
parent 90a6a52985
commit 5330751a3d
8 changed files with 51 additions and 30 deletions

View File

@ -483,6 +483,15 @@ static SLOT_INTERFACE_START( c8250_floppies )
SLOT_INTERFACE_END
//-------------------------------------------------
// SLOT_INTERFACE( sfd1001_floppies )
//-------------------------------------------------
static SLOT_INTERFACE_START( sfd1001_floppies )
SLOT_INTERFACE( "525qd", FLOPPY_525_QD ) // Matsushita JU-570 / JU-570-2
SLOT_INTERFACE_END
//-------------------------------------------------
// FLOPPY_FORMATS( floppy_formats )
//-------------------------------------------------
@ -727,7 +736,6 @@ static MACHINE_CONFIG_FRAGMENT( sfd1001 )
MCFG_DEVICE_ADD(M6530_TAG, MOS6530n, XTAL_12MHz/12)
MCFG_MOS6530n_IRQ_CB(INPUTLINE(M6504_TAG, M6502_IRQ_LINE))
MCFG_MOS6530n_OUT_PA_CB(DEVWRITE8(FDC_TAG, c8050_fdc_t, write))
MCFG_MOS6530n_OUT_PB0_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, drv_sel_w))
MCFG_MOS6530n_OUT_PB1_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, ds0_w))
MCFG_MOS6530n_OUT_PB2_CB(DEVWRITELINE(FDC_TAG, c8050_fdc_t, ds1_w))
MCFG_MOS6530n_IN_PB3_CB(DEVREADLINE(FDC_TAG, c8050_fdc_t, wps_r))
@ -739,8 +747,7 @@ static MACHINE_CONFIG_FRAGMENT( sfd1001 )
MCFG_C8050_READY_CALLBACK(DEVWRITELINE(M6522_TAG, via6522_device, write_ca1))
MCFG_C8050_BRDY_CALLBACK(INPUTLINE(M6504_TAG, M6502_SET_OVERFLOW)) MCFG_DEVCB_XOR(1)
MCFG_C8050_ERROR_CALLBACK(DEVWRITELINE(M6522_TAG, via6522_device, write_cb1))
MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":0", c8250_floppies, "525qd", sfd1001_device::floppy_formats)
MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":1", c8250_floppies, NULL, sfd1001_device::floppy_formats)
MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":0", sfd1001_floppies, "525qd", sfd1001_device::floppy_formats)
MACHINE_CONFIG_END
@ -882,7 +889,7 @@ sfd1001_device::sfd1001_device(const machine_config &mconfig, const char *tag, d
void c8050_device::device_start()
{
// install image callbacks
m_fdc->set_floppy(m_floppy0->get_device(), m_floppy1->get_device());
m_fdc->set_floppy(m_floppy0, m_floppy1);
// register for state saving
save_item(NAME(m_rfdo));

View File

@ -216,10 +216,13 @@ void c8050_fdc_t::ds_w(int ds)
}
}
void c8050_fdc_t::set_floppy(floppy_image_device *floppy0, floppy_image_device *floppy1)
void c8050_fdc_t::set_floppy(floppy_connector *floppy0, floppy_connector *floppy1)
{
m_floppy0 = floppy0;
m_floppy1 = floppy1;
m_floppy0 = floppy0->get_device();
if (floppy1) {
m_floppy1 = floppy1->get_device();
}
}
void c8050_fdc_t::live_start()

View File

@ -76,7 +76,7 @@ public:
void stp1_w(int stp);
void ds_w(int ds);
void set_floppy(floppy_image_device *floppy0, floppy_image_device *floppy1);
void set_floppy(floppy_connector *floppy0, floppy_connector *floppy1);
protected:
// device-level overrides

View File

@ -180,6 +180,13 @@ void d64_format::build_sector_description(const format &f, UINT8 *sectdata, UINT
}
}
void d64_format::fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size)
{
desc[21].p2 = remaining_size / 8;
desc[22].p2 = remaining_size & 7;
desc[22].p1 >>= remaining_size & 0x01;
}
bool d64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
{
int type = find_size(io, form_factor);
@ -219,10 +226,7 @@ bool d64_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
if(remaining_size < 0)
throw emu_fatalerror("d64_format: Incorrect track layout, max_size=%d, current_size=%d", total_size, current_size);
// Fixup the end gap
desc[21].p2 = remaining_size / 8;
desc[22].p2 = remaining_size & 7;
desc[22].p1 >>= remaining_size & 0x01;
this->fix_end_gap(desc, remaining_size);
desc_s sectors[40];

View File

@ -65,6 +65,7 @@ protected:
void get_disk_id(const format &f, io_generic *io, UINT8 &id1, UINT8 &id2);
virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2);
void build_sector_description(const format &f, UINT8 *sectdata, UINT32 sect_offs, UINT32 error_offs, desc_s *sectors, int sector_count) const;
virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size);
static const format file_formats[];

View File

@ -37,7 +37,7 @@ const char *d80_format::extensions() const
const d80_format::format d80_format::file_formats[] = {
{ // d80, dos 2.5, 77 tracks, head/stepper 100 tpi
floppy_image::FF_525, floppy_image::SSQD, 2083, 77, 1, 256, 19, 19 // TODO verify gaps
floppy_image::FF_525, floppy_image::SSQD, 2083, 77, 1, 256, 22, 19 // TODO verify gaps
},
{}
};
@ -104,26 +104,31 @@ floppy_image_format_t::desc_e* d80_format::get_sector_desc(const format &f, int
/* 07 */ { GCR5, id2, 1 },
/* 08 */ { GCR5, id1, 1 },
/* 09 */ { CRC_END, 1 },
/* 10 */ { GCR5, 0x0f, 2 },
/* 11 */ { RAWBYTE, 0x55, f.gap_1 },
/* 12 */ { RAWBYTE, 0xff, 5 },
/* 13 */ { GCR5, 0x07, 1 },
/* 14 */ { CRC_CBM_START, 2 },
/* 15 */ { SECTOR_DATA_GCR5, -1 },
/* 16 */ { CRC_END, 2 },
/* 17 */ { CRC, 2 },
/* 18 */ { GCR5, 0x00, 2 },
/* 19 */ { RAWBYTE, 0x55, gap_2 },
/* 20 */ { SECTOR_LOOP_END },
/* 21 */ { RAWBYTE, 0x55, 0 },
/* 22 */ { RAWBITS, 0x5555, 0 },
/* 23 */ { END }
/* 10 */ { GCR5, 0x0f, f.gap_1 },
/* 11 */ { RAWBYTE, 0xff, 5 },
/* 12 */ { GCR5, 0x07, 1 },
/* 13 */ { CRC_CBM_START, 2 },
/* 14 */ { SECTOR_DATA_GCR5, -1 },
/* 15 */ { CRC_END, 2 },
/* 16 */ { CRC, 2 },
/* 17 */ { GCR5, 0x0f, gap_2 },
/* 18 */ { SECTOR_LOOP_END },
/* 19 */ { RAWBYTE, 0x55, 0 },
/* 20 */ { RAWBITS, 0x5555, 0 },
/* 21 */ { END }
};
current_size = 40 + (1+1+4+2)*10 + (f.gap_1)*8 + 40 + (1+f.sector_base_size+1+2)*10 + gap_2*8;
current_size = 40 + (1+1+4)*10 + (f.gap_1)*10 + 40 + (1+f.sector_base_size+1)*10 + gap_2*10;
current_size *= sector_count;
return desc;
}
void d80_format::fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size)
{
desc[19].p2 = remaining_size / 8;
desc[20].p2 = remaining_size & 7;
desc[20].p1 >>= remaining_size & 0x01;
}
const floppy_format_type FLOPPY_D80_FORMAT = &floppy_image_format_creator<d80_format>;

View File

@ -29,7 +29,8 @@ protected:
virtual UINT32 get_cell_size(const format &f, int track);
virtual int get_sectors_per_track(const format &f, int track);
virtual int get_disk_id_offset(const format &f);
floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2);
virtual floppy_image_format_t::desc_e* get_sector_desc(const format &f, int &current_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2);
virtual void fix_end_gap(floppy_image_format_t::desc_e* desc, int remaining_size);
static const format file_formats[];

View File

@ -33,7 +33,7 @@ const char *d82_format::extensions() const
const d82_format::format d82_format::file_formats[] = {
{ // d82, dos 2.5, 77 tracks, 2 heads, head/stepper 100 tpi
floppy_image::FF_525, floppy_image::DSQD, 2083, 77, 2, 256, 19, 19 // TODO verify gaps
floppy_image::FF_525, floppy_image::DSQD, 2083, 77, 2, 256, 22, 19 // TODO verify gaps
},
{}
};