OSDN Git Service

[VM] Add PC-8001/mk2/8801/mk2.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Sat, 12 Jan 2019 15:48:36 +0000 (00:48 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Sat, 12 Jan 2019 15:48:36 +0000 (00:48 +0900)
[General] Merge upstream 2019-01-11.

25 files changed:
source/build-cmake/cmake/config_pc8801.cmake
source/build-cmake/cmake/toolchain_mingw_cross_linux.cmake
source/build-cmake/pc8001/CMakeLists.txt [new file with mode: 0644]
source/build-cmake/pc8001mk2/CMakeLists.txt [new file with mode: 0644]
source/build-cmake/pc8001sr/CMakeLists.txt
source/build-cmake/pc8801/CMakeLists.txt [new file with mode: 0644]
source/build-cmake/pc8801mk2/CMakeLists.txt [new file with mode: 0644]
source/src/res/fm7.rc
source/src/res/fm77.rc
source/src/res/fm77av.rc
source/src/res/fm77av40.rc
source/src/res/fm77av40ex.rc
source/src/res/fm8.rc
source/src/res/icon.txt
source/src/res/pc8001.rc [new file with mode: 0644]
source/src/res/pc8001mk2.ico [new file with mode: 0644]
source/src/res/pc8001mk2.rc [new file with mode: 0644]
source/src/res/pc8001mk2sr.rc
source/src/res/pc8801.rc [new file with mode: 0644]
source/src/res/pc8801mk2.ico [new file with mode: 0644]
source/src/res/pc8801mk2.rc [new file with mode: 0644]
source/src/vm/pc8801/pc88.cpp
source/src/vm/pc8801/pc88.h
source/src/vm/pc8801/pc8801.cpp
source/src/vm/pc8801/pc8801.h

index 767a811..bd02c3b 100644 (file)
@@ -23,7 +23,6 @@ set(VMFILES_LIB
                pcm1bit.cpp
                upd1990a.cpp
                upd765a.cpp
-               ym2203.cpp
                z80ctc.cpp
                z80dma.cpp
                z80pio.cpp
@@ -36,10 +35,13 @@ set(FLAG_USE_Z80 ON)
 
 set(BUILD_SHARED_LIBS OFF)
 
+set(BUILD_PC8001 OFF CACHE BOOL "Build for PC8001")
+set(BUILD_PC8001MK2 OFF CACHE BOOL "Build for PC8001 mk2")
 set(BUILD_PC8001SR OFF CACHE BOOL "Build for PC8001SR")
+set(BUILD_PC8801 OFF CACHE BOOL "Build with PC8801")
+set(BUILD_PC8801MK2 OFF CACHE BOOL "Build with PC8801 mk2")
 set(BUILD_PC8801MA OFF CACHE BOOL "Build with PC8801MA")
-set(USE_OPNA ON CACHE BOOL "Use OPNA sound with PC8801MA")
-set(USE_SOUNDBOARD2 ON CACHE BOOL "Use Sound Board sound with PC8801MA")
+
 set(USE_PCG  ON CACHE BOOL "Use PCG8100")
 set(PC88_EXTRAM_PAGES  "4" CACHE STRING "Set banks of EXTRAM of PC8801, bank = 32Kbytes")
 set(USE_OPENMP ON CACHE BOOL "Build using OpenMP")
@@ -53,19 +55,47 @@ set(CMAKE_SYSTEM_PROCESSOR ${ARCHITECTURE} CACHE STRING "Set processor to build.
 
 add_definitions(-D_CONFIGURE_WITH_CMAKE)
 
-
-
-if(BUILD_PC8001SR)
+if(BUILD_PC8001)
+  set(EXEC_TARGET emupc8001)
+  add_definitions(-D_PC8001)
+  set(RESOURCE ${CMAKE_SOURCE_DIR}/../../src/qt/common/qrc/pc8001.qrc)
+  
+elseif(BUILD_PC8001MK2)
+  set(EXEC_TARGET emupc8001mk2)
+  add_definitions(-D_PC8001MK2)
+  set(RESOURCE ${CMAKE_SOURCE_DIR}/../../src/qt/common/qrc/pc8001mk2.qrc)
+  set(VMFILES_LIB ${VMFILES_LIB}
+               ym2203.cpp
+  )      
+  
+elseif(BUILD_PC8001SR)
   set(EXEC_TARGET emupc8001sr)
   add_definitions(-D_PC8001SR)
   set(RESOURCE ${CMAKE_SOURCE_DIR}/../../src/qt/common/qrc/pc8001mk2sr.qrc)
+  set(VMFILES_LIB ${VMFILES_LIB}
+               ym2203.cpp
+  )      
+  
+elseif(BUILD_PC8801)
+  set(EXEC_TARGET emupc8801)
+  add_definitions(-D_PC8801)
+  set(RESOURCE ${CMAKE_SOURCE_DIR}/../../src/qt/common/qrc/pc8801.qrc)
+
+elseif(BUILD_PC8801MK2)
+  set(EXEC_TARGET emupc8801mk2)
+  add_definitions(-D_PC8801MK2)
+  set(RESOURCE ${CMAKE_SOURCE_DIR}/../../src/qt/common/qrc/pc8801mk2.qrc)
+  set(VMFILES_LIB ${VMFILES_LIB}
+               ym2203.cpp
+  )      
   
 elseif(BUILD_PC8801MA)
   set(EXEC_TARGET emupc8801ma)
   add_definitions(-D_PC8801MA)
   set(RESOURCE ${CMAKE_SOURCE_DIR}/../../src/qt/common/qrc/pc8801ma.qrc)
   set(VMFILES_LIB ${VMFILES_LIB}
-            ym2151.cpp
+               ym2203.cpp
+        ym2151.cpp
   )      
   set(VMFILES ${VMFILES}
             scsi_dev.cpp scsi_cdrom.cpp scsi_host.cpp
@@ -81,13 +111,4 @@ if(USE_PCG)
   add_definitions(-DSUPPORT_PC88_PCG8100)
 endif()
 
-if(USE_SOUNDBOARD2)
-  add_definitions(-DSUPPORT_PC88_SB2)
-  add_definitions(-DSUPPORT_PC88_OPNA)
-else()  
- if(USE_OPNA)
-    add_definitions(-DSUPPORT_PC88_OPNA)
- endif()
-endif() 
-
 include(config_commonsource)
index 2ab6425..afa3d81 100644 (file)
@@ -9,14 +9,14 @@ SET(CMAKE_AR  i686-w64-mingw32-gcc-ar)
 
 #set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
 #set(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++")
-set(CMAKE_EXE_LINKER_FLAGS "-flto=6 -fwhole-program")
+#set(CMAKE_EXE_LINKER_FLAGS "-flto=12 -fwhole-program")
 
 #SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> --plugin==$(i686-w64-mingw32-gcc --print-file-name=liblto_plugin.so) <LINK_FLAGS> <OBJECTS>")
 #SET(CMAKE_C_ARCHIVE_FINISH   true)
 #SET(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> --plugin==$(i686-w64-mingw32-gcc --print-file-name=liblto_plugin.so) <LINK_FLAGS> <OBJECTS>")
 #SET(CMAKE_CXX_ARCHIVE_FINISH   true)
 
-set(LIBAV_ROOT_DIR "/usr/local/i586-mingw-msvc/ffmpeg-4.0")
+set(LIBAV_ROOT_DIR "/usr/local/i586-mingw-msvc/ffmpeg-4.1")
 
 # here is the target environment located
 set(USE_SDL2 ON)
@@ -24,15 +24,13 @@ if(USE_SDL2)
    SET(CMAKE_FIND_ROOT_PATH  /usr/i686-w64-mingw32 
                           /usr/local/i586-mingw-msvc
                           /usr/local/i586-mingw-msvc/SDL/i686-w64-mingw32
-                         /usr/local/i586-mingw-msvc/5.10.1/mingw_73x
-#                        /usr/local/i586-mingw-msvc/devel-libs/usr/i686-w64-mingw32/sys-root/mingw
+                         /usr/local/i586-mingw-msvc/5.12/mingw_82x
                          )
 else()
    SET(CMAKE_FIND_ROOT_PATH  /usr/i686-w64-mingw32 
                           /usr/local/i586-mingw-msvc
                           /usr/local/i586-mingw-msvc/SDL1/
-                         /usr/local/i586-mingw-msvc/5.10.1/mingw_73x
-#                        /usr/local/i586-mingw-msvc/devel-libs/usr/i686-w64-mingw32/sys-root/mingw
+                         /usr/local/i586-mingw-msvc/5.12/mingw_82x
                          )
 endif()
 SET(CSP_CROSS_BUILD 1)
@@ -44,8 +42,6 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
 
-#set(LIBAV_INCLUDE_DIRS /usr/local/i586-mingw-msvc/ffmpeg-3.0/include)
-
 set(SDL2_LIBRARIES
                          /usr/local/i586-mingw-msvc/SDL/i686-w64-mingw32/lib/libSDL2.dll.a 
                         /usr/local/i586-mingw-msvc/SDL/i686-w64-mingw32/lib/libSDL2main.a)
diff --git a/source/build-cmake/pc8001/CMakeLists.txt b/source/build-cmake/pc8001/CMakeLists.txt
new file mode 100644 (file)
index 0000000..50245c7
--- /dev/null
@@ -0,0 +1,18 @@
+# Build Common Sourcecode Project, Agar.
+# (C) 2014 K.Ohta <whatisthis.sowhat@gmail.com>
+# This is part of , but license is apache 2.2,
+# this part was written only me.
+
+cmake_minimum_required (VERSION 2.8)
+cmake_policy(SET CMP0011 NEW)
+
+message("")
+message("** Start of configure CommonSourceProject,PC8001, Qt **")
+message("")
+
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake")
+
+project (emupc8001)
+set(BUILD_PC8001 ON CACHE BOOL "Build for PC8001")
+
+include(config_pc8801)
diff --git a/source/build-cmake/pc8001mk2/CMakeLists.txt b/source/build-cmake/pc8001mk2/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1df3016
--- /dev/null
@@ -0,0 +1,18 @@
+# Build Common Sourcecode Project, Agar.
+# (C) 2014 K.Ohta <whatisthis.sowhat@gmail.com>
+# This is part of , but license is apache 2.2,
+# this part was written only me.
+
+cmake_minimum_required (VERSION 2.8)
+cmake_policy(SET CMP0011 NEW)
+
+message("")
+message("** Start of configure CommonSourceProject,PC8001mk2, Qt **")
+message("")
+
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake")
+
+project (emupc8001mk2)
+set(BUILD_PC8001MK2 ON CACHE BOOL "Build for PC8001mk2")
+
+include(config_pc8801)
index 882954f..c79d01c 100644 (file)
@@ -7,7 +7,7 @@ cmake_minimum_required (VERSION 2.8)
 cmake_policy(SET CMP0011 NEW)
 
 message("")
-message("** Start of configure CommonSourceProject,PC8801MA, Qt **")
+message("** Start of configure CommonSourceProject,PC8001mk2 SR, Qt **")
 message("")
 
 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake")
diff --git a/source/build-cmake/pc8801/CMakeLists.txt b/source/build-cmake/pc8801/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d376fa2
--- /dev/null
@@ -0,0 +1,18 @@
+# Build Common Sourcecode Project, Agar.
+# (C) 2014 K.Ohta <whatisthis.sowhat@gmail.com>
+# This is part of , but license is apache 2.2,
+# this part was written only me.
+
+cmake_minimum_required (VERSION 2.8)
+cmake_policy(SET CMP0011 NEW)
+
+message("")
+message("** Start of configure CommonSourceProject,PC8801, Qt **")
+message("")
+
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake")
+project (emupc8801)
+
+set(BUILD_PC8801 ON CACHE BOOL "Build with PC8801")
+
+include(config_pc8801)
\ No newline at end of file
diff --git a/source/build-cmake/pc8801mk2/CMakeLists.txt b/source/build-cmake/pc8801mk2/CMakeLists.txt
new file mode 100644 (file)
index 0000000..e95b29c
--- /dev/null
@@ -0,0 +1,18 @@
+# Build Common Sourcecode Project, Agar.
+# (C) 2014 K.Ohta <whatisthis.sowhat@gmail.com>
+# This is part of , but license is apache 2.2,
+# this part was written only me.
+
+cmake_minimum_required (VERSION 2.8)
+cmake_policy(SET CMP0011 NEW)
+
+message("")
+message("** Start of configure CommonSourceProject,PC8801mk2, Qt **")
+message("")
+
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../cmake")
+project (emupc8801mk2)
+
+set(BUILD_PC8801MK2 ON CACHE BOOL "Build with PC8801mk2")
+
+include(config_pc8801)
\ No newline at end of file
index 4a6e92f..e50f729 100644 (file)
@@ -128,7 +128,7 @@ BEGIN
         MENUITEM SEPARATOR
         MENUITEM "Exit",                        ID_EXIT
     END
-    POPUP "FD0"
+    POPUP "FD1"
     BEGIN
         MENUITEM "Insert",                      ID_OPEN_FD1
         MENUITEM "Eject",                       ID_CLOSE_FD1
@@ -140,7 +140,7 @@ BEGIN
         MENUITEM SEPARATOR
         MENUITEM "Recent",                      ID_RECENT_FD1
     END
-    POPUP "FD1"
+    POPUP "FD2"
     BEGIN
         MENUITEM "Insert",                      ID_OPEN_FD2
         MENUITEM "Eject",                       ID_CLOSE_FD2
index e86c9bc..68d98d2 100644 (file)
@@ -128,7 +128,7 @@ BEGIN
         MENUITEM SEPARATOR
         MENUITEM "Exit",                        ID_EXIT
     END
-    POPUP "FD0"
+    POPUP "FD1"
     BEGIN
         MENUITEM "Insert",                      ID_OPEN_FD1
         MENUITEM "Eject",                       ID_CLOSE_FD1
@@ -141,7 +141,7 @@ BEGIN
         MENUITEM SEPARATOR
         MENUITEM "Recent",                      ID_RECENT_FD1
     END
-    POPUP "FD1"
+    POPUP "FD2"
     BEGIN
         MENUITEM "Insert",                      ID_OPEN_FD2
         MENUITEM "Eject",                       ID_CLOSE_FD2
index 8920b6f..4da2e51 100644 (file)
@@ -128,7 +128,7 @@ BEGIN
         MENUITEM SEPARATOR
         MENUITEM "Exit",                        ID_EXIT
     END
-    POPUP "FD0"
+    POPUP "FD1"
     BEGIN
         MENUITEM "Insert",                      ID_OPEN_FD1
         MENUITEM "Eject",                       ID_CLOSE_FD1
@@ -140,7 +140,7 @@ BEGIN
         MENUITEM SEPARATOR
         MENUITEM "Recent",                      ID_RECENT_FD1
     END
-    POPUP "FD1"
+    POPUP "FD2"
     BEGIN
         MENUITEM "Insert",                      ID_OPEN_FD2
         MENUITEM "Eject",                       ID_CLOSE_FD2
index 461458a..64c285c 100644 (file)
@@ -128,7 +128,7 @@ BEGIN
         MENUITEM SEPARATOR
         MENUITEM "Exit",                        ID_EXIT
     END
-    POPUP "FD0"
+    POPUP "FD1"
     BEGIN
         MENUITEM "Insert",                      ID_OPEN_FD1
         MENUITEM "Eject",                       ID_CLOSE_FD1
@@ -141,7 +141,7 @@ BEGIN
         MENUITEM SEPARATOR
         MENUITEM "Recent",                      ID_RECENT_FD1
     END
-    POPUP "FD1"
+    POPUP "FD2"
     BEGIN
         MENUITEM "Insert",                      ID_OPEN_FD2
         MENUITEM "Eject",                       ID_CLOSE_FD2
index bbd0728..75bf762 100644 (file)
@@ -128,7 +128,7 @@ BEGIN
         MENUITEM SEPARATOR
         MENUITEM "Exit",                        ID_EXIT
     END
-    POPUP "FD0"
+    POPUP "FD1"
     BEGIN
         MENUITEM "Insert",                      ID_OPEN_FD1
         MENUITEM "Eject",                       ID_CLOSE_FD1
@@ -141,7 +141,7 @@ BEGIN
         MENUITEM SEPARATOR
         MENUITEM "Recent",                      ID_RECENT_FD1
     END
-    POPUP "FD1"
+    POPUP "FD2"
     BEGIN
         MENUITEM "Insert",                      ID_OPEN_FD2
         MENUITEM "Eject",                       ID_CLOSE_FD2
index 7d7aba1..622af6b 100644 (file)
@@ -128,7 +128,7 @@ BEGIN
         MENUITEM SEPARATOR
         MENUITEM "Exit",                        ID_EXIT
     END
-    POPUP "FD0"
+    POPUP "FD1"
     BEGIN
         MENUITEM "Insert",                      ID_OPEN_FD1
         MENUITEM "Eject",                       ID_CLOSE_FD1
@@ -140,7 +140,7 @@ BEGIN
         MENUITEM SEPARATOR
         MENUITEM "Recent",                      ID_RECENT_FD1
     END
-    POPUP "FD1"
+    POPUP "FD2"
     BEGIN
         MENUITEM "Insert",                      ID_OPEN_FD2
         MENUITEM "Eject",                       ID_CLOSE_FD2
index e759bcf..7abe7cf 100644 (file)
@@ -44,8 +44,11 @@ PC6001MK2SR
 PC6601
 PC6601SR
 PC8001
+PC8001MK2
+PC8001MK2SR
 PC8201
 PC8801
+PC8801MK2
 PC8801MA (PC8801FH)
 PC9801 (PC9801)
 PC9801E (PC98E)
diff --git a/source/src/res/pc8001.rc b/source/src/res/pc8001.rc
new file mode 100644 (file)
index 0000000..5bdf835
--- /dev/null
@@ -0,0 +1,358 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Japanese resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
+#ifdef _WIN32
+LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
+#pragma code_page(932)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+#endif    // Japanese resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Accelerator
+//
+
+IDR_ACCELERATOR1 ACCELERATORS DISCARDABLE 
+BEGIN
+    VK_RETURN,      ID_ACCEL_MOUSE,         VIRTKEY, CONTROL, NOINVERT
+    VK_RETURN,      ID_ACCEL_SCREEN,        VIRTKEY, ALT, NOINVERT
+    VK_APPS,        ID_ACCEL_SPEED,         VIRTKEY, NOINVERT
+    VK_APPS,        ID_ACCEL_ROMAJI,        VIRTKEY, CONTROL, NOINVERT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDR_MENU1 MENU DISCARDABLE 
+BEGIN
+    POPUP "Control"
+    BEGIN
+        MENUITEM "Reset",                       ID_RESET
+        MENUITEM SEPARATOR
+        MENUITEM "CPU x1",                      ID_CPU_POWER0
+        MENUITEM "CPU x2",                      ID_CPU_POWER1
+        MENUITEM "CPU x4",                      ID_CPU_POWER2
+        MENUITEM "CPU x8",                      ID_CPU_POWER3
+        MENUITEM "CPU x16",                     ID_CPU_POWER4
+        MENUITEM "Full Speed",                  ID_FULL_SPEED
+        MENUITEM SEPARATOR
+        MENUITEM "Paste",                       ID_AUTOKEY_START
+        MENUITEM "Stop",                        ID_AUTOKEY_STOP
+        MENUITEM "Romaji to Kana",              ID_ROMAJI_TO_KANA
+        MENUITEM SEPARATOR
+        POPUP "Save State"
+        BEGIN
+            MENUITEM "State 0",                     ID_SAVE_STATE0
+            MENUITEM "State 1",                     ID_SAVE_STATE1
+            MENUITEM "State 2",                     ID_SAVE_STATE2
+            MENUITEM "State 3",                     ID_SAVE_STATE3
+            MENUITEM "State 4",                     ID_SAVE_STATE4
+            MENUITEM "State 5",                     ID_SAVE_STATE5
+            MENUITEM "State 6",                     ID_SAVE_STATE6
+            MENUITEM "State 7",                     ID_SAVE_STATE7
+            MENUITEM "State 8",                     ID_SAVE_STATE8
+            MENUITEM "State 9",                     ID_SAVE_STATE9
+        END
+        POPUP "Load State"
+        BEGIN
+            MENUITEM "State 0",                     ID_LOAD_STATE0
+            MENUITEM "State 1",                     ID_LOAD_STATE1
+            MENUITEM "State 2",                     ID_LOAD_STATE2
+            MENUITEM "State 3",                     ID_LOAD_STATE3
+            MENUITEM "State 4",                     ID_LOAD_STATE4
+            MENUITEM "State 5",                     ID_LOAD_STATE5
+            MENUITEM "State 6",                     ID_LOAD_STATE6
+            MENUITEM "State 7",                     ID_LOAD_STATE7
+            MENUITEM "State 8",                     ID_LOAD_STATE8
+            MENUITEM "State 9",                     ID_LOAD_STATE9
+        END
+        MENUITEM SEPARATOR
+        MENUITEM "Debug Main CPU",              ID_OPEN_DEBUGGER0
+        MENUITEM "Debug PC-80S31K CPU",         ID_OPEN_DEBUGGER1
+        MENUITEM "Close Debugger",              ID_CLOSE_DEBUGGER
+        MENUITEM SEPARATOR
+        MENUITEM "Exit",                        ID_EXIT
+    END
+    POPUP "FD1"
+    BEGIN
+        MENUITEM "Insert",                      ID_OPEN_FD1
+        MENUITEM "Eject",                       ID_CLOSE_FD1
+        MENUITEM "Insert Blank 2D Disk",        ID_OPEN_BLANK_2D_FD1
+        MENUITEM SEPARATOR
+        MENUITEM "Write Protected",             ID_WRITE_PROTECT_FD1
+        MENUITEM "Correct Timing",              ID_CORRECT_TIMING_FD1
+        MENUITEM "Ignore CRC Errors",           ID_IGNORE_CRC_FD1
+        MENUITEM SEPARATOR
+        MENUITEM "Recent",                      ID_RECENT_FD1
+    END
+    POPUP "FD2"
+    BEGIN
+        MENUITEM "Insert",                      ID_OPEN_FD2
+        MENUITEM "Eject",                       ID_CLOSE_FD2
+        MENUITEM "Insert Blank 2D Disk",        ID_OPEN_BLANK_2D_FD2
+        MENUITEM SEPARATOR
+        MENUITEM "Write Protected",             ID_WRITE_PROTECT_FD2
+        MENUITEM "Correct Timing",              ID_CORRECT_TIMING_FD2
+        MENUITEM "Ignore CRC Errors",           ID_IGNORE_CRC_FD2
+        MENUITEM SEPARATOR
+        MENUITEM "Recent",                      ID_RECENT_FD2
+    END
+    POPUP "CMT"
+    BEGIN
+        MENUITEM "Play",                        ID_PLAY_TAPE1
+        MENUITEM "Rec",                         ID_REC_TAPE1
+        MENUITEM "Eject",                       ID_CLOSE_TAPE1
+        MENUITEM SEPARATOR
+        MENUITEM "Recent",                      ID_RECENT_TAPE1
+    END
+    POPUP "Device"
+    BEGIN
+        POPUP "Sound"
+        BEGIN
+            MENUITEM "Play FDD Noise",              ID_VM_SOUND_NOISE_FDD
+            MENUITEM "Play CMT Noise",              ID_VM_SOUND_NOISE_CMT, GRAYED
+            MENUITEM "Play CMT Sound",              ID_VM_SOUND_PLAY_TAPE, GRAYED
+        END
+        POPUP "Display"
+        BEGIN
+            MENUITEM "Scanline",                    ID_VM_MONITOR_SCANLINE
+        END
+        POPUP "Printer"
+        BEGIN
+            MENUITEM "Write Printer to File",       ID_VM_PRINTER_TYPE0
+            MENUITEM "PC-PR201",                    ID_VM_PRINTER_TYPE1, GRAYED
+            MENUITEM "None",                        ID_VM_PRINTER_TYPE2
+        END
+    END
+    POPUP "Host"
+    BEGIN
+        MENUITEM "Rec Movie 60fps",             ID_HOST_REC_MOVIE_60FPS
+        MENUITEM "Rec Movie 30fps",             ID_HOST_REC_MOVIE_30FPS
+        MENUITEM "Rec Movie 15fps",             ID_HOST_REC_MOVIE_15FPS
+        MENUITEM "Rec Sound",                   ID_HOST_REC_SOUND
+        MENUITEM "Stop",                        ID_HOST_REC_STOP
+        MENUITEM "Capture Screen",              ID_HOST_CAPTURE_SCREEN
+        MENUITEM SEPARATOR
+        POPUP "Screen"
+        BEGIN
+            MENUITEM "Window x1",                   ID_SCREEN_WINDOW
+            MENUITEM "Fullscreen 640x400",          ID_SCREEN_FULLSCREEN
+            MENUITEM SEPARATOR
+            MENUITEM "Window Stretch 1",            ID_SCREEN_WINDOW_STRETCH
+            MENUITEM "Window Stretch 2",            ID_SCREEN_WINDOW_ASPECT
+            MENUITEM SEPARATOR
+            MENUITEM "Fullscreen Stretch 1",        ID_SCREEN_FULLSCREEN_DOTBYDOT
+            MENUITEM "Fullscreen Stretch 2",        ID_SCREEN_FULLSCREEN_STRETCH
+            MENUITEM "Fullscreen Stretch 3",        ID_SCREEN_FULLSCREEN_ASPECT
+            MENUITEM "Fullscreen Stretch 4",        ID_SCREEN_FULLSCREEN_FILL
+            MENUITEM SEPARATOR
+            MENUITEM "Rotate 0deg",                 ID_SCREEN_ROTATE_0
+            MENUITEM "Rotate +90deg",               ID_SCREEN_ROTATE_90
+            MENUITEM "Rotate 180deg",               ID_SCREEN_ROTATE_180
+            MENUITEM "Rotate -90deg",               ID_SCREEN_ROTATE_270
+        END
+        POPUP "Filter"
+        BEGIN
+            MENUITEM "RGB Filter",                  ID_FILTER_RGB
+            MENUITEM "None",                        ID_FILTER_NONE
+        END
+        POPUP "Sound"
+        BEGIN
+            MENUITEM "2000Hz",                      ID_SOUND_FREQ0
+            MENUITEM "4000Hz",                      ID_SOUND_FREQ1
+            MENUITEM "8000Hz",                      ID_SOUND_FREQ2
+            MENUITEM "11025Hz",                     ID_SOUND_FREQ3
+            MENUITEM "22050Hz",                     ID_SOUND_FREQ4
+            MENUITEM "44100Hz",                     ID_SOUND_FREQ5
+            MENUITEM "55467Hz",                     ID_SOUND_FREQ6
+            MENUITEM "96000Hz",                     ID_SOUND_FREQ7
+            MENUITEM SEPARATOR
+            MENUITEM "50msec",                      ID_SOUND_LATE0
+            MENUITEM "100msec",                     ID_SOUND_LATE1
+            MENUITEM "200msec",                     ID_SOUND_LATE2
+            MENUITEM "300msec",                     ID_SOUND_LATE3
+            MENUITEM "400msec",                     ID_SOUND_LATE4
+            MENUITEM SEPARATOR
+            MENUITEM "Realtime Mix",                ID_SOUND_STRICT_RENDER
+            MENUITEM "Light Weight Mix",            ID_SOUND_LIGHT_RENDER
+            MENUITEM SEPARATOR
+            MENUITEM "Volume",                      ID_SOUND_VOLUME
+        END
+        POPUP "Input"
+        BEGIN
+            MENUITEM "Joystick #1",                 ID_INPUT_JOYSTICK0
+            MENUITEM "Joystick #2",                 ID_INPUT_JOYSTICK1
+            MENUITEM "Joystick To Keyboard",        ID_INPUT_JOYTOKEY
+        END
+        MENUITEM SEPARATOR
+        MENUITEM "Use Direct3D9",               ID_HOST_USE_D3D9
+        MENUITEM "Wait Vsync",                  ID_HOST_WAIT_VSYNC
+        MENUITEM "Use DirectInput",             ID_HOST_USE_DINPUT
+        MENUITEM "Disable Windows 8 DWM",       ID_HOST_DISABLE_DWM
+        MENUITEM "Show Status Bar",             ID_HOST_SHOW_STATUS_BAR
+    END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Image
+//
+
+IDI_BITMAP_ACCESS_OFF   BITMAP  DISCARDABLE     "indicator/access_off.bmp"
+IDI_BITMAP_ACCESS_ON    BITMAP  DISCARDABLE     "indicator/access_on.bmp"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON1               ICON    DISCARDABLE     "pc8001.ico"
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_VOLUME DIALOG DISCARDABLE  0, 0, 250, 120
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Volume"
+FONT 9, "MS PGothic"
+BEGIN
+    LTEXT           "Sound Device #1",IDC_VOLUME_CAPTION0,6,6,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L0,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,6,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R0,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,21,175,12
+    LTEXT           "Sound Device #2",IDC_VOLUME_CAPTION1,6,36,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L1,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,36,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R1,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,51,175,12
+    LTEXT           "Sound Device #3",IDC_VOLUME_CAPTION2,6,66,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L2,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,66,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R2,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,81,175,12
+    DEFPUSHBUTTON   "OK",IDOK,70,100,50,14
+    DEFPUSHBUTTON   "Reset",IDC_VOLUME_RESET,130,100,50,14
+END
+
+IDD_JOYSTICK DIALOG DISCARDABLE  0, 0, 175, 120
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Joystick #1"
+FONT 9, "MS PGothic"
+BEGIN
+    LTEXT           "Button #1",IDC_JOYSTICK_CAPTION0,6,6,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM0,50,4,120,14,ES_MULTILINE
+    LTEXT           "Button #2",IDC_JOYSTICK_CAPTION1,6,21,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM1,50,19,120,14,ES_MULTILINE
+    LTEXT           "Button #3",IDC_JOYSTICK_CAPTION2,6,36,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM2,50,34,120,14,ES_MULTILINE
+    LTEXT           "Button #4",IDC_JOYSTICK_CAPTION3,6,51,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM3,50,49,120,14,ES_MULTILINE
+    LTEXT           "Button #5",IDC_JOYSTICK_CAPTION4,6,66,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM4,50,64,120,14,ES_MULTILINE
+    LTEXT           "Button #6",IDC_JOYSTICK_CAPTION5,6,81,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM5,50,79,120,14,ES_MULTILINE
+    DEFPUSHBUTTON   "OK",IDOK,35,100,50,14
+    DEFPUSHBUTTON   "Reset",IDC_JOYSTICK_RESET,90,100,50,14
+END
+
+IDD_JOYTOKEY DIALOG DISCARDABLE  0, 0, 175, 235
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Joystick To Keyboard"
+FONT 9, "MS PGothic"
+BEGIN
+    CONTROL         "Enable Joystick To Keyboard",IDC_JOYTOKEY_CHECK0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,6,164,8
+    CONTROL         "Cursor Key",IDC_JOYTOKEY_RADIO0,"Button",BS_AUTORADIOBUTTON,6,26,164,7
+    CONTROL         "NumPad Key (4-Directions)",IDC_JOYTOKEY_RADIO1,"Button",BS_AUTORADIOBUTTON,6,41,164,7
+    CONTROL         "NumPad Key (8-Directions)",IDC_JOYTOKEY_RADIO2,"Button",BS_AUTORADIOBUTTON,6,56,164,7
+    CONTROL         "Press NumPad 5 To Release Stick",IDC_JOYTOKEY_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,71,164,8
+    LTEXT           "Button #1",IDC_JOYSTICK_CAPTION0,6,91,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM0,50,89,120,14,ES_MULTILINE
+    LTEXT           "Button #2",IDC_JOYSTICK_CAPTION1,6,106,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM1,50,104,120,14,ES_MULTILINE
+    LTEXT           "Button #3",IDC_JOYSTICK_CAPTION2,6,121,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM2,50,119,120,14,ES_MULTILINE
+    LTEXT           "Button #4",IDC_JOYSTICK_CAPTION3,6,136,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM3,50,134,120,14,ES_MULTILINE
+    LTEXT           "Button #5",IDC_JOYSTICK_CAPTION4,6,151,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM4,50,149,120,14,ES_MULTILINE
+    LTEXT           "Button #6",IDC_JOYSTICK_CAPTION5,6,166,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM5,50,164,120,14,ES_MULTILINE
+    LTEXT           "Button #7",IDC_JOYSTICK_CAPTION6,6,181,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM6,50,179,120,14,ES_MULTILINE
+    LTEXT           "Button #8",IDC_JOYSTICK_CAPTION7,6,196,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM7,50,194,120,14,ES_MULTILINE
+    DEFPUSHBUTTON   "OK",IDOK,35,215,50,14
+    DEFPUSHBUTTON   "Reset",IDC_JOYSTICK_RESET,90,215,50,14
+END
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
diff --git a/source/src/res/pc8001mk2.ico b/source/src/res/pc8001mk2.ico
new file mode 100644 (file)
index 0000000..8af82cd
Binary files /dev/null and b/source/src/res/pc8001mk2.ico differ
diff --git a/source/src/res/pc8001mk2.rc b/source/src/res/pc8001mk2.rc
new file mode 100644 (file)
index 0000000..4b83bc9
--- /dev/null
@@ -0,0 +1,378 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Japanese resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
+#ifdef _WIN32
+LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
+#pragma code_page(932)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+#endif    // Japanese resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Accelerator
+//
+
+IDR_ACCELERATOR1 ACCELERATORS DISCARDABLE 
+BEGIN
+    VK_RETURN,      ID_ACCEL_MOUSE,         VIRTKEY, CONTROL, NOINVERT
+    VK_RETURN,      ID_ACCEL_SCREEN,        VIRTKEY, ALT, NOINVERT
+    VK_APPS,        ID_ACCEL_SPEED,         VIRTKEY, NOINVERT
+    VK_APPS,        ID_ACCEL_ROMAJI,        VIRTKEY, CONTROL, NOINVERT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDR_MENU1 MENU DISCARDABLE 
+BEGIN
+    POPUP "Control"
+    BEGIN
+        MENUITEM "Reset",                       ID_RESET
+        MENUITEM SEPARATOR
+        MENUITEM "CPU x1",                      ID_CPU_POWER0
+        MENUITEM "CPU x2",                      ID_CPU_POWER1
+        MENUITEM "CPU x4",                      ID_CPU_POWER2
+        MENUITEM "CPU x8",                      ID_CPU_POWER3
+        MENUITEM "CPU x16",                     ID_CPU_POWER4
+        MENUITEM "Full Speed",                  ID_FULL_SPEED
+        MENUITEM SEPARATOR
+        MENUITEM "Paste",                       ID_AUTOKEY_START
+        MENUITEM "Stop",                        ID_AUTOKEY_STOP
+        MENUITEM "Romaji to Kana",              ID_ROMAJI_TO_KANA
+        MENUITEM SEPARATOR
+        POPUP "Save State"
+        BEGIN
+            MENUITEM "State 0",                     ID_SAVE_STATE0
+            MENUITEM "State 1",                     ID_SAVE_STATE1
+            MENUITEM "State 2",                     ID_SAVE_STATE2
+            MENUITEM "State 3",                     ID_SAVE_STATE3
+            MENUITEM "State 4",                     ID_SAVE_STATE4
+            MENUITEM "State 5",                     ID_SAVE_STATE5
+            MENUITEM "State 6",                     ID_SAVE_STATE6
+            MENUITEM "State 7",                     ID_SAVE_STATE7
+            MENUITEM "State 8",                     ID_SAVE_STATE8
+            MENUITEM "State 9",                     ID_SAVE_STATE9
+        END
+        POPUP "Load State"
+        BEGIN
+            MENUITEM "State 0",                     ID_LOAD_STATE0
+            MENUITEM "State 1",                     ID_LOAD_STATE1
+            MENUITEM "State 2",                     ID_LOAD_STATE2
+            MENUITEM "State 3",                     ID_LOAD_STATE3
+            MENUITEM "State 4",                     ID_LOAD_STATE4
+            MENUITEM "State 5",                     ID_LOAD_STATE5
+            MENUITEM "State 6",                     ID_LOAD_STATE6
+            MENUITEM "State 7",                     ID_LOAD_STATE7
+            MENUITEM "State 8",                     ID_LOAD_STATE8
+            MENUITEM "State 9",                     ID_LOAD_STATE9
+        END
+        MENUITEM SEPARATOR
+        MENUITEM "Debug Main CPU",              ID_OPEN_DEBUGGER0
+        MENUITEM "Debug PC-80S31K CPU",         ID_OPEN_DEBUGGER1
+        MENUITEM "Close Debugger",              ID_CLOSE_DEBUGGER
+        MENUITEM SEPARATOR
+        MENUITEM "Exit",                        ID_EXIT
+    END
+    POPUP "FD1"
+    BEGIN
+        MENUITEM "Insert",                      ID_OPEN_FD1
+        MENUITEM "Eject",                       ID_CLOSE_FD1
+        MENUITEM "Insert Blank 2D Disk",        ID_OPEN_BLANK_2D_FD1
+        MENUITEM SEPARATOR
+        MENUITEM "Write Protected",             ID_WRITE_PROTECT_FD1
+        MENUITEM "Correct Timing",              ID_CORRECT_TIMING_FD1
+        MENUITEM "Ignore CRC Errors",           ID_IGNORE_CRC_FD1
+        MENUITEM SEPARATOR
+        MENUITEM "Recent",                      ID_RECENT_FD1
+    END
+    POPUP "FD2"
+    BEGIN
+        MENUITEM "Insert",                      ID_OPEN_FD2
+        MENUITEM "Eject",                       ID_CLOSE_FD2
+        MENUITEM "Insert Blank 2D Disk",        ID_OPEN_BLANK_2D_FD2
+        MENUITEM SEPARATOR
+        MENUITEM "Write Protected",             ID_WRITE_PROTECT_FD2
+        MENUITEM "Correct Timing",              ID_CORRECT_TIMING_FD2
+        MENUITEM "Ignore CRC Errors",           ID_IGNORE_CRC_FD2
+        MENUITEM SEPARATOR
+        MENUITEM "Recent",                      ID_RECENT_FD2
+    END
+    POPUP "CMT"
+    BEGIN
+        MENUITEM "Play",                        ID_PLAY_TAPE1
+        MENUITEM "Rec",                         ID_REC_TAPE1
+        MENUITEM "Eject",                       ID_CLOSE_TAPE1
+        MENUITEM SEPARATOR
+        MENUITEM "Recent",                      ID_RECENT_TAPE1
+    END
+    POPUP "Device"
+    BEGIN
+        POPUP "Boot"
+        BEGIN
+            MENUITEM "N80 mode"                 ID_VM_BOOT_MODE0
+            MENUITEM "N mode"                   ID_VM_BOOT_MODE2
+        END
+        POPUP "Sound"
+        BEGIN
+            MENUITEM "OPN",                     ID_VM_SOUND_TYPE0
+            MENUITEM "OPNA",                    ID_VM_SOUND_TYPE1
+            MENUITEM SEPARATOR
+            MENUITEM "Play FDD Noise",              ID_VM_SOUND_NOISE_FDD
+            MENUITEM "Play CMT Noise",              ID_VM_SOUND_NOISE_CMT, GRAYED
+            MENUITEM "Play CMT Sound",              ID_VM_SOUND_PLAY_TAPE, GRAYED
+        END
+        POPUP "Display"
+        BEGIN
+            MENUITEM "Scanline",                    ID_VM_MONITOR_SCANLINE
+        END
+        POPUP "Printer"
+        BEGIN
+            MENUITEM "Write Printer to File",       ID_VM_PRINTER_TYPE0
+            MENUITEM "PC-PR201",                    ID_VM_PRINTER_TYPE1, GRAYED
+            MENUITEM "None",                        ID_VM_PRINTER_TYPE2
+        END
+    END
+    POPUP "Host"
+    BEGIN
+        MENUITEM "Rec Movie 60fps",             ID_HOST_REC_MOVIE_60FPS
+        MENUITEM "Rec Movie 30fps",             ID_HOST_REC_MOVIE_30FPS
+        MENUITEM "Rec Movie 15fps",             ID_HOST_REC_MOVIE_15FPS
+        MENUITEM "Rec Sound",                   ID_HOST_REC_SOUND
+        MENUITEM "Stop",                        ID_HOST_REC_STOP
+        MENUITEM "Capture Screen",              ID_HOST_CAPTURE_SCREEN
+        MENUITEM SEPARATOR
+        POPUP "Screen"
+        BEGIN
+            MENUITEM "Window x1",                   ID_SCREEN_WINDOW
+            MENUITEM "Fullscreen 640x400",          ID_SCREEN_FULLSCREEN
+            MENUITEM SEPARATOR
+            MENUITEM "Window Stretch 1",            ID_SCREEN_WINDOW_STRETCH
+            MENUITEM "Window Stretch 2",            ID_SCREEN_WINDOW_ASPECT
+            MENUITEM SEPARATOR
+            MENUITEM "Fullscreen Stretch 1",        ID_SCREEN_FULLSCREEN_DOTBYDOT
+            MENUITEM "Fullscreen Stretch 2",        ID_SCREEN_FULLSCREEN_STRETCH
+            MENUITEM "Fullscreen Stretch 3",        ID_SCREEN_FULLSCREEN_ASPECT
+            MENUITEM "Fullscreen Stretch 4",        ID_SCREEN_FULLSCREEN_FILL
+            MENUITEM SEPARATOR
+            MENUITEM "Rotate 0deg",                 ID_SCREEN_ROTATE_0
+            MENUITEM "Rotate +90deg",               ID_SCREEN_ROTATE_90
+            MENUITEM "Rotate 180deg",               ID_SCREEN_ROTATE_180
+            MENUITEM "Rotate -90deg",               ID_SCREEN_ROTATE_270
+        END
+        POPUP "Filter"
+        BEGIN
+            MENUITEM "RGB Filter",                  ID_FILTER_RGB
+            MENUITEM "None",                        ID_FILTER_NONE
+        END
+        POPUP "Sound"
+        BEGIN
+            MENUITEM "2000Hz",                      ID_SOUND_FREQ0
+            MENUITEM "4000Hz",                      ID_SOUND_FREQ1
+            MENUITEM "8000Hz",                      ID_SOUND_FREQ2
+            MENUITEM "11025Hz",                     ID_SOUND_FREQ3
+            MENUITEM "22050Hz",                     ID_SOUND_FREQ4
+            MENUITEM "44100Hz",                     ID_SOUND_FREQ5
+            MENUITEM "55467Hz",                     ID_SOUND_FREQ6
+            MENUITEM "96000Hz",                     ID_SOUND_FREQ7
+            MENUITEM SEPARATOR
+            MENUITEM "50msec",                      ID_SOUND_LATE0
+            MENUITEM "100msec",                     ID_SOUND_LATE1
+            MENUITEM "200msec",                     ID_SOUND_LATE2
+            MENUITEM "300msec",                     ID_SOUND_LATE3
+            MENUITEM "400msec",                     ID_SOUND_LATE4
+            MENUITEM SEPARATOR
+            MENUITEM "Realtime Mix",                ID_SOUND_STRICT_RENDER
+            MENUITEM "Light Weight Mix",            ID_SOUND_LIGHT_RENDER
+            MENUITEM SEPARATOR
+            MENUITEM "Volume",                      ID_SOUND_VOLUME
+        END
+        POPUP "Input"
+        BEGIN
+            MENUITEM "Joystick #1",                 ID_INPUT_JOYSTICK0
+            MENUITEM "Joystick #2",                 ID_INPUT_JOYSTICK1
+            MENUITEM "Joystick To Keyboard",        ID_INPUT_JOYTOKEY
+        END
+        MENUITEM SEPARATOR
+        MENUITEM "Use Direct3D9",               ID_HOST_USE_D3D9
+        MENUITEM "Wait Vsync",                  ID_HOST_WAIT_VSYNC
+        MENUITEM "Use DirectInput",             ID_HOST_USE_DINPUT
+        MENUITEM "Disable Windows 8 DWM",       ID_HOST_DISABLE_DWM
+        MENUITEM "Show Status Bar",             ID_HOST_SHOW_STATUS_BAR
+    END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Image
+//
+
+IDI_BITMAP_ACCESS_OFF   BITMAP  DISCARDABLE     "indicator/access_off.bmp"
+IDI_BITMAP_ACCESS_ON    BITMAP  DISCARDABLE     "indicator/access_on.bmp"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON1               ICON    DISCARDABLE     "pc8001mk2.ico"
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_VOLUME DIALOG DISCARDABLE  0, 0, 250, 240
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Volume"
+FONT 9, "MS PGothic"
+BEGIN
+    LTEXT           "Sound Device #1",IDC_VOLUME_CAPTION0,6,6,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L0,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,6,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R0,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,21,175,12
+    LTEXT           "Sound Device #2",IDC_VOLUME_CAPTION1,6,36,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L1,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,36,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R1,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,51,175,12
+    LTEXT           "Sound Device #3",IDC_VOLUME_CAPTION2,6,66,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L2,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,66,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R2,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,81,175,12
+    LTEXT           "Sound Device #4",IDC_VOLUME_CAPTION3,6,96,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L3,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,96,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R3,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,111,175,12
+    LTEXT           "Sound Device #5",IDC_VOLUME_CAPTION4,6,126,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L4,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,126,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R4,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,141,175,12
+    LTEXT           "Sound Device #6",IDC_VOLUME_CAPTION5,6,156,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L5,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,156,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R5,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,171,175,12
+    LTEXT           "Sound Device #7",IDC_VOLUME_CAPTION6,6,186,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L6,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,186,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R6,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,201,175,12
+    DEFPUSHBUTTON   "OK",IDOK,70,220,50,14
+    DEFPUSHBUTTON   "Reset",IDC_VOLUME_RESET,130,220,50,14
+END
+
+IDD_JOYSTICK DIALOG DISCARDABLE  0, 0, 175, 120
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Joystick #1"
+FONT 9, "MS PGothic"
+BEGIN
+    LTEXT           "Button #1",IDC_JOYSTICK_CAPTION0,6,6,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM0,50,4,120,14,ES_MULTILINE
+    LTEXT           "Button #2",IDC_JOYSTICK_CAPTION1,6,21,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM1,50,19,120,14,ES_MULTILINE
+    LTEXT           "Button #3",IDC_JOYSTICK_CAPTION2,6,36,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM2,50,34,120,14,ES_MULTILINE
+    LTEXT           "Button #4",IDC_JOYSTICK_CAPTION3,6,51,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM3,50,49,120,14,ES_MULTILINE
+    LTEXT           "Button #5",IDC_JOYSTICK_CAPTION4,6,66,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM4,50,64,120,14,ES_MULTILINE
+    LTEXT           "Button #6",IDC_JOYSTICK_CAPTION5,6,81,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM5,50,79,120,14,ES_MULTILINE
+    DEFPUSHBUTTON   "OK",IDOK,35,100,50,14
+    DEFPUSHBUTTON   "Reset",IDC_JOYSTICK_RESET,90,100,50,14
+END
+
+IDD_JOYTOKEY DIALOG DISCARDABLE  0, 0, 175, 235
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Joystick To Keyboard"
+FONT 9, "MS PGothic"
+BEGIN
+    CONTROL         "Enable Joystick To Keyboard",IDC_JOYTOKEY_CHECK0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,6,164,8
+    CONTROL         "Cursor Key",IDC_JOYTOKEY_RADIO0,"Button",BS_AUTORADIOBUTTON,6,26,164,7
+    CONTROL         "NumPad Key (4-Directions)",IDC_JOYTOKEY_RADIO1,"Button",BS_AUTORADIOBUTTON,6,41,164,7
+    CONTROL         "NumPad Key (8-Directions)",IDC_JOYTOKEY_RADIO2,"Button",BS_AUTORADIOBUTTON,6,56,164,7
+    CONTROL         "Press NumPad 5 To Release Stick",IDC_JOYTOKEY_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,71,164,8
+    LTEXT           "Button #1",IDC_JOYSTICK_CAPTION0,6,91,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM0,50,89,120,14,ES_MULTILINE
+    LTEXT           "Button #2",IDC_JOYSTICK_CAPTION1,6,106,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM1,50,104,120,14,ES_MULTILINE
+    LTEXT           "Button #3",IDC_JOYSTICK_CAPTION2,6,121,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM2,50,119,120,14,ES_MULTILINE
+    LTEXT           "Button #4",IDC_JOYSTICK_CAPTION3,6,136,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM3,50,134,120,14,ES_MULTILINE
+    LTEXT           "Button #5",IDC_JOYSTICK_CAPTION4,6,151,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM4,50,149,120,14,ES_MULTILINE
+    LTEXT           "Button #6",IDC_JOYSTICK_CAPTION5,6,166,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM5,50,164,120,14,ES_MULTILINE
+    LTEXT           "Button #7",IDC_JOYSTICK_CAPTION6,6,181,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM6,50,179,120,14,ES_MULTILINE
+    LTEXT           "Button #8",IDC_JOYSTICK_CAPTION7,6,196,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM7,50,194,120,14,ES_MULTILINE
+    DEFPUSHBUTTON   "OK",IDOK,35,215,50,14
+    DEFPUSHBUTTON   "Reset",IDC_JOYSTICK_RESET,90,215,50,14
+END
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
index 799143a..5d476b8 100644 (file)
@@ -97,29 +97,29 @@ BEGIN
         MENUITEM SEPARATOR
         POPUP "Save State"
         BEGIN
-            MENUITEM "State 0",                 ID_SAVE_STATE0
-            MENUITEM "State 1",                 ID_SAVE_STATE1
-            MENUITEM "State 2",                 ID_SAVE_STATE2
-            MENUITEM "State 3",                 ID_SAVE_STATE3
-            MENUITEM "State 4",                 ID_SAVE_STATE4
-            MENUITEM "State 5",                 ID_SAVE_STATE5
-            MENUITEM "State 6",                 ID_SAVE_STATE6
-            MENUITEM "State 7",                 ID_SAVE_STATE7
-            MENUITEM "State 8",                 ID_SAVE_STATE8
-            MENUITEM "State 9",                 ID_SAVE_STATE9
+            MENUITEM "State 0",                     ID_SAVE_STATE0
+            MENUITEM "State 1",                     ID_SAVE_STATE1
+            MENUITEM "State 2",                     ID_SAVE_STATE2
+            MENUITEM "State 3",                     ID_SAVE_STATE3
+            MENUITEM "State 4",                     ID_SAVE_STATE4
+            MENUITEM "State 5",                     ID_SAVE_STATE5
+            MENUITEM "State 6",                     ID_SAVE_STATE6
+            MENUITEM "State 7",                     ID_SAVE_STATE7
+            MENUITEM "State 8",                     ID_SAVE_STATE8
+            MENUITEM "State 9",                     ID_SAVE_STATE9
         END
         POPUP "Load State"
         BEGIN
-            MENUITEM "State 0",                 ID_LOAD_STATE0
-            MENUITEM "State 1",                 ID_LOAD_STATE1
-            MENUITEM "State 2",                 ID_LOAD_STATE2
-            MENUITEM "State 3",                 ID_LOAD_STATE3
-            MENUITEM "State 4",                 ID_LOAD_STATE4
-            MENUITEM "State 5",                 ID_LOAD_STATE5
-            MENUITEM "State 6",                 ID_LOAD_STATE6
-            MENUITEM "State 7",                 ID_LOAD_STATE7
-            MENUITEM "State 8",                 ID_LOAD_STATE8
-            MENUITEM "State 9",                 ID_LOAD_STATE9
+            MENUITEM "State 0",                     ID_LOAD_STATE0
+            MENUITEM "State 1",                     ID_LOAD_STATE1
+            MENUITEM "State 2",                     ID_LOAD_STATE2
+            MENUITEM "State 3",                     ID_LOAD_STATE3
+            MENUITEM "State 4",                     ID_LOAD_STATE4
+            MENUITEM "State 5",                     ID_LOAD_STATE5
+            MENUITEM "State 6",                     ID_LOAD_STATE6
+            MENUITEM "State 7",                     ID_LOAD_STATE7
+            MENUITEM "State 8",                     ID_LOAD_STATE8
+            MENUITEM "State 9",                     ID_LOAD_STATE9
         END
         MENUITEM SEPARATOR
         MENUITEM "Debug Main CPU",              ID_OPEN_DEBUGGER0
@@ -170,28 +170,27 @@ BEGIN
         END
         POPUP "DIP Switch"
         BEGIN
-            MENUITEM "Memory Wait",             ID_VM_DIPSWITCH0
-        END
-        POPUP "Joystick"
-        BEGIN
-            MENUITEM "Joystick"                 ID_VM_JOYSTICK_TYPE0
-            MENUITEM "Bus Mouse"                ID_VM_JOYSTICK_TYPE1
+            MENUITEM "Memory Wait",                 ID_VM_DIPSWITCH0
         END
         POPUP "Sound"
         BEGIN
-            MENUITEM "Play FDD Noise",          ID_VM_SOUND_NOISE_FDD
-            MENUITEM "Play CMT Noise",          ID_VM_SOUND_NOISE_CMT, GRAYED
-            MENUITEM "Play CMT Sound",          ID_VM_SOUND_PLAY_TAPE, GRAYED
+            MENUITEM "OPN",                     ID_VM_SOUND_TYPE0
+            MENUITEM "OPN+OPN",                 ID_VM_SOUND_TYPE1
+            MENUITEM "OPN+OPNA",                ID_VM_SOUND_TYPE2
+            MENUITEM SEPARATOR
+            MENUITEM "Play FDD Noise",              ID_VM_SOUND_NOISE_FDD
+            MENUITEM "Play CMT Noise",              ID_VM_SOUND_NOISE_CMT, GRAYED
+            MENUITEM "Play CMT Sound",              ID_VM_SOUND_PLAY_TAPE, GRAYED
         END
         POPUP "Display"
         BEGIN
-            MENUITEM "Scanline",                ID_VM_MONITOR_SCANLINE
+            MENUITEM "Scanline",                    ID_VM_MONITOR_SCANLINE
         END
         POPUP "Printer"
         BEGIN
-            MENUITEM "Write Printer to File",   ID_VM_PRINTER_TYPE0
-            MENUITEM "PC-PR201",                ID_VM_PRINTER_TYPE1, GRAYED
-            MENUITEM "None",                    ID_VM_PRINTER_TYPE2
+            MENUITEM "Write Printer to File",       ID_VM_PRINTER_TYPE0
+            MENUITEM "PC-PR201",                    ID_VM_PRINTER_TYPE1, GRAYED
+            MENUITEM "None",                        ID_VM_PRINTER_TYPE2
         END
     END
     POPUP "Host"
@@ -205,54 +204,54 @@ BEGIN
         MENUITEM SEPARATOR
         POPUP "Screen"
         BEGIN
-            MENUITEM "Window x1",               ID_SCREEN_WINDOW
-            MENUITEM "Fullscreen 640x400",      ID_SCREEN_FULLSCREEN
+            MENUITEM "Window x1",                   ID_SCREEN_WINDOW
+            MENUITEM "Fullscreen 640x400",          ID_SCREEN_FULLSCREEN
             MENUITEM SEPARATOR
-            MENUITEM "Window Stretch 1",        ID_SCREEN_WINDOW_STRETCH
-            MENUITEM "Window Stretch 2",        ID_SCREEN_WINDOW_ASPECT
+            MENUITEM "Window Stretch 1",            ID_SCREEN_WINDOW_STRETCH
+            MENUITEM "Window Stretch 2",            ID_SCREEN_WINDOW_ASPECT
             MENUITEM SEPARATOR
-            MENUITEM "Fullscreen Stretch 1",    ID_SCREEN_FULLSCREEN_DOTBYDOT
-            MENUITEM "Fullscreen Stretch 2",    ID_SCREEN_FULLSCREEN_STRETCH
-            MENUITEM "Fullscreen Stretch 3",    ID_SCREEN_FULLSCREEN_ASPECT
-            MENUITEM "Fullscreen Stretch 4",    ID_SCREEN_FULLSCREEN_FILL
+            MENUITEM "Fullscreen Stretch 1",        ID_SCREEN_FULLSCREEN_DOTBYDOT
+            MENUITEM "Fullscreen Stretch 2",        ID_SCREEN_FULLSCREEN_STRETCH
+            MENUITEM "Fullscreen Stretch 3",        ID_SCREEN_FULLSCREEN_ASPECT
+            MENUITEM "Fullscreen Stretch 4",        ID_SCREEN_FULLSCREEN_FILL
             MENUITEM SEPARATOR
-            MENUITEM "Rotate 0deg",             ID_SCREEN_ROTATE_0
-            MENUITEM "Rotate +90deg",           ID_SCREEN_ROTATE_90
-            MENUITEM "Rotate 180deg",           ID_SCREEN_ROTATE_180
-            MENUITEM "Rotate -90deg",           ID_SCREEN_ROTATE_270
+            MENUITEM "Rotate 0deg",                 ID_SCREEN_ROTATE_0
+            MENUITEM "Rotate +90deg",               ID_SCREEN_ROTATE_90
+            MENUITEM "Rotate 180deg",               ID_SCREEN_ROTATE_180
+            MENUITEM "Rotate -90deg",               ID_SCREEN_ROTATE_270
         END
         POPUP "Filter"
         BEGIN
-            MENUITEM "RGB Filter",              ID_FILTER_RGB
-            MENUITEM "None",                    ID_FILTER_NONE
+            MENUITEM "RGB Filter",                  ID_FILTER_RGB
+            MENUITEM "None",                        ID_FILTER_NONE
         END
         POPUP "Sound"
         BEGIN
-            MENUITEM "2000Hz",                  ID_SOUND_FREQ0
-            MENUITEM "4000Hz",                  ID_SOUND_FREQ1
-            MENUITEM "8000Hz",                  ID_SOUND_FREQ2
-            MENUITEM "11025Hz",                 ID_SOUND_FREQ3
-            MENUITEM "22050Hz",                 ID_SOUND_FREQ4
-            MENUITEM "44100Hz",                 ID_SOUND_FREQ5
-            MENUITEM "55467Hz",                 ID_SOUND_FREQ6
-            MENUITEM "96000Hz",                 ID_SOUND_FREQ7
+            MENUITEM "2000Hz",                      ID_SOUND_FREQ0
+            MENUITEM "4000Hz",                      ID_SOUND_FREQ1
+            MENUITEM "8000Hz",                      ID_SOUND_FREQ2
+            MENUITEM "11025Hz",                     ID_SOUND_FREQ3
+            MENUITEM "22050Hz",                     ID_SOUND_FREQ4
+            MENUITEM "44100Hz",                     ID_SOUND_FREQ5
+            MENUITEM "55467Hz",                     ID_SOUND_FREQ6
+            MENUITEM "96000Hz",                     ID_SOUND_FREQ7
             MENUITEM SEPARATOR
-            MENUITEM "50msec",                  ID_SOUND_LATE0
-            MENUITEM "100msec",                 ID_SOUND_LATE1
-            MENUITEM "200msec",                 ID_SOUND_LATE2
-            MENUITEM "300msec",                 ID_SOUND_LATE3
-            MENUITEM "400msec",                 ID_SOUND_LATE4
+            MENUITEM "50msec",                      ID_SOUND_LATE0
+            MENUITEM "100msec",                     ID_SOUND_LATE1
+            MENUITEM "200msec",                     ID_SOUND_LATE2
+            MENUITEM "300msec",                     ID_SOUND_LATE3
+            MENUITEM "400msec",                     ID_SOUND_LATE4
             MENUITEM SEPARATOR
-            MENUITEM "Realtime Mix",            ID_SOUND_STRICT_RENDER
-            MENUITEM "Light Weight Mix",        ID_SOUND_LIGHT_RENDER
+            MENUITEM "Realtime Mix",                ID_SOUND_STRICT_RENDER
+            MENUITEM "Light Weight Mix",            ID_SOUND_LIGHT_RENDER
             MENUITEM SEPARATOR
-            MENUITEM "Volume",                  ID_SOUND_VOLUME
+            MENUITEM "Volume",                      ID_SOUND_VOLUME
         END
         POPUP "Input"
         BEGIN
-            MENUITEM "Joystick #1",             ID_INPUT_JOYSTICK0
-            MENUITEM "Joystick #2",             ID_INPUT_JOYSTICK1
-            MENUITEM "Joystick To Keyboard",    ID_INPUT_JOYTOKEY
+            MENUITEM "Joystick #1",                 ID_INPUT_JOYSTICK0
+            MENUITEM "Joystick #2",                 ID_INPUT_JOYSTICK1
+            MENUITEM "Joystick To Keyboard",        ID_INPUT_JOYTOKEY
         END
         MENUITEM SEPARATOR
         MENUITEM "Use Direct3D9",               ID_HOST_USE_D3D9
@@ -290,7 +289,7 @@ IDI_ICON1               ICON    DISCARDABLE     "pc8001mk2sr.ico"
 // Dialog
 //
 
-IDD_VOLUME DIALOG DISCARDABLE  0, 0, 250, 180
+IDD_VOLUME DIALOG DISCARDABLE  0, 0, 250, 360
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Volume"
 FONT 9, "MS PGothic"
@@ -301,17 +300,35 @@ BEGIN
     LTEXT           "Sound Device #2",IDC_VOLUME_CAPTION1,6,36,60,8
     CONTROL         "",IDC_VOLUME_PARAM_L1,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,36,175,12
     CONTROL         "",IDC_VOLUME_PARAM_R1,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,51,175,12
-    LTEXT           "Sound Device #3",IDC_VOLUME_CAPTION2,6,66,60,8
-    CONTROL         "",IDC_VOLUME_PARAM_L2,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,66,175,12
-    CONTROL         "",IDC_VOLUME_PARAM_R2,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,81,175,12
-    LTEXT           "Sound Device #4",IDC_VOLUME_CAPTION3,6,96,60,8
-    CONTROL         "",IDC_VOLUME_PARAM_L3,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,96,175,12
-    CONTROL         "",IDC_VOLUME_PARAM_R3,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,111,175,12
+    LTEXT           "Sound Device #3",IDC_VOLUME_CAPTION2,6,66,60,8,WS_DISABLED
+    CONTROL         "",IDC_VOLUME_PARAM_L2,"msctls_trackbar32",TBS_AUTOTICKS | WS_DISABLED | WS_TABSTOP,70,66,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R2,"msctls_trackbar32",TBS_AUTOTICKS | WS_DISABLED | WS_TABSTOP,70,81,175,12
+    LTEXT           "Sound Device #4",IDC_VOLUME_CAPTION3,6,96,60,8,WS_DISABLED
+    CONTROL         "",IDC_VOLUME_PARAM_L3,"msctls_trackbar32",TBS_AUTOTICKS | WS_DISABLED | WS_TABSTOP,70,96,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R3,"msctls_trackbar32",TBS_AUTOTICKS | WS_DISABLED | WS_TABSTOP,70,111,175,12
     LTEXT           "Sound Device #5",IDC_VOLUME_CAPTION4,6,126,60,8
     CONTROL         "",IDC_VOLUME_PARAM_L4,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,126,175,12
     CONTROL         "",IDC_VOLUME_PARAM_R4,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,141,175,12
-    DEFPUSHBUTTON   "OK",IDOK,70,160,50,14
-    DEFPUSHBUTTON   "Reset",IDC_VOLUME_RESET,130,160,50,14
+    LTEXT           "Sound Device #6",IDC_VOLUME_CAPTION5,6,156,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L5,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,156,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R5,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,171,175,12
+    LTEXT           "Sound Device #7",IDC_VOLUME_CAPTION6,6,186,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L6,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,186,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R6,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,201,175,12
+    LTEXT           "Sound Device #8",IDC_VOLUME_CAPTION7,6,216,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L7,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,216,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R7,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,231,175,12
+    LTEXT           "Sound Device #9",IDC_VOLUME_CAPTION8,6,246,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L8,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,246,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R8,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,261,175,12
+    LTEXT           "Sound Device #10",IDC_VOLUME_CAPTION9,6,276,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L9,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,276,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R9,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,291,175,12
+    LTEXT           "Sound Device #11",IDC_VOLUME_CAPTION10,6,306,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L10,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,306,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R10,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,321,175,12
+    DEFPUSHBUTTON   "OK",IDOK,70,340,50,14
+    DEFPUSHBUTTON   "Reset",IDC_VOLUME_RESET,130,340,50,14
 END
 
 IDD_JOYSTICK DIALOG DISCARDABLE  0, 0, 175, 120
diff --git a/source/src/res/pc8801.rc b/source/src/res/pc8801.rc
new file mode 100644 (file)
index 0000000..e57c856
--- /dev/null
@@ -0,0 +1,363 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Japanese resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
+#ifdef _WIN32
+LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
+#pragma code_page(932)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+#endif    // Japanese resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Accelerator
+//
+
+IDR_ACCELERATOR1 ACCELERATORS DISCARDABLE 
+BEGIN
+    VK_RETURN,      ID_ACCEL_MOUSE,         VIRTKEY, CONTROL, NOINVERT
+    VK_RETURN,      ID_ACCEL_SCREEN,        VIRTKEY, ALT, NOINVERT
+    VK_APPS,        ID_ACCEL_SPEED,         VIRTKEY, NOINVERT
+    VK_APPS,        ID_ACCEL_ROMAJI,        VIRTKEY, CONTROL, NOINVERT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDR_MENU1 MENU DISCARDABLE 
+BEGIN
+    POPUP "Control"
+    BEGIN
+        MENUITEM "Reset",                       ID_RESET
+        MENUITEM SEPARATOR
+        MENUITEM "CPU x1",                      ID_CPU_POWER0
+        MENUITEM "CPU x2",                      ID_CPU_POWER1
+        MENUITEM "CPU x4",                      ID_CPU_POWER2
+        MENUITEM "CPU x8",                      ID_CPU_POWER3
+        MENUITEM "CPU x16",                     ID_CPU_POWER4
+        MENUITEM "Full Speed",                  ID_FULL_SPEED
+        MENUITEM SEPARATOR
+        MENUITEM "Paste",                       ID_AUTOKEY_START
+        MENUITEM "Stop",                        ID_AUTOKEY_STOP
+        MENUITEM "Romaji to Kana",              ID_ROMAJI_TO_KANA
+        MENUITEM SEPARATOR
+        POPUP "Save State"
+        BEGIN
+            MENUITEM "State 0",                     ID_SAVE_STATE0
+            MENUITEM "State 1",                     ID_SAVE_STATE1
+            MENUITEM "State 2",                     ID_SAVE_STATE2
+            MENUITEM "State 3",                     ID_SAVE_STATE3
+            MENUITEM "State 4",                     ID_SAVE_STATE4
+            MENUITEM "State 5",                     ID_SAVE_STATE5
+            MENUITEM "State 6",                     ID_SAVE_STATE6
+            MENUITEM "State 7",                     ID_SAVE_STATE7
+            MENUITEM "State 8",                     ID_SAVE_STATE8
+            MENUITEM "State 9",                     ID_SAVE_STATE9
+        END
+        POPUP "Load State"
+        BEGIN
+            MENUITEM "State 0",                     ID_LOAD_STATE0
+            MENUITEM "State 1",                     ID_LOAD_STATE1
+            MENUITEM "State 2",                     ID_LOAD_STATE2
+            MENUITEM "State 3",                     ID_LOAD_STATE3
+            MENUITEM "State 4",                     ID_LOAD_STATE4
+            MENUITEM "State 5",                     ID_LOAD_STATE5
+            MENUITEM "State 6",                     ID_LOAD_STATE6
+            MENUITEM "State 7",                     ID_LOAD_STATE7
+            MENUITEM "State 8",                     ID_LOAD_STATE8
+            MENUITEM "State 9",                     ID_LOAD_STATE9
+        END
+        MENUITEM SEPARATOR
+        MENUITEM "Debug Main CPU",              ID_OPEN_DEBUGGER0
+        MENUITEM "Debug PC-80S31K CPU",         ID_OPEN_DEBUGGER1
+        MENUITEM "Close Debugger",              ID_CLOSE_DEBUGGER
+        MENUITEM SEPARATOR
+        MENUITEM "Exit",                        ID_EXIT
+    END
+    POPUP "FD1"
+    BEGIN
+        MENUITEM "Insert",                      ID_OPEN_FD1
+        MENUITEM "Eject",                       ID_CLOSE_FD1
+        MENUITEM "Insert Blank 2D Disk",        ID_OPEN_BLANK_2D_FD1
+        MENUITEM SEPARATOR
+        MENUITEM "Write Protected",             ID_WRITE_PROTECT_FD1
+        MENUITEM "Correct Timing",              ID_CORRECT_TIMING_FD1
+        MENUITEM "Ignore CRC Errors",           ID_IGNORE_CRC_FD1
+        MENUITEM SEPARATOR
+        MENUITEM "Recent",                      ID_RECENT_FD1
+    END
+    POPUP "FD2"
+    BEGIN
+        MENUITEM "Insert",                      ID_OPEN_FD2
+        MENUITEM "Eject",                       ID_CLOSE_FD2
+        MENUITEM "Insert Blank 2D Disk",        ID_OPEN_BLANK_2D_FD2
+        MENUITEM SEPARATOR
+        MENUITEM "Write Protected",             ID_WRITE_PROTECT_FD2
+        MENUITEM "Correct Timing",              ID_CORRECT_TIMING_FD2
+        MENUITEM "Ignore CRC Errors",           ID_IGNORE_CRC_FD2
+        MENUITEM SEPARATOR
+        MENUITEM "Recent",                      ID_RECENT_FD2
+    END
+    POPUP "CMT"
+    BEGIN
+        MENUITEM "Play",                        ID_PLAY_TAPE1
+        MENUITEM "Rec",                         ID_REC_TAPE1
+        MENUITEM "Eject",                       ID_CLOSE_TAPE1
+        MENUITEM SEPARATOR
+        MENUITEM "Recent",                      ID_RECENT_TAPE1
+    END
+    POPUP "Device"
+    BEGIN
+        POPUP "Boot"
+        BEGIN
+            MENUITEM "N88 mode"                 ID_VM_BOOT_MODE0
+            MENUITEM "N mode"                   ID_VM_BOOT_MODE3
+        END
+        POPUP "Sound"
+        BEGIN
+            MENUITEM "Play FDD Noise",              ID_VM_SOUND_NOISE_FDD
+            MENUITEM "Play CMT Noise",              ID_VM_SOUND_NOISE_CMT, GRAYED
+            MENUITEM "Play CMT Sound",              ID_VM_SOUND_PLAY_TAPE, GRAYED
+        END
+        POPUP "Display"
+        BEGIN
+            MENUITEM "Scanline",                    ID_VM_MONITOR_SCANLINE
+        END
+        POPUP "Printer"
+        BEGIN
+            MENUITEM "Write Printer to File",       ID_VM_PRINTER_TYPE0
+            MENUITEM "PC-PR201",                    ID_VM_PRINTER_TYPE1, GRAYED
+            MENUITEM "None",                        ID_VM_PRINTER_TYPE2
+        END
+    END
+    POPUP "Host"
+    BEGIN
+        MENUITEM "Rec Movie 60fps",             ID_HOST_REC_MOVIE_60FPS
+        MENUITEM "Rec Movie 30fps",             ID_HOST_REC_MOVIE_30FPS
+        MENUITEM "Rec Movie 15fps",             ID_HOST_REC_MOVIE_15FPS
+        MENUITEM "Rec Sound",                   ID_HOST_REC_SOUND
+        MENUITEM "Stop",                        ID_HOST_REC_STOP
+        MENUITEM "Capture Screen",              ID_HOST_CAPTURE_SCREEN
+        MENUITEM SEPARATOR
+        POPUP "Screen"
+        BEGIN
+            MENUITEM "Window x1",                   ID_SCREEN_WINDOW
+            MENUITEM "Fullscreen 640x400",          ID_SCREEN_FULLSCREEN
+            MENUITEM SEPARATOR
+            MENUITEM "Window Stretch 1",            ID_SCREEN_WINDOW_STRETCH
+            MENUITEM "Window Stretch 2",            ID_SCREEN_WINDOW_ASPECT
+            MENUITEM SEPARATOR
+            MENUITEM "Fullscreen Stretch 1",        ID_SCREEN_FULLSCREEN_DOTBYDOT
+            MENUITEM "Fullscreen Stretch 2",        ID_SCREEN_FULLSCREEN_STRETCH
+            MENUITEM "Fullscreen Stretch 3",        ID_SCREEN_FULLSCREEN_ASPECT
+            MENUITEM "Fullscreen Stretch 4",        ID_SCREEN_FULLSCREEN_FILL
+            MENUITEM SEPARATOR
+            MENUITEM "Rotate 0deg",                 ID_SCREEN_ROTATE_0
+            MENUITEM "Rotate +90deg",               ID_SCREEN_ROTATE_90
+            MENUITEM "Rotate 180deg",               ID_SCREEN_ROTATE_180
+            MENUITEM "Rotate -90deg",               ID_SCREEN_ROTATE_270
+        END
+        POPUP "Filter"
+        BEGIN
+            MENUITEM "RGB Filter",                  ID_FILTER_RGB
+            MENUITEM "None",                        ID_FILTER_NONE
+        END
+        POPUP "Sound"
+        BEGIN
+            MENUITEM "2000Hz",                      ID_SOUND_FREQ0
+            MENUITEM "4000Hz",                      ID_SOUND_FREQ1
+            MENUITEM "8000Hz",                      ID_SOUND_FREQ2
+            MENUITEM "11025Hz",                     ID_SOUND_FREQ3
+            MENUITEM "22050Hz",                     ID_SOUND_FREQ4
+            MENUITEM "44100Hz",                     ID_SOUND_FREQ5
+            MENUITEM "55467Hz",                     ID_SOUND_FREQ6
+            MENUITEM "96000Hz",                     ID_SOUND_FREQ7
+            MENUITEM SEPARATOR
+            MENUITEM "50msec",                      ID_SOUND_LATE0
+            MENUITEM "100msec",                     ID_SOUND_LATE1
+            MENUITEM "200msec",                     ID_SOUND_LATE2
+            MENUITEM "300msec",                     ID_SOUND_LATE3
+            MENUITEM "400msec",                     ID_SOUND_LATE4
+            MENUITEM SEPARATOR
+            MENUITEM "Realtime Mix",                ID_SOUND_STRICT_RENDER
+            MENUITEM "Light Weight Mix",            ID_SOUND_LIGHT_RENDER
+            MENUITEM SEPARATOR
+            MENUITEM "Volume",                      ID_SOUND_VOLUME
+        END
+        POPUP "Input"
+        BEGIN
+            MENUITEM "Joystick #1",                 ID_INPUT_JOYSTICK0
+            MENUITEM "Joystick #2",                 ID_INPUT_JOYSTICK1
+            MENUITEM "Joystick To Keyboard",        ID_INPUT_JOYTOKEY
+        END
+        MENUITEM SEPARATOR
+        MENUITEM "Use Direct3D9",               ID_HOST_USE_D3D9
+        MENUITEM "Wait Vsync",                  ID_HOST_WAIT_VSYNC
+        MENUITEM "Use DirectInput",             ID_HOST_USE_DINPUT
+        MENUITEM "Disable Windows 8 DWM",       ID_HOST_DISABLE_DWM
+        MENUITEM "Show Status Bar",             ID_HOST_SHOW_STATUS_BAR
+    END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Image
+//
+
+IDI_BITMAP_ACCESS_OFF   BITMAP  DISCARDABLE     "indicator/access_off.bmp"
+IDI_BITMAP_ACCESS_ON    BITMAP  DISCARDABLE     "indicator/access_on.bmp"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON1               ICON    DISCARDABLE     "pc8801.ico"
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_VOLUME DIALOG DISCARDABLE  0, 0, 250, 120
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Volume"
+FONT 9, "MS PGothic"
+BEGIN
+    LTEXT           "Sound Device #1",IDC_VOLUME_CAPTION0,6,6,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L0,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,6,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R0,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,21,175,12
+    LTEXT           "Sound Device #2",IDC_VOLUME_CAPTION1,6,36,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L1,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,36,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R1,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,51,175,12
+    LTEXT           "Sound Device #3",IDC_VOLUME_CAPTION2,6,66,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L2,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,66,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R2,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,81,175,12
+    DEFPUSHBUTTON   "OK",IDOK,70,100,50,14
+    DEFPUSHBUTTON   "Reset",IDC_VOLUME_RESET,130,100,50,14
+END
+
+IDD_JOYSTICK DIALOG DISCARDABLE  0, 0, 175, 120
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Joystick #1"
+FONT 9, "MS PGothic"
+BEGIN
+    LTEXT           "Button #1",IDC_JOYSTICK_CAPTION0,6,6,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM0,50,4,120,14,ES_MULTILINE
+    LTEXT           "Button #2",IDC_JOYSTICK_CAPTION1,6,21,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM1,50,19,120,14,ES_MULTILINE
+    LTEXT           "Button #3",IDC_JOYSTICK_CAPTION2,6,36,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM2,50,34,120,14,ES_MULTILINE
+    LTEXT           "Button #4",IDC_JOYSTICK_CAPTION3,6,51,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM3,50,49,120,14,ES_MULTILINE
+    LTEXT           "Button #5",IDC_JOYSTICK_CAPTION4,6,66,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM4,50,64,120,14,ES_MULTILINE
+    LTEXT           "Button #6",IDC_JOYSTICK_CAPTION5,6,81,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM5,50,79,120,14,ES_MULTILINE
+    DEFPUSHBUTTON   "OK",IDOK,35,100,50,14
+    DEFPUSHBUTTON   "Reset",IDC_JOYSTICK_RESET,90,100,50,14
+END
+
+IDD_JOYTOKEY DIALOG DISCARDABLE  0, 0, 175, 235
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Joystick To Keyboard"
+FONT 9, "MS PGothic"
+BEGIN
+    CONTROL         "Enable Joystick To Keyboard",IDC_JOYTOKEY_CHECK0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,6,164,8
+    CONTROL         "Cursor Key",IDC_JOYTOKEY_RADIO0,"Button",BS_AUTORADIOBUTTON,6,26,164,7
+    CONTROL         "NumPad Key (4-Directions)",IDC_JOYTOKEY_RADIO1,"Button",BS_AUTORADIOBUTTON,6,41,164,7
+    CONTROL         "NumPad Key (8-Directions)",IDC_JOYTOKEY_RADIO2,"Button",BS_AUTORADIOBUTTON,6,56,164,7
+    CONTROL         "Press NumPad 5 To Release Stick",IDC_JOYTOKEY_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,71,164,8
+    LTEXT           "Button #1",IDC_JOYSTICK_CAPTION0,6,91,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM0,50,89,120,14,ES_MULTILINE
+    LTEXT           "Button #2",IDC_JOYSTICK_CAPTION1,6,106,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM1,50,104,120,14,ES_MULTILINE
+    LTEXT           "Button #3",IDC_JOYSTICK_CAPTION2,6,121,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM2,50,119,120,14,ES_MULTILINE
+    LTEXT           "Button #4",IDC_JOYSTICK_CAPTION3,6,136,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM3,50,134,120,14,ES_MULTILINE
+    LTEXT           "Button #5",IDC_JOYSTICK_CAPTION4,6,151,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM4,50,149,120,14,ES_MULTILINE
+    LTEXT           "Button #6",IDC_JOYSTICK_CAPTION5,6,166,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM5,50,164,120,14,ES_MULTILINE
+    LTEXT           "Button #7",IDC_JOYSTICK_CAPTION6,6,181,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM6,50,179,120,14,ES_MULTILINE
+    LTEXT           "Button #8",IDC_JOYSTICK_CAPTION7,6,196,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM7,50,194,120,14,ES_MULTILINE
+    DEFPUSHBUTTON   "OK",IDOK,35,215,50,14
+    DEFPUSHBUTTON   "Reset",IDC_JOYSTICK_RESET,90,215,50,14
+END
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
diff --git a/source/src/res/pc8801mk2.ico b/source/src/res/pc8801mk2.ico
new file mode 100644 (file)
index 0000000..db23482
Binary files /dev/null and b/source/src/res/pc8801mk2.ico differ
diff --git a/source/src/res/pc8801mk2.rc b/source/src/res/pc8801mk2.rc
new file mode 100644 (file)
index 0000000..5d54811
--- /dev/null
@@ -0,0 +1,378 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Japanese resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN)
+#ifdef _WIN32
+LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT
+#pragma code_page(932)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+#endif    // Japanese resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Accelerator
+//
+
+IDR_ACCELERATOR1 ACCELERATORS DISCARDABLE 
+BEGIN
+    VK_RETURN,      ID_ACCEL_MOUSE,         VIRTKEY, CONTROL, NOINVERT
+    VK_RETURN,      ID_ACCEL_SCREEN,        VIRTKEY, ALT, NOINVERT
+    VK_APPS,        ID_ACCEL_SPEED,         VIRTKEY, NOINVERT
+    VK_APPS,        ID_ACCEL_ROMAJI,        VIRTKEY, CONTROL, NOINVERT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDR_MENU1 MENU DISCARDABLE 
+BEGIN
+    POPUP "Control"
+    BEGIN
+        MENUITEM "Reset",                       ID_RESET
+        MENUITEM SEPARATOR
+        MENUITEM "CPU x1",                      ID_CPU_POWER0
+        MENUITEM "CPU x2",                      ID_CPU_POWER1
+        MENUITEM "CPU x4",                      ID_CPU_POWER2
+        MENUITEM "CPU x8",                      ID_CPU_POWER3
+        MENUITEM "CPU x16",                     ID_CPU_POWER4
+        MENUITEM "Full Speed",                  ID_FULL_SPEED
+        MENUITEM SEPARATOR
+        MENUITEM "Paste",                       ID_AUTOKEY_START
+        MENUITEM "Stop",                        ID_AUTOKEY_STOP
+        MENUITEM "Romaji to Kana",              ID_ROMAJI_TO_KANA
+        MENUITEM SEPARATOR
+        POPUP "Save State"
+        BEGIN
+            MENUITEM "State 0",                     ID_SAVE_STATE0
+            MENUITEM "State 1",                     ID_SAVE_STATE1
+            MENUITEM "State 2",                     ID_SAVE_STATE2
+            MENUITEM "State 3",                     ID_SAVE_STATE3
+            MENUITEM "State 4",                     ID_SAVE_STATE4
+            MENUITEM "State 5",                     ID_SAVE_STATE5
+            MENUITEM "State 6",                     ID_SAVE_STATE6
+            MENUITEM "State 7",                     ID_SAVE_STATE7
+            MENUITEM "State 8",                     ID_SAVE_STATE8
+            MENUITEM "State 9",                     ID_SAVE_STATE9
+        END
+        POPUP "Load State"
+        BEGIN
+            MENUITEM "State 0",                     ID_LOAD_STATE0
+            MENUITEM "State 1",                     ID_LOAD_STATE1
+            MENUITEM "State 2",                     ID_LOAD_STATE2
+            MENUITEM "State 3",                     ID_LOAD_STATE3
+            MENUITEM "State 4",                     ID_LOAD_STATE4
+            MENUITEM "State 5",                     ID_LOAD_STATE5
+            MENUITEM "State 6",                     ID_LOAD_STATE6
+            MENUITEM "State 7",                     ID_LOAD_STATE7
+            MENUITEM "State 8",                     ID_LOAD_STATE8
+            MENUITEM "State 9",                     ID_LOAD_STATE9
+        END
+        MENUITEM SEPARATOR
+        MENUITEM "Debug Main CPU",              ID_OPEN_DEBUGGER0
+        MENUITEM "Debug PC-80S31K CPU",         ID_OPEN_DEBUGGER1
+        MENUITEM "Close Debugger",              ID_CLOSE_DEBUGGER
+        MENUITEM SEPARATOR
+        MENUITEM "Exit",                        ID_EXIT
+    END
+    POPUP "FD1"
+    BEGIN
+        MENUITEM "Insert",                      ID_OPEN_FD1
+        MENUITEM "Eject",                       ID_CLOSE_FD1
+        MENUITEM "Insert Blank 2D Disk",        ID_OPEN_BLANK_2D_FD1
+        MENUITEM SEPARATOR
+        MENUITEM "Write Protected",             ID_WRITE_PROTECT_FD1
+        MENUITEM "Correct Timing",              ID_CORRECT_TIMING_FD1
+        MENUITEM "Ignore CRC Errors",           ID_IGNORE_CRC_FD1
+        MENUITEM SEPARATOR
+        MENUITEM "Recent",                      ID_RECENT_FD1
+    END
+    POPUP "FD2"
+    BEGIN
+        MENUITEM "Insert",                      ID_OPEN_FD2
+        MENUITEM "Eject",                       ID_CLOSE_FD2
+        MENUITEM "Insert Blank 2D Disk",        ID_OPEN_BLANK_2D_FD2
+        MENUITEM SEPARATOR
+        MENUITEM "Write Protected",             ID_WRITE_PROTECT_FD2
+        MENUITEM "Correct Timing",              ID_CORRECT_TIMING_FD2
+        MENUITEM "Ignore CRC Errors",           ID_IGNORE_CRC_FD2
+        MENUITEM SEPARATOR
+        MENUITEM "Recent",                      ID_RECENT_FD2
+    END
+    POPUP "CMT"
+    BEGIN
+        MENUITEM "Play",                        ID_PLAY_TAPE1
+        MENUITEM "Rec",                         ID_REC_TAPE1
+        MENUITEM "Eject",                       ID_CLOSE_TAPE1
+        MENUITEM SEPARATOR
+        MENUITEM "Recent",                      ID_RECENT_TAPE1
+    END
+    POPUP "Device"
+    BEGIN
+        POPUP "Boot"
+        BEGIN
+            MENUITEM "N88 mode"                 ID_VM_BOOT_MODE0
+            MENUITEM "N mode"                   ID_VM_BOOT_MODE3
+        END
+        POPUP "Sound"
+        BEGIN
+            MENUITEM "OPN",                     ID_VM_SOUND_TYPE0
+            MENUITEM "OPNA",                    ID_VM_SOUND_TYPE1
+            MENUITEM SEPARATOR
+            MENUITEM "Play FDD Noise",              ID_VM_SOUND_NOISE_FDD
+            MENUITEM "Play CMT Noise",              ID_VM_SOUND_NOISE_CMT, GRAYED
+            MENUITEM "Play CMT Sound",              ID_VM_SOUND_PLAY_TAPE, GRAYED
+        END
+        POPUP "Display"
+        BEGIN
+            MENUITEM "Scanline",                    ID_VM_MONITOR_SCANLINE
+        END
+        POPUP "Printer"
+        BEGIN
+            MENUITEM "Write Printer to File",       ID_VM_PRINTER_TYPE0
+            MENUITEM "PC-PR201",                    ID_VM_PRINTER_TYPE1, GRAYED
+            MENUITEM "None",                        ID_VM_PRINTER_TYPE2
+        END
+    END
+    POPUP "Host"
+    BEGIN
+        MENUITEM "Rec Movie 60fps",             ID_HOST_REC_MOVIE_60FPS
+        MENUITEM "Rec Movie 30fps",             ID_HOST_REC_MOVIE_30FPS
+        MENUITEM "Rec Movie 15fps",             ID_HOST_REC_MOVIE_15FPS
+        MENUITEM "Rec Sound",                   ID_HOST_REC_SOUND
+        MENUITEM "Stop",                        ID_HOST_REC_STOP
+        MENUITEM "Capture Screen",              ID_HOST_CAPTURE_SCREEN
+        MENUITEM SEPARATOR
+        POPUP "Screen"
+        BEGIN
+            MENUITEM "Window x1",                   ID_SCREEN_WINDOW
+            MENUITEM "Fullscreen 640x400",          ID_SCREEN_FULLSCREEN
+            MENUITEM SEPARATOR
+            MENUITEM "Window Stretch 1",            ID_SCREEN_WINDOW_STRETCH
+            MENUITEM "Window Stretch 2",            ID_SCREEN_WINDOW_ASPECT
+            MENUITEM SEPARATOR
+            MENUITEM "Fullscreen Stretch 1",        ID_SCREEN_FULLSCREEN_DOTBYDOT
+            MENUITEM "Fullscreen Stretch 2",        ID_SCREEN_FULLSCREEN_STRETCH
+            MENUITEM "Fullscreen Stretch 3",        ID_SCREEN_FULLSCREEN_ASPECT
+            MENUITEM "Fullscreen Stretch 4",        ID_SCREEN_FULLSCREEN_FILL
+            MENUITEM SEPARATOR
+            MENUITEM "Rotate 0deg",                 ID_SCREEN_ROTATE_0
+            MENUITEM "Rotate +90deg",               ID_SCREEN_ROTATE_90
+            MENUITEM "Rotate 180deg",               ID_SCREEN_ROTATE_180
+            MENUITEM "Rotate -90deg",               ID_SCREEN_ROTATE_270
+        END
+        POPUP "Filter"
+        BEGIN
+            MENUITEM "RGB Filter",                  ID_FILTER_RGB
+            MENUITEM "None",                        ID_FILTER_NONE
+        END
+        POPUP "Sound"
+        BEGIN
+            MENUITEM "2000Hz",                      ID_SOUND_FREQ0
+            MENUITEM "4000Hz",                      ID_SOUND_FREQ1
+            MENUITEM "8000Hz",                      ID_SOUND_FREQ2
+            MENUITEM "11025Hz",                     ID_SOUND_FREQ3
+            MENUITEM "22050Hz",                     ID_SOUND_FREQ4
+            MENUITEM "44100Hz",                     ID_SOUND_FREQ5
+            MENUITEM "55467Hz",                     ID_SOUND_FREQ6
+            MENUITEM "96000Hz",                     ID_SOUND_FREQ7
+            MENUITEM SEPARATOR
+            MENUITEM "50msec",                      ID_SOUND_LATE0
+            MENUITEM "100msec",                     ID_SOUND_LATE1
+            MENUITEM "200msec",                     ID_SOUND_LATE2
+            MENUITEM "300msec",                     ID_SOUND_LATE3
+            MENUITEM "400msec",                     ID_SOUND_LATE4
+            MENUITEM SEPARATOR
+            MENUITEM "Realtime Mix",                ID_SOUND_STRICT_RENDER
+            MENUITEM "Light Weight Mix",            ID_SOUND_LIGHT_RENDER
+            MENUITEM SEPARATOR
+            MENUITEM "Volume",                      ID_SOUND_VOLUME
+        END
+        POPUP "Input"
+        BEGIN
+            MENUITEM "Joystick #1",                 ID_INPUT_JOYSTICK0
+            MENUITEM "Joystick #2",                 ID_INPUT_JOYSTICK1
+            MENUITEM "Joystick To Keyboard",        ID_INPUT_JOYTOKEY
+        END
+        MENUITEM SEPARATOR
+        MENUITEM "Use Direct3D9",               ID_HOST_USE_D3D9
+        MENUITEM "Wait Vsync",                  ID_HOST_WAIT_VSYNC
+        MENUITEM "Use DirectInput",             ID_HOST_USE_DINPUT
+        MENUITEM "Disable Windows 8 DWM",       ID_HOST_DISABLE_DWM
+        MENUITEM "Show Status Bar",             ID_HOST_SHOW_STATUS_BAR
+    END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Image
+//
+
+IDI_BITMAP_ACCESS_OFF   BITMAP  DISCARDABLE     "indicator/access_off.bmp"
+IDI_BITMAP_ACCESS_ON    BITMAP  DISCARDABLE     "indicator/access_on.bmp"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON1               ICON    DISCARDABLE     "pc8801mk2.ico"
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_VOLUME DIALOG DISCARDABLE  0, 0, 250, 240
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Volume"
+FONT 9, "MS PGothic"
+BEGIN
+    LTEXT           "Sound Device #1",IDC_VOLUME_CAPTION0,6,6,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L0,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,6,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R0,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,21,175,12
+    LTEXT           "Sound Device #2",IDC_VOLUME_CAPTION1,6,36,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L1,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,36,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R1,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,51,175,12
+    LTEXT           "Sound Device #3",IDC_VOLUME_CAPTION2,6,66,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L2,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,66,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R2,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,81,175,12
+    LTEXT           "Sound Device #4",IDC_VOLUME_CAPTION3,6,96,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L3,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,96,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R3,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,111,175,12
+    LTEXT           "Sound Device #5",IDC_VOLUME_CAPTION4,6,126,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L4,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,126,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R4,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,141,175,12
+    LTEXT           "Sound Device #6",IDC_VOLUME_CAPTION5,6,156,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L5,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,156,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R5,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,171,175,12
+    LTEXT           "Sound Device #7",IDC_VOLUME_CAPTION6,6,186,60,8
+    CONTROL         "",IDC_VOLUME_PARAM_L6,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,186,175,12
+    CONTROL         "",IDC_VOLUME_PARAM_R6,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,70,201,175,12
+    DEFPUSHBUTTON   "OK",IDOK,70,220,50,14
+    DEFPUSHBUTTON   "Reset",IDC_VOLUME_RESET,130,220,50,14
+END
+
+IDD_JOYSTICK DIALOG DISCARDABLE  0, 0, 175, 120
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Joystick #1"
+FONT 9, "MS PGothic"
+BEGIN
+    LTEXT           "Button #1",IDC_JOYSTICK_CAPTION0,6,6,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM0,50,4,120,14,ES_MULTILINE
+    LTEXT           "Button #2",IDC_JOYSTICK_CAPTION1,6,21,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM1,50,19,120,14,ES_MULTILINE
+    LTEXT           "Button #3",IDC_JOYSTICK_CAPTION2,6,36,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM2,50,34,120,14,ES_MULTILINE
+    LTEXT           "Button #4",IDC_JOYSTICK_CAPTION3,6,51,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM3,50,49,120,14,ES_MULTILINE
+    LTEXT           "Button #5",IDC_JOYSTICK_CAPTION4,6,66,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM4,50,64,120,14,ES_MULTILINE
+    LTEXT           "Button #6",IDC_JOYSTICK_CAPTION5,6,81,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM5,50,79,120,14,ES_MULTILINE
+    DEFPUSHBUTTON   "OK",IDOK,35,100,50,14
+    DEFPUSHBUTTON   "Reset",IDC_JOYSTICK_RESET,90,100,50,14
+END
+
+IDD_JOYTOKEY DIALOG DISCARDABLE  0, 0, 175, 235
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Joystick To Keyboard"
+FONT 9, "MS PGothic"
+BEGIN
+    CONTROL         "Enable Joystick To Keyboard",IDC_JOYTOKEY_CHECK0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,6,164,8
+    CONTROL         "Cursor Key",IDC_JOYTOKEY_RADIO0,"Button",BS_AUTORADIOBUTTON,6,26,164,7
+    CONTROL         "NumPad Key (4-Directions)",IDC_JOYTOKEY_RADIO1,"Button",BS_AUTORADIOBUTTON,6,41,164,7
+    CONTROL         "NumPad Key (8-Directions)",IDC_JOYTOKEY_RADIO2,"Button",BS_AUTORADIOBUTTON,6,56,164,7
+    CONTROL         "Press NumPad 5 To Release Stick",IDC_JOYTOKEY_CHECK1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,6,71,164,8
+    LTEXT           "Button #1",IDC_JOYSTICK_CAPTION0,6,91,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM0,50,89,120,14,ES_MULTILINE
+    LTEXT           "Button #2",IDC_JOYSTICK_CAPTION1,6,106,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM1,50,104,120,14,ES_MULTILINE
+    LTEXT           "Button #3",IDC_JOYSTICK_CAPTION2,6,121,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM2,50,119,120,14,ES_MULTILINE
+    LTEXT           "Button #4",IDC_JOYSTICK_CAPTION3,6,136,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM3,50,134,120,14,ES_MULTILINE
+    LTEXT           "Button #5",IDC_JOYSTICK_CAPTION4,6,151,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM4,50,149,120,14,ES_MULTILINE
+    LTEXT           "Button #6",IDC_JOYSTICK_CAPTION5,6,166,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM5,50,164,120,14,ES_MULTILINE
+    LTEXT           "Button #7",IDC_JOYSTICK_CAPTION6,6,181,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM6,50,179,120,14,ES_MULTILINE
+    LTEXT           "Button #8",IDC_JOYSTICK_CAPTION7,6,196,40,8
+    EDITTEXT        IDC_JOYSTICK_PARAM7,50,194,120,14,ES_MULTILINE
+    DEFPUSHBUTTON   "OK",IDOK,35,215,50,14
+    DEFPUSHBUTTON   "Reset",IDC_JOYSTICK_RESET,90,215,50,14
+END
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
index 30c5ca4..9dae1d8 100644 (file)
@@ -1,7 +1,11 @@
 /*
-       NEC PC-98DO Emulator 'ePC-98DO'
-       NEC PC-8801MA Emulator 'ePC-8801MA'
+       NEC PC-8001 Emulator 'ePC-8001'
+       NEC PC-8001mkII Emulator 'ePC-8001mkII'
        NEC PC-8001mkIISR Emulator 'ePC-8001mkIISR'
+       NEC PC-8801 Emulator 'ePC-8801'
+       NEC PC-8801mkII Emulator 'ePC-8801mkII'
+       NEC PC-8801MA Emulator 'ePC-8801MA'
+       NEC PC-98DO Emulator 'ePC-98DO'
 
        Author : Takeda.Toshiya
        Date   : 2011.12.29-
@@ -14,7 +18,9 @@
 #include "../i8251.h"
 #include "../pcm1bit.h"
 #include "../upd1990a.h"
+#if defined(SUPPORT_PC88_OPN1) || defined(SUPPORT_PC88_OPN2)
 #include "../ym2203.h"
+#endif
 #include "../z80.h"
 
 #ifdef SUPPORT_PC88_CDROM
@@ -51,34 +57,53 @@ namespace PC88DEV
 #define Port30_RS232C  (port[0x30] & 0x20)
 
 #define Port31_MMODE   (port[0x31] & 0x02)
+#ifdef PC8801_VARIANT
 #define Port31_RMODE   (port[0x31] & 0x04)
+#endif
 #define Port31_GRAPH   (port[0x31] & 0x08)
+#if defined(_PC8001SR) || defined(PC8801_VARIANT)
 #define Port31_HCOLOR  (port[0x31] & 0x10)
-#if !defined(_PC8001SR)
+#else
+#define Port31_HCOLOR  false
+#endif
+#ifdef PC8801SR_VARIANT
 #define Port31_400LINE !(port[0x31] & 0x11)
 #else
 #define Port31_400LINE false
 #endif
 
+#ifdef PC8001_VARIANT
 #define Port31_V1_320x200      (port[0x31] & 0x10)     // PC-8001 (V1)
 #define Port31_V1_MONO         (port[0x31] & 0x04)     // PC-8001 (V1)
-
 #define Port31_320x200 (port[0x31] & 0x04)     // PC-8001
+#endif
 
+#if defined(_PC8001SR)
+#define Port32_SINTM   (port[0x33] & 0x02)     // PC-8001SR
+#define Port32_GVAM    (port[0x33] & 0x40)     // PC-8001SR
+#elif defined(PC8801SR_VARIANT)
+#define Port32_GVAM    (port[0x32] & 0x40)
+#define Port32_SINTM   (port[0x32] & 0x80)
+#endif
+#if defined(PC8801SR_VARIANT)
 #define Port32_EROMSL  (port[0x32] & 0x03)
 #define Port32_TMODE   (port[0x32] & 0x10)
-#if !defined(_PC8001SR)
 #define Port32_PMODE   (port[0x32] & 0x20)
 #else
+#define Port32_EROMSL  0
+#define Port32_TMODE   true
 #define Port32_PMODE   false
 #endif
-#define Port32_GVAM    (port[0x32] & 0x40)
-#define Port32_SINTM   (port[0x32] & 0x80)
 
-#define Port33_SINTM   (port[0x33] & 0x02)     // PC-8001
-#define Port33_GVAM    (port[0x33] & 0x40)     // PC-8001
-#define Port33_N80SR   (port[0x33] & 0x80)     // PC-8001
+#ifdef _PC8001SR
+#define Port33_PR1     (port[0x33] & 0x04)     // PC-8001SR
+#define Port33_PR2     (port[0x33] & 0x08)     // PC-8001SR
+//#define Port33_SINTM (port[0x33] & 0x02)     // PC-8001SR -> Port32_SINTM
+//#define Port33_GVAM  (port[0x33] & 0x40)     // PC-8001SR -> Port32_GVAM
+#define Port33_N80SR   (port[0x33] & 0x80)     // PC-8001SR
+#endif
 
+#if defined(_PC8001SR) || defined(PC8801SR_VARIANT)
 #define Port34_ALU     port[0x34]
 
 #define Port35_PLN0    (port[0x35] & 0x01)
@@ -86,32 +111,48 @@ namespace PC88DEV
 #define Port35_PLN2    (port[0x35] & 0x04)
 #define Port35_GDM     (port[0x35] & 0x30)
 #define Port35_GAM     (port[0x35] & 0x80)
+#endif
 
+#if defined(_PC8001SR) || defined(PC8801SR_VARIANT)
 #define Port40_GHSM    (port[0x40] & 0x10)
+#else
+#define Port40_GHSM    false
+#endif
 #define Port40_JOP1    (port[0x40] & 0x40)
 
+#ifdef SUPPORT_PC88_OPN1
 #define Port44_OPNCH   port[0x44]
+#endif
 
 #define Port53_TEXTDS  (port[0x53] & 0x01)
 #define Port53_G0DS    (port[0x53] & 0x02)
 #define Port53_G1DS    (port[0x53] & 0x04)
 #define Port53_G2DS    (port[0x53] & 0x08)
+#if defined(PC8001_VARIANT)
 #define Port53_G3DS    (port[0x53] & 0x10)     // PC-8001
 #define Port53_G4DS    (port[0x53] & 0x20)     // PC-8001
 #define Port53_G5DS    (port[0x53] & 0x40)     // PC-8001
+#endif
 
+#if defined(PC8801_VARIANT)
 #define Port70_TEXTWND port[0x70]
+#endif
 
+#if defined(_PC8001SR) || defined(PC8801_VARIANT)
 #define Port71_EROM    port[0x71]
+#endif
 
 #ifdef SUPPORT_PC88_CDROM
 #define Port99_CDREN   (port[0x99] & 0x10)
 #endif
 
 // XM8 version 1.20
+#ifdef SUPPORT_PC88_OPN2
 #define PortA8_OPNCH   port[0xa8]
 #define PortAA_S2INTM  (port[0xaa] & 0x80)
+#endif
 
+#ifdef PC88_EXRAM_BANKS
 #define PortE2_RDEN    (port[0xe2] & 0x01)
 #define PortE2_WREN    (port[0xe2] & 0x10)
 
@@ -120,14 +161,21 @@ namespace PC88DEV
 #else
 #define PortE3_ERAMSL  (port[0xe3] & 0x0f)
 #endif
+#endif
 
+#ifdef SUPPORT_PC88_KANJI1
 #define PortE8E9_KANJI1        (port[0xe8] | (port[0xe9] << 8))
+#endif
+#ifdef SUPPORT_PC88_KANJI2
 #define PortECED_KANJI2        (port[0xec] | (port[0xed] << 8))
+#endif
 
+#ifdef SUPPORT_PC88_DICTIONARY
 #define PortF0_DICROMSL        (port[0xf0] & 0x1f)
 #define PortF1_DICROM  !(port[0xf1] & 0x01)
+#endif
 
-#if defined(SUPPORT_PC88_VAB)
+#ifdef SUPPORT_PC88_VAB
 // X88000
 #define PortB4_VAB_DISP        ((port[0xb4] & 0x41) == 0x41)
 #define PortE3_VAB_SEL (((port[0xe3] >> 2) & 3) == PC88_VAB_PAGE)
@@ -216,17 +264,25 @@ void PC88::initialize()
 #endif
        memset(gvram, 0, sizeof(gvram));
        memset(gvram_null, 0, sizeof(gvram_null));
+#if defined(PC8801SR_VARIANT)
        memset(tvram, 0, sizeof(tvram));
+#endif
+#if defined(PC8001_VARIANT)
+       memset(n80rom, 0xff, sizeof(n80rom));
 #if defined(_PC8001SR)
-       memset(n80mk2rom, 0xff, sizeof(n80mk2rom));
-       memset(n80mk2srrom, 0xff, sizeof(n80mk2srrom));
+       memset(n80srrom, 0xff, sizeof(n80srrom));
+#endif
 #else
        memset(n88rom, 0xff, sizeof(n88rom));
        memset(n88exrom, 0xff, sizeof(n88exrom));
        memset(n80rom, 0xff, sizeof(n80rom));
 #endif
+//#ifdef SUPPORT_PC88_KANJI1
        memset(kanji1, 0xff, sizeof(kanji1));
+//#endif
+#ifdef SUPPORT_PC88_KANJI2
        memset(kanji2, 0xff, sizeof(kanji2));
+#endif
 #ifdef SUPPORT_PC88_DICTIONARY
        memset(dicrom, 0xff, sizeof(dicrom));
 #endif
@@ -237,15 +293,21 @@ void PC88::initialize()
        
        // load rom images
        FILEIO* fio = new FILEIO();
-#if defined(_PC8001SR)
+#if defined(PC8001_VARIANT)
+#if defined(_PC8001)
+       if(fio->Fopen(create_local_path(_T("N80_1.ROM")), FILEIO_READ_BINARY)) {
+#else
        if(fio->Fopen(create_local_path(_T("N80_2.ROM")), FILEIO_READ_BINARY)) {
-               fio->Fread(n80mk2rom, 0x8000, 1);
+#endif
+               fio->Fread(n80rom, 0x8000, 1);
                fio->Fclose();
        }
+#if defined(_PC8001SR)
        if(fio->Fopen(create_local_path(_T("N80_3.ROM")), FILEIO_READ_BINARY)) {
-               fio->Fread(n80mk2srrom, 0xa000, 1);
+               fio->Fread(n80srrom, 0xa000, 1);
                fio->Fclose();
        }
+#endif
 #else
        if(fio->Fopen(create_local_path(_T("PC88.ROM")), FILEIO_READ_BINARY)) {
                fio->Fread(n88rom, 0x8000, 1);
@@ -281,14 +343,21 @@ void PC88::initialize()
                fio->Fclose();
        }
 #endif
+//#ifdef SUPPORT_PC88_KANJI1
        if(fio->Fopen(create_local_path(_T("KANJI1.ROM")), FILEIO_READ_BINARY)) {
                fio->Fread(kanji1, 0x20000, 1);
                fio->Fclose();
+       } else if(fio->Fopen(create_local_path(_T("FONT.ROM")), FILEIO_READ_BINARY)) {
+               fio->Fread(&(kanji1[0x1000]), 0x800, 1);
+               fio->Fclose();
        }
+//#endif
+#ifdef SUPPORT_PC88_KANJI2
        if(fio->Fopen(create_local_path(_T("KANJI2.ROM")), FILEIO_READ_BINARY)) {
                fio->Fread(kanji2, 0x20000, 1);
                fio->Fclose();
        }
+#endif
 #ifdef SUPPORT_PC88_DICTIONARY
        if(fio->Fopen(create_local_path(_T("JISYO.ROM")), FILEIO_READ_BINARY)) {
                fio->Fread(dicrom, 0x80000, 1);
@@ -296,13 +365,13 @@ void PC88::initialize()
        }
 #endif
 #ifdef SUPPORT_PC88_CDROM
-       if(config.boot_mode == MODE_PC88_V2) {
+//     if(config.boot_mode == MODE_PC88_V2) {
                if(fio->Fopen(create_local_path(_T("CDBIOS.ROM")), FILEIO_READ_BINARY)) {
                        fio->Fread(cdbios, 0x10000, 1);
                        fio->Fclose();
                        cdbios_loaded = true;
                }
-       }
+//     }
 #endif
        delete fio;
        
@@ -380,9 +449,11 @@ void PC88::initialize()
        register_event(this, EVENT_TIMER, 1000000.0 / 600.0, true, NULL);
        register_event(this, EVENT_BEEP, 1000000.0 / 4800.0, true, NULL);
        
-#if !defined(_PC8001SR)
+#if defined(PC8801SR_VARIANT)
        // hack to update config.scan_line at first
        hireso = !(config.monitor_type == 0);
+#else
+       hireso = false;
 #endif
 #ifdef SUPPORT_PC88_CDROM
        cdda_register_id = -1;
@@ -397,9 +468,7 @@ void PC88::release()
 
 void PC88::reset()
 {
-#if defined(_PC8001SR)
-       hireso = false;
-#else
+#if defined(PC8801SR_VARIANT)
        bool value = (config.monitor_type == 0);
        if(hireso != value) {
                // update config.scan_line when config.monitor_type is changed
@@ -418,41 +487,56 @@ void PC88::reset()
 //     port[0x70] = 0x80;      // XM8 version 1.10
        port[0x71] = port[0xf1] = 0xff;
 #if defined(SUPPORT_PC88_CDROM)
-       if (cdbios_loaded) {
-               port[0x99]  = 0x10;
+       if(config.boot_mode == MODE_PC88_V2) {
+               if(cdbios_loaded) {
+                       port[0x99]  = 0x10;
+               }
        }
 #endif
+#if defined(_PC8001SR) || defined(PC8801SR_VARIANT)
        memset(alu_reg, 0, sizeof(alu_reg));
+#endif
        gvram_plane = gvram_sel = 0;
        
+#if defined(PC8001_VARIANT)
 #if defined(_PC8001SR)
        if(config.boot_mode == MODE_PC80_V2) {
-               SET_BANK(0x0000, 0x7fff, wdmy, n80mk2srrom);
+               SET_BANK(0x0000, 0x7fff, wdmy, n80srrom);
                port[0x33] = 0x80;
-       } else {
-               SET_BANK(0x0000, 0x7fff, wdmy, n80mk2rom);
+       } else
+#endif
+       {
+               SET_BANK(0x0000, 0x7fff, wdmy, n80rom);
        }
        SET_BANK(0x8000, 0xffff, ram + 0x8000, ram + 0x8000);
 #else
-//     SET_BANK(0x0000, 0x7fff, ram, n88rom);
-       SET_BANK(0x8000, 0xefff, ram + 0x8000, ram + 0x8000);
-       update_low_memmap();
+       SET_BANK(0x8000, 0xffff, ram + 0x8000, ram + 0x8000);
+       update_low_write();
+       update_low_read();
+#if defined(PC8801SR_VARIANT)
        update_tvram_memmap();  // XM8 version 1.10
 #endif
+#endif
        
        // misc
        usart_dcd = false;
        opn_busy = true;
        
        // memory wait
+#if defined(_PC8001SR) || defined(PC8801SR_VARIANT)
        mem_wait_on = ((config.dipswitch & 1) != 0);
+#else
+       mem_wait_on = true;
+#endif
        
        m1_wait_clocks = get_m1_wait(false);
        f000_m1_wait_clocks = get_m1_wait(true);
        mem_wait_clocks_r = get_main_wait(true);
        mem_wait_clocks_w = get_main_wait(false);
+#if defined(PC8801SR_VARIANT)
        tvram_wait_clocks_r = get_tvram_wait(true);
        tvram_wait_clocks_w = get_tvram_wait(false);
+#endif
        
        // crtc
        memset(&crtc, 0, sizeof(crtc));
@@ -494,9 +578,11 @@ void PC88::reset()
        
        // interrupt
        intr_req = intr_mask1 = intr_mask2 = 0;
-       intr_req_sound = false;
-#ifdef SUPPORT_PC88_SB2
-       intr_req_sb2 = false;
+#ifdef SUPPORT_PC88_OPN1
+       intr_req_opn1 = false;
+#endif
+#ifdef SUPPORT_PC88_OPN2
+       intr_req_opn2 = false;
 #endif
        
        // fdd i/f
@@ -537,7 +623,7 @@ void PC88::write_data8w(uint32_t addr, uint32_t data, int* wait)
        addr &= 0xffff;
        *wait = mem_wait_clocks_w;
        
-#if !defined(_PC8001SR)
+#if defined(PC8801_VARIANT)
        if((addr & 0xfc00) == 0x8000) {
                // text window
                if(!Port31_MMODE && !Port31_RMODE) {
@@ -545,7 +631,11 @@ void PC88::write_data8w(uint32_t addr, uint32_t data, int* wait)
                }
                ram[addr & 0xffff] = data;
                return;
-       } else if((addr & 0xc000) == 0xc000) {
+       }
+#endif
+#if defined(_PC8001MK2) || defined(_PC8001SR) || defined(PC8801_VARIANT)
+#if defined(PC8801_VARIANT)
+       if((addr & 0xc000) == 0xc000) {
 #else
        if((addr & 0xc000) == 0x8000) {
 #endif
@@ -554,6 +644,7 @@ void PC88::write_data8w(uint32_t addr, uint32_t data, int* wait)
                        *wait = gvram_wait_clocks_w;
                        gvram[(addr & 0x3fff) | 0x0000] = data;
                        return;
+#if defined(_PC8001SR) || defined(PC8801_VARIANT)
                case 2:
                        *wait = gvram_wait_clocks_w;
                        gvram[(addr & 0x3fff) | 0x4000] = data;
@@ -562,6 +653,8 @@ void PC88::write_data8w(uint32_t addr, uint32_t data, int* wait)
                        *wait = gvram_wait_clocks_w;
                        gvram[(addr & 0x3fff) | 0x8000] = data;
                        return;
+#endif
+#if defined(_PC8001SR) || defined(PC8801SR_VARIANT)
                case 8:
                        *wait = gvram_wait_clocks_w;
                        addr &= 0x3fff;
@@ -594,9 +687,11 @@ void PC88::write_data8w(uint32_t addr, uint32_t data, int* wait)
                                break;
                        }
                        return;
+#endif
                }
        }
-#if !defined(_PC8001SR)
+#endif
+#if defined(PC8801SR_VARIANT)
        if((addr & 0xf000) == 0xf000) {
                // high speed ram
                *wait += tvram_wait_clocks_w;
@@ -610,38 +705,47 @@ uint32_t PC88::read_data8w(uint32_t addr, int* wait)
        addr &= 0xffff;
        *wait = mem_wait_clocks_r;
        
-#if !defined(_PC8001SR)
+#if defined(PC8801_VARIANT)
        if((addr & 0xfc00) == 0x8000) {
                // text window
                if(!Port31_MMODE && !Port31_RMODE) {
                        addr = (Port70_TEXTWND << 8) + (addr & 0x3ff);
                }
                return ram[addr & 0xffff];
-       } else if((addr & 0xc000) == 0xc000) {
+       }
+#endif
+#if defined(_PC8001MK2) || defined(_PC8001SR) || defined(PC8801_VARIANT)
+#if defined(PC8801_VARIANT)
+       if((addr & 0xc000) == 0xc000) {
 #else
        if((addr & 0xc000) == 0x8000) {
 #endif
-               uint8_t b, r, g;
-               switch(gvram_sel) {
+               switch (gvram_sel) {
                case 1:
                        *wait = gvram_wait_clocks_r;
                        return gvram[(addr & 0x3fff) | 0x0000];
+#if defined(_PC8001SR) || defined(PC8801_VARIANT)
                case 2:
                        *wait = gvram_wait_clocks_r;
                        return gvram[(addr & 0x3fff) | 0x4000];
                case 4:
                        *wait = gvram_wait_clocks_r;
                        return gvram[(addr & 0x3fff) | 0x8000];
+#endif
+#if defined(_PC8001SR) || defined(PC8801SR_VARIANT)
                case 8:
-                       *wait = gvram_wait_clocks_r;
-                       addr &= 0x3fff;
-                       alu_reg[0] = gvram[addr | 0x0000];
-                       alu_reg[1] = gvram[addr | 0x4000];
-                       alu_reg[2] = gvram[addr | 0x8000];
-                       b = alu_reg[0]; if(!Port35_PLN0) b ^= 0xff;
-                       r = alu_reg[1]; if(!Port35_PLN1) r ^= 0xff;
-                       g = alu_reg[2]; if(!Port35_PLN2) g ^= 0xff;
-                       return b & r & g;
+                       {
+                               *wait = gvram_wait_clocks_r;
+                               addr &= 0x3fff;
+                               alu_reg[0] = gvram[addr | 0x0000];
+                               alu_reg[1] = gvram[addr | 0x4000];
+                               alu_reg[2] = gvram[addr | 0x8000];
+                               uint8_t b = alu_reg[0]; if(!Port35_PLN0) b ^= 0xff;
+                               uint8_t r = alu_reg[1]; if(!Port35_PLN1) r ^= 0xff;
+                               uint8_t g = alu_reg[2]; if(!Port35_PLN2) g ^= 0xff;
+                               return b & r & g;
+                       }
+#endif
                }
 #ifdef SUPPORT_PC88_DICTIONARY
                if(PortF1_DICROM) {
@@ -649,7 +753,8 @@ uint32_t PC88::read_data8w(uint32_t addr, int* wait)
                }
 #endif
        }
-#if !defined(_PC8001SR)
+#endif
+#if defined(PC8801SR_VARIANT)
        if((addr & 0xf000) == 0xf000) {
                // high speed ram
                *wait += tvram_wait_clocks_r;
@@ -675,6 +780,38 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
 #ifdef _IO_DEBUG_LOG
        this->out_debug_log(_T("%06x\tOUT8\t%02x,%02x\n"), d_cpu->get_pc(), addr, data);
 #endif
+#if defined(_PC8001) || defined(_PC8001MK2) || defined(_PC8801) || defined(_PC8801MK2)
+       // i/o address is not full-decoded
+       switch(addr) {
+       case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:
+               addr = 0x10;
+               break;
+       case 0x22: case 0x24: case 0x26: case 0x28: case 0x2a: case 0x2c: case 0x2e:
+               addr = 0x20;
+               break;
+       case 0x23: case 0x25: case 0x27: case 0x29: case 0x2b: case 0x2d: case 0x2f:
+               addr = 0x21;
+               break;
+#if defined(_PC8001)
+       case 0x31: case 0x33: case 0x35: case 0x37: case 0x39: case 0x3b: case 0x3d: case 0x3f:
+#endif
+       case 0x32: case 0x34: case 0x36: case 0x38: case 0x3a: case 0x3c: case 0x3e:
+               addr = 0x30;
+               break;
+#if defined(_PC8001MK2) || defined(_PC8801MK2)
+       case 0x33: case 0x35: case 0x37: case 0x39: case 0x3b: case 0x3d: case 0x3f:
+               addr = 0x31;
+               break;
+#endif
+       case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x4f:
+               addr = 0x40;
+               break;
+       // correct ???
+       case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: case 0x6e: case 0x6f:
+               addr &= 0xf7;
+               break;
+       }
+#endif
 #ifdef NIPPY_PATCH
        // dirty patch for NIPPY
        if(addr == 0x31 && data == 0x3f && d_cpu->get_pc() == 0xaa4f && nippy_patch) {
@@ -741,8 +878,8 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
        case 0x0e:
        case 0x0f:
                d_pcg_pit->write_io8(addr & 3, data);
-#endif
                break;
+#endif
        case 0x10:
                d_prn->write_signal(SIG_PRINTER_DATA, data, 0xff);
                d_rtc->write_signal(SIG_UPD1990A_C0, data, 1);
@@ -787,7 +924,8 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
                        }
                }
                break;
-#if defined(_PC8001SR)
+#if defined(PC8001_VARIANT)
+#if defined(_PC8001MK2) || defined(_PC8001SR)
        case 0x31:
                if(mod & 0x03) {
                        update_n80_write();
@@ -800,6 +938,8 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
                        update_palette = true;
                }
                break;
+#endif
+#if defined(_PC8001SR)
        case 0x33:
                if(mod & 0x80) {
                        update_n80_read();
@@ -810,15 +950,16 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
                        update_gvram_sel();
                }
                if(mod & 0x02) {
-                       if(intr_req_sound && !Port33_SINTM) {
+                       if(intr_req_opn1 && !Port32_SINTM) {
                                request_intr(IRQ_SOUND, true);
                        }
                }
                break;
+#endif
 #else
        case 0x31:
                if(mod & 0x06) {
-                       update_low_memmap();
+                       update_low_read();
                }
                if(mod & 0x08) {
                        update_gvram_wait();
@@ -833,10 +974,11 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
                nippy_patch = (data == 0x37 && d_cpu->get_pc() == 0xaa32);
 #endif
                break;
+#if defined(PC8801SR_VARIANT)
        case 0x32:
                if(mod & 0x03) {
                        if(!(Port71_EROM & 1)) {
-                               update_low_memmap();
+                               update_low_read();
                        }
                }
                if(mod & 0x10) {
@@ -850,17 +992,20 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
                        update_gvram_sel();
                }
                if(mod & 0x80) {
-                       if(intr_req_sound && !Port32_SINTM) {
+                       if(intr_req_opn1 && !Port32_SINTM) {
                                request_intr(IRQ_SOUND, true);
                        }
                }
                break;
 #endif
+#endif
+#if defined(_PC8001SR) || defined(PC8801SR_VARIANT)
        case 0x35:
                if(mod & 0x80) {
                        update_gvram_sel();
                }
                break;
+#endif
        case 0x40:
                d_prn->write_signal(SIG_PRINTER_STROBE, data, 1);
                d_rtc->write_signal(SIG_UPD1990A_STB, ~data, 2);
@@ -889,18 +1034,22 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
                sing_signal = ((data & 0x80) != 0);
                d_pcm->write_signal(SIG_PCM1BIT_SIGNAL, ((beep_on && beep_signal) || sing_signal) ? 1 : 0, 1);
                break;
+#ifdef SUPPORT_PC88_OPN1
        case 0x44:
        case 0x45:
-               d_opn->write_io8(addr, data);
+               if(d_opn1 != NULL) {
+                       d_opn1->write_io8(addr, data);
+               }
                break;
 #ifdef SUPPORT_PC88_OPNA
        case 0x46:
        case 0x47:
-               if(d_opn->is_ym2608) {
-                       d_opn->write_io8(addr, data);
+               if(d_opn1 != NULL && d_opn1->is_ym2608) {
+                       d_opn1->write_io8(addr, data);
                }
                break;
 #endif
+#endif
        case 0x50:
                crtc.write_param(data);
                if(crtc.timing_changed) {
@@ -911,7 +1060,7 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
        case 0x51:
                crtc.write_cmd(data);
                break;
-#if !defined(_PC8001SR)
+#if defined(PC8801_VARIANT)
        case 0x52:
                palette[8].b = (data & 0x10) ? 7 : 0;
                palette[8].r = (data & 0x20) ? 7 : 0;
@@ -919,6 +1068,7 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
                update_palette = true;
                break;
 #endif
+#if defined(_PC8001SR) || defined(PC8801_VARIANT)
        case 0x54:
        case 0x55:
        case 0x56:
@@ -927,7 +1077,7 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
        case 0x59:
        case 0x5a:
        case 0x5b:
-#if !defined(_PC8001SR)
+#if defined(PC8801SR_VARIANT)
                if(Port32_PMODE) {
                        int n = (data & 0x80) ? 9 : (addr - 0x54);
                        if(data & 0x40) {
@@ -936,21 +1086,25 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
                                palette[n].b = data & 7;
                                palette[n].r = (data >> 3) & 7;
                        }
-               } else {
+               } else
+#endif
+               {
                        int n = addr - 0x54;
                        palette[n].b = (data & 1) ? 7 : 0;
                        palette[n].r = (data & 2) ? 7 : 0;
                        palette[n].g = (data & 4) ? 7 : 0;
                }
-#endif
                update_palette = true;
                break;
+#endif
+#if defined(_PC8001MK2) || defined(_PC8001SR) || defined(PC8801_VARIANT)
        case 0x5c:
                if(gvram_plane != 1) {
                        gvram_plane = 1;
                        update_gvram_sel();
                }
                break;
+#if defined(_PC8001SR) || defined(PC8801_VARIANT)
        case 0x5d:
                if(gvram_plane != 2) {
                        gvram_plane = 2;
@@ -963,12 +1117,14 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
                        update_gvram_sel();
                }
                break;
+#endif
        case 0x5f:
                if(gvram_plane != 0) {
                        gvram_plane = 0;
                        update_gvram_sel();
                }
                break;
+#endif
        case 0x60:
        case 0x61:
        case 0x62:
@@ -980,30 +1136,18 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
        case 0x68:
                dmac.write_io8(addr, data);
                break;
+#if defined(PC8001_VARIANT)
 #if defined(_PC8001SR)
        case 0x71:
                if((mod & 1) && Port33_N80SR) {
                        update_n80_read();
                }
                break;
-       case 0xe2:
-               if(mod & 0x01) {
-                       update_n80_read();
-               }
-               if(mod & 0x10) {
-                       update_n80_write();
-               }
-               break;
-       case 0xe3:
-               if(mod) {
-                       update_n80_write();
-                       update_n80_read();
-               }
-               break;
+#endif
 #else
        case 0x71:
                if(mod & 0x01) {
-                       update_low_memmap();
+                       update_low_read();
                }
                break;
        case 0x78:
@@ -1093,20 +1237,21 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
                break;
        case 0x99:
                if(cdbios_loaded && (mod & 0x10)) {
-                       update_low_memmap();
+                       update_low_read();
                }
                break;
 #endif
-#ifdef SUPPORT_PC88_SB2
+#endif
+#ifdef SUPPORT_PC88_OPN2
        case 0xa8:
        case 0xa9:
-               if(d_sb2 != NULL) {
-                       d_sb2->write_io8(addr, data);
+               if(d_opn2 != NULL) {
+                       d_opn2->write_io8(addr, data);
                }
                break;
        case 0xaa:
                if(mod & 0x80) {
-                       if(intr_req_sb2 && !PortAA_S2INTM) {
+                       if(intr_req_opn2 && !PortAA_S2INTM) {
                                request_intr(IRQ_SOUND, true);
                        }
                }
@@ -1114,15 +1259,35 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
 #ifdef SUPPORT_PC88_OPNA
        case 0xac:
        case 0xad:
-               if(d_sb2 != NULL && d_sb2->is_ym2608) {
-                       d_sb2->write_io8(addr | 2, data);
+               if(d_opn2 != NULL && d_opn2->is_ym2608) {
+                       d_opn2->write_io8(addr | 2, data);
                }
                break;
 #endif
 #endif
+#if defined(PC88_EXRAM_BANKS)
+#if defined(PC8001_VARIANT)
        case 0xe2:
-               if(mod & 0x11) {
-                       update_low_memmap();
+               if(mod & 0x01) {
+                       update_n80_read();
+               }
+               if(mod & 0x10) {
+                       update_n80_write();
+               }
+               break;
+       case 0xe3:
+               if(mod) {
+                       update_n80_write();
+                       update_n80_read();
+               }
+               break;
+#else
+       case 0xe2:
+               if(mod & 0x01) {
+                       update_low_read();
+               }
+               if(mod & 0x10) {
+                       update_low_write();
                }
                break;
        case 0xe3:
@@ -1131,12 +1296,16 @@ void PC88::write_io8(uint32_t addr, uint32_t data)
 #else
                if(mod & 0x0f) {
 #endif
-                       if(PortE2_RDEN || PortE2_WREN) {
-                               update_low_memmap();
+                       if(PortE2_RDEN) {
+                               update_low_read();
+                       }
+                       if(PortE2_WREN) {
+                               update_low_write();
                        }
                }
                break;
 #endif
+#endif
        case 0xe4:
                intr_mask1 = ~(0xff << (data < 8 ? data : 8));
                update_intr();
@@ -1189,6 +1358,38 @@ uint32_t PC88::read_io8_debug(uint32_t addr)
        uint32_t val = 0xff;
        
        addr &= 0xff;
+#if defined(_PC8001) || defined(_PC8001MK2) || defined(_PC8801) || defined(_PC8801MK2)
+       // i/o address is not full-decoded
+       switch(addr) {
+       case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:
+               addr = 0x10;
+               break;
+       case 0x22: case 0x24: case 0x26: case 0x28: case 0x2a: case 0x2c: case 0x2e:
+               addr = 0x20;
+               break;
+       case 0x23: case 0x25: case 0x27: case 0x29: case 0x2b: case 0x2d: case 0x2f:
+               addr = 0x21;
+               break;
+#if defined(_PC8001)
+       case 0x31: case 0x33: case 0x35: case 0x37: case 0x39: case 0x3b: case 0x3d: case 0x3f:
+#endif
+       case 0x32: case 0x34: case 0x36: case 0x38: case 0x3a: case 0x3c: case 0x3e:
+               addr = 0x30;
+               break;
+#if defined(_PC8001MK2) || defined(_PC8801MK2)
+       case 0x33: case 0x35: case 0x37: case 0x39: case 0x3b: case 0x3d: case 0x3f:
+               addr = 0x31;
+               break;
+#endif
+       case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x4f:
+               addr = 0x40;
+               break;
+       // correct ???
+       case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: case 0x6e: case 0x6f:
+               addr &= 0xf7;
+               break;
+       }
+#endif
        switch(addr) {
        case 0x00:
        case 0x01:
@@ -1200,11 +1401,17 @@ uint32_t PC88::read_io8_debug(uint32_t addr)
        case 0x07:
        case 0x08:
        case 0x09:
+#if defined(_PC8001SR) || defined(PC8801_VARIANT)
        case 0x0a:
+#endif
+#if defined(PC8801_VARIANT)
        case 0x0b:
        case 0x0c:
+#endif
+#if defined(PC8801SR_VARIANT)
        case 0x0d:
        case 0x0e:
+#endif
                for(int i = 0; i < 8; i++) {
                        if(key_status[key_table[addr & 0x0f][i]]) {
                                val &= ~(1 << i);
@@ -1217,13 +1424,19 @@ uint32_t PC88::read_io8_debug(uint32_t addr)
        case 0x20:
        case 0x21:
                return d_sio->read_io8(addr);
-#if defined(_PC8001SR)
+#if defined(PC8001_VARIANT)
+#if defined(_PC8001MK2) || defined(_PC8001SR)
        case 0x30:
                return (config.boot_mode == MODE_PC80_N ? 0 : 1) | (config.boot_mode == MODE_PC80_V2 ? 0 : 2) | 0xfc;
        case 0x31:
                return (config.boot_mode == MODE_PC80_V2 ? 0 : 0x80) | 0x39;
+#endif
+#if defined(_PC8801SR)
+       case 0x32:
+               return port[0x32];
        case 0x33:
                return port[0x33];
+#endif
 #else
        case 0x30:
 //             return (config.boot_mode == MODE_PC88_N ? 0 : 1) | 0xca; // 80x20 (XM8 version 1.00)
@@ -1239,61 +1452,73 @@ uint32_t PC88::read_io8_debug(uint32_t addr)
                // XM8 version 1.10
 //             return (crtc.vblank ? 0x20 : 0) | (d_rtc->read_signal(0) ? 0x10 : 0) | (usart_dcd ? 4 : 0) | (hireso ? 0 : 2) | 0xc1;
                return (crtc.vblank ? 0x20 : 0) | (d_rtc->read_signal(0) ? 0x10 : 0) | (usart_dcd ? 4 : 0) | (hireso ? 0 : 2) | (d_prn->read_signal(SIG_PRINTER_BUSY) ? 1 : 0) | 0xc0;
+#ifdef SUPPORT_PC88_OPN1
        case 0x44:
-               val = d_opn->read_io8(addr);
-               if(opn_busy) {
-                       // show busy flag for first access (for ALPHA)
-                       if(d_cpu->get_pc() == 0xe615) {
-                               val |= 0x80;
+               if(d_opn1 != NULL) {
+                       val = d_opn1->read_io8(addr);
+#ifdef PC8801_VARIANT
+                       if(opn_busy) {
+                               // show busy flag for first access (for ALPHA)
+                               if(d_cpu->get_pc() == 0xe615) {
+                                       val |= 0x80;
+                               }
+                               opn_busy = false;
                        }
-                       opn_busy = false;
+#endif
+                       return val;
                }
-               return val;
+               break;
        case 0x45:
-               if(Port44_OPNCH == 14) {
+               if(d_opn1 != NULL) {
+                       if(Port44_OPNCH == 14) {
 #ifdef SUPPORT_PC88_JOYSTICK
-                       if(config.joystick_type == DEVICE_JOYSTICK) {
-                               return (~(joystick_status[0] >> 0) & 0x0f) | 0xf0;
-                       } else if(config.joystick_type == DEVICE_MOUSE) {
-                               switch(mouse_phase) {
-                               case 0:
-                                       return ((mouse_lx >> 4) & 0x0f) | 0xf0;
-                               case 1:
-                                       return ((mouse_lx >> 0) & 0x0f) | 0xf0;
-                               case 2:
-                                       return ((mouse_ly >> 4) & 0x0f) | 0xf0;
-                               case 3:
-                                       return ((mouse_ly >> 0) & 0x0f) | 0xf0;
+                               if(config.joystick_type == DEVICE_JOYSTICK) {
+                                       return (~(joystick_status[0] >> 0) & 0x0f) | 0xf0;
+                               } else if(config.joystick_type == DEVICE_MOUSE) {
+                                       switch(mouse_phase) {
+                                       case 0:
+                                               return ((mouse_lx >> 4) & 0x0f) | 0xf0;
+                                       case 1:
+                                               return ((mouse_lx >> 0) & 0x0f) | 0xf0;
+                                       case 2:
+                                               return ((mouse_ly >> 4) & 0x0f) | 0xf0;
+                                       case 3:
+                                               return ((mouse_ly >> 0) & 0x0f) | 0xf0;
+                                       }
+                                       return 0xf0; // ???
                                }
-                               return 0xf0; // ???
-                       }
 #endif
-                       return 0xff;
-               } else if(Port44_OPNCH == 15) {
+                               return 0xff;
+                       } else if(Port44_OPNCH == 15) {
 #ifdef SUPPORT_PC88_JOYSTICK
-                       if(config.joystick_type == DEVICE_JOYSTICK) {
-                               return (~(joystick_status[0] >> 4) & 0x03) | 0xfc;
-                       } else if(config.joystick_type == DEVICE_MOUSE) {
-                               return (~mouse_status[2] & 0x03) | 0xfc;
-                       }
+                               if(config.joystick_type == DEVICE_JOYSTICK) {
+                                       return (~(joystick_status[0] >> 4) & 0x03) | 0xfc;
+                               } else if(config.joystick_type == DEVICE_MOUSE) {
+                                       return (~mouse_status[2] & 0x03) | 0xfc;
+                               }
 #endif
-                       return 0xff;
+                               return 0xff;
+                       }
+                       return d_opn1->read_io8(addr);
                }
-               return d_opn->read_io8(addr);
+               break;
 #ifdef SUPPORT_PC88_OPNA
        case 0x46:
        case 0x47:
-               if(d_opn->is_ym2608) {
-                       return d_opn->read_io8(addr);
+               if(d_opn1 != NULL && d_opn1->is_ym2608) {
+                       return d_opn1->read_io8(addr);
                }
                break;
 #endif
+#endif
        case 0x50:
                return crtc.read_param();
        case 0x51:
                return crtc.read_status();
+#if defined(_PC8001SR) || defined(PC8801_VARIANT)
        case 0x5c:
                return gvram_plane | 0xf8;
+#endif
        case 0x60:
        case 0x61:
        case 0x62:
@@ -1304,20 +1529,24 @@ uint32_t PC88::read_io8_debug(uint32_t addr)
        case 0x67:
        case 0x68:
                return dmac.read_io8(addr);
+#if defined(PC8801SR_VARIANT)
        case 0x6e:
                // XM8 version 1.20
                return (cpu_clock_low ? 0x80 : 0) | (is_sr_mr() ? 0x7f : 0x10);
        case 0x6f:
                // XM8 version 1.20
                return is_sr_mr() ? 0xff : (port[0x6f] | 0xf0);
-#if !defined(_PC8001SR)
+#endif
+#if defined(PC8801_VARIANT)
        case 0x70:
                // PC-8001mkIISR returns the constant value
                // this port is used to detect PC-8001mkIISR or 8801mkIISR
                return port[0x70];
 #endif
+#if defined(_PC8001SR) || defined(PC8801_VARIANT)
        case 0x71:
                return port[0x71];
+#endif
 #ifdef SUPPORT_PC88_HMB20
 //     case 0x88:
        case 0x89:
@@ -1374,14 +1603,14 @@ uint32_t PC88::read_io8_debug(uint32_t addr)
                }
                break;
 #endif
-#ifdef SUPPORT_PC88_SB2
+#ifdef SUPPORT_PC88_OPN2
        case 0xa8:
-               if(d_sb2 != NULL) {
-                       return d_sb2->read_io8(addr);
+               if(d_opn2 != NULL) {
+                       return d_opn2->read_io8(addr);
                }
                break;
        case 0xa9:
-               if(d_sb2 != NULL) {
+               if(d_opn2 != NULL) {
                        if(PortA8_OPNCH == 14) {
 #ifdef SUPPORT_PC88_JOYSTICK
                                if(config.joystick_type == DEVICE_JOYSTICK) {
@@ -1411,7 +1640,7 @@ uint32_t PC88::read_io8_debug(uint32_t addr)
 #endif
                                return 0xff;
                        }
-                       return d_sb2->read_io8(addr);
+                       return d_opn2->read_io8(addr);
                }
                break;
        case 0xaa:
@@ -1419,8 +1648,8 @@ uint32_t PC88::read_io8_debug(uint32_t addr)
 #ifdef SUPPORT_PC88_OPNA
        case 0xac:
        case 0xad:
-               if(d_sb2 != NULL && d_sb2->is_ym2608) {
-                       d_sb2->read_io8(addr | 2);
+               if(d_opn2 != NULL && d_opn2->is_ym2608) {
+                       d_opn2->read_io8(addr | 2);
                }
                break;
 #endif
@@ -1434,6 +1663,7 @@ uint32_t PC88::read_io8_debug(uint32_t addr)
                }
                break;
 #endif
+#if defined(PC88_EXRAM_BANKS)
        case 0xe2:
                return (~port[0xe2]) | 0xee;
        case 0xe3:
@@ -1442,14 +1672,19 @@ uint32_t PC88::read_io8_debug(uint32_t addr)
 #else
                return port[0xe3] | 0xf0;
 #endif
+#endif
+#ifdef SUPPORT_PC88_KANJI1
        case 0xe8:
                return kanji1[PortE8E9_KANJI1 * 2 + 1];
        case 0xe9:
                return kanji1[PortE8E9_KANJI1 * 2];
+#endif
+#ifdef SUPPORT_PC88_KANJI2
        case 0xec:
                return kanji2[PortECED_KANJI2 * 2 + 1];
        case 0xed:
                return kanji2[PortECED_KANJI2 * 2];
+#endif
        case 0xfc:
        case 0xfd:
        case 0xfe:
@@ -1461,15 +1696,12 @@ uint32_t PC88::read_io8_debug(uint32_t addr)
 uint32_t PC88::read_dma_data8(uint32_t addr)
 {
        // from ram
-#if defined(_PC8001SR)
-       return ram[addr & 0xffff];
-#else
+#if defined(PC8801SR_VARIANT)
        if((addr & 0xf000) == 0xf000 && (config.boot_mode == MODE_PC88_V1H || config.boot_mode == MODE_PC88_V2)) {
                return tvram[addr & 0xfff];
-       } else {
-               return ram[addr & 0xffff];
        }
 #endif
+       return ram[addr & 0xffff];
 }
 
 void PC88::write_dma_data8(uint32_t addr, uint32_t data)
@@ -1500,7 +1732,7 @@ int PC88::get_m1_wait(bool addr_f000)
        // XM8 version 1.20
        int wait = 0;
        
-#if defined(_PC8001SR)
+#if defined(PC8001_VARIANT)
        if(config.boot_mode == MODE_PC80_V1 || config.boot_mode == MODE_PC80_N) {
 #else
        if(config.boot_mode == MODE_PC88_V1S || config.boot_mode == MODE_PC88_N) {
@@ -1531,7 +1763,7 @@ int PC88::get_m1_wait(bool addr_f000)
        return wait;
 }
 
-int  PC88::get_main_wait(bool read)
+int PC88::get_main_wait(bool read)
 {
        // XM8 version 1.20
        int wait = 0;
@@ -1546,7 +1778,7 @@ int  PC88::get_main_wait(bool read)
                }
        } else {
                // 8MHz
-#if !defined(_PC8001SR)
+#if defined(PC8801SR_VARIANT)
                if(!cpu_clock_high_fe2) {
                        // not 8MHzH
                        wait += 1;
@@ -1560,6 +1792,7 @@ int  PC88::get_main_wait(bool read)
        return wait;
 }
 
+#if defined(PC8801SR_VARIANT)
 int PC88::get_tvram_wait(bool read)
 {
        int wait = 0;
@@ -1584,8 +1817,9 @@ int PC88::get_tvram_wait(bool read)
        }
        return wait;
 }
+#endif
 
-int  PC88::get_gvram_wait(bool read)
+int PC88::get_gvram_wait(bool read)
 {
        // XM8 version 1.20
        int wait = 0;
@@ -1594,7 +1828,7 @@ int  PC88::get_gvram_wait(bool read)
                // graphic on
                if(cpu_clock_low) {
                        // 4MHz
-#if defined(_PC8001SR)
+#if defined(PC8001_VARIANT)
                        if(config.boot_mode == MODE_PC80_V1 || config.boot_mode == MODE_PC80_N) {
 #else
                        if(config.boot_mode == MODE_PC88_V1S || config.boot_mode == MODE_PC88_N) {
@@ -1622,10 +1856,9 @@ int  PC88::get_gvram_wait(bool read)
                                        wait += 2;
                                }
                        }
-               }
-               else {
+               } else {
                        // 8MHz
-#if defined(_PC8001SR)
+#if defined(PC8001_VARIANT)
                        if(config.boot_mode == MODE_PC80_V1 || config.boot_mode == MODE_PC80_N) {
 #else
                        if(config.boot_mode == MODE_PC88_V1S || config.boot_mode == MODE_PC88_N) {
@@ -1680,87 +1913,99 @@ void PC88::update_gvram_wait()
 
 void PC88::update_gvram_sel()
 {
-#if defined(_PC8001SR)
-       if(Port33_GVAM) {
-#else
+#if defined(_PC8001SR) || defined(PC8801SR_VARIANT)
        if(Port32_GVAM) {
-#endif
                if(Port35_GAM) {
                        gvram_sel = 8;
                } else {
                        gvram_sel = 0;
                }
                gvram_plane = 0; // from M88
-       } else {
+       } else
+#endif
+       {
                gvram_sel = gvram_plane;
        }
        f000_m1_wait_clocks = get_m1_wait(true);
 }
 
-#if defined(_PC8001SR)
+#if defined(PC8001_VARIANT)
 void PC88::update_n80_write()
 {
+#if defined(PC88_EXRAM_BANKS)
        if(PortE2_WREN || Port31_MMODE) {
                if(PortE3_ERAMSL < PC88_EXRAM_BANKS) {
                        SET_BANK_W(0x0000, 0x7fff, exram + 0x8000 * PortE3_ERAMSL);
                } else {
                        SET_BANK_W(0x0000, 0x7fff, exram);
                }
-       } else {
-               SET_BANK_W(0x0000, 0x7fff, wdmy);
+               return;
        }
+#endif
+       SET_BANK_W(0x0000, 0x7fff, wdmy);
 }
 
 void PC88::update_n80_read()
 {
+#if defined(PC88_EXRAM_BANKS)
        if(PortE2_RDEN || Port31_MMODE) {
                if(PortE3_ERAMSL < PC88_EXRAM_BANKS) {
                        SET_BANK_R(0x0000, 0x7fff, exram + 0x8000 * PortE3_ERAMSL);
                } else {
                        SET_BANK_R(0x0000, 0x7fff, exram);
                }
-       } else if(Port33_N80SR) {
+               return;
+       }
+#endif
+#if defined(_PC8001SR)
+       if(Port33_N80SR) {
                if(port[0x71] & 1) {
-                       SET_BANK_R(0x0000, 0x7fff, n80mk2srrom);
-               } else {
-                       SET_BANK_R(0x0000, 0x5fff, n80mk2srrom);
-                       SET_BANK_R(0x6000, 0x7fff, n80mk2srrom + 0x8000);
-               }
-       } else {
-               if(port[0x31] & 1) {
-                       SET_BANK_R(0x0000, 0x7fff, n80mk2rom);
+                       SET_BANK_R(0x0000, 0x7fff, n80srrom);
                } else {
-                       SET_BANK_R(0x0000, 0x5fff, n80mk2rom);
-                       SET_BANK_R(0x6000, 0x7fff, rdmy);
+                       SET_BANK_R(0x0000, 0x5fff, n80srrom);
+                       SET_BANK_R(0x6000, 0x7fff, n80srrom + 0x8000);
                }
+               return;
+       }
+#endif
+#if defined(_PC8001MK2) || defined(_PC8001SR)
+       if(!(port[0x31] & 1)) {
+               SET_BANK_R(0x0000, 0x5fff, n80rom);
+               SET_BANK_R(0x6000, 0x7fff, rdmy);
+               return;
        }
+#endif
+       SET_BANK_R(0x0000, 0x7fff, n80rom);
 }
 #else
-void PC88::update_low_memmap()
+void PC88::update_low_read()
 {
-       // read
+#if defined(PC88_EXRAM_BANKS)
        if(PortE2_RDEN) {
-#ifdef PC88_EXRAM_BANKS
                if(PortE3_ERAMSL < PC88_EXRAM_BANKS) {
                        SET_BANK_R(0x0000, 0x7fff, exram + 0x8000 * PortE3_ERAMSL);
                } else {
-#endif
 //                     SET_BANK_R(0x0000, 0x7fff, rdmy);
-#ifdef PC88_EXRAM_BANKS
                }
+               return;
+       }
 #endif
-       } else if(Port31_MMODE) {
+       if(Port31_MMODE) {
                // 64K RAM
                SET_BANK_R(0x0000, 0x7fff, ram);
+               return;
+       }
 #ifdef SUPPORT_PC88_CDROM
-       } else if(cdbios_loaded && Port99_CDREN) {
+       if(cdbios_loaded && Port99_CDREN) {
                if(Port31_RMODE) {
                        SET_BANK_R(0x0000, 0x7fff, cdbios + 0x8000);
                } else {
                        SET_BANK_R(0x0000, 0x7fff, cdbios + 0x0000);
                }
+               return;
+       }
 #endif
-       } else if(Port31_RMODE) {
+       if(Port31_RMODE) {
                // N-BASIC
                SET_BANK_R(0x0000, 0x7fff, n80rom);
        } else {
@@ -1772,24 +2017,25 @@ void PC88::update_low_memmap()
                        SET_BANK_R(0x6000, 0x7fff, n88exrom + 0x2000 * Port32_EROMSL);
                }
        }
-       
-       // write
+}
+
+void PC88::update_low_write()
+{
+#if defined(PC88_EXRAM_BANKS)
        if(PortE2_WREN) {
-#ifdef PC88_EXRAM_BANKS
                if(PortE3_ERAMSL < PC88_EXRAM_BANKS) {
                        SET_BANK_W(0x0000, 0x7fff, exram + 0x8000 * PortE3_ERAMSL);
                } else {
-#endif
 //                     SET_BANK_W(0x0000, 0x7fff, wdmy);
                        SET_BANK_W(0x0000, 0x7fff, ram);
-#ifdef PC88_EXRAM_BANKS
                }
-#endif
-       } else {
-               SET_BANK_W(0x0000, 0x7fff, ram);
+               return;
        }
+#endif
+       SET_BANK_W(0x0000, 0x7fff, ram);
 }
 
+#if defined(PC8801SR_VARIANT)
 void PC88::update_tvram_memmap()
 {
        // XM8 version 1.10
@@ -1800,24 +2046,23 @@ void PC88::update_tvram_memmap()
        }
 }
 #endif
+#endif
 
 void PC88::write_signal(int id, uint32_t data, uint32_t mask)
 {
        if(id == SIG_PC88_USART_IRQ) {
                request_intr(IRQ_USART, ((data & mask) != 0));
-       } else if(id == SIG_PC88_SOUND_IRQ) {
-               intr_req_sound = ((data & mask) != 0);
-#if defined(_PC8001SR)
-               if(intr_req_sound && !Port33_SINTM) {
-#else
-               if(intr_req_sound && !Port32_SINTM) {
-#endif
+#ifdef SUPPORT_PC88_OPN1
+       } else if(id == SIG_PC88_OPN1_IRQ) {
+               intr_req_opn1 = ((data & mask) != 0);
+               if(intr_req_opn1 && !Port32_SINTM) {
                        request_intr(IRQ_SOUND, true);
                }
-#ifdef SUPPORT_PC88_SB2
-       } else if(id == SIG_PC88_SB2_IRQ) {
-               intr_req_sb2 = ((data & mask) != 0);
-               if(intr_req_sb2 && !PortAA_S2INTM) {
+#endif
+#ifdef SUPPORT_PC88_OPN2
+       } else if(id == SIG_PC88_OPN2_IRQ) {
+               intr_req_opn2 = ((data & mask) != 0);
+               if(intr_req_opn2 && !PortAA_S2INTM) {
                        request_intr(IRQ_SOUND, true);
                }
 #endif
@@ -1963,7 +2208,7 @@ void PC88::event_vline(int v, int clock)
        if(v < disp_line) {
                if(/*(crtc.status & 0x10) && */dmac.ch[2].running) {
                        // bus request
-#if defined(_PC8001SR)
+#if defined(PC8001_VARIANT)
                        if(config.boot_mode == MODE_PC80_V1 || config.boot_mode == MODE_PC80_N) {
 #else
                        if(config.boot_mode == MODE_PC88_V1S || config.boot_mode == MODE_PC88_N) {
@@ -1990,7 +2235,7 @@ void PC88::event_vline(int v, int clock)
                update_gvram_wait();
        }
        // update palette
-#if !defined(_PC8001SR)
+#if defined(PC8801SR_VARIANT)
        if(v < (disp_line <= 200 ? 200 : 400)) {
 #else
        if(v < 200) {
@@ -2010,8 +2255,10 @@ void PC88::event_vline(int v, int clock)
                        for(int i = 0; i < 9; i++) {
                                palette_digital[i] = palette_analog[i] = initial[i];
                        }
+#if defined(PC8001_VARIANT)
 #if defined(_PC8001SR)
                        if(config.boot_mode != MODE_PC80_V2) {
+#endif
                                if(Port31_V1_320x200) {
                                        for(int i = 0; i < 3; i++) {
                                                palette_analog[i].b = (port[0x31] & 4) ? 7 : 0;
@@ -2035,6 +2282,7 @@ void PC88::event_vline(int v, int clock)
                                } else {
                                        palette_digital[0] = palette_analog[0];
                                }
+#if defined(_PC8001SR)
                        } else {
                                for(int i = 0; i < 8; i++) {
                                        palette_analog[i].b = (port[0x54 + i] & 1) ? 7 : 0;
@@ -2046,6 +2294,7 @@ void PC88::event_vline(int v, int clock)
                                }
                                palette_digital[0] = palette_analog[0];
                        }
+#endif
 #else
                        for(int i = 0; i < 8; i++) {
                                palette_analog[i] = palette[i];
@@ -2215,8 +2464,13 @@ void PC88::draw_screen()
        // render graph screen
        bool disp_color_graph = true;
        bool draw_scanline_black = config.scan_line;
+#if defined(PC8001_VARIANT)
 #if defined(_PC8001SR)
        if(config.boot_mode != MODE_PC80_V2) {
+#endif
+#if defined(_PC8001)
+               memset(graph, 0, sizeof(graph));
+#else
                if(Port31_V1_320x200) {
                        disp_color_graph = draw_320x200_4color_graph();
                } else if(Port31_V1_MONO) {
@@ -2227,7 +2481,9 @@ void PC88::draw_screen()
                        }
                        draw_640x200_attrib_graph();
                }
+#endif
                emu->set_vm_screen_lines(200);
+#if defined(_PC8001SR)
        } else {
                if(Port31_HCOLOR) {
                        if(Port31_320x200) {
@@ -2248,29 +2504,32 @@ void PC88::draw_screen()
                        emu->set_vm_screen_lines(200);
                }
        }
+#endif
 #else
        if(Port31_HCOLOR) {
                disp_color_graph = draw_640x200_color_graph();
                emu->set_vm_screen_lines(200);
-       } else if(!Port31_400LINE) {
+#if defined(PC8801SR_VARIANT)
+       } else if (Port31_400LINE) {
                if(hireso) {
                        draw_scanline_black = false;
                }
-               draw_640x200_attrib_graph();
-//             draw_640x200_mono_graph();
-               emu->set_vm_screen_lines(200);
+               draw_640x400_attrib_graph();
+//             draw_640x400_mono_graph();
+               emu->set_vm_screen_lines(400);
+#endif
        } else {
                if(hireso) {
                        draw_scanline_black = false;
                }
-               draw_640x400_attrib_graph();
-//             draw_640x400_mono_graph();
-               emu->set_vm_screen_lines(400);
+               draw_640x200_attrib_graph();
+//             draw_640x200_mono_graph();
+               emu->set_vm_screen_lines(200);
        }
 #endif
        
        // create palette for each scanline
-#if !defined(_PC8001SR)
+#if defined(PC8801SR_VARIANT)
        int disp_line = crtc.height * crtc.char_height;
        int ymax = (disp_line <= 200) ? 200 : 400;
 #else
@@ -2286,7 +2545,7 @@ void PC88::draw_screen()
        
        scrntype_t palette_line_digital_text_pc [400][9];
        scrntype_t palette_line_analog_graph_pc [400][9];
-#if !defined(_PC8001SR)
+#if defined(PC8801_VARIANT)
        scrntype_t palette_line_analog_text_pc  [400][9];
        scrntype_t palette_line_digital_graph_pc[400][9];
 #endif
@@ -2316,7 +2575,7 @@ void PC88::draw_screen()
                                palette_line_digital_text_pc [2 * y + 1][i] = palette_digital_text_pc [i];
                                palette_line_analog_graph_pc [2 * y    ][i] = 
                                palette_line_analog_graph_pc [2 * y + 1][i] = palette_analog_graph_pc [i];
-#if !defined(_PC8001SR)
+#if defined(PC8801_VARIANT)
                                palette_line_analog_text_pc  [2 * y    ][i] = 
                                palette_line_analog_text_pc  [2 * y + 1][i] = palette_analog_text_pc  [i];
                                palette_line_digital_graph_pc[2 * y    ][i] = 
@@ -2327,7 +2586,7 @@ void PC88::draw_screen()
                        for(int i = 0; i < 9; i++) {
                                palette_line_digital_text_pc [y][i] = palette_digital_text_pc [i];
                                palette_line_analog_graph_pc [y][i] = palette_analog_graph_pc [i];
-#if !defined(_PC8001SR)
+#if defined(PC8801_VARIANT)
                                palette_line_analog_text_pc  [y][i] = palette_analog_text_pc  [i];
                                palette_line_digital_graph_pc[y][i] = palette_digital_graph_pc[i];
 #endif
@@ -2336,7 +2595,7 @@ void PC88::draw_screen()
        }
        
        // copy to screen buffer
-#if !defined(_PC8001SR)
+#if defined(PC8801SR_VARIANT)
 #if defined(SUPPORT_PC88_VAB)
        // X88000
        if(PortB4_VAB_DISP) {
@@ -2395,17 +2654,20 @@ void PC88::draw_screen()
                        uint8_t* src_g = graph[y];
                        scrntype_t* pal_t;
                        scrntype_t* pal_g;
-#if defined(_PC8001SR)
+#if defined(PC8001_VARIANT)
                        pal_t = palette_line_digital_text_pc[y];
                        pal_g = palette_line_analog_graph_pc[y];
                        
-                       if(port[0x33] & 8) {
+#if defined(_PC8001SR)
+                       if(Port33_PR2) {
                                for(int x = 0; x < 640; x++) {
                                        uint32_t t = src_t[x];
                                        uint32_t g = src_g[x];
                                        dest[x] = (!g && t) ? pal_t[t] : ((y & 1) && draw_scanline_black) ? 0 : pal_g[g];
                                }
-                       } else {
+                       } else
+#endif
+                       {
                                for(int x = 0; x < 640; x++) {
                                        uint32_t t = src_t[x];
                                        dest[x] = t ? pal_t[t] : ((y & 1) && draw_scanline_black) ? 0 : pal_g[src_g[x]];
@@ -2552,6 +2814,7 @@ void PC88::draw_text()
        }
 }
 
+#if defined(PC8001_VARIANT)
 #if defined(_PC8001SR)
 bool PC88::draw_320x200_color_graph()
 {
@@ -2566,7 +2829,7 @@ bool PC88::draw_320x200_color_graph()
        uint8_t *gvram_r1 = Port53_G1DS ? gvram_null : (gvram + 0x6000);
        uint8_t *gvram_g1 = Port53_G1DS ? gvram_null : (gvram + 0xa000);
        
-       if(port[0x33] & 4) {
+       if(Port33_PR1) {
                // G1>G0
                uint8_t *tmp;
                tmp = gvram_b0; gvram_b0 = gvram_b1; gvram_b1 = tmp;
@@ -2618,6 +2881,7 @@ bool PC88::draw_320x200_color_graph()
        }
        return true;
 }
+#endif
 
 bool PC88::draw_320x200_4color_graph()
 {
@@ -2871,7 +3135,7 @@ void PC88::draw_640x200_attrib_graph()
        }
 }
 
-#if !defined(_PC8001SR)
+#if defined(PC8801SR_VARIANT)
 void PC88::draw_640x400_mono_graph()
 {
        if(!Port31_GRAPH || (Port53_G0DS && Port53_G1DS)) {
@@ -3305,10 +3569,10 @@ void pc88_dmac_t::write_io8(uint32_t addr, uint32_t data)
        int c = (addr >> 1) & 3;
        
        switch(addr & 0x0f) {
-       case 0:
-       case 2:
-       case 4:
-       case 6:
+       case 0x00:
+       case 0x02: case 0x0a:
+       case 0x04: case 0x0c:
+       case 0x06: case 0x0e:
                if(!high_low) {
                        if((mode & 0x80) && c == 2) {
                                ch[3].addr.b.l = data;
@@ -3324,10 +3588,10 @@ void pc88_dmac_t::write_io8(uint32_t addr, uint32_t data)
                }
                high_low = !high_low;
                break;
-       case 1:
-       case 3:
-       case 5:
-       case 7:
+       case 0x01: case 0x09:
+       case 0x03: case 0x0b:
+       case 0x05: case 0x0d:
+       case 0x07: case 0x0f:
                if(!high_low) {
                        if((mode & 0x80) && c == 2) {
                                ch[3].count.b.l = data;
@@ -3345,7 +3609,7 @@ void pc88_dmac_t::write_io8(uint32_t addr, uint32_t data)
                }
                high_low = !high_low;
                break;
-       case 8:
+       case 0x08:
                mode = data;
                high_low = false;
                break;
@@ -3358,10 +3622,10 @@ uint32_t pc88_dmac_t::read_io8(uint32_t addr)
        int c = (addr >> 1) & 3;
        
        switch(addr & 0x0f) {
-       case 0:
-       case 2:
-       case 4:
-       case 6:
+       case 0x00:
+       case 0x02: case 0x0a:
+       case 0x04: case 0x0c:
+       case 0x06: case 0x0e:
                if(!high_low) {
                        val = ch[c].addr.b.l;
                } else {
@@ -3369,10 +3633,10 @@ uint32_t pc88_dmac_t::read_io8(uint32_t addr)
                }
                high_low = !high_low;
                break;
-       case 1:
-       case 3:
-       case 5:
-       case 7:
+       case 0x01: case 0x09:
+       case 0x03: case 0x0b:
+       case 0x05: case 0x0d:
+       case 0x07: case 0x0f:
                if(!high_low) {
                        val = ch[c].count.b.l;
                } else {
@@ -3380,7 +3644,7 @@ uint32_t pc88_dmac_t::read_io8(uint32_t addr)
                }
                high_low = !high_low;
                break;
-       case 8:
+       case 0x08:
                val = status;
                status &= 0xf0;
 //             high_low = false;
@@ -3446,7 +3710,7 @@ void pc88_dmac_t::finish(int c)
        }
 }
 
-#define STATE_VERSION  10
+#define STATE_VERSION  11
 
 bool PC88::process_state(FILEIO* state_fio, bool loading)
 {
@@ -3461,7 +3725,9 @@ bool PC88::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateArray(exram, sizeof(exram), 1);
 #endif
        state_fio->StateArray(gvram, sizeof(gvram), 1);
+#if defined(PC8801SR_VARIANT)
        state_fio->StateArray(tvram, sizeof(tvram), 1);
+#endif
        state_fio->StateArray(port, sizeof(port), 1);
        state_fio->StateValue(crtc.blink.rate);
        state_fio->StateValue(crtc.blink.counter);
@@ -3500,7 +3766,9 @@ bool PC88::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateValue(dmac.mode);
        state_fio->StateValue(dmac.status);
        state_fio->StateValue(dmac.high_low);
+#if defined(_PC8001SR) || defined(PC8801SR_VARIANT)
        state_fio->StateArray(alu_reg, sizeof(alu_reg), 1);
+#endif
        state_fio->StateValue(gvram_plane);
        state_fio->StateValue(gvram_sel);
        state_fio->StateValue(cpu_clock_low);
@@ -3512,8 +3780,10 @@ bool PC88::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateValue(f000_m1_wait_clocks);
        state_fio->StateValue(mem_wait_clocks_r);
        state_fio->StateValue(mem_wait_clocks_w);
+#if defined(PC8801SR_VARIANT)
        state_fio->StateValue(tvram_wait_clocks_r);
        state_fio->StateValue(tvram_wait_clocks_w);
+#endif
        state_fio->StateValue(gvram_wait_clocks_r);
        state_fio->StateValue(gvram_wait_clocks_w);
        state_fio->StateValue(busreq_clocks);
@@ -3550,9 +3820,11 @@ bool PC88::process_state(FILEIO* state_fio, bool loading)
        state_fio->StateValue(mouse_ly);
 #endif
        state_fio->StateValue(intr_req);
-       state_fio->StateValue(intr_req_sound);
-#ifdef SUPPORT_PC88_SB2
-       state_fio->StateValue(intr_req_sb2);
+#ifdef SUPPORT_PC88_OPN1
+       state_fio->StateValue(intr_req_opn1);
+#endif
+#ifdef SUPPORT_PC88_OPN2
+       state_fio->StateValue(intr_req_opn2);
 #endif
        state_fio->StateValue(intr_mask1);
        state_fio->StateValue(intr_mask2);
@@ -3614,13 +3886,16 @@ bool PC88::process_state(FILEIO* state_fio, bool loading)
        
        // post process
        if(loading) {
-#if defined(_PC8001SR)
+#if defined(PC8001_VARIANT)
                update_n80_write();
                update_n80_read();
 #else
-               update_low_memmap();
+               update_low_write();
+               update_low_read();
+#if defined(PC8801SR_VARIANT)
                update_tvram_memmap();
 #endif
+#endif
                // force update palette when state file is loaded
                update_palette = true;
        }
index d7bfb4f..497b33d 100644 (file)
@@ -1,7 +1,11 @@
 /*
-       NEC PC-98DO Emulator 'ePC-98DO'
-       NEC PC-8801MA Emulator 'ePC-8801MA'
+       NEC PC-8001 Emulator 'ePC-8001'
+       NEC PC-8001mkII Emulator 'ePC-8001mkII'
        NEC PC-8001mkIISR Emulator 'ePC-8001mkIISR'
+       NEC PC-8801 Emulator 'ePC-8801'
+       NEC PC-8801mkII Emulator 'ePC-8801mkII'
+       NEC PC-8801MA Emulator 'ePC-8801MA'
+       NEC PC-98DO Emulator 'ePC-98DO'
 
        Author : Takeda.Toshiya
        Date   : 2011.12.29-
 #include "../device.h"
 
 #define SIG_PC88_USART_IRQ     0
-#define SIG_PC88_SOUND_IRQ     1
-#ifdef SUPPORT_PC88_SB2
-#define SIG_PC88_SB2_IRQ       2
+#ifdef SUPPORT_PC88_OPN1
+#define SIG_PC88_OPN1_IRQ      1
+#endif
+#ifdef SUPPORT_PC88_OPN2
+#define SIG_PC88_OPN2_IRQ      2
 #endif
 #ifdef SUPPORT_PC88_CDROM
 #define SIG_PC88_SCSI_DRQ      3
 
 #define CMT_BUFFER_SIZE                0x40000
 
-#if defined(_PC8001SR) && !defined(PC88_EXRAM_BANKS)
-#define PC88_EXRAM_BANKS       1
-#endif
-
-#if !defined(_PC8001SR)
+#if defined(PC8801_VARIANT)
 #define NIPPY_PATCH
 #endif
 
+#if defined(SUPPORT_PC88_OPN1) || defined(SUPPORT_PC88_OPN2)
 class YM2203;
+#endif
 class Z80;
 #ifdef SUPPORT_PC88_CDROM
 class SCSI_HOST;
@@ -109,9 +113,11 @@ typedef struct {
 class PC88 : public DEVICE
 {
 private:
-       YM2203 *d_opn;
-#ifdef SUPPORT_PC88_SB2
-       YM2203 *d_sb2;
+#ifdef SUPPORT_PC88_OPN1
+       YM2203 *d_opn1;
+#endif
+#ifdef SUPPORT_PC88_OPN2
+       YM2203 *d_opn2;
 #endif
        Z80 *d_cpu;
        DEVICE *d_pcm, *d_pio, *d_prn, *d_rtc, *d_sio;
@@ -137,17 +143,25 @@ private:
 #endif
        uint8_t gvram[0xc000];
        uint8_t gvram_null[0x4000];
+#if defined(PC8801SR_VARIANT)
        uint8_t tvram[0x1000];
+#endif
+#if defined(PC8001_VARIANT)
+       uint8_t n80rom[0x8000];
 #if defined(_PC8001SR)
-       uint8_t n80mk2rom[0x8000];
-       uint8_t n80mk2srrom[0xa000];
+       uint8_t n80srrom[0xa000];
+#endif
 #else
        uint8_t n88rom[0x8000];
        uint8_t n88exrom[0x8000];
        uint8_t n80rom[0x8000];
 #endif
+//#ifdef SUPPORT_PC88_KANJI1
        uint8_t kanji1[0x20000];
+//#endif
+#ifdef SUPPORT_PC88_KANJI2
        uint8_t kanji2[0x20000];
+#endif
 #ifdef SUPPORT_PC88_DICTIONARY
        uint8_t dicrom[0x80000];
 #endif
@@ -163,23 +177,30 @@ private:
        pc88_dmac_t dmac;
        
        // memory mapper
+#if defined(_PC8001SR) || defined(PC8801SR_VARIANT)
        uint8_t alu_reg[3];
+#endif
        uint8_t gvram_plane, gvram_sel;
        
        void update_timing();
        int get_m1_wait(bool addr_f000);
        int get_main_wait(bool read);
+#if defined(PC8801SR_VARIANT)
        int get_tvram_wait(bool read);
+#endif
        int get_gvram_wait(bool read);
        void update_gvram_wait();
        void update_gvram_sel();
-#if defined(_PC8001SR)
+#if defined(PC8001_VARIANT)
        void update_n80_write();
        void update_n80_read();
 #else
-       void update_low_memmap();
+       void update_low_write();
+       void update_low_read();
+#if defined(PC8801SR_VARIANT)
        void update_tvram_memmap();
 #endif
+#endif
        
        // cpu
        bool cpu_clock_low;
@@ -190,7 +211,9 @@ private:
        int m1_wait_clocks;
        int f000_m1_wait_clocks;
        int mem_wait_clocks_r, mem_wait_clocks_w;
+#if defined(PC8801SR_VARIANT)
        int tvram_wait_clocks_r, tvram_wait_clocks_w;
+#endif
        int gvram_wait_clocks_r, gvram_wait_clocks_w;
        int busreq_clocks;
        
@@ -218,15 +241,17 @@ private:
 #endif
        
        void draw_text();
+#if defined(PC8001_VARIANT)
 #if defined(_PC8001SR)
        bool draw_320x200_color_graph();
+#endif
        bool draw_320x200_4color_graph();
        void draw_320x200_attrib_graph();
 #endif
        bool draw_640x200_color_graph();
        void draw_640x200_mono_graph();
        void draw_640x200_attrib_graph();
-#if !defined(_PC8001SR)
+#if defined(PC8801SR_VARIANT)
        void draw_640x400_mono_graph();
        void draw_640x400_attrib_graph();
 #endif
@@ -252,9 +277,11 @@ private:
        
        // intterrupt
        uint8_t intr_req;
-       bool intr_req_sound;
-#ifdef SUPPORT_PC88_SB2
-       bool intr_req_sb2;
+#ifdef SUPPORT_PC88_OPN1
+       bool intr_req_opn1;
+#endif
+#ifdef SUPPORT_PC88_OPN2
+       bool intr_req_opn2;
 #endif
        uint8_t intr_mask1, intr_mask2;
        void request_intr(int level, bool status);
@@ -294,7 +321,7 @@ private:
 public:
        PC88(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
-#if defined(_PC8001SR)
+#if defined(PC8001_VARIANT)
                set_device_name(_T("PC-8001 Core"));
 #else
                set_device_name(_T("PC-8801 Core"));
@@ -329,26 +356,26 @@ public:
        bool process_state(FILEIO* state_fio, bool loading);
        
        // unique functions
+#ifdef PC8801SR_VARIANT
        bool is_sr_mr()
        {
-#if !defined(_PC8001SR)
                return (n88rom[0x79d7] < 0x38);
-#else
-               return true;
-#endif
        }
+#endif
        void set_context_cpu(Z80* device)
        {
                d_cpu = device;
        }
-       void set_context_opn(YM2203* device)
+#ifdef SUPPORT_PC88_OPN1
+       void set_context_opn1(YM2203* device)
        {
-               d_opn = device;
+               d_opn1 = device;
        }
-#ifdef SUPPORT_PC88_SB2
-       void set_context_sb2(YM2203* device)
+#endif
+#ifdef SUPPORT_PC88_OPN2
+       void set_context_opn2(YM2203* device)
        {
-               d_sb2 = device;
+               d_opn2 = device;
        }
 #endif
        void set_context_pcm(DEVICE* device)
index 969c014..266093f 100644 (file)
@@ -1,7 +1,11 @@
 
 /*
-       NEC PC-8801MA Emulator 'ePC-8801MA'
+       NEC PC-8001 Emulator 'ePC-8001'
+       NEC PC-8001mkII Emulator 'ePC-8001mkII'
        NEC PC-8001mkIISR Emulator 'ePC-8001mkIISR'
+       NEC PC-8801 Emulator 'ePC-8801'
+       NEC PC-8801mkII Emulator 'ePC-8801mkII'
+       NEC PC-8801MA Emulator 'ePC-8801MA'
 
        Author : Takeda.Toshiya
        Date   : 2012.02.16-
@@ -20,7 +24,9 @@
 //#include "../pcpr201.h"
 #include "../prnfile.h"
 #include "../upd1990a.h"
+#if defined(SUPPORT_PC88_OPN1) || defined(SUPPORT_PC88_OPN2)
 #include "../ym2203.h"
+#endif
 #include "../z80.h"
 
 #include "../disk.h"
@@ -55,6 +61,23 @@ using PC88DEV::PC88;
 VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
 {
        // check configs
+#if defined(PC8001_VARIANT)
+#if defined(_PC8001)
+       if(config.boot_mode != MODE_PC80_N) {
+               config.boot_mode = MODE_PC80_N;
+       }
+#elif defined(_PC8001MK2)
+       if(config.boot_mode == MODE_PC80_V2) {
+               config.boot_mode = MODE_PC80_V1;
+       }
+#endif
+#else
+#if !defined(PC8801SR_VARIANT)
+       if(config.boot_mode == MODE_PC88_V1H || config.boot_mode == MODE_PC88_V2) {
+               config.boot_mode = MODE_PC88_V1S;
+       }
+#endif
+#endif
        boot_mode = config.boot_mode;
        
        // create devices
@@ -80,6 +103,7 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
        pc88rtc = new UPD1990A(this, emu);
 //     pc88rtc->set_device_name(_T("uPD1990A RTC (PC-8801)"));
 //     pc88rtc->set_context_event_manager(pc88event);
+#if defined(_PC8801MA)
        // config.sound_type
        //      0: 44h:OPNA A4h:None            PC-8801FH/MH or later
        //      1: 44h:OPN  A4h:None            PC-8801mkIISR/TR/FR/MR
@@ -87,39 +111,90 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
        //      3: 44h:OPN  A4h:OPN             PC-8801mkIISR/TR/FR/MR + PC-8801-11
        //      4: 44h:OPNA A4h:OPNA            PC-8801FH/MH or later  + PC-8801-24
        //      5: 44h:OPNA A4h:OPN             PC-8801FH/MH or later  + PC-8801-11
-       pc88opn = new YM2203(this, emu);
-//     pc88opn->set_context_event_manager(pc88event);
-#ifdef USE_SOUND_TYPE
-#ifdef SUPPORT_PC88_OPNA
+       pc88opn1 = new YM2203(this, emu);
+//     pc88opn1->set_context_event_manager(pc88event);
        if(config.sound_type == 0 || config.sound_type == 4 || config.sound_type == 5) {
-               pc88opn->is_ym2608 = true;
-               pc88opn->set_device_name(_T("YM2608 OPNA"));
+               pc88opn1->is_ym2608 = true;
+               pc88opn1->set_device_name(_T("YM2608 OPNA #1"));
        } else {
-#endif
-               pc88opn->is_ym2608 = false;
-               pc88opn->set_device_name(_T("YM2203 OPN"));
-#ifdef SUPPORT_PC88_OPNA
+               pc88opn1->is_ym2608 = false;
+               pc88opn1->set_device_name(_T("YM2203 OPN #1"));
        }
-#endif
-#ifdef SUPPORT_PC88_SB2
        if(config.sound_type >= 2) {
-               pc88sb2 = new YM2203(this, emu);
-//             pc88sb2->set_context_event_manager(pc88event);
-#ifdef SUPPORT_PC88_OPNA
+               pc88opn2 = new YM2203(this, emu);
+//             pc88opn2->set_context_event_manager(pc88event);
                if(config.sound_type == 2 || config.sound_type == 4) {
-                       pc88sb2->is_ym2608 = true;
-                       pc88sb2->set_device_name(_T("YM2608 OPNA (SB2)"));
-               } else {
-#endif
-                       pc88sb2->is_ym2608 = false;
-                       pc88sb2->set_device_name(_T("YM2203 OPN (SB2)"));
-#ifdef SUPPORT_PC88_OPNA
+                       pc88opn2->is_ym2608 = true;
+                       pc88opn2->set_device_name(_T("YM2608 OPNA #2"));
+               } else if(config.sound_type == 3 || config.sound_type == 5) {
+                       pc88opn2->is_ym2608 = false;
+                       pc88opn2->set_device_name(_T("YM2203 OPN #2"));
                }
-#endif
        } else {
-               pc88sb2 = NULL;
+               pc88opn2 = NULL;
        }
-#endif
+#elif defined(_PC8001SR)
+       // config.sound_type
+       //      0: 44h:OPN  A4h:None            PC-8001mkIISR
+       //      1: 44h:OPN  A4h:OPN             PC-8001mkIISR + PC-8801-11
+       //      2: 44h:OPN  A4h:OPNA            PC-8001mkIISR + PC-8801-23
+       pc88opn1 = new YM2203(this, emu);
+//     pc88opn1->set_context_event_manager(pc88event);
+       pc88opn1->is_ym2608 = false;
+       pc88opn1->set_device_name(_T("YM2203 OPN #1"));
+       if(config.sound_type == 1) {
+               pc88opn2 = new YM2203(this, emu);
+//             pc88opn2->set_context_event_manager(pc88event);
+               pc88opn2->is_ym2608 = false;
+               pc88opn2->set_device_name(_T("YM2203 OPN #2"));
+       } else if(config.sound_type == 2) {
+               pc88opn2 = new YM2203(this, emu);
+//             pc88opn2->set_context_event_manager(pc88event);
+               pc88opn2->is_ym2608 = true;
+               pc88opn2->set_device_name(_T("YM2608 OPNA #2"));
+       } else {
+               pc88opn2 = NULL;
+       }
+#elif defined(_PC8001MK2) || defined(_PC8801MK2)
+       //      0: 44h:None A4h:None            PC-8001/8801mkII
+       //      1: 44h:None A4h:OPN             PC-8001/8801mkII + PC-8801-11
+       //      2: 44h:None A4h:OPNA            PC-8001/8801mkII + PC-8801-23
+       if(config.sound_type == 1) {
+               pc88opn2 = new YM2203(this, emu);
+//             pc88opn2->set_context_event_manager(pc88event);
+               pc88opn2->is_ym2608 = false;
+               pc88opn2->set_device_name(_T("YM2203 OPN #2"));
+       } else if(config.sound_type == 2) {
+               pc88opn2 = new YM2203(this, emu);
+//             pc88opn2->set_context_event_manager(pc88event);
+               pc88opn2->is_ym2608 = true;
+               pc88opn2->set_device_name(_T("YM2608 OPNA #2"));
+       } else {
+               pc88opn2 = NULL;
+       }
+#else
+       #if defined(SUPPORT_PC88_OPN1)
+               pc88opn1 = new YM2203(this, emu);
+//             pc88opn1->set_context_event_manager(pc88event);
+               #if defined(SUPPORT_PC88_OPNA)
+                       pc88opn1->is_ym2608 = true;
+                       pc88opn1->set_device_name(_T("YM2608 OPNA #1"));
+               #else
+                       pc88opn1->is_ym2608 = false;
+                       pc88opn1->set_device_name(_T("YM2203 OPN #1"));
+               #endif
+       #endif
+       #if defined(SUPPORT_PC88_OPN2)
+               pc88opn2 = new YM2203(this, emu);
+//             pc88opn2->set_context_event_manager(pc88event);
+               #if defined(SUPPORT_PC88_OPNA)
+                       pc88opn2->is_ym2608 = true;
+                       pc88opn2->set_device_name(_T("YM2608 OPNA #2"));
+               #else
+                       pc88opn2->is_ym2608 = false;
+                       pc88opn2->set_device_name(_T("YM2203 OPN #2"));
+               #endif
+       #endif
 #endif
        if(config.printer_type == 0) {
                pc88prn = new PRNFILE(this, emu);
@@ -186,10 +261,14 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
        pc88event->set_context_cpu(pc88cpu, 3993624);
 #endif
        pc88event->set_context_cpu(pc88cpu_sub, 3993624);
-       pc88event->set_context_sound(pc88opn);
-#ifdef SUPPORT_PC88_SB2
-       if(pc88sb2 != NULL) {
-               pc88event->set_context_sound(pc88sb2);
+#ifdef SUPPORT_PC88_OPN1
+       if(pc88opn1 != NULL) {
+               pc88event->set_context_sound(pc88opn1);
+       }
+#endif
+#ifdef SUPPORT_PC88_OPN2
+       if(pc88opn2 != NULL) {
+               pc88event->set_context_sound(pc88opn2);
        }
 #endif
        pc88event->set_context_sound(pc88pcm);
@@ -209,9 +288,15 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
        pc88event->set_context_sound(pc88noise_head_up);
        
        pc88->set_context_cpu(pc88cpu);
-       pc88->set_context_opn(pc88opn);
-#ifdef SUPPORT_PC88_SB2
-       pc88->set_context_sb2(pc88sb2);
+#ifdef SUPPORT_PC88_OPN1
+       if(pc88opn1 != NULL) {
+               pc88->set_context_opn1(pc88opn1);
+       }
+#endif
+#ifdef SUPPORT_PC88_OPN2
+       if(pc88opn2 != NULL) {
+               pc88->set_context_opn2(pc88opn2);
+       }
 #endif
        pc88->set_context_pcm(pc88pcm);
        pc88->set_context_pio(pc88pio);
@@ -237,10 +322,14 @@ VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
 #ifdef USE_DEBUGGER
        pc88cpu->set_context_debugger(new DEBUGGER(this, emu));
 #endif
-       pc88opn->set_context_irq(pc88, SIG_PC88_SOUND_IRQ, 1);
-#ifdef SUPPORT_PC88_SB2
-       if(pc88sb2 != NULL) {
-               pc88sb2->set_context_irq(pc88, SIG_PC88_SB2_IRQ, 1);
+#ifdef SUPPORT_PC88_OPN1
+       if(pc88opn1 != NULL) {
+               pc88opn1->set_context_irq(pc88, SIG_PC88_OPN1_IRQ, 1);
+       }
+#endif
+#ifdef SUPPORT_PC88_OPN2
+       if(pc88opn2 != NULL) {
+               pc88opn2->set_context_irq(pc88, SIG_PC88_OPN2_IRQ, 1);
        }
 #endif
        pc88sio->set_context_rxrdy(pc88, SIG_PC88_USART_IRQ, 1);
@@ -327,7 +416,11 @@ void VM::reset()
        }
        
        // initial device settings
-       pc88opn->set_reg(0x29, 3); // for Misty Blue
+#ifdef SUPPORT_PC88_OPN1
+       if(pc88opn1 != NULL) {
+               pc88opn1->set_reg(0x29, 3); // for Misty Blue
+       }
+#endif
        pc88pio->write_signal(SIG_I8255_PORT_C, 0, 0xff);
        pc88pio_sub->write_signal(SIG_I8255_PORT_C, 0, 0xff);
 }
@@ -377,17 +470,21 @@ void VM::initialize_sound(int rate, int samples)
        pc88event->initialize_sound(rate, samples);
        
        // init sound gen
-       if(pc88opn->is_ym2608) {
-               pc88opn->initialize_sound(rate, 7987248, samples, 0, 0);
-       } else {
-               pc88opn->initialize_sound(rate, 3993624, samples, 0, 0);
+#ifdef SUPPORT_PC88_OPN1
+       if(pc88opn1 != NULL) {
+               if(pc88opn1->is_ym2608) {
+                       pc88opn1->initialize_sound(rate, 7987248, samples, 0, 0);
+               } else {
+                       pc88opn1->initialize_sound(rate, 3993624, samples, 0, 0);
+               }
        }
-#ifdef SUPPORT_PC88_SB2
-       if(pc88sb2 != NULL) {
-               if(pc88sb2->is_ym2608) {
-                       pc88sb2->initialize_sound(rate, 7987248, samples, 0, 0);
+#endif
+#ifdef SUPPORT_PC88_OPN2
+       if(pc88opn2 != NULL) {
+               if(pc88opn2->is_ym2608) {
+                       pc88opn2->initialize_sound(rate, 7987248, samples, 0, 0);
                } else {
-                       pc88sb2->initialize_sound(rate, 3993624, samples, 0, 0);
+                       pc88opn2->initialize_sound(rate, 3993624, samples, 0, 0);
                }
        }
 #endif
@@ -415,56 +512,91 @@ int VM::get_sound_buffer_ptr()
 #ifdef USE_SOUND_VOLUME
 void VM::set_sound_device_volume(int ch, int decibel_l, int decibel_r)
 {
+#ifdef SUPPORT_PC88_OPN1
        if(ch-- == 0) {
-               pc88opn->set_volume(0, decibel_l, decibel_r);
-       } else if(ch-- == 0) {
-               pc88opn->set_volume(1, decibel_l, decibel_r);
+               if(pc88opn1 != NULL) {
+                       pc88opn1->set_volume(0, decibel_l, decibel_r);
+               }
+               return;
+       }
+       if(ch-- == 0) {
+               if(pc88opn1 != NULL) {
+                       pc88opn1->set_volume(1, decibel_l, decibel_r);
+               }
+               return;
+       }
 #ifdef SUPPORT_PC88_OPNA
-       } else if(ch-- == 0) {
-               pc88opn->set_volume(2, decibel_l, decibel_r);
-       } else if(ch-- == 0) {
-               pc88opn->set_volume(3, decibel_l, decibel_r);
-#endif
-#ifdef SUPPORT_PC88_SB2
-       } else if(ch-- == 0) {
-               if(pc88sb2 != NULL) {
-                       pc88sb2->set_volume(0, decibel_l, decibel_r);
+       if(ch-- == 0) {
+               if(pc88opn1 != NULL && pc88opn1->is_ym2608) {
+                       pc88opn1->set_volume(2, decibel_l, decibel_r);
+               }
+               return;
+       }
+       if(ch-- == 0) {
+               if(pc88opn1 != NULL && pc88opn1->is_ym2608) {
+                       pc88opn1->set_volume(3, decibel_l, decibel_r);
+               }
+               return;
+       }
+#endif
+#endif
+#ifdef SUPPORT_PC88_OPN2
+       if(ch-- == 0) {
+               if(pc88opn2 != NULL) {
+                       pc88opn2->set_volume(0, decibel_l, decibel_r);
                }
-       } else if(ch-- == 0) {
-               if(pc88sb2 != NULL) {
-                       pc88sb2->set_volume(1, decibel_l, decibel_r);
+               return;
+       }
+       if(ch-- == 0) {
+               if(pc88opn2 != NULL) {
+                       pc88opn2->set_volume(1, decibel_l, decibel_r);
                }
+               return;
+       }
 #ifdef SUPPORT_PC88_OPNA
-       } else if(ch-- == 0) {
-               if(pc88sb2 != NULL) {
-                       pc88sb2->set_volume(2, decibel_l, decibel_r);
+       if(ch-- == 0) {
+               if(pc88opn2 != NULL && pc88opn2->is_ym2608) {
+                       pc88opn2->set_volume(2, decibel_l, decibel_r);
                }
-       } else if(ch-- == 0) {
-               if(pc88sb2 != NULL) {
-                       pc88sb2->set_volume(3, decibel_l, decibel_r);
+               return;
+       }
+       if(ch-- == 0) {
+               if(pc88opn2 != NULL && pc88opn2->is_ym2608) {
+                       pc88opn2->set_volume(3, decibel_l, decibel_r);
                }
+               return;
+       }
 #endif
 #endif
 #ifdef SUPPORT_PC88_CDROM
-       } else if(ch-- == 0) {
+       if(ch-- == 0) {
                pc88scsi_cdrom->set_volume(0, decibel_l, decibel_r);
+               return;
+       }
 #endif
 #ifdef SUPPORT_PC88_HMB20
-       } else if(ch-- == 0) {
+       if(ch-- == 0) {
                pc88opm->set_volume(0, decibel_l, decibel_r);
+               return;
+       }
 #endif
 #ifdef SUPPORT_PC88_PCG8100
-       } else if(ch-- == 0) {
+       if(ch-- == 0) {
                pc88pcm0->set_volume(0, decibel_l, decibel_r);
                pc88pcm1->set_volume(0, decibel_l, decibel_r);
                pc88pcm2->set_volume(0, decibel_l, decibel_r);
+               return;
+       }
 #endif
-       } else if(ch-- == 0) {
+       if(ch-- == 0) {
                pc88pcm->set_volume(0, decibel_l, decibel_r);
-       } else if(ch-- == 0) {
+               return;
+       }
+       if(ch-- == 0) {
                pc88noise_seek->set_volume(0, decibel_l, decibel_r);
                pc88noise_head_down->set_volume(0, decibel_l, decibel_r);
                pc88noise_head_up->set_volume(0, decibel_l, decibel_r);
+               return;
        }
 }
 #endif
index 649e826..3b73723 100644 (file)
@@ -1,6 +1,10 @@
 /*
-       NEC PC-8801MA Emulator 'ePC-8801MA'
+       NEC PC-8001 Emulator 'ePC-8001'
+       NEC PC-8001mkII Emulator 'ePC-8001mkII'
        NEC PC-8001mkIISR Emulator 'ePC-8001mkIISR'
+       NEC PC-8801 Emulator 'ePC-8801'
+       NEC PC-8801mkII Emulator 'ePC-8801mkII'
+       NEC PC-8801MA Emulator 'ePC-8801MA'
 
        Author : Takeda.Toshiya
        Date   : 2012.02.16-
 #if defined(_PC8801MA)
 #define DEVICE_NAME            "NEC PC-8801MA"
 #define CONFIG_NAME            "pc8801ma"
+#elif defined(_PC8801MK2)
+#define DEVICE_NAME            "NEC PC-8801mkII"
+#define CONFIG_NAME            "pc8801mk2"
+#elif defined(_PC8801)
+#define DEVICE_NAME            "NEC PC-8801"
+#define CONFIG_NAME            "pc8801"
 #elif defined(_PC8001SR)
 #define DEVICE_NAME            "NEC PC-8001mkIISR"
 #define CONFIG_NAME            "pc8001mk2sr"
+#elif defined(_PC8001MK2)
+#define DEVICE_NAME            "NEC PC-8001mkII"
+#define CONFIG_NAME            "pc8001mk2"
+#elif defined(_PC8001)
+#define DEVICE_NAME            "NEC PC-8001"
+#define CONFIG_NAME            "pc8001"
 #endif
 
-#if defined(_PC8001SR)
-#define MODE_PC80_V1   0
-#define MODE_PC80_V2   1
-#define MODE_PC80_N    2
+#if defined(_PC8001) || defined(_PC8001MK2) || defined(_PC8001SR)
+#define PC8001_VARIANT
 #else
-#define MODE_PC88_V1S  0
-#define MODE_PC88_V1H  1
-#define MODE_PC88_V2   2
-#define MODE_PC88_N    3
+#define PC8801_VARIANT
 #endif
-
 #if defined(_PC8801MA)
-#define SUPPORT_PC88_DICTIONARY
-#define SUPPORT_PC88_HIGH_CLOCK
-#define SUPPORT_PC88_OPNA
-#define SUPPORT_PC88_SB2
-#define SUPPORT_PC88_CDROM
-#define SUPPORT_PC88_VAB
-#define SUPPORT_PC88_HMB20
-#if defined(SUPPORT_PC88_VAB)
-// X88000
-#define PC88_EXRAM_BANKS       8
-#define PC88_VAB_PAGE          1
+#define PC8801SR_VARIANT
+#endif
+
+#if defined(PC8001_VARIANT)
+       #define MODE_PC80_V1    0
+       #define MODE_PC80_V2    1
+       #define MODE_PC80_N     2
 #else
-#define PC88_EXRAM_BANKS       4
+       #define MODE_PC88_V1S   0
+       #define MODE_PC88_V1H   1
+       #define MODE_PC88_V2    2
+       #define MODE_PC88_N     3
 #endif
-#define HAS_UPD4990A
+
+#if defined(_PC8801MA)
+       #define SUPPORT_PC88_KANJI1
+       #define SUPPORT_PC88_KANJI2
+       #define SUPPORT_PC88_DICTIONARY
+       #define SUPPORT_PC88_HIGH_CLOCK
+       #define SUPPORT_PC88_OPN1
+       #define SUPPORT_PC88_OPN2
+       #define SUPPORT_PC88_OPNA
+       #define SUPPORT_PC88_CDROM
+       #define SUPPORT_PC88_VAB
+       #define SUPPORT_PC88_HMB20
+       #define SUPPORT_PC88_JOYSTICK
+       #if defined(SUPPORT_PC88_VAB)
+               // X88000
+               #define PC88_EXRAM_BANKS        8
+               #define PC88_VAB_PAGE           1
+       #else
+               #define PC88_EXRAM_BANKS        4
+       #endif
+       #define HAS_UPD4990A
+#elif defined(_PC8801MK2)
+       #define SUPPORT_PC88_KANJI1
+//     #define SUPPORT_PC88_KANJI2
+       #define SUPPORT_PC88_OPN2
+       #define SUPPORT_PC88_OPNA
+#elif defined(_PC8801)
+       #define SUPPORT_PC88_KANJI1
+//     #define SUPPORT_PC88_KANJI2
+//     #define SUPPORT_PC88_OPN2
+//     #define SUPPORT_PC88_OPNA
+#elif defined(_PC8001SR)
+       #define SUPPORT_PC88_KANJI1
+//     #define SUPPORT_PC88_KANJI2
+       #define SUPPORT_PC88_OPN1
+       #define SUPPORT_PC88_OPN2
+       #define SUPPORT_PC88_OPNA
+       #define PC88_EXRAM_BANKS        1
+#elif defined(_PC8001MK2)
+       #define SUPPORT_PC88_KANJI1
+//     #define SUPPORT_PC88_KANJI2
+       #define SUPPORT_PC88_OPN2
+       #define SUPPORT_PC88_OPNA
+       #define PC88_EXRAM_BANKS        1
+#elif defined(_PC8001)
+//     #define SUPPORT_PC88_KANJI1
+//     #define SUPPORT_PC88_KANJI2
+//     #define SUPPORT_PC88_OPN2
+//     #define SUPPORT_PC88_OPNA
 #endif
-#define SUPPORT_PC88_JOYSTICK
 #define SUPPORT_PC88_PCG8100
 
 // device informations for virtual machine
 #define WINDOW_HEIGHT_ASPECT   480
 #define MAX_DRIVE              2
 #define UPD765A_NO_ST1_EN_OR_FOR_RESULT7
-#if defined(_PC8801MA)
+#if defined(PC8801_VARIANT)
 #define PC80S31K_NO_WAIT
 #endif
 #if defined(SUPPORT_PC88_CDROM)
 #define OVERRIDE_SOUND_FREQ_48000HZ    55467
 
 // device informations for win32
-#if defined(_PC8001SR)
+#if defined(PC8001_VARIANT)
 #define USE_BOOT_MODE          3
 #define USE_CPU_TYPE           2
 #else
 #define USE_MONITOR_TYPE       2
 #define USE_SCREEN_FILTER
 #define USE_SCANLINE
-#ifdef SUPPORT_PC88_OPNA
-#ifdef SUPPORT_PC88_SB2
-#define USE_SOUND_TYPE         6
-#else
-#define USE_SOUND_TYPE         2
-#endif
-#endif
 
-#undef _SOUNDS_OPN
-#undef _SOUNDS_SB2
-#undef _SOUNDS_PCG8100
-#undef _SOUNDS_CDROM
-#undef _SOUNDS_HMB20
-#undef _SOUNDS_BEEP
-#undef _SOUNDS_NOISE
-
-#if defined(SUPPORT_PC88_OPNA)
-       #define _SOUNDS_OPN 4
-#else /* ToDo: PC8001 without OPN/OPNA */
-       #define _SOUNDS_OPN 2
+#if defined(_PC8801MA)
+       #define USE_SOUND_TYPE          6       // OPNA,OPN,OPN+OPNA,OPN+OPN,OPNA+OPNA,OPNA+OPN
+#elif defined(_PC8001SR)
+       #define USE_SOUND_TYPE          3       // OPN,OPN+OPN,OPN+OPNA
+#elif defined(_PC8001MK2) || defined(_PC8801MK2)
+       #define USE_SOUND_TYPE          3       // None,OPN,OPNA
 #endif
-#if defined(SUPPORT_PC88_SB2)
+#if defined(SUPPORT_PC88_OPN1)
        #if defined(SUPPORT_PC88_OPNA)
-       #define _SOUNDS_SB2 4
-       #else /* SB2=OPN */
-       #define _SOUNDS_SB2 2
+               #define SOUND_VOLUME_OPN1       4
+       #else
+               #define SOUND_VOLUME_OPN1       2
        #endif
-#else /* Have not SB2 */
-       #define _SOUNDS_SB2 0
+#else
+       #define SOUND_VOLUME_OPN1       0
 #endif
-#if defined(SUPPORT_PC88_PCG8100)
-       #define _SOUNDS_PCG8100 1
+#if defined(SUPPORT_PC88_OPN2)
+       #if defined(SUPPORT_PC88_OPNA)
+               #define SOUND_VOLUME_OPN2       4
+       #else
+               #define SOUND_VOLUME_OPN2       2
+       #endif
 #else
-       #define _SOUNDS_PCG8100 0
+       #define SOUND_VOLUME_OPN2       0
 #endif
-#if defined(SUPPORT_PC88_CDROM)
-       #define _SOUNDS_CDROM 1
+ #if defined(SUPPORT_PC88_CDROM)
+#define SOUND_VOLUME_CDROM     1
+       #define SOUND_VOLUME_CDROM      1
 #else
-       #define _SOUNDS_CDROM 0
+       #define SOUND_VOLUME_CDROM      0
 #endif
 #if defined(SUPPORT_PC88_HMB20)
-       #define _SOUNDS_HMB20 1
+       #define SOUND_VOLUME_HMB20      1
 #else
-       #define _SOUNDS_HMB20 0
+       #define SOUND_VOLUME_HMB20      0
 #endif
-#define _SOUNDS_BEEP 1
-#define _SOUNDS_NOISE 1
-
-#define USE_SOUND_VOLUME (_SOUNDS_OPN + _SOUNDS_SB2 + _SOUNDS_PCG8100 + _SOUNDS_CDROM + _SOUNDS_HMB20 + _SOUNDS_BEEP + _SOUNDS_NOISE)
-
+#if defined(SUPPORT_PC88_PCG8100)
+       #define SOUND_VOLUME_PCG8100    1
+#else
+       #define SOUND_VOLUME_PCG8100    0
+#endif
+#define USE_SOUND_VOLUME       (SOUND_VOLUME_OPN1 + SOUND_VOLUME_OPN2 + SOUND_VOLUME_CDROM + SOUND_VOLUME_HMB20 + SOUND_VOLUME_PCG8100 + 1 + 1)
 
 #define SUPPORT_TV_RENDER
 #define USE_JOYSTICK
 
 #ifdef USE_SOUND_VOLUME
 static const _TCHAR *sound_device_caption[USE_SOUND_VOLUME] = {
+#ifdef SUPPORT_PC88_OPN1
+       _T("OPN1 (FM)"), _T("OPN1 (PSG)"),
 #ifdef SUPPORT_PC88_OPNA
-       _T("OPNA (FM)"), _T("OPNA (PSG)"), _T("OPNA (ADPCM)"), _T("OPNA (Rhythm)"),
-#else
-       _T("OPN (FM)"), _T("OPN (PSG)"),
+       _T("OPN1 (ADPCM)"), _T("OPN1 (Rhythm)"),
 #endif
-#ifdef SUPPORT_PC88_SB2
+#endif
+#ifdef SUPPORT_PC88_OPN2
+       _T("OPN2 (FM)"), _T("OPN2 (PSG)"),
 #ifdef SUPPORT_PC88_OPNA
-       _T("SB2 (FM)"), _T("SB2 (PSG)"), _T("SB2 (ADPCM)"), _T("SB2 (Rhythm)"),
-#else
-       _T("SB2 (FM)"), _T("SB2 (PSG)"),
+       _T("OPN2 (ADPCM)"), _T("OPN2 (Rhythm)"),
 #endif
 #endif
 #ifdef SUPPORT_PC88_CDROM
@@ -198,7 +247,9 @@ class I8255;
 class NOISE;
 class PCM1BIT;
 class UPD1990A;
+#if defined(SUPPORT_PC88_OPN1) || defined(SUPPORT_PC88_OPN2)
 class YM2203;
+#endif
 class Z80;
 
 class PC80S31K;
@@ -233,9 +284,11 @@ protected:
        I8255* pc88pio;
        PCM1BIT* pc88pcm;
        UPD1990A* pc88rtc;
-       YM2203* pc88opn;
-#ifdef SUPPORT_PC88_SB2
-       YM2203* pc88sb2;
+#ifdef SUPPORT_PC88_OPN1
+       YM2203* pc88opn1;
+#endif
+#ifdef SUPPORT_PC88_OPN2
+       YM2203* pc88opn2;
 #endif
        DEVICE* dummycpu;
        Z80* pc88cpu;