OSDN Git Service

[VM][WIP] Apply some devices merging upstream 2018-10-05.This still not build.WIP.
[csp-qt/common_source_project-fm7.git] / source / src / vm / tf20.h
1 /*
2         Skelton for retropc emulator
3
4         Author : Takeda.Toshiya
5         Date   : 2015.01.30-
6
7         [ EPSON TF-20 ]
8 */
9
10 #ifndef _TF20_H_
11 #define _TF20_H_
12
13 //#include "vm.h"
14 //#include "../emu.h"
15 #include "device.h"
16 class VM;
17 class EMU;
18 class TF20 : public DEVICE
19 {
20 private:
21         DEVICE *d_cpu, *d_fdc, *d_pio, *d_sio;
22         
23         uint8_t rom[0x800];
24         uint8_t ram[0x10000];
25         bool rom_selected;
26         
27         uint8_t wdmy[0x800];
28         uint8_t rdmy[0x800];
29         uint8_t* wbank[32];
30         uint8_t* rbank[32];
31         
32 public:
33         TF20(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
34         {
35                 drive_no = 0;
36                 set_device_name(_T("TF-20 FDD"));
37         }
38         ~TF20() {}
39         
40         // common functions
41         void initialize();
42         void reset();
43         uint32_t read_data8(uint32_t addr);
44         void write_data8(uint32_t addr, uint32_t data);
45         uint32_t read_io8(uint32_t addr);
46         void write_io8(uint32_t addr, uint32_t data);
47         uint32_t get_intr_ack();
48         bool process_state(FILEIO* state_fio, bool loading);
49         
50         // unique functions
51         void set_context_cpu(DEVICE* device)
52         {
53                 d_cpu = device;
54         }
55         void set_context_fdc(DEVICE* device)
56         {
57                 d_fdc = device;
58         }
59         void set_context_pio(DEVICE* device)
60         {
61                 d_pio = device;
62         }
63         void set_context_sio(DEVICE* device)
64         {
65                 d_sio = device;
66         }
67         int drive_no;
68 };
69
70 #endif
71