Annotation of hatari/src/st.c, revision 1.1

1.1     ! root        1: /*
        !             2:   Hatari
        !             3: 
        !             4:   ST Disc support
        !             5: */
        !             6: 
        !             7: #include "main.h"
        !             8: #include "file.h"
        !             9: 
        !            10: #define SAVE_TO_ST_IMAGES
        !            11: 
        !            12: /*
        !            13:     .ST FILE FORMAT
        !            14:   --===============-------------------------------------------------------------
        !            15: 
        !            16:   The file format of the .ST image files used by PaCifiST is simplicity itself;
        !            17:   they are just straight images of the disk in question, with sectors stored in
        !            18:   the expected logical order. So, on a sector basis the images run from sector
        !            19:   0 (bootsector) to however many sectors are on the disk. On a track basis the
        !            20:   layout is the same as for MSA files but obviously the data is raw, no track
        !            21:   header or compression or anything like that.
        !            22: 
        !            23:   TRACK 0, SIDE 0
        !            24:   TRACK 0, SIDE 1
        !            25:   TRACK 1, SIDE 0
        !            26:   TRACK 1, SIDE 1
        !            27:   TRACK 2, SIDE 0
        !            28:   TRACK 2, SIDE 1
        !            29: */
        !            30: 
        !            31: 
        !            32: //-----------------------------------------------------------------------
        !            33: /*
        !            34:   Load .ST file into memory, return number of bytes loaded
        !            35: */
        !            36: int ST_ReadDisc(char *pszFileName,unsigned char *pBuffer)
        !            37: {
        !            38:   void *pSTFile;
        !            39:   long ImageSize=0;
        !            40: 
        !            41:   // Just load directly into buffer, and set ImageSize accordingly(no need to free memory)
        !            42:   pSTFile = File_Read(pszFileName,pBuffer,&ImageSize,NULL);
        !            43:   if (!pSTFile)
        !            44:     ImageSize = 0;
        !            45: 
        !            46:   return(ImageSize);
        !            47: }
        !            48: 
        !            49: //-----------------------------------------------------------------------
        !            50: /*
        !            51:   Save .ST file from memory buffer. Returns TRUE is all OK
        !            52: */
        !            53: BOOL ST_WriteDisc(char *pszFileName,unsigned char *pBuffer,int ImageSize)
        !            54: {
        !            55: #ifdef SAVE_TO_ST_IMAGES
        !            56: 
        !            57:   // Just save buffer directly to file
        !            58:   return( File_Save(/*hWnd,*/pszFileName,pBuffer,ImageSize,FALSE) );
        !            59: 
        !            60: #else  //SAVE_TO_ST_IMAGES
        !            61: 
        !            62:   // Oops, cannot save
        !            63:   return(FALSE);
        !            64: 
        !            65: #endif  //SAVE_TO_ST_IMAGES
        !            66: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.