From af8b0eedcdd3ca94afe94f86e5bcc2a8c3b36805 Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Mon, 3 Nov 2014 22:52:52 +0200 Subject: [PATCH] (MESS) victor9k: Floppy WIP. (nw) --- src/lib/formats/victor9k_dsk.c | 2 +- src/mess/machine/victor9k_fdc.c | 32 ++++++++++++++++++++++++++++++-- src/mess/machine/victor9k_fdc.h | 4 +++- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/lib/formats/victor9k_dsk.c b/src/lib/formats/victor9k_dsk.c index 18fef02afea..bbc0b45aac9 100644 --- a/src/lib/formats/victor9k_dsk.c +++ b/src/lib/formats/victor9k_dsk.c @@ -87,7 +87,7 @@ const victor9k_format::format victor9k_format::formats[] = { const UINT32 victor9k_format::cell_size[] = { - 0 + 1789, 1896, 2009, 2130, 2272, 2428, 2613, 2847, 2961 }; const int victor9k_format::sectors_per_track[2][80] = diff --git a/src/mess/machine/victor9k_fdc.c b/src/mess/machine/victor9k_fdc.c index 0cc943a433c..1f8f3d3360e 100644 --- a/src/mess/machine/victor9k_fdc.c +++ b/src/mess/machine/victor9k_fdc.c @@ -887,6 +887,8 @@ void victor_9000_fdc_t::live_start() cur_live.shift_reg = 0; cur_live.shift_reg_write = 0; cur_live.bit_counter = 0; + cur_live.sync_bit_counter = 0; + cur_live.sync_byte_counter = 0; cur_live.drive = m_drive; cur_live.side = m_side; @@ -1007,6 +1009,7 @@ void victor_9000_fdc_t::live_abort() cur_live.brdy = 1; cur_live.lbrdy = 1; cur_live.sync = 1; + cur_live.syn = 1; cur_live.gcr_err = 1; } @@ -1045,17 +1048,35 @@ void victor_9000_fdc_t::live_run(const attotime &limit) } } + // sync counter + if (sync) { + cur_live.sync_bit_counter = 0; + cur_live.sync_byte_counter = 10; + } else if (!cur_live.sync) { + cur_live.sync_bit_counter++; + if (cur_live.sync_bit_counter == 10) { + cur_live.sync_bit_counter = 0; + cur_live.sync_byte_counter++; + if (cur_live.sync_byte_counter == 16) { + cur_live.sync_byte_counter = 0; + } + } + } + + // syn + int syn = !(cur_live.sync_byte_counter == 15); + // GCR decoder if (cur_live.drw) { cur_live.i = cur_live.drw << 10 | cur_live.shift_reg; } else { - cur_live.i = 0x300 | ((cur_live.wd & 0xf0) << 1) | cur_live.wrsync << 4 | (cur_live.wd & 0x0f); + cur_live.i = cur_live.drw << 10 | ((cur_live.wd & 0xf0) << 1) | cur_live.wrsync << 4 | (cur_live.wd & 0x0f); } cur_live.e = m_gcr_rom->base()[cur_live.i]; // byte ready - int brdy = cur_live.bit_counter == 9; + int brdy = !(cur_live.bit_counter == 9); // GCR error int gcr_err = !(brdy || BIT(cur_live.e, 3)); @@ -1073,6 +1094,12 @@ void victor_9000_fdc_t::live_run(const attotime &limit) syncpoint = true; } + if (syn != cur_live.syn) { + if (LOG) logerror("%s SYN %u\n", cur_live.tm.as_string(),syn); + cur_live.syn = syn; + syncpoint = true; + } + if (gcr_err != cur_live.gcr_err) { if (LOG) logerror("%s GCR ERR %u\n", cur_live.tm.as_string(),gcr_err); cur_live.gcr_err = gcr_err; @@ -1093,6 +1120,7 @@ void victor_9000_fdc_t::live_run(const attotime &limit) case RUNNING_SYNCPOINT: { m_lbrdy_cb(cur_live.lbrdy); + m_syn_cb(cur_live.syn); cur_live.state = RUNNING; checkpoint(); diff --git a/src/mess/machine/victor9k_fdc.h b/src/mess/machine/victor9k_fdc.h index 3f374437e04..d6eb959b659 100644 --- a/src/mess/machine/victor9k_fdc.h +++ b/src/mess/machine/victor9k_fdc.h @@ -125,9 +125,12 @@ private: attotime edge; UINT16 shift_reg; int bit_counter; + int sync_bit_counter; + int sync_byte_counter; int brdy; int lbrdy; int sync; + int syn; int gcr_err; // write @@ -137,7 +140,6 @@ private: int write_position; UINT8 wd; int wrsync; - int syn; int gcr_data; int erase; };