OSDN Git Service

[VM][BABBAGE2ND][PC6001][PC8801][PC9801][PCENGINE][X1] Use VM_TEMPLATE.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Sun, 29 Jul 2018 17:49:00 +0000 (02:49 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Sun, 29 Jul 2018 17:49:00 +0000 (02:49 +0900)
48 files changed:
source/src/vm/babbage2nd/babbage2nd.cpp
source/src/vm/babbage2nd/babbage2nd.h
source/src/vm/babbage2nd/display.h
source/src/vm/babbage2nd/keyboard.h
source/src/vm/pc6001/display.h
source/src/vm/pc6001/floppy.h
source/src/vm/pc6001/joystick.h
source/src/vm/pc6001/memory.cpp
source/src/vm/pc6001/memory.h
source/src/vm/pc6001/memory_draw.cpp
source/src/vm/pc6001/pc6001.cpp
source/src/vm/pc6001/pc6001.h
source/src/vm/pc6001/psub.h
source/src/vm/pc6001/sub.h
source/src/vm/pc6001/timer.cpp
source/src/vm/pc6001/timer.h
source/src/vm/pc8801/pc88.h
source/src/vm/pc8801/pc8801.cpp
source/src/vm/pc8801/pc8801.h
source/src/vm/pc9801/cmt.h
source/src/vm/pc9801/cpureg.h
source/src/vm/pc9801/display.h
source/src/vm/pc9801/dmareg.h
source/src/vm/pc9801/floppy.h
source/src/vm/pc9801/fmsound.h
source/src/vm/pc9801/joystick.h
source/src/vm/pc9801/keyboard.h
source/src/vm/pc9801/membus.h
source/src/vm/pc9801/mouse.h
source/src/vm/pc9801/pc9801.cpp
source/src/vm/pc9801/pc9801.h
source/src/vm/pc9801/sasi.h
source/src/vm/pcengine/pcengine.cpp
source/src/vm/pcengine/pcengine.h
source/src/vm/vm_template.h
source/src/vm/x1/display.h
source/src/vm/x1/emm.h
source/src/vm/x1/floppy.h
source/src/vm/x1/iobus.h
source/src/vm/x1/joystick.h
source/src/vm/x1/keyboard.h
source/src/vm/x1/memory.h
source/src/vm/x1/mouse.h
source/src/vm/x1/psub.h
source/src/vm/x1/sasi.h
source/src/vm/x1/sub.h
source/src/vm/x1/x1.cpp
source/src/vm/x1/x1.h

index 8c73652..ff57688 100644 (file)
@@ -29,7 +29,7 @@
 // initialize
 // ----------------------------------------------------------------------------
 
-VM::VM(EMU* parent_emu) : emu(parent_emu)
+VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
 {
        // create devices
        first_device = last_device = NULL;
index 21cf432..0998d61 100644 (file)
@@ -34,6 +34,7 @@
 
 #include "../../common.h"
 #include "../../fileio.h"
+#include "../vm_template.h"
 
 const struct {
        int x, y;
@@ -97,11 +98,11 @@ class Z80PIO;
 class DISPLAY;
 class KEYBOARD;
 
-class VM
+class VM : public VM_TEMPLATE
 {
 protected:
-       EMU* emu;
-       csp_state_utils* state_entry;
+       //EMU* emu;
+       //csp_state_utils* state_entry;
        
        // devices
        EVENT* event;
@@ -169,9 +170,9 @@ public:
        
        // devices
        DEVICE* get_device(int id);
-       DEVICE* dummy;
-       DEVICE* first_device;
-       DEVICE* last_device;
+       //DEVICE* dummy;
+       //DEVICE* first_device;
+       //DEVICE* last_device;
 };
 
 #endif
index 1a2b0f3..d542213 100644 (file)
@@ -29,7 +29,7 @@ private:
        uint8_t pio_8bit;
        
 public:
-       DISPLAY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       DISPLAY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("7-Segment LEDs"));
        }
index 5e555d8..c0427b0 100644 (file)
@@ -20,7 +20,7 @@ private:
        DEVICE *d_pio;
        
 public:
-       KEYBOARD(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       KEYBOARD(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("Keyboard"));
        }
index f35a375..3882cc2 100644 (file)
@@ -28,7 +28,7 @@ private:
 
        int tmp_vram_size;
 public:
-       DISPLAY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       DISPLAY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("Display"));
        }
index 3f76c60..2693032 100644 (file)
@@ -101,7 +101,7 @@ private:
        unsigned char InDDH_66();
        
 public:
-       FLOPPY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       FLOPPY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                d_noise_seek = NULL;
 //             d_noise_head_down = NULL;
index dc1d772..35a83c9 100644 (file)
@@ -25,7 +25,7 @@ private:
        const uint32_t *joy_stat;
        
 public:
-       JOYSTICK(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       JOYSTICK(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("Joystick I/F"));
        }
index 62e31e5..50a09fa 100644 (file)
@@ -213,7 +213,7 @@ void MEMORY::reset()
                EXTROM1 = EXTROM2 = EmptyRAM;
        }
 #if defined(_PC6001MK2) || defined(_PC6601)
-       vm->sr_mode=0;
+       static_cast<VM *>(vm)->sr_mode=0;
        CGROM = CGROM1;
        VRAM = RAM+0xE000;
        for (I=0; I<0x200; I++ ) *(VRAM+I)=0xde;
@@ -221,7 +221,7 @@ void MEMORY::reset()
        for(J=4;J<8;J++) {RdMem[J]=RAM+0x2000*J;WrMem[J]=RAM+0x2000*J;};
        EnWrite[0]=EnWrite[1]=0; EnWrite[2]=EnWrite[3]=1;
 #elif defined(_PC6601SR) || defined(_PC6001MK2SR)
-       vm->sr_mode=1;
+       static_cast<VM *>(vm)->sr_mode=1;
        bitmap=1;
        cols=40;
        rows=20;
@@ -260,7 +260,7 @@ void MEMORY::write_data8(uint32_t addr, uint32_t data)
 {
 #if defined(_PC6601SR) || defined(_PC6001MK2SR)
        /* Graphics Vram Write (SR basic) */
-       if(vm->sr_mode && chk_gvram(addr ,8)) 
+       if(static_cast<VM *>(vm)->sr_mode && chk_gvram(addr ,8)) 
                gvram_write(addr, data);
        else
 #endif
@@ -273,7 +273,7 @@ uint32_t MEMORY::read_data8(uint32_t addr)
 {
 #if defined(_PC6601SR) || defined(_PC6001MK2SR)
        /* Graphics Vram Read (SR basic) */
-       if(vm->sr_mode && chk_gvram(addr, 0))
+       if(static_cast<VM *>(vm)->sr_mode && chk_gvram(addr, 0))
                return(gvram_read(addr));
 #endif
        return(RdMem[addr >> 13][addr & 0x1FFF]);
@@ -372,7 +372,7 @@ void MEMORY::write_io8(uint32_t addr, uint32_t data)
                break;
 #endif
        case 0xB0:
-               if (vm->sr_mode) {
+               if (static_cast<VM *>(vm)->sr_mode) {
                        d_timer->set_portB0(Value);
                } else {
                        VRAM=(RAM+VRAMHead[CRTMode1][(data&0x06)>>1]);
@@ -389,13 +389,13 @@ void MEMORY::write_io8(uint32_t addr, uint32_t data)
                CRTMode3=(Value&0x08) ? 0 : 1;
 #if defined(_PC6601SR) || defined(_PC6001MK2SR)
                portC1 = Value;
-               if (vm->sr_mode)
+               if (static_cast<VM *>(vm)->sr_mode)
                        lines=(Value&0x01) ? 200 : 204;
-               if (vm->sr_mode)
+               if (static_cast<VM *>(vm)->sr_mode)
                        CGROM = CGROM6;    // N66SR BASIC use CGROM6
                else
                        CGROM = ((CRTMode1 == 0) ? CGROM1 : CGROM5);
-               if (vm->sr_mode) {
+               if (static_cast<VM *>(vm)->sr_mode) {
                        if (CRTMode1==1 && CRTMode2==0 && !bitmap) { /* width 80 */
                                cols=80;
                        } else if(CRTMode1==0 && CRTMode2==0 && !bitmap) { /* Width 40  */
@@ -407,7 +407,7 @@ void MEMORY::write_io8(uint32_t addr, uint32_t data)
 #endif
                break;
        case 0xC2: // ROM swtich
-               if (vm->sr_mode) return;        /* sr_mode do nothing! */
+               if (static_cast<VM *>(vm)->sr_mode) return;     /* sr_mode do nothing! */
                if ((Value&0x02)==0x00) CurKANJIROM=KANJIROM;
                else CurKANJIROM=KANJIROM+0x4000;
                if ((Value&0x01)==0x00) {
@@ -429,18 +429,18 @@ void MEMORY::write_io8(uint32_t addr, uint32_t data)
                bitmap  = (Value & 8)? 0:1;
                rows    = (Value & 4)? 20:25;
 ///            busreq  = (Value & 2)? 0:1;
-               vm->sr_mode = ((Value & 1)==1) ? 0 : 1;
-               if (bitmap && vm->sr_mode)
+               static_cast<VM *>(vm)->sr_mode = ((Value & 1)==1) ? 0 : 1;
+               if (bitmap && static_cast<VM *>(vm)->sr_mode)
                {
                        VRAM = (Value & 0x10) ? RAM+0x8000:RAM+0x0000;
                }
-               if (vm->sr_mode) {
+               if (static_cast<VM *>(vm)->sr_mode) {
                        CGROM=CGROM6; 
                        portF0=0x11;
                }
                break;  
        case 0xC9:
-               if (vm->sr_mode && !bitmap ) 
+               if (static_cast<VM *>(vm)->sr_mode && !bitmap ) 
                {               
                        TEXTVRAM=RAM+(Value & 0xf)*0x1000;
                }
@@ -452,7 +452,7 @@ void MEMORY::write_io8(uint32_t addr, uint32_t data)
        case 0xCF: portCF=0; break;
 #endif
        case 0xF0: // read block set 
-               if (vm->sr_mode) return;        /* sr_mode do nothing! */
+               if (static_cast<VM *>(vm)->sr_mode) return;     /* sr_mode do nothing! */
                portF0 = Value;
                switch(data & 0x0f)
                {
@@ -507,7 +507,7 @@ void MEMORY::write_io8(uint32_t addr, uint32_t data)
                if (CGSW93)     RdMem[3] = CGROM;
                break;
        case 0xF1: // read block set
-               if (vm->sr_mode) return;        /* sr_mode do nothing! */
+               if (static_cast<VM *>(vm)->sr_mode) return;     /* sr_mode do nothing! */
                portF1 = Value;
                switch(data & 0x0f)
                {
@@ -557,7 +557,7 @@ void MEMORY::write_io8(uint32_t addr, uint32_t data)
                };
                break;
        case 0xF2: // write ram block set
-               if (vm->sr_mode) return;        /* sr_mode do nothing! */
+               if (static_cast<VM *>(vm)->sr_mode) return;     /* sr_mode do nothing! */
                if (data & 0x40) {EnWrite[3]=1;WrMem[6]=RAM+0xc000;WrMem[7]=RAM+0xe000;}
                else EnWrite[3]=0;
                if (data & 0x010) {EnWrite[2]=1;WrMem[4]=RAM+0x8000;WrMem[5]=RAM+0xa000;}
@@ -596,8 +596,8 @@ uint32_t MEMORY::read_io8(uint32_t addr)
        case 0xC0: Value=0xff;break;
        case 0xC2: Value=0xff;break;
 #endif
-       case 0xF0: if (!vm->sr_mode) Value=portF0;break;
-       case 0xF1: if (!vm->sr_mode) Value=portF1;break;
+       case 0xF0: if (!static_cast<VM *>(vm)->sr_mode) Value=portF0;break;
+       case 0xF1: if (!static_cast<VM *>(vm)->sr_mode) Value=portF1;break;
        }
        return(Value);
 }
@@ -607,7 +607,7 @@ uint32_t MEMORY::read_io8(uint32_t addr)
 void MEMORY::event_vline(int v, int clock)
 {
 #if defined(_PC6601SR) || defined(_PC6001MK2SR)
-       if(vm->sr_mode) {
+       if(static_cast<VM *>(vm)->sr_mode) {
                if(v == (CRTMode1 ? 200 : 192)) {
                        d_timer->write_signal(SIG_TIMER_IRQ_VRTC, 1, 1);
                }
@@ -645,7 +645,7 @@ void MEMORY::write_signal(int id, uint32_t data, uint32_t mask)
                }
 #else
                if(data & 4) {
-                       CGSW93=0; if (!vm->sr_mode) write_io8(0xf0, portF0);
+                       CGSW93=0; if (!static_cast<VM *>(vm)->sr_mode) write_io8(0xf0, portF0);
                } else {
                        CGSW93=1; RdMem[3]=CGROM;
                }
index ded5395..9dee407 100644 (file)
@@ -165,7 +165,7 @@ private:
 #endif
 
 public:
-       MEMORY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       MEMORY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                inserted = false;
                set_device_name(_T("Memory Bus"));
index f00aa00..6635737 100644 (file)
@@ -43,7 +43,7 @@ void MEMORY::draw_screen()
                        memset(dest, 0, 640 * sizeof(scrntype_t));
                }
 #if defined(_PC6601SR) || defined(_PC6001MK2SR)
-       } else if (vm->sr_mode) {
+       } else if (static_cast<VM *>(vm)->sr_mode) {
                if (CRTMode2) {
                        if (CRTMode3) RefreshScr63();
                        else RefreshScr62();
index 2e01ae4..8edcddc 100644 (file)
@@ -57,7 +57,7 @@
 // initialize
 // ----------------------------------------------------------------------------
 
-VM::VM(EMU* parent_emu) : emu(parent_emu)
+VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
 {
        support_pc80s31k = FILEIO::IsFileExisting(create_local_path(_T("DISK.ROM")));
 #ifdef _PC6601SR
index f4fc819..2a1172b 100644 (file)
 
 #include "../../common.h"
 #include "../../fileio.h"
+#include "../vm_template.h"
 
 #ifdef USE_SOUND_VOLUME
 static const _TCHAR *sound_device_caption[] = {
@@ -159,11 +160,11 @@ class PSUB;
 class SUB;
 class TIMER;
 
-class VM
+class VM : public VM_TEMPLATE
 {
 protected:
-       EMU* emu;
-       csp_state_utils *state_entry;
+       //EMU* emu;
+       //csp_state_utils *state_entry;
 
        int vdata;
        
@@ -283,9 +284,9 @@ public:
        
        // devices
        DEVICE* get_device(int id);
-       DEVICE* dummy;
-       DEVICE* first_device;
-       DEVICE* last_device;
+       //DEVICE* dummy;
+       //DEVICE* first_device;
+       //DEVICE* last_device;
        
        int sr_mode;
 };
index 5892ef8..c0611f3 100644 (file)
@@ -52,7 +52,7 @@ private:
        void update_keyboard();
        
 public:
-       PSUB(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       PSUB(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("Pseudo Sub System"));
        }
index 5541d11..05a4b01 100644 (file)
@@ -40,7 +40,7 @@ private:
        uint8_t buffer[0x10000];
        
 public:
-       SUB(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       SUB(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("Sub System"));
        }
index c28d946..dad8069 100644 (file)
@@ -133,7 +133,7 @@ void TIMER::event_callback(int event_id, int err)
                register_event(this, EVENT_TIMER, 2000.0, false, &timer_id);
 #else
 #if defined(_PC6601SR) || defined(_PC6001MK2SR)
-               if(vm->sr_mode) {
+               if(static_cast<VM *>(vm)->sr_mode) {
                        register_event(this, EVENT_TIMER, 2000.0 * (portF6 + 1) / 0x80, false, &timer_id);
                } else
 #endif
@@ -158,7 +158,7 @@ void TIMER::set_portB0(uint32_t data)
                        register_event(this, EVENT_TIMER, 1000.0, false, &timer_id);
 #else
 #if defined(_PC6601SR) || defined(_PC6001MK2SR)
-                       if(vm->sr_mode) {
+                       if(static_cast<VM *>(vm)->sr_mode) {
                                register_event(this, EVENT_TIMER, 2000.0 * (portF6 + 1) / 0x80, false, &timer_id);
                        } else
 #endif
@@ -181,7 +181,7 @@ void TIMER::write_signal(int id, uint32_t data, uint32_t mask)
 uint32_t TIMER::get_intr_ack()
 {
 #if defined(_PC6601SR) || defined(_PC6001MK2SR)
-       if(vm->sr_mode) {
+       if(static_cast<VM *>(vm)->sr_mode) {
                for(int i = 0, bit = 1; i < 8; i++, bit <<= 1) {
                        if(NewIRQ & bit) {
                                if(portFB & bit) {
@@ -256,7 +256,7 @@ void TIMER::update_intr()
        NewIRQ &= 0x05; // Only Sub-CPU and Timer
 #else
 #if defined(_PC6601SR) || defined(_PC6001MK2SR)
-       if(vm->sr_mode) {
+       if(static_cast<VM *>(vm)->sr_mode) {
                NewIRQ &= ~portFA;
        } else
 #endif
index 09b38e0..197f474 100644 (file)
@@ -57,7 +57,7 @@ private:
        void update_intr();
        
 public:
-       TIMER(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
+       TIMER(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
        ~TIMER() {}
        
        // common functions
index 7e26599..e34a94c 100644 (file)
@@ -263,7 +263,7 @@ private:
        void decl_state_dmac();
        
 public:
-       PC88(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       PC88(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
 #if defined(_PC8001SR)
                set_device_name(_T("PC-8001 Core"));
index 6b2b7a3..a8d761f 100644 (file)
@@ -41,7 +41,7 @@
 // initialize
 // ----------------------------------------------------------------------------
 
-VM::VM(EMU* parent_emu) : emu(parent_emu)
+VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
 {
        // check configs
        boot_mode = config.boot_mode;
index e9cabb7..de3106b 100644 (file)
 
 #include "../../common.h"
 #include "../../fileio.h"
+#include "../vm_template.h"
 
 #ifdef USE_SOUND_VOLUME
 static const _TCHAR *sound_device_caption[] = {
@@ -147,7 +148,6 @@ static const _TCHAR *sound_device_caption[] = {
 };
 #endif
 
-class csp_state_utils;
 class EMU;
 class DEVICE;
 class EVENT;
@@ -168,11 +168,11 @@ class I8253;
 #endif
 class PC88;
 
-class VM
+class VM : public VM_TEMPLATE
 {
 protected:
-       EMU* emu;
-       csp_state_utils* state_entry;
+       //EMU* emu;
+       //csp_state_utils* state_entry;
        
        // devices
        EVENT* pc88event;
@@ -270,9 +270,9 @@ public:
        
        // devices
        DEVICE* get_device(int id);
-       DEVICE* dummy;
-       DEVICE* first_device;
-       DEVICE* last_device;
+       //DEVICE* dummy;
+       //DEVICE* first_device;
+       //DEVICE* last_device;
 };
 
 #endif
index d7a896e..338396f 100644 (file)
@@ -36,7 +36,7 @@ private:
        void release_tape();
        
 public:
-       CMT(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       CMT(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("CMT I/F"));
        }
index 588f4ce..e1209bc 100644 (file)
@@ -35,7 +35,7 @@ private:
        bool nmi_enabled;
        
 public:
-       CPUREG(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       CPUREG(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("CPU I/O"));
        }
index 507f665..0f0e9ba 100644 (file)
@@ -197,7 +197,7 @@ private:
        void draw_gfx_screen();
        
 public:
-       DISPLAY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       DISPLAY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                memset(tvram, 0, sizeof(tvram));
                set_device_name(_T("Display"));
index e3a8853..ea107de 100644 (file)
@@ -24,7 +24,7 @@ private:
        DEVICE *d_dma;
        
 public:
-       DMAREG(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       DMAREG(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("DMA I/O"));
        }
index fffea7e..1149106 100644 (file)
@@ -59,7 +59,7 @@ private:
        int timer_id;
        
 public:
-       FLOPPY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       FLOPPY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("Floppy I/F"));
        }
index eb0abc3..e3dcd1c 100644 (file)
@@ -33,7 +33,7 @@ private:
 #endif
        
 public:
-       FMSOUND(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       FMSOUND(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
 #ifdef SUPPORT_PC98_OPNA
                set_device_name(_T("PC-9801-86 (FM Sound)"));
index bb7f1a0..b2eeeda 100644 (file)
@@ -35,7 +35,7 @@ private:
        uint8_t select;
        
 public:
-       JOYSTICK(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       JOYSTICK(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("Joystick I/F"));
        }
index 9eea8bf..72c5a04 100644 (file)
@@ -35,7 +35,7 @@ private:
        uint8_t flag[256];
        
 public:
-       KEYBOARD(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       KEYBOARD(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("Keyboard"));
        }
index 9ff98d9..210e586 100644 (file)
@@ -112,7 +112,7 @@ private:
 #endif
        
 public:
-       MEMBUS(VM* parent_vm, EMU* parent_emu) : MEMORY(parent_vm, parent_emu)
+       MEMBUS(VM_TEMPLATE* parent_vm, EMU* parent_emu) : MEMORY(parent_vm, parent_emu)
        {
                set_device_name(_T("Memory Bus"));
        }
index a6698d9..1e81a3c 100644 (file)
@@ -39,7 +39,7 @@ private:
        void update_mouse();
        
 public:
-       MOUSE(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       MOUSE(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("Mouse I/F"));
        }
index 2b6a5eb..f20ec16 100644 (file)
 // initialize
 // ----------------------------------------------------------------------------
 
-VM::VM(EMU* parent_emu) : emu(parent_emu)
+VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
 {
        // check configs
 #if defined(_PC98DO) || defined(_PC98DOPLUS)
index 0a09f92..45eecf1 100644 (file)
 
 #include "../../common.h"
 #include "../../fileio.h"
+#include "../vm_template.h"
 
 #ifdef USE_SOUND_VOLUME
 static const _TCHAR *sound_device_caption[] = {
@@ -407,11 +408,11 @@ class PC88;
 class Z80;
 #endif
 
-class VM
+class VM : public VM_TEMPLATE
 {
 protected:
-       EMU* emu;
-       csp_state_utils* state_entry;
+       //EMU* emu;
+       //csp_state_utils* state_entry;
        
        // devices
        EVENT* event;
@@ -624,9 +625,9 @@ public:
        
        // devices
        DEVICE* get_device(int id);
-       DEVICE* dummy;
-       DEVICE* first_device;
-       DEVICE* last_device;
+       //DEVICE* dummy;
+       //DEVICE* first_device;
+       //DEVICE* last_device;
 };
 
 #endif
index 105f4f7..ef2d226 100644 (file)
@@ -36,7 +36,7 @@ private:
        bool drq_status;
        
 public:
-       SASI(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       SASI(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("SASI I/F"));
        }
index 5c32755..63e5398 100644 (file)
@@ -27,7 +27,7 @@
 // initialize
 // ----------------------------------------------------------------------------
 
-VM::VM(EMU* parent_emu) : emu(parent_emu)
+VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
 {
        // create devices
        first_device = last_device = NULL;
index 3b660b6..5b0a7ea 100644 (file)
@@ -42,6 +42,7 @@
 
 #include "../../common.h"
 #include "../../fileio.h"
+#include "../vm_template.h"
 
 #ifdef USE_SOUND_VOLUME
 static const _TCHAR *sound_device_caption[] = {
@@ -77,11 +78,11 @@ class SCSI_HOST;
 class SCSI_CDROM;
 class PCE;
 
-class VM
+class VM : public VM_TEMPLATE
 {
 protected:
-       EMU* emu;
-       csp_state_utils* state_entry;
+       //EMU* emu;
+       //csp_state_utils* state_entry;
        
        // devices
        EVENT* pceevent;
@@ -148,9 +149,9 @@ public:
        
        // devices
        DEVICE* get_device(int id);
-       DEVICE* dummy;
-       DEVICE* first_device;
-       DEVICE* last_device;
+       //DEVICE* dummy;
+       //DEVICE* first_device;
+       //DEVICE* last_device;
 };
 
 #endif
index f2aa062..dd7ddac 100644 (file)
@@ -106,6 +106,7 @@ public:
        virtual bool is_quick_disk_inserted(int drv) { return false; }
        virtual bool is_hard_disk_inserted(int drv) { return false; }
        virtual bool is_compact_disc_inserted(int drv) { return false; }
+       virtual bool is_cart_inserted(int drv) { return false; }
        virtual bool is_laser_disc_inserted(int drv) { return false; }
        virtual bool is_tape_inserted(int drv) { return false; }
        
@@ -128,7 +129,7 @@ public:
 
        virtual void update_config() { }
        virtual void save_state(FILEIO* state_fio) { }
-       virtual bool load_state(FILEIO* state_fio) { }
+       virtual bool load_state(FILEIO* state_fio) { return true; }
        virtual void decl_state(void) { }
        
        // devices
index b1f6651..0f27a8a 100644 (file)
@@ -148,7 +148,7 @@ private:
 
        int tmp_kanji_ptr;
 public:
-       DISPLAY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       DISPLAY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("Display"));
        }
index 99d912d..46e3152 100644 (file)
@@ -26,7 +26,7 @@ private:
        uint32_t data_addr;
        
 public:
-       EMM(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       EMM(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("EMM"));
        }
index 8791287..c54b705 100644 (file)
@@ -34,7 +34,7 @@ private:
        int register_id;
        
 public:
-       FLOPPY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       FLOPPY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                prev = 0;
                motor_on = false;
index 66ac430..774d265 100644 (file)
@@ -57,7 +57,7 @@ private:
        int get_vram_wait();
        
 public:
-       IOBUS(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       IOBUS(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("I/O Bus"));
        }
index 263b6b5..801b33a 100644 (file)
@@ -24,7 +24,7 @@ private:
        const uint32_t* joy_stat;
        
 public:
-       JOYSTICK(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       JOYSTICK(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("Joystick I/F"));
        }
index 6d52bc3..89e2665 100644 (file)
@@ -26,7 +26,7 @@ private:
        uint16_t column;
        
 public:
-       KEYBOARD(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       KEYBOARD(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("Keyboard"));
        }
index a77f3f1..7bc03fa 100644 (file)
@@ -39,7 +39,7 @@ private:
        void update_map();
        
 public:
-       MEMORY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       MEMORY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("Memory Bus"));
        }
index abf03bf..3f0fade 100644 (file)
@@ -28,7 +28,7 @@ private:
        const int32_t* stat;
        
 public:
-       MOUSE(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       MOUSE(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("Mouse I/F"));
        }
index b2608fe..20898bc 100644 (file)
@@ -57,7 +57,7 @@ private:
        uint16_t get_key(int code, bool repeat);
        
 public:
-       PSUB(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       PSUB(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("Pseudo Sub System"));
        }
index 5c16b7f..d27f374 100644 (file)
@@ -32,7 +32,7 @@ private:
        bool drq_status;
        
 public:
-       SASI(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       SASI(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("SASI I/F"));
        }
index 07d9864..fa7eda2 100644 (file)
@@ -44,7 +44,7 @@ private:
        void update_intr();
        
 public:
-       SUB(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       SUB(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("Sub System"));
        }
index a8e9f1c..561be15 100644 (file)
@@ -69,7 +69,7 @@ DLL_PREFIX_I struct cur_time_s cur_time;
 // initialize
 // ----------------------------------------------------------------------------
 
-VM::VM(EMU* parent_emu) : emu(parent_emu)
+VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
 {
        pseudo_sub_cpu = !(FILEIO::IsFileExisting(create_local_path(SUB_ROM_FILE_NAME)) && FILEIO::IsFileExisting(create_local_path(KBD_ROM_FILE_NAME)));
        
index 6059c95..b439076 100644 (file)
 
 #include "../../common.h"
 #include "../../fileio.h"
+#include "../vm_template.h"
 
 #ifdef USE_SOUND_VOLUME
 static const _TCHAR *sound_device_caption[] = {
@@ -292,12 +293,10 @@ class HUC6280;
 class PCE;
 #define USE_CPU_HUC6280
 #endif
-class csp_state_utils;
-
-class VM
+class VM : public VM_TEMPLATE
 {
 protected:
-       EMU* emu;
+       //EMU* emu;
        
        // devices for x1
        EVENT* event;
@@ -357,7 +356,6 @@ protected:
        HUC6280* pcecpu;
        PCE* pce;
 #endif
-       csp_state_utils *state_entry;
        
 public:
        // ----------------------------------------
@@ -445,9 +443,9 @@ public:
        
        // devices
        DEVICE* get_device(int id);
-       DEVICE* dummy;
-       DEVICE* first_device;
-       DEVICE* last_device;
+       //DEVICE* dummy;
+       //DEVICE* first_device;
+       //DEVICE* last_device;
 };
 
 #endif