OSDN Git Service

[VM][I286] Save cpustate without StateBuffer().
[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_TAPE_BUTTON
32 #define NOTIFY_KEY_DOWN
33 #define USE_ALT_F10_KEY
34 #define USE_AUTO_KEY            5
35 #define USE_AUTO_KEY_RELEASE    6
36 #define USE_AUTO_KEY_CAPS
37
38 #define USE_SOUND_VOLUME        2
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("CMT (Signal)"), _T("Noise (CMT)"),
50 };
51 #endif
52
53 class csp_state_utils;
54 class EMU;
55 class DEVICE;
56 class EVENT;
57
58 class DATAREC;
59 class I8080;
60 class MEMORY;
61 class RP5C01;
62
63 class FP200_IO;
64
65 class VM : public VM_TEMPLATE
66 {
67 protected:
68         //EMU* emu;
69         //csp_state_utils *state_entry;
70         
71         // devices
72         //EVENT* event;
73         
74         DATAREC* drec;
75         I8080* cpu;
76         MEMORY* memory;
77         RP5C01* rtc;
78         
79         FP200_IO* io;
80         
81         // memory
82         uint8_t rom[0x8000];
83         uint8_t ram[0x8000];
84         
85 public:
86         // ----------------------------------------
87         // initialize
88         // ----------------------------------------
89         
90         VM(EMU* parent_emu);
91         ~VM();
92         
93         // ----------------------------------------
94         // for emulation class
95         // ----------------------------------------
96         
97         // drive virtual machine
98         void reset();
99         void run();
100         
101 #ifdef USE_DEBUGGER
102         // debugger
103         DEVICE *get_cpu(int index);
104 #endif
105         
106         // draw screen
107         void draw_screen();
108         
109         // sound generation
110         void initialize_sound(int rate, int samples);
111         uint16_t* create_sound(int* extra_frames);
112         int get_sound_buffer_ptr();
113 #ifdef USE_SOUND_VOLUME
114         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
115 #endif
116         
117         // notify key
118         void key_down(int code, bool repeat);
119         void key_up(int code);
120         
121         // user interface
122         void play_tape(int drv, const _TCHAR* file_path);
123         void rec_tape(int drv, const _TCHAR* file_path);
124         void close_tape(int drv);
125         bool is_tape_inserted(int drv);
126         bool is_tape_playing(int drv);
127         bool is_tape_recording(int drv);
128         int get_tape_position(int drv);
129         const _TCHAR* get_tape_message(int drv);
130         void push_play(int drv);
131         void push_stop(int drv);
132         void push_fast_forward(int drv);
133         void push_fast_rewind(int drv);
134         void push_apss_forward(int drv) {}
135         void push_apss_rewind(int drv) {}
136         bool is_frame_skippable();
137         
138         void update_config();
139         bool process_state(FILEIO* state_fio, bool loading);
140         
141         // ----------------------------------------
142         // for each device
143         // ----------------------------------------
144         
145         // devices
146         DEVICE* get_device(int id);
147         //DEVICE* dummy;
148         //DEVICE* first_device;
149         //DEVICE* last_device;
150 };
151
152 #endif