summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Curt Coder <curtcoder@mail.com>2014-12-08 19:48:11 +0200
committer Curt Coder <curtcoder@mail.com>2014-12-08 19:48:11 +0200
commitd1f488e45f5d1472c91378cff095be633be598ba (patch)
tree34fcfd6d89a822c592e65683bf0c06bbc9a63ae5
parentbeb6c17cedab06a6e069db882c244cb03ec20a82 (diff)
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]
-rw-r--r--src/emu/machine/fdc_pll.c19
-rw-r--r--src/emu/machine/fdc_pll.h2
-rw-r--r--src/mess/machine/victor9k_fdc.c2
3 files changed, 22 insertions, 1 deletions
diff --git a/src/emu/machine/fdc_pll.c b/src/emu/machine/fdc_pll.c
index ef8b78b8125..80819c16164 100644
--- a/src/emu/machine/fdc_pll.c
+++ b/src/emu/machine/fdc_pll.c
@@ -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;
+}
diff --git a/src/emu/machine/fdc_pll.h b/src/emu/machine/fdc_pll.h
index 4a356616126..0cb08bba8cf 100644
--- a/src/emu/machine/fdc_pll.h
+++ b/src/emu/machine/fdc_pll.h
@@ -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);
diff --git a/src/mess/machine/victor9k_fdc.c b/src/mess/machine/victor9k_fdc.c
index 905c6cd08db..f2c3b2778dc 100644
--- a/src/mess/machine/victor9k_fdc.c
+++ b/src/mess/machine/victor9k_fdc.c
@@ -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()