OSDN Git Service

[VM][STATE] Apply New framework to some VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / phc20 / phc20.h
index 05d0c23..db24352 100644 (file)
-/*\r
-       SANYO PHC-20 Emulator 'ePHC-20'\r
-\r
-       Author : Takeda.Toshiya\r
-       Date   : 2010.09.03-\r
-\r
-       [ virtual machine ]\r
-*/\r
-\r
-#ifndef _PHC20_H_\r
-#define _PHC20_H_\r
-\r
-#define DEVICE_NAME            "SANYO PHC-20"\r
-#define CONFIG_NAME            "phc20"\r
-\r
-// device informations for virtual machine\r
-#define FRAMES_PER_SEC         60\r
-#define LINES_PER_FRAME                262\r
-#define CPU_CLOCKS             4000000\r
-#define SCREEN_WIDTH           256\r
-#define SCREEN_HEIGHT          192\r
-\r
-#define MC6847_VRAM_INV                0x40\r
-\r
-// device informations for win32\r
-#define USE_TAPE\r
-#define USE_ALT_F10_KEY\r
-#define USE_AUTO_KEY           6\r
-#define USE_AUTO_KEY_RELEASE   10\r
-#define USE_AUTO_KEY_NO_CAPS\r
-#define USE_DEBUGGER\r
-\r
-#include "../../common.h"\r
-\r
-class EMU;\r
-class DEVICE;\r
-class EVENT;\r
-\r
-class DATAREC;\r
-class MC6847;\r
-class Z80;\r
-\r
-class MEMORY;\r
-\r
-class VM\r
-{\r
-protected:\r
-       EMU* emu;\r
-       \r
-       // devices\r
-       EVENT* event;\r
-       \r
-       DATAREC* drec;\r
-       MC6847* vdp;\r
-       Z80* cpu;\r
-       \r
-       MEMORY* memory;\r
-       \r
-public:\r
-       // ----------------------------------------\r
-       // initialize\r
-       // ----------------------------------------\r
-       \r
-       VM(EMU* parent_emu);\r
-       ~VM();\r
-       \r
-       // ----------------------------------------\r
-       // for emulation class\r
-       // ----------------------------------------\r
-       \r
-       // drive virtual machine\r
-       void reset();\r
-       void run();\r
-       \r
-#ifdef USE_DEBUGGER\r
-       // debugger\r
-       DEVICE *get_cpu(int index);\r
-#endif\r
-       \r
-       // draw screen\r
-       void draw_screen();\r
-       \r
-       // sound generation\r
-       void initialize_sound(int rate, int samples);\r
-       uint16* create_sound(int* extra_frames);\r
-       int sound_buffer_ptr();\r
-       \r
-       // user interface\r
-       void play_tape(_TCHAR* file_path);\r
-       void rec_tape(_TCHAR* file_path);\r
-       void close_tape();\r
-       bool tape_inserted();\r
-       bool now_skip();\r
-       \r
-       void update_config();\r
-       \r
-       // ----------------------------------------\r
-       // for each device\r
-       // ----------------------------------------\r
-       \r
-       // devices\r
-       DEVICE* get_device(int id);\r
-       DEVICE* dummy;\r
-       DEVICE* first_device;\r
-       DEVICE* last_device;\r
-};\r
-\r
-#endif\r
+/*
+       SANYO PHC-20 Emulator 'ePHC-20'
+
+       Author : Takeda.Toshiya
+       Date   : 2010.09.03-
+
+       [ virtual machine ]
+*/
+
+#ifndef _PHC20_H_
+#define _PHC20_H_
+
+#define DEVICE_NAME            "SANYO PHC-20"
+#define CONFIG_NAME            "phc20"
+
+// device informations for virtual machine
+#define FRAMES_PER_SEC         60
+#define LINES_PER_FRAME                262
+#define CPU_CLOCKS             4000000
+#define SCREEN_WIDTH           256
+#define SCREEN_HEIGHT          192
+
+#define MC6847_VRAM_INV                0x40
+
+// device informations for win32
+#define USE_TAPE               1
+#define USE_TAPE_BUTTON
+#define USE_ALT_F10_KEY
+#define USE_AUTO_KEY           6
+#define USE_AUTO_KEY_RELEASE   10
+#define USE_AUTO_KEY_NO_CAPS
+#define USE_SOUND_VOLUME       2
+#define USE_DEBUGGER
+#define USE_STATE
+
+#define USE_CPU_Z80
+
+#include "../../common.h"
+#include "../../fileio.h"
+#include "../vm_template.h"
+
+#ifdef USE_SOUND_VOLUME
+static const _TCHAR *sound_device_caption[] = {
+       _T("CMT (Signal)"), _T("Noise (CMT)"),
+};
+#endif
+
+class csp_state_utils;
+
+class EMU;
+class DEVICE;
+class EVENT;
+
+class DATAREC;
+class MC6847;
+class Z80;
+
+class PHC20_MEMORY;
+
+class VM : public VM_TEMPLATE
+{
+protected:
+       //EMU* emu;
+       //csp_state_utils* state_entry;
+       
+       // devices
+       //EVENT* event;
+       
+       DATAREC* drec;
+       MC6847* vdp;
+       Z80* cpu;
+       
+       PHC20_MEMORY* memory;
+       
+public:
+       // ----------------------------------------
+       // initialize
+       // ----------------------------------------
+       
+       VM(EMU* parent_emu);
+       ~VM();
+       
+       // ----------------------------------------
+       // for emulation class
+       // ----------------------------------------
+       
+       // drive virtual machine
+       void reset();
+       void run();
+       
+#ifdef USE_DEBUGGER
+       // debugger
+       DEVICE *get_cpu(int index);
+#endif
+       
+       // draw screen
+       void draw_screen();
+       
+       // sound generation
+       void initialize_sound(int rate, int samples);
+       uint16_t* create_sound(int* extra_frames);
+       int get_sound_buffer_ptr();
+#ifdef USE_SOUND_VOLUME
+       void set_sound_device_volume(int ch, int decibel_l, int decibel_r);
+#endif
+       
+       // user interface
+       void play_tape(int drv, const _TCHAR* file_path);
+       void rec_tape(int drv, const _TCHAR* file_path);
+       void close_tape(int drv);
+       bool is_tape_inserted(int drv);
+       bool is_tape_playing(int drv);
+       bool is_tape_recording(int drv);
+       int get_tape_position(int drv);
+       const _TCHAR* get_tape_message(int drv);
+       void push_play(int drv);
+       void push_stop(int drv);
+       void push_fast_forward(int drv);
+       void push_fast_rewind(int drv);
+       void push_apss_forward(int drv) {}
+       void push_apss_rewind(int drv) {}
+       bool is_frame_skippable();
+       
+       void update_config();
+       bool process_state(FILEIO* state_fio, bool loading);
+       
+       // ----------------------------------------
+       // for each device
+       // ----------------------------------------
+       
+       // devices
+       DEVICE* get_device(int id);
+       //DEVICE* dummy;
+       //DEVICE* first_device;
+       //DEVICE* last_device;
+};
+
+#endif