OSDN Git Service

[VM][FMTOWNS][MEMORY] Fix setup around memory banks by I/O 0404h and 0480h.
[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
24 // device informations for win32
25 #define WINDOW_MODE_BASE        3
26 #define USE_BOOT_MODE           2
27 #define USE_TAPE                1
28 #define USE_AUTO_KEY            5
29 #define USE_AUTO_KEY_RELEASE    6
30 #define USE_AUTO_KEY_CAPS
31
32 #define USE_SOUND_VOLUME        2
33 #define USE_DEBUGGER
34 #define USE_STATE
35 #define USE_CPU_I8080
36
37 #include "../../common.h"
38 #include "../../fileio.h"
39 #include "../vm_template.h"
40
41 #ifdef USE_SOUND_VOLUME
42 static const _TCHAR *sound_device_caption[] = {
43         _T("CMT (Signal)"), _T("Noise (CMT)"),
44 };
45 #endif
46
47 class EMU;
48 class DEVICE;
49 class EVENT;
50
51 class DATAREC;
52 class I8080;
53 class MEMORY;
54 class RP5C01;
55
56 namespace FP200 {
57         class IO;
58 }
59 class VM : public VM_TEMPLATE
60 {
61 protected:
62         //EMU* emu;
63         //csp_state_utils *state_entry;
64
65         // devices
66         //EVENT* event;
67
68         DATAREC* drec;
69         I8080* cpu;
70         MEMORY* memory;
71         RP5C01* rtc;
72
73         FP200::IO* io;
74
75         // memory
76         uint8_t rom[0x8000];
77         uint8_t ram[0x8000];
78
79 public:
80         // ----------------------------------------
81         // initialize
82         // ----------------------------------------
83
84         VM(EMU_TEMPLATE* parent_emu);
85         ~VM();
86
87         // ----------------------------------------
88         // for emulation class
89         // ----------------------------------------
90
91         // drive virtual machine
92         //void reset();
93         void run() override;
94         double get_frame_rate() override
95         {
96                 return FRAMES_PER_SEC;
97         }
98
99 #ifdef USE_DEBUGGER
100         // debugger
101         DEVICE *get_cpu(int index) override;
102 #endif
103
104         // draw screen
105         void draw_screen() override;
106
107         // sound generation
108         void initialize_sound(int rate, int samples) override;
109         uint16_t* create_sound(int* extra_frames) override;
110         int get_sound_buffer_ptr() override;
111 #ifdef USE_SOUND_VOLUME
112         void set_sound_device_volume(int ch, int decibel_l, int decibel_r) override;
113 #endif
114
115         // notify key
116         void key_down(int code, bool repeat) override;
117         void key_up(int code) override;
118
119         // user interface
120         void play_tape(int drv, const _TCHAR* file_path) override;
121         void rec_tape(int drv, const _TCHAR* file_path) override;
122         void close_tape(int drv) override;
123         bool is_tape_inserted(int drv) override;
124         bool is_tape_playing(int drv) override;
125         bool is_tape_recording(int drv) override;
126         int get_tape_position(int drv) override;
127         const _TCHAR* get_tape_message(int drv) override;
128         void push_play(int drv) override;
129         void push_stop(int drv) override;
130         void push_fast_forward(int drv) override;
131         void push_fast_rewind(int drv) override;
132         void push_apss_forward(int drv)  override {}
133         void push_apss_rewind(int drv)  override {}
134         bool is_frame_skippable() override;
135
136         double get_current_usec() override;
137         uint64_t get_current_clock_uint64() override;
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