+3/28/2015
+
+[FM7] add eFM7 codes (thanks Mr.Artane.)
+
+
+3/26/2015
+
+[VM/MB8877] fix not to return error status when seek to unformatted track (thanks Mr.Artane.)
+[VM/MC6809] improve mc6809 instructions (thanks Mr.Artane.)
+[VM/YM2151] support mamefm.dll
+[VM/YM2203] fix to check SUPPORT_MULTIPLE flag of mamefm.dll
+
+[MSX2/MEMORY] import Mr.tanam's fixes
+
+
+3/21/2015-2
+
+[MSX2] import Mr.umaiboux's patches posted on Mr.tanam's blog
+
+
+3/21/2015
+
+[VM/DISK] support 1dd floppy image
+[VM/V99X8] support V99x8 (thanks Mr.umaiboux and Zodiac)
+[VM/V99X8] support save/load state
+[VM/Z80] support to hook ret opecode for pseudo bios call
+
+[MSX1] add yaMSX1 codes (thanks Mr.tanam, Mr.umaiboux and fMSX)
+[MSX1] support save/load state
+[MSX2] add yaMSX2 codes (thanks Mr.tanam, Mr.umaiboux and fMSX)
+[MSX2] support save/load state
+
+
+3/19/2015
+
+[WIN32/INPUT] fix DirectInput issues
+
+
3/15/2015
[WINMAIN] support to disable Desktop Window Manager (DWM) automatically
[VM/TMS9918A] support super impose
-[GAMEGEAR] add yaGEMEGEAR codes (thanks Mr.tanam)
+[GAMEGEAR] add yaGAMEGEAR codes (thanks Mr.tanam)
[MASTERSYSTEM] add yaMASTERSYSTEM codes (thanks Mr.tanam)
[PC6001] update yaPC-6001 codes (thanks Mr.tanam)
[PC6001MK2] add yaPC-6201 codes (thanks Mr.tanam)
--- /dev/null
+03/22/2015
+[MSX2] Fix MSX-DOS2 support
+
+02/14/2015
+[MSX2] MSXDOS2.ROM support
+
+02/05/2015
+[MSX2] DISK.ROM patch support
+
+02/04/2015
+[MSX2] Initial release
+
+02/03/2015
+[MSX2] RTC support
+[MSX2] V99X8 support
+
+02/02/2015
+[MSX2] DISK support
+[MSX2] 64K RAM(slot3) support
+[MSX2] V9938 support
+
+07/27/2014
+[GAMEGEAR] Remove COLECOVISION support
+[MASTERSYSTEM] SK-1100 support
+
+06/21/2014
+[SC3000] Change COLECOVISION memory map
+
+06/08/2014
+[SC3000] Fix memory address bug
+
+06/07/2014
+[SC3000] Megarom support
+
+05/26/2014
+[PC6001MK2SR] Fix SR mode bug
+
+05/24/2014
+[MSX1] Removed
+
+05/19/2014
+[PC6001MK2SR] Fix FM Sound bug
+[PC6601SR] Fix FM Sound bug
+
+05/11/2014
+[PC6001] 64K RAM(ASCII 1983/7) support
+
+05/10/2014
+[PC6001MK2SR] Initial release
+[PC6601SR] Initial release
+
+3/31/2014
+[MASTERSYSTEM] Assign Keyboard to Joystick again
+
+2/1/2014
+[PC6801] Fix INT bug
+
+1/31/2014
+[MASTERSYSTEM] Assign Keyboard to Joystick
+
+1/27/2014
+[PC6801] Fix INT bug
+[PC6801] Release with BIOS
+
+1/20/2014
+[PC6801] Fix INT bug
+
+01/14/2014
+[PC6801] Initial release
+
+01/09/2014
+[PC6601] Test Colony Oddysey
+[PC6001] Adjust INT timing
+
+01/05/2014
+[Android] Test on Android devices
+
+01/03/2014
+[PC6001] DISK Added
+
+01/01/2014
+[PC6201] Initial release
+
+12/29/2013
+[PC6601] Fix DISK bug
+
+12/28/2013
+[PC6601] Fix VOICE bug
+[PC6601] CHECKER SCREEN Added
+
+12/14/2013
+[PC6601] Fix VDG bug
+[PC6601] Fix CMT bug
+
+12/08/2013
+[PC6601] PD7752 Added
+
+12/01/2013
+[PC6601] Initial release
+[PC6001] Fix CGROM bug
+
+11/17/2013
+[Z80] Fix VDP bug
+[315-5124] Fix VDP bug
+[GAMEGEAR] Fix VDP bug
+[MASTERSYSTEM] Fix VDP bug
+
+11/14/2013
+[SDL] Assign Joystick
+
+11/10/2013
+[315-5124] Fix VDP bug
+[QT] Assign F11 F12 to F7 F8 for Choidroid
+
+10/26/2013
+[MASTERSYSTEM] Initial release
+
+09/23/2013
+[MSX1] Initial release
+
+09/20/2013
+[GAMEGEAR] Initial release
+
+08/13/2013
+[PC6001] Initial release
retro pc emulator common source code
- 3/15/2015
+ 3/28/2015
--- What's this ?
This archive includes the all source codes of emulators listed below:
+ ASCII
+ yaMSX1 MSX1 (by Mr.tanam and Mr.umaiboux)
+ yaMSX2 MSX2 (by Mr.tanam and Mr.umaiboux)
BANDAI
eRX-78 RX-78
CANON
eHC-80 HC-80/PX-8/Geneva
eQC-10 QC-10/QX-10
FUJITSU
+ eFM7 FM-7 (by Mr.Artane.)
eFM16pi FM16pi
eFMR-30 FMR-30
eFMR-50 FMR-50
MAME i386 core
- vm/i8259.*
Neko Project 2 and MESS 8259 core
+- vm/ld700.*
+ openMSX LD-700
- vm/m6502.*
MAME m6502 core
- vm/mb8877.*
- vm/mc6800.*
MAME mc6800 core
- vm/mc6809.*
- MAME mc6809 core
+ MAME mc6809 core and improved by Mr.Artane.
- vm/mc6847.*
MAME mc6847 core
- vm/pc6031.*
iP6 by Mr.Nishida
- vm/upd7801.*
MAME uPD7810 core
+- vm/v99x8.*
+ Zodiac V99x8 core, converted to c++ class by Mr.umaiboux
- vm/w3100a.*
Mr.Oh!Ishi for the chip specification info
- vm/z80.*
MAME Z80DMA core
- vm/familybasic
nester
+- vm/fm7/*.*
+ eFM7 by Mr.Artane.
- vm/fmr50/bios.*
FM-TOWNS emulator on bochs
UNZ pseudo BIOS
- vm/m5/*
MESS sord driver
Mr.Moriya for Sord M5 hardware design info
+- vm/msx/*
+ yaMSX1 and yaMSX2 by Mr.tanam
+- vm/msx/memory.*
+ fMSX Disk BIOS
- vm/mycomz80a/mon.c
Based on MON80 by Mr.Tesuya Suzuki
- vm/mz1200/*
retro pc emulator drivers
- 5/24/2014
+ 03/22/2015
--- What's this ?
yaPC-6401 Yet Another NEC PC-6001mk2SR Emulator
yaPC-6601 Yet Another NEC PC-6601 Emulator
yaPC-6801 Yet Another NEC PC-6601SR Emulator
+ yaGAME GEAR Yet Another SEGA GAME GEAR Emulator
+ yaMASTER SYSTEM Yet Another SEGA MASTER SYSTEM Emulator
+ yaMSX2 Yet Another ASCII MSX2 Emulator
You can build them with Microsoft Visual C++ 2008 SP1 and DirectX SDK.
PC6001V
http://www.papicom.net/p6v/
+SMS Plus
+http://cgfm2.emuviews.com/smsplus.php
+
+fMSX
+http://fms.komkon.org/fMSX/
+
----------------------------------------
tanam
http://www.geocities.jp/parallel_computer_inc/android.html
\ No newline at end of file
set(EXEC_TARGET emumsx1)
-set(LOCAL_LIBS vm_msx1
+set(LOCAL_LIBS vm_msx
vm_vm
common_common
vm_fmgen
set(BUILD_PX7 OFF CACHE BOOL "Build for Pioneer PX7")
+set(BUILD_MSX1 ON CACHE BOOL "Build for MSX1")
+set(BUILD_MSX2 OFF CACHE BOOL "Build for MSX2")
set(USE_CMT_SOUND ON CACHE BOOL "Sound with CMT")
set(USE_OPENMP ON CACHE BOOL "Build using OpenMP")
set(USE_OPENCL ON CACHE BOOL "Build using OpenCL")
set(USE_OPENGL ON CACHE BOOL "Build using OpenGL")
#set(WITH_DEBUGGER ON CACHE BOOL "Build witnDebugger.")
+set(VMFILES_MSX2 ${VMFILES_BASE}
+ rp5c01.cpp
+ v99x8.cpp
+ disk.cpp
+)
+
+set(VMFILES_MSX1 ${VMFILES_BASE}
+ tms9918a.cpp
+ disk.cpp
+)
+
set(VMFILES_PX7 ${VMFILES_BASE}
+ tms9918a.cpp
ld700.cpp
)
+
+
if(USE_CMT_SOUND)
set(VMFILES_MSX ${VMFILES_BASE})
endif()
if(BUILD_PX7)
set(VMFILES ${VMFILES_PX7})
add_definitions(-D_PX7)
+elseif(BUILD_MSX2)
+ set(VMFILES ${VMFILES_MSX2})
+ add_definitions(-D_MSX2)
else()
- set(VMFILES ${VMFILES_MSX})
+ set(VMFILES ${VMFILES_MSX1})
add_definitions(-D_MSX1)
endif()
#include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../src/vm)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../src/vm/msx1)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../src/vm/msx)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../src/vm/fmgen)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../src/qt/msx1)
# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../src/qt/common/scaler/sse2)
endif()
-add_subdirectory(../../src/vm/msx1 vm/msx1)
+add_subdirectory(../../src/vm/msx vm/msx)
add_subdirectory(../../src/vm/fmgen vm/fmgen)
add_subdirectory(../../src/qt/msx1 qt/msx1)
--- /dev/null
+<?xml version="1.0" encoding="shift_jis"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="fm7"
+ ProjectGUID="{19644030-FB96-4EE0-8819-86D8D13C25A7}"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/fm7.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_FM7"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile=".\Debug/fm7.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1041"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib dsound.lib imm32.lib vfw32.lib"
+ OutputFile=".\Debug/fm7.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/fm7.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/fm7.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/fm7.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="2"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_FM7"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release/fm7.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib dsound.lib imm32.lib vfw32.lib"
+ OutputFile=".\Release/fm7.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile=".\Release/fm7.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/fm7.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="src\common.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\config.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\fifo.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\fileio.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\winmain.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <Filter
+ Name="EMU Source Files"
+ Filter="cpp"
+ >
+ <File
+ RelativePath="src\emu.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\win32_debugger.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\win32_input.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\win32_screen.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\win32_sound.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="VM Common Source Files"
+ Filter="cpp"
+ >
+ <File
+ RelativePath="src\vm\beep.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\datarec.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\disk.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\event.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\mb8877.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\mc6809.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\memory.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\ym2203.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\z80.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <Filter
+ Name="fmgen Source Files"
+ Filter="cpp"
+ >
+ <File
+ RelativePath="src\vm\fmgen\file.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\fmgen.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\fmtimer.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\opna.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\psg.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="VM Driver Source Files"
+ Filter="cpp"
+ >
+ <File
+ RelativePath="src\vm\fm7\display.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fm7\floppy.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fm7\fm7.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fm7\fm7_mainio.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fm7\fm7_mainmem.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fm7\kanjirom.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fm7\keyboard.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fm7\sound.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="src\common.h"
+ >
+ </File>
+ <File
+ RelativePath="src\config.h"
+ >
+ </File>
+ <File
+ RelativePath="src\fifo.h"
+ >
+ </File>
+ <File
+ RelativePath="src\fileio.h"
+ >
+ </File>
+ <Filter
+ Name="EMU Header Files"
+ Filter="h"
+ >
+ <File
+ RelativePath="src\emu.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="VM Common Header Files"
+ Filter="h"
+ >
+ <File
+ RelativePath="src\vm\beep.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\datarec.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\debugger.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\device.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\disk.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\event.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\mb8877.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\mc6809.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\memory.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\vm.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\ym2203.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\z80.h"
+ >
+ </File>
+ <Filter
+ Name="fmgen Header Files"
+ >
+ <File
+ RelativePath="src\vm\fmgen\diag.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\file.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\fmgen.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\fmgeninl.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\fmtimer.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\headers.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\misc.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\opna.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\psg.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\types.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="VM Driver Header Files"
+ Filter="h"
+ >
+ <File
+ RelativePath="src\vm\fm7\fm7.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fm7\fm7_common.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fm7\fm7_dipsw.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fm7\fm7_display.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fm7\fm7_keyboard.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fm7\fm7_mainio.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fm7\fm7_mainmem.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath="src\res\fm7.ico"
+ >
+ </File>
+ <File
+ RelativePath="src\res\fm7.rc"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ AdditionalIncludeDirectories="src\res"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ AdditionalIncludeDirectories="src\res"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\res\resource.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- /dev/null
+<?xml version="1.0" encoding="shift_jis"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="msx1"
+ ProjectGUID="{F62D036D-7569-431B-9C55-C056A4D3145A}"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/msx1.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MSX1"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile=".\Debug/msx1.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1041"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib dsound.lib imm32.lib vfw32.lib"
+ OutputFile=".\Debug/msx1.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/msx1.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/msx1.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/msx1.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="2"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MSX1"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release/msx1.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib dsound.lib imm32.lib vfw32.lib"
+ OutputFile=".\Release/msx1.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile=".\Release/msx1.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/msx1.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="src\common.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\config.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\fifo.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\fileio.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\winmain.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <Filter
+ Name="EMU Source Files"
+ Filter="cpp"
+ >
+ <File
+ RelativePath="src\emu.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\win32_debugger.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\win32_input.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\win32_screen.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\win32_sound.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="VM Common Source Files"
+ Filter="cpp"
+ >
+ <File
+ RelativePath="src\vm\datarec.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\disk.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\event.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\i8255.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\io.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\not.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\pcm1bit.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\tms9918a.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\ym2203.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\z80.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <Filter
+ Name="fmgen Source Files"
+ Filter="cpp"
+ >
+ <File
+ RelativePath="src\vm\fmgen\file.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\fmgen.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\fmtimer.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\opna.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\psg.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="VM Driver Source Files"
+ Filter="cpp"
+ >
+ <File
+ RelativePath="src\vm\msx\joystick.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\msx\keyboard.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\msx\memory.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\msx\msx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="src\common.h"
+ >
+ </File>
+ <File
+ RelativePath="src\config.h"
+ >
+ </File>
+ <File
+ RelativePath="src\fifo.h"
+ >
+ </File>
+ <File
+ RelativePath="src\fileio.h"
+ >
+ </File>
+ <Filter
+ Name="EMU Header Files"
+ Filter="h"
+ >
+ <File
+ RelativePath="src\emu.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="VM Common Header Files"
+ Filter="h"
+ >
+ <File
+ RelativePath="src\vm\debugger.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\datarec.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\disk.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\device.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\event.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\i8255.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\io.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\not.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\pcm1bit.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\tms9918a.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\vm.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\ym2203.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\z80.h"
+ >
+ </File>
+ <Filter
+ Name="fmgen Header Files"
+ >
+ <File
+ RelativePath="src\vm\fmgen\diag.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\file.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\fmgen.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\fmgeninl.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\fmtimer.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\headers.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\misc.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\opna.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\psg.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\types.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="VM Driver Header Files"
+ Filter="h"
+ >
+ <File
+ RelativePath="src\vm\msx\joystick.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\msx\keyboard.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\msx\memory.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\msx\msx.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath="src\res\msx1.ico"
+ >
+ </File>
+ <File
+ RelativePath="src\res\msx1.rc"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ AdditionalIncludeDirectories="src\res"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ AdditionalIncludeDirectories="src\res"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\res\resource.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
--- /dev/null
+<?xml version="1.0" encoding="shift_jis"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="msx2"
+ ProjectGUID="{F62D036D-7569-431B-9C55-C056A4D3145A}"
+ TargetFrameworkVersion="131072"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory=".\Debug"
+ IntermediateDirectory=".\Debug"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="_DEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Debug/msx2.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MSX2"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
+ PrecompiledHeaderFile=".\Debug/msx2.pch"
+ AssemblerListingLocation=".\Debug/"
+ ObjectFile=".\Debug/"
+ ProgramDataBaseFileName=".\Debug/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG"
+ Culture="1041"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib dsound.lib imm32.lib vfw32.lib"
+ OutputFile=".\Debug/msx2.exe"
+ LinkIncremental="2"
+ SuppressStartupBanner="true"
+ GenerateDebugInformation="true"
+ ProgramDatabaseFile=".\Debug/msx2.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Debug/msx2.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory=".\Release"
+ IntermediateDirectory=".\Release"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
+ UseOfMFC="0"
+ ATLMinimizesCRunTimeLibraryUsage="false"
+ CharacterSet="2"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ PreprocessorDefinitions="NDEBUG"
+ MkTypLibCompatible="true"
+ SuppressStartupBanner="true"
+ TargetEnvironment="1"
+ TypeLibraryName=".\Release/msx2.tlb"
+ HeaderFileName=""
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ InlineFunctionExpansion="2"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MSX2"
+ StringPooling="true"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ PrecompiledHeaderFile=".\Release/msx2.pch"
+ AssemblerListingLocation=".\Release/"
+ ObjectFile=".\Release/"
+ ProgramDataBaseFileName=".\Release/"
+ BrowseInformation="1"
+ WarningLevel="3"
+ SuppressStartupBanner="true"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG"
+ Culture="1033"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="odbc32.lib odbccp32.lib winmm.lib dsound.lib imm32.lib vfw32.lib"
+ OutputFile=".\Release/msx2.exe"
+ LinkIncremental="1"
+ SuppressStartupBanner="true"
+ ProgramDatabaseFile=".\Release/msx2.pdb"
+ SubSystem="2"
+ RandomizedBaseAddress="1"
+ DataExecutionPrevention="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ SuppressStartupBanner="true"
+ OutputFile=".\Release/msx2.bsc"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+ >
+ <File
+ RelativePath="src\common.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\config.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\fifo.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\fileio.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\winmain.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <Filter
+ Name="EMU Source Files"
+ Filter="cpp"
+ >
+ <File
+ RelativePath="src\emu.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\win32_debugger.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\win32_input.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\win32_screen.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\win32_sound.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ <Filter
+ Name="VM Common Source Files"
+ Filter="cpp"
+ >
+ <File
+ RelativePath="src\vm\datarec.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\disk.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\event.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\i8255.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\io.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\not.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\pcm1bit.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\rp5c01.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\v99x8.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\ym2203.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\z80.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <Filter
+ Name="fmgen Source Files"
+ Filter="cpp"
+ >
+ <File
+ RelativePath="src\vm\fmgen\file.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\fmgen.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\fmtimer.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\opna.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\psg.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="VM Driver Source Files"
+ Filter="cpp"
+ >
+ <File
+ RelativePath="src\vm\msx\joystick.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\msx\keyboard.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\msx\memory.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\msx\msx.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\vm\msx\rtcif.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ PreprocessorDefinitions=""
+ />
+ </FileConfiguration>
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl"
+ >
+ <File
+ RelativePath="src\common.h"
+ >
+ </File>
+ <File
+ RelativePath="src\config.h"
+ >
+ </File>
+ <File
+ RelativePath="src\fifo.h"
+ >
+ </File>
+ <File
+ RelativePath="src\fileio.h"
+ >
+ </File>
+ <Filter
+ Name="EMU Header Files"
+ Filter="h"
+ >
+ <File
+ RelativePath="src\emu.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="VM Common Header Files"
+ Filter="h"
+ >
+ <File
+ RelativePath="src\vm\debugger.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\datarec.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\disk.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\device.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\event.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\i8255.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\io.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\not.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\rp5c01.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\pcm1bit.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\v99x8.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\vm.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\ym2203.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\z80.h"
+ >
+ </File>
+ <Filter
+ Name="fmgen Header Files"
+ >
+ <File
+ RelativePath="src\vm\fmgen\diag.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\file.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\fmgen.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\fmgeninl.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\fmtimer.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\headers.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\misc.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\opna.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\psg.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\fmgen\types.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="VM Driver Header Files"
+ Filter="h"
+ >
+ <File
+ RelativePath="src\vm\msx\joystick.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\msx\keyboard.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\msx\memory.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\msx\msx.h"
+ >
+ </File>
+ <File
+ RelativePath="src\vm\msx\rtcif.h"
+ >
+ </File>
+ </Filter>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+ >
+ <File
+ RelativePath="src\res\msx2.ico"
+ >
+ </File>
+ <File
+ RelativePath="src\res\msx2.rc"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ AdditionalIncludeDirectories="src\res"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions=""
+ AdditionalIncludeDirectories="src\res"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="src\res\resource.h"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
#if defined(USE_DIPSWITCH) && defined(DIPSWITCH_DEFAULT)
config.dipswitch = DIPSWITCH_DEFAULT;
#endif
+#if defined(_FM8) || defined(_FM7) || defined(_FMNEW7) || defined(_FM77_VARIANTS) || defined(_FM77AV_VARIANTS)
+ config.ignore_crc = true;
+#endif
+ // FM7 Series:
+ // 0 = PSG or NONE
+ // 1 = OPN (+PSG)
+ // 2 = WHG (+PSG)
+ // 3 = WHG + OPN (+PSG)
+ // 4 = THG (+PSG)
+ // 5 = THG + OPN (+PSG)
+ // 6 = THG + WHG (+PSG)
+ // 7 = THG + WHG + OPN (+PSG)
+#if defined(_FM8)
+ config.sound_device_type = 0; // WITHOUT PSG?
+#elif defined(_FM7) || defined(_FMNEW7) || defined(_FM77_VARIANTS)
+ config.sound_device_type = 0; // PSG ONLY
+#elif defined(_FM77AV_VARIANTS)
+ config.sound_device_type = 1; // OPN
+#endif
#if defined(_HC80)
config.device_type = 2; // Nonintelligent ram disk
#endif
uint8 keycode_conv[256];
uint8 key_status[256]; // windows key code mapping
uint32_t modkey_status;
+ uint8 key_dik_prev[256];
#ifdef USE_SHIFT_NUMPAD_KEY
uint8 key_converted[256];
bool key_shift_pressed, key_shift_released;
--- /dev/null
+// 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_SCREEN, VIRTKEY, ALT, NOINVERT
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDR_MENU1 MENU DISCARDABLE
+BEGIN
+ POPUP "Control"
+ BEGIN
+ MENUITEM "Reset", ID_RESET
+ MENUITEM SEPARATOR
+ MENUITEM "BASIC" ID_BOOT_MODE0
+ MENUITEM "DOS" ID_BOOT_MODE1
+ MENUITEM "MMR" ID_BOOT_MODE2
+ MENUITEM SEPARATOR
+ MENUITEM "CPU 2.0MHz", ID_CPU_TYPE0
+ MENUITEM "CPU 1.2MHz", ID_CPU_TYPE1
+ 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 SEPARATOR
+ MENUITEM "Paste", ID_AUTOKEY_START
+ MENUITEM "Stop", ID_AUTOKEY_STOP
+ MENUITEM SEPARATOR
+ MENUITEM "Save State", ID_SAVE_STATE
+ MENUITEM "Load State", ID_LOAD_STATE
+ MENUITEM SEPARATOR
+ MENUITEM "Debug Main CPU", ID_OPEN_DEBUGGER0
+ 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 SEPARATOR
+ MENUITEM "Recent", ID_RECENT_FD1
+ END
+ POPUP "FD2"
+ BEGIN
+ MENUITEM "Insert", ID_OPEN_FD2
+ MENUITEM "Eject", ID_CLOSE_FD2
+ MENUITEM SEPARATOR
+ MENUITEM "Recent", ID_RECENT_FD2
+ END
+ POPUP "CMT"
+ BEGIN
+ MENUITEM "Play", ID_PLAY_TAPE
+ MENUITEM "Rec", ID_REC_TAPE
+ MENUITEM "Eject", ID_CLOSE_TAPE
+ MENUITEM SEPARATOR
+ MENUITEM "Play Tape Sound", ID_PLAY_TAPE_SOUND
+ MENUITEM "Waveform Shaper", ID_USE_WAVE_SHAPER
+ MENUITEM SEPARATOR
+ MENUITEM "Recent", ID_RECENT_TAPE
+ END
+ POPUP "Screen"
+ BEGIN
+ MENUITEM "Rec 60fps", ID_SCREEN_REC60
+ MENUITEM "Rec 30fps", ID_SCREEN_REC30
+ MENUITEM "Rec 15fps", ID_SCREEN_REC15
+ MENUITEM "Stop", ID_SCREEN_STOP
+ MENUITEM "Capture", ID_SCREEN_CAPTURE
+ MENUITEM SEPARATOR
+ MENUITEM "Window x1", ID_SCREEN_WINDOW1
+ MENUITEM "Window x2", ID_SCREEN_WINDOW2
+ MENUITEM "Window x3", ID_SCREEN_WINDOW3
+ MENUITEM "Window x4", ID_SCREEN_WINDOW4
+ MENUITEM "Window x5", ID_SCREEN_WINDOW5
+ MENUITEM "Window x6", ID_SCREEN_WINDOW6
+ MENUITEM "Window x7", ID_SCREEN_WINDOW7
+ MENUITEM "Window x8", ID_SCREEN_WINDOW8
+ MENUITEM "Fullscreen 1", ID_SCREEN_FULLSCREEN1
+ MENUITEM "Fullscreen 2", ID_SCREEN_FULLSCREEN2
+ MENUITEM "Fullscreen 3", ID_SCREEN_FULLSCREEN3
+ MENUITEM "Fullscreen 4", ID_SCREEN_FULLSCREEN4
+ MENUITEM "Fullscreen 5", ID_SCREEN_FULLSCREEN5
+ MENUITEM "Fullscreen 6", ID_SCREEN_FULLSCREEN6
+ MENUITEM "Fullscreen 7", ID_SCREEN_FULLSCREEN7
+ MENUITEM "Fullscreen 8", ID_SCREEN_FULLSCREEN8
+ MENUITEM "Fullscreen 9", ID_SCREEN_FULLSCREEN9
+ MENUITEM "Fullscreen 10", ID_SCREEN_FULLSCREEN10
+ MENUITEM "Fullscreen 11", ID_SCREEN_FULLSCREEN11
+ MENUITEM "Fullscreen 12", ID_SCREEN_FULLSCREEN12
+ MENUITEM "Fullscreen 13", ID_SCREEN_FULLSCREEN13
+ MENUITEM "Fullscreen 14", ID_SCREEN_FULLSCREEN14
+ MENUITEM "Fullscreen 15", ID_SCREEN_FULLSCREEN15
+ MENUITEM "Fullscreen 16", ID_SCREEN_FULLSCREEN16
+ MENUITEM "Fullscreen 17", ID_SCREEN_FULLSCREEN17
+ MENUITEM "Fullscreen 18", ID_SCREEN_FULLSCREEN18
+ MENUITEM "Fullscreen 19", ID_SCREEN_FULLSCREEN19
+ MENUITEM "Fullscreen 20", ID_SCREEN_FULLSCREEN20
+ MENUITEM "Fullscreen 21", ID_SCREEN_FULLSCREEN21
+ MENUITEM "Fullscreen 22", ID_SCREEN_FULLSCREEN22
+ MENUITEM "Fullscreen 23", ID_SCREEN_FULLSCREEN23
+ MENUITEM "Fullscreen 24", ID_SCREEN_FULLSCREEN24
+ MENUITEM "Fullscreen 25", ID_SCREEN_FULLSCREEN25
+ MENUITEM "Fullscreen 26", ID_SCREEN_FULLSCREEN26
+ MENUITEM "Fullscreen 27", ID_SCREEN_FULLSCREEN27
+ MENUITEM "Fullscreen 28", ID_SCREEN_FULLSCREEN28
+ MENUITEM "Fullscreen 29", ID_SCREEN_FULLSCREEN29
+ MENUITEM "Fullscreen 30", ID_SCREEN_FULLSCREEN30
+ MENUITEM "Fullscreen 31", ID_SCREEN_FULLSCREEN31
+ MENUITEM "Fullscreen 32", ID_SCREEN_FULLSCREEN32
+ MENUITEM SEPARATOR
+ MENUITEM "Dot By Dot", ID_SCREEN_STRETCH_DOT
+ MENUITEM "Stretch (Aspect)", ID_SCREEN_STRETCH_ASPECT
+ MENUITEM "Stretch (Fill)", ID_SCREEN_STRETCH_FILL
+ MENUITEM SEPARATOR
+ MENUITEM "Use Direct3D9", ID_SCREEN_USE_D3D9
+ MENUITEM "Wait Vsync", ID_SCREEN_WAIT_VSYNC
+ MENUITEM SEPARATOR
+ MENUITEM "CRT Filter", ID_SCREEN_CRT_FILTER
+ MENUITEM "Scanline", ID_SCREEN_SCANLINE
+ END
+ POPUP "Sound"
+ BEGIN
+ MENUITEM "Rec", ID_SOUND_REC
+ MENUITEM "Stop", ID_SOUND_STOP
+ MENUITEM SEPARATOR
+ 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 "48000Hz", 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 "PSG", ID_SOUND_DEVICE_TYPE0
+ MENUITEM "PSG+OPN", ID_SOUND_DEVICE_TYPE1
+ MENUITEM "PSG+WHG", ID_SOUND_DEVICE_TYPE2
+ MENUITEM "PSG+OPN+WHG", ID_SOUND_DEVICE_TYPE3
+ MENUITEM "PSG+THG", ID_SOUND_DEVICE_TYPE4
+ MENUITEM "PSG+OPN+THG", ID_SOUND_DEVICE_TYPE5
+ MENUITEM "PSG+WHG+THG", ID_SOUND_DEVICE_TYPE6
+ MENUITEM "PSG+OPN+WHG+THG", ID_SOUND_DEVICE_TYPE7
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON1 ICON DISCARDABLE "fm7.ico"
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
FAMILYBASIC
BUBCOM80 (FM8)
+FM8
+FM7
+FM77L2
+FM77L4
+FM77AV
+FM77AV40SX
FM11
FP1100
HC20
--- /dev/null
+// 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_SCREEN, VIRTKEY, ALT, 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 SEPARATOR
+ MENUITEM "Paste", ID_AUTOKEY_START
+ MENUITEM "Stop", ID_AUTOKEY_STOP
+ MENUITEM SEPARATOR
+ MENUITEM "Save State", ID_SAVE_STATE
+ MENUITEM "Load State", ID_LOAD_STATE
+ MENUITEM SEPARATOR
+ MENUITEM "Debug Main CPU", ID_OPEN_DEBUGGER0
+ MENUITEM "Close Debugger", ID_CLOSE_DEBUGGER
+ MENUITEM SEPARATOR
+ MENUITEM "Exit", ID_EXIT
+ END
+ POPUP "Cart #1"
+ BEGIN
+ MENUITEM "Insert", ID_OPEN_CART1
+ MENUITEM "Eject", ID_CLOSE_CART1
+ MENUITEM SEPARATOR
+ MENUITEM "Recent", ID_RECENT_CART1
+ END
+ POPUP "Cart #2"
+ BEGIN
+ MENUITEM "Insert", ID_OPEN_CART2
+ MENUITEM "Eject", ID_CLOSE_CART2
+ MENUITEM SEPARATOR
+ MENUITEM "Recent", ID_RECENT_CART2
+ END
+ POPUP "CMT"
+ BEGIN
+ MENUITEM "Play", ID_PLAY_TAPE
+ MENUITEM "Rec", ID_REC_TAPE
+ MENUITEM "Eject", ID_CLOSE_TAPE
+ MENUITEM SEPARATOR
+ MENUITEM "Play Tape Sound", ID_PLAY_TAPE_SOUND
+ MENUITEM "Waveform Shaper", ID_USE_WAVE_SHAPER
+ MENUITEM SEPARATOR
+ MENUITEM "Recent", ID_RECENT_TAPE
+ END
+ POPUP "FD1"
+ BEGIN
+ MENUITEM "Insert", ID_OPEN_FD1
+ MENUITEM "Eject", ID_CLOSE_FD1
+ MENUITEM SEPARATOR
+ MENUITEM "Recent", ID_RECENT_FD1
+ END
+ POPUP "FD2"
+ BEGIN
+ MENUITEM "Insert", ID_OPEN_FD2
+ MENUITEM "Eject", ID_CLOSE_FD2
+ MENUITEM SEPARATOR
+ MENUITEM "Recent", ID_RECENT_FD2
+ END
+ POPUP "Screen"
+ BEGIN
+ MENUITEM "Rec 60fps", ID_SCREEN_REC60
+ MENUITEM "Rec 30fps", ID_SCREEN_REC30
+ MENUITEM "Rec 15fps", ID_SCREEN_REC15
+ MENUITEM "Stop", ID_SCREEN_STOP
+ MENUITEM "Capture", ID_SCREEN_CAPTURE
+ MENUITEM SEPARATOR
+ MENUITEM "Window x1", ID_SCREEN_WINDOW1
+ MENUITEM "Window x2", ID_SCREEN_WINDOW2
+ MENUITEM "Window x3", ID_SCREEN_WINDOW3
+ MENUITEM "Window x4", ID_SCREEN_WINDOW4
+ MENUITEM "Window x5", ID_SCREEN_WINDOW5
+ MENUITEM "Window x6", ID_SCREEN_WINDOW6
+ MENUITEM "Window x7", ID_SCREEN_WINDOW7
+ MENUITEM "Window x8", ID_SCREEN_WINDOW8
+ MENUITEM "Fullscreen 1", ID_SCREEN_FULLSCREEN1
+ MENUITEM "Fullscreen 2", ID_SCREEN_FULLSCREEN2
+ MENUITEM "Fullscreen 3", ID_SCREEN_FULLSCREEN3
+ MENUITEM "Fullscreen 4", ID_SCREEN_FULLSCREEN4
+ MENUITEM "Fullscreen 5", ID_SCREEN_FULLSCREEN5
+ MENUITEM "Fullscreen 6", ID_SCREEN_FULLSCREEN6
+ MENUITEM "Fullscreen 7", ID_SCREEN_FULLSCREEN7
+ MENUITEM "Fullscreen 8", ID_SCREEN_FULLSCREEN8
+ MENUITEM "Fullscreen 9", ID_SCREEN_FULLSCREEN9
+ MENUITEM "Fullscreen 10", ID_SCREEN_FULLSCREEN10
+ MENUITEM "Fullscreen 11", ID_SCREEN_FULLSCREEN11
+ MENUITEM "Fullscreen 12", ID_SCREEN_FULLSCREEN12
+ MENUITEM "Fullscreen 13", ID_SCREEN_FULLSCREEN13
+ MENUITEM "Fullscreen 14", ID_SCREEN_FULLSCREEN14
+ MENUITEM "Fullscreen 15", ID_SCREEN_FULLSCREEN15
+ MENUITEM "Fullscreen 16", ID_SCREEN_FULLSCREEN16
+ MENUITEM "Fullscreen 17", ID_SCREEN_FULLSCREEN17
+ MENUITEM "Fullscreen 18", ID_SCREEN_FULLSCREEN18
+ MENUITEM "Fullscreen 19", ID_SCREEN_FULLSCREEN19
+ MENUITEM "Fullscreen 20", ID_SCREEN_FULLSCREEN20
+ MENUITEM "Fullscreen 21", ID_SCREEN_FULLSCREEN21
+ MENUITEM "Fullscreen 22", ID_SCREEN_FULLSCREEN22
+ MENUITEM "Fullscreen 23", ID_SCREEN_FULLSCREEN23
+ MENUITEM "Fullscreen 24", ID_SCREEN_FULLSCREEN24
+ MENUITEM "Fullscreen 25", ID_SCREEN_FULLSCREEN25
+ MENUITEM "Fullscreen 26", ID_SCREEN_FULLSCREEN26
+ MENUITEM "Fullscreen 27", ID_SCREEN_FULLSCREEN27
+ MENUITEM "Fullscreen 28", ID_SCREEN_FULLSCREEN28
+ MENUITEM "Fullscreen 29", ID_SCREEN_FULLSCREEN29
+ MENUITEM "Fullscreen 30", ID_SCREEN_FULLSCREEN30
+ MENUITEM "Fullscreen 31", ID_SCREEN_FULLSCREEN31
+ MENUITEM "Fullscreen 32", ID_SCREEN_FULLSCREEN32
+ MENUITEM SEPARATOR
+ MENUITEM "Dot By Dot", ID_SCREEN_STRETCH_DOT
+ MENUITEM "Stretch (Aspect)", ID_SCREEN_STRETCH_ASPECT
+ MENUITEM "Stretch (Fill)", ID_SCREEN_STRETCH_FILL
+ MENUITEM SEPARATOR
+ MENUITEM "Use Direct3D9", ID_SCREEN_USE_D3D9
+ MENUITEM "Wait Vsync", ID_SCREEN_WAIT_VSYNC
+ END
+ POPUP "Sound"
+ BEGIN
+ MENUITEM "Rec", ID_SOUND_REC
+ MENUITEM "Stop", ID_SOUND_STOP
+ MENUITEM SEPARATOR
+ 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 "48000Hz", 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
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON1 ICON DISCARDABLE "msx1.ico"
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
--- /dev/null
+// 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_SCREEN, VIRTKEY, ALT, 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 SEPARATOR
+ MENUITEM "Paste", ID_AUTOKEY_START
+ MENUITEM "Stop", ID_AUTOKEY_STOP
+ MENUITEM SEPARATOR
+ MENUITEM "Save State", ID_SAVE_STATE
+ MENUITEM "Load State", ID_LOAD_STATE
+ MENUITEM SEPARATOR
+ MENUITEM "Debug Main CPU", ID_OPEN_DEBUGGER0
+ MENUITEM "Close Debugger", ID_CLOSE_DEBUGGER
+ MENUITEM SEPARATOR
+ MENUITEM "Exit", ID_EXIT
+ END
+ POPUP "Cart #1"
+ BEGIN
+ MENUITEM "Insert", ID_OPEN_CART1
+ MENUITEM "Eject", ID_CLOSE_CART1
+ MENUITEM SEPARATOR
+ MENUITEM "Recent", ID_RECENT_CART1
+ END
+ POPUP "Cart #2"
+ BEGIN
+ MENUITEM "Insert", ID_OPEN_CART2
+ MENUITEM "Eject", ID_CLOSE_CART2
+ MENUITEM SEPARATOR
+ MENUITEM "Recent", ID_RECENT_CART2
+ END
+ POPUP "CMT"
+ BEGIN
+ MENUITEM "Play", ID_PLAY_TAPE
+ MENUITEM "Rec", ID_REC_TAPE
+ MENUITEM "Eject", ID_CLOSE_TAPE
+ MENUITEM SEPARATOR
+ MENUITEM "Play Tape Sound", ID_PLAY_TAPE_SOUND
+ MENUITEM "Waveform Shaper", ID_USE_WAVE_SHAPER
+ MENUITEM SEPARATOR
+ MENUITEM "Recent", ID_RECENT_TAPE
+ END
+ POPUP "FD1"
+ BEGIN
+ MENUITEM "Insert", ID_OPEN_FD1
+ MENUITEM "Eject", ID_CLOSE_FD1
+ MENUITEM SEPARATOR
+ MENUITEM "Recent", ID_RECENT_FD1
+ END
+ POPUP "FD2"
+ BEGIN
+ MENUITEM "Insert", ID_OPEN_FD2
+ MENUITEM "Eject", ID_CLOSE_FD2
+ MENUITEM SEPARATOR
+ MENUITEM "Recent", ID_RECENT_FD2
+ END
+ POPUP "Screen"
+ BEGIN
+ MENUITEM "Rec 60fps", ID_SCREEN_REC60
+ MENUITEM "Rec 30fps", ID_SCREEN_REC30
+ MENUITEM "Rec 15fps", ID_SCREEN_REC15
+ MENUITEM "Stop", ID_SCREEN_STOP
+ MENUITEM "Capture", ID_SCREEN_CAPTURE
+ MENUITEM SEPARATOR
+ MENUITEM "Window x1", ID_SCREEN_WINDOW1
+ MENUITEM "Window x2", ID_SCREEN_WINDOW2
+ MENUITEM "Window x3", ID_SCREEN_WINDOW3
+ MENUITEM "Window x4", ID_SCREEN_WINDOW4
+ MENUITEM "Window x5", ID_SCREEN_WINDOW5
+ MENUITEM "Window x6", ID_SCREEN_WINDOW6
+ MENUITEM "Window x7", ID_SCREEN_WINDOW7
+ MENUITEM "Window x8", ID_SCREEN_WINDOW8
+ MENUITEM "Fullscreen 1", ID_SCREEN_FULLSCREEN1
+ MENUITEM "Fullscreen 2", ID_SCREEN_FULLSCREEN2
+ MENUITEM "Fullscreen 3", ID_SCREEN_FULLSCREEN3
+ MENUITEM "Fullscreen 4", ID_SCREEN_FULLSCREEN4
+ MENUITEM "Fullscreen 5", ID_SCREEN_FULLSCREEN5
+ MENUITEM "Fullscreen 6", ID_SCREEN_FULLSCREEN6
+ MENUITEM "Fullscreen 7", ID_SCREEN_FULLSCREEN7
+ MENUITEM "Fullscreen 8", ID_SCREEN_FULLSCREEN8
+ MENUITEM "Fullscreen 9", ID_SCREEN_FULLSCREEN9
+ MENUITEM "Fullscreen 10", ID_SCREEN_FULLSCREEN10
+ MENUITEM "Fullscreen 11", ID_SCREEN_FULLSCREEN11
+ MENUITEM "Fullscreen 12", ID_SCREEN_FULLSCREEN12
+ MENUITEM "Fullscreen 13", ID_SCREEN_FULLSCREEN13
+ MENUITEM "Fullscreen 14", ID_SCREEN_FULLSCREEN14
+ MENUITEM "Fullscreen 15", ID_SCREEN_FULLSCREEN15
+ MENUITEM "Fullscreen 16", ID_SCREEN_FULLSCREEN16
+ MENUITEM "Fullscreen 17", ID_SCREEN_FULLSCREEN17
+ MENUITEM "Fullscreen 18", ID_SCREEN_FULLSCREEN18
+ MENUITEM "Fullscreen 19", ID_SCREEN_FULLSCREEN19
+ MENUITEM "Fullscreen 20", ID_SCREEN_FULLSCREEN20
+ MENUITEM "Fullscreen 21", ID_SCREEN_FULLSCREEN21
+ MENUITEM "Fullscreen 22", ID_SCREEN_FULLSCREEN22
+ MENUITEM "Fullscreen 23", ID_SCREEN_FULLSCREEN23
+ MENUITEM "Fullscreen 24", ID_SCREEN_FULLSCREEN24
+ MENUITEM "Fullscreen 25", ID_SCREEN_FULLSCREEN25
+ MENUITEM "Fullscreen 26", ID_SCREEN_FULLSCREEN26
+ MENUITEM "Fullscreen 27", ID_SCREEN_FULLSCREEN27
+ MENUITEM "Fullscreen 28", ID_SCREEN_FULLSCREEN28
+ MENUITEM "Fullscreen 29", ID_SCREEN_FULLSCREEN29
+ MENUITEM "Fullscreen 30", ID_SCREEN_FULLSCREEN30
+ MENUITEM "Fullscreen 31", ID_SCREEN_FULLSCREEN31
+ MENUITEM "Fullscreen 32", ID_SCREEN_FULLSCREEN32
+ MENUITEM SEPARATOR
+ MENUITEM "Dot By Dot", ID_SCREEN_STRETCH_DOT
+ MENUITEM "Stretch (Aspect)", ID_SCREEN_STRETCH_ASPECT
+ MENUITEM "Stretch (Fill)", ID_SCREEN_STRETCH_FILL
+ MENUITEM SEPARATOR
+ MENUITEM "Use Direct3D9", ID_SCREEN_USE_D3D9
+ MENUITEM "Wait Vsync", ID_SCREEN_WAIT_VSYNC
+ END
+ POPUP "Sound"
+ BEGIN
+ MENUITEM "Rec", ID_SOUND_REC
+ MENUITEM "Stop", ID_SOUND_STOP
+ MENUITEM SEPARATOR
+ 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 "48000Hz", 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
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_ICON1 ICON DISCARDABLE "msx2.ico"
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
#define MENU_POS_SOUND 3
#endif
+// FUJITSU FM-7
+#ifdef _FM7
+#define MENU_POS_CONTROL 0
+#define MENU_POS_FD1 1
+#define MENU_POS_FD2 2
+#define MENU_POS_TAPE 3
+#define MENU_POS_SCREEN 4
+#define MENU_POS_SOUND 5
+#endif
+
// FUJITSU FM16pi
#ifdef _FM16PI
#define MENU_POS_CONTROL 0
#define MENU_POS_SOUND 3
#endif
+// ASCII MSX1
+#ifdef _MSX1
+#define MENU_POS_CONTROL 0
+#define MENU_POS_CART1 1
+#define MENU_POS_CART2 2
+#define MENU_POS_TAPE 3
+#define MENU_POS_FD1 4
+#define MENU_POS_FD2 5
+#define MENU_POS_SCREEN 6
+#define MENU_POS_SOUND 7
+#endif
+
+// ASCII MSX2
+#ifdef _MSX2
+#define MENU_POS_CONTROL 0
+#define MENU_POS_CART1 1
+#define MENU_POS_CART2 2
+#define MENU_POS_TAPE 3
+#define MENU_POS_FD1 4
+#define MENU_POS_FD2 5
+#define MENU_POS_SCREEN 6
+#define MENU_POS_SOUND 7
+#endif
+
// MITSUBISHI Elec. MULTI8
#ifdef _MULTI8
#define MENU_POS_CONTROL 0
{
return false;
}
- virtual bool bios_call_z80(uint16 PC, uint16* AF, uint16* BC, uint16* DE, uint16* HL, uint16* IX, uint16* IY)
+ virtual bool bios_ret_z80(uint16 PC, pair* af, pair* bc, pair* de, pair* hl, pair* ix, pair* iy, uint8* iff1)
{
return false;
}
static const fd_format_t fd_formats[] = {
{ MEDIA_TYPE_2D, 40, 1, 16, 256 }, // 1D 160KB
+#if defined(SUPPORT_MEDIA_TYPE_1DD)
+ { MEDIA_TYPE_2DD, 80, 1, 16, 256 }, // 1DD 320KB
+ { MEDIA_TYPE_2DD, 80, 1, 9, 512 }, // 1DD 360KB
+#else
{ MEDIA_TYPE_2D , 40, 2, 16, 256 }, // 2D 320KB
+ { MEDIA_TYPE_2D, 40, 2, 9, 512 }, // 2D 360KB
+#endif
#if defined(_MZ80B) || defined(_MZ2000) || defined(_MZ2200) || defined(_MZ2500)
{ MEDIA_TYPE_2DD, 80, 2, 16, 256 }, // 2DD 640KB (MZ-2500)
#else
{ MEDIA_TYPE_2DD, 80, 2, 8, 512 }, // 2DD 640KB
#endif
{ MEDIA_TYPE_2DD, 80, 2, 9, 512 }, // 2DD 720KB
+#if defined(_PX7) || defined(_MSX1) || defined(_MSX2)
+ { MEDIA_TYPE_2DD, 81, 2, 9, 512 }, // 2DD 729KB
+#endif
{ MEDIA_TYPE_2HD, 80, 2, 15, 512 }, // 2HC 1.20MB
{ MEDIA_TYPE_2HD, 77, 2, 8, 1024 }, // 2HD 1.25MB
{ MEDIA_TYPE_144, 80, 2, 18, 512 }, // 2HD 1.44MB
if(!(0 <= trkside && trkside < 164)) {
return false;
}
+ cur_track = trk;
+ cur_side = side;
+
pair offset;
offset.read_4bytes_le_from(buffer + 0x20 + trkside * 4);
}
// search track
+ if(trk == -1 && side == -1) {
+ trk = cur_track;
+ side = cur_side;
+ }
int trkside = trk * 2 + (side & 1);
if(!(0 <= trkside && trkside < 164)) {
return false;
crc = (uint16)((crc << 8) ^ crc_table[(uint8)(crc >> 8) ^ t[3]]);
id[4] = (crc >> 8) & 0xff;
id[5] = (crc >> 0) & 0xff;
+ // http://www,gnu-darwin.or.jp/www001/src/ports/emulators/quasi88/work/quasi88-0.6.3/document/FORMAT.TXT
+ // t[6]: 0x00 = double-density, 0x40 = single-density
+ // t[7]: 0x00 = normal, 0x10 = deleted mark
+ // t[8]: 0x00 = valid, 0x10 = valid (deleted data), 0xa0 = id crc error, 0xb0 = data crc error, 0xe0 = address mark missing, 0xf0 = data mark missing
density = t[6];
deleted = (t[7] != 0);
//crc_error = (t[8] != 0x00 && t[8] != 0x10);
{
if(sector != NULL) {
uint8 *t = sector - 0x10;
- t[8] = value ? 0xb0 : t[7];
+ t[8] = value ? 0xb0 : t[7]; // FIXME: always data crc error ?
}
crc_error = value;
}
t[5] = sector_num.b.h;
t[6] = drive_mfm ? 0 : 0x40;
t[7] = deleted ? 0x10 : 0;
- t[8] = crc_error ? 0xb0 : t[7];
+ t[8] = crc_error ? 0xb0 : t[7]; // FIXME: always data crc error ?
t[14] = (length >> 0) & 0xff;
t[15] = (length >> 8) & 0xff;
memset(t + 16, fill_data, length);
set_sector_info(t);
}
+void DISK::sync_buffer()
+{
+ if(trim_required) {
+ trim_buffer();
+ trim_required = false;
+ }
+}
+
void DISK::trim_buffer()
{
int max_tracks = 164;
void set_sector_info(uint8 *t);
void trim_buffer();
- bool check_media_type();
// teledisk image decoder (td0)
bool teledisk_to_d88();
bool format_track(int trk, int side);
void insert_sector(uint8 c, uint8 h, uint8 r, uint8 n, bool deleted, bool crc_error, uint8 fill_data, int length);
+ void sync_buffer();
int get_rpm();
int get_track_size();
double get_usec_per_bytes(int bytes);
- void sync_buffer(void){
- if(trim_required) trim_buffer();
- trim_required = false;
- }
+ bool check_media_type();
+
bool inserted;
bool ejected;
bool write_protected;
pair sector_num;
bool invalid_format;
bool no_skew;
+ int cur_track, cur_side;
int sync_position[256];
int id_position[256];
#define MAX_MEMCARD 2
//#define HAS_I286
#define HAS_I86
-#define I86_BIOS_CALL
+#define I86_PSEUDO_BIOS
#define HAS_I8254
#define I8259_MAX_CHIPS 2
//#define SINGLE_MODE_DMA
#define MAX_SCSI 8
#define MAX_MEMCARD 2
#if defined(HAS_I286)
-#define I86_BIOS_CALL
+#define I86_PSEUDO_BIOS
#else
-#define I386_BIOS_CALL
+#define I386_PSEUDO_BIOS
#endif
#define I8259_MAX_CHIPS 2
//#define SINGLE_MODE_DMA
cpustate->pic = d_pic;
cpustate->program = d_mem;
cpustate->io = d_io;
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
cpustate->bios = d_bios;
#endif
#ifdef SINGLE_MODE_DMA
cpustate->pic = d_pic;
cpustate->program = d_mem;
cpustate->io = d_io;
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
cpustate->bios = d_bios;
#endif
#ifdef SINGLE_MODE_DMA
cpustate->pic = d_pic;
cpustate->program = d_mem;
cpustate->io = d_io;
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
cpustate->bios = d_bios;
#endif
#ifdef SINGLE_MODE_DMA
{
private:
DEVICE *d_mem, *d_io, *d_pic;
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
DEVICE *d_bios;
#endif
#ifdef SINGLE_MODE_DMA
public:
I286(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
{
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
d_bios = NULL;
#endif
#ifdef SINGLE_MODE_DMA
{
d_pic = device;
}
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
void set_context_bios(DEVICE* device)
{
d_bios = device;
/* Highly useful macro for compile-time knowledge of an array size */
#define ARRAY_LENGTH(x) (sizeof(x) / sizeof(x[0]))
-#ifdef I386_BIOS_CALL
+#ifdef I386_PSEUDO_BIOS
#define BIOS_INT(num) if(cpustate->bios != NULL) { \
uint16 regs[8], sregs[4]; \
regs[0] = REG16(AX); regs[1] = REG16(CX); regs[2] = REG16(DX); regs[3] = REG16(BX); \
cpustate->pic = d_pic;
cpustate->program = d_mem;
cpustate->io = d_io;
-#ifdef I386_BIOS_CALL
+#ifdef I386_PSEUDO_BIOS
cpustate->bios = d_bios;
#endif
#ifdef SINGLE_MODE_DMA
cpustate->pic = d_pic;
cpustate->program = d_mem;
cpustate->io = d_io;
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
cpustate->bios = d_bios;
#endif
#ifdef SINGLE_MODE_DMA
{
private:
DEVICE *d_mem, *d_io, *d_pic;
-#ifdef I386_BIOS_CALL
+#ifdef I386_PSEUDO_BIOS
DEVICE *d_bios;
#endif
#ifdef SINGLE_MODE_DMA
public:
I386(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
{
-#ifdef I386_BIOS_CALL
+#ifdef I386_PSEUDO_BIOS
d_bios = NULL;
#endif
#ifdef SINGLE_MODE_DMA
{
d_pic = device;
}
-#ifdef I386_BIOS_CALL
+#ifdef I386_PSEUDO_BIOS
void set_context_bios(DEVICE* device)
{
d_bios = device;
sregs[CS] = (uint16)tmp2;
base[CS] = SegBase(CS);
pc = (base[CS] + (uint16)tmp) & AMASK;
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
if(d_bios && d_bios->bios_call_i86(pc, regs.w, sregs, &ZeroVal, &CarryVal)) {
/* bios call */
_retf();
{
unsigned int_num = FETCH;
icount -= timing.int_imm;
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
if(d_bios && d_bios->bios_int_i86(int_num, regs.w, sregs, &ZeroVal, &CarryVal)) {
/* bios call */
return;
PUSH(ip);
ip += tmp;
pc = (ip + base[CS]) & AMASK;
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
if(d_bios && d_bios->bios_call_i86(pc, regs.w, sregs, &ZeroVal, &CarryVal)) {
/* bios call */
_ret();
ip = pc - base[CS];
PUSH(ip);
pc = (base[CS] + (uint16)tmp) & AMASK;
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
if(d_bios && d_bios->bios_call_i86(pc, regs.w, sregs, &ZeroVal, &CarryVal)) {
/* bios call */
_ret();
sregs[CS] = GetNextRMWord;
base[CS] = SegBase(CS);
pc = (base[CS] + tmp1) & AMASK;
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
if(d_bios && d_bios->bios_call_i86(pc, regs.w, sregs, &ZeroVal, &CarryVal)) {
/* bios call */
_ret();
UINT16 offset = FETCH16(cpustate);
UINT16 ptr = FETCH16(cpustate);
-#ifdef I386_BIOS_CALL
+#ifdef I386_PSEUDO_BIOS
BIOS_CALL(((ptr << 4) + offset) & cpustate->a20_mask)
#endif
{
INT16 disp = FETCH16(cpustate);
-#ifdef I386_BIOS_CALL
+#ifdef I386_PSEUDO_BIOS
BIOS_CALL((cpustate->pc + disp) & cpustate->a20_mask)
#endif
address = READ16(cpustate,ea);
CYCLES(cpustate,CYCLES_CALL_MEM); /* TODO: Timing = 10 + m */
}
-#ifdef I386_BIOS_CALL
+#ifdef I386_PSEUDO_BIOS
BIOS_CALL(((cpustate->sreg[CS].selector << 4) + address) & cpustate->a20_mask)
#endif
PUSH16(cpustate, cpustate->eip );
address = READ16(cpustate,ea + 0);
selector = READ16(cpustate,ea + 2);
CYCLES(cpustate,CYCLES_CALL_MEM_INTERSEG); /* TODO: Timing = 10 + m */
-#ifdef I386_BIOS_CALL
+#ifdef I386_PSEUDO_BIOS
BIOS_CALL(((selector << 4) + address) & cpustate->a20_mask)
#endif
if(PROTECTED_MODE && !V8086_MODE)
{
int interrupt = FETCH(cpustate);
CYCLES(cpustate,CYCLES_INT);
-#ifdef I386_BIOS_CALL
+#ifdef I386_PSEUDO_BIOS
BIOS_INT(interrupt)
#endif
cpustate->ext = 0; // not an external interrupt
DEVICE *pic;
DEVICE *program;
DEVICE *io;
-#ifdef I386_BIOS_CALL
+#ifdef I386_PSEUDO_BIOS
DEVICE *bios;
#endif
#ifdef SINGLE_MODE_DMA
DEVICE *pic;
DEVICE *program;
DEVICE *io;
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
DEVICE *bios;
#endif
#ifdef SINGLE_MODE_DMA
DEVICE *pic;
DEVICE *program;
DEVICE *io;
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
DEVICE *bios;
#endif
#ifdef SINGLE_MODE_DMA
tmp2 = FETCH;
tmp2 += FETCH << 8;
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
if(cpustate->bios != NULL && cpustate->bios->bios_call_i86(((tmp2 << 4) + tmp) & AMASK, cpustate->regs.w, cpustate->sregs, &cpustate->ZeroVal, &cpustate->CarryVal)) {
ICOUNT -= timing.call_far;
return;
{
unsigned int_num = FETCH;
ICOUNT -= timing.int_imm;
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
if(cpustate->bios != NULL && cpustate->bios->bios_int_i86(int_num, cpustate->regs.w, cpustate->sregs, &cpustate->ZeroVal, &cpustate->CarryVal)) {
return;
}
WORD ip, tmp;
FETCHWORD(tmp);
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
if(cpustate->bios != NULL && cpustate->bios->bios_call_i86((cpustate->pc + tmp) & AMASK, cpustate->regs.w, cpustate->sregs, &cpustate->ZeroVal, &cpustate->CarryVal)) {
ICOUNT -= timing.call_near;
return;
case 0x10: /* CALL ew */
ICOUNT -= (ModRM >= 0xc0) ? timing.call_r16 : timing.call_m16;
tmp = GetRMWord(ModRM);
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
if(cpustate->bios != NULL && cpustate->bios->bios_call_i86((cpustate->base[CS] + (WORD)tmp) & AMASK, cpustate->regs.w, cpustate->sregs, &cpustate->ZeroVal, &cpustate->CarryVal)) {
ICOUNT -= timing.call_far;
return;
tmp = cpustate->sregs[CS]; /* HJB 12/13/98 need to skip displacements of cpustate->ea */
tmp1 = GetRMWord(ModRM);
tmp2 = GetnextRMWord;
-#ifdef I86_BIOS_CALL
+#ifdef I86_PSEUDO_BIOS
if(cpustate->bios != NULL && cpustate->bios->bios_call_i86(((tmp2 << 4) + tmp1) & AMASK, cpustate->regs.w, cpustate->sregs, &cpustate->ZeroVal, &cpustate->CarryVal)) {
return;
}
OP( 0x99, i_cwd ) { Wreg(DW) = (Breg(AH) & 0x80) ? 0xffff : 0; CLK(4); }
OP( 0x9a, i_call_far ) {
UINT32 tmp, tmp2; tmp = FETCHWORD(); tmp2 = FETCHWORD();
-#ifdef V30_BIOS_CALL
+#ifdef V30_PSEUDO_BIOS
int32 ZeroVal = nec_state->ZeroVal, CarryVal = nec_state->CarryVal;
if(nec_state->bios != NULL && nec_state->bios->bios_call_i86(((tmp2 << 4) + tmp) & 0xfffff, nec_state->regs.w, nec_state->sregs, &ZeroVal, &CarryVal)) {
nec_state->ZeroVal = ZeroVal;
OP( 0xcc, i_int3 ) { nec_interrupt(nec_state, 3, BRK); CLKS(50,50,24); }
OP( 0xcd, i_int ) {
unsigned int_num = FETCH();
-#ifdef V30_BIOS_CALL
+#ifdef V30_PSEUDO_BIOS
int32 ZeroVal = nec_state->ZeroVal, CarryVal = nec_state->CarryVal;
if(nec_state->bios != NULL && nec_state->bios->bios_int_i86(int_num, nec_state->regs.w, nec_state->sregs, &ZeroVal, &CarryVal)) {
nec_state->ZeroVal = ZeroVal;
OP( 0xe8, i_call_d16 ) {
UINT32 tmp; tmp = FETCHWORD();
-#ifdef V30_BIOS_CALL
+#ifdef V30_PSEUDO_BIOS
int32 ZeroVal = nec_state->ZeroVal, CarryVal = nec_state->CarryVal;
if(nec_state->bios != NULL && nec_state->bios->bios_call_i86((PC(nec_state) + (INT16)tmp) & 0xfffff, nec_state->regs.w, nec_state->sregs, &ZeroVal, &CarryVal)) {
nec_state->ZeroVal = ZeroVal;
case 0x00: tmp1 = tmp+1; nec_state->OverVal = (tmp==0x7fff); SetAF(tmp1,tmp,1); SetSZPF_Word(tmp1); PutbackRMWord(ModRM,(WORD)tmp1); CLKM(2,2,2,24,16,7); break; /* INC */
case 0x08: tmp1 = tmp-1; nec_state->OverVal = (tmp==0x8000); SetAF(tmp1,tmp,1); SetSZPF_Word(tmp1); PutbackRMWord(ModRM,(WORD)tmp1); CLKM(2,2,2,24,16,7); break; /* DEC */
case 0x10:
-#ifdef V30_BIOS_CALL
+#ifdef V30_PSEUDO_BIOS
{
int32 ZeroVal = nec_state->ZeroVal, CarryVal = nec_state->CarryVal;
if(nec_state->bios != NULL && nec_state->bios->bios_call_i86(((Sreg(PS) << 4) + tmp) & 0xfffff, nec_state->regs.w, nec_state->sregs, &ZeroVal, &CarryVal)) {
PUSH(nec_state->ip); nec_state->ip = (WORD)tmp; CHANGE_PC; nec_state->icount-=(ModRM >=0xc0 )?16:20; break; /* CALL */
case 0x18:
tmp2 = GetnextRMWord;
-#ifdef V30_BIOS_CALL
+#ifdef V30_PSEUDO_BIOS
{
int32 ZeroVal = nec_state->ZeroVal, CarryVal = nec_state->CarryVal;
if(nec_state->bios != NULL && nec_state->bios->bios_call_i86(((tmp2 << 4) + tmp) & 0xfffff, nec_state->regs.w, nec_state->sregs, &ZeroVal, &CarryVal)) {
DEVICE *pic;
DEVICE *program;
DEVICE *io;
-#ifdef V30_BIOS_CALL
+#ifdef V30_PSEUDO_BIOS
DEVICE *bios;
#endif
#ifdef SINGLE_MODE_DMA
void MB8877::initialize()
{
- // config
- ignore_crc = config.ignore_crc;
-
// initialize d88 handler
for(int i = 0; i < MAX_DRIVE; i++) {
disk[i] = new DISK(emu);
no_command = 0;
}
-void MB8877::update_config()
-{
- ignore_crc = config.ignore_crc;
-}
-
void MB8877::write_io8(uint32 addr, uint32 data)
{
switch(addr & 3) {
if(fdc[drvreg].index >= 6) {
status &= ~FDC_ST_BUSY;
cmdtype = 0;
+ if(!disk[drvreg]->write_protected) {
+ disk[drvreg]->sync_buffer();
+ }
set_irq(true);
} else {
REGISTER_DRQ_EVENT();
uint8 MB8877::search_track()
{
int trk = fdc[drvreg].track;
+ int trkside = trk * 2 + (sidereg & 1);
+ if(!(disk[drvreg]->inserted && disk[drvreg]->check_media_type())) {
+ return FDC_ST_SEEKERR;
+ }
+ if(!(0 <= trkside && trkside < 164)) {
+ return FDC_ST_SEEKERR;
+ }
+#if 0
if(!disk[drvreg]->get_track(trk, sidereg)) {
if(!disk[drvreg]->make_track(trk, sidereg)) {
//return FDC_ST_SEEKERR;
//return 0;
}
}
-
+#endif
// verify track number
+ disk[drvreg]->get_track(trk, sidereg);
if(!(cmdreg & 4)) {
return 0;
}
fdc[drvreg].next_trans_position = disk[drvreg]->data_position[i];
fdc[drvreg].next_sync_position = disk[drvreg]->sync_position[i];
fdc[drvreg].index = 0;
- return (disk[drvreg]->deleted ? FDC_ST_RECTYPE : 0) | ((disk[drvreg]->crc_error && !ignore_crc) ? FDC_ST_CRCERR : 0);
+ return (disk[drvreg]->deleted ? FDC_ST_RECTYPE : 0) | ((disk[drvreg]->crc_error && !config.ignore_crc) ? FDC_ST_CRCERR : 0);
}
// sector not found
fdc[drvreg].next_sync_position = disk[drvreg]->sync_position[first_sector];
fdc[drvreg].index = 0;
secreg = disk[drvreg]->id[0];
- return (disk[drvreg]->crc_error && !ignore_crc) ? FDC_ST_CRCERR : 0;
+ return (disk[drvreg]->crc_error && !config.ignore_crc) ? FDC_ST_CRCERR : 0;
}
// sector not found
#endif
}
-#define STATE_VERSION 2
+#define STATE_VERSION 3
void MB8877::save_state(FILEIO* state_fio)
{
state_fio->FputUint32(STATE_VERSION);
state_fio->FputInt32(this_device_id);
- state_fio->FputBool(ignore_crc);
state_fio->Fwrite(fdc, sizeof(fdc), 1);
for(int i = 0; i < MAX_DRIVE; i++) {
disk[i]->save_state(state_fio);
if(state_fio->FgetInt32() != this_device_id) {
return false;
}
- ignore_crc = state_fio->FgetBool();
state_fio->Fread(fdc, sizeof(fdc), 1);
for(int i = 0; i < MAX_DRIVE; i++) {
if(!disk[i]->load_state(state_fio)) {
class MB8877 : public DEVICE
{
private:
- // config
- bool ignore_crc;
-
// output signals
outputs_t outputs_irq;
outputs_t outputs_drq;
void write_signal(int id, uint32 data, uint32 mask);
uint32 read_signal(int ch);
void event_callback(int event_id, int err);
- void update_config();
void save_state(FILEIO* state_fio);
bool load_state(FILEIO* state_fio);
Date : 2011.05.06-
[ MC6809 ]
- Notes from K.Ohta <whatisthis.sowhat _at_ gmail.com> at Jan 16, 2015:
+ Notes from K.Ohta <whatisthis.sowhat _at_ gmail.com> at Jan 16, 2015:
All of undocumented instructions (i.e. ngc, flag16) of MC6809(not HD6309) are written by me.
These behaviors of undocumented insns are refered from "vm/cpu_x86.asm" (ia32 assembly codefor nasm) within XM7
written by Ryu Takegami , and older article wrote in magazine, "I/O" at 1985.
/****************************************************************************/
+
#define RM(Addr) d_mem->read_data8(Addr)
#define WM(Addr,Value) d_mem->write_data8(Addr, Value)
#define OP_HANDLER(_name) inline void MC6809::_name (void)
-
/* macros for branch instructions */
#define BRANCH(f) { \
uint8 t; \
state_fio->FputUint32(y.d);
state_fio->FputUint8(cc);
state_fio->FputUint32(ea.d);
-
}
bool MC6809::load_state(FILEIO* state_fio)
icount = state_fio->FgetInt32();
extra_icount = state_fio->FgetInt32();
int_state = state_fio->FgetUint32();
-
pc.d = state_fio->FgetUint32();
ppc.d = state_fio->FgetUint32();
acc.d = state_fio->FgetUint32();
[ MC6809 ]
*/
-#ifndef _MC6809_H_
+#ifndef _MC6809_H_
#define _MC6809_H_
#include "vm.h"
--- /dev/null
+cmake_minimum_required (VERSION 2.6)
+
+message("* vm/msx1")
+
+if(BUILD_PX7)
+ add_library(vm_msx
+ joystick.cpp
+ keyboard.cpp
+ memory.cpp
+ msx.cpp
+ )
+elseif(BUILD_MSX2)
+ add_library(vm_msx
+ joystick.cpp
+ keyboard.cpp
+ memory.cpp
+ rtcif.cpp
+ msx.cpp
+ )
+else()
+ add_library(vm_msx
+ joystick.cpp
+ keyboard.cpp
+ memory.cpp
+ msx.cpp
+ )
+endif()
+
/*
ASCII MSX1 Emulator 'yaMSX1'
+ ASCII MSX2 Emulator 'yaMSX2'
Pioneer PX-7 Emulator 'ePX-7'
Author : tanam
Date : 2013.06.29-
- modified by Takeda.Toshiya, umaiboux
+ modified by Takeda.Toshiya
+ modified by umaiboux
[ joystick ]
*/
void JOYSTICK::write_signal(int id, uint32 data, uint32 mask)
{
if(id == SIG_JOYSTICK_SEL) {
- if (select != ((data & mask) != 0)) {
+ if(select != ((data & mask) != 0)) {
select = ((data & mask) != 0);
d_psg->write_signal(SIG_YM2203_PORT_A, ~(joy_stat[select] & 0x3f), 0x7f);
}
}
}
+
+#define STATE_VERSION 1
+
+void JOYSTICK::save_state(FILEIO* state_fio)
+{
+ state_fio->FputUint32(STATE_VERSION);
+ state_fio->FputInt32(this_device_id);
+
+ state_fio->FputInt32(select);
+}
+
+bool JOYSTICK::load_state(FILEIO* state_fio)
+{
+ if(state_fio->FgetUint32() != STATE_VERSION) {
+ return false;
+ }
+ if(state_fio->FgetInt32() != this_device_id) {
+ return false;
+ }
+ select = state_fio->FgetInt32();
+ return true;
+}
+
/*
ASCII MSX1 Emulator 'yaMSX1'
+ ASCII MSX2 Emulator 'yaMSX2'
Pioneer PX-7 Emulator 'ePX-7'
Author : tanam
void initialize();
void event_frame();
void write_signal(int id, uint32 data, uint32 mask);
+ void save_state(FILEIO* state_fio);
+ bool load_state(FILEIO* state_fio);
// unique function
void set_context_psg(DEVICE* device)
d_psg = device;
}
};
+
#endif
+
/*
ASCII MSX1 Emulator 'yaMSX1'
+ ASCII MSX2 Emulator 'yaMSX2'
Pioneer PX-7 Emulator 'ePX-7'
Author : tanam
{
key_stat = emu->key_buffer();
column = 0;
- break_pressed = false;
+// break_pressed = false;
// register event to update the key status
register_frame_event(this);
void KEYBOARD::event_frame()
{
- bool new_pressed = (key_stat[0x13] != 0);
- if(new_pressed && !break_pressed) {
- d_cpu->write_signal(SIG_CPU_NMI, 1, 1);
- }
- break_pressed = new_pressed;
+// bool new_pressed = (key_stat[0x13] != 0);
+// if(new_pressed && !break_pressed) {
+// d_cpu->write_signal(SIG_CPU_NMI, 1, 1);
+// }
+// break_pressed = new_pressed;
update_keyboard();
}
}
d_pio->write_signal(SIG_I8255_PORT_B, ~val, 0xff);
}
+
+#define STATE_VERSION 2
+
+void KEYBOARD::save_state(FILEIO* state_fio)
+{
+ state_fio->FputUint32(STATE_VERSION);
+ state_fio->FputInt32(this_device_id);
+
+ state_fio->FputUint8(column);
+// state_fio->FputBool(break_pressed);
+}
+
+bool KEYBOARD::load_state(FILEIO* state_fio)
+{
+ if(state_fio->FgetUint32() != STATE_VERSION) {
+ return false;
+ }
+ if(state_fio->FgetInt32() != this_device_id) {
+ return false;
+ }
+ column = state_fio->FgetUint8();
+// break_pressed = state_fio->FgetBool();
+ return true;
+}
+
/*
ASCII MSX1 Emulator 'yaMSX1'
+ ASCII MSX2 Emulator 'yaMSX2'
Pioneer PX-7 Emulator 'ePX-7'
Author : tanam
class KEYBOARD : public DEVICE
{
private:
- DEVICE *d_cpu, *d_pio;
+// DEVICE *d_cpu, *d_pio;
+ DEVICE *d_pio;
uint8* key_stat;
uint8 column;
- bool break_pressed;
+// bool break_pressed;
void update_keyboard();
void initialize();
void event_frame();
void write_signal(int id, uint32 data, uint32 mask);
+ void save_state(FILEIO* state_fio);
+ bool load_state(FILEIO* state_fio);
// unique functions
- void set_context_cpu(DEVICE* device)
- {
- d_cpu = device;
- }
+// void set_context_cpu(DEVICE* device)
+// {
+// d_cpu = device;
+// }
void set_context_pio(DEVICE* device)
{
d_pio = device;
--- /dev/null
+/*
+ ASCII MSX1 Emulator 'yaMSX1'
+ ASCII MSX2 Emulator 'yaMSX2'
+ Pioneer PX-7 Emulator 'ePX-7'
+
+ Author : Takeda.Toshiya
+ Date : 2014.01.09-
+
+ modified by tanam
+ modified by umaiboux
+
+ [ memory ]
+*/
+
+#include "memory.h"
+#if defined(_PX7)
+#include "../ld700.h"
+#include "../tms9918a.h"
+#else
+#include "../disk.h"
+#endif
+
+#define EVENT_CLOCK 0
+
+#define SET_BANK(s, e, w, r) { \
+ int sb = (s) >> 13, eb = (e) >> 13; \
+ for(int i = sb; i <= eb; i++) { \
+ if((w) == wdmy) { \
+ wbank[i] = wdmy; \
+ } else { \
+ wbank[i] = (w) + 0x2000 * (i - sb); \
+ } \
+ if((r) == rdmy) { \
+ rbank[i] = rdmy; \
+ } else { \
+ rbank[i] = (r) + 0x2000 * (i - sb); \
+ } \
+ } \
+}
+
+#if !defined(_PX7)
+static const struct {
+ int sectors;
+ uint8 heads, names, per_track, per_fat, per_cluster;
+} info[8] = {
+ { 720, 1, 112, 9, 2, 2 },
+ { 1440, 2, 112, 9, 3, 2 },
+ { 640, 1, 112, 8, 1, 2 },
+ { 1280, 2, 112, 8, 2, 2 },
+ { 360, 1, 64, 9, 2, 1 },
+ { 720, 2, 112, 9, 2, 2 },
+ { 320, 1, 64, 8, 1, 1 },
+ { 640, 2, 112, 8, 1, 2 }
+};
+
+static const uint8 boot_block[] = {
+ 0xeb, 0xfe, 0x90, 0x56, 0x46, 0x42, 0x2d, 0x31, 0x39, 0x38, 0x39, 0x00, 0x02, 0x02, 0x01, 0x00,
+ 0x02, 0x70, 0x00, 0xa0, 0x05, 0xf9, 0x03, 0x00, 0x09, 0x00, 0x02, 0x00, 0x00, 0x00, 0xd0, 0xed,
+ 0x53, 0x58, 0xc0, 0x32, 0xc2, 0xc0, 0x36, 0x55, 0x23, 0x36, 0xc0, 0x31, 0x1f, 0xf5, 0x11, 0x9d,
+ 0xc0, 0x0e, 0x0f, 0xcd, 0x7d, 0xf3, 0x3c, 0x28, 0x28, 0x11, 0x00, 0x01, 0x0e, 0x1a, 0xcd, 0x7d,
+ 0xf3, 0x21, 0x01, 0x00, 0x22, 0xab, 0xc0, 0x21, 0x00, 0x3f, 0x11, 0x9d, 0xc0, 0x0e, 0x27, 0xcd,
+ 0x7d, 0xf3, 0xc3, 0x00, 0x01, 0x57, 0xc0, 0xcd, 0x00, 0x00, 0x79, 0xe6, 0xfe, 0xfe, 0x02, 0x20,
+ 0x07, 0x3a, 0xc2, 0xc0, 0xa7, 0xca, 0x22, 0x40, 0x11, 0x77, 0xc0, 0x0e, 0x09, 0xcd, 0x7d, 0xf3,
+ 0x0e, 0x07, 0xcd, 0x7d, 0xf3, 0x18, 0xb4, 0x42, 0x6f, 0x6f, 0x74, 0x20, 0x65, 0x72, 0x72, 0x6f,
+ 0x72, 0x0d, 0x0a, 0x50, 0x72, 0x65, 0x73, 0x73, 0x20, 0x61, 0x6e, 0x79, 0x20, 0x6b, 0x65, 0x79,
+ 0x20, 0x66, 0x6f, 0x72, 0x20, 0x72, 0x65, 0x74, 0x72, 0x79, 0x0d, 0x0a, 0x24, 0x00, 0x4d, 0x53,
+ 0x58, 0x44, 0x4f, 0x53, 0x20, 0x20, 0x53, 0x59, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf3, 0x2a,
+ 0x51, 0xf3, 0x11, 0x00, 0x01, 0x19, 0x01, 0x00, 0x01, 0x11, 0x00, 0xc1, 0xed, 0xb0, 0x3a, 0xee,
+ 0xc0, 0x47, 0x11, 0xef, 0xc0, 0x21, 0x00, 0x00, 0xcd, 0x51, 0x52, 0xf3, 0x76, 0xc9, 0x18, 0x64,
+ 0x3a, 0xaf, 0x80, 0xf9, 0xca, 0x6d, 0x48, 0xd3, 0xa5, 0x0c, 0x8c, 0x2f, 0x9c, 0xcb, 0xe9, 0x89,
+ 0xd2, 0x00, 0x32, 0x26, 0x40, 0x94, 0x61, 0x19, 0x20, 0xe6, 0x80, 0x6d, 0x8a, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static int DSKIO = -1, DSKCHG = -1, GETDPB = -1, DSKFMT = -1;
+#endif
+
+static bool load_cart(_TCHAR *file_path, uint8 *rom)
+{
+ bool result = false;
+ FILEIO* fio = new FILEIO();
+ if(fio->Fopen(file_path, FILEIO_READ_BINARY)) {
+ memset(rom, 0xff, 0x10000);
+
+ fio->Fseek(0, FILEIO_SEEK_END);
+ int file_size = fio->Ftell();
+ fio->Fseek(0, FILEIO_SEEK_SET);
+
+ if(file_size <= 0x2000) {
+ // 8KB: 00000000
+ fio->Fread(rom, 0x2000, 1);
+ memcpy(rom + 0x2000, rom, 0x2000);
+ memcpy(rom + 0x4000, rom, 0x4000);
+ memcpy(rom + 0x8000, rom, 0x8000);
+ } else if(file_size <= 0x4000) {
+ // 16KB: 01010101
+ fio->Fread(rom, 0x4000, 1);
+ memcpy(rom + 0x4000, rom, 0x4000);
+ memcpy(rom + 0x8000, rom, 0x8000);
+ } else if(file_size <= 0x8000) {
+ // 32KB: 01012323
+ fio->Fread(rom + 0x4000, 0x8000, 1);
+ memcpy(rom + 0x0000, rom + 0x4000, 0x4000);
+ memcpy(rom + 0xc000, rom + 0x8000, 0x4000);
+ } else {
+ // 64KB: 01234567
+ fio->Fread(rom, 0x10000, 1);
+ }
+ fio->Fclose();
+ result = true;
+ }
+ delete fio;
+ return result;
+}
+
+// slot #0
+
+void SLOT0::initialize()
+{
+ memset(rom, 0xff, sizeof(rom));
+#if defined(_PX7)
+ memset(ram, 0, sizeof(ram));
+#endif
+ FILEIO* fio = new FILEIO();
+#if defined(_MSX2)
+ if(fio->Fopen(emu->bios_path(_T("MSX2J.ROM")), FILEIO_READ_BINARY) ||
+ fio->Fopen(emu->bios_path(_T("MSX2.ROM" )), FILEIO_READ_BINARY) ||
+#else
+ if(fio->Fopen(emu->bios_path(_T("MSXJ.ROM")), FILEIO_READ_BINARY) ||
+ fio->Fopen(emu->bios_path(_T("MSX.ROM" )), FILEIO_READ_BINARY) ||
+#endif
+ fio->Fopen(emu->bios_path(_T("BASIC.ROM")), FILEIO_READ_BINARY)) {
+ fio->Fread(rom, sizeof(rom), 1);
+ fio->Fclose();
+ }
+ delete fio;
+
+ SET_BANK(0x0000, 0x7fff, wdmy, rom);
+#if defined(_PX7)
+ SET_BANK(0x8000, 0xffff, ram, ram);
+#else
+ SET_BANK(0x8000, 0xffff, wdmy, rdmy);
+#endif
+}
+
+void SLOT0::write_data8(uint32 addr, uint32 data)
+{
+ wbank[addr >> 13][addr & 0x1fff] = data;
+}
+
+uint32 SLOT0::read_data8(uint32 addr)
+{
+ return rbank[addr >> 13][addr & 0x1fff];
+}
+
+#define SLOT0_STATE_VERSION 1
+
+void SLOT0::save_state(FILEIO* state_fio)
+{
+ state_fio->FputUint32(SLOT0_STATE_VERSION);
+ state_fio->FputInt32(this_device_id);
+
+#if defined(_PX7)
+ state_fio->Fwrite(ram, sizeof(ram), 1);
+#endif
+}
+
+bool SLOT0::load_state(FILEIO* state_fio)
+{
+ if(state_fio->FgetUint32() != SLOT0_STATE_VERSION) {
+ return false;
+ }
+ if(state_fio->FgetInt32() != this_device_id) {
+ return false;
+ }
+#if defined(_PX7)
+ state_fio->Fread(ram, sizeof(ram), 1);
+#endif
+ return true;
+}
+
+// slot #1
+
+void SLOT1::initialize()
+{
+ memset(rdmy, 0xff, sizeof(rdmy));
+ close_cart();
+}
+
+void SLOT1::write_data8(uint32 addr, uint32 data)
+{
+#if defined(_MSX2)
+ if(addr >= 0x4000 && addr < 0xc000 && mapper[0] < 4) {
+ addr >>= 15;
+ addr &= 1;
+ data &= 3;
+ if(mapper[addr] != data) {
+ mapper[addr] = data;
+ SET_BANK(addr * 0x4000 + 0x4000, addr * 0x4000 + 0x7fff, wdmy, rom + data * 0x4000);
+ }
+ return;
+ }
+#endif
+ wbank[addr >> 13][addr & 0x1fff] = data;
+}
+
+uint32 SLOT1::read_data8(uint32 addr)
+{
+ return rbank[addr >> 13][addr & 0x1fff];
+}
+
+void SLOT1::open_cart(_TCHAR *file_path)
+{
+ if(load_cart(file_path, rom)) {
+ SET_BANK(0x0000, 0xffff, wdmy, rom);
+ inserted = true;
+#if defined(_MSX2)
+ mapper[0] = mapper[1] = 4;
+#endif
+ }
+}
+
+void SLOT1::close_cart()
+{
+ SET_BANK(0x0000, 0xffff, wdmy, rdmy);
+ inserted = false;
+#if defined(_MSX2)
+ mapper[0] = mapper[1] = 4;
+ FILEIO* fio = new FILEIO();
+ if(fio->Fopen(emu->bios_path(_T("MSXDOS2.ROM")), FILEIO_READ_BINARY)) {
+ fio->Fread(rom, sizeof(rom), 1);
+ fio->Fclose();
+ mapper[0] = 0;
+ mapper[1] = 3;
+ SET_BANK(0x4000, 0x7fff, wdmy, rom + mapper[0] * 0x4000);
+ SET_BANK(0x8000, 0xbfff, wdmy, rom + mapper[1] * 0x4000);
+ }
+ delete fio;
+#endif
+}
+
+#define SLOT1_STATE_VERSION 1
+
+void SLOT1::save_state(FILEIO* state_fio)
+{
+ state_fio->FputUint32(SLOT1_STATE_VERSION);
+ state_fio->FputInt32(this_device_id);
+
+ state_fio->FputBool(inserted);
+#if defined(_MSX2)
+ state_fio->Fwrite(mapper, sizeof(mapper), 1);
+#endif
+}
+
+bool SLOT1::load_state(FILEIO* state_fio)
+{
+ if(state_fio->FgetUint32() != SLOT1_STATE_VERSION) {
+ return false;
+ }
+ if(state_fio->FgetInt32() != this_device_id) {
+ return false;
+ }
+ inserted = state_fio->FgetBool();
+#if defined(_MSX2)
+ state_fio->Fread(mapper, sizeof(mapper), 1);
+#endif
+
+ // post process
+ if(inserted) {
+ SET_BANK(0x0000, 0xffff, wdmy, rom);
+#if defined(_MSX2)
+ } else if(mapper[0] < 4) {
+ SET_BANK(0x0000, 0x3fff, wdmy, rdmy);
+ SET_BANK(0x4000, 0x7fff, wdmy, rom + mapper[0] * 0x4000);
+ SET_BANK(0x8000, 0xbfff, wdmy, rom + mapper[1] * 0x4000);
+ SET_BANK(0xc000, 0xffff, wdmy, rdmy);
+#endif
+ } else {
+ SET_BANK(0x0000, 0xffff, wdmy, rdmy);
+ }
+ return true;
+}
+
+// slot #2
+
+#if defined(_PX7)
+void SLOT2::initialize()
+{
+ memset(rom, 0xff, sizeof(rom));
+ memset(rdmy, 0xff, sizeof(rdmy));
+
+ FILEIO* fio = new FILEIO();
+ if(fio->Fopen(emu->bios_path(_T("PX7EXT.ROM")), FILEIO_READ_BINARY) ||
+ fio->Fopen(emu->bios_path(_T("EXT.ROM") ), FILEIO_READ_BINARY)) {
+ fio->Fread(rom, sizeof(rom), 1);
+ fio->Fclose();
+ }
+ delete fio;
+
+ SET_BANK(0x0000, 0x3fff, wdmy, rdmy);
+ SET_BANK(0x4000, 0x5fff, wdmy, rom);
+ SET_BANK(0x6000, 0xffff, wdmy, rdmy);
+
+ clock = exv = ack = false;
+
+ register_event(this, EVENT_CLOCK, 1000000.0 / 7812.5, true, NULL);
+}
+
+void SLOT2::reset()
+{
+ super_impose = false;
+ req_intr = false;
+ pc4 = false;
+ mute_l = mute_r = true;
+
+ d_ldp->write_signal(SIG_LD700_MUTE_L, 1, 1);
+ d_ldp->write_signal(SIG_LD700_MUTE_R, 1, 1);
+ d_vdp->write_signal(SIG_TMS9918A_SUPER_IMPOSE, 0, 0);
+}
+
+void SLOT2::write_data8(uint32 addr, uint32 data)
+{
+ if(addr == 0x7ffe) {
+ d_ldp->write_signal(SIG_LD700_REMOTE, data, 1);
+ } else if(addr == 0x7fff) {
+ // super impose
+ bool prev_super_impose = super_impose;
+ super_impose = ((data & 1) == 0);
+ if(super_impose) {
+ if(req_intr && !prev_super_impose) {
+ d_cpu->write_signal(SIG_CPU_IRQ, 1, 1);
+ }
+ } else {
+ d_cpu->write_signal(SIG_CPU_IRQ, 0, 0);
+ }
+ d_vdp->write_signal(SIG_TMS9918A_SUPER_IMPOSE, super_impose ? 1 : 0, 1);
+
+ // mute
+ bool prev_mute_l = mute_l;
+ mute_l = ((data & 0x80) == 0);
+ if(!prev_mute_l && mute_l) {
+ mute_r = !pc4;
+ }
+ d_ldp->write_signal(SIG_LD700_MUTE_L, mute_l ? 1 : 0, 1);
+ d_ldp->write_signal(SIG_LD700_MUTE_R, mute_r ? 1 : 0, 1);
+ } else {
+ wbank[addr >> 13][addr & 0x1fff] = data;
+ }
+}
+
+uint32 SLOT2::read_data8(uint32 addr)
+{
+ if(addr == 0x7ffe) {
+ return (clock ? 0 : 1) | (ack ? 0 : 0x80) | 0x7e;
+ } else if(addr == 0x7fff) {
+ uint32 data = (req_intr ? 1 : 0) | (exv ? 0 : 0x80) | 0x7e;
+ req_intr = false;
+ d_cpu->write_signal(SIG_CPU_IRQ, 0, 0);
+ return data;
+ } else {
+ return rbank[addr >> 13][addr & 0x1fff];
+ }
+}
+
+void SLOT2::write_signal(int id, uint32 data, uint32 mask)
+{
+ if(id == SIG_SLOT2_EXV) {
+ bool prev = exv;
+ exv = ((data & mask) != 0);
+ if(prev && !exv) {
+ req_intr = true;
+ if(super_impose) {
+ d_cpu->write_signal(SIG_CPU_IRQ, 1, 1);
+ }
+ }
+ } else if(id == SIG_SLOT2_ACK) {
+ ack = ((data & mask) != 0);
+ } else if(id == SIG_SLOT2_MUTE) {
+ pc4 = ((data & mask) != 0);
+ }
+}
+
+void SLOT2::event_callback(int event_id, int err)
+{
+ if(event_id == EVENT_CLOCK) {
+ clock = !clock;
+ }
+}
+
+#define SLOT2_STATE_VERSION 1
+
+void SLOT2::save_state(FILEIO* state_fio)
+{
+ state_fio->FputUint32(SLOT2_STATE_VERSION);
+ state_fio->FputInt32(this_device_id);
+
+ state_fio->FputBool(clock);
+ state_fio->FputBool(exv);
+ state_fio->FputBool(ack);
+ state_fio->FputBool(super_impose);
+ state_fio->FputBool(req_intr);
+ state_fio->FputBool(pc4);
+ state_fio->FputBool(mute_l);
+ state_fio->FputBool(mute_r);
+}
+
+bool SLOT2::load_state(FILEIO* state_fio)
+{
+ if(state_fio->FgetUint32() != SLOT2_STATE_VERSION) {
+ return false;
+ }
+ if(state_fio->FgetInt32() != this_device_id) {
+ return false;
+ }
+ clock = state_fio->FgetBool();
+ exv = state_fio->FgetBool();
+ ack = state_fio->FgetBool();
+ super_impose = state_fio->FgetBool();
+ req_intr = state_fio->FgetBool();
+ pc4 = state_fio->FgetBool();
+ mute_l = state_fio->FgetBool();
+ mute_r = state_fio->FgetBool();
+ return true;
+}
+#else
+void SLOT2::initialize()
+{
+ memset(rom, 0xff, sizeof(rom));
+ memset(rdmy, 0xff, sizeof(rdmy));
+
+ FILEIO* fio = new FILEIO();
+#if defined(_MSX2)
+ if(fio->Fopen(emu->bios_path(_T("MSX2JEXT.ROM")), FILEIO_READ_BINARY) ||
+ fio->Fopen(emu->bios_path(_T("MSX2EXT.ROM" )), FILEIO_READ_BINARY)) {
+ fio->Fread(rom, sizeof(rom), 1);
+ fio->Fclose();
+ }
+#endif
+ if(fio->Fopen(emu->bios_path(_T("DISK.ROM")), FILEIO_READ_BINARY)) {
+ fio->Fread(rom + 0x4000, sizeof(rom) - 0x4000, 1);
+ fio->Fclose();
+ }
+ delete fio;
+
+ // patch for pseudo disk bios
+ if(rom[0x4010] == 0xc3) {
+ rom[DSKIO = rom[0x4011] + (int)rom[0x4012] * 256] = 0xc9;
+ }
+ if(rom[0x4013] == 0xc3) {
+ rom[DSKCHG = rom[0x4014] + (int)rom[0x4015] * 256] = 0xc9;
+ }
+ if(rom[0x4016] == 0xc3) {
+ rom[GETDPB = rom[0x4017] + (int)rom[0x4018] * 256] = 0xc9;
+ }
+ if(rom[0x401c] == 0xc3) {
+ rom[DSKFMT = rom[0x401d] + (int)rom[0x401e] * 256] = 0xc9;
+ }
+ if(rom[0x401f] == 0xc3) {
+ rom[ rom[0x4020] + (int)rom[0x4021] * 256] = 0xc9;
+ }
+ SET_BANK(0x0000, 0x7fff, wdmy, rom);
+ SET_BANK(0x8000, 0xffff, wdmy, rdmy);
+}
+
+void SLOT2::write_data8(uint32 addr, uint32 data)
+{
+ wbank[addr >> 13][addr & 0x1fff] = data;
+}
+
+uint32 SLOT2::read_data8(uint32 addr)
+{
+ return rbank[addr >> 13][addr & 0x1fff];
+}
+#endif
+
+// slot #3
+
+void SLOT3::initialize()
+{
+ memset(ram, 0xff, sizeof(ram));
+ close_cart();
+}
+
+void SLOT3::write_data8(uint32 addr, uint32 data)
+{
+ wbank[addr >> 13][addr & 0x1fff] = data;
+}
+
+uint32 SLOT3::read_data8(uint32 addr)
+{
+ return rbank[addr >> 13][addr & 0x1fff];
+}
+
+void SLOT3::write_io8(uint32 addr, uint32 data)
+{
+ switch(addr & 0xff) {
+ case 0xfc:
+ case 0xfd:
+ case 0xfe:
+ case 0xff:
+ if(!inserted) {
+ addr &= 3;
+ data &= 7;
+ if(mapper[addr] != data) {
+ mapper[addr] = data;
+ SET_BANK(addr * 0x4000, addr * 0x4000 + 0x3fff, ram + data * 0x4000, ram + data * 0x4000);
+ }
+ }
+ break;
+ }
+}
+
+void SLOT3::open_cart(_TCHAR *file_path)
+{
+ if(load_cart(file_path, rom)) {
+ SET_BANK(0x0000, 0xffff, wdmy, rom);
+ inserted = true;
+ }
+}
+
+void SLOT3::close_cart()
+{
+ for(int i = 0; i < 4; i++) {
+ mapper[i] = i;
+ }
+ SET_BANK(0x0000, 0xffff, ram, ram);
+ inserted = false;
+}
+
+
+#define SLOT3_STATE_VERSION 1
+
+void SLOT3::save_state(FILEIO* state_fio)
+{
+ state_fio->FputUint32(SLOT3_STATE_VERSION);
+ state_fio->FputInt32(this_device_id);
+
+ state_fio->Fwrite(ram, sizeof(ram), 1);
+ state_fio->FputBool(inserted);
+ state_fio->Fwrite(mapper, sizeof(mapper), 1);
+}
+
+bool SLOT3::load_state(FILEIO* state_fio)
+{
+ if(state_fio->FgetUint32() != SLOT3_STATE_VERSION) {
+ return false;
+ }
+ if(state_fio->FgetInt32() != this_device_id) {
+ return false;
+ }
+ state_fio->Fread(ram, sizeof(ram), 1);
+ inserted = state_fio->FgetBool();
+ state_fio->Fread(mapper, sizeof(mapper), 1);
+
+ // post process
+ if(inserted) {
+ SET_BANK(0x0000, 0xffff, wdmy, rom);
+ } else {
+ SET_BANK(0x0000, 0x3fff, ram + mapper[0] * 0x4000, ram + mapper[0] * 0x4000);
+ SET_BANK(0x4000, 0x7fff, ram + mapper[1] * 0x4000, ram + mapper[1] * 0x4000);
+ SET_BANK(0x8000, 0xbfff, ram + mapper[2] * 0x4000, ram + mapper[2] * 0x4000);
+ SET_BANK(0xc000, 0xffff, ram + mapper[3] * 0x4000, ram + mapper[3] * 0x4000);
+ }
+ return true;
+}
+
+// memory bus
+
+#if !defined(_PX7)
+void MEMORY::initialize()
+{
+ for(int i = 0; i < MAX_DRIVE; i++) {
+ disk[i] = new DISK(emu);
+ }
+}
+
+void MEMORY::release()
+{
+ for(int i = 0; i < MAX_DRIVE; i++) {
+ if(disk[i]) {
+ disk[i]->close();
+ delete disk[i];
+ }
+ }
+}
+#endif
+
+void MEMORY::reset()
+{
+ update_map((0 << 0) | (1 << 2) | (2 << 4) | (3 << 6));
+}
+
+void MEMORY::write_data8(uint32 addr, uint32 data)
+{
+ addr &= 0xffff;
+ d_map[addr >> 14]->write_data8(addr, data);
+}
+
+uint32 MEMORY::read_data8(uint32 addr)
+{
+ addr &= 0xffff;
+ return d_map[addr >> 14]->read_data8(addr);
+}
+
+uint32 MEMORY::fetch_op(uint32 addr, int* wait)
+{
+ *wait = 1;
+ return read_data8(addr);
+}
+
+void MEMORY::write_io8(uint32 addr, uint32 data)
+{
+#if !defined(_PX7)
+// if(d_map[3] == d_slot[3]) {
+ d_slot[3]->write_io8(addr, data);
+// }
+#endif
+}
+
+void MEMORY::write_signal(int id, uint32 data, uint32 mask)
+{
+ if(id == SIG_MEMORY_SEL) {
+ if(slot_select != (data & mask)) {
+ update_map(data & mask);
+ }
+ }
+}
+
+void MEMORY::update_map(uint32 val)
+{
+ d_map[0] = d_slot[(val >> 0) & 3];
+ d_map[1] = d_slot[(val >> 2) & 3];
+ d_map[2] = d_slot[(val >> 4) & 3];
+ d_map[3] = d_slot[(val >> 6) & 3];
+ slot_select = val;
+}
+
+#if !defined(_PX7)
+static int get_track_number(int desc, int sector)
+{
+ int trkside = sector / info[desc].per_track;
+ return trkside >> (info[desc].heads - 1);
+}
+
+static int get_side_number(int desc, int sector)
+{
+ int trkside = sector / info[desc].per_track;
+ return trkside & (info[desc].heads - 1);
+}
+
+static bool get_track(DISK *disk, int desc, int sector)
+{
+ return disk->get_track(get_track_number(desc, sector), get_side_number(desc, sector));
+}
+
+static bool get_sector(DISK *disk, int desc, int sector)
+{
+ if(get_track(disk, desc, sector)) {
+ for(int i = 0; i < disk->sector_num.sd; i++) {
+ disk->get_sector(-1, -1, i);
+ if(disk->id[2] == (sector % info[desc].per_track) + 1) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+static bool get_boot_sector(DISK *disk)
+{
+ if(disk->get_track(0, 0)) {
+ for(int i = 0; i < disk->sector_num.sd; i++) {
+ disk->get_sector(0, 0, i);
+ if(disk->id[2] == 1) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool MEMORY::bios_ret_z80(uint16 PC, pair* af, pair* bc, pair* de, pair* hl, pair* ix, pair* iy, uint8* iff1)
+{
+ #define AF af->w.l
+ #define A af->b.h
+ #define F af->b.l
+ #define BC bc->w.l
+ #define B bc->b.h
+ #define C bc->b.l
+ #define DE de->w.l
+ #define D de->b.h
+ #define E de->b.l
+ #define HL hl->w.l
+ #define H hl->b.h
+ #define L hl->b.l
+
+ #define CF 0x01
+
+ if(d_map[1] == d_slot[2]) {
+ // pseudo disk bios from fMSX
+ if(PC == DSKIO) {
+ // read/write sectors
+ *iff1 |= 1;
+ int desc = C & 7;
+ int drv = A;
+ int addr = HL;
+ if(!(drv < MAX_DRIVE && disk[drv]->inserted)) {
+ AF = 0x0201; // not ready
+ return true;
+ }
+ if(F & CF) {
+ if(disk[drv]->write_protected) {
+ AF = 0x0001; // write protected
+ return true;
+ }
+ for(int sector = DE; B != 0; sector++) {
+ if(!get_sector(disk[drv], desc, sector)) {
+ AF = 0x0801; // record not found
+ return true;
+ }
+ if(disk[drv]->crc_error && !config.ignore_crc) {
+ AF = 0x0401; // data crc error
+ return true;
+ }
+ if(addr + 512/*disk[drv]->sector_size.sd*/ > 0xffff) {
+ F &= ~CF;
+ return true;
+ }
+ d_map[1] = d_slot[read_data8(0xf342) & 3];
+ for(int i = 0; i < 512/*disk[drv]->sector_size.sd*/; i++) {
+ disk[drv]->sector[i] = read_data8(addr++);
+ }
+ d_map[1] = d_slot[2];
+ B--;
+ }
+ } else {
+ for(int sector = DE; B != 0; sector++) {
+ if(!get_sector(disk[drv], desc, sector)) {
+ AF = 0x0801; // record not found
+ return true;
+ }
+ if(disk[drv]->crc_error && !config.ignore_crc) {
+ AF = 0x0401; // data crc error
+ return true;
+ }
+ if(addr + 512/*disk[drv]->sector_size.sd*/ > 0xffff) {
+ F &= ~CF;
+ return true;
+ }
+ d_map[1] = d_slot[read_data8(0xf342) & 3];
+ for(int i = 0; i < 512/*disk[drv]->sector_size.sd*/; i++) {
+ write_data8(addr++, disk[drv]->sector[i]);
+ }
+ d_map[1] = d_slot[2];
+ B--;
+ }
+ }
+ F &= ~CF;
+ return true;
+ } else if(PC == DSKCHG) {
+ // detect disk changed
+ *iff1 |= 1;
+ int drv = A;
+ if(!(drv < MAX_DRIVE && disk[drv]->inserted)) {
+ AF = 0x0201; // not ready
+ return true;
+ }
+ B = disk[drv]->changed ? 0xff : 0x01;
+ disk[drv]->changed = false;
+ F &= ~CF;
+ return true;
+ } else if(PC == GETDPB) {
+ // det drive parameter block
+ int drv = A;
+ if(!(drv < MAX_DRIVE && disk[drv]->inserted)) {
+ AF = 0x0201; // not ready
+ return true;
+ }
+ if(!get_boot_sector(disk[drv])) {
+ AF = 0x0c01; // other error
+ return true;
+ }
+ if(disk[drv]->crc_error && !config.ignore_crc) {
+ AF = 0x0401; // data crc error
+ return true;
+ }
+ int bytes_per_sector = (int)disk[drv]->sector[0x0c] * 256 + disk[drv]->sector[0x0b];
+ int sectors_per_disk = (int)disk[drv]->sector[0x14] * 256 + disk[drv]->sector[0x13];
+ int sectors_per_fat = (int)disk[drv]->sector[0x17] * 256 + disk[drv]->sector[0x16];
+ int reserved_sectors = (int)disk[drv]->sector[0x0f] * 256 + disk[drv]->sector[0x0e];
+ int addr = HL + 1, num, bits;
+ d_map[1] = d_slot[read_data8(0xf342) & 3];
+ write_data8(addr++, disk[drv]->sector[0x15]); // format id [f8h-ffh]
+ write_data8(addr++, disk[drv]->sector[0x0b]); // sector size
+ write_data8(addr++, disk[drv]->sector[0x0c]);
+ num = (bytes_per_sector >> 5) - 1;
+ for(bits = 0; num & (1 << bits); bits++);
+ write_data8(addr++, num); // directory mask/shft
+ write_data8(addr++, bits);
+ num = disk[drv]->sector[0x0d] - 1;
+ for(bits = 0; num & (1 << bits); bits++);
+ write_data8(addr++, num); // cluster mask/shift
+ write_data8(addr++, bits + 1);
+ write_data8(addr++, disk[drv]->sector[0x0e]); // sector # of 1st fat
+ write_data8(addr++, disk[drv]->sector[0x0f]);
+ write_data8(addr++, disk[drv]->sector[0x10]); // number of fats
+ write_data8(addr++, disk[drv]->sector[0x11]); // number of dirent-s
+ num = reserved_sectors + disk[drv]->sector[0x10] * sectors_per_fat;
+ num += 32 * disk[drv]->sector[0x11] / bytes_per_sector;
+ write_data8(addr++, num & 0xff); // sector # of data
+ write_data8(addr++, (num >> 8) & 0xff);
+ num = (sectors_per_disk - num) / disk[drv]->sector[0x0d];
+ write_data8(addr++, num & 0xff); // number of clusters
+ write_data8(addr++, (num >> 8) & 0xff);
+ write_data8(addr++, disk[drv]->sector[0x16]); // sectors per fat
+ num = reserved_sectors + disk[drv]->sector[0x10] * sectors_per_fat;
+ write_data8(addr++, num & 0xff); // sector # of dir.
+ write_data8(addr, (num >> 8) & 0xff);
+ d_map[1] = d_slot[2];
+ F &= ~CF;
+ return true;
+ } else if(PC == DSKFMT) {
+ // format disk
+ *iff1 |= 1;
+// int desc = 2 - A;
+ int desc = A - 1; // A: 1=single-side 2=double-side
+ int drv = D;
+ if(desc != 0 && desc != 1) {
+ AF = 0x0c01; // bad parameter
+ return true;
+ }
+ if(!(drv < MAX_DRIVE && disk[drv]->inserted)) {
+ AF = 0x0201; // not ready
+ return true;
+ }
+ if(disk[drv]->write_protected) {
+ AF = 0x0001; // write protected
+ return true;
+ }
+ // physical format
+ int max_trkside = info[desc].sectors / info[desc].per_track;
+ for(int trkside = 0; trkside < max_trkside; trkside++) {
+ int trk = trkside >> (info[desc].heads - 1);
+ int side = trkside & (info[desc].heads - 1);
+ disk[drv]->format_track(trk, side);
+ for(int sct = 0; sct < info[desc].per_track; sct++) {
+ disk[drv]->insert_sector(trk, side, sct + 1, 2, false, false, 0, 512);
+ }
+ }
+ // fill boot block with data:
+ int sector = 0;
+ get_sector(disk[drv], desc, sector++);
+ memcpy(disk[drv]->sector, boot_block, 512);
+ uint8 *ptr = disk[drv]->sector + 3;
+ memcpy(ptr, "fMSXdisk", 8); ptr += 10; // manufacturer's id
+ *ptr = info[desc].per_cluster; ptr += 4; // sectors per cluster
+ *ptr++ = info[desc].names; *ptr++ = 0x00; // number of names
+ *ptr++ = info[desc].sectors & 0xff; // number of sectors
+ *ptr++ = (info[desc].sectors >> 8) & 0xff;
+ *ptr++ = desc + 0xf8; // format id [f8h-ffh]
+ *ptr++ = info[desc].per_fat; *ptr++ = 0x00; // sectors per fat
+ *ptr++ = info[desc].per_track; *ptr++ = 0x00; // sectors per track
+ *ptr++ = info[desc].heads; *ptr = 0x00; // number of heads
+ // writing fats:
+ for(int j = 0; j < 2; j++) {
+ get_sector(disk[drv], desc, sector++);
+ memset(disk[drv]->sector, 0x00, 512);
+ disk[drv]->sector[0] = desc + 0xf8;
+ disk[drv]->sector[1] = disk[drv]->sector[2] = 0xff;
+ for(int i = info[desc].per_fat; i > 1; i--) {
+ get_sector(disk[drv], desc, sector++);
+ memset(disk[drv]->sector, 0x00, 512);
+ }
+ }
+ for(int i = info[desc].names / 16; i; i--) {
+ get_sector(disk[drv], desc, sector++);
+ memset(disk[drv]->sector, 0x00, 512);
+ }
+ for(int i = info[desc].sectors - 2 * info[desc].per_fat - info[desc].names / 16 - 1; i; i--) {
+ get_sector(disk[drv], desc, sector++);
+ memset(disk[drv]->sector, 0xff, 512);
+ }
+ F &= ~CF;
+ return true;
+ }
+ }
+ return false;
+}
+
+void MEMORY::open_disk(int drv, _TCHAR path[], int bank)
+{
+ if(drv < MAX_DRIVE) {
+ disk[drv]->open(path, bank);
+ }
+}
+
+void MEMORY::close_disk(int drv)
+{
+ if(drv < MAX_DRIVE && disk[drv]->inserted) {
+ disk[drv]->close();
+ }
+}
+
+bool MEMORY::disk_inserted(int drv)
+{
+ if(drv < MAX_DRIVE) {
+ return disk[drv]->inserted;
+ }
+ return false;
+}
+
+#endif
+
+#define STATE_VERSION 1
+
+void MEMORY::save_state(FILEIO* state_fio)
+{
+ state_fio->FputUint32(STATE_VERSION);
+ state_fio->FputInt32(this_device_id);
+
+#if !defined(_PX7)
+ for(int i = 0; i < MAX_DRIVE; i++) {
+ disk[i]->save_state(state_fio);
+ }
+#endif
+ state_fio->FputUint32(slot_select);
+}
+
+bool MEMORY::load_state(FILEIO* state_fio)
+{
+ if(state_fio->FgetUint32() != STATE_VERSION) {
+ return false;
+ }
+ if(state_fio->FgetInt32() != this_device_id) {
+ return false;
+ }
+#if !defined(_PX7)
+ for(int i = 0; i < MAX_DRIVE; i++) {
+ if(!disk[i]->load_state(state_fio)) {
+ return false;
+ }
+ }
+#endif
+ slot_select = state_fio->FgetUint32();
+
+ // post process
+ update_map(slot_select);
+ return true;
+}
+
--- /dev/null
+/*
+ ASCII MSX1 Emulator 'yaMSX1'
+ ASCII MSX2 Emulator 'yaMSX2'
+ Pioneer PX-7 Emulator 'ePX-7'
+
+ Author : Takeda.Toshiya
+ Date : 2014.01.09-
+
+ modified by tanam
+ modified by umaiboux
+
+ [ memory ]
+*/
+
+#ifndef _MEMORY_H_
+#define _MEMORY_H_
+
+#include "../vm.h"
+#include "../../emu.h"
+#include "../device.h"
+
+#define SIG_SLOT2_EXV 0
+#define SIG_SLOT2_ACK 1
+#define SIG_SLOT2_MUTE 2
+
+#define SIG_MEMORY_SEL 0
+
+#if !defined(_PX7)
+class DISK;
+#endif
+
+// slot #0
+
+class SLOT0 : public DEVICE
+{
+private:
+ uint8 wdmy[0x2000];
+ uint8 rdmy[0x2000];
+ uint8* wbank[8];
+ uint8* rbank[8];
+ uint8 rom[0x8000];
+#if defined(_PX7)
+ uint8 ram[0x8000];
+#endif
+public:
+ SLOT0(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
+ ~SLOT0() {}
+
+ // common functions
+ void initialize();
+ void write_data8(uint32 addr, uint32 data);
+ uint32 read_data8(uint32 addr);
+ void save_state(FILEIO* state_fio);
+ bool load_state(FILEIO* state_fio);
+};
+
+// slot #1
+
+class SLOT1 : public DEVICE
+{
+private:
+ uint8 wdmy[0x2000];
+ uint8 rdmy[0x2000];
+ uint8* wbank[8];
+ uint8* rbank[8];
+ uint8 rom[0x10000];
+ bool inserted;
+#if defined(_MSX2)
+ uint8 mapper[2];
+#endif
+
+public:
+ SLOT1(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
+ ~SLOT1() {}
+
+ // common functions
+ void initialize();
+ void write_data8(uint32 addr, uint32 data);
+ uint32 read_data8(uint32 addr);
+ void save_state(FILEIO* state_fio);
+ bool load_state(FILEIO* state_fio);
+
+ // unique functions
+ void open_cart(_TCHAR *file_path);
+ void close_cart();
+ bool cart_inserted()
+ {
+ return inserted;
+ }
+};
+
+// slot #2
+
+#if defined(_PX7)
+class SLOT2 : public DEVICE
+{
+private:
+ DEVICE *d_cpu, *d_ldp, *d_vdp;
+
+ uint8 wdmy[0x2000];
+ uint8 rdmy[0x2000];
+ uint8* wbank[8];
+ uint8* rbank[8];
+ uint8 rom[0x2000];
+
+ bool clock;
+ bool exv, ack;
+ bool super_impose;
+ bool req_intr;
+ bool pc4, mute_l, mute_r;
+
+public:
+ SLOT2(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
+ ~SLOT2() {}
+
+ // common functions
+ void initialize();
+ void reset();
+ void write_data8(uint32 addr, uint32 data);
+ uint32 read_data8(uint32 addr);
+ void write_signal(int id, uint32 data, uint32 mask);
+ void event_callback(int event_id, int err);
+ void save_state(FILEIO* state_fio);
+ bool load_state(FILEIO* state_fio);
+
+ // unique functions
+ void set_context_cpu(DEVICE* device)
+ {
+ d_cpu = device;
+ }
+ void set_context_ldp(DEVICE* device)
+ {
+ d_ldp = device;
+ }
+ void set_context_vdp(DEVICE* device)
+ {
+ d_vdp = device;
+ }
+};
+#else
+class SLOT2 : public DEVICE
+{
+private:
+ uint8 wdmy[0x2000];
+ uint8 rdmy[0x2000];
+ uint8* wbank[8];
+ uint8* rbank[8];
+ uint8 rom[0x8000];
+
+public:
+ SLOT2(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
+ ~SLOT2() {}
+
+ // common functions
+ void initialize();
+ void write_data8(uint32 addr, uint32 data);
+ uint32 read_data8(uint32 addr);
+};
+#endif
+
+// slot #3
+
+class SLOT3 : public DEVICE
+{
+private:
+ uint8 wdmy[0x2000];
+ uint8 rdmy[0x2000];
+ uint8* wbank[8];
+ uint8* rbank[8];
+ uint8 rom[0x10000];
+ uint8 ram[0x20000];
+ bool inserted;
+ uint8 mapper[4];
+
+public:
+ SLOT3(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
+ ~SLOT3() {}
+
+ // common functions
+ void initialize();
+ void write_data8(uint32 addr, uint32 data);
+ uint32 read_data8(uint32 addr);
+ void write_io8(uint32 addr, uint32 data);
+ void save_state(FILEIO* state_fio);
+ bool load_state(FILEIO* state_fio);
+
+ // unique functions
+ void open_cart(_TCHAR *file_path);
+ void close_cart();
+ bool cart_inserted()
+ {
+ return inserted;
+ }
+};
+
+// memory bus
+
+class MEMORY : public DEVICE
+{
+private:
+ DEVICE *d_slot[4];
+ DEVICE *d_map[4];
+#if !defined(_PX7)
+ DISK* disk[MAX_DRIVE];
+#endif
+ uint32 slot_select;
+ void update_map(uint32 val);
+
+public:
+ MEMORY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
+ ~MEMORY() {}
+
+ // common functions
+#if !defined(_PX7)
+ void initialize();
+ void release();
+#endif
+ void reset();
+ void write_data8(uint32 addr, uint32 data);
+ uint32 read_data8(uint32 addr);
+ uint32 fetch_op(uint32 addr, int* wait);
+ void write_io8(uint32 addr, uint32 data);
+ void write_signal(int id, uint32 data, uint32 mask);
+#if !defined(_PX7)
+ bool bios_ret_z80(uint16 PC, pair* af, pair* bc, pair* de, pair* hl, pair* ix, pair* iy, uint8* iff1);
+#endif
+ void save_state(FILEIO* state_fio);
+ bool load_state(FILEIO* state_fio);
+
+ // unique functions
+ void set_context_slot(int drv, DEVICE *device)
+ {
+ d_slot[drv] = device;
+ }
+#if !defined(_PX7)
+ void open_disk(int drv, _TCHAR path[], int bank);
+ void close_disk(int drv);
+ bool disk_inserted(int drv);
+#endif
+};
+
+#endif
+
/*
ASCII MSX1 Emulator 'yaMSX1'
+ ASCII MSX2 Emulator 'yaMSX2'
Pioneer PX-7 Emulator 'ePX-7'
Author : tanam
Date : 2013.06.29-
- modified by Takeda.Toshiya, umaiboux
+ modified by Takeda.Toshiya
+ modified by umaiboux
[ virtual machine ]
*/
-#include "msx1.h"
+#include "msx.h"
#include "../../emu.h"
#include "../device.h"
#include "../event.h"
#include "../datarec.h"
#include "../i8255.h"
#include "../io.h"
-#ifdef _PX7
+#if defined(_PX7)
#include "../ld700.h"
#endif
#include "../not.h"
#include "../ym2203.h"
#include "../pcm1bit.h"
+#if defined(_MSX2)
+#include "../rp5c01.h"
+#include "../v99x8.h"
+#else
#include "../tms9918a.h"
+#endif
#include "../z80.h"
#ifdef USE_DEBUGGER
#include "joystick.h"
#include "keyboard.h"
#include "memory.h"
+#if defined(_MSX2)
+#include "rtcif.h"
+#endif
// ----------------------------------------------------------------------------
// initialize
drec = new DATAREC(this, emu);
pio = new I8255(this, emu);
io = new IO(this, emu);
-#ifdef _PX7
+#if defined(_PX7)
ldp = new LD700(this, emu);
#endif
- g_not = new NOT(this, emu);
+ d_not = new NOT(this, emu);
psg = new YM2203(this, emu);
pcm = new PCM1BIT(this, emu);
+#if defined(_MSX2)
+ rtc = new RP5C01(this, emu);
+ vdp = new V99X8(this, emu);
+#else
vdp = new TMS9918A(this, emu);
+#endif
cpu = new Z80(this, emu);
joystick = new JOYSTICK(this, emu);
keyboard = new KEYBOARD(this, emu);
memory = new MEMORY(this, emu);
- slot0 = new SLOT_MAIN(this, emu);
- slot1 = new SLOT_CART(this, emu);
- slot2 = new SLOT_SUB(this, emu);
- slot3 = new SLOT_CART(this, emu);
+#if defined(_MSX2)
+ rtcif = new RTCIF(this, emu);
+#endif
+ slot0 = new SLOT0(this, emu); // #0: main memory
+ slot1 = new SLOT1(this, emu); // #1: rom-cartridge or msx-dos
+ slot2 = new SLOT2(this, emu); // #2: fdd-cartridge or p-basic
+ slot3 = new SLOT3(this, emu); // #3: rom-cartridge or ram-cartridge
// set contexts
event->set_context_cpu(cpu);
event->set_context_sound(psg);
event->set_context_sound(pcm);
-#ifdef _PX7
- event->set_context_sound(ldp);
-#endif
event->set_context_sound(drec);
-
+#if defined(_PX7)
+ event->set_context_sound(ldp);
+#endif
+
drec->set_context_out(psg, SIG_YM2203_PORT_A, 0x80);
pio->set_context_port_a(memory, SIG_MEMORY_SEL, 0xff, 0);
pio->set_context_port_c(keyboard, SIG_KEYBOARD_COLUMN, 0x0f, 0);
+ pio->set_context_port_c(d_not, SIG_NOT_INPUT, 0x10, 0);
+ d_not->set_context_out(drec, SIG_DATAREC_REMOTE, 1);
+ pio->set_context_port_c(drec, SIG_DATAREC_OUT, 0x20, 0);
+ pio->set_context_port_c(pcm, SIG_PCM1BIT_SIGNAL, 0x80, 0);
+ psg->set_context_port_b(joystick, SIG_JOYSTICK_SEL, 0x40, 0);
+ vdp->set_context_irq(cpu, SIG_CPU_IRQ, 1);
+#if defined(_PX7)
pio->set_context_port_c(slot2, SIG_SLOT2_MUTE, 0x10, 0);
- pio->set_context_port_c(g_not, SIG_NOT_INPUT, 0x10, 0);
- g_not->set_context_out(drec, SIG_DATAREC_REMOTE, 1);
-#ifdef _PX7
ldp->set_context_exv(slot2, SIG_SLOT2_EXV, 1);
ldp->set_context_ack(slot2, SIG_SLOT2_ACK, 1);
ldp->set_context_sound(psg, SIG_YM2203_PORT_A, 0x80);
#endif
- pio->set_context_port_c(drec, SIG_DATAREC_OUT, 0x20, 0);
- pio->set_context_port_c(pcm, SIG_PCM1BIT_SIGNAL, 0x80, 0);
- psg->set_context_port_b(joystick, SIG_JOYSTICK_SEL, 0x40, 0);
- vdp->set_context_irq(cpu, SIG_CPU_IRQ, 1);
joystick->set_context_psg(psg);
- keyboard->set_context_cpu(cpu);
+// keyboard->set_context_cpu(cpu);
keyboard->set_context_pio(pio);
memory->set_context_slot(0, slot0);
memory->set_context_slot(1, slot1);
memory->set_context_slot(2, slot2);
memory->set_context_slot(3, slot3);
+#if defined(_MSX2)
+ rtcif->set_context_rtc(rtc);
+#endif
+#if defined(_PX7)
slot2->set_context_cpu(cpu);
-#ifdef _PX7
slot2->set_context_ldp(ldp);
+ slot2->set_context_vdp(vdp);
#endif
- slot2->set_context_vdp(vdp);
// cpu bus
cpu->set_context_mem(memory);
cpu->set_context_io(io);
cpu->set_context_intr(dummy);
+#if !defined(_PX7)
+ cpu->set_context_bios(memory);
+#endif
#ifdef USE_DEBUGGER
cpu->set_context_debugger(new DEBUGGER(this, emu));
#endif
// i/o bus
+#ifdef _MSX2
+ io->set_iomap_range_rw(0xb4, 0xb5, rtcif);
+ io->set_iomap_range_rw(0x98, 0x9b, vdp);
+#else
io->set_iomap_range_rw(0x98, 0x99, vdp);
+#endif
io->set_iomap_range_rw(0xa8, 0xab, pio);
-
io->set_iomap_alias_w(0xa0, psg, 0); // PSG ch
io->set_iomap_alias_w(0xa1, psg, 1); // PSG data
io->set_iomap_alias_r(0xa2, psg, 1); // PSG data
+ io->set_iomap_range_rw(0xfc, 0xff, memory);
// initialize all devices
for(DEVICE* device = first_device; device; device = device->next_device) {
// init sound gen
psg->init(rate, 3579545, samples, 0, 0);
pcm->init(rate, 8000);
-#ifdef _PX7
+#if defined(_PX7)
ldp->initialize_sound(rate, samples);
#endif
}
return event->sound_buffer_ptr();
}
+#if defined(_PX7)
void VM::movie_sound_callback(uint8 *buffer, long size)
{
-#ifdef _PX7
ldp->movie_sound_callback(buffer, size);
-#endif
}
+#endif
// ----------------------------------------------------------------------------
// user interface
return drec->get_tape_ptr();
}
+#if defined(_PX7)
void VM::open_laser_disc(_TCHAR* file_path)
{
-#ifdef _PX7
ldp->open_disc(file_path);
-#endif
}
void VM::close_laser_disc()
{
-#ifdef _PX7
ldp->close_disc();
-#endif
}
bool VM::laser_disc_inserted()
{
-#ifdef _PX7
return ldp->disc_inserted();
-#endif
+}
+#else
+void VM::open_disk(int drv, _TCHAR* file_path, int bank)
+{
+ memory->open_disk(drv, file_path, bank);
}
+void VM::close_disk(int drv)
+{
+ memory->close_disk(drv);
+}
+
+bool VM::disk_inserted(int drv)
+{
+ return memory->disk_inserted(drv);
+}
+void VM::write_protect_fd(int drv, bool flag)
+{
+ //fdc->write_protect_fd(drv, flag);
+}
+ bool VM::is_write_protect_fd(int drv)
+{
+ //return fdc->is_write_protect_fd(drv);
+ return false;
+}
+int VM::access_lamp()
+{
+ //uint32 status = fdc->read_signal(0);
+ //return (status & (1 | 4)) ? 1 : (status & (2 | 8)) ? 2 : 0;
+ return 0;
+}
+#endif
+
bool VM::now_skip()
{
return event->now_skip();
}
}
+#define STATE_VERSION 1
+
+void VM::save_state(FILEIO* state_fio)
+{
+ state_fio->FputUint32(STATE_VERSION);
+
+ for(DEVICE* device = first_device; device; device = device->next_device) {
+ device->save_state(state_fio);
+ }
+}
+
+bool VM::load_state(FILEIO* state_fio)
+{
+ if(state_fio->FgetUint32() != STATE_VERSION) {
+ return false;
+ }
+ for(DEVICE* device = first_device; device; device = device->next_device) {
+ if(!device->load_state(state_fio)) {
+ return false;
+ }
+ }
+ return true;
+}
+
/*
ASCII MSX1 Emulator 'yaMSX1'
+ ASCII MSX2 Emulator 'yaMSX2'
Pioneer PX-7 Emulator 'ePX-7'
Author : tanam
Date : 2013.06.29-
- modified by Takeda.Toshiya, umaiboux
+ modified by Takeda.Toshiya
+ modified by umaiboux
[ virtual machine ]
*/
-#ifndef _MSX1_H_
-#define _MSX1_H_
+#ifndef _MSX_H_
+#define _MSX_H_
-#ifdef _PX7
+#if defined(_PX7)
#define DEVICE_NAME "PIONEER PX-7"
#define CONFIG_NAME "px7"
-#else
+#elif defined(_MSX1)
#define DEVICE_NAME "ASCII MSX1"
#define CONFIG_NAME "msx1"
+#elif defined(_MSX2)
+#define DEVICE_NAME "ASCII MSX2"
+#define CONFIG_NAME "msx2"
#endif
// device informations for virtual machine
#define FRAMES_PER_SEC 60
#define LINES_PER_FRAME 262
#define CPU_CLOCKS 3579545
-//#define SCREEN_WIDTH 256
-//#define SCREEN_HEIGHT 192
+#if defined(_MSX2)
+#define SCREEN_WIDTH ((256 + 15)*2) // V99X8_WIDTH
+#define SCREEN_HEIGHT ((212 + 15)*2) // V99X8_HEIGHT
+#else
#define SCREEN_WIDTH 512
#define SCREEN_HEIGHT 384
+#endif
#define TMS9918A_VRAM_SIZE 0x4000
#define TMS9918A_LIMIT_SPRITES
+#if defined(_PX7)
#define TMS9918A_SUPER_IMPOSE
+#else
+#define MAX_DRIVE 2
+#define SUPPORT_MEDIA_TYPE_1DD
+#define Z80_PSEUDO_BIOS
+#endif
#define HAS_AY_3_8910
// for Flappy Limited '85
#define YM2203_PORT_MODE 0x80
#define USE_CART1
#define USE_CART2
#define USE_TAPE
-#ifdef _PX7
-# define USE_LASER_DISC
+#if defined(_PX7)
+#define USE_LASER_DISC
+#else
+#define USE_FD1
+#define USE_FD2
#endif
#define USE_ALT_F10_KEY
#define USE_AUTO_KEY 6
#define USE_AUTO_KEY_RELEASE 10
#define USE_DEBUGGER
+#define USE_STATE
#include "../../common.h"
#include "../../fileio.h"
class DATAREC;
class I8255;
class IO;
-#ifdef _PX7
+#if defined(_PX7)
class LD700;
#endif
class NOT;
class YM2203;
class PCM1BIT;
+#if defined(_MSX2)
+class RP5C01;
+class V99X8;
+#else
class TMS9918A;
+#endif
class Z80;
class JOYSTICK;
class KEYBOARD;
class MEMORY;
-class SLOT_CART;
-class SLOT_MAIN;
-class SLOT_SUB;
+#if defined(_MSX2)
+class RTCIF;
+#endif
+class SLOT0;
+class SLOT1;
+class SLOT2;
+class SLOT3;
class VM
{
DATAREC* drec;
I8255* pio;
IO* io;
-#ifdef _PX7
- LD700* ldp;
+#if defined(_PX7)
+ LD700* ldp;
#endif
- NOT* g_not;
+ NOT* d_not;
YM2203* psg;
PCM1BIT* pcm;
+#if defined(_MSX2)
+ RP5C01* rtc;
+ V99X8* vdp;
+#else
TMS9918A* vdp;
+#endif
Z80* cpu;
JOYSTICK* joystick;
KEYBOARD* keyboard;
MEMORY* memory;
- SLOT_MAIN *slot0;
- SLOT_CART *slot1;
- SLOT_SUB *slot2;
- SLOT_CART *slot3;
+#ifdef _MSX2
+ RTCIF* rtcif;
+#endif
+ SLOT0 *slot0;
+ SLOT1 *slot1;
+ SLOT2 *slot2;
+ SLOT3 *slot3;
public:
// ----------------------------------------
void initialize_sound(int rate, int samples);
uint16* create_sound(int* extra_frames);
int sound_buffer_ptr();
+#if defined(_PX7)
void movie_sound_callback(uint8 *buffer, long size);
+#endif
// user interface
void open_cart(int drv, _TCHAR* file_path);
void close_tape();
bool tape_inserted();
int get_tape_ptr();
+#if defined(_PX7)
void open_laser_disc(_TCHAR* file_path);
void close_laser_disc();
bool laser_disc_inserted();
+#else
+ void open_disk(int drv, _TCHAR* file_path, int bank);
+ void close_disk(int drv);
+ bool disk_inserted(int drv);
+ void write_protect_fd(int drv, bool flag);
+ bool is_write_protect_fd(int drv);
+ int access_lamp();
+#endif
bool now_skip();
void update_config();
+ void save_state(FILEIO* state_fio);
+ bool load_state(FILEIO* state_fio);
// ----------------------------------------
// for each device
--- /dev/null
+/*
+ ASCII MSX2 Emulator 'yaMSX2'
+
+ Author : umaiboux
+ Date : 2014.12.xx-
+
+ modified by Takeda.Toshiya
+
+ [ rtc i/f ]
+*/
+
+#include "rtcif.h"
+
+void RTCIF::write_io8(uint32 addr, uint32 data)
+{
+ switch(addr & 1) {
+ case 0:
+ adrs = data & 0x0f;
+ break;
+ case 1:
+ d_rtc->write_io8(adrs, data & 0x0f);
+ break;
+ }
+}
+
+uint32 RTCIF::read_io8(uint32 addr)
+{
+ return d_rtc->read_io8(adrs);
+}
+
+#define STATE_VERSION 1
+
+void RTCIF::save_state(FILEIO* state_fio)
+{
+ state_fio->FputUint32(STATE_VERSION);
+ state_fio->FputInt32(this_device_id);
+
+ state_fio->FputUint8(adrs);
+}
+
+bool RTCIF::load_state(FILEIO* state_fio)
+{
+ if(state_fio->FgetUint32() != STATE_VERSION) {
+ return false;
+ }
+ if(state_fio->FgetInt32() != this_device_id) {
+ return false;
+ }
+ adrs = state_fio->FgetUint8();
+ return true;
+}
+
--- /dev/null
+/*
+ ASCII MSX2 Emulator 'yaMSX2'
+
+ Author : umaiboux
+ Date : 2014.12.xx-
+
+ modified by Takeda.Toshiya
+
+ [ rtc i/f ]
+*/
+
+#ifndef _RTCIF_H_
+#define _RTCIF_H_
+
+#include "../vm.h"
+#include "../../emu.h"
+#include "../device.h"
+
+class RTCIF : public DEVICE
+{
+private:
+ DEVICE *d_rtc;
+ uint8 adrs;
+
+public:
+ RTCIF(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
+ ~RTCIF() {}
+
+ // common functions
+ void write_io8(uint32 addr, uint32 data);
+ uint32 read_io8(uint32 addr);
+ void save_state(FILEIO* state_fio);
+ bool load_state(FILEIO* state_fio);
+
+ // unique function
+ void set_context_rtc(DEVICE* device)
+ {
+ d_rtc = device;
+ }
+};
+
+#endif
+
+++ /dev/null
-cmake_minimum_required (VERSION 2.6)
-
-message("* vm/msx1")
-
-add_library(vm_msx1
- joystick.cpp
- keyboard.cpp
- memory.cpp
- msx1.cpp
-)
\ No newline at end of file
+++ /dev/null
-/*
- Pioneer PX-7 Emulator 'ePX-7'
-
- Author : Takeda.Toshiya
- Date : 2014.01.09-
-
- modified by umaiboux
-
- [ memory ]
-*/
-
-#include "memory.h"
-#include "../ld700.h"
-#include "../tms9918a.h"
-
-#define SET_BANK(s, e, w, r) { \
- int sb = (s) >> 13, eb = (e) >> 13; \
- for(int i = sb; i <= eb; i++) { \
- if((w) == wdmy) { \
- wbank[i] = wdmy; \
- } else { \
- wbank[i] = (w) + 0x2000 * (i - sb); \
- } \
- if((r) == rdmy) { \
- rbank[i] = rdmy; \
- } else { \
- rbank[i] = (r) + 0x2000 * (i - sb); \
- } \
- } \
-}
-
-// slot #0
-
-void SLOT_MAIN::initialize()
-{
- memset(rom, 0xff, sizeof(rom));
- memset(ram, 0, sizeof(ram));
- memset(rdmy, 0xff, sizeof(rdmy));
-
- FILEIO* fio = new FILEIO();
- if(fio->Fopen(emu->bios_path(_T("BASIC.ROM")), FILEIO_READ_BINARY)) {
- fio->Fread(rom, sizeof(rom), 1);
- fio->Fclose();
- }
- delete fio;
-
- SET_BANK(0x0000, 0x7fff, wdmy, rom);
- SET_BANK(0x8000, 0xffff, ram, ram);
-}
-
-void SLOT_MAIN::write_data8(uint32 addr, uint32 data)
-{
- wbank[addr >> 13][addr & 0x1fff] = data;
-}
-
-uint32 SLOT_MAIN::read_data8(uint32 addr)
-{
- return rbank[addr >> 13][addr & 0x1fff];
-}
-
-// slot #2
-
-#define EVENT_CLOCK 0
-
-void SLOT_SUB::initialize()
-{
- memset(rom, 0xff, sizeof(rom));
- memset(rdmy, 0xff, sizeof(rdmy));
-
- FILEIO* fio = new FILEIO();
- if(fio->Fopen(emu->bios_path(_T("EXT.ROM")), FILEIO_READ_BINARY)) {
- fio->Fread(rom, sizeof(rom), 1);
- fio->Fclose();
- }
- delete fio;
-
- SET_BANK(0x0000, 0x3fff, wdmy, rdmy);
- SET_BANK(0x4000, 0x5fff, wdmy, rom);
- SET_BANK(0x6000, 0xffff, wdmy, rdmy);
-
- clock = exv = ack = false;
-
- register_event(this, EVENT_CLOCK, 1000000.0 / 7812.5, true, NULL);
-}
-
-void SLOT_SUB::reset()
-{
- super_impose = false;
- req_intr = false;
- pc4 = false;
- mute_l = mute_r = true;
-
-#ifdef _PX7
- d_ldp->write_signal(SIG_LD700_MUTE_L, 1, 1);
- d_ldp->write_signal(SIG_LD700_MUTE_R, 1, 1);
-#endif
- d_vdp->write_signal(SIG_TMS9918A_SUPER_IMPOSE, 0, 0);
-}
-
-void SLOT_SUB::write_data8(uint32 addr, uint32 data)
-{
- if(addr == 0x7ffe) {
-#ifdef _PX7
- d_ldp->write_signal(SIG_LD700_REMOTE, data, 1);
-#endif
- } else if(addr == 0x7fff) {
- // super impose
- bool prev_super_impose = super_impose;
- super_impose = ((data & 1) == 0);
- if(super_impose) {
- if(req_intr && !prev_super_impose) {
- d_cpu->write_signal(SIG_CPU_IRQ, 1, 1);
- }
- } else {
- d_cpu->write_signal(SIG_CPU_IRQ, 0, 0);
- }
- d_vdp->write_signal(SIG_TMS9918A_SUPER_IMPOSE, super_impose ? 1 : 0, 1);
-
- // mute
- bool prev_mute_l = mute_l;
- mute_l = ((data & 0x80) == 0);
- if(!prev_mute_l && mute_l) {
- mute_r = !pc4;
- }
-#ifdef _PX7
- d_ldp->write_signal(SIG_LD700_MUTE_L, mute_l ? 1 : 0, 1);
- d_ldp->write_signal(SIG_LD700_MUTE_R, mute_r ? 1 : 0, 1);
-#endif
- } else {
- wbank[addr >> 13][addr & 0x1fff] = data;
- }
-}
-
-uint32 SLOT_SUB::read_data8(uint32 addr)
-{
- if(addr == 0x7ffe) {
- return (clock ? 0 : 1) | (ack ? 0 : 0x80) | 0x7e;
- } else if(addr == 0x7fff) {
- uint32 data = (req_intr ? 1 : 0) | (exv ? 0 : 0x80) | 0x7e;
- req_intr = false;
- d_cpu->write_signal(SIG_CPU_IRQ, 0, 0);
- return data;
- } else {
- return rbank[addr >> 13][addr & 0x1fff];
- }
-}
-
-void SLOT_SUB::write_signal(int id, uint32 data, uint32 mask)
-{
- if(id == SIG_SLOT2_EXV) {
- bool prev = exv;
- exv = ((data & mask) != 0);
- if(prev && !exv) {
- req_intr = true;
- if(super_impose) {
- d_cpu->write_signal(SIG_CPU_IRQ, 1, 1);
- }
- }
- } else if(id == SIG_SLOT2_ACK) {
- ack = ((data & mask) != 0);
- } else if(id == SIG_SLOT2_MUTE) {
- pc4 = ((data & mask) != 0);
- }
-}
-
-void SLOT_SUB::event_callback(int event_id, int err)
-{
- if(event_id == EVENT_CLOCK) {
- clock = !clock;
- }
-}
-
-// slot #1, #3
-
-void SLOT_CART::initialize()
-{
- memset(rom, 0xff, sizeof(rom));
- memset(rdmy, 0xff, sizeof(rdmy));
-
- SET_BANK(0x0000, 0xffff, wdmy, rom);
-
- inserted = false;
-}
-
-void SLOT_CART::write_data8(uint32 addr, uint32 data)
-{
- wbank[addr >> 13][addr & 0x1fff] = data;
-}
-
-uint32 SLOT_CART::read_data8(uint32 addr)
-{
- return rbank[addr >> 13][addr & 0x1fff];
-}
-
-void SLOT_CART::open_cart(_TCHAR *file_path)
-{
- FILEIO* fio = new FILEIO();
- if(fio->Fopen(file_path, FILEIO_READ_BINARY)) {
- memset(rom, 0xff, sizeof(rom));
-
- fio->Fseek(0, FILEIO_SEEK_END);
- int file_size = fio->Ftell();
- fio->Fseek(0, FILEIO_SEEK_SET);
-
- if(file_size <= 0x2000) {
- // 8KB: 00000000
- fio->Fread(rom, 0x2000, 1);
- memcpy(rom + 0x2000, rom, 0x2000);
- memcpy(rom + 0x4000, rom, 0x4000);
- memcpy(rom + 0x8000, rom, 0x8000);
- } else if(file_size <= 0x4000) {
- // 16KB: 01010101
- fio->Fread(rom, 0x4000, 1);
- memcpy(rom + 0x4000, rom, 0x4000);
- memcpy(rom + 0x8000, rom, 0x8000);
- } else if(file_size <= 0x8000) {
- // 32KB: 01012323
- fio->Fread(rom + 0x4000, 0x8000, 1);
- memcpy(rom + 0x0000, rom + 0x4000, 0x4000);
- memcpy(rom + 0xc000, rom + 0x8000, 0x4000);
- } else {
- // 64KB: 01234567
- fio->Fread(rom, 0x10000, 1);
- }
- fio->Fclose();
- inserted = true;
- }
- delete fio;
-}
-
-void SLOT_CART::close_cart()
-{
- memset(rom, 0xff, sizeof(rom));
- inserted = false;
-}
-
-// memory bus
-
-void MEMORY::reset()
-{
- for(int i = 0; i < 4; i++) {
- d_map[i] = d_slot[i];
- }
-}
-
-void MEMORY::write_data8(uint32 addr, uint32 data)
-{
- addr &= 0xffff;
- d_map[addr >> 14]->write_data8(addr, data);
-}
-
-uint32 MEMORY::read_data8(uint32 addr)
-{
- addr &= 0xffff;
- return d_map[addr >> 14]->read_data8(addr);
-}
-
-uint32 MEMORY::fetch_op(uint32 addr, int* wait)
-{
- *wait = 1;
- return read_data8(addr);
-}
-
-void MEMORY::write_signal(int id, uint32 data, uint32 mask)
-{
- if(id == SIG_MEMORY_SEL) {
- for(int i = 0; i < 4; i++) {
- d_map[i] = d_slot[data & 3];
- data >>= 2;
- }
- }
-}
+++ /dev/null
-/*
- Pioneer PX-7 Emulator 'ePX-7'
-
- Author : Takeda.Toshiya
- Date : 2014.01.09-
-
- modified by umaiboux
-
- [ memory ]
-*/
-
-#ifndef _MEMORY_H_
-#define _MEMORY_H_
-
-#include "../vm.h"
-#include "../../emu.h"
-#include "../device.h"
-
-#define SIG_SLOT2_EXV 0
-#define SIG_SLOT2_ACK 1
-#define SIG_SLOT2_MUTE 2
-
-#define SIG_MEMORY_SEL 0
-
-class SLOT_MAIN : public DEVICE
-{
-private:
- uint8 wdmy[0x2000];
- uint8 rdmy[0x2000];
- uint8* wbank[8];
- uint8* rbank[8];
- uint8 rom[0x8000];
- uint8 ram[0x8000];
-
-public:
- SLOT_MAIN(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
- ~SLOT_MAIN() {}
-
- // common functions
- void initialize();
- void write_data8(uint32 addr, uint32 data);
- uint32 read_data8(uint32 addr);
-};
-
-#define MAX_TRACKS 1024
-
-class SLOT_SUB : public DEVICE
-{
-private:
- DEVICE *d_cpu;
-#ifdef _PX7
- DEVICE *d_ldp;
-#endif
- DEVICE *d_vdp;
- uint8 wdmy[0x2000];
- uint8 rdmy[0x2000];
- uint8* wbank[8];
- uint8* rbank[8];
- uint8 rom[0x2000];
-
- bool clock;
- bool exv, ack;
- bool super_impose;
- bool req_intr;
- bool pc4, mute_l, mute_r;
-
-public:
- SLOT_SUB(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
- ~SLOT_SUB() {}
-
- // common functions
- void initialize();
- void reset();
- void write_data8(uint32 addr, uint32 data);
- uint32 read_data8(uint32 addr);
- void write_signal(int id, uint32 data, uint32 mask);
- void event_callback(int event_id, int err);
-
- // unique functions
- void set_context_cpu(DEVICE* device)
- {
- d_cpu = device;
- }
- void set_context_ldp(DEVICE* device)
- {
-#ifdef _PX7
- d_ldp = device;
-#endif
- }
- void set_context_vdp(DEVICE* device)
- {
- d_vdp = device;
- }
-};
-
-class SLOT_CART : public DEVICE
-{
-private:
- uint8 wdmy[0x2000];
- uint8 rdmy[0x2000];
- uint8* wbank[8];
- uint8* rbank[8];
- uint8 rom[0x10000];
-
- bool inserted;
-
-public:
- SLOT_CART(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
- ~SLOT_CART() {}
-
- // common functions
- void initialize();
- void write_data8(uint32 addr, uint32 data);
- uint32 read_data8(uint32 addr);
-
- // unique functions
- void open_cart(_TCHAR *file_path);
- void close_cart();
- bool cart_inserted()
- {
- return inserted;
- }
-};
-
-class MEMORY : public DEVICE
-{
-private:
- DEVICE *d_slot[4];
- DEVICE *d_map[4];
-
-public:
- MEMORY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {}
- ~MEMORY() {}
-
- // common functions
- void reset();
- void write_data8(uint32 addr, uint32 data);
- uint32 read_data8(uint32 addr);
- uint32 fetch_op(uint32 addr, int* wait);
- void write_signal(int id, uint32 data, uint32 mask);
-
- // unique function
- void set_context_slot(int drv, DEVICE *device)
- {
- d_slot[drv] = device;
- }
-};
-
-#endif
-
{
for (int code=0; code < 256; code++) {
if (key_stat[code] & 0x80) {
+ if (code == VK_LSHIFT || code == VK_LCONTROL || code == VK_LMENU ||
+ code == VK_RSHIFT || code == VK_RCONTROL || code == VK_RMENU) continue;
if (code == VK_SHIFT || code == VK_CONTROL) continue;
key_stat[code]=0;
if (code == 0x75) {kanaMode = -1 * (kanaMode-1);continue;} // VK_F6
#define SCREEN_HEIGHT 400
#define MAX_DRIVE 1
#define HAS_V30
-#define I86_BIOS_CALL
+#define I86_PSEUDO_BIOS
#define I8259_MAX_CHIPS 1
//#define UPD765A_DMA_MODE
//#define SINGLE_MODE_DMA
--- /dev/null
+#define USE_CMDTIME
+
+// from "v99x8.c" of Zodiac
+
+/*
+ * Copyright (c) 2000-2002 SASAKI Shunsuke (eruchan@users.sourceforge.net).
+ * Copyright (c) 2001-2002 The Zodiac project.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+//#include "../../config.h"
+
+#include <string.h>
+
+//#include "../zodiac.h"
+#include "v99x8.h"
+v99x8_t v99x8;
+
+#ifdef USE_CMDTIME
+void cmdtime_set(int m);
+void cmdtime_chk(void);
+static int cmdtime_t;
+static int cmdtime_m;
+#endif
+static int latch1;
+static int latch2;
+
+// from "md.h.in" of Zodiac
+#if defined(_MSC_VER)
+# define __inline__ __forceinline
+#elif defined(_MWERKS_)
+# define __inline__ inline
+#elif !defined(__GNUC__)
+# define __inline__
+#endif
+
+#define MD_LITTLE
+
+//#include "z80.h" /* XXX interrupt */
+#define Z80_NOINT 0xffff
+#define Z80_INT 0x0038
+//#define Z80_NMI 0x0066
+
+#define MD_BPP 32
+#define md_maprgb15(R,G,B) (((R)<<19)|((G)<<11)|((B)<<3))
+#define md_video_pixbytes(n) (n*32/8)
+#define md_refresh_sync() (TRUE)
+#define md_video_defaultopt() (0)
+int md_video_pitch(void); // the length of a row of pixels in bytes
+uint8 *md_video_lockline(int x, int y, int w, int h);
+void md_video_unlockline(void) {}
+void md_video_update(int n, /*md_video_rect_t*/void *rp);
+void md_video_fill(int x, int y, int w, int h, uint32 c);
+typedef uint32 md_pixel_t;
+
+// from "md_depend.h" of Zodiac
+typedef struct
+{
+ int width, height;
+ int bpp;
+ int option;
+} md_video_mode_t;
+//typedef SDL_Rect md_video_rect_t;
+//typedef SDL_Surface md_video_surface_t;
+typedef struct
+{
+ //md_video_surface_t *screen;
+ int w, h; /* \97v\8b\81\82µ\82½\83T\83C\83Y */
+} md_video_t;
+
+
+static int vram_addr;
+static int vram_page;
+
+static bool f_out3;
+static bool f_mode;
+bool f_scr;
+
+
+extern void v99x8_command(int m); /* v99x8_internal.h ?? */
+extern void v99x8_cputovdp(int m);
+
+
+#define XXX_V99X8_ID 0
+
+
+/*
+0: 000, 10 xx TMS
+1: 000, 00 xx TMS
+2: 001, 00 xx TMS
+3: 000, 01 xx TMS
+
+x: 010, 10 xx
+4: 010, 00 xx
+5: 011, 00 xx 1
+6: 100, 00 xx 2
+7: 101, 00 xx I 1
+8: 111, 00 xx I 0
+
+a: 111, 00 11 0
+c: 111, 00 01 0
+*/
+
+
+/*
+normal, sc7/8
+
+00000h: 00000h
+00001h: 10000h
+00002h: 00001h
+00003h: 10000h
+0fffeh: 07fffh
+0ffffh: 17fffh
+10000h: 08000h
+10001h: 08001h
+
+*/
+
+static void v99x8_interleave(void)
+{
+#if 0
+ static uint8 *vram = NULL;
+ uint8 *p;
+ size_t size;
+
+ size = v99x8.pages * 0x4000;
+
+ if (vram == NULL)
+ vram = (uint8 *)malloc(size);
+
+ p = vram;
+ vram = v99x8.vram;
+ v99x8.vram = p;
+
+ if (v99x8.mode.f_interleave)
+ {
+ int a, b, c;
+
+ a = 0;
+ b = size / 2;
+ c = 0;
+
+ while (c < (int)size)
+ {
+ v99x8.vram[c] = vram[a++];
+ v99x8.vram[c + 1] = vram[b++];
+ c += 2;
+ }
+ } else
+ {
+ int a, b, c;
+
+ a = 0;
+ b = size / 2;
+ c = 0;
+
+ while (c < (int)size)
+ {
+ v99x8.vram[a++] = vram[c];
+ v99x8.vram[b++] = vram[c + 1];
+ c += 2;
+ }
+ }
+#endif
+}
+
+static void v99x8_mode_set(int n)
+{
+ v99x8_screen_mode_t mode[] =
+ {
+ {TRUE, FALSE, 0, 0}, /* V99X8_SCREEN_0 */
+ {TRUE, FALSE, 0, 0}, /* V99X8_SCREEN_1 */
+ {TRUE, FALSE, 0, 0}, /* V99X8_SCREEN_2 */
+ {TRUE, FALSE, 0, 0}, /* V99X8_SCREEN_3 */
+
+ {FALSE, FALSE, 0, 0}, /* V99X8_SCREEN_4 */
+ {FALSE, FALSE, 256, 1}, /* V99X8_SCREEN_5 */
+ {FALSE, FALSE, 512, 2}, /* V99X8_SCREEN_6 */
+ {FALSE, TRUE, 512, 1}, /* V99X8_SCREEN_7 */
+
+ {FALSE, TRUE, 256, 0}, /* V99X8_SCREEN_8 */
+ {FALSE, FALSE, 0, 0}, /* V99X8_SCREEN_X */
+ {FALSE, TRUE, 256, 0}, /* V99X8_SCREEN_A */
+ {FALSE, TRUE, 256, 0} /* V99X8_SCREEN_C */
+ };
+
+ if (n != V99X8_SCREEN_8 || (v99x8.ctrl[25] & 0x08) != 0x08)
+ v99x8.scr = n;
+ else
+ {
+ if ((v99x8.ctrl[25] & 0x10) == 0x10)
+ v99x8.scr = V99X8_SCREEN_A;
+ else
+ v99x8.scr = V99X8_SCREEN_C;
+ }
+
+ memcpy(&v99x8.mode, &mode[v99x8.scr], sizeof(v99x8_screen_mode_t));
+}
+
+static void v99x8_update(void)
+{
+ int mapping[] =
+ {
+ V99X8_SCREEN_1, V99X8_SCREEN_2, V99X8_SCREEN_4, V99X8_SCREEN_5,
+ V99X8_SCREEN_6, V99X8_SCREEN_7, V99X8_SCREEN_IGN, V99X8_SCREEN_8,
+ V99X8_SCREEN_3, V99X8_SCREEN_IGN, V99X8_SCREEN_IGN, V99X8_SCREEN_IGN,
+ V99X8_SCREEN_IGN, V99X8_SCREEN_IGN, V99X8_SCREEN_IGN, V99X8_SCREEN_IGN,
+ V99X8_SCREEN_0, V99X8_SCREEN_IGN, V99X8_SCREEN_X
+ };
+
+ bool f;
+ int a;
+
+ if (!f_mode)
+ return;
+
+ f = v99x8.mode.f_interleave;
+
+ a = ((v99x8.ctrl[0] & 0x0e) >> 1) | (v99x8.ctrl[1] & 0x18);
+ if (a >= sizeof(mapping) / sizeof(*mapping) ||
+ mapping[a] == V99X8_SCREEN_IGN)
+ {
+ return;
+ }
+
+ v99x8_mode_set(mapping[a]);
+
+ if (f != v99x8.mode.f_interleave)
+ v99x8_interleave();
+
+ f_mode = FALSE;
+}
+
+
+static void v99x8_ctrl_init(void)
+{
+ memset(v99x8.ctrl, 0, sizeof(v99x8.ctrl));
+}
+
+void v99x8_ctrl(int n, uint8 m)
+{
+/* printf ("v99x8_ctrl %2d <= %02x\n", n, m); */
+
+ if (n >= V99X8_NREG)
+ {
+ n = V99X8_NREG - 1;
+ }
+
+ switch(n)
+ {
+ case 0:
+ if (((m ^ v99x8.ctrl[0]) & 0x0e) != 0)
+ {
+ f_mode = TRUE;
+ f_scr = TRUE;
+ }
+ break;
+
+ case 1:
+ if (((m ^ v99x8.ctrl[1]) & 0x18) != 0)
+ {
+ f_mode = TRUE;
+ f_scr = TRUE;
+ }
+ break;
+
+ case 2:
+ case 3:
+ case 4:
+ case 10:
+ f_scr = TRUE;
+ break;
+
+ case 7:
+ v99x8.col_fg = m >> 4;
+ v99x8.col_bg = m & 0x0f;
+ break;
+
+ case 14:
+ m &= v99x8.pages - 1;
+ vram_page = (int)m << 14;
+ break;
+
+ case 15:
+ if (m >= V99X8_NSTAT)
+ m = V99X8_NSTAT - 1;
+ break;
+
+ case 16:
+ m &= 0x0f;
+ break;
+
+ case 17:
+ f_out3 = !(m & 0x80);
+ m &= 0x3f;
+ break;
+
+ case 44:
+ v99x8_update();
+ v99x8_cputovdp(m);
+ break;
+ case 46:
+ v99x8_update();
+ v99x8_command(m);
+ break;
+
+ /* XXX
+
+ */
+ case 6:
+ m &= 0x3f;
+ break;
+
+ case 11:
+ m &= 0x03;
+ break;
+ }
+
+ v99x8.ctrl[n] = m;
+}
+
+
+static void vram_incaddr(void)
+{
+ vram_addr = (vram_addr + 1) & 0x3fff;
+ if (vram_addr == 0 && !v99x8.mode.f_tms)
+ v99x8_ctrl(14, v99x8.ctrl[14] + 1);
+}
+
+uint8 vram_read(int addr)
+{
+ return v99x8.vram[addr];
+}
+
+void vram_write(int addr, uint8 n)
+{
+ v99x8.vram[addr] = n;
+}
+
+
+uint8 v99x8_in_0(void) /* VRAM read */
+{
+ int n;
+
+ v99x8_update();
+
+ n = vram_read(vram_addr + vram_page);
+ vram_incaddr();
+ return n;
+}
+
+void v99x8_out_0(uint8 n) /* VRAM write */
+{
+ v99x8_update();
+
+ vram_write(vram_addr + vram_page, n);
+ vram_incaddr();
+}
+
+uint8 v99x8_in_1(void) /* status in */
+{
+ int n;
+#if 0
+ int a, b;
+#endif
+
+ v99x8_update();
+
+ n = v99x8.status[v99x8.ctrl[15]];
+
+/*
+if (z80.ivec!=Z80_NOINT)
+ {
+printf("* IFF:%d H:%d V:%d\n", z80.IFF&1, (v99x8.ctrl[0]&0x10), (v99x8.ctrl[1]&0x20));
+ }
+ z80_intreq(Z80_NOINT);
+ VKey=1;
+*/
+
+ switch(v99x8.ctrl[15])
+ {
+ case 0:
+ v99x8.status[0] &= ~0xa0;
+ break;
+ case 1:
+ v99x8.status[1] &= ~0x01;
+ break;
+ case 7:
+/* v99x8.status[7] = v99x8.ctrl[44] = v99x8_vdptocpu(); */
+ break;
+
+ case 2:
+#if 0
+ context_timelock();
+ a = context.hz / 60 / 262;
+ b = (context.time_cycle % a) * 100 / a;
+ context_timeunlock();
+
+ if (b > 73)
+ n |= 0x20;
+// else
+#endif
+// n &= ~0x20;
+ break;
+ }
+
+ return n;
+}
+
+void v99x8_out_1(uint8 n) /* ctrl out */
+{
+ //static int latch = -1;
+
+ if (latch1 == -1)
+ {
+ latch1 = n;
+ } else
+ {
+ if (n & 0x80)
+ {
+ if ((n & 0x40) == 0)
+ v99x8_ctrl(n & 0x3f, latch1);
+ } else
+ {
+/* ??? read/write \82Ì\8bæ\95Ê */
+ vram_addr = ((int)(n & 0x3f) << 8) + latch1;
+ }
+ latch1 = -1;
+ }
+}
+
+void v99x8_out_2(uint8 n) /* palette out */
+{
+ //static int latch = -1;
+
+ if (latch2 == -1)
+ {
+ latch2 = n;
+ } else
+ {
+ int a;
+
+ a = v99x8.ctrl[16];
+ v99x8_pallete_set(a, (latch2 & 0x70) >> 4, n & 0x07, latch2 & 0x07);
+ v99x8_ctrl(16, a + 1);
+
+ latch2 = -1;
+ }
+}
+
+void v99x8_out_3(uint8 n) /* ctrl out */
+{
+ if (v99x8.ctrl[17] != 17)
+ v99x8_ctrl(v99x8.ctrl[17], n);
+
+ if (f_out3)
+ v99x8_ctrl(17, v99x8.ctrl[17] + 1);
+}
+
+
+static void v99x8_status_init(void)
+{
+ memset(v99x8.status, 0, sizeof(v99x8.status));
+ v99x8.status[0] = 0x9f;
+ v99x8.status[1] = XXX_V99X8_ID << 1;
+ v99x8.status[2] = 0xac;
+}
+
+static void v99x8_vram_init(void)
+{
+ //v99x8.vram = (uint8 *)malloc(v99x8.pages * 0x4000);
+ memset(v99x8.vram, 0xff, v99x8.pages * 0x4000);
+}
+
+void v99x8_init(void)
+{
+/* ---- */
+
+ vram_addr = 0;
+ vram_page = 0;
+ f_out3 = FALSE;
+ f_scr = TRUE;
+ f_mode = FALSE;
+
+
+/* ---- */
+
+ v99x8.scanline = 0;
+ v99x8.n_scanlines = 262;
+ v99x8.pages = 8;
+
+ v99x8_ctrl_init();
+ v99x8_status_init();
+
+/* v99x8.f_zoom = FALSE; */
+
+ v99x8_vram_init();
+
+ v99x8_mode_set(V99X8_SCREEN_1);
+
+ v99x8.col_fg = 0;
+ v99x8.col_bg = 0;
+
+ v99x8_refresh_init();
+}
+
+static bool flag_frame = FALSE;
+
+int V99X8::hsync(int v/*void*/)
+{
+ int a, line;
+
+ v99x8.scanline = v; // is this OK???
+ v99x8.status[2] ^= 0x20;
+
+ if (v99x8.scanline < 226)
+ {
+ if (flag_frame)
+ {
+ if (0 == v99x8.scanline) v99x8_refresh_clear(); // added by umaiboux
+ line = v99x8.scanline + (((v99x8.ctrl[18] >> 4) + 8) & 0x0f) - 8 - 7;
+ if (v99x8.ctrl[9] & 0x80)
+ a = 212;
+ else
+ a = 192, line -= 10;
+
+ if (v99x8.ctrl[1] & 0x40 && line >= 0 && line < a)
+ {
+ v99x8_update();
+
+ switch(v99x8.scr)
+ {
+ case V99X8_SCREEN_0: v99x8_refresh_sc0(line, 1); break;
+ case V99X8_SCREEN_1: v99x8_refresh_sc1(line, 1); break;
+ case V99X8_SCREEN_2: v99x8_refresh_sc4(line, 1); break;
+ case V99X8_SCREEN_3: v99x8_refresh_sc3(line, 1); break;
+ case V99X8_SCREEN_4: v99x8_refresh_sc4(line, 1); break;
+ case V99X8_SCREEN_5: v99x8_refresh_sc5(line, 1); break;
+ case V99X8_SCREEN_6: v99x8_refresh_sc6(line, 1); break;
+ case V99X8_SCREEN_7: v99x8_refresh_sc7(line, 1); break;
+ case V99X8_SCREEN_8: v99x8_refresh_sc8(line, 1); break;
+ case V99X8_SCREEN_A: v99x8_refresh_scc(line, 1); break;
+ case V99X8_SCREEN_C: v99x8_refresh_scc(line, 1); break;
+ case V99X8_SCREEN_X: v99x8_refresh_scx(line, 1); break;
+ }
+ }
+ }
+
+ if (((v99x8.scanline + v99x8.ctrl[23]
+ - ((v99x8.ctrl[9] & 0x80) ? 8 : 18)) & 0xff) == v99x8.ctrl[19])
+ {
+ if (v99x8.ctrl[0] & 0x10)
+ {
+ v99x8.status[1] |= 0x01; /* H-sync */
+ z80_intreq(Z80_INT);
+ }
+ } else
+ {
+ if (!(v99x8.ctrl[0] & 0x10))
+ v99x8.status[1] &= ~0x01; /* ?? H-sync off*/
+ }
+ } else
+ {
+ switch(v99x8.scanline)
+ {
+ case 234:
+ if (flag_frame)
+ v99x8_refresh_screen();
+
+ flag_frame = md_refresh_sync();
+
+ v99x8.status[2] |= 0x40; /* VBlank on */
+
+ v99x8.status[1] &= ~0x01; /* ?? H-sync off*/
+ z80_intreq(Z80_NOINT); /* ?? H-sync \82ð clear */
+
+/* XXX sprite check */
+ break;
+
+ case 237:
+/* v99x8.status[1] &= ~0x01; */ /* ?? H-sync off*/
+ if (v99x8.ctrl[1] & 0x20)
+ {
+ v99x8.status[0] |= 0x80; /* V-sync int */
+ z80_intreq(Z80_INT);
+ }
+ break;
+
+ case 261:
+ v99x8.status[2] &= ~0x40; /* VBlank off */
+ v99x8.status[0] &= ~0x40; /* 5sprit off */
+ v99x8.status[0] &= ~0x80; /* Vsync off */
+ z80_intreq(Z80_NOINT); /* ?? V-sync \82ð clear */
+
+ /*if (flag_frame)
+ v99x8_refresh_clear();*/ // deleted by umaiboux
+ }
+
+
+/* NTSC timing
+
+ 3/ 3: sync signal
+ 13/ 13: top erase
+ 26/ 16: top border
+192/212: line
+ 25/ 15: bottom border
+
+ 3/ 3: bottom erase
+
+*/
+ }
+ return v99x8.scanline = (v99x8.scanline + 1) % v99x8.n_scanlines;
+}
+
+
+
+// from "v99x8_command.c" of Zodiac
+
+/*
+ * Copyright (c) 2000-2002 SASAKI Shunsuke (eruchan@users.sourceforge.net).
+ * Copyright (c) 2001-2002 The Zodiac project.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+//#include "../../config.h"
+
+//#include <string.h>
+#include <stdlib.h>
+
+//#include "../zodiac.h"
+#include "v99x8.h"
+
+/* #define YAN_V99X8_TEST 1 */ /* XXX */
+
+typedef struct
+{
+ int xbytes;
+ int xmask, xshift;
+ int ymask, yshift;
+
+ int sx, sy, dx, dy, nx, ny;
+ int lop;
+
+ uint8 *src, *dst;
+} vcom_t;
+
+vcom_t vcom;
+
+typedef struct
+{
+ int sx, sy, ex, ey;
+ int x, y;
+ int xsize;
+} r44_t;
+
+static r44_t r44;
+
+#if 1 /* XXX */
+typedef struct
+{
+ int npix;
+ int xmask;
+ int mask;
+ int pmask[4];
+ int lshift[4];
+ int rshift[4];
+} pixmask_t;
+
+static pixmask_t pixmasks[4] = {
+ {2, 0x01, 0x0f, {0x0f, 0xf0, 0x0f, 0xf0}, {4, 0, 4, 0}, {4, 0, 4, 0}},
+ {4, 0x03, 0x03, {0x3f, 0xcf, 0xf3, 0xfc}, {6, 4, 2, 0}, {6, 4, 2, 0}},
+ {2, 0x01, 0x0f, {0x0f, 0xf0, 0x0f, 0xf0}, {4, 0, 4, 0}, {4, 0, 4, 0}},
+ {1, 0x00, 0xff, {0x00, 0x00, 0x00, 0x00}, {0, 0, 0, 0}, {0, 0, 0, 0}}
+};
+
+static pixmask_t pixmask;
+#endif
+
+static int getshift(int n)
+{
+ int i;
+
+ for (i = 0; n & (1 << i); i++)
+ ;
+ return i;
+}
+
+#define vcom_getsx() vcom.sx = (v99x8.ctrl[32] + (v99x8.ctrl[33] << 8)) & vcom.xmask
+#define vcom_getsy() vcom.sy = (v99x8.ctrl[34] + (v99x8.ctrl[35] << 8)) & vcom.ymask
+#define vcom_getdx() vcom.dx = (v99x8.ctrl[36] + (v99x8.ctrl[37] << 8)) & vcom.xmask
+#define vcom_getdy() vcom.dy = (v99x8.ctrl[38] + (v99x8.ctrl[39] << 8)) & vcom.ymask
+#define vcom_getnx() vcom.nx = ((v99x8.ctrl[40] + (v99x8.ctrl[41] << 8) - 1) & 511) + 1
+#define vcom_getny() vcom.ny = ((v99x8.ctrl[42] + (v99x8.ctrl[43] << 8) - 1) & 1023) + 1
+
+static void vcom_lpset(int x, int y, int clr);
+static uint8 vcom_point(int x, int y);
+
+static void vcom_set(int base, int n)
+{
+ v99x8.ctrl[base] = n & 0xff;
+ v99x8.ctrl[base + 1] = n >> 8;
+}
+
+#define vcom_setsy(n) vcom_set(34, n)
+#define vcom_setdy(n) vcom_set(38, n)
+#define vcom_setny(n) vcom_set(42, n)
+
+#define vcom_vram(x, y) (&v99x8.vram[((x) >> vcom.xshift) + ((y) << vcom.yshift)])
+
+static int vcom_chksum(uint8 *d, int n)
+{
+ uint8 *p;
+ int sum = 0;
+
+ p = d;
+ while(n--) {
+ sum += *p;
+ p++;
+ }
+ return sum;
+}
+
+#define vcom_dtcopy(d, s, nbytes) { \
+ uint8 *p1, *p2; \
+ int n; \
+ p1 = (s); \
+ p2 = (d); \
+ n = (nbytes); \
+ while(n--) \
+ *p2++ = *p1++; \
+}
+
+static int vcom_canonaddr(void)
+{
+ int ny;
+
+ if (v99x8.ctrl[45] & 0x04) /* Direction to left */
+ {
+ vcom.sx -= vcom.nx;
+ vcom.dx -= vcom.nx;
+ }
+ vcom.sx = max(vcom.sx, 0);
+ vcom.nx = min(vcom.nx, vcom.xmask + 1 - vcom.sx);
+ vcom.dx = max(vcom.dx, 0);
+ vcom.nx = min(vcom.nx, vcom.xmask + 1 - vcom.dx);
+
+ ny = vcom.ny;
+ if ((v99x8.ctrl[45] & 0x08) == 0) /* Direction to down */
+ {
+ ny = min(ny, vcom.ymask + 1 - vcom.sy);
+ ny = min(ny, vcom.ymask + 1 - vcom.dy);
+ } else
+ {
+ ny = min(ny, vcom.sy + 1);
+ ny = min(ny, vcom.dy + 1);
+ ny = 0 - ny;
+ }
+
+/* printf("can %d->%d *(%d,%d)\n", vcom.sx, vcom.dx, vcom.nx, ny); */
+
+ vcom.src = vcom_vram(vcom.sx, vcom.sy);
+ vcom.dst = vcom_vram(vcom.dx, vcom.dy);
+ vcom.nx >>= vcom.xshift;
+
+ return ny;
+}
+
+static void vcom_hcopy(uint8 *dst, uint8 *src, int nx, int ny)
+{
+ if (ny < 0)
+ {
+ while (ny++ < 0)
+ {
+/* printf("sum1: %d\n", vcom_chksum(src, nx)); */
+ /* memmove(dst, src, nx); */
+ vcom_dtcopy(dst, src, nx);
+/* printf("sum2: %d\n", vcom_chksum(dst, nx)); */
+ src -= vcom.xbytes;
+ dst -= vcom.xbytes;
+ }
+ } else
+ {
+ while (ny--)
+ {
+/* printf("sum1: %d\n", vcom_chksum(src, nx)); */
+ /* memmove(dst, src, nx); */
+ vcom_dtcopy(dst, src, nx);
+/* printf("sum2: %d\n", vcom_chksum(dst, nx)); */
+ src += vcom.xbytes;
+ dst += vcom.xbytes;
+ }
+ }
+}
+
+static void ymmm(void)
+{
+ int n;
+
+ vcom_getdx();
+ vcom_getsy();
+ vcom.sx = vcom.dx;
+ vcom_getdy();
+ vcom.nx = 512;
+ vcom_getny();
+
+/* printf("ymmm: (%d,%d) %d*%d\n", vcom.sx, vcom.sy, vcom.dy, vcom.ny); */
+ n = vcom_canonaddr();
+ vcom_hcopy(vcom.dst, vcom.src, vcom.nx, n);
+
+ vcom_setsy(vcom.sy + n);
+ vcom_setdy(vcom.dy + n);
+
+ if (vcom.ny != abs(n))
+ vcom_setny(vcom.ny - abs(n));
+}
+
+static void hmmm(void)
+{
+ int n;
+
+ vcom_getsx();
+ vcom_getsy();
+ vcom_getdx();
+ vcom_getdy();
+ vcom_getnx();
+ vcom_getny();
+
+/* printf("hmmm: (%d,%d)->(%d,%d) *(%d,%d)\n", vcom.sx, vcom.sy, vcom.dx, vcom.dy, vcom.nx, vcom.ny); */
+ n = vcom_canonaddr();
+ vcom_hcopy(vcom.dst, vcom.src, vcom.nx, n);
+
+ vcom_setsy(vcom.sy + n);
+ vcom_setdy(vcom.dy + n);
+
+ if (vcom.ny != abs(n))
+ vcom_setny(vcom.ny - abs(n));
+}
+
+static void hmmv(void)
+{
+ int n, ny, clr;
+
+ vcom.sx = 0;
+ vcom.sy = 0;
+ vcom_getdx();
+ vcom_getdy();
+ vcom_getnx();
+ vcom_getny();
+ clr = v99x8.ctrl[44];
+
+ ny = n = vcom_canonaddr();
+ if (n < 0)
+ {
+ while (ny++ < 0)
+ {
+ memset(vcom.dst, clr, vcom.nx);
+ vcom.dst -= vcom.xbytes;
+ }
+ } else
+ {
+ while (ny--)
+ {
+ memset(vcom.dst, clr, vcom.nx);
+ vcom.dst += vcom.xbytes;
+ }
+ }
+
+ vcom_setsy(vcom.sy + n);
+ vcom_setdy(vcom.dy + n);
+
+ if (vcom.ny != abs(n))
+ vcom_setny(vcom.ny - abs(n));
+}
+
+#define vcom_lset(dc, sc) \
+switch(vcom.lop) \
+{ \
+ case 0x0: (dc) = (sc); break; \
+ case 0x1: (dc) &= (sc); break; \
+ case 0x2: (dc) |= (sc); break; \
+ case 0x3: (dc) ^= (sc); break; \
+ case 0x4: (dc) =~ (sc); break; \
+ case 0x8: if ((sc) != 0) (dc) = (sc); break; \
+ case 0x9: if ((sc) != 0) (dc) &= (sc); break; \
+ case 0xa: if ((sc) != 0) (dc) |= (sc); break; \
+ case 0xb: if ((sc) != 0) (dc) ^= (sc); break; \
+ case 0xc: if ((sc) != 0) (dc) =~ (sc); break; \
+}
+
+/*
+ dc = sc;
+ dc &= sc;
+ dc |= sc;
+ dc ^= sc;
+ dc = ~sc;
+*/
+
+static void vcom_lmove(uint8 *dst, uint8 *src, int n)
+{
+#if 0
+ if (v99x8.ctrl[45] & 0x04) /* Direction to left */
+#endif
+
+ while(n>0)
+ {
+ vcom_lset(*dst, *src);
+ ++dst, ++src;
+ --n;
+ }
+}
+
+static void vcom_lcopy(uint8 *dst, uint8 *src, int nx, int ny)
+{
+ if (ny < 0)
+ {
+ while (ny++ < 0)
+ {
+ vcom_lmove(dst, src, nx);
+ src -= vcom.xbytes;
+ dst -= vcom.xbytes;
+ }
+ } else
+ {
+ while (ny--)
+ {
+ vcom_lmove(dst, src, nx);
+ src += vcom.xbytes;
+ dst += vcom.xbytes;
+ }
+ }
+}
+
+/*
+ XXX
+ \82±\82ê\82Í\82 \82\82Ü\82Å\82»\82Ì\8fê\82µ\82Ì\82¬\82È\82à\82Ì\81B
+ memo:
+ src\82Ì\83f\81[\83^\82ðbuf\82É\83o\83C\83g\83R\83s\81[\82µ\81Adst\82Ì\90æ\93ª\82\90\82\89\82\98\82\85\82\8c\88Ê\92u\82É\82 \82¤\82æ\82¤\82É\83r\83b\83g\83V\83t\83g\82µ\81A
+ \90æ\92[\82Æ\8fI\92[\82Ì\83f\81[\83^\82ðdst\82Æ\8d\87\90¬\82µ\82Ä\81A\82»\82ê\82ðdst\82Ölogop\82ð\8dl\97¶\82µ\82Â\82Â\81A\83o\83C\83g\83R\83s
+ \81[\82·\82ê\82Î\82¢\82¢\82Ì\82©\81H
+
+ \82Å\81ASCREEN8\82Ì\8e\9e\82â\81Asrc\82Ædst\82Ìpixel\88Ê\92u\82ª\93¯\82¶\82È\82ç\81A\83V\83t\83g\8f\88\97\9d\82ð\82µ\82È\82¢\82æ\82¤
+ \82É\82·\82é\81A\82Æ\81B
+
+ \83R\83X\83g\82Í\82©\82©\82é\82¯\82Ç\81A1pix\82¸\82Â\82¿\82Ü\82¿\82Ü\83R\83s\81[\82·\82é\82æ\82è\82©\82Í\91¬\82»\82¤\82È\8bC\82ª\82·\82é\81B
+
+ \82»\82Ì\8fê\8d\87 vcom_lset \82É\82à\8eè\92¼\82µ\82ª\95K\97v\82É\82È\82é\82Æ(T\95t\82«\98_\97\9d\89\89\8eZ\95\94\95ª)\81B
+ \82¾\82¯\82Ç memmove \82Ì\8c\8f\82Ì\82æ\82¤\82É\81A\88ê\92Ubuf\82É\83Z\81[\83u\82·\82é\82Æ\81AVRAM\89ó\82µ\82¿\82á\82¤\82©\82à\81B
+
+ \82Æ\82·\82é\82Æ\81c\89º\82Ý\82½\82¢\82É\82¿\82Ü\82¿\82Ü\83R\83s\81[\82µ\82Ä\82\82µ\82©\82È\82¢\82Ì\82©\82È\82\9f\81c
+*/
+#ifdef YAN_V99X8_TEST
+static void vcom_lbcopy(int sx, int sy, int dx, int dy, int nx, int ny)
+{
+ int osx, odx, onx;
+
+ nx <<= vcom.xshift;
+ osx = sx;
+ odx = dx;
+ onx = nx;
+
+ if (ny < 0)
+ {
+ while (ny++ < 0)
+ {
+ while (nx-- > -1)
+ {
+ vcom_lpset(dx, dy, (int)vcom_point(sx, sy));
+ sx++;
+ dx++;
+ }
+ sy--;
+ dy--;
+ sx = osx;
+ dx = odx;
+ nx = onx;
+ }
+ } else
+ {
+ while (ny--)
+ {
+ while (nx-- > -1)
+ {
+ vcom_lpset(dx, dy, (int)vcom_point(sx, sy));
+ sx++;
+ dx++;
+ }
+ sy++;
+ dy++;
+ sx = osx;
+ dx = odx;
+ nx = onx;
+ }
+ }
+}
+#endif /* YAN_V99X8_TEST */
+
+
+void vcom_lputc(int m) /* XXX \8d¶\95û\8cü\81A\8fã\95û\8cü\82Ì\83e\83X\83g\82Í\82µ\82Ä\82Ü\82¹\82ñ */
+{
+ uint8 *dst;
+ int dot;
+
+ dst = vcom_vram(r44.x, r44.y);
+
+#if 1 /* XXX */
+ {
+ int pixn;
+
+ m &= pixmask.mask;
+ pixn = r44.x & pixmask.xmask;
+ dot = (*dst >> ((1 - pixn) * pixmask.npix)) & pixmask.mask;
+ vcom_lset(dot, m);
+ *dst = (*dst & pixmask.pmask[pixn]) | (dot << pixmask.lshift[pixn]);
+ }
+#else
+ switch (v99x8.scr)
+ {
+ case V99X8_SCREEN_5:
+ case V99X8_SCREEN_7:
+ m &= 0x0f;
+ dot = (*dst >> ((1 - (r44.x & 1)) * 4)) & 0x0f;
+ vcom_lset(dot, m);
+ if ((r44.x & 1) == 0)
+ *dst = (*dst & 0x0f) | (dot << 4);
+ else
+ *dst = (*dst & 0xf0) | dot;
+ break;
+
+ case V99X8_SCREEN_6:
+ m &= 0x03;
+ dot = (*dst >> ((1 - (r44.x & 3)) * 2)) & 0x03;
+ vcom_lset(dot, m);
+ switch (r44.x & 0x03)
+ {
+ case 0:
+ *dst = (*dst & 0x3f) | (dot << 6);
+ break;
+ case 1:
+ *dst = (*dst & 0xcf) | (dot << 4);
+ break;
+ case 2:
+ *dst = (*dst & 0xf3) | (dot << 2);
+ break;
+ case 3:
+ *dst = (*dst & 0xfc) | dot;
+ }
+ break;
+
+ case V99X8_SCREEN_8:
+ vcom_lset(*dst, m & 0xff);
+ break;
+
+ }
+#endif
+
+ if (r44.sx <= r44.ex)
+ {
+ if (++r44.x >= r44.ex)
+ {
+ r44.x = r44.sx;
+ if (r44.sy < r44.ey)
+ {
+ if (++r44.y >= r44.ey)
+ v99x8.status[2] &= ~0x01;
+ } else
+ {
+ if (--r44.y < r44.ey)
+ v99x8.status[2] &= ~0x01;
+ }
+ }
+ } else
+ {
+ if (--r44.x < r44.ex)
+ {
+ r44.x = r44.sx;
+ if (r44.sy <= r44.ey)
+ {
+ if (++r44.y > r44.ey)
+ v99x8.status[2] &= ~0x01;
+ } else
+ {
+ if (--r44.y < r44.ey)
+ v99x8.status[2] &= ~0x01;
+ }
+ }
+ }
+}
+
+
+void vcom_hputc(int m) /* XXX \8d¶\95û\8cü\81A\8fã\95û\8cü\82Ì\83e\83X\83g\82Í\82µ\82Ä\82Ü\82¹\82ñ */
+{
+ *vcom_vram(r44.x, r44.y) = m;
+
+ if (r44.sx <= r44.ex)
+ {
+ r44.x += 1 << vcom.xshift;
+
+ if (r44.x >= r44.ex)
+ {
+ r44.x = r44.sx;
+ if (r44.sy <= r44.ey)
+ {
+ if ((++r44.y) >= r44.ey)
+ v99x8.status[2] &= ~0x01;
+ } else
+ {
+ if ((--r44.y) <= r44.ey)
+ v99x8.status[2] &= ~0x01;
+ }
+ }
+ } else
+ {
+ r44.x -= 1 << vcom.xshift;
+
+ if (r44.x <= r44.ex)
+ {
+ r44.x = r44.sx;
+ if (r44.sy <= r44.ey)
+ {
+ if ((++r44.y) >= r44.ey)
+ v99x8.status[2] &= ~0x01;
+ } else
+ {
+ if ((--r44.y) <= r44.ey)
+ v99x8.status[2] &= ~0x01;
+ }
+ }
+ }
+}
+
+
+void v99x8_cputovdp(int m)
+{
+ if ((v99x8.status[2] & 0x01) == 0)
+ return;
+
+ switch(v99x8.ctrl[46] >> 4)
+ {
+ case 0xb:
+ vcom_lputc(m);
+ break;
+ case 0xf:
+ vcom_hputc(m);
+ break;
+ }
+}
+
+static void lmmc(void)
+{
+ vcom_getdx();
+ vcom_getdy();
+ vcom_getnx();
+ vcom_getny();
+
+
+ r44.sx = r44.x = vcom.dx;
+ r44.sy = r44.y = vcom.dy;
+ r44.ex = vcom.dx + vcom.nx;
+ r44.ey = vcom.dy + vcom.ny;
+
+ vcom_lputc(v99x8.ctrl[44]);
+}
+
+
+static void lmcm(void);
+
+static void stop(void);
+
+
+static void vcom_lpset(int x,int y, int clr)
+{
+ uint8 *dst;
+ int src_dot, dst_dot;
+
+ dst = vcom_vram(x, y);
+
+#if 1 /* XXX */
+ {
+ int pixn;
+
+ pixn = x & pixmask.xmask;
+ src_dot = clr & pixmask.mask;
+ dst_dot = (*dst >> pixmask.rshift[pixn]) & pixmask.mask;
+ vcom_lset(dst_dot, src_dot);
+ *dst = (*dst & pixmask.pmask[pixn]) | (dst_dot << pixmask.lshift[pixn]);
+ }
+#else
+ switch(v99x8.scr)
+ {
+ case V99X8_SCREEN_5:
+ case V99X8_SCREEN_7:
+ src_dot = clr & 0x0f;
+ dst_dot = (*dst >> ((1 - (x & 1)) * 4)) & 0x0f;
+ vcom_lset(dst_dot, src_dot);
+ if ((x & 1) == 0)
+ *dst = (*dst & 0x0f) | (dst_dot << 4);
+ else
+ *dst = (*dst & 0xf0) | dst_dot;
+ break;
+
+ case V99X8_SCREEN_6:
+ src_dot = clr & 0x03;
+ dst_dot = (*dst >> ((1 - (r44.x & 3)) * 2)) & 0x03;
+ vcom_lset(dst_dot, src_dot);
+ switch(x & 0x03)
+ {
+ case 0:
+ *dst = (*dst & 0x3f) | (src_dot << 6);
+ break;
+ case 1:
+ *dst = (*dst & 0xcf) | (src_dot << 4);
+ break;
+ case 2:
+ *dst = (*dst & 0xf3) | (src_dot << 2);
+ break;
+ case 3:
+ *dst = (*dst & 0xfc) | src_dot;
+ }
+ break;
+
+ case V99X8_SCREEN_8:
+ vcom_lset(*dst, clr & 0xff);
+ break;
+ }
+#endif
+}
+
+
+static void line(void)
+{
+ int i, j, x, y;
+ int maj, min;
+
+ vcom_getdx();
+ vcom_getdy();
+ maj = (v99x8.ctrl[40] + (v99x8.ctrl[41] << 8)) & 1023;
+ min = (v99x8.ctrl[42] + (v99x8.ctrl[43] << 8)) & 511;
+
+ /* XXX */
+ maj = (maj == 0) ? (1) : (maj);
+
+ for (i = 0; i <= maj; i++)
+ {
+ j = (i * min) / maj;
+ if (v99x8.ctrl[45] & 0x01)
+ {
+ y = vcom.dy + ((v99x8.ctrl[45] & 0x08) ? -i : i);
+ x = vcom.dx + ((v99x8.ctrl[45] & 0x04) ? -j : j);
+ } else
+ {
+ x = vcom.dx + ((v99x8.ctrl[45] & 0x04) ? -i : i);
+ y = vcom.dy + ((v99x8.ctrl[45] & 0x08) ? -j : j);
+ }
+ vcom_lpset(x, y, v99x8.ctrl[44]);
+ }
+}
+
+static uint8 vcom_point(int x, int y)
+{
+ uint8 clr = *vcom_vram(x, y);
+
+#if 1 /* XXX */
+ {
+ int pixn;
+
+ pixn = x & pixmask.xmask;
+ clr = (clr >> pixmask.rshift[pixn]) & pixmask.mask;
+ }
+#else
+ switch (v99x8.scr)
+ {
+ case V99X8_SCREEN_5:
+ case V99X8_SCREEN_7:
+ clr = (clr >> (4 * (x & 1))) & 0x0F;
+ break;
+ case V99X8_SCREEN_6:
+ clr = (clr >> (2 * (x & 3))) & 0x03;
+ break;
+ }
+#endif
+
+ return clr;
+}
+
+static void srch(void)
+{
+ int i;
+
+ vcom_getsx();
+ vcom_getsy();
+
+ i = 0;
+ v99x8.status[2] &= ~0x10;
+ while ((0 <= (vcom.sx + i)) && ((vcom.sx + i) <= vcom.xmask))
+ {
+ uint8 clr = vcom_point(vcom.sx + i, vcom.sy);
+ if (v99x8.ctrl[45] & 0x02)
+ {
+ if (clr != v99x8.ctrl[44])
+ {
+ v99x8.status[2] |= 0x10;
+ break;
+ }
+ } else
+ {
+ if (clr == v99x8.ctrl[44])
+ {
+ v99x8.status[2] |= 0x10;
+ break;
+ }
+ }
+ i = (v99x8.ctrl[45] & 0x04) ? (i - 1) : (i + 1);
+ }
+
+ if (v99x8.status[2] & 0x10)
+ {
+ v99x8.status[8] = (vcom.sx + i) & 0xff;
+ v99x8.status[9] = (((vcom.sx + i) >> 8) & 0x03) | 0xfc;
+ }
+}
+
+
+static void pset(void)
+{
+ vcom_getdx();
+ vcom_getdy();
+ vcom_lpset(vcom.dx, vcom.dy, v99x8.ctrl[44]);
+}
+
+
+static void point(void)
+{
+ vcom_getsx();
+ vcom_getsy();
+ v99x8.status[7] = vcom_point(vcom.sx, vcom.sy);
+}
+
+static void hmmc(void)
+{
+ vcom_getdx();
+ vcom_getdy();
+ vcom_getnx();
+ vcom_getny();
+
+
+ r44.sx = r44.x = vcom.dx & ~1;
+ r44.sy = r44.y = vcom.dy;
+ r44.ex = (vcom.dx + vcom.nx) & ~1;
+ r44.ey = vcom.dy + vcom.ny;
+ r44.xsize = vcom.nx & ~1;
+
+ vcom_hputc(v99x8.ctrl[44]);
+}
+
+static void lmmm(void)
+{
+ int n;
+
+ vcom_getsx();
+ vcom_getsy();
+ vcom_getdx();
+ vcom_getdy();
+ vcom_getnx();
+ vcom_getny();
+
+/* printf("hmmm: (%d,%d)->(%d,%d) *(%d,%d)\n", vcom.sx, vcom.sy, vcom.dx, vcom.dy, vcom.nx, vcom.ny); */
+ n = vcom_canonaddr();
+#if YAN_V99X8_TEST /* XXX */
+ vcom_lbcopy(vcom.sx, vcom.sy, vcom.dx, vcom.dy, vcom.nx, n);
+#else
+ vcom_lcopy(vcom.dst, vcom.src, vcom.nx, n);
+#endif
+ vcom_setsy(vcom.sy + n);
+ vcom_setdy(vcom.dy + n);
+
+ if (vcom.ny != abs(n))
+ vcom_setny(vcom.ny - abs(n));
+}
+
+
+static void lmmm_(void);
+
+
+static void vcom_lfill(uint8 *p, int clr, int n)
+{
+ if (n == 0) /* \83o\83C\83g\90\94\92P\88Ê\82Å\8f\88\97\9d\82ð\82¨\82±\82È\82¤\82½\82ß */
+ n = 1; /* 1dot\82ª\96³\8e\8b\82³\82ê\82Ä\82µ\82Ü\82¤\91Î\89\9e */
+
+ switch(vcom.lop)
+ {
+ case 0x8:
+ if (clr == 0)
+ break;
+ case 0x0:
+ while (n-- > 0)
+ *p++ = clr;
+ break;
+
+ case 0x9:
+ if (clr == 0)
+ break;
+ case 0x1:
+ while (n-- > 0)
+ *p++ &= clr;
+ break;
+
+ case 0xa:
+ if (clr == 0)
+ break;
+ case 0x2:
+ while (n-- > 0)
+ *p++ |= clr;
+ break;
+
+ case 0xb:
+ if (clr == 0)
+ break;
+ case 0x3:
+ while (n-- > 0)
+ *p++ ^= clr;
+ break;
+
+ case 0xc:
+ if (clr == 0)
+ break;
+ case 0x4:
+ while (n-- > 0)
+ *p++ = ~clr;
+ break;
+ }
+
+}
+
+static void lmmv(void) /* XXX byte \92P\88Ê\82Å\8f\88\97\9d\82µ\82Ä\82é\82Ì\82Í\8eè\94²\82«(^^; */
+{
+ int n, ny, clr;
+
+ vcom.sx = 0;
+ vcom.sy = 0;
+ vcom_getdx();
+ vcom_getdy();
+ vcom_getnx();
+ vcom_getny();
+ clr = v99x8.ctrl[44];
+ switch (vcom.xshift)
+ {
+ case 2:
+ clr |= clr << 2;
+ case 1:
+ clr |= clr << 4;
+ }
+
+ ny = n = vcom_canonaddr();
+ if (n < 0)
+ {
+ while (ny++ < 0)
+ {
+ vcom_lfill(vcom.dst, clr, vcom.nx);
+ vcom.dst -= vcom.xbytes;
+ }
+ } else
+ {
+ while (ny--)
+ {
+ vcom_lfill(vcom.dst, clr, vcom.nx);
+ vcom.dst += vcom.xbytes;
+ }
+ }
+
+ vcom_setsy(vcom.sy + n);
+ vcom_setdy(vcom.dy + n);
+
+ if (vcom.ny != abs(n))
+ vcom_setny(vcom.ny - abs(n));
+}
+
+
+static void lmmv_(void);
+
+
+void v99x8_command(int m)
+{
+ if (v99x8.mode.xsize == 0) /* XXX */
+ return;
+
+ vcom.xbytes = v99x8.mode.xsize >> v99x8.mode.xshift;
+ vcom.xmask = v99x8.mode.xsize - 1;
+ vcom.xshift = v99x8.mode.xshift;
+
+ vcom.ymask = v99x8.pages * 0x4000 / vcom.xbytes - 1;
+ vcom.yshift = getshift(vcom.xbytes - 1);
+
+#if 1 /* XXX */
+ pixmask = pixmasks[(v99x8.scr - V99X8_SCREEN_5) & 0x03];
+#endif
+
+ v99x8.status[2] |= 0x01;
+#ifdef USE_CMDTIME
+ cmdtime_set(m);
+#endif
+
+
+ vcom.lop = m & 0xf;
+
+ switch(m >> 4)
+ {
+ case 0xf: hmmc(); break;
+ case 0xe: ymmm(); break;
+ case 0xd: hmmm(); break;
+ case 0xc: hmmv(); break;
+ case 0xb: lmmc(); break;
+ case 0xa: lmcm(); break;
+ case 0x9: lmmm_(); break;
+ case 0x8: lmmv_(); break;
+ case 0x7: line(); break;
+ case 0x6: srch(); break;
+ case 0x5: pset(); break;
+ case 0x4: point(); break;
+ case 0x0: stop(); break;
+ }
+
+ v99x8.ctrl[46] &= 0x0f;
+#ifdef USE_CMDTIME
+ if (((m >> 4) != 0xb) && ((m >> 4) != 0xf) && (0 == cmdtime_t)) v99x8.status[2] &= ~0x01;
+ //cmdtime_chk();
+#else
+ if ((m >> 4) != 0xb && (m >> 4) != 0xf)
+ v99x8.status[2] &= ~0x01;
+#endif
+}
+
+// from "v99x8_refresh.c" of Zodiac
+
+/*
+ * Copyright (c) 2000-2002 SASAKI Shunsuke (eruchan@users.sourceforge.net).
+ * Copyright (c) 2001-2002 The Zodiac project.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+//#include "../../config.h"
+
+#include <stdlib.h>
+//#include <string.h>
+
+//#include "../zodiac.h"
+#include "v99x8.h"
+
+extern bool f_scr;
+
+
+#ifdef MD_LITTLE
+# define UINT32_FROM16(n1, n2) ((n2) << 16 | (n1))
+# define UINT8_FROM4(n1, n2) ((n1) << 4 | (n2))
+#else
+# define UINT32_FROM16(n1, n2) ((n1) << 16 | (n2))
+# define UINT8_FROM4(n1, n2) ((n2) << 4 | (n1))
+#endif
+
+
+typedef struct
+{
+ int width, height;
+ int bpp;
+
+} v99x8_refresh_t;
+
+static v99x8_refresh_t v99x8_refresh;
+
+
+ /* pallete */
+
+typedef struct
+{
+ bool flag;
+ uint8 r, g, b;
+ uint32 color;
+} v99x8_pallete_t;
+
+static v99x8_pallete_t pal[16 + 1];
+static uint32 pal_8[256];
+static uint32 pal_m[256];
+
+static bool f_pal;
+
+
+void v99x8_pallete_set(uint8 n, uint8 r, uint8 g, uint8 b)
+{
+ if (n == 0)
+ n = 16;
+
+ pal[n].r = r * 31 / 7;
+ pal[n].g = g * 31 / 7;
+ pal[n].b = b * 31 / 7;
+ pal[n].flag = TRUE;
+
+ f_pal = TRUE;
+}
+
+static int col_bg = 0;
+
+static void v99x8_pallete_update(void)
+{
+ int a;
+ int i, j;
+
+ if (f_pal)
+ for (i = 1; i < 17; ++i)
+ if (pal[i].flag)
+ pal[i].color = md_maprgb15(pal[i].r, pal[i].g, pal[i].b);
+
+ a = (v99x8.col_bg == 0 || (v99x8.ctrl[8] & 0x20)) ? 16 : v99x8.col_bg;
+ if (col_bg != a || pal[a].flag)
+ {
+ f_pal = TRUE;
+ col_bg = a;
+ memcpy(&pal[0], &pal[a], sizeof(v99x8_pallete_t));
+ pal[0].flag = TRUE;
+ }
+
+ if (!f_pal)
+ return;
+
+ if (!v99x8.f_zoom)
+ {
+ for (i = 0; i < 16; ++i)
+ {
+ for (j = 0; j < 16; ++j)
+ {
+ if (!pal[i].flag && !pal[j].flag)
+ continue;
+
+ a = UINT8_FROM4(i, j);
+
+ if (i == j)
+ {
+ pal_m[a] = pal[i].color;
+ } else
+ {
+ pal_m[a] = md_maprgb15((pal[i].r >> 1) + (pal[j].r >> 1),
+ (pal[i].g >> 1) + (pal[j].g >> 1),
+ (pal[i].b >> 1) + (pal[j].b >> 1));
+ }
+ }
+ }
+ }
+ f_pal = FALSE;
+ for (i = 0; i < 17; ++i)
+ pal[i].flag = FALSE;
+}
+
+static void v99x8_pallete_init(void)
+{
+ static const uint8 inipal[16][3] =
+ {
+ {0, 0, 0}, {0, 0, 0}, {1, 6, 1}, {3, 7, 3},
+ {1, 1, 7}, {2, 3, 7}, {5, 1, 1}, {2, 6, 7},
+ {7, 1, 1}, {7, 3, 3}, {6, 6, 1}, {6, 6, 4},
+ {1, 4, 1}, {6, 2, 5}, {5, 5, 5}, {7, 7, 7}
+ };
+
+ uint32 pal_black;
+ int i;
+
+ memset(pal, 0, sizeof(pal));
+
+ pal_black = md_maprgb15(0, 0, 0);
+ for (i = 0; i < 256; ++i)
+ {
+ /* GGGRRRBB */
+ /* i & 0x1c, (i >> 3) & 0x1c, (i & 3) << 3); */
+ pal_8[i] = md_maprgb15((i & 0x1c) * 31 / (7 << 2),
+ (i & 0xe0) * 31 / (7 << 5),
+ (i & 3) * 31 / 3);
+ pal_m[i] = pal_black;
+ }
+
+ for(i = 0; i < 16; i++)
+ v99x8_pallete_set(i, inipal[i][0], inipal[i][1], inipal[i][2]);
+}
+
+
+
+
+#define V99X8_WIDTH (256 + 15)
+#define V99X8_HEIGHT (212 + 15)
+
+
+static uint8 tbl_yjk_b[32 * 64 * 64], tbl_yjk_rg[62 + 32];
+static uint8 blackbuf[256]; /* sprite \94ñ\95\\8e¦\97p\83o\83b\83t\83@ */
+
+
+void v99x8_refresh_init(void)
+{
+ int i;
+ md_video_mode_t mode;
+
+ v99x8_refresh.width = V99X8_WIDTH;
+ v99x8_refresh.height = V99X8_HEIGHT;
+
+ if (v99x8.f_zoom)
+ {
+ v99x8_refresh.width *= 2;
+ v99x8_refresh.height *= 2;
+ }
+
+ mode.width = v99x8_refresh.width;
+ mode.height = v99x8_refresh.height;
+
+#ifdef MD_BPP
+ mode.bpp = v99x8_refresh.bpp = MD_BPP;
+#else
+ mode.bpp = v99x8_refresh.bpp = 16;
+#endif
+
+ mode.option = md_video_defaultopt();
+
+#if 0
+ md_video_fixmode(&mode);
+ if (!md_video_setmode(v99x8_refresh.width, v99x8_refresh.height, &mode, NULL))
+ exit(EXIT_FAILURE);
+
+ v99x8_refresh.bpp = md_video_bpp();
+#endif
+
+ v99x8_pallete_init();
+
+ for (i = 0; i < 32; ++i)
+ {
+ int n;
+
+ int j;
+ for (j = 0; j < 64; ++j)
+ {
+ int k;
+ for (k = 0; k < 64; ++k)
+ {
+ n = (i * 5 - ((j & 0x20) ? j - 64 : j) * 2
+ - ((k & 0x20) ? k - 64 : k)) >> 2;
+ if (n > 31)
+ n = 31;
+ if (n < 0)
+ n = 0;
+
+ tbl_yjk_b[(((j + 32) & 63) << 11)
+ + (((k + 32) & 63) << 5) + i] = n;
+ }
+ }
+
+ tbl_yjk_rg[i] = 0;
+ tbl_yjk_rg[i + 32] = i;
+ tbl_yjk_rg[i + 64] = 31;
+ }
+
+/*
+y5:k3 (low)
+y5:k3 (high)
+y5:j3
+y5:j3
+
+r: y + j
+g: y + k
+b: (5Y + 2J + K) >> 2
+*/
+ memset(blackbuf, 0, sizeof(blackbuf));
+}
+
+void V99X8::v99x8_refresh_screen(void)
+{
+ md_video_update(0, NULL);
+}
+
+void V99X8::v99x8_refresh_clear(void)
+{
+ md_video_fill(0, 0, v99x8_refresh.width, v99x8_refresh.height, pal[v99x8.col_bg].color);
+}
+
+uint8 *V99X8::v99x8_refresh_start(int x, int w, int h)
+{
+ int a;
+
+ v99x8_pallete_update();
+
+ a = v99x8.f_zoom ? 2 : 1;
+
+ return md_video_lockline((((7 - v99x8.ctrl[18]) & 0x0f) + x) * a
+ , v99x8.scanline * a
+ , w * a, h * a);
+}
+
+static __inline__ void v99x8_refresh_stop(void)
+{
+ md_video_unlockline();
+}
+
+
+#ifdef MD_BPP
+
+# if MD_BPP != 2
+
+# define pixel_put(pb, n, px) *((md_pixel_t *)(pb) + (n)) = (px)
+
+# else
+
+/*
+
+# ifdef MD_LITTLE
+# define pixel_put(pb, n, px) *((uint8 *)(pb) + (n) / 4) \
+ |= (px) << ((3 - (n)) * 2)
+# else
+# define pixel_put(pb, n, px) *((uint8 *)(pb) + (n) / 4) \
+ |= (px) << ((n) * 2)
+# endif
+
+*/
+
+# endif
+
+#else
+static __inline__ void pixel_put(void *pb, int n, uint32 p1)
+{
+ uint8 *p;
+ int mask, pix2bpp;
+
+ switch (v99x8_refresh.bpp)
+ {
+ case 16:
+ *((uint16 *)pb + n) = p1;
+ break;
+ case 8:
+ *((uint8 *)pb + n) = p1;
+ break;
+ case 32:
+ *((uint32 *)pb + n) = p1;
+ break;
+ case 2:
+ p = (uint8 *)pb + (n >> 2);
+#ifdef MD_LITTLE
+ mask = 0xc0 >> ((n & 3) * 2);
+ pix2bpp = p1 << (6 - ((n & 3) * 2));
+#else
+ mask = 0x03 << ((n & 3) * 2);
+ pix2bpp = p1 << ((n & 3) * 2);
+
+#endif
+ *p = (*p & ~mask) | (pix2bpp & mask);
+ break;
+
+/* XXX 2bpp \91Î\89\9e\95û\96@
+ *
+ * 1. \82Ü\82¸\91Î\89\9e\82·\82é 2bit \82ð & \82Å 0 \83N\83\8a\83A\82·\82é
+ * 2. \8e\9f\82É\81A2bit \82ð | \82Å\89Á\82¦\82é
+ *
+ * \82Æ\82¢\82¤\8eè\8f\87\82ª\95K\97v\81B\91Î\89\9e\82Í\8cã\93ú\82É\82Ä.... --\82k
+ */
+
+ }
+}
+#endif
+
+
+
+
+static uint8 sbuf[32 + 256 + 16];
+
+typedef struct
+{
+ uint8 y;
+ uint8 x;
+ uint8 n;
+ uint8 a;
+} v99x8_sprite_t;
+
+
+
+static uint8 *v99x8_refresh_sprite1(uint8 y)
+{
+ v99x8_sprite_t *ptr_a;
+ int n, size;
+ int i;
+ uint8 a, c, *ptr_g, *ptr_s, *tbl_sp;
+ bool cf;
+
+/* if (v99x8.ctrl[8] & 0x02)
+ return blackbuf; */
+
+/* tbl_sp = &v99x8.vram[(int)v99x8.ctrl[6] << 11]; */
+ tbl_sp = v99x8.vram + ((int)v99x8.ctrl[6] << 11);
+
+ memset(sbuf + 32, 0, 256);
+
+ size = (v99x8.ctrl[1] & 0x02) ? 16 : 8;
+/* if (SpritesMAG)
+ h *= 2; */
+
+ n = 0;
+ cf = FALSE;
+ ptr_a = (v99x8_sprite_t *)(v99x8.vram + ((int)v99x8.ctrl[11] << 15)
+ + ((int)v99x8.ctrl[5] << 7));
+
+ for (i = 0 ;; ++i, ++ptr_a)
+ {
+ if (i >= 32 || n >= 4 || ptr_a->y == 208)
+ break;
+
+ a = (uint8)(ptr_a->y - v99x8.ctrl[23]); /* a>256-h? a-=256 */
+ if (a >=y || a + size < y)
+ continue;
+
+ ++n;
+ a = y - (a + 1);
+
+ c = ptr_a->a;
+ ptr_s = sbuf + ptr_a->x + ((c & 0x80) ? 0 : 32);
+ ptr_g = tbl_sp + a
+ + (((v99x8.ctrl[1] & 0x02) ? ptr_a->n & 0xfc : ptr_a->n) << 3);
+
+/* cf = TRUE; */
+ c &= 0x0f;
+
+ if (ptr_s[0] == 0 && (*ptr_g & 0x80)) ptr_s[0] = c;
+ if (ptr_s[1] == 0 && (*ptr_g & 0x40)) ptr_s[1] = c;
+ if (ptr_s[2] == 0 && (*ptr_g & 0x20)) ptr_s[2] = c;
+ if (ptr_s[3] == 0 && (*ptr_g & 0x10)) ptr_s[3] = c;
+ if (ptr_s[4] == 0 && (*ptr_g & 0x08)) ptr_s[4] = c;
+ if (ptr_s[5] == 0 && (*ptr_g & 0x04)) ptr_s[5] = c;
+ if (ptr_s[6] == 0 && (*ptr_g & 0x02)) ptr_s[6] = c;
+ if (ptr_s[7] == 0 && (*ptr_g & 0x01)) ptr_s[7] = c;
+
+ if (!(v99x8.ctrl[1] & 0x02))
+ continue;
+
+ ptr_s += 8;
+ ptr_g += 16;
+
+ if (ptr_s[0] == 0 && (*ptr_g & 0x80)) ptr_s[0] = c;
+ if (ptr_s[1] == 0 && (*ptr_g & 0x40)) ptr_s[1] = c;
+ if (ptr_s[2] == 0 && (*ptr_g & 0x20)) ptr_s[2] = c;
+ if (ptr_s[3] == 0 && (*ptr_g & 0x10)) ptr_s[3] = c;
+ if (ptr_s[4] == 0 && (*ptr_g & 0x08)) ptr_s[4] = c;
+ if (ptr_s[5] == 0 && (*ptr_g & 0x04)) ptr_s[5] = c;
+ if (ptr_s[6] == 0 && (*ptr_g & 0x02)) ptr_s[6] = c;
+ if (ptr_s[7] == 0 && (*ptr_g & 0x01)) ptr_s[7] = c;
+ }
+ return sbuf + 32;
+}
+
+
+static uint8 *v99x8_refresh_sprite2(uint8 y)
+{
+ v99x8_sprite_t *ptr_a;
+ int n, size;
+ int i;
+ uint8 a, c, *ptr_g, *ptr_c, *ptr_s, *tbl_sp;
+ bool cf;
+
+ if (v99x8.ctrl[8] & 0x02)
+ return blackbuf;
+
+ tbl_sp = v99x8.vram + ((int)v99x8.ctrl[6] << 11);
+
+ memset(sbuf + 32, 0, 256);
+
+ size = (v99x8.ctrl[1] & 0x02) ? 16 : 8;
+/* if (SpritesMAG)
+ h *= 2; */
+
+ n = 0;
+ cf = FALSE;
+
+ ptr_c = v99x8.vram + ((int)v99x8.ctrl[11] << 15)
+ + ((int)(v99x8.ctrl[5] & 0xf8) << 7);
+ ptr_a = (v99x8_sprite_t *)(ptr_c + 0x200);
+
+ for (i = 0 ;; ++i, ++ptr_a, ptr_c += 16)
+ {
+ if (i >= 32 || n >= 8 || ptr_a->y == 216)
+ break;
+
+ a = (uint8)(ptr_a->y - v99x8.ctrl[23]); /* a>256-h? a-=256 */
+ if (a >= y || a + size < y)
+ continue;
+
+ ++n;
+ a = y - (a + 1);
+
+ c = ptr_c[a];
+ ptr_s = sbuf + ptr_a->x + ((c & 0x80) ? 0 : 32);
+ ptr_g = tbl_sp + a
+ + (((v99x8.ctrl[1] & 0x02) ? ptr_a->n & 0xfc : ptr_a->n) << 3);
+
+ if ((c & 0x40) == 0)
+ {
+ cf = TRUE;
+ c &= 0x0f;
+
+ if (ptr_s[0] == 0 && (*ptr_g & 0x80)) ptr_s[0] = c;
+ if (ptr_s[1] == 0 && (*ptr_g & 0x40)) ptr_s[1] = c;
+ if (ptr_s[2] == 0 && (*ptr_g & 0x20)) ptr_s[2] = c;
+ if (ptr_s[3] == 0 && (*ptr_g & 0x10)) ptr_s[3] = c;
+ if (ptr_s[4] == 0 && (*ptr_g & 0x08)) ptr_s[4] = c;
+ if (ptr_s[5] == 0 && (*ptr_g & 0x04)) ptr_s[5] = c;
+ if (ptr_s[6] == 0 && (*ptr_g & 0x02)) ptr_s[6] = c;
+ if (ptr_s[7] == 0 && (*ptr_g & 0x01)) ptr_s[7] = c;
+
+ if (!(v99x8.ctrl[1] & 0x02))
+ continue;
+
+ ptr_s += 8; ptr_g += 16;
+ if (ptr_s[0] == 0 && (*ptr_g & 0x80)) ptr_s[0] = c;
+ if (ptr_s[1] == 0 && (*ptr_g & 0x40)) ptr_s[1] = c;
+ if (ptr_s[2] == 0 && (*ptr_g & 0x20)) ptr_s[2] = c;
+ if (ptr_s[3] == 0 && (*ptr_g & 0x10)) ptr_s[3] = c;
+ if (ptr_s[4] == 0 && (*ptr_g & 0x08)) ptr_s[4] = c;
+ if (ptr_s[5] == 0 && (*ptr_g & 0x04)) ptr_s[5] = c;
+ if (ptr_s[6] == 0 && (*ptr_g & 0x02)) ptr_s[6] = c;
+ if (ptr_s[7] == 0 && (*ptr_g & 0x01)) ptr_s[7] = c;
+ } else
+ {
+ if (!cf)
+ continue;
+
+ c &= 0x0f;
+ if (*ptr_g & 0x80) ptr_s[0] |= c;
+ if (*ptr_g & 0x40) ptr_s[1] |= c;
+ if (*ptr_g & 0x20) ptr_s[2] |= c;
+ if (*ptr_g & 0x10) ptr_s[3] |= c;
+ if (*ptr_g & 0x08) ptr_s[4] |= c;
+ if (*ptr_g & 0x04) ptr_s[5] |= c;
+ if (*ptr_g & 0x02) ptr_s[6] |= c;
+ if (*ptr_g & 0x01) ptr_s[7] |= c;
+
+ if (!(v99x8.ctrl[1] & 0x02))
+ continue;
+
+ ptr_s += 8; ptr_g += 16;
+ if (*ptr_g & 0x80) ptr_s[0] |= c;
+ if (*ptr_g & 0x40) ptr_s[1] |= c;
+ if (*ptr_g & 0x20) ptr_s[2] |= c;
+ if (*ptr_g & 0x10) ptr_s[3] |= c;
+ if (*ptr_g & 0x08) ptr_s[4] |= c;
+ if (*ptr_g & 0x04) ptr_s[5] |= c;
+ if (*ptr_g & 0x02) ptr_s[6] |= c;
+ if (*ptr_g & 0x01) ptr_s[7] |= c;
+ }
+ }
+ return sbuf + 32;
+}
+
+
+
+void V99X8::v99x8_refresh_sc0(int y, int h)
+{
+ uint8 *pbuf;
+ uint32 fg, bg;
+ int pp;
+
+
+ if (f_scr)
+ {
+ v99x8.tbl_pg = v99x8.vram + (((int)v99x8.ctrl[4] & 0x3f) << 11);
+ v99x8.tbl_pn = v99x8.vram + (((int)v99x8.ctrl[2] & 0x7f) << 10);
+ f_scr = FALSE;
+ }
+
+ pbuf = v99x8_refresh_start(8, 240, h);
+ pp = md_video_pitch() - md_video_pixbytes(240);
+
+ fg = pal[v99x8.col_fg].color;
+ bg = pal[v99x8.col_bg].color;
+
+ while(h-- > 0)
+ {
+ int i;
+ uint8 *T,*G;
+
+ T = v99x8.tbl_pn + (y >> 3) * 40;
+ G = v99x8.tbl_pg + (y & 0x07);
+ ++y;
+
+ for (i = 0; i < 40; ++i)
+ {
+ uint8 a;
+
+ a = G[(int)*T++ << 3];
+ if (v99x8.f_zoom)
+ {
+ pixel_put(pbuf, 0, (a & 0x80)? fg : bg);
+ pixel_put(pbuf, 1, (a & 0x80)? fg : bg);
+ pixel_put(pbuf, 2, (a & 0x40)? fg : bg);
+ pixel_put(pbuf, 3, (a & 0x40)? fg : bg);
+ pixel_put(pbuf, 4, (a & 0x20)? fg : bg);
+ pixel_put(pbuf, 5, (a & 0x20)? fg : bg);
+ pixel_put(pbuf, 6, (a & 0x10)? fg : bg);
+ pixel_put(pbuf, 7, (a & 0x10)? fg : bg);
+ pixel_put(pbuf, 8, (a & 0x08)? fg : bg);
+ pixel_put(pbuf, 9, (a & 0x08)? fg : bg);
+ pixel_put(pbuf, 10, (a & 0x04)? fg : bg);
+ pixel_put(pbuf, 11, (a & 0x04)? fg : bg);
+ pbuf += md_video_pixbytes(12);
+ } else
+ {
+ pixel_put(pbuf, 0, (a & 0x80)? fg : bg);
+ pixel_put(pbuf, 1, (a & 0x40)? fg : bg);
+ pixel_put(pbuf, 2, (a & 0x20)? fg : bg);
+ pixel_put(pbuf, 3, (a & 0x10)? fg : bg);
+ pixel_put(pbuf, 4, (a & 0x08)? fg : bg);
+ pixel_put(pbuf, 5, (a & 0x04)? fg : bg);
+ pbuf += md_video_pixbytes(6);
+ }
+ }
+ pbuf += pp;
+ }
+
+ v99x8_refresh_stop();
+}
+
+void V99X8::v99x8_refresh_sc1(int y, int h)
+{
+ uint8 *T,*G;
+ int i, n;
+ int pp;
+ uint8 *pbuf, *sp;
+
+ if (f_scr)
+ {
+ v99x8.tbl_pg = v99x8.vram + (((int)v99x8.ctrl[4] & 0x3f) << 11);
+ v99x8.tbl_pn = v99x8.vram + (((int)v99x8.ctrl[2] & 0x7f) << 10);
+ v99x8.tbl_cl = v99x8.vram + (((int)v99x8.ctrl[10] & 0x07) << 14)
+ + ((int)v99x8.ctrl[3] << 6);
+ f_scr = FALSE;
+ }
+
+ pbuf = v99x8_refresh_start(0, 256, h);
+ pp = md_video_pitch() - md_video_pixbytes(256);
+
+ while (h-- > 0)
+ {
+ n = v99x8.ctrl[23] + y;
+ G = v99x8.tbl_pg + (n & 0x07);
+ T = v99x8.tbl_pn + ((n & 0xF8) << 2);
+ sp = v99x8_refresh_sprite1(y++);
+
+ for(i = 0; i < 32; ++i)
+ {
+ uint8 a;
+ uint8 n;
+ uint32 fg, bg;
+
+ n = v99x8.tbl_cl[*T >> 3];
+ fg = pal[n >> 4].color;
+ bg = pal[n & 0x0f].color;
+
+ a = G[(int)*T++ << 3];
+ if (v99x8.f_zoom)
+ {
+ pixel_put(pbuf, 0, sp[0] ? pal[sp[0]].color : (a & 0x80) ? fg : bg);
+ pixel_put(pbuf, 1, sp[0] ? pal[sp[0]].color : (a & 0x80) ? fg : bg);
+ pixel_put(pbuf, 2, sp[1] ? pal[sp[1]].color : (a & 0x40) ? fg : bg);
+ pixel_put(pbuf, 3, sp[1] ? pal[sp[1]].color : (a & 0x40) ? fg : bg);
+ pixel_put(pbuf, 4, sp[2] ? pal[sp[2]].color : (a & 0x20) ? fg : bg);
+ pixel_put(pbuf, 5, sp[2] ? pal[sp[2]].color : (a & 0x20) ? fg : bg);
+ pixel_put(pbuf, 6, sp[3] ? pal[sp[3]].color : (a & 0x10) ? fg : bg);
+ pixel_put(pbuf, 7, sp[3] ? pal[sp[3]].color : (a & 0x10) ? fg : bg);
+ pixel_put(pbuf, 8, sp[4] ? pal[sp[4]].color : (a & 0x08) ? fg : bg);
+ pixel_put(pbuf, 9, sp[4] ? pal[sp[4]].color : (a & 0x08) ? fg : bg);
+ pixel_put(pbuf, 10, sp[5] ? pal[sp[5]].color : (a & 0x04) ? fg : bg);
+ pixel_put(pbuf, 11, sp[5] ? pal[sp[5]].color : (a & 0x04) ? fg : bg);
+ pixel_put(pbuf, 12, sp[6] ? pal[sp[6]].color : (a & 0x02) ? fg : bg);
+ pixel_put(pbuf, 13, sp[6] ? pal[sp[6]].color : (a & 0x02) ? fg : bg);
+ pixel_put(pbuf, 14, sp[7] ? pal[sp[7]].color : (a & 0x01) ? fg : bg);
+ pixel_put(pbuf, 15, sp[7] ? pal[sp[7]].color : (a & 0x01) ? fg : bg);
+ pbuf += md_video_pixbytes(16);
+ sp += 8;
+ } else
+ {
+ pixel_put(pbuf, 0, sp[0] ? pal[sp[0]].color : (a & 0x80) ? fg : bg);
+ pixel_put(pbuf, 1, sp[1] ? pal[sp[1]].color : (a & 0x40) ? fg : bg);
+ pixel_put(pbuf, 2, sp[2] ? pal[sp[2]].color : (a & 0x20) ? fg : bg);
+ pixel_put(pbuf, 3, sp[3] ? pal[sp[3]].color : (a & 0x10) ? fg : bg);
+ pixel_put(pbuf, 4, sp[4] ? pal[sp[4]].color : (a & 0x08) ? fg : bg);
+ pixel_put(pbuf, 5, sp[5] ? pal[sp[5]].color : (a & 0x04) ? fg : bg);
+ pixel_put(pbuf, 6, sp[6] ? pal[sp[6]].color : (a & 0x02) ? fg : bg);
+ pixel_put(pbuf, 7, sp[7] ? pal[sp[7]].color : (a & 0x01) ? fg : bg);
+
+ pbuf += md_video_pixbytes(8);
+ sp += 8;
+ }
+ }
+ pbuf += pp;
+ }
+
+ v99x8_refresh_stop();
+}
+
+void V99X8::v99x8_refresh_sc4(int y, int h)
+{
+ int i;
+ int n;
+ uint8 *T, *PGT, *CLT;
+ int pp;
+ uint8 *pbuf, *sp;
+
+ if (f_scr)
+ {
+ v99x8.tbl_pg = v99x8.vram + (((int)v99x8.ctrl[4] & 0x3c) << 11);
+ v99x8.tbl_pn = v99x8.vram + (((int)v99x8.ctrl[2] & 0x7f) << 10);
+ v99x8.tbl_cl = v99x8.vram + (((int)v99x8.ctrl[10] & 0x07) << 14)
+ + (((int)v99x8.ctrl[3] & 0x80) << 6);
+ f_scr = FALSE;
+ }
+
+
+ pbuf = v99x8_refresh_start(0, 256, h);
+ pp = md_video_pitch() - md_video_pixbytes(256);
+
+ while (h-- > 0)
+ {
+ n = v99x8.ctrl[23] + y;
+ T = v99x8.tbl_pn + ((n & 0xf8) << 2);
+
+ n = ((n & 0xc0) << 5) + (n & 0x07);
+ PGT = v99x8.tbl_pg + n;
+ CLT = v99x8.tbl_cl + n;
+
+ if (v99x8.scr == V99X8_SCREEN_2)
+ sp = v99x8_refresh_sprite1(y++);
+ else
+ sp = v99x8_refresh_sprite2(y++);
+
+ for (i = 0; i < 32; ++i)
+ {
+ uint8 a;
+ uint8 n;
+ uint32 fg, bg;
+
+ n = CLT[*T << 3];
+ fg = pal[n >> 4].color;
+ bg = pal[n & 0x0f].color;
+
+ a = PGT[(int)*T++ << 3];
+
+ if (v99x8.f_zoom)
+ {
+ pixel_put(pbuf, 0, sp[0] ? pal[sp[0]].color : (a & 0x80) ? fg : bg);
+ pixel_put(pbuf, 1, sp[0] ? pal[sp[0]].color : (a & 0x80) ? fg : bg);
+ pixel_put(pbuf, 2, sp[1] ? pal[sp[1]].color : (a & 0x40) ? fg : bg);
+ pixel_put(pbuf, 3, sp[1] ? pal[sp[1]].color : (a & 0x40) ? fg : bg);
+ pixel_put(pbuf, 4, sp[2] ? pal[sp[2]].color : (a & 0x20) ? fg : bg);
+ pixel_put(pbuf, 5, sp[2] ? pal[sp[2]].color : (a & 0x20) ? fg : bg);
+ pixel_put(pbuf, 6, sp[3] ? pal[sp[3]].color : (a & 0x10) ? fg : bg);
+ pixel_put(pbuf, 7, sp[3] ? pal[sp[3]].color : (a & 0x10) ? fg : bg);
+ pixel_put(pbuf, 8, sp[4] ? pal[sp[4]].color : (a & 0x08) ? fg : bg);
+ pixel_put(pbuf, 9, sp[4] ? pal[sp[4]].color : (a & 0x08) ? fg : bg);
+ pixel_put(pbuf, 10, sp[5] ? pal[sp[5]].color : (a & 0x04) ? fg : bg);
+ pixel_put(pbuf, 11, sp[5] ? pal[sp[5]].color : (a & 0x04) ? fg : bg);
+ pixel_put(pbuf, 12, sp[6] ? pal[sp[6]].color : (a & 0x02) ? fg : bg);
+ pixel_put(pbuf, 13, sp[6] ? pal[sp[6]].color : (a & 0x02) ? fg : bg);
+ pixel_put(pbuf, 14, sp[7] ? pal[sp[7]].color : (a & 0x01) ? fg : bg);
+ pixel_put(pbuf, 15, sp[7] ? pal[sp[7]].color : (a & 0x01) ? fg : bg);
+ pbuf += md_video_pixbytes(16); sp += 8;
+ } else
+ {
+ pixel_put(pbuf, 0, sp[0] ? pal[sp[0]].color : (a & 0x80)? fg : bg);
+ pixel_put(pbuf, 1, sp[1] ? pal[sp[1]].color : (a & 0x40)? fg : bg);
+ pixel_put(pbuf, 2, sp[2] ? pal[sp[2]].color : (a & 0x20)? fg : bg);
+ pixel_put(pbuf, 3, sp[3] ? pal[sp[3]].color : (a & 0x10)? fg : bg);
+ pixel_put(pbuf, 4, sp[4] ? pal[sp[4]].color : (a & 0x08)? fg : bg);
+ pixel_put(pbuf, 5, sp[5] ? pal[sp[5]].color : (a & 0x04)? fg : bg);
+ pixel_put(pbuf, 6, sp[6] ? pal[sp[6]].color : (a & 0x02)? fg : bg);
+ pixel_put(pbuf, 7, sp[7] ? pal[sp[7]].color : (a & 0x01)? fg : bg);
+
+ pbuf += md_video_pixbytes(8); sp += 8;
+ }
+ }
+ pbuf += pp;
+ }
+
+ v99x8_refresh_stop();
+}
+
+void V99X8::v99x8_refresh_sc5(int y, int h)
+{
+ int i;
+ uint8 *T;
+ int pp;
+ uint8 *pbuf, *sp;
+
+ if (f_scr)
+ {
+ v99x8.tbl_pn = v99x8.vram + (((int)v99x8.ctrl[2] & 0x60) << 10);
+ f_scr = FALSE;
+ }
+
+ pbuf = v99x8_refresh_start(0, 256, h);
+ pp = md_video_pitch() - md_video_pixbytes(256);
+
+ T = v99x8.tbl_pn + (((y + v99x8.ctrl[23]) & 0xff) << 7);
+
+ while(h-- > 0)
+ {
+ sp = v99x8_refresh_sprite2(y++);
+ for (i = 0; i < 32; ++i)
+ {
+ if (v99x8.f_zoom)
+ {
+ pixel_put(pbuf, 0, pal[sp[0] ? sp[0] : T[0] >> 4].color);
+ pixel_put(pbuf, 1, pal[sp[0] ? sp[0] : T[0] >> 4].color);
+ pixel_put(pbuf, 2, pal[sp[1] ? sp[1] : T[0] & 0x0f].color);
+ pixel_put(pbuf, 3, pal[sp[1] ? sp[1] : T[0] & 0x0f].color);
+ pixel_put(pbuf, 4, pal[sp[2] ? sp[2] : T[1] >> 4].color);
+ pixel_put(pbuf, 5, pal[sp[2] ? sp[2] : T[1] >> 4].color);
+ pixel_put(pbuf, 6, pal[sp[3] ? sp[3] : T[1] & 0x0f].color);
+ pixel_put(pbuf, 7, pal[sp[3] ? sp[3] : T[1] & 0x0f].color);
+ pixel_put(pbuf, 8, pal[sp[4] ? sp[4] : T[2] >> 4].color);
+ pixel_put(pbuf, 9, pal[sp[4] ? sp[4] : T[2] >> 4].color);
+ pixel_put(pbuf, 10, pal[sp[5] ? sp[5] : T[2] & 0x0f].color);
+ pixel_put(pbuf, 11, pal[sp[5] ? sp[5] : T[2] & 0x0f].color);
+ pixel_put(pbuf, 12, pal[sp[6] ? sp[6] : T[3] >> 4].color);
+ pixel_put(pbuf, 13, pal[sp[6] ? sp[6] : T[3] >> 4].color);
+ pixel_put(pbuf, 14, pal[sp[7] ? sp[7] : T[3] & 0x0f].color);
+ pixel_put(pbuf, 15, pal[sp[7] ? sp[7] : T[3] & 0x0f].color);
+
+ pbuf += md_video_pixbytes(16); T += 4; sp += 8;
+ } else {
+ pixel_put(pbuf, 0, pal[sp[0] ? sp[0] : T[0] >> 4].color);
+ pixel_put(pbuf, 1, pal[sp[1] ? sp[1] : T[0] & 0x0f].color);
+ pixel_put(pbuf, 2, pal[sp[2] ? sp[2] : T[1] >> 4].color);
+ pixel_put(pbuf, 3, pal[sp[3] ? sp[3] : T[1] & 0x0f].color);
+ pixel_put(pbuf, 4, pal[sp[4] ? sp[4] : T[2] >> 4].color);
+ pixel_put(pbuf, 5, pal[sp[5] ? sp[5] : T[2] & 0x0f].color);
+ pixel_put(pbuf, 6, pal[sp[6] ? sp[6] : T[3] >> 4].color);
+ pixel_put(pbuf, 7, pal[sp[7] ? sp[7] : T[3] & 0x0f].color);
+
+ pbuf += md_video_pixbytes(8); T += 4; sp += 8;
+ }
+ }
+ pbuf += pp;
+ }
+
+ v99x8_refresh_stop();
+}
+
+void V99X8::v99x8_refresh_sc6(int y, int h)
+{
+ int i;
+ uint8 *T;
+ int pp;
+ uint8 *pbuf, *sp;
+
+ if (f_scr)
+ {
+ v99x8.tbl_pn = v99x8.vram + (((int)v99x8.ctrl[2] & 0x60) << 10);
+ f_scr = FALSE;
+ }
+
+
+ pbuf = v99x8_refresh_start(0, 256, h);
+ pp = md_video_pitch() - md_video_pixbytes(256);
+
+ T = v99x8.tbl_pn + (((y + v99x8.ctrl[23]) & 0xff) << 7);
+
+ while(h-- > 0)
+ {
+ sp = v99x8_refresh_sprite2(y++);
+ for(i = 0; i < 32; ++i)
+ {
+ if (v99x8.f_zoom)
+ {
+ pixel_put(pbuf, 0, pal[sp[0] ? sp[0] : T[0] >> 6].color);
+ pixel_put(pbuf, 1, pal[sp[0] ? sp[0] : (T[0] >> 4) & 3].color);
+ pixel_put(pbuf, 2, pal[sp[1] ? sp[1] : (T[0] >> 2) & 3].color);
+ pixel_put(pbuf, 3, pal[sp[1] ? sp[1] : T[0] & 3].color);
+ pixel_put(pbuf, 4, pal[sp[2] ? sp[2] : T[1] >> 6].color);
+ pixel_put(pbuf, 5, pal[sp[2] ? sp[2] : (T[1] >> 4) & 3].color);
+ pixel_put(pbuf, 6, pal[sp[3] ? sp[3] : (T[1] >> 2) & 3].color);
+ pixel_put(pbuf, 7, pal[sp[3] ? sp[3] : T[1] & 3].color);
+ pixel_put(pbuf, 8, pal[sp[4] ? sp[4] : T[2] >> 6].color);
+ pixel_put(pbuf, 9, pal[sp[4] ? sp[4] : (T[2] >> 4) & 3].color);
+ pixel_put(pbuf, 10, pal[sp[5] ? sp[5] : (T[2] >> 2) & 3].color);
+ pixel_put(pbuf, 11, pal[sp[5] ? sp[5] : T[2] & 3].color);
+ pixel_put(pbuf, 12, pal[sp[6] ? sp[6] : T[3] >> 6].color);
+ pixel_put(pbuf, 13, pal[sp[6] ? sp[6] : (T[3] >> 4) & 3].color);
+ pixel_put(pbuf, 14, pal[sp[7] ? sp[7] : (T[3] >> 2) & 3].color);
+ pixel_put(pbuf, 15, pal[sp[7] ? sp[7] : T[3] & 3].color);
+ pbuf += md_video_pixbytes(16); T += 4; sp += 8;
+ } else
+ {
+ pixel_put(pbuf, 0, sp[0] ? pal[sp[0]].color : pal_m[(T[0] >> 6) | (T[0] & 0x30)]);
+ pixel_put(pbuf, 1, sp[1] ? pal[sp[1]].color : pal_m[((T[0] & 0x0c) << 2) | (T[0] & 0x03)]);
+ pixel_put(pbuf, 2, sp[2] ? pal[sp[2]].color : pal_m[(T[1] >> 6) | (T[1] & 0x30)]);
+ pixel_put(pbuf, 3, sp[3] ? pal[sp[3]].color : pal_m[((T[1] & 0x0c) << 2) | (T[1] & 0x03)]);
+ pixel_put(pbuf, 4, sp[4] ? pal[sp[4]].color : pal_m[(T[2] >> 6) | (T[2] & 0x30)]);
+ pixel_put(pbuf, 5, sp[5] ? pal[sp[5]].color : pal_m[((T[2] & 0x0c) << 2) | (T[2] & 0x03)]);
+ pixel_put(pbuf, 6, sp[6] ? pal[sp[6]].color : pal_m[(T[3] >> 6) | (T[3] & 0x30)]);
+ pixel_put(pbuf, 7, sp[7] ? pal[sp[7]].color : pal_m[((T[3] & 0x0c) << 2) | (T[3] & 0x03)]);
+ pbuf += md_video_pixbytes(8); T += 4; sp += 8;
+ }
+ }
+ pbuf += pp;
+ }
+
+ v99x8_refresh_stop();
+}
+
+void V99X8::v99x8_refresh_sc7(int y, int h)
+{
+ uint8 *pbuf, *sp;
+ uint8 *T;
+ int pp;
+ int i;
+
+ if (f_scr)
+ {
+ v99x8.tbl_pn = v99x8.vram + (((int)v99x8.ctrl[2] & 0x20) << 11);
+ f_scr = FALSE;
+ }
+
+ pbuf = v99x8_refresh_start(0, 256, h);
+ pp = md_video_pitch() - md_video_pixbytes(256);
+
+/* printf("%d/%d %d %d\n", y, v99x8.ctrl[23], (y+v99x8.ctrl[23])&0xff, v99x8.ctrl[19]+1); */
+ T = v99x8.tbl_pn + (((y + v99x8.ctrl[23]) & 0xff) << 8);
+
+ while(h-- > 0)
+ {
+ sp = v99x8_refresh_sprite2(y);
+ {
+ for (i = 0; i < 32; ++i)
+ {
+ if (v99x8.f_zoom)
+ {
+ pixel_put(pbuf, 0, pal[sp[0] ? sp[0] : T[0] >> 4].color);
+ pixel_put(pbuf, 1, pal[sp[0] ? sp[0] : T[0] & 0x0f].color);
+ pixel_put(pbuf, 2, pal[sp[1] ? sp[1] : T[1] >> 4].color);
+ pixel_put(pbuf, 3, pal[sp[1] ? sp[1] : T[1] & 0x0f].color);
+ pixel_put(pbuf, 4, pal[sp[2] ? sp[2] : T[2] >> 4].color);
+ pixel_put(pbuf, 5, pal[sp[2] ? sp[2] : T[2] & 0x0f].color);
+ pixel_put(pbuf, 6, pal[sp[3] ? sp[3] : T[3] >> 4].color);
+ pixel_put(pbuf, 7, pal[sp[3] ? sp[3] : T[3] & 0x0f].color);
+ pixel_put(pbuf, 8, pal[sp[4] ? sp[4] : T[4] >> 4].color);
+ pixel_put(pbuf, 9, pal[sp[4] ? sp[4] : T[4] & 0x0f].color);
+ pixel_put(pbuf, 10, pal[sp[5] ? sp[5] : T[5] >> 4].color);
+ pixel_put(pbuf, 11, pal[sp[5] ? sp[5] : T[5] & 0x0f].color);
+ pixel_put(pbuf, 12, pal[sp[6] ? sp[6] : T[6] >> 4].color);
+ pixel_put(pbuf, 13, pal[sp[6] ? sp[6] : T[6] & 0x0f].color);
+ pixel_put(pbuf, 14, pal[sp[7] ? sp[7] : T[7] >> 4].color);
+ pixel_put(pbuf, 15, pal[sp[7] ? sp[7] : T[7] & 0x0f].color);
+ pbuf += md_video_pixbytes(16); T += 8; sp += 8;
+ } else
+ {
+ pixel_put(pbuf,0, sp[0]? pal[sp[0]].color : pal_m[T[0]]);
+ pixel_put(pbuf,1, sp[1]? pal[sp[1]].color : pal_m[T[1]]);
+ pixel_put(pbuf,2, sp[2]? pal[sp[2]].color : pal_m[T[2]]);
+ pixel_put(pbuf,3, sp[3]? pal[sp[3]].color : pal_m[T[3]]);
+ pixel_put(pbuf,4, sp[4]? pal[sp[4]].color : pal_m[T[4]]);
+ pixel_put(pbuf,5, sp[5]? pal[sp[5]].color : pal_m[T[5]]);
+ pixel_put(pbuf,6, sp[6]? pal[sp[6]].color : pal_m[T[6]]);
+ pixel_put(pbuf,7, sp[7]? pal[sp[7]].color : pal_m[T[7]]);
+
+ pbuf += md_video_pixbytes(8); T += 8; sp += 8;
+ }
+ }
+ }
+ ++y;
+ pbuf += pp;
+ }
+
+ v99x8_refresh_stop();
+}
+
+void V99X8::v99x8_refresh_sc8(int y, int h)
+{
+ uint8 *pbuf, *sp;
+ uint8 *T;
+ int pp;
+ int i;
+ uint8 sc8spr[16] =
+ {
+ 0x00,0x02,0x10,0x12,0x80,0x82,0x90,0x92,
+ 0x49,0x4B,0x59,0x5B,0xC9,0xCB,0xD9,0xDB
+ };
+
+ if (f_scr)
+ {
+ v99x8.tbl_pn = v99x8.vram + (((int)v99x8.ctrl[2] & 0x20) << 11);
+ f_scr = FALSE;
+ }
+
+ pbuf = v99x8_refresh_start(0, 256, h);
+ pp = md_video_pitch() - md_video_pixbytes(256);
+
+ T = v99x8.tbl_pn + (((y + v99x8.ctrl[23]) & 0xff) << 8);
+
+ while(h-- > 0)
+ {
+ sp = v99x8_refresh_sprite2(y);
+ {
+ for (i = 0; i < 32; ++i)
+ {
+ if (v99x8.f_zoom)
+ {
+ pixel_put(pbuf, 0, pal_8[sp[0] ? sc8spr[sp[0]] : T[0]]);
+ pixel_put(pbuf, 1, pal_8[sp[0] ? sc8spr[sp[0]] : T[0]]);
+ pixel_put(pbuf, 2, pal_8[sp[1] ? sc8spr[sp[1]] : T[1]]);
+ pixel_put(pbuf, 3, pal_8[sp[1] ? sc8spr[sp[1]] : T[1]]);
+ pixel_put(pbuf, 4, pal_8[sp[2] ? sc8spr[sp[2]] : T[2]]);
+ pixel_put(pbuf, 5, pal_8[sp[2] ? sc8spr[sp[2]] : T[2]]);
+ pixel_put(pbuf, 6, pal_8[sp[3] ? sc8spr[sp[3]] : T[3]]);
+ pixel_put(pbuf, 7, pal_8[sp[3] ? sc8spr[sp[3]] : T[3]]);
+ pixel_put(pbuf, 8, pal_8[sp[4] ? sc8spr[sp[4]] : T[4]]);
+ pixel_put(pbuf, 9, pal_8[sp[4] ? sc8spr[sp[4]] : T[4]]);
+ pixel_put(pbuf, 10, pal_8[sp[5] ? sc8spr[sp[5]] : T[5]]);
+ pixel_put(pbuf, 11, pal_8[sp[5] ? sc8spr[sp[5]] : T[5]]);
+ pixel_put(pbuf, 12, pal_8[sp[6] ? sc8spr[sp[6]] : T[6]]);
+ pixel_put(pbuf, 13, pal_8[sp[6] ? sc8spr[sp[6]] : T[6]]);
+ pixel_put(pbuf, 14, pal_8[sp[7] ? sc8spr[sp[7]] : T[7]]);
+ pixel_put(pbuf, 15, pal_8[sp[7] ? sc8spr[sp[7]] : T[7]]);
+ pbuf += md_video_pixbytes(16); T += 8; sp += 8;
+ } else
+ {
+ pixel_put(pbuf,0, pal_8[sp[0] ? sc8spr[sp[0]] : T[0]]);
+ pixel_put(pbuf,1, pal_8[sp[1] ? sc8spr[sp[1]] : T[1]]);
+ pixel_put(pbuf,2, pal_8[sp[2] ? sc8spr[sp[2]] : T[2]]);
+ pixel_put(pbuf,3, pal_8[sp[3] ? sc8spr[sp[3]] : T[3]]);
+ pixel_put(pbuf,4, pal_8[sp[4] ? sc8spr[sp[4]] : T[4]]);
+ pixel_put(pbuf,5, pal_8[sp[5] ? sc8spr[sp[5]] : T[5]]);
+ pixel_put(pbuf,6, pal_8[sp[6] ? sc8spr[sp[6]] : T[6]]);
+ pixel_put(pbuf,7, pal_8[sp[7] ? sc8spr[sp[7]] : T[7]]);
+ pbuf += md_video_pixbytes(8); T += 8; sp += 8;
+ }
+ }
+ }
+ ++y;
+ pbuf += pp;
+ }
+
+ v99x8_refresh_stop();
+}
+
+static __inline__ uint32 v99x8_refresh_MapYJK(int n, int j, int k, int jk)
+{
+ return md_maprgb15(tbl_yjk_rg[n + j], tbl_yjk_rg[n + k], tbl_yjk_b [n + jk]);
+}
+
+
+void V99X8::v99x8_refresh_scc(int y, int h)
+{
+ uint8 *pbuf, *sp;
+ uint8 *T;
+ int pp;
+ int i;
+ uint8 sc8spr[16] =
+ {
+ 0x00, 0x02, 0x10, 0x12, 0x80, 0x82, 0x90, 0x92,
+ 0x49, 0x4B, 0x59, 0x5B, 0xC9, 0xCB, 0xD9, 0xDB
+ };
+
+ if (f_scr)
+ {
+ v99x8.tbl_pn = v99x8.vram + (((int)v99x8.ctrl[2] & 0x20) << 11);
+ f_scr = FALSE;
+ }
+
+ pbuf = v99x8_refresh_start(0, 256, h);
+ pp = md_video_pitch() - md_video_pixbytes(256);
+
+ T = v99x8.tbl_pn + (((y + v99x8.ctrl[23]) & 0xff) << 8);
+
+ while(h-- > 0)
+ {
+ sp = v99x8_refresh_sprite2(y);
+ for (i = 0; i < 64; ++i)
+ {
+ int yjk_k, yjk_j, yjk_jk;
+
+ yjk_k = (((T[0] & 7) | ((T[1] & 7) << 3)) + 32) & 0x3f;
+ yjk_j = (((T[2] & 7) | ((T[3] & 7) << 3)) + 32) & 0x3f;
+
+ yjk_jk = (yjk_j << 11) + (yjk_k << 5);
+
+ pixel_put(pbuf, 0, sp[0] ? pal_8[sc8spr[sp[0]]] : v99x8_refresh_MapYJK(T[0] >> 3, yjk_j, yjk_k, yjk_jk));
+ pixel_put(pbuf, 1, sp[1] ? pal_8[sc8spr[sp[1]]] : v99x8_refresh_MapYJK(T[1] >> 3, yjk_j, yjk_k, yjk_jk));
+ pixel_put(pbuf, 2, sp[2] ? pal_8[sc8spr[sp[2]]] : v99x8_refresh_MapYJK(T[2] >> 3, yjk_j, yjk_k, yjk_jk));
+ pixel_put(pbuf, 3, sp[3] ? pal_8[sc8spr[sp[3]]] : v99x8_refresh_MapYJK(T[3] >> 3, yjk_j, yjk_k, yjk_jk));
+
+ pbuf += md_video_pixbytes(4); T += 4; sp += 4;
+ }
+ ++y;
+ pbuf += pp;
+ }
+
+ v99x8_refresh_stop();
+}
+
+void V99X8::v99x8_refresh_sc2(int y, int h) {;}
+void V99X8::v99x8_refresh_sc3(int y, int h) {;}
+void V99X8::v99x8_refresh_sca(int y, int h) {;} /* sc10/sc11 */
+void V99X8::v99x8_refresh_scx(int y, int h)
+{
+ uint8 *pbuf;
+ int pp;
+ uint32 fg, bg, m[4];
+
+ if (f_scr)
+ {
+ v99x8.tbl_pg = v99x8.vram + (((int)v99x8.ctrl[4] & 0x3f) << 11);
+ v99x8.tbl_pn = v99x8.vram + (((int)v99x8.ctrl[2] & 0x7c) << 10);
+ v99x8.tbl_cl = v99x8.vram + (((int)v99x8.ctrl[10] & 0x07) << 14)
+ + (((int)v99x8.ctrl[3] & 0xf8) << 6);
+ f_scr = FALSE;
+ }
+
+ pbuf = v99x8_refresh_start(8, 240, h);
+ pp = md_video_pitch() - md_video_pixbytes(240);
+
+ fg = pal[v99x8.col_fg].color;
+ bg = pal[v99x8.col_bg].color;
+ m[0] = pal_m[(v99x8.col_bg << 4) | v99x8.col_bg];
+ m[1] = pal_m[(v99x8.col_bg << 4) | v99x8.col_fg];
+ m[2] = pal_m[(v99x8.col_fg << 4) | v99x8.col_bg];
+ m[3] = pal_m[(v99x8.col_fg << 4) | v99x8.col_fg];
+
+ while(h-- > 0)
+ {
+ int i;
+ uint8 *T,*G;
+
+ T = v99x8.tbl_pn + (y >> 3) * 80;
+ G = v99x8.tbl_pg + (y & 0x07);
+ ++y;
+
+ for (i = 0; i < 80; ++i)
+ {
+ uint8 a;
+
+ a = G[(int)*T++ << 3];
+ if (v99x8.f_zoom)
+ {
+ pixel_put(pbuf, 0, (a & 0x80) ? fg : bg);
+ pixel_put(pbuf, 1, (a & 0x40) ? fg : bg);
+ pixel_put(pbuf, 2, (a & 0x20) ? fg : bg);
+ pixel_put(pbuf, 3, (a & 0x10) ? fg : bg);
+ pixel_put(pbuf, 4, (a & 0x08) ? fg : bg);
+ pixel_put(pbuf, 5, (a & 0x04) ? fg : bg);
+ pbuf += md_video_pixbytes(6);
+ } else
+ {
+ pixel_put(pbuf, 0, m[a >> 6]);
+ pixel_put(pbuf, 1, m[(a >> 4)& 0x03]);
+ pixel_put(pbuf, 2, m[(a >> 2)& 0x03]);
+
+ pbuf += md_video_pixbytes(3);
+ }
+ }
+ pbuf += pp;
+ }
+
+ v99x8_refresh_stop();
+}
+
+
+
+
+
+/*
+ Skelton for retropc emulator
+
+ Origin : Zodiac
+ Author : umaiboux
+ Date : 2014.12.xx -
+
+ [ V99x8 ]
+*/
+
+void V99X8::initialize()
+{
+ // register event
+ register_vline_event(this);
+
+ v99x8.vram = this->vram;
+ v99x8.f_zoom = TRUE;
+ //v99x8_init();
+}
+
+void V99X8::reset()
+{
+ v99x8_init();
+#ifdef USE_CMDTIME
+ cmdtime_t = 0;
+ cmdtime_m = 0;
+#endif
+ latch1 = -1;
+ latch2 = -1;
+}
+
+void V99X8::write_io8(uint32 addr, uint32 data)
+{
+ data &= 0xFF;
+ switch (addr & 3) {
+ case 0:
+ v99x8_out_0(data);
+ break;
+ case 1:
+ v99x8_out_1(data);
+ break;
+ case 2:
+ v99x8_out_2(data);
+ break;
+ default:
+ v99x8_out_3(data);
+ break;
+ }
+}
+
+uint32 V99X8::read_io8(uint32 addr)
+{
+ uint8 data;
+ switch (addr & 1) {
+ case 0:
+ data = v99x8_in_0();
+ break;
+ default:
+ data = v99x8_in_1();
+ break;
+ }
+ return data;
+}
+
+void V99X8::draw_screen()
+{
+ md_video_update(0, NULL);
+}
+
+void V99X8::event_vline(int v, int clock)
+{
+#ifdef USE_CMDTIME
+ cmdtime_chk();
+#endif
+ hsync(v);
+}
+
+void V99X8::set_intstat(bool val)
+{
+ if(val != intstat) {
+ write_signals(&outputs_irq, val ? 0xffffffff : 0);
+ intstat = val;
+ }
+}
+
+void V99X8::z80_intreq(int a)
+{
+ set_intstat(a != Z80_NOINT);
+}
+
+int V99X8::md_video_pitch(void)
+{
+ return SCREEN_WIDTH*4;
+}
+
+uint8 *V99X8::md_video_lockline(int x, int y, int w, int h)
+{
+ return (uint8*)(screen+y*SCREEN_WIDTH+x);
+#if 0
+ if (SDL_MUSTLOCK(video.screen))
+ SDL_LockSurface(video.screen); /* \96ß\82è\92l\83`\83F\83b\83N\81H */
+
+ return (Uint8 *)video.screen->pixels
+ + video.screen->format->BytesPerPixel * (video.w + x)
+ + video.screen->pitch * (y + video.h);
+#endif
+}
+
+void V99X8::md_video_update(int n, /*md_video_rect_t*/void *rp)
+{
+ if (rp == NULL) {
+ scrntype *dst;
+ int y = 0;
+ int h = SCREEN_HEIGHT;
+ for(;h>0; h-=2) {
+ dst = emu->screen_buffer(y);
+ memcpy(dst, screen+y*SCREEN_WIDTH, SCREEN_WIDTH*4);
+ dst = emu->screen_buffer(y+1);
+ memcpy(dst, screen+y*SCREEN_WIDTH, SCREEN_WIDTH*4);
+ y+=2;
+ }
+ }
+ else {
+ ;
+ }
+}
+
+void V99X8::md_video_fill(int x, int y, int w, int h, uint32 c)
+{
+ int w2;
+ for(;h>0; h--) {
+ scrntype *p = screen+y*SCREEN_WIDTH+x;
+ for(w2=w;w2>0; w2--) {
+ *p++ = c;
+ }
+ y++;
+ }
+}
+
+static void lmcm(void)
+{
+ ;
+}
+
+
+static void stop(void)
+{
+#ifdef USE_CMDTIME
+ cmdtime_t = 0;
+ v99x8.status[2] &= ~0x01;
+#endif
+}
+
+
+static void vcom_lfill_(int dx, int dy, int nx, int clr)
+{
+ if (v99x8.ctrl[45] & 0x04) { /* Direction to left */
+ // Todo?: if (dx-nx<MIN_OF_X) xxx;
+ for (;nx>0;nx--,dx--) vcom_lpset(dx, dy, clr);
+ }
+ else {
+ // Todo?: if (dx+nx>MAX_OF_X) xxx;
+ for (;nx>0;nx--,dx++) vcom_lpset(dx, dy, clr);
+ }
+}
+
+static void lmmv_(void)
+{
+ int clr;
+
+ vcom.sx = 0;
+ vcom.sy = 0;
+ vcom_getdx();
+ vcom_getdy();
+ vcom_getnx();
+ vcom_getny();
+ clr = v99x8.ctrl[44];
+
+ if ((v99x8.ctrl[45] & 0x08) == 0) { /* Direction to down */
+ int ny = vcom.ny, dy = vcom.dy;
+ // Todo?: if (dy+ny>MAX_OF_Y) xxx;
+ for (;ny>0;ny--,dy++) vcom_lfill_(vcom.dx, dy, vcom.nx, clr);
+ vcom_setdy(vcom.dy + vcom.ny);
+ }
+ else {
+ int ny = vcom.ny, dy = vcom.dy;
+ // Todo?: if (dy-ny<MIN_OF_Y) xxx;
+ for (;ny>0;ny--,dy--) vcom_lfill_(vcom.dx, dy, vcom.nx, clr);
+ vcom_setdy(vcom.dy - vcom.ny);
+ }
+
+ //vcom_setdy(vcom.dy + n);
+
+ //if (vcom.ny != abs(n))
+ // vcom_setny(vcom.ny - abs(n));
+ vcom_setny(0);
+}
+
+
+static void vcom_lcopy_(int sx, int sy, int dx, int dy, int nx)
+{
+ if (v99x8.ctrl[45] & 0x04) { /* Direction to left */
+ // Todo?: if (dx-nx<MIN_OF_X) xxx;
+ // Todo?: if (sx-nx<MIN_OF_X) xxx;
+ for (;nx>0;nx--,dx--, sx--) vcom_lpset(dx, dy, vcom_point(sx, sy));
+ }
+ else {
+ // Todo?: if (dx+nx>MAX_OF_X) xxx;
+ // Todo?: if (sx+nx>MAX_OF_X) xxx;
+ if (dx+nx>vcom.xmask+1) {
+ nx=vcom.xmask-dx+1;
+ }
+ if (sx+nx>vcom.xmask+1) {
+ nx=vcom.xmask-sx+1;
+ }
+ for (;nx>0;nx--,dx++, sx++) vcom_lpset(dx, dy, vcom_point(sx, sy));
+ }
+}
+
+
+static void lmmm_(void)
+{
+ vcom_getsx();
+ vcom_getsy();
+ vcom_getdx();
+ vcom_getdy();
+ vcom_getnx();
+ vcom_getny();
+
+ if ((v99x8.ctrl[45] & 0x08) == 0) { /* Direction to down */
+ int ny = vcom.ny, dy = vcom.dy, sy = vcom.sy;
+ // Todo?: if (dy+ny>MAX_OF_Y) xxx;
+ // Todo?: if (sy+ny>MAX_OF_Y) xxx;
+ for (;ny>0;ny--,dy++,sy++) vcom_lcopy_(vcom.sx, sy, vcom.dx, dy, vcom.nx);
+ vcom_setsy(vcom.sy + vcom.ny);
+ vcom_setdy(vcom.dy + vcom.ny);
+ }
+ else {
+ int ny = vcom.ny, dy = vcom.dy, sy = vcom.sy;
+ // Todo?: if (dy-ny<MIN_OF_Y) xxx;
+ // Todo?: if (sy-ny<MIN_OF_Y) xxx;
+ for (;ny>0;ny--,dy--,sy--) vcom_lcopy_(vcom.sx, sy, vcom.dx, dy, vcom.nx);
+ vcom_setsy(vcom.sy - vcom.ny);
+ vcom_setdy(vcom.dy - vcom.ny);
+ }
+
+ //vcom_setsy(vcom.sy + n);
+ //vcom_setdy(vcom.dy + n);
+
+ //if (vcom.ny != abs(n))
+ // vcom_setny(vcom.ny - abs(n));
+ vcom_setny(0);
+}
+
+#ifdef USE_CMDTIME
+void cmdtime_set(int m)
+{
+ cmdtime_m = m>>4;
+ cmdtime_t = 0;
+
+ /* provisional data */
+ /*
+ if ((v99x8.ctrl[8] & 0x02) == 0) && ((v99x8.ctrl[1] & 0x40) != 0)
+ YMMM 4.83 microseconds/byte
+ HMMM 5.85 microseconds/byte
+ HMMV 3.05 microseconds/byte
+ LMMM 6.87 microseconds/dot
+ LMMV 5.91 microseconds/dot
+ */
+ switch(m >> 4)
+ {
+ case 0xe: /* ymmm */ vcom_getdx();vcom_getny();cmdtime_t=483*(v99x8.ctrl[45] & 0x04?vcom.dx:v99x8.mode.xsize-vcom.dx)*vcom.ny/pixmask.npix; break;
+ case 0xd: /* hmmm */ vcom_getnx();vcom_getny();cmdtime_t=585*vcom.nx*vcom.ny/pixmask.npix; break;
+ case 0xc: /* hmmv */ vcom_getnx();vcom_getny();cmdtime_t=305*vcom.nx*vcom.ny/pixmask.npix; break;
+ case 0x9: /* lmmm */ vcom_getnx();vcom_getny();cmdtime_t=687*vcom.nx*vcom.ny; break;
+ case 0x8: /* lmmv */ vcom_getnx();vcom_getny();cmdtime_t=591*vcom.nx*vcom.ny; break;
+ }
+ //cmdtime_t = cmdtime_t*60*262/1000000/100;
+ cmdtime_t = cmdtime_t/6361;
+ if (cmdtime_t<0) cmdtime_t=0;
+}
+
+void cmdtime_chk(void)
+{
+ if (cmdtime_t) {
+ cmdtime_t--;
+ if (0 == cmdtime_t) v99x8.status[2] &= ~0x01;
+ }
+}
+#endif
+
+#define STATE_VERSION 1
+
+void V99X8::save_state(FILEIO* state_fio)
+{
+ state_fio->FputUint32(STATE_VERSION);
+ state_fio->FputInt32(this_device_id);
+
+ state_fio->Fwrite(&v99x8, sizeof(v99x8), 1);
+#ifdef USE_CMDTIME
+ state_fio->FputInt32(cmdtime_t);
+ state_fio->FputInt32(cmdtime_m);
+#endif
+ state_fio->FputInt32(latch1);
+ state_fio->FputInt32(latch2);
+ state_fio->FputInt32(vram_addr);
+ state_fio->FputInt32(vram_page);
+ state_fio->FputBool(f_out3);
+ state_fio->FputBool(f_mode);
+ state_fio->FputBool(flag_frame);
+ state_fio->Fwrite(&vcom, sizeof(vcom), 1);
+ state_fio->FputInt32((int)(vcom.src - vram));
+ state_fio->FputInt32((int)(vcom.dst - vram));
+ state_fio->Fwrite(&r44, sizeof(r44), 1);
+ state_fio->Fwrite(&pixmask, sizeof(pixmask), 1);
+ state_fio->Fwrite(&v99x8_refresh, sizeof(v99x8_refresh), 1);
+ state_fio->Fwrite(pal, sizeof(pal), 1);
+ state_fio->Fwrite(pal_8, sizeof(pal_8), 1);
+ state_fio->Fwrite(pal_m, sizeof(pal_m), 1);
+ state_fio->FputInt32(col_bg);
+ state_fio->Fwrite(tbl_yjk_b, sizeof(tbl_yjk_b), 1);
+ state_fio->Fwrite(tbl_yjk_rg, sizeof(tbl_yjk_rg), 1);
+ state_fio->Fwrite(blackbuf, sizeof(blackbuf), 1);
+ state_fio->Fwrite(sbuf, sizeof(sbuf), 1);
+ state_fio->Fwrite(vram, sizeof(vram), 1);
+ state_fio->FputBool(intstat);
+}
+
+bool V99X8::load_state(FILEIO* state_fio)
+{
+ if(state_fio->FgetUint32() != STATE_VERSION) {
+ return false;
+ }
+ if(state_fio->FgetInt32() != this_device_id) {
+ return false;
+ }
+ state_fio->Fread(&v99x8, sizeof(v99x8), 1);
+#ifdef USE_CMDTIME
+ cmdtime_t = state_fio->FgetInt32();
+ cmdtime_m = state_fio->FgetInt32();
+#endif
+ latch1 = state_fio->FgetInt32();
+ latch2 = state_fio->FgetInt32();
+ vram_addr = state_fio->FgetInt32();
+ vram_page = state_fio->FgetInt32();
+ f_out3 = state_fio->FgetBool();
+ f_mode = state_fio->FgetBool();
+ flag_frame = state_fio->FgetBool();
+ state_fio->Fread(&vcom, sizeof(vcom), 1);
+ vcom.src = vram + state_fio->FgetInt32();
+ vcom.dst = vram + state_fio->FgetInt32();
+ state_fio->Fread(&r44, sizeof(r44), 1);
+ state_fio->Fread(&pixmask, sizeof(pixmask), 1);
+ state_fio->Fread(&v99x8_refresh, sizeof(v99x8_refresh), 1);
+ state_fio->Fread(pal, sizeof(pal), 1);
+ state_fio->Fread(pal_8, sizeof(pal_8), 1);
+ state_fio->Fread(pal_m, sizeof(pal_m), 1);
+ col_bg = state_fio->FgetInt32();
+ state_fio->Fread(tbl_yjk_b, sizeof(tbl_yjk_b), 1);
+ state_fio->Fread(tbl_yjk_rg, sizeof(tbl_yjk_rg), 1);
+ state_fio->Fread(blackbuf, sizeof(blackbuf), 1);
+ state_fio->Fread(sbuf, sizeof(sbuf), 1);
+ state_fio->Fread(vram, sizeof(vram), 1);
+ intstat = state_fio->FgetBool();
+
+ // post process
+ v99x8.vram = vram;
+ f_scr = true;
+ return true;
+}
+
--- /dev/null
+// from "v99x8.h" of Zodiac
+
+#ifndef _V99X8_H_
+#define _V99X8_H_
+
+#include "vm.h"
+#include "../emu.h"
+#include "device.h"
+
+#ifndef VAR
+# define VAR extern
+#endif
+
+//#include "../misc/ut.h"
+//#include <md.h>
+
+
+#define V99X8_NREG 48
+#define V99X8_NSTAT 10
+
+enum
+{
+ V99X8_SCREEN_IGN = -1,
+ V99X8_SCREEN_0, V99X8_SCREEN_1, V99X8_SCREEN_2, V99X8_SCREEN_3,
+ V99X8_SCREEN_4, V99X8_SCREEN_5, V99X8_SCREEN_6, V99X8_SCREEN_7,
+ V99X8_SCREEN_8, V99X8_SCREEN_X, V99X8_SCREEN_A, V99X8_SCREEN_C
+};
+
+typedef struct
+{
+ bool f_tms;
+ bool f_interleave; /* sc7/8 \82É\82¨\82¯\82é\93Á\95Ê\82È\83}\83b\83s\83\93\83O\83\82\81[\83h */
+
+ int xsize;
+ int xshift;
+} v99x8_screen_mode_t;
+
+typedef struct
+{
+ uint8 ctrl[V99X8_NREG], status[V99X8_NSTAT];
+
+ int scr;
+ v99x8_screen_mode_t mode;
+
+ uint8 col_fg, col_bg;
+
+ uint8 *tbl_pg, *tbl_pn, *tbl_cl;
+
+ int pages; /* VRAM memory size */
+ bool f_zoom;
+
+ uint8 *vram;
+
+ int scanline, n_scanlines; /* \8f\88\97\9d\92\86\82Ì scanline \82Æ scanline \90\94\81B
+ ??? \82à\82Á\82Æ\82æ\82¢\83l\81[\83~\83\93\83O\81H */
+
+
+/* private */
+
+
+} v99x8_t;
+
+VAR v99x8_t v99x8;
+
+
+extern void v99x8_init(void);
+extern void v99x8_ctrl(int n, uint8 m);
+extern int v99x8_hsync(void);
+
+extern uint8 v99x8_in_0(void); /* VRAM read */
+extern uint8 v99x8_in_1(void); /* status in */
+
+extern void v99x8_out_0(uint8 n); /* VRAM write */
+extern void v99x8_out_1(uint8 n); /* ctrl out */
+extern void v99x8_out_2(uint8 n); /* palette out */
+extern void v99x8_out_3(uint8 n); /* ctrl out */
+
+
+extern void v99x8_pallete_set(uint8 n, uint8 r, uint8 g, uint8 b);
+extern void v99x8_refresh_init(void);
+extern void v99x8_refresh_screen(void);
+extern void v99x8_refresh_clear(void);
+extern void v99x8_refresh_sc0(int y, int h);
+extern void v99x8_refresh_sc1(int y, int h);
+extern void v99x8_refresh_sc2(int y, int h);
+extern void v99x8_refresh_sc3(int y, int h);
+extern void v99x8_refresh_sc4(int y, int h);
+extern void v99x8_refresh_sc5(int y, int h);
+extern void v99x8_refresh_sc6(int y, int h);
+extern void v99x8_refresh_sc7(int y, int h);
+extern void v99x8_refresh_sc8(int y, int h);
+extern void v99x8_refresh_sca(int y, int h);
+extern void v99x8_refresh_scc(int y, int h);
+extern void v99x8_refresh_scx(int y, int h);
+
+extern uint8 vram_read(int addr);
+extern void vram_write(int addr, uint8 n);
+
+/*
+#define VRAM_ADDR(addr) (v99x8.f_interleave ? \
+ (addr >> 1) | ((addr & 1) << 16) : \
+ addr)
+*/
+
+
+
+
+
+/*
+ Skelton for retropc emulator
+
+ Origin : "tms9918a.h"
+ Author : umaiboux
+ Date : 2014.12.XX -
+
+ [ V99x8 ]
+*/
+
+
+#include "vm.h"
+#include "../emu.h"
+#include "device.h"
+
+
+class V99X8 : public DEVICE
+{
+private:
+ // output signals
+ outputs_t outputs_irq;
+
+ uint8 vram[1024*128];
+ scrntype screen[SCREEN_WIDTH*SCREEN_HEIGHT];
+ bool intstat;
+
+ void set_intstat(bool val);
+
+ int hsync(int v/*void*/);
+ void z80_intreq(int a);
+ int md_video_pitch(void);
+ uint8 *md_video_lockline(int x, int y, int w, int h);
+ void md_video_update(int n, /*md_video_rect_t*/void *rp);
+ void md_video_fill(int x, int y, int w, int h, uint32 c);
+ void v99x8_refresh_screen(void);
+ void v99x8_refresh_clear(void);
+ uint8 *v99x8_refresh_start(int x, int w, int h);
+ void v99x8_refresh_sc0(int y, int h);
+ void v99x8_refresh_sc1(int y, int h);
+ void v99x8_refresh_sc2(int y, int h);
+ void v99x8_refresh_sc3(int y, int h);
+ void v99x8_refresh_sc4(int y, int h);
+ void v99x8_refresh_sc5(int y, int h);
+ void v99x8_refresh_sc6(int y, int h);
+ void v99x8_refresh_sc7(int y, int h);
+ void v99x8_refresh_sc8(int y, int h);
+ void v99x8_refresh_sca(int y, int h);
+ void v99x8_refresh_scc(int y, int h);
+ void v99x8_refresh_scx(int y, int h);
+public:
+ V99X8(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+ {
+ init_output_signals(&outputs_irq);
+ }
+ ~V99X8() {}
+
+ // common functions
+ void initialize();
+ void reset();
+ void write_io8(uint32 addr, uint32 data);
+ uint32 read_io8(uint32 addr);
+ void event_vline(int v, int clock);
+ void save_state(FILEIO* state_fio);
+ bool load_state(FILEIO* state_fio);
+
+ // unique functions
+ void set_context_irq(DEVICE* device, int id, uint32 mask)
+ {
+ register_output_signal(&outputs_irq, device, id, mask);
+ }
+ void draw_screen();
+};
+
+#endif
#include "fm7/fm7.h"
#endif
+// FUJITSU FM-7
+#ifdef _FM7
+#include "fm7/fm7.h"
+#endif
+
// FUJITSU FM16pi
#ifdef _FM16PI
#include "fm16pi/fm16pi.h"
#include "gamegear/mastersystem.h"
#endif
+// ASCII MSX
+#ifdef _MSX1
+#include "msx/msx.h"
+#endif
+
+// ASCII MSX2
+#ifdef _MSX2
+#include "msx/msx.h"
+#endif
+
// MITSUBISHI Elec. MULTI8
#ifdef _MULTI8
#include "multi8/multi8.h"
// PIONEER PX-7
#ifdef _PX7
-#include "msx1/msx1.h"
+#include "msx/msx.h"
#endif
// ASCII MSX1
#ifdef _MSX1
-#include "msx1/msx1.h"
+#include "msx/msx.h"
+#endif
+
+// ASCII MSX2
+#ifdef _MSX2
+#include "msx/msx.h"
#endif
// TOMY PYUTA
#include "ym2151.h"
+#ifdef SUPPORT_MAME_FM_DLL
+static bool dont_create_multiple_chips = false;
+#endif
+
void YM2151::initialize()
{
opm = new FM::OPM;
+#ifdef SUPPORT_MAME_FM_DLL
+// fmdll = new CFMDLL(_T("mamefm.dll"));
+ fmdll = new CFMDLL(config.fmgen_dll_path);
+ dllchip = NULL;
+#endif
register_vline_event(this);
mute = false;
clock_prev = clock_accum = clock_busy = 0;
void YM2151::release()
{
delete opm;
+#ifdef SUPPORT_MAME_FM_DLL
+ if(dllchip) {
+ fmdll->Release(dllchip);
+ }
+ delete fmdll;
+#endif
}
void YM2151::reset()
{
opm->Reset();
+#ifdef SUPPORT_MAME_FM_DLL
+ if(dllchip) {
+ fmdll->Reset(dllchip);
+ }
+ memset(port_log, 0, sizeof(port_log));
+#endif
irq_prev = busy = false;
}
{
if(addr & 1) {
update_count();
- opm->SetReg(ch, data);
+ SetReg(ch, data);
update_interrupt();
clock_busy = current_clock();
busy = true;
{
if(cnt > 0 && !mute) {
opm->Mix(buffer, cnt);
+#ifdef SUPPORT_MAME_FM_DLL
+ if(dllchip) {
+ fmdll->Mix(dllchip, buffer, cnt);
+ }
+#endif
}
}
{
opm->Init(clock, rate, false);
opm->SetVolume(vol);
+#ifdef SUPPORT_MAME_FM_DLL
+ if(!dont_create_multiple_chips) {
+ fmdll->Create((LPVOID*)&dllchip, clock, rate);
+ if(dllchip) {
+ fmdll->SetVolumeFM(dllchip, vol);
+
+ DWORD mask = 0;
+ DWORD dwCaps = fmdll->GetCaps(dllchip);
+ if((dwCaps & SUPPORT_MULTIPLE) != SUPPORT_MULTIPLE) {
+ dont_create_multiple_chips = true;
+ }
+ if((dwCaps & SUPPORT_FM_A) == SUPPORT_FM_A) {
+ mask = 0x07;
+ }
+ if((dwCaps & SUPPORT_FM_B) == SUPPORT_FM_B) {
+ mask |= 0x38;
+ }
+ if((dwCaps & SUPPORT_FM_C) == SUPPORT_FM_C) {
+ mask |= 0xc0;
+ }
+ opm->SetChannelMask(mask);
+ fmdll->SetChannelMask(dllchip, ~mask);
+ }
+ }
+#endif
chip_clock = clock;
}
void YM2151::SetReg(uint addr, uint data)
{
opm->SetReg(addr, data);
+#ifdef SUPPORT_MAME_FM_DLL
+ if(dllchip) {
+ fmdll->SetReg(dllchip, addr, data);
+ }
+ port_log[addr].written = true;
+ port_log[addr].data = data;
+#endif
}
void YM2151::update_timing(int new_clocks, double new_frames_per_sec, int new_lines_per_frame)
state_fio->FputInt32(this_device_id);
opm->SaveState((void *)state_fio);
+#ifdef SUPPORT_MAME_FM_DLL
+ state_fio->Fwrite(port_log, sizeof(port_log), 1);
+#endif
state_fio->FputInt32(chip_clock);
state_fio->FputUint8(ch);
state_fio->FputBool(irq_prev);
if(!opm->LoadState((void *)state_fio)) {
return false;
}
+#ifdef SUPPORT_MAME_FM_DLL
+ state_fio->Fread(port_log, sizeof(port_log), 1);
+#endif
chip_clock = state_fio->FgetInt32();
ch = state_fio->FgetUint8();
irq_prev = state_fio->FgetBool();
clock_const = state_fio->FgetUint32();
clock_busy = state_fio->FgetUint32();
busy = state_fio->FgetBool();
+
+#ifdef SUPPORT_MAME_FM_DLL
+ // post process
+ if(dllchip) {
+ fmdll->Reset(dllchip);
+ for(int i = 0; i < 0x100; i++) {
+ if(port_log[i].written) {
+ fmdll->SetReg(dllchip, i, port_log[i].data);
+ }
+ }
+ }
+#endif
return true;
}
#include "device.h"
#include "fmgen/opm.h"
+#if defined(_WIN32)
+#define SUPPORT_MAME_FM_DLL
+#include "fmdll/fmdll.h"
+#endif
+
#define SIG_YM2151_MUTE 0
class YM2151 : public DEVICE
outputs_t outputs_irq;
FM::OPM* opm;
+#ifdef SUPPORT_MAME_FM_DLL
+ CFMDLL* fmdll;
+ LPVOID* dllchip;
+ struct {
+ bool written;
+ uint8 data;
+ } port_log[0x100];
+#endif
int chip_clock;
uint8 ch;
#include "ym2203.h"
+#ifdef SUPPORT_MAME_FM_DLL
+static bool dont_create_multiple_chips = false;
+#endif
+
void YM2203::initialize()
{
#ifdef HAS_YM2608
#endif
#ifdef SUPPORT_MAME_FM_DLL
-#ifdef HAS_YM2608
- if(is_ym2608) {
- fmdll->Create((LPVOID*)&dllchip, clock, rate);
- } else
-#endif
- fmdll->Create((LPVOID*)&dllchip, clock * 2, rate);
- if(dllchip) {
- fmdll->SetVolumeFM(dllchip, volf);
- fmdll->SetVolumePSG(dllchip, volp);
-
- DWORD mask = 0;
- DWORD dwCaps = fmdll->GetCaps(dllchip);
- if((dwCaps & SUPPORT_FM_A) == SUPPORT_FM_A) {
- mask = 0x07;
- }
- if((dwCaps & SUPPORT_FM_B) == SUPPORT_FM_B) {
- mask |= 0x38;
- }
- if((dwCaps & SUPPORT_PSG) == SUPPORT_PSG) {
- mask |= 0x1c0;
- }
- if((dwCaps & SUPPORT_ADPCM_B) == SUPPORT_ADPCM_B) {
- mask |= 0x200;
- }
- if((dwCaps & SUPPORT_RHYTHM) == SUPPORT_RHYTHM) {
- mask |= 0xfc00;
- }
+ if(!dont_create_multiple_chips) {
#ifdef HAS_YM2608
if(is_ym2608) {
- opna->SetChannelMask(mask);
+ fmdll->Create((LPVOID*)&dllchip, clock, rate);
} else
#endif
- opn->SetChannelMask(mask);
- fmdll->SetChannelMask(dllchip, ~mask);
+ fmdll->Create((LPVOID*)&dllchip, clock * 2, rate);
+ if(dllchip) {
+ fmdll->SetVolumeFM(dllchip, volf);
+ fmdll->SetVolumePSG(dllchip, volp);
+
+ DWORD mask = 0;
+ DWORD dwCaps = fmdll->GetCaps(dllchip);
+ if((dwCaps & SUPPORT_MULTIPLE) != SUPPORT_MULTIPLE) {
+ dont_create_multiple_chips = true;
+ }
+ if((dwCaps & SUPPORT_FM_A) == SUPPORT_FM_A) {
+ mask = 0x07;
+ }
+ if((dwCaps & SUPPORT_FM_B) == SUPPORT_FM_B) {
+ mask |= 0x38;
+ }
+ if((dwCaps & SUPPORT_PSG) == SUPPORT_PSG) {
+ mask |= 0x1c0;
+ }
+ if((dwCaps & SUPPORT_ADPCM_B) == SUPPORT_ADPCM_B) {
+ mask |= 0x200;
+ }
+ if((dwCaps & SUPPORT_RHYTHM) == SUPPORT_RHYTHM) {
+ mask |= 0xfc00;
+ }
+#ifdef HAS_YM2608
+ if(is_ym2608) {
+ opna->SetChannelMask(mask);
+ } else
+#endif
+ opn->SetChannelMask(mask);
+ fmdll->SetChannelMask(dllchip, ~mask);
+ }
}
#endif
chip_clock = clock;
} else PC++; \
} while(0)
-#ifdef Z80_BIOS_CALL
-#define CALL() do { \
- ea = FETCH16(); \
- WZ = ea; \
- if(d_bios != NULL && d_bios->bios_call_z80(WZ, &AF, &BC, &DE, &HL, &IX, &IY)) { \
- break; \
- } \
- PUSH(pc); \
- PCD = ea; \
-} while(0)
-
-#define CALL_COND(cond, opcode) do { \
- if(cond) { \
- ea = FETCH16(); \
- WZ = ea; \
- if(d_bios != NULL && d_bios->bios_call_z80(WZ, &AF, &BC, &DE, &HL, &IX, &IY)) { \
- break; \
- } \
- PUSH(pc); \
- PCD = ea; \
- icount -= cc_ex[opcode]; \
- } else { \
- WZ = FETCH16(); /* implicit call PC+=2; */ \
- } \
-} while(0)
-#else
#define CALL() do { \
ea = FETCH16(); \
WZ = ea; \
WZ = FETCH16(); /* implicit call PC+=2; */ \
} \
} while(0)
-#endif
#define RET_COND(cond, opcode) do { \
if(cond) { \
case 0xc6: ADD(FETCH8()); break; /* ADD A,n */
case 0xc7: RST(0x00); break; /* RST 0 */
case 0xc8: RET_COND(F & ZF, 0xc8); break; /* RET Z */
+#ifdef Z80_PSEUDO_BIOS
+ case 0xc9:
+ if(d_bios != NULL) {
+ d_bios->bios_ret_z80(prevpc, &af, &bc, &de, &hl, &ix, &iy, &iff1);
+ }
+ POP(pc); WZ = PCD; break; /* RET */
+#else
case 0xc9: POP(pc); WZ = PCD; break; /* RET */
+#endif
case 0xca: JP_COND(F & ZF); break; /* JP Z,a */
case 0xcb: OP_CB(FETCHOP()); break; /* **** CB xx */
case 0xcc: CALL_COND(F & ZF, 0xcc); break; /* CALL Z,a */
--------------------------------------------------------------------------- */
DEVICE *d_mem, *d_io, *d_pic;
-#ifdef Z80_BIOS_CALL
+#ifdef Z80_PSEUDO_BIOS
DEVICE *d_bios;
#endif
#ifdef SINGLE_MODE_DMA
Z80(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
{
busreq = false;
-#ifdef Z80_BIOS_CALL
+#ifdef Z80_PSEUDO_BIOS
d_bios = NULL;
#endif
#ifdef SINGLE_MODE_DMA
{
d_pic = device;
}
-#ifdef Z80_BIOS_CALL
+#ifdef Z80_PSEUDO_BIOS
void set_context_bios(DEVICE* device)
{
d_bios = device;
#include "fifo.h"
#include "fileio.h"
-#define KEY_KEEP_FRAMES 3
+#define KEY_KEEP_FRAMES 3
+
+// dummy dinput keycode
+#define DIK_SHIFT 0xfd
+#define DIK_CONTROL 0xfe
+#define DIK_MENU 0xff
typedef struct {
- int l_dik, r_dik, l_vk, r_vk, vk;
+ int lr_dik, l_dik, r_dik, l_vk, r_vk;
} lr_t;
static const lr_t lr[3] = {
- {DIK_LSHIFT , DIK_RSHIFT , VK_LSHIFT , VK_RSHIFT , VK_SHIFT },
- {DIK_LCONTROL, DIK_RCONTROL, VK_LCONTROL, VK_RCONTROL, VK_CONTROL},
- {DIK_LMENU , DIK_RMENU , VK_LMENU , VK_RMENU , VK_MENU }
+ {DIK_SHIFT , DIK_LSHIFT , DIK_RSHIFT , VK_LSHIFT , VK_RSHIFT },
+ {DIK_CONTROL, DIK_LCONTROL, DIK_RCONTROL, VK_LCONTROL, VK_RCONTROL},
+ {DIK_MENU , DIK_LMENU , DIK_RMENU , VK_LMENU , VK_RMENU }
};
static const uint8 vk_dik[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x0f, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xC5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x79, 0x7b, 0x00, 0x00,
+ DIK_SHIFT, DIK_CONTROL, DIK_MENU,
+ 0xC5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x79, 0x7b, 0x00, 0x00,
0x39, 0xc9, 0xd1, 0xcf, 0xc7, 0xcb, 0xc8, 0xcd, 0xd0, 0x00, 0x00, 0x00, 0x00, 0xd2, 0xd3, 0x00,
0x0b, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x1e, 0x30, 0x2e, 0x20, 0x12, 0x21, 0x22, 0x23, 0x17, 0x24, 0x25, 0x26, 0x32, 0x31, 0x18,
if(SUCCEEDED(lpdikey->SetDataFormat(&c_dfDIKeyboard))) {
if(SUCCEEDED(lpdikey->SetCooperativeLevel(main_window_handle, DISCL_FOREGROUND | DISCL_NONEXCLUSIVE))) {
dinput_key_ok = true;
+ memset(key_dik_prev, 0, sizeof(key_dik_prev));
}
}
}
{
if(dinput_key_ok) {
// direct input
- static uint8 buffer[256];
+ static uint8 key_dik[256];
lpdikey->Acquire();
- lpdikey->GetDeviceState(256, buffer);
+ lpdikey->GetDeviceState(256, key_dik);
- // XXX: DIK_RSHIFT is not detected on Vista or later
- if(vista_or_later && (GetAsyncKeyState(VK_RSHIFT) & 0x8000) != 0) {
- buffer[DIK_RSHIFT] = 0x80;
+ // DIK_RSHIFT is not detected on Vista or later
+ if(vista_or_later) {
+ key_dik[DIK_RSHIFT] = (GetAsyncKeyState(VK_RSHIFT) & 0x8000) ? 0x80 : 0;
}
-
-#ifndef USE_NUMPAD_ENTER
- buffer[DIK_RETURN ] |= buffer[DIK_NUMPADENTER];
-#endif
- buffer[DIK_CIRCUMFLEX] |= buffer[DIK_EQUALS ];
- buffer[DIK_COLON ] |= buffer[DIK_APOSTROPHE ];
- buffer[DIK_YEN ] |= buffer[DIK_GRAVE ];
-
#ifdef USE_SHIFT_NUMPAD_KEY
+ // XXX: don't release shift key while numpad key is pressed
uint8 numpad_keys;
- numpad_keys = buffer[DIK_NUMPAD0];
- numpad_keys |= buffer[DIK_NUMPAD1];
- numpad_keys |= buffer[DIK_NUMPAD2];
- numpad_keys |= buffer[DIK_NUMPAD3];
- numpad_keys |= buffer[DIK_NUMPAD4];
- numpad_keys |= buffer[DIK_NUMPAD5];
- numpad_keys |= buffer[DIK_NUMPAD6];
- numpad_keys |= buffer[DIK_NUMPAD7];
- numpad_keys |= buffer[DIK_NUMPAD8];
- numpad_keys |= buffer[DIK_NUMPAD9];
- numpad_keys &= 0x80;
+ numpad_keys = key_dik[DIK_NUMPAD0];
+ numpad_keys |= key_dik[DIK_NUMPAD1];
+ numpad_keys |= key_dik[DIK_NUMPAD2];
+ numpad_keys |= key_dik[DIK_NUMPAD3];
+ numpad_keys |= key_dik[DIK_NUMPAD4];
+ numpad_keys |= key_dik[DIK_NUMPAD5];
+ numpad_keys |= key_dik[DIK_NUMPAD6];
+ numpad_keys |= key_dik[DIK_NUMPAD7];
+ numpad_keys |= key_dik[DIK_NUMPAD8];
+ numpad_keys |= key_dik[DIK_NUMPAD9];
+ if(numpad_keys & 0x80) {
+ key_dik[DIK_LSHIFT] |= key_dik_prev[DIK_LSHIFT];
+ key_dik[DIK_RSHIFT] |= key_dik_prev[DIK_RSHIFT];
+ }
+#endif
+ key_dik[DIK_CIRCUMFLEX] |= key_dik[DIK_EQUALS ];
+ key_dik[DIK_COLON ] |= key_dik[DIK_APOSTROPHE ];
+ key_dik[DIK_YEN ] |= key_dik[DIK_GRAVE ];
+#ifndef USE_NUMPAD_ENTER
+ key_dik[DIK_RETURN ] |= key_dik[DIK_NUMPADENTER];
#endif
for(int i = 0; i < 3; i++) {
// left and right keys of shift, ctrl and alt
- if(buffer[lr[i].l_dik] & 0x80) {
+ if(key_dik[lr[i].l_dik] & 0x80) {
key_status[lr[i].l_vk] = 0x80;
} else {
key_status[lr[i].l_vk] &= 0x7f;
}
- if(buffer[lr[i].r_dik] & 0x80) {
+ if(key_dik[lr[i].r_dik] & 0x80) {
key_status[lr[i].r_vk] = 0x80;
} else {
key_status[lr[i].r_vk] &= 0x7f;
}
- if((buffer[lr[i].l_dik] | buffer[lr[i].r_dik]) & 0x80) {
- if(!(key_status[lr[i].vk] & 0x80)) {
- key_down_sub(lr[i].vk, false);
- }
- } else {
- if(key_status[lr[i].vk] & 0x80) {
-#ifdef USE_SHIFT_NUMPAD_KEY
- // XXX: don't release shift key while numpad key is pressed
- if(!(i == 0 && numpad_keys != 0))
-#endif
- key_up_sub(lr[i].vk);
- }
- }
+ key_dik[lr[i].lr_dik] = key_dik[lr[i].l_dik] | key_dik[lr[i].r_dik];
}
for(int vk = 0; vk < 256; vk++) {
int dik = vk_dik[vk];
if(dik) {
- if(buffer[dik] & 0x80) {
- if(!(key_status[keycode_conv[vk]] & 0x80)) {
+ if(key_dik[dik] & 0x80) {
+ if(!(key_dik_prev[dik] & 0x80)) {
key_down_sub(vk, false);
}
} else {
- if(key_status[keycode_conv[vk]] & 0x80) {
+ if(key_dik_prev[dik] & 0x80) {
key_up_sub(vk);
}
}
}
}
+ memcpy(key_dik_prev, key_dik, sizeof(key_dik_prev));
#ifdef USE_SHIFT_NUMPAD_KEY
} else {
// update numpad key status
code = keycode_conv[code];
}
-//#ifdef NOTIFY_KEY_DOWN
-// bool prev_pressed = (key_status[code] != 0);
-//#endif
#ifdef DONT_KEEEP_KEY_PRESSED
if(!(code == VK_SHIFT || code == VK_CONTROL || code == VK_MENU)) {
key_status[code] = KEY_KEEP_FRAMES;
#endif
key_status[code] = keep_frames ? KEY_KEEP_FRAMES : 0x80;
#ifdef NOTIFY_KEY_DOWN
-// if(!prev_pressed) {
- if(keep_frames) {
- repeat = false;
- }
- vm->key_down(code, repeat);
-// }
+ if(keep_frames) {
+ repeat = false;
+ }
+ vm->key_down(code, repeat);
#endif
}
#elif defined(_X1) || defined(_X1TWIN) || defined(_X1TURBO) || defined(_X1TURBOZ)
play ? _T("Supported Files (*.wav;*.cas;*.tap)\0*.wav;*.cas;*.tap\0All Files (*.*)\0*.*\0\0")
: _T("Supported Files (*.wav;*.cas)\0*.wav;*.cas\0All Files (*.*)\0*.*\0\0"),
-#elif defined(_FM7)
+#elif defined(_FM8) || defined(_FM7) || defined(_FMNEW7) || defined(_FM77_VARIANTS) || defined(_FM77AV_VARIANTS)
_T("Supported Files (*.wav;*.cas;*.t77)\0*.wav;*.cas;*.t77\0All Files (*.*)\0*.*\0\0"),
#elif defined(TAPE_BINARY_ONLY)
_T("Supported Files (*.cas;*.cmt)\0*.cas;*.cmt\0All Files (*.*)\0*.*\0\0"),