trunk/src/emu/machine/wd_fdc.c
| r19241 | r19242 | |
| 112 | 112 | if(floppy == _floppy) |
| 113 | 113 | return; |
| 114 | 114 | |
| 115 | int prev_ready = floppy ? floppy->ready_r() : 1; |
| 116 | |
| 115 | 117 | if(floppy) { |
| 116 | 118 | floppy->mon_w(1); |
| 117 | 119 | floppy->setup_index_pulse_cb(floppy_image_device::index_pulse_cb()); |
| 120 | floppy->setup_ready_cb(floppy_image_device::ready_cb()); |
| 118 | 121 | } |
| 119 | 122 | |
| 120 | 123 | floppy = _floppy; |
| 121 | 124 | |
| 125 | int next_ready = floppy ? floppy->ready_r() : 1; |
| 126 | |
| 122 | 127 | if(floppy) { |
| 123 | 128 | if(motor_control) |
| 124 | 129 | floppy->mon_w(status & S_MON ? 0 : 1); |
| 125 | 130 | floppy->setup_index_pulse_cb(floppy_image_device::index_pulse_cb(FUNC(wd_fdc_t::index_callback), this)); |
| 131 | floppy->setup_ready_cb(floppy_image_device::ready_cb(FUNC(wd_fdc_t::ready_callback), this)); |
| 126 | 132 | } |
| 133 | |
| 134 | if(prev_ready != next_ready) |
| 135 | ready_callback(floppy, next_ready); |
| 127 | 136 | } |
| 128 | 137 | |
| 129 | 138 | void wd_fdc_t::setup_intrq_cb(line_cb cb) |
| r19241 | r19242 | |
| 1059 | 1068 | |
| 1060 | 1069 | } |
| 1061 | 1070 | |
| 1071 | void wd_fdc_t::ready_callback(floppy_image_device *floppy, int state) |
| 1072 | { |
| 1073 | live_sync(); |
| 1074 | if(!ready_hooked) |
| 1075 | return; |
| 1076 | |
| 1077 | if(!intrq && (((intrq_cond & I_RDY) && state) || ((intrq_cond & I_NRDY) && !state))) { |
| 1078 | intrq = true; |
| 1079 | if(!intrq_cb.isnull()) |
| 1080 | intrq_cb(intrq); |
| 1081 | } |
| 1082 | } |
| 1083 | |
| 1062 | 1084 | void wd_fdc_t::index_callback(floppy_image_device *floppy, int state) |
| 1063 | 1085 | { |
| 1064 | 1086 | live_sync(); |
| r19241 | r19242 | |
| 1068 | 1090 | return; |
| 1069 | 1091 | } |
| 1070 | 1092 | |
| 1071 | | if(intrq_cond & I_IDX) { |
| 1093 | if(!intrq && (intrq_cond & I_IDX)) { |
| 1072 | 1094 | intrq = true; |
| 1073 | 1095 | if(!intrq_cb.isnull()) |
| 1074 | 1096 | intrq_cb(intrq); |