Previous 199869 Revisions Next

r19242 Saturday 1st December, 2012 at 14:57:19 UTC by O. Galibert
wd_fdc: Interrupt on ready support [O. Galibert]
[src/emu/machine]wd_fdc.c wd_fdc.h

trunk/src/emu/machine/wd_fdc.c
r19241r19242
112112   if(floppy == _floppy)
113113      return;
114114
115   int prev_ready = floppy ? floppy->ready_r() : 1;
116
115117   if(floppy) {
116118      floppy->mon_w(1);
117119      floppy->setup_index_pulse_cb(floppy_image_device::index_pulse_cb());
120      floppy->setup_ready_cb(floppy_image_device::ready_cb());
118121   }
119122
120123   floppy = _floppy;
121124
125   int next_ready = floppy ? floppy->ready_r() : 1;
126
122127   if(floppy) {
123128      if(motor_control)
124129         floppy->mon_w(status & S_MON ? 0 : 1);
125130      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));
126132   }
133
134   if(prev_ready != next_ready)
135      ready_callback(floppy, next_ready);
127136}
128137
129138void wd_fdc_t::setup_intrq_cb(line_cb cb)
r19241r19242
10591068
10601069}
10611070
1071void 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
10621084void wd_fdc_t::index_callback(floppy_image_device *floppy, int state)
10631085{
10641086   live_sync();
r19241r19242
10681090      return;
10691091   }
10701092
1071   if(intrq_cond & I_IDX) {
1093   if(!intrq && (intrq_cond & I_IDX)) {
10721094      intrq = true;
10731095      if(!intrq_cb.isnull())
10741096         intrq_cb(intrq);
trunk/src/emu/machine/wd_fdc.h
r19241r19242
384384
385385   void spinup();
386386   void index_callback(floppy_image_device *floppy, int state);
387   void ready_callback(floppy_image_device *floppy, int state);
387388   bool sector_matches() const;
388389   bool is_ready();
389390

Previous 199869 Revisions Next


© 1997-2024 The MAME Team