2 Skelton for retropc emulator
5 Author : Takeda.Toshiya
18 #define SIG_MB8877_DRIVEREG 0
19 #define SIG_MB8877_SIDEREG 1
20 #define SIG_MB8877_MOTOR 2
24 class MB8877 : public DEVICE
31 outputs_t outputs_irq;
32 outputs_t outputs_drq;
41 int next_trans_position;
42 int next_sync_position;
45 DISK* disk[MAX_DRIVE];
48 uint8 status, status_tmp;
49 uint8 cmdreg, cmdreg_tmp;
62 bool now_seek, after_seek;
70 uint32 prev_drq_clock;
72 int get_cur_position();
73 double get_usec_to_start_trans();
77 uint8 search_sector(int trk, int side, int sct, bool compare);
91 void cmd_writetrack();
95 void set_irq(bool val);
96 void set_drq(bool val);
99 MB8877(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
101 init_output_signals(&outputs_irq);
102 init_output_signals(&outputs_drq);
111 void write_io8(uint32 addr, uint32 data);
112 uint32 read_io8(uint32 addr);
113 void write_dma_io8(uint32 addr, uint32 data);
114 uint32 read_dma_io8(uint32 addr);
115 void write_signal(int id, uint32 data, uint32 mask);
116 uint32 read_signal(int ch);
117 void event_callback(int event_id, int err);
118 void update_config();
119 void save_state(FILEIO* state_fio);
120 bool load_state(FILEIO* state_fio);
123 void set_context_irq(DEVICE* device, int id, uint32 mask)
125 register_output_signal(&outputs_irq, device, id, mask);
127 void set_context_drq(DEVICE* device, int id, uint32 mask)
129 register_output_signal(&outputs_drq, device, id, mask);
131 DISK* get_disk_handler(int drv)
135 void open_disk(int drv, _TCHAR path[], int offset);
136 void close_disk(int drv);
137 bool disk_inserted(int drv);
138 void set_drive_type(int drv, uint8 type);
139 uint8 get_drive_type(int drv);
140 void set_drive_rpm(int drv, int rpm);
141 void set_drive_mfm(int drv, bool mfm);
143 void write_protect_fd(int drive, bool flag) {
144 if((drive >= MAX_DRIVE) || (drive < 0)) return;
145 disk[drive]->write_protected = flag;
147 bool is_write_protect_fd(int drive) {
148 if((drive >= MAX_DRIVE) || (drive < 0)) return true; // Protected
149 return disk[drive]->write_protected;