Previous 15994 Revisions Next

r6772 Saturday 26th December, 2009 at 12:25:08 UTC by Wilbert Pol
Made the pc_hdc play nice with the 8237 implementation. Fixes bug #1886.
[src/mess/machine]pc_hdc.c

src/mess/machine/pc_hdc.c
r6771r6772
3636#include "memconv.h"
3737
3838
39#define LOG_HDC_STATUS      0
40#define LOG_HDC_CALL      0
41#define LOG_HDC_DATA      0
39#define LOG_HDC_STATUS      1
40#define LOG_HDC_CALL      1
41#define LOG_HDC_DATA      1
4242
4343
4444#define MAX_HARD   2
r6771r6772
330330/* the following crap is an abomination; it is a relic of the old crappy DMA
331331 * implementation that threw the idea of "emulating the hardware" to the wind
332332 */
333static UINT8 *hdcdma_data;
333static UINT8 hdcdma_data[512];
334334static UINT8 *hdcdma_src;
335335static UINT8 *hdcdma_dst;
336336static int hdcdma_read;
r6771r6772
373373        }
374374   }
375375
376   if ( ! no_dma() )
377   {
378      assert( pc_hdc_dma8237 != NULL );
379      i8237_dreq3_w( pc_hdc_dma8237, ( hdcdma_read || hdcdma_size ) ? 1 : 0 );
380   }
381
376382   return result;
377383}
378384
r6771r6772
408414        }
409415        hdcdma_dst = hdcdma_data;
410416    }
417
418   if ( ! no_dma() )
419   {
420      assert( pc_hdc_dma8237 != NULL );
421      i8237_dreq3_w( pc_hdc_dma8237, ( hdcdma_write || hdcdma_size ) ? 1 : 0 );
422   }
411423}
412424
413425
r6771r6772
415427static void execute_read(running_machine *machine)
416428{
417429   hard_disk_file *disk = pc_hdc_file(machine, idx);
418   UINT8 data[512], *src = data;
419430   int size = sector_cnt[idx] * 512;
420431   int read_ = 0;
421432
r6771r6772
423434   if (!disk)
424435      return;
425436
426   hdcdma_data = data;
427   hdcdma_src = src;
437   hdcdma_src = hdcdma_data;
428438   hdcdma_read = read_;
429439   hdcdma_size = size;
430440
r6771r6772
437447   }
438448   else
439449   {
440      i8237_run_transfer(pc_hdc_dma8237, HDC_DMA);
450      assert( pc_hdc_dma8237 != NULL );
451      i8237_dreq3_w( pc_hdc_dma8237, 1 );
441452   }
442453}
443454
r6771r6772
446457static void execute_write(running_machine *machine)
447458{
448459   hard_disk_file *disk = pc_hdc_file(machine, idx);
449   UINT8 data[512], *dst = data;
450460   int size = sector_cnt[idx] * 512;
451461   int write_ = 512;
452462
r6771r6772
454464   if (!disk)
455465      return;
456466
457   hdcdma_data = data;
458   hdcdma_dst = dst;
467   hdcdma_dst = hdcdma_data;
459468   hdcdma_write = write_;
460469   hdcdma_size = size;
461470
r6771r6772
469478   }
470479   else
471480   {
472      i8237_run_transfer(pc_hdc_dma8237, HDC_DMA);
481      assert( pc_hdc_dma8237 != NULL );
482      i8237_dreq3_w( pc_hdc_dma8237, 1 );
473483   }
474484}
475485

Previous 15994 Revisions Next


© 1998-2018 The MESS Team