OSDN Git Service

d5e30d29d9657b74e84890af5ac5f35e879859f5
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc8201 / pc8201.h
1 /*
2         NEC PC-8201 Emulator 'ePC-8201'
3
4         Author : Takeda.Toshiya
5         Date   : 2009.03.31-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _PC8201_H_
11 #define _PC8201_H_
12
13 #ifdef _PC8201A
14 #define DEVICE_NAME             "NEC PC-8201A"
15 #define CONFIG_NAME             "pc8201a"
16 #else
17 #define DEVICE_NAME             "NEC PC-8201"
18 #define CONFIG_NAME             "pc8201"
19 #endif
20
21 // device informations for virtual machine
22 #define FRAMES_PER_SEC          60
23 #define LINES_PER_FRAME         64
24 #define CPU_CLOCKS              2457600
25 #define SCREEN_WIDTH            240
26 #define SCREEN_HEIGHT           64
27 #define HAS_I8085
28
29 // device informations for win32
30 #define USE_TAPE                1
31 #define USE_TAPE_BUTTON
32 #define NOTIFY_KEY_DOWN
33 #define USE_KEY_LOCKED
34 #define USE_ALT_F10_KEY
35 #define USE_AUTO_KEY            5
36 #define USE_AUTO_KEY_RELEASE    6
37 #define USE_AUTO_KEY_CAPS
38 #define USE_SOUND_VOLUME        3
39 #define USE_DEBUGGER
40 #define USE_STATE
41 #define USE_CPU_I8080
42
43 #include "../../common.h"
44 #include "../../fileio.h"
45 #include "../vm_template.h"
46
47 #ifdef USE_SOUND_VOLUME
48 static const _TCHAR *sound_device_caption[] = {
49         _T("Beep"), _T("CMT (Signal)"), _T("Noise (CMT)"),
50 };
51 #endif
52
53 class csp_state_utils;
54
55 class EMU;
56 class DEVICE;
57 class EVENT;
58
59 class DATAREC;
60 class I8080;
61 class I8155;
62 class IO;
63 class PCM1BIT;
64 class UPD1990A;
65
66 class CMT;
67 class KEYBOARD;
68 class LCD;
69 class PC8201_MEMORY;
70
71 class VM :public VM_TEMPLATE
72 {
73 protected:
74         //EMU* emu;
75         //csp_state_utils *state_entry;
76         
77         // devices
78         //EVENT* event;
79         
80         DATAREC* drec;
81         I8080* cpu;
82         I8155* pio;
83         IO* io;
84         PCM1BIT* pcm;
85         UPD1990A* rtc;
86         
87         CMT* cmt;
88         KEYBOARD* keyboard;
89         LCD* lcd;
90         PC8201_MEMORY* memory;
91         
92 public:
93         // ----------------------------------------
94         // initialize
95         // ----------------------------------------
96         
97         VM(EMU* parent_emu);
98         ~VM();
99         
100         // ----------------------------------------
101         // for emulation class
102         // ----------------------------------------
103         
104         // drive virtual machine
105         void reset();
106         void run();
107         
108 #ifdef USE_DEBUGGER
109         // debugger
110         DEVICE *get_cpu(int index);
111 #endif
112         
113         // draw screen
114         void draw_screen();
115         
116         // sound generation
117         void initialize_sound(int rate, int samples);
118         uint16_t* create_sound(int* extra_frames);
119         int get_sound_buffer_ptr();
120 #ifdef USE_SOUND_VOLUME
121         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
122 #endif
123         
124         // notify key
125         void key_down(int code, bool repeat);
126         void key_up(int code);
127         bool get_caps_locked();
128         bool get_kana_locked();
129         
130         // user interface
131         void play_tape(int drv, const _TCHAR* file_path);
132         void rec_tape(int drv, const _TCHAR* file_path);
133         void close_tape(int drv);
134         bool is_tape_inserted(int drv);
135         bool is_tape_playing(int drv);
136         bool is_tape_recording(int drv);
137         int get_tape_position(int drv);
138         const _TCHAR* get_tape_message(int drv);
139         void push_play(int drv);
140         void push_stop(int drv);
141         void push_fast_forward(int drv);
142         void push_fast_rewind(int drv);
143         void push_apss_forward(int drv) {}
144         void push_apss_rewind(int drv) {}
145         bool is_frame_skippable();
146         
147         void update_config();
148         bool process_state(FILEIO* state_fio, bool loading);
149         
150         // ----------------------------------------
151         // for each device
152         // ----------------------------------------
153         
154         // devices
155         DEVICE* get_device(int id);
156         //DEVICE* dummy;
157         //DEVICE* first_device;
158         //DEVICE* last_device;
159 };
160
161 #endif