2 Skelton for retropc emulator
4 Author : Takeda.Toshiya
17 #define SIG_T3444A_DRIVE 0
18 #define SIG_T3444A_TND 1
19 #define SIG_T3444A_MOTOR 2
22 #define SIG_T3444A_DRDY 4
23 #define SIG_T3444A_CRDY 5
24 #define SIG_T3444A_RQM 6
27 #define SECTORS_IN_TRACK 16
29 #define SECTORS_IN_TRACK 26
35 class T3444A : public DEVICE
39 outputs_t outputs_rqm;
43 NOISE* d_noise_head_down;
44 NOISE* d_noise_head_up;
54 int next_trans_position;
55 int bytes_before_2nd_rqm;
56 int next_sync_position;
70 uint8_t sector_id[SECTORS_IN_TRACK * 4];
75 void cancel_my_event(int event);
76 void register_my_event(int event, double usec);
77 void register_seek_event();
78 void register_rqm_event(int bytes);
79 void register_lost_event(int bytes);
89 uint32_t prev_rqm_clock;
91 int get_cur_position();
92 double get_usec_to_start_trans();
93 double get_usec_to_next_trans_pos();
94 double get_usec_to_detect_index_hole(int count);
97 uint8_t search_sector();
101 void cmd_seek_zero();
103 void cmd_read_write();
106 void update_head_flag(int drv, bool head_load);
109 void set_rqm(bool val);
112 T3444A(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
114 initialize_output_signals(&outputs_rqm);
116 d_noise_head_down = NULL;
117 d_noise_head_up = NULL;
120 set_device_name(_T("T3444A FDC"));
128 void write_io8(uint32_t addr, uint32_t data);
129 uint32_t read_io8(uint32_t addr);
130 void write_dma_io8(uint32_t addr, uint32_t data);
131 uint32_t read_dma_io8(uint32_t addr);
132 void write_signal(int id, uint32_t data, uint32_t mask);
133 uint32_t read_signal(int ch);
134 void event_callback(int event_id, int err);
135 void update_config();
136 void save_state(FILEIO* state_fio);
137 bool load_state(FILEIO* state_fio);
140 void set_context_rqm(DEVICE* device, int id, uint32_t mask)
142 register_output_signal(&outputs_rqm, device, id, mask);
144 void set_context_noise_seek(NOISE* device)
146 d_noise_seek = device;
148 NOISE* get_context_noise_seek()
152 void set_context_noise_head_down(NOISE* device)
154 d_noise_head_down = device;
156 NOISE* get_context_noise_head_down()
158 return d_noise_head_down;
160 void set_context_noise_head_up(NOISE* device)
162 d_noise_head_up = device;
164 NOISE* get_context_noise_head_up()
166 return d_noise_head_up;
168 DISK* get_disk_handler(int drv)
172 void open_disk(int drv, const _TCHAR* file_path, int bank);
173 void close_disk(int drv);
174 bool is_disk_inserted(int drv);
175 void is_disk_protected(int drv, bool value);
176 bool is_disk_protected(int drv);
177 void set_drive_type(int drv, uint8_t type);
178 uint8_t get_drive_type(int drv);
179 void set_drive_rpm(int drv, int rpm);
180 void set_drive_mfm(int drv, bool mfm);