forked from WerWolv/ImHex-Patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
intel_hex.hexpat
51 lines (45 loc) · 1.48 KB
/
intel_hex.hexpat
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
/* If you have no delimiters between data records then remove
* the null_bytes field in the data_packet struct.
* Set the array at the bottom to the highest index + 1 in the Pattern Data view
* NOTE: these were ascii hex values for me, so use the calculator tool to convert
* values
*/
#pragma endian big
enum FileType: u16 {
Data = 0x3030,
EOF = 0x3031,
Extended_Segment_Address = 0x3032,
Start_Segment_Address = 0x3033,
Extended_Linear_Address = 0x3034,
Start_Linear_Address = 0x3035
};
struct Bytes {
u8 HOB [[color("00FF6699")]];
u8 LOB [[color("00FF6699")]];
};
struct data_packet {
char start_code [[color("00EFECCA")]];
Bytes byte_count [[color("00A9CBB7")]];
u32 address [[color("00F7FF58")]];
FileType recordType [[color("00FF934F")]];
// both not A
if (byte_count.HOB < 65 && byte_count.LOB < 65) {
u16 data[((byte_count.HOB - 48) * 16)
+ (byte_count.LOB - 48)] [[color("0095B46A")]];
// HOB is A but LOB is not
} else if (byte_count.HOB >= 65 && byte_count.LOB < 65) {
u16 data[((byte_count.HOB - 55) * 16)
+ (byte_count.LOB - 48)] [[color("0095B46A")]];
// LOB is A but HOB is not
} else if (byte_count.HOB < 65 && byte_count.LOB >= 65) {
u16 data[((byte_count.HOB - 48) * 16)
+ (byte_count.LOB - 55)] [[color("0095B46A")]];
// both are A
} else {
u16 data[((byte_count.HOB - 55) * 16)
+ (byte_count.LOB - 55)] [[color("0095B46A")]];
}
u16 checksum [[color("0045F0DF")]];
u16 null_bytes [[color("005E565A")]];
};
data_packet data[1418] @ 0x00;