trunk/src/mess/machine/victor9k_fdc.c
r241691 | r241692 | |
887 | 887 | cur_live.shift_reg = 0; |
888 | 888 | cur_live.shift_reg_write = 0; |
889 | 889 | cur_live.bit_counter = 0; |
| 890 | cur_live.sync_bit_counter = 0; |
| 891 | cur_live.sync_byte_counter = 0; |
890 | 892 | |
891 | 893 | cur_live.drive = m_drive; |
892 | 894 | cur_live.side = m_side; |
r241691 | r241692 | |
1007 | 1009 | cur_live.brdy = 1; |
1008 | 1010 | cur_live.lbrdy = 1; |
1009 | 1011 | cur_live.sync = 1; |
| 1012 | cur_live.syn = 1; |
1010 | 1013 | cur_live.gcr_err = 1; |
1011 | 1014 | } |
1012 | 1015 | |
r241691 | r241692 | |
1045 | 1048 | } |
1046 | 1049 | } |
1047 | 1050 | |
| 1051 | // sync counter |
| 1052 | if (sync) { |
| 1053 | cur_live.sync_bit_counter = 0; |
| 1054 | cur_live.sync_byte_counter = 10; |
| 1055 | } else if (!cur_live.sync) { |
| 1056 | cur_live.sync_bit_counter++; |
| 1057 | if (cur_live.sync_bit_counter == 10) { |
| 1058 | cur_live.sync_bit_counter = 0; |
| 1059 | cur_live.sync_byte_counter++; |
| 1060 | if (cur_live.sync_byte_counter == 16) { |
| 1061 | cur_live.sync_byte_counter = 0; |
| 1062 | } |
| 1063 | } |
| 1064 | } |
| 1065 | |
| 1066 | // syn |
| 1067 | int syn = !(cur_live.sync_byte_counter == 15); |
| 1068 | |
1048 | 1069 | // GCR decoder |
1049 | 1070 | if (cur_live.drw) { |
1050 | 1071 | cur_live.i = cur_live.drw << 10 | cur_live.shift_reg; |
1051 | 1072 | } else { |
1052 | | cur_live.i = 0x300 | ((cur_live.wd & 0xf0) << 1) | cur_live.wrsync << 4 | (cur_live.wd & 0x0f); |
| 1073 | cur_live.i = cur_live.drw << 10 | ((cur_live.wd & 0xf0) << 1) | cur_live.wrsync << 4 | (cur_live.wd & 0x0f); |
1053 | 1074 | } |
1054 | 1075 | |
1055 | 1076 | cur_live.e = m_gcr_rom->base()[cur_live.i]; |
1056 | 1077 | |
1057 | 1078 | // byte ready |
1058 | | int brdy = cur_live.bit_counter == 9; |
| 1079 | int brdy = !(cur_live.bit_counter == 9); |
1059 | 1080 | |
1060 | 1081 | // GCR error |
1061 | 1082 | int gcr_err = !(brdy || BIT(cur_live.e, 3)); |
r241691 | r241692 | |
1073 | 1094 | syncpoint = true; |
1074 | 1095 | } |
1075 | 1096 | |
| 1097 | if (syn != cur_live.syn) { |
| 1098 | if (LOG) logerror("%s SYN %u\n", cur_live.tm.as_string(),syn); |
| 1099 | cur_live.syn = syn; |
| 1100 | syncpoint = true; |
| 1101 | } |
| 1102 | |
1076 | 1103 | if (gcr_err != cur_live.gcr_err) { |
1077 | 1104 | if (LOG) logerror("%s GCR ERR %u\n", cur_live.tm.as_string(),gcr_err); |
1078 | 1105 | cur_live.gcr_err = gcr_err; |
r241691 | r241692 | |
1093 | 1120 | |
1094 | 1121 | case RUNNING_SYNCPOINT: { |
1095 | 1122 | m_lbrdy_cb(cur_live.lbrdy); |
| 1123 | m_syn_cb(cur_live.syn); |
1096 | 1124 | |
1097 | 1125 | cur_live.state = RUNNING; |
1098 | 1126 | checkpoint(); |