trunk/src/lib/formats/flopimg.c
r241733 | r241734 | |
1071 | 1071 | type == CRC_CBM_START || |
1072 | 1072 | type == CRC_MACHEAD_START || |
1073 | 1073 | type == CRC_FCS_START || |
| 1074 | type == CRC_VICTOR_HDR_START || |
| 1075 | type == CRC_VICTOR_DATA_START || |
1074 | 1076 | type == CRC_END || |
1075 | 1077 | type == SECTOR_LOOP_START || |
1076 | 1078 | type == SECTOR_LOOP_END || |
r241733 | r241734 | |
1112 | 1114 | case CRC_FCS_START: |
1113 | 1115 | crcs[desc[i].p1].type = CRC_FCS; |
1114 | 1116 | break; |
| 1117 | case CRC_VICTOR_HDR_START: |
| 1118 | crcs[desc[i].p1].type = CRC_VICTOR_HDR; |
| 1119 | break; |
| 1120 | case CRC_VICTOR_DATA_START: |
| 1121 | crcs[desc[i].p1].type = CRC_VICTOR_DATA; |
| 1122 | break; |
1115 | 1123 | } |
1116 | 1124 | |
1117 | 1125 | for(int i=0; desc[i].type != END; i++) |
r241733 | r241734 | |
1131 | 1139 | case CRC_CBM: return 10; |
1132 | 1140 | case CRC_MACHEAD: return 8; |
1133 | 1141 | case CRC_FCS: return 20; |
| 1142 | case CRC_VICTOR_HDR: return 10; |
| 1143 | case CRC_VICTOR_DATA: return 20; |
1134 | 1144 | default: return 0; |
1135 | 1145 | } |
1136 | 1146 | } |
r241733 | r241734 | |
1271 | 1281 | // TODO |
1272 | 1282 | } |
1273 | 1283 | |
| 1284 | void floppy_image_format_t::fixup_crc_victor_header(UINT32 *buffer, const gen_crc_info *crc) |
| 1285 | { |
| 1286 | UINT8 v = 0; |
| 1287 | for(int o = crc->start; o < crc->end; o+=10) { |
| 1288 | v += ((gcr5bw_tb[bitn_r(buffer, o, 5)] << 4) | gcr5bw_tb[bitn_r(buffer, o+5, 5)]); |
| 1289 | } |
| 1290 | int offset = crc->write; |
| 1291 | gcr5_w(buffer, offset, 10, v); |
| 1292 | } |
| 1293 | |
| 1294 | void floppy_image_format_t::fixup_crc_victor_data(UINT32 *buffer, const gen_crc_info *crc) |
| 1295 | { |
| 1296 | UINT16 v = 0; |
| 1297 | for(int o = crc->start; o < crc->end; o+=10) { |
| 1298 | v += ((gcr5bw_tb[bitn_r(buffer, o, 5)] << 4) | gcr5bw_tb[bitn_r(buffer, o+5, 5)]); |
| 1299 | } |
| 1300 | int offset = crc->write; |
| 1301 | gcr5_w(buffer, offset, 10, v & 0xff); |
| 1302 | gcr5_w(buffer, offset, 10, v >> 8); |
| 1303 | } |
| 1304 | |
1274 | 1305 | void floppy_image_format_t::fixup_crcs(UINT32 *buffer, gen_crc_info *crcs) |
1275 | 1306 | { |
1276 | 1307 | for(int i=0; i != MAX_CRC_COUNT; i++) |
1277 | 1308 | if(crcs[i].write != -1) { |
1278 | 1309 | switch(crcs[i].type) { |
1279 | | case CRC_AMIGA: fixup_crc_amiga(buffer, crcs+i); break; |
1280 | | case CRC_CBM: fixup_crc_cbm(buffer, crcs+i); break; |
1281 | | case CRC_CCITT: fixup_crc_ccitt(buffer, crcs+i); break; |
1282 | | case CRC_CCITT_FM:fixup_crc_ccitt_fm(buffer, crcs+i); break; |
1283 | | case CRC_MACHEAD: fixup_crc_machead(buffer, crcs+i); break; |
1284 | | case CRC_FCS: fixup_crc_fcs(buffer, crcs+i); break; |
| 1310 | case CRC_AMIGA: fixup_crc_amiga(buffer, crcs+i); break; |
| 1311 | case CRC_CBM: fixup_crc_cbm(buffer, crcs+i); break; |
| 1312 | case CRC_CCITT: fixup_crc_ccitt(buffer, crcs+i); break; |
| 1313 | case CRC_CCITT_FM: fixup_crc_ccitt_fm(buffer, crcs+i); break; |
| 1314 | case CRC_MACHEAD: fixup_crc_machead(buffer, crcs+i); break; |
| 1315 | case CRC_FCS: fixup_crc_fcs(buffer, crcs+i); break; |
| 1316 | case CRC_VICTOR_HDR: fixup_crc_victor_header(buffer, crcs+i); break; |
| 1317 | case CRC_VICTOR_DATA: fixup_crc_victor_data(buffer, crcs+i); break; |
1285 | 1318 | } |
1286 | 1319 | if(crcs[i].fixup_mfm_clock) { |
1287 | 1320 | int offset = crcs[i].write + crc_cells_size(crcs[i].type); |
r241733 | r241734 | |
1403 | 1436 | raw_w(buffer, offset, desc[index].p2, desc[index].p1); |
1404 | 1437 | break; |
1405 | 1438 | |
| 1439 | case SYNC_GCR5: |
| 1440 | for(int i=0; i<desc[index].p1; i++) |
| 1441 | raw_w(buffer, offset, 10, 0xffff); |
| 1442 | break; |
| 1443 | |
1406 | 1444 | case TRACK_ID: |
1407 | 1445 | mfm_w(buffer, offset, 8, track); |
1408 | 1446 | break; |
r241733 | r241734 | |
1427 | 1465 | _8n1_w(buffer, offset, 8, track); |
1428 | 1466 | break; |
1429 | 1467 | |
| 1468 | case TRACK_ID_VICTOR_GCR5: |
| 1469 | gcr5_w(buffer, offset, 10, 1 + track + (head * 0x80)); |
| 1470 | break; |
| 1471 | |
1430 | 1472 | case HEAD_ID: |
1431 | 1473 | mfm_w(buffer, offset, 8, head); |
1432 | 1474 | break; |
r241733 | r241734 | |
1536 | 1578 | case CRC_CCITT_FM_START: |
1537 | 1579 | case CRC_MACHEAD_START: |
1538 | 1580 | case CRC_FCS_START: |
| 1581 | case CRC_VICTOR_HDR_START: |
| 1582 | case CRC_VICTOR_DATA_START: |
1539 | 1583 | crcs[desc[index].p1].start = offset; |
1540 | 1584 | break; |
1541 | 1585 | |
trunk/src/lib/formats/flopimg.h
r241733 | r241734 | |
307 | 307 | RAW, //!< One 16 bits word in p1 to be written raw, msb first, repeated p2 times |
308 | 308 | RAWBYTE, //!< One 8 bit byte in p1 to be written raw, msb first, repeated p2 times |
309 | 309 | RAWBITS, //!< A value of p2 bits in p1 to be copied as-is, msb first |
| 310 | SYNC_GCR5, //!< gcr5 sync byte |
310 | 311 | TRACK_ID, //!< Track id byte, mfm-encoded |
311 | 312 | TRACK_ID_FM, //!< Track id byte, fm-encoded |
312 | 313 | TRACK_ID_DOS2_GCR5, //!< Track id byte, gcr5-encoded |
313 | 314 | TRACK_ID_DOS25_GCR5, //!< Track id byte, gcr5-encoded |
314 | 315 | TRACK_ID_GCR6, //!< Track id low 6 bits, gcr6-encoded |
315 | 316 | TRACK_ID_8N1, //!< Track id byte, 8N1-encoded |
| 317 | TRACK_ID_VICTOR_GCR5, //!< Track id byte, gcr5-encoded |
316 | 318 | HEAD_ID, //!< Head id byte, mfm-encoded |
317 | 319 | HEAD_ID_FM, //!< Head id byte, fm-encoded |
318 | 320 | HEAD_ID_SWAP, //!< Head id byte swapped (0->1, 1->0), mfm-encoded |
r241733 | r241734 | |
346 | 348 | CRC_CBM_START, //!< Start a CBM checksum calculation (xor of original data values, gcr5-encoded), p1 = crc id |
347 | 349 | CRC_MACHEAD_START, //!< Start of the mac gcr6 sector header checksum calculation (xor of pre-encode 6-bits values, gcr6-encoded) |
348 | 350 | CRC_FCS_START, //!< Start a Compucolor File Control System checksum calculation, p1 = crc id |
| 351 | CRC_VICTOR_HDR_START, //!< Start a Victor 9000 checksum calculation, p1 = crc id |
| 352 | CRC_VICTOR_DATA_START, //!< Start a Victor 9000 checksum calculation, p1 = crc id |
349 | 353 | CRC_END, //!< End the checksum, p1 = crc id |
350 | 354 | CRC, //!< Write a checksum in the apporpriate format, p1 = crc id |
351 | 355 | |
r241733 | r241734 | |
565 | 569 | UINT8 sbyte_mfm_r(const UINT8 *bitstream, int &pos, int track_size); |
566 | 570 | |
567 | 571 | private: |
568 | | enum { CRC_NONE, CRC_AMIGA, CRC_CBM, CRC_CCITT, CRC_CCITT_FM, CRC_MACHEAD, CRC_FCS }; |
| 572 | enum { CRC_NONE, CRC_AMIGA, CRC_CBM, CRC_CCITT, CRC_CCITT_FM, CRC_MACHEAD, CRC_FCS, CRC_VICTOR_HDR, CRC_VICTOR_DATA }; |
569 | 573 | enum { MAX_CRC_COUNT = 64 }; |
570 | 574 | |
571 | 575 | //! Holds data used internally for generating CRCs. |
r241733 | r241734 | |
587 | 591 | void fixup_crc_ccitt_fm(UINT32 *buffer, const gen_crc_info *crc); |
588 | 592 | void fixup_crc_machead(UINT32 *buffer, const gen_crc_info *crc); |
589 | 593 | void fixup_crc_fcs(UINT32 *buffer, const gen_crc_info *crc); |
| 594 | void fixup_crc_victor_header(UINT32 *buffer, const gen_crc_info *crc); |
| 595 | void fixup_crc_victor_data(UINT32 *buffer, const gen_crc_info *crc); |
590 | 596 | void fixup_crcs(UINT32 *buffer, gen_crc_info *crcs); |
591 | 597 | void collect_crcs(const desc_e *desc, gen_crc_info *crcs); |
592 | 598 | |
trunk/src/lib/formats/victor9k_dsk.c
r241733 | r241734 | |
37 | 37 | 8 unused 75-79 11 144.0 417 |
38 | 38 | |
39 | 39 | Interleave factor 3 |
| 40 | cell 2.13 usec |
40 | 41 | |
41 | 42 | */ |
42 | 43 | |
r241733 | r241734 | |
83 | 84 | return 0; |
84 | 85 | } |
85 | 86 | |
86 | | floppy_image_format_t::desc_e* victor9k_format::get_sector_desc(const format &f, int ¤t_size, int sector_count, UINT8 id1, UINT8 id2, int gap_2) |
| 87 | floppy_image_format_t::desc_e* victor9k_format::get_sector_desc(const format &f, int ¤t_size, int sector_count) |
87 | 88 | { |
88 | 89 | static floppy_image_format_t::desc_e desc[] = { |
89 | | /* 00 */ { SECTOR_LOOP_START, 0, -1 }, |
90 | | /* 01 */ { RAWBYTE, 0xff, 5 }, |
91 | | /* 02 */ { GCR5, 0x08, 1 }, |
92 | | /* 03 */ { CRC, 1 }, |
93 | | /* 04 */ { CRC_CBM_START, 1 }, |
94 | | /* 05 */ { SECTOR_ID_GCR5 }, |
95 | | /* 06 */ { TRACK_ID_DOS2_GCR5 }, |
96 | | /* 07 */ { GCR5, id2, 1 }, |
97 | | /* 08 */ { GCR5, id1, 1 }, |
98 | | /* 09 */ { CRC_END, 1 }, |
99 | | /* 10 */ { GCR5, 0x0f, 2 }, |
100 | | /* 11 */ { RAWBYTE, 0x55, f.gap_1 }, |
101 | | /* 12 */ { RAWBYTE, 0xff, 5 }, |
102 | | /* 13 */ { GCR5, 0x07, 1 }, |
103 | | /* 14 */ { CRC_CBM_START, 2 }, |
104 | | /* 15 */ { SECTOR_DATA_GCR5, -1 }, |
105 | | /* 16 */ { CRC_END, 2 }, |
106 | | /* 17 */ { CRC, 2 }, |
107 | | /* 18 */ { GCR5, 0x00, 2 }, |
108 | | /* 19 */ { RAWBYTE, 0x55, gap_2 }, |
109 | | /* 20 */ { SECTOR_LOOP_END }, |
110 | | /* 21 */ { RAWBYTE, 0x55, 0 }, |
111 | | /* 22 */ { RAWBITS, 0x5555, 0 }, |
112 | | /* 23 */ { END } |
| 90 | /* 00 */ { SECTOR_INTERLEAVE_SKEW, 0, 0}, |
| 91 | /* 01 */ { SECTOR_LOOP_START, 0, -1 }, |
| 92 | /* 02 */ { SYNC_GCR5, 6 }, |
| 93 | /* 03 */ { GCR5, 0x07, 1 }, |
| 94 | /* 04 */ { CRC_VICTOR_HDR_START, 1 }, |
| 95 | /* 05 */ { TRACK_ID_VICTOR_GCR5 }, |
| 96 | /* 06 */ { SECTOR_ID_GCR5 }, |
| 97 | /* 07 */ { CRC_END, 1 }, |
| 98 | /* 08 */ { CRC, 1 }, |
| 99 | /* 09 */ { RAWBYTE, 0x55, 8 }, |
| 100 | /* 10 */ { SYNC_GCR5, 5 }, |
| 101 | /* 11 */ { GCR5, 0x08, 1 }, |
| 102 | /* 12 */ { CRC_VICTOR_DATA_START, 2 }, |
| 103 | /* 13 */ { SECTOR_DATA_GCR5, -1 }, |
| 104 | /* 14 */ { CRC_END, 2 }, |
| 105 | /* 15 */ { CRC, 2 }, |
| 106 | /* 16 */ { RAWBYTE, 0x55, 8 }, |
| 107 | /* 17 */ { SECTOR_LOOP_END }, |
| 108 | /* 18 */ { RAWBYTE, 0x55, 0 }, |
| 109 | /* 19 */ { RAWBITS, 0x5555, 0 }, |
| 110 | /* 20 */ { END } |
113 | 111 | }; |
114 | 112 | |
115 | | current_size = 40 + (1+1+4+2)*10 + (f.gap_1)*8 + 40 + (1+f.sector_base_size+1+2)*10 + gap_2*8; |
| 113 | current_size = 60 + (1+1+1+1)*10 + 8*8 + 50 + (1+f.sector_base_size+2)*10 + 8*8; |
116 | 114 | |
117 | 115 | current_size *= sector_count; |
118 | 116 | return desc; |
r241733 | r241734 | |
145 | 143 | |
146 | 144 | int track_offset = 0; |
147 | 145 | |
148 | | UINT8 id1 = 0xde, id2 = 0xad; // TODO |
149 | | |
150 | 146 | for (int head = 0; head < f.head_count; head++) { |
151 | 147 | for (int track = 0; track < f.track_count; track++) { |
152 | 148 | int current_size = 0; |
r241733 | r241734 | |
154 | 150 | int sector_count = sectors_per_track[head][track]; |
155 | 151 | int track_size = sector_count*f.sector_base_size; |
156 | 152 | |
157 | | floppy_image_format_t::desc_e *desc = get_sector_desc(f, current_size, sector_count, id1, id2, f.gap_2); |
| 153 | floppy_image_format_t::desc_e *desc = get_sector_desc(f, current_size, sector_count); |
158 | 154 | |
159 | 155 | int remaining_size = total_size - current_size; |
160 | 156 | if(remaining_size < 0) |
161 | 157 | throw emu_fatalerror("victor9k_format: Incorrect track layout, max_size=%d, current_size=%d", total_size, current_size); |
162 | 158 | |
163 | 159 | // Fixup the end gap |
164 | | desc[21].p2 = remaining_size / 8; |
165 | | desc[22].p2 = remaining_size & 7; |
166 | | desc[22].p1 >>= remaining_size & 0x01; |
| 160 | desc[18].p2 = remaining_size / 8; |
| 161 | desc[19].p2 = remaining_size & 7; |
| 162 | desc[19].p1 >>= remaining_size & 0x01; |
167 | 163 | |
168 | 164 | desc_s sectors[40]; |
169 | 165 | |
r241733 | r241734 | |
184 | 180 | return false; |
185 | 181 | } |
186 | 182 | |
| 183 | int victor9k_format::get_rpm(int head, int track) |
| 184 | { |
| 185 | return rpm[speed_zone[head][track]]; |
| 186 | } |
| 187 | |
187 | 188 | const victor9k_format::format victor9k_format::formats[] = { |
188 | 189 | { // |
189 | | floppy_image::FF_525, floppy_image::SSDD, 1224, 80, 1, 512, 9, 8 |
| 190 | floppy_image::FF_525, floppy_image::SSDD, 1224, 80, 1, 512 |
190 | 191 | }, |
191 | 192 | { // |
192 | | floppy_image::FF_525, floppy_image::DSDD, 2448, 80, 2, 512, 9, 8 |
| 193 | floppy_image::FF_525, floppy_image::DSDD, 2448, 80, 2, 512 |
193 | 194 | }, |
194 | 195 | {} |
195 | 196 | }; |
196 | 197 | |
197 | | const UINT32 victor9k_format::cell_size[] = |
| 198 | const UINT32 victor9k_format::cell_size[9] = |
198 | 199 | { |
199 | 200 | 1789, 1896, 2009, 2130, 2272, 2428, 2613, 2847, 2961 |
200 | 201 | }; |
r241733 | r241734 | |
247 | 248 | } |
248 | 249 | }; |
249 | 250 | |
| 251 | const int victor9k_format::rpm[9] = |
| 252 | { |
| 253 | 252, 267, 283, 300, 320, 342, 368, 401, 417 |
| 254 | }; |
| 255 | |
250 | 256 | const floppy_format_type FLOPPY_VICTOR_9000_FORMAT = &floppy_image_format_creator<victor9k_format>; |
trunk/src/mess/machine/victor9k_fdc.c
r241733 | r241734 | |
13 | 13 | |
14 | 14 | TODO: |
15 | 15 | |
16 | | - floppy format |
17 | | - spindle speed |
| 16 | - disk error 8 (sync missing?) |
| 17 | - 8048 spindle speed control |
18 | 18 | - read PLL |
19 | 19 | - write logic |
20 | 20 | |
r241733 | r241734 | |
29 | 29 | //************************************************************************** |
30 | 30 | |
31 | 31 | #define LOG 1 |
| 32 | #define LOG_VIA 1 |
| 33 | #define LOG_SCP 0 |
32 | 34 | |
33 | 35 | #define I8048_TAG "5d" |
34 | 36 | #define M6522_4_TAG "1f" |
r241733 | r241734 | |
182 | 184 | m_via6(*this, M6522_6_TAG), |
183 | 185 | m_floppy0(*this, I8048_TAG":0:525qd"), |
184 | 186 | m_floppy1(*this, I8048_TAG":1:525qd"), |
185 | | m_rom(*this, I8048_TAG), |
186 | 187 | m_gcr_rom(*this, "gcr"), |
187 | 188 | m_da(0), |
188 | 189 | m_da0(0), |
r241733 | r241734 | |
209 | 210 | m_via5_irq(CLEAR_LINE), |
210 | 211 | m_via6_irq(CLEAR_LINE), |
211 | 212 | m_syn(0), |
212 | | m_lbrdy(1) |
| 213 | m_lbrdy(1), |
| 214 | m_period(attotime::from_nsec(21300)) |
213 | 215 | { |
214 | 216 | cur_live.tm = attotime::never; |
215 | 217 | cur_live.state = IDLE; |
r241733 | r241734 | |
303 | 305 | break; |
304 | 306 | |
305 | 307 | case TM_TACH0: |
306 | | m_tach0 = 1; |
| 308 | // TODO |
307 | 309 | break; |
308 | 310 | |
309 | 311 | case TM_TACH1: |
310 | | m_tach1 = 1; |
| 312 | // TODO |
311 | 313 | break; |
312 | 314 | } |
313 | 315 | } |
r241733 | r241734 | |
391 | 393 | int sel1 = BIT(data, 4); |
392 | 394 | if (m_sel1 != sel1) sync = true; |
393 | 395 | |
394 | | m_rdy0 = BIT(data, 6); |
395 | | m_rdy1 = BIT(data, 7); |
| 396 | //m_rdy0 = BIT(data, 6); |
| 397 | //m_via5->write_ca2(m_rdy0); |
396 | 398 | |
397 | | if (LOG) logerror("%s %s START0/STOP0/SEL0/RDY0 %u/%u/%u/%u START1/STOP1/SEL1/RDY1 %u/%u/%u/%u\n", machine().time().as_string(), machine().describe_context(), start0, stop0, sel0, m_rdy0, start1, stop1, sel1, m_rdy1); |
| 399 | //m_rdy1 = BIT(data, 7); |
| 400 | //m_via5->write_cb2(m_rdy1); |
398 | 401 | |
| 402 | if (LOG_SCP) logerror("%s %s START0/STOP0/SEL0/RDY0 %u/%u/%u/%u START1/STOP1/SEL1/RDY1 %u/%u/%u/%u\n", machine().time().as_string(), machine().describe_context(), start0, stop0, sel0, m_rdy0, start1, stop1, sel1, m_rdy1); |
| 403 | |
399 | 404 | if (sync) |
400 | 405 | { |
401 | 406 | live_sync(); |
r241733 | r241734 | |
403 | 408 | m_start0 = start0; |
404 | 409 | m_stop0 = stop0; |
405 | 410 | m_sel0 = sel0; |
406 | | update_spindle_motor(m_floppy0, t_tach0, m_start0, m_stop0, m_sel0, m_da0); |
| 411 | //update_spindle_motor(m_floppy0, t_tach0, m_start0, m_stop0, m_sel0, m_da0); |
407 | 412 | |
408 | 413 | m_start1 = start1; |
409 | 414 | m_stop1 = stop1; |
410 | 415 | m_sel1 = sel1; |
411 | | update_spindle_motor(m_floppy1, t_tach1, m_start1, m_stop1, m_sel1, m_da1); |
| 416 | //update_spindle_motor(m_floppy1, t_tach1, m_start1, m_stop1, m_sel1, m_da1); |
412 | 417 | |
413 | 418 | checkpoint(); |
414 | 419 | |
r241733 | r241734 | |
431 | 436 | |
432 | 437 | READ8_MEMBER( victor_9000_fdc_t::tach0_r ) |
433 | 438 | { |
434 | | int tach0 = m_tach0; |
435 | | |
436 | | m_tach0 = 0; |
437 | | |
438 | | return tach0; |
| 439 | return m_tach0; |
439 | 440 | } |
440 | 441 | |
441 | 442 | |
r241733 | r241734 | |
445 | 446 | |
446 | 447 | READ8_MEMBER( victor_9000_fdc_t::tach1_r ) |
447 | 448 | { |
448 | | int tach1 = m_tach1; |
449 | | |
450 | | m_tach1 = 0; |
451 | | |
452 | | return tach1; |
| 449 | return m_tach1; |
453 | 450 | } |
454 | 451 | |
455 | 452 | |
r241733 | r241734 | |
483 | 480 | |
484 | 481 | void victor_9000_fdc_t::update_spindle_motor(floppy_image_device *floppy, emu_timer *t_tach, bool start, bool stop, bool sel, UINT8 &da) |
485 | 482 | { |
486 | | if (!start && !stop && floppy->mon_r()) { |
487 | | if (LOG) logerror("%s: motor start\n", floppy->tag()); |
| 483 | if (start && !stop && floppy->mon_r()) { |
| 484 | if (LOG_SCP) logerror("%s: motor start\n", floppy->tag()); |
488 | 485 | floppy->mon_w(0); |
489 | 486 | } else if (stop && !floppy->mon_r()) { |
490 | | if (LOG) logerror("%s: motor stop\n", floppy->tag()); |
| 487 | if (LOG_SCP) logerror("%s: motor stop\n", floppy->tag()); |
491 | 488 | floppy->mon_w(1); |
492 | 489 | } |
493 | 490 | |
494 | 491 | if (sel) { |
495 | 492 | da = m_da; |
496 | 493 | } |
497 | | |
498 | | floppy->set_rpm(300); // TODO |
499 | | t_tach->adjust(attotime::from_hz(5)); // TODO |
500 | 494 | } |
501 | 495 | |
502 | 496 | |
r241733 | r241734 | |
506 | 500 | |
507 | 501 | WRITE8_MEMBER( victor_9000_fdc_t::da_w ) |
508 | 502 | { |
| 503 | if (LOG_SCP) logerror("%s %s DA %02x\n", machine().time().as_string(), machine().describe_context(), data); |
| 504 | |
509 | 505 | if (m_da != data) |
510 | 506 | { |
511 | 507 | live_sync(); |
512 | 508 | m_da = data; |
513 | | if (LOG) logerror("%s %s DA %02x\n", machine().time().as_string(), machine().describe_context(), data); |
514 | 509 | update_spindle_motor(m_floppy0, t_tach0, m_start0, m_stop0, m_sel0, m_da0); |
515 | 510 | update_spindle_motor(m_floppy1, t_tach1, m_start1, m_stop1, m_sel1, m_da1); |
516 | 511 | checkpoint(); |
r241733 | r241734 | |
537 | 532 | |
538 | 533 | m_l0ms = data & 0x0f; |
539 | 534 | |
| 535 | { // HACK to bypass SCP |
| 536 | m_floppy0->mon_w((m_l0ms == 0xf) ? 1 : 0); |
| 537 | m_floppy0->set_rpm(victor9k_format::get_rpm(m_side, m_floppy0->get_cyl())); |
| 538 | m_rdy0 = (m_l0ms == 0xf) ? 0 : 1; |
| 539 | m_via5->write_ca2(m_rdy0); |
| 540 | } |
| 541 | |
540 | 542 | UINT8 st0 = data >> 4; |
541 | 543 | |
| 544 | if (LOG_VIA) logerror("%s %s L0MS %01x ST0 %01x\n", machine().time().as_string(), machine().describe_context(), m_l0ms, st0); |
| 545 | |
542 | 546 | if (m_st0 != st0) |
543 | 547 | { |
544 | 548 | live_sync(); |
545 | 549 | update_stepper_motor(m_floppy0, m_stp0, st0, m_st0); |
546 | 550 | m_st0 = st0; |
547 | | if (LOG) logerror("%s %s L0MS %01x ST0 %01x\n", machine().time().as_string(), machine().describe_context(), m_l0ms, st0); |
548 | 551 | checkpoint(); |
549 | 552 | live_run(); |
550 | 553 | } |
r241733 | r241734 | |
569 | 572 | |
570 | 573 | m_l1ms = data & 0x0f; |
571 | 574 | |
| 575 | { // HACK to bypass SCP |
| 576 | m_floppy1->mon_w((m_l1ms == 0xf) ? 1 : 0); |
| 577 | m_floppy1->set_rpm(victor9k_format::get_rpm(m_side, m_floppy1->get_cyl())); |
| 578 | m_rdy1 = (m_l1ms == 0xf) ? 0 : 1; |
| 579 | m_via5->write_cb2(m_rdy1); |
| 580 | } |
| 581 | |
572 | 582 | UINT8 st1 = data >> 4; |
573 | 583 | |
| 584 | if (LOG_VIA) logerror("%s %s L1MS %01x ST1 %01x\n", machine().time().as_string(), machine().describe_context(), m_l1ms, st1); |
| 585 | |
574 | 586 | if (m_st1 != st1) |
575 | 587 | { |
576 | 588 | live_sync(); |
577 | 589 | update_stepper_motor(m_floppy1, m_stp1, st1, m_st1); |
578 | 590 | m_st1 = st1; |
579 | | if (LOG) logerror("%s %s L1MS %01x ST1 %01x\n", machine().time().as_string(), machine().describe_context(), m_l1ms, st1); |
580 | 591 | checkpoint(); |
581 | 592 | live_run(); |
582 | 593 | } |
r241733 | r241734 | |
590 | 601 | m_wrsync = state; |
591 | 602 | cur_live.wrsync = state; |
592 | 603 | checkpoint(); |
| 604 | if (LOG_VIA) logerror("%s %s ERASE %u\n", machine().time().as_string(), machine().describe_context(), state); |
593 | 605 | live_run(); |
594 | 606 | } |
595 | 607 | } |
r241733 | r241734 | |
645 | 657 | { |
646 | 658 | live_sync(); |
647 | 659 | m_wd = cur_live.wd = data; |
648 | | if (LOG) logerror("%s %s WD %02x\n", machine().time().as_string(), machine().describe_context(), data); |
| 660 | if (LOG_VIA) logerror("%s %s WD %02x\n", machine().time().as_string(), machine().describe_context(), data); |
649 | 661 | checkpoint(); |
650 | 662 | live_run(); |
651 | 663 | } |
r241733 | r241734 | |
676 | 688 | |
677 | 689 | */ |
678 | 690 | |
679 | | if (LOG) logerror("%s %s TRK0D0 %u TRK0D1 %u\n", machine().time().as_string(), machine().describe_context(), m_floppy0->trk00_r(),m_floppy1->trk00_r()); |
| 691 | if (LOG_VIA) logerror("%s %s TRK0D0 %u TRK0D1 %u SYNC %u\n", machine().time().as_string(), machine().describe_context(), m_floppy0->trk00_r(), m_floppy1->trk00_r(), checkpoint_live.sync); |
680 | 692 | |
681 | 693 | UINT8 data = 0; |
682 | 694 | |
r241733 | r241734 | |
740 | 752 | m_drive = drive; |
741 | 753 | cur_live.drive = drive; |
742 | 754 | |
743 | | if (LOG) logerror("%s %s SIDE %u DRIVE %u\n", machine().time().as_string(), machine().describe_context(), side, drive); |
| 755 | if (LOG_VIA) logerror("%s %s SIDE %u DRIVE %u\n", machine().time().as_string(), machine().describe_context(), side, drive); |
744 | 756 | |
745 | 757 | checkpoint(); |
746 | 758 | live_run(); |
r241733 | r241734 | |
825 | 837 | m_stp1 = stp1; |
826 | 838 | update_stepper_motor(m_floppy1, m_stp1, m_st1, m_st1); |
827 | 839 | |
828 | | if (LOG) logerror("%s %s STP0 %u STP1 %u\n", machine().time().as_string(), machine().describe_context(), stp0, stp1); |
| 840 | if (LOG_VIA) logerror("%s %s STP0 %u STP1 %u\n", machine().time().as_string(), machine().describe_context(), stp0, stp1); |
829 | 841 | |
830 | 842 | checkpoint(); |
831 | 843 | live_run(); |
r241733 | r241734 | |
839 | 851 | live_sync(); |
840 | 852 | m_drw = cur_live.drw = state; |
841 | 853 | checkpoint(); |
842 | | if (LOG) logerror("%s %s DRW %u\n", machine().time().as_string(), machine().describe_context(), state); |
| 854 | if (LOG_VIA) logerror("%s %s DRW %u\n", machine().time().as_string(), machine().describe_context(), state); |
843 | 855 | if (state) { |
844 | 856 | stop_writing(machine().time()); |
845 | 857 | } else { |
r241733 | r241734 | |
856 | 868 | live_sync(); |
857 | 869 | m_erase = cur_live.erase = state; |
858 | 870 | checkpoint(); |
859 | | if (LOG) logerror("%s %s ERASE %u\n", machine().time().as_string(), machine().describe_context(), state); |
| 871 | if (LOG_VIA) logerror("%s %s ERASE %u\n", machine().time().as_string(), machine().describe_context(), state); |
860 | 872 | live_run(); |
861 | 873 | } |
862 | 874 | } |
r241733 | r241734 | |
874 | 886 | { |
875 | 887 | live_sync(); |
876 | 888 | cur_live.lbrdy = 1; |
877 | | if (LOG) logerror("%s %s LBRDY 1\n", machine().time().as_string(), machine().describe_context()); |
| 889 | if (LOG_VIA) logerror("%s %s LBRDY 1\n", machine().time().as_string(), machine().describe_context()); |
878 | 890 | m_lbrdy_cb(1); |
879 | 891 | checkpoint(); |
880 | 892 | live_run(); |
r241733 | r241734 | |
889 | 901 | { |
890 | 902 | live_sync(); |
891 | 903 | cur_live.lbrdy = 1; |
892 | | if (LOG) logerror("%s %s LBRDY 1\n", machine().time().as_string(), machine().describe_context()); |
| 904 | if (LOG_VIA) logerror("%s %s LBRDY 1\n", machine().time().as_string(), machine().describe_context()); |
893 | 905 | m_lbrdy_cb(1); |
894 | 906 | checkpoint(); |
895 | 907 | live_run(); |
r241733 | r241734 | |
1157 | 1169 | |
1158 | 1170 | void victor_9000_fdc_t::get_next_edge(const attotime &when) |
1159 | 1171 | { |
1160 | | // TODO |
| 1172 | floppy_image_device *floppy = get_floppy(); |
| 1173 | |
| 1174 | cur_live.edge = floppy ? floppy->get_next_transition(when) : attotime::never; |
1161 | 1175 | } |
1162 | 1176 | |
1163 | 1177 | int victor_9000_fdc_t::get_next_bit(attotime &tm, const attotime &limit) |
1164 | 1178 | { |
1165 | | return -1; // TODO |
| 1179 | attotime next = tm + m_period; |
| 1180 | |
| 1181 | int bit = (cur_live.edge.is_never() || cur_live.edge >= next) ? 0 : 1; |
| 1182 | |
| 1183 | if (bit) { |
| 1184 | get_next_edge(next); |
| 1185 | } |
| 1186 | |
| 1187 | return bit; |
1166 | 1188 | } |