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 / fm7 / fm7.h
index f0bd3fe..ec48034 100644 (file)
 #ifndef _FM7_H_
 #define _FM7_H_
 
-#define USE_TAPE1
+#define USE_TAPE 1
 #define USE_TAPE_PTR
 #define USE_TAPE_BUTTON
 #define USE_SCANLINE
 #define USE_DIPSWITCH
 #define USE_CPU_TYPE 2
 #define USE_SPECIAL_RESET
-#define USE_EXTRA_LEDS 3
+#define USE_LED_DEVICE                 3
 #define USE_MINIMUM_RENDERING 1
 #define USE_MOUSE
 #define USE_JOYSTICK
@@ -25,6 +25,7 @@
 #define USE_PRINTER
 #define USE_PRINTER_TYPE 4
 #define USE_AY_3_8910_AS_PSG
+#define SUPPORT_VARIABLE_TIMING
 
 #define INDEPENDENT_CAPS_KANA_LED
 #define NOTIFY_KEY_DOWN
 #define CONFIG_NAME            "fm8"
 #define CAPABLE_Z80
 #define DIPSWITCH_DEFAULT 0x00000000 
-#define USE_BUBBLE1
-#define USE_BUBBLE2
-#define MAX_BUBBLE 2
+#define USE_BUBBLE 2
+#define BASE_BUBBLE_NUM 0
 #define MAX_DRIVE  4
 
 #undef CPU_TYPE_DEFAULT
 #define CPU_TYPE_DEFAULT 1
+#define USE_GREEN_DISPLAY
+#define USE_MONITOR_TYPE 2
 
 #elif defined(_FM7)
 #define DEVICE_NAME            "FUJITSU FM-7"
@@ -64,6 +66,9 @@
 #define DIPSWITCH_DEFAULT 0x000000000 
 #define MAX_DRIVE  4
 #define CAPABLE_JCOMMCARD 1
+#define USE_GREEN_DISPLAY
+#define USE_MONITOR_TYPE 2
+
 #elif defined(_FMNEW7)
 #define DEVICE_NAME            "FUJITSU FM-NEW7"
 #define CONFIG_NAME            "fmnew7"
@@ -71,6 +76,8 @@
 #define DIPSWITCH_DEFAULT 0x000000000 
 #define MAX_DRIVE  4
 #define CAPABLE_JCOMMCARD 1
+#define USE_GREEN_DISPLAY
+#define USE_MONITOR_TYPE 2
 
 #elif defined(_FM77) || defined(_FM77L2)
 # if defined(_FM77)
@@ -91,6 +98,8 @@
 #define MAX_DRIVE  4
 #define CAPABLE_JCOMMCARD 1
 #define HAS_2HD
+#define USE_GREEN_DISPLAY
+#define USE_MONITOR_TYPE 2
 
 #elif defined(_FM77L4)
 #define DEVICE_NAME            "FUJITSU FM-77L4"
 #define DIPSWITCH_DEFAULT 0x00000003 
 #define MAX_DRIVE  4
 #define CAPABLE_JCOMMCARD 1
+#define USE_GREEN_DISPLAY
+#define USE_MONITOR_TYPE 2
 
 #elif defined(_FM77AV)
 #define DEVICE_NAME            "FUJITSU FM77AV"
 // device informations for virtual machine
 
 // TODO: check refresh rate
-#define FRAMES_PER_SEC         59.94
+//#define FRAMES_PER_SEC               60.0962 /* Related to display.cpp */ 
+#define FRAMES_PER_SEC         59.94 /* Related to display.cpp */ 
 #if defined(_FM77AV40) || defined(_FM77AV40EX) || defined(_FM77AV40SX) || defined(_FM77L4)
 #define LINES_PER_FRAME        400
 #else
 #endif
 
 #if defined(_FM77AV40) || defined(_FM77AV40EX) || defined(_FM77AV40SX) || \
-    defined(_FM77AV20) || defined(_FM77AV20EX) || defined(_FM77AV20SX)
-#define CPU_CLOCKS             2016000
-#elif defined(_FM8)
-#define CPU_CLOCKS             1095000
+  defined(_FM77AV20) || defined(_FM77AV20EX) || defined(_FM77AV20SX)
+#define CPU_CLOCKS             2016000 /* 2016 */
 #else
-#define CPU_CLOCKS             2000000
+#define CPU_CLOCKS      1798000   /* FM8,7 - 77AV/20? */
 #endif
 
+
 /*
  * If you wish to use software-scanline, define below.
  * If not, undef.
 //#define IO_ADDR_MAX          0x10000
 
 // device informations for win32
-#define USE_FD1
-#define USE_FD2
-
 #if defined(HAS_2HD)
-#define USE_FD3
-#define USE_FD4
+#define USE_FLOPPY_DISK 4
+#else
+#define USE_FLOPPY_DISK 2
 #endif
-
+#define BASE_FLOPPY_DISK_NUM 0
 
 #ifdef BUILD_Z80
 # ifdef CAPABLE_Z80
 //#include "../../config.h"
 #include "../../common.h"
 #include "../../fileio.h"
+#include "../vm_template.h"
 
 #ifdef USE_SOUND_VOLUME
 static const _TCHAR *sound_device_caption[] = {
@@ -380,28 +390,44 @@ static const _TCHAR *joy_button_captions[] = {
 };
 #endif
 
+/*
+ * NOTE:
+ * Below defines are for EVENT::run_cpu().
+ * Please see event.cpp for details.
+ * 20180317 -- K.Ohta.
+ */
+
+#define USE_CPU_MC6809
+#if defined(WITH_Z80)
+#define USE_CPU_Z80
+#endif
+
 class EMU;
 class DEVICE;
 class EVENT;
 class FILEIO;
 
+class AND;
+#if defined(USE_AY_3_8910_AS_PSG) && !defined(_FM77AV_VARIANTS)
+class AY_3_891X;
+#endif
 #if defined(_FM77AV_VARIANTS)
 class BEEP;
 #endif
-class PCM1BIT;
-class MC6809;
-class YM2203;
-class MB8877;
-class MEMORY;
 class DATAREC;
-class I8251;
-#if defined(USE_AY_3_8910_AS_PSG) && !defined(_FM77AV_VARIANTS)
-class AY_3_891X;
+#if defined(_FM77L4)
+class HD46505;
 #endif
-#if defined(_FM8)
-class BUBBLECASETTE;
+class I8251;
+class MB8877;
+class MC6809;
+class PCM1BIT;
+class YM2203;
+#ifdef WITH_Z80
+class Z80;
+class OR;
 #endif
-class DISPLAY;
+
 #if defined(_FM77AV_VARIANTS)
 class MB61VH010;
 #endif
@@ -409,39 +435,41 @@ class MB61VH010;
     defined(_FM77AV20) || defined(_FM77AV20EX) || defined(_FM77AV20SX)
 class HD6844;
 #endif
-class AND;
-class FM7_MAINMEM;
-#if defined(_FM8)
-class FM8_MAINIO;
-#else
-class FM7_MAINIO;
-#endif
-
-class KEYBOARD;
-class KANJIROM;
-class JOYSTICK;
 
-#ifdef WITH_Z80
-class Z80;
-class OR;
+namespace FM7 {
+#if defined(USE_BUBBLE)
+       class BUBBLECASETTE;
 #endif
+       class DISPLAY;
 #ifdef CAPABLE_JCOMMCARD
 class FM7_JCOMMCARD;
 #endif
+       class FM7_MAINMEM;
+#if defined(_FM8)
+       class FM8_MAINIO;
+#else
+       class FM7_MAINIO;
+#endif
+       class JOYSTICK;
+       class KEYBOARD;
+       class KANJIROM;
+}
 
-class VM {
+class VM : public VM_TEMPLATE
+{
 protected:
-       EMU* emu;
+//     EMU* emu;
        
        // devices
-       EVENT* event;
-
+//     EVENT* event;
+       
+       DEVICE* dummycpu;
        MC6809* maincpu;
-       FM7_MAINMEM* mainmem;
+       FM7::FM7_MAINMEM* mainmem;
 #if defined(_FM8)
-       FM8_MAINIO* mainio;
+       FM7::FM8_MAINIO* mainio;
 #else
-       FM7_MAINIO* mainio;
+       FM7::FM7_MAINIO* mainio;
 #endif
        MB8877* fdc;
 #if defined(HAS_2HD)
@@ -465,8 +493,8 @@ protected:
 #  endif
 # endif
 #endif
-#if defined(_FM8)
-       BUBBLECASETTE *bubble_casette[2];
+#if defined(USE_BUBBLE)
+       FM7::BUBBLECASETTE *bubble_casette[USE_BUBBLE];
 #endif
        I8251 *uart[3];
 # if defined(_FM77AV20) || defined(_FM77AV40) || defined(_FM77AV20EX) || defined(_FM77AV40EX) || defined(_FM77AV40SX)
@@ -476,7 +504,7 @@ protected:
        //BEEP* beep;
        PCM1BIT* pcm1bit;
        DATAREC *drec;
-       JOYSTICK *joystick;
+       FM7::JOYSTICK *joystick;
        
 #ifdef  WITH_Z80
        Z80* z80cpu;
@@ -500,20 +528,24 @@ protected:
 #if defined(HAS_DMA)
        HD6844 *dmac;
 #endif   
-       DISPLAY* display;
-       KEYBOARD* keyboard;
+       FM7::DISPLAY* display;
+       FM7::KEYBOARD* keyboard;
    
-       KANJIROM *kanjiclass1;
+       FM7::KANJIROM *kanjiclass1;
 #ifdef CAPABLE_KANJI_CLASS2
-       KANJIROM *kanjiclass2;
+       FM7::KANJIROM *kanjiclass2;
 #endif
 #if defined(CAPABLE_JCOMMCARD)
        MC6809 *jsubcpu;
-       FM7_JCOMMCARD *jcommcard;
+       FM7::FM7_JCOMMCARD *jcommcard;
        AND *g_jsubhalt;
 #endif
+#if defined(_FM77L4)
+       HD46505 *l4crtc;
+#endif
        bool connect_320kfdc;
        bool connect_1Mfdc;
+
 public:
        // ----------------------------------------
        // initialize
@@ -536,7 +568,6 @@ public:
        // debugger
        DEVICE *get_cpu(int index);
 #endif
-       void initialize(void);
        void connect_bus(void);
 
        void update_dipswitch(void);
@@ -550,13 +581,14 @@ public:
 #ifdef USE_SOUND_VOLUME
        void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
 #endif
+       void set_vm_frame_rate(double fps);
        
        // notify key
        void key_down(int code, bool repeat);
        void key_up(int code);
        bool get_caps_locked();
        bool get_kana_locked();
-       uint32_t get_extra_leds(); 
+       uint32_t get_led_status(); 
        
        // user interface
        void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
@@ -583,9 +615,9 @@ public:
        void push_apss_forward(int drv);
        void push_apss_rewind(int drv);
        void update_config();
-       void save_state(FILEIO* state_fio);
-       bool load_state(FILEIO* state_fio);
-#if defined(USE_BUBBLE1)
+       bool process_state(FILEIO* state_fio, bool loading);
+       
+#if defined(USE_BUBBLE)
        void open_bubble_casette(int drv, const _TCHAR *path, int bank);
        void close_bubble_casette(int drv);
        bool is_bubble_casette_inserted(int drv);
@@ -604,9 +636,9 @@ public:
        void set_cpu_clock(DEVICE *cpu, uint32_t clocks);
        // devices
        DEVICE* get_device(int id);
-       DEVICE* dummy;
-       DEVICE* first_device;
-       DEVICE* last_device;
+//     DEVICE* dummy;
+//     DEVICE* first_device;
+//     DEVICE* last_device;
 };
 
 #endif