OSDN Git Service

[VM] TRY:Use namespace {VMNAME} to separate around VMs. This feature still apply...
[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 SUPPORT_TV_RENDER
27 #define USE_TAPE                        1
28 #define USE_TAPE_BUTTON
29 #define NOTIFY_KEY_DOWN
30 #define USE_ALT_F10_KEY
31 #define USE_AUTO_KEY            8
32 #define USE_AUTO_KEY_RELEASE    10
33 //#define USE_SCREEN_FILTER
34 //#define USE_SCANLINE
35 #define USE_SOUND_VOLUME        3
36 #define USE_DEBUGGER
37 #define USE_STATE
38 #define USE_CPU_MC6800
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("Beep"), _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 MC6800;
56 class MC6820;
57 namespace BMJR {
58         class MEMORY;
59 }
60 class VM : public VM_TEMPLATE
61 {
62 protected:
63         //EMU* emu;
64         //csp_state_utils *state_entry;
65         // devices
66         //EVENT* event;
67         
68         DATAREC* drec;
69         MC6800* cpu;
70         MC6820* pia;
71         
72         BMJR::MEMORY* memory;
73         
74 public:
75         // ----------------------------------------
76         // initialize
77         // ----------------------------------------
78         
79         VM(EMU* parent_emu);
80         ~VM();
81         
82         // ----------------------------------------
83         // for emulation class
84         // ----------------------------------------
85         
86         // drive virtual machine
87         void reset();
88         void special_reset();
89         void run();
90         double get_frame_rate();
91         
92 #ifdef USE_DEBUGGER
93         // debugger
94         DEVICE *get_cpu(int index);
95 #endif
96         
97         // draw screen
98         void draw_screen();
99         
100         // sound generation
101         void initialize_sound(int rate, int samples);
102         uint16_t* create_sound(int* extra_frames);
103         int get_sound_buffer_ptr();
104 #ifdef USE_SOUND_VOLUME
105         void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
106 #endif
107         
108         // notify key
109         void key_down(int code, bool repeat);
110         void key_up(int code);
111         
112         // user interface
113         void play_tape(int drv, const _TCHAR* file_path);
114         void rec_tape(int drv, const _TCHAR* file_path);
115         void close_tape(int drv);
116         bool is_tape_inserted(int drv);
117         bool is_tape_playing(int drv);
118         bool is_tape_recording(int drv);
119         int get_tape_position(int drv);
120         const _TCHAR* get_tape_message(int drv);
121         void push_play(int drv);
122         void push_stop(int drv);
123         void push_fast_forward(int drv);
124         void push_fast_rewind(int drv);
125         void push_apss_forward(int drv) {}
126         void push_apss_rewind(int drv) {}
127         bool is_frame_skippable();
128         
129         void update_config();
130         bool process_state(FILEIO* state_fio, bool loading);
131         
132         // ----------------------------------------
133         // for each device
134         // ----------------------------------------
135         
136         // devices
137         DEVICE* get_device(int id);
138         //DEVICE* dummy;
139         //DEVICE* first_device;
140         //DEVICE* last_device;
141 };
142
143 #endif