trunk/src/mess/machine/victor9k_fdc.c
| r242242 | r242243 | |
| 23 | 23 | 08 sync too long |
| 24 | 24 | 99 not a system disc |
| 25 | 25 | |
| 26 | 11 Noise on sync |
| 27 | FF No sync (bad or unformatted disk) |
| 28 | |
| 26 | 29 | */ |
| 27 | 30 | |
| 28 | 31 | /* |
| r242242 | r242243 | |
| 32 | 35 | - communication error with SCP after loading boot sector |
| 33 | 36 | - bp ff1a8 |
| 34 | 37 | - patch ff1ab=c3 |
| 35 | | - data block checksum errors loading header track |
| 36 | | - bp ff46a (ax = checksum read from disk, dx = calculated checksum) |
| 37 | | - bit stream is offset by 1 bit at some point |
| 38 | - sync counter errors |
| 39 | - FF if sync byte counter loaded to 10 |
| 40 | - 11 if sync byte counter loaded to 9 |
| 38 | 41 | - 8048 spindle speed control |
| 39 | | - read PLL |
| 40 | 42 | - write logic |
| 41 | 43 | |
| 42 | 44 | */ |
| r242242 | r242243 | |
| 1064 | 1066 | cur_live.wrsync = m_wrsync; |
| 1065 | 1067 | cur_live.erase = m_erase; |
| 1066 | 1068 | |
| 1069 | pll_reset(cur_live.tm, attotime::from_nsec(2130)); |
| 1067 | 1070 | checkpoint_live = cur_live; |
| 1071 | pll_save_checkpoint(); |
| 1068 | 1072 | |
| 1069 | 1073 | live_run(); |
| 1070 | 1074 | } |
| 1071 | 1075 | |
| 1076 | void victor_9000_fdc_t::pll_reset(const attotime &when, const attotime clock) |
| 1077 | { |
| 1078 | cur_pll.reset(when); |
| 1079 | cur_pll.set_clock(clock); |
| 1080 | } |
| 1081 | |
| 1082 | void victor_9000_fdc_t::pll_save_checkpoint() |
| 1083 | { |
| 1084 | checkpoint_pll = cur_pll; |
| 1085 | } |
| 1086 | |
| 1087 | void victor_9000_fdc_t::pll_retrieve_checkpoint() |
| 1088 | { |
| 1089 | cur_pll = checkpoint_pll; |
| 1090 | } |
| 1091 | |
| 1072 | 1092 | void victor_9000_fdc_t::checkpoint() |
| 1073 | 1093 | { |
| 1074 | | get_next_edge(machine().time()); |
| 1075 | 1094 | checkpoint_live = cur_live; |
| 1095 | pll_save_checkpoint(); |
| 1076 | 1096 | } |
| 1077 | 1097 | |
| 1078 | 1098 | void victor_9000_fdc_t::rollback() |
| 1079 | 1099 | { |
| 1080 | 1100 | cur_live = checkpoint_live; |
| 1081 | | get_next_edge(cur_live.tm); |
| 1101 | pll_retrieve_checkpoint(); |
| 1082 | 1102 | } |
| 1083 | 1103 | |
| 1084 | 1104 | void victor_9000_fdc_t::start_writing(const attotime &tm) |
| r242242 | r242243 | |
| 1315 | 1335 | } |
| 1316 | 1336 | } |
| 1317 | 1337 | |
| 1318 | | void victor_9000_fdc_t::get_next_edge(const attotime &when) |
| 1319 | | { |
| 1320 | | floppy_image_device *floppy = get_floppy(); |
| 1321 | | |
| 1322 | | cur_live.edge = floppy ? floppy->get_next_transition(when) : attotime::never; |
| 1323 | | } |
| 1324 | | |
| 1325 | 1338 | int victor_9000_fdc_t::get_next_bit(attotime &tm, const attotime &limit) |
| 1326 | 1339 | { |
| 1327 | | attotime next = tm + m_period; |
| 1328 | | |
| 1329 | | int bit = (cur_live.edge.is_never() || cur_live.edge >= next) ? 0 : 1; |
| 1330 | | |
| 1331 | | if (bit) { |
| 1332 | | get_next_edge(next); |
| 1333 | | } |
| 1334 | | |
| 1335 | | return bit; |
| 1340 | return cur_pll.get_next_bit(tm, get_floppy(), limit); |
| 1336 | 1341 | } |
trunk/src/mess/machine/victor9k_fdc.h
| r242242 | r242243 | |
| 19 | 19 | #include "formats/victor9k_dsk.h" |
| 20 | 20 | #include "imagedev/floppy.h" |
| 21 | 21 | #include "machine/6522via.h" |
| 22 | #include "machine/fdc_pll.h" |
| 22 | 23 | |
| 23 | 24 | |
| 24 | 25 | |
| r242242 | r242243 | |
| 216 | 217 | attotime m_period; |
| 217 | 218 | |
| 218 | 219 | live_info cur_live, checkpoint_live; |
| 220 | fdc_pll_t cur_pll, checkpoint_pll; |
| 219 | 221 | emu_timer *t_gen, *t_tach0, *t_tach1; |
| 220 | 222 | |
| 221 | 223 | floppy_image_device* get_floppy(); |
| 222 | 224 | void live_start(); |
| 225 | void pll_reset(const attotime &when, const attotime clock); |
| 226 | void pll_save_checkpoint(); |
| 227 | void pll_retrieve_checkpoint(); |
| 223 | 228 | void checkpoint(); |
| 224 | 229 | void rollback(); |
| 225 | 230 | bool write_next_bit(bool bit, const attotime &limit); |