Commits

spencercw committed 716b76b

#46 Add proper command line parsing.

Also fixed bug in the release build where GbCpu::pause was never initialised.

Comments (0)

Files changed (41)

 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gb_emulator_main", "gb_emulator_main\gb_emulator_main.vcxproj", "{C482DE3A-7E8A-46E3-8808-9AB6B297DBB9}"
 	ProjectSection(ProjectDependencies) = postProject
 		{36A6F338-8651-4F03-9CC7-15D970CED2BE} = {36A6F338-8651-4F03-9CC7-15D970CED2BE}
+		{652CAAA0-2AAC-435C-A1BA-CBD1F5B0945D} = {652CAAA0-2AAC-435C-A1BA-CBD1F5B0945D}
 	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sdcc", "sdcc", "{318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "config", "third_party\sdcc\config.vcxproj", "{EA41B63D-76C6-B813-E599-AF5F008BDE4F}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "config", "third_party\sdcc\config.vcxproj", "{AF6166D9-3EDA-D68D-DE92-F571B2AD1754}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asgb", "third_party\sdcc\sdas\asgb\asgb.vcxproj", "{87AB8AFB-4210-1384-5848-F90A36E6F60A}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asgb", "third_party\sdcc\sdas\asgb\asgb.vcxproj", "{1342F6A4-878F-08E4-8395-97ABE0F63951}"
 	ProjectSection(ProjectDependencies) = postProject
-		{EA41B63D-76C6-B813-E599-AF5F008BDE4F} = {EA41B63D-76C6-B813-E599-AF5F008BDE4F}
+		{AF6166D9-3EDA-D68D-DE92-F571B2AD1754} = {AF6166D9-3EDA-D68D-DE92-F571B2AD1754}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "makebin", "third_party\sdcc\support\makebin\makebin.vcxproj", "{E9C4C803-8C50-0C43-3027-84991DE738FB}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "makebin", "third_party\sdcc\support\makebin\makebin.vcxproj", "{12C4DF94-8F2D-02C4-EEED-86D88AF9C42A}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "librarian", "third_party\sdcc\support\librarian\librarian.vcxproj", "{7C8D2BCF-9326-96CB-38B9-E9B9B9CDB5F0}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "librarian", "third_party\sdcc\support\librarian\librarian.vcxproj", "{D36E44D7-7F8D-5634-618A-301DF919129F}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "z80a", "third_party\sdcc\src\z80\z80a.vcxproj", "{DCF0BBB8-2A9F-C960-0F58-F36D703CD232}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "z80a", "third_party\sdcc\src\z80\z80a.vcxproj", "{E1A7C65A-FE0A-CB01-F783-32FCF5147466}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "z80", "third_party\sdcc\src\z80\z80.vcxproj", "{DB0EEE50-838B-E0E4-9701-15723B6392B4}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "z80", "third_party\sdcc\src\z80\z80.vcxproj", "{92496E41-5CB8-08BF-A4D7-23036E57DB8D}"
 	ProjectSection(ProjectDependencies) = postProject
-		{EA41B63D-76C6-B813-E599-AF5F008BDE4F} = {EA41B63D-76C6-B813-E599-AF5F008BDE4F}
-		{DCF0BBB8-2A9F-C960-0F58-F36D703CD232} = {DCF0BBB8-2A9F-C960-0F58-F36D703CD232}
-		{1B30CBBB-439F-8DE9-86D8-7A074E12F9E6} = {1B30CBBB-439F-8DE9-86D8-7A074E12F9E6}
+		{42EDC447-7082-17F1-A02F-2ED8746669AA} = {42EDC447-7082-17F1-A02F-2ED8746669AA}
+		{E1A7C65A-FE0A-CB01-F783-32FCF5147466} = {E1A7C65A-FE0A-CB01-F783-32FCF5147466}
+		{AF6166D9-3EDA-D68D-DE92-F571B2AD1754} = {AF6166D9-3EDA-D68D-DE92-F571B2AD1754}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yacc", "third_party\sdcc\src\yacc.vcxproj", "{1B30CBBB-439F-8DE9-86D8-7A074E12F9E6}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yacc", "third_party\sdcc\src\yacc.vcxproj", "{42EDC447-7082-17F1-A02F-2ED8746669AA}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "src", "third_party\sdcc\src\src.vcxproj", "{2CA9A94E-367A-6137-4189-8C5C15EFE681}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "src", "third_party\sdcc\src\src.vcxproj", "{B11F7AFD-04A2-9DCF-266A-B2C0635596D6}"
 	ProjectSection(ProjectDependencies) = postProject
-		{EA41B63D-76C6-B813-E599-AF5F008BDE4F} = {EA41B63D-76C6-B813-E599-AF5F008BDE4F}
-		{DB0EEE50-838B-E0E4-9701-15723B6392B4} = {DB0EEE50-838B-E0E4-9701-15723B6392B4}
-		{1B30CBBB-439F-8DE9-86D8-7A074E12F9E6} = {1B30CBBB-439F-8DE9-86D8-7A074E12F9E6}
+		{92496E41-5CB8-08BF-A4D7-23036E57DB8D} = {92496E41-5CB8-08BF-A4D7-23036E57DB8D}
+		{42EDC447-7082-17F1-A02F-2ED8746669AA} = {42EDC447-7082-17F1-A02F-2ED8746669AA}
+		{AF6166D9-3EDA-D68D-DE92-F571B2AD1754} = {AF6166D9-3EDA-D68D-DE92-F571B2AD1754}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdcppa", "third_party\sdcc\support\cpp\sdcppa.vcxproj", "{ACBF1FE5-DEC3-8681-3CD1-9D552A4D5B30}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdcppa", "third_party\sdcc\support\cpp\sdcppa.vcxproj", "{44E8DACE-F6D4-ABC9-5A93-AB0F603D7EDF}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdcpp", "third_party\sdcc\support\cpp\sdcpp.vcxproj", "{9231D57F-C0D3-8C7F-849E-C83455E97F76}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sdcpp", "third_party\sdcc\support\cpp\sdcpp.vcxproj", "{A3DA8040-004F-7E7D-D507-1972371079D3}"
 	ProjectSection(ProjectDependencies) = postProject
-		{ACBF1FE5-DEC3-8681-3CD1-9D552A4D5B30} = {ACBF1FE5-DEC3-8681-3CD1-9D552A4D5B30}
+		{44E8DACE-F6D4-ABC9-5A93-AB0F603D7EDF} = {44E8DACE-F6D4-ABC9-5A93-AB0F603D7EDF}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aslink", "third_party\sdcc\sdas\linksrc\aslink.vcxproj", "{E92FA78D-64F0-EE65-45ED-F4CA76CBCAF5}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aslink", "third_party\sdcc\sdas\linksrc\aslink.vcxproj", "{2535D37F-2DC1-8EFB-AA96-50CCBADD1AE5}"
 	ProjectSection(ProjectDependencies) = postProject
-		{EA41B63D-76C6-B813-E599-AF5F008BDE4F} = {EA41B63D-76C6-B813-E599-AF5F008BDE4F}
+		{AF6166D9-3EDA-D68D-DE92-F571B2AD1754} = {AF6166D9-3EDA-D68D-DE92-F571B2AD1754}
 	EndProjectSection
 EndProject
 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gbdk", "gbdk", "{CD8488DE-0838-46D1-980C-3E325A7CF560}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gbz80", "third_party\gbdk\libc\gbz80.vcxproj", "{49C9510A-C9BD-4199-9602-A724CC257817}"
 	ProjectSection(ProjectDependencies) = postProject
-		{2CA9A94E-367A-6137-4189-8C5C15EFE681} = {2CA9A94E-367A-6137-4189-8C5C15EFE681}
-		{9231D57F-C0D3-8C7F-849E-C83455E97F76} = {9231D57F-C0D3-8C7F-849E-C83455E97F76}
-		{7C8D2BCF-9326-96CB-38B9-E9B9B9CDB5F0} = {7C8D2BCF-9326-96CB-38B9-E9B9B9CDB5F0}
-		{87AB8AFB-4210-1384-5848-F90A36E6F60A} = {87AB8AFB-4210-1384-5848-F90A36E6F60A}
+		{A3DA8040-004F-7E7D-D507-1972371079D3} = {A3DA8040-004F-7E7D-D507-1972371079D3}
+		{1342F6A4-878F-08E4-8395-97ABE0F63951} = {1342F6A4-878F-08E4-8395-97ABE0F63951}
+		{D36E44D7-7F8D-5634-618A-301DF919129F} = {D36E44D7-7F8D-5634-618A-301DF919129F}
+		{B11F7AFD-04A2-9DCF-266A-B2C0635596D6} = {B11F7AFD-04A2-9DCF-266A-B2C0635596D6}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "maccer", "third_party\gbdk\maccer\maccer.vcxproj", "{5F04981B-7F84-4440-8BC3-D250AABDACE0}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gb", "third_party\gbdk\libc\gb\gb.vcxproj", "{72BF5C65-4B6D-4A4A-A958-6F64EDD14E65}"
 	ProjectSection(ProjectDependencies) = postProject
-		{2CA9A94E-367A-6137-4189-8C5C15EFE681} = {2CA9A94E-367A-6137-4189-8C5C15EFE681}
-		{9231D57F-C0D3-8C7F-849E-C83455E97F76} = {9231D57F-C0D3-8C7F-849E-C83455E97F76}
-		{7C8D2BCF-9326-96CB-38B9-E9B9B9CDB5F0} = {7C8D2BCF-9326-96CB-38B9-E9B9B9CDB5F0}
-		{87AB8AFB-4210-1384-5848-F90A36E6F60A} = {87AB8AFB-4210-1384-5848-F90A36E6F60A}
+		{A3DA8040-004F-7E7D-D507-1972371079D3} = {A3DA8040-004F-7E7D-D507-1972371079D3}
+		{1342F6A4-878F-08E4-8395-97ABE0F63951} = {1342F6A4-878F-08E4-8395-97ABE0F63951}
+		{D36E44D7-7F8D-5634-618A-301DF919129F} = {D36E44D7-7F8D-5634-618A-301DF919129F}
+		{B11F7AFD-04A2-9DCF-266A-B2C0635596D6} = {B11F7AFD-04A2-9DCF-266A-B2C0635596D6}
 	EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "argtable", "third_party\argtable\argtable.vcxproj", "{652CAAA0-2AAC-435C-A1BA-CBD1F5B0945D}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
 		{C482DE3A-7E8A-46E3-8808-9AB6B297DBB9}.Release|Win32.Build.0 = Release|Win32
 		{C482DE3A-7E8A-46E3-8808-9AB6B297DBB9}.Release|x64.ActiveCfg = Release|x64
 		{C482DE3A-7E8A-46E3-8808-9AB6B297DBB9}.Release|x64.Build.0 = Release|x64
-		{EA41B63D-76C6-B813-E599-AF5F008BDE4F}.Debug|Win32.ActiveCfg = Debug|Win32
-		{EA41B63D-76C6-B813-E599-AF5F008BDE4F}.Debug|Win32.Build.0 = Debug|Win32
-		{EA41B63D-76C6-B813-E599-AF5F008BDE4F}.Debug|x64.ActiveCfg = Debug|x64
-		{EA41B63D-76C6-B813-E599-AF5F008BDE4F}.Debug|x64.Build.0 = Debug|x64
-		{EA41B63D-76C6-B813-E599-AF5F008BDE4F}.Release|Win32.ActiveCfg = Release|Win32
-		{EA41B63D-76C6-B813-E599-AF5F008BDE4F}.Release|Win32.Build.0 = Release|Win32
-		{EA41B63D-76C6-B813-E599-AF5F008BDE4F}.Release|x64.ActiveCfg = Release|x64
-		{EA41B63D-76C6-B813-E599-AF5F008BDE4F}.Release|x64.Build.0 = Release|x64
-		{87AB8AFB-4210-1384-5848-F90A36E6F60A}.Debug|Win32.ActiveCfg = Debug|Win32
-		{87AB8AFB-4210-1384-5848-F90A36E6F60A}.Debug|Win32.Build.0 = Debug|Win32
-		{87AB8AFB-4210-1384-5848-F90A36E6F60A}.Debug|x64.ActiveCfg = Debug|x64
-		{87AB8AFB-4210-1384-5848-F90A36E6F60A}.Debug|x64.Build.0 = Debug|x64
-		{87AB8AFB-4210-1384-5848-F90A36E6F60A}.Release|Win32.ActiveCfg = Release|Win32
-		{87AB8AFB-4210-1384-5848-F90A36E6F60A}.Release|Win32.Build.0 = Release|Win32
-		{87AB8AFB-4210-1384-5848-F90A36E6F60A}.Release|x64.ActiveCfg = Release|x64
-		{87AB8AFB-4210-1384-5848-F90A36E6F60A}.Release|x64.Build.0 = Release|x64
-		{E9C4C803-8C50-0C43-3027-84991DE738FB}.Debug|Win32.ActiveCfg = Debug|Win32
-		{E9C4C803-8C50-0C43-3027-84991DE738FB}.Debug|Win32.Build.0 = Debug|Win32
-		{E9C4C803-8C50-0C43-3027-84991DE738FB}.Debug|x64.ActiveCfg = Debug|x64
-		{E9C4C803-8C50-0C43-3027-84991DE738FB}.Debug|x64.Build.0 = Debug|x64
-		{E9C4C803-8C50-0C43-3027-84991DE738FB}.Release|Win32.ActiveCfg = Release|Win32
-		{E9C4C803-8C50-0C43-3027-84991DE738FB}.Release|Win32.Build.0 = Release|Win32
-		{E9C4C803-8C50-0C43-3027-84991DE738FB}.Release|x64.ActiveCfg = Release|x64
-		{E9C4C803-8C50-0C43-3027-84991DE738FB}.Release|x64.Build.0 = Release|x64
-		{7C8D2BCF-9326-96CB-38B9-E9B9B9CDB5F0}.Debug|Win32.ActiveCfg = Debug|Win32
-		{7C8D2BCF-9326-96CB-38B9-E9B9B9CDB5F0}.Debug|Win32.Build.0 = Debug|Win32
-		{7C8D2BCF-9326-96CB-38B9-E9B9B9CDB5F0}.Debug|x64.ActiveCfg = Debug|x64
-		{7C8D2BCF-9326-96CB-38B9-E9B9B9CDB5F0}.Debug|x64.Build.0 = Debug|x64
-		{7C8D2BCF-9326-96CB-38B9-E9B9B9CDB5F0}.Release|Win32.ActiveCfg = Release|Win32
-		{7C8D2BCF-9326-96CB-38B9-E9B9B9CDB5F0}.Release|Win32.Build.0 = Release|Win32
-		{7C8D2BCF-9326-96CB-38B9-E9B9B9CDB5F0}.Release|x64.ActiveCfg = Release|x64
-		{7C8D2BCF-9326-96CB-38B9-E9B9B9CDB5F0}.Release|x64.Build.0 = Release|x64
-		{DCF0BBB8-2A9F-C960-0F58-F36D703CD232}.Debug|Win32.ActiveCfg = Debug|Win32
-		{DCF0BBB8-2A9F-C960-0F58-F36D703CD232}.Debug|Win32.Build.0 = Debug|Win32
-		{DCF0BBB8-2A9F-C960-0F58-F36D703CD232}.Debug|x64.ActiveCfg = Debug|x64
-		{DCF0BBB8-2A9F-C960-0F58-F36D703CD232}.Debug|x64.Build.0 = Debug|x64
-		{DCF0BBB8-2A9F-C960-0F58-F36D703CD232}.Release|Win32.ActiveCfg = Release|Win32
-		{DCF0BBB8-2A9F-C960-0F58-F36D703CD232}.Release|Win32.Build.0 = Release|Win32
-		{DCF0BBB8-2A9F-C960-0F58-F36D703CD232}.Release|x64.ActiveCfg = Release|x64
-		{DCF0BBB8-2A9F-C960-0F58-F36D703CD232}.Release|x64.Build.0 = Release|x64
-		{DB0EEE50-838B-E0E4-9701-15723B6392B4}.Debug|Win32.ActiveCfg = Debug|Win32
-		{DB0EEE50-838B-E0E4-9701-15723B6392B4}.Debug|Win32.Build.0 = Debug|Win32
-		{DB0EEE50-838B-E0E4-9701-15723B6392B4}.Debug|x64.ActiveCfg = Debug|x64
-		{DB0EEE50-838B-E0E4-9701-15723B6392B4}.Debug|x64.Build.0 = Debug|x64
-		{DB0EEE50-838B-E0E4-9701-15723B6392B4}.Release|Win32.ActiveCfg = Release|Win32
-		{DB0EEE50-838B-E0E4-9701-15723B6392B4}.Release|Win32.Build.0 = Release|Win32
-		{DB0EEE50-838B-E0E4-9701-15723B6392B4}.Release|x64.ActiveCfg = Release|x64
-		{DB0EEE50-838B-E0E4-9701-15723B6392B4}.Release|x64.Build.0 = Release|x64
-		{1B30CBBB-439F-8DE9-86D8-7A074E12F9E6}.Debug|Win32.ActiveCfg = Debug|Win32
-		{1B30CBBB-439F-8DE9-86D8-7A074E12F9E6}.Debug|Win32.Build.0 = Debug|Win32
-		{1B30CBBB-439F-8DE9-86D8-7A074E12F9E6}.Debug|x64.ActiveCfg = Debug|x64
-		{1B30CBBB-439F-8DE9-86D8-7A074E12F9E6}.Debug|x64.Build.0 = Debug|x64
-		{1B30CBBB-439F-8DE9-86D8-7A074E12F9E6}.Release|Win32.ActiveCfg = Release|Win32
-		{1B30CBBB-439F-8DE9-86D8-7A074E12F9E6}.Release|Win32.Build.0 = Release|Win32
-		{1B30CBBB-439F-8DE9-86D8-7A074E12F9E6}.Release|x64.ActiveCfg = Release|x64
-		{1B30CBBB-439F-8DE9-86D8-7A074E12F9E6}.Release|x64.Build.0 = Release|x64
-		{2CA9A94E-367A-6137-4189-8C5C15EFE681}.Debug|Win32.ActiveCfg = Debug|Win32
-		{2CA9A94E-367A-6137-4189-8C5C15EFE681}.Debug|Win32.Build.0 = Debug|Win32
-		{2CA9A94E-367A-6137-4189-8C5C15EFE681}.Debug|x64.ActiveCfg = Debug|x64
-		{2CA9A94E-367A-6137-4189-8C5C15EFE681}.Debug|x64.Build.0 = Debug|x64
-		{2CA9A94E-367A-6137-4189-8C5C15EFE681}.Release|Win32.ActiveCfg = Release|Win32
-		{2CA9A94E-367A-6137-4189-8C5C15EFE681}.Release|Win32.Build.0 = Release|Win32
-		{2CA9A94E-367A-6137-4189-8C5C15EFE681}.Release|x64.ActiveCfg = Release|x64
-		{2CA9A94E-367A-6137-4189-8C5C15EFE681}.Release|x64.Build.0 = Release|x64
-		{ACBF1FE5-DEC3-8681-3CD1-9D552A4D5B30}.Debug|Win32.ActiveCfg = Debug|Win32
-		{ACBF1FE5-DEC3-8681-3CD1-9D552A4D5B30}.Debug|Win32.Build.0 = Debug|Win32
-		{ACBF1FE5-DEC3-8681-3CD1-9D552A4D5B30}.Debug|x64.ActiveCfg = Debug|x64
-		{ACBF1FE5-DEC3-8681-3CD1-9D552A4D5B30}.Debug|x64.Build.0 = Debug|x64
-		{ACBF1FE5-DEC3-8681-3CD1-9D552A4D5B30}.Release|Win32.ActiveCfg = Release|Win32
-		{ACBF1FE5-DEC3-8681-3CD1-9D552A4D5B30}.Release|Win32.Build.0 = Release|Win32
-		{ACBF1FE5-DEC3-8681-3CD1-9D552A4D5B30}.Release|x64.ActiveCfg = Release|x64
-		{ACBF1FE5-DEC3-8681-3CD1-9D552A4D5B30}.Release|x64.Build.0 = Release|x64
-		{9231D57F-C0D3-8C7F-849E-C83455E97F76}.Debug|Win32.ActiveCfg = Debug|Win32
-		{9231D57F-C0D3-8C7F-849E-C83455E97F76}.Debug|Win32.Build.0 = Debug|Win32
-		{9231D57F-C0D3-8C7F-849E-C83455E97F76}.Debug|x64.ActiveCfg = Debug|x64
-		{9231D57F-C0D3-8C7F-849E-C83455E97F76}.Debug|x64.Build.0 = Debug|x64
-		{9231D57F-C0D3-8C7F-849E-C83455E97F76}.Release|Win32.ActiveCfg = Release|Win32
-		{9231D57F-C0D3-8C7F-849E-C83455E97F76}.Release|Win32.Build.0 = Release|Win32
-		{9231D57F-C0D3-8C7F-849E-C83455E97F76}.Release|x64.ActiveCfg = Release|x64
-		{9231D57F-C0D3-8C7F-849E-C83455E97F76}.Release|x64.Build.0 = Release|x64
-		{E92FA78D-64F0-EE65-45ED-F4CA76CBCAF5}.Debug|Win32.ActiveCfg = Debug|Win32
-		{E92FA78D-64F0-EE65-45ED-F4CA76CBCAF5}.Debug|Win32.Build.0 = Debug|Win32
-		{E92FA78D-64F0-EE65-45ED-F4CA76CBCAF5}.Debug|x64.ActiveCfg = Debug|x64
-		{E92FA78D-64F0-EE65-45ED-F4CA76CBCAF5}.Debug|x64.Build.0 = Debug|x64
-		{E92FA78D-64F0-EE65-45ED-F4CA76CBCAF5}.Release|Win32.ActiveCfg = Release|Win32
-		{E92FA78D-64F0-EE65-45ED-F4CA76CBCAF5}.Release|Win32.Build.0 = Release|Win32
-		{E92FA78D-64F0-EE65-45ED-F4CA76CBCAF5}.Release|x64.ActiveCfg = Release|x64
-		{E92FA78D-64F0-EE65-45ED-F4CA76CBCAF5}.Release|x64.Build.0 = Release|x64
+		{AF6166D9-3EDA-D68D-DE92-F571B2AD1754}.Debug|Win32.ActiveCfg = Debug|Win32
+		{AF6166D9-3EDA-D68D-DE92-F571B2AD1754}.Debug|Win32.Build.0 = Debug|Win32
+		{AF6166D9-3EDA-D68D-DE92-F571B2AD1754}.Debug|x64.ActiveCfg = Debug|x64
+		{AF6166D9-3EDA-D68D-DE92-F571B2AD1754}.Debug|x64.Build.0 = Debug|x64
+		{AF6166D9-3EDA-D68D-DE92-F571B2AD1754}.Release|Win32.ActiveCfg = Release|Win32
+		{AF6166D9-3EDA-D68D-DE92-F571B2AD1754}.Release|Win32.Build.0 = Release|Win32
+		{AF6166D9-3EDA-D68D-DE92-F571B2AD1754}.Release|x64.ActiveCfg = Release|x64
+		{AF6166D9-3EDA-D68D-DE92-F571B2AD1754}.Release|x64.Build.0 = Release|x64
+		{1342F6A4-878F-08E4-8395-97ABE0F63951}.Debug|Win32.ActiveCfg = Debug|Win32
+		{1342F6A4-878F-08E4-8395-97ABE0F63951}.Debug|Win32.Build.0 = Debug|Win32
+		{1342F6A4-878F-08E4-8395-97ABE0F63951}.Debug|x64.ActiveCfg = Debug|x64
+		{1342F6A4-878F-08E4-8395-97ABE0F63951}.Debug|x64.Build.0 = Debug|x64
+		{1342F6A4-878F-08E4-8395-97ABE0F63951}.Release|Win32.ActiveCfg = Release|Win32
+		{1342F6A4-878F-08E4-8395-97ABE0F63951}.Release|Win32.Build.0 = Release|Win32
+		{1342F6A4-878F-08E4-8395-97ABE0F63951}.Release|x64.ActiveCfg = Release|x64
+		{1342F6A4-878F-08E4-8395-97ABE0F63951}.Release|x64.Build.0 = Release|x64
+		{12C4DF94-8F2D-02C4-EEED-86D88AF9C42A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{12C4DF94-8F2D-02C4-EEED-86D88AF9C42A}.Debug|Win32.Build.0 = Debug|Win32
+		{12C4DF94-8F2D-02C4-EEED-86D88AF9C42A}.Debug|x64.ActiveCfg = Debug|x64
+		{12C4DF94-8F2D-02C4-EEED-86D88AF9C42A}.Debug|x64.Build.0 = Debug|x64
+		{12C4DF94-8F2D-02C4-EEED-86D88AF9C42A}.Release|Win32.ActiveCfg = Release|Win32
+		{12C4DF94-8F2D-02C4-EEED-86D88AF9C42A}.Release|Win32.Build.0 = Release|Win32
+		{12C4DF94-8F2D-02C4-EEED-86D88AF9C42A}.Release|x64.ActiveCfg = Release|x64
+		{12C4DF94-8F2D-02C4-EEED-86D88AF9C42A}.Release|x64.Build.0 = Release|x64
+		{D36E44D7-7F8D-5634-618A-301DF919129F}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D36E44D7-7F8D-5634-618A-301DF919129F}.Debug|Win32.Build.0 = Debug|Win32
+		{D36E44D7-7F8D-5634-618A-301DF919129F}.Debug|x64.ActiveCfg = Debug|x64
+		{D36E44D7-7F8D-5634-618A-301DF919129F}.Debug|x64.Build.0 = Debug|x64
+		{D36E44D7-7F8D-5634-618A-301DF919129F}.Release|Win32.ActiveCfg = Release|Win32
+		{D36E44D7-7F8D-5634-618A-301DF919129F}.Release|Win32.Build.0 = Release|Win32
+		{D36E44D7-7F8D-5634-618A-301DF919129F}.Release|x64.ActiveCfg = Release|x64
+		{D36E44D7-7F8D-5634-618A-301DF919129F}.Release|x64.Build.0 = Release|x64
+		{E1A7C65A-FE0A-CB01-F783-32FCF5147466}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E1A7C65A-FE0A-CB01-F783-32FCF5147466}.Debug|Win32.Build.0 = Debug|Win32
+		{E1A7C65A-FE0A-CB01-F783-32FCF5147466}.Debug|x64.ActiveCfg = Debug|x64
+		{E1A7C65A-FE0A-CB01-F783-32FCF5147466}.Debug|x64.Build.0 = Debug|x64
+		{E1A7C65A-FE0A-CB01-F783-32FCF5147466}.Release|Win32.ActiveCfg = Release|Win32
+		{E1A7C65A-FE0A-CB01-F783-32FCF5147466}.Release|Win32.Build.0 = Release|Win32
+		{E1A7C65A-FE0A-CB01-F783-32FCF5147466}.Release|x64.ActiveCfg = Release|x64
+		{E1A7C65A-FE0A-CB01-F783-32FCF5147466}.Release|x64.Build.0 = Release|x64
+		{92496E41-5CB8-08BF-A4D7-23036E57DB8D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{92496E41-5CB8-08BF-A4D7-23036E57DB8D}.Debug|Win32.Build.0 = Debug|Win32
+		{92496E41-5CB8-08BF-A4D7-23036E57DB8D}.Debug|x64.ActiveCfg = Debug|x64
+		{92496E41-5CB8-08BF-A4D7-23036E57DB8D}.Debug|x64.Build.0 = Debug|x64
+		{92496E41-5CB8-08BF-A4D7-23036E57DB8D}.Release|Win32.ActiveCfg = Release|Win32
+		{92496E41-5CB8-08BF-A4D7-23036E57DB8D}.Release|Win32.Build.0 = Release|Win32
+		{92496E41-5CB8-08BF-A4D7-23036E57DB8D}.Release|x64.ActiveCfg = Release|x64
+		{92496E41-5CB8-08BF-A4D7-23036E57DB8D}.Release|x64.Build.0 = Release|x64
+		{42EDC447-7082-17F1-A02F-2ED8746669AA}.Debug|Win32.ActiveCfg = Debug|Win32
+		{42EDC447-7082-17F1-A02F-2ED8746669AA}.Debug|Win32.Build.0 = Debug|Win32
+		{42EDC447-7082-17F1-A02F-2ED8746669AA}.Debug|x64.ActiveCfg = Debug|x64
+		{42EDC447-7082-17F1-A02F-2ED8746669AA}.Debug|x64.Build.0 = Debug|x64
+		{42EDC447-7082-17F1-A02F-2ED8746669AA}.Release|Win32.ActiveCfg = Release|Win32
+		{42EDC447-7082-17F1-A02F-2ED8746669AA}.Release|Win32.Build.0 = Release|Win32
+		{42EDC447-7082-17F1-A02F-2ED8746669AA}.Release|x64.ActiveCfg = Release|x64
+		{42EDC447-7082-17F1-A02F-2ED8746669AA}.Release|x64.Build.0 = Release|x64
+		{B11F7AFD-04A2-9DCF-266A-B2C0635596D6}.Debug|Win32.ActiveCfg = Debug|Win32
+		{B11F7AFD-04A2-9DCF-266A-B2C0635596D6}.Debug|Win32.Build.0 = Debug|Win32
+		{B11F7AFD-04A2-9DCF-266A-B2C0635596D6}.Debug|x64.ActiveCfg = Debug|x64
+		{B11F7AFD-04A2-9DCF-266A-B2C0635596D6}.Debug|x64.Build.0 = Debug|x64
+		{B11F7AFD-04A2-9DCF-266A-B2C0635596D6}.Release|Win32.ActiveCfg = Release|Win32
+		{B11F7AFD-04A2-9DCF-266A-B2C0635596D6}.Release|Win32.Build.0 = Release|Win32
+		{B11F7AFD-04A2-9DCF-266A-B2C0635596D6}.Release|x64.ActiveCfg = Release|x64
+		{B11F7AFD-04A2-9DCF-266A-B2C0635596D6}.Release|x64.Build.0 = Release|x64
+		{44E8DACE-F6D4-ABC9-5A93-AB0F603D7EDF}.Debug|Win32.ActiveCfg = Debug|Win32
+		{44E8DACE-F6D4-ABC9-5A93-AB0F603D7EDF}.Debug|Win32.Build.0 = Debug|Win32
+		{44E8DACE-F6D4-ABC9-5A93-AB0F603D7EDF}.Debug|x64.ActiveCfg = Debug|x64
+		{44E8DACE-F6D4-ABC9-5A93-AB0F603D7EDF}.Debug|x64.Build.0 = Debug|x64
+		{44E8DACE-F6D4-ABC9-5A93-AB0F603D7EDF}.Release|Win32.ActiveCfg = Release|Win32
+		{44E8DACE-F6D4-ABC9-5A93-AB0F603D7EDF}.Release|Win32.Build.0 = Release|Win32
+		{44E8DACE-F6D4-ABC9-5A93-AB0F603D7EDF}.Release|x64.ActiveCfg = Release|x64
+		{44E8DACE-F6D4-ABC9-5A93-AB0F603D7EDF}.Release|x64.Build.0 = Release|x64
+		{A3DA8040-004F-7E7D-D507-1972371079D3}.Debug|Win32.ActiveCfg = Debug|Win32
+		{A3DA8040-004F-7E7D-D507-1972371079D3}.Debug|Win32.Build.0 = Debug|Win32
+		{A3DA8040-004F-7E7D-D507-1972371079D3}.Debug|x64.ActiveCfg = Debug|x64
+		{A3DA8040-004F-7E7D-D507-1972371079D3}.Debug|x64.Build.0 = Debug|x64
+		{A3DA8040-004F-7E7D-D507-1972371079D3}.Release|Win32.ActiveCfg = Release|Win32
+		{A3DA8040-004F-7E7D-D507-1972371079D3}.Release|Win32.Build.0 = Release|Win32
+		{A3DA8040-004F-7E7D-D507-1972371079D3}.Release|x64.ActiveCfg = Release|x64
+		{A3DA8040-004F-7E7D-D507-1972371079D3}.Release|x64.Build.0 = Release|x64
+		{2535D37F-2DC1-8EFB-AA96-50CCBADD1AE5}.Debug|Win32.ActiveCfg = Debug|Win32
+		{2535D37F-2DC1-8EFB-AA96-50CCBADD1AE5}.Debug|Win32.Build.0 = Debug|Win32
+		{2535D37F-2DC1-8EFB-AA96-50CCBADD1AE5}.Debug|x64.ActiveCfg = Debug|x64
+		{2535D37F-2DC1-8EFB-AA96-50CCBADD1AE5}.Debug|x64.Build.0 = Debug|x64
+		{2535D37F-2DC1-8EFB-AA96-50CCBADD1AE5}.Release|Win32.ActiveCfg = Release|Win32
+		{2535D37F-2DC1-8EFB-AA96-50CCBADD1AE5}.Release|Win32.Build.0 = Release|Win32
+		{2535D37F-2DC1-8EFB-AA96-50CCBADD1AE5}.Release|x64.ActiveCfg = Release|x64
+		{2535D37F-2DC1-8EFB-AA96-50CCBADD1AE5}.Release|x64.Build.0 = Release|x64
 		{49C9510A-C9BD-4199-9602-A724CC257817}.Debug|Win32.ActiveCfg = Debug|Win32
 		{49C9510A-C9BD-4199-9602-A724CC257817}.Debug|Win32.Build.0 = Debug|Win32
 		{49C9510A-C9BD-4199-9602-A724CC257817}.Debug|x64.ActiveCfg = Debug|x64
 		{72BF5C65-4B6D-4A4A-A958-6F64EDD14E65}.Release|Win32.Build.0 = Release|Win32
 		{72BF5C65-4B6D-4A4A-A958-6F64EDD14E65}.Release|x64.ActiveCfg = Release|x64
 		{72BF5C65-4B6D-4A4A-A958-6F64EDD14E65}.Release|x64.Build.0 = Release|x64
+		{652CAAA0-2AAC-435C-A1BA-CBD1F5B0945D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{652CAAA0-2AAC-435C-A1BA-CBD1F5B0945D}.Debug|Win32.Build.0 = Debug|Win32
+		{652CAAA0-2AAC-435C-A1BA-CBD1F5B0945D}.Debug|x64.ActiveCfg = Debug|x64
+		{652CAAA0-2AAC-435C-A1BA-CBD1F5B0945D}.Debug|x64.Build.0 = Debug|x64
+		{652CAAA0-2AAC-435C-A1BA-CBD1F5B0945D}.Release|Win32.ActiveCfg = Release|Win32
+		{652CAAA0-2AAC-435C-A1BA-CBD1F5B0945D}.Release|Win32.Build.0 = Release|Win32
+		{652CAAA0-2AAC-435C-A1BA-CBD1F5B0945D}.Release|x64.ActiveCfg = Release|x64
+		{652CAAA0-2AAC-435C-A1BA-CBD1F5B0945D}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 		{F12F4A06-F450-4CF4-B699-E29B3F4E90F5} = {E4EA39C2-326B-473E-8DFC-EB8206863544}
 		{318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C} = {E4EA39C2-326B-473E-8DFC-EB8206863544}
 		{CD8488DE-0838-46D1-980C-3E325A7CF560} = {E4EA39C2-326B-473E-8DFC-EB8206863544}
+		{652CAAA0-2AAC-435C-A1BA-CBD1F5B0945D} = {E4EA39C2-326B-473E-8DFC-EB8206863544}
 		{3E283F37-A4ED-41B7-A3E6-A2D89D131A30} = {C7EBDEED-384A-453D-B21E-18EFFDFD0D1E}
 		{B84FF31A-5F9A-46F8-AB22-DBFC9BECE3BE} = {C7EBDEED-384A-453D-B21E-18EFFDFD0D1E}
 		{1738D5F6-ED1E-47E0-B2F0-456864B93C1E} = {C7EBDEED-384A-453D-B21E-18EFFDFD0D1E}
 		{1DC41A27-9A43-412D-ABDB-90E6A427A228} = {99F2E5DC-7F2B-4A6C-9567-9616923B46B1}
 		{3D185A1F-893F-43D7-9C0E-84218717FDD0} = {99F2E5DC-7F2B-4A6C-9567-9616923B46B1}
-		{EA41B63D-76C6-B813-E599-AF5F008BDE4F} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
-		{87AB8AFB-4210-1384-5848-F90A36E6F60A} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
-		{E9C4C803-8C50-0C43-3027-84991DE738FB} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
-		{7C8D2BCF-9326-96CB-38B9-E9B9B9CDB5F0} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
-		{DCF0BBB8-2A9F-C960-0F58-F36D703CD232} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
-		{DB0EEE50-838B-E0E4-9701-15723B6392B4} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
-		{1B30CBBB-439F-8DE9-86D8-7A074E12F9E6} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
-		{2CA9A94E-367A-6137-4189-8C5C15EFE681} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
-		{ACBF1FE5-DEC3-8681-3CD1-9D552A4D5B30} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
-		{9231D57F-C0D3-8C7F-849E-C83455E97F76} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
-		{E92FA78D-64F0-EE65-45ED-F4CA76CBCAF5} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
+		{AF6166D9-3EDA-D68D-DE92-F571B2AD1754} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
+		{1342F6A4-878F-08E4-8395-97ABE0F63951} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
+		{12C4DF94-8F2D-02C4-EEED-86D88AF9C42A} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
+		{D36E44D7-7F8D-5634-618A-301DF919129F} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
+		{E1A7C65A-FE0A-CB01-F783-32FCF5147466} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
+		{92496E41-5CB8-08BF-A4D7-23036E57DB8D} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
+		{42EDC447-7082-17F1-A02F-2ED8746669AA} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
+		{B11F7AFD-04A2-9DCF-266A-B2C0635596D6} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
+		{44E8DACE-F6D4-ABC9-5A93-AB0F603D7EDF} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
+		{A3DA8040-004F-7E7D-D507-1972371079D3} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
+		{2535D37F-2DC1-8EFB-AA96-50CCBADD1AE5} = {318C7CCA-CB33-4798-BCCE-EBB4ADE05C3C}
 		{49C9510A-C9BD-4199-9602-A724CC257817} = {CD8488DE-0838-46D1-980C-3E325A7CF560}
 		{5F04981B-7F84-4440-8BC3-D250AABDACE0} = {CD8488DE-0838-46D1-980C-3E325A7CF560}
 		{72BF5C65-4B6D-4A4A-A958-6F64EDD14E65} = {CD8488DE-0838-46D1-980C-3E325A7CF560}

gb_emulator/gb_cpu_opcodes.cpp.inc

 /* This file was automatically generated from the opcodes definition file */
 
-switch (gb_.mem_.read(pc++))
+switch (gb_.mem_->read(pc++))
 {
 case LD_A_N:
 	cycles -= 2;
-	r.r8[A] = gb_.mem_.read(pc++);
+	r.r8[A] = gb_.mem_->read(pc++);
 	break;
 case LD_B_N:
 	cycles -= 2;
-	r.r8[B] = gb_.mem_.read(pc++);
+	r.r8[B] = gb_.mem_->read(pc++);
 	break;
 case LD_C_N:
 	cycles -= 2;
-	r.r8[C] = gb_.mem_.read(pc++);
+	r.r8[C] = gb_.mem_->read(pc++);
 	break;
 case LD_D_N:
 	cycles -= 2;
-	r.r8[D] = gb_.mem_.read(pc++);
+	r.r8[D] = gb_.mem_->read(pc++);
 	break;
 case LD_E_N:
 	cycles -= 2;
-	r.r8[E] = gb_.mem_.read(pc++);
+	r.r8[E] = gb_.mem_->read(pc++);
 	break;
 case LD_H_N:
 	cycles -= 2;
-	r.r8[H] = gb_.mem_.read(pc++);
+	r.r8[H] = gb_.mem_->read(pc++);
 	break;
 case LD_L_N:
 	cycles -= 2;
-	r.r8[L] = gb_.mem_.read(pc++);
+	r.r8[L] = gb_.mem_->read(pc++);
 	break;
 case LD_A_MBC:
 	cycles -= 2;
-	r.r8[A] = gb_.mem_.read(r.r16[BC]);
+	r.r8[A] = gb_.mem_->read(r.r16[BC]);
 	break;
 case LD_A_MHL:
 	cycles -= 2;
-	r.r8[A] = gb_.mem_.read(r.r16[HL]);
+	r.r8[A] = gb_.mem_->read(r.r16[HL]);
 	break;
 case LD_A_MDE:
 	cycles -= 2;
-	r.r8[A] = gb_.mem_.read(r.r16[DE]);
+	r.r8[A] = gb_.mem_->read(r.r16[DE]);
 	break;
 case LD_A_MNN:
 	cycles -= 4;
-	r.r8[A] = gb_.mem_.read(gb_.mem_.read16(pc));
+	r.r8[A] = gb_.mem_->read(gb_.mem_->read16(pc));
 	pc += 2;
 	break;
 case LD_A_MFFC:
 	cycles -= 2;
-	r.r8[A] = gb_.mem_.read(0xff00 | r.r8[C]);
+	r.r8[A] = gb_.mem_->read(0xff00 | r.r8[C]);
 	break;
 case LD_A_MFFN:
 	cycles -= 3;
-	r.r8[A] = gb_.mem_.read(0xff00 | gb_.mem_.read(pc++));
+	r.r8[A] = gb_.mem_->read(0xff00 | gb_.mem_->read(pc++));
 	break;
 case LDD_A_MHL:
 	cycles -= 2;
-	r.r8[A] = gb_.mem_.read(r.r16[HL]--);
+	r.r8[A] = gb_.mem_->read(r.r16[HL]--);
 	break;
 case LDI_A_MHL:
 	cycles -= 2;
-	r.r8[A] = gb_.mem_.read(r.r16[HL]++);
+	r.r8[A] = gb_.mem_->read(r.r16[HL]++);
 	break;
 case LD_B_MHL:
 	cycles -= 2;
-	r.r8[B] = gb_.mem_.read(r.r16[HL]);
+	r.r8[B] = gb_.mem_->read(r.r16[HL]);
 	break;
 case LD_C_MHL:
 	cycles -= 2;
-	r.r8[C] = gb_.mem_.read(r.r16[HL]);
+	r.r8[C] = gb_.mem_->read(r.r16[HL]);
 	break;
 case LD_D_MHL:
 	cycles -= 2;
-	r.r8[D] = gb_.mem_.read(r.r16[HL]);
+	r.r8[D] = gb_.mem_->read(r.r16[HL]);
 	break;
 case LD_E_MHL:
 	cycles -= 2;
-	r.r8[E] = gb_.mem_.read(r.r16[HL]);
+	r.r8[E] = gb_.mem_->read(r.r16[HL]);
 	break;
 case LD_H_MHL:
 	cycles -= 2;
-	r.r8[H] = gb_.mem_.read(r.r16[HL]);
+	r.r8[H] = gb_.mem_->read(r.r16[HL]);
 	break;
 case LD_L_MHL:
 	cycles -= 2;
-	r.r8[L] = gb_.mem_.read(r.r16[HL]);
+	r.r8[L] = gb_.mem_->read(r.r16[HL]);
 	break;
 case LD_MBC_A:
 	cycles -= 2;
-	gb_.mem_.write(r.r16[BC], r.r8[A]);
+	gb_.mem_->write(r.r16[BC], r.r8[A]);
 	break;
 case LD_MDE_A:
 	cycles -= 2;
-	gb_.mem_.write(r.r16[DE], r.r8[A]);
+	gb_.mem_->write(r.r16[DE], r.r8[A]);
 	break;
 case LD_MHL_A:
 	cycles -= 2;
-	gb_.mem_.write(r.r16[HL], r.r8[A]);
+	gb_.mem_->write(r.r16[HL], r.r8[A]);
 	break;
 case LD_MNN_A:
 	cycles -= 4;
-	gb_.mem_.write(gb_.mem_.read16(pc), r.r8[A]);
+	gb_.mem_->write(gb_.mem_->read16(pc), r.r8[A]);
 	pc += 2;
 	break;
 case LD_MFFC_A:
 	cycles -= 2;
-	gb_.mem_.write(0xff00 | r.r8[C], r.r8[A]);
+	gb_.mem_->write(0xff00 | r.r8[C], r.r8[A]);
 	break;
 case LD_MFFN_A:
 	cycles -= 3;
-	gb_.mem_.write(0xff00 | gb_.mem_.read(pc++), r.r8[A]);
+	gb_.mem_->write(0xff00 | gb_.mem_->read(pc++), r.r8[A]);
 	break;
 case LDD_MHL_A:
 	cycles -= 2;
-	gb_.mem_.write(r.r16[HL]--, r.r8[A]);
+	gb_.mem_->write(r.r16[HL]--, r.r8[A]);
 	break;
 case LDI_MHL_A:
 	cycles -= 2;
-	gb_.mem_.write(r.r16[HL]++, r.r8[A]);
+	gb_.mem_->write(r.r16[HL]++, r.r8[A]);
 	break;
 case LD_MHL_B:
 	cycles -= 2;
-	gb_.mem_.write(r.r16[HL], r.r8[B]);
+	gb_.mem_->write(r.r16[HL], r.r8[B]);
 	break;
 case LD_MHL_C:
 	cycles -= 2;
-	gb_.mem_.write(r.r16[HL], r.r8[C]);
+	gb_.mem_->write(r.r16[HL], r.r8[C]);
 	break;
 case LD_MHL_D:
 	cycles -= 2;
-	gb_.mem_.write(r.r16[HL], r.r8[D]);
+	gb_.mem_->write(r.r16[HL], r.r8[D]);
 	break;
 case LD_MHL_E:
 	cycles -= 2;
-	gb_.mem_.write(r.r16[HL], r.r8[E]);
+	gb_.mem_->write(r.r16[HL], r.r8[E]);
 	break;
 case LD_MHL_H:
 	cycles -= 2;
-	gb_.mem_.write(r.r16[HL], r.r8[H]);
+	gb_.mem_->write(r.r16[HL], r.r8[H]);
 	break;
 case LD_MHL_L:
 	cycles -= 2;
-	gb_.mem_.write(r.r16[HL], r.r8[L]);
+	gb_.mem_->write(r.r16[HL], r.r8[L]);
 	break;
 case LD_MHL_N:
 	cycles -= 3;
-	gb_.mem_.write(r.r16[HL], gb_.mem_.read(pc++));
+	gb_.mem_->write(r.r16[HL], gb_.mem_->read(pc++));
 	break;
 case LD_A_A:
 	cycles -= 1;
 	break;
 case LD_BC_NN:
 	cycles -= 3;
-	r.r16[BC] = gb_.mem_.read16(pc);
+	r.r16[BC] = gb_.mem_->read16(pc);
 	pc += 2;
 	break;
 case LD_DE_NN:
 	cycles -= 3;
-	r.r16[DE] = gb_.mem_.read16(pc);
+	r.r16[DE] = gb_.mem_->read16(pc);
 	pc += 2;
 	break;
 case LD_HL_NN:
 	cycles -= 3;
-	r.r16[HL] = gb_.mem_.read16(pc);
+	r.r16[HL] = gb_.mem_->read16(pc);
 	pc += 2;
 	break;
 case LD_SP_NN:
 	cycles -= 3;
-	sp = gb_.mem_.read16(pc);
+	sp = gb_.mem_->read16(pc);
 	pc += 2;
 	break;
 case LDHL_SP_N:
 	cycles -= 3;
 	{
-		int8_t n = gb_.mem_.read(pc++);
+		int8_t n = gb_.mem_->read(pc++);
 		uint32_t ptr = sp + n;
 		r.r16[HL] = static_cast<uint16_t>(ptr);
 		r.r8[F] =
 	break;
 case LD_MNN_SP:
 	cycles -= 5;
-	gb_.mem_.write16(gb_.mem_.read16(pc), sp);
+	gb_.mem_->write16(gb_.mem_->read16(pc), sp);
 	pc += 2;
 	break;
 case PUSH_AF:
 	cycles -= 4;
 	sp -= 2;
-	gb_.mem_.write16(sp, r.r16[AF]);
+	gb_.mem_->write16(sp, r.r16[AF]);
 	break;
 case PUSH_BC:
 	cycles -= 4;
 	sp -= 2;
-	gb_.mem_.write16(sp, r.r16[BC]);
+	gb_.mem_->write16(sp, r.r16[BC]);
 	break;
 case PUSH_DE:
 	cycles -= 4;
 	sp -= 2;
-	gb_.mem_.write16(sp, r.r16[DE]);
+	gb_.mem_->write16(sp, r.r16[DE]);
 	break;
 case PUSH_HL:
 	cycles -= 4;
 	sp -= 2;
-	gb_.mem_.write16(sp, r.r16[HL]);
+	gb_.mem_->write16(sp, r.r16[HL]);
 	break;
 case POP_AF:
 	cycles -= 3;
-	r.r16[AF] = gb_.mem_.read16(sp);
+	r.r16[AF] = gb_.mem_->read16(sp);
 	sp += 2;
 	break;
 case POP_BC:
 	cycles -= 3;
-	r.r16[BC] = gb_.mem_.read16(sp);
+	r.r16[BC] = gb_.mem_->read16(sp);
 	sp += 2;
 	break;
 case POP_DE:
 	cycles -= 3;
-	r.r16[DE] = gb_.mem_.read16(sp);
+	r.r16[DE] = gb_.mem_->read16(sp);
 	sp += 2;
 	break;
 case POP_HL:
 	cycles -= 3;
-	r.r16[HL] = gb_.mem_.read16(sp);
+	r.r16[HL] = gb_.mem_->read16(sp);
 	sp += 2;
 	break;
 case ADD_A_A:
 case ADD_A_MHL:
 	cycles -= 2;
 	{
-		uint8_t val = gb_.mem_.read(r.r16[HL]);
+		uint8_t val = gb_.mem_->read(r.r16[HL]);
 		uint16_t result = r.r8[A] + val;
 		r.r8[F] =
 			(result & 0x00ff ? 0 : Z) |
 case ADD_A_N:
 	cycles -= 2;
 	{
-		uint8_t val = gb_.mem_.read(pc++);
+		uint8_t val = gb_.mem_->read(pc++);
 		uint16_t result = r.r8[A] + val;
 		r.r8[F] =
 			(result & 0x00ff ? 0 : Z) |
 case ADC_A_MHL:
 	cycles -= 2;
 	{
-		uint16_t val = gb_.mem_.read(r.r16[HL]) + (r.r8[F] & CF ? 1 : 0),
+		uint16_t val = gb_.mem_->read(r.r16[HL]) + (r.r8[F] & CF ? 1 : 0),
 			result = r.r8[A] + val;
 		r.r8[F] =
 			(result & 0x00ff ? 0 : Z) |
 case ADC_A_N:
 	cycles -= 2;
 	{
-		uint16_t val = gb_.mem_.read(pc++) + (r.r8[F] & CF ? 1 : 0),
+		uint16_t val = gb_.mem_->read(pc++) + (r.r8[F] & CF ? 1 : 0),
 			result = r.r8[A] + val;
 		r.r8[F] =
 			(result & 0x00ff ? 0 : Z) |
 case SUB_A_MHL:
 	cycles -= 2;
 	{
-		uint8_t val = gb_.mem_.read(r.r16[HL]);
+		uint8_t val = gb_.mem_->read(r.r16[HL]);
 		uint16_t result = r.r8[A] - val;
 		r.r8[F] =
 			(result ? 0 : Z) |
 case SUB_A_N:
 	cycles -= 2;
 	{
-		uint8_t val = gb_.mem_.read(pc++);
+		uint8_t val = gb_.mem_->read(pc++);
 		uint16_t result = r.r8[A] - val;
 		r.r8[F] =
 			(result ? 0 : Z) |
 case SBC_A_MHL:
 	cycles -= 2;
 	{
-		uint16_t val = gb_.mem_.read(r.r16[HL]) + (r.r8[F] & CF ? 1 : 0),
+		uint16_t val = gb_.mem_->read(r.r16[HL]) + (r.r8[F] & CF ? 1 : 0),
 			result = r.r8[A] - val;
 		r.r8[F] =
 			(result ? 0 : Z) |
 case SBC_A_N:
 	cycles -= 2;
 	{
-		uint16_t val = gb_.mem_.read(pc++) + (r.r8[F] & CF ? 1 : 0),
+		uint16_t val = gb_.mem_->read(pc++) + (r.r8[F] & CF ? 1 : 0),
 			result = r.r8[A] - val;
 		r.r8[F] =
 			(result ? 0 : Z) |
 	break;
 case AND_A_MHL:
 	cycles -= 2;
-	r.r8[A] &= gb_.mem_.read(r.r16[HL]);
+	r.r8[A] &= gb_.mem_->read(r.r16[HL]);
 	r.r8[F]  =
 		(r.r8[A] ? 0 : Z) |
 		HF;
 	break;
 case AND_A_N:
 	cycles -= 2;
-	r.r8[A] &= gb_.mem_.read(pc++);
+	r.r8[A] &= gb_.mem_->read(pc++);
 	r.r8[F]  =
 		(r.r8[A] ? 0 : Z) |
 		HF;
 	break;
 case OR_A_MHL:
 	cycles -= 2;
-	r.r8[A] |= gb_.mem_.read(r.r16[HL]);
+	r.r8[A] |= gb_.mem_->read(r.r16[HL]);
 	r.r8[F]  = r.r8[A] ? 0 : Z;
 	break;
 case OR_A_N:
 	cycles -= 2;
-	r.r8[A] |= gb_.mem_.read(pc++);
+	r.r8[A] |= gb_.mem_->read(pc++);
 	r.r8[F]  = r.r8[A] ? 0 : Z;
 	break;
 case XOR_A_A:
 	break;
 case XOR_A_MHL:
 	cycles -= 2;
-	r.r8[A] ^= gb_.mem_.read(r.r16[HL]);
+	r.r8[A] ^= gb_.mem_->read(r.r16[HL]);
 	r.r8[F]  = r.r8[A] ? 0 : Z;
 	break;
 case XOR_A_N:
 	cycles -= 2;
-	r.r8[A] ^= gb_.mem_.read(pc++);
+	r.r8[A] ^= gb_.mem_->read(pc++);
 	r.r8[F]  = r.r8[A] ? 0 : Z;
 	break;
 case CP_A_A:
 case CP_A_MHL:
 	cycles -= 2;
 	{
-		uint8_t val = gb_.mem_.read(r.r16[HL]);
+		uint8_t val = gb_.mem_->read(r.r16[HL]);
 		uint16_t result = r.r8[A] - val;
 		r.r8[F] =
 			(result ? 0 : Z) |
 case CP_A_N:
 	cycles -= 2;
 	{
-		uint8_t val = gb_.mem_.read(pc++);
+		uint8_t val = gb_.mem_->read(pc++);
 		uint16_t result = r.r8[A] - val;
 		r.r8[F] =
 			(result ? 0 : Z) |
 case INC_MHL:
 	cycles -= 3;
 	{
-		uint8_t val = gb_.mem_.read(r.r16[HL]) + 1;
-		gb_.mem_.write(r.r16[HL], val);
+		uint8_t val = gb_.mem_->read(r.r16[HL]) + 1;
+		gb_.mem_->write(r.r16[HL], val);
 		r.r8[F] =
 			(val ? 0 : Z) |
 			(val & 0x0f ? 0 : HF) |
 case DEC_MHL:
 	cycles -= 3;
 	{
-		uint8_t val = gb_.mem_.read(r.r16[HL]) - 1;
-		gb_.mem_.write(r.r16[HL], val);
+		uint8_t val = gb_.mem_->read(r.r16[HL]) - 1;
+		gb_.mem_->write(r.r16[HL], val);
 		r.r8[F] =
 			(val ? 0 : Z) |
 			(val & 0x0f ? 0 : HF) |
 case ADD_SP_N:
 	cycles -= 4;
 	{
-		int8_t n = gb_.mem_.read(pc++);
+		int8_t n = gb_.mem_->read(pc++);
 		uint32_t result = sp + n;
 		r.r8[F] =
 			((sp ^ n ^ result) & 0x1000 ? HF : 0) |
 case STOP:
 	cycles -= 1;
 	// Change the CPU speed if requested
-	if (gb_.mem_.ioPorts[KEY1] & 0x01)
+	if (gb_.mem_->ioPorts[KEY1] & 0x01)
 	{
-		if (gb_.mem_.ioPorts[KEY1] & 0x80)
+		if (gb_.mem_->ioPorts[KEY1] & 0x80)
 		{
-			gb_.mem_.ioPorts[KEY1] = 0;
+			gb_.mem_->ioPorts[KEY1] = 0;
 		}
 		else
 		{
-			gb_.mem_.ioPorts[KEY1] = 0x80;
+			gb_.mem_->ioPorts[KEY1] = 0x80;
 		}
 		// Return now so the cycle counts can be adjusted to the new speed
 		speedSwitch = true;
 	break;
 case JP_NN:
 	cycles -= 4;
-	pc = gb_.mem_.read16(pc);
+	pc = gb_.mem_->read16(pc);
 	break;
 case JP_MHL:
 	cycles -= 1;
 	if (!(r.r8[F] & Z))
 	{
 		--cycles;
-		pc = gb_.mem_.read16(pc);
+		pc = gb_.mem_->read16(pc);
 	}
 	else
 		pc += 2;
 	if (r.r8[F] & Z)
 	{
 		--cycles;
-		pc = gb_.mem_.read16(pc);
+		pc = gb_.mem_->read16(pc);
 	}
 	else
 		pc += 2;
 	if (!(r.r8[F] & CF))
 	{
 		--cycles;
-		pc = gb_.mem_.read16(pc);
+		pc = gb_.mem_->read16(pc);
 	}
 	else
 		pc += 2;
 	if (r.r8[F] & CF)
 	{
 		--cycles;
-		pc = gb_.mem_.read16(pc);
+		pc = gb_.mem_->read16(pc);
 	}
 	else
 		pc += 2;
 	break;
 case JR_N:
 	cycles -= 3;
-	pc += ((int8_t) gb_.mem_.read(pc)) + 1;
+	pc += ((int8_t) gb_.mem_->read(pc)) + 1;
 	break;
 case JR_NZ_N:
 	cycles -= 2;
 	if (!(r.r8[F] & Z))
 	{
 		--cycles;
-		pc += ((int8_t) gb_.mem_.read(pc)) + 1;
+		pc += ((int8_t) gb_.mem_->read(pc)) + 1;
 	}
 	else
 		++pc;
 	if (r.r8[F] & Z)
 	{
 		--cycles;
-		pc += ((int8_t) gb_.mem_.read(pc)) + 1;
+		pc += ((int8_t) gb_.mem_->read(pc)) + 1;
 	}
 	else
 		++pc;
 	if (!(r.r8[F] & CF))
 	{
 		--cycles;
-		pc += ((int8_t) gb_.mem_.read(pc)) + 1;
+		pc += ((int8_t) gb_.mem_->read(pc)) + 1;
 	}
 	else
 		++pc;
 	if (r.r8[F] & CF)
 	{
 		--cycles;
-		pc += ((int8_t) gb_.mem_.read(pc)) + 1;
+		pc += ((int8_t) gb_.mem_->read(pc)) + 1;
 	}
 	else
 		++pc;
 	cycles -= 6;
 	{
 		sp -= 2;
-		gb_.mem_.write16(sp, pc + 2);
-		pc = gb_.mem_.read16(pc);
+		gb_.mem_->write16(sp, pc + 2);
+		pc = gb_.mem_->read16(pc);
 	}
 	break;
 case CALL_NZ_NN:
 	{
 		cycles -= 3;
 		sp -= 2;
-		gb_.mem_.write16(sp, pc + 2);
-		pc = gb_.mem_.read16(pc);
+		gb_.mem_->write16(sp, pc + 2);
+		pc = gb_.mem_->read16(pc);
 	}
 	else
 		pc += 2;
 	{
 		cycles -= 3;
 		sp -= 2;
-		gb_.mem_.write16(sp, pc + 2);
-		pc = gb_.mem_.read16(pc);
+		gb_.mem_->write16(sp, pc + 2);
+		pc = gb_.mem_->read16(pc);
 	}
 	else
 		pc += 2;
 	{
 		cycles -= 3;
 		sp -= 2;
-		gb_.mem_.write16(sp, pc + 2);
-		pc = gb_.mem_.read16(pc);
+		gb_.mem_->write16(sp, pc + 2);
+		pc = gb_.mem_->read16(pc);
 	}
 	else
 		pc += 2;
 	{
 		cycles -= 3;
 		sp -= 2;
-		gb_.mem_.write16(sp, pc + 2);
-		pc = gb_.mem_.read16(pc);
+		gb_.mem_->write16(sp, pc + 2);
+		pc = gb_.mem_->read16(pc);
 	}
 	else
 		pc += 2;
 case RST_00:
 	cycles -= 4;
 	sp -= 2;
-	gb_.mem_.write16(sp, pc);
+	gb_.mem_->write16(sp, pc);
 	pc = 0x00;
 	break;
 case RST_08:
 	cycles -= 4;
 	sp -= 2;
-	gb_.mem_.write16(sp, pc);
+	gb_.mem_->write16(sp, pc);
 	pc = 0x08;
 	break;
 case RST_10:
 	cycles -= 4;
 	sp -= 2;
-	gb_.mem_.write16(sp, pc);
+	gb_.mem_->write16(sp, pc);
 	pc = 0x10;
 	break;
 case RST_18:
 	cycles -= 4;
 	sp -= 2;
-	gb_.mem_.write16(sp, pc);
+	gb_.mem_->write16(sp, pc);
 	pc = 0x18;
 	break;
 case RST_20:
 	cycles -= 4;
 	sp -= 2;
-	gb_.mem_.write16(sp, pc);
+	gb_.mem_->write16(sp, pc);
 	pc = 0x20;
 	break;
 case RST_28:
 	cycles -= 4;
 	sp -= 2;
-	gb_.mem_.write16(sp, pc);
+	gb_.mem_->write16(sp, pc);
 	pc = 0x28;
 	break;
 case RST_30:
 	cycles -= 4;
 	sp -= 2;
-	gb_.mem_.write16(sp, pc);
+	gb_.mem_->write16(sp, pc);
 	pc = 0x30;
 	break;
 case RST_38:
 	cycles -= 4;
 	sp -= 2;
-	gb_.mem_.write16(sp, pc);
+	gb_.mem_->write16(sp, pc);
 	pc = 0x38;
 	break;
 case RET:
 	cycles -= 4;
-	pc = gb_.mem_.read16(sp);
+	pc = gb_.mem_->read16(sp);
 	sp += 2;
 	break;
 case RET_NZ:
 	if (!(r.r8[F] & Z))
 	{
 		cycles -= 3;
-		pc = gb_.mem_.read16(sp);
+		pc = gb_.mem_->read16(sp);
 		sp += 2;
 	}
 	break;
 	if (r.r8[F] & Z)
 	{
 		cycles -= 3;
-		pc = gb_.mem_.read16(sp);
+		pc = gb_.mem_->read16(sp);
 		sp += 2;
 	}
 	break;
 	if (!(r.r8[F] & CF))
 	{
 		cycles -= 3;
-		pc = gb_.mem_.read16(sp);
+		pc = gb_.mem_->read16(sp);
 		sp += 2;
 	}
 	break;
 	if (r.r8[F] & CF)
 	{
 		cycles -= 3;
-		pc = gb_.mem_.read16(sp);
+		pc = gb_.mem_->read16(sp);
 		sp += 2;
 	}
 	break;
 case RETI:
 	cycles -= 4;
-	pc = gb_.mem_.read16(sp);
+	pc = gb_.mem_->read16(sp);
 	sp += 2;
 	ime = IME_ENABLING2;
 	break;
 case MULTI_BYTE:
-	switch (gb_.mem_.read(pc++))
+	switch (gb_.mem_->read(pc++))
 	{
 	case SWAP_A:
 		cycles -= 2;
 	case SWAP_MHL:
 		cycles -= 4;
 		{
-			uint8_t val = gb_.mem_.read(r.r16[HL]);
-			gb_.mem_.write(r.r16[HL], (val << 4) | (val >> 4));
+			uint8_t val = gb_.mem_->read(r.r16[HL]);
+			gb_.mem_->write(r.r16[HL], (val << 4) | (val >> 4));
 			r.r8[F] = val ? 0 : Z;
 		}
 		break;
 	case RLC_MHL:
 		cycles -= 4;
 		{
-			uint8_t val = gb_.mem_.read(r.r16[HL]);
+			uint8_t val = gb_.mem_->read(r.r16[HL]);
 			bool carry = (val & 0x80) != 0;
 			val <<= 1;
 			if (carry)
 			r.r8[F] =
 				(val ? 0 : Z) |
 				(carry ? CF : 0);
-			gb_.mem_.write(r.r16[HL], val);
+			gb_.mem_->write(r.r16[HL], val);
 		}
 		break;
 	case RL_A:
 	case RL_MHL:
 		cycles -= 4;
 		{
-			uint8_t val = gb_.mem_.read(r.r16[HL]);
+			uint8_t val = gb_.mem_->read(r.r16[HL]);
 			bool carry = (val & 0x80) != 0;
 			val = (val << 1) | (r.r8[F] & CF ? 1 : 0);
 			r.r8[F] =
 				(val ? 0 : Z) |
 				(carry ? CF : 0);
-			gb_.mem_.write(r.r16[HL], val);
+			gb_.mem_->write(r.r16[HL], val);
 		}
 		break;
 	case RRC_A:
 	case RRC_MHL:
 		cycles -= 4;
 		{
-			uint8_t val = gb_.mem_.read(r.r16[HL]);
+			uint8_t val = gb_.mem_->read(r.r16[HL]);
 			bool carry = val & 0x01;
 			val >>= 1;
 			if (carry)
 			r.r8[F] =
 				(val ? 0 : Z) |
 				(carry ? CF : 0);
-			gb_.mem_.write(r.r16[HL], val);
+			gb_.mem_->write(r.r16[HL], val);
 		}
 		break;
 	case RR_A:
 	case RR_MHL:
 		cycles -= 4;
 		{
-			uint8_t val = gb_.mem_.read(r.r16[HL]);
+			uint8_t val = gb_.mem_->read(r.r16[HL]);
 			bool carry = val & 0x01;
 			val = (val >> 1) | (r.r8[F] & CF ? 0x80 : 0);
 			r.r8[F] =
 				(val ? 0 : Z) |
 				(carry ? CF : 0);
-			gb_.mem_.write(r.r16[HL], val);
+			gb_.mem_->write(r.r16[HL], val);
 		}
 		break;
 	case SLA_A:
 	case SLA_MHL:
 		cycles -= 4;
 		{
-			uint8_t val = gb_.mem_.read(r.r16[HL]);
+			uint8_t val = gb_.mem_->read(r.r16[HL]);
 			bool carry = (val & 0x80) != 0;
 			val <<= 1;
 			r.r8[F] =
 				(val ? 0 : Z) |
 				(carry ? CF : 0);
-			gb_.mem_.write(r.r16[HL], val);
+			gb_.mem_->write(r.r16[HL], val);
 		}
 		break;
 	case SRA_A:
 	case SRA_MHL:
 		cycles -= 4;
 		{
-			uint8_t val = gb_.mem_.read(r.r16[HL]);
+			uint8_t val = gb_.mem_->read(r.r16[HL]);
 			bool carry = val & 0x01;
 			val = val >> 1 | (val & 0x80);
-			gb_.mem_.write(r.r16[HL], val);
+			gb_.mem_->write(r.r16[HL], val);
 			r.r8[F] =
 				(val ? 0 : Z) |
 				(carry ? CF : 0);
 	case SRL_MHL:
 		cycles -= 4;
 		{
-			uint8_t val = gb_.mem_.read(r.r16[HL]);
+			uint8_t val = gb_.mem_->read(r.r16[HL]);
 			bool carry = val & 0x01;
 			val >>= 1;
-			gb_.mem_.write(r.r16[HL], val);
+			gb_.mem_->write(r.r16[HL], val);
 			r.r8[F] =
 				(val ? 0 : Z) |
 				(carry ? CF : 0);
 	case BIT_0_MHL:
 		cycles -= 3;
 		r.r8[F] =
-			(gb_.mem_.read(r.r16[HL]) & 1 << 0 ? 0 : Z) | \
+			(gb_.mem_->read(r.r16[HL]) & 1 << 0 ? 0 : Z) | \
 			HF | \
 			(r.r8[F] & CF);
 		break;
 	case BIT_1_MHL:
 		cycles -= 3;
 		r.r8[F] =
-			(gb_.mem_.read(r.r16[HL]) & 1 << 1 ? 0 : Z) | \
+			(gb_.mem_->read(r.r16[HL]) & 1 << 1 ? 0 : Z) | \
 			HF | \
 			(r.r8[F] & CF);
 		break;
 	case BIT_2_MHL:
 		cycles -= 3;
 		r.r8[F] =
-			(gb_.mem_.read(r.r16[HL]) & 1 << 2 ? 0 : Z) | \
+			(gb_.mem_->read(r.r16[HL]) & 1 << 2 ? 0 : Z) | \
 			HF | \
 			(r.r8[F] & CF);
 		break;
 	case BIT_3_MHL:
 		cycles -= 3;
 		r.r8[F] =
-			(gb_.mem_.read(r.r16[HL]) & 1 << 3 ? 0 : Z) | \
+			(gb_.mem_->read(r.r16[HL]) & 1 << 3 ? 0 : Z) | \
 			HF | \
 			(r.r8[F] & CF);
 		break;
 	case BIT_4_MHL:
 		cycles -= 3;
 		r.r8[F] =
-			(gb_.mem_.read(r.r16[HL]) & 1 << 4 ? 0 : Z) | \
+			(gb_.mem_->read(r.r16[HL]) & 1 << 4 ? 0 : Z) | \
 			HF | \
 			(r.r8[F] & CF);
 		break;
 	case BIT_5_MHL:
 		cycles -= 3;
 		r.r8[F] =
-			(gb_.mem_.read(r.r16[HL]) & 1 << 5 ? 0 : Z) | \
+			(gb_.mem_->read(r.r16[HL]) & 1 << 5 ? 0 : Z) | \
 			HF | \
 			(r.r8[F] & CF);
 		break;
 	case BIT_6_MHL:
 		cycles -= 3;
 		r.r8[F] =
-			(gb_.mem_.read(r.r16[HL]) & 1 << 6 ? 0 : Z) | \
+			(gb_.mem_->read(r.r16[HL]) & 1 << 6 ? 0 : Z) | \
 			HF | \
 			(r.r8[F] & CF);
 		break;
 	case BIT_7_MHL:
 		cycles -= 3;
 		r.r8[F] =
-			(gb_.mem_.read(r.r16[HL]) & 1 << 7 ? 0 : Z) | \
+			(gb_.mem_->read(r.r16[HL]) & 1 << 7 ? 0 : Z) | \
 			HF | \
 			(r.r8[F] & CF);
 		break;
 		break;
 	case SET_0_MHL:
 		cycles -= 4;
-		gb_.mem_.write(r.r16[HL], gb_.mem_.read(r.r16[HL]) | 1 << 0);
+		gb_.mem_->write(r.r16[HL], gb_.mem_->read(r.r16[HL]) | 1 << 0);
 		break;
 	case SET_1_MHL:
 		cycles -= 4;
-		gb_.mem_.write(r.r16[HL], gb_.mem_.read(r.r16[HL]) | 1 << 1);
+		gb_.mem_->write(r.r16[HL], gb_.mem_->read(r.r16[HL]) | 1 << 1);
 		break;
 	case SET_2_MHL:
 		cycles -= 4;
-		gb_.mem_.write(r.r16[HL], gb_.mem_.read(r.r16[HL]) | 1 << 2);
+		gb_.mem_->write(r.r16[HL], gb_.mem_->read(r.r16[HL]) | 1 << 2);
 		break;
 	case SET_3_MHL:
 		cycles -= 4;
-		gb_.mem_.write(r.r16[HL], gb_.mem_.read(r.r16[HL]) | 1 << 3);
+		gb_.mem_->write(r.r16[HL], gb_.mem_->read(r.r16[HL]) | 1 << 3);
 		break;
 	case SET_4_MHL:
 		cycles -= 4;
-		gb_.mem_.write(r.r16[HL], gb_.mem_.read(r.r16[HL]) | 1 << 4);
+		gb_.mem_->write(r.r16[HL], gb_.mem_->read(r.r16[HL]) | 1 << 4);
 		break;
 	case SET_5_MHL:
 		cycles -= 4;
-		gb_.mem_.write(r.r16[HL], gb_.mem_.read(r.r16[HL]) | 1 << 5);
+		gb_.mem_->write(r.r16[HL], gb_.mem_->read(r.r16[HL]) | 1 << 5);
 		break;
 	case SET_6_MHL:
 		cycles -= 4;
-		gb_.mem_.write(r.r16[HL], gb_.mem_.read(r.r16[HL]) | 1 << 6);
+		gb_.mem_->write(r.r16[HL], gb_.mem_->read(r.r16[HL]) | 1 << 6);
 		break;
 	case SET_7_MHL:
 		cycles -= 4;
-		gb_.mem_.write(r.r16[HL], gb_.mem_.read(r.r16[HL]) | 1 << 7);
+		gb_.mem_->write(r.r16[HL], gb_.mem_->read(r.r16[HL]) | 1 << 7);
 		break;
 	case RES_0_A:
 		cycles -= 2;
 		break;
 	case RES_0_MHL:
 		cycles -= 4;
-		gb_.mem_.write(r.r16[HL], gb_.mem_.read(r.r16[HL]) & ~(1 << 0));
+		gb_.mem_->write(r.r16[HL], gb_.mem_->read(r.r16[HL]) & ~(1 << 0));
 		break;
 	case RES_1_MHL:
 		cycles -= 4;
-		gb_.mem_.write(r.r16[HL], gb_.mem_.read(r.r16[HL]) & ~(1 << 1));
+		gb_.mem_->write(r.r16[HL], gb_.mem_->read(r.r16[HL]) & ~(1 << 1));
 		break;
 	case RES_2_MHL:
 		cycles -= 4;
-		gb_.mem_.write(r.r16[HL], gb_.mem_.read(r.r16[HL]) & ~(1 << 2));
+		gb_.mem_->write(r.r16[HL], gb_.mem_->read(r.r16[HL]) & ~(1 << 2));
 		break;
 	case RES_3_MHL:
 		cycles -= 4;
-		gb_.mem_.write(r.r16[HL], gb_.mem_.read(r.r16[HL]) & ~(1 << 3));
+		gb_.mem_->write(r.r16[HL], gb_.mem_->read(r.r16[HL]) & ~(1 << 3));
 		break;
 	case RES_4_MHL:
 		cycles -= 4;
-		gb_.mem_.write(r.r16[HL], gb_.mem_.read(r.r16[HL]) & ~(1 << 4));
+		gb_.mem_->write(r.r16[HL], gb_.mem_->read(r.r16[HL]) & ~(1 << 4));
 		break;
 	case RES_5_MHL:
 		cycles -= 4;
-		gb_.mem_.write(r.r16[HL], gb_.mem_.read(r.r16[HL]) & ~(1 << 5));
+		gb_.mem_->write(r.r16[HL], gb_.mem_->read(r.r16[HL]) & ~(1 << 5));
 		break;
 	case RES_6_MHL:
 		cycles -= 4;
-		gb_.mem_.write(r.r16[HL], gb_.mem_.read(r.r16[HL]) & ~(1 << 6));
+		gb_.mem_->write(r.r16[HL], gb_.mem_->read(r.r16[HL]) & ~(1 << 6));
 		break;
 	case RES_7_MHL:
 		cycles -= 4;
-		gb_.mem_.write(r.r16[HL], gb_.mem_.read(r.r16[HL]) & ~(1 << 7));
+		gb_.mem_->write(r.r16[HL], gb_.mem_->read(r.r16[HL]) & ~(1 << 7));
 		break;
 	default:
 		clog << hex << setfill('0')
-		     << "unknown opcode: cb"  << setw(2) << static_cast<unsigned>(gb_.mem_.read(pc - 1))
+		     << "unknown opcode: cb"  << setw(2) << static_cast<unsigned>(gb_.mem_->read(pc - 1))
 		     << " at " << setw(4) << pc - 2 << "\n";
 		exit(1);
 	}
 	break;
 default:
 	clog << hex << setfill('0')
-	     << "unknown opcode: " << setw(2) << static_cast<unsigned>(gb_.mem_.read(pc - 1))
+	     << "unknown opcode: " << setw(2) << static_cast<unsigned>(gb_.mem_->read(pc - 1))
 	     << " at " << setw(4) << pc - 1 << "\n";
 	exit(1);
 }

gb_emulator/gb_emulator.vcxproj

     <ClInclude Include="include\gb_emulator\constants.hpp" />
     <ClInclude Include="include\gb_emulator\defs.hpp" />
     <ClInclude Include="include\gb_emulator\gb.hpp" />
+    <ClInclude Include="include\gb_emulator\gb_config.h" />
     <ClInclude Include="include\gb_emulator\gb_cpu.hpp" />
     <ClInclude Include="include\gb_emulator\gb_debugger.h" />
     <ClInclude Include="include\gb_emulator\gb_debugger_module.h" />

gb_emulator/gb_emulator.vcxproj.filters

     <ClInclude Include="include\gb_emulator\gb_video_d3d11.h">
       <Filter>Header Files</Filter>
     </ClInclude>
+    <ClInclude Include="include\gb_emulator\gb_config.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="gb.pb.cc">

gb_emulator/gen_ops.py

 
 print '/* This file was automatically generated from the opcodes definition file */'
 print
-print 'switch (gb_.mem_.read(pc++))'
+print 'switch (gb_.mem_->read(pc++))'
 print '{'
 
 for op in ops:
 			print '\texit(1);'
 
 print 'case MULTI_BYTE:'
-print '\tswitch (gb_.mem_.read(pc++))'
+print '\tswitch (gb_.mem_->read(pc++))'
 print '\t{'
 for op in mbops:
 	print '\tcase %s:' % op['mName']
 		print '\t\texit(1);'
 print '\tdefault:'
 print '\t\tclog << hex << setfill(\'0\')'
-print '\t\t     << "unknown opcode: cb"  << setw(2) << static_cast<unsigned>(gb_.mem_.read(pc - 1))'
+print '\t\t     << "unknown opcode: cb"  << setw(2) << static_cast<unsigned>(gb_.mem_->read(pc - 1))'
 print '\t\t     << " at " << setw(4) << pc - 2 << "\\n";'
 print '\t\texit(1);'
 print '\t}'
 
 print 'default:'
 print '\tclog << hex << setfill(\'0\')'
-print '\t     << "unknown opcode: " << setw(2) << static_cast<unsigned>(gb_.mem_.read(pc - 1))'
+print '\t     << "unknown opcode: " << setw(2) << static_cast<unsigned>(gb_.mem_->read(pc - 1))'
 print '\t     << " at " << setw(4) << pc - 1 << "\\n";'
 print '\texit(1);'
 print '}'

gb_emulator/include/gb_emulator/gb.hpp

 #include <vector>
 
 #include <boost/filesystem/path.hpp>
+#include <boost/scoped_ptr.hpp>
 #include <boost/shared_ptr.hpp>
 
 #include <gb_emulator/defs.hpp>
 #include <gb_emulator/gb_cpu.hpp>
 #include <gb_emulator/gb_debugger.h>
 #include <gb_emulator/gb_debugger_module.h>
-#include <gb_emulator/gb_input.hpp>
-#include <gb_emulator/gb_memory.hpp>
 #include <gb_emulator/gb_timers.hpp>
-#ifdef _WIN32
-#include <gb_emulator/gb_sound_wasapi.h>
-#include <gb_emulator/gb_video_d3d11.h>
-#else
-#include <gb_emulator/gb_sound_sdl.h>
-#include <gb_emulator/gb_video_sdl.h>
-#endif
 
+class GbConfig;
 class GbDebugger;
+class GbInput;
+class GbMemory;
 class GbSoundSdl;
 class GbSoundWasapi;
 class GbVideoD3D11;
+class GbVideoSdl;
 
 //! Main class for the GameBoy emulator.
 /**
 	friend class GbDebugger;
 
 public:
-	//! Default constructor; loads the BIOS.
-	Gb();
+	//! Constructor; sets the configuration options and loads the BIOS.
+	Gb(const GbConfig &config);
 
 	//! Destructor.
 	~Gb();
 
-	//! Sets the ROM to use.
-	/**
-	 * This does nothing if run() has already been called.
-	 */
-	void loadRom(const boost::filesystem::path &rom);
-
 	//! Runs the emulator.
 	/**
 	 * This doesn't return until the emulator exited or there is an error.
 
 	GbCpu cpu_;
 	GbTimers timers_;
-	GbInput input_;
-#ifdef _WIN32
-	GbSoundWasapi sound_;
-	GbVideoD3D11 video_;
-#else
-	GbSoundSdl sound_;
-	GbVideoSdl video_;
-#endif
-	GbMemory mem_;
+	boost::scoped_ptr<GbInput> input_;
+	boost::scoped_ptr<GbSound> sound_;
+	boost::scoped_ptr<GbVideo> video_;
+	boost::scoped_ptr<GbMemory> mem_;
 	GbDebugger debugger_;
 	bool gbc_;
 
 	// Common initialisation code
 	void init(const boost::filesystem::path &bios);
 
+	// Loads the given ROM file
+	void loadRom(const boost::filesystem::path &romPath);
+
 	// Loads the battery-backed RAM from the saved file, if available
 	void loadRam();
 

gb_emulator/include/gb_emulator/gb_config.h

+/*  Copyright � 2011 Chris Spencer <spencercw@gmail.com>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef GB_CONFIG_H_E891C8C0_1E0A_11E1_A5CC_0002A5D5C51B
+#define GB_CONFIG_H_E891C8C0_1E0A_11E1_A5CC_0002A5D5C51B
+
+#include <boost/filesystem/path.hpp>
+
+class GbConfig
+{
+public:
+	//! Drivers that may be used to display the video emulation.
+	enum VideoDriver
+	{
+		VIDEO_DEFAULT,  //!< Use an appropriate default.
+		VIDEO_D3D11,    //!< Direct3D 11.
+		VIDEO_SDL       //!< SDL.
+	};
+
+	//! Drivers that may be used to output the sound emulation.
+	enum AudioDriver
+	{
+		AUDIO_DEFAULT,  //!< Use an appropriate default.
+		AUDIO_WASAPI,   //!< WASAPI.
+		AUDIO_SDL       //!< SDL.
+	};
+
+	//! Rendering method to use for the video emulation.
+	enum Renderer
+	{
+		RENDER_DEFAULT,   //!< Use an appropriate default.
+		RENDER_SOFTWARE,  //!< Performs emulation in software.
+		//! Offloads some of the emulation onto the graphics hardware.
+		/**
+		 * This is experimental and is currently only supported by the Direct3D 11 video driver.
+		 */
+		RENDER_HARDWARE
+	};
+
+	//! The video driver to use.
+	VideoDriver videoDriver;
+
+	//! The audio driver to use.
+	AudioDriver audioDriver;
+
+	//! The rendering method to use.
+	Renderer renderer;
+
+	//! The ROM file to execute.
+	/**
+	 * This may be empty.
+	 */
+	boost::filesystem::path rom;
+
+	//! Default constructor; sets appropriate default values.
+	GbConfig():
+	videoDriver(VIDEO_DEFAULT),
+	audioDriver(AUDIO_DEFAULT),
+	renderer(RENDER_DEFAULT)
+	{
+	}
+};
+
+#endif

gb_emulator/include/gb_emulator/gb_cpu.hpp

 	//! CPU pause flag.
 	bool pause;
 
-	#ifdef DEBUG
-	//! CPU debug output flag.
-	bool showOps;
-	#endif
-
 	//! Constructor; sets the associated emulator container.
 	GbCpu(Gb &gb);
 

gb_emulator/include/gb_emulator/gb_sound.hpp

 	void writeIoPort(uint8_t ptr, uint8_t val);
 
 	//! Resets all the sound registers to their initial states.
-	void resetRegisters();
+	void resetRegisters(GbMemory &mem) const;
 
 	//! Starts recording to the given file.
 	/**

gb_emulator/include/gb_emulator/gb_video_d3d11.h

 #include <atlbase.h>
 #include <atlcom.h>
 
+#include <gb_emulator/gb_config.h>
 #include <gb_emulator/gb_video.hpp>
 
 struct _CGcontext;
 class GbVideoD3D11: public GbVideo
 {
 public:
-	//! Constructor; sets the emulation context.
+	//! Constructor; initialises Direct3D and opens the display.
 	/**
 	 * \param gb The emulator context.
+	 * \param renderer The renderer to use. If set to \c GbConfig::RENDER_HARDWARE then colour
+	 * decoding will be offloaded onto the graphics hardware which results in a big decrease in CPU
+	 * usage, but the result of that is that the fancy image scaling effects are disabled, so
+	 * software rendering should be used unless performance is an issue.
+	 * \param installDir The installation directory.
 	 */
-	GbVideoD3D11(Gb &gb);
+	GbVideoD3D11(Gb &gb, GbConfig::Renderer renderer, const boost::filesystem::path &installDir);
 
 	//! Destructor.
 	~GbVideoD3D11();
 
-	//! Initialises Direct3D and opens the display.
-	/**
-	 * \param installDir The installation directory.
-	 */
-	void initialise(const boost::filesystem::path &installDir);
-
 private:
 	// Direct3D stuff
 	ATL::CComPtr<ID3D11Device> device_;

gb_emulator/include/gb_emulator/gb_video_sdl.h

 #ifndef GB_VIDEO_SDL_H_75A9CC80_1B63_11E1_B757_0002A5D5C51B
 #define GB_VIDEO_SDL_H_75A9CC80_1B63_11E1_B757_0002A5D5C51B
 
+#include <gb_emulator/gb_config.h>
 #include <gb_emulator/gb_video.hpp>
 
 struct SDL_Surface;
 {
 public:
 	//! Constructor; opens the display.
-	GbVideoSdl(Gb &gb);
+	/**
+	 * \param gb The emulator context.
+	 * \param renderer The renderer to use. Only software rendering is supported by the SDL driver.
+	 */
+	GbVideoSdl(Gb &gb, GbConfig::Renderer renderer);
 
 private:
 	SDL_Surface *surface_;

gb_emulator/ops.txt

 
 ; ld r,n
 >
-r.r8[%s] = gb_.mem_.read(pc++);
+r.r8[%s] = gb_.mem_->read(pc++);
 3e   LD_A_N     'ld a,$%02x'         1 2 1 A
 06   LD_B_N     'ld b,$%02x'         1 2 1 B
 0e   LD_C_N     'ld c,$%02x'         1 2 1 C
 
 ; ld r,m
 >
-r.r8[A] = gb_.mem_.read(r.r16[%s]);
+r.r8[A] = gb_.mem_->read(r.r16[%s]);
 0a   LD_A_MBC   'ld a,[bc]'          0 2 1 BC
 7e   LD_A_MHL   'ld a,[hl]'          0 2 1 HL
 1a   LD_A_MDE   'ld a,[de]'          0 2 1 DE
 fa   LD_A_MNN   'ld a,[$%04x]'       2 4 1
-r.r8[A] = gb_.mem_.read(gb_.mem_.read16(pc));
+r.r8[A] = gb_.mem_->read(gb_.mem_->read16(pc));
 pc += 2;
 
 >
-r.r8[A] = gb_.mem_.read(0xff00 | %s);
+r.r8[A] = gb_.mem_->read(0xff00 | %s);
 f2   LD_A_MFFC  'ld a,[$ff00+c]'     0 2 1 r.r8[C]
-f0   LD_A_MFFN  'ld a,[$ff%02x]'     1 3 1 gb_.mem_.read(pc++)
+f0   LD_A_MFFN  'ld a,[$ff%02x]'     1 3 1 gb_.mem_->read(pc++)
 
 >
-r.r8[A] = gb_.mem_.read(r.r16[HL]%s);
+r.r8[A] = gb_.mem_->read(r.r16[HL]%s);
 3a   LDD_A_MHL  'ldd a,[hl]'         0 2 1 --
 2a   LDI_A_MHL  'ldi a,[hl]'         0 2 1 ++
 
 >
-r.r8[%s] = gb_.mem_.read(r.r16[HL]);
+r.r8[%s] = gb_.mem_->read(r.r16[HL]);
 46   LD_B_MHL   'ld b,[hl]'          0 2 1 B
 4e   LD_C_MHL   'ld c,[hl]'          0 2 1 C
 56   LD_D_MHL   'ld d,[hl]'          0 2 1 D
 
 ; ld m,r
 >
-gb_.mem_.write(r.r16[%s], r.r8[A]);
+gb_.mem_->write(r.r16[%s], r.r8[A]);
 02   LD_MBC_A   'ld [bc],a'          0 2 1 BC
 12   LD_MDE_A   'ld [de],a'          0 2 1 DE
 77   LD_MHL_A   'ld [hl],a'          0 2 1 HL
 ea   LD_MNN_A   'ld [$%04x],a'       2 4 1
-gb_.mem_.write(gb_.mem_.read16(pc), r.r8[A]);
+gb_.mem_->write(gb_.mem_->read16(pc), r.r8[A]);
 pc += 2;
 e2   LD_MFFC_A  'ld [$ff00+c],a'     0 2 1
-gb_.mem_.write(0xff00 | r.r8[C], r.r8[A]);
+gb_.mem_->write(0xff00 | r.r8[C], r.r8[A]);
 e0   LD_MFFN_A  'ld [$ff%02x],a'     1 3 1
-gb_.mem_.write(0xff00 | gb_.mem_.read(pc++), r.r8[A]);
+gb_.mem_->write(0xff00 | gb_.mem_->read(pc++), r.r8[A]);
 
 >
-gb_.mem_.write(r.r16[HL]%s, r.r8[A]);
+gb_.mem_->write(r.r16[HL]%s, r.r8[A]);
 32   LDD_MHL_A  'ldd [hl],a'         0 2 1 --
 22   LDI_MHL_A  'ldi [hl],a'         0 2 1 ++
 
 >
-gb_.mem_.write(r.r16[HL], r.r8[%s]);
+gb_.mem_->write(r.r16[HL], r.r8[%s]);
 70   LD_MHL_B   'ld [hl],b'          0 2 1 B
 71   LD_MHL_C   'ld [hl],c'          0 2 1 C
 72   LD_MHL_D   'ld [hl],d'          0 2 1 D
 
 ; ld m,n
 36   LD_MHL_N   'ld [hl],$%02x'      1 3 1
-gb_.mem_.write(r.r16[HL], gb_.mem_.read(pc++));
+gb_.mem_->write(r.r16[HL], gb_.mem_->read(pc++));
 
 ; ld r1,r2
 >
 
 ; ld r,nn
 >
-r.r16[%s] = gb_.mem_.read16(pc);
+r.r16[%s] = gb_.mem_->read16(pc);
 pc += 2;
 01   LD_BC_NN   'ld bc,$%04x'        2 3 1 BC
 11   LD_DE_NN   'ld de,$%04x'        2 3 1 DE
 21   LD_HL_NN   'ld hl,$%04x'        2 3 1 HL
 31   LD_SP_NN   'ld sp,$%04x'        2 3 1
-sp = gb_.mem_.read16(pc);
+sp = gb_.mem_->read16(pc);
 pc += 2;
 
 ; ldhl r,n
 f8   LDHL_SP_N  'ldhl sp,$%02x'      1 3 1
 {
-	int8_t n = gb_.mem_.read(pc++);
+	int8_t n = gb_.mem_->read(pc++);
 	uint32_t ptr = sp + n;
 	r.r16[HL] = static_cast<uint16_t>(ptr);
 	r.r8[F] =
 
 ; ld m,r
 08   LD_MNN_SP  'ld [$%04x],sp'      2 5 1
-gb_.mem_.write16(gb_.mem_.read16(pc), sp);
+gb_.mem_->write16(gb_.mem_->read16(pc), sp);
 pc += 2;
 
 ; push
 >
 sp -= 2;
-gb_.mem_.write16(sp, r.r16[%s]);
+gb_.mem_->write16(sp, r.r16[%s]);
 f5   PUSH_AF    'push af'            0 4 1 AF
 c5   PUSH_BC    'push bc'            0 4 1 BC
 d5   PUSH_DE    'push de'            0 4 1 DE
 
 ; pop
 >
-r.r16[%s] = gb_.mem_.read16(sp);
+r.r16[%s] = gb_.mem_->read16(sp);
 sp += 2;
 f1   POP_AF     'pop af'             0 3 1 AF
 c1   POP_BC     'pop bc'             0 3 1 BC
 
 >
 {
-	uint8_t val = gb_.mem_.read(%s);
+	uint8_t val = gb_.mem_->read(%s);
 	uint16_t result = r.r8[A] + val;
 	r.r8[F] =
 		(result & 0x00ff ? 0 : Z) |
 8b   ADC_A_E    'adc a,e'            0 1 1 r.r8[E]
 8c   ADC_A_H    'adc a,h'            0 1 1 r.r8[H]
 8d   ADC_A_L    'adc a,l'            0 1 1 r.r8[L]
-8e   ADC_A_MHL  'adc a,[hl]'         0 2 1 gb_.mem_.read(r.r16[HL])
-ce   ADC_A_N    'adc a,$%02x'        1 2 1 gb_.mem_.read(pc++)
+8e   ADC_A_MHL  'adc a,[hl]'         0 2 1 gb_.mem_->read(r.r16[HL])
+ce   ADC_A_N    'adc a,$%02x'        1 2 1 gb_.mem_->read(pc++)
 
 ; sub a,rmn
 >
 
 >
 {
-	uint8_t val = gb_.mem_.read(%s);
+	uint8_t val = gb_.mem_->read(%s);
 	uint16_t result = r.r8[A] - val;
 	r.r8[F] =
 		(result ? 0 : Z) |
 9b   SBC_A_E    'sbc a,e'            0 1 1 r.r8[E]
 9c   SBC_A_H    'sbc a,h'            0 1 1 r.r8[H]
 9d   SBC_A_L    'sbc a,l'            0 1 1 r.r8[L]
-9e   SBC_A_MHL  'sbc a,[hl]'         0 2 1 gb_.mem_.read(r.r16[HL])
-de   SBC_A_N    'sbc a,$%02x'        1 2 1 gb_.mem_.read(pc++)
+9e   SBC_A_MHL  'sbc a,[hl]'         0 2 1 gb_.mem_->read(r.r16[HL])
+de   SBC_A_N    'sbc a,$%02x'        1 2 1 gb_.mem_->read(pc++)
 
 ; and a,rmn
 a7   AND_A_A    'and a,a'            0 1 1
 a3   AND_A_E    'and a,e'            0 1 1 r.r8[E]
 a4   AND_A_H    'and a,h'            0 1 1 r.r8[H]
 a5   AND_A_L    'and a,l'            0 1 1 r.r8[L]
-a6   AND_A_MHL  'and a,[hl]'         0 2 1 gb_.mem_.read(r.r16[HL])
-e6   AND_A_N    'and a,$%02x'        1 2 1 gb_.mem_.read(pc++)
+a6   AND_A_MHL  'and a,[hl]'         0 2 1 gb_.mem_->read(r.r16[HL])
+e6   AND_A_N    'and a,$%02x'        1 2 1 gb_.mem_->read(pc++)
 
 ; or a,rmn
 b7   OR_A_A     'or a,a'             0 1 1
 b3   OR_A_E     'or a,e'             0 1 1 r.r8[E]
 b4   OR_A_H     'or a,h'             0 1 1 r.r8[H]
 b5   OR_A_L     'or a,l'             0 1 1 r.r8[L]
-b6   OR_A_MHL   'or a,[hl]'          0 2 1 gb_.mem_.read(r.r16[HL])
-f6   OR_A_N     'or a,$%02x'         1 2 1 gb_.mem_.read(pc++)
+b6   OR_A_MHL   'or a,[hl]'          0 2 1 gb_.mem_->read(r.r16[HL])
+f6   OR_A_N     'or a,$%02x'         1 2 1 gb_.mem_->read(pc++)
 
 ; xor a,rmn
 af   XOR_A_A    'xor a,a'            0 1 1
 ab   XOR_A_E    'xor a,e'            0 1 1 r.r8[E]
 ac   XOR_A_H    'xor a,h'            0 1 1 r.r8[H]
 ad   XOR_A_L    'xor a,l'            0 1 1 r.r8[L]
-ae   XOR_A_MHL  'xor a,[hl]'         0 2 1 gb_.mem_.read(r.r16[HL])
-ee   XOR_A_N    'xor a,$%02x'        1 2 1 gb_.mem_.read(pc++)
+ae   XOR_A_MHL  'xor a,[hl]'         0 2 1 gb_.mem_->read(r.r16[HL])
+ee   XOR_A_N    'xor a,$%02x'        1 2 1 gb_.mem_->read(pc++)
 
 ; cp a,rmn
 >
 
 >
 {
-	uint8_t val = gb_.mem_.read(%s);
+	uint8_t val = gb_.mem_->read(%s);
 	uint16_t result = r.r8[A] - val;
 	r.r8[F] =
 		(result ? 0 : Z) |
 2c   INC_L      'inc l'              0 1 1 L:L:L
 34   INC_MHL    'inc [hl]'           0 3 1
 {
-	uint8_t val = gb_.mem_.read(r.r16[HL]) + 1;
-	gb_.mem_.write(r.r16[HL], val);
+	uint8_t val = gb_.mem_->read(r.r16[HL]) + 1;
+	gb_.mem_->write(r.r16[HL], val);
 	r.r8[F] =
 		(val ? 0 : Z) |
 		(val & 0x0f ? 0 : HF) |
 2d   DEC_L      'dec l'              0 1 1 L:L:L
 35   DEC_MHL    'dec [hl]'           0 3 1
 {
-	uint8_t val = gb_.mem_.read(r.r16[HL]) - 1;
-	gb_.mem_.write(r.r16[HL], val);
+	uint8_t val = gb_.mem_->read(r.r16[HL]) - 1;
+	gb_.mem_->write(r.r16[HL], val);
 	r.r8[F] =
 		(val ? 0 : Z) |
 		(val & 0x0f ? 0 : HF) |
 39   ADD_HL_SP  'add hl,sp'          0 2 1 sp:sp
 e8   ADD_SP_N   'add sp,$%02x'       1 4 1
 {
-	int8_t n = gb_.mem_.read(pc++);
+	int8_t n = gb_.mem_->read(pc++);
 	uint32_t result = sp + n;
 	r.r8[F] =
 		((sp ^ n ^ result) & 0x1000 ? HF : 0) |
 cb35 SWAP_L     'swap l'             0 2 1 L:L:L:L
 cb36 SWAP_MHL   'swap [hl]'          0 4 1
 {
-	uint8_t val = gb_.mem_.read(r.r16[HL]);
-	gb_.mem_.write(r.r16[HL], (val << 4) | (val >> 4));
+	uint8_t val = gb_.mem_->read(r.r16[HL]);
+	gb_.mem_->write(r.r16[HL], (val << 4) | (val >> 4));
 	r.r8[F] = val ? 0 : Z;
 }
 
 }
 10   STOP       'stop'               0 1 1
 // Change the CPU speed if requested
-if (gb_.mem_.ioPorts[KEY1] & 0x01)
+if (gb_.mem_->ioPorts[KEY1] & 0x01)
 {
-	if (gb_.mem_.ioPorts[KEY1] & 0x80)
+	if (gb_.mem_->ioPorts[KEY1] & 0x80)
 	{
-		gb_.mem_.ioPorts[KEY1] = 0;
+		gb_.mem_->ioPorts[KEY1] = 0;
 	}
 	else
 	{
-		gb_.mem_.ioPorts[KEY1] = 0x80;
+		gb_.mem_->ioPorts[KEY1] = 0x80;
 	}
 	// Return now so the cycle counts can be adjusted to the new speed
 	speedSwitch = true;
 cb05 RLC_L      'rlc l'              0 2 1 L:L:L:L
 cb06 RLC_MHL    'rlc [hl]'           0 4 1
 {
-	uint8_t val = gb_.mem_.read(r.r16[HL]);
+	uint8_t val = gb_.mem_->read(r.r16[HL]);
 	bool carry = (val & 0x80) != 0;
 	val <<= 1;
 	if (carry)
 	r.r8[F] =
 		(val ? 0 : Z) |
 		(carry ? CF : 0);
-	gb_.mem_.write(r.r16[HL], val);
+	gb_.mem_->write(r.r16[HL], val);
 }
 
 ; rl rm
 cb15 RL_L       'rl l'               0 2 1 L:L:L:L
 cb16 RL_MHL     'rl [hl]'            0 4 1
 {
-	uint8_t val = gb_.mem_.read(r.r16[HL]);
+	uint8_t val = gb_.mem_->read(r.r16[HL]);
 	bool carry = (val & 0x80) != 0;
 	val = (val << 1) | (r.r8[F] & CF ? 1 : 0);
 	r.r8[F] =
 		(val ? 0 : Z) |
 		(carry ? CF : 0);
-	gb_.mem_.write(r.r16[HL], val);
+	gb_.mem_->write(r.r16[HL], val);
 }
 
 ; rrc rm
 cb0d RRC_L      'rrc l'              0 2 1 L:L:L:L
 cb0e RRC_MHL    'rrc [hl]'           0 4 1
 {
-	uint8_t val = gb_.mem_.read(r.r16[HL]);
+	uint8_t val = gb_.mem_->read(r.r16[HL]);
 	bool carry = val & 0x01;
 	val >>= 1;
 	if (carry)
 	r.r8[F] =
 		(val ? 0 : Z) |
 		(carry ? CF : 0);
-	gb_.mem_.write(r.r16[HL], val);
+	gb_.mem_->write(r.r16[HL], val);
 }
 
 ; rr rm
 cb1d RR_L       'rr l'               0 2 1 L:L:L:L