OSDN Git Service

[VM]Add PC6001/6601.
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc6001 / psub.h
1 /*
2         NEC PC-6001 Emulator 'yaPC-6001'
3         NEC PC-6001mkII Emulator 'yaPC-6201'
4         NEC PC-6001mkIISR Emulator 'yaPC-6401'
5         NEC PC-6601 Emulator 'yaPC-6601'
6         NEC PC-6601SR Emulator 'yaPC-6801'
7
8         Author : tanam
9         Date   : 2013.07.15-
10
11         [ pseudo sub cpu ]
12 */
13
14 #ifndef _PSUB_H_
15 #define _PSUB_H_
16
17 #include "../vm.h"
18 #include "../../emu.h"
19 #include "../device.h"
20
21 class FILEIO;
22
23 #if defined(_USE_QT) || defined(_USE_AGAR)
24 typedef uint8 byte;
25 #endif
26
27 class PSUB : public DEVICE
28 {
29 private:
30         DEVICE *d_pio, *d_timer;
31         
32         // data recorder
33         FILEIO* fio;
34         bool play, rec, is_wav, is_p6t;
35         _TCHAR rec_file_path[_MAX_PATH];
36         int CasIntFlag;
37         int CasIndex;
38         int CasRecv;
39         int CasMode;
40         int CasBaud, FileBaud;
41         uint8 CasData[0x10000];
42         int CasLength;
43         int CasSkipFlag;
44         
45         uint8* key_stat;
46         int kbFlagFunc;
47         int kbFlagGraph;
48         int kbFlagCtrl;
49         int kanaMode;
50         int katakana;
51         int p6key;
52         int stick0;
53         int StrigIntFlag;
54         int StrigEventID;
55         void update_keyboard();
56         
57 public:
58         PSUB(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
59         ~PSUB() {}
60         
61         // common functions
62         void initialize();
63         void release();
64         void reset();
65         void write_io8(uint32 addr, uint32 data);
66         uint32 read_io8(uint32 addr);
67         void event_frame();
68         void event_callback(int event_id, int err);
69         uint32 intr_ack();
70         void save_state(FILEIO* state_fio);
71         bool load_state(FILEIO* state_fio);
72         
73         // unique functions
74         void set_context_pio(DEVICE* device)
75         {
76                 d_pio = device;
77         }
78         void set_context_timer(DEVICE* device)
79         {
80                 d_timer = device;
81         }
82         bool play_tape(_TCHAR* file_path);
83         bool rec_tape(_TCHAR* file_path);
84         void close_tape();
85         bool tape_inserted()
86         {
87                 return (play || rec);
88         }
89         int get_tape_ptr()
90         {
91                 if(CasLength <= 0) return 0;
92                 return (CasIndex * 100) / CasLength;
93         }
94 };
95 #endif