-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathatx.h
98 lines (84 loc) · 2.35 KB
/
atx.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*! \file atx.h \brief ATX file handling. */
//*****************************************************************************
//
// File Name : 'atx.h'
// Title : ATX file handling
// Author : Daniel Noguerol
// Date : 21/01/2018
// Revised : 21/01/2018
// Version : 0.1
// Target MCU : ???
// Editor Tabs : 4
//
// NOTE: This code is currently below version 1.0, and therefore is considered
// to be lacking in some functionality or documentation, or may not be fully
// tested. Nonetheless, you can expect most functions to work.
//
// This code is distributed under the GNU Public License
// which can be found at http://www.gnu.org/licenses/gpl.txt
//
//*****************************************************************************
#ifndef ATX_TEST_ATX_H
#define ATX_TEST_ATX_H
#define ATX_VERSION 0x01
#define STS_EXTENDED 0x40
struct atxFileHeader {
u08 signature[4];
u16 version;
u16 minVersion;
u16 creator;
u16 creatorVersion;
u32 flags;
u16 imageType;
u08 density;
u08 reserved0;
u32 imageId;
u16 imageVersion;
u16 reserved1;
u32 startData;
u32 endData;
u08 reserved2[12];
};
struct atxTrackHeader {
u32 size;
u16 type;
u16 reserved0;
u08 trackNumber;
u08 reserved1;
u16 sectorCount;
u16 rate;
u16 reserved3;
u32 flags;
u32 headerSize;
u08 reserved4[8];
};
struct atxSectorListHeader {
u32 next;
u16 type;
u16 pad0;
};
struct atxSectorHeader {
u08 number;
u08 status;
u16 timev;
u32 data;
};
struct atxExtendedSectorData {
u32 size;
u08 type;
u08 sectorIndex;
u16 data;
};
/***************************************************************/
/***************************************************************/
// load an ATX file (returns sector size if ATX file is successfully loaded; 0 if not)
u16 loadAtxFile(u08 drive);
// load data for a specific disk sector (returns number of data bytes read or 0 if sector not found)
u16 loadAtxSector(u08 drive, u16 num, unsigned short *sectorSize, u08 *status);
// returns the current head position in angular units
u16 getCurrentHeadPosition();
// increments an angular unit position with a angular displacement
u16 incAngularDisplacement(u16 start, u16 delta);
// delays until head position reaches the specified position
void waitForAngularPosition(u16 pos);
#endif //ATX_TEST_ATX_H