/*************************************************************************************
 CopyQM image handler - file-io 

 used by i8272_floppy driver

 (C) Matt Knoth 2008

 *************************************************************************************/

#ifndef QM_IMAGE_H
#define QM_IMAGE_H

typedef struct cqm_image {

   char   fname[256];
   UINT16 sector_size;
   UINT8  sectors_per_track;
   UINT8  heads;
   UINT8  tracks;

   UINT8  current_sector;
   UINT8  current_head;
   UINT8  current_track;

} cqm_image;


// file-io functions for a CopyQM image
cqm_image* qm_image_new( UINT8 which, const char* fname);
cqm_image* qm_image_open( UINT8 which, const char* fname);
void       qm_image_format( UINT8 which, cqm_image* geometry, UINT8 databyte );
void       qm_image_save( UINT8 which );
void       qm_image_close( UINT8 which );
void       qm_dump_disk( UINT8 which );

// optain a pointer to read/write within this sector. Invalid beyond the sector.
unsigned char* qm_image_get_rw_ptr( UINT8 which, int cylinder, int head, int sector);
unsigned char* qm_image_get_block_rw_ptr( UINT8 which, long block);


#endif

