@@ -123,6 +123,9 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
case "O2":
return CoreSystem.Odyssey2;

case "MSX":
return CoreSystem.MSX;

case "VB":
case "NGP":
case "DNGP":
@@ -38,6 +38,7 @@ public enum CoreSystem
GB4x,
ChannelF,
Odyssey2,
MAME
MAME,
MSX
}
}
@@ -232,6 +232,10 @@ private SystemInfo(string displayName, CoreSystem system, int maxControllers, Jo
/// Gets the <see cref="SystemInfo"/> instance for MAME
/// </summary>
public static SystemInfo Mame { get; } = new SystemInfo("MAME", CoreSystem.MAME, 4);
/// <summary>
/// Gets the <see cref="SystemInfo"/> instance for MSX
/// </summary>
public static SystemInfo MSX { get; } = new SystemInfo("MSX", CoreSystem.MSX, 2);

#endregion Get SystemInfo

@@ -416,6 +416,13 @@ private static string ResolveToolsPath(string subPath)
new PathEntry { System = "O2", SystemDisplayName = "O2", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry { System = "O2", SystemDisplayName = "O2", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry { System = "O2", SystemDisplayName = "O2", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },

new PathEntry { System = "MSX", SystemDisplayName = "MSX", Type = "Base", Path = Path.Combine(".", "MSX"), Ordinal = 0 },
new PathEntry { System = "MSX", SystemDisplayName = "MSX", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry { System = "MSX", SystemDisplayName = "MSX", Type = "Savestates", Path = Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry { System = "MSX", SystemDisplayName = "MSX", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry { System = "MSX", SystemDisplayName = "MSX", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry { System = "MSX", SystemDisplayName = "MSX", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
};
}
}
@@ -219,6 +219,7 @@ public enum SystemType
VEC,
GB3x,
GB4x,
O2
O2,
MSX
}
}

Some generated files are not rendered by default. Learn more.

@@ -2462,6 +2462,15 @@ private void VectrexSettingsMenuItem_Click(object sender, EventArgs e)

#endregion

#region MSX

private void MSXSettingsMenuItem_Click(object sender, EventArgs e)
{
GenericCoreConfig.DoDialog(this, "MSX Settings");
}

#endregion

#region O2Hawk

private void O2HawkSettingsMenuItem_Click(object sender, EventArgs e)
@@ -1816,6 +1816,7 @@ private void HandlePlatformMenus()
zXSpectrumToolStripMenuItem.Visible = false;
amstradCPCToolStripMenuItem.Visible = false;
VectrexSubMenu.Visible = false;
MSXSubMenu.Visible = false;
O2HawkSubMenu.Visible = false;
arcadeToolStripMenuItem.Visible = false;

@@ -1936,6 +1937,9 @@ private void HandlePlatformMenus()
case "VEC":
VectrexSubMenu.Visible = true;
break;
case "MSX":
MSXSubMenu.Visible = true;
break;
case "O2":
O2HawkSubMenu.Visible = true;
break;
@@ -55,7 +55,8 @@ public partial class FirmwaresConfig : Form
["ZXSpectrum"] = "ZX Spectrum",
["AmstradCPC"] = "Amstrad CPC",
["ChannelF"] = "Channel F",
["Vectrex"] = "Vectrex"
["Vectrex"] = "Vectrex",
["MSX"] = "MSX",
};

public string TargetSystem { get; set; }
@@ -38,7 +38,8 @@ public class SystemLookup
new SystemInfo { SystemId = "AmstradCPC", FullName = "Amstrad CPC" },
new SystemInfo { SystemId = "ChannelF", FullName = "Fairchild Channel F"},
new SystemInfo { SystemId = "O2", FullName = "Odyssey2"},
new SystemInfo { SystemId = "VEC", FullName = "Vectrex"}
new SystemInfo { SystemId = "VEC", FullName = "Vectrex"},
new SystemInfo { SystemId = "MSX", FullName = "MSX"}
};

public SystemInfo this[string systemId]
@@ -10,11 +10,11 @@ namespace BizHawk.Emulation.Cores.Computers.MSX
public static class LibMSX
{
/// <returns>opaque state pointer</returns>
[DllImport("libMSX.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport("MSXHAWK.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr MSX_create();

/// <param name="core">opaque state pointer</param>
[DllImport("libMSX.dll", CallingConvention = CallingConvention.Cdecl)]
[DllImport("MSXHAWK.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void MSX_destroy(IntPtr core);
}
}
@@ -3,7 +3,7 @@

namespace BizHawk.Emulation.Cores.Computers.MSX
{
public partial class MSX : IEmulator, ISoundProvider
public partial class MSX : IEmulator, ISoundProvider, IVideoProvider
{
public IEmulatorServiceProvider ServiceProvider { get; }

@@ -23,7 +23,7 @@ public bool FrameAdvance(IController controller, bool render, bool rendersound)
_controller = controller;
_lagged = true;
_frame++;

/*
if (Tracer.Enabled)
{
@@ -32,7 +32,7 @@ public bool FrameAdvance(IController controller, bool render, bool rendersound)
{
}

*/
if (_lagged)
{
_lagCount++;
@@ -63,6 +63,12 @@ public void ResetCounters()

public void Dispose()
{
if (MSX_Pntr != IntPtr.Zero)
{
LibMSX.MSX_destroy(MSX_Pntr);
MSX_Pntr = IntPtr.Zero;
}

if (blip_L != null)
{
blip_L.Dispose();
@@ -129,5 +135,31 @@ public void DiscardSamples()

#endregion

#region Video
public int _frameHz = 60;

public int[] _vidbuffer;

public int[] frame_buffer = new int[160 * 144];

public int[] GetVideoBuffer()
{
return frame_buffer;
}

public int VirtualWidth => 160;
public int VirtualHeight => 144;
public int BufferWidth => 160;
public int BufferHeight => 144;
public int BackgroundColor => unchecked((int)0xFF000000);
public int VsyncNumerator => _frameHz;
public int VsyncDenominator => 1;

public static readonly uint[] color_palette_BW = { 0xFFFFFFFF, 0xFFAAAAAA, 0xFF555555, 0xFF000000 };
public static readonly uint[] color_palette_Gr = { 0xFFA4C505, 0xFF88A905, 0xFF1D551D, 0xFF052505 };

public uint[] color_palette = new uint[4];

#endregion
}
}
@@ -1,4 +1,10 @@
using BizHawk.Emulation.Common;
using System;
using System.ComponentModel;

using Newtonsoft.Json;

using BizHawk.Common;
using BizHawk.Emulation.Common;

namespace BizHawk.Emulation.Cores.Computers.MSX
{
@@ -34,8 +40,15 @@ public bool PutSyncSettings(MSXSyncSettings o)
public class MSXSettings
{
// graphics settings
public bool DispBG = true;
public bool DispOBJ = true;
[DisplayName("Show Background")]
[Description("Display BG Layer")]
[DefaultValue(true)]
public bool DispBG { get; set; }

[DisplayName("Show Sprites")]
[Description("Display Sprites")]
[DefaultValue(true)]
public bool DispOBJ { get; set; }

public MSXSettings Clone()
{
@@ -10,7 +10,7 @@ namespace BizHawk.Emulation.Cores.Computers.MSX
isPorted: false,
isReleased: false)]
[ServiceNotApplicable(typeof(IDriveLight))]
public partial class MSX : IEmulator, ISaveRam, IStatable, IInputPollable, IRegionable, ISettable<MSX.MSXSettings, MSX.MSXSyncSettings>
public partial class MSX : IEmulator, IVideoProvider, ISaveRam, IStatable, IInputPollable, IRegionable, ISettable<MSX.MSXSettings, MSX.MSXSyncSettings>
{
[CoreConstructor("MSX")]
public MSX(CoreComm comm, GameInfo game, byte[] rom, object settings, object syncSettings)
@@ -27,27 +27,28 @@ public MSX(CoreComm comm, GameInfo game, byte[] rom, object settings, object syn
Array.Resize(ref RomData, ((RomData.Length / BankSize) + 1) * BankSize);
}

MSX_Pntr = LibMSX.MSX_create();

blip_L.SetRates(3579545, 44100);
blip_R.SetRates(3579545, 44100);

(ServiceProvider as BasicServiceProvider).Register<ISoundProvider>(this);

SetupMemoryDomains();

//this manages the linkage between the cpu and mapper callbacks so it needs running before bootup is complete
((ICodeDataLogger)this).SetCDL(null);

InputCallbacks = new InputCallbackSystem();

var serviceProvider = ServiceProvider as BasicServiceProvider;
serviceProvider.Register<ITraceable>(Tracer);
//var serviceProvider = ServiceProvider as BasicServiceProvider;
//serviceProvider.Register<ITraceable>(Tracer);
}

public void HardReset()
{

}

IntPtr MSX_Pntr { get; set; } = IntPtr.Zero;

// Constants
private const int BankSize = 16384;

@@ -16,12 +16,32 @@ namespace MSXHawk
public:
MSXCore()
{

cpu.HW_Write = &HardwareWrite;
};

VDP vdp;
Z80A cpu;
SN76489sms psg;

unsigned char* rom;
unsigned int rom_size;
unsigned char ram[0x2000];

static void HardwareWrite(uint8_t value)
{

}

// memory map
unsigned char* Memory_Map[8];

void Load_ROM(unsigned char* ext_rom, unsigned int ext_rom_size)
{
rom = ext_rom;
rom_size = ext_rom_size;

Memory_Map[0] = &rom[0];
}
};
}

@@ -6,10 +6,15 @@

using namespace MSXHawk;

// This is an example of an exported variable
MSXHAWK_EXPORT int nMSXHawk=0;

// This is an example of an exported function.
MSXHAWK_EXPORT MSXCore* MSX_create() {
// Create pointer to a core instance
MSXHAWK_EXPORT MSXCore* MSX_create()
{
return new MSXCore();
}
}

// free the memory from the core pointer
MSXHAWK_EXPORT void MSX_destroy(MSXCore* p)
{
std::free(p);
}

@@ -26,6 +26,11 @@ namespace MSXHawk
uint8_t Registers[16] = { 0x06, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFB, 0xF0, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00 };
uint8_t Statusuint8_t;

static void TO_REGS(uint8_t value)
{

}

const int Command_VramRead = 0x00;
const int Command_VramWrite = 0x40;
const int Command_RegisterWrite = 0x80;
@@ -20,6 +20,8 @@ namespace MSXHawk
uint8_t* HWMemoryMap;
uint8_t* HWMemoryMapMask;

void (*HW_Write)(uint8_t);

// when connected devices do not output a value on the BUS, they are responsible for determining open bus behaviour and returning it
int ExternalDB;