OSDN Git Service

ef2a57d5f4744f6ac38deb6f9161f61d0a856940
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz700 / floppy.h
1 /*
2         SHARP MZ-800 Emulator 'EmuZ-800'
3         SHARP MZ-1500 Emulator 'EmuZ-1500'
4
5         Author : Takeda.Toshiya
6         Date   : 2011.05.16-
7
8         [ floppy ]
9 */
10
11 #ifndef _FLOPPY_H_
12 #define _FLOPPY_H_
13
14 #include "../vm.h"
15 #include "../../emu.h"
16 #include "../device.h"
17
18 #define SIG_FLOPPY_DRQ  0
19
20 class FLOPPY : public DEVICE
21 {
22 private:
23         DEVICE* d_cpu;
24         DEVICE* d_fdc;
25         
26         uint32_t prev_dc;
27         int register_id;
28         bool motor_on;
29         bool irq_enabled;
30         
31 public:
32         FLOPPY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
33         {
34                 set_device_name(_T("Floppy I/F"));
35         }
36         ~FLOPPY() {}
37         
38         // common functions
39         void initialize();
40         void reset();
41         void write_io8(uint32_t addr, uint32_t data);
42         void event_callback(int event_id, int err);
43         void write_signal(int id, uint32_t data, uint32_t mask);
44         void decl_state();
45         void save_state(FILEIO* state_fio);
46         bool load_state(FILEIO* state_fio);
47         
48         // unique functions
49         void set_context_cpu(DEVICE* device)
50         {
51                 d_cpu = device;
52         }
53         void set_context_fdc(DEVICE* device)
54         {
55                 d_fdc = device;
56         }
57 };
58
59 #endif
60