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 / rx78 / rx78.h
1 /*
2         BANDAI RX-78 Emulator 'eRX-78'
3
4         Author : Takeda.Toshiya
5         Date   : 2006.08.21 -
6
7         [ virtual machine ]
8 */
9
10 #ifndef _RX78_H_
11 #define _RX78_H_
12
13 #define DEVICE_NAME             "BANDAI RX-78"
14 #define CONFIG_NAME             "rx78"
15
16 // device informations for virtual machine
17 #define FRAMES_PER_SEC          60
18 #define LINES_PER_FRAME         262
19 #define CPU_CLOCKS              4090909
20 #define SCREEN_WIDTH            192
21 #define SCREEN_HEIGHT           184
22 #define WINDOW_WIDTH_ASPECT     288
23
24 // device informations for win32
25 #define USE_CART                1
26 #define USE_TAPE                1
27 #define USE_AUTO_KEY            6
28 #define USE_AUTO_KEY_RELEASE    10
29 #define USE_AUTO_KEY_CAPS
30 #define USE_SOUND_VOLUME        3
31 #define SUPPORT_TV_RENDER
32 #define USE_JOYSTICK
33 #define USE_DEBUGGER
34 #define USE_STATE
35 #define USE_CPU_Z80
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("PSG"), _T("CMT (Signal)"), _T("Noise (CMT)"),
44 };
45 #endif
46 class EMU;
47 class DEVICE;
48 class EVENT;
49
50 class DATAREC;
51 class IO;
52 class SN76489AN;
53 class Z80;
54
55 namespace RX78 {
56         class CMT;
57         class KEYBOARD;
58         class MEMORY;
59         class PRINTER;
60         class VDP;
61 }
62
63 class VM : public VM_TEMPLATE
64 {
65 protected:
66         //EMU* emu;
67         // devices
68         //EVENT* event;
69         
70         DATAREC* drec;
71         IO* io;
72         SN76489AN* psg;
73         Z80* cpu;
74         
75         RX78::CMT* cmt;
76         RX78::KEYBOARD* key;
77         RX78::MEMORY* memory;
78         RX78::PRINTER* prt;
79         RX78::VDP* vdp;
80         
81 public:
82         // ----------------------------------------
83         // initialize
84         // ----------------------------------------
85         
86         VM(EMU_TEMPLATE* parent_emu);
87         ~VM();
88         
89         // ----------------------------------------
90         // for emulation class
91         // ----------------------------------------
92         
93         // drive virtual machine
94         void reset();
95         void run();
96         double get_frame_rate()
97         {
98                 return FRAMES_PER_SEC;
99         }
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         // user interface
118         void open_cart(int drv, const _TCHAR* file_path);
119         void close_cart(int drv);
120         bool is_cart_inserted(int drv);
121         void play_tape(int drv, const _TCHAR* file_path);
122         void rec_tape(int drv, const _TCHAR* file_path);
123         void close_tape(int drv);
124         bool is_tape_inserted(int drv);
125         bool is_tape_playing(int drv);
126         bool is_tape_recording(int drv);
127         int get_tape_position(int drv);
128         const _TCHAR* get_tape_message(int drv);
129         void push_play(int drv);
130         void push_stop(int drv);
131         void push_fast_forward(int drv);
132         void push_fast_rewind(int drv);
133         void push_apss_forward(int drv) {}
134         void push_apss_rewind(int drv) {}
135         bool is_frame_skippable();
136         
137         double get_current_usec();
138         uint64_t get_current_clock_uint64();
139         
140         void update_config();
141         bool process_state(FILEIO* state_fio, bool loading);
142         
143         // ----------------------------------------
144         // for each device
145         // ----------------------------------------
146         
147         // devices
148         DEVICE* get_device(int id);
149         //DEVICE* dummy;
150         //DEVICE* first_device;
151         //DEVICE* last_device;
152 };
153
154 #endif