OSDN Git Service

[VM][WIP] Use namespace to devices per VMs.
[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 namespace MZ700 {
21         
22 class FLOPPY : public DEVICE
23 {
24 private:
25         DEVICE* d_cpu;
26         DEVICE* d_fdc;
27         
28         uint32_t prev_dc;
29         int register_id;
30         bool motor_on;
31         bool irq_enabled;
32         
33 public:
34         FLOPPY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
35         {
36                 set_device_name(_T("Floppy I/F"));
37         }
38         ~FLOPPY() {}
39         
40         // common functions
41         void initialize();
42         void reset();
43         void write_io8(uint32_t addr, uint32_t data);
44         void event_callback(int event_id, int err);
45         void write_signal(int id, uint32_t data, uint32_t mask);
46         bool process_state(FILEIO* state_fio, bool loading);
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 }
60 #endif
61