fdc_pll: Added write_next_bit_prev_cell() that writes a bit at the position the previous bit was read from. This is needed for FDC's that read and write on the same clock cycle, e.g. the Commodore 8050 and Victor 9000. [Curt Coder]

This commit is contained in:
Curt Coder 2014-12-08 19:48:11 +02:00
parent beb6c17ced
commit d1f488e45f
3 changed files with 22 additions and 1 deletions

View File

@ -22,6 +22,7 @@ void fdc_pll_t::set_clock(const attotime &_period)
void fdc_pll_t::reset(const attotime &when)
{
ctime = when;
write_ctime = when;
phase_adjust = attotime::zero;
freq_hist = 0;
write_position = 0;
@ -65,6 +66,7 @@ int fdc_pll_t::get_next_bit(attotime &tm, floppy_image_device *floppy, const att
if(next > limit)
return -1;
write_ctime = ctime;
ctime = next;
tm = next;
@ -130,3 +132,20 @@ bool fdc_pll_t::write_next_bit(bool bit, attotime &tm, floppy_image_device *flop
ctime = etime;
return false;
}
bool fdc_pll_t::write_next_bit_prev_cell(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit)
{
if(write_start_time.is_never()) {
write_start_time = write_ctime;
write_position = 0;
}
attotime etime = write_ctime + period;
if(etime > limit)
return true;
if(bit && write_position < ARRAY_LENGTH(write_buffer))
write_buffer[write_position++] = write_ctime + period/2;
return false;
}

View File

@ -12,6 +12,7 @@ class fdc_pll_t {
public:
attotime ctime, period, min_period, max_period, period_adjust_base, phase_adjust;
attotime write_ctime;
attotime write_start_time;
attotime write_buffer[32];
int write_position;
@ -21,6 +22,7 @@ public:
void reset(const attotime &when);
int get_next_bit(attotime &tm, floppy_image_device *floppy, const attotime &limit);
bool write_next_bit(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit);
bool write_next_bit_prev_cell(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit);
void start_writing(const attotime &tm);
void commit(floppy_image_device *floppy, const attotime &tm);
void stop_writing(floppy_image_device *floppy, const attotime &tm);

View File

@ -1114,7 +1114,7 @@ int victor_9000_fdc_t::pll_get_next_bit(attotime &tm, floppy_image_device *flopp
bool victor_9000_fdc_t::pll_write_next_bit(bool bit, attotime &tm, floppy_image_device *floppy, const attotime &limit)
{
return cur_pll.write_next_bit(bit, tm, floppy, limit);
return cur_pll.write_next_bit_prev_cell(bit, tm, floppy, limit);
}
void victor_9000_fdc_t::checkpoint()