[PCE] TurboCD Battery RAM implemented

This commit is contained in:
beirich 2011-06-19 01:37:09 +00:00
parent e250355024
commit 8b00da908e
6 changed files with 92 additions and 12 deletions

View File

@ -111,6 +111,7 @@
<Compile Include="Consoles\Nintendo\NES\PPU.cs" />
<Compile Include="Consoles\Nintendo\NES\PPU.regs.cs" />
<Compile Include="Consoles\Nintendo\NES\PPU.run.cs" />
<Compile Include="Consoles\PC Engine\TurboCD.cs" />
<Compile Include="Consoles\Sega\SMS\MemoryMap.CodeMasters.cs" />
<Compile Include="Consoles\Sega\SMS\MemoryMap.Sega.cs" />
<Compile Include="Consoles\Sega\SMS\VDP.ModeTMS.cs" />

View File

@ -11,19 +11,20 @@ General:
Air Zonk - Fully playable, doesn't freeze, but some gfx/timing issues
Battle Ace - Some gfx glitches
Cadash - Minor raster issue. Timing sensitive game.
Chase HQ - Press start -"O" sprite gets left on screen. probably timing on SATB DMA
Coryoon - Recent VDC updates broke scrolling. Generally timing sensitive game.
Cross Wiber - Minor; Raster on wrong line
Davis Cup Tennis - Some timing issue, splash screen is too slow
Dungeon Explorer - Freeze in 'intro' - gfx corruption in-game
Fighting Run - Corruption issues
Gunboat - Crash / CPU Break (Needs BRAM)
Legend of Hero Ton- Slight gfx- check top of screen
Lode Runner - Freezes in new game
Madoo Granzort - Graphics issues because SGX VPC renderer is not using new frame timing
MML Demo - Echo channels are too loud (equal volume!)
Outrun - Raster issues, music slows when paused
Outrun - OK currently but timing sensitive game for future testing
Paranoia - Game hits BREAK on 3rd level. need to investigate
Populous - Game freezes on starting new game - *** NEEDS BATTERY SAVERAM ***
Populous - Game freezes on starting new game - unclear if related to battery RAM
Power Drift - Timing glitch... starting new game runs slower than it should
Power Tennis - Elaborate intro screen doesnt display right
Raiden - Sprites and BG get out of sync with current timing

View File

@ -63,8 +63,8 @@
if (Region == "Japan") value |= 0x40;
if (Type != NecSystemType.TurboCD)
value |= 0x80;
/*if (Type != NecSystemType.TurboCD)
value |= 0x80;*/
return value;
}

View File

@ -23,6 +23,18 @@
if ((addr & ~1) == 0x1FF400) return IOBuffer;
if (addr == 0x1FF402) { IOBuffer = (byte) (Cpu.IRQControlByte | (IOBuffer & 0xF8)); return IOBuffer; }
if (addr == 0x1FF403) { IOBuffer = (byte) (Cpu.ReadIrqStatus() | (IOBuffer & 0xF8)); return IOBuffer; }
if (addr >= 0x1FF800) return ReadCD(addr);
}
if (addr >= 0x1EE000 && addr <= 0x1EE7FF) // BRAM
{
if (BramEnabled && BramLocked == false)
{
System.Console.WriteLine("READ BRAM[{0}] ; ret {1:X2}", addr & 0x7FF, BRAM[addr & 0x7FF]);
return BRAM[addr & 0x7FF];
}
System.Console.WriteLine("attemped BRAM read while locked");
return 0xFF;
}
Log.Error("MEM", "UNHANDLED READ: {0:X6}", addr);
@ -49,8 +61,21 @@
addr < 0x1FF400) { IOBuffer = value; WriteInput(value); }
else if (addr == 0x1FF402) { IOBuffer = value; Cpu.WriteIrqControl(value); }
else if (addr == 0x1FF403) { IOBuffer = value; Cpu.WriteIrqStatus(); }
else if (addr >= 0x1FF800) { WriteCD(addr, value); }
else Log.Error("MEM", "unhandled hardware write [{0:X6}] : {1:X2}", addr, value);
}
else if (addr >= 0x1EE000 && addr <= 0x1EE7FF) // BRAM
{
if (BramEnabled && BramLocked == false)
{
System.Console.WriteLine("WRITE BRAM[{0}] : {1:X2}", addr & 0x7FF, value);
BRAM[addr & 0x7FF] = value;
SaveRamModified = true;
}
else System.Console.WriteLine("attemped BRAM write while locked!");
}
else
Log.Error("MEM","UNHANDLED WRITE: {0:X6}:{1:X2}",addr,value);
}

View File

@ -31,6 +31,11 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
private bool TurboGrafx { get { return Type == NecSystemType.TurboGrafx; } }
private bool SuperGrafx { get { return Type == NecSystemType.SuperGrafx; } }
private bool TurboCD { get { return Type == NecSystemType.TurboCD; } }
// BRAM
private bool BramEnabled = false;
private bool BramLocked = true;
private byte[] BRAM;
// Memory system
public byte[] Ram;
@ -92,6 +97,18 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
RomData = game.GetRomData();
RomLength = RomData.Length;
}
if (game.GetOptions().Contains("BRAM"))
{
BramEnabled = true;
BRAM = new byte[2048];
Console.WriteLine("ENABLE BRAM!");
// pre-format BRAM
BRAM[0] = 0x48; BRAM[1] = 0x55; BRAM[2] = 0x42; BRAM[3] = 0x4D;
BRAM[4] = 0x00; BRAM[5] = 0x88; BRAM[6] = 0x10; BRAM[7] = 0x80;
}
Cpu.ResetPC();
SetupMemoryDomains();
}
@ -144,14 +161,10 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
public byte[] SaveRam
{
get { throw new NotImplementedException(); }
get { return BRAM; }
}
public bool SaveRamModified
{
get { return false; }
set { throw new NotImplementedException(); }
}
public bool SaveRamModified { get; set; }
public void SaveStateText(TextWriter writer)
{
@ -275,7 +288,10 @@ namespace BizHawk.Emulation.Consoles.TurboGrafx
public byte[] SaveStateBinary()
{
var buf = new byte[SuperGrafx ? 166552 : 75854];
int buflen = SuperGrafx ? 166552 : 75854;
if (BramEnabled) buflen += 2048;
var buf = new byte[buflen];
var stream = new MemoryStream(buf);
var writer = new BinaryWriter(stream);
SaveStateBinary(writer);

View File

@ -0,0 +1,37 @@
using System;
namespace BizHawk.Emulation.Consoles.TurboGrafx
{
public partial class PCEngine
{
private void WriteCD(int addr, byte value)
{
switch (addr & 0x1FFF)
{
case 0x1807:
if (BramEnabled && (value & 0x80) != 0)
{
Console.WriteLine("UNLOCK BRAM!");
BramLocked = false;
}
break;
}
}
public byte ReadCD(int addr)
{
switch (addr & 0x1FFF)
{
case 0x1803:
if (BramEnabled)
{
Console.WriteLine("LOCKED BRAM!");
BramLocked = true;
}
break;
}
return 0xFF;
}
}
}