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

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: 
1.1.1.2 ! root       32: /*-----------------------------------------------------------------------*/
1.1       root       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: 
1.1.1.2 ! root       41:   /* Just load directly into buffer, and set ImageSize accordingly (no need to free memory) */
1.1       root       42:   pSTFile = File_Read(pszFileName,pBuffer,&ImageSize,NULL);
                     43:   if (!pSTFile)
                     44:     ImageSize = 0;
                     45: 
                     46:   return(ImageSize);
                     47: }
                     48: 
1.1.1.2 ! root       49: 
        !            50: /*-----------------------------------------------------------------------*/
1.1       root       51: /*
                     52:   Save .ST file from memory buffer. Returns TRUE is all OK
                     53: */
                     54: BOOL ST_WriteDisc(char *pszFileName,unsigned char *pBuffer,int ImageSize)
                     55: {
                     56: #ifdef SAVE_TO_ST_IMAGES
                     57: 
1.1.1.2 ! root       58:   /* Just save buffer directly to file */
        !            59:   return( File_Save(pszFileName, pBuffer, ImageSize, FALSE) );
1.1       root       60: 
1.1.1.2 ! root       61: #else   /*SAVE_TO_ST_IMAGES*/
1.1       root       62: 
1.1.1.2 ! root       63:   /* Oops, cannot save */
1.1       root       64:   return(FALSE);
                     65: 
1.1.1.2 ! root       66: #endif  /*SAVE_TO_ST_IMAGES*/
1.1       root       67: }

unix.superglobalmegacorp.com

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