OSDN Git Service

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