OSDN Git Service

[ROMAKANA] More supported VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / bmjr / bmjr.h
1 /*
2         HITACH BASIC Master Jr Emulator 'eBASICMasterJr'
3
4         Author : Takeda.Toshiya
5         Date   : 2015.08.28-
6
7         [ virtual machine ]
8 */
9
10 #ifndef _BMJR_H_
11 #define _BMJR_H_
12
13 #define DEVICE_NAME             "HITACHI BASIC Master Jr"
14 #define CONFIG_NAME             "bmjr"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          60
18 #define LINES_PER_FRAME         262
19 #define CPU_CLOCKS              754560
20 #define SCREEN_WIDTH            256
21 #define SCREEN_HEIGHT           192
22 //#define HAS_MB8861
23 #define HAS_MC6800
24
25 // device informations for win32
26 #define USE_TAPE
27 #define USE_TAPE_BUTTON
28 #define NOTIFY_KEY_DOWN
29 #define USE_ALT_F10_KEY
30 #define USE_AUTO_KEY            8
31 #define USE_AUTO_KEY_RELEASE    10
32 #define SUPPORT_ROMA_KANA_CONVERSION
33 //#define USE_CRT_FILTER
34 //#define USE_SCANLINE
35 #define USE_SOUND_FILES 2
36 //#define USE_SOUND_FILES_FDD
37 #define USE_SOUND_FILES_RELAY
38 #if defined(USE_SOUND_FILES)
39 #define USE_SOUND_VOLUME        3
40 #else
41 #define USE_SOUND_VOLUME        2
42 #endif
43 #define USE_DEBUGGER
44 #define USE_STATE
45
46 #include "../../common.h"
47 #include "../../fileio.h"
48
49 #ifdef USE_SOUND_VOLUME
50 static const _TCHAR *sound_device_caption[] = {
51         _T("Beep"), _T("CMT"),
52 #if defined(USE_SOUND_FILES)
53         _T("CMT RELAY"),
54 #endif
55 };
56 #endif
57
58 class EMU;
59 class DEVICE;
60 class EVENT;
61
62 class DATAREC;
63 class MC6800;
64 class MC6820;
65
66 class MEMORY;
67
68 class VM
69 {
70 protected:
71         EMU* emu;
72         
73         // devices
74         EVENT* event;
75         
76         DATAREC* drec;
77         MC6800* cpu;
78         MC6820* pia;
79         
80         MEMORY* memory;
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 special_reset();
97         void run();
98         double get_frame_rate();
99         
100 #ifdef USE_DEBUGGER
101         // debugger
102         DEVICE *get_cpu(int index);
103 #endif
104         
105         // draw screen
106         void draw_screen();
107 //      uint32_t get_access_lamp_status();
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(const _TCHAR* file_path);
123         void rec_tape(const _TCHAR* file_path);
124         void close_tape();
125         bool is_tape_inserted();
126         bool is_tape_playing();
127         bool is_tape_recording();
128         int get_tape_position();
129         void push_play();
130         void push_stop();
131         void push_fast_forward();
132         void push_fast_rewind();
133         void push_apss_forward() {}
134         void push_apss_rewind() {}
135         bool is_frame_skippable();
136         
137         void update_config();
138         void save_state(FILEIO* state_fio);
139         bool load_state(FILEIO* state_fio);
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