mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
wd_fdc: add a SSO callback.
Some machines do not connect the SSO output to control the floppy side. When this new callback option is used the wd_fdc no longer controls the floppy, rather calls the SSO callback.
This commit is contained in:
parent
6bf8519cf5
commit
26897dd6ff
@ -85,6 +85,7 @@ wd_fdc_device_base::wd_fdc_device_base(const machine_config &mconfig, device_typ
|
||||
drq_cb(*this),
|
||||
hld_cb(*this),
|
||||
enp_cb(*this),
|
||||
sso_cb(*this),
|
||||
ready_cb(*this), // actually output by the drive, not by the FDC
|
||||
enmf_cb(*this)
|
||||
{
|
||||
@ -108,6 +109,7 @@ void wd_fdc_device_base::device_start()
|
||||
drq_cb.resolve();
|
||||
hld_cb.resolve();
|
||||
enp_cb.resolve();
|
||||
sso_cb.resolve();
|
||||
ready_cb.resolve();
|
||||
enmf_cb.resolve();
|
||||
|
||||
@ -475,8 +477,8 @@ void wd_fdc_device_base::read_sector_start()
|
||||
main_state = READ_SECTOR;
|
||||
status &= ~(S_CRC|S_LOST|S_RNF|S_WP|S_DDM);
|
||||
drop_drq();
|
||||
if(side_control && floppy)
|
||||
floppy->ss_w((command & 0x02) ? 1 : 0);
|
||||
if(side_control)
|
||||
update_sso();
|
||||
sub_state = motor_control ? SPINUP : SPINUP_DONE;
|
||||
status_type_1 = false;
|
||||
read_sector_continue();
|
||||
@ -576,8 +578,8 @@ void wd_fdc_device_base::read_track_start()
|
||||
main_state = READ_TRACK;
|
||||
status &= ~(S_LOST|S_RNF);
|
||||
drop_drq();
|
||||
if(side_control && floppy)
|
||||
floppy->ss_w((command & 0x02) ? 1 : 0);
|
||||
if(side_control)
|
||||
update_sso();
|
||||
sub_state = motor_control ? SPINUP : SPINUP_DONE;
|
||||
status_type_1 = false;
|
||||
read_track_continue();
|
||||
@ -655,8 +657,8 @@ void wd_fdc_device_base::read_id_start()
|
||||
main_state = READ_ID;
|
||||
status &= ~(S_WP|S_DDM|S_LOST|S_RNF);
|
||||
drop_drq();
|
||||
if(side_control && floppy)
|
||||
floppy->ss_w((command & 0x02) ? 1 : 0);
|
||||
if(side_control)
|
||||
update_sso();
|
||||
sub_state = motor_control ? SPINUP : SPINUP_DONE;
|
||||
status_type_1 = false;
|
||||
read_id_continue();
|
||||
@ -732,8 +734,8 @@ void wd_fdc_device_base::write_track_start()
|
||||
main_state = WRITE_TRACK;
|
||||
status &= ~(S_WP|S_DDM|S_LOST|S_RNF);
|
||||
drop_drq();
|
||||
if(side_control && floppy)
|
||||
floppy->ss_w((command & 0x02) ? 1 : 0);
|
||||
if(side_control)
|
||||
update_sso();
|
||||
sub_state = motor_control ? SPINUP : SPINUP_DONE;
|
||||
status_type_1 = false;
|
||||
|
||||
@ -843,8 +845,8 @@ void wd_fdc_device_base::write_sector_start()
|
||||
main_state = WRITE_SECTOR;
|
||||
status &= ~(S_CRC|S_LOST|S_RNF|S_WP|S_DDM);
|
||||
drop_drq();
|
||||
if(side_control && floppy)
|
||||
floppy->ss_w((command & 0x02) ? 1 : 0);
|
||||
if(side_control)
|
||||
update_sso();
|
||||
sub_state = motor_control ? SPINUP : SPINUP_DONE;
|
||||
status_type_1 = false;
|
||||
write_sector_continue();
|
||||
@ -2206,6 +2208,31 @@ void wd_fdc_device_base::drop_drq()
|
||||
}
|
||||
}
|
||||
|
||||
void wd_fdc_device_base::update_sso()
|
||||
{
|
||||
// The 'side_control' flag is interpreted as meaning that the FDC has
|
||||
// a SSO output feature, not that it necessarily controls the floppy.
|
||||
if(!side_control)
|
||||
return;
|
||||
|
||||
uint8_t side = (command & 0x02) ? 1 : 0;
|
||||
|
||||
// If a SSO callback is defined then it is assumed that this callback
|
||||
// will update the floppy side if that is the connection. There are
|
||||
// some machines that use the SSO output for other purposes.
|
||||
if(!sso_cb.isnull()) {
|
||||
sso_cb(side);
|
||||
return;
|
||||
}
|
||||
|
||||
// If a SSO callback is not defined then assume that the machine
|
||||
// intended the driver to update the floppy side which appears to be
|
||||
// the case in most cases.
|
||||
if(floppy) {
|
||||
floppy->ss_w((command & 0x02) ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
int wd_fdc_device_base::calc_sector_size(uint8_t size, uint8_t command) const
|
||||
{
|
||||
return 128 << (size & 3);
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
auto drq_wr_callback() { return drq_cb.bind(); }
|
||||
auto hld_wr_callback() { return hld_cb.bind(); }
|
||||
auto enp_wr_callback() { return enp_cb.bind(); }
|
||||
auto sso_wr_callback() { return sso_cb.bind(); }
|
||||
auto ready_wr_callback() { return ready_cb.bind(); }
|
||||
auto enmf_rd_callback() { return enmf_cb.bind(); }
|
||||
|
||||
@ -291,7 +292,7 @@ private:
|
||||
|
||||
live_info cur_live, checkpoint_live;
|
||||
|
||||
devcb_write_line intrq_cb, drq_cb, hld_cb, enp_cb, ready_cb;
|
||||
devcb_write_line intrq_cb, drq_cb, hld_cb, enp_cb, sso_cb, ready_cb;
|
||||
devcb_read_line enmf_cb;
|
||||
|
||||
uint8_t format_last_byte;
|
||||
@ -355,6 +356,8 @@ private:
|
||||
|
||||
void drop_drq();
|
||||
void set_drq();
|
||||
|
||||
void update_sso();
|
||||
};
|
||||
|
||||
class wd_fdc_analog_device_base : public wd_fdc_device_base {
|
||||
|
Loading…
Reference in New Issue
Block a user