-
Notifications
You must be signed in to change notification settings - Fork 16
/
disc.h
116 lines (101 loc) · 4.89 KB
/
disc.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#ifndef BEEBJIT_DISC_H
#define BEEBJIT_DISC_H
#include <stddef.h>
#include <stdint.h>
struct disc_struct;
struct bbc_options;
struct timing_struct;
struct util_file;
enum {
k_disc_max_bytes_per_track = (256 * 13),
};
/* TODO: these do_convert_* options should be separate function calls, not
* flags to the constructor.
*/
struct disc_struct* disc_create(const char* p_filename,
int is_writeable,
int is_mutable,
int do_convert_to_hfe,
int do_convert_to_ssd,
int do_convert_to_adl,
struct bbc_options* p_options);
struct disc_struct* disc_create_from_raw(const char* p_file_name,
const char* p_raw_spec);
void disc_load(struct disc_struct* p_disc);
void disc_destroy(struct disc_struct* p_disc);
int disc_is_double_sided(struct disc_struct* p_disc);
uint32_t disc_get_num_tracks_used(struct disc_struct* p_disc);
int disc_is_skip_upper_side(struct disc_struct* p_disc);
int disc_is_skip_odd_tracks(struct disc_struct* p_disc);
uint32_t disc_get_required_rev(struct disc_struct* p_disc);
const char* disc_get_file_name(struct disc_struct* p_disc);
struct util_file* disc_get_file(struct disc_struct* p_disc);
uint8_t* disc_allocate_format_metadata(struct disc_struct* p_disc,
size_t num_bytes);
void disc_set_track_length(struct disc_struct* p_disc,
int is_side_upper,
uint32_t track,
uint32_t length);
int disc_is_double_sided(struct disc_struct* p_disc);
int disc_is_write_protected(struct disc_struct* p_disc);
uint8_t* disc_get_format_metadata(struct disc_struct* p_disc);
uint32_t disc_get_track_length(struct disc_struct* p_disc,
int is_side_upper,
uint32_t track);
uint32_t disc_read_pulses(struct disc_struct* p_disc,
int is_side_upper,
uint32_t track,
uint32_t pos);
uint32_t* disc_get_raw_pulses_buffer(struct disc_struct* p_disc,
int is_side_upper,
uint32_t track);
void disc_write_pulses(struct disc_struct* p_disc,
int is_side_upper,
uint32_t track,
uint32_t pos,
uint32_t pulses);
void disc_dirty_and_flush(struct disc_struct* p_disc,
int is_side_upper,
uint32_t track);
void disc_flush_writes(struct disc_struct* p_disc);
void disc_build_track(struct disc_struct* p_disc,
int is_side_upper,
uint32_t track);
void disc_build_set_track_length(struct disc_struct* p_disc);
void disc_build_reset_crc(struct disc_struct* p_disc);
/* FM */
void disc_build_append_fm_data_and_clocks(struct disc_struct* p_disc,
uint8_t data,
uint8_t clocks);
void disc_build_append_fm_byte(struct disc_struct* p_disc, uint8_t data);
void disc_build_append_repeat_fm_byte(struct disc_struct* p_disc,
uint8_t data,
size_t num);
void disc_build_append_repeat_fm_byte_with_clocks(struct disc_struct* p_disc,
uint8_t data,
uint8_t clocks,
size_t num);
void disc_build_append_fm_chunk(struct disc_struct* p_disc,
uint8_t* p_src,
size_t num);
/* MFM */
void disc_build_append_mfm_byte(struct disc_struct* p_disc, uint8_t data);
void disc_build_append_repeat_mfm_byte(struct disc_struct* p_disc,
uint8_t data,
uint32_t count);
void disc_build_append_mfm_3x_A1_sync(struct disc_struct* p_disc);
void disc_build_append_mfm_chunk(struct disc_struct* p_disc,
uint8_t* p_src,
uint32_t count);
void disc_build_fill_mfm_byte(struct disc_struct* p_disc, uint8_t data);
void disc_build_append_crc(struct disc_struct* p_disc, int is_mfm);
void disc_build_append_bad_crc(struct disc_struct* p_disc);
void disc_build_fill_fm_byte(struct disc_struct* p_disc, uint8_t data);
/* Raw pulses. */
void disc_build_track_from_pulses(struct disc_struct* p_disc,
uint32_t rev,
int is_side_upper,
uint32_t track,
float* p_pulse_deltas,
uint32_t num_pulses);
#endif /* BEEBJIT_DISC_H */