OSDN Git Service

[VM][WIP] Use namespace to devices per VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / hc80 / hc80.h
index 3e5d432..b119a81 100644 (file)
-/*\r
-       EPSON HC-80 Emulator 'eHC-80'\r
-\r
-       Author : Takeda.Toshiya\r
-       Date   : 2008.03.14 -\r
-\r
-       [ virtual machine ]\r
-*/\r
-\r
-#ifndef _HC80_H_\r
-#define _HC80_H_\r
-\r
-#define DEVICE_NAME            "EPSON HC-80"\r
-#define CONFIG_NAME            "hc80"\r
-\r
-// device informations for virtual machine\r
-#define FRAMES_PER_SEC         64\r
-#define LINES_PER_FRAME                64\r
-#define CPU_CLOCKS             2457600\r
-#define SCREEN_WIDTH           480\r
-#define SCREEN_HEIGHT          64\r
-#define MAX_DRIVE              4\r
-\r
-// device informations for win32\r
-#define USE_SPECIAL_RESET\r
-#define USE_DEVICE_TYPE                3\r
-#define USE_FD1\r
-#define USE_FD2\r
-#define USE_FD3\r
-#define USE_FD4\r
-#define NOTIFY_KEY_DOWN\r
-#define USE_ALT_F10_KEY\r
-#define USE_AUTO_KEY           6\r
-#define USE_AUTO_KEY_RELEASE   10\r
-#define USE_ACCESS_LAMP\r
-#define USE_DEBUGGER\r
-\r
-#include "../../common.h"\r
-\r
-class EMU;\r
-class DEVICE;\r
-class EVENT;\r
-\r
-class BEEP;\r
-class I8251;\r
-class TF20;\r
-class Z80;\r
-\r
-class IO;\r
-class MEMORY;\r
-\r
-class VM\r
-{\r
-protected:\r
-       EMU* emu;\r
-       \r
-       // devices\r
-       EVENT* event;\r
-       \r
-       BEEP* beep;\r
-       I8251* sio;\r
-       TF20* tf20;\r
-       Z80* cpu;\r
-       \r
-       IO* io;\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 special_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
-       int access_lamp();\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
-       // notify key\r
-       void key_down(int code, bool repeat);\r
-       void key_up(int code);\r
-       \r
-       // user interface\r
-       void open_disk(int drv, _TCHAR* file_path, int offset);\r
-       void close_disk(int drv);\r
-       bool disk_inserted(int drv);\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
+/*
+       EPSON HC-80 Emulator 'eHC-80'
+
+       Author : Takeda.Toshiya
+       Date   : 2008.03.14 -
+
+       [ virtual machine ]
+*/
+
+#ifndef _HC80_H_
+#define _HC80_H_
+
+#define DEVICE_NAME            "EPSON HC-80"
+#define CONFIG_NAME            "hc80"
+
+// device informations for virtual machine
+#define FRAMES_PER_SEC         64
+#define LINES_PER_FRAME                64
+#define CPU_CLOCKS             2457600
+#define SCREEN_WIDTH           480
+#define SCREEN_HEIGHT          64
+#define MAX_DRIVE              4
+
+// device informations for win32
+#define USE_SPECIAL_RESET
+#define USE_DEVICE_TYPE                3
+// Nonintelligent ram disk
+#define DEVICE_TYPE_DEFAULT    2
+#define USE_FLOPPY_DISK                4
+#define NOTIFY_KEY_DOWN
+#define USE_ALT_F10_KEY
+#define USE_AUTO_KEY           6
+#define USE_AUTO_KEY_RELEASE   10
+#define USE_SOUND_VOLUME       1
+#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("Beep"),
+};
+#endif
+
+class csp_state_utils;
+class EMU;
+class DEVICE;
+class EVENT;
+
+class BEEP;
+class I8251;
+class PTF20;
+class Z80;
+
+namespace HC80 {
+       class IO;
+       class MEMORY;
+}
+class VM : public VM_TEMPLATE
+{
+protected:
+       //EMU* emu;
+       //csp_state_utils *state_entry;
+       
+       // devices
+       //EVENT* event;
+       
+       BEEP* beep;
+       I8251* sio;
+       PTF20* tf20;
+       Z80* cpu;
+       
+       HC80::IO* io;
+       HC80::MEMORY* memory;
+       
+public:
+       // ----------------------------------------
+       // initialize
+       // ----------------------------------------
+       
+       VM(EMU* parent_emu);
+       ~VM();
+       
+       // ----------------------------------------
+       // for emulation class
+       // ----------------------------------------
+       
+       // drive virtual machine
+       void reset();
+       void special_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
+       
+       // notify key
+       void key_down(int code, bool repeat);
+       void key_up(int code);
+       
+       // user interface
+       void open_floppy_disk(int drv, const _TCHAR* file_path, int bank);
+       void close_floppy_disk(int drv);
+       bool is_floppy_disk_inserted(int drv);
+       void is_floppy_disk_protected(int drv, bool value);
+       bool is_floppy_disk_protected(int drv);
+       uint32_t is_floppy_disk_accessed();
+       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