-
Notifications
You must be signed in to change notification settings - Fork 37
/
Copy pathatari.h
70 lines (59 loc) · 1.29 KB
/
atari.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
#ifndef ATARI_H
#define ATARI_H
const byte ACK = 0x41;
const byte NAK = 0x4E;
const byte COMPLETE = 0x43;
const byte ERR = 0x45;
const byte DELAY_T2 = 1;
const byte DELAY_T3 = 2;
const byte DELAY_T4 = 1;
const byte DELAY_T5 = 1;
const byte DENSITY_SD = 1;
const byte DENSITY_ED = 2;
const byte DENSITY_DD = 3;
const unsigned long SD_SECTOR_SIZE = 128;
const unsigned long MAX_SECTOR_SIZE = 128;
struct CommandFrame {
byte deviceId;
byte command;
byte aux1;
byte aux2;
byte checksum;
};
struct HardwareStatus {
byte controllerBusy:1;
byte dataRequestOrIndex:1;
byte dataLostOrTrack0:1;
byte crcError:1;
byte recordNotFound:1;
byte recordType:1;
byte writeProtect:1;
byte notReady:1;
};
struct CommandStatus {
byte invalidCommandFrame:1;
byte invalidDataFrame:1;
byte writeFailure:1;
byte writeProtect:1;
byte motorStatus:1;
byte doubleDensity:1;
byte unused:1;
byte enhancedDensity:1;
};
struct StatusFrame {
CommandStatus commandStatus;
HardwareStatus hardwareStatus;
byte timeout_lsb;
byte timeout_msb;
};
struct DriveStatus {
unsigned long sectorSize;
StatusFrame statusFrame;
};
struct SectorDataInfo {
unsigned long length;
StatusFrame statusFrame;
boolean validStatusFrame;
boolean error;
};
#endif