OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Mon, 22 Oct 2018 15:20:35 +0000 (00:20 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Mon, 22 Oct 2018 15:20:35 +0000 (00:20 +0900)
220 files changed:
source/src/vm/babbage2nd/babbage2nd.h
source/src/vm/device.h
source/src/vm/disk.h
source/src/vm/mz2800/crtc.cpp
source/src/vm/mz2800/crtc.h
source/src/vm/mz2800/floppy.cpp
source/src/vm/mz2800/floppy.h
source/src/vm/mz2800/joystick.cpp
source/src/vm/mz2800/joystick.h
source/src/vm/mz2800/keyboard.cpp
source/src/vm/mz2800/keyboard.h
source/src/vm/mz2800/memory.cpp
source/src/vm/mz2800/memory.h
source/src/vm/mz2800/mouse.cpp
source/src/vm/mz2800/mouse.h
source/src/vm/mz2800/mz2800.cpp
source/src/vm/mz2800/mz2800.h
source/src/vm/mz2800/printer.cpp
source/src/vm/mz2800/printer.h
source/src/vm/mz2800/reset.cpp
source/src/vm/mz2800/reset.h
source/src/vm/mz2800/sasi.cpp
source/src/vm/mz2800/sasi.h
source/src/vm/mz2800/serial.cpp
source/src/vm/mz2800/serial.h
source/src/vm/mz2800/sysport.cpp
source/src/vm/mz2800/sysport.h
source/src/vm/mz3500/keyboard.cpp
source/src/vm/mz3500/keyboard.h
source/src/vm/mz3500/main.cpp
source/src/vm/mz3500/main.h
source/src/vm/mz3500/mz3500.cpp
source/src/vm/mz3500/mz3500.h
source/src/vm/mz3500/sub.cpp
source/src/vm/mz3500/sub.h
source/src/vm/mz5500/display.cpp
source/src/vm/mz5500/display.h
source/src/vm/mz5500/keyboard.cpp
source/src/vm/mz5500/keyboard.h
source/src/vm/mz5500/memory.cpp
source/src/vm/mz5500/memory.h
source/src/vm/mz5500/mz5500.cpp
source/src/vm/mz5500/mz5500.h
source/src/vm/mz5500/sysport.cpp
source/src/vm/mz5500/sysport.h
source/src/vm/n5200/display.cpp
source/src/vm/n5200/display.h
source/src/vm/n5200/floppy.cpp
source/src/vm/n5200/floppy.h
source/src/vm/n5200/keyboard.cpp
source/src/vm/n5200/keyboard.h
source/src/vm/n5200/memory.cpp
source/src/vm/n5200/memory.h
source/src/vm/n5200/n5200.cpp
source/src/vm/n5200/n5200.h
source/src/vm/n5200/system.cpp
source/src/vm/n5200/system.h
source/src/vm/pasopia/display.cpp
source/src/vm/pasopia/display.h
source/src/vm/pasopia/floppy.cpp
source/src/vm/pasopia/floppy.h
source/src/vm/pasopia/joypac2.cpp
source/src/vm/pasopia/joypac2.h
source/src/vm/pasopia/kanjipac2.cpp
source/src/vm/pasopia/kanjipac2.h
source/src/vm/pasopia/keyboard.cpp
source/src/vm/pasopia/keyboard.h
source/src/vm/pasopia/memory.cpp
source/src/vm/pasopia/memory.h
source/src/vm/pasopia/pac2.cpp
source/src/vm/pasopia/pac2.h
source/src/vm/pasopia/pac2dev.h
source/src/vm/pasopia/pasopia.cpp
source/src/vm/pasopia/pasopia.h
source/src/vm/pasopia/rampac2.cpp
source/src/vm/pasopia/rampac2.h
source/src/vm/pasopia7/display.cpp
source/src/vm/pasopia7/display.h
source/src/vm/pasopia7/floppy.cpp
source/src/vm/pasopia7/floppy.h
source/src/vm/pasopia7/iobus.cpp
source/src/vm/pasopia7/iobus.h
source/src/vm/pasopia7/iotrap.cpp
source/src/vm/pasopia7/iotrap.h
source/src/vm/pasopia7/joypac2.cpp
source/src/vm/pasopia7/joypac2.h
source/src/vm/pasopia7/kanjipac2.cpp
source/src/vm/pasopia7/kanjipac2.h
source/src/vm/pasopia7/keyboard.cpp
source/src/vm/pasopia7/keyboard.h
source/src/vm/pasopia7/memory.cpp
source/src/vm/pasopia7/memory.h
source/src/vm/pasopia7/pac2.cpp
source/src/vm/pasopia7/pac2.h
source/src/vm/pasopia7/pac2dev.h
source/src/vm/pasopia7/pasopia7.cpp
source/src/vm/pasopia7/pasopia7.h
source/src/vm/pasopia7/rampac2.cpp
source/src/vm/pasopia7/rampac2.h
source/src/vm/pc100/crtc.cpp
source/src/vm/pc100/crtc.h
source/src/vm/pc100/ioctrl.cpp
source/src/vm/pc100/ioctrl.h
source/src/vm/pc100/kanji.cpp
source/src/vm/pc100/kanji.h
source/src/vm/pc100/pc100.cpp
source/src/vm/pc100/pc100.h
source/src/vm/pc2001/io.cpp
source/src/vm/pc2001/io.h
source/src/vm/pc2001/pc2001.cpp
source/src/vm/pc2001/pc2001.h
source/src/vm/pc6001/display.cpp
source/src/vm/pc6001/display.h
source/src/vm/pc6001/floppy.cpp
source/src/vm/pc6001/floppy.h
source/src/vm/pc6001/joystick.cpp
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.cpp
source/src/vm/pc6001/psub.h
source/src/vm/pc6001/sub.cpp
source/src/vm/pc6001/sub.h
source/src/vm/pc6001/timer.cpp
source/src/vm/pc6001/timer.h
source/src/vm/pc8201/cmt.cpp
source/src/vm/pc8201/cmt.h
source/src/vm/pc8201/keyboard.cpp
source/src/vm/pc8201/keyboard.h
source/src/vm/pc8201/lcd.cpp
source/src/vm/pc8201/lcd.h
source/src/vm/pc8201/memory.cpp
source/src/vm/pc8201/memory.h
source/src/vm/pc8201/pc8201.cpp
source/src/vm/pc8201/pc8201.h
source/src/vm/pc9801/cmt.cpp
source/src/vm/pc9801/cmt.h
source/src/vm/pc9801/cpureg.cpp
source/src/vm/pc9801/cpureg.h
source/src/vm/pc9801/display.cpp
source/src/vm/pc9801/display.h
source/src/vm/pc9801/dmareg.cpp
source/src/vm/pc9801/dmareg.h
source/src/vm/pc9801/floppy.cpp
source/src/vm/pc9801/floppy.h
source/src/vm/pc9801/fmsound.cpp
source/src/vm/pc9801/fmsound.h
source/src/vm/pc9801/joystick.cpp
source/src/vm/pc9801/joystick.h
source/src/vm/pc9801/keyboard.cpp
source/src/vm/pc9801/keyboard.h
source/src/vm/pc9801/membus.cpp
source/src/vm/pc9801/membus.h
source/src/vm/pc9801/mouse.cpp
source/src/vm/pc9801/mouse.h
source/src/vm/pc9801/pc9801.cpp
source/src/vm/pc9801/pc9801.h
source/src/vm/pc9801/sasi.cpp
source/src/vm/pc9801/sasi.h
source/src/vm/pc98ha/bios.cpp
source/src/vm/pc98ha/bios.h
source/src/vm/pc98ha/calendar.cpp
source/src/vm/pc98ha/calendar.h
source/src/vm/pc98ha/floppy.cpp
source/src/vm/pc98ha/floppy.h
source/src/vm/pc98ha/keyboard.cpp
source/src/vm/pc98ha/keyboard.h
source/src/vm/pc98ha/memory.cpp
source/src/vm/pc98ha/memory.h
source/src/vm/pc98ha/note.cpp
source/src/vm/pc98ha/note.h
source/src/vm/pc98ha/pc98ha.cpp
source/src/vm/pc98ha/pc98ha.h
source/src/vm/pcengine/pce.cpp
source/src/vm/pcengine/pce.h
source/src/vm/pcengine/pcengine.cpp
source/src/vm/pcengine/pcengine.h
source/src/vm/phc20/memory.cpp
source/src/vm/phc20/memory.h
source/src/vm/phc20/phc20.cpp
source/src/vm/phc20/phc20.h
source/src/vm/phc25/joystick.cpp
source/src/vm/phc25/joystick.h
source/src/vm/phc25/keyboard.cpp
source/src/vm/phc25/keyboard.h
source/src/vm/phc25/memory.cpp
source/src/vm/phc25/memory.h
source/src/vm/phc25/phc25.cpp
source/src/vm/phc25/phc25.h
source/src/vm/phc25/system.cpp
source/src/vm/phc25/system.h
source/src/vm/qc10/display.cpp
source/src/vm/qc10/display.h
source/src/vm/qc10/floppy.cpp
source/src/vm/qc10/floppy.h
source/src/vm/qc10/keyboard.cpp
source/src/vm/qc10/keyboard.h
source/src/vm/qc10/memory.cpp
source/src/vm/qc10/memory.h
source/src/vm/qc10/mfont.cpp
source/src/vm/qc10/mfont.h
source/src/vm/qc10/qc10.cpp
source/src/vm/qc10/qc10.h
source/src/vm/tk80bs/cmt.cpp
source/src/vm/tk80bs/cmt.h
source/src/vm/tk80bs/display.cpp
source/src/vm/tk80bs/display.h
source/src/vm/tk80bs/keyboard.cpp
source/src/vm/tk80bs/keyboard.h
source/src/vm/tk80bs/membus.cpp
source/src/vm/tk80bs/membus.h
source/src/vm/tk80bs/memory.cpp
source/src/vm/tk80bs/memory.h
source/src/vm/tk80bs/tk80bs.cpp
source/src/vm/tk80bs/tk80bs.h
source/src/vm/x1/x1.cpp
source/src/vm/x1/x1.h

index 114e98a..df6f5d4 100644 (file)
@@ -102,7 +102,6 @@ class VM : public VM_TEMPLATE
 {
 protected:
        //EMU* emu;
-       //csp_state_utils* state_entry;
        
        // devices
        //EVENT* event;
index edb3661..bae0fef 100644 (file)
@@ -54,8 +54,6 @@
 
 #if defined(_USE_QT)
 class CSP_Logger;
-class csp_state_utils;
-
 extern CSP_Logger *csp_logger;
 
 #endif
@@ -67,7 +65,6 @@ protected:
        OSD* osd;
 #if defined(_USE_QT)
        CSP_Logger *p_logger;
-       csp_state_utils *state_entry;
 #endif
 
 public:
@@ -76,7 +73,6 @@ public:
 #if defined(_USE_QT)
                osd = emu->get_osd();
                p_logger = csp_logger;
-               state_entry = NULL;
 #else
                osd = NULL;
 #endif
@@ -107,8 +103,6 @@ public:
        virtual void initialize() {     /* osd = emu->get_osd(); */ /* Initializing VM must be after initializing OSD. */ }
 #if defined(_USE_QT)
        virtual void release() {
-               if(state_entry != NULL) delete state_entry;
-               state_entry = NULL;
        }
 #else
        virtual void release() {}
index ba7e90c..3d60d12 100644 (file)
@@ -55,7 +55,6 @@ typedef struct {
        bool mfm;
 } fd_format_t;
 
-class csp_state_utils;
 class CSP_Logger;
 class FILEIO;
 class OSD;
@@ -66,7 +65,6 @@ protected:
        EMU* emu;
        OSD* osd;
 #endif
-       csp_state_utils *state_entry;
 private:
        uint8_t buffer[DISK_BUFFER_SIZE + TRACK_BUFFER_SIZE];
        _TCHAR orig_path[_MAX_PATH];
index 8afaea5..909e0cb 100644 (file)
@@ -17,6 +17,8 @@
 #define SCRN_640x400   1
 #define SCRN_640x200   2
 
+namespace MZ2800 {
+
 void CRTC::initialize()
 {
        // set 16/4096 palette
@@ -1482,3 +1484,5 @@ bool CRTC::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(trans_init);
        return true;
 }
+
+}
index 336ea62..abb266f 100644 (file)
@@ -18,6 +18,8 @@
 #define SIG_CRTC_PALLETE       1
 #define SIG_CRTC_MASK          2
 
+namespace MZ2800 {
+
 class CRTC : public DEVICE
 {
 private:
@@ -133,5 +135,6 @@ public:
        void draw_screen();
 };
 
+}
 #endif
 
index e9636d9..fd9d6e2 100644 (file)
@@ -11,6 +11,8 @@
 #include "../mb8877.h"
 #include "../disk.h"
 
+namespace MZ2800 {
+
 void FLOPPY::reset()
 {
        for(int i = 0; i < 4; i++) {
@@ -48,3 +50,4 @@ void FLOPPY::write_io8(uint32_t addr, uint32_t data)
        }
 }
 
+}
index 911e6f5..4a67351 100644 (file)
@@ -16,6 +16,8 @@
 
 class MB8877;
 
+namespace MZ2800 {
+
 class FLOPPY : public DEVICE
 {
 private:
@@ -39,5 +41,6 @@ public:
        }
 };
 
+}
 #endif
 
index 10d17d7..510b326 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "joystick.h"
 
+namespace MZ2800 {
+
 void JOYSTICK::initialize()
 {
        mode = 0xf;
@@ -64,3 +66,5 @@ bool JOYSTICK::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint32(mode);
        return true;
 }
+
+}
index 43f21cf..d7b1fd4 100644 (file)
@@ -14,6 +14,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace MZ2800 {
+
 class JOYSTICK : public DEVICE
 {
 private:
@@ -33,4 +35,5 @@ public:
        bool process_state(FILEIO* state_fio, bool loading);
 };
 
+}
 #endif
index 5767fb2..61f9e71 100644 (file)
@@ -11,6 +11,8 @@
 #include "../i8255.h"
 #include "../z80pio.h"
 
+namespace MZ2800 {
+
 static const int key_map[14][8] = {
        {0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77},
        {0x78, 0x79, 0x68, 0x69, 0x6c, 0x6e, 0x6b, 0x6d},
@@ -98,3 +100,5 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint8(column);
        return true;
 }
+
+}
index b6c939a..22cf930 100644 (file)
@@ -16,6 +16,8 @@
 
 #define SIG_KEYBOARD_COLUMN    0
 
+namespace MZ2800 {
+
 class KEYBOARD : public DEVICE
 {
 private:
@@ -52,5 +54,6 @@ public:
        }
 };
 
+}
 #endif
 
index d755559..2aec944 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "./memory.h"
 
+namespace MZ2800 {
+
 #define SET_BANK(s, e, w, r) { \
        int sb = (s) >> 11, eb = (e) >> 11; \
        for(int i = sb; i <= eb; i++) { \
@@ -25,7 +27,7 @@
        } \
 }
 
-void MZ2800_MEMORY::initialize()
+void MEMORY::initialize()
 {
        // init memory
        memset(ram, 0, sizeof(ram));
@@ -61,7 +63,7 @@ void MZ2800_MEMORY::initialize()
        delete fio;
 }
 
-void MZ2800_MEMORY::reset()
+void MEMORY::reset()
 {
        SET_BANK(0x000000, 0x0bffff, ram, ram);
        SET_BANK(0x0c0000, 0x0dffff, vram, vram);
@@ -79,7 +81,7 @@ void MZ2800_MEMORY::reset()
        vram_bank = dic_bank = kanji_bank = 0;
 }
 
-void MZ2800_MEMORY::write_data8(uint32_t addr, uint32_t data)
+void MEMORY::write_data8(uint32_t addr, uint32_t data)
 {
        if((addr & 0xfc0000) == 0x80000) {
                write_dma_data8((addr & 0x3ffff) | mem_window, data);
@@ -90,7 +92,7 @@ void MZ2800_MEMORY::write_data8(uint32_t addr, uint32_t data)
        }
 }
 
-uint32_t MZ2800_MEMORY::read_data8(uint32_t addr)
+uint32_t MEMORY::read_data8(uint32_t addr)
 {
        if((addr & 0xfc0000) == 0x80000) {
                return read_dma_data8((addr & 0x3ffff) | mem_window);
@@ -101,17 +103,17 @@ uint32_t MZ2800_MEMORY::read_data8(uint32_t addr)
        }
 }
 
-void MZ2800_MEMORY::write_dma_data8(uint32_t addr, uint32_t data)
+void MEMORY::write_dma_data8(uint32_t addr, uint32_t data)
 {
        wbank[addr >> 11][addr & 0x7ff] = data;
 }
 
-uint32_t MZ2800_MEMORY::read_dma_data8(uint32_t addr)
+uint32_t MEMORY::read_dma_data8(uint32_t addr)
 {
        return rbank[addr >> 11][addr & 0x7ff];
 }
 
-void MZ2800_MEMORY::write_io8(uint32_t addr, uint32_t data)
+void MEMORY::write_io8(uint32_t addr, uint32_t data)
 {
        switch(addr & 0x7fff) {
        case 0x8c:
@@ -160,7 +162,7 @@ void MZ2800_MEMORY::write_io8(uint32_t addr, uint32_t data)
        }
 }
 
-uint32_t MZ2800_MEMORY::read_io8(uint32_t addr)
+uint32_t MEMORY::read_io8(uint32_t addr)
 {
        switch(addr & 0x7fff) {
        case 0x8c:
@@ -177,7 +179,7 @@ uint32_t MZ2800_MEMORY::read_io8(uint32_t addr)
 
 #define STATE_VERSION  2
 
-bool MZ2800_MEMORY::process_state(FILEIO* state_fio, bool loading)
+bool MEMORY::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
@@ -220,3 +222,5 @@ bool MZ2800_MEMORY::process_state(FILEIO* state_fio, bool loading)
        }
        return true;
 }
+
+}
index 26fc92f..a115de8 100644 (file)
@@ -14,7 +14,9 @@
 #include "../../emu.h"
 #include "../device.h"
 
-class MZ2800_MEMORY : public DEVICE
+namespace MZ2800 {
+
+class MEMORY : public DEVICE
 {
 private:
        DEVICE* d_crtc;
@@ -36,11 +38,11 @@ private:
        uint8_t vram_bank, dic_bank, kanji_bank;
        
 public:
-       MZ2800_MEMORY(VM_TEMPLATE* 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"));
        }
-       ~MZ2800_MEMORY() {}
+       ~MEMORY() {}
        
        // common functions
        void initialize();
@@ -76,5 +78,6 @@ public:
        }
 };
 
+}
 #endif
 
index 2305de8..826b1f5 100644 (file)
@@ -10,6 +10,8 @@
 #include "mouse.h"
 #include "../z80sio.h"
 
+namespace MZ2800 {
+
 void MOUSE::initialize()
 {
        stat = emu->get_mouse_buffer();
@@ -51,3 +53,5 @@ bool MOUSE::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(select);
        return true;
 }
+
+}
index 6f5b9a6..1bc4bc8 100644 (file)
@@ -17,6 +17,8 @@
 #define SIG_MOUSE_SEL  0
 #define SIG_MOUSE_DTR  1
 
+namespace MZ2800 {
+
 class MOUSE : public DEVICE
 {
 private:
@@ -45,5 +47,6 @@ public:
        }
 };
 
+}
 #endif
 
index 5915fde..4e14eb8 100644 (file)
 #include "serial.h"
 #include "sysport.h"
 
+using MZ2800::CRTC;
+using MZ2800::FLOPPY;
+using MZ2800::JOYSTICK;
+using MZ2800::KEYBOARD;
+using MZ2800::MEMORY;
+using MZ2800::MOUSE;
+using MZ2800::PRINTER;
+using MZ2800::RESET;
+using MZ2800::SASI;
+using MZ2800::SERIAL;
+using MZ2800::SYSPORT;
+
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
@@ -95,7 +107,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
        floppy = new FLOPPY(this, emu);
        joystick = new JOYSTICK(this, emu);
        keyboard = new KEYBOARD(this, emu);
-       memory = new MZ2800_MEMORY(this, emu);
+       memory = new MEMORY(this, emu);
        mouse = new MOUSE(this, emu);
        printer = new PRINTER(this, emu);
        rst = new RESET(this, emu);
index 59903cf..8aebedc 100644 (file)
@@ -78,17 +78,19 @@ class YM2203;
 class Z80PIO;
 class Z80SIO;
 
-class CRTC;
-class FLOPPY;
-class JOYSTICK;
-class KEYBOARD;
-class MZ2800_MEMORY;
-class MOUSE;
-class PRINTER;
-class RESET;
-class SASI;
-class SERIAL;
-class SYSPORT;
+namespace MZ2800 {
+       class CRTC;
+       class FLOPPY;
+       class JOYSTICK;
+       class KEYBOARD;
+       class MEMORY;
+       class MOUSE;
+       class PRINTER;
+       class RESET;
+       class SASI;
+       class SERIAL;
+       class SYSPORT;
+}
 
 class VM : public VM_TEMPLATE
 {
@@ -115,17 +117,17 @@ protected:
        Z80PIO* pio1;
        Z80SIO* sio;
        
-       CRTC* crtc;
-       FLOPPY* floppy;
-       JOYSTICK* joystick;
-       KEYBOARD* keyboard;
-       MZ2800_MEMORY* memory;
-       MOUSE* mouse;
-       PRINTER* printer;
-       RESET* rst;
-       SASI* sasi;
-       SERIAL* serial;
-       SYSPORT* sysport;
+       MZ2800::CRTC* crtc;
+       MZ2800::FLOPPY* floppy;
+       MZ2800::JOYSTICK* joystick;
+       MZ2800::KEYBOARD* keyboard;
+       MZ2800::MEMORY* memory;
+       MZ2800::MOUSE* mouse;
+       MZ2800::PRINTER* printer;
+       MZ2800::RESET* rst;
+       MZ2800::SASI* sasi;
+       MZ2800::SERIAL* serial;
+       MZ2800::SYSPORT* sysport;
        
 public:
        // ----------------------------------------
index cff3a24..02982c4 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "printer.h"
 
+namespace MZ2800 {
+
 void PRINTER::write_io8(uint32_t addr, uint32_t data)
 {
        switch(addr & 0x7fff) {
@@ -31,3 +33,4 @@ uint32_t PRINTER::read_io8(uint32_t addr)
        return 0xff;
 }
 
+}
index a8c9e84..28d12b5 100644 (file)
@@ -14,6 +14,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace MZ2800 {
+
 class PRINTER : public DEVICE
 {
 private:
@@ -37,5 +39,6 @@ public:
        }
 };
 
+}
 #endif
 
index a999525..ceb8180 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "reset.h"
 
+namespace MZ2800 {
+
 void RESET::initialize()
 {
        prev = 0xff;
@@ -39,3 +41,5 @@ bool RESET::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint8(prev);
        return true;
 }
+
+}
index da781aa..a664982 100644 (file)
@@ -16,6 +16,8 @@
 
 #define SIG_RESET_CONTROL      0
 
+namespace MZ2800 {
+
 class RESET : public DEVICE
 {
 private:
@@ -34,5 +36,6 @@ public:
        bool process_state(FILEIO* state_fio, bool loading);
 };
 
+}
 #endif
 
index 388ba97..4ff8299 100644 (file)
@@ -20,6 +20,8 @@
 #define STATUS_ACK     0x40
 #define STATUS_REQ     0x80
 
+namespace MZ2800 {
+
 void SASI::reset()
 {
        control = 0x00;
@@ -136,3 +138,5 @@ bool SASI::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(drq_status);
        return true;
 }
+
+}
index 93e8cc8..e5c7abb 100644 (file)
@@ -17,6 +17,8 @@
 #define SIG_SASI_IRQ   0
 #define SIG_SASI_DRQ   1
 
+namespace MZ2800 {
+
 class SASI : public DEVICE
 {
 private:
@@ -59,5 +61,6 @@ public:
        }
 };
 
+}
 #endif
 
index 6959ab2..02ff7ec 100644 (file)
@@ -10,6 +10,8 @@
 #include "serial.h"
 #include "../z80sio.h"
 
+namespace MZ2800 {
+
 void SERIAL::reset()
 {
        addr_a0 = true;
@@ -80,3 +82,5 @@ bool SERIAL::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(addr_a0);
        return true;
 }
+
+}
index e72620f..540f74e 100644 (file)
@@ -16,6 +16,8 @@
 
 class Z80SIO;
 
+namespace MZ2800 {
+
 class SERIAL : public DEVICE
 {
 private:
@@ -42,5 +44,6 @@ public:
        }
 };
 
+}
 #endif
 
index 7e17293..8e2a825 100644 (file)
@@ -10,6 +10,8 @@
 #include "sysport.h"
 #include "../i8253.h"
 
+namespace MZ2800 {
+
 void SYSPORT::write_io8(uint32_t addr, uint32_t data)
 {
        switch(addr & 0x7fff) {
@@ -34,3 +36,4 @@ uint32_t SYSPORT::read_io8(uint32_t addr)
        return 0xff;
 }
 
+}
index a815288..214436a 100644 (file)
@@ -14,6 +14,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace MZ2800 {
+
 class SYSPORT : public DEVICE
 {
 private:
@@ -41,5 +43,6 @@ public:
        }
 };
 
+}
 #endif
 
index eabcaa5..028aaf6 100644 (file)
@@ -61,6 +61,8 @@
 // PRO         Page Up
 // OP          Page Down
 
+namespace MZ3500 {
+
 static const uint16_t key_table[256] = {
        0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x00f, 0x1f4, 0x000, 0x000, 0x000, 0x00d, 0x000, 0x000,
        0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x0fe, 0x000, 0x0fe, 0x000, 0x000, 0x000, 0x000,
@@ -485,3 +487,5 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(pro_mode);
        return true;
 }
+
+}
index 31c6770..eeaeb15 100644 (file)
@@ -20,6 +20,8 @@
 
 class FIFO;
 
+namespace MZ3500 {
+
 class KEYBOARD : public DEVICE
 {
 private:
@@ -77,4 +79,5 @@ public:
        }
 };
 
+}
 #endif
index 88233d6..290e347 100644 (file)
@@ -10,6 +10,8 @@
 #include "./main.h"
 #include "../upd765a.h"
 
+namespace MZ3500 {
+
 #define SET_BANK(s, e, w, r) { \
        int sb = (s) >> 11, eb = (e) >> 11; \
        for(int i = sb; i <= eb; i++) { \
@@ -430,3 +432,5 @@ bool MAIN::process_state(FILEIO* state_fio, bool loading)
        }
        return true;
 }
+
+}
index 8d1314d..9e5e6ac 100644 (file)
@@ -25,6 +25,8 @@
 #define SIG_MAIN_DRQ   8
 #define SIG_MAIN_INDEX 9
 
+namespace MZ3500 {
+
 class MAIN : public DEVICE
 {
 private:
@@ -98,5 +100,6 @@ public:
        }
 };
 
+}
 #endif
 
index dea738d..a888ccc 100644 (file)
 #include "./sub.h"
 #include "keyboard.h"
 
+using MZ3500::MAIN;
+using MZ3500::SUB;
+using MZ3500::KEYBOARD;
+
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
index bdaaa80..9852080 100644 (file)
@@ -77,9 +77,11 @@ class UPD7220;
 class UPD765A;
 class Z80;
 
-class MAIN;
-class SUB;
-class KEYBOARD;
+namespace MZ3500 {
+       class MAIN;
+       class SUB;
+       class KEYBOARD;
+}
 
 class VM : public VM_TEMPLATE
 {
@@ -94,7 +96,7 @@ protected:
        IO* mainio;
        UPD765A* fdc;
        Z80* maincpu;
-       MAIN* mainbus;
+       MZ3500::MAIN* mainbus;
        
        // for sub cpu
        DEVICE* printer;
@@ -117,8 +119,8 @@ protected:
        UPD7220* gdc_chr;
        UPD7220* gdc_gfx;
        Z80* subcpu;
-       SUB* subbus;
-       KEYBOARD* kbd;
+       MZ3500::SUB* subbus;
+       MZ3500::KEYBOARD* kbd;
        
        uint8_t halt;
        
index fd7de6e..c4a51c5 100644 (file)
@@ -10,6 +10,8 @@
 #include "./sub.h"
 #include "./main.h"
 
+namespace MZ3500 {
+
 #define SET_BANK(s, e, w, r) { \
        int sb = (s) >> 11, eb = (e) >> 11; \
        for(int i = sb; i <= eb; i++) { \
@@ -585,3 +587,5 @@ bool SUB::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(crt_400line);
        return true;
 }
+
+}
index 92bb0d2..614af94 100644 (file)
@@ -14,6 +14,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace MZ3500 {
+
 class SUB : public DEVICE
 {
 private:
@@ -123,5 +125,6 @@ public:
        void draw_screen();
 };
 
+}
 #endif
 
index 5a0a846..713cdb6 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "display.h"
 
+namespace MZ5500 {
+
 static const int plane_priority[8][8] = {
        {0, 1, 2, 3, 0, 1, 2, 3}, {0, 1, 2, 3, 4, 1, 2, 3},
        {0, 1, 2, 3, 4, 4, 2, 3}, {0, 1, 2, 3, 4, 4, 4, 3},
@@ -545,3 +547,5 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint8(mode_p);
        return true;
 }
+
+}
index 65d76b3..96e3c1a 100644 (file)
@@ -18,6 +18,8 @@
 
 class UPD7220;
 
+namespace MZ5500 {
+
 class DISPLAY : public DEVICE
 {
 private:
@@ -82,5 +84,6 @@ public:
        void draw_screen();
 };
 
+}
 #endif
 
index 312a96f..e5e6762 100644 (file)
@@ -61,6 +61,8 @@
 #define TIMEOUT_500MSEC        30
 #define TIMEOUT_100MSEC        6
 
+namespace MZ5500 {
+
 static const int key_table[256] = {
        0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x008,0x009,0x000,0x000,0x000,0x00d,0x000,0x000,
        0x000,0x000,0x000,0x006,0x000,0x000,0x000,0x000,0x000,0x000,0x000,0x01b,0x000,0x000,0x000,0x000,
@@ -493,3 +495,5 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateInt32(timeout);
        return true;
 }
+
+}
index 4233cef..57bb4e3 100644 (file)
@@ -18,6 +18,8 @@
 
 class FIFO;
 
+namespace MZ5500 {
+
 class KEYBOARD : public DEVICE
 {
 private:
@@ -71,4 +73,5 @@ public:
        }
 };
 
+}
 #endif
index 8123649..16ff67b 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "./memory.h"
 
+namespace MZ5500 {
+
 #define SET_BANK(s, e, w, r) { \
        int sb = (s) >> 14, eb = (e) >> 14; \
        for(int i = sb; i <= eb; i++) { \
@@ -25,7 +27,7 @@
        } \
 }
 
-void MZ5500_MEMORY::initialize()
+void MEMORY::initialize()
 {
        // init memory
        memset(ram, 0, sizeof(ram));
@@ -84,14 +86,14 @@ void MZ5500_MEMORY::initialize()
        haddr = 0;
 }
 
-void MZ5500_MEMORY::reset()
+void MEMORY::reset()
 {
        bank1 = 0xe0;
        bank2 = 0;
        update_bank();
 }
 
-void MZ5500_MEMORY::write_data8(uint32_t addr, uint32_t data)
+void MEMORY::write_data8(uint32_t addr, uint32_t data)
 {
        addr &= 0xfffff;
 //     if((0x80000 <= addr && addr < 0xa0000) || (0xf0000 <= addr && addr < 0xfc000)) {
@@ -100,7 +102,7 @@ void MZ5500_MEMORY::write_data8(uint32_t addr, uint32_t data)
        wbank[addr >> 14][addr & 0x3fff] = data;
 }
 
-uint32_t MZ5500_MEMORY::read_data8(uint32_t addr)
+uint32_t MEMORY::read_data8(uint32_t addr)
 {
        addr &= 0xfffff;
 //     if((0x80000 <= addr && addr < 0xa0000) || (0xf0000 <= addr && addr < 0xfc000)) {
@@ -109,7 +111,7 @@ uint32_t MZ5500_MEMORY::read_data8(uint32_t addr)
        return rbank[addr >> 14][addr & 0x3fff];
 }
 
-void MZ5500_MEMORY::write_dma_data8(uint32_t addr, uint32_t data)
+void MEMORY::write_dma_data8(uint32_t addr, uint32_t data)
 {
        addr = (addr & 0xffff) | haddr;
 //     if((0x80000 <= addr && addr < 0xa0000) || (0xf0000 <= addr && addr < 0xfc000)) {
@@ -118,7 +120,7 @@ void MZ5500_MEMORY::write_dma_data8(uint32_t addr, uint32_t data)
        wbank[addr >> 14][addr & 0x3fff] = data;
 }
 
-uint32_t MZ5500_MEMORY::read_dma_data8(uint32_t addr)
+uint32_t MEMORY::read_dma_data8(uint32_t addr)
 {
        addr = (addr & 0xffff) | haddr;
 //     if((0x80000 <= addr && addr < 0xa0000) || (0xf0000 <= addr && addr < 0xfc000)) {
@@ -127,7 +129,7 @@ uint32_t MZ5500_MEMORY::read_dma_data8(uint32_t addr)
        return rbank[addr >> 14][addr & 0x3fff];
 }
 
-void MZ5500_MEMORY::write_io8(uint32_t addr, uint32_t data)
+void MEMORY::write_io8(uint32_t addr, uint32_t data)
 {
        switch(addr & 0xff) {
        case 0x50:
@@ -145,12 +147,12 @@ void MZ5500_MEMORY::write_io8(uint32_t addr, uint32_t data)
        }
 }
 
-uint32_t MZ5500_MEMORY::read_io8(uint32_t addr)
+uint32_t MEMORY::read_io8(uint32_t addr)
 {
        return 0xf0 | bank2;    // ???
 }
 
-void MZ5500_MEMORY::write_signal(int id, uint32_t data, uint32_t mask)
+void MEMORY::write_signal(int id, uint32_t data, uint32_t mask)
 {
        if(bank1 != data) {
                bank1 = data;
@@ -158,7 +160,7 @@ void MZ5500_MEMORY::write_signal(int id, uint32_t data, uint32_t mask)
        }
 }
 
-void MZ5500_MEMORY::update_bank()
+void MEMORY::update_bank()
 {
        switch(bank1 & 0xe0) {
        case 0xe0:
@@ -190,7 +192,7 @@ void MZ5500_MEMORY::update_bank()
 
 #define STATE_VERSION  1
 
-bool MZ5500_MEMORY::process_state(FILEIO* state_fio, bool loading)
+bool MEMORY::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
@@ -213,3 +215,5 @@ bool MZ5500_MEMORY::process_state(FILEIO* state_fio, bool loading)
                }
        return true;
 }
+
+}
index 779ddd0..b9dffbb 100644 (file)
@@ -16,7 +16,9 @@
 
 #define SIG_MEMORY_BANK        0
 
-class MZ5500_MEMORY : public DEVICE
+namespace MZ5500 {
+
+class MEMORY : public DEVICE
 {
 private:
        DEVICE* d_cpu;
@@ -50,11 +52,11 @@ private:
        void update_bank();
        
 public:
-       MZ5500_MEMORY(VM_TEMPLATE* 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"));
        }
-       ~MZ5500_MEMORY() {}
+       ~MEMORY() {}
        
        // common functions
        void initialize();
@@ -79,5 +81,6 @@ public:
        }
 };
 
+}
 #endif
 
index 3f7e3e7..e8548f2 100644 (file)
 #include "./memory.h"
 #include "sysport.h"
 
+using MZ5500::DISPLAY;
+using MZ5500::KEYBOARD;
+using MZ5500::MEMORY;
+using MZ5500::SYSPORT;
+
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
@@ -107,7 +112,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
        
        display = new DISPLAY(this, emu);
        keyboard = new KEYBOARD(this, emu);
-       memory = new MZ5500_MEMORY(this, emu);
+       memory = new MEMORY(this, emu);
        sysport = new SYSPORT(this, emu);
 
        // set contexts
index b67aebd..26a8ef8 100644 (file)
@@ -101,10 +101,12 @@ class AY_3_891X;
 class Z80CTC;
 class Z80SIO;
 
-class DISPLAY;
-class KEYBOARD;
-class MZ5500_MEMORY;
-class SYSPORT;
+namespace MZ5500 {
+       class DISPLAY;
+       class KEYBOARD;
+       class MEMORY;
+       class SYSPORT;
+}
 
 class VM : public VM_TEMPLATE
 {
@@ -146,10 +148,10 @@ protected:
 #endif
        Z80SIO* sio;
        
-       DISPLAY* display;
-       KEYBOARD* keyboard;
-       MZ5500_MEMORY* memory;
-       SYSPORT* sysport;
+       MZ5500::DISPLAY* display;
+       MZ5500::KEYBOARD* keyboard;
+       MZ5500::MEMORY* memory;
+       MZ5500::SYSPORT* sysport;
        
 public:
        // ----------------------------------------
index 96a9b49..99d6afe 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "sysport.h"
 
+namespace MZ5500 {
+
 void SYSPORT::initialize()
 {
        rst = 0;
@@ -80,3 +82,5 @@ bool SYSPORT::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateInt32(highden);
        return true;
 }
+
+}
index 3bcc4be..27b12e4 100644 (file)
@@ -14,6 +14,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace MZ5500 {
+
 class SYSPORT : public DEVICE
 {
 private:
@@ -53,5 +55,6 @@ public:
        }
 };
 
+}
 #endif
 
index cc17b70..2bb9688 100644 (file)
@@ -10,6 +10,8 @@
 #include "display.h"
 #include "../i8259.h"
 
+namespace N5200 {
+
 void DISPLAY::initialize()
 {
        register_vline_event(this);
@@ -42,3 +44,4 @@ void DISPLAY::draw_screen()
        emu->screen_skip_line(false);
 }
 
+}
index df30d64..c965861 100644 (file)
@@ -14,6 +14,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace N5200 {
+
 class DISPLAY : public DEVICE
 {
 private:
@@ -51,5 +53,6 @@ public:
        void draw_screen();
 };
 
+}
 #endif
 
index 940894d..5258871 100644 (file)
@@ -12,6 +12,8 @@
 #include "floppy.h"
 #include "../i8237.h"
 
+namespace N5200 {
+
 void FLOPPY::reset()
 {
        chgreg = 3;
@@ -81,3 +83,4 @@ void FLOPPY::write_signal(int id, uint32_t data, uint32_t mask)
        d_dma->write_signal(dma_ids[chgreg & 1], data, mask);
 }
 
+}
index 2836f2a..c99127b 100644 (file)
@@ -16,6 +16,8 @@
 
 #define SIG_FLOPPY_DRQ 0
 
+namespace N5200 {
+
 class FLOPPY : public DEVICE
 {
 private:
@@ -47,5 +49,6 @@ public:
        }
 };
 
+}
 #endif
 
index 5b2632f..afcba7f 100644 (file)
@@ -10,6 +10,8 @@
 #include "keyboard.h"
 #include "../i8251.h"
 
+namespace N5200 {
+
 static const int key_table[256] = {
          -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,0x0e,0x0f,  -1,  -1,  -1,0x1c,  -1,  -1,
        0x70,0x74,0x73,0x60,  -1,  -1,  -1,  -1,  -1,  -1,  -1,0x00,0x35,0x51,  -1,  -1,
@@ -94,3 +96,4 @@ void KEYBOARD::key_up(int code)
        }
 }
 
+}
index a659dc7..7dd39ad 100644 (file)
@@ -17,6 +17,8 @@
 #define SIG_KEYBOARD_RST       0
 #define SIG_KEYBOARD_RECV      1
 
+namespace N5200 {
+
 class KEYBOARD : public DEVICE
 {
 private:
@@ -54,4 +56,5 @@ public:
        }
 };
 
+}
 #endif
index 40d602a..be8b8ef 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "./memory.h"
 
+namespace N5200 {
+
 #define SET_BANK(s, e, w, r) { \
        int sb = (s) >> 11, eb = (e) >> 11; \
        for(int i = sb; i <= eb; i++) { \
@@ -25,7 +27,7 @@
        } \
 }
 
-void N5200_MEMORY::initialize()
+void MEMORY::initialize()
 {
        // init memory
        memset(ram, 0, sizeof(ram));
@@ -48,7 +50,7 @@ void N5200_MEMORY::initialize()
        delete fio;
 }
 
-void N5200_MEMORY::release()
+void MEMORY::release()
 {
        // save ram image
        FILEIO* fio = new FILEIO();
@@ -59,7 +61,7 @@ void N5200_MEMORY::release()
        delete fio;
 }
 
-void N5200_MEMORY::reset()
+void MEMORY::reset()
 {
        SET_BANK(0x000000, 0xffffff, wdmy, rdmy);
        SET_BANK(0x000000, 0x0bffff, ram, ram);
@@ -73,7 +75,7 @@ void N5200_MEMORY::reset()
        protect = true;
 }
 
-void N5200_MEMORY::write_data8(uint32_t addr, uint32_t data)
+void MEMORY::write_data8(uint32_t addr, uint32_t data)
 {
        addr &= 0xffffff;
        if(0xe7800 <= addr && addr < 0xf0000 && protect) {
@@ -82,13 +84,13 @@ void N5200_MEMORY::write_data8(uint32_t addr, uint32_t data)
        wbank[addr >> 11][addr & 0x7ff] = data;
 }
 
-uint32_t N5200_MEMORY::read_data8(uint32_t addr)
+uint32_t MEMORY::read_data8(uint32_t addr)
 {
        addr &= 0xffffff;
        return rbank[addr >> 11][addr & 0x7ff];
 }
 
-void N5200_MEMORY::write_io8(uint32_t addr, uint32_t data)
+void MEMORY::write_io8(uint32_t addr, uint32_t data)
 {
        switch(addr) {
        case 0x74:
@@ -97,8 +99,9 @@ void N5200_MEMORY::write_io8(uint32_t addr, uint32_t data)
        }
 }
 
-uint32_t N5200_MEMORY::read_io8(uint32_t addr)
+uint32_t MEMORY::read_io8(uint32_t addr)
 {
        return 0xff;
 }
 
+}
index 1ecc5a6..fb9b2f1 100644 (file)
@@ -14,7 +14,9 @@
 #include "../../emu.h"
 #include "../device.h"
 
-class N5200_MEMORY : public DEVICE
+namespace N5200 {
+
+class MEMORY : public DEVICE
 {
 private:
        uint8_t* rbank[8192];   // 16MB / 2KB
@@ -32,11 +34,11 @@ private:
        bool protect;
        
 public:
-       N5200_MEMORY(VM_TEMPLATE* 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"));
        }
-       ~N5200_MEMORY() {}
+       ~MEMORY() {}
        
        // common functions
        void initialize();
@@ -58,5 +60,6 @@ public:
        }
 };
 
+}
 #endif
 
index 20fcba8..feeb53b 100644 (file)
 #include "./memory.h"
 #include "system.h"
 
+using N5200::DISPLAY;
+using N5200::FLOPPY;
+using N5200::KEYBOARD;
+using N5200::MEMORY;
+using N5200::SYSTEM;
+
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
@@ -74,7 +80,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
        display = new DISPLAY(this, emu);
        floppy = new FLOPPY(this, emu);
        keyboard = new KEYBOARD(this, emu);
-       memory = new N5200_MEMORY(this, emu);
+       memory = new MEMORY(this, emu);
        system = new SYSTEM(this, emu);
        
        // set contexts
index 0a9cfb2..738c035 100644 (file)
@@ -65,11 +65,13 @@ class UPD1990A;
 class UPD7220;
 class UPD765A;
 
-class DISPLAY;
-class FLOPPY;
-class KEYBOARD;
-class N5200_MEMORY;
-class SYSTEM;
+namespace N5200 {
+       class DISPLAY;
+       class FLOPPY;
+       class KEYBOARD;
+       class MEMORY;
+       class SYSTEM;
+}
 
 class VM : public VM_TEMPLATE
 {
@@ -94,11 +96,11 @@ protected:
        UPD7220* gdc_g;
        UPD765A* fdc;
        
-       DISPLAY* display;
-       FLOPPY* floppy;
-       KEYBOARD* keyboard;
-       N5200_MEMORY* memory;
-       SYSTEM* system;
+       N5200::DISPLAY* display;
+       N5200::FLOPPY* floppy;
+       N5200::KEYBOARD* keyboard;
+       N5200::MEMORY* memory;
+       N5200::SYSTEM* system;
        
 public:
        // ----------------------------------------
index 6bc875e..5c0a99a 100644 (file)
@@ -12,6 +12,8 @@
 #include "system.h"
 #include "../i8237.h"
 
+namespace N5200 {
+
 void SYSTEM::reset()
 {
        mode = 0;
@@ -62,3 +64,5 @@ uint32_t SYSTEM::read_io8(uint32_t addr)
        return 0xff;
 }
 
+}
+
index 9cb7844..bbfe649 100644 (file)
@@ -14,6 +14,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace N5200 {
+
 class SYSTEM : public DEVICE
 {
 private:
@@ -41,5 +43,6 @@ public:
        }
 };
 
+}
 #endif
 
index e2d3fc2..c3af671 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "display.h"
 
+namespace PASOPIA {
+
 void DISPLAY::initialize()
 {
        // load rom image
@@ -644,3 +646,5 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint16(cblink);
        return true;
 }
+
+}
index 346ea70..80397f4 100644 (file)
@@ -16,6 +16,8 @@
 
 #define SIG_DISPLAY_I8255_1_A  0
 
+namespace PASOPIA {
+
 class DISPLAY : public DEVICE
 {
 private:
@@ -74,5 +76,6 @@ public:
        void draw_screen();
 };
 
+}
 #endif
 
index d6a875b..00bc324 100644 (file)
@@ -10,6 +10,8 @@
 #include "floppy.h"
 #include "../upd765a.h"
 
+namespace PASOPIA {
+
 void FLOPPY::initialize()
 {
        intr = false;
@@ -85,3 +87,5 @@ bool FLOPPY::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(supported);
        return true;
 }
+
+}
index 45a46e5..490c85a 100644 (file)
@@ -16,6 +16,8 @@
 
 #define SIG_FLOPPY_INTR        0
 
+namespace PASOPIA {
+
 class FLOPPY : public DEVICE
 {
 private:
@@ -44,5 +46,6 @@ public:
        bool supported;
 };
 
+}
 #endif
 
index 65ee64b..f530969 100644 (file)
@@ -10,6 +10,8 @@
 
 #include "joypac2.h"
 
+namespace PASOPIA {
+
 void JOYPAC2::initialize(int id)
 {
        joy = emu->get_joy_buffer();
@@ -45,3 +47,4 @@ uint32_t JOYPAC2::read_io8(uint32_t addr)
        return 0xff;
 }
 
+}
index f2052d5..7756c6b 100644 (file)
@@ -15,6 +15,8 @@
 #include "../../emu.h"
 #include "pac2dev.h"
 
+namespace PASOPIA {
+
 class JOYPAC2 : public PAC2DEV
 {
 private:
@@ -32,5 +34,6 @@ public:
        uint32_t read_io8(uint32_t addr);
 };
 
+}
 #endif
 
index 47927ee..b788f57 100644 (file)
@@ -10,6 +10,8 @@
 
 #include "kanjipac2.h"
 
+namespace PASOPIA {
+
 void KANJIPAC2::initialize(int id)
 {
        FILEIO* fio = new FILEIO();
@@ -52,3 +54,5 @@ bool KANJIPAC2::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint32(ptr);
        return true;
 }
+
+}
index 6b9741e..47cb83e 100644 (file)
@@ -15,6 +15,8 @@
 #include "../../emu.h"
 #include "pac2dev.h"
 
+namespace PASOPIA {
+
 class KANJIPAC2 : public PAC2DEV
 {
 private:
@@ -34,5 +36,6 @@ public:
        bool process_state(FILEIO* state_fio, bool loading);
 };
 
+}
 #endif
 
index 0a38215..d8fbe43 100644 (file)
@@ -10,6 +10,8 @@
 #include "keyboard.h"
 #include "../z80pio.h"
 
+namespace PASOPIA {
+
 static const int key_map[12][8] = {
        { 0x12, 0x10, 0x14, 0x00, 0x11, 0x15, 0x00, 0x00 },
        { 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67 },
@@ -85,3 +87,5 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint8(sel);
        return true;
 }
+
+}
index 1076d59..5935754 100644 (file)
@@ -16,6 +16,8 @@
 
 #define SIG_KEYBOARD_Z80PIO_A  0
 
+namespace PASOPIA {
+
 class KEYBOARD : public DEVICE
 {
 private:
@@ -45,5 +47,6 @@ public:
        }
 };
 
+}
 #endif
 
index 7be0c14..eba8d7d 100644 (file)
@@ -10,6 +10,8 @@
 #include "./memory.h"
 #include "../i8255.h"
 
+namespace PASOPIA {
+
 #define SET_BANK(s, e, w, r) { \
        int sb = (s) >> 12, eb = (e) >> 12; \
        for(int i = sb; i <= eb; i++) { \
@@ -26,7 +28,7 @@
        } \
 }
 
-void PASOPIA_MEMORY::initialize()
+void MEMORY::initialize()
 {
        // load ipl
        memset(rdmy, 0xff, sizeof(rdmy));
@@ -39,7 +41,7 @@ void PASOPIA_MEMORY::initialize()
        vram_data = mem_map = 0;
 }
 
-void PASOPIA_MEMORY::load_ipl()
+void MEMORY::load_ipl()
 {
        // load ipl
        memset(rom, 0xff, sizeof(rom));
@@ -76,24 +78,24 @@ void PASOPIA_MEMORY::load_ipl()
        
 }
 
-void PASOPIA_MEMORY::reset()
+void MEMORY::reset()
 {
        memset(vram, 0, sizeof(vram));
 }
 
-void PASOPIA_MEMORY::write_data8(uint32_t addr, uint32_t data)
+void MEMORY::write_data8(uint32_t addr, uint32_t data)
 {
        addr &= 0xffff;
        wbank[addr >> 12][addr & 0xfff] = data;
 }
 
-uint32_t PASOPIA_MEMORY::read_data8(uint32_t addr)
+uint32_t MEMORY::read_data8(uint32_t addr)
 {
        addr &= 0xffff;
        return rbank[addr >> 12][addr & 0xfff];
 }
 
-void PASOPIA_MEMORY::write_io8(uint32_t addr, uint32_t data)
+void MEMORY::write_io8(uint32_t addr, uint32_t data)
 {
        mem_map = data;
        
@@ -109,7 +111,7 @@ void PASOPIA_MEMORY::write_io8(uint32_t addr, uint32_t data)
        d_pio2->write_signal(SIG_I8255_PORT_C, (mem_map & 2) ? 4 : 0, 4);
 }
 
-void PASOPIA_MEMORY::write_signal(int id, uint32_t data, uint32_t mask)
+void MEMORY::write_signal(int id, uint32_t data, uint32_t mask)
 {
        // vram control
        if(id == SIG_MEMORY_I8255_0_A) {
@@ -141,7 +143,7 @@ void PASOPIA_MEMORY::write_signal(int id, uint32_t data, uint32_t mask)
 
 #define STATE_VERSION  1
 
-bool PASOPIA_MEMORY::process_state(FILEIO* state_fio, bool loading)
+bool MEMORY::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
@@ -166,3 +168,5 @@ bool PASOPIA_MEMORY::process_state(FILEIO* state_fio, bool loading)
        }
        return true;
 }
+
+}
index 610119d..f27f8b3 100644 (file)
@@ -18,7 +18,9 @@
 #define SIG_MEMORY_I8255_0_B   1
 #define SIG_MEMORY_I8255_1_C   2
 
-class PASOPIA_MEMORY : public DEVICE
+namespace PASOPIA {
+
+class MEMORY : public DEVICE
 {
 private:
        DEVICE *d_pio0, *d_pio1, *d_pio2;
@@ -35,11 +37,11 @@ private:
        uint8_t vram_data, mem_map;
        
 public:
-       PASOPIA_MEMORY(VM_TEMPLATE* 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"));
        }
-       ~PASOPIA_MEMORY() {}
+       ~MEMORY() {}
        
        // common functions
        void initialize();
@@ -74,4 +76,5 @@ public:
        void load_ipl();
 };
 
+}
 #endif
index 10de0a4..41d9454 100644 (file)
 #include "kanjipac2.h"
 #include "joypac2.h"
 
+using PASOPIA::RAMPAC2;
+using PASOPIA::KANJIPAC2;
+using PASOPIA::JOYPAC2;
+using PASOPIA::PAC2DEV;
+
+namespace PASOPIA {
+
 void PAC2::initialize()
 {
        rampac2 = new RAMPAC2(static_cast<VM *>(vm), emu);
@@ -88,3 +95,5 @@ bool PAC2::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateInt32(device_type);
        return get_device()->process_state(state_fio, loading);
 }
+
+}
index c7e052d..80234d8 100644 (file)
 #include "../../emu.h"
 #include "../device.h"
 
-class PAC2DEV;
-class RAMPAC2;
-class KANJIPAC2;
-class JOYPAC2;
+namespace PASOPIA {
+       class PAC2DEV;
+       class RAMPAC2;
+       class KANJIPAC2;
+       class JOYPAC2;
+}
+       
+namespace PASOPIA {
 
 class PAC2 : public DEVICE
 {
 private:
        int device_type;
        
-       RAMPAC2* rampac2;
-       KANJIPAC2* kanji;
-       JOYPAC2* joy;
-       PAC2DEV* dummy;
+       PASOPIA::RAMPAC2* rampac2;
+       PASOPIA::KANJIPAC2* kanji;
+       PASOPIA::JOYPAC2* joy;
+       PASOPIA::PAC2DEV* dummy;
        
-       PAC2DEV* get_device();
+       PASOPIA::PAC2DEV* get_device();
        
 public:
        PAC2(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
@@ -50,5 +54,6 @@ public:
        void open_rampac2(const _TCHAR* file_path);
 };
 
+}
 #endif
 
index a08f00a..df1caf5 100644 (file)
 #include "../vm.h"
 #include "../../emu.h"
 
-class csp_state_utils;
+namespace PASOPIA {
+
 class PAC2DEV
 {
 protected:
        VM* vm;
        EMU* emu;
-       csp_state_utils *state_entry;
        
 public:
        PAC2DEV(VM* parent_vm, EMU* parent_emu) : vm(parent_vm), emu(parent_emu)
@@ -59,5 +59,6 @@ public:
        _TCHAR this_device_name[128];
 };
 
+}
 #endif
 
index b3edcfb..c2d93ce 100644 (file)
 #include "./memory.h"
 #include "pac2.h"
 
+using PASOPIA::DISPLAY;
+using PASOPIA::FLOPPY;
+using PASOPIA::KEYBOARD;
+using PASOPIA::MEMORY;
+using PASOPIA::PAC2;
+
+
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
@@ -76,7 +83,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
        floppy = new FLOPPY(this, emu);
        display = new DISPLAY(this, emu);
        key = new KEYBOARD(this, emu);
-       memory = new PASOPIA_MEMORY(this, emu);
+       memory = new MEMORY(this, emu);
        pac2 = new PAC2(this, emu);
        // set contexts
        event->set_context_cpu(cpu);
index f31d6fa..4c6bda1 100644 (file)
@@ -83,7 +83,6 @@ static const _TCHAR *sound_device_caption[] = {
 };
 #endif
 
-class csp_state_utils;
 class EMU;
 class DEVICE;
 class EVENT;
@@ -100,11 +99,13 @@ class Z80;
 class Z80CTC;
 class Z80PIO;
 
-class FLOPPY;
-class DISPLAY;
-class KEYBOARD;
-class PASOPIA_MEMORY;
-class PAC2;
+namespace PASOPIA {
+       class FLOPPY;
+       class DISPLAY;
+       class KEYBOARD;
+       class MEMORY;
+       class PAC2;
+}
 
 class VM : public VM_TEMPLATE
 {
@@ -129,11 +130,11 @@ protected:
        Z80CTC* ctc;
        Z80PIO* pio;
        
-       FLOPPY* floppy;
-       DISPLAY* display;
-       KEYBOARD* key;
-       PASOPIA_MEMORY* memory;
-       PAC2* pac2;
+       PASOPIA::FLOPPY* floppy;
+       PASOPIA::DISPLAY* display;
+       PASOPIA::KEYBOARD* key;
+       PASOPIA::MEMORY* memory;
+       PASOPIA::PAC2* pac2;
        
        int boot_mode;
        
index f091390..9b0d656 100644 (file)
@@ -10,6 +10,8 @@
 
 #include "rampac2.h"
 
+namespace PASOPIA {
+
 static const uint8_t header[16] = {
        0xaa, 0x1f, 0x04, 0x00, 0x04, 0x80, 0x00, 0x01, 0x04, 0x04, 0x01, 0x03, 0x08, 0x00, 0x00, 0x00
 };
@@ -107,3 +109,5 @@ bool RAMPAC2::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(modified);
        return true;
 }
+
+}
index d26ed7e..b9f0d8f 100644 (file)
@@ -15,6 +15,8 @@
 #include "../../emu.h"
 #include "pac2dev.h"
 
+namespace PASOPIA {
+
 class RAMPAC2 : public PAC2DEV
 {
 private:
@@ -40,5 +42,6 @@ public:
        bool process_state(FILEIO* state_fio, bool loading);
 };
 
+}
 #endif
 
index 5889a5d..f0244b5 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "display.h"
 
+namespace PASOPIA7 {
+
 void DISPLAY::initialize()
 {
        // load rom image
@@ -774,3 +776,5 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(pal_dis);
        return true;
 }
+
+}
index a666269..b07b062 100644 (file)
@@ -18,6 +18,8 @@
 #define SIG_DISPLAY_I8255_1_B  1
 #define SIG_DISPLAY_I8255_1_C  2
 
+namespace PASOPIA7 {
+
 class DISPLAY : public DEVICE
 {
 private:
@@ -74,5 +76,6 @@ public:
        void draw_screen();
 };
 
+}
 #endif
 
index 28fdf6f..97bb945 100644 (file)
@@ -10,6 +10,8 @@
 #include "floppy.h"
 #include "../upd765a.h"
 
+namespace PASOPIA7 {
+
 void FLOPPY::initialize()
 {
        intr = false;
@@ -67,3 +69,5 @@ bool FLOPPY::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(intr);
        return true;
 }
+
+}
index 7e2ffbd..db60495 100644 (file)
@@ -16,6 +16,8 @@
 
 #define SIG_FLOPPY_INTR        0
 
+namespace PASOPIA7 {
+
 class FLOPPY : public DEVICE
 {
 private:
@@ -43,5 +45,6 @@ public:
        }
 };
 
+}
 #endif
 
index 7a6e203..18c9086 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "iobus.h"
 
+namespace PASOPIA7 {
+
 void IOBUS::reset()
 {
        mio = false;
@@ -54,3 +56,5 @@ bool IOBUS::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(mio);
        return true;
 }
+
+}
index ac8fd97..7bb602f 100644 (file)
@@ -16,6 +16,8 @@
 
 #define SIG_IOBUS_MIO  0
 
+namespace PASOPIA7 {
+
 class IOBUS : public DEVICE
 {
 private:
@@ -48,5 +50,7 @@ public:
        }
 };
 
+}
+
 #endif
 
index 38c870f..33f0ef6 100644 (file)
@@ -10,6 +10,8 @@
 #include "iotrap.h"
 #include "../i8255.h"
 
+namespace PASOPIA7 {
+
 void IOTRAP::initialize()
 {
        nmi_mask = pasopia = false;
@@ -91,3 +93,5 @@ bool IOTRAP::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(pasopia);
        return true;
 }
+
+}
index d927494..d59f069 100644 (file)
@@ -17,6 +17,8 @@
 #define SIG_IOTRAP_I8255_2_A   0
 #define SIG_IOTRAP_I8255_2_C   1
 
+namespace PASOPIA7 {
+
 class IOTRAP : public DEVICE
 {
 private:
@@ -49,5 +51,6 @@ public:
        void do_reset();
 };
 
+}
 #endif
 
index 65ee64b..db21b2b 100644 (file)
@@ -10,6 +10,8 @@
 
 #include "joypac2.h"
 
+namespace PASOPIA7 {
+
 void JOYPAC2::initialize(int id)
 {
        joy = emu->get_joy_buffer();
@@ -45,3 +47,4 @@ uint32_t JOYPAC2::read_io8(uint32_t addr)
        return 0xff;
 }
 
+}
index f2052d5..75b01fa 100644 (file)
@@ -15,6 +15,8 @@
 #include "../../emu.h"
 #include "pac2dev.h"
 
+namespace PASOPIA7 {
+
 class JOYPAC2 : public PAC2DEV
 {
 private:
@@ -32,5 +34,6 @@ public:
        uint32_t read_io8(uint32_t addr);
 };
 
+}
 #endif
 
index 3d6ea5d..a8e1dac 100644 (file)
@@ -10,6 +10,8 @@
 
 #include "kanjipac2.h"
 
+namespace PASOPIA7 {
+
 void KANJIPAC2::initialize(int id)
 {
        FILEIO* fio = new FILEIO();
@@ -55,3 +57,5 @@ bool KANJIPAC2::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint32(ptr);
        return true;
 }
+
+}
index 95a9d6c..b6c5c4d 100644 (file)
@@ -15,6 +15,8 @@
 #include "../../emu.h"
 #include "pac2dev.h"
 
+namespace PASOPIA7 {
+
 class KANJIPAC2 : public PAC2DEV
 {
 private:
@@ -35,5 +37,6 @@ public:
        bool process_state(FILEIO* state_fio, bool loading);
 };
 
+}
 #endif
 
index 9e37232..a647ff7 100644 (file)
@@ -10,6 +10,8 @@
 #include "keyboard.h"
 #include "../z80pio.h"
 
+namespace PASOPIA7 {
+
 static const int key_map[12][8] = {
        { 0x12, 0x10, 0x14, 0x00, 0x11, 0x15, 0x00, 0x00 },
        { 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67 },
@@ -90,3 +92,5 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint8(sel);
        return true;
 }
+
+}
index 9c5ab30..488cffd 100644 (file)
@@ -16,6 +16,8 @@
 
 #define SIG_KEYBOARD_Z80PIO_A  0
 
+namespace PASOPIA7 {
+
 class KEYBOARD : public DEVICE
 {
 private:
@@ -45,5 +47,6 @@ public:
        }
 };
 
+}
 #endif
 
index 312dc75..f54e8f1 100644 (file)
@@ -11,6 +11,8 @@
 #include "iobus.h"
 #include "../i8255.h"
 
+namespace PASOPIA7 {
+
 #define SET_BANK(s, e, w, r) { \
        int sb = (s) >> 12, eb = (e) >> 12; \
        for(int i = sb; i <= eb; i++) { \
@@ -27,7 +29,7 @@
        } \
 }
 
-void PASOPIA7_MEMORY::initialize()
+void MEMORY::initialize()
 {
        memset(bios, 0xff, sizeof(bios));
        memset(basic, 0xff, sizeof(basic));
@@ -52,12 +54,12 @@ void PASOPIA7_MEMORY::initialize()
        vram_sel = pal_sel = attr_wrap = false;
 }
 
-void PASOPIA7_MEMORY::reset()
+void MEMORY::reset()
 {
        memset(vram, 0, sizeof(vram));
 }
 
-void PASOPIA7_MEMORY::write_data8(uint32_t addr, uint32_t data)
+void MEMORY::write_data8(uint32_t addr, uint32_t data)
 {
        addr &= 0xffff;
        if(vram_sel && (addr & 0xc000) == 0x8000) {
@@ -84,7 +86,7 @@ void PASOPIA7_MEMORY::write_data8(uint32_t addr, uint32_t data)
        wbank[addr >> 12][addr & 0xfff] = data;
 }
 
-uint32_t PASOPIA7_MEMORY::read_data8(uint32_t addr)
+uint32_t MEMORY::read_data8(uint32_t addr)
 {
        addr &= 0xffff;
        if(vram_sel && (addr & 0xc000) == 0x8000) {
@@ -109,7 +111,7 @@ uint32_t PASOPIA7_MEMORY::read_data8(uint32_t addr)
        return rbank[addr >> 12][addr & 0xfff];
 }
 
-void PASOPIA7_MEMORY::write_io8(uint32_t addr, uint32_t data)
+void MEMORY::write_io8(uint32_t addr, uint32_t data)
 {
        if(mem_map != (data & 7)) {
                mem_map = data & 7;
@@ -124,7 +126,7 @@ void PASOPIA7_MEMORY::write_io8(uint32_t addr, uint32_t data)
        d_pio2->write_signal(SIG_I8255_PORT_C, data, 3);
 }
 
-void PASOPIA7_MEMORY::write_signal(int id, uint32_t data, uint32_t mask)
+void MEMORY::write_signal(int id, uint32_t data, uint32_t mask)
 {
        if(id == SIG_MEMORY_I8255_1_A) {
                plane = data;
@@ -136,7 +138,7 @@ void PASOPIA7_MEMORY::write_signal(int id, uint32_t data, uint32_t mask)
        }
 }
 
-void PASOPIA7_MEMORY::update_memory_map()
+void MEMORY::update_memory_map()
 {
        if(mem_map == 0xff) {
                SET_BANK(0x0000, 0x3fff, wdmy, bios);
@@ -167,7 +169,7 @@ void PASOPIA7_MEMORY::update_memory_map()
 
 #define STATE_VERSION  1
 
-bool PASOPIA7_MEMORY::process_state(FILEIO* state_fio, bool loading)
+bool MEMORY::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
@@ -192,3 +194,5 @@ bool PASOPIA7_MEMORY::process_state(FILEIO* state_fio, bool loading)
        }
        return true;
 }
+
+}
index 04d3bf8..aa582fe 100644 (file)
@@ -18,7 +18,9 @@
 #define SIG_MEMORY_I8255_1_B   1
 #define SIG_MEMORY_I8255_1_C   2
 
-class PASOPIA7_MEMORY : public DEVICE
+namespace PASOPIA7 {
+
+class MEMORY : public DEVICE
 {
 private:
        DEVICE *d_iobus, *d_pio0, *d_pio2;
@@ -39,11 +41,11 @@ private:
        void update_memory_map();
        
 public:
-       PASOPIA7_MEMORY(VM_TEMPLATE* 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"));
        }
-       ~PASOPIA7_MEMORY() {}
+       ~MEMORY() {}
        
        // common functions
        void initialize();
@@ -81,5 +83,6 @@ public:
        }
 };
 
+}
 #endif
 
index 0400d95..5ea1c73 100644 (file)
 #include "kanjipac2.h"
 #include "joypac2.h"
 
+using PASOPIA7::PAC2DEV;
+using PASOPIA7::RAMPAC2;
+using PASOPIA7::KANJIPAC2;
+using PASOPIA7::JOYPAC2;
+
+namespace PASOPIA7 {
+
 void PAC2::initialize()
 {
        // slot 4 : ram pack #5
@@ -110,3 +117,5 @@ bool PAC2::process_state(FILEIO* state_fio, bool loading)
        }
        return true;
 }
+
+}
index d300ea2..0411bab 100644 (file)
 #include "../../emu.h"
 #include "../device.h"
 
-class PAC2DEV;
-class RAMPAC2;
-class KANJIPAC2;
-class JOYPAC2;
+namespace PASOPIA7 {
+       class PAC2DEV;
+       class RAMPAC2;
+       class KANJIPAC2;
+       class JOYPAC2;
+}
+
+namespace PASOPIA7 {
 
 class PAC2 : public DEVICE
 {
@@ -25,10 +29,10 @@ private:
        PAC2DEV* dev[8];
        int sel;
        
-       RAMPAC2* rampac2[2];
-       KANJIPAC2* kanji;
-       JOYPAC2* joy;
-       PAC2DEV* dummy;
+       PASOPIA7::RAMPAC2* rampac2[2];
+       PASOPIA7::KANJIPAC2* kanji;
+       PASOPIA7::JOYPAC2* joy;
+       PASOPIA7::PAC2DEV* dummy;
        
 public:
        PAC2(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
@@ -49,5 +53,6 @@ public:
        void open_rampac2(int drv, const _TCHAR* file_path);
 };
 
+}
 #endif
 
index a0fb49e..f26f09c 100644 (file)
 #include "../vm.h"
 #include "../../emu.h"
 
-class csp_state_utils;
+namespace PASOPIA7 {
+
 class PAC2DEV
 {
 protected:
        VM* vm;
        EMU* emu;
-       csp_state_utils *state_entry;
 public:
        PAC2DEV(VM* parent_vm, EMU* parent_emu) : vm(parent_vm), emu(parent_emu)
        {
@@ -58,5 +58,6 @@ public:
        _TCHAR this_device_name[128];
 };
 
+}
 #endif
 
index a2c988d..e5cdb5c 100644 (file)
 #include "./memory.h"
 #include "pac2.h"
 
+using PASOPIA7::DISPLAY;
+using PASOPIA7::FLOPPY;
+using PASOPIA7::IOBUS;
+using PASOPIA7::IOTRAP;
+using PASOPIA7::KEYBOARD;
+using PASOPIA7::MEMORY;
+using PASOPIA7::PAC2;
+
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
@@ -82,7 +90,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
        iobus = new IOBUS(this, emu);
        iotrap = new IOTRAP(this, emu);
        key = new KEYBOARD(this, emu);
-       memory = new PASOPIA7_MEMORY(this, emu);
+       memory = new MEMORY(this, emu);
        pac2 = new PAC2(this, emu);
        
        // set contexts
index ac28962..6f3e25a 100644 (file)
@@ -89,13 +89,15 @@ class Z80;
 class Z80CTC;
 class Z80PIO;
 
-class FLOPPY;
-class DISPLAY;
-class IOBUS;
-class IOTRAP;
-class KEYBOARD;
-class PASOPIA7_MEMORY;
-class PAC2;
+namespace PASOPIA7 {
+       class FLOPPY;
+       class DISPLAY;
+       class IOBUS;
+       class IOTRAP;
+       class KEYBOARD;
+       class MEMORY;
+       class PAC2;
+}
 
 class VM : public VM_TEMPLATE
 {
@@ -122,13 +124,13 @@ protected:
        Z80CTC* ctc;
        Z80PIO* pio;
        
-       FLOPPY* floppy;
-       DISPLAY* display;
-       IOBUS* iobus;
-       IOTRAP* iotrap;
-       KEYBOARD* key;
-       PASOPIA7_MEMORY* memory;
-       PAC2* pac2;
+       PASOPIA7::FLOPPY* floppy;
+       PASOPIA7::DISPLAY* display;
+       PASOPIA7::IOBUS* iobus;
+       PASOPIA7::IOTRAP* iotrap;
+       PASOPIA7::KEYBOARD* key;
+       PASOPIA7::MEMORY* memory;
+       PASOPIA7::PAC2* pac2;
        
 public:
        // ----------------------------------------
index f091390..c2109d3 100644 (file)
@@ -10,6 +10,8 @@
 
 #include "rampac2.h"
 
+namespace PASOPIA7 {
+
 static const uint8_t header[16] = {
        0xaa, 0x1f, 0x04, 0x00, 0x04, 0x80, 0x00, 0x01, 0x04, 0x04, 0x01, 0x03, 0x08, 0x00, 0x00, 0x00
 };
@@ -107,3 +109,5 @@ bool RAMPAC2::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(modified);
        return true;
 }
+
+}
index d7a30ba..0923ce0 100644 (file)
@@ -15,6 +15,8 @@
 #include "../../emu.h"
 #include "pac2dev.h"
 
+namespace PASOPIA7 {
+
 class RAMPAC2 : public PAC2DEV
 {
 private:
@@ -42,5 +44,6 @@ public:
        bool process_state(FILEIO* state_fio, bool loading);
 };
 
+}
 #endif
 
index ecf3eb0..ff121fd 100644 (file)
@@ -10,6 +10,8 @@
 #include "crtc.h"
 #include "../i8259.h"
 
+namespace PC100 {
+
 void CRTC::initialize()
 {
        // init vram
@@ -354,3 +356,5 @@ bool CRTC::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint32(read_plane);
        return true;
 }
+
+}
index 5e49d76..e26bf60 100644 (file)
@@ -18,6 +18,8 @@
 #define SIG_CRTC_BITMASK_HIGH  1
 #define SIG_CRTC_VRAM_PLANE    2
 
+namespace PC100 {
+
 class CRTC : public DEVICE
 {
 private:
@@ -61,5 +63,6 @@ public:
        void draw_screen();
 };
 
+}
 #endif
 
index df8204f..7e2bac6 100644 (file)
@@ -14,6 +14,8 @@
 #include "../upd765a.h"
 #include "../../fifo.h"
 
+namespace PC100 {
+
 static const int key_table[256] = {
          -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,0x18,0x12,  -1,  -1,  -1,0x38,  -1,  -1,
          -1,0x04,0x05,0x09,  -1,  -1,  -1,  -1,  -1,0x10,  -1,0x11,  -1,  -1,  -1,  -1,
@@ -241,3 +243,5 @@ bool IOCTRL::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint8(ts);
        return true;
 }
+
+}
index 9dfa96f..eb09f68 100644 (file)
@@ -18,6 +18,8 @@
 
 class FIFO;
 
+namespace PC100 {
+
 class IOCTRL : public DEVICE
 {
 private:
@@ -81,5 +83,6 @@ public:
        }
 };
 
+}
 #endif
 
index 2139a11..ef3cf25 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "kanji.h"
 
+namespace PC100 {
+
 void KANJI::initialize()
 {
        // init image
@@ -69,3 +71,5 @@ bool KANJI::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(strobe);
        return true;
 }
+
+}
index 57eddea..94aaa61 100644 (file)
@@ -14,6 +14,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace PC100 {
+
 class KANJI : public DEVICE
 {
 private:
@@ -35,5 +37,6 @@ public:
        bool process_state(FILEIO* state_fio, bool loading);
 };
 
+}
 #endif
 
index 8b63c15..d659154 100644 (file)
 #include "ioctrl.h"
 #include "kanji.h"
 
+using PC100::CRTC;
+using PC100::IOCTRL;
+using PC100::KANJI;
+
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
index 08dba06..4fc85e9 100644 (file)
@@ -76,9 +76,11 @@ class MSM58321;
 class PCM1BIT;
 class UPD765A;
 
-class CRTC;
-class IOCTRL;
-class KANJI;
+namespace PC100 {
+       class CRTC;
+       class IOCTRL;
+       class KANJI;
+}
 
 class VM : public VM_TEMPLATE
 {
@@ -102,9 +104,9 @@ protected:
        PCM1BIT* pcm;
        UPD765A* fdc;
        
-       CRTC* crtc;
-       IOCTRL* ioctrl;
-       KANJI* kanji;
+       PC100::CRTC* crtc;
+       PC100::IOCTRL* ioctrl;
+       PC100::KANJI* kanji;
        
        // memory
        uint8_t ram[0xc0000];   // Main RAM 768KB
index 0cd9088..383b4a8 100644 (file)
 
 #define EVENT_TIMER    0
 
-void PC2001_IO::initialize()
+namespace PC2001 {
+
+void IO::initialize()
 {
        register_event(this, EVENT_TIMER, 20000, true, NULL);
        key_stat = emu->get_key_buffer();
 }
 
-void PC2001_IO::reset()
+void IO::reset()
 {
        port_a = port_b = port_s = 0xff;
        drec_in = rtc_in = false;
        key_strobe = 0xffff;
 }
 
-void PC2001_IO::write_io8(uint32_t addr, uint32_t data)
+void IO::write_io8(uint32_t addr, uint32_t data)
 {
        switch(addr) {
        case UPD7807_PORTA:
@@ -81,7 +83,7 @@ void PC2001_IO::write_io8(uint32_t addr, uint32_t data)
        }
 }
 
-uint32_t PC2001_IO::read_io8(uint32_t addr)
+uint32_t IO::read_io8(uint32_t addr)
 {
        uint32_t value = 0xff;
        
@@ -110,7 +112,7 @@ uint32_t PC2001_IO::read_io8(uint32_t addr)
        return value;
 }
 
-void PC2001_IO::write_io16(uint32_t addr, uint32_t data)
+void IO::write_io16(uint32_t addr, uint32_t data)
 {
        switch(addr) {
        case UPD7807_PORTE:
@@ -122,7 +124,7 @@ void PC2001_IO::write_io16(uint32_t addr, uint32_t data)
        }
 }
 
-void PC2001_IO::write_signal(int id, uint32_t data, uint32_t mask)
+void IO::write_signal(int id, uint32_t data, uint32_t mask)
 {
        switch(id) {
        case SIG_IO_DREC_IN:
@@ -135,14 +137,14 @@ void PC2001_IO::write_signal(int id, uint32_t data, uint32_t mask)
        }
 }
 
-void PC2001_IO::event_callback(int event_id, int err)
+void IO::event_callback(int event_id, int err)
 {
        if(event_id == EVENT_TIMER) {
                d_cpu->write_signal(SIG_UPD7810_INTF1, 1, 1);
        }
 }
 
-uint8_t PC2001_IO::get_key()
+uint8_t IO::get_key()
 {
        uint8_t data = 0x3f;
        
@@ -267,7 +269,7 @@ uint8_t PC2001_IO::get_key()
        return data;
 }
 
-bool PC2001_IO::key_hit(int code)
+bool IO::key_hit(int code)
 {
        bool value = (key_stat[code] != 0);
        return value;
@@ -275,7 +277,7 @@ bool PC2001_IO::key_hit(int code)
 
 #define STATE_VERSION  2
 
-bool PC2001_IO::process_state(FILEIO* state_fio, bool loading)
+bool IO::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
@@ -291,3 +293,5 @@ bool PC2001_IO::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint16(key_strobe);
        return true;
 }
+
+}
index 11b4ff7..674c19a 100644 (file)
@@ -20,7 +20,9 @@
 
 class UPD16434;
 
-class PC2001_IO : public DEVICE
+namespace PC2001 {
+
+class IO : public DEVICE
 {
 private:
        UPD16434 *d_lcd[4];
@@ -38,11 +40,11 @@ private:
        bool key_hit(int code);
        
 public:
-       PC2001_IO(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       IO(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("I/O Bus"));
        }
-       ~PC2001_IO() {}
+       ~IO() {}
        
        // common functions
        void initialize();
@@ -73,4 +75,5 @@ public:
        }
 };
 
+}
 #endif
index a2c5b55..b6a1753 100644 (file)
@@ -27,6 +27,8 @@
 
 #include "./io.h"
 
+using PC2001::IO;
+
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
@@ -55,7 +57,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
        rtc = new UPD1990A(this, emu);
        cpu = new UPD7810(this, emu);
        
-       io = new PC2001_IO(this, emu);
+       io = new PC2001::IO(this, emu);
        
        // set contexts
        event->set_context_cpu(cpu);
index 1dee026..2b148f0 100644 (file)
@@ -61,7 +61,9 @@ class UPD16434;
 class UPD1990A;
 class UPD7810;
 
-class PC2001_IO;
+namespace PC2001 {
+       class IO;
+}
 class VM : public VM_TEMPLATE
 {
 protected:
@@ -78,7 +80,7 @@ protected:
        UPD1990A* rtc;
        UPD7810* cpu;
        
-       PC2001_IO* io;
+       PC2001::IO* io;
        
        // memory
        uint8_t ram[0x5000];
index 4b71ce7..1dfac92 100644 (file)
@@ -11,6 +11,8 @@
 #include "timer.h"
 #include "../mc6847.h"
 
+namespace PC6001 {
+
 void DISPLAY::reset()
 {
        vram_ptr = ram_ptr + 0xe000;
@@ -61,3 +63,5 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading)
        }
        return true;
 }
+
+}
index 0110dac..c29bd7a 100644 (file)
 #include "../device.h"
 
 class MC6847;
-class TIMER;
+
+namespace PC6001 {
+       class TIMER;
+}
+namespace PC6001 {
 
 class DISPLAY : public DEVICE
 {
 private:
        MC6847 *d_vdp;
-       TIMER *d_timer;
+       PC6001::TIMER *d_timer;
        
        uint8_t *ram_ptr;
        uint8_t *vram_ptr;
@@ -48,10 +52,12 @@ public:
        {
                ram_ptr = vram_ptr = ptr;
        }
-       void set_context_timer(TIMER* device)
+       void set_context_timer(PC6001::TIMER* device)
        {
                d_timer = device;
        }
        void draw_screen();
 };
+
+}
 #endif
index 033687d..d373294 100644 (file)
@@ -19,6 +19,8 @@
 #include "../disk.h"
 #include "../noise.h"
 
+namespace PC6001 {
+
 int FLOPPY::Seek88(int drvno, int trackno, int sectno)
 {
        if(drvno < 2) {
@@ -652,3 +654,5 @@ bool FLOPPY::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint8(Status);
        return true;
 }
+
+}
index e2c3d8c..9f7467a 100644 (file)
@@ -25,6 +25,8 @@
 class DISK;
 class NOISE;
 
+namespace PC6001 {
+
 class FLOPPY : public DEVICE
 {
 private:
@@ -160,5 +162,6 @@ public:
        bool is_disk_protected(int drv);
 };
 
+}
 #endif
 
index 1102185..a8a7622 100644 (file)
@@ -18,6 +18,8 @@
 #include "../ay_3_891x.h"
 #endif
 
+namespace PC6001 {
+
 void JOYSTICK::initialize()
 {
        joy_stat = emu->get_joy_buffer();
@@ -36,3 +38,5 @@ void JOYSTICK::event_frame()
        d_psg->write_signal(SIG_AY_3_891X_PORT_B, ~(joy_stat[1] & 0x1f), 0xff);
 #endif
 }
+
+}
index 35a83c9..d7704d4 100644 (file)
@@ -18,6 +18,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace PC6001 {
+
 class JOYSTICK : public DEVICE
 {
 private:
@@ -41,4 +43,6 @@ public:
                d_psg = device;
        }
 };
+
+}
 #endif
index d696868..2362b18 100644 (file)
@@ -39,7 +39,9 @@
 #define SYSTEMROM2     (MEMORY_BASE + SYSTEMROM2_BASE)
 #define CGROM6         (MEMORY_BASE + CGROM6_BASE)
 
-void PC6001_MEMORY::initialize()
+namespace PC6001 {
+
+void MEMORY::initialize()
 {
        FILEIO* fio = new FILEIO();
 #if defined(_PC6001)
@@ -167,7 +169,7 @@ void PC6001_MEMORY::initialize()
 #endif
 }
 
-void PC6001_MEMORY::reset()
+void MEMORY::reset()
 {
 #ifdef _PC6001
        int J;
@@ -256,7 +258,7 @@ void PC6001_MEMORY::reset()
 #endif
 }
 
-void PC6001_MEMORY::write_data8(uint32_t addr, uint32_t data)
+void MEMORY::write_data8(uint32_t addr, uint32_t data)
 {
 #if defined(_PC6601SR) || defined(_PC6001MK2SR)
        /* Graphics Vram Write (SR basic) */
@@ -269,7 +271,7 @@ void PC6001_MEMORY::write_data8(uint32_t addr, uint32_t data)
                WrMem[addr >> 13][addr & 0x1FFF] = data;
 }
 
-uint32_t PC6001_MEMORY::read_data8(uint32_t addr)
+uint32_t MEMORY::read_data8(uint32_t addr)
 {
 #if defined(_PC6601SR) || defined(_PC6001MK2SR)
        /* Graphics Vram Read (SR basic) */
@@ -279,7 +281,7 @@ uint32_t PC6001_MEMORY::read_data8(uint32_t addr)
        return(RdMem[addr >> 13][addr & 0x1FFF]);
 }
 
-void PC6001_MEMORY::write_io8(uint32_t addr, uint32_t data)
+void MEMORY::write_io8(uint32_t addr, uint32_t data)
 {
        unsigned int VRAMHead[2][4] = {
                { 0xc000, 0xe000, 0x8000, 0xa000 },
@@ -581,7 +583,7 @@ void PC6001_MEMORY::write_io8(uint32_t addr, uint32_t data)
 }
 
 #ifndef _PC6001
-uint32_t PC6001_MEMORY::read_io8(uint32_t addr)
+uint32_t MEMORY::read_io8(uint32_t addr)
 {
        uint16_t port=(addr & 0x00ff);
        uint8_t Value=0xff;
@@ -604,7 +606,7 @@ uint32_t PC6001_MEMORY::read_io8(uint32_t addr)
 
 #define EVENT_HBLANK   1
 
-void PC6001_MEMORY::event_vline(int v, int clock)
+void MEMORY::event_vline(int v, int clock)
 {
 #if defined(_PC6601SR) || defined(_PC6001MK2SR)
        if(static_cast<VM *>(vm)->sr_mode) {
@@ -626,7 +628,7 @@ void PC6001_MEMORY::event_vline(int v, int clock)
        }
 }
 
-void PC6001_MEMORY::event_callback(int event_id, int err)
+void MEMORY::event_callback(int event_id, int err)
 {
        if(event_id == EVENT_HBLANK) {
                d_cpu->write_signal(SIG_CPU_BUSREQ, 0, 0);
@@ -634,7 +636,7 @@ void PC6001_MEMORY::event_callback(int event_id, int err)
 }
 #endif
 
-void PC6001_MEMORY::write_signal(int id, uint32_t data, uint32_t mask)
+void MEMORY::write_signal(int id, uint32_t data, uint32_t mask)
 {
        if(id == SIG_MEMORY_PIO_PORT_C) {
 #ifdef _PC6001
@@ -654,7 +656,7 @@ void PC6001_MEMORY::write_signal(int id, uint32_t data, uint32_t mask)
        }
 }
 
-void PC6001_MEMORY::open_cart(const _TCHAR* file_path)
+void MEMORY::open_cart(const _TCHAR* file_path)
 {
        FILEIO* fio = new FILEIO();
        if(fio->Fopen(file_path, FILEIO_READ_BINARY)) {
@@ -674,7 +676,7 @@ void PC6001_MEMORY::open_cart(const _TCHAR* file_path)
        delete fio;
 }
 
-void PC6001_MEMORY::close_cart()
+void MEMORY::close_cart()
 {
 ///    EXTROM1 = EXTROM2 = EmptyRAM;
        EXTROM1 = RAM + 0x4000;
@@ -685,7 +687,7 @@ void PC6001_MEMORY::close_cart()
 
 #define STATE_VERSION  1
 
-bool PC6001_MEMORY::process_state(FILEIO* state_fio, bool loading)
+bool MEMORY::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
@@ -757,3 +759,5 @@ bool PC6001_MEMORY::process_state(FILEIO* state_fio, bool loading)
 #endif
        return true;
 }
+
+}
index 5b69827..ab95f02 100644 (file)
@@ -27,7 +27,9 @@
 #define SIG_MEMORY_PIO_PORT_C  0
 
 #ifndef _PC6001
-class TIMER;
+namespace PC6001 {
+       class TIMER;
+}
 #endif
 
 // memory offset
@@ -65,12 +67,14 @@ class TIMER;
 #define MEMORY_SIZE            (CGROM6_BASE + CGROM6_SIZE)
 #endif
 
-class PC6001_MEMORY : public DEVICE
+namespace PC6001 {
+
+class MEMORY : public DEVICE
 {
 private:
        DEVICE *d_cpu;
 #ifndef _PC6001
-       TIMER *d_timer;
+       PC6001::TIMER *d_timer;
 #endif
        uint8_t MEMORY_BASE[MEMORY_SIZE];
 //     uint8_t RAM[0x10000];
@@ -165,12 +169,12 @@ private:
 #endif
 
 public:
-       PC6001_MEMORY(VM_TEMPLATE* 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"));
        }
-       ~PC6001_MEMORY() {}
+       ~MEMORY() {}
        
        // common functions
        void initialize();
@@ -195,7 +199,7 @@ public:
                d_cpu = device;
        }
 #ifndef _PC6001
-       void set_context_timer(TIMER* device)
+       void set_context_timer(PC6001::TIMER* device)
        {
                d_timer = device;
        }
@@ -217,4 +221,6 @@ public:
        }
 #endif
 };
+
+}
 #endif
index db21fe5..455325e 100644 (file)
@@ -35,7 +35,9 @@
 #define SeqPix21(c) dest[X*8+W]=c;W++;
 #define SeqPix41(c) dest[X*8+W]=c;W++;dest[X*8+W]=c;W++;
 
-void PC6001_MEMORY::draw_screen()
+namespace PC6001 {
+
+void MEMORY::draw_screen()
 {
        if (CRTKILL) {
                for(int y = 0; y < 400; y++) {
@@ -137,7 +139,7 @@ void PC6001_MEMORY::draw_screen()
 }
 
 // RefreshScr10: N60-BASIC select function
-void PC6001_MEMORY::RefreshScr10()
+void MEMORY::RefreshScr10()
 {
        if ((*VRAM&0x80) == 0x00)
                RefreshScr11();
@@ -159,7 +161,7 @@ void PC6001_MEMORY::RefreshScr10()
 }
 
 // RefreshScr11: N60-BASIC screen 1,2
-void PC6001_MEMORY::RefreshScr11()
+void MEMORY::RefreshScr11()
 {
        uint8_t X,Y,K;
        int FC,BC;
@@ -197,7 +199,7 @@ W=0;
 }
 
 // RefreshScr13: N60-BASIC screen 3,4
-void PC6001_MEMORY::RefreshScr13()
+void MEMORY::RefreshScr13()
 {
        uint8_t X,Y;
        uint8_t *T1,*T2;
@@ -233,7 +235,7 @@ W=0;
 }
 
 // RefreshScr13a: N60-BASIC screen 3,4
-void PC6001_MEMORY::RefreshScr13a() /*  64x 64 color / 128x 64 */
+void MEMORY::RefreshScr13a() /*  64x 64 color / 128x 64 */
 {
        uint8_t X,Y;
        uint8_t *T1,*T2;
@@ -275,7 +277,7 @@ W=0;
 }
 
 // RefreshScr13b: N60-BASIC screen 3,4
-void PC6001_MEMORY::RefreshScr13b() /* 128x 64 color */
+void MEMORY::RefreshScr13b() /* 128x 64 color */
 {
        uint8_t X,Y;
        uint8_t *T1,*T2;
@@ -299,7 +301,7 @@ W=0;
 }
 
 // RefreshScr13c: N60-BASIC screen 3,4
-void PC6001_MEMORY::RefreshScr13c() /* 128x 96 */
+void MEMORY::RefreshScr13c() /* 128x 96 */
 {
        uint8_t X,Y;
        uint8_t *T1,*T2;
@@ -327,7 +329,7 @@ W=0;
 }
 
 // RefreshScr13d: N60-BASIC screen 3,4
-void PC6001_MEMORY::RefreshScr13d() /* 128x 96 color */
+void MEMORY::RefreshScr13d() /* 128x 96 color */
 {
        uint8_t X,Y;
        uint8_t *T1,*T2;
@@ -351,7 +353,7 @@ W=0;
 }
 
 // RefreshScr13e: N60-BASIC screen 3,4
-void PC6001_MEMORY::RefreshScr13e() /* 128x192 */
+void MEMORY::RefreshScr13e() /* 128x192 */
 {
        uint8_t X,Y;
        uint8_t *T1,*T2;
@@ -378,7 +380,7 @@ W=0;
 }
 
 // RefreshScr51: N60m/66-BASIC screen 1,2
-void PC6001_MEMORY::RefreshScr51()
+void MEMORY::RefreshScr51()
 {
        uint8_t X,Y,K;
        int FC,BC;
@@ -406,7 +408,7 @@ W=0;
 }
 
 // RefreshScr53: N60m/66-BASIC screen 3
-void PC6001_MEMORY::RefreshScr53()
+void MEMORY::RefreshScr53()
 {
        uint8_t X,Y;
        uint8_t *T1,*T2;
@@ -427,7 +429,7 @@ W=0;
 }
 
 // RefreshScr54: N60m/66-BASIC screen 4
-void PC6001_MEMORY::RefreshScr54()
+void MEMORY::RefreshScr54()
 {
        uint8_t X,Y;
        uint8_t *T1,*T2;
@@ -456,7 +458,7 @@ W=0;
 
 #if defined(_PC6601SR) || defined(_PC6001MK2SR)
 // RefreshScr61: N66-SR BASIC screen 1
-void PC6001_MEMORY::RefreshScr61()
+void MEMORY::RefreshScr61()
 {
        uint8_t X,Y,K;
        register int FC,BC;
@@ -490,7 +492,7 @@ W=0;
 }
 
 // RefreshScr62  N66-SR BASIC screen 2
-void PC6001_MEMORY::RefreshScr62()
+void MEMORY::RefreshScr62()
 {
        uint8_t X,Y;
        uint8_t *T1,*T2;
@@ -524,7 +526,7 @@ W=0;
 }
 
 // RefreshScr63  N66-SR BASIC screen 3
-void PC6001_MEMORY::RefreshScr63()
+void MEMORY::RefreshScr63()
 {
        uint8_t X,Y;
        uint8_t *T1,*T2;
@@ -566,7 +568,7 @@ W=0;
        }
 }
 
-void PC6001_MEMORY::do_palet(int dest,int src)
+void MEMORY::do_palet(int dest,int src)
 {
        int textpalet2[16]={0,4,1,5,2,6,3,7,8,12,9,13,10,14,11,15}; /*  color code-> VRAM code*/
        // *************** for RefreshScr 53/54/62/63 ***************************
@@ -596,7 +598,7 @@ void PC6001_MEMORY::do_palet(int dest,int src)
                BPal[textpalet2[dest]]= BPal61[ textpalet2[src]];  
 }
 
-void PC6001_MEMORY::make_semigraph(void)
+void MEMORY::make_semigraph(void)
 {
        uint8_t *P;
        unsigned int i, j, m1, m2;
@@ -638,14 +640,14 @@ void PC6001_MEMORY::make_semigraph(void)
        }
 }
 
-int PC6001_MEMORY::chk_gvram(uint32_t A,int flag)
+int MEMORY::chk_gvram(uint32_t A,int flag)
 {
        if (port60[ (A>>13)+flag ]==0x00 && bitmap)     // VRAM \82Ì\90æ\93ª\82©\82Â\81ACRT\82ª BITMAP mode
                return 1;
        return 0;
 }
 
-uint8_t PC6001_MEMORY::gvram_read(uint32_t A)
+uint8_t MEMORY::gvram_read(uint32_t A)
 {
        uint8_t* adr;
        uint8_t  ret;
@@ -669,7 +671,7 @@ uint8_t PC6001_MEMORY::gvram_read(uint32_t A)
        return (ret);
 }
 
-void PC6001_MEMORY::gvram_write(uint32_t A, uint32_t V)
+void MEMORY::gvram_write(uint32_t A, uint32_t V)
 {
        uint8_t* adr;
        int x,y,z,w,off;
@@ -693,3 +695,5 @@ void PC6001_MEMORY::gvram_write(uint32_t A, uint32_t V)
 }
 #endif
 
+}
+
index 54c86df..57333a3 100644 (file)
 #include "sub.h"
 #include "timer.h"
 
+#ifdef _PC6001
+using PC6001::DISPLAY;
+#endif
+#if defined(_PC6601) || defined(_PC6601SR)
+using PC6001::FLOPPY;
+#endif
+
+using PC6001::JOYSTICK;
+using PC6001::MEMORY;
+using PC6001::PSUB;
+using PC6001::SUB;
+using PC6001::TIMER;
+
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
@@ -96,7 +109,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
 //     floppy->set_context_noise_head_up(noise_head_up);
 #endif
        joystick = new JOYSTICK(this, emu);
-       memory = new PC6001_MEMORY(this, emu);
+       memory = new MEMORY(this, emu);
        timer = new TIMER(this, emu);
        
        // set contexts
index 4f7fa07..a02cc0a 100644 (file)
@@ -121,8 +121,6 @@ static const _TCHAR *sound_device_caption[] = {
        _T("CMT (Signal)"), _T("Noise (FDD)"), _T("Noise (CMT)"),
 };
 #endif
-
-class csp_state_utils;
 class EMU;
 class DEVICE;
 class EVENT;
@@ -149,22 +147,28 @@ class DATAREC;
 class MCS48;
 
 #ifdef _PC6001
-class DISPLAY;
+namespace PC6001 {
+       class DISPLAY;
+}
 #endif
 #if defined(_PC6601) || defined(_PC6601SR)
-class FLOPPY;
+namespace PC6001 {
+       class FLOPPY;
+}
 #endif
-class JOYSTICK;
-class PC6001_MEMORY;
-class PSUB;
-class SUB;
-class TIMER;
+
+namespace PC6001 {
+       class JOYSTICK;
+       class MEMORY;
+       class PSUB;
+       class SUB;
+       class TIMER;
+}
 
 class VM : public VM_TEMPLATE
 {
 protected:
        //EMU* emu;
-       //csp_state_utils *state_entry;
 
        int vdata;
        
@@ -185,20 +189,20 @@ protected:
        Z80* cpu;
 #ifdef _PC6001
        MC6847* vdp;
-       DISPLAY* display;
+       PC6001::DISPLAY* display;
 #else
        UPD7752* voice;
 #endif
 #if defined(_PC6601) || defined(_PC6601SR)
-       FLOPPY* floppy;
+       PC6001::FLOPPY* floppy;
 #endif
-       JOYSTICK* joystick;
-       PC6001_MEMORY* memory;
-       PSUB* psub;
-       TIMER* timer;
+       PC6001::JOYSTICK* joystick;
+       PC6001::MEMORY* memory;
+       PC6001::PSUB* psub;
+       PC6001::TIMER* timer;
        
        MCS48* cpu_sub;
-       SUB* sub;
+       PC6001::SUB* sub;
        DATAREC* drec;
        
        PC6031* pc6031;
index 349762c..ea594b3 100644 (file)
@@ -41,6 +41,8 @@
 #define EVENT_CASSETTE 0
 #define EVENT_STRIG    1
 
+namespace PC6001 {
+
 /* normal (small alphabet) */
 uint8_t Keys1[256][2] =
 {
@@ -1170,3 +1172,5 @@ bool PSUB::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateInt32(StrigEventID);
        return true;
 }
+
+}
index fa8e66b..94d1bb4 100644 (file)
@@ -20,6 +20,8 @@
 
 class FILEIO;
 
+namespace PC6001 {
+
 class PSUB : public DEVICE
 {
 private:
@@ -88,4 +90,6 @@ public:
        void key_down(int code);
        void key_up(int code);
 };
+
+}
 #endif
index bbac829..9960a14 100644 (file)
@@ -20,6 +20,8 @@
 #define EVENT_PLAY     0
 #define EVENT_STOP     1
 
+namespace PC6001 {
+
 static const uint8_t key_matrix[16][8] = {
        {0x00,  0x11,   0x10,   0x12,   0x00,   0x00,   0x00,   0x00},
        {0x31,  0x51,   0x41,   0x5a,   0x4b,   0x49,   0x38,   0xbc},
@@ -441,3 +443,6 @@ bool SUB::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBuffer(buffer, sizeof(buffer), 1);
        return true;
 }
+
+}
+
index 2401fe4..1422878 100644 (file)
@@ -23,6 +23,8 @@
 
 class FILEIO;
 
+namespace PC6001 {
+
 class SUB : public DEVICE
 {
 private:
@@ -78,4 +80,6 @@ public:
                return rec;
        }
 };
+
+}
 #endif
index deb4b57..e455d77 100644 (file)
@@ -18,6 +18,8 @@
 
 #define EVENT_TIMER    0
 
+namespace PC6001 {
+
 void TIMER::initialize()
 {
 #if defined(_PC6601SR) || defined(_PC6001MK2SR)
@@ -306,3 +308,6 @@ bool TIMER::process_state(FILEIO* state_fio, bool loading)
 #endif
        return true;
 }
+
+}
+
index f050867..d4ed70a 100644 (file)
 #define SIG_TIMER_IRQ_EXT_INT  7
 
 #ifndef _PC6001
-class PC6001_MEMORY;
+namespace PC6001 {
+       class MEMORY;
+}
 #endif
 
+namespace PC6001 {
 class TIMER : public DEVICE
 {
 private:
        DEVICE *d_cpu, *d_sub;
 #ifndef _PC6001
-       PC6001_MEMORY *d_mem;
+       PC6001::MEMORY *d_mem;
 #endif
        
        uint8_t IRQ, NewIRQ;
@@ -83,11 +86,12 @@ public:
                d_sub = device;
        }
 #ifndef _PC6001
-       void set_context_memory(PC6001_MEMORY* device)
+       void set_context_memory(PC6001::MEMORY* device)
        {
                d_mem = device;
        }
 #endif
        void set_portB0(uint32_t data);
 };
+}
 #endif
index 7b98ca5..58c8f4d 100644 (file)
@@ -11,6 +11,8 @@
 
 #define SAMPLE_RATE 48000
 
+namespace PC8201 {
+
 void CMT::initialize()
 {
        fio = new FILEIO();
@@ -230,3 +232,5 @@ bool CMT::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint32(prev_clock);
        return true;
 }
+
+}
index 377fb0b..ddfdf86 100644 (file)
@@ -20,6 +20,8 @@
 // max 256kbytes
 #define BUFFER_SIZE    0x40000
 
+namespace PC8201 {
+
 class CMT : public DEVICE
 {
 private:
@@ -69,5 +71,6 @@ public:
        }
 };
 
+}
 #endif
 
index 73fa496..9b82f03 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "keyboard.h"
 
+namespace PC8201 {
+
 static const int key_map[9][8] = {
        {0x5a, 0x58, 0x43, 0x56, 0x42, 0x4e, 0x4d, 0x4c},       //      Z       X       C       V       B       N       M       L
        {0x41, 0x53, 0x44, 0x46, 0x47, 0x48, 0x4a, 0x4b},       //      A       S       D       F       G       H       J       K
@@ -96,3 +98,5 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(kana);
        return true;
 }
+
+}
index c965c49..1e976be 100644 (file)
@@ -17,6 +17,8 @@
 #define SIG_KEYBOARD_COLUMN_L  0
 #define SIG_KEYBOARD_COLUMN_H  1
 
+namespace PC8201 {
+
 class KEYBOARD : public DEVICE
 {
 private:
@@ -49,4 +51,5 @@ public:
        }
 };
 
+}
 #endif
index 4bf0f97..2265e9e 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "lcd.h"
 
+namespace PC8201 {
+
 void LCD::initialize()
 {
        memset(seg, 0, sizeof(seg));
@@ -184,3 +186,5 @@ bool LCD::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint16(sel);
        return true;
 }
+
+}
index d7e2fa8..9dd304d 100644 (file)
@@ -17,6 +17,8 @@
 #define SIG_LCD_CHIPSEL_L      0
 #define SIG_LCD_CHIPSEL_H      1
 
+namespace PC8201 {
+
 class LCD : public DEVICE
 {
 private:
@@ -46,4 +48,5 @@ public:
        void draw_screen();
 };
 
+}
 #endif
index b2f197a..138acab 100644 (file)
@@ -12,6 +12,8 @@
 #include "../datarec.h"
 #include "../upd1990a.h"
 
+namespace PC8201 {
+
 #define SET_BANK(s, e, w, r) { \
        int sb = (s) >> 12, eb = (e) >> 12; \
        for(int i = sb; i <= eb; i++) { \
@@ -28,7 +30,7 @@
        } \
 }
 
-void PC8201_MEMORY::initialize()
+void MEMORY::initialize()
 {
        // init memory
        memset(ram, 0, sizeof(ram));
@@ -53,7 +55,7 @@ void PC8201_MEMORY::initialize()
        delete fio;
 }
 
-void PC8201_MEMORY::release()
+void MEMORY::release()
 {
        // save ram image
        FILEIO* fio = new FILEIO();
@@ -64,25 +66,25 @@ void PC8201_MEMORY::release()
        delete fio;
 }
 
-void PC8201_MEMORY::reset()
+void MEMORY::reset()
 {
        sio = bank = 0;
        update_bank();
 }
 
-void PC8201_MEMORY::write_data8(uint32_t addr, uint32_t data)
+void MEMORY::write_data8(uint32_t addr, uint32_t data)
 {
        addr &= 0xffff;
        wbank[addr >> 12][addr & 0xfff] = data;
 }
 
-uint32_t PC8201_MEMORY::read_data8(uint32_t addr)
+uint32_t MEMORY::read_data8(uint32_t addr)
 {
        addr &= 0xffff;
        return rbank[addr >> 12][addr & 0xfff];
 }
 
-void PC8201_MEMORY::write_io8(uint32_t addr, uint32_t data)
+void MEMORY::write_io8(uint32_t addr, uint32_t data)
 {
        switch(addr & 0xf0) {
        case 0x90:
@@ -104,13 +106,13 @@ void PC8201_MEMORY::write_io8(uint32_t addr, uint32_t data)
        }
 }
 
-uint32_t PC8201_MEMORY::read_io8(uint32_t addr)
+uint32_t MEMORY::read_io8(uint32_t addr)
 {
        // $A0: bank status
        return (sio & 0xc0) | (bank & 0xf);
 }
 
-void PC8201_MEMORY::update_bank()
+void MEMORY::update_bank()
 {
        switch(bank & 3) {
        case 0:
@@ -144,7 +146,7 @@ void PC8201_MEMORY::update_bank()
 
 #define STATE_VERSION  1
 
-bool PC8201_MEMORY::process_state(FILEIO* state_fio, bool loading)
+bool MEMORY::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
@@ -162,3 +164,5 @@ bool PC8201_MEMORY::process_state(FILEIO* state_fio, bool loading)
        }
        return true;
 }
+
+}
index 26869aa..36f2ddc 100644 (file)
@@ -14,7 +14,9 @@
 #include "../../emu.h"
 #include "../device.h"
 
-class PC8201_MEMORY : public DEVICE
+namespace PC8201 {
+
+class MEMORY : public DEVICE
 {
 private:
        DEVICE *d_cmt, *d_drec, *d_rtc;
@@ -31,11 +33,11 @@ private:
        void update_bank();
        
 public:
-       PC8201_MEMORY(VM_TEMPLATE* 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"));
        }
-       ~PC8201_MEMORY() {}
+       ~MEMORY() {}
        
        // common functions
        void initialize();
@@ -62,5 +64,6 @@ public:
        }
 };
 
+}
 #endif
 
index e2055ec..32d6d11 100644 (file)
 #include "lcd.h"
 #include "./memory.h"
 
+using PC8201::CMT;
+using PC8201::KEYBOARD;
+using PC8201::LCD;
+using PC8201::MEMORY;
+
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
@@ -53,7 +58,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
        cmt = new CMT(this, emu);
        keyboard = new KEYBOARD(this, emu);
        lcd = new LCD(this, emu);
-       memory = new PC8201_MEMORY(this, emu);
+       memory = new MEMORY(this, emu);
        
        // set contexts
        event->set_context_cpu(cpu);
index d5e30d2..30e536f 100644 (file)
@@ -63,10 +63,12 @@ class IO;
 class PCM1BIT;
 class UPD1990A;
 
-class CMT;
-class KEYBOARD;
-class LCD;
-class PC8201_MEMORY;
+namespace PC8201 {
+       class CMT;
+       class KEYBOARD;
+       class LCD;
+       class MEMORY;
+}
 
 class VM :public VM_TEMPLATE
 {
@@ -84,10 +86,10 @@ protected:
        PCM1BIT* pcm;
        UPD1990A* rtc;
        
-       CMT* cmt;
-       KEYBOARD* keyboard;
-       LCD* lcd;
-       PC8201_MEMORY* memory;
+       PC8201::CMT* cmt;
+       PC8201::KEYBOARD* keyboard;
+       PC8201::LCD* lcd;
+       PC8201::MEMORY* memory;
        
 public:
        // ----------------------------------------
index 4196372..d91c1c8 100644 (file)
@@ -11,6 +11,8 @@
 #include "cmt.h"
 #include "../i8251.h"
 
+namespace PC9801 {
+
 void CMT::initialize()
 {
        fio = new FILEIO();
@@ -122,3 +124,4 @@ bool CMT::process_state(FILEIO* state_fio, bool loading)
        return true;
 }
 
+}
index 2fd5172..1cc870d 100644 (file)
@@ -23,6 +23,8 @@
 // max 256kbytes
 #define BUFFER_SIZE    0x40000
 
+namespace PC9801 {
+
 class CMT : public DEVICE
 {
 private:
@@ -64,5 +66,6 @@ public:
        }
 };
 
+}
 #endif
 
index c28d0d1..f9186bd 100644 (file)
@@ -18,6 +18,8 @@
 #include "../i286.h"
 #endif
 
+namespace PC9801 {
+
 void CPUREG::reset()
 {
        d_cpu->set_address_mask(0x000fffff);
@@ -117,3 +119,6 @@ bool CPUREG::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(nmi_enabled);
        return true;
 }
+
+}
+
index 77982b6..a24575e 100644 (file)
@@ -24,6 +24,8 @@ class I386;
 class I286;
 #endif
 
+namespace PC9801 {
+
 class CPUREG : public DEVICE
 {
 private:
@@ -58,5 +60,6 @@ public:
        }
 };
 
+}
 #endif
 
index 7b575b6..e1e7aa2 100644 (file)
@@ -73,6 +73,8 @@
 #define ATTR_VL                0x10
 #define ATTR_COL       0xe0
 
+namespace PC9801 {
+
 static const uint8_t memsw_default[] = {
        0xe1, 0x48, 0xe1, 0x05, 0xe1, 0x04, 0xe1, 0x00,
        0xe1, 0x01, 0xe1, 0x00, 0xe1, 0x00, 0xe1, 0x00,
@@ -2715,3 +2717,4 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading)
        return true;
 }
 
+}
index ae8eff5..117f728 100644 (file)
@@ -26,6 +26,8 @@
 
 class UPD7220;
 
+namespace PC9801 {
+
 class DISPLAY : public DEVICE
 {
 private:
@@ -243,5 +245,6 @@ public:
        void draw_screen();
 };
 
+}
 #endif
 
index 56eabe9..4578c28 100644 (file)
@@ -14,6 +14,8 @@
 #include "dmareg.h"
 #include "../i8237.h"
 
+namespace PC9801 {
+
 static const int bank_lo_id[] = {
        SIG_I8237_BANK1, SIG_I8237_BANK2, SIG_I8237_BANK3, SIG_I8237_BANK0,
 };
@@ -94,3 +96,6 @@ bool DMAREG::process_state(FILEIO* state_fio, bool loading)
 }
 
 */
+
+}
+
index ea3335a..7c4412c 100644 (file)
@@ -18,6 +18,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace PC9801 {
+
 class DMAREG : public DEVICE
 {
 private:
@@ -42,5 +44,6 @@ public:
        }
 };
 
+}
 #endif
 
index fa2bae8..a033dff 100644 (file)
@@ -25,6 +25,8 @@
 
 #define EVENT_TIMER    0
 
+namespace PC9801 {
+
 void FLOPPY::reset()
 {
 #if defined(SUPPORT_2HD_FDD_IF)
@@ -341,3 +343,4 @@ bool FLOPPY::process_state(FILEIO* state_fio, bool loading)
        return true;
 }
 
+}
index 4cc7a24..a47eaad 100644 (file)
@@ -39,6 +39,8 @@
 
 class UPD765A;
 
+namespace PC9801 {
+
 class FLOPPY : public DEVICE
 {
 private:
@@ -102,5 +104,6 @@ public:
        }
 };
 
+}
 #endif
 
index 941bb59..e85a4be 100644 (file)
@@ -22,6 +22,8 @@
 // PC-98DO+
 #define BOARD_ID       0
 
+namespace PC9801 {
+
 #ifdef SUPPORT_PC98_OPNA
 void FMSOUND::reset()
 {
@@ -97,3 +99,4 @@ bool FMSOUND::process_state(FILEIO* state_fio, bool loading)
 }
 #endif
 
+}
index f2aff1c..a6dd9e5 100644 (file)
@@ -24,6 +24,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace PC9801 {
+
 class FMSOUND : public DEVICE
 {
 private:
@@ -60,5 +62,6 @@ public:
        }
 };
 
+}
 #endif
 
index 8ffe422..f7a0e37 100644 (file)
@@ -20,6 +20,8 @@
 #include "joystick.h"
 #include "../ym2203.h"
 
+namespace PC9801 {
+
 void JOYSTICK::initialize()
 {
        joy_status = emu->get_joy_buffer();
@@ -55,3 +57,4 @@ bool JOYSTICK::process_state(FILEIO* state_fio, bool loading)
        return true;
 }
 
+}
index 22a9e38..26b4b4c 100644 (file)
@@ -26,6 +26,8 @@
 
 #define SIG_JOYSTICK_SELECT    0
 
+namespace PC9801 {
+
 class JOYSTICK : public DEVICE
 {
 private:
@@ -54,4 +56,5 @@ public:
        }
 };
 
+}
 #endif
index d6107ba..8b5e838 100644 (file)
@@ -20,6 +20,8 @@
 #include "keyboard.h"
 #include "../i8251.h"
 
+namespace PC9801 {
+
 static const int key_table[256] = {
          -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,0x0e,0x0f,  -1,  -1,  -1,0x1c,  -1,  -1,
        0x70,0x74,0x73,0x60,  -1,  -1,  -1,  -1,  -1,  -1,  -1,0x00,0x35,  -1,  -1,  -1,
@@ -99,3 +101,4 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading)
        return true;
 }
 
+}
index b3f99f8..e3e6d3d 100644 (file)
@@ -26,6 +26,8 @@
 
 #define SIG_KEYBOARD_RECV      0
 
+namespace PC9801 {
+
 class KEYBOARD : public DEVICE
 {
 private:
@@ -63,4 +65,5 @@ public:
        }
 };
 
+}
 #endif
index 485d041..933ae6f 100644 (file)
@@ -52,6 +52,8 @@
                F0000h - FFFFFh: BIOS
 */
 
+namespace PC9801 {
+
 void MEMBUS::initialize()
 {
        MEMORY::initialize();
@@ -605,3 +607,5 @@ bool MEMBUS::process_state(FILEIO* state_fio, bool loading)
        }
        return true;
 }
+
+}
index 8380d31..fe00823 100644 (file)
@@ -22,8 +22,9 @@
 
 #include "../memory.h"
 
-class DISPLAY;
-
+namespace PC9801 {
+       class DISPLAY;
+}
 #if defined(SUPPORT_32BIT_ADDRESS)
        #define RAM_SIZE        0x800000        // 8MB
 #elif defined(SUPPORT_24BIT_ADDRESS)
@@ -34,6 +35,8 @@ class DISPLAY;
 
 //class csp_state_utils;
 
+namespace PC9801 {
+
 class MEMBUS : public MEMORY
 {
 private:
@@ -138,4 +141,5 @@ public:
        }
 };
 
+}
 #endif
index 7d03df0..24f9695 100644 (file)
@@ -23,6 +23,8 @@
 
 #define EVENT_TIMER    0
 
+namespace PC9801 {
+
 static const int freq_table[4] = {120, 60, 30, 15};
 
 void MOUSE::initialize()
@@ -146,3 +148,4 @@ bool MOUSE::process_state(FILEIO* state_fio, bool loading)
        return true;
 }
 
+}
index 03d7c93..1ca5fd0 100644 (file)
@@ -26,6 +26,8 @@
 
 #define SIG_MOUSE_PORT_C       0
 
+namespace PC9801 {
+
 class MOUSE : public DEVICE
 {
 private:
@@ -68,5 +70,6 @@ public:
        }
 };
 
+}
 #endif
 
index 0326bff..8e21b15 100644 (file)
 #include "ide.h"
 #endif
 
+#if defined(SUPPORT_CMT_IF)
+using PC9801::CMT;
+#endif
+#if defined(SUPPORT_24BIT_ADDRESS) || defined(SUPPORT_32BIT_ADDRESS)
+using PC9801::CPUREG;
+#endif
+using PC9801::DISPLAY;
+using PC9801::DMAREG;
+using PC9801::FLOPPY;
+using PC9801::FMSOUND;
+using PC9801::JOYSTICK;
+using PC9801::KEYBOARD;
+using PC9801::MEMBUS;
+using PC9801::MOUSE;
+#if defined(SUPPORT_SASI_IF)
+using PC9801::SASI;
+#endif
+#if defined(SUPPORT_SCSI_IF)
+using PC9801::SCSI;
+#endif
+#if defined(SUPPORT_IDE_IF)
+using PC9801::IDE;
+#endif
+
 #if defined(SUPPORT_320KB_FDD_IF)
 #include "../pc80s31k.h"
 #include "../z80.h"
 #include "../pc8801/pc88.h"
 #endif
 
+#if defined(_PC98DO) || defined(_PC98DOPLUS)
+using PC88DEV::PC88;
+#endif
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
index df1aacb..e118829 100644 (file)
@@ -375,29 +375,31 @@ class UPD7220;
 class UPD765A;
 class YM2203;
 
+namespace PC9801 {
 #if defined(SUPPORT_CMT_IF)
-class CMT;
+       class CMT;
 #endif
 #if defined(SUPPORT_24BIT_ADDRESS) || defined(SUPPORT_32BIT_ADDRESS)
-class CPUREG;
-#endif
-class DISPLAY;
-class DMAREG;
-class FLOPPY;
-class FMSOUND;
-class JOYSTICK;
-class KEYBOARD;
-class MEMBUS;
-class MOUSE;
+       class CPUREG;
+#endif
+       class DISPLAY;
+       class DMAREG;
+       class FLOPPY;
+       class FMSOUND;
+       class JOYSTICK;
+       class KEYBOARD;
+       class MEMBUS;
+       class MOUSE;
 #if defined(SUPPORT_SASI_IF)
-class SASI;
+       class SASI;
 #endif
 #if defined(SUPPORT_SCSI_IF)
-class SCSI;
+       class SCSI;
 #endif
 #if defined(SUPPORT_IDE_IF)
-class IDE;
+       class IDE;
 #endif
+}
 
 #if defined(SUPPORT_320KB_FDD_IF)
 // 320kb fdd drives
@@ -407,7 +409,9 @@ class Z80;
 
 #if defined(_PC98DO) || defined(_PC98DOPLUS)
 class PC80S31K;
-class PC88;
+namespace PC88DEV {
+       class PC88;
+}
 class Z80;
 #endif
 
@@ -480,27 +484,27 @@ protected:
        YM2203* opn;
        
 #if defined(SUPPORT_CMT_IF)
-       CMT* cmt;
+       PC9801::CMT* cmt;
 #endif
 #if defined(SUPPORT_24BIT_ADDRESS) || defined(SUPPORT_32BIT_ADDRESS)
-       CPUREG* cpureg;
-#endif
-       DISPLAY* display;
-       DMAREG* dmareg;
-       FLOPPY* floppy;
-       FMSOUND* fmsound;
-       JOYSTICK* joystick;
-       KEYBOARD* keyboard;
-       MEMBUS* memory;
-       MOUSE* mouse;
+       PC9801::CPUREG* cpureg;
+#endif
+       PC9801::DISPLAY* display;
+       PC9801::DMAREG* dmareg;
+       PC9801::FLOPPY* floppy;
+       PC9801::FMSOUND* fmsound;
+       PC9801::JOYSTICK* joystick;
+       PC9801::KEYBOARD* keyboard;
+       PC9801::MEMBUS* memory;
+       PC9801::MOUSE* mouse;
 #if defined(SUPPORT_SASI_IF)
-       SASI* sasi;
+       PC9801::SASI* sasi;
 #endif
 #if defined(SUPPORT_SCSI_IF)
-       SCSI* scsi;
+       PC9801::SCSI* scsi;
 #endif
 #if defined(SUPPORT_IDE_IF)
-       IDE* ide;
+       PC9801::IDE* ide;
 #endif
        
        // PC-9801-14
@@ -524,7 +528,7 @@ protected:
 #if defined(_PC98DO) || defined(_PC98DOPLUS)
        EVENT* pc88event;
        
-       PC88* pc88;
+       PC88DEV::PC88* pc88;
        DEVICE* pc88prn;
        I8251* pc88sio;
        I8255* pc88pio;
index 67da952..f4a2856 100644 (file)
@@ -33,6 +33,8 @@
 #define ISR_IXO                0x04
 #define ISR_INT                0x01
 
+namespace PC9801 {
+
 void SASI::reset()
 {
        ocr = 0;
@@ -211,3 +213,5 @@ bool SASI::process_state(FILEIO* state_fio, bool loading)
        return true;
 }
 
+}
+
index eaca08d..71c2261 100644 (file)
@@ -24,6 +24,8 @@
 
 class SASI_HDD;
 
+namespace PC9801 {
+
 class SASI : public DEVICE
 {
 private:
@@ -70,5 +72,6 @@ public:
        }
 };
 
+}
 #endif
 
index 0fb7681..62621e2 100644 (file)
@@ -12,6 +12,8 @@
 #include "../upd765a.h"
 #include "../disk.h"
 
+namespace PC98HA {
+
 // regs
 #define AL     regs8[0]
 #define AH     regs8[1]
@@ -45,3 +47,5 @@ bool BIOS::bios_int_i86(int intnum, uint16_t regs[], uint16_t sregs[], int32_t*
        }
        return false;
 }
+
+}
index 37b8538..b334cce 100644 (file)
@@ -17,6 +17,8 @@
 
 class UPD765A;
 
+namespace PC98HA {
+
 class BIOS : public DEVICE
 {
 private:
@@ -39,5 +41,6 @@ public:
        }
 };
 
+}
 #endif
 
index 6b3f65a..56facd0 100644 (file)
@@ -13,6 +13,8 @@
 #include "../upd1990a.h"
 #endif
 
+namespace PC98HA {
+
 void CALENDAR::initialize()
 {
 #ifdef _PC98HA
@@ -68,3 +70,4 @@ bool CALENDAR::process_state(FILEIO* state_fio, bool loading)
 }
 #endif
 
+}
index f5b63ac..b587e1c 100644 (file)
@@ -15,6 +15,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace PC98HA {
+
 class CALENDAR : public DEVICE
 {
 private:
@@ -45,5 +47,6 @@ public:
        }
 };
 
+}
 #endif
 
index d0e0f5e..c60135f 100644 (file)
@@ -12,6 +12,8 @@
 #include "../disk.h"
 #include "../upd765a.h"
 
+namespace PC98HA {
+
 void FLOPPY::reset()
 {
 /*
@@ -81,3 +83,5 @@ bool FLOPPY::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint8(modereg);
        return true;
 }
+
+}
index 158248b..2426e16 100644 (file)
@@ -19,6 +19,8 @@
 
 class UPD765A;
 
+namespace PC98HA {
+
 class FLOPPY : public DEVICE
 {
 private:
@@ -46,5 +48,6 @@ public:
        }
 };
 
+}
 #endif
 
index 0cbc46a..214c02e 100644 (file)
@@ -11,6 +11,8 @@
 #include "keyboard.h"
 #include "../i8251.h"
 
+namespace PC98HA {
+
 static const int key_table[256] = {
          -1,  -1,  -1,  -1,  -1,  -1,  -1,  -1,0x0e,0x0f,  -1,  -1,  -1,0x1c,  -1,  -1,
        0x70,0x74,0x73,0x60,  -1,  -1,  -1,  -1,  -1,  -1,  -1,0x00,0x35,0x51,  -1,  -1,
@@ -85,3 +87,5 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBuffer(flag, sizeof(flag), 1);
        return true;
 }
+
+}
index 148712e..75bddde 100644 (file)
@@ -17,6 +17,8 @@
 
 #define SIG_KEYBOARD_RECV      0
 
+namespace PC98HA {
+
 class KEYBOARD : public DEVICE
 {
 private:
@@ -54,4 +56,5 @@ public:
        }
 };
 
+}
 #endif
index 1c7e7cb..81433fb 100644 (file)
@@ -10,6 +10,8 @@
 
 #include "./memory.h"
 
+namespace PC98HA {
+
 #define SET_BANK(s, e, w, r) { \
        int sb = (s) >> 14, eb = (e) >> 14; \
        for(int i = sb; i <= eb; i++) { \
@@ -26,7 +28,7 @@
        } \
 }
 
-void PC98LT_MEMORY::initialize()
+void MEMORY::initialize()
 {
        // init memory
        memset(ram, 0, sizeof(ram));
@@ -87,7 +89,7 @@ void PC98LT_MEMORY::initialize()
 #endif
 }
 
-void PC98LT_MEMORY::release()
+void MEMORY::release()
 {
        // save ram images
        FILEIO* fio = new FILEIO();
@@ -114,7 +116,7 @@ void PC98LT_MEMORY::release()
        delete fio;
 }
 
-void PC98LT_MEMORY::reset()
+void MEMORY::reset()
 {
        // set memory bank
        learn_bank = dic_bank = kanji_bank = romdrv_bank = 0;
@@ -126,7 +128,7 @@ void PC98LT_MEMORY::reset()
        update_bank();
 }
 
-void PC98LT_MEMORY::write_data8(uint32_t addr, uint32_t data)
+void MEMORY::write_data8(uint32_t addr, uint32_t data)
 {
        addr &= 0xfffff;
        wbank[addr >> 14][addr & 0x3fff] = data;
@@ -138,13 +140,13 @@ void PC98LT_MEMORY::write_data8(uint32_t addr, uint32_t data)
 #endif
 }
 
-uint32_t PC98LT_MEMORY::read_data8(uint32_t addr)
+uint32_t MEMORY::read_data8(uint32_t addr)
 {
        addr &= 0xfffff;
        return rbank[addr >> 14][addr & 0x3fff];
 }
 
-void PC98LT_MEMORY::write_io8(uint32_t addr, uint32_t data)
+void MEMORY::write_io8(uint32_t addr, uint32_t data)
 {
        switch(addr & 0xffff) {
 #ifdef _PC98HA
@@ -205,7 +207,7 @@ void PC98LT_MEMORY::write_io8(uint32_t addr, uint32_t data)
        }
 }
 
-uint32_t PC98LT_MEMORY::read_io8(uint32_t addr)
+uint32_t MEMORY::read_io8(uint32_t addr)
 {
        switch(addr & 0xffff) {
        case 0x0c10:
@@ -220,7 +222,7 @@ uint32_t PC98LT_MEMORY::read_io8(uint32_t addr)
        return 0xff;
 }
 
-void PC98LT_MEMORY::update_bank()
+void MEMORY::update_bank()
 {
        SET_BANK(0x00000, 0xfffff, wdmy, rdmy);
        
@@ -253,7 +255,7 @@ void PC98LT_MEMORY::update_bank()
        SET_BANK(0xf0000, 0xfffff, wdmy, ipl);
 }
 
-void PC98LT_MEMORY::draw_screen()
+void MEMORY::draw_screen()
 {
        // draw to real screen
        scrntype_t cd = RGB_COLOR(48, 56, 16);
@@ -278,7 +280,7 @@ void PC98LT_MEMORY::draw_screen()
 
 #define STATE_VERSION  1
 
-bool PC98LT_MEMORY::process_state(FILEIO* state_fio, bool loading)
+bool MEMORY::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
@@ -315,3 +317,5 @@ bool PC98LT_MEMORY::process_state(FILEIO* state_fio, bool loading)
        }
        return true;
 }
+
+}
index 716fac0..1331ac8 100644 (file)
@@ -17,7 +17,9 @@
 
 #define SIG_MEMORY_IR2 0
 
-class PC98LT_MEMORY : public DEVICE
+namespace PC98HA {
+
+class MEMORY : public DEVICE
 {
 private:
        uint8_t* rbank[64];     // 1MB / 16KB
@@ -57,11 +59,11 @@ private:
 #endif
        
 public:
-       PC98LT_MEMORY(VM_TEMPLATE* 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"));
        }
-       ~PC98LT_MEMORY() {}
+       ~MEMORY() {}
        
        // common functions
        void initialize();
@@ -81,5 +83,6 @@ public:
        void draw_screen();
 };
 
+}
 #endif
 
index 381010e..7512986 100644 (file)
@@ -11,6 +11,8 @@
 #include "note.h"
 #include "../i8259.h"
 
+namespace PC98HA {
+
 void NOTE::initialize()
 {
        ch = 0;
@@ -92,3 +94,6 @@ bool NOTE::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBuffer(regs, sizeof(regs), 1);
        return true;
 }
+
+}
+
index df49561..e90864c 100644 (file)
@@ -15,6 +15,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace PC98HA {
+
 class NOTE : public DEVICE
 {
 private:
@@ -41,5 +43,6 @@ public:
        }
 };
 
+}
 #endif
 
index 96fa8d9..98e7d79 100644 (file)
 #include "./memory.h"
 #include "note.h"
 
+using PC98HA::BIOS;
+using PC98HA::CALENDAR;
+using PC98HA::FLOPPY;
+using PC98HA::KEYBOARD;
+using PC98HA::MEMORY;
+using PC98HA::NOTE;
+
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
@@ -103,7 +110,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
        calendar = new CALENDAR(this, emu);
        floppy = new FLOPPY(this, emu);
        keyboard = new KEYBOARD(this, emu);
-       memory = new PC98LT_MEMORY(this, emu);
+       memory = new MEMORY(this, emu);
        note = new NOTE(this, emu);
        // set contexts
        event->set_context_cpu(cpu);
index ddbeeb4..2a0111e 100644 (file)
@@ -93,12 +93,14 @@ class UPD1990A;
 class UPD71071;
 class UPD765A;
 
-class BIOS;
-class CALENDAR;
-class FLOPPY;
-class KEYBOARD;
-class PC98LT_MEMORY;
-class NOTE;
+namespace PC98HA {
+       class BIOS;
+       class CALENDAR;
+       class FLOPPY;
+       class KEYBOARD;
+       class MEMORY;
+       class NOTE;
+}
 
 class VM : public VM_TEMPLATE
 {
@@ -132,12 +134,12 @@ protected:
        UPD71071* dma;
        UPD765A* fdc;
        
-       BIOS* bios;
-       CALENDAR* calendar;
-       FLOPPY* floppy;
-       KEYBOARD* keyboard;
-       PC98LT_MEMORY* memory;
-       NOTE* note;
+       PC98HA::BIOS* bios;
+       PC98HA::CALENDAR* calendar;
+       PC98HA::FLOPPY* floppy;
+       PC98HA::KEYBOARD* keyboard;
+       PC98HA::MEMORY* memory;
+       PC98HA::NOTE* note;
        
 public:
        // ----------------------------------------
index 46b18fe..949d8f5 100644 (file)
@@ -52,6 +52,8 @@
 #define DCR_DVC         0x02    /* VRAM > VRAM EOT interrupt enable */
 #define DCR_DSC         0x01    /* VRAM > SATB EOT interrupt enable */
 
+namespace PCEDEV {
+
 /* just to keep things simple... */
 enum vdc_regs {MAWR = 0, MARR, VxR, reg3, reg4, CR, RCR, BXR, BYR, MWR, HSR, HDR, VPR, VDW, VCR, DCR, SOUR, DESR, LENR, DVSSR };
 
@@ -2610,3 +2612,5 @@ bool PCE::process_state(FILEIO* state_fio, bool loading)
 #endif
        return true;
 }
+
+}
index e071010..0098b5f 100644 (file)
@@ -41,6 +41,8 @@ class SCSI_HOST;
 class SCSI_CDROM;
 #endif
 
+namespace PCEDEV {
+
 class PCE : public DEVICE
 {
 private:
@@ -278,4 +280,5 @@ public:
        void draw_screen();
 };
 
+}
 #endif
index f821e4c..5811dd2 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "pce.h"
 
+using PCEDEV::PCE;
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
index 8b11fd9..ca8c6ff 100644 (file)
@@ -76,8 +76,10 @@ class HUC6280;
 class MSM5205;
 class SCSI_HOST;
 class SCSI_CDROM;
-class PCE;
 
+namespace PCEDEV {
+       class PCE;
+}
 class VM : public VM_TEMPLATE
 {
 protected:
@@ -91,7 +93,7 @@ protected:
        MSM5205* adpcm;
        SCSI_HOST* scsi_host;
        SCSI_CDROM* scsi_cdrom;
-       PCE* pce;
+       PCEDEV::PCE* pce;
        
 public:
        // ----------------------------------------
index 558480a..262dc6e 100644 (file)
@@ -10,6 +10,8 @@
 #include "./memory.h"
 #include "../datarec.h"
 
+namespace PHC20 {
+
 static const uint8_t key_map[9][8] = {
        {0x31, 0x57, 0x53, 0x58, 0x00, 0x28, 0xba, 0xbd},       //      1       W       S       X               DOWN    :       -
        {0x1b, 0x51, 0x41, 0x5a, 0x00, 0x0d, 0xbb, 0xbf},       //      ESC???  Q       A       Z               RET     ;       /
@@ -38,7 +40,7 @@ static const uint8_t key_map[9][8] = {
        } \
 }
 
-void PHC20_MEMORY::initialize()
+void MEMORY::initialize()
 {
        memset(rom, 0xff, sizeof(rom));
        memset(rdmy, 0xff, sizeof(rdmy));
@@ -64,7 +66,7 @@ void PHC20_MEMORY::initialize()
        register_frame_event(this);
 }
 
-void PHC20_MEMORY::reset()
+void MEMORY::reset()
 {
        memset(ram, 0, sizeof(ram));
        memset(vram, 0, sizeof(vram));
@@ -73,7 +75,7 @@ void PHC20_MEMORY::reset()
        sysport = 0;
 }
 
-void PHC20_MEMORY::write_data8(uint32_t addr, uint32_t data)
+void MEMORY::write_data8(uint32_t addr, uint32_t data)
 {
        addr &= 0xffff;
        if((0x3000 <= addr && addr < 0x4000) || 0x4400 <= addr) {
@@ -104,7 +106,7 @@ void PHC20_MEMORY::write_data8(uint32_t addr, uint32_t data)
        wbank[addr >> 10][addr & 0x3ff] = data;
 }
 
-uint32_t PHC20_MEMORY::read_data8(uint32_t addr)
+uint32_t MEMORY::read_data8(uint32_t addr)
 {
        addr &= 0xffff;
        if((0x3000 <= addr && addr < 0x4000) || 0x4400 <= addr) {
@@ -134,7 +136,7 @@ uint32_t PHC20_MEMORY::read_data8(uint32_t addr)
        return rbank[addr >> 10][addr & 0x3ff];
 }
 
-void PHC20_MEMORY::event_frame()
+void MEMORY::event_frame()
 {
        memset(status, 0, sizeof(status));
        
@@ -147,7 +149,7 @@ void PHC20_MEMORY::event_frame()
        }
 }
 
-void PHC20_MEMORY::write_signal(int id, uint32_t data, uint32_t mask)
+void MEMORY::write_signal(int id, uint32_t data, uint32_t mask)
 {
        if(data & mask) {
                sysport |= mask;
@@ -158,7 +160,7 @@ void PHC20_MEMORY::write_signal(int id, uint32_t data, uint32_t mask)
 
 #define STATE_VERSION  1
 
-bool PHC20_MEMORY::process_state(FILEIO* state_fio, bool loading)
+bool MEMORY::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
@@ -172,3 +174,5 @@ bool PHC20_MEMORY::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint8(sysport);
        return true;
 }
+
+}
index e4d3b3f..2c2d0a2 100644 (file)
@@ -16,7 +16,9 @@
 
 #define SIG_MEMORY_SYSPORT     0
 
-class PHC20_MEMORY : public DEVICE
+namespace PHC20 {
+
+class MEMORY : public DEVICE
 {
 private:
        DEVICE *d_drec;
@@ -35,11 +37,11 @@ private:
        uint8_t sysport;
        
 public:
-       PHC20_MEMORY(VM_TEMPLATE* 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"));
        }
-       ~PHC20_MEMORY() {}
+       ~MEMORY() {}
        
        // common functions
        void initialize();
@@ -61,5 +63,6 @@ public:
        }
 };
 
+}
 #endif
 
index c1a53a6..53e80b1 100644 (file)
@@ -23,6 +23,8 @@
 
 #include "./memory.h"
 
+using PHC20::MEMORY;
+
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
@@ -41,7 +43,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
        drec->set_context_noise_fast(new NOISE(this, emu));
        vdp = new MC6847(this, emu);
        cpu = new Z80(this, emu);
-       memory = new PHC20_MEMORY(this, emu);
+       memory = new MEMORY(this, emu);
        // set contexts
        event->set_context_cpu(cpu);
        event->set_context_sound(drec);
index db24352..c4082ea 100644 (file)
@@ -45,8 +45,6 @@ static const _TCHAR *sound_device_caption[] = {
 };
 #endif
 
-class csp_state_utils;
-
 class EMU;
 class DEVICE;
 class EVENT;
@@ -55,7 +53,9 @@ class DATAREC;
 class MC6847;
 class Z80;
 
-class PHC20_MEMORY;
+namespace PHC20 {
+       class MEMORY;
+}
 
 class VM : public VM_TEMPLATE
 {
@@ -70,7 +70,7 @@ protected:
        MC6847* vdp;
        Z80* cpu;
        
-       PHC20_MEMORY* memory;
+       PHC20::MEMORY* memory;
        
 public:
        // ----------------------------------------
index 4a3634c..ebdee0f 100644 (file)
@@ -11,6 +11,8 @@
 #include "joystick.h"
 #include "../ay_3_891x.h"
 
+namespace PHC25 {
+
 void JOYSTICK::initialize()
 {
        joy_stat = emu->get_joy_buffer();
@@ -24,3 +26,5 @@ void JOYSTICK::event_frame()
        d_psg->write_signal(SIG_AY_3_891X_PORT_A, ~(joy_stat[0] & 0x1f), 0xff);
        d_psg->write_signal(SIG_AY_3_891X_PORT_B, ~(joy_stat[1] & 0x1f), 0xff);
 }
+
+}
index 01c47db..a7d5d04 100644 (file)
@@ -15,6 +15,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace PHC25 {
+
 class JOYSTICK : public DEVICE
 {
 private:
@@ -39,4 +41,5 @@ public:
        }
 };
 
+}
 #endif
index 17574ab..25e4c68 100644 (file)
@@ -10,6 +10,8 @@
 
 #include "keyboard.h"
 
+namespace PHC25 {
+
 #ifdef _MAP1010
 static const uint8_t key_map[0x50] = {
 /*
@@ -135,3 +137,5 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading)
 #endif
        return true;
 }
+
+}
index c9c8a0c..c79a1c1 100644 (file)
@@ -15,6 +15,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace PHC25 {
+
 class KEYBOARD : public DEVICE
 {
 private:
@@ -41,4 +43,5 @@ public:
        bool process_state(FILEIO* state_fio, bool loading);
 };
 
+}
 #endif
index 7ae17e6..ca12d01 100644 (file)
@@ -10,6 +10,8 @@
 
 #include "./memory.h"
 
+namespace PHC25 {
+
 #define SET_BANK(s, e, w, r) { \
        int sb = (s) >> 11, eb = (e) >> 11; \
        for(int i = sb; i <= eb; i++) { \
@@ -26,7 +28,7 @@
        } \
 }
 
-void PHC25_MEMORY::initialize()
+void MEMORY::initialize()
 {
        memset(rom, 0xff, sizeof(rom));
        memset(rdmy, 0xff, sizeof(rdmy));
@@ -53,13 +55,13 @@ void PHC25_MEMORY::initialize()
 #endif
 }
 
-void PHC25_MEMORY::reset()
+void MEMORY::reset()
 {
        memset(ram, 0, sizeof(ram));
        memset(vram, 0, sizeof(vram));
 }
 
-void PHC25_MEMORY::write_data8(uint32_t addr, uint32_t data)
+void MEMORY::write_data8(uint32_t addr, uint32_t data)
 {
        addr &= 0xffff;
 #ifdef _MAP1010
@@ -71,7 +73,7 @@ void PHC25_MEMORY::write_data8(uint32_t addr, uint32_t data)
        wbank[addr >> 11][addr & 0x7ff] = data;
 }
 
-uint32_t PHC25_MEMORY::read_data8(uint32_t addr)
+uint32_t MEMORY::read_data8(uint32_t addr)
 {
        addr &= 0xffff;
 #ifdef _MAP1010
@@ -87,7 +89,7 @@ uint32_t PHC25_MEMORY::read_data8(uint32_t addr)
 
 #define STATE_VERSION  1
 
-bool PHC25_MEMORY::process_state(FILEIO* state_fio, bool loading)
+bool MEMORY::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
@@ -99,3 +101,5 @@ bool PHC25_MEMORY::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBuffer(vram, sizeof(vram), 1);
        return true;
 }
+
+}
index 1a51166..1d98ee5 100644 (file)
@@ -15,7 +15,9 @@
 #include "../../emu.h"
 #include "../device.h"
 
-class PHC25_MEMORY : public DEVICE
+namespace PHC25 {
+
+class MEMORY : public DEVICE
 {
 private:
        DEVICE *d_kbd;
@@ -34,11 +36,11 @@ private:
        uint8_t* rbank[32];
        
 public:
-       PHC25_MEMORY(VM_TEMPLATE* 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"));
        }
-       ~PHC25_MEMORY() {}
+       ~MEMORY() {}
        
        // common functions
        void initialize();
@@ -58,5 +60,6 @@ public:
        }
 };
 
+}
 #endif
 
index 0987d12..38ac634 100644 (file)
 #include "./memory.h"
 #include "./system.h"
 
+using PHC25::JOYSTICK;
+using PHC25::KEYBOARD;
+using PHC25::MEMORY;
+using PHC25::SYSTEM;
+
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
@@ -57,8 +62,8 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
        
        joystick = new JOYSTICK(this, emu);
        keyboard = new KEYBOARD(this, emu);
-       memory = new PHC25_MEMORY(this, emu);
-       system = new PHC25_SYSTEM(this, emu);
+       memory = new MEMORY(this, emu);
+       system = new SYSTEM(this, emu);
        // set contexts
        event->set_context_cpu(cpu);
        event->set_context_sound(psg);
index 72f8698..4dc2426 100644 (file)
@@ -69,10 +69,12 @@ class NOT;
 class AY_3_891X;
 class Z80;
 
-class JOYSTICK;
-class KEYBOARD;
-class PHC25_MEMORY;
-class PHC25_SYSTEM;
+namespace PHC25 {
+       class JOYSTICK;
+       class KEYBOARD;
+       class MEMORY;
+       class SYSTEM;
+}
 
 class VM : public VM_TEMPLATE
 {
@@ -91,10 +93,10 @@ protected:
        AY_3_891X* psg;
        Z80* cpu;
        
-       JOYSTICK* joystick;
-       KEYBOARD* keyboard;
-       PHC25_MEMORY* memory;
-       PHC25_SYSTEM* system;
+       PHC25::JOYSTICK* joystick;
+       PHC25::KEYBOARD* keyboard;
+       PHC25::MEMORY* memory;
+       PHC25::SYSTEM* system;
        
 public:
        // ----------------------------------------
index 2a6e473..d024d77 100644 (file)
 #include "../datarec.h"
 #include "../mc6847.h"
 
-void PHC25_SYSTEM::initialize()
+namespace PHC25 {
+       
+void SYSTEM::initialize()
 {
        sysport = 0;
 }
 
-void PHC25_SYSTEM::reset()
+void SYSTEM::reset()
 {
        d_vdp->write_signal(SIG_MC6847_INTEXT, 1, 1);
 }
 
-void PHC25_SYSTEM::write_io8(uint32_t addr, uint32_t data)
+void SYSTEM::write_io8(uint32_t addr, uint32_t data)
 {
        d_drec->write_signal(SIG_DATAREC_MIC, data, 0x01);
        d_drec->write_signal(SIG_DATAREC_REMOTE, ~data, 0x02);
@@ -33,60 +35,19 @@ void PHC25_SYSTEM::write_io8(uint32_t addr, uint32_t data)
        d_vdp->write_signal(SIG_MC6847_AG, data, 0x80);
 }
 
-uint32_t PHC25_SYSTEM::read_io8(uint32_t addr)
+uint32_t SYSTEM::read_io8(uint32_t addr)
 {
        return sysport;
 }
 
-void PHC25_SYSTEM::write_signal(int id, uint32_t data, uint32_t mask)
+void SYSTEM::write_signal(int id, uint32_t data, uint32_t mask)
 {
        sysport = (sysport & ~mask) | (data & mask);
 }
 
 #define STATE_VERSION  1
 
-#include "../../statesub.h"
-
-void PHC25_SYSTEM::decl_state()
-{
-       enter_decl_state(STATE_VERSION);
-
-       DECL_STATE_ENTRY_UINT8(sysport);
-       
-       leave_decl_state();
-}
-
-void PHC25_SYSTEM::save_state(FILEIO* state_fio)
-{
-       if(state_entry != NULL) {
-               state_entry->save_state(state_fio);
-       }
-//     state_fio->FputUint32(STATE_VERSION);
-//     state_fio->FputInt32(this_device_id);
-       
-//     state_fio->FputUint8(sysport);
-}
-
-bool PHC25_SYSTEM::load_state(FILEIO* state_fio)
-{
-       bool mb = false;
-       if(state_entry != NULL) {
-               mb = state_entry->load_state(state_fio);
-       }
-       if(!mb) {
-               return false;
-       }
-//     if(state_fio->FgetUint32() != STATE_VERSION) {
-//             return false;
-//     }
-//     if(state_fio->FgetInt32() != this_device_id) {
-//             return false;
-//     }
-//     sysport = state_fio->FgetUint8();
-       return true;
-}
-
-bool PHC25_SYSTEM::process_state(FILEIO* state_fio, bool loading)
+bool SYSTEM::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
@@ -97,3 +58,5 @@ bool PHC25_SYSTEM::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint8(sysport);
        return true;
 }
+
+}
index bf2cdc5..df14984 100644 (file)
@@ -17,7 +17,9 @@
 
 #define SIG_SYSTEM_PORT        0
 
-class PHC25_SYSTEM : public DEVICE
+namespace PHC25 {
+
+class SYSTEM : public DEVICE
 {
 private:
        DEVICE *d_drec, *d_vdp;
@@ -25,11 +27,11 @@ private:
        uint8_t sysport;
        
 public:
-       PHC25_SYSTEM(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       SYSTEM(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
                set_device_name(_T("System I/O"));
        }
-       ~PHC25_SYSTEM() {}
+       ~SYSTEM() {}
        
        // common functions
        void initialize();
@@ -50,5 +52,6 @@ public:
        }
 };
 
+}
 #endif
 
index 3203148..33e4534 100644 (file)
@@ -11,6 +11,8 @@
 #include "display.h"
 #include "../upd7220.h"
 
+namespace QC10 {
+
 void DISPLAY::initialize()
 {
 #ifdef _COLOR_MONITOR
@@ -307,71 +309,6 @@ void DISPLAY::draw_screen()
 
 #define STATE_VERSION  1
 
-#include "../../statesub.h"
-
-void DISPLAY::decl_state()
-{
-       enter_decl_state(STATE_VERSION);
-
-#ifdef _COLOR_MONITOR
-       DECL_STATE_ENTRY_1D_ARRAY(vram_r, sizeof(vram_r));
-       DECL_STATE_ENTRY_1D_ARRAY(vram_g, sizeof(vram_g));
-       DECL_STATE_ENTRY_1D_ARRAY(vram_b, sizeof(vram_b));
-#else
-       DECL_STATE_ENTRY_1D_ARRAY(vram, sizeof(vram));
-#endif
-       DECL_STATE_ENTRY_UINT8(bank);
-       DECL_STATE_ENTRY_INT32(blink);
-       
-       leave_decl_state();
-}
-
-void DISPLAY::save_state(FILEIO* state_fio)
-{
-       if(state_entry != NULL) {
-               state_entry->save_state(state_fio);
-       }
-//     state_fio->FputUint32(STATE_VERSION);
-//     state_fio->FputInt32(this_device_id);
-       
-//#ifdef _COLOR_MONITOR
-//     state_fio->Fwrite(vram_r, sizeof(vram_r), 1);
-//     state_fio->Fwrite(vram_g, sizeof(vram_g), 1);
-//     state_fio->Fwrite(vram_b, sizeof(vram_b), 1);
-//#else
-//     state_fio->Fwrite(vram, sizeof(vram), 1);
-//#endif
-//     state_fio->FputUint8(bank);
-//     state_fio->FputInt32(blink);
-}
-
-bool DISPLAY::load_state(FILEIO* state_fio)
-{
-       bool mb = false;
-       if(state_entry != NULL) {
-               mb = state_entry->load_state(state_fio);
-       }
-       if(!mb) {
-               return false;
-       }
-//     if(state_fio->FgetUint32() != STATE_VERSION) {
-//             return false;
-//     }
-//     if(state_fio->FgetInt32() != this_device_id) {
-//             return false;
-//     }
-//#ifdef _COLOR_MONITOR
-//     state_fio->Fread(vram_r, sizeof(vram_r), 1);
-//     state_fio->Fread(vram_g, sizeof(vram_g), 1);
-//     state_fio->Fread(vram_b, sizeof(vram_b), 1);
-//#else
-//     state_fio->Fread(vram, sizeof(vram), 1);
-//#endif
-//     bank = state_fio->FgetUint8();
-//     blink = state_fio->FgetInt32();
-       return true;
-}
-
 bool DISPLAY::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
@@ -391,3 +328,5 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateInt32(blink);
        return true;
 }
+
+}
index 3eb965b..576b819 100644 (file)
@@ -18,6 +18,8 @@
 
 class UPD7220;
 
+namespace QC10 {
+
 class DISPLAY : public DEVICE
 {
 private:
@@ -54,9 +56,7 @@ public:
        void write_io8(uint32_t addr, uint32_t data);
        uint32_t read_io8(uint32_t addr);
        void event_frame();
-       void decl_state();
-       void save_state(FILEIO* state_fio);
-       bool load_state(FILEIO* state_fio);
+       bool process_state(FILEIO* state_fio, bool loading);
        
        // unique functions
        void set_context_gdc(UPD7220* device)
@@ -94,5 +94,6 @@ public:
        void draw_screen();
 };
 
+}
 #endif
 
index 1e643a3..ccb7ecb 100644 (file)
 #include "memory.h"
 #include "../upd765a.h"
 
+namespace QC10 {
+
 void FLOPPY::write_io8(uint32_t addr, uint32_t data)
 {
        d_fdc->write_signal(SIG_UPD765A_MOTOR, 1, 1);
        d_mem->write_signal(SIG_MEMORY_MOTOR, 1, 1);
 }
 
+}
index 9944177..5d70b3c 100644 (file)
@@ -14,6 +14,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace QC10 {
+
 class FLOPPY : public DEVICE
 {
 private:
@@ -40,5 +42,6 @@ public:
        }
 };
 
+}
 #endif
 
index 09797d1..920dc1c 100644 (file)
@@ -26,6 +26,8 @@
        SHIFT + F4      -> VK_F24
 */
 
+namespace QC10 {
+
 // pc key code -> qc-10 key code
 static const int key_map[256] = {
        0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00, 0x6d,0x77,0x00,0x00, 0x00,0x4e,0x00,0x00,     // 0
@@ -148,53 +150,6 @@ void KEYBOARD::process_cmd(uint8_t val)
 
 #define STATE_VERSION  1
 
-#include "../../statesub.h"
-
-void KEYBOARD::decl_state()
-{
-       enter_decl_state(STATE_VERSION);
-
-       DECL_STATE_ENTRY_1D_ARRAY(led, sizeof(led) / sizeof(bool));
-       DECL_STATE_ENTRY_BOOL(repeat);
-       DECL_STATE_ENTRY_BOOL(enable);
-       
-       leave_decl_state();
-}
-
-void KEYBOARD::save_state(FILEIO* state_fio)
-{
-       if(state_entry != NULL) {
-               state_entry->save_state(state_fio);
-       }
-//     state_fio->FputUint32(STATE_VERSION);
-//     state_fio->FputInt32(this_device_id);
-       
-//     state_fio->Fwrite(led, sizeof(led), 1);
-//     state_fio->FputBool(repeat);
-//     state_fio->FputBool(enable);
-}
-
-bool KEYBOARD::load_state(FILEIO* state_fio)
-{
-       bool mb = false;
-       if(state_entry != NULL) {
-               mb = state_entry->load_state(state_fio);
-       }
-       if(!mb) {
-               return false;
-       }
-//     if(state_fio->FgetUint32() != STATE_VERSION) {
-//             return false;
-//     }
-//     if(state_fio->FgetInt32() != this_device_id) {
-//             return false;
-//     }
-//     state_fio->Fread(led, sizeof(led), 1);
-//     repeat = state_fio->FgetBool();
-//     enable = state_fio->FgetBool();
-       return true;
-}
-
 bool KEYBOARD::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
@@ -203,8 +158,13 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading)
        if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
-       state_fio->StateBuffer(led, sizeof(led), 1);
+       //state_fio->StateBuffer(led, sizeof(led), 1);
+       for(int i = 0; i < 8; i++) {
+               state_fio->StateBool(led[i]);
+       }
        state_fio->StateBool(repeat);
        state_fio->StateBool(enable);
        return true;
 }
+
+}
index 82fe073..30601b4 100644 (file)
@@ -16,6 +16,8 @@
 
 #define SIG_KEYBOARD_RECV      0
 
+namespace QC10 {
+
 class KEYBOARD : public DEVICE
 {
 private:
@@ -36,9 +38,7 @@ public:
        // common functions
        void initialize();
        void write_signal(int id, uint32_t data, uint32_t mask);
-       void decl_state();
-       void save_state(FILEIO* state_fio);
-       bool load_state(FILEIO* state_fio);
+       bool process_state(FILEIO* state_fio, bool loading);
        
        // unique functions
        void set_context_sio(DEVICE* device)
@@ -49,4 +49,5 @@ public:
        void key_up(int code);
 };
 
+}
 #endif
index 5adab54..05b1912 100644 (file)
@@ -12,7 +12,9 @@
 #include "../pcm1bit.h"
 #include "../upd765a.h"
 
-#define SET_BANK(s, e, w, r) { \
+namespace QC10 {
+
+#define SET_BANK(s, e, w, r) {                 \
        int sb = (s) >> 11, eb = (e) >> 11; \
        for(int i = sb; i <= eb; i++) { \
                wbank[i] = (w) + 0x800 * (i - sb); \
@@ -182,80 +184,6 @@ void MEMORY::update_pcm()
 
 #define STATE_VERSION  1
 
-#include "../../statesub.h"
-
-void MEMORY::decl_state()
-{
-       enter_decl_state(STATE_VERSION);
-
-       DECL_STATE_ENTRY_1D_ARRAY(ram, sizeof(ram));
-       DECL_STATE_ENTRY_1D_ARRAY(cmos, sizeof(cmos));
-       DECL_STATE_ENTRY_UINT32(cmos_crc32);
-       DECL_STATE_ENTRY_UINT8(bank);
-       DECL_STATE_ENTRY_UINT8(psel);
-       DECL_STATE_ENTRY_UINT8(csel);
-       DECL_STATE_ENTRY_BOOL(pcm_on);
-       DECL_STATE_ENTRY_BOOL(pcm_cont);
-       DECL_STATE_ENTRY_BOOL(pcm_pit);
-       DECL_STATE_ENTRY_BOOL(fdc_irq);
-       DECL_STATE_ENTRY_BOOL(motor);
-       
-       leave_decl_state();
-}
-
-void MEMORY::save_state(FILEIO* state_fio)
-{
-       if(state_entry != NULL) {
-               state_entry->save_state(state_fio);
-       }
-//     state_fio->FputUint32(STATE_VERSION);
-//     state_fio->FputInt32(this_device_id);
-       
-//     state_fio->Fwrite(ram, sizeof(ram), 1);
-//     state_fio->Fwrite(cmos, sizeof(cmos), 1);
-//     state_fio->FputUint32(cmos_crc32);
-//     state_fio->FputUint8(bank);
-//     state_fio->FputUint8(psel);
-//     state_fio->FputUint8(csel);
-//     state_fio->FputBool(pcm_on);
-//     state_fio->FputBool(pcm_cont);
-//     state_fio->FputBool(pcm_pit);
-//     state_fio->FputBool(fdc_irq);
-//     state_fio->FputBool(motor);
-}
-
-bool MEMORY::load_state(FILEIO* state_fio)
-{
-       bool mb = false;
-       if(state_entry != NULL) {
-               mb = state_entry->load_state(state_fio);
-       }
-       if(!mb) {
-               return false;
-       }
-//     if(state_fio->FgetUint32() != STATE_VERSION) {
-//             return false;
-//     }
-//     if(state_fio->FgetInt32() != this_device_id) {
-//             return false;
-//     }
-//     state_fio->Fread(ram, sizeof(ram), 1);
-//     state_fio->Fread(cmos, sizeof(cmos), 1);
-//     cmos_crc32 = state_fio->FgetUint32();
-//     bank = state_fio->FgetUint8();
-//     psel = state_fio->FgetUint8();
-//     csel = state_fio->FgetUint8();
-//     pcm_on = state_fio->FgetBool();
-//     pcm_cont = state_fio->FgetBool();
-//     pcm_pit = state_fio->FgetBool();
-//     fdc_irq = state_fio->FgetBool();
-//     motor = state_fio->FgetBool();
-       
-       // post process
-       update_map();
-       return true;
-}
-
 bool MEMORY::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
@@ -282,3 +210,5 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading)
        }
        return true;
 }
+
+}
index f059c66..5a76b82 100644 (file)
@@ -20,6 +20,8 @@
 
 class UPD765A;
 
+namespace QC10 {
+
 class MEMORY : public DEVICE
 {
 private:
@@ -58,9 +60,7 @@ public:
        void write_io8(uint32_t addr, uint32_t data);
        uint32_t read_io8(uint32_t addr);
        void write_signal(int id, uint32_t data, uint32_t mask);
-       void decl_state();
-       void save_state(FILEIO* state_fio);
-       bool load_state(FILEIO* state_fio);
+       bool process_state(FILEIO* state_fio, bool loading);
        
        // unique functions
        void set_context_pit(DEVICE* device)
@@ -77,5 +77,6 @@ public:
        }
 };
 
+}
 #endif
 
index 2477c8a..5591350 100644 (file)
@@ -15,6 +15,8 @@
 #define BIT_ERR        2
 #define BIT_OBF        1
 
+namespace QC10 {
+
 void MFONT::initialize()
 {
        memset(mfont, 0xff, sizeof(mfont));
@@ -94,57 +96,6 @@ uint32_t MFONT::read_io8(uint32_t addr)
 
 #define STATE_VERSION  1
 
-#include "../../statesub.h"
-
-void MFONT::decl_state()
-{
-       enter_decl_state(STATE_VERSION);
-
-       DECL_STATE_ENTRY_UINT8(status);
-       DECL_STATE_ENTRY_FIFO(cmd);
-       DECL_STATE_ENTRY_FIFO(res);
-       
-       leave_decl_state();
-}
-
-void MFONT::save_state(FILEIO* state_fio)
-{
-       if(state_entry != NULL) {
-               state_entry->save_state(state_fio);
-       }
-//     state_fio->FputUint32(STATE_VERSION);
-//     state_fio->FputInt32(this_device_id);
-       
-//     state_fio->FputUint8(status);
-//     cmd->save_state((void *)state_fio);
-//     res->save_state((void *)state_fio);
-}
-
-bool MFONT::load_state(FILEIO* state_fio)
-{
-       bool mb = false;
-       if(state_entry != NULL) {
-               mb = state_entry->load_state(state_fio);
-       }
-       if(!mb) {
-               return false;
-       }
-//     if(state_fio->FgetUint32() != STATE_VERSION) {
-//             return false;
-//     }
-//     if(state_fio->FgetInt32() != this_device_id) {
-//             return false;
-//     }
-//     status = state_fio->FgetUint8();
-//     if(!cmd->load_state((void *)state_fio)) {
-//             return false;
-//     }
-//     if(!res->load_state((void *)state_fio)) {
-//             return false;
-//     }
-       return true;
-}
-
 bool MFONT::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
@@ -162,3 +113,5 @@ bool MFONT::process_state(FILEIO* state_fio, bool loading)
        }
        return true;
 }
+
+}
index 4fe6e4d..69c0633 100644 (file)
@@ -16,6 +16,8 @@
 
 class FIFO;
 
+namespace QC10 {
+
 class MFONT : public DEVICE
 {
 private:
@@ -38,9 +40,7 @@ public:
        void release();
        void write_io8(uint32_t addr, uint32_t data);
        uint32_t read_io8(uint32_t addr);
-       void decl_state();
-       void save_state(FILEIO* state_fio);
-       bool load_state(FILEIO* state_fio);
+       bool process_state(FILEIO* state_fio, bool loading);
        
        // unique function
        void set_context_pic(DEVICE* device)
@@ -49,5 +49,6 @@ public:
        }
 };
 
+}
 #endif
 
index e5bfee6..5de7c58 100644 (file)
 #include "memory.h"
 #include "mfont.h"
 
+using QC10::DISPLAY;
+using QC10::FLOPPY;
+using QC10::KEYBOARD;
+using QC10::MEMORY;
+using QC10::MFONT;
+
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
@@ -174,7 +180,6 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
        for(DEVICE* device = first_device; device; device = device->next_device) {
                device->initialize();
        }
-       decl_state();
        //pcm->set_realtime_render(true);
        for(int i = 0; i < 4; i++) {
                fdc->set_drive_type(i, DRIVE_TYPE_2D);
@@ -345,73 +350,37 @@ void VM::update_config()
 
 #define STATE_VERSION  3
 
-#include "../../statesub.h"
-#include "../../qt/gui/csp_logger.h"
-extern CSP_Logger DLL_PREFIX_I *csp_logger;
-
-void VM::decl_state(void)
-{
-#ifdef _COLOR_MONITOR
-       state_entry = new csp_state_utils(STATE_VERSION, 0, (_TCHAR *)(_T("CSP::QC_10_WITH_COLOR_MONITOR_HEAD")), csp_logger);
-#else
-       state_entry = new csp_state_utils(STATE_VERSION, 0, (_TCHAR *)(_T("CSP::QC_10_HEAD")), csp_logger);
-#endif
-       for(DEVICE* device = first_device; device; device = device->next_device) {
-               device->decl_state();
-       }
-}
-
-void VM::save_state(FILEIO* state_fio)
-{
-       //state_fio->FputUint32(STATE_VERSION);
-       
-       if(state_entry != NULL) {
-               state_entry->save_state(state_fio);
-       }
-       for(DEVICE* device = first_device; device; device = device->next_device) {
-               device->save_state(state_fio);
-       }
-}
-
-bool VM::load_state(FILEIO* state_fio)
-{
-       //if(state_fio->FgetUint32() != STATE_VERSION) {
-       //      return false;
-       //}
-       bool mb = false;
-       if(state_entry != NULL) {
-               mb = state_entry->load_state(state_fio);
-       }
-       if(!mb) {
-               emu->out_debug_log("INFO: HEADER DATA ERROR");
-               return false;
-       }
-       for(DEVICE* device = first_device; device; device = device->next_device) {
-               if(!device->load_state(state_fio)) {
-                       return false;
-               }
-       }
-       return true;
-}
-
 bool VM::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
        }
-       for(DEVICE* device = first_device; device; device = device->next_device) {
-               const char *name = typeid(*device).name() + 6; // skip "class "
+       for(DEVICE* device = first_device; device; device = device->next_device) {
+               // Note: typeid(foo).name is fixed by recent ABI.Not dec 6.
+               // const char *name = typeid(*device).name();
+               //       But, using get_device_name() instead of typeid(foo).name() 20181008 K.O
+               const char *name = device->get_device_name();
                int len = strlen(name);
                
                if(!state_fio->StateCheckInt32(len)) {
+                       if(loading) {
+                               printf("Class name len Error: DEVID=%d EXPECT=%s\n", device->this_device_id, name);
+                       }
                        return false;
                }
                if(!state_fio->StateCheckBuffer(name, len, 1)) {
-                       return false;
-               }
+                       if(loading) {
+                               printf("Class name Error: DEVID=%d EXPECT=%s\n", device->this_device_id, name);
+                       }
+                       return false;
+               }
                if(!device->process_state(state_fio, loading)) {
-                       return false;
-               }
-       }
+                       if(loading) {
+                               printf("Data loading Error: DEVID=%d\n", device->this_device_id);
+                       }
+                       return false;
+               }
+       }
+       // Machine specified.
        return true;
 }
index 89e7ae9..5a821a4 100644 (file)
@@ -65,8 +65,6 @@ static const _TCHAR *sound_device_caption[] = {
 };
 #endif
 
-class csp_state_utils;
-
 class EMU;
 class DEVICE;
 class EVENT;
@@ -83,12 +81,14 @@ class UPD765A;
 class Z80;
 class Z80SIO;
 
-class DISPLAY;
-class FLOPPY;
-class KEYBOARD;
-class MEMORY;
-class MFONT;
-
+namespace QC10 {
+       class DISPLAY;
+       class FLOPPY;
+       class KEYBOARD;
+       class MEMORY;
+       class MFONT;
+}
+       
 class VM : public VM_TEMPLATE
 {
 protected:
@@ -112,11 +112,11 @@ protected:
        Z80* cpu;
        Z80SIO* sio;
        
-       DISPLAY* display;
-       FLOPPY* floppy;
-       KEYBOARD* keyboard;
-       MEMORY* memory;
-       MFONT* mfont;
+       QC10::DISPLAY* display;
+       QC10::FLOPPY* floppy;
+       QC10::KEYBOARD* keyboard;
+       QC10::MEMORY* memory;
+       QC10::MFONT* mfont;
        
 public:
        // ----------------------------------------
@@ -165,9 +165,7 @@ public:
        bool is_frame_skippable();
        
        void update_config();
-       void decl_state();
-       void save_state(FILEIO* state_fio);
-       bool load_state(FILEIO* state_fio);
+       bool process_state(FILEIO* state_fio, bool loading);
        
        // ----------------------------------------
        // for each device
index 8da4c86..aa58cb0 100644 (file)
@@ -17,6 +17,8 @@
 
 #define EVENT_PULSE    0
 
+namespace TK80 {
+       
 void CMT::initialize()
 {
        mic = ear = pulse = false;
@@ -142,108 +144,6 @@ void CMT::release_tape()
 
 #define STATE_VERSION  2
 
-#include "../../statesub.h"
-
-void CMT::decl_state()
-{
-       enter_decl_state(STATE_VERSION);
-       
-       DECL_STATE_ENTRY_BOOL(mic);
-       DECL_STATE_ENTRY_BOOL(ear);
-       DECL_STATE_ENTRY_BOOL(pulse);
-       DECL_STATE_ENTRY_INT32(pulse_count);
-#if defined(_TK80BS)
-       DECL_STATE_ENTRY_BOOL(play);
-       DECL_STATE_ENTRY_BOOL(rec);
-       DECL_STATE_ENTRY_STRING(rec_file_path, sizeof(rec_file_path) / sizeof(_TCHAR));
-
-       DECL_STATE_ENTRY_CMT_RECORDING(fio, rec, rec_file_path);
-
-       DECL_STATE_ENTRY_INT32(bufcnt);
-       DECL_STATE_ENTRY_1D_ARRAY(buffer, sizeof(buffer));
-#endif
-       leave_decl_state();
-}
-
-void CMT::save_state(FILEIO* state_fio)
-{
-       if(state_entry != NULL) {
-               state_entry->save_state(state_fio);
-       }
-//     state_fio->FputUint32(STATE_VERSION);
-//     state_fio->FputInt32(this_device_id);
-       
-//     state_fio->FputBool(mic);
-//     state_fio->FputBool(ear);
-//     state_fio->FputBool(pulse);
-//     state_fio->FputInt32(pulse_count);
-#if defined(_TK80BS)
-//     state_fio->FputBool(play);
-//     state_fio->FputBool(rec);
-//     state_fio->Fwrite(rec_file_path, sizeof(rec_file_path), 1);
-//     if(rec && fio->IsOpened()) {
-//             int length_tmp = (int)fio->Ftell();
-//             fio->Fseek(0, FILEIO_SEEK_SET);
-//             state_fio->FputInt32(length_tmp);
-//             while(length_tmp != 0) {
-//                     uint8_t buffer_tmp[1024];
-//                     int length_rw = min(length_tmp, (int)sizeof(buffer_tmp));
-//                     fio->Fread(buffer_tmp, length_rw, 1);
-//                     state_fio->Fwrite(buffer_tmp, length_rw, 1);
-//                     length_tmp -= length_rw;
-//             }
-//     } else {
-//             state_fio->FputInt32(0);
-//     }
-//     state_fio->FputInt32(bufcnt);
-//     state_fio->Fwrite(buffer, sizeof(buffer), 1);
-#endif
-}
-
-bool CMT::load_state(FILEIO* state_fio)
-{
-       release_tape();
-       
-       bool mb = false;
-       if(state_entry != NULL) {
-               mb = state_entry->load_state(state_fio);
-       }
-       if(!mb) {
-               return false;
-       }
-//     if(state_fio->FgetUint32() != STATE_VERSION) {
-//             return false;
-//     }
-//     if(state_fio->FgetInt32() != this_device_id) {
-//             return false;
-//     }
-//     mic = state_fio->FgetBool();
-//     ear = state_fio->FgetBool();
-//     pulse = state_fio->FgetBool();
-//     pulse_count = state_fio->FgetInt32();
-//#if defined(_TK80BS)
-//     play = state_fio->FgetBool();
-//     rec = state_fio->FgetBool();
-//     state_fio->Fread(rec_file_path, sizeof(rec_file_path), 1);
-//     int length_tmp = state_fio->FgetInt32();
-//     if(rec) {
-//             fio->Fopen(rec_file_path, FILEIO_READ_WRITE_NEW_BINARY);
-//             while(length_tmp != 0) {
-//                     uint8_t buffer_tmp[1024];
-//                     int length_rw = min(length_tmp, (int)sizeof(buffer_tmp));
-//                     state_fio->Fread(buffer_tmp, length_rw, 1);
-//                     if(fio->IsOpened()) {
-//                             fio->Fwrite(buffer_tmp, length_rw, 1);
-//                     }
-//                     length_tmp -= length_rw;
-//             }
-//     }
-//     bufcnt = state_fio->FgetInt32();
-//     state_fio->Fread(buffer, sizeof(buffer), 1);
-//#endif
-       return true;
-}
-
 bool CMT::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
@@ -295,3 +195,5 @@ bool CMT::process_state(FILEIO* state_fio, bool loading)
 #endif
        return true;
 }
+
+}
index 7e26cfc..c772edf 100644 (file)
@@ -24,6 +24,8 @@
 // max 256kbytes
 #define BUFFER_SIZE    0x40000
 
+namespace TK80 {
+
 class CMT : public DEVICE
 {
 private:
@@ -61,9 +63,7 @@ public:
 #endif
        void write_signal(int id, uint32_t data, uint32_t mask);
        void event_callback(int event_id, int err);
-       void decl_state();
-       void save_state(FILEIO* state_fio);
-       bool load_state(FILEIO* state_fio);
+       bool process_state(FILEIO* state_fio, bool loading);
        
        // unique functions
        void set_context_drec(DEVICE* device)
@@ -101,5 +101,6 @@ public:
 #endif
 };
 
+}
 #endif
 
index c54379e..28a4d7b 100644 (file)
@@ -11,6 +11,8 @@
 
 #include "display.h"
 
+namespace TK80 {
+
 static const int led_pattern[LED_SIZE_Y][LED_SIZE_X] = {
 #if defined(_TK80BS) || defined(_TK80)
        {9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9},
@@ -210,56 +212,6 @@ void DISPLAY::draw_screen()
 
 #define STATE_VERSION  1
 
-#include "../../statesub.h"
-
-void DISPLAY::decl_state()
-{
-       enter_decl_state(STATE_VERSION);
-
-#if defined(_TK80BS)
-       DECL_STATE_ENTRY_INT32(mode);
-#endif
-       DECL_STATE_ENTRY_BOOL(dma);
-       
-       leave_decl_state();
-}
-
-void DISPLAY::save_state(FILEIO* state_fio)
-{
-       if(state_entry != NULL) {
-               state_entry->save_state(state_fio);
-       }
-//     state_fio->FputUint32(STATE_VERSION);
-//     state_fio->FputInt32(this_device_id);
-//     
-//#if defined(_TK80BS)
-//     state_fio->FputInt32(mode);
-//#endif
-//     state_fio->FputBool(dma);
-}
-
-bool DISPLAY::load_state(FILEIO* state_fio)
-{
-       bool mb = false;
-       if(state_entry != NULL) {
-               mb = state_entry->load_state(state_fio);
-       }
-       if(!mb) {
-               return false;
-       }
-//     if(state_fio->FgetUint32() != STATE_VERSION) {
-//             return false;
-//     }
-//     if(state_fio->FgetInt32() != this_device_id) {
-//             return false;
-//     }
-//#if defined(_TK80BS)
-//     mode = state_fio->FgetInt32();
-//#endif
-//     dma = state_fio->FgetBool();
-       return true;
-}
-
 bool DISPLAY::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
@@ -274,3 +226,5 @@ bool DISPLAY::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBool(dma);
        return true;
 }
+
+}
index d9822ae..9262e5d 100644 (file)
@@ -19,6 +19,8 @@
 #define SIG_DISPLAY_MODE       0
 #define SIG_DISPLAY_DMA                1
 
+namespace TK80 {
+
 class DISPLAY : public DEVICE
 {
 private:
@@ -40,9 +42,7 @@ public:
        // common functions
        void initialize();
        void write_signal(int id, uint32_t data, uint32_t mask);
-       void decl_state();
-       void save_state(FILEIO* state_fio);
-       bool load_state(FILEIO* state_fio);
+       bool process_state(FILEIO* state_fio, bool loading);
        
        // unique functions
 #if defined(_TK80BS)
@@ -58,5 +58,6 @@ public:
        void draw_screen();
 };
 
+}
 #endif
 
index 69ae962..b2ac7f8 100644 (file)
@@ -12,6 +12,8 @@
 #include "keyboard.h"
 #include "../i8255.h"
 
+namespace TK80 {
+
 #if defined(_TK80BS)
 static const uint8_t matrix[256] = {
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,
@@ -283,68 +285,6 @@ void KEYBOARD::update_tk80()
 
 #define STATE_VERSION  2
 
-#include "../../statesub.h"
-
-void KEYBOARD::decl_state()
-{
-       enter_decl_state(STATE_VERSION);
-
-#if defined(_TK80BS)
-       DECL_STATE_ENTRY_UINT8(prev_type);
-       DECL_STATE_ENTRY_UINT8(prev_brk);
-       DECL_STATE_ENTRY_UINT8(prev_kana);
-       DECL_STATE_ENTRY_BOOL(kana_lock);
-       DECL_STATE_ENTRY_UINT32(kb_type);
-#endif
-       DECL_STATE_ENTRY_UINT32(column);
-       
-       leave_decl_state();
-}
-
-void KEYBOARD::save_state(FILEIO* state_fio)
-{
-       if(state_entry != NULL) {
-               state_entry->save_state(state_fio);
-       }
-//     state_fio->FputUint32(STATE_VERSION);
-//     state_fio->FputInt32(this_device_id);
-       
-//#if defined(_TK80BS)
-//     state_fio->FputUint8(prev_type);
-//     state_fio->FputUint8(prev_brk);
-//     state_fio->FputUint8(prev_kana);
-//     state_fio->FputBool(kana_lock);
-//     state_fio->FputUint32(kb_type);
-//#endif
-//     state_fio->FputUint32(column);
-}
-
-bool KEYBOARD::load_state(FILEIO* state_fio)
-{
-       bool mb = false;
-       if(state_entry != NULL) {
-               mb = state_entry->load_state(state_fio);
-       }
-       if(!mb) {
-               return false;
-       }
-//     if(state_fio->FgetUint32() != STATE_VERSION) {
-//             return false;
-//     }
-//     if(state_fio->FgetInt32() != this_device_id) {
-//             return false;
-//     }
-//#if defined(_TK80BS)
-//     prev_type = state_fio->FgetUint8();
-//     prev_brk = state_fio->FgetUint8();
-//     prev_kana = state_fio->FgetUint8();
-//     kana_lock = state_fio->FgetBool();
-//     kb_type = state_fio->FgetUint32();
-//#endif
-//     column = state_fio->FgetUint32();
-       return true;
-}
-
 bool KEYBOARD::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
@@ -363,3 +303,5 @@ bool KEYBOARD::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateUint32(column);
        return true;
 }
+
+}
index bb33046..d2fcf06 100644 (file)
@@ -18,6 +18,8 @@
 
 #define SIG_KEYBOARD_COLUMN    0
 
+namespace TK80 {
+
 class KEYBOARD : public DEVICE
 {
 private:
@@ -54,9 +56,7 @@ public:
                return kb_type & 3;
        }
 #endif
-       void decl_state();
-       void save_state(FILEIO* state_fio);
-       bool load_state(FILEIO* state_fio);
+       bool process_state(FILEIO* state_fio, bool loading);
        
        // unique functions
 #if defined(_TK80BS)
@@ -90,5 +90,6 @@ public:
        }
 };
 
+}
 #endif
 
index 3aecc1b..08d4726 100644 (file)
@@ -12,6 +12,8 @@
 #include "membus.h"
 #include "../i8080.h"
 
+namespace TK80 {
+
 void MEMBUS::reset()
 {
 #if defined(_TK85)
@@ -51,47 +53,6 @@ void MEMBUS::write_signal(int id, uint32_t data, uint32_t mask)
 
 #define STATE_VERSION  1
 
-#include "../../statesub.h"
-
-void MEMBUS::decl_state()
-{
-       enter_decl_state(STATE_VERSION);
-
-#if defined(_TK85)
-       DECL_STATE_ENTRY_UINT32(pc7);
-       DECL_STATE_ENTRY_UINT32(count);
-#endif
-       MEMORY::decl_state();
-       
-       leave_decl_state();
-}
-
-void MEMBUS::save_state(FILEIO* state_fio)
-{
-//     state_fio->FputUint32(STATE_VERSION);
-//     state_fio->FputInt32(this_device_id);
-       
-//#if defined(_TK85)
-//     state_fio->FputUint32(pc7);
-//     state_fio->FputUint32(count);
-//#endif
-       MEMORY::save_state(state_fio);
-}
-
-bool MEMBUS::load_state(FILEIO* state_fio)
-{
-//     if(state_fio->FgetUint32() != STATE_VERSION) {
-//             return false;
-//     }
-//     if(state_fio->FgetInt32() != this_device_id) {
-//             return false;
-//     }
-//#if defined(_TK85)
-//     pc7 = state_fio->FgetUint32();
-//     count = state_fio->FgetUint32();
-//#endif
-       return MEMORY::load_state(state_fio);
-}
 bool MEMBUS::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
@@ -106,3 +67,5 @@ bool MEMBUS::process_state(FILEIO* state_fio, bool loading)
 #endif
        return MEMORY::process_state(state_fio, loading);
 }
+
+}
index 98465c1..8bf0edb 100644 (file)
 #endif
 
 //class csp_state_utils;
+namespace TK80 {
 
 class MEMBUS : public MEMORY
 {
 private:
        DEVICE *d_cpu;
 
-//     csp_state_utils *state_entry;
-
 #if defined(_TK85)
        uint32_t pc7, count;
 #endif
@@ -44,9 +43,7 @@ public:
 #if defined(_TK85)
        void write_signal(int id, uint32_t data, uint32_t mask);
 #endif
-       void decl_state();
-       void save_state(FILEIO* state_fio);
-       bool load_state(FILEIO* state_fio);
+       bool process_state(FILEIO* state_fio, bool loading);
        
        // unique function
        void set_context_cpu(DEVICE* device)
@@ -55,4 +52,6 @@ public:
        }
 };
 
+}
+
 #endif
index 63c6c17..1b8f0b8 100644 (file)
 // AUTO/STEP\83X\83C\83b\83`\82Ì\82½\82ß\82É\8eÀ\91\95\92\86\82Ì\83\\81[\83X
 // \8eÀ\8dÛ\82É\8eg\97p\82·\82é\82©\82Í\96¢\92è
 
-#include "memory.h"
+#include "./memory.h"
 #include "../i8080.h"
 
+namespace TK80 {
+
 #define SET_BANK(s, e, w, r) { \
        int sb = (s) >> 9, eb = (e) >> 9; \
        for(int i = sb; i <= eb; i++) { \
@@ -161,47 +163,6 @@ void MEMORY::save_binary(const _TCHAR* file_path)
 
 #define STATE_VERSION  1
 
-void MEMORY::decl_state(FILEIO* state_fio)
-{
-       // enter_decl_state(STATE_VERSION);
-
-       DECL_STATE_ENTRY_1D_ARRAY(ram, sizeof(ram));
-       DECL_STATE_ENTRY_1D_ARRAY(vram, sizeof(vram));
-       // leave_decl_state();
-}
-
-void MEMORY::save_state(FILEIO* state_fio)
-{
-       if(state_entry != NULL) {
-               state_entry->save_state(state_fio);
-       }
-//     state_fio->FputUint32(STATE_VERSION);
-//     state_fio->FputInt32(this_device_id);
-       
-//     state_fio->Fwrite(ram, sizeof(ram), 1);
-//     state_fio->Fwrite(vram, sizeof(vram), 1);
-}
-
-bool MEMORY::load_state(FILEIO* state_fio)
-{
-       bool mb = false;
-       if(state_entry != NULL) {
-               mb = state_entry->load_state(state_fio);
-       }
-       if(!mb) {
-               return false;
-       }
-//     if(state_fio->FgetUint32() != STATE_VERSION) {
-//             return false;
-//     }
-//     if(state_fio->FgetInt32() != this_device_id) {
-//             return false;
-//     }
-//     state_fio->Fread(ram, sizeof(ram), 1);
-//     state_fio->Fread(vram, sizeof(vram), 1);
-       return true;
-}
-
 bool MEMORY::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
@@ -214,3 +175,5 @@ bool MEMORY::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateBuffer(vram, sizeof(vram), 1);
        return true;
 }
+
+}
index 69d0563..1ce2f86 100644 (file)
@@ -14,6 +14,8 @@
 #include "../../emu.h"
 #include "../device.h"
 
+namespace TK80 {
+
 class MEMORY : public DEVICE
 {
 private:
@@ -46,9 +48,7 @@ public:
        void write_data8(uint32_t addr, uint32_t data);
        uint32_t read_data8(uint32_t addr);
        uint32_t fetch_op(uint32_t addr, int *wait);
-       virtual void decl_state();
-       virtual void save_state(FILEIO* state_fio);
-       virtual bool load_state(FILEIO* state_fio);
+       virtual bool process_state(FILEIO* state_fio, bool loading);
        
        // unique functions
        void set_context_cpu(DEVICE* device)
@@ -71,5 +71,6 @@ public:
        void save_binary(const _TCHAR* file_path);
 };
 
+}
 #endif
 
index 5773ba0..185b7e7 100644 (file)
 #include "keyboard.h"
 #include "membus.h"
 
+#if defined(_TK80BS) || defined(_TK80)
+using TK80::CMT;
+#endif
+using TK80::DISPLAY;
+using TK80::KEYBOARD;
+using TK80::MEMBUS;
+
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
@@ -208,7 +215,6 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
        for(DEVICE* device = first_device; device; device = device->next_device) {
                device->initialize();
        }
-       decl_state();
 }
 
 VM::~VM()
@@ -547,100 +553,38 @@ void VM::update_config()
 
 #define STATE_VERSION  6
 
-#include "../../statesub.h"
-#include "../../qt/gui/csp_logger.h"
-extern CSP_Logger DLL_PREFIX_I *csp_logger;
-
-void VM::decl_state(void)
-{
-#if defined(_TK80)
-       state_entry = new csp_state_utils(STATE_VERSION, 0, (_TCHAR *)(_T("CSP::TK_80_HEAD")), csp_logger);
-#elif defined(_TK85)
-       state_entry = new csp_state_utils(STATE_VERSION, 0, (_TCHAR *)(_T("CSP::TK_85_HEAD")), csp_logger);
-#elif defined(_TK80BS)
-       state_entry = new csp_state_utils(STATE_VERSION, 0, (_TCHAR *)(_T("CSP::TK_80BS_HEAD")), csp_logger);
-#else
-       state_entry = new csp_state_utils(STATE_VERSION, 0, (_TCHAR *)(_T("CSP::TK_80_SERIES_HEAD")), csp_logger);
-#endif
-       DECL_STATE_ENTRY_1D_ARRAY(ram, sizeof(ram));
-#if defined(_TK80BS)
-       DECL_STATE_ENTRY_1D_ARRAY(vram, sizeof(vram));
-       DECL_STATE_ENTRY_INT32(boot_mode);
-       //DECL_STATE_ENTRY_INT32(draw_ranges);
-#endif
-       for(DEVICE* device = first_device; device; device = device->next_device) {
-               device->decl_state();
-       }
-}
-
-void VM::save_state(FILEIO* state_fio)
-{
-       //state_fio->FputUint32(STATE_VERSION);
-       
-       if(state_entry != NULL) {
-               state_entry->save_state(state_fio);
-       }
-       for(DEVICE* device = first_device; device; device = device->next_device) {
-               device->save_state(state_fio);
-       }
-//     state_fio->Fwrite(ram, sizeof(ram), 1);
-//#if defined(_TK80BS)
-//     state_fio->Fwrite(vram, sizeof(vram), 1);
-//     state_fio->FputInt32(boot_mode);
-////   state_fio->FputInt32(draw_ranges);
-//#endif
-}
-
-bool VM::load_state(FILEIO* state_fio)
-{
-       //if(state_fio->FgetUint32() != STATE_VERSION) {
-       //      return false;
-       //}
-       bool mb = false;
-       if(state_entry != NULL) {
-               mb = state_entry->load_state(state_fio);
-       }
-       if(!mb) {
-               emu->out_debug_log("INFO: HEADER DATA ERROR");
-               return false;
-       }
-       for(DEVICE* device = first_device; device; device = device->next_device) {
-               if(!device->load_state(state_fio)) {
-                       return false;
-               }
-       }
-//     state_fio->Fread(ram, sizeof(ram), 1);
-#if defined(_TK80BS)
-//     state_fio->Fread(vram, sizeof(vram), 1);
-//     boot_mode = state_fio->FgetInt32();
-////   draw_ranges = state_fio->FgetInt32();
-       
-       // post process
-       emu->reload_bitmap();
-       draw_ranges = 8;
-#endif
-       return true;
-}
-
 bool VM::process_state(FILEIO* state_fio, bool loading)
 {
        if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
        }
-       for(DEVICE* device = first_device; device; device = device->next_device) {
-               const char *name = typeid(*device).name() + 6; // skip "class "
+       for(DEVICE* device = first_device; device; device = device->next_device) {
+               // Note: typeid(foo).name is fixed by recent ABI.Not dec 6.
+               // const char *name = typeid(*device).name();
+               //       But, using get_device_name() instead of typeid(foo).name() 20181008 K.O
+               const char *name = device->get_device_name();
                int len = strlen(name);
                
                if(!state_fio->StateCheckInt32(len)) {
+                       if(loading) {
+                               printf("Class name len Error: DEVID=%d EXPECT=%s\n", device->this_device_id, name);
+                       }
                        return false;
                }
                if(!state_fio->StateCheckBuffer(name, len, 1)) {
-                       return false;
-               }
+                       if(loading) {
+                               printf("Class name Error: DEVID=%d EXPECT=%s\n", device->this_device_id, name);
+                       }
+                       return false;
+               }
                if(!device->process_state(state_fio, loading)) {
-                       return false;
-               }
-       }
+                       if(loading) {
+                               printf("Data loading Error: DEVID=%d\n", device->this_device_id);
+                       }
+                       return false;
+               }
+       }
+       // Machine specified.
        state_fio->StateBuffer(ram, sizeof(ram), 1);
 #if defined(_TK80BS)
        state_fio->StateBuffer(vram, sizeof(vram), 1);
index c4b5a6d..ac2e399 100644 (file)
@@ -182,8 +182,6 @@ const struct {
 #endif
 };
 
-class csp_state_utils;
-
 class EMU;
 class DEVICE;
 class EVENT;
@@ -195,21 +193,22 @@ class I8251;
 class IO;
 #endif
 class I8255;
-//class MEMORY;
 class PCM1BIT;
 
+namespace TK80 {
 #if defined(_TK80BS)
-class CMT;
+       class CMT;
 #endif
-class DISPLAY;
-class KEYBOARD;
-class MEMBUS;
+       //class MEMORY;
+       class DISPLAY;
+       class KEYBOARD;
+       class MEMBUS;
+}
 
 class VM : public VM_TEMPLATE
 {
 protected:
        //EMU* emu;
-       //csp_state_utils* state_entry;
        
        // devices
        //EVENT* event;
@@ -222,16 +221,16 @@ protected:
        IO* memio;
 #endif
        I8255* pio_t;
-//     MEMORY* memory;
+//     TK80::MEMORY* memory;
        PCM1BIT* pcm0;
        PCM1BIT* pcm1;
        
 #if defined(_TK80BS)
-       CMT* cmt;
+       TK80::CMT* cmt;
 #endif
-       DISPLAY* display;
-       KEYBOARD* keyboard;
-       MEMBUS* memory;
+       TK80::DISPLAY* display;
+       TK80::KEYBOARD* keyboard;
+       TK80::MEMBUS* memory;
        
        // memory
        uint8_t mon[0x800];
@@ -306,9 +305,7 @@ public:
        bool is_frame_skippable();
        
        void update_config();
-       void decl_state();
-       void save_state(FILEIO* state_fio);
-       bool load_state(FILEIO* state_fio);
+       bool process_state(FILEIO* state_fio, bool loading);
        
        // ----------------------------------------
        // for each device
index 9378e3a..a0ba139 100644 (file)
@@ -64,6 +64,7 @@
 #if defined(Q_OS_WIN)
 DLL_PREFIX_I struct cur_time_s cur_time;
 #endif
+
 using X1::DISPLAY;
 using X1::EMM;
 using X1::FLOPPY;
@@ -75,7 +76,9 @@ using X1::PSUB;
 using X1::SASI;
 using X1::SUB;
 using X1::KEYBOARD;
-
+#ifdef _X1TWIN
+using PCEDEV::PCE;
+#endif
 // ----------------------------------------------------------------------------
 // initialize
 // ----------------------------------------------------------------------------
index 549335c..fd45dcf 100644 (file)
@@ -293,7 +293,9 @@ namespace X1 {
 
 #ifdef _X1TWIN
 class HUC6280;
-class PCE;
+namespace PCEDEV {
+       class PCE;
+}
 #define USE_CPU_HUC6280
 #endif
 class VM : public VM_TEMPLATE
@@ -350,7 +352,7 @@ protected:
        EVENT* pceevent;
        
        HUC6280* pcecpu;
-       PCE* pce;
+       PCEDEV::PCE* pce;
 #endif
        
 public: