Previous 199869 Revisions Next

r41818 Saturday 21st November, 2015 at 23:10:14 UTC by Robbbert
Merge branch 'master' of https://github.com/mamedev/mame
[src/devices/machine]wozfdc.cpp

trunk/src/devices/machine/wozfdc.cpp
r250329r250330
186186
187187READ8_MEMBER(wozfdc_device::read)
188188{
189   lss_sync();
189190   control(offset);
190191
191192   if(!(offset & 1)) {
192      lss_sync();
193193      return data_reg;
194194   }
195195   return 0xff;
r250329r250330
202202
203203WRITE8_MEMBER(wozfdc_device::write)
204204{
205   control(offset);
206205   lss_sync();
206   control(offset);
207207   last_6502_write = data;
208208}
209209
r250329r250330
220220
221221void wozfdc_device::control(int offset)
222222{
223   if(offset < 8) {
224      if(active)
225         lss_sync();
223   if(offset < 8)
226224      phase(offset >> 1, offset & 1);
227225
228   } else
226   else
229227      switch(offset) {
230228      case 0x8:
231229         if(active == MODE_ACTIVE) {
232            lss_sync();
233230            delay_timer->adjust(attotime::from_seconds(1));
234231            active = MODE_DELAY;
235232         }
r250329r250330
252249      case 0xa:
253250            external_io_select = false;
254251            if(floppy != floppy0->get_device()) {
255               if(active) {
256                  lss_sync();
252               if(active)
257253                  floppy->mon_w(true);
258               }
259254            floppy = floppy0->get_device();
260255            if(active)
261256               floppy->mon_w(false);
r250329r250330
267262         {
268263            if (floppy != floppy1->get_device())
269264            {
270               if(active) {
271                  lss_sync();
265               if(active)
272266                  floppy->mon_w(true);
273               }
274267               floppy = floppy1->get_device();
275268               if(active)
276269                  floppy->mon_w(false);
r250329r250330
283276         break;
284277      case 0xc:
285278         if(mode_load) {
286            if(active) {
287               lss_sync();
279            if(active)
288280               address &= ~0x04;
289            }
290281            mode_load = false;
291282         }
292283         break;
293284      case 0xd:
294285         if(!mode_load) {
295            if(active) {
296               lss_sync();
286            if(active)
297287               address |= 0x04;
298            }
299288            mode_load = true;
300289         }
301290         break;
302291      case 0xe:
303292         if(mode_write) {
304            if(active) {
305               lss_sync();
293            if(active)
306294               address &= ~0x08;
307            }
308295            mode_write = false;
296            attotime now = machine().time();
297            if(floppy)
298               floppy->write_flux(write_start_time, now, write_position, write_buffer);
309299         }
310300         break;
311301      case 0xf:
312302         if(!mode_write) {
313303            if(active) {
314               lss_sync();
315304               address |= 0x08;
316305               write_start_time = machine().time();
306               write_position = 0;
317307               if(floppy)
318308                  floppy->set_write_splice(write_start_time);
319309            }
r250329r250330
355345   if(!active)
356346      return;
357347
358   attotime next_flux = floppy ? floppy->get_next_transition(cycles_to_time(cycles) - attotime::from_usec(1)) : attotime::never;
348   attotime next_flux = floppy ? floppy->get_next_transition(cycles_to_time(cycles-1)) : attotime::never;
359349
360350   UINT64 cycles_limit = time_to_cycles(machine().time());
361351   UINT64 cycles_next_flux = next_flux != attotime::never ? time_to_cycles(next_flux) : UINT64(-1);
r250329r250330
382372               write_line_active = !write_line_active;
383373               assert(write_position != 32);
384374               write_buffer[write_position++] = cycles_to_time(cycles);
375            } else if(write_position >= 30) {
376               attotime now = cycles_to_time(cycles);
377               if(floppy)
378                  floppy->write_flux(write_start_time, now, write_position, write_buffer);
379               write_start_time = now;
380               write_position = 0;
385381            }
386382         }
387383


Previous 199869 Revisions Next


© 1997-2024 The MAME Team