OSDN Git Service

[VM][I286] Save cpustate without StateBuffer().
[csp-qt/common_source_project-fm7.git] / source / src / vm / mz700 / quickdisk.h
1 /*
2         SHARP MZ-800 Emulator 'EmuZ-800'
3         SHARP MZ-1500 Emulator 'EmuZ-1500'
4         SHARP MZ-2200 Emulator 'EmuZ-2200'
5
6         Author : Takeda.Toshiya
7         Date   : 2011.02.17-
8
9         [ quick disk ]
10 */
11
12 #ifndef _QUICKDISK_H_
13 #define _QUICKDISK_H_
14
15 #include "../vm.h"
16 #include "../../emu.h"
17 #include "../device.h"
18
19 #define QUICKDISK_SIO_RTSA      0
20 #define QUICKDISK_SIO_DTRB      1
21 #define QUICKDISK_SIO_SYNC      2
22 #define QUICKDISK_SIO_RXDONE    3
23 #define QUICKDISK_SIO_DATA      4
24 #define QUICKDISK_SIO_BREAK     5
25
26 #define QUICKDISK_BUFFER_SIZE   65536
27
28 class QUICKDISK : public DEVICE
29 {
30 private:
31         DEVICE *d_sio;
32         
33         _TCHAR file_path[_MAX_PATH];
34         bool insert, protect, home;
35         bool modified;
36         bool accessed;
37         
38         uint16_t buffer[QUICKDISK_BUFFER_SIZE];
39         int buffer_ptr, write_ptr;
40         bool first_data;
41         bool send_break;
42         
43         bool wrga, mton, sync;
44         bool motor_on;
45         int restore_id, end_id;
46         
47         void restore();
48         void send_data();
49         void write_crc();
50         void end_of_disk();
51         void set_insert(bool val);
52         void set_protect(bool val);
53         void set_home(bool val);
54         void release_disk();
55         
56 public:
57         QUICKDISK(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
58         {
59                 set_device_name(_T("Quick Disk"));
60         }
61         ~QUICKDISK() {}
62         
63         // common functions
64         void initialize();
65         void release();
66         void reset();
67         void write_signal(int id, uint32_t data, uint32_t mask);
68         uint32_t read_signal(int ch);
69         void event_callback(int event_id, int err);
70         bool process_state(FILEIO* state_fio, bool loading);
71         
72         // unique functions
73         void set_context_sio(DEVICE* device)
74         {
75                 d_sio = device;
76         }
77         void open_disk(const _TCHAR* path);
78         void close_disk();
79         bool is_disk_inserted()
80         {
81                 return insert;
82         }
83 };
84
85 #endif
86