VS System initial commits
This commit is contained in:
parent
e6673f89f9
commit
f35d14a8b4
|
@ -37,6 +37,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
|
|
||||||
//variable to change controller read/write behaviour when keyboard is attached
|
//variable to change controller read/write behaviour when keyboard is attached
|
||||||
public bool _iskeyboard = false;
|
public bool _iskeyboard = false;
|
||||||
|
//variable set when VS system games are running
|
||||||
|
public bool _isVS = false;
|
||||||
|
//since prg reg for VS System is set in the controller regs, it is convenient to have it here
|
||||||
|
//instead of in the board
|
||||||
|
public byte VS_chr_reg;
|
||||||
|
public byte VS_prg_reg;
|
||||||
|
//various VS controls
|
||||||
|
public byte[] VS_dips = new byte[8];
|
||||||
|
public byte VS_service = 0;
|
||||||
|
public byte VS_coin_inserted=0;
|
||||||
|
public byte VS_ROM_control;
|
||||||
|
|
||||||
// new input system
|
// new input system
|
||||||
NESControlSettings ControllerSettings; // this is stored internally so that a new change of settings won't replace
|
NESControlSettings ControllerSettings; // this is stored internally so that a new change of settings won't replace
|
||||||
|
@ -272,7 +283,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
ram[0x701] = 0xFF;
|
ram[0x701] = 0xFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,6 +526,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
case 0x4014: /*OAM DMA*/ break;
|
case 0x4014: /*OAM DMA*/ break;
|
||||||
case 0x4015: return (byte)((byte)(apu.ReadReg(addr) & 0xDF) + (byte)(DB & 0x20));
|
case 0x4015: return (byte)((byte)(apu.ReadReg(addr) & 0xDF) + (byte)(DB & 0x20));
|
||||||
case 0x4016:
|
case 0x4016:
|
||||||
|
if (_isVS)
|
||||||
|
{
|
||||||
|
byte ret = 0;
|
||||||
|
// for whatever reason, in VS left and right controller have swapped regs
|
||||||
|
ret = read_joyport(0x4017);
|
||||||
|
ret &= 1;
|
||||||
|
ret = (byte)(ret | (VS_service << 2) | (VS_dips[0] << 3) | (VS_dips[1] << 4) | (VS_coin_inserted << 5) | (VS_ROM_control<<7));
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// special hardware glitch case
|
// special hardware glitch case
|
||||||
ret_spec = read_joyport(addr);
|
ret_spec = read_joyport(addr);
|
||||||
|
@ -534,6 +555,18 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
// eventually this will be the keyboard function, but for now it is a place holder (no keys pressed)
|
// eventually this will be the keyboard function, but for now it is a place holder (no keys pressed)
|
||||||
return 0x1E;
|
return 0x1E;
|
||||||
}
|
}
|
||||||
|
else if (_isVS)
|
||||||
|
{
|
||||||
|
byte ret = 0;
|
||||||
|
// for whatever reason, in VS left and right controller have swapped regs
|
||||||
|
ret = read_joyport(0x4016);
|
||||||
|
ret &= 1;
|
||||||
|
|
||||||
|
ret = (byte)(ret | (VS_dips[2] << 2) | (VS_dips[3] << 3) | (VS_dips[4] << 4) | (VS_dips[5] << 5) | (VS_dips[6] << 6) | (VS_dips[7] << 7));
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return read_joyport(addr);
|
return read_joyport(addr);
|
||||||
|
@ -618,6 +651,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
{
|
{
|
||||||
// eventually keyboard emulation will go here
|
// eventually keyboard emulation will go here
|
||||||
}
|
}
|
||||||
|
else if (_isVS)
|
||||||
|
{
|
||||||
|
write_joyport(val);
|
||||||
|
VS_chr_reg = (byte)((val & 0x4)>>2);
|
||||||
|
|
||||||
|
//TODO: does other stuff for dual system
|
||||||
|
|
||||||
|
//this is actually different then assignment
|
||||||
|
VS_prg_reg = (byte)((val & 0x4)>>2);
|
||||||
|
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
write_joyport(val);
|
write_joyport(val);
|
||||||
|
@ -666,7 +710,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
/// Sets the provided palette as current.
|
/// Sets the provided palette as current.
|
||||||
/// Applies the current deemph settings if needed to expand a 64-entry palette to 512
|
/// Applies the current deemph settings if needed to expand a 64-entry palette to 512
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void SetPalette(byte[,] pal)
|
public void SetPalette(byte[,] pal)
|
||||||
{
|
{
|
||||||
int nColors = pal.GetLength(0);
|
int nColors = pal.GetLength(0);
|
||||||
int nElems = pal.GetLength(1);
|
int nElems = pal.GetLength(1);
|
||||||
|
|
|
@ -76,8 +76,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
ser.Sync("special_case_delay", ref special_case_delay);
|
ser.Sync("special_case_delay", ref special_case_delay);
|
||||||
ser.Sync("do_the_reread", ref do_the_reread);
|
ser.Sync("do_the_reread", ref do_the_reread);
|
||||||
|
|
||||||
|
//VS related
|
||||||
|
ser.Sync("VS", ref _isVS);
|
||||||
|
ser.Sync("VS_CHR", ref VS_chr_reg);
|
||||||
|
ser.Sync("VS_PRG", ref VS_prg_reg);
|
||||||
|
ser.Sync("VS_DIPS", ref VS_dips, false);
|
||||||
|
ser.Sync("VS_Service", ref VS_service);
|
||||||
|
ser.Sync("VS_Coin", ref VS_coin_inserted);
|
||||||
|
ser.Sync("VS_ROM_Control", ref VS_ROM_control);
|
||||||
|
|
||||||
ser.BeginSection("Board");
|
ser.BeginSection("Board");
|
||||||
Board.SyncState(ser);
|
Board.SyncState(ser);
|
||||||
if (Board is NESBoardBase && !((NESBoardBase)Board).SyncStateFlag)
|
if (Board is NESBoardBase && !((NESBoardBase)Board).SyncStateFlag)
|
||||||
throw new InvalidOperationException("the current NES mapper didnt call base.SyncState");
|
throw new InvalidOperationException("the current NES mapper didnt call base.SyncState");
|
||||||
|
|
|
@ -57,6 +57,17 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
}
|
}
|
||||||
PutSettings((NESSettings)Settings ?? new NESSettings());
|
PutSettings((NESSettings)Settings ?? new NESSettings());
|
||||||
|
|
||||||
|
// we need to put this here because the line directly above will overwrite palette intialization anywhere else
|
||||||
|
if (_isVS)
|
||||||
|
{
|
||||||
|
Console.WriteLine(palette_compiled[0]);
|
||||||
|
//Settings.Palette = (byte[,])Palettes.palette_2c04.Clone();
|
||||||
|
SetPalette(Palettes.palette_2c04_B);
|
||||||
|
Console.WriteLine(palette_compiled[0]);
|
||||||
|
Console.WriteLine(Palettes.QuickNESPalette[0, 0]);
|
||||||
|
Console.WriteLine(Palettes.palette_2c04[0, 0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ser.Register<IDisassemblable>(cpu);
|
ser.Register<IDisassemblable>(cpu);
|
||||||
|
|
||||||
|
|
|
@ -187,5 +187,74 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
|
||||||
{0, 0, 0},
|
{0, 0, 0},
|
||||||
{0, 0, 0},
|
{0, 0, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static byte[,] palette_2c04_B =
|
||||||
|
{
|
||||||
|
{4<<5, 3<<5, 0<<5},
|
||||||
|
{3<<5, 2<<5, 6<<5},
|
||||||
|
{0<<5, 4<<5, 4<<5},
|
||||||
|
{6<<5, 6<<5, 0<<5},
|
||||||
|
{0<<5, 0<<5, 0<<5},
|
||||||
|
{7<<5, 5<<5, 5<<5},
|
||||||
|
{0<<5, 1<<5, 4<<5},
|
||||||
|
{6<<5, 3<<5, 0<<5},
|
||||||
|
{5<<5, 5<<5, 5<<5},
|
||||||
|
{3<<5, 1<<5, 0<<5},
|
||||||
|
{0<<5, 7<<5, 0<<5},
|
||||||
|
{0<<5, 0<<5, 3<<5},
|
||||||
|
{7<<5, 6<<5, 4<<5},
|
||||||
|
{7<<5, 7<<5, 0<<5},
|
||||||
|
{0<<5, 4<<5, 0<<5},
|
||||||
|
{5<<5, 7<<5, 2<<5},
|
||||||
|
{7<<5, 3<<5, 7<<5},
|
||||||
|
{2<<5, 0<<5, 0<<5},
|
||||||
|
{0<<5, 2<<5, 7<<5},
|
||||||
|
{7<<5, 4<<5, 7<<5},
|
||||||
|
{0<<5, 0<<5, 0<<5},
|
||||||
|
{2<<5, 2<<5, 2<<5},
|
||||||
|
{5<<5, 1<<5, 0<<5},
|
||||||
|
{7<<5, 4<<5, 0<<5},
|
||||||
|
{6<<5, 5<<5, 3<<5},
|
||||||
|
{0<<5, 5<<5, 3<<5},
|
||||||
|
{4<<5, 4<<5, 7<<5},
|
||||||
|
{1<<5, 4<<5, 0<<5},
|
||||||
|
{4<<5, 0<<5, 3<<5},
|
||||||
|
{0<<5, 0<<5, 0<<5},
|
||||||
|
{4<<5, 7<<5, 3<<5},
|
||||||
|
{3<<5, 5<<5, 7<<5},
|
||||||
|
{5<<5, 0<<5, 3<<5},
|
||||||
|
{0<<5, 3<<5, 1<<5},
|
||||||
|
{4<<5, 2<<5, 0<<5},
|
||||||
|
{0<<5, 0<<5, 6<<5},
|
||||||
|
{4<<5, 0<<5, 7<<5},
|
||||||
|
{5<<5, 0<<5, 7<<5},
|
||||||
|
{3<<5, 3<<5, 3<<5},
|
||||||
|
{7<<5, 0<<5, 4<<5},
|
||||||
|
{0<<5, 2<<5, 2<<5},
|
||||||
|
{6<<5, 6<<5, 6<<5},
|
||||||
|
{0<<5, 3<<5, 6<<5},
|
||||||
|
{0<<5, 2<<5, 0<<5},
|
||||||
|
{1<<5, 1<<5, 1<<5},
|
||||||
|
{7<<5, 7<<5, 3<<5},
|
||||||
|
{4<<5, 4<<5, 4<<5},
|
||||||
|
{7<<5, 0<<5, 7<<5},
|
||||||
|
{7<<5, 5<<5, 7<<5},
|
||||||
|
{7<<5, 7<<5, 7<<5},
|
||||||
|
{3<<5, 2<<5, 0<<5},
|
||||||
|
{7<<5, 0<<5, 0<<5},
|
||||||
|
{7<<5, 6<<5, 0<<5},
|
||||||
|
{2<<5, 7<<5, 6<<5},
|
||||||
|
{7<<5, 7<<5, 7<<5},
|
||||||
|
{4<<5, 6<<5, 7<<5},
|
||||||
|
{0<<5, 0<<5, 0<<5},
|
||||||
|
{7<<5, 5<<5, 0<<5},
|
||||||
|
{6<<5, 3<<5, 7<<5},
|
||||||
|
{5<<5, 6<<5, 7<<5},
|
||||||
|
{3<<5, 6<<5, 0<<5},
|
||||||
|
{6<<5, 5<<5, 7<<5},
|
||||||
|
{0<<5, 7<<5, 7<<5},
|
||||||
|
{1<<5, 2<<5, 0<<5},
|
||||||
|
};
|
||||||
|
|
||||||
} //class palettes
|
} //class palettes
|
||||||
} //namespace
|
} //namespace
|
||||||
|
|
Loading…
Reference in New Issue