OSDN Git Service

4cc7a2453ac6d5639b1b459e8a58cf7d9f77677a
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc9801 / floppy.h
1 /*
2         NEC PC-9801 Emulator 'ePC-9801'
3         NEC PC-9801E/F/M Emulator 'ePC-9801E'
4         NEC PC-9801U Emulator 'ePC-9801U'
5         NEC PC-9801VF Emulator 'ePC-9801VF'
6         NEC PC-9801VM Emulator 'ePC-9801VM'
7         NEC PC-9801VX Emulator 'ePC-9801VX'
8         NEC PC-9801RA Emulator 'ePC-9801RA'
9         NEC PC-98XA Emulator 'ePC-98XA'
10         NEC PC-98XL Emulator 'ePC-98XL'
11         NEC PC-98RL Emulator 'ePC-98RL'
12         NEC PC-98DO Emulator 'ePC-98DO'
13
14         Author : Takeda.Toshiya
15         Date   : 2010.09.15-
16
17         [ floppy ]
18 */
19
20 #ifndef _FLOPPY_H_
21 #define _FLOPPY_H_
22
23 #include "../vm.h"
24 #include "../../emu.h"
25 #include "../device.h"
26
27 #if defined(SUPPORT_2HD_FDD_IF)
28 #define SIG_FLOPPY_2HD_IRQ      0
29 #define SIG_FLOPPY_2HD_DRQ      1
30 #endif
31 #if defined(SUPPORT_2DD_FDD_IF)
32 #define SIG_FLOPPY_2DD_IRQ      2
33 #define SIG_FLOPPY_2DD_DRQ      3
34 #endif
35 #if defined(SUPPORT_2HD_2DD_FDD_IF)
36 #define SIG_FLOPPY_IRQ  0
37 #define SIG_FLOPPY_DRQ  1
38 #endif
39
40 class UPD765A;
41
42 class FLOPPY : public DEVICE
43 {
44 private:
45 #if defined(SUPPORT_2HD_FDD_IF)
46         UPD765A *d_fdc_2hd;
47         uint8_t ctrlreg_2hd;
48 #endif
49 #if defined(SUPPORT_2DD_FDD_IF)
50         UPD765A *d_fdc_2dd;
51         uint8_t ctrlreg_2dd;
52 #endif
53 #if defined(SUPPORT_2HD_2DD_FDD_IF)
54         UPD765A *d_fdc;
55         uint8_t ctrlreg, modereg;
56 #endif
57         DEVICE *d_dma, *d_pic;
58         
59         int timer_id;
60         
61 public:
62         FLOPPY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
63         {
64                 set_device_name(_T("Floppy I/F"));
65         }
66         ~FLOPPY() {}
67         
68         // common functions
69         void reset();
70         void write_io8(uint32_t addr, uint32_t data);
71         uint32_t read_io8(uint32_t addr);
72         void write_signal(int id, uint32_t data, uint32_t mask);
73         void event_callback(int event_id, int err);
74         bool process_state(FILEIO* state_fio, bool loading);
75         
76         // unique functions
77 #if defined(SUPPORT_2HD_FDD_IF)
78         void set_context_fdc_2hd(UPD765A* device)
79         {
80                 d_fdc_2hd = device;
81         }
82 #endif
83 #if defined(SUPPORT_2DD_FDD_IF)
84         void set_context_fdc_2dd(UPD765A* device)
85         {
86                 d_fdc_2dd = device;
87         }
88 #endif
89 #if defined(SUPPORT_2HD_2DD_FDD_IF)
90         void set_context_fdc(UPD765A* device)
91         {
92                 d_fdc = device;
93         }
94 #endif
95         void set_context_dma(DEVICE* device)
96         {
97                 d_dma = device;
98         }
99         void set_context_pic(DEVICE* device)
100         {
101                 d_pic = device;
102         }
103 };
104
105 #endif
106