wozfdc: I don't find you comitted enough (nw)

This commit is contained in:
Olivier Galibert 2015-11-21 23:44:05 +01:00
parent 181da32c69
commit 620839530a

View File

@ -186,10 +186,10 @@ void wozfdc_device::device_timer(emu_timer &timer, device_timer_id id, int param
READ8_MEMBER(wozfdc_device::read)
{
lss_sync();
control(offset);
if(!(offset & 1)) {
lss_sync();
return data_reg;
}
return 0xff;
@ -202,8 +202,8 @@ READ8_MEMBER(wozfdc_device::read)
WRITE8_MEMBER(wozfdc_device::write)
{
control(offset);
lss_sync();
control(offset);
last_6502_write = data;
}
@ -220,16 +220,13 @@ void wozfdc_device::phase(int ph, bool on)
void wozfdc_device::control(int offset)
{
if(offset < 8) {
if(active)
lss_sync();
if(offset < 8)
phase(offset >> 1, offset & 1);
} else
else
switch(offset) {
case 0x8:
if(active == MODE_ACTIVE) {
lss_sync();
delay_timer->adjust(attotime::from_seconds(1));
active = MODE_DELAY;
}
@ -252,10 +249,8 @@ void wozfdc_device::control(int offset)
case 0xa:
external_io_select = false;
if(floppy != floppy0->get_device()) {
if(active) {
lss_sync();
if(active)
floppy->mon_w(true);
}
floppy = floppy0->get_device();
if(active)
floppy->mon_w(false);
@ -267,10 +262,8 @@ void wozfdc_device::control(int offset)
{
if (floppy != floppy1->get_device())
{
if(active) {
lss_sync();
if(active)
floppy->mon_w(true);
}
floppy = floppy1->get_device();
if(active)
floppy->mon_w(false);
@ -283,37 +276,34 @@ void wozfdc_device::control(int offset)
break;
case 0xc:
if(mode_load) {
if(active) {
lss_sync();
if(active)
address &= ~0x04;
}
mode_load = false;
}
break;
case 0xd:
if(!mode_load) {
if(active) {
lss_sync();
if(active)
address |= 0x04;
}
mode_load = true;
}
break;
case 0xe:
if(mode_write) {
if(active) {
lss_sync();
if(active)
address &= ~0x08;
}
mode_write = false;
attotime now = machine().time();
if(floppy)
floppy->write_flux(write_start_time, now, write_position, write_buffer);
}
break;
case 0xf:
if(!mode_write) {
if(active) {
lss_sync();
address |= 0x08;
write_start_time = machine().time();
write_position = 0;
if(floppy)
floppy->set_write_splice(write_start_time);
}
@ -355,7 +345,7 @@ void wozfdc_device::lss_sync()
if(!active)
return;
attotime next_flux = floppy ? floppy->get_next_transition(cycles_to_time(cycles) - attotime::from_usec(1)) : attotime::never;
attotime next_flux = floppy ? floppy->get_next_transition(cycles_to_time(cycles-1)) : attotime::never;
UINT64 cycles_limit = time_to_cycles(machine().time());
UINT64 cycles_next_flux = next_flux != attotime::never ? time_to_cycles(next_flux) : UINT64(-1);
@ -382,6 +372,12 @@ void wozfdc_device::lss_sync()
write_line_active = !write_line_active;
assert(write_position != 32);
write_buffer[write_position++] = cycles_to_time(cycles);
} else if(write_position >= 30) {
attotime now = cycles_to_time(cycles);
if(floppy)
floppy->write_flux(write_start_time, now, write_position, write_buffer);
write_start_time = now;
write_position = 0;
}
}