/[projet1]/public/pc/tools/osdk/main/makedisk/Floppy.h
Defence Force logotype

Contents of /public/pc/tools/osdk/main/makedisk/Floppy.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1002 - (show annotations)
Sun Dec 8 10:50:26 2013 UTC (6 years, 3 months ago) by dbug
File MIME type: text/plain
File size: 1781 byte(s)
Resynchronized my own changes to the OSDK with what was in the depot.
From now on I will continue the changes directly with the depot version, and try to update more regularly.
The reason I had this big change is that I had two computers with local changes done in demo parties when working on demos, where I did the fixes to handle Euphoric and Oricutron, plus new tools, modified tools, etc... giant mess.
I do not guarantee that what is on the depot is bug free, but it's the version I'm using right now (My OSDK var points to the public\pc\tools\osdk\main\Osdk\_final_ folder.
1 #ifndef FLOPPY_H_
2 #define FLOPPY_H_
3
4 #include <vector>
5
6 // File structure:
7 // MFM_DISK
8
9 #define header_dsk 256+156
10
11 // Nombre de secteur pour une piste
12 #define taille_piste 17
13 #define taille_secteur 256
14 // Header secteur
15 #define nb_oct_before_sector 59 // Cas de 17 secteurs/pistes !
16 #define nb_oct_after_sector 43 //#define nb_oct_after_sector 31
17
18
19 // This class is meant to be mapped on memory area supposed to be of MFM disk format.
20 // The header is 256 bytes long, so this class memory usage should be similar in size and structure.
21 class FloppyHeader
22 {
23 public:
24 FloppyHeader();
25 ~FloppyHeader();
26
27 bool IsValidHeader() const;
28
29 int GetSideNumber() const;
30 int GetTrackNumber() const;
31
32
33 private:
34 char m_Signature[8]; // (MFM_DISK)
35 unsigned char m_Sides[4]; // : 4 bytes (2)
36 unsigned char m_Tracks[4]; // : 4 bytes (42/$2A)
37 unsigned char m_Geometry[4]; // : 4 bytes (1)
38 unsigned char m_Padding[236]; // : 236 bytes (000000...00000 )
39 };
40
41
42 class Floppy
43 {
44 public:
45 Floppy();
46 ~Floppy();
47
48 bool Load(const char* fileName);
49 bool Save(const char* fileName) const;
50
51 unsigned int formule_disk(int track,int sector);
52
53 void writeSector(int track,int sector,const char *fileName);
54
55 int writeFile(const char *fileName,int& track,int& sector); // Returns the number of sectors
56
57 void SetOffset(int track,int sector)
58 {
59 m_Offset=formule_disk(track,sector);
60 }
61
62 void SetOffset(size_t offset)
63 {
64 m_Offset=offset;
65 }
66
67 private:
68 void* m_Buffer;
69 size_t m_BufferSize;
70 size_t m_Offset;
71 int m_TrackNumber; // 42
72 int m_SectorNumber; // 17
73 int m_SideNumber; // 2
74 };
75
76 #endif

  ViewVC Help
Powered by ViewVC 1.1.26