OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
[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 namespace PC9801 {
43
44 class FLOPPY : public DEVICE
45 {
46 private:
47 #if defined(SUPPORT_2HD_FDD_IF)
48         UPD765A *d_fdc_2hd;
49         uint8_t ctrlreg_2hd;
50 #endif
51 #if defined(SUPPORT_2DD_FDD_IF)
52         UPD765A *d_fdc_2dd;
53         uint8_t ctrlreg_2dd;
54 #endif
55 #if defined(SUPPORT_2HD_2DD_FDD_IF)
56         UPD765A *d_fdc;
57         uint8_t ctrlreg, modereg;
58 #endif
59         DEVICE *d_dma, *d_pic;
60         
61         int timer_id;
62         
63 public:
64         FLOPPY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
65         {
66                 set_device_name(_T("Floppy I/F"));
67         }
68         ~FLOPPY() {}
69         
70         // common functions
71         void reset();
72         void write_io8(uint32_t addr, uint32_t data);
73         uint32_t read_io8(uint32_t addr);
74         void write_signal(int id, uint32_t data, uint32_t mask);
75         void event_callback(int event_id, int err);
76         bool process_state(FILEIO* state_fio, bool loading);
77         
78         // unique functions
79 #if defined(SUPPORT_2HD_FDD_IF)
80         void set_context_fdc_2hd(UPD765A* device)
81         {
82                 d_fdc_2hd = device;
83         }
84 #endif
85 #if defined(SUPPORT_2DD_FDD_IF)
86         void set_context_fdc_2dd(UPD765A* device)
87         {
88                 d_fdc_2dd = device;
89         }
90 #endif
91 #if defined(SUPPORT_2HD_2DD_FDD_IF)
92         void set_context_fdc(UPD765A* device)
93         {
94                 d_fdc = device;
95         }
96 #endif
97         void set_context_dma(DEVICE* device)
98         {
99                 d_dma = device;
100         }
101         void set_context_pic(DEVICE* device)
102         {
103                 d_pic = device;
104         }
105 };
106
107 }
108 #endif
109