Initial conversion of core to C++14. Note that compilers are now limited to GCC 4.9.0 and up, Clang 3.4.0 and up, and VS2013 and up [Miodrag Milanovic]

This commit is contained in:
Miodrag Milanovic 2015-12-03 11:40:45 +01:00
parent 39afa0533a
commit 92f81361d6
52 changed files with 335 additions and 488 deletions

View File

@ -80,7 +80,6 @@
# LTO = 1 # LTO = 1
# SSE2 = 1 # SSE2 = 1
# OPENMP = 1 # OPENMP = 1
# CPP11 = 1
# FASTDEBUG = 1 # FASTDEBUG = 1
# FILTER_DEPS = 1 # FILTER_DEPS = 1
@ -615,10 +614,6 @@ ifdef OPENMP
PARAMS += --OPENMP='$(OPENMP)' PARAMS += --OPENMP='$(OPENMP)'
endif endif
ifdef CPP11
PARAMS += --CPP11='$(CPP11)'
endif
ifdef FASTDEBUG ifdef FASTDEBUG
PARAMS += --FASTDEBUG='$(FASTDEBUG)' PARAMS += --FASTDEBUG='$(FASTDEBUG)'
endif endif
@ -840,18 +835,6 @@ windows_x64_clang: generate $(PROJECTDIR)/gmake-mingw-clang/Makefile
windows_x86_clang: generate $(PROJECTDIR)/gmake-mingw-clang/Makefile windows_x86_clang: generate $(PROJECTDIR)/gmake-mingw-clang/Makefile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR)/gmake-mingw-clang config=$(CONFIG)32 WINDRES=$(WINDRES) $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR)/gmake-mingw-clang config=$(CONFIG)32 WINDRES=$(WINDRES)
vs2010: generate
$(SILENT) $(GENIE) $(PARAMS) vs2010
vs2012: generate
$(SILENT) $(GENIE) $(PARAMS) vs2012
vs2012_intel: generate
$(SILENT) $(GENIE) $(PARAMS) --vs=intel-15 vs2012
vs2012_xp: generate
$(SILENT) $(GENIE) $(PARAMS) --vs=vs2012-xp vs2012
vs2013: generate vs2013: generate
$(SILENT) $(GENIE) $(PARAMS) vs2013 $(SILENT) $(GENIE) $(PARAMS) vs2013
ifdef MSBUILD ifdef MSBUILD

View File

@ -305,15 +305,6 @@ newoption {
} }
} }
newoption {
trigger = "CPP11",
description = "Compile c++ code as C++11.",
allowed = {
{ "0", "Disabled" },
{ "1", "Enabled" },
}
}
newoption { newoption {
trigger = "FASTDEBUG", trigger = "FASTDEBUG",
description = "Fast DEBUG.", description = "Fast DEBUG.",
@ -532,11 +523,6 @@ else
os.outputof( PYTHON .. " " .. MAME_DIR .. "scripts/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS["SOURCES"] .. " drivers " .. _OPTIONS["subtarget"] .. " > ".. GEN_DIR .. _OPTIONS["target"] .. "/" .. _OPTIONS["subtarget"].."/drivlist.cpp") os.outputof( PYTHON .. " " .. MAME_DIR .. "scripts/build/makedep.py " .. MAME_DIR .. " " .. _OPTIONS["SOURCES"] .. " drivers " .. _OPTIONS["subtarget"] .. " > ".. GEN_DIR .. _OPTIONS["target"] .. "/" .. _OPTIONS["subtarget"].."/drivlist.cpp")
end end
configuration { "gmake" } configuration { "gmake" }
if _OPTIONS["CPP11"]~="1" then
defines {
"nullptr=NULL" -- getting ready for C++11
}
end
flags { flags {
"SingleOutputDir", "SingleOutputDir",
} }
@ -743,33 +729,14 @@ else
end end
if _OPTIONS["CPP11"]=="1" then
buildoptions_cpp { buildoptions_cpp {
"-x c++", "-x c++",
"-std=gnu++11", "-std=c++14",
-- "-std=c++11",
-- "-Wpedantic",
-- "-pedantic",
-- "-Wno-variadic-macros",
-- "-Wno-long-long",
} }
else
--we compile C++ code to C++98 standard with GNU extensions
buildoptions_cpp {
"-x c++",
-- "-Wpedantic",
-- "-pedantic",
"-std=gnu++98",
"-Wno-variadic-macros",
"-Wno-long-long",
"-Wno-variadic-macros",
-- "-std=c++98",
}
end
buildoptions_objc { buildoptions_objc {
"-x objective-c++", "-x objective-c++",
"-std=c++14",
} }
@ -993,18 +960,19 @@ end
local version = str_to_version(_OPTIONS["gcc_version"]) local version = str_to_version(_OPTIONS["gcc_version"])
if string.find(_OPTIONS["gcc"], "clang") then if string.find(_OPTIONS["gcc"], "clang") then
if (version < 30400) then
print("Clang version 3.4 or later needed")
os.exit(-1)
end
buildoptions { buildoptions {
"-Wno-cast-align", "-Wno-cast-align",
"-Wno-tautological-compare", "-Wno-tautological-compare",
"-Wno-dynamic-class-memaccess", "-Wno-dynamic-class-memaccess",
"-Wno-unused-value",
"-Wno-c++11-narrowing",
"-Wno-inline-new-delete",
"-Wno-constant-logical-operand",
} }
if (version >= 30000) then
buildoptions {
"-Wno-unused-value",
"-Wno-inline-new-delete",
"-Wno-constant-logical-operand",
}
end
if (version >= 30500) then if (version >= 30500) then
buildoptions { buildoptions {
"-Wno-absolute-value", "-Wno-absolute-value",
@ -1018,6 +986,10 @@ end
} }
end end
else else
if (version < 40900) then
print("GCC version 4.9 or later needed")
os.exit(-1)
end
if (version == 40201) then if (version == 40201) then
buildoptions { buildoptions {
"-Wno-cast-align" "-Wno-cast-align"
@ -1044,21 +1016,6 @@ end
} }
-- end -- end
end end
if (version >= 50000) then
buildoptions {
-- "-D__USE_MINGW_ANSI_STDIO=1", -- required or lua won't compile linux ignores this but Windows needs it
"-freport-bug",
"-D_GLIBCXX_USE_CXX11_ABI=0", -- does not seem to matter in linux, mingw needs to link printf,etc
-- "-DNO_MEM_TRACKING", -- must comment out for mingw GCC 5.2 pedantic or get new/delete redef error
-- next two should work, but compiler complains about end conditions that are int when loop variable is unsigned. maybe these can be fixed
-- "-funsafe-loop-optimizations",
-- "-Wunsafe-loop-optimizations",
-- this six flag combo lets MAME compile with LTO=1 on linux with no errors and ~2% speed boost, but compile time is much longer
-- "-fdevirtualize-at-ltrans","-fgcse-sm","-fgcse-las",
-- "-fipa-pta","-fipa-icf","-fvariable-expansion-in-unroller",
}
end
end end
end end
--ifeq ($(findstring arm,$(UNAME)),arm) --ifeq ($(findstring arm,$(UNAME)),arm)
@ -1278,11 +1235,6 @@ configuration { "vs2015" }
"/wd4297", -- warning C4297: 'xxx::~xxx': function assumed not to throw an exception but does "/wd4297", -- warning C4297: 'xxx::~xxx': function assumed not to throw an exception but does
"/wd4319", -- warning C4319: 'operator' : zero extending 'type' to 'type' of greater size "/wd4319", -- warning C4319: 'operator' : zero extending 'type' to 'type' of greater size
} }
configuration { "vs2010" }
buildoptions {
"/wd4481", -- warning C4481: nonstandard extension used: override specifier 'override'
}
configuration { "winphone8* or winstore8*" } configuration { "winphone8* or winstore8*" }
removelinks { removelinks {
"DelayImp", "DelayImp",

View File

@ -42,10 +42,8 @@ newoption {
allowed = { allowed = {
{ "intel-14", "Intel C++ Compiler XE 14.0" }, { "intel-14", "Intel C++ Compiler XE 14.0" },
{ "intel-15", "Intel C++ Compiler XE 15.0" }, { "intel-15", "Intel C++ Compiler XE 15.0" },
{ "vs2012-clang", "Clang 3.6" },
{ "vs2013-clang", "Clang 3.6" }, { "vs2013-clang", "Clang 3.6" },
{ "vs2015-clang", "Clang 3.6" }, { "vs2015-clang", "Clang 3.6" },
{ "vs2012-xp", "Visual Studio 2012 targeting XP" },
{ "vs2013-xp", "Visual Studio 2013 targeting XP" }, { "vs2013-xp", "Visual Studio 2013 targeting XP" },
{ "vs2015-xp", "Visual Studio 2015 targeting XP" }, { "vs2015-xp", "Visual Studio 2015 targeting XP" },
{ "winphone8", "Windows Phone 8.0" }, { "winphone8", "Windows Phone 8.0" },
@ -327,7 +325,7 @@ function toolchain(_buildDir, _subDir)
if "os2" == _OPTIONS["gcc"] then if "os2" == _OPTIONS["gcc"] then
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-os2") location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-os2")
end end
elseif _ACTION == "vs2012" or _ACTION == "vs2013" or _ACTION == "vs2015" then elseif _ACTION == "vs2013" or _ACTION == "vs2015" then
if (_ACTION .. "-clang") == _OPTIONS["vs"] then if (_ACTION .. "-clang") == _OPTIONS["vs"] then
premake.vstudio.toolset = ("LLVM-" .. _ACTION) premake.vstudio.toolset = ("LLVM-" .. _ACTION)
@ -369,11 +367,6 @@ function toolchain(_buildDir, _subDir)
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-intel") location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-intel")
end end
if ("vs2012-xp") == _OPTIONS["vs"] then
premake.vstudio.toolset = ("v110_xp")
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-xp")
end
if ("vs2013-xp") == _OPTIONS["vs"] then if ("vs2013-xp") == _OPTIONS["vs"] then
premake.vstudio.toolset = ("v120_xp") premake.vstudio.toolset = ("v120_xp")
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-xp") location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-xp")

View File

@ -96,14 +96,14 @@ void gba_rom_eeprom_device::device_start()
{ {
// for the moment we use a custom eeprom implementation, so we alloc/save it as nvram // for the moment we use a custom eeprom implementation, so we alloc/save it as nvram
nvram_alloc(0x200); nvram_alloc(0x200);
m_eeprom.reset(global_alloc(gba_eeprom_device(machine(), (UINT8*)get_nvram_base(), get_nvram_size(), 6))); m_eeprom = std::make_unique<gba_eeprom_device>(machine(), (UINT8*)get_nvram_base(), get_nvram_size(), 6);
} }
void gba_rom_eeprom64_device::device_start() void gba_rom_eeprom64_device::device_start()
{ {
// for the moment we use a custom eeprom implementation, so we alloc/save it as nvram // for the moment we use a custom eeprom implementation, so we alloc/save it as nvram
nvram_alloc(0x2000); nvram_alloc(0x2000);
m_eeprom.reset(global_alloc(gba_eeprom_device(machine(), (UINT8*)get_nvram_base(), get_nvram_size(), 14))); m_eeprom = std::make_unique<gba_eeprom_device>(machine(), (UINT8*)get_nvram_base(), get_nvram_size(), 14);
} }

View File

@ -137,7 +137,7 @@ public:
virtual DECLARE_WRITE32_MEMBER(write_ram); virtual DECLARE_WRITE32_MEMBER(write_ram);
private: private:
auto_pointer<gba_eeprom_device> m_eeprom; std::unique_ptr<gba_eeprom_device> m_eeprom;
}; };
@ -157,7 +157,7 @@ public:
virtual DECLARE_WRITE32_MEMBER(write_ram); virtual DECLARE_WRITE32_MEMBER(write_ram);
private: private:
auto_pointer<gba_eeprom_device> m_eeprom; std::unique_ptr<gba_eeprom_device> m_eeprom;
}; };

View File

@ -191,7 +191,7 @@ md_eeprom_stm95_device::md_eeprom_stm95_device(const machine_config &mconfig, co
void md_eeprom_stm95_device::device_start() void md_eeprom_stm95_device::device_start()
{ {
nvram_alloc(M95320_SIZE); nvram_alloc(M95320_SIZE);
m_stm95.reset(global_alloc(stm95_eeprom_device(machine(), (UINT8*)get_nvram_base()))); m_stm95 = std::make_unique<stm95_eeprom_device>(machine(), (UINT8*)get_nvram_base());
save_item(NAME(m_rdcnt)); save_item(NAME(m_rdcnt));
save_item(NAME(m_bank)); save_item(NAME(m_bank));

View File

@ -76,7 +76,7 @@ private:
UINT8 m_bank[3]; UINT8 m_bank[3];
int m_rdcnt; int m_rdcnt;
auto_pointer<stm95_eeprom_device> m_stm95; std::unique_ptr<stm95_eeprom_device> m_stm95;
}; };

View File

@ -6,7 +6,7 @@
namespace DSP56K namespace DSP56K
{ {
// Factory // Factory
Instruction* Instruction::decodeInstruction(const Opcode* opc, std::unique_ptr<Instruction> Instruction::decodeInstruction(const Opcode* opc,
const UINT16 word0, const UINT16 word0,
const UINT16 word1, const UINT16 word1,
bool shifted) bool shifted)
@ -28,7 +28,7 @@ Instruction* Instruction::decodeInstruction(const Opcode* opc,
// Avoid "05-- 05--" recursion // Avoid "05-- 05--" recursion
if (shifted) return NULL; if (shifted) return NULL;
auto_pointer<Instruction> op(decodeInstruction(opc, w0, w1, true)); std::unique_ptr<Instruction> op = decodeInstruction(opc, w0, w1, true);
if (op) if (op)
{ {
// This parallel move only works for certain trailing instructions. // This parallel move only works for certain trailing instructions.
@ -45,7 +45,7 @@ Instruction* Instruction::decodeInstruction(const Opcode* opc,
/* TODO: More? */) /* TODO: More? */)
{ {
op->m_sizeIncrement = 1; op->m_sizeIncrement = 1;
return op; return std::move(op);
} }
} }
} }
@ -58,38 +58,38 @@ Instruction* Instruction::decodeInstruction(const Opcode* opc,
/* TFR : 011m mKKK 0rr1 F0DD : A-212 */ /* TFR : 011m mKKK 0rr1 F0DD : A-212 */
if ((w0 & 0xe094) == 0x6010) if ((w0 & 0xe094) == 0x6010)
{ {
return global_alloc(Tfr_2(opc, w0, w1)); return std::make_unique<Tfr_2>(opc, w0, w1);
} }
/* MOVE : 011m mKKK 0rr1 0000 : A-128 */ /* MOVE : 011m mKKK 0rr1 0000 : A-128 */
if ((w0 & 0xe097) == 0x6017) if ((w0 & 0xe097) == 0x6017)
{ {
return global_alloc(Move_2(opc, w0, w1)); return std::make_unique<Move_2>(opc, w0, w1);
} }
/* MAC : 011m mKKK 1xx0 F1QQ : A-122 */ /* MAC : 011m mKKK 1xx0 F1QQ : A-122 */
else if ((w0 & 0xe094) == 0x6084) else if ((w0 & 0xe094) == 0x6084)
{ {
return global_alloc(Mac_3(opc, w0, w1)); return std::make_unique<Mac_3>(opc, w0, w1);
} }
/* MACR: 011m mKKK 1--1 F1QQ : A-124 */ /* MACR: 011m mKKK 1--1 F1QQ : A-124 */
else if ((w0 & 0xe094) == 0x6094) else if ((w0 & 0xe094) == 0x6094)
{ {
return global_alloc(Macr_2(opc, w0, w1)); return std::make_unique<Macr_2>(opc, w0, w1);
} }
/* MPY : 011m mKKK 1xx0 F0QQ : A-160 */ /* MPY : 011m mKKK 1xx0 F0QQ : A-160 */
else if ((w0 & 0xe094) == 0x6080) else if ((w0 & 0xe094) == 0x6080)
{ {
return global_alloc(Mpy_2(opc, w0, w1)); return std::make_unique<Mpy_2>(opc, w0, w1);
} }
/* MPYR : 011m mKKK 1--1 F0QQ : A-162 */ /* MPYR : 011m mKKK 1--1 F0QQ : A-162 */
else if ((w0 & 0xe094) == 0x6090) else if ((w0 & 0xe094) == 0x6090)
{ {
return global_alloc(Mpyr_2(opc, w0, w1)); return std::make_unique<Mpyr_2>(opc, w0, w1);
} }
/* ADD : 011m mKKK 0rru Fuuu : A-22 */ /* ADD : 011m mKKK 0rru Fuuu : A-22 */
/* SUB : 011m mKKK 0rru Fuuu : A-202 */ /* SUB : 011m mKKK 0rru Fuuu : A-202 */
else if ((w0 & 0xe080) == 0x6000) else if ((w0 & 0xe080) == 0x6000)
{ {
return global_alloc(Add_2(opc, w0, w1)); return std::make_unique<Add_2>(opc, w0, w1);
} }
/****************************************************************************/ /****************************************************************************/
@ -99,12 +99,12 @@ Instruction* Instruction::decodeInstruction(const Opcode* opc,
/* MPY : 0001 0110 RRDD FQQQ : A-160 */ /* MPY : 0001 0110 RRDD FQQQ : A-160 */
else if ((w0 & 0xff00) == 0x1600) else if ((w0 & 0xff00) == 0x1600)
{ {
return global_alloc(Mpy_3(opc, w0, w1)); return std::make_unique<Mpy_3>(opc, w0, w1);
} }
/* MAC : 0001 0111 RRDD FQQQ : A-122 */ /* MAC : 0001 0111 RRDD FQQQ : A-122 */
else if ((w0 & 0xff00) == 0x1700) else if ((w0 & 0xff00) == 0x1700)
{ {
return global_alloc(Mac_3(opc, w0, w1)); return std::make_unique<Mac_3>(opc, w0, w1);
} }
/****************************************************************/ /****************************************************************/
@ -126,171 +126,171 @@ Instruction* Instruction::decodeInstruction(const Opcode* opc,
/* CLR : .... .... 0000 F001 : A-60 */ /* CLR : .... .... 0000 F001 : A-60 */
if ((w0 & 0x00f7) == 0x0001) if ((w0 & 0x00f7) == 0x0001)
{ {
return global_alloc(Clr(opc, w0, w1)); return std::make_unique<Clr>(opc, w0, w1);
} }
/* ADD : .... .... 0000 FJJJ : A-22 */ /* ADD : .... .... 0000 FJJJ : A-22 */
else if ((w0 & 0x00f0) == 0x0000) else if ((w0 & 0x00f0) == 0x0000)
{ {
return global_alloc(Add(opc, w0, w1)); return std::make_unique<Add>(opc, w0, w1);
} }
/* MOVE : .... .... 0001 0001 : A-128 */ /* MOVE : .... .... 0001 0001 : A-128 */
else if ((w0 & 0x00ff) == 0x0011 || (w0 & 0x00ff) == 0x0019) else if ((w0 & 0x00ff) == 0x0011 || (w0 & 0x00ff) == 0x0019)
// NEW // else if ((w0 & 0x00ff) == 0x0011) // NEW // else if ((w0 & 0x00ff) == 0x0011)
{ {
return global_alloc(Move(opc, w0, w1)); return std::make_unique<Move>(opc, w0, w1);
} }
/* TFR : .... .... 0001 FJJJ : A-212 */ /* TFR : .... .... 0001 FJJJ : A-212 */
else if ((w0 & 0x00f0) == 0x0010) else if ((w0 & 0x00f0) == 0x0010)
{ {
return global_alloc(Tfr(opc, w0, w1)); return std::make_unique<Tfr>(opc, w0, w1);
} }
/* RND : .... .... 0010 F000 : A-188 */ /* RND : .... .... 0010 F000 : A-188 */
else if ((w0 & 0x00f7) == 0x0020) else if ((w0 & 0x00f7) == 0x0020)
{ {
return global_alloc(Rnd(opc, w0, w1)); return std::make_unique<Rnd>(opc, w0, w1);
} }
/* TST : .... .... 0010 F001 : A-218 */ /* TST : .... .... 0010 F001 : A-218 */
else if ((w0 & 0x00f7) == 0x0021) else if ((w0 & 0x00f7) == 0x0021)
{ {
return global_alloc(Tst(opc, w0, w1)); return std::make_unique<Tst>(opc, w0, w1);
} }
/* INC : .... .... 0010 F010 : A-104 */ /* INC : .... .... 0010 F010 : A-104 */
else if ((w0 & 0x00f7) == 0x0022) else if ((w0 & 0x00f7) == 0x0022)
{ {
return global_alloc(Inc(opc, w0, w1)); return std::make_unique<Inc>(opc, w0, w1);
} }
/* INC24 : .... .... 0010 F011 : A-106 */ /* INC24 : .... .... 0010 F011 : A-106 */
else if ((w0 & 0x00f7) == 0x0023) else if ((w0 & 0x00f7) == 0x0023)
{ {
return global_alloc(Inc24(opc, w0, w1)); return std::make_unique<Inc24>(opc, w0, w1);
} }
/* OR : .... .... 0010 F1JJ : A-176 */ /* OR : .... .... 0010 F1JJ : A-176 */
else if ((w0 & 0x00f4) == 0x0024) else if ((w0 & 0x00f4) == 0x0024)
{ {
return global_alloc(Or(opc, w0, w1)); return std::make_unique<Or>(opc, w0, w1);
} }
/* ASR : .... .... 0011 F000 : A-32 */ /* ASR : .... .... 0011 F000 : A-32 */
else if ((w0 & 0x00f7) == 0x0030) else if ((w0 & 0x00f7) == 0x0030)
{ {
return global_alloc(Asr(opc, w0, w1)); return std::make_unique<Asr>(opc, w0, w1);
} }
/* ASL : .... .... 0011 F001 : A-28 */ /* ASL : .... .... 0011 F001 : A-28 */
else if ((w0 & 0x00f7) == 0x0031) else if ((w0 & 0x00f7) == 0x0031)
{ {
return global_alloc(Asl(opc, w0, w1)); return std::make_unique<Asl>(opc, w0, w1);
} }
/* LSR : .... .... 0011 F010 : A-120 */ /* LSR : .... .... 0011 F010 : A-120 */
else if ((w0 & 0x00f7) == 0x0032) else if ((w0 & 0x00f7) == 0x0032)
{ {
return global_alloc(Lsr(opc, w0, w1)); return std::make_unique<Lsr>(opc, w0, w1);
} }
/* LSL : .... .... 0011 F011 : A-118 */ /* LSL : .... .... 0011 F011 : A-118 */
else if ((w0 & 0x00f7) == 0x0033) else if ((w0 & 0x00f7) == 0x0033)
{ {
return global_alloc(Lsl(opc, w0, w1)); return std::make_unique<Lsl>(opc, w0, w1);
} }
/* EOR : .... .... 0011 F1JJ : A-94 */ /* EOR : .... .... 0011 F1JJ : A-94 */
else if ((w0 & 0x00f4) == 0x0034) else if ((w0 & 0x00f4) == 0x0034)
{ {
return global_alloc(Eor(opc, w0, w1)); return std::make_unique<Eor>(opc, w0, w1);
} }
/* SUBL : .... .... 0100 F001 : A-204 */ /* SUBL : .... .... 0100 F001 : A-204 */
else if ((w0 & 0x00f7) == 0x0041) else if ((w0 & 0x00f7) == 0x0041)
{ {
return global_alloc(Subl(opc, w0, w1)); return std::make_unique<Subl>(opc, w0, w1);
} }
/* SUB : .... .... 0100 FJJJ : A-202 */ /* SUB : .... .... 0100 FJJJ : A-202 */
else if ((w0 & 0x00f0) == 0x0040) else if ((w0 & 0x00f0) == 0x0040)
{ {
return global_alloc(Sub(opc, w0, w1)); return std::make_unique<Sub>(opc, w0, w1);
} }
/* CLR24 : .... .... 0101 F001 : A-62 */ /* CLR24 : .... .... 0101 F001 : A-62 */
else if ((w0 & 0x00f7) == 0x0051) else if ((w0 & 0x00f7) == 0x0051)
{ {
return global_alloc(Clr24(opc, w0, w1)); return std::make_unique<Clr24>(opc, w0, w1);
} }
/* SBC : .... .... 0101 F01J : A-198 */ /* SBC : .... .... 0101 F01J : A-198 */
else if ((w0 & 0x00f6) == 0x0052) else if ((w0 & 0x00f6) == 0x0052)
{ {
return global_alloc(Sbc(opc, w0, w1)); return std::make_unique<Sbc>(opc, w0, w1);
} }
/* CMP : .... .... 0101 FJJJ : A-64 */ /* CMP : .... .... 0101 FJJJ : A-64 */
else if ((w0 & 0x00f0) == 0x0050) else if ((w0 & 0x00f0) == 0x0050)
{ {
return global_alloc(Cmp(opc, w0, w1)); return std::make_unique<Cmp>(opc, w0, w1);
} }
/* NEG : .... .... 0110 F000 : A-166 */ /* NEG : .... .... 0110 F000 : A-166 */
else if ((w0 & 0x00f7) == 0x0060) else if ((w0 & 0x00f7) == 0x0060)
{ {
return global_alloc(Neg(opc, w0, w1)); return std::make_unique<Neg>(opc, w0, w1);
} }
/* NOT : .... .... 0110 F001 : A-174 */ /* NOT : .... .... 0110 F001 : A-174 */
else if ((w0 & 0x00f7) == 0x0061) else if ((w0 & 0x00f7) == 0x0061)
{ {
return global_alloc(Not(opc, w0, w1)); return std::make_unique<Not>(opc, w0, w1);
} }
/* DEC : .... .... 0110 F010 : A-72 */ /* DEC : .... .... 0110 F010 : A-72 */
else if ((w0 & 0x00f7) == 0x0062) else if ((w0 & 0x00f7) == 0x0062)
{ {
return global_alloc(Dec(opc, w0, w1)); return std::make_unique<Dec>(opc, w0, w1);
} }
/* DEC24 : .... .... 0110 F011 : A-74 */ /* DEC24 : .... .... 0110 F011 : A-74 */
else if ((w0 & 0x00f7) == 0x0063) else if ((w0 & 0x00f7) == 0x0063)
{ {
return global_alloc(Dec24(opc, w0, w1)); return std::make_unique<Dec24>(opc, w0, w1);
} }
/* AND : .... .... 0110 F1JJ : A-24 */ /* AND : .... .... 0110 F1JJ : A-24 */
else if ((w0 & 0x00f4) == 0x0064) else if ((w0 & 0x00f4) == 0x0064)
{ {
return global_alloc(And(opc, w0, w1)); return std::make_unique<And>(opc, w0, w1);
} }
/* ABS : .... .... 0111 F001 : A-18 */ /* ABS : .... .... 0111 F001 : A-18 */
if ((w0 & 0x00f7) == 0x0071) if ((w0 & 0x00f7) == 0x0071)
{ {
return global_alloc(Abs(opc, w0, w1)); return std::make_unique<Abs>(opc, w0, w1);
} }
/* ROR : .... .... 0111 F010 : A-192 */ /* ROR : .... .... 0111 F010 : A-192 */
else if ((w0 & 0x00f7) == 0x0072) else if ((w0 & 0x00f7) == 0x0072)
{ {
return global_alloc(Ror(opc, w0, w1)); return std::make_unique<Ror>(opc, w0, w1);
} }
/* ROL : .... .... 0111 F011 : A-190 */ /* ROL : .... .... 0111 F011 : A-190 */
else if ((w0 & 0x00f7) == 0x0073) else if ((w0 & 0x00f7) == 0x0073)
{ {
return global_alloc(Rol(opc, w0, w1)); return std::make_unique<Rol>(opc, w0, w1);
} }
/* CMPM : .... .... 0111 FJJJ : A-66 */ /* CMPM : .... .... 0111 FJJJ : A-66 */
else if ((w0 & 0x00f0) == 0x0070) else if ((w0 & 0x00f0) == 0x0070)
{ {
return global_alloc(Cmpm(opc, w0, w1)); return std::make_unique<Cmpm>(opc, w0, w1);
} }
/* MPY : .... .... 1k00 FQQQ : A-160 */ /* MPY : .... .... 1k00 FQQQ : A-160 */
else if ((w0 & 0x00b0) == 0x0080) else if ((w0 & 0x00b0) == 0x0080)
{ {
return global_alloc(Mpy(opc, w0, w1)); return std::make_unique<Mpy>(opc, w0, w1);
} }
/* MPYR : .... .... 1k01 FQQQ : A-162 */ /* MPYR : .... .... 1k01 FQQQ : A-162 */
else if ((w0 & 0x00b0) == 0x0090) else if ((w0 & 0x00b0) == 0x0090)
{ {
return global_alloc(Mpyr(opc, w0, w1)); return std::make_unique<Mpyr>(opc, w0, w1);
} }
/* MAC : .... .... 1k10 FQQQ : A-122 */ /* MAC : .... .... 1k10 FQQQ : A-122 */
else if ((w0 & 0x00b0) == 0x00a0) else if ((w0 & 0x00b0) == 0x00a0)
{ {
return global_alloc(Mac(opc, w0, w1)); return std::make_unique<Mac>(opc, w0, w1);
} }
/* MACR : .... .... 1k11 FQQQ : A-124 */ /* MACR : .... .... 1k11 FQQQ : A-124 */
else if ((w0 & 0x00b0) == 0x00b0) else if ((w0 & 0x00b0) == 0x00b0)
{ {
return global_alloc(Macr(opc, w0, w1)); return std::make_unique<Macr>(opc, w0, w1);
} }
} }
@ -300,249 +300,249 @@ Instruction* Instruction::decodeInstruction(const Opcode* opc,
/* ADC : 0001 0101 0000 F01J : A-20 */ /* ADC : 0001 0101 0000 F01J : A-20 */
else if ((w0 & 0xfff6) == 0x1502) else if ((w0 & 0xfff6) == 0x1502)
{ {
return global_alloc(Adc(opc, w0, w1)); return std::make_unique<Adc>(opc, w0, w1);
} }
/* ANDI : 0001 1EE0 iiii iiii : A-26 */ /* ANDI : 0001 1EE0 iiii iiii : A-26 */
/* Note: MoveP sneaks in here if you don't check 0x0600 */ /* Note: MoveP sneaks in here if you don't check 0x0600 */
else if (((w0 & 0xf900) == 0x1800) & ((w0 & 0x0600) != 0x0000)) else if (((w0 & 0xf900) == 0x1800) & ((w0 & 0x0600) != 0x0000))
{ {
return global_alloc(Andi(opc, w0, w1)); return std::make_unique<Andi>(opc, w0, w1);
} }
/* ASL4 : 0001 0101 0011 F001 : A-30 */ /* ASL4 : 0001 0101 0011 F001 : A-30 */
else if ((w0 & 0xfff7) == 0x1531) else if ((w0 & 0xfff7) == 0x1531)
{ {
return global_alloc(Asl4(opc, w0, w1)); return std::make_unique<Asl4>(opc, w0, w1);
} }
/* ASR4 : 0001 0101 0011 F000 : A-34 */ /* ASR4 : 0001 0101 0011 F000 : A-34 */
else if ((w0 & 0xfff7) == 0x1530) else if ((w0 & 0xfff7) == 0x1530)
{ {
return global_alloc(Asr4(opc, w0, w1)); return std::make_unique<Asr4>(opc, w0, w1);
} }
/* ASR16 : 0001 0101 0111 F000 : A-36 */ /* ASR16 : 0001 0101 0111 F000 : A-36 */
else if ((w0 & 0xfff7) == 0x1570) else if ((w0 & 0xfff7) == 0x1570)
{ {
return global_alloc(Asr16(opc, w0, w1)); return std::make_unique<Asr16>(opc, w0, w1);
} }
/* BFCHG : 0001 0100 11Pp pppp BBB1 0010 iiii iiii : A-38 */ /* BFCHG : 0001 0100 11Pp pppp BBB1 0010 iiii iiii : A-38 */
else if (((w0 & 0xffc0) == 0x14c0) && ((w1 & 0x1f00) == 0x1200)) else if (((w0 & 0xffc0) == 0x14c0) && ((w1 & 0x1f00) == 0x1200))
{ {
return global_alloc(BfInstruction(opc, w0, w1)); return std::make_unique<BfInstruction>(opc, w0, w1);
} }
/* BFCHG : 0001 0100 101- --RR BBB1 0010 iiii iiii : A-38 */ /* BFCHG : 0001 0100 101- --RR BBB1 0010 iiii iiii : A-38 */
else if (((w0 & 0xfff0) == 0x14b0) && ((w1 & 0x1f00) == 0x1200)) else if (((w0 & 0xfff0) == 0x14b0) && ((w1 & 0x1f00) == 0x1200))
// NEW // else if (((w0 & 0xffe0) == 0x14a0) && ((w1 & 0x1f00) == 0x1200)) // NEW // else if (((w0 & 0xffe0) == 0x14a0) && ((w1 & 0x1f00) == 0x1200))
{ {
return global_alloc(BfInstruction_2(opc, w0, w1)); return std::make_unique<BfInstruction_2>(opc, w0, w1);
} }
/* BFCHG : 0001 0100 100D DDDD BBB1 0010 iiii iiii : A-38 */ /* BFCHG : 0001 0100 100D DDDD BBB1 0010 iiii iiii : A-38 */
else if (((w0 & 0xffe0) == 0x1480) && ((w1 & 0x1f00) == 0x1200)) else if (((w0 & 0xffe0) == 0x1480) && ((w1 & 0x1f00) == 0x1200))
{ {
return global_alloc(BfInstruction_3(opc, w0, w1)); return std::make_unique<BfInstruction_3>(opc, w0, w1);
} }
/* BFCLR : 0001 0100 11Pp pppp BBB0 0100 iiii iiii : A-40 */ /* BFCLR : 0001 0100 11Pp pppp BBB0 0100 iiii iiii : A-40 */
else if (((w0 & 0xffc0) == 0x14c0) && ((w1 & 0x1f00) == 0x0400)) else if (((w0 & 0xffc0) == 0x14c0) && ((w1 & 0x1f00) == 0x0400))
{ {
return global_alloc(BfInstruction(opc, w0, w1)); return std::make_unique<BfInstruction>(opc, w0, w1);
} }
/* BFCLR : 0001 0100 101- --RR BBB0 0100 iiii iiii : A-40 */ /* BFCLR : 0001 0100 101- --RR BBB0 0100 iiii iiii : A-40 */
else if (((w0 & 0xfff0) == 0x14b0) && ((w1 & 0x1f00) == 0x0400)) else if (((w0 & 0xfff0) == 0x14b0) && ((w1 & 0x1f00) == 0x0400))
// NEW // else if (((w0 & 0xffe0) == 0x14a0) && ((w1 & 0x1f00) == 0x0400)) // NEW // else if (((w0 & 0xffe0) == 0x14a0) && ((w1 & 0x1f00) == 0x0400))
{ {
return global_alloc(BfInstruction_2(opc, w0, w1)); return std::make_unique<BfInstruction_2>(opc, w0, w1);
} }
/* BFCLR : 0001 0100 100D DDDD BBB0 0100 iiii iiii : A-40 */ /* BFCLR : 0001 0100 100D DDDD BBB0 0100 iiii iiii : A-40 */
else if (((w0 & 0xffe0) == 0x1480) && ((w1 & 0x1f00) == 0x0400)) else if (((w0 & 0xffe0) == 0x1480) && ((w1 & 0x1f00) == 0x0400))
{ {
return global_alloc(BfInstruction_3(opc, w0, w1)); return std::make_unique<BfInstruction_3>(opc, w0, w1);
} }
/* BFSET : 0001 0100 11Pp pppp BBB1 1000 iiii iiii : A-42 */ /* BFSET : 0001 0100 11Pp pppp BBB1 1000 iiii iiii : A-42 */
else if (((w0 & 0xffc0) == 0x14c0) && ((w1 & 0x1f00) == 0x1800)) else if (((w0 & 0xffc0) == 0x14c0) && ((w1 & 0x1f00) == 0x1800))
{ {
return global_alloc(BfInstruction(opc, w0, w1)); return std::make_unique<BfInstruction>(opc, w0, w1);
} }
/* BFSET : 0001 0100 101- --RR BBB1 1000 iiii iiii : A-42 */ /* BFSET : 0001 0100 101- --RR BBB1 1000 iiii iiii : A-42 */
else if (((w0 & 0xfff0) == 0x14b0) && ((w1 & 0x1f00) == 0x1800)) else if (((w0 & 0xfff0) == 0x14b0) && ((w1 & 0x1f00) == 0x1800))
// NEW // else if (((w0 & 0xffe0) == 0x14a0) && ((w1 & 0x1f00) == 0x1800)) // NEW // else if (((w0 & 0xffe0) == 0x14a0) && ((w1 & 0x1f00) == 0x1800))
{ {
return global_alloc(BfInstruction_2(opc, w0, w1)); return std::make_unique<BfInstruction_2>(opc, w0, w1);
} }
/* BFSET : 0001 0100 100D DDDD BBB1 1000 iiii iiii : A-42 */ /* BFSET : 0001 0100 100D DDDD BBB1 1000 iiii iiii : A-42 */
else if (((w0 & 0xffe0) == 0x1480) && ((w1 & 0x1f00) == 0x1800)) else if (((w0 & 0xffe0) == 0x1480) && ((w1 & 0x1f00) == 0x1800))
{ {
return global_alloc(BfInstruction_3(opc, w0, w1)); return std::make_unique<BfInstruction_3>(opc, w0, w1);
} }
/* BFTSTH : 0001 0100 01Pp pppp BBB1 0000 iiii iiii : A-44 */ /* BFTSTH : 0001 0100 01Pp pppp BBB1 0000 iiii iiii : A-44 */
else if (((w0 & 0xffc0) == 0x1440) && ((w1 & 0x1f00) == 0x1000)) else if (((w0 & 0xffc0) == 0x1440) && ((w1 & 0x1f00) == 0x1000))
{ {
return global_alloc(BfInstruction(opc, w0, w1)); return std::make_unique<BfInstruction>(opc, w0, w1);
} }
/* BFTSTH : 0001 0100 001- --RR BBB1 0000 iiii iiii : A-44 */ /* BFTSTH : 0001 0100 001- --RR BBB1 0000 iiii iiii : A-44 */
else if (((w0 & 0xfff0) == 0x1430) && ((w1 & 0x1f00) == 0x1000)) else if (((w0 & 0xfff0) == 0x1430) && ((w1 & 0x1f00) == 0x1000))
// NEW // else if (((w0 & 0xffe0) == 0x1420) && ((w1 & 0x1f00) == 0x1000)) // NEW // else if (((w0 & 0xffe0) == 0x1420) && ((w1 & 0x1f00) == 0x1000))
{ {
return global_alloc(BfInstruction_2(opc, w0, w1)); return std::make_unique<BfInstruction_2>(opc, w0, w1);
} }
/* BFTSTH : 0001 0100 000D DDDD BBB1 0000 iiii iiii : A-44 */ /* BFTSTH : 0001 0100 000D DDDD BBB1 0000 iiii iiii : A-44 */
else if (((w0 & 0xffe0) == 0x1400) && ((w1 & 0x1f00) == 0x1000)) else if (((w0 & 0xffe0) == 0x1400) && ((w1 & 0x1f00) == 0x1000))
{ {
return global_alloc(BfInstruction_3(opc, w0, w1)); return std::make_unique<BfInstruction_3>(opc, w0, w1);
} }
/* BFTSTL : 0001 0100 01Pp pppp BBB0 0000 iiii iiii : A-46 */ /* BFTSTL : 0001 0100 01Pp pppp BBB0 0000 iiii iiii : A-46 */
else if (((w0 & 0xffc0) == 0x1440) && ((w1 & 0x1f00) == 0x0000)) else if (((w0 & 0xffc0) == 0x1440) && ((w1 & 0x1f00) == 0x0000))
{ {
return global_alloc(BfInstruction(opc, w0, w1)); return std::make_unique<BfInstruction>(opc, w0, w1);
} }
/* BFTSTL : 0001 0100 001- --RR BBB0 0000 iiii iiii : A-46 */ /* BFTSTL : 0001 0100 001- --RR BBB0 0000 iiii iiii : A-46 */
else if (((w0 & 0xfff0) == 0x1430) && ((w1 & 0x1f00) == 0x0000)) else if (((w0 & 0xfff0) == 0x1430) && ((w1 & 0x1f00) == 0x0000))
// NEW // else if (((w0 & 0xffe0) == 0x1420) && ((w1 & 0x1f00) == 0x0000)) // NEW // else if (((w0 & 0xffe0) == 0x1420) && ((w1 & 0x1f00) == 0x0000))
{ {
return global_alloc(BfInstruction_2(opc, w0, w1)); return std::make_unique<BfInstruction_2>(opc, w0, w1);
} }
/* BFTSTL : 0001 0100 000D DDDD BBB0 0000 iiii iiii : A-46 */ /* BFTSTL : 0001 0100 000D DDDD BBB0 0000 iiii iiii : A-46 */
else if (((w0 & 0xffe0) == 0x1400) && ((w1 & 0x1f00) == 0x0000)) else if (((w0 & 0xffe0) == 0x1400) && ((w1 & 0x1f00) == 0x0000))
{ {
return global_alloc(BfInstruction_3(opc, w0, w1)); return std::make_unique<BfInstruction_3>(opc, w0, w1);
} }
/* Bcc : 0000 0111 --11 cccc xxxx xxxx xxxx xxxx : A-48 */ /* Bcc : 0000 0111 --11 cccc xxxx xxxx xxxx xxxx : A-48 */
else if (((w0 & 0xff30) == 0x0730) && ((w1 & 0x0000) == 0x0000)) else if (((w0 & 0xff30) == 0x0730) && ((w1 & 0x0000) == 0x0000))
{ {
return global_alloc(Bcc(opc, w0, w1)); return std::make_unique<Bcc>(opc, w0, w1);
} }
/* Bcc : 0010 11cc ccee eeee : A-48 */ /* Bcc : 0010 11cc ccee eeee : A-48 */
else if ((w0 & 0xfc00) == 0x2c00) else if ((w0 & 0xfc00) == 0x2c00)
{ {
return global_alloc(Bcc_2(opc, w0, w1)); return std::make_unique<Bcc_2>(opc, w0, w1);
} }
/* Bcc : 0000 0111 RR10 cccc : A-48 */ /* Bcc : 0000 0111 RR10 cccc : A-48 */
else if ((w0 & 0xff30) == 0x0720) else if ((w0 & 0xff30) == 0x0720)
{ {
return global_alloc(Bcc_3(opc, w0, w1)); return std::make_unique<Bcc_3>(opc, w0, w1);
} }
/* BRA : 0000 0001 0011 11-- xxxx xxxx xxxx xxxx : A-50 */ /* BRA : 0000 0001 0011 11-- xxxx xxxx xxxx xxxx : A-50 */
else if (((w0 & 0xfffc) == 0x013c) && ((w1 & 0x0000) == 0x0000)) else if (((w0 & 0xfffc) == 0x013c) && ((w1 & 0x0000) == 0x0000))
{ {
return global_alloc(Bra(opc, w0, w1)); return std::make_unique<Bra>(opc, w0, w1);
} }
/* BRA : 0000 1011 aaaa aaaa : A-50 */ /* BRA : 0000 1011 aaaa aaaa : A-50 */
else if ((w0 & 0xff00) == 0x0b00) else if ((w0 & 0xff00) == 0x0b00)
{ {
return global_alloc(Bra_2(opc, w0, w1)); return std::make_unique<Bra_2>(opc, w0, w1);
} }
/* BRA : 0000 0001 0010 11RR : A-50 */ /* BRA : 0000 0001 0010 11RR : A-50 */
else if ((w0 & 0xfffc) == 0x012c) else if ((w0 & 0xfffc) == 0x012c)
{ {
return global_alloc(Bra_3(opc, w0, w1)); return std::make_unique<Bra_3>(opc, w0, w1);
} }
/* BRKc : 0000 0001 0001 cccc : A-52 */ /* BRKc : 0000 0001 0001 cccc : A-52 */
else if ((w0 & 0xfff0) == 0x0110) else if ((w0 & 0xfff0) == 0x0110)
{ {
return global_alloc(Brkcc(opc, w0, w1)); return std::make_unique<Brkcc>(opc, w0, w1);
} }
/* BScc : 0000 0111 --01 cccc xxxx xxxx xxxx xxxx : A-54 */ /* BScc : 0000 0111 --01 cccc xxxx xxxx xxxx xxxx : A-54 */
else if (((w0 & 0xff30) == 0x0710) && ((w1 & 0x0000) == 0x0000)) else if (((w0 & 0xff30) == 0x0710) && ((w1 & 0x0000) == 0x0000))
{ {
return global_alloc(Bscc(opc, w0, w1)); return std::make_unique<Bscc>(opc, w0, w1);
} }
/* BScc : 0000 0111 RR00 cccc : A-54 */ /* BScc : 0000 0111 RR00 cccc : A-54 */
else if ((w0 & 0xff30) == 0x0700) else if ((w0 & 0xff30) == 0x0700)
{ {
return global_alloc(Bscc_2(opc, w0, w1)); return std::make_unique<Bscc_2>(opc, w0, w1);
} }
/* BSR : 0000 0001 0011 10-- xxxx xxxx xxxx xxxx : A-56 */ /* BSR : 0000 0001 0011 10-- xxxx xxxx xxxx xxxx : A-56 */
else if (((w0 & 0xfffc) == 0x0138) && ((w1 & 0x0000) == 0x0000)) else if (((w0 & 0xfffc) == 0x0138) && ((w1 & 0x0000) == 0x0000))
{ {
return global_alloc(Bsr(opc, w0, w1)); return std::make_unique<Bsr>(opc, w0, w1);
} }
/* BSR : 0000 0001 0010 10RR : A-56 */ /* BSR : 0000 0001 0010 10RR : A-56 */
else if ((w0 & 0xfffc) == 0x0128) else if ((w0 & 0xfffc) == 0x0128)
{ {
return global_alloc(Bsr_2(opc, w0, w1)); return std::make_unique<Bsr_2>(opc, w0, w1);
} }
/* CHKAAU : 0000 0000 0000 0100 : A-58 */ /* CHKAAU : 0000 0000 0000 0100 : A-58 */
else if ((w0 & 0xffff) == 0x0004) else if ((w0 & 0xffff) == 0x0004)
{ {
return global_alloc(Chkaau(opc, w0, w1)); return std::make_unique<Chkaau>(opc, w0, w1);
} }
/* DEBUG : 0000 0000 0000 0001 : A-68 */ /* DEBUG : 0000 0000 0000 0001 : A-68 */
else if ((w0 & 0xffff) == 0x0001) else if ((w0 & 0xffff) == 0x0001)
{ {
return global_alloc(Debug(opc, w0, w1)); return std::make_unique<Debug>(opc, w0, w1);
} }
/* DEBUGcc : 0000 0000 0101 cccc : A-70 */ /* DEBUGcc : 0000 0000 0101 cccc : A-70 */
else if ((w0 & 0xfff0) == 0x0050) else if ((w0 & 0xfff0) == 0x0050)
{ {
return global_alloc(Debugcc(opc, w0, w1)); return std::make_unique<Debugcc>(opc, w0, w1);
} }
/* DIV : 0001 0101 0--0 F1DD : A-76 */ /* DIV : 0001 0101 0--0 F1DD : A-76 */
else if ((w0 & 0xfff4) == 0x1504) else if ((w0 & 0xfff4) == 0x1504)
// NEW // else if ((w0 & 0xff94) == 0x1504) // NEW // else if ((w0 & 0xff94) == 0x1504)
{ {
return global_alloc(Div(opc, w0, w1)); return std::make_unique<Div>(opc, w0, w1);
} }
/* DMAC : 0001 0101 10s1 FsQQ : A-80 */ /* DMAC : 0001 0101 10s1 FsQQ : A-80 */
else if ((w0 & 0xffd0) == 0x1590) else if ((w0 & 0xffd0) == 0x1590)
{ {
return global_alloc(Dmac(opc, w0, w1)); return std::make_unique<Dmac>(opc, w0, w1);
} }
/* DO : 0000 0000 110- --RR xxxx xxxx xxxx xxxx : A-82 */ /* DO : 0000 0000 110- --RR xxxx xxxx xxxx xxxx : A-82 */
else if (((w0 & 0xffe0) == 0x00c0) && ((w1 & 0x0000) == 0x0000)) // Wait. Huh? else if (((w0 & 0xffe0) == 0x00c0) && ((w1 & 0x0000) == 0x0000)) // Wait. Huh?
{ {
return global_alloc(Do(opc, w0, w1)); return std::make_unique<Do>(opc, w0, w1);
} }
/* DO : 0000 1110 iiii iiii xxxx xxxx xxxx xxxx : A-82 */ /* DO : 0000 1110 iiii iiii xxxx xxxx xxxx xxxx : A-82 */
else if (((w0 & 0xff00) == 0x0e00) && ((w1 & 0x0000) == 0x0000)) // Wait. Huh? else if (((w0 & 0xff00) == 0x0e00) && ((w1 & 0x0000) == 0x0000)) // Wait. Huh?
{ {
return global_alloc(Do_2(opc, w0, w1)); return std::make_unique<Do_2>(opc, w0, w1);
} }
/* DO : 0000 0100 000D DDDD xxxx xxxx xxxx xxxx : A-82 */ /* DO : 0000 0100 000D DDDD xxxx xxxx xxxx xxxx : A-82 */
else if (((w0 & 0xffe0) == 0x0400) && ((w1 & 0x0000) == 0x0000)) // Wait. Huh? else if (((w0 & 0xffe0) == 0x0400) && ((w1 & 0x0000) == 0x0000)) // Wait. Huh?
{ {
return global_alloc(Do_3(opc, w0, w1)); return std::make_unique<Do_3>(opc, w0, w1);
} }
/* DO FOREVER : 0000 0000 0000 0010 xxxx xxxx xxxx xxxx : A-88 */ /* DO FOREVER : 0000 0000 0000 0010 xxxx xxxx xxxx xxxx : A-88 */
else if (((w0 & 0xffff) == 0x0002) && ((w1 & 0x0000) == 0x0000)) // Wait. Huh? else if (((w0 & 0xffff) == 0x0002) && ((w1 & 0x0000) == 0x0000)) // Wait. Huh?
{ {
return global_alloc(DoForever(opc, w0, w1)); return std::make_unique<DoForever>(opc, w0, w1);
} }
/* ENDDO : 0000 0000 0000 1001 : A-92 */ /* ENDDO : 0000 0000 0000 1001 : A-92 */
else if ((w0 & 0xffff) == 0x0009) else if ((w0 & 0xffff) == 0x0009)
{ {
return global_alloc(Enddo(opc, w0, w1)); return std::make_unique<Enddo>(opc, w0, w1);
} }
/* EXT : 0001 0101 0101 F010 : A-96 */ /* EXT : 0001 0101 0101 F010 : A-96 */
else if ((w0 & 0xfff7) == 0x1552) else if ((w0 & 0xfff7) == 0x1552)
{ {
return global_alloc(Ext(opc, w0, w1)); return std::make_unique<Ext>(opc, w0, w1);
} }
/* ILLEGAL : 0000 0000 0000 1111 : A-98 */ /* ILLEGAL : 0000 0000 0000 1111 : A-98 */
else if ((w0 & 0xffff) == 0x000f) else if ((w0 & 0xffff) == 0x000f)
{ {
return global_alloc(Illegal(opc, w0, w1)); return std::make_unique<Illegal>(opc, w0, w1);
} }
/* IMAC : 0001 0101 1010 FQQQ : A-100 */ /* IMAC : 0001 0101 1010 FQQQ : A-100 */
else if ((w0 & 0xfff0) == 0x15a0) else if ((w0 & 0xfff0) == 0x15a0)
{ {
return global_alloc(Imac(opc, w0, w1)); return std::make_unique<Imac>(opc, w0, w1);
} }
/* IMPY : 0001 0101 1000 FQQQ : A-102 */ /* IMPY : 0001 0101 1000 FQQQ : A-102 */
else if ((w0 & 0xfff0) == 0x1580) else if ((w0 & 0xfff0) == 0x1580)
{ {
return global_alloc(Impy(opc, w0, w1)); return std::make_unique<Impy>(opc, w0, w1);
} }
/* Jcc : 0000 0110 --11 cccc xxxx xxxx xxxx xxxx : A-108 */ /* Jcc : 0000 0110 --11 cccc xxxx xxxx xxxx xxxx : A-108 */
else if (((w0 & 0xff30) == 0x0630) && ((w1 & 0x0000) == 0x0000)) else if (((w0 & 0xff30) == 0x0630) && ((w1 & 0x0000) == 0x0000))
{ {
return global_alloc(Jcc(opc, w0, w1)); return std::make_unique<Jcc>(opc, w0, w1);
} }
/* Jcc : 0000 0110 RR10 cccc : A-108 */ /* Jcc : 0000 0110 RR10 cccc : A-108 */
else if ((w0 & 0xff30) == 0x0620 ) else if ((w0 & 0xff30) == 0x0620 )
{ {
return global_alloc(Jcc_2(opc, w0, w1)); return std::make_unique<Jcc_2>(opc, w0, w1);
} }
/* JMP : 0000 0001 0011 01-- xxxx xxxx xxxx xxxx : A-110 */ /* JMP : 0000 0001 0011 01-- xxxx xxxx xxxx xxxx : A-110 */
else if (((w0 & 0xfffc) == 0x0134) && ((w1 & 0x0000) == 0x0000)) else if (((w0 & 0xfffc) == 0x0134) && ((w1 & 0x0000) == 0x0000))
{ {
return global_alloc(Jmp(opc, w0, w1)); return std::make_unique<Jmp>(opc, w0, w1);
} }
/* JMP : 0000 0001 0010 01RR : A-110 */ /* JMP : 0000 0001 0010 01RR : A-110 */
else if ((w0 & 0xfffc) == 0x0124) else if ((w0 & 0xfffc) == 0x0124)
@ -550,233 +550,233 @@ Instruction* Instruction::decodeInstruction(const Opcode* opc,
//JMP2->m_oco = opc; //JMP2->m_oco = opc;
//JMP2->decode(w0, w1); //JMP2->decode(w0, w1);
//return JMP2; //return JMP2;
return global_alloc(Jmp_2(opc, w0, w1)); return std::make_unique<Jmp_2>(opc, w0, w1);
} }
/* JScc : 0000 0110 --01 cccc xxxx xxxx xxxx xxxx : A-112 */ /* JScc : 0000 0110 --01 cccc xxxx xxxx xxxx xxxx : A-112 */
else if (((w0 & 0xff30) == 0x0610) && ((w1 & 0x0000) == 0x0000)) else if (((w0 & 0xff30) == 0x0610) && ((w1 & 0x0000) == 0x0000))
{ {
return global_alloc(Jscc(opc, w0, w1)); return std::make_unique<Jscc>(opc, w0, w1);
} }
/* JScc : 0000 0110 RR00 cccc : A-112 */ /* JScc : 0000 0110 RR00 cccc : A-112 */
else if ((w0 & 0xff30) == 0x0600) else if ((w0 & 0xff30) == 0x0600)
{ {
return global_alloc(Jscc_2(opc, w0, w1)); return std::make_unique<Jscc_2>(opc, w0, w1);
} }
/* JSR : 0000 0001 0011 00-- xxxx xxxx xxxx xxxx : A-114 */ /* JSR : 0000 0001 0011 00-- xxxx xxxx xxxx xxxx : A-114 */
else if (((w0 & 0xfffc) == 0x0130) && ((w1 & 0x0000) == 0x0000)) else if (((w0 & 0xfffc) == 0x0130) && ((w1 & 0x0000) == 0x0000))
{ {
return global_alloc(Jsr(opc, w0, w1)); return std::make_unique<Jsr>(opc, w0, w1);
} }
/* JSR : 0000 1010 AAAA AAAA : A-114 */ /* JSR : 0000 1010 AAAA AAAA : A-114 */
else if ((w0 & 0xff00) == 0x0a00) else if ((w0 & 0xff00) == 0x0a00)
{ {
return global_alloc(Jsr_2(opc, w0, w1)); return std::make_unique<Jsr_2>(opc, w0, w1);
} }
/* JSR : 0000 0001 0010 00RR : A-114 */ /* JSR : 0000 0001 0010 00RR : A-114 */
else if ((w0 & 0xfffc) == 0x0120) else if ((w0 & 0xfffc) == 0x0120)
{ {
return global_alloc(Jsr_3(opc, w0, w1)); return std::make_unique<Jsr_3>(opc, w0, w1);
} }
/* LEA : 0000 0001 11TT MMRR : A-116 */ /* LEA : 0000 0001 11TT MMRR : A-116 */
else if ((w0 & 0xffc0) == 0x01c0) else if ((w0 & 0xffc0) == 0x01c0)
{ {
return global_alloc(Lea(opc, w0, w1)); return std::make_unique<Lea>(opc, w0, w1);
} }
/* LEA : 0000 0001 10NN MMRR : A-116 */ /* LEA : 0000 0001 10NN MMRR : A-116 */
else if ((w0 & 0xffc0) == 0x0180) else if ((w0 & 0xffc0) == 0x0180)
{ {
return global_alloc(Lea_2(opc, w0, w1)); return std::make_unique<Lea_2>(opc, w0, w1);
} }
/* MAC(su,uu) : 0001 0101 1110 FsQQ : A-126 */ /* MAC(su,uu) : 0001 0101 1110 FsQQ : A-126 */
else if ((w0 & 0xfff0) == 0x15e0) else if ((w0 & 0xfff0) == 0x15e0)
{ {
return global_alloc(Macsuuu(opc, w0, w1)); return std::make_unique<Macsuuu>(opc, w0, w1);
} }
/* MOVE : 0000 0101 BBBB BBBB ---- HHHW 0001 0001 : A-128 */ /* MOVE : 0000 0101 BBBB BBBB ---- HHHW 0001 0001 : A-128 */
// NEW // else if (((w0 & 0xff00) == 0x0500) && ((w1 & 0x00ff) == 0x0011)) // NEW // else if (((w0 & 0xff00) == 0x0500) && ((w1 & 0x00ff) == 0x0011))
// NEW // { // NEW // {
// NEW // return global_alloc(Move_3(opc, w0, w1)); // NEW // return std::make_unique<Move_3>(opc, w0, w1);
// NEW // } // NEW // }
/* MOVE(C) : 0011 1WDD DDD0 MMRR : A-144 */ /* MOVE(C) : 0011 1WDD DDD0 MMRR : A-144 */
else if ((w0 & 0xf810) == 0x3800) else if ((w0 & 0xf810) == 0x3800)
{ {
return global_alloc(Movec(opc, w0, w1)); return std::make_unique<Movec>(opc, w0, w1);
} }
/* MOVE(C) : 0011 1WDD DDD1 q0RR : A-144 */ /* MOVE(C) : 0011 1WDD DDD1 q0RR : A-144 */
else if ((w0 & 0xf814) == 0x3810) else if ((w0 & 0xf814) == 0x3810)
{ {
return global_alloc(Movec_2(opc, w0, w1)); return std::make_unique<Movec_2>(opc, w0, w1);
} }
/* MOVE(C) : 0011 1WDD DDD1 Z11- : A-144 */ /* MOVE(C) : 0011 1WDD DDD1 Z11- : A-144 */
else if ((w0 & 0xf816) == 0x3816) else if ((w0 & 0xf816) == 0x3816)
{ {
return global_alloc(Movec_3(opc, w0, w1)); return std::make_unique<Movec_3>(opc, w0, w1);
} }
/* MOVE(C) : 0011 1WDD DDD1 t10- xxxx xxxx xxxx xxxx : A-144 */ /* MOVE(C) : 0011 1WDD DDD1 t10- xxxx xxxx xxxx xxxx : A-144 */
else if (((w0 & 0xf816) == 0x3814) && ((w1 & 0x0000) == 0x0000)) else if (((w0 & 0xf816) == 0x3814) && ((w1 & 0x0000) == 0x0000))
{ {
return global_alloc(Movec_4(opc, w0, w1)); return std::make_unique<Movec_4>(opc, w0, w1);
} }
/* MOVE(C) : 0010 10dd dddD DDDD : A-144 */ /* MOVE(C) : 0010 10dd dddD DDDD : A-144 */
else if ((w0 & 0xfc00) == 0x2800) else if ((w0 & 0xfc00) == 0x2800)
{ {
return global_alloc(Movec_5(opc, w0, w1)); return std::make_unique<Movec_5>(opc, w0, w1);
} }
/* MOVE(C) : 0000 0101 BBBB BBBB 0011 1WDD DDD0 ---- : A-144 */ /* MOVE(C) : 0000 0101 BBBB BBBB 0011 1WDD DDD0 ---- : A-144 */
else if (((w0 & 0xff00) == 0x0500) && ((w1 & 0xf810) == 0x3800)) else if (((w0 & 0xff00) == 0x0500) && ((w1 & 0xf810) == 0x3800))
{ {
return global_alloc(Movec_6(opc, w0, w1)); return std::make_unique<Movec_6>(opc, w0, w1);
} }
/* MOVE(I) : 0010 00DD BBBB BBBB : A-150 */ /* MOVE(I) : 0010 00DD BBBB BBBB : A-150 */
else if ((w0 & 0xfc00) == 0x2000) else if ((w0 & 0xfc00) == 0x2000)
{ {
return global_alloc(Movei(opc, w0, w1)); return std::make_unique<Movei>(opc, w0, w1);
} }
/* MOVE(M) : 0000 001W RR0M MHHH : A-152 */ /* MOVE(M) : 0000 001W RR0M MHHH : A-152 */
else if ((w0 & 0xfe20) == 0x0200) else if ((w0 & 0xfe20) == 0x0200)
{ {
return global_alloc(Movem(opc, w0, w1)); return std::make_unique<Movem>(opc, w0, w1);
} }
/* MOVE(M) : 0000 001W RR11 mmRR : A-152 */ /* MOVE(M) : 0000 001W RR11 mmRR : A-152 */
else if ((w0 & 0xfe30) == 0x0230) else if ((w0 & 0xfe30) == 0x0230)
{ {
return global_alloc(Movem_2(opc, w0, w1)); return std::make_unique<Movem_2>(opc, w0, w1);
} }
/* MOVE(M) : 0000 0101 BBBB BBBB 0000 001W --0- -HHH : A-152 */ /* MOVE(M) : 0000 0101 BBBB BBBB 0000 001W --0- -HHH : A-152 */
else if (((w0 & 0xff00) == 0x0500) && ((w1 & 0xfe20) == 0x0200)) else if (((w0 & 0xff00) == 0x0500) && ((w1 & 0xfe20) == 0x0200))
{ {
return global_alloc(Movem_3(opc, w0, w1)); return std::make_unique<Movem_3>(opc, w0, w1);
} }
/* MOVE(P) : 0001 100W HH1p pppp : A-156 */ /* MOVE(P) : 0001 100W HH1p pppp : A-156 */
else if ((w0 & 0xfe20) == 0x1820) else if ((w0 & 0xfe20) == 0x1820)
{ {
return global_alloc(Movep(opc, w0, w1)); return std::make_unique<Movep>(opc, w0, w1);
} }
/* MOVE(P) : 0000 110W RRmp pppp : A-156 */ /* MOVE(P) : 0000 110W RRmp pppp : A-156 */
else if ((w0 & 0xfe00) == 0x0c00) else if ((w0 & 0xfe00) == 0x0c00)
{ {
return global_alloc(Movep_2(opc, w0, w1)); return std::make_unique<Movep_2>(opc, w0, w1);
} }
/* MOVE(S) : 0001 100W HH0a aaaa : A-158 */ /* MOVE(S) : 0001 100W HH0a aaaa : A-158 */
else if ((w0 & 0xfe20) == 0x1800) else if ((w0 & 0xfe20) == 0x1800)
{ {
return global_alloc(Moves(opc, w0, w1)); return std::make_unique<Moves>(opc, w0, w1);
} }
/* MPY(su,uu) : 0001 0101 1100 FsQQ : A-164 */ /* MPY(su,uu) : 0001 0101 1100 FsQQ : A-164 */
else if ((w0 & 0xfff0) == 0x15c0) else if ((w0 & 0xfff0) == 0x15c0)
{ {
return global_alloc(Mpysuuu(opc, w0, w1)); return std::make_unique<Mpysuuu>(opc, w0, w1);
} }
/* NEGC : 0001 0101 0110 F000 : A-168 */ /* NEGC : 0001 0101 0110 F000 : A-168 */
else if ((w0 & 0xfff7) == 0x1560) else if ((w0 & 0xfff7) == 0x1560)
{ {
return global_alloc(Negc(opc, w0, w1)); return std::make_unique<Negc>(opc, w0, w1);
} }
/* NOP : 0000 0000 0000 0000 : A-170 */ /* NOP : 0000 0000 0000 0000 : A-170 */
else if ((w0 & 0xffff) == 0x0000) else if ((w0 & 0xffff) == 0x0000)
{ {
return global_alloc(Nop(opc, w0, w1)); return std::make_unique<Nop>(opc, w0, w1);
} }
/* NORM : 0001 0101 0010 F0RR : A-172 */ /* NORM : 0001 0101 0010 F0RR : A-172 */
else if ((w0 & 0xfff4) == 0x1520) else if ((w0 & 0xfff4) == 0x1520)
{ {
return global_alloc(Norm(opc, w0, w1)); return std::make_unique<Norm>(opc, w0, w1);
} }
/* ORI : 0001 1EE1 iiii iiii : A-178 */ /* ORI : 0001 1EE1 iiii iiii : A-178 */
else if ((w0 & 0xf900) == 0x1900) else if ((w0 & 0xf900) == 0x1900)
{ {
return global_alloc(Ori(opc, w0, w1)); return std::make_unique<Ori>(opc, w0, w1);
} }
/* REP : 0000 0000 111- --RR : A-180 */ /* REP : 0000 0000 111- --RR : A-180 */
else if ((w0 & 0xffe0) == 0x00e0) else if ((w0 & 0xffe0) == 0x00e0)
{ {
return global_alloc(Rep(opc, w0, w1)); return std::make_unique<Rep>(opc, w0, w1);
} }
/* REP : 0000 1111 iiii iiii : A-180 */ /* REP : 0000 1111 iiii iiii : A-180 */
else if ((w0 & 0xff00) == 0x0f00) else if ((w0 & 0xff00) == 0x0f00)
{ {
return global_alloc(Rep_2(opc, w0, w1)); return std::make_unique<Rep_2>(opc, w0, w1);
} }
/* REP : 0000 0100 001D DDDD : A-180 */ /* REP : 0000 0100 001D DDDD : A-180 */
else if ((w0 & 0xffe0) == 0x0420) else if ((w0 & 0xffe0) == 0x0420)
{ {
return global_alloc(Rep_3(opc, w0, w1)); return std::make_unique<Rep_3>(opc, w0, w1);
} }
/* REPcc : 0000 0001 0101 cccc : A-184 */ /* REPcc : 0000 0001 0101 cccc : A-184 */
else if ((w0 & 0xfff0) == 0x0150) else if ((w0 & 0xfff0) == 0x0150)
{ {
return global_alloc(Repcc(opc, w0, w1)); return std::make_unique<Repcc>(opc, w0, w1);
} }
/* RESET : 0000 0000 0000 1000 : A-186 */ /* RESET : 0000 0000 0000 1000 : A-186 */
else if ((w0 & 0xffff) == 0x0008) else if ((w0 & 0xffff) == 0x0008)
{ {
return global_alloc(Reset(opc, w0, w1)); return std::make_unique<Reset>(opc, w0, w1);
} }
/* RTI : 0000 0000 0000 0111 : A-194 */ /* RTI : 0000 0000 0000 0111 : A-194 */
else if ((w0 & 0xffff) == 0x0007) else if ((w0 & 0xffff) == 0x0007)
{ {
return global_alloc(Rti(opc, w0, w1)); return std::make_unique<Rti>(opc, w0, w1);
} }
/* RTS : 0000 0000 0000 0110 : A-196 */ /* RTS : 0000 0000 0000 0110 : A-196 */
else if ((w0 & 0xffff) == 0x0006) else if ((w0 & 0xffff) == 0x0006)
{ {
return global_alloc(Rts(opc, w0, w1)); return std::make_unique<Rts>(opc, w0, w1);
} }
/* STOP : 0000 0000 0000 1010 : A-200 */ /* STOP : 0000 0000 0000 1010 : A-200 */
else if ((w0 & 0xffff) == 0x000a) else if ((w0 & 0xffff) == 0x000a)
{ {
return global_alloc(Stop(opc, w0, w1)); return std::make_unique<Stop>(opc, w0, w1);
} }
/* SWAP : 0001 0101 0111 F001 : A-206 */ /* SWAP : 0001 0101 0111 F001 : A-206 */
else if ((w0 & 0xfff7) == 0x1571) else if ((w0 & 0xfff7) == 0x1571)
{ {
return global_alloc(Swap(opc, w0, w1)); return std::make_unique<Swap>(opc, w0, w1);
} }
/* SWI : 0000 0000 0000 0101 : A-208 */ /* SWI : 0000 0000 0000 0101 : A-208 */
else if ((w0 & 0xffff) == 0x0005) else if ((w0 & 0xffff) == 0x0005)
{ {
return global_alloc(Swi(opc, w0, w1)); return std::make_unique<Swi>(opc, w0, w1);
} }
/* Tcc : 0001 00cc ccTT Fh0h : A-210 */ /* Tcc : 0001 00cc ccTT Fh0h : A-210 */
else if ((w0 & 0xfc02) == 0x1000) else if ((w0 & 0xfc02) == 0x1000)
{ {
return global_alloc(Tcc(opc, w0, w1)); return std::make_unique<Tcc>(opc, w0, w1);
} }
/* TFR(2) : 0001 0101 0000 F00J : A-214 */ /* TFR(2) : 0001 0101 0000 F00J : A-214 */
else if ((w0 & 0xfff6) == 0x1500) else if ((w0 & 0xfff6) == 0x1500)
{ {
return global_alloc(Tfr2(opc, w0, w1)); return std::make_unique<Tfr2>(opc, w0, w1);
} }
/* TFR(3) : 0010 01mW RRDD FHHH : A-216 */ /* TFR(3) : 0010 01mW RRDD FHHH : A-216 */
else if ((w0 & 0xfc00) == 0x2400) else if ((w0 & 0xfc00) == 0x2400)
{ {
return global_alloc(Tfr3(opc, w0, w1)); return std::make_unique<Tfr3>(opc, w0, w1);
} }
/* TST(2) : 0001 0101 0001 -1DD : A-220 */ /* TST(2) : 0001 0101 0001 -1DD : A-220 */
else if ((w0 & 0xfffc) == 0x1514) else if ((w0 & 0xfffc) == 0x1514)
// NEW // else if ((w0 & 0xfff4) == 0x1514) // NEW // else if ((w0 & 0xfff4) == 0x1514)
{ {
return global_alloc(Tst2(opc, w0, w1)); return std::make_unique<Tst2>(opc, w0, w1);
} }
/* WAIT : 0000 0000 0000 1011 : A-222 */ /* WAIT : 0000 0000 0000 1011 : A-222 */
else if ((w0 & 0xffff) == 0x000b) else if ((w0 & 0xffff) == 0x000b)
{ {
return global_alloc(Wait(opc, w0, w1)); return std::make_unique<Wait>(opc, w0, w1);
} }
/* ZERO : 0001 0101 0101 F000 : A-224 */ /* ZERO : 0001 0101 0101 F000 : A-224 */
else if ((w0 & 0xfff7) == 0x1550) else if ((w0 & 0xfff7) == 0x1550)
{ {
return global_alloc(Zero(opc, w0, w1)); return std::make_unique<Zero>(opc, w0, w1);
} }
/* SHFL : 0001 0101 1101 FQQQ : !!UNDOCUMENTED!! */ /* SHFL : 0001 0101 1101 FQQQ : !!UNDOCUMENTED!! */
else if ((w0 & 0xfff0) == 0x15d0) else if ((w0 & 0xfff0) == 0x15d0)
{ {
return global_alloc(Shfl(opc, w0, w1)); return std::make_unique<Shfl>(opc, w0, w1);
} }
/* SHFR : 0001 0101 1111 FQQQ : !!UNDOCUMENTED!! */ /* SHFR : 0001 0101 1111 FQQQ : !!UNDOCUMENTED!! */
else if ((w0 & 0xfff0) == 0x15f0) else if ((w0 & 0xfff0) == 0x15f0)
{ {
return global_alloc(Shfr(opc, w0, w1)); return std::make_unique<Shfr>(opc, w0, w1);
} }
return NULL; return NULL;

View File

@ -39,7 +39,7 @@ public:
virtual size_t accumulatorBitsModified() const = 0; // Potentially make this always return ALL (like flags) virtual size_t accumulatorBitsModified() const = 0; // Potentially make this always return ALL (like flags)
virtual size_t flags() const { return 0; } virtual size_t flags() const { return 0; }
static Instruction* decodeInstruction(const Opcode* opc, static std::unique_ptr<Instruction> decodeInstruction(const Opcode* opc,
const UINT16 word0, const UINT16 word0,
const UINT16 word1, const UINT16 word1,
bool shifted=false); bool shifted=false);

View File

@ -8,8 +8,8 @@ namespace DSP56K
{ {
Opcode::Opcode(UINT16 w0, UINT16 w1) : m_word0(w0)/*, m_word1(w1)*/ Opcode::Opcode(UINT16 w0, UINT16 w1) : m_word0(w0)/*, m_word1(w1)*/
{ {
m_instruction.reset(Instruction::decodeInstruction(this, w0, w1)); m_instruction = std::move(Instruction::decodeInstruction(this, w0, w1));
m_parallelMove.reset(ParallelMove::decodeParallelMove(this, w0, w1)); m_parallelMove = std::move(ParallelMove::decodeParallelMove(this, w0, w1));
} }

View File

@ -34,8 +34,8 @@ public:
size_t instAccumulatorBitsModified() const; size_t instAccumulatorBitsModified() const;
private: private:
auto_pointer<Instruction> m_instruction; std::unique_ptr<Instruction> m_instruction;
auto_pointer<ParallelMove> m_parallelMove; std::unique_ptr<ParallelMove> m_parallelMove;
UINT16 m_word0; UINT16 m_word0;
//UINT16 m_word1; //UINT16 m_word1;

View File

@ -9,7 +9,7 @@ const reg_id& ParallelMove::opDestination() const { return m_oco->instDestinatio
size_t ParallelMove::opAccumulatorBitsModified() const { return m_oco->instAccumulatorBitsModified(); } size_t ParallelMove::opAccumulatorBitsModified() const { return m_oco->instAccumulatorBitsModified(); }
ParallelMove* ParallelMove::decodeParallelMove(const Opcode* opc, const UINT16 word0, const UINT16 word1) std::unique_ptr<ParallelMove> ParallelMove::decodeParallelMove(const Opcode* opc, const UINT16 word0, const UINT16 word1)
{ {
const UINT16 w0 = word0; const UINT16 w0 = word0;
const UINT16 w1 = word1; const UINT16 w1 = word1;
@ -17,12 +17,12 @@ ParallelMove* ParallelMove::decodeParallelMove(const Opcode* opc, const UINT16 w
/* Dual X Memory Data Read : 011m mKKK .rr. .... : A-142*/ /* Dual X Memory Data Read : 011m mKKK .rr. .... : A-142*/
if ((w0 & 0xe000) == 0x6000) if ((w0 & 0xe000) == 0x6000)
{ {
return global_alloc(DualXMemoryDataRead(opc, w0, w1)); return std::make_unique<DualXMemoryDataRead>(opc, w0, w1);
} }
/* X Memory Data Write and Register Data Move : 0001 011k RRDD .... : A-140 */ /* X Memory Data Write and Register Data Move : 0001 011k RRDD .... : A-140 */
else if ((w0 & 0xfe00) == 0x1600) else if ((w0 & 0xfe00) == 0x1600)
{ {
return global_alloc(XMemoryDataWriteAndRegisterDataMove(opc, w0, w1)); return std::make_unique<XMemoryDataWriteAndRegisterDataMove>(opc, w0, w1);
} }
else else
{ {
@ -37,22 +37,22 @@ ParallelMove* ParallelMove::decodeParallelMove(const Opcode* opc, const UINT16 w
/* Register to Register Data Move : 0100 IIII .... .... : A-133 */ /* Register to Register Data Move : 0100 IIII .... .... : A-133 */
else if ((w0 & 0xf000) == 0x4000) else if ((w0 & 0xf000) == 0x4000)
{ {
return global_alloc(RegisterToRegisterDataMove(opc, w0, w1)); return std::make_unique<RegisterToRegisterDataMove>(opc, w0, w1);
} }
/* Address Register Update : 0011 0zRR .... .... : A-135 */ /* Address Register Update : 0011 0zRR .... .... : A-135 */
else if ((w0 & 0xf800) == 0x3000) else if ((w0 & 0xf800) == 0x3000)
{ {
return global_alloc(AddressRegisterUpdate(opc, w0, w1)); return std::make_unique<AddressRegisterUpdate>(opc, w0, w1);
} }
/* X Memory Data Move : 1mRR HHHW .... .... : A-137 */ /* X Memory Data Move : 1mRR HHHW .... .... : A-137 */
else if ((w0 & 0x8000) == 0x8000) else if ((w0 & 0x8000) == 0x8000)
{ {
return global_alloc(XMemoryDataMove(opc, w0, w1)); return std::make_unique<XMemoryDataMove>(opc, w0, w1);
} }
/* X Memory Data Move : 0101 HHHW .... .... : A-137 */ /* X Memory Data Move : 0101 HHHW .... .... : A-137 */
else if ((w0 & 0xf000) == 0x5000) else if ((w0 & 0xf000) == 0x5000)
{ {
return global_alloc(XMemoryDataMove_2(opc, w0, w1)); return std::make_unique<XMemoryDataMove_2>(opc, w0, w1);
} }
/* X Memory Data Move with short displacement : 0000 0101 BBBB BBBB ---- HHHW .... .... : A-139 */ /* X Memory Data Move with short displacement : 0000 0101 BBBB BBBB ---- HHHW .... .... : A-139 */
else if ((w0 & 0xff00) == 0x0500) else if ((w0 & 0xff00) == 0x0500)
@ -68,12 +68,12 @@ ParallelMove* ParallelMove::decodeParallelMove(const Opcode* opc, const UINT16 w
((w1 & 0xf810) != 0x3800) && ((w1 & 0xf810) != 0x3800) &&
((w1 & 0x00ff) != 0x0011)) ((w1 & 0x00ff) != 0x0011))
{ {
return global_alloc(XMemoryDataMoveWithShortDisplacement(opc, w0, w1)); return std::make_unique<XMemoryDataMoveWithShortDisplacement>(opc, w0, w1);
} }
} }
} }
return NULL; return nullptr;
} }
} }

View File

@ -24,7 +24,7 @@ public:
virtual void disassemble(std::string& retString) const = 0; virtual void disassemble(std::string& retString) const = 0;
virtual void evaluate() = 0; virtual void evaluate() = 0;
static ParallelMove* decodeParallelMove(const Opcode* opc, const UINT16 word0, const UINT16 word1); static std::unique_ptr<ParallelMove> decodeParallelMove(const Opcode* opc, const UINT16 word0, const UINT16 word1);
bool valid() const { return m_valid; } bool valid() const { return m_valid; }

View File

@ -682,10 +682,6 @@ void cheat_script::script_entry::output_argument::save(emu_file &cheatfile) cons
cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, const char *filename, xml_data_node &cheatnode) cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, const char *filename, xml_data_node &cheatnode)
: m_manager(manager), : m_manager(manager),
m_next(NULL), m_next(NULL),
m_on_script(NULL),
m_off_script(NULL),
m_change_script(NULL),
m_run_script(NULL),
m_symbols(&manager.machine(), &globaltable), m_symbols(&manager.machine(), &globaltable),
m_state(SCRIPT_STATE_OFF), m_state(SCRIPT_STATE_OFF),
m_numtemp(DEFAULT_TEMP_VARIABLES), m_numtemp(DEFAULT_TEMP_VARIABLES),
@ -750,8 +746,8 @@ cheat_entry::cheat_entry(cheat_manager &manager, symbol_table &globaltable, cons
cheat_script *curscript = global_alloc(cheat_script(manager, m_symbols, filename, *scriptnode)); cheat_script *curscript = global_alloc(cheat_script(manager, m_symbols, filename, *scriptnode));
// if we have a script already for this slot, it is an error // if we have a script already for this slot, it is an error
auto_pointer<cheat_script> &slot = script_for_state(curscript->state()); std::unique_ptr<cheat_script> &slot = script_for_state(curscript->state());
if (slot != NULL) if (slot != nullptr)
osd_printf_warning("%s.xml(%d): only one on script allowed; ignoring additional scripts\n", filename, scriptnode->line); osd_printf_warning("%s.xml(%d): only one on script allowed; ignoring additional scripts\n", filename, scriptnode->line);
else else
slot.reset(curscript); slot.reset(curscript);
@ -1028,7 +1024,7 @@ bool cheat_entry::set_state(script_state newstate)
// given script pointer // given script pointer
//------------------------------------------------- //-------------------------------------------------
auto_pointer<cheat_script> &cheat_entry::script_for_state(script_state state) std::unique_ptr<cheat_script> &cheat_entry::script_for_state(script_state state)
{ {
switch (state) switch (state)
{ {

View File

@ -260,18 +260,18 @@ public:
private: private:
// internal helpers // internal helpers
bool set_state(script_state newstate); bool set_state(script_state newstate);
auto_pointer<cheat_script> &script_for_state(script_state state); std::unique_ptr<cheat_script> &script_for_state(script_state state);
// internal state // internal state
cheat_manager & m_manager; // reference to our manager cheat_manager & m_manager; // reference to our manager
cheat_entry * m_next; // next cheat entry cheat_entry * m_next; // next cheat entry
std::string m_description; // string description/menu title std::string m_description; // string description/menu title
std::string m_comment; // comment data std::string m_comment; // comment data
auto_pointer<cheat_parameter> m_parameter; // parameter std::unique_ptr<cheat_parameter> m_parameter; // parameter
auto_pointer<cheat_script> m_on_script; // script to run when turning on std::unique_ptr<cheat_script> m_on_script; // script to run when turning on
auto_pointer<cheat_script> m_off_script; // script to run when turning off std::unique_ptr<cheat_script> m_off_script; // script to run when turning off
auto_pointer<cheat_script> m_change_script; // script to run when value changes std::unique_ptr<cheat_script> m_change_script; // script to run when value changes
auto_pointer<cheat_script> m_run_script; // script to run each frame when on std::unique_ptr<cheat_script> m_run_script; // script to run each frame when on
symbol_table m_symbols; // symbol table for this cheat symbol_table m_symbols; // symbol table for this cheat
script_state m_state; // current cheat state script_state m_state; // current cheat state
UINT32 m_numtemp; // number of temporary variables UINT32 m_numtemp; // number of temporary variables

View File

@ -271,14 +271,14 @@ public:
for (int index = 0; index < _Count; index++) for (int index = 0; index < _Count; index++)
{ {
strformat(m_tag[index], "%s.%d", basetag, index); strformat(m_tag[index], "%s.%d", basetag, index);
m_array[index].reset(global_alloc(ioport_finder_type(base, m_tag[index].c_str()))); m_array[index] = std::make_unique<ioport_finder_type>(base, m_tag[index].c_str());
} }
} }
ioport_array_finder(device_t &base, const char * const *tags) ioport_array_finder(device_t &base, const char * const *tags)
{ {
for (int index = 0; index < _Count; index++) for (int index = 0; index < _Count; index++)
m_array[index].reset(global_alloc(ioport_finder_type(base, tags[index]))); m_array[index] = std::make_unique<ioport_finder_type>(base, tags[index]);
} }
// array accessors // array accessors
@ -287,7 +287,7 @@ public:
protected: protected:
// internal state // internal state
auto_pointer<ioport_finder_type> m_array[_Count]; std::unique_ptr<ioport_finder_type> m_array[_Count];
std::string m_tag[_Count]; std::string m_tag[_Count];
}; };
@ -442,7 +442,7 @@ public:
for (int index = 0; index < _Count; index++) for (int index = 0; index < _Count; index++)
{ {
strformat(m_tag[index],"%s.%d", basetag, index); strformat(m_tag[index],"%s.%d", basetag, index);
m_array[index].reset(global_alloc(shared_ptr_type(base, m_tag[index].c_str(), width))); m_array[index] = std::make_unique<shared_ptr_type>(base, m_tag[index].c_str(), width);
} }
} }
@ -452,7 +452,7 @@ public:
protected: protected:
// internal state // internal state
auto_pointer<shared_ptr_type> m_array[_Count]; std::unique_ptr<shared_ptr_type> m_array[_Count];
std::string m_tag[_Count]; std::string m_tag[_Count];
}; };

View File

@ -384,7 +384,7 @@ void device_t::start()
// if we're debugging, create a device_debug object // if we're debugging, create a device_debug object
if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0) if ((machine().debug_flags & DEBUG_FLAG_ENABLED) != 0)
{ {
m_debug.reset(global_alloc(device_debug(*this))); m_debug = std::make_unique<device_debug>(*this);
debug_setup(); debug_setup();
} }

View File

@ -197,7 +197,7 @@ public:
void ATTR_COLD save_pointer(_ItemType *value, const char *valname, UINT32 count, int index = 0) { assert(m_save != NULL); m_save->save_pointer(this, name(), tag(), index, value, valname, count); } void ATTR_COLD save_pointer(_ItemType *value, const char *valname, UINT32 count, int index = 0) { assert(m_save != NULL); m_save->save_pointer(this, name(), tag(), index, value, valname, count); }
// debugging // debugging
device_debug *debug() const { return m_debug; } device_debug *debug() const { return m_debug.get(); }
offs_t safe_pc() const; offs_t safe_pc() const;
offs_t safe_pcbase() const; offs_t safe_pcbase() const;
@ -267,7 +267,7 @@ protected:
double m_clock_scale; // clock scale factor double m_clock_scale; // clock scale factor
attoseconds_t m_attoseconds_per_clock;// period in attoseconds attoseconds_t m_attoseconds_per_clock;// period in attoseconds
auto_pointer<device_debug> m_debug; std::unique_ptr<device_debug> m_debug;
memory_region * m_region; // our device-local region memory_region * m_region; // our device-local region
const machine_config & m_machine_config; // reference to the machine's configuration const machine_config & m_machine_config; // reference to the machine's configuration
const void * m_static_config; // static device configuration const void * m_static_config; // static device configuration

View File

@ -276,7 +276,7 @@ void device_gfx_interface::decode_gfx(const gfx_decode_entry *gfxdecodeinfo)
} }
// allocate the graphics // allocate the graphics
m_gfx[curgfx].reset(global_alloc(gfx_element(m_palette, glcopy, (region_base != NULL) ? region_base + gfx.start : NULL, xormask, gfx.total_color_codes, gfx.color_codes_start))); m_gfx[curgfx] = std::make_unique<gfx_element>(m_palette, glcopy, (region_base != NULL) ? region_base + gfx.start : NULL, xormask, gfx.total_color_codes, gfx.color_codes_start);
} }
m_decoded = true; m_decoded = true;

View File

@ -200,7 +200,7 @@ public:
// getters // getters
palette_device *palette() const { return m_palette; } palette_device *palette() const { return m_palette; }
gfx_element *gfx(int index) const { assert(index < MAX_GFX_ELEMENTS); return m_gfx[index]; } gfx_element *gfx(int index) const { assert(index < MAX_GFX_ELEMENTS); return m_gfx[index].get(); }
// decoding // decoding
void decode_gfx(const gfx_decode_entry *gfxdecodeinfo); void decode_gfx(const gfx_decode_entry *gfxdecodeinfo);
@ -215,7 +215,7 @@ protected:
virtual void interface_post_start(); virtual void interface_post_start();
palette_device * m_palette; // pointer to the palette device palette_device * m_palette; // pointer to the palette device
auto_pointer<gfx_element> m_gfx[MAX_GFX_ELEMENTS]; // array of pointers to graphic sets std::unique_ptr<gfx_element> m_gfx[MAX_GFX_ELEMENTS]; // array of pointers to graphic sets
private: private:
// configuration // configuration

View File

@ -26,7 +26,7 @@ protected:
bool m_promisc; bool m_promisc;
char m_mac[6]; char m_mac[6];
float m_bandwidth; float m_bandwidth;
auto_pointer<class osd_netdev> m_dev; std::unique_ptr<osd_netdev> m_dev;
int m_intf; int m_intf;
}; };

View File

@ -189,17 +189,7 @@ machine_config &driver_enumerator::config(int index, emu_options &options) const
// if we don't have it cached, add it // if we don't have it cached, add it
if (m_config[index] == NULL) if (m_config[index] == NULL)
{ {
// if our cache is full, release the head entry m_config[index] = std::make_unique<machine_config>(*s_drivers_sorted[index], options);
if (m_config_cache.count() == CONFIG_CACHE_COUNT)
{
config_entry *first = m_config_cache.first();
m_config[first->index()] = NULL;
m_config_cache.remove(*first);
}
// allocate the config and add it to the end of the list
machine_config *config = m_config[index] = global_alloc(machine_config(*s_drivers_sorted[index], options));
m_config_cache.append(*global_alloc(config_entry(*config, index)));
} }
return *m_config[index]; return *m_config[index];
} }

View File

@ -119,36 +119,12 @@ private:
// internal helpers // internal helpers
void release_current() const; void release_current() const;
// entry in the config cache
struct config_entry
{
friend class simple_list<config_entry>;
public:
// construction/destruction
config_entry(machine_config &config, int index) : m_next(NULL), m_config(&config), m_index(index) { }
// getters
config_entry *next() const { return m_next; }
int index() const { return m_index; }
machine_config *config() const { return m_config; }
private:
// internal state
config_entry * m_next;
auto_pointer<machine_config> m_config;
int m_index;
};
static const int CONFIG_CACHE_COUNT = 100;
// internal state // internal state
int m_current; int m_current;
int m_filtered_count; int m_filtered_count;
emu_options & m_options; emu_options & m_options;
std::vector<UINT8> m_included; std::vector<UINT8> m_included;
mutable std::vector<machine_config *> m_config; mutable std::vector<std::unique_ptr<machine_config>> m_config;
mutable simple_list<config_entry> m_config_cache;
}; };
#endif #endif

View File

@ -20,6 +20,11 @@
#ifndef __EMU_H__ #ifndef __EMU_H__
#define __EMU_H__ #define __EMU_H__
#include <stdio.h> // must be here otherwise issues with I64FMT in MINGW
#include <list>
#include <vector>
#include <memory>
// core emulator headers -- must be first // core emulator headers -- must be first
#include "emucore.h" #include "emucore.h"
#include "eminline.h" #include "eminline.h"

View File

@ -843,28 +843,26 @@ input_item_id input_device::add_item(const char *name, input_item_id itemid, ite
assert(m_item[itemid] == NULL); assert(m_item[itemid] == NULL);
// determine the class and create the appropriate item class // determine the class and create the appropriate item class
input_device_item *item;
switch (m_class.standard_item_class(originalid)) switch (m_class.standard_item_class(originalid))
{ {
case ITEM_CLASS_SWITCH: case ITEM_CLASS_SWITCH:
item = global_alloc(input_device_switch_item(*this, name, internal, itemid, getstate)); m_item[itemid] = std::make_unique<input_device_switch_item>(*this, name, internal, itemid, getstate);
break; break;
case ITEM_CLASS_RELATIVE: case ITEM_CLASS_RELATIVE:
item = global_alloc(input_device_relative_item(*this, name, internal, itemid, getstate)); m_item[itemid] = std::make_unique<input_device_relative_item>(*this, name, internal, itemid, getstate);
break; break;
case ITEM_CLASS_ABSOLUTE: case ITEM_CLASS_ABSOLUTE:
item = global_alloc(input_device_absolute_item(*this, name, internal, itemid, getstate)); m_item[itemid] = std::make_unique<input_device_absolute_item>(*this, name, internal, itemid, getstate);
break; break;
default: default:
item = NULL; m_item[itemid] = nullptr;
assert(false); assert(false);
} }
// assign the new slot and update the maximum // assign the new slot and update the maximum
m_item[itemid].reset(item);
m_maxitem = MAX(m_maxitem, itemid); m_maxitem = MAX(m_maxitem, itemid);
return itemid; return itemid;
} }
@ -922,7 +920,7 @@ void input_device::apply_steadykey() const
bool anything_changed = false; bool anything_changed = false;
for (input_item_id itemid = ITEM_ID_FIRST_VALID; itemid <= m_maxitem; ++itemid) for (input_item_id itemid = ITEM_ID_FIRST_VALID; itemid <= m_maxitem; ++itemid)
{ {
input_device_item *item = m_item[itemid]; input_device_item *item = m_item[itemid].get();
if (item != NULL && item->itemclass() == ITEM_CLASS_SWITCH) if (item != NULL && item->itemclass() == ITEM_CLASS_SWITCH)
if (downcast<input_device_switch_item *>(item)->steadykey_changed()) if (downcast<input_device_switch_item *>(item)->steadykey_changed())
anything_changed = true; anything_changed = true;
@ -932,7 +930,7 @@ void input_device::apply_steadykey() const
if (!anything_changed) if (!anything_changed)
for (input_item_id itemid = ITEM_ID_FIRST_VALID; itemid <= m_maxitem; ++itemid) for (input_item_id itemid = ITEM_ID_FIRST_VALID; itemid <= m_maxitem; ++itemid)
{ {
input_device_item *item = m_item[itemid]; input_device_item *item = m_item[itemid].get();
if (item != NULL && item->itemclass() == ITEM_CLASS_SWITCH) if (item != NULL && item->itemclass() == ITEM_CLASS_SWITCH)
downcast<input_device_switch_item *>(item)->steadykey_update_to_current(); downcast<input_device_switch_item *>(item)->steadykey_update_to_current();
} }
@ -985,13 +983,13 @@ input_device *input_class::add_device(int devindex, const char *name, void *inte
assert(m_device[devindex] == NULL); assert(m_device[devindex] == NULL);
// allocate a new device // allocate a new device
m_device[devindex].reset(global_alloc(input_device(*this, devindex, name, internal))); m_device[devindex] = std::make_unique<input_device>(*this, devindex, name, internal);
// update the maximum index found // update the maximum index found
m_maxindex = MAX(m_maxindex, devindex); m_maxindex = MAX(m_maxindex, devindex);
osd_printf_verbose("Input: Adding %s #%d: %s\n", (*devclass_string_table)[m_devclass], devindex, name); osd_printf_verbose("Input: Adding %s #%d: %s\n", (*devclass_string_table)[m_devclass], devindex, name);
return m_device[devindex]; return m_device[devindex].get();
} }

View File

@ -540,10 +540,9 @@ class input_device
{ {
friend class input_class; friend class input_class;
public:
// construction/destruction // construction/destruction
input_device(input_class &_class, int _devindex, const char *_name, void *_internal); input_device(input_class &_class, int _devindex, const char *_name, void *_internal);
public:
// getters // getters
input_class &device_class() const { return m_class; } input_class &device_class() const { return m_class; }
input_manager &manager() const; input_manager &manager() const;
@ -551,7 +550,7 @@ public:
input_device_class devclass() const; input_device_class devclass() const;
const char *name() const { return m_name.c_str(); } const char *name() const { return m_name.c_str(); }
int devindex() const { return m_devindex; } int devindex() const { return m_devindex; }
input_device_item *item(input_item_id index) const { return m_item[index]; } input_device_item *item(input_item_id index) const { return m_item[index].get(); }
input_item_id maxitem() const { return m_maxitem; } input_item_id maxitem() const { return m_maxitem; }
void *internal() const { return m_internal; } void *internal() const { return m_internal; }
joystick_map &joymap() { return m_joymap; } joystick_map &joymap() { return m_joymap; }
@ -571,7 +570,7 @@ private:
input_class & m_class; // reference to our class input_class & m_class; // reference to our class
std::string m_name; // string name of device std::string m_name; // string name of device
int m_devindex; // device index of this device int m_devindex; // device index of this device
auto_pointer<input_device_item> m_item[ITEM_ID_ABSOLUTE_MAXIMUM+1]; // array of pointers to items std::unique_ptr<input_device_item> m_item[ITEM_ID_ABSOLUTE_MAXIMUM+1]; // array of pointers to items
input_item_id m_maxitem; // maximum item index input_item_id m_maxitem; // maximum item index
void * m_internal; // internal callback pointer void * m_internal; // internal callback pointer
@ -619,7 +618,7 @@ private:
// internal state // internal state
input_manager & m_manager; // reference to our manager input_manager & m_manager; // reference to our manager
auto_pointer<input_device> m_device[DEVICE_INDEX_MAXIMUM]; // array of devices in this class std::unique_ptr<input_device> m_device[DEVICE_INDEX_MAXIMUM]; // array of devices in this class
input_device_class m_devclass; // our device class input_device_class m_devclass; // our device class
int m_maxindex; // maximum populated index int m_maxindex; // maximum populated index
bool m_enabled; // is this class enabled? bool m_enabled; // is this class enabled?

View File

@ -2131,7 +2131,7 @@ void ioport_field::init_live_state(analog_field *analog)
m_crosshair_mapper.bind_relative_to(device()); m_crosshair_mapper.bind_relative_to(device());
// allocate live state // allocate live state
m_live.reset(global_alloc(ioport_field_live(*this, analog))); m_live = std::make_unique<ioport_field_live>(*this, analog);
m_condition.initialize(device()); m_condition.initialize(device());
@ -2396,7 +2396,7 @@ void ioport_port::insert_field(ioport_field &newfield, ioport_value &disallowedb
void ioport_port::init_live_state() void ioport_port::init_live_state()
{ {
m_live.reset(global_alloc(ioport_port_live(*this))); m_live = std::make_unique<ioport_port_live>(*this);
} }

View File

@ -1054,7 +1054,7 @@ public:
UINT8 way() const { return m_way; } UINT8 way() const { return m_way; }
unicode_char keyboard_code(int which) const; unicode_char keyboard_code(int which) const;
ioport_field_live &live() const { assert(m_live != NULL); return *m_live; } ioport_field_live &live() const { assert(m_live != nullptr); return *m_live; }
// setters // setters
void set_crosshair_scale(double scale) { m_crosshair_scale = scale; } void set_crosshair_scale(double scale) { m_crosshair_scale = scale; }
@ -1098,7 +1098,7 @@ private:
// internal state // internal state
ioport_field * m_next; // pointer to next field in sequence ioport_field * m_next; // pointer to next field in sequence
ioport_port & m_port; // reference to the port that owns us ioport_port & m_port; // reference to the port that owns us
auto_pointer<ioport_field_live> m_live; // live state of field (NULL if not live) std::unique_ptr<ioport_field_live> m_live; // live state of field (NULL if not live)
int m_modcount; // modification count int m_modcount; // modification count
simple_list<ioport_setting> m_settinglist; // list of input_setting_configs simple_list<ioport_setting> m_settinglist; // list of input_setting_configs
simple_list<ioport_diplocation> m_diploclist; // list of locations for various bits simple_list<ioport_diplocation> m_diploclist; // list of locations for various bits
@ -1200,7 +1200,7 @@ public:
const char *tag() const { return m_tag.c_str(); } const char *tag() const { return m_tag.c_str(); }
int modcount() const { return m_modcount; } int modcount() const { return m_modcount; }
ioport_value active() const { return m_active; } ioport_value active() const { return m_active; }
ioport_port_live &live() const { assert(m_live != NULL); return *m_live; } ioport_port_live &live() const { assert(m_live != nullptr); return *m_live; }
// read/write to the port // read/write to the port
ioport_value read(); ioport_value read();
@ -1222,7 +1222,7 @@ private:
std::string m_tag; // copy of this port's tag std::string m_tag; // copy of this port's tag
int m_modcount; // modification count int m_modcount; // modification count
ioport_value m_active; // mask of active bits in the port ioport_value m_active; // mask of active bits in the port
auto_pointer<ioport_port_live> m_live; // live state of port (NULL if not live) std::unique_ptr<ioport_port_live> m_live; // live state of port (NULL if not live)
}; };
inline ioport_value read_safe(ioport_port *port, ioport_value defval) { return (port == NULL) ? defval : port->read(); } inline ioport_value read_safe(ioport_port *port, ioport_value defval) { return (port == NULL) ? defval : port->read(); }

View File

@ -218,9 +218,9 @@ void running_machine::start()
{ {
// initialize basic can't-fail systems here // initialize basic can't-fail systems here
config_init(*this); config_init(*this);
m_input.reset(global_alloc(input_manager(*this))); m_input = std::make_unique<input_manager>(*this);
output_init(*this); output_init(*this);
m_render.reset(global_alloc(render_manager(*this))); m_render = std::make_unique<render_manager>(*this);
generic_machine_init(*this); generic_machine_init(*this);
// allocate a soft_reset timer // allocate a soft_reset timer
@ -230,8 +230,8 @@ void running_machine::start()
m_manager.osd().init(*this); m_manager.osd().init(*this);
// create the video manager // create the video manager
m_video.reset(global_alloc(video_manager(*this))); m_video = std::make_unique<video_manager>(*this);
m_ui.reset(global_alloc(ui_manager(*this))); m_ui = std::make_unique<ui_manager>(*this);
// initialize the base time (needed for doing record/playback) // initialize the base time (needed for doing record/playback)
::time(&m_base_time); ::time(&m_base_time);
@ -247,7 +247,7 @@ void running_machine::start()
ui_input_init(*this); ui_input_init(*this);
// initialize the streams engine before the sound devices start // initialize the streams engine before the sound devices start
m_sound.reset(global_alloc(sound_manager(*this))); m_sound = std::make_unique<sound_manager>(*this);
// first load ROMs, then populate memory, and finally initialize CPUs // first load ROMs, then populate memory, and finally initialize CPUs
// these operations must proceed in this order // these operations must proceed in this order
@ -267,7 +267,7 @@ void running_machine::start()
// initialize image devices // initialize image devices
image_init(*this); image_init(*this);
m_tilemap.reset(global_alloc(tilemap_manager(*this))); m_tilemap = std::make_unique<tilemap_manager>(*this);
crosshair_init(*this); crosshair_init(*this);
network_init(*this); network_init(*this);
@ -299,7 +299,7 @@ void running_machine::start()
schedule_load("auto"); schedule_load("auto");
// set up the cheat engine // set up the cheat engine
m_cheat.reset(global_alloc(cheat_manager(*this))); m_cheat = std::make_unique<cheat_manager>(*this);
// allocate autoboot timer // allocate autoboot timer
m_autoboot_timer = scheduler().timer_alloc(timer_expired_delegate(FUNC(running_machine::autoboot_callback), this)); m_autoboot_timer = scheduler().timer_alloc(timer_expired_delegate(FUNC(running_machine::autoboot_callback), this));
@ -325,7 +325,7 @@ int running_machine::run(bool firstrun)
// if we have a logfile, set up the callback // if we have a logfile, set up the callback
if (options().log() && &system() != &GAME_NAME(___empty)) if (options().log() && &system() != &GAME_NAME(___empty))
{ {
m_logfile.reset(global_alloc(emu_file(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS))); m_logfile = std::make_unique<emu_file>(OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
file_error filerr = m_logfile->open("error.log"); file_error filerr = m_logfile->open("error.log");
assert_always(filerr == FILERR_NONE, "unable to open log file"); assert_always(filerr == FILERR_NONE, "unable to open log file");
add_logerror_callback(logfile_callback); add_logerror_callback(logfile_callback);
@ -768,11 +768,11 @@ void running_machine::add_notifier(machine_notification event, machine_notify_de
// exit notifiers are added to the head, and executed in reverse order // exit notifiers are added to the head, and executed in reverse order
if (event == MACHINE_NOTIFY_EXIT) if (event == MACHINE_NOTIFY_EXIT)
m_notifier_list[event].prepend(*global_alloc(notifier_callback_item(callback))); m_notifier_list[event].push_front(std::make_unique<notifier_callback_item>(callback));
// all other notifiers are added to the tail, and executed in the order registered // all other notifiers are added to the tail, and executed in the order registered
else else
m_notifier_list[event].append(*global_alloc(notifier_callback_item(callback))); m_notifier_list[event].push_back(std::make_unique<notifier_callback_item>(callback));
} }
@ -784,7 +784,7 @@ void running_machine::add_notifier(machine_notification event, machine_notify_de
void running_machine::add_logerror_callback(logerror_callback callback) void running_machine::add_logerror_callback(logerror_callback callback)
{ {
assert_always(m_current_phase == MACHINE_PHASE_INIT, "Can only call add_logerror_callback at init time!"); assert_always(m_current_phase == MACHINE_PHASE_INIT, "Can only call add_logerror_callback at init time!");
m_logerror_list.append(*global_alloc(logerror_callback_item(callback))); m_logerror_list.push_back(std::make_unique<logerror_callback_item>(callback));
} }
/*------------------------------------------------- /*-------------------------------------------------
@ -835,7 +835,7 @@ void running_machine::logerror(const char *format, ...) const
void running_machine::vlogerror(const char *format, va_list args) const void running_machine::vlogerror(const char *format, va_list args) const
{ {
// process only if there is a target // process only if there is a target
if (m_logerror_list.first() != NULL) if (!m_logerror_list.empty())
{ {
g_profiler.start(PROFILER_LOGERROR); g_profiler.start(PROFILER_LOGERROR);
@ -843,8 +843,8 @@ void running_machine::vlogerror(const char *format, va_list args) const
vsnprintf(giant_string_buffer, ARRAY_LENGTH(giant_string_buffer), format, args); vsnprintf(giant_string_buffer, ARRAY_LENGTH(giant_string_buffer), format, args);
// log to all callbacks // log to all callbacks
for (logerror_callback_item *cb = m_logerror_list.first(); cb != NULL; cb = cb->next()) for (auto& cb : m_logerror_list)
(*cb->m_func)(*this, giant_string_buffer); (cb->m_func)(*this, giant_string_buffer);
g_profiler.stop(); g_profiler.stop();
} }
@ -895,7 +895,7 @@ UINT32 running_machine::rand()
void running_machine::call_notifiers(machine_notification which) void running_machine::call_notifiers(machine_notification which)
{ {
for (notifier_callback_item *cb = m_notifier_list[which].first(); cb != NULL; cb = cb->next()) for (auto& cb : m_notifier_list[which])
cb->m_func(); cb->m_func();
} }
@ -1298,8 +1298,7 @@ void running_machine::nvram_save()
//------------------------------------------------- //-------------------------------------------------
running_machine::notifier_callback_item::notifier_callback_item(machine_notify_delegate func) running_machine::notifier_callback_item::notifier_callback_item(machine_notify_delegate func)
: m_next(NULL), : m_func(func)
m_func(func)
{ {
} }
@ -1309,8 +1308,7 @@ running_machine::notifier_callback_item::notifier_callback_item(machine_notify_d
//------------------------------------------------- //-------------------------------------------------
running_machine::logerror_callback_item::logerror_callback_item(logerror_callback func) running_machine::logerror_callback_item::logerror_callback_item(logerror_callback func)
: m_next(NULL), : m_func(func)
m_func(func)
{ {
} }

View File

@ -165,14 +165,14 @@ public:
memory_manager &memory() { return m_memory; } memory_manager &memory() { return m_memory; }
ioport_manager &ioport() { return m_ioport; } ioport_manager &ioport() { return m_ioport; }
parameters_manager &parameters() { return m_parameters; } parameters_manager &parameters() { return m_parameters; }
cheat_manager &cheat() const { assert(m_cheat != NULL); return *m_cheat; } cheat_manager &cheat() const { assert(m_cheat != nullptr); return *m_cheat; }
render_manager &render() const { assert(m_render != NULL); return *m_render; } render_manager &render() const { assert(m_render != nullptr); return *m_render; }
input_manager &input() const { assert(m_input != NULL); return *m_input; } input_manager &input() const { assert(m_input != nullptr); return *m_input; }
sound_manager &sound() const { assert(m_sound != NULL); return *m_sound; } sound_manager &sound() const { assert(m_sound != nullptr); return *m_sound; }
video_manager &video() const { assert(m_video != NULL); return *m_video; } video_manager &video() const { assert(m_video != nullptr); return *m_video; }
ui_manager &ui() const { assert(m_ui != NULL); return *m_ui; } ui_manager &ui() const { assert(m_ui != nullptr); return *m_ui; }
tilemap_manager &tilemap() const { assert(m_tilemap != NULL); return *m_tilemap; } tilemap_manager &tilemap() const { assert(m_tilemap != nullptr); return *m_tilemap; }
debug_view_manager &debug_view() const { assert(m_debug_view != NULL); return *m_debug_view; } debug_view_manager &debug_view() const { assert(m_debug_view != nullptr); return *m_debug_view; }
driver_device *driver_data() const { return &downcast<driver_device &>(root_device()); } driver_device *driver_data() const { return &downcast<driver_device &>(root_device()); }
template<class _DriverClass> _DriverClass *driver_data() const { return &downcast<_DriverClass &>(root_device()); } template<class _DriverClass> _DriverClass *driver_data() const { return &downcast<_DriverClass &>(root_device()); }
machine_phase phase() const { return m_current_phase; } machine_phase phase() const { return m_current_phase; }
@ -278,14 +278,14 @@ private:
const game_driver & m_system; // reference to the definition of the game machine const game_driver & m_system; // reference to the definition of the game machine
machine_manager & m_manager; // reference to machine manager system machine_manager & m_manager; // reference to machine manager system
// managers // managers
auto_pointer<cheat_manager> m_cheat; // internal data from cheat.c std::unique_ptr<cheat_manager> m_cheat; // internal data from cheat.c
auto_pointer<render_manager> m_render; // internal data from render.c std::unique_ptr<render_manager> m_render; // internal data from render.c
auto_pointer<input_manager> m_input; // internal data from input.c std::unique_ptr<input_manager> m_input; // internal data from input.c
auto_pointer<sound_manager> m_sound; // internal data from sound.c std::unique_ptr<sound_manager> m_sound; // internal data from sound.c
auto_pointer<video_manager> m_video; // internal data from video.c std::unique_ptr<video_manager> m_video; // internal data from video.c
auto_pointer<ui_manager> m_ui; // internal data from ui.c std::unique_ptr<ui_manager> m_ui; // internal data from ui.c
auto_pointer<tilemap_manager> m_tilemap; // internal data from tilemap.c std::unique_ptr<tilemap_manager> m_tilemap; // internal data from tilemap.c
auto_pointer<debug_view_manager> m_debug_view; // internal data from debugvw.c std::unique_ptr<debug_view_manager> m_debug_view; // internal data from debugvw.c
// system state // system state
machine_phase m_current_phase; // current execution phase machine_phase m_current_phase; // current execution phase
@ -306,7 +306,7 @@ private:
std::string m_basename; // basename used for game-related paths std::string m_basename; // basename used for game-related paths
std::string m_context; // context string buffer std::string m_context; // context string buffer
int m_sample_rate; // the digital audio sample rate int m_sample_rate; // the digital audio sample rate
auto_pointer<emu_file> m_logfile; // pointer to the active log file std::unique_ptr<emu_file> m_logfile; // pointer to the active log file
// load/save management // load/save management
enum saveload_schedule enum saveload_schedule
@ -326,14 +326,10 @@ private:
// construction/destruction // construction/destruction
notifier_callback_item(machine_notify_delegate func); notifier_callback_item(machine_notify_delegate func);
// getters
notifier_callback_item *next() const { return m_next; }
// state // state
notifier_callback_item * m_next;
machine_notify_delegate m_func; machine_notify_delegate m_func;
}; };
simple_list<notifier_callback_item> m_notifier_list[MACHINE_NOTIFY_COUNT]; std::list<std::unique_ptr<notifier_callback_item>> m_notifier_list[MACHINE_NOTIFY_COUNT];
// logerror callbacks // logerror callbacks
class logerror_callback_item class logerror_callback_item
@ -342,14 +338,10 @@ private:
// construction/destruction // construction/destruction
logerror_callback_item(logerror_callback func); logerror_callback_item(logerror_callback func);
// getters
logerror_callback_item *next() const { return m_next; }
// state // state
logerror_callback_item * m_next;
logerror_callback m_func; logerror_callback m_func;
}; };
simple_list<logerror_callback_item> m_logerror_list; std::list<std::unique_ptr<logerror_callback_item>> m_logerror_list;
// embedded managers and objects // embedded managers and objects
save_manager m_save; // save manager save_manager m_save; // save manager

View File

@ -115,7 +115,7 @@ device_t *machine_config::device_add(device_t *owner, const char *tag, device_ty
if (tag[0] == ':') if (tag[0] == ':')
{ {
tag++; tag++;
owner = m_root_device; owner = m_root_device.get();
} }
// go down the path until we're done with it // go down the path until we're done with it
@ -147,8 +147,8 @@ device_t *machine_config::device_add(device_t *owner, const char *tag, device_ty
// apply any machine configuration owned by the device now // apply any machine configuration owned by the device now
machine_config_constructor additions = m_root_device->machine_config_additions(); machine_config_constructor additions = m_root_device->machine_config_additions();
if (additions != NULL) if (additions != NULL)
(*additions)(*this, m_root_device, NULL); (*additions)(*this, m_root_device.get(), NULL);
return m_root_device; return m_root_device.get();
} }

View File

@ -51,7 +51,7 @@ public:
// getters // getters
const game_driver &gamedrv() const { return m_gamedrv; } const game_driver &gamedrv() const { return m_gamedrv; }
device_t &root_device() const { assert(m_root_device != NULL); return *m_root_device; } device_t &root_device() const { assert(m_root_device != nullptr); return *m_root_device; }
screen_device *first_screen() const; screen_device *first_screen() const;
emu_options &options() const { return m_options; } emu_options &options() const { return m_options; }
inline device_t *device(const char *tag) const { return root_device().subdevice(tag); } inline device_t *device(const char *tag) const { return root_device().subdevice(tag); }
@ -77,7 +77,7 @@ private:
// internal state // internal state
const game_driver & m_gamedrv; const game_driver & m_gamedrv;
emu_options & m_options; emu_options & m_options;
auto_pointer<device_t> m_root_device; std::unique_ptr<device_t> m_root_device;
}; };

View File

@ -711,7 +711,7 @@ private:
} }
// internal state // internal state
auto_pointer<handler_entry_read> m_handlers[TOTAL_MEMORY_BANKS]; // array of user-installed handlers std::unique_ptr<handler_entry_read> m_handlers[TOTAL_MEMORY_BANKS]; // array of user-installed handlers
}; };
@ -779,7 +779,7 @@ private:
} }
// internal state // internal state
auto_pointer<handler_entry_write> m_handlers[TOTAL_MEMORY_BANKS]; // array of user-installed handlers std::unique_ptr<handler_entry_write> m_handlers[TOTAL_MEMORY_BANKS]; // array of user-installed handlers
}; };
// ======================> address_table_setoffset // ======================> address_table_setoffset
@ -793,7 +793,7 @@ public:
{ {
// allocate handlers for each entry, prepopulating the bankptrs for banks // allocate handlers for each entry, prepopulating the bankptrs for banks
for (int entrynum = 0; entrynum < ARRAY_LENGTH(m_handlers); entrynum++) for (int entrynum = 0; entrynum < ARRAY_LENGTH(m_handlers); entrynum++)
m_handlers[entrynum].reset(global_alloc(handler_entry_setoffset())); m_handlers[entrynum] = std::make_unique<handler_entry_setoffset>();
// Watchpoints and unmap states do not make sense for setoffset // Watchpoints and unmap states do not make sense for setoffset
m_handlers[STATIC_NOP]->set_delegate(setoffset_delegate(FUNC(address_table_setoffset::nop_so), this)); m_handlers[STATIC_NOP]->set_delegate(setoffset_delegate(FUNC(address_table_setoffset::nop_so), this));
@ -829,7 +829,7 @@ private:
} }
// internal state // internal state
auto_pointer<handler_entry_setoffset> m_handlers[TOTAL_MEMORY_BANKS]; // array of user-installed handlers std::unique_ptr<handler_entry_setoffset> m_handlers[TOTAL_MEMORY_BANKS]; // array of user-installed handlers
}; };
@ -1674,7 +1674,7 @@ address_space::address_space(memory_manager &manager, device_memory_interface &m
m_spacenum(spacenum), m_spacenum(spacenum),
m_debugger_access(false), m_debugger_access(false),
m_log_unmap(true), m_log_unmap(true),
m_direct(global_alloc(direct_read_data(*this))), m_direct(std::make_unique<direct_read_data>(*this)),
m_name(memory.space_config(spacenum)->name()), m_name(memory.space_config(spacenum)->name()),
m_addrchars((m_config.m_addrbus_width + 3) / 4), m_addrchars((m_config.m_addrbus_width + 3) / 4),
m_logaddrchars((m_config.m_logaddr_width + 3) / 4), m_logaddrchars((m_config.m_logaddr_width + 3) / 4),
@ -1809,7 +1809,7 @@ void address_space::prepare_map()
UINT32 devregionsize = (devregion != NULL) ? devregion->bytes() : 0; UINT32 devregionsize = (devregion != NULL) ? devregion->bytes() : 0;
// allocate the address map // allocate the address map
m_map.reset(global_alloc(address_map(m_device, m_spacenum))); m_map = std::make_unique<address_map>(m_device, m_spacenum);
// merge in the submaps // merge in the submaps
m_map->uplift_submaps(machine(), m_device, m_device.owner() ? *m_device.owner() : m_device, endianness()); m_map->uplift_submaps(machine(), m_device, m_device.owner() ? *m_device.owner() : m_device, endianness());
@ -1899,7 +1899,7 @@ void address_space::populate_from_map(address_map *map)
{ {
// no map specified, use the space-specific one // no map specified, use the space-specific one
if (map == NULL) if (map == NULL)
map = m_map; map = m_map.get();
// no map, nothing to do // no map, nothing to do
if (map == NULL) if (map == NULL)
@ -3506,7 +3506,7 @@ address_table_read::address_table_read(address_space &space, bool large)
for (int entrynum = 0; entrynum < ARRAY_LENGTH(m_handlers); entrynum++) for (int entrynum = 0; entrynum < ARRAY_LENGTH(m_handlers); entrynum++)
{ {
UINT8 **bankptr = (entrynum >= STATIC_BANK1 && entrynum <= STATIC_BANKMAX) ? space.manager().bank_pointer_addr(entrynum) : NULL; UINT8 **bankptr = (entrynum >= STATIC_BANK1 && entrynum <= STATIC_BANKMAX) ? space.manager().bank_pointer_addr(entrynum) : NULL;
m_handlers[entrynum].reset(global_alloc(handler_entry_read(space.data_width(), space.endianness(), bankptr))); m_handlers[entrynum] = std::make_unique<handler_entry_read>(space.data_width(), space.endianness(), bankptr);
} }
// we have to allocate different object types based on the data bus width // we have to allocate different object types based on the data bus width
@ -3580,7 +3580,7 @@ address_table_write::address_table_write(address_space &space, bool large)
for (int entrynum = 0; entrynum < ARRAY_LENGTH(m_handlers); entrynum++) for (int entrynum = 0; entrynum < ARRAY_LENGTH(m_handlers); entrynum++)
{ {
UINT8 **bankptr = (entrynum >= STATIC_BANK1 && entrynum <= STATIC_BANKMAX) ? space.manager().bank_pointer_addr(entrynum) : NULL; UINT8 **bankptr = (entrynum >= STATIC_BANK1 && entrynum <= STATIC_BANKMAX) ? space.manager().bank_pointer_addr(entrynum) : NULL;
m_handlers[entrynum].reset(global_alloc(handler_entry_write(space.data_width(), space.endianness(), bankptr))); m_handlers[entrynum] = std::make_unique<handler_entry_write>(space.data_width(), space.endianness(), bankptr);
} }
// we have to allocate different object types based on the data bus width // we have to allocate different object types based on the data bus width

View File

@ -275,7 +275,7 @@ public:
running_machine &machine() const { return m_machine; } running_machine &machine() const { return m_machine; }
const char *name() const { return m_name; } const char *name() const { return m_name; }
address_spacenum spacenum() const { return m_spacenum; } address_spacenum spacenum() const { return m_spacenum; }
address_map *map() const { return m_map; } address_map *map() const { return m_map.get(); }
direct_read_data &direct() const { return *m_direct; } direct_read_data &direct() const { return *m_direct; }
@ -463,7 +463,7 @@ protected:
address_space * m_next; // next address space in the global list address_space * m_next; // next address space in the global list
const address_space_config &m_config; // configuration of this space const address_space_config &m_config; // configuration of this space
device_t & m_device; // reference to the owning device device_t & m_device; // reference to the owning device
auto_pointer<address_map> m_map; // original memory map std::unique_ptr<address_map> m_map; // original memory map
offs_t m_addrmask; // physical address mask offs_t m_addrmask; // physical address mask
offs_t m_bytemask; // byte-converted physical address mask offs_t m_bytemask; // byte-converted physical address mask
offs_t m_logaddrmask; // logical address mask offs_t m_logaddrmask; // logical address mask
@ -472,7 +472,7 @@ protected:
address_spacenum m_spacenum; // address space index address_spacenum m_spacenum; // address space index
bool m_debugger_access; // treat accesses as coming from the debugger bool m_debugger_access; // treat accesses as coming from the debugger
bool m_log_unmap; // log unmapped accesses in this space? bool m_log_unmap; // log unmapped accesses in this space?
auto_pointer<direct_read_data> m_direct; // fast direct-access read info std::unique_ptr<direct_read_data> m_direct; // fast direct-access read info
const char * m_name; // friendly name of the address space const char * m_name; // friendly name of the address space
UINT8 m_addrchars; // number of characters to use for physical addresses UINT8 m_addrchars; // number of characters to use for physical addresses
UINT8 m_logaddrchars; // number of characters to use for logical addresses UINT8 m_logaddrchars; // number of characters to use for logical addresses

View File

@ -722,9 +722,9 @@ const rgb_t *render_container::bcg_lookup_table(int texformat, palette_t *palett
{ {
case TEXFORMAT_PALETTE16: case TEXFORMAT_PALETTE16:
case TEXFORMAT_PALETTEA16: case TEXFORMAT_PALETTEA16:
if (m_palclient == NULL) // if adjusted palette hasn't been created yet, create it if (m_palclient == nullptr) // if adjusted palette hasn't been created yet, create it
{ {
m_palclient.reset(global_alloc(palette_client(*palette))); m_palclient = std::make_unique<palette_client>(*palette);
m_bcglookup.resize(palette->max_index()); m_bcglookup.resize(palette->max_index());
recompute_lookups(); recompute_lookups();
} }
@ -813,7 +813,7 @@ void render_container::recompute_lookups()
} }
// recompute the palette entries // recompute the palette entries
if (m_palclient != NULL) if (m_palclient != nullptr)
{ {
palette_t &palette = m_palclient->palette(); palette_t &palette = m_palclient->palette();
const rgb_t *adjusted_palette = palette.entry_list_adjusted(); const rgb_t *adjusted_palette = palette.entry_list_adjusted();

View File

@ -572,7 +572,7 @@ private:
user_settings m_user; // user settings user_settings m_user; // user settings
bitmap_argb32 * m_overlaybitmap; // overlay bitmap bitmap_argb32 * m_overlaybitmap; // overlay bitmap
render_texture * m_overlaytexture; // overlay texture render_texture * m_overlaytexture; // overlay texture
auto_pointer<palette_client> m_palclient; // client to the screen palette std::unique_ptr<palette_client> m_palclient; // client to the screen palette
std::vector<rgb_t> m_bcglookup; // copy of screen palette with bcg adjustment std::vector<rgb_t> m_bcglookup; // copy of screen palette with bcg adjustment
rgb_t m_bcglookup256[0x400]; // lookup table for brightness/contrast/gamma rgb_t m_bcglookup256[0x400]; // lookup table for brightness/contrast/gamma
}; };
@ -704,7 +704,7 @@ private:
int m_textalign; // text alignment to box int m_textalign; // text alignment to box
bitmap_argb32 m_bitmap[MAX_BITMAPS]; // source bitmap for images bitmap_argb32 m_bitmap[MAX_BITMAPS]; // source bitmap for images
std::string m_dirname; // directory name of image file (for lazy loading) std::string m_dirname; // directory name of image file (for lazy loading)
auto_pointer<emu_file> m_file[MAX_BITMAPS]; // file object for reading image/alpha files std::unique_ptr<emu_file> m_file[MAX_BITMAPS]; // file object for reading image/alpha files
std::string m_imagefile[MAX_BITMAPS]; // name of the image file (for lazy loading) std::string m_imagefile[MAX_BITMAPS]; // name of the image file (for lazy loading)
std::string m_alphafile[MAX_BITMAPS]; // name of the alpha file (for lazy loading) std::string m_alphafile[MAX_BITMAPS]; // name of the alpha file (for lazy loading)
bool m_hasalpha[MAX_BITMAPS]; // is there any alpha component present? bool m_hasalpha[MAX_BITMAPS]; // is there any alpha component present?

View File

@ -589,7 +589,7 @@ layout_element::component::component(running_machine &machine, xml_data_node &co
m_dirname = dirname; m_dirname = dirname;
m_imagefile[0] = xml_get_attribute_string_with_subst(machine, compnode, "file", ""); m_imagefile[0] = xml_get_attribute_string_with_subst(machine, compnode, "file", "");
m_alphafile[0] = xml_get_attribute_string_with_subst(machine, compnode, "alphafile", ""); m_alphafile[0] = xml_get_attribute_string_with_subst(machine, compnode, "alphafile", "");
m_file[0].reset(global_alloc(emu_file(machine.options().art_path(), OPEN_FLAG_READ))); m_file[0] = std::make_unique<emu_file>(machine.options().art_path(), OPEN_FLAG_READ);
} }
// text nodes // text nodes
@ -657,7 +657,7 @@ layout_element::component::component(running_machine &machine, xml_data_node &co
m_imagefile[i] = m_imagefile[i].substr(location+1, m_imagefile[i].length()-(location-1)); m_imagefile[i] = m_imagefile[i].substr(location+1, m_imagefile[i].length()-(location-1));
//m_alphafile[i] = //m_alphafile[i] =
m_file[i].reset(global_alloc(emu_file(machine.options().art_path(), OPEN_FLAG_READ))); m_file[i] = std::make_unique<emu_file>(machine.options().art_path(), OPEN_FLAG_READ);
} }
else else
{ {

View File

@ -51,7 +51,7 @@ ui_menu_select_game::~ui_menu_select_game()
void ui_menu_select_game::build_driver_list() void ui_menu_select_game::build_driver_list()
{ {
// start with an empty list // start with an empty list
m_drivlist.reset(global_alloc(driver_enumerator(machine().options()))); m_drivlist = std::make_unique<driver_enumerator>(machine().options());
m_drivlist->exclude_all(); m_drivlist->exclude_all();
// open a path to the ROMs and find them in the array // open a path to the ROMs and find them in the array

View File

@ -35,7 +35,7 @@ private:
char m_search[40]; char m_search[40];
int m_matchlist[VISIBLE_GAMES_IN_LIST]; int m_matchlist[VISIBLE_GAMES_IN_LIST];
std::vector<const game_driver *> m_driverlist; std::vector<const game_driver *> m_driverlist;
auto_pointer<driver_enumerator> m_drivlist; std::unique_ptr<driver_enumerator> m_drivlist;
// internal methods // internal methods
void build_driver_list(); void build_driver_list();

View File

@ -438,7 +438,7 @@ void video_manager::begin_recording(const char *name, movie_format format)
m_mng_next_frame_time = machine().time(); m_mng_next_frame_time = machine().time();
// create a new movie file and start recording // create a new movie file and start recording
m_mng_file.reset(global_alloc(emu_file(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS))); m_mng_file = std::make_unique<emu_file>(machine().options().snapshot_directory(), OPEN_FLAG_WRITE | OPEN_FLAG_CREATE | OPEN_FLAG_CREATE_PATHS);
file_error filerr; file_error filerr;
if (name != NULL) if (name != NULL)
filerr = m_mng_file->open(name); filerr = m_mng_file->open(name);

View File

@ -64,7 +64,7 @@ public:
bool throttled() const { return m_throttled; } bool throttled() const { return m_throttled; }
float throttle_rate() const { return m_throttle_rate; } float throttle_rate() const { return m_throttle_rate; }
bool fastforward() const { return m_fastforward; } bool fastforward() const { return m_fastforward; }
bool is_recording() const { return (m_mng_file != NULL || m_avi_file != NULL); } bool is_recording() const { return (m_mng_file != nullptr || m_avi_file != NULL); }
// setters // setters
void set_frameskip(int frameskip); void set_frameskip(int frameskip);
@ -166,7 +166,7 @@ private:
INT32 m_snap_height; // height of snapshots (0 == auto) INT32 m_snap_height; // height of snapshots (0 == auto)
// movie recording - MNG // movie recording - MNG
auto_pointer<emu_file> m_mng_file; // handle to the open movie file std::unique_ptr<emu_file> m_mng_file; // handle to the open movie file
attotime m_mng_frame_period; // period of a single movie frame attotime m_mng_frame_period; // period of a single movie frame
attotime m_mng_next_frame_time; // time of next frame attotime m_mng_next_frame_time; // time of next frame
UINT32 m_mng_frame; // current movie frame number UINT32 m_mng_frame; // current movie frame number

View File

@ -25,41 +25,6 @@
#endif #endif
// ======================> auto_pointer
// an object that transparently wraps a pointer and auto-frees it upon destruction
template<class _ElementType>
class auto_pointer
{
private:
// we don't support deep copying
auto_pointer(const auto_pointer &);
auto_pointer &operator=(const auto_pointer &);
public:
// construction/destruction
auto_pointer(_ElementType *value = NULL)
: m_ptr(value) { }
virtual ~auto_pointer() { reset(); }
// operators
operator _ElementType *() const { return m_ptr; }
_ElementType &operator*() const { assert(m_ptr != NULL); return *m_ptr; }
_ElementType *operator->() const { return m_ptr; }
// simple getters
_ElementType *get() const { return m_ptr; }
// core operations
void reset(_ElementType *ptr = NULL) { if (m_ptr != ptr) { global_free(m_ptr); m_ptr = ptr; } }
private:
// internal state
_ElementType * m_ptr; // pointer we are tracking
};
typedef std::vector<UINT8> dynamic_buffer; typedef std::vector<UINT8> dynamic_buffer;

View File

@ -166,7 +166,7 @@ MD5Final(md5byte digest[16], struct MD5Context *ctx)
void void
MD5Transform(UWORD32 buf[4], UWORD32 const in[16]) MD5Transform(UWORD32 buf[4], UWORD32 const in[16])
{ {
register UWORD32 a, b, c, d; UWORD32 a, b, c, d;
a = buf[0]; a = buf[0];
b = buf[1]; b = buf[1];

View File

@ -641,7 +641,7 @@ void sega_315_5195_mapper_device::decrypt_bank::set_decrypt(fd1089_base_device *
void sega_315_5195_mapper_device::decrypt_bank::set_decrypt(fd1094_device *fd1094) void sega_315_5195_mapper_device::decrypt_bank::set_decrypt(fd1094_device *fd1094)
{ {
// set the fd1094 pointer and allocate a decryption cache // set the fd1094 pointer and allocate a decryption cache
m_fd1094_cache.reset(global_alloc(fd1094_decryption_cache(*fd1094))); m_fd1094_cache = std::make_unique<fd1094_decryption_cache>(*fd1094);
// clear out all fd1089 stuff // clear out all fd1089 stuff
m_fd1089 = NULL; m_fd1089 = NULL;

View File

@ -152,7 +152,7 @@ private:
UINT8 * m_srcptr; UINT8 * m_srcptr;
fd1089_base_device * m_fd1089; fd1089_base_device * m_fd1089;
std::vector<UINT16> m_fd1089_decrypted; std::vector<UINT16> m_fd1089_decrypted;
auto_pointer<fd1094_decryption_cache> m_fd1094_cache; std::unique_ptr<fd1094_decryption_cache> m_fd1094_cache;
}; };
// internal helpers // internal helpers

View File

@ -44,7 +44,7 @@
INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE
_mul_32x32_hi(INT32 val1, INT32 val2) _mul_32x32_hi(INT32 val1, INT32 val2)
{ {
register INT32 result; INT32 result;
__asm__ ( __asm__ (
" mulhw %[result], %[val1], %[val2] \n" " mulhw %[result], %[val1], %[val2] \n"
@ -67,7 +67,7 @@ _mul_32x32_hi(INT32 val1, INT32 val2)
INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE
_mulu_32x32_hi(UINT32 val1, UINT32 val2) _mulu_32x32_hi(UINT32 val1, UINT32 val2)
{ {
register UINT32 result; UINT32 result;
__asm__ ( __asm__ (
" mulhwu %[result], %[val1], %[val2] \n" " mulhwu %[result], %[val1], %[val2] \n"
@ -92,7 +92,7 @@ _mulu_32x32_hi(UINT32 val1, UINT32 val2)
INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE
_mul_32x32_shift(INT32 val1, INT32 val2, UINT8 shift) _mul_32x32_shift(INT32 val1, INT32 val2, UINT8 shift)
{ {
register INT32 result; INT32 result;
/* Valid for (0 <= shift <= 32) */ /* Valid for (0 <= shift <= 32) */
__asm__ ( __asm__ (
@ -126,7 +126,7 @@ _mul_32x32_shift(INT32 val1, INT32 val2, UINT8 shift)
INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE
_mulu_32x32_shift(UINT32 val1, UINT32 val2, UINT8 shift) _mulu_32x32_shift(UINT32 val1, UINT32 val2, UINT8 shift)
{ {
register UINT32 result; UINT32 result;
/* Valid for (0 <= shift <= 32) */ /* Valid for (0 <= shift <= 32) */
__asm__ ( __asm__ (
@ -225,7 +225,7 @@ _mulu_32x32_shift(UINT32 val1, UINT32 val2, UINT8 shift)
INLINE float ATTR_CONST ATTR_FORCE_INLINE INLINE float ATTR_CONST ATTR_FORCE_INLINE
_recip_approx(float value) _recip_approx(float value)
{ {
register float result; float result;
__asm__ ( __asm__ (
" fres %[result], %[value] \n" " fres %[result], %[value] \n"
@ -251,7 +251,7 @@ _recip_approx(float value)
INLINE UINT8 ATTR_CONST ATTR_FORCE_INLINE INLINE UINT8 ATTR_CONST ATTR_FORCE_INLINE
_count_leading_zeros(UINT32 value) _count_leading_zeros(UINT32 value)
{ {
register UINT32 result; UINT32 result;
__asm__ ( __asm__ (
" cntlzw %[result], %[value] \n" " cntlzw %[result], %[value] \n"
@ -272,7 +272,7 @@ _count_leading_zeros(UINT32 value)
INLINE UINT8 ATTR_CONST ATTR_FORCE_INLINE INLINE UINT8 ATTR_CONST ATTR_FORCE_INLINE
_count_leading_ones(UINT32 value) _count_leading_ones(UINT32 value)
{ {
register UINT32 result; UINT32 result;
__asm__ ( __asm__ (
" not %[result], %[value] \n" " not %[result], %[value] \n"
@ -301,7 +301,7 @@ _count_leading_ones(UINT32 value)
INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE
_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange) _compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange)
{ {
register INT32 result; INT32 result;
__asm__ __volatile__ ( __asm__ __volatile__ (
"1: lwarx %[result], 0, %[ptr] \n" "1: lwarx %[result], 0, %[ptr] \n"
@ -335,7 +335,7 @@ _compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange)
INLINE INT64 ATTR_NONNULL(1) ATTR_FORCE_INLINE INLINE INT64 ATTR_NONNULL(1) ATTR_FORCE_INLINE
_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange) _compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange)
{ {
register INT64 result; INT64 result;
__asm__ __volatile__ ( __asm__ __volatile__ (
"1: ldarx %[result], 0, %[ptr] \n" "1: ldarx %[result], 0, %[ptr] \n"
@ -368,7 +368,7 @@ _compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange)
INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE
_atomic_exchange32(INT32 volatile *ptr, INT32 exchange) _atomic_exchange32(INT32 volatile *ptr, INT32 exchange)
{ {
register INT32 result; INT32 result;
__asm__ __volatile__ ( __asm__ __volatile__ (
"1: lwarx %[result], 0, %[ptr] \n" "1: lwarx %[result], 0, %[ptr] \n"
@ -396,7 +396,7 @@ _atomic_exchange32(INT32 volatile *ptr, INT32 exchange)
INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE
_atomic_add32(INT32 volatile *ptr, INT32 delta) _atomic_add32(INT32 volatile *ptr, INT32 delta)
{ {
register INT32 result; INT32 result;
__asm__ __volatile__ ( __asm__ __volatile__ (
"1: lwarx %[result], 0, %[ptr] \n" "1: lwarx %[result], 0, %[ptr] \n"
@ -425,7 +425,7 @@ _atomic_add32(INT32 volatile *ptr, INT32 delta)
INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE
_atomic_increment32(INT32 volatile *ptr) _atomic_increment32(INT32 volatile *ptr)
{ {
register INT32 result; INT32 result;
__asm__ __volatile__ ( __asm__ __volatile__ (
"1: lwarx %[result], 0, %[ptr] \n" "1: lwarx %[result], 0, %[ptr] \n"
@ -453,7 +453,7 @@ _atomic_increment32(INT32 volatile *ptr)
INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE
_atomic_decrement32(INT32 volatile *ptr) _atomic_decrement32(INT32 volatile *ptr)
{ {
register INT32 result; INT32 result;
__asm__ __volatile__ ( __asm__ __volatile__ (
"1: lwarx %[result], 0, %[ptr] \n" "1: lwarx %[result], 0, %[ptr] \n"

View File

@ -44,7 +44,7 @@ union _x86_union
INLINE INT64 ATTR_CONST ATTR_FORCE_INLINE INLINE INT64 ATTR_CONST ATTR_FORCE_INLINE
_mul_32x32(INT32 a, INT32 b) _mul_32x32(INT32 a, INT32 b)
{ {
register INT64 result; INT64 result;
__asm__ ( __asm__ (
" imull %[b] ;" " imull %[b] ;"
@ -70,7 +70,7 @@ _mul_32x32(INT32 a, INT32 b)
INLINE UINT64 ATTR_CONST ATTR_FORCE_INLINE INLINE UINT64 ATTR_CONST ATTR_FORCE_INLINE
_mulu_32x32(UINT32 a, UINT32 b) _mulu_32x32(UINT32 a, UINT32 b)
{ {
register UINT64 result; UINT64 result;
__asm__ ( __asm__ (
" mull %[b] ;" " mull %[b] ;"
@ -95,7 +95,7 @@ _mulu_32x32(UINT32 a, UINT32 b)
INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE
_mul_32x32_hi(INT32 a, INT32 b) _mul_32x32_hi(INT32 a, INT32 b)
{ {
register INT32 result, temp; INT32 result, temp;
__asm__ ( __asm__ (
" imull %[b] ;" " imull %[b] ;"
@ -120,7 +120,7 @@ _mul_32x32_hi(INT32 a, INT32 b)
INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE
_mulu_32x32_hi(UINT32 a, UINT32 b) _mulu_32x32_hi(UINT32 a, UINT32 b)
{ {
register UINT32 result, temp; UINT32 result, temp;
__asm__ ( __asm__ (
" mull %[b] ;" " mull %[b] ;"
@ -147,7 +147,7 @@ _mulu_32x32_hi(UINT32 a, UINT32 b)
INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE
_mul_32x32_shift(INT32 a, INT32 b, UINT8 shift) _mul_32x32_shift(INT32 a, INT32 b, UINT8 shift)
{ {
register INT32 result; INT32 result;
/* Valid for (0 <= shift <= 31) */ /* Valid for (0 <= shift <= 31) */
__asm__ ( __asm__ (
@ -177,7 +177,7 @@ _mul_32x32_shift(INT32 a, INT32 b, UINT8 shift)
INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE
_mulu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) _mulu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift)
{ {
register UINT32 result; UINT32 result;
/* Valid for (0 <= shift <= 31) */ /* Valid for (0 <= shift <= 31) */
__asm__ ( __asm__ (
@ -205,7 +205,7 @@ _mulu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift)
INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE
_div_64x32(INT64 a, INT32 b) _div_64x32(INT64 a, INT32 b)
{ {
register INT32 result, temp; INT32 result, temp;
/* Throws arithmetic exception if result doesn't fit in 32 bits */ /* Throws arithmetic exception if result doesn't fit in 32 bits */
__asm__ ( __asm__ (
@ -232,7 +232,7 @@ _div_64x32(INT64 a, INT32 b)
INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE
_divu_64x32(UINT64 a, UINT32 b) _divu_64x32(UINT64 a, UINT32 b)
{ {
register UINT32 result, temp; UINT32 result, temp;
/* Throws arithmetic exception if result doesn't fit in 32 bits */ /* Throws arithmetic exception if result doesn't fit in 32 bits */
__asm__ ( __asm__ (
@ -260,7 +260,7 @@ _divu_64x32(UINT64 a, UINT32 b)
INLINE INT32 ATTR_FORCE_INLINE INLINE INT32 ATTR_FORCE_INLINE
_div_64x32_rem(INT64 dividend, INT32 divisor, INT32 *remainder) _div_64x32_rem(INT64 dividend, INT32 divisor, INT32 *remainder)
{ {
register INT32 quotient; INT32 quotient;
/* Throws arithmetic exception if result doesn't fit in 32 bits */ /* Throws arithmetic exception if result doesn't fit in 32 bits */
__asm__ ( __asm__ (
@ -288,7 +288,7 @@ _div_64x32_rem(INT64 dividend, INT32 divisor, INT32 *remainder)
INLINE UINT32 ATTR_FORCE_INLINE INLINE UINT32 ATTR_FORCE_INLINE
_divu_64x32_rem(UINT64 dividend, UINT32 divisor, UINT32 *remainder) _divu_64x32_rem(UINT64 dividend, UINT32 divisor, UINT32 *remainder)
{ {
register UINT32 quotient; UINT32 quotient;
/* Throws arithmetic exception if result doesn't fit in 32 bits */ /* Throws arithmetic exception if result doesn't fit in 32 bits */
__asm__ ( __asm__ (
@ -307,8 +307,8 @@ _divu_64x32_rem(UINT64 dividend, UINT32 divisor, UINT32 *remainder)
INLINE UINT32 ATTR_FORCE_INLINE INLINE UINT32 ATTR_FORCE_INLINE
_divu_64x32_rem(UINT64 dividend, UINT32 divisor, UINT32 *remainder) _divu_64x32_rem(UINT64 dividend, UINT32 divisor, UINT32 *remainder)
{ {
register UINT32 quotient; UINT32 quotient;
register _x86_union r; _x86_union r;
r.u64 = dividend; r.u64 = dividend;
@ -339,7 +339,7 @@ _divu_64x32_rem(UINT64 dividend, UINT32 divisor, UINT32 *remainder)
INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE
_div_32x32_shift(INT32 a, INT32 b, UINT8 shift) _div_32x32_shift(INT32 a, INT32 b, UINT8 shift)
{ {
register INT32 result; INT32 result;
/* Valid for (0 <= shift <= 31) */ /* Valid for (0 <= shift <= 31) */
/* Throws arithmetic exception if result doesn't fit in 32 bits */ /* Throws arithmetic exception if result doesn't fit in 32 bits */
@ -371,7 +371,7 @@ _div_32x32_shift(INT32 a, INT32 b, UINT8 shift)
INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE
_divu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift) _divu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift)
{ {
register INT32 result; INT32 result;
/* Valid for (0 <= shift <= 31) */ /* Valid for (0 <= shift <= 31) */
/* Throws arithmetic exception if result doesn't fit in 32 bits */ /* Throws arithmetic exception if result doesn't fit in 32 bits */
@ -402,7 +402,7 @@ _divu_32x32_shift(UINT32 a, UINT32 b, UINT8 shift)
INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE INLINE INT32 ATTR_CONST ATTR_FORCE_INLINE
_mod_64x32(INT64 a, INT32 b) _mod_64x32(INT64 a, INT32 b)
{ {
register INT32 result, temp; INT32 result, temp;
/* Throws arithmetic exception if quotient doesn't fit in 32 bits */ /* Throws arithmetic exception if quotient doesn't fit in 32 bits */
__asm__ ( __asm__ (
@ -429,7 +429,7 @@ _mod_64x32(INT64 a, INT32 b)
INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE INLINE UINT32 ATTR_CONST ATTR_FORCE_INLINE
_modu_64x32(UINT64 a, UINT32 b) _modu_64x32(UINT64 a, UINT32 b)
{ {
register UINT32 result, temp; UINT32 result, temp;
/* Throws arithmetic exception if quotient doesn't fit in 32 bits */ /* Throws arithmetic exception if quotient doesn't fit in 32 bits */
__asm__ ( __asm__ (
@ -479,7 +479,7 @@ _recip_approx(float value)
INLINE UINT8 ATTR_CONST ATTR_FORCE_INLINE INLINE UINT8 ATTR_CONST ATTR_FORCE_INLINE
_count_leading_zeros(UINT32 value) _count_leading_zeros(UINT32 value)
{ {
register UINT32 result; UINT32 result;
__asm__ ( __asm__ (
" bsrl %[value], %[result] ;" " bsrl %[value], %[result] ;"
@ -504,7 +504,7 @@ _count_leading_zeros(UINT32 value)
INLINE UINT8 ATTR_CONST ATTR_FORCE_INLINE INLINE UINT8 ATTR_CONST ATTR_FORCE_INLINE
_count_leading_ones(UINT32 value) _count_leading_ones(UINT32 value)
{ {
register UINT32 result; UINT32 result;
__asm__ ( __asm__ (
" movl %[value], %[result] ;" " movl %[value], %[result] ;"
@ -538,7 +538,7 @@ _count_leading_ones(UINT32 value)
INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE
_compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange) _compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange)
{ {
register INT32 result; INT32 result;
__asm__ __volatile__ ( __asm__ __volatile__ (
" lock ; cmpxchgl %[exchange], %[ptr] ;" " lock ; cmpxchgl %[exchange], %[ptr] ;"
@ -565,7 +565,7 @@ _compare_exchange32(INT32 volatile *ptr, INT32 compare, INT32 exchange)
INLINE INT64 ATTR_NONNULL(1) ATTR_FORCE_INLINE INLINE INT64 ATTR_NONNULL(1) ATTR_FORCE_INLINE
_compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange) _compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange)
{ {
register INT64 result; INT64 result;
__asm__ __volatile__ ( __asm__ __volatile__ (
" lock ; cmpxchgq %[exchange], %[ptr] ;" " lock ; cmpxchgq %[exchange], %[ptr] ;"
@ -591,7 +591,7 @@ _compare_exchange64(INT64 volatile *ptr, INT64 compare, INT64 exchange)
INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE
_atomic_exchange32(INT32 volatile *ptr, INT32 exchange) _atomic_exchange32(INT32 volatile *ptr, INT32 exchange)
{ {
register INT32 result; INT32 result;
__asm__ __volatile__ ( __asm__ __volatile__ (
" lock ; xchgl %[exchange], %[ptr] ;" " lock ; xchgl %[exchange], %[ptr] ;"
@ -614,7 +614,7 @@ _atomic_exchange32(INT32 volatile *ptr, INT32 exchange)
INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE
_atomic_add32(INT32 volatile *ptr, INT32 delta) _atomic_add32(INT32 volatile *ptr, INT32 delta)
{ {
register INT32 result = delta; INT32 result = delta;
__asm__ __volatile__ ( __asm__ __volatile__ (
" lock ; xaddl %[result], %[ptr] ;" " lock ; xaddl %[result], %[ptr] ;"
@ -638,7 +638,7 @@ _atomic_add32(INT32 volatile *ptr, INT32 delta)
INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE
_atomic_increment32(INT32 volatile *ptr) _atomic_increment32(INT32 volatile *ptr)
{ {
register INT32 result = 1; INT32 result = 1;
__asm__ __volatile__ ( __asm__ __volatile__ (
" lock ; xaddl %[result], %[ptr] ;" " lock ; xaddl %[result], %[ptr] ;"
@ -662,7 +662,7 @@ _atomic_increment32(INT32 volatile *ptr)
INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE INLINE INT32 ATTR_NONNULL(1) ATTR_FORCE_INLINE
_atomic_decrement32(INT32 volatile *ptr) _atomic_decrement32(INT32 volatile *ptr)
{ {
register INT32 result = -1; INT32 result = -1;
__asm__ __volatile__ ( __asm__ __volatile__ (
" lock ; xaddl %[result], %[ptr] ;" " lock ; xaddl %[result], %[ptr] ;"

View File

@ -35,7 +35,7 @@ osd_yield_processor(void)
INLINE INT64 ATTR_UNUSED ATTR_NONNULL(1) ATTR_FORCE_INLINE INLINE INT64 ATTR_UNUSED ATTR_NONNULL(1) ATTR_FORCE_INLINE
_osd_exchange64(INT64 volatile *ptr, INT64 exchange) _osd_exchange64(INT64 volatile *ptr, INT64 exchange)
{ {
register INT64 ret; INT64 ret;
__asm__ __volatile__ ( __asm__ __volatile__ (
" lock ; xchg %[exchange], %[ptr] ;" " lock ; xchg %[exchange], %[ptr] ;"
: [ptr] "+m" (*ptr) : [ptr] "+m" (*ptr)
@ -69,7 +69,7 @@ osd_yield_processor(void)
INLINE INT64 ATTR_UNUSED ATTR_NONNULL(1) ATTR_FORCE_INLINE INLINE INT64 ATTR_UNUSED ATTR_NONNULL(1) ATTR_FORCE_INLINE
_osd_exchange64(INT64 volatile *ptr, INT64 exchange) _osd_exchange64(INT64 volatile *ptr, INT64 exchange)
{ {
register INT64 ret; INT64 ret;
__asm__ __volatile__ ( __asm__ __volatile__ (
"1: ldarx %[ret], 0, %[ptr] \n" "1: ldarx %[ret], 0, %[ptr] \n"
" stdcx. %[exchange], 0, %[ptr] \n" " stdcx. %[exchange], 0, %[ptr] \n"

View File

@ -72,7 +72,7 @@ private:
template <typename T> T *create_window(); template <typename T> T *create_window();
running_machine *m_machine; running_machine *m_machine;
auto_pointer<ui_metrics> m_metrics; std::unique_ptr<ui_metrics> m_metrics;
bool m_waiting_for_debugger; bool m_waiting_for_debugger;
simple_list<debugwin_info> m_window_list; simple_list<debugwin_info> m_window_list;
consolewin_info *m_main_console; consolewin_info *m_main_console;
@ -94,7 +94,7 @@ void debugger_windows::exit()
void debugger_windows::init_debugger(running_machine &machine) void debugger_windows::init_debugger(running_machine &machine)
{ {
m_machine = &machine; m_machine = &machine;
m_metrics.reset(global_alloc(ui_metrics(downcast<osd_options &>(m_machine->options())))); m_metrics = std::make_unique<ui_metrics>(downcast<osd_options &>(m_machine->options()));
} }

View File

@ -80,7 +80,7 @@ void debugwin_info::prev_view(debugview_info *curview)
{ {
for (curindex = numviews - 1; curindex > 0; curindex--) for (curindex = numviews - 1; curindex > 0; curindex--)
{ {
if (m_views[curindex] == curview) if (m_views[curindex].get() == curview)
break; break;
} }
if (curindex < 0) if (curindex < 0)
@ -126,7 +126,7 @@ void debugwin_info::next_view(debugview_info *curview)
{ {
for (curindex = numviews - 1; curindex > 0; curindex--) for (curindex = numviews - 1; curindex > 0; curindex--)
{ {
if (m_views[curindex] == curview) if (m_views[curindex].get() == curview)
break; break;
} }
} }

View File

@ -116,7 +116,7 @@ protected:
void draw_border(HDC dc, RECT &bounds); void draw_border(HDC dc, RECT &bounds);
void draw_border(HDC dc, HWND child); void draw_border(HDC dc, HWND child);
auto_pointer<debugview_info> m_views[MAX_VIEWS]; std::unique_ptr<debugview_info> m_views[MAX_VIEWS];
private: private:
LRESULT window_proc(UINT message, WPARAM wparam, LPARAM lparam); LRESULT window_proc(UINT message, WPARAM wparam, LPARAM lparam);

View File

@ -226,7 +226,7 @@ void osd_lock_acquire(osd_lock *lock)
current = pthread_self(); current = pthread_self();
prev = osd_compare_exchange_pthread_t(&lock->holder, 0, current); prev = osd_compare_exchange_pthread_t(&lock->holder, 0, current);
if (prev != (size_t)NULL && prev != current) if (prev != nullptr && prev != current)
{ {
do { do {
register INT32 spin = 10000; // Convenient spin count register INT32 spin = 10000; // Convenient spin count
@ -281,7 +281,7 @@ void osd_lock_acquire(osd_lock *lock)
nanosleep(&sleep, &remaining); // sleep for 100us nanosleep(&sleep, &remaining); // sleep for 100us
} }
#endif #endif
} while (osd_compare_exchange_pthread_t(&lock->holder, 0, current) != (size_t)NULL); } while (osd_compare_exchange_pthread_t(&lock->holder, 0, current) != nullptr);
} }
lock->count++; lock->count++;
} }
@ -296,7 +296,7 @@ int osd_lock_try(osd_lock *lock)
current = pthread_self(); current = pthread_self();
prev = osd_compare_exchange_pthread_t(&lock->holder, 0, current); prev = osd_compare_exchange_pthread_t(&lock->holder, 0, current);
if (prev == (size_t)NULL || prev == current) if (prev == nullptr || prev == current)
{ {
lock->count++; lock->count++;
return 1; return 1;