SMS: port 3E emulation; fixes remaining BIOS roms; check out the rocking Japanese BIOS music!
This commit is contained in:
parent
0e06b08f91
commit
d35d9e9d29
|
@ -3,7 +3,7 @@
|
|||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
|
|
|
@ -77,5 +77,50 @@
|
|||
WriteMemory(0xFFFE, 1);
|
||||
WriteMemory(0xFFFF, 2);
|
||||
}
|
||||
|
||||
// Mapper when loading a BIOS as a ROM
|
||||
|
||||
private bool BiosMapped { get { return (Port3E & 0x08) == 0; } }
|
||||
|
||||
private byte ReadMemoryBIOS(ushort address)
|
||||
{
|
||||
if (BiosMapped == false && address < BankSize * 3)
|
||||
return 0x00;
|
||||
|
||||
if (address < 1024)
|
||||
return RomData[address];
|
||||
if (address < BankSize)
|
||||
return RomData[(RomBank0 * BankSize) + address];
|
||||
if (address < BankSize * 2)
|
||||
return RomData[(RomBank1 * BankSize) + (address & BankSizeMask)];
|
||||
if (address < BankSize * 3)
|
||||
return RomData[(RomBank2 * BankSize) + (address & BankSizeMask)];
|
||||
|
||||
return SystemRam[address & RamSizeMask];
|
||||
}
|
||||
|
||||
private void WriteMemoryBIOS(ushort address, byte value)
|
||||
{
|
||||
if (address >= 0xC000)
|
||||
SystemRam[address & RamSizeMask] = value;
|
||||
|
||||
if (address >= 0xFFFC)
|
||||
{
|
||||
if (address == 0xFFFD) RomBank0 = (byte)(value % RomBanks);
|
||||
else if (address == 0xFFFE) RomBank1 = (byte)(value % RomBanks);
|
||||
else if (address == 0xFFFF) RomBank2 = (byte)(value % RomBanks);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitBiosMapper()
|
||||
{
|
||||
Cpu.ReadMemory = ReadMemoryBIOS;
|
||||
Cpu.WriteMemory = WriteMemoryBIOS;
|
||||
WriteMemory(0xFFFC, 0);
|
||||
WriteMemory(0xFFFD, 0);
|
||||
WriteMemory(0xFFFE, 1);
|
||||
WriteMemory(0xFFFF, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,14 +10,13 @@ using BizHawk.Emulation.Sound;
|
|||
|
||||
TODO:
|
||||
+ HCounter
|
||||
+ Port 3F emulation (Japanese BIOS)
|
||||
+ Try to clean up the organization of the source code.
|
||||
+ Fix remaining broken games
|
||||
|
||||
**********************************************************/
|
||||
|
||||
namespace BizHawk.Emulation.Consoles.Sega
|
||||
{
|
||||
|
||||
public sealed partial class SMS : IEmulator
|
||||
{
|
||||
// Constants
|
||||
|
@ -54,19 +53,7 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
private byte Port3E = 0xAF;
|
||||
private byte Port3F = 0xFF;
|
||||
|
||||
private int scanlinesPerFrame;
|
||||
|
||||
private DisplayType displayType;
|
||||
public DisplayType DisplayType
|
||||
{
|
||||
get { return displayType; }
|
||||
set
|
||||
{
|
||||
displayType = value;
|
||||
scanlinesPerFrame = displayType == DisplayType.NTSC ? 262 : 313;
|
||||
}
|
||||
}
|
||||
|
||||
public DisplayType DisplayType { get; set; }
|
||||
public bool DeterministicEmulation { get; set; }
|
||||
|
||||
public void Init()
|
||||
|
@ -82,16 +69,22 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
Vdp = new VDP(Cpu, IsGameGear ? VdpMode.GameGear : VdpMode.SMS, DisplayType);
|
||||
PSG = new SN76489();
|
||||
YM2413 = new YM2413();
|
||||
SoundMixer = new SoundMixer(PSG, YM2413);
|
||||
SoundMixer = new SoundMixer(YM2413, PSG);
|
||||
if (HasYM2413 && Options.Contains("WhenFMDisablePSG"))
|
||||
SoundMixer.DisableSource(PSG);
|
||||
ActiveSoundProvider = PSG;
|
||||
ActiveSoundProvider = HasYM2413 ? (ISoundProvider) SoundMixer : PSG;
|
||||
|
||||
SystemRam = new byte[0x2000];
|
||||
if (Options.Contains("CMMapper") == false)
|
||||
InitSegaMapper();
|
||||
else
|
||||
InitCodeMastersMapper();
|
||||
|
||||
if (Options.Contains("BIOS"))
|
||||
{
|
||||
Port3E = 0xF7; // Disable cartridge, enable BIOS rom
|
||||
InitBiosMapper();
|
||||
}
|
||||
SetupMemoryDomains();
|
||||
}
|
||||
|
||||
|
@ -126,6 +119,7 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
case 0x04: return 0xFF;
|
||||
case 0x05: return 0x00;
|
||||
case 0x06: return 0xFF;
|
||||
case 0x3E: return Port3E;
|
||||
case 0x7E: return Vdp.ReadVLineCounter();
|
||||
case 0x7F: break; // hline counter TODO
|
||||
case 0xBE: return Vdp.ReadData();
|
||||
|
@ -134,13 +128,7 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
case 0xDC: return ReadControls1();
|
||||
case 0xC1:
|
||||
case 0xDD: return ReadControls2();
|
||||
case 0xF2:
|
||||
if (HasYM2413)
|
||||
{
|
||||
ActiveSoundProvider = SoundMixer;
|
||||
return YM2413.DetectionValue;
|
||||
}
|
||||
break;
|
||||
case 0xF2: return HasYM2413 ? YM2413.DetectionValue : (byte) 0xFF;
|
||||
}
|
||||
return 0xFF;
|
||||
}
|
||||
|
@ -152,6 +140,7 @@ namespace BizHawk.Emulation.Consoles.Sega
|
|||
case 0x01: Port01 = value; break;
|
||||
case 0x02: Port02 = value; break;
|
||||
case 0x06: PSG.StereoPanning = value; break;
|
||||
case 0x3E: Port3E = value; break;
|
||||
case 0x3F: Port3F = value; break;
|
||||
case 0x7E:
|
||||
case 0x7F: PSG.WritePsgData(value, Cpu.TotalExecutedCycles); break;
|
||||
|
|
|
@ -52,7 +52,7 @@ B33817AE T Alex Kidd in Miracle World [v1] (FR) [A] SMS Floflo
|
|||
1BE4314A T Alex Kidd in Miracle World [v1] (FR) [C] SMS Terminus Traduction; v1.0
|
||||
5BCD77ED T Alex Kidd in Miracle World [v1] (IT) SMS
|
||||
2C08872B H Alex Kidd in Miracle World [Playpal hack] SMS Alex Kidd in Miracle World [v1]; hacked to make it compatible with the PlayPal/Coleco hardware
|
||||
CF4A09EA I Alex Kidd in Miracle World [BIOS] SMS
|
||||
CF4A09EA I Alex Kidd in Miracle World [BIOS] SMS BIOS
|
||||
5C4CA816 H Alex Kidd in Miracle World [BIOS] [Game hack] SMS Alex Kidd in Miracle World [BIOS]; hacked to skip the BIOS checks and boot to the game
|
||||
9C5BAD91 I Alex Kidd in Miracle World [BIOS] (KR) SMS
|
||||
08C9EC91 Alex Kidd no Miracle World (JP) SMS
|
||||
|
@ -462,7 +462,7 @@ A77F996F F Hang On (BR) [A] (h) SMS
|
|||
1C5059F0 Hang On & Astro Warrior (US) SMS
|
||||
E167A561 Hang On & Safari Hunt SMS
|
||||
C5083000 V Hang On & Safari Hunt (bad dump) SMS Blank 16KB from 1C000 to fix
|
||||
91E93385 I Hang On & Safari Hunt [BIOS] SMS
|
||||
91E93385 I Hang On & Safari Hunt [BIOS] SMS BIOS
|
||||
BC05774F D Happy 10! SMS blind_io; SMS Power Sega 8-bit Coding Competition 2007 entry
|
||||
07C39BA4 D Happy Looser SMS Zoop (Bock); Y2Kode entry
|
||||
922954C6 B Happy Looser (7 bad bytes) SMS
|
||||
|
@ -902,7 +902,7 @@ E4CD2EDD D SMS APA Demo [v0.02] SMS Haroldo O. Pinheiro
|
|||
5AD6EDAC H SMS BIOS (US v1.3) [Hack] SMS SMS BIOS (US v1.3) to make it play the snail game when loaded as a ROM
|
||||
0072ED54 I SMS BIOS (US v1.3) SMS
|
||||
AD31C5FF D SMS Boot Loader SMS Bock; v0.9
|
||||
48D44A13 I SMS Japanese (v2.1) [BIOS] SMS
|
||||
48D44A13 I SMS Japanese (v2.1) [BIOS] SMS BIOS;FM
|
||||
1A15DFCC I SMS Prototype (M404) [BIOS] SMS
|
||||
EE2C29BA I SMS Store Display Unit [BIOS] (non-functional) SMS Different memory map; v1.3
|
||||
97B89878 D SMS Cast SMS Bock
|
||||
|
@ -946,7 +946,7 @@ B519E833 Sonic The Hedgehog SMS
|
|||
CD1BAC10 F Sonic The Hedgehog (f) SMS F
|
||||
246564E6 V Sonic The Hedgehog (bad dump) SMS Very bad
|
||||
48806FF7 T Sonic The Hedgehog (FR) SMS Terminus Traduction; v1.00
|
||||
81C3476B I Sonic The Hedgehog [BIOS] SMS
|
||||
81C3476B I Sonic The Hedgehog [BIOS] SMS BIOS
|
||||
4B3C7752 H Sonic 1 Sprite Hack SMS Sonic The Hedgehog by Ambil
|
||||
5B3B922C Sonic The Hedgehog 2 [v0] SMS
|
||||
CD85F7C5 F Sonic The Hedgehog 2 [v0] (f) SMS F
|
||||
|
|
Loading…
Reference in New Issue